/* 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) */ "use strict";var j$=Object.create;var _c=Object.defineProperty;var V$=Object.getOwnPropertyDescriptor;var z$=Object.getOwnPropertyNames;var W$=Object.getPrototypeOf,q$=Object.prototype.hasOwnProperty;var Bb=t=>{throw TypeError(t)};var Y$=(t,e,r)=>e in t?_c(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Z$=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(i){throw r=[i],i}};var H=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},K$=(t,e)=>{for(var r in e)_c(t,r,{get:e[r],enumerable:!0})},Hb=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of z$(e))!q$.call(t,n)&&n!==r&&_c(t,n,{get:()=>e[n],enumerable:!(i=V$(e,n))||i.enumerable});return t};var mt=(t,e,r)=>(r=t!=null?j$(W$(t)):{},Hb(e||!t||!t.__esModule?_c(r,"default",{value:t,enumerable:!0}):r,t)),X$=t=>Hb(_c({},"__esModule",{value:!0}),t);var Ue=(t,e,r)=>Y$(t,typeof e!="symbol"?e+"":e,r),dm=(t,e,r)=>e.has(t)||Bb("Cannot "+r);var $=(t,e,r)=>(dm(t,e,"read from private field"),r?r.call(t):e.get(t)),ge=(t,e,r)=>e.has(t)?Bb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),de=(t,e,r,i)=>(dm(t,e,"write to private field"),i?i.call(t,r):e.set(t,r),r),Se=(t,e,r)=>(dm(t,e,"access private method"),r);var jb=H(Lf=>{"use strict";m();Lf.byteLength=J$;Lf.toByteArray=tF;Lf.fromByteArray=nF;var dn=[],bi=[],Q$=typeof Uint8Array!="undefined"?Uint8Array:Array,hm="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ca=0,Ub=hm.length;ca0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function J$(t){var e=Gb(t),r=e[0],i=e[1];return(r+i)*3/4-i}function eF(t,e,r){return(e+r)*3/4-r}function tF(t){var e,r=Gb(t),i=r[0],n=r[1],s=new Q$(eF(t,i,n)),a=0,o=n>0?i-4:i,l;for(l=0;l>16&255,s[a++]=e>>8&255,s[a++]=e&255;return n===2&&(e=bi[t.charCodeAt(l)]<<2|bi[t.charCodeAt(l+1)]>>4,s[a++]=e&255),n===1&&(e=bi[t.charCodeAt(l)]<<10|bi[t.charCodeAt(l+1)]<<4|bi[t.charCodeAt(l+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function rF(t){return dn[t>>18&63]+dn[t>>12&63]+dn[t>>6&63]+dn[t&63]}function iF(t,e,r){for(var i,n=[],s=e;so?o:a+s));return i===1?(e=t[r-1],n.push(dn[e>>2]+dn[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(dn[e>>10]+dn[e>>4&63]+dn[e<<2&63]+"=")),n.join("")}});var Vb=H(pm=>{m();pm.read=function(t,e,r,i,n){var s,a,o=n*8-i-1,l=(1<>1,u=-7,f=r?n-1:0,d=r?-1:1,h=t[e+f];for(f+=d,s=h&(1<<-u)-1,h>>=-u,u+=o;u>0;s=s*256+t[e+f],f+=d,u-=8);for(a=s&(1<<-u)-1,s>>=-u,u+=i;u>0;a=a*256+t[e+f],f+=d,u-=8);if(s===0)s=1-c;else{if(s===l)return a?NaN:(h?-1:1)*(1/0);a=a+Math.pow(2,i),s=s-c}return(h?-1:1)*a*Math.pow(2,s-i)};pm.write=function(t,e,r,i,n,s){var a,o,l,c=s*8-n-1,u=(1<>1,d=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,p=i?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,a=u):(a=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(a++,l/=2),a+f>=u?(o=0,a=u):a+f>=1?(o=(e*l-1)*Math.pow(2,n),a=a+f):(o=e*Math.pow(2,f-1)*Math.pow(2,n),a=0));n>=8;t[r+h]=o&255,h+=p,o/=256,n-=8);for(a=a<0;t[r+h]=a&255,h+=p,a/=256,c-=8);t[r+h-p]|=g*128}});var Em=H(Ao=>{"use strict";m();var mm=jb(),ko=Vb(),zb=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ao.Buffer=D;Ao.SlowBuffer=uF;Ao.INSPECT_MAX_BYTES=50;var Nf=2147483647;Ao.kMaxLength=Nf;D.TYPED_ARRAY_SUPPORT=sF();!D.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 sF(){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(D.prototype,"parent",{enumerable:!0,get:function(){if(D.isBuffer(this))return this.buffer}});Object.defineProperty(D.prototype,"offset",{enumerable:!0,get:function(){if(D.isBuffer(this))return this.byteOffset}});function Wn(t){if(t>Nf)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,D.prototype),e}function D(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return bm(t)}return Zb(t,e,r)}D.poolSize=8192;function Zb(t,e,r){if(typeof t=="string")return oF(t,e);if(ArrayBuffer.isView(t))return lF(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(hn(t,ArrayBuffer)||t&&hn(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(hn(t,SharedArrayBuffer)||t&&hn(t.buffer,SharedArrayBuffer)))return vm(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=t.valueOf&&t.valueOf();if(i!=null&&i!==t)return D.from(i,e,r);let n=cF(t);if(n)return n;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return D.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}D.from=function(t,e,r){return Zb(t,e,r)};Object.setPrototypeOf(D.prototype,Uint8Array.prototype);Object.setPrototypeOf(D,Uint8Array);function Kb(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 aF(t,e,r){return Kb(t),t<=0?Wn(t):e!==void 0?typeof r=="string"?Wn(t).fill(e,r):Wn(t).fill(e):Wn(t)}D.alloc=function(t,e,r){return aF(t,e,r)};function bm(t){return Kb(t),Wn(t<0?0:_m(t)|0)}D.allocUnsafe=function(t){return bm(t)};D.allocUnsafeSlow=function(t){return bm(t)};function oF(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!D.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Xb(t,e)|0,i=Wn(r),n=i.write(t,e);return n!==r&&(i=i.slice(0,n)),i}function gm(t){let e=t.length<0?0:_m(t.length)|0,r=Wn(e);for(let i=0;i=Nf)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Nf.toString(16)+" bytes");return t|0}function uF(t){return+t!=t&&(t=0),D.alloc(+t)}D.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==D.prototype};D.compare=function(e,r){if(hn(e,Uint8Array)&&(e=D.from(e,e.offset,e.byteLength)),hn(r,Uint8Array)&&(r=D.from(r,r.offset,r.byteLength)),!D.isBuffer(e)||!D.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let i=e.length,n=r.length;for(let s=0,a=Math.min(i,n);sn.length?(D.isBuffer(a)||(a=D.from(a)),a.copy(n,s)):Uint8Array.prototype.set.call(n,a,s);else if(D.isBuffer(a))a.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=a.length}return n};function Xb(t,e){if(D.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||hn(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 r=t.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return wm(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return a_(t).length;default:if(n)return i?-1:wm(t).length;e=(""+e).toLowerCase(),n=!0}}D.byteLength=Xb;function fF(t,e,r){let i=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return yF(this,e,r);case"utf8":case"utf-8":return Jb(this,e,r);case"ascii":return bF(this,e,r);case"latin1":case"binary":return _F(this,e,r);case"base64":return vF(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xF(this,e,r);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}D.prototype._isBuffer=!0;function ua(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}D.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 r=0;rr&&(e+=" ... "),""};zb&&(D.prototype[zb]=D.prototype.inspect);D.prototype.compare=function(e,r,i,n,s){if(hn(e,Uint8Array)&&(e=D.from(e,e.offset,e.byteLength)),!D.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),i===void 0&&(i=e?e.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),r<0||i>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&r>=i)return 0;if(n>=s)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,s>>>=0,this===e)return 0;let a=s-n,o=i-r,l=Math.min(a,o),c=this.slice(n,s),u=e.slice(r,i);for(let f=0;f2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,xm(r)&&(r=n?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(n)return-1;r=t.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof e=="string"&&(e=D.from(e,i)),D.isBuffer(e))return e.length===0?-1:Wb(t,e,r,i,n);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Wb(t,[e],r,i,n);throw new TypeError("val must be string, number or Buffer")}function Wb(t,e,r,i,n){let s=1,a=t.length,o=e.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(t.length<2||e.length<2)return-1;s=2,a/=2,o/=2,r/=2}function l(u,f){return s===1?u[f]:u.readUInt16BE(f*s)}let c;if(n){let u=-1;for(c=r;ca&&(r=a-o),c=r;c>=0;c--){let u=!0;for(let f=0;fn&&(i=n)):i=n;let s=e.length;i>s/2&&(i=s/2);let a;for(a=0;a>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-r;if((i===void 0||i>s)&&(i=s),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let a=!1;for(;;)switch(n){case"hex":return dF(this,e,r,i);case"utf8":case"utf-8":return hF(this,e,r,i);case"ascii":case"latin1":case"binary":return pF(this,e,r,i);case"base64":return mF(this,e,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return gF(this,e,r,i);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}};D.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function vF(t,e,r){return e===0&&r===t.length?mm.fromByteArray(t):mm.fromByteArray(t.slice(e,r))}function Jb(t,e,r){r=Math.min(t.length,r);let i=[],n=e;for(;n239?4:s>223?3:s>191?2:1;if(n+o<=r){let l,c,u,f;switch(o){case 1:s<128&&(a=s);break;case 2:l=t[n+1],(l&192)===128&&(f=(s&31)<<6|l&63,f>127&&(a=f));break;case 3:l=t[n+1],c=t[n+2],(l&192)===128&&(c&192)===128&&(f=(s&15)<<12|(l&63)<<6|c&63,f>2047&&(f<55296||f>57343)&&(a=f));break;case 4:l=t[n+1],c=t[n+2],u=t[n+3],(l&192)===128&&(c&192)===128&&(u&192)===128&&(f=(s&15)<<18|(l&63)<<12|(c&63)<<6|u&63,f>65535&&f<1114112&&(a=f))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,i.push(a>>>10&1023|55296),a=56320|a&1023),i.push(a),n+=o}return wF(i)}var qb=4096;function wF(t){let e=t.length;if(e<=qb)return String.fromCharCode.apply(String,t);let r="",i=0;for(;ii)&&(r=i);let n="";for(let s=e;si&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),rr)throw new RangeError("Trying to access beyond buffer length")}D.prototype.readUintLE=D.prototype.readUIntLE=function(e,r,i){e=e>>>0,r=r>>>0,i||Vt(e,r,this.length);let n=this[e],s=1,a=0;for(;++a>>0,r=r>>>0,i||Vt(e,r,this.length);let n=this[e+--r],s=1;for(;r>0&&(s*=256);)n+=this[e+--r]*s;return n};D.prototype.readUint8=D.prototype.readUInt8=function(e,r){return e=e>>>0,r||Vt(e,1,this.length),this[e]};D.prototype.readUint16LE=D.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||Vt(e,2,this.length),this[e]|this[e+1]<<8};D.prototype.readUint16BE=D.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||Vt(e,2,this.length),this[e]<<8|this[e+1]};D.prototype.readUint32LE=D.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||Vt(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};D.prototype.readUint32BE=D.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||Vt(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};D.prototype.readBigUInt64LE=ks(function(e){e=e>>>0,Co(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&yc(e,this.length-8);let n=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<>>0,Co(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&yc(e,this.length-8);let n=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+i;return(BigInt(n)<>>0,r=r>>>0,i||Vt(e,r,this.length);let n=this[e],s=1,a=0;for(;++a=s&&(n-=Math.pow(2,8*r)),n};D.prototype.readIntBE=function(e,r,i){e=e>>>0,r=r>>>0,i||Vt(e,r,this.length);let n=r,s=1,a=this[e+--n];for(;n>0&&(s*=256);)a+=this[e+--n]*s;return s*=128,a>=s&&(a-=Math.pow(2,8*r)),a};D.prototype.readInt8=function(e,r){return e=e>>>0,r||Vt(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};D.prototype.readInt16LE=function(e,r){e=e>>>0,r||Vt(e,2,this.length);let i=this[e]|this[e+1]<<8;return i&32768?i|4294901760:i};D.prototype.readInt16BE=function(e,r){e=e>>>0,r||Vt(e,2,this.length);let i=this[e+1]|this[e]<<8;return i&32768?i|4294901760:i};D.prototype.readInt32LE=function(e,r){return e=e>>>0,r||Vt(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};D.prototype.readInt32BE=function(e,r){return e=e>>>0,r||Vt(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};D.prototype.readBigInt64LE=ks(function(e){e=e>>>0,Co(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&yc(e,this.length-8);let n=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(i<<24);return(BigInt(n)<>>0,Co(e,"offset");let r=this[e],i=this[e+7];(r===void 0||i===void 0)&&yc(e,this.length-8);let n=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(n)<>>0,r||Vt(e,4,this.length),ko.read(this,e,!0,23,4)};D.prototype.readFloatBE=function(e,r){return e=e>>>0,r||Vt(e,4,this.length),ko.read(this,e,!1,23,4)};D.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||Vt(e,8,this.length),ko.read(this,e,!0,52,8)};D.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||Vt(e,8,this.length),ko.read(this,e,!1,52,8)};function Ir(t,e,r,i,n,s){if(!D.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>n||et.length)throw new RangeError("Index out of range")}D.prototype.writeUintLE=D.prototype.writeUIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,i=i>>>0,!n){let o=Math.pow(2,8*i)-1;Ir(this,e,r,i,o,0)}let s=1,a=0;for(this[r]=e&255;++a>>0,i=i>>>0,!n){let o=Math.pow(2,8*i)-1;Ir(this,e,r,i,o,0)}let s=i-1,a=1;for(this[r+s]=e&255;--s>=0&&(a*=256);)this[r+s]=e/a&255;return r+i};D.prototype.writeUint8=D.prototype.writeUInt8=function(e,r,i){return e=+e,r=r>>>0,i||Ir(this,e,r,1,255,0),this[r]=e&255,r+1};D.prototype.writeUint16LE=D.prototype.writeUInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||Ir(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};D.prototype.writeUint16BE=D.prototype.writeUInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||Ir(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};D.prototype.writeUint32LE=D.prototype.writeUInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||Ir(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};D.prototype.writeUint32BE=D.prototype.writeUInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||Ir(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function e_(t,e,r,i,n){s_(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,a=a>>8,t[r++]=a,r}function t_(t,e,r,i,n){s_(e,i,n,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s=s>>8,t[r+6]=s,s=s>>8,t[r+5]=s,s=s>>8,t[r+4]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a=a>>8,t[r+2]=a,a=a>>8,t[r+1]=a,a=a>>8,t[r]=a,r+8}D.prototype.writeBigUInt64LE=ks(function(e,r=0){return e_(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});D.prototype.writeBigUInt64BE=ks(function(e,r=0){return t_(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});D.prototype.writeIntLE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);Ir(this,e,r,i,l-1,-l)}let s=0,a=1,o=0;for(this[r]=e&255;++s>0)-o&255;return r+i};D.prototype.writeIntBE=function(e,r,i,n){if(e=+e,r=r>>>0,!n){let l=Math.pow(2,8*i-1);Ir(this,e,r,i,l-1,-l)}let s=i-1,a=1,o=0;for(this[r+s]=e&255;--s>=0&&(a*=256);)e<0&&o===0&&this[r+s+1]!==0&&(o=1),this[r+s]=(e/a>>0)-o&255;return r+i};D.prototype.writeInt8=function(e,r,i){return e=+e,r=r>>>0,i||Ir(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};D.prototype.writeInt16LE=function(e,r,i){return e=+e,r=r>>>0,i||Ir(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};D.prototype.writeInt16BE=function(e,r,i){return e=+e,r=r>>>0,i||Ir(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};D.prototype.writeInt32LE=function(e,r,i){return e=+e,r=r>>>0,i||Ir(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};D.prototype.writeInt32BE=function(e,r,i){return e=+e,r=r>>>0,i||Ir(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};D.prototype.writeBigInt64LE=ks(function(e,r=0){return e_(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});D.prototype.writeBigInt64BE=ks(function(e,r=0){return t_(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function r_(t,e,r,i,n,s){if(r+i>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function i_(t,e,r,i,n){return e=+e,r=r>>>0,n||r_(t,e,r,4,34028234663852886e22,-34028234663852886e22),ko.write(t,e,r,i,23,4),r+4}D.prototype.writeFloatLE=function(e,r,i){return i_(this,e,r,!0,i)};D.prototype.writeFloatBE=function(e,r,i){return i_(this,e,r,!1,i)};function n_(t,e,r,i,n){return e=+e,r=r>>>0,n||r_(t,e,r,8,17976931348623157e292,-17976931348623157e292),ko.write(t,e,r,i,52,8),r+8}D.prototype.writeDoubleLE=function(e,r,i){return n_(this,e,r,!0,i)};D.prototype.writeDoubleBE=function(e,r,i){return n_(this,e,r,!1,i)};D.prototype.copy=function(e,r,i,n){if(!D.isBuffer(e))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r>>0,i=i===void 0?this.length:i>>>0,e||(e=0);let s;if(typeof e=="number")for(s=r;s2**32?n=Yb(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=Yb(n)),n+="n"),i+=` It must be ${e}. Received ${n}`,i},RangeError);function Yb(t){let e="",r=t.length,i=t[0]==="-"?1:0;for(;r>=i+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function EF(t,e,r){Co(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&yc(e,t.length-(r+1))}function s_(t,e,r,i,n,s){if(t>r||t3?e===0||e===BigInt(0)?o=`>= 0${a} and < 2${a} ** ${(s+1)*8}${a}`:o=`>= -(2${a} ** ${(s+1)*8-1}${a}) and < 2 ** ${(s+1)*8-1}${a}`:o=`>= ${e}${a} and <= ${r}${a}`,new So.ERR_OUT_OF_RANGE("value",o,t)}EF(i,n,s)}function Co(t,e){if(typeof t!="number")throw new So.ERR_INVALID_ARG_TYPE(e,"number",t)}function yc(t,e,r){throw Math.floor(t)!==t?(Co(t,r),new So.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new So.ERR_BUFFER_OUT_OF_BOUNDS:new So.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var SF=/[^+/0-9A-Za-z-_]/g;function kF(t){if(t=t.split("=")[0],t=t.trim().replace(SF,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function wm(t,e){e=e||1/0;let r,i=t.length,n=null,s=[];for(let a=0;a55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(a+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function CF(t){let e=[];for(let r=0;r>8,n=r%256,s.push(n),s.push(i);return s}function a_(t){return mm.toByteArray(kF(t))}function Bf(t,e,r,i){let n;for(n=0;n=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function hn(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function xm(t){return t!==t}var TF=(function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)e[i+n]=t[r]+t[n]}return e})();function ks(t){return typeof BigInt=="undefined"?PF:t}function PF(){throw new Error("BigInt not supported")}});var o_,Sm,k,m=Z$(()=>{"use strict";o_=require("obsidian");o_.Platform.isMobileApp?Sm=Em().Buffer:Sm=global.Buffer;k=Sm});var c_=H((nj,l_)=>{"use strict";m();var ri=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||ri.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||ri.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||ri.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=ri.DEFAULT_MAX_PENDING};ri.DEFAULT_TIMEOUT=0;ri.DEFAULT_MAX_OCCUPATION_TIME=0;ri.DEFAULT_MAX_EXECUTION_TIME=0;ri.DEFAULT_MAX_PENDING=1e3;ri.prototype.acquire=function(t,e,r,i){if(Array.isArray(t))return this._acquireBatch(t,e,r,i);if(typeof e!="function")throw new Error("You must pass a function to execute");var n=null,s=null,a=null;typeof r!="function"&&(i=r,r=null,a=new this.Promise(function(_,C){n=_,s=C})),i=i||{};var o=!1,l=null,c=null,u=null,f=this,d=function(_,C,x){c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null),_&&(f.queues[t]&&f.queues[t].length===0&&delete f.queues[t],f.domainReentrant&&delete f.domains[t]),o||(a?C?s(C):n(x):typeof r=="function"&&r(C,x),o=!0),_&&f.queues[t]&&f.queues[t].length>0&&f.queues[t].shift()()},h=function(_){if(o)return d(_);l&&(clearTimeout(l),l=null),f.domainReentrant&&_&&(f.domains[t]=process.domain);var C=i.maxExecutionTime||f.maxExecutionTime;if(C&&(u=setTimeout(function(){f.queues[t]&&d(_,new Error("Maximum execution time is exceeded "+t))},C)),e.length===1){var x=!1;try{e(function(E,A){x||(x=!0,d(_,E,A))})}catch(E){x||(x=!0,d(_,E))}}else f._promiseTry(function(){return e()}).then(function(E){d(_,void 0,E)},function(E){d(_,E)})};f.domainReentrant&&process.domain&&(h=process.domain.bind(h));var p=i.maxPending||f.maxPending;if(!f.queues[t])f.queues[t]=[],h(!0);else if(f.domainReentrant&&process.domain&&process.domain===f.domains[t])h(!1);else if(f.queues[t].length>=p)d(!1,new Error("Too many pending tasks in queue "+t));else{var g=function(){h(!0)};i.skipQueue?f.queues[t].unshift(g):f.queues[t].push(g);var v=i.timeout||f.timeout;v&&(l=setTimeout(function(){l=null,d(!1,new Error("async-lock timed out in queue "+t))},v))}var b=i.maxOccupationTime||f.maxOccupationTime;if(b&&(c=setTimeout(function(){f.queues[t]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+t))},b)),a)return a};ri.prototype._acquireBatch=function(t,e,r,i){typeof r!="function"&&(i=r,r=null);var n=this,s=function(o,l){return function(c){n.acquire(o,l,c,i)}},a=t.reduceRight(function(o,l){return s(l,o)},e);if(typeof r=="function")a(r);else return new this.Promise(function(o,l){a.length===1?a(function(c,u){c?l(c):o(u)}):o(a())})};ri.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0};ri.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(e){return this.Promise.reject(e)}};l_.exports=ri});var f_=H((aj,u_)=>{"use strict";m();u_.exports=c_()});var d_=H((lj,km)=>{m();typeof Object.create=="function"?km.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:km.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}}});var Uf=H((Cm,p_)=>{m();var Hf=Em(),pn=Hf.Buffer;function h_(t,e){for(var r in t)e[r]=t[r]}pn.from&&pn.alloc&&pn.allocUnsafe&&pn.allocUnsafeSlow?p_.exports=Hf:(h_(Hf,Cm),Cm.Buffer=fa);function fa(t,e,r){return pn(t,e,r)}fa.prototype=Object.create(pn.prototype);h_(pn,fa);fa.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return pn(t,e,r)};fa.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var i=pn(t);return e!==void 0?typeof r=="string"?i.fill(e,r):i.fill(e):i.fill(0),i};fa.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return pn(t)};fa.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Hf.SlowBuffer(t)}});var g_=H((fj,m_)=>{m();var RF={}.toString;m_.exports=Array.isArray||function(t){return RF.call(t)=="[object Array]"}});var To=H((hj,v_)=>{"use strict";m();v_.exports=TypeError});var Am=H((mj,w_)=>{"use strict";m();w_.exports=Object});var __=H((vj,b_)=>{"use strict";m();b_.exports=Error});var x_=H((bj,y_)=>{"use strict";m();y_.exports=EvalError});var S_=H((yj,E_)=>{"use strict";m();E_.exports=RangeError});var C_=H((Ej,k_)=>{"use strict";m();k_.exports=ReferenceError});var Tm=H((kj,A_)=>{"use strict";m();A_.exports=SyntaxError});var P_=H((Aj,T_)=>{"use strict";m();T_.exports=URIError});var $_=H((Pj,R_)=>{"use strict";m();R_.exports=Math.abs});var I_=H(($j,F_)=>{"use strict";m();F_.exports=Math.floor});var D_=H((Ij,M_)=>{"use strict";m();M_.exports=Math.max});var L_=H((Dj,O_)=>{"use strict";m();O_.exports=Math.min});var B_=H((Lj,N_)=>{"use strict";m();N_.exports=Math.pow});var U_=H((Bj,H_)=>{"use strict";m();H_.exports=Math.round});var j_=H((Uj,G_)=>{"use strict";m();G_.exports=Number.isNaN||function(e){return e!==e}});var z_=H((jj,V_)=>{"use strict";m();var $F=j_();V_.exports=function(e){return $F(e)||e===0?e:e<0?-1:1}});var q_=H((zj,W_)=>{"use strict";m();W_.exports=Object.getOwnPropertyDescriptor});var Po=H((qj,Y_)=>{"use strict";m();var Gf=q_();if(Gf)try{Gf([],"length")}catch(t){Gf=null}Y_.exports=Gf});var xc=H((Zj,Z_)=>{"use strict";m();var jf=Object.defineProperty||!1;if(jf)try{jf({},"a",{value:1})}catch(t){jf=!1}Z_.exports=jf});var Pm=H((Xj,K_)=>{"use strict";m();K_.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),i=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;e[r]=n;for(var s in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var o=Object.getOwnPropertyDescriptor(e,r);if(o.value!==n||o.enumerable!==!0)return!1}return!0}});var J_=H((Jj,Q_)=>{"use strict";m();var X_=typeof Symbol!="undefined"&&Symbol,FF=Pm();Q_.exports=function(){return typeof X_!="function"||typeof Symbol!="function"||typeof X_("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:FF()}});var Rm=H((tV,ey)=>{"use strict";m();ey.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var $m=H((iV,ty)=>{"use strict";m();var IF=Am();ty.exports=IF.getPrototypeOf||null});var ny=H((sV,iy)=>{"use strict";m();var MF="Function.prototype.bind called on incompatible ",DF=Object.prototype.toString,OF=Math.max,LF="[object Function]",ry=function(e,r){for(var i=[],n=0;n{"use strict";m();var HF=ny();sy.exports=Function.prototype.bind||HF});var Vf=H((cV,ay)=>{"use strict";m();ay.exports=Function.prototype.call});var zf=H((fV,oy)=>{"use strict";m();oy.exports=Function.prototype.apply});var cy=H((hV,ly)=>{"use strict";m();ly.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var Fm=H((mV,uy)=>{"use strict";m();var UF=Ro(),GF=zf(),jF=Vf(),VF=cy();uy.exports=VF||UF.call(jF,GF)});var Wf=H((vV,fy)=>{"use strict";m();var zF=Ro(),WF=To(),qF=Vf(),YF=Fm();fy.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new WF("a function is required");return YF(zF,qF,e)}});var vy=H((bV,gy)=>{"use strict";m();var ZF=Wf(),dy=Po(),py;try{py=[].__proto__===Array.prototype}catch(t){if(!t||typeof t!="object"||!("code"in t)||t.code!=="ERR_PROTO_ACCESS")throw t}var Im=!!py&&dy&&dy(Object.prototype,"__proto__"),my=Object,hy=my.getPrototypeOf;gy.exports=Im&&typeof Im.get=="function"?ZF([Im.get]):typeof hy=="function"?function(e){return hy(e==null?e:my(e))}:!1});var Mm=H((yV,yy)=>{"use strict";m();var wy=Rm(),by=$m(),_y=vy();yy.exports=wy?function(e){return wy(e)}:by?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return by(e)}:_y?function(e){return _y(e)}:null});var Ey=H((EV,xy)=>{"use strict";m();var KF=Function.prototype.call,XF=Object.prototype.hasOwnProperty,QF=Ro();xy.exports=QF.call(KF,XF)});var Lm=H((kV,Py)=>{"use strict";m();var Te,JF=Am(),eI=__(),tI=x_(),rI=S_(),iI=C_(),Mo=Tm(),Io=To(),nI=P_(),sI=$_(),aI=I_(),oI=D_(),lI=L_(),cI=B_(),uI=U_(),fI=z_(),Ay=Function,Dm=function(t){try{return Ay('"use strict"; return ('+t+").constructor;")()}catch(e){}},Ec=Po(),dI=xc(),Om=function(){throw new Io},hI=Ec?(function(){try{return arguments.callee,Om}catch(t){try{return Ec(arguments,"callee").get}catch(e){return Om}}})():Om,$o=J_()(),zt=Mm(),pI=$m(),mI=Rm(),Ty=zf(),Sc=Vf(),Fo={},gI=typeof Uint8Array=="undefined"||!zt?Te:zt(Uint8Array),da={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?Te:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Te:ArrayBuffer,"%ArrayIteratorPrototype%":$o&&zt?zt([][Symbol.iterator]()):Te,"%AsyncFromSyncIteratorPrototype%":Te,"%AsyncFunction%":Fo,"%AsyncGenerator%":Fo,"%AsyncGeneratorFunction%":Fo,"%AsyncIteratorPrototype%":Fo,"%Atomics%":typeof Atomics=="undefined"?Te:Atomics,"%BigInt%":typeof BigInt=="undefined"?Te:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Te:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Te:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Te:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":eI,"%eval%":eval,"%EvalError%":tI,"%Float16Array%":typeof Float16Array=="undefined"?Te:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?Te:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Te:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Te:FinalizationRegistry,"%Function%":Ay,"%GeneratorFunction%":Fo,"%Int8Array%":typeof Int8Array=="undefined"?Te:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Te:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Te:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":$o&&zt?zt(zt([][Symbol.iterator]())):Te,"%JSON%":typeof JSON=="object"?JSON:Te,"%Map%":typeof Map=="undefined"?Te:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!$o||!zt?Te:zt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":JF,"%Object.getOwnPropertyDescriptor%":Ec,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Te:Promise,"%Proxy%":typeof Proxy=="undefined"?Te:Proxy,"%RangeError%":rI,"%ReferenceError%":iI,"%Reflect%":typeof Reflect=="undefined"?Te:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Te:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!$o||!zt?Te:zt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Te:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":$o&&zt?zt(""[Symbol.iterator]()):Te,"%Symbol%":$o?Symbol:Te,"%SyntaxError%":Mo,"%ThrowTypeError%":hI,"%TypedArray%":gI,"%TypeError%":Io,"%Uint8Array%":typeof Uint8Array=="undefined"?Te:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Te:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Te:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Te:Uint32Array,"%URIError%":nI,"%WeakMap%":typeof WeakMap=="undefined"?Te:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Te:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Te:WeakSet,"%Function.prototype.call%":Sc,"%Function.prototype.apply%":Ty,"%Object.defineProperty%":dI,"%Object.getPrototypeOf%":pI,"%Math.abs%":sI,"%Math.floor%":aI,"%Math.max%":oI,"%Math.min%":lI,"%Math.pow%":cI,"%Math.round%":uI,"%Math.sign%":fI,"%Reflect.getPrototypeOf%":mI};if(zt)try{null.error}catch(t){Sy=zt(zt(t)),da["%Error.prototype%"]=Sy}var Sy,vI=function t(e){var r;if(e==="%AsyncFunction%")r=Dm("async function () {}");else if(e==="%GeneratorFunction%")r=Dm("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Dm("async function* () {}");else if(e==="%AsyncGenerator%"){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var n=t("%AsyncGenerator%");n&&zt&&(r=zt(n.prototype))}return da[e]=r,r},ky={__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"]},kc=Ro(),qf=Ey(),wI=kc.call(Sc,Array.prototype.concat),bI=kc.call(Ty,Array.prototype.splice),Cy=kc.call(Sc,String.prototype.replace),Yf=kc.call(Sc,String.prototype.slice),_I=kc.call(Sc,RegExp.prototype.exec),yI=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,xI=/\\(\\)?/g,EI=function(e){var r=Yf(e,0,1),i=Yf(e,-1);if(r==="%"&&i!=="%")throw new Mo("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new Mo("invalid intrinsic syntax, expected opening `%`");var n=[];return Cy(e,yI,function(s,a,o,l){n[n.length]=o?Cy(l,xI,"$1"):a||s}),n},SI=function(e,r){var i=e,n;if(qf(ky,i)&&(n=ky[i],i="%"+n[0]+"%"),qf(da,i)){var s=da[i];if(s===Fo&&(s=vI(i)),typeof s=="undefined"&&!r)throw new Io("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:s}}throw new Mo("intrinsic "+e+" does not exist!")};Py.exports=function(e,r){if(typeof e!="string"||e.length===0)throw new Io("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Io('"allowMissing" argument must be a boolean');if(_I(/^%?[^%]*%?$/,e)===null)throw new Mo("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=EI(e),n=i.length>0?i[0]:"",s=SI("%"+n+"%",r),a=s.name,o=s.value,l=!1,c=s.alias;c&&(n=c[0],bI(i,wI([0,1],c)));for(var u=1,f=!0;u=i.length){var g=Ec(o,d);f=!!g,f&&"get"in g&&!("originalValue"in g.get)?o=g.get:o=o[d]}else f=qf(o,d),o=o[d];f&&!l&&(da[a]=o)}}return o}});var Nm=H((AV,Fy)=>{"use strict";m();var Ry=Lm(),$y=Wf(),kI=$y([Ry("%String.prototype.indexOf%")]);Fy.exports=function(e,r){var i=Ry(e,!!r);return typeof i=="function"&&kI(e,".prototype.")>-1?$y([i]):i}});var Oy=H((PV,Dy)=>{"use strict";m();var My=Function.prototype.toString,Do=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Hm,Zf;if(typeof Do=="function"&&typeof Object.defineProperty=="function")try{Hm=Object.defineProperty({},"length",{get:function(){throw Zf}}),Zf={},Do(function(){throw 42},null,Hm)}catch(t){t!==Zf&&(Do=null)}else Do=null;var CI=/^\s*class\b/,Um=function(e){try{var r=My.call(e);return CI.test(r)}catch(i){return!1}},Bm=function(e){try{return Um(e)?!1:(My.call(e),!0)}catch(r){return!1}},Kf=Object.prototype.toString,AI="[object Object]",TI="[object Function]",PI="[object GeneratorFunction]",RI="[object HTMLAllCollection]",$I="[object HTML document.all class]",FI="[object HTMLCollection]",II=typeof Symbol=="function"&&!!Symbol.toStringTag,MI=!(0 in[,]),Gm=function(){return!1};typeof document=="object"&&(Iy=document.all,Kf.call(Iy)===Kf.call(document.all)&&(Gm=function(e){if((MI||!e)&&(typeof e=="undefined"||typeof e=="object"))try{var r=Kf.call(e);return(r===RI||r===$I||r===FI||r===AI)&&e("")==null}catch(i){}return!1}));var Iy;Dy.exports=Do?function(e){if(Gm(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{Do(e,null,Hm)}catch(r){if(r!==Zf)return!1}return!Um(e)&&Bm(e)}:function(e){if(Gm(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(II)return Bm(e);if(Um(e))return!1;var r=Kf.call(e);return r!==TI&&r!==PI&&!/^\[object HTML/.test(r)?!1:Bm(e)}});var By=H(($V,Ny)=>{"use strict";m();var DI=Oy(),OI=Object.prototype.toString,Ly=Object.prototype.hasOwnProperty,LI=function(e,r,i){for(var n=0,s=e.length;n=3&&(n=i),HI(e)?LI(e,r,n):typeof e=="string"?NI(e,r,n):BI(e,r,n)}});var Uy=H((IV,Hy)=>{"use strict";m();Hy.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var jy=H((DV,Gy)=>{"use strict";m();var jm=Uy(),UI=typeof globalThis=="undefined"?global:globalThis;Gy.exports=function(){for(var e=[],r=0;r{"use strict";m();var Vy=xc(),GI=Tm(),Oo=To(),zy=Po();Wy.exports=function(e,r,i){if(!e||typeof e!="object"&&typeof e!="function")throw new Oo("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Oo("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Oo("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Oo("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Oo("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Oo("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,o=arguments.length>6?arguments[6]:!1,l=!!zy&&zy(e,r);if(Vy)Vy(e,r,{configurable:a===null&&l?l.configurable:!a,enumerable:n===null&&l?l.enumerable:!n,value:i,writable:s===null&&l?l.writable:!s});else if(o||!n&&!s&&!a)e[r]=i;else throw new GI("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Ky=H((BV,Zy)=>{"use strict";m();var Vm=xc(),Yy=function(){return!!Vm};Yy.hasArrayLengthDefineBug=function(){if(!Vm)return null;try{return Vm([],"length",{value:1}).length!==1}catch(e){return!0}};Zy.exports=Yy});var tx=H((UV,ex)=>{"use strict";m();var jI=Lm(),Xy=qy(),VI=Ky()(),Qy=Po(),Jy=To(),zI=jI("%Math.floor%");ex.exports=function(e,r){if(typeof e!="function")throw new Jy("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||zI(r)!==r)throw new Jy("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,s=!0;if("length"in e&&Qy){var a=Qy(e,"length");a&&!a.configurable&&(n=!1),a&&!a.writable&&(s=!1)}return(n||s||!i)&&(VI?Xy(e,"length",r,!0,!0):Xy(e,"length",r)),e}});var ix=H((jV,rx)=>{"use strict";m();var WI=Ro(),qI=zf(),YI=Fm();rx.exports=function(){return YI(WI,qI,arguments)}});var ax=H((zV,Xf)=>{"use strict";m();var ZI=tx(),nx=xc(),KI=Wf(),sx=ix();Xf.exports=function(e){var r=KI(arguments),i=1+e.length-(arguments.length-1);return ZI(r,i>0?i:0,!0)};nx?nx(Xf.exports,"apply",{value:sx}):Xf.exports.apply=sx});var lx=H((qV,ox)=>{"use strict";m();var XI=Pm();ox.exports=function(){return XI()&&!!Symbol.toStringTag}});var hx=H((ZV,dx)=>{"use strict";m();var td=By(),QI=jy(),cx=ax(),Wm=Nm(),Jf=Po(),Qf=Mm(),JI=Wm("Object.prototype.toString"),fx=lx()(),ux=typeof globalThis=="undefined"?global:globalThis,zm=QI(),qm=Wm("String.prototype.slice"),eM=Wm("Array.prototype.indexOf",!0)||function(e,r){for(var i=0;i-1}dx.exports=function(e){if(!e||typeof e!="object")return!1;if(!fx){var r=qm(JI(e),8,-1);return iM(r)?r:r!=="Object"?!1:rM(e)}return Jf?tM(e):null}});var mx=H((XV,px)=>{"use strict";m();var nM=hx();px.exports=function(e){return!!nM(e)}});var vx=H((JV,gx)=>{"use strict";m();var sM=To(),aM=Nm(),oM=aM("TypedArray.prototype.buffer",!0),lM=mx();gx.exports=oM||function(e){if(!lM(e))throw new sM("Not a Typed Array");return e.buffer}});var _x=H((tz,bx)=>{"use strict";m();var Gi=Uf().Buffer,cM=g_(),uM=vx(),fM=ArrayBuffer.isView||function(e){try{return uM(e),!0}catch(r){return!1}},dM=typeof Uint8Array!="undefined",wx=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined",hM=wx&&(Gi.prototype instanceof Uint8Array||Gi.TYPED_ARRAY_SUPPORT);bx.exports=function(e,r){if(Gi.isBuffer(e))return e.constructor&&!("isBuffer"in e)?Gi.from(e):e;if(typeof e=="string")return Gi.from(e,r);if(wx&&fM(e)){if(e.byteLength===0)return Gi.alloc(0);if(hM){var i=Gi.from(e.buffer,e.byteOffset,e.byteLength);if(i.byteLength===e.byteLength)return i}var n=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=Gi.from(n);if(s.length===e.byteLength)return s}if(dM&&e instanceof Uint8Array)return Gi.from(e);var a=cM(e);if(a)for(var o=0;o255||~~l!==l)throw new RangeError("Array items must be numbers in the range 0-255.")}if(a||Gi.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return Gi.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}});var xx=H((iz,yx)=>{"use strict";m();var pM=Uf().Buffer,mM=_x();function id(t,e){this._block=pM.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}id.prototype.update=function(t,e){t=mM(t,e||"utf8");for(var r=this._block,i=this._blockSize,n=t.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var i=(r&4294967295)>>>0,n=(r-i)/4294967296;this._block.writeUInt32BE(n,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var s=this._hash();return t?s.toString(t):s};id.prototype._update=function(){throw new Error("_update must be implemented by subclass")};yx.exports=id});var kx=H((sz,Sx)=>{"use strict";m();var gM=d_(),Ex=xx(),vM=Uf().Buffer,wM=[1518500249,1859775393,-1894007588,-899497514],bM=new Array(80);function Cc(){this.init(),this._w=bM,Ex.call(this,64,56)}gM(Cc,Ex);Cc.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function _M(t){return t<<1|t>>>31}function yM(t){return t<<5|t>>>27}function xM(t){return t<<30|t>>>2}function EM(t,e,r,i){return t===0?e&r|~e&i:t===2?e&r|e&i|r&i:e^r^i}Cc.prototype._update=function(t){for(var e=this._w,r=this._a|0,i=this._b|0,n=this._c|0,s=this._d|0,a=this._e|0,o=0;o<16;++o)e[o]=t.readInt32BE(o*4);for(;o<80;++o)e[o]=_M(e[o-3]^e[o-8]^e[o-14]^e[o-16]);for(var l=0;l<80;++l){var c=~~(l/20),u=yM(r)+EM(c,i,n,s)+a+e[l]+wM[c]|0;a=s,s=n,n=xM(i),i=r,r=u}this._a=r+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};Cc.prototype._hash=function(){var t=vM.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};Sx.exports=Cc});var Ax=H(Ym=>{m();var Cx;(function(t){typeof DO_NOT_EXPORT_CRC=="undefined"?typeof Ym=="object"?t(Ym):typeof define=="function"&&define.amd?define(function(){var e={};return t(e),e}):t(Cx={}):t(Cx={})})(function(t){t.version="1.2.2";function e(){for(var w=0,S=new Array(256),y=0;y!=256;++y)w=y,w=w&1?-306674912^w>>>1:w>>>1,w=w&1?-306674912^w>>>1:w>>>1,w=w&1?-306674912^w>>>1:w>>>1,w=w&1?-306674912^w>>>1:w>>>1,w=w&1?-306674912^w>>>1:w>>>1,w=w&1?-306674912^w>>>1:w>>>1,w=w&1?-306674912^w>>>1:w>>>1,w=w&1?-306674912^w>>>1:w>>>1,S[y]=w;return typeof Int32Array!="undefined"?new Int32Array(S):S}var r=e();function i(w){var S=0,y=0,P=0,T=typeof Int32Array!="undefined"?new Int32Array(4096):new Array(4096);for(P=0;P!=256;++P)T[P]=w[P];for(P=0;P!=256;++P)for(y=w[P],S=256+P;S<4096;S+=256)y=T[S]=y>>>8^w[y&255];var I=[];for(P=1;P!=16;++P)I[P-1]=typeof Int32Array!="undefined"?T.subarray(P*256,P*256+256):T.slice(P*256,P*256+256);return I}var n=i(r),s=n[0],a=n[1],o=n[2],l=n[3],c=n[4],u=n[5],f=n[6],d=n[7],h=n[8],p=n[9],g=n[10],v=n[11],b=n[12],_=n[13],C=n[14];function x(w,S){for(var y=S^-1,P=0,T=w.length;P>>8^r[(y^w.charCodeAt(P++))&255];return~y}function E(w,S){for(var y=S^-1,P=w.length-15,T=0;T>8&255]^b[w[T++]^y>>16&255]^v[w[T++]^y>>>24]^g[w[T++]]^p[w[T++]]^h[w[T++]]^d[w[T++]]^f[w[T++]]^u[w[T++]]^c[w[T++]]^l[w[T++]]^o[w[T++]]^a[w[T++]]^s[w[T++]]^r[w[T++]];for(P+=15;T>>8^r[(y^w[T++])&255];return~y}function A(w,S){for(var y=S^-1,P=0,T=w.length,I=0,M=0;P>>8^r[(y^I)&255]:I<2048?(y=y>>>8^r[(y^(192|I>>6&31))&255],y=y>>>8^r[(y^(128|I&63))&255]):I>=55296&&I<57344?(I=(I&1023)+64,M=w.charCodeAt(P++)&1023,y=y>>>8^r[(y^(240|I>>8&7))&255],y=y>>>8^r[(y^(128|I>>2&63))&255],y=y>>>8^r[(y^(128|M>>6&15|(I&3)<<4))&255],y=y>>>8^r[(y^(128|M&63))&255]):(y=y>>>8^r[(y^(224|I>>12&15))&255],y=y>>>8^r[(y^(128|I>>6&63))&255],y=y>>>8^r[(y^(128|I&63))&255]);return~y}t.table=r,t.bstr=x,t.buf=E,t.str=A})});var qn=H(_r=>{"use strict";m();var SM=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function kM(t,e){return Object.prototype.hasOwnProperty.call(t,e)}_r.assign=function(t){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var r=e.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var i in r)kM(r,i)&&(t[i]=r[i])}}return t};_r.shrinkBuf=function(t,e){return t.length===e?t:t.subarray?t.subarray(0,e):(t.length=e,t)};var CM={arraySet:function(t,e,r,i,n){if(e.subarray&&t.subarray){t.set(e.subarray(r,r+i),n);return}for(var s=0;s{"use strict";m();var TM=qn(),PM=4,Tx=0,Px=1,RM=2;function No(t){for(var e=t.length;--e>=0;)t[e]=0}var $M=0,Dx=1,FM=2,IM=3,MM=258,tg=29,Fc=256,Tc=Fc+1+tg,Lo=30,rg=19,Ox=2*Tc+1,ha=15,Zm=16,DM=7,ig=256,Lx=16,Nx=17,Bx=18,Jm=[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],nd=[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],OM=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Hx=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],LM=512,Yn=new Array((Tc+2)*2);No(Yn);var Ac=new Array(Lo*2);No(Ac);var Pc=new Array(LM);No(Pc);var Rc=new Array(MM-IM+1);No(Rc);var ng=new Array(tg);No(ng);var sd=new Array(Lo);No(sd);function Km(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}var Ux,Gx,jx;function Xm(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function Vx(t){return t<256?Pc[t]:Pc[256+(t>>>7)]}function $c(t,e){t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255}function Mr(t,e,r){t.bi_valid>Zm-r?(t.bi_buf|=e<>Zm-t.bi_valid,t.bi_valid+=r-Zm):(t.bi_buf|=e<>>=1,r<<=1;while(--e>0);return r>>>1}function NM(t){t.bi_valid===16?($c(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 BM(t,e){var r=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,s=e.stat_desc.has_stree,a=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,l=e.stat_desc.max_length,c,u,f,d,h,p,g=0;for(d=0;d<=ha;d++)t.bl_count[d]=0;for(r[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;cl&&(d=l,g++),r[u*2+1]=d,!(u>i)&&(t.bl_count[d]++,h=0,u>=o&&(h=a[u-o]),p=r[u*2],t.opt_len+=p*(d+h),s&&(t.static_len+=p*(n[u*2+1]+h)));if(g!==0){do{for(d=l-1;t.bl_count[d]===0;)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[l]--,g-=2}while(g>0);for(d=l;d!==0;d--)for(u=t.bl_count[d];u!==0;)f=t.heap[--c],!(f>i)&&(r[f*2+1]!==d&&(t.opt_len+=(d-r[f*2+1])*r[f*2],r[f*2+1]=d),u--)}}function Wx(t,e,r){var i=new Array(ha+1),n=0,s,a;for(s=1;s<=ha;s++)i[s]=n=n+r[s-1]<<1;for(a=0;a<=e;a++){var o=t[a*2+1];o!==0&&(t[a*2]=zx(i[o]++,o))}}function HM(){var t,e,r,i,n,s=new Array(ha+1);for(r=0,i=0;i>=7;i8?$c(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 UM(t,e,r,i){Yx(t),i&&($c(t,r),$c(t,~r)),TM.arraySet(t.pending_buf,t.window,e,r,t.pending),t.pending+=r}function Rx(t,e,r,i){var n=e*2,s=r*2;return t[n]>1;a>=1;a--)Qm(t,r,a);c=s;do a=t.heap[1],t.heap[1]=t.heap[t.heap_len--],Qm(t,r,1),o=t.heap[1],t.heap[--t.heap_max]=a,t.heap[--t.heap_max]=o,r[c*2]=r[a*2]+r[o*2],t.depth[c]=(t.depth[a]>=t.depth[o]?t.depth[a]:t.depth[o])+1,r[a*2+1]=r[o*2+1]=c,t.heap[1]=c++,Qm(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],BM(t,e),Wx(r,l,t.bl_count)}function Fx(t,e,r){var i,n=-1,s,a=e[1],o=0,l=7,c=4;for(a===0&&(l=138,c=3),e[(r+1)*2+1]=65535,i=0;i<=r;i++)s=a,a=e[(i+1)*2+1],!(++o=3&&t.bl_tree[Hx[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e}function jM(t,e,r,i){var n;for(Mr(t,e-257,5),Mr(t,r-1,5),Mr(t,i-4,4),n=0;n>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return Tx;if(t.dyn_ltree[18]!==0||t.dyn_ltree[20]!==0||t.dyn_ltree[26]!==0)return Px;for(r=32;r0?(t.strm.data_type===RM&&(t.strm.data_type=VM(t)),eg(t,t.l_desc),eg(t,t.d_desc),a=GM(t),n=t.opt_len+3+7>>>3,s=t.static_len+3+7>>>3,s<=n&&(n=s)):n=s=r+5,r+4<=n&&e!==-1?Zx(t,e,r,i):t.strategy===PM||s===n?(Mr(t,(Dx<<1)+(i?1:0),3),$x(t,Yn,Ac)):(Mr(t,(FM<<1)+(i?1:0),3),jM(t,t.l_desc.max_code+1,t.d_desc.max_code+1,a+1),$x(t,t.dyn_ltree,t.dyn_dtree)),qx(t),i&&Yx(t)}function YM(t,e,r){return t.pending_buf[t.d_buf+t.last_lit*2]=e>>>8&255,t.pending_buf[t.d_buf+t.last_lit*2+1]=e&255,t.pending_buf[t.l_buf+t.last_lit]=r&255,t.last_lit++,e===0?t.dyn_ltree[r*2]++:(t.matches++,e--,t.dyn_ltree[(Rc[r]+Fc+1)*2]++,t.dyn_dtree[Vx(e)*2]++),t.last_lit===t.lit_bufsize-1}Bo._tr_init=zM;Bo._tr_stored_block=Zx;Bo._tr_flush_block=qM;Bo._tr_tally=YM;Bo._tr_align=WM});var sg=H((hz,Xx)=>{"use strict";m();function ZM(t,e,r,i){for(var n=t&65535|0,s=t>>>16&65535|0,a=0;r!==0;){a=r>2e3?2e3:r,r-=a;do n=n+e[i++]|0,s=s+n|0;while(--a);n%=65521,s%=65521}return n|s<<16|0}Xx.exports=ZM});var ag=H((mz,Qx)=>{"use strict";m();function KM(){for(var t,e=[],r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e}var XM=KM();function QM(t,e,r,i){var n=XM,s=i+r;t^=-1;for(var a=i;a>>8^n[(t^e[a])&255];return t^-1}Qx.exports=QM});var ad=H((vz,Jx)=>{"use strict";m();Jx.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 l1=H(wn=>{"use strict";m();var yr=qn(),_i=Kx(),i1=sg(),Cs=ag(),JM=ad(),va=0,eD=1,tD=3,$s=4,e1=5,vn=0,t1=1,yi=-2,rD=-3,og=-5,iD=-1,nD=1,od=2,sD=3,aD=4,oD=0,lD=2,fd=8,cD=9,uD=15,fD=8,dD=29,hD=256,cg=hD+1+dD,pD=30,mD=19,gD=2*cg+1,vD=15,Re=3,Ps=258,ji=Ps+Re+1,wD=32,dd=42,ug=69,ld=73,cd=91,ud=103,pa=113,Mc=666,Ot=1,Dc=2,ma=3,Go=4,bD=3;function Rs(t,e){return t.msg=JM[e],e}function r1(t){return(t<<1)-(t>4?9:0)}function Ts(t){for(var e=t.length;--e>=0;)t[e]=0}function As(t){var e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(yr.arraySet(t.output,e.pending_buf,e.pending_out,r,t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,e.pending===0&&(e.pending_out=0))}function Qt(t,e){_i._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,As(t.strm)}function Me(t,e){t.pending_buf[t.pending++]=e}function Ic(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255}function _D(t,e,r,i){var n=t.avail_in;return n>i&&(n=i),n===0?0:(t.avail_in-=n,yr.arraySet(e,t.input,t.next_in,n,r),t.state.wrap===1?t.adler=i1(t.adler,e,n,r):t.state.wrap===2&&(t.adler=Cs(t.adler,e,n,r)),t.next_in+=n,t.total_in+=n,n)}function n1(t,e){var r=t.max_chain_length,i=t.strstart,n,s,a=t.prev_length,o=t.nice_match,l=t.strstart>t.w_size-ji?t.strstart-(t.w_size-ji):0,c=t.window,u=t.w_mask,f=t.prev,d=t.strstart+Ps,h=c[i+a-1],p=c[i+a];t.prev_length>=t.good_match&&(r>>=2),o>t.lookahead&&(o=t.lookahead);do if(n=e,!(c[n+a]!==p||c[n+a-1]!==h||c[n]!==c[i]||c[++n]!==c[i+1])){i+=2,n++;do;while(c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&ia){if(t.match_start=e,a=s,s>=o)break;h=c[i+a-1],p=c[i+a]}}while((e=f[e&u])>l&&--r!==0);return a<=t.lookahead?a:t.lookahead}function ga(t){var e=t.w_size,r,i,n,s,a;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-ji)){yr.arraySet(t.window,t.window,e,e,0),t.match_start-=e,t.strstart-=e,t.block_start-=e,i=t.hash_size,r=i;do n=t.head[--r],t.head[r]=n>=e?n-e:0;while(--i);i=e,r=i;do n=t.prev[--r],t.prev[r]=n>=e?n-e:0;while(--i);s+=e}if(t.strm.avail_in===0)break;if(i=_D(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=i,t.lookahead+t.insert>=Re)for(a=t.strstart-t.insert,t.ins_h=t.window[a],t.ins_h=(t.ins_h<t.pending_buf_size-5&&(r=t.pending_buf_size-5);;){if(t.lookahead<=1){if(ga(t),t.lookahead===0&&e===va)return Ot;if(t.lookahead===0)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+r;if((t.strstart===0||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,Qt(t,!1),t.strm.avail_out===0)||t.strstart-t.block_start>=t.w_size-ji&&(Qt(t,!1),t.strm.avail_out===0))return Ot}return t.insert=0,e===$s?(Qt(t,!0),t.strm.avail_out===0?ma:Go):(t.strstart>t.block_start&&(Qt(t,!1),t.strm.avail_out===0),Ot)}function lg(t,e){for(var r,i;;){if(t.lookahead=Re&&(t.ins_h=(t.ins_h<=Re)if(i=_i._tr_tally(t,t.strstart-t.match_start,t.match_length-Re),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=Re){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<=Re&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=Re-1)),t.prev_length>=Re&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-Re,i=_i._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-Re),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=n&&(t.ins_h=(t.ins_h<=Re&&t.strstart>0&&(n=t.strstart-1,i=a[n],i===a[++n]&&i===a[++n]&&i===a[++n])){s=t.strstart+Ps;do;while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&nt.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=Re?(r=_i._tr_tally(t,1,t.match_length-Re),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=_i._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(Qt(t,!1),t.strm.avail_out===0))return Ot}return t.insert=0,e===$s?(Qt(t,!0),t.strm.avail_out===0?ma:Go):t.last_lit&&(Qt(t,!1),t.strm.avail_out===0)?Ot:Dc}function ED(t,e){for(var r;;){if(t.lookahead===0&&(ga(t),t.lookahead===0)){if(e===va)return Ot;break}if(t.match_length=0,r=_i._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(Qt(t,!1),t.strm.avail_out===0))return Ot}return t.insert=0,e===$s?(Qt(t,!0),t.strm.avail_out===0?ma:Go):t.last_lit&&(Qt(t,!1),t.strm.avail_out===0)?Ot:Dc}function gn(t,e,r,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=i,this.func=n}var Uo;Uo=[new gn(0,0,0,0,yD),new gn(4,4,8,4,lg),new gn(4,5,16,8,lg),new gn(4,6,32,32,lg),new gn(4,4,16,16,Ho),new gn(8,16,32,32,Ho),new gn(8,16,128,128,Ho),new gn(8,32,128,256,Ho),new gn(32,128,258,1024,Ho),new gn(32,258,258,4096,Ho)];function SD(t){t.window_size=2*t.w_size,Ts(t.head),t.max_lazy_match=Uo[t.level].max_lazy,t.good_match=Uo[t.level].good_length,t.nice_match=Uo[t.level].nice_length,t.max_chain_length=Uo[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=Re-1,t.match_available=0,t.ins_h=0}function kD(){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=fd,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 yr.Buf16(gD*2),this.dyn_dtree=new yr.Buf16((2*pD+1)*2),this.bl_tree=new yr.Buf16((2*mD+1)*2),Ts(this.dyn_ltree),Ts(this.dyn_dtree),Ts(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new yr.Buf16(vD+1),this.heap=new yr.Buf16(2*cg+1),Ts(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new yr.Buf16(2*cg+1),Ts(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 s1(t){var e;return!t||!t.state?Rs(t,yi):(t.total_in=t.total_out=0,t.data_type=lD,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?dd:pa,t.adler=e.wrap===2?0:1,e.last_flush=va,_i._tr_init(e),vn)}function a1(t){var e=s1(t);return e===vn&&SD(t.state),e}function CD(t,e){return!t||!t.state||t.state.wrap!==2?yi:(t.state.gzhead=e,vn)}function o1(t,e,r,i,n,s){if(!t)return yi;var a=1;if(e===iD&&(e=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>cD||r!==fd||i<8||i>15||e<0||e>9||s<0||s>aD)return Rs(t,yi);i===8&&(i=9);var o=new kD;return t.state=o,o.strm=t,o.wrap=a,o.gzhead=null,o.w_bits=i,o.w_size=1<e1||e<0)return t?Rs(t,yi):yi;if(i=t.state,!t.output||!t.input&&t.avail_in!==0||i.status===Mc&&e!==$s)return Rs(t,t.avail_out===0?og:yi);if(i.strm=t,r=i.last_flush,i.last_flush=e,i.status===dd)if(i.wrap===2)t.adler=0,Me(i,31),Me(i,139),Me(i,8),i.gzhead?(Me(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Me(i,i.gzhead.time&255),Me(i,i.gzhead.time>>8&255),Me(i,i.gzhead.time>>16&255),Me(i,i.gzhead.time>>24&255),Me(i,i.level===9?2:i.strategy>=od||i.level<2?4:0),Me(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(Me(i,i.gzhead.extra.length&255),Me(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(t.adler=Cs(t.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=ug):(Me(i,0),Me(i,0),Me(i,0),Me(i,0),Me(i,0),Me(i,i.level===9?2:i.strategy>=od||i.level<2?4:0),Me(i,bD),i.status=pa);else{var a=fd+(i.w_bits-8<<4)<<8,o=-1;i.strategy>=od||i.level<2?o=0:i.level<6?o=1:i.level===6?o=2:o=3,a|=o<<6,i.strstart!==0&&(a|=wD),a+=31-a%31,i.status=pa,Ic(i,a),i.strstart!==0&&(Ic(i,t.adler>>>16),Ic(i,t.adler&65535)),t.adler=1}if(i.status===ug)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(i.gzhead.extra.length&65535)&&!(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Cs(t.adler,i.pending_buf,i.pending-n,n)),As(t),n=i.pending,i.pending===i.pending_buf_size));)Me(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(t.adler=Cs(t.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=ld)}else i.status=ld;if(i.status===ld)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Cs(t.adler,i.pending_buf,i.pending-n,n)),As(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindexn&&(t.adler=Cs(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.gzindex=0,i.status=cd)}else i.status=cd;if(i.status===cd)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(t.adler=Cs(t.adler,i.pending_buf,i.pending-n,n)),As(t),n=i.pending,i.pending===i.pending_buf_size)){s=1;break}i.gzindexn&&(t.adler=Cs(t.adler,i.pending_buf,i.pending-n,n)),s===0&&(i.status=ud)}else i.status=ud;if(i.status===ud&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&As(t),i.pending+2<=i.pending_buf_size&&(Me(i,t.adler&255),Me(i,t.adler>>8&255),t.adler=0,i.status=pa)):i.status=pa),i.pending!==0){if(As(t),t.avail_out===0)return i.last_flush=-1,vn}else if(t.avail_in===0&&r1(e)<=r1(r)&&e!==$s)return Rs(t,og);if(i.status===Mc&&t.avail_in!==0)return Rs(t,og);if(t.avail_in!==0||i.lookahead!==0||e!==va&&i.status!==Mc){var l=i.strategy===od?ED(i,e):i.strategy===sD?xD(i,e):Uo[i.level].func(i,e);if((l===ma||l===Go)&&(i.status=Mc),l===Ot||l===ma)return t.avail_out===0&&(i.last_flush=-1),vn;if(l===Dc&&(e===eD?_i._tr_align(i):e!==e1&&(_i._tr_stored_block(i,0,0,!1),e===tD&&(Ts(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),As(t),t.avail_out===0))return i.last_flush=-1,vn}return e!==$s?vn:i.wrap<=0?t1:(i.wrap===2?(Me(i,t.adler&255),Me(i,t.adler>>8&255),Me(i,t.adler>>16&255),Me(i,t.adler>>24&255),Me(i,t.total_in&255),Me(i,t.total_in>>8&255),Me(i,t.total_in>>16&255),Me(i,t.total_in>>24&255)):(Ic(i,t.adler>>>16),Ic(i,t.adler&65535)),As(t),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?vn:t1)}function PD(t){var e;return!t||!t.state?yi:(e=t.state.status,e!==dd&&e!==ug&&e!==ld&&e!==cd&&e!==ud&&e!==pa&&e!==Mc?Rs(t,yi):(t.state=null,e===pa?Rs(t,rD):vn))}function RD(t,e){var r=e.length,i,n,s,a,o,l,c,u;if(!t||!t.state||(i=t.state,a=i.wrap,a===2||a===1&&i.status!==dd||i.lookahead))return yi;for(a===1&&(t.adler=i1(t.adler,e,r,0)),i.wrap=0,r>=i.w_size&&(a===0&&(Ts(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new yr.Buf8(i.w_size),yr.arraySet(u,e,r-i.w_size,i.w_size,0),e=u,r=i.w_size),o=t.avail_in,l=t.next_in,c=t.input,t.avail_in=r,t.next_in=0,t.input=e,ga(i);i.lookahead>=Re;){n=i.strstart,s=i.lookahead-(Re-1);do i.ins_h=(i.ins_h<{"use strict";m();var hd=qn(),c1=!0,u1=!0;try{String.fromCharCode.apply(null,[0])}catch(t){c1=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){u1=!1}var Oc=new hd.Buf8(256);for(Zn=0;Zn<256;Zn++)Oc[Zn]=Zn>=252?6:Zn>=248?5:Zn>=240?4:Zn>=224?3:Zn>=192?2:1;var Zn;Oc[254]=Oc[254]=1;jo.string2buf=function(t){var e,r,i,n,s,a=t.length,o=0;for(n=0;n>>6,e[s++]=128|r&63):r<65536?(e[s++]=224|r>>>12,e[s++]=128|r>>>6&63,e[s++]=128|r&63):(e[s++]=240|r>>>18,e[s++]=128|r>>>12&63,e[s++]=128|r>>>6&63,e[s++]=128|r&63);return e};function f1(t,e){if(e<65534&&(t.subarray&&u1||!t.subarray&&c1))return String.fromCharCode.apply(null,hd.shrinkBuf(t,e));for(var r="",i=0;i4){o[i++]=65533,r+=s-1;continue}for(n&=s===2?31:s===3?15:7;s>1&&r1){o[i++]=65533;continue}n<65536?o[i++]=n:(n-=65536,o[i++]=55296|n>>10&1023,o[i++]=56320|n&1023)}return f1(o,i)};jo.utf8border=function(t,e){var r;for(e=e||t.length,e>t.length&&(e=t.length),r=e-1;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+Oc[t[r]]>e?r:e}});var dg=H((Ez,d1)=>{"use strict";m();function $D(){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}d1.exports=$D});var g1=H(Bc=>{"use strict";m();var Lc=l1(),Nc=qn(),pg=fg(),mg=ad(),FD=dg(),m1=Object.prototype.toString,ID=0,hg=4,Vo=0,h1=1,p1=2,MD=-1,DD=0,OD=8;function wa(t){if(!(this instanceof wa))return new wa(t);this.options=Nc.assign({level:MD,method:OD,chunkSize:16384,windowBits:15,memLevel:8,strategy:DD,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 FD,this.strm.avail_out=0;var r=Lc.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==Vo)throw new Error(mg[r]);if(e.header&&Lc.deflateSetHeader(this.strm,e.header),e.dictionary){var i;if(typeof e.dictionary=="string"?i=pg.string2buf(e.dictionary):m1.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,r=Lc.deflateSetDictionary(this.strm,i),r!==Vo)throw new Error(mg[r]);this._dict_set=!0}}wa.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n,s;if(this.ended)return!1;s=e===~~e?e:e===!0?hg:ID,typeof t=="string"?r.input=pg.string2buf(t):m1.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Nc.Buf8(i),r.next_out=0,r.avail_out=i),n=Lc.deflate(r,s),n!==h1&&n!==Vo)return this.onEnd(n),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(s===hg||s===p1))&&(this.options.to==="string"?this.onData(pg.buf2binstring(Nc.shrinkBuf(r.output,r.next_out))):this.onData(Nc.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&n!==h1);return s===hg?(n=Lc.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Vo):(s===p1&&(this.onEnd(Vo),r.avail_out=0),!0)};wa.prototype.onData=function(t){this.chunks.push(t)};wa.prototype.onEnd=function(t){t===Vo&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Nc.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function gg(t,e){var r=new wa(e);if(r.push(t,!0),r.err)throw r.msg||mg[r.err];return r.result}function LD(t,e){return e=e||{},e.raw=!0,gg(t,e)}function ND(t,e){return e=e||{},e.gzip=!0,gg(t,e)}Bc.Deflate=wa;Bc.deflate=gg;Bc.deflateRaw=LD;Bc.gzip=ND});var w1=H((Az,v1)=>{"use strict";m();var pd=30,BD=12;v1.exports=function(e,r){var i,n,s,a,o,l,c,u,f,d,h,p,g,v,b,_,C,x,E,A,w,S,y,P,T;i=e.state,n=e.next_in,P=e.input,s=n+(e.avail_in-5),a=e.next_out,T=e.output,o=a-(r-e.avail_out),l=a+(e.avail_out-257),c=i.dmax,u=i.wsize,f=i.whave,d=i.wnext,h=i.window,p=i.hold,g=i.bits,v=i.lencode,b=i.distcode,_=(1<>>24,p>>>=E,g-=E,E=x>>>16&255,E===0)T[a++]=x&65535;else if(E&16){A=x&65535,E&=15,E&&(g>>=E,g-=E),g<15&&(p+=P[n++]<>>24,p>>>=E,g-=E,E=x>>>16&255,E&16){if(w=x&65535,E&=15,gc){e.msg="invalid distance too far back",i.mode=pd;break e}if(p>>>=E,g-=E,E=a-o,w>E){if(E=w-E,E>f&&i.sane){e.msg="invalid distance too far back",i.mode=pd;break e}if(S=0,y=h,d===0){if(S+=u-E,E2;)T[a++]=y[S++],T[a++]=y[S++],T[a++]=y[S++],A-=3;A&&(T[a++]=y[S++],A>1&&(T[a++]=y[S++]))}else{S=a-w;do T[a++]=T[S++],T[a++]=T[S++],T[a++]=T[S++],A-=3;while(A>2);A&&(T[a++]=T[S++],A>1&&(T[a++]=T[S++]))}}else if((E&64)===0){x=b[(x&65535)+(p&(1<>3,n-=A,g-=A<<3,p&=(1<{"use strict";m();var b1=qn(),zo=15,_1=852,y1=592,x1=0,vg=1,E1=2,HD=[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],UD=[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],GD=[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],jD=[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];S1.exports=function(e,r,i,n,s,a,o,l){var c=l.bits,u=0,f=0,d=0,h=0,p=0,g=0,v=0,b=0,_=0,C=0,x,E,A,w,S,y=null,P=0,T,I=new b1.Buf16(zo+1),M=new b1.Buf16(zo+1),B=null,re=0,Ae,K,Q;for(u=0;u<=zo;u++)I[u]=0;for(f=0;f=1&&I[h]===0;h--);if(p>h&&(p=h),h===0)return s[a++]=1<<24|64<<16|0,s[a++]=1<<24|64<<16|0,l.bits=1,0;for(d=1;d0&&(e===x1||h!==1))return-1;for(M[1]=0,u=1;u_1||e===E1&&_>y1)return 1;for(;;){Ae=u-v,o[f]T?(K=B[re+o[f]],Q=y[P+o[f]]):(K=96,Q=0),x=1<>v)+E]=Ae<<24|K<<16|Q|0;while(E!==0);for(x=1<>=1;if(x!==0?(C&=x-1,C+=x):C=0,f++,--I[u]===0){if(u===h)break;u=r[i+o[f]]}if(u>p&&(C&w)!==A){for(v===0&&(v=p),S+=d,g=u-v,b=1<_1||e===E1&&_>y1)return 1;A=C&w,s[A]=p<<24|g<<16|S-a|0}}return C!==0&&(s[S+C]=u-v<<24|64<<16|0),l.bits=p,0}});var aE=H(Vi=>{"use strict";m();var ii=qn(),Eg=sg(),bn=ag(),VD=w1(),Hc=k1(),zD=0,X1=1,Q1=2,C1=4,WD=5,md=6,ba=0,qD=1,YD=2,xi=-2,J1=-3,Sg=-4,ZD=-5,A1=8,eE=1,T1=2,P1=3,R1=4,$1=5,F1=6,I1=7,M1=8,D1=9,O1=10,wd=11,Kn=12,wg=13,L1=14,bg=15,N1=16,B1=17,H1=18,U1=19,gd=20,vd=21,G1=22,j1=23,V1=24,z1=25,W1=26,_g=27,q1=28,Y1=29,lt=30,kg=31,KD=32,XD=852,QD=592,JD=15,eO=JD;function Z1(t){return(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24)}function tO(){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 ii.Buf16(320),this.work=new ii.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function tE(t){var e;return!t||!t.state?xi:(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=eE,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new ii.Buf32(XD),e.distcode=e.distdyn=new ii.Buf32(QD),e.sane=1,e.back=-1,ba)}function rE(t){var e;return!t||!t.state?xi:(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,tE(t))}function iE(t,e){var r,i;return!t||!t.state||(i=t.state,e<0?(r=0,e=-e):(r=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?xi:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,rE(t))}function nE(t,e){var r,i;return t?(i=new tO,t.state=i,i.window=null,r=iE(t,e),r!==ba&&(t.state=null),r):xi}function rO(t){return nE(t,eO)}var K1=!0,yg,xg;function iO(t){if(K1){var e;for(yg=new ii.Buf32(512),xg=new ii.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(Hc(X1,t.lens,0,288,yg,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Hc(Q1,t.lens,0,32,xg,0,t.work,{bits:5}),K1=!1}t.lencode=yg,t.lenbits=9,t.distcode=xg,t.distbits=5}function sE(t,e,r,i){var n,s=t.state;return s.window===null&&(s.wsize=1<=s.wsize?(ii.arraySet(s.window,e,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),ii.arraySet(s.window,e,r-i,n,s.wnext),i-=n,i?(ii.arraySet(s.window,e,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=bn(r.check,y,2,0),c=0,u=0,r.mode=T1;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",r.mode=lt;break}if((c&15)!==A1){t.msg="unknown compression method",r.mode=lt;break}if(c>>>=4,u-=4,w=(c&15)+8,r.wbits===0)r.wbits=w;else if(w>r.wbits){t.msg="invalid window size",r.mode=lt;break}r.dmax=1<>8&1),r.flags&512&&(y[0]=c&255,y[1]=c>>>8&255,r.check=bn(r.check,y,2,0)),c=0,u=0,r.mode=P1;case P1:for(;u<32;){if(o===0)break e;o--,c+=i[s++]<>>8&255,y[2]=c>>>16&255,y[3]=c>>>24&255,r.check=bn(r.check,y,4,0)),c=0,u=0,r.mode=R1;case R1:for(;u<16;){if(o===0)break e;o--,c+=i[s++]<>8),r.flags&512&&(y[0]=c&255,y[1]=c>>>8&255,r.check=bn(r.check,y,2,0)),c=0,u=0,r.mode=$1;case $1:if(r.flags&1024){for(;u<16;){if(o===0)break e;o--,c+=i[s++]<>>8&255,r.check=bn(r.check,y,2,0)),c=0,u=0}else r.head&&(r.head.extra=null);r.mode=F1;case F1:if(r.flags&1024&&(h=r.length,h>o&&(h=o),h&&(r.head&&(w=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),ii.arraySet(r.head.extra,i,s,h,w)),r.flags&512&&(r.check=bn(r.check,i,h,s)),o-=h,s+=h,r.length-=h),r.length))break e;r.length=0,r.mode=I1;case I1:if(r.flags&2048){if(o===0)break e;h=0;do w=i[s+h++],r.head&&w&&r.length<65536&&(r.head.name+=String.fromCharCode(w));while(w&&h>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=Kn;break;case O1:for(;u<32;){if(o===0)break e;o--,c+=i[s++]<>>=u&7,u-=u&7,r.mode=_g;break}for(;u<3;){if(o===0)break e;o--,c+=i[s++]<>>=1,u-=1,c&3){case 0:r.mode=L1;break;case 1:if(iO(r),r.mode=gd,e===md){c>>>=2,u-=2;break e}break;case 2:r.mode=B1;break;case 3:t.msg="invalid block type",r.mode=lt}c>>>=2,u-=2;break;case L1:for(c>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,c+=i[s++]<>>16^65535)){t.msg="invalid stored block lengths",r.mode=lt;break}if(r.length=c&65535,c=0,u=0,r.mode=bg,e===md)break e;case bg:r.mode=N1;case N1:if(h=r.length,h){if(h>o&&(h=o),h>l&&(h=l),h===0)break e;ii.arraySet(n,i,s,h,a),o-=h,s+=h,l-=h,a+=h,r.length-=h;break}r.mode=Kn;break;case B1:for(;u<14;){if(o===0)break e;o--,c+=i[s++]<>>=5,u-=5,r.ndist=(c&31)+1,c>>>=5,u-=5,r.ncode=(c&15)+4,c>>>=4,u-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=lt;break}r.have=0,r.mode=H1;case H1:for(;r.have>>=3,u-=3}for(;r.have<19;)r.lens[I[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,P={bits:r.lenbits},S=Hc(zD,r.lens,0,19,r.lencode,0,r.work,P),r.lenbits=P.bits,S){t.msg="invalid code lengths set",r.mode=lt;break}r.have=0,r.mode=U1;case U1:for(;r.have>>24,_=v>>>16&255,C=v&65535,!(b<=u);){if(o===0)break e;o--,c+=i[s++]<>>=b,u-=b,r.lens[r.have++]=C;else{if(C===16){for(T=b+2;u>>=b,u-=b,r.have===0){t.msg="invalid bit length repeat",r.mode=lt;break}w=r.lens[r.have-1],h=3+(c&3),c>>>=2,u-=2}else if(C===17){for(T=b+3;u>>=b,u-=b,w=0,h=3+(c&7),c>>>=3,u-=3}else{for(T=b+7;u>>=b,u-=b,w=0,h=11+(c&127),c>>>=7,u-=7}if(r.have+h>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=lt;break}for(;h--;)r.lens[r.have++]=w}}if(r.mode===lt)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=lt;break}if(r.lenbits=9,P={bits:r.lenbits},S=Hc(X1,r.lens,0,r.nlen,r.lencode,0,r.work,P),r.lenbits=P.bits,S){t.msg="invalid literal/lengths set",r.mode=lt;break}if(r.distbits=6,r.distcode=r.distdyn,P={bits:r.distbits},S=Hc(Q1,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,P),r.distbits=P.bits,S){t.msg="invalid distances set",r.mode=lt;break}if(r.mode=gd,e===md)break e;case gd:r.mode=vd;case vd:if(o>=6&&l>=258){t.next_out=a,t.avail_out=l,t.next_in=s,t.avail_in=o,r.hold=c,r.bits=u,VD(t,d),a=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,c=r.hold,u=r.bits,r.mode===Kn&&(r.back=-1);break}for(r.back=0;v=r.lencode[c&(1<>>24,_=v>>>16&255,C=v&65535,!(b<=u);){if(o===0)break e;o--,c+=i[s++]<>x)],b=v>>>24,_=v>>>16&255,C=v&65535,!(x+b<=u);){if(o===0)break e;o--,c+=i[s++]<>>=x,u-=x,r.back+=x}if(c>>>=b,u-=b,r.back+=b,r.length=C,_===0){r.mode=W1;break}if(_&32){r.back=-1,r.mode=Kn;break}if(_&64){t.msg="invalid literal/length code",r.mode=lt;break}r.extra=_&15,r.mode=G1;case G1:if(r.extra){for(T=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=j1;case j1:for(;v=r.distcode[c&(1<>>24,_=v>>>16&255,C=v&65535,!(b<=u);){if(o===0)break e;o--,c+=i[s++]<>x)],b=v>>>24,_=v>>>16&255,C=v&65535,!(x+b<=u);){if(o===0)break e;o--,c+=i[s++]<>>=x,u-=x,r.back+=x}if(c>>>=b,u-=b,r.back+=b,_&64){t.msg="invalid distance code",r.mode=lt;break}r.offset=C,r.extra=_&15,r.mode=V1;case V1:if(r.extra){for(T=r.extra;u>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=lt;break}r.mode=z1;case z1:if(l===0)break e;if(h=d-l,r.offset>h){if(h=r.offset-h,h>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=lt;break}h>r.wnext?(h-=r.wnext,p=r.wsize-h):p=r.wnext-h,h>r.length&&(h=r.length),g=r.window}else g=n,p=a-r.offset,h=r.length;h>l&&(h=l),l-=h,r.length-=h;do n[a++]=g[p++];while(--h);r.length===0&&(r.mode=vd);break;case W1:if(l===0)break e;n[a++]=r.length,l--,r.mode=vd;break;case _g:if(r.wrap){for(;u<32;){if(o===0)break e;o--,c|=i[s++]<{"use strict";m();oE.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 cE=H((Dz,lE)=>{"use strict";m();function lO(){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}lE.exports=lO});var fE=H(Gc=>{"use strict";m();var Wo=aE(),Uc=qn(),bd=fg(),xt=Cg(),Ag=ad(),cO=dg(),uO=cE(),uE=Object.prototype.toString;function _a(t){if(!(this instanceof _a))return new _a(t);this.options=Uc.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)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new cO,this.strm.avail_out=0;var r=Wo.inflateInit2(this.strm,e.windowBits);if(r!==xt.Z_OK)throw new Error(Ag[r]);if(this.header=new uO,Wo.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=bd.string2buf(e.dictionary):uE.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=Wo.inflateSetDictionary(this.strm,e.dictionary),r!==xt.Z_OK)))throw new Error(Ag[r])}_a.prototype.push=function(t,e){var r=this.strm,i=this.options.chunkSize,n=this.options.dictionary,s,a,o,l,c,u=!1;if(this.ended)return!1;a=e===~~e?e:e===!0?xt.Z_FINISH:xt.Z_NO_FLUSH,typeof t=="string"?r.input=bd.binstring2buf(t):uE.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Uc.Buf8(i),r.next_out=0,r.avail_out=i),s=Wo.inflate(r,xt.Z_NO_FLUSH),s===xt.Z_NEED_DICT&&n&&(s=Wo.inflateSetDictionary(this.strm,n)),s===xt.Z_BUF_ERROR&&u===!0&&(s=xt.Z_OK,u=!1),s!==xt.Z_STREAM_END&&s!==xt.Z_OK)return this.onEnd(s),this.ended=!0,!1;r.next_out&&(r.avail_out===0||s===xt.Z_STREAM_END||r.avail_in===0&&(a===xt.Z_FINISH||a===xt.Z_SYNC_FLUSH))&&(this.options.to==="string"?(o=bd.utf8border(r.output,r.next_out),l=r.next_out-o,c=bd.buf2string(r.output,o),r.next_out=l,r.avail_out=i-l,l&&Uc.arraySet(r.output,r.output,o,l,0),this.onData(c)):this.onData(Uc.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(u=!0)}while((r.avail_in>0||r.avail_out===0)&&s!==xt.Z_STREAM_END);return s===xt.Z_STREAM_END&&(a=xt.Z_FINISH),a===xt.Z_FINISH?(s=Wo.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===xt.Z_OK):(a===xt.Z_SYNC_FLUSH&&(this.onEnd(xt.Z_OK),r.avail_out=0),!0)};_a.prototype.onData=function(t){this.chunks.push(t)};_a.prototype.onEnd=function(t){t===xt.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Uc.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Tg(t,e){var r=new _a(e);if(r.push(t,!0),r.err)throw r.msg||Ag[r.err];return r.result}function fO(t,e){return e=e||{},e.raw=!0,Tg(t,e)}Gc.Inflate=_a;Gc.inflate=Tg;Gc.inflateRaw=fO;Gc.ungzip=Tg});var pE=H((Bz,hE)=>{"use strict";m();var dO=qn().assign,hO=g1(),pO=fE(),mO=Cg(),dE={};dO(dE,hO,pO,mO);hE.exports=dE});var vE=H((Uz,gE)=>{"use strict";m();var mE=(t,e)=>function(...r){let i=e.promiseModule;return new i((n,s)=>{e.multiArgs?r.push((...a)=>{e.errorFirst?a[0]?s(a):(a.shift(),n(a)):n(a)}):e.errorFirst?r.push((a,o)=>{a?s(a):n(o)}):r.push(n),t.apply(this,r)})};gE.exports=(t,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);let r=typeof t;if(!(t!==null&&(r==="object"||r==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${t===null?"null":r}\``);let i=s=>{let a=o=>typeof o=="string"?s===o:o.test(s);return e.include?e.include.some(a):!e.exclude.some(a)},n;r==="function"?n=function(...s){return e.excludeMain?t(...s):mE(t,e).apply(this,s)}:n=Object.create(Object.getPrototypeOf(t));for(let s in t){let a=t[s];n[s]=typeof a=="function"&&i(s)?mE(a,e):a}return n}});var CE=H((jz,kE)=>{m();function wE(t){return Array.isArray(t)?t:[t]}var $g="",bE=" ",Pg="\\",gO=/^\s+$/,vO=/(?:[^\\]|^)\\$/,wO=/^\\!/,bO=/^\\#/,_O=/\r?\n/g,yO=/^\.*\/|^\.+$/,Rg="/",xE="node-ignore";typeof Symbol!="undefined"&&(xE=Symbol.for("node-ignore"));var _E=xE,xO=(t,e,r)=>Object.defineProperty(t,e,{value:r}),EO=/([0-z])-([0-z])/g,EE=()=>!1,SO=t=>t.replace(EO,(e,r,i)=>r.charCodeAt(0)<=i.charCodeAt(0)?e:$g),kO=t=>{let{length:e}=t;return t.slice(0,e-e%2)},CO=[[/^\uFEFF/,()=>$g],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?bE:$g)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+bE}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6{let i=r.replace(/\\\*/g,"[^\\/]*");return e+i}],[/\\\\\\(?=[$.|*+(){^])/g,()=>Pg],[/\\\\/g,()=>Pg],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,i,n)=>e===Pg?`\\[${r}${kO(i)}${n}`:n==="]"&&i.length%2===0?`[${SO(r)}${i}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(t,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],yE=Object.create(null),AO=(t,e)=>{let r=yE[t];return r||(r=CO.reduce((i,[n,s])=>i.replace(n,s.bind(t)),t),yE[t]=r),e?new RegExp(r,"i"):new RegExp(r)},Mg=t=>typeof t=="string",TO=t=>t&&Mg(t)&&!gO.test(t)&&!vO.test(t)&&t.indexOf("#")!==0,PO=t=>t.split(_O),Fg=class{constructor(e,r,i,n){this.origin=e,this.pattern=r,this.negative=i,this.regex=n}},RO=(t,e)=>{let r=t,i=!1;t.indexOf("!")===0&&(i=!0,t=t.substr(1)),t=t.replace(wO,"!").replace(bO,"#");let n=AO(t,e);return new Fg(r,t,i,n)},$O=(t,e)=>{throw new e(t)},Xn=(t,e,r)=>Mg(t)?t?Xn.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),SE=t=>yO.test(t);Xn.isNotRelative=SE;Xn.convert=t=>t;var Ig=class{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:i=!1}={}){xO(this,_E,!0),this._rules=[],this._ignoreCase=r,this._allowRelativePaths=i,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[_E]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(TO(e)){let r=RO(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,wE(Mg(e)?PO(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,r){let i=!1,n=!1;return this._rules.forEach(s=>{let{negative:a}=s;if(n===a&&i!==n||a&&!i&&!n&&!r)return;s.regex.test(e)&&(i=!a,n=a)}),{ignored:i,unignored:n}}_test(e,r,i,n){let s=e&&Xn.convert(e);return Xn(s,e,this._allowRelativePaths?EE:$O),this._t(s,r,i,n)}_t(e,r,i,n){if(e in r)return r[e];if(n||(n=e.split(Rg)),n.pop(),!n.length)return r[e]=this._testOne(e,i);let s=this._t(n.join(Rg)+Rg,r,i,n);return r[e]=s.ignored?s:this._testOne(e,i)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return wE(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},_d=t=>new Ig(t),FO=t=>Xn(t&&Xn.convert(t),t,EE);_d.isPathValid=FO;_d.default=_d;kE.exports=_d;if(typeof process!="undefined"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let t=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");Xn.convert=t;let e=/^[a-z]:\//i;Xn.isNotRelative=r=>e.test(r)||SE(r)}});var TE=H((zz,AE)=>{"use strict";m();function IO(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _n(t,e,r){return e=e instanceof RegExp?e:new RegExp(IO(e),"g"),t.replace(e,r)}var MO={clean:function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=_n(e,"./","/"),e=_n(e,"..","."),e=_n(e," ","-"),e=_n(e,/^[~^:?*\\\-]/g,""),e=_n(e,/[~^:?*\\]/g,"-"),e=_n(e,/[~^:?*\\\-]$/g,""),e=_n(e,"@{","-"),e=_n(e,/\.$/g,""),e=_n(e,/\/$/g,""),e=_n(e,/\.lock$/g,""),e}};AE.exports=MO});var RE=H((qz,PE)=>{m();PE.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,a=!1,o=null,l=n+1,c=[],u=[],f=[],d="",h=-1,p=0,g=1,v,b,_=function(){n>=s&&(v=r,b=n,r=i,i=v,n=s,s=b,a=!0,l=n+1)},C=function(w,S,y){return{x:w,y:S,k:y}},x=function(w,S){return{elem:w,t:S}},E=function(w,S,y){var P,T,I;for(S>y?P=c[w-1+l]:P=c[w+1+l],I=Math.max(S,y),T=I-w;T=0;--I)for(;PT-P?(a?f[f.length]=new x(i[T],h):f[f.length]=new x(i[T],g),++y,++T):w[I].y-w[I].x=w+1;--B)y[B+l]=E(B,y[B-1+l]+1,y[B+1+l]);y[w+l]=E(w,y[w-1+l]+1,y[w+1+l])}while(y[w+l]!==s);for(o=w+2*P,T=c[w+l],I=[];T!==-1;)I[I.length]=new C(u[T].x,u[T].y,null),T=u[T].k;A(I)}}}});var IE=H((Zz,FE)=>{m();var DO=RE();function OO(t,e){var r=new DO(t,e);r.compose();for(var i=r.getses(),n,s,a=t.length-1,o=e.length-1,l=i.length-1;l>=0;--l)i[l].t===r.SES_COMMON?(s?(s.chain={file1index:a,file2index:o,chain:null},s=s.chain):(n={file1index:a,file2index:o,chain:null},s=n),a--,o--):i[l].t===r.SES_DELETE?a--:i[l].t===r.SES_ADD&&o--;var c={file1index:-1,file2index:-1,chain:null};return s?(s.chain=c,n):c}function $E(t,e){for(var r=[],i=t.length,n=e.length,s=OO(t,e);s!==null;s=s.chain){var a=i-s.file1index-1,o=n-s.file2index-1;i=s.file1index,n=s.file2index,(a||o)&&r.push({file1:[i+1,a],file2:[n+1,o]})}return r.reverse(),r}function LO(t,e,r){var i,n=$E(e,t),s=$E(e,r),a=[];function o(M,B){a.push([M.file1[0],B,M.file1[1],M.file2[0],M.file2[1]])}for(i=0;ic&&(l.push([1,c,M-c]),c=M)}for(var f=0;fg)break;g=Math.max(g,b+v[2]),f++}if(u(p),d==f)h[4]>0&&l.push([h[1],h[3],h[4]]);else{var _={0:[t.length,-1,e.length,-1],2:[r.length,-1,e.length,-1]};for(i=d;i<=f;i++){h=a[i];var C=h[1],x=_[C],E=h[0],A=E+h[2],w=h[3],S=w+h[4];x[0]=Math.min(w,x[0]),x[1]=Math.max(S,x[1]),x[2]=Math.min(E,x[2]),x[3]=Math.max(A,x[3])}var y=_[0][0]+(p-_[0][2]),P=_[0][1]+(g-_[0][3]),T=_[2][0]+(p-_[2][2]),I=_[2][1]+(g-_[2][3]);l.push([-1,y,P-y,p,g-p,T,I-T])}c=g}return u(e.length),l}function NO(t,e,r){var i=[],n=[t,e,r],s=LO(t,e,r),a=[];function o(){a.length&&i.push({ok:a}),a=[]}function l(h){for(var p=0;p{"use strict";m();JS.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 rk=H((A9,tk)=>{m();var gv={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}};tk.exports=function(t,e,r,i){if(!gv.hasOwnProperty(r))throw new Error("Cannot convert to "+r);if(!gv[r].hasOwnProperty(e))throw new Error("Cannot convert from "+e+" to "+r);var n=gv[r][e]*t;return i!==!1?(i=Math.pow(10,parseInt(i)||5),Math.round(n*i)/i):n}});var gk=H(es=>{"use strict";m();Object.defineProperty(es,"__esModule",{value:!0});es.fromRgba=cl;es.fromRgb=vv;es.fromHsla=Vd;es.fromHsl=pk;es.fromString=mk;es.default=void 0;var ik=ak(ek()),a3=ak(rk());function ak(t){return t&&t.__esModule?t:{default:t}}function o3(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nk(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,i=new Array(e);r-1}function h3(t,e,r){var i=t/255,n=e/255,s=r/255,a=Math.max(i,n,s),o=Math.min(i,n,s),l=a-o,c=(a+o)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=(function(){switch(a){case i:return(n-s)/l%6;case n:return(s-i)/l+2;default:return(i-n)/l+4}})();return[f*60,u*100,c*100]}function p3(t,e,r){var i=t/60,n=e/100,s=r/100,a=(1-Math.abs(2*s-1))*n,o=a*(1-Math.abs(i%2-1)),l=s-a/2,c=(function(){return i<1?[a,o,0]:i<2?[o,a,0]:i<3?[0,a,o]:i<4?[0,o,a]:i<5?[o,0,a]:[a,0,o]})(),u=Er(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var m3=(function(){function t(e){var r=Er(e,4),i=r[0],n=r[1],s=r[2],a=r[3];o3(this,t),this.values=[Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(n,10),255),0),Math.max(Math.min(parseInt(s,10),255),0),a==null?1:Math.max(Math.min(parseFloat(a),255),0)]}return l3(t,[{key:"toRgbString",value:function(){var r=Er(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return a===1?"rgb(".concat(i,", ").concat(n,", ").concat(s,")"):"rgba(".concat(i,", ").concat(n,", ").concat(s,", ").concat(a,")")}},{key:"toHslString",value:function(){var r=this.toHslaArray(),i=Er(r,4),n=i[0],s=i[1],a=i[2],o=i[3];return o===1?"hsl(".concat(n,", ").concat(s,"%, ").concat(a,"%)"):"hsla(".concat(n,", ").concat(s,"%, ").concat(a,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var r=Er(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3];return i=Number(i).toString(16).padStart(2,"0"),n=Number(n).toString(16).padStart(2,"0"),s=Number(s).toString(16).padStart(2,"0"),a=a<1?parseInt(a*255,10).toString(16).padStart(2,"0"):"","#".concat(i).concat(n).concat(s).concat(a)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var r=Er(this.values,4),i=r[0],n=r[1],s=r[2],a=r[3],o=h3(i,n,s),l=Er(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,a]}}]),t})();function cl(t){var e=Er(t,4),r=e[0],i=e[1],n=e[2],s=e[3];return new m3([r,i,n,s])}function vv(t){var e=Er(t,3),r=e[0],i=e[1],n=e[2];return cl([r,i,n,1])}function Vd(t){var e=Er(t,4),r=e[0],i=e[1],n=e[2],s=e[3],a=p3(r,i,n),o=Er(a,3),l=o[0],c=o[1],u=o[2];return cl([l,c,u,s])}function pk(t){var e=Er(t,3),r=e[0],i=e[1],n=e[2];return Vd([r,i,n,1])}function g3(t){var e=ok.exec(t)||lk.exec(t),r=Er(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=parseInt(i.length<2?i.repeat(2):i,16),n=parseInt(n.length<2?n.repeat(2):n,16),s=parseInt(s.length<2?s.repeat(2):s,16),a=a&&(parseInt(a.length<2?a.repeat(2):a,16)/255).toPrecision(1)||1,cl([i,n,s,a])}function v3(t){var e=ck.exec(t)||fk.exec(t)||uk.exec(t)||dk.exec(t),r=Er(e,5),i=r[1],n=r[2],s=r[3],a=r[4];return i=yu(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),n=yu(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),s=yu(s,"%")>0?parseInt(s,10)*255/100:parseInt(s,10),a=a===void 0?1:parseFloat(a)/(yu(a,"%")?100:1),cl([i,n,s,a])}function w3(t){var e=hk.exec(t),r=Er(e,6),i=r[1],n=r[2],s=r[3],a=r[4],o=r[5];return n=n||"deg",i=(0,a3.default)(parseFloat(i),n,"deg"),s=parseFloat(s),a=parseFloat(a),o=o===void 0?1:parseFloat(o)/(yu(o,"%")?100:1),Vd([i,s,a,o])}function mk(t){return ik.default[t]?vv(ik.default[t]):ok.test(t)||lk.test(t)?g3(t):ck.test(t)||fk.test(t)||uk.test(t)||dk.test(t)?v3(t):hk.test(t)?w3(t):null}var b3={fromString:mk,fromRgb:vv,fromRgba:cl,fromHsl:pk,fromHsla:Vd};es.default=b3});var Tk=H((B9,Ak)=>{m();Ak.exports=function(t,e){var r=t,i=e,n=r.length,s=i.length,a=!1,o=n+1,l=[],c=[],u,f,d=function(){n>=s&&(u=r,f=n,r=i,i=u,n=s,s=f,a=!0,o=n+1)},h=function(g,v,b,_,C){return{startX:g,startY:v,endX:b,endY:_,r:C}},p=function(g,v,b){var _,C,x,E,A;for(v>b?_=l[g-1+o]:_=l[g+1+o],A=x=Math.max(v,b),E=C=x-g;C=g+1;--E)b[E+o]=p(E,b[E-1+o]+1,b[E+1+o]);b[g+o]=p(g,b[g-1+o]+1,b[g+1+o])}while(b[g+o]!==s);for(ed=g+2*_,C=l[g+o],A=n,w=s,S=[];C!==-1;){let y=c[C];(n!=y.endX||s!=y.endY)&&S.push({file1:[a?y.endY:y.endX,a?w-y.endY:A-y.endX],file2:[a?y.endX:y.endY,a?A-y.endX:w-y.endY]}),A=y.startX,w=y.startY,C=c[C].r}return(A!=0||w!=0)&&S.push({file1:[0,a?w:A],file2:[0,a?A:w]}),S.reverse(),S}}}});var $k=H((U9,Rk)=>{m();var Pk=Tk();function x3(t,e,r){var i,n=new Pk(e,t).compose(),s=new Pk(e,r).compose(),a=[];function o(M,B){a.push([M.file1[0],B,M.file1[1],M.file2[0],M.file2[1]])}for(i=0;ic&&(l.push([1,c,M-c]),c=M)}for(var f=0;fg)break;g=Math.max(g,b+v[2]),f++}if(u(p),d==f)h[4]>0&&l.push([h[1],h[3],h[4]]);else{var _={0:[t.length,-1,e.length,-1],2:[r.length,-1,e.length,-1]};for(i=d;i<=f;i++){h=a[i];var C=h[1],x=_[C],E=h[0],A=E+h[2],w=h[3],S=w+h[4];x[0]=Math.min(w,x[0]),x[1]=Math.max(S,x[1]),x[2]=Math.min(E,x[2]),x[3]=Math.max(A,x[3])}var y=_[0][0]+(p-_[0][2]),P=_[0][1]+(g-_[0][3]),T=_[2][0]+(p-_[2][2]),I=_[2][1]+(g-_[2][3]);l.push([-1,y,P-y,p,g-p,T,I-T])}c=g}return u(e.length),l}function E3(t,e,r){var i=[],n=[t,e,r],s=x3(t,e,r),a=[];function o(){a.length&&i.push({ok:a}),a=[]}function l(h){for(var p=0;p{m();var pl=1e3,ml=pl*60,gl=ml*60,Fa=gl*24,A3=Fa*7,T3=Fa*365.25;Ik.exports=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return P3(t);if(r==="number"&&isFinite(t))return e.long?$3(t):R3(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function P3(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 r=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return r*T3;case"weeks":case"week":case"w":return r*A3;case"days":case"day":case"d":return r*Fa;case"hours":case"hour":case"hrs":case"hr":case"h":return r*gl;case"minutes":case"minute":case"mins":case"min":case"m":return r*ml;case"seconds":case"second":case"secs":case"sec":case"s":return r*pl;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function R3(t){var e=Math.abs(t);return e>=Fa?Math.round(t/Fa)+"d":e>=gl?Math.round(t/gl)+"h":e>=ml?Math.round(t/ml)+"m":e>=pl?Math.round(t/pl)+"s":t+"ms"}function $3(t){var e=Math.abs(t);return e>=Fa?Kd(t,e,Fa,"day"):e>=gl?Kd(t,e,gl,"hour"):e>=ml?Kd(t,e,ml,"minute"):e>=pl?Kd(t,e,pl,"second"):t+" ms"}function Kd(t,e,r,i){var n=e>=r*1.5;return Math.round(t/r)+" "+i+(n?"s":"")}});var Ok=H((eW,Dk)=>{m();function F3(t){r.debug=r,r.default=r,r.coerce=l,r.disable=a,r.enable=n,r.enabled=o,r.humanize=Mk(),r.destroy=c,Object.keys(t).forEach(u=>{r[u]=t[u]}),r.names=[],r.skips=[],r.formatters={};function e(u){let f=0;for(let d=0;d{if(A==="%%")return"%";x++;let S=r.formatters[w];if(typeof S=="function"){let y=v[x];A=S.call(b,y),v.splice(x,1),x--}return A}),r.formatArgs.call(b,v),(b.log||r.log).apply(b,v)}return g.namespace=u,g.useColors=r.useColors(),g.color=r.selectColor(u),g.extend=i,g.destroy=r.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(h!==r.namespaces&&(h=r.namespaces,p=r.enabled(u)),p),set:v=>{d=v}}),typeof r.init=="function"&&r.init(g),g}function i(u,f){let d=r(this.namespace+(typeof f=="undefined"?":":f)+u);return d.log=this.log,d}function n(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];let f=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of f)d[0]==="-"?r.skips.push(d.slice(1)):r.names.push(d)}function s(u,f){let d=0,h=0,p=-1,g=0;for(;d"-"+f)].join(",");return r.enable(""),u}function o(u){for(let f of r.skips)if(s(u,f))return!1;for(let f of r.names)if(s(u,f))return!0;return!1}function l(u){return u instanceof Error?u.stack||u.message:u}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}Dk.exports=F3});var Qd=H((Ur,Xd)=>{m();Ur.formatArgs=M3;Ur.save=D3;Ur.load=O3;Ur.useColors=I3;Ur.storage=L3();Ur.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`."))}})();Ur.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 I3(){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 M3(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+Xd.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;t.splice(1,0,e,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(r++,n==="%c"&&(i=r))}),t.splice(i,0,e)}Ur.log=console.debug||console.log||(()=>{});function D3(t){try{t?Ur.storage.setItem("debug",t):Ur.storage.removeItem("debug")}catch(e){}}function O3(){let t;try{t=Ur.storage.getItem("debug")||Ur.storage.getItem("DEBUG")}catch(e){}return!t&&typeof process!="undefined"&&"env"in process&&(t=process.env.DEBUG),t}function L3(){try{return localStorage}catch(t){}}Xd.exports=Ok()(Ur);var{formatters:N3}=Xd.exports;N3.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Lk=H(si=>{"use strict";m();var B3=si&&si.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(si,"__esModule",{value:!0});var H3=require("fs"),U3=B3(Qd()),vl=U3.default("@kwsites/file-exists");function G3(t,e,r){vl("checking %s",t);try{let i=H3.statSync(t);return i.isFile()&&e?(vl("[OK] path represents a file"),!0):i.isDirectory()&&r?(vl("[OK] path represents a directory"),!0):(vl("[FAIL] path represents something other than a file or directory"),!1)}catch(i){if(i.code==="ENOENT")return vl("[FAIL] path is not accessible: %o",i),!1;throw vl("[FATAL] %o",i),i}}function j3(t,e=si.READABLE){return G3(t,(e&si.FILE)>0,(e&si.FOLDER)>0)}si.exists=j3;si.FILE=1;si.FOLDER=2;si.READABLE=si.FILE+si.FOLDER});var Nk=H(Jd=>{"use strict";m();function V3(t){for(var e in t)Jd.hasOwnProperty(e)||(Jd[e]=t[e])}Object.defineProperty(Jd,"__esModule",{value:!0});V3(Lk())});var kv=H(Ia=>{"use strict";m();Object.defineProperty(Ia,"__esModule",{value:!0});Ia.createDeferred=Ia.deferred=void 0;function Sv(){let t,e,r="pending";return{promise:new Promise((n,s)=>{t=n,e=s}),done(n){r==="pending"&&(r="resolved",t(n))},fail(n){r==="pending"&&(r="rejected",e(n))},get fulfilled(){return r!=="pending"},get status(){return r}}}Ia.deferred=Sv;Ia.createDeferred=Sv;Ia.default=Sv});var uP=H(r0=>{m();(function(t){var e=/\S/,r=/\"/g,i=/\n/g,n=/\r/g,s=/\\/g,a=/\u2028/,o=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(S,y){var P=S.length,T=0,I=1,M=2,B=T,re=null,Ae=null,K="",Q=[],fe=!1,ce=0,z=0,X="{{",j="}}";function Ze(){K.length>0&&(Q.push({tag:"_t",text:new String(K)}),K="")}function $r(){for(var yt=!0,Tt=z;Tt"&&(J.indent=Q[Ke].text.toString()),Q.splice(Ke,1));else Tt||Q.push({tag:` `});fe=!1,z=Q.length}function Ie(yt,Tt){var Ke="="+j,J=yt.indexOf(Ke,Tt),L=c(yt.substring(yt.indexOf("=",Tt)+1,J)).split(" ");return X=L[0],j=L[L.length-1],J+Ke.length-1}for(y&&(y=y.split(" "),X=y[0],j=y[1]),ce=0;ce0;){if(B=w.shift(),M&&M.tag=="<"&&!(B.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[B.tag]<=t.tags.$||h(B,P))y.push(B),B.nodes=d(w,B.tag,y,P);else if(B.tag=="/"){if(y.length===0)throw new Error("Closing tag without opener: /"+B.n);if(I=y.pop(),B.n!=I.n&&!p(B.n,I.n,P))throw new Error("Nesting error: "+I.n+" vs. "+B.n);return I.end=B.i,T}else B.tag==` `&&(B.last=w.length==0||w[0].tag==` `);T.push(B)}if(y.length>0)throw new Error("missing closing tag: "+y.pop().n);return T}function h(w,S){for(var y=0,P=S.length;y":x,"<":function(w,S){var y={partials:{},code:"",subs:{},inPartial:!0};t.walk(w.nodes,y);var P=S.partials[x(w,S)];P.subs=y.subs,P.partials=y.partials},$:function(w,S){var y={subs:{},code:"",partials:S.partials,prefix:w.n};t.walk(w.nodes,y),S.subs[w.n]=y.code,S.inPartial||(S.code+='t.sub("'+_(w.n)+'",c,p,i);')},"\n":function(w,S){S.code+=A('"\\n"'+(w.last?"":" + i"))},_v:function(w,S){S.code+="t.b(t.v(t."+C(w.n)+'("'+_(w.n)+'",c,p,0)));'},_t:function(w,S){S.code+=A('"'+_(w.text)+'"')},"{":E,"&":E};function E(w,S){S.code+="t.b(t.t(t."+C(w.n)+'("'+_(w.n)+'",c,p,0)));'}function A(w){return"t.b("+w+");"}t.walk=function(w,S){for(var y,P=0,T=w.length;P{m();var B4={};(function(t){t.Template=function(d,h,p,g){d=d||{},this.r=d.code||this.r,this.c=p,this.options=g||{},this.text=h||"",this.partials=d.partials||{},this.subs=d.subs||{},this.buf=""},t.Template.prototype={r:function(d,h,p){return""},v:u,t:c,render:function(h,p,g){return this.ri([h],p||{},g)},ri:function(d,h,p){return this.r(d,h,p)},ep:function(d,h){var p=this.partials[d],g=h[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[d].base=g,p.subs){h.stackText||(h.stackText={});for(key in p.subs)h.stackText[key]||(h.stackText[key]=this.activeSub!==void 0&&h.stackText[this.activeSub]?h.stackText[this.activeSub]:this.text);g=r(g,p.subs,p.partials,this.stackSubs,this.stackPartials,h.stackText)}return this.partials[d].instance=g,g},rp:function(d,h,p,g){var v=this.ep(d,p);return v?v.ri(h,p,g):""},rs:function(d,h,p){var g=d[d.length-1];if(!f(g)){p(d,h,this);return}for(var v=0;v=0;x--)if(b=h[x],v=e(d,b,C),v!==void 0){_=!0;break}return _?(!g&&typeof v=="function"&&(v=this.mv(v,h,p)),v):g?!1:""},ls:function(d,h,p,g,v,b){var _=this.options.delimiters;return this.options.delimiters=b,this.b(this.ct(c(d.call(h,v,p)),h,g)),this.options.delimiters=_,!1},ct:function(d,h,p){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(d,this.options).render(h,p)},b:function(d){this.buf+=d},fl:function(){var d=this.buf;return this.buf="",d},ms:function(d,h,p,g,v,b,_){var C,x=h[h.length-1],E=d.call(x);return typeof E=="function"?g?!0:(C=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(E,x,h,p,C.substring(v,b),_)):E},mv:function(d,h,p){var g=h[h.length-1],v=d.call(g);return typeof v=="function"?this.ct(c(v.call(g)),g,p):v},sub:function(d,h,p,g){var v=this.subs[d];v&&(this.activeSub=d,v(h,p,this,g),this.activeSub=!1)}};function e(d,h,p){var g;return h&&typeof h=="object"&&(h[d]!==void 0?g=h[d]:p&&h.get&&typeof h.get=="function"&&(g=h.get(d))),g}function r(d,h,p,g,v,b){function _(){}_.prototype=d;function C(){}C.prototype=d.subs;var x,E=new _;E.subs=new C,E.subsText={},E.buf="",g=g||{},E.stackSubs=g,E.subsText=b;for(x in h)g[x]||(g[x]=h[x]);for(x in g)E.subs[x]=g[x];v=v||{},E.stackPartials=v;for(x in p)v[x]||(v[x]=p[x]);for(x in v)E.partials[x]=v[x];return E}var i=/&/g,n=//g,a=/\'/g,o=/\"/g,l=/[&<>\"\']/;function c(d){return String(d==null?"":d)}function u(d){return d=c(d),l.test(d)?d.replace(i,"&").replace(n,"<").replace(s,">").replace(a,"'").replace(o,"""):d}var f=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"}})(typeof i0!="undefined"?i0:B4)});var n0=H((zY,dP)=>{m();var Qh=uP();Qh.Template=fP().Template;Qh.template=Qh.Template;dP.exports=Qh});var mP=H($i=>{"use strict";m();Object.defineProperty($i,"__esModule",{value:!0});$i.ColorSchemeType=$i.DiffStyleType=$i.LineMatchingType=$i.OutputFormatType=$i.LineType=void 0;var hP;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(hP||($i.LineType=hP={}));$i.OutputFormatType={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"};$i.LineMatchingType={LINES:"lines",WORDS:"words",NONE:"none"};$i.DiffStyleType={WORD:"word",CHAR:"char"};var pP;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(pP||($i.ColorSchemeType=pP={}))});var YG={};K$(YG,{default:()=>sm});module.exports=X$(YG);m();m();var Yo=mt(f_(),1),sv=mt(kx(),1),iS=mt(Ax(),1),Md=mt(pE(),1),Vc=mt(vE(),1),nS=mt(CE(),1),Zo=mt(TE(),1),sS=mt(IE(),1),Pe=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 r=new t(e.message);return r.code=e.code,r.data=e.data,r.caller=e.caller,r.stack=e.stack,r}get isIsomorphicGitError(){return!0}},zc=class t extends Pe{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}}};zc.code="UnmergedPathsError";var he=class t extends Pe{constructor(e){super(`An internal error caused this command to fail. If you're using an application that depends on isomorphic-git, please report this error to that application's developers. If you're a developer and you believe this is a bug in isomorphic-git, please file an issue at https://github.com/isomorphic-git/isomorphic-git/issues with a minimal reproduction, version and environment details, and this error message: ${e}`),this.code=this.name=t.code,this.data={message:e}}};he.code="InternalError";var Ea=class t extends Pe{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=t.code,this.data={filepath:e}}};Ea.code="UnsafeFilepathError";var zi=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 r=this.buffer.slice(this._start,this._start+e);return this._start+=e,r}toString(e,r){let i=this.buffer.toString(e,this._start,this._start+r);return this._start+=r,i}write(e,r,i){let n=this.buffer.write(e,this._start,r,i);return this._start+=r,n}copy(e,r,i){let n=e.copy(this.buffer,this._start,r,i);return this._start+=n,n}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let r=this.buffer.writeUInt8(e,this._start);return this._start+=1,r}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let r=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,r}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let r=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,r}};function Dd(t,e){return-(te)}function aS(t,e){return Dd(t.path,e.path)}function oS(t){let e=t>0?t>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let r=t&511;return r&73?r=493:r=420,e!==8&&(r=0),(e<<12)+r}var yn=2**32;function ME(t,e,r,i){if(t!==void 0&&e!==void 0)return[t,e];r===void 0&&(r=i.valueOf());let n=Math.floor(r/1e3),s=(r-n*1e3)*1e6;return[n,s]}function Ko(t){let[e,r]=ME(t.ctimeSeconds,t.ctimeNanoseconds,t.ctimeMs,t.ctime),[i,n]=ME(t.mtimeSeconds,t.mtimeNanoseconds,t.mtimeMs,t.mtime);return{ctimeSeconds:e%yn,ctimeNanoseconds:r%yn,mtimeSeconds:i%yn,mtimeNanoseconds:n%yn,dev:t.dev%yn,ino:t.ino%yn,mode:oS(t.mode%yn),uid:t.uid%yn,gid:t.gid%yn,size:t.size>-1?t.size%yn:0}}function BO(t){let e="";for(let r of new Uint8Array(t))r<16&&(e+="0"),e+=r.toString(16);return e}var Dg=null;async function En(t){return Dg===null&&(Dg=await UO()),Dg?lS(t):HO(t)}function HO(t){return new sv.default().update(t).digest("hex")}async function lS(t){let e=await crypto.subtle.digest("SHA-1",t);return BO(e)}async function UO(){try{return await lS(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(t){}return!1}function GO(t){return{assumeValid:!!(t&32768),extended:!!(t&16384),stage:(t&12288)>>12,nameLength:t&4095}}function jO(t){let e=t.flags;return e.extended=!1,e.nameLength=Math.min(k.from(t.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}var qg=class t{constructor(e,r){this._dirty=!1,this._unmergedPaths=r||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let r=this._entries.get(e.path);r||(this._entries.set(e.path,e),r=e),r.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(k.isBuffer(e))return t.fromBuffer(e);if(e===null)return new t(null);throw new he("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new he("Index file is empty (.git/index)");let r=new t,i=new zi(e),n=i.toString("utf8",4);if(n!=="DIRC")throw new he(`Invalid dircache magic file number: ${n}`);let s=await En(e.slice(0,-20)),a=e.slice(-20).toString("hex");if(a!==s)throw new he(`Invalid checksum in GitIndex buffer: expected ${a} but saw ${s}`);let o=i.readUInt32BE();if(o!==2)throw new he(`Unsupported dircache version: ${o}`);let l=i.readUInt32BE(),c=0;for(;!i.eof()&&ce.stages.length>1?e.stages.filter(r=>r):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:r,oid:i,stage:n=0}){r||(r={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),r=Ko(r);let s=k.from(e),a={ctimeSeconds:r.ctimeSeconds,ctimeNanoseconds:r.ctimeNanoseconds,mtimeSeconds:r.mtimeSeconds,mtimeNanoseconds:r.mtimeNanoseconds,dev:r.dev,ino:r.ino,mode:r.mode||33188,uid:r.uid,gid:r.gid,size:r.size,path:e,oid:i,flags:{assumeValid:!1,extended:!1,stage:n,nameLength:s.length<4095?s.length:4095},stages:[]};this._addEntry(a),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let r of this._entries.keys())r.startsWith(e+"/")&&this._entries.delete(r);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(` `)}static async _entryToBuffer(e){let r=k.from(e.path),i=Math.ceil((62+r.length+1)/8)*8,n=k.alloc(i),s=new zi(n),a=Ko(e);return s.writeUInt32BE(a.ctimeSeconds),s.writeUInt32BE(a.ctimeNanoseconds),s.writeUInt32BE(a.mtimeSeconds),s.writeUInt32BE(a.mtimeNanoseconds),s.writeUInt32BE(a.dev),s.writeUInt32BE(a.ino),s.writeUInt32BE(a.mode),s.writeUInt32BE(a.uid),s.writeUInt32BE(a.gid),s.writeUInt32BE(a.size),s.write(e.oid,20,"hex"),s.writeUInt16BE(jO(e)),s.write(e.path,r.length,"utf8"),n}async toObject(){let e=k.alloc(12),r=new zi(e);r.write("DIRC",4,"utf8"),r.writeUInt32BE(2),r.writeUInt32BE(this.entriesFlat.length);let i=[];for(let o of this.entries)if(i.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&i.push(t._entryToBuffer(l));i=await Promise.all(i);let n=k.concat(i),s=k.concat([e,n]),a=await En(s);return k.concat([s,k.from(a,"hex")])}};function Ed(t,e,r=!0,i=!0){let n=Ko(t),s=Ko(e);return r&&n.mode!==s.mode||n.mtimeSeconds!==s.mtimeSeconds||n.ctimeSeconds!==s.ctimeSeconds||n.uid!==s.uid||n.gid!==s.gid||i&&n.ino!==s.ino||n.size!==s.size}var Og=null,Lg=Symbol("IndexCache");function VO(){return{map:new Map,stats:new Map}}async function zO(t,e,r){let[i,n]=await Promise.all([t.lstat(e),t.read(e)]),s=await qg.from(n);r.map.set(e,s),r.stats.set(e,i)}async function WO(t,e,r){let i=r.stats.get(e);if(i===void 0)return!0;if(i===null)return!1;let n=await t.lstat(e);return n===null?!1:Ed(i,n)}var gt=class{static async acquire({fs:e,gitdir:r,cache:i,allowUnmerged:n=!0},s){i[Lg]||(i[Lg]=VO());let a=`${r}/index`;Og===null&&(Og=new Yo.default({maxPending:1/0}));let o,l=[];return await Og.acquire(a,async()=>{let c=i[Lg];await WO(e,a,c)&&await zO(e,a,c);let u=c.map.get(a);if(l=u.unmergedPaths,l.length&&!n)throw new zc(l);if(o=await s(u),u._dirty){let f=await u.toObject();await e.write(a,f),c.stats.set(a,await e.lstat(a)),u._dirty=!1}}),o}};function Sd(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function Sa(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function cS(t){let e=new Map,r=function(n){if(!e.has(n)){let s={type:"tree",fullpath:n,basename:Sd(n),metadata:{},children:[]};e.set(n,s),s.parent=r(Sa(n)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(n)},i=function(n,s){if(!e.has(n)){let a={type:"blob",fullpath:n,basename:Sd(n),metadata:s,parent:r(Sa(n)),children:[]};a.parent&&a.parent.children.push(a),e.set(n,a)}return e.get(n)};r(".");for(let n of t)i(n.path,n);return e}function qO(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 he(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var Yg=class{constructor({fs:e,gitdir:r,cache:i}){this.treePromise=gt.acquire({fs:e,gitdir:r,cache:i},async function(s){return cS(s.entries)});let n=this;this.ConstructEntry=class{constructor(a){this._fullpath=a,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return n.type(this)}async mode(){return n.mode(this)}async stat(){return n.stat(this)}async content(){return n.content(this)}async oid(){return n.oid(this)}}}async readdir(e){let r=e._fullpath,n=(await this.treePromise).get(r);if(!n||n.type==="blob")return null;if(n.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${r}'`);let s=n.children.map(a=>a.fullpath);return s.sort(Dd),s}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let i=(await this.treePromise).get(e._fullpath);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let n=i.type==="tree"?{}:Ko(i.metadata);e._type=i.type==="tree"?"tree":qO(n.mode),e._mode=n.mode,i.type==="tree"?e._stat=void 0:e._stat=n}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let i=(await this.treePromise).get(e._fullpath);e._oid=i.metadata.oid}return e._oid}},Od=Symbol("GitWalkSymbol");function sl(){let t=Object.create(null);return Object.defineProperty(t,Od,{value:function({fs:e,gitdir:r,cache:i}){return new Yg({fs:e,gitdir:r,cache:i})}}),Object.freeze(t),t}var ze=class t extends Pe{constructor(e){super(`Could not find ${e}.`),this.code=this.name=t.code,this.data={what:e}}};ze.code="NotFoundError";var xr=class t extends Pe{constructor(e,r,i,n){super(`Object ${e} ${n?`at ${n}`:""}was anticipated to be a ${i} but it is a ${r}.`),this.code=this.name=t.code,this.data={oid:e,actual:r,expected:i,filepath:n}}};xr.code="ObjectTypeError";var Ms=class t extends Pe{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=t.code,this.data={value:e}}};Ms.code="InvalidOidError";var Wc=class t extends Pe{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}}};Wc.code="NoRefspecError";var kd=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let r=null;this.parsedConfig=e.trim().split(` `).map(i=>{if(/^\s*#/.test(i))return{line:i,comment:!0};let n=i.indexOf(" ");if(i.startsWith("^")){let s=i.slice(1);return this.refs.set(r+"^{}",s),{line:i,ref:r,peeled:s}}else{let s=i.slice(0,n);return r=i.slice(n+1),this.refs.set(r,s),{line:i,ref:r,oid:s}}})}return this}static from(e){return new t(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(r=>r.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(` `)+` `}},Cd=class t{constructor({remotePath:e,localPath:r,force:i,matchPrefix:n}){Object.assign(this,{remotePath:e,localPath:r,force:i,matchPrefix:n})}static from(e){let[r,i,n,s,a]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=r==="+",l=n==="*";if(l!==(a==="*"))throw new he("Invalid refspec");return new t({remotePath:i,localPath:s,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}},Zg=class t{constructor(e=[]){this.rules=e}static from(e){let r=[];for(let i of e)r.push(Cd.from(i));return new t(r)}add(e){let r=Cd.from(e);this.rules.push(r)}translate(e){let r=[];for(let i of this.rules)for(let n of e){let s=i.translate(n);s&&r.push([n,s])}return r}translateOne(e){let r=null;for(let i of this.rules){let n=i.translate(e);n&&(r=n)}return r}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function YO(t,e){let r=t.replace(/\^\{\}$/,""),i=e.replace(/\^\{\}$/,""),n=-(ri);return n===0?t.endsWith("^{}")?1:-1:n}function ZO(t,e){let r="",i=0,n=-1,s=0,a="\0";for(let o=0;o<=t.length;++o){if(o2){let l=r.lastIndexOf("/");l===-1?(r="",i=0):(r=r.slice(0,l),i=r.length-1-r.lastIndexOf("/")),n=o,s=0;continue}else if(r.length!==0){r="",i=0,n=o,s=0;continue}}e&&(r+=r.length>0?"/..":"..",i=2)}else r.length>0?r+="/"+t.slice(n+1,o):r=t.slice(n+1,o),i=o-n-1;n=o,s=0}else a==="."&&s!==-1?++s:s=-1}return r}function KO(t){return t.length>=2&&/^[a-zA-Z]:/.test(t)?t.slice(0,2):null}function XO(t){if(!t.length)return".";t=t.replace(/\\/g,"/");let e=KO(t),r=t[0]==="/"||e!==null&&t[2]==="/",i=t.at(-1)==="/",n=e?t.slice(2):t,s=ZO(n,!r);if(!s.length){let a=e?r?e+"/":e:r?"/":".";return i&&!r?a+"/":a}return i&&(s+="/"),e?r?`${e}/${s}`:`${e}${s}`:r?`/${s}`:s}function N(...t){if(t.length===0)return".";let e;for(let r=0;r{if(typeof t=="number")return t;t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},jc=t=>{if(typeof t=="boolean")return t;if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},DE={core:{filemode:jc,bare:jc,logallrefupdates:jc,symlinks:jc,ignorecase:jc,bigFileThreshold:QO}},JO=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,eL=/^[A-Za-z0-9-.]+$/,tL=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,rL=/^[A-Za-z][A-Za-z-]*$/,iL=/^(.*?)( *[#;].*)$/,nL=t=>{let e=JO.exec(t);if(e!=null){let[r,i]=e.slice(1);return[r,i]}return null},sL=t=>{let e=tL.exec(t);if(e!=null){let[r,i="true"]=e.slice(1),n=aL(i),s=oL(n);return[r,s]}return null},aL=t=>{let e=iL.exec(t);if(e==null)return t;let[r,i]=e.slice(1);return OE(r)&&OE(i)?`${r}${i}`:r},OE=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,oL=t=>t.split("").reduce((e,r,i,n)=>{let s=r==='"'&&n[i-1]!=="\\",a=r==="\\"&&n[i+1]==='"';return s||a?e:e+r},""),LE=t=>t!=null?t.toLowerCase():null,Kg=(t,e,r)=>[LE(t),e,LE(r)].filter(i=>i!=null).join("."),NE=t=>{let e=t.split("."),r=e.shift(),i=e.pop(),n=e.length?e.join("."):void 0;return{section:r,subsection:n,name:i,path:Kg(r,n,i),sectionPath:Kg(r,n,null),isSection:!!r}},lL=(t,e)=>t.reduce((r,i,n)=>e(i)?n:r,-1),Xg=class t{constructor(e){let r=null,i=null;this.parsedConfig=e?e.split(` `).map(n=>{let s=null,a=null,o=n.trim(),l=nL(o),c=l!=null;if(c)[r,i]=l;else{let f=sL(o);f!=null&&([s,a]=f)}let u=Kg(r,i,s);return{line:n,isSection:c,section:r,subsection:i,name:s,value:a,path:u}}):[]}static from(e){return new t(e)}async get(e,r=!1){let i=NE(e).path,n=this.parsedConfig.filter(s=>s.path===i).map(({section:s,name:a,value:o})=>{let l=DE[s]&&DE[s][a];return l?l(o):o});return r?n:n.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(r=>r.isSection&&r.section===e).map(r=>r.subsection)}async deleteSection(e,r){this.parsedConfig=this.parsedConfig.filter(i=>!(i.section===e&&i.subsection===r))}async append(e,r){return this.set(e,r,!0)}async set(e,r,i=!1){let{section:n,subsection:s,name:a,path:o,sectionPath:l,isSection:c}=NE(e),u=lL(this.parsedConfig,f=>f.path===o);if(r==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let f=this.parsedConfig[u],d=Object.assign({},f,{name:a,value:r,modified:!0});i?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:n,subsection:s,name:a,value:r,modified:!0,path:o};if(eL.test(n)&&rL.test(a))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:c,section:n,subsection:s,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,section:r,subsection:i,name:n,value:s,modified:a=!1})=>a?n!=null&&s!=null?typeof s=="string"&&/[#;]/.test(s)?` ${n} = "${s}"`:` ${n} = ${s}`:i!=null?`[${r} "${i}"]`:`[${r}]`:e).join(` `)}},vt=class{static async get({fs:e,gitdir:r}){let i=await e.read(`${r}/config`,{encoding:"utf8"});return Xg.from(i)}static async save({fs:e,gitdir:r,config:i}){await e.write(`${r}/config`,i.toString(),{encoding:"utf8"})}},yd=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],cL=["config","description","index","shallow","commondir"],Ng;async function Fs(t,e){return Ng===void 0&&(Ng=new Yo.default),Ng.acquire(t,e)}var q=class t{static async updateRemoteRefs({fs:e,gitdir:r,remote:i,refs:n,symrefs:s,tags:a,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let v of n.values())if(!v.match(/[0-9a-f]{40}/))throw new Ms(v);let u=await vt.get({fs:e,gitdir:r});if(!o){if(o=await u.getall(`remote.${i}.fetch`),o.length===0)throw new Wc(i);o.unshift(`+HEAD:refs/remotes/${i}/HEAD`)}let f=Zg.from(o),d=new Map;if(c){let v=await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:r,refs:v.map(b=>`refs/tags/${b}`)})}if(a){for(let v of n.keys())if(v.startsWith("refs/tags")&&!v.endsWith("^{}")&&!await t.exists({fs:e,gitdir:r,ref:v})){let b=n.get(v);d.set(v,b)}}let h=f.translate([...n.keys()]);for(let[v,b]of h){let _=n.get(v);d.set(b,_)}let p=f.translate([...s.keys()]);for(let[v,b]of p){let _=s.get(v),C=f.translateOne(_);C&&d.set(b,`ref: ${C}`)}let g=[];if(l){for(let v of f.localNamespaces()){let b=(await t.listRefs({fs:e,gitdir:r,filepath:v})).map(_=>`${v}/${_}`);for(let _ of b)d.has(_)||g.push(_)}g.length>0&&await t.deleteRefs({fs:e,gitdir:r,refs:g})}for(let[v,b]of d)await Fs(v,async()=>e.write(N(r,v),`${b.trim()} `,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:r,ref:i,value:n}){if(!n.match(/[0-9a-f]{40}/))throw new Ms(n);await Fs(i,async()=>e.write(N(r,i),`${n.trim()} `,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:r,ref:i,value:n}){await Fs(i,async()=>e.write(N(r,i),`ref: ${n.trim()} `,"utf8"))}static async deleteRef({fs:e,gitdir:r,ref:i}){return t.deleteRefs({fs:e,gitdir:r,refs:[i]})}static async deleteRefs({fs:e,gitdir:r,refs:i}){await Promise.all(i.map(o=>e.rm(N(r,o))));let n=await Fs("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"})),s=kd.from(n),a=s.refs.size;for(let o of i)s.refs.has(o)&&s.delete(o);s.refs.sizee.write(`${r}/packed-refs`,n,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:r,ref:i,depth:n=void 0,visited:s=new Set}){if(n!==void 0&&(n--,n===-1))return i;if(i.startsWith("ref: "))return i=i.slice(5),t.resolve({fs:e,gitdir:r,ref:i,depth:n,visited:s});if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let a=await t.packedRefs({fs:e,gitdir:r}),o=yd(i).filter(l=>!cL.includes(l));for(let l of o){let c=await Fs(l,async()=>await e.read(`${r}/${l}`,{encoding:"utf8"})||a.get(l));if(c){if(s.has(l))throw new he(`Circular reference detected while resolving ref "${l}"`);return s.add(l),t.resolve({fs:e,gitdir:r,ref:c.trim(),depth:n,visited:s})}}throw new ze(i)}static async exists({fs:e,gitdir:r,ref:i}){try{return await t.expand({fs:e,gitdir:r,ref:i}),!0}catch(n){return!1}}static async expand({fs:e,gitdir:r,ref:i}){if(i.length===40&&/[0-9a-f]{40}/.test(i))return i;let n=await t.packedRefs({fs:e,gitdir:r}),s=yd(i);for(let a of s)if(await Fs(a,async()=>e.exists(`${r}/${a}`))||n.has(a))return a;throw new ze(i)}static async expandAgainstMap({ref:e,map:r}){let i=yd(e);for(let n of i)if(await r.has(n))return n;throw new ze(e)}static resolveAgainstMap({ref:e,fullref:r=e,depth:i=void 0,map:n}){if(i!==void 0&&(i--,i===-1))return{fullref:r,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:r,depth:i,map:n});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:r,oid:e};let s=yd(e);for(let a of s){let o=n.get(a);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:a,depth:i,map:n})}throw new ze(e)}static async packedRefs({fs:e,gitdir:r}){let i=await Fs("packed-refs",async()=>e.read(`${r}/packed-refs`,{encoding:"utf8"}));return kd.from(i).refs}static async listRefs({fs:e,gitdir:r,filepath:i}){let n=t.packedRefs({fs:e,gitdir:r}),s=null;try{s=await e.readdirDeep(`${r}/${i}`),s=s.map(a=>a.replace(`${r}/${i}/`,""))}catch(a){s=[]}for(let a of(await n).keys())a.startsWith(i)&&(a=a.replace(i+"/",""),s.includes(a)||s.push(a));return s.sort(YO),s}static async listBranches({fs:e,gitdir:r,remote:i}){return i?t.listRefs({fs:e,gitdir:r,filepath:`refs/remotes/${i}`}):t.listRefs({fs:e,gitdir:r,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:r}){return(await t.listRefs({fs:e,gitdir:r,filepath:"refs/tags"})).filter(n=>!n.endsWith("^{}"))}};function uL(t,e){return Dd(BE(t),BE(e))}function BE(t){return t.mode==="040000"?t.path+"/":t.path}function uS(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 he(`Unexpected GitTree entry mode: ${t}`)}function fL(t){let e=[],r=0;for(;r`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(` `)}toObject(){let e=[...this._entries];return e.sort(uL),k.concat(e.map(r=>{let i=k.from(r.mode.replace(/^0/,"")),n=k.from(" "),s=k.from(r.path,"utf8"),a=k.from([0]),o=k.from(r.oid,"hex");return k.concat([i,n,s,a,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},Ds=class{static wrap({type:e,object:r}){let i=`${e} ${r.length}\0`,n=i.length,s=n+r.length,a=new Uint8Array(s);for(let o=0;o>=1,n+=8;return i}function GE(t,e){let r=t.readUInt8(),i=128,n=15,s=112;if(r&i){let a=UE(t,r&n,4),o=UE(t,(r&s)>>4,3);return o===0&&(o=65536),e.slice(a,a+o)}else return t.slice(r)}function mL(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function dS(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:mL(t)}var Ad=class{constructor(e){if(typeof k=="undefined")throw new Error("Missing Buffer dependency");this.stream=dS(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:r}=await this.stream.next();return e&&(this._ended=!0,!r)?k.alloc(0):(r&&(r=k.from(r)),r)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let r=[this.buffer];for(;this.cursor+e>gL(r);){let i=await this._next();if(this._ended)break;r.push(i)}this.buffer=k.concat(r)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function gL(t){return t.reduce((e,r)=>e+r.length,0)}async function vL(t,e){let r=new Ad(t),i=await r.read(4);if(i=i.toString("utf8"),i!=="PACK")throw new he(`Invalid PACK header '${i}'`);let n=await r.read(4);if(n=n.readUInt32BE(0),n!==2)throw new he(`Invalid packfile version: ${n}`);let s=await r.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!r.eof()&&s--;){let a=r.tell(),{type:o,length:l,ofs:c,reference:u}=await wL(r),f=new Md.default.Inflate;for(;!f.result;){let d=await r.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new he(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new he("Inflated object size is different from that stated in packfile.");await r.undo(),await r.read(d.length-f.strm.avail_in);let h=r.tell();await e({data:f.result,type:o,num:s,offset:a,end:h,reference:u,ofs:c})}}}}async function wL(t){let e=await t.byte(),r=e>>4&7,i=e&15;if(e&128){let a=4;do e=await t.byte(),i|=(e&127)<n+1<<7|s,-1)}function xL(t,e){let r=e,i=4,n=null;do n=t.readUInt8(),r|=(n&127)<2048*1024*1024)throw new he("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");i.seek(i.tell()+1020);let a=i.readUInt32BE(),o=[];for(let u=0;u{u===null&&(u=x);let E=Math.floor((u-x)*100/u);E!==f&&i&&await i({phase:"Receiving objects",loaded:u-x,total:u}),f=E,b=n[b],["commit","tree","blob","tag"].includes(b)?s[C]={type:b,offset:C}:b==="ofs-delta"?s[C]={type:b,offset:C}:b==="ref-delta"&&(s[C]={type:b,offset:C})});let d=Object.keys(s).map(Number);for(let[v,b]of d.entries()){let _=v+1===d.length?e.byteLength-20:d[v+1],C=s[b],x=iS.default.buf(e.slice(b,_))>>>0;C.end=_,C.crc=x}let h=new t({pack:Promise.resolve(e),packfileSha:a,crcs:l,hashes:o,offsets:c,getExternalRefDelta:r});f=null;let p=0,g=[0,0,0,0,0,0,0,0,0,0,0,0];for(let v in s){v=Number(v);let b=Math.floor(p*100/u);b!==f&&i&&await i({phase:"Resolving deltas",loaded:p,total:u}),p++,f=b;let _=s[v];if(!_.oid)try{h.readDepth=0,h.externalReadDepth=0;let{type:C,object:x}=await h.readSlice({start:v});g[h.readDepth]+=1;let E=await En(Ds.wrap({type:C,object:x}));_.oid=E,o.push(E),c.set(E,v),l[E]=_.crc}catch(C){continue}}return o.sort(),h}async toBuffer(){let e=[],r=(c,u)=>{e.push(k.from(c,u))};r("ff744f63","hex"),r("00000002","hex");let i=new zi(k.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++;i.writeUInt32BE(u)}e.push(i.buffer);for(let c of this.hashes)r(c,"hex");let n=new zi(k.alloc(this.hashes.length*4));for(let c of this.hashes)n.writeUInt32BE(this.crcs[c]);e.push(n.buffer);let s=new zi(k.alloc(this.hashes.length*4));for(let c of this.hashes)s.writeUInt32BE(this.offsets.get(c));e.push(s.buffer),r(this.packfileSha,"hex");let a=k.concat(e),o=await En(a),l=k.alloc(20);return l.write(o,"hex"),k.concat([a,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 he(`Could not read object ${e} from packfile`)}let r=this.offsets.get(e);return this.readSlice({start:r})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;let r={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"},i=await this.pack;if(!i)throw new he("Could not read packfile data. The packfile may be missing, corrupted, or too large to read into memory.");let n=i.slice(e),s=new zi(n),a=s.readUInt8(),o=a&112,l=r[o];if(l===void 0)throw new he("Unrecognized type: 0b"+o.toString(2));let c=a&15,u=c;a&128&&(u=xL(s,c));let d=null,h=null;if(l==="ofs_delta"){let g=yL(s),v=e-g;({object:d,type:l}=await this.readSlice({start:v}))}if(l==="ref_delta"){let g=s.slice(20).toString("hex");({object:d,type:l}=await this.read({oid:g}))}let p=n.slice(s.tell());if(h=k.from(await hS(p)),h.byteLength!==u)throw new he(`Packfile told us object would have length ${u} but it had length ${h.byteLength}`);return d&&(h=k.from(pL(h,d))),this.readDepth>3&&(this.offsetCache[e]={type:l,object:h}),{type:l,format:"content",object:h}}},xd=Symbol("PackfileCache");async function EL({fs:t,filename:e,getExternalRefDelta:r,emitter:i,emitterPrefix:n}){let s=await t.read(e);return qc.fromIdx({idx:s,getExternalRefDelta:r})}function av({fs:t,cache:e,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}){e[xd]||(e[xd]=new Map);let a=e[xd].get(r);return a||(a=EL({fs:t,filename:r,getExternalRefDelta:i,emitter:n,emitterPrefix:s}),e[xd].set(r,a)),a}async function SL(t,{start:e=0,end:r=t.length}={}){return En(t.subarray(e,r))}async function kL({fs:t,cache:e,gitdir:r,oid:i,format:n="content",getExternalRefDelta:s}){let a=await t.readdir(N(r,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(let o of a){let l=`${r}/objects/pack/${o}`,c=await av({fs:t,cache:e,filename:l,getExternalRefDelta:s});if(c.error)throw new he(c.error);if(c.offsets.has(i)){let u=l.replace(/idx$/,"pack");c.pack||(c.pack=t.read(u));let f=await c.pack;if(!f)throw c.pack=null,new he(`Could not read packfile at ${u}. The file may be missing, corrupted, or too large to read into memory.`);if(!c._checksumVerified){let h=c.packfileSha,p=f.subarray(-20),g=Array.from(p).map(b=>b.toString(16).padStart(2,"0")).join("");if(g!==h)throw new he(`Packfile trailer mismatch: expected ${h}, got ${g}. The packfile may be corrupted.`);let v=await SL(f,{start:0,end:f.length-20});if(v!==h)throw new he(`Packfile payload corrupted: calculated ${v} but expected ${h}. The packfile may have been tampered with.`);c._checksumVerified=!0}let d=await c.read({oid:i,getExternalRefDelta:s});return d.format="content",d.source=`objects/pack/${o.replace(/idx$/,"pack")}`,d}}return null}async function st({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=u=>st({fs:t,cache:e,gitdir:r,oid:u}),a;if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(a={format:"wrapped",object:k.from("tree 0\0")}),a||(a=await fS({fs:t,gitdir:r,oid:i})),!a){if(a=await kL({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s}),!a)throw new ze(i);return a}if(n==="deflated"||(a.format==="deflated"&&(a.object=k.from(await hS(a.object)),a.format="wrapped"),n==="wrapped"))return a;let o=await En(a.object);if(o!==i)throw new he(`SHA check failed! Expected ${i}, computed ${o}`);let{object:l,type:c}=Ds.unwrap(a.object);if(a.type=c,a.object=l,a.format="content",n==="content")return a;throw new he(`invalid requested format "${n}"`)}var Wi=class t extends Pe{constructor(e,r,i=!0){super(`Failed to create ${e} at ${r} because it already exists.${i?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=t.code,this.data={noun:e,where:r,canForce:i}}};Wi.code="AlreadyExistsError";var Yc=class t extends Pe{constructor(e,r,i){super(`Found multiple ${e} matching "${r}" (${i.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=t.code,this.data={nouns:e,short:r,matches:i}}};Yc.code="AmbiguousError";var Zc=class t extends Pe{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}}};Zc.code="CheckoutConflictError";var Kc=class t extends Pe{constructor(e,r){super(`Cannot cherry-pick merge commit ${e}. Merge commits have ${r} parents and require specifying which parent to use as the base.`),this.code=this.name=t.code,this.data={oid:e,parentCount:r}}};Kc.code="CherryPickMergeCommitError";var Xc=class t extends Pe{constructor(e){super(`Cannot cherry-pick root commit ${e}. Root commits have no parents.`),this.code=this.name=t.code,this.data={oid:e}}};Xc.code="CherryPickRootCommitError";var Qc=class t extends Pe{constructor(e,r){super(`Failed to checkout "${e}" because commit ${r} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=t.code,this.data={ref:e,oid:r}}};Qc.code="CommitNotFetchedError";var Jc=class t extends Pe{constructor(){super("Cannot create an empty commit when disallowEmpty is true."),this.code=this.name=t.code,this.data={}}};Jc.code="EmptyCommitError";var eu=class t extends Pe{constructor(){super("Empty response from git server."),this.code=this.name=t.code,this.data={}}};eu.code="EmptyServerResponseError";var tu=class t extends Pe{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=t.code,this.data={}}};tu.code="FastForwardError";var ru=class t extends Pe{constructor(e,r){super(`One or more branches were not updated: ${e}`),this.code=this.name=t.code,this.data={prettyDetails:e,result:r}}};ru.code="GitPushError";var Xo=class t extends Pe{constructor(e,r,i){super(`HTTP Error: ${e} ${r}`),this.code=this.name=t.code,this.data={statusCode:e,statusMessage:r,response:i}}};Xo.code="HttpError";var Os=class t extends Pe{constructor(e){let r="invalid filepath";e==="leading-slash"||e==="trailing-slash"?r='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(r='"filepath" should not be a directory.'),super(r),this.code=this.name=t.code,this.data={reason:e}}};Os.code="InvalidFilepathError";var qi=class t extends Pe{constructor(e,r){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${r}".)`),this.code=this.name=t.code,this.data={ref:e,suggestion:r}}};qi.code="InvalidRefNameError";var iu=class t extends Pe{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=t.code,this.data={depth:e}}};iu.code="MaxDepthError";var Qo=class t extends Pe{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=t.code,this.data={}}};Qo.code="MergeNotSupportedError";var ka=class t extends Pe{constructor(e,r,i,n){super(`Automatic merge failed with one or more merge conflicts in the following files: ${e.toString()}. Fix conflicts then commit the result.`),this.code=this.name=t.code,this.data={filepaths:e,bothModified:r,deleteByUs:i,deleteByTheirs:n}}};ka.code="MergeConflictError";var Jt=class t extends Pe{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}}};Jt.code="MissingNameError";var Or=class t extends Pe{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=t.code,this.data={parameter:e}}};Or.code="MissingParameterError";var Ca=class t extends Pe{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}};Ca.code="MultipleGitError";var Aa=class t extends Pe{constructor(e,r){super(`Expected "${e}" but received "${r}".`),this.code=this.name=t.code,this.data={expected:e,actual:r}}};Aa.code="ParseError";var Jo=class t extends Pe{constructor(e){let r="";e==="not-fast-forward"?r=" because it was not a simple fast-forward":e==="tag-exists"&&(r=" because tag already exists"),super(`Push rejected${r}. Use "force: true" to override.`),this.code=this.name=t.code,this.data={reason:e}}};Jo.code="PushRejectedError";var Is=class t extends Pe{constructor(e,r){super(`Remote does not support the "${e}" so the "${r}" parameter cannot be used.`),this.code=this.name=t.code,this.data={capability:e,parameter:r}}};Is.code="RemoteCapabilityError";var nu=class t extends Pe{constructor(e,r){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${e}`),this.code=this.name=t.code,this.data={preview:e,response:r}}};nu.code="SmartHttpError";var su=class t extends Pe{constructor(e,r,i){super(`Git remote "${e}" uses an unrecognized transport protocol: "${r}"`),this.code=this.name=t.code,this.data={url:e,transport:r,suggestion:i}}};su.code="UnknownTransportError";var au=class t extends Pe{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=t.code,this.data={url:e}}};au.code="UrlParseError";var el=class t extends Pe{constructor(){super("The operation was canceled."),this.code=this.name=t.code,this.data={}}};el.code="UserCanceledError";var ou=class t extends Pe{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}}};ou.code="IndexResetError";var lu=class t extends Pe{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}}};lu.code="NoCommitError";var du=Object.freeze({__proto__:null,AlreadyExistsError:Wi,AmbiguousError:Yc,CheckoutConflictError:Zc,CherryPickMergeCommitError:Kc,CherryPickRootCommitError:Xc,CommitNotFetchedError:Qc,EmptyCommitError:Jc,EmptyServerResponseError:eu,FastForwardError:tu,GitPushError:ru,HttpError:Xo,InternalError:he,InvalidFilepathError:Os,InvalidOidError:Ms,InvalidRefNameError:qi,MaxDepthError:iu,MergeNotSupportedError:Qo,MergeConflictError:ka,MissingNameError:Jt,MissingParameterError:Or,MultipleGitError:Ca,NoRefspecError:Wc,NotFoundError:ze,ObjectTypeError:xr,ParseError:Aa,PushRejectedError:Jo,RemoteCapabilityError:Is,SmartHttpError:nu,UnknownTransportError:su,UnsafeFilepathError:Ea,UrlParseError:au,UserCanceledError:el,UnmergedPathsError:zc,IndexResetError:ou,NoCommitError:lu});function Qg({name:t,email:e,timestamp:r,timezoneOffset:i}){return i=CL(i),`${t} <${e}> ${r} ${i}`}function CL(t){let e=AL(TL(t));t=Math.abs(t);let r=Math.floor(t/60);t-=r*60;let i=String(r),n=String(t);return i.length<2&&(i="0"+i),n.length<2&&(n="0"+n),(e===-1?"-":"+")+i+n}function AL(t){return Math.sign(t)||(Object.is(t,-0)?-1:1)}function TL(t){return t===0?t:-t}function Qn(t){return t=t.replace(/\r/g,""),t=t.replace(/^\n+/,""),t=t.replace(/\n+$/,"")+` `,t}function Td(t){let[,e,r,i,n]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:r,timestamp:Number(i),timezoneOffset:PL(n)}}function PL(t){let[,e,r,i]=t.match(/(\+|-)(\d\d)(\d\d)/);return i=(e==="+"?1:-1)*(Number(r)*60+Number(i)),RL(i)}function RL(t){return t===0?t:-t}var ni=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(k.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new he("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 ${Qg(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(` `),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=` `+n.slice(1):r.push(n);let i={};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.tagger&&(i.tagger=Td(i.tagger)),i.committer&&(i.committer=Td(i.committer)),i}withoutSignature(){let e=Qn(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 Qn(e)}payload(){return this.withoutSignature()+` `}toObject(){return k.from(this._tag,"utf8")}static async sign(e,r,i){let n=e.payload(),{signature:s}=await r({payload:n,secretKey:i});s=Qn(s);let a=n+s;return t.from(a)}};function Hg(t){return t.trim().split(` `).map(e=>" "+e).join(` `)+` `}function $L(t){return t.split(` `).map(e=>e.replace(/^ /,"")).join(` `)}var Nr=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(k.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new he("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:r}){let i=t.justHeaders(e),n=t.justMessage(e),s=Qn(i+` gpgsig`+Hg(r)+` `+n);return new t(s)}static from(e){return new t(e)}toObject(){return k.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 Qn(e.slice(e.indexOf(` `)+2))}static justHeaders(e){return e.slice(0,e.indexOf(` `))}parseHeaders(){let e=t.justHeaders(this._commit).split(` `),r=[];for(let n of e)n[0]===" "?r[r.length-1]+=` `+n.slice(1):r.push(n);let i={parent:[]};for(let n of r){let s=n.slice(0,n.indexOf(" ")),a=n.slice(n.indexOf(" ")+1);Array.isArray(i[s])?i[s].push(a):i[s]=a}return i.author&&(i.author=Td(i.author)),i.committer&&(i.committer=Td(i.committer)),i}static renderHeaders(e){let r="";if(e.tree?r+=`tree ${e.tree} `:r+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 `,e.parent){if(e.parent.length===void 0)throw new he("commit 'parent' property should be an array");for(let s of e.parent)r+=`parent ${s} `}let i=e.author;r+=`author ${Qg(i)} `;let n=e.committer||e.author;return r+=`committer ${Qg(n)} `,e.gpgsig&&(r+="gpgsig"+Hg(e.gpgsig)),r}static render(e){return t.renderHeaders(e)+` `+Qn(e.message)}render(){return this._commit}withoutSignature(){let e=Qn(this._commit);if(e.indexOf(` gpgsig`)===-1)return e;let r=e.slice(0,e.indexOf(` gpgsig`)),i=e.slice(e.indexOf(`-----END PGP SIGNATURE----- `)+28);return Qn(r+` `+i)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return $L(e)}static async sign(e,r,i){let n=e.withoutSignature(),s=t.justMessage(e._commit),{signature:a}=await r({payload:n,secretKey:i});a=Qn(a);let l=t.justHeaders(e._commit)+` gpgsig`+Hg(a)+` `+s;return t.from(l)}};async function tl({fs:t,cache:e,gitdir:r,oid:i}){if(i==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Lr.from([]),oid:i};let{type:n,object:s}=await st({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=ni.from(s).parse().object,tl({fs:t,cache:e,gitdir:r,oid:i});if(n==="commit")return i=Nr.from(s).parse().tree,tl({fs:t,cache:e,gitdir:r,oid:i});if(n!=="tree")throw new xr(i,n,"tree");return{tree:Lr.from(s),oid:i}}var Jg=class{constructor({fs:e,gitdir:r,ref:i,cache:n}){this.fs=e,this.cache=n,this.gitdir=r,this.mapPromise=(async()=>{let a=new Map,o;try{o=await q.resolve({fs:e,gitdir:r,ref:i})}catch(c){c instanceof ze&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await tl({fs:e,cache:this.cache,gitdir:r,oid:o});return l.type="tree",l.mode="40000",a.set(".",l),a})();let s=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 s.type(this)}async mode(){return s.mode(this)}async stat(){return s.stat(this)}async content(){return s.content(this)}async oid(){return s.oid(this)}}}async readdir(e){let r=e._fullpath,{fs:i,cache:n,gitdir:s}=this,a=await this.mapPromise,o=a.get(r);if(!o)throw new Error(`No obj for ${r}`);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 st({fs:i,cache:n,gitdir:s,oid:l});if(c!==o.type)throw new xr(l,c,o.type);let f=Lr.from(u);for(let d of f)a.set(N(r,d.path),d);return f.entries().map(d=>N(r,d.path))}async type(e){if(e._type===!1){let r=await this.mapPromise,{type:i}=r.get(e._fullpath);e._type=i}return e._type}async mode(e){if(e._mode===!1){let r=await this.mapPromise,{mode:i}=r.get(e._fullpath);e._mode=oS(parseInt(i,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let r=await this.mapPromise,{fs:i,cache:n,gitdir:s}=this,o=r.get(e._fullpath).oid,{type:l,object:c}=await st({fs:i,cache:n,gitdir:s,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let i=(await this.mapPromise).get(e._fullpath);e._oid=i.oid}return e._oid}};function Dr({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,Od,{value:function({fs:r,gitdir:i,cache:n}){return new Jg({fs:r,gitdir:i,ref:t,cache:n})}}),Object.freeze(e),e}var ev=class{constructor({fs:e,dir:r,gitdir:i,cache:n,refresh:s=!0}){this.fs=e,this.cache=n,this.dir=r,this.gitdir=i,this.refresh=s,this.config=null;let a=this;this.ConstructEntry=class{constructor(l){this._fullpath=l,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){if(await e.type()!=="tree")return null;let r=e._fullpath,{fs:i,dir:n}=this,s=await i.readdir(N(n,r));return s===null?null:s.map(a=>N(r,a))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:r,dir:i}=this,n=await r.lstat(`${i}/${e._fullpath}`);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=n.isDirectory()?"tree":"blob";s==="blob"&&!n.isFile()&&!n.isSymbolicLink()&&(s="special"),e._type=s,n=Ko(n),e._mode=n.mode,n.size===-1&&e._actualSize&&(n.size=e._actualSize),e._stat=n}return e._stat}async content(e){if(e._content===!1){let{fs:r,dir:i,gitdir:n}=this;if(await e.type()==="tree")e._content=void 0;else{let s;if(await e.mode()>>12===10)s=await r.readlink(`${i}/${e._fullpath}`);else{let o=await(await this._getGitConfig(r,n)).get("core.autocrlf");s=await r.read(`${i}/${e._fullpath}`,{autocrlf:o})}e._actualSize=s.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(s)}}return e._content}async oid(e){if(e._oid===!1){let r=this,{fs:i,gitdir:n,cache:s}=this,a;await gt.acquire({fs:i,gitdir:n,cache:s},async function(o){let l=o.entriesMap.get(e._fullpath),c=await e.stat(),f=await(await r._getGitConfig(i,n)).get("core.filemode"),d=typeof process!="undefined"?process.platform!=="win32":!0;if(!l||Ed(c,l,f,d)){let h=await e.content();h===void 0?a=void 0:(a=await En(Ds.wrap({type:"blob",object:h})),r.refresh&&l&&a===l.oid&&(!f||c.mode===l.mode)&&Ed(c,l,f,d)&&o.insert({filepath:e._fullpath,stats:c,oid:a}))}else a=l.oid}),e._oid=a}return e._oid}async _getGitConfig(e,r){return this.config?this.config:(this.config=await vt.get({fs:e,gitdir:r}),this.config)}};function hu({refresh:t=!0}={}){let e=Object.create(null);return Object.defineProperty(e,Od,{value:function({fs:r,dir:i,gitdir:n,cache:s}){return new ev({fs:r,dir:i,gitdir:n,cache:s,refresh:t})}}),Object.freeze(e),e}function FL(t,e){let r=e-t;return Array.from({length:r},(i,n)=>t+n)}var pS=typeof Array.prototype.flat=="undefined"?t=>t.reduce((e,r)=>e.concat(r),[]):t=>t.flat(),tv=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:ec,reduce:a=async(l,c)=>{let u=pS(c);return l!==void 0&&u.unshift(l),u},iterate:o=(l,c)=>Promise.all([...c].map(l))}){let l=n.map(h=>h[Od]({fs:t,dir:r,gitdir:i,cache:e})),c=new Array(l.length).fill("."),u=FL(0,l.length),f=async h=>{u.forEach(v=>{let b=h[v];h[v]=b&&new l[v].ConstructEntry(b)});let g=(await Promise.all(u.map(v=>{let b=h[v];return b?l[v].readdir(b):[]}))).map(v=>(v===null?[]:v)[Symbol.iterator]());return{entries:h,children:IL(g)}},d=async h=>{let{entries:p,children:g}=await f(h),v=p.find(_=>_&&_._fullpath)._fullpath,b=await s(v,p);if(b!==null){let _=await o(d,g);return _=_.filter(C=>C!==void 0),a(b,_)}};return d(c)}async function rv(t,e){let r=await t.readdir(e);r==null?await t.rm(e):r.length?await Promise.all(r.map(i=>{let n=N(e,i);return t.lstat(n).then(s=>{if(s)return s.isDirectory()?rv(t,n):t.rm(n)})})).then(()=>t.rmdir(e)):await t.rmdir(e)}function ML(t){return DL(t)&&jE(t.then)&&jE(t.catch)}function DL(t){return t&&typeof t=="object"}function jE(t){return typeof t=="function"}function VE(t){return ML((r=>{try{return r.readFile().catch(i=>i)}catch(i){return i}})(t))}var zE=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function WE(t,e){if(VE(e))for(let r of zE)t[`_${r}`]=e[r].bind(e);else for(let r of zE)t[`_${r}`]=(0,Vc.default)(e[r].bind(e));VE(e)?(e.cp&&(t._cp=e.cp.bind(e)),e.rm?t._rm=e.rm.bind(e):e.rmdir.length>1?t._rm=e.rmdir.bind(e):t._rm=rv.bind(null,t)):(e.cp&&(t._cp=(0,Vc.default)(e.cp.bind(e))),e.rm?t._rm=(0,Vc.default)(e.rm.bind(e)):e.rmdir.length>2?t._rm=(0,Vc.default)(e.rmdir.bind(e)):t._rm=rv.bind(null,t))}var te=class{constructor(e){if(typeof e._original_unwrapped_fs!="undefined")return e;let r=Object.getOwnPropertyDescriptor(e,"promises");r&&r.enumerable?WE(this,e.promises):WE(this,e),this._original_unwrapped_fs=e}async exists(e,r={}){try{return await this._stat(e),!0}catch(i){if(i.code==="ENOENT"||i.code==="ENOTDIR"||(i.code||"").includes("ENS"))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',i),i}}async read(e,r={}){try{let i=await this._readFile(e,r);if(r.autocrlf==="true")try{i=new TextDecoder("utf8",{fatal:!0}).decode(i),i=i.replace(/\r\n/g,` `),i=new TextEncoder().encode(i)}catch(n){}return typeof i!="string"&&(i=k.from(i)),i}catch(i){return null}}async write(e,r,i={}){try{await this._writeFile(e,r,i)}catch(n){await this.mkdir(Sa(e)),await this._writeFile(e,r,i)}}async mkdir(e,r=!1){try{await this._mkdir(e)}catch(i){if(i===null||i.code==="EEXIST")return;if(r)throw i;if(i.code==="ENOENT"){let n=Sa(e);if(n==="."||n==="/"||n===e)throw i;await this.mkdir(n),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(r){if(r.code!=="ENOENT")throw r}}async rmdir(e,r){try{r&&r.recursive?await this._rm(e,r):await this._rmdir(e)}catch(i){if(i.code!=="ENOENT")throw i}}async readdir(e){try{let r=await this._readdir(e);return r.sort(Dd),r}catch(r){return r.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let r=await this._readdir(e);return(await Promise.all(r.map(async n=>{let s=e+"/"+n;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((n,s)=>n.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(r){if(r.code==="ENOENT"||(r.code||"").includes("ENS"))return null;throw r}}async readlink(e,r={encoding:"buffer"}){try{let i=await this._readlink(e,r);return k.isBuffer(i)?i:k.from(i)}catch(i){if(i.code==="ENOENT"||(i.code||"").includes("ENS"))return null;throw i}}async writelink(e,r){return this._symlink(r.toString("utf8"),e)}};function R(t,e){if(e===void 0)throw new Or(t)}function OL(t){return t.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(t)}async function ie({fsp:t,dotgit:e}){R("fsp",t),R("dotgit",e);let r=await t._stat(e).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return r.isDirectory()?e:r.isFile()?t._readFile(e,"utf8").then(i=>i.trimRight().substr(8)).then(i=>OL(i)?i:N(Sa(e),i)):e}async function Pd(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 LL({fs:t,dir:e,gitdir:r=N(e,".git"),commit:i="HEAD",cache:n={}}){try{R("fs",t),R("dir",e),R("gitdir",r);let s=new te(t),a=[Dr({ref:i}),hu(),sl()],o=[],l=await ie({fsp:s,dotgit:r});await gt.acquire({fs:s,gitdir:l,cache:n},async function(u){o=u.unmergedPaths});let c=await Jn({fs:s,cache:n,dir:e,gitdir:l,trees:a,map:async function(u,[f,d,h]){let p=!await Pd(d,h),g=o.includes(u),v=!await Pd(h,f);if(p||g)return f?{path:u,mode:await f.mode(),oid:await f.oid(),type:await f.type(),content:await f.content()}:void 0;if(v)return!1;throw new ou(u)}});await gt.acquire({fs:s,gitdir:l,cache:n},async function(u){for(let f of c)if(f!==!1){if(!f){await s.rmdir(`${e}/${f.path}`,{recursive:!0}),u.delete({filepath:f.path});continue}if(f.type==="blob"){let d=new TextDecoder().decode(f.content);await s.write(`${e}/${f.path}`,d,{mode:f.mode}),u.insert({filepath:f.path,oid:f.oid,stage:0})}}})}catch(s){throw s.caller="git.abortMerge",s}}var Ls=class{static async isIgnored({fs:e,dir:r,gitdir:i=N(r,".git"),filepath:n}){if(Sd(n)===".git")return!0;if(n===".")return!1;let s="",a=N(i,"info","exclude");await e.exists(a)&&(s=await e.read(a,"utf8"));let o=[{gitignore:N(r,".gitignore"),filepath:n}],l=n.split("/").filter(Boolean);for(let u=1;u{let f=await(await vt.get({fs:o,gitdir:l})).get("core.autocrlf");return iv({dir:e,gitdir:l,fs:o,filepath:i,index:c,force:s,parallel:a,autocrlf:f})})}catch(o){throw o.caller="git.add",o}}async function iv({dir:t,gitdir:e,fs:r,filepath:i,index:n,force:s,parallel:a,autocrlf:o}){i=Array.isArray(i)?i:[i];let l=i.map(async d=>{if(!s&&await Ls.isIgnored({fs:r,dir:t,gitdir:e,filepath:d}))return;let h=await r.lstat(N(t,d));if(!h)throw new ze(d);if(h.isDirectory()){let p=await r.readdir(N(t,d));if(a){let g=p.map(v=>iv({dir:t,gitdir:e,fs:r,filepath:[N(d,v)],index:n,force:s,parallel:a,autocrlf:o}));await Promise.all(g)}else for(let g of p)await iv({dir:t,gitdir:e,fs:r,filepath:[N(d,g)],index:n,force:s,parallel:a,autocrlf:o})}else{let p=h.isSymbolicLink()?await r.readlink(N(t,d)).then(gS):await r.read(N(t,d),{autocrlf:o});if(p===null)throw new ze(d);let g=await Br({fs:r,gitdir:e,type:"blob",object:p});n.insert({filepath:d,stats:h,oid:g})}}),c=await Promise.allSettled(l),u=c.filter(d=>d.status==="rejected").map(d=>d.reason);if(u.length>1)throw new Ca(u);if(u.length===1)throw u[0];return c.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}async function cu({fs:t,gitdir:e,path:r}){return(await vt.get({fs:t,gitdir:e})).get(r)}function vS(t,...e){for(let r of e)if(r)for(let i of Object.keys(r)){let n=r[i];n!==void 0&&(t[i]=n)}return t}async function Ns({fs:t,gitdir:e,author:r,commit:i}){let n=Math.floor(Date.now()/1e3),s={name:await cu({fs:t,gitdir:e,path:"user.name"}),email:await cu({fs:t,gitdir:e,path:"user.email"})||"",timestamp:n,timezoneOffset:new Date(n*1e3).getTimezoneOffset()},a=vS({},s,i?i.author:void 0,r);if(a.name!==void 0)return a}async function Ta({fs:t,gitdir:e,author:r,committer:i,commit:n}){let s=Math.floor(Date.now()/1e3),a={name:await cu({fs:t,gitdir:e,path:"user.name"}),email:await cu({fs:t,gitdir:e,path:"user.email"})||"",timestamp:s,timezoneOffset:new Date(s*1e3).getTimezoneOffset()},o=vS({},a,n?n.committer:void 0,r,i);if(o.name!==void 0)return o}async function wS({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await st({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=ni.from(s).parse().object,wS({fs:t,cache:e,gitdir:r,oid:i});if(n!=="commit")throw new xr(i,n,"commit");return{commit:Nr.from(s),oid:i}}async function xn({fs:t,cache:e,gitdir:r,oid:i}){let{commit:n,oid:s}=await wS({fs:t,cache:e,gitdir:r,oid:i});return{oid:s,commit:n.parse(),payload:n.withoutSignature()}}var GL="4b825dc642cb6eb9a060e54bf8d69288fbee4904";async function pu({fs:t,cache:e,onSign:r,gitdir:i,message:n,author:s,committer:a,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,disallowEmpty:f=!1,ref:d,parent:h,tree:p}){let g=!1,v=!1;d||(v=!(await t.read(`${i}/HEAD`,{encoding:"utf8"})).startsWith("ref:"),d=await q.resolve({fs:t,gitdir:i,ref:"HEAD",depth:2}));let b,_;try{b=await q.resolve({fs:t,gitdir:i,ref:d}),_=await xn({fs:t,gitdir:i,oid:b,cache:{}})}catch(E){g=!0}if(l&&g)throw new lu(d);let C=l?await Ns({fs:t,gitdir:i,author:s,commit:_.commit}):await Ns({fs:t,gitdir:i,author:s});if(!C)throw new Jt("author");let x=l?await Ta({fs:t,gitdir:i,author:C,committer:a,commit:_.commit}):await Ta({fs:t,gitdir:i,author:C,committer:a});if(!x)throw new Jt("committer");return gt.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async function(E){let w=cS(E.entries).get(".");if(p||(p=await bS({fs:t,gitdir:i,inode:w,dryRun:c})),h?h=await Promise.all(h.map(P=>q.resolve({fs:t,gitdir:i,ref:P}))):l?h=_.commit.parent:h=b?[b]:[],f&&!l&&(g&&p===GL||!g&&p===_.commit.tree))throw new Jc;if(!n)if(l)n=_.commit.message;else throw new Or("message");let S=Nr.from({tree:p,parent:h,author:C,committer:x,message:n});o&&(S=await Nr.sign(S,r,o));let y=await Br({fs:t,gitdir:i,type:"commit",object:S.toObject(),dryRun:c});return!u&&!c&&await q.writeRef({fs:t,gitdir:i,ref:v?"HEAD":d,value:y}),y})}async function bS({fs:t,gitdir:e,inode:r,dryRun:i}){let n=r.children;for(let l of n)l.type==="tree"&&(l.metadata.mode="040000",l.metadata.oid=await bS({fs:t,gitdir:e,inode:l,dryRun:i}));let s=n.map(l=>({mode:l.metadata.mode,path:l.basename,oid:l.metadata.oid,type:l.type})),a=Lr.from(s);return await Br({fs:t,gitdir:e,type:"tree",object:a.toObject(),dryRun:i})}async function mu({fs:t,cache:e,gitdir:r,oid:i,filepath:n}){if(n.startsWith("/"))throw new Os("leading-slash");if(n.endsWith("/"))throw new Os("trailing-slash");let s=i,a=await tl({fs:t,cache:e,gitdir:r,oid:i}),o=a.tree;if(n==="")i=a.oid;else{let l=n.split("/");i=await _S({fs:t,cache:e,gitdir:r,tree:o,pathArray:l,oid:s,filepath:n})}return i}async function _S({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:a}){let o=n.shift();for(let l of i)if(l.path===o){if(n.length===0)return l.oid;{let{type:c,object:u}=await st({fs:t,cache:e,gitdir:r,oid:l.oid});if(c!=="tree")throw new xr(s,c,"tree",a);return i=Lr.from(u),_S({fs:t,cache:e,gitdir:r,tree:i,pathArray:n,oid:s,filepath:a})}}throw new ze(`file or directory found at "${s}:${a}"`)}async function al({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){n!==void 0&&(i=await mu({fs:t,cache:e,gitdir:r,oid:i,filepath:n}));let{tree:s,oid:a}=await tl({fs:t,cache:e,gitdir:r,oid:i});return{oid:a,tree:s.entries()}}async function gu({fs:t,gitdir:e,tree:r}){let i=Lr.from(r).toObject();return await Br({fs:t,gitdir:e,type:"tree",object:i,format:"content"})}async function jL({fs:t,cache:e,onSign:r,gitdir:i,ref:n,oid:s,note:a,force:o,author:l,committer:c,signingKey:u}){let f;try{f=await q.resolve({gitdir:i,fs:t,ref:n})}catch(b){if(!(b instanceof ze))throw b}let h=(await al({fs:t,cache:e,gitdir:i,oid:f||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(o)h=h.filter(b=>b.path!==s);else for(let b of h)if(b.path===s)throw new Wi("note",s);typeof a=="string"&&(a=k.from(a,"utf8"));let p=await Br({fs:t,gitdir:i,type:"blob",object:a,format:"content"});h.push({mode:"100644",path:s,oid:p,type:"blob"});let g=await gu({fs:t,gitdir:i,tree:h});return await pu({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:g,parent:f&&[f],message:`Note added by 'isomorphic-git addNote' `,author:l,committer:c,signingKey:u})}async function VL({fs:t,onSign:e,dir:r,gitdir:i=N(r,".git"),ref:n="refs/notes/commits",oid:s,note:a,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{R("fs",t),R("gitdir",i),R("oid",s),R("note",a),u&&R("onSign",e);let d=new te(t),h=await Ns({fs:d,gitdir:i,author:l});if(!h)throw new Jt("author");let p=await Ta({fs:d,gitdir:i,author:h,committer:c});if(!p)throw new Jt("committer");let g=await ie({fsp:d,dotgit:i});return await jL({fs:d,cache:f,onSign:e,gitdir:g,ref:n,oid:s,note:a,force:o,author:h,committer:p,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}var zL=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function uu(t,e){if(typeof t!="string")throw new TypeError("Reference name must be a string");return!zL.test(t)&&(!!e||t.includes("/"))}async function yS({fs:t,gitdir:e,remote:r,url:i,force:n}){if(!uu(r,!0))throw new qi(r,Zo.default.clean(r));let s=await vt.get({fs:t,gitdir:e});if(!n&&(await s.getSubsections("remote")).includes(r)&&i!==await s.get(`remote.${r}.url`))throw new Wi("remote",r);await s.set(`remote.${r}.url`,i),await s.set(`remote.${r}.fetch`,`+refs/heads/*:refs/remotes/${r}/*`),await vt.save({fs:t,gitdir:e,config:s})}async function WL({fs:t,dir:e,gitdir:r=N(e,".git"),remote:i,url:n,force:s=!1}){try{R("fs",t),R("gitdir",r),R("remote",i),R("url",n);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await yS({fs:a,gitdir:o,remote:i,url:n,force:s})}catch(a){throw a.caller="git.addRemote",a}}async function qL({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,!u&&await q.exists({fs:t,gitdir:i,ref:n}))throw new Wi("tag",n);let f=await q.resolve({fs:t,gitdir:i,ref:l||"HEAD"}),{type:d}=await st({fs:t,cache:e,gitdir:i,oid:f}),h=ni.from({object:f,type:d,tag:n.replace("refs/tags/",""),tagger:s,message:a,gpgsig:o});c&&(h=await ni.sign(h,r,c));let p=await Br({fs:t,gitdir:i,type:"tag",object:h.toObject()});await q.writeRef({fs:t,gitdir:i,ref:n,value:p})}async function YL({fs:t,onSign:e,dir:r,gitdir:i=N(r,".git"),ref:n,tagger:s,message:a=n,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{R("fs",t),R("gitdir",i),R("ref",n),c&&R("onSign",e);let d=new te(t),h=await ie({fsp:d,dotgit:i}),p=await Ns({fs:d,gitdir:h,author:s});if(!p)throw new Jt("tagger");return await qL({fs:d,cache:f,onSign:e,gitdir:h,ref:n,tagger:p,message:a,gpgsig:o,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function ZL({fs:t,gitdir:e,ref:r,object:i,checkout:n=!1,force:s=!1}){if(!uu(r,!0))throw new qi(r,Zo.default.clean(r));let a=`refs/heads/${r}`;if(!s&&await q.exists({fs:t,gitdir:e,ref:a}))throw new Wi("branch",r,!1);let o;try{o=await q.resolve({fs:t,gitdir:e,ref:i||"HEAD"})}catch(l){}o&&await q.writeRef({fs:t,gitdir:e,ref:a,value:o}),n&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function KL({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i,object:n,checkout:s=!1,force:a=!1}){try{R("fs",t),R("gitdir",r),R("ref",i);let o=new te(t),l=await ie({fsp:o,dotgit:r});return await ZL({fs:o,gitdir:l,ref:i,object:n,checkout:s,force:a})}catch(o){throw o.caller="git.branch",o}}async function fu(t,e,r){let i=r.split("/");i.pop();let n=e;for(let s of i){if(s===""||s===".")continue;n=`${n}/${s}`;let a=await t.lstat(n);if(a&&a.isSymbolicLink())throw new Ea(r)}}var xS=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function ov({fs:t,cache:e,onProgress:r,onPostCheckout:i,dir:n,gitdir:s,remote:a,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0,nonBlocking:p=!1,batchSize:g=100}){let v;if(i)try{v=await q.resolve({fs:t,gitdir:s,ref:"HEAD"})}catch(_){v="0000000000000000000000000000000000000000"}let b;try{b=await q.resolve({fs:t,gitdir:s,ref:o})}catch(_){if(o==="HEAD")throw _;let C=`${a}/${o}`;if(b=await q.resolve({fs:t,gitdir:s,ref:C}),h){let x=await vt.get({fs:t,gitdir:s});await x.set(`branch.${o}.remote`,a),await x.set(`branch.${o}.merge`,`refs/heads/${o}`),await vt.save({fs:t,gitdir:s,config:x})}await q.writeRef({fs:t,gitdir:s,ref:`refs/heads/${o}`,value:b})}if(!c){let _;try{_=await XL({fs:t,cache:e,onProgress:r,dir:n,gitdir:s,ref:o,force:d,filepaths:l})}catch(w){throw w instanceof ze&&w.data.what===b?new Qc(o,b):w}let C=_.filter(([w])=>w==="conflict").map(([w,S])=>S);if(C.length>0)throw new Zc(C);let x=_.filter(([w])=>w==="error").map(([w,S])=>S);if(x.length>0)throw new he(x.join(", "));if(f){i&&await i({previousHead:v,newHead:b,type:l!=null&&l.length>0?"file":"branch"});return}let E=0,A=_.length;if(await gt.acquire({fs:t,gitdir:s,cache:e},async function(w){await Promise.all(_.filter(([S])=>S==="delete"||S==="delete-index").map(async function([S,y]){let P=`${n}/${y}`;S==="delete"&&await t.rm(P),w.delete({filepath:y}),r&&await r({phase:"Updating workdir",loaded:++E,total:A})}))}),await gt.acquire({fs:t,gitdir:s,cache:e},async function(w){for(let[S,y]of _)if(S==="rmdir"||S==="rmdir-index"){let P=`${n}/${y}`;try{S==="rmdir"&&await t.rmdir(P),w.delete({filepath:y}),r&&await r({phase:"Updating workdir",loaded:++E,total:A})}catch(T){if(T.code==="ENOTEMPTY")console.log(`Did not delete ${y} because directory is not empty`);else throw T}}}),await Promise.all(_.filter(([w])=>w==="mkdir"||w==="mkdir-index").map(async function([w,S]){let y=`${n}/${S}`;await fu(t,n,S),await t.mkdir(y),r&&await r({phase:"Updating workdir",loaded:++E,total:A})})),p){let w=_.filter(([y])=>y==="create"||y==="create-index"||y==="update"||y==="mkdir-index"),S=await qE("Update Working Dir",w.map(([y,P,T,I,M])=>()=>JL({fs:t,cache:e,gitdir:s,dir:n},[y,P,T,I,M])),r,g);await gt.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(y){await qE("Update Index",S.map(([P,T,I])=>()=>QL({index:y,fullpath:P,oid:T,stats:I})),r,g)})}else await gt.acquire({fs:t,gitdir:s,cache:e,allowUnmerged:!0},async function(w){var P,T;let S=await Promise.allSettled(_.filter(([I])=>I==="create"||I==="create-index"||I==="update"||I==="mkdir-index").map(async function([I,M,B,re,Ae]){let K=`${n}/${M}`;if(I!=="create-index"&&I!=="mkdir-index"){await fu(t,n,M);let{object:fe}=await st({fs:t,cache:e,gitdir:s,oid:B});if(Ae&&await t.rm(K),re===33188)await t.write(K,fe);else if(re===33261)await t.write(K,fe,{mode:511});else if(re===40960)await t.writelink(K,fe);else throw new he(`Invalid mode 0o${re.toString(8)} detected in blob ${B}`)}let Q=await t.lstat(K);re===33261&&(Q.mode=493),I==="mkdir-index"&&(Q.mode=57344),w.insert({filepath:M,stats:Q,oid:B}),r&&await r({phase:"Updating workdir",loaded:++E,total:A})})),y=[];for(let I of S)I.status==="rejected"&&(y.push(I.reason),console.error("[isomorphic-git checkout] task rejected:",(T=(P=I.reason)==null?void 0:P.stack)!=null?T:I.reason));if(y.length>0)throw new Ca(y)});i&&await i({previousHead:v,newHead:b,type:l!=null&&l.length>0?"file":"branch"})}if(!u){let _=await q.expand({fs:t,gitdir:s,ref:o});_.startsWith("refs/heads")?await q.writeSymbolicRef({fs:t,gitdir:s,ref:"HEAD",value:_}):await q.writeRef({fs:t,gitdir:s,ref:"HEAD",value:b})}}async function XL({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,ref:s,force:a,filepaths:o}){let l=0;return Jn({fs:t,cache:e,dir:i,gitdir:n,trees:[Dr({ref:s}),hu(),sl()],map:async function(c,[u,f,d]){if(c===".")return;if(o&&!o.some(p=>xS(c,p)))return null;switch(r&&await r({phase:"Analyzing workdir",loaded:++l}),[!!d,!!u,!!f].map(Number).join("")){case"000":return;case"001":return a&&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()?a?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]:await u.mode()!==await f.mode()?a?["update",c,await u.oid(),await u.mode(),!0]:["conflict",c]:["create-index",c,await u.oid(),await u.mode()];case"commit-tree":return;case"commit-blob":return["conflict",c];default:return["error",`new entry Unhandled type ${u.type}`]}case"100":return["delete-index",c];case"101":switch(await d.type()){case"tree":return["rmdir-index",c];case"blob":return await d.oid()!==await f.oid()?a?["delete",c]:["conflict",c]:["delete",c];case"commit":return["rmdir-index",c];default:return["error",`delete entry Unhandled type ${await d.type()}`]}case"110":case"111":switch(`${await d.type()}-${await u.type()}`){case"tree-tree":return;case"blob-blob":{if(await d.oid()===await u.oid()&&await d.mode()===await u.mode()&&!a)return;if(f){if(await f.oid()!==await d.oid()&&await f.oid()!==await u.oid())return a?["update",c,await u.oid(),await u.mode(),await u.mode()!==await f.mode()]:["conflict",c]}else if(a)return["update",c,await u.oid(),await u.mode(),await u.mode()!==await d.mode()];return await u.mode()!==await d.mode()?["update",c,await u.oid(),await u.mode(),!0]:await u.oid()!==await d.oid()?["update",c,await u.oid(),await u.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",c,await u.oid()];case"blob-tree":return["update-blob-to-tree",c];case"commit-commit":return["mkdir-index",c,await u.oid(),await u.mode()];default:return["error",`update entry Unhandled type ${await d.type()}-${await u.type()}`]}}},reduce:async function(c,u){return u=pS(u),c?c&&c[0]==="rmdir"?(u.push(c),u):(u.unshift(c),u):u}})}async function QL({index:t,fullpath:e,stats:r,oid:i}){try{t.insert({filepath:e,stats:r,oid:i})}catch(n){console.warn(`Error inserting ${e} into index:`,n)}}async function JL({fs:t,cache:e,gitdir:r,dir:i},[n,s,a,o,l]){let c=`${i}/${s}`;if(n!=="create-index"&&n!=="mkdir-index"){await fu(t,i,s);let{object:f}=await st({fs:t,cache:e,gitdir:r,oid:a});if(l&&await t.rm(c),o===33188)await t.write(c,f);else if(o===33261)await t.write(c,f,{mode:511});else if(o===40960)await t.writelink(c,f);else throw new he(`Invalid mode 0o${o.toString(8)} detected in blob ${a}`)}let u=await t.lstat(c);return o===33261&&(u.mode=493),n==="mkdir-index"&&(u.mode=57344),[s,a,u]}async function qE(t,e,r,i){let n=[],s=[];for(let a=0;ac());(await Promise.allSettled(o)).forEach(c=>{var u,f;c.status==="fulfilled"?n.push(c.value):(s.push(c.reason),console.error(`[isomorphic-git ${t}] task rejected:`,(f=(u=c.reason)==null?void 0:u.stack)!=null?f:c.reason))}),r&&await r({phase:"Updating workdir",loaded:a+o.length,total:e.length})}if(s.length>0)throw new Ca(s);return n}async function ES({fs:t,onProgress:e,onPostCheckout:r,dir:i,gitdir:n=N(i,".git"),remote:s="origin",ref:a,filepaths:o,noCheckout:l=!1,noUpdateHead:c=a===void 0,dryRun:u=!1,force:f=!1,track:d=!0,cache:h={},nonBlocking:p=!1,batchSize:g=100}){try{R("fs",t),R("dir",i),R("gitdir",n);let v=a||"HEAD",b=new te(t),_=await ie({fsp:b,dotgit:n});return await ov({fs:b,cache:h,onProgress:e,onPostCheckout:r,dir:i,gitdir:_,remote:s,ref:v,filepaths:o,noCheckout:l,noUpdateHead:c,dryRun:u,force:f,track:d,nonBlocking:p,batchSize:g})}catch(v){throw v.caller="git.checkout",v}}var Gg=/^.*(\r?\n|$)/gm;function eN({branches:t,contents:e}){let r=t[1],i=t[2],n=e[0],s=e[1],a=e[2],o=s.match(Gg),l=n.match(Gg),c=a.match(Gg),u=(0,sS.default)(o,l,c),f=7,d="",h=!0;for(let p of u)p.ok&&(d+=p.ok.join("")),p.conflict&&(h=!1,d+=`${"<".repeat(f)} ${r} `,d+=p.conflict.a.join(""),d+=`${"=".repeat(f)} `,d+=p.conflict.b.join(""),d+=`${">".repeat(f)} ${i} `);return{cleanMerge:h,mergedText:d}}async function SS({fs:t,cache:e,dir:r,gitdir:i=N(r,".git"),index:n,ourOid:s,baseOid:a,theirOid:o,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let p=Dr({ref:s}),g=Dr({ref:a}),v=Dr({ref:o}),b=[],_=[],C=[],x=[],E=await Jn({fs:t,cache:e,dir:r,gitdir:i,trees:[p,g,v],map:async function(A,[w,S,y]){let P=Sd(A),T=await Pd(w,S),I=await Pd(y,S);switch(`${T}-${I}`){case"false-false":return{mode:await S.mode(),path:P,oid:await S.oid(),type:await S.type()};case"false-true":return!y&&await w.type()==="tree"?{mode:await w.mode(),path:P,oid:await w.oid(),type:await w.type()}:y?{mode:await y.mode(),path:P,oid:await y.oid(),type:await y.type()}:void 0;case"true-false":return!w&&await y.type()==="tree"?{mode:await y.mode(),path:P,oid:await y.oid(),type:await y.type()}:w?{mode:await w.mode(),path:P,oid:await w.oid(),type:await w.type()}:void 0;case"true-true":{if(w&&y&&await w.type()==="tree"&&await y.type()==="tree")return{mode:await w.mode(),path:P,oid:await w.oid(),type:"tree"};if(w&&y&&await w.type()==="blob"&&await y.type()==="blob")return tN({fs:t,gitdir:i,path:P,ours:w,base:S,theirs:y,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async M=>{if(M.cleanMerge)d||n.insert({filepath:A,oid:M.mergeResult.oid,stage:0});else if(b.push(A),_.push(A),!d){let B="";S&&await S.type()==="blob"&&(B=await S.oid());let re=await w.oid(),Ae=await y.oid();n.delete({filepath:A}),B&&n.insert({filepath:A,oid:B,stage:1}),n.insert({filepath:A,oid:re,stage:2}),n.insert({filepath:A,oid:Ae,stage:3})}return M.mergeResult});if(S&&!w&&y&&await S.type()==="blob"&&await y.type()==="blob"){if(b.push(A),C.push(A),!d){let M=await S.oid(),B=await y.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:M,stage:1}),n.insert({filepath:A,oid:B,stage:3})}return{mode:await y.mode(),oid:await y.oid(),type:"blob",path:P}}if(S&&w&&!y&&await S.type()==="blob"&&await w.type()==="blob"){if(b.push(A),x.push(A),!d){let M=await S.oid(),B=await w.oid();n.delete({filepath:A}),n.insert({filepath:A,oid:M,stage:1}),n.insert({filepath:A,oid:B,stage:2})}return{mode:await w.mode(),oid:await w.oid(),type:"blob",path:P}}if(S&&!w&&!y&&(await S.type()==="blob"||await S.type()==="tree"))return;throw new Qo}}},reduce:b.length!==0&&(!r||d)?void 0:async(A,w)=>{let S=w.filter(Boolean);if(A&&!(A&&A.type==="tree"&&S.length===0&&A.path!==".")){if(S.length>0||A.path==="."&&S.length===0){let P=new Lr(S).toObject(),T=await Br({fs:t,gitdir:i,type:"tree",object:P,dryRun:f});A.oid=T}return A}}});return b.length!==0?(r&&!d&&await Jn({fs:t,cache:e,dir:r,gitdir:i,trees:[Dr({ref:E.oid})],map:async function(A,[w]){let S=`${r}/${A}`;if(await w.type()==="blob"){let y=await w.mode(),P=await w.content();await t.write(S,P,{mode:y})}return!0}}),new ka(b,_,C,x)):E.oid}async function tN({fs:t,gitdir:e,path:r,ours:i,base:n,theirs:s,ourName:a,theirName:o,baseName:l,dryRun:c,mergeDriver:u=eN}){let f="blob",d="100755",h="",p="";n&&await n.type()==="blob"&&(d=await n.mode(),h=await n.oid(),p=k.from(await n.content()).toString("utf8"));let g=d===await i.mode()?await s.mode():await i.mode();if(await i.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};if(await i.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await s.oid(),type:f}};if(await s.oid()===h)return{cleanMerge:!0,mergeResult:{mode:g,path:r,oid:await i.oid(),type:f}};let v=k.from(await i.content()).toString("utf8"),b=k.from(await s.content()).toString("utf8"),{mergedText:_,cleanMerge:C}=await u({branches:[l,a,o],contents:[p,v,b],path:r}),x=await Br({fs:t,gitdir:e,type:"blob",object:k.from(_,"utf8"),dryRun:c});return{cleanMerge:C,mergeResult:{mode:g,path:r,oid:x,type:f}}}var rN={stage:sl,workdir:hu},jg;async function rl(t,e){return jg===void 0&&(jg=new Yo.default),jg.acquire(t,e)}async function iN(t,e,r,i,n=null){let s=N(r,i),a=await t.lstat(s);if(!a)throw new ze(s);if(a.isDirectory())throw new he(`${s}: file expected, but found directory`);let o=n?await fS({fs:t,gitdir:e,oid:n}):void 0,l=o?n:void 0;return o||await rl({fs:t,gitdir:e,currentFilepath:s},async()=>{let c=a.isSymbolicLink()?await t.readlink(s).then(gS):await t.read(s);if(c===null)throw new ze(s);l=await Br({fs:t,gitdir:e,type:"blob",object:c})}),l}async function nN({fs:t,dir:e,gitdir:r,entries:i}){async function n(s){if(s.type==="tree"){if(!s.oid){let a=await Promise.all(s.children.map(n));s.oid=await gu({fs:t,gitdir:r,tree:a}),s.mode=16384}}else s.type==="blob"&&(s.oid=await iN(t,r,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return Promise.all(i.map(n))}async function YE({fs:t,dir:e,gitdir:r,treePair:i}){let n=i[1]==="stage",s=i.map(h=>typeof h=="string"?rN[h]():h),a=[],u=await Jn({fs:t,cache:{},dir:e,gitdir:r,trees:s,map:async(h,[p,g])=>{if(!(h==="."||await Ls.isIgnored({fs:t,dir:e,gitdir:r,filepath:h}))&&g)return(!p||await p.oid()!==await g.oid()&&await g.oid()!==void 0)&&a.push([p,g]),{mode:await g.mode(),path:h,oid:await g.oid(),type:await g.type()}},reduce:async(h,p)=>(p=p.filter(Boolean),h?(h.children=p,h):p.length>0?p:void 0),iterate:async(h,p)=>{let g=[];for(let v of p){let[b,_]=v;n?_&&(await t.exists(`${e}/${_.toString()}`)?g.push(v):a.push([null,_])):b&&(_?g.push(v):a.push([b,null]))}return g.length?Promise.all(g.map(h)):[]}});if(a.length===0||u.length===0)return null;let d=(await nN({fs:t,dir:e,gitdir:r,entries:u})).filter(Boolean).map(h=>({mode:h.mode,path:h.path,oid:h.oid,type:h.type}));return gu({fs:t,gitdir:r,tree:d})}async function kS({fs:t,dir:e,gitdir:r,stashCommit:i,parentCommit:n,wasStaged:s}){let a=[],o=[],l=await Jn({fs:t,cache:{},dir:e,gitdir:r,trees:[Dr({ref:n}),Dr({ref:i})],map:async(c,[u,f])=>{if(c==="."||await Ls.isIgnored({fs:t,dir:e,gitdir:r,filepath:c}))return;let d=f?await f.type():await u.type();if(d!=="tree"&&d!=="blob")return;if(!f&&u){let p=d==="tree"?"rmdir":"rm";return d==="tree"&&a.push(c),d==="blob"&&s&&o.push({filepath:c,oid:await u.oid()}),{method:p,filepath:c}}let h=await f.oid();if(!u||await u.oid()!==h)return d==="tree"?{method:"mkdir",filepath:c}:(s&&o.push({filepath:c,oid:h,stats:await t.lstat(N(e,c))}),{method:"write",filepath:c,oid:h})}});await rl({fs:t,gitdir:r,dirRemoved:a,ops:l},async()=>{for(let c of l){let u=N(e,c.filepath);switch(c.method){case"rmdir":await t.rmdir(u);break;case"mkdir":await fu(t,e,c.filepath),await t.mkdir(u);break;case"rm":await t.rm(u);break;case"write":if(!a.some(f=>u.startsWith(f))){await fu(t,e,c.filepath);let{object:f}=await st({fs:t,cache:{},gitdir:r,oid:c.oid});await t.exists(u)&&await t.rm(u),await t.write(u,f)}break}}}),await gt.acquire({fs:t,gitdir:r,cache:{}},async c=>{o.forEach(({filepath:u,stats:f,oid:d})=>{c.insert({filepath:u,stats:f,oid:d})})})}async function ZE({fs:t,cache:e,dir:r,gitdir:i,oid:n,dryRun:s=!1,noUpdateBranch:a=!1,abortOnConflict:o=!0,committer:l,mergeDriver:c}){let{commit:u,oid:f}=await xn({fs:t,cache:e,gitdir:i,oid:n});if(u.parent.length>1)throw new Kc(f,u.parent.length);if(u.parent.length===0)throw new Xc(f);let d=await q.resolve({fs:t,gitdir:i,ref:"HEAD"}),{commit:h}=await xn({fs:t,cache:e,gitdir:i,oid:d}),p=u.parent[0],{commit:g}=await xn({fs:t,cache:e,gitdir:i,oid:p}),v=await gt.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async _=>SS({fs:t,cache:e,dir:r,gitdir:i,index:_,ourOid:h.tree,baseOid:g.tree,theirOid:u.tree,ourName:"HEAD",baseName:`parent of ${f.slice(0,7)}`,theirName:f.slice(0,7),dryRun:s,abortOnConflict:o,mergeDriver:c}));if(v instanceof ka)throw v;let b=await pu({fs:t,cache:e,gitdir:i,message:u.message,tree:v,parent:[d],author:u.author,committer:l,dryRun:s,noUpdateBranch:a});return r&&!s&&!a&&await kS({fs:t,dir:r,gitdir:i,stashCommit:b,parentCommit:d,wasStaged:!0}),b}async function sN({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,cache:n={},committer:s,dryRun:a=!1,noUpdateBranch:o=!1,abortOnConflict:l=!0,mergeDriver:c}){try{R("fs",t),R("gitdir",r),R("oid",i);let u=new te(t),f=await ie({fsp:u,dotgit:r}),{commit:d}=await xn({fs:u,cache:n,gitdir:f,oid:i});if(d.parent&&d.parent.length>1)return await ZE({fs:u,cache:n,dir:e,gitdir:f,oid:i,dryRun:a,noUpdateBranch:o,abortOnConflict:l,committer:void 0,mergeDriver:c});let h=await Ta({fs:u,gitdir:f,committer:s});if(!h)throw new Jt("committer");return await ZE({fs:u,cache:n,dir:e,gitdir:f,oid:i,dryRun:a,noUpdateBranch:o,abortOnConflict:l,committer:h,mergeDriver:c})}catch(u){throw u.caller="git.cherryPick",u}}var aN=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function xa(t){let e=aN.exec(t);return e?e[1]==="remotes/"&&t.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:t}async function Bs({fs:t,gitdir:e,fullname:r=!1,test:i=!1}){let n=await q.resolve({fs:t,gitdir:e,ref:"HEAD",depth:2});if(i)try{await q.resolve({fs:t,gitdir:e,ref:n})}catch(s){return}if(n.startsWith("refs/"))return r?n:xa(n)}function oN(t){return t=t.replace(/^git@([^:]+):/,"https://$1/"),t=t.replace(/^ssh:\/\//,"https://"),t}function CS({username:t="",password:e=""}){return`Basic ${k.from(`${t}:${e}`).toString("base64")}`}async function vu(t,e){let r=dS(t);for(;;){let{value:i,done:n}=await r.next();if(i&&await e(i),n)break}r.return&&r.return()}async function Rd(t){let e=0,r=[];await vu(t,s=>{r.push(s),e+=s.byteLength});let i=new Uint8Array(e),n=0;for(let s of r)i.set(s,n),n+=s.byteLength;return i}function KE(t){let e=t.match(/^https?:\/\/([^/]+)@/);if(e==null)return{url:t,auth:{}};e=e[1];let[r,i]=e.split(":");return t=t.replace(`${e}@`,""),{url:t,auth:{username:r,password:i}}}function nv(t,e){let r=e.toString(16);return"0".repeat(t-r.length)+r}var dt=class{static flush(){return k.from("0000","utf8")}static delim(){return k.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=k.from(e));let r=e.length+4,i=nv(4,r);return k.concat([k.from(i,"utf8"),e])}static streamReader(e){let r=new Ad(e);return async function(){try{let n=await r.read(4);if(n==null)return!0;if(n=parseInt(n.toString("utf8"),16),n===0||n===1)return null;let s=await r.read(n-4);return s==null?!0:s}catch(n){return e.error=n,!0}}}};async function XE(t){let e={},r;for(;r=await t(),r!==!0;){if(r===null)continue;r=r.toString("utf8").replace(/\n$/,"");let i=r.indexOf("=");if(i>-1){let n=r.slice(0,i),s=r.slice(i+1);e[n]=s}else e[r]=!0}return{protocolVersion:2,capabilities2:e}}async function QE(t,{service:e}){let r=new Set,i=new Map,n=new Map,s=dt.streamReader(t),a=await s();for(;a===null;)a=await s();if(a===!0)throw new eu;if(a.includes("version 2"))return XE(s);if(a.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new Aa(`# service=${e}\\n`,a.toString("utf8"));let o=await s();for(;o===null;)o=await s();if(o===!0)return{capabilities:r,refs:i,symrefs:n};if(o=o.toString("utf8"),o.includes("version 2"))return XE(s);let[l,c]=Vg(o,"\0","\\x00");if(c.split(" ").map(u=>r.add(u)),l!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,f]=Vg(l," "," ");for(i.set(f,u);;){let d=await s();if(d===!0)break;if(d!==null){let[h,p]=Vg(d.toString("utf8")," "," ");i.set(p,h)}}}for(let u of r)if(u.startsWith("symref=")){let f=u.match(/symref=([^:]+):(.*)/);f.length===3&&n.set(f[1],f[2])}return{protocolVersion:1,capabilities:r,refs:i,symrefs:n}}function Vg(t,e,r){let i=t.trim().split(e);if(i.length!==2)throw new Aa(`Two strings separated by '${r}'`,t.toString("utf8"));return i}var JE=(t,e)=>t.endsWith("?")?`${t}${e}`:`${t}/${e.replace(/^https?:\/\//,"")}`,eS=(t,e)=>{(e.username||e.password)&&(t.Authorization=CS(e)),e.headers&&Object.assign(t,e.headers)},zg=async t=>{try{let e=k.from(await Rd(t.body)),r=e.toString("utf8");return{preview:r.length<256?r:r.slice(0,256)+"...",response:r,data:e}}catch(e){return{}}},il=class{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:r,onAuth:i,onAuthSuccess:n,onAuthFailure:s,corsProxy:a,service:o,url:l,headers:c,protocolVersion:u}){let{url:f,auth:d}=KE(l),h=a?JE(a,f):f;(d.username||d.password)&&(c.Authorization=CS(d)),u===2&&(c["Git-Protocol"]="version=2");let p,g,v=!1;do if(p=await e.request({onProgress:r,method:"GET",url:`${h}/info/refs?service=${o}`,headers:c}),g=!1,p.statusCode===401||p.statusCode===203){let b=v?s:i;if(b){if(d=await b(f,{...d,headers:{...c}}),d&&d.cancel)throw new el;d&&(eS(c,d),v=!0,g=!0)}}else p.statusCode===200&&v&&n&&await n(f,d);while(g);if(p.statusCode!==200){let{response:b}=await zg(p);throw new Xo(p.statusCode,p.statusMessage,b)}if(p.headers["content-type"]===`application/x-${o}-advertisement`){let b=await QE(p.body,{service:o});return b.auth=d,b}else{let{preview:b,response:_,data:C}=await zg(p);try{let x=await QE([C],{service:o});return x.auth=d,x}catch(x){throw new nu(b,_)}}}static async connect({http:e,onProgress:r,corsProxy:i,service:n,url:s,auth:a,body:o,headers:l}){let c=KE(s);c&&(s=c.url),i&&(s=JE(i,s)),l["content-type"]=`application/x-${n}-request`,l.accept=`application/x-${n}-result`,eS(l,a);let u=await e.request({onProgress:r,method:"POST",url:`${s}/${n}`,body:o,headers:l});if(u.statusCode!==200){let{response:f}=zg(u);throw new Xo(u.statusCode,u.statusMessage,f)}return u}},nl=class{static getRemoteHelperFor({url:e}){let r=new Map;r.set("http",il),r.set("https",il);let i=lN({url:e});if(!i)throw new au(e);if(r.has(i.transport))return r.get(i.transport);throw new su(e,i.transport,i.transport==="ssh"?oN(e):void 0)}};function lN({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 ya=null,Pa=class{static async read({fs:e,gitdir:r}){ya===null&&(ya=new Yo.default);let i=N(r,"shallow"),n=new Set;return await ya.acquire(i,async function(){let s=await e.read(i,{encoding:"utf8"});if(s===null||s.trim()==="")return n;s.trim().split(` `).map(a=>n.add(a))}),n}static async write({fs:e,gitdir:r,oids:i}){ya===null&&(ya=new Yo.default);let n=N(r,"shallow");if(i.size>0){let s=[...i].join(` `)+` `;await ya.acquire(n,async function(){await e.write(n,s,{encoding:"utf8"})})}else await ya.acquire(n,async function(){await e.rm(n)})}};async function cN({fs:t,gitdir:e,oid:r}){let i=`objects/${r.slice(0,2)}/${r.slice(2)}`;return t.exists(`${e}/${i}`)}async function uN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=await t.readdir(N(r,"objects/pack"));s=s.filter(a=>a.endsWith(".idx"));for(let a of s){let o=`${r}/objects/pack/${a}`,l=await av({fs:t,cache:e,filename:o,getExternalRefDelta:n});if(l.error)throw new he(l.error);if(l.offsets.has(i))return!0}return!1}async function tS({fs:t,cache:e,gitdir:r,oid:i,format:n="content"}){let s=o=>st({fs:t,cache:e,gitdir:r,oid:o}),a=await cN({fs:t,gitdir:r,oid:i});return a||(a=await uN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:s})),a}function $d({config:t,onAuth:e}){return e&&(async(r,i)=>{let n=i.username||await t.get(`credential.${r}.username`);return e(r,n?{...i,username:n}:i)})}function fN(t){let n="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===n}function AS(t,e){let r=t.map(i=>i.split("=",1)[0]);return e.filter(i=>{let n=i.split("=",1)[0];return r.includes(n)})}var Ld={name:"isomorphic-git",version:"1.40.0",agent:"git/isomorphic-git@1.40.0"},qo=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 r=this._waiting;this._waiting=null,r({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};function dN(t){let e=t.indexOf("\r"),r=t.indexOf(` `);return e===-1&&r===-1?-1:e===-1?r+1:r===-1?e+1:r===e+1?r+1:Math.min(e,r)+1}function TS(t){let e=new qo,r="";return(async()=>(await vu(t,i=>{for(i=i.toString("utf8"),r+=i;;){let n=dN(r);if(n===-1)break;e.write(r.slice(0,n)),r=r.slice(n)}}),r.length>0&&e.write(r),e.end()))(),e}var Fd=class{static demux(e){let r=dt.streamReader(e),i=new qo,n=new qo,s=new qo,a=async function(){let o=await r();if(o===null)return a();if(o===!0){i.end(),s.end(),e.error?n.destroy(e.error):n.end();return}switch(o[0]){case 1:{n.write(o.slice(1));break}case 2:{s.write(o.slice(1));break}case 3:{let l=o.slice(1);s.write(l),i.end(),s.end(),n.destroy(new Error(l.toString("utf8")));return}default:i.write(o)}a()};return a(),{packetlines:i,packfile:n,progress:s}}};async function hN(t){let{packetlines:e,packfile:r,progress:i}=Fd.demux(t),n=[],s=[],a=[],o=!1,l=!1;return new Promise((c,u)=>{vu(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new Ms(h)),n.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new Ms(h)),s.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");a.push({oid:h,status:p}),p||(l=!0)}else d.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:n,unshallows:s,acks:a,nak:o,packfile:r,progress:i}))})})}function pN({capabilities:t=[],wants:e=[],haves:r=[],shallows:i=[],depth:n=null,since:s=null,exclude:a=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)o.push(dt.encode(`want ${c}${l} `)),l="";for(let c of i)o.push(dt.encode(`shallow ${c} `));n!==null&&o.push(dt.encode(`deepen ${n} `)),s!==null&&o.push(dt.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)} `));for(let c of a)o.push(dt.encode(`deepen-not ${c} `));o.push(dt.flush());for(let c of r)o.push(dt.encode(`have ${c} `));return o.push(dt.encode(`done `)),o}async function lv({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:l,ref:c,remoteRef:u,remote:f,url:d,corsProxy:h,depth:p=null,since:g=null,exclude:v=[],relative:b=!1,tags:_=!1,singleBranch:C=!1,headers:x={},prune:E=!1,pruneTags:A=!1}){let w=c||await Bs({fs:t,gitdir:l,test:!0}),S=await vt.get({fs:t,gitdir:l}),y=f||w&&await S.get(`branch.${w}.remote`)||"origin",P=d||await S.get(`remote.${y}.url`);if(typeof P=="undefined")throw new Or("remote OR url");let T=u||w&&await S.get(`branch.${w}.merge`)||c||"HEAD";h===void 0&&(h=await S.get("http.corsProxy"));let I=nl.getRemoteHelperFor({url:P}),M=await I.discover({http:r,onAuth:$d({config:S,onAuth:s}),onAuthSuccess:a,onAuthFailure:$d({config:S,onAuth:o}),corsProxy:h,service:"git-upload-pack",url:P,headers:x,protocolVersion:1}),B=M.auth,re=M.refs;if(re.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!M.capabilities.has("shallow"))throw new Is("shallow","depth");if(g!==null&&!M.capabilities.has("deepen-since"))throw new Is("deepen-since","since");if(v.length>0&&!M.capabilities.has("deepen-not"))throw new Is("deepen-not","exclude");if(b===!0&&!M.capabilities.has("deepen-relative"))throw new Is("deepen-relative","relative");let{oid:Ae,fullref:K}=q.resolveAgainstMap({ref:T,map:re});for(let L of re.keys())L===K||L==="HEAD"||L.startsWith("refs/heads/")||_&&L.startsWith("refs/tags/")||re.delete(L);let Q=AS([...M.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Ld.agent}`]);b&&Q.push("deepen-relative");let fe=C?[Ae]:re.values(),ce=C?[w]:await q.listRefs({fs:t,gitdir:l,filepath:"refs"}),z=[];for(let L of ce)try{L=await q.expand({fs:t,gitdir:l,ref:L});let W=await q.resolve({fs:t,gitdir:l,ref:L});await tS({fs:t,cache:e,gitdir:l,oid:W})&&z.push(W)}catch(W){}z=[...new Set(z)];let X=await Pa.read({fs:t,gitdir:l}),j=M.capabilities.has("shallow")?[...X]:[],Ze=pN({capabilities:Q,wants:fe,haves:z,shallows:j,depth:p,since:g,exclude:v}),$r=k.from(await Rd(Ze)),cr=await I.connect({http:r,onProgress:i,corsProxy:h,service:"git-upload-pack",url:P,auth:B,body:[$r],headers:x}),Ie=await hN(cr.body);cr.headers&&(Ie.headers=cr.headers);for(let L of Ie.shallows)if(!X.has(L))try{let{object:W}=await st({fs:t,cache:e,gitdir:l,oid:L}),xe=new Nr(W),Xe=await Promise.all(xe.headers().parent.map(ti=>tS({fs:t,cache:e,gitdir:l,oid:ti})));Xe.length===0||Xe.every(ti=>ti)||X.add(L)}catch(W){X.add(L)}for(let L of Ie.unshallows)X.delete(L);if(await Pa.write({fs:t,gitdir:l,oids:X}),C){let L=new Map([[K,Ae]]),W=new Map,xe=10,Xe=K;for(;xe--;){let aa=M.symrefs.get(Xe);if(aa===void 0)break;W.set(Xe,aa),Xe=aa}let Dt=re.get(Xe);Dt&&L.set(Xe,Dt);let{pruned:ti}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:y,refs:L,symrefs:W,tags:_,prune:E});E&&(Ie.pruned=ti)}else{let{pruned:L}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:y,refs:re,symrefs:M.symrefs,tags:_,prune:E,pruneTags:A});E&&(Ie.pruned=L)}if(Ie.HEAD=M.symrefs.get("HEAD"),Ie.HEAD===void 0){let{oid:L}=q.resolveAgainstMap({ref:"HEAD",map:re});for(let[W,xe]of re.entries())if(W!=="HEAD"&&xe===L){Ie.HEAD=W;break}}let yt=K.startsWith("refs/tags")?"tag":"branch";if(Ie.FETCH_HEAD={oid:Ae,description:`${yt} '${xa(K)}' of ${P}`},i||n){let L=TS(Ie.progress);vu(L,async W=>{if(n&&await n(W),i){let xe=W.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);xe&&await i({phase:xe[1].trim(),loaded:parseInt(xe[2],10),total:parseInt(xe[3],10)})}})}let Tt=k.from(await Rd(Ie.packfile));if(cr.body.error)throw cr.body.error;let Ke=Tt.slice(-20).toString("hex"),J={defaultBranch:Ie.HEAD,fetchHead:Ie.FETCH_HEAD.oid,fetchHeadDescription:Ie.FETCH_HEAD.description};if(Ie.headers&&(J.headers=Ie.headers),E&&(J.pruned=Ie.pruned),Ke!==""&&!fN(Tt)){J.packfile=`objects/pack/pack-${Ke}.pack`;let L=N(l,J.packfile);await t.write(L,Tt);let W=Xe=>st({fs:t,cache:e,gitdir:l,oid:Xe}),xe=await qc.fromPack({pack:Tt,getExternalRefDelta:W,onProgress:i});await t.write(L.replace(/\.pack$/,".idx"),await xe.toBuffer())}return J}async function PS({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:N(r,".git"),defaultBranch:n="master"}){if(await t.exists(i+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(a=>i+"/"+a);for(let a of s)await t.mkdir(a);await t.write(i+"/config",`[core] repositoryformatversion = 0 filemode = false bare = ${e} `+(e?"":` logallrefupdates = true `)+` symlinks = false ignorecase = true `),await t.write(i+"/HEAD",`ref: refs/heads/${n} `)}async function mN({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:p,depth:g,since:v,exclude:b,relative:_,singleBranch:C,noCheckout:x,noTags:E,headers:A,nonBlocking:w,batchSize:S=100}){try{if(await PS({fs:t,gitdir:u}),await yS({fs:t,gitdir:u,remote:p,url:f,force:!1}),d){let T=await vt.get({fs:t,gitdir:u});await T.set("http.corsProxy",d),await vt.save({fs:t,gitdir:u,config:T})}let{defaultBranch:y,fetchHead:P}=await lv({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:u,ref:h,remote:p,corsProxy:d,depth:g,since:v,exclude:b,relative:_,singleBranch:C,headers:A,tags:!E});if(P===null)return;h=h||y,h=h.replace("refs/heads/",""),await ov({fs:t,cache:e,onProgress:i,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:p,noCheckout:x,nonBlocking:w,batchSize:S})}catch(y){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),y}}async function gN({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:c=N(l,".git"),url:u,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:p=void 0,since:g=void 0,exclude:v=[],relative:b=!1,singleBranch:_=!1,noCheckout:C=!1,noTags:x=!1,headers:E={},cache:A={},nonBlocking:w=!1,batchSize:S=100}){try{R("fs",t),R("http",e),R("gitdir",c),C||R("dir",l),R("url",u);let y=new te(t),P=await ie({fsp:y,dotgit:c});return await mN({fs:y,cache:A,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPostCheckout:o,dir:l,gitdir:P,url:u,corsProxy:f,ref:d,remote:h,depth:p,since:g,exclude:v,relative:b,singleBranch:_,noCheckout:C,noTags:x,headers:E,nonBlocking:w,batchSize:S})}catch(y){throw y.caller="git.clone",y}}async function vN({fs:t,onSign:e,dir:r,gitdir:i=N(r,".git"),message:n,author:s,committer:a,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,disallowEmpty:f=!1,ref:d,parent:h,tree:p,cache:g={}}){try{R("fs",t),l||R("message",n),o&&R("onSign",e);let v=new te(t),b=await ie({fsp:v,dotgit:i});return await pu({fs:v,cache:g,onSign:e,gitdir:b,message:n,author:s,committer:a,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,disallowEmpty:f,ref:d,parent:h,tree:p})}catch(v){throw v.caller="git.commit",v}}async function wN({fs:t,dir:e,gitdir:r=N(e,".git"),fullname:i=!1,test:n=!1}){try{R("fs",t),R("gitdir",r);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await Bs({fs:s,gitdir:a,fullname:i,test:n})}catch(s){throw s.caller="git.currentBranch",s}}async function bN({fs:t,gitdir:e,ref:r}){if(r=r.startsWith("refs/heads/")?r:`refs/heads/${r}`,!await q.exists({fs:t,gitdir:e,ref:r}))throw new ze(r);let n=await q.expand({fs:t,gitdir:e,ref:r}),s=await Bs({fs:t,gitdir:e,fullname:!0});if(n===s){let l=await q.resolve({fs:t,gitdir:e,ref:n});await q.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await q.deleteRef({fs:t,gitdir:e,ref:n});let a=xa(r),o=await vt.get({fs:t,gitdir:e});await o.deleteSection("branch",a),await vt.save({fs:t,gitdir:e,config:o})}async function _N({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i}){try{R("fs",t),R("ref",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await bN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteBranch",n}}async function yN({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i}){try{R("fs",t),R("ref",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});await q.deleteRef({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteRef",n}}async function xN({fs:t,gitdir:e,remote:r}){let i=await vt.get({fs:t,gitdir:e});await i.deleteSection("remote",r),await vt.save({fs:t,gitdir:e,config:i})}async function EN({fs:t,dir:e,gitdir:r=N(e,".git"),remote:i}){try{R("fs",t),R("remote",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await xN({fs:n,gitdir:s,remote:i})}catch(n){throw n.caller="git.deleteRemote",n}}async function SN({fs:t,gitdir:e,ref:r}){r=r.startsWith("refs/tags/")?r:`refs/tags/${r}`,await q.deleteRef({fs:t,gitdir:e,ref:r})}async function kN({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i}){try{R("fs",t),R("ref",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await SN({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.deleteTag",n}}async function CN({fs:t,gitdir:e,oid:r}){let i=r.slice(0,2);return(await t.readdir(`${e}/objects/${i}`)).map(s=>`${i}${s}`).filter(s=>s.startsWith(r))}async function AN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n}){let s=[],a=await t.readdir(N(r,"objects/pack"));a=a.filter(o=>o.endsWith(".idx"));for(let o of a){let l=`${r}/objects/pack/${o}`,c=await av({fs:t,cache:e,filename:l,getExternalRefDelta:n});if(c.error)throw new he(c.error);for(let u of c.offsets.keys())u.startsWith(i)&&s.push(u)}return s}async function TN({fs:t,cache:e,gitdir:r,oid:i}){let n=o=>st({fs:t,cache:e,gitdir:r,oid:o}),s=await CN({fs:t,gitdir:r,oid:i}),a=await AN({fs:t,cache:e,gitdir:r,oid:i,getExternalRefDelta:n});for(let o of a)s.indexOf(o)===-1&&s.push(o);if(s.length===1)return s[0];throw s.length>1?new Yc("oids",i,s):new ze(`an object matching "${i}"`)}async function PN({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await TN({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.expandOid",s}}async function RN({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i}){try{R("fs",t),R("gitdir",r),R("ref",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await q.expand({fs:n,gitdir:s,ref:i})}catch(n){throw n.caller="git.expandRef",n}}async function cv({fs:t,cache:e,gitdir:r,oids:i}){let n={},s=i.length,a=i.map((o,l)=>({index:l,oid:o}));for(;a.length;){let o=new Set;for(let{oid:c,index:u}of a)n[c]||(n[c]=new Set),n[c].add(u),n[c].size===s&&o.add(c);if(o.size>0)return[...o];let l=new Map;for(let{oid:c,index:u}of a)try{let{object:f}=await st({fs:t,cache:e,gitdir:r,oid:c}),d=Nr.from(f),{parent:h}=d.parseHeaders();for(let p of h)(!n[p]||!n[p].has(u))&&l.set(p+":"+u,{oid:p,index:u})}catch(f){}a=Array.from(l.values())}return[]}async function RS({fs:t,cache:e,dir:r,gitdir:i,ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,onSign:g,mergeDriver:v,allowUnrelatedHistories:b=!1}){n===void 0&&(n=await Bs({fs:t,gitdir:i,fullname:!0})),n=await q.expand({fs:t,gitdir:i,ref:n}),s=await q.expand({fs:t,gitdir:i,ref:s});let _=await q.resolve({fs:t,gitdir:i,ref:n}),C=await q.resolve({fs:t,gitdir:i,ref:s}),x=await cv({fs:t,cache:e,gitdir:i,oids:[_,C]});if(x.length!==1)if(x.length===0&&b)x.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new Qo;let E=x[0];if(E===C)return{oid:_,alreadyMerged:!0};if(a&&E===_)return!l&&!c&&await q.writeRef({fs:t,gitdir:i,ref:n,value:C}),{oid:C,fastForward:!0};{if(o)throw new tu;let A=await gt.acquire({fs:t,gitdir:i,cache:e,allowUnmerged:!1},async S=>SS({fs:t,cache:e,dir:r,gitdir:i,index:S,ourOid:_,theirOid:C,baseOid:E,ourName:xa(n),baseName:"base",theirName:xa(s),dryRun:l,abortOnConflict:u,mergeDriver:v}));if(A instanceof ka)throw A;return f||(f=`Merge branch '${xa(s)}' into ${xa(n)}`),{oid:await pu({fs:t,cache:e,gitdir:i,message:f,ref:n,tree:A,parent:[_,C],author:d,committer:h,signingKey:p,onSign:g,dryRun:l,noUpdateBranch:c}),tree:A,mergeCommit:!0}}}async function $S({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,dir:l,gitdir:c,ref:u,url:f,remote:d,remoteRef:h,prune:p,pruneTags:g,fastForward:v,fastForwardOnly:b,corsProxy:_,singleBranch:C,headers:x,author:E,committer:A,signingKey:w}){try{if(!u){let P=await Bs({fs:t,gitdir:c});if(!P)throw new Or("ref");u=P}let{fetchHead:S,fetchHeadDescription:y}=await lv({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,gitdir:c,corsProxy:_,ref:u,url:f,remote:d,remoteRef:h,singleBranch:C,headers:x,prune:p,pruneTags:g});await RS({fs:t,cache:e,gitdir:c,ours:u,theirs:S,fastForward:v,fastForwardOnly:b,message:`Merge ${y}`,author:E,committer:A,signingKey:w,dryRun:!1,noUpdateBranch:!1}),await ov({fs:t,cache:e,onProgress:i,dir:l,gitdir:c,ref:u,remote:d,noCheckout:!1})}catch(S){throw S.caller="git.pull",S}}async function $N({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:l=N(o,".git"),ref:c,url:u,remote:f,remoteRef:d,corsProxy:h,singleBranch:p,headers:g={},cache:v={}}){try{R("fs",t),R("http",e),R("gitdir",l);let b={name:"",email:"",timestamp:Date.now(),timezoneOffset:0},_=new te(t),C=await ie({fsp:_,dotgit:l});return await $S({fs:_,cache:v,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:C,ref:c,url:u,remote:f,remoteRef:d,fastForwardOnly:!0,corsProxy:h,singleBranch:p,headers:g,author:b,committer:b})}catch(b){throw b.caller="git.fastForward",b}}async function FN({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:l=N(o,".git"),ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:p=null,since:g=null,exclude:v=[],relative:b=!1,tags:_=!1,singleBranch:C=!1,headers:x={},prune:E=!1,pruneTags:A=!1,cache:w={}}){try{R("fs",t),R("http",e),R("gitdir",l);let S=new te(t),y=await ie({fsp:S,dotgit:l});return await lv({fs:S,cache:w,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,gitdir:y,ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:p,since:g,exclude:v,relative:b,tags:_,singleBranch:C,headers:x,prune:E,pruneTags:A})}catch(S){throw S.caller="git.fetch",S}}async function IN({fs:t,dir:e,gitdir:r=N(e,".git"),oids:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("oids",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await cv({fs:s,cache:n,gitdir:a,oids:i})}catch(s){throw s.caller="git.findMergeBase",s}}async function FS({fs:t,filepath:e}){if(await t.exists(N(e,".git")))return e;{let r=Sa(e);if(r===e)throw new ze(`git root for ${e}`);return FS({fs:t,filepath:r})}}async function MN({fs:t,filepath:e}){try{return R("fs",t),R("filepath",e),await FS({fs:new te(t),filepath:e})}catch(r){throw r.caller="git.findRoot",r}}async function DN({fs:t,dir:e,gitdir:r=N(e,".git"),path:i}){try{R("fs",t),R("gitdir",r),R("path",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await cu({fs:n,gitdir:s,path:i})}catch(n){throw n.caller="git.getConfig",n}}async function ON({fs:t,gitdir:e,path:r}){return(await vt.get({fs:t,gitdir:e})).getall(r)}async function LN({fs:t,dir:e,gitdir:r=N(e,".git"),path:i}){try{R("fs",t),R("gitdir",r),R("path",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await ON({fs:n,gitdir:s,path:i})}catch(n){throw n.caller="git.getConfigAll",n}}async function NN({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1}){try{R("http",t),R("url",s);let c=await nl.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:1}),u={capabilities:[...c.capabilities]};for(let[f,d]of c.refs){let h=f.split("/"),p=h.pop(),g=u;for(let v of h)g[v]=g[v]||{},g=g[v];g[p]=d}for(let[f,d]of c.symrefs){let h=f.split("/"),p=h.pop(),g=u;for(let v of h)g[v]=g[v]||{},g=g[v];g[p]=d}return u}catch(l){throw l.caller="git.getRemoteInfo",l}}function IS(t,e,r,i){let n=[];for(let[s,a]of t.refs){if(e&&!s.startsWith(e))continue;if(s.endsWith("^{}")){if(i){let l=s.replace("^{}",""),c=n[n.length-1],u=c.ref===l?c:n.find(f=>f.ref===l);if(u===void 0)throw new Error("I did not expect this to happen");u.peeled=a}continue}let o={ref:s,oid:a};r&&t.symrefs.has(s)&&(o.target=t.symrefs.get(s)),n.push(o)}return n}async function BN({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1,protocolVersion:l=2}){try{R("http",t),R("url",s);let u=await nl.getRemoteHelperFor({url:s}).discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:l});if(u.protocolVersion===2)return{protocolVersion:u.protocolVersion,capabilities:u.capabilities2};let f={};for(let d of u.capabilities){let[h,p]=d.split("=");p?f[h]=p:f[h]=!0}return{protocolVersion:1,capabilities:f,refs:IS(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}async function HN({type:t,object:e,format:r="content",oid:i=void 0}){return r!=="deflated"&&(r!=="wrapped"&&(e=Ds.wrap({type:t,object:e})),i=await En(e)),{oid:i,object:e}}async function UN({object:t}){try{R("object",t),typeof t=="string"?t=k.from(t,"utf8"):t instanceof Uint8Array||(t=new Uint8Array(t));let e="blob",{oid:r,object:i}=await HN({type:e,format:"content",object:t});return{oid:r,type:e,object:i,format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}async function GN({fs:t,cache:e,onProgress:r,dir:i,gitdir:n,filepath:s}){try{s=N(i,s);let a=await t.read(s),o=c=>st({fs:t,cache:e,gitdir:n,oid:c}),l=await qc.fromPack({pack:a,getExternalRefDelta:o,onProgress:r});return await t.write(s.replace(/\.pack$/,".idx"),await l.toBuffer()),{oids:[...l.hashes]}}catch(a){throw a.caller="git.indexPack",a}}async function jN({fs:t,onProgress:e,dir:r,gitdir:i=N(r,".git"),filepath:n,cache:s={}}){try{R("fs",t),R("dir",r),R("gitdir",r),R("filepath",n);let a=new te(t),o=await ie({fsp:a,dotgit:i});return await GN({fs:a,cache:s,onProgress:e,dir:r,gitdir:o,filepath:n})}catch(a){throw a.caller="git.indexPack",a}}async function VN({fs:t,bare:e=!1,dir:r,gitdir:i=e?r:N(r,".git"),defaultBranch:n="master"}){try{R("fs",t),R("gitdir",i),e||R("dir",r);let s=new te(t),a=await ie({fsp:s,dotgit:i});return await PS({fs:s,bare:e,dir:r,gitdir:a,defaultBranch:n})}catch(s){throw s.caller="git.init",s}}async function MS({fs:t,cache:e,gitdir:r,oid:i,ancestor:n,depth:s}){let a=await Pa.read({fs:t,gitdir:r});if(!i)throw new Or("oid");if(!n)throw new Or("ancestor");if(i===n)return!1;let o=[i],l=new Set,c=0;for(;o.length;){if(c++===s)throw new iu(s);let u=o.shift(),{type:f,object:d}=await st({fs:t,cache:e,gitdir:r,oid:u});if(f!=="commit")throw new xr(u,f,"commit");let h=Nr.from(d).parse();for(let p of h.parent)if(p===n)return!0;if(!a.has(u))for(let p of h.parent)l.has(p)||(o.push(p),l.add(p))}return!1}async function zN({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,ancestor:n,depth:s=-1,cache:a={}}){try{R("fs",t),R("gitdir",r),R("oid",i),R("ancestor",n);let o=new te(t),l=await ie({fsp:o,dotgit:r});return await MS({fs:o,cache:a,gitdir:l,oid:i,ancestor:n,depth:s})}catch(o){throw o.caller="git.isDescendent",o}}async function WN({fs:t,dir:e,gitdir:r=N(e,".git"),filepath:i}){try{R("fs",t),R("dir",e),R("gitdir",r),R("filepath",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return Ls.isIgnored({fs:n,dir:e,gitdir:s,filepath:i})}catch(n){throw n.caller="git.isIgnored",n}}async function qN({fs:t,dir:e,gitdir:r=N(e,".git"),remote:i}){try{R("fs",t),R("gitdir",r);let n=new te(t),s=await ie({fsp:n,dotgit:r});return q.listBranches({fs:n,gitdir:s,remote:i})}catch(n){throw n.caller="git.listBranches",n}}async function YN({fs:t,gitdir:e,ref:r,cache:i}){if(r){let n=await q.resolve({gitdir:e,fs:t,ref:r}),s=[];return await DS({fs:t,cache:i,gitdir:e,oid:n,filenames:s,prefix:""}),s}else return gt.acquire({fs:t,gitdir:e,cache:i},async function(n){return n.entries.map(s=>s.path)})}async function DS({fs:t,cache:e,gitdir:r,oid:i,filenames:n,prefix:s}){let{tree:a}=await al({fs:t,cache:e,gitdir:r,oid:i});for(let o of a)o.type==="tree"?await DS({fs:t,cache:e,gitdir:r,oid:o.oid,filenames:n,prefix:N(s,o.path)}):n.push(N(s,o.path))}async function ZN({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i,cache:n={}}){try{R("fs",t),R("gitdir",r);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await YN({fs:s,cache:n,gitdir:a,ref:i})}catch(s){throw s.caller="git.listFiles",s}}async function KN({fs:t,cache:e,gitdir:r,ref:i}){let n;try{n=await q.resolve({gitdir:r,fs:t,ref:i})}catch(o){if(o instanceof ze)return[]}return(await al({fs:t,cache:e,gitdir:r,oid:n})).tree.map(o=>({target:o.path,note:o.oid}))}async function XN({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i="refs/notes/commits",cache:n={}}){try{R("fs",t),R("gitdir",r),R("ref",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await KN({fs:s,cache:n,gitdir:a,ref:i})}catch(s){throw s.caller="git.listNotes",s}}async function QN({fs:t,dir:e,gitdir:r=N(e,".git"),filepath:i}){try{R("fs",t),R("gitdir",r);let n=new te(t),s=await ie({fsp:n,dotgit:r});return q.listRefs({fs:n,gitdir:s,filepath:i})}catch(n){throw n.caller="git.listRefs",n}}async function JN({fs:t,gitdir:e}){let r=await vt.get({fs:t,gitdir:e}),i=await r.getSubsections("remote");return Promise.all(i.map(async s=>{let a=await r.get(`remote.${s}.url`);return{remote:s,url:a}}))}async function eB({fs:t,dir:e,gitdir:r=N(e,".git")}){try{R("fs",t),R("gitdir",r);let i=new te(t),n=await ie({fsp:i,dotgit:r});return await JN({fs:i,gitdir:n})}catch(i){throw i.caller="git.listRemotes",i}}async function tB(t){let e=dt.streamReader(t),r=[],i;for(;i=await e(),i!==!0;){if(i===null)continue;i=i.toString("utf8").replace(/\n$/,"");let[n,s,...a]=i.split(" "),o={ref:s,oid:n};for(let l of a){let[c,u]=l.split(":");c==="symref-target"?o.target=u:c==="peeled"&&(o.peeled=u)}r.push(o)}return r}async function rB({prefix:t,symrefs:e,peelTags:r}){let i=[];return i.push(dt.encode(`command=ls-refs `)),i.push(dt.encode(`agent=${Ld.agent} `)),(r||e||t)&&i.push(dt.delim()),r&&i.push(dt.encode("peel")),e&&i.push(dt.encode("symrefs")),t&&i.push(dt.encode(`ref-prefix ${t}`)),i.push(dt.flush()),i}async function iB({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,url:s,headers:a={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{R("http",t),R("url",s);let d=await il.discover({http:t,onAuth:e,onAuthSuccess:r,onAuthFailure:i,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,headers:a,protocolVersion:l});if(d.protocolVersion===1)return IS(d,c,u,f);let h=await rB({prefix:c,symrefs:u,peelTags:f}),p=await il.connect({http:t,auth:d.auth,headers:a,corsProxy:n,service:o?"git-receive-pack":"git-upload-pack",url:s,body:h});return tB(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function nB({fs:t,dir:e,gitdir:r=N(e,".git")}){try{R("fs",t),R("gitdir",r);let i=new te(t),n=await ie({fsp:i,dotgit:r});return q.listTags({fs:i,gitdir:n})}catch(i){throw i.caller="git.listTags",i}}function sB(t,e){return t.committer.timestamp-e.committer.timestamp}var aB="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function rS({fs:t,cache:e,gitdir:r,oid:i,fileId:n}){if(n===aB)return;let s=i,a,o=await tl({fs:t,cache:e,gitdir:r,oid:i}),l=o.tree;return n===o.oid?a=o.path:(a=await OS({fs:t,cache:e,gitdir:r,tree:l,fileId:n,oid:s}),Array.isArray(a)&&(a.length===0?a=void 0:a.length===1&&(a=a[0]))),a}async function OS({fs:t,cache:e,gitdir:r,tree:i,fileId:n,oid:s,filepaths:a=[],parentPath:o=""}){let l=i.entries().map(function(c){let u;return c.oid===n?(u=N(o,c.path),a.push(u)):c.type==="tree"&&(u=st({fs:t,cache:e,gitdir:r,oid:c.oid}).then(function({object:f}){return OS({fs:t,cache:e,gitdir:r,tree:Lr.from(f),fileId:n,oid:s,filepaths:a,parentPath:N(o,c.path)})})),u});return await Promise.all(l),a}async function oB({fs:t,cache:e,gitdir:r,filepath:i,ref:n,depth:s,since:a,force:o,follow:l,includeChanges:c}){let u=typeof a=="undefined"?void 0:Math.floor(a.valueOf()/1e3),f=[],d=await Pa.read({fs:t,gitdir:r}),h=await q.resolve({fs:t,gitdir:r,ref:n}),p=[await xn({fs:t,cache:e,gitdir:r,oid:h})],g,v,b;function _(C){b&&i&&f.push(C)}for(;p.length>0;){let C=p.pop();if(u!==void 0&&C.commit.committer.timestamp<=u)break;if(i){let x;try{x=await mu({fs:t,cache:e,gitdir:r,oid:C.commit.tree,filepath:i}),v&&g!==x&&f.push(v),g=x,v=C,b=!0}catch(E){if(E instanceof ze){let A=l&&g;if(A&&(A=await rS({fs:t,cache:e,gitdir:r,oid:C.commit.tree,fileId:g}),A))if(Array.isArray(A)){if(v){let w=await rS({fs:t,cache:e,gitdir:r,oid:v.commit.tree,fileId:g});if(Array.isArray(w))if(A=A.filter(S=>w.indexOf(S)===-1),A.length===1)A=A[0],i=A,v&&f.push(v);else{A=!1,v&&f.push(v);break}}}else i=A,v&&f.push(v);if(!A){if(b&&g&&(f.push(v),!o))break;if(!o&&!l)throw E}v=C,b=!1}else throw E}}else f.push(C);if(s!==void 0&&f.length===s){_(C);break}if(!d.has(C.oid))for(let x of C.commit.parent){let E=await xn({fs:t,cache:e,gitdir:r,oid:x});p.map(A=>A.oid).includes(E.oid)||p.push(E)}p.length===0&&_(C),p.sort((x,E)=>sB(x.commit,E.commit))}if(c)for(let C of f)C.commit.changes=await lB({fs:t,cache:e,gitdir:r,commit:C,shallow:d.has(C.oid)});return f}async function lB({fs:t,cache:e,gitdir:r,commit:i,shallow:n}){let s=n||!i.commit.parent[0]?"4b825dc642cb6eb9a060e54bf8d69288fbee4904":i.commit.parent[0];return Jn({fs:t,cache:e,gitdir:r,trees:[Dr({ref:i.oid}),Dr({ref:s})],map:async(a,[o,l])=>{let[c,u]=await Promise.all([o&&o.type(),l&&l.type()]);if(c==="tree")return u&&u!=="tree"?[null,await l.oid(),a]:void 0;if(u==="tree")return c?[await o.oid(),null,a]:void 0;let[f,d]=await Promise.all([o?o.oid():null,l?l.oid():null]);if(f!==d)return[f,d,a]}})}async function cB({fs:t,dir:e,gitdir:r=N(e,".git"),filepath:i,ref:n="HEAD",depth:s,since:a,force:o,follow:l,includeChanges:c=!1,cache:u={}}){try{R("fs",t),R("gitdir",r),R("ref",n);let f=new te(t),d=await ie({fsp:f,dotgit:r});return await oB({fs:f,cache:u,gitdir:d,filepath:i,ref:n,depth:s,since:a,force:o,follow:l,includeChanges:c})}catch(f){throw f.caller="git.log",f}}async function uB({fs:t,onSign:e,dir:r,gitdir:i=N(r,".git"),ours:n,theirs:s,fastForward:a=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,cache:g={},mergeDriver:v,allowUnrelatedHistories:b=!1}){try{R("fs",t),p&&R("onSign",e);let _=new te(t),C=await ie({fsp:_,dotgit:i}),x=await Ns({fs:_,gitdir:C,author:d});if(!x&&(!o||!a))throw new Jt("author");let E=await Ta({fs:_,gitdir:C,author:x,committer:h});if(!E&&(!o||!a))throw new Jt("committer");return await RS({fs:_,cache:g,dir:r,gitdir:C,ours:n,theirs:s,fastForward:a,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:x,committer:E,signingKey:p,onSign:e,mergeDriver:v,allowUnrelatedHistories:b})}catch(_){throw _.caller="git.merge",_}}var fB={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function LS({fs:t,cache:e,dir:r,gitdir:i=N(r,".git"),oids:n}){let s=new sv.default,a=[];function o(u,f){let d=k.from(u,f);a.push(d),s.update(d)}async function l({stype:u,object:f}){let d=fB[u],h=f.length,p=h>15?128:0,g=h&15;h=h>>>4;let v=(p|d|g).toString(16);for(o(v,"hex");p;)p=h>127?128:0,v=p|h&127,o(nv(2,v),"hex"),h=h>>>7;o(k.from(await mS(f)))}o("PACK"),o("00000002","hex"),o(nv(8,n.length),"hex");for(let u of n){let{type:f,object:d}=await st({fs:t,cache:e,gitdir:i,oid:u});await l({write:o,object:d,stype:f})}let c=s.digest();return a.push(c),a}async function dB({fs:t,cache:e,gitdir:r,oids:i,write:n}){let s=await LS({fs:t,cache:e,gitdir:r,oids:i}),a=k.from(await Rd(s)),l=`pack-${a.slice(-20).toString("hex")}.pack`;return n?(await t.write(N(r,`objects/pack/${l}`),a),{filename:l}):{filename:l,packfile:new Uint8Array(a)}}async function hB({fs:t,dir:e,gitdir:r=N(e,".git"),oids:i,write:n=!1,cache:s={}}){try{R("fs",t),R("gitdir",r),R("oids",i);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await dB({fs:a,cache:s,gitdir:o,oids:i,write:n})}catch(a){throw a.caller="git.packObjects",a}}async function pB({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:l=N(o,".git"),ref:c,url:u,remote:f,remoteRef:d,prune:h=!1,pruneTags:p=!1,fastForward:g=!0,fastForwardOnly:v=!1,corsProxy:b,singleBranch:_,headers:C={},author:x,committer:E,signingKey:A,cache:w={}}){try{R("fs",t),R("gitdir",l);let S=new te(t),y=await ie({fsp:S,dotgit:l}),P=await Ns({fs:S,gitdir:y,author:x});if(!P)throw new Jt("author");let T=await Ta({fs:S,gitdir:y,author:P,committer:E});if(!T)throw new Jt("committer");return await $S({fs:S,cache:w,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,dir:o,gitdir:y,ref:c,url:u,remote:f,remoteRef:d,fastForward:g,fastForwardOnly:v,corsProxy:b,singleBranch:_,headers:C,author:P,committer:T,signingKey:A,prune:h,pruneTags:p})}catch(S){throw S.caller="git.pull",S}}async function mB({fs:t,cache:e,dir:r,gitdir:i=N(r,".git"),start:n,finish:s}){let a=await Pa.read({fs:t,gitdir:i}),o=new Set,l=new Set;for(let f of n)o.add(await q.resolve({fs:t,gitdir:i,ref:f}));for(let f of s)try{let d=await q.resolve({fs:t,gitdir:i,ref:f});l.add(d)}catch(d){}let c=new Set;async function u(f){c.add(f);let{type:d,object:h}=await st({fs:t,cache:e,gitdir:i,oid:f});if(d==="tag"){let g=ni.from(h).headers().object;return u(g)}if(d!=="commit")throw new xr(f,d,"commit");if(!a.has(f)){let g=Nr.from(h).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 Wg({fs:t,cache:e,dir:r,gitdir:i=N(r,".git"),oids:n}){let s=new Set;async function a(o){if(s.has(o))return;s.add(o);let{type:l,object:c}=await st({fs:t,cache:e,gitdir:i,oid:o});if(l==="tag"){let f=ni.from(c).headers().object;await a(f)}else if(l==="commit"){let f=Nr.from(c).headers().tree;await a(f)}else if(l==="tree"){let u=Lr.from(c);for(let f of u)f.type==="blob"&&s.add(f.oid),f.type==="tree"&&await a(f.oid)}}for(let o of n)await a(o);return s}async function gB(t){let e={},r="",i=dt.streamReader(t),n=await i();for(;n!==!0;)n!==null&&(r+=n.toString("utf8")+` `),n=await i();let s=r.toString("utf8").split(` `);if(n=s.shift(),!n.startsWith("unpack "))throw new Aa('unpack ok" or "unpack [error message]',n);e.ok=n==="unpack ok",e.ok||(e.error=n.slice(7)),e.refs={};for(let a of s){if(a.trim()==="")continue;let o=a.slice(0,2),l=a.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 vB({capabilities:t=[],triplets:e=[]}){let r=[],i=`\0 ${t.join(" ")}`;for(let n of e)r.push(dt.encode(`${n.oldoid} ${n.oid} ${n.fullRef}${i} `)),i="";return r.push(dt.flush()),r}async function wB({fs:t,cache:e,http:r,onProgress:i,onMessage:n,onAuth:s,onAuthSuccess:a,onAuthFailure:o,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p=!1,delete:g=!1,corsProxy:v,headers:b={}}){let _=u||await Bs({fs:t,gitdir:c});if(typeof _=="undefined")throw new Or("ref");let C=await vt.get({fs:t,gitdir:c});d=d||await C.get(`branch.${_}.pushRemote`)||await C.get("remote.pushDefault")||await C.get(`branch.${_}.remote`)||"origin";let x=h||await C.get(`remote.${d}.pushurl`)||await C.get(`remote.${d}.url`);if(typeof x=="undefined")throw new Or("remote OR url");let E=f||await C.get(`branch.${_}.merge`);if(typeof x=="undefined")throw new Or("remoteRef");v===void 0&&(v=await C.get("http.corsProxy"));let A=await q.expand({fs:t,gitdir:c,ref:_}),w=g?"0000000000000000000000000000000000000000":await q.resolve({fs:t,gitdir:c,ref:A}),S=nl.getRemoteHelperFor({url:x}),y=await S.discover({http:r,onAuth:$d({config:C,onAuth:s}),onAuthSuccess:a,onAuthFailure:$d({config:C,onAuth:o}),corsProxy:v,service:"git-receive-pack",url:x,headers:b,protocolVersion:1}),P=y.auth,T;if(!E)T=A;else try{T=await q.expandAgainstMap({ref:E,map:y.refs})}catch(X){if(X instanceof ze)T=E.startsWith("refs/")?E:`refs/heads/${E}`;else throw X}let I=y.refs.get(T)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:x,localRef:{ref:g?"(delete)":A,oid:w},remoteRef:{ref:T,oid:I}}))throw new el;let M=!y.capabilities.has("no-thin"),B=new Set;if(!g){let X=[...y.refs.values()],j=new Set;if(I!=="0000000000000000000000000000000000000000"){let Ze=await cv({fs:t,cache:e,gitdir:c,oids:[w,I]});for(let $r of Ze)X.push($r);M&&(j=await Wg({fs:t,cache:e,gitdir:c,oids:Ze}))}if(!X.includes(w)){let Ze=await mB({fs:t,cache:e,gitdir:c,start:[w],finish:X});B=await Wg({fs:t,cache:e,gitdir:c,oids:Ze})}if(M){try{let Ze=await q.resolve({fs:t,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:$r}=await q.resolveAgainstMap({ref:Ze.replace(`refs/remotes/${d}/`,""),fullref:Ze,map:y.refs}),cr=[$r];for(let Ie of await Wg({fs:t,cache:e,gitdir:c,oids:cr}))j.add(Ie)}catch(Ze){}for(let Ze of j)B.delete(Ze)}if(w===I&&(p=!0),!p){if(A.startsWith("refs/tags")&&I!=="0000000000000000000000000000000000000000")throw new Jo("tag-exists");if(w!=="0000000000000000000000000000000000000000"&&I!=="0000000000000000000000000000000000000000"&&!await MS({fs:t,cache:e,gitdir:c,oid:w,ancestor:I,depth:-1}))throw new Jo("not-fast-forward")}}let re=AS([...y.capabilities],["report-status","side-band-64k",`agent=${Ld.agent}`]),Ae=await vB({capabilities:re,triplets:[{oldoid:I,oid:w,fullRef:T}]}),K=g?[]:await LS({fs:t,cache:e,gitdir:c,oids:[...B]}),Q=await S.connect({http:r,onProgress:i,corsProxy:v,service:"git-receive-pack",url:x,auth:P,headers:b,body:[...Ae,...K]}),{packfile:fe,progress:ce}=await Fd.demux(Q.body);if(n){let X=TS(ce);vu(X,async j=>{await n(j)})}let z=await gB(fe);if(Q.headers&&(z.headers=Q.headers),d&&z.ok&&z.refs[T].ok&&!A.startsWith("refs/tags")){let X=`refs/remotes/${d}/${T.replace("refs/heads","")}`;g?await q.deleteRef({fs:t,gitdir:c,ref:X}):await q.writeRef({fs:t,gitdir:c,ref:X,value:w})}if(z.ok&&Object.values(z.refs).every(X=>X.ok))return z;{let X=Object.entries(z.refs).filter(([j,Ze])=>!Ze.ok).map(([j,Ze])=>` - ${j}: ${Ze.error}`).join("");throw new ru(X,z)}}async function bB({fs:t,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,dir:l,gitdir:c=N(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:g=!1,corsProxy:v,headers:b={},cache:_={}}){try{R("fs",t),R("http",e),R("gitdir",c);let C=new te(t),x=await ie({fsp:C,dotgit:c});return await wB({fs:C,cache:_,http:e,onProgress:r,onMessage:i,onAuth:n,onAuthSuccess:s,onAuthFailure:a,onPrePush:o,gitdir:x,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:g,corsProxy:v,headers:b})}catch(C){throw C.caller="git.push",C}}async function NS({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await st({fs:t,cache:e,gitdir:r,oid:i});if(n==="tag")return i=ni.from(s).parse().object,NS({fs:t,cache:e,gitdir:r,oid:i});if(n!=="blob")throw new xr(i,n,"blob");return{oid:i,blob:new Uint8Array(s)}}async function BS({fs:t,cache:e,gitdir:r,oid:i,filepath:n=void 0}){return n!==void 0&&(i=await mu({fs:t,cache:e,gitdir:r,oid:i,filepath:n})),await NS({fs:t,cache:e,gitdir:r,oid:i})}async function wu({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,filepath:n,cache:s={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await BS({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readBlob",a}}async function HS({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await xn({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readCommit",s}}async function _B({fs:t,cache:e,gitdir:r,ref:i="refs/notes/commits",oid:n}){let s=await q.resolve({gitdir:r,fs:t,ref:i}),{blob:a}=await BS({fs:t,cache:e,gitdir:r,oid:s,filepath:n});return a}async function yB({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i="refs/notes/commits",oid:n,cache:s={}}){try{R("fs",t),R("gitdir",r),R("ref",i),R("oid",n);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await _B({fs:a,cache:s,gitdir:o,ref:i,oid:n})}catch(a){throw a.caller="git.readNote",a}}async function xB({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,format:n="parsed",filepath:s=void 0,encoding:a=void 0,cache:o={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let l=new te(t),c=await ie({fsp:l,dotgit:r});s!==void 0&&(i=await mu({fs:l,cache:o,gitdir:c,oid:i,filepath:s}));let f=await st({fs:l,cache:o,gitdir:c,oid:i,format:n==="parsed"?"content":n});if(f.oid=i,n==="parsed")switch(f.format="parsed",f.type){case"commit":f.object=Nr.from(f.object).parse();break;case"tree":f.object=Lr.from(f.object).entries();break;case"blob":a?f.object=f.object.toString(a):(f.object=new Uint8Array(f.object),f.format="content");break;case"tag":f.object=ni.from(f.object).parse();break;default:throw new xr(f.oid,f.type,"blob|commit|tag|tree")}else(f.format==="deflated"||f.format==="wrapped")&&(f.type=f.format);return f}catch(l){throw l.caller="git.readObject",l}}async function EB({fs:t,cache:e,gitdir:r,oid:i}){let{type:n,object:s}=await st({fs:t,cache:e,gitdir:r,oid:i,format:"content"});if(n!=="tag")throw new xr(i,n,"tag");let a=ni.from(s);return{oid:i,tag:a.parse(),payload:a.payload()}}async function SB({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await EB({fs:s,cache:n,gitdir:a,oid:i})}catch(s){throw s.caller="git.readTag",s}}async function kB({fs:t,dir:e,gitdir:r=N(e,".git"),oid:i,filepath:n=void 0,cache:s={}}){try{R("fs",t),R("gitdir",r),R("oid",i);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await al({fs:a,cache:s,gitdir:o,oid:i,filepath:n})}catch(a){throw a.caller="git.readTree",a}}async function CB({fs:t,dir:e,gitdir:r=N(e,".git"),filepath:i,cache:n={}}){try{R("fs",t),R("gitdir",r),R("filepath",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});await gt.acquire({fs:s,gitdir:a,cache:n},async function(o){o.delete({filepath:i})})}catch(s){throw s.caller="git.remove",s}}async function AB({fs:t,cache:e,onSign:r,gitdir:i,ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l}){let c;try{c=await q.resolve({gitdir:i,fs:t,ref:n})}catch(p){if(!(p instanceof ze))throw p}let f=(await al({fs:t,cache:e,gitdir:i,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==s);let d=await gu({fs:t,gitdir:i,tree:f});return await pu({fs:t,cache:e,onSign:r,gitdir:i,ref:n,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote' `,author:a,committer:o,signingKey:l})}async function TB({fs:t,onSign:e,dir:r,gitdir:i=N(r,".git"),ref:n="refs/notes/commits",oid:s,author:a,committer:o,signingKey:l,cache:c={}}){try{R("fs",t),R("gitdir",i),R("oid",s);let u=new te(t),f=await ie({fsp:u,dotgit:i}),d=await Ns({fs:u,gitdir:f,author:a});if(!d)throw new Jt("author");let h=await Ta({fs:u,gitdir:f,author:d,committer:o});if(!h)throw new Jt("committer");return await AB({fs:u,cache:c,onSign:e,gitdir:f,ref:n,oid:s,author:d,committer:h,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function PB({fs:t,gitdir:e,oldref:r,ref:i,checkout:n=!1}){if(!uu(i,!0))throw new qi(i,Zo.default.clean(i));if(!uu(r,!0))throw new qi(r,Zo.default.clean(r));let s=`refs/heads/${r}`,a=`refs/heads/${i}`;if(await q.exists({fs:t,gitdir:e,ref:a}))throw new Wi("branch",i,!1);let l=await q.resolve({fs:t,gitdir:e,ref:s,depth:1});await q.writeRef({fs:t,gitdir:e,ref:a,value:l}),await q.deleteRef({fs:t,gitdir:e,ref:s});let u=await Bs({fs:t,gitdir:e,fullname:!0})===s;(n||u)&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:a})}async function RB({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i,oldref:n,checkout:s=!1}){try{R("fs",t),R("gitdir",r),R("ref",i),R("oldref",n);let a=new te(t),o=await ie({fsp:a,dotgit:r});return await PB({fs:a,gitdir:o,ref:i,oldref:n,checkout:s})}catch(a){throw a.caller="git.renameBranch",a}}async function US({gitdir:t,type:e,object:r}){return En(Ds.wrap({type:e,object:r}))}async function $B({fs:t,dir:e,gitdir:r=N(e,".git"),filepath:i,ref:n,cache:s={}}){try{R("fs",t),R("gitdir",r),R("filepath",i);let a=new te(t),o=await ie({fsp:a,dotgit:r}),l,c;try{l=await q.resolve({fs:a,gitdir:o,ref:n||"HEAD"})}catch(d){if(n)throw d}if(l)try{l=await mu({fs:a,cache:s,gitdir:o,oid:l,filepath:i})}catch(d){l=null}let u={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},f=e&&await a.read(N(e,i));f&&(c=await US({gitdir:o,type:"blob",object:f}),l===c&&(u=await a.lstat(N(e,i)))),await gt.acquire({fs:a,gitdir:o,cache:s},async function(d){d.delete({filepath:i}),l&&d.insert({filepath:i,stats:u,oid:l})})}catch(a){throw a.caller="git.reset",a}}async function FB({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i,depth:n}){try{R("fs",t),R("gitdir",r),R("ref",i);let s=new te(t),a=await ie({fsp:s,dotgit:r});return await q.resolve({fs:s,gitdir:a,ref:i,depth:n})}catch(s){throw s.caller="git.resolveRef",s}}async function IB({fs:t,dir:e,gitdir:r=N(e,".git"),path:i,value:n,append:s=!1}){try{R("fs",t),R("gitdir",r),R("path",i);let a=new te(t),o=await ie({fsp:a,dotgit:r}),l=await vt.get({fs:a,gitdir:o});s?await l.append(i,n):await l.set(i,n),await vt.save({fs:a,gitdir:o,config:l})}catch(a){throw a.caller="git.setConfig",a}}async function GS({fs:t,gitdir:e,commit:r}){let i=Nr.from(r).toObject();return await Br({fs:t,gitdir:e,type:"commit",object:i,format:"content"})}var Id=class t{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),r=Math.abs(Math.floor(e/60)),i=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${r.toString().padStart(2,"0")}${i}`}static createStashReflogEntry(e,r,i){let n=e.name.replace(/\s/g,""),s="0000000000000000000000000000000000000000",a=Math.floor(Date.now()/1e3),o=t.timezoneOffsetForRefLogEntry;return`${s} ${r} ${n} ${e.email} ${a} ${o} ${i} `}static getStashReflogEntry(e,r=!1){return e.split(` `).filter(s=>s).reverse().map((s,a)=>r?`stash@{${a}}: ${s.split(" ")[1]}`:s)}},Ra=class t{constructor({fs:e,dir:r,gitdir:i=N(r,".git")}){Object.assign(this,{fs:e,dir:r,gitdir:i,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return N(this.gitdir,t.refStash)}get refLogsStashPath(){return N(this.gitdir,t.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await Ns({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new Jt("author");return this._author}async getStashSHA(e,r){return await this.fs.exists(this.refStashPath)?(r||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:r,parent:i}){return GS({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:r,parent:i,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let r=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>r.length-1))throw new qi(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let i=await this.getStashSHA(e,r);return i?xn({fs:this.fs,cache:{},gitdir:this.gitdir,oid:i}):{}}async writeStashRef(e){return q.writeRef({fs:this.fs,gitdir:this.gitdir,ref:t.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:r}){let i=await this.getAuthor(),n=Id.createStashReflogEntry(i,e,r),s=this.refLogsStashPath;await rl({filepath:s,entry:n},async()=>{let a=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,a+n,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let r=await this.fs.read(this.refLogsStashPath,"utf8");return Id.getStashReflogEntry(r,e)}};async function jS({fs:t,dir:e,gitdir:r,message:i=""}){let n=new Ra({fs:t,dir:e,gitdir:r});await n.getAuthor();let s=await Bs({fs:t,gitdir:r,fullname:!1}),a=await q.resolve({fs:t,gitdir:r,ref:"HEAD"}),l=(await HS({fs:t,dir:e,gitdir:r,oid:a})).commit.message,c=[a],u=null,f=Dr({ref:"HEAD"}),d=await YE({fs:t,dir:e,gitdir:r,treePair:[Dr({ref:"HEAD"}),"stage"]});if(d){let v=await n.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(v),u=d,f=sl()}let h=await YE({fs:t,dir:e,gitdir:r,treePair:[f,"workdir"]});if(h){let v=await n.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:h,parent:[c[c.length-1]]});c.push(v),u=h}if(!u||!d&&!h)throw new ze("changes, nothing to stash");let p=(i.trim()||`WIP on ${s}`)+`: ${a.substring(0,7)} ${l}`;return{stashCommit:await n.writeStashCommit({message:p,tree:u,parent:c}),stashMsg:p,branch:s,stashMgr:n}}async function MB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n,stashMsg:s,branch:a,stashMgr:o}=await jS({fs:t,dir:e,gitdir:r,message:i});return await o.writeStashRef(n),await o.writeStashReflogEntry({stashCommit:n,message:s}),await ES({fs:t,dir:e,gitdir:r,ref:a,track:!1,force:!0}),n}async function DB({fs:t,dir:e,gitdir:r,message:i=""}){let{stashCommit:n}=await jS({fs:t,dir:e,gitdir:r,message:i});return n}async function VS({fs:t,dir:e,gitdir:r,refIdx:i=0}){let s=await new Ra({fs:t,dir:e,gitdir:r}).readStashCommit(i),{parent:a=null}=s.commit?s.commit:{};if(!(!a||!Array.isArray(a)))for(let o=0;o{await t.exists(a)&&await t.rm(a)});let o=await n.readStashReflogs({parsed:!1});if(!o.length)return;o.splice(i,1);let l=n.refLogsStashPath;await rl({reflogEntries:o,stashReflogPath:l,stashMgr:n},async()=>{if(o.length){await t.write(l,o.reverse().join(` `)+` `,"utf8");let c=o[o.length-1].split(" ")[1];await n.writeStashRef(c)}else await t.rm(l)})}async function OB({fs:t,dir:e,gitdir:r}){return new Ra({fs:t,dir:e,gitdir:r}).readStashReflogs({parsed:!0})}async function LB({fs:t,dir:e,gitdir:r}){let i=new Ra({fs:t,dir:e,gitdir:r}),n=[i.refStashPath,i.refLogsStashPath];await rl(n,async()=>{await Promise.all(n.map(async s=>{if(await t.exists(s))return t.rm(s)}))})}async function NB({fs:t,dir:e,gitdir:r,refIdx:i=0}){await VS({fs:t,dir:e,gitdir:r,refIdx:i}),await zS({fs:t,dir:e,gitdir:r,refIdx:i})}async function BB({fs:t,dir:e,gitdir:r=N(e,".git"),op:i="push",message:n="",refIdx:s=0}){R("fs",t),R("dir",e),R("gitdir",r),R("op",i);let a={push:MB,apply:VS,drop:zS,list:OB,clear:LB,pop:NB,create:DB},o=["apply","drop","pop"];try{let l=new te(t),c=await ie({fsp:l,dotgit:r});["refs","logs","logs/refs"].map(d=>N(c,d)).forEach(async d=>{await l.exists(d)||await l.mkdir(d)});let f=a[i];if(f){if(o.includes(i)&&s<0)throw new qi(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await f({fs:l,dir:e,gitdir:c,message:n,refIdx:s})}throw new Error(`To be implemented: ${i}`)}catch(l){throw l.caller="git.stash",l}}async function HB({fs:t,dir:e,gitdir:r=N(e,".git"),filepath:i,cache:n={},refresh:s=!0}){try{R("fs",t),R("gitdir",r),R("filepath",i);let a=new te(t),o=await ie({fsp:a,dotgit:r});if(await Ls.isIgnored({fs:a,gitdir:o,dir:e,filepath:i}))return"ignored";let c=await UB({fs:a,cache:n,gitdir:o}),u=await WS({fs:a,cache:n,gitdir:o,tree:c,path:i}),f=await gt.acquire({fs:a,gitdir:o,cache:n},async function(b){for(let _ of b)if(_.path===i)return _;return null}),d=await a.lstat(N(e,i)),h=u!==null,p=f!==null,g=d!==null,v=async()=>{if(p&&!Ed(f,d))return f.oid;{let b=await a.read(N(e,i)),_=await US({gitdir:o,type:"blob",object:b});return s&&p&&f.oid===_&&d.size!==-1&>.acquire({fs:a,gitdir:o,cache:n},async function(C){C.insert({filepath:i,stats:d,oid:_})}),_}};if(!h&&!g&&!p)return"absent";if(!h&&!g&&p)return"*absent";if(!h&&g&&!p)return"*added";if(!h&&g&&p)return await v()===f.oid?"added":"*added";if(h&&!g&&!p)return"deleted";if(h&&!g&&p)return u===f.oid,"*deleted";if(h&&g&&!p)return await v()===u?"*undeleted":"*undeletemodified";if(h&&g&&p){let b=await v();return b===u?b===f.oid?"unmodified":"*unmodified":b===f.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function WS({fs:t,cache:e,gitdir:r,tree:i,path:n}){typeof n=="string"&&(n=n.split("/"));let s=n.shift();for(let a of i)if(a.path===s){if(n.length===0)return a.oid;let{type:o,object:l}=await st({fs:t,cache:e,gitdir:r,oid:a.oid});if(o==="tree"){let c=Lr.from(l);return WS({fs:t,cache:e,gitdir:r,tree:c,path:n})}if(o==="blob")throw new xr(a.oid,o,"blob",n.join("/"))}return null}async function UB({fs:t,cache:e,gitdir:r}){let i;try{i=await q.resolve({fs:t,gitdir:r,ref:"HEAD"})}catch(s){if(s instanceof ze)return[]}let{tree:n}=await al({fs:t,cache:e,gitdir:r,oid:i});return n}async function GB({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i="HEAD",filepaths:n=["."],filter:s,cache:a={},ignored:o=!1,refresh:l=!0}){try{R("fs",t),R("gitdir",r),R("ref",i);let c=new te(t),u=await ie({fsp:c,dotgit:r});return await Jn({fs:c,cache:a,dir:e,gitdir:u,trees:[Dr({ref:i}),hu({refresh:l}),sl()],map:async function(f,[d,h,p]){if(!d&&!p&&h&&!o&&await Ls.isIgnored({fs:c,dir:e,filepath:f})||!n.some(S=>xS(f,S)))return null;if(s&&!s(f))return;let[g,v,b]=await Promise.all([d&&d.type(),h&&h.type(),p&&p.type()]),_=[g,v,b].includes("blob");if((g==="tree"||g==="special")&&!_)return;if(g==="commit")return null;if((v==="tree"||v==="special")&&!_)return;if(b==="commit")return null;if((b==="tree"||b==="special")&&!_)return;let C=g==="blob"?await d.oid():void 0,x=b==="blob"?await p.oid():void 0,E;g!=="blob"&&v==="blob"&&b!=="blob"?E="42":v==="blob"&&(E=await h.oid());let A=[void 0,C,E,x],w=A.map(S=>A.indexOf(S));return w.shift(),[f,...w]}})}catch(c){throw c.caller="git.statusMatrix",c}}async function jB({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i,object:n,force:s=!1}){try{R("fs",t),R("gitdir",r),R("ref",i);let a=new te(t);if(i===void 0)throw new Or("ref");i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`;let o=await ie({fsp:a,dotgit:r}),l=await q.resolve({fs:a,gitdir:o,ref:n||"HEAD"});if(!s&&await q.exists({fs:a,gitdir:o,ref:i}))throw new Wi("tag",i);await q.writeRef({fs:a,gitdir:o,ref:i,value:l})}catch(a){throw a.caller="git.tag",a}}async function VB({fs:t,dir:e,gitdir:r=N(e,".git"),cache:i={},filepath:n,oid:s,mode:a,add:o,remove:l,force:c}){try{R("fs",t),R("gitdir",r),R("filepath",n);let u=new te(t),f=await ie({fsp:u,dotgit:r});if(l)return await gt.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!c){let p=await u.lstat(N(e,n));if(p){if(p.isDirectory())throw new Os("directory");return}}h.has({filepath:n})&&h.delete({filepath:n})});let d;if(!s){if(d=await u.lstat(N(e,n)),!d)throw new ze(`file at "${n}" on disk and "remove" not set`);if(d.isDirectory())throw new Os("directory")}return await gt.acquire({fs:u,gitdir:f,cache:i},async function(h){if(!o&&!h.has({filepath:n}))throw new ze(`file at "${n}" in index and "add" not set`);let p;if(s)p={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:a,uid:0,gid:0,size:0};else{p=d;let g=p.isSymbolicLink()?await u.readlink(N(e,n)):await u.read(N(e,n));s=await Br({fs:u,gitdir:f,type:"blob",format:"content",object:g})}return h.insert({filepath:n,oid:s,stats:p}),s})}catch(u){throw u.caller="git.updateIndex",u}}function zB(){try{return Ld.version}catch(t){throw t.caller="git.version",t}}async function WB({fs:t,dir:e,gitdir:r=N(e,".git"),trees:i,map:n,reduce:s,iterate:a,cache:o={}}){try{R("fs",t),R("gitdir",r),R("trees",i);let l=new te(t),c=await ie({fsp:l,dotgit:r});return await Jn({fs:l,cache:o,dir:e,gitdir:c,trees:i,map:n,reduce:s,iterate:a})}catch(l){throw l.caller="git.walk",l}}async function qB({fs:t,dir:e,gitdir:r=N(e,".git"),blob:i}){try{R("fs",t),R("gitdir",r),R("blob",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await Br({fs:n,gitdir:s,type:"blob",object:i,format:"content"})}catch(n){throw n.caller="git.writeBlob",n}}async function YB({fs:t,dir:e,gitdir:r=N(e,".git"),commit:i}){try{R("fs",t),R("gitdir",r),R("commit",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await GS({fs:n,gitdir:s,commit:i})}catch(n){throw n.caller="git.writeCommit",n}}async function ZB({fs:t,dir:e,gitdir:r=N(e,".git"),type:i,object:n,format:s="parsed",oid:a,encoding:o=void 0}){try{let l=new te(t),c=await ie({fsp:l,dotgit:r});if(s==="parsed"){switch(i){case"commit":n=Nr.from(n).toObject();break;case"tree":n=Lr.from(n).toObject();break;case"blob":n=k.from(n,o);break;case"tag":n=ni.from(n).toObject();break;default:throw new xr(a||"",i,"blob|commit|tag|tree")}s="content"}return a=await Br({fs:l,gitdir:c,type:i,object:n,oid:a,format:s}),a}catch(l){throw l.caller="git.writeObject",l}}async function KB({fs:t,dir:e,gitdir:r=N(e,".git"),ref:i,value:n,force:s=!1,symbolic:a=!1}){try{R("fs",t),R("gitdir",r),R("ref",i),R("value",n);let o=new te(t);if(!uu(i,!0))throw new qi(i,Zo.default.clean(i));let l=await ie({fsp:o,dotgit:r});if(!s&&await q.exists({fs:o,gitdir:l,ref:i}))throw new Wi("ref",i);a?await q.writeSymbolicRef({fs:o,gitdir:l,ref:i,value:n}):(n=await q.resolve({fs:o,gitdir:l,ref:n}),await q.writeRef({fs:o,gitdir:l,ref:i,value:n}))}catch(o){throw o.caller="git.writeRef",o}}async function XB({fs:t,gitdir:e,tag:r}){let i=ni.from(r).toObject();return await Br({fs:t,gitdir:e,type:"tag",object:i,format:"content"})}async function QB({fs:t,dir:e,gitdir:r=N(e,".git"),tag:i}){try{R("fs",t),R("gitdir",r),R("tag",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await XB({fs:n,gitdir:s,tag:i})}catch(n){throw n.caller="git.writeTag",n}}async function JB({fs:t,dir:e,gitdir:r=N(e,".git"),tree:i}){try{R("fs",t),R("gitdir",r),R("tree",i);let n=new te(t),s=await ie({fsp:n,dotgit:r});return await gu({fs:n,gitdir:s,tree:i})}catch(n){throw n.caller="git.writeTree",n}}var e3={Errors:du,STAGE:sl,TREE:Dr,WORKDIR:hu,add:UL,abortMerge:LL,addNote:VL,addRemote:WL,annotatedTag:YL,branch:KL,cherryPick:sN,checkout:ES,clone:gN,commit:vN,getConfig:DN,getConfigAll:LN,setConfig:IB,currentBranch:wN,deleteBranch:_N,deleteRef:yN,deleteRemote:EN,deleteTag:kN,expandOid:PN,expandRef:RN,fastForward:$N,fetch:FN,findMergeBase:IN,findRoot:MN,getRemoteInfo:NN,getRemoteInfo2:BN,hashBlob:UN,indexPack:jN,init:VN,isDescendent:zN,isIgnored:WN,listBranches:qN,listFiles:ZN,listNotes:XN,listRefs:QN,listRemotes:eB,listServerRefs:iB,listTags:nB,log:cB,merge:uB,packObjects:hB,pull:pB,push:bB,readBlob:wu,readCommit:HS,readNote:yB,readObject:xB,readTag:SB,readTree:kB,remove:CB,removeNote:TB,renameBranch:RB,resetIndex:$B,updateIndex:VB,resolveRef:FB,status:HB,statusMatrix:GB,tag:jB,version:zB,walk:WB,writeBlob:qB,writeCommit:YB,writeObject:ZB,writeRef:KB,writeTag:QB,writeTree:JB,stash:BB},pe=e3;var Ce=require("obsidian"),k$=mt(require("path"),1),am=mt(require("fs/promises"),1);m();var Et={};m();var Nd=class{constructor(e){this.plugin=e;this.tasks=[];this.currentTask=null}addTask(e,r){this.tasks.push({task:e,onFinished:i=>{r&&r(i)}}),this.kickstart()}kickstart(){if(this.currentTask!==null||this.tasks.length===0)return;let e=this.tasks.shift();this.currentTask=Promise.resolve().then(()=>e.task()).then(r=>{try{e.onFinished(r)}catch(i){console.error(i)}},r=>{this.plugin.displayError(r);try{e.onFinished(void 0)}catch(i){console.error(i)}}).finally(()=>{this.currentTask=null,this.kickstart()})}clear(){this.tasks=[]}};m();var U=require("obsidian");m();var qS=require("obsidian"),Bd="YYYY-MM-DD",uv=`${Bd} HH:mm`,fv=`${Bd} HH:mm:ss`,Hd=40,ol="conflict-files-obsidian-git.md",tt={commitMessage:"vault backup: {{date}}",autoCommitMessage:"vault backup: {{date}}",commitMessageScript:"",commitDateFormat:fv,autoSaveInterval:0,autoPushInterval:0,autoPullInterval:0,autoPullOnBoot:!1,autoCommitOnlyStaged:!1,disablePush:!1,pullBeforePush:!0,squashCommitsBeforePush:!1,disablePopups:!1,showErrorNotices:!0,disablePopupsForNoChanges:!1,listChangedFilesInMessageBody:!1,showStatusBar:!0,updateSubmodules:!1,syncMethod:"merge",mergeStrategy:"none",customMessageOnAutoBackup:!1,autoBackupAfterFileChange:!1,treeStructure:!1,refreshSourceControl:qS.Platform.isDesktopApp,basePath:"",differentIntervalCommitAndPush:!1,changedFilesInStatusBar:!1,showedMobileNotice:!1,refreshSourceControlTimer:7e3,showBranchStatusBar:!0,setLastSaveToLastCommit:!1,submoduleRecurseCheckout:!1,gitDir:"",showFileMenu:!0,authorInHistoryView:"hide",dateInHistoryView:!1,diffStyle:"split",diffTimeout:50,autoStageOnEmptyIndex:!0,hunks:{showSigns:!1,hunkCommands:!1,statusBar:"disabled"},lineAuthor:{show:!1,followMovement:"inactive",authorDisplay:"initials",showCommitHash:!1,dateTimeFormatOptions:"date",dateTimeFormatCustomString:uv,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}},er={type:"git-view",name:"Source Control",icon:"git-pull-request"},Ei={type:"git-history-view",name:"History",icon:"history"},Hs={type:"split-diff-view",name:"Diff view",icon:"diff"},Us={type:"diff-view",name:"Diff View",icon:"git-pull-request"},Ud="C:\\Program Files\\Git\\cmd\\git.exe",Gd=".git_credentials_input",$a="obsidian_askpass.sh",YS=`#!/bin/sh PROMPT="$1" TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT" cleanup() { rm -f "$TEMP_FILE" "$TEMP_FILE.response" } trap cleanup EXIT echo "$PROMPT" > "$TEMP_FILE" while [ ! -e "$TEMP_FILE.response" ]; do if [ ! -e "$TEMP_FILE" ]; then echo "Trigger file got removed: Abort" >&2 exit 1 fi sleep 0.1 done RESPONSE=$(cat "$TEMP_FILE.response") echo "$RESPONSE" `,ZS=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"];m();m();m();var bu=class{diff(e,r,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let s=this.castInput(e,i),a=this.castInput(r,i),o=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,l,i,n)}diffWithOptionsObj(e,r,i,n){var s;let a=_=>{if(_=this.postProcess(_,i),n){setTimeout(function(){n(_)},0);return}else return _},o=r.length,l=e.length,c=1,u=o+l;i.maxEditLength!=null&&(u=Math.min(u,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],r,e,0,i);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,v=1/0,b=()=>{for(let _=Math.max(g,-c);_<=Math.min(v,c);_+=2){let C,x=h[_-1],E=h[_+1];x&&(h[_-1]=void 0);let A=!1;if(E){let S=E.oldPos-_;A=E&&0<=S&&S=l&&p+1>=o)return a(this.buildValues(C.lastComponent,r,e))||!0;h[_]=C,C.oldPos+1>=l&&(v=Math.min(v,_-1)),p+1>=o&&(g=Math.max(g,_+1))}c++};if(n)(function _(){setTimeout(function(){if(c>u||Date.now()>d)return n(void 0);b()||_()},0)})();else for(;c<=u&&Date.now()<=d;){let _=b();if(_)return _}}addToPath(e,r,i,n,s){let a=e.lastComponent;return a&&!s.oneChangePerToken&&a.added===r&&a.removed===i?{oldPos:e.oldPos+n,lastComponent:{count:a.count+1,added:r,removed:i,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+n,lastComponent:{count:1,added:r,removed:i,previousComponent:a}}}extractCommon(e,r,i,n,s){let a=r.length,o=i.length,l=e.oldPos,c=l-n,u=0;for(;c+1d.length?p:d}),u.value=this.join(f)}else u.value=this.join(r.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return n}};m();var dv=class extends bu{constructor(){super(...arguments),this.tokenize=r3}equals(e,r,i){return i.ignoreWhitespace?((!i.newlineIsToken||!e.includes(` `))&&(e=e.trim()),(!i.newlineIsToken||!r.includes(` `))&&(r=r.trim())):i.ignoreNewlineAtEof&&!i.newlineIsToken&&(e.endsWith(` `)&&(e=e.slice(0,-1)),r.endsWith(` `)&&(r=r.slice(0,-1))),super.equals(e,r,i)}},t3=new dv;function hv(t,e,r){return t3.diff(t,e,r)}function r3(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,` `));let r=[],i=t.split(/(\n|\r\n)/);i[i.length-1]||i.pop();for(let n=0;n"~"||t[e]==='"'||t[e]==="\\")return!0;return!1}function Gs(t){if(!i3(t))return t;let e='"',r=new TextEncoder().encode(t),i=0;for(;i=32&&n<=126?e+=String.fromCharCode(n):e+="\\"+n.toString(8).padStart(3,"0"),i++}return e+='"',e}var pv={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function mv(t,e,r,i,n,s,a){let o;a?typeof a=="function"?o={callback:a}:o=a:o={},typeof o.context=="undefined"&&(o.context=4);let l=o.context;if(o.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(o.callback){let{callback:u}=o;hv(r,i,Object.assign(Object.assign({},o),{callback:f=>{let d=c(f);u(d)}}))}else return c(hv(r,i,o));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(_){return _.map(function(C){return" "+C})}let d=[],h=0,p=0,g=[],v=1,b=1;for(let _=0;_0?f(E.lines.slice(-l)):[],h-=g.length,p-=g.length)}for(let E of x)g.push((C.added?"+":"-")+E);C.added?b+=x.length:v+=x.length}else{if(h)if(x.length<=l*2&&_1&&!e.includeFileHeaders&&!t.every(u=>u.isGit))throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return t.map(u=>jd(u,e)).join(` `)}let l=[];if(t.isGit){if(e=pv,!t.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!t.newFileName)throw new Error("newFileName must be specified for Git patches");let u=t.oldFileName,f=t.newFileName;t.isCreate&&u==="/dev/null"?u=f.replace(/^b\//,"a/"):t.isDelete&&f==="/dev/null"&&(f=u.replace(/^a\//,"b/")),l.push("diff --git "+Gs(u)+" "+Gs(f)),t.isDelete&&l.push("deleted file mode "+((r=t.oldMode)!==null&&r!==void 0?r:"100644")),t.isCreate&&l.push("new file mode "+((i=t.newMode)!==null&&i!==void 0?i:"100644")),t.oldMode&&t.newMode&&!t.isDelete&&!t.isCreate&&(l.push("old mode "+t.oldMode),l.push("new mode "+t.newMode)),t.isRename&&(l.push("rename from "+Gs(((n=t.oldFileName)!==null&&n!==void 0?n:"").replace(/^a\//,""))),l.push("rename to "+Gs(((s=t.newFileName)!==null&&s!==void 0?s:"").replace(/^b\//,"")))),t.isCopy&&(l.push("copy from "+Gs(((a=t.oldFileName)!==null&&a!==void 0?a:"").replace(/^a\//,""))),l.push("copy to "+Gs(((o=t.newFileName)!==null&&o!==void 0?o:"").replace(/^b\//,""))))}else e.includeIndex&&t.oldFileName==t.newFileName&&t.oldFileName!==void 0&&l.push("Index: "+t.oldFileName),e.includeUnderline&&l.push("===================================================================");let c=t.hunks.length>0;e.includeFileHeaders&&t.oldFileName!==void 0&&t.newFileName!==void 0&&(!t.isGit||c)&&(l.push("--- "+Gs(t.oldFileName)+(t.oldHeader?" "+t.oldHeader:"")),l.push("+++ "+Gs(t.newFileName)+(t.newHeader?" "+t.newHeader:"")));for(let u=0;u{o(l?jd(l,a.headerOptions):void 0)}}))}else{let o=mv(t,e,r,i,n,s,a);return o?jd(o,a==null?void 0:a.headerOptions):void 0}}function _u(t,e,r,i,n,s){return KS(t,t,e,r,i,n,s)}function n3(t){let e=t.endsWith(` `),r=t.split(` `).map(i=>i+` `);return e?r.pop():r.push(r.pop().slice(0,-1)),r}var Cn=require("obsidian");m();function XS(t,e){let r=Object.assign({},t.lineAuthor,e.lineAuthor);return Object.assign({},t,e,{lineAuthor:r})}var ll=class extends Error{constructor(r){super("No network connection available");this.originalError=r}};m();var QS=require("obsidian"),s3={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},at=class extends QS.SuggestModal{constructor(e,r){if(super(e.app),this.config={...s3,...r},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let i=this.containerEl.querySelector(".prompt-input-container");i.addClass("git-obscure-prompt"),i.setAttr("git-is-obscured","true");let n=i==null?void 0:i.createDiv({cls:"search-input-clear-button"});n.style.marginRight="32px",n.id="git-show-password",n.addEventListener("click",()=>{i.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",i.setAttr("git-is-obscured","false")):(this.inputEl.type="password",i.setAttr("git-is-obscured","true"))})}}openAndGetResult(){return new Promise(e=>{this.resolve=e,this.open(),this.config.initialValue!=null&&(this.inputEl.value=this.config.initialValue,this.inputEl.dispatchEvent(new Event("input")))})}onClose(){new Promise(e=>window.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,r){this.config.obscure?r.hide():r.setText(e)}onChooseSuggestion(e,r){if(this.resolve){let i;this.config.allowEmpty&&e===" "?i="":e==="..."?i=void 0:i=e,this.resolve(i)}}};m();var vk=mt(gk(),1),wk=require("child_process"),ts=require("obsidian");function zd(t){throw new Error(`Unexpected object: ${String(t)}`)}function xu(t,e,r){return t===1?`${t} ${e}`:`${t} ${r!=null?r:e+"s"}`}var wv=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);function Yi(t,e){let r;if(e){if(e.button===0||e.button===1){let i=ts.Keymap.isModEvent(e);r=t.workspace.getLeaf(i)}}else r=t.workspace.getLeaf(!1);return r}function Hr(t){return t.getRoot().side==="left"?"right":"left"}function Sn(t,e,r,i,n){if(e.button==2){let s=t.vault.getAbstractFileByPath(r);if(s!=null){let a=new ts.Menu;t.workspace.trigger("file-menu",a,s,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}else{let a=new ts.Menu;t.workspace.trigger("obsidian-git:menu",a,r,n,i),a.showAtPosition({x:e.pageX,y:e.pageY})}}}function js(t){throw new Error(`Impossible branch: ${String(t)}`)}function bv(t){return`rgb(${t.r},${t.g},${t.b})`}function bk(t){var s;let e=(s=vk.fromString(t))==null?void 0:s.toRgbaArray();if(e===void 0)return;let[r,i,n]=e;return{r,g:i,b:n}}function _k(t){return t.diff(ts.moment.unix(0),"seconds")}function yk(t){if(t.length!==0)return t.slice().sort()[Math.floor(t.length/2)]}function Eu(t,e){return new Proxy(t,{get(r,i){return i==="length"?Math.min(e,r.length):r[i]}})}function xk(t,e,r){return t.length<=e?new Array(e-t.length).fill(r).join("")+t:t.substring(t.length-e)}function Ek(t,e){if(e<=0)return t;let r=new Array(e).fill(" ").join(""),i=t.substring(e,t.length);return r+i}function _v(t,e,r){return t<=e&&e<=r}function Vs(t){let[e,...r]=t.split("/");return[e!=null?e:"",r.length===0?void 0:r.join("/")]}function kn(t){return t.endsWith("/")?t:t.split("/").last().replace(/\.md$/,"")}function Sk(t){return t===1?"1 minute":`${t} minutes`}function _3(t){let e=t.lastIndexOf(".");return t.substring(e+1)}function ul(t){if(t.endsWith(".md"))return!1;let e=_3(t);return ZS.includes(e)}function yv(t){return(t.startsWith("https://github.com/")||t.startsWith("https://gitlab.com/"))&&(t.endsWith(".git")||(t=t+".git")),t}function fl(t,e){let r=e.vault.getAbstractFileByPath(t);if(!(r instanceof ts.TFile))return!1;try{return!!e.viewRegistry.getTypeByExtension(r.extension)}catch(i){return!0}}function kk({isFolder:t,gitRelativePath:e}){let r="/";return r+=e,t&&(r+="/"),r.replace(/([\\!#*?[\]])/g,String.raw`\$1`).replace(/\s(?=\s*$)/g,String.raw`\ `)}function dl(t,e,r,i){let n=e.target;t.workspace.trigger("hover-link",{event:e,source:r.getViewType(),hoverParent:r,targetEl:n,linktext:i})}function Su(t,e,r={}){return new Promise((i,n)=>{let s=(0,wk.spawn)(t,e,r),a="",o="";s.stdout.on("data",l=>{a+=l.toString()}),s.stderr.on("data",l=>{o+=l.toString()}),s.on("error",l=>{i({error:new Error(l.message),stdout:a,stderr:o,code:1})}),s.on("close",l=>{i({stdout:a,stderr:o,code:l!=null?l:1,error:void 0})})})}m();var Ck=require("os"),qd=require("obsidian");var hl=class{constructor(e){this.plugin=e,this.app=e.app}async withGitOperation(e,r){var i;this.plugin.setPluginState({operation:e});try{return await r()}finally{(i=this.plugin.statusBar)==null||i.clearProgress(!1),this.plugin.setPluginState({operation:0})}}getRelativeVaultPath(e){return this.plugin.settings.basePath?e===""||e==="."?this.plugin.settings.basePath:this.plugin.settings.basePath+"/"+e:e}getRelativeRepoPath(e,r=!0){if(r){let i=this.plugin.settings.basePath;if(i&&i.length>0){if(e.startsWith(i+"/"))return e.substring(i.length+1);if(e===i)return""}}return e}unload(){}simplify(e){var r,i,n,s;for(let a of e){for(;;){let o=((r=a.children)==null?void 0:r.length)==1,l=((n=(i=a.children)==null?void 0:i.first())==null?void 0:n.data)==null;if(!(a.children!=null&&o&&l))break;let c=a.children.first();a.title+="/"+c.title,a.data=c.data,a.path=c.path,a.vaultPath=c.vaultPath,a.children=c.children}a.children!=null&&this.simplify(a.children),(s=a.children)==null||s.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((a,o)=>{let l=(o.data==null?1:0)-(a.data==null?1:0);return l!=0?l:a.title.localeCompare(o.title)})}getTreeStructure(e){let r=new Map;for(let a of e){let o=a.path.split("/"),l=r,c="";for(let u=0;u{let o=[];for(let l of a.values())l.children.size>0?o.push({title:l.title,path:l.path,vaultPath:this.getRelativeVaultPath(l.path),children:i(l.children)}):o.push({title:l.title,data:l.data,path:l.path,vaultPath:this.getRelativeVaultPath(l.path)});return o},n=i(r);return this.simplify(n)}async formatCommitMessage(e){let r;if(e.includes("{{numFiles}}")){r=await this.status();let i=r.staged.length;e=e.replace("{{numFiles}}",String(i))}if(e.includes("{{hostname}}")){let i=this.plugin.localStorage.getHostname()||"";!i&&qd.Platform.isDesktopApp&&(i=(0,Ck.hostname)()),e=e.replace("{{hostname}}",i)}if(e.includes("{{files}}")){r=r!=null?r:await this.status();let i={},n="";if(r.staged.length<100){r.staged.forEach(a=>{a.index in i?i[a.index].push(a.path):i[a.index]=[a.path]});let s=[];for(let[a,o]of Object.entries(i))s.push(a+" "+o.join(" "));n=s.join(", ")}else n="Too many files to list";e=e.replace("{{files}}",n)}if(e=e.replace("{{date}}",(0,qd.moment)().format(this.plugin.settings.commitDateFormat)),this.plugin.settings.listChangedFilesInMessageBody){let i=r!=null?r:await this.status(),n="";i.staged.length<100?n=i.staged.map(s=>s.path).join(` `):n="Too many files to list",e=e+` Affected files: `+n}return e}};m();var Wt=require("obsidian"),Yd=class extends Error{constructor(r){super(`File not found: ${r}`);this.code="ENOENT";this.name="FileNotFoundError"}},Zd=class{constructor(e,r){this.plugin=r;this.adapter=e.adapter,this.vault=e,this.lastBasePath=this.plugin.settings.basePath,this.promises={readFile:this.readFile.bind(this),writeFile:this.writeFile.bind(this),readdir:this.readdir.bind(this),mkdir:this.mkdir.bind(this),rmdir:this.rmdir.bind(this),stat:this.stat.bind(this),unlink:this.unlink.bind(this),lstat:this.lstat.bind(this),readlink:this.readlink.bind(this),symlink:this.symlink.bind(this)}}async readFile(e,r){var n;if(e===void 0)return;if(e=(0,Wt.normalizePath)(e),this.maybeLog("Read: "+e+JSON.stringify(r)),(typeof r=="string"?r:r==null?void 0:r.encoding)==="utf8"){let s=this.vault.getAbstractFileByPath(e);return s instanceof Wt.TFile?(this.maybeLog("Reuse"),this.vault.read(s)):this.adapter.read(e)}else{if(this.isIndexPath(e))return this.plugin.settings.basePath!=this.lastBasePath?(this.clearIndex(),this.lastBasePath=this.plugin.settings.basePath,this.adapter.readBinary(e)):(n=this.index)!=null?n:this.adapter.readBinary(e);let s=this.vault.getAbstractFileByPath(e);return s instanceof Wt.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(s)):this.adapter.readBinary(e)}}async writeFile(e,r){var i;if(this.maybeLog("Write: "+e),e=(0,Wt.normalizePath)(e),typeof r=="string"){let n=this.vault.getAbstractFileByPath(e);if(n instanceof Wt.TFile)return this.vault.modify(n,r);if(!this.isHiddenPath(e))await this.vault.create(e,r);else return this.adapter.write(e,r)}else{let n=y3(r);if(this.isIndexPath(e)){this.index=n;let s=Date.now();(i=this.indexctime)!=null||(this.indexctime=s),this.indexmtime=s}else{let s=this.vault.getAbstractFileByPath(e);if(s instanceof Wt.TFile)return this.vault.modifyBinary(s,n);if(!this.isHiddenPath(e))await this.vault.createBinary(e,n);else return this.adapter.writeBinary(e,n)}}}async readdir(e){e=(0,Wt.normalizePath)(e),this.maybeLog("ReadDir: "+e),e==="."&&(e="/");let r=await this.adapter.list(e),i=[...r.files,...r.folders],n;return e!=="/"?n=i.map(s=>(0,Wt.normalizePath)(s.substring(e.length))):n=i,n}async mkdir(e){if(e=(0,Wt.normalizePath)(e),!(e==="."||e==="/")){if(!this.isHiddenPath(e)){if(this.vault.getFolderByPath(e))return;await this.vault.createFolder(e);return}return this.adapter.mkdir(e)}}async rmdir(e,r){var i,n;if(e=(0,Wt.normalizePath)(e),this.maybeLog("Rmdir: "+e+JSON.stringify(r)),!this.isHiddenPath(e)){let s=this.vault.getAbstractFileByPath(e);if(s instanceof Wt.TFolder){await this.vault.delete(s,(r==null?void 0:r.recursive)===!0||((i=r==null?void 0:r.options)==null?void 0:i.recursive)===!0);return}}return this.adapter.rmdir(e,(r==null?void 0:r.recursive)===!0||((n=r==null?void 0:r.options)==null?void 0:n.recursive)===!0)}async stat(e){if(e=(0,Wt.normalizePath)(e),this.isIndexPath(e)){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.byteLength,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let i=await this.adapter.stat(e);if(i==null)throw new Yd(e);return this.indexctime=i.ctime,this.indexmtime=i.mtime,{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let r=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),r instanceof Wt.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:r.stat.ctime,mtimeMs:r.stat.mtime,size:r.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let i=await this.adapter.stat(e);if(i)return{ctimeMs:i.ctime,mtimeMs:i.mtime,size:i.size,type:i.type==="folder"?"directory":i.type,isFile:()=>i.type==="file",isDirectory:()=>i.type==="folder",isSymbolicLink:()=>!1};throw new Yd(e)}}async unlink(e){if(e=(0,Wt.normalizePath)(e),!this.isHiddenPath(e)){let r=this.vault.getAbstractFileByPath(e);if(r instanceof Wt.TFile)return this.vault.delete(r)}return this.adapter.remove(e)}async lstat(e){return this.stat(e)}readlink(e){return Promise.reject(new Error(`readlink of (${e}) is not implemented.`))}symlink(e){return Promise.reject(new Error(`symlink of (${e}) is not implemented.`))}async saveAndClear(){this.index!==void 0&&await this.adapter.writeBinary(this.getIndexPath(),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"}getIndexPath(){return this.plugin.gitManager.getRelativeVaultPath(this.gitDir+"/index")}isIndexPath(e){return e===this.getIndexPath()}isHiddenPath(e){return e.startsWith(this.gitDir)?!0:e.split("/").some(r=>r.startsWith(".")&&r!==".")}maybeLog(e){}};function y3(t){return t instanceof ArrayBuffer?t:t.buffer instanceof ArrayBuffer&&t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t.buffer,t.byteOffset,t.byteLength).slice().buffer}var Fk=mt($k(),1),Zi=class extends hl{constructor(r){super(r);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 Zd(this.app.vault,this.plugin)}getRepo(){return{fs:this.fs,dir:this.plugin.settings.basePath,gitdir:this.plugin.settings.gitDir?this.getGitDirPath():void 0,onAuth:()=>{var r,i;return{username:(r=this.plugin.localStorage.getUsername())!=null?r:void 0,password:(i=this.plugin.localStorage.getPassword())!=null?i:void 0}},onAuthFailure:async()=>{new Cn.Notice("Authentication failed. Please try with different credentials");let r=await new at(this.plugin,{placeholder:"Specify your username"}).openAndGetResult();if(r){let i=await new at(this.plugin,{placeholder:"Specify your password/personal access token",obscure:!0}).openAndGetResult();if(i)return this.plugin.localStorage.setUsername(r),this.plugin.localStorage.setPassword(i),{username:r,password:i}}return{cancel:!0}},http:{async request({url:r,method:i,headers:n,body:s}){let a;s&&(a=await k3(s));let o=await(0,Cn.requestUrl)({url:r,method:i,headers:{"Accept-Encoding":"identity",...n},body:a,throw:!1}),l=await C3(o.arrayBuffer);return{url:r,method:i,headers:o.headers,body:S3(l),statusCode:o.status,statusMessage:o.status.toString()}}}}}async wrapFS(r){try{let i=await r;return await this.fs.saveAndClear(),i}catch(i){throw await this.fs.saveAndClear(),i}}async status(r){let i,n=window.setTimeout(()=>{i=new Cn.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let s={...this.getRepo()};(r==null?void 0:r.path)!=null&&(s.filepaths=[`${r.path}/`]);let a=(await this.wrapFS(pe.statusMatrix(s))).map(f=>this.getFileStatusResult(f)),o=[],l=[],c=[];for(let f of a)f.workingDir!==" "&&o.push(f),f.index!==" "&&f.index!=="U"&&l.push(f),(f.index!=" "||f.workingDir!=" ")&&c.push(f);let u=[];return window.clearTimeout(n),i==null||i.hide(),{all:c,changed:o,staged:l,conflicted:u}}catch(s){throw window.clearTimeout(n),i==null||i.hide(),this.plugin.displayError(s),s}}async commitAll({message:r,status:i,unstagedFiles:n}){try{return await this.checkAuthorInfo(),await this.stageAll({status:i,unstagedFiles:n}),this.commit({message:r})}catch(s){throw this.plugin.displayError(s),s}}async commit({message:r}){return this.withGitOperation(2,async()=>{try{await this.checkAuthorInfo();let i=await this.formatCommitMessage(r),n=this.plugin.localStorage.getConflict(),s;if(n){let a=await this.branchInfo();s=[a.current,a.tracking]}await this.wrapFS(pe.commit({...this.getRepo(),message:i,parent:s})),this.plugin.localStorage.setConflict(!1);return}catch(i){throw this.plugin.displayError(i),i}})}async stage(r,i){let n=this.getRelativeRepoPath(r,i),s;i?s=r:s=this.getRelativeVaultPath(r);try{await this.app.vault.adapter.exists(s)?await this.wrapFS(pe.add({...this.getRepo(),filepath:n})):await this.wrapFS(pe.remove({...this.getRepo(),filepath:n}))}catch(a){throw this.plugin.displayError(a),a}}async stageAll({dir:r,status:i,unstagedFiles:n}){try{if(i)await this.stageFiles(i.changed.map(s=>({path:s.path,deleted:s.workingDir==="D"})));else{let s=n!=null?n:await this.getUnstagedFiles(r!=null?r:".");await this.stageFiles(s.map(({path:a,type:o})=>({path:a,deleted:o==="D"})))}}catch(s){throw this.plugin.displayError(s),s}}async stageFiles(r){let n=(await this.wrapFS(Promise.allSettled(r.map(s=>s.deleted?pe.remove({...this.getRepo(),filepath:s.path}):pe.add({...this.getRepo(),filepath:s.path}))))).find(s=>s.status==="rejected");if((n==null?void 0:n.status)==="rejected")throw n.reason}async unstage(r,i){try{r=this.getRelativeRepoPath(r,i),await this.wrapFS(pe.resetIndex({...this.getRepo(),filepath:r}))}catch(n){throw this.plugin.displayError(n),n}}async unstageAll({dir:r,status:i}){try{let n;i?n=i.staged.map(s=>s.path):n=(await this.getStagedFiles(r!=null?r:".")).map(({path:a})=>a),await this.wrapFS(Promise.all(n.map(s=>pe.resetIndex({...this.getRepo(),filepath:s}))))}catch(n){throw this.plugin.displayError(n),n}}async discard(r){try{await this.wrapFS(pe.checkout({...this.getRepo(),filepaths:[r],force:!0}))}catch(i){throw this.plugin.displayError(i),i}}async discardAll({dir:r,status:i}){let n=[];i?r!=null?n=i.changed.filter(s=>s.workingDir!="U"&&s.path.startsWith(r)).map(s=>s.path):n=i.changed.filter(s=>s.workingDir!="U").map(s=>s.path):n=(await this.getUnstagedFiles(r)).filter(s=>s.type!="A").map(({path:s})=>s);try{await this.wrapFS(pe.checkout({...this.getRepo(),filepaths:n,force:!0}))}catch(s){throw this.plugin.displayError(s),s}}async getUntrackedPaths(r){let i=[];if(r.status)for(let n of r.status.changed)n.index=="U"&&n.workingDir==="U"&&n.path.startsWith(r.path!=null?`${r.path}/`:"")&&i.push(n.path);else{let n=await this.status({path:r==null?void 0:r.path});for(let s of n.changed)s.index==="U"&&s.workingDir==="U"&&i.push(s.path)}return i}getProgressText(r,i){let n=`${r} progress:`;return i.phase&&(n=`${n} ${i.phase}:`),i.loaded&&(n=`${n} ${i.loaded}`,i.total&&(n=`${n} of ${i.total}`)),n}resolveRef(r){return this.wrapFS(pe.resolveRef({...this.getRepo(),ref:r}))}async pull(){let r=this.showNotice("Initializing pull");return this.withGitOperation(1,async()=>{try{let i=await this.resolveRef("HEAD");await this.fetch();let n=await this.branchInfo();await this.checkAuthorInfo(),(await this.wrapFS(pe.merge({...this.getRepo(),ours:n.current,theirs:n.tracking,abortOnConflict:!1,mergeDriver:this.plugin.settings.mergeStrategy!=="none"?({contents:l})=>{var _,C,x;let c=l[0],u=l[1],f=l[2],d=/^.*(\r?\n|$)/gm,h=(_=u.match(d))!=null?_:[],p=(C=c.match(d))!=null?C:[],g=(x=f.match(d))!=null?x:[],v=(0,Fk.default)(h,p,g),b="";for(let E of v)E.ok&&(b+=E.ok.join("")),E.conflict&&(b+=this.plugin.settings.mergeStrategy==="ours"?E.conflict.a.join(""):E.conflict.b.join(""));return{cleanMerge:!0,mergedText:b}}:void 0}))).alreadyMerged||await this.wrapFS(pe.checkout({...this.getRepo(),ref:n.current,onProgress:l=>{r!==void 0&&r.setMessage(this.getProgressText("Checkout",l))},remote:n.remote})),r==null||r.hide();let a=await this.resolveRef("HEAD"),o=await this.getFileChangesCount(i,a);return this.showNotice("Finished pull",!1),o.map(l=>({path:l.path,workingDir:"P",index:"P",vaultPath:this.getRelativeVaultPath(l.path)}))}catch(i){throw r==null||r.hide(),i instanceof du.MergeConflictError&&await this.plugin.handleConflict(i.data.filepaths.map(n=>this.getRelativeVaultPath(n))),this.plugin.displayError(i),i}})}async push(){if(!await this.canPush())return 0;let r=this.showNotice("Initializing push");return this.withGitOperation(3,async()=>{try{let i=await this.branchInfo(),n=i.tracking,s=i.current,a=(await this.getFileChangesCount(s,n)).length,o=await this.getCurrentRemote();return await this.wrapFS(pe.push({...this.getRepo(),remote:o,onProgress:l=>{r!==void 0&&r.setMessage(this.getProgressText("Pushing",l))}})),r==null||r.hide(),a}catch(i){throw r==null||r.hide(),this.plugin.displayError(i),i}})}async getUnpushedCommits(){let r=await this.branchInfo(),i=r.tracking,n=r.current;if(i==null||n==null)return 0;let s=await this.resolveRef(n),a=await this.resolveRef(i);return(await this.getFileChangesCount(s,a)).length}async canPush(){let r=await this.branchInfo(),i=r.tracking,n=r.current,s=await this.resolveRef(n),a=await this.resolveRef(i);return s!=a}async checkRequirements(){return await this.plugin.app.vault.adapter.exists((0,Cn.normalizePath)(`${this.getGitDirPath()}/HEAD`))?"valid":"missing-repo"}async branchInfo(){var r,i;try{let n=await pe.currentBranch(this.getRepo())||"",s=await pe.listBranches(this.getRepo()),a=(r=await this.getConfig(`branch.${n}.remote`))!=null?r:"origin",o=(i=await this.getConfig(`branch.${n}.merge`))==null?void 0:i.split("refs/heads")[1],l=o?a+o:void 0;return{current:n,tracking:l,branches:s,remote:a}}catch(n){throw this.plugin.displayError(n),n}}async getCurrentRemote(){var n;let r=await pe.currentBranch(this.getRepo())||"";return(n=await this.getConfig(`branch.${r}.remote`))!=null?n:"origin"}async checkout(r,i){try{return this.wrapFS(pe.checkout({...this.getRepo(),ref:r,force:!!i,remote:i}))}catch(n){throw this.plugin.displayError(n),n}}async createBranch(r){try{await this.wrapFS(pe.branch({...this.getRepo(),ref:r,checkout:!0}))}catch(i){throw this.plugin.displayError(i),i}}async deleteBranch(r){try{await this.wrapFS(pe.deleteBranch({...this.getRepo(),ref:r}))}catch(i){throw this.plugin.displayError(i),i}}branchIsMerged(r){return Promise.resolve(!0)}async init(){try{await this.wrapFS(pe.init(this.getRepo()))}catch(r){throw this.plugin.displayError(r),r}}async clone(r,i,n){let s=this.showNotice("Initializing clone");try{await this.wrapFS(pe.clone({...this.getRepo(),dir:i,url:r,depth:n,onProgress:a=>{s!==void 0&&s.setMessage(this.getProgressText("Cloning",a))}})),s==null||s.hide()}catch(a){throw s==null||s.hide(),this.plugin.displayError(a),a}}async setConfig(r,i){try{return this.wrapFS(pe.setConfig({...this.getRepo(),path:r,value:i}))}catch(n){throw this.plugin.displayError(n),n}}async getConfig(r){try{return this.wrapFS(pe.getConfig({...this.getRepo(),path:r}))}catch(i){throw this.plugin.displayError(i),i}}async fetch(r){let i=this.showNotice("Initializing fetch");try{let n={...this.getRepo(),onProgress:s=>{i!==void 0&&i.setMessage(this.getProgressText("Fetching",s))},remote:r!=null?r:await this.getCurrentRemote()};await this.wrapFS(pe.fetch(n)),i==null||i.hide()}catch(n){throw this.plugin.displayError(n),i==null||i.hide(),n}}async setRemote(r,i){try{await this.wrapFS(pe.addRemote({...this.getRepo(),remote:r,url:i,force:!0}))}catch(n){throw this.plugin.displayError(n),n}}async getRemoteBranches(r){let i=[];return i.push(...await this.wrapFS(pe.listBranches({...this.getRepo(),remote:r}))),i.remove("HEAD"),i=i.map(n=>`${r}/${n}`),i}async getRemotes(){return(await this.wrapFS(pe.listRemotes({...this.getRepo()}))).map(r=>r.remote)}async removeRemote(r){await this.wrapFS(pe.deleteRemote({...this.getRepo(),remote:r}))}async getRemoteUrl(r){var i;return(i=(await this.wrapFS(pe.listRemotes({...this.getRepo()}))).filter(n=>n.remote==r)[0])==null?void 0:i.url}async log(r,i=!0,n,s){let a=await this.wrapFS(pe.log({...this.getRepo(),depth:n,ref:s}));return Promise.all(a.map(async o=>{var c;let l=o.commit.message.split(` `);return{message:(c=l[0])!=null?c:"",author:{name:o.commit.author.name,email:o.commit.author.email},body:l.slice(1).join(` `),date:new Date(o.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(o.commit.parent.first(),o.oid)).map(u=>({path:u.path,status:u.type,vaultPath:this.getRelativeVaultPath(u.path),hash:o.oid}))},hash:o.oid,refs:[]}}))}updateBasePath(r){return this.getRepo().dir=r,Promise.resolve()}getGitDirPath(){return(0,Cn.normalizePath)(this.getRelativeVaultPath(this.plugin.settings.gitDir||".git"))}async updateUpstreamBranch(r){let[i,n]=Vs(r),s=await this.branchInfo();await this.wrapFS(pe.push({...this.getRepo(),remote:i,remoteRef:n})),await this.setConfig(`branch.${s.current}.merge`,`refs/heads/${n}`)}updateGitPath(r){return Promise.resolve()}async getFileChangesCount(r,i){return this.walkDifference({walkers:[pe.TREE({ref:r}),pe.TREE({ref:i})]})}async walkDifference({walkers:r,dir:i}){return this.wrapFS(xv({...this.getRepo(),trees:r,map:async function(n,[s,a]){if(!wv(n,i))return null;if(await(s==null?void 0:s.type())==="tree"||await(a==null?void 0:a.type())==="tree")return;let o=await(s==null?void 0:s.oid()),l=await(a==null?void 0:a.oid()),c="equal";if(o!==l&&(c="M"),o===void 0&&(c="A"),l===void 0&&(c="D"),o===void 0&&l===void 0&&(console.log("Something weird happened:"),console.log(s),console.log(a)),c!=="equal")return{path:n,type:c}}}))}async getStagedFiles(r="."){return(await this.walkDifference({walkers:[pe.TREE({ref:"HEAD"}),pe.STAGE()],dir:r})).map(n=>({vaultPath:this.getRelativeVaultPath(n.path),path:n.path}))}async getUnstagedFiles(r="."){let i,n=window.setTimeout(()=>{i=new Cn.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let s=this.getRepo(),a=await this.wrapFS(xv({...s,trees:[pe.WORKDIR(),pe.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await pe.isIgnored({...s,filepath:o})||!wv(o,r))return null;let[u,f]=await Promise.all([l&&l.type(),c&&c.type()]),d=[u,f].includes("blob");if((u==="tree"||u==="special")&&!d)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!d)return;let h=f==="blob"?await c.oid():void 0,p;return u==="blob"&&f!=="blob"?p="42":u==="blob"&&(p=await l.oid()),p?h?p!==h?{path:o,type:"M"}:null:{path:o,type:"A"}:{path:o,type:"D"}}}));return window.clearTimeout(n),i==null||i.hide(),a}catch(s){throw window.clearTimeout(n),i==null||i.hide(),this.plugin.displayError(s),s}}async getDiffString(r,i=!1,n){let s=this.getRelativeVaultPath(r),a=async(c,[u])=>{if(r==c){let f=await u.oid();return(await pe.readBlob({...this.getRepo(),oid:f})).blob}};if(n){let c=await wu({...this.getRepo(),filepath:r,oid:n}).then(p=>new TextDecoder().decode(p.blob)).catch(p=>{if(!(p instanceof pe.Errors.NotFoundError))throw p}),f=(await pe.readCommit({...this.getRepo(),oid:n})).commit.parent.first(),d;return f&&(d=await wu({...this.getRepo(),filepath:r,oid:f}).then(p=>new TextDecoder().decode(p.blob)).catch(p=>{if(!(p instanceof pe.Errors.NotFoundError))throw p})),_u(s,d!=null?d:"",c!=null?c:"")}let o=(await xv({...this.getRepo(),trees:[pe.STAGE()],map:a})).first(),l=new TextDecoder().decode(o);if(i){let c=await this.resolveRef("HEAD").then(f=>wu({...this.getRepo(),filepath:r,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof pe.Errors.NotFoundError))throw f});return _u(s,c!=null?c:"",l)}else{let c;return await this.app.vault.adapter.exists(s)?c=await this.app.vault.adapter.read(s):c="",_u(s,l,c)}}async getLastCommitTime(){let r=this.getRepo(),i=await this.resolveRef("HEAD"),s=(await pe.readCommit({...r,oid:i})).commit.committer.timestamp;return new Date(s*1e3)}getFileStatusResult(r){var s,a;let i=`${r[this.HEAD]}${r[this.WORKDIR]}${r[this.STAGE]}`,n=this.status_mapping[i];if(n===void 0)throw new Error(`Unsupported status matrix row: ${i}`);return{index:n[0]=="?"?"U":(s=n[0])!=null?s:" ",workingDir:n[1]=="?"?"U":(a=n[1])!=null?a:" ",path:r[this.FILE],vaultPath:this.getRelativeVaultPath(r[this.FILE])}}async checkAuthorInfo(){let r=await this.getConfig("user.name"),i=await this.getConfig("user.email");if(!r||!i)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(r,i=!0){if(!this.plugin.settings.disablePopups)return new Cn.Notice(r,i?this.noticeLength:void 0)}};async function xv(t){let e=await pe.walk(t);if(!Array.isArray(e))throw new TypeError("isomorphic-git walk returned a non-array result");return e}function S3(t){let e=[new Uint8Array(t)].values();return{next:()=>Promise.resolve(e.next()),[Symbol.asyncIterator](){return this}}}async function k3(t){let e=new ReadableStream({async start(i){for await(let n of t)i.enqueue(n);i.close()}});return await new Response(e).arrayBuffer()}async function C3(t){let e=new Uint8Array(t);if(e.length<2||e[0]!==31||e[1]!==139)return t;try{let r=new Blob([t]).stream().pipeThrough(new DecompressionStream("gzip"));return await new Response(r).arrayBuffer()}catch(r){return t}}m();var PT=mt(Qd(),1),oi=mt(require("fs/promises"),1),rs=require("obsidian"),Be=mt(require("path"),1),Mu=require("path");m();var lh=mt(Nk(),1);m();var Ev=new WeakMap;function wl(...t){let e=new String(t);return Ev.set(e,t),e}function Si(t){return t instanceof String&&Ev.has(t)}function bl(t){var e;return(e=Ev.get(t))!=null?e:[]}var ah=mt(Qd(),1),pA=require("child_process");var QA=mt(kv(),1),cT=require("node:path");m();function*Bk(t,e){let r=e==="global";for(let i of t)i.isGlobal===r&&(yield i)}var z3=new Set(["--add","--edit","--remove-section","--rename-section","--replace-all","--unset","--unset-all","-e"]),W3=new Set(["--get","--get-all","--get-color","--get-colorbool","--get-regexp","--get-urlmatch","--list","-l"]),q3=new Set(["edit","remove-section","rename-section","set","unset"]),Y3=new Set(["get","get-color","get-colorbool","list"]);function Z3(t,e){var i;for(let{name:n}of Bk(t,"task")){if(z3.has(n))return _l(!0,e);if(W3.has(n))return _l(!1,e)}let r=(i=e.at(0))==null?void 0:i.toLowerCase();return r===void 0?null:q3.has(r)?_l(!0,e.slice(1)):Y3.has(r)?_l(!1,e.slice(1)):e.length===1?_l(!1,e):_l(!0,e)}function _l(t=!1,e=[]){var i;let r=(i=e.at(0))==null?void 0:i.toLowerCase();return r===void 0?null:{isWrite:t,isRead:!t,key:r,value:e.at(1)}}function K3(t,e){return e.isWrite&&e.value!==void 0?{key:e.key,value:e.value,scope:t}:{key:e.key,scope:t}}function X3(t){let e=(t==null?void 0:t.indexOf("="))||-1;return!t||e<0?null:{key:t.slice(0,e).trim().toLowerCase(),value:t.slice(e+1)}}function Q3(t){for(let{name:e}of Bk(t,"task"))switch(e){case"--global":return"global";case"--system":return"system";case"--worktree":return"worktree";case"--local":return"local";case"--file":case"-f":return"file"}return"local"}function J3({name:t}){if(t==="-c"||t==="--config")return"inline";if(t==="--config-env")return"env"}function*e8(t){for(let e of t){let r=J3(e),i=r&&X3(e.value);i&&(yield{...i,scope:r})}}function t8(t,e,r){let i={read:[],write:[...e8(e)]};return t==="config"&&r8(i,Q3(e),Z3(e,r)),i}function r8(t,e,r){if(r===null)return;let i=K3(e,r);r.isWrite?t.write.push(i):t.read.push(i)}var Hk={short:new Map([["c",!0]])},i8={short:new Map([["C",!0],["P",!1],["h",!1],["p",!1],["v",!1],...Hk.short.entries()]),long:new Set(["attr-source","config-env","exec-path","git-dir","list-cmds","namespace","super-prefix","work-tree"])},n8={clone:{short:new Map([["b",!0],["j",!0],["l",!1],["n",!1],["o",!0],["q",!1],["s",!1],["u",!0]]),long:new Set(["branch","config","jobs","origin","upload-pack","u","template"])},commit:{short:new Map([["C",!0],["F",!0],["c",!0],["m",!0],["t",!0]]),long:new Set(["file","message","reedit-message","reuse-message","template"])},config:{short:new Map([["e",!1],["f",!0],["l",!1]]),long:new Set(["blob","comment","default","file","type","value"])},fetch:{short:new Map,long:new Set(["upload-pack"])},init:{short:new Map,long:new Set(["template"])},pull:{short:new Map,long:new Set(["upload-pack"])},push:{short:new Map,long:new Set(["exec","receive-pack"])}},s8={short:new Map,long:new Set};function a8(t){var r;let e=(r=n8[t!=null?t:""])!=null?r:s8;return{short:new Map([...Hk.short.entries(),...e.short.entries()]),long:e.long}}function Uk(t,e=i8){if(t.startsWith("--")){let r=t.indexOf("=");if(r>2)return[{name:t.slice(0,r),value:t.slice(r+1),needsNext:!1}];let i=t.slice(2);return[{name:t,needsNext:e.long.has(i)}]}if(t.length===2){let r=t.charAt(1),i=e.short.get(r);return[{name:t,needsNext:i===!0}]}return o8(t,e.short)}function o8(t,e){let r=t.slice(1).split(""),i=[];for(let n=0;ne.has(l)))return i.push({name:`-${s}`,value:o,needsNext:!1}),i}i.push({name:`-${s}`,needsNext:a})}return i}function l8(t,e=[]){let r=0;for(;rfunction(){return t&&(e=(0,t[qv(t)[0]])(t=0)),e},E8=(t,e)=>function(){return e||(0,t[qv(t)[0]])((e={exports:{}}).exports,e),e.exports},Pt=(t,e)=>{for(var r in e)Wv(t,r,{get:e[r],enumerable:!0})},S8=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of qv(e))!x8.call(t,n)&&n!==r&&Wv(t,n,{get:()=>e[n],enumerable:!(i=y8(e,n))||i.enumerable});return t},St=t=>S8(Wv({},"__esModule",{value:!0}),t),jr,Ws=Y({"src/lib/errors/git-error.ts"(){"use strict";jr=class extends Error{constructor(t,e){super(e),this.task=t,Object.setPrototypeOf(this,new.target.prototype)}}}}),Pu,Sl=Y({"src/lib/errors/git-response-error.ts"(){"use strict";Ws(),Pu=class extends jr{constructor(t,e){super(void 0,e||String(t)),this.git=t}}}}),EC,SC=Y({"src/lib/errors/task-configuration-error.ts"(){"use strict";Ws(),EC=class extends jr{constructor(t){super(void 0,t)}}}});function kC(t){return typeof t!="function"?La:t}function CC(t){return typeof t=="function"&&t!==La}function AC(t,e){let r=t.indexOf(e);return r<=0?[t,""]:[t.substr(0,r),t.substr(r+1)]}function TC(t,e=0){return PC(t)&&t.length>e?t[e]:void 0}function Oa(t,e=0){if(PC(t)&&t.length>e)return t[t.length-1-e]}function PC(t){return dh(t)}function Ru(t="",e=!0,r=` `){return t.split(r).reduce((i,n)=>{let s=e?n.trim():n;return s&&i.push(s),i},[])}function Yv(t,e){return Ru(t,!0).map(r=>e(r))}function Zv(t){return(0,lh.exists)(t,lh.FOLDER)}function Ai(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function RC(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function ch(t,e){if(Array.isArray(t)){let r=t.indexOf(e);r>=0&&t.splice(r,1)}else t.delete(e);return e}function An(t){return Array.isArray(t)?t:[t]}function $C(t){return t.replace(/[\s-]+(.)/g,(e,r)=>r.toUpperCase())}function kl(t){return An(t).map(e=>e instanceof String?e:String(e))}function rt(t,e=0){if(t==null)return e;let r=parseInt(t,10);return Number.isNaN(r)?e:r}function Au(t,e){let r=[];for(let i=0,n=t.length;i{t[i]!==void 0&&(r[i]=t[i])}),r}function Fv(t=0){return new Promise(e=>setTimeout(e,t))}function Iv(t){if(t!==!1)return t}var xl,La,$u,uh=Y({"src/lib/utils/util.ts"(){"use strict";Kv(),xl="\0",La=()=>{},$u=Object.prototype.toString.call.bind(Object.prototype.toString)}});function ur(t,e,r){return e(t)?t:arguments.length>2?r:void 0}function Mv(t,e){let r=Si(t)?"string":typeof t;return/number|string|boolean/.test(r)&&(!e||!e.includes(r))}function fh(t){return!!t&&$u(t)==="[object Object]"}function IC(t){return typeof t=="function"}var Fu,MC,wt,nh,dh,Kv=Y({"src/lib/utils/argument-filters.ts"(){"use strict";uh(),Fu=t=>Array.isArray(t),MC=t=>typeof t=="number",wt=t=>typeof t=="string"||Si(t),nh=t=>wt(t)||Array.isArray(t)&&t.every(wt),dh=t=>t==null||"number|boolean|function".includes(typeof t)?!1:typeof t.length=="number"}}),Dv,k8=Y({"src/lib/utils/exit-codes.ts"(){"use strict";Dv=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(Dv||{})}}),sh,C8=Y({"src/lib/utils/git-output-streams.ts"(){"use strict";sh=class DC{constructor(e,r){this.stdOut=e,this.stdErr=r}asStrings(){return new DC(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}});function A8(){throw new Error("LineParser:useMatches not implemented")}var be,zs,T8=Y({"src/lib/utils/line-parser.ts"(){"use strict";be=class{constructor(t,e){this.matches=[],this.useMatches=A8,this.parse=(r,i)=>(this.resetMatches(),this._regExp.every((n,s)=>this.addMatch(n,s,r(s)))?this.useMatches(i,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,r){let i=r&&t.exec(r);return i&&this.pushMatch(e,i),!!i}pushMatch(t,e){this.matches.push(...e.slice(1))}},zs=class extends be{addMatch(t,e,r){return/^remote:\s/.test(String(r))&&super.addMatch(t,e,r)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function OC(...t){let e=process.cwd(),r=Object.assign({baseDir:e,...LC},...t.filter(i=>typeof i=="object"&&i));return r.baseDir=r.baseDir||e,r.trimmed=r.trimmed===!0,r}var LC,P8=Y({"src/lib/utils/simple-git-options.ts"(){"use strict";LC={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function Xv(t,e=[]){return fh(t)?Object.keys(t).reduce((r,i)=>{let n=t[i];if(Si(n))r.push(n);else if(Mv(n,["boolean"]))r.push(i+"="+n);else if(Array.isArray(n))for(let s of n)Mv(s,["string","number"])||r.push(i+"="+s);else r.push(i);return r},e):e}function Sr(t,e=0,r=!1){let i=[];for(let n=0,s=e<0?t.length:e;n{for(let s=Ru(n,i),a=0,o=s.length;a{if(!(a+c>=o))return s[a+c]};e.some(({parse:c})=>c(l,t))}}),t}var F8=Y({"src/lib/utils/task-parser.ts"(){"use strict";uh()}}),NC={};Pt(NC,{ExitCodes:()=>Dv,GitOutputStreams:()=>sh,LineParser:()=>be,NOOP:()=>La,NULL:()=>xl,RemoteLineParser:()=>zs,append:()=>Ai,appendTaskOptions:()=>Xv,asArray:()=>An,asCamelCase:()=>$C,asFunction:()=>kC,asNumber:()=>rt,asStringArray:()=>kl,bufferToString:()=>Tu,callTaskParser:()=>Ov,createInstanceConfig:()=>OC,delay:()=>Fv,filterArray:()=>Fu,filterFunction:()=>IC,filterHasLength:()=>dh,filterNumber:()=>MC,filterPlainObject:()=>fh,filterPrimitives:()=>Mv,filterString:()=>wt,filterStringOrStringArray:()=>nh,filterType:()=>ur,first:()=>TC,folderExists:()=>Zv,forEachLineWithContent:()=>Yv,getTrailingOptions:()=>Sr,including:()=>RC,isUserFunction:()=>CC,last:()=>Oa,objectToString:()=>$u,orVoid:()=>Iv,parseStringResponse:()=>Vr,pick:()=>FC,prefixedArray:()=>Au,remove:()=>ch,splitOn:()=>AC,toLinesWithContent:()=>Ru,trailingFunctionArgument:()=>ct,trailingOptionsArgument:()=>Qv});var ve=Y({"src/lib/utils/index.ts"(){"use strict";Kv(),k8(),C8(),T8(),P8(),$8(),F8(),uh()}}),BC={};Pt(BC,{CheckRepoActions:()=>Lv,checkIsBareRepoTask:()=>UC,checkIsRepoRootTask:()=>HC,checkIsRepoTask:()=>I8});function I8(t){switch(t){case"bare":return UC();case"root":return HC()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:hh,parser:Jv}}function HC(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:hh,parser(e){return/^\.(git)?$/.test(e.trim())}}}function UC(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:hh,parser:Jv}}function M8(t){return/(Not a git repository|Kein Git-Repository)/i.test(String(t))}var Lv,hh,Jv,GC=Y({"src/lib/tasks/check-is-repo.ts"(){"use strict";ve(),Lv=(t=>(t.BARE="bare",t.IN_TREE="tree",t.IS_REPO_ROOT="root",t))(Lv||{}),hh=({exitCode:t},e,r,i)=>{if(t===128&&M8(e))return r(k.from("false"));i(e)},Jv=t=>t.trim()==="true"}});function D8(t,e){let r=new jC(t),i=t?zC:VC;return Ru(e).forEach(n=>{let s=n.replace(i,"");r.paths.push(s),(WC.test(s)?r.folders:r.files).push(s)}),r}var jC,VC,zC,WC,O8=Y({"src/lib/responses/CleanSummary.ts"(){"use strict";ve(),jC=class{constructor(t){this.dryRun=t,this.paths=[],this.files=[],this.folders=[]}},VC=/^[a-z]+\s*/i,zC=/^[a-z]+\s+[a-z]+\s*/i,WC=/\/$/}}),Nv={};Pt(Nv,{EMPTY_COMMANDS:()=>ph,adhocExecTask:()=>qC,configurationErrorTask:()=>Gr,isBufferTask:()=>ZC,isEmptyTask:()=>KC,straightThroughBufferTask:()=>YC,straightThroughStringTask:()=>kr});function qC(t){return{commands:ph,format:"empty",parser:t}}function Gr(t){return{commands:ph,format:"empty",parser(){throw typeof t=="string"?new EC(t):t}}}function kr(t,e=!1){return{commands:t,format:"utf-8",parser(r){return e?String(r).trim():r}}}function YC(t){return{commands:t,format:"buffer",parser(e){return e}}}function ZC(t){return t.format==="buffer"}function KC(t){return t.format==="empty"||!t.commands.length}var ph,kt=Y({"src/lib/tasks/task.ts"(){"use strict";SC(),ph=[]}}),XC={};Pt(XC,{CONFIG_ERROR_INTERACTIVE_MODE:()=>ew,CONFIG_ERROR_MODE_REQUIRED:()=>tw,CONFIG_ERROR_UNKNOWN_OPTION:()=>rw,CleanOptions:()=>Da,cleanTask:()=>QC,cleanWithOptionsTask:()=>L8,isCleanOptionsArray:()=>N8});function L8(t,e){let{cleanMode:r,options:i,valid:n}=B8(t);return r?n.options?(i.push(...e),i.some(G8)?Gr(ew):QC(r,i)):Gr(rw+JSON.stringify(t)):Gr(tw)}function QC(t,e){return{commands:["clean",`-${t}`,...e],format:"utf-8",parser(i){return D8(t==="n",i)}}}function N8(t){return Array.isArray(t)&&t.every(e=>iw.has(e))}function B8(t){let e,r=[],i={cleanMode:!1,options:!0};return t.replace(/[^a-z]i/g,"").split("").forEach(n=>{H8(n)?(e=n,i.cleanMode=!0):i.options=i.options&&U8(r[r.length]=`-${n}`)}),{cleanMode:e,options:r,valid:i}}function H8(t){return t==="f"||t==="n"}function U8(t){return/^-[a-z]$/i.test(t)&&iw.has(t.charAt(1))}function G8(t){return/^-[^\-]/.test(t)?t.indexOf("i")>0:t==="--interactive"}var ew,tw,rw,Da,iw,JC=Y({"src/lib/tasks/clean.ts"(){"use strict";O8(),ve(),kt(),ew="Git clean interactive mode is not supported",tw='Git clean mode parameter ("n" or "f") is required',rw="Git clean unknown option found in: ",Da=(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))(Da||{}),iw=new Set(["i",...kl(Object.values(Da))])}});function j8(t){let e=new tA;for(let r of eA(t))e.addValue(r.file,String(r.key),r.value);return e}function V8(t,e){let r=null,i=[],n=new Map;for(let s of eA(t,e))s.key===e&&(i.push(r=s.value),n.has(s.file)||n.set(s.file,[]),n.get(s.file).push(r));return{key:e,paths:Array.from(n.keys()),scopes:n,value:r,values:i}}function z8(t){return t.replace(/^(file):/,"")}function*eA(t,e=null){let r=t.split("\0");for(let i=0,n=r.length-1;iObject.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=Oa(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,r){let i=this.addFile(t);Object.hasOwn(i,e)?Array.isArray(i[e])?i[e].push(r):i[e]=[i[e],r]:i[e]=r,this._all=void 0}}}});function Cv(t,e){return typeof t=="string"&&Object.hasOwn(Bv,t)?t:e}function q8(t,e,r,i){let n=["config",`--${i}`];return r&&n.push("--add"),n.push(t,e),{commands:n,format:"utf-8",parser(s){return s}}}function Y8(t,e){let r=["config","--null","--show-origin","--get-all",t];return e&&r.splice(1,0,`--${e}`),{commands:r,format:"utf-8",parser(i){return V8(i,t)}}}function Z8(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(r){return j8(r)}}}function K8(){return{addConfig(t,e,...r){return this._runTask(q8(t,e,r[0]===!0,Cv(r[1],"local")),ct(arguments))},getConfig(t,e){return this._runTask(Y8(t,Cv(e,void 0)),ct(arguments))},listConfig(...t){return this._runTask(Z8(Cv(t[0],void 0)),ct(arguments))}}}var Bv,rA=Y({"src/lib/tasks/config.ts"(){"use strict";W8(),ve(),Bv=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(Bv||{})}});function X8(t){return iA.has(t)}var Av,iA,nA=Y({"src/lib/tasks/diff-name-status.ts"(){"use strict";Av=(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))(Av||{}),iA=new Set(Object.values(Av))}});function Q8(...t){return new aA().param(...t)}function J8(t){let e=new Set,r={};return Yv(t,i=>{let[n,s,a]=i.split(xl);e.add(n),(r[n]=r[n]||[]).push({line:rt(s),path:n,preview:a})}),{paths:e,results:r}}function eH(){return{grep(t){let e=ct(arguments),r=Sr(arguments);for(let n of sA)if(r.includes(n))return this._runTask(Gr(`git.grep: use of "${n}" is not supported.`),e);typeof t=="string"&&(t=Q8().param(t));let i=["grep","--null","-n","--full-name",...r,...t];return this._runTask({commands:i,format:"utf-8",parser(n){return J8(n)}},e)}}}var sA,Cu,Wk,aA,oA=Y({"src/lib/tasks/grep.ts"(){"use strict";ve(),kt(),sA=["-h"],Cu=Symbol("grepQuery"),aA=class{constructor(){this[Wk]=[]}*[(Wk=Cu,Symbol.iterator)](){for(let t of this[Cu])yield t}and(...t){return t.length&&this[Cu].push("--and","(",...Au(t,"-e"),")"),this}param(...t){return this[Cu].push(...Au(t,"-e")),this}}}}),lA={};Pt(lA,{ResetMode:()=>th,getResetMode:()=>rH,resetTask:()=>tH});function tH(t,e){let r=["reset"];return cA(t)&&r.push(`--${t}`),r.push(...e),kr(r)}function rH(t){if(cA(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function cA(t){return typeof t=="string"&&uA.includes(t)}var th,uA,fA=Y({"src/lib/tasks/reset.ts"(){"use strict";ve(),kt(),th=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(th||{}),uA=kl(Object.values(th))}});function iH(){return(0,ah.default)("simple-git")}function qk(t,e,r){return!e||!String(e).replace(/\s*/,"")?r?(i,...n)=>{t(i,...n),r(i,...n)}:t:(i,...n)=>{t(`%s ${i}`,e,...n),r&&r(i,...n)}}function nH(t,e,{namespace:r}){if(typeof t=="string")return t;let i=e&&e.namespace||"";return i.startsWith(r)?i.substr(r.length+1):i||r}function nw(t,e,r,i=iH()){let n=t&&`[${t}]`||"",s=[],a=typeof e=="string"?i.extend(e):e,o=nH(ur(e,wt),a,i);return c(r);function l(u,f){return Ai(s,nw(t,o.replace(/^[^:]+/,u),f,i))}function c(u){let f=u&&`[${u}]`||"",d=a&&qk(a,f)||La,h=qk(i,`${n} ${f}`,d);return Object.assign(a?d:h,{label:t,sibling:l,info:h,step:c})}}var dA=Y({"src/lib/git-logger.ts"(){"use strict";ve(),ah.default.formatters.L=t=>String(dh(t)?t.length:"-"),ah.default.formatters.B=t=>k.isBuffer(t)?t.toString("utf8"):$u(t)}}),hA,sH=Y({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";var t;Ws(),dA(),hA=(t=class{constructor(r="GitExecutor"){this.logLabel=r,this._queue=new Map}withProgress(r){return this._queue.get(r)}createProgress(r){let i=t.getName(r.commands[0]),n=nw(this.logLabel,i);return{task:r,logger:n,name:i}}push(r){let i=this.createProgress(r);return i.logger("Adding task to the queue, commands = %o",r.commands),this._queue.set(r,i),i}fatal(r){for(let[i,{logger:n}]of Array.from(this._queue.entries()))i===r.task?(n.info("Failed %o",r),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",r.message),this.complete(i);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(r){this.withProgress(r)&&this._queue.delete(r)}attempt(r){let i=this.withProgress(r);if(!i)throw new jr(void 0,"TasksPendingQueue: attempt called for an unknown task");return i.logger("Starting task"),i}static getName(r="empty"){return`task:${r}:${++t.counter}`}},t.counter=0,t)}});function Ma(t,e){return{method:TC(t.commands)||"",commands:e}}function aH(t,e){return r=>{e("[ERROR] child process exception %o",r),t.push(k.from(String(r.stack),"ascii"))}}function Yk(t,e,r,i){return n=>{r("%s received %L bytes",e,n),i("%B",n),t.push(n)}}var Hv,oH=Y({"src/lib/runners/git-executor-chain.ts"(){"use strict";Ws(),kt(),ve(),sH(),Hv=class{constructor(t,e,r){this._executor=t,this._scheduler=e,this._plugins=r,this._chain=Promise.resolve(),this._queue=new hA}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))}async attemptTask(t){let e=await this._scheduler.next(),r=()=>this._queue.complete(t);try{let{logger:i}=this._queue.attempt(t);return await(KC(t)?this.attemptEmptyTask(t,i):this.attemptRemoteTask(t,i))}catch(i){throw this.onFatalException(t,i)}finally{r(),e()}}onFatalException(t,e){let r=e instanceof jr?Object.assign(e,{task:t}):new jr(t,e&&String(e));return this._chain=Promise.resolve(),this._queue.fatal(r),r}async attemptRemoteTask(t,e){let r=this._plugins.exec("spawn.binary","",Ma(t,t.commands)),i=this._plugins.exec("spawn.args",[...t.commands],{...Ma(t,t.commands),env:{...this.env}}),n=await this.gitResponse(t,r,i,this.outputHandler,e.step("SPAWN")),s=await this.handleTaskData(t,i,n,e.step("HANDLE"));return e("passing response to task's parser as a %s",t.format),ZC(t)?Ov(t.parser,s):Ov(t.parser,s.asStrings())}async attemptEmptyTask(t,e){return e("empty task bypassing child process to call to task's parser"),t.parser(this)}handleTaskData(t,e,r,i){let{exitCode:n,rejection:s,stdOut:a,stdErr:o}=r;return new Promise((l,c)=>{i("Preparing to handle process response exitCode=%d stdOut=",n);let{error:u}=this._plugins.exec("task.error",{error:s},{...Ma(t,e),...r});if(u&&t.onError)return i.info("exitCode=%s handling with custom error handler"),t.onError(r,u,f=>{i.info("custom error handler treated as success"),i("custom error returned a %s",$u(f)),l(new sh(Array.isArray(f)?k.concat(f):f,k.concat(o)))},c);if(u)return i.info("handling as error: exitCode=%s stdErr=%s rejection=%o",n,o.length,s),c(u);i.info("retrieving task output complete"),l(new sh(k.concat(a),k.concat(o)))})}async gitResponse(t,e,r,i,n){let s=n.sibling("output"),a=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},Ma(t,t.commands));return new Promise(o=>{let l=[],c=[];n.info("%s %o",e,r),n("%O",a);let u=this._beforeSpawn(t,r);if(u)return o({stdOut:l,stdErr:c,exitCode:9901,rejection:u});this._plugins.exec("spawn.before",void 0,{...Ma(t,r),kill(d){u=d||u}});let f=(0,pA.spawn)(e,r,a);f.stdout.on("data",Yk(l,"stdOut",n,s.step("stdOut"))),f.stderr.on("data",Yk(c,"stdErr",n,s.step("stdErr"))),f.on("error",aH(c,n)),i&&(n("Passing child process stdOut/stdErr to custom outputHandler"),i(e,f.stdout,f.stderr,[...r])),this._plugins.exec("spawn.after",void 0,{...Ma(t,r),spawned:f,close(d,h){o({stdOut:l,stdErr:c,exitCode:d,rejection:u||h})},kill(d){f.killed||(u=d,f.kill("SIGINT"))}})})}_beforeSpawn(t,e){let r;return this._plugins.exec("spawn.before",void 0,{...Ma(t,e),kill(i){r=i||r}}),r}}}}),mA={};Pt(mA,{GitExecutor:()=>gA});var gA,lH=Y({"src/lib/runners/git-executor.ts"(){"use strict";oH(),gA=class{constructor(t,e,r){this.cwd=t,this._scheduler=e,this._plugins=r,this._chain=new Hv(this,this._scheduler,this._plugins)}chain(){return new Hv(this,this._scheduler,this._plugins)}push(t){return this._chain.push(t)}}}});function cH(t,e,r=La){let i=s=>{r(null,s)},n=s=>{(s==null?void 0:s.task)===t&&r(s instanceof Pu?uH(s):s,void 0)};e.then(i,n)}function uH(t){let e=i=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${i} should be GitResponseError.git.${i}, this will no longer be available in version 3`),e=La};return Object.create(t,Object.getOwnPropertyNames(t.git).reduce(r,{}));function r(i,n){return n in t||(i[n]={enumerable:!1,configurable:!1,get(){return e(n),t.git[n]}}),i}}var fH=Y({"src/lib/task-callback.ts"(){"use strict";Sl(),ve()}});function Zk(t,e){return qC(r=>{if(!Zv(t))throw new Error(`Git.cwd: cannot change to non-directory "${t}"`);return(e||r).cwd=t})}var dH=Y({"src/lib/tasks/change-working-directory.ts"(){"use strict";ve(),kt()}});function Tv(t){let e=["checkout",...t];return e[1]==="-b"&&e.includes("-B")&&(e[1]=ch(e,"-B")),kr(e)}function hH(){return{checkout(){return this._runTask(Tv(Sr(arguments,1)),ct(arguments))},checkoutBranch(t,e){return this._runTask(Tv(["-b",t,e,...Sr(arguments)]),ct(arguments))},checkoutLocalBranch(t){return this._runTask(Tv(["-b",t,...Sr(arguments)]),ct(arguments))}}}var pH=Y({"src/lib/tasks/checkout.ts"(){"use strict";ve(),kt()}});function mH(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function gH(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(t){return Vr(mH(),[vA],t)}})}}}var vA,vH=Y({"src/lib/tasks/count-objects.ts"(){"use strict";ve(),vA=new be(/([a-z-]+): (\d+)$/,(t,[e,r])=>{let i=$C(e);Object.hasOwn(t,i)&&(t[i]=rt(r))})}});function wH(t){return Vr({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},wA,t)}var wA,bH=Y({"src/lib/parsers/parse-commit.ts"(){"use strict";ve(),wA=[new be(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(t,[e,r,i])=>{t.branch=e,t.commit=i,t.root=!!r}),new be(/\s*Author:\s(.+)/i,(t,[e])=>{let r=e.split("<"),i=r.pop();!i||!i.includes("@")||(t.author={email:i.substr(0,i.length-1),name:r.join("<").trim()})}),new be(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(t,[e,r,i])=>{t.summary.changes=parseInt(e,10)||0,t.summary.insertions=parseInt(r,10)||0,t.summary.deletions=parseInt(i,10)||0}),new be(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(t,[e,r,i])=>{t.summary.changes=parseInt(e,10)||0;let n=parseInt(r,10)||0;i==="-"?t.summary.deletions=n:i==="+"&&(t.summary.insertions=n)})]}});function _H(t,e,r){return{commands:["-c","core.abbrev=40","commit",...Au(t,"-m"),...e,...r],format:"utf-8",parser:wH}}function yH(){return{commit(e,...r){let i=ct(arguments),n=t(e)||_H(An(e),An(ur(r[0],nh,[])),[...kl(ur(r[1],Fu,[])),...Sr(arguments,0,!0)]);return this._runTask(n,i)}};function t(e){return!nh(e)&&Gr("git.commit: requires the commit message to be supplied as a string/string[]")}}var xH=Y({"src/lib/tasks/commit.ts"(){"use strict";bH(),ve(),kt()}});function EH(){return{firstCommit(){return this._runTask(kr(["rev-list","--max-parents=0","HEAD"],!0),ct(arguments))}}}var SH=Y({"src/lib/tasks/first-commit.ts"(){"use strict";ve(),kt()}});function kH(t,e){let r=["hash-object",t];return e&&r.push("-w"),kr(r,!0)}var CH=Y({"src/lib/tasks/hash-object.ts"(){"use strict";kt()}});function AH(t,e,r){let i=String(r).trim(),n;if(n=bA.exec(i))return new rh(t,e,!1,n[1]);if(n=_A.exec(i))return new rh(t,e,!0,n[1]);let s="",a=i.split(" ");for(;a.length;)if(a.shift()==="in"){s=a.join(" ");break}return new rh(t,e,/^re/i.test(i),s)}var rh,bA,_A,TH=Y({"src/lib/responses/InitSummary.ts"(){"use strict";rh=class{constructor(t,e,r,i){this.bare=t,this.path=e,this.existing=r,this.gitDir=i}},bA=/^Init.+ repository in (.+)$/,_A=/^Rein.+ in (.+)$/}});function PH(t){return t.includes(sw)}function RH(t=!1,e,r){let i=["init",...r];return t&&!PH(i)&&i.splice(1,0,sw),{commands:i,format:"utf-8",parser(n){return AH(i.includes("--bare"),e,n)}}}var sw,$H=Y({"src/lib/tasks/init.ts"(){"use strict";TH(),sw="--bare"}});function aw(t){for(let e=0;eVr(new yA,e,r,!1)}var Pv,Kk,Xk,Qk,EA,SA=Y({"src/lib/parsers/parse-diff-summary.ts"(){"use strict";Iu(),IH(),nA(),ve(),Pv=[new be(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(t,[e,r,i=""])=>{t.files.push({file:e.trim(),changes:rt(r),insertions:i.replace(/[^+]/g,"").length,deletions:i.replace(/[^-]/g,"").length,binary:!1})}),new be(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(t,[e,r,i])=>{t.files.push({file:e.trim(),before:rt(r),after:rt(i),binary:!0})}),new be(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(t,[e,r])=>{let i=/(\d+) i/.exec(r),n=/(\d+) d/.exec(r);t.changed=rt(e),t.insertions=rt(i==null?void 0:i[1]),t.deletions=rt(n==null?void 0:n[1])})],Kk=[new be(/(\d+)\t(\d+)\t(.+)$/,(t,[e,r,i])=>{let n=rt(e),s=rt(r);t.changed++,t.insertions+=n,t.deletions+=s,t.files.push({file:i,changes:n+s,insertions:n,deletions:s,binary:!1})}),new be(/-\t-\t(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,after:0,before:0,binary:!0})})],Xk=[new be(/(.+)$/,(t,[e])=>{t.changed++,t.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],Qk=[new be(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(t,[e,r,i,n,s])=>{t.changed++,t.files.push({file:s!=null?s:i,changes:0,insertions:0,deletions:0,binary:!1,status:Iv(X8(e)&&e),from:Iv(!!s&&i!==s&&i),similarity:rt(r)})})],EA={"":Pv,"--stat":Pv,"--numstat":Kk,"--name-status":Qk,"--name-only":Xk}}});function MH(t,e){return e.reduce((r,i,n)=>(r[i]=t[n]||"",r),Object.create({diff:null}))}function kA(t=uw,e=CA,r=""){let i=xA(r);return function(n){let s=Ru(n.trim(),!1,lw).map(function(a){let o=a.split(cw),l=MH(o[0].split(t),e);return o.length>1&&o[1].trim()&&(l.diff=i(o[1])),l});return{all:s,latest:s.length&&s[0]||null,total:s.length}}}var lw,cw,uw,CA,AA=Y({"src/lib/parsers/parse-list-log-summary.ts"(){"use strict";ve(),SA(),Iu(),lw="\xF2\xF2\xF2\xF2\xF2\xF2 ",cw=" \xF2\xF2",uw=" \xF2 ",CA=["hash","date","message","refs","author_name","author_email"]}}),TA={};Pt(TA,{diffSummaryTask:()=>DH,validateLogFormatConfig:()=>mh});function DH(t){let e=aw(t),r=["diff"];return e===""&&(e="--stat",r.push("--stat=4096")),r.push(...t),mh(r)||{commands:r,format:"utf-8",parser:xA(e)}}function mh(t){let e=t.filter(FH);if(e.length>1)return Gr(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&t.includes("-z"))return Gr(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}var fw=Y({"src/lib/tasks/diff.ts"(){"use strict";Iu(),SA(),kt()}});function OH(t,e){let r=[],i=[];return Object.keys(t).forEach(n=>{r.push(n),i.push(String(t[n]))}),[r,i.join(e)]}function LH(t){return Object.keys(t).reduce((e,r)=>(r in Uv||(e[r]=t[r]),e),{})}function PA(t={},e=[]){let r=ur(t.splitter,wt,uw),i=fh(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"},[n,s]=OH(i,r),a=[],o=[`--pretty=format:${lw}${s}${cw}`,...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?"...":"..";a.push(`${t.from||""}${c}${t.to||""}`)}return wt(t.file)&&o.push("--follow",wl(t.file)),Xv(LH(t),o),{fields:n,splitter:r,commands:[...o,...a]}}function NH(t,e,r){let i=kA(t,e,aw(r));return{commands:["log",...r],format:"utf-8",parser:i}}function BH(){return{log(...r){let i=ct(arguments),n=PA(Qv(arguments),kl(ur(arguments[0],Fu,[]))),s=e(...r)||mh(n.commands)||t(n);return this._runTask(s,i)}};function t(r){return NH(r.splitter,r.fields,r.commands)}function e(r,i){return wt(r)&&wt(i)&&Gr("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var Uv,RA=Y({"src/lib/tasks/log.ts"(){"use strict";Iu(),AA(),ve(),kt(),fw(),Uv=(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))(Uv||{})}}),ih,$A,HH=Y({"src/lib/responses/MergeSummary.ts"(){"use strict";ih=class{constructor(t,e=null,r){this.reason=t,this.file=e,this.meta=r}toString(){return`${this.file}:${this.reason}`}},$A=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"}}}}),Gv,FA,UH=Y({"src/lib/responses/PullSummary.ts"(){"use strict";Gv=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},FA=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}}}});function Rv(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 Jk(t){let e=/^\s*(\d+)/.exec(t),r=/delta (\d+)/i.exec(t);return{count:rt(e&&e[1]||"0"),delta:rt(r&&r[1]||"0")}}var IA,GH=Y({"src/lib/parsers/parse-remote-objects.ts"(){"use strict";ve(),IA=[new zs(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(t,[e,r])=>{let i=e.toLowerCase(),n=Rv(t.remoteMessages);Object.assign(n,{[i]:rt(r)})}),new zs(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(t,[e,r])=>{let i=e.toLowerCase(),n=Rv(t.remoteMessages);Object.assign(n,{[i]:rt(r)})}),new zs(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(t,[e,r,i])=>{let n=Rv(t.remoteMessages);n.total=Jk(e),n.reused=Jk(r),n.packReused=rt(i)})]}});function MA(t,e){return Vr({remoteMessages:new OA},DA,e)}var DA,OA,LA=Y({"src/lib/parsers/parse-remote-messages.ts"(){"use strict";ve(),GH(),DA=[new zs(/^remote:\s*(.+)$/,(t,[e])=>(t.remoteMessages.all.push(e.trim()),!1)),...IA,new zs([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(t,[e])=>{t.remoteMessages.pullRequestUrl=e}),new zs([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(t,[e,r,i])=>{t.remoteMessages.vulnerabilities={count:rt(e),summary:r,url:i}})],OA=class{constructor(){this.all=[]}}}});function jH(t,e){let r=Vr(new FA,NA,[t,e]);return r.message&&r}var eC,tC,rC,iC,NA,nC,dw,BA=Y({"src/lib/parsers/parse-pull.ts"(){"use strict";UH(),ve(),LA(),eC=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,tC=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,rC=/^(create|delete) mode \d+ (.+)/,iC=[new be(eC,(t,[e,r,i])=>{t.files.push(e),r&&(t.insertions[e]=r.length),i&&(t.deletions[e]=i.length)}),new be(tC,(t,[e,,r,,i])=>r!==void 0||i!==void 0?(t.summary.changes=+e||0,t.summary.insertions=+r||0,t.summary.deletions=+i||0,!0):!1),new be(rC,(t,[e,r])=>{Ai(t.files,r),Ai(e==="create"?t.created:t.deleted,r)})],NA=[new be(/^from\s(.+)$/i,(t,[e])=>{t.remote=e}),new be(/^fatal:\s(.+)$/,(t,[e])=>{t.message=e}),new be(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(t,[e,r,i,n])=>{t.branch.local=i,t.hash.local=e,t.branch.remote=n,t.hash.remote=r})],nC=(t,e)=>Vr(new Gv,iC,[t,e]),dw=(t,e)=>Object.assign(new Gv,nC(t,e),MA(t,e))}}),sC,HA,aC,VH=Y({"src/lib/parsers/parse-merge.ts"(){"use strict";HH(),ve(),BA(),sC=[new be(/^Auto-merging\s+(.+)$/,(t,[e])=>{t.merges.push(e)}),new be(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(t,[e,r])=>{t.conflicts.push(new ih(e,r))}),new be(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(t,[e,r,i])=>{t.conflicts.push(new ih(e,r,{deleteRef:i}))}),new be(/^CONFLICT\s+\((.+)\):/,(t,[e])=>{t.conflicts.push(new ih(e,null))}),new be(/^Automatic merge failed;\s+(.+)$/,(t,[e])=>{t.result=e})],HA=(t,e)=>Object.assign(aC(t,e),dw(t,e)),aC=t=>Vr(new $A,sC,t)}});function oC(t){return t.length?{commands:["merge",...t],format:"utf-8",parser(e,r){let i=HA(e,r);if(i.failed)throw new Pu(i);return i}}:Gr("Git.merge requires at least one option")}var zH=Y({"src/lib/tasks/merge.ts"(){"use strict";Sl(),VH(),kt()}});function WH(t,e,r){let i=r.includes("deleted"),n=r.includes("tag")||/^refs\/tags/.test(t),s=!r.includes("new");return{deleted:i,tag:n,branch:!n,new:!s,alreadyUpdated:s,local:t,remote:e}}var lC,UA,cC,qH=Y({"src/lib/parsers/parse-push.ts"(){"use strict";ve(),LA(),lC=[new be(/^Pushing to (.+)$/,(t,[e])=>{t.repo=e}),new be(/^updating local tracking ref '(.+)'/,(t,[e])=>{t.ref={...t.ref||{},local:e}}),new be(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(t,[e,r,i])=>{t.pushed.push(WH(e,r,i))}),new be(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(t,[e,r,i])=>{t.branch={...t.branch||{},local:e,remote:r,remoteName:i}}),new be(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(t,[e,r,i,n])=>{t.update={head:{local:e,remote:r},hash:{from:i,to:n}}})],UA=(t,e)=>{let r=cC(t,e),i=MA(t,e);return{...r,...i}},cC=(t,e)=>Vr({pushed:[]},lC,[t,e])}}),GA={};Pt(GA,{pushTagsTask:()=>YH,pushTask:()=>hw});function YH(t={},e){return Ai(e,"--tags"),hw(t,e)}function hw(t={},e){let r=["push",...e];return t.branch&&r.splice(1,0,t.branch),t.remote&&r.splice(1,0,t.remote),ch(r,"-v"),Ai(r,"--verbose"),Ai(r,"--porcelain"),{commands:r,format:"utf-8",parser:UA}}var jA=Y({"src/lib/tasks/push.ts"(){"use strict";qH(),ve()}});function ZH(){return{showBuffer(){let t=["show",...Sr(arguments,1)];return t.includes("--binary")||t.splice(1,0,"--binary"),this._runTask(YC(t),ct(arguments))},show(){let t=["show",...Sr(arguments,1)];return this._runTask(kr(t),ct(arguments))}}}var KH=Y({"src/lib/tasks/show.ts"(){"use strict";ve(),kt()}}),uC,VA,XH=Y({"src/lib/responses/FileStatusSummary.ts"(){"use strict";uC=/^(.+)\0(.+)$/,VA=class{constructor(t,e,r){if(this.path=t,this.index=e,this.working_dir=r,e==="R"||r==="R"){let i=uC.exec(t)||[null,t,t];this.from=i[2]||"",this.path=i[1]||""}}}}});function fC(t){let[e,r]=t.split(xl);return{from:r||e,to:e}}function ai(t,e,r){return[`${t}${e}`,r]}function $v(t,...e){return e.map(r=>ai(t,r,(i,n)=>i.conflicted.push(n)))}function QH(t,e){let r=e.trim();switch(" "){case r.charAt(2):return i(r.charAt(0),r.charAt(1),r.slice(3));case r.charAt(1):return i(" ",r.charAt(0),r.slice(2));default:return}function i(n,s,a){let o=`${n}${s}`,l=zA.get(o);l&&l(t,a),o!=="##"&&o!=="!!"&&t.files.push(new VA(a,n,s))}}var dC,zA,WA,JH=Y({"src/lib/responses/StatusSummary.ts"(){"use strict";ve(),XH(),dC=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}},zA=new Map([ai(" ","A",(t,e)=>t.created.push(e)),ai(" ","D",(t,e)=>t.deleted.push(e)),ai(" ","M",(t,e)=>t.modified.push(e)),ai("A"," ",(t,e)=>{t.created.push(e),t.staged.push(e)}),ai("A","M",(t,e)=>{t.created.push(e),t.staged.push(e),t.modified.push(e)}),ai("D"," ",(t,e)=>{t.deleted.push(e),t.staged.push(e)}),ai("M"," ",(t,e)=>{t.modified.push(e),t.staged.push(e)}),ai("M","M",(t,e)=>{t.modified.push(e),t.staged.push(e)}),ai("R"," ",(t,e)=>{t.renamed.push(fC(e))}),ai("R","M",(t,e)=>{let r=fC(e);t.renamed.push(r),t.modified.push(r.to)}),ai("!","!",(t,e)=>{(t.ignored=t.ignored||[]).push(e)}),ai("?","?",(t,e)=>t.not_added.push(e)),...$v("A","A","U"),...$v("D","D","U"),...$v("U","A","D","U"),["##",(t,e)=>{let r=/ahead (\d+)/,i=/behind (\d+)/,n=/^(.+?(?=(?:\.{3}|\s|$)))/,s=/\.{3}(\S*)/,a=/\son\s(\S+?)(?=\.{3}|$)/,o=r.exec(e);t.ahead=o&&+o[1]||0,o=i.exec(e),t.behind=o&&+o[1]||0,o=n.exec(e),t.current=ur(o==null?void 0:o[1],wt,null),o=s.exec(e),t.tracking=ur(o==null?void 0:o[1],wt,null),o=a.exec(e),o&&(t.current=ur(o==null?void 0:o[1],wt,t.current)),t.detached=/\(no branch\)/.test(e)}]]),WA=function(t){let e=t.split(xl),r=new dC;for(let i=0,n=e.length;i!qA.includes(r))],parser(r){return WA(r)}}}var qA,t6=Y({"src/lib/tasks/status.ts"(){"use strict";JH(),qA=["--null","-z"]}});function oh(t=0,e=0,r=0,i="",n=!0){return Object.defineProperty({major:t,minor:e,patch:r,agent:i,installed:n},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function r6(){return oh(0,0,0,"",!1)}function i6(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:n6,onError(t,e,r,i){if(t.exitCode===-2)return r(k.from(pw));i(e)}})}}}function n6(t){return t===pw?r6():Vr(oh(0,0,0,t),YA,t)}var pw,YA,s6=Y({"src/lib/tasks/version.ts"(){"use strict";ve(),pw="installed=false",YA=[new be(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(t,[e,r,i,n=""])=>{Object.assign(t,oh(rt(e),rt(r),rt(i),n))}),new be(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(t,[e,r,i,n=""])=>{Object.assign(t,oh(rt(e),rt(r),i,n))})]}});function hC(t,e,r,...i){return wt(r)?e(r,ur(i[0],wt),Sr(arguments)):Gr(`git.${t}() requires a string 'repoPath'`)}function a6(){return{clone(t,...e){return this._runTask(hC("clone",jv,ur(t,wt),...e),ct(arguments))},mirror(t,...e){return this._runTask(hC("mirror",ZA,ur(t,wt),...e),ct(arguments))}}}var jv,ZA,o6=Y({"src/lib/tasks/clone.ts"(){"use strict";kt(),ve(),jv=(t,e,r)=>{let i=["clone",...r];return wt(t)&&i.push(wl(t)),wt(e)&&i.push(wl(e)),kr(i)},ZA=(t,e,r)=>(Ai(r,"--mirror"),jv(t,e,r))}}),KA={};Pt(KA,{SimpleGitApi:()=>Vv});var Vv,l6=Y({"src/lib/simple-git-api.ts"(){"use strict";fH(),dH(),pH(),vH(),xH(),rA(),SH(),oA(),CH(),$H(),RA(),zH(),jA(),KH(),t6(),kt(),s6(),ve(),o6(),Vv=class{constructor(t){this._executor=t}_runTask(t,e){let r=this._executor.chain(),i=r.push(t);return e&&cH(t,i,e),Object.create(this,{then:{value:i.then.bind(i)},catch:{value:i.catch.bind(i)},_executor:{value:r}})}add(t){return this._runTask(kr(["add",...An(t)]),ct(arguments))}cwd(t){let e=ct(arguments);return typeof t=="string"?this._runTask(Zk(t,this._executor),e):typeof(t==null?void 0:t.path)=="string"?this._runTask(Zk(t.path,t.root&&this._executor||void 0),e):this._runTask(Gr("Git.cwd: workingDirectory must be supplied as a string"),e)}hashObject(t,e){return this._runTask(kH(t,e===!0),ct(arguments))}init(t){return this._runTask(RH(t===!0,this._executor.cwd,Sr(arguments)),ct(arguments))}merge(){return this._runTask(oC(Sr(arguments)),ct(arguments))}mergeFromTo(t,e){return wt(t)&&wt(e)?this._runTask(oC([t,e,...Sr(arguments)]),ct(arguments,!1)):this._runTask(Gr("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(t){return this._executor.outputHandler=t,this}push(){let t=hw({remote:ur(arguments[0],wt),branch:ur(arguments[1],wt)},Sr(arguments));return this._runTask(t,ct(arguments))}stash(){return this._runTask(kr(["stash",...Sr(arguments)]),ct(arguments))}status(){return this._runTask(e6(Sr(arguments)),ct(arguments))}},Object.assign(Vv.prototype,hH(),a6(),yH(),K8(),gH(),EH(),eH(),BH(),ZH(),i6())}}),XA={};Pt(XA,{Scheduler:()=>JA});var pC,JA,c6=Y({"src/lib/runners/scheduler.ts"(){"use strict";ve(),dA(),pC=(()=>{let t=0;return()=>{t++;let{promise:e,done:r}=(0,QA.createDeferred)();return{promise:e,done:r,id:t}}})(),JA=class{constructor(t=2){this.concurrency=t,this.logger=nw("","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=Ai(this.running,this.pending.shift());this.logger("Attempting id=%s",t.id),t.done(()=>{this.logger("Completing id=",t.id),ch(this.running,t),this.schedule()})}next(){let{promise:t,id:e}=Ai(this.pending,pC());return this.logger("Scheduling id=%s",e),this.schedule(),t}}}}),eT={};Pt(eT,{applyPatchTask:()=>u6});function u6(t,e){return kr(["apply",...e,...t])}var f6=Y({"src/lib/tasks/apply-patch.ts"(){"use strict";kt()}});function d6(t,e){return{branch:t,hash:e,success:!0}}function h6(t){return{branch:t,hash:null,success:!1}}var tT,p6=Y({"src/lib/responses/BranchDeleteSummary.ts"(){"use strict";tT=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function rT(t,e){return e===1&&zv.test(t)}var mC,zv,gC,gh,m6=Y({"src/lib/parsers/parse-branch-delete.ts"(){"use strict";p6(),ve(),mC=/(\S+)\s+\(\S+\s([^)]+)\)/,zv=/^error[^']+'([^']+)'/m,gC=[new be(mC,(t,[e,r])=>{let i=d6(e,r);t.all.push(i),t.branches[e]=i}),new be(zv,(t,[e])=>{let r=h6(e);t.errors.push(r),t.all.push(r),t.branches[e]=r})],gh=(t,e)=>Vr(new tT,gC,[t,e])}}),iT,g6=Y({"src/lib/responses/BranchSummary.ts"(){"use strict";iT=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(t,e,r,i,n){t==="*"&&(this.detached=e,this.current=r),this.all.push(r),this.branches[r]={current:t==="*",linkedWorkTree:t==="+",name:r,commit:i,label:n}}}}});function vC(t){return t?t.charAt(0):""}function nT(t,e=!1){return Vr(new iT,e?[aT]:sT,t)}var sT,aT,v6=Y({"src/lib/parsers/parse-branch.ts"(){"use strict";g6(),ve(),sT=[new be(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(t,[e,r,i,n])=>{t.push(vC(e),!0,r,i,n)}),new be(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(t,[e,r,i,n])=>{t.push(vC(e),!1,r,i,n)})],aT=new be(/^(\S+)$/s,(t,[e])=>{t.push("*",!1,e,"","")})}}),oT={};Pt(oT,{branchLocalTask:()=>b6,branchTask:()=>w6,containsDeleteBranchCommand:()=>lT,deleteBranchTask:()=>y6,deleteBranchesTask:()=>_6});function lT(t){let e=["-d","-D","--delete"];return t.some(r=>e.includes(r))}function w6(t){let e=lT(t),r=t.includes("--show-current"),i=["branch",...t];return i.length===1&&i.push("-a"),i.includes("-v")||i.splice(1,0,"-v"),{format:"utf-8",commands:i,parser(n,s){return e?gh(n,s).all[0]:nT(n,r)}}}function b6(){return{format:"utf-8",commands:["branch","-v"],parser(t){return nT(t)}}}function _6(t,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...t],parser(r,i){return gh(r,i)},onError({exitCode:r,stdOut:i},n,s,a){if(!rT(String(n),r))return a(n);s(i)}}}function y6(t,e=!1){let r={format:"utf-8",commands:["branch","-v",e?"-D":"-d",t],parser(i,n){return gh(i,n).branches[t]},onError({exitCode:i,stdErr:n,stdOut:s},a,o,l){if(!rT(String(a),i))return l(a);throw new Pu(r.parser(Tu(s),Tu(n)),String(a))}};return r}var x6=Y({"src/lib/tasks/branch.ts"(){"use strict";Sl(),m6(),v6(),ve()}});function E6(t){let e=t.trim().replace(/^["']|["']$/g,"");return e&&(0,cT.normalize)(e)}var uT,S6=Y({"src/lib/responses/CheckIgnore.ts"(){"use strict";uT=t=>t.split(/\n/g).map(E6).filter(Boolean)}}),fT={};Pt(fT,{checkIgnoreTask:()=>k6});function k6(t){return{commands:["check-ignore",...t],format:"utf-8",parser:uT}}var C6=Y({"src/lib/tasks/check-ignore.ts"(){"use strict";S6()}});function A6(t,e){return Vr({raw:t,remote:null,branches:[],tags:[],updated:[],deleted:[]},dT,[t,e])}var dT,T6=Y({"src/lib/parsers/parse-fetch.ts"(){"use strict";ve(),dT=[new be(/From (.+)$/,(t,[e])=>{t.remote=e}),new be(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.branches.push({name:e,tracking:r})}),new be(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(t,[e,r])=>{t.tags.push({name:e,tracking:r})}),new be(/- \[deleted]\s+\S+\s*-> (.+)$/,(t,[e])=>{t.deleted.push({tracking:e})}),new be(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(t,[e,r,i,n])=>{t.updated.push({name:i,tracking:n,to:r,from:e})})]}}),hT={};Pt(hT,{fetchTask:()=>R6});function P6(t){return/^--upload-pack(=|$)/.test(t)}function R6(t,e,r){let i=["fetch",...r];return t&&e&&i.push(t,e),i.find(P6)?Gr("git.fetch: potential exploit argument blocked."):{commands:i,format:"utf-8",parser:A6}}var $6=Y({"src/lib/tasks/fetch.ts"(){"use strict";T6(),kt()}});function F6(t){return Vr({moves:[]},pT,t)}var pT,I6=Y({"src/lib/parsers/parse-move.ts"(){"use strict";ve(),pT=[new be(/^Renaming (.+) to (.+)$/,(t,[e,r])=>{t.moves.push({from:e,to:r})})]}}),mT={};Pt(mT,{moveTask:()=>M6});function M6(t,e){return{commands:["mv","-v",...An(t),e],format:"utf-8",parser:F6}}var D6=Y({"src/lib/tasks/move.ts"(){"use strict";I6(),ve()}}),gT={};Pt(gT,{pullTask:()=>O6});function O6(t,e,r){let i=["pull",...r];return t&&e&&i.splice(1,0,t,e),{commands:i,format:"utf-8",parser(n,s){return dw(n,s)},onError(n,s,a,o){let l=jH(Tu(n.stdOut),Tu(n.stdErr));if(l)return o(new Pu(l));o(s)}}}var L6=Y({"src/lib/tasks/pull.ts"(){"use strict";Sl(),BA(),ve()}});function N6(t){let e={};return vT(t,([r])=>e[r]={name:r}),Object.values(e)}function B6(t){let e={};return vT(t,([r,i,n])=>{Object.hasOwn(e,r)||(e[r]={name:r,refs:{fetch:"",push:""}}),n&&i&&(e[r].refs[n.replace(/[^a-z]/g,"")]=i)}),Object.values(e)}function vT(t,e){Yv(t,r=>e(r.split(/\s+/)))}var H6=Y({"src/lib/responses/GetRemoteSummary.ts"(){"use strict";ve()}}),wT={};Pt(wT,{addRemoteTask:()=>U6,getRemotesTask:()=>G6,listRemotesTask:()=>j6,remoteTask:()=>V6,removeRemoteTask:()=>z6});function U6(t,e,r){return kr(["remote","add",...r,t,e])}function G6(t){let e=["remote"];return t&&e.push("-v"),{commands:e,format:"utf-8",parser:t?B6:N6}}function j6(t){let e=[...t];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),kr(e)}function V6(t){let e=[...t];return e[0]!=="remote"&&e.unshift("remote"),kr(e)}function z6(t){return kr(["remote","remove",t])}var W6=Y({"src/lib/tasks/remote.ts"(){"use strict";H6(),kt()}}),bT={};Pt(bT,{stashListTask:()=>q6});function q6(t={},e){let r=PA(t),i=["stash","list",...r.commands,...e],n=kA(r.splitter,r.fields,aw(i));return mh(i)||{commands:i,format:"utf-8",parser:n}}var Y6=Y({"src/lib/tasks/stash-list.ts"(){"use strict";Iu(),AA(),fw(),RA()}}),_T={};Pt(_T,{addSubModuleTask:()=>Z6,initSubModuleTask:()=>K6,subModuleTask:()=>vh,updateSubModuleTask:()=>X6});function Z6(t,e){return vh(["add",t,e])}function K6(t){return vh(["init",...t])}function vh(t){let e=[...t];return e[0]!=="submodule"&&e.unshift("submodule"),kr(e)}function X6(t){return vh(["update",...t])}var Q6=Y({"src/lib/tasks/sub-module.ts"(){"use strict";kt()}});function J6(t,e){let r=Number.isNaN(t),i=Number.isNaN(e);return r!==i?r?1:-1:r?yT(t,e):0}function yT(t,e){return t===e?0:t>e?1:-1}function e5(t){return t.trim()}function eh(t){return typeof t=="string"&&parseInt(t.replace(/^\D+/g,""),10)||0}var wC,xT,t5=Y({"src/lib/responses/TagList.ts"(){"use strict";wC=class{constructor(t,e){this.all=t,this.latest=e}},xT=function(t,e=!1){let r=t.split(` `).map(e5).filter(Boolean);e||r.sort(function(n,s){let a=n.split("."),o=s.split(".");if(a.length===1||o.length===1)return J6(eh(a[0]),eh(o[0]));for(let l=0,c=Math.max(a.length,o.length);ln.indexOf(".")>=0);return new wC(r,i)}}}),ET={};Pt(ET,{addAnnotatedTagTask:()=>n5,addTagTask:()=>i5,tagListTask:()=>r5});function r5(t=[]){let e=t.some(r=>/^--sort=/.test(r));return{format:"utf-8",commands:["tag","-l",...t],parser(r){return xT(r,e)}}}function i5(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function n5(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var s5=Y({"src/lib/tasks/tag.ts"(){"use strict";t5()}}),a5=E8({"src/git.js"(t,e){"use strict";var{GitExecutor:r}=(lH(),St(mA)),{SimpleGitApi:i}=(l6(),St(KA)),{Scheduler:n}=(c6(),St(XA)),{adhocExecTask:s,configurationErrorTask:a}=(kt(),St(Nv)),{asArray:o,filterArray:l,filterPrimitives:c,filterString:u,filterStringOrStringArray:f,filterType:d,getTrailingOptions:h,trailingFunctionArgument:p,trailingOptionsArgument:g}=(ve(),St(NC)),{applyPatchTask:v}=(f6(),St(eT)),{branchTask:b,branchLocalTask:_,deleteBranchesTask:C,deleteBranchTask:x}=(x6(),St(oT)),{checkIgnoreTask:E}=(C6(),St(fT)),{checkIsRepoTask:A}=(GC(),St(BC)),{cleanWithOptionsTask:w,isCleanOptionsArray:S}=(JC(),St(XC)),{diffSummaryTask:y}=(fw(),St(TA)),{fetchTask:P}=($6(),St(hT)),{moveTask:T}=(D6(),St(mT)),{pullTask:I}=(L6(),St(gT)),{pushTagsTask:M}=(jA(),St(GA)),{addRemoteTask:B,getRemotesTask:re,listRemotesTask:Ae,remoteTask:K,removeRemoteTask:Q}=(W6(),St(wT)),{getResetMode:fe,resetTask:ce}=(fA(),St(lA)),{stashListTask:z}=(Y6(),St(bT)),{addSubModuleTask:X,initSubModuleTask:j,subModuleTask:Ze,updateSubModuleTask:$r}=(Q6(),St(_T)),{addAnnotatedTagTask:cr,addTagTask:Ie,tagListTask:yt}=(s5(),St(ET)),{straightThroughBufferTask:Tt,straightThroughStringTask:Ke}=(kt(),St(Nv));function J(L,W){this._plugins=W,this._executor=new r(L.baseDir,new n(L.maxConcurrentProcesses),W),this._trimmed=L.trimmed}(J.prototype=Object.create(i.prototype)).constructor=J,J.prototype.customBinary=function(L){return this._plugins.reconfigure("binary",L),this},J.prototype.env=function(L,W){return arguments.length===1&&typeof L=="object"?this._executor.env=L:(this._executor.env=this._executor.env||{})[L]=W,this},J.prototype.stashList=function(L){return this._runTask(z(g(arguments)||{},l(L)&&L||[]),p(arguments))},J.prototype.mv=function(L,W){return this._runTask(T(L,W),p(arguments))},J.prototype.checkoutLatestTag=function(L){var W=this;return this.pull(function(){W.tags(function(xe,Xe){W.checkout(Xe.latest,L)})})},J.prototype.pull=function(L,W,xe,Xe){return this._runTask(I(d(L,u),d(W,u),h(arguments)),p(arguments))},J.prototype.fetch=function(L,W){return this._runTask(P(d(L,u),d(W,u),h(arguments)),p(arguments))},J.prototype.silent=function(L){return this._runTask(s(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},J.prototype.tags=function(L,W){return this._runTask(yt(h(arguments)),p(arguments))},J.prototype.rebase=function(){return this._runTask(Ke(["rebase",...h(arguments)]),p(arguments))},J.prototype.reset=function(L){return this._runTask(ce(fe(L),h(arguments)),p(arguments))},J.prototype.revert=function(L){let W=p(arguments);return typeof L!="string"?this._runTask(a("Commit must be a string"),W):this._runTask(Ke(["revert",...h(arguments,0,!0),L]),W)},J.prototype.addTag=function(L){let W=typeof L=="string"?Ie(L):a("Git.addTag requires a tag name");return this._runTask(W,p(arguments))},J.prototype.addAnnotatedTag=function(L,W){return this._runTask(cr(L,W),p(arguments))},J.prototype.deleteLocalBranch=function(L,W,xe){return this._runTask(x(L,typeof W=="boolean"?W:!1),p(arguments))},J.prototype.deleteLocalBranches=function(L,W,xe){return this._runTask(C(L,typeof W=="boolean"?W:!1),p(arguments))},J.prototype.branch=function(L,W){return this._runTask(b(h(arguments)),p(arguments))},J.prototype.branchLocal=function(L){return this._runTask(_(),p(arguments))},J.prototype.raw=function(L){let W=!Array.isArray(L),xe=[].slice.call(W?arguments:L,0);for(let Dt=0;Dtconsole.warn("simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.")))},J.prototype.checkIgnore=function(L,W){return this._runTask(E(o(d(L,f,[]))),p(arguments))},J.prototype.checkIsRepo=function(L,W){return this._runTask(A(d(L,u)),p(arguments))},e.exports=J}});Ws();var o5=class extends jr{constructor(t,e){super(void 0,e),this.config=t}};Ws();Ws();var El=class extends jr{constructor(t,e,r){super(t,r),this.task=t,this.plugin=e,Object.setPrototypeOf(this,new.target.prototype)}};Sl();SC();GC();JC();rA();nA();oA();fA();function l5(t){return t?[{type:"spawn.before",action(i,n){t.aborted&&n.kill(new El(void 0,"abort","Abort already signaled"))}},{type:"spawn.after",action(i,n){function s(){n.kill(new El(void 0,"abort","Abort signal received"))}t.addEventListener("abort",s),n.spawned.on("close",()=>t.removeEventListener("abort",s))}}]:void 0}function c5(t={}){return{type:"spawn.args",action(e,{env:r}){for(let i of zk(e,r))if(t[i.category]!==!0)throw new El(void 0,"unsafe",i.message);return e}}}ve();function u5(t){let e=Au(t,"-c");return{type:"spawn.args",action(r){return[...e,...r]}}}ve();var bC=(0,yl.deferred)().promise;function f5({onClose:t=!0,onExit:e=50}={}){function r(){let n=-1,s={close:(0,yl.deferred)(),closeTimeout:(0,yl.deferred)(),exit:(0,yl.deferred)(),exitTimeout:(0,yl.deferred)()},a=Promise.race([t===!1?bC:s.closeTimeout.promise,e===!1?bC:s.exitTimeout.promise]);return i(t,s.close,s.closeTimeout),i(e,s.exit,s.exitTimeout),{close(o){n=o,s.close.done()},exit(o){n=o,s.exit.done()},get exitCode(){return n},result:a}}function i(n,s,a){n!==!1&&(n===!0?s.promise:s.promise.then(()=>Fv(n))).then(a.done)}return{type:"spawn.after",async action(n,{spawned:s,close:a}){var u,f;let o=r(),l=!0,c=()=>{l=!1};(u=s.stdout)==null||u.on("data",c),(f=s.stderr)==null||f.on("data",c),s.on("error",c),s.on("close",d=>o.close(d)),s.on("exit",d=>o.exit(d));try{await o.result,l&&await Fv(50),a(o.exitCode)}catch(d){a(o.exitCode,d)}}}}ve();var d5="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",_C="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function h5(t){return!t||!/^([a-z]:)?([a-z0-9/.\\_~-]+)$/i.test(t)}function yC(t,e){if(t.length<1||t.length>2)throw new El(void 0,"binary",d5);if(t.some(h5))if(e)console.warn(_C);else throw new El(void 0,"binary",_C);let[i,n]=t;return{binary:i,prefix:n}}function p5(t,e=["git"],r=!1){let i=yC(An(e),r);t.on("binary",n=>{i=yC(An(n),r)}),t.append("spawn.binary",()=>i.binary),t.append("spawn.args",n=>i.prefix?[i.prefix,...n]:n)}Ws();function m5(t){return!!(t.exitCode&&t.stdErr.length)}function g5(t){return k.concat([...t.stdOut,...t.stdErr])}function v5(t=!1,e=m5,r=g5){return(i,n)=>!t&&i||!e(n)?i:r(n)}function xC(t){return{type:"task.error",action(e,r){let i=t(e.error,{stdErr:r.stdErr,stdOut:r.stdOut,exitCode:r.exitCode});return k.isBuffer(i)?{error:new jr(void 0,i.toString("utf-8"))}:{error:i}}}}ve();var w5=class{constructor(){this.plugins=new Set,this.events=new ST.EventEmitter}on(t,e){this.events.on(t,e)}reconfigure(t,e){this.events.emit(t,e)}append(t,e){let r=Ai(this.plugins,{type:t,action:e});return()=>this.plugins.delete(r)}add(t){let e=[];return An(t).forEach(r=>r&&this.plugins.add(Ai(e,r))),()=>{e.forEach(r=>this.plugins.delete(r))}}exec(t,e,r){let i=e,n=Object.freeze(Object.create(r));for(let s of this.plugins)s.type===t&&(i=s.action(i,n));return i}};ve();function b5(t){let e="--progress",r=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(s,a){return r.includes(a.method)?RC(s,e):s}},{type:"spawn.after",action(s,a){var o;a.commands.includes(e)&&((o=a.spawned.stderr)==null||o.on("data",l=>{let c=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(l.toString("utf8"));c&&t({method:a.method,stage:_5(c[1]),progress:rt(c[2]),processed:rt(c[3]),total:rt(c[4])})}))}}]}function _5(t){return String(t.toLowerCase().split(" ",1))||"unknown"}ve();function y5(t){let e=FC(t,["uid","gid"]);return{type:"spawn.options",action(r){return{...e,...r}}}}function x5({block:t,stdErr:e=!0,stdOut:r=!0}){if(t>0)return{type:"spawn.after",action(i,n){var c,u;let s;function a(){s&&clearTimeout(s),s=setTimeout(l,t)}function o(){var f,d;(f=n.spawned.stdout)==null||f.off("data",a),(d=n.spawned.stderr)==null||d.off("data",a),n.spawned.off("exit",o),n.spawned.off("close",o),s&&clearTimeout(s)}function l(){o(),n.kill(new El(void 0,"timeout","block timeout reached"))}r&&((c=n.spawned.stdout)==null||c.on("data",a)),e&&((u=n.spawned.stderr)==null||u.on("data",a)),n.spawned.on("exit",o),n.spawned.on("close",o),a()}}}function E5(){return{type:"spawn.args",action(t){let e=[],r;function i(n){(r=r||[]).push(...n)}for(let n=0;nSi(a)&&bl(a)||a));break}e.push(s)}return r?[...e,"--",...r.map(String)]:e}}}ve();var S5=a5();function k5(t,e){var n;let r=new w5,i=OC(t&&(typeof t=="string"?{baseDir:t}:t)||{},e);if(!Zv(i.baseDir))throw new o5(i,"Cannot use simple-git on a directory that does not exist");return Array.isArray(i.config)&&r.add(u5(i.config)),r.add(c5(i.unsafe)),r.add(f5(i.completion)),i.abort&&r.add(l5(i.abort)),i.progress&&r.add(b5(i.progress)),i.timeout&&r.add(x5(i.timeout)),i.spawnOptions&&r.add(y5(i.spawnOptions)),r.add(E5()),r.add(xC(v5(!0))),i.errors&&r.add(xC(i.errors)),p5(r,i.binary,(n=i.unsafe)==null?void 0:n.allowUnsafeCustomBinary),new S5(i,r)}Sl();var kT=k5;var ke=class extends hl{constructor(r){super(r);this.useDefaultWindowsGitPath=!1}async setGitInstance(r=!1){var i;if(await this.isGitInstalled()){let n=this.app.vault.adapter,s=n.getBasePath(),a=s;this.plugin.settings.basePath&&(await n.exists((0,rs.normalizePath)(this.plugin.settings.basePath))?a=Be.join(s,this.plugin.settings.basePath):r||new rs.Notice("ObsidianGit: Base path does not exist")),this.absoluteRepoPath=a,this.git=kT({baseDir:a,binary:this.plugin.localStorage.getGitPath()||(this.useDefaultWindowsGitPath?Ud:void 0),config:["core.quotepath=off"],progress:b=>{var _;(_=this.plugin.statusBar)==null||_.displayProgress(this.toGitProgress(b))},unsafe:{allowUnsafeCustomBinary:!0,allowUnsafeEditor:!0,allowUnsafeAskPass:!0,allowUnsafeConfigEnvCount:!0,allowUnsafeConfigPaths:!0,allowUnsafeCredentialHelper:!0,allowUnsafeGitProxy:!0,allowUnsafeGpgProgram:!0,allowUnsafeHooksPath:!0,allowUnsafeMergeDriver:!0,allowUnsafeSshCommand:!0,allowUnsafePager:!0}});let o=this.plugin.localStorage.getPATHPaths(),l=this.plugin.localStorage.getEnvVars(),c=this.plugin.settings.gitDir,u={...process.env};if(o.length>0){let b=o.join(Be.delimiter)+Be.delimiter+u.PATH;u.PATH=b}c&&(u.GIT_DIR=c,u.GIT_WORK_TREE=a);for(let b of l){let[_,C]=b.split("=");_!==void 0&&(u[_]=C)}let f="simple-git",d=",",p=((i=localStorage.debug)!=null?i:"").split(d);if(!p.includes(f)&&!p.includes(`-${f}`)&&(p.push(f),PT.default.enable(p.join(d))),await this.git.env(u).checkIsRepo()){let b=await this.git.revparse("--show-cdup"),_=(0,Mu.resolve)(a+Mu.sep+b);this.absoluteRepoPath=_,await this.git.cwd(_)}let g=Be.join(s,this.app.vault.configDir,"plugins","obsidian-git"),v=Be.join(g,$a);u.SSH_ASKPASS==null&&(u.SSH_ASKPASS=v),u.SSH_ASKPASS_REQUIRE="force",u.OBSIDIAN_GIT_CREDENTIALS_INPUT=Be.join(g,Gd),u.SSH_ASKPASS==v&&this.askpass().catch(b=>this.plugin.displayError(b)),u.OBSIDIAN_GIT="1",this.git=this.git.env(u)}}toGitProgress(r){return{action:this.getProgressAction(r.method),stage:r.stage,progress:r.progress,processed:r.processed,total:r.total}}getProgressAction(r){switch(r){case"fetch":return"Fetching";case"push":return"Pushing";case"pull":return"Pulling";case"checkout":return"Checking out";default:return r?r.charAt(0).toUpperCase()+r.slice(1):"Working"}}getRelativeVaultPath(r){let n=this.app.vault.adapter.getBasePath(),s=Be.join(this.absoluteRepoPath,r),a=Be.relative(n,s);return rs.Platform.isWin&&(a=a.replace(/\\/g,"/")),a}getRelativeRepoPath(r,i=!0){if(i){let s=this.plugin.app.vault.adapter.getBasePath(),a=this.absoluteRepoPath,o=Be.join(s,r),l=Be.relative(a,o);return rs.Platform.isWin&&(l=l.replace(/\\/g,"/")),l}return r}get absPluginConfigPath(){let i=this.app.vault.adapter.getBasePath();return Be.join(i,this.app.vault.configDir,"plugins","obsidian-git")}get relPluginConfigPath(){return Be.join(this.app.vault.configDir,"plugins","obsidian-git")}async askpass(){let r=this.app.vault.adapter,i=this.app.vault.configDir+"/plugins/obsidian-git/";await this.addAskPassScriptToExclude(),await oi.writeFile(Be.join(this.absPluginConfigPath,$a),YS),await oi.chmod(Be.join(this.absPluginConfigPath,$a),493),this.watchAbortController=new AbortController;let{signal:n}=this.watchAbortController;try{let s=oi.watch(this.absPluginConfigPath,{signal:n});for await(let a of s){if(a.filename!=Gd)continue;let o=i+Gd;if(await new Promise(d=>window.setTimeout(d,200)),!await r.exists(o))continue;let l=await r.read(o),c;l.length>60&&(c=new rs.Notice(l,999999));let u=!0;l.contains("Username for")&&(u=!1);let f=await new at(this.plugin,{allowEmpty:!0,obscure:u,placeholder:l.length>60?"Enter a response to the message.":l}).openAndGetResult();c==null||c.hide(),await r.exists(o)&&await r.write(`${o}.response`,f!=null?f:"")}}catch(s){this.plugin.displayError(s),await oi.rm(Be.join(this.absPluginConfigPath,$a),{force:!0}),await oi.rm(Be.join(this.absPluginConfigPath,`${$a}.response`),{force:!0}),await new Promise(a=>window.setTimeout(a,5e3)),this.plugin.log("Retry watch for ask pass"),await this.askpass()}}async addAskPassScriptToExclude(){try{if(!await this.git.checkIsRepo())return;let r=await this.git.revparse(["--path-format=absolute","--git-path","info/exclude"]),i=Be.join(this.app.vault.configDir,"plugins","obsidian-git",$a),n=this.getRelativeRepoPath(i,!0);(await oi.readFile(r,"utf-8")).split(` `).some(l=>l.contains(n))||await oi.appendFile(r,n+` `)}catch(r){console.error("Error while adding askpass script to exclude file:",r)}}unload(){var r;(r=this.watchAbortController)==null||r.abort()}async status(r){let i=r==null?void 0:r.path,n=await this.git.status(i!=null?["--",i]:[]),s=n.files.map(a=>{let o=this.formatPath(a);return{path:o.path,from:o.from,index:a.index==="?"?"U":a.index,workingDir:a.working_dir==="?"?"U":a.working_dir,vaultPath:this.getRelativeVaultPath(o.path)}});return{all:s,changed:s.filter(a=>a.workingDir!==" "),staged:s.filter(a=>a.index!==" "&&a.index!="U"),conflicted:n.conflicted.map(a=>this.formatPath({path:a}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(r){let i=this.getRelativeRepoPath(r),s=["-C",Be.dirname(i),"rev-parse","HEAD"],a=this.git.raw(s);return a.catch(o=>console.warn("obsidian-git: rev-parse error:",o)),(await a).trim()}async getSubmodulePaths(){return new Promise(r=>{this.git.outputHandler((i,n,s,a)=>{if(!(a.contains("submodule")&&a.contains("foreach")))return;let o="",l=this.absoluteRepoPath;n.on("data",c=>{o+=c.toString("utf8")}),n.on("end",()=>{let u=o.split(` `).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+Mu.sep}).filter(f=>!!f);u.reverse(),r(u)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},i=>this.plugin.displayError(i))})}formatPath(r){function i(n){if(n!=null)return n.startsWith('"')&&n.endsWith('"')?n.substring(1,n.length-1):n}return r.from!=null?{from:i(r.from),path:i(r.path)}:{path:i(r.path)}}async blame(r,i,n){if(r=this.getRelativeRepoPath(r),!await this.isTracked(r))return"untracked";let s=await this.getSubmoduleOfFile(r),a=s?["-C",s.submodule]:[],o=s?s.relativeFilepath:r;a.push("blame","--porcelain"),n&&a.push("-w");let l=`-C${Hd}`;switch(i){case"inactive":break;case"same-commit":a.push("-C",l);break;case"all-commits":a.push("-C","-C",l);break;default:js(i)}a.push("--",o);let c=await this.git.raw(a);return C5(c)}async isTracked(r){let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("ls-files","--",s),this.git.raw(n).then(a=>a.trim()!=="")}async commitAll({message:r}){return this.withGitOperation(2,async()=>{if(this.plugin.settings.updateSubmodules){let n=await this.getSubmodulePaths();for(let s of n)await this.git.cwd({path:s,root:!1}).add("-A"),await this.git.cwd({path:s,root:!1}).commit(await this.formatCommitMessage(r))}await this.git.add("-A");let i=await this.git.commit(await this.formatCommitMessage(r));return this.app.workspace.trigger("obsidian-git:head-change"),i.summary.changes})}async commit({message:r,amend:i}){return this.withGitOperation(2,async()=>{let n=(await this.git.commit(await this.formatCommitMessage(r),i?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),n})}async stage(r,i){r=this.getRelativeRepoPath(r,i),await this.git.add(["--",r])}async stageAll({dir:r}){await this.git.add(r!=null?r:"-A")}async unstageAll({dir:r}){await this.git.reset(r!=null?["--",r]:[])}async unstage(r,i){r=this.getRelativeRepoPath(r,i),await this.git.reset(["--",r])}async discard(r){await this.isTracked(r)&&await this.git.checkout(["--progress","--",r])}async applyPatch(r){let i=Be.join(this.relPluginConfigPath,"patch");await this.app.vault.adapter.write(i,r),await this.git.applyPatch(i,{"--cached":null,"--unidiff-zero":null,"--whitespace":"nowarn"}),await this.app.vault.adapter.remove(i)}async getUntrackedPaths(r){let i=r==null?void 0:r.path,n=[];return i!=null&&n.push("--",i),(await this.git.clean(Da.RECURSIVE+Da.DRY_RUN,n)).paths}async hashObject(r){r=this.getRelativeRepoPath(r);let i=await this.getSubmoduleOfFile(r),n=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:r;return n.push("hash-object","--",s),this.git.raw(n)}async discardAll({dir:r}){return this.discard(r!=null?r:".")}async pull(){return this.withGitOperation(1,async()=>{try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let r=await this.branchInfo();if(!r.current){this.plugin.displayError("No current branch found. Cannot pull.");return}let i=await this.git.revparse([r.current]);if(!r.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 n=await this.git.revparse([r.tracking]);if(i!==n){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{let o=[r.tracking];switch(this.plugin.settings.mergeStrategy!=="none"&&o.push(`--strategy-option=${this.plugin.settings.mergeStrategy}`),this.plugin.settings.syncMethod){case"merge":await this.git.merge(o);break;case"rebase":await this.git.rebase(o)}}catch(o){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${TT(o)}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${r.current}`,n]),await this.git.reset([])}catch(o){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${TT(o)}`)}this.app.workspace.trigger("obsidian-git:head-change");let s=await this.git.revparse([r.current]);return(await this.git.diff([`${i}..${s}`,"--name-only"])).split(/\r\n|\r|\n/).filter(o=>o.length>0).map(o=>({path:o,workingDir:"P",vaultPath:this.getRelativeVaultPath(o)}))}else return[]}catch(r){this.convertErrors(r)}})}async push(){return this.withGitOperation(3,async()=>{try{if(this.plugin.settings.updateSubmodules){let a=await this.git.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 i=(await this.git.status()).current;if(!i){this.plugin.displayError("No current branch found. Cannot push.");return}let n=await this.getPushTarget(i);if(!n&&this.plugin.settings.updateSubmodules){this.plugin.log("No push target found. Ignoring push of main repo and updating submodules only.");return}let s=null;return n!=null&&n.exists&&(s=(await this.git.diffSummary([i,n.ref,"--"])).changed),await this.git.push(),s}catch(r){this.convertErrors(r)}})}async getPushTarget(r){let i=(await this.git.raw(["for-each-ref","--format=%(push)",`refs/heads/${r}`])).trim();if(!i)return;let n=(await this.git.raw(["for-each-ref","--format=%(refname)",i])).trim();return{ref:i,exists:n===i}}async squashAllUnpushedCommits(){let r=await this.git.status();if(!r.current)return;let i=await this.getPushTarget(r.current);if(!(i!=null&&i.exists)||(await this.git.raw(["diff","--cached","--name-only"])).trim().length>0)return;let s=`${i.ref}..HEAD`;if(parseInt((await this.git.raw(["rev-list","--count",s])).trim(),10)<2||parseInt((await this.git.raw(["rev-list","--merges","--count",s])).trim(),10)>0)return;let l=(await this.git.raw(["rev-parse","HEAD"])).trim();await this.withGitOperation(2,async()=>{await this.git.reset(["--soft",i.ref]),await this.git.raw(["commit","-C",l]),this.app.workspace.trigger("obsidian-git:head-change")})}async getUnpushedCommits(){let i=(await this.git.status()).current;if(i==null)return 0;let n=await this.getPushTarget(i);return n?n.exists?(await this.git.diffSummary([i,n.ref,"--"])).changed:(this.plugin.log(`Push target ${n.ref} does not exist on the remote yet.`),0):0}async canPush(){if(this.plugin.settings.updateSubmodules===!0)return!0;let i=(await this.git.status()).current;if(!i)return this.plugin.log("During canPush check, no current branch found."),!1;let n=await this.getPushTarget(i);if(!n)return!1;if(!n.exists)return!0;let[s,a]=await Promise.all([this.git.revparse([i]),this.git.revparse([n.ref])]);return s!==a}async checkRequirements(){return await this.isGitInstalled()?await this.git.checkIsRepo()?"valid":"missing-repo":"missing-git"}async branchInfo(){let r=await this.git.status(),i=await this.git.branch(["--no-color"]);return{current:r.current||void 0,tracking:r.tracking||void 0,branches:i.all}}async getRemoteUrl(r){try{return await this.git.remote(["get-url",r])||void 0}catch(i){if(String(i).contains(r))return;throw i}}async log(r,i=!0,n,s){let a;r&&(a=this.getRelativeRepoPath(r,i));let o={file:a,maxCount:n,"--diff-merges":"first-parent","--name-status":null};return s&&(o[s]=null),(await this.git.log(o)).all.map(c=>{var u,f,d,h;return{...c,author:{name:c.author_name,email:c.author_email},refs:c.refs.split(", ").filter(p=>p.length>0),diff:{...c.diff,files:(f=(u=c.diff)==null?void 0:u.files.map(p=>{let g="from"in p?p.from:void 0;return{...p,status:"status"in p?p.status:"M",path:p.file,hash:c.hash,vaultPath:this.getRelativeVaultPath(p.file),fromPath:g,fromVaultPath:g!=null?this.getRelativeVaultPath(g):void 0,binary:p.binary}}))!=null?f:[]},fileName:(h=(d=c.diff)==null?void 0:d.files.first())==null?void 0:h.file}})}async show(r,i,n=!0){let s=this.getRelativeRepoPath(i,n);return this.git.show([r+":"+s])}async getLocalBranchUpstream(r){try{let n=(await this.git.raw(["rev-parse","--abbrev-ref",`${r}@{upstream}`])).trim();return n.length>0?n:void 0}catch(i){return}}getAvailableLocalBranchName(r,i,n){let s=r;if(!n.includes(s))return s;let a=`${r}-${i}`,o=a,l=0;for(;n.includes(o);)l+=1,o=`${a}-${l}`;return o}async checkout(r,i){return this.withGitOperation(5,async()=>{if(i){let n=`${i}/${r}`,s=await this.branchInfo();if(s.branches.includes(r)&&await this.getLocalBranchUpstream(r)===n)await this.git.checkout(r);else{let l=this.getAvailableLocalBranchName(r,i,s.branches);await this.git.checkout(["-b",l,n])}}else await this.git.checkout(r);if(this.plugin.settings.submoduleRecurseCheckout){let n=await this.getSubmodulePaths();for(let s of n){let a=await this.git.cwd({path:s,root:!1}).branch();Object.keys(a.branches).includes(r)&&await this.git.cwd({path:s,root:!1}).checkout(r)}}})}async createBranch(r){await this.git.checkout(["-b",r])}async deleteBranch(r,i){await this.git.branch([i?"-D":"-d",r])}async branchIsMerged(r){return!(await this.git.branch(["--no-merged"])).all.contains(r)}async init(){await this.git.init(!1)}async clone(r,i,n){await this.git.clone(r,Be.join(this.app.vault.adapter.getBasePath(),i),n?["--depth",`${n}`]:[]),await this.setGitInstance()}async setConfig(r,i){i==null?await this.git.raw(["config","--local","--unset",r]):await this.git.addConfig(r,i)}async getConfig(r,i="local"){var s;return(s=(await this.git.getConfig(r.toLowerCase(),i=="all"?void 0:i)).value)!=null?s:void 0}async fetch(r){return this.withGitOperation(4,async()=>{await this.git.fetch(r!=null?[r]:[])})}async setRemote(r,i){(await this.getRemotes()).includes(r)?await this.git.remote(["set-url",r,i]):await this.git.remote(["add",r,i])}async getRemoteBranches(r){let i=await this.git.branch(["-r","--list",`${r}*`]),n=[];for(let s in i.branches)n.push(i.branches[s].name);return n}async getRemotes(){let r=await this.git.remote([]);return r?r.trim().split(` `):[]}async removeRemote(r){await this.git.removeRemote(r)}async updateUpstreamBranch(r){try{await this.git.branch(["--set-upstream-to",r])}catch(i){try{await this.git.branch(["--set-upstream",r])}catch(n){let[s,a]=Vs(r),o=await this.branchInfo();await this.git.push(["--set-upstream",s,`${o.current}:${a}`])}}}updateGitPath(r){return this.setGitInstance()}updateBasePath(r){return this.setGitInstance(!0)}async getDiffString(r,i=!1,n){return i?await this.git.diff(["--cached","--",r]):n?await this.git.show([`${n}`,"--",r]):await this.git.diff(["--",r])}async diff(r,i,n){return await this.git.diff([`${i}..${n}`,"--",r])}async rawCommand(r){let i=r.split(" "),n=i[0];return n===void 0?"":await this.git.raw(n,...i.slice(1))}async getSubmoduleOfFile(r){if(!await this.app.vault.adapter.exists(Be.dirname(r)))return;let i=await this.git.raw(["-C",Be.dirname(r),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(i=i.trim(),(await this.git.raw(["-C",Be.dirname(r),"rev-parse","--show-superproject-working-tree"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message))).trim()==="")return;let a=this.app.vault.adapter.getFullPath(Be.normalize(r)),o=Be.relative(i,a);return{submodule:i,relativeFilepath:o}}async getLastCommitTime(){try{let r=await this.git.log({n:1});if(r!=null&&r.latest!=null)return new Date(r.latest.date)}catch(r){if(r instanceof jr){if(r.message.contains("does not have any commits yet"))return}else throw r}}async isGitInstalled(){let r=this.plugin.localStorage.getGitPath(),i=await Su(r||"git",["--version"],{});if(i.error)if(rs.Platform.isWin&&!r){this.plugin.log(`Git not found in PATH. Checking standard installation path(${Ud}) of Git for Windows.`);let n=await Su(Ud,["--version"]);if(n.error)return console.error(n.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(i.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(r){if(r instanceof jr){let i=String(r.message);if(i.contains("Could not resolve host")||i.contains("Unable to resolve host")||i.contains("Unable to open connection")||i.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||i.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||i.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new ll(i)}throw r}async isFileTrackedByLFS(r){try{return(await this.git.raw(["check-attr","filter",r])).includes("filter: lfs")}catch(i){let n=i instanceof Error?i.message:String(i);return this.plugin.displayError(`Error checking LFS status: ${n}`),!1}}},RT={hash:"000000",isZeroCommit:!0,summary:""};function C5(t){let r=t.replace(`\r `,` `).split(` `),i={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},n=1;for(let s=0;s=4&&r.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(s)!==e)throw Error(`git-blame output is out of order: ${e} vs ${s}`);return i}function T5(t,e,r){let i=t[0],n=t.slice(1).join(" "),s=e.hashPerLine[r];if(s===void 0)throw Error(`No commit hash found for git-blame line ${r}`);let a=e.commits.get(s)||{hash:s,author:{},committer:{},previous:{}};switch(i){case"summary":a.summary=n;break;case"author":a.author.name=n;break;case"author-mail":a.author.email=AT(n);break;case"author-time":a.author.epochSeconds=parseInt(n);break;case"author-tz":a.author.tz=n;break;case"committer":a.committer.name=n;break;case"committer-mail":a.committer.email=AT(n);break;case"committer-time":a.committer.epochSeconds=parseInt(n);break;case"committer-tz":a.committer.tz=n;break;case"previous":a.previous.commitHash=n;break;case"filename":a.previous.filename=n;break}e.commits.set(s,a)}function P5(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);mw(t.author)&&(t.author=void 0),mw(t.committer)&&(t.committer=void 0),mw(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function mw(t){return!t||Object.keys(t).length===0}function CT(t){return t===void 0?!1:t.length>0&&t[0].trim()===t[0]}function AT(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}function TT(t){return t instanceof Error?t.message:String(t)}m();var t2=require("@codemirror/state");m();var gw=class{constructor(){this.eventsPerFilepath=new Map;this.init()}ifFilepathDefinedTransformSubscribers(e,r){if(e)return this.ensureInitialized(e),r(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(r=>r.forEach(e))}ensureInitialized(e){this.eventsPerFilepath.get(e)||this.eventsPerFilepath.set(e,new Set)}init(){this.removeStalesSubscribersTimer===void 0&&this.startRemoveStalesSubscribersInterval()}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(e=>e==null?void 0:e.removeIfStale()),6e4)}clear(){this.removeStalesSubscribersTimer!==void 0&&(window.clearInterval(this.removeStalesSubscribersTimer),this.removeStalesSubscribersTimer=void 0),this.eventsPerFilepath.clear()}},Ti=new gw;m();var wh=require("@codemirror/state");m();function R5(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $T={exports:{}};(function(t){(function(){var e="input is invalid type",r=typeof window=="object",i=r?window:{};i.JS_SHA256_NO_WINDOW&&(r=!1);var n=!r&&typeof self=="object";n&&(i=self);var s=!i.JS_SHA256_NO_COMMON_JS&&!0&&t.exports,a=!i.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer!="undefined",o="0123456789abcdef".split(""),l=[-2147483648,8388608,32768,128],c=[24,16,8,0],u=[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],f=["hex","array","digest","arrayBuffer"],d=[];(i.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}),a&&(i.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(x){return typeof x=="object"&&x.buffer&&x.buffer.constructor===ArrayBuffer});var h=function(x,E){return function(A){return new b(E,!0).update(A)[x]()}},p=function(x){var E=h("hex",x);E.create=function(){return new b(x)},E.update=function(S){return E.create().update(S)};for(var A=0;A>>2]|=x[S]<>>2]|=w<>>2]|=(192|w>>>6)<>>2]|=(128|w&63)<=57344?(T[y>>>2]|=(224|w>>>12)<>>2]|=(128|w>>>6&63)<>>2]|=(128|w&63)<>>2]|=(240|w>>>18)<>>2]|=(128|w>>>12&63)<>>2]|=(128|w>>>6&63)<>>2]|=(128|w&63)<=64?(this.block=T[16],this.start=y-64,this.hash(),this.hashed=!0):this.start=y}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},b.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var x=this.blocks,E=this.lastByteIndex;x[16]=this.block,x[E>>>2]|=l[E&3],this.block=x[16],E>=56&&(this.hashed||this.hash(),x[0]=this.block,x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0),x[14]=this.hBytes<<3|this.bytes>>>29,x[15]=this.bytes<<3,this.hash()}},b.prototype.hash=function(){var x=this.h0,E=this.h1,A=this.h2,w=this.h3,S=this.h4,y=this.h5,P=this.h6,T=this.h7,I=this.blocks,M,B,re,Ae,K,Q,fe,ce,z,X,j;for(M=16;M<64;++M)K=I[M-15],B=(K>>>7|K<<25)^(K>>>18|K<<14)^K>>>3,K=I[M-2],re=(K>>>17|K<<15)^(K>>>19|K<<13)^K>>>10,I[M]=I[M-16]+B+I[M-7]+re<<0;for(j=E&A,M=0;M<64;M+=4)this.first?(this.is224?(ce=300032,K=I[0]-1413257819,T=K-150054599<<0,w=K+24177077<<0):(ce=704751109,K=I[0]-210244248,T=K-1521486534<<0,w=K+143694565<<0),this.first=!1):(B=(x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10),re=(S>>>6|S<<26)^(S>>>11|S<<21)^(S>>>25|S<<7),ce=x&E,Ae=ce^x&A^j,fe=S&y^~S&P,K=T+re+fe+u[M]+I[M],Q=B+Ae,T=w+K<<0,w=K+Q<<0),B=(w>>>2|w<<30)^(w>>>13|w<<19)^(w>>>22|w<<10),re=(T>>>6|T<<26)^(T>>>11|T<<21)^(T>>>25|T<<7),z=w&x,Ae=z^w&E^ce,fe=T&S^~T&y,K=P+re+fe+u[M+1]+I[M+1],Q=B+Ae,P=A+K<<0,A=K+Q<<0,B=(A>>>2|A<<30)^(A>>>13|A<<19)^(A>>>22|A<<10),re=(P>>>6|P<<26)^(P>>>11|P<<21)^(P>>>25|P<<7),X=A&w,Ae=X^A&x^z,fe=P&T^~P&S,K=y+re+fe+u[M+2]+I[M+2],Q=B+Ae,y=E+K<<0,E=K+Q<<0,B=(E>>>2|E<<30)^(E>>>13|E<<19)^(E>>>22|E<<10),re=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),j=E&A,Ae=j^E&w^X,fe=y&P^~y&T,K=S+re+fe+u[M+3]+I[M+3],Q=B+Ae,S=x+K<<0,x=K+Q<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+x<<0,this.h1=this.h1+E<<0,this.h2=this.h2+A<<0,this.h3=this.h3+w<<0,this.h4=this.h4+S<<0,this.h5=this.h5+y<<0,this.h6=this.h6+P<<0,this.h7=this.h7+T<<0},b.prototype.hex=function(){this.finalize();var x=this.h0,E=this.h1,A=this.h2,w=this.h3,S=this.h4,y=this.h5,P=this.h6,T=this.h7,I=o[x>>>28&15]+o[x>>>24&15]+o[x>>>20&15]+o[x>>>16&15]+o[x>>>12&15]+o[x>>>8&15]+o[x>>>4&15]+o[x&15]+o[E>>>28&15]+o[E>>>24&15]+o[E>>>20&15]+o[E>>>16&15]+o[E>>>12&15]+o[E>>>8&15]+o[E>>>4&15]+o[E&15]+o[A>>>28&15]+o[A>>>24&15]+o[A>>>20&15]+o[A>>>16&15]+o[A>>>12&15]+o[A>>>8&15]+o[A>>>4&15]+o[A&15]+o[w>>>28&15]+o[w>>>24&15]+o[w>>>20&15]+o[w>>>16&15]+o[w>>>12&15]+o[w>>>8&15]+o[w>>>4&15]+o[w&15]+o[S>>>28&15]+o[S>>>24&15]+o[S>>>20&15]+o[S>>>16&15]+o[S>>>12&15]+o[S>>>8&15]+o[S>>>4&15]+o[S&15]+o[y>>>28&15]+o[y>>>24&15]+o[y>>>20&15]+o[y>>>16&15]+o[y>>>12&15]+o[y>>>8&15]+o[y>>>4&15]+o[y&15]+o[P>>>28&15]+o[P>>>24&15]+o[P>>>20&15]+o[P>>>16&15]+o[P>>>12&15]+o[P>>>8&15]+o[P>>>4&15]+o[P&15];return this.is224||(I+=o[T>>>28&15]+o[T>>>24&15]+o[T>>>20&15]+o[T>>>16&15]+o[T>>>12&15]+o[T>>>8&15]+o[T>>>4&15]+o[T&15]),I},b.prototype.toString=b.prototype.hex,b.prototype.digest=function(){this.finalize();var x=this.h0,E=this.h1,A=this.h2,w=this.h3,S=this.h4,y=this.h5,P=this.h6,T=this.h7,I=[x>>>24&255,x>>>16&255,x>>>8&255,x&255,E>>>24&255,E>>>16&255,E>>>8&255,E&255,A>>>24&255,A>>>16&255,A>>>8&255,A&255,w>>>24&255,w>>>16&255,w>>>8&255,w&255,S>>>24&255,S>>>16&255,S>>>8&255,S&255,y>>>24&255,y>>>16&255,y>>>8&255,y&255,P>>>24&255,P>>>16&255,P>>>8&255,P&255];return this.is224||I.push(T>>>24&255,T>>>16&255,T>>>8&255,T&255),I},b.prototype.array=b.prototype.digest,b.prototype.arrayBuffer=function(){this.finalize();var x=new ArrayBuffer(this.is224?28:32),E=new DataView(x);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),x};function _(x,E,A){var w,S=typeof x;if(S==="string"){var y=[],P=x.length,T=0,I;for(w=0;w>>6,y[T++]=128|I&63):I<55296||I>=57344?(y[T++]=224|I>>>12,y[T++]=128|I>>>6&63,y[T++]=128|I&63):(I=65536+((I&1023)<<10|x.charCodeAt(++w)&1023),y[T++]=240|I>>>18,y[T++]=128|I>>>12&63,y[T++]=128|I>>>6&63,y[T++]=128|I&63);x=y}else if(S==="object"){if(x===null)throw new Error(e);if(a&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!a||!ArrayBuffer.isView(x)))throw new Error(e)}else throw new Error(e);x.length>64&&(x=new b(E,!0).update(x).array());var M=[],B=[];for(w=0;w<64;++w){var re=x[w]||0;M[w]=92^re,B[w]=54^re}b.call(this,E,A),this.update(B),this.oKeyPad=M,this.inner=!0,this.sharedMemory=A}_.prototype=new b,_.prototype.finalize=function(){if(b.prototype.finalize.call(this),this.inner){this.inner=!1;var x=this.array();b.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(x),b.prototype.finalize.call(this)}};var C=p();C.sha256=C,C.sha224=p(!0),C.sha256.hmac=v(),C.sha224.hmac=v(!0),s?t.exports=C:(i.sha256=C.sha256,i.sha224=C.sha224)})()})($T);var $5=$T.exports,Du=R5($5),{sha224:a7}=Du;function FT(t,e,r){if(!(t===void 0||e===void 0||r===void 0))return`head${t}-obj${e}-path${r}`}var IT=wh.StateEffect.define();function MT(t,e,r){return r.update({effects:IT.of({key:t,la:e,lineOffsetsFromUnsavedChanges:new Map})})}var Cl=wh.StateField.define({create:t=>{},update:(t,e)=>{for(let r of e.effects)if(r.is(IT))return r.value;return F5(e,t)},compare:(t,e)=>(t==null?void 0:t.key)===(e==null?void 0:e.key)});function bh(t){var s;let e=Du.create();if(!t)return e;let{la:r,key:i,lineOffsetsFromUnsavedChanges:n}=t;e.update(r==="untracked"?"t":"f"),e.update(i);for(let[a,o]of(s=n.entries())!=null?s:[])e.update([a,o]);return e}var Ou={get:void 0,save:void 0};function DT(t,e){Ou.get=t,Ou.save=e}function _h(t){var e,r;return(r=(e=Lu(t.coloringMaxAge))==null?void 0:e.asDays())!=null?r:Lu(tt.lineAuthor.coloringMaxAge).asDays()}function F5(t,e){if(e)return t.changes.empty||t.changes.iterChanges((r,i,n,s)=>{var p;let a=t.startState.doc,{newDoc:o}=t,l=a.lineAt(r).number,c=a.lineAt(i).number,u=o.lineAt(n).number,f=o.lineAt(s).number,d=c-l+1,h=f-u+1;for(let g=u;g<=f;g++){let v=(p=e.lineOffsetsFromUnsavedChanges.get(g))!=null?p:0,b=f===g,_=h-d;b&&(v+=_),e.lineOffsetsFromUnsavedChanges.set(g,v)}}),e}m();function OT(){Al=void 0,vw=[],yh=0,Eh.clear(),Sh.clear(),Tl.clear()}var Al,xh=()=>Al;function LT(t,e){var n;let r=e.length;if(r<((n=Al==null?void 0:Al.length)!=null?n:0))return;Al={gutter:t,length:r,text:e};let i=Et.plugin.localStorage.getGutterSpacingFallbackLength();r!==i&&Et.plugin.localStorage.setGutterSpacingFallbackLength(r)}var vw=[],I5=15,yh=0;function NT(t){vw[yh]=t,yh=(yh+1)%I5}function BT(){return yk(vw)}var Eh=new Map,Sh=new Map,Tl=new Set;m();var QT=require("@codemirror/state"),JT=require("@codemirror/view");m();var yw=require("@codemirror/view");var Pl=require("obsidian");m();m();var kh={x:-10,y:-10};function HT(){kh.x===-10&&window.addEventListener("mousedown",t=>{kh.x=t.clientX,kh.y=t.clientY})}function UT(){for(let t of Tl)if(M5(t,kh))return t}function M5(t,e){let{x:r,y:i,width:n,height:s}=t.getBoundingClientRect();return r<=e.x&&e.x<=r+n&&i<=e.y&&e.y<=i+s}var GT="data-commit";function jT(t,e,r){if(e.hasFocus())return;let i=UT();if(!i)return;let n=O5(i);n&&(!n.isZeroCommit&&!n.isWaitingGutter&&D5(n,t),ww("showCommitHash",t),ww("authorDisplay",t),ww("dateTimeFormatOptions",t))}function D5(t,e){e.addItem(r=>r.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-author-copy").onClick(i=>navigator.clipboard.writeText(t.hash)))}function ww(t,e){var l,c;let r,i,n=Et.plugin.settings.lineAuthor,s=n[t],a=typeof s=="boolean"?s:s!=="hide",o=tt.lineAuthor[t];if(t==="showCommitHash")r="Show commit hash",i=s;else if(t==="authorDisplay"){let u=(l=n.lastShownAuthorDisplay)!=null?l:o;r="Show author "+(a?s:u),i=a?"hide":u}else if(t==="dateTimeFormatOptions"){let u=(c=n.lastShownDateTimeFormatOptions)!=null?c:o;r="Show "+(a?s:u),r+=r.contains("date")?"":" date",i=a?"hide":u}else js(t);e.addItem(u=>u.setTitle(r).setSection("obs-git-line-author-configure").setChecked(a).onClick(f=>{var d,h;return(h=(d=Et.plugin)==null?void 0:d.settingsTab)==null?void 0:h.lineAuthorSettingHandler(t,i)}))}function VT(t,e,r){r.setAttr(GT,JSON.stringify({hash:t.hash,isZeroCommit:t.isZeroCommit,isWaitingGutter:e}))}function O5(t){let e=t.getAttr(GT);return e?JSON.parse(e):void 0}m();function Ah(t,e){return t==="oldest"?Ch(0,!1,e).color:Ch(void 0,!0,e).color}function Ch(t,e,r){let i=_h(r),n=Date.now()/1e3,s=t!=null?t:0,o=(e?0:n-s)/60/60/24,l=Math.pow(Math.clamp(o/i,0,1),1/2.3),c=L5(),u=r.colorNew,f=r.colorOld,d=c?.4:1,h=bw(u.r,f.r,l)*d,p=bw(u.g,f.g,l)*d,g=bw(u.b,f.b,l)*d;return{color:`rgba(${h},${p},${g},${c?.75:.25})`,daysSinceCommit:o}}function bw(t,e,r){return t+(e-t)*r}function L5(){var t,e,r;return(r=(e=(t=Et.plugin)==null?void 0:t.app)==null?void 0:e.isDarkMode())!=null?r:!1}function zT(t){activeDocument.body.style.setProperty("--obs-git-gutter-text",t.textColorCss)}m();function WT(t,e,r){let i;for(let n=e;n<=r;n++){let s=t.hashPerLine[n];if(s===void 0)continue;let a=t.commits.get(s);(!i||a.isZeroCommit||N5(a,i))&&(i=a)}return i}function N5(t,e){var n,s,a,o;let r=(s=(n=t.author)==null?void 0:n.epochSeconds)!=null?s:0,i=(o=(a=e.author)==null?void 0:a.epochSeconds)!=null?o:0;return r>i}var YT=require("node:util");var qT="-",B5="+",H5=3,U5="*",G5=/\S/g,j5="%",Rl=class t extends yw.GutterMarker{constructor(r){super();this.text=r}eq(r){return r instanceof t&&this.text===r.text}toDOM(){return activeDocument.createTextNode(this.text)}destroy(r){}},_w=class extends yw.GutterMarker{constructor(r,i,n,s,a,o){super();this.lineAuthoring=r;this.startLine=i;this.endLine=n;this.key=s;this.settings=a;this.options=o;this.point=!1;this.elementClass="obs-git-blame-gutter"}eq(r){return this.key===(r==null?void 0:r.key)&&this.startLine===(r==null?void 0:r.startLine)&&this.endLine===(r==null?void 0:r.endLine)&&(this==null?void 0:this.options)===(r==null?void 0:r.options)}toDOM(){var r;return this.precomputedDomProvider=(r=this.precomputedDomProvider)!=null?r:this.computeDom(),this.precomputedDomProvider()}destroy(r){r&&(activeDocument.body.contains(r)||Tl.delete(r))}computeDom(){let r=WT(this.lineAuthoring,this.startLine,this.endLine),i=r.isZeroCommit?"":this.renderNonZeroCommit(r);return!r.isZeroCommit&&this.options!=="waiting-for-result"?LT(this,i):i=this.adaptTextForFakeCommit(r,i,this.options),this.createHtmlNode(r,i,this.options==="waiting-for-result")}createHtmlNode(r,i,n){var c,u,f,d,h,p;let s=window.createDiv();s.setText(i);let{color:a,daysSinceCommit:o}=Ch((c=r==null?void 0:r.author)==null?void 0:c.epochSeconds,r==null?void 0:r.isZeroCommit,this.settings);s.style.backgroundColor=a,s.setAttribute("data-author",(f=(u=r==null?void 0:r.author)==null?void 0:u.name)!=null?f:""),s.setAttribute("data-author-email",(h=(d=r==null?void 0:r.author)==null?void 0:d.email)!=null?h:""),(0,Pl.setTooltip)(s,(p=r==null?void 0:r.summary)!=null?p:""),VT(r,n,s);function l(){let g=s.cloneNode(!0);return Tl.add(g),n||NT(o),g}return l}renderNonZeroCommit(r){let i=this.settings.showCommitHash?this.renderHash(r):"",n=this.settings.authorDisplay==="hide"?"":`${this.renderAuthorName(r,this.settings.authorDisplay)}`,s=this.settings.dateTimeFormatOptions==="hide"?"":`${this.renderAuthoringDate(r,this.settings.dateTimeFormatOptions,this.settings.dateTimeFormatCustomString,this.settings.dateTimeTimezone)}`;return[i,n,s].filter(o=>o.length>=1).join(" ")}renderHash(r){return r.hash.substring(0,6)}renderAuthorName(r,i){var o,l,c,u;let n=(l=(o=r==null?void 0:r.author)==null?void 0:o.name)!=null?l:"",s=n.split(" ").filter(f=>f.length>=1),a;switch(i){case"initials":a=s.map(f=>f[0].toUpperCase()).join("");break;case"first name":a=(c=s.first())!=null?c:qT;break;case"last name":a=(u=s.last())!=null?u:qT;break;case"full":a=n;break;default:return js(i)}return(0,YT.isDeepStrictEqual)(r==null?void 0:r.author,r==null?void 0:r.committer)||(a=a+U5),a}renderAuthoringDate(r,i,n,s){var c;if(((c=r==null?void 0:r.author)==null?void 0:c.epochSeconds)===void 0)return"?";let o;switch(i){case"date":o=Bd;break;case"datetime":o=uv;break;case"custom":o=n;break;case"natural language":o=u=>{let f=u.diff((0,Pl.moment)());return Pl.moment.duration(f).humanize(!0)};break;default:return js(i)}let l=Pl.moment.unix(r.author.epochSeconds);switch(s){case"viewer-local":break;case"author-local":l=l.utcOffset(r.author.tz),typeof o=="string"&&(o+=" Z");break;case"utc0000":l=l.utc(),typeof o=="string"&&(o+="[Z]");break;default:return js(s)}return typeof o=="string"?l.format(o):o(l)}adaptTextForFakeCommit(r,i,n){var l,c,u;let s=(c=(l=xh())==null?void 0:l.text)!=null?c:i,a=n!=="waiting-for-result"&&r.isZeroCommit?B5:j5;i=s.replace(G5,a);let o=(u=Et.plugin.localStorage.getGutterSpacingFallbackLength())!=null?u:i.length;if(i=xk(i,o,a),n!=="waiting-for-result"&&r.isZeroCommit){let f=Math.min(o,H5);i=Ek(i,o-f)}return i}};function Na(t,e,r,i,n,s){let a=Du.create();a.update(JSON.stringify(n)),a.update(`s${e}-e${r}-k${i}-o${s}`);let o=a.hex(),l=Eh.get(o);if(l)return l;let c=new _w(t,e,r,i,n,s);return Eh.set(o,c),c}m();var ZT=require("obsidian");function xw(){let t=Et.plugin.localStorage.getGutterSpacingFallbackLength();return new Rl(Array(t).fill("-").join(""))}function Ew(t){let{lineAuthoring:e,ageForInitialRender:r}=V5(t);return Na(e,1,1,"initialGutter"+r,t,"waiting-for-result")}function V5(t){var s;let e=(s=BT())!=null?s:_h(t)*.25,r=(0,ZT.moment)().add(-e,"days"),i={name:"",epochSeconds:_k(r),tz:"+0000"},n={hash:"waiting-for-result",author:i,committer:i,isZeroCommit:!1};return{lineAuthoring:{hashPerLine:[void 0,"waiting-for-result"],commits:new Map([["waiting-for-result",n]])},ageForInitialRender:e}}m();function KT(t,e){return Na({hashPerLine:[void 0,"000000"],commits:new Map([["000000",RT]])},1,1,t,e)}var Sw=new Rl(""),e2=(0,JT.gutter)({class:"line-author-gutter-container",markers(t){let e=t.state.field(Cl,!1);return z5(t,e)},lineMarkerChange(t){let e=bh(t.state.field(Cl));return bh(t.startState.field(Cl))!==e},renderEmptyElements:!0,initialSpacer:t=>(XT(t),xw()),updateSpacer:(t,e)=>{var r,i;return XT(e.view),(i=(r=xh())==null?void 0:r.gutter)!=null?i:xw()}});function z5(t,e){let r=bh(e),i=t.state.doc,n=new Map;for(let u=1;u<=i.lines;u++){let f=i.line(u).from,d=t.lineBlockAt(f).to;n.set(u,[f,d]),r.update([f,d,0])}let s=Ou.get();r.update("s"+Object.values(Ou).join(","));let a=r.hex(),o=Sh.get(a);if(o)return o;let{result:l,allowCache:c}=W5(i,n,s,e);return c&&Sh.set(a,l),l}function W5(t,e,r,i){let n=!0,s=t.lines,a=[];function o(f,d,h){return a.push(h.range(f,d))}let l=q5(s,i),c=t.length===0,u=t.iterLines(s,s+1).next().value==="";for(let f=1;f<=s;f++){let[d,h]=e.get(f),p=t.lineAt(h).number;if(c){o(d,h,Sw);continue}if(f===s&&u){o(d,h,Sw);continue}if(i===void 0){o(d,h,Ew(r)),n=!1;continue}let{key:g,la:v}=i;if(v==="untracked"){o(d,h,KT(v,r));continue}let b=v.hashPerLine.length-1,_=l[f],C=l[p];if(C&&C>b&&o(d,h,Sw),_!==void 0&&_v(1,_,b)&&C!==void 0&&_v(1,C,b)){o(d,h,Na(v,_,C,g,r));continue}if(b<1){o(d,h,Ew(r)),n=!1;continue}let x=Math.clamp(_!=null?_:f,1,b),E=Math.clamp(C!=null?C:p,1,b);o(d,h,Na(v,x,E,g+"computing",r,"waiting-for-result"))}return{result:QT.RangeSet.of(a,!0),allowCache:n}}function q5(t,e){if(!(e!=null&&e.lineOffsetsFromUnsavedChanges))return Array.from(new Array(t+1),n=>n);let r=[void 0],i=0;for(let n=1;n<=t;n++){let s=e.lineOffsetsFromUnsavedChanges.get(n);i+=s!=null?s:0,r[n]=s===void 0?n-i:void 0}return r}function XT(t){t.dom.querySelectorAll(".cm-gutters").forEach(r=>{r!=null&&r.style&&(r.style.marginLeft||(r.style.marginLeft="unset"))})}var Th=class{constructor(e){this.plugin=e;this.lineAuthorings=new Map}async trackChanged(e){try{await this.trackChangedHelper(e)}catch(r){throw console.warn("Git: Error in trackChanged.",r),r}}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(),OT()}async computeLineAuthorInfo(e){let r=this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager,i=await r.submoduleAwareHeadRevisonInContainingDirectory(e),n=await r.hashObject(e),s=FT(i,n,e);if(s!==void 0){if(!this.lineAuthorings.has(s)){let a=await r.blame(e,this.plugin.settings.lineAuthor.followMovement,this.plugin.settings.lineAuthor.ignoreWhitespace);this.lineAuthorings.set(s,a)}this.notifyComputationResultToSubscribers(e,s)}}notifyComputationResultToSubscribers(e,r){Ti.ifFilepathDefinedTransformSubscribers(e,i=>i.forEach(n=>n.notifyLineAuthoring(r,this.lineAuthorings.get(r))))}},r2=t2.Prec.high([Cl,e2]);var i2="https://momentjs.com/docs/#/parsing/string-format/",Y5="https://publish.obsidian.md/git-doc/Line+Authoring",Ph=class extends U.PluginSettingTab{constructor(r,i){super(r,i);this.plugin=i;this.lineAuthorColorSettings=new Map;this.icon="git-pull-request"}get settings(){return this.plugin.settings}display(){let{containerEl:r}=this,i=this.plugin,n;i.settings.differentIntervalCommitAndPush?n="commit":n="commit-and-sync";let s=i.gitReady;r.empty(),s||(r.createEl("p",{text:"Git is not ready. When all settings are correct you can configure commit-sync, etc."}),r.createEl("br"));let a;if(s){new U.Setting(r).setName("Automatic").setHeading(),new U.Setting(r).setName("Split timers for automatic commit and sync").setDesc("Enable to use one interval for commit and another for sync.").addToggle(f=>f.setValue(i.settings.differentIntervalCommitAndPush).onChange(async d=>{i.settings.differentIntervalCommitAndPush=d,await i.saveSettings(),i.automaticsManager.reload("commit","push"),this.refreshDisplayWithDelay()})),new U.Setting(r).setName(`Auto ${n} interval (minutes)`).setDesc(`${i.settings.differentIntervalCommitAndPush?"Commit":"Commit and sync"} changes every X minutes. Set to 0 (default) to disable. (See below setting for further configuration!)`).addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoSaveInterval"}),f.setPlaceholder(String(tt.autoSaveInterval)),f.onChange(async d=>{d!==""?i.settings.autoSaveInterval=Number(d):i.settings.autoSaveInterval=tt.autoSaveInterval,await i.saveSettings(),i.automaticsManager.reload("commit")})}),a=new U.Setting(r).setName(`Auto ${n} after stopping file edits`).setDesc(`Requires the ${n} interval not to be 0. If turned on, do auto ${n} every ${Sk(i.settings.autoSaveInterval)} after stopping file edits. This also prevents auto ${n} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(f=>f.setValue(i.settings.autoBackupAfterFileChange).onChange(async d=>{i.settings.autoBackupAfterFileChange=d,this.refreshDisplayWithDelay(),await i.saveSettings(),i.automaticsManager.reload("commit")})),this.mayDisableSetting(a,i.settings.setLastSaveToLastCommit),a=new U.Setting(r).setName(`Auto ${n} after latest commit`).setDesc(`If turned on, sets last auto ${n} timestamp to the latest commit timestamp. This reduces the frequency of auto ${n} when doing manual commits.`).addToggle(f=>f.setValue(i.settings.setLastSaveToLastCommit).onChange(async d=>{i.settings.setLastSaveToLastCommit=d,await i.saveSettings(),i.automaticsManager.reload("commit"),this.refreshDisplayWithDelay()})),this.mayDisableSetting(a,i.settings.autoBackupAfterFileChange),a=new U.Setting(r).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPushInterval"}),f.setPlaceholder(String(tt.autoPushInterval)),f.onChange(async d=>{d!==""?i.settings.autoPushInterval=Number(d):i.settings.autoPushInterval=tt.autoPushInterval,await i.saveSettings(),i.automaticsManager.reload("push")})}),this.mayDisableSetting(a,!i.settings.differentIntervalCommitAndPush),new U.Setting(r).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(f=>{f.inputEl.type="number",this.setNonDefaultValue({text:f,settingsProperty:"autoPullInterval"}),f.setPlaceholder(String(tt.autoPullInterval)),f.onChange(async d=>{d!==""?i.settings.autoPullInterval=Number(d):i.settings.autoPullInterval=tt.autoPullInterval,await i.saveSettings(),i.automaticsManager.reload("pull")})}),new U.Setting(r).setName(`Auto ${n} only staged files`).setDesc(`If turned on, only staged files are committed on ${n}. If turned off, all changed files are committed.`).addToggle(f=>f.setValue(i.settings.autoCommitOnlyStaged).onChange(async d=>{i.settings.autoCommitOnlyStaged=d,await i.saveSettings()})),new U.Setting(r).setName(`Specify custom commit message on auto ${n}`).setDesc("You will get a pop up to specify your message.").addToggle(f=>f.setValue(i.settings.customMessageOnAutoBackup).onChange(async d=>{i.settings.customMessageOnAutoBackup=d,await i.saveSettings(),this.refreshDisplayWithDelay()})),a=new U.Setting(r).setName(`Commit message on auto ${n}`).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(f=>{f.setPlaceholder(tt.autoCommitMessage).onChange(async d=>{d===""?i.settings.autoCommitMessage=tt.autoCommitMessage:i.settings.autoCommitMessage=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"autoCommitMessage"})}),this.mayDisableSetting(a,i.settings.customMessageOnAutoBackup),new U.Setting(r).setName("Commit").setHeading(),new U.Setting(r).setName("Stage all changes when nothing is staged").setDesc("When using Commit with nothing staged, stage and commit all changes. When disabled, changes must be staged first. Commit all changes and Commit-and-sync are unaffected.").addToggle(f=>f.setValue(i.settings.autoStageOnEmptyIndex).onChange(async d=>{i.settings.autoStageOnEmptyIndex=d,await i.saveSettings()}));let c=new U.Setting(r).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). Leave empty to require manual input on each commit.");c.addTextArea(f=>{c.addButton(d=>{d.setIcon("reset").setTooltip(`Set to default: "${tt.commitMessage}"`).onClick(()=>{f.setValue(tt.commitMessage),f.onChanged()})}),f.setValue(i.settings.commitMessage),f.onChange(async d=>{i.settings.commitMessage=d,await i.saveSettings()})}),U.Platform.isDesktopApp&&new U.Setting(r).setName("Commit message script").setDesc("A script that is run using 'sh -c' to generate the commit message. May be used to generate commit messages using AI tools. Available placeholders: {{hostname}}, {{date}}.").addText(f=>{f.onChange(async d=>{d===""?i.settings.commitMessageScript=tt.commitMessageScript:i.settings.commitMessageScript=d,await i.saveSettings()}),this.setNonDefaultValue({text:f,settingsProperty:"commitMessageScript"})});let u=new U.Setting(r).setName("{{date}} placeholder format").addMomentFormat(f=>f.setDefaultFormat(i.settings.commitDateFormat).setValue(i.settings.commitDateFormat).onChange(async d=>{i.settings.commitDateFormat=d,await i.saveSettings()}));u.descEl.createSpan({text:` Specify custom date format. E.g. "${fv}. See `}),u.descEl.createEl("a",{text:"Moment.js documentation",href:i2,attr:{target:"_blank"}}),u.descEl.createSpan({text:" for more formats."}),new U.Setting(r).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device. Defaults to the OS hostname if not set on desktop.").addText(f=>{var d;return f.setValue((d=i.localStorage.getHostname())!=null?d:"").onChange(h=>{i.localStorage.setHostname(h)})}),new U.Setting(r).setName("Preview commit message").addButton(f=>f.setButtonText("Preview").onClick(async()=>{let d=await i.gitManager.formatCommitMessage(i.settings.commitMessage);new U.Notice(`${d}`)})),new U.Setting(r).setName("List filenames affected by commit in the commit body").addToggle(f=>f.setValue(i.settings.listChangedFilesInMessageBody).onChange(async d=>{i.settings.listChangedFilesInMessageBody=d,await i.saveSettings()})),new U.Setting(r).setName("Pull").setHeading(),i.gitManager instanceof ke&&new U.Setting(r).setName("Merge strategy").setDesc("Decide how to integrate commits from your remote branch into your local branch.").addDropdown(f=>{let d={merge:"Merge",rebase:"Rebase",reset:"Other sync service (Only updates the HEAD without touching the working directory)"};f.addOptions(d),f.setValue(i.settings.syncMethod),f.onChange(async h=>{i.settings.syncMethod=h,await i.saveSettings()})}),new U.Setting(r).setName("Merge strategy on conflicts").setDesc("Decide how to solve conflicts when pulling remote changes. This can be used to favor your local changes or the remote changes automatically.").addDropdown(f=>{let d={none:"None (git default)",ours:"Our changes",theirs:"Their changes"};f.addOptions(d),f.setValue(i.settings.mergeStrategy),f.onChange(async h=>{i.settings.mergeStrategy=h,await i.saveSettings()})}),new U.Setting(r).setName("Pull on startup").setDesc("Automatically pull commits when Obsidian starts.").addToggle(f=>f.setValue(i.settings.autoPullOnBoot).onChange(async d=>{i.settings.autoPullOnBoot=d,await i.saveSettings()})),new U.Setting(r).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(),a=new U.Setting(r).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 ${i.settings.pullBeforePush?"and pull ":""}only. It will still be called commit-and-sync.`).addToggle(f=>f.setValue(!i.settings.disablePush).onChange(async d=>{i.settings.disablePush=!d,this.refreshDisplayWithDelay(),await i.saveSettings()})),new U.Setting(r).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 ${i.settings.disablePush?"":"and push "}only.`).addToggle(f=>f.setValue(i.settings.pullBeforePush).onChange(async d=>{i.settings.pullBeforePush=d,this.refreshDisplayWithDelay(),await i.saveSettings()})),i.gitManager instanceof ke&&new U.Setting(r).setName("Squash commits before push").setDesc("On commit-and-sync, squash all local unpushed commits into a single commit right before pushing. Keeps the remote history clean when committing often. Only unpushed commits are rewritten, so no force-push is needed.").addToggle(f=>f.setValue(i.settings.squashCommitsBeforePush).onChange(async d=>{i.settings.squashCommitsBeforePush=d,await i.saveSettings()})),i.gitManager instanceof ke&&(new U.Setting(r).setName("Hunk management").setDesc("Hunks are sections of grouped line changes right in your editor.").setHeading(),new U.Setting(r).setName("Signs").setDesc("This allows you to see your changes right in your editor via colored markers and stage/reset/preview individual hunks.").addToggle(f=>f.setValue(i.settings.hunks.showSigns).onChange(async d=>{i.settings.hunks.showSigns=d,await i.saveSettings(),i.editorIntegration.refreshSignsSettings()})),new U.Setting(r).setName("Hunk commands").setDesc("Adds commands to stage/reset individual Git diff hunks and navigate between them via 'Go to next/prev hunk' commands.").addToggle(f=>f.setValue(i.settings.hunks.hunkCommands).onChange(async d=>{i.settings.hunks.hunkCommands=d,await i.saveSettings(),i.editorIntegration.refreshSignsSettings()})),new U.Setting(r).setName("Status bar with summary of line changes").addDropdown(f=>f.addOptions({disabled:"Disabled",colored:"Colored",monochrome:"Monochrome"}).setValue(i.settings.hunks.statusBar).onChange(async d=>{i.settings.hunks.statusBar=d,await i.saveSettings(),i.editorIntegration.refreshSignsSettings()})),new U.Setting(r).setName("Line author information").setHeading(),this.addLineAuthorInfoSettings())}new U.Setting(r).setName("History view").setHeading(),new U.Setting(r).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(i.settings.authorInHistoryView),c.onChange(async f=>{i.settings.authorInHistoryView=f,await i.saveSettings(),await i.refresh()})}),new U.Setting(r).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(i.settings.dateInHistoryView).onChange(async u=>{i.settings.dateInHistoryView=u,await i.saveSettings(),await i.refresh()})),new U.Setting(r).setName("Source control view").setHeading(),new U.Setting(r).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(i.settings.refreshSourceControl).onChange(async u=>{i.settings.refreshSourceControl=u,await i.saveSettings()})),new U.Setting(r).setName("Source control view refresh interval").setDesc("Milliseconds to wait after file change before refreshing the Source Control View.").addText(c=>{c.inputEl.type="number",this.setNonDefaultValue({text:c,settingsProperty:"refreshSourceControlTimer"}),c.setPlaceholder(String(tt.refreshSourceControlTimer)),c.onChange(async f=>{f!==""&&Number.isInteger(Number(f))?i.settings.refreshSourceControlTimer=Math.max(Number(f),500):i.settings.refreshSourceControlTimer=tt.refreshSourceControlTimer,await i.saveSettings(),i.setRefreshDebouncer()})}),new U.Setting(r).setName("Miscellaneous").setHeading(),i.gitManager instanceof ke&&(new U.Setting(r).setName("Diff view style").setDesc('Set the style for the diff view. Note that the actual diff in "Split" mode is not generated by Git, but the editor itself instead so it may differ from the diff generated by Git. One advantage of this is that you can edit the text in that view.').addDropdown(c=>{let u={split:"Split",git_unified:"Unified"};c.addOptions(u),c.setValue(i.settings.diffStyle),c.onChange(async f=>{i.settings.diffStyle=f,await i.saveSettings()})}),new U.Setting(r).setName("Split diff view timeout").setDesc("Maximum time in milliseconds to compute a detailed split diff. Higher values improve accuracy for large files with many changes but may reduce responsiveness. Read-only diffs use ten times this value.").addText(c=>{c.inputEl.type="number",c.inputEl.min="1",c.inputEl.step="1",this.setNonDefaultValue({text:c,settingsProperty:"diffTimeout"}),c.setPlaceholder(String(tt.diffTimeout)),c.onChange(async u=>{let f=Number(u);i.settings.diffTimeout=u!==""&&Number.isInteger(f)&&f>0?f:tt.diffTimeout,await i.saveSettings()})})),new U.Setting(r).setName("Disable informative notifications").setDesc("Disable informative notifications for git operations to minimize distraction (refer to status bar for updates).").addToggle(c=>c.setValue(i.settings.disablePopups).onChange(async u=>{i.settings.disablePopups=u,this.refreshDisplayWithDelay(),await i.saveSettings()})),new U.Setting(r).setName("Disable error notifications").setDesc("Disable error notifications of any kind to minimize distraction (refer to status bar for updates).").addToggle(c=>c.setValue(!i.settings.showErrorNotices).onChange(async u=>{i.settings.showErrorNotices=!u,await i.saveSettings()})),i.settings.disablePopups||new U.Setting(r).setName("Hide notifications for no changes").setDesc("Don't show notifications when there are no changes to commit or push.").addToggle(c=>c.setValue(i.settings.disablePopupsForNoChanges).onChange(async u=>{i.settings.disablePopupsForNoChanges=u,await i.saveSettings()})),new U.Setting(r).setName("Show status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(i.settings.showStatusBar).onChange(async u=>{i.settings.showStatusBar=u,await i.saveSettings()})),new U.Setting(r).setName("File menu integration").setDesc('Add "Stage", "Unstage" and "Add to .gitignore" actions to the file menu.').addToggle(c=>c.setValue(i.settings.showFileMenu).onChange(async u=>{i.settings.showFileMenu=u,await i.saveSettings()})),new U.Setting(r).setName("Show branch status bar").setDesc("Obsidian must be restarted for the changes to take affect.").addToggle(c=>c.setValue(i.settings.showBranchStatusBar).onChange(async u=>{i.settings.showBranchStatusBar=u,await i.saveSettings()})),new U.Setting(r).setName("Show the count of modified files in the status bar").addToggle(c=>c.setValue(i.settings.changedFilesInStatusBar).onChange(async u=>{i.settings.changedFilesInStatusBar=u,await i.saveSettings()})),i.gitManager instanceof Zi?new U.Setting(r).setName("Authentication/commit author").setHeading():new U.Setting(r).setName("Commit author").setHeading(),i.gitManager instanceof Zi&&new U.Setting(r).setName("Username on your git server. E.g. your username on GitHub").addText(c=>{var u;c.setValue((u=i.localStorage.getUsername())!=null?u:""),c.onChange(f=>{i.localStorage.setUsername(f)})}),i.gitManager instanceof Zi&&new U.Setting(r).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=>{i.localStorage.setPassword(u)})}),i.gitReady&&new U.Setting(r).setName("Author name for commit").addText(async c=>{var u;c.setValue((u=await i.gitManager.getConfig("user.name"))!=null?u:""),c.onChange(async f=>{await i.gitManager.setConfig("user.name",f==""?void 0:f)})}),i.gitReady&&new U.Setting(r).setName("Author email for commit").addText(async c=>{var u;c.setValue((u=await i.gitManager.getConfig("user.email"))!=null?u:""),c.onChange(async f=>{await i.gitManager.setConfig("user.email",f==""?void 0:f)})}),new U.Setting(r).setName("Advanced").setDesc("These settings usually don't need to be changed, but may be required for special setups.").setHeading(),i.gitManager instanceof ke&&(new U.Setting(r).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(i.settings.updateSubmodules).onChange(async u=>{i.settings.updateSubmodules=u,await i.saveSettings()})),i.settings.updateSubmodules&&new U.Setting(r).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(i.settings.submoduleRecurseCheckout).onChange(async u=>{i.settings.submoduleRecurseCheckout=u,await i.saveSettings()}))),i.gitManager instanceof ke&&new U.Setting(r).setName("Custom Git binary path").setDesc("Specify the path to the Git binary/executable. Git should already be in your PATH. Should only be necessary for a custom Git installation.").addText(c=>{var u;c.setValue((u=i.localStorage.getGitPath())!=null?u:""),c.setPlaceholder("git"),c.onChange(f=>{i.localStorage.setGitPath(f),i.gitManager.updateGitPath(f||"git").catch(d=>i.displayError(d))})}),i.gitManager instanceof ke&&new U.Setting(r).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(i.localStorage.getEnvVars().join(` `)),c.onChange(u=>{i.localStorage.setEnvVars(u.split(` `))})}),i.gitManager instanceof ke&&new U.Setting(r).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(c=>{c.setValue(i.localStorage.getPATHPaths().join(` `)),c.onChange(u=>{i.localStorage.setPATHPaths(u.split(` `))})}),i.gitManager instanceof ke&&new U.Setting(r).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 i.gitManager.setGitInstance()})}),new U.Setting(r).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(i.settings.basePath),c.setPlaceholder("directory/directory-with-git-repo"),c.onChange(async u=>{i.settings.basePath=u,await i.saveSettings(),i.gitManager.updateBasePath(u||"").catch(f=>i.displayError(f))})}),new U.Setting(r).setName("Custom Git directory path (Instead of '.git')").setDesc('Corresponds to the GIT_DIR environment variable. Relative paths are resolved from the custom base path, or the vault root when no base path is configured. Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(c=>{c.setValue(i.settings.gitDir),c.setPlaceholder(".git"),c.onChange(async u=>{i.settings.gitDir=u,await i.saveSettings()})}),new U.Setting(r).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(c=>c.setValue(i.localStorage.getPluginDisabled()).onChange(u=>{i.localStorage.setPluginDisabled(u),u?i.unloadPlugin():i.init({fromReload:!0}).catch(f=>i.displayError(f)),new U.Notice("Obsidian must be restarted for the changes to take affect.")})),new U.Setting(r).setName("Support").setHeading(),new U.Setting(r).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(c=>{var f;let u=(f=c.buttonEl.parentElement)==null?void 0:f.createEl("a",{href:"https://ko-fi.com/F1F195IQ5",attr:{target:"_blank"}});u&&(u.createEl("img",{attr:{height:"36",style:"border:0px;height:36px;",src:"https://cdn.ko-fi.com/cdn/kofi3.png?v=3",border:"0",alt:"Buy Me a Coffee at ko-fi.com"}}),c.buttonEl.remove())});let o=r.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 U.Notice("Debug information copied to clipboard. May contain sensitive information!")},U.Platform.isDesktopApp){let c=r.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=r.createDiv();u.setAttr("align","center"),u.addClass("obsidian-git-shortcuts"),U.Platform.isMacOS===!0?u.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):u.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(r,i){i&&(r.setDisabled(i),r.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(r){this.settings.lineAuthor.show=r,this.plugin.saveSettings(),r?this.plugin.editorIntegration.activateLineAuthoring():this.plugin.editorIntegration.deactiveLineAuthoring()}async lineAuthorSettingHandler(r,i){this.settings.lineAuthor[r]=i,await this.plugin.saveSettings(),this.plugin.editorIntegration.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let r=this.settings.lineAuthor;r.authorDisplay!=="hide"&&(r.lastShownAuthorDisplay=r.authorDisplay),r.dateTimeFormatOptions!=="hide"&&(r.lastShownDateTimeFormatOptions=r.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let r=new U.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform()||r.setDesc("Only available on desktop currently.").setDisabled(!0),r.descEl.createEl("a",{href:Y5,text:"Feature guide and quick examples",attr:{target:"_blank"}}),r.descEl.createEl("br"),r.descEl.createSpan({text:" The commit hash, author name and authoring date can all be individually toggled."}),r.descEl.createEl("br"),r.descEl.createSpan({text:"Hide everything, to only show the age-colored sidebar."}),r.addToggle(i=>i.setValue(this.settings.lineAuthor.show).onChange(n=>{this.configureLineAuthorShowStatus(n),this.refreshDisplayWithDelay()})),this.settings.lineAuthor.show){let i=new U.Setting(this.containerEl).setName("Follow movement and copies across files and commits").addDropdown(l=>{l.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),l.setValue(this.settings.lineAuthor.followMovement),l.onChange(c=>this.lineAuthorSettingHandler("followMovement",c))});if(i.descEl.createSpan({text:"By default (deactivated), each line only shows the newest commit where it was changed."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"With "}),i.descEl.createEl("i",{text:"same commit"}),i.descEl.createSpan({text:", cut-copy-paste-ing of text is followed within the same commit and the original commit of authoring will be shown."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"With "}),i.descEl.createEl("i",{text:"all commits"}),i.descEl.createSpan({text:", cut-copy-paste-ing text inbetween multiple commits will be detected."}),i.descEl.createEl("br"),i.descEl.createSpan({text:"It uses "}),i.descEl.createEl("a",{href:"https://git-scm.com/docs/git-blame",text:"git-blame",attr:{target:"_blank"}}),i.descEl.createSpan({text:` and for matches (at least ${Hd} characters) within the same (or all) commit(s), `}),i.descEl.createEl("em",{text:"the originating"}),i.descEl.createSpan({text:" commit's information is shown."}),new U.Setting(this.containerEl).setName("Show commit hash").addToggle(l=>{l.setValue(this.settings.lineAuthor.showCommitHash),l.onChange(c=>this.lineAuthorSettingHandler("showCommitHash",c))}),new U.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(l=>{let c={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};l.addOptions(c),l.setValue(this.settings.lineAuthor.authorDisplay),l.onChange(async u=>this.lineAuthorSettingHandler("authorDisplay",u))}),new U.Setting(this.containerEl).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(l=>{let c={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};l.addOptions(c),l.setValue(this.settings.lineAuthor.dateTimeFormatOptions),l.onChange(async u=>{await this.lineAuthorSettingHandler("dateTimeFormatOptions",u),this.refreshDisplayWithDelay()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let l=new U.Setting(this.containerEl);l.setName("Custom authoring date format").addText(c=>{c.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),c.setPlaceholder("YYYY-MM-DD HH:mm"),c.onChange(async u=>{await this.lineAuthorSettingHandler("dateTimeFormatCustomString",u),this.setCustomDateTimeDescription(l.descEl,u)})}),this.setCustomDateTimeDescription(l.descEl,this.settings.lineAuthor.dateTimeFormatCustomString)}let n=new U.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(l=>{let c={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};l.addOptions(c),l.setValue(this.settings.lineAuthor.dateTimeTimezone),l.onChange(async u=>this.lineAuthorSettingHandler("dateTimeTimezone",u))});n.descEl.empty(),n.descEl.createSpan({text:`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 `}),n.descEl.createEl("a",{text:"UTC\xB100:00",href:"https://en.wikipedia.org/wiki/UTC%C2%B100:00"}),n.descEl.createSpan({text:"."});let s=new U.Setting(this.containerEl).setName("Oldest age in coloring");this.setOldestAgeDescription(s.descEl,this.settings.lineAuthor.coloringMaxAge),s.addText(l=>{l.setPlaceholder("1y"),l.setValue(this.settings.lineAuthor.coloringMaxAge),l.onChange(async c=>{let f=Lu(c)!==void 0;this.setOldestAgeDescription(s.descEl,c),f&&(await this.lineAuthorSettingHandler("coloringMaxAge",c),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest");let a=new U.Setting(this.containerEl).setName("Text color").addText(l=>{l.setValue(this.settings.lineAuthor.textColorCss),l.onChange(async c=>{await this.lineAuthorSettingHandler("textColorCss",c)})});a.descEl.empty(),a.descEl.createSpan({text:"The CSS color of the gutter text."}),a.descEl.createEl("br"),a.descEl.createEl("br"),a.descEl.createSpan({text:"It is highly recommended to use "}),a.descEl.createEl("a",{text:"CSS variables",href:"https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties"}),a.descEl.createSpan({text:" defined by themes (e.g. "}),a.descEl.createEl("pre",{text:"var(--text-muted)",attr:{style:"display:inline"}}),a.descEl.createSpan({text:" or "}),a.descEl.createEl("pre",{text:"var(--text-on-accent)",attr:{style:"display:inline"}}),a.descEl.createSpan({text:"), because they automatically adapt to theme changes."}),a.descEl.createEl("br"),a.descEl.createEl("br"),a.descEl.createSpan({text:"See: "}),a.descEl.createEl("a",{text:"List of available CSS variables in Obsidian",href:"https://github.com/obsidian-community/obsidian-theme-template/blob/main/obsidian.css"});let o=new U.Setting(this.containerEl).setName("Ignore whitespace and newlines in changes").addToggle(l=>{l.setValue(this.settings.lineAuthor.ignoreWhitespace),l.onChange(c=>this.lineAuthorSettingHandler("ignoreWhitespace",c))});o.descEl.empty(),o.descEl.createSpan({text:"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."}),o.descEl.createEl("br"),o.descEl.createSpan({text:"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(r){let i=new U.Setting(this.containerEl).setName("").addText(n=>{let s=kw(r,this.settings.lineAuthor),a=kw(r,tt.lineAuthor);n.setPlaceholder(bv(a)),n.setValue(bv(s)),n.onChange(async o=>{let l=bk(o);if(l!==void 0){let c=r==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(c,l)}this.refreshColorSettingsDesc(r,l)})});this.lineAuthorColorSettings.set(r,i),this.refreshColorSettingsName(r),this.refreshColorSettingsDesc(r,kw(r,this.settings.lineAuthor))}refreshColorSettingsName(r){let i=this.lineAuthorColorSettings.get(r);if(i){let n=r==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";i.nameEl.setText(`Color for ${n} commits`)}}refreshColorSettingsDesc(r,i){let n=this.lineAuthorColorSettings.get(r);n&&this.colorSettingPreviewDesc(n.descEl,r,this.settings.lineAuthor,i!==void 0)}colorSettingPreviewDesc(r,i,n,s){r.empty(),r.createSpan({text:"Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and named colors (e.g. 'black', 'purple'). Color preview: "});let a=s?Ah(i,n):"rgba(127,127,127,0.3)",o=U.moment.unix(U.moment.now()/1e3).format("YYYY-MM-DD"),l=s?`abcdef Author Name ${o}`:"invalid color";r.createEl("div",{text:l,attr:{class:"line-author-settings-preview",style:`background-color: ${a}; width: 30ch;`}})}setCustomDateTimeDescription(r,i){r.empty(),r.createEl("a",{text:"Format string",href:i2}),r.createSpan({text:" to display the authoring date."}),r.createEl("br");let n=(0,U.moment)().format(i);r.createSpan({text:`Currently: ${n}`})}setOldestAgeDescription(r,i){let n=Lu(i),s=n!==void 0?`${n.asDays()} days`:"invalid!";r.empty(),r.createSpan({text:`The oldest age in the line author coloring. Everything older will have the same color. Smallest valid age is "1d". Currently: ${s}`})}setNonDefaultValue({settingsProperty:r,text:i}){let n=this.plugin.settings[r];tt[r]!==n&&(typeof n=="string"||typeof n=="number"||typeof n=="boolean"?i.setValue(String(n)):i.setValue(JSON.stringify(n)))}refreshDisplayWithDelay(r=80){window.setTimeout(()=>this.display(),r)}};function kw(t,e){return t==="oldest"?e.colorOld:e.colorNew}function Lu(t){let e=U.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}m();var zr=require("obsidian");var Rh=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.messages=[];this.currentMessage=null;this.lastMessageTimestamp=null;this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),r.registerEvent(r.app.workspace.on("obsidian-git:refreshed",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,r){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:r}),this.display()}displayProgress(e){this.progress=e,this.display()}clearProgress(e=!0){this.progress=void 0,e&&this.display()}display(){this.progress?this.displayState():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(){if((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.pausedEl=this.statusBarEl.createDiv(),this.pausedEl.setAttribute("data-tooltip-position","top"),this.pausedEl.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,zr.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.localStorage.getPausedAutomatics()?((0,zr.setIcon)(this.pausedEl,"pause-circle"),this.pausedEl.ariaLabel="Automatic routines are currently paused.",this.pausedEl.style.marginRight="5px",this.pausedEl.addClass(this.base+"paused")):(this.pausedEl.empty(),this.pausedEl.style.marginRight=""),this.progress){this.statusBarEl.ariaLabel=this.getProgressTooltip("Git operation in progress..."),(0,zr.setIcon)(this.iconEl,this.getProgressIcon()),this.displayProgressText(),this.statusBarEl.addClass(this.base+"progress");return}switch(this.plugin.state.operation){case 0:this.displayFromNow();break;case 2:this.statusBarEl.ariaLabel="Committing changes...",(0,zr.setIcon)(this.iconEl,"git-commit"),this.textEl.empty(),this.statusBarEl.addClass(this.base+"commit");break;case 3:this.statusBarEl.ariaLabel=this.getProgressTooltip("Pushing changes..."),(0,zr.setIcon)(this.iconEl,"upload"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"push");break;case 1:this.statusBarEl.ariaLabel=this.getProgressTooltip("Pulling changes..."),(0,zr.setIcon)(this.iconEl,"download"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"pull");break;case 4:this.statusBarEl.ariaLabel=this.getProgressTooltip("Fetching from remote..."),(0,zr.setIcon)(this.iconEl,"download"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"fetch");break;case 5:this.statusBarEl.ariaLabel=this.getProgressTooltip("Checking out branch..."),(0,zr.setIcon)(this.iconEl,"git-branch"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"checkout");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,zr.setIcon)(this.iconEl,"alert-triangle"),this.textEl.empty(),this.statusBarEl.addClass(this.base+"failed-init");break}}displayProgressText(){this.progress?this.textEl.setText(this.getCompactProgressText()):this.textEl.empty()}getProgressTooltip(e){if(!this.progress)return e;let r=this.progress.stage?`${this.progress.stage}: `:"";if(this.progress.progress===void 0)return this.progress.stage?`${this.progress.action}: ${this.progress.stage}...`:`${this.progress.action}...`;let i=this.progress.processed!==void 0&&this.progress.total!==void 0?` (${this.progress.processed}/${this.progress.total})`:"";return`${this.progress.action}: ${r}${Math.round(this.progress.progress)}%${i}`}getCompactProgressText(){return this.progress?this.progress.progress===void 0?`${this.progress.action}...`:`${this.progress.action} ${Math.round(this.progress.progress)}%`:""}getProgressIcon(){var e;switch((e=this.progress)==null?void 0:e.action){case"Fetching":case"Pulling":return"download";case"Pushing":return"upload";case"Checking out":return"git-branch";default:return"git-pull-request"}}displayFromNow(){var i;let e=this.lastCommitTimestamp,r=this.plugin.state.offlineMode;if(e){let n=(0,zr.moment)(e).fromNow();this.statusBarEl.ariaLabel=`${r?"Offline: ":""}Last Commit: ${n}`,((i=this.unPushedCommits)!=null?i:0)>0&&(this.statusBarEl.ariaLabel+=` (${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=r?"Git is offline":"Git is ready";r?(0,zr.setIcon)(this.iconEl,"globe"):(0,zr.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus?this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()):this.textEl.empty(),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()}};m();var Fh=require("obsidian"),$h=class extends Fh.SuggestModal{constructor(r){super(r.app);this.plugin=r;this.resolve=null;this.setPlaceholder("Type your message and select optional the version with the added date.")}openAndGetResult(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>window.setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(r){let i=(0,Fh.moment)().format(this.plugin.settings.commitDateFormat);return r==""&&(r="..."),[r,`${i}: ${r}`,`${r}: ${i}`]}renderSuggestion(r,i){i.innerText=r}onChooseSuggestion(r,i){this.resolve&&this.resolve(r)}};m();var n2=require("obsidian"),Nu=class{constructor(e){this.plugin=e}saveLastAuto(e,r){r==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):r==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):r==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,r,i;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((r=this.plugin.localStorage.getLastAutoPull())!=null?r:""),push:new Date((i=this.plugin.localStorage.getLastAutoPush())!=null?i:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let r=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(r)}if(this.plugin.settings.autoPullInterval>0){let r=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){this.plugin.localStorage.getPausedAutomatics()||(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.saveLastAuto(e,"backup")}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let r=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(r)}}}get isAutomaticsDisabled(){return!this.plugin.gitReady||this.plugin.localStorage.getPausedAutomatics()}startAutoCommitAndSync(e){if(this.isAutomaticsDisabled)return;let r=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,n2.debounce)(()=>this.doAutoCommitAndSync(),r,!0):(r>2147483647&&(r=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),r))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(async()=>{if(this.plugin.settings.setLastSaveToLastCommit){let r=await this.plugin.gitManager.getLastCommitTime();if(r){this.saveLastAuto(r,"backup");let i=this.diff(this.plugin.settings.autoSaveInterval,r);if(i>0)return this.startAutoCommitAndSync(i),!1}}let e=this.plugin.settings.autoCommitOnlyStaged?"staged":"all";return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.commit({fromAuto:!0,mode:e}):await this.plugin.commitAndSync({fromAutoBackup:!0,mode:e}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){if(this.isAutomaticsDisabled)return;let r=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),r)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(e){if(this.isAutomaticsDisabled)return;let r=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;r>2147483647&&(r=2147483647),this.timeoutIDPush=window.setTimeout(()=>this.doAutoPush(),r)}doAutoPush(){this.plugin.promiseQueue.addTask(()=>this.plugin.push(),()=>{this.saveLastAuto(new Date,"push"),this.startAutoPush()})}clearAutoCommitAndSync(){var r;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.autoCommitDebouncer&&((r=this.plugin.autoCommitDebouncer)==null||r.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}diff(e,r){if(isNaN(r.getTime()))return e;let n=e-Math.round((new Date().getTime()-r.getTime())/1e3/60);return Math.max(0,n)}};m();var Xi=require("obsidian");m();var Bu=require("obsidian");async function s2(t,e,r){let i=await o2(e,r);if(i.result==="failure"){new Bu.Notice(i.reason);return}let{isGitHub:n,branch:s,repo:a,user:o,filePath:l}=i;if(n){let c=t.getCursor("from").line+1,u=t.getCursor("to").line+1;c===u?window.open(`https://github.com/${o}/${a}/blob/${s}/${l}?plain=1#L${c}`):window.open(`https://github.com/${o}/${a}/blob/${s}/${l}?plain=1#L${c}-L${u}`)}else new Bu.Notice("It seems like you are not using GitHub")}async function a2(t,e){let r=await o2(t,e);if(r.result==="failure"){new Bu.Notice(r.reason);return}let{isGitHub:i,branch:n,repo:s,user:a,filePath:o}=r;i?window.open(`https://github.com/${a}/${s}/commits/${n}/${o}`):new Bu.Notice("It seems like you are not using GitHub")}async function o2(t,e){var l,c;let r=await e.branchInfo(),i=r.tracking,n=r.current,s,a=e.getRelativeRepoPath(t.path);if(e instanceof ke){let u=await e.getSubmoduleOfFile(e.getRelativeRepoPath(t.path));if(u){a=u.relativeFilepath;let f=await e.git.cwd({path:u.submodule,root:!1}).status();if(i=f.tracking||void 0,n=f.current||void 0,i){let d=i.substring(0,i.indexOf("/")),h=await e.git.cwd({path:u.submodule,root:!1}).getConfig(`remote.${d}.url`,"local");if(h.value!=null)s=h.value;else return{result:"failure",reason:"Failed to get remote url of submodule"}}}}if(i==null)return{result:"failure",reason:"Remote branch is not configured"};if(n==null)return{result:"failure",reason:"Failed to get current branch name"};if(s==null){let u=i.substring(0,i.indexOf("/"));if(s=await e.getConfig(`remote.${u}.url`),s==null)return{result:"failure",reason:"Failed to get remote url"}}let o=s.match(/(?:^https:\/\/github\.com\/(.+)\/(.+?)(?:\.git)?$)|(?:^[a-zA-Z]+@github\.com:(.+)\/(.+?)(?:\.git)?$)/);if(o==null)return{result:"failure",reason:"Could not parse remote url"};{let[u,f,d,h,p]=o;return{result:"success",isGitHub:!!u,repo:(l=d!=null?d:p)!=null?l:"",user:(c=f!=null?f:h)!=null?c:"",branch:n,filePath:a}}}m();var l2=require("obsidian"),Ih=class extends l2.FuzzySuggestModal{constructor(e,r){super(e.app),this.plugin=e,this.changedFiles=r,this.setPlaceholder("Not supported files will be opened by default app!")}getItems(){return this.changedFiles}getItemText(e){if(e.index=="U"&&e.workingDir=="U")return`Untracked | ${e.vaultPath}`;let r="",i="";return e.workingDir!=" "&&(r=`Working Dir: ${e.workingDir} `),e.index!=" "&&(i=`Index: ${e.index}`),`${r}${i} | ${e.vaultPath}`}onChooseItem(e,r){this.plugin.app.metadataCache.getFirstLinkpathDest(e.vaultPath,"")==null?this.app.openWithDefaultApp(e.vaultPath):this.plugin.app.workspace.openLinkText(e.vaultPath,"/")}};m();var c2=require("obsidian"),Mh=class extends c2.Modal{constructor(r,i){super(r);this.content=i;this.resolve=null}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onOpen(){let{contentEl:r,titleEl:i}=this;i.setText("Edit .gitignore");let n=r.createDiv(),s=n.createEl("textarea",{text:this.content,cls:["obsidian-git-textarea"],attr:{rows:10,cols:30,wrap:"off"}});n.createEl("button",{cls:["mod-cta","obsidian-git-center-button"],text:"Save"}).addEventListener("click",()=>{this.resolve(s.value),this.close()})}onClose(){let{contentEl:r}=this;r.empty(),this.resolve&&this.resolve(void 0)}};m();var Ku=require("@codemirror/state"),ep=require("@codemirror/view");m();var Il=require("@codemirror/state");m();var qt=class t{static createHunk(e,r,i,n){return{removed:{start:e,count:r,lines:[]},added:{start:i,count:n,lines:[]},vend:i+Math.max(n-1,0),type:n===0?"delete":r===0?"add":"change"}}static getHunkHeader(e){return`@@ -${e.removed.start}${e.removed.count>0?`,${e.removed.count}`:""} +${e.added.start}${e.added.count>0?`,${e.added.count}`:""} @@`}static createPartialHunk(e,r,i){let n=r,s=i-r+1,a=0;for(let o of e){let l=o.added.count-o.removed.count,c=0;if(o.added.start>=r&&o.vend<=i)c=l;else{let u=Math.max(0,i+1-(o.added.start+o.removed.count)),f=Math.max(0,r-(o.added.start+o.removed.count));o.added.start>=r&&o.added.start<=i?c=u:o.vend>=r&&o.vend<=i?(c=l-f,n=n-f):o.added.start<=r&&o.vend>=i?(c=u-f,n=n-f):a++,r>o.vend&&(n=n-l)}s=s-c}if(a!==e.length)return s===0&&(n=n-1),this.createHunk(n,s,r,i-r+1)}static patchLines(e,r=!1){let i=[];for(let n of e.removed.lines)i.push("-"+n);for(let n of e.added.lines)i.push("+"+n);return r?i.map(n=>n.replace(/\r$/,"")):i}static parseDiffLine(e){var l,c,u;let i=(l=e.split("@@")[1])==null?void 0:l.trim();if(!i)throw Error(`Invalid diff line: ${e}`);let n=i.split(" "),s=(c=n[0])==null?void 0:c.substring(1).split(","),a=(u=n[1])==null?void 0:u.substring(1).split(",");if(!s||!a||s[0]===void 0||a[0]===void 0)throw Error(`Invalid diff hunk range: ${e}`);return this.createHunk(parseInt(s[0]),parseInt(s[1]||"1"),parseInt(a[0]),parseInt(a[1]||"1"))}static changeEnd(e){return e.added.count===0?e.added.start:e.removed.count===0?e.added.start+e.added.count-1:e.added.start+Math.min(e.added.count,e.removed.count)-1}static calcSigns(e,r,i,n=1,s=1/0,a){if(a&&r.type!=="add")return console.error(`Invalid hunk with untracked=${a} hunk="${t.getHunkHeader(r)}"`),[];n=Math.max(1,n);let{start:o,added:l,removed:c}={start:r.added.start,added:r.added.count,removed:r.removed.count},u=this.changeEnd(r),f=r.type==="delete"&&(o===0||e&&this.changeEnd(e)===o)&&(!i||i.added.start!==o+1);f&&n===1&&(n=0);let d=[];for(let h=Math.max(o,n);h<=Math.min(u,s);h++){let p=r.type==="change"&&(c>l&&h===u||e&&e.added.start===0);d.push({type:f?"topdelete":p?"changedelete":a?"untracked":r.type,count:h===o?r.type==="add"?l:c:void 0,lnum:h+(f?1:0)})}if(r.type==="change"&&l>c&&r.vend>=n&&u<=s)for(let h=Math.max(u,n);h<=Math.min(r.vend,s);h++)d.push({type:"add",count:h===r.vend?l-c:void 0,lnum:h});return d}static createPatch(e,r,i,n=!1){let s=[`diff --git a/${e} b/${e}`,`index 000000..000000 ${i}`,`--- a/${e}`,`+++ b/${e}`],a=0;r=structuredClone(r);for(let o of r){let l=o.removed.start,c=o.removed.count,u=o.added.count;o.type==="add"&&(l=l+1);let f=o.removed.lines,d=o.added.lines;n&&([c,u]=[u,c],[f,d]=[d,f]),s.push(`@@ -${l},${c} +${l+a},${u} @@`);for(let h of f)s.push("-"+h);(n?o.added:o.removed).no_nl_at_eof&&s.push("\\ No newline at end of file");for(let h of d)s.push("+"+h);(n?o.removed:o.added).no_nl_at_eof&&s.push("\\ No newline at end of file"),o.removed.start=l+a,a=a+(u-c)}return s}static getSummary(e){let r={added:0,changed:0,removed:0};for(let i of e)if(i.type==="add")r.added+=i.added.count;else if(i.type==="delete")r.removed+=i.removed.count;else if(i.type==="change"){let n=i.added.count,s=i.removed.count,a=Math.min(n,s);r.changed+=a,r.added+=n-a,r.removed+=s-a}return r}static findHunk(e,r){if(!r)return[void 0,void 0];for(let i=0;i=e)return[n,i]}return[void 0,void 0]}static findNearestHunk(e,r,i,n){if(r.length!==0){if(i==="first")return 0;if(i==="last")return r.length-1;if(i==="next"){if(r[0].added.start>e)return 0;for(let s=r.length-1;s>=0;s--)if(r[s].added.start<=e){if(s+1e)return s+1;if(n)return 0}}else if(i==="prev"){if(Math.max(r[r.length-1].vend)0&&Math.max(r[s-1].vend,1)l.added.start?n++:o.added.starta.map(v=>g.replace(/&/,v))).reduce((g,v)=>g.concat(v)),p,l);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+h+") should be a primitive value.");s(n(h),p,u,d)}else p!=null&&u.push(h.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+p+";")}(u.length||d)&&l.push((i&&!f&&!c?a.map(i):a).join(", ")+" {"+u.join(" ")+"}")}for(let a in e)s(n(a),e[a],this.rules)}getRules(){return this.rules.join(` `)}static newName(){let e=f2[u2]||1;return f2[u2]=e+1,"\u037C"+e.toString(36)}static mount(e,r,i){let n=e[Cw],s=i&&i.nonce;n?s&&n.setNonce(s):n=new Aw(e,s),n.mount(Array.isArray(r)?r:[r],e)}},d2=new Map,Aw=class{constructor(e,r){let i=e.ownerDocument||e,n=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=d2.get(i);if(s)return e[Cw]=s;this.sheet=new n.CSSStyleSheet,d2.set(i,this)}else this.styleTag=i.createElement("style"),r&&this.styleTag.setAttribute("nonce",r);this.modules=[],e[Cw]=this}mount(e,r){let i=this.sheet,n=0,s=0;for(let a=0;a-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,o),i)for(let c=0;cc){let f=t.slice(e,r).indexOf(i.slice(n,s));if(f>-1)return[new Rt(e,e+f,n,n),new Rt(e+f+c,r,s,s)]}else if(c>l){let f=i.slice(n,s).indexOf(t.slice(e,r));if(f>-1)return[new Rt(e,e,n,n+f),new Rt(r,r,n+f+l,s)]}if(l==1||c==1)return[new Rt(e,r,n,s)];let u=F2(t,e,r,i,n,s);if(u){let[f,d,h]=u;return Ha(t,e,f,i,n,d).concat(Ha(t,f+h,r,i,d+h,s))}return K5(t,e,r,i,n,s)}var Hu=1e9,Uu=0,Mw=!1;function K5(t,e,r,i,n,s){let a=r-e,o=s-n;if(Hu<1e9&&Math.min(a,o)>Hu*16||Uu>0&&Date.now()>Uu)return Math.min(a,o)>Hu*64?[new Rt(e,r,n,s)]:h2(t,e,r,i,n,s);let l=Math.ceil((a+o)/2);Tw.reset(l),Pw.reset(l);let c=(h,p)=>t.charCodeAt(e+h)==i.charCodeAt(n+p),u=(h,p)=>t.charCodeAt(r-h-1)==i.charCodeAt(s-p-1),f=(a-o)%2!=0?Pw:null,d=f?null:Tw;for(let h=0;hHu||Uu>0&&!(h&63)&&Date.now()>Uu)return h2(t,e,r,i,n,s);let p=Tw.advance(h,a,o,l,f,!1,c)||Pw.advance(h,a,o,l,d,!0,u);if(p)return X5(t,e,r,e+p[0],i,n,s,n+p[1])}return[new Rt(e,r,n,s)]}var Hh=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let r=0;rr)this.end+=2;else if(f>i)this.start+=2;else if(s){let d=n+(r-i)-l;if(d>=0&&d=r-u)return[h,n+h-d]}else{let h=r-s.vec[d];if(u>=h)return[u,f]}}}return null}},Tw=new Hh,Pw=new Hh;function X5(t,e,r,i,n,s,a,o){let l=!1;return!Fl(t,i)&&++i==r&&(l=!0),!Fl(n,o)&&++o==a&&(l=!0),l?[new Rt(e,r,s,a)]:Ha(t,e,i,n,s,o).concat(Ha(t,i,r,n,o,a))}function $2(t,e){let r=1,i=Math.min(t,e);for(;rr||u>s||t.slice(o,c)!=i.slice(l,u)){if(a==1)return o-e-(Fl(t,o)?0:1);a=a>>1}else{if(c==r||u==s)return c-e;o=c,l=u}}}function Ow(t,e,r,i,n,s){if(e==r||n==s||t.charCodeAt(r-1)!=i.charCodeAt(s-1))return 0;let a=$2(r-e,s-n);for(let o=r,l=s;;){let c=o-a,u=l-a;if(c>1}else{if(c==e||u==n)return r-c;o=c,l=u}}}function Rw(t,e,r,i,n,s,a,o){let l=i.slice(n,s),c=null;for(;;){if(c||a=r)break;let d=t.slice(u,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let p=Dw(t,f,r,i,n+h+d.length,s),g=Ow(t,e,u,i,n,n+h),v=d.length+p+g;(!c||c[2]>1}}function F2(t,e,r,i,n,s){let a=r-e,o=s-n;if(an.fromA-e&&i.toB>n.fromB-e&&(t[r-1]=new Rt(i.fromA,n.toA,i.fromB,n.toB),t.splice(r--,1))}}function Q5(t,e,r){for(;;){I2(r,1);let i=!1;for(let n=0;n3||o>3){let l=n==t.length-1?e.length:t[n+1].fromA,c=s.fromA-i,u=l-s.toA,f=m2(e,s.fromA,c),d=p2(e,s.toA,u),h=s.fromA-f,p=d-s.toA;if((!a||!o)&&h&&p){let g=Math.max(a,o),[v,b,_]=a?[e,s.fromA,s.toA]:[r,s.fromB,s.toB];g>h&&e.slice(f,s.fromA)==v.slice(_-h,_)?(s=t[n]=new Rt(f,f+a,s.fromB-h,s.toB-h),f=s.fromA,d=p2(e,s.toA,l-s.toA)):g>p&&e.slice(s.toA,d)==v.slice(b,b+p)&&(s=t[n]=new Rt(d-a,d,s.fromB+p,s.toB+p),d=s.toA,f=m2(e,s.fromA,s.fromA-i)),h=s.fromA-f,p=d-s.toA}if(h||p)s=t[n]=new Rt(s.fromA-h,s.toA+p,s.fromB-h,s.toB+p);else if(a){if(!o){let g=v2(e,s.fromA,s.toA),v,b=g<0?-1:g2(e,s.toA,s.fromA);g>-1&&(v=g-s.fromA)<=u&&e.slice(s.fromA,g)==e.slice(s.toA,s.toA+v)?s=t[n]=s.offset(v):b>-1&&(v=s.toA-b)<=c&&e.slice(s.fromA-v,s.fromA)==e.slice(b,s.toA)&&(s=t[n]=s.offset(-v))}}else{let g=v2(r,s.fromB,s.toB),v,b=g<0?-1:g2(r,s.toB,s.fromB);g>-1&&(v=g-s.fromB)<=u&&r.slice(s.fromB,g)==r.slice(s.toB,s.toB+v)?s=t[n]=s.offset(v):b>-1&&(v=s.toB-b)<=c&&r.slice(s.fromB-v,s.fromB)==r.slice(b,s.toB)&&(s=t[n]=s.offset(-v))}}i=s.toA}return I2(t,3),t}var Ba;try{Ba=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch(t){}function M2(t){return t>48&&t<58||t>64&&t<91||t>96&&t<123}function D2(t,e){if(e==t.length)return 0;let r=t.charCodeAt(e);return r<192?M2(r)?1:0:Ba?!N2(r)||e==t.length-1?Ba.test(String.fromCharCode(r))?1:0:Ba.test(t.slice(e,e+2))?2:0:0}function O2(t,e){if(!e)return 0;let r=t.charCodeAt(e-1);return r<192?M2(r)?1:0:Ba?!B2(r)||e==1?Ba.test(String.fromCharCode(r))?1:0:Ba.test(t.slice(e-2,e))?2:0:0}var L2=8;function p2(t,e,r){if(e==t.length||!O2(t,e))return e;for(let i=e,n=e+r,s=0;sn)return i;i+=a}return e}function m2(t,e,r){if(!e||!D2(t,e))return e;for(let i=e,n=e-r,s=0;st>=55296&&t<=56319,B2=t=>t>=56320&&t<=57343;function Fl(t,e){return!e||e==t.length||!N2(t.charCodeAt(e-1))||!B2(t.charCodeAt(e))}function e4(t,e,r){var i;let n=r==null?void 0:r.override;return n?n(t,e):(Hu=((i=r==null?void 0:r.scanLimit)!==null&&i!==void 0?i:1e9)>>1,Uu=r!=null&&r.timeout?Date.now()+r.timeout:0,Mw=!1,Q5(t,e,Ha(t,0,t.length,e,0,e.length)))}function H2(){return!Mw}function U2(t,e,r){return J5(e4(t,e,r),t,e)}var Pi=Fe.Facet.define({combine:t=>t[0]}),$w=Fe.StateEffect.define(),t4=Fe.Facet.define(),Tn=Fe.StateField.define({create(t){return null},update(t,e){for(let r of e.effects)r.is($w)&&(t=r.value);for(let r of e.state.facet(t4))t=r(t,e);return t}});function Lw(t){let e=t.field(Tn,!1);if(!e)return null;let r=t.facet(Pi);return{chunks:e,side:r?r.side:null}}var is=class t{constructor(e,r,i,n,s,a=!0){this.changes=e,this.fromA=r,this.toA=i,this.fromB=n,this.toB=s,this.precise=a}offset(e,r){return e||r?new t(this.changes,this.fromA+e,this.toA+e,this.fromB+r,this.toB+r,this.precise):this}get endA(){return Math.max(this.fromA,this.toA-1)}get endB(){return Math.max(this.fromB,this.toB-1)}static build(e,r,i){let n=U2(e.toString(),r.toString(),i);return G2(n,e,r,0,0,H2())}static updateA(e,r,i,n,s){return x2(y2(e,n,!0,i.length),e,r,i,s)}static updateB(e,r,i,n,s){return x2(y2(e,n,!1,r.length),e,r,i,s)}};function w2(t,e,r,i){let n=r.lineAt(t),s=i.lineAt(e);return n.to==t&&s.to==e&&tf+1&&v>d+1)break;h.push(p.offset(-c+i,-u+n)),[f,d]=b2(p.toA+i,p.toB+n,e,r),o++}a.push(new is(h,c,Math.max(c,f),u,Math.max(u,d),s))}return a}var Oh=1e3;function _2(t,e,r,i){let n=0,s=t.length;for(;;){if(n==s){let u=0,f=0;n&&({toA:u,toB:f}=t[n-1]);let d=e-(r?u:f);return[u+d,f+d]}let a=n+s>>1,o=t[a],[l,c]=r?[o.fromA,o.toA]:[o.fromB,o.toB];if(l>e)s=a;else if(c<=e)n=a+1;else return i?[o.fromA,o.fromB]:[o.toA,o.toB]}}function y2(t,e,r,i){let n=[];return e.iterChangedRanges((s,a,o,l)=>{let c=0,u=r?e.length:i,f=0,d=r?i:e.length;s>Oh&&([c,f]=_2(t,s-Oh,r,!0)),a=c?n[n.length-1]={fromA:p.fromA,fromB:p.fromB,toA:u,toB:d,diffA:p.diffA+g,diffB:p.diffB+v}:n.push({fromA:c,toA:u,fromB:f,toB:d,diffA:g,diffB:v})}),n}function x2(t,e,r,i,n){if(!t.length)return e;let s=[];for(let a=0,o=0,l=0,c=0;;a++){let u=a==t.length?null:t[a],f=u?u.fromA+o:r.length,d=u?u.fromB+l:i.length;for(;cf||v.toB+l>d))break;s.push(v.offset(o,l)),c++}if(!u)break;let h=u.toA+o+u.diffA,p=u.toB+l+u.diffB,g=U2(r.sliceString(f,h),i.sliceString(d,p),n);for(let v of G2(g,r,i,f,d,H2()))s.push(v);for(o+=u.diffA,l+=u.diffB;ch&&v.fromB+l>p)break;c++}}return s}var r4={scanLimit:500},j2=Oe.ViewPlugin.fromClass(class{constructor(t){({deco:this.deco,gutter:this.gutter}=k2(t))}update(t){(t.docChanged||t.viewportChanged||i4(t.startState,t.state)||n4(t.startState,t.state))&&({deco:this.deco,gutter:this.gutter}=k2(t.view))}},{decorations:t=>t.deco}),Lh=Fe.Prec.low((0,Oe.gutter)({class:"cm-changeGutter",markers:t=>{var e;return((e=t.plugin(j2))===null||e===void 0?void 0:e.gutter)||Fe.RangeSet.empty}}));function i4(t,e){return t.field(Tn,!1)!=e.field(Tn,!1)}function n4(t,e){return t.facet(Pi)!=e.facet(Pi)}var E2=Oe.Decoration.line({class:"cm-changedLine"}),s4=Oe.Decoration.mark({class:"cm-changedText"}),a4=Oe.Decoration.mark({tagName:"ins",class:"cm-insertedLine"}),o4=Oe.Decoration.mark({tagName:"del",class:"cm-deletedLine"}),S2=new class extends Oe.GutterMarker{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function l4(t,e,r,i,n,s){let a=r?t.fromA:t.fromB,o=r?t.toA:t.toB,l=0;if(a!=o){n.add(a,a,E2),n.add(a,o,r?o4:a4),s&&s.add(a,a,S2);for(let c=e.iterRange(a,o-1),u=a;!c.next().done;){if(c.lineBreak){u++,n.add(u,u,E2),s&&s.add(u,u,S2);continue}let f=u+c.value.length;if(i)for(;l=u)break;(a?f.toA:f.toB)>c&&(!s||!s(t.state,f,o,l))&&l4(f,t.state.doc,a,i,o,l)}return{deco:o.finish(),gutter:l&&l.finish()}}var $l=class extends Oe.WidgetType{constructor(e){super(),this.height=e}eq(e){return this.height==e.height}toDOM(){let e=document.createElement("div");return e.className="cm-mergeSpacer",e.style.height=this.height+"px",e}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}},Uh=Fe.StateEffect.define({map:(t,e)=>t.map(e)}),Gu=Fe.StateField.define({create:()=>Oe.Decoration.none,update:(t,e)=>{for(let r of e.effects)if(r.is(Uh))return r.value;return t.map(e.changes)},provide:t=>Oe.EditorView.decorations.from(t)}),Nh=.01;function C2(t,e){if(t.size!=e.size)return!1;let r=t.iter(),i=e.iter();for(;r.value;){if(r.from!=i.from||Math.abs(r.value.spec.widget.height-i.value.spec.widget.height)>1)return!1;r.next(),i.next()}return!0}function c4(t,e,r){let i=new Fe.RangeSetBuilder,n=new Fe.RangeSetBuilder,s=t.state.field(Gu).iter(),a=e.state.field(Gu).iter(),o=0,l=0,c=0,u=0,f=t.viewport,d=e.viewport;for(let v=0;;v++){let b=vNh&&(u+=A,n.add(l,l,Oe.Decoration.widget({widget:new $l(A),block:!0,side:-1})))}if(_>o+1e3&&of.from&&ld.from){let x=Math.min(f.from-o,d.from-l);o+=x,l+=x,v--}else if(b)o=b.toA,l=b.toB;else break;for(;s.value&&s.fromNh&&n.add(e.state.doc.length,e.state.doc.length,Oe.Decoration.widget({widget:new $l(h),block:!0,side:1}));let p=i.finish(),g=n.finish();C2(p,t.state.field(Gu))||t.dispatch({effects:Uh.of(p)}),C2(g,e.state.field(Gu))||e.dispatch({effects:Uh.of(g)})}var Fw=Fe.StateEffect.define({map:(t,e)=>e.mapPos(t)});var Iw=class extends Oe.WidgetType{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let r=document.createElement("div");return r.className="cm-collapsedLines",r.textContent=e.state.phrase("$ unchanged lines",this.lines),r.addEventListener("click",i=>{let n=e.posAtDOM(i.target);e.dispatch({effects:Fw.of(n)});let{side:s,sibling:a}=e.state.facet(Pi);a&&a().dispatch({effects:Fw.of(u4(n,e.state.field(Tn),s=="a"))})}),r}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}};function u4(t,e,r){let i=0,n=0;for(let s=0;;s++){let a=s=t)return n+(t-i);[i,n]=r?[a.toA,a.toB]:[a.toB,a.toA]}}var f4=Fe.StateField.define({create(t){return Oe.Decoration.none},update(t,e){t=t.map(e.changes);for(let r of e.effects)r.is(Fw)&&(t=t.update({filter:i=>i!=r.value}));if(t.size&&e.state.field(Tn)!=e.startState.field(Tn,!1)){let r=e.state.facet(Pi).side=="a",i=[];for(let n of e.state.field(Tn))t.between(r?n.fromA:n.fromB,r?n.toA:n.toB,s=>{i.push(s)});i.length&&(t=t.update({filter:n=>i.indexOf(n)<0}))}return t},provide:t=>Oe.EditorView.decorations.from(t)});function A2({margin:t=3,minSize:e=4}){return f4.init(r=>d4(r,t,e))}function d4(t,e,r){let i=new Fe.RangeSetBuilder,n=t.facet(Pi).side=="a",s=t.field(Tn),a=1;for(let o=0;;o++){let l=o=r&&i.add(t.doc.line(c).from,t.doc.line(u).to,Oe.Decoration.replace({widget:new Iw(f),block:!0})),!l)break;a=t.doc.lineAt(Math.min(t.doc.length,n?l.toA:l.toB)).number}return i.finish()}var h4=Oe.EditorView.styleModule.of(new Dh({".cm-mergeView":{overflowY:"auto"},".cm-mergeViewEditors":{display:"flex",alignItems:"stretch"},".cm-mergeViewEditor":{flexGrow:1,flexBasis:0,overflow:"hidden"},".cm-merge-revert":{width:"1.6em",flexGrow:0,flexShrink:0,position:"relative"},".cm-merge-revert button":{position:"absolute",display:"block",width:"100%",boxSizing:"border-box",textAlign:"center",background:"none",border:"none",font:"inherit",cursor:"pointer"}})),p4=Oe.EditorView.baseTheme({".cm-mergeView & .cm-scroller, .cm-mergeView &":{height:"auto !important",overflowY:"visible !important"},"&.cm-merge-a .cm-changedLine, .cm-deletedChunk":{backgroundColor:"rgba(160, 128, 100, .08)"},"&.cm-merge-b .cm-changedLine, .cm-inlineChangedLine":{backgroundColor:"rgba(100, 160, 128, .08)"},"&light.cm-merge-a .cm-changedText, &light .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ee443366, #ee443366) bottom/100% 2px no-repeat"},"&dark.cm-merge-a .cm-changedText, &dark .cm-deletedChunk .cm-deletedText":{background:"linear-gradient(#ffaa9966, #ffaa9966) bottom/100% 2px no-repeat"},"&light.cm-merge-b .cm-changedText":{background:"linear-gradient(#22bb22aa, #22bb22aa) bottom/100% 2px no-repeat"},"&dark.cm-merge-b .cm-changedText":{background:"linear-gradient(#88ff88aa, #88ff88aa) bottom/100% 2px no-repeat"},"&.cm-merge-b .cm-deletedText":{background:"#ff000033"},".cm-insertedLine, .cm-deletedLine, .cm-deletedLine del":{textDecoration:"none"},".cm-deletedChunk":{paddingLeft:"6px","& .cm-chunkButtons":{position:"absolute",insetInlineEnd:"5px"},"& button":{border:"none",cursor:"pointer",color:"white",margin:"0 2px",borderRadius:"3px","&[name=accept]":{background:"#2a2"},"&[name=reject]":{background:"#d43"}}},".cm-collapsedLines":{padding:"5px 5px 5px 10px",cursor:"pointer","&:before":{content:'"\u299A"',marginInlineEnd:"7px"},"&:after":{content:'"\u299A"',marginInlineStart:"7px"}},"&light .cm-collapsedLines":{color:"#444",background:"linear-gradient(to bottom, transparent 0, #f3f3f3 30%, #f3f3f3 70%, transparent 100%)"},"&dark .cm-collapsedLines":{color:"#ddd",background:"linear-gradient(to bottom, transparent 0, #222 30%, #222 70%, transparent 100%)"},".cm-changeGutter":{width:"3px",paddingLeft:"1px"},"&light.cm-merge-a .cm-changedLineGutter, &light .cm-deletedLineGutter":{background:"#e43"},"&dark.cm-merge-a .cm-changedLineGutter, &dark .cm-deletedLineGutter":{background:"#fa9"},"&light.cm-merge-b .cm-changedLineGutter":{background:"#2b2"},"&dark.cm-merge-b .cm-changedLineGutter":{background:"#8f8"},".cm-inlineChangedLineGutter":{background:"#75d"}}),T2=new Fe.Compartment,Bh=new Fe.Compartment,Gh=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||r4;let r=[Fe.Prec.low(j2),p4,h4,Gu,Oe.EditorView.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(d=>d.effects.some(h=>h.is(Uh)))&&this.measure()})],i=[Pi.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&i.push(Lh);let n=Fe.EditorState.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Oe.EditorView.editorAttributes.of({class:"cm-merge-a"}),Bh.of(i),r]}),s=[Pi.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(Lh);let a=Fe.EditorState.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Oe.EditorView.editorAttributes.of({class:"cm-merge-b"}),Bh.of(s),r]});this.chunks=is.build(n.doc,a.doc,this.diffConf);let o=[Tn.init(()=>this.chunks),T2.of(e.collapseUnchanged?A2(e.collapseUnchanged):[])];n=n.update({effects:Fe.StateEffect.appendConfig.of(o)}).state,a=a.update({effects:Fe.StateEffect.appendConfig.of(o)}).state,this.dom=document.createElement("div"),this.dom.className="cm-mergeView",this.editorDOM=this.dom.appendChild(document.createElement("div")),this.editorDOM.className="cm-mergeViewEditors";let l=e.orientation||"a-b",c=document.createElement("div");c.className="cm-mergeViewEditor";let u=document.createElement("div");u.className="cm-mergeViewEditor",this.editorDOM.appendChild(l=="a-b"?c:u),this.editorDOM.appendChild(l=="a-b"?u:c),this.a=new Oe.EditorView({state:n,parent:c,root:e.root,dispatchTransactions:f=>this.dispatch(f,this.a)}),this.b=new Oe.EditorView({state:a,parent:u,root:e.root,dispatchTransactions:f=>this.dispatch(f,this.b)}),this.setupRevertControls(!!e.revertControls,e.revertControls=="b-to-a",e.renderRevertControl),e.parent&&e.parent.appendChild(this.dom),this.scheduleMeasure()}dispatch(e,r){if(e.some(i=>i.docChanged)){let i=e[e.length-1],n=e.reduce((a,o)=>a.compose(o.changes),Fe.ChangeSet.empty(e[0].startState.doc.length));this.chunks=r==this.a?is.updateA(this.chunks,i.newDoc,this.b.state.doc,n,this.diffConf):is.updateB(this.chunks,this.a.state.doc,i.newDoc,n,this.diffConf),r.update([...e,i.state.update({effects:$w.of(this.chunks)})]);let s=r==this.a?this.b:this.a;s.update([s.state.update({effects:$w.of(this.chunks)})]),this.scheduleMeasure()}else r.update(e)}reconfigure(e){if("diffConfig"in e&&(this.diffConf=e.diffConfig),"orientation"in e){let s=e.orientation!="b-a";if(s!=(this.editorDOM.firstChild==this.a.dom.parentNode)){let a=this.a.dom.parentNode,o=this.b.dom.parentNode;a.remove(),o.remove(),this.editorDOM.insertBefore(s?a:o,this.editorDOM.firstChild),this.editorDOM.appendChild(s?o:a),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let s=!!this.revertDOM,a=this.revertToA,o=this.renderRevert;"revertControls"in e&&(s=!!e.revertControls,a=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(o=e.renderRevertControl),this.setupRevertControls(s,a,o)}let r="highlightChanges"in e,i="gutter"in e,n="collapseUnchanged"in e;if(r||i||n){let s=[],a=[];if(r||i){let o=this.a.state.facet(Pi),l=i?e.gutter!==!1:o.markGutter,c=r?e.highlightChanges!==!1:o.highlightChanges;s.push(Bh.reconfigure([Pi.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:l}),l?Lh:[]])),a.push(Bh.reconfigure([Pi.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:l}),l?Lh:[]]))}if(n){let o=T2.reconfigure(e.collapseUnchanged?A2(e.collapseUnchanged):[]);s.push(o),a.push(o)}this.a.dispatch({effects:s}),this.b.dispatch({effects:a})}this.scheduleMeasure()}setupRevertControls(e,r,i){this.revertToA=r,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=i,!e&&this.revertDOM?(this.revertDOM.remove(),this.revertDOM=null):e&&!this.revertDOM?(this.revertDOM=this.editorDOM.insertBefore(document.createElement("div"),this.editorDOM.firstChild.nextSibling),this.revertDOM.addEventListener("mousedown",n=>this.revertClicked(n)),this.revertDOM.className="cm-merge-revert"):this.revertDOM&&(this.revertDOM.textContent="")}scheduleMeasure(){if(this.measuring<0){let e=this.dom.ownerDocument.defaultView||window;this.measuring=e.requestAnimationFrame(()=>{this.measuring=-1,this.measure()})}}measure(){c4(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,r=e.firstChild,i=this.a.viewport,n=this.b.viewport;for(let s=0;si.to||a.fromB>n.to)break;if(a.fromA-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function P2(t){let e=t.nextSibling;return t.remove(),e}var Nw=require("@codemirror/state");function jh(t,e){let r=t.lineAt(e);return!(r.text.length==0&&r.number==t.lines)?r.number:r.number-1}function Bw(t,e,r){let i=[],n=t.split(` `),s=e.split(` `);for(let a of r){let{oldStart:o,oldLines:l,newStart:c,newLines:u}=a,f=qt.createHunk(o,l,c,u);if(a.oldLines>0){for(let d=o;dn.length&&n.last()!=""&&(f.removed.no_nl_at_eof=!0)}if(a.newLines>0){for(let d=c;ds.length&&s.last()!=""&&(f.added.no_nl_at_eof=!0)}i.push(f)}return i}function Hw(t,e,r){let i=e.lineAt(t.fromA).number,n=t.fromA==t.toA?0:jh(e,t.endA)-i+1,s=r.lineAt(t.fromB).number,a=t.fromB==t.toB?0:jh(r,t.endB)-s+1,o={oldStart:i,oldLines:n,newStart:s,newLines:a};return o.oldLines==0&&(o.oldStart-=1),o.newLines==0&&(o.newStart-=1),o}var V2={scanLimit:1e3,timeout:200};function m4(t,e,r,i){let n=Nw.Text.of(t.split(` `)),s=Nw.Text.of(e.split(` `)),a=r&&i?is.updateB(r,n,s,i,V2):is.build(n,s,V2),o=[];for(let l=0;lh.vend&&(f=f-(h.added.count-h.removed.count)),o>h.vend&&(d=d-(h.added.count-h.removed.count));c.added.lines=u.compareText.split(` `).slice(f-1,d),u.compareTextHead?c.removed.lines=u.compareTextHead.split(` `).slice(c.removed.start-1,c.removed.start-1+c.removed.count):c.removed.lines=[]}else c.added.lines=e.doc.toString().split(` `).slice(a-1,o),o===e.doc.lines&&!e.doc.toString().endsWith(` `)&&(c.added.no_nl_at_eof=!0),c.removed.lines=u.compareText.split(` `).slice(c.removed.start-1,c.removed.start-1+c.removed.count),c.removed.start+c.removed.count-1===u.compareText.split(` `).length&&!u.compareText.endsWith(` `)&&(c.removed.no_nl_at_eof=!0);return c}},Wr=Il.StateField.define({create:t=>{},update:(t,e)=>{var n,s,a;let r=t?{...t}:{maxDiffTimeMs:0,hunks:[],stagedHunks:[],chunks:void 0,isDirty:!1},i=!1;for(let o of e.effects)if(o.is(Ml)&&(r.compareText=o.value.compareText,r.compareTextHead=o.value.compareTextHead,i=(t==null?void 0:t.compareText)!==o.value.compareText,i&&(r.chunks=void 0,r.changeDesc=void 0)),o.is(Vh)){let l=(n=e.startState.field(ju,!1))==null?void 0:n.revision;if(o.value.revision!==l)continue;W2(r,o.value.result,e.state),r.changeDesc=void 0}if(e.docChanged){let o=!r.changeDesc||r.changeDesc.newLength===e.changes.length;console.assert(o,"Git: Hunk changes belong to different document histories."),o||(r.chunks=void 0),r.changeDesc=g4(r.changeDesc,e.changes)}if(r.compareText!==void 0){if(i||e.docChanged){r.isDirty=!0;let o=v4(e,r.compareText,r.chunks,r.changeDesc,r.maxDiffTimeMs);o&&(W2(r,o,e.state),r.changeDesc=void 0)}}else{r.compareText=void 0,r.compareTextHead=void 0,r.chunks=void 0,r.hunks=[],r.stagedHunks=[],r.isDirty=!1;let o=e.state.field(ns.editorInfoField).file;(a=(s=Et.plugin)==null?void 0:s.editorIntegration.signsFeature.changeStatusBar)==null||a.display(r.hunks,o)}return r}});function W2(t,e,r){var n,s;t.hunks=e.hunks,t.chunks=e.chunks,t.isDirty=!1,t.maxDiffTimeMs=Math.max(.95*t.maxDiffTimeMs,e.diffDuration);let i=r.field(ns.editorInfoField).file;(s=(n=Et.plugin)==null?void 0:n.editorIntegration.signsFeature.changeStatusBar)==null||s.display(t.hunks,i)}var ju=Il.StateField.define({create:t=>{var e,r;return{debouncer:(0,ns.debounce)(i=>{let{state:n,compareText:s,previousChunks:a,changeDesc:o,revision:l}=i,c=n.field(ns.editorEditorField,!1);if(!c)return;let u=c.state.field(ju,!1);if((u==null?void 0:u.revision)!==l)return;let f=q2(n,s,a,o);c.dispatch({effects:Vh.of({result:f,revision:l})})},1e3,!0),revision:{},filePath:(r=(e=t.field(ns.editorInfoField,!1))==null?void 0:e.file)==null?void 0:r.path}},update:(t,e)=>{var i,n;let r=(n=(i=e.state.field(ns.editorInfoField,!1))==null?void 0:i.file)==null?void 0:n.path;return e.docChanged||r!==t.filePath?{...t,revision:{},filePath:r}:t}});function g4(t,e){return!t||t.newLength!==e.length?e:t.composeDesc(e)}function q2(t,e,r,i){let n=t.doc.toString(),s=performance.now(),{hunks:a,chunks:o}=z2(e,n,r,i),l=performance.now()-s;return{hunks:a,chunks:o,diffDuration:l}}function v4(t,e,r,i,n){let s=t.state,a=Math.abs(t.changes.length-t.changes.newLength),o=s.field(ju);if(a>1e3||n>16){o.debouncer({state:s,compareText:e,previousChunks:r,changeDesc:i,revision:o.revision});return}else return q2(s,e,r,i)}var Ml=Il.StateEffect.define(),Vh=Il.StateEffect.define();function Y2(t,e){return e.update({effects:Ml.of(t)})}m();m();m();var ut;(function(t){t.INSERT="insert",t.DELETE="delete",t.CONTEXT="context"})(ut||(ut={}));var Z2={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},K2={LINES:"lines",WORDS:"words",NONE:"none"},X2={WORD:"word",CHAR:"char"},Ua;(function(t){t.AUTO="auto",t.DARK="dark",t.LIGHT="light"})(Ua||(Ua={}));m();var w4=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],b4=RegExp("["+w4.join("\\")+"]","g");function Q2(t){return t.replace(b4,"\\$&")}function Uw(t){return t&&t.replace(/\\/g,"/")}function J2(t){let e,r,i,n=0;for(e=0,i=t.length;e1?r[r.length-1]:e}function tP(t,e){return e.reduce((r,i)=>r||t.startsWith(i),!1)}var rP=["a/","b/","i/","w/","c/","o/"];function qs(t,e,r){let i=r!==void 0?[...rP,r]:rP,n=e?new RegExp(`^${Q2(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,s=""]=n.exec(t)||[],a=i.find(l=>s.indexOf(l)===0);return(a?s.slice(a.length):s).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function _4(t,e){return qs(t,"---",e)}function y4(t,e){return qs(t,"+++",e)}function iP(t,e={}){let r=[],i=null,n=null,s=null,a=null,o=null,l=null,c=null,u="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,p=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,v=/^new file mode (\d{6})/,b=/^copy from "?(.+)"?/,_=/^copy to "?(.+)"?/,C=/^rename from "?(.+)"?/,x=/^rename to "?(.+)"?/,E=/^similarity index (\d+)%/,A=/^dissimilarity index (\d+)%/,w=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,S=/^Binary files (.*) and (.*) differ/,y=/^GIT binary patch/,P=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,T=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,I=/^new file mode (\d{6})/,M=/^deleted file mode (\d{6}),(\d{6})/,B=t.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,` `).split(` `);function re(){n!==null&&i!==null&&(i.blocks.push(n),n=null)}function Ae(){i!==null&&(!i.oldName&&l!==null&&(i.oldName=l),!i.newName&&c!==null&&(i.newName=c),i.newName&&(r.push(i),i=null)),l=null,c=null}function K(){re(),Ae(),i={blocks:[],deletedLines:0,addedLines:0}}function Q(z){re();let X;i!==null&&((X=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(z))?(i.isCombined=!1,s=parseInt(X[1],10),o=parseInt(X[2],10)):(X=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(z))?(i.isCombined=!0,s=parseInt(X[1],10),a=parseInt(X[2],10),o=parseInt(X[3],10)):(z.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),s=0,o=0,i.isCombined=!1)),n={lines:[],oldStartLine:s,oldStartLine2:a,newStartLine:o,header:z}}function fe(z){if(i===null||n===null||s===null||o===null)return;let X={content:z},j=i.isCombined?["+ "," +","++"]:["+"],Ze=i.isCombined?["- "," -","--"]:["-"];tP(z,j)?(i.addedLines++,X.type=ut.INSERT,X.oldNumber=void 0,X.newNumber=o++):tP(z,Ze)?(i.deletedLines++,X.type=ut.DELETE,X.oldNumber=s++,X.newNumber=void 0):(X.type=ut.CONTEXT,X.oldNumber=s++,X.newNumber=o++),n.lines.push(X)}function ce(z,X){let j=X;for(;j{if(!z||z.startsWith("*"))return;let j,Ze=B[X-1],$r=B[X+1],cr=B[X+2];if(z.startsWith("diff --git")||z.startsWith("diff --combined")){if(K(),(j=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(z))&&(l=qs(j[1],void 0,e.dstPrefix),c=qs(j[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isGitDiff=!0;return}if(z.startsWith("Binary files")&&!(i!=null&&i.isGitDiff)){if(K(),(j=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(z))&&(l=qs(j[1],void 0,e.dstPrefix),c=qs(j[2],void 0,e.srcPrefix)),i===null)throw new Error("Where is my file !!!");i.isBinary=!0;return}if((!i||!i.isGitDiff&&i&&z.startsWith(u)&&$r.startsWith(f)&&cr.startsWith(d))&&K(),i!=null&&i.isTooBig)return;if(i&&(typeof e.diffMaxChanges=="number"&&i.addedLines+i.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&z.length>e.diffMaxLineLength)){i.isTooBig=!0,i.addedLines=0,i.deletedLines=0,i.blocks=[],n=null;let yt=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(r.length):"Diff too big to be displayed";Q(yt);return}if(z.startsWith(u)&&$r.startsWith(f)||z.startsWith(f)&&Ze.startsWith(u)){if(i&&!i.oldName&&z.startsWith("--- ")&&(j=_4(z,e.srcPrefix))){i.oldName=j,i.language=eP(i.oldName,i.language);return}if(i&&!i.newName&&z.startsWith("+++ ")&&(j=y4(z,e.dstPrefix))){i.newName=j,i.language=eP(i.newName,i.language);return}}if(i&&(z.startsWith(d)||i.isGitDiff&&i.oldName&&i.newName&&!n)){Q(z);return}if(n&&(z.startsWith("+")||z.startsWith("-")||z.startsWith(" "))){fe(z);return}let Ie=!ce(z,X);if(i===null)throw new Error("Where is my file !!!");(j=h.exec(z))?i.oldMode=j[1]:(j=p.exec(z))?i.newMode=j[1]:(j=g.exec(z))?(i.deletedFileMode=j[1],i.isDeleted=!0):(j=v.exec(z))?(i.newFileMode=j[1],i.isNew=!0):(j=b.exec(z))?(Ie&&(i.oldName=j[1]),i.isCopy=!0):(j=_.exec(z))?(Ie&&(i.newName=j[1]),i.isCopy=!0):(j=C.exec(z))?(Ie&&(i.oldName=j[1]),i.isRename=!0):(j=x.exec(z))?(Ie&&(i.newName=j[1]),i.isRename=!0):(j=S.exec(z))?(i.isBinary=!0,i.oldName=qs(j[1],void 0,e.srcPrefix),i.newName=qs(j[2],void 0,e.dstPrefix),Q("Binary file")):y.test(z)?(i.isBinary=!0,Q(z)):(j=E.exec(z))?i.unchangedPercentage=parseInt(j[1],10):(j=A.exec(z))?i.changedPercentage=parseInt(j[1],10):(j=w.exec(z))?(i.checksumBefore=j[1],i.checksumAfter=j[2],j[3]&&(i.mode=j[3])):(j=P.exec(z))?(i.checksumBefore=[j[2],j[3]],i.checksumAfter=j[1]):(j=T.exec(z))?(i.oldMode=[j[2],j[3]],i.newMode=j[1]):(j=I.exec(z))?(i.newFileMode=j[1],i.isNew=!0):(j=M.exec(z))&&(i.deletedFileMode=j[1],i.isDeleted=!0)}),re(),Ae(),r}m();m();m();m();var Ys=class{diff(e,r,i={}){let n;typeof i=="function"?(n=i,i={}):"callback"in i&&(n=i.callback);let s=this.castInput(e,i),a=this.castInput(r,i),o=this.removeEmpty(this.tokenize(s,i)),l=this.removeEmpty(this.tokenize(a,i));return this.diffWithOptionsObj(o,l,i,n)}diffWithOptionsObj(e,r,i,n){var s;let a=_=>{if(_=this.postProcess(_,i),n){setTimeout(function(){n(_)},0);return}else return _},o=r.length,l=e.length,c=1,u=o+l;i.maxEditLength!=null&&(u=Math.min(u,i.maxEditLength));let f=(s=i.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],r,e,0,i);if(h[0].oldPos+1>=l&&p+1>=o)return a(this.buildValues(h[0].lastComponent,r,e));let g=-1/0,v=1/0,b=()=>{for(let _=Math.max(g,-c);_<=Math.min(v,c);_+=2){let C,x=h[_-1],E=h[_+1];x&&(h[_-1]=void 0);let A=!1;if(E){let S=E.oldPos-_;A=E&&0<=S&&S=l&&p+1>=o)return a(this.buildValues(C.lastComponent,r,e))||!0;h[_]=C,C.oldPos+1>=l&&(v=Math.min(v,_-1)),p+1>=o&&(g=Math.max(g,_+1))}c++};if(n)(function _(){setTimeout(function(){if(c>u||Date.now()>d)return n(void 0);b()||_()},0)})();else for(;c<=u&&Date.now()<=d;){let _=b();if(_)return _}}addToPath(e,r,i,n,s){let a=e.lastComponent;return a&&!s.oneChangePerToken&&a.added===r&&a.removed===i?{oldPos:e.oldPos+n,lastComponent:{count:a.count+1,added:r,removed:i,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+n,lastComponent:{count:1,added:r,removed:i,previousComponent:a}}}extractCommon(e,r,i,n,s){let a=r.length,o=i.length,l=e.oldPos,c=l-n,u=0;for(;c+1d.length?p:d}),u.value=this.join(f)}else u.value=this.join(r.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return n}};m();var Gw=class extends Ys{},nP=new Gw;function jw(t,e,r){return nP.diff(t,e,r)}m();m();function Vw(t,e){let r;for(r=0;re.length&&(r=t.length-e.length);let i=e.length;t.length0&&e[a]!=e[s];)s=n[s];e[a]==e[s]&&s++}s=0;for(let a=r;a0&&t[a]!=e[s];)s=n[s];t[a]==e[s]&&s++}return s}function qw(t,e){let r=[];for(let i of Array.from(e.segment(t))){let n=i.segment;r.length&&/\s/.test(r[r.length-1])&&/\s/.test(n)?r[r.length-1]+=n:r.push(n)}return r}function Yh(t,e){if(e)return Ol(t,e)[1];let r;for(r=t.length-1;r>=0&&t[r].match(/\s/);r--);return t.substring(r+1)}function Ga(t,e){if(e)return Ol(t,e)[0];let r=t.match(/^\s*/);return r?r[0]:""}function Ol(t,e){if(!e)return[Ga(t),Yh(t)];if(e.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');let r=qw(t,e),i=r[0],n=r[r.length-1],s=/\s/.test(i)?i:"",a=/\s/.test(n)?n:"";return[s,a]}var Zh="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",S4=new RegExp(`[${Zh}]+|\\s+|[^${Zh}]`,"ug"),Yw=class extends Ys{equals(e,r,i){return i.ignoreCase&&(e=e.toLowerCase(),r=r.toLowerCase()),e.trim()===r.trim()}tokenize(e,r={}){let i;if(r.intlSegmenter){let a=r.intlSegmenter;if(a.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');i=qw(e,a)}else i=e.match(S4)||[];let n=[],s=null;return i.forEach(a=>{/\s/.test(a)?s==null?n.push(a):n.push(n.pop()+a):s!=null&&/\s/.test(s)?n[n.length-1]==s?n.push(n.pop()+a):n.push(s+a):n.push(a),s=a}),n}join(e){return e.map((r,i)=>i==0?r:r.replace(/^\s+/,"")).join("")}postProcess(e,r){if(!e||r.oneChangePerToken)return e;let i=null,n=null,s=null;return e.forEach(a=>{a.added?n=a:a.removed?s=a:((n||s)&&sP(i,s,n,a,r.intlSegmenter),i=a,n=null,s=null)}),(n||s)&&sP(i,s,n,null,r.intlSegmenter),e}},k4=new Yw;function sP(t,e,r,i,n){if(e&&r){let[s,a]=Ol(e.value,n),[o,l]=Ol(r.value,n);if(t){let c=Vw(s,o);t.value=qh(t.value,o,c),e.value=Dl(e.value,c),r.value=Dl(r.value,c)}if(i){let c=zw(a,l);i.value=Wh(i.value,l,c),e.value=Vu(e.value,c),r.value=Vu(r.value,c)}}else if(r){if(t){let s=Ga(r.value,n);r.value=r.value.substring(s.length)}if(i){let s=Ga(i.value,n);i.value=i.value.substring(s.length)}}else if(t&&i){let s=Ga(i.value,n),[a,o]=Ol(e.value,n),l=Vw(s,a);e.value=Dl(e.value,l);let c=zw(Dl(s,l),o);e.value=Vu(e.value,c),i.value=Wh(i.value,s,c),t.value=qh(t.value,s,s.slice(0,s.length-c.length))}else if(i){let s=Ga(i.value,n),a=Yh(e.value,n),o=Ww(a,s);e.value=Vu(e.value,o)}else if(t){let s=Yh(t.value,n),a=Ga(e.value,n),o=Ww(s,a);e.value=Dl(e.value,o)}}var Zw=class extends Ys{tokenize(e){let r=new RegExp(`(\\r?\\n)|[${Zh}]+|[^\\S\\n\\r]+|[^${Zh}]`,"ug");return e.match(r)||[]}},aP=new Zw;function Kw(t,e,r){return aP.diff(t,e,r)}m();function A4(t,e){if(t.length===0)return e.length;if(e.length===0)return t.length;let r=[],i;for(i=0;i<=e.length;i++)r[i]=[i];let n;for(n=0;n<=t.length;n++)r[0][n]=n;for(i=1;i<=e.length;i++)for(n=1;n<=t.length;n++)e.charAt(i-1)===t.charAt(n-1)?r[i][n]=r[i-1][n-1]:r[i][n]=Math.min(r[i-1][n-1]+1,Math.min(r[i][n-1]+1,r[i-1][n]+1));return r[e.length][t.length]}function Ll(t){return(e,r)=>{let i=t(e).trim(),n=t(r).trim();return A4(i,n)/(i.length+n.length)}}function Nl(t){function e(i,n,s=new Map){let a=1/0,o;for(let l=0;l0||o.indexB>0)&&(C=v.concat(C)),(i.length>d||n.length>h)&&(C=C.concat(_)),C}return r}var tr={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},ja={matching:K2.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:X2.WORD,colorScheme:Ua.LIGHT},Pn="/",oP=Ll(t=>t.value),T4=Nl(oP);function Qw(t){return t.indexOf("dev/null")!==-1}function P4(t){return t.replace(/(]*>((.|\n)*?)<\/ins>)/g,"")}function R4(t){return t.replace(/(]*>((.|\n)*?)<\/del>)/g,"")}function Bl(t){switch(t){case ut.CONTEXT:return tr.CONTEXT;case ut.INSERT:return tr.INSERTS;case ut.DELETE:return tr.DELETES}}function Hl(t){switch(t){case Ua.DARK:return"d2h-dark-color-scheme";case Ua.AUTO:return"d2h-auto-color-scheme";case Ua.LIGHT:default:return"d2h-light-color-scheme"}}function $4(t){return t?2:1}function Zs(t){return t.slice(0).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function Ri(t,e,r=!0){let i=$4(e);return{prefix:t.substring(0,i),content:r?Zs(t.substring(i)):t.substring(i)}}function Va(t){let e=Uw(t.oldName),r=Uw(t.newName);if(e!==r&&!Qw(e)&&!Qw(r)){let i=[],n=[],s=e.split(Pn),a=r.split(Pn),o=s.length,l=a.length,c=0,u=o-1,f=l-1;for(;cc&&f>c&&s[u]===a[f];)n.unshift(a[f]),u-=1,f-=1;let d=i.join(Pn),h=n.join(Pn),p=s.slice(c,u+1).join(Pn),g=a.slice(c,f+1).join(Pn);return d.length&&h.length?d+Pn+"{"+p+" \u2192 "+g+"}"+Pn+h:d.length?d+Pn+"{"+p+" \u2192 "+g+"}":h.length?"{"+p+" \u2192 "+g+"}"+Pn+h:e+" \u2192 "+r}else return Qw(r)?e:r}function Ul(t){return`d2h-${J2(Va(t)).toString().slice(-6)}`}function Gl(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 Kh(t,e,r,i={}){let{matching:n,maxLineLengthHighlight:s,matchWordsThreshold:a,diffStyle:o}=Object.assign(Object.assign({},ja),i),l=Ri(t,r,!1),c=Ri(e,r,!1);if(l.content.length>s||c.content.length>s)return{oldLine:{prefix:l.prefix,content:Zs(l.content)},newLine:{prefix:c.prefix,content:Zs(c.content)}};let u=o==="char"?jw(l.content,c.content):Kw(l.content,c.content),f=[];if(o==="word"&&n==="words"){let h=u.filter(v=>v.removed),p=u.filter(v=>v.added);T4(p,h).forEach(v=>{v[0].length===1&&v[1].length===1&&oP(v[0][0],v[1][0]){let g=p.added?"ins":p.removed?"del":null,v=f.indexOf(p)>-1?' class="d2h-change"':"",b=Zs(p.value);return g!==null?`${h}<${g}${v}>${b}`:`${h}${b}`},"");return{oldLine:{prefix:l.prefix,content:P4(d)},newLine:{prefix:c.prefix,content:R4(d)}}}var lP="file-summary",F4="icon",I4={colorScheme:ja.colorScheme},Xh=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},I4),r)}render(e){let r=e.map(i=>this.hoganUtils.render(lP,"line",{fileHtmlId:Ul(i),oldName:i.oldName,newName:i.newName,fileName:Va(i),deletedLines:"-"+i.deletedLines,addedLines:"+"+i.addedLines},{fileIcon:this.hoganUtils.template(F4,Gl(i))})).join(` `);return this.hoganUtils.render(lP,"wrapper",{colorScheme:Hl(this.config.colorScheme),filesNumber:e.length,files:r})}};m();var e0=Object.assign(Object.assign({},ja),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),zu="generic",cP="line-by-line",M4="icon",D4="tag",Wu=class{constructor(e,r={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},e0),r)}render(e){let r=e.map(i=>{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(` `);return this.hoganUtils.render(zu,"wrapper",{colorScheme:Hl(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(cP,"file-diff"),n=this.hoganUtils.template(zu,"file-path"),s=this.hoganUtils.template(M4,"file"),a=this.hoganUtils.template(D4,Gl(e));return i.render({file:e,fileHtmlId:Ul(e),diffs:r,filePath:n.render({fileDiffName:Va(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return this.hoganUtils.render(zu,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:tr})}generateFileHtml(e){let r=Nl(Ll(i=>Ri(i.content,e.isCombined).content));return e.blocks.map(i=>{let n=this.hoganUtils.render(zu,"block-header",{CSSLineClass:tr,blockHeader:e.isTooBig?i.header:Zs(i.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);n+=u,n+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=Ri(l.content,e.isCombined);n+=this.generateSingleLineHtml(e,{type:tr.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,a,o);n+=l,n+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).join(` `)}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s0)&&(r.push([[],i,n]),i=[],n=[]),a.type===ut.CONTEXT?r.push([[a],[],[]]):a.type===ut.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===ut.INSERT&&i.length>0?n.push(a):a.type===ut.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=zh(e.concat(r).map(o=>o.content.length));return n{let n;return i.blocks.length?n=this.generateFileHtml(i):n=this.generateEmptyDiff(),this.makeFileDiffHtml(i,n)}).join(` `);return this.hoganUtils.render(qu,"wrapper",{colorScheme:Hl(this.config.colorScheme),content:r})}makeFileDiffHtml(e,r){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let i=this.hoganUtils.template(O4,"file-diff"),n=this.hoganUtils.template(qu,"file-path"),s=this.hoganUtils.template(L4,"file"),a=this.hoganUtils.template(N4,Gl(e));return i.render({file:e,fileHtmlId:Ul(e),diffs:r,filePath:n.render({fileDiffName:Va(e)},{fileIcon:s,fileTag:a})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(qu,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:tr})}}generateFileHtml(e){let r=Nl(Ll(i=>Ri(i.content,e.isCombined).content));return e.blocks.map(i=>{let n={left:this.makeHeaderHtml(i.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(i).forEach(([s,a,o])=>{if(a.length&&o.length&&!s.length)this.applyRematchMatching(a,o,r).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);n.left+=u,n.right+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=Ri(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:tr.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:tr.CONTEXT,prefix:c,content:u,number:l.newNumber});n.left+=f,n.right+=d});else if(a.length||o.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,a,o);n.left+=l,n.right+=c}else console.error("Unknown state reached while processing groups of lines",s,a,o)}),n}).reduce((i,n)=>({left:i.left+n.left,right:i.right+n.right}),{left:"",right:""})}applyLineGroupping(e){let r=[],i=[],n=[];for(let s=0;s0)&&(r.push([[],i,n]),i=[],n=[]),a.type===ut.CONTEXT?r.push([[a],[],[]]):a.type===ut.INSERT&&i.length===0?r.push([[],[],[a]]):a.type===ut.INSERT&&i.length>0?n.push(a):a.type===ut.DELETE&&i.push(a)}return(i.length||n.length)&&(r.push([[],i,n]),i=[],n=[]),r}applyRematchMatching(e,r,i){let n=e.length*r.length,s=zh(e.concat(r).map(o=>o.content.length));return n'),i.b(` `+r),i.b(' '),i.b(` `+r),i.b(i.rp("'),i.b(i.v(i.f("fileName",t,e,0))),i.b(""),i.b(` `+r),i.b(' '),i.b(` `+r),i.b(' '),i.b(i.v(i.f("addedLines",t,e,0))),i.b(""),i.b(` `+r),i.b(' '),i.b(i.v(i.f("deletedLines",t,e,0))),i.b(""),i.b(` `+r),i.b(" "),i.b(` `+r),i.b(" "),i.b(` `+r),i.b(""),i.fl()},partials:{"'),i.b(` `+r),i.b('
'),i.b(` `+r),i.b(' Files changed ('),i.b(i.v(i.f("filesNumber",t,e,0))),i.b(")"),i.b(` `+r),i.b(' hide'),i.b(` `+r),i.b(' show'),i.b(` `+r),i.b("
"),i.b(` `+r),i.b('
    '),i.b(` `+r),i.b(" "),i.b(i.t(i.f("files",t,e,0))),i.b(` `+r),i.b("
"),i.b(` `+r),i.b(""),i.fl()},partials:{},subs:{}});Ct["generic-block-header"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b(""),i.b(` `+r),i.b(' '),i.b(` `+r),i.b(' '),i.b(` `+r),i.b('
'),i.s(i.f("blockHeader",t,e,1),t,e,0,156,173,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(a.t(a.f("blockHeader",n,s,0)))}),t.pop()),i.s(i.f("blockHeader",t,e,1),t,e,1,0,0,"")||i.b(" "),i.b("
"),i.b(` `+r),i.b(" "),i.b(` `+r),i.b(""),i.fl()},partials:{},subs:{}});Ct["generic-empty-diff"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b(""),i.b(` `+r),i.b(' '),i.b(` `+r),i.b('
'),i.b(` `+r),i.b(" File without changes"),i.b(` `+r),i.b("
"),i.b(` `+r),i.b(" "),i.b(` `+r),i.b(""),i.fl()},partials:{},subs:{}});Ct["generic-file-path"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b(''),i.b(` `+r),i.b(i.rp("'),i.b(i.v(i.f("fileDiffName",t,e,0))),i.b(""),i.b(` `+r),i.b(i.rp(""),i.b(` `+r),i.b('"),i.fl()},partials:{""),i.b(` `+r),i.b(' '),i.b(` `+r),i.b(" "),i.b(i.t(i.f("lineNumber",t,e,0))),i.b(` `+r),i.b(" "),i.b(` `+r),i.b(' '),i.b(` `+r),i.b('
'),i.b(` `+r),i.s(i.f("prefix",t,e,1),t,e,0,162,238,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(' '),a.b(a.t(a.f("prefix",n,s,0))),a.b(""),a.b(` `+r)}),t.pop()),i.s(i.f("prefix",t,e,1),t,e,1,0,0,"")||(i.b('  '),i.b(` `+r)),i.s(i.f("content",t,e,1),t,e,0,371,445,"{{ }}")&&(i.rs(t,e,function(n,s,a){a.b(' '),a.b(a.t(a.f("content",n,s,0))),a.b(""),a.b(` `+r)}),t.pop()),i.s(i.f("content",t,e,1),t,e,1,0,0,"")||(i.b('
'),i.b(` `+r)),i.b("
"),i.b(` `+r),i.b(" "),i.b(` `+r),i.b(""),i.fl()},partials:{},subs:{}});Ct["generic-wrapper"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b(` `+r),i.b(" "),i.b(i.t(i.f("content",t,e,0))),i.b(` `+r),i.b("
"),i.fl()},partials:{},subs:{}});Ct["icon-file-added"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});Ct["icon-file-changed"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});Ct["icon-file-deleted"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});Ct["icon-file-renamed"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});Ct["icon-file"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('"),i.fl()},partials:{},subs:{}});Ct["line-by-line-file-diff"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b(` `+r),i.b('
'),i.b(` `+r),i.b(" "),i.b(i.t(i.f("filePath",t,e,0))),i.b(` `+r),i.b("
"),i.b(` `+r),i.b('
'),i.b(` `+r),i.b('
'),i.b(` `+r),i.b(' '),i.b(` `+r),i.b(' '),i.b(` `+r),i.b(" "),i.b(i.t(i.f("diffs",t,e,0))),i.b(` `+r),i.b(" "),i.b(` `+r),i.b("
"),i.b(` `+r),i.b("
"),i.b(` `+r),i.b("
"),i.b(` `+r),i.b("
"),i.fl()},partials:{},subs:{}});Ct["line-by-line-numbers"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b(i.v(i.f("oldNumber",t,e,0))),i.b("
"),i.b(` `+r),i.b('
'),i.b(i.v(i.f("newNumber",t,e,0))),i.b("
"),i.fl()},partials:{},subs:{}});Ct["side-by-side-file-diff"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('
'),i.b(` `+r),i.b('
'),i.b(` `+r),i.b(" "),i.b(i.t(i.f("filePath",t,e,0))),i.b(` `+r),i.b("
"),i.b(` `+r),i.b('
'),i.b(` `+r),i.b('
'),i.b(` `+r),i.b('
'),i.b(` `+r),i.b(' '),i.b(` `+r),i.b(' '),i.b(` `+r),i.b(" "),i.b(i.t(i.d("diffs.left",t,e,0))),i.b(` `+r),i.b(" "),i.b(` `+r),i.b("
"),i.b(` `+r),i.b("
"),i.b(` `+r),i.b("
"),i.b(` `+r),i.b('
'),i.b(` `+r),i.b('
'),i.b(` `+r),i.b(' '),i.b(` `+r),i.b(' '),i.b(` `+r),i.b(" "),i.b(i.t(i.d("diffs.right",t,e,0))),i.b(` `+r),i.b(" "),i.b(` `+r),i.b("
"),i.b(` `+r),i.b("
"),i.b(` `+r),i.b("
"),i.b(` `+r),i.b("
"),i.b(` `+r),i.b("
"),i.fl()},partials:{},subs:{}});Ct["tag-file-added"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('ADDED'),i.fl()},partials:{},subs:{}});Ct["tag-file-changed"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('CHANGED'),i.fl()},partials:{},subs:{}});Ct["tag-file-deleted"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('DELETED'),i.fl()},partials:{},subs:{}});Ct["tag-file-renamed"]=new $t.Template({code:function(t,e,r){var i=this;return i.b(r=r||""),i.b('RENAMED'),i.fl()},partials:{},subs:{}});var Zu=class{constructor({compiledTemplates:e={},rawTemplates:r={}}){let i=Object.entries(r).reduce((n,[s,a])=>{let o=s0.compile(a,{asString:!1});return Object.assign(Object.assign({},n),{[s]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},Ct),e),i)}static compile(e){return s0.compile(e,{asString:!1})}render(e,r,i,n,s){let a=this.templateKey(e,r);try{return this.preCompiledTemplates[a].render(i,n,s)}catch(o){throw new Error(`Could not find template to render '${a}'`)}}template(e,r){return this.preCompiledTemplates[this.templateKey(e,r)]}templateKey(e,r){return`${e}-${r}`}};var H4=Object.assign(Object.assign(Object.assign({},e0),t0),{outputFormat:Z2.LINE_BY_LINE,drawFileList:!0});function Jh(t,e={}){let r=Object.assign(Object.assign({},H4),e),i=typeof t=="string"?iP(t,r):t,n=new Zu(r),{colorScheme:s}=r,a={colorScheme:s},o=r.drawFileList?new Xh(n,a).render(i):"",l=r.outputFormat==="side-by-side"?new Yu(n,r).render(i):new Wu(n,r).render(i);return o+l}var vP=mt(mP(),1);var za=require("obsidian"),a0=Ku.StateEffect.define();function Ks(t,e){let r=t.state,i=r.field(tp),n=r.field(Wr),s=r.doc.lineAt(e!=null?e:r.selection.main.head).number,a=qt.findHunk(s,n==null?void 0:n.hunks)[0];if(!a)return;let o=r.doc.line(Math.max(1,a.added.start)).from,l=i.has(o);return r.field(za.editorEditorField).dispatch({effects:a0.of({pos:o,add:!l})})}var tp=Ku.StateField.define({create:()=>new Set,update(t,e){let r=new Set;for(let i of e.effects)i.is(a0)&&(i.value.add?t.add(i.value.pos):t.delete(i.value.pos));for(let i of t)r.add(e.changes.mapPos(i));return r}}),wP=Ku.StateField.define({create:t=>gP(t),update(t,e){return e.docChanged||e.effects.some(r=>r.is(Ml)||r.is(a0))?gP(e.state):t},provide:t=>ep.showTooltip.computeN([t],e=>e.field(t))}),bP=ep.EditorView.baseTheme({".cm-tooltip.git-diff-tooltip":{"z-index":"var(--layer-popover)",backgroundColor:"var(--background-primary-alt)",border:"var(--border-width) solid var(--background-primary-alt)",borderRadius:"var(--radius-s)"},".cm-tooltip.git-diff-tooltip .tooltip-toolbar":{display:"flex",padding:"var(--size-2-1)"}});function gP(t){let e=t.field(Wr);return e?[...t.field(tp)].map(i=>{let n=t.doc.lineAt(i),s=qt.findHunk(n.number,e.hunks)[0];if(s)return{pos:i,above:!1,arrow:!1,strictSide:!0,clip:!1,create:()=>U4(s,t,i)}}).filter(i=>i!==void 0):[]}function U4(t,e,r){var g,v;let i=qt.createPatch("file",[t],"10064",!1).join(` `)+` `,n=Jh(i,{colorScheme:vP.ColorSchemeType.AUTO,diffStyle:"word",drawFileList:!1}),s=new DOMParser().parseFromString(n,"text/html").querySelector(".d2h-file-diff"),a=createDiv();a.addClass("tooltip-toolbar");let o=(b,_)=>{let C=createDiv();return(0,za.setIcon)(C,b),C.setAttr("aria-label",_),C.addClass("clickable-icon"),C},l=o("x","Close hunk"),c=o("plus","Stage hunk"),u=o("undo","Reset hunk");a.appendChild(l),a.appendChild(c),a.appendChild(u);let f=createDiv();f.appendChild(a),f.appendChild(s),f.addClass("git-diff-tooltip","git-diff");let d=e.field(za.editorEditorField);l.onclick=()=>{Ks(d,r)},c.onclick=()=>{let b=Et.plugin;b&&(b.promiseQueue.addTask(()=>b.hunkActions.stageHunk(r)),Ks(d,r))},u.onclick=()=>{let b=Et.plugin;b&&(b.hunkActions.resetHunk(r),Ks(d,r))};let h=(v=(g=Et.plugin)==null?void 0:g.app.workspace.getActiveViewOfType(za.MarkdownView))==null?void 0:v.scope,p=h==null?void 0:h.register(null,"Escape",(b,_)=>{Ks(d,r)});return{dom:f,destroy:()=>{p&&(h==null||h.unregister(p))},update:b=>{r=b.changes.mapPos(r)}}}function _P(t){let e=t.app;t.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let r=t.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(r)||await e.vault.adapter.write(r,"");let i=await e.vault.adapter.read(r),s=await new Mh(e,i).openAndGetReslt();s!==void 0&&(await e.vault.adapter.write(r,s),await t.refresh())}}),t.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(er.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:er.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var n;let r=e.workspace.getLeavesOfType(Ei.type),i;r.length===0?(i=(n=e.workspace.getRightLeaf(!1))!=null?n:e.workspace.getLeaf(),await i.setViewState({type:Ei.type})):i=r.first(),await e.workspace.revealLeaf(i),e.workspace.trigger("obsidian-git:refresh")}}),t.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:r=>{let i=e.workspace.getActiveFile();if(r)return i!==null;{let n=t.gitManager.getRelativeRepoPath(i.path,!0);return t.tools.openDiff({aFile:n,aRef:""}),!0}}}),t.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(r,{file:i})=>{if(i)return s2(r,i,t.gitManager)}}),t.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(r,{file:i})=>{if(i)return a2(i,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:r=>{let i=e.workspace.getActiveFile();return r?i!==null:(t.addFileToGitignore(i.path,i instanceof Xi.TFolder).catch(n=>t.displayError(n)),!0)}}),t.addCommand({id:"push",name:"Commit-and-sync",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1}))}),t.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>t.promiseQueue.addTask(async()=>{await t.commitAndSync({fromAutoBackup:!1}),window.close()})}),t.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commitAndSync({fromAutoBackup:!1,requestCustomMessage:!0}))}),t.addCommand({id:"commit",name:"Commit all changes",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,mode:"all"}))}),t.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,mode:"all"}))}),t.addCommand({id:"commit-smart",name:"Commit",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!1,mode:"smart"}))}),t.addCommand({id:"commit-staged",name:"Commit staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!1,mode:"staged"}))}),Xi.Platform.isDesktopApp&&t.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,mode:"staged",amend:!0}))}),t.addCommand({id:"commit-smart-specified-message",name:"Commit with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,mode:"smart"}))}),t.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",callback:()=>t.promiseQueue.addTask(()=>t.commit({fromAuto:!1,requestCustomMessage:!0,mode:"staged"}))}),t.addCommand({id:"push2",name:"Push",callback:()=>t.promiseQueue.addTask(()=>t.push())}),t.addCommand({id:"stage-current-file",name:"Stage current file",checkCallback:r=>{let i=e.workspace.getActiveFile();return r?i!==null:(t.promiseQueue.addTask(()=>t.stageFile(i)),!0)}}),t.addCommand({id:"unstage-current-file",name:"Unstage current file",checkCallback:r=>{let i=e.workspace.getActiveFile();return r?i!==null:(t.promiseQueue.addTask(()=>t.unstageFile(i)),!0)}}),t.addCommand({id:"edit-remotes",name:"Edit remotes",callback:()=>t.editRemotes().catch(r=>t.displayError(r))}),t.addCommand({id:"remove-remote",name:"Remove remote",callback:()=>t.removeRemote().catch(r=>t.displayError(r))}),t.addCommand({id:"set-upstream-branch",name:"Set upstream branch",callback:()=>t.setUpstreamBranch().catch(r=>t.displayError(r))}),t.addCommand({id:"delete-repo",name:"CAUTION: Delete repository",callback:async()=>{await e.vault.adapter.exists(`${t.settings.basePath}/.git`)?await new at(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 Xi.Notice("Successfully deleted repository. Reloading plugin..."),t.unloadPlugin(),await t.init({fromReload:!0})):new Xi.Notice("No repository found")}}),t.addCommand({id:"init-repo",name:"Initialize a new repo",callback:()=>t.createNewRepo().catch(r=>t.displayError(r))}),t.addCommand({id:"clone-repo",name:"Clone an existing remote repo",callback:()=>t.cloneNewRepo().catch(r=>t.displayError(r))}),t.addCommand({id:"list-changed-files",name:"List changed files",callback:async()=>{if(await t.isAllInitialized())try{let r=await t.updateCachedStatus();if(r.changed.length+r.staged.length>500){t.displayError("Too many changes to display");return}new Ih(t,r.all).open()}catch(r){t.displayError(r)}}}),t.addCommand({id:"switch-branch",name:"Switch branch",callback:()=>{t.switchBranch().catch(r=>t.displayError(r))}}),t.addCommand({id:"create-branch",name:"Create new branch",callback:()=>{t.createBranch().catch(r=>t.displayError(r))}}),t.addCommand({id:"delete-branch",name:"Delete branch",callback:()=>{t.deleteBranch().catch(r=>t.displayError(r))}}),t.addCommand({id:"discard-all",name:"CAUTION: Discard all changes",callback:async()=>{let r=await t.discardAll();switch(r){case"discard":new Xi.Notice("Discarded all changes in tracked files.");break;case"delete":new Xi.Notice("Discarded all files.");break;case!1:break;default:zd(r)}}}),t.addCommand({id:"pause-automatic-routines",name:"Pause/Resume automatic routines",callback:()=>{let r=!t.localStorage.getPausedAutomatics();t.localStorage.setPausedAutomatics(r),r?(t.automaticsManager.unload(),new Xi.Notice("Paused automatic routines.")):(t.automaticsManager.reload("commit","push","pull"),new Xi.Notice("Resumed automatic routines."))}}),t.addCommand({id:"raw-command",name:"Raw command",checkCallback:r=>{let i=t.gitManager;return r?i instanceof ke:(t.tools.runRawCommand().catch(n=>t.displayError(n)),!0)}}),t.addCommand({id:"toggle-line-author-info",name:"Toggle line author information",callback:()=>{var r;return(r=t.settingsTab)==null?void 0:r.configureLineAuthorShowStatus(!t.settings.lineAuthor.show)}}),t.addCommand({id:"reset-hunk",name:"Reset hunk",editorCheckCallback(r,i,n){return r?t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0:(t.hunkActions.resetHunk(),!0)}}),t.addCommand({id:"stage-hunk",name:"Stage hunk",editorCheckCallback:(r,i,n)=>r?t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0:(t.promiseQueue.addTask(()=>t.hunkActions.stageHunk()),!0)}),t.addCommand({id:"preview-hunk",name:"Preview hunk",editorCheckCallback:(r,i,n)=>{if(r)return t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0;let s=t.hunkActions.editor.editor;return Ks(s),!0}}),t.addCommand({id:"next-hunk",name:"Go to next hunk",editorCheckCallback:(r,i,n)=>r?t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0:(t.hunkActions.goToHunk("next"),!0)}),t.addCommand({id:"prev-hunk",name:"Go to previous hunk",editorCheckCallback:(r,i,n)=>r?t.settings.hunks.hunkCommands&&t.hunkActions.editor!==void 0:(t.hunkActions.goToHunk("prev"),!0)})}m();var rp=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 r of e){let i=localStorage.getItem(this.prefix+r);this.app.loadLocalStorage(this.prefix+r)==null&&i!=null&&i!=null&&(this.app.saveLocalStorage(this.prefix+r,i),localStorage.removeItem(this.prefix+r))}}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,r;return(r=(e=this.app.loadLocalStorage(this.prefix+"PATHPaths"))==null?void 0:e.split(":"))!=null?r:[]}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}`)}getPausedAutomatics(){return this.app.loadLocalStorage(this.prefix+"pausedAutomatics")=="true"}setPausedAutomatics(e){return this.app.saveLocalStorage(this.prefix+"pausedAutomatics",`${e}`)}getGutterSpacingFallbackLength(){var e;return(e=this.app.loadLocalStorage(this.prefix+"gutterSpacingFallbackLength"))!=null?e:5}setGutterSpacingFallbackLength(e){return this.app.saveLocalStorage(this.prefix+"gutterSpacingFallbackLength",e)}};m();var jl=require("obsidian");var Xu=class{constructor(e){this.plugin=e}async hasTooBigFiles(e){let r=await this.plugin.gitManager.branchInfo(),i=r.tracking?Vs(r.tracking)[0]:null;if(!i)return!1;let n=await this.plugin.gitManager.getRemoteUrl(i);if(n!=null&&n.includes("github.com")){let s=[],a=this.plugin.gitManager;for(let o of e){let l=this.plugin.app.vault.getAbstractFileByPath(o.vaultPath),c=!1;if(l instanceof jl.TFile)l.stat.size>=1e8&&(c=!0);else{let u=await this.plugin.app.vault.adapter.stat(o.vaultPath);u&&u.size>=1e8&&(c=!0)}if(c){let u=!1;a instanceof ke&&(u=await a.isFileTrackedByLFS(o.path)),u||s.push(o)}}if(s.length>0)return this.plugin.displayError(`Aborted commit, because the following files are too big: - ${s.map(o=>o.vaultPath).join(` - `)} Please remove them or add to .gitignore.`),!0}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(ol,e);let r=!1;this.plugin.app.workspace.iterateAllLeaves(i=>{i.getDisplayText()!=""&&ol.startsWith(i.getDisplayText())&&(r=!0)}),r||await this.plugin.app.workspace.openLinkText(ol,"/",!0)}openDiff({aFile:e,bFile:r,aRef:i,bRef:n,event:s}){var l,c;let a=this.plugin.settings.diffStyle;jl.Platform.isMobileApp&&(a="git_unified");let o={aFile:e,bFile:r!=null?r:e,aRef:i,bRef:n};a=="split"?(l=Yi(this.plugin.app,s))==null||l.setViewState({type:Hs.type,active:!0,state:o}):a=="git_unified"&&((c=Yi(this.plugin.app,s))==null||c.setViewState({type:Us.type,active:!0,state:o}))}async runRawCommand(){let e=this.plugin.gitManager;if(!(e instanceof ke))return;let i=await new at(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();i!==void 0&&this.plugin.promiseQueue.addTask(async()=>{let n=new jl.Notice(`Running '${i}'...`,999999);try{let s=await e.rawCommand(i);s?(n.setMessage(s),window.setTimeout(()=>n.hide(),5e3)):n.hide()}catch(s){throw n.hide(),s}})}};m();var ip=require("obsidian");var Wa=class extends ip.ItemView{constructor(r,i){super(r);this.plugin=i;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.contentEl.addClass("git-diff"),this.gitRefreshRef=this.app.workspace.on("obsidian-git:status-changed",()=>{this.refresh().catch(console.error)})}getViewType(){return Us.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();return i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3)),`Diff: ${i}`}return Us.name}getIcon(){return Us.icon}async setState(r,i){this.state=r,ip.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 r;if((r=this.state)!=null&&r.bFile&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let i=await this.plugin.gitManager.getDiffString(this.state.bFile,this.state.aRef=="HEAD",this.state.bRef);this.contentEl.empty();let n=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);if(!i){if(this.plugin.gitManager instanceof ke&&await this.plugin.gitManager.isTracked(this.state.bFile))i=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(` `);else if(await this.app.vault.adapter.exists(n)){let s=await this.app.vault.adapter.read(n);i=[...`--- /dev/null +++ ${this.state.bFile} @@ -0,0 +1,${s.split(` `).length} @@`.split(` `),...s.split(` `).map(o=>`+${o}`)].join(` `)}}if(i){let s=this.parser.parseFromString(Jh(i),"text/html").querySelector(".d2h-file-diff");this.contentEl.append(s)}else{let s=this.contentEl.createDiv({cls:"obsidian-git-center"});s.createSpan({text:"\u26A0\uFE0F",attr:{style:"font-size: 2em"}}),s.createEl("br"),s.createSpan({text:"File not found: "+this.state.bFile})}}finally{this.gettingDiff=!1}}}};m();var ss=require("obsidian");var zl=require("@codemirror/commands");var sp=require("@codemirror/search"),Vl=require("@codemirror/state"),Qi=require("@codemirror/view");m();var np=require("obsidian"),o0=require("@codemirror/view");function G4(t){return t.selection.ranges.filter(e=>!e.empty).map(e=>t.sliceDoc(e.from,e.to)).join(t.lineBreak)}function j4(t){t.dispatch({...t.state.replaceSelection(""),userEvent:"delete.cut"})}function yP(t,e){t.dispatch({...t.state.replaceSelection(e),scrollIntoView:!0,userEvent:"input.paste"})}async function xP(t){if(!t&&navigator.clipboard.read){let e=await navigator.clipboard.read();for(let r of e)if(r.types.includes("text/html")){let i=await(await r.getType("text/html")).text();return(0,np.htmlToMarkdown)(i)}}return navigator.clipboard.readText()}var EP=o0.EditorView.domEventHandlers({contextmenu(t,e){t.preventDefault();let r=G4(e.state),i=!e.state.readOnly&&e.state.facet(o0.EditorView.editable),n=np.Menu.forEvent(t);return n.addItem(s=>s.setTitle("Cut").setIcon("scissors").setDisabled(!i||r.length===0).onClick(async()=>{await navigator.clipboard.writeText(r),j4(e)})),n.addItem(s=>s.setTitle("Copy").setIcon("copy").setDisabled(r.length===0).onClick(()=>navigator.clipboard.writeText(r))),n.addItem(s=>s.setTitle("Paste").setIcon("clipboard-paste").setDisabled(!i).onClick(async()=>yP(e,await xP(!1)))),n.addItem(s=>s.setTitle("Paste as plain text").setIcon("clipboard-type").setDisabled(!i).onClick(async()=>yP(e,await xP(!0)))),n.addItem(s=>s.setTitle("Select all").setIcon("scan").onClick(()=>e.dispatch({selection:{anchor:0,head:e.state.doc.length}}))),n.showAtMouseEvent(t),!0}});var SP=Qi.EditorView.theme({"& .cm-content":{caretColor:"transparent !important"},"&.cm-focused .cm-cursor, & .cm-dropCursor":{display:"none !important"}}),V4=10;function z4(t,e){let r=Number.isInteger(t)&&t>0?t:tt.diffTimeout;return e?r:r*V4}var qa=class extends ss.ItemView{constructor(r,i){super(r);this.plugin=i;this.refreshing=!1;this.ignoreNextModification=!1;this.navigation=!0,this.registerEvent(this.app.workspace.on("obsidian-git:status-changed",()=>{this.mergeView?this.updateRefEditors().catch(console.error):this.createMergeView().catch(console.error)})),this.intervalRef=window.setInterval(()=>{this.mergeView&&this.updateRefEditors().catch(console.error)},30*1e3),this.registerEvent(this.app.vault.on("modify",n=>{this.state.bRef==null&&n.path===this.state.bFile&&(this.ignoreNextModification?this.ignoreNextModification=!1:this.updateModifiableEditor().catch(console.error))})),this.registerEvent(this.app.vault.on("delete",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("create",n=>{this.state.bRef==null&&n.path===this.state.bFile&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("rename",(n,s)=>{this.state.bRef==null&&(n.path===this.state.bFile||s===this.state.bFile)&&this.createMergeView().catch(console.error)})),this.fileSaveDebouncer=(0,ss.debounce)(n=>{let s=this.state.bFile;s&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(this.plugin.gitManager.getRelativeVaultPath(s),n).catch(a=>this.plugin.displayError(a)))},1e3,!1)}getViewType(){return Hs.type}getDisplayText(){var r;if(((r=this.state)==null?void 0:r.bFile)!=null){let i=this.state.bFile.split("/").last();i!=null&&i.endsWith(".md")&&(i=i.slice(0,-3));let n;return this.state.bRef==null?n=" (Working Tree)":this.state.bRef==""?n=" (Index)":n="("+this.state.bRef.substring(0,7)+")",`Diff: ${i} ${n}`}return Hs.name}getIcon(){return Hs.icon}async setState(r,i){this.state=r,ss.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await super.setState(r,i),await this.createMergeView()}getState(){return this.state}onClose(){return window.clearInterval(this.intervalRef),super.onClose()}async onOpen(){return await this.createMergeView(),super.onOpen()}async gitShow(r,i){try{return await this.plugin.gitManager.show(r,i,!1)}catch(n){if(n instanceof jr&&(n.message.includes("does not exist")||n.message.includes("unknown revision or path")||n.message.includes("exists on disk, but not in")||n.message.includes("fatal: bad object")))return n.message.includes("fatal: bad object")&&this.plugin.displayError(n.message),"";throw n}}async bShouldBeEditable(){if(this.state.bRef!=null)return!1;let r=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);return await this.app.vault.adapter.exists(r)}async updateModifiableEditor(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.b;this.refreshing=!0;let i=await this.app.vault.adapter.read(this.state.bFile);if(i!=r.state.doc.toString()){let n=r.state.update({changes:{from:0,to:r.state.doc.length,insert:i},annotations:[Vl.Transaction.remote.of(!0)]});r.dispatch(n)}this.refreshing=!1}async updateRefEditors(){if(!this.mergeView||this.refreshing)return;let r=this.mergeView.a,i=this.mergeView.b;this.refreshing=!0;let n=await this.gitShow(this.state.aRef,this.state.aFile),s;if(this.state.bRef!=null&&(s=await this.gitShow(this.state.bRef,this.state.bFile)),n!=r.state.doc.toString()){let a=r.state.update({changes:{from:0,to:r.state.doc.length,insert:n}});r.dispatch(a)}if(s!=null&&s!=i.state.doc.toString()){let a=i.state.update({changes:{from:0,to:i.state.doc.length,insert:s}});i.dispatch(a)}this.refreshing=!1}renderButtons(r){let i=r.createDiv(),n=i.createDiv();if(n.addClass("clickable-icon"),n.setAttr("aria-label",this.state.bRef==null?"Stage hunk":"Unstage hunk"),(0,ss.setIcon)(n,this.state.bRef==null?"plus":"minus"),n.onmousedown=async s=>{var p;let a=this.mergeView.b,o=this.mergeView.a,l=Lw(a.state),c=(p=i.parentElement)==null?void 0:p.indexOf(i),u=l.chunks[c],f=Hw(u,o.state.doc,a.state.doc),d=Bw(this.mergeView.a.state.doc.toString(),this.mergeView.b.state.doc.toString(),[f])[0],h=qt.createPatch(this.state.bFile,[d],"100644",this.state.bRef!=null).join(` `)+` `;await this.plugin.gitManager.applyPatch(h),this.plugin.app.workspace.trigger("obsidian-git:refresh")},this.state.bRef==null){let s=i.createDiv();s.addClass("clickable-icon"),s.setAttr("aria-label","Reset hunk"),(0,ss.setIcon)(s,"undo"),s.onmousedown=a=>{var d;let o=this.mergeView.a,l=this.mergeView.b,c=Lw(l.state),u=(d=i.parentElement)==null?void 0:d.indexOf(i),f=c.chunks[u];if(f){let h=f.fromA,p=f.toA,g=f.fromB,v=f.toB,b=o.state.sliceDoc(h,Math.max(h,p-1));h!=p&&v<=l.state.doc.length&&(b+=o.state.lineBreak),l.dispatch({changes:{from:g,to:Math.min(l.state.doc.length,v),insert:b},userEvent:"revert"})}}}return i.onmousedown=s=>{s.preventDefault(),s.stopPropagation()},i}async createMergeView(){var r,i,n;if((r=this.state)!=null&&r.aFile&&((i=this.state)!=null&&i.bFile)&&!this.refreshing&&this.plugin.gitManager){this.refreshing=!0,(n=this.mergeView)==null||n.destroy();let s=this.containerEl.children[1];s.empty(),this.contentEl.addClass("git-split-diff-view","git-diff"),this.bIsEditable=await this.bShouldBeEditable();let a=await this.gitShow(this.state.aRef,this.state.aFile),o;if(this.state.bRef!=null)o=await this.gitShow(this.state.bRef,this.state.bFile);else{let p=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);await this.app.vault.adapter.exists(p)?o=await this.app.vault.adapter.read(p):o=""}let l=[(0,Qi.lineNumbers)(),(0,sp.highlightSelectionMatches)(),(0,Qi.drawSelection)(),Qi.keymap.of([...zl.standardKeymap,zl.indentWithTab]),(0,zl.history)(),(0,sp.search)(),Qi.EditorView.lineWrapping,EP],c=Qi.ViewPlugin.define(p=>({update:g=>{if(g.docChanged&&!g.transactions.some(v=>v.annotation(Vl.Transaction.remote))){let v=p.state.doc.toString();this.fileSaveDebouncer(v)}}})),u={doc:a,extensions:[...l,Vl.EditorState.readOnly.of(!0),SP]},f=[...l];this.bIsEditable?f.push(c):f.push(Vl.EditorState.readOnly.of(!0),SP);let d={doc:o,extensions:f};s.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]);let h=this.plugin.gitManager instanceof ke&&(this.state.bRef===void 0||this.state.bRef==="");this.mergeView=new Gh({b:d,a:u,collapseUnchanged:{minSize:6,margin:4},renderRevertControl:h?()=>this.renderButtons(s):void 0,revertControls:h?"a-to-b":void 0,diffConfig:{timeout:z4(this.plugin.settings.diffTimeout,this.bIsEditable)},parent:s}),this.refreshing=!1}}};m();var p$=require("obsidian");m();m();m();var kP,CP,AP;typeof window!="undefined"&&((AP=(CP=(kP=window.__svelte)!=null?kP:window.__svelte={}).v)!=null?AP:CP.v=new Set).add("5");m();m();m();var as={};var Qe=Symbol("uninitialized"),Fi=Symbol("filename");var ap="http://www.w3.org/1999/xhtml";m();m();m();m();var op=!0;m();var O=!1;m();var os=Array.isArray,TP=Array.prototype.indexOf,Xs=Array.prototype.includes,Wl=Array.from,l0=Object.keys,fr=Object.defineProperty,qr=Object.getOwnPropertyDescriptor,c0=Object.getOwnPropertyDescriptors,u0=Object.prototype,PP=Array.prototype,ql=Object.getPrototypeOf,f0=Object.isExtensible;function d0(t){return typeof t=="function"}var dr=()=>{};function lp(t){for(var e=0;e{t=i,e=n});return{promise:r,resolve:t,reject:e}}m();m();var rr=Symbol("$state"),Qu=Symbol("legacy props"),$P=Symbol(""),up=Symbol("proxy path"),fp=Symbol("attributes"),Ju=Symbol("class"),h0=Symbol("style"),ef=Symbol("text"),Ya=Symbol("form reset"),p0=Symbol("hmr anchor"),ls=new class extends Error{constructor(){super(...arguments);Ue(this,"name","StaleReactionError");Ue(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},RP,m0=!!((RP=globalThis.document)!=null&&RP.contentType)&&globalThis.document.contentType.includes("xml");var Yl=3,Ii=8;m();m();function FP(t){if(O){let e=new Error(`invariant_violation An invariant violation occurred, meaning Svelte's internal assumptions were flawed. This is a bug in Svelte, not your app \u2014 please open an issue at https://github.com/sveltejs/svelte, citing the following message: "${t}" https://svelte.dev/e/invariant_violation`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/invariant_violation")}function dp(t){if(O){let e=new Error(`lifecycle_outside_component \`${t}(...)\` can only be used during component initialisation https://svelte.dev/e/lifecycle_outside_component`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function MP(){if(O){let t=new Error("async_derived_orphan\nCannot create a `$derived(...)` with an `await` expression outside of an effect tree\nhttps://svelte.dev/e/async_derived_orphan");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function g0(){if(O){let t=new Error("bind_invalid_checkbox_value\nUsing `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead\nhttps://svelte.dev/e/bind_invalid_checkbox_value");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function DP(){if(O){let t=new Error(`derived_references_self A derived value cannot reference itself recursively https://svelte.dev/e/derived_references_self`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/derived_references_self")}function v0(t,e,r){if(O){let i=new Error(`each_key_duplicate ${r?`Keyed each block has duplicate key \`${r}\` at indexes ${t} and ${e}`:`Keyed each block has duplicate key at indexes ${t} and ${e}`} https://svelte.dev/e/each_key_duplicate`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_duplicate")}function OP(t,e,r){if(O){let i=new Error(`each_key_volatile Keyed each block has key that is not idempotent \u2014 the key for item at index ${t} was \`${e}\` but is now \`${r}\`. Keys must be the same each time for a given item https://svelte.dev/e/each_key_volatile`);throw i.name="Svelte error",i}else throw new Error("https://svelte.dev/e/each_key_volatile")}function LP(t){if(O){let e=new Error(`effect_in_teardown \`${t}\` cannot be used inside an effect cleanup function https://svelte.dev/e/effect_in_teardown`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_in_teardown")}function NP(){if(O){let t=new Error("effect_in_unowned_derived\nEffect cannot be created inside a `$derived` value that was not itself created inside an effect\nhttps://svelte.dev/e/effect_in_unowned_derived");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function BP(t){if(O){let e=new Error(`effect_orphan \`${t}\` can only be used inside an effect (e.g. during component initialisation) https://svelte.dev/e/effect_orphan`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/effect_orphan")}function HP(){if(O){let t=new Error(`effect_update_depth_exceeded Maximum update depth exceeded. This typically indicates that an effect reads and writes the same piece of state https://svelte.dev/e/effect_update_depth_exceeded`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function UP(){if(O){let t=new Error(`hydration_failed Failed to hydrate the application https://svelte.dev/e/hydration_failed`);throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/hydration_failed")}function GP(t){if(O){let e=new Error(`props_invalid_value Cannot do \`bind:${t}={undefined}\` when \`${t}\` has a fallback value https://svelte.dev/e/props_invalid_value`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/props_invalid_value")}function jP(t){if(O){let e=new Error(`rune_outside_svelte The \`${t}\` rune is only available inside \`.svelte\` and \`.svelte.js/ts\` files https://svelte.dev/e/rune_outside_svelte`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/rune_outside_svelte")}function VP(){if(O){let t=new Error("state_descriptors_fixed\nProperty descriptors defined on `$state` objects must contain `value` and always be `enumerable`, `configurable` and `writable`.\nhttps://svelte.dev/e/state_descriptors_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function zP(){if(O){let t=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function WP(){if(O){let t=new Error("state_unsafe_mutation\nUpdating state inside `$derived(...)`, `$inspect(...)` or a template expression is forbidden. If the value should not be reactive, declare it without `$state`\nhttps://svelte.dev/e/state_unsafe_mutation");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function qP(){if(O){let t=new Error("svelte_boundary_reset_onerror\nA `` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw t.name="Svelte error",t}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}m();m();m();var Rn="font-weight: bold",$n="font-weight: normal";function YP(t){O?console.warn(`%c[svelte] await_reactivity_loss %cDetected reactivity loss when reading \`${t}\`. This happens when state is read in an async function after an earlier \`await\` https://svelte.dev/e/await_reactivity_loss`,Rn,$n):console.warn("https://svelte.dev/e/await_reactivity_loss")}function ZP(t,e){O?console.warn(`%c[svelte] await_waterfall %cAn async derived, \`${t}\` (${e}) was not read immediately after it resolved. This often indicates an unnecessary waterfall, which can slow down your app https://svelte.dev/e/await_waterfall`,Rn,$n):console.warn("https://svelte.dev/e/await_waterfall")}function KP(){O?console.warn(`%c[svelte] derived_inert %cReading a derived belonging to a now-destroyed effect may result in stale values https://svelte.dev/e/derived_inert`,Rn,$n):console.warn("https://svelte.dev/e/derived_inert")}function XP(t,e,r){O?console.warn(`%c[svelte] hydration_attribute_changed %cThe \`${t}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${r}\`, will be ignored in favour of the server value https://svelte.dev/e/hydration_attribute_changed`,Rn,$n):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Za(t){O?console.warn(`%c[svelte] hydration_mismatch %c${t?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${t}`:"Hydration failed because the initial UI does not match what was rendered on the server"} https://svelte.dev/e/hydration_mismatch`,Rn,$n):console.warn("https://svelte.dev/e/hydration_mismatch")}function QP(){O?console.warn(`%c[svelte] lifecycle_double_unmount %cTried to unmount a component that was not mounted https://svelte.dev/e/lifecycle_double_unmount`,Rn,$n):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function hp(t){O?console.warn(`%c[svelte] state_proxy_equality_mismatch %cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${t}\` will produce unexpected results https://svelte.dev/e/state_proxy_equality_mismatch`,Rn,$n):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function JP(){O?console.warn(`%c[svelte] state_proxy_unmount %cTried to unmount a state proxy, rather than a component https://svelte.dev/e/state_proxy_unmount`,Rn,$n):console.warn("https://svelte.dev/e/state_proxy_unmount")}function eR(){O?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",Rn,$n):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function tR(t){O?console.warn(`%c[svelte] transition_slide_display %cThe \`slide\` transition does not work correctly for elements with \`display: ${t}\` https://svelte.dev/e/transition_slide_display`,Rn,$n):console.warn("https://svelte.dev/e/transition_slide_display")}var se=!1;function Lt(t){se=t}var we;function We(t){if(t===null)throw Za(),as;return we=t}function hr(){return We(nr(we))}function G(t){if(se){if(nr(we)!==null)throw Za(),as;we=t}}function Ka(t=1){if(se){for(var e=t,r=we;e--;)r=nr(r);we=r}}function Fn(t=!0){for(var e=0,r=we;;){if(r.nodeType===Ii){var i=r.data;if(i==="]"){if(e===0)return r;e-=1}else(i==="["||i==="[!"||i[0]==="["&&!isNaN(Number(i.slice(1))))&&(e+=1)}var n=nr(r);t&&r.remove(),r=n}}function rf(t){if(!t||t.nodeType!==Ii)throw Za(),as;return t.data}m();m();m();m();function pp(t){return t===this.v}function w0(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function mp(t){return!w0(t,this.v)}m();var Ft=!1,cs=!1,Ji=!1;m();m();m();var nf=null;function pr(t,e){return t.label=e,vp(t.v,e),t}function vp(t,e){var r;return(r=t==null?void 0:t[up])==null||r.call(t,e),t}m();function en(t){let e=new Error,r=q4();return r.length===0?null:(r.unshift(` `),fr(e,"stack",{value:r.join(` `)}),fr(e,"name",{value:t}),e)}function q4(){let t=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let e=new Error().stack;if(Error.stackTraceLimit=t,!e)return[];let r=e.split(` `),i=[];for(let n=0;n{e===Xa&&nR()})}Xa.push(t)}function sR(){for(;Xa.length>0;)nR()}m();var _0=new WeakMap;function bp(t){var e=ee;if(e===null)return oe.f|=8388608,t;if(O&&t instanceof Error&&!_0.has(t)&&_0.set(t,Y4(t,e)),(e.f&32768)===0&&(e.f&4)===0)throw O&&!e.parent&&t instanceof Error&&aR(t),t;nn(t,e)}function nn(t,e){if(!(e!==null&&(e.f&16384)!==0)){for(;e!==null;){if((e.f&128)!==0){if((e.f&32768)===0)throw t;try{e.b.error(t);return}catch(r){t=r}}e=e.parent}throw O&&t instanceof Error&&aR(t),t}}function Y4(t,e){var a,o,l;let r=qr(t,"message");if(!(r&&!r.configurable)){for(var i=af?" ":" ",n=` ${i}in ${((a=e.fn)==null?void 0:a.name)||""}`,s=e.ctx;s!==null;)n+=` ${i}in ${(o=s.function)==null?void 0:o[Fi].split("/").pop()}`,s=s.p;return{message:t.message+` ${n} `,stack:(l=t.stack)==null?void 0:l.split(` `).filter(c=>!c.includes("svelte/src/internal")).join(` `)}}}function aR(t){let e=_0.get(t);e&&(fr(t,"message",{value:e.message}),fr(t,"stack",{value:e.stack}))}m();m();var Z4=-7169;function Ge(t,e){t.f=t.f&Z4|e}function Ql(t){(t.f&512)!==0||t.deps===null?Ge(t,1024):Ge(t,4096)}function oR(t){if(t!==null)for(let e of t)(e.f&2)===0||(e.f&65536)===0||(e.f^=65536,oR(e.deps))}function _p(t,e,r){(t.f&2048)!==0?e.add(t):(t.f&4096)!==0&&r.add(t),oR(t.deps),Ge(t,1024)}m();m();m();var lR=!1,yp=!1;function y0(t){var e=yp;try{return yp=!1,[t(),yp]}finally{yp=e}}m();m();m();m();function x0(t){se&&or(t)!==null&&ec(t)}var cR=!1;function E0(){cR||(cR=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(let r of t.target.elements)(e=r[Ya])==null||e.call(r)})},{capture:!0}))}function Zr(t){var e=oe,r=ee;Ht(null),Ut(null);try{return t()}finally{Ht(e),Ut(r)}}function S0(t,e,r,i=r){t.addEventListener(e,()=>Zr(r));let n=t[Ya];n?t[Ya]=()=>{n(),i(!0)}:t[Ya]=()=>i(!0),E0()}m();m();m();function uR(t){let e=0,r=gr(0),i;return O&&pr(r,"createSubscriber version"),()=>{Qs()&&(F(r),lr(()=>(e===0&&(i=Je(()=>t(()=>to(r)))),e+=1,()=>{At(()=>{e-=1,e===0&&(i==null||i(),i=void 0,to(r))})})))}}var X4=589824;function R0(t,e,r,i){new k0(t,e,r,i)}var li,of,Oi,ro,Kr,Li,Ar,ci,ds,io,Js,tc,lf,cf,Dn,Sp,qe,dR,hR,C0,pR,A0,xp,Ep,T0,P0,k0=class{constructor(e,r,i,n){ge(this,qe);Ue(this,"parent");Ue(this,"is_pending",!1);Ue(this,"transform_error");ge(this,li);ge(this,of,se?we:null);ge(this,Oi);ge(this,ro);ge(this,Kr);ge(this,Li,null);ge(this,Ar,null);ge(this,ci,null);ge(this,ds,null);ge(this,io,0);ge(this,Js,0);ge(this,tc,!1);ge(this,lf,new Set);ge(this,cf,new Set);ge(this,Dn,null);ge(this,Sp,uR(()=>(de(this,Dn,gr($(this,io))),O&&pr($(this,Dn),"$effect.pending()"),()=>{de(this,Dn,null)})));var s,a;de(this,li,e),de(this,Oi,r),de(this,ro,o=>{var l=ee;l.b=this,l.f|=128,i(o)}),this.parent=ee.b,this.transform_error=(a=n!=null?n:(s=this.parent)==null?void 0:s.transform_error)!=null?a:(o=>o),de(this,Kr,fi(()=>{if(se){let o=$(this,of);hr();let l=o.data==="[!";if(o.data.startsWith("[?")){let u=JSON.parse(o.data.slice("[?".length));Se(this,qe,hR).call(this,u)}else l?Se(this,qe,pR).call(this):Se(this,qe,dR).call(this)}else Se(this,qe,A0).call(this)},X4)),se&&de(this,li,we)}defer_effect(e){_p(e,$(this,lf),$(this,cf))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!$(this,Oi).pending}update_pending_count(e,r){Se(this,qe,T0).call(this,e,r),de(this,io,$(this,io)+e),!(!$(this,Dn)||$(this,tc))&&(de(this,tc,!0),At(()=>{de(this,tc,!1),$(this,Dn)&&sn($(this,Dn),$(this,io))}))}get_effect_pending(){return $(this,Sp).call(this),F($(this,Dn))}error(e){var r;if(!$(this,Oi).onerror&&!$(this,Oi).failed)throw e;(r=le)!=null&&r.is_fork?($(this,Li)&&le.skip_effect($(this,Li)),$(this,Ar)&&le.skip_effect($(this,Ar)),$(this,ci)&&le.skip_effect($(this,ci)),le.oncommit(()=>{Se(this,qe,P0).call(this,e)})):Se(this,qe,P0).call(this,e)}};li=new WeakMap,of=new WeakMap,Oi=new WeakMap,ro=new WeakMap,Kr=new WeakMap,Li=new WeakMap,Ar=new WeakMap,ci=new WeakMap,ds=new WeakMap,io=new WeakMap,Js=new WeakMap,tc=new WeakMap,lf=new WeakMap,cf=new WeakMap,Dn=new WeakMap,Sp=new WeakMap,qe=new WeakSet,dR=function(){try{de(this,Li,Gt(()=>$(this,ro).call(this,$(this,li))))}catch(e){this.error(e)}},hR=function(e){let r=$(this,Oi).failed,{reset:i,invoke_onerror:n}=Se(this,qe,C0).call(this,e);At(n),r&&de(this,ci,Gt(()=>{r($(this,li),()=>e,()=>i)}))},C0=function(e){var r=!1,i=!1;let n=()=>{if(r){eR();return}r=!0,i&&qP(),$(this,ci)!==null&&On($(this,ci),()=>{de(this,ci,null)}),Se(this,qe,Ep).call(this,()=>{Se(this,qe,A0).call(this)})};return{reset:n,invoke_onerror:()=>{var a,o;try{i=!0,(o=(a=$(this,Oi)).onerror)==null||o.call(a,e,n),i=!1}catch(l){nn(l,$(this,Kr)&&$(this,Kr).parent)}}}},pR=function(){let e=$(this,Oi).pending;e&&(this.is_pending=!0,de(this,Ar,Gt(()=>e($(this,li)))),At(()=>{var r=de(this,ds,document.createDocumentFragment()),i=jt();r.append(i),de(this,Li,Se(this,qe,Ep).call(this,()=>Gt(()=>$(this,ro).call(this,i)))),$(this,Js)===0&&($(this,li).before(r),de(this,ds,null),On($(this,Ar),()=>{de(this,Ar,null)}),Se(this,qe,xp).call(this,le))}))},A0=function(){try{if(this.is_pending=this.has_pending_snippet(),de(this,Js,0),de(this,io,0),de(this,Li,Gt(()=>{$(this,ro).call(this,$(this,li))})),$(this,Js)>0){var e=de(this,ds,document.createDocumentFragment());rc($(this,Li),e);let r=$(this,Oi).pending;de(this,Ar,Gt(()=>r($(this,li))))}else Se(this,qe,xp).call(this,le)}catch(r){this.error(r)}},xp=function(e){this.is_pending=!1,e.transfer_effects($(this,lf),$(this,cf))},Ep=function(e){var r=ee,i=oe,n=Ee;Ut($(this,Kr)),Ht($(this,Kr)),us($(this,Kr).ctx);try{return ui.ensure(),e()}catch(s){return bp(s),null}finally{Ut(r),Ht(i),us(n)}},T0=function(e,r){var i;if(!this.has_pending_snippet()){this.parent&&Se(i=this.parent,qe,T0).call(i,e,r);return}de(this,Js,$(this,Js)+e),$(this,Js)===0&&(Se(this,qe,xp).call(this,r),$(this,Ar)&&On($(this,Ar),()=>{de(this,Ar,null)}),$(this,ds)&&($(this,li).before($(this,ds)),de(this,ds,null)))},P0=function(e){$(this,Li)&&(_t($(this,Li)),de(this,Li,null)),$(this,Ar)&&(_t($(this,Ar)),de(this,Ar,null)),$(this,ci)&&(_t($(this,ci)),de(this,ci,null)),se&&(We($(this,of)),Ka(),We(Fn()));let r=$(this,Oi).failed,i=n=>{let{reset:s,invoke_onerror:a}=Se(this,qe,C0).call(this,n);a(),r&&de(this,ci,Se(this,qe,Ep).call(this,()=>{try{return Gt(()=>{var o=ee;o.b=this,o.f|=128,r($(this,li),()=>n,()=>s)})}catch(o){return nn(o,$(this,Kr).parent),null}}))};At(()=>{var n;try{n=this.transform_error(e)}catch(s){nn(s,$(this,Kr)&&$(this,Kr).parent);return}n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(i,s=>nn(s,$(this,Kr)&&$(this,Kr).parent)):i(n)})};function kp(t,e,r,i){let n=Mn()?ea:no;var s=t.filter(h=>!h.settled),a=e.map(n);if(O&&a.forEach((h,p)=>{h.label=e[p].toString().replace("() => ","").replaceAll("$.eager(() => ","$state.eager(").replace(/\$\.get\((.+?)\)/g,(g,v)=>v)}),r.length===0&&s.length===0){i(a);return}var o=ee,l=mR(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(h=>h.promise)):null;function u(h){if((o.f&16384)===0){l();try{i([...a,...h])}catch(p){nn(p,o)}ic()}}var f=$0();if(r.length===0){c.then(()=>u([])).finally(f);return}function d(){Promise.all(r.map(h=>I0(h))).then(u).catch(h=>nn(h,o)).finally(f)}c?c.then(()=>{l(),d(),ic()}):d()}function mR(){var t=ee,e=oe,r=Ee,i=le;if(O)var n=In;return function(a=!0){Ut(t),Ht(e),us(r),a&&(t.f&16384)===0&&(i==null||i.activate(),i==null||i.apply()),O&&(F0(null),Xl(n))}}function ic(t=!0){var e;Ut(null),Ht(null),us(null),t&&((e=le)==null||e.deactivate()),O&&(F0(null),Xl(null))}function $0(){var t=ee,e=t.b,r=le,i=!!(e!=null&&e.is_rendered());return e==null||e.update_pending_count(1,r),r.increment(i,t),()=>{e==null||e.update_pending_count(-1,r),r.decrement(i,t)}}var Qr=null;function F0(t){Qr=t}var uf=new Set;function ea(t){var e=2050;ee!==null&&(ee.f|=524288);let r={ctx:Ee,deps:null,effects:null,equals:pp,f:e,fn:t,reactions:null,rv:0,v:Qe,wv:0,parent:ee,ac:null};return O&&Ji&&(r.created=en("created at")),r}var nc=Symbol("obsolete");function I0(t,e,r){let i=ee;i===null&&MP();var n=void 0,s=gr(Qe);O&&(s.label=e!=null?e:t.toString());var a=!oe,o=new Set;return wR(()=>{var h,p;var l=ee;O&&(Qr={effect:l,effect_deps:new Set,warned:!1});var c=cp();n=c.promise;try{Promise.resolve(t()).then(c.resolve,g=>{g!==ls&&c.reject(g)}).finally(ic)}catch(g){c.reject(g),ic()}if(O){if(Qr){if(l.deps!==null)for(let g=0;g{O&&(Qr=null),f==null||f(),o.delete(c),v!==nc&&(u.activate(),v?(s.f|=8388608,sn(s,v)):((s.f&8388608)!==0&&(s.f^=8388608),O&&r!==void 0&&!s.equals(g)&&(uf.add(s),setTimeout(()=>{uf.has(s)&&(l.f&16384)===0&&(ZP(s.label,r),uf.delete(s))})),sn(s,g)),u.deactivate())};c.promise.then(d,g=>d(null,g||"unknown"))}),sr(()=>{for(let l of o)l.reject(nc)}),O&&(s.f|=4194304),new Promise(l=>{function c(u){function f(){u===n?l(s):c(n)}u.then(f,f)}c(n)})}function Le(t){let e=ea(t);return Ft||Tp(e),e}function no(t){let e=ea(t);return e.equals=mp,e}function gR(t){var e=t.effects;if(e!==null){t.effects=null;for(var r=0;r{r.ac.abort(ls),r.ac=null}),r.fn!==null&&(r.teardown=dr),ao(r,0),df(r))}function O0(t){if(t.effects!==null)for(let e of t.effects)e.teardown&&e.fn!==null&&Ln(e)}var Pp=null,ac=null,le=null,ps=null,It=null,B0=null,Qa=!1,L0=!1,oo=null,mf=null,bR=0,N0=new Set,eU=1,lc,ms,gs,cc,uc,fc,vs,dc,Pr,gf,ws,an,Nn,hc,ta,He,H0,hf,U0,yR,xR,oc,ER,pf,Rp=class Rp{constructor(){ge(this,He);Ue(this,"id",eU++);ge(this,lc,!1);Ue(this,"linked",!0);ge(this,ms,null);ge(this,gs,null);Ue(this,"async_deriveds",new Map);Ue(this,"current",new Map);Ue(this,"previous",new Map);ge(this,cc,new Set);ge(this,uc,new Set);ge(this,fc,0);ge(this,vs,new Map);ge(this,dc,null);ge(this,Pr,[]);ge(this,gf,[]);ge(this,ws,new Set);ge(this,an,new Set);ge(this,Nn,new Map);ge(this,hc,new Set);Ue(this,"is_fork",!1);ge(this,ta,!1);ac===null?Pp=ac=this:(de(ac,gs,this),de(this,ms,ac)),ac=this}skip_effect(e){$(this,Nn).has(e)||$(this,Nn).set(e,{d:[],m:[]}),$(this,hc).delete(e)}unskip_effect(e,r=i=>this.schedule(i)){var i=$(this,Nn).get(e);if(i){$(this,Nn).delete(e);for(var n of i.d)Ge(n,2048),r(n);for(n of i.m)Ge(n,4096),r(n)}$(this,hc).add(e)}capture(e,r,i=!1){e.v!==Qe&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&8388608)===0&&(this.current.set(e,[r,i]),It==null||It.set(e,r)),this.is_fork||(e.v=r)}activate(){le=this}deactivate(){le=null,It=null}flush(){try{O&&N0.clear(),L0=!0,le=this,Se(this,He,hf).call(this)}finally{if(bR=0,B0=null,oo=null,mf=null,L0=!1,le=null,It=null,bs.clear(),O)for(let e of N0)e.updated=null}}discard(){var e;for(let r of $(this,uc))r(this);$(this,uc).clear();for(let r of this.async_deriveds.values())r.reject(nc);Se(this,He,pf).call(this),(e=$(this,dc))==null||e.resolve()}register_created_effect(e){$(this,gf).push(e)}increment(e,r){var i;if(de(this,fc,$(this,fc)+1),e){let n=(i=$(this,vs).get(r))!=null?i:0;$(this,vs).set(r,n+1)}}decrement(e,r){var i;if(de(this,fc,$(this,fc)-1),e){let n=(i=$(this,vs).get(r))!=null?i:0;n===1?$(this,vs).delete(r):$(this,vs).set(r,n-1)}$(this,ta)||(de(this,ta,!0),At(()=>{de(this,ta,!1),this.linked&&this.flush()}))}transfer_effects(e,r){for(let i of e)$(this,ws).add(i);for(let i of r)$(this,an).add(i);e.clear(),r.clear()}oncommit(e){$(this,cc).add(e)}ondiscard(e){$(this,uc).add(e)}settled(){var e;return((e=$(this,dc))!=null?e:de(this,dc,cp())).promise}static ensure(){if(le===null){let e=le=new Rp;!L0&&!Qa&&At(()=>{$(e,lc)||e.flush()})}return le}apply(){if(!Ft||!this.is_fork&&$(this,ms)===null&&$(this,gs)===null){It=null;return}It=new Map;for(let[r,[i]]of this.current)It.set(r,i);for(let r=Pp;r!==null;r=$(r,gs))if(!(r===this||r.is_fork)){var e=!1;if(r.id1e3&&(Se(this,He,pf).call(this),tU()),O)for(let d of this.current.keys())N0.add(d);for(let d of $(this,ws))$(this,an).delete(d),Ge(d,2048),this.schedule(d);for(let d of $(this,an))Ge(d,4096),this.schedule(d);let e=$(this,Pr);de(this,Pr,[]),this.apply();var r=oo=[],i=[],n=mf=[];for(let d of e)try{Se(this,He,U0).call(this,d,r,i)}catch(h){throw CR(d),Se(this,He,H0).call(this)||this.discard(),h}if(le=null,n.length>0){var s=Rp.ensure();for(let d of n)s.schedule(d)}if(oo=null,mf=null,Se(this,He,H0).call(this)){Se(this,He,oc).call(this,i),Se(this,He,oc).call(this,r);for(let[d,h]of $(this,Nn))kR(d,h);n.length>0&&Se(l=le,He,hf).call(l);return}let a=Se(this,He,yR).call(this);if(a){Se(this,He,oc).call(this,i),Se(this,He,oc).call(this,r),Se(c=a,He,xR).call(c,this);return}$(this,ws).clear(),$(this,an).clear();for(let d of $(this,cc))d(this);$(this,cc).clear(),ps=this,_R(i),_R(r),ps=null,(u=$(this,dc))==null||u.resolve();var o=le;if($(this,fc)===0&&($(this,Pr).length===0||o!==null)&&(Se(this,He,pf).call(this),Ft&&(Se(this,He,ER).call(this),le=o)),$(this,Pr).length>0)if(o!==null){let d=o;$(d,Pr).push(...$(this,Pr).filter(h=>!$(d,Pr).includes(h)))}else o=this;o!==null&&Se(f=o,He,hf).call(f)},U0=function(e,r,i){e.f^=1024;for(var n=e.first;n!==null;){var s=n.f,a=(s&96)!==0,o=a&&(s&1024)!==0,l=o||(s&8192)!==0||$(this,Nn).has(n);if(!l&&n.fn!==null){a?n.f^=1024:(s&4)!==0?r.push(n):Ft&&(s&16777224)!==0?i.push(n):ra(n)&&((s&16)!==0&&$(this,an).add(n),Ln(n));var c=n.first;if(c!==null){n=c;continue}}for(;n!==null;){var u=n.next;if(u!==null){n=u;break}n=n.parent}}},yR=function(){for(var e=$(this,ms);e!==null;){if(!e.is_fork){for(let[r,[,i]]of this.current)if(e.current.has(r)&&!i)return e}e=$(e,ms)}return null},xR=function(e){var i;for(let[n,s]of e.current)!this.previous.has(n)&&e.previous.has(n)&&this.previous.set(n,e.previous.get(n)),this.current.set(n,s);for(let[n,s]of e.async_deriveds){let a=this.async_deriveds.get(n);a&&s.promise.then(a.resolve).catch(a.reject)}e.async_deriveds.clear(),this.transfer_effects($(e,ws),$(e,an));let r=n=>{var s=n.reactions;if(s!==null&&!((n.f&2)!==0&&(n.f&6144)===0))for(let l of s){var a=l.f;if((a&2)!==0)r(l);else{var o=l;a&4194320&&!this.async_deriveds.has(o)&&($(this,an).delete(o),Ge(o,2048),this.schedule(o))}}};for(let n of this.current.keys())r(n);this.oncommit(()=>e.discard()),Se(i=e,He,pf).call(i),le=this,Se(this,He,hf).call(this)},oc=function(e){for(var r=0;r!d.current.get(h)[1]);if(!(!$(d,lc)||n.length===0)){var s=n.filter(h=>!this.current.has(h));if(s.length===0)e&&d.discard();else if(r.length>0){if(O&&!$(d,ta)&&iR($(d,Pr).length===0,"Batch has scheduled roots"),e)for(let h of $(this,hc))d.unskip_effect(h,p=>{var g;(p.f&4194320)!==0?d.schedule(p):Se(g=d,He,oc).call(g,[p])});d.activate();var a=new Set,o=new Map;for(var l of r)SR(l,s,a,o);o=new Map;var c=[...d.current].filter(([h,p])=>{let g=this.current.get(h);return g?g[0]!==p[0]||g[1]!==p[1]:!0}).map(([h])=>h);if(c.length>0)for(let h of $(this,gf))(h.f&155648)===0&&G0(h,c,o)&&((h.f&4194320)!==0?(Ge(h,2048),d.schedule(h)):$(d,ws).add(h));if($(d,Pr).length>0&&!$(d,ta)){d.apply();for(var u of $(d,Pr))Se(f=d,He,U0).call(f,u,[],[]);de(d,Pr,[])}d.deactivate()}}}},pf=function(){if(this.linked){var e=$(this,ms),r=$(this,gs);e===null?Pp=r:de(e,gs,r),r===null?ac=e:de(r,ms,e),this.linked=!1}};var ui=Rp;function co(t){var e=Qa;Qa=!0;try{var r;for(t&&(le!==null&&!le.is_fork&&le.flush(),r=t());;){if(sR(),le===null)return r;le.flush()}}finally{Qa=e}}function tU(){var r;if(O){var t=new Map;for(let i of le.current.keys())for(let[n,s]of(r=i.updated)!=null?r:[]){var e=t.get(n);e||(e={error:s.error,count:0},t.set(n,e)),e.count+=s.count}for(let i of t.values())i.error&&console.error(i.error)}try{HP()}catch(i){O&&fr(i,"stack",{value:""}),nn(i,B0)}}var Jr=null;function _R(t){var e=t.length;if(e!==0){for(var r=0;r0)){bs.clear();for(let n of Jr){if((n.f&24576)!==0)continue;let s=[n],a=n.parent;for(;a!==null;)Jr.has(a)&&(Jr.delete(a),s.push(a)),a=a.parent;for(let o=s.length-1;o>=0;o--){let l=s[o];(l.f&24576)===0&&Ln(l)}}Jr.clear()}}Jr=null}}function SR(t,e,r,i){if(!r.has(t)&&(r.add(t),t.reactions!==null))for(let n of t.reactions){let s=n.f;(s&2)!==0?SR(n,e,r,i):(s&4194320)!==0&&(s&2048)===0&&G0(n,e,i)&&(Ge(n,2048),wf(n))}}function G0(t,e,r){let i=r.get(t);if(i!==void 0)return i;if(t.deps!==null)for(let n of t.deps){if(Xs.call(e,n))return!0;if((n.f&2)!==0&&G0(n,e,r))return r.set(n,!0),!0}return r.set(t,!1),!1}function wf(t){le.schedule(t)}function kR(t,e){if(!((t.f&32)!==0&&(t.f&1024)!==0)){(t.f&2048)!==0?e.d.push(t):(t.f&4096)!==0&&e.m.push(t),Ge(t,1024);for(var r=t.first;r!==null;)kR(r,e),r=r.next}}function CR(t){Ge(t,1024);for(var e=t.first;e!==null;)CR(e),e=e.next}var so=new Set,bs=new Map;function Cp(t){so=t}var V0=!1;function TR(){V0=!0}function gr(t,e){var r={f:0,v:t,reactions:null,equals:pp,rv:0,wv:0};return O&&Ji&&(r.created=e!=null?e:en("created at"),r.updated=null,r.set_during_effect=!1,r.trace=null),r}function Ne(t,e){let r=gr(t,e);return Tp(r),r}function Ja(t,e=!1,r=!0){var n,s;let i=gr(t);return e||(i.equals=mp),cs&&r&&Ee!==null&&Ee.l!==null&&((s=(n=Ee.l).s)!=null?s:n.s=[]).push(i),i}function ae(t,e,r=!1){oe!==null&&(!Rr||(oe.f&131072)!==0)&&Mn()&&(oe.f&4325394)!==0&&(hi===null||!hi.has(t))&&WP();let i=r?nt(e):e;return O&&vp(i,t.label),sn(t,i,mf)}function sn(t,e,r=null){var n,s,a;if(!t.equals(e)){bs.set(t,di?e:t.v);var i=ui.ensure();if(i.capture(t,e),O){if(Ji||ee!==null){(n=t.updated)!=null||(t.updated=new Map);let o=((a=(s=t.updated.get(""))==null?void 0:s.count)!=null?a:0)+1;if(t.updated.set("",{error:null,count:o}),Ji||o>5){let l=en("updated at");if(l!==null){let c=t.updated.get(l.stack);c||(c={error:l,count:0},t.updated.set(l.stack,c)),c.count++}}}ee!==null&&(t.set_during_effect=!0)}if((t.f&2)!==0){let o=t;(t.f&2048)!==0&&ff(o),It===null&&Ql(o)}t.wv=sc(),PR(t,2048,r),Mn()&&ee!==null&&(ee.f&1024)!==0&&(ee.f&96)===0&&(pi===null?RR([t]):pi.push(t)),!i.is_fork&&so.size>0&&!V0&&$p()}return e}function $p(){V0=!1;for(let t of so){(t.f&1024)!==0&&Ge(t,4096);let e;try{e=ra(t)}catch(r){e=!0}e&&Ln(t)}so.clear()}function to(t){ae(t,t.v+1)}function PR(t,e,r){var d;var i=t.reactions;if(i!==null)for(var n=Mn(),s=i.length,a=0;a{if(ia===a)return f();var d=oe,h=ia;Ht(null),z0(a);var p=f();return Ht(d),z0(h),p};i&&(r.set("length",Ne(t.length,s)),O&&(t=sU(t)));var l="";let c=!1;function u(f){if(!c){c=!0,l=f,pr(n,`${l} version`);for(let[d,h]of r)pr(h,uo(l,d));c=!1}}return new Proxy(t,{defineProperty(f,d,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&VP();var p=r.get(d);return p===void 0?o(()=>{var g=Ne(h.value,s);return r.set(d,g),O&&typeof d=="string"&&pr(g,uo(l,d)),g}):ae(p,h.value,!0),!0},deleteProperty(f,d){var h=r.get(d);if(h===void 0){if(d in f){let p=o(()=>Ne(Qe,s));r.set(d,p),to(n),O&&pr(p,uo(l,d))}}else ae(h,Qe),to(n);return!0},get(f,d,h){var b;if(d===rr)return t;if(O&&d===up)return u;var p=r.get(d),g=d in f;if(p===void 0&&(!g||(b=qr(f,d))!=null&&b.writable)&&(p=o(()=>{var _=nt(g?f[d]:Qe),C=Ne(_,s);return O&&pr(C,uo(l,d)),C}),r.set(d,p)),p!==void 0){var v=F(p);return v===Qe?void 0:v}return Reflect.get(f,d,h)},getOwnPropertyDescriptor(f,d){var h=Reflect.getOwnPropertyDescriptor(f,d);if(h&&"value"in h){var p=r.get(d);p&&(h.value=F(p))}else if(h===void 0){var g=r.get(d),v=g==null?void 0:g.v;if(g!==void 0&&v!==Qe)return{enumerable:!0,configurable:!0,value:v,writable:!0}}return h},has(f,d){var v;if(d===rr)return!0;var h=r.get(d),p=h!==void 0&&h.v!==Qe||Reflect.has(f,d);if(h!==void 0||ee!==null&&(!p||(v=qr(f,d))!=null&&v.writable)){h===void 0&&(h=o(()=>{var b=p?nt(f[d]):Qe,_=Ne(b,s);return O&&pr(_,uo(l,d)),_}),r.set(d,h));var g=F(h);if(g===Qe)return!1}return p},set(f,d,h,p){var w;var g=r.get(d),v=d in f;if(i&&d==="length")for(var b=h;bNe(Qe,s)),r.set(b+"",_),O&&pr(_,uo(l,b)))}if(g===void 0)(!v||(w=qr(f,d))!=null&&w.writable)&&(g=o(()=>Ne(void 0,s)),O&&pr(g,uo(l,d)),ae(g,nt(h)),r.set(d,g));else{v=g.v!==Qe;var C=o(()=>nt(h));ae(g,C)}var x=Reflect.getOwnPropertyDescriptor(f,d);if(x!=null&&x.set&&x.set.call(p,h),!v){if(i&&typeof d=="string"){var E=r.get("length"),A=Number(d);Number.isInteger(A)&&A>=E.v&&ae(E,A+1)}to(n)}return!0},ownKeys(f){F(n);var d=Reflect.ownKeys(f).filter(g=>{var v=r.get(g);return v===void 0||v.v!==Qe});for(var[h,p]of r)p.v!==Qe&&!(h in f)&&d.push(h);return d},setPrototypeOf(){zP()}})}function uo(t,e){var r;return typeof e=="symbol"?`${t}[Symbol(${(r=e.description)!=null?r:""})]`:iU.test(e)?`${t}.${e}`:/^\d+$/.test(e)?`${t}[${e}]`:`${t}['${e}']`}function Fp(t){try{if(t!==null&&typeof t=="object"&&rr in t)return t[rr]}catch(e){}return t}var nU=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function sU(t){return new Proxy(t,{get(e,r,i){var n=Reflect.get(e,r,i);return nU.has(r)?function(...s){TR();var a=n.apply(this,s);return $p(),a}:n}})}function $R(){let t=Array.prototype,e=Array.__svelte_cleanup;e&&e();let{indexOf:r,lastIndexOf:i,includes:n}=t;t.indexOf=function(s,a){let o=r.call(this,s,a);if(o===-1){for(let l=a!=null?a:0;l{t.indexOf=r,t.lastIndexOf=i,t.includes=n}}var W0,FR,af,IR,MR;function Ip(){if(W0===void 0){W0=window,FR=document,af=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,r=Text.prototype;IR=qr(e,"firstChild").get,MR=qr(e,"nextSibling").get,f0(t)&&(t[Ju]=void 0,t[fp]=null,t[h0]=void 0,t.__e=void 0),f0(r)&&(r[ef]=void 0),O&&(t.__svelte_meta=null,$R())}}function jt(t=""){return document.createTextNode(t)}function or(t){return IR.call(t)}function nr(t){return MR.call(t)}function V(t,e){if(!se)return or(t);var r=or(we);if(r===null)r=we.appendChild(jt());else if(e&&r.nodeType!==Yl){var i=jt();return r==null||r.before(i),We(i),i}return e&&Dp(r),We(r),r}function Ni(t,e=!1){var n,s;if(!se){var r=or(t);return r instanceof Comment&&r.data===""?nr(r):r}if(e){if(((n=we)==null?void 0:n.nodeType)!==Yl){var i=jt();return(s=we)==null||s.before(i),We(i),i}Dp(we)}return we}function ne(t,e=1,r=!1){let i=se?we:t;for(var n;e--;)n=i,i=nr(i);if(!se)return i;if(r){if((i==null?void 0:i.nodeType)!==Yl){var s=jt();return i===null?n==null||n.after(s):i.before(s),We(s),s}Dp(i)}return We(i),i}function ec(t){t.textContent=""}function Mp(){if(!Ft||Jr!==null)return!1;var t=ee.f;return(t&32768)!==0}function Bn(t,e,r){return e==null||e===ap?r?document.createElement(t,{is:r}):document.createElement(t):r?document.createElementNS(e,t,{is:r}):document.createElementNS(e,t)}function Dp(t){if(t.nodeValue.length<65536)return;let e=t.nextSibling;for(;e!==null&&e.nodeType===Yl;)e.remove(),t.nodeValue+=e.nodeValue,e=t.nextSibling}function OR(t){ee===null&&(oe===null&&BP(t),NP()),di&&LP(t)}function oU(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function Hn(t,e){var a,o;var r=ee;if(O)for(;r!==null&&(r.f&131072)!==0;)r=r.parent;r!==null&&(r.f&8192)!==0&&(t|=8192);var i={ctx:Ee,deps:null,nodes:null,f:t|2048|512,first:null,fn:e,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,wv:0,ac:null};O&&(i.component_function=tn),(a=le)==null||a.register_created_effect(i);var n=i;if((t&4)!==0)oo!==null?oo.push(i):ui.ensure().schedule(i);else if(e!==null){try{Ln(i)}catch(l){throw _t(i),l}n.deps===null&&n.teardown===null&&n.nodes===null&&n.first===n.last&&(n.f&524288)===0&&(n=n.first,(t&16)!==0&&(t&65536)!==0&&n!==null&&(n.f|=65536))}if(n!==null&&(n.parent=r,r!==null&&oU(n,r),oe!==null&&(oe.f&2)!==0&&(t&64)===0)){var s=oe;((o=s.effects)!=null?o:s.effects=[]).push(n)}return i}function Qs(){return oe!==null&&!Rr}function sr(t){let e=Hn(8,null);return Ge(e,1024),e.teardown=t,e}function vr(t){var n;OR("$effect"),O&&fr(t,"name",{value:"$effect"});var e=ee.f,r=!oe&&(e&32)!==0&&Ee!==null&&!Ee.i;if(r){var i=Ee;((n=i.e)!=null?n:i.e=[]).push(t)}else return b0(t)}function b0(t){return Hn(1048580,t)}function Y0(t){ui.ensure();let e=Hn(524352,t);return()=>{_t(e)}}function LR(t){ui.ensure();let e=Hn(524352,t);return(r={})=>new Promise(i=>{r.outro?On(e,()=>{_t(e),i(void 0)}):(_t(e),i(void 0))})}function ei(t){return Hn(4,t)}function wR(t){return Hn(4718592,t)}function lr(t,e=0){return Hn(8|e,t)}function Ve(t,e=[],r=[],i=[]){kp(i,e,r,n=>{Hn(8,()=>{t(...n.map(F))})})}function fi(t,e=0){var r=Hn(16|e,t);return O&&(r.dev_stack=In),r}function Gt(t){return Hn(524320,t)}function Z0(t){var e=t.teardown;if(e!==null){let r=di,i=oe;q0(!0),Ht(null);try{e.call(null)}finally{q0(r),Ht(i)}}}function df(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){let n=r.ac;n!==null&&Zr(()=>{n.abort(ls)});var i=r.next;(r.f&64)!==0?r.parent=null:_t(r,e),r=i}}function NR(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&32)===0&&_t(e),e=r}}function _t(t,e=!0){var r=!1;(e||(t.f&262144)!==0)&&t.nodes!==null&&t.nodes.end!==null&&(BR(t.nodes.start,t.nodes.end),r=!0),t.f|=33554432,df(t,e&&!r),ao(t,0);var i=t.nodes&&t.nodes.t;if(i!==null)for(let s of i)s.stop();Z0(t),t.f^=33554432,t.f|=16384;var n=t.parent;n!==null&&n.first!==null&&j0(t),O&&(t.component_function=null),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes=t.ac=t.b=null}function BR(t,e){for(;t!==null;){var r=t===e?null:nr(t);t.remove(),t=r}}function j0(t){var e=t.parent,r=t.prev,i=t.next;r!==null&&(r.next=i),i!==null&&(i.prev=r),e!==null&&(e.first===t&&(e.first=i),e.last===t&&(e.last=r))}function On(t,e,r=!0){var i=[];HR(t,i,!0);var n=()=>{r&&_t(t),e&&e()},s=i.length;if(s>0){var a=()=>--s||n();for(var o of i)o.out(a)}else n()}function HR(t,e,r){if((t.f&8192)===0){t.f^=8192;var i=t.nodes&&t.nodes.t;if(i!==null)for(let o of i)(o.is_global||r)&&e.push(o);for(var n=t.first;n!==null;){var s=n.next;if((n.f&64)===0){var a=(n.f&65536)!==0||(n.f&32)!==0&&(t.f&16)!==0;HR(n,e,a?r:!1)}n=s}}}function mc(t){UR(t,!0)}function UR(t,e){if((t.f&8192)!==0){t.f^=8192,(t.f&1024)===0&&(Ge(t,2048),ui.ensure().schedule(t));for(var r=t.first;r!==null;){var i=r.next,n=(r.f&65536)!==0||(r.f&32)!==0;UR(r,n?e:!1),r=i}var s=t.nodes&&t.nodes.t;if(s!==null)for(let a of s)(a.is_global||e)&&a.in()}}function rc(t,e){if(t.nodes)for(var r=t.nodes.start,i=t.nodes.end;r!==null;){var n=r===i?null:nr(r);e.append(r),r=n}}m();var GR=null;var Op=!1,di=!1;function q0(t){di=t}var oe=null,Rr=!1;function Ht(t){oe=t}var ee=null;function Ut(t){ee=t}var hi=null;function Tp(t){oe!==null&&(!Ft||(oe.f&2)!==0)&&(hi!=null?hi:hi=new Set).add(t)}var Kt=null,Tr=0,pi=null;function RR(t){pi=t}var jR=1,fo=0,ia=fo;function z0(t){ia=t}function sc(){return++jR}function ra(t){var e=t.f;if((e&2048)!==0)return!0;if(e&2&&(t.f&=-65537),(e&4096)!==0){for(var r=t.deps,i=r.length,n=0;nt.wv)return!0}(e&512)!==0&&It===null&&Ge(t,1024)}return!1}function VR(t,e,r=!0){var i=t.reactions;if(i!==null&&!(!Ft&&hi!==null&&hi.has(t)))for(var n=0;n{t.ac.abort(ls)}),t.ac=null);try{t.f|=2097152;var u=t.fn,f=u();t.f|=32768;var d=t.deps,h=(g=le)==null?void 0:g.is_fork;if(Kt!==null){var p;if(h||ao(t,Tr),d!==null&&Tr>0)for(d.length=Tr+Kt.length,p=0;p{s.ac.abort(ls),s.ac=null,Ge(s,2048)}),vR(s),ao(s,0)}}function ao(t,e){var r=t.deps;if(r!==null)for(var i=e;i{requestAnimationFrame(()=>t()),setTimeout(()=>t())});await Promise.resolve(),co()}function F(t){var h,p,g;var e=t.f,r=(e&2)!==0;if((h=GR)==null||h.add(t),oe!==null&&!Rr){var i=ee!==null&&(ee.f&16384)!==0;if(!i&&(hi===null||!hi.has(t))){var n=oe.deps;if((oe.f&2097152)!==0)t.rvr==null?void 0:r.call(this,s))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?At(()=>{e.addEventListener(t,n,i)}):e.addEventListener(t,n,i),n}function mi(t,e,r,i,n){var s={capture:i,passive:n},a=YR(t,e,r,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&sr(()=>{e.removeEventListener(t,a,s)})}function me(t,e,r){var i;((i=e[ho])!=null?i:e[ho]={})[t]=r}function Mt(t){for(var e=0;e{throw b});throw d}}finally{t[ho]=e,delete t.currentTarget,Ht(u),Ut(f)}}}m();m();var ZR,X0=((ZR=globalThis==null?void 0:globalThis.window)==null?void 0:ZR.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function KR(t){var e;return(e=X0==null?void 0:X0.createHTML(t))!=null?e:t}function Q0(t){var e=Bn("template");return e.innerHTML=KR(t.replaceAll("","")),e.content}function on(t,e){var r=ee;r.nodes===null&&(r.nodes={start:t,end:e,a:null,t:null})}function _e(t,e){var r=(e&1)!==0,i=(e&2)!==0,n,s=!t.startsWith("");return()=>{if(se)return on(we,null),we;n===void 0&&(n=Q0(s?t:""+t),r||(n=or(n)));var a=i||af?document.importNode(n,!0):n.cloneNode(!0);if(r){var o=or(a),l=a.lastChild;on(o,l)}else on(a,a);return a}}function po(){if(se)return on(we,null),we;var t=document.createDocumentFragment(),e=document.createComment(""),r=jt();return t.append(e,r),on(e,r),t}function ue(t,e){if(se){var r=ee;((r.f&32768)===0||r.nodes.end===null)&&(r.nodes.end=we),hr();return}t!==null&&t.before(e)}m();var pU=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory","defer","disablepictureinpicture","disableremoteplayback"];var Ote=[...pU,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var mU=["touchstart","touchmove"];function XR(t){return mU.includes(t)}var gU=["$state","$state.raw","$derived","$derived.by"],Lte=[...gU,"$state.eager","$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"];var Up=!0;function Ye(t,e){var i,n;var r=e==null?"":typeof e=="object"?`${e}`:e;r!==((n=t[i=ef])!=null?n:t[i]=t.nodeValue)&&(t[ef]=r,t.nodeValue=`${r}`)}function na(t,e){return QR(t,e)}function tb(t,e){var a;Ip(),e.intro=(a=e.intro)!=null?a:!1;let r=e.target,i=se,n=we;try{for(var s=or(r);s&&(s.nodeType!==Ii||s.data!=="[");)s=nr(s);if(!s)throw as;Lt(!0),We(s);let o=QR(t,{...e,anchor:s});return Lt(!1),o}catch(o){if(o instanceof Error&&o.message.split(` `).some(l=>l.startsWith("https://svelte.dev/e/")))throw o;return o!==as&&console.warn("Failed to hydrate: ",o),e.recover===!1&&UP(),Ip(),ec(r),Lt(!1),na(t,e)}finally{Lt(i),We(n)}}var Hp=new Map;function QR(t,{target:e,anchor:r,props:i={},events:n,context:s,intro:a=!0,transformError:o}){Ip();var l=void 0,c=LR(()=>{var u=r!=null?r:e.appendChild(jt());R0(u,{pending:()=>{}},h=>{ht({});var p=Ee;if(s&&(p.c=s),n&&(i.$$events=n),se&&on(h,null),Up=a,l=t(h,i)||{},Up=!0,se&&(ee.nodes.end=we,we===null||we.nodeType!==Ii||we.data!=="]"))throw Za(),as;pt()},o);var f=new Set,d=h=>{for(var p=0;p{var v;for(var h of f)for(let b of[e,document]){var p=Hp.get(b),g=p.get(h);--g==0?(b.removeEventListener(h,Bp),p.delete(h),p.size===0&&Hp.delete(b)):p.set(h,g)}Np.delete(d),u!==r&&((v=u.parentNode)==null||v.removeChild(u))}});return eb.set(l,c),l}var eb=new WeakMap;function _s(t,e){let r=eb.get(t);return r?(eb.delete(t),r(e)):(O&&(rr in t?JP():QP()),Promise.resolve())}m();m();m();var ln,Un,gi,mo,bf,_f,Gp,ys=class{constructor(e,r=!0){Ue(this,"anchor");ge(this,ln,new Map);ge(this,Un,new Map);ge(this,gi,new Map);ge(this,mo,new Set);ge(this,bf,!0);ge(this,_f,e=>{if($(this,ln).has(e)){var r=$(this,ln).get(e),i=$(this,Un).get(r);if(i)mc(i),$(this,mo).delete(r);else{var n=$(this,gi).get(r);n&&(mc(n.effect),$(this,Un).set(r,n.effect),$(this,gi).delete(r),O&&(n.fragment.lastChild[p0]=this.anchor),n.fragment.lastChild.remove(),this.anchor.before(n.fragment),i=n.effect)}for(let[s,a]of $(this,ln)){if($(this,ln).delete(s),s===e)break;let o=$(this,gi).get(a);o&&(_t(o.effect),$(this,gi).delete(a))}for(let[s,a]of $(this,Un)){if(s===r||$(this,mo).has(s))continue;let o=()=>{if(Array.from($(this,ln).values()).includes(s)){var c=document.createDocumentFragment();rc(a,c),c.append(jt()),$(this,gi).set(s,{effect:a,fragment:c})}else _t(a);$(this,mo).delete(s),$(this,Un).delete(s)};$(this,bf)||!i?($(this,mo).add(s),On(a,o,!1)):o()}}});ge(this,Gp,e=>{$(this,ln).delete(e);let r=Array.from($(this,ln).values());for(let[i,n]of $(this,gi))r.includes(i)||(_t(n.effect),$(this,gi).delete(i))});this.anchor=e,de(this,bf,r)}ensure(e,r){var i=le,n=Mp();if(r&&!$(this,Un).has(e)&&!$(this,gi).has(e))if(n){var s=document.createDocumentFragment(),a=jt();s.append(a),$(this,gi).set(e,{effect:Gt(()=>r(a)),fragment:s})}else $(this,Un).set(e,Gt(()=>r(this.anchor)));if($(this,ln).set(i,e),n){for(let[o,l]of $(this,Un))o===e?i.unskip_effect(l):i.skip_effect(l);for(let[o,l]of $(this,gi))o===e?i.unskip_effect(l.effect):i.skip_effect(l.effect);i.oncommit($(this,_f)),i.ondiscard($(this,Gp))}else se&&(this.anchor=we),$(this,_f).call(this,i)}};ln=new WeakMap,Un=new WeakMap,gi=new WeakMap,mo=new WeakMap,bf=new WeakMap,_f=new WeakMap,Gp=new WeakMap;if(O){let t=function(e){if(!(e in globalThis)){let r;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(r!==void 0)return r;jP(e)},set:i=>{r=i}})}};t("$state"),t("$effect"),t("$derived"),t("$inspect"),t("$props"),t("$bindable")}function go(t){Ee===null&&dp("onMount"),cs&&Ee.l!==null?bU(Ee).m.push(t):vr(()=>{let e=Je(t);if(typeof e=="function")return e})}function bU(t){var r;var e=t.l;return(r=e.u)!=null?r:e.u={a:[],b:[],m:[]}}m();m();var t$=new Map;function r$(t,e){var r=t$.get(t);r||(r=new Set,t$.set(t,r)),r.add(e)}m();m();m();m();m();m();m();m();m();function $e(t,e,r=!1){var i;se&&(i=we,hr());var n=new ys(t),s=r?65536:0;function a(o,l){if(se){var c=rf(i);if(o!==parseInt(c.substring(1))){var u=Fn();We(u),n.anchor=u,Lt(!1),n.ensure(o,l),Lt(!0);return}}n.ensure(o,l)}fi(()=>{var o=!1;e((l,c=0)=>{o=!0,a(c,l)}),o||a(-1,null)},s)}m();m();m();function vi(t,e){return e}function AU(t,e,r){var f;for(var i=[],n=e.length,s,a=e.length,o=0;o{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=t.outrogroups;rb(t,Wl(s.done)),h.delete(s),h.size===0&&(t.outrogroups=null)}}else a-=1},!1)}if(a===0){var l=i.length===0&&r!==null;if(l){var c=r,u=c.parentNode;ec(u),u.append(c),t.items.clear()}rb(t,e,!l)}else s={pending:new Set(e),done:new Set},((f=t.outrogroups)!=null?f:t.outrogroups=new Set).add(s)}function rb(t,e,r=!0){var i;if(t.pending.size>0){i=new Set;for(let a of t.pending.values())for(let o of a)i.add(t.items.get(o).e)}for(var n=0;n{var C=r();return os(C)?C:C==null?[]:Wl(C)});O&&pr(f,"{#each ...}");var d,h=new Map,p=!0;function g(C){(_.effect.f&16384)===0&&(_.pending.delete(C),_.fallback=u,TU(_,d,a,e,i),u!==null&&(d.length===0?(u.f&33554432)===0?mc(u):(u.f^=33554432,xf(u,null,a)):On(u,()=>{u=null})))}function v(C){_.pending.delete(C)}var b=fi(()=>{d=F(f);var C=d.length;let x=!1;if(se){var E=rf(a)==="[!";E!==(C===0)&&(a=Fn(),We(a),Lt(!1),x=!0)}for(var A=new Set,w=le,S=Mp(),y=0;ys(a)):(u=Gt(()=>s(gc!=null?gc:gc=jt())),u.f|=33554432)),C>A.size&&(O?RU(d,i):v0("","","")),se&&C>0&&We(Fn()),!p)if(h.set(w,A),S){for(let[B,re]of o)A.has(B)||w.skip_effect(re.e);w.oncommit(g),w.ondiscard(v)}else g(w);x&&Lt(!0),F(f)}),_={effect:b,flags:e,items:o,pending:h,outrogroups:null,fallback:u};p=!1,se&&(a=we)}function yf(t){for(;t!==null&&(t.f&32)===0;)t=t.next;return t}function TU(t,e,r,i,n){var P,T,I,M,B,re,Ae,K,Q;var s=(i&8)!==0,a=e.length,o=t.items,l=yf(t.effect.first),c,u=null,f,d=[],h=[],p,g,v,b;if(s)for(b=0;b0){var y=(i&4)!==0&&a===0?r:null;if(s){for(b=0;b{var fe,ce;if(f!==void 0)for(v of f)(ce=(fe=v.nodes)==null?void 0:fe.a)==null||ce.apply()})}function PU(t,e,r,i,n,s,a,o){var l=(a&1)!==0?(a&16)===0?Ja(r,!1,!1):gr(r):null,c=(a&2)!==0?gr(n):null;return O&&l&&(l.trace=()=>{var u;o()[(u=c==null?void 0:c.v)!=null?u:n]}),{v:l,i:c,e:Gt(()=>(s(e,l!=null?l:r,c!=null?c:n,o),()=>{t.delete(i)}))}}function xf(t,e,r){if(t.nodes)for(var i=t.nodes.start,n=t.nodes.end,s=e&&(e.f&33554432)===0?e.nodes.start:r;i!==null;){var a=nr(i);if(s.before(i),i===n)return;i=a}}function sa(t,e,r){e===null?t.effect.first=r:e.next=r,r===null?t.effect.last=e:r.prev=e}function RU(t,e){let r=new Map,i=t.length;for(let n=0;nperformance.now():()=>Date.now(),cn={tick:t=>(op?requestAnimationFrame:dr)(t),now:()=>$U(),tasks:new Set};function n$(){let t=cn.now();cn.tasks.forEach(e=>{e.c(t)||(cn.tasks.delete(e),e.f())}),cn.tasks.size!==0&&cn.tick(n$)}function s$(t){let e;return cn.tasks.size===0&&cn.tick(n$),{promise:new Promise(r=>{cn.tasks.add(e={c:t,f:r})}),abort(){cn.tasks.delete(e)}}}function jp(t,e){Zr(()=>{t.dispatchEvent(new CustomEvent(e))})}function DU(t){if(t==="float")return"cssFloat";if(t==="offset")return"cssOffset";if(t.startsWith("--"))return t;let e=t.split("-");return e.length===1?e[0]:e[0]+e.slice(1).map(r=>r[0].toUpperCase()+r.slice(1)).join("")}function a$(t){let e={},r=t.split(";");for(let i of r){let[n,s]=i.split(":");if(!n||s===void 0)break;let a=DU(n.trim());e[a]=s.trim()}return e}var OU=t=>t;function un(t,e,r,i){var C,x;var n=(t&1)!==0,s=(t&2)!==0,a=n&&s,o=(t&4)!==0,l=a?"both":n?"in":"out",c,u=e.inert,f=e.style.overflow,d,h;function p(){return Zr(()=>{var E;return c!=null?c:c=r()(e,(E=i==null?void 0:i())!=null?E:{},{direction:l})})}var g={is_global:o,in(){var E;if(e.inert=u,!n){h==null||h.abort(),(E=h==null?void 0:h.reset)==null||E.call(h);return}s||d==null||d.abort(),d=ib(e,p(),h,1,()=>{jp(e,"introstart")},()=>{jp(e,"introend"),d==null||d.abort(),d=c=void 0,e.style.overflow=f})},out(E){if(!s){E==null||E(),c=void 0;return}e.inert=!0,h=ib(e,p(),d,0,()=>{jp(e,"outrostart")},()=>{jp(e,"outroend"),E==null||E()})},stop:()=>{d==null||d.abort(),h==null||h.abort()}},v=ee;if(((x=(C=v.nodes).t)!=null?x:C.t=[]).push(g),n&&Up){var b=o;if(!b){for(var _=v.parent;_&&(_.f&65536)!==0;)for(;(_=_.parent)&&(_.f&16)===0;);b=!_||(_.f&32768)!==0}b&&ei(()=>{Je(()=>g.in())})}}function ib(t,e,r,i,n,s){var a=i===1;if(d0(e)){var o,l=!1;return At(()=>{if(!l){var b=e({direction:a?"in":"out"});o=ib(t,b,r,i,n,s)}}),{abort:()=>{l=!0,o==null||o.abort()},deactivate:()=>o.deactivate(),reset:()=>o.reset(),t:()=>o.t()}}if(r==null||r.deactivate(),!(e!=null&&e.duration)&&!(e!=null&&e.delay))return n(),s(),{abort:dr,deactivate:dr,reset:dr,t:()=>i};let{delay:c=0,css:u,tick:f,easing:d=OU}=e;var h=[];if(a&&r===void 0&&(f&&f(0,1),u)){var p=a$(u(0,1));h.push(p,p)}var g=()=>1-i,v=t.animate(h,{duration:c,fill:"forwards"});return v.onfinish=()=>{var P;v.cancel(),n();var b=(P=r==null?void 0:r.t())!=null?P:1-i;r==null||r.abort();var _=i-b,C=e.duration*Math.abs(_),x=[];if(C>0){var E=!1;if(u)for(var A=Math.ceil(C/16.666666666666668),w=0;w<=A;w+=1){var S=b+_*d(w/A),y=a$(u(S,1-S));x.push(y),E||(E=y.overflow==="hidden")}E&&(t.style.overflow="hidden"),g=()=>{var T=v.currentTime;return b+_*d(T/C)},f&&s$(()=>{if(v.playState!=="running")return!1;var T=g();return f(T,1-T),!0})}v=t.animate(x,{duration:C,fill:"forwards"}),v.onfinish=()=>{g=()=>i,f==null||f(i,1-i),s()}},{abort:()=>{v&&(v.cancel(),v.effect=null,v.onfinish=dr)},deactivate:()=>{s=dr},reset:()=>{i===0&&(f==null||f(1,0))},t:()=>g()}}m();m();function fn(t,e){ei(()=>{var n;var r=t.getRootNode(),i=r.host?r:(n=r.head)!=null?n:r.ownerDocument.head;if(!i.querySelector("#"+e.hash)){let s=Bn("style");s.id=e.hash,s.textContent=e.code,i.appendChild(s),O&&r$(e.hash,s)}})}m();m();m();m();m();m();var l$=[...` \r\f\xA0\v\uFEFF`];function c$(t,e,r){var i=t==null?"":""+t;if(e&&(i=i?i+" "+e:e),r){for(var n of Object.keys(r))if(r[n])i=i?i+" "+n:n;else if(i.length)for(var s=n.length,a=0;(a=i.indexOf(n,a))>=0;){var o=a+s;(a===0||l$.includes(i[a-1]))&&(o===i.length||l$.includes(i[o]))?i=(a===0?"":i.substring(0,a))+i.substring(o+1):a=o}}return i===""?null:i}m();function ft(t,e,r,i,n,s){var a=t[Ju];if(se||a!==r||a===void 0){var o=c$(r,i,s);(!se||o!==t.getAttribute("class"))&&(o==null?t.removeAttribute("class"):e?t.className=o:t.setAttribute("class",o)),t[Ju]=r}else if(s&&n!==s)for(var l in s){var c=!!s[l];(n==null||c!==!!n[l])&&t.classList.toggle(l,c)}return s}m();m();var VU=Symbol("is custom element"),zU=Symbol("is html"),WU=m0?"link":"LINK";function ye(t,e,r,i){var n=qU(t);if(se&&(n[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName===WU)){i||ZU(t,e,r!=null?r:"");return}n[e]!==(n[e]=r)&&(e==="loading"&&(t[$P]=r),r==null?t.removeAttribute(e):typeof r!="string"&&YU(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function qU(t){var e,r;return(r=t[e=fp])!=null?r:t[e]={[VU]:t.nodeName.includes("-"),[zU]:t.namespaceURI===ap}}var u$=new Map;function YU(t){var e=t.getAttribute("is")||t.nodeName,r=u$.get(e);if(r)return r;u$.set(e,r=[]);for(var i,n=t,s=Element.prototype;s!==n;){i=c0(n);for(var a in i)i[a].set&&a!=="innerHTML"&&a!=="textContent"&&a!=="innerText"&&r.push(a);n=ql(n)}return r}function ZU(t,e,r){var i;O&&(e==="srcset"&&KU(t,r)||nb((i=t.getAttribute(e))!=null?i:"",r)||XP(e,t.outerHTML.replace(t.innerHTML,t.innerHTML&&"..."),String(r)))}function nb(t,e){return t===e?!0:new URL(t,document.baseURI).href===new URL(e,document.baseURI).href}function f$(t){return t.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function KU(t,e){var r=f$(t.srcset),i=f$(e);return i.length===r.length&&i.every(([n,s],a)=>s===r[a][1]&&(nb(r[a][0],n)||nb(n,r[a][0])))}m();m();m();function ob(t,e,r=e){var i=new WeakSet;S0(t,"input",async n=>{O&&t.type==="checkbox"&&g0();var s=n?t.defaultValue:t.value;if(s=sb(t)?ab(s):s,r(s),le!==null&&i.add(le),await Lp(),s!==(s=e())){var a=t.selectionStart,o=t.selectionEnd,l=t.value.length;if(t.value=s!=null?s:"",o!==null){var c=t.value.length;a===o&&o===l&&c>l?(t.selectionStart=c,t.selectionEnd=c):(t.selectionStart=a,t.selectionEnd=Math.min(o,c))}}}),(se&&t.defaultValue!==t.value||Je(e)==null&&t.value)&&(r(sb(t)?ab(t.value):t.value),le!==null&&i.add(le)),lr(()=>{O&&t.type==="checkbox"&&g0();var n=e();if(t===document.activeElement){var s=Ft?ps:le;if(i.has(s))return}sb(t)&&n===ab(t.value)||t.type==="date"&&!n&&!t.value||n!==t.value&&(t.value=n!=null?n:"")})}function sb(t){var e=t.type;return e==="number"||e==="range"}function ab(t){return t===""?null:+t}m();m();m();m();m();function lb(t,e){return t===e||(t==null?void 0:t[rr])===e}function ot(t={},e,r,i){var n=Ee.r,s=ee;return ei(()=>{var a,o;return lr(()=>{a=o,o=(i==null?void 0:i())||[],Je(()=>{lb(r(...o),t)||(e(t,...o),a&&lb(r(...a),t)&&e(null,...a))})}),()=>{let l=s;for(;l!==n&&l.parent!==null&&l.parent.f&33554432;)l=l.parent;let c=()=>{o&&lb(r(...o),t)&&e(null,...o)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),t}m();m();m();m();m();m();function Bi(t,e,r,i){var x,E;var n=!cs||(r&2)!==0,s=(r&8)!==0,a=(r&16)!==0,o=i,l=!0,c=void 0,u=()=>a&&n?(c!=null||(c=ea(i)),F(c)):(l&&(l=!1,o=a?Je(i):i),o);let f;if(s){var d=rr in t||Qu in t;f=(E=(x=qr(t,e))==null?void 0:x.set)!=null?E:d&&e in t?A=>t[e]=A:void 0}var h,p=!1;s?[h,p]=y0(()=>t[e]):h=t[e],h===void 0&&i!==void 0&&(h=u(),f&&(n&&GP(e),f(h)));var g;if(n?g=()=>{var A=t[e];return A===void 0?u():(l=!0,A)}:g=()=>{var A=t[e];return A!==void 0&&(o=void 0),A===void 0?o:A},n&&(r&4)===0)return g;if(f){var v=t.$$legacy;return(function(A,w){return arguments.length>0?((!n||!w||v||p)&&f(w?g():A),A):g()})}var b=!1,_=((r&1)!==0?ea:no)(()=>(b=!1,g()));O&&(_.label=e),s&&F(_);var C=ee;return(function(A,w){if(arguments.length>0){let S=w?F(_):n&&s?nt(A):A;return ae(_,S),b=!0,o!==void 0&&(o=S),A}return di&&b||(C.f&16384)!==0?_.v:F(_)})}m();m();m();function h$(t){return new ub(t)}var xs,Hi,ub=class{constructor(e){ge(this,xs);ge(this,Hi);var s,a;var r=new Map,i=(o,l)=>{var c=Ja(l,!1,!1);return r.set(o,c),c};let n=new Proxy({...e.props||{},$$events:{}},{get(o,l){var c;return F((c=r.get(l))!=null?c:i(l,Reflect.get(o,l)))},has(o,l){var c;return l===Qu?!0:(F((c=r.get(l))!=null?c:i(l,Reflect.get(o,l))),Reflect.has(o,l))},set(o,l,c){var u;return ae((u=r.get(l))!=null?u:i(l,c),c),Reflect.set(o,l,c)}});de(this,Hi,(e.hydrate?tb:na)(e.component,{target:e.target,anchor:e.anchor,props:n,context:e.context,intro:(s=e.intro)!=null?s:!1,recover:e.recover,transformError:e.transformError})),!Ft&&(!((a=e==null?void 0:e.props)!=null&&a.$$host)||e.sync===!1)&&co(),de(this,xs,n.$$events);for(let o of Object.keys($(this,Hi)))o==="$set"||o==="$destroy"||o==="$on"||fr(this,o,{get(){return $(this,Hi)[o]},set(l){$(this,Hi)[o]=l},enumerable:!0});$(this,Hi).$set=o=>{Object.assign(n,o)},$(this,Hi).$destroy=()=>{_s($(this,Hi))}}$set(e){$(this,Hi).$set(e)}$on(e,r){$(this,xs)[e]=$(this,xs)[e]||[];let i=(...n)=>r.call(this,...n);return $(this,xs)[e].push(i),()=>{$(this,xs)[e]=$(this,xs)[e].filter(n=>n!==i)}}$destroy(){$(this,Hi).$destroy()}};xs=new WeakMap,Hi=new WeakMap;var cG;typeof HTMLElement=="function"&&(cG=class extends HTMLElement{constructor(e,r,i){super();Ue(this,"$$ctor");Ue(this,"$$s");Ue(this,"$$c");Ue(this,"$$cn",!1);Ue(this,"$$d",{});Ue(this,"$$r",!1);Ue(this,"$$p_d",{});Ue(this,"$$l",{});Ue(this,"$$l_u",new Map);Ue(this,"$$me");Ue(this,"$$shadowRoot",null);this.$$ctor=e,this.$$s=r,i&&(this.$$shadowRoot=this.attachShadow(i))}addEventListener(e,r,i){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(r),this.$$c){let n=this.$$c.$on(e,r);this.$$l_u.set(r,n)}super.addEventListener(e,r,i)}removeEventListener(e,r,i){if(super.removeEventListener(e,r,i),this.$$c){let n=this.$$l_u.get(r);n&&(n(),this.$$l_u.delete(r))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(n){return s=>{let a=Bn("slot");n!=="default"&&(a.name=n),ue(s,a)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let r={},i=uG(this);for(let n of this.$$s)n in i&&(n==="default"&&!this.$$d.children?(this.$$d.children=e(n),r.default=!0):r[n]=e(n));for(let n of this.attributes){let s=this.$$g_p(n.name);s in this.$$d||(this.$$d[s]=fb(s,n.value,this.$$p_d,"toProp"))}for(let n in this.$$p_d)!(n in this.$$d)&&this[n]!==void 0&&(this.$$d[n]=this[n],delete this[n]);this.$$c=h$({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:r,$$host:this}}),this.$$me=Y0(()=>{lr(()=>{var n;this.$$r=!0;for(let s of l0(this.$$c)){if(!((n=this.$$p_d[s])!=null&&n.reflect))continue;this.$$d[s]=this.$$c[s];let a=fb(s,this.$$d[s],this.$$p_d,"toAttribute");a==null?this.removeAttribute(this.$$p_d[s].attribute||s):this.setAttribute(this.$$p_d[s].attribute||s,a)}this.$$r=!1})});for(let n in this.$$l)for(let s of this.$$l[n]){let a=this.$$c.$on(n,s);this.$$l_u.set(s,a)}this.$$l={}}}attributeChangedCallback(e,r,i){var n;this.$$r||(e=this.$$g_p(e),this.$$d[e]=fb(e,i,this.$$p_d,"toProp"),(n=this.$$c)==null||n.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return l0(this.$$p_d).find(r=>this.$$p_d[r].attribute===e||!this.$$p_d[r].attribute&&r.toLowerCase()===e)||e}});function fb(t,e,r,i){var s;let n=(s=r[t])==null?void 0:s.type;if(e=n==="Boolean"&&typeof e!="boolean"?e!=null:e,!i||!r[t])return e;if(i==="toAttribute")switch(n){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(n){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function uG(t){let e={};return t.childNodes.forEach(r=>{e[r.slot||"default"]=!0}),e}m();var mb=require("obsidian");m();var hb=require("obsidian");m();function fG(t){let e=t-1;return e*e*e+1}var db=!1;function Vn(t,{delay:e=0,duration:r=400,easing:i=fG,axis:n="y"}={}){let s=getComputedStyle(t);O&&!db&&/(contents|inline|table)/.test(s.display)&&(db=!0,Promise.resolve().then(()=>db=!1),tR(s.display));let a=+s.opacity,o=n==="y"?"height":"width",l=parseFloat(s[o]),c=n==="y"?["top","bottom"]:["left","right"],u=c.map(b=>`${b[0].toUpperCase()}${b.slice(1)}`),f=parseFloat(s[`padding${u[0]}`]),d=parseFloat(s[`padding${u[1]}`]),h=parseFloat(s[`margin${u[0]}`]),p=parseFloat(s[`margin${u[1]}`]),g=parseFloat(s[`border${u[0]}Width`]),v=parseFloat(s[`border${u[1]}Width`]);return{delay:e,duration:r,easing:i,css:b=>`overflow: hidden;opacity: ${Math.min(b*20,1)*a};${o}: ${b*l}px;padding-${c[0]}: ${b*f}px;padding-${c[1]}: ${b*d}px;margin-${c[0]}: ${b*h}px;margin-${c[1]}: ${b*p}px;border-${c[0]}-width: ${b*g}px;border-${c[1]}-width: ${b*v}px;min-${o}: 0`}}m();var zp=require("obsidian");var dG=_e('
'),hG=_e('
'),pG={hash:"svelte-1c0jiav",code:"main.svelte-1c0jiav .nav-file-title:where(.svelte-1c0jiav) {align-items:center;}"};function Ef(t,e){ht(e,!0),fn(t,pG);let r=nt([]),i=Le(()=>Hr(e.view.leaf));vr(()=>{for(let _ of r)_&&(0,zp.setIcon)(_,_.getAttr("data-icon"))});function n(_){_.stopPropagation(),ul(e.diff.path)?s(_):a(_)}function s(_){var x;_.stopPropagation();let C=e.view.app.vault.getAbstractFileByPath(e.diff.vaultPath);C instanceof zp.TFile&&((x=Yi(e.view.app,_))==null||x.openFile(C).catch(E=>e.view.plugin.displayError(E)))}function a(_){var C;e.view.plugin.tools.openDiff({event:_,aFile:(C=e.diff.fromPath)!=null?C:e.diff.path,aRef:`${e.diff.hash}^`,bFile:e.diff.path,bRef:e.diff.hash})}var o=hG(),l=V(o),c=V(l),u=V(c,!0);G(c);var f=ne(c,2),d=V(f),h=V(d);{var p=_=>{var C=dG();ot(C,x=>r[0]=x,()=>r==null?void 0:r[0]),mi("auxclick",C,s),me("click",C,s),ue(_,C)},g=Le(()=>fl(e.diff.vaultPath,e.view.app));$e(h,_=>{F(g)&&_(p)})}G(d);var v=ne(d,2),b=V(v,!0);G(v),G(f),G(l),G(o),Ve(_=>{ye(l,"data-path",e.diff.vaultPath),ye(l,"data-tooltip-position",F(i)),ye(l,"aria-label",e.diff.vaultPath),Ye(u,_),ye(v,"data-type",e.diff.status),Ye(b,e.diff.status)},[()=>kn(e.diff.vaultPath)]),me("click",o,n),mi("auxclick",o,_=>{_.stopPropagation(),_.button==2?Sn(e.view.app,_,e.diff.vaultPath,e.view.leaf,"git-history"):n(_)}),ue(t,o),pt()}Mt(["click"]);m();var mG=_e("
"),gG=_e(''),vG=_e('
'),wG=_e("
"),bG={hash:"svelte-d9h7mp",code:"main.svelte-d9h7mp .nav-folder-title-content:where(.svelte-d9h7mp) {display:flex;align-items:center;}"};function Sf(t,e){ht(e,!0),fn(t,bG);let r=Bi(e,"topLevel",3,!1),i=Bi(e,"closed",15),n=Le(()=>Hr(e.view.leaf));function s(l,c){l.stopPropagation(),i(i()[c.path]=!i()[c.path],!0)}var a=wG();let o;wi(a,21,()=>e.hierarchy.children,vi,(l,c)=>{var u=po(),f=Ni(u);{var d=p=>{var g=mG(),v=V(g);Ef(v,{get diff(){return F(c).data},get view(){return e.view}}),G(g),ue(p,g)},h=p=>{var g=vG();let v;var b=V(g),_=ne(V(b),2);let C;var x=ne(_,2),E=V(x,!0);G(x),G(b);var A=ne(b,2);{var w=S=>{var y=gG(),P=V(y);Sf(P,{get hierarchy(){return F(c)},get plugin(){return e.plugin},get view(){return e.view},get closed(){return i()},set closed(T){i(T)}}),G(y),un(3,y,()=>Vn,()=>({duration:150})),ue(S,y)};$e(A,S=>{i()[F(c).path]||S(w)})}G(g),Ve(()=>{v=ft(g,1,"tree-item nav-folder",null,v,{"is-collapsed":i()[F(c).path]}),ye(b,"data-tooltip-position",F(n)),ye(b,"aria-label",F(c).vaultPath),C=ft(_,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,C,{"is-collapsed":i()[F(c).path]}),Ye(E,F(c).title)}),me("click",b,S=>s(S,F(c))),ue(p,g)};$e(f,p=>{F(c).data?p(d):p(h,-1)})}ue(l,u)}),G(a),Ve(()=>o=ft(a,1,"svelte-d9h7mp",null,o,{topLevel:r()})),ue(t,a),pt()}Mt(["click"]);var _G=_e('
'),yG=_e('
'),xG=_e('
'),EG=_e(''),SG=_e('
'),kG={hash:"svelte-1edsiy5",code:""};function pb(t,e){ht(e,!0),fn(t,kG);let r=Le(()=>({title:"",path:"",vaultPath:"",children:e.plugin.gitManager.getTreeStructure(e.log.diff.files)})),i=Le(()=>Hr(e.view.leaf)),n=Ne(!0),s=Ne(nt({}));function a(S){let y=S.author.name;return e.plugin.settings.authorInHistoryView=="full"?y:e.plugin.settings.authorInHistoryView=="initials"?y.split(" ").filter(T=>T.length>0).map(T=>T[0].toUpperCase()).join(""):""}var o=SG(),l=V(o);let c;var u=V(l),f=V(u);let d;var h=ne(f,2),p=V(h);{var g=S=>{var y=_G(),P=V(y,!0);G(y),Ve(T=>Ye(P,T),[()=>e.log.refs.join(", ")]),ue(S,y)};$e(p,S=>{e.log.refs.length>0&&S(g)})}var v=ne(p,2);{var b=S=>{var y=yG(),P=V(y,!0);G(y),Ve(T=>Ye(P,T),[()=>a(e.log)]),ue(S,y)};$e(v,S=>{var y;e.plugin.settings.authorInHistoryView!="hide"&&((y=e.log.author)!=null&&y.name)&&S(b)})}var _=ne(v,2);{var C=S=>{var y=xG(),P=V(y,!0);G(y),Ve(T=>Ye(P,T),[()=>(0,hb.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)]),ue(S,y)};$e(_,S=>{e.plugin.settings.dateInHistoryView&&S(C)})}var x=ne(_,2),E=V(x,!0);G(x),G(h),G(u);var A=ne(u,2);{var w=S=>{var y=EG(),P=V(y);{var T=M=>{Sf(M,{get hierarchy(){return F(r)},get plugin(){return e.plugin},get view(){return e.view},topLevel:!0,get closed(){return F(s)},set closed(B){ae(s,B,!0)}})},I=M=>{var B=po(),re=Ni(B);wi(re,17,()=>e.log.diff.files,vi,(Ae,K)=>{Ef(Ae,{get view(){return e.view},get diff(){return F(K)}})}),ue(M,B)};$e(P,M=>{e.showTree?M(T):M(I,-1)})}G(y),un(3,y,()=>Vn,()=>({duration:150})),ue(S,y)};$e(A,S=>{F(n)||S(w)})}G(l),G(o),Ve(S=>{c=ft(l,1,"tree-item nav-folder",null,c,{"is-collapsed":F(n)}),ye(u,"aria-label",S),ye(u,"data-tooltip-position",F(i)),d=ft(f,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,d,{"is-collapsed":F(n)}),Ye(E,e.log.message)},[()=>{var S;return`${e.log.refs.length>0?e.log.refs.join(", ")+` `:""}${(S=e.log.author)==null?void 0:S.name} ${(0,hb.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)} ${e.log.message}`}]),me("click",u,()=>ae(n,!F(n))),ue(t,o),pt()}Mt(["click"]);var CG=_e(''),AG=_e('
'),TG={hash:"svelte-12n6twc",code:""};function gb(t,e){ht(e,!0),fn(t,TG);let r=Bi(e,"plugin",15),i=Ne(!1),n=nt([]),s=Ne(void 0),a=Ne(nt(r().settings.treeStructure)),o;vr(()=>{o&&o.empty()}),go(()=>{e.view.registerEvent(e.view.app.workspace.on("obsidian-git:head-change",()=>{c().catch(console.error)}))}),vr(()=>{n.forEach(x=>(0,mb.setIcon)(x,x.getAttr("data-icon")))}),go(()=>{let x=new IntersectionObserver(A=>{var w;(w=A[0])!=null&&w.isIntersecting&&!F(i)&&u().catch(console.error)}),E=activeDocument.querySelector("#sentinel");return E&&x.observe(E),()=>{x.disconnect()}}),c().catch(console.error);function l(){c().catch(console.error)}async function c(){var A,w;if(!r().gitReady){ae(s,void 0);return}ae(i,!0);let x=r().gitManager instanceof ke,E;((w=(A=F(s))==null?void 0:A.length)!=null?w:0)==0?E=x?50:10:E=F(s).length,ae(s,await r().gitManager.log(void 0,!1,E),!0),ae(i,!1)}async function u(){var w;if(!r().gitReady||F(s)===void 0)return;ae(i,!0);let E=r().gitManager instanceof ke?50:10,A=await r().gitManager.log(void 0,!1,E,(w=F(s).last())==null?void 0:w.hash);F(s).push(...A.slice(1)),ae(i,!1)}var f=AG(),d=V(f),h=V(d),p=V(h);ot(p,x=>n[0]=x,()=>n==null?void 0:n[0]);var g=ne(p,2);let v;ot(g,x=>n[1]=x,()=>n==null?void 0:n[1]),G(h),G(d);var b=ne(d,2),_=V(b);{var C=x=>{var E=CG();wi(E,21,()=>F(s),vi,(A,w)=>{pb(A,{get view(){return e.view},get showTree(){return F(a)},get log(){return F(w)},get plugin(){return r()}})}),G(E),ue(x,E)};$e(_,x=>{F(s)&&x(C)})}Ka(4),G(b),G(f),Ve(()=>{ye(p,"data-icon",F(a)?"list":"folder"),v=ft(g,1,"clickable-icon nav-action-button",null,v,{loading:F(i)})}),me("click",p,()=>{ae(a,!F(a)),(0,mb.setIcon)(n[0],F(a)?"list":"folder"),r(r().settings.treeStructure=F(a),!0),r().saveSettings()}),me("click",g,l),ue(t,f),pt()}Mt(["click"]);var kf=class extends p$.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return Ei.type}getDisplayText(){return Ei.name}getIcon(){return Ei.icon}async onClose(){return this._view&&await _s(this._view),super.onClose()}async reload(){this._view&&await _s(this._view),this._view=na(gb,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}async onOpen(){return await this.reload(),super.onOpen()}};m();var m$=require("obsidian"),Wp=class extends m$.FuzzySuggestModal{constructor(r,i){super(r.app);this.branches=i;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(r){return r}onChooseItem(r,i){this.resolve(r)}openAndGetReslt(){return new Promise(r=>{this.resolve=r,this.open()})}onClose(){new Promise(r=>window.setTimeout(r,10)).then(()=>{this.resolve&&this.resolve(void 0)})}};m();var w$=require("obsidian");m();var zn=require("obsidian");m();var Cf=require("obsidian");m();var g$=require("obsidian");var vc=class extends g$.Modal{constructor({app:r,path:i,filesToDeleteCount:n,filesToDiscardCount:s}){super(r);this.resolve=null;this.path=i,this.deleteCount=n,this.discardCount=s}openAndGetResult(){return this.open(),new Promise(r=>{this.resolve=r})}onOpen(){let r=this.deleteCount+this.discardCount,{contentEl:i,titleEl:n}=this,s="";this.path!=""&&(r>1?s=`files in "${this.path}"`:s=`"${this.path}"`),n.setText(`${this.discardCount==0?"Delete":"Discard"} ${s}`),this.deleteCount>0&&i.createEl("p").setText(`Are you sure you want to DELETE the ${xu(this.deleteCount,"untracked file")}? They are deleted according to your Obsidian trash settting.`),this.discardCount>0&&i.createEl("p").setText(`Are you sure you want to discard ALL changes in ${xu(this.discardCount,"tracked file")}?`);let a=i.createDiv({cls:"modal-button-container"});if(this.deleteCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`${this.discardCount>0?"Discard":"Delete"} all ${xu(r,"file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("delete"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("delete"),this.close()})}if(this.discardCount>0){let l=a.createEl("button",{cls:"mod-warning",text:`Discard all ${xu(this.discardCount,"tracked file")}`});l.addEventListener("click",()=>{this.resolve&&this.resolve("discard"),this.close()}),l.addEventListener("keypress",()=>{this.resolve&&this.resolve("discard"),this.close()})}let o=a.createEl("button",{text:"Cancel"});o.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),o.addEventListener("keypress",()=>(this.resolve&&this.resolve(!1),this.close()))}onClose(){let{contentEl:r}=this;r.empty()}};var PG=_e('
'),RG=_e('
');function Af(t,e){ht(e,!0);let r=nt([]),i=Le(()=>Hr(e.view.leaf));vr(()=>{for(let w of r)w&&(0,Cf.setIcon)(w,w.getAttr("data-icon"))});function n(w){w.stopPropagation(),ul(e.change.path)?a(w):l(w)}function s(w){e.view.app.vault.getAbstractFileByPath(e.change.vaultPath)&&dl(e.view.app,w,e.view,e.change.vaultPath)}function a(w){var y;w.stopPropagation();let S=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);S instanceof Cf.TFile&&((y=Yi(e.view.app,w))==null||y.openFile(S).catch(P=>e.view.plugin.displayError(P)))}function o(w){w.stopPropagation(),e.manager.stage(e.change.path,!1).catch(S=>e.view.plugin.displayError(S)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function l(w){w.stopPropagation(),e.view.plugin.tools.openDiff({aFile:e.change.path,aRef:"",event:w})}function c(w){w.stopPropagation();let S=e.change.workingDir=="U";new vc({app:e.view.app,filesToDeleteCount:S?1:0,filesToDiscardCount:S?0:1,path:e.change.vaultPath}).openAndGetResult().then(async y=>{if(y=="delete"){let P=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);P instanceof Cf.TFile?await e.view.app.fileManager.trashFile(P):await e.view.app.vault.adapter.remove(e.change.vaultPath)}else y=="discard"&&await e.manager.discard(e.change.path).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")});e.view.app.workspace.trigger("obsidian-git:refresh")},y=>e.view.plugin.displayError(y))}var u=RG(),f=V(u),d=V(f),h=V(d,!0);G(d);var p=ne(d,2),g=V(p),v=V(g);{var b=w=>{var S=PG();ot(S,y=>r[0]=y,()=>r==null?void 0:r[0]),mi("auxclick",S,a),me("click",S,a),ue(w,S)},_=Le(()=>fl(e.change.vaultPath,e.view.app));$e(v,w=>{F(_)&&w(b)})}var C=ne(v,2);ot(C,w=>r[1]=w,()=>r==null?void 0:r[1]);var x=ne(C,2);ot(x,w=>r[2]=w,()=>r==null?void 0:r[2]),G(g);var E=ne(g,2),A=V(E,!0);G(E),G(p),G(f),G(u),Ve(w=>{ye(f,"data-path",e.change.vaultPath),ye(f,"data-tooltip-position",F(i)),ye(f,"aria-label",e.change.vaultPath),Ye(h,w),ye(E,"data-type",e.change.workingDir),Ye(A,e.change.workingDir)},[()=>kn(e.change.vaultPath)]),me("mouseover",u,s),me("click",u,n),mi("auxclick",u,w=>{w.stopPropagation(),w.button==2?Sn(e.view.app,w,e.change.vaultPath,e.view.leaf,"git-source-control"):n(w)}),me("click",C,c),me("click",x,o),ue(t,u),pt()}Mt(["mouseover","click"]);m();var v$=require("obsidian");var $G=_e('
');function Tf(t,e){ht(e,!0);let r=Le(()=>Hr(e.view.leaf));function i(d){e.view.app.vault.getAbstractFileByPath(e.change.vaultPath)&&dl(e.view.app,d,e.view,e.change.vaultPath)}function n(d){var p;d.stopPropagation();let h=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);h instanceof v$.TFile&&((p=Yi(e.view.app,d))==null||p.openFile(h).catch(g=>e.view.plugin.displayError(g)))}var s=$G(),a=V(s),o=V(a),l=V(o,!0);G(o);var c=ne(o,2),u=V(c),f=V(u,!0);G(u),G(c),G(a),G(s),Ve(d=>{ye(a,"data-path",e.change.vaultPath),ye(a,"data-tooltip-position",F(r)),ye(a,"aria-label",e.change.vaultPath),Ye(l,d),ye(u,"data-type",e.change.workingDir),Ye(f,e.change.workingDir)},[()=>kn(e.change.vaultPath)]),me("mouseover",s,i),me("click",s,n),mi("auxclick",s,d=>{d.stopPropagation(),d.button==2?Sn(e.view.app,d,e.change.vaultPath,e.view.leaf,"git-source-control"):n(d)}),ue(t,s),pt()}Mt(["mouseover","click"]);m();var qp=require("obsidian");var FG=_e('
'),IG=_e('
');function Pf(t,e){ht(e,!0);let r=nt([]),i=Le(()=>Hr(e.view.leaf));vr(()=>{for(let E of r)E&&(0,qp.setIcon)(E,E.getAttr("data-icon"))});function n(E){E.stopPropagation(),ul(e.change.path)?a(E):o(E)}function s(E){e.view.app.vault.getFileByPath(e.change.vaultPath)&&dl(e.view.app,E,e.view,e.change.vaultPath)}function a(E){var w;E.stopPropagation();let A=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);A instanceof qp.TFile&&((w=Yi(e.view.app,E))==null||w.openFile(A).catch(S=>e.view.plugin.displayError(S)))}function o(E){var A;E.stopPropagation(),e.view.plugin.tools.openDiff({aFile:(A=e.change.from)!=null?A:e.change.path,bFile:e.change.path,aRef:"HEAD",bRef:"",event:E})}function l(E){E.stopPropagation(),e.manager.unstage(e.change.path,!1).catch(A=>e.view.plugin.displayError(A)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}var c=IG(),u=V(c),f=V(u),d=V(f,!0);G(f);var h=ne(f,2),p=V(h),g=V(p);{var v=E=>{var A=FG();ot(A,w=>r[0]=w,()=>r==null?void 0:r[0]),me("click",A,a),ue(E,A)},b=Le(()=>fl(e.change.vaultPath,e.view.app));$e(g,E=>{F(b)&&E(v)})}var _=ne(g,2);ot(_,E=>r[1]=E,()=>r==null?void 0:r[1]),G(p);var C=ne(p,2),x=V(C,!0);G(C),G(h),G(u),G(c),Ve(E=>{ye(u,"data-path",e.change.vaultPath),ye(u,"data-tooltip-position",F(i)),ye(u,"aria-label",e.change.vaultPath),Ye(d,E),ye(C,"data-type",e.change.index),Ye(x,e.change.index)},[()=>kn(e.change.vaultPath)]),me("mouseover",c,s),me("click",c,n),mi("auxclick",c,E=>{E.stopPropagation(),E.button==2?Sn(e.view.app,E,e.change.vaultPath,e.view.leaf,"git-source-control"):n(E)}),me("click",_,l),ue(t,c),pt()}Mt(["mouseover","click"]);m();m();var MG=_e(''),DG=_e("
");function vo(t,e){ht(e,!0);var r=DG(),i=V(r);{var n=s=>{var a=MG(),o=V(a),l=V(o),c=V(l,!0);G(l),G(o),G(a),Ve(()=>{ye(o,"aria-label","And "+(e.files.length-500)+" more files"),Ye(c,"And "+(e.files.length-500)+" more files")}),ue(s,a)};$e(i,s=>{e.files.length>500&&s(n)})}G(r),ue(t,r),pt()}var LG=_e("
"),NG=_e('
'),BG=_e('
',1),HG=_e(''),UG=_e('
'),GG=_e("
");function wo(t,e){ht(e,!0);let r=Bi(e,"topLevel",3,!1),i=Bi(e,"closed",15);go(()=>{var h,p;for(let g of e.hierarchy.children)((p=(h=g.children)==null?void 0:h.length)!=null?p:0)>100&&i(i()[g.title]=!0,!0)});let n=Le(()=>Hr(e.view.leaf));function s(h,p){h.stopPropagation(),e.plugin.gitManager.stageAll({dir:p}).catch(g=>e.plugin.displayError(g)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function a(h,p){h.stopPropagation(),e.plugin.gitManager.unstageAll({dir:p}).catch(g=>e.plugin.displayError(g)).finally(()=>{e.view.app.workspace.trigger("obsidian-git:refresh")})}function o(h,p){h.stopPropagation(),e.plugin.discardAll(p.vaultPath)}function l(h,p){h.stopPropagation(),i(i()[p.path]=!i()[p.path],!0)}var c=GG();let u;var f=V(c);wi(f,17,()=>Eu(e.hierarchy.children,500),vi,(h,p)=>{var g=po(),v=Ni(g);{var b=C=>{var x=LG(),E=V(x);{var A=y=>{Pf(y,{get change(){return F(p).data},get manager(){return e.plugin.gitManager},get view(){return e.view}})},w=y=>{Af(y,{get change(){return F(p).data},get manager(){return e.plugin.gitManager},get view(){return e.view}})},S=y=>{Tf(y,{get change(){return F(p).data},get view(){return e.view}})};$e(E,y=>{e.fileType==0?y(A):e.fileType==1?y(w,1):e.fileType==2&&y(S,2)})}G(x),ue(C,x)},_=C=>{var x=UG();let E;var A=V(x),w=ne(V(A),2);let S;var y=ne(w,2),P=V(y,!0);G(y);var T=ne(y,2),I=V(T),M=V(I);{var B=Q=>{var fe=NG();me("click",fe,ce=>a(ce,F(p).path)),ue(Q,fe)},re=Q=>{var fe=BG(),ce=Ni(fe),z=ne(ce,2);me("click",ce,X=>o(X,F(p))),me("click",z,X=>s(X,F(p).path)),ue(Q,fe)};$e(M,Q=>{e.fileType==0?Q(B):Q(re,-1)})}Ka(2),G(I),G(T),G(A);var Ae=ne(A,2);{var K=Q=>{var fe=HG(),ce=V(fe);wo(ce,{get hierarchy(){return F(p)},get plugin(){return e.plugin},get view(){return e.view},get fileType(){return e.fileType},get closed(){return i()},set closed(z){i(z)}}),G(fe),un(3,fe,()=>Vn,()=>({duration:150})),ue(Q,fe)};$e(Ae,Q=>{i()[F(p).path]||Q(K)})}G(x),Ve(()=>{E=ft(x,1,"tree-item nav-folder",null,E,{"is-collapsed":i()[F(p).path]}),ye(A,"data-tooltip-position",F(n)),ye(A,"aria-label",F(p).vaultPath),S=ft(w,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,S,{"is-collapsed":i()[F(p).path]}),Ye(P,F(p).title)}),mi("auxclick",x,Q=>Sn(e.view.app,Q,F(p).vaultPath,e.view.leaf,"git-source-control")),me("click",A,Q=>l(Q,F(p))),ue(C,x)};$e(v,C=>{F(p).data?C(b):C(_,-1)})}ue(h,g)});var d=ne(f,2);vo(d,{get files(){return e.hierarchy.children}}),G(c),Ve(()=>u=ft(c,1,"",null,u,{topLevel:r()})),ue(t,c),pt()}Mt(["click"]);var jG=_e('
'),vb=_e(" ",1),wb=_e(''),VG=_e('
'),zG=_e(''),WG=_e('
'),qG={hash:"svelte-5wq9p",code:`.commit-action-group.svelte-5wq9p {display:inline-flex;flex:0 0 auto;gap:0;overflow:hidden;border:1px solid var(--background-modifier-border);border-radius:var(--radius-s);}.commit-action-group.svelte-5wq9p .nav-action-button:where(.svelte-5wq9p) {margin:0;border-radius:0;}.commit-action-group.svelte-5wq9p .nav-action-button:where(.svelte-5wq9p) + .nav-action-button:where(.svelte-5wq9p) {border-left:1px solid var(--background-modifier-border);}.commit-action-group.svelte-5wq9p #commit-menu:where(.svelte-5wq9p) {width:var(--size-4-5);padding-right:0;padding-left:0;}.commit-msg-input.svelte-5wq9p {width:100%;overflow:hidden;resize:none;padding:7px 5px;background-color:var(--background-modifier-form-field);}.git-commit-msg.svelte-5wq9p {position:relative;padding:0;width:calc(100% - var(--size-4-8));margin:4px auto;}main.svelte-5wq9p .git-tools:where(.svelte-5wq9p) .files-count:where(.svelte-5wq9p) {padding-left:var(--size-2-1);width:11px;display:flex;align-items:center;justify-content:center;}.nav-folder-title.svelte-5wq9p {align-items:center;}.git-commit-msg-clear-button.svelte-5wq9p {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-5wq9p: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 bb(t,e){ht(e,!0),fn(t,qG);let r=Bi(e,"plugin",7),i=Bi(e,"view",7),n=Ne(!1),s=Ne(void 0),a=Ne(nt([])),o=Le(()=>r().settings.commitMessage),l=nt([]),c=Ne(void 0),u=Ne(void 0),f=Ne(void 0),d=Ne(!0),h=Ne(!0),p=Ne(!0),g=Ne(0),v=Ne(nt({})),b=Ne(nt({})),_=Ne(nt({})),C=Le(()=>{var Z,De;return(De=(Z=F(s))==null?void 0:Z.staged.length)!=null?De:0}),x=Le(()=>{var Z,De;return(De=(Z=F(s))==null?void 0:Z.changed.length)!=null?De:0}),E=Le(()=>{var Z,De;return((De=(Z=F(s))==null?void 0:Z.conflicted.length)!=null?De:0)>0}),A=Le(()=>F(C)+F(x)>0),w=Le(()=>!M("smart")),S=Le(()=>!B("all")),y=Le(()=>I(!1)),P=Le(()=>I(!0)),T=Le(()=>r().settings.treeStructure);go(()=>{i().registerEvent(i().app.workspace.on("obsidian-git:loading-status",()=>ae(n,!0))),i().registerEvent(i().app.workspace.on("obsidian-git:status-changed",()=>{fe().catch(console.error)})),i().plugin.cachedStatus==null?i().plugin.refresh().catch(console.error):fe().catch(console.error),i().scope=new zn.Scope(r().app.scope),i().scope.register(["Ctrl"],"Enter",Z=>K())}),vr(()=>{l.forEach(Z=>(0,zn.setIcon)(Z,Z.getAttr("data-icon")))}),vr(()=>{l.forEach(Z=>{var De,Xt;!Z||Z.id!="push"||(zn.Platform.isMobile?(Z.removeClass("button-border"),F(g)>0&&Z.addClass("button-border")):((De=Z.firstElementChild)==null||De.removeAttribute("color"),F(g)>0&&((Xt=Z.firstElementChild)==null||Xt.setAttr("color","var(--text-accent)"))))})});function I(Z){let De=Z?" and sync":"";return F(E)?"Resolve conflicts before committing":F(A)?Z?"Commit all changes and sync":F(C)>0?`Commit ${F(C)} staged ${F(C)===1?"file":"files"}${De}`:r().settings.autoStageOnEmptyIndex?`Stage and commit all ${F(x)} changed ${F(x)===1?"file":"files"}${De}`:"Nothing staged \u2014 stage changes before committing":Z?"Sync (no changes to commit)":"No changes to commit"}function M(Z){return F(E)?!1:Z==="staged"?F(C)>0:Z==="all"?F(A):F(C)>0||r().settings.autoStageOnEmptyIndex&&F(x)>0}function B(Z){return F(E)?!1:Z==="all"||F(C)>0}function re(Z="smart"){M(Z)&&(ae(n,!0),F(s)&&r().promiseQueue.addTask(()=>r().commit({fromAuto:!1,commitMessage:F(o),mode:Z}).then(()=>ae(o,r().settings.commitMessage)).finally(ce)))}function Ae(){M("staged")&&(ae(n,!0),r().promiseQueue.addTask(()=>r().commit({fromAuto:!1,commitMessage:F(o),mode:"staged",amend:!0}).then(()=>ae(o,r().settings.commitMessage)).finally(ce)))}function K(Z="all"){B(Z)&&(ae(n,!0),F(s)&&r().promiseQueue.addTask(()=>r().commitAndSync({fromAutoBackup:!1,commitMessage:F(o),mode:Z}).then(()=>{ae(o,r().settings.commitMessage)}).finally(ce)))}function Q(Z){Z.stopPropagation();let De=zn.Menu.forEvent(Z);De.addItem(Xt=>Xt.setTitle("Commit staged").setIcon("git-commit").setDisabled(!M("staged")).onClick(()=>re("staged"))),De.addItem(Xt=>Xt.setTitle("Stage all and commit").setIcon("list-plus").setDisabled(!M("all")).onClick(()=>re("all"))),zn.Platform.isDesktopApp&&De.addItem(Xt=>Xt.setTitle("Amend staged").setIcon("git-commit").setDisabled(!M("staged")).onClick(Ae)),De.addSeparator(),De.addItem(Xt=>Xt.setTitle("Commit staged and sync").setIcon("arrow-up-circle").setDisabled(!M("staged")).onClick(()=>K("staged"))),De.showAtMouseEvent(Z)}async function fe(){if(!r().gitReady){ae(s,void 0);return}if(ae(g,await r().gitManager.getUnpushedCommits(),!0),ae(s,r().cachedStatus,!0),ae(n,!1),r().lastPulledFiles&&r().lastPulledFiles!=F(a)&&(ae(a,r().lastPulledFiles,!0),ae(f,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(F(a))},!0)),F(s)){let Z=(De,Xt)=>De.vaultPath.split("/").last().localeCompare(kn(Xt.vaultPath));F(s).changed.sort(Z),F(s).staged.sort(Z),ae(c,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(F(s).changed)},!0),ae(u,{title:"",path:"",vaultPath:"",children:r().gitManager.getTreeStructure(F(s).staged)},!0)}else ae(c,void 0),ae(u,void 0)}function ce(){i().app.workspace.trigger("obsidian-git:refresh")}function z(Z){Z.stopPropagation(),ae(n,!0),r().promiseQueue.addTask(()=>r().gitManager.stageAll({status:F(s)}).finally(ce))}function X(Z){Z.stopPropagation(),ae(n,!0),r().promiseQueue.addTask(()=>r().gitManager.unstageAll({status:F(s)}).finally(ce))}function j(){ae(n,!0),r().promiseQueue.addTask(()=>r().push().finally(ce))}function Ze(){ae(n,!0),r().promiseQueue.addTask(()=>r().pullChangesFromRemote().finally(ce))}function $r(Z){Z.stopPropagation(),r().discardAll()}let cr=Le(()=>(F(o).match(/\n/g)||[]).length+1||1);var Ie=WG(),yt=V(Ie),Tt=V(yt),Ke=V(Tt),J=V(Ke);let L;ot(J,Z=>l[0]=Z,()=>l==null?void 0:l[0]);var W=ne(J,2);let xe;ot(W,Z=>l[1]=Z,()=>l==null?void 0:l[1]);var Xe=ne(W,2);ot(Xe,Z=>l[10]=Z,()=>l==null?void 0:l[10]),G(Ke);var Dt=ne(Ke,2);ot(Dt,Z=>l[2]=Z,()=>l==null?void 0:l[2]);var ti=ne(Dt,2);ot(ti,Z=>l[3]=Z,()=>l==null?void 0:l[3]);var aa=ne(ti,2);ot(aa,Z=>l[4]=Z,()=>l==null?void 0:l[4]);var om=ne(aa,2);ot(om,Z=>l[5]=Z,()=>l==null?void 0:l[5]);var $f=ne(om,2);ot($f,Z=>l[6]=Z,()=>l==null?void 0:l[6]);var lm=ne($f,2);let Eb;ot(lm,Z=>l[7]=Z,()=>l==null?void 0:l[7]),G(Tt),G(yt);var cm=ne(yt,2),Ff=V(cm);x0(Ff);var C$=ne(Ff,2);{var A$=Z=>{var De=jG();ye(De,"aria-label","Clear"),me("click",De,()=>ae(o,"")),ue(Z,De)};$e(C$,Z=>{F(o)&&Z(A$)})}G(cm);var Sb=ne(cm,2),T$=V(Sb);{var P$=Z=>{var De=zG(),Xt=V(De);let kb;var If=V(Xt),Cb=V(If);let Ab;var Tb=ne(Cb,4),um=V(Tb),Pb=V(um);ot(Pb,wr=>l[8]=wr,()=>l==null?void 0:l[8]),G(um);var Rb=ne(um,2),R$=V(Rb,!0);G(Rb),G(Tb),G(If);var $$=ne(If,2);{var F$=wr=>{var Fr=wb(),yo=V(Fr);{var Es=br=>{wo(br,{get hierarchy(){return F(u)},get plugin(){return r()},get view(){return i()},get fileType(){return 0},topLevel:!0,get closed(){return F(v)},set closed(Ui){ae(v,Ui,!0)}})},xo=br=>{var Ui=vb(),oa=Ni(Ui);wi(oa,17,()=>Eu(F(s).staged,500),vi,(Ss,bc)=>{Pf(Ss,{get change(){return F(bc)},get view(){return i()},get manager(){return r().gitManager}})});var la=ne(oa,2);vo(la,{get files(){return F(s).staged}}),ue(br,Ui)};$e(yo,br=>{F(T)?br(Es):br(xo,-1)})}G(Fr),un(3,Fr,()=>Vn,()=>({duration:150})),ue(wr,Fr)};$e($$,wr=>{F(h)&&wr(F$)})}G(Xt);var Mf=ne(Xt,2);let $b;var Df=V(Mf),Fb=V(Df);let Ib;var Mb=ne(Fb,4),fm=V(Mb),Db=V(fm),Ob=ne(Db,2);ot(Ob,wr=>l[9]=wr,()=>l==null?void 0:l[9]),G(fm);var Lb=ne(fm,2),I$=V(Lb,!0);G(Lb),G(Mb),G(Df);var M$=ne(Df,2);{var D$=wr=>{var Fr=wb(),yo=V(Fr);{var Es=br=>{wo(br,{get hierarchy(){return F(c)},get plugin(){return r()},get view(){return i()},get fileType(){return 1},topLevel:!0,get closed(){return F(b)},set closed(Ui){ae(b,Ui,!0)}})},xo=br=>{var Ui=vb(),oa=Ni(Ui);wi(oa,17,()=>Eu(F(s).changed,500),vi,(Ss,bc)=>{Af(Ss,{get change(){return F(bc)},get view(){return i()},get manager(){return r().gitManager}})});var la=ne(oa,2);vo(la,{get files(){return F(s).changed}}),ue(br,Ui)};$e(yo,br=>{F(T)?br(Es):br(xo,-1)})}G(Fr),un(3,Fr,()=>Vn,()=>({duration:150})),ue(wr,Fr)};$e(M$,wr=>{F(d)&&wr(D$)})}G(Mf);var O$=ne(Mf,2);{var L$=wr=>{var Fr=VG();let yo;var Es=V(Fr),xo=ne(V(Es),4),br=V(xo,!0);G(xo),G(Es);var Ui=ne(Es,2);{var oa=la=>{var Ss=wb(),bc=V(Ss);{var N$=Eo=>{wo(Eo,{get hierarchy(){return F(f)},get plugin(){return r()},get view(){return i()},get fileType(){return 2},topLevel:!0,get closed(){return F(_)},set closed(Of){ae(_,Of,!0)}})},B$=Eo=>{var Of=vb(),Nb=Ni(Of);wi(Nb,17,()=>F(a),vi,(U$,G$)=>{Tf(U$,{get change(){return F(G$)},get view(){return i()}})});var H$=ne(Nb,2);vo(H$,{get files(){return F(a)}}),ue(Eo,Of)};$e(bc,Eo=>{F(T)?Eo(N$):Eo(B$,-1)})}G(Ss),un(3,Ss,()=>Vn,()=>({duration:150})),ue(la,Ss)};$e(Ui,la=>{F(p)&&la(oa)})}G(Fr),Ve(()=>{yo=ft(Fr,1,"pulled nav-folder",null,yo,{"is-collapsed":!F(p)}),Ye(br,F(a).length)}),me("click",Es,()=>ae(p,!F(p))),ue(wr,Fr)};$e(O$,wr=>{F(a).length>0&&F(f)&&wr(L$)})}G(De),Ve(()=>{kb=ft(Xt,1,"staged tree-item nav-folder",null,kb,{"is-collapsed":!F(h)}),Ab=ft(Cb,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,Ab,{"is-collapsed":!F(h)}),Ye(R$,F(s).staged.length),$b=ft(Mf,1,"changes tree-item nav-folder",null,$b,{"is-collapsed":!F(d)}),Ib=ft(Fb,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,Ib,{"is-collapsed":!F(d)}),Ye(I$,F(s).changed.length)}),me("click",If,()=>ae(h,!F(h))),me("click",Pb,X),me("click",Df,()=>ae(d,!F(d))),me("click",Db,$r),me("click",Ob,z),ue(Z,De)};$e(T$,Z=>{F(s)&&F(u)&&F(c)&&Z(P$)})}G(Sb),G(Ie),Ve(()=>{ye(Ie,"data-type",er.type),L=ft(J,1,"clickable-icon nav-action-button svelte-5wq9p",null,L,{"is-disabled":F(S)}),ye(J,"aria-label",F(P)),ye(J,"aria-disabled",F(S)),xe=ft(W,1,"clickable-icon nav-action-button svelte-5wq9p",null,xe,{"is-disabled":F(w)}),ye(W,"aria-label",F(y)),ye(W,"aria-disabled",F(w)),ye($f,"data-icon",F(T)?"list":"folder"),Eb=ft(lm,1,"clickable-icon nav-action-button",null,Eb,{loading:F(n)}),ye(Ff,"rows",F(cr))}),me("click",J,()=>K()),me("click",W,()=>re()),me("click",Xe,Q),me("click",Dt,z),me("click",ti,X),me("click",aa,j),me("click",om,Ze),me("click",$f,()=>{ae(T,!F(T)),(0,zn.setIcon)(l[6],F(T)?"list":"folder"),r().settings.treeStructure=F(T),r().saveSettings()}),me("click",lm,ce),ob(Ff,()=>F(o),Z=>ae(o,Z)),ue(t,Ie),pt()}Mt(["click"]);var Rf=class extends w$.ItemView{constructor(e,r){super(e),this.plugin=r,this.hoverPopover=null}getViewType(){return er.type}getDisplayText(){return er.name}getIcon(){return er.icon}async onClose(){return this._view&&await _s(this._view),super.onClose()}async reload(){this._view&&await _s(this._view),this._view=na(bb,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}async onOpen(){return await this.reload(),super.onOpen()}};m();var Yp=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;this.statusBarEl.addClass("mod-clickable"),this.statusBarEl.onClickEvent(i=>{this.plugin.switchBranch().catch(n=>r.displayError(n))})}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()}};m();var b$=require("obsidian");var Zp=class{constructor(e){this.plugin=e}get editor(){var i;let e=(i=this.plugin.app.workspace.activeEditor)==null?void 0:i.editor,r=e==null?void 0:e.cm;if(!(!e||!Ki.hasHunksData(r.state)))return{editor:r,obEditor:e}}get gitManager(){return this.plugin.gitManager}resetHunk(e){if(!this.editor)return;let{editor:r,obEditor:i}=this.editor,n=Ki.getHunk(r.state,!1,e);if(n){let s,a;n.type==="delete"?(s=n.added.start+1,a=n.added.start+1):(s=n.added.start-0,a=n.added.start-1+n.added.count);let o=r.state.doc.line(s).from,l=n.type==="delete"?r.state.doc.line(a).from:r.state.doc.line(a).to+1,c=n.removed.lines.join(` `);n.removed.lines.length>0&&!n.removed.no_nl_at_eof&&(c+=` `),i.replaceRange(c,i.offsetToPos(o),i.offsetToPos(l)),i.setSelection(i.offsetToPos(o))}}async stageHunk(e){if(!await this.plugin.isAllInitialized()||!this.editor)return;let{editor:r}=this.editor,i=Ki.getHunk(r.state,!1,e),n=!1;if(i||(i=Ki.getHunk(r.state,!0,e),n=!0),!i)return;let s=r.state.field(b$.editorInfoField).file.path,a=qt.createPatch(s,[i],"100644",n).join(` `)+` `;await this.gitManager.applyPatch(a),this.plugin.app.workspace.trigger("obsidian-git:refresh")}goToHunk(e){if(!this.editor)return;let{editor:r,obEditor:i}=this.editor,n=Ki.getHunks(r.state,!1),s=i.getCursor().line+1,a=qt.findNearestHunk(s,n,e,!0);if(a==null)return;let o=n[a];if(o){let l=o.added.start-1;i.setCursor(l,0),i.scrollIntoView({from:{line:l,ch:0},to:{line:l+1,ch:0}},!0)}}};m();m();var bo=require("obsidian");var Kp=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.lineAuthorInfoProvider){console.warn("Git: undefined lineAuthorInfoProvider. Unexpected situation.");return}let r=e==null?void 0:e.view;!(r instanceof bo.MarkdownView)||r.file==null||(r==null?void 0:r.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(r.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),DT(()=>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;zT(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new Th(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&&bo.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof ke?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(r2),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.headChangeEvent=this.createHeadChangeEvent(),this.refreshOnCssChangeEvent=this.createCssRefreshHandler(),this.fileRenameEvent=this.createFileRenameEvent(),HT(),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.headChangeEvent),this.plg.registerEvent(this.fileRenameEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.gutterContextMenuEvent),this.plg.app.workspace.offref(this.refreshOnCssChangeEvent),this.plg.app.workspace.offref(this.fileOpenEvent),this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.vault.offref(this.fileModificationEvent),this.plg.app.workspace.offref(this.headChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent)}createFileOpenEvent(){return this.plg.app.workspace.on("file-open",e=>{var r;e&&((r=this.lineAuthorInfoProvider)==null||r.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,r)=>{var i;return e instanceof bo.TFile&&((i=this.lineAuthorInfoProvider)==null?void 0:i.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var r;return e instanceof bo.TFile&&((r=this.lineAuthorInfoProvider)==null?void 0:r.trackChanged(e))})}createHeadChangeEvent(){return this.plg.app.workspace.on("obsidian-git:head-change",()=>{this.refreshLineAuthorViews()})}createCssRefreshHandler(){return this.plg.app.workspace.on("css-change",()=>this.refreshLineAuthorViews())}createGutterContextMenuHandler(){return this.plg.app.workspace.on("editor-menu",jT)}};m();var wc=require("obsidian");m();m();var _o=require("@codemirror/state"),Qp=require("@codemirror/view");var Xp=class extends Qp.GutterMarker{constructor(r,i){super();this.type=r;this.staged=i}toDOM(r){let i=createDiv();return i.className=`git-gutter-marker git-${this.type} ${this.staged?"staged":"unstaged"}`,this.type=="changedelete"&&i.setText("~"),i}},_b=_o.StateField.define({create:()=>_o.RangeSet.empty,update:(t,e)=>{let r=e.state.field(Wr,!1);if(!r)return _o.RangeSet.empty;let i=e.effects.some(s=>s.is(Vh)),n=e.effects.some(s=>s.is(Ml));if(i||n||(e.docChanged||t.size==0)&&r.isDirty==!1){let s=new Set,a=_$(e,r.hunks,!1,s),o=_$(e,r.stagedHunks,!0,s);return t=_o.RangeSet.of([...a,...o],!0),t}else e.docChanged&&(t=t.map(e.changes));return t}});function _$(t,e,r,i){let n=[];for(let a=0;a0?e[a-1]:void 0,l=a{var e;return(e=t.state.field(_b,!1))!=null?e:_o.RangeSet.empty},initialSpacer:t=>new Xp("delete",!1),domEventHandlers:{click:(t,e,r)=>{var n;return((n=Ki.getHunkAtPos(t.state,e.from,!1))!=null?n:Ki.getHunkAtPos(t.state,e.from,!0))&&(Ks(t,e.from),r.preventDefault()),!1}}});var Jp=class{constructor(e){this.plugin=e}async trackChanged(e){try{await this.trackChangedHelper(e)}catch(r){throw console.warn("Git: Error in trackChanged.",r),r}}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.computeSigns(e.path)}}destroy(){}async computeSigns(e){let i=await this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager.show("",e).catch(()=>{});this.notifySignComputationResultToSubscribers(e,{compareText:i,compareTextHead:void 0})}notifySignComputationResultToSubscribers(e,r){Ti.ifFilepathDefinedTransformSubscribers(e,i=>i.forEach(n=>n.notifyGitCompare(r)))}},x$=[wP,bP,y$,_b,tp],E$=[Wr,ju];m();var em=require("obsidian"),tm=class{constructor(e,r){this.statusBarEl=e;this.plugin=r;var i;e.addClass("git-changes-status-bar"),r.settings.hunks.statusBar==="colored"&&e.addClass("git-changes-status-bar-colored"),e.setAttr("aria-label","Git diff of the current editor"),this.statusBarEl.setAttribute("data-tooltip-position","top"),this.view=(i=r.app.workspace.getActiveViewOfType(em.MarkdownView))!=null?i:void 0,r.app.workspace.on("active-leaf-change",n=>{!n||n.getRoot()==r.app.workspace.rootSplit&&!(n.view instanceof em.MarkdownView)?this.statusBarEl.empty():n.view instanceof em.MarkdownView&&(this.view=n.view)})}display(e,r){var a;if(!this.view||((a=this.view.file)==null?void 0:a.path)!==(r==null?void 0:r.path))return;let i=0,n=0,s=0;for(let o of e)i+=Math.max(0,o.added.count-o.removed.count),n+=Math.min(o.added.count,o.removed.count),s+=Math.max(0,o.removed.count-o.added.count);this.statusBarEl.empty(),i>0&&this.statusBarEl.createSpan({text:`+${i} `,cls:"git-add"}),n>0&&this.statusBarEl.createSpan({text:`~${n} `,cls:"git-change"}),s>0&&this.statusBarEl.createSpan({text:`-${s}`,cls:"git-delete"})}remove(){this.statusBarEl.remove()}};var rm=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.signsProvider){console.warn("Git: undefined signsProvider. Unexpected situation.");return}let r=e==null?void 0:e.view;!(r instanceof wc.MarkdownView)||r.file==null||(r==null?void 0:r.allowNoFile)===!0||this.signsProvider.trackChanged(r.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions)}conditionallyActivateBySettings(){(this.plg.settings.hunks.showSigns||this.plg.settings.hunks.statusBar!="disabled"||this.plg.settings.hunks.hunkCommands)&&this.activateFeature()}activateFeature(){try{if(!this.isAvailableOnCurrentPlatform().available)return;if(this.signsProvider=new Jp(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),this.plg.settings.hunks.statusBar!="disabled"){let e=this.plg.addStatusBarItem();this.changeStatusBar=new tm(e,this.plg)}}catch(e){console.warn("Git: Error while loading signs feature.",e),this.deactivateFeature()}}deactivateFeature(){var e,r;this.destroyEventHandlers(),this.deactivateCodeMirrorExtensions(),(e=this.signsProvider)==null||e.destroy(),this.signsProvider=void 0,(r=this.changeStatusBar)==null||r.remove(),this.changeStatusBar=void 0}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&wc.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof ke?this.plg.gitManager:void 0}}refresh(){this.signsProvider&&this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(E$),this.plg.settings.hunks.showSigns&&this.codeMirrorExtensions.push(...x$),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.workspaceLeafChangeEvent=this.createWorkspaceLeafChangeEvent(),this.fileRenameEvent=this.createFileRenameEvent(),this.pluginRefreshedEvent=this.createPluginRefreshedEvent(),this.intervalRefreshEvent=this.createIntervalRefreshEvent(),this.plg.registerEvent(this.workspaceLeafChangeEvent),this.plg.registerEvent(this.fileRenameEvent),this.plg.registerEvent(this.pluginRefreshedEvent),this.plg.registerInterval(this.intervalRefreshEvent)}destroyEventHandlers(){this.plg.app.workspace.offref(this.workspaceLeafChangeEvent),this.plg.app.vault.offref(this.fileRenameEvent),this.plg.app.workspace.offref(this.pluginRefreshedEvent),window.clearInterval(this.intervalRefreshEvent)}createWorkspaceLeafChangeEvent(){return this.plg.app.workspace.on("active-leaf-change",this.handleWorkspaceLeaf)}createFileRenameEvent(){return this.plg.app.vault.on("rename",(e,r)=>{var i;return Ti.ifFilepathDefinedTransformSubscribers(r,n=>n.forEach(s=>{s.changeToNewFilepath(e.path)})),e instanceof wc.TFile&&((i=this.signsProvider)==null?void 0:i.trackChanged(e))})}createPluginRefreshedEvent(){return this.plg.app.workspace.on("obsidian-git:refreshed",()=>{this.refresh()})}createIntervalRefreshEvent(){return window.setInterval(()=>{var e,r;(e=this.plg.app.workspace.activeEditor)!=null&&e.file&&((r=this.signsProvider)==null||r.trackChanged(this.plg.app.workspace.activeEditor.file).catch(console.error))},10*1e3)}};m();var S$=require("@codemirror/state"),im=require("obsidian");var yb=class{constructor(e){this.state=e;this.subscribeMe()}notifyLineAuthoring(e,r){if(this.view===void 0){console.warn(`Git: View is not defined for editor cache key. Unforeseen situation. id: ${e}`);return}let i=this.view.state,n=MT(e,r,i);this.view.dispatch(n)}notifyGitCompare(e){if(this.view===void 0){console.warn("Git: View is not defined for editor cache key. Unforeseen situation. id: ");return}if(this.removeIfStale())return;let r=this.view.state,i=r.field(Wr);if(!i||i.compareText!=e.compareText||i.compareTextHead!=e.compareTextHead){let n=Y2(e,r);this.view.dispatch(n)}}updateToNewState(e){return this.state=e,!this.lastSeenPath&&this.filepath&&this.subscribeMe(),this}removeIfStale(){var e;return((e=this.view)==null?void 0:e.state.field(xb,!1))!=this||this.view.destroyed?(this.unsubscribeMe(this.lastSeenPath),!0):!1}changeToNewFilepath(e){this.unsubscribeMe(this.lastSeenPath),this.subscribeMe(e)}subscribeMe(e){e!=null||(e=this.filepath),e!==void 0&&(Ti.ifFilepathDefinedTransformSubscribers(e,r=>r.add(this)),this.lastSeenPath=e)}unsubscribeMe(e){Ti.ifFilepathDefinedTransformSubscribers(e,r=>r.delete(this))}get filepath(){var e,r;return(r=(e=this.state.field(im.editorInfoField))==null?void 0:e.file)==null?void 0:r.path}get view(){return this.state.field(im.editorEditorField)}},xb=S$.StateField.define({create:t=>new yb(t),update:(t,e)=>t.updateToNewState(e.state),compare:(t,e)=>t===e});var nm=class{constructor(e){this.plg=e;this.lineAuthoringFeature=new Kp(this.plg);this.signsFeature=new rm(this.plg)}onUnloadPlugin(){this.lineAuthoringFeature.deactivateFeature(),this.signsFeature.deactivateFeature(),Ti.clear()}onLoadPlugin(){Ti.init(),this.plg.registerEditorExtension(xb),this.lineAuthoringFeature.onLoadPlugin(),this.signsFeature.onLoadPlugin()}onReady(){this.lineAuthoringFeature.conditionallyActivateBySettings(),this.signsFeature.conditionallyActivateBySettings()}activateLineAuthoring(){this.lineAuthoringFeature.activateFeature()}deactiveLineAuthoring(){this.lineAuthoringFeature.deactivateFeature()}refreshSignsSettings(){let e=this.plg.settings.hunks;e.showSigns||e.statusBar!="disabled"||e.hunkCommands?(this.signsFeature.deactivateFeature(),this.signsFeature.activateFeature()):this.signsFeature.deactivateFeature()}};var sm=class extends Ce.Plugin{constructor(){super(...arguments);this.automaticsManager=new Nu(this);this.tools=new Xu(this);this.localStorage=new rp(this);this.state={operation:0,offlineMode:!1};this.gitReady=!1;this.promiseQueue=new Nd(this);this.intervalsToClear=[];this.editorIntegration=new nm(this);this.hunkActions=new Zp(this)}setPluginState(r){var i;this.state=Object.assign(this.state,r),(i=this.statusBar)==null||i.display()}async updateCachedStatus(){var r,i;return this.app.workspace.trigger("obsidian-git:loading-status"),this.cachedStatus=await this.gitManager.status(),this.cachedStatus.conflicted.length>0?(this.localStorage.setConflict(!0),await((r=this.branchBar)==null?void 0:r.display())):(this.localStorage.setConflict(!1),await((i=this.branchBar)==null?void 0:i.display())),this.app.workspace.trigger("obsidian-git:status-changed",this.cachedStatus),this.cachedStatus}async refresh(){if(!this.gitReady)return;let r=this.app.workspace.getLeavesOfType(er.type),i=this.app.workspace.getLeavesOfType(Ei.type);(this.settings.changedFilesInStatusBar||r.some(n=>{var s;return!((s=n.isDeferred)!=null&&s)})||i.some(n=>{var s;return!((s=n.isDeferred)!=null&&s)}))&&await this.updateCachedStatus().catch(n=>this.displayError(n)),this.app.workspace.trigger("obsidian-git:refreshed")}refreshUpdatedHead(){}async onload(){console.log("loading "+this.manifest.name+" plugin: v"+this.manifest.version),Et.plugin=this,this.localStorage.migrate(),await this.loadSettings(),await this.migrateSettings(),this.settingsTab=new Ph(this.app,this),this.addSettingTab(this.settingsTab),this.localStorage.getPluginDisabled()||(this.registerStuff(),this.app.workspace.onLayoutReady(()=>this.init({fromReload:!1}).catch(r=>this.displayError(r))))}onExternalSettingsChange(){this.reloadSettings().catch(r=>this.displayError(r))}async reloadSettings(){var n,s;let r=JSON.stringify(this.settings);await this.loadSettings();let i=JSON.stringify(this.settings);if(r!==i){this.log("Reloading settings"),this.unloadPlugin(),await this.init({fromReload:!0});for(let a of this.app.workspace.getLeavesOfType(er.type))(n=a.isDeferred)!=null&&n||await a.view.reload();for(let a of this.app.workspace.getLeavesOfType(Ei.type))(s=a.isDeferred)!=null&&s||await a.view.reload()}}registerStuff(){this.registerEvent(this.app.workspace.on("obsidian-git:refresh",()=>{this.refresh().catch(r=>this.displayError(r))})),this.registerEvent(this.app.workspace.on("obsidian-git:head-change",()=>{this.refreshUpdatedHead()})),this.registerEvent(this.app.workspace.on("file-menu",(r,i,n)=>{this.handleFileMenu(r,i,n,"file-manu")})),this.registerEvent(this.app.workspace.on("obsidian-git:menu",(r,i,n)=>{this.handleFileMenu(r,i,n,"obsidian-git:menu")})),this.registerEvent(this.app.workspace.on("active-leaf-change",r=>{this.onActiveLeafChange(r)})),this.registerEvent(this.app.vault.on("modify",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerEvent(this.app.vault.on("delete",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerEvent(this.app.vault.on("create",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerEvent(this.app.vault.on("rename",()=>{var r;this.debRefresh(),(r=this.autoCommitDebouncer)==null||r.call(this)})),this.registerView(er.type,r=>new Rf(r,this)),this.registerView(Ei.type,r=>new kf(r,this)),this.registerView(Us.type,r=>new Wa(r,this)),this.registerView(Hs.type,r=>new qa(r,this)),this.addRibbonIcon("git-pull-request","Open Git source control",async()=>{var n;let r=this.app.workspace.getLeavesOfType(er.type),i;r.length===0?(i=(n=this.app.workspace.getRightLeaf(!1))!=null?n:this.app.workspace.getLeaf(),await i.setViewState({type:er.type})):i=r.first(),await this.app.workspace.revealLeaf(i)}),this.registerHoverLinkSource(er.type,{display:"Git View",defaultMod:!0}),this.editorIntegration.onLoadPlugin(),this.setRefreshDebouncer(),_P(this)}setRefreshDebouncer(){var r;(r=this.debRefresh)==null||r.cancel(),this.debRefresh=(0,Ce.debounce)(()=>{this.settings.refreshSourceControl&&this.refresh().catch(console.error)},this.settings.refreshSourceControlTimer,!0)}async addFileToGitignore(r,i){let n=this.gitManager.getRelativeRepoPath(r,!0),s=kk({isFolder:i,gitRelativePath:n});await this.app.vault.adapter.append(this.gitManager.getRelativeVaultPath(".gitignore"),` `+s),this.app.workspace.trigger("obsidian-git:refresh")}handleFileMenu(r,i,n,s){if(!this.gitReady||!this.settings.showFileMenu||!i)return;let a;if(typeof i=="string"?a=i:a=i.path,n=="file-explorer-context-menu"&&(r.addItem(o=>{o.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof Ce.TFile?await this.stageFile(i):(await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{i instanceof Ce.TFile?await this.unstageFile(i):(await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(a,!0)}),this.app.workspace.trigger("obsidian-git:refresh"))})})}),r.addItem(o=>{o.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(l=>{this.addFileToGitignore(a,i instanceof Ce.TFolder).catch(c=>this.displayError(c))})})),n=="git-source-control"){r.addItem(l=>{l.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(c=>{this.addFileToGitignore(a,i instanceof Ce.TFolder).catch(u=>this.displayError(u))})});let o=this.app.vault.adapter;s==="obsidian-git:menu"&&o instanceof Ce.FileSystemAdapter&&(r.addItem(l=>{l.setTitle("Open in default app").setIcon("arrow-up-right").setSection("action").onClick(c=>{this.app.openWithDefaultApp(a)})}),r.addItem(l=>{l.setTitle("Show in system explorer").setIcon("arrow-up-right").setSection("action").onClick(c=>{window.electron.shell.showItemInFolder(k$.join(o.getBasePath(),a))})}))}}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 r,i;this.gitReady=!1,this.editorIntegration.onUnloadPlugin(),this.automaticsManager.unload(),(r=this.branchBar)==null||r.remove(),(i=this.statusBar)==null||i.remove(),this.statusBar=void 0,this.branchBar=void 0,this.gitManager.unload(),this.promiseQueue.clear();for(let n of this.intervalsToClear)window.clearInterval(n);this.intervalsToClear=[],this.debRefresh.cancel()}onunload(){this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let r=await this.loadData();r==null&&(r={showedMobileNotice:!0}),this.settings=XS(tt,r)}async saveSettings(){var r;(r=this.settingsTab)==null||r.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return Ce.Platform.isDesktopApp}async init({fromReload:r=!1}){var i;if(!this.localStorage.getPluginDisabled()){if(this.settings.showStatusBar&&!this.statusBar){let n=this.addStatusBarItem();this.statusBar=new Rh(n,this),this.intervalsToClear.push(window.setInterval(()=>{var s;return(s=this.statusBar)==null?void 0:s.display()},1e3))}try{this.useSimpleGit?(this.gitManager=new ke(this),await this.gitManager.setGitInstance()):this.gitManager=new Zi(this);let n=await this.gitManager.checkRequirements(),s=this.localStorage.getPausedAutomatics();switch(n){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new Ce.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,Ce.Platform.isDesktop&&this.settings.showBranchStatusBar&&!this.branchBar){let a=this.addStatusBarItem();this.branchBar=new Yp(a,this),this.intervalsToClear.push(window.setInterval(()=>{var o;(o=this.branchBar)==null?void 0:o.display().catch(console.error)},6e4))}await((i=this.branchBar)==null?void 0:i.display()),this.editorIntegration.onReady(),this.app.workspace.trigger("obsidian-git:refresh"),this.app.workspace.trigger("obsidian-git:head-change"),!r&&this.settings.autoPullOnBoot&&!s&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),s||await this.automaticsManager.init(),s&&new Ce.Notice("Automatic routines are currently paused.");break;default:this.log("Something weird happened. The 'checkRequirements' result is "+String(n))}}catch(n){this.displayError(n),console.error(n)}}}async createNewRepo(){try{await this.gitManager.init(),new Ce.Notice("Initialized new repo"),await this.init({fromReload:!0})}catch(r){this.displayError(r)}}async cloneNewRepo(){let i=await new at(this,{placeholder:"Enter remote URL"}).openAndGetResult();if(i){let n="Vault Root",s=await new at(this,{options:this.gitManager instanceof Zi?[n]:[],placeholder:"Enter directory for clone. It needs to be empty or not existent.",allowEmpty:this.gitManager instanceof Zi}).openAndGetResult();if(s==null)return;if(s===n&&(s="."),s=(0,Ce.normalizePath)(s),s==="/"&&(s="."),s==="."){let f=await new at(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 Ce.Notice("Aborted clone");return}else if(f==="YES"){let d="DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";if(await new at(this,{options:["Abort clone",d],placeholder:`To avoid conflicts, the local ${this.app.vault.configDir} directory needs to be deleted.`,onlySelection:!0}).openAndGetResult()===d)await this.app.vault.adapter.rmdir(this.app.vault.configDir,!0);else{new Ce.Notice("Aborted clone");return}}}let a=await new at(this,{placeholder:"Specify depth of clone. Leave empty for full clone.",allowEmpty:!0}).openAndGetResult(),o;if(a===void 0){new Ce.Notice("Aborted clone");return}if(a!==""&&(o=parseInt(a),isNaN(o))){new Ce.Notice("Invalid depth. Aborting clone.");return}new Ce.Notice(`Cloning new repo into "${s}"`);let l=this.settings.basePath,c=s&&s!==".";c&&(this.settings.basePath=s);try{await this.gitManager.clone(yv(i),s,o),new Ce.Notice("Cloned new repo."),new Ce.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 r=await this.pull();if(r!==!1){if(r||this.displayMessage("Pull: Everything is up-to-date"),this.gitManager instanceof ke){let i=await this.updateCachedStatus();i.conflicted.length>0&&(this.displayError(`You have conflicts in ${i.conflicted.length} ${i.conflicted.length==1?"file":"files"}`),await this.handleConflict(i.conflicted))}this.app.workspace.trigger("obsidian-git:refresh")}}resolveCommitMode(r,i){return r==="all"?"all":i>0?"staged":r==="staged"?"nothing":this.settings.autoStageOnEmptyIndex?"all":"nothing"}async commitAndSync({fromAutoBackup:r,requestCustomMessage:i=!1,commitMessage:n,mode:s="all"}){!await this.isAllInitialized()||(this.settings.syncMethod=="reset"&&this.settings.pullBeforePush&&await this.pull(),!await this.commit({fromAuto:r,requestCustomMessage:i,commitMessage:n,mode:s}))||(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")))}async commit({fromAuto:r,requestCustomMessage:i=!1,mode:n="all",commitMessage:s,amend:a=!1}){if(!await this.isAllInitialized())return!1;try{let o=this.localStorage.getConflict(),l,c=[],u=[],f=n==="smart"?"nothing":n;if(this.gitManager instanceof ke){if(await this.mayDeleteConflictFile(),l=await this.updateCachedStatus(),l.conflicted.length==0&&(o=!1),r&&l.conflicted.length>0)return this.displayError(`Did not commit, because you have conflicts in ${l.conflicted.length} ${l.conflicted.length==1?"file":"files"}. Please resolve them and commit per command.`),await this.handleConflict(l.conflicted),!1;c=l.staged,u=l.changed,f=this.resolveCommitMode(n,c.length)}else{if(r&&o)return this.displayError("Did not commit, because you have conflicts. Please resolve them and commit per command."),!1;{o&&await this.mayDeleteConflictFile();let p=this.gitManager;c=await p.getStagedFiles(),f=this.resolveCommitMode(n,c.length),f==="all"&&(u=(await p.getUnstagedFiles()).map(({path:v,type:b})=>({vaultPath:this.gitManager.getRelativeVaultPath(v),path:v,type:b})))}}if(f==="nothing")return this.displayMessage("Nothing staged. Stage changes first or use Commit all changes."),!0;let d=f==="staged";if(await this.tools.hasTooBigFiles(d?c:[...c,...u]))return!1;if((d?0:u.length)+c.length!==0||o){let p=s!=null?s:s=r?this.settings.autoCommitMessage:this.settings.commitMessage;if(r&&this.settings.customMessageOnAutoBackup||i){!this.settings.disablePopups&&r&&new Ce.Notice("Auto backup: Please enter a custom commit message. Leave empty to abort");let b=await new $h(this).openAndGetResult();if(b!=null&&b!=""&&b!="...")p=b;else return!1}else if(this.gitManager instanceof ke&&this.settings.commitMessageScript){let b=this.settings.commitMessageScript,_=this.localStorage.getHostname()||"",C=b.replace("{{hostname}}",_);C=C.replace("{{date}}",(0,Ce.moment)().format(this.settings.commitDateFormat));let x="sh";if(Ce.Platform.isWin){x=process.env.PROGRAMFILES+"\\Git\\bin\\sh.exe";let A=!1;try{await am.access(x,am.constants.X_OK),A=!0}catch(w){A=!1}if(!A)return this.displayError(`Cannot find sh.exe at ${x}. Please make sure Git is properly installed.`),!1}let E=await Su(x,["-c",C],{cwd:this.gitManager.absoluteRepoPath});E.code!=0?this.displayError(E.stderr):E.stdout.trim().length==0?this.displayMessage("Stdout from commit message script is empty. Using default message."):p=E.stdout}if(!p||p.trim()==="")return new Ce.Notice("Commit aborted: No commit message provided"),!1;let g;d?g=await this.gitManager.commit({message:p,amend:a}):g=await this.gitManager.commitAll({message:p,status:l,unstagedFiles:u,amend:a}),this.gitManager instanceof ke&&await this.updateCachedStatus();let v=!1;g===void 0&&(v=!0,g=u.length+c.length||0),g===0?this.displayMessage("No changes to commit"):this.displayMessage(`Committed${v?" approx.":""} ${g} ${g==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 r=this.localStorage.getConflict();try{this.gitManager instanceof ke&&await this.mayDeleteConflictFile();let i;if(this.gitManager instanceof ke&&(i=await this.updateCachedStatus()).conflicted.length>0)return this.displayError(`Cannot push. You have conflicts in ${i.conflicted.length} ${i.conflicted.length==1?"file":"files"}`),await this.handleConflict(i.conflicted),!1;if(this.gitManager instanceof Zi&&r)return this.displayError("Cannot push. You have conflicts"),!1;this.settings.squashCommitsBeforePush&&this.gitManager instanceof ke&&await this.gitManager.squashAllUnpushedCommits(),this.log("Pushing....");let n=await this.gitManager.push();return n!==void 0&&(n===null?this.displayMessage("Pushed to remote"):n>0?this.displayMessage(`Pushed ${n} ${n==1?"file":"files"} to remote`):this.displayMessage("No commits to push")),this.setPluginState({offlineMode:!1}),this.app.workspace.trigger("obsidian-git:refresh"),!0}catch(i){return i instanceof ll?this.handleNoNetworkError(i):this.displayError(i),!1}}async pull(){if(!await this.remotesAreSet())return!1;try{this.log("Pulling....");let r=await this.gitManager.pull()||[];return this.setPluginState({offlineMode:!1}),r.length>0&&(this.displayMessage(`Pulled ${r.length} ${r.length==1?"file":"files"} from remote`),this.lastPulledFiles=r),r.length}catch(r){return this.displayError(r),!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(r){this.displayError(r)}}async mayDeleteConflictFile(){let r=this.app.vault.getAbstractFileByPath(ol);r&&(this.app.workspace.iterateAllLeaves(i=>{var n;i.view instanceof Ce.MarkdownView&&((n=i.view.file)==null?void 0:n.path)==r.path&&i.detach()}),await this.app.vault.delete(r))}async stageFile(r){return await this.isAllInitialized()?(await this.gitManager.stage(r.path,!0),this.app.workspace.trigger("obsidian-git:refresh"),!0):!1}async unstageFile(r){return await this.isAllInitialized()?(await this.gitManager.unstage(r.path,!0),this.app.workspace.trigger("obsidian-git:refresh"),!0):!1}async switchBranch(){var n;if(!await this.isAllInitialized())return;let r=await this.gitManager.branchInfo(),i=await new Wp(this,r.branches).openAndGetReslt();if(i!=null)return await this.gitManager.checkout(i),this.displayMessage(`Switched to ${i}`),this.app.workspace.trigger("obsidian-git:refresh"),await((n=this.branchBar)==null?void 0:n.display()),i}async switchRemoteBranch(){var s;if(!await this.isAllInitialized())return;let r=await this.selectRemoteBranch()||"",[i,n]=Vs(r);if(n!=null&&i!=null)return await this.gitManager.checkout(n,i),this.displayMessage(`Switched to ${r}`),await((s=this.branchBar)==null?void 0:s.display()),r}async createBranch(){var i;if(!await this.isAllInitialized())return;let r=await new at(this,{placeholder:"Create new branch"}).openAndGetResult();if(r!=null)return await this.gitManager.createBranch(r),this.displayMessage(`Created new branch ${r}`),await((i=this.branchBar)==null?void 0:i.display()),r}async deleteBranch(){var n;if(!await this.isAllInitialized())return;let r=await this.gitManager.branchInfo();r.current&&r.branches.remove(r.current);let i=await new at(this,{options:r.branches,placeholder:"Delete branch",onlySelection:!0}).openAndGetResult();if(i!=null){let s=!1;if(!await this.gitManager.branchIsMerged(i)){let o=await new at(this,{options:["YES","NO"],placeholder:"This branch isn't merged into HEAD. Force delete?",onlySelection:!0}).openAndGetResult();if(o!=="YES")return;s=o==="YES"}return await this.gitManager.deleteBranch(i,s),this.displayMessage(`Deleted branch ${i}`),await((n=this.branchBar)==null?void 0:n.display()),i}}async remotesAreSet(){return this.settings.updateSubmodules||this.gitManager instanceof ke&&await this.gitManager.getConfig("push.autoSetupRemote","all")=="true"||(await this.gitManager.branchInfo()).tracking?!0:(new Ce.Notice("No upstream branch is set. Please select one."),await this.setUpstreamBranch())}async setUpstreamBranch(){let r=await this.selectRemoteBranch();return r==null?(this.displayError("Aborted. No upstream-branch is set!",1e4),!1):(await this.gitManager.updateUpstreamBranch(r),this.displayMessage(`Set upstream branch to ${r}`),!0)}async discardAll(r){if(!await this.isAllInitialized())return!1;let i=await this.gitManager.status({path:r}),n=0,s=0;for(let o of i.changed)o.workingDir=="U"?n++:s++;if(n+s==0)return!1;let a=await new vc({app:this.app,filesToDeleteCount:n,filesToDiscardCount:s,path:r!=null?r:""}).openAndGetResult();switch(a){case!1:return a;case"discard":await this.gitManager.discardAll({dir:r,status:this.cachedStatus});break;case"delete":{await this.gitManager.discardAll({dir:r,status:this.cachedStatus});let o=await this.gitManager.getUntrackedPaths({path:r,status:this.cachedStatus});for(let l of o){let c=this.gitManager.getRelativeVaultPath(l),u=this.app.vault.getAbstractFileByPath(c);u?await this.app.fileManager.trashFile(u):l.endsWith("/")?await this.app.vault.adapter.rmdir(c,!0):await this.app.vault.adapter.remove(c)}break}default:zd(a)}return this.app.workspace.trigger("obsidian-git:refresh"),a}async handleConflict(r){this.localStorage.setConflict(!0);let i;r!==void 0&&(i=["# 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","",...r.map(n=>{let s=this.app.vault.getAbstractFileByPath(n);return s instanceof Ce.TFile?`- [[${this.app.metadataCache.fileToLinktext(s,"/")}]]`:`- Not a file: ${n}`}),` # 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(i==null?void 0:i.join(` `))}async editRemotes(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new at(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(n){let s=await this.gitManager.getRemoteUrl(n),o=await new at(this,{initialValue:s,placeholder:"Enter remote URL"}).openAndGetResult();if(o)return await this.gitManager.setRemote(n,yv(o)),n}}async selectRemoteBranch(){let r=await this.gitManager.getRemotes(),i;r.length===0&&(i=await this.editRemotes(),i==null&&(r=await this.gitManager.getRemotes()));let n=new at(this,{options:r,placeholder:"Select or create a new remote by typing its name and selecting it"}),s=i!=null?i:await n.openAndGetResult();if(s){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(s);let a=await this.gitManager.getRemoteBranches(s),l=await new at(this,{options:a,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult();return l==null?void 0:l.startsWith(s+"/")?l:`${s}/${l}`}}async removeRemote(){if(!await this.isAllInitialized())return;let r=await this.gitManager.getRemotes(),n=await new at(this,{options:r,placeholder:"Select a remote"}).openAndGetResult();n&&await this.gitManager.removeRemote(n)}onActiveLeafChange(r){var a,o;let i=r==null?void 0:r.view;if(!(i!=null&&i.getState().file)&&!(i instanceof Wa||i instanceof qa))return;let n=this.app.workspace.getLeavesOfType(er.type).first(),s=this.app.workspace.getLeavesOfType(Ei.type).first();if((a=n==null?void 0:n.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||a.removeClass("is-active"),(o=s==null?void 0:s.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||o.removeClass("is-active"),(r==null?void 0:r.view)instanceof Wa||(r==null?void 0:r.view)instanceof qa){let c=r.view.state.bFile.replace(/["\\]/g,"\\$&");this.lastDiffViewState=r.view.getState();let u;n&&r.view.state.aRef=="HEAD"?u=n.view.containerEl.querySelector(`div.staged div.tree-item-self[data-path="${c}"]`):n&&r.view.state.aRef==""?u=n.view.containerEl.querySelector(`div.changes div.tree-item-self[data-path="${c}"]`):s&&(u=s.view.containerEl.querySelector(`div.tree-item-self[data-path='${c}']`)),u==null||u.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(r){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({offlineMode:!0})}displayMessage(r,i=4*1e3){var n;(n=this.statusBar)==null||n.displayMessage(r.toLowerCase(),i),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!r.startsWith("No changes"))&&new Ce.Notice(r,5*1e3),this.log(r)}displayError(r,i=10*1e3){var s;if(r instanceof du.UserCanceledError){new Ce.Notice("Aborted");return}let n;r instanceof Error?n=r:n=new Error(String(r)),this.settings.showErrorNotices&&new Ce.Notice(n.message,i),console.error(`${this.manifest.id}:`,n.stack),(s=this.statusBar)==null||s.displayMessage(n.message.toLowerCase(),i)}log(...r){console.log(`${this.manifest.id}:`,...r)}}; /*! 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 *) isomorphic-git/index.js: (*! * This code for `path.join` is directly copied from @zenfs/core/path for bundle size improvements. * SPDX-License-Identifier: LGPL-3.0-or-later * Copyright (c) James Prevett and other ZenFS contributors. * * Windows support added: * - Backslashes are normalised to forward slashes before processing. * - Drive-letter prefixes (e.g. "C:") are detected and preserved through * normalisation, so absolute Windows paths are handled correctly. * - An absolute argument passed to join() resets the accumulated path, * matching Node behaviour and handling worktree gitdir paths properly. * * Limitation: UNC paths (e.g. \\server\share) are not supported. The leading * backslashes are normalised to forward slashes and then collapsed by * normalizeString, losing the UNC root. Git on Windows works with * drive-letter paths, so this is not expected to be a practical issue. *) js-sha256/build/sha256.mjs: (** * [js-sha256]{@link https://github.com/emn178/js-sha256} * * @version 0.12.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2014-2026 * @license MIT *) */ /* nosourcemap */