/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source visit the plugins github repository (https://github.com/denolehov/obsidian-git) */ var Jk=Object.create;var Ca=Object.defineProperty;var Qk=Object.getOwnPropertyDescriptor;var eA=Object.getOwnPropertyNames;var tA=Object.getPrototypeOf,nA=Object.prototype.hasOwnProperty;var rA=(t,e,n)=>e in t?Ca(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var iA=(t,e)=>()=>(t&&(e=t(t=0)),e);var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),aA=(t,e)=>{for(var n in e)Ca(t,n,{get:e[n],enumerable:!0})},om=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of eA(e))!nA.call(t,i)&&i!==n&&Ca(t,i,{get:()=>e[i],enumerable:!(r=Qk(e,i))||r.enumerable});return t};var Ze=(t,e,n)=>(n=t!=null?Jk(tA(t)):{},om(e||!t||!t.__esModule?Ca(n,"default",{value:t,enumerable:!0}):n,t)),sA=t=>om(Ca({},"__esModule",{value:!0}),t);var ct=(t,e,n)=>rA(t,typeof e!="symbol"?e+"":e,n);var um=R(co=>{"use strict";v();co.byteLength=lA;co.toByteArray=uA;co.fromByteArray=dA;var vn=[],Zt=[],oA=typeof Uint8Array!="undefined"?Uint8Array:Array,pu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Tr=0,lm=pu.length;Tr0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");n===-1&&(n=e);var r=n===e?0:4-n%4;return[n,r]}function lA(t){var e=cm(t),n=e[0],r=e[1];return(n+r)*3/4-r}function cA(t,e,n){return(e+n)*3/4-n}function uA(t){var e,n=cm(t),r=n[0],i=n[1],a=new oA(cA(t,r,i)),s=0,o=i>0?r-4:r,l;for(l=0;l>16&255,a[s++]=e>>8&255,a[s++]=e&255;return i===2&&(e=Zt[t.charCodeAt(l)]<<2|Zt[t.charCodeAt(l+1)]>>4,a[s++]=e&255),i===1&&(e=Zt[t.charCodeAt(l)]<<10|Zt[t.charCodeAt(l+1)]<<4|Zt[t.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function fA(t){return vn[t>>18&63]+vn[t>>12&63]+vn[t>>6&63]+vn[t&63]}function hA(t,e,n){for(var r,i=[],a=e;ao?o:s+a));return r===1?(e=t[n-1],i.push(vn[e>>2]+vn[e<<4&63]+"==")):r===2&&(e=(t[n-2]<<8)+t[n-1],i.push(vn[e>>10]+vn[e>>4&63]+vn[e<<2&63]+"=")),i.join("")}});var fm=R(mu=>{v();mu.read=function(t,e,n,r,i){var a,s,o=i*8-r-1,l=(1<>1,u=-7,f=n?i-1:0,h=n?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-u)-1,d>>=-u,u+=o;u>0;a=a*256+t[e+f],f+=h,u-=8);for(s=a&(1<<-u)-1,a>>=-u,u+=r;u>0;s=s*256+t[e+f],f+=h,u-=8);if(a===0)a=1-c;else{if(a===l)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,r),a=a-c}return(d?-1:1)*s*Math.pow(2,a-r)};mu.write=function(t,e,n,r,i,a){var s,o,l,c=a*8-i-1,u=(1<>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:a-1,p=r?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+f>=1?e+=h/l:e+=h*Math.pow(2,1-f),e*l>=2&&(s++,l/=2),s+f>=u?(o=0,s=u):s+f>=1?(o=(e*l-1)*Math.pow(2,i),s=s+f):(o=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[n+d]=o&255,d+=p,o/=256,i-=8);for(s=s<0;t[n+d]=s&255,d+=p,s/=256,c-=8);t[n+d-p]|=g*128}});var Eu=R(ui=>{"use strict";v();var gu=um(),li=fm(),hm=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ui.Buffer=P;ui.SlowBuffer=wA;ui.INSPECT_MAX_BYTES=50;var uo=2147483647;ui.kMaxLength=uo;P.TYPED_ARRAY_SUPPORT=pA();!P.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function pA(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(t){return!1}}Object.defineProperty(P.prototype,"parent",{enumerable:!0,get:function(){if(P.isBuffer(this))return this.buffer}});Object.defineProperty(P.prototype,"offset",{enumerable:!0,get:function(){if(P.isBuffer(this))return this.byteOffset}});function Ln(t){if(t>uo)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,P.prototype),e}function P(t,e,n){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return bu(t)}return gm(t,e,n)}P.poolSize=8192;function gm(t,e,n){if(typeof t=="string")return gA(t,e);if(ArrayBuffer.isView(t))return yA(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(wn(t,ArrayBuffer)||t&&wn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(wn(t,SharedArrayBuffer)||t&&wn(t.buffer,SharedArrayBuffer)))return vu(t,e,n);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let r=t.valueOf&&t.valueOf();if(r!=null&&r!==t)return P.from(r,e,n);let i=vA(t);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return P.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}P.from=function(t,e,n){return gm(t,e,n)};Object.setPrototypeOf(P.prototype,Uint8Array.prototype);Object.setPrototypeOf(P,Uint8Array);function ym(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function mA(t,e,n){return ym(t),t<=0?Ln(t):e!==void 0?typeof n=="string"?Ln(t).fill(e,n):Ln(t).fill(e):Ln(t)}P.alloc=function(t,e,n){return mA(t,e,n)};function bu(t){return ym(t),Ln(t<0?0:xu(t)|0)}P.allocUnsafe=function(t){return bu(t)};P.allocUnsafeSlow=function(t){return bu(t)};function gA(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!P.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let n=vm(t,e)|0,r=Ln(n),i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}function yu(t){let e=t.length<0?0:xu(t.length)|0,n=Ln(e);for(let r=0;r=uo)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+uo.toString(16)+" bytes");return t|0}function wA(t){return+t!=t&&(t=0),P.alloc(+t)}P.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==P.prototype};P.compare=function(e,n){if(wn(e,Uint8Array)&&(e=P.from(e,e.offset,e.byteLength)),wn(n,Uint8Array)&&(n=P.from(n,n.offset,n.byteLength)),!P.isBuffer(e)||!P.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===n)return 0;let r=e.length,i=n.length;for(let a=0,s=Math.min(r,i);ai.length?(P.isBuffer(s)||(s=P.from(s)),s.copy(i,a)):Uint8Array.prototype.set.call(i,s,a);else if(P.isBuffer(s))s.copy(i,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=s.length}return i};function vm(t,e){if(P.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||wn(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let n=t.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return wu(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Tm(t).length;default:if(i)return r?-1:wu(t).length;e=(""+e).toLowerCase(),i=!0}}P.byteLength=vm;function bA(t,e,n){let r=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,e>>>=0,n<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return MA(this,e,n);case"utf8":case"utf-8":return bm(this,e,n);case"ascii":return CA(this,e,n);case"latin1":case"binary":return FA(this,e,n);case"base64":return AA(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return OA(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}P.prototype._isBuffer=!0;function Cr(t,e,n){let r=t[e];t[e]=t[n],t[n]=r}P.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;nn&&(e+=" ... "),""};hm&&(P.prototype[hm]=P.prototype.inspect);P.prototype.compare=function(e,n,r,i,a){if(wn(e,Uint8Array)&&(e=P.from(e,e.offset,e.byteLength)),!P.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(n===void 0&&(n=0),r===void 0&&(r=e?e.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),n<0||r>e.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&n>=r)return 0;if(i>=a)return-1;if(n>=r)return 1;if(n>>>=0,r>>>=0,i>>>=0,a>>>=0,this===e)return 0;let s=a-i,o=r-n,l=Math.min(s,o),c=this.slice(i,a),u=e.slice(n,r);for(let f=0;f2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Su(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof e=="string"&&(e=P.from(e,r)),P.isBuffer(e))return e.length===0?-1:dm(t,e,n,r,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):dm(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function dm(t,e,n,r,i){let a=1,s=t.length,o=e.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(t.length<2||e.length<2)return-1;a=2,s/=2,o/=2,n/=2}function l(u,f){return a===1?u[f]:u.readUInt16BE(f*a)}let c;if(i){let u=-1;for(c=n;cs&&(n=s-o),c=n;c>=0;c--){let u=!0;for(let f=0;fi&&(r=i)):r=i;let a=e.length;r>a/2&&(r=a/2);let s;for(s=0;s>>0,isFinite(r)?(r=r>>>0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let a=this.length-n;if((r===void 0||r>a)&&(r=a),e.length>0&&(r<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return xA(this,e,n,r);case"utf8":case"utf-8":return _A(this,e,n,r);case"ascii":case"latin1":case"binary":return SA(this,e,n,r);case"base64":return EA(this,e,n,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return kA(this,e,n,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};P.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function AA(t,e,n){return e===0&&n===t.length?gu.fromByteArray(t):gu.fromByteArray(t.slice(e,n))}function bm(t,e,n){n=Math.min(t.length,n);let r=[],i=e;for(;i239?4:a>223?3:a>191?2:1;if(i+o<=n){let l,c,u,f;switch(o){case 1:a<128&&(s=a);break;case 2:l=t[i+1],(l&192)===128&&(f=(a&31)<<6|l&63,f>127&&(s=f));break;case 3:l=t[i+1],c=t[i+2],(l&192)===128&&(c&192)===128&&(f=(a&15)<<12|(l&63)<<6|c&63,f>2047&&(f<55296||f>57343)&&(s=f));break;case 4:l=t[i+1],c=t[i+2],u=t[i+3],(l&192)===128&&(c&192)===128&&(u&192)===128&&(f=(a&15)<<18|(l&63)<<12|(c&63)<<6|u&63,f>65535&&f<1114112&&(s=f))}}s===null?(s=65533,o=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),i+=o}return TA(r)}var pm=4096;function TA(t){let e=t.length;if(e<=pm)return String.fromCharCode.apply(String,t);let n="",r=0;for(;rr)&&(n=r);let i="";for(let a=e;ar&&(e=r),n<0?(n+=r,n<0&&(n=0)):n>r&&(n=r),nn)throw new RangeError("Trying to access beyond buffer length")}P.prototype.readUintLE=P.prototype.readUIntLE=function(e,n,r){e=e>>>0,n=n>>>0,r||ut(e,n,this.length);let i=this[e],a=1,s=0;for(;++s>>0,n=n>>>0,r||ut(e,n,this.length);let i=this[e+--n],a=1;for(;n>0&&(a*=256);)i+=this[e+--n]*a;return i};P.prototype.readUint8=P.prototype.readUInt8=function(e,n){return e=e>>>0,n||ut(e,1,this.length),this[e]};P.prototype.readUint16LE=P.prototype.readUInt16LE=function(e,n){return e=e>>>0,n||ut(e,2,this.length),this[e]|this[e+1]<<8};P.prototype.readUint16BE=P.prototype.readUInt16BE=function(e,n){return e=e>>>0,n||ut(e,2,this.length),this[e]<<8|this[e+1]};P.prototype.readUint32LE=P.prototype.readUInt32LE=function(e,n){return e=e>>>0,n||ut(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};P.prototype.readUint32BE=P.prototype.readUInt32BE=function(e,n){return e=e>>>0,n||ut(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};P.prototype.readBigUInt64LE=Kn(function(e){e=e>>>0,ci(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&Fa(e,this.length-8);let i=n+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,a=this[++e]+this[++e]*2**8+this[++e]*2**16+r*2**24;return BigInt(i)+(BigInt(a)<>>0,ci(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&Fa(e,this.length-8);let i=n*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],a=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+r;return(BigInt(i)<>>0,n=n>>>0,r||ut(e,n,this.length);let i=this[e],a=1,s=0;for(;++s=a&&(i-=Math.pow(2,8*n)),i};P.prototype.readIntBE=function(e,n,r){e=e>>>0,n=n>>>0,r||ut(e,n,this.length);let i=n,a=1,s=this[e+--i];for(;i>0&&(a*=256);)s+=this[e+--i]*a;return a*=128,s>=a&&(s-=Math.pow(2,8*n)),s};P.prototype.readInt8=function(e,n){return e=e>>>0,n||ut(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};P.prototype.readInt16LE=function(e,n){e=e>>>0,n||ut(e,2,this.length);let r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};P.prototype.readInt16BE=function(e,n){e=e>>>0,n||ut(e,2,this.length);let r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};P.prototype.readInt32LE=function(e,n){return e=e>>>0,n||ut(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};P.prototype.readInt32BE=function(e,n){return e=e>>>0,n||ut(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};P.prototype.readBigInt64LE=Kn(function(e){e=e>>>0,ci(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&Fa(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(r<<24);return(BigInt(i)<>>0,ci(e,"offset");let n=this[e],r=this[e+7];(n===void 0||r===void 0)&&Fa(e,this.length-8);let i=(n<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<>>0,n||ut(e,4,this.length),li.read(this,e,!0,23,4)};P.prototype.readFloatBE=function(e,n){return e=e>>>0,n||ut(e,4,this.length),li.read(this,e,!1,23,4)};P.prototype.readDoubleLE=function(e,n){return e=e>>>0,n||ut(e,8,this.length),li.read(this,e,!0,52,8)};P.prototype.readDoubleBE=function(e,n){return e=e>>>0,n||ut(e,8,this.length),li.read(this,e,!1,52,8)};function Mt(t,e,n,r,i,a){if(!P.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}P.prototype.writeUintLE=P.prototype.writeUIntLE=function(e,n,r,i){if(e=+e,n=n>>>0,r=r>>>0,!i){let o=Math.pow(2,8*r)-1;Mt(this,e,n,r,o,0)}let a=1,s=0;for(this[n]=e&255;++s>>0,r=r>>>0,!i){let o=Math.pow(2,8*r)-1;Mt(this,e,n,r,o,0)}let a=r-1,s=1;for(this[n+a]=e&255;--a>=0&&(s*=256);)this[n+a]=e/s&255;return n+r};P.prototype.writeUint8=P.prototype.writeUInt8=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,1,255,0),this[n]=e&255,n+1};P.prototype.writeUint16LE=P.prototype.writeUInt16LE=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,2,65535,0),this[n]=e&255,this[n+1]=e>>>8,n+2};P.prototype.writeUint16BE=P.prototype.writeUInt16BE=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,2,65535,0),this[n]=e>>>8,this[n+1]=e&255,n+2};P.prototype.writeUint32LE=P.prototype.writeUInt32LE=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,4,4294967295,0),this[n+3]=e>>>24,this[n+2]=e>>>16,this[n+1]=e>>>8,this[n]=e&255,n+4};P.prototype.writeUint32BE=P.prototype.writeUInt32BE=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,4,4294967295,0),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e&255,n+4};function xm(t,e,n,r,i){Am(e,r,i,t,n,7);let a=Number(e&BigInt(4294967295));t[n++]=a,a=a>>8,t[n++]=a,a=a>>8,t[n++]=a,a=a>>8,t[n++]=a;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=s,s=s>>8,t[n++]=s,s=s>>8,t[n++]=s,s=s>>8,t[n++]=s,n}function _m(t,e,n,r,i){Am(e,r,i,t,n,7);let a=Number(e&BigInt(4294967295));t[n+7]=a,a=a>>8,t[n+6]=a,a=a>>8,t[n+5]=a,a=a>>8,t[n+4]=a;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=s,s=s>>8,t[n+2]=s,s=s>>8,t[n+1]=s,s=s>>8,t[n]=s,n+8}P.prototype.writeBigUInt64LE=Kn(function(e,n=0){return xm(this,e,n,BigInt(0),BigInt("0xffffffffffffffff"))});P.prototype.writeBigUInt64BE=Kn(function(e,n=0){return _m(this,e,n,BigInt(0),BigInt("0xffffffffffffffff"))});P.prototype.writeIntLE=function(e,n,r,i){if(e=+e,n=n>>>0,!i){let l=Math.pow(2,8*r-1);Mt(this,e,n,r,l-1,-l)}let a=0,s=1,o=0;for(this[n]=e&255;++a>0)-o&255;return n+r};P.prototype.writeIntBE=function(e,n,r,i){if(e=+e,n=n>>>0,!i){let l=Math.pow(2,8*r-1);Mt(this,e,n,r,l-1,-l)}let a=r-1,s=1,o=0;for(this[n+a]=e&255;--a>=0&&(s*=256);)e<0&&o===0&&this[n+a+1]!==0&&(o=1),this[n+a]=(e/s>>0)-o&255;return n+r};P.prototype.writeInt8=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,1,127,-128),e<0&&(e=255+e+1),this[n]=e&255,n+1};P.prototype.writeInt16LE=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,2,32767,-32768),this[n]=e&255,this[n+1]=e>>>8,n+2};P.prototype.writeInt16BE=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,2,32767,-32768),this[n]=e>>>8,this[n+1]=e&255,n+2};P.prototype.writeInt32LE=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,4,2147483647,-2147483648),this[n]=e&255,this[n+1]=e>>>8,this[n+2]=e>>>16,this[n+3]=e>>>24,n+4};P.prototype.writeInt32BE=function(e,n,r){return e=+e,n=n>>>0,r||Mt(this,e,n,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[n]=e>>>24,this[n+1]=e>>>16,this[n+2]=e>>>8,this[n+3]=e&255,n+4};P.prototype.writeBigInt64LE=Kn(function(e,n=0){return xm(this,e,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});P.prototype.writeBigInt64BE=Kn(function(e,n=0){return _m(this,e,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Sm(t,e,n,r,i,a){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Em(t,e,n,r,i){return e=+e,n=n>>>0,i||Sm(t,e,n,4,34028234663852886e22,-34028234663852886e22),li.write(t,e,n,r,23,4),n+4}P.prototype.writeFloatLE=function(e,n,r){return Em(this,e,n,!0,r)};P.prototype.writeFloatBE=function(e,n,r){return Em(this,e,n,!1,r)};function km(t,e,n,r,i){return e=+e,n=n>>>0,i||Sm(t,e,n,8,17976931348623157e292,-17976931348623157e292),li.write(t,e,n,r,52,8),n+8}P.prototype.writeDoubleLE=function(e,n,r){return km(this,e,n,!0,r)};P.prototype.writeDoubleBE=function(e,n,r){return km(this,e,n,!1,r)};P.prototype.copy=function(e,n,r,i){if(!P.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!i&&i!==0&&(i=this.length),n>=e.length&&(n=e.length),n||(n=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-n>>0,r=r===void 0?this.length:r>>>0,e||(e=0);let a;if(typeof e=="number")for(a=n;a2**32?i=mm(String(n)):typeof n=="bigint"&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=mm(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r},RangeError);function mm(t){let e="",n=t.length,r=t[0]==="-"?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function PA(t,e,n){ci(e,"offset"),(t[e]===void 0||t[e+n]===void 0)&&Fa(e,t.length-(n+1))}function Am(t,e,n,r,i,a){if(t>n||t3?e===0||e===BigInt(0)?o=`>= 0${s} and < 2${s} ** ${(a+1)*8}${s}`:o=`>= -(2${s} ** ${(a+1)*8-1}${s}) and < 2 ** ${(a+1)*8-1}${s}`:o=`>= ${e}${s} and <= ${n}${s}`,new oi.ERR_OUT_OF_RANGE("value",o,t)}PA(r,i,a)}function ci(t,e){if(typeof t!="number")throw new oi.ERR_INVALID_ARG_TYPE(e,"number",t)}function Fa(t,e,n){throw Math.floor(t)!==t?(ci(t,n),new oi.ERR_OUT_OF_RANGE(n||"offset","an integer",t)):e<0?new oi.ERR_BUFFER_OUT_OF_BOUNDS:new oi.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}var IA=/[^+/0-9A-Za-z-_]/g;function RA(t){if(t=t.split("=")[0],t=t.trim().replace(IA,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function wu(t,e){e=e||1/0;let n,r=t.length,i=null,a=[];for(let s=0;s55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&a.push(239,191,189);continue}else if(s+1===r){(e-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;a.push(n)}else if(n<2048){if((e-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((e-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((e-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return a}function LA(t){let e=[];for(let n=0;n>8,i=n%256,a.push(i),a.push(r);return a}function Tm(t){return gu.toByteArray(RA(t))}function fo(t,e,n,r){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function wn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Su(t){return t!==t}var DA=function(){let t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function Kn(t){return typeof BigInt=="undefined"?BA:t}function BA(){throw new Error("BigInt not supported")}});var Cm,ku,Buffer,v=iA(()=>{Cm=require("obsidian");Cm.Platform.isMobileApp?ku=Eu().Buffer:ku=global.Buffer;Buffer=ku});var Mm=R((p7,Fm)=>{"use strict";v();var $t=function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if(typeof process=="undefined"||typeof process.domain=="undefined")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||$t.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||$t.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||$t.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=$t.DEFAULT_MAX_PENDING};$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,n,r){if(Array.isArray(t))return this._acquireBatch(t,e,n,r);if(typeof e!="function")throw new Error("You must pass a function to execute");var i=null,a=null,s=null;typeof n!="function"&&(r=n,n=null,s=new this.Promise(function(b,S){i=b,a=S})),r=r||{};var o=!1,l=null,c=null,u=null,f=this,h=function(b,S,k){c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null),b&&(f.queues[t]&&f.queues[t].length===0&&delete f.queues[t],f.domainReentrant&&delete f.domains[t]),o||(s?S?a(S):i(k):typeof n=="function"&&n(S,k),o=!0),b&&f.queues[t]&&f.queues[t].length>0&&f.queues[t].shift()()},d=function(b){if(o)return h(b);l&&(clearTimeout(l),l=null),f.domainReentrant&&b&&(f.domains[t]=process.domain);var S=r.maxExecutionTime||f.maxExecutionTime;if(S&&(u=setTimeout(function(){f.queues[t]&&h(b,new Error("Maximum execution time is exceeded "+t))},S)),e.length===1){var k=!1;try{e(function(x,A){k||(k=!0,h(b,x,A))})}catch(x){k||(k=!0,h(b,x))}}else f._promiseTry(function(){return e()}).then(function(x){h(b,void 0,x)},function(x){h(b,x)})};f.domainReentrant&&process.domain&&(d=process.domain.bind(d));var p=r.maxPending||f.maxPending;if(!f.queues[t])f.queues[t]=[],d(!0);else if(f.domainReentrant&&process.domain&&process.domain===f.domains[t])d(!1);else if(f.queues[t].length>=p)h(!1,new Error("Too many pending tasks in queue "+t));else{var g=function(){d(!0)};r.skipQueue?f.queues[t].unshift(g):f.queues[t].push(g);var m=r.timeout||f.timeout;m&&(l=setTimeout(function(){l=null,h(!1,new Error("async-lock timed out in queue "+t))},m))}var w=r.maxOccupationTime||f.maxOccupationTime;if(w&&(c=setTimeout(function(){f.queues[t]&&h(!1,new Error("Maximum occupation time is exceeded in queue "+t))},w)),s)return s};$t.prototype._acquireBatch=function(t,e,n,r){typeof n!="function"&&(r=n,n=null);var i=this,a=function(o,l){return function(c){i.acquire(o,l,c,r)}},s=t.reduceRight(function(o,l){return a(l,o)},e);if(typeof n=="function")s(n);else return new this.Promise(function(o,l){s.length===1?s(function(c,u){c?l(c):o(u)}):o(s())})};$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(e){return this.Promise.reject(e)}};Fm.exports=$t});var Pm=R((g7,Om)=>{"use strict";v();Om.exports=Mm()});var Im=R((v7,Au)=>{v();typeof Object.create=="function"?Au.exports=function(e,n){n&&(e.super_=n,e.prototype=Object.create(n.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Au.exports=function(e,n){if(n){e.super_=n;var r=function(){};r.prototype=n.prototype,e.prototype=new r,e.prototype.constructor=e}}});var Cu=R((Tu,Lm)=>{v();var ho=Eu(),bn=ho.Buffer;function Rm(t,e){for(var n in t)e[n]=t[n]}bn.from&&bn.alloc&&bn.allocUnsafe&&bn.allocUnsafeSlow?Lm.exports=ho:(Rm(ho,Tu),Tu.Buffer=Fr);function Fr(t,e,n){return bn(t,e,n)}Fr.prototype=Object.create(bn.prototype);Rm(bn,Fr);Fr.from=function(t,e,n){if(typeof t=="number")throw new TypeError("Argument must not be a number");return bn(t,e,n)};Fr.alloc=function(t,e,n){if(typeof t!="number")throw new TypeError("Argument must be a number");var r=bn(t);return e!==void 0?typeof n=="string"?r.fill(e,n):r.fill(e):r.fill(0),r};Fr.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return bn(t)};Fr.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return ho.SlowBuffer(t)}});var Bm=R((x7,Dm)=>{v();var jm=Cu().Buffer;function po(t,e){this._block=jm.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}po.prototype.update=function(t,e){typeof t=="string"&&(e=e||"utf8",t=jm.from(t,e));for(var n=this._block,r=this._blockSize,i=t.length,a=this._len,s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=this._len*8;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var r=(n&4294967295)>>>0,i=(n-r)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(r,this._blockSize-4)}this._update(this._block);var a=this._hash();return t?a.toString(t):a};po.prototype._update=function(){throw new Error("_update must be implemented by subclass")};Dm.exports=po});var Hm=R((S7,$m)=>{v();var NA=Im(),Nm=Bm(),$A=Cu().Buffer,HA=[1518500249,1859775393,-1894007588,-899497514],UA=new Array(80);function Ma(){this.init(),this._w=UA,Nm.call(this,64,56)}NA(Ma,Nm);Ma.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function zA(t){return t<<1|t>>>31}function GA(t){return t<<5|t>>>27}function VA(t){return t<<30|t>>>2}function WA(t,e,n,r){return t===0?e&n|~e&r:t===2?e&n|e&r|n&r:e^n^r}Ma.prototype._update=function(t){for(var e=this._w,n=this._a|0,r=this._b|0,i=this._c|0,a=this._d|0,s=this._e|0,o=0;o<16;++o)e[o]=t.readInt32BE(o*4);for(;o<80;++o)e[o]=zA(e[o-3]^e[o-8]^e[o-14]^e[o-16]);for(var l=0;l<80;++l){var c=~~(l/20),u=GA(n)+WA(c,r,i,a)+s+e[l]+HA[c]|0;s=a,a=i,i=VA(r),r=n,n=u}this._a=n+this._a|0,this._b=r+this._b|0,this._c=i+this._c|0,this._d=a+this._d|0,this._e=s+this._e|0};Ma.prototype._hash=function(){var t=$A.allocUnsafe(20);return t.writeInt32BE(this._a|0,0),t.writeInt32BE(this._b|0,4),t.writeInt32BE(this._c|0,8),t.writeInt32BE(this._d|0,12),t.writeInt32BE(this._e|0,16),t};$m.exports=Ma});var zm=R(Fu=>{v();var Um;(function(t){typeof DO_NOT_EXPORT_CRC=="undefined"?typeof Fu=="object"?t(Fu):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(Um={}):t(Um={})})(function(t){t.version="1.2.2";function e(){for(var y=0,E=new Array(256),_=0;_!=256;++_)y=_,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,y=y&1?-306674912^y>>>1:y>>>1,E[_]=y;return typeof Int32Array!="undefined"?new Int32Array(E):E}var n=e();function r(y){var E=0,_=0,C=0,M=typeof Int32Array!="undefined"?new Int32Array(4096):new Array(4096);for(C=0;C!=256;++C)M[C]=y[C];for(C=0;C!=256;++C)for(_=y[C],E=256+C;E<4096;E+=256)_=M[E]=_>>>8^y[_&255];var L=[];for(C=1;C!=16;++C)L[C-1]=typeof Int32Array!="undefined"?M.subarray(C*256,C*256+256):M.slice(C*256,C*256+256);return L}var i=r(n),a=i[0],s=i[1],o=i[2],l=i[3],c=i[4],u=i[5],f=i[6],h=i[7],d=i[8],p=i[9],g=i[10],m=i[11],w=i[12],b=i[13],S=i[14];function k(y,E){for(var _=E^-1,C=0,M=y.length;C>>8^n[(_^y.charCodeAt(C++))&255];return~_}function x(y,E){for(var _=E^-1,C=y.length-15,M=0;M>8&255]^w[y[M++]^_>>16&255]^m[y[M++]^_>>>24]^g[y[M++]]^p[y[M++]]^d[y[M++]]^h[y[M++]]^f[y[M++]]^u[y[M++]]^c[y[M++]]^l[y[M++]]^o[y[M++]]^s[y[M++]]^a[y[M++]]^n[y[M++]];for(C+=15;M>>8^n[(_^y[M++])&255];return~_}function A(y,E){for(var _=E^-1,C=0,M=y.length,L=0,N=0;C>>8^n[(_^L)&255]:L<2048?(_=_>>>8^n[(_^(192|L>>6&31))&255],_=_>>>8^n[(_^(128|L&63))&255]):L>=55296&&L<57344?(L=(L&1023)+64,N=y.charCodeAt(C++)&1023,_=_>>>8^n[(_^(240|L>>8&7))&255],_=_>>>8^n[(_^(128|L>>2&63))&255],_=_>>>8^n[(_^(128|N>>6&15|(L&3)<<4))&255],_=_>>>8^n[(_^(128|N&63))&255]):(_=_>>>8^n[(_^(224|L>>12&15))&255],_=_>>>8^n[(_^(128|L>>6&63))&255],_=_>>>8^n[(_^(128|L&63))&255]);return~_}t.table=n,t.bstr=k,t.buf=x,t.str=A})});var jn=R(St=>{"use strict";v();var qA=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function XA(t,e){return Object.prototype.hasOwnProperty.call(t,e)}St.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var n=e.shift();if(n){if(typeof n!="object")throw new TypeError(n+"must be non-object");for(var r in n)XA(n,r)&&(t[r]=n[r])}}return t};St.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var YA={arraySet:function(t,e,n,r,i){if(e.subarray&&t.subarray){t.set(e.subarray(n,n+r),i);return}for(var a=0;a{"use strict";v();var KA=jn(),JA=4,Gm=0,Vm=1,QA=2;function hi(t){for(var e=t.length;--e>=0;)t[e]=0}var e3=0,Km=1,t3=2,n3=3,r3=258,ju=29,ja=256,Pa=ja+1+ju,fi=30,Du=19,Jm=2*Pa+1,Mr=15,Mu=16,i3=7,Bu=256,Qm=16,eg=17,tg=18,Ru=[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],mo=[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],a3=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ng=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],s3=512,Dn=new Array((Pa+2)*2);hi(Dn);var Oa=new Array(fi*2);hi(Oa);var Ia=new Array(s3);hi(Ia);var Ra=new Array(r3-n3+1);hi(Ra);var Nu=new Array(ju);hi(Nu);var go=new Array(fi);hi(go);function Ou(t,e,n,r,i){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=t&&t.length}var rg,ig,ag;function Pu(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function sg(t){return t<256?Ia[t]:Ia[256+(t>>>7)]}function La(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}function Ot(t,e,n){t.bi_valid>Mu-n?(t.bi_buf|=e<>Mu-t.bi_valid,t.bi_valid+=n-Mu):(t.bi_buf|=e<>>=1,n<<=1;while(--e>0);return n>>>1}function o3(t){t.bi_valid===16?(La(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)}function l3(t,e){var n=e.dyn_tree,r=e.max_code,i=e.stat_desc.static_tree,a=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,l=e.stat_desc.max_length,c,u,f,h,d,p,g=0;for(h=0;h<=Mr;h++)t.bl_count[h]=0;for(n[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;cl&&(h=l,g++),n[u*2+1]=h,!(u>r)&&(t.bl_count[h]++,d=0,u>=o&&(d=s[u-o]),p=n[u*2],t.opt_len+=p*(h+d),a&&(t.static_len+=p*(i[u*2+1]+d)));if(g!==0){do{for(h=l-1;t.bl_count[h]===0;)h--;t.bl_count[h]--,t.bl_count[h+1]+=2,t.bl_count[l]--,g-=2}while(g>0);for(h=l;h!==0;h--)for(u=t.bl_count[h];u!==0;)f=t.heap[--c],!(f>r)&&(n[f*2+1]!==h&&(t.opt_len+=(h-n[f*2+1])*n[f*2],n[f*2+1]=h),u--)}}function lg(t,e,n){var r=new Array(Mr+1),i=0,a,s;for(a=1;a<=Mr;a++)r[a]=i=i+n[a-1]<<1;for(s=0;s<=e;s++){var o=t[s*2+1];o!==0&&(t[s*2]=og(r[o]++,o))}}function c3(){var t,e,n,r,i,a=new Array(Mr+1);for(n=0,r=0;r>=7;r8?La(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 u3(t,e,n,r){ug(t),r&&(La(t,n),La(t,~n)),KA.arraySet(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}function Wm(t,e,n,r){var i=e*2,a=n*2;return t[i]>1;s>=1;s--)Iu(t,n,s);c=a;do s=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Iu(t,n,1),o=t.heap[1],t.heap[--t.heap_max]=s,t.heap[--t.heap_max]=o,n[c*2]=n[s*2]+n[o*2],t.depth[c]=(t.depth[s]>=t.depth[o]?t.depth[s]:t.depth[o])+1,n[s*2+1]=n[o*2+1]=c,t.heap[1]=c++,Iu(t,n,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],l3(t,e),lg(n,l,t.bl_count)}function Xm(t,e,n){var r,i=-1,a,s=e[0*2+1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),e[(n+1)*2+1]=65535,r=0;r<=n;r++)a=s,s=e[(r+1)*2+1],!(++o=3&&t.bl_tree[ng[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}function h3(t,e,n,r){var i;for(Ot(t,e-257,5),Ot(t,n-1,5),Ot(t,r-4,4),i=0;i>>=1)if(e&1&&t.dyn_ltree[n*2]!==0)return Gm;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return Vm;for(n=32;n0?(t.strm.data_type===QA&&(t.strm.data_type=d3(t)),Lu(t,t.l_desc),Lu(t,t.d_desc),s=f3(t),i=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=i&&(i=a)):i=a=n+5,n+4<=i&&e!==-1?fg(t,e,n,r):t.strategy===JA||a===i?(Ot(t,(Km<<1)+(r?1:0),3),qm(t,Dn,Oa)):(Ot(t,(t3<<1)+(r?1:0),3),h3(t,t.l_desc.max_code+1,t.d_desc.max_code+1,s+1),qm(t,t.dyn_ltree,t.dyn_dtree)),cg(t),r&&ug(t)}function y3(t,e,n){return t.pending_buf[t.d_buf+t.last_lit*2]=e>>>8&255,t.pending_buf[t.d_buf+t.last_lit*2+1]=e&255,t.pending_buf[t.l_buf+t.last_lit]=n&255,t.last_lit++,e===0?t.dyn_ltree[n*2]++:(t.matches++,e--,t.dyn_ltree[(Ra[n]+ja+1)*2]++,t.dyn_dtree[sg(e)*2]++),t.last_lit===t.lit_bufsize-1}di._tr_init=p3;di._tr_stored_block=fg;di._tr_flush_block=g3;di._tr_tally=y3;di._tr_align=m3});var $u=R((O7,dg)=>{"use strict";v();function v3(t,e,n,r){for(var i=t&65535|0,a=t>>>16&65535|0,s=0;n!==0;){s=n>2e3?2e3:n,n-=s;do i=i+e[r++]|0,a=a+i|0;while(--s);i%=65521,a%=65521}return i|a<<16|0}dg.exports=v3});var Hu=R((I7,pg)=>{"use strict";v();function w3(){for(var t,e=[],n=0;n<256;n++){t=n;for(var r=0;r<8;r++)t=t&1?3988292384^t>>>1:t>>>1;e[n]=t}return e}var b3=w3();function x3(t,e,n,r){var i=b3,a=r+n;t^=-1;for(var s=r;s>>8^i[(t^e[s])&255];return t^-1}pg.exports=x3});var yo=R((L7,mg)=>{"use strict";v();mg.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var Eg=R(En=>{"use strict";v();var Et=jn(),Kt=hg(),wg=$u(),Jn=Hu(),_3=yo(),Rr=0,S3=1,E3=3,rr=4,gg=5,Sn=0,yg=1,Jt=-2,k3=-3,Uu=-5,A3=-1,T3=1,vo=2,C3=3,F3=4,M3=0,O3=2,_o=8,P3=9,I3=15,R3=8,L3=29,j3=256,Gu=j3+1+L3,D3=30,B3=19,N3=2*Gu+1,$3=15,me=3,tr=258,cn=tr+me+1,H3=32,So=42,Vu=69,wo=73,bo=91,xo=103,Or=113,Ba=666,ot=1,Na=2,Pr=3,gi=4,U3=3;function nr(t,e){return t.msg=_3[e],e}function vg(t){return(t<<1)-(t>4?9:0)}function er(t){for(var e=t.length;--e>=0;)t[e]=0}function Qn(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),n!==0&&(Et.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,e.pending===0&&(e.pending_out=0))}function ht(t,e){Kt._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,Qn(t.strm)}function ve(t,e){t.pending_buf[t.pending++]=e}function Da(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}function z3(t,e,n,r){var i=t.avail_in;return i>r&&(i=r),i===0?0:(t.avail_in-=i,Et.arraySet(e,t.input,t.next_in,i,n),t.state.wrap===1?t.adler=wg(t.adler,e,i,n):t.state.wrap===2&&(t.adler=Jn(t.adler,e,i,n)),t.next_in+=i,t.total_in+=i,i)}function bg(t,e){var n=t.max_chain_length,r=t.strstart,i,a,s=t.prev_length,o=t.nice_match,l=t.strstart>t.w_size-cn?t.strstart-(t.w_size-cn):0,c=t.window,u=t.w_mask,f=t.prev,h=t.strstart+tr,d=c[r+s-1],p=c[r+s];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do if(i=e,!(c[i+s]!==p||c[i+s-1]!==d||c[i]!==c[r]||c[++i]!==c[r+1])){r+=2,i++;do;while(c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&c[++r]===c[++i]&&rs){if(t.match_start=e,s=a,a>=o)break;d=c[r+s-1],p=c[r+s]}}while((e=f[e&u])>l&&--n!==0);return s<=t.lookahead?s:t.lookahead}function Ir(t){var e=t.w_size,n,r,i,a,s;do{if(a=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-cn)){Et.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,r=t.hash_size,n=r;do i=t.head[--n],t.head[n]=i>=e?i-e:0;while(--r);r=e,n=r;do i=t.prev[--n],t.prev[n]=i>=e?i-e:0;while(--r);a+=e}if(t.strm.avail_in===0)break;if(r=z3(t.strm,t.window,t.strstart+t.lookahead,a),t.lookahead+=r,t.lookahead+t.insert>=me)for(s=t.strstart-t.insert,t.ins_h=t.window[s],t.ins_h=(t.ins_h<t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(Ir(t),t.lookahead===0&&e===Rr)return ot;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var r=t.block_start+n;if((t.strstart===0||t.strstart>=r)&&(t.lookahead=t.strstart-r,t.strstart=r,ht(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-cn&&(ht(t,!1),t.strm.avail_out===0))return ot}return t.insert=0,e===rr?(ht(t,!0),t.strm.avail_out===0?Pr:gi):(t.strstart>t.block_start&&(ht(t,!1),t.strm.avail_out===0),ot)}function zu(t,e){for(var n,r;;){if(t.lookahead=me&&(t.ins_h=(t.ins_h<=me)if(r=Kt._tr_tally(t,t.strstart-t.match_start,t.match_length-me),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=me){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<=me&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=me-1)),t.prev_length>=me&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-me,r=Kt._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-me),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=(t.ins_h<=me&&t.strstart>0&&(i=t.strstart-1,r=s[i],r===s[++i]&&r===s[++i]&&r===s[++i])){a=t.strstart+tr;do;while(r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&r===s[++i]&&it.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=me?(n=Kt._tr_tally(t,1,t.match_length-me),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=Kt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(ht(t,!1),t.strm.avail_out===0))return ot}return t.insert=0,e===rr?(ht(t,!0),t.strm.avail_out===0?Pr:gi):t.last_lit&&(ht(t,!1),t.strm.avail_out===0)?ot:Na}function W3(t,e){for(var n;;){if(t.lookahead===0&&(Ir(t),t.lookahead===0)){if(e===Rr)return ot;break}if(t.match_length=0,n=Kt._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(ht(t,!1),t.strm.avail_out===0))return ot}return t.insert=0,e===rr?(ht(t,!0),t.strm.avail_out===0?Pr:gi):t.last_lit&&(ht(t,!1),t.strm.avail_out===0)?ot:Na}function _n(t,e,n,r,i){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=r,this.func=i}var mi;mi=[new _n(0,0,0,0,G3),new _n(4,4,8,4,zu),new _n(4,5,16,8,zu),new _n(4,6,32,32,zu),new _n(4,4,16,16,pi),new _n(8,16,32,32,pi),new _n(8,16,128,128,pi),new _n(8,32,128,256,pi),new _n(32,128,258,1024,pi),new _n(32,258,258,4096,pi)];function q3(t){t.window_size=2*t.w_size,er(t.head),t.max_lazy_match=mi[t.level].max_lazy,t.good_match=mi[t.level].good_length,t.nice_match=mi[t.level].nice_length,t.max_chain_length=mi[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=me-1,t.match_available=0,t.ins_h=0}function X3(){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=_o,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 Et.Buf16(N3*2),this.dyn_dtree=new Et.Buf16((2*D3+1)*2),this.bl_tree=new Et.Buf16((2*B3+1)*2),er(this.dyn_ltree),er(this.dyn_dtree),er(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Et.Buf16($3+1),this.heap=new Et.Buf16(2*Gu+1),er(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Et.Buf16(2*Gu+1),er(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 xg(t){var e;return!t||!t.state?nr(t,Jt):(t.total_in=t.total_out=0,t.data_type=O3,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?So:Or,t.adler=e.wrap===2?0:1,e.last_flush=Rr,Kt._tr_init(e),Sn)}function _g(t){var e=xg(t);return e===Sn&&q3(t.state),e}function Y3(t,e){return!t||!t.state||t.state.wrap!==2?Jt:(t.state.gzhead=e,Sn)}function Sg(t,e,n,r,i,a){if(!t)return Jt;var s=1;if(e===A3&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),i<1||i>P3||n!==_o||r<8||r>15||e<0||e>9||a<0||a>F3)return nr(t,Jt);r===8&&(r=9);var o=new X3;return t.state=o,o.strm=t,o.wrap=s,o.gzhead=null,o.w_bits=r,o.w_size=1<gg||e<0)return t?nr(t,Jt):Jt;if(r=t.state,!t.output||!t.input&&t.avail_in!==0||r.status===Ba&&e!==rr)return nr(t,t.avail_out===0?Uu:Jt);if(r.strm=t,n=r.last_flush,r.last_flush=e,r.status===So)if(r.wrap===2)t.adler=0,ve(r,31),ve(r,139),ve(r,8),r.gzhead?(ve(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),ve(r,r.gzhead.time&255),ve(r,r.gzhead.time>>8&255),ve(r,r.gzhead.time>>16&255),ve(r,r.gzhead.time>>24&255),ve(r,r.level===9?2:r.strategy>=vo||r.level<2?4:0),ve(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(ve(r,r.gzhead.extra.length&255),ve(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Jn(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=Vu):(ve(r,0),ve(r,0),ve(r,0),ve(r,0),ve(r,0),ve(r,r.level===9?2:r.strategy>=vo||r.level<2?4:0),ve(r,U3),r.status=Or);else{var s=_o+(r.w_bits-8<<4)<<8,o=-1;r.strategy>=vo||r.level<2?o=0:r.level<6?o=1:r.level===6?o=2:o=3,s|=o<<6,r.strstart!==0&&(s|=H3),s+=31-s%31,r.status=Or,Da(r,s),r.strstart!==0&&(Da(r,t.adler>>>16),Da(r,t.adler&65535)),t.adler=1}if(r.status===Vu)if(r.gzhead.extra){for(i=r.pending;r.gzindex<(r.gzhead.extra.length&65535)&&!(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=Jn(t.adler,r.pending_buf,r.pending-i,i)),Qn(t),i=r.pending,r.pending===r.pending_buf_size));)ve(r,r.gzhead.extra[r.gzindex]&255),r.gzindex++;r.gzhead.hcrc&&r.pending>i&&(t.adler=Jn(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=wo)}else r.status=wo;if(r.status===wo)if(r.gzhead.name){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=Jn(t.adler,r.pending_buf,r.pending-i,i)),Qn(t),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}r.gzindexi&&(t.adler=Jn(t.adler,r.pending_buf,r.pending-i,i)),a===0&&(r.gzindex=0,r.status=bo)}else r.status=bo;if(r.status===bo)if(r.gzhead.comment){i=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>i&&(t.adler=Jn(t.adler,r.pending_buf,r.pending-i,i)),Qn(t),i=r.pending,r.pending===r.pending_buf_size)){a=1;break}r.gzindexi&&(t.adler=Jn(t.adler,r.pending_buf,r.pending-i,i)),a===0&&(r.status=xo)}else r.status=xo;if(r.status===xo&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&Qn(t),r.pending+2<=r.pending_buf_size&&(ve(r,t.adler&255),ve(r,t.adler>>8&255),t.adler=0,r.status=Or)):r.status=Or),r.pending!==0){if(Qn(t),t.avail_out===0)return r.last_flush=-1,Sn}else if(t.avail_in===0&&vg(e)<=vg(n)&&e!==rr)return nr(t,Uu);if(r.status===Ba&&t.avail_in!==0)return nr(t,Uu);if(t.avail_in!==0||r.lookahead!==0||e!==Rr&&r.status!==Ba){var l=r.strategy===vo?W3(r,e):r.strategy===C3?V3(r,e):mi[r.level].func(r,e);if((l===Pr||l===gi)&&(r.status=Ba),l===ot||l===Pr)return t.avail_out===0&&(r.last_flush=-1),Sn;if(l===Na&&(e===S3?Kt._tr_align(r):e!==gg&&(Kt._tr_stored_block(r,0,0,!1),e===E3&&(er(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),Qn(t),t.avail_out===0))return r.last_flush=-1,Sn}return e!==rr?Sn:r.wrap<=0?yg:(r.wrap===2?(ve(r,t.adler&255),ve(r,t.adler>>8&255),ve(r,t.adler>>16&255),ve(r,t.adler>>24&255),ve(r,t.total_in&255),ve(r,t.total_in>>8&255),ve(r,t.total_in>>16&255),ve(r,t.total_in>>24&255)):(Da(r,t.adler>>>16),Da(r,t.adler&65535)),Qn(t),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?Sn:yg)}function J3(t){var e;return!t||!t.state?Jt:(e=t.state.status,e!==So&&e!==Vu&&e!==wo&&e!==bo&&e!==xo&&e!==Or&&e!==Ba?nr(t,Jt):(t.state=null,e===Or?nr(t,k3):Sn))}function Q3(t,e){var n=e.length,r,i,a,s,o,l,c,u;if(!t||!t.state||(r=t.state,s=r.wrap,s===2||s===1&&r.status!==So||r.lookahead))return Jt;for(s===1&&(t.adler=wg(t.adler,e,n,0)),r.wrap=0,n>=r.w_size&&(s===0&&(er(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new Et.Buf8(r.w_size),Et.arraySet(u,e,n-r.w_size,r.w_size,0),e=u,n=r.w_size),o=t.avail_in,l=t.next_in,c=t.input,t.avail_in=n,t.next_in=0,t.input=e,Ir(r);r.lookahead>=me;){i=r.strstart,a=r.lookahead-(me-1);do r.ins_h=(r.ins_h<{"use strict";v();var Eo=jn(),kg=!0,Ag=!0;try{String.fromCharCode.apply(null,[0])}catch(t){kg=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){Ag=!1}var $a=new Eo.Buf8(256);for(Bn=0;Bn<256;Bn++)$a[Bn]=Bn>=252?6:Bn>=248?5:Bn>=240?4:Bn>=224?3:Bn>=192?2:1;var Bn;$a[254]=$a[254]=1;yi.string2buf=function(t){var e,n,r,i,a,s=t.length,o=0;for(i=0;i>>6,e[a++]=128|n&63):n<65536?(e[a++]=224|n>>>12,e[a++]=128|n>>>6&63,e[a++]=128|n&63):(e[a++]=240|n>>>18,e[a++]=128|n>>>12&63,e[a++]=128|n>>>6&63,e[a++]=128|n&63);return e};function Tg(t,e){if(e<65534&&(t.subarray&&Ag||!t.subarray&&kg))return String.fromCharCode.apply(null,Eo.shrinkBuf(t,e));for(var n="",r=0;r4){o[r++]=65533,n+=a-1;continue}for(i&=a===2?31:a===3?15:7;a>1&&n1){o[r++]=65533;continue}i<65536?o[r++]=i:(i-=65536,o[r++]=55296|i>>10&1023,o[r++]=56320|i&1023)}return Tg(o,r)};yi.utf8border=function(t,e){var n;for(e=e||t.length,e>t.length&&(e=t.length),n=e-1;n>=0&&(t[n]&192)===128;)n--;return n<0||n===0?e:n+$a[t[n]]>e?n:e}});var qu=R((H7,Cg)=>{"use strict";v();function eT(){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}Cg.exports=eT});var Pg=R(za=>{"use strict";v();var Ha=Eg(),Ua=jn(),Yu=Wu(),Zu=yo(),tT=qu(),Og=Object.prototype.toString,nT=0,Xu=4,vi=0,Fg=1,Mg=2,rT=-1,iT=0,aT=8;function Lr(t){if(!(this instanceof Lr))return new Lr(t);this.options=Ua.assign({level:rT,method:aT,chunkSize:16384,windowBits:15,memLevel:8,strategy:iT,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new tT,this.strm.avail_out=0;var n=Ha.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==vi)throw new Error(Zu[n]);if(e.header&&Ha.deflateSetHeader(this.strm,e.header),e.dictionary){var r;if(typeof e.dictionary=="string"?r=Yu.string2buf(e.dictionary):Og.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,n=Ha.deflateSetDictionary(this.strm,r),n!==vi)throw new Error(Zu[n]);this._dict_set=!0}}Lr.prototype.push=function(t,e){var n=this.strm,r=this.options.chunkSize,i,a;if(this.ended)return!1;a=e===~~e?e:e===!0?Xu:nT,typeof t=="string"?n.input=Yu.string2buf(t):Og.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Ua.Buf8(r),n.next_out=0,n.avail_out=r),i=Ha.deflate(n,a),i!==Fg&&i!==vi)return this.onEnd(i),this.ended=!0,!1;(n.avail_out===0||n.avail_in===0&&(a===Xu||a===Mg))&&(this.options.to==="string"?this.onData(Yu.buf2binstring(Ua.shrinkBuf(n.output,n.next_out))):this.onData(Ua.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||n.avail_out===0)&&i!==Fg);return a===Xu?(i=Ha.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===vi):(a===Mg&&(this.onEnd(vi),n.avail_out=0),!0)};Lr.prototype.onData=function(t){this.chunks.push(t)};Lr.prototype.onEnd=function(t){t===vi&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ua.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Ku(t,e){var n=new Lr(e);if(n.push(t,!0),n.err)throw n.msg||Zu[n.err];return n.result}function sT(t,e){return e=e||{},e.raw=!0,Ku(t,e)}function oT(t,e){return e=e||{},e.gzip=!0,Ku(t,e)}za.Deflate=Lr;za.deflate=Ku;za.deflateRaw=sT;za.gzip=oT});var Rg=R((V7,Ig)=>{"use strict";v();var ko=30,lT=12;Ig.exports=function(e,n){var r,i,a,s,o,l,c,u,f,h,d,p,g,m,w,b,S,k,x,A,y,E,_,C,M;r=e.state,i=e.next_in,C=e.input,a=i+(e.avail_in-5),s=e.next_out,M=e.output,o=s-(n-e.avail_out),l=s+(e.avail_out-257),c=r.dmax,u=r.wsize,f=r.whave,h=r.wnext,d=r.window,p=r.hold,g=r.bits,m=r.lencode,w=r.distcode,b=(1<>>24,p>>>=x,g-=x,x=k>>>16&255,x===0)M[s++]=k&65535;else if(x&16){A=k&65535,x&=15,x&&(g>>=x,g-=x),g<15&&(p+=C[i++]<>>24,p>>>=x,g-=x,x=k>>>16&255,x&16){if(y=k&65535,x&=15,gc){e.msg="invalid distance too far back",r.mode=ko;break e}if(p>>>=x,g-=x,x=s-o,y>x){if(x=y-x,x>f&&r.sane){e.msg="invalid distance too far back",r.mode=ko;break e}if(E=0,_=d,h===0){if(E+=u-x,x2;)M[s++]=_[E++],M[s++]=_[E++],M[s++]=_[E++],A-=3;A&&(M[s++]=_[E++],A>1&&(M[s++]=_[E++]))}else{E=s-y;do M[s++]=M[E++],M[s++]=M[E++],M[s++]=M[E++],A-=3;while(A>2);A&&(M[s++]=M[E++],A>1&&(M[s++]=M[E++]))}}else if(x&64){e.msg="invalid distance code",r.mode=ko;break e}else{k=w[(k&65535)+(p&(1<>3,i-=A,g-=A<<3,p&=(1<{"use strict";v();var Lg=jn(),wi=15,jg=852,Dg=592,Bg=0,Ju=1,Ng=2,cT=[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],uT=[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],fT=[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],hT=[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];$g.exports=function(e,n,r,i,a,s,o,l){var c=l.bits,u=0,f=0,h=0,d=0,p=0,g=0,m=0,w=0,b=0,S=0,k,x,A,y,E,_=null,C=0,M,L=new Lg.Buf16(wi+1),N=new Lg.Buf16(wi+1),j=null,Y=0,le,he,ie;for(u=0;u<=wi;u++)L[u]=0;for(f=0;f=1&&L[d]===0;d--);if(p>d&&(p=d),d===0)return a[s++]=1<<24|64<<16|0,a[s++]=1<<24|64<<16|0,l.bits=1,0;for(h=1;h0&&(e===Bg||d!==1))return-1;for(N[1]=0,u=1;ujg||e===Ng&&b>Dg)return 1;for(;;){le=u-m,o[f]M?(he=j[Y+o[f]],ie=_[C+o[f]]):(he=96,ie=0),k=1<>m)+x]=le<<24|he<<16|ie|0;while(x!==0);for(k=1<>=1;if(k!==0?(S&=k-1,S+=k):S=0,f++,--L[u]===0){if(u===d)break;u=n[r+o[f]]}if(u>p&&(S&y)!==A){for(m===0&&(m=p),E+=h,g=u-m,w=1<jg||e===Ng&&b>Dg)return 1;A=S&y,a[A]=p<<24|g<<16|E-s|0}}return S!==0&&(a[E+S]=u-m<<24|64<<16|0),l.bits=p,0}});var _0=R(un=>{"use strict";v();var Ht=jn(),af=$u(),kn=Hu(),dT=Rg(),Ga=Hg(),pT=0,d0=1,p0=2,Ug=4,mT=5,Ao=6,jr=0,gT=1,yT=2,Qt=-2,m0=-3,sf=-4,vT=-5,zg=8,g0=1,Gg=2,Vg=3,Wg=4,qg=5,Xg=6,Yg=7,Zg=8,Kg=9,Jg=10,Fo=11,Nn=12,Qu=13,Qg=14,ef=15,e0=16,t0=17,n0=18,r0=19,To=20,Co=21,i0=22,a0=23,s0=24,o0=25,l0=26,tf=27,c0=28,u0=29,Ne=30,of=31,wT=32,bT=852,xT=592,_T=15,ST=_T;function f0(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}function ET(){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 Ht.Buf16(320),this.work=new Ht.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y0(t){var e;return!t||!t.state?Qt:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=g0,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Ht.Buf32(bT),e.distcode=e.distdyn=new Ht.Buf32(xT),e.sane=1,e.back=-1,jr)}function v0(t){var e;return!t||!t.state?Qt:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,y0(t))}function w0(t,e){var n,r;return!t||!t.state||(r=t.state,e<0?(n=0,e=-e):(n=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?Qt:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=n,r.wbits=e,v0(t))}function b0(t,e){var n,r;return t?(r=new ET,t.state=r,r.window=null,n=w0(t,e),n!==jr&&(t.state=null),n):Qt}function kT(t){return b0(t,ST)}var h0=!0,nf,rf;function AT(t){if(h0){var e;for(nf=new Ht.Buf32(512),rf=new Ht.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Ga(d0,t.lens,0,288,nf,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Ga(p0,t.lens,0,32,rf,0,t.work,{bits:5}),h0=!1}t.lencode=nf,t.lenbits=9,t.distcode=rf,t.distbits=5}function x0(t,e,n,r){var i,a=t.state;return a.window===null&&(a.wsize=1<=a.wsize?(Ht.arraySet(a.window,e,n-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>r&&(i=r),Ht.arraySet(a.window,e,n-r,i,a.wnext),r-=i,r?(Ht.arraySet(a.window,e,n-r,r,0),a.wnext=r,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave>>8&255,n.check=kn(n.check,_,2,0),c=0,u=0,n.mode=Gg;break}if(n.flags=0,n.head&&(n.head.done=!1),!(n.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",n.mode=Ne;break}if((c&15)!==zg){t.msg="unknown compression method",n.mode=Ne;break}if(c>>>=4,u-=4,y=(c&15)+8,n.wbits===0)n.wbits=y;else if(y>n.wbits){t.msg="invalid window size",n.mode=Ne;break}n.dmax=1<>8&1),n.flags&512&&(_[0]=c&255,_[1]=c>>>8&255,n.check=kn(n.check,_,2,0)),c=0,u=0,n.mode=Vg;case Vg:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<>>8&255,_[2]=c>>>16&255,_[3]=c>>>24&255,n.check=kn(n.check,_,4,0)),c=0,u=0,n.mode=Wg;case Wg:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<>8),n.flags&512&&(_[0]=c&255,_[1]=c>>>8&255,n.check=kn(n.check,_,2,0)),c=0,u=0,n.mode=qg;case qg:if(n.flags&1024){for(;u<16;){if(o===0)break e;o--,c+=r[a++]<>>8&255,n.check=kn(n.check,_,2,0)),c=0,u=0}else n.head&&(n.head.extra=null);n.mode=Xg;case Xg:if(n.flags&1024&&(d=n.length,d>o&&(d=o),d&&(n.head&&(y=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),Ht.arraySet(n.head.extra,r,a,d,y)),n.flags&512&&(n.check=kn(n.check,r,d,a)),o-=d,a+=d,n.length-=d),n.length))break e;n.length=0,n.mode=Yg;case Yg:if(n.flags&2048){if(o===0)break e;d=0;do y=r[a+d++],n.head&&y&&n.length<65536&&(n.head.name+=String.fromCharCode(y));while(y&&d>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=Nn;break;case Jg:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<>>=u&7,u-=u&7,n.mode=tf;break}for(;u<3;){if(o===0)break e;o--,c+=r[a++]<>>=1,u-=1,c&3){case 0:n.mode=Qg;break;case 1:if(AT(n),n.mode=To,e===Ao){c>>>=2,u-=2;break e}break;case 2:n.mode=t0;break;case 3:t.msg="invalid block type",n.mode=Ne}c>>>=2,u-=2;break;case Qg:for(c>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,c+=r[a++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=Ne;break}if(n.length=c&65535,c=0,u=0,n.mode=ef,e===Ao)break e;case ef:n.mode=e0;case e0:if(d=n.length,d){if(d>o&&(d=o),d>l&&(d=l),d===0)break e;Ht.arraySet(i,r,a,d,s),o-=d,a+=d,l-=d,s+=d,n.length-=d;break}n.mode=Nn;break;case t0:for(;u<14;){if(o===0)break e;o--,c+=r[a++]<>>=5,u-=5,n.ndist=(c&31)+1,c>>>=5,u-=5,n.ncode=(c&15)+4,c>>>=4,u-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=Ne;break}n.have=0,n.mode=n0;case n0:for(;n.have>>=3,u-=3}for(;n.have<19;)n.lens[L[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,C={bits:n.lenbits},E=Ga(pT,n.lens,0,19,n.lencode,0,n.work,C),n.lenbits=C.bits,E){t.msg="invalid code lengths set",n.mode=Ne;break}n.have=0,n.mode=r0;case r0:for(;n.have>>24,b=m>>>16&255,S=m&65535,!(w<=u);){if(o===0)break e;o--,c+=r[a++]<>>=w,u-=w,n.lens[n.have++]=S;else{if(S===16){for(M=w+2;u>>=w,u-=w,n.have===0){t.msg="invalid bit length repeat",n.mode=Ne;break}y=n.lens[n.have-1],d=3+(c&3),c>>>=2,u-=2}else if(S===17){for(M=w+3;u>>=w,u-=w,y=0,d=3+(c&7),c>>>=3,u-=3}else{for(M=w+7;u>>=w,u-=w,y=0,d=11+(c&127),c>>>=7,u-=7}if(n.have+d>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=Ne;break}for(;d--;)n.lens[n.have++]=y}}if(n.mode===Ne)break;if(n.lens[256]===0){t.msg="invalid code -- missing end-of-block",n.mode=Ne;break}if(n.lenbits=9,C={bits:n.lenbits},E=Ga(d0,n.lens,0,n.nlen,n.lencode,0,n.work,C),n.lenbits=C.bits,E){t.msg="invalid literal/lengths set",n.mode=Ne;break}if(n.distbits=6,n.distcode=n.distdyn,C={bits:n.distbits},E=Ga(p0,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,C),n.distbits=C.bits,E){t.msg="invalid distances set",n.mode=Ne;break}if(n.mode=To,e===Ao)break e;case To:n.mode=Co;case Co:if(o>=6&&l>=258){t.next_out=s,t.avail_out=l,t.next_in=a,t.avail_in=o,n.hold=c,n.bits=u,dT(t,h),s=t.next_out,i=t.output,l=t.avail_out,a=t.next_in,r=t.input,o=t.avail_in,c=n.hold,u=n.bits,n.mode===Nn&&(n.back=-1);break}for(n.back=0;m=n.lencode[c&(1<>>24,b=m>>>16&255,S=m&65535,!(w<=u);){if(o===0)break e;o--,c+=r[a++]<>k)],w=m>>>24,b=m>>>16&255,S=m&65535,!(k+w<=u);){if(o===0)break e;o--,c+=r[a++]<>>=k,u-=k,n.back+=k}if(c>>>=w,u-=w,n.back+=w,n.length=S,b===0){n.mode=l0;break}if(b&32){n.back=-1,n.mode=Nn;break}if(b&64){t.msg="invalid literal/length code",n.mode=Ne;break}n.extra=b&15,n.mode=i0;case i0:if(n.extra){for(M=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=a0;case a0:for(;m=n.distcode[c&(1<>>24,b=m>>>16&255,S=m&65535,!(w<=u);){if(o===0)break e;o--,c+=r[a++]<>k)],w=m>>>24,b=m>>>16&255,S=m&65535,!(k+w<=u);){if(o===0)break e;o--,c+=r[a++]<>>=k,u-=k,n.back+=k}if(c>>>=w,u-=w,n.back+=w,b&64){t.msg="invalid distance code",n.mode=Ne;break}n.offset=S,n.extra=b&15,n.mode=s0;case s0:if(n.extra){for(M=n.extra;u>>=n.extra,u-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=Ne;break}n.mode=o0;case o0:if(l===0)break e;if(d=h-l,n.offset>d){if(d=n.offset-d,d>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=Ne;break}d>n.wnext?(d-=n.wnext,p=n.wsize-d):p=n.wnext-d,d>n.length&&(d=n.length),g=n.window}else g=i,p=s-n.offset,d=n.length;d>l&&(d=l),l-=d,n.length-=d;do i[s++]=g[p++];while(--d);n.length===0&&(n.mode=Co);break;case l0:if(l===0)break e;i[s++]=n.length,l--,n.mode=Co;break;case tf:if(n.wrap){for(;u<32;){if(o===0)break e;o--,c|=r[a++]<{"use strict";v();S0.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var k0=R((Q7,E0)=>{"use strict";v();function OT(){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}E0.exports=OT});var T0=R(Wa=>{"use strict";v();var bi=_0(),Va=jn(),Mo=Wu(),Ke=lf(),cf=yo(),PT=qu(),IT=k0(),A0=Object.prototype.toString;function Dr(t){if(!(this instanceof Dr))return new Dr(t);this.options=Va.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15||(e.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new PT,this.strm.avail_out=0;var n=bi.inflateInit2(this.strm,e.windowBits);if(n!==Ke.Z_OK)throw new Error(cf[n]);if(this.header=new IT,bi.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Mo.string2buf(e.dictionary):A0.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(n=bi.inflateSetDictionary(this.strm,e.dictionary),n!==Ke.Z_OK)))throw new Error(cf[n])}Dr.prototype.push=function(t,e){var n=this.strm,r=this.options.chunkSize,i=this.options.dictionary,a,s,o,l,c,u=!1;if(this.ended)return!1;s=e===~~e?e:e===!0?Ke.Z_FINISH:Ke.Z_NO_FLUSH,typeof t=="string"?n.input=Mo.binstring2buf(t):A0.call(t)==="[object ArrayBuffer]"?n.input=new Uint8Array(t):n.input=t,n.next_in=0,n.avail_in=n.input.length;do{if(n.avail_out===0&&(n.output=new Va.Buf8(r),n.next_out=0,n.avail_out=r),a=bi.inflate(n,Ke.Z_NO_FLUSH),a===Ke.Z_NEED_DICT&&i&&(a=bi.inflateSetDictionary(this.strm,i)),a===Ke.Z_BUF_ERROR&&u===!0&&(a=Ke.Z_OK,u=!1),a!==Ke.Z_STREAM_END&&a!==Ke.Z_OK)return this.onEnd(a),this.ended=!0,!1;n.next_out&&(n.avail_out===0||a===Ke.Z_STREAM_END||n.avail_in===0&&(s===Ke.Z_FINISH||s===Ke.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=Mo.utf8border(n.output,n.next_out),l=n.next_out-o,c=Mo.buf2string(n.output,o),n.next_out=l,n.avail_out=r-l,l&&Va.arraySet(n.output,n.output,o,l,0),this.onData(c)):this.onData(Va.shrinkBuf(n.output,n.next_out))),n.avail_in===0&&n.avail_out===0&&(u=!0)}while((n.avail_in>0||n.avail_out===0)&&a!==Ke.Z_STREAM_END);return a===Ke.Z_STREAM_END&&(s=Ke.Z_FINISH),s===Ke.Z_FINISH?(a=bi.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,a===Ke.Z_OK):(s===Ke.Z_SYNC_FLUSH&&(this.onEnd(Ke.Z_OK),n.avail_out=0),!0)};Dr.prototype.onData=function(t){this.chunks.push(t)};Dr.prototype.onEnd=function(t){t===Ke.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Va.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function uf(t,e){var n=new Dr(e);if(n.push(t,!0),n.err)throw n.msg||cf[n.err];return n.result}function RT(t,e){return e=e||{},e.raw=!0,uf(t,e)}Wa.Inflate=Dr;Wa.inflate=uf;Wa.inflateRaw=RT;Wa.ungzip=uf});var M0=R((rD,F0)=>{"use strict";v();var LT=jn().assign,jT=Pg(),DT=T0(),BT=lf(),C0={};LT(C0,jT,DT,BT);F0.exports=C0});var I0=R((aD,P0)=>{"use strict";v();var O0=(t,e)=>function(...n){let r=e.promiseModule;return new r((i,a)=>{e.multiArgs?n.push((...s)=>{e.errorFirst?s[0]?a(s):(s.shift(),i(s)):i(s)}):e.errorFirst?n.push((s,o)=>{s?a(s):i(o)}):n.push(i),t.apply(this,n)})};P0.exports=(t,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);let n=typeof t;if(!(t!==null&&(n==="object"||n==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${t===null?"null":n}\``);let r=a=>{let s=o=>typeof o=="string"?a===o:o.test(a);return e.include?e.include.some(s):!e.exclude.some(s)},i;n==="function"?i=function(...a){return e.excludeMain?t(...a):O0(t,e).apply(this,a)}:i=Object.create(Object.getPrototypeOf(t));for(let a in t){let s=t[a];i[a]=typeof s=="function"&&r(a)?O0(s,e):s}return i}});var U0=R((oD,H0)=>{v();function R0(t){return Array.isArray(t)?t:[t]}var df="",L0=" ",ff="\\",NT=/^\s+$/,$T=/(?:[^\\]|^)\\$/,HT=/^\\!/,UT=/^\\#/,zT=/\r?\n/g,GT=/^\.*\/|^\.+$/,hf="/",B0="node-ignore";typeof Symbol!="undefined"&&(B0=Symbol.for("node-ignore"));var j0=B0,VT=(t,e,n)=>Object.defineProperty(t,e,{value:n}),WT=/([0-z])-([0-z])/g,N0=()=>!1,qT=t=>t.replace(WT,(e,n,r)=>n.charCodeAt(0)<=r.charCodeAt(0)?e:df),XT=t=>{let{length:e}=t;return t.slice(0,e-e%2)},YT=[[/^\uFEFF/,()=>df],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,n)=>e+(n.indexOf("\\")===0?L0:df)],[/(\\+?)\s/g,(t,e)=>{let{length:n}=e;return e.slice(0,n-n%2)+L0}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,n)=>e+6{let r=n.replace(/\\\*/g,"[^\\/]*");return e+r}],[/\\\\\\(?=[$.|*+(){^])/g,()=>ff],[/\\\\/g,()=>ff],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,n,r,i)=>e===ff?`\\[${n}${XT(r)}${i}`:i==="]"&&r.length%2===0?`[${qT(n)}${r}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],D0=Object.create(null),ZT=(t,e)=>{let n=D0[t];return n||(n=YT.reduce((r,[i,a])=>r.replace(i,a.bind(t)),t),D0[t]=n),e?new RegExp(n,"i"):new RegExp(n)},gf=t=>typeof t=="string",KT=t=>t&&gf(t)&&!NT.test(t)&&!$T.test(t)&&t.indexOf("#")!==0,JT=t=>t.split(zT),pf=class{constructor(e,n,r,i){this.origin=e,this.pattern=n,this.negative=r,this.regex=i}},QT=(t,e)=>{let n=t,r=!1;t.indexOf("!")===0&&(r=!0,t=t.substr(1)),t=t.replace(HT,"!").replace(UT,"#");let i=ZT(t,e);return new pf(n,t,r,i)},e5=(t,e)=>{throw new e(t)},$n=(t,e,n)=>gf(t)?t?$n.isNotRelative(t)?n(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:n("path must not be empty",TypeError):n(`path must be a string, but got \`${e}\``,TypeError),$0=t=>GT.test(t);$n.isNotRelative=$0;$n.convert=t=>t;var mf=class{constructor({ignorecase:e=!0,ignoreCase:n=e,allowRelativePaths:r=!1}={}){VT(this,j0,!0),this._rules=[],this._ignoreCase=n,this._allowRelativePaths=r,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[j0]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(KT(e)){let n=QT(e,this._ignoreCase);this._added=!0,this._rules.push(n)}}add(e){return this._added=!1,R0(gf(e)?JT(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,n){let r=!1,i=!1;return this._rules.forEach(a=>{let{negative:s}=a;if(i===s&&r!==i||s&&!r&&!i&&!n)return;a.regex.test(e)&&(r=!s,i=s)}),{ignored:r,unignored:i}}_test(e,n,r,i){let a=e&&$n.convert(e);return $n(a,e,this._allowRelativePaths?N0:e5),this._t(a,n,r,i)}_t(e,n,r,i){if(e in n)return n[e];if(i||(i=e.split(hf)),i.pop(),!i.length)return n[e]=this._testOne(e,r);let a=this._t(i.join(hf)+hf,n,r,i);return n[e]=a.ignored?a:this._testOne(e,r)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return R0(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},Oo=t=>new mf(t),t5=t=>$n(t&&$n.convert(t),t,N0);Oo.isPathValid=t5;Oo.default=Oo;H0.exports=Oo;if(typeof process!="undefined"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let t=n=>/^\\\\\?\\/.test(n)||/["<>|\u0000-\u001F]+/u.test(n)?n:n.replace(/\\/g,"/");$n.convert=t;let e=/^[a-z]:\//i;$n.isNotRelative=n=>e.test(n)||$0(n)}});var G0=R((cD,z0)=>{"use strict";v();function n5(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function An(t,e,n){return e=e instanceof RegExp?e:new RegExp(n5(e),"g"),t.replace(e,n)}var r5={clean:function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=An(e,"./","/"),e=An(e,"..","."),e=An(e," ","-"),e=An(e,/^[~^:?*\\\-]/g,""),e=An(e,/[~^:?*\\]/g,"-"),e=An(e,/[~^:?*\\\-]$/g,""),e=An(e,"@{","-"),e=An(e,/\.$/g,""),e=An(e,/\/$/g,""),e=An(e,/\.lock$/g,""),e}};z0.exports=r5});var W0=R((fD,V0)=>{v();V0.exports=function(t,e){var n=t,r=e,i=n.length,a=r.length,s=!1,o=null,l=i+1,c=[],u=[],f=[],h="",d=-1,p=0,g=1,m,w,b=function(){i>=a&&(m=n,w=i,n=r,r=m,i=a,a=w,s=!0,l=i+1)},S=function(y,E,_){return{x:y,y:E,k:_}},k=function(y,E){return{elem:y,t:E}},x=function(y,E,_){var C,M,L;for(E>_?C=c[y-1+l]:C=c[y+1+l],L=Math.max(E,_),M=L-y;M=0;--L)for(;CM-C?(s?f[f.length]=new k(r[M],d):f[f.length]=new k(r[M],g),++_,++M):y[L].y-y[L].x=y+1;--j)_[j+l]=x(j,_[j-1+l]+1,_[j+1+l]);_[y+l]=x(y,_[y-1+l]+1,_[y+1+l])}while(_[y+l]!==a);for(o=y+2*C,M=c[y+l],L=[];M!==-1;)L[L.length]=new S(u[M].x,u[M].y,null),M=u[M].k;A(L)}}}});var Y0=R((dD,X0)=>{v();var i5=W0();function a5(t,e){var n=new i5(t,e);n.compose();for(var r=n.getses(),i,a,s=t.length-1,o=e.length-1,l=r.length-1;l>=0;--l)r[l].t===n.SES_COMMON?(a?(a.chain={file1index:s,file2index:o,chain:null},a=a.chain):(i={file1index:s,file2index:o,chain:null},a=i),s--,o--):r[l].t===n.SES_DELETE?s--:r[l].t===n.SES_ADD&&o--;var c={file1index:-1,file2index:-1,chain:null};return a?(a.chain=c,i):c}function q0(t,e){for(var n=[],r=t.length,i=e.length,a=a5(t,e);a!==null;a=a.chain){var s=r-a.file1index-1,o=i-a.file2index-1;r=a.file1index,i=a.file2index,(s||o)&&n.push({file1:[r+1,s],file2:[i+1,o]})}return n.reverse(),n}function s5(t,e,n){var r,i=q0(e,t),a=q0(e,n),s=[];function o(N,j){s.push([N.file1[0],j,N.file1[1],N.file2[0],N.file2[1]])}for(r=0;rc&&(l.push([1,c,N-c]),c=N)}for(var f=0;fg)break;g=Math.max(g,w+m[2]),f++}if(u(p),h==f)d[4]>0&&l.push([d[1],d[3],d[4]]);else{var b={0:[t.length,-1,e.length,-1],2:[n.length,-1,e.length,-1]};for(r=h;r<=f;r++){d=s[r];var S=d[1],k=b[S],x=d[0],A=x+d[2],y=d[3],E=y+d[4];k[0]=Math.min(y,k[0]),k[1]=Math.max(E,k[1]),k[2]=Math.min(x,k[2]),k[3]=Math.max(A,k[3])}var _=b[0][0]+(p-b[0][2]),C=b[0][1]+(g-b[0][3]),M=b[2][0]+(p-b[2][2]),L=b[2][1]+(g-b[2][3]);l.push([-1,_,C-_,p,g-p,M,L-M])}c=g}return u(e.length),l}function o5(t,e,n){var r=[],i=[t,e,n],a=s5(t,e,n),s=[];function o(){s.length&&r.push({ok:s}),s=[]}function l(d){for(var p=0;p{v();var Bi=1e3,Ni=Bi*60,$i=Ni*60,Gr=$i*24,u6=Gr*7,f6=Gr*365.25;J1.exports=function(t,e){e=e||{};var n=typeof t;if(n==="string"&&t.length>0)return h6(t);if(n==="number"&&isFinite(t))return e.long?p6(t):d6(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function h6(t){if(t=String(t),!(t.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*f6;case"weeks":case"week":case"w":return n*u6;case"days":case"day":case"d":return n*Gr;case"hours":case"hour":case"hrs":case"hr":case"h":return n*$i;case"minutes":case"minute":case"mins":case"min":case"m":return n*Ni;case"seconds":case"second":case"secs":case"sec":case"s":return n*Bi;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function d6(t){var e=Math.abs(t);return e>=Gr?Math.round(t/Gr)+"d":e>=$i?Math.round(t/$i)+"h":e>=Ni?Math.round(t/Ni)+"m":e>=Bi?Math.round(t/Bi)+"s":t+"ms"}function p6(t){var e=Math.abs(t);return e>=Gr?Jo(t,e,Gr,"day"):e>=$i?Jo(t,e,$i,"hour"):e>=Ni?Jo(t,e,Ni,"minute"):e>=Bi?Jo(t,e,Bi,"second"):t+" ms"}function Jo(t,e,n,r){var i=e>=n*1.5;return Math.round(t/n)+" "+r+(i?"s":"")}});var ty=R((_D,ey)=>{v();function m6(t){n.debug=n,n.default=n,n.coerce=l,n.disable=a,n.enable=i,n.enabled=s,n.humanize=Q1(),n.destroy=c,Object.keys(t).forEach(u=>{n[u]=t[u]}),n.names=[],n.skips=[],n.formatters={};function e(u){let f=0;for(let h=0;h{if(A==="%%")return"%";k++;let E=n.formatters[y];if(typeof E=="function"){let _=m[k];A=E.call(w,_),m.splice(k,1),k--}return A}),n.formatArgs.call(w,m),(w.log||n.log).apply(w,m)}return g.namespace=u,g.useColors=n.useColors(),g.color=n.selectColor(u),g.extend=r,g.destroy=n.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(d!==n.namespaces&&(d=n.namespaces,p=n.enabled(u)),p),set:m=>{h=m}}),typeof n.init=="function"&&n.init(g),g}function r(u,f){let h=n(this.namespace+(typeof f=="undefined"?":":f)+u);return h.log=this.log,h}function i(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let f,h=(typeof u=="string"?u:"").split(/[\s,]+/),d=h.length;for(f=0;f"-"+f)].join(",");return n.enable(""),u}function s(u){if(u[u.length-1]==="*")return!0;let f,h;for(f=0,h=n.skips.length;f{v();Gt.formatArgs=y6;Gt.save=v6;Gt.load=w6;Gt.useColors=g6;Gt.storage=b6();Gt.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Gt.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function g6(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function y6(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Qo.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let n=0,r=0;t[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(n++,i==="%c"&&(r=n))}),t.splice(r,0,e)}Gt.log=console.debug||console.log||(()=>{});function v6(t){try{t?Gt.storage.setItem("debug",t):Gt.storage.removeItem("debug")}catch(e){}}function w6(){let t;try{t=Gt.storage.getItem("debug")}catch(e){}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function b6(){try{return localStorage}catch(t){}}Qo.exports=ty()(Gt);var{formatters:x6}=Qo.exports;x6.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var ny=R(Vt=>{"use strict";v();var _6=Vt&&Vt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Vt,"__esModule",{value:!0});var S6=require("fs"),E6=_6(el()),Hi=E6.default("@kwsites/file-exists");function k6(t,e,n){Hi("checking %s",t);try{let r=S6.statSync(t);return r.isFile()&&e?(Hi("[OK] path represents a file"),!0):r.isDirectory()&&n?(Hi("[OK] path represents a directory"),!0):(Hi("[FAIL] path represents something other than a file or directory"),!1)}catch(r){if(r.code==="ENOENT")return Hi("[FAIL] path is not accessible: %o",r),!1;throw Hi("[FATAL] %o",r),r}}function A6(t,e=Vt.READABLE){return k6(t,(e&Vt.FILE)>0,(e&Vt.FOLDER)>0)}Vt.exists=A6;Vt.FILE=1;Vt.FOLDER=2;Vt.READABLE=Vt.FILE+Vt.FOLDER});var ry=R(tl=>{"use strict";v();function T6(t){for(var e in t)tl.hasOwnProperty(e)||(tl[e]=t[e])}Object.defineProperty(tl,"__esModule",{value:!0});T6(ny())});var Wf=R(Vr=>{"use strict";v();Object.defineProperty(Vr,"__esModule",{value:!0});Vr.createDeferred=Vr.deferred=void 0;function Vf(){let t,e,n="pending";return{promise:new Promise((i,a)=>{t=i,e=a}),done(i){n==="pending"&&(n="resolved",t(i))},fail(i){n==="pending"&&(n="rejected",e(i))},get fulfilled(){return n!=="pending"},get status(){return n}}}Vr.deferred=Vf;Vr.createDeferred=Vf;Vr.default=Vf});var zw=R((h9,Uw)=>{"use strict";v();Uw.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var Vw=R((p9,Gw)=>{v();var Bh={px:{px:1,cm:37.79527559055118,mm:3.7795275590551185,in:96,pt:1.3333333333333333,pc:16},cm:{px:.026458333333333334,cm:1,mm:.1,in:2.54,pt:.035277777777777776,pc:.42333333333333334},mm:{px:.26458333333333334,cm:10,mm:1,in:25.4,pt:.35277777777777775,pc:4.233333333333333},in:{px:.010416666666666666,cm:.39370078740157477,mm:.03937007874015748,in:1,pt:.013888888888888888,pc:.16666666666666666},pt:{px:.75,cm:28.346456692913385,mm:2.834645669291339,in:72,pt:1,pc:12},pc:{px:.0625,cm:2.3622047244094486,mm:.2362204724409449,in:6,pt:.08333333333333333,pc:1},deg:{deg:1,grad:.9,rad:180/Math.PI,turn:360},grad:{deg:1.1111111111111112,grad:1,rad:200/Math.PI,turn:400},rad:{deg:Math.PI/180,grad:Math.PI/200,rad:1,turn:Math.PI*2},turn:{deg:.002777777777777778,grad:.0025,rad:.5/Math.PI,turn:1},s:{s:1,ms:.001},ms:{s:1e3,ms:1},Hz:{Hz:1,kHz:1e3},kHz:{Hz:.001,kHz:1},dpi:{dpi:1,dpcm:.39370078740157477,dppx:.010416666666666666},dpcm:{dpi:2.54,dpcm:1,dppx:.026458333333333334},dppx:{dpi:96,dpcm:37.79527559055118,dppx:1}};Gw.exports=function(t,e,n,r){if(!Bh.hasOwnProperty(n))throw new Error("Cannot convert to "+n);if(!Bh[n].hasOwnProperty(e))throw new Error("Cannot convert from "+e+" to "+n);var i=Bh[n][e]*t;return r!==!1?(r=Math.pow(10,parseInt(r)||5),Math.round(i*r)/r):i}});var a2=R(Vn=>{"use strict";v();Object.defineProperty(Vn,"__esModule",{value:!0});Vn.fromRgba=qi;Vn.fromRgb=Nh;Vn.fromHsla=El;Vn.fromHsl=r2;Vn.fromString=i2;Vn.default=void 0;var Ww=Yw(zw()),BM=Yw(Vw());function Yw(t){return t&&t.__esModule?t:{default:t}}function NM(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qw(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n-1}function VM(t,e,n){var r=t/255,i=e/255,a=n/255,s=Math.max(r,i,a),o=Math.min(r,i,a),l=s-o,c=(s+o)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=function(){switch(s){case r:return(i-a)/l%6;case i:return(a-r)/l+2;default:return(r-i)/l+4}}();return[f*60,u*100,c*100]}function WM(t,e,n){var r=t/60,i=e/100,a=n/100,s=(1-Math.abs(2*a-1))*i,o=s*(1-Math.abs(r%2-1)),l=a-s/2,c=function(){return r<1?[s,o,0]:r<2?[o,s,0]:r<3?[0,s,o]:r<4?[0,o,s]:r<5?[o,0,s]:[s,0,o]}(),u=Ft(c,3),f=u[0],h=u[1],d=u[2];return[(f+l)*255,(h+l)*255,(d+l)*255]}var qM=function(){function t(e){var n=Ft(e,4),r=n[0],i=n[1],a=n[2],s=n[3];NM(this,t),this.values=[Math.max(Math.min(parseInt(r,10),255),0),Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(a,10),255),0),s==null?1:Math.max(Math.min(parseFloat(s),255),0)]}return $M(t,[{key:"toRgbString",value:function(){var n=Ft(this.values,4),r=n[0],i=n[1],a=n[2],s=n[3];return s===1?"rgb(".concat(r,", ").concat(i,", ").concat(a,")"):"rgba(".concat(r,", ").concat(i,", ").concat(a,", ").concat(s,")")}},{key:"toHslString",value:function(){var n=this.toHslaArray(),r=Ft(n,4),i=r[0],a=r[1],s=r[2],o=r[3];return o===1?"hsl(".concat(i,", ").concat(a,"%, ").concat(s,"%)"):"hsla(".concat(i,", ").concat(a,"%, ").concat(s,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var n=Ft(this.values,4),r=n[0],i=n[1],a=n[2],s=n[3];return r=Number(r).toString(16).padStart(2,"0"),i=Number(i).toString(16).padStart(2,"0"),a=Number(a).toString(16).padStart(2,"0"),s=s<1?parseInt(s*255,10).toString(16).padStart(2,"0"):"","#".concat(r).concat(i).concat(a).concat(s)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var n=Ft(this.values,4),r=n[0],i=n[1],a=n[2],s=n[3],o=VM(r,i,a),l=Ft(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,s]}}]),t}();function qi(t){var e=Ft(t,4),n=e[0],r=e[1],i=e[2],a=e[3];return new qM([n,r,i,a])}function Nh(t){var e=Ft(t,3),n=e[0],r=e[1],i=e[2];return qi([n,r,i,1])}function El(t){var e=Ft(t,4),n=e[0],r=e[1],i=e[2],a=e[3],s=WM(n,r,i),o=Ft(s,3),l=o[0],c=o[1],u=o[2];return qi([l,c,u,a])}function r2(t){var e=Ft(t,3),n=e[0],r=e[1],i=e[2];return El([n,r,i,1])}function XM(t){var e=Zw.exec(t)||Kw.exec(t),n=Ft(e,5),r=n[1],i=n[2],a=n[3],s=n[4];return r=parseInt(r.length<2?r.repeat(2):r,16),i=parseInt(i.length<2?i.repeat(2):i,16),a=parseInt(a.length<2?a.repeat(2):a,16),s=s&&(parseInt(s.length<2?s.repeat(2):s,16)/255).toPrecision(1)||1,qi([r,i,a,s])}function YM(t){var e=Jw.exec(t)||e2.exec(t)||Qw.exec(t)||t2.exec(t),n=Ft(e,5),r=n[1],i=n[2],a=n[3],s=n[4];return r=Cs(r,"%")?parseInt(r,10)*255/100:parseInt(r,10),i=Cs(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),a=Cs(a,"%")>0?parseInt(a,10)*255/100:parseInt(a,10),s=s===void 0?1:parseFloat(s)/(Cs(s,"%")?100:1),qi([r,i,a,s])}function ZM(t){var e=n2.exec(t),n=Ft(e,6),r=n[1],i=n[2],a=n[3],s=n[4],o=n[5];return i=i||"deg",r=(0,BM.default)(parseFloat(r),i,"deg"),a=parseFloat(a),s=parseFloat(s),o=o===void 0?1:parseFloat(o)/(Cs(o,"%")?100:1),El([r,a,s,o])}function i2(t){return Ww.default[t]?Nh(Ww.default[t]):Zw.test(t)||Kw.test(t)?XM(t):Jw.test(t)||e2.test(t)||Qw.test(t)||t2.test(t)?YM(t):n2.test(t)?ZM(t):null}var KM={fromString:i2,fromRgb:Nh,fromRgba:qi,fromHsl:r2,fromHsla:El};Vn.default=KM});var $h=R((v9,o2)=>{"use strict";v();var s2=Object.prototype.toString;o2.exports=function(e){var n=s2.call(e),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&s2.call(e.callee)==="[object Function]"),r}});var g2=R((b9,m2)=>{"use strict";v();var p2;Object.keys||(Fs=Object.prototype.hasOwnProperty,Hh=Object.prototype.toString,l2=$h(),Uh=Object.prototype.propertyIsEnumerable,c2=!Uh.call({toString:null},"toString"),u2=Uh.call(function(){},"prototype"),Ms=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],kl=function(t){var e=t.constructor;return e&&e.prototype===t},f2={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h2=function(){if(typeof window=="undefined")return!1;for(var t in window)try{if(!f2["$"+t]&&Fs.call(window,t)&&window[t]!==null&&typeof window[t]=="object")try{kl(window[t])}catch(e){return!0}}catch(e){return!0}return!1}(),d2=function(t){if(typeof window=="undefined"||!h2)return kl(t);try{return kl(t)}catch(e){return!1}},p2=function(e){var n=e!==null&&typeof e=="object",r=Hh.call(e)==="[object Function]",i=l2(e),a=n&&Hh.call(e)==="[object String]",s=[];if(!n&&!r&&!i)throw new TypeError("Object.keys called on a non-object");var o=u2&&r;if(a&&e.length>0&&!Fs.call(e,0))for(var l=0;l0)for(var c=0;c{"use strict";v();var JM=Array.prototype.slice,QM=$h(),y2=Object.keys,Al=y2?function(e){return y2(e)}:g2(),v2=Object.keys;Al.shim=function(){if(Object.keys){var e=function(){var n=Object.keys(arguments);return n&&n.length===arguments.length}(1,2);e||(Object.keys=function(r){return QM(r)?v2(JM.call(r)):v2(r)})}else Object.keys=Al;return Object.keys||Al};w2.exports=Al});var x2=R((E9,b2)=>{"use strict";v();b2.exports=Error});var S2=R((A9,_2)=>{"use strict";v();_2.exports=EvalError});var k2=R((C9,E2)=>{"use strict";v();E2.exports=RangeError});var T2=R((M9,A2)=>{"use strict";v();A2.exports=ReferenceError});var zh=R((P9,C2)=>{"use strict";v();C2.exports=SyntaxError});var Wn=R((R9,F2)=>{"use strict";v();F2.exports=TypeError});var O2=R((j9,M2)=>{"use strict";v();M2.exports=URIError});var Os=R((B9,P2)=>{"use strict";v();P2.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},n=Symbol("test"),r=Object(n);if(typeof n=="string"||Object.prototype.toString.call(n)!=="[object Symbol]"||Object.prototype.toString.call(r)!=="[object Symbol]")return!1;var i=42;e[n]=i;for(n in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==n||!Object.prototype.propertyIsEnumerable.call(e,n))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var s=Object.getOwnPropertyDescriptor(e,n);if(s.value!==i||s.enumerable!==!0)return!1}return!0}});var Cl=R(($9,R2)=>{"use strict";v();var I2=typeof Symbol!="undefined"&&Symbol,eO=Os();R2.exports=function(){return typeof I2!="function"||typeof Symbol!="function"||typeof I2("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:eO()}});var j2=R((U9,L2)=>{"use strict";v();var Gh={__proto__:null,foo:{}},tO=Object;L2.exports=function(){return{__proto__:Gh}.foo===Gh.foo&&!(Gh instanceof tO)}});var N2=R((G9,B2)=>{"use strict";v();var nO="Function.prototype.bind called on incompatible ",rO=Object.prototype.toString,iO=Math.max,aO="[object Function]",D2=function(e,n){for(var r=[],i=0;i{"use strict";v();var lO=N2();$2.exports=Function.prototype.bind||lO});var Vh=R((X9,H2)=>{"use strict";v();var cO=Function.prototype.call,uO=Object.prototype.hasOwnProperty,fO=Fl();H2.exports=fO.call(cO,uO)});var pn=R((Z9,W2)=>{"use strict";v();var pe,hO=x2(),dO=S2(),pO=k2(),mO=T2(),Ki=zh(),Zi=Wn(),gO=O2(),V2=Function,Wh=function(t){try{return V2('"use strict"; return ('+t+").constructor;")()}catch(e){}},Yr=Object.getOwnPropertyDescriptor;if(Yr)try{Yr({},"")}catch(t){Yr=null}var qh=function(){throw new Zi},yO=Yr?function(){try{return arguments.callee,qh}catch(t){try{return Yr(arguments,"callee").get}catch(e){return qh}}}():qh,Xi=Cl()(),vO=j2()(),ft=Object.getPrototypeOf||(vO?function(t){return t.__proto__}:null),Yi={},wO=typeof Uint8Array=="undefined"||!ft?pe:ft(Uint8Array),Zr={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?pe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?pe:ArrayBuffer,"%ArrayIteratorPrototype%":Xi&&ft?ft([][Symbol.iterator]()):pe,"%AsyncFromSyncIteratorPrototype%":pe,"%AsyncFunction%":Yi,"%AsyncGenerator%":Yi,"%AsyncGeneratorFunction%":Yi,"%AsyncIteratorPrototype%":Yi,"%Atomics%":typeof Atomics=="undefined"?pe:Atomics,"%BigInt%":typeof BigInt=="undefined"?pe:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?pe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?pe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?pe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":hO,"%eval%":eval,"%EvalError%":dO,"%Float32Array%":typeof Float32Array=="undefined"?pe:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?pe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?pe:FinalizationRegistry,"%Function%":V2,"%GeneratorFunction%":Yi,"%Int8Array%":typeof Int8Array=="undefined"?pe:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?pe:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?pe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Xi&&ft?ft(ft([][Symbol.iterator]())):pe,"%JSON%":typeof JSON=="object"?JSON:pe,"%Map%":typeof Map=="undefined"?pe:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Xi||!ft?pe:ft(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?pe:Promise,"%Proxy%":typeof Proxy=="undefined"?pe:Proxy,"%RangeError%":pO,"%ReferenceError%":mO,"%Reflect%":typeof Reflect=="undefined"?pe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?pe:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Xi||!ft?pe:ft(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?pe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Xi&&ft?ft(""[Symbol.iterator]()):pe,"%Symbol%":Xi?Symbol:pe,"%SyntaxError%":Ki,"%ThrowTypeError%":yO,"%TypedArray%":wO,"%TypeError%":Zi,"%Uint8Array%":typeof Uint8Array=="undefined"?pe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?pe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?pe:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?pe:Uint32Array,"%URIError%":gO,"%WeakMap%":typeof WeakMap=="undefined"?pe:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?pe:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?pe:WeakSet};if(ft)try{null.error}catch(t){U2=ft(ft(t)),Zr["%Error.prototype%"]=U2}var U2,bO=function t(e){var n;if(e==="%AsyncFunction%")n=Wh("async function () {}");else if(e==="%GeneratorFunction%")n=Wh("function* () {}");else if(e==="%AsyncGeneratorFunction%")n=Wh("async function* () {}");else if(e==="%AsyncGenerator%"){var r=t("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=t("%AsyncGenerator%");i&&ft&&(n=ft(i.prototype))}return Zr[e]=n,n},z2={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Ps=Fl(),Ml=Vh(),xO=Ps.call(Function.call,Array.prototype.concat),_O=Ps.call(Function.apply,Array.prototype.splice),G2=Ps.call(Function.call,String.prototype.replace),Ol=Ps.call(Function.call,String.prototype.slice),SO=Ps.call(Function.call,RegExp.prototype.exec),EO=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,kO=/\\(\\)?/g,AO=function(e){var n=Ol(e,0,1),r=Ol(e,-1);if(n==="%"&&r!=="%")throw new Ki("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new Ki("invalid intrinsic syntax, expected opening `%`");var i=[];return G2(e,EO,function(a,s,o,l){i[i.length]=o?G2(l,kO,"$1"):s||a}),i},TO=function(e,n){var r=e,i;if(Ml(z2,r)&&(i=z2[r],r="%"+i[0]+"%"),Ml(Zr,r)){var a=Zr[r];if(a===Yi&&(a=bO(r)),typeof a=="undefined"&&!n)throw new Zi("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:a}}throw new Ki("intrinsic "+e+" does not exist!")};W2.exports=function(e,n){if(typeof e!="string"||e.length===0)throw new Zi("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new Zi('"allowMissing" argument must be a boolean');if(SO(/^%?[^%]*%?$/,e)===null)throw new Ki("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=AO(e),i=r.length>0?r[0]:"",a=TO("%"+i+"%",n),s=a.name,o=a.value,l=!1,c=a.alias;c&&(i=c[0],_O(r,xO([0,1],c)));for(var u=1,f=!0;u=r.length){var g=Yr(o,h);f=!!g,f&&"get"in g&&!("originalValue"in g.get)?o=g.get:o=o[h]}else f=Ml(o,h),o=o[h];f&&!l&&(Zr[s]=o)}}return o}});var Il=R((J9,q2)=>{"use strict";v();var CO=pn(),Pl=CO("%Object.defineProperty%",!0)||!1;if(Pl)try{Pl({},"a",{value:1})}catch(t){Pl=!1}q2.exports=Pl});var Ll=R((eB,X2)=>{"use strict";v();var FO=pn(),Rl=FO("%Object.getOwnPropertyDescriptor%",!0);if(Rl)try{Rl([],"length")}catch(t){Rl=null}X2.exports=Rl});var jl=R((nB,K2)=>{"use strict";v();var Y2=Il(),MO=zh(),Ji=Wn(),Z2=Ll();K2.exports=function(e,n,r){if(!e||typeof e!="object"&&typeof e!="function")throw new Ji("`obj` must be an object or a function`");if(typeof n!="string"&&typeof n!="symbol")throw new Ji("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ji("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ji("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ji("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ji("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,a=arguments.length>4?arguments[4]:null,s=arguments.length>5?arguments[5]:null,o=arguments.length>6?arguments[6]:!1,l=!!Z2&&Z2(e,n);if(Y2)Y2(e,n,{configurable:s===null&&l?l.configurable:!s,enumerable:i===null&&l?l.enumerable:!i,value:r,writable:a===null&&l?l.writable:!a});else if(o||!i&&!a&&!s)e[n]=r;else throw new MO("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Dl=R((iB,Q2)=>{"use strict";v();var Xh=Il(),J2=function(){return!!Xh};J2.hasArrayLengthDefineBug=function(){if(!Xh)return null;try{return Xh([],"length",{value:1}).length!==1}catch(e){return!0}};Q2.exports=J2});var hr=R((sB,rb)=>{"use strict";v();var OO=Tl(),PO=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",IO=Object.prototype.toString,RO=Array.prototype.concat,eb=jl(),LO=function(t){return typeof t=="function"&&IO.call(t)==="[object Function]"},tb=Dl()(),jO=function(t,e,n,r){if(e in t){if(r===!0){if(t[e]===n)return}else if(!LO(r)||!r())return}tb?eb(t,e,n,!0):eb(t,e,n)},nb=function(t,e){var n=arguments.length>2?arguments[2]:{},r=OO(e);PO&&(r=RO.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i{"use strict";v();var DO=pn(),ib=jl(),BO=Dl()(),ab=Ll(),sb=Wn(),NO=DO("%Math.floor%");ob.exports=function(e,n){if(typeof e!="function")throw new sb("`fn` is not a function");if(typeof n!="number"||n<0||n>4294967295||NO(n)!==n)throw new sb("`length` must be a positive 32-bit integer");var r=arguments.length>2&&!!arguments[2],i=!0,a=!0;if("length"in e&&ab){var s=ab(e,"length");s&&!s.configurable&&(i=!1),s&&!s.writable&&(a=!1)}return(i||a||!r)&&(BO?ib(e,"length",n,!0,!0):ib(e,"length",n)),e}});var Kr=R((uB,Bl)=>{"use strict";v();var Yh=Fl(),Nl=pn(),$O=lb(),HO=Wn(),fb=Nl("%Function.prototype.apply%"),hb=Nl("%Function.prototype.call%"),db=Nl("%Reflect.apply%",!0)||Yh.call(hb,fb),cb=Il(),UO=Nl("%Math.max%");Bl.exports=function(e){if(typeof e!="function")throw new HO("a function is required");var n=db(Yh,hb,arguments);return $O(n,1+UO(0,e.length-(arguments.length-1)),!0)};var ub=function(){return db(Yh,fb,arguments)};cb?cb(Bl.exports,"apply",{value:ub}):Bl.exports.apply=ub});var qt=R((hB,gb)=>{"use strict";v();var pb=pn(),mb=Kr(),zO=mb(pb("String.prototype.indexOf"));gb.exports=function(e,n){var r=pb(e,!!n);return typeof r=="function"&&zO(e,".prototype.")>-1?mb(r):r}});var Zh=R((pB,xb)=>{"use strict";v();var GO=Tl(),wb=Os()(),bb=qt(),yb=Object,VO=bb("Array.prototype.push"),vb=bb("Object.prototype.propertyIsEnumerable"),WO=wb?Object.getOwnPropertySymbols:null;xb.exports=function(e,n){if(e==null)throw new TypeError("target must be an object");var r=yb(e);if(arguments.length===1)return r;for(var i=1;i{"use strict";v();var Kh=Zh(),qO=function(){if(!Object.assign)return!1;for(var t="abcdefghijklmnopqrst",e=t.split(""),n={},r=0;r{"use strict";v();var YO=hr(),ZO=Jh();Sb.exports=function(){var e=ZO();return YO(Object,{assign:e},{assign:function(){return Object.assign!==e}}),e}});var Cb=R((bB,Tb)=>{"use strict";v();var KO=hr(),JO=Kr(),QO=Zh(),kb=Jh(),eP=Eb(),tP=JO.apply(kb()),Ab=function(e,n){return tP(Object,arguments)};KO(Ab,{getPolyfill:kb,implementation:QO,shim:eP});Tb.exports=Ab});var Mb=R((_B,Fb)=>{"use strict";v();var Rs=function(){return typeof function(){}.name=="string"},Is=Object.getOwnPropertyDescriptor;if(Is)try{Is([],"length")}catch(t){Is=null}Rs.functionsHaveConfigurableNames=function(){if(!Rs()||!Is)return!1;var e=Is(function(){},"name");return!!e&&!!e.configurable};var nP=Function.prototype.bind;Rs.boundFunctionsHaveNames=function(){return Rs()&&typeof nP=="function"&&function(){}.bind().name!==""};Fb.exports=Rs});var Ib=R((EB,Pb)=>{"use strict";v();var Ob=jl(),rP=Dl()(),iP=Mb().functionsHaveConfigurableNames(),aP=Wn();Pb.exports=function(e,n){if(typeof e!="function")throw new aP("`fn` is not a function");var r=arguments.length>2&&!!arguments[2];return(!r||iP)&&(rP?Ob(e,"name",n,!0,!0):Ob(e,"name",n)),e}});var Qh=R((AB,Rb)=>{"use strict";v();var sP=Ib(),oP=Wn(),lP=Object;Rb.exports=sP(function(){if(this==null||this!==lP(this))throw new oP("RegExp.prototype.flags getter called on non-object");var e="";return this.hasIndices&&(e+="d"),this.global&&(e+="g"),this.ignoreCase&&(e+="i"),this.multiline&&(e+="m"),this.dotAll&&(e+="s"),this.unicode&&(e+="u"),this.unicodeSets&&(e+="v"),this.sticky&&(e+="y"),e},"get flags",!0)});var ed=R((CB,Lb)=>{"use strict";v();var cP=Qh(),uP=hr().supportsDescriptors,fP=Object.getOwnPropertyDescriptor;Lb.exports=function(){if(uP&&/a/mig.flags==="gim"){var e=fP(RegExp.prototype,"flags");if(e&&typeof e.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var n="",r={};if(Object.defineProperty(r,"hasIndices",{get:function(){n+="d"}}),Object.defineProperty(r,"sticky",{get:function(){n+="y"}}),e.get.call(r),n==="dy")return e.get}}return cP}});var Bb=R((MB,Db)=>{"use strict";v();var hP=hr().supportsDescriptors,dP=ed(),pP=Object.getOwnPropertyDescriptor,mP=Object.defineProperty,gP=TypeError,jb=Object.getPrototypeOf,yP=/a/;Db.exports=function(){if(!hP||!jb)throw new gP("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var e=dP(),n=jb(yP),r=pP(n,"flags");return(!r||r.get!==e)&&mP(n,"flags",{configurable:!0,enumerable:!1,get:e}),e}});var Ub=R((PB,Hb)=>{"use strict";v();var vP=hr(),wP=Kr(),bP=Qh(),Nb=ed(),xP=Bb(),$b=wP(Nb());vP($b,{getPolyfill:Nb,implementation:bP,shim:xP});Hb.exports=$b});var dr=R((RB,zb)=>{"use strict";v();var _P=Os();zb.exports=function(){return _P()&&!!Symbol.toStringTag}});var nd=R((jB,Vb)=>{"use strict";v();var SP=dr()(),EP=qt(),td=EP("Object.prototype.toString"),$l=function(e){return SP&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:td(e)==="[object Arguments]"},Gb=function(e){return $l(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&td(e)!=="[object Array]"&&td(e.callee)==="[object Function]"},kP=function(){return $l(arguments)}();$l.isLegacyArguments=Gb;Vb.exports=kP?$l:Gb});var Wb=R(()=>{v()});var hx=R((HB,fx)=>{v();var hd=typeof Map=="function"&&Map.prototype,rd=Object.getOwnPropertyDescriptor&&hd?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Ul=hd&&rd&&typeof rd.get=="function"?rd.get:null,qb=hd&&Map.prototype.forEach,dd=typeof Set=="function"&&Set.prototype,id=Object.getOwnPropertyDescriptor&&dd?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,zl=dd&&id&&typeof id.get=="function"?id.get:null,Xb=dd&&Set.prototype.forEach,AP=typeof WeakMap=="function"&&WeakMap.prototype,js=AP?WeakMap.prototype.has:null,TP=typeof WeakSet=="function"&&WeakSet.prototype,Ds=TP?WeakSet.prototype.has:null,CP=typeof WeakRef=="function"&&WeakRef.prototype,Yb=CP?WeakRef.prototype.deref:null,FP=Boolean.prototype.valueOf,MP=Object.prototype.toString,OP=Function.prototype.toString,PP=String.prototype.match,pd=String.prototype.slice,mr=String.prototype.replace,IP=String.prototype.toUpperCase,Zb=String.prototype.toLowerCase,ax=RegExp.prototype.test,Kb=Array.prototype.concat,On=Array.prototype.join,RP=Array.prototype.slice,Jb=Math.floor,od=typeof BigInt=="function"?BigInt.prototype.valueOf:null,ad=Object.getOwnPropertySymbols,ld=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Qi=typeof Symbol=="function"&&typeof Symbol.iterator=="object",yt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Qi||!0)?Symbol.toStringTag:null,sx=Object.prototype.propertyIsEnumerable,Qb=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(t){return t.__proto__}:null);function ex(t,e){if(t===1/0||t===-1/0||t!==t||t&&t>-1e3&&t<1e3||ax.call(/e/,e))return e;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof t=="number"){var r=t<0?-Jb(-t):Jb(t);if(r!==t){var i=String(r),a=pd.call(e,i.length+1);return mr.call(i,n,"$&_")+"."+mr.call(mr.call(a,/([0-9]{3})/g,"$&_"),/_$/,"")}}return mr.call(e,n,"$&_")}var cd=Wb(),tx=cd.custom,nx=lx(tx)?tx:null;fx.exports=function t(e,n,r,i){var a=n||{};if(pr(a,"quoteStyle")&&a.quoteStyle!=="single"&&a.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(pr(a,"maxStringLength")&&(typeof a.maxStringLength=="number"?a.maxStringLength<0&&a.maxStringLength!==1/0:a.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=pr(a,"customInspect")?a.customInspect:!0;if(typeof s!="boolean"&&s!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(pr(a,"indent")&&a.indent!==null&&a.indent!==" "&&!(parseInt(a.indent,10)===a.indent&&a.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(pr(a,"numericSeparator")&&typeof a.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var o=a.numericSeparator;if(typeof e=="undefined")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return ux(e,a);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return o?ex(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return o?ex(e,c):c}var u=typeof a.depth=="undefined"?5:a.depth;if(typeof r=="undefined"&&(r=0),r>=u&&u>0&&typeof e=="object")return ud(e)?"[Array]":"[Object]";var f=JP(a,r);if(typeof i=="undefined")i=[];else if(cx(i,e)>=0)return"[Circular]";function h(N,j,Y){if(j&&(i=RP.call(i),i.push(j)),Y){var le={depth:a.depth};return pr(a,"quoteStyle")&&(le.quoteStyle=a.quoteStyle),t(N,le,r+1,i)}return t(N,a,r+1,i)}if(typeof e=="function"&&!rx(e)){var d=zP(e),p=Hl(e,h);return"[Function"+(d?": "+d:" (anonymous)")+"]"+(p.length>0?" { "+On.call(p,", ")+" }":"")}if(lx(e)){var g=Qi?mr.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):ld.call(e);return typeof e=="object"&&!Qi?Ls(g):g}if(YP(e)){for(var m="<"+Zb.call(String(e.nodeName)),w=e.attributes||[],b=0;b",m}if(ud(e)){if(e.length===0)return"[]";var S=Hl(e,h);return f&&!KP(S)?"["+fd(S,f)+"]":"[ "+On.call(S,", ")+" ]"}if(DP(e)){var k=Hl(e,h);return!("cause"in Error.prototype)&&"cause"in e&&!sx.call(e,"cause")?"{ ["+String(e)+"] "+On.call(Kb.call("[cause]: "+h(e.cause),k),", ")+" }":k.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+On.call(k,", ")+" }"}if(typeof e=="object"&&s){if(nx&&typeof e[nx]=="function"&&cd)return cd(e,{depth:u-r});if(s!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(GP(e)){var x=[];return qb&&qb.call(e,function(N,j){x.push(h(j,e,!0)+" => "+h(N,e))}),ix("Map",Ul.call(e),x,f)}if(qP(e)){var A=[];return Xb&&Xb.call(e,function(N){A.push(h(N,e))}),ix("Set",zl.call(e),A,f)}if(VP(e))return sd("WeakMap");if(XP(e))return sd("WeakSet");if(WP(e))return sd("WeakRef");if(NP(e))return Ls(h(Number(e)));if(HP(e))return Ls(h(od.call(e)));if($P(e))return Ls(FP.call(e));if(BP(e))return Ls(h(String(e)));if(typeof window!="undefined"&&e===window)return"{ [object Window] }";if(typeof globalThis!="undefined"&&e===globalThis||typeof global!="undefined"&&e===global)return"{ [object globalThis] }";if(!jP(e)&&!rx(e)){var y=Hl(e,h),E=Qb?Qb(e)===Object.prototype:e instanceof Object||e.constructor===Object,_=e instanceof Object?"":"null prototype",C=!E&&yt&&Object(e)===e&&yt in e?pd.call(gr(e),8,-1):_?"Object":"",M=E||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",L=M+(C||_?"["+On.call(Kb.call([],C||[],_||[]),": ")+"] ":"");return y.length===0?L+"{}":f?L+"{"+fd(y,f)+"}":L+"{ "+On.call(y,", ")+" }"}return String(e)};function ox(t,e,n){var r=(n.quoteStyle||e)==="double"?'"':"'";return r+t+r}function LP(t){return mr.call(String(t),/"/g,""")}function ud(t){return gr(t)==="[object Array]"&&(!yt||!(typeof t=="object"&&yt in t))}function jP(t){return gr(t)==="[object Date]"&&(!yt||!(typeof t=="object"&&yt in t))}function rx(t){return gr(t)==="[object RegExp]"&&(!yt||!(typeof t=="object"&&yt in t))}function DP(t){return gr(t)==="[object Error]"&&(!yt||!(typeof t=="object"&&yt in t))}function BP(t){return gr(t)==="[object String]"&&(!yt||!(typeof t=="object"&&yt in t))}function NP(t){return gr(t)==="[object Number]"&&(!yt||!(typeof t=="object"&&yt in t))}function $P(t){return gr(t)==="[object Boolean]"&&(!yt||!(typeof t=="object"&&yt in t))}function lx(t){if(Qi)return t&&typeof t=="object"&&t instanceof Symbol;if(typeof t=="symbol")return!0;if(!t||typeof t!="object"||!ld)return!1;try{return ld.call(t),!0}catch(e){}return!1}function HP(t){if(!t||typeof t!="object"||!od)return!1;try{return od.call(t),!0}catch(e){}return!1}var UP=Object.prototype.hasOwnProperty||function(t){return t in this};function pr(t,e){return UP.call(t,e)}function gr(t){return MP.call(t)}function zP(t){if(t.name)return t.name;var e=PP.call(OP.call(t),/^function\s*([\w$]+)/);return e?e[1]:null}function cx(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;ne.maxStringLength){var n=t.length-e.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return ux(pd.call(t,0,e.maxStringLength),e)+r}var i=mr.call(mr.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ZP);return ox(i,"single",e)}function ZP(t){var e=t.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return n?"\\"+n:"\\x"+(e<16?"0":"")+IP.call(e.toString(16))}function Ls(t){return"Object("+t+")"}function sd(t){return t+" { ? }"}function ix(t,e,n,r){var i=r?fd(n,r):On.call(n,", ");return t+" ("+e+") {"+i+"}"}function KP(t){for(var e=0;e=0)return!1;return!0}function JP(t,e){var n;if(t.indent===" ")n=" ";else if(typeof t.indent=="number"&&t.indent>0)n=On.call(Array(t.indent+1)," ");else return null;return{base:n,prev:On.call(Array(e+1),n)}}function fd(t,e){if(t.length===0)return"";var n=` `+e.prev+e.base;return n+On.call(t,","+n)+` `+e.prev}function Hl(t,e){var n=ud(t),r=[];if(n){r.length=t.length;for(var i=0;i{"use strict";v();var dx=pn(),ea=qt(),QP=hx(),eI=Wn(),Gl=dx("%WeakMap%",!0),Vl=dx("%Map%",!0),tI=ea("WeakMap.prototype.get",!0),nI=ea("WeakMap.prototype.set",!0),rI=ea("WeakMap.prototype.has",!0),iI=ea("Map.prototype.get",!0),aI=ea("Map.prototype.set",!0),sI=ea("Map.prototype.has",!0),md=function(t,e){for(var n=t,r;(r=n.next)!==null;n=r)if(r.key===e)return n.next=r.next,r.next=t.next,t.next=r,r},oI=function(t,e){var n=md(t,e);return n&&n.value},lI=function(t,e,n){var r=md(t,e);r?r.value=n:t.next={key:e,next:t.next,value:n}},cI=function(t,e){return!!md(t,e)};px.exports=function(){var e,n,r,i={assert:function(a){if(!i.has(a))throw new eI("Side channel does not contain "+QP(a))},get:function(a){if(Gl&&a&&(typeof a=="object"||typeof a=="function")){if(e)return tI(e,a)}else if(Vl){if(n)return iI(n,a)}else if(r)return oI(r,a)},has:function(a){if(Gl&&a&&(typeof a=="object"||typeof a=="function")){if(e)return rI(e,a)}else if(Vl){if(n)return sI(n,a)}else if(r)return cI(r,a);return!1},set:function(a,s){Gl&&a&&(typeof a=="object"||typeof a=="function")?(e||(e=new Gl),nI(e,a,s)):Vl?(n||(n=new Vl),aI(n,a,s)):(r||(r={key:{},next:null}),lI(r,a,s))}};return i}});var gx=R((VB,mx)=>{"use strict";v();var uI=Vh(),Bs=gd()(),qn=Wn(),yd={assert:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new qn("`O` is not an object");if(typeof e!="string")throw new qn("`slot` must be a string");if(Bs.assert(t),!yd.has(t,e))throw new qn("`"+e+"` is not present on `O`")},get:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new qn("`O` is not an object");if(typeof e!="string")throw new qn("`slot` must be a string");var n=Bs.get(t);return n&&n["$"+e]},has:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new qn("`O` is not an object");if(typeof e!="string")throw new qn("`slot` must be a string");var n=Bs.get(t);return!!n&&uI(n,"$"+e)},set:function(t,e,n){if(!t||typeof t!="object"&&typeof t!="function")throw new qn("`O` is not an object");if(typeof e!="string")throw new qn("`slot` must be a string");var r=Bs.get(t);r||(r={},Bs.set(t,r)),r["$"+e]=n}};Object.freeze&&Object.freeze(yd);mx.exports=yd});var wx=R((qB,vx)=>{"use strict";v();var Ns=gx(),fI=SyntaxError,yx=typeof StopIteration=="object"?StopIteration:null;vx.exports=function(e){if(!yx)throw new fI("this environment lacks StopIteration");Ns.set(e,"[[Done]]",!1);var n={next:function(){var i=Ns.get(this,"[[Iterator]]"),a=Ns.get(i,"[[Done]]");try{return{done:a,value:a?void 0:i.next()}}catch(s){if(Ns.set(i,"[[Done]]",!0),s!==yx)throw s;return{done:!0,value:void 0}}}};return Ns.set(n,"[[Iterator]]",e),n}});var vd=R((YB,bx)=>{v();var hI={}.toString;bx.exports=Array.isArray||function(t){return hI.call(t)=="[object Array]"}});var wd=R((KB,xx)=>{"use strict";v();var dI=String.prototype.valueOf,pI=function(e){try{return dI.call(e),!0}catch(n){return!1}},mI=Object.prototype.toString,gI="[object String]",yI=dr()();xx.exports=function(e){return typeof e=="string"?!0:typeof e!="object"?!1:yI?pI(e):mI.call(e)===gI}});var xd=R((QB,Ex)=>{"use strict";v();var bd=typeof Map=="function"&&Map.prototype?Map:null,vI=typeof Set=="function"&&Set.prototype?Set:null,Wl;bd||(Wl=function(e){return!1});var Sx=bd?Map.prototype.has:null,_x=vI?Set.prototype.has:null;!Wl&&!Sx&&(Wl=function(e){return!1});Ex.exports=Wl||function(e){if(!e||typeof e!="object")return!1;try{if(Sx.call(e),_x)try{_x.call(e)}catch(n){return!0}return e instanceof bd}catch(n){}return!1}});var Sd=R((tN,Tx)=>{"use strict";v();var wI=typeof Map=="function"&&Map.prototype?Map:null,_d=typeof Set=="function"&&Set.prototype?Set:null,ql;_d||(ql=function(e){return!1});var kx=wI?Map.prototype.has:null,Ax=_d?Set.prototype.has:null;!ql&&!Ax&&(ql=function(e){return!1});Tx.exports=ql||function(e){if(!e||typeof e!="object")return!1;try{if(Ax.call(e),kx)try{kx.call(e)}catch(n){return!0}return e instanceof _d}catch(n){}return!1}});var Nx=R((rN,Zl)=>{"use strict";v();var Cx=nd(),Fx=wx();Cl()()||Os()()?(Xl=Symbol.iterator,Zl.exports=function(e){if(e!=null&&typeof e[Xl]!="undefined")return e[Xl]();if(Cx(e))return Array.prototype[Xl].call(e)}):(Mx=vd(),Ox=wd(),Ed=pn(),Px=Ed("%Map%",!0),Ix=Ed("%Set%",!0),rn=qt(),kd=rn("Array.prototype.push"),Ad=rn("String.prototype.charCodeAt"),Rx=rn("String.prototype.slice"),Lx=function(e,n){var r=e.length;if(n+1>=r)return n+1;var i=Ad(e,n);if(i<55296||i>56319)return n+1;var a=Ad(e,n+1);return a<56320||a>57343?n+1:n+2},Yl=function(e){var n=0;return{next:function(){var i=n>=e.length,a;return i||(a=e[n],n+=1),{done:i,value:a}}}},Td=function(e,n){if(Mx(e)||Cx(e))return Yl(e);if(Ox(e)){var r=0;return{next:function(){var a=Lx(e,r),s=Rx(e,r,a);return r=a,{done:a>e.length,value:s}}}}if(n&&typeof e["_es6-shim iterator_"]!="undefined")return e["_es6-shim iterator_"]()},!Px&&!Ix?Zl.exports=function(e){if(e!=null)return Td(e,!0)}:(jx=xd(),Dx=Sd(),Cd=rn("Map.prototype.forEach",!0),Fd=rn("Set.prototype.forEach",!0),(typeof process=="undefined"||!process.versions||!process.versions.node)&&(Md=rn("Map.prototype.iterator",!0),Od=rn("Set.prototype.iterator",!0)),Pd=rn("Map.prototype.@@iterator",!0)||rn("Map.prototype._es6-shim iterator_",!0),Id=rn("Set.prototype.@@iterator",!0)||rn("Set.prototype._es6-shim iterator_",!0),Bx=function(e){if(jx(e)){if(Md)return Fx(Md(e));if(Pd)return Pd(e);if(Cd){var n=[];return Cd(e,function(i,a){kd(n,[a,i])}),Yl(n)}}if(Dx(e)){if(Od)return Fx(Od(e));if(Id)return Id(e);if(Fd){var r=[];return Fd(e,function(i){kd(r,i)}),Yl(r)}}},Zl.exports=function(e){return Bx(e)||Td(e)}));var Xl,Mx,Ox,Ed,Px,Ix,rn,kd,Ad,Rx,Lx,Yl,Td,jx,Dx,Cd,Fd,Md,Od,Pd,Id,Bx});var Rd=R((aN,Hx)=>{"use strict";v();var $x=function(t){return t!==t};Hx.exports=function(e,n){return e===0&&n===0?1/e===1/n:!!(e===n||$x(e)&&$x(n))}});var Ld=R((oN,Ux)=>{"use strict";v();var bI=Rd();Ux.exports=function(){return typeof Object.is=="function"?Object.is:bI}});var Gx=R((cN,zx)=>{"use strict";v();var xI=Ld(),_I=hr();zx.exports=function(){var e=xI();return _I(Object,{is:e},{is:function(){return Object.is!==e}}),e}});var Xx=R((fN,qx)=>{"use strict";v();var SI=hr(),EI=Kr(),kI=Rd(),Vx=Ld(),AI=Gx(),Wx=EI(Vx(),Object);SI(Wx,{getPolyfill:Vx,implementation:kI,shim:AI});qx.exports=Wx});var Dd=R((dN,Jx)=>{"use strict";v();var TI=Kr(),Kx=qt(),CI=pn(),jd=CI("%ArrayBuffer%",!0),Kl=Kx("ArrayBuffer.prototype.byteLength",!0),FI=Kx("Object.prototype.toString"),Yx=!!jd&&!Kl&&new jd(0).slice,Zx=!!Yx&&TI(Yx);Jx.exports=Kl||Zx?function(e){if(!e||typeof e!="object")return!1;try{return Kl?Kl(e):Zx(e,0),!0}catch(n){return!1}}:jd?function(e){return FI(e)==="[object ArrayBuffer]"}:function(e){return!1}});var e_=R((mN,Qx)=>{"use strict";v();var MI=Date.prototype.getDay,OI=function(e){try{return MI.call(e),!0}catch(n){return!1}},PI=Object.prototype.toString,II="[object Date]",RI=dr()();Qx.exports=function(e){return typeof e!="object"||e===null?!1:RI?OI(e):PI.call(e)===II}});var a_=R((yN,i_)=>{"use strict";v();var Bd=qt(),t_=dr()(),n_,r_,Nd,$d;t_&&(n_=Bd("Object.prototype.hasOwnProperty"),r_=Bd("RegExp.prototype.exec"),Nd={},Jl=function(){throw Nd},$d={toString:Jl,valueOf:Jl},typeof Symbol.toPrimitive=="symbol"&&($d[Symbol.toPrimitive]=Jl));var Jl,LI=Bd("Object.prototype.toString"),jI=Object.getOwnPropertyDescriptor,DI="[object RegExp]";i_.exports=t_?function(e){if(!e||typeof e!="object")return!1;var n=jI(e,"lastIndex"),r=n&&n_(n,"value");if(!r)return!1;try{r_(e,$d)}catch(i){return i===Nd}}:function(e){return!e||typeof e!="object"&&typeof e!="function"?!1:LI(e)===DI}});var l_=R((wN,o_)=>{"use strict";v();var BI=qt(),s_=BI("SharedArrayBuffer.prototype.byteLength",!0);o_.exports=s_?function(e){if(!e||typeof e!="object")return!1;try{return s_(e),!0}catch(n){return!1}}:function(e){return!1}});var u_=R((xN,c_)=>{"use strict";v();var NI=Number.prototype.toString,$I=function(e){try{return NI.call(e),!0}catch(n){return!1}},HI=Object.prototype.toString,UI="[object Number]",zI=dr()();c_.exports=function(e){return typeof e=="number"?!0:typeof e!="object"?!1:zI?$I(e):HI.call(e)===UI}});var d_=R((SN,h_)=>{"use strict";v();var f_=qt(),GI=f_("Boolean.prototype.toString"),VI=f_("Object.prototype.toString"),WI=function(e){try{return GI(e),!0}catch(n){return!1}},qI="[object Boolean]",XI=dr()();h_.exports=function(e){return typeof e=="boolean"?!0:e===null||typeof e!="object"?!1:XI&&Symbol.toStringTag in e?WI(e):VI(e)===qI}});var y_=R((kN,Hd)=>{"use strict";v();var YI=Object.prototype.toString,ZI=Cl()();ZI?(p_=Symbol.prototype.toString,m_=/^Symbol\(.*\)$/,g_=function(e){return typeof e.valueOf()!="symbol"?!1:m_.test(p_.call(e))},Hd.exports=function(e){if(typeof e=="symbol")return!0;if(YI.call(e)!=="[object Symbol]")return!1;try{return g_(e)}catch(n){return!1}}):Hd.exports=function(e){return!1};var p_,m_,g_});var b_=R((TN,w_)=>{"use strict";v();var v_=typeof BigInt!="undefined"&&BigInt;w_.exports=function(){return typeof v_=="function"&&typeof BigInt=="function"&&typeof v_(42)=="bigint"&&typeof BigInt(42)=="bigint"}});var S_=R((FN,Ud)=>{"use strict";v();var KI=b_()();KI?(x_=BigInt.prototype.valueOf,__=function(e){try{return x_.call(e),!0}catch(n){}return!1},Ud.exports=function(e){return e===null||typeof e=="undefined"||typeof e=="boolean"||typeof e=="string"||typeof e=="number"||typeof e=="symbol"||typeof e=="function"?!1:typeof e=="bigint"?!0:__(e)}):Ud.exports=function(e){return!1};var x_,__});var k_=R((ON,E_)=>{"use strict";v();var JI=wd(),QI=u_(),eR=d_(),tR=y_(),nR=S_();E_.exports=function(e){if(e==null||typeof e!="object"&&typeof e!="function")return null;if(JI(e))return"String";if(QI(e))return"Number";if(eR(e))return"Boolean";if(tR(e))return"Symbol";if(nR(e))return"BigInt"}});var C_=R((IN,T_)=>{"use strict";v();var Ql=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,A_=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,ec;Ql||(ec=function(e){return!1});var Gd=Ql?Ql.prototype.has:null,zd=A_?A_.prototype.has:null;!ec&&!Gd&&(ec=function(e){return!1});T_.exports=ec||function(e){if(!e||typeof e!="object")return!1;try{if(Gd.call(e,Gd),zd)try{zd.call(e,zd)}catch(n){return!0}return e instanceof Ql}catch(n){}return!1}});var M_=R((LN,Wd)=>{"use strict";v();var rR=pn(),F_=qt(),iR=rR("%WeakSet%",!0),Vd=F_("WeakSet.prototype.has",!0);Vd?(tc=F_("WeakMap.prototype.has",!0),Wd.exports=function(e){if(!e||typeof e!="object")return!1;try{if(Vd(e,Vd),tc)try{tc(e,tc)}catch(n){return!0}return e instanceof iR}catch(n){}return!1}):Wd.exports=function(e){return!1};var tc});var P_=R((DN,O_)=>{"use strict";v();var aR=xd(),sR=Sd(),oR=C_(),lR=M_();O_.exports=function(e){if(e&&typeof e=="object"){if(aR(e))return"Map";if(sR(e))return"Set";if(oR(e))return"WeakMap";if(lR(e))return"WeakSet"}return!1}});var j_=R((NN,L_)=>{"use strict";v();var R_=Function.prototype.toString,ta=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Xd,nc;if(typeof ta=="function"&&typeof Object.defineProperty=="function")try{Xd=Object.defineProperty({},"length",{get:function(){throw nc}}),nc={},ta(function(){throw 42},null,Xd)}catch(t){t!==nc&&(ta=null)}else ta=null;var cR=/^\s*class\b/,Yd=function(e){try{var n=R_.call(e);return cR.test(n)}catch(r){return!1}},qd=function(e){try{return Yd(e)?!1:(R_.call(e),!0)}catch(n){return!1}},rc=Object.prototype.toString,uR="[object Object]",fR="[object Function]",hR="[object GeneratorFunction]",dR="[object HTMLAllCollection]",pR="[object HTML document.all class]",mR="[object HTMLCollection]",gR=typeof Symbol=="function"&&!!Symbol.toStringTag,yR=!(0 in[,]),Zd=function(){return!1};typeof document=="object"&&(I_=document.all,rc.call(I_)===rc.call(document.all)&&(Zd=function(e){if((yR||!e)&&(typeof e=="undefined"||typeof e=="object"))try{var n=rc.call(e);return(n===dR||n===pR||n===mR||n===uR)&&e("")==null}catch(r){}return!1}));var I_;L_.exports=ta?function(e){if(Zd(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{ta(e,null,Xd)}catch(n){if(n!==nc)return!1}return!Yd(e)&&qd(e)}:function(e){if(Zd(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(gR)return qd(e);if(Yd(e))return!1;var n=rc.call(e);return n!==fR&&n!==hR&&!/^\[object HTML/.test(n)?!1:qd(e)}});var N_=R((HN,B_)=>{"use strict";v();var vR=j_(),wR=Object.prototype.toString,D_=Object.prototype.hasOwnProperty,bR=function(e,n,r){for(var i=0,a=e.length;i=3&&(i=r),wR.call(e)==="[object Array]"?bR(e,n,i):typeof e=="string"?xR(e,n,i):_R(e,n,i)};B_.exports=SR});var H_=R((zN,$_)=>{"use strict";v();$_.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var z_=R((VN,U_)=>{"use strict";v();var Kd=H_(),ER=typeof globalThis=="undefined"?global:globalThis;U_.exports=function(){for(var e=[],n=0;n{"use strict";v();var ac=N_(),kR=z_(),G_=Kr(),ep=qt(),ic=Ll(),AR=ep("Object.prototype.toString"),W_=dr()(),V_=typeof globalThis=="undefined"?global:globalThis,Qd=kR(),tp=ep("String.prototype.slice"),Jd=Object.getPrototypeOf,TR=ep("Array.prototype.indexOf",!0)||function(e,n){for(var r=0;r-1?n:n!=="Object"?!1:FR(e)}return ic?CR(e):null}});var K_=R((YN,Z_)=>{"use strict";v();var MR=qt(),Y_=MR("ArrayBuffer.prototype.byteLength",!0),OR=Dd();Z_.exports=function(e){return OR(e)?Y_?Y_(e):e.byteLength:NaN}});var _S=R((KN,xS)=>{"use strict";v();var vS=Cb(),Pn=qt(),J_=Ub(),PR=pn(),na=Nx(),IR=gd(),Q_=Xx(),eS=nd(),tS=vd(),nS=Dd(),rS=e_(),iS=a_(),aS=l_(),sS=Tl(),oS=k_(),lS=P_(),cS=X_(),uS=K_(),fS=Pn("SharedArrayBuffer.prototype.byteLength",!0),hS=Pn("Date.prototype.getTime"),np=Object.getPrototypeOf,dS=Pn("Object.prototype.toString"),lc=PR("%Set%",!0),rp=Pn("Map.prototype.has",!0),cc=Pn("Map.prototype.get",!0),pS=Pn("Map.prototype.size",!0),uc=Pn("Set.prototype.add",!0),wS=Pn("Set.prototype.delete",!0),fc=Pn("Set.prototype.has",!0),oc=Pn("Set.prototype.size",!0);function mS(t,e,n,r){for(var i=na(t),a;(a=i.next())&&!a.done;)if(mn(e,a.value,n,r))return wS(t,a.value),!0;return!1}function bS(t){if(typeof t=="undefined")return null;if(typeof t!="object")return typeof t=="symbol"?!1:typeof t=="string"||typeof t=="number"?+t==+t:!0}function RR(t,e,n,r,i,a){var s=bS(n);if(s!=null)return s;var o=cc(e,s),l=vS({},i,{strict:!1});return typeof o=="undefined"&&!rp(e,s)||!mn(r,o,l,a)?!1:!rp(t,s)&&mn(r,o,l,a)}function LR(t,e,n){var r=bS(n);return r!=null?r:fc(e,r)&&!fc(t,r)}function gS(t,e,n,r,i,a){for(var s=na(t),o,l;(o=s.next())&&!o.done;)if(l=o.value,mn(n,l,i,a)&&mn(r,cc(e,l),i,a))return wS(t,l),!0;return!1}function mn(t,e,n,r){var i=n||{};if(i.strict?Q_(t,e):t===e)return!0;var a=oS(t),s=oS(e);if(a!==s)return!1;if(!t||!e||typeof t!="object"&&typeof e!="object")return i.strict?Q_(t,e):t==e;var o=r.has(t),l=r.has(e),c;if(o&&l){if(r.get(t)===r.get(e))return!0}else c={};return o||r.set(t,c),l||r.set(e,c),BR(t,e,i,r)}function yS(t){return!t||typeof t!="object"||typeof t.length!="number"||typeof t.copy!="function"||typeof t.slice!="function"||t.length>0&&typeof t[0]!="number"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function jR(t,e,n,r){if(oc(t)!==oc(e))return!1;for(var i=na(t),a=na(e),s,o,l;(s=i.next())&&!s.done;)if(s.value&&typeof s.value=="object")l||(l=new lc),uc(l,s.value);else if(!fc(e,s.value)){if(n.strict||!LR(t,e,s.value))return!1;l||(l=new lc),uc(l,s.value)}if(l){for(;(o=a.next())&&!o.done;)if(o.value&&typeof o.value=="object"){if(!mS(l,o.value,n.strict,r))return!1}else if(!n.strict&&!fc(t,o.value)&&!mS(l,o.value,n.strict,r))return!1;return oc(l)===0}return!0}function DR(t,e,n,r){if(pS(t)!==pS(e))return!1;for(var i=na(t),a=na(e),s,o,l,c,u,f;(s=i.next())&&!s.done;)if(c=s.value[0],u=s.value[1],c&&typeof c=="object")l||(l=new lc),uc(l,c);else if(f=cc(e,c),typeof f=="undefined"&&!rp(e,c)||!mn(u,f,n,r)){if(n.strict||!RR(t,e,c,u,n,r))return!1;l||(l=new lc),uc(l,c)}if(l){for(;(o=a.next())&&!o.done;)if(c=o.value[0],f=o.value[1],c&&typeof c=="object"){if(!gS(l,t,c,f,n,r))return!1}else if(!n.strict&&(!t.has(c)||!mn(cc(t,c),f,n,r))&&!gS(l,t,c,f,vS({},n,{strict:!1}),r))return!1;return oc(l)===0}return!0}function BR(t,e,n,r){var i,a;if(typeof t!=typeof e||t==null||e==null||dS(t)!==dS(e)||eS(t)!==eS(e))return!1;var s=tS(t),o=tS(e);if(s!==o)return!1;var l=t instanceof Error,c=e instanceof Error;if(l!==c||(l||c)&&(t.name!==e.name||t.message!==e.message))return!1;var u=iS(t),f=iS(e);if(u!==f||(u||f)&&(t.source!==e.source||J_(t)!==J_(e)))return!1;var h=rS(t),d=rS(e);if(h!==d||(h||d)&&hS(t)!==hS(e)||n.strict&&np&&np(t)!==np(e))return!1;var p=cS(t),g=cS(e);if(p!==g)return!1;if(p||g){if(t.length!==e.length)return!1;for(i=0;i=0;i--)if(A[i]!=y[i])return!1;for(i=A.length-1;i>=0;i--)if(a=A[i],!mn(t[a],e[a],n,r))return!1;var E=lS(t),_=lS(e);return E!==_?!1:E==="Set"||_==="Set"?jR(t,e,n,r):E==="Map"?DR(t,e,n,r):!0}xS.exports=function(e,n,r){return mn(e,n,r,IR())}});var cp=R((exports,module)=>{v();(function(){"use strict";var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&typeof module=="object"&&module.exports,AMD=typeof define=="function"&&define.amd,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];(root.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(t){return Object.prototype.toString.call(t)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(t){return typeof t=="object"&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t,e){return function(n){return new Sha256(e,!0).update(n)[t]()}},createMethod=function(t){var e=createOutputMethod("hex",t);NODE_JS&&(e=nodeWrap(e,t)),e.create=function(){return new Sha256(t)},e.update=function(i){return e.create().update(i)};for(var n=0;n>2]|=t[i]<>2]|=r<>2]|=(192|r>>6)<>2]|=(128|r&63)<=57344?(o[a>>2]|=(224|r>>12)<>2]|=(128|r>>6&63)<>2]|=(128|r&63)<>2]|=(240|r>>18)<>2]|=(128|r>>12&63)<>2]|=(128|r>>6&63)<>2]|=(128|r&63)<=64?(this.block=o[16],this.start=a-64,this.hash(),this.hashed=!0):this.start=a}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[16]=this.block,t[e>>2]|=EXTRA[e&3],this.block=t[16],e>=56&&(this.hashed||this.hash(),t[0]=this.block,t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.hBytes<<3|this.bytes>>>29,t[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var t=this.h0,e=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=this.blocks,c,u,f,h,d,p,g,m,w,b,S;for(c=16;c<64;++c)d=l[c-15],u=(d>>>7|d<<25)^(d>>>18|d<<14)^d>>>3,d=l[c-2],f=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,l[c]=l[c-16]+u+l[c-7]+f<<0;for(S=e&n,c=0;c<64;c+=4)this.first?(this.is224?(m=300032,d=l[0]-1413257819,o=d-150054599<<0,r=d+24177077<<0):(m=704751109,d=l[0]-210244248,o=d-1521486534<<0,r=d+143694565<<0),this.first=!1):(u=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),f=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),m=t&e,h=m^t&n^S,g=i&a^~i&s,d=o+f+g+K[c]+l[c],p=u+h,o=r+d<<0,r=d+p<<0),u=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),f=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),w=r&t,h=w^r&e^m,g=o&i^~o&a,d=s+f+g+K[c+1]+l[c+1],p=u+h,s=n+d<<0,n=d+p<<0,u=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),f=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),b=n&r,h=b^n&t^w,g=s&o^~s&i,d=a+f+g+K[c+2]+l[c+2],p=u+h,a=e+d<<0,e=d+p<<0,u=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),f=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),S=e&n,h=S^e&r^b,g=a&s^~a&o,d=i+f+g+K[c+3]+l[c+3],p=u+h,i=t+d<<0,t=d+p<<0;this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+n<<0,this.h3=this.h3+r<<0,this.h4=this.h4+i<<0,this.h5=this.h5+a<<0,this.h6=this.h6+s<<0,this.h7=this.h7+o<<0},Sha256.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[i&15]+HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[a&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15];return this.is224||(l+=HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15]),l},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,s=this.h6,o=this.h7,l=[t>>24&255,t>>16&255,t>>8&255,t&255,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24&255,n>>16&255,n>>8&255,n&255,r>>24&255,r>>16&255,r>>8&255,r&255,i>>24&255,i>>16&255,i>>8&255,i&255,a>>24&255,a>>16&255,a>>8&255,a&255,s>>24&255,s>>16&255,s>>8&255,s&255];return this.is224||l.push(o>>24&255,o>>16&255,o>>8&255,o&255),l},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(this.is224?28:32),e=new DataView(t);return e.setUint32(0,this.h0),e.setUint32(4,this.h1),e.setUint32(8,this.h2),e.setUint32(12,this.h3),e.setUint32(16,this.h4),e.setUint32(20,this.h5),e.setUint32(24,this.h6),this.is224||e.setUint32(28,this.h7),t};function HmacSha256(t,e,n){var r,i=typeof t;if(i==="string"){var a=[],s=t.length,o=0,l;for(r=0;r>6,a[o++]=128|l&63):l<55296||l>=57344?(a[o++]=224|l>>12,a[o++]=128|l>>6&63,a[o++]=128|l&63):(l=65536+((l&1023)<<10|t.charCodeAt(++r)&1023),a[o++]=240|l>>18,a[o++]=128|l>>12&63,a[o++]=128|l>>6&63,a[o++]=128|l&63);t=a}else if(i==="object"){if(t===null)throw new Error(ERROR);if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!Array.isArray(t)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(t)))throw new Error(ERROR)}else throw new Error(ERROR);t.length>64&&(t=new Sha256(e,!0).update(t).array());var c=[],u=[];for(r=0;r<64;++r){var f=t[r]||0;c[r]=92^f,u[r]=54^f}Sha256.call(this,e,n),this.update(u),this.oKeyPad=c,this.inner=!0,this.sharedMemory=n}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var t=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(t),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define(function(){return exports}))})()});var GE=R(Bp=>{v();(function(t){var e=/\S/,n=/\"/g,r=/\n/g,i=/\r/g,a=/\\/g,s=/\u2028/,o=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(E,_){var C=E.length,M=0,L=1,N=2,j=M,Y=null,le=null,he="",ie=[],Me=!1,de=0,$=0,G="{{",D="}}";function se(){he.length>0&&(ie.push({tag:"_t",text:new String(he)}),he="")}function Se(){for(var st=!0,ee=$;ee"&&(Ee.indent=ie[Ie].text.toString()),ie.splice(Ie,1));else ee||ie.push({tag:` `});Me=!1,$=ie.length}function be(st,ee){var Ie="="+D,Ee=st.indexOf(Ie,ee),z=c(st.substring(st.indexOf("=",ee)+1,Ee)).split(" ");return G=z[0],D=z[z.length-1],Ee+Ie.length-1}for(_&&(_=_.split(" "),G=_[0],D=_[1]),de=0;de0;){if(j=y.shift(),N&&N.tag=="<"&&!(j.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[j.tag]<=t.tags.$||d(j,C))_.push(j),j.nodes=h(y,j.tag,_,C);else if(j.tag=="/"){if(_.length===0)throw new Error("Closing tag without opener: /"+j.n);if(L=_.pop(),j.n!=L.n&&!p(j.n,L.n,C))throw new Error("Nesting error: "+L.n+" vs. "+j.n);return L.end=j.i,M}else j.tag==` `&&(j.last=y.length==0||y[0].tag==` `);M.push(j)}if(_.length>0)throw new Error("missing closing tag: "+_.pop().n);return M}function d(y,E){for(var _=0,C=E.length;_":k,"<":function(y,E){var _={partials:{},code:"",subs:{},inPartial:!0};t.walk(y.nodes,_);var C=E.partials[k(y,E)];C.subs=_.subs,C.partials=_.partials},$:function(y,E){var _={subs:{},code:"",partials:E.partials,prefix:y.n};t.walk(y.nodes,_),E.subs[y.n]=_.code,E.inPartial||(E.code+='t.sub("'+b(y.n)+'",c,p,i);')},"\n":function(y,E){E.code+=A('"\\n"'+(y.last?"":" + i"))},_v:function(y,E){E.code+="t.b(t.v(t."+S(y.n)+'("'+b(y.n)+'",c,p,0)));'},_t:function(y,E){E.code+=A('"'+b(y.text)+'"')},"{":x,"&":x};function x(y,E){E.code+="t.b(t.t(t."+S(y.n)+'("'+b(y.n)+'",c,p,0)));'}function A(y){return"t.b("+y+");"}t.walk=function(y,E){for(var _,C=0,M=y.length;C{v();var KL={};(function(t){t.Template=function(h,d,p,g){h=h||{},this.r=h.code||this.r,this.c=p,this.options=g||{},this.text=d||"",this.partials=h.partials||{},this.subs=h.subs||{},this.buf=""},t.Template.prototype={r:function(h,d,p){return""},v:u,t:c,render:function(d,p,g){return this.ri([d],p||{},g)},ri:function(h,d,p){return this.r(h,d,p)},ep:function(h,d){var p=this.partials[h],g=d[p.name];if(p.instance&&p.base==g)return p.instance;if(typeof g=="string"){if(!this.c)throw new Error("No compiler available.");g=this.c.compile(g,this.options)}if(!g)return null;if(this.partials[h].base=g,p.subs){d.stackText||(d.stackText={});for(key in p.subs)d.stackText[key]||(d.stackText[key]=this.activeSub!==void 0&&d.stackText[this.activeSub]?d.stackText[this.activeSub]:this.text);g=n(g,p.subs,p.partials,this.stackSubs,this.stackPartials,d.stackText)}return this.partials[h].instance=g,g},rp:function(h,d,p,g){var m=this.ep(h,p);return m?m.ri(d,p,g):""},rs:function(h,d,p){var g=h[h.length-1];if(!f(g)){p(h,d,this);return}for(var m=0;m=0;k--)if(w=d[k],m=e(h,w,S),m!==void 0){b=!0;break}return b?(!g&&typeof m=="function"&&(m=this.mv(m,d,p)),m):g?!1:""},ls:function(h,d,p,g,m){var w=this.options.delimiters;return this.options.delimiters=m,this.b(this.ct(c(h.call(d,g)),d,p)),this.options.delimiters=w,!1},ct:function(h,d,p){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(h,this.options).render(d,p)},b:function(h){this.buf+=h},fl:function(){var h=this.buf;return this.buf="",h},ms:function(h,d,p,g,m,w,b){var S,k=d[d.length-1],x=h.call(k);return typeof x=="function"?g?!0:(S=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(x,k,p,S.substring(m,w),b)):x},mv:function(h,d,p){var g=d[d.length-1],m=h.call(g);return typeof m=="function"?this.ct(c(m.call(g)),g,p):m},sub:function(h,d,p,g){var m=this.subs[h];m&&(this.activeSub=h,m(d,p,this,g),this.activeSub=!1)}};function e(h,d,p){var g;return d&&typeof d=="object"&&(d[h]!==void 0?g=d[h]:p&&d.get&&typeof d.get=="function"&&(g=d.get(h))),g}function n(h,d,p,g,m,w){function b(){}b.prototype=h;function S(){}S.prototype=h.subs;var k,x=new b;x.subs=new S,x.subsText={},x.buf="",g=g||{},x.stackSubs=g,x.subsText=w;for(k in d)g[k]||(g[k]=d[k]);for(k in g)x.subs[k]=g[k];m=m||{},x.stackPartials=m;for(k in p)m[k]||(m[k]=p[k]);for(k in m)x.partials[k]=m[k];return x}var r=/&/g,i=//g,s=/\'/g,o=/\"/g,l=/[&<>\"\']/;function c(h){return String(h==null?"":h)}function u(h){return h=c(h),l.test(h)?h.replace(r,"&").replace(i,"<").replace(a,">").replace(s,"'").replace(o,"""):h}var f=Array.isArray||function(h){return Object.prototype.toString.call(h)==="[object Array]"}})(typeof Np!="undefined"?Np:KL)});var $p=R((QU,WE)=>{v();var Vc=GE();Vc.Template=VE().Template;Vc.template=Vc.Template;WE.exports=Vc});var Fk=R((so,tm)=>{v();(function(e,n){typeof so=="object"&&typeof tm=="object"?tm.exports=n():typeof define=="function"&&define.amd?define([],n):typeof so=="object"?so.feather=n():e.feather=n()})(typeof self!="undefined"?self:so,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(r,i,a){n.o(r,i)||Object.defineProperty(r,i,{configurable:!1,enumerable:!0,get:a})},n.r=function(r){Object.defineProperty(r,"__esModule",{value:!0})},n.n=function(r){var i=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(i,"a",i),i},n.o=function(r,i){return Object.prototype.hasOwnProperty.call(r,i)},n.p="",n(n.s=0)}({"./dist/icons.json":function(t){t.exports={activity:'',airplay:'',"alert-circle":'',"alert-octagon":'',"alert-triangle":'',"align-center":'',"align-justify":'',"align-left":'',"align-right":'',anchor:'',aperture:'',archive:'',"arrow-down-circle":'',"arrow-down-left":'',"arrow-down-right":'',"arrow-down":'',"arrow-left-circle":'',"arrow-left":'',"arrow-right-circle":'',"arrow-right":'',"arrow-up-circle":'',"arrow-up-left":'',"arrow-up-right":'',"arrow-up":'',"at-sign":'',award:'',"bar-chart-2":'',"bar-chart":'',"battery-charging":'',battery:'',"bell-off":'',bell:'',bluetooth:'',bold:'',"book-open":'',book:'',bookmark:'',box:'',briefcase:'',calendar:'',"camera-off":'',camera:'',cast:'',"check-circle":'',"check-square":'',check:'',"chevron-down":'',"chevron-left":'',"chevron-right":'',"chevron-up":'',"chevrons-down":'',"chevrons-left":'',"chevrons-right":'',"chevrons-up":'',chrome:'',circle:'',clipboard:'',clock:'',"cloud-drizzle":'',"cloud-lightning":'',"cloud-off":'',"cloud-rain":'',"cloud-snow":'',cloud:'',code:'',codepen:'',codesandbox:'',coffee:'',columns:'',command:'',compass:'',copy:'',"corner-down-left":'',"corner-down-right":'',"corner-left-down":'',"corner-left-up":'',"corner-right-down":'',"corner-right-up":'',"corner-up-left":'',"corner-up-right":'',cpu:'',"credit-card":'',crop:'',crosshair:'',database:'',delete:'',disc:'',"divide-circle":'',"divide-square":'',divide:'',"dollar-sign":'',"download-cloud":'',download:'',dribbble:'',droplet:'',"edit-2":'',"edit-3":'',edit:'',"external-link":'',"eye-off":'',eye:'',facebook:'',"fast-forward":'',feather:'',figma:'',"file-minus":'',"file-plus":'',"file-text":'',file:'',film:'',filter:'',flag:'',"folder-minus":'',"folder-plus":'',folder:'',framer:'',frown:'',gift:'',"git-branch":'',"git-commit":'',"git-merge":'',"git-pull-request":'',github:'',gitlab:'',globe:'',grid:'',"hard-drive":'',hash:'',headphones:'',heart:'',"help-circle":'',hexagon:'',home:'',image:'',inbox:'',info:'',instagram:'',italic:'',key:'',layers:'',layout:'',"life-buoy":'',"link-2":'',link:'',linkedin:'',list:'',loader:'',lock:'',"log-in":'',"log-out":'',mail:'',"map-pin":'',map:'',"maximize-2":'',maximize:'',meh:'',menu:'',"message-circle":'',"message-square":'',"mic-off":'',mic:'',"minimize-2":'',minimize:'',"minus-circle":'',"minus-square":'',minus:'',monitor:'',moon:'',"more-horizontal":'',"more-vertical":'',"mouse-pointer":'',move:'',music:'',"navigation-2":'',navigation:'',octagon:'',package:'',paperclip:'',"pause-circle":'',pause:'',"pen-tool":'',percent:'',"phone-call":'',"phone-forwarded":'',"phone-incoming":'',"phone-missed":'',"phone-off":'',"phone-outgoing":'',phone:'',"pie-chart":'',"play-circle":'',play:'',"plus-circle":'',"plus-square":'',plus:'',pocket:'',power:'',printer:'',radio:'',"refresh-ccw":'',"refresh-cw":'',repeat:'',rewind:'',"rotate-ccw":'',"rotate-cw":'',rss:'',save:'',scissors:'',search:'',send:'',server:'',settings:'',"share-2":'',share:'',"shield-off":'',shield:'',"shopping-bag":'',"shopping-cart":'',shuffle:'',sidebar:'',"skip-back":'',"skip-forward":'',slack:'',slash:'',sliders:'',smartphone:'',smile:'',speaker:'',square:'',star:'',"stop-circle":'',sun:'',sunrise:'',sunset:'',table:'',tablet:'',tag:'',target:'',terminal:'',thermometer:'',"thumbs-down":'',"thumbs-up":'',"toggle-left":'',"toggle-right":'',tool:'',"trash-2":'',trash:'',trello:'',"trending-down":'',"trending-up":'',triangle:'',truck:'',tv:'',twitch:'',twitter:'',type:'',umbrella:'',underline:'',unlock:'',"upload-cloud":'',upload:'',"user-check":'',"user-minus":'',"user-plus":'',"user-x":'',user:'',users:'',"video-off":'',video:'',voicemail:'',"volume-1":'',"volume-2":'',"volume-x":'',volume:'',watch:'',"wifi-off":'',wifi:'',wind:'',"x-circle":'',"x-octagon":'',"x-square":'',x:'',youtube:'',"zap-off":'',zap:'',"zoom-in":'',"zoom-out":''}},"./node_modules/classnames/dedupe.js":function(t,e,n){var r,i;(function(){"use strict";var a=function(){function s(){}s.prototype=Object.create(null);function o(g,m){for(var w=m.length,b=0;b1?arguments[1]:void 0,m=g!==void 0,w=0,b=c(h),S,k,x,A;if(m&&(g=r(g,p>2?arguments[2]:void 0,2)),b!=null&&!(d==Array&&s(b)))for(A=b.call(h),k=new d;!(x=A.next()).done;w++)l(k,w,m?a(A,g,[x.value,w],!0):x.value);else for(S=o(h.length),k=new d(S);S>w;w++)l(k,w,m?g(h[w],w):h[w]);return k.length=w,k}},"./node_modules/core-js/internals/array-includes.js":function(t,e,n){var r=n("./node_modules/core-js/internals/to-indexed-object.js"),i=n("./node_modules/core-js/internals/to-length.js"),a=n("./node_modules/core-js/internals/to-absolute-index.js");t.exports=function(s){return function(o,l,c){var u=r(o),f=i(u.length),h=a(c,f),d;if(s&&l!=l){for(;f>h;)if(d=u[h++],d!=d)return!0}else for(;f>h;h++)if((s||h in u)&&u[h]===l)return s||h||0;return!s&&-1}}},"./node_modules/core-js/internals/bind-context.js":function(t,e,n){var r=n("./node_modules/core-js/internals/a-function.js");t.exports=function(i,a,s){if(r(i),a===void 0)return i;switch(s){case 0:return function(){return i.call(a)};case 1:return function(o){return i.call(a,o)};case 2:return function(o,l){return i.call(a,o,l)};case 3:return function(o,l,c){return i.call(a,o,l,c)}}return function(){return i.apply(a,arguments)}}},"./node_modules/core-js/internals/call-with-safe-iteration-closing.js":function(t,e,n){var r=n("./node_modules/core-js/internals/an-object.js");t.exports=function(i,a,s,o){try{return o?a(r(s)[0],s[1]):a(s)}catch(c){var l=i.return;throw l!==void 0&&r(l.call(i)),c}}},"./node_modules/core-js/internals/check-correctness-of-iteration.js":function(t,e,n){var r=n("./node_modules/core-js/internals/well-known-symbol.js"),i=r("iterator"),a=!1;try{var s=0,o={next:function(){return{done:!!s++}},return:function(){a=!0}};o[i]=function(){return this},Array.from(o,function(){throw 2})}catch(l){}t.exports=function(l,c){if(!c&&!a)return!1;var u=!1;try{var f={};f[i]=function(){return{next:function(){return{done:u=!0}}}},l(f)}catch(h){}return u}},"./node_modules/core-js/internals/classof-raw.js":function(t,e){var n={}.toString;t.exports=function(r){return n.call(r).slice(8,-1)}},"./node_modules/core-js/internals/classof.js":function(t,e,n){var r=n("./node_modules/core-js/internals/classof-raw.js"),i=n("./node_modules/core-js/internals/well-known-symbol.js"),a=i("toStringTag"),s=r(function(){return arguments}())=="Arguments",o=function(l,c){try{return l[c]}catch(u){}};t.exports=function(l){var c,u,f;return l===void 0?"Undefined":l===null?"Null":typeof(u=o(c=Object(l),a))=="string"?u:s?r(c):(f=r(c))=="Object"&&typeof c.callee=="function"?"Arguments":f}},"./node_modules/core-js/internals/copy-constructor-properties.js":function(t,e,n){var r=n("./node_modules/core-js/internals/has.js"),i=n("./node_modules/core-js/internals/own-keys.js"),a=n("./node_modules/core-js/internals/object-get-own-property-descriptor.js"),s=n("./node_modules/core-js/internals/object-define-property.js");t.exports=function(o,l){for(var c=i(l),u=s.f,f=a.f,h=0;h",S="java"+w+":",k;for(p.style.display="none",o.appendChild(p),p.src=String(S),k=p.contentWindow.document,k.open(),k.write(m+w+b+"document.F=Object"+m+"/"+w+b),k.close(),d=k.F;g--;)delete d[f][a[g]];return d()};t.exports=Object.create||function(g,m){var w;return g!==null?(h[f]=r(g),w=new h,h[f]=null,w[u]=g):w=d(),m===void 0?w:i(w,m)},s[u]=!0},"./node_modules/core-js/internals/object-define-properties.js":function(t,e,n){var r=n("./node_modules/core-js/internals/descriptors.js"),i=n("./node_modules/core-js/internals/object-define-property.js"),a=n("./node_modules/core-js/internals/an-object.js"),s=n("./node_modules/core-js/internals/object-keys.js");t.exports=r?Object.defineProperties:function(l,c){a(l);for(var u=s(c),f=u.length,h=0,d;f>h;)i.f(l,d=u[h++],c[d]);return l}},"./node_modules/core-js/internals/object-define-property.js":function(t,e,n){var r=n("./node_modules/core-js/internals/descriptors.js"),i=n("./node_modules/core-js/internals/ie8-dom-define.js"),a=n("./node_modules/core-js/internals/an-object.js"),s=n("./node_modules/core-js/internals/to-primitive.js"),o=Object.defineProperty;e.f=r?o:function(c,u,f){if(a(c),u=s(u,!0),a(f),i)try{return o(c,u,f)}catch(h){}if("get"in f||"set"in f)throw TypeError("Accessors not supported");return"value"in f&&(c[u]=f.value),c}},"./node_modules/core-js/internals/object-get-own-property-descriptor.js":function(t,e,n){var r=n("./node_modules/core-js/internals/descriptors.js"),i=n("./node_modules/core-js/internals/object-property-is-enumerable.js"),a=n("./node_modules/core-js/internals/create-property-descriptor.js"),s=n("./node_modules/core-js/internals/to-indexed-object.js"),o=n("./node_modules/core-js/internals/to-primitive.js"),l=n("./node_modules/core-js/internals/has.js"),c=n("./node_modules/core-js/internals/ie8-dom-define.js"),u=Object.getOwnPropertyDescriptor;e.f=r?u:function(h,d){if(h=s(h),d=o(d,!0),c)try{return u(h,d)}catch(p){}if(l(h,d))return a(!i.f.call(h,d),h[d])}},"./node_modules/core-js/internals/object-get-own-property-names.js":function(t,e,n){var r=n("./node_modules/core-js/internals/object-keys-internal.js"),i=n("./node_modules/core-js/internals/enum-bug-keys.js"),a=i.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(o){return r(o,a)}},"./node_modules/core-js/internals/object-get-own-property-symbols.js":function(t,e){e.f=Object.getOwnPropertySymbols},"./node_modules/core-js/internals/object-get-prototype-of.js":function(t,e,n){var r=n("./node_modules/core-js/internals/has.js"),i=n("./node_modules/core-js/internals/to-object.js"),a=n("./node_modules/core-js/internals/shared-key.js"),s=n("./node_modules/core-js/internals/correct-prototype-getter.js"),o=a("IE_PROTO"),l=Object.prototype;t.exports=s?Object.getPrototypeOf:function(c){return c=i(c),r(c,o)?c[o]:typeof c.constructor=="function"&&c instanceof c.constructor?c.constructor.prototype:c instanceof Object?l:null}},"./node_modules/core-js/internals/object-keys-internal.js":function(t,e,n){var r=n("./node_modules/core-js/internals/has.js"),i=n("./node_modules/core-js/internals/to-indexed-object.js"),a=n("./node_modules/core-js/internals/array-includes.js"),s=n("./node_modules/core-js/internals/hidden-keys.js"),o=a(!1);t.exports=function(l,c){var u=i(l),f=0,h=[],d;for(d in u)!r(s,d)&&r(u,d)&&h.push(d);for(;c.length>f;)r(u,d=c[f++])&&(~o(h,d)||h.push(d));return h}},"./node_modules/core-js/internals/object-keys.js":function(t,e,n){var r=n("./node_modules/core-js/internals/object-keys-internal.js"),i=n("./node_modules/core-js/internals/enum-bug-keys.js");t.exports=Object.keys||function(s){return r(s,i)}},"./node_modules/core-js/internals/object-property-is-enumerable.js":function(t,e,n){"use strict";var r={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,a=i&&!r.call({1:2},1);e.f=a?function(o){var l=i(this,o);return!!l&&l.enumerable}:r},"./node_modules/core-js/internals/object-set-prototype-of.js":function(t,e,n){var r=n("./node_modules/core-js/internals/validate-set-prototype-of-arguments.js");t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var i=!1,a={},s;try{s=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set,s.call(a,[]),i=a instanceof Array}catch(o){}return function(l,c){return r(l,c),i?s.call(l,c):l.__proto__=c,l}}():void 0)},"./node_modules/core-js/internals/own-keys.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/object-get-own-property-names.js"),a=n("./node_modules/core-js/internals/object-get-own-property-symbols.js"),s=n("./node_modules/core-js/internals/an-object.js"),o=r.Reflect;t.exports=o&&o.ownKeys||function(c){var u=i.f(s(c)),f=a.f;return f?u.concat(f(c)):u}},"./node_modules/core-js/internals/path.js":function(t,e,n){t.exports=n("./node_modules/core-js/internals/global.js")},"./node_modules/core-js/internals/redefine.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/shared.js"),a=n("./node_modules/core-js/internals/hide.js"),s=n("./node_modules/core-js/internals/has.js"),o=n("./node_modules/core-js/internals/set-global.js"),l=n("./node_modules/core-js/internals/function-to-string.js"),c=n("./node_modules/core-js/internals/internal-state.js"),u=c.get,f=c.enforce,h=String(l).split("toString");i("inspectSource",function(d){return l.call(d)}),(t.exports=function(d,p,g,m){var w=m?!!m.unsafe:!1,b=m?!!m.enumerable:!1,S=m?!!m.noTargetGet:!1;if(typeof g=="function"&&(typeof p=="string"&&!s(g,"name")&&a(g,"name",p),f(g).source=h.join(typeof p=="string"?p:"")),d===r){b?d[p]=g:o(p,g);return}else w?!S&&d[p]&&(b=!0):delete d[p];b?d[p]=g:a(d,p,g)})(Function.prototype,"toString",function(){return typeof this=="function"&&u(this).source||l.call(this)})},"./node_modules/core-js/internals/require-object-coercible.js":function(t,e){t.exports=function(n){if(n==null)throw TypeError("Can't call method on "+n);return n}},"./node_modules/core-js/internals/set-global.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/hide.js");t.exports=function(a,s){try{i(r,a,s)}catch(o){r[a]=s}return s}},"./node_modules/core-js/internals/set-to-string-tag.js":function(t,e,n){var r=n("./node_modules/core-js/internals/object-define-property.js").f,i=n("./node_modules/core-js/internals/has.js"),a=n("./node_modules/core-js/internals/well-known-symbol.js"),s=a("toStringTag");t.exports=function(o,l,c){o&&!i(o=c?o:o.prototype,s)&&r(o,s,{configurable:!0,value:l})}},"./node_modules/core-js/internals/shared-key.js":function(t,e,n){var r=n("./node_modules/core-js/internals/shared.js"),i=n("./node_modules/core-js/internals/uid.js"),a=r("keys");t.exports=function(s){return a[s]||(a[s]=i(s))}},"./node_modules/core-js/internals/shared.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/set-global.js"),a=n("./node_modules/core-js/internals/is-pure.js"),s="__core-js_shared__",o=r[s]||i(s,{});(t.exports=function(l,c){return o[l]||(o[l]=c!==void 0?c:{})})("versions",[]).push({version:"3.1.3",mode:a?"pure":"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})},"./node_modules/core-js/internals/string-at.js":function(t,e,n){var r=n("./node_modules/core-js/internals/to-integer.js"),i=n("./node_modules/core-js/internals/require-object-coercible.js");t.exports=function(a,s,o){var l=String(i(a)),c=r(s),u=l.length,f,h;return c<0||c>=u?o?"":void 0:(f=l.charCodeAt(c),f<55296||f>56319||c+1===u||(h=l.charCodeAt(c+1))<56320||h>57343?o?l.charAt(c):f:o?l.slice(c,c+2):(f-55296<<10)+(h-56320)+65536)}},"./node_modules/core-js/internals/to-absolute-index.js":function(t,e,n){var r=n("./node_modules/core-js/internals/to-integer.js"),i=Math.max,a=Math.min;t.exports=function(s,o){var l=r(s);return l<0?i(l+o,0):a(l,o)}},"./node_modules/core-js/internals/to-indexed-object.js":function(t,e,n){var r=n("./node_modules/core-js/internals/indexed-object.js"),i=n("./node_modules/core-js/internals/require-object-coercible.js");t.exports=function(a){return r(i(a))}},"./node_modules/core-js/internals/to-integer.js":function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(i){return isNaN(i=+i)?0:(i>0?r:n)(i)}},"./node_modules/core-js/internals/to-length.js":function(t,e,n){var r=n("./node_modules/core-js/internals/to-integer.js"),i=Math.min;t.exports=function(a){return a>0?i(r(a),9007199254740991):0}},"./node_modules/core-js/internals/to-object.js":function(t,e,n){var r=n("./node_modules/core-js/internals/require-object-coercible.js");t.exports=function(i){return Object(r(i))}},"./node_modules/core-js/internals/to-primitive.js":function(t,e,n){var r=n("./node_modules/core-js/internals/is-object.js");t.exports=function(i,a){if(!r(i))return i;var s,o;if(a&&typeof(s=i.toString)=="function"&&!r(o=s.call(i))||typeof(s=i.valueOf)=="function"&&!r(o=s.call(i))||!a&&typeof(s=i.toString)=="function"&&!r(o=s.call(i)))return o;throw TypeError("Can't convert object to primitive value")}},"./node_modules/core-js/internals/uid.js":function(t,e){var n=0,r=Math.random();t.exports=function(i){return"Symbol(".concat(i===void 0?"":i,")_",(++n+r).toString(36))}},"./node_modules/core-js/internals/validate-set-prototype-of-arguments.js":function(t,e,n){var r=n("./node_modules/core-js/internals/is-object.js"),i=n("./node_modules/core-js/internals/an-object.js");t.exports=function(a,s){if(i(a),!r(s)&&s!==null)throw TypeError("Can't set "+String(s)+" as a prototype")}},"./node_modules/core-js/internals/well-known-symbol.js":function(t,e,n){var r=n("./node_modules/core-js/internals/global.js"),i=n("./node_modules/core-js/internals/shared.js"),a=n("./node_modules/core-js/internals/uid.js"),s=n("./node_modules/core-js/internals/native-symbol.js"),o=r.Symbol,l=i("wks");t.exports=function(c){return l[c]||(l[c]=s&&o[c]||(s?o:a)("Symbol."+c))}},"./node_modules/core-js/modules/es.array.from.js":function(t,e,n){var r=n("./node_modules/core-js/internals/export.js"),i=n("./node_modules/core-js/internals/array-from.js"),a=n("./node_modules/core-js/internals/check-correctness-of-iteration.js"),s=!a(function(o){Array.from(o)});r({target:"Array",stat:!0,forced:s},{from:i})},"./node_modules/core-js/modules/es.string.iterator.js":function(t,e,n){"use strict";var r=n("./node_modules/core-js/internals/string-at.js"),i=n("./node_modules/core-js/internals/internal-state.js"),a=n("./node_modules/core-js/internals/define-iterator.js"),s="String Iterator",o=i.set,l=i.getterFor(s);a(String,"String",function(c){o(this,{type:s,string:String(c),index:0})},function(){var u=l(this),f=u.string,h=u.index,d;return h>=f.length?{value:void 0,done:!0}:(d=r(f,h,!0),u.index+=d.length,{value:d,done:!1})})},"./node_modules/webpack/buildin/global.js":function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(r){typeof window=="object"&&(n=window)}t.exports=n},"./src/default-attrs.json":function(t){t.exports={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"}},"./src/icon.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(d){for(var p=1;p2&&arguments[2]!==void 0?arguments[2]:[];u(this,d),this.name=p,this.contents=g,this.tags=m,this.attrs=r({},l.default,{class:"feather feather-"+p})}return i(d,[{key:"toSvg",value:function(){var g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},m=r({},this.attrs,g,{class:(0,s.default)(this.attrs.class,g.class)});return""+this.contents+""}},{key:"toString",value:function(){return this.contents}}]),d}();function h(d){return Object.keys(d).map(function(p){return p+'="'+d[p]+'"'}).join(" ")}e.default=f},"./src/icons.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("./src/icon.js"),i=c(r),a=n("./dist/icons.json"),s=c(a),o=n("./src/tags.json"),l=c(o);function c(u){return u&&u.__esModule?u:{default:u}}e.default=Object.keys(s.default).map(function(u){return new i.default(u,s.default[u],l.default[u])}).reduce(function(u,f){return u[f.name]=f,u},{})},"./src/index.js":function(t,e,n){"use strict";var r=n("./src/icons.js"),i=c(r),a=n("./src/to-svg.js"),s=c(a),o=n("./src/replace.js"),l=c(o);function c(u){return u&&u.__esModule?u:{default:u}}t.exports={icons:i.default,toSvg:s.default,replace:l.default}},"./src/replace.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=Object.assign||function(h){for(var d=1;d0&&arguments[0]!==void 0?arguments[0]:{};if(typeof document=="undefined")throw new Error("`feather.replace()` only works in a browser environment.");var d=document.querySelectorAll("[data-feather]");Array.from(d).forEach(function(p){return u(p,h)})}function u(h){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=f(h),g=p["data-feather"];if(delete p["data-feather"],o.default[g]===void 0){console.warn("feather: '"+g+"' is not a valid icon");return}var m=o.default[g].toSvg(r({},d,p,{class:(0,a.default)(d.class,p.class)})),w=new DOMParser().parseFromString(m,"image/svg+xml"),b=w.querySelector("svg");h.parentNode.replaceChild(b,h)}function f(h){return Array.from(h.attributes).reduce(function(d,p){return d[p.name]=p.value,d},{})}e.default=c},"./src/tags.json":function(t){t.exports={activity:["pulse","health","action","motion"],airplay:["stream","cast","mirroring"],"alert-circle":["warning","alert","danger"],"alert-octagon":["warning","alert","danger"],"alert-triangle":["warning","alert","danger"],"align-center":["text alignment","center"],"align-justify":["text alignment","justified"],"align-left":["text alignment","left"],"align-right":["text alignment","right"],anchor:[],archive:["index","box"],"at-sign":["mention","at","email","message"],award:["achievement","badge"],aperture:["camera","photo"],"bar-chart":["statistics","diagram","graph"],"bar-chart-2":["statistics","diagram","graph"],battery:["power","electricity"],"battery-charging":["power","electricity"],bell:["alarm","notification","sound"],"bell-off":["alarm","notification","silent"],bluetooth:["wireless"],"book-open":["read","library"],book:["read","dictionary","booklet","magazine","library"],bookmark:["read","clip","marker","tag"],box:["cube"],briefcase:["work","bag","baggage","folder"],calendar:["date"],camera:["photo"],cast:["chromecast","airplay"],"chevron-down":["expand"],"chevron-up":["collapse"],circle:["off","zero","record"],clipboard:["copy"],clock:["time","watch","alarm"],"cloud-drizzle":["weather","shower"],"cloud-lightning":["weather","bolt"],"cloud-rain":["weather"],"cloud-snow":["weather","blizzard"],cloud:["weather"],codepen:["logo"],codesandbox:["logo"],code:["source","programming"],coffee:["drink","cup","mug","tea","cafe","hot","beverage"],columns:["layout"],command:["keyboard","cmd","terminal","prompt"],compass:["navigation","safari","travel","direction"],copy:["clone","duplicate"],"corner-down-left":["arrow","return"],"corner-down-right":["arrow"],"corner-left-down":["arrow"],"corner-left-up":["arrow"],"corner-right-down":["arrow"],"corner-right-up":["arrow"],"corner-up-left":["arrow"],"corner-up-right":["arrow"],cpu:["processor","technology"],"credit-card":["purchase","payment","cc"],crop:["photo","image"],crosshair:["aim","target"],database:["storage","memory"],delete:["remove"],disc:["album","cd","dvd","music"],"dollar-sign":["currency","money","payment"],droplet:["water"],edit:["pencil","change"],"edit-2":["pencil","change"],"edit-3":["pencil","change"],eye:["view","watch"],"eye-off":["view","watch","hide","hidden"],"external-link":["outbound"],facebook:["logo","social"],"fast-forward":["music"],figma:["logo","design","tool"],"file-minus":["delete","remove","erase"],"file-plus":["add","create","new"],"file-text":["data","txt","pdf"],film:["movie","video"],filter:["funnel","hopper"],flag:["report"],"folder-minus":["directory"],"folder-plus":["directory"],folder:["directory"],framer:["logo","design","tool"],frown:["emoji","face","bad","sad","emotion"],gift:["present","box","birthday","party"],"git-branch":["code","version control"],"git-commit":["code","version control"],"git-merge":["code","version control"],"git-pull-request":["code","version control"],github:["logo","version control"],gitlab:["logo","version control"],globe:["world","browser","language","translate"],"hard-drive":["computer","server","memory","data"],hash:["hashtag","number","pound"],headphones:["music","audio","sound"],heart:["like","love","emotion"],"help-circle":["question mark"],hexagon:["shape","node.js","logo"],home:["house","living"],image:["picture"],inbox:["email"],instagram:["logo","camera"],key:["password","login","authentication","secure"],layers:["stack"],layout:["window","webpage"],"life-buoy":["help","life ring","support"],link:["chain","url"],"link-2":["chain","url"],linkedin:["logo","social media"],list:["options"],lock:["security","password","secure"],"log-in":["sign in","arrow","enter"],"log-out":["sign out","arrow","exit"],mail:["email","message"],"map-pin":["location","navigation","travel","marker"],map:["location","navigation","travel"],maximize:["fullscreen"],"maximize-2":["fullscreen","arrows","expand"],meh:["emoji","face","neutral","emotion"],menu:["bars","navigation","hamburger"],"message-circle":["comment","chat"],"message-square":["comment","chat"],"mic-off":["record","sound","mute"],mic:["record","sound","listen"],minimize:["exit fullscreen","close"],"minimize-2":["exit fullscreen","arrows","close"],minus:["subtract"],monitor:["tv","screen","display"],moon:["dark","night"],"more-horizontal":["ellipsis"],"more-vertical":["ellipsis"],"mouse-pointer":["arrow","cursor"],move:["arrows"],music:["note"],navigation:["location","travel"],"navigation-2":["location","travel"],octagon:["stop"],package:["box","container"],paperclip:["attachment"],pause:["music","stop"],"pause-circle":["music","audio","stop"],"pen-tool":["vector","drawing"],percent:["discount"],"phone-call":["ring"],"phone-forwarded":["call"],"phone-incoming":["call"],"phone-missed":["call"],"phone-off":["call","mute"],"phone-outgoing":["call"],phone:["call"],play:["music","start"],"pie-chart":["statistics","diagram"],"play-circle":["music","start"],plus:["add","new"],"plus-circle":["add","new"],"plus-square":["add","new"],pocket:["logo","save"],power:["on","off"],printer:["fax","office","device"],radio:["signal"],"refresh-cw":["synchronise","arrows"],"refresh-ccw":["arrows"],repeat:["loop","arrows"],rewind:["music"],"rotate-ccw":["arrow"],"rotate-cw":["arrow"],rss:["feed","subscribe"],save:["floppy disk"],scissors:["cut"],search:["find","magnifier","magnifying glass"],send:["message","mail","email","paper airplane","paper aeroplane"],settings:["cog","edit","gear","preferences"],"share-2":["network","connections"],shield:["security","secure"],"shield-off":["security","insecure"],"shopping-bag":["ecommerce","cart","purchase","store"],"shopping-cart":["ecommerce","cart","purchase","store"],shuffle:["music"],"skip-back":["music"],"skip-forward":["music"],slack:["logo"],slash:["ban","no"],sliders:["settings","controls"],smartphone:["cellphone","device"],smile:["emoji","face","happy","good","emotion"],speaker:["audio","music"],star:["bookmark","favorite","like"],"stop-circle":["media","music"],sun:["brightness","weather","light"],sunrise:["weather","time","morning","day"],sunset:["weather","time","evening","night"],tablet:["device"],tag:["label"],target:["logo","bullseye"],terminal:["code","command line","prompt"],thermometer:["temperature","celsius","fahrenheit","weather"],"thumbs-down":["dislike","bad","emotion"],"thumbs-up":["like","good","emotion"],"toggle-left":["on","off","switch"],"toggle-right":["on","off","switch"],tool:["settings","spanner"],trash:["garbage","delete","remove","bin"],"trash-2":["garbage","delete","remove","bin"],triangle:["delta"],truck:["delivery","van","shipping","transport","lorry"],tv:["television","stream"],twitch:["logo"],twitter:["logo","social"],type:["text"],umbrella:["rain","weather"],unlock:["security"],"user-check":["followed","subscribed"],"user-minus":["delete","remove","unfollow","unsubscribe"],"user-plus":["new","add","create","follow","subscribe"],"user-x":["delete","remove","unfollow","unsubscribe","unavailable"],user:["person","account"],users:["group"],"video-off":["camera","movie","film"],video:["camera","movie","film"],voicemail:["phone"],volume:["music","sound","mute"],"volume-1":["music","sound"],"volume-2":["music","sound"],"volume-x":["music","sound","mute"],watch:["clock","time"],"wifi-off":["disabled"],wifi:["connection","signal","wireless"],wind:["weather","air"],"x-circle":["cancel","close","delete","remove","times","clear"],"x-octagon":["delete","stop","alert","warning","times","clear"],"x-square":["cancel","close","delete","remove","times","clear"],x:["cancel","close","delete","remove","times","clear"],youtube:["logo","video","play"],"zap-off":["flash","camera","lightning"],zap:["flash","camera","lightning"],"zoom-in":["magnifying glass"],"zoom-out":["magnifying glass"]}},"./src/to-svg.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n("./src/icons.js"),i=a(r);function a(o){return o&&o.__esModule?o:{default:o}}function s(o){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(console.warn("feather.toSvg() is deprecated. Please use feather.icons[name].toSvg() instead."),!o)throw new Error("The required `key` (icon name) parameter is missing.");if(!i.default[o])throw new Error("No icon matching '"+o+"'. See the complete list of icons at https://feathericons.com");return i.default[o].toSvg(l)}e.default=s},0:function(t,e,n){n("./node_modules/core-js/es/array/from.js"),t.exports=n("./src/index.js")}})})});var i7={};aA(i7,{default:()=>hu});module.exports=sA(i7);v();v();var Xa=Ze(Pm(),1),Nf=Ze(Hm(),1),v1=Ze(zm(),1),Vo=Ze(M0(),1),Ro=Ze(I0(),1),w1=Ze(U0(),1),fn=Ze(G0(),1),b1=Ze(Y0(),1),ge=class t extends Error{constructor(e){super(e),this.caller=""}toJSON(){return{code:this.code,data:this.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){let n=new t(e.message);return n.code=e.code,n.data=e.data,n.caller=e.caller,n.stack=e.stack,n}get isIsomorphicGitError(){return!0}},Ya=class t extends ge{constructor(e){super(`Modifying the index is not possible because you have unmerged files: ${e.toString}. Fix them up in the work tree, and then use 'git add/rm as appropriate to mark resolution and make a commit.`),this.code=this.name=t.code,this.data={filepaths:e}}};Ya.code="UnmergedPathsError";var ue=class t extends ge{constructor(e){super(`An internal error caused this command to fail. Please file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};ue.code="InternalError";var Si=class t extends ge{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};Si.code="UnsafeFilepathError";var en=class{constructor(e){this.buffer=e,this._start=0}eof(){return this._start>=this.buffer.length}tell(){return this._start}seek(e){this._start=e}slice(e){let n=this.buffer.slice(this._start,this._start+e);return this._start+=e,n}toString(e,n){let r=this.buffer.toString(e,this._start,this._start+n);return this._start+=n,r}write(e,n,r){let i=this.buffer.write(e,this._start,n,r);return this._start+=n,i}copy(e,n,r){let i=e.copy(this.buffer,this._start,n,r);return this._start+=i,i}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let n=this.buffer.writeUInt8(e,this._start);return this._start+=1,n}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let n=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,n}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let n=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,n}};function Wo(t,e){return-(te)}function x1(t,e){return Wo(t.path,e.path)}function _1(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let n=t&511;return n&73?n=493:n=420,e!==8&&(n=0),(e<<12)+n}var Tn=2**32;function Z0(t,e,n,r){if(t!==void 0&&e!==void 0)return[t,e];n===void 0&&(n=r.valueOf());let i=Math.floor(n/1e3),a=(n-i*1e3)*1e6;return[i,a]}function Ei(t){let[e,n]=Z0(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[r,i]=Z0(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%Tn,ctimeNanoseconds:n%Tn,mtimeSeconds:r%Tn,mtimeNanoseconds:i%Tn,dev:t.dev%Tn,ino:t.ino%Tn,mode:_1(t.mode%Tn),uid:t.uid%Tn,gid:t.gid%Tn,size:t.size>-1?t.size%Tn:0}}function l5(t){let e="";for(let n of new Uint8Array(t))n<16&&(e+="0"),e+=n.toString(16);return e}var yf=null;async function Un(t){return yf===null&&(yf=await u5()),yf?S1(t):c5(t)}function c5(t){return new Nf.default().update(t).digest("hex")}async function S1(t){let e=await crypto.subtle.digest("SHA-1",t);return l5(e)}async function u5(){try{if(await S1(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709")return!0}catch(t){}return!1}function f5(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function h5(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(Buffer.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var Tf=class t{constructor(e,n){this._dirty=!1,this._unmergedPaths=n||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let n=this._entries.get(e.path);n||(this._entries.set(e.path,e),n=e),n.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(Buffer.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new ue("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new ue("Index file is empty (.git/index)");let n=new t,r=new en(e),i=r.toString("utf8",4);if(i!=="DIRC")throw new ue(`Invalid dircache magic file number: ${i}`);let a=await Un(e.slice(0,-20)),s=e.slice(-20).toString("hex");if(s!==a)throw new ue(`Invalid checksum in GitIndex buffer: expected ${s} but saw ${a}`);let o=r.readUInt32BE();if(o!==2)throw new ue(`Unsupported dircache version: ${o}`);let l=r.readUInt32BE(),c=0;for(;!r.eof()&&ce.stages.length>1?e.stages.filter(n=>n):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:n,oid:r,stage:i=0}){n||(n={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),n=Ei(n);let a=Buffer.from(e),s={ctimeSeconds:n.ctimeSeconds,ctimeNanoseconds:n.ctimeNanoseconds,mtimeSeconds:n.mtimeSeconds,mtimeNanoseconds:n.mtimeNanoseconds,dev:n.dev,ino:n.ino,mode:n.mode||33188,uid:n.uid,gid:n.gid,size:n.size,path:e,oid:r,flags:{assumeValid:!1,extended:!1,stage:i,nameLength:a.length<4095?a.length:4095},stages:[]};this._addEntry(s),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let n of this._entries.keys())n.startsWith(e+"/")&&this._entries.delete(n);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(` `)}static async _entryToBuffer(e){let n=Buffer.from(e.path),r=Math.ceil((62+n.length+1)/8)*8,i=Buffer.alloc(r),a=new en(i),s=Ei(e);return a.writeUInt32BE(s.ctimeSeconds),a.writeUInt32BE(s.ctimeNanoseconds),a.writeUInt32BE(s.mtimeSeconds),a.writeUInt32BE(s.mtimeNanoseconds),a.writeUInt32BE(s.dev),a.writeUInt32BE(s.ino),a.writeUInt32BE(s.mode),a.writeUInt32BE(s.uid),a.writeUInt32BE(s.gid),a.writeUInt32BE(s.size),a.write(e.oid,20,"hex"),a.writeUInt16BE(h5(e)),a.write(e.path,n.length,"utf8"),i}async toObject(){let e=Buffer.alloc(12),n=new en(e);n.write("DIRC",4,"utf8"),n.writeUInt32BE(2),n.writeUInt32BE(this.entriesFlat.length);let r=[];for(let o of this.entries)if(r.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&r.push(t._entryToBuffer(l));r=await Promise.all(r);let i=Buffer.concat(r),a=Buffer.concat([e,i]),s=await Un(a);return Buffer.concat([a,Buffer.from(s,"hex")])}};function Lo(t,e,n=!0,r=!0){let i=Ei(t),a=Ei(e);return n&&i.mode!==a.mode||i.mtimeSeconds!==a.mtimeSeconds||i.ctimeSeconds!==a.ctimeSeconds||i.uid!==a.uid||i.gid!==a.gid||r&&i.ino!==a.ino||i.size!==a.size}var vf=null,xi=Symbol("IndexCache");function d5(){return{map:new Map,stats:new Map}}async function p5(t,e,n){let r=await t.lstat(e),i=await t.read(e),a=await Tf.from(i);n.map.set(e,a),n.stats.set(e,r)}async function m5(t,e,n){let r=n.stats.get(e);if(r===void 0)return!0;let i=await t.lstat(e);return r===null||i===null?!1:Lo(r,i)}var lt=class{static async acquire({fs:e,gitdir:n,cache:r,allowUnmerged:i=!0},a){r[xi]||(r[xi]=d5());let s=`${n}/index`;vf===null&&(vf=new Xa.default({maxPending:1/0}));let o,l=[];return await vf.acquire(s,async()=>{await m5(e,s,r[xi])&&await p5(e,s,r[xi]);let c=r[xi].map.get(s);if(l=c.unmergedPaths,l.length&&!i)throw new Ya(l);if(o=await a(c),c._dirty){let u=await c.toObject();await e.write(s,u),r[xi].stats.set(s,await e.lstat(s)),c._dirty=!1}}),o}};function jo(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function ki(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function E1(t){let e=new Map,n=function(i){if(!e.has(i)){let a={type:"tree",fullpath:i,basename:jo(i),metadata:{},children:[]};e.set(i,a),a.parent=n(ki(i)),a.parent&&a.parent!==a&&a.parent.children.push(a)}return e.get(i)},r=function(i,a){if(!e.has(i)){let s={type:"blob",fullpath:i,basename:jo(i),metadata:a,parent:n(ki(i)),children:[]};s.parent&&s.parent.children.push(s),e.set(i,s)}return e.get(i)};n(".");for(let i of t)r(i.path,i);return e}function g5(t){switch(t){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new ue(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var Cf=class{constructor({fs:e,gitdir:n,cache:r}){this.treePromise=lt.acquire({fs:e,gitdir:n,cache:r},async function(a){return E1(a.entries)});let i=this;this.ConstructEntry=class{constructor(s){this._fullpath=s,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(e){let n=e._fullpath,i=(await this.treePromise).get(n);if(!i||i.type==="blob")return null;if(i.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${n}'`);let a=i.children.map(s=>s.fullpath);return a.sort(Wo),a}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let r=(await this.treePromise).get(e._fullpath);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=r.type==="tree"?{}:Ei(r.metadata);e._type=r.type==="tree"?"tree":g5(i.mode),e._mode=i.mode,r.type==="tree"?e._stat=void 0:e._stat=i}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let r=(await this.treePromise).get(e._fullpath);e._oid=r.metadata.oid}return e._oid}},qo=Symbol("GitWalkSymbol");function Xo(){let t=Object.create(null);return Object.defineProperty(t,qo,{value:function({fs:e,gitdir:n,cache:r}){return new Cf({fs:e,gitdir:n,cache:r})}}),Object.freeze(t),t}var Re=class t extends ge{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};Re.code="NotFoundError";var kt=class t extends ge{constructor(e,n,r,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${r} but it is a ${n}.`),this.code=this.name=t.code,this.data={oid:e,actual:n,expected:r,filepath:i}}};kt.code="ObjectTypeError";var or=class t extends ge{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};or.code="InvalidOidError";var Za=class t extends ge{constructor(e){super(`Could not find a fetch refspec for remote "${e}". Make sure the config file has an entry like the following: [remote "${e}"] fetch = +refs/heads/*:refs/remotes/origin/* `),this.code=this.name=t.code,this.data={remote:e}}};Za.code="NoRefspecError";var Do=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let n=null;this.parsedConfig=e.trim().split(` `).map(r=>{if(/^\s*#/.test(r))return{line:r,comment:!0};let i=r.indexOf(" ");if(r.startsWith("^")){let a=r.slice(1);return this.refs.set(n+"^{}",a),{line:r,ref:n,peeled:a}}else{let a=r.slice(0,i);return n=r.slice(i+1),this.refs.set(n,a),{line:r,ref:n,oid:a}}})}return this}static from(e){return new t(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(n=>n.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(` `)+` `}},Bo=class t{constructor({remotePath:e,localPath:n,force:r,matchPrefix:i}){Object.assign(this,{remotePath:e,localPath:n,force:r,matchPrefix:i})}static from(e){let[n,r,i,a,s]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=n==="+",l=i==="*";if(l!==(s==="*"))throw new ue("Invalid refspec");return new t({remotePath:r,localPath:a,force:o,matchPrefix:l})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,"")}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,"")}else if(e===this.localPath)return this.remotePath;return null}},Ff=class t{constructor(e=[]){this.rules=e}static from(e){let n=[];for(let r of e)n.push(Bo.from(r));return new t(n)}add(e){let n=Bo.from(e);this.rules.push(n)}translate(e){let n=[];for(let r of this.rules)for(let i of e){let a=r.translate(i);a&&n.push([i,a])}return n}translateOne(e){let n=null;for(let r of this.rules){let i=r.translate(e);i&&(n=i)}return n}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function y5(t,e){let n=t.replace(/\^\{\}$/,""),r=e.replace(/\^\{\}$/,""),i=-(nr);return i===0?t.endsWith("^{}")?1:-1:i}var K0=new Map;function J0(t){let e=K0.get(t);return e||(e=v5(t),K0.set(t,e)),e}function v5(t){return t=t.split("/./").join("/").replace(/\/{2,}/g,"/"),t==="/."?"/":t==="./"||(t.startsWith("./")&&(t=t.slice(2)),t.endsWith("/.")&&(t=t.slice(0,-2)),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t==="")?".":t}function B(...t){return J0(t.map(J0).join("/"))}var w5=t=>{t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},qa=t=>{if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},Q0={core:{filemode:qa,bare:qa,logallrefupdates:qa,symlinks:qa,ignorecase:qa,bigFileThreshold:w5}},b5=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,x5=/^[A-Za-z0-9-.]+$/,_5=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,S5=/^[A-Za-z][A-Za-z-]*$/,E5=/^(.*?)( *[#;].*)$/,k5=t=>{let e=b5.exec(t);if(e!=null){let[n,r]=e.slice(1);return[n,r]}return null},A5=t=>{let e=_5.exec(t);if(e!=null){let[n,r="true"]=e.slice(1),i=T5(r),a=C5(i);return[n,a]}return null},T5=t=>{let e=E5.exec(t);if(e==null)return t;let[n,r]=e.slice(1);return e1(n)&&e1(r)?`${n}${r}`:n},e1=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,C5=t=>t.split("").reduce((e,n,r,i)=>{let a=n==='"'&&i[r-1]!=="\\",s=n==="\\"&&i[r+1]==='"';return a||s?e:e+n},""),t1=t=>t!=null?t.toLowerCase():null,Mf=(t,e,n)=>[t1(t),e,t1(n)].filter(r=>r!=null).join("."),n1=t=>{let e=t.split("."),n=e.shift(),r=e.pop(),i=e.length?e.join("."):void 0;return{section:n,subsection:i,name:r,path:Mf(n,i,r),sectionPath:Mf(n,i,null)}},F5=(t,e)=>t.reduce((n,r,i)=>e(r)?i:n,-1),Of=class t{constructor(e){let n=null,r=null;this.parsedConfig=e?e.split(` `).map(i=>{let a=null,s=null,o=i.trim(),l=k5(o),c=l!=null;if(c)[n,r]=l;else{let f=A5(o);f!=null&&([a,s]=f)}let u=Mf(n,r,a);return{line:i,isSection:c,section:n,subsection:r,name:a,value:s,path:u}}):[]}static from(e){return new t(e)}async get(e,n=!1){let r=n1(e).path,i=this.parsedConfig.filter(a=>a.path===r).map(({section:a,name:s,value:o})=>{let l=Q0[a]&&Q0[a][s];return l?l(o):o});return n?i:i.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(n=>n.section===e&&n.isSection).map(n=>n.subsection)}async deleteSection(e,n){this.parsedConfig=this.parsedConfig.filter(r=>!(r.section===e&&r.subsection===n))}async append(e,n){return this.set(e,n,!0)}async set(e,n,r=!1){let{section:i,subsection:a,name:s,path:o,sectionPath:l}=n1(e),c=F5(this.parsedConfig,u=>u.path===o);if(n==null)c!==-1&&this.parsedConfig.splice(c,1);else if(c!==-1){let u=this.parsedConfig[c],f=Object.assign({},u,{name:s,value:n,modified:!0});r?this.parsedConfig.splice(c+1,0,f):this.parsedConfig[c]=f}else{let u=this.parsedConfig.findIndex(h=>h.path===l),f={section:i,subsection:a,name:s,value:n,modified:!0,path:o};if(x5.test(i)&&S5.test(s))if(u>=0)this.parsedConfig.splice(u+1,0,f);else{let h={section:i,subsection:a,modified:!0,path:l};this.parsedConfig.push(h,f)}}}toString(){return this.parsedConfig.map(({line:e,section:n,subsection:r,name:i,value:a,modified:s=!1})=>s?i!=null&&a!=null?typeof a=="string"&&/[#;]/.test(a)?` ${i} = "${a}"`:` ${i} = ${a}`:r!=null?`[${n} "${r}"]`:`[${n}]`:e).join(` `)}},ze=class{static async get({fs:e,gitdir:n}){let r=await e.read(`${n}/config`,{encoding:"utf8"});return Of.from(r)}static async save({fs:e,gitdir:n,config:r}){await e.write(`${n}/config`,r.toString(),{encoding:"utf8"})}},Po=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],M5=["config","description","index","shallow","commondir"],wf;async function ir(t,e){return wf===void 0&&(wf=new Xa.default),wf.acquire(t,e)}var q=class t{static async updateRemoteRefs({fs:e,gitdir:n,remote:r,refs:i,symrefs:a,tags:s,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let m of i.values())if(!m.match(/[0-9a-f]{40}/))throw new or(m);let u=await ze.get({fs:e,gitdir:n});if(!o){if(o=await u.getall(`remote.${r}.fetch`),o.length===0)throw new Za(r);o.unshift(`+HEAD:refs/remotes/${r}/HEAD`)}let f=Ff.from(o),h=new Map;if(c){let m=await t.listRefs({fs:e,gitdir:n,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:n,refs:m.map(w=>`refs/tags/${w}`)})}if(s){for(let m of i.keys())if(m.startsWith("refs/tags")&&!m.endsWith("^{}")&&!await t.exists({fs:e,gitdir:n,ref:m})){let w=i.get(m);h.set(m,w)}}let d=f.translate([...i.keys()]);for(let[m,w]of d){let b=i.get(m);h.set(w,b)}let p=f.translate([...a.keys()]);for(let[m,w]of p){let b=a.get(m),S=f.translateOne(b);S&&h.set(w,`ref: ${S}`)}let g=[];if(l){for(let m of f.localNamespaces()){let w=(await t.listRefs({fs:e,gitdir:n,filepath:m})).map(b=>`${m}/${b}`);for(let b of w)h.has(b)||g.push(b)}g.length>0&&await t.deleteRefs({fs:e,gitdir:n,refs:g})}for(let[m,w]of h)await ir(m,async()=>e.write(B(n,m),`${w.trim()} `,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:n,ref:r,value:i}){if(!i.match(/[0-9a-f]{40}/))throw new or(i);await ir(r,async()=>e.write(B(n,r),`${i.trim()} `,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:n,ref:r,value:i}){await ir(r,async()=>e.write(B(n,r),`ref: ${i.trim()} `,"utf8"))}static async deleteRef({fs:e,gitdir:n,ref:r}){return t.deleteRefs({fs:e,gitdir:n,refs:[r]})}static async deleteRefs({fs:e,gitdir:n,refs:r}){await Promise.all(r.map(o=>e.rm(B(n,o))));let i=await ir("packed-refs",async()=>e.read(`${n}/packed-refs`,{encoding:"utf8"})),a=Do.from(i),s=a.refs.size;for(let o of r)a.refs.has(o)&&a.delete(o);a.refs.sizee.write(`${n}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:n,ref:r,depth:i=void 0}){if(i!==void 0&&(i--,i===-1))return r;if(r.startsWith("ref: "))return r=r.slice(5),t.resolve({fs:e,gitdir:n,ref:r,depth:i});if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let a=await t.packedRefs({fs:e,gitdir:n}),s=Po(r).filter(o=>!M5.includes(o));for(let o of s){let l=await ir(o,async()=>await e.read(`${n}/${o}`,{encoding:"utf8"})||a.get(o));if(l)return t.resolve({fs:e,gitdir:n,ref:l.trim(),depth:i})}throw new Re(r)}static async exists({fs:e,gitdir:n,ref:r}){try{return await t.expand({fs:e,gitdir:n,ref:r}),!0}catch(i){return!1}}static async expand({fs:e,gitdir:n,ref:r}){if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let i=await t.packedRefs({fs:e,gitdir:n}),a=Po(r);for(let s of a)if(await ir(s,async()=>e.exists(`${n}/${s}`))||i.has(s))return s;throw new Re(r)}static async expandAgainstMap({ref:e,map:n}){let r=Po(e);for(let i of r)if(await n.has(i))return i;throw new Re(e)}static resolveAgainstMap({ref:e,fullref:n=e,depth:r=void 0,map:i}){if(r!==void 0&&(r--,r===-1))return{fullref:n,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:n,depth:r,map:i});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:n,oid:e};let a=Po(e);for(let s of a){let o=i.get(s);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:s,depth:r,map:i})}throw new Re(e)}static async packedRefs({fs:e,gitdir:n}){let r=await ir("packed-refs",async()=>e.read(`${n}/packed-refs`,{encoding:"utf8"}));return Do.from(r).refs}static async listRefs({fs:e,gitdir:n,filepath:r}){let i=t.packedRefs({fs:e,gitdir:n}),a=null;try{a=await e.readdirDeep(`${n}/${r}`),a=a.map(s=>s.replace(`${n}/${r}/`,""))}catch(s){a=[]}for(let s of(await i).keys())s.startsWith(r)&&(s=s.replace(r+"/",""),a.includes(s)||a.push(s));return a.sort(y5),a}static async listBranches({fs:e,gitdir:n,remote:r}){return r?t.listRefs({fs:e,gitdir:n,filepath:`refs/remotes/${r}`}):t.listRefs({fs:e,gitdir:n,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:n}){return(await t.listRefs({fs:e,gitdir:n,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}};function O5(t,e){return Wo(r1(t),r1(e))}function r1(t){return t.mode==="040000"?t.path+"/":t.path}function k1(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new ue(`Unexpected GitTree entry mode: ${t}`)}function P5(t){let e=[],n=0;for(;n`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(` `)}toObject(){let e=[...this._entries];return e.sort(O5),Buffer.concat(e.map(n=>{let r=Buffer.from(n.mode.replace(/^0/,"")),i=Buffer.from(" "),a=Buffer.from(n.path,"utf8"),s=Buffer.from([0]),o=Buffer.from(n.oid,"hex");return Buffer.concat([r,i,a,s,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},lr=class{static wrap({type:e,object:n}){return Buffer.concat([Buffer.from(`${e} ${n.byteLength.toString()}\0`),Buffer.from(n)])}static unwrap(e){let n=e.indexOf(32),r=e.indexOf(0),i=e.slice(0,n).toString("utf8"),a=e.slice(n+1,r).toString("utf8"),s=e.length-(r+1);if(parseInt(a)!==s)throw new ue(`Length mismatch: expected ${a} bytes but got ${s} instead.`);return{type:i,object:Buffer.from(e.slice(r+1))}}};async function L5({fs:t,gitdir:e,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`,i=await t.read(`${e}/${r}`);return i?{object:i,format:"deflated",source:r}:null}function j5(t,e){let n=new en(t),r=i1(n);if(r!==e.byteLength)throw new ue(`applyDelta expected source buffer to be ${r} bytes but the provided buffer was ${e.length} bytes`);let i=i1(n),a,s=s1(n,e);if(s.byteLength===i)a=s;else{a=Buffer.alloc(i);let o=new en(a);for(o.copy(s);!n.eof();)o.copy(s1(n,e));let l=o.tell();if(i!==l)throw new ue(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`)}return a}function i1(t){let e=0,n=0,r=null;do r=t.readUInt8(),e|=(r&127)<>=1,i+=8;return r}function s1(t,e){let n=t.readUInt8(),r=128,i=15,a=112;if(n&r){let s=a1(t,n&i,4),o=a1(t,(n&a)>>4,3);return o===0&&(o=65536),e.slice(s,s+o)}else return t.slice(n)}function D5(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function A1(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:D5(t)}var No=class{constructor(e){if(typeof Buffer=="undefined")throw new Error("Missing Buffer dependency");this.stream=A1(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:n}=await this.stream.next();return e&&(this._ended=!0,!n)?Buffer.alloc(0):(n&&(n=Buffer.from(n)),n)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let n=[this.buffer];for(;this.cursor+e>B5(n);){let r=await this._next();if(this._ended)break;n.push(r)}this.buffer=Buffer.concat(n)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function B5(t){return t.reduce((e,n)=>e+n.length,0)}async function N5(t,e){let n=new No(t),r=await n.read(4);if(r=r.toString("utf8"),r!=="PACK")throw new ue(`Invalid PACK header '${r}'`);let i=await n.read(4);if(i=i.readUInt32BE(0),i!==2)throw new ue(`Invalid packfile version: ${i}`);let a=await n.read(4);if(a=a.readUInt32BE(0),!(a<1))for(;!n.eof()&&a--;){let s=n.tell(),{type:o,length:l,ofs:c,reference:u}=await $5(n),f=new Vo.default.Inflate;for(;!f.result;){let h=await n.chunk();if(!h)break;if(f.push(h,!1),f.err)throw new ue(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new ue("Inflated object size is different from that stated in packfile.");await n.undo(),await n.read(h.length-f.strm.avail_in);let d=n.tell();await e({data:f.result,type:o,num:a,offset:s,end:d,reference:u,ofs:c})}}}}async function $5(t){let e=await t.byte(),n=e>>4&7,r=e&15;if(e&128){let s=4;do e=await t.byte(),r|=(e&127)<i+1<<7|a,-1)}function G5(t,e){let n=e,r=4,i=null;do i=t.readUInt8(),n|=(i&127)<2048*1024*1024)throw new ue("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");r.seek(r.tell()+4*255);let s=r.readUInt32BE(),o=[];for(let u=0;u{u===null&&(u=k);let x=Math.floor((u-k)*100/u);x!==f&&r&&await r({phase:"Receiving objects",loaded:u-k,total:u}),f=x,w=i[w],["commit","tree","blob","tag"].includes(w)?a[S]={type:w,offset:S}:w==="ofs-delta"?a[S]={type:w,offset:S}:w==="ref-delta"&&(a[S]={type:w,offset:S})});let h=Object.keys(a).map(Number);for(let[m,w]of h.entries()){let b=m+1===h.length?e.byteLength-20:h[m+1],S=a[w],k=v1.default.buf(e.slice(w,b))>>>0;S.end=b,S.crc=k}let d=new t({pack:Promise.resolve(e),packfileSha:s,crcs:l,hashes:o,offsets:c,getExternalRefDelta:n});f=null;let p=0,g=[0,0,0,0,0,0,0,0,0,0,0,0];for(let m in a){m=Number(m);let w=Math.floor(p*100/u);w!==f&&r&&await r({phase:"Resolving deltas",loaded:p,total:u}),p++,f=w;let b=a[m];if(!b.oid)try{d.readDepth=0,d.externalReadDepth=0;let{type:S,object:k}=await d.readSlice({start:m});g[d.readDepth]+=1;let x=await Un(lr.wrap({type:S,object:k}));b.oid=x,o.push(x),c.set(x,m),l[x]=b.crc}catch(S){continue}}return o.sort(),d}async toBuffer(){let e=[],n=(c,u)=>{e.push(Buffer.from(c,u))};n("ff744f63","hex"),n("00000002","hex");let r=new en(Buffer.alloc(256*4));for(let c=0;c<256;c++){let u=0;for(let f of this.hashes)parseInt(f.slice(0,2),16)<=c&&u++;r.writeUInt32BE(u)}e.push(r.buffer);for(let c of this.hashes)n(c,"hex");let i=new en(Buffer.alloc(this.hashes.length*4));for(let c of this.hashes)i.writeUInt32BE(this.crcs[c]);e.push(i.buffer);let a=new en(Buffer.alloc(this.hashes.length*4));for(let c of this.hashes)a.writeUInt32BE(this.offsets.get(c));e.push(a.buffer),n(this.packfileSha,"hex");let s=Buffer.concat(e),o=await Un(s),l=Buffer.alloc(20);return l.write(o,"hex"),Buffer.concat([s,l])}async load({pack:e}){this.pack=e}async unload(){this.pack=null}async read({oid:e}){if(!this.offsets.get(e)){if(this.getExternalRefDelta)return this.externalReadDepth++,this.getExternalRefDelta(e);throw new ue(`Could not read object ${e} from packfile`)}let n=this.offsets.get(e);return this.readSlice({start:n})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;let n={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"};if(!this.pack)throw new ue("Tried to read from a GitPackIndex with no packfile loaded into memory");let r=(await this.pack).slice(e),i=new en(r),a=i.readUInt8(),s=a&112,o=n[s];if(o===void 0)throw new ue("Unrecognized type: 0b"+s.toString(2));let l=a&15,c=l;a&128&&(c=G5(i,l));let f=null,h=null;if(o==="ofs_delta"){let p=z5(i),g=e-p;({object:f,type:o}=await this.readSlice({start:g}))}if(o==="ref_delta"){let p=i.slice(20).toString("hex");({object:f,type:o}=await this.read({oid:p}))}let d=r.slice(i.tell());if(h=Buffer.from(await T1(d)),h.byteLength!==c)throw new ue(`Packfile told us object would have length ${c} but it had length ${h.byteLength}`);return f&&(h=Buffer.from(j5(h,f))),this.readDepth>3&&(this.offsetCache[e]={type:o,object:h}),{type:o,format:"content",object:h}}},Io=Symbol("PackfileCache");async function V5({fs:t,filename:e,getExternalRefDelta:n,emitter:r,emitterPrefix:i}){let a=await t.read(e);return Ka.fromIdx({idx:a,getExternalRefDelta:n})}function $f({fs:t,cache:e,filename:n,getExternalRefDelta:r,emitter:i,emitterPrefix:a}){e[Io]||(e[Io]=new Map);let s=e[Io].get(n);return s||(s=V5({fs:t,filename:n,getExternalRefDelta:r,emitter:i,emitterPrefix:a}),e[Io].set(n,s)),s}async function W5({fs:t,cache:e,gitdir:n,oid:r,format:i="content",getExternalRefDelta:a}){let s=await t.readdir(B(n,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${n}/objects/pack/${o}`,c=await $f({fs:t,cache:e,filename:l,getExternalRefDelta:a});if(c.error)throw new ue(c.error);if(c.offsets.has(r)){if(!c.pack){let f=l.replace(/idx$/,"pack");c.pack=t.read(f)}let u=await c.read({oid:r,getExternalRefDelta:a});return u.format="content",u.source=`objects/pack/${o.replace(/idx$/,"pack")}`,u}}return null}async function Ge({fs:t,cache:e,gitdir:n,oid:r,format:i="content"}){let a=u=>Ge({fs:t,cache:e,gitdir:n,oid:u}),s;if(r==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(s={format:"wrapped",object:Buffer.from("tree 0\0")}),s||(s=await L5({fs:t,gitdir:n,oid:r})),!s){if(s=await W5({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:a}),!s)throw new Re(r);return s}if(i==="deflated"||(s.format==="deflated"&&(s.object=Buffer.from(await T1(s.object)),s.format="wrapped"),i==="wrapped"))return s;let o=await Un(s.object);if(o!==r)throw new ue(`SHA check failed! Expected ${r}, computed ${o}`);let{object:l,type:c}=lr.unwrap(s.object);if(s.type=c,s.object=l,s.format="content",i==="content")return s;throw new ue(`invalid requested format "${i}"`)}var hn=class t extends ge{constructor(e,n,r=!0){super(`Failed to create ${e} at ${n} because it already exists.${r?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=t.code,this.data={noun:e,where:n,canForce:r}}};hn.code="AlreadyExistsError";var Ja=class t extends ge{constructor(e,n,r){super(`Found multiple ${e} matching "${n}" (${r.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=t.code,this.data={nouns:e,short:n,matches:r}}};Ja.code="AmbiguousError";var Qa=class t extends ge{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=t.code,this.data={filepaths:e}}};Qa.code="CheckoutConflictError";var es=class t extends ge{constructor(e,n){super(`Failed to checkout "${e}" because commit ${n} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=t.code,this.data={ref:e,oid:n}}};es.code="CommitNotFetchedError";var ts=class t extends ge{constructor(){super("Empty response from git server."),this.code=this.name=t.code,this.data={}}};ts.code="EmptyServerResponseError";var ns=class t extends ge{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=t.code,this.data={}}};ns.code="FastForwardError";var rs=class t extends ge{constructor(e,n){super(`One or more branches were not updated: ${e}`),this.code=this.name=t.code,this.data={prettyDetails:e,result:n}}};rs.code="GitPushError";var Ai=class t extends ge{constructor(e,n,r){super(`HTTP Error: ${e} ${n}`),this.code=this.name=t.code,this.data={statusCode:e,statusMessage:n,response:r}}};Ai.code="HttpError";var cr=class t extends ge{constructor(e){let n="invalid filepath";e==="leading-slash"||e==="trailing-slash"?n='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(n='"filepath" should not be a directory.'),super(n),this.code=this.name=t.code,this.data={reason:e}}};cr.code="InvalidFilepathError";var zn=class t extends ge{constructor(e,n){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${n}".)`),this.code=this.name=t.code,this.data={ref:e,suggestion:n}}};zn.code="InvalidRefNameError";var is=class t extends ge{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=t.code,this.data={depth:e}}};is.code="MaxDepthError";var Ti=class t extends ge{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=t.code,this.data={}}};Ti.code="MergeNotSupportedError";var Ci=class t extends ge{constructor(e,n,r,i){super(`Automatic merge failed with one or more merge conflicts in the following files: ${e.toString()}. Fix conflicts then commit the result.`),this.code=this.name=t.code,this.data={filepaths:e,bothModified:n,deleteByUs:r,deleteByTheirs:i}}};Ci.code="MergeConflictError";var At=class t extends ge{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=t.code,this.data={role:e}}};At.code="MissingNameError";var Pt=class t extends ge{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=t.code,this.data={parameter:e}}};Pt.code="MissingParameterError";var as=class t extends ge{constructor(e){super('There are multiple errors that were thrown by the method. Please refer to the "errors" property to see more'),this.code=this.name=t.code,this.data={errors:e},this.errors=e}};as.code="MultipleGitError";var $r=class t extends ge{constructor(e,n){super(`Expected "${e}" but received "${n}".`),this.code=this.name=t.code,this.data={expected:e,actual:n}}};$r.code="ParseError";var Fi=class t extends ge{constructor(e){let n="";e==="not-fast-forward"?n=" because it was not a simple fast-forward":e==="tag-exists"&&(n=" because tag already exists"),super(`Push rejected${n}. Use "force: true" to override.`),this.code=this.name=t.code,this.data={reason:e}}};Fi.code="PushRejectedError";var ar=class t extends ge{constructor(e,n){super(`Remote does not support the "${e}" so the "${n}" parameter cannot be used.`),this.code=this.name=t.code,this.data={capability:e,parameter:n}}};ar.code="RemoteCapabilityError";var ss=class t extends ge{constructor(e,n){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${e}`),this.code=this.name=t.code,this.data={preview:e,response:n}}};ss.code="SmartHttpError";var os=class t extends ge{constructor(e,n,r){super(`Git remote "${e}" uses an unrecognized transport protocol: "${n}"`),this.code=this.name=t.code,this.data={url:e,transport:n,suggestion:r}}};os.code="UnknownTransportError";var ls=class t extends ge{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=t.code,this.data={url:e}}};ls.code="UrlParseError";var Mi=class t extends ge{constructor(){super("The operation was canceled."),this.code=this.name=t.code,this.data={}}};Mi.code="UserCanceledError";var cs=class t extends ge{constructor(e){super(`Could not merge index: Entry for '${e}' is not up to date. Either reset the index entry to HEAD, or stage your unstaged changes.`),this.code=this.name=t.code,this.data={filepath:e}}};cs.code="IndexResetError";var us=class t extends ge{constructor(e){super(`"${e}" does not point to any commit. You're maybe working on a repository with no commits yet. `),this.code=this.name=t.code,this.data={ref:e}}};us.code="NoCommitError";var hs=Object.freeze({__proto__:null,AlreadyExistsError:hn,AmbiguousError:Ja,CheckoutConflictError:Qa,CommitNotFetchedError:es,EmptyServerResponseError:ts,FastForwardError:ns,GitPushError:rs,HttpError:Ai,InternalError:ue,InvalidFilepathError:cr,InvalidOidError:or,InvalidRefNameError:zn,MaxDepthError:is,MergeNotSupportedError:Ti,MergeConflictError:Ci,MissingNameError:At,MissingParameterError:Pt,MultipleGitError:as,NoRefspecError:Za,NotFoundError:Re,ObjectTypeError:kt,ParseError:$r,PushRejectedError:Fi,RemoteCapabilityError:ar,SmartHttpError:ss,UnknownTransportError:os,UnsafeFilepathError:Si,UrlParseError:ls,UserCanceledError:Mi,UnmergedPathsError:Ya,IndexResetError:cs,NoCommitError:us});function Pf({name:t,email:e,timestamp:n,timezoneOffset:r}){return r=q5(r),`${t} <${e}> ${n} ${r}`}function q5(t){let e=X5(Y5(t));t=Math.abs(t);let n=Math.floor(t/60);t-=n*60;let r=String(n),i=String(t);return r.length<2&&(r="0"+r),i.length<2&&(i="0"+i),(e===-1?"-":"+")+r+i}function X5(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}function Y5(t){return t===0?t:-t}function Hn(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+` `,t}function $o(t){let[,e,n,r,i]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:n,timestamp:Number(r),timezoneOffset:Z5(i)}}function Z5(t){let[,e,n,r]=t.match(/(\+|-)(\d\d)(\d\d)/);return r=(e==="+"?1:-1)*(Number(n)*60+Number(r)),K5(r)}function K5(t){return t===0?t:-t}var Ut=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(Buffer.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new ue("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new t(e)}static render(e){return`object ${e.object} type ${e.type} tag ${e.tag} tagger ${Pf(e.tagger)} ${e.message} ${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(` `))}message(){let e=this.withoutSignature();return e.slice(e.indexOf(` `)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(` `),n=[];for(let i of e)i[0]===" "?n[n.length-1]+=` `+i.slice(1):n.push(i);let r={};for(let i of n){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(r[a])?r[a].push(s):r[a]=s}return r.tagger&&(r.tagger=$o(r.tagger)),r.committer&&(r.committer=$o(r.committer)),r}withoutSignature(){let e=Hn(this._tag);return e.indexOf(` -----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(` -----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(` -----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return Hn(e)}payload(){return this.withoutSignature()+` `}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,n,r){let i=e.payload(),{signature:a}=await n({payload:i,secretKey:r});a=Hn(a);let s=i+a;return t.from(s)}};function xf(t){return t.trim().split(` `).map(e=>" "+e).join(` `)+` `}function J5(t){return t.split(` `).map(e=>e.replace(/^ /,"")).join(` `)}var Rt=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new ue("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:n}){let r=t.justHeaders(e),i=t.justMessage(e),a=Hn(r+` gpgsig`+xf(n)+` `+i);return new t(a)}static from(e){return new t(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return t.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Hn(e.slice(e.indexOf(` `)+2))}static justHeaders(e){return e.slice(0,e.indexOf(` `))}parseHeaders(){let e=t.justHeaders(this._commit).split(` `),n=[];for(let i of e)i[0]===" "?n[n.length-1]+=` `+i.slice(1):n.push(i);let r={parent:[]};for(let i of n){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(r[a])?r[a].push(s):r[a]=s}return r.author&&(r.author=$o(r.author)),r.committer&&(r.committer=$o(r.committer)),r}static renderHeaders(e){let n="";if(e.tree?n+=`tree ${e.tree} `:n+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 `,e.parent){if(e.parent.length===void 0)throw new ue("commit 'parent' property should be an array");for(let a of e.parent)n+=`parent ${a} `}let r=e.author;n+=`author ${Pf(r)} `;let i=e.committer||e.author;return n+=`committer ${Pf(i)} `,e.gpgsig&&(n+="gpgsig"+xf(e.gpgsig)),n}static render(e){return t.renderHeaders(e)+` `+Hn(e.message)}render(){return this._commit}withoutSignature(){let e=Hn(this._commit);if(e.indexOf(` gpgsig`)===-1)return e;let n=e.slice(0,e.indexOf(` gpgsig`)),r=e.slice(e.indexOf(`-----END PGP SIGNATURE----- `)+28);return Hn(n+` `+r)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return J5(e)}static async sign(e,n,r){let i=e.withoutSignature(),a=t.justMessage(e._commit),{signature:s}=await n({payload:i,secretKey:r});s=Hn(s);let l=t.justHeaders(e._commit)+` gpgsig`+xf(s)+` `+a;return t.from(l)}};async function Oi({fs:t,cache:e,gitdir:n,oid:r}){if(r==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:It.from([]),oid:r};let{type:i,object:a}=await Ge({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=Ut.from(a).parse().object,Oi({fs:t,cache:e,gitdir:n,oid:r});if(i==="commit")return r=Rt.from(a).parse().tree,Oi({fs:t,cache:e,gitdir:n,oid:r});if(i!=="tree")throw new kt(r,i,"tree");return{tree:It.from(a),oid:r}}var If=class{constructor({fs:e,gitdir:n,ref:r,cache:i}){this.fs=e,this.cache=i,this.gitdir=n,this.mapPromise=(async()=>{let s=new Map,o;try{o=await q.resolve({fs:e,gitdir:n,ref:r})}catch(c){c instanceof Re&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await Oi({fs:e,cache:this.cache,gitdir:n,oid:o});return l.type="tree",l.mode="40000",s.set(".",l),s})();let a=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,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(e){let n=e._fullpath,{fs:r,cache:i,gitdir:a}=this,s=await this.mapPromise,o=s.get(n);if(!o)throw new Error(`No obj for ${n}`);let l=o.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!=="tree")return null;let{type:c,object:u}=await Ge({fs:r,cache:i,gitdir:a,oid:l});if(c!==o.type)throw new kt(l,c,o.type);let f=It.from(u);for(let h of f)s.set(B(n,h.path),h);return f.entries().map(h=>B(n,h.path))}async type(e){if(e._type===!1){let n=await this.mapPromise,{type:r}=n.get(e._fullpath);e._type=r}return e._type}async mode(e){if(e._mode===!1){let n=await this.mapPromise,{mode:r}=n.get(e._fullpath);e._mode=_1(parseInt(r,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let n=await this.mapPromise,{fs:r,cache:i,gitdir:a}=this,o=n.get(e._fullpath).oid,{type:l,object:c}=await Ge({fs:r,cache:i,gitdir:a,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let r=(await this.mapPromise).get(e._fullpath);e._oid=r.oid}return e._oid}};function sr({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,qo,{value:function({fs:n,gitdir:r,cache:i}){return new If({fs:n,gitdir:r,ref:t,cache:i})}}),Object.freeze(e),e}var Rf=class{constructor({fs:e,dir:n,gitdir:r,cache:i}){this.fs=e,this.cache=i,this.dir=n,this.gitdir=r;let a=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,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(e){let n=e._fullpath,{fs:r,dir:i}=this,a=await r.readdir(B(i,n));return a===null?null:a.map(s=>B(n,s))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:n,dir:r}=this,i=await n.lstat(`${r}/${e._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let a=i.isDirectory()?"tree":"blob";a==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(a="special"),e._type=a,i=Ei(i),e._mode=i.mode,i.size===-1&&e._actualSize&&(i.size=e._actualSize),e._stat=i}return e._stat}async content(e){if(e._content===!1){let{fs:n,dir:r,gitdir:i}=this;if(await e.type()==="tree")e._content=void 0;else{let s=await(await ze.get({fs:n,gitdir:i})).get("core.autocrlf"),o=await n.read(`${r}/${e._fullpath}`,{autocrlf:s});e._actualSize=o.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(o)}}return e._content}async oid(e){if(e._oid===!1){let{fs:n,gitdir:r,cache:i}=this,a;await lt.acquire({fs:n,gitdir:r,cache:i},async function(s){let o=s.entriesMap.get(e._fullpath),l=await e.stat(),u=await(await ze.get({fs:n,gitdir:r})).get("core.filemode"),f=typeof process!="undefined"?process.platform!=="win32":!0;!o||Lo(l,o,u,f)?await e.content()===void 0?a=void 0:(a=await Un(lr.wrap({type:"blob",object:await e.content()})),o&&a===o.oid&&(!u||l.mode===o.mode)&&Lo(l,o,u,f)&&s.insert({filepath:e._fullpath,stats:l,oid:a})):a=o.oid}),e._oid=a}return e._oid}};function Yo(){let t=Object.create(null);return Object.defineProperty(t,qo,{value:function({fs:e,dir:n,gitdir:r,cache:i}){return new Rf({fs:e,dir:n,gitdir:r,cache:i})}}),Object.freeze(t),t}function Q5(t,e){let n=e-t;return Array.from({length:n},(r,i)=>t+i)}var C1=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,n)=>e.concat(n),[]):t=>t.flat(),Lf=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:ec,reduce:s=async(l,c)=>{let u=C1(c);return l!==void 0&&u.unshift(l),u},iterate:o=(l,c)=>Promise.all([...c].map(l))}){let l=i.map(d=>d[qo]({fs:t,dir:n,gitdir:r,cache:e})),c=new Array(l.length).fill("."),u=Q5(0,l.length),f=async d=>{u.map(m=>{d[m]=d[m]&&new l[m].ConstructEntry(d[m])});let g=(await Promise.all(u.map(m=>d[m]?l[m].readdir(d[m]):[]))).map(m=>m===null?[]:m).map(m=>m[Symbol.iterator]());return{entries:d,children:eC(g)}},h=async d=>{let{entries:p,children:g}=await f(d),m=p.find(b=>b&&b._fullpath)._fullpath,w=await a(m,p);if(w!==null){let b=await o(h,g);return b=b.filter(S=>S!==void 0),s(w,b)}};return h(c)}async function jf(t,e){let n=await t.readdir(e);n==null?await t.rm(e):n.length?await Promise.all(n.map(r=>{let i=B(e,r);return t.lstat(i).then(a=>{if(a)return a.isDirectory()?jf(t,i):t.rm(i)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}function tC(t){return nC(t)&&o1(t.then)&&o1(t.catch)}function nC(t){return t&&typeof t=="object"}function o1(t){return typeof t=="function"}function l1(t){return tC((n=>{try{return n.readFile().catch(r=>r)}catch(r){return r}})(t))}var c1=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function u1(t,e){if(l1(e))for(let n of c1)t[`_${n}`]=e[n].bind(e);else for(let n of c1)t[`_${n}`]=(0,Ro.default)(e[n].bind(e));l1(e)?e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=jf.bind(null,t):e.rm?t._rm=(0,Ro.default)(e.rm.bind(e)):e.rmdir.length>2?t._rm=(0,Ro.default)(e.rmdir.bind(e)):t._rm=jf.bind(null,t)}var Q=class{constructor(e){if(typeof e._original_unwrapped_fs!="undefined")return e;let n=Object.getOwnPropertyDescriptor(e,"promises");n&&n.enumerable?u1(this,e.promises):u1(this,e),this._original_unwrapped_fs=e}async exists(e,n={}){try{return await this._stat(e),!0}catch(r){if(r.code==="ENOENT"||r.code==="ENOTDIR")return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',r),r}}async read(e,n={}){try{let r=await this._readFile(e,n);if(n.autocrlf==="true")try{r=new TextDecoder("utf8",{fatal:!0}).decode(r),r=r.replace(/\r\n/g,` `),r=new TextEncoder().encode(r)}catch(i){}return typeof r!="string"&&(r=Buffer.from(r)),r}catch(r){return null}}async write(e,n,r={}){try{await this._writeFile(e,n,r);return}catch(i){await this.mkdir(ki(e)),await this._writeFile(e,n,r)}}async mkdir(e,n=!1){try{await this._mkdir(e);return}catch(r){if(r===null||r.code==="EEXIST")return;if(n)throw r;if(r.code==="ENOENT"){let i=ki(e);if(i==="."||i==="/"||i===e)throw r;await this.mkdir(i),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(n){if(n.code!=="ENOENT")throw n}}async rmdir(e,n){try{n&&n.recursive?await this._rm(e,n):await this._rmdir(e)}catch(r){if(r.code!=="ENOENT")throw r}}async readdir(e){try{let n=await this._readdir(e);return n.sort(Wo),n}catch(n){return n.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let n=await this._readdir(e);return(await Promise.all(n.map(async i=>{let a=e+"/"+i;return(await this._stat(a)).isDirectory()?this.readdirDeep(a):a}))).reduce((i,a)=>i.concat(a),[])}async lstat(e){try{return await this._lstat(e)}catch(n){if(n.code==="ENOENT")return null;throw n}}async readlink(e,n={encoding:"buffer"}){try{let r=await this._readlink(e,n);return Buffer.isBuffer(r)?r:Buffer.from(r)}catch(r){if(r.code==="ENOENT")return null;throw r}}async writelink(e,n){return this._symlink(n.toString("utf8"),e)}};function F(t,e){if(e===void 0)throw new Pt(t)}async function Ho(t,e){return!t&&!e?!1:t&&!e||!t&&e?!0:!(await t.type()==="tree"&&await e.type()==="tree"||await t.type()===await e.type()&&await t.mode()===await e.mode()&&await t.oid()===await e.oid())}async function rC({fs:t,dir:e,gitdir:n=B(e,".git"),commit:r="HEAD",cache:i={}}){try{F("fs",t),F("dir",e),F("gitdir",n);let a=new Q(t),s=[sr({ref:r}),Yo(),Xo()],o=[];await lt.acquire({fs:a,gitdir:n,cache:i},async function(c){o=c.unmergedPaths});let l=await Pi({fs:a,cache:i,dir:e,gitdir:n,trees:s,map:async function(c,[u,f,h]){let d=!await Ho(f,h),p=o.includes(c),g=!await Ho(h,u);if(d||p)return u?{path:c,mode:await u.mode(),oid:await u.oid(),type:await u.type(),content:await u.content()}:void 0;if(g)return!1;throw new cs(c)}});await lt.acquire({fs:a,gitdir:n,cache:i},async function(c){for(let u of l)if(u!==!1){if(!u){await a.rmdir(`${e}/${u.path}`,{recursive:!0}),c.delete({filepath:u.path});continue}if(u.type==="blob"){let f=new TextDecoder().decode(u.content);await a.write(`${e}/${u.path}`,f,{mode:u.mode}),c.insert({filepath:u.path,oid:u.oid,stage:0})}}})}catch(a){throw a.caller="git.abortMerge",a}}var Ii=class{static async isIgnored({fs:e,dir:n,gitdir:r=B(n,".git"),filepath:i}){if(jo(i)===".git")return!0;if(i===".")return!1;let a="",s=B(r,"info","exclude");await e.exists(s)&&(a=await e.read(s,"utf8"));let o=[{gitignore:B(n,".gitignore"),filepath:i}],l=i.split("/").filter(Boolean);for(let u=1;uDf({dir:e,gitdir:n,fs:o,filepath:r,index:l,force:a,parallel:s}))}catch(o){throw o.caller="git.add",o}}async function Df({dir:t,gitdir:e,fs:n,filepath:r,index:i,force:a,parallel:s}){r=Array.isArray(r)?r:[r];let o=r.map(async f=>{if(!a&&await Ii.isIgnored({fs:n,dir:t,gitdir:e,filepath:f}))return;let h=await n.lstat(B(t,f));if(!h)throw new Re(f);if(h.isDirectory()){let d=await n.readdir(B(t,f));if(s){let p=d.map(g=>Df({dir:t,gitdir:e,fs:n,filepath:[B(f,g)],index:i,force:a,parallel:s}));await Promise.all(p)}else for(let p of d)await Df({dir:t,gitdir:e,fs:n,filepath:[B(f,p)],index:i,force:a,parallel:s})}else{let p=await(await ze.get({fs:n,gitdir:e})).get("core.autocrlf"),g=h.isSymbolicLink()?await n.readlink(B(t,f)).then(oC):await n.read(B(t,f),{autocrlf:p});if(g===null)throw new Re(f);let m=await zt({fs:n,gitdir:e,type:"blob",object:g});i.insert({filepath:f,stats:h,oid:m})}}),l=await Promise.allSettled(o),c=l.filter(f=>f.status==="rejected").map(f=>f.reason);if(c.length>1)throw new as(c);if(c.length===1)throw c[0];return l.filter(f=>f.status==="fulfilled"&&f.value).map(f=>f.value)}async function fs({fs:t,gitdir:e,path:n}){return(await ze.get({fs:t,gitdir:e})).get(n)}function M1(t,...e){for(let n of e)if(n)for(let r of Object.keys(n)){let i=n[r];i!==void 0&&(t[r]=i)}return t}async function Hr({fs:t,gitdir:e,author:n,commit:r}){let i=Math.floor(Date.now()/1e3),a={name:await fs({fs:t,gitdir:e,path:"user.name"}),email:await fs({fs:t,gitdir:e,path:"user.email"})||"",timestamp:i,timezoneOffset:new Date(i*1e3).getTimezoneOffset()},s=M1({},a,r?r.author:void 0,n);if(s.name!==void 0)return s}async function Ri({fs:t,gitdir:e,author:n,committer:r,commit:i}){let a=Math.floor(Date.now()/1e3),s={name:await fs({fs:t,gitdir:e,path:"user.name"}),email:await fs({fs:t,gitdir:e,path:"user.email"})||"",timestamp:a,timezoneOffset:new Date(a*1e3).getTimezoneOffset()},o=M1({},s,i?i.committer:void 0,n,r);if(o.name!==void 0)return o}async function O1({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:a}=await Ge({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=Ut.from(a).parse().object,O1({fs:t,cache:e,gitdir:n,oid:r});if(i!=="commit")throw new kt(r,i,"commit");return{commit:Rt.from(a),oid:r}}async function Uo({fs:t,cache:e,gitdir:n,oid:r}){let{commit:i,oid:a}=await O1({fs:t,cache:e,gitdir:n,oid:r});return{oid:a,commit:i.parse(),payload:i.withoutSignature()}}async function Zo({fs:t,cache:e,onSign:n,gitdir:r,message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:h,tree:d}){let p=!1;f||(f=await q.resolve({fs:t,gitdir:r,ref:"HEAD",depth:2}));let g,m;try{g=await q.resolve({fs:t,gitdir:r,ref:f}),m=await Uo({fs:t,gitdir:r,oid:g,cache:{}})}catch(S){p=!0}if(l&&p)throw new us(f);let w=l?await Hr({fs:t,gitdir:r,author:a,commit:m.commit}):await Hr({fs:t,gitdir:r,author:a});if(!w)throw new At("author");let b=l?await Ri({fs:t,gitdir:r,author:w,committer:s,commit:m.commit}):await Ri({fs:t,gitdir:r,author:w,committer:s});if(!b)throw new At("committer");return lt.acquire({fs:t,gitdir:r,cache:e,allowUnmerged:!1},async function(S){let x=E1(S.entries).get(".");if(d||(d=await P1({fs:t,gitdir:r,inode:x,dryRun:c})),h?h=await Promise.all(h.map(E=>q.resolve({fs:t,gitdir:r,ref:E}))):l?h=m.commit.parent:h=g?[g]:[],!i)if(l)i=m.commit.message;else throw new Pt("message");let A=Rt.from({tree:d,parent:h,author:w,committer:b,message:i});o&&(A=await Rt.sign(A,n,o));let y=await zt({fs:t,gitdir:r,type:"commit",object:A.toObject(),dryRun:c});return!u&&!c&&await q.writeRef({fs:t,gitdir:r,ref:f,value:y}),y})}async function P1({fs:t,gitdir:e,inode:n,dryRun:r}){let i=n.children;for(let l of i)l.type==="tree"&&(l.metadata.mode="040000",l.metadata.oid=await P1({fs:t,gitdir:e,inode:l,dryRun:r}));let a=i.map(l=>({mode:l.metadata.mode,path:l.basename,oid:l.metadata.oid,type:l.type})),s=It.from(a);return await zt({fs:t,gitdir:e,type:"tree",object:s.toObject(),dryRun:r})}async function ds({fs:t,cache:e,gitdir:n,oid:r,filepath:i}){if(i.startsWith("/"))throw new cr("leading-slash");if(i.endsWith("/"))throw new cr("trailing-slash");let a=r,s=await Oi({fs:t,cache:e,gitdir:n,oid:r}),o=s.tree;if(i==="")r=s.oid;else{let l=i.split("/");r=await I1({fs:t,cache:e,gitdir:n,tree:o,pathArray:l,oid:a,filepath:i})}return r}async function I1({fs:t,cache:e,gitdir:n,tree:r,pathArray:i,oid:a,filepath:s}){let o=i.shift();for(let l of r)if(l.path===o){if(i.length===0)return l.oid;{let{type:c,object:u}=await Ge({fs:t,cache:e,gitdir:n,oid:l.oid});if(c!=="tree")throw new kt(a,c,"tree",s);return r=It.from(u),I1({fs:t,cache:e,gitdir:n,tree:r,pathArray:i,oid:a,filepath:s})}}throw new Re(`file or directory found at "${a}:${s}"`)}async function Di({fs:t,cache:e,gitdir:n,oid:r,filepath:i=void 0}){i!==void 0&&(r=await ds({fs:t,cache:e,gitdir:n,oid:r,filepath:i}));let{tree:a,oid:s}=await Oi({fs:t,cache:e,gitdir:n,oid:r});return{oid:s,tree:a.entries()}}async function Hf({fs:t,gitdir:e,tree:n}){let r=It.from(n).toObject();return await zt({fs:t,gitdir:e,type:"tree",object:r,format:"content"})}async function cC({fs:t,cache:e,onSign:n,gitdir:r,ref:i,oid:a,note:s,force:o,author:l,committer:c,signingKey:u}){let f;try{f=await q.resolve({gitdir:r,fs:t,ref:i})}catch(w){if(!(w instanceof Re))throw w}let d=(await Di({fs:t,cache:e,gitdir:r,oid:f||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(o)d=d.filter(w=>w.path!==a);else for(let w of d)if(w.path===a)throw new hn("note",a);typeof s=="string"&&(s=Buffer.from(s,"utf8"));let p=await zt({fs:t,gitdir:r,type:"blob",object:s,format:"content"});d.push({mode:"100644",path:a,oid:p,type:"blob"});let g=await Hf({fs:t,gitdir:r,tree:d});return await Zo({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tree:g,parent:f&&[f],message:`Note added by 'isomorphic-git addNote' `,author:l,committer:c,signingKey:u})}async function uC({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ref:i="refs/notes/commits",oid:a,note:s,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{F("fs",t),F("gitdir",r),F("oid",a),F("note",s),u&&F("onSign",e);let h=new Q(t),d=await Hr({fs:h,gitdir:r,author:l});if(!d)throw new At("author");let p=await Ri({fs:h,gitdir:r,author:d,committer:c});if(!p)throw new At("committer");return await cC({fs:new Q(h),cache:f,onSign:e,gitdir:r,ref:i,oid:a,note:s,force:o,author:d,committer:p,signingKey:u})}catch(h){throw h.caller="git.addNote",h}}async function R1({fs:t,gitdir:e,remote:n,url:r,force:i}){if(n!==fn.default.clean(n))throw new zn(n,fn.default.clean(n));let a=await ze.get({fs:t,gitdir:e});if(!i&&(await a.getSubsections("remote")).includes(n)&&r!==await a.get(`remote.${n}.url`))throw new hn("remote",n);await a.set(`remote.${n}.url`,r),await a.set(`remote.${n}.fetch`,`+refs/heads/*:refs/remotes/${n}/*`),await ze.save({fs:t,gitdir:e,config:a})}async function fC({fs:t,dir:e,gitdir:n=B(e,".git"),remote:r,url:i,force:a=!1}){try{return F("fs",t),F("gitdir",n),F("remote",r),F("url",i),await R1({fs:new Q(t),gitdir:n,remote:r,url:i,force:a})}catch(s){throw s.caller="git.addRemote",s}}async function hC({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!u&&await q.exists({fs:t,gitdir:r,ref:i}))throw new hn("tag",i);let f=await q.resolve({fs:t,gitdir:r,ref:l||"HEAD"}),{type:h}=await Ge({fs:t,cache:e,gitdir:r,oid:f}),d=Ut.from({object:f,type:h,tag:i.replace("refs/tags/",""),tagger:a,message:s,gpgsig:o});c&&(d=await Ut.sign(d,n,c));let p=await zt({fs:t,gitdir:r,type:"tag",object:d.toObject()});await q.writeRef({fs:t,gitdir:r,ref:i,value:p})}async function dC({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{F("fs",t),F("gitdir",r),F("ref",i),c&&F("onSign",e);let h=new Q(t),d=await Hr({fs:h,gitdir:r,author:a});if(!d)throw new At("tagger");return await hC({fs:h,cache:f,onSign:e,gitdir:r,ref:i,tagger:d,message:s,gpgsig:o,object:l,signingKey:c,force:u})}catch(h){throw h.caller="git.annotatedTag",h}}async function pC({fs:t,gitdir:e,ref:n,object:r,checkout:i=!1,force:a=!1}){if(n!==fn.default.clean(n))throw new zn(n,fn.default.clean(n));let s=`refs/heads/${n}`;if(!a&&await q.exists({fs:t,gitdir:e,ref:s}))throw new hn("branch",n,!1);let o;try{o=await q.resolve({fs:t,gitdir:e,ref:r||"HEAD"})}catch(l){}o&&await q.writeRef({fs:t,gitdir:e,ref:s,value:o}),i&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function mC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,object:i,checkout:a=!1,force:s=!1}){try{return F("fs",t),F("gitdir",n),F("ref",r),await pC({fs:new Q(t),gitdir:n,ref:r,object:i,checkout:a,force:s})}catch(o){throw o.caller="git.branch",o}}var L1=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function Uf({fs:t,cache:e,onProgress:n,onPostCheckout:r,dir:i,gitdir:a,remote:s,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:h,track:d=!0}){let p;if(r)try{p=await q.resolve({fs:t,gitdir:a,ref:"HEAD"})}catch(m){p="0000000000000000000000000000000000000000"}let g;try{g=await q.resolve({fs:t,gitdir:a,ref:o})}catch(m){if(o==="HEAD")throw m;let w=`${s}/${o}`;if(g=await q.resolve({fs:t,gitdir:a,ref:w}),d){let b=await ze.get({fs:t,gitdir:a});await b.set(`branch.${o}.remote`,s),await b.set(`branch.${o}.merge`,`refs/heads/${o}`),await ze.save({fs:t,gitdir:a,config:b})}await q.writeRef({fs:t,gitdir:a,ref:`refs/heads/${o}`,value:g})}if(!c){let m;try{m=await gC({fs:t,cache:e,onProgress:n,dir:i,gitdir:a,ref:o,force:h,filepaths:l})}catch(x){throw x instanceof Re&&x.data.what===g?new es(o,g):x}let w=m.filter(([x])=>x==="conflict").map(([x,A])=>A);if(w.length>0)throw new Qa(w);let b=m.filter(([x])=>x==="error").map(([x,A])=>A);if(b.length>0)throw new ue(b.join(", "));if(f){r&&await r({previousHead:p,newHead:g,type:l!=null&&l.length>0?"file":"branch"});return}let S=0,k=m.length;await lt.acquire({fs:t,gitdir:a,cache:e},async function(x){await Promise.all(m.filter(([A])=>A==="delete"||A==="delete-index").map(async function([A,y]){let E=`${i}/${y}`;A==="delete"&&await t.rm(E),x.delete({filepath:y}),n&&await n({phase:"Updating workdir",loaded:++S,total:k})}))}),await lt.acquire({fs:t,gitdir:a,cache:e},async function(x){for(let[A,y]of m)if(A==="rmdir"||A==="rmdir-index"){let E=`${i}/${y}`;try{A==="rmdir-index"&&x.delete({filepath:y}),await t.rmdir(E),n&&await n({phase:"Updating workdir",loaded:++S,total:k})}catch(_){if(_.code==="ENOTEMPTY")console.log(`Did not delete ${y} because directory is not empty`);else throw _}}}),await Promise.all(m.filter(([x])=>x==="mkdir"||x==="mkdir-index").map(async function([x,A]){let y=`${i}/${A}`;await t.mkdir(y),n&&await n({phase:"Updating workdir",loaded:++S,total:k})})),await lt.acquire({fs:t,gitdir:a,cache:e},async function(x){await Promise.all(m.filter(([A])=>A==="create"||A==="create-index"||A==="update"||A==="mkdir-index").map(async function([A,y,E,_,C]){let M=`${i}/${y}`;try{if(A!=="create-index"&&A!=="mkdir-index"){let{object:N}=await Ge({fs:t,cache:e,gitdir:a,oid:E});if(C&&await t.rm(M),_===33188)await t.write(M,N);else if(_===33261)await t.write(M,N,{mode:511});else if(_===40960)await t.writelink(M,N);else throw new ue(`Invalid mode 0o${_.toString(8)} detected in blob ${E}`)}let L=await t.lstat(M);_===33261&&(L.mode=493),A==="mkdir-index"&&(L.mode=57344),x.insert({filepath:y,stats:L,oid:E}),n&&await n({phase:"Updating workdir",loaded:++S,total:k})}catch(L){console.log(L)}}))}),r&&await r({previousHead:p,newHead:g,type:l!=null&&l.length>0?"file":"branch"})}if(!u){let m=await q.expand({fs:t,gitdir:a,ref:o});m.startsWith("refs/heads")?await q.writeSymbolicRef({fs:t,gitdir:a,ref:"HEAD",value:m}):await q.writeRef({fs:t,gitdir:a,ref:"HEAD",value:g})}}async function gC({fs:t,cache:e,onProgress:n,dir:r,gitdir:i,ref:a,force:s,filepaths:o}){let l=0;return Pi({fs:t,cache:e,dir:r,gitdir:i,trees:[sr({ref:a}),Yo(),Xo()],map:async function(c,[u,f,h]){if(c===".")return;if(o&&!o.some(p=>L1(c,p)))return null;switch(n&&await n({phase:"Analyzing workdir",loaded:++l}),[!!h,!!u,!!f].map(Number).join("")){case"000":return;case"001":return s&&o&&o.includes(c)?["delete",c]:void 0;case"010":switch(await u.type()){case"tree":return["mkdir",c];case"blob":return["create",c,await u.oid(),await u.mode()];case"commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`new entry Unhandled type ${await u.type()}`]}case"011":switch(`${await u.type()}-${await f.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",c];case"blob-blob":return await u.oid()!==await f.oid()?s?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]:await u.mode()!==await f.mode()?s?["update",c,await u.oid(),await u.mode(),!0]:["conflict",c]:["create-index",c,await u.oid(),await u.mode()];case"commit-tree":return;case"commit-blob":return["conflict",c];default:return["error",`new entry Unhandled type ${u.type}`]}case"100":return["delete-index",c];case"101":switch(await h.type()){case"tree":return["rmdir",c];case"blob":return await h.oid()!==await f.oid()?s?["delete",c]:["conflict",c]:["delete",c];case"commit":return["rmdir-index",c];default:return["error",`delete entry Unhandled type ${await h.type()}`]}case"110":case"111":switch(`${await h.type()}-${await u.type()}`){case"tree-tree":return;case"blob-blob":{if(await h.oid()===await u.oid()&&await h.mode()===await u.mode()&&!s)return;if(f){if(await f.oid()!==await h.oid()&&await f.oid()!==await u.oid())return s?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]}else if(s)return["update",c,await u.oid(),await u.mode(),await u.mode()!==await h.mode()];return await u.mode()!==await h.mode()?["update",c,await u.oid(),await u.mode(),!0]:await u.oid()!==await h.oid()?["update",c,await u.oid(),await u.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",c,await u.oid()];case"blob-tree":return["update-blob-to-tree",c];case"commit-commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`update entry Unhandled type ${await h.type()}-${await u.type()}`]}}},reduce:async function(c,u){return u=C1(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u}})}async function yC({fs:t,onProgress:e,onPostCheckout:n,dir:r,gitdir:i=B(r,".git"),remote:a="origin",ref:s,filepaths:o,noCheckout:l=!1,noUpdateHead:c=s===void 0,dryRun:u=!1,force:f=!1,track:h=!0,cache:d={}}){try{F("fs",t),F("dir",r),F("gitdir",i);let p=s||"HEAD";return await Uf({fs:new Q(t),cache:d,onProgress:e,onPostCheckout:n,dir:r,gitdir:i,remote:a,ref:p,filepaths:o,noCheckout:l,noUpdateHead:c,dryRun:u,force:f,track:h})}catch(p){throw p.caller="git.checkout",p}}var vC=new RegExp("^refs/(heads/|tags/|remotes/)?(.*)");function Nr(t){let e=vC.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}async function zr({fs:t,gitdir:e,fullname:n=!1,test:r=!1}){let i=await q.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(r)try{await q.resolve({fs:t,gitdir:e,ref:i})}catch(a){return}if(i.startsWith("refs/"))return n?i:Nr(i)}function wC(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}function j1({username:t="",password:e=""}){return`Basic ${Buffer.from(`${t}:${e}`).toString("base64")}`}async function ps(t,e){let n=A1(t);for(;;){let{value:r,done:i}=await n.next();if(r&&await e(r),i)break}n.return&&n.return()}async function zo(t){let e=0,n=[];await ps(t,a=>{n.push(a),e+=a.byteLength});let r=new Uint8Array(e),i=0;for(let a of n)r.set(a,i),i+=a.byteLength;return r}function f1(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(e==null)return{url:t,auth:{}};e=e[1];let[n,r]=e.split(":");return t=t.replace(`${e}@`,""),{url:t,auth:{username:n,password:r}}}function Bf(t,e){let n=e.toString(16);return"0".repeat(t-n.length)+n}var Ue=class{static flush(){return Buffer.from("0000","utf8")}static delim(){return Buffer.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=Buffer.from(e));let n=e.length+4,r=Bf(4,n);return Buffer.concat([Buffer.from(r,"utf8"),e])}static streamReader(e){let n=new No(e);return async function(){try{let i=await n.read(4);if(i==null)return!0;if(i=parseInt(i.toString("utf8"),16),i===0||i===1)return null;let a=await n.read(i-4);return a==null?!0:a}catch(i){return e.error=i,!0}}}};async function h1(t){let e={},n;for(;n=await t(),n!==!0;){if(n===null)continue;n=n.toString("utf8").replace(/\n$/,"");let r=n.indexOf("=");if(r>-1){let i=n.slice(0,r),a=n.slice(r+1);e[i]=a}else e[n]=!0}return{protocolVersion:2,capabilities2:e}}async function d1(t,{service:e}){let n=new Set,r=new Map,i=new Map,a=Ue.streamReader(t),s=await a();for(;s===null;)s=await a();if(s===!0)throw new ts;if(s.includes("version 2"))return h1(a);if(s.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new $r(`# service=${e}\\n`,s.toString("utf8"));let o=await a();for(;o===null;)o=await a();if(o===!0)return{capabilities:n,refs:r,symrefs:i};if(o=o.toString("utf8"),o.includes("version 2"))return h1(a);let[l,c]=Sf(o,"\0","\\x00");if(c.split(" ").map(u=>n.add(u)),l!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,f]=Sf(l," "," ");for(r.set(f,u);;){let h=await a();if(h===!0)break;if(h!==null){let[d,p]=Sf(h.toString("utf8")," "," ");r.set(p,d)}}}for(let u of n)if(u.startsWith("symref=")){let f=u.match(/symref=([^:]+):(.*)/);f.length===3&&i.set(f[1],f[2])}return{protocolVersion:1,capabilities:n,refs:r,symrefs:i}}function Sf(t,e,n){let r=t.trim().split(e);if(r.length!==2)throw new $r(`Two strings separated by '${n}'`,t.toString("utf8"));return r}var p1=(t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,m1=(t,e)=>{(e.username||e.password)&&(t.Authorization=j1(e)),e.headers&&Object.assign(t,e.headers)},Ef=async t=>{try{let e=Buffer.from(await zo(t.body)),n=e.toString("utf8");return{preview:n.length<256?n:n.slice(0,256)+"...",response:n,data:e}}catch(e){return{}}},Li=class{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:n,onAuth:r,onAuthSuccess:i,onAuthFailure:a,corsProxy:s,service:o,url:l,headers:c,protocolVersion:u}){let{url:f,auth:h}=f1(l),d=s?p1(s,f):f;(h.username||h.password)&&(c.Authorization=j1(h)),u===2&&(c["Git-Protocol"]="version=2");let p,g,m=!1;do if(p=await e.request({onProgress:n,method:"GET",url:`${d}/info/refs?service=${o}`,headers:c}),g=!1,p.statusCode===401||p.statusCode===203){let w=m?a:r;if(w){if(h=await w(f,{...h,headers:{...c}}),h&&h.cancel)throw new Mi;h&&(m1(c,h),m=!0,g=!0)}}else p.statusCode===200&&m&&i&&await i(f,h);while(g);if(p.statusCode!==200){let{response:w}=await Ef(p);throw new Ai(p.statusCode,p.statusMessage,w)}if(p.headers["content-type"]===`application/x-${o}-advertisement`){let w=await d1(p.body,{service:o});return w.auth=h,w}else{let{preview:w,response:b,data:S}=await Ef(p);try{let k=await d1([S],{service:o});return k.auth=h,k}catch(k){throw new ss(w,b)}}}static async connect({http:e,onProgress:n,corsProxy:r,service:i,url:a,auth:s,body:o,headers:l}){let c=f1(a);c&&(a=c.url),r&&(a=p1(r,a)),l["content-type"]=`application/x-${i}-request`,l.accept=`application/x-${i}-result`,m1(l,s);let u=await e.request({onProgress:n,method:"POST",url:`${a}/${i}`,body:o,headers:l});if(u.statusCode!==200){let{response:f}=Ef(u);throw new Ai(u.statusCode,u.statusMessage,f)}return u}};function bC({url:t}){if(t.startsWith("git@"))return{transport:"ssh",address:t};let e=t.match(/(\w+)(:\/\/|::)(.*)/);if(e!==null){if(e[2]==="://")return{transport:e[1],address:e[0]};if(e[2]==="::")return{transport:e[1],address:e[3]}}}var ji=class{static getRemoteHelperFor({url:e}){let n=new Map;n.set("http",Li),n.set("https",Li);let r=bC({url:e});if(!r)throw new ls(e);if(n.has(r.transport))return n.get(r.transport);throw new os(e,r.transport,r.transport==="ssh"?wC(e):void 0)}},Br=null,Ur=class{static async read({fs:e,gitdir:n}){Br===null&&(Br=new Xa.default);let r=B(n,"shallow"),i=new Set;return await Br.acquire(r,async function(){let a=await e.read(r,{encoding:"utf8"});if(a===null||a.trim()==="")return i;a.trim().split(` `).map(s=>i.add(s))}),i}static async write({fs:e,gitdir:n,oids:r}){Br===null&&(Br=new Xa.default);let i=B(n,"shallow");if(r.size>0){let a=[...r].join(` `)+` `;await Br.acquire(i,async function(){await e.write(i,a,{encoding:"utf8"})})}else await Br.acquire(i,async function(){await e.rm(i)})}};async function xC({fs:t,gitdir:e,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`;return t.exists(`${e}/${r}`)}async function _C({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i}){let a=await t.readdir(B(n,"objects/pack"));a=a.filter(s=>s.endsWith(".idx"));for(let s of a){let o=`${n}/objects/pack/${s}`,l=await $f({fs:t,cache:e,filename:o,getExternalRefDelta:i});if(l.error)throw new ue(l.error);if(l.offsets.has(r))return!0}return!1}async function g1({fs:t,cache:e,gitdir:n,oid:r,format:i="content"}){let a=o=>Ge({fs:t,cache:e,gitdir:n,oid:o}),s=await xC({fs:t,gitdir:n,oid:r});return s||(s=await _C({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:a})),s}function SC(t){let i="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===i}function D1(t,e){let n=t.map(r=>r.split("=",1)[0]);return e.filter(r=>{let i=r.split("=",1)[0];return n.includes(i)})}var Ko={name:"isomorphic-git",version:"1.27.1",agent:"git/isomorphic-git@1.27.1"},_i=class{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let n=this._waiting;this._waiting=null,n({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};function EC(t){let e=t.indexOf("\r"),n=t.indexOf(` `);return e===-1&&n===-1?-1:e===-1?n+1:n===-1?e+1:n===e+1?n+1:Math.min(e,n)+1}function B1(t){let e=new _i,n="";return(async()=>(await ps(t,r=>{for(r=r.toString("utf8"),n+=r;;){let i=EC(n);if(i===-1)break;e.write(n.slice(0,i)),n=n.slice(i)}}),n.length>0&&e.write(n),e.end()))(),e}var Go=class{static demux(e){let n=Ue.streamReader(e),r=new _i,i=new _i,a=new _i,s=async function(){let o=await n();if(o===null)return s();if(o===!0){r.end(),a.end(),e.error?i.destroy(e.error):i.end();return}switch(o[0]){case 1:{i.write(o.slice(1));break}case 2:{a.write(o.slice(1));break}case 3:{let l=o.slice(1);a.write(l),r.end(),a.end(),i.destroy(new Error(l.toString("utf8")));return}default:r.write(o)}s()};return s(),{packetlines:r,packfile:i,progress:a}}};async function kC(t){let{packetlines:e,packfile:n,progress:r}=Go.demux(t),i=[],a=[],s=[],o=!1,l=!1;return new Promise((c,u)=>{ps(e,f=>{let h=f.toString("utf8").trim();if(h.startsWith("shallow")){let d=h.slice(-41).trim();d.length!==40&&u(new or(d)),i.push(d)}else if(h.startsWith("unshallow")){let d=h.slice(-41).trim();d.length!==40&&u(new or(d)),a.push(d)}else if(h.startsWith("ACK")){let[,d,p]=h.split(" ");s.push({oid:d,status:p}),p||(l=!0)}else h.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?u(t.error):c({shallows:i,unshallows:a,acks:s,nak:o,packfile:n,progress:r}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:i,unshallows:a,acks:s,nak:o,packfile:n,progress:r}))})})}function AC({capabilities:t=[],wants:e=[],haves:n=[],shallows:r=[],depth:i=null,since:a=null,exclude:s=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)o.push(Ue.encode(`want ${c}${l} `)),l="";for(let c of r)o.push(Ue.encode(`shallow ${c} `));i!==null&&o.push(Ue.encode(`deepen ${i} `)),a!==null&&o.push(Ue.encode(`deepen-since ${Math.floor(a.valueOf()/1e3)} `));for(let c of s)o.push(Ue.encode(`deepen-not ${c} `));o.push(Ue.flush());for(let c of n)o.push(Ue.encode(`have ${c} `));return o.push(Ue.encode(`done `)),o}async function zf({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:l,ref:c,remoteRef:u,remote:f,url:h,corsProxy:d,depth:p=null,since:g=null,exclude:m=[],relative:w=!1,tags:b=!1,singleBranch:S=!1,headers:k={},prune:x=!1,pruneTags:A=!1}){let y=c||await zr({fs:t,gitdir:l,test:!0}),E=await ze.get({fs:t,gitdir:l}),_=f||y&&await E.get(`branch.${y}.remote`)||"origin",C=h||await E.get(`remote.${_}.url`);if(typeof C=="undefined")throw new Pt("remote OR url");let M=u||y&&await E.get(`branch.${y}.merge`)||c||"HEAD";d===void 0&&(d=await E.get("http.corsProxy"));let L=ji.getRemoteHelperFor({url:C}),N=await L.discover({http:n,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:d,service:"git-upload-pack",url:C,headers:k,protocolVersion:1}),j=N.auth,Y=N.refs;if(Y.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!N.capabilities.has("shallow"))throw new ar("shallow","depth");if(g!==null&&!N.capabilities.has("deepen-since"))throw new ar("deepen-since","since");if(m.length>0&&!N.capabilities.has("deepen-not"))throw new ar("deepen-not","exclude");if(w===!0&&!N.capabilities.has("deepen-relative"))throw new ar("deepen-relative","relative");let{oid:le,fullref:he}=q.resolveAgainstMap({ref:M,map:Y});for(let z of Y.keys())z===he||z==="HEAD"||z.startsWith("refs/heads/")||b&&z.startsWith("refs/tags/")||Y.delete(z);let ie=D1([...N.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Ko.agent}`]);w&&ie.push("deepen-relative");let Me=S?[le]:Y.values(),de=S?[y]:await q.listRefs({fs:t,gitdir:l,filepath:"refs"}),$=[];for(let z of de)try{z=await q.expand({fs:t,gitdir:l,ref:z});let nt=await q.resolve({fs:t,gitdir:l,ref:z});await g1({fs:t,cache:e,gitdir:l,oid:nt})&&$.push(nt)}catch(nt){}$=[...new Set($)];let G=await Ur.read({fs:t,gitdir:l}),D=N.capabilities.has("shallow")?[...G]:[],se=AC({capabilities:ie,wants:Me,haves:$,shallows:D,depth:p,since:g,exclude:m}),Se=Buffer.from(await zo(se)),mt=await L.connect({http:n,onProgress:r,corsProxy:d,service:"git-upload-pack",url:C,auth:j,body:[Se],headers:k}),be=await kC(mt.body);mt.headers&&(be.headers=mt.headers);for(let z of be.shallows)if(!G.has(z))try{let{object:nt}=await Ge({fs:t,cache:e,gitdir:l,oid:z}),H=new Rt(nt),Z=await Promise.all(H.headers().parent.map(Ye=>g1({fs:t,cache:e,gitdir:l,oid:Ye})));Z.length===0||Z.every(Ye=>Ye)||G.add(z)}catch(nt){G.add(z)}for(let z of be.unshallows)G.delete(z);if(await Ur.write({fs:t,gitdir:l,oids:G}),S){let z=new Map([[he,le]]),nt=new Map,H=10,Z=he;for(;H--;){let _t=N.symrefs.get(Z);if(_t===void 0)break;nt.set(Z,_t),Z=_t}let ye=Y.get(Z);ye&&z.set(Z,ye);let{pruned:Ye}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:z,symrefs:nt,tags:b,prune:x});x&&(be.pruned=Ye)}else{let{pruned:z}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:Y,symrefs:N.symrefs,tags:b,prune:x,pruneTags:A});x&&(be.pruned=z)}if(be.HEAD=N.symrefs.get("HEAD"),be.HEAD===void 0){let{oid:z}=q.resolveAgainstMap({ref:"HEAD",map:Y});for(let[nt,H]of Y.entries())if(nt!=="HEAD"&&H===z){be.HEAD=nt;break}}let st=he.startsWith("refs/tags")?"tag":"branch";if(be.FETCH_HEAD={oid:le,description:`${st} '${Nr(he)}' of ${C}`},r||i){let z=B1(be.progress);ps(z,async nt=>{if(i&&await i(nt),r){let H=nt.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);H&&await r({phase:H[1].trim(),loaded:parseInt(H[2],10),total:parseInt(H[3],10)})}})}let ee=Buffer.from(await zo(be.packfile));if(mt.body.error)throw mt.body.error;let Ie=ee.slice(-20).toString("hex"),Ee={defaultBranch:be.HEAD,fetchHead:be.FETCH_HEAD.oid,fetchHeadDescription:be.FETCH_HEAD.description};if(be.headers&&(Ee.headers=be.headers),x&&(Ee.pruned=be.pruned),Ie!==""&&!SC(ee)){Ee.packfile=`objects/pack/pack-${Ie}.pack`;let z=B(l,Ee.packfile);await t.write(z,ee);let nt=Z=>Ge({fs:t,cache:e,gitdir:l,oid:Z}),H=await Ka.fromPack({pack:ee,getExternalRefDelta:nt,onProgress:r});await t.write(z.replace(/\.pack$/,".idx"),await H.toBuffer())}return Ee}async function N1({fs:t,bare:e=!1,dir:n,gitdir:r=e?n:B(n,".git"),defaultBranch:i="master"}){if(await t.exists(r+"/config"))return;let a=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];a=a.map(s=>r+"/"+s);for(let s of a)await t.mkdir(s);await t.write(r+"/config",`[core] repositoryformatversion = 0 filemode = false bare = ${e} `+(e?"":` logallrefupdates = true `)+` symlinks = false ignorecase = true `),await t.write(r+"/HEAD",`ref: refs/heads/${i} `)}async function TC({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:h,ref:d,remote:p,depth:g,since:m,exclude:w,relative:b,singleBranch:S,noCheckout:k,noTags:x,headers:A}){try{if(await N1({fs:t,gitdir:u}),await R1({fs:t,gitdir:u,remote:p,url:f,force:!1}),h){let _=await ze.get({fs:t,gitdir:u});await _.set("http.corsProxy",h),await ze.save({fs:t,gitdir:u,config:_})}let{defaultBranch:y,fetchHead:E}=await zf({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:u,ref:d,remote:p,corsProxy:h,depth:g,since:m,exclude:w,relative:b,singleBranch:S,headers:A,tags:!x});if(E===null)return;d=d||y,d=d.replace("refs/heads/",""),await Uf({fs:t,cache:e,onProgress:r,onPostCheckout:l,dir:c,gitdir:u,ref:d,remote:p,noCheckout:k})}catch(y){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),y}}async function CC({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:c=B(l,".git"),url:u,corsProxy:f=void 0,ref:h=void 0,remote:d="origin",depth:p=void 0,since:g=void 0,exclude:m=[],relative:w=!1,singleBranch:b=!1,noCheckout:S=!1,noTags:k=!1,headers:x={},cache:A={}}){try{return F("fs",t),F("http",e),F("gitdir",c),S||F("dir",l),F("url",u),await TC({fs:new Q(t),cache:A,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:c,url:u,corsProxy:f,ref:h,remote:d,depth:p,since:g,exclude:m,relative:w,singleBranch:b,noCheckout:S,noTags:k,headers:x})}catch(y){throw y.caller="git.clone",y}}async function FC({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:h,tree:d,cache:p={}}){try{F("fs",t),l||F("message",i),o&&F("onSign",e);let g=new Q(t);return await Zo({fs:g,cache:p,onSign:e,gitdir:r,message:i,author:a,committer:s,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,ref:f,parent:h,tree:d})}catch(g){throw g.caller="git.commit",g}}async function MC({fs:t,dir:e,gitdir:n=B(e,".git"),fullname:r=!1,test:i=!1}){try{return F("fs",t),F("gitdir",n),await zr({fs:new Q(t),gitdir:n,fullname:r,test:i})}catch(a){throw a.caller="git.currentBranch",a}}async function OC({fs:t,gitdir:e,ref:n}){if(n=n.startsWith("refs/heads/")?n:`refs/heads/${n}`,!await q.exists({fs:t,gitdir:e,ref:n}))throw new Re(n);let i=await q.expand({fs:t,gitdir:e,ref:n}),a=await zr({fs:t,gitdir:e,fullname:!0});if(i===a){let l=await q.resolve({fs:t,gitdir:e,ref:i});await q.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await q.deleteRef({fs:t,gitdir:e,ref:i});let s=Nr(n),o=await ze.get({fs:t,gitdir:e});await o.deleteSection("branch",s),await ze.save({fs:t,gitdir:e,config:o})}async function PC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{return F("fs",t),F("ref",r),await OC({fs:new Q(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.deleteBranch",i}}async function IC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{F("fs",t),F("ref",r),await q.deleteRef({fs:new Q(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.deleteRef",i}}async function RC({fs:t,gitdir:e,remote:n}){let r=await ze.get({fs:t,gitdir:e});await r.deleteSection("remote",n),await ze.save({fs:t,gitdir:e,config:r})}async function LC({fs:t,dir:e,gitdir:n=B(e,".git"),remote:r}){try{return F("fs",t),F("remote",r),await RC({fs:new Q(t),gitdir:n,remote:r})}catch(i){throw i.caller="git.deleteRemote",i}}async function jC({fs:t,gitdir:e,ref:n}){n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,await q.deleteRef({fs:t,gitdir:e,ref:n})}async function DC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{return F("fs",t),F("ref",r),await jC({fs:new Q(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.deleteTag",i}}async function BC({fs:t,gitdir:e,oid:n}){let r=n.slice(0,2);return(await t.readdir(`${e}/objects/${r}`)).map(a=>`${r}${a}`).filter(a=>a.startsWith(n))}async function NC({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i}){let a=[],s=await t.readdir(B(n,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${n}/objects/pack/${o}`,c=await $f({fs:t,cache:e,filename:l,getExternalRefDelta:i});if(c.error)throw new ue(c.error);for(let u of c.offsets.keys())u.startsWith(r)&&a.push(u)}return a}async function $C({fs:t,cache:e,gitdir:n,oid:r}){let i=o=>Ge({fs:t,cache:e,gitdir:n,oid:o}),a=await BC({fs:t,gitdir:n,oid:r}),s=await NC({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i});for(let o of s)a.indexOf(o)===-1&&a.push(o);if(a.length===1)return a[0];throw a.length>1?new Ja("oids",r,a):new Re(`an object matching "${r}"`)}async function HC({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await $C({fs:new Q(t),cache:i,gitdir:n,oid:r})}catch(a){throw a.caller="git.expandOid",a}}async function UC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{return F("fs",t),F("gitdir",n),F("ref",r),await q.expand({fs:new Q(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.expandRef",i}}async function Gf({fs:t,cache:e,gitdir:n,oids:r}){let i={},a=r.length,s=r.map((o,l)=>({index:l,oid:o}));for(;s.length;){let o=new Set;for(let{oid:c,index:u}of s)i[c]||(i[c]=new Set),i[c].add(u),i[c].size===a&&o.add(c);if(o.size>0)return[...o];let l=new Map;for(let{oid:c,index:u}of s)try{let{object:f}=await Ge({fs:t,cache:e,gitdir:n,oid:c}),h=Rt.from(f),{parent:d}=h.parseHeaders();for(let p of d)(!i[p]||!i[p].has(u))&&l.set(p+":"+u,{oid:p,index:u})}catch(f){}s=Array.from(l.values())}return[]}var kf=/^.*(\r?\n|$)/gm;function zC({branches:t,contents:e}){let n=t[1],r=t[2],i=e[0],a=e[1],s=e[2],o=a.match(kf),l=i.match(kf),c=s.match(kf),u=(0,b1.default)(o,l,c),f=7,h="",d=!0;for(let p of u)p.ok&&(h+=p.ok.join("")),p.conflict&&(d=!1,h+=`${"<".repeat(f)} ${n} `,h+=p.conflict.a.join(""),h+=`${"=".repeat(f)} `,h+=p.conflict.b.join(""),h+=`${">".repeat(f)} ${r} `);return{cleanMerge:d,mergedText:h}}async function GC({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),index:i,ourOid:a,baseOid:s,theirOid:o,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:h=!0,mergeDriver:d}){let p=sr({ref:a}),g=sr({ref:s}),m=sr({ref:o}),w=[],b=[],S=[],k=[],x=await Pi({fs:t,cache:e,dir:n,gitdir:r,trees:[p,g,m],map:async function(A,[y,E,_]){let C=jo(A),M=await Ho(y,E),L=await Ho(_,E);switch(`${M}-${L}`){case"false-false":return{mode:await E.mode(),path:C,oid:await E.oid(),type:await E.type()};case"false-true":return _?{mode:await _.mode(),path:C,oid:await _.oid(),type:await _.type()}:void 0;case"true-false":return y?{mode:await y.mode(),path:C,oid:await y.oid(),type:await y.type()}:void 0;case"true-true":{if(y&&E&&_&&await y.type()==="blob"&&await E.type()==="blob"&&await _.type()==="blob")return VC({fs:t,gitdir:r,path:C,ours:y,base:E,theirs:_,ourName:l,baseName:c,theirName:u,mergeDriver:d}).then(async N=>{if(N.cleanMerge)h||i.insert({filepath:A,oid:N.mergeResult.oid,stage:0});else if(w.push(A),b.push(A),!h){let j=await E.oid(),Y=await y.oid(),le=await _.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:j,stage:1}),i.insert({filepath:A,oid:Y,stage:2}),i.insert({filepath:A,oid:le,stage:3})}return N.mergeResult});if(E&&!y&&_&&await E.type()==="blob"&&await _.type()==="blob"){if(w.push(A),S.push(A),!h){let N=await E.oid(),j=await _.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:N,stage:1}),i.insert({filepath:A,oid:j,stage:3})}return{mode:await _.mode(),oid:await _.oid(),type:"blob",path:C}}if(E&&y&&!_&&await E.type()==="blob"&&await y.type()==="blob"){if(w.push(A),k.push(A),!h){let N=await E.oid(),j=await y.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:N,stage:1}),i.insert({filepath:A,oid:j,stage:2})}return{mode:await y.mode(),oid:await y.oid(),type:"blob",path:C}}if(E&&!y&&!_&&await E.type()==="blob")return;throw new Ti}}},reduce:w.length!==0&&(!n||h)?void 0:async(A,y)=>{let E=y.filter(Boolean);if(A&&!(A&&A.type==="tree"&&E.length===0)){if(E.length>0){let C=new It(E).toObject(),M=await zt({fs:t,gitdir:r,type:"tree",object:C,dryRun:f});A.oid=M}return A}}});return w.length!==0?(n&&!h&&await Pi({fs:t,cache:e,dir:n,gitdir:r,trees:[sr({ref:x.oid})],map:async function(A,[y]){let E=`${n}/${A}`;if(await y.type()==="blob"){let _=await y.mode(),C=new TextDecoder().decode(await y.content());await t.write(E,C,{mode:_})}return!0}}),new Ci(w,b,S,k)):x.oid}async function VC({fs:t,gitdir:e,path:n,ours:r,base:i,theirs:a,ourName:s,theirName:o,baseName:l,dryRun:c,mergeDriver:u=zC}){let f="blob",h=await i.mode()===await r.mode()?await a.mode():await r.mode();if(await r.oid()===await a.oid())return{cleanMerge:!0,mergeResult:{mode:h,path:n,oid:await r.oid(),type:f}};if(await r.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:h,path:n,oid:await a.oid(),type:f}};if(await a.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:h,path:n,oid:await r.oid(),type:f}};let d=Buffer.from(await r.content()).toString("utf8"),p=Buffer.from(await i.content()).toString("utf8"),g=Buffer.from(await a.content()).toString("utf8"),{mergedText:m,cleanMerge:w}=await u({branches:[l,s,o],contents:[p,d,g],path:n}),b=await zt({fs:t,gitdir:e,type:"blob",object:Buffer.from(m,"utf8"),dryRun:c});return{cleanMerge:w,mergeResult:{mode:h,path:n,oid:b,type:f}}}async function $1({fs:t,cache:e,dir:n,gitdir:r,ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:h,committer:d,signingKey:p,onSign:g,mergeDriver:m}){i===void 0&&(i=await zr({fs:t,gitdir:r,fullname:!0})),i=await q.expand({fs:t,gitdir:r,ref:i}),a=await q.expand({fs:t,gitdir:r,ref:a});let w=await q.resolve({fs:t,gitdir:r,ref:i}),b=await q.resolve({fs:t,gitdir:r,ref:a}),S=await Gf({fs:t,cache:e,gitdir:r,oids:[w,b]});if(S.length!==1)throw new Ti;let k=S[0];if(k===b)return{oid:w,alreadyMerged:!0};if(s&&k===w)return!l&&!c&&await q.writeRef({fs:t,gitdir:r,ref:i,value:b}),{oid:b,fastForward:!0};{if(o)throw new ns;let x=await lt.acquire({fs:t,gitdir:r,cache:e,allowUnmerged:!1},async y=>GC({fs:t,cache:e,dir:n,gitdir:r,index:y,ourOid:w,theirOid:b,baseOid:k,ourName:Nr(i),baseName:"base",theirName:Nr(a),dryRun:l,abortOnConflict:u,mergeDriver:m}));if(x instanceof Ci)throw x;return f||(f=`Merge branch '${Nr(a)}' into ${Nr(i)}`),{oid:await Zo({fs:t,cache:e,gitdir:r,message:f,ref:i,tree:x,parent:[w,b],author:h,committer:d,signingKey:p,onSign:g,dryRun:l,noUpdateBranch:c}),tree:x,mergeCommit:!0}}}async function H1({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,dir:l,gitdir:c,ref:u,url:f,remote:h,remoteRef:d,prune:p,pruneTags:g,fastForward:m,fastForwardOnly:w,corsProxy:b,singleBranch:S,headers:k,author:x,committer:A,signingKey:y}){try{if(!u){let C=await zr({fs:t,gitdir:c});if(!C)throw new Pt("ref");u=C}let{fetchHead:E,fetchHeadDescription:_}=await zf({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:c,corsProxy:b,ref:u,url:f,remote:h,remoteRef:d,singleBranch:S,headers:k,prune:p,pruneTags:g});await $1({fs:t,cache:e,gitdir:c,ours:u,theirs:E,fastForward:m,fastForwardOnly:w,message:`Merge ${_}`,author:x,committer:A,signingKey:y,dryRun:!1,noUpdateBranch:!1}),await Uf({fs:t,cache:e,onProgress:r,dir:l,gitdir:c,ref:u,remote:h,noCheckout:!1})}catch(E){throw E.caller="git.pull",E}}async function WC({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=B(o,".git"),ref:c,url:u,remote:f,remoteRef:h,corsProxy:d,singleBranch:p,headers:g={},cache:m={}}){try{F("fs",t),F("http",e),F("gitdir",l);let w={name:"",email:"",timestamp:Date.now(),timezoneOffset:0};return await H1({fs:new Q(t),cache:m,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l,ref:c,url:u,remote:f,remoteRef:h,fastForwardOnly:!0,corsProxy:d,singleBranch:p,headers:g,author:w,committer:w})}catch(w){throw w.caller="git.fastForward",w}}async function qC({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=B(o,".git"),ref:c,remote:u,remoteRef:f,url:h,corsProxy:d,depth:p=null,since:g=null,exclude:m=[],relative:w=!1,tags:b=!1,singleBranch:S=!1,headers:k={},prune:x=!1,pruneTags:A=!1,cache:y={}}){try{return F("fs",t),F("http",e),F("gitdir",l),await zf({fs:new Q(t),cache:y,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,gitdir:l,ref:c,remote:u,remoteRef:f,url:h,corsProxy:d,depth:p,since:g,exclude:m,relative:w,tags:b,singleBranch:S,headers:k,prune:x,pruneTags:A})}catch(E){throw E.caller="git.fetch",E}}async function XC({fs:t,dir:e,gitdir:n=B(e,".git"),oids:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oids",r),await Gf({fs:new Q(t),cache:i,gitdir:n,oids:r})}catch(a){throw a.caller="git.findMergeBase",a}}async function U1({fs:t,filepath:e}){if(await t.exists(B(e,".git")))return e;{let n=ki(e);if(n===e)throw new Re(`git root for ${e}`);return U1({fs:t,filepath:n})}}async function YC({fs:t,filepath:e}){try{return F("fs",t),F("filepath",e),await U1({fs:new Q(t),filepath:e})}catch(n){throw n.caller="git.findRoot",n}}async function ZC({fs:t,dir:e,gitdir:n=B(e,".git"),path:r}){try{return F("fs",t),F("gitdir",n),F("path",r),await fs({fs:new Q(t),gitdir:n,path:r})}catch(i){throw i.caller="git.getConfig",i}}async function KC({fs:t,gitdir:e,path:n}){return(await ze.get({fs:t,gitdir:e})).getall(n)}async function JC({fs:t,dir:e,gitdir:n=B(e,".git"),path:r}){try{return F("fs",t),F("gitdir",n),F("path",r),await KC({fs:new Q(t),gitdir:n,path:r})}catch(i){throw i.caller="git.getConfigAll",i}}async function QC({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:s={},forPush:o=!1}){try{F("http",t),F("url",a);let c=await ji.getRemoteHelperFor({url:a}).discover({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:1}),u={capabilities:[...c.capabilities]};for(let[f,h]of c.refs){let d=f.split("/"),p=d.pop(),g=u;for(let m of d)g[m]=g[m]||{},g=g[m];g[p]=h}for(let[f,h]of c.symrefs){let d=f.split("/"),p=d.pop(),g=u;for(let m of d)g[m]=g[m]||{},g=g[m];g[p]=h}return u}catch(l){throw l.caller="git.getRemoteInfo",l}}function z1(t,e,n,r){let i=[];for(let[a,s]of t.refs){if(e&&!a.startsWith(e))continue;if(a.endsWith("^{}")){if(r){let l=a.replace("^{}",""),c=i[i.length-1],u=c.ref===l?c:i.find(f=>f.ref===l);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=s}continue}let o={ref:a,oid:s};n&&t.symrefs.has(a)&&(o.target=t.symrefs.get(a)),i.push(o)}return i}async function e8({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2}){try{F("http",t),F("url",a);let u=await ji.getRemoteHelperFor({url:a}).discover({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:l});if(u.protocolVersion===2)return{protocolVersion:u.protocolVersion,capabilities:u.capabilities2};let f={};for(let h of u.capabilities){let[d,p]=h.split("=");p?f[d]=p:f[d]=!0}return{protocolVersion:1,capabilities:f,refs:z1(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}async function t8({type:t,object:e,format:n="content",oid:r=void 0}){return n!=="deflated"&&(n!=="wrapped"&&(e=lr.wrap({type:t,object:e})),r=await Un(e)),{oid:r,object:e}}async function n8({object:t}){try{F("object",t),typeof t=="string"?t=Buffer.from(t,"utf8"):t=Buffer.from(t);let e="blob",{oid:n,object:r}=await t8({type:"blob",format:"content",object:t});return{oid:n,type:e,object:new Uint8Array(r),format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}async function r8({fs:t,cache:e,onProgress:n,dir:r,gitdir:i,filepath:a}){try{a=B(r,a);let s=await t.read(a),o=c=>Ge({fs:t,cache:e,gitdir:i,oid:c}),l=await Ka.fromPack({pack:s,getExternalRefDelta:o,onProgress:n});return await t.write(a.replace(/\.pack$/,".idx"),await l.toBuffer()),{oids:[...l.hashes]}}catch(s){throw s.caller="git.indexPack",s}}async function i8({fs:t,onProgress:e,dir:n,gitdir:r=B(n,".git"),filepath:i,cache:a={}}){try{return F("fs",t),F("dir",n),F("gitdir",n),F("filepath",i),await r8({fs:new Q(t),cache:a,onProgress:e,dir:n,gitdir:r,filepath:i})}catch(s){throw s.caller="git.indexPack",s}}async function a8({fs:t,bare:e=!1,dir:n,gitdir:r=e?n:B(n,".git"),defaultBranch:i="master"}){try{return F("fs",t),F("gitdir",r),e||F("dir",n),await N1({fs:new Q(t),bare:e,dir:n,gitdir:r,defaultBranch:i})}catch(a){throw a.caller="git.init",a}}async function G1({fs:t,cache:e,gitdir:n,oid:r,ancestor:i,depth:a}){let s=await Ur.read({fs:t,gitdir:n});if(!r)throw new Pt("oid");if(!i)throw new Pt("ancestor");if(r===i)return!1;let o=[r],l=new Set,c=0;for(;o.length;){if(c++===a)throw new is(a);let u=o.shift(),{type:f,object:h}=await Ge({fs:t,cache:e,gitdir:n,oid:u});if(f!=="commit")throw new kt(u,f,"commit");let d=Rt.from(h).parse();for(let p of d.parent)if(p===i)return!0;if(!s.has(u))for(let p of d.parent)l.has(p)||(o.push(p),l.add(p))}return!1}async function s8({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,ancestor:i,depth:a=-1,cache:s={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),F("ancestor",i),await G1({fs:new Q(t),cache:s,gitdir:n,oid:r,ancestor:i,depth:a})}catch(o){throw o.caller="git.isDescendent",o}}async function o8({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r}){try{return F("fs",t),F("dir",e),F("gitdir",n),F("filepath",r),Ii.isIgnored({fs:new Q(t),dir:e,gitdir:n,filepath:r})}catch(i){throw i.caller="git.isIgnored",i}}async function l8({fs:t,dir:e,gitdir:n=B(e,".git"),remote:r}){try{return F("fs",t),F("gitdir",n),q.listBranches({fs:new Q(t),gitdir:n,remote:r})}catch(i){throw i.caller="git.listBranches",i}}async function c8({fs:t,gitdir:e,ref:n,cache:r}){if(n){let i=await q.resolve({gitdir:e,fs:t,ref:n}),a=[];return await V1({fs:t,cache:r,gitdir:e,oid:i,filenames:a,prefix:""}),a}else return lt.acquire({fs:t,gitdir:e,cache:r},async function(i){return i.entries.map(a=>a.path)})}async function V1({fs:t,cache:e,gitdir:n,oid:r,filenames:i,prefix:a}){let{tree:s}=await Di({fs:t,cache:e,gitdir:n,oid:r});for(let o of s)o.type==="tree"?await V1({fs:t,cache:e,gitdir:n,oid:o.oid,filenames:i,prefix:B(a,o.path)}):i.push(B(a,o.path))}async function u8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),await c8({fs:new Q(t),cache:i,gitdir:n,ref:r})}catch(a){throw a.caller="git.listFiles",a}}async function f8({fs:t,cache:e,gitdir:n,ref:r}){let i;try{i=await q.resolve({gitdir:n,fs:t,ref:r})}catch(o){if(o instanceof Re)return[]}return(await Di({fs:t,cache:e,gitdir:n,oid:i})).tree.map(o=>({target:o.path,note:o.oid}))}async function h8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r="refs/notes/commits",cache:i={}}){try{return F("fs",t),F("gitdir",n),F("ref",r),await f8({fs:new Q(t),cache:i,gitdir:n,ref:r})}catch(a){throw a.caller="git.listNotes",a}}async function d8({fs:t,gitdir:e}){let n=await ze.get({fs:t,gitdir:e}),r=await n.getSubsections("remote");return Promise.all(r.map(async a=>{let s=await n.get(`remote.${a}.url`);return{remote:a,url:s}}))}async function p8({fs:t,dir:e,gitdir:n=B(e,".git")}){try{return F("fs",t),F("gitdir",n),await d8({fs:new Q(t),gitdir:n})}catch(r){throw r.caller="git.listRemotes",r}}async function m8(t){let e=Ue.streamReader(t),n=[],r;for(;r=await e(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let[i,a,...s]=r.split(" "),o={ref:a,oid:i};for(let l of s){let[c,u]=l.split(":");c==="symref-target"?o.target=u:c==="peeled"&&(o.peeled=u)}n.push(o)}return n}async function g8({prefix:t,symrefs:e,peelTags:n}){let r=[];return r.push(Ue.encode(`command=ls-refs `)),r.push(Ue.encode(`agent=${Ko.agent} `)),(n||e||t)&&r.push(Ue.delim()),n&&r.push(Ue.encode("peel")),e&&r.push(Ue.encode("symrefs")),t&&r.push(Ue.encode(`ref-prefix ${t}`)),r.push(Ue.flush()),r}async function y8({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{F("http",t),F("url",a);let h=await Li.discover({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:l});if(h.protocolVersion===1)return z1(h,c,u,f);let d=await g8({prefix:c,symrefs:u,peelTags:f}),p=await Li.connect({http:t,auth:h.auth,headers:s,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,body:d});return m8(p.body)}catch(h){throw h.caller="git.listServerRefs",h}}async function v8({fs:t,dir:e,gitdir:n=B(e,".git")}){try{return F("fs",t),F("gitdir",n),q.listTags({fs:new Q(t),gitdir:n})}catch(r){throw r.caller="git.listTags",r}}function w8(t,e){return t.committer.timestamp-e.committer.timestamp}var b8="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function y1({fs:t,cache:e,gitdir:n,oid:r,fileId:i}){if(i===b8)return;let a=r,s,o=await Oi({fs:t,cache:e,gitdir:n,oid:r}),l=o.tree;return i===o.oid?s=o.path:(s=await W1({fs:t,cache:e,gitdir:n,tree:l,fileId:i,oid:a}),Array.isArray(s)&&(s.length===0?s=void 0:s.length===1&&(s=s[0]))),s}async function W1({fs:t,cache:e,gitdir:n,tree:r,fileId:i,oid:a,filepaths:s=[],parentPath:o=""}){let l=r.entries().map(function(c){let u;return c.oid===i?(u=B(o,c.path),s.push(u)):c.type==="tree"&&(u=Ge({fs:t,cache:e,gitdir:n,oid:c.oid}).then(function({object:f}){return W1({fs:t,cache:e,gitdir:n,tree:It.from(f),fileId:i,oid:a,filepaths:s,parentPath:B(o,c.path)})})),u});return await Promise.all(l),s}async function x8({fs:t,cache:e,gitdir:n,filepath:r,ref:i,depth:a,since:s,force:o,follow:l}){let c=typeof s=="undefined"?void 0:Math.floor(s.valueOf()/1e3),u=[],f=await Ur.read({fs:t,gitdir:n}),h=await q.resolve({fs:t,gitdir:n,ref:i}),d=[await Uo({fs:t,cache:e,gitdir:n,oid:h})],p,g,m;function w(b){m&&r&&u.push(b)}for(;d.length>0;){let b=d.pop();if(c!==void 0&&b.commit.committer.timestamp<=c)break;if(r){let S;try{S=await ds({fs:t,cache:e,gitdir:n,oid:b.commit.tree,filepath:r}),g&&p!==S&&u.push(g),p=S,g=b,m=!0}catch(k){if(k instanceof Re){let x=l&&p;if(x&&(x=await y1({fs:t,cache:e,gitdir:n,oid:b.commit.tree,fileId:p}),x))if(Array.isArray(x)){if(g){let A=await y1({fs:t,cache:e,gitdir:n,oid:g.commit.tree,fileId:p});if(Array.isArray(A))if(x=x.filter(y=>A.indexOf(y)===-1),x.length===1)x=x[0],r=x,g&&u.push(g);else{x=!1,g&&u.push(g);break}}}else r=x,g&&u.push(g);if(!x){if(m&&p&&(u.push(g),!o))break;if(!o&&!l)throw k}g=b,m=!1}else throw k}}else u.push(b);if(a!==void 0&&u.length===a){w(b);break}if(!f.has(b.oid))for(let S of b.commit.parent){let k=await Uo({fs:t,cache:e,gitdir:n,oid:S});d.map(x=>x.oid).includes(k.oid)||d.push(k)}d.length===0&&w(b),d.sort((S,k)=>w8(S.commit,k.commit))}return u}async function _8({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,ref:i="HEAD",depth:a,since:s,force:o,follow:l,cache:c={}}){try{return F("fs",t),F("gitdir",n),F("ref",i),await x8({fs:new Q(t),cache:c,gitdir:n,filepath:r,ref:i,depth:a,since:s,force:o,follow:l})}catch(u){throw u.caller="git.log",u}}async function S8({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:h,committer:d,signingKey:p,cache:g={},mergeDriver:m}){try{F("fs",t),p&&F("onSign",e);let w=new Q(t),b=await Hr({fs:w,gitdir:r,author:h});if(!b&&(!o||!s))throw new At("author");let S=await Ri({fs:w,gitdir:r,author:b,committer:d});if(!S&&(!o||!s))throw new At("committer");return await $1({fs:w,cache:g,dir:n,gitdir:r,ours:i,theirs:a,fastForward:s,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:b,committer:S,signingKey:p,onSign:e,mergeDriver:m})}catch(w){throw w.caller="git.merge",w}}var E8={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function q1({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),oids:i}){let a=new Nf.default,s=[];function o(u,f){let h=Buffer.from(u,f);s.push(h),a.update(h)}async function l({stype:u,object:f}){let h=E8[u],d=f.length,p=d>15?128:0,g=d&15;d=d>>>4;let m=(p|h|g).toString(16);for(o(m,"hex");p;)p=d>127?128:0,m=p|d&127,o(Bf(2,m),"hex"),d=d>>>7;o(Buffer.from(await F1(f)))}o("PACK"),o("00000002","hex"),o(Bf(8,i.length),"hex");for(let u of i){let{type:f,object:h}=await Ge({fs:t,cache:e,gitdir:r,oid:u});await l({write:o,object:h,stype:f})}let c=a.digest();return s.push(c),s}async function k8({fs:t,cache:e,gitdir:n,oids:r,write:i}){let a=await q1({fs:t,cache:e,gitdir:n,oids:r}),s=Buffer.from(await zo(a)),l=`pack-${s.slice(-20).toString("hex")}.pack`;return i?(await t.write(B(n,`objects/pack/${l}`),s),{filename:l}):{filename:l,packfile:new Uint8Array(s)}}async function A8({fs:t,dir:e,gitdir:n=B(e,".git"),oids:r,write:i=!1,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("oids",r),await k8({fs:new Q(t),cache:a,gitdir:n,oids:r,write:i})}catch(s){throw s.caller="git.packObjects",s}}async function T8({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l=B(o,".git"),ref:c,url:u,remote:f,remoteRef:h,prune:d=!1,pruneTags:p=!1,fastForward:g=!0,fastForwardOnly:m=!1,corsProxy:w,singleBranch:b,headers:S={},author:k,committer:x,signingKey:A,cache:y={}}){try{F("fs",t),F("gitdir",l);let E=new Q(t),_=await Hr({fs:E,gitdir:l,author:k});if(!_)throw new At("author");let C=await Ri({fs:E,gitdir:l,author:_,committer:x});if(!C)throw new At("committer");return await H1({fs:E,cache:y,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,dir:o,gitdir:l,ref:c,url:u,remote:f,remoteRef:h,fastForward:g,fastForwardOnly:m,corsProxy:w,singleBranch:b,headers:S,author:_,committer:C,signingKey:A,prune:d,pruneTags:p})}catch(E){throw E.caller="git.pull",E}}async function C8({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),start:i,finish:a}){let s=await Ur.read({fs:t,gitdir:r}),o=new Set,l=new Set;for(let f of i)o.add(await q.resolve({fs:t,gitdir:r,ref:f}));for(let f of a)try{let h=await q.resolve({fs:t,gitdir:r,ref:f});l.add(h)}catch(h){}let c=new Set;async function u(f){c.add(f);let{type:h,object:d}=await Ge({fs:t,cache:e,gitdir:r,oid:f});if(h==="tag"){let g=Ut.from(d).headers().object;return u(g)}if(h!=="commit")throw new kt(f,h,"commit");if(!s.has(f)){let g=Rt.from(d).headers().parent;for(f of g)!l.has(f)&&!c.has(f)&&await u(f)}}for(let f of o)await u(f);return c}async function Af({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),oids:i}){let a=new Set;async function s(o){if(a.has(o))return;a.add(o);let{type:l,object:c}=await Ge({fs:t,cache:e,gitdir:r,oid:o});if(l==="tag"){let f=Ut.from(c).headers().object;await s(f)}else if(l==="commit"){let f=Rt.from(c).headers().tree;await s(f)}else if(l==="tree"){let u=It.from(c);for(let f of u)f.type==="blob"&&a.add(f.oid),f.type==="tree"&&await s(f.oid)}}for(let o of i)await s(o);return a}async function F8(t){let e={},n="",r=Ue.streamReader(t),i=await r();for(;i!==!0;)i!==null&&(n+=i.toString("utf8")+` `),i=await r();let a=n.toString("utf8").split(` `);if(i=a.shift(),!i.startsWith("unpack "))throw new $r('unpack ok" or "unpack [error message]',i);e.ok=i==="unpack ok",e.ok||(e.error=i.slice(7)),e.refs={};for(let s of a){if(s.trim()==="")continue;let o=s.slice(0,2),l=s.slice(3),c=l.indexOf(" ");c===-1&&(c=l.length);let u=l.slice(0,c),f=l.slice(c+1);e.refs[u]={ok:o==="ok",error:f}}return e}async function M8({capabilities:t=[],triplets:e=[]}){let n=[],r=`\0 ${t.join(" ")}`;for(let i of e)n.push(Ue.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${r} `)),r="";return n.push(Ue.flush()),n}async function O8({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:h,url:d,force:p=!1,delete:g=!1,corsProxy:m,headers:w={}}){let b=u||await zr({fs:t,gitdir:c});if(typeof b=="undefined")throw new Pt("ref");let S=await ze.get({fs:t,gitdir:c});h=h||await S.get(`branch.${b}.pushRemote`)||await S.get("remote.pushDefault")||await S.get(`branch.${b}.remote`)||"origin";let k=d||await S.get(`remote.${h}.pushurl`)||await S.get(`remote.${h}.url`);if(typeof k=="undefined")throw new Pt("remote OR url");let x=f||await S.get(`branch.${b}.merge`);if(typeof k=="undefined")throw new Pt("remoteRef");m===void 0&&(m=await S.get("http.corsProxy"));let A=await q.expand({fs:t,gitdir:c,ref:b}),y=g?"0000000000000000000000000000000000000000":await q.resolve({fs:t,gitdir:c,ref:A}),E=ji.getRemoteHelperFor({url:k}),_=await E.discover({http:n,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:m,service:"git-receive-pack",url:k,headers:w,protocolVersion:1}),C=_.auth,M;if(!x)M=A;else try{M=await q.expandAgainstMap({ref:x,map:_.refs})}catch(G){if(G instanceof Re)M=x.startsWith("refs/")?x:`refs/heads/${x}`;else throw G}let L=_.refs.get(M)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:h,url:k,localRef:{ref:g?"(delete)":A,oid:y},remoteRef:{ref:M,oid:L}}))throw new Mi;let N=!_.capabilities.has("no-thin"),j=new Set;if(!g){let G=[..._.refs.values()],D=new Set;if(L!=="0000000000000000000000000000000000000000"){let se=await Gf({fs:t,cache:e,gitdir:c,oids:[y,L]});for(let Se of se)G.push(Se);N&&(D=await Af({fs:t,cache:e,gitdir:c,oids:se}))}if(!G.includes(y)){let se=await C8({fs:t,cache:e,gitdir:c,start:[y],finish:G});j=await Af({fs:t,cache:e,gitdir:c,oids:se})}if(N){try{let se=await q.resolve({fs:t,gitdir:c,ref:`refs/remotes/${h}/HEAD`,depth:2}),{oid:Se}=await q.resolveAgainstMap({ref:se.replace(`refs/remotes/${h}/`,""),fullref:se,map:_.refs}),mt=[Se];for(let be of await Af({fs:t,cache:e,gitdir:c,oids:mt}))D.add(be)}catch(se){}for(let se of D)j.delete(se)}if(y===L&&(p=!0),!p){if(A.startsWith("refs/tags")&&L!=="0000000000000000000000000000000000000000")throw new Fi("tag-exists");if(y!=="0000000000000000000000000000000000000000"&&L!=="0000000000000000000000000000000000000000"&&!await G1({fs:t,cache:e,gitdir:c,oid:y,ancestor:L,depth:-1}))throw new Fi("not-fast-forward")}}let Y=D1([..._.capabilities],["report-status","side-band-64k",`agent=${Ko.agent}`]),le=await M8({capabilities:Y,triplets:[{oldoid:L,oid:y,fullRef:M}]}),he=g?[]:await q1({fs:t,cache:e,gitdir:c,oids:[...j]}),ie=await E.connect({http:n,onProgress:r,corsProxy:m,service:"git-receive-pack",url:k,auth:C,headers:w,body:[...le,...he]}),{packfile:Me,progress:de}=await Go.demux(ie.body);if(i){let G=B1(de);ps(G,async D=>{await i(D)})}let $=await F8(Me);if(ie.headers&&($.headers=ie.headers),h&&$.ok&&$.refs[M].ok&&!A.startsWith("refs/tags")){let G=`refs/remotes/${h}/${M.replace("refs/heads","")}`;g?await q.deleteRef({fs:t,gitdir:c,ref:G}):await q.writeRef({fs:t,gitdir:c,ref:G,value:y})}if($.ok&&Object.values($.refs).every(G=>G.ok))return $;{let G=Object.entries($.refs).filter(([D,se])=>!se.ok).map(([D,se])=>` - ${D}: ${se.error}`).join("");throw new rs(G,$)}}async function P8({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,dir:l,gitdir:c=B(l,".git"),ref:u,remoteRef:f,remote:h="origin",url:d,force:p=!1,delete:g=!1,corsProxy:m,headers:w={},cache:b={}}){try{return F("fs",t),F("http",e),F("gitdir",c),await O8({fs:new Q(t),cache:b,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,gitdir:c,ref:u,remoteRef:f,remote:h,url:d,force:p,delete:g,corsProxy:m,headers:w})}catch(S){throw S.caller="git.push",S}}async function X1({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:a}=await Ge({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=Ut.from(a).parse().object,X1({fs:t,cache:e,gitdir:n,oid:r});if(i!=="blob")throw new kt(r,i,"blob");return{oid:r,blob:new Uint8Array(a)}}async function Y1({fs:t,cache:e,gitdir:n,oid:r,filepath:i=void 0}){return i!==void 0&&(r=await ds({fs:t,cache:e,gitdir:n,oid:r,filepath:i})),await X1({fs:t,cache:e,gitdir:n,oid:r})}async function ms({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,filepath:i,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await Y1({fs:new Q(t),cache:a,gitdir:n,oid:r,filepath:i})}catch(s){throw s.caller="git.readBlob",s}}async function I8({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await Uo({fs:new Q(t),cache:i,gitdir:n,oid:r})}catch(a){throw a.caller="git.readCommit",a}}async function R8({fs:t,cache:e,gitdir:n,ref:r="refs/notes/commits",oid:i}){let a=await q.resolve({gitdir:n,fs:t,ref:r}),{blob:s}=await Y1({fs:t,cache:e,gitdir:n,oid:a,filepath:i});return s}async function L8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r="refs/notes/commits",oid:i,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("ref",r),F("oid",i),await R8({fs:new Q(t),cache:a,gitdir:n,ref:r,oid:i})}catch(s){throw s.caller="git.readNote",s}}async function j8({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,format:i="parsed",filepath:a=void 0,encoding:s=void 0,cache:o={}}){try{F("fs",t),F("gitdir",n),F("oid",r);let l=new Q(t);a!==void 0&&(r=await ds({fs:l,cache:o,gitdir:n,oid:r,filepath:a}));let u=await Ge({fs:l,cache:o,gitdir:n,oid:r,format:i==="parsed"?"content":i});if(u.oid=r,i==="parsed")switch(u.format="parsed",u.type){case"commit":u.object=Rt.from(u.object).parse();break;case"tree":u.object=It.from(u.object).entries();break;case"blob":s?u.object=u.object.toString(s):(u.object=new Uint8Array(u.object),u.format="content");break;case"tag":u.object=Ut.from(u.object).parse();break;default:throw new kt(u.oid,u.type,"blob|commit|tag|tree")}else(u.format==="deflated"||u.format==="wrapped")&&(u.type=u.format);return u}catch(l){throw l.caller="git.readObject",l}}async function D8({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:a}=await Ge({fs:t,cache:e,gitdir:n,oid:r,format:"content"});if(i!=="tag")throw new kt(r,i,"tag");let s=Ut.from(a);return{oid:r,tag:s.parse(),payload:s.payload()}}async function B8({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await D8({fs:new Q(t),cache:i,gitdir:n,oid:r})}catch(a){throw a.caller="git.readTag",a}}async function N8({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,filepath:i=void 0,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await Di({fs:new Q(t),cache:a,gitdir:n,oid:r,filepath:i})}catch(s){throw s.caller="git.readTree",s}}async function $8({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,cache:i={}}){try{F("fs",t),F("gitdir",n),F("filepath",r),await lt.acquire({fs:new Q(t),gitdir:n,cache:i},async function(a){a.delete({filepath:r})})}catch(a){throw a.caller="git.remove",a}}async function H8({fs:t,cache:e,onSign:n,gitdir:r,ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l}){let c;try{c=await q.resolve({gitdir:r,fs:t,ref:i})}catch(p){if(!(p instanceof Re))throw p}let f=(await Di({fs:t,gitdir:r,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==a);let h=await Hf({fs:t,gitdir:r,tree:f});return await Zo({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tree:h,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote' `,author:s,committer:o,signingKey:l})}async function U8({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l,cache:c={}}){try{F("fs",t),F("gitdir",r),F("oid",a);let u=new Q(t),f=await Hr({fs:u,gitdir:r,author:s});if(!f)throw new At("author");let h=await Ri({fs:u,gitdir:r,author:f,committer:o});if(!h)throw new At("committer");return await H8({fs:u,cache:c,onSign:e,gitdir:r,ref:i,oid:a,author:f,committer:h,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function z8({fs:t,gitdir:e,oldref:n,ref:r,checkout:i=!1}){if(r!==fn.default.clean(r))throw new zn(r,fn.default.clean(r));if(n!==fn.default.clean(n))throw new zn(n,fn.default.clean(n));let a=`refs/heads/${n}`,s=`refs/heads/${r}`;if(await q.exists({fs:t,gitdir:e,ref:s}))throw new hn("branch",r,!1);let l=await q.resolve({fs:t,gitdir:e,ref:a,depth:1});await q.writeRef({fs:t,gitdir:e,ref:s,value:l}),await q.deleteRef({fs:t,gitdir:e,ref:a});let u=await zr({fs:t,gitdir:e,fullname:!0})===a;(i||u)&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function G8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,oldref:i,checkout:a=!1}){try{return F("fs",t),F("gitdir",n),F("ref",r),F("oldref",i),await z8({fs:new Q(t),gitdir:n,ref:r,oldref:i,checkout:a})}catch(s){throw s.caller="git.renameBranch",s}}async function Z1({gitdir:t,type:e,object:n}){return Un(lr.wrap({type:e,object:n}))}async function V8({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,ref:i,cache:a={}}){try{F("fs",t),F("gitdir",n),F("filepath",r);let s=new Q(t),o,l;try{o=await q.resolve({fs:s,gitdir:n,ref:i||"HEAD"})}catch(f){if(i)throw f}if(o)try{o=await ds({fs:s,cache:a,gitdir:n,oid:o,filepath:r})}catch(f){o=null}let c={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},u=e&&await s.read(B(e,r));u&&(l=await Z1({gitdir:n,type:"blob",object:u}),o===l&&(c=await s.lstat(B(e,r)))),await lt.acquire({fs:s,gitdir:n,cache:a},async function(f){f.delete({filepath:r}),o&&f.insert({filepath:r,stats:c,oid:o})})}catch(s){throw s.caller="git.reset",s}}async function W8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,depth:i}){try{return F("fs",t),F("gitdir",n),F("ref",r),await q.resolve({fs:new Q(t),gitdir:n,ref:r,depth:i})}catch(a){throw a.caller="git.resolveRef",a}}async function q8({fs:t,dir:e,gitdir:n=B(e,".git"),path:r,value:i,append:a=!1}){try{F("fs",t),F("gitdir",n),F("path",r);let s=new Q(t),o=await ze.get({fs:s,gitdir:n});a?await o.append(r,i):await o.set(r,i),await ze.save({fs:s,gitdir:n,config:o})}catch(s){throw s.caller="git.setConfig",s}}async function X8({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,cache:i={}}){try{F("fs",t),F("gitdir",n),F("filepath",r);let a=new Q(t);if(await Ii.isIgnored({fs:a,gitdir:n,dir:e,filepath:r}))return"ignored";let o=await Y8({fs:a,cache:i,gitdir:n}),l=await K1({fs:a,cache:i,gitdir:n,tree:o,path:r}),c=await lt.acquire({fs:a,gitdir:n,cache:i},async function(g){for(let m of g)if(m.path===r)return m;return null}),u=await a.lstat(B(e,r)),f=l!==null,h=c!==null,d=u!==null,p=async()=>{if(h&&!Lo(c,u))return c.oid;{let g=await a.read(B(e,r)),m=await Z1({gitdir:n,type:"blob",object:g});return h&&c.oid===m&&u.size!==-1&<.acquire({fs:a,gitdir:n,cache:i},async function(w){w.insert({filepath:r,stats:u,oid:m})}),m}};if(!f&&!d&&!h)return"absent";if(!f&&!d&&h)return"*absent";if(!f&&d&&!h)return"*added";if(!f&&d&&h)return await p()===c.oid?"added":"*added";if(f&&!d&&!h)return"deleted";if(f&&!d&&h)return l===c.oid,"*deleted";if(f&&d&&!h)return await p()===l?"*undeleted":"*undeletemodified";if(f&&d&&h){let g=await p();return g===l?g===c.oid?"unmodified":"*unmodified":g===c.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function K1({fs:t,cache:e,gitdir:n,tree:r,path:i}){typeof i=="string"&&(i=i.split("/"));let a=i.shift();for(let s of r)if(s.path===a){if(i.length===0)return s.oid;let{type:o,object:l}=await Ge({fs:t,cache:e,gitdir:n,oid:s.oid});if(o==="tree"){let c=It.from(l);return K1({fs:t,cache:e,gitdir:n,tree:c,path:i})}if(o==="blob")throw new kt(s.oid,o,"blob",i.join("/"))}return null}async function Y8({fs:t,cache:e,gitdir:n}){let r;try{r=await q.resolve({fs:t,gitdir:n,ref:"HEAD"})}catch(a){if(a instanceof Re)return[]}let{tree:i}=await Di({fs:t,cache:e,gitdir:n,oid:r});return i}async function Z8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r="HEAD",filepaths:i=["."],filter:a,cache:s={},ignored:o=!1}){try{F("fs",t),F("gitdir",n),F("ref",r);let l=new Q(t);return await Pi({fs:l,cache:s,dir:e,gitdir:n,trees:[sr({ref:r}),Yo(),Xo()],map:async function(c,[u,f,h]){if(!u&&!h&&f&&!o&&await Ii.isIgnored({fs:l,dir:e,filepath:c})||!i.some(A=>L1(c,A)))return null;if(a&&!a(c))return;let[d,p,g]=await Promise.all([u&&u.type(),f&&f.type(),h&&h.type()]),m=[d,p,g].includes("blob");if((d==="tree"||d==="special")&&!m)return;if(d==="commit")return null;if((p==="tree"||p==="special")&&!m)return;if(g==="commit")return null;if((g==="tree"||g==="special")&&!m)return;let w=d==="blob"?await u.oid():void 0,b=g==="blob"?await h.oid():void 0,S;d!=="blob"&&p==="blob"&&g!=="blob"?S="42":p==="blob"&&(S=await f.oid());let k=[void 0,w,S,b],x=k.map(A=>k.indexOf(A));return x.shift(),[c,...x]}})}catch(l){throw l.caller="git.statusMatrix",l}}async function K8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,object:i,force:a=!1}){try{F("fs",t),F("gitdir",n),F("ref",r);let s=new Q(t);if(r===void 0)throw new Pt("ref");r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`;let o=await q.resolve({fs:s,gitdir:n,ref:i||"HEAD"});if(!a&&await q.exists({fs:s,gitdir:n,ref:r}))throw new hn("tag",r);await q.writeRef({fs:s,gitdir:n,ref:r,value:o})}catch(s){throw s.caller="git.tag",s}}async function J8({fs:t,dir:e,gitdir:n=B(e,".git"),cache:r={},filepath:i,oid:a,mode:s,add:o,remove:l,force:c}){try{F("fs",t),F("gitdir",n),F("filepath",i);let u=new Q(t);if(l)return await lt.acquire({fs:u,gitdir:n,cache:r},async function(h){let d;if(!c&&(d=await u.lstat(B(e,i)),d)){if(d.isDirectory())throw new cr("directory");return}h.has({filepath:i})&&h.delete({filepath:i})});let f;if(!a){if(f=await u.lstat(B(e,i)),!f)throw new Re(`file at "${i}" on disk and "remove" not set`);if(f.isDirectory())throw new cr("directory")}return await lt.acquire({fs:u,gitdir:n,cache:r},async function(h){if(!o&&!h.has({filepath:i}))throw new Re(`file at "${i}" in index and "add" not set`);let d={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:s,uid:0,gid:0,size:0};if(!a){d=f;let p=d.isSymbolicLink()?await u.readlink(B(e,i)):await u.read(B(e,i));a=await zt({fs:u,gitdir:n,type:"blob",format:"content",object:p})}return h.insert({filepath:i,oid:a,stats:d}),a})}catch(u){throw u.caller="git.updateIndex",u}}function Q8(){try{return Ko.version}catch(t){throw t.caller="git.version",t}}async function e6({fs:t,dir:e,gitdir:n=B(e,".git"),trees:r,map:i,reduce:a,iterate:s,cache:o={}}){try{return F("fs",t),F("gitdir",n),F("trees",r),await Pi({fs:new Q(t),cache:o,dir:e,gitdir:n,trees:r,map:i,reduce:a,iterate:s})}catch(l){throw l.caller="git.walk",l}}async function t6({fs:t,dir:e,gitdir:n=B(e,".git"),blob:r}){try{return F("fs",t),F("gitdir",n),F("blob",r),await zt({fs:new Q(t),gitdir:n,type:"blob",object:r,format:"content"})}catch(i){throw i.caller="git.writeBlob",i}}async function n6({fs:t,gitdir:e,commit:n}){let r=Rt.from(n).toObject();return await zt({fs:t,gitdir:e,type:"commit",object:r,format:"content"})}async function r6({fs:t,dir:e,gitdir:n=B(e,".git"),commit:r}){try{return F("fs",t),F("gitdir",n),F("commit",r),await n6({fs:new Q(t),gitdir:n,commit:r})}catch(i){throw i.caller="git.writeCommit",i}}async function i6({fs:t,dir:e,gitdir:n=B(e,".git"),type:r,object:i,format:a="parsed",oid:s,encoding:o=void 0}){try{let l=new Q(t);if(a==="parsed"){switch(r){case"commit":i=Rt.from(i).toObject();break;case"tree":i=It.from(i).toObject();break;case"blob":i=Buffer.from(i,o);break;case"tag":i=Ut.from(i).toObject();break;default:throw new kt(s||"",r,"blob|commit|tag|tree")}a="content"}return s=await zt({fs:l,gitdir:n,type:r,object:i,oid:s,format:a}),s}catch(l){throw l.caller="git.writeObject",l}}async function a6({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,value:i,force:a=!1,symbolic:s=!1}){try{F("fs",t),F("gitdir",n),F("ref",r),F("value",i);let o=new Q(t);if(r!==fn.default.clean(r))throw new zn(r,fn.default.clean(r));if(!a&&await q.exists({fs:o,gitdir:n,ref:r}))throw new hn("ref",r);s?await q.writeSymbolicRef({fs:o,gitdir:n,ref:r,value:i}):(i=await q.resolve({fs:o,gitdir:n,ref:i}),await q.writeRef({fs:o,gitdir:n,ref:r,value:i}))}catch(o){throw o.caller="git.writeRef",o}}async function s6({fs:t,gitdir:e,tag:n}){let r=Ut.from(n).toObject();return await zt({fs:t,gitdir:e,type:"tag",object:r,format:"content"})}async function o6({fs:t,dir:e,gitdir:n=B(e,".git"),tag:r}){try{return F("fs",t),F("gitdir",n),F("tag",r),await s6({fs:new Q(t),gitdir:n,tag:r})}catch(i){throw i.caller="git.writeTag",i}}async function l6({fs:t,dir:e,gitdir:n=B(e,".git"),tree:r}){try{return F("fs",t),F("gitdir",n),F("tree",r),await Hf({fs:new Q(t),gitdir:n,tree:r})}catch(i){throw i.caller="git.writeTree",i}}var c6={Errors:hs,STAGE:Xo,TREE:sr,WORKDIR:Yo,add:lC,abortMerge:rC,addNote:uC,addRemote:fC,annotatedTag:dC,branch:mC,checkout:yC,clone:CC,commit:FC,getConfig:ZC,getConfigAll:JC,setConfig:q8,currentBranch:MC,deleteBranch:PC,deleteRef:IC,deleteRemote:LC,deleteTag:DC,expandOid:HC,expandRef:UC,fastForward:WC,fetch:qC,findMergeBase:XC,findRoot:YC,getRemoteInfo:QC,getRemoteInfo2:e8,hashBlob:n8,indexPack:i8,init:a8,isDescendent:s8,isIgnored:o8,listBranches:l8,listFiles:u8,listNotes:h8,listRemotes:p8,listServerRefs:y8,listTags:v8,log:_8,merge:S8,packObjects:A8,pull:T8,push:P8,readBlob:ms,readCommit:I8,readNote:L8,readObject:j8,readTag:B8,readTree:N8,remove:$8,removeNote:U8,renameBranch:G8,resetIndex:V8,updateIndex:J8,resolveRef:W8,status:X8,statusMatrix:Z8,tag:K8,version:Q8,walk:e6,writeBlob:t6,writeCommit:r6,writeObject:i6,writeRef:a6,writeTag:o6,writeTree:l6},ae=c6;var _e=require("obsidian");v();var ti=require("obsidian");v();var RS=require("child_process"),LS=Ze(el()),Jr=require("obsidian"),vt=Ze(require("path")),Hs=require("path");v();var pl=Ze(ry(),1),ul=Ze(el(),1),Fv=require("child_process"),hw=Ze(Wf(),1),Ui=Ze(Wf(),1),Bw=require("node:events"),hl=Object.defineProperty,C6=Object.defineProperties,F6=Object.getOwnPropertyDescriptor,M6=Object.getOwnPropertyDescriptors,hh=Object.getOwnPropertyNames,iy=Object.getOwnPropertySymbols,Dy=Object.prototype.hasOwnProperty,O6=Object.prototype.propertyIsEnumerable,ay=(t,e,n)=>e in t?hl(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,tn=(t,e)=>{for(var n in e||(e={}))Dy.call(e,n)&&ay(t,n,e[n]);if(iy)for(var n of iy(e))O6.call(e,n)&&ay(t,n,e[n]);return t},vs=(t,e)=>C6(t,M6(e)),W=(t,e)=>function(){return t&&(e=(0,t[hh(t)[0]])(t=0)),e},P6=(t,e)=>function(){return e||(0,t[hh(t)[0]])((e={exports:{}}).exports,e),e.exports},Qe=(t,e)=>{for(var n in e)hl(t,n,{get:e[n],enumerable:!0})},I6=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of hh(e))!Dy.call(t,i)&&i!==n&&hl(t,i,{get:()=>e[i],enumerable:!(r=F6(e,i))||r.enumerable});return t},We=t=>I6(hl({},"__esModule",{value:!0}),t),ys=(t,e,n)=>new Promise((r,i)=>{var a=l=>{try{o(n.next(l))}catch(c){i(c)}},s=l=>{try{o(n.throw(l))}catch(c){i(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(a,s);o((n=n.apply(t,e)).next())});function R6(...t){let e=new String(t);return dl.set(e,t),e}function ll(t){return t instanceof String&&dl.has(t)}function sy(t){return dl.get(t)||[]}var dl,_s=W({"src/lib/args/pathspec.ts"(){"use strict";dl=new WeakMap}}),dn,fr=W({"src/lib/errors/git-error.ts"(){"use strict";dn=class extends Error{constructor(t,e){super(e),this.task=t,Object.setPrototypeOf(this,new.target.prototype)}}}}),Ss,Gi=W({"src/lib/errors/git-response-error.ts"(){"use strict";fr(),Ss=class extends dn{constructor(t,e){super(void 0,e||String(t)),this.git=t}}}}),By,Ny=W({"src/lib/errors/task-configuration-error.ts"(){"use strict";fr(),By=class extends dn{constructor(t){super(void 0,t)}}}});function $y(t){return typeof t=="function"?t:Xr}function Hy(t){return typeof t=="function"&&t!==Xr}function Uy(t,e){let n=t.indexOf(e);return n<=0?[t,""]:[t.substr(0,n),t.substr(n+1)]}function zy(t,e=0){return Gy(t)&&t.length>e?t[e]:void 0}function qr(t,e=0){if(Gy(t)&&t.length>e)return t[t.length-1-e]}function Gy(t){return!!(t&&typeof t.length=="number")}function Es(t="",e=!0,n=` `){return t.split(n).reduce((r,i)=>{let a=e?i.trim():i;return a&&r.push(a),r},[])}function dh(t,e){return Es(t,!0).map(n=>e(n))}function ph(t){return(0,pl.exists)(t,pl.FOLDER)}function we(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function Vy(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function ml(t,e){if(Array.isArray(t)){let n=t.indexOf(e);n>=0&&t.splice(n,1)}else t.delete(e);return e}function Cn(t){return Array.isArray(t)?t:[t]}function Wy(t){return t.replace(/[\s-]+(.)/g,(e,n)=>n.toUpperCase())}function qy(t){return Cn(t).map(String)}function Pe(t,e=0){if(t==null)return e;let n=parseInt(t,10);return isNaN(n)?e:n}function ws(t,e){let n=[];for(let r=0,i=t.length;rn in t?{[n]:t[n]}:{}))}function Qf(t=0){return new Promise(e=>setTimeout(e,t))}function eh(t){if(t!==!1)return t}var zi,Xr,ks,gl=W({"src/lib/utils/util.ts"(){"use strict";zi="\0",Xr=()=>{},ks=Object.prototype.toString.call.bind(Object.prototype.toString)}});function Fn(t,e,n){return e(t)?t:arguments.length>2?n:void 0}function mh(t,e){let n=ll(t)?"string":typeof t;return/number|string|boolean/.test(n)&&(!e||!e.includes(n))}function gh(t){return!!t&&ks(t)==="[object Object]"}function Yy(t){return typeof t=="function"}var As,gt,Zy,cl,yh,Ky=W({"src/lib/utils/argument-filters.ts"(){"use strict";gl(),_s(),As=t=>Array.isArray(t),gt=t=>typeof t=="string",Zy=t=>Array.isArray(t)&&t.every(gt),cl=t=>gt(t)||Array.isArray(t)&&t.every(gt),yh=t=>t==null||"number|boolean|function".includes(typeof t)?!1:Array.isArray(t)||typeof t=="string"||typeof t.length=="number"}}),th,L6=W({"src/lib/utils/exit-codes.ts"(){"use strict";th=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(th||{})}}),xs,j6=W({"src/lib/utils/git-output-streams.ts"(){"use strict";xs=class{constructor(t,e){this.stdOut=t,this.stdErr=e}asStrings(){return new xs(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}}),fe,ur,D6=W({"src/lib/utils/line-parser.ts"(){"use strict";fe=class{constructor(t,e){this.matches=[],this.parse=(n,r)=>(this.resetMatches(),this._regExp.every((i,a)=>this.addMatch(i,a,n(a)))?this.useMatches(r,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}useMatches(t,e){throw new Error("LineParser:useMatches not implemented")}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,n){let r=n&&t.exec(n);return r&&this.pushMatch(e,r),!!r}pushMatch(t,e){this.matches.push(...e.slice(1))}},ur=class extends fe{addMatch(t,e,n){return/^remote:\s/.test(String(n))&&super.addMatch(t,e,n)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function Jy(...t){let e=process.cwd(),n=Object.assign(tn({baseDir:e},Qy),...t.filter(r=>typeof r=="object"&&r));return n.baseDir=n.baseDir||e,n.trimmed=n.trimmed===!0,n}var Qy,B6=W({"src/lib/utils/simple-git-options.ts"(){"use strict";Qy={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function vh(t,e=[]){return gh(t)?Object.keys(t).reduce((n,r)=>{let i=t[r];return ll(i)?n.push(i):mh(i,["boolean"])?n.push(r+"="+i):n.push(r),n},e):e}function Lt(t,e=0,n=!1){let r=[];for(let i=0,a=e<0?t.length:e;i{for(let a=Es(i,r),s=0,o=a.length;s{if(!(s+c>=o))return a[s+c]};e.some(({parse:c})=>c(l,t))}}),t}var H6=W({"src/lib/utils/task-parser.ts"(){"use strict";gl()}}),ev={};Qe(ev,{ExitCodes:()=>th,GitOutputStreams:()=>xs,LineParser:()=>fe,NOOP:()=>Xr,NULL:()=>zi,RemoteLineParser:()=>ur,append:()=>we,appendTaskOptions:()=>vh,asArray:()=>Cn,asCamelCase:()=>Wy,asFunction:()=>$y,asNumber:()=>Pe,asStringArray:()=>qy,bufferToString:()=>bs,callTaskParser:()=>nh,createInstanceConfig:()=>Jy,delay:()=>Qf,filterArray:()=>As,filterFunction:()=>Yy,filterHasLength:()=>yh,filterPlainObject:()=>gh,filterPrimitives:()=>mh,filterString:()=>gt,filterStringArray:()=>Zy,filterStringOrStringArray:()=>cl,filterType:()=>Fn,first:()=>zy,folderExists:()=>ph,forEachLineWithContent:()=>dh,getTrailingOptions:()=>Lt,including:()=>Vy,isUserFunction:()=>Hy,last:()=>qr,objectToString:()=>ks,orVoid:()=>eh,parseStringResponse:()=>Dt,pick:()=>Xy,prefixedArray:()=>ws,remove:()=>ml,splitOn:()=>Uy,toLinesWithContent:()=>Es,trailingFunctionArgument:()=>qe,trailingOptionsArgument:()=>wh});var oe=W({"src/lib/utils/index.ts"(){"use strict";Ky(),L6(),j6(),D6(),B6(),$6(),H6(),gl()}}),tv={};Qe(tv,{CheckRepoActions:()=>rh,checkIsBareRepoTask:()=>rv,checkIsRepoRootTask:()=>nv,checkIsRepoTask:()=>U6});function U6(t){switch(t){case"bare":return rv();case"root":return nv()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:yl,parser:bh}}function nv(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:yl,parser(e){return/^\.(git)?$/.test(e.trim())}}}function rv(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:yl,parser:bh}}function z6(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var rh,yl,bh,iv=W({"src/lib/tasks/check-is-repo.ts"(){"use strict";oe(),rh=(t=>(t.BARE="bare",t.IN_TREE="tree",t.IS_REPO_ROOT="root",t))(rh||{}),yl=({exitCode:t},e,n,r)=>{if(t===128&&z6(e))return n(Buffer.from("false"));r(e)},bh=t=>t.trim()==="true"}});function G6(t,e){let n=new av(t),r=t?ov:sv;return Es(e).forEach(i=>{let a=i.replace(r,"");n.paths.push(a),(lv.test(a)?n.folders:n.files).push(a)}),n}var av,sv,ov,lv,V6=W({"src/lib/responses/CleanSummary.ts"(){"use strict";oe(),av=class{constructor(t){this.dryRun=t,this.paths=[],this.files=[],this.folders=[]}},sv=/^[a-z]+\s*/i,ov=/^[a-z]+\s+[a-z]+\s*/i,lv=/\/$/}}),ih={};Qe(ih,{EMPTY_COMMANDS:()=>vl,adhocExecTask:()=>cv,configurationErrorTask:()=>jt,isBufferTask:()=>fv,isEmptyTask:()=>hv,straightThroughBufferTask:()=>uv,straightThroughStringTask:()=>Tt});function cv(t){return{commands:vl,format:"empty",parser:t}}function jt(t){return{commands:vl,format:"empty",parser(){throw typeof t=="string"?new By(t):t}}}function Tt(t,e=!1){return{commands:t,format:"utf-8",parser(n){return e?String(n).trim():n}}}function uv(t){return{commands:t,format:"buffer",parser(e){return e}}}function fv(t){return t.format==="buffer"}function hv(t){return t.format==="empty"||!t.commands.length}var vl,Je=W({"src/lib/tasks/task.ts"(){"use strict";Ny(),vl=[]}}),dv={};Qe(dv,{CONFIG_ERROR_INTERACTIVE_MODE:()=>xh,CONFIG_ERROR_MODE_REQUIRED:()=>_h,CONFIG_ERROR_UNKNOWN_OPTION:()=>Sh,CleanOptions:()=>il,cleanTask:()=>pv,cleanWithOptionsTask:()=>W6,isCleanOptionsArray:()=>q6});function W6(t,e){let{cleanMode:n,options:r,valid:i}=X6(t);return n?i.options?(r.push(...e),r.some(K6)?jt(xh):pv(n,r)):jt(Sh+JSON.stringify(t)):jt(_h)}function pv(t,e){return{commands:["clean",`-${t}`,...e],format:"utf-8",parser(r){return G6(t==="n",r)}}}function q6(t){return Array.isArray(t)&&t.every(e=>Eh.has(e))}function X6(t){let e,n=[],r={cleanMode:!1,options:!0};return t.replace(/[^a-z]i/g,"").split("").forEach(i=>{Y6(i)?(e=i,r.cleanMode=!0):r.options=r.options&&Z6(n[n.length]=`-${i}`)}),{cleanMode:e,options:n,valid:r}}function Y6(t){return t==="f"||t==="n"}function Z6(t){return/^-[a-z]$/i.test(t)&&Eh.has(t.charAt(1))}function K6(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:t==="--interactive"}var xh,_h,Sh,il,Eh,mv=W({"src/lib/tasks/clean.ts"(){"use strict";V6(),oe(),Je(),xh="Git clean interactive mode is not supported",_h='Git clean mode parameter ("n" or "f") is required',Sh="Git clean unknown option found in: ",il=(t=>(t.DRY_RUN="n",t.FORCE="f",t.IGNORED_INCLUDED="x",t.IGNORED_ONLY="X",t.EXCLUDING="e",t.QUIET="q",t.RECURSIVE="d",t))(il||{}),Eh=new Set(["i",...qy(Object.values(il))])}});function J6(t){let e=new yv;for(let n of gv(t))e.addValue(n.file,String(n.key),n.value);return e}function Q6(t,e){let n=null,r=[],i=new Map;for(let a of gv(t,e))a.key===e&&(r.push(n=a.value),i.has(a.file)||i.set(a.file,[]),i.get(a.file).push(n));return{key:e,paths:Array.from(i.keys()),scopes:i,value:n,values:r}}function e4(t){return t.replace(/^(file):/,"")}function*gv(t,e=null){let n=t.split("\0");for(let r=0,i=n.length-1;rObject.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=qr(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,n){let r=this.addFile(t);r.hasOwnProperty(e)?Array.isArray(r[e])?r[e].push(n):r[e]=[r[e],n]:r[e]=n,this._all=void 0}}}});function qf(t,e){return typeof t=="string"&&ah.hasOwnProperty(t)?t:e}function n4(t,e,n,r){let i=["config",`--${r}`];return n&&i.push("--add"),i.push(t,e),{commands:i,format:"utf-8",parser(a){return a}}}function r4(t,e){let n=["config","--null","--show-origin","--get-all",t];return e&&n.splice(1,0,`--${e}`),{commands:n,format:"utf-8",parser(r){return Q6(r,t)}}}function i4(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(n){return J6(n)}}}function a4(){return{addConfig(t,e,...n){return this._runTask(n4(t,e,n[0]===!0,qf(n[1],"local")),qe(arguments))},getConfig(t,e){return this._runTask(r4(t,qf(e,void 0)),qe(arguments))},listConfig(...t){return this._runTask(i4(qf(t[0],void 0)),qe(arguments))}}}var ah,vv=W({"src/lib/tasks/config.ts"(){"use strict";t4(),oe(),ah=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(ah||{})}});function s4(t){return wv.has(t)}var Xf,wv,bv=W({"src/lib/tasks/diff-name-status.ts"(){"use strict";Xf=(t=>(t.ADDED="A",t.COPIED="C",t.DELETED="D",t.MODIFIED="M",t.RENAMED="R",t.CHANGED="T",t.UNMERGED="U",t.UNKNOWN="X",t.BROKEN="B",t))(Xf||{}),wv=new Set(Object.values(Xf))}});function o4(...t){return new _v().param(...t)}function l4(t){let e=new Set,n={};return dh(t,r=>{let[i,a,s]=r.split(zi);e.add(i),(n[i]=n[i]||[]).push({line:Pe(a),path:i,preview:s})}),{paths:e,results:n}}function c4(){return{grep(t){let e=qe(arguments),n=Lt(arguments);for(let i of xv)if(n.includes(i))return this._runTask(jt(`git.grep: use of "${i}" is not supported.`),e);typeof t=="string"&&(t=o4().param(t));let r=["grep","--null","-n","--full-name",...n,...t];return this._runTask({commands:r,format:"utf-8",parser(i){return l4(i)}},e)}}}var xv,gs,oy,_v,Sv=W({"src/lib/tasks/grep.ts"(){"use strict";oe(),Je(),xv=["-h"],gs=Symbol("grepQuery"),_v=class{constructor(){this[oy]=[]}*[(oy=gs,Symbol.iterator)](){for(let t of this[gs])yield t}and(...t){return t.length&&this[gs].push("--and","(",...ws(t,"-e"),")"),this}param(...t){return this[gs].push(...ws(t,"-e")),this}}}}),Ev={};Qe(Ev,{ResetMode:()=>al,getResetMode:()=>f4,resetTask:()=>u4});function u4(t,e){let n=["reset"];return kv(t)&&n.push(`--${t}`),n.push(...e),Tt(n)}function f4(t){if(kv(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function kv(t){return Av.includes(t)}var al,Av,Tv=W({"src/lib/tasks/reset.ts"(){"use strict";Je(),al=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(al||{}),Av=Array.from(Object.values(al))}});function h4(){return(0,ul.default)("simple-git")}function ly(t,e,n){return!e||!String(e).replace(/\s*/,"")?n?(r,...i)=>{t(r,...i),n(r,...i)}:t:(r,...i)=>{t(`%s ${r}`,e,...i),n&&n(r,...i)}}function d4(t,e,{namespace:n}){if(typeof t=="string")return t;let r=e&&e.namespace||"";return r.startsWith(n)?r.substr(n.length+1):r||n}function kh(t,e,n,r=h4()){let i=t&&`[${t}]`||"",a=[],s=typeof e=="string"?r.extend(e):e,o=d4(Fn(e,gt),s,r);return c(n);function l(u,f){return we(a,kh(t,o.replace(/^[^:]+/,u),f,r))}function c(u){let f=u&&`[${u}]`||"",h=s&&ly(s,f)||Xr,d=ly(r,`${i} ${f}`,h);return Object.assign(s?h:d,{label:t,sibling:l,info:d,step:c})}}var Cv=W({"src/lib/git-logger.ts"(){"use strict";oe(),ul.default.formatters.L=t=>String(yh(t)?t.length:"-"),ul.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):ks(t)}}),nl,sh,p4=W({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";fr(),Cv(),nl=class{constructor(t="GitExecutor"){this.logLabel=t,this._queue=new Map}withProgress(t){return this._queue.get(t)}createProgress(t){let e=nl.getName(t.commands[0]),n=kh(this.logLabel,e);return{task:t,logger:n,name:e}}push(t){let e=this.createProgress(t);return e.logger("Adding task to the queue, commands = %o",t.commands),this._queue.set(t,e),e}fatal(t){for(let[e,{logger:n}]of Array.from(this._queue.entries()))e===t.task?(n.info("Failed %o",t),n("Fatal exception, any as-yet un-started tasks run through this executor will not be attempted")):n.info("A fatal exception occurred in a previous task, the queue has been purged: %o",t.message),this.complete(e);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(t){this.withProgress(t)&&this._queue.delete(t)}attempt(t){let e=this.withProgress(t);if(!e)throw new dn(void 0,"TasksPendingQueue: attempt called for an unknown task");return e.logger("Starting task"),e}static getName(t="empty"){return`task:${t}:${++nl.counter}`}},sh=nl,sh.counter=0}});function Wr(t,e){return{method:zy(t.commands)||"",commands:e}}function m4(t,e){return n=>{e("[ERROR] child process exception %o",n),t.push(Buffer.from(String(n.stack),"ascii"))}}function cy(t,e,n,r){return i=>{n("%s received %L bytes",e,i),r("%B",i),t.push(i)}}var oh,g4=W({"src/lib/runners/git-executor-chain.ts"(){"use strict";fr(),Je(),oe(),p4(),oh=class{constructor(t,e,n){this._executor=t,this._scheduler=e,this._plugins=n,this._chain=Promise.resolve(),this._queue=new sh}get cwd(){return this._cwd||this._executor.cwd}set cwd(t){this._cwd=t}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(t){return this._queue.push(t),this._chain=this._chain.then(()=>this.attemptTask(t))}attemptTask(t){return ys(this,null,function*(){let e=yield this._scheduler.next(),n=()=>this._queue.complete(t);try{let{logger:r}=this._queue.attempt(t);return yield hv(t)?this.attemptEmptyTask(t,r):this.attemptRemoteTask(t,r)}catch(r){throw this.onFatalException(t,r)}finally{n(),e()}})}onFatalException(t,e){let n=e instanceof dn?Object.assign(e,{task:t}):new dn(t,e&&String(e));return this._chain=Promise.resolve(),this._queue.fatal(n),n}attemptRemoteTask(t,e){return ys(this,null,function*(){let n=this._plugins.exec("spawn.binary","",Wr(t,t.commands)),r=this._plugins.exec("spawn.args",[...t.commands],Wr(t,t.commands)),i=yield this.gitResponse(t,n,r,this.outputHandler,e.step("SPAWN")),a=yield this.handleTaskData(t,r,i,e.step("HANDLE"));return e("passing response to task's parser as a %s",t.format),fv(t)?nh(t.parser,a):nh(t.parser,a.asStrings())})}attemptEmptyTask(t,e){return ys(this,null,function*(){return e("empty task bypassing child process to call to task's parser"),t.parser(this)})}handleTaskData(t,e,n,r){let{exitCode:i,rejection:a,stdOut:s,stdErr:o}=n;return new Promise((l,c)=>{r("Preparing to handle process response exitCode=%d stdOut=",i);let{error:u}=this._plugins.exec("task.error",{error:a},tn(tn({},Wr(t,e)),n));if(u&&t.onError)return r.info("exitCode=%s handling with custom error handler"),t.onError(n,u,f=>{r.info("custom error handler treated as success"),r("custom error returned a %s",ks(f)),l(new xs(Array.isArray(f)?Buffer.concat(f):f,Buffer.concat(o)))},c);if(u)return r.info("handling as error: exitCode=%s stdErr=%s rejection=%o",i,o.length,a),c(u);r.info("retrieving task output complete"),l(new xs(Buffer.concat(s),Buffer.concat(o)))})}gitResponse(t,e,n,r,i){return ys(this,null,function*(){let a=i.sibling("output"),s=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},Wr(t,t.commands));return new Promise(o=>{let l=[],c=[];i.info("%s %o",e,n),i("%O",s);let u=this._beforeSpawn(t,n);if(u)return o({stdOut:l,stdErr:c,exitCode:9901,rejection:u});this._plugins.exec("spawn.before",void 0,vs(tn({},Wr(t,n)),{kill(h){u=h||u}}));let f=(0,Fv.spawn)(e,n,s);f.stdout.on("data",cy(l,"stdOut",i,a.step("stdOut"))),f.stderr.on("data",cy(c,"stdErr",i,a.step("stdErr"))),f.on("error",m4(c,i)),r&&(i("Passing child process stdOut/stdErr to custom outputHandler"),r(e,f.stdout,f.stderr,[...n])),this._plugins.exec("spawn.after",void 0,vs(tn({},Wr(t,n)),{spawned:f,close(h,d){o({stdOut:l,stdErr:c,exitCode:h,rejection:u||d})},kill(h){f.killed||(u=h,f.kill("SIGINT"))}}))})})}_beforeSpawn(t,e){let n;return this._plugins.exec("spawn.before",void 0,vs(tn({},Wr(t,e)),{kill(r){n=r||n}})),n}}}}),Mv={};Qe(Mv,{GitExecutor:()=>Ov});var Ov,y4=W({"src/lib/runners/git-executor.ts"(){"use strict";g4(),Ov=class{constructor(t,e,n){this.cwd=t,this._scheduler=e,this._plugins=n,this._chain=new oh(this,this._scheduler,this._plugins)}chain(){return new oh(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function v4(t,e,n=Xr){let r=a=>{n(null,a)},i=a=>{(a==null?void 0:a.task)===t&&n(a instanceof Ss?w4(a):a,void 0)};e.then(r,i)}function w4(t){let e=r=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${r} should be GitResponseError.git.${r}, this will no longer be available in version 3`),e=Xr};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(n,{}));function n(r,i){return i in t||(r[i]={enumerable:!1,configurable:!1,get(){return e(i),t.git[i]}}),r}}var b4=W({"src/lib/task-callback.ts"(){"use strict";Gi(),oe()}});function uy(t,e){return cv(n=>{if(!ph(t))throw new Error(`Git.cwd: cannot change to non-directory "${t}"`);return(e||n).cwd=t})}var x4=W({"src/lib/tasks/change-working-directory.ts"(){"use strict";oe(),Je()}});function Yf(t){let e=["checkout",...t];return e[1]==="-b"&&e.includes("-B")&&(e[1]=ml(e,"-B")),Tt(e)}function _4(){return{checkout(){return this._runTask(Yf(Lt(arguments,1)),qe(arguments))},checkoutBranch(t,e){return this._runTask(Yf(["-b",t,e,...Lt(arguments)]),qe(arguments))},checkoutLocalBranch(t){return this._runTask(Yf(["-b",t,...Lt(arguments)]),qe(arguments))}}}var S4=W({"src/lib/tasks/checkout.ts"(){"use strict";oe(),Je()}});function E4(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function k4(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(t){return Dt(E4(),[Pv],t)}})}}}var Pv,A4=W({"src/lib/tasks/count-objects.ts"(){"use strict";oe(),Pv=new fe(/([a-z-]+): (\d+)$/,(t,[e,n])=>{let r=Wy(e);t.hasOwnProperty(r)&&(t[r]=Pe(n))})}});function T4(t){return Dt({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},Iv,t)}var Iv,C4=W({"src/lib/parsers/parse-commit.ts"(){"use strict";oe(),Iv=[new fe(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(t,[e,n,r])=>{t.branch=e,t.commit=r,t.root=!!n}),new fe(/\s*Author:\s(.+)/i,(t,[e])=>{let n=e.split("<"),r=n.pop();!r||!r.includes("@")||(t.author={email:r.substr(0,r.length-1),name:n.join("<").trim()})}),new fe(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(t,[e,n,r])=>{t.summary.changes=parseInt(e,10)||0,t.summary.insertions=parseInt(n,10)||0,t.summary.deletions=parseInt(r,10)||0}),new fe(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(t,[e,n,r])=>{t.summary.changes=parseInt(e,10)||0;let i=parseInt(n,10)||0;r==="-"?t.summary.deletions=i:r==="+"&&(t.summary.insertions=i)})]}});function F4(t,e,n){return{commands:["-c","core.abbrev=40","commit",...ws(t,"-m"),...e,...n],format:"utf-8",parser:T4}}function M4(){return{commit(e,...n){let r=qe(arguments),i=t(e)||F4(Cn(e),Cn(Fn(n[0],cl,[])),[...Fn(n[1],As,[]),...Lt(arguments,0,!0)]);return this._runTask(i,r)}};function t(e){return!cl(e)&&jt("git.commit: requires the commit message to be supplied as a string/string[]")}}var O4=W({"src/lib/tasks/commit.ts"(){"use strict";C4(),oe(),Je()}});function P4(){return{firstCommit(){return this._runTask(Tt(["rev-list","--max-parents=0","HEAD"],!0),qe(arguments))}}}var I4=W({"src/lib/tasks/first-commit.ts"(){"use strict";oe(),Je()}});function R4(t,e){let n=["hash-object",t];return e&&n.push("-w"),Tt(n,!0)}var L4=W({"src/lib/tasks/hash-object.ts"(){"use strict";Je()}});function j4(t,e,n){let r=String(n).trim(),i;if(i=Rv.exec(r))return new sl(t,e,!1,i[1]);if(i=Lv.exec(r))return new sl(t,e,!0,i[1]);let a="",s=r.split(" ");for(;s.length;)if(s.shift()==="in"){a=s.join(" ");break}return new sl(t,e,/^re/i.test(r),a)}var sl,Rv,Lv,D4=W({"src/lib/responses/InitSummary.ts"(){"use strict";sl=class{constructor(t,e,n,r){this.bare=t,this.path=e,this.existing=n,this.gitDir=r}},Rv=/^Init.+ repository in (.+)$/,Lv=/^Rein.+ in (.+)$/}});function B4(t){return t.includes(Ah)}function N4(t=!1,e,n){let r=["init",...n];return t&&!B4(r)&&r.splice(1,0,Ah),{commands:r,format:"utf-8",parser(i){return j4(r.includes("--bare"),e,i)}}}var Ah,$4=W({"src/lib/tasks/init.ts"(){"use strict";D4(),Ah="--bare"}});function Th(t){for(let e=0;eDt(new jv,e,n,!1)}var Zf,fy,hy,dy,Bv,Nv=W({"src/lib/parsers/parse-diff-summary.ts"(){"use strict";Ts(),U4(),bv(),oe(),Zf=[new fe(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(t,[e,n,r=""])=>{t.files.push({file:e.trim(),changes:Pe(n),insertions:r.replace(/[^+]/g,"").length,deletions:r.replace(/[^-]/g,"").length,binary:!1})}),new fe(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(t,[e,n,r])=>{t.files.push({file:e.trim(),before:Pe(n),after:Pe(r),binary:!0})}),new fe(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(t,[e,n])=>{let r=/(\d+) i/.exec(n),i=/(\d+) d/.exec(n);t.changed=Pe(e),t.insertions=Pe(r==null?void 0:r[1]),t.deletions=Pe(i==null?void 0:i[1])})],fy=[new fe(/(\d+)\t(\d+)\t(.+)$/,(t,[e,n,r])=>{let i=Pe(e),a=Pe(n);t.changed++,t.insertions+=i,t.deletions+=a,t.files.push({file:r,changes:i+a,insertions:i,deletions:a,binary:!1})}),new fe(/-\t-\t(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,after:0,before:0,binary:!0})})],hy=[new fe(/(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],dy=[new fe(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(t,[e,n,r,i,a])=>{t.changed++,t.files.push({file:a!=null?a:r,changes:0,insertions:0,deletions:0,binary:!1,status:eh(s4(e)&&e),from:eh(!!a&&r!==a&&r),similarity:Pe(n)})})],Bv={"":Zf,"--stat":Zf,"--numstat":fy,"--name-status":dy,"--name-only":hy}}});function z4(t,e){return e.reduce((n,r,i)=>(n[r]=t[i]||"",n),Object.create({diff:null}))}function $v(t=Oh,e=Hv,n=""){let r=Dv(n);return function(i){let a=Es(i.trim(),!1,Fh).map(function(s){let o=s.split(Mh),l=z4(o[0].split(t),e);return o.length>1&&o[1].trim()&&(l.diff=r(o[1])),l});return{all:a,latest:a.length&&a[0]||null,total:a.length}}}var Fh,Mh,Oh,Hv,Uv=W({"src/lib/parsers/parse-list-log-summary.ts"(){"use strict";oe(),Nv(),Ts(),Fh="\xF2\xF2\xF2\xF2\xF2\xF2 ",Mh=" \xF2\xF2",Oh=" \xF2 ",Hv=["hash","date","message","refs","author_name","author_email"]}}),zv={};Qe(zv,{diffSummaryTask:()=>G4,validateLogFormatConfig:()=>wl});function G4(t){let e=Th(t),n=["diff"];return e===""&&(e="--stat",n.push("--stat=4096")),n.push(...t),wl(n)||{commands:n,format:"utf-8",parser:Dv(e)}}function wl(t){let e=t.filter(H4);if(e.length>1)return jt(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&t.includes("-z"))return jt(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}var Ph=W({"src/lib/tasks/diff.ts"(){"use strict";Ts(),Nv(),Je()}});function V4(t,e){let n=[],r=[];return Object.keys(t).forEach(i=>{n.push(i),r.push(String(t[i]))}),[n,r.join(e)]}function W4(t){return Object.keys(t).reduce((e,n)=>(n in lh||(e[n]=t[n]),e),{})}function Gv(t={},e=[]){let n=Fn(t.splitter,gt,Oh),r=!mh(t.format)&&t.format?t.format:{hash:"%H",date:t.strictDate===!1?"%ai":"%aI",message:"%s",refs:"%D",body:t.multiLine?"%B":"%b",author_name:t.mailMap!==!1?"%aN":"%an",author_email:t.mailMap!==!1?"%aE":"%ae"},[i,a]=V4(r,n),s=[],o=[`--pretty=format:${Fh}${a}${Mh}`,...e],l=t.n||t["max-count"]||t.maxCount;if(l&&o.push(`--max-count=${l}`),t.from||t.to){let c=t.symmetric!==!1?"...":"..";s.push(`${t.from||""}${c}${t.to||""}`)}return gt(t.file)&&o.push("--follow",R6(t.file)),vh(W4(t),o),{fields:i,splitter:n,commands:[...o,...s]}}function q4(t,e,n){let r=$v(t,e,Th(n));return{commands:["log",...n],format:"utf-8",parser:r}}function X4(){return{log(...n){let r=qe(arguments),i=Gv(wh(arguments),Fn(arguments[0],As)),a=e(...n)||wl(i.commands)||t(i);return this._runTask(a,r)}};function t(n){return q4(n.splitter,n.fields,n.commands)}function e(n,r){return gt(n)&>(r)&&jt("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var lh,Vv=W({"src/lib/tasks/log.ts"(){"use strict";Ts(),_s(),Uv(),oe(),Je(),Ph(),lh=(t=>(t[t["--pretty"]=0]="--pretty",t[t["max-count"]=1]="max-count",t[t.maxCount=2]="maxCount",t[t.n=3]="n",t[t.file=4]="file",t[t.format=5]="format",t[t.from=6]="from",t[t.to=7]="to",t[t.splitter=8]="splitter",t[t.symmetric=9]="symmetric",t[t.mailMap=10]="mailMap",t[t.multiLine=11]="multiLine",t[t.strictDate=12]="strictDate",t))(lh||{})}}),ol,Wv,Y4=W({"src/lib/responses/MergeSummary.ts"(){"use strict";ol=class{constructor(t,e=null,n){this.reason=t,this.file=e,this.meta=n}toString(){return`${this.file}:${this.reason}`}},Wv=class{constructor(){this.conflicts=[],this.merges=[],this.result="success"}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(", ")}`:"OK"}}}}),ch,qv,Z4=W({"src/lib/responses/PullSummary.ts"(){"use strict";ch=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},qv=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function Kf(t){return t.objects=t.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function py(t){let e=/^\s*(\d+)/.exec(t),n=/delta (\d+)/i.exec(t);return{count:Pe(e&&e[1]||"0"),delta:Pe(n&&n[1]||"0")}}var Xv,K4=W({"src/lib/parsers/parse-remote-objects.ts"(){"use strict";oe(),Xv=[new ur(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(t,[e,n])=>{let r=e.toLowerCase(),i=Kf(t.remoteMessages);Object.assign(i,{[r]:Pe(n)})}),new ur(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(t,[e,n])=>{let r=e.toLowerCase(),i=Kf(t.remoteMessages);Object.assign(i,{[r]:Pe(n)})}),new ur(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(t,[e,n,r])=>{let i=Kf(t.remoteMessages);i.total=py(e),i.reused=py(n),i.packReused=Pe(r)})]}});function Yv(t,e){return Dt({remoteMessages:new Kv},Zv,e)}var Zv,Kv,Jv=W({"src/lib/parsers/parse-remote-messages.ts"(){"use strict";oe(),K4(),Zv=[new ur(/^remote:\s*(.+)$/,(t,[e])=>(t.remoteMessages.all.push(e.trim()),!1)),...Xv,new ur([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(t,[e])=>{t.remoteMessages.pullRequestUrl=e}),new ur([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(t,[e,n,r])=>{t.remoteMessages.vulnerabilities={count:Pe(e),summary:n,url:r}})],Kv=class{constructor(){this.all=[]}}}});function J4(t,e){let n=Dt(new qv,Qv,[t,e]);return n.message&&n}var my,gy,yy,vy,Qv,wy,Ih,ew=W({"src/lib/parsers/parse-pull.ts"(){"use strict";Z4(),oe(),Jv(),my=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,gy=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,yy=/^(create|delete) mode \d+ (.+)/,vy=[new fe(my,(t,[e,n,r])=>{t.files.push(e),n&&(t.insertions[e]=n.length),r&&(t.deletions[e]=r.length)}),new fe(gy,(t,[e,,n,,r])=>n!==void 0||r!==void 0?(t.summary.changes=+e||0,t.summary.insertions=+n||0,t.summary.deletions=+r||0,!0):!1),new fe(yy,(t,[e,n])=>{we(t.files,n),we(e==="create"?t.created:t.deleted,n)})],Qv=[new fe(/^from\s(.+)$/i,(t,[e])=>void(t.remote=e)),new fe(/^fatal:\s(.+)$/,(t,[e])=>void(t.message=e)),new fe(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(t,[e,n,r,i])=>{t.branch.local=r,t.hash.local=e,t.branch.remote=i,t.hash.remote=n})],wy=(t,e)=>Dt(new ch,vy,[t,e]),Ih=(t,e)=>Object.assign(new ch,wy(t,e),Yv(t,e))}}),by,tw,xy,Q4=W({"src/lib/parsers/parse-merge.ts"(){"use strict";Y4(),oe(),ew(),by=[new fe(/^Auto-merging\s+(.+)$/,(t,[e])=>{t.merges.push(e)}),new fe(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(t,[e,n])=>{t.conflicts.push(new ol(e,n))}),new fe(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(t,[e,n,r])=>{t.conflicts.push(new ol(e,n,{deleteRef:r}))}),new fe(/^CONFLICT\s+\((.+)\):/,(t,[e])=>{t.conflicts.push(new ol(e,null))}),new fe(/^Automatic merge failed;\s+(.+)$/,(t,[e])=>{t.result=e})],tw=(t,e)=>Object.assign(xy(t,e),Ih(t,e)),xy=t=>Dt(new Wv,by,t)}});function _y(t){return t.length?{commands:["merge",...t],format:"utf-8",parser(e,n){let r=tw(e,n);if(r.failed)throw new Ss(r);return r}}:jt("Git.merge requires at least one option")}var eF=W({"src/lib/tasks/merge.ts"(){"use strict";Gi(),Q4(),Je()}});function tF(t,e,n){let r=n.includes("deleted"),i=n.includes("tag")||/^refs\/tags/.test(t),a=!n.includes("new");return{deleted:r,tag:i,branch:!i,new:!a,alreadyUpdated:a,local:t,remote:e}}var Sy,nw,Ey,nF=W({"src/lib/parsers/parse-push.ts"(){"use strict";oe(),Jv(),Sy=[new fe(/^Pushing to (.+)$/,(t,[e])=>{t.repo=e}),new fe(/^updating local tracking ref '(.+)'/,(t,[e])=>{t.ref=vs(tn({},t.ref||{}),{local:e})}),new fe(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(t,[e,n,r])=>{t.pushed.push(tF(e,n,r))}),new fe(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(t,[e,n,r])=>{t.branch=vs(tn({},t.branch||{}),{local:e,remote:n,remoteName:r})}),new fe(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(t,[e,n,r,i])=>{t.update={head:{local:e,remote:n},hash:{from:r,to:i}}})],nw=(t,e)=>{let n=Ey(t,e),r=Yv(t,e);return tn(tn({},n),r)},Ey=(t,e)=>Dt({pushed:[]},Sy,[t,e])}}),rw={};Qe(rw,{pushTagsTask:()=>rF,pushTask:()=>Rh});function rF(t={},e){return we(e,"--tags"),Rh(t,e)}function Rh(t={},e){let n=["push",...e];return t.branch&&n.splice(1,0,t.branch),t.remote&&n.splice(1,0,t.remote),ml(n,"-v"),we(n,"--verbose"),we(n,"--porcelain"),{commands:n,format:"utf-8",parser:nw}}var iw=W({"src/lib/tasks/push.ts"(){"use strict";nF(),oe()}});function iF(){return{showBuffer(){let t=["show",...Lt(arguments,1)];return t.includes("--binary")||t.splice(1,0,"--binary"),this._runTask(uv(t),qe(arguments))},show(){let t=["show",...Lt(arguments,1)];return this._runTask(Tt(t),qe(arguments))}}}var aF=W({"src/lib/tasks/show.ts"(){"use strict";oe(),Je()}}),ky,aw,sF=W({"src/lib/responses/FileStatusSummary.ts"(){"use strict";ky=/^(.+)\0(.+)$/,aw=class{constructor(t,e,n){if(this.path=t,this.index=e,this.working_dir=n,e==="R"||n==="R"){let r=ky.exec(t)||[null,t,t];this.from=r[2]||"",this.path=r[1]||""}}}}});function Ay(t){let[e,n]=t.split(zi);return{from:n||e,to:e}}function Wt(t,e,n){return[`${t}${e}`,n]}function Jf(t,...e){return e.map(n=>Wt(t,n,(r,i)=>we(r.conflicted,i)))}function oF(t,e){let n=e.trim();switch(" "){case n.charAt(2):return r(n.charAt(0),n.charAt(1),n.substr(3));case n.charAt(1):return r(" ",n.charAt(0),n.substr(2));default:return}function r(i,a,s){let o=`${i}${a}`,l=sw.get(o);l&&l(t,s),o!=="##"&&o!=="!!"&&t.files.push(new aw(s,i,a))}}var Ty,sw,ow,lF=W({"src/lib/responses/StatusSummary.ts"(){"use strict";oe(),sF(),Ty=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},sw=new Map([Wt(" ","A",(t,e)=>we(t.created,e)),Wt(" ","D",(t,e)=>we(t.deleted,e)),Wt(" ","M",(t,e)=>we(t.modified,e)),Wt("A"," ",(t,e)=>we(t.created,e)&&we(t.staged,e)),Wt("A","M",(t,e)=>we(t.created,e)&&we(t.staged,e)&&we(t.modified,e)),Wt("D"," ",(t,e)=>we(t.deleted,e)&&we(t.staged,e)),Wt("M"," ",(t,e)=>we(t.modified,e)&&we(t.staged,e)),Wt("M","M",(t,e)=>we(t.modified,e)&&we(t.staged,e)),Wt("R"," ",(t,e)=>{we(t.renamed,Ay(e))}),Wt("R","M",(t,e)=>{let n=Ay(e);we(t.renamed,n),we(t.modified,n.to)}),Wt("!","!",(t,e)=>{we(t.ignored=t.ignored||[],e)}),Wt("?","?",(t,e)=>we(t.not_added,e)),...Jf("A","A","U"),...Jf("D","D","U"),...Jf("U","A","D","U"),["##",(t,e)=>{let n=/ahead (\d+)/,r=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,a=/\.{3}(\S*)/,s=/\son\s([\S]+)$/,o;o=n.exec(e),t.ahead=o&&+o[1]||0,o=r.exec(e),t.behind=o&&+o[1]||0,o=i.exec(e),t.current=o&&o[1],o=a.exec(e),t.tracking=o&&o[1],o=s.exec(e),t.current=o&&o[1]||t.current,t.detached=/\(no branch\)/.test(e)}]]),ow=function(t){let e=t.split(zi),n=new Ty;for(let r=0,i=e.length;r!lw.includes(n))],parser(n){return ow(n)}}}var lw,uF=W({"src/lib/tasks/status.ts"(){"use strict";lF(),lw=["--null","-z"]}});function fl(t=0,e=0,n=0,r="",i=!0){return Object.defineProperty({major:t,minor:e,patch:n,agent:r,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function fF(){return fl(0,0,0,"",!1)}function hF(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:dF,onError(t,e,n,r){if(t.exitCode===-2)return n(Buffer.from(Lh));r(e)}})}}}function dF(t){return t===Lh?fF():Dt(fl(0,0,0,t),cw,t)}var Lh,cw,pF=W({"src/lib/tasks/version.ts"(){"use strict";oe(),Lh="installed=false",cw=[new fe(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(t,[e,n,r,i=""])=>{Object.assign(t,fl(Pe(e),Pe(n),Pe(r),i))}),new fe(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(t,[e,n,r,i=""])=>{Object.assign(t,fl(Pe(e),Pe(n),r,i))})]}}),uw={};Qe(uw,{SimpleGitApi:()=>uh});var uh,mF=W({"src/lib/simple-git-api.ts"(){"use strict";b4(),x4(),S4(),A4(),O4(),vv(),I4(),Sv(),L4(),$4(),Vv(),eF(),iw(),aF(),uF(),Je(),pF(),oe(),uh=class{constructor(t){this._executor=t}_runTask(t,e){let n=this._executor.chain(),r=n.push(t);return e&&v4(t,r,e),Object.create(this,{then:{value:r.then.bind(r)},catch:{value:r.catch.bind(r)},_executor:{value:n}})}add(t){return this._runTask(Tt(["add",...Cn(t)]),qe(arguments))}cwd(t){let e=qe(arguments);return typeof t=="string"?this._runTask(uy(t,this._executor),e):typeof(t==null?void 0:t.path)=="string"?this._runTask(uy(t.path,t.root&&this._executor||void 0),e):this._runTask(jt("Git.cwd: workingDirectory must be supplied as a string"),e)}hashObject(t,e){return this._runTask(R4(t,e===!0),qe(arguments))}init(t){return this._runTask(N4(t===!0,this._executor.cwd,Lt(arguments)),qe(arguments))}merge(){return this._runTask(_y(Lt(arguments)),qe(arguments))}mergeFromTo(t,e){return gt(t)&>(e)?this._runTask(_y([t,e,...Lt(arguments)]),qe(arguments,!1)):this._runTask(jt("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(t){return this._executor.outputHandler=t,this}push(){let t=Rh({remote:Fn(arguments[0],gt),branch:Fn(arguments[1],gt)},Lt(arguments));return this._runTask(t,qe(arguments))}stash(){return this._runTask(Tt(["stash",...Lt(arguments)]),qe(arguments))}status(){return this._runTask(cF(Lt(arguments)),qe(arguments))}},Object.assign(uh.prototype,_4(),M4(),a4(),k4(),P4(),c4(),X4(),iF(),hF())}}),fw={};Qe(fw,{Scheduler:()=>dw});var Cy,dw,gF=W({"src/lib/runners/scheduler.ts"(){"use strict";oe(),Cv(),Cy=(()=>{let t=0;return()=>{t++;let{promise:e,done:n}=(0,hw.createDeferred)();return{promise:e,done:n,id:t}}})(),dw=class{constructor(t=2){this.concurrency=t,this.logger=kh("","scheduler"),this.pending=[],this.running=[],this.logger("Constructed, concurrency=%s",t)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger("Schedule attempt ignored, pending=%s running=%s concurrency=%s",this.pending.length,this.running.length,this.concurrency);return}let t=we(this.running,this.pending.shift());this.logger("Attempting id=%s",t.id),t.done(()=>{this.logger("Completing id=",t.id),ml(this.running,t),this.schedule()})}next(){let{promise:t,id:e}=we(this.pending,Cy());return this.logger("Scheduling id=%s",e),this.schedule(),t}}}}),pw={};Qe(pw,{applyPatchTask:()=>yF});function yF(t,e){return Tt(["apply",...e,...t])}var vF=W({"src/lib/tasks/apply-patch.ts"(){"use strict";Je()}});function wF(t,e){return{branch:t,hash:e,success:!0}}function bF(t){return{branch:t,hash:null,success:!1}}var mw,xF=W({"src/lib/responses/BranchDeleteSummary.ts"(){"use strict";mw=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function gw(t,e){return e===1&&fh.test(t)}var Fy,fh,My,bl,_F=W({"src/lib/parsers/parse-branch-delete.ts"(){"use strict";xF(),oe(),Fy=/(\S+)\s+\(\S+\s([^)]+)\)/,fh=/^error[^']+'([^']+)'/m,My=[new fe(Fy,(t,[e,n])=>{let r=wF(e,n);t.all.push(r),t.branches[e]=r}),new fe(fh,(t,[e])=>{let n=bF(e);t.errors.push(n),t.all.push(n),t.branches[e]=n})],bl=(t,e)=>Dt(new mw,My,[t,e])}}),yw,SF=W({"src/lib/responses/BranchSummary.ts"(){"use strict";yw=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(t,e,n,r,i){t==="*"&&(this.detached=e,this.current=n),this.all.push(n),this.branches[n]={current:t==="*",linkedWorkTree:t==="+",name:n,commit:r,label:i}}}}});function Oy(t){return t?t.charAt(0):""}function vw(t){return Dt(new yw,ww,t)}var ww,EF=W({"src/lib/parsers/parse-branch.ts"(){"use strict";SF(),oe(),ww=[new fe(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(t,[e,n,r,i])=>{t.push(Oy(e),!0,n,r,i)}),new fe(new RegExp("^([*+]\\s)?(\\S+)\\s+([a-z0-9]+)\\s?(.*)$","s"),(t,[e,n,r,i])=>{t.push(Oy(e),!1,n,r,i)})]}}),bw={};Qe(bw,{branchLocalTask:()=>AF,branchTask:()=>kF,containsDeleteBranchCommand:()=>xw,deleteBranchTask:()=>CF,deleteBranchesTask:()=>TF});function xw(t){let e=["-d","-D","--delete"];return t.some(n=>e.includes(n))}function kF(t){let e=xw(t),n=["branch",...t];return n.length===1&&n.push("-a"),n.includes("-v")||n.splice(1,0,"-v"),{format:"utf-8",commands:n,parser(r,i){return e?bl(r,i).all[0]:vw(r)}}}function AF(){return{format:"utf-8",commands:["branch","-v"],parser:vw}}function TF(t,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...t],parser(n,r){return bl(n,r)},onError({exitCode:n,stdOut:r},i,a,s){if(!gw(String(i),n))return s(i);a(r)}}}function CF(t,e=!1){let n={format:"utf-8",commands:["branch","-v",e?"-D":"-d",t],parser(r,i){return bl(r,i).branches[t]},onError({exitCode:r,stdErr:i,stdOut:a},s,o,l){if(!gw(String(s),r))return l(s);throw new Ss(n.parser(bs(a),bs(i)),String(s))}};return n}var FF=W({"src/lib/tasks/branch.ts"(){"use strict";Gi(),_F(),EF(),oe()}}),_w,MF=W({"src/lib/responses/CheckIgnore.ts"(){"use strict";_w=t=>t.split(/\n/g).map(e=>e.trim()).filter(e=>!!e)}}),Sw={};Qe(Sw,{checkIgnoreTask:()=>OF});function OF(t){return{commands:["check-ignore",...t],format:"utf-8",parser:_w}}var PF=W({"src/lib/tasks/check-ignore.ts"(){"use strict";MF()}}),Ew={};Qe(Ew,{cloneMirrorTask:()=>RF,cloneTask:()=>kw});function IF(t){return/^--upload-pack(=|$)/.test(t)}function kw(t,e,n){let r=["clone",...n];return gt(t)&&r.push(t),gt(e)&&r.push(e),r.find(IF)?jt("git.fetch: potential exploit argument blocked."):Tt(r)}function RF(t,e,n){return we(n,"--mirror"),kw(t,e,n)}var LF=W({"src/lib/tasks/clone.ts"(){"use strict";Je(),oe()}});function jF(t,e){return Dt({raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]},Aw,[t,e])}var Aw,DF=W({"src/lib/parsers/parse-fetch.ts"(){"use strict";oe(),Aw=[new fe(/From (.+)$/,(t,[e])=>{t.remote=e}),new fe(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(t,[e,n])=>{t.branches.push({name:e,tracking:n})}),new fe(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(t,[e,n])=>{t.tags.push({name:e,tracking:n})}),new fe(/- \[deleted]\s+\S+\s*-> (.+)$/,(t,[e])=>{t.deleted.push({tracking:e})}),new fe(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(t,[e,n,r,i])=>{t.updated.push({name:r,tracking:i,to:n,from:e})})]}}),Tw={};Qe(Tw,{fetchTask:()=>NF});function BF(t){return/^--upload-pack(=|$)/.test(t)}function NF(t,e,n){let r=["fetch",...n];return t&&e&&r.push(t,e),r.find(BF)?jt("git.fetch: potential exploit argument blocked."):{commands:r,format:"utf-8",parser:jF}}var $F=W({"src/lib/tasks/fetch.ts"(){"use strict";DF(),Je()}});function HF(t){return Dt({moves:[]},Cw,t)}var Cw,UF=W({"src/lib/parsers/parse-move.ts"(){"use strict";oe(),Cw=[new fe(/^Renaming (.+) to (.+)$/,(t,[e,n])=>{t.moves.push({from:e,to:n})})]}}),Fw={};Qe(Fw,{moveTask:()=>zF});function zF(t,e){return{commands:["mv","-v",...Cn(t),e],format:"utf-8",parser:HF}}var GF=W({"src/lib/tasks/move.ts"(){"use strict";UF(),oe()}}),Mw={};Qe(Mw,{pullTask:()=>VF});function VF(t,e,n){let r=["pull",...n];return t&&e&&r.splice(1,0,t,e),{commands:r,format:"utf-8",parser(i,a){return Ih(i,a)},onError(i,a,s,o){let l=J4(bs(i.stdOut),bs(i.stdErr));if(l)return o(new Ss(l));o(a)}}}var WF=W({"src/lib/tasks/pull.ts"(){"use strict";Gi(),ew(),oe()}});function qF(t){let e={};return Ow(t,([n])=>e[n]={name:n}),Object.values(e)}function XF(t){let e={};return Ow(t,([n,r,i])=>{e.hasOwnProperty(n)||(e[n]={name:n,refs:{fetch:"",push:""}}),i&&r&&(e[n].refs[i.replace(/[^a-z]/g,"")]=r)}),Object.values(e)}function Ow(t,e){dh(t,n=>e(n.split(/\s+/)))}var YF=W({"src/lib/responses/GetRemoteSummary.ts"(){"use strict";oe()}}),Pw={};Qe(Pw,{addRemoteTask:()=>ZF,getRemotesTask:()=>KF,listRemotesTask:()=>JF,remoteTask:()=>QF,removeRemoteTask:()=>eM});function ZF(t,e,n){return Tt(["remote","add",...n,t,e])}function KF(t){let e=["remote"];return t&&e.push("-v"),{commands:e,format:"utf-8",parser:t?XF:qF}}function JF(t){let e=[...t];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),Tt(e)}function QF(t){let e=[...t];return e[0]!=="remote"&&e.unshift("remote"),Tt(e)}function eM(t){return Tt(["remote","remove",t])}var tM=W({"src/lib/tasks/remote.ts"(){"use strict";YF(),Je()}}),Iw={};Qe(Iw,{stashListTask:()=>nM});function nM(t={},e){let n=Gv(t),r=["stash","list",...n.commands,...e],i=$v(n.splitter,n.fields,Th(r));return wl(r)||{commands:r,format:"utf-8",parser:i}}var rM=W({"src/lib/tasks/stash-list.ts"(){"use strict";Ts(),Uv(),Ph(),Vv()}}),Rw={};Qe(Rw,{addSubModuleTask:()=>iM,initSubModuleTask:()=>aM,subModuleTask:()=>xl,updateSubModuleTask:()=>sM});function iM(t,e){return xl(["add",t,e])}function aM(t){return xl(["init",...t])}function xl(t){let e=[...t];return e[0]!=="submodule"&&e.unshift("submodule"),Tt(e)}function sM(t){return xl(["update",...t])}var oM=W({"src/lib/tasks/sub-module.ts"(){"use strict";Je()}});function lM(t,e){let n=isNaN(t),r=isNaN(e);return n!==r?n?1:-1:n?Lw(t,e):0}function Lw(t,e){return t===e?0:t>e?1:-1}function cM(t){return t.trim()}function rl(t){return typeof t=="string"&&parseInt(t.replace(/^\D+/g,""),10)||0}var Py,jw,uM=W({"src/lib/responses/TagList.ts"(){"use strict";Py=class{constructor(t,e){this.all=t,this.latest=e}},jw=function(t,e=!1){let n=t.split(` `).map(cM).filter(Boolean);e||n.sort(function(i,a){let s=i.split("."),o=a.split(".");if(s.length===1||o.length===1)return lM(rl(s[0]),rl(o[0]));for(let l=0,c=Math.max(s.length,o.length);li.indexOf(".")>=0);return new Py(n,r)}}}),Dw={};Qe(Dw,{addAnnotatedTagTask:()=>dM,addTagTask:()=>hM,tagListTask:()=>fM});function fM(t=[]){let e=t.some(n=>/^--sort=/.test(n));return{format:"utf-8",commands:["tag","-l",...t],parser(n){return jw(n,e)}}}function hM(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function dM(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var pM=W({"src/lib/tasks/tag.ts"(){"use strict";uM()}}),mM=P6({"src/git.js"(t,e){"use strict";var{GitExecutor:n}=(y4(),We(Mv)),{SimpleGitApi:r}=(mF(),We(uw)),{Scheduler:i}=(gF(),We(fw)),{configurationErrorTask:a}=(Je(),We(ih)),{asArray:s,filterArray:o,filterPrimitives:l,filterString:c,filterStringOrStringArray:u,filterType:f,getTrailingOptions:h,trailingFunctionArgument:d,trailingOptionsArgument:p}=(oe(),We(ev)),{applyPatchTask:g}=(vF(),We(pw)),{branchTask:m,branchLocalTask:w,deleteBranchesTask:b,deleteBranchTask:S}=(FF(),We(bw)),{checkIgnoreTask:k}=(PF(),We(Sw)),{checkIsRepoTask:x}=(iv(),We(tv)),{cloneTask:A,cloneMirrorTask:y}=(LF(),We(Ew)),{cleanWithOptionsTask:E,isCleanOptionsArray:_}=(mv(),We(dv)),{diffSummaryTask:C}=(Ph(),We(zv)),{fetchTask:M}=($F(),We(Tw)),{moveTask:L}=(GF(),We(Fw)),{pullTask:N}=(WF(),We(Mw)),{pushTagsTask:j}=(iw(),We(rw)),{addRemoteTask:Y,getRemotesTask:le,listRemotesTask:he,remoteTask:ie,removeRemoteTask:Me}=(tM(),We(Pw)),{getResetMode:de,resetTask:$}=(Tv(),We(Ev)),{stashListTask:G}=(rM(),We(Iw)),{addSubModuleTask:D,initSubModuleTask:se,subModuleTask:Se,updateSubModuleTask:mt}=(oM(),We(Rw)),{addAnnotatedTagTask:be,addTagTask:st,tagListTask:ee}=(pM(),We(Dw)),{straightThroughBufferTask:Ie,straightThroughStringTask:Ee}=(Je(),We(ih));function z(H,Z){this._plugins=Z,this._executor=new n(H.baseDir,new i(H.maxConcurrentProcesses),Z),this._trimmed=H.trimmed}(z.prototype=Object.create(r.prototype)).constructor=z,z.prototype.customBinary=function(H){return this._plugins.reconfigure("binary",H),this},z.prototype.env=function(H,Z){return arguments.length===1&&typeof H=="object"?this._executor.env=H:(this._executor.env=this._executor.env||{})[H]=Z,this},z.prototype.stashList=function(H){return this._runTask(G(p(arguments)||{},o(H)&&H||[]),d(arguments))};function nt(H,Z,ye,Ye){return typeof ye!="string"?a(`git.${H}() requires a string 'repoPath'`):Z(ye,f(Ye,c),h(arguments))}z.prototype.clone=function(){return this._runTask(nt("clone",A,...arguments),d(arguments))},z.prototype.mirror=function(){return this._runTask(nt("mirror",y,...arguments),d(arguments))},z.prototype.mv=function(H,Z){return this._runTask(L(H,Z),d(arguments))},z.prototype.checkoutLatestTag=function(H){var Z=this;return this.pull(function(){Z.tags(function(ye,Ye){Z.checkout(Ye.latest,H)})})},z.prototype.pull=function(H,Z,ye,Ye){return this._runTask(N(f(H,c),f(Z,c),h(arguments)),d(arguments))},z.prototype.fetch=function(H,Z){return this._runTask(M(f(H,c),f(Z,c),h(arguments)),d(arguments))},z.prototype.silent=function(H){return console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"),this},z.prototype.tags=function(H,Z){return this._runTask(ee(h(arguments)),d(arguments))},z.prototype.rebase=function(){return this._runTask(Ee(["rebase",...h(arguments)]),d(arguments))},z.prototype.reset=function(H){return this._runTask($(de(H),h(arguments)),d(arguments))},z.prototype.revert=function(H){let Z=d(arguments);return typeof H!="string"?this._runTask(a("Commit must be a string"),Z):this._runTask(Ee(["revert",...h(arguments,0,!0),H]),Z)},z.prototype.addTag=function(H){let Z=typeof H=="string"?st(H):a("Git.addTag requires a tag name");return this._runTask(Z,d(arguments))},z.prototype.addAnnotatedTag=function(H,Z){return this._runTask(be(H,Z),d(arguments))},z.prototype.deleteLocalBranch=function(H,Z,ye){return this._runTask(S(H,typeof Z=="boolean"?Z:!1),d(arguments))},z.prototype.deleteLocalBranches=function(H,Z,ye){return this._runTask(b(H,typeof Z=="boolean"?Z:!1),d(arguments))},z.prototype.branch=function(H,Z){return this._runTask(m(h(arguments)),d(arguments))},z.prototype.branchLocal=function(H){return this._runTask(w(),d(arguments))},z.prototype.raw=function(H){let Z=!Array.isArray(H),ye=[].slice.call(Z?arguments:H,0);for(let _t=0;_tt.removeEventListener("abort",a))}}]:void 0}function vM(t){return typeof t=="string"&&t.trim().toLowerCase()==="-c"}function wM(t,e){if(vM(t)&&/^\s*protocol(.[a-z]+)?.allow/.test(e))throw new Gn(void 0,"unsafe","Configuring protocol.allow is not permitted without enabling allowUnsafeExtProtocol")}function bM(t,e){if(/^\s*--(upload|receive)-pack/.test(t))throw new Gn(void 0,"unsafe","Use of --upload-pack or --receive-pack is not permitted without enabling allowUnsafePack");if(e==="clone"&&/^\s*-u\b/.test(t))throw new Gn(void 0,"unsafe","Use of clone with option -u is not permitted without enabling allowUnsafePack");if(e==="push"&&/^\s*--exec\b/.test(t))throw new Gn(void 0,"unsafe","Use of push with option --exec is not permitted without enabling allowUnsafePack")}function xM({allowUnsafeProtocolOverride:t=!1,allowUnsafePack:e=!1}={}){return{type:"spawn.args",action(n,r){return n.forEach((i,a)=>{let s=aQf(i))).then(s.done)}return{type:"spawn.after",action(i,a){return ys(this,arguments,function*(s,{spawned:o,close:l}){var c,u;let f=n(),h=!0,d=()=>void(h=!1);(c=o.stdout)==null||c.on("data",d),(u=o.stderr)==null||u.on("data",d),o.on("error",d),o.on("close",p=>f.close(p)),o.on("exit",p=>f.exit(p));try{yield f.result,h&&(yield Qf(50)),l(f.exitCode)}catch(p){l(f.exitCode,p)}})}}}oe();var EM="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",Ry="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function kM(t){return!t||!/^([a-z]:)?([a-z0-9/.\\_-]+)$/i.test(t)}function Ly(t,e){if(t.length<1||t.length>2)throw new Gn(void 0,"binary",EM);if(t.some(kM))if(e)console.warn(Ry);else throw new Gn(void 0,"binary",Ry);let[r,i]=t;return{binary:r,prefix:i}}function AM(t,e=["git"],n=!1){let r=Ly(Cn(e),n);t.on("binary",i=>{r=Ly(Cn(i),n)}),t.append("spawn.binary",()=>r.binary),t.append("spawn.args",i=>r.prefix?[r.prefix,...i]:i)}fr();function TM(t){return!!(t.exitCode&&t.stdErr.length)}function CM(t){return Buffer.concat([...t.stdOut,...t.stdErr])}function FM(t=!1,e=TM,n=CM){return(r,i)=>!t&&r||!e(i)?r:n(i)}function jy(t){return{type:"task.error",action(e,n){let r=t(e.error,{stdErr:n.stdErr,stdOut:n.stdOut,exitCode:n.exitCode});return Buffer.isBuffer(r)?{error:new dn(void 0,r.toString("utf-8"))}:{error:r}}}}oe();var MM=class{constructor(){this.plugins=new Set,this.events=new Bw.EventEmitter}on(t,e){this.events.on(t,e)}reconfigure(t,e){this.events.emit(t,e)}append(t,e){let n=we(this.plugins,{type:t,action:e});return()=>this.plugins.delete(n)}add(t){let e=[];return Cn(t).forEach(n=>n&&this.plugins.add(we(e,n))),()=>{e.forEach(n=>this.plugins.delete(n))}}exec(t,e,n){let r=e,i=Object.freeze(Object.create(n));for(let a of this.plugins)a.type===t&&(r=a.action(r,i));return r}};oe();function OM(t){let e="--progress",n=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(a,s){return n.includes(s.method)?Vy(a,e):a}},{type:"spawn.after",action(a,s){var o;s.commands.includes(e)&&((o=s.spawned.stderr)==null||o.on("data",l=>{let c=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(l.toString("utf8"));c&&t({method:s.method,stage:PM(c[1]),progress:Pe(c[2]),processed:Pe(c[3]),total:Pe(c[4])})}))}}]}function PM(t){return String(t.toLowerCase().split(" ",1))||"unknown"}oe();function IM(t){let e=Xy(t,["uid","gid"]);return{type:"spawn.options",action(n){return tn(tn({},e),n)}}}function RM({block:t,stdErr:e=!0,stdOut:n=!0}){if(t>0)return{type:"spawn.after",action(r,i){var a,s;let o;function l(){o&&clearTimeout(o),o=setTimeout(u,t)}function c(){var f,h;(f=i.spawned.stdout)==null||f.off("data",l),(h=i.spawned.stderr)==null||h.off("data",l),i.spawned.off("exit",c),i.spawned.off("close",c),o&&clearTimeout(o)}function u(){c(),i.kill(new Gn(void 0,"timeout","block timeout reached"))}n&&((a=i.spawned.stdout)==null||a.on("data",l)),e&&((s=i.spawned.stderr)==null||s.on("data",l)),i.spawned.on("exit",c),i.spawned.on("close",c),l()}}}_s();function LM(){return{type:"spawn.args",action(t){let e=[],n;function r(i){(n=n||[]).push(...i)}for(let i=0;ill(s)&&sy(s)||s));break}e.push(a)}return n?[...e,"--",...n.map(String)]:e}}}oe();var jM=mM();function DM(t,e){var n;let r=new MM,i=Jy(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!ph(i.baseDir))throw new gM(i,"Cannot use simple-git on a directory that does not exist");return Array.isArray(i.config)&&r.add(_M(i.config)),r.add(xM(i.unsafe)),r.add(LM()),r.add(SM(i.completion)),i.abort&&r.add(yM(i.abort)),i.progress&&r.add(OM(i.progress)),i.timeout&&r.add(RM(i.timeout)),i.spawnOptions&&r.add(IM(i.spawnOptions)),r.add(jy(FM(!0))),i.errors&&r.add(jy(i.errors)),AM(r,i.binary,(n=i.unsafe)==null?void 0:n.allowUnsafeCustomBinary),new jM(i,r)}Gi();var Nw=DM;v();var $w=require("obsidian"),_l="YYYY-MM-DD",jh=`${_l} HH:mm`,Dh=`${_l} HH:mm:ss`,Sl=40,Vi="conflict-files-obsidian-git.md",Mn={commitMessage:"vault backup: {{date}}",commitDateFormat:Dh,autoSaveInterval:0,autoPushInterval:0,autoPullInterval:0,autoPullOnBoot:!1,disablePush:!1,pullBeforePush:!0,disablePopups:!1,disablePopupsForNoChanges:!1,listChangedFilesInMessageBody:!1,showStatusBar:!0,updateSubmodules:!1,syncMethod:"merge",customMessageOnAutoBackup:!1,autoBackupAfterFileChange:!1,treeStructure:!1,refreshSourceControl:$w.Platform.isDesktopApp,basePath:"",differentIntervalCommitAndPush:!1,changedFilesInStatusBar:!1,showedMobileNotice:!1,refreshSourceControlTimer:7e3,showBranchStatusBar:!0,setLastSaveToLastCommit:!1,submoduleRecurseCheckout:!1,gitDir:"",showFileMenu:!0,authorInHistoryView:"hide",dateInHistoryView:!1,lineAuthor:{show:!1,followMovement:"inactive",authorDisplay:"initials",showCommitHash:!1,dateTimeFormatOptions:"date",dateTimeFormatCustomString:jh,dateTimeTimezone:"viewer-local",coloringMaxAge:"1y",colorNew:{r:255,g:150,b:150},colorOld:{r:120,g:160,b:255},textColorCss:"var(--text-muted)",ignoreWhitespace:!1,gutterSpacingFallbackLength:5}},dt={type:"git-view",name:"Source Control",icon:"git-pull-request"},nn={type:"git-history-view",name:"History",icon:"history"},Ct={type:"diff-view",name:"Diff View",icon:"git-pull-request"};v();function Hw(t,e){let n=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:n})}var Wi=class extends Error{constructor(n){super("No network connection available");this.originalError=n}};v();var SS=Ze(a2()),ES=Ze(_S()),ra=require("obsidian"),ip=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function Xt(t,e){let n;if(e){if(e.button===0||e.button===1){let r=ra.Keymap.isModEvent(e);n=t.workspace.getLeaf(r)}}else n=t.workspace.getLeaf(!1);return n}function In(t,e,n,r,i){if(e.button==2){let a=t.vault.getAbstractFileByPath(n);if(a!=null){let s=new ra.Menu;t.workspace.trigger("file-menu",s,a,i,r),s.showAtPosition({x:e.pageX,y:e.pageY})}}}function yr(t){throw new Error("Impossible branch: "+t)}function ap(t){return`rgb(${t.r},${t.g},${t.b})`}function kS(t){var a;let e=(a=SS.fromString(t))==null?void 0:a.toRgbaArray();if(e===void 0)return;let[n,r,i]=e;return{r:n,g:r,b:i}}function AS(t){return t.diff(ra.moment.unix(0),"seconds")}function TS(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function CS(t,e){return(0,ES.default)(t,e,{strict:!0})}function vr(t,e){return new Proxy(t,{get(n,r){return r==="length"?Math.min(e,n.length):n[r]}})}function FS(t,e,n){return t.length<=e?new Array(e-t.length).fill(n).join("")+t:t.substring(t.length-e)}function MS(t,e){if(e<=0)return t;let n=new Array(e).fill(" ").join(""),r=t.substring(e,t.length);return n+r}function sp(t,e,n){return t<=e&&e<=n}function wr(t){let[e,...n]=t.split("/");return[e,n.length===0?void 0:n.join("/")]}function Bt(t){return t.endsWith("/")?t:t.split("/").last().replace(".md","")}function $s(t){return t===1?"1 minute":`${t} minutes`}v();var OS=require("obsidian"),ia=class{constructor(e){this.plugin=e,this.app=e.app}getRelativeVaultPath(e){return this.plugin.settings.basePath?this.plugin.settings.basePath+"/"+e:e}getRelativeRepoPath(e,n=!0){return n&&this.plugin.settings.basePath.length>0?e.substring(this.plugin.settings.basePath.length+1):e}_getTreeStructure(e,n=0){let r=[];for(e=[...e];e.length>0;){let i=e.first(),a=i.path.substring(n);if(a.contains("/")){let s=a.substring(0,a.indexOf("/")),o=e.filter(c=>c.path.substring(n).startsWith(s+"/"));o.forEach(c=>e.remove(c));let l=i.path.substring(0,a.indexOf("/")+n);r.push({title:s,path:l,vaultPath:this.getRelativeVaultPath(l),children:this._getTreeStructure(o,(n>0?n+s.length:s.length)+1)})}else r.push({title:a,data:i,path:i.path,vaultPath:this.getRelativeVaultPath(i.path)}),e.remove(i)}return r}simplify(e){var n,r,i,a;for(let s of e){for(;;){let o=((n=s.children)==null?void 0:n.length)==1,l=((i=(r=s.children)==null?void 0:r.first())==null?void 0:i.data)==null;if(!(s.children!=null&&o&&l))break;let c=s.children.first();s.title+="/"+c.title,s.data=c.data,s.path=c.path,s.vaultPath=c.vaultPath,s.children=c.children}s.children!=null&&this.simplify(s.children),(a=s.children)==null||a.sort((o,l)=>{let c=(l.data==null?1:0)-(o.data==null?1:0);return c!=0?c:o.title.localeCompare(l.title)})}return e.sort((s,o)=>{let l=(o.data==null?1:0)-(s.data==null?1:0);return l!=0?l:s.title.localeCompare(o.title)})}getTreeStructure(e){let n=this._getTreeStructure(e);return this.simplify(n)}async formatCommitMessage(e){let n;if(e.includes("{{numFiles}}")){n=await this.status();let r=n.staged.length;e=e.replace("{{numFiles}}",String(r))}if(e.includes("{{hostname}}")){let r=this.plugin.localStorage.getHostname()||"";e=e.replace("{{hostname}}",r)}if(e.includes("{{files}}")){n=n!=null?n:await this.status();let r={},i="";if(n.staged.length<100){n.staged.forEach(s=>{s.index in r?r[s.index].push(s.path):r[s.index]=[s.path]});let a=[];for(let[s,o]of Object.entries(r))a.push(s+" "+o.join(" "));i=a.join(", ")}else i="Too many files to list";e=e.replace("{{files}}",i)}if(e=e.replace("{{date}}",(0,OS.moment)().format(this.plugin.settings.commitDateFormat)),this.plugin.settings.listChangedFilesInMessageBody){let r=n!=null?n:await this.status(),i="";r.staged.length<100?i=r.staged.map(a=>a.path).join(` `):i="Too many files to list",e=e+` Affected files: `+i}return e}};var Le=class extends ia{constructor(e){super(e)}async setGitInstance(e=!1){if(this.isGitInstalled()){let n=this.app.vault.adapter,r=n.getBasePath(),i=r;this.plugin.settings.basePath&&(await n.exists((0,Jr.normalizePath)(this.plugin.settings.basePath))?i=vt.join(r,this.plugin.settings.basePath):e||new Jr.Notice("ObsidianGit: Base path does not exist")),this.absoluteRepoPath=i,this.git=Nw({baseDir:i,binary:this.plugin.localStorage.getGitPath()||void 0,config:["core.quotepath=off"]});let a=this.plugin.localStorage.getPATHPaths(),s=this.plugin.localStorage.getEnvVars(),o=this.plugin.settings.gitDir;if(a.length>0){let l=process.env.PATH+":"+a.join(":");process.env.PATH=l}o&&(process.env.GIT_DIR=o);for(let l of s){let[c,u]=l.split("=");process.env[c]=u}if(LS.default.enable("simple-git"),await this.git.checkIsRepo()){let l=await this.git.revparse("--show-cdup"),c=(0,Hs.resolve)(i+Hs.sep+l);this.absoluteRepoPath=c,await this.git.cwd(c)}}}getRelativeVaultPath(e){let r=this.app.vault.adapter.getBasePath(),i=vt.join(this.absoluteRepoPath,e),a=vt.relative(r,i);return Jr.Platform.isWin&&(a=a.replace(/\\/g,"/")),a}getRelativeRepoPath(e,n=!0){if(n){let i=this.plugin.app.vault.adapter.getBasePath(),a=this.absoluteRepoPath,s=vt.join(i,e),o=vt.relative(a,s);return Jr.Platform.isWin&&(o=o.replace(/\\/g,"/")),o}return e}async status(){this.plugin.setPluginState({gitAction:1});let e=await this.git.status();this.plugin.setPluginState({gitAction:0});let n=e.files.map(r=>{let i=this.formatPath(r);return{path:i.path,from:i.from,index:r.index==="?"?"U":r.index,working_dir:r.working_dir==="?"?"U":r.working_dir,vault_path:this.getRelativeVaultPath(i.path)}});return{all:n,changed:n.filter(r=>r.working_dir!==" "),staged:n.filter(r=>r.index!==" "&&r.index!="U"),conflicted:e.conflicted.map(r=>this.formatPath({path:r}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(e){let n=this.getRelativeRepoPath(e),i=["-C",vt.dirname(n),"rev-parse","HEAD"],a=this.git.raw(i);return a.catch(s=>console.warn("obsidian-git: rev-parse error:",s)),a}async getSubmodulePaths(){return new Promise(e=>{this.git.outputHandler((n,r,i,a)=>{if(!(a.contains("submodule")&&a.contains("foreach")))return;let s="",o=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");r.on("data",l=>{s+=l.toString("utf8")}),r.on("end",()=>{let c=s.split(` `).map(u=>{let f=u.match(/'([^']*)'/);if(f!=null)return o+"/"+f[1]+Hs.sep}).filter(u=>!!u);c.reverse(),e(c)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},n=>this.plugin.displayError(n))})}formatPath(e,n=!1){function r(i){if(i!=null)return i.startsWith('"')&&i.endsWith('"')?i.substring(1,i.length-1):i}return n?{from:r(e.from),path:r(e.path)}:{path:r(e.path)}}async blame(e,n,r){if(e=this.getRelativeRepoPath(e),!await this.isTracked(e))return"untracked";let i=await this.getSubmoduleOfFile(e),a=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:e;a.push("blame","--porcelain"),r&&a.push("-w");let o=`-C${Sl}`;switch(n){case"inactive":break;case"same-commit":a.push("-C",o);break;case"all-commits":a.push("-C","-C",o);break;default:yr(n)}a.push("--",s);let l=await this.git.raw(a);return NR(l)}async isTracked(e){let n=await this.getSubmoduleOfFile(e),r=n?["-C",n.submodule]:[],i=n?n.relativeFilepath:e;return r.push("ls-files","--",i),this.git.raw(r).then(a=>a.trim()!=="")}async commitAll({message:e}){if(this.plugin.settings.updateSubmodules){this.plugin.setPluginState({gitAction:4});let r=await this.getSubmodulePaths();for(let i of r)await this.git.cwd({path:i,root:!1}).add("-A"),await this.git.cwd({path:i,root:!1}).commit(await this.formatCommitMessage(e))}this.plugin.setPluginState({gitAction:3}),await this.git.add("-A"),this.plugin.setPluginState({gitAction:4});let n=await this.git.commit(await this.formatCommitMessage(e));return this.app.workspace.trigger("obsidian-git:head-change"),n.summary.changes}async commit({message:e,amend:n}){this.plugin.setPluginState({gitAction:4});let r=(await this.git.commit(await this.formatCommitMessage(e),n?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),this.plugin.setPluginState({gitAction:0}),r}async stage(e,n){this.plugin.setPluginState({gitAction:3}),e=this.getRelativeRepoPath(e,n),await this.git.add(["--",e]),this.plugin.setPluginState({gitAction:0})}async stageAll({dir:e}){this.plugin.setPluginState({gitAction:3}),await this.git.add(e!=null?e:"-A"),this.plugin.setPluginState({gitAction:0})}async unstageAll({dir:e}){this.plugin.setPluginState({gitAction:3}),await this.git.reset(e!=null?["--",e]:[]),this.plugin.setPluginState({gitAction:0})}async unstage(e,n){this.plugin.setPluginState({gitAction:3}),e=this.getRelativeRepoPath(e,n),await this.git.reset(["--",e]),this.plugin.setPluginState({gitAction:0})}async discard(e){this.plugin.setPluginState({gitAction:3}),await this.isTracked(e)?await this.git.checkout(["--",e]):await this.app.vault.adapter.rmdir(this.getRelativeVaultPath(e),!0),this.plugin.setPluginState({gitAction:0})}async hashObject(e){e=this.getRelativeRepoPath(e);let n=await this.getSubmoduleOfFile(e),r=n?["-C",n.submodule]:[],i=n?n.relativeFilepath:e;return r.push("hash-object","--",i),this.git.raw(r)}async discardAll({dir:e}){return this.discard(e!=null?e:".")}async pull(){this.plugin.setPluginState({gitAction:2});try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let e=await this.branchInfo(),n=await this.git.revparse([e.current]);if(!e.tracking&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring pull of main repo and updating submodules only.");return}await this.git.fetch();let r=await this.git.revparse([e.tracking]);if(n!==r){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{switch(this.plugin.settings.syncMethod){case"merge":await this.git.merge([e.tracking]);break;case"rebase":await this.git.rebase([e.tracking])}}catch(s){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${"message"in s?s.message:s}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${e.current}`,r]),await this.unstageAll({})}catch(s){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${"message"in s?s.message:s}`)}this.app.workspace.trigger("obsidian-git:head-change");let i=await this.git.revparse([e.current]);return(await this.git.diff([`${n}..${i}`,"--name-only"])).split(/\r\n|\r|\n/).filter(s=>s.length>0).map(s=>({path:s,working_dir:"P",vault_path:this.getRelativeVaultPath(s)}))}else return[]}catch(e){this.convertErrors(e)}}async push(){this.plugin.setPluginState({gitAction:5});try{if(this.plugin.settings.updateSubmodules){let a=await this.git.env({...process.env,OBSIDIAN_GIT:1}).subModule(["foreach","--recursive",`tracking=$(git for-each-ref --format='%(upstream:short)' "$(git symbolic-ref -q HEAD)"); echo $tracking; if [ ! -z "$(git diff --shortstat $tracking)" ]; then git push; fi`]);console.log(a)}let e=await this.git.status(),n=e.tracking,r=e.current;if(!n&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring push of main repo and updating submodules only.");return}let i=(await this.git.diffSummary([r,n,"--"])).changed;return await this.git.env({...process.env,OBSIDIAN_GIT:1}).push(),i}catch(e){this.convertErrors(e)}}async getUnpushedCommits(){let e=await this.git.status(),n=e.tracking,r=e.current;return n==null||r==null?0:(await this.git.diffSummary([r,n,"--"])).changed}async canPush(){if(this.plugin.settings.updateSubmodules===!0)return!0;let e=await this.git.status(),n=e.tracking,r=e.current;return n?(await this.git.diffSummary([r,n,"--"])).changed!==0:!1}async checkRequirements(){return this.isGitInstalled()?await this.git.checkIsRepo()?"valid":"missing-repo":"missing-git"}async branchInfo(){let e=await this.git.status(),n=await this.git.branch(["--no-color"]);return{current:e.current||void 0,tracking:e.tracking||void 0,branches:n.all}}async getRemoteUrl(e){try{return await this.git.remote(["get-url",e])||void 0}catch(n){if(String(n).contains(e))return;throw n}}async log(e,n=!0,r){let i;return e&&(i=this.getRelativeRepoPath(e,n)),(await this.git.log({file:i,maxCount:r,"-m":null,"--name-status":null})).all.map(s=>{var o,l,c,u;return{...s,author:{name:s.author_name,email:s.author_email},refs:s.refs.split(", ").filter(f=>f.length>0),diff:{...s.diff,files:(l=(o=s.diff)==null?void 0:o.files.map(f=>({...f,status:f.status,path:f.file,hash:s.hash,vault_path:this.getRelativeVaultPath(f.file)})))!=null?l:[]},fileName:(u=(c=s.diff)==null?void 0:c.files.first())==null?void 0:u.file}})}async show(e,n,r=!0){let i=this.getRelativeRepoPath(n,r);return this.git.show([e+":"+i])}async checkout(e,n){if(n&&(e=`${n}/${e}`),await this.git.checkout(e),this.plugin.settings.submoduleRecurseCheckout){let r=await this.getSubmodulePaths();for(let i of r){let a=await this.git.cwd({path:i,root:!1}).branch();Object.keys(a.branches).includes(e)&&await this.git.cwd({path:i,root:!1}).checkout(e)}}}async createBranch(e){await this.git.checkout(["-b",e])}async deleteBranch(e,n){await this.git.branch([n?"-D":"-d",e])}async branchIsMerged(e){return!(await this.git.branch(["--no-merged"])).all.contains(e)}async init(){await this.git.init(!1)}async clone(e,n,r){await this.git.clone(e,vt.join(this.app.vault.adapter.getBasePath(),n),r?["--depth",`${r}`]:[])}async setConfig(e,n){n==null?await this.git.raw(["config","--local","--unset",e]):await this.git.addConfig(e,n)}async getConfig(e){let r=(await this.git.listConfig("local")).all[e];if(typeof r=="string")return r;throw new Error("Config value is not a string")}async fetch(e){await this.git.fetch(e!=null?[e]:[])}async setRemote(e,n){(await this.getRemotes()).includes(e)?await this.git.remote(["set-url",e,n]):await this.git.remote(["add",e,n])}async getRemoteBranches(e){let n=await this.git.branch(["-r","--list",`${e}*`]),r=[];for(let i in n.branches)r.push(n.branches[i].name);return r}async getRemotes(){let e=await this.git.remote([]);return e?e.trim().split(` `):[]}async removeRemote(e){await this.git.removeRemote(e)}async updateUpstreamBranch(e){try{await this.git.branch(["--set-upstream-to",e])}catch(n){console.error(n);try{await this.git.branch(["--set-upstream",e])}catch(r){console.error(r),await this.git.push(["--set-upstream",...wr(e)])}}}updateGitPath(e){return this.setGitInstance()}updateBasePath(e){return this.setGitInstance(!0)}async getDiffString(e,n=!1,r){return n?await this.git.diff(["--cached","--",e]):r?await this.git.show([`${r}`,"--",e]):await this.git.diff(["--",e])}async diff(e,n,r){return await this.git.diff([`${n}..${r}`,"--",e])}async getSubmoduleOfFile(e){if(!await this.app.vault.adapter.exists(vt.dirname(e)))return;let n=await this.git.raw(["-C",vt.dirname(e),"rev-parse","--show-toplevel"],o=>o&&console.warn("get-submodule-of-file",o==null?void 0:o.message));if(n=n.trim(),(await this.git.raw(["-C",vt.dirname(e),"rev-parse","--show-superproject-working-tree"],o=>o&&console.warn("get-submodule-of-file",o==null?void 0:o.message))).trim()==="")return;let a=this.app.vault.adapter.getFullPath(vt.normalize(e)),s=vt.relative(n,a);return{submodule:n,relativeFilepath:s}}async getLastCommitTime(){let e=await this.git.log({n:1});if(e!=null&&e.latest!=null)return new Date(e.latest.date)}isGitInstalled(){let e=(0,RS.spawnSync)(this.plugin.localStorage.getGitPath()||"git",["--version"],{stdio:"ignore"});return e.error?(console.error(e.error),!1):!0}convertErrors(e){if(e instanceof dn){let n=String(e.message);if(n.contains("Could not resolve host")||n.contains("Unable to resolve host")||n.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||n.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||n.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new Wi(n)}throw e}},jS={hash:"000000",isZeroCommit:!0,summary:""};function NR(t){let n=t.replace(`\r `,` `).split(` `),r={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},i=1;for(let a=0;a=4&&n.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(t[2])!==e)throw Error(`git-blame output is out of order: ${e} vs ${t[2]}`);return r}function HR(t,e,n){let r=t[0],i=t.slice(1).join(" "),a=e.hashPerLine[n],s=e.commits.get(a)||{hash:a,author:{},committer:{},previous:{}};switch(r){case"summary":s.summary=i;break;case"author":s.author.name=i;break;case"author-mail":s.author.email=IS(i);break;case"author-time":s.author.epochSeconds=parseInt(i);break;case"author-tz":s.author.tz=i;break;case"committer":s.committer.name=i;break;case"committer-mail":s.committer.email=IS(i);break;case"committer-time":s.committer.epochSeconds=parseInt(i);break;case"committer-tz":s.committer.tz=i;break;case"previous":s.previous.commitHash=i;break;case"filename":s.previous.filename=i;break}e.commits.set(a,s)}function UR(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);op(t.author)&&(t.author=void 0),op(t.committer)&&(t.committer=void 0),op(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function op(t){return!t||Object.keys(t).length===0}function PS(t){return t.length>0&&t[0].trim()===t[0]}function IS(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}v();var vE=require("@codemirror/state");v();var KS=require("@codemirror/state"),kc=require("obsidian");v();var lp=class{constructor(){this.eventsPerFilepath=new Map;this.startRemoveStalesSubscribersInterval()}ifFilepathDefinedTransformSubscribers(e,n){if(e)return this.ensureInitialized(e),n(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(n=>n.forEach(e))}ensureInitialized(e){this.eventsPerFilepath.get(e)||this.eventsPerFilepath.set(e,new Set)}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(e=>e==null?void 0:e.removeIfStale()),6e4)}clear(){window.clearInterval(this.removeStalesSubscribersTimer),this.eventsPerFilepath.clear()}},aa=new lp;v();var _c=require("@codemirror/state"),WS=Ze(cp());v();var V=require("obsidian");v();v();function gn(){}gn.prototype={diff:function(e,n){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=i.callback;typeof i=="function"&&(a=i,i={});var s=this;function o(k){return k=s.postProcess(k,i),a?(setTimeout(function(){a(k)},0),!0):k}e=this.castInput(e,i),n=this.castInput(n,i),e=this.removeEmpty(this.tokenize(e,i)),n=this.removeEmpty(this.tokenize(n,i));var l=n.length,c=e.length,u=1,f=l+c;i.maxEditLength!=null&&(f=Math.min(f,i.maxEditLength));var h=(r=i.timeout)!==null&&r!==void 0?r:1/0,d=Date.now()+h,p=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(p[0],n,e,0,i);if(p[0].oldPos+1>=c&&g+1>=l)return o(DS(s,p[0].lastComponent,n,e,s.useLongestToken));var m=-1/0,w=1/0;function b(){for(var k=Math.max(m,-u);k<=Math.min(w,u);k+=2){var x=void 0,A=p[k-1],y=p[k+1];A&&(p[k-1]=void 0);var E=!1;if(y){var _=y.oldPos-k;E=y&&0<=_&&_=c&&g+1>=l)return o(DS(s,x.lastComponent,n,e,s.useLongestToken));p[k]=x,x.oldPos+1>=c&&(w=Math.min(w,k-1)),g+1>=l&&(m=Math.max(m,k+1))}u++}if(a)(function k(){setTimeout(function(){if(u>f||Date.now()>d)return a();b()||k()},0)})();else for(;u<=f&&Date.now()<=d;){var S=b();if(S)return S}},addToPath:function(e,n,r,i,a){var s=e.lastComponent;return s&&!a.oneChangePerToken&&s.added===n&&s.removed===r?{oldPos:e.oldPos+i,lastComponent:{count:s.count+1,added:n,removed:r,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:s}}},extractCommon:function(e,n,r,i,a){for(var s=n.length,o=r.length,l=e.oldPos,c=l-i,u=0;c+1d.length?g:d}),f.value=t.join(h)}else f.value=t.join(n.slice(c,c+f.count));c+=f.count,f.added||(u+=f.count)}}return a}var d$=new gn;function BS(t,e){var n;for(n=0;ne.length&&(n=t.length-e.length);var r=e.length;t.length0&&e[s]!=e[a];)a=i[a];e[s]==e[a]&&a++}a=0;for(var o=n;o0&&t[o]!=e[a];)a=i[a];t[o]==e[a]&&a++}return a}var pc="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",GR=new RegExp("[".concat(pc,"]+|\\s+|[^").concat(pc,"]"),"ug"),gc=new gn;gc.equals=function(t,e,n){return n.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t.trim()===e.trim()};gc.tokenize=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n;if(e.intlSegmenter){if(e.intlSegmenter.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');n=Array.from(e.intlSegmenter.segment(t),function(a){return a.segment})}else n=t.match(GR)||[];var r=[],i=null;return n.forEach(function(a){/\s/.test(a)?i==null?r.push(a):r.push(r.pop()+a):/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+a):r.push(i+a):r.push(a),i=a}),r};gc.join=function(t){return t.map(function(e,n){return n==0?e:e.replace(/^\s+/,"")}).join("")};gc.postProcess=function(t,e){if(!t||e.oneChangePerToken)return t;var n=null,r=null,i=null;return t.forEach(function(a){a.added?r=a:a.removed?i=a:((r||i)&&HS(n,i,r,a),n=a,r=null,i=null)}),(r||i)&&HS(n,i,r,null),t};function HS(t,e,n,r){if(e&&n){var i=e.value.match(/^\s*/)[0],a=e.value.match(/\s*$/)[0],s=n.value.match(/^\s*/)[0],o=n.value.match(/\s*$/)[0];if(t){var l=BS(i,s);t.value=hp(t.value,s,l),e.value=Us(e.value,l),n.value=Us(n.value,l)}if(r){var c=NS(a,o);r.value=fp(r.value,o,c),e.value=dc(e.value,c),n.value=dc(n.value,c)}}else if(n)t&&(n.value=n.value.replace(/^\s*/,"")),r&&(r.value=r.value.replace(/^\s*/,""));else if(t&&r){var u=r.value.match(/^\s*/)[0],f=e.value.match(/^\s*/)[0],h=e.value.match(/\s*$/)[0],d=BS(u,f);e.value=Us(e.value,d);var p=NS(Us(u,d),h);e.value=dc(e.value,p),r.value=fp(r.value,u,p),t.value=hp(t.value,u,u.slice(0,u.length-p.length))}else if(r){var g=r.value.match(/^\s*/)[0],m=e.value.match(/\s*$/)[0],w=$S(m,g);e.value=dc(e.value,w)}else if(t){var b=t.value.match(/\s*$/)[0],S=e.value.match(/^\s*/)[0],k=$S(b,S);e.value=Us(e.value,k)}}var VR=new gn;VR.tokenize=function(t){var e=new RegExp("(\\r?\\n)|[".concat(pc,"]+|[^\\S\\n\\r]+|[^").concat(pc,"]"),"ug");return t.match(e)||[]};var yc=new gn;yc.tokenize=function(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,` `));var n=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(var i=0;it.length)&&(e=t.length);for(var n=0,r=new Array(e);n0?f(L.lines.slice(-s.context)):[],d-=g.length,p-=g.length)}(M=g).push.apply(M,up(C.map(function(he){return(_.added?"+":"-")+he}))),_.added?w+=C.length:m+=C.length}else{if(d)if(C.length<=s.context*2&&S{this.resolve=e,this.open()})}onClose(){new Promise(e=>setTimeout(e,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(e){return this.config.onlySelection?this.config.options:this.config.allowEmpty?[e.length>0?e:" ",...this.config.options]:[e.length>0?e:"...",...this.config.options]}renderSuggestion(e,n){n.setText(e)}onChooseSuggestion(e,n){if(this.resolve){let r;this.config.allowEmpty&&e===" "?r="":e==="..."?r=void 0:r=e,this.resolve(r)}}};v();var br=require("obsidian"),wc=class{constructor(e,n){this.plugin=n;this.promises={};this.adapter=e.adapter,this.vault=e,this.lastBasePath=this.plugin.settings.basePath,this.promises.readFile=this.readFile.bind(this),this.promises.writeFile=this.writeFile.bind(this),this.promises.readdir=this.readdir.bind(this),this.promises.mkdir=this.mkdir.bind(this),this.promises.rmdir=this.rmdir.bind(this),this.promises.stat=this.stat.bind(this),this.promises.unlink=this.unlink.bind(this),this.promises.lstat=this.lstat.bind(this),this.promises.readlink=this.readlink.bind(this),this.promises.symlink=this.symlink.bind(this)}async readFile(e,n){var r;if(this.maybeLog("Read: "+e+JSON.stringify(n)),n=="utf8"||n.encoding=="utf8"){let i=this.vault.getAbstractFileByPath(e);return i instanceof br.TFile?(this.maybeLog("Reuse"),this.vault.read(i)):this.adapter.read(e)}else{if(e.endsWith(this.gitDir+"/index"))return this.plugin.settings.basePath!=this.lastBasePath?(this.clearIndex(),this.lastBasePath=this.plugin.settings.basePath,this.adapter.readBinary(e)):(r=this.index)!=null?r:this.adapter.readBinary(e);let i=this.vault.getAbstractFileByPath(e);return i instanceof br.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(i)):this.adapter.readBinary(e)}}async writeFile(e,n){if(this.maybeLog("Write: "+e),typeof n=="string"){let r=this.vault.getAbstractFileByPath(e);return r instanceof br.TFile?this.vault.modify(r,n):this.adapter.write(e,n)}else if(e.endsWith(this.gitDir+"/index"))this.index=n,this.indexmtime=Date.now();else{let r=this.vault.getAbstractFileByPath(e);return r instanceof br.TFile?this.vault.modifyBinary(r,n):this.adapter.writeBinary(e,n)}}async readdir(e){e==="."&&(e="/");let n=await this.adapter.list(e),r=[...n.files,...n.folders],i;return e!=="/"?i=r.map(a=>(0,br.normalizePath)(a.substring(e.length))):i=r,i}async mkdir(e){return this.adapter.mkdir(e)}async rmdir(e,n){var r,i;return this.adapter.rmdir(e,(i=(r=n==null?void 0:n.options)==null?void 0:r.recursive)!=null?i:!1)}async stat(e){if(e.endsWith(this.gitDir+"/index")){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.length,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let r=await this.adapter.stat(e);if(r==null)throw{code:"ENOENT"};return this.indexctime=r.ctime,this.indexmtime=r.mtime,{ctimeMs:r.ctime,mtimeMs:r.mtime,size:r.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let n=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),n instanceof br.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:n.stat.ctime,mtimeMs:n.stat.mtime,size:n.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let r=await this.adapter.stat(e);if(r)return{ctimeMs:r.ctime,mtimeMs:r.mtime,size:r.size,type:r.type==="folder"?"directory":r.type,isFile:()=>r.type==="file",isDirectory:()=>r.type==="folder",isSymbolicLink:()=>!1};throw{code:"ENOENT"}}}async unlink(e){return this.adapter.remove(e)}async lstat(e){return this.stat(e)}async readlink(e){throw new Error(`readlink of (${e}) is not implemented.`)}async symlink(e){throw new Error(`symlink of (${e}) is not implemented.`)}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index"),this.index,{ctime:this.indexctime,mtime:this.indexmtime}),this.clearIndex()}clearIndex(){this.index=void 0,this.indexctime=void 0,this.indexmtime=void 0}get gitDir(){return this.plugin.settings.gitDir||".git"}maybeLog(e){}};var yn=class extends ia{constructor(n){super(n);this.FILE=0;this.HEAD=1;this.WORKDIR=2;this.STAGE=3;this.status_mapping={"000":" ","003":"AD","020":"??","022":"A ","023":"AM",100:"D ",101:" D",103:"MD",110:"DA",111:" ",113:"MM",120:"DA",121:" M",122:"M ",123:"MM"};this.noticeLength=999999;this.fs=new wc(this.app.vault,this.plugin)}getRepo(){return{fs:this.fs,dir:this.plugin.settings.basePath,gitdir:this.plugin.settings.gitDir||void 0,onAuth:()=>{var n,r;return{username:(n=this.plugin.localStorage.getUsername())!=null?n:void 0,password:(r=this.plugin.localStorage.getPassword())!=null?r:void 0}},onAuthFailure:async()=>{new Qr.Notice("Authentication failed. Please try with different credentials");let n=await new Xe(this.plugin,{placeholder:"Specify your username"}).openAndGetResult();if(n){let r=await new Xe(this.plugin,{placeholder:"Specify your password/personal access token"}).openAndGetResult();if(r)return this.plugin.localStorage.setUsername(n),this.plugin.localStorage.setPassword(r),{username:n,password:r}}return{cancel:!0}},http:{async request({url:n,method:r,headers:i,body:a}){let s;a&&(s=(await oL(a)).buffer);let o=await(0,Qr.requestUrl)({url:n,method:r,headers:i,body:s,throw:!1});return{url:n,method:r,headers:o.headers,body:[new Uint8Array(o.arrayBuffer)],statusCode:o.status,statusMessage:o.status.toString()}}}}}async wrapFS(n){try{let r=await n;return await this.fs.saveAndClear(),r}catch(r){throw await this.fs.saveAndClear(),r}}async status(){let n,r=window.setTimeout(()=>{n=new Qr.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{this.plugin.setPluginState({gitAction:1});let i=(await this.wrapFS(ae.statusMatrix({...this.getRepo()}))).map(l=>this.getFileStatusResult(l)),a=i.filter(l=>l.working_dir!==" "),s=i.filter(l=>l.index!==" "&&l.index!=="U"),o=[];return window.clearTimeout(r),n==null||n.hide(),{all:i,changed:a,staged:s,conflicted:o}}catch(i){throw window.clearTimeout(r),n==null||n.hide(),this.plugin.displayError(i),i}}async commitAll({message:n,status:r,unstagedFiles:i}){try{return await this.checkAuthorInfo(),await this.stageAll({status:r,unstagedFiles:i}),this.commit({message:n})}catch(a){throw this.plugin.displayError(a),a}}async commit({message:n}){try{await this.checkAuthorInfo(),this.plugin.setPluginState({gitAction:4});let r=await this.formatCommitMessage(n),i=this.plugin.localStorage.getConflict(),a;if(i){let s=await this.branchInfo();a=[s.current,s.tracking]}await this.wrapFS(ae.commit({...this.getRepo(),message:r,parent:a})),this.plugin.localStorage.setConflict(!1);return}catch(r){throw this.plugin.displayError(r),r}}async stage(n,r){let i=this.getRelativeRepoPath(n,r),a;r?a=n:a=this.getRelativeVaultPath(n);try{this.plugin.setPluginState({gitAction:3}),await this.app.vault.adapter.exists(a)?await this.wrapFS(ae.add({...this.getRepo(),filepath:i})):await this.wrapFS(ae.remove({...this.getRepo(),filepath:i}))}catch(s){throw this.plugin.displayError(s),s}}async stageAll({dir:n,status:r,unstagedFiles:i}){try{if(r)await Promise.all(r.changed.map(a=>a.working_dir!=="D"?this.wrapFS(ae.add({...this.getRepo(),filepath:a.path})):ae.remove({...this.getRepo(),filepath:a.path})));else{let a=i!=null?i:await this.getUnstagedFiles(n!=null?n:".");await Promise.all(a.map(({filepath:s,deleted:o})=>o?ae.remove({...this.getRepo(),filepath:s}):this.wrapFS(ae.add({...this.getRepo(),filepath:s}))))}}catch(a){throw this.plugin.displayError(a),a}}async unstage(n,r){try{this.plugin.setPluginState({gitAction:3}),n=this.getRelativeRepoPath(n,r),await this.wrapFS(ae.resetIndex({...this.getRepo(),filepath:n}))}catch(i){throw this.plugin.displayError(i),i}}async unstageAll({dir:n,status:r}){try{let i;r?i=r.staged.map(a=>a.path):i=(await this.getStagedFiles(n!=null?n:".")).map(({filepath:s})=>s),await this.wrapFS(Promise.all(i.map(a=>ae.resetIndex({...this.getRepo(),filepath:a}))))}catch(i){throw this.plugin.displayError(i),i}}async discard(n){try{this.plugin.setPluginState({gitAction:3}),await this.wrapFS(ae.checkout({...this.getRepo(),filepaths:[n],force:!0}))}catch(r){throw this.plugin.displayError(r),r}}async discardAll({dir:n,status:r}){let i=[];r?n!=null?i=r.changed.filter(a=>a.path.startsWith(n)).map(a=>a.path):i=r.changed.map(a=>a.path):i=(await this.getUnstagedFiles(n)).map(({filepath:a})=>a);try{await this.wrapFS(ae.checkout({...this.getRepo(),filepaths:i,force:!0}))}catch(a){throw this.plugin.displayError(a),a}}getProgressText(n,r){let i=`${n} progress:`;return r.phase&&(i=`${i} ${r.phase}:`),r.loaded&&(i=`${i} ${r.loaded}`,r.total&&(i=`${i} of ${r.total}`)),i}resolveRef(n){return this.wrapFS(ae.resolveRef({...this.getRepo(),ref:n}))}async pull(){let n=this.showNotice("Initializing pull");try{this.plugin.setPluginState({gitAction:2});let r=await this.resolveRef("HEAD");await this.fetch();let i=await this.branchInfo();await this.checkAuthorInfo(),(await this.wrapFS(ae.merge({...this.getRepo(),ours:i.current,theirs:i.tracking,abortOnConflict:!1}))).alreadyMerged||await this.wrapFS(ae.checkout({...this.getRepo(),ref:i.current,onProgress:l=>{n!==void 0&&(n.noticeEl.innerText=this.getProgressText("Checkout",l))},remote:i.remote})),n==null||n.hide();let s=await this.resolveRef("HEAD"),o=await this.getFileChangesCount(r,s);return this.showNotice("Finished pull",!1),o.map(l=>({path:l.path,working_dir:"P",index:"P",vault_path:this.getRelativeVaultPath(l.path)}))}catch(r){throw n==null||n.hide(),r instanceof hs.MergeConflictError&&await this.plugin.handleConflict(r.data.filepaths.map(i=>this.getRelativeVaultPath(i))),this.plugin.displayError(r),r}}async push(){if(!await this.canPush())return 0;let n=this.showNotice("Initializing push");try{this.plugin.setPluginState({gitAction:1});let r=await this.branchInfo(),i=r.tracking,a=r.current,s=(await this.getFileChangesCount(a,i)).length;return this.plugin.setPluginState({gitAction:5}),await this.wrapFS(ae.push({...this.getRepo(),onProgress:o=>{n!==void 0&&(n.noticeEl.innerText=this.getProgressText("Pushing",o))}})),n==null||n.hide(),s}catch(r){throw n==null||n.hide(),this.plugin.displayError(r),r}}async getUnpushedCommits(){let n=await this.branchInfo(),r=n.tracking,i=n.current;if(r==null||i==null)return 0;let a=await this.resolveRef(i),s=await this.resolveRef(r);return(await this.getFileChangesCount(a,s)).length}async canPush(){let n=await this.branchInfo(),r=n.tracking,i=n.current,a=await this.resolveRef(i),s=await this.resolveRef(r);return a!=s}async checkRequirements(){return await this.plugin.app.vault.adapter.exists(`${this.getRepo().dir}/.git/HEAD`)?"valid":"missing-repo"}async branchInfo(){var n,r;try{let i=await ae.currentBranch(this.getRepo())||"",a=await ae.listBranches(this.getRepo()),s=(n=await this.getConfig(`branch.${i}.remote`))!=null?n:"origin",o=(r=await this.getConfig(`branch.${i}.merge`))==null?void 0:r.split("refs/heads")[1],l=o?s+o:void 0;return{current:i,tracking:l,branches:a,remote:s}}catch(i){throw this.plugin.displayError(i),i}}async getCurrentRemote(){var i;let n=await ae.currentBranch(this.getRepo())||"";return(i=await this.getConfig(`branch.${n}.remote`))!=null?i:"origin"}async checkout(n,r){try{return this.wrapFS(ae.checkout({...this.getRepo(),ref:n,force:!!r,remote:r}))}catch(i){throw this.plugin.displayError(i),i}}async createBranch(n){try{await this.wrapFS(ae.branch({...this.getRepo(),ref:n,checkout:!0}))}catch(r){throw this.plugin.displayError(r),r}}async deleteBranch(n){try{await this.wrapFS(ae.deleteBranch({...this.getRepo(),ref:n}))}catch(r){throw this.plugin.displayError(r),r}}branchIsMerged(n){return Promise.resolve(!0)}async init(){try{await this.wrapFS(ae.init(this.getRepo()))}catch(n){throw this.plugin.displayError(n),n}}async clone(n,r,i){let a=this.showNotice("Initializing clone");try{await this.wrapFS(ae.clone({...this.getRepo(),dir:r,url:n,depth:i,onProgress:s=>{a!==void 0&&(a.noticeEl.innerText=this.getProgressText("Cloning",s))}})),a==null||a.hide()}catch(s){throw a==null||a.hide(),this.plugin.displayError(s),s}}async setConfig(n,r){try{return this.wrapFS(ae.setConfig({...this.getRepo(),path:n,value:r}))}catch(i){throw this.plugin.displayError(i),i}}async getConfig(n){try{return this.wrapFS(ae.getConfig({...this.getRepo(),path:n}))}catch(r){throw this.plugin.displayError(r),r}}async fetch(n){let r=this.showNotice("Initializing fetch");try{let i={...this.getRepo(),onProgress:a=>{r!==void 0&&(r.noticeEl.innerText=this.getProgressText("Fetching",a))},remote:n!=null?n:await this.getCurrentRemote()};await this.wrapFS(ae.fetch(i)),r==null||r.hide()}catch(i){throw this.plugin.displayError(i),r==null||r.hide(),i}}async setRemote(n,r){try{await this.wrapFS(ae.addRemote({...this.getRepo(),remote:n,url:r,force:!0}))}catch(i){throw this.plugin.displayError(i),i}}async getRemoteBranches(n){let r=[];return r.push(...await this.wrapFS(ae.listBranches({...this.getRepo(),remote:n}))),r.remove("HEAD"),r=r.map(i=>`${n}/${i}`),r}async getRemotes(){return(await this.wrapFS(ae.listRemotes({...this.getRepo()}))).map(n=>n.remote)}async removeRemote(n){await this.wrapFS(ae.deleteRemote({...this.getRepo(),remote:n}))}async getRemoteUrl(n){var r;return(r=(await this.wrapFS(ae.listRemotes({...this.getRepo()}))).filter(i=>i.remote==n)[0])==null?void 0:r.url}async log(n,r=!0,i){let a=await this.wrapFS(ae.log({...this.getRepo(),depth:i}));return Promise.all(a.map(async s=>{let o=s.commit.message.split(` `);return{message:o[0],author:{name:s.commit.author.name,email:s.commit.author.email},body:o.slice(1).join(` `),date:new Date(s.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(s.commit.parent.first(),s.oid)).map(l=>({path:l.path,status:l.type,vault_path:this.getRelativeVaultPath(l.path),hash:s.oid,binary:void 0}))},hash:s.oid,refs:[]}}))}updateBasePath(n){return this.getRepo().dir=n,Promise.resolve()}async updateUpstreamBranch(n){let[r,i]=wr(n),a=await this.branchInfo();await this.setConfig(`branch.${a.current}.merge`,`refs/heads/${i}`),await this.setConfig(`branch.${i}.remote`,r)}updateGitPath(n){return Promise.resolve()}async getFileChangesCount(n,r){return this.walkDifference({walkers:[ae.TREE({ref:n}),ae.TREE({ref:r})]})}async walkDifference({walkers:n,dir:r}){return await this.wrapFS(ae.walk({...this.getRepo(),trees:n,map:async function(a,[s,o]){if(!ip(a,r))return null;if(await(s==null?void 0:s.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let l=await(s==null?void 0:s.oid()),c=await(o==null?void 0:o.oid()),u="equal";if(l!==c&&(u="M"),l===void 0&&(u="A"),c===void 0&&(u="D"),l===void 0&&c===void 0&&(console.log("Something weird happened:"),console.log(s),console.log(o)),u!=="equal")return{path:a,type:u}}}))}async getStagedFiles(n="."){return(await this.walkDifference({walkers:[ae.TREE({ref:"HEAD"}),ae.STAGE()],dir:n})).map(i=>({vault_path:this.getRelativeVaultPath(i.path),filepath:i.path}))}async getUnstagedFiles(n="."){let r,i=window.setTimeout(()=>{r=new Qr.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let a=this.getRepo(),s=await this.wrapFS(ae.walk({...a,trees:[ae.WORKDIR(),ae.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await ae.isIgnored({...a,filepath:o})||!ip(o,n))return null;let[u,f]=await Promise.all([l&&l.type(),c&&c.type()]),h=[u,f].includes("blob");if((u==="tree"||u==="special")&&!h)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!h)return;let d=f==="blob"?await c.oid():void 0,p;return u==="blob"&&f!=="blob"?p="42":u==="blob"&&(p=await l.oid()),p?p!==d?{filepath:o,deleted:!1}:null:{filepath:o,deleted:!0}}}));return window.clearTimeout(i),r==null||r.hide(),s}catch(a){throw window.clearTimeout(i),r==null||r.hide(),this.plugin.displayError(a),a}}async getDiffString(n,r=!1,i){let a=this.getRelativeVaultPath(n),s=async(c,[u])=>{if(n==c){let f=await u.oid();return(await ae.readBlob({...this.getRepo(),oid:f})).blob}};if(i){let c=await ms({...this.getRepo(),filepath:n,oid:i}).then(d=>new TextDecoder().decode(d.blob)).catch(d=>{if(!(d instanceof ae.Errors.NotFoundError))throw d}),u=await ae.readCommit({...this.getRepo(),oid:i}),f=await ms({...this.getRepo(),filepath:n,oid:u.commit.parent.first()}).then(d=>new TextDecoder().decode(d.blob)).catch(d=>{if(!(d instanceof ae.Errors.NotFoundError))throw d});return vc(a,f!=null?f:"",c!=null?c:"")}let o=(await ae.walk({...this.getRepo(),trees:[ae.STAGE()],map:s})).first(),l=new TextDecoder().decode(o);if(r){let c=await this.resolveRef("HEAD").then(f=>ms({...this.getRepo(),filepath:n,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof ae.Errors.NotFoundError))throw f});return vc(a,c!=null?c:"",l)}else{let c;return await this.app.vault.adapter.exists(a)?c=await this.app.vault.adapter.read(a):c="",vc(a,l,c)}}async getLastCommitTime(){let n=this.getRepo(),r=await this.resolveRef("HEAD"),a=(await ae.readCommit({...n,oid:r})).commit.committer.timestamp;return new Date(a*1e3)}getFileStatusResult(n){let r=this.status_mapping[`${n[this.HEAD]}${n[this.WORKDIR]}${n[this.STAGE]}`];return{index:r[0]=="?"?"U":r[0],working_dir:r[1]=="?"?"U":r[1],path:n[this.FILE],vault_path:this.getRelativeVaultPath(n[this.FILE])}}async checkAuthorInfo(){let n=await this.getConfig("user.name"),r=await this.getConfig("user.email");if(!n||!r)throw Error("Git author information is not set. Please set it in the settings.")}showNotice(n,r=!0){if(!this.plugin.settings.disablePopups)return new Qr.Notice(n,r?this.noticeLength:void 0)}};function iL(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function aL(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:iL(t)}async function sL(t,e){let n=aL(t);for(;;){let{value:r,done:i}=await n.next();if(r&&await e(r),i)break}n.return&&n.return()}async function oL(t){let e=0,n=[];await sL(t,a=>{n.push(a),e+=a.byteLength});let r=new Uint8Array(e),i=0;for(let a of n)r.set(a,i),i+=a.byteLength;return r}var lL="https://momentjs.com/docs/#/parsing/string-format/",cL="https://publish.obsidian.md/git-doc/Line+Authoring",bc=class extends V.PluginSettingTab{constructor(n,r){super(n,r);this.plugin=r;this.lineAuthorColorSettings=new Map}get settings(){return this.plugin.settings}display(){let{containerEl:n}=this,r=this.plugin,i;r.settings.differentIntervalCommitAndPush?i="commit":i="commit-and-sync";let a=r.gitReady;n.empty(),a||(n.createEl("p",{text:"Git is not ready. When all settings are correct you can configure commit-sync, etc."}),n.createEl("br"));let s;if(a){new V.Setting(n).setName("Automatic").setHeading(),new V.Setting(n).setName("Split timers for automatic commit and sync").setDesc("Enable to use one interval for commit and another for sync.").addToggle(u=>u.setValue(r.settings.differentIntervalCommitAndPush).onChange(async f=>{r.settings.differentIntervalCommitAndPush=f,await r.saveSettings(),r.automaticsManager.reload("commit","push"),this.display()})),new V.Setting(n).setName(`Auto ${i} interval (minutes)`).setDesc(`${r.settings.differentIntervalCommitAndPush?"Commit":"Commit and sync"} changes every X minutes. Set to 0 (default) to disable. (See below setting for further configuration!)`).addText(u=>u.setValue(String(r.settings.autoSaveInterval)).onChange(async f=>{isNaN(Number(f))?new V.Notice("Please specify a valid number."):(r.settings.autoSaveInterval=Number(f),await r.saveSettings(),r.automaticsManager.reload("commit"),r.settings.autoSaveInterval>0?new V.Notice(`Automatic ${i} enabled! Every ${$s(r.settings.autoSaveInterval)}.`):r.settings.autoSaveInterval<=0&&new V.Notice(`Automatic ${i} disabled!`))})),s=new V.Setting(n).setName(`Auto ${i} after stopping file edits`).setDesc(`Requires the ${i} interval not to be 0. If turned on, do auto ${i} every ${$s(r.settings.autoSaveInterval)} after stopping file edits. This also prevents auto ${i} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(u=>u.setValue(r.settings.autoBackupAfterFileChange).onChange(async f=>{r.settings.autoBackupAfterFileChange=f,this.display(),await r.saveSettings(),r.automaticsManager.reload("commit")})),this.mayDisableSetting(s,r.settings.setLastSaveToLastCommit),s=new V.Setting(n).setName(`Auto ${i} after latest commit`).setDesc(`If turned on, sets last auto ${i} timestamp to the latest commit timestamp. This reduces the frequency of auto ${i} when doing manual commits.`).addToggle(u=>u.setValue(r.settings.setLastSaveToLastCommit).onChange(async f=>{r.settings.setLastSaveToLastCommit=f,await r.saveSettings(),r.automaticsManager.reload("commit"),this.display()})),this.mayDisableSetting(s,r.settings.autoBackupAfterFileChange),s=new V.Setting(n).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(u=>u.setValue(String(r.settings.autoPushInterval)).onChange(async f=>{isNaN(Number(f))?new V.Notice("Please specify a valid number."):(r.settings.autoPushInterval=Number(f),await r.saveSettings(),r.settings.autoPushInterval>0?(r.automaticsManager.reload("push"),new V.Notice(`Automatic push enabled! Every ${$s(r.settings.autoPushInterval)}.`)):r.settings.autoPushInterval<=0&&new V.Notice("Automatic push disabled!"))})),this.mayDisableSetting(s,!r.settings.differentIntervalCommitAndPush),new V.Setting(n).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(u=>u.setValue(String(r.settings.autoPullInterval)).onChange(async f=>{isNaN(Number(f))?new V.Notice("Please specify a valid number."):(r.settings.autoPullInterval=Number(f),await r.saveSettings(),r.settings.autoPullInterval>0?(r.automaticsManager.reload("pull"),new V.Notice(`Automatic pull enabled! Every ${$s(r.settings.autoPullInterval)}.`)):r.settings.autoPullInterval<=0&&new V.Notice("Automatic pull disabled!"))})),new V.Setting(n).setName(`Specify custom commit message on auto ${i}`).setDesc("You will get a pop up to specify your message.").addToggle(u=>u.setValue(r.settings.customMessageOnAutoBackup).onChange(async f=>{r.settings.customMessageOnAutoBackup=f,await r.saveSettings(),this.display()})),s=new V.Setting(n).setName(`Commit message on auto ${i}`).setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(u=>u.setPlaceholder("vault backup: {{date}}").setValue(r.settings.autoCommitMessage).onChange(async f=>{r.settings.autoCommitMessage=f,await r.saveSettings()})),this.mayDisableSetting(s,r.settings.customMessageOnAutoBackup),new V.Setting(n).setName("Commit message").setHeading(),new V.Setting(n).setName("Commit message on manual commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(u=>u.setPlaceholder("vault backup: {{date}}").setValue(r.settings.commitMessage?r.settings.commitMessage:"").onChange(async f=>{r.settings.commitMessage=f,await r.saveSettings()}));let c=new V.Setting(n).setName("{{date}} placeholder format").addMomentFormat(u=>u.setDefaultFormat(r.settings.commitDateFormat).setValue(r.settings.commitDateFormat).onChange(async f=>{r.settings.commitDateFormat=f,await r.saveSettings()}));c.descEl.innerHTML=` Specify custom date format. E.g. "${Dh}. See Moment.js for more formats.`,new V.Setting(n).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device.").addText(u=>{var f;return u.setValue((f=r.localStorage.getHostname())!=null?f:"").onChange(h=>{r.localStorage.setHostname(h)})}),new V.Setting(n).setName("Preview commit message").addButton(u=>u.setButtonText("Preview").onClick(async()=>{let f=await r.gitManager.formatCommitMessage(r.settings.commitMessage);new V.Notice(`${f}`)})),new V.Setting(n).setName("List filenames affected by commit in the commit body").addToggle(u=>u.setValue(r.settings.listChangedFilesInMessageBody).onChange(async f=>{r.settings.listChangedFilesInMessageBody=f,await r.saveSettings()})),new V.Setting(n).setName("Pull").setHeading(),r.gitManager instanceof Le&&new V.Setting(n).setName("Merge strategy").setDesc("Decide how to integrate commits from your remote branch into your local branch.").addDropdown(u=>{let f={merge:"Merge",rebase:"Rebase",reset:"Other sync service (Only updates the HEAD without touching the working directory)"};u.addOptions(f),u.setValue(r.settings.syncMethod),u.onChange(async h=>{r.settings.syncMethod=h,await r.saveSettings()})}),new V.Setting(n).setName("Pull on startup").setDesc("Automatically pull commits when Obsidian starts.").addToggle(u=>u.setValue(r.settings.autoPullOnBoot).onChange(async f=>{r.settings.autoPullOnBoot=f,await r.saveSettings()})),new V.Setting(n).setName("Commit-and-sync").setDesc("Commit-and-sync with default settings means staging everything -> committing -> pulling -> pushing. Ideally this is a single action that you do regularly to keep your local and remote repository in sync.").setHeading(),s=new V.Setting(n).setName("Push on commit-and-sync").setDesc(`Most of the time you want to push after committing. Turning this off turns a commit-and-sync action into commit ${r.settings.pullBeforePush?"and pull ":""}only. It will still be called commit-and-sync.`).addToggle(u=>u.setValue(!r.settings.disablePush).onChange(async f=>{r.settings.disablePush=!f,this.display(),await r.saveSettings()})),new V.Setting(n).setName("Pull on commit-and-sync").setDesc(`On commit-and-sync, pull commits as well. Turning this off turns a commit-and-sync action into commit ${r.settings.disablePush?"":"and push "}only.`).addToggle(u=>u.setValue(r.settings.pullBeforePush).onChange(async f=>{r.settings.pullBeforePush=f,this.display(),await r.saveSettings()})),r.gitManager instanceof Le&&(new V.Setting(n).setName("Line author information").setHeading(),this.addLineAuthorInfoSettings())}new V.Setting(n).setName("History view").setHeading(),new V.Setting(n).setName("Show Author").setDesc("Show the author of the commit in the history view.").addDropdown(c=>{let u={hide:"Hide",full:"Full",initials:"Initials"};c.addOptions(u),c.setValue(r.settings.authorInHistoryView),c.onChange(async f=>{r.settings.authorInHistoryView=f,await r.saveSettings(),await r.refresh()})}),new V.Setting(n).setName("Show Date").setDesc("Show the date of the commit in the history view. The {{date}} placeholder format is used to display the date.").addToggle(c=>c.setValue(r.settings.dateInHistoryView).onChange(async u=>{r.settings.dateInHistoryView=u,await r.saveSettings(),await r.refresh()})),new V.Setting(n).setName("Source control view").setHeading(),new V.Setting(n).setName("Automatically refresh source control view on file changes").setDesc("On slower machines this may cause lags. If so, just disable this option.").addToggle(c=>c.setValue(r.settings.refreshSourceControl).onChange(async u=>{r.settings.refreshSourceControl=u,await r.saveSettings()})),new V.Setting(n).setName("Source control view refresh interval").setDesc("Milliseconds to wait after file change before refreshing the Source Control View.").addText(c=>c.setValue(r.settings.refreshSourceControlTimer.toString()).setPlaceholder("7000").onChange(async u=>{r.settings.refreshSourceControlTimer=Math.max(parseInt(u),500),await r.saveSettings(),r.setRefreshDebouncer()})),new V.Setting(n).setName("Miscellaneous").setHeading(),new V.Setting(n).setName("Disable notifications").setDesc("Disable notifications for git operations to minimize distraction (refer to status bar for updates). Errors are still shown as notifications even if you enable this setting.").addToggle(c=>c.setValue(r.settings.disablePopups).onChange(async u=>{r.settings.disablePopups=u,this.display(),await r.saveSettings()})),r.settings.disablePopups||new V.Setting(n).setName("Hide notifications for no changes").setDesc("Don't show notifications when there are no changes to commit or push.").addToggle(c=>c.setValue(r.settings.disablePopupsForNoChanges).onChange(async u=>{r.settings.disablePopupsForNoChanges=u,await r.saveSettings()})),new V.Setting(n).setName("Show status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(r.settings.showStatusBar).onChange(async u=>{r.settings.showStatusBar=u,await r.saveSettings()})),new V.Setting(n).setName("Show stage/unstage button in file menu").addToggle(c=>c.setValue(r.settings.showFileMenu).onChange(async u=>{r.settings.showFileMenu=u,await r.saveSettings()})),new V.Setting(n).setName("Show branch status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(r.settings.showBranchStatusBar).onChange(async u=>{r.settings.showBranchStatusBar=u,await r.saveSettings()})),new V.Setting(n).setName("Show the count of modified files in the status bar").addToggle(c=>c.setValue(r.settings.changedFilesInStatusBar).onChange(async u=>{r.settings.changedFilesInStatusBar=u,await r.saveSettings()})),r.gitManager instanceof yn?new V.Setting(n).setName("Authentication/commit author").setHeading():new V.Setting(n).setName("Commit author").setHeading(),r.gitManager instanceof yn&&new V.Setting(n).setName("Username on your git server. E.g. your username on GitHub").addText(c=>{var u;c.setValue((u=r.localStorage.getUsername())!=null?u:""),c.onChange(f=>{r.localStorage.setUsername(f)})}),r.gitManager instanceof yn&&new V.Setting(n).setName("Password/Personal access token").setDesc("Type in your password. You won't be able to see it again.").addText(c=>{c.inputEl.autocapitalize="off",c.inputEl.autocomplete="off",c.inputEl.spellcheck=!1,c.onChange(u=>{r.localStorage.setPassword(u)})}),r.gitReady&&new V.Setting(n).setName("Author name for commit").addText(async c=>{c.setValue(await r.gitManager.getConfig("user.name")),c.onChange(async u=>{await r.gitManager.setConfig("user.name",u==""?void 0:u)})}),r.gitReady&&new V.Setting(n).setName("Author email for commit").addText(async c=>{c.setValue(await r.gitManager.getConfig("user.email")),c.onChange(async u=>{await r.gitManager.setConfig("user.email",u==""?void 0:u)})}),new V.Setting(n).setName("Advanced").setDesc("These settings usually don't need to be changed, but may be requried for special setups.").setHeading(),r.gitManager instanceof Le&&(new V.Setting(n).setName("Update submodules").setDesc('"Commit-and-sync" and "pull" takes care of submodules. Missing features: Conflicted files, count of pulled/pushed/committed files. Tracking branch needs to be set for each submodule.').addToggle(c=>c.setValue(r.settings.updateSubmodules).onChange(async u=>{r.settings.updateSubmodules=u,await r.saveSettings()})),r.settings.updateSubmodules&&new V.Setting(n).setName("Submodule recurse checkout/switch").setDesc("Whenever a checkout happens on the root repository, recurse the checkout on the submodules (if the branches exist).").addToggle(c=>c.setValue(r.settings.submoduleRecurseCheckout).onChange(async u=>{r.settings.submoduleRecurseCheckout=u,await r.saveSettings()}))),r.gitManager instanceof Le&&new V.Setting(n).setName("Custom Git binary path").addText(c=>{var u;c.setValue((u=r.localStorage.getGitPath())!=null?u:""),c.setPlaceholder("git"),c.onChange(f=>{r.localStorage.setGitPath(f),r.gitManager.updateGitPath(f||"git").catch(h=>r.displayError(h))})}),r.gitManager instanceof Le&&new V.Setting(n).setName("Additional environment variables").setDesc("Use each line for a new environment variable in the format KEY=VALUE .").addTextArea(c=>{c.setPlaceholder("GIT_DIR=/path/to/git/dir"),c.setValue(r.localStorage.getEnvVars().join(` `)),c.onChange(u=>{r.localStorage.setEnvVars(u.split(` `))})}),r.gitManager instanceof Le&&new V.Setting(n).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(c=>{c.setValue(r.localStorage.getPATHPaths().join(` `)),c.onChange(u=>{r.localStorage.setPATHPaths(u.split(` `))})}),r.gitManager instanceof Le&&new V.Setting(n).setName("Reload with new environment variables").setDesc("Removing previously added environment variables will not take effect until Obsidian is restarted.").addButton(c=>{c.setButtonText("Reload"),c.setCta(),c.onClick(async()=>{await r.gitManager.setGitInstance()})}),new V.Setting(n).setName("Custom base path (Git repository path)").setDesc(` Sets the relative path to the vault from which the Git binary should be executed. Mostly used to set the path to the Git repository, which is only required if the Git repository is below the vault root directory. Use "\\" instead of "/" on Windows. `).addText(c=>{c.setValue(r.settings.basePath),c.setPlaceholder("directory/directory-with-git-repo"),c.onChange(async u=>{r.settings.basePath=u,await r.saveSettings(),r.gitManager.updateBasePath(u||"").catch(f=>r.displayError(f))})}),new V.Setting(n).setName("Custom Git directory path (Instead of '.git')").setDesc('Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(c=>{c.setValue(r.settings.gitDir),c.setPlaceholder(".git"),c.onChange(async u=>{r.settings.gitDir=u,await r.saveSettings()})}),new V.Setting(n).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(c=>c.setValue(r.localStorage.getPluginDisabled()).onChange(u=>{r.localStorage.setPluginDisabled(u),u?r.unloadPlugin():r.init({fromReload:!0}).catch(f=>r.displayError(f)),new V.Notice("Obsidian must be restarted for the changes to take affect.")})),new V.Setting(n).setName("Support").setHeading(),new V.Setting(n).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(c=>{c.buttonEl.outerHTML="Buy Me a Coffee at ko-fi.com"});let o=n.createDiv();o.setAttr("align","center"),o.setAttr("style","margin: var(--size-4-2)");let l=o.createEl("button");if(l.setText("Copy Debug Information"),l.onclick=async()=>{await window.navigator.clipboard.writeText(JSON.stringify({settings:this.plugin.settings,pluginVersion:this.plugin.manifest.version},null,4)),new V.Notice("Debug information copied to clipboard. May contain sensitive information!")},V.Platform.isDesktopApp){let c=n.createDiv();c.setAttr("align","center"),c.setText(`Debugging and logging: You can always see the logs of this and every other plugin by opening the console with`);let u=n.createDiv();u.setAttr("align","center"),u.addClass("obsidian-git-shortcuts"),V.Platform.isMacOS===!0?u.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):u.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(n,r){r&&(n.setDisabled(r),n.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(n){this.settings.lineAuthor.show=n,this.plugin.saveSettings(),n?this.plugin.lineAuthoringFeature.activateFeature():this.plugin.lineAuthoringFeature.deactivateFeature()}async lineAuthorSettingHandler(n,r){this.settings.lineAuthor[n]=r,await this.plugin.saveSettings(),this.plugin.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let n=this.settings.lineAuthor;n.authorDisplay!=="hide"&&(n.lastShownAuthorDisplay=n.authorDisplay),n.dateTimeFormatOptions!=="hide"&&(n.lastShownDateTimeFormatOptions=n.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let n=new V.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.lineAuthoringFeature.isAvailableOnCurrentPlatform()||n.setDesc("Only available on desktop currently.").setDisabled(!0),n.descEl.innerHTML=` Feature guide and quick examples
The commit hash, author name and authoring date can all be individually toggled.
Hide everything, to only show the age-colored sidebar.`,n.addToggle(r=>r.setValue(this.settings.lineAuthor.show).onChange(i=>{this.configureLineAuthorShowStatus(i),this.display()})),this.settings.lineAuthor.show){let r=new V.Setting(this.containerEl).setName("Follow movement and copies across files and commits").setDesc("").addDropdown(a=>{a.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),a.setValue(this.settings.lineAuthor.followMovement),a.onChange(s=>this.lineAuthorSettingHandler("followMovement",s))});if(r.descEl.innerHTML=` By default (deactivated), each line only shows the newest commit where it was changed.
With same commit, cut-copy-paste-ing of text is followed within the same commit and the original commit of authoring will be shown.
With all commits, cut-copy-paste-ing text inbetween multiple commits will be detected.
It uses git-blame and for matches (at least ${Sl} characters) within the same (or all) commit(s), the originating commit's information is shown.`,new V.Setting(this.containerEl).setName("Show commit hash").addToggle(a=>{a.setValue(this.settings.lineAuthor.showCommitHash),a.onChange(s=>this.lineAuthorSettingHandler("showCommitHash",s))}),new V.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(a=>{let s={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};a.addOptions(s),a.setValue(this.settings.lineAuthor.authorDisplay),a.onChange(async o=>this.lineAuthorSettingHandler("authorDisplay",o))}),new V.Setting(this.containerEl).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(a=>{let s={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};a.addOptions(s),a.setValue(this.settings.lineAuthor.dateTimeFormatOptions),a.onChange(async o=>{await this.lineAuthorSettingHandler("dateTimeFormatOptions",o),this.display()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let a=new V.Setting(this.containerEl);a.setName("Custom authoring date format").addText(s=>{s.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),s.setPlaceholder("YYYY-MM-DD HH:mm"),s.onChange(async o=>{await this.lineAuthorSettingHandler("dateTimeFormatCustomString",o),a.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(o)})}),a.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(this.settings.lineAuthor.dateTimeFormatCustomString)}new V.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(a=>{let s={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};a.addOptions(s),a.setValue(this.settings.lineAuthor.dateTimeTimezone),a.onChange(async o=>this.lineAuthorSettingHandler("dateTimeTimezone",o))}).descEl.innerHTML=` The time-zone in which the authoring date should be shown. Either your local time-zone (default), the author's time-zone during commit creation or UTC\xB100:00. `;let i=new V.Setting(this.containerEl).setName("Oldest age in coloring");i.descEl.innerHTML=this.previewOldestAgeDescriptionHtml(this.settings.lineAuthor.coloringMaxAge)[0],i.addText(a=>{a.setPlaceholder("1y"),a.setValue(this.settings.lineAuthor.coloringMaxAge),a.onChange(async s=>{let[o,l]=this.previewOldestAgeDescriptionHtml(s);i.descEl.innerHTML=o,l&&(await this.lineAuthorSettingHandler("coloringMaxAge",s),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest"),new V.Setting(this.containerEl).setName("Text color").addText(a=>{a.setValue(this.settings.lineAuthor.textColorCss),a.onChange(async s=>{await this.lineAuthorSettingHandler("textColorCss",s)})}).descEl.innerHTML=` The CSS color of the gutter text.
It is higly recommended to use CSS variables defined by themes (e.g.
var(--text-muted)
or
var(--text-on-accent)
, because they automatically adapt to theme changes.
See: List of available CSS variables in Obsidian `,new V.Setting(this.containerEl).setName("Ignore whitespace and newlines in changes").addToggle(a=>{a.setValue(this.settings.lineAuthor.ignoreWhitespace),a.onChange(s=>this.lineAuthorSettingHandler("ignoreWhitespace",s))}).descEl.innerHTML=` Whitespace and newlines are interpreted as part of the document and in changes by default (hence not ignored). This makes the last line being shown as 'changed' when a new subsequent line is added, even if the previously last line's text is the same.
If you don't care about purely-whitespace changes (e.g. list nesting / quote indentation changes), then activating this will provide more meaningful change detection. `}}createColorSetting(n){let r=new V.Setting(this.containerEl).setName("").addText(i=>{let a=vp(n,this.settings.lineAuthor),s=vp(n,Mn.lineAuthor);i.setPlaceholder(ap(s)),i.setValue(ap(a)),i.onChange(async o=>{let l=kS(o);if(l!==void 0){let c=n==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(c,l)}this.refreshColorSettingsDesc(n,l)})});this.lineAuthorColorSettings.set(n,r),this.refreshColorSettingsName(n),this.refreshColorSettingsDesc(n,vp(n,this.settings.lineAuthor))}refreshColorSettingsName(n){let r=this.lineAuthorColorSettings.get(n);if(r){let i=n==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";r.nameEl.innerText=`Color for ${i} commits`}}refreshColorSettingsDesc(n,r){let i=this.lineAuthorColorSettings.get(n);i&&(i.descEl.innerHTML=this.colorSettingPreviewDescHtml(n,this.settings.lineAuthor,r!==void 0))}colorSettingPreviewDescHtml(n,r,i){let a=i?wp(n,r):"rgba(127,127,127,0.3)",s=V.moment.unix(V.moment.now()/1e3).format("YYYY-MM-DD"),o=i?`abcdef Author Name ${s}`:"invalid color";return`Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and named colors (e.g. 'black', 'purple'). Color preview: ${`
${o}
`}`}previewCustomDateTimeDescriptionHtml(n){let r=(0,V.moment)().format(n);return`
Format string to display the authoring date.
Currently: ${r}`}previewOldestAgeDescriptionHtml(n){let r=xc(n);return[`The oldest age in the line author coloring. Everything older will have the same color.
Smallest valid age is "1d". Currently: ${r!==void 0?`${r.asDays()} days`:"invalid!"}`,r]}};function vp(t,e){return t==="oldest"?e.colorOld:e.colorNew}function xc(t){let e=V.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}function qS(t,e,n){if(!(t===void 0||e===void 0||n===void 0))return`head${t}-obj${e}-path${n}`}var XS=_c.Annotation.define();function YS(t,e,n){return n.update({annotations:XS.of({key:t,la:e,lineOffsetsFromUnsavedChanges:new Map})})}function uL(t){return t.annotation(XS)}var sa=_c.StateField.define({create:t=>{},update:(t,e)=>{var n;return(n=uL(e))!=null?n:fL(e,t)},compare:(t,e)=>(t==null?void 0:t.key)===(e==null?void 0:e.key)});function Sc(t){var a;let e=WS.sha256.create();if(!t)return e;let{la:n,key:r,lineOffsetsFromUnsavedChanges:i}=t;e.update(n==="untracked"?"t":"f"),e.update(r);for(let[s,o]of(a=i.entries())!=null?a:[])e.update([s,o]);return e}var an={get:void 0,save:void 0};function ZS(t,e){an.get=t,an.save=e}function Ec(t){var e,n;return(n=(e=xc(t.coloringMaxAge))==null?void 0:e.asDays())!=null?n:xc(Mn.lineAuthor.coloringMaxAge).asDays()}function fL(t,e){if(e)return t.changes.empty||t.changes.iterChanges((n,r,i,a)=>{var p;let s=t.startState.doc,{newDoc:o}=t,l=s.lineAt(n).number,c=s.lineAt(r).number,u=o.lineAt(i).number,f=o.lineAt(a).number,h=c-l+1,d=f-u+1;for(let g=u;g<=f;g++){let m=(p=e.lineOffsetsFromUnsavedChanges.get(g))!=null?p:0,w=f===g,b=d-h;w&&(m+=b),e.lineOffsetsFromUnsavedChanges.set(g,m)}}),e}var bp=class{constructor(e){this.state=e;this.subscribeMe()}notifyLineAuthoring(e,n){if(this.view===void 0){console.warn(`Git: View is not defined for editor cache key. Unforeseen situation. id: ${e}`);return}let r=this.view.state,i=YS(e,n,r);this.view.dispatch(i)}updateToNewState(e){let n=this.lastSeenPath&&this.filepath!=this.lastSeenPath;return this.state=e,n&&(this.unsubscribeMe(this.lastSeenPath),this.subscribeMe()),this}removeIfStale(){this.view.destroyed&&this.unsubscribeMe(this.lastSeenPath)}subscribeMe(){this.filepath!==void 0&&(aa.ifFilepathDefinedTransformSubscribers(this.filepath,e=>e.add(this)),this.lastSeenPath=this.filepath)}unsubscribeMe(e){aa.ifFilepathDefinedTransformSubscribers(e,n=>n.delete(this))}get filepath(){var e,n;return(n=(e=this.state.field(kc.editorInfoField))==null?void 0:e.file)==null?void 0:n.path}get view(){return this.state.field(kc.editorEditorField)}},JS=KS.StateField.define({create:t=>new bp(t),update:(t,e)=>t.updateToNewState(e.state),compare:(t,e)=>t===e});v();function QS(){oa=void 0,xp=[],Ac=0,Cc.clear(),Fc.clear(),la.clear()}var oa,Tc=()=>oa;function eE(t,e){var i;let n=e.length;if(n<((i=oa==null?void 0:oa.length)!=null?i:0))return;oa={gutter:t,length:n,text:e};let r=an.get();n!==r.gutterSpacingFallbackLength&&(r.gutterSpacingFallbackLength=n,an.save(r))}var xp=[],hL=15,Ac=0;function tE(t){xp[Ac]=t,Ac=(Ac+1)%hL}function nE(){return TS(xp)}var Cc=new Map,Fc=new Map,la=new Set;v();var mE=require("@codemirror/state"),gE=require("@codemirror/view");v();var kp=require("@codemirror/view"),fE=Ze(cp()),Pc=require("obsidian");v();v();var Mc={x:-10,y:-10};function rE(){Mc.x===-10&&window.addEventListener("mousedown",t=>{Mc.x=t.clientX,Mc.y=t.clientY})}function iE(){for(let t of la)if(dL(t,Mc))return t}function dL(t,e){let{x:n,y:r,width:i,height:a}=t.getBoundingClientRect();return n<=e.x&&e.x<=n+i&&r<=e.y&&e.y<=r+a}v();var Gs={};var aE="data-commit";function sE(t,e,n){if(e.hasFocus())return;let r=iE();if(!r)return;let i=mL(r);i&&(!i.isZeroCommit&&!i.isWaitingGutter&&pL(i,t),_p("showCommitHash",t),_p("authorDisplay",t),_p("dateTimeFormatOptions",t))}function pL(t,e){e.addItem(n=>n.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-author-copy").onClick(r=>navigator.clipboard.writeText(t.hash)))}function _p(t,e){var l,c;let n,r,i=Gs.plugin.settings.lineAuthor,a=i[t],s=typeof a=="boolean"?a:a!=="hide",o=Mn.lineAuthor[t];if(t==="showCommitHash")n="Show commit hash",r=a;else if(t==="authorDisplay"){let u=(l=i.lastShownAuthorDisplay)!=null?l:o;n="Show author "+(s?a:u),r=s?"hide":u}else if(t==="dateTimeFormatOptions"){let u=(c=i.lastShownDateTimeFormatOptions)!=null?c:o;n="Show "+(s?a:u),n+=n.contains("date")?"":" date",r=s?"hide":u}else yr(t);e.addItem(u=>u.setTitle(n).setSection("obs-git-line-author-configure").setChecked(s).onClick(f=>{var h,d;return(d=(h=Gs.plugin)==null?void 0:h.settingsTab)==null?void 0:d.lineAuthorSettingHandler(t,r)}))}function oE(t,e,n){n.setAttr(aE,JSON.stringify({hash:t.hash,isZeroCommit:t.isZeroCommit,isWaitingGutter:e}))}function mL(t){let e=t.getAttr(aE);return e?JSON.parse(e):void 0}v();function wp(t,e){return t==="oldest"?Oc(0,!1,e).color:Oc(void 0,!0,e).color}function Oc(t,e,n){let r=Ec(n),i=Date.now()/1e3,a=t!=null?t:0,o=(e?0:i-a)/60/60/24,l=Math.pow(Math.clamp(o/r,0,1),1/2.3),c=gL(),u=n.colorNew,f=n.colorOld,h=c?.4:1,d=Sp(u.r,f.r,l)*h,p=Sp(u.g,f.g,l)*h,g=Sp(u.b,f.b,l)*h;return{color:`rgba(${d},${p},${g},${c?.75:.25})`,daysSinceCommit:o}}function Sp(t,e,n){return t+(e-t)*n}function gL(){var t;return((t=window.app)==null?void 0:t.getTheme())==="obsidian"}function lE(t){document.body.style.setProperty("--obs-git-gutter-text",t.textColorCss)}v();function cE(t,e,n){let r;for(let i=e;i<=n;i++){let a=t.hashPerLine[i],s=t.commits.get(a);(!r||s.isZeroCommit||yL(s,r))&&(r=s)}return r}function yL(t,e){var i,a,s,o;let n=(a=(i=t.author)==null?void 0:i.epochSeconds)!=null?a:0,r=(o=(s=e.author)==null?void 0:s.epochSeconds)!=null?o:0;return n>r}var uE="-",vL="+",wL=3,bL="*",xL=/\S/g,_L="%",ca=class t extends kp.GutterMarker{constructor(n){super();this.text=n}eq(n){return n instanceof t&&this.text===n.text}toDOM(){return document.createTextNode(this.text)}destroy(n){document.body.contains(n)||n.remove()}},Ep=class extends kp.GutterMarker{constructor(n,r,i,a,s,o){super();this.lineAuthoring=n;this.startLine=r;this.endLine=i;this.key=a;this.settings=s;this.options=o;this.point=!1;this.elementClass="obs-git-blame-gutter"}eq(n){return this.key===(n==null?void 0:n.key)&&this.startLine===(n==null?void 0:n.startLine)&&this.endLine===(n==null?void 0:n.endLine)&&(this==null?void 0:this.options)===(n==null?void 0:n.options)}toDOM(){var n;return this.precomputedDomProvider=(n=this.precomputedDomProvider)!=null?n:this.computeDom(),this.precomputedDomProvider()}destroy(n){document.body.contains(n)||(n.remove(),la.delete(n))}computeDom(){let n=cE(this.lineAuthoring,this.startLine,this.endLine),r=n.isZeroCommit?"":this.renderNonZeroCommit(n);return!n.isZeroCommit&&this.options!=="waiting-for-result"?eE(this,r):r=this.adaptTextForFakeCommit(n,r,this.options),this.createHtmlNode(n,r,this.options==="waiting-for-result")}createHtmlNode(n,r,i){var c;let a=window.createDiv();a.innerText=r;let{color:s,daysSinceCommit:o}=Oc((c=n==null?void 0:n.author)==null?void 0:c.epochSeconds,n==null?void 0:n.isZeroCommit,this.settings);a.style.backgroundColor=s,oE(n,i,a);function l(){let u=a.cloneNode(!0);return la.add(u),i||tE(o),u}return l}renderNonZeroCommit(n){let r=this.settings.showCommitHash?this.renderHash(n):"",i=this.settings.authorDisplay==="hide"?"":`${this.renderAuthorName(n,this.settings.authorDisplay)}`,a=this.settings.dateTimeFormatOptions==="hide"?"":`${this.renderAuthoringDate(n,this.settings.dateTimeFormatOptions,this.settings.dateTimeFormatCustomString,this.settings.dateTimeTimezone)}`;return[r,i,a].filter(o=>o.length>=1).join(" ")}renderHash(n){return n.hash.substring(0,6)}renderAuthorName(n,r){var o,l,c,u;let i=(l=(o=n==null?void 0:n.author)==null?void 0:o.name)!=null?l:"",a=i.split(" ").filter(f=>f.length>=1),s;switch(r){case"initials":s=a.map(f=>f[0].toUpperCase()).join("");break;case"first name":s=(c=a.first())!=null?c:uE;break;case"last name":s=(u=a.last())!=null?u:uE;break;case"full":s=i;break;default:return yr(r)}return CS(n==null?void 0:n.author,n==null?void 0:n.committer)||(s=s+bL),s}renderAuthoringDate(n,r,i,a){var c;let s="?";if(((c=n==null?void 0:n.author)==null?void 0:c.epochSeconds)===void 0)return s;let o;switch(r){case"date":o=_l;break;case"datetime":o=jh;break;case"custom":o=i;break;case"natural language":o=u=>{let f=u.diff((0,Pc.moment)());return Pc.moment.duration(f).humanize(!0)};break;default:return yr(r)}let l=Pc.moment.unix(n.author.epochSeconds);switch(a){case"viewer-local":break;case"author-local":l=l.utcOffset(n.author.tz),typeof o=="string"&&(o+=" Z");break;case"utc0000":l=l.utc(),typeof o=="string"&&(o+="[Z]");break;default:return yr(a)}return typeof o=="string"?l.format(o):o(l)}adaptTextForFakeCommit(n,r,i){var l,c,u,f;let a=(c=(l=Tc())==null?void 0:l.text)!=null?c:r,s=i!=="waiting-for-result"&&n.isZeroCommit?vL:_L;r=a.replace(xL,s);let o=(f=(u=an.get())==null?void 0:u.gutterSpacingFallbackLength)!=null?f:r.length;if(r=FS(r,o,s),i!=="waiting-for-result"&&n.isZeroCommit){let h=Math.min(o,wL);r=MS(r,o-h)}return r}};function ei(t,e,n,r,i,a){let s=fE.sha256.create();s.update(Object.values(i).join(",")),s.update(`s${e}-e${n}-k${r}-o${a}`);let o=s.hex(),l=Cc.get(o);if(l)return l;let c=new Ep(t,e,n,r,i,a);return Cc.set(o,c),c}v();var hE=require("obsidian");function Ap(){var e,n;let t=(n=(e=an.get())==null?void 0:e.gutterSpacingFallbackLength)!=null?n:Mn.lineAuthor.gutterSpacingFallbackLength;return new ca(Array(t).fill("-").join(""))}function Tp(t){let{lineAuthoring:e,ageForInitialRender:n}=SL(t);return ei(e,1,1,"initialGutter"+n,t,"waiting-for-result")}function SL(t){var a;let e=(a=nE())!=null?a:Ec(t)*.25,n=(0,hE.moment)().add(-e,"days"),r={name:"",epochSeconds:AS(n),tz:"+0000"},i={hash:"waiting-for-result",author:r,committer:r,isZeroCommit:!1};return{lineAuthoring:{hashPerLine:[void 0,"waiting-for-result"],commits:new Map([["waiting-for-result",i]])},ageForInitialRender:e}}v();function dE(t,e){return ei({hashPerLine:[void 0,"000000"],commits:new Map([["000000",jS]])},1,1,t,e)}var Cp=new ca(""),yE=(0,gE.gutter)({class:"line-author-gutter-container",markers(t){let e=t.state.field(sa,!1);return EL(t,e)},lineMarkerChange(t){let e=Sc(t.state.field(sa));return Sc(t.startState.field(sa))!==e},renderEmptyElements:!0,initialSpacer:t=>(pE(t),Ap()),updateSpacer:(t,e)=>{var n,r;return pE(e.view),(r=(n=Tc())==null?void 0:n.gutter)!=null?r:Ap()}});function EL(t,e){let n=Sc(e),r=t.state.doc,i=new Map;for(let u=1;u<=r.lines;u++){let f=r.line(u).from,h=t.lineBlockAt(f).to;i.set(u,[f,h]),n.update([f,h,0])}let a=an.get();n.update("s"+Object.values(an).join(","));let s=n.hex(),o=Fc.get(s);if(o)return o;let{result:l,allowCache:c}=kL(r,i,a,e);return c&&Fc.set(s,l),l}function kL(t,e,n,r){let i=!0,a=t.lines,s=[];function o(f,h,d){return s.push(d.range(f,h))}let l=AL(a,r),c=t.length===0,u=t.iterLines(a,a+1).next().value==="";for(let f=1;f<=a;f++){let[h,d]=e.get(f),p=t.lineAt(d).number;if(c){o(h,d,Cp);continue}if(f===a&&u){o(h,d,Cp);continue}if(r===void 0){o(h,d,Tp(n)),i=!1;continue}let{key:g,la:m}=r;if(m==="untracked"){o(h,d,dE(m,n));continue}let w=m.hashPerLine.length-1,b=l[f],S=l[p];if(S&&S>w&&o(h,d,Cp),b!==void 0&&sp(1,b,w)&&S!==void 0&&sp(1,S,w)){o(h,d,ei(m,b,S,g,n));continue}if(w<1){o(h,d,Tp(n)),i=!1;continue}let k=Math.clamp(b!=null?b:f,1,w),x=Math.clamp(S!=null?S:p,1,w);o(h,d,ei(m,k,x,g+"computing",n,"waiting-for-result"))}return{result:mE.RangeSet.of(s,!0),allowCache:i}}function AL(t,e){if(!(e!=null&&e.lineOffsetsFromUnsavedChanges))return Array.from(new Array(t+1),i=>i);let n=[void 0],r=0;for(let i=1;i<=t;i++){let a=e.lineOffsetsFromUnsavedChanges.get(i);r+=a!=null?a:0,n[i]=a===void 0?i-r:void 0}return n}function pE(t){t.dom.querySelectorAll(".cm-gutters").forEach(n=>{n!=null&&n.style&&(n.style.marginLeft||(n.style.marginLeft="unset"))})}var Ic=class{constructor(e){this.plugin=e;this.lineAuthorings=new Map}async trackChanged(e){return this.trackChangedHelper(e).catch(n=>(console.warn("Git: Error in trackChanged."+n),Promise.reject(n)))}async trackChangedHelper(e){if(e){if(e.path===void 0){console.warn("Git: Attempted to track change of undefined filepath. Unforeseen situation.");return}return this.computeLineAuthorInfo(e.path)}}destroy(){this.lineAuthorings.clear(),aa.clear(),QS()}async computeLineAuthorInfo(e){let n=this.plugin.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager,r=await n.submoduleAwareHeadRevisonInContainingDirectory(e),i=await n.hashObject(e),a=qS(r,i,e);if(a!==void 0){if(!this.lineAuthorings.has(a)){let s=await n.blame(e,this.plugin.settings.lineAuthor.followMovement,this.plugin.settings.lineAuthor.ignoreWhitespace);this.lineAuthorings.set(a,s)}this.notifyComputationResultToSubscribers(e,a)}}notifyComputationResultToSubscribers(e,n){aa.ifFilepathDefinedTransformSubscribers(e,r=>r.forEach(i=>i.notifyLineAuthoring(n,this.lineAuthorings.get(n))))}},wE=vE.Prec.high([JS,sa,yE]);var Rc=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.lineAuthorInfoProvider){console.warn("Git: undefined lineAuthorInfoProvider. Unexpected situation.");return}let n=e==null?void 0:e.view;!(n instanceof ti.MarkdownView)||n.file==null||(n==null?void 0:n.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(n.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),ZS(()=>this.plg.settings.lineAuthor,e=>{this.plg.settings.lineAuthor=e,this.plg.saveSettings()})}conditionallyActivateBySettings(){this.plg.settings.lineAuthor.show&&this.activateFeature()}activateFeature(){try{if(!this.isAvailableOnCurrentPlatform().available)return;lE(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new Ic(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),console.log(this.plg.manifest.name+": Enabled line authoring.")}catch(e){console.warn("Git: Error while loading line authoring feature.",e),this.deactivateFeature()}}deactivateFeature(){var e;this.destroyEventHandlers(),this.deactivateCodeMirrorExtensions(),(e=this.lineAuthorInfoProvider)==null||e.destroy(),this.lineAuthorInfoProvider=void 0,console.log(this.plg.manifest.name+": Disabled line authoring.")}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&ti.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Le?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(wE),this.plg.app.workspace.updateOptions(),this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}deactivateCodeMirrorExtensions(){for(let e of this.codeMirrorExtensions)this.codeMirrorExtensions.remove(e);this.plg.app.workspace.updateOptions()}createEventHandlers(){this.gutterContextMenuEvent=this.createGutterContextMenuHandler(),this.fileOpenEvent=this.createFileOpenEvent(),this.workspaceLeafChangeEvent=this.createWorkspaceLeafChangeEvent(),this.fileModificationEvent=this.createVaultFileModificationHandler(),this.refreshOnCssChangeEvent=this.createCssRefreshHandler(),this.fileRenameEvent=this.createFileRenameEvent(),rE(),this.plg.registerEvent(this.gutterContextMenuEvent),this.plg.registerEvent(this.refreshOnCssChangeEvent),this.plg.registerEvent(this.fileOpenEvent),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileModificationEvent),this.plg.registerEvent(this.fileRenameEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.workspace.offref(this.fileOpenEvent),this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent),this.plg.app.workspace.offref(this.gutterContextMenuEvent)}createFileOpenEvent(){return this.plg.app.workspace.on("file-open",e=>{var n;return void((n=this.lineAuthorInfoProvider)==null?void 0:n.trackChanged(e).catch(console.error))})}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,n)=>{var r;return e instanceof ti.TFile&&((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var n;return e instanceof ti.TFile&&((n=this.lineAuthorInfoProvider)==null?void 0:n.trackChanged(e))})}createCssRefreshHandler(){return this.plg.app.workspace.on("css-change",()=>this.refreshLineAuthorViews())}createGutterContextMenuHandler(){return this.plg.app.workspace.on("editor-menu",sE)}};v();var Lc=class{constructor(e){this.plugin=e;this.tasks=[]}addTask(e){this.tasks.push(e),this.tasks.length===1&&this.handleTask()}handleTask(){this.tasks.length>0&&this.tasks[0]().catch(e=>this.plugin.displayError(e)).finally(()=>{this.tasks.shift(),this.handleTask()})}};v();var sn=require("obsidian");var jc=class{constructor(e,n){this.statusBarEl=e;this.plugin=n;this.messages=[];this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),n.registerEvent(n.app.workspace.on("obsidian-git:refresh",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,n){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:n}),this.display()}display(){this.messages.length>0&&!this.currentMessage?(this.currentMessage=this.messages.shift(),this.statusBarEl.addClass(this.base+"message"),this.statusBarEl.ariaLabel="",this.statusBarEl.setText(this.currentMessage.message),this.lastMessageTimestamp=Date.now()):this.currentMessage?Date.now()-this.lastMessageTimestamp>=this.currentMessage.timeout&&(this.currentMessage=null,this.lastMessageTimestamp=null):this.displayState()}displayState(){switch((this.statusBarEl.getText().length>3||!this.statusBarEl.hasChildNodes())&&(this.statusBarEl.empty(),this.conflictEl=this.statusBarEl.createDiv(),this.conflictEl.setAttribute("data-tooltip-position","top"),this.conflictEl.style.float="left",this.iconEl=this.statusBarEl.createDiv(),this.iconEl.style.float="left",this.textEl=this.statusBarEl.createDiv(),this.textEl.style.float="right",this.textEl.style.marginLeft="5px"),this.plugin.localStorage.getConflict()?((0,sn.setIcon)(this.conflictEl,"alert-circle"),this.conflictEl.ariaLabel="You have merge conflicts. Resolve them and commit afterwards.",this.conflictEl.style.marginRight="5px",this.conflictEl.addClass(this.base+"conflict")):(this.conflictEl.empty(),this.conflictEl.style.marginRight=""),this.plugin.state.gitAction){case 0:this.displayFromNow();break;case 1:this.statusBarEl.ariaLabel="Checking repository status...",(0,sn.setIcon)(this.iconEl,"refresh-cw"),this.statusBarEl.addClass(this.base+"status");break;case 3:this.statusBarEl.ariaLabel="Adding files...",(0,sn.setIcon)(this.iconEl,"archive"),this.statusBarEl.addClass(this.base+"add");break;case 4:this.statusBarEl.ariaLabel="Committing changes...",(0,sn.setIcon)(this.iconEl,"git-commit"),this.statusBarEl.addClass(this.base+"commit");break;case 5:this.statusBarEl.ariaLabel="Pushing changes...",(0,sn.setIcon)(this.iconEl,"upload"),this.statusBarEl.addClass(this.base+"push");break;case 2:this.statusBarEl.ariaLabel="Pulling changes...",(0,sn.setIcon)(this.iconEl,"download"),this.statusBarEl.addClass(this.base+"pull");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,sn.setIcon)(this.iconEl,"alert-triangle"),this.statusBarEl.addClass(this.base+"failed-init");break}}displayFromNow(){var r;let e=this.lastCommitTimestamp,n=this.plugin.state.offlineMode;if(e){let i=(0,sn.moment)(e).fromNow();this.statusBarEl.ariaLabel=`${n?"Offline: ":""}Last Commit: ${i}`,(r=this.unPushedCommits)!=null&&r&&(this.statusBarEl.ariaLabel+=` (${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=n?"Git is offline":"Git is ready";n?(0,sn.setIcon)(this.iconEl,"globe"):(0,sn.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus&&this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()),this.statusBarEl.addClass(this.base+"idle")}async refreshCommitTimestamp(){this.lastCommitTimestamp=await this.plugin.gitManager.getLastCommitTime(),this.unPushedCommits=await this.plugin.gitManager.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};v();var Bc=require("obsidian"),Dc=class extends Bc.SuggestModal{constructor(n){super(n.app);this.plugin=n;this.resolve=null;this.setPlaceholder("Type your message and select optional the version with the added date.")}openAndGetResult(){return new Promise(n=>{this.resolve=n,this.open()})}onClose(){new Promise(n=>setTimeout(n,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(n){let r=(0,Bc.moment)().format(this.plugin.settings.commitDateFormat);return n==""&&(n="..."),[n,`${r}: ${n}`,`${n}: ${r}`]}renderSuggestion(n,r){r.innerText=n}onChooseSuggestion(n,r){this.resolve&&this.resolve(n)}};v();var bE=require("obsidian"),Vs=class{constructor(e){this.plugin=e}saveLastAuto(e,n){n==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):n==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):n==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,n,r;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((n=this.plugin.localStorage.getLastAutoPull())!=null?n:""),push:new Date((r=this.plugin.localStorage.getLastAutoPush())!=null?r:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let n=new Date,r=this.plugin.settings.autoPushInterval-Math.round((n.getTime()-e.push.getTime())/1e3/60);this.startAutoPush(r<=0?0:r)}if(this.plugin.settings.autoPullInterval>0){let n=new Date,r=this.plugin.settings.autoPullInterval-Math.round((n.getTime()-e.pull.getTime())/1e3/60);this.startAutoPull(r<=0?0:r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){e.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),e.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),e.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let e=await this.plugin.gitManager.getLastCommitTime();e&&this.plugin.localStorage.setLastAutoBackup(e.toString())}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let n=new Date,r=this.plugin.settings.autoSaveInterval-Math.round((n.getTime()-e.backup.getTime())/1e3/60);this.startAutoCommitAndSync(r<=0?0:r)}}}startAutoCommitAndSync(e){let n=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,bE.debounce)(()=>this.doAutoCommitAndSync(),n,!0):(n>2147483647&&(n=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),n))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(()=>this.plugin.settings.differentIntervalCommitAndPush?this.plugin.commit({fromAuto:!0}):this.plugin.commitAndSync(!0)),this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync()}startAutoPull(e){let n=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;n>2147483647&&(n=2147483647),this.timeoutIDPull=window.setTimeout(()=>{this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote()),this.saveLastAuto(new Date,"pull"),this.startAutoPull()},n)}startAutoPush(e){let n=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;n>2147483647&&(n=2147483647),this.timeoutIDPush=window.setTimeout(()=>{this.plugin.promiseQueue.addTask(()=>this.plugin.push()),this.saveLastAuto(new Date,"push"),this.startAutoPush()},n)}clearAutoCommitAndSync(){var n;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.autoCommitDebouncer&&((n=this.plugin.autoCommitDebouncer)==null||n.cancel(),this.plugin.autoCommitDebouncer=void 0,e=!0),e}clearAutoPull(){return this.timeoutIDPull?(window.clearTimeout(this.timeoutIDPull),this.timeoutIDPull=void 0,!0):!1}clearAutoPush(){return this.timeoutIDPush?(window.clearTimeout(this.timeoutIDPush),this.timeoutIDPush=void 0,!0):!1}};v();var qs=require("obsidian");v();var Ws=require("obsidian");async function xE(t,e,n){let r=await SE(e,n);if(r.result==="failure"){new Ws.Notice(r.reason);return}let{isGitHub:i,branch:a,repo:s,user:o,filePath:l}=r;if(i){let c=t.getCursor("from").line+1,u=t.getCursor("to").line+1;c===u?window.open(`https://github.com/${o}/${s}/blob/${a}/${l}?plain=1#L${c}`):window.open(`https://github.com/${o}/${s}/blob/${a}/${l}?plain=1#L${c}-L${u}`)}else new Ws.Notice("It seems like you are not using GitHub")}async function _E(t,e){let n=await SE(t,e);if(n.result==="failure"){new Ws.Notice(n.reason);return}let{isGitHub:r,branch:i,repo:a,user:s,filePath:o}=n;r?window.open(`https://github.com/${s}/${a}/commits/${i}/${o}`):new Ws.Notice("It seems like you are not using GitHub")}async function SE(t,e){let n=await e.branchInfo(),r=n.tracking,i=n.current,a,s=e.getRelativeRepoPath(t.path);if(e instanceof Le){let l=await e.getSubmoduleOfFile(e.getRelativeRepoPath(t.path));if(l){s=l.relativeFilepath;let c=await e.git.cwd({path:l.submodule,root:!1}).status();if(r=c.tracking||void 0,i=c.current||void 0,r){let u=r.substring(0,r.indexOf("/")),f=await e.git.cwd({path:l.submodule,root:!1}).getConfig(`remote.${u}.url`,"local");if(f.value!=null)a=f.value;else return{result:"failure",reason:"Failed to get remote url of submodule"}}}}if(r==null)return{result:"failure",reason:"Remote branch is not configured"};if(i==null)return{result:"failure",reason:"Failed to get current branch name"};if(a==null){let l=r.substring(0,r.indexOf("/"));if(a=await e.getConfig(`remote.${l}.url`),a==null)return{result:"failure",reason:"Failed to get remote url"}}let o=a.match(/(?:^https:\/\/github\.com\/(.+)\/(.+?)(?:\.git)?$)|(?:^[a-zA-Z]+@github\.com:(.+)\/(.+?)(?:\.git)?$)/);if(o==null)return{result:"failure",reason:"Could not parse remote url"};{let[l,c,u,f,h]=o;return{result:"success",isGitHub:!!l,repo:u||h,user:c||f,branch:i,filePath:s}}}v();var EE=require("obsidian"),Nc=class extends EE.FuzzySuggestModal{constructor(e,n){super(e.app),this.plugin=e,this.changedFiles=n,this.setPlaceholder("Not supported files will be opened by default app!")}getItems(){return this.changedFiles}getItemText(e){if(e.index=="U"&&e.working_dir=="U")return`Untracked | ${e.vault_path}`;let n="",r="";return e.working_dir!=" "&&(n=`Working Dir: ${e.working_dir} `),e.index!=" "&&(r=`Index: ${e.index}`),`${n}${r} | ${e.vault_path}`}onChooseItem(e,n){this.plugin.app.metadataCache.getFirstLinkpathDest(e.vault_path,"")==null?this.app.openWithDefaultApp(e.vault_path):this.plugin.app.workspace.openLinkText(e.vault_path,"/")}};v();var kE=require("obsidian"),$c=class extends kE.Modal{constructor(n,r){super(n);this.content=r;this.resolve=null}openAndGetReslt(){return new Promise(n=>{this.resolve=n,this.open()})}onOpen(){let{contentEl:n,titleEl:r}=this;r.setText("Edit .gitignore");let i=n.createDiv(),a=i.createEl("textarea",{text:this.content,cls:["obsidian-git-textarea"],attr:{rows:10,cols:30,wrap:"off"}});i.createEl("button",{cls:["mod-cta","obsidian-git-center-button"],text:"Save"}).addEventListener("click",()=>{this.resolve(a.value),this.close()})}onClose(){let{contentEl:n}=this;n.empty(),this.resolve&&this.resolve(void 0)}};function AE(t){let e=t.app;t.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let n=t.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(n)||await e.vault.adapter.write(n,"");let r=await e.vault.adapter.read(n),a=await new $c(e,r).openAndGetReslt();a!==void 0&&(await e.vault.adapter.write(n,a),await t.refresh())}}),t.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var i;let n=e.workspace.getLeavesOfType(dt.type),r;n.length===0?(r=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await r.setViewState({type:dt.type})):r=n.first(),await e.workspace.revealLeaf(r),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var i;let n=e.workspace.getLeavesOfType(nn.type),r;n.length===0?(r=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await r.setViewState({type:nn.type})):r=n.first(),await e.workspace.revealLeaf(r),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:n=>{var i;let r=e.workspace.getActiveFile();if(n)return r!==null;(i=Xt(e))==null||i.setViewState({type:Ct.type,active:!0,state:{staged:!1,file:t.gitManager.getRelativeRepoPath(r.path,!0)}})}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(n,{file:r})=>{if(r)return xE(n,r,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(n,{file:r})=>{if(r)return _E(r,t.gitManager)}}),t.addCommand({id:"pull",name:"Pull",callback:()=>t.promiseQueue.addTask(()=>t.pullChangesFromRemote())}),t.addCommand({id:"fetch",name:"Fetch",callback:()=>t.promiseQueue.addTask(()=>t.fetch())}),t.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>t.promiseQueue.addTask(()=>t.switchRemoteBranch())}),t.addCommand({id:"add-to-gitignore",name:"Add file to gitignore",checkCallback:n=>{let r=e.workspace.getActiveFile();if(n)return r!==null;t.addFileToGitignore(r).catch(i=>t.displayError(i))}}),t.addCommand({id:"push",name:"Commit-and-sync",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync(!1))}),t.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>t.promiseQueue.addTask(async()=>{await t.commitAndSync(!1),window.close()})}),t.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync(!1,!0))}),t.addCommand({id:"commit",name:"Commit all changes",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1}))}),t.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit-staged",name:"Commit staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!1,onlyStaged:!0}))}),qs.Platform.isDesktopApp&&t.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0,amend:!0}))}),t.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,onlyStaged:!0}))}),t.addCommand({id:"push2",name:"Push",callback:()=>t.promiseQueue.addTask(()=>t.push())}),t.addCommand({id:"stage-current-file",name:"Stage current file",checkCallback:n=>{let r=e.workspace.getActiveFile();if(n)return r!==null;t.promiseQueue.addTask(()=>t.stageFile(r))}}),t.addCommand({id:"unstage-current-file",name:"Unstage current file",checkCallback:n=>{let r=e.workspace.getActiveFile();if(n)return r!==null;t.promiseQueue.addTask(()=>t.unstageFile(r))}}),t.addCommand({id:"edit-remotes",name:"Edit remotes",callback:()=>t.editRemotes().catch(n=>t.displayError(n))}),t.addCommand({id:"remove-remote",name:"Remove remote",callback:()=>t.removeRemote().catch(n=>t.displayError(n))}),t.addCommand({id:"set-upstream-branch",name:"Set upstream branch",callback:()=>t.setUpstreamBranch().catch(n=>t.displayError(n))}),t.addCommand({id:"delete-repo",name:"CAUTION: Delete repository",callback:async()=>{await e.vault.adapter.exists(`${t.settings.basePath}/.git`)?await new Xe(t,{options:["NO","YES"],placeholder:"Do you really want to delete the repository (.git directory)? plugin action cannot be undone.",onlySelection:!0}).openAndGetResult()==="YES"&&(await e.vault.adapter.rmdir(`${t.settings.basePath}/.git`,!0),new qs.Notice("Successfully deleted repository. Reloading plugin..."),t.unloadPlugin(),await t.init({fromReload:!0})):new qs.Notice("No repository found")}}),t.addCommand({id:"init-repo",name:"Initialize a new repo",callback:()=>t.createNewRepo().catch(n=>t.displayError(n))}),t.addCommand({id:"clone-repo",name:"Clone an existing remote repo",callback:()=>t.cloneNewRepo().catch(n=>t.displayError(n))}),t.addCommand({id:"list-changed-files",name:"List changed files",callback:async()=>{if(await t.isAllInitialized())try{let n=await t.updateCachedStatus();if(n.changed.length+n.staged.length>500){t.displayError("Too many changes to display");return}new Nc(t,n.all).open()}catch(n){t.displayError(n)}}}),t.addCommand({id:"switch-branch",name:"Switch branch",callback:()=>{t.switchBranch().catch(n=>t.displayError(n))}}),t.addCommand({id:"create-branch",name:"Create new branch",callback:()=>{t.createBranch().catch(n=>t.displayError(n))}}),t.addCommand({id:"delete-branch",name:"Delete branch",callback:()=>{t.deleteBranch().catch(n=>t.displayError(n))}}),t.addCommand({id:"discard-all",name:"CAUTION: Discard all changes",callback:async()=>{if(!await t.isAllInitialized())return!1;await new Xe(t,{options:["NO","YES"],placeholder:"Do you want to discard all changes to tracked files? plugin action cannot be undone.",onlySelection:!0}).openAndGetResult()==="YES"&&t.promiseQueue.addTask(()=>t.discardAll())}}),t.addCommand({id:"toggle-line-author-info",name:"Toggle line author information",callback:()=>{var n;return(n=t.settingsTab)==null?void 0:n.configureLineAuthorShowStatus(!t.settings.lineAuthor.show)}})}v();var Hc=class{constructor(e){this.plugin=e;this.prefix=this.plugin.manifest.id+":",this.app=e.app}migrate(){let e=["password","hostname","conflict","lastAutoPull","lastAutoBackup","lastAutoPush","gitPath","pluginDisabled"];for(let n of e){let r=localStorage.getItem(this.prefix+n);this.app.loadLocalStorage(this.prefix+n)==null&&r!=null&&r!=null&&(this.app.saveLocalStorage(this.prefix+n,r),localStorage.removeItem(this.prefix+n))}}getPassword(){return this.app.loadLocalStorage(this.prefix+"password")}setPassword(e){return this.app.saveLocalStorage(this.prefix+"password",e)}getUsername(){return this.app.loadLocalStorage(this.prefix+"username")}setUsername(e){return this.app.saveLocalStorage(this.prefix+"username",e)}getHostname(){return this.app.loadLocalStorage(this.prefix+"hostname")}setHostname(e){return this.app.saveLocalStorage(this.prefix+"hostname",e)}getConflict(){return this.app.loadLocalStorage(this.prefix+"conflict")=="true"}setConflict(e){return this.app.saveLocalStorage(this.prefix+"conflict",`${e}`)}getLastAutoPull(){return this.app.loadLocalStorage(this.prefix+"lastAutoPull")}setLastAutoPull(e){return this.app.saveLocalStorage(this.prefix+"lastAutoPull",e)}getLastAutoBackup(){return this.app.loadLocalStorage(this.prefix+"lastAutoBackup")}setLastAutoBackup(e){return this.app.saveLocalStorage(this.prefix+"lastAutoBackup",e)}getLastAutoPush(){return this.app.loadLocalStorage(this.prefix+"lastAutoPush")}setLastAutoPush(e){return this.app.saveLocalStorage(this.prefix+"lastAutoPush",e)}getGitPath(){return this.app.loadLocalStorage(this.prefix+"gitPath")}setGitPath(e){return this.app.saveLocalStorage(this.prefix+"gitPath",e)}getPATHPaths(){var e,n;return(n=(e=this.app.loadLocalStorage(this.prefix+"PATHPaths"))==null?void 0:e.split(":"))!=null?n:[]}setPATHPaths(e){return this.app.saveLocalStorage(this.prefix+"PATHPaths",e.join(":"))}getEnvVars(){var e;return JSON.parse((e=this.app.loadLocalStorage(this.prefix+"envVars"))!=null?e:"[]")}setEnvVars(e){return this.app.saveLocalStorage(this.prefix+"envVars",JSON.stringify(e))}getPluginDisabled(){return this.app.loadLocalStorage(this.prefix+"pluginDisabled")=="true"}setPluginDisabled(e){return this.app.saveLocalStorage(this.prefix+"pluginDisabled",`${e}`)}};v();v();v();v();var $e;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})($e||($e={}));var TE={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},CE={LINES:"lines",WORDS:"words",NONE:"none"},FE={WORD:"word",CHAR:"char"},ni;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(ni||(ni={}));v();var TL=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],CL=RegExp("["+TL.join("\\")+"]","g");function ME(t){return t.replace(CL,"\\$&")}function Fp(t){return t&&t.replace(/\\/g,"/")}function OE(t){let e,n,r,i=0;for(e=0,r=t.length;e1?n[n.length-1]:e}function IE(t,e){return e.reduce((n,r)=>n||t.startsWith(r),!1)}var RE=["a/","b/","i/","w/","c/","o/"];function xr(t,e,n){let r=n!==void 0?[...RE,n]:RE,i=e?new RegExp(`^${ME(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,a=""]=i.exec(t)||[],s=r.find(l=>a.indexOf(l)===0);return(s?a.slice(s.length):a).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function FL(t,e){return xr(t,"---",e)}function ML(t,e){return xr(t,"+++",e)}function LE(t,e={}){let n=[],r=null,i=null,a=null,s=null,o=null,l=null,c=null,u="--- ",f="+++ ",h="@@",d=/^old mode (\d{6})/,p=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,m=/^new file mode (\d{6})/,w=/^copy from "?(.+)"?/,b=/^copy to "?(.+)"?/,S=/^rename from "?(.+)"?/,k=/^rename to "?(.+)"?/,x=/^similarity index (\d+)%/,A=/^dissimilarity index (\d+)%/,y=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,E=/^Binary files (.*) and (.*) differ/,_=/^GIT binary patch/,C=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,M=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,L=/^new file mode (\d{6})/,N=/^deleted file mode (\d{6}),(\d{6})/,j=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,` `).split(` `);function Y(){i!==null&&r!==null&&(r.blocks.push(i),i=null)}function le(){r!==null&&(!r.oldName&&l!==null&&(r.oldName=l),!r.newName&&c!==null&&(r.newName=c),r.newName&&(n.push(r),r=null)),l=null,c=null}function he(){Y(),le(),r={blocks:[],deletedLines:0,addedLines:0}}function ie($){Y();let G;r!==null&&((G=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec($))?(r.isCombined=!1,a=parseInt(G[1],10),o=parseInt(G[2],10)):(G=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec($))?(r.isCombined=!0,a=parseInt(G[1],10),s=parseInt(G[2],10),o=parseInt(G[3],10)):($.startsWith(h)&&console.error("Failed to parse lines, starting in 0!"),a=0,o=0,r.isCombined=!1)),i={lines:[],oldStartLine:a,oldStartLine2:s,newStartLine:o,header:$}}function Me($){if(r===null||i===null||a===null||o===null)return;let G={content:$},D=r.isCombined?["+ "," +","++"]:["+"],se=r.isCombined?["- "," -","--"]:["-"];IE($,D)?(r.addedLines++,G.type=$e.INSERT,G.oldNumber=void 0,G.newNumber=o++):IE($,se)?(r.deletedLines++,G.type=$e.DELETE,G.oldNumber=a++,G.newNumber=void 0):(G.type=$e.CONTEXT,G.oldNumber=a++,G.newNumber=o++),i.lines.push(G)}function de($,G){let D=G;for(;D{if(!$||$.startsWith("*"))return;let D,se=j[G-1],Se=j[G+1],mt=j[G+2];if($.startsWith("diff --git")||$.startsWith("diff --combined")){if(he(),(D=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec($))&&(l=xr(D[1],void 0,e.dstPrefix),c=xr(D[2],void 0,e.srcPrefix)),r===null)throw new Error("Where is my file !!!");r.isGitDiff=!0;return}if($.startsWith("Binary files")&&!(r!=null&&r.isGitDiff)){if(he(),(D=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec($))&&(l=xr(D[1],void 0,e.dstPrefix),c=xr(D[2],void 0,e.srcPrefix)),r===null)throw new Error("Where is my file !!!");r.isBinary=!0;return}if((!r||!r.isGitDiff&&r&&$.startsWith(u)&&Se.startsWith(f)&&mt.startsWith(h))&&he(),r!=null&&r.isTooBig)return;if(r&&(typeof e.diffMaxChanges=="number"&&r.addedLines+r.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&$.length>e.diffMaxLineLength)){r.isTooBig=!0,r.addedLines=0,r.deletedLines=0,r.blocks=[],i=null;let st=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(n.length):"Diff too big to be displayed";ie(st);return}if($.startsWith(u)&&Se.startsWith(f)||$.startsWith(f)&&se.startsWith(u)){if(r&&!r.oldName&&$.startsWith("--- ")&&(D=FL($,e.srcPrefix))){r.oldName=D,r.language=PE(r.oldName,r.language);return}if(r&&!r.newName&&$.startsWith("+++ ")&&(D=ML($,e.dstPrefix))){r.newName=D,r.language=PE(r.newName,r.language);return}}if(r&&($.startsWith(h)||r.isGitDiff&&r.oldName&&r.newName&&!i)){ie($);return}if(i&&($.startsWith("+")||$.startsWith("-")||$.startsWith(" "))){Me($);return}let be=!de($,G);if(r===null)throw new Error("Where is my file !!!");(D=d.exec($))?r.oldMode=D[1]:(D=p.exec($))?r.newMode=D[1]:(D=g.exec($))?(r.deletedFileMode=D[1],r.isDeleted=!0):(D=m.exec($))?(r.newFileMode=D[1],r.isNew=!0):(D=w.exec($))?(be&&(r.oldName=D[1]),r.isCopy=!0):(D=b.exec($))?(be&&(r.newName=D[1]),r.isCopy=!0):(D=S.exec($))?(be&&(r.oldName=D[1]),r.isRename=!0):(D=k.exec($))?(be&&(r.newName=D[1]),r.isRename=!0):(D=E.exec($))?(r.isBinary=!0,r.oldName=xr(D[1],void 0,e.srcPrefix),r.newName=xr(D[2],void 0,e.dstPrefix),ie("Binary file")):_.test($)?(r.isBinary=!0,ie($)):(D=x.exec($))?r.unchangedPercentage=parseInt(D[1],10):(D=A.exec($))?r.changedPercentage=parseInt(D[1],10):(D=y.exec($))?(r.checksumBefore=D[1],r.checksumAfter=D[2],D[3]&&(r.mode=D[3])):(D=C.exec($))?(r.checksumBefore=[D[2],D[3]],r.checksumAfter=D[1]):(D=M.exec($))?(r.oldMode=[D[2],D[3]],r.newMode=D[1]):(D=L.exec($))?(r.newFileMode=D[1],r.isNew=!0):(D=N.exec($))&&(r.deletedFileMode=D[1],r.isDeleted=!0)}),Y(),le(),n}v();v();v();function Xn(){}Xn.prototype={diff:function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.callback;typeof r=="function"&&(i=r,r={}),this.options=r;var a=this;function s(g){return i?(setTimeout(function(){i(void 0,g)},0),!0):g}e=this.castInput(e),n=this.castInput(n),e=this.removeEmpty(this.tokenize(e)),n=this.removeEmpty(this.tokenize(n));var o=n.length,l=e.length,c=1,u=o+l;r.maxEditLength&&(u=Math.min(u,r.maxEditLength));var f=[{newPos:-1,components:[]}],h=this.extractCommon(f[0],n,e,0);if(f[0].newPos+1>=o&&h+1>=l)return s([{value:this.join(n),count:n.length}]);function d(){for(var g=-1*c;g<=c;g+=2){var m=void 0,w=f[g-1],b=f[g+1],S=(b?b.newPos:0)-g;w&&(f[g-1]=void 0);var k=w&&w.newPos+1=o&&S+1>=l)return s(PL(a,m.components,n,e,a.useLongestToken));f[g]=m}c++}if(i)(function g(){setTimeout(function(){if(c>u)return i();d()||g()},0)})();else for(;c<=u;){var p=d();if(p)return p}},pushComponent:function(e,n,r){var i=e[e.length-1];i&&i.added===n&&i.removed===r?e[e.length-1]={count:i.count+1,added:n,removed:r}:e.push({count:1,added:n,removed:r})},extractCommon:function(e,n,r,i){for(var a=n.length,s=r.length,o=e.newPos,l=o-i,c=0;o+1d.length?g:d}),c.value=t.join(u)}else c.value=t.join(n.slice(o,o+c.count));o+=c.count,c.added||(l+=c.count)}}var h=e[s-1];return s>1&&typeof h.value=="string"&&(h.added||h.removed)&&t.equals("",h.value)&&(e[s-2].value+=h.value,e.pop()),e}function IL(t){return{newPos:t.newPos,components:t.components.slice(0)}}var RL=new Xn;function BE(t,e,n){return RL.diff(t,e,n)}var jE=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,DE=/\S/,Pp=new Xn;Pp.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!DE.test(t)&&!DE.test(e)};Pp.tokenize=function(t){for(var e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n{let r=t(e).trim(),i=t(n).trim();return NL(r,i)/(r.length+i.length)}}function fa(t){function e(r,i,a=new Map){let s=1/0,o;for(let l=0;l0||o.indexB>0)&&(S=m.concat(S)),(r.length>h||i.length>d)&&(S=S.concat(b)),S}return n}var pt={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},ri={matching:CE.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:FE.WORD,colorScheme:ni.LIGHT},Rn="/",HE=ua(t=>t.value),$L=fa(HE);function Rp(t){return t.indexOf("dev/null")!==-1}function HL(t){return t.replace(/(]*>((.|\n)*?)<\/ins>)/g,"")}function UL(t){return t.replace(/(]*>((.|\n)*?)<\/del>)/g,"")}function ha(t){switch(t){case $e.CONTEXT:return pt.CONTEXT;case $e.INSERT:return pt.INSERTS;case $e.DELETE:return pt.DELETES}}function da(t){switch(t){case ni.DARK:return"d2h-dark-color-scheme";case ni.AUTO:return"d2h-auto-color-scheme";case ni.LIGHT:default:return"d2h-light-color-scheme"}}function zL(t){return t?2:1}function _r(t){return t.slice(0).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function on(t,e,n=!0){let r=zL(e);return{prefix:t.substring(0,r),content:n?_r(t.substring(r)):t.substring(r)}}function ii(t){let e=Fp(t.oldName),n=Fp(t.newName);if(e!==n&&!Rp(e)&&!Rp(n)){let r=[],i=[],a=e.split(Rn),s=n.split(Rn),o=a.length,l=s.length,c=0,u=o-1,f=l-1;for(;cc&&f>c&&a[u]===s[f];)i.unshift(s[f]),u-=1,f-=1;let h=r.join(Rn),d=i.join(Rn),p=a.slice(c,u+1).join(Rn),g=s.slice(c,f+1).join(Rn);return h.length&&d.length?h+Rn+"{"+p+" \u2192 "+g+"}"+Rn+d:h.length?h+Rn+"{"+p+" \u2192 "+g+"}":d.length?"{"+p+" \u2192 "+g+"}"+Rn+d:e+" \u2192 "+n}else return Rp(n)?e:n}function pa(t){return`d2h-${OE(ii(t)).toString().slice(-6)}`}function ma(t){let e="file-changed";return t.isRename||t.isCopy?e="file-renamed":t.isNew?e="file-added":t.isDeleted?e="file-deleted":t.newName!==t.oldName&&(e="file-renamed"),e}function zc(t,e,n,r={}){let{matching:i,maxLineLengthHighlight:a,matchWordsThreshold:s,diffStyle:o}=Object.assign(Object.assign({},ri),r),l=on(t,n,!1),c=on(e,n,!1);if(l.content.length>a||c.content.length>a)return{oldLine:{prefix:l.prefix,content:_r(l.content)},newLine:{prefix:c.prefix,content:_r(c.content)}};let u=o==="char"?BE(l.content,c.content):NE(l.content,c.content),f=[];if(o==="word"&&i==="words"){let d=u.filter(m=>m.removed),p=u.filter(m=>m.added);$L(p,d).forEach(m=>{m[0].length===1&&m[1].length===1&&HE(m[0][0],m[1][0]){let g=p.added?"ins":p.removed?"del":null,m=f.indexOf(p)>-1?' class="d2h-change"':"",w=_r(p.value);return g!==null?`${d}<${g}${m}>${w}`:`${d}${w}`},"");return{oldLine:{prefix:l.prefix,content:HL(h)},newLine:{prefix:c.prefix,content:UL(h)}}}var UE="file-summary",GL="icon",VL={colorScheme:ri.colorScheme},Gc=class{constructor(e,n={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},VL),n)}render(e){let n=e.map(r=>this.hoganUtils.render(UE,"line",{fileHtmlId:pa(r),oldName:r.oldName,newName:r.newName,fileName:ii(r),deletedLines:"-"+r.deletedLines,addedLines:"+"+r.addedLines},{fileIcon:this.hoganUtils.template(GL,ma(r))})).join(` `);return this.hoganUtils.render(UE,"wrapper",{colorScheme:da(this.config.colorScheme),filesNumber:e.length,files:n})}};v();var jp=Object.assign(Object.assign({},ri),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Ys="generic",zE="line-by-line",WL="icon",qL="tag",Zs=class{constructor(e,n={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},jp),n)}render(e){let n=e.map(r=>{let i;return r.blocks.length?i=this.generateFileHtml(r):i=this.generateEmptyDiff(),this.makeFileDiffHtml(r,i)}).join(` `);return this.hoganUtils.render(Ys,"wrapper",{colorScheme:da(this.config.colorScheme),content:n})}makeFileDiffHtml(e,n){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let r=this.hoganUtils.template(zE,"file-diff"),i=this.hoganUtils.template(Ys,"file-path"),a=this.hoganUtils.template(WL,"file"),s=this.hoganUtils.template(qL,ma(e));return r.render({file:e,fileHtmlId:pa(e),diffs:n,filePath:i.render({fileDiffName:ii(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return this.hoganUtils.render(Ys,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:pt})}generateFileHtml(e){let n=fa(ua(r=>on(r.content,e.isCombined).content));return e.blocks.map(r=>{let i=this.hoganUtils.render(Ys,"block-header",{CSSLineClass:pt,blockHeader:e.isTooBig?r.header:_r(r.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(r).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,n).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);i+=u,i+=f});else if(a.length)a.forEach(l=>{let{prefix:c,content:u}=on(l.content,e.isCombined);i+=this.generateSingleLineHtml(e,{type:pt.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(s.length||o.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,s,o);i+=l,i+=c}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).join(` `)}applyLineGroupping(e){let n=[],r=[],i=[];for(let a=0;a0)&&(n.push([[],r,i]),r=[],i=[]),s.type===$e.CONTEXT?n.push([[s],[],[]]):s.type===$e.INSERT&&r.length===0?n.push([[],[],[s]]):s.type===$e.INSERT&&r.length>0?i.push(s):s.type===$e.DELETE&&r.push(s)}return(r.length||i.length)&&(n.push([[],r,i]),r=[],i=[]),n}applyRematchMatching(e,n,r){let i=e.length*n.length,a=Math.max.apply(null,[0].concat(e.concat(n).map(o=>o.content.length)));return i{let i;return r.blocks.length?i=this.generateFileHtml(r):i=this.generateEmptyDiff(),this.makeFileDiffHtml(r,i)}).join(` `);return this.hoganUtils.render(Ks,"wrapper",{colorScheme:da(this.config.colorScheme),content:n})}makeFileDiffHtml(e,n){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let r=this.hoganUtils.template(XL,"file-diff"),i=this.hoganUtils.template(Ks,"file-path"),a=this.hoganUtils.template(YL,"file"),s=this.hoganUtils.template(ZL,ma(e));return r.render({file:e,fileHtmlId:pa(e),diffs:n,filePath:i.render({fileDiffName:ii(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(Ks,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:pt})}}generateFileHtml(e){let n=fa(ua(r=>on(r.content,e.isCombined).content));return e.blocks.map(r=>{let i={left:this.makeHeaderHtml(r.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(r).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,n).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);i.left+=u,i.right+=f});else if(a.length)a.forEach(l=>{let{prefix:c,content:u}=on(l.content,e.isCombined),{left:f,right:h}=this.generateLineHtml({type:pt.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:pt.CONTEXT,prefix:c,content:u,number:l.newNumber});i.left+=f,i.right+=h});else if(s.length||o.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,s,o);i.left+=l,i.right+=c}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).reduce((r,i)=>({left:r.left+i.left,right:r.right+i.right}),{left:"",right:""})}applyLineGroupping(e){let n=[],r=[],i=[];for(let a=0;a0)&&(n.push([[],r,i]),r=[],i=[]),s.type===$e.CONTEXT?n.push([[s],[],[]]):s.type===$e.INSERT&&r.length===0?n.push([[],[],[s]]):s.type===$e.INSERT&&r.length>0?i.push(s):s.type===$e.DELETE&&r.push(s)}return(r.length||i.length)&&(n.push([[],r,i]),r=[],i=[]),n}applyRematchMatching(e,n,r){let i=e.length*n.length,a=Math.max.apply(null,[0].concat(e.concat(n).map(o=>o.content.length)));return i'),r.b(` `+n),r.b(' '),r.b(` `+n),r.b(r.rp("'),r.b(r.v(r.f("fileName",t,e,0))),r.b(""),r.b(` `+n),r.b(' '),r.b(` `+n),r.b(' '),r.b(r.v(r.f("addedLines",t,e,0))),r.b(""),r.b(` `+n),r.b(' '),r.b(r.v(r.f("deletedLines",t,e,0))),r.b(""),r.b(` `+n),r.b(" "),r.b(` `+n),r.b(" "),r.b(` `+n),r.b(""),r.fl()},partials:{"'),r.b(` `+n),r.b('
'),r.b(` `+n),r.b(' Files changed ('),r.b(r.v(r.f("filesNumber",t,e,0))),r.b(")"),r.b(` `+n),r.b(' hide'),r.b(` `+n),r.b(' show'),r.b(` `+n),r.b("
"),r.b(` `+n),r.b('
    '),r.b(` `+n),r.b(" "),r.b(r.t(r.f("files",t,e,0))),r.b(` `+n),r.b("
"),r.b(` `+n),r.b(""),r.fl()},partials:{},subs:{}});et["generic-block-header"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b(""),r.b(` `+n),r.b(' '),r.b(` `+n),r.b(' '),r.b(` `+n),r.b('
'),r.s(r.f("blockHeader",t,e,1),t,e,0,156,173,"{{ }}")&&(r.rs(t,e,function(i,a,s){s.b(s.t(s.f("blockHeader",i,a,0)))}),t.pop()),r.s(r.f("blockHeader",t,e,1),t,e,1,0,0,"")||r.b(" "),r.b("
"),r.b(` `+n),r.b(" "),r.b(` `+n),r.b(""),r.fl()},partials:{},subs:{}});et["generic-empty-diff"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b(""),r.b(` `+n),r.b(' '),r.b(` `+n),r.b('
'),r.b(` `+n),r.b(" File without changes"),r.b(` `+n),r.b("
"),r.b(` `+n),r.b(" "),r.b(` `+n),r.b(""),r.fl()},partials:{},subs:{}});et["generic-file-path"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b(''),r.b(` `+n),r.b(r.rp("'),r.b(r.v(r.f("fileDiffName",t,e,0))),r.b(""),r.b(` `+n),r.b(r.rp(""),r.b(` `+n),r.b('"),r.fl()},partials:{""),r.b(` `+n),r.b(' '),r.b(` `+n),r.b(" "),r.b(r.t(r.f("lineNumber",t,e,0))),r.b(` `+n),r.b(" "),r.b(` `+n),r.b(' '),r.b(` `+n),r.b('
'),r.b(` `+n),r.s(r.f("prefix",t,e,1),t,e,0,162,238,"{{ }}")&&(r.rs(t,e,function(i,a,s){s.b(' '),s.b(s.t(s.f("prefix",i,a,0))),s.b(""),s.b(` `+n)}),t.pop()),r.s(r.f("prefix",t,e,1),t,e,1,0,0,"")||(r.b('  '),r.b(` `+n)),r.s(r.f("content",t,e,1),t,e,0,371,445,"{{ }}")&&(r.rs(t,e,function(i,a,s){s.b(' '),s.b(s.t(s.f("content",i,a,0))),s.b(""),s.b(` `+n)}),t.pop()),r.s(r.f("content",t,e,1),t,e,1,0,0,"")||(r.b('
'),r.b(` `+n)),r.b("
"),r.b(` `+n),r.b(" "),r.b(` `+n),r.b(""),r.fl()},partials:{},subs:{}});et["generic-wrapper"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('
'),r.b(` `+n),r.b(" "),r.b(r.t(r.f("content",t,e,0))),r.b(` `+n),r.b("
"),r.fl()},partials:{},subs:{}});et["icon-file-added"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});et["icon-file-changed"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});et["icon-file-deleted"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});et["icon-file-renamed"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});et["icon-file"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('"),r.fl()},partials:{},subs:{}});et["line-by-line-file-diff"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('
'),r.b(` `+n),r.b('
'),r.b(` `+n),r.b(" "),r.b(r.t(r.f("filePath",t,e,0))),r.b(` `+n),r.b("
"),r.b(` `+n),r.b('
'),r.b(` `+n),r.b('
'),r.b(` `+n),r.b(' '),r.b(` `+n),r.b(' '),r.b(` `+n),r.b(" "),r.b(r.t(r.f("diffs",t,e,0))),r.b(` `+n),r.b(" "),r.b(` `+n),r.b("
"),r.b(` `+n),r.b("
"),r.b(` `+n),r.b("
"),r.b(` `+n),r.b("
"),r.fl()},partials:{},subs:{}});et["line-by-line-numbers"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('
'),r.b(r.v(r.f("oldNumber",t,e,0))),r.b("
"),r.b(` `+n),r.b('
'),r.b(r.v(r.f("newNumber",t,e,0))),r.b("
"),r.fl()},partials:{},subs:{}});et["side-by-side-file-diff"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('
'),r.b(` `+n),r.b('
'),r.b(` `+n),r.b(" "),r.b(r.t(r.f("filePath",t,e,0))),r.b(` `+n),r.b("
"),r.b(` `+n),r.b('
'),r.b(` `+n),r.b('
'),r.b(` `+n),r.b('
'),r.b(` `+n),r.b(' '),r.b(` `+n),r.b(' '),r.b(` `+n),r.b(" "),r.b(r.t(r.d("diffs.left",t,e,0))),r.b(` `+n),r.b(" "),r.b(` `+n),r.b("
"),r.b(` `+n),r.b("
"),r.b(` `+n),r.b("
"),r.b(` `+n),r.b('
'),r.b(` `+n),r.b('
'),r.b(` `+n),r.b(' '),r.b(` `+n),r.b(' '),r.b(` `+n),r.b(" "),r.b(r.t(r.d("diffs.right",t,e,0))),r.b(` `+n),r.b(" "),r.b(` `+n),r.b("
"),r.b(` `+n),r.b("
"),r.b(` `+n),r.b("
"),r.b(` `+n),r.b("
"),r.b(` `+n),r.b("
"),r.fl()},partials:{},subs:{}});et["tag-file-added"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('ADDED'),r.fl()},partials:{},subs:{}});et["tag-file-changed"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('CHANGED'),r.fl()},partials:{},subs:{}});et["tag-file-deleted"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('DELETED'),r.fl()},partials:{},subs:{}});et["tag-file-renamed"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('RENAMED'),r.fl()},partials:{},subs:{}});var Qs=class{constructor({compiledTemplates:e={},rawTemplates:n={}}){let r=Object.entries(n).reduce((i,[a,s])=>{let o=Hp.compile(s,{asString:!1});return Object.assign(Object.assign({},i),{[a]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},et),e),r)}static compile(e){return Hp.compile(e,{asString:!1})}render(e,n,r,i,a){let s=this.templateKey(e,n);try{return this.preCompiledTemplates[s].render(r,i,a)}catch(o){throw new Error(`Could not find template to render '${s}'`)}}template(e,n){return this.preCompiledTemplates[this.templateKey(e,n)]}templateKey(e,n){return`${e}-${n}`}};var JL=Object.assign(Object.assign(Object.assign({},jp),Dp),{outputFormat:TE.LINE_BY_LINE,drawFileList:!0});function qE(t,e={}){let n=Object.assign(Object.assign({},JL),e),r=typeof t=="string"?LE(t,n):t,i=new Qs(n),{colorScheme:a}=n,s={colorScheme:a},o=n.drawFileList?new Gc(i,s).render(r):"",l=n.outputFormat==="side-by-side"?new Js(i,n).render(r):new Zs(i,n).render(r);return o+l}var Wc=require("obsidian");var ga=class extends Wc.ItemView{constructor(n,r){super(n);this.plugin=r;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.gitRefreshRef=this.app.workspace.on("obsidian-git:refresh",()=>{this.refresh().catch(console.error)}),this.gitViewRefreshRef=this.app.workspace.on("obsidian-git:view-refresh",()=>{this.refresh().catch(console.error)})}getViewType(){return Ct.type}getDisplayText(){var n;if(((n=this.state)==null?void 0:n.file)!=null){let r=this.state.file.split("/").last();return r!=null&&r.endsWith(".md")&&(r=r.slice(0,-3)),Ct.name+` (${r})`}return Ct.name}getIcon(){return Ct.icon}async setState(n,r){this.state=n,Wc.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await this.refresh()}getState(){return this.state}onClose(){return this.app.workspace.offref(this.gitRefreshRef),this.app.workspace.offref(this.gitViewRefreshRef),super.onClose()}async onOpen(){return await this.refresh(),super.onOpen()}async refresh(){var n;if((n=this.state)!=null&&n.file&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let r=await this.plugin.gitManager.getDiffString(this.state.file,this.state.staged,this.state.hash);this.contentEl.empty();let i=this.plugin.gitManager.getRelativeVaultPath(this.state.file);if(!r){if(this.plugin.gitManager instanceof Le&&await this.plugin.gitManager.isTracked(this.state.file))r=[`--- ${this.state.file}`,`+++ ${this.state.file}`,""].join(` `);else if(await this.app.vault.adapter.exists(i)){let a=await this.app.vault.adapter.read(i);r=[...`--- /dev/null +++ ${this.state.file} @@ -0,0 +1,${a.split(` `).length} @@`.split(` `),...a.split(` `).map(o=>`+${o}`)].join(` `)}}if(r){let a=this.parser.parseFromString(qE(r),"text/html").querySelector(".d2h-file-diff");this.contentEl.append(a)}else{let a=this.contentEl.createDiv({cls:"obsidian-git-center"});a.createSpan({text:"\u26A0\uFE0F",attr:{style:"font-size: 2em"}}),a.createEl("br"),a.createSpan({text:"File not found: "+this.state.file})}}finally{this.gettingDiff=!1}}}};v();var Ak=require("obsidian");v();v();v();v();function ke(){}var eo=t=>t;function Up(t){return t()}function qc(){return Object.create(null)}function Ae(t){t.forEach(Up)}function ya(t){return typeof t=="function"}function it(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function XE(t){return Object.keys(t).length===0}v();var YE=typeof window!="undefined",zp=YE?()=>window.performance.now():()=>Date.now(),to=YE?t=>requestAnimationFrame(t):ke;v();var va=new Set;function ZE(t){va.forEach(e=>{e.c(t)||(va.delete(e),e.f())}),va.size!==0&&to(ZE)}function Gp(t){let e;return va.size===0&&to(ZE),{promise:new Promise(n=>{va.add(e={c:t,f:n})}),abort(){va.delete(e)}}}v();v();v();v();var Vp=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;var Xc=class t{constructor(e){ct(this,"_listeners","WeakMap"in Vp?new WeakMap:void 0);ct(this,"_observer");ct(this,"options");this.options=e}observe(e,n){return this._listeners.set(e,n),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!=null?e:this._observer=new ResizeObserver(n=>{var r;for(let i of n)t.entries.set(i.target,i),(r=this._listeners.get(i.target))==null||r(i)})}};Xc.entries="WeakMap"in Vp?new WeakMap:void 0;var KE=!1;function JE(){KE=!0}function QE(){KE=!1}function O(t,e){t.appendChild(e)}function Nt(t,e,n){let r=Yc(t);if(!r.getElementById(e)){let i=I("style");i.id=e,i.textContent=n,tk(r,i)}}function Yc(t){if(!t)return document;let e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function ek(t){let e=I("style");return e.textContent="/* empty */",tk(Yc(t),e),e.sheet}function tk(t,e){return O(t.head||t,e),e.sheet}function re(t,e,n){t.insertBefore(e,n||null)}function ne(t){t.parentNode&&t.parentNode.removeChild(t)}function ln(t,e){for(let n=0;nt.removeEventListener(e,n,r)}function xe(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function T(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function nk(t){return Array.from(t.childNodes)}function Oe(t,e){e=""+e,t.data!==e&&(t.data=e)}function Wp(t,e){t.value=e==null?"":e}function Yt(t,e,n,r){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function ce(t,e,n){t.classList.toggle(e,!!n)}function Zc(t,e,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:r})}function rk(t){let e={};return t.childNodes.forEach(n=>{e[n.slot||"default"]=!0}),e}var Kc=new Map,Jc=0;function ej(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}function tj(t,e){let n={stylesheet:ek(e),rules:{}};return Kc.set(t,n),n}function Qc(t,e,n,r,i,a,s,o=0){let l=16.666/r,c=`{ `;for(let m=0;m<=1;m+=l){let w=e+(n-e)*a(m);c+=m*100+`%{${s(w,1-w)}} `}let u=c+`100% {${s(n,1-n)}} }`,f=`__svelte_${ej(u)}_${o}`,h=Yc(t),{stylesheet:d,rules:p}=Kc.get(h)||tj(h,t);p[f]||(p[f]=!0,d.insertRule(`@keyframes ${f} ${u}`,d.cssRules.length));let g=t.style.animation||"";return t.style.animation=`${g?`${g}, `:""}${f} ${r}ms linear ${i}ms 1 both`,Jc+=1,f}function qp(t,e){let n=(t.style.animation||"").split(", "),r=n.filter(e?a=>a.indexOf(e)<0:a=>a.indexOf("__svelte")===-1),i=n.length-r.length;i&&(t.style.animation=r.join(", "),Jc-=i,Jc||nj())}function nj(){to(()=>{Jc||(Kc.forEach(t=>{let{ownerNode:e}=t.stylesheet;e&&ne(e)}),Kc.clear())})}v();v();v();v();var Sr;function Yn(t){Sr=t}function ik(){if(!Sr)throw new Error("Function called outside component initialization");return Sr}function no(t){ik().$$.on_destroy.push(t)}function Er(t,e){let n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}var ai=[];var je=[],xa=[],ak=[],rj=Promise.resolve(),Yp=!1;function sk(){Yp||(Yp=!0,rj.then(eu))}function wt(t){xa.push(t)}var Xp=new Set,ba=0;function eu(){if(ba!==0)return;let t=Sr;do{try{for(;bat.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),xa=e}var ro;function aj(){return ro||(ro=Promise.resolve(),ro.then(()=>{ro=null})),ro}function Zp(t,e,n){t.dispatchEvent(Zc(`${e?"intro":"outro"}${n}`))}var tu=new Set,Zn;function Ce(){Zn={r:0,c:[],p:Zn}}function Fe(){Zn.r||Ae(Zn.c),Zn=Zn.p}function U(t,e){t&&t.i&&(tu.delete(t),t.i(e))}function X(t,e,n,r){if(t&&t.o){if(tu.has(t))return;tu.add(t),Zn.c.push(()=>{tu.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}var sj={duration:0};function bt(t,e,n,r){let a=e(t,n,{direction:"both"}),s=r?0:1,o=null,l=null,c=null,u;function f(){c&&qp(t,c)}function h(p,g){let m=p.b-s;return g*=Math.abs(m),{a:s,b:p.b,d:m,duration:g,start:p.start,end:p.start+g,group:p.group}}function d(p){let{delay:g=0,duration:m=300,easing:w=eo,tick:b=ke,css:S}=a||sj,k={start:zp()+g,b:p};p||(k.group=Zn,Zn.r+=1),"inert"in t&&(p?u!==void 0&&(t.inert=u):(u=t.inert,t.inert=!0)),o||l?l=k:(S&&(f(),c=Qc(t,s,p,m,g,w,S)),p&&b(0,1),o=h(k,m),wt(()=>Zp(t,p,"start")),Gp(x=>{if(l&&x>l.start&&(o=h(l,m),l=null,Zp(t,o.b,"start"),S&&(f(),c=Qc(t,s,o.b,o.duration,0,w,a.css))),o){if(x>=o.end)b(s=o.b,1-s),Zp(t,o.b,"end"),l||(o.b?f():--o.group.r||Ae(o.group.c)),o=null;else if(x>=o.start){let A=x-o.start;s=o.a+o.d*w(A/o.duration),b(s,1-s)}}return!!(o||l)}))}return{run(p){ya(a)?aj().then(()=>{a=a({direction:p?"in":"out"}),d(p)}):d(p)},end(){f(),o=l=null}}}v();function tt(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}v();v();v();var oj=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],lj=new Set([...oj]);v();v();v();function He(t){t&&t.c()}function De(t,e,n){let{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),wt(()=>{let a=t.$$.on_mount.map(Up).filter(ya);t.$$.on_destroy?t.$$.on_destroy.push(...a):Ae(a),t.$$.on_mount=[]}),i.forEach(wt)}function Be(t,e){let n=t.$$;n.fragment!==null&&(ok(n.after_update),Ae(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function uj(t,e){t.$$.dirty[0]===-1&&(ai.push(t),sk(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{let p=d.length?d[0]:h;return c.ctx&&i(c.ctx[f],c.ctx[f]=p)&&(!c.skip_bound&&c.bound[f]&&c.bound[f](p),u&&uj(t,f)),h}):[],c.update(),u=!0,Ae(c.before_update),c.fragment=r?r(c.ctx):!1,e.target){if(e.hydrate){JE();let f=nk(e.target);c.fragment&&c.fragment.l(f),f.forEach(ne)}else c.fragment&&c.fragment.c();e.intro&&U(t.$$.fragment),De(t,e.target,e.anchor),QE(),eu()}Yn(l)}var fj;typeof HTMLElement=="function"&&(fj=class extends HTMLElement{constructor(e,n,r){super();ct(this,"$$ctor");ct(this,"$$s");ct(this,"$$c");ct(this,"$$cn",!1);ct(this,"$$d",{});ct(this,"$$r",!1);ct(this,"$$p_d",{});ct(this,"$$l",{});ct(this,"$$l_u",new Map);this.$$ctor=e,this.$$s=n,r&&this.attachShadow({mode:"open"})}addEventListener(e,n,r){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(n),this.$$c){let i=this.$$c.$on(e,n);this.$$l_u.set(n,i)}super.addEventListener(e,n,r)}removeEventListener(e,n,r){if(super.removeEventListener(e,n,r),this.$$c){let i=this.$$l_u.get(n);i&&(i(),this.$$l_u.delete(n))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(a){return()=>{let s;return{c:function(){s=I("slot"),a!=="default"&&T(s,"name",a)},m:function(c,u){re(c,s,u)},d:function(c){c&&ne(s)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let n={},r=rk(this);for(let a of this.$$s)a in r&&(n[a]=[e(a)]);for(let a of this.attributes){let s=this.$$g_p(a.name);s in this.$$d||(this.$$d[s]=Kp(s,a.value,this.$$p_d,"toProp"))}for(let a in this.$$p_d)!(a in this.$$d)&&this[a]!==void 0&&(this.$$d[a]=this[a],delete this[a]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:n,$$scope:{ctx:[]}}});let i=()=>{this.$$r=!0;for(let a in this.$$p_d)if(this.$$d[a]=this.$$c.$$.ctx[this.$$c.$$.props[a]],this.$$p_d[a].reflect){let s=Kp(a,this.$$d[a],this.$$p_d,"toAttribute");s==null?this.removeAttribute(this.$$p_d[a].attribute||a):this.setAttribute(this.$$p_d[a].attribute||a,s)}this.$$r=!1};this.$$c.$$.after_update.push(i),i();for(let a in this.$$l)for(let s of this.$$l[a]){let o=this.$$c.$on(a,s);this.$$l_u.set(s,o)}this.$$l={}}}attributeChangedCallback(e,n,r){var i;this.$$r||(e=this.$$g_p(e),this.$$d[e]=Kp(e,r,this.$$p_d,"toProp"),(i=this.$$c)==null||i.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0)})}$$g_p(e){return Object.keys(this.$$p_d).find(n=>this.$$p_d[n].attribute===e||!this.$$p_d[n].attribute&&n.toLowerCase()===e)||e}});function Kp(t,e,n,r){var a;let i=(a=n[t])==null?void 0:a.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!r||!n[t])return e;if(r==="toAttribute")switch(i){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e==null?null:e;default:return e}else switch(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}var Ve=class{constructor(){ct(this,"$$");ct(this,"$$set")}$destroy(){Be(this,1),this.$destroy=ke}$on(e,n){if(!ya(n))return ke;let r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{let i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!XE(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}};v();v();var lk="4";v();typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(lk);v();function _a(t,e,n,r){function i(a){return a instanceof n?a:new n(function(s){s(a)})}return new(n||(n=Promise))(function(a,s){function o(u){try{c(r.next(u))}catch(f){s(f)}}function l(u){try{c(r.throw(u))}catch(f){s(f)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((r=r.apply(t,e||[])).next())})}var iu=require("obsidian");v();v();var io=require("obsidian");v();v();function ck(t){let e=t-1;return e*e*e+1}function xt(t,{delay:e=0,duration:n=400,easing:r=ck,axis:i="y"}={}){let a=getComputedStyle(t),s=+a.opacity,o=i==="y"?"height":"width",l=parseFloat(a[o]),c=i==="y"?["top","bottom"]:["left","right"],u=c.map(w=>`${w[0].toUpperCase()}${w.slice(1)}`),f=parseFloat(a[`padding${u[0]}`]),h=parseFloat(a[`padding${u[1]}`]),d=parseFloat(a[`margin${u[0]}`]),p=parseFloat(a[`margin${u[1]}`]),g=parseFloat(a[`border${u[0]}Width`]),m=parseFloat(a[`border${u[1]}Width`]);return{delay:e,duration:n,easing:r,css:w=>`overflow: hidden;opacity: ${Math.min(w*20,1)*s};${o}: ${w*l}px;padding-${c[0]}: ${w*f}px;padding-${c[1]}: ${w*h}px;margin-${c[0]}: ${w*d}px;margin-${c[1]}: ${w*p}px;border-${c[0]}-width: ${w*g}px;border-${c[1]}-width: ${w*m}px;`}}v();var Sa=require("obsidian");function hj(t){Nt(t,"svelte-1wbh8tp","main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}")}function uk(t){let e,n,r;return{c(){e=I("div"),T(e,"data-icon","go-to-file"),T(e,"aria-label","Open File"),T(e,"class","clickable-icon")},m(i,a){re(i,e,a),t[7](e),n||(r=[te(e,"auxclick",xe(t[4])),te(e,"click",xe(t[4]))],n=!0)},p:ke,d(i){i&&ne(e),t[7](null),n=!1,Ae(r)}}}function dj(t){let e,n,r,i=Bt(t[0].vault_path)+"",a,s,o,l,c=t[1].app.vault.getAbstractFileByPath(t[0].vault_path)instanceof Sa.TFile,u,f,h=t[0].status+"",d,p,g,m,w,b,S=c&&uk(t);return{c(){var k,x;e=I("main"),n=I("div"),r=I("div"),a=Te(i),s=J(),o=I("div"),l=I("div"),S&&S.c(),u=J(),f=I("span"),d=Te(h),T(r,"class","tree-item-inner nav-file-title-content"),T(l,"class","buttons"),T(f,"class","type"),T(f,"data-type",p=t[0].status),T(o,"class","git-tools"),T(n,"class","tree-item-self is-clickable nav-file-title svelte-1wbh8tp"),T(n,"data-path",g=t[0].vault_path),T(n,"data-tooltip-position",t[3]),T(n,"aria-label",m=t[0].vault_path),ce(n,"is-active",((k=t[1].plugin.lastDiffViewState)==null?void 0:k.file)==t[0].vault_path&&((x=t[1].plugin.lastDiffViewState)==null?void 0:x.hash)),T(e,"class","tree-item nav-file svelte-1wbh8tp")},m(k,x){re(k,e,x),O(e,n),O(n,r),O(r,a),O(n,s),O(n,o),O(o,l),S&&S.m(l,null),O(o,u),O(o,f),O(f,d),w||(b=[te(e,"click",xe(t[5])),te(e,"auxclick",xe(t[8])),te(e,"focus",t[6])],w=!0)},p(k,[x]){var A,y;x&1&&i!==(i=Bt(k[0].vault_path)+"")&&Oe(a,i),x&3&&(c=k[1].app.vault.getAbstractFileByPath(k[0].vault_path)instanceof Sa.TFile),c?S?S.p(k,x):(S=uk(k),S.c(),S.m(l,null)):S&&(S.d(1),S=null),x&1&&h!==(h=k[0].status+"")&&Oe(d,h),x&1&&p!==(p=k[0].status)&&T(f,"data-type",p),x&1&&g!==(g=k[0].vault_path)&&T(n,"data-path",g),x&8&&T(n,"data-tooltip-position",k[3]),x&1&&m!==(m=k[0].vault_path)&&T(n,"aria-label",m),x&3&&ce(n,"is-active",((A=k[1].plugin.lastDiffViewState)==null?void 0:A.file)==k[0].vault_path&&((y=k[1].plugin.lastDiffViewState)==null?void 0:y.hash))},i:ke,o:ke,d(k){k&&ne(e),S&&S.d(),w=!1,Ae(b)}}}function pj(t,e,n){let r,{diff:i}=e,{view:a}=e,s=[];window.setTimeout(()=>s.forEach(h=>(0,Sa.setIcon)(h,h.getAttr("data-icon"))),0);function o(h){var d;let p=a.app.vault.getAbstractFileByPath(i.vault_path);p instanceof Sa.TFile&&((d=Xt(a.app,h))===null||d===void 0||d.openFile(p).catch(g=>a.plugin.displayError(g)))}function l(h){var d;(d=Xt(a.app,h))===null||d===void 0||d.setViewState({type:Ct.type,active:!0,state:{file:i.path,staged:!1,hash:i.hash}})}function c(h){Er.call(this,t,h)}function u(h){je[h?"unshift":"push"](()=>{s[0]=h,n(2,s)})}let f=h=>{h.button==2?In(a.app,h,i.vault_path,a.leaf,"git-history"):l(h)};return t.$$set=h=>{"diff"in h&&n(0,i=h.diff),"view"in h&&n(1,a=h.view)},t.$$.update=()=>{t.$$.dirty&2&&n(3,r=a.leaf.getRoot().side=="left"?"right":"left")},[i,a,s,r,o,l,c,u,f]}var Jp=class extends Ve{constructor(e){super(),at(this,e,pj,dj,it,{diff:0,view:1},hj)}},nu=Jp;v();function mj(t){Nt(t,"svelte-1lnl15d","main.svelte-1lnl15d .nav-folder-title-content.svelte-1lnl15d{display:flex;align-items:center}")}function fk(t,e,n){let r=t.slice();return r[8]=e[n],r}function gj(t){let e,n,r,i,a,s,o,l=t[8].title+"",c,u,f,h,d,p,g;function m(){return t[7](t[8])}let w=!t[4][t[8].title]&&hk(t);return{c(){e=I("div"),n=I("div"),r=I("div"),i=J(),a=I("div"),a.innerHTML='',s=J(),o=I("div"),c=Te(l),f=J(),w&&w.c(),h=J(),T(r,"data-icon","folder"),Yt(r,"padding-right","5px"),Yt(r,"display","flex"),T(a,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),ce(a,"is-collapsed",t[4][t[8].title]),T(o,"class","tree-item-inner nav-folder-title-content svelte-1lnl15d"),T(n,"class","tree-item-self is-clickable nav-folder-title"),T(n,"data-tooltip-position",t[5]),T(n,"aria-label",u=t[8].vaultPath),T(e,"class","tree-item nav-folder"),ce(e,"is-collapsed",t[4][t[8].title])},m(b,S){re(b,e,S),O(e,n),O(n,r),O(n,i),O(n,a),O(n,s),O(n,o),O(o,c),O(e,f),w&&w.m(e,null),O(e,h),d=!0,p||(g=te(n,"click",m),p=!0)},p(b,S){t=b,(!d||S&17)&&ce(a,"is-collapsed",t[4][t[8].title]),(!d||S&1)&&l!==(l=t[8].title+"")&&Oe(c,l),(!d||S&32)&&T(n,"data-tooltip-position",t[5]),(!d||S&1&&u!==(u=t[8].vaultPath))&&T(n,"aria-label",u),t[4][t[8].title]?w&&(Ce(),X(w,1,1,()=>{w=null}),Fe()):w?(w.p(t,S),S&17&&U(w,1)):(w=hk(t),w.c(),U(w,1),w.m(e,h)),(!d||S&17)&&ce(e,"is-collapsed",t[4][t[8].title])},i(b){d||(U(w),d=!0)},o(b){X(w),d=!1},d(b){b&&ne(e),w&&w.d(),p=!1,g()}}}function yj(t){let e,n,r,i;return n=new nu({props:{diff:t[8].data,view:t[2]}}),{c(){e=I("div"),He(n.$$.fragment),r=J()},m(a,s){re(a,e,s),De(n,e,null),O(e,r),i=!0},p(a,s){let o={};s&1&&(o.diff=a[8].data),s&4&&(o.view=a[2]),n.$set(o)},i(a){i||(U(n.$$.fragment,a),i=!0)},o(a){X(n.$$.fragment,a),i=!1},d(a){a&&ne(e),Be(n)}}}function hk(t){let e,n,r,i;return n=new ru({props:{hierarchy:t[8],plugin:t[1],view:t[2]}}),{c(){e=I("div"),He(n.$$.fragment),T(e,"class","tree-item-children nav-folder-children")},m(a,s){re(a,e,s),De(n,e,null),i=!0},p(a,s){let o={};s&1&&(o.hierarchy=a[8]),s&2&&(o.plugin=a[1]),s&4&&(o.view=a[2]),n.$set(o)},i(a){i||(U(n.$$.fragment,a),a&&wt(()=>{i&&(r||(r=bt(e,xt,{duration:150},!0)),r.run(1))}),i=!0)},o(a){X(n.$$.fragment,a),a&&(r||(r=bt(e,xt,{duration:150},!1)),r.run(0)),i=!1},d(a){a&&ne(e),Be(n),a&&r&&r.end()}}}function dk(t){let e,n,r,i,a=[yj,gj],s=[];function o(l,c){return l[8].data?0:1}return e=o(t,-1),n=s[e]=a[e](t),{c(){n.c(),r=wa()},m(l,c){s[e].m(l,c),re(l,r,c),i=!0},p(l,c){let u=e;e=o(l,c),e===u?s[e].p(l,c):(Ce(),X(s[u],1,1,()=>{s[u]=null}),Fe(),n=s[e],n?n.p(l,c):(n=s[e]=a[e](l),n.c()),U(n,1),n.m(r.parentNode,r))},i(l){i||(U(n),i=!0)},o(l){X(n),i=!1},d(l){l&&ne(r),s[e].d(l)}}}function vj(t){let e,n,r=tt(t[0].children),i=[];for(let s=0;sX(i[s],1,1,()=>{i[s]=null});return{c(){e=I("main");for(let s=0;sc(f);return t.$$set=f=>{"hierarchy"in f&&n(0,i=f.hierarchy),"plugin"in f&&n(1,a=f.plugin),"view"in f&&n(2,s=f.view),"topLevel"in f&&n(3,o=f.topLevel)},t.$$.update=()=>{t.$$.dirty&4&&n(5,r=s.leaf.getRoot().side=="left"?"right":"left")},[i,a,s,o,l,r,c,u]}var ru=class extends Ve{constructor(e){super(),at(this,e,wj,vj,it,{hierarchy:0,plugin:1,view:2,topLevel:3},mj)}},pk=ru;function mk(t,e,n){let r=t.slice();return r[9]=e[n],r}function gk(t){let e,n=t[0].refs.join(", ")+"",r;return{c(){e=I("div"),r=Te(n),T(e,"class","git-ref")},m(i,a){re(i,e,a),O(e,r)},p(i,a){a&1&&n!==(n=i[0].refs.join(", ")+"")&&Oe(r,n)},d(i){i&&ne(e)}}}function yk(t){let e,n=t[7](t[0])+"",r;return{c(){e=I("div"),r=Te(n),T(e,"class","git-author")},m(i,a){re(i,e,a),O(e,r)},p(i,a){a&1&&n!==(n=i[7](i[0])+"")&&Oe(r,n)},d(i){i&&ne(e)}}}function vk(t){let e,n=(0,io.moment)(t[0].date).format(t[3].settings.commitDateFormat)+"",r;return{c(){e=I("div"),r=Te(n),T(e,"class","git-date")},m(i,a){re(i,e,a),O(e,r)},p(i,a){a&9&&n!==(n=(0,io.moment)(i[0].date).format(i[3].settings.commitDateFormat)+"")&&Oe(r,n)},d(i){i&&ne(e)}}}function wk(t){let e,n,r,i,a,s=[xj,bj],o=[];function l(c,u){return c[2]?0:1}return n=l(t,-1),r=o[n]=s[n](t),{c(){e=I("div"),r.c(),T(e,"class","tree-item-children nav-folder-children")},m(c,u){re(c,e,u),o[n].m(e,null),a=!0},p(c,u){let f=n;n=l(c,u),n===f?o[n].p(c,u):(Ce(),X(o[f],1,1,()=>{o[f]=null}),Fe(),r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),U(r,1),r.m(e,null))},i(c){a||(U(r),c&&wt(()=>{a&&(i||(i=bt(e,xt,{duration:150},!0)),i.run(1))}),a=!0)},o(c){X(r),c&&(i||(i=bt(e,xt,{duration:150},!1)),i.run(0)),a=!1},d(c){c&&ne(e),o[n].d(),c&&i&&i.end()}}}function bj(t){let e,n,r=tt(t[0].diff.files),i=[];for(let s=0;sX(i[s],1,1,()=>{i[s]=null});return{c(){for(let s=0;s0&&gk(t),S=t[3].settings.authorInHistoryView!="hide"&&((A=t[0].author)==null?void 0:A.name)&&yk(t),k=t[3].settings.dateInHistoryView&&vk(t),x=!t[4]&&wk(t);return{c(){var y;e=I("main"),n=I("div"),r=I("div"),i=I("div"),i.innerHTML='',a=J(),s=I("div"),b&&b.c(),o=J(),S&&S.c(),l=J(),k&&k.c(),c=J(),u=I("div"),h=Te(f),p=J(),x&&x.c(),T(i,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),ce(i,"is-collapsed",t[4]),T(u,"class","tree-item-inner nav-folder-title-content"),T(r,"class","tree-item-self is-clickable nav-folder-title"),T(r,"aria-label",d=`${t[0].refs.length>0?t[0].refs.join(", ")+` `:""}${(y=t[0].author)==null?void 0:y.name} ${(0,io.moment)(t[0].date).format(t[3].settings.commitDateFormat)} ${t[0].message}`),T(r,"data-tooltip-position",t[5]),T(n,"class","tree-item nav-folder"),ce(n,"is-collapsed",t[4])},m(y,E){re(y,e,E),O(e,n),O(n,r),O(r,i),O(r,a),O(r,s),b&&b.m(s,null),O(s,o),S&&S.m(s,null),O(s,l),k&&k.m(s,null),O(s,c),O(s,u),O(u,h),O(n,p),x&&x.m(n,null),g=!0,m||(w=te(r,"click",t[8]),m=!0)},p(y,[E]){var _,C;(!g||E&16)&&ce(i,"is-collapsed",y[4]),y[0].refs.length>0?b?b.p(y,E):(b=gk(y),b.c(),b.m(s,o)):b&&(b.d(1),b=null),y[3].settings.authorInHistoryView!="hide"&&((_=y[0].author)!=null&&_.name)?S?S.p(y,E):(S=yk(y),S.c(),S.m(s,l)):S&&(S.d(1),S=null),y[3].settings.dateInHistoryView?k?k.p(y,E):(k=vk(y),k.c(),k.m(s,c)):k&&(k.d(1),k=null),(!g||E&1)&&f!==(f=y[0].message+"")&&Oe(h,f),(!g||E&9&&d!==(d=`${y[0].refs.length>0?y[0].refs.join(", ")+` `:""}${(C=y[0].author)==null?void 0:C.name} ${(0,io.moment)(y[0].date).format(y[3].settings.commitDateFormat)} ${y[0].message}`))&&T(r,"aria-label",d),(!g||E&32)&&T(r,"data-tooltip-position",y[5]),y[4]?x&&(Ce(),X(x,1,1,()=>{x=null}),Fe()):x?(x.p(y,E),E&16&&U(x,1)):(x=wk(y),x.c(),U(x,1),x.m(n,null)),(!g||E&16)&&ce(n,"is-collapsed",y[4])},i(y){g||(U(x),g=!0)},o(y){X(x),g=!1},d(y){y&&ne(e),b&&b.d(),S&&S.d(),k&&k.d(),x&&x.d(),m=!1,w()}}}function Sj(t,e,n){let r,i,{log:a}=e,{view:s}=e,{showTree:o}=e,{plugin:l}=e,c=!0;function u(h){let d=h.author.name;if(l.settings.authorInHistoryView=="full")return d;if(l.settings.authorInHistoryView=="initials")return d.split(" ").filter(g=>g.length>0).map(g=>g[0].toUpperCase()).join("")}let f=()=>n(4,c=!c);return t.$$set=h=>{"log"in h&&n(0,a=h.log),"view"in h&&n(1,s=h.view),"showTree"in h&&n(2,o=h.showTree),"plugin"in h&&n(3,l=h.plugin)},t.$$.update=()=>{t.$$.dirty&9&&n(6,r={title:"",path:"",vaultPath:"",children:l.gitManager.getTreeStructure(a.diff.files)}),t.$$.dirty&2&&n(5,i=s.leaf.getRoot().side=="left"?"right":"left")},[a,s,o,l,c,i,r,u,f]}var Qp=class extends Ve{constructor(e){super(),at(this,e,Sj,_j,it,{log:0,view:1,showTree:2,plugin:3})}},xk=Qp;function _k(t,e,n){let r=t.slice();return r[13]=e[n],r}function Sk(t){let e,n,r=tt(t[6]),i=[];for(let s=0;sX(i[s],1,1,()=>{i[s]=null});return{c(){e=I("div");for(let s=0;s{h=null}),Fe())},i(d){c||(U(h),c=!0)},o(d){X(h),c=!1},d(d){d&&ne(e),t[8](null),t[10](null),h&&h.d(),u=!1,Ae(f)}}}function kj(t,e,n){let{plugin:r}=e,{view:i}=e,a,s=[],o,l=r.settings.treeStructure,c,u;c=i.app.workspace.on("obsidian-git:view-refresh",()=>void h().catch(console.error)),h().catch(console.error),r.app.workspace.onLayoutReady(()=>{window.setTimeout(()=>{s.forEach(m=>(0,iu.setIcon)(m,m.getAttr("data-icon"))),(0,iu.setIcon)(u,l?"list":"folder")},0)}),no(()=>{i.app.workspace.offref(c)});function f(){i.app.workspace.trigger("obsidian-git:refresh")}function h(){return _a(this,void 0,void 0,function*(){if(!r.gitReady){n(6,o=void 0);return}n(4,a=!0);let m=r.gitManager instanceof Le;n(6,o=yield r.gitManager.log(void 0,!1,m?50:10)),n(4,a=!1)})}function d(m){je[m?"unshift":"push"](()=>{u=m,n(3,u)})}let p=()=>{n(2,l=!l),n(0,r.settings.treeStructure=l,r),r.saveSettings()};function g(m){je[m?"unshift":"push"](()=>{s[6]=m,n(5,s)})}return t.$$set=m=>{"plugin"in m&&n(0,r=m.plugin),"view"in m&&n(1,i=m.view)},t.$$.update=()=>{t.$$.dirty&12&&u&&(u.empty(),(0,iu.setIcon)(u,l?"list":"folder"))},[r,i,l,u,a,s,o,f,d,p,g]}var em=class extends Ve{constructor(e){super(),at(this,e,kj,Ej,it,{plugin:0,view:1})}},kk=em;var ao=class extends Ak.ItemView{constructor(e,n){super(e),this.plugin=n,this.hoverPopover=null}getViewType(){return nn.type}getDisplayText(){return nn.name}getIcon(){return nn.icon}onClose(){var e;return(e=this._view)==null||e.$destroy(),super.onClose()}reload(){var e;(e=this._view)==null||e.$destroy(),this._view=new kk({target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};v();var Tk=require("obsidian"),au=class extends Tk.FuzzySuggestModal{constructor(n,r){super(n.app);this.branches=r;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(n){return n}onChooseItem(n,r){this.resolve(n)}openAndGetReslt(){return new Promise(n=>{this.resolve=n,this.open()})}onClose(){new Promise(n=>setTimeout(n,10)).then(()=>{this.resolve&&this.resolve(void 0)})}};v();var Zk=require("obsidian");v();var Ta=require("obsidian");v();var Ck=require("obsidian"),kr=class extends Ck.Modal{constructor(n,r,i){super(n);this.deletion=r;this.filename=i;this.resolve=null}myOpen(){return this.open(),new Promise(n=>{this.resolve=n})}onOpen(){let{contentEl:n,titleEl:r}=this;r.setText(`${this.deletion?"Delete":"Discard"} this file?`),n.createEl("p").setText(`Do you really want to ${this.deletion?"delete":"discard the changes of"} "${this.filename}"`);let i=n.createDiv({cls:"modal-button-container"}),a=i.createEl("button",{cls:"mod-warning",text:this.deletion?"Delete":"Discard"});a.addEventListener("click",()=>{this.resolve&&this.resolve(!0),this.close()}),a.addEventListener("keypress",()=>{this.resolve&&this.resolve(!0),this.close()});let s=i.createEl("button",{text:"Cancel"});s.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),s.addEventListener("keypress",()=>(this.resolve&&this.resolve(!1),this.close()))}onClose(){let{contentEl:n}=this;n.empty()}};v();var Ea=require("obsidian");v();v();var Aj=Ze(Fk()),Ar=require("obsidian");function si(t,e,n){let r=t.target;app.workspace.trigger("hover-link",{event:t,source:e.getViewType(),hoverParent:e,targetEl:r,linktext:n})}function Tj(t){Nt(t,"svelte-1wbh8tp","main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}")}function Mk(t){let e,n,r;return{c(){e=I("div"),T(e,"data-icon","go-to-file"),T(e,"aria-label","Open File"),T(e,"class","clickable-icon")},m(i,a){re(i,e,a),t[11](e),n||(r=[te(e,"auxclick",xe(t[5])),te(e,"click",xe(t[5]))],n=!0)},p:ke,d(i){i&&ne(e),t[11](null),n=!1,Ae(r)}}}function Cj(t){let e,n,r,i=Bt(t[0].vault_path)+"",a,s,o,l,c=t[1].app.vault.getAbstractFileByPath(t[0].vault_path)instanceof Ea.TFile,u,f,h,d,p,g,m=t[0].working_dir+"",w,b,S,k,x,A,y=c&&Mk(t);return{c(){var E,_,C;e=I("main"),n=I("div"),r=I("div"),a=Te(i),s=J(),o=I("div"),l=I("div"),y&&y.c(),u=J(),f=I("div"),h=J(),d=I("div"),p=J(),g=I("div"),w=Te(m),T(r,"class","tree-item-inner nav-file-title-content"),T(f,"data-icon","undo"),T(f,"aria-label","Discard"),T(f,"class","clickable-icon"),T(d,"data-icon","plus"),T(d,"aria-label","Stage"),T(d,"class","clickable-icon"),T(l,"class","buttons"),T(g,"class","type"),T(g,"data-type",b=t[0].working_dir),T(o,"class","git-tools"),T(n,"class","tree-item-self is-clickable nav-file-title svelte-1wbh8tp"),T(n,"data-path",S=t[0].vault_path),T(n,"data-tooltip-position",t[3]),T(n,"aria-label",k=t[0].vault_path),ce(n,"is-active",((E=t[1].plugin.lastDiffViewState)==null?void 0:E.file)==t[0].vault_path&&!((_=t[1].plugin.lastDiffViewState)!=null&&_.hash)&&!((C=t[1].plugin.lastDiffViewState)!=null&&C.staged)),T(e,"class","tree-item nav-file svelte-1wbh8tp")},m(E,_){re(E,e,_),O(e,n),O(n,r),O(r,a),O(n,s),O(n,o),O(o,l),y&&y.m(l,null),O(l,u),O(l,f),t[12](f),O(l,h),O(l,d),t[13](d),O(o,p),O(o,g),O(g,w),x||(A=[te(f,"click",xe(t[8])),te(d,"click",xe(t[6])),te(e,"mouseover",t[4]),te(e,"click",xe(t[7])),te(e,"auxclick",xe(t[14])),te(e,"focus",t[10])],x=!0)},p(E,[_]){var C,M,L;_&1&&i!==(i=Bt(E[0].vault_path)+"")&&Oe(a,i),_&3&&(c=E[1].app.vault.getAbstractFileByPath(E[0].vault_path)instanceof Ea.TFile),c?y?y.p(E,_):(y=Mk(E),y.c(),y.m(l,u)):y&&(y.d(1),y=null),_&1&&m!==(m=E[0].working_dir+"")&&Oe(w,m),_&1&&b!==(b=E[0].working_dir)&&T(g,"data-type",b),_&1&&S!==(S=E[0].vault_path)&&T(n,"data-path",S),_&8&&T(n,"data-tooltip-position",E[3]),_&1&&k!==(k=E[0].vault_path)&&T(n,"aria-label",k),_&3&&ce(n,"is-active",((C=E[1].plugin.lastDiffViewState)==null?void 0:C.file)==E[0].vault_path&&!((M=E[1].plugin.lastDiffViewState)!=null&&M.hash)&&!((L=E[1].plugin.lastDiffViewState)!=null&&L.staged))},i:ke,o:ke,d(E){E&&ne(e),y&&y.d(),t[12](null),t[13](null),x=!1,Ae(A)}}}function Fj(t,e,n){let r,{change:i}=e,{view:a}=e,{manager:s}=e,o=[];window.setTimeout(()=>o.forEach(b=>(0,Ea.setIcon)(b,b.getAttr("data-icon"))),0);function l(b){a.app.vault.getAbstractFileByPath(i.vault_path)&&si(b,a,i.vault_path)}function c(b){var S;let k=a.app.vault.getAbstractFileByPath(i.vault_path);k instanceof Ea.TFile&&((S=Xt(a.app,b))===null||S===void 0||S.openFile(k).catch(x=>a.plugin.displayError(x)))}function u(){s.stage(i.path,!1).catch(b=>a.plugin.displayError(b)).finally(()=>{a.app.workspace.trigger("obsidian-git:refresh")})}function f(b){var S;(S=Xt(a.app,b))===null||S===void 0||S.setViewState({type:Ct.type,active:!0,state:{file:i.path,staged:!1}})}function h(){let b=i.working_dir=="U";new kr(a.app,b,i.vault_path).myOpen().then(S=>{if(S===!0)return b?a.app.vault.adapter.remove(i.vault_path).finally(()=>{a.app.workspace.trigger("obsidian-git:refresh")}):s.discard(i.path).finally(()=>{a.app.workspace.trigger("obsidian-git:refresh")})},S=>a.plugin.displayError(S))}function d(b){Er.call(this,t,b)}function p(b){je[b?"unshift":"push"](()=>{o[1]=b,n(2,o)})}function g(b){je[b?"unshift":"push"](()=>{o[0]=b,n(2,o)})}function m(b){je[b?"unshift":"push"](()=>{o[2]=b,n(2,o)})}let w=b=>{b.button==2?In(a.app,b,i.vault_path,a.leaf,"git-source-control"):f(b)};return t.$$set=b=>{"change"in b&&n(0,i=b.change),"view"in b&&n(1,a=b.view),"manager"in b&&n(9,s=b.manager)},t.$$.update=()=>{t.$$.dirty&2&&n(3,r=a.leaf.getRoot().side=="left"?"right":"left")},[i,a,o,r,l,c,u,f,h,s,d,p,g,m,w]}var nm=class extends Ve{constructor(e){super(),at(this,e,Fj,Cj,it,{change:0,view:1,manager:9},Tj)}},su=nm;v();var Ok=require("obsidian");function Mj(t){Nt(t,"svelte-1wbh8tp","main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}")}function Oj(t){let e,n,r,i=Bt(t[0].vault_path)+"",a,s,o,l,c=t[0].working_dir+"",u,f,h,d,p,g;return{c(){e=I("main"),n=I("div"),r=I("div"),a=Te(i),s=J(),o=I("div"),l=I("span"),u=Te(c),T(r,"class","tree-item-inner nav-file-title-content"),T(l,"class","type"),T(l,"data-type",f=t[0].working_dir),T(o,"class","git-tools"),T(n,"class","tree-item-self is-clickable nav-file-title svelte-1wbh8tp"),T(n,"data-path",h=t[0].vault_path),T(n,"data-tooltip-position",t[2]),T(n,"aria-label",d=t[0].vault_path),T(e,"class","tree-item nav-file svelte-1wbh8tp")},m(m,w){re(m,e,w),O(e,n),O(n,r),O(r,a),O(n,s),O(n,o),O(o,l),O(l,u),p||(g=[te(e,"mouseover",t[3]),te(e,"click",xe(t[4])),te(e,"auxclick",xe(t[6])),te(e,"focus",t[5])],p=!0)},p(m,[w]){w&1&&i!==(i=Bt(m[0].vault_path)+"")&&Oe(a,i),w&1&&c!==(c=m[0].working_dir+"")&&Oe(u,c),w&1&&f!==(f=m[0].working_dir)&&T(l,"data-type",f),w&1&&h!==(h=m[0].vault_path)&&T(n,"data-path",h),w&4&&T(n,"data-tooltip-position",m[2]),w&1&&d!==(d=m[0].vault_path)&&T(n,"aria-label",d)},i:ke,o:ke,d(m){m&&ne(e),p=!1,Ae(g)}}}function Pj(t,e,n){let r,{change:i}=e,{view:a}=e;function s(u){a.app.vault.getAbstractFileByPath(i.vault_path)&&si(u,a,i.vault_path)}function o(u){var f;let h=a.app.vault.getAbstractFileByPath(i.vault_path);h instanceof Ok.TFile&&((f=Xt(a.app,u))===null||f===void 0||f.openFile(h).catch(d=>a.plugin.displayError(d)))}function l(u){Er.call(this,t,u)}let c=u=>{u.button==2?In(a.app,u,i.vault_path,a.leaf,"git-source-control"):o(u)};return t.$$set=u=>{"change"in u&&n(0,i=u.change),"view"in u&&n(1,a=u.view)},t.$$.update=()=>{t.$$.dirty&2&&n(2,r=a.leaf.getRoot().side=="left"?"right":"left")},[i,a,r,s,o,l,c]}var rm=class extends Ve{constructor(e){super(),at(this,e,Pj,Oj,it,{change:0,view:1},Mj)}},ou=rm;v();var ka=require("obsidian");function Ij(t){Nt(t,"svelte-1wbh8tp","main.svelte-1wbh8tp .nav-file-title.svelte-1wbh8tp{align-items:center}")}function Pk(t){let e,n,r;return{c(){e=I("div"),T(e,"data-icon","go-to-file"),T(e,"aria-label","Open File"),T(e,"class","clickable-icon")},m(i,a){re(i,e,a),t[10](e),n||(r=te(e,"click",xe(t[5])),n=!0)},p:ke,d(i){i&&ne(e),t[10](null),n=!1,r()}}}function Rj(t){let e,n,r,i=Bt(t[0].vault_path)+"",a,s,o,l,c=t[1].app.vault.getAbstractFileByPath(t[0].vault_path)instanceof ka.TFile,u,f,h,d,p=t[0].index+"",g,m,w,b,S,k,x=c&&Pk(t);return{c(){var A,y,E;e=I("main"),n=I("div"),r=I("div"),a=Te(i),s=J(),o=I("div"),l=I("div"),x&&x.c(),u=J(),f=I("div"),h=J(),d=I("div"),g=Te(p),T(r,"class","tree-item-inner nav-file-title-content"),T(f,"data-icon","minus"),T(f,"aria-label","Unstage"),T(f,"class","clickable-icon"),T(l,"class","buttons"),T(d,"class","type"),T(d,"data-type",m=t[0].index),T(o,"class","git-tools"),T(n,"class","tree-item-self is-clickable nav-file-title svelte-1wbh8tp"),T(n,"data-path",w=t[0].vault_path),T(n,"data-tooltip-position",t[3]),T(n,"aria-label",b=t[0].vault_path),ce(n,"is-active",((A=t[1].plugin.lastDiffViewState)==null?void 0:A.file)==t[0].vault_path&&!((y=t[1].plugin.lastDiffViewState)!=null&&y.hash)&&((E=t[1].plugin.lastDiffViewState)==null?void 0:E.staged)),T(e,"class","tree-item nav-file svelte-1wbh8tp")},m(A,y){re(A,e,y),O(e,n),O(n,r),O(r,a),O(n,s),O(n,o),O(o,l),x&&x.m(l,null),O(l,u),O(l,f),t[11](f),O(o,h),O(o,d),O(d,g),S||(k=[te(f,"click",xe(t[7])),te(e,"mouseover",t[4]),te(e,"focus",t[9]),te(e,"click",xe(t[6])),te(e,"auxclick",xe(t[12]))],S=!0)},p(A,[y]){var E,_,C;y&1&&i!==(i=Bt(A[0].vault_path)+"")&&Oe(a,i),y&3&&(c=A[1].app.vault.getAbstractFileByPath(A[0].vault_path)instanceof ka.TFile),c?x?x.p(A,y):(x=Pk(A),x.c(),x.m(l,u)):x&&(x.d(1),x=null),y&1&&p!==(p=A[0].index+"")&&Oe(g,p),y&1&&m!==(m=A[0].index)&&T(d,"data-type",m),y&1&&w!==(w=A[0].vault_path)&&T(n,"data-path",w),y&8&&T(n,"data-tooltip-position",A[3]),y&1&&b!==(b=A[0].vault_path)&&T(n,"aria-label",b),y&3&&ce(n,"is-active",((E=A[1].plugin.lastDiffViewState)==null?void 0:E.file)==A[0].vault_path&&!((_=A[1].plugin.lastDiffViewState)!=null&&_.hash)&&((C=A[1].plugin.lastDiffViewState)==null?void 0:C.staged))},i:ke,o:ke,d(A){A&&ne(e),x&&x.d(),t[11](null),S=!1,Ae(k)}}}function Lj(t,e,n){let r,{change:i}=e,{view:a}=e,{manager:s}=e,o=[];window.setTimeout(()=>o.forEach(m=>(0,ka.setIcon)(m,m.getAttr("data-icon"))),0);function l(m){a.app.vault.getFileByPath(i.vault_path)&&si(m,a,i.vault_path)}function c(m){var w;let b=a.app.vault.getAbstractFileByPath(i.vault_path);b instanceof ka.TFile&&((w=Xt(a.app,m))===null||w===void 0||w.openFile(b).catch(S=>a.plugin.displayError(S)))}function u(m){var w;(w=Xt(a.app,m))===null||w===void 0||w.setViewState({type:Ct.type,active:!0,state:{file:i.path,staged:!0}})}function f(){s.unstage(i.path,!1).catch(m=>a.plugin.displayError(m)).finally(()=>{a.app.workspace.trigger("obsidian-git:refresh")})}function h(m){Er.call(this,t,m)}function d(m){je[m?"unshift":"push"](()=>{o[1]=m,n(2,o)})}function p(m){je[m?"unshift":"push"](()=>{o[0]=m,n(2,o)})}let g=m=>{m.button==2?In(a.app,m,i.vault_path,a.leaf,"git-source-control"):u(m)};return t.$$set=m=>{"change"in m&&n(0,i=m.change),"view"in m&&n(1,a=m.view),"manager"in m&&n(8,s=m.manager)},t.$$.update=()=>{t.$$.dirty&2&&n(3,r=a.leaf.getRoot().side=="left"?"right":"left")},[i,a,o,r,l,c,u,f,s,h,d,p,g]}var im=class extends Ve{constructor(e){super(),at(this,e,Lj,Rj,it,{change:0,view:1,manager:8},Ij)}},lu=im;v();v();function Ik(t){let e,n,r,i="And "+(t[0].length-500)+" more files",a,s;return{c(){e=I("div"),n=I("div"),r=I("div"),a=Te(i),T(r,"class","tree-item-inner nav-file-title-content"),T(n,"class","tree-item-self nav-file-title"),T(n,"aria-label",s="And "+(t[0].length-500)+" more files"),T(e,"class","tree-item nav-file")},m(o,l){re(o,e,l),O(e,n),O(n,r),O(r,a)},p(o,l){l&1&&i!==(i="And "+(o[0].length-500)+" more files")&&Oe(a,i),l&1&&s!==(s="And "+(o[0].length-500)+" more files")&&T(n,"aria-label",s)},d(o){o&&ne(e)}}}function jj(t){let e,n=t[0].length>500&&Ik(t);return{c(){e=I("main"),n&&n.c()},m(r,i){re(r,e,i),n&&n.m(e,null)},p(r,[i]){r[0].length>500?n?n.p(r,i):(n=Ik(r),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},i:ke,o:ke,d(r){r&&ne(e),n&&n.d()}}}function Dj(t,e,n){let{files:r}=e;return t.$$set=i=>{"files"in i&&n(0,r=i.files)},[r]}var am=class extends Ve{constructor(e){super(),at(this,e,Dj,jj,it,{files:0})}},Aa=am;function Nj(t){Nt(t,"svelte-hup5mn","main.svelte-hup5mn .nav-folder-title.svelte-hup5mn{align-items:center}")}function Rk(t,e,n){let r=t.slice();return r[18]=e[n],r}function $j(t){let e,n,r,i,a,s,o,l=t[18].title+"",c,u,f,h,d,p,g,m,w,b,S;function k(C,M){return C[3]==0?zj:Uj}let x=k(t,-1),A=x(t),y=!t[5][t[18].title]&&Lk(t);function E(){return t[14](t[18])}function _(...C){return t[15](t[18],...C)}return{c(){e=I("div"),n=I("div"),r=I("div"),i=J(),a=I("div"),a.innerHTML='',s=J(),o=I("div"),c=Te(l),u=J(),f=I("div"),h=I("div"),A.c(),d=J(),p=I("div"),m=J(),y&&y.c(),T(r,"data-icon","folder"),Yt(r,"padding-right","5px"),Yt(r,"display","flex"),T(a,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),ce(a,"is-collapsed",t[5][t[18].title]),T(o,"class","tree-item-inner nav-folder-title-content"),Yt(p,"width","11px"),T(h,"class","buttons"),T(f,"class","git-tools"),T(n,"class","tree-item-self is-clickable nav-folder-title svelte-hup5mn"),T(n,"data-tooltip-position",t[6]),T(n,"aria-label",g=t[18].vaultPath),T(e,"class","tree-item nav-folder"),ce(e,"is-collapsed",t[5][t[18].title])},m(C,M){re(C,e,M),O(e,n),O(n,r),O(n,i),O(n,a),O(n,s),O(n,o),O(o,c),O(n,u),O(n,f),O(f,h),A.m(h,null),O(h,d),O(h,p),O(e,m),y&&y.m(e,null),w=!0,b||(S=[te(e,"click",xe(E)),te(e,"auxclick",xe(_))],b=!0)},p(C,M){t=C,(!w||M&33)&&ce(a,"is-collapsed",t[5][t[18].title]),(!w||M&1)&&l!==(l=t[18].title+"")&&Oe(c,l),x===(x=k(t,M))&&A?A.p(t,M):(A.d(1),A=x(t),A&&(A.c(),A.m(h,d))),(!w||M&64)&&T(n,"data-tooltip-position",t[6]),(!w||M&1&&g!==(g=t[18].vaultPath))&&T(n,"aria-label",g),t[5][t[18].title]?y&&(Ce(),X(y,1,1,()=>{y=null}),Fe()):y?(y.p(t,M),M&33&&U(y,1)):(y=Lk(t),y.c(),U(y,1),y.m(e,null)),(!w||M&33)&&ce(e,"is-collapsed",t[5][t[18].title])},i(C){w||(U(y),w=!0)},o(C){X(y),w=!1},d(C){C&&ne(e),A.d(),y&&y.d(),b=!1,Ae(S)}}}function Hj(t){let e,n,r,i,a=[Wj,Vj,Gj],s=[];function o(l,c){return l[3]==0?0:l[3]==1?1:l[3]==2?2:-1}return~(n=o(t,-1))&&(r=s[n]=a[n](t)),{c(){e=I("div"),r&&r.c()},m(l,c){re(l,e,c),~n&&s[n].m(e,null),i=!0},p(l,c){let u=n;n=o(l,c),n===u?~n&&s[n].p(l,c):(r&&(Ce(),X(s[u],1,1,()=>{s[u]=null}),Fe()),~n?(r=s[n],r?r.p(l,c):(r=s[n]=a[n](l),r.c()),U(r,1),r.m(e,null)):r=null)},i(l){i||(U(r),i=!0)},o(l){X(r),i=!1},d(l){l&&ne(e),~n&&s[n].d()}}}function Uj(t){let e,n,r,i,a;function s(){return t[12](t[18])}function o(){return t[13](t[18])}return{c(){e=I("div"),e.innerHTML='',n=J(),r=I("div"),r.innerHTML='',T(e,"data-icon","undo"),T(e,"aria-label","Discard"),T(e,"class","clickable-icon"),T(r,"data-icon","plus"),T(r,"aria-label","Stage"),T(r,"class","clickable-icon")},m(l,c){re(l,e,c),re(l,n,c),re(l,r,c),i||(a=[te(e,"click",xe(s)),te(r,"click",xe(o))],i=!0)},p(l,c){t=l},d(l){l&&(ne(e),ne(n),ne(r)),i=!1,Ae(a)}}}function zj(t){let e,n,r;function i(){return t[11](t[18])}return{c(){e=I("div"),e.innerHTML='',T(e,"data-icon","minus"),T(e,"aria-label","Unstage"),T(e,"class","clickable-icon")},m(a,s){re(a,e,s),n||(r=te(e,"click",xe(i)),n=!0)},p(a,s){t=a},d(a){a&&ne(e),n=!1,r()}}}function Lk(t){let e,n,r,i;return n=new cu({props:{hierarchy:t[18],plugin:t[1],view:t[2],fileType:t[3]}}),{c(){e=I("div"),He(n.$$.fragment),T(e,"class","tree-item-children nav-folder-children")},m(a,s){re(a,e,s),De(n,e,null),i=!0},p(a,s){let o={};s&1&&(o.hierarchy=a[18]),s&2&&(o.plugin=a[1]),s&4&&(o.view=a[2]),s&8&&(o.fileType=a[3]),n.$set(o)},i(a){i||(U(n.$$.fragment,a),a&&wt(()=>{i&&(r||(r=bt(e,xt,{duration:150},!0)),r.run(1))}),i=!0)},o(a){X(n.$$.fragment,a),a&&(r||(r=bt(e,xt,{duration:150},!1)),r.run(0)),i=!1},d(a){a&&ne(e),Be(n),a&&r&&r.end()}}}function Gj(t){let e,n;return e=new ou({props:{change:t[18].data,view:t[2]}}),{c(){He(e.$$.fragment)},m(r,i){De(e,r,i),n=!0},p(r,i){let a={};i&1&&(a.change=r[18].data),i&4&&(a.view=r[2]),e.$set(a)},i(r){n||(U(e.$$.fragment,r),n=!0)},o(r){X(e.$$.fragment,r),n=!1},d(r){Be(e,r)}}}function Vj(t){let e,n;return e=new su({props:{change:t[18].data,manager:t[1].gitManager,view:t[2]}}),{c(){He(e.$$.fragment)},m(r,i){De(e,r,i),n=!0},p(r,i){let a={};i&1&&(a.change=r[18].data),i&2&&(a.manager=r[1].gitManager),i&4&&(a.view=r[2]),e.$set(a)},i(r){n||(U(e.$$.fragment,r),n=!0)},o(r){X(e.$$.fragment,r),n=!1},d(r){Be(e,r)}}}function Wj(t){let e,n;return e=new lu({props:{change:t[18].data,manager:t[1].gitManager,view:t[2]}}),{c(){He(e.$$.fragment)},m(r,i){De(e,r,i),n=!0},p(r,i){let a={};i&1&&(a.change=r[18].data),i&2&&(a.manager=r[1].gitManager),i&4&&(a.view=r[2]),e.$set(a)},i(r){n||(U(e.$$.fragment,r),n=!0)},o(r){X(e.$$.fragment,r),n=!1},d(r){Be(e,r)}}}function jk(t){let e,n,r,i,a=[Hj,$j],s=[];function o(l,c){return l[18].data?0:1}return e=o(t,-1),n=s[e]=a[e](t),{c(){n.c(),r=wa()},m(l,c){s[e].m(l,c),re(l,r,c),i=!0},p(l,c){let u=e;e=o(l,c),e===u?s[e].p(l,c):(Ce(),X(s[u],1,1,()=>{s[u]=null}),Fe(),n=s[e],n?n.p(l,c):(n=s[e]=a[e](l),n.c()),U(n,1),n.m(r.parentNode,r))},i(l){i||(U(n),i=!0)},o(l){X(n),i=!1},d(l){l&&ne(r),s[e].d(l)}}}function qj(t){let e,n,r,i,a=tt(vr(t[0].children,500)),s=[];for(let l=0;lX(s[l],1,1,()=>{s[l]=null});return r=new Aa({props:{files:t[0].children}}),{c(){e=I("main");for(let l=0;l100;function h(x){o.gitManager.stageAll({dir:x}).catch(A=>o.displayError(A)).finally(()=>{l.app.workspace.trigger("obsidian-git:refresh")})}function d(x){o.gitManager.unstageAll({dir:x}).catch(A=>o.displayError(A)).finally(()=>{l.app.workspace.trigger("obsidian-git:refresh")})}function p(x){new kr(l.app,!1,x.vaultPath).myOpen().then(A=>{if(A===!0)return o.gitManager.discardAll({dir:x.path,status:o.cachedStatus}).finally(()=>{l.app.workspace.trigger("obsidian-git:refresh")})},A=>o.displayError(A))}function g(x){n(5,f[x.title]=!f[x.title],f)}let m=x=>d(x.path),w=x=>p(x),b=x=>h(x.path),S=x=>g(x),k=(x,A)=>In(l.app,A,x.vaultPath,l.leaf,"git-source-control");return t.$$set=x=>{"hierarchy"in x&&n(0,s=x.hierarchy),"plugin"in x&&n(1,o=x.plugin),"view"in x&&n(2,l=x.view),"fileType"in x&&n(3,c=x.fileType),"topLevel"in x&&n(4,u=x.topLevel)},t.$$.update=()=>{t.$$.dirty&4&&n(6,r=l.leaf.getRoot().side=="left"?"right":"left")},[s,o,l,c,u,f,r,h,d,p,g,m,w,b,S,k]}var cu=class extends Ve{constructor(e){super(),at(this,e,Xj,qj,it,{hierarchy:0,plugin:1,view:2,fileType:3,topLevel:4},Nj)}},uu=cu;function Yj(t){Nt(t,"svelte-11adhly",`.commit-msg-input.svelte-11adhly.svelte-11adhly{width:100%;overflow:hidden;resize:none;padding:7px 5px;background-color:var(--background-modifier-form-field)}.git-commit-msg.svelte-11adhly.svelte-11adhly{position:relative;padding:0;width:calc(100% - var(--size-4-8));margin:4px auto}main.svelte-11adhly .git-tools .files-count.svelte-11adhly{padding-left:var(--size-2-1);width:11px;display:flex;align-items:center;justify-content:center}.nav-folder-title.svelte-11adhly.svelte-11adhly{align-items:center}.git-commit-msg-clear-button.svelte-11adhly.svelte-11adhly{position:absolute;background:transparent;border-radius:50%;color:var(--search-clear-button-color);cursor:var(--cursor);top:-4px;right:2px;bottom:0px;line-height:0;height:var(--input-height);width:28px;margin:auto;padding:0 0;text-align:center;display:flex;justify-content:center;align-items:center;transition:color 0.15s ease-in-out}.git-commit-msg-clear-button.svelte-11adhly.svelte-11adhly:after{content:"";height:var(--search-clear-button-size);width:var(--search-clear-button-size);display:block;background-color:currentColor;mask-image:url("data:image/svg+xml,");mask-repeat:no-repeat;-webkit-mask-image:url("data:image/svg+xml,");-webkit-mask-repeat:no-repeat}`)}function Dk(t,e,n){let r=t.slice();return r[42]=e[n],r}function Bk(t,e,n){let r=t.slice();return r[42]=e[n],r}function Nk(t,e,n){let r=t.slice();return r[47]=e[n],r}function $k(t){let e,n,r,i;return{c(){e=I("div"),T(e,"class","git-commit-msg-clear-button svelte-11adhly"),T(e,"aria-label",n="Clear")},m(a,s){re(a,e,s),r||(i=te(e,"click",t[34]),r=!0)},p:ke,d(a){a&&ne(e),r=!1,i()}}}function Hk(t){let e,n,r,i,a,s,o,l,c,u,f,h,d=t[6].staged.length+"",p,g,m,w,b,S,k,x,A,y,E,_,C,M,L,N,j=t[6].changed.length+"",Y,le,he,ie,Me,de,$=t[13]&&Uk(t),G=t[12]&&Gk(t),D=t[7].length>0&&Wk(t);return{c(){e=I("div"),n=I("div"),r=I("div"),i=I("div"),i.innerHTML='',a=J(),s=I("div"),s.textContent="Staged Changes",o=J(),l=I("div"),c=I("div"),u=I("div"),u.innerHTML='',f=J(),h=I("div"),p=Te(d),g=J(),$&&$.c(),m=J(),w=I("div"),b=I("div"),S=I("div"),S.innerHTML='',k=J(),x=I("div"),x.textContent="Changes",A=J(),y=I("div"),E=I("div"),_=I("div"),_.innerHTML='',C=J(),M=I("div"),M.innerHTML='',L=J(),N=I("div"),Y=Te(j),le=J(),G&&G.c(),he=J(),D&&D.c(),T(i,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),ce(i,"is-collapsed",!t[13]),T(s,"class","tree-item-inner nav-folder-title-content"),T(u,"data-icon","minus"),T(u,"aria-label","Unstage"),T(u,"class","clickable-icon"),T(c,"class","buttons"),T(h,"class","files-count svelte-11adhly"),T(l,"class","git-tools"),T(r,"class","tree-item-self is-clickable nav-folder-title svelte-11adhly"),T(n,"class","staged tree-item nav-folder"),ce(n,"is-collapsed",!t[13]),T(S,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),ce(S,"is-collapsed",!t[12]),T(x,"class","tree-item-inner nav-folder-title-content"),T(_,"data-icon","undo"),T(_,"aria-label","Discard"),T(_,"class","clickable-icon"),T(M,"data-icon","plus"),T(M,"aria-label","Stage"),T(M,"class","clickable-icon"),T(E,"class","buttons"),T(N,"class","files-count svelte-11adhly"),T(y,"class","git-tools"),T(b,"class","tree-item-self is-clickable nav-folder-title svelte-11adhly"),T(w,"class","changes tree-item nav-folder"),ce(w,"is-collapsed",!t[12]),T(e,"class","tree-item nav-folder mod-root")},m(se,Se){re(se,e,Se),O(e,n),O(n,r),O(r,i),O(r,a),O(r,s),O(r,o),O(r,l),O(l,c),O(c,u),t[35](u),O(l,f),O(l,h),O(h,p),O(n,g),$&&$.m(n,null),O(e,m),O(e,w),O(w,b),O(b,S),O(b,k),O(b,x),O(b,A),O(b,y),O(y,E),O(E,_),O(E,C),O(E,M),t[37](M),O(y,L),O(y,N),O(N,Y),O(w,le),G&&G.m(w,null),O(e,he),D&&D.m(e,null),ie=!0,Me||(de=[te(u,"click",xe(t[20])),te(r,"click",t[36]),te(_,"click",xe(t[23])),te(M,"click",xe(t[19])),te(b,"click",t[38])],Me=!0)},p(se,Se){(!ie||Se[0]&8192)&&ce(i,"is-collapsed",!se[13]),(!ie||Se[0]&64)&&d!==(d=se[6].staged.length+"")&&Oe(p,d),se[13]?$?($.p(se,Se),Se[0]&8192&&U($,1)):($=Uk(se),$.c(),U($,1),$.m(n,null)):$&&(Ce(),X($,1,1,()=>{$=null}),Fe()),(!ie||Se[0]&8192)&&ce(n,"is-collapsed",!se[13]),(!ie||Se[0]&4096)&&ce(S,"is-collapsed",!se[12]),(!ie||Se[0]&64)&&j!==(j=se[6].changed.length+"")&&Oe(Y,j),se[12]?G?(G.p(se,Se),Se[0]&4096&&U(G,1)):(G=Gk(se),G.c(),U(G,1),G.m(w,null)):G&&(Ce(),X(G,1,1,()=>{G=null}),Fe()),(!ie||Se[0]&4096)&&ce(w,"is-collapsed",!se[12]),se[7].length>0?D?(D.p(se,Se),Se[0]&128&&U(D,1)):(D=Wk(se),D.c(),U(D,1),D.m(e,null)):D&&(Ce(),X(D,1,1,()=>{D=null}),Fe())},i(se){ie||(U($),U(G),U(D),ie=!0)},o(se){X($),X(G),X(D),ie=!1},d(se){se&&ne(e),t[35](null),$&&$.d(),t[37](null),G&&G.d(),D&&D.d(),Me=!1,Ae(de)}}}function Uk(t){let e,n,r,i,a,s=[Kj,Zj],o=[];function l(c,u){return c[3]?0:1}return n=l(t,[-1,-1]),r=o[n]=s[n](t),{c(){e=I("div"),r.c(),T(e,"class","tree-item-children nav-folder-children")},m(c,u){re(c,e,u),o[n].m(e,null),a=!0},p(c,u){let f=n;n=l(c,u),n===f?o[n].p(c,u):(Ce(),X(o[f],1,1,()=>{o[f]=null}),Fe(),r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),U(r,1),r.m(e,null))},i(c){a||(U(r),c&&wt(()=>{a&&(i||(i=bt(e,xt,{duration:150},!0)),i.run(1))}),a=!0)},o(c){X(r),c&&(i||(i=bt(e,xt,{duration:150},!1)),i.run(0)),a=!1},d(c){c&&ne(e),o[n].d(),c&&i&&i.end()}}}function Zj(t){let e,n,r,i=tt(vr(t[6].staged,500)),a=[];for(let o=0;oX(a[o],1,1,()=>{a[o]=null});return n=new Aa({props:{files:t[6].staged}}),{c(){for(let o=0;o{o[f]=null}),Fe(),r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),U(r,1),r.m(e,null))},i(c){a||(U(r),c&&wt(()=>{a&&(i||(i=bt(e,xt,{duration:150},!0)),i.run(1))}),a=!0)},o(c){X(r),c&&(i||(i=bt(e,xt,{duration:150},!1)),i.run(0)),a=!1},d(c){c&&ne(e),o[n].d(),c&&i&&i.end()}}}function Jj(t){let e,n,r,i=tt(vr(t[6].changed,500)),a=[];for(let o=0;oX(a[o],1,1,()=>{a[o]=null});return n=new Aa({props:{files:t[6].changed}}),{c(){for(let o=0;o',i=J(),a=I("div"),a.textContent="Recently Pulled Files",s=J(),o=I("span"),c=Te(l),u=J(),p&&p.c(),T(r,"class","tree-item-icon nav-folder-collapse-indicator collapse-icon"),T(a,"class","tree-item-inner nav-folder-title-content"),T(o,"class","tree-item-flair"),T(n,"class","tree-item-self is-clickable nav-folder-title svelte-11adhly"),T(e,"class","pulled nav-folder"),ce(e,"is-collapsed",!t[14])},m(g,m){re(g,e,m),O(e,n),O(n,r),O(n,i),O(n,a),O(n,s),O(n,o),O(o,c),O(e,u),p&&p.m(e,null),f=!0,h||(d=te(n,"click",t[39]),h=!0)},p(g,m){(!f||m[0]&128)&&l!==(l=g[7].length+"")&&Oe(c,l),g[14]?p?(p.p(g,m),m[0]&16384&&U(p,1)):(p=qk(g),p.c(),U(p,1),p.m(e,null)):p&&(Ce(),X(p,1,1,()=>{p=null}),Fe()),(!f||m[0]&16384)&&ce(e,"is-collapsed",!g[14])},i(g){f||(U(p),f=!0)},o(g){X(p),f=!1},d(g){g&&ne(e),p&&p.d(),h=!1,d()}}}function qk(t){let e,n,r,i,a,s=[t7,e7],o=[];function l(c,u){return c[3]?0:1}return n=l(t,[-1,-1]),r=o[n]=s[n](t),{c(){e=I("div"),r.c(),T(e,"class","tree-item-children nav-folder-children")},m(c,u){re(c,e,u),o[n].m(e,null),a=!0},p(c,u){let f=n;n=l(c,u),n===f?o[n].p(c,u):(Ce(),X(o[f],1,1,()=>{o[f]=null}),Fe(),r=o[n],r?r.p(c,u):(r=o[n]=s[n](c),r.c()),U(r,1),r.m(e,null))},i(c){a||(U(r),c&&wt(()=>{a&&(i||(i=bt(e,xt,{duration:150},!0)),i.run(1))}),a=!0)},o(c){X(r),c&&(i||(i=bt(e,xt,{duration:150},!1)),i.run(0)),a=!1},d(c){c&&ne(e),o[n].d(),c&&i&&i.end()}}}function e7(t){let e,n,r,i=tt(t[7]),a=[];for(let o=0;oX(a[o],1,1,()=>{a[o]=null});return n=new Aa({props:{files:t[7]}}),{c(){for(let o=0;o{j=null}),Fe())},i(Y){C||(U(j),C=!0)},o(Y){X(j),C=!1},d(Y){Y&&ne(e),t[24](null),t[25](null),t[26](null),t[27](null),t[28](null),t[29](null),t[30](null),t[32](null),N&&N.d(),j&&j.d(),M=!1,Ae(L)}}}function r7(t,e,n){let r,{plugin:i}=e,{view:a}=e,s,o,l=[],c=i.settings.commitMessage,u=[],f,h,d,p=!0,g=!0,m=!0,w=i.settings.treeStructure,b,S;S=a.app.workspace.on("obsidian-git:view-refresh",()=>void A().catch(console.error)),A().catch(console.error),i.app.workspace.onLayoutReady(()=>{window.setTimeout(()=>{u.forEach(ee=>(0,Ta.setIcon)(ee,ee.getAttr("data-icon"))),(0,Ta.setIcon)(b,w?"list":"folder")},0)}),no(()=>{a.app.workspace.offref(S)});function k(){return _a(this,void 0,void 0,function*(){if(n(5,s=!0),o){if(yield i.tools.hasTooBigFiles(o.staged))return i.setPluginState({gitAction:0}),!1;i.promiseQueue.addTask(()=>i.gitManager.commit({message:c}).then(()=>_a(this,void 0,void 0,function*(){c!==i.settings.commitMessage&&n(2,c=""),yield i.automaticsManager.setUpAutoCommitAndSync()})).finally(y))}})}function x(){n(5,s=!0),o&&i.promiseQueue.addTask(()=>i.commitAndSync(!1,!1,c).then(()=>{c!==i.settings.commitMessage&&n(2,c="")}).finally(y))}function A(){return _a(this,void 0,void 0,function*(){if(!i.gitReady){n(6,o=void 0);return}let ee=yield i.gitManager.getUnpushedCommits();if(u.forEach(Ie=>{var Ee,z;Ie&&(Ta.Platform.isMobile?(Ie.removeClass("button-border"),Ie.id=="push"&&ee>0&&Ie.addClass("button-border")):((Ee=Ie.firstElementChild)===null||Ee===void 0||Ee.removeAttribute("color"),Ie.id=="push"&&ee>0&&((z=Ie.firstElementChild)===null||z===void 0||z.setAttr("color","var(--text-accent)"))))}),n(6,o=i.cachedStatus),i.lastPulledFiles&&i.lastPulledFiles!=l&&(n(7,l=i.lastPulledFiles),n(11,d={title:"",path:"",vaultPath:"",children:i.gitManager.getTreeStructure(l)})),o){let Ie=(Ee,z)=>Ee.vault_path.split("/").last().localeCompare(Bt(z.vault_path));o.changed.sort(Ie),o.staged.sort(Ie),n(9,f={title:"",path:"",vaultPath:"",children:i.gitManager.getTreeStructure(o.changed)}),n(10,h={title:"",path:"",vaultPath:"",children:i.gitManager.getTreeStructure(o.staged)})}else n(9,f=void 0),n(10,h=void 0);n(5,s=i.loading)})}function y(){a.app.workspace.trigger("obsidian-git:refresh")}function E(){n(5,s=!0),i.promiseQueue.addTask(()=>i.gitManager.stageAll({status:o}).finally(y))}function _(){n(5,s=!0),i.promiseQueue.addTask(()=>i.gitManager.unstageAll({status:o}).finally(y))}function C(){n(5,s=!0),i.promiseQueue.addTask(()=>i.push().finally(y))}function M(){n(5,s=!0),i.promiseQueue.addTask(()=>i.pullChangesFromRemote().finally(y))}function L(){new kr(a.app,!1,i.gitManager.getRelativeVaultPath("/")).myOpen().then(ee=>{ee===!0&&i.promiseQueue.addTask(()=>i.gitManager.discardAll({status:i.cachedStatus}).finally(()=>{a.app.workspace.trigger("obsidian-git:refresh")}))},console.error)}function N(ee){je[ee?"unshift":"push"](()=>{u[5]=ee,n(8,u)})}function j(ee){je[ee?"unshift":"push"](()=>{u[0]=ee,n(8,u)})}function Y(ee){je[ee?"unshift":"push"](()=>{u[1]=ee,n(8,u)})}function le(ee){je[ee?"unshift":"push"](()=>{u[2]=ee,n(8,u)})}function he(ee){je[ee?"unshift":"push"](()=>{u[3]=ee,n(8,u)})}function ie(ee){je[ee?"unshift":"push"](()=>{u[4]=ee,n(8,u)})}function Me(ee){je[ee?"unshift":"push"](()=>{b=ee,n(4,b)})}let de=()=>{n(3,w=!w),n(0,i.settings.treeStructure=w,i),i.saveSettings()};function $(ee){je[ee?"unshift":"push"](()=>{u[6]=ee,n(8,u)})}function G(){c=this.value,n(2,c)}let D=()=>n(2,c="");function se(ee){je[ee?"unshift":"push"](()=>{u[8]=ee,n(8,u)})}let Se=()=>n(13,g=!g);function mt(ee){je[ee?"unshift":"push"](()=>{u[9]=ee,n(8,u)})}let be=()=>n(12,p=!p),st=()=>n(14,m=!m);return t.$$set=ee=>{"plugin"in ee&&n(0,i=ee.plugin),"view"in ee&&n(1,a=ee.view)},t.$$.update=()=>{t.$$.dirty[0]&24&&b&&(b.empty(),(0,Ta.setIcon)(b,w?"list":"folder")),t.$$.dirty[0]&4&&n(15,r=(c.match(/\n/g)||[]).length+1||1)},[i,a,c,w,b,s,o,l,u,f,h,d,p,g,m,r,k,x,y,E,_,C,M,L,N,j,Y,le,he,ie,Me,de,$,G,D,se,Se,mt,be,st]}var sm=class extends Ve{constructor(e){super(),at(this,e,r7,n7,it,{plugin:0,view:1},Yj,[-1,-1])}},Yk=sm;var oo=class extends Zk.ItemView{constructor(e,n){super(e),this.plugin=n,this.hoverPopover=null}getViewType(){return dt.type}getDisplayText(){return dt.name}getIcon(){return dt.icon}onClose(){var e;return(e=this._view)==null||e.$destroy(),super.onClose()}reload(){var e;(e=this._view)==null||e.$destroy(),this._view=new Yk({target:this.contentEl,props:{plugin:this.plugin,view:this}})}onOpen(){return this.reload(),super.onOpen()}};v();var fu=class{constructor(e,n){this.statusBarEl=e;this.plugin=n;this.statusBarEl.addClass("mod-clickable"),this.statusBarEl.onClickEvent(r=>{this.plugin.switchBranch().catch(i=>n.displayError(i))})}async display(){if(this.plugin.gitReady){let e=await this.plugin.gitManager.branchInfo();e.current!=null?this.statusBarEl.setText(e.current):this.statusBarEl.empty()}else this.statusBarEl.empty()}remove(){this.statusBarEl.remove()}};v();var Kk=require("obsidian");var lo=class{constructor(e){this.plugin=e}async hasTooBigFiles(e){let n=await this.plugin.gitManager.branchInfo(),r=n.tracking?wr(n.tracking)[0]:null;if(r){let i=await this.plugin.gitManager.getRemoteUrl(r);if(i!=null&&i.includes("github.com")){let a=e.filter(s=>{let o=this.plugin.app.vault.getAbstractFileByPath(s.vault_path);return o instanceof Kk.TFile?o.stat.size>=1e8:!1});if(a.length>0)return this.plugin.displayError(`Did not commit, because following files are too big: ${a.map(s=>s.vault_path).join(` `)}. Please remove them.`),!0}}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(Vi,e);let n=!1;this.plugin.app.workspace.iterateAllLeaves(r=>{r.getDisplayText()!=""&&Vi.startsWith(r.getDisplayText())&&(n=!0)}),n||await this.plugin.app.workspace.openLinkText(Vi,"/",!0)}};var hu=class extends _e.Plugin{constructor(){super(...arguments);this.tools=new lo(this);this.state={gitAction:0,loading:!1,offlineMode:!1};this.gitReady=!1;this.promiseQueue=new Lc(this);this.loading=!1;this.intervalsToClear=[];this.lineAuthoringFeature=new Rc(this)}setPluginState(n){var r;this.state=Object.assign(this.state,n),(r=this.statusBar)==null||r.display()}async updateCachedStatus(){var n,r;return this.cachedStatus=await this.gitManager.status(),this.cachedStatus.conflicted.length>0?(this.localStorage.setConflict(!0),await((n=this.branchBar)==null?void 0:n.display())):(this.localStorage.setConflict(!1),await((r=this.branchBar)==null?void 0:r.display())),this.cachedStatus}async refresh(){if(!this.gitReady)return;let n=this.app.workspace.getLeavesOfType(dt.type),r=this.app.workspace.getLeavesOfType(nn.type);(this.settings.changedFilesInStatusBar||n.some(i=>{var a;return!((a=i.isDeferred)!=null&&a)})||r.some(i=>{var a;return!((a=i.isDeferred)!=null&&a)}))&&(this.loading=!0,this.app.workspace.trigger("obsidian-git:view-refresh"),await this.updateCachedStatus().catch(i=>this.displayError(i)),this.loading=!1,this.app.workspace.trigger("obsidian-git:view-refresh"))}refreshUpdatedHead(){this.lineAuthoringFeature.refreshLineAuthorViews()}async onload(){console.log("loading "+this.manifest.name+" plugin: v"+this.manifest.version),Gs.plugin=this,this.localStorage=new Hc(this),this.localStorage.migrate(),await this.loadSettings(),await this.migrateSettings(),this.settingsTab=new bc(this.app,this),this.addSettingTab(this.settingsTab),this.localStorage.getPluginDisabled()||(this.registerStuff(),this.app.workspace.onLayoutReady(()=>this.init({fromReload:!1}).catch(n=>this.displayError(n))))}onExternalSettingsChange(){this.reloadSettings().catch(n=>this.displayError(n))}async reloadSettings(){let n=JSON.stringify(this.settings);await this.loadSettings();let r=JSON.stringify(this.settings);n!==r&&(this.log("Reloading settings"),this.unloadPlugin(),await this.init({fromReload:!0}),this.app.workspace.getLeavesOfType(dt.type).forEach(i=>{var a;if(!((a=i.isDeferred)!=null&&a))return i.view.reload()}),this.app.workspace.getLeavesOfType(nn.type).forEach(i=>{var a;if(!((a=i.isDeferred)!=null&&a))return i.view.reload()}))}registerStuff(){this.registerEvent(this.app.workspace.on("obsidian-git:refresh",()=>{this.refresh().catch(n=>this.displayError(n))})),this.registerEvent(this.app.workspace.on("obsidian-git:head-change",()=>{this.refreshUpdatedHead()})),this.registerEvent(this.app.workspace.on("file-menu",(n,r,i)=>{this.handleFileMenu(n,r,i)})),this.registerEvent(this.app.workspace.on("active-leaf-change",n=>{this.handleViewActiveState(n)})),this.registerEvent(this.app.vault.on("modify",()=>{var n;this.debRefresh(),(n=this.autoCommitDebouncer)==null||n.call(this)})),this.registerEvent(this.app.vault.on("delete",()=>{var n;this.debRefresh(),(n=this.autoCommitDebouncer)==null||n.call(this)})),this.registerEvent(this.app.vault.on("create",()=>{var n;this.debRefresh(),(n=this.autoCommitDebouncer)==null||n.call(this)})),this.registerEvent(this.app.vault.on("rename",()=>{var n;this.debRefresh(),(n=this.autoCommitDebouncer)==null||n.call(this)})),this.registerView(dt.type,n=>new oo(n,this)),this.registerView(nn.type,n=>new ao(n,this)),this.registerView(Ct.type,n=>new ga(n,this)),this.addRibbonIcon("git-pull-request","Open Git source control",async()=>{var i;let n=this.app.workspace.getLeavesOfType(dt.type),r;n.length===0?(r=(i=this.app.workspace.getRightLeaf(!1))!=null?i:this.app.workspace.getLeaf(),await r.setViewState({type:dt.type})):r=n.first(),await this.app.workspace.revealLeaf(r),this.app.workspace.trigger("obsidian-git:refresh")}),this.registerHoverLinkSource(dt.type,{display:"Git View",defaultMod:!0}),this.lineAuthoringFeature.onLoadPlugin(),this.setRefreshDebouncer(),AE(this)}setRefreshDebouncer(){var n;(n=this.debRefresh)==null||n.cancel(),this.debRefresh=(0,_e.debounce)(()=>{this.settings.refreshSourceControl&&this.refresh().catch(console.error)},this.settings.refreshSourceControlTimer,!0)}async addFileToGitignore(n){return await this.app.vault.adapter.append(this.gitManager.getRelativeVaultPath(".gitignore"),` `+this.gitManager.getRelativeRepoPath(n.path,!0)),this.refresh()}handleFileMenu(n,r,i){this.gitReady&&this.settings.showFileMenu&&r&&(this.settings.showFileMenu&&i=="file-explorer-context-menu"&&(n.addItem(a=>{a.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(s=>{this.promiseQueue.addTask(async()=>{r instanceof _e.TFile?await this.gitManager.stage(r.path,!0):await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(r.path,!0)}),this.displayMessage(`Staged ${r.path}`)})})}),n.addItem(a=>{a.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(s=>{this.promiseQueue.addTask(async()=>{r instanceof _e.TFile?await this.gitManager.unstage(r.path,!0):await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(r.path,!0)}),this.displayMessage(`Unstaged ${r.path}`)})})}),n.addItem(a=>{a.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(s=>{this.addFileToGitignore(r).catch(o=>this.displayError(o))})})),i=="git-source-control"&&n.addItem(a=>{a.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(s=>{this.addFileToGitignore(r).catch(o=>this.displayError(o))})}))}async migrateSettings(){this.settings.mergeOnPull!=null&&(this.settings.syncMethod=this.settings.mergeOnPull?"merge":"rebase",this.settings.mergeOnPull=void 0,await this.saveSettings()),this.settings.autoCommitMessage===void 0&&(this.settings.autoCommitMessage=this.settings.commitMessage,await this.saveSettings()),this.settings.gitPath!=null&&(this.localStorage.setGitPath(this.settings.gitPath),this.settings.gitPath=void 0,await this.saveSettings()),this.settings.username!=null&&(this.localStorage.setPassword(this.settings.username),this.settings.username=void 0,await this.saveSettings())}unloadPlugin(){var n,r;this.gitReady=!1,this.app.workspace.trigger("obsidian-git:refresh"),this.lineAuthoringFeature.deactivateFeature(),this.automaticsManager.unload(),(n=this.branchBar)==null||n.remove(),(r=this.statusBar)==null||r.remove();for(let i of this.intervalsToClear)window.clearInterval(i);this.intervalsToClear=[],this.debRefresh.cancel()}onunload(){this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let n=await this.loadData();n==null&&(n={showedMobileNotice:!0}),this.settings=Hw(Mn,n)}async saveSettings(){var n;(n=this.settingsTab)==null||n.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return _e.Platform.isDesktopApp}async init({fromReload:n=!1}){var r;if(this.settings.showStatusBar){let i=this.addStatusBarItem();this.statusBar=new jc(i,this),this.intervalsToClear.push(window.setInterval(()=>{var a;return(a=this.statusBar)==null?void 0:a.display()},1e3))}try{this.useSimpleGit?(this.gitManager=new Le(this),await this.gitManager.setGitInstance()):this.gitManager=new yn(this);let i=await this.gitManager.checkRequirements();switch(i){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new _e.Notice("Can't find a valid git repository. Please create one via the given command or clone an existing repo.",1e4);break;case"valid":if(this.gitReady=!0,this.setPluginState({gitAction:0}),_e.Platform.isDesktop&&this.settings.showBranchStatusBar){let a=this.addStatusBarItem();this.branchBar=new fu(a,this),this.intervalsToClear.push(window.setInterval(()=>{var s;return void((s=this.branchBar)==null?void 0:s.display().catch(console.error))},6e4))}await((r=this.branchBar)==null?void 0:r.display()),this.lineAuthoringFeature.conditionallyActivateBySettings(),this.app.workspace.trigger("obsidian-git:refresh"),!n&&this.settings.autoPullOnBoot&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),this.automaticsManager=new Vs(this),await this.automaticsManager.init();break;default:this.log("Something weird happened. The 'checkRequirements' result is "+i)}}catch(i){this.displayError(i),console.error(i)}}async createNewRepo(){try{await this.gitManager.init(),new _e.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(n){this.displayError(n)}}async cloneNewRepo(){let r=await new Xe(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(r){let i="Vault Root",a=await new Xe(this,{options:this.gitManager instanceof yn?[i]:[],placeholder:"Enter directory for clone. It needs to be empty or not existent.",allowEmpty:this.gitManager instanceof yn}).openAndGetResult();if(a==null)return;if(a===i&&(a="."),a=(0,_e.normalizePath)(a),a==="/"&&(a="."),a==="."){let f=await new Xe(this,{options:["NO","YES"],placeholder:`Does your remote repo contain a ${this.app.vault.configDir} directory at the root?`,onlySelection:!0}).openAndGetResult();if(f===void 0){new _e.Notice("Aborted clone");return}else if(f==="YES"){let h="DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";if(await new Xe(this,{options:["Abort clone",h],placeholder:`To avoid conflicts, the local ${this.app.vault.configDir} directory needs to be deleted.`,onlySelection:!0}).openAndGetResult()===h)await this.app.vault.adapter.rmdir(this.app.vault.configDir,!0);else{new _e.Notice("Aborted clone");return}}}let s=await new Xe(this,{placeholder:"Specify depth of clone. Leave empty for full clone.",allowEmpty:!0}).openAndGetResult(),o;if(s!==""&&(o=parseInt(s),isNaN(o))){new _e.Notice("Invalid depth. Aborting clone.");return}new _e.Notice(`Cloning new repo into "${a}"`);let l=this.settings.basePath,c=a&&a!==".";c&&(this.settings.basePath=a);try{await this.gitManager.clone(r,a,o),new _e.Notice("Cloned new repo."),new _e.Notice("Please restart Obsidian"),c&&await this.saveSettings()}catch(u){this.displayError(u),this.settings.basePath=l,await this.saveSettings()}}}async isAllInitialized(){return this.gitReady||await this.init({fromReload:!0}),this.gitReady}async pullChangesFromRemote(){if(!await this.isAllInitialized())return;let n=await this.pull();if(await this.automaticsManager.setUpAutoCommitAndSync(),n!==!1){if(n||this.displayMessage("Everything is up-to-date"),this.gitManager instanceof Le){let r=await this.updateCachedStatus();r.conflicted.length>0&&(this.displayError(`You have conflicts in ${r.conflicted.length} ${r.conflicted.length==1?"file":"files"}`),await this.handleConflict(r.conflicted))}this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0})}}async commitAndSync(n,r=!1,i){!await this.isAllInitialized()||(this.settings.syncMethod=="reset"&&this.settings.pullBeforePush&&await this.pull(),!await this.commit({fromAuto:n,requestCustomMessage:r,commitMessage:i}))||(this.settings.syncMethod!="reset"&&this.settings.pullBeforePush&&await this.pull(),this.settings.disablePush||(await this.remotesAreSet()&&await this.gitManager.canPush()?await this.push():this.displayMessage("No commits to push")),this.setPluginState({gitAction:0}))}async commit({fromAuto:n,requestCustomMessage:r=!1,onlyStaged:i=!1,commitMessage:a,amend:s=!1}){if(!await this.isAllInitialized())return!1;try{let o=this.localStorage.getConflict(),l,c,u;if(this.gitManager instanceof Le){if(await this.mayDeleteConflictFile(),c=await this.updateCachedStatus(),c.conflicted.length==0&&(o=!1),n&&c.conflicted.length>0)return this.displayError(`Did not commit, because you have conflicts in ${c.conflicted.length} ${c.conflicted.length==1?"file":"files"}. Please resolve them and commit per command.`),await this.handleConflict(c.conflicted),!1;l=[...c.changed,...c.staged]}else{if(n&&o)return this.displayError("Did not commit, because you have conflicts. Please resolve them and commit per command."),!1;if(o)await this.mayDeleteConflictFile(),c=await this.updateCachedStatus(),l=[...c.changed,...c.staged];else{let f=this.gitManager;i?l=await f.getStagedFiles():(u=await f.getUnstagedFiles(),l=u.map(({filepath:h})=>({vault_path:this.gitManager.getRelativeVaultPath(h)})))}}if(await this.tools.hasTooBigFiles(l))return this.setPluginState({gitAction:0}),!1;if(l.length!==0||o){let f=a!=null?a:a=n?this.settings.autoCommitMessage:this.settings.commitMessage;if(n&&this.settings.customMessageOnAutoBackup||r){!this.settings.disablePopups&&n&&new _e.Notice("Auto backup: Please enter a custom commit message. Leave empty to abort");let p=await new Dc(this).openAndGetResult();if(p!=null&&p!=""&&p!="...")f=p;else return this.setPluginState({gitAction:0}),!1}let h;i?h=await this.gitManager.commit({message:f,amend:s}):h=await this.gitManager.commitAll({message:f,status:c,unstagedFiles:u,amend:s}),this.gitManager instanceof Le&&await this.updateCachedStatus();let d=!1;h===void 0&&(d=!0,h=l.length),await this.automaticsManager.setUpAutoCommitAndSync(),this.displayMessage(`Committed${d?" approx.":""} ${h} ${h==1?"file":"files"}`)}else this.displayMessage("No changes to commit");return this.app.workspace.trigger("obsidian-git:refresh"),!0}catch(o){return this.displayError(o),!1}}async push(){if(!await this.isAllInitialized()||!await this.remotesAreSet())return!1;let n=this.localStorage.getConflict();try{this.gitManager instanceof Le&&await this.mayDeleteConflictFile();let r;if(this.gitManager instanceof Le&&(r=await this.updateCachedStatus()).conflicted.length>0)return this.displayError(`Cannot push. You have conflicts in ${r.conflicted.length} ${r.conflicted.length==1?"file":"files"}`),await this.handleConflict(r.conflicted),!1;if(this.gitManager instanceof yn&&n)return this.displayError("Cannot push. You have conflicts"),!1;this.log("Pushing....");let i=await this.gitManager.push();return i!==void 0&&(i>0?this.displayMessage(`Pushed ${i} ${i==1?"file":"files"} to remote`):this.displayMessage("No commits to push")),this.setPluginState({offlineMode:!1}),this.app.workspace.trigger("obsidian-git:refresh"),!0}catch(r){return r instanceof Wi?this.handleNoNetworkError(r):this.displayError(r),!1}}async pull(){if(!await this.remotesAreSet())return!1;try{this.log("Pulling....");let n=await this.gitManager.pull()||[];return this.setPluginState({offlineMode:!1}),n.length>0&&(this.displayMessage(`Pulled ${n.length} ${n.length==1?"file":"files"} from remote`),this.lastPulledFiles=n),n.length}catch(n){return this.displayError(n),!1}}async fetch(){if(await this.remotesAreSet())try{await this.gitManager.fetch(),this.displayMessage("Fetched from remote"),this.setPluginState({offlineMode:!1}),this.app.workspace.trigger("obsidian-git:refresh")}catch(n){this.displayError(n)}}async mayDeleteConflictFile(){let n=this.app.vault.getAbstractFileByPath(Vi);n&&(this.app.workspace.iterateAllLeaves(r=>{var i;r.view instanceof _e.MarkdownView&&((i=r.view.file)==null?void 0:i.path)==n.path&&r.detach()}),await this.app.vault.delete(n))}async stageFile(n){return await this.isAllInitialized()?(await this.gitManager.stage(n.path,!0),this.displayMessage(`Staged ${n.path}`),this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0}),!0):!1}async unstageFile(n){return await this.isAllInitialized()?(await this.gitManager.unstage(n.path,!0),this.displayMessage(`Unstaged ${n.path}`),this.app.workspace.trigger("obsidian-git:refresh"),this.setPluginState({gitAction:0}),!0):!1}async switchBranch(){var i;if(!await this.isAllInitialized())return;let n=await this.gitManager.branchInfo(),r=await new au(this,n.branches).openAndGetReslt();if(r!=null)return await this.gitManager.checkout(r),this.displayMessage(`Switched to ${r}`),await((i=this.branchBar)==null?void 0:i.display()),r}async switchRemoteBranch(){var a;if(!await this.isAllInitialized())return;let n=await this.selectRemoteBranch()||"",[r,i]=wr(n);if(i!=null&&r!=null)return await this.gitManager.checkout(i,r),this.displayMessage(`Switched to ${n}`),await((a=this.branchBar)==null?void 0:a.display()),n}async createBranch(){var r;if(!await this.isAllInitialized())return;let n=await new Xe(this,{placeholder:"Create new branch"}).openAndGetResult();if(n!=null)return await this.gitManager.createBranch(n),this.displayMessage(`Created new branch ${n}`),await((r=this.branchBar)==null?void 0:r.display()),n}async deleteBranch(){var i;if(!await this.isAllInitialized())return;let n=await this.gitManager.branchInfo();n.current&&n.branches.remove(n.current);let r=await new Xe(this,{options:n.branches,placeholder:"Delete branch",onlySelection:!0}).openAndGetResult();if(r!=null){let a=!1;if(!await this.gitManager.branchIsMerged(r)){let o=await new Xe(this,{options:["YES","NO"],placeholder:"This branch isn't merged into HEAD. Force delete?",onlySelection:!0}).openAndGetResult();if(o!=="YES")return;a=o==="YES"}return await this.gitManager.deleteBranch(r,a),this.displayMessage(`Deleted branch ${r}`),await((i=this.branchBar)==null?void 0:i.display()),r}}async remotesAreSet(){return this.settings.updateSubmodules||(await this.gitManager.branchInfo()).tracking?!0:(new _e.Notice("No upstream branch is set. Please select one."),await this.setUpstreamBranch())}async setUpstreamBranch(){let n=await this.selectRemoteBranch();return n==null?(this.displayError("Aborted. No upstream-branch is set!",1e4),this.setPluginState({gitAction:0}),!1):(await this.gitManager.updateUpstreamBranch(n),this.displayMessage(`Set upstream branch to ${n}`),this.setPluginState({gitAction:0}),!0)}async discardAll(){await this.gitManager.discardAll({status:this.cachedStatus}),new _e.Notice("All local changes have been discarded. New files remain untouched.")}async handleConflict(n){this.localStorage.setConflict(!0);let r;n!==void 0&&(r=["# Conflicts","Please resolve them and commit them using the commands `Git: Commit all changes` followed by `Git: Push`","(This file will automatically be deleted before commit)","[[#Additional Instructions]] available below file list","",...n.map(i=>{let a=this.app.vault.getAbstractFileByPath(i);return a instanceof _e.TFile?`- [[${this.app.metadataCache.fileToLinktext(a,"/")}]]`:`- Not a file: ${i}`}),` # Additional Instructions I strongly recommend to use "Source mode" for viewing the conflicted files. For simple conflicts, in each file listed above replace every occurrence of the following text blocks with the desired text. \`\`\`diff <<<<<<< HEAD File changes in local repository ======= File changes in remote repository >>>>>>> origin/main \`\`\``]),await this.tools.writeAndOpenFile(r==null?void 0:r.join(` `))}async editRemotes(){if(!await this.isAllInitialized())return;let n=await this.gitManager.getRemotes(),i=await new Xe(this,{options:n,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(i){let a=await this.gitManager.getRemoteUrl(i),o=await new Xe(this,{initialValue:a}).openAndGetResult();if(o)return await this.gitManager.setRemote(i,o),i}}async selectRemoteBranch(){let n=await this.gitManager.getRemotes(),r;n.length===0&&(r=await this.editRemotes(),r==null&&(n=await this.gitManager.getRemotes()));let i=new Xe(this,{options:n,placeholder:"Select or create a new remote by typing its name and selecting it"}),a=r!=null?r:await i.openAndGetResult();if(a){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(a);let s=await this.gitManager.getRemoteBranches(a);return await new Xe(this,{options:s,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult()}}async removeRemote(){if(!await this.isAllInitialized())return;let n=await this.gitManager.getRemotes(),i=await new Xe(this,{options:n,placeholder:"Select a remote"}).openAndGetResult();i&&await this.gitManager.removeRemote(i)}handleViewActiveState(n){var a,s;if(!(n!=null&&n.view.getState().file))return;let r=this.app.workspace.getLeavesOfType(dt.type).first(),i=this.app.workspace.getLeavesOfType(nn.type).first();if((a=r==null?void 0:r.view.containerEl.querySelector("div.nav-file-title.is-active"))==null||a.removeClass("is-active"),(s=i==null?void 0:i.view.containerEl.querySelector("div.nav-file-title.is-active"))==null||s.removeClass("is-active"),(n==null?void 0:n.view)instanceof ga){let o=n.view.state.file;this.lastDiffViewState=n.view.getState();let l;r&&n.view.state.staged?l=r.view.containerEl.querySelector(`div.staged div.nav-file-title[data-path='${o}']`):r&&n.view.state.staged===!1&&!n.view.state.hash?l=r.view.containerEl.querySelector(`div.changes div.nav-file-title[data-path='${o}']`):i&&n.view.state.hash&&(l=i.view.containerEl.querySelector(`div.nav-file-title[data-path='${o}']`)),l==null||l.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(n){this.state.offlineMode?this.log("Encountered network error, but already in offline mode"):this.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3),this.setPluginState({gitAction:0,offlineMode:!0})}displayMessage(n,r=4*1e3){var i;(i=this.statusBar)==null||i.displayMessage(n.toLowerCase(),r),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!n.startsWith("No changes"))&&new _e.Notice(n,5*1e3),this.log(n)}displayError(n,r=10*1e3){var a;if(n instanceof hs.UserCanceledError){new _e.Notice("Aborted");return}let i;n instanceof Error?i=n:i=new Error(String(n)),this.setPluginState({gitAction:0}),new _e.Notice(i.message,r),console.error(`${this.manifest.id}:`,i.stack),(a=this.statusBar)==null||a.displayMessage(i.message.toLowerCase(),r)}log(...n){console.log(`${this.manifest.id}:`,...n)}}; /*! Bundled license information: ieee754/index.js: (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh *) buffer/index.js: (*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT *) safe-buffer/index.js: (*! safe-buffer. MIT License. Feross Aboukhadijeh *) crc-32/crc32.js: (*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *) js-sha256/src/sha256.js: (** * [js-sha256]{@link https://github.com/emn178/js-sha256} * * @version 0.9.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2014-2017 * @license MIT *) feather-icons/dist/feather.js: (*! Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames *) */ /* nosourcemap */