Files
2026-11-05 15:16:24 +08:00

415 lines
800 KiB
JavaScript

/*
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 GO=Object.create;var Yc=Object.defineProperty;var UO=Object.getOwnPropertyDescriptor;var jO=Object.getOwnPropertyNames;var zO=Object.getPrototypeOf,VO=Object.prototype.hasOwnProperty;var ax=r=>{throw TypeError(r)};var WO=(r,e,t)=>e in r?Yc(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var qO=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(n){throw t=[n],n}};var G=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},YO=(r,e)=>{for(var t in e)Yc(r,t,{get:e[t],enumerable:!0})},lx=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of jO(e))!VO.call(r,i)&&i!==t&&Yc(r,i,{get:()=>e[i],enumerable:!(n=UO(e,i))||n.enumerable});return r};var nt=(r,e,t)=>(t=r!=null?GO(zO(r)):{},lx(e||!r||!r.__esModule?Yc(t,"default",{value:r,enumerable:!0}):t,r)),KO=r=>lx(Yc({},"__esModule",{value:!0}),r);var Xe=(r,e,t)=>WO(r,typeof e!="symbol"?e+"":e,t),gg=(r,e,t)=>e.has(r)||ax("Cannot "+t);var O=(r,e,t)=>(gg(r,e,"read from private field"),t?t.call(r):e.get(r)),Re=(r,e,t)=>e.has(r)?ax("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),Se=(r,e,t,n)=>(gg(r,e,"write to private field"),n?n.call(r,t):e.set(r,t),t),me=(r,e,t)=>(gg(r,e,"access private method"),t);var fx=G(yd=>{"use strict";g();yd.byteLength=XO;yd.toByteArray=JO;yd.fromByteArray=rF;var Ni=[],Vn=[],ZO=typeof Uint8Array!="undefined"?Uint8Array:Array,wg="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(jo=0,cx=wg.length;jo<cx;++jo)Ni[jo]=wg[jo],Vn[wg.charCodeAt(jo)]=jo;var jo,cx;Vn[45]=62;Vn[95]=63;function ux(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function XO(r){var e=ux(r),t=e[0],n=e[1];return(t+n)*3/4-n}function QO(r,e,t){return(e+t)*3/4-t}function JO(r){var e,t=ux(r),n=t[0],i=t[1],s=new ZO(QO(r,n,i)),o=0,a=i>0?n-4:n,l;for(l=0;l<a;l+=4)e=Vn[r.charCodeAt(l)]<<18|Vn[r.charCodeAt(l+1)]<<12|Vn[r.charCodeAt(l+2)]<<6|Vn[r.charCodeAt(l+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=Vn[r.charCodeAt(l)]<<2|Vn[r.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=Vn[r.charCodeAt(l)]<<10|Vn[r.charCodeAt(l+1)]<<4|Vn[r.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function eF(r){return Ni[r>>18&63]+Ni[r>>12&63]+Ni[r>>6&63]+Ni[r&63]}function tF(r,e,t){for(var n,i=[],s=e;s<t;s+=3)n=(r[s]<<16&16711680)+(r[s+1]<<8&65280)+(r[s+2]&255),i.push(eF(n));return i.join("")}function rF(r){for(var e,t=r.length,n=t%3,i=[],s=16383,o=0,a=t-n;o<a;o+=s)i.push(tF(r,o,o+s>a?a:o+s));return n===1?(e=r[t-1],i.push(Ni[e>>2]+Ni[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(Ni[e>>10]+Ni[e>>4&63]+Ni[e<<2&63]+"=")),i.join("")}});var dx=G(vg=>{g();vg.read=function(r,e,t,n,i){var s,o,a=i*8-n-1,l=(1<<a)-1,c=l>>1,u=-7,f=t?i-1:0,d=t?-1:1,h=r[e+f];for(f+=d,s=h&(1<<-u)-1,h>>=-u,u+=a;u>0;s=s*256+r[e+f],f+=d,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=n;u>0;o=o*256+r[e+f],f+=d,u-=8);if(s===0)s=1-c;else{if(s===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-c}return(h?-1:1)*o*Math.pow(2,s-n)};vg.write=function(r,e,t,n,i,s){var o,a,l,c=s*8-i-1,u=(1<<c)-1,f=u>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:s-1,p=n?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+f>=1?e+=d/l:e+=d*Math.pow(2,1-f),e*l>=2&&(o++,l/=2),o+f>=u?(a=0,o=u):o+f>=1?(a=(e*l-1)*Math.pow(2,i),o=o+f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;r[t+h]=a&255,h+=p,a/=256,i-=8);for(o=o<<i|a,c+=i;c>0;r[t+h]=o&255,h+=p,o/=256,c-=8);r[t+h-p]|=m*128}});var Cg=G(il=>{"use strict";g();var bg=fx(),rl=dx(),hx=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;il.Buffer=L;il.SlowBuffer=lF;il.INSPECT_MAX_BYTES=50;var _d=2147483647;il.kMaxLength=_d;L.TYPED_ARRAY_SUPPORT=nF();!L.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 nF(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch(r){return!1}}Object.defineProperty(L.prototype,"parent",{enumerable:!0,get:function(){if(L.isBuffer(this))return this.buffer}});Object.defineProperty(L.prototype,"offset",{enumerable:!0,get:function(){if(L.isBuffer(this))return this.byteOffset}});function ws(r){if(r>_d)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,L.prototype),e}function L(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Eg(r)}return wx(r,e,t)}L.poolSize=8192;function wx(r,e,t){if(typeof r=="string")return sF(r,e);if(ArrayBuffer.isView(r))return oF(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(Bi(r,ArrayBuffer)||r&&Bi(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(Bi(r,SharedArrayBuffer)||r&&Bi(r.buffer,SharedArrayBuffer)))return _g(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return L.from(n,e,t);let i=aF(r);if(i)return i;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return L.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}L.from=function(r,e,t){return wx(r,e,t)};Object.setPrototypeOf(L.prototype,Uint8Array.prototype);Object.setPrototypeOf(L,Uint8Array);function vx(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function iF(r,e,t){return vx(r),r<=0?ws(r):e!==void 0?typeof t=="string"?ws(r).fill(e,t):ws(r).fill(e):ws(r)}L.alloc=function(r,e,t){return iF(r,e,t)};function Eg(r){return vx(r),ws(r<0?0:Sg(r)|0)}L.allocUnsafe=function(r){return Eg(r)};L.allocUnsafeSlow=function(r){return Eg(r)};function sF(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!L.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=bx(r,e)|0,n=ws(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}function yg(r){let e=r.length<0?0:Sg(r.length)|0,t=ws(e);for(let n=0;n<e;n+=1)t[n]=r[n]&255;return t}function oF(r){if(Bi(r,Uint8Array)){let e=new Uint8Array(r);return _g(e.buffer,e.byteOffset,e.byteLength)}return yg(r)}function _g(r,e,t){if(e<0||r.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&t===void 0?n=new Uint8Array(r):t===void 0?n=new Uint8Array(r,e):n=new Uint8Array(r,e,t),Object.setPrototypeOf(n,L.prototype),n}function aF(r){if(L.isBuffer(r)){let e=Sg(r.length)|0,t=ws(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||Ag(r.length)?ws(0):yg(r);if(r.type==="Buffer"&&Array.isArray(r.data))return yg(r.data)}function Sg(r){if(r>=_d)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_d.toString(16)+" bytes");return r|0}function lF(r){return+r!=r&&(r=0),L.alloc(+r)}L.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==L.prototype};L.compare=function(e,t){if(Bi(e,Uint8Array)&&(e=L.from(e,e.offset,e.byteLength)),Bi(t,Uint8Array)&&(t=L.from(t,t.offset,t.byteLength)),!L.isBuffer(e)||!L.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,i=t.length;for(let s=0,o=Math.min(n,i);s<o;++s)if(e[s]!==t[s]){n=e[s],i=t[s];break}return n<i?-1:i<n?1:0};L.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};L.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return L.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let i=L.allocUnsafe(t),s=0;for(n=0;n<e.length;++n){let o=e[n];if(Bi(o,Uint8Array))s+o.length>i.length?(L.isBuffer(o)||(o=L.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(L.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function bx(r,e){if(L.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||Bi(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return xg(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return Tx(r).length;default:if(i)return n?-1:xg(r).length;e=(""+e).toLowerCase(),i=!0}}L.byteLength=bx;function cF(r,e,t){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return bF(this,e,t);case"utf8":case"utf-8":return _x(this,e,t);case"ascii":return wF(this,e,t);case"latin1":case"binary":return vF(this,e,t);case"base64":return mF(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return yF(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}L.prototype._isBuffer=!0;function zo(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}L.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 t=0;t<e;t+=2)zo(this,t,t+1);return this};L.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)zo(this,t,t+3),zo(this,t+1,t+2);return this};L.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)zo(this,t,t+7),zo(this,t+1,t+6),zo(this,t+2,t+5),zo(this,t+3,t+4);return this};L.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?_x(this,0,e):cF.apply(this,arguments)};L.prototype.toLocaleString=L.prototype.toString;L.prototype.equals=function(e){if(!L.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:L.compare(this,e)===0};L.prototype.inspect=function(){let e="",t=il.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};hx&&(L.prototype[hx]=L.prototype.inspect);L.prototype.compare=function(e,t,n,i,s){if(Bi(e,Uint8Array)&&(e=L.from(e,e.offset,e.byteLength)),!L.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),t<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&t>=n)return 0;if(i>=s)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,a=n-t,l=Math.min(o,a),c=this.slice(i,s),u=e.slice(t,n);for(let f=0;f<l;++f)if(c[f]!==u[f]){o=c[f],a=u[f];break}return o<a?-1:a<o?1:0};function yx(r,e,t,n,i){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,Ag(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e=="string"&&(e=L.from(e,n)),L.isBuffer(e))return e.length===0?-1:px(r,e,t,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):px(r,[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}function px(r,e,t,n,i){let s=1,o=r.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,a/=2,t/=2}function l(u,f){return s===1?u[f]:u.readUInt16BE(f*s)}let c;if(i){let u=-1;for(c=t;c<o;c++)if(l(r,c)===l(e,u===-1?0:c-u)){if(u===-1&&(u=c),c-u+1===a)return u*s}else u!==-1&&(c-=c-u),u=-1}else for(t+a>o&&(t=o-a),c=t;c>=0;c--){let u=!0;for(let f=0;f<a;f++)if(l(r,c+f)!==l(e,f)){u=!1;break}if(u)return c}return-1}L.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};L.prototype.indexOf=function(e,t,n){return yx(this,e,t,n,!0)};L.prototype.lastIndexOf=function(e,t,n){return yx(this,e,t,n,!1)};function uF(r,e,t,n){t=Number(t)||0;let i=r.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o<n;++o){let a=parseInt(e.substr(o*2,2),16);if(Ag(a))return o;r[t+o]=a}return o}function fF(r,e,t,n){return xd(xg(e,r.length-t),r,t,n)}function dF(r,e,t,n){return xd(SF(e),r,t,n)}function hF(r,e,t,n){return xd(Tx(e),r,t,n)}function pF(r,e,t,n){return xd(kF(e,r.length-t),r,t,n)}L.prototype.write=function(e,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return uF(this,e,t,n);case"utf8":case"utf-8":return fF(this,e,t,n);case"ascii":case"latin1":case"binary":return dF(this,e,t,n);case"base64":return hF(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pF(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};L.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function mF(r,e,t){return e===0&&t===r.length?bg.fromByteArray(r):bg.fromByteArray(r.slice(e,t))}function _x(r,e,t){t=Math.min(r.length,t);let n=[],i=e;for(;i<t;){let s=r[i],o=null,a=s>239?4:s>223?3:s>191?2:1;if(i+a<=t){let l,c,u,f;switch(a){case 1:s<128&&(o=s);break;case 2:l=r[i+1],(l&192)===128&&(f=(s&31)<<6|l&63,f>127&&(o=f));break;case 3:l=r[i+1],c=r[i+2],(l&192)===128&&(c&192)===128&&(f=(s&15)<<12|(l&63)<<6|c&63,f>2047&&(f<55296||f>57343)&&(o=f));break;case 4:l=r[i+1],c=r[i+2],u=r[i+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&&(o=f))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return gF(n)}var mx=4096;function gF(r){let e=r.length;if(e<=mx)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=mx));return t}function wF(r,e,t){let n="";t=Math.min(r.length,t);for(let i=e;i<t;++i)n+=String.fromCharCode(r[i]&127);return n}function vF(r,e,t){let n="";t=Math.min(r.length,t);for(let i=e;i<t;++i)n+=String.fromCharCode(r[i]);return n}function bF(r,e,t){let n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);let i="";for(let s=e;s<t;++s)i+=AF[r[s]];return i}function yF(r,e,t){let n=r.slice(e,t),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}L.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let i=this.subarray(e,t);return Object.setPrototypeOf(i,L.prototype),i};function rr(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}L.prototype.readUintLE=L.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||rr(e,t,this.length);let i=this[e],s=1,o=0;for(;++o<t&&(s*=256);)i+=this[e+o]*s;return i};L.prototype.readUintBE=L.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||rr(e,t,this.length);let i=this[e+--t],s=1;for(;t>0&&(s*=256);)i+=this[e+--t]*s;return i};L.prototype.readUint8=L.prototype.readUInt8=function(e,t){return e=e>>>0,t||rr(e,1,this.length),this[e]};L.prototype.readUint16LE=L.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||rr(e,2,this.length),this[e]|this[e+1]<<8};L.prototype.readUint16BE=L.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||rr(e,2,this.length),this[e]<<8|this[e+1]};L.prototype.readUint32LE=L.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||rr(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};L.prototype.readUint32BE=L.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||rr(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};L.prototype.readBigUInt64LE=Js(function(e){e=e>>>0,nl(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Kc(e,this.length-8);let i=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))});L.prototype.readBigUInt64BE=Js(function(e){e=e>>>0,nl(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Kc(e,this.length-8);let i=t*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+n;return(BigInt(i)<<BigInt(32))+BigInt(s)});L.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||rr(e,t,this.length);let i=this[e],s=1,o=0;for(;++o<t&&(s*=256);)i+=this[e+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*t)),i};L.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||rr(e,t,this.length);let i=t,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};L.prototype.readInt8=function(e,t){return e=e>>>0,t||rr(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};L.prototype.readInt16LE=function(e,t){e=e>>>0,t||rr(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};L.prototype.readInt16BE=function(e,t){e=e>>>0,t||rr(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};L.prototype.readInt32LE=function(e,t){return e=e>>>0,t||rr(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};L.prototype.readInt32BE=function(e,t){return e=e>>>0,t||rr(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};L.prototype.readBigInt64LE=Js(function(e){e=e>>>0,nl(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Kc(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});L.prototype.readBigInt64BE=Js(function(e){e=e>>>0,nl(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Kc(e,this.length-8);let i=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});L.prototype.readFloatLE=function(e,t){return e=e>>>0,t||rr(e,4,this.length),rl.read(this,e,!0,23,4)};L.prototype.readFloatBE=function(e,t){return e=e>>>0,t||rr(e,4,this.length),rl.read(this,e,!1,23,4)};L.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||rr(e,8,this.length),rl.read(this,e,!0,52,8)};L.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||rr(e,8,this.length),rl.read(this,e,!1,52,8)};function qr(r,e,t,n,i,s){if(!L.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError("Index out of range")}L.prototype.writeUintLE=L.prototype.writeUIntLE=function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;qr(this,e,t,n,a,0)}let s=1,o=0;for(this[t]=e&255;++o<n&&(s*=256);)this[t+o]=e/s&255;return t+n};L.prototype.writeUintBE=L.prototype.writeUIntBE=function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;qr(this,e,t,n,a,0)}let s=n-1,o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+n};L.prototype.writeUint8=L.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||qr(this,e,t,1,255,0),this[t]=e&255,t+1};L.prototype.writeUint16LE=L.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||qr(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};L.prototype.writeUint16BE=L.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||qr(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};L.prototype.writeUint32LE=L.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||qr(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};L.prototype.writeUint32BE=L.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||qr(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function xx(r,e,t,n,i){Cx(e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}function Ex(r,e,t,n,i){Cx(e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>>8,r[t+5]=s,s=s>>8,r[t+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}L.prototype.writeBigUInt64LE=Js(function(e,t=0){return xx(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});L.prototype.writeBigUInt64BE=Js(function(e,t=0){return Ex(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});L.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t=t>>>0,!i){let l=Math.pow(2,8*n-1);qr(this,e,t,n,l-1,-l)}let s=0,o=1,a=0;for(this[t]=e&255;++s<n&&(o*=256);)e<0&&a===0&&this[t+s-1]!==0&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n};L.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t=t>>>0,!i){let l=Math.pow(2,8*n-1);qr(this,e,t,n,l-1,-l)}let s=n-1,o=1,a=0;for(this[t+s]=e&255;--s>=0&&(o*=256);)e<0&&a===0&&this[t+s+1]!==0&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+n};L.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||qr(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};L.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||qr(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};L.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||qr(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};L.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||qr(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};L.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||qr(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};L.prototype.writeBigInt64LE=Js(function(e,t=0){return xx(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});L.prototype.writeBigInt64BE=Js(function(e,t=0){return Ex(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Sx(r,e,t,n,i,s){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function kx(r,e,t,n,i){return e=+e,t=t>>>0,i||Sx(r,e,t,4,34028234663852886e22,-34028234663852886e22),rl.write(r,e,t,n,23,4),t+4}L.prototype.writeFloatLE=function(e,t,n){return kx(this,e,t,!0,n)};L.prototype.writeFloatBE=function(e,t,n){return kx(this,e,t,!1,n)};function Ax(r,e,t,n,i){return e=+e,t=t>>>0,i||Sx(r,e,t,8,17976931348623157e292,-17976931348623157e292),rl.write(r,e,t,n,52,8),t+8}L.prototype.writeDoubleLE=function(e,t,n){return Ax(this,e,t,!0,n)};L.prototype.writeDoubleBE=function(e,t,n){return Ax(this,e,t,!1,n)};L.prototype.copy=function(e,t,n,i){if(!L.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);let s=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),t),s};L.prototype.fill=function(e,t,n,i){if(typeof e=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!L.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let o=e.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=t;s<n;++s)this[s]=e;else{let o=L.isBuffer(e)?e:L.from(e,i),a=o.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-t;++s)this[s+t]=o[s%a]}return this};var tl={};function kg(r,e,t){tl[r]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}kg("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);kg("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError);kg("ERR_OUT_OF_RANGE",function(r,e,t){let n=`The value of "${r}" is out of range.`,i=t;return Number.isInteger(t)&&Math.abs(t)>2**32?i=gx(String(t)):typeof t=="bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=gx(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function gx(r){let e="",t=r.length,n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function _F(r,e,t){nl(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&Kc(e,r.length-(t+1))}function Cx(r,e,t,n,i,s){if(r>t||r<e){let o=typeof e=="bigint"?"n":"",a;throw s>3?e===0||e===BigInt(0)?a=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:a=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:a=`>= ${e}${o} and <= ${t}${o}`,new tl.ERR_OUT_OF_RANGE("value",a,r)}_F(n,i,s)}function nl(r,e){if(typeof r!="number")throw new tl.ERR_INVALID_ARG_TYPE(e,"number",r)}function Kc(r,e,t){throw Math.floor(r)!==r?(nl(r,t),new tl.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new tl.ERR_BUFFER_OUT_OF_BOUNDS:new tl.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var xF=/[^+/0-9A-Za-z-_]/g;function EF(r){if(r=r.split("=")[0],r=r.trim().replace(xF,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function xg(r,e){e=e||1/0;let t,n=r.length,i=null,s=[];for(let o=0;o<n;++o){if(t=r.charCodeAt(o),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function SF(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function kF(r,e){let t,n,i,s=[];for(let o=0;o<r.length&&!((e-=2)<0);++o)t=r.charCodeAt(o),n=t>>8,i=t%256,s.push(i),s.push(n);return s}function Tx(r){return bg.toByteArray(EF(r))}function xd(r,e,t,n){let i;for(i=0;i<n&&!(i+t>=e.length||i>=r.length);++i)e[i+t]=r[i];return i}function Bi(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function Ag(r){return r!==r}var AF=(function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i<16;++i)e[n+i]=r[t]+r[i]}return e})();function Js(r){return typeof BigInt=="undefined"?CF:r}function CF(){throw new Error("BigInt not supported")}});var Rx,Tg,_,g=qO(()=>{"use strict";Rx=require("obsidian");Rx.Platform.isMobileApp?Tg=Cg().Buffer:Tg=global.Buffer;_=Tg});var $x=G((tW,Rg)=>{g();typeof Object.create=="function"?Rg.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Rg.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}});var Sd=G(($g,Ix)=>{g();var Ed=Cg(),Hi=Ed.Buffer;function Px(r,e){for(var t in r)e[t]=r[t]}Hi.from&&Hi.alloc&&Hi.allocUnsafe&&Hi.allocUnsafeSlow?Ix.exports=Ed:(Px(Ed,$g),$g.Buffer=Vo);function Vo(r,e,t){return Hi(r,e,t)}Vo.prototype=Object.create(Hi.prototype);Px(Hi,Vo);Vo.from=function(r,e,t){if(typeof r=="number")throw new TypeError("Argument must not be a number");return Hi(r,e,t)};Vo.alloc=function(r,e,t){if(typeof r!="number")throw new TypeError("Argument must be a number");var n=Hi(r);return e!==void 0?typeof t=="string"?n.fill(e,t):n.fill(e):n.fill(0),n};Vo.allocUnsafe=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return Hi(r)};Vo.allocUnsafeSlow=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return Ed.SlowBuffer(r)}});var Fx=G((iW,Ox)=>{g();var TF={}.toString;Ox.exports=Array.isArray||function(r){return TF.call(r)=="[object Array]"}});var sl=G((oW,Mx)=>{"use strict";g();Mx.exports=TypeError});var Pg=G((lW,Dx)=>{"use strict";g();Dx.exports=Object});var Nx=G((uW,Lx)=>{"use strict";g();Lx.exports=Error});var Hx=G((dW,Bx)=>{"use strict";g();Bx.exports=EvalError});var Ux=G((pW,Gx)=>{"use strict";g();Gx.exports=RangeError});var zx=G((gW,jx)=>{"use strict";g();jx.exports=ReferenceError});var Ig=G((vW,Vx)=>{"use strict";g();Vx.exports=SyntaxError});var qx=G((yW,Wx)=>{"use strict";g();Wx.exports=URIError});var Kx=G((xW,Yx)=>{"use strict";g();Yx.exports=Math.abs});var Xx=G((SW,Zx)=>{"use strict";g();Zx.exports=Math.floor});var Jx=G((AW,Qx)=>{"use strict";g();Qx.exports=Math.max});var t1=G((TW,e1)=>{"use strict";g();e1.exports=Math.min});var n1=G(($W,r1)=>{"use strict";g();r1.exports=Math.pow});var s1=G((IW,i1)=>{"use strict";g();i1.exports=Math.round});var a1=G((FW,o1)=>{"use strict";g();o1.exports=Number.isNaN||function(e){return e!==e}});var c1=G((DW,l1)=>{"use strict";g();var RF=a1();l1.exports=function(e){return RF(e)||e===0?e:e<0?-1:1}});var f1=G((NW,u1)=>{"use strict";g();u1.exports=Object.getOwnPropertyDescriptor});var ol=G((HW,d1)=>{"use strict";g();var kd=f1();if(kd)try{kd([],"length")}catch(r){kd=null}d1.exports=kd});var Zc=G((UW,h1)=>{"use strict";g();var Ad=Object.defineProperty||!1;if(Ad)try{Ad({},"a",{value:1})}catch(r){Ad=!1}h1.exports=Ad});var Og=G((zW,p1)=>{"use strict";g();p1.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var i=42;e[t]=i;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 o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(e,t);if(a.value!==i||a.enumerable!==!0)return!1}return!0}});var w1=G((WW,g1)=>{"use strict";g();var m1=typeof Symbol!="undefined"&&Symbol,$F=Og();g1.exports=function(){return typeof m1!="function"||typeof Symbol!="function"||typeof m1("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:$F()}});var Fg=G((YW,v1)=>{"use strict";g();v1.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var Mg=G((ZW,b1)=>{"use strict";g();var PF=Pg();b1.exports=PF.getPrototypeOf||null});var x1=G((QW,_1)=>{"use strict";g();var IF="Function.prototype.bind called on incompatible ",OF=Object.prototype.toString,FF=Math.max,MF="[object Function]",y1=function(e,t){for(var n=[],i=0;i<e.length;i+=1)n[i]=e[i];for(var s=0;s<t.length;s+=1)n[s+e.length]=t[s];return n},DF=function(e,t){for(var n=[],i=t||0,s=0;i<e.length;i+=1,s+=1)n[s]=e[i];return n},LF=function(r,e){for(var t="",n=0;n<r.length;n+=1)t+=r[n],n+1<r.length&&(t+=e);return t};_1.exports=function(e){var t=this;if(typeof t!="function"||OF.apply(t)!==MF)throw new TypeError(IF+t);for(var n=DF(arguments,1),i,s=function(){if(this instanceof i){var u=t.apply(this,y1(n,arguments));return Object(u)===u?u:this}return t.apply(e,y1(n,arguments))},o=FF(0,t.length-n.length),a=[],l=0;l<o;l++)a[l]="$"+l;if(i=Function("binder","return function ("+LF(a,",")+"){ return binder.apply(this,arguments); }")(s),t.prototype){var c=function(){};c.prototype=t.prototype,i.prototype=new c,c.prototype=null}return i}});var al=G((eq,E1)=>{"use strict";g();var NF=x1();E1.exports=Function.prototype.bind||NF});var Cd=G((rq,S1)=>{"use strict";g();S1.exports=Function.prototype.call});var Td=G((iq,k1)=>{"use strict";g();k1.exports=Function.prototype.apply});var C1=G((oq,A1)=>{"use strict";g();A1.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var Dg=G((lq,T1)=>{"use strict";g();var BF=al(),HF=Td(),GF=Cd(),UF=C1();T1.exports=UF||BF.call(GF,HF)});var Rd=G((uq,R1)=>{"use strict";g();var jF=al(),zF=sl(),VF=Cd(),WF=Dg();R1.exports=function(e){if(e.length<1||typeof e[0]!="function")throw new zF("a function is required");return WF(jF,VF,e)}});var M1=G((dq,F1)=>{"use strict";g();var qF=Rd(),$1=ol(),I1;try{I1=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var Lg=!!I1&&$1&&$1(Object.prototype,"__proto__"),O1=Object,P1=O1.getPrototypeOf;F1.exports=Lg&&typeof Lg.get=="function"?qF([Lg.get]):typeof P1=="function"?function(e){return P1(e==null?e:O1(e))}:!1});var Ng=G((pq,B1)=>{"use strict";g();var D1=Fg(),L1=Mg(),N1=M1();B1.exports=D1?function(e){return D1(e)}:L1?function(e){if(!e||typeof e!="object"&&typeof e!="function")throw new TypeError("getProto: not an object");return L1(e)}:N1?function(e){return N1(e)}:null});var G1=G((gq,H1)=>{"use strict";g();var YF=Function.prototype.call,KF=Object.prototype.hasOwnProperty,ZF=al();H1.exports=ZF.call(YF,KF)});var Gg=G((vq,q1)=>{"use strict";g();var Ne,XF=Pg(),QF=Nx(),JF=Hx(),eM=Ux(),tM=zx(),fl=Ig(),ul=sl(),rM=qx(),nM=Kx(),iM=Xx(),sM=Jx(),oM=t1(),aM=n1(),lM=s1(),cM=c1(),V1=Function,Bg=function(r){try{return V1('"use strict"; return ('+r+").constructor;")()}catch(e){}},Xc=ol(),uM=Zc(),Hg=function(){throw new ul},fM=Xc?(function(){try{return arguments.callee,Hg}catch(r){try{return Xc(arguments,"callee").get}catch(e){return Hg}}})():Hg,ll=w1()(),nr=Ng(),dM=Mg(),hM=Fg(),W1=Td(),Qc=Cd(),cl={},pM=typeof Uint8Array=="undefined"||!nr?Ne:nr(Uint8Array),Wo={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?Ne:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Ne:ArrayBuffer,"%ArrayIteratorPrototype%":ll&&nr?nr([][Symbol.iterator]()):Ne,"%AsyncFromSyncIteratorPrototype%":Ne,"%AsyncFunction%":cl,"%AsyncGenerator%":cl,"%AsyncGeneratorFunction%":cl,"%AsyncIteratorPrototype%":cl,"%Atomics%":typeof Atomics=="undefined"?Ne:Atomics,"%BigInt%":typeof BigInt=="undefined"?Ne:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Ne:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Ne:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Ne:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":QF,"%eval%":eval,"%EvalError%":JF,"%Float16Array%":typeof Float16Array=="undefined"?Ne:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?Ne:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Ne:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Ne:FinalizationRegistry,"%Function%":V1,"%GeneratorFunction%":cl,"%Int8Array%":typeof Int8Array=="undefined"?Ne:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Ne:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Ne:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ll&&nr?nr(nr([][Symbol.iterator]())):Ne,"%JSON%":typeof JSON=="object"?JSON:Ne,"%Map%":typeof Map=="undefined"?Ne:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!ll||!nr?Ne:nr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":XF,"%Object.getOwnPropertyDescriptor%":Xc,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Ne:Promise,"%Proxy%":typeof Proxy=="undefined"?Ne:Proxy,"%RangeError%":eM,"%ReferenceError%":tM,"%Reflect%":typeof Reflect=="undefined"?Ne:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Ne:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!ll||!nr?Ne:nr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Ne:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ll&&nr?nr(""[Symbol.iterator]()):Ne,"%Symbol%":ll?Symbol:Ne,"%SyntaxError%":fl,"%ThrowTypeError%":fM,"%TypedArray%":pM,"%TypeError%":ul,"%Uint8Array%":typeof Uint8Array=="undefined"?Ne:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Ne:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Ne:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Ne:Uint32Array,"%URIError%":rM,"%WeakMap%":typeof WeakMap=="undefined"?Ne:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Ne:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Ne:WeakSet,"%Function.prototype.call%":Qc,"%Function.prototype.apply%":W1,"%Object.defineProperty%":uM,"%Object.getPrototypeOf%":dM,"%Math.abs%":nM,"%Math.floor%":iM,"%Math.max%":sM,"%Math.min%":oM,"%Math.pow%":aM,"%Math.round%":lM,"%Math.sign%":cM,"%Reflect.getPrototypeOf%":hM};if(nr)try{null.error}catch(r){U1=nr(nr(r)),Wo["%Error.prototype%"]=U1}var U1,mM=function r(e){var t;if(e==="%AsyncFunction%")t=Bg("async function () {}");else if(e==="%GeneratorFunction%")t=Bg("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Bg("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var i=r("%AsyncGenerator%");i&&nr&&(t=nr(i.prototype))}return Wo[e]=t,t},j1={__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"]},Jc=al(),$d=G1(),gM=Jc.call(Qc,Array.prototype.concat),wM=Jc.call(W1,Array.prototype.splice),z1=Jc.call(Qc,String.prototype.replace),Pd=Jc.call(Qc,String.prototype.slice),vM=Jc.call(Qc,RegExp.prototype.exec),bM=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,yM=/\\(\\)?/g,_M=function(e){var t=Pd(e,0,1),n=Pd(e,-1);if(t==="%"&&n!=="%")throw new fl("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new fl("invalid intrinsic syntax, expected opening `%`");var i=[];return z1(e,bM,function(s,o,a,l){i[i.length]=a?z1(l,yM,"$1"):o||s}),i},xM=function(e,t){var n=e,i;if($d(j1,n)&&(i=j1[n],n="%"+i[0]+"%"),$d(Wo,n)){var s=Wo[n];if(s===cl&&(s=mM(n)),typeof s=="undefined"&&!t)throw new ul("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:i,name:n,value:s}}throw new fl("intrinsic "+e+" does not exist!")};q1.exports=function(e,t){if(typeof e!="string"||e.length===0)throw new ul("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new ul('"allowMissing" argument must be a boolean');if(vM(/^%?[^%]*%?$/,e)===null)throw new fl("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=_M(e),i=n.length>0?n[0]:"",s=xM("%"+i+"%",t),o=s.name,a=s.value,l=!1,c=s.alias;c&&(i=c[0],wM(n,gM([0,1],c)));for(var u=1,f=!0;u<n.length;u+=1){var d=n[u],h=Pd(d,0,1),p=Pd(d,-1);if((h==='"'||h==="'"||h==="`"||p==='"'||p==="'"||p==="`")&&h!==p)throw new fl("property names with quotes must have matching quotes");if((d==="constructor"||!f)&&(l=!0),i+="."+d,o="%"+i+"%",$d(Wo,o))a=Wo[o];else if(a!=null){if(!(d in a)){if(!t)throw new ul("base intrinsic for "+e+" exists, but the property is not available.");return}if(Xc&&u+1>=n.length){var m=Xc(a,d);f=!!m,f&&"get"in m&&!("originalValue"in m.get)?a=m.get:a=a[d]}else f=$d(a,d),a=a[d];f&&!l&&(Wo[o]=a)}}return a}});var Ug=G((yq,Z1)=>{"use strict";g();var Y1=Gg(),K1=Rd(),EM=K1([Y1("%String.prototype.indexOf%")]);Z1.exports=function(e,t){var n=Y1(e,!!t);return typeof n=="function"&&EM(e,".prototype.")>-1?K1([n]):n}});var eE=G((xq,J1)=>{"use strict";g();var Q1=Function.prototype.toString,dl=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,zg,Id;if(typeof dl=="function"&&typeof Object.defineProperty=="function")try{zg=Object.defineProperty({},"length",{get:function(){throw Id}}),Id={},dl(function(){throw 42},null,zg)}catch(r){r!==Id&&(dl=null)}else dl=null;var SM=/^\s*class\b/,Vg=function(e){try{var t=Q1.call(e);return SM.test(t)}catch(n){return!1}},jg=function(e){try{return Vg(e)?!1:(Q1.call(e),!0)}catch(t){return!1}},Od=Object.prototype.toString,kM="[object Object]",AM="[object Function]",CM="[object GeneratorFunction]",TM="[object HTMLAllCollection]",RM="[object HTML document.all class]",$M="[object HTMLCollection]",PM=typeof Symbol=="function"&&!!Symbol.toStringTag,IM=!(0 in[,]),Wg=function(){return!1};typeof document=="object"&&(X1=document.all,Od.call(X1)===Od.call(document.all)&&(Wg=function(e){if((IM||!e)&&(typeof e=="undefined"||typeof e=="object"))try{var t=Od.call(e);return(t===TM||t===RM||t===$M||t===kM)&&e("")==null}catch(n){}return!1}));var X1;J1.exports=dl?function(e){if(Wg(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{dl(e,null,zg)}catch(t){if(t!==Id)return!1}return!Vg(e)&&jg(e)}:function(e){if(Wg(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(PM)return jg(e);if(Vg(e))return!1;var t=Od.call(e);return t!==AM&&t!==CM&&!/^\[object HTML/.test(t)?!1:jg(e)}});var nE=G((Sq,rE)=>{"use strict";g();var OM=eE(),FM=Object.prototype.toString,tE=Object.prototype.hasOwnProperty,MM=function(e,t,n){for(var i=0,s=e.length;i<s;i++)tE.call(e,i)&&(n==null?t(e[i],i,e):t.call(n,e[i],i,e))},DM=function(e,t,n){for(var i=0,s=e.length;i<s;i++)n==null?t(e.charAt(i),i,e):t.call(n,e.charAt(i),i,e)},LM=function(e,t,n){for(var i in e)tE.call(e,i)&&(n==null?t(e[i],i,e):t.call(n,e[i],i,e))};function NM(r){return FM.call(r)==="[object Array]"}rE.exports=function(e,t,n){if(!OM(t))throw new TypeError("iterator must be a function");var i;arguments.length>=3&&(i=n),NM(e)?MM(e,t,i):typeof e=="string"?DM(e,t,i):LM(e,t,i)}});var sE=G((Aq,iE)=>{"use strict";g();iE.exports=["Float16Array","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var aE=G((Tq,oE)=>{"use strict";g();var qg=sE(),BM=typeof globalThis=="undefined"?global:globalThis;oE.exports=function(){for(var e=[],t=0;t<qg.length;t++)typeof BM[qg[t]]=="function"&&(e[e.length]=qg[t]);return e}});var fE=G(($q,uE)=>{"use strict";g();var lE=Zc(),HM=Ig(),hl=sl(),cE=ol();uE.exports=function(e,t,n){if(!e||typeof e!="object"&&typeof e!="function")throw new hl("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new hl("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new hl("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new hl("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new hl("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new hl("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,s=arguments.length>4?arguments[4]:null,o=arguments.length>5?arguments[5]:null,a=arguments.length>6?arguments[6]:!1,l=!!cE&&cE(e,t);if(lE)lE(e,t,{configurable:o===null&&l?l.configurable:!o,enumerable:i===null&&l?l.enumerable:!i,value:n,writable:s===null&&l?l.writable:!s});else if(a||!i&&!s&&!o)e[t]=n;else throw new HM("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var pE=G((Iq,hE)=>{"use strict";g();var Yg=Zc(),dE=function(){return!!Yg};dE.hasArrayLengthDefineBug=function(){if(!Yg)return null;try{return Yg([],"length",{value:1}).length!==1}catch(e){return!0}};hE.exports=dE});var bE=G((Fq,vE)=>{"use strict";g();var GM=Gg(),mE=fE(),UM=pE()(),gE=ol(),wE=sl(),jM=GM("%Math.floor%");vE.exports=function(e,t){if(typeof e!="function")throw new wE("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||jM(t)!==t)throw new wE("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],i=!0,s=!0;if("length"in e&&gE){var o=gE(e,"length");o&&!o.configurable&&(i=!1),o&&!o.writable&&(s=!1)}return(i||s||!n)&&(UM?mE(e,"length",t,!0,!0):mE(e,"length",t)),e}});var _E=G((Dq,yE)=>{"use strict";g();var zM=al(),VM=Td(),WM=Dg();yE.exports=function(){return WM(zM,VM,arguments)}});var SE=G((Nq,Fd)=>{"use strict";g();var qM=bE(),xE=Zc(),YM=Rd(),EE=_E();Fd.exports=function(e){var t=YM(arguments),n=1+e.length-(arguments.length-1);return qM(t,n>0?n:0,!0)};xE?xE(Fd.exports,"apply",{value:EE}):Fd.exports.apply=EE});var AE=G((Hq,kE)=>{"use strict";g();var KM=Og();kE.exports=function(){return KM()&&!!Symbol.toStringTag}});var PE=G((Uq,$E)=>{"use strict";g();var Ld=nE(),ZM=aE(),CE=SE(),Zg=Ug(),Dd=ol(),Md=Ng(),XM=Zg("Object.prototype.toString"),RE=AE()(),TE=typeof globalThis=="undefined"?global:globalThis,Kg=ZM(),Xg=Zg("String.prototype.slice"),QM=Zg("Array.prototype.indexOf",!0)||function(e,t){for(var n=0;n<e.length;n+=1)if(e[n]===t)return n;return-1},Nd={__proto__:null};RE&&Dd&&Md?Ld(Kg,function(r){var e=new TE[r];if(Symbol.toStringTag in e&&Md){var t=Md(e),n=Dd(t,Symbol.toStringTag);if(!n&&t){var i=Md(t);n=Dd(i,Symbol.toStringTag)}if(n&&n.get){var s=CE(n.get);Nd["$"+r]=s}}}):Ld(Kg,function(r){var e=new TE[r],t=e.slice||e.set;if(t){var n=CE(t);Nd["$"+r]=n}});function JM(r){var e=!1;return Ld(Nd,function(t,n){if(!e)try{"$"+t(r)===n&&(e=Xg(n,1))}catch(i){}}),e}function eD(r){var e=!1;return Ld(Nd,function(t,n){if(!e)try{t(r),e=Xg(n,1)}catch(i){}}),e}function tD(r){return QM(Kg,r)>-1}function rD(r){if(!r||typeof r!="object")return!1;if(!RE){var e=Xg(XM(r),8,-1);return tD(e)?e:e!=="Object"?!1:eD(r)}return Dd?JM(r):null}$E.exports=rD});var OE=G((zq,IE)=>{"use strict";g();var nD=PE();IE.exports=function(e){return!!nD(e)}});var ME=G((Wq,FE)=>{"use strict";g();var iD=sl(),sD=Ug(),oD=sD("TypedArray.prototype.buffer",!0),aD=OE();FE.exports=oD||function(e){if(!aD(e))throw new iD("Not a Typed Array");return e.buffer}});var NE=G((Yq,LE)=>{"use strict";g();var di=Sd().Buffer,lD=Fx(),cD=ME(),uD=ArrayBuffer.isView||function(e){try{return cD(e),!0}catch(t){return!1}},fD=typeof Uint8Array!="undefined",DE=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined",dD=DE&&(di.prototype instanceof Uint8Array||di.TYPED_ARRAY_SUPPORT);LE.exports=function(e,t){if(di.isBuffer(e))return e.constructor&&!("isBuffer"in e)?di.from(e):e;if(typeof e=="string")return di.from(e,t);if(DE&&uD(e)){if(e.byteLength===0)return di.alloc(0);if(dD){var n=di.from(e.buffer,e.byteOffset,e.byteLength);if(n.byteLength===e.byteLength)return n}var i=e instanceof Uint8Array?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength),s=di.from(i);if(s.length===e.byteLength)return s}if(fD&&e instanceof Uint8Array)return di.from(e);var o=lD(e);if(o)for(var a=0;a<e.length;a+=1){var l=e[a];if(typeof l!="number"||l<0||l>255||~~l!==l)throw new RangeError("Array items must be numbers in the range 0-255.")}if(o||di.isBuffer(e)&&e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e))return di.from(e);throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.')}});var HE=G((Zq,BE)=>{"use strict";g();var hD=Sd().Buffer,pD=NE();function Bd(r,e){this._block=hD.alloc(r),this._finalSize=e,this._blockSize=r,this._len=0}Bd.prototype.update=function(r,e){r=pD(r,e||"utf8");for(var t=this._block,n=this._blockSize,i=r.length,s=this._len,o=0;o<i;){for(var a=s%n,l=Math.min(i-o,n-a),c=0;c<l;c++)t[a+c]=r[o+c];s+=l,o+=l,s%n===0&&this._update(t)}return this._len+=i,this};Bd.prototype.digest=function(r){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var t=this._len*8;if(t<=4294967295)this._block.writeUInt32BE(t,this._blockSize-4);else{var n=(t&4294967295)>>>0,i=(t-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return r?s.toString(r):s};Bd.prototype._update=function(){throw new Error("_update must be implemented by subclass")};BE.exports=Bd});var Qg=G((Qq,UE)=>{"use strict";g();var mD=$x(),GE=HE(),gD=Sd().Buffer,wD=[1518500249,1859775393,-1894007588,-899497514],vD=new Array(80);function eu(){this.init(),this._w=vD,GE.call(this,64,56)}mD(eu,GE);eu.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function bD(r){return r<<1|r>>>31}function yD(r){return r<<5|r>>>27}function _D(r){return r<<30|r>>>2}function xD(r,e,t,n){return r===0?e&t|~e&n:r===2?e&t|e&n|t&n:e^t^n}eu.prototype._update=function(r){for(var e=this._w,t=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,o=this._e|0,a=0;a<16;++a)e[a]=r.readInt32BE(a*4);for(;a<80;++a)e[a]=bD(e[a-3]^e[a-8]^e[a-14]^e[a-16]);for(var l=0;l<80;++l){var c=~~(l/20),u=yD(t)+xD(c,n,i,s)+o+e[l]+wD[c]|0;o=s,s=i,i=_D(n),n=t,t=u}this._a=t+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=o+this._e|0};eu.prototype._hash=function(){var r=gD.allocUnsafe(20);return r.writeInt32BE(this._a|0,0),r.writeInt32BE(this._b|0,4),r.writeInt32BE(this._c|0,8),r.writeInt32BE(this._d|0,12),r.writeInt32BE(this._e|0,16),r};UE.exports=eu});var zE=G((e7,jE)=>{"use strict";g();var bn=function(r){if(r=r||{},this.Promise=r.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=r.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=r.timeout||bn.DEFAULT_TIMEOUT,this.maxOccupationTime=r.maxOccupationTime||bn.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=r.maxExecutionTime||bn.DEFAULT_MAX_EXECUTION_TIME,r.maxPending===1/0||Number.isInteger(r.maxPending)&&r.maxPending>=0?this.maxPending=r.maxPending:this.maxPending=bn.DEFAULT_MAX_PENDING};bn.DEFAULT_TIMEOUT=0;bn.DEFAULT_MAX_OCCUPATION_TIME=0;bn.DEFAULT_MAX_EXECUTION_TIME=0;bn.DEFAULT_MAX_PENDING=1e3;bn.prototype.acquire=function(r,e,t,n){if(Array.isArray(r))return this._acquireBatch(r,e,t,n);if(typeof e!="function")throw new Error("You must pass a function to execute");var i=null,s=null,o=null;typeof t!="function"&&(n=t,t=null,o=new this.Promise(function(v,A){i=v,s=A})),n=n||{};var a=!1,l=null,c=null,u=null,f=this,d=function(v,A,C){c&&(clearTimeout(c),c=null),u&&(clearTimeout(u),u=null),v&&(f.queues[r]&&f.queues[r].length===0&&delete f.queues[r],f.domainReentrant&&delete f.domains[r]),a||(o?A?s(A):i(C):typeof t=="function"&&t(A,C),a=!0),v&&f.queues[r]&&f.queues[r].length>0&&f.queues[r].shift()()},h=function(v){if(a)return d(v);l&&(clearTimeout(l),l=null),f.domainReentrant&&v&&(f.domains[r]=process.domain);var A=n.maxExecutionTime||f.maxExecutionTime;if(A&&(u=setTimeout(function(){f.queues[r]&&d(v,new Error("Maximum execution time is exceeded "+r))},A)),e.length===1){var C=!1;try{e(function(S,T){C||(C=!0,d(v,S,T))})}catch(S){C||(C=!0,d(v,S))}}else f._promiseTry(function(){return e()}).then(function(S){d(v,void 0,S)},function(S){d(v,S)})};f.domainReentrant&&process.domain&&(h=process.domain.bind(h));var p=n.maxPending||f.maxPending;if(!f.queues[r])f.queues[r]=[],h(!0);else if(f.domainReentrant&&process.domain&&process.domain===f.domains[r])h(!1);else if(f.queues[r].length>=p)d(!1,new Error("Too many pending tasks in queue "+r));else{var m=function(){h(!0)};n.skipQueue?f.queues[r].unshift(m):f.queues[r].push(m);var w=n.timeout||f.timeout;w&&(l=setTimeout(function(){l=null,d(!1,new Error("async-lock timed out in queue "+r))},w))}var y=n.maxOccupationTime||f.maxOccupationTime;if(y&&(c=setTimeout(function(){f.queues[r]&&d(!1,new Error("Maximum occupation time is exceeded in queue "+r))},y)),o)return o};bn.prototype._acquireBatch=function(r,e,t,n){typeof t!="function"&&(n=t,t=null);var i=this,s=function(a,l){return function(c){i.acquire(a,l,c,n)}},o=r.reduceRight(function(a,l){return s(l,a)},e);if(typeof t=="function")o(t);else return new this.Promise(function(a,l){o.length===1?o(function(c,u){c?l(c):a(u)}):a(o())})};bn.prototype.isBusy=function(r){return r?!!this.queues[r]:Object.keys(this.queues).length>0};bn.prototype._promiseTry=function(r){try{return this.Promise.resolve(r())}catch(e){return this.Promise.reject(e)}};jE.exports=bn});var Jg=G((r7,VE)=>{"use strict";g();VE.exports=zE()});var ew=G((i7,WE)=>{"use strict";g();function ED(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Gi(r,e,t){return e=e instanceof RegExp?e:new RegExp(ED(e),"g"),r.replace(e,t)}var SD={clean:function(e){if(typeof e!="string")throw new Error("Expected a string, received: "+e);return e=Gi(e,"./","/"),e=Gi(e,"..","."),e=Gi(e," ","-"),e=Gi(e,/^[~^:?*\\\-]/g,""),e=Gi(e,/[~^:?*\\]/g,"-"),e=Gi(e,/[~^:?*\\\-]$/g,""),e=Gi(e,"@{","-"),e=Gi(e,/\.$/g,""),e=Gi(e,/\/$/g,""),e=Gi(e,/\.lock$/g,""),e}};WE.exports=SD});var rw=G(tw=>{g();var qE;(function(r){typeof DO_NOT_EXPORT_CRC=="undefined"?typeof tw=="object"?r(tw):typeof define=="function"&&define.amd?define(function(){var e={};return r(e),e}):r(qE={}):r(qE={})})(function(r){r.version="1.2.2";function e(){for(var b=0,x=new Array(256),E=0;E!=256;++E)b=E,b=b&1?-306674912^b>>>1:b>>>1,b=b&1?-306674912^b>>>1:b>>>1,b=b&1?-306674912^b>>>1:b>>>1,b=b&1?-306674912^b>>>1:b>>>1,b=b&1?-306674912^b>>>1:b>>>1,b=b&1?-306674912^b>>>1:b>>>1,b=b&1?-306674912^b>>>1:b>>>1,b=b&1?-306674912^b>>>1:b>>>1,x[E]=b;return typeof Int32Array!="undefined"?new Int32Array(x):x}var t=e();function n(b){var x=0,E=0,k=0,$=typeof Int32Array!="undefined"?new Int32Array(4096):new Array(4096);for(k=0;k!=256;++k)$[k]=b[k];for(k=0;k!=256;++k)for(E=b[k],x=256+k;x<4096;x+=256)E=$[x]=E>>>8^b[E&255];var M=[];for(k=1;k!=16;++k)M[k-1]=typeof Int32Array!="undefined"?$.subarray(k*256,k*256+256):$.slice(k*256,k*256+256);return M}var i=n(t),s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],u=i[5],f=i[6],d=i[7],h=i[8],p=i[9],m=i[10],w=i[11],y=i[12],v=i[13],A=i[14];function C(b,x){for(var E=x^-1,k=0,$=b.length;k<$;)E=E>>>8^t[(E^b.charCodeAt(k++))&255];return~E}function S(b,x){for(var E=x^-1,k=b.length-15,$=0;$<k;)E=A[b[$++]^E&255]^v[b[$++]^E>>8&255]^y[b[$++]^E>>16&255]^w[b[$++]^E>>>24]^m[b[$++]]^p[b[$++]]^h[b[$++]]^d[b[$++]]^f[b[$++]]^u[b[$++]]^c[b[$++]]^l[b[$++]]^a[b[$++]]^o[b[$++]]^s[b[$++]]^t[b[$++]];for(k+=15;$<k;)E=E>>>8^t[(E^b[$++])&255];return~E}function T(b,x){for(var E=x^-1,k=0,$=b.length,M=0,D=0;k<$;)M=b.charCodeAt(k++),M<128?E=E>>>8^t[(E^M)&255]:M<2048?(E=E>>>8^t[(E^(192|M>>6&31))&255],E=E>>>8^t[(E^(128|M&63))&255]):M>=55296&&M<57344?(M=(M&1023)+64,D=b.charCodeAt(k++)&1023,E=E>>>8^t[(E^(240|M>>8&7))&255],E=E>>>8^t[(E^(128|M>>2&63))&255],E=E>>>8^t[(E^(128|D>>6&15|(M&3)<<4))&255],E=E>>>8^t[(E^(128|D&63))&255]):(E=E>>>8^t[(E^(224|M>>12&15))&255],E=E>>>8^t[(E^(128|M>>6&63))&255],E=E>>>8^t[(E^(128|M&63))&255]);return~E}r.table=t,r.bstr=C,r.buf=S,r.str=T})});var vs=G(Ir=>{"use strict";g();var kD=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function AD(r,e){return Object.prototype.hasOwnProperty.call(r,e)}Ir.assign=function(r){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var t=e.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(var n in t)AD(t,n)&&(r[n]=t[n])}}return r};Ir.shrinkBuf=function(r,e){return r.length===e?r:r.subarray?r.subarray(0,e):(r.length=e,r)};var CD={arraySet:function(r,e,t,n,i){if(e.subarray&&r.subarray){r.set(e.subarray(t,t+n),i);return}for(var s=0;s<n;s++)r[i+s]=e[t+s]},flattenChunks:function(r){var e,t,n,i,s,o;for(n=0,e=0,t=r.length;e<t;e++)n+=r[e].length;for(o=new Uint8Array(n),i=0,e=0,t=r.length;e<t;e++)s=r[e],o.set(s,i),i+=s.length;return o}},TD={arraySet:function(r,e,t,n,i){for(var s=0;s<n;s++)r[i+s]=e[t+s]},flattenChunks:function(r){return[].concat.apply([],r)}};Ir.setTyped=function(r){r?(Ir.Buf8=Uint8Array,Ir.Buf16=Uint16Array,Ir.Buf32=Int32Array,Ir.assign(Ir,CD)):(Ir.Buf8=Array,Ir.Buf16=Array,Ir.Buf32=Array,Ir.assign(Ir,TD))};Ir.setTyped(kD)});var gS=G(gl=>{"use strict";g();var RD=vs(),$D=4,YE=0,KE=1,PD=2;function ml(r){for(var e=r.length;--e>=0;)r[e]=0}var ID=0,tS=1,OD=2,FD=3,MD=258,cw=29,ou=256,ru=ou+1+cw,pl=30,uw=19,rS=2*ru+1,qo=15,nw=16,DD=7,fw=256,nS=16,iS=17,sS=18,aw=[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],Hd=[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],LD=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],oS=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ND=512,bs=new Array((ru+2)*2);ml(bs);var tu=new Array(pl*2);ml(tu);var nu=new Array(ND);ml(nu);var iu=new Array(MD-FD+1);ml(iu);var dw=new Array(cw);ml(dw);var Gd=new Array(pl);ml(Gd);function iw(r,e,t,n,i){this.static_tree=r,this.extra_bits=e,this.extra_base=t,this.elems=n,this.max_length=i,this.has_stree=r&&r.length}var aS,lS,cS;function sw(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}function uS(r){return r<256?nu[r]:nu[256+(r>>>7)]}function su(r,e){r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255}function Yr(r,e,t){r.bi_valid>nw-t?(r.bi_buf|=e<<r.bi_valid&65535,su(r,r.bi_buf),r.bi_buf=e>>nw-r.bi_valid,r.bi_valid+=t-nw):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)}function Ui(r,e,t){Yr(r,t[e*2],t[e*2+1])}function fS(r,e){var t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1}function BD(r){r.bi_valid===16?(su(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)}function HD(r,e){var t=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,s=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,l=e.stat_desc.max_length,c,u,f,d,h,p,m=0;for(d=0;d<=qo;d++)r.bl_count[d]=0;for(t[r.heap[r.heap_max]*2+1]=0,c=r.heap_max+1;c<rS;c++)u=r.heap[c],d=t[t[u*2+1]*2+1]+1,d>l&&(d=l,m++),t[u*2+1]=d,!(u>n)&&(r.bl_count[d]++,h=0,u>=a&&(h=o[u-a]),p=t[u*2],r.opt_len+=p*(d+h),s&&(r.static_len+=p*(i[u*2+1]+h)));if(m!==0){do{for(d=l-1;r.bl_count[d]===0;)d--;r.bl_count[d]--,r.bl_count[d+1]+=2,r.bl_count[l]--,m-=2}while(m>0);for(d=l;d!==0;d--)for(u=r.bl_count[d];u!==0;)f=r.heap[--c],!(f>n)&&(t[f*2+1]!==d&&(r.opt_len+=(d-t[f*2+1])*t[f*2],t[f*2+1]=d),u--)}}function dS(r,e,t){var n=new Array(qo+1),i=0,s,o;for(s=1;s<=qo;s++)n[s]=i=i+t[s-1]<<1;for(o=0;o<=e;o++){var a=r[o*2+1];a!==0&&(r[o*2]=fS(n[a]++,a))}}function GD(){var r,e,t,n,i,s=new Array(qo+1);for(t=0,n=0;n<cw-1;n++)for(dw[n]=t,r=0;r<1<<aw[n];r++)iu[t++]=n;for(iu[t-1]=n,i=0,n=0;n<16;n++)for(Gd[n]=i,r=0;r<1<<Hd[n];r++)nu[i++]=n;for(i>>=7;n<pl;n++)for(Gd[n]=i<<7,r=0;r<1<<Hd[n]-7;r++)nu[256+i++]=n;for(e=0;e<=qo;e++)s[e]=0;for(r=0;r<=143;)bs[r*2+1]=8,r++,s[8]++;for(;r<=255;)bs[r*2+1]=9,r++,s[9]++;for(;r<=279;)bs[r*2+1]=7,r++,s[7]++;for(;r<=287;)bs[r*2+1]=8,r++,s[8]++;for(dS(bs,ru+1,s),r=0;r<pl;r++)tu[r*2+1]=5,tu[r*2]=fS(r,5);aS=new iw(bs,aw,ou+1,ru,qo),lS=new iw(tu,Hd,0,pl,qo),cS=new iw(new Array(0),LD,0,uw,DD)}function hS(r){var e;for(e=0;e<ru;e++)r.dyn_ltree[e*2]=0;for(e=0;e<pl;e++)r.dyn_dtree[e*2]=0;for(e=0;e<uw;e++)r.bl_tree[e*2]=0;r.dyn_ltree[fw*2]=1,r.opt_len=r.static_len=0,r.last_lit=r.matches=0}function pS(r){r.bi_valid>8?su(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0}function UD(r,e,t,n){pS(r),n&&(su(r,t),su(r,~t)),RD.arraySet(r.pending_buf,r.window,e,t,r.pending),r.pending+=t}function ZE(r,e,t,n){var i=e*2,s=t*2;return r[i]<r[s]||r[i]===r[s]&&n[e]<=n[t]}function ow(r,e,t){for(var n=r.heap[t],i=t<<1;i<=r.heap_len&&(i<r.heap_len&&ZE(e,r.heap[i+1],r.heap[i],r.depth)&&i++,!ZE(e,n,r.heap[i],r.depth));)r.heap[t]=r.heap[i],t=i,i<<=1;r.heap[t]=n}function XE(r,e,t){var n,i,s=0,o,a;if(r.last_lit!==0)do n=r.pending_buf[r.d_buf+s*2]<<8|r.pending_buf[r.d_buf+s*2+1],i=r.pending_buf[r.l_buf+s],s++,n===0?Ui(r,i,e):(o=iu[i],Ui(r,o+ou+1,e),a=aw[o],a!==0&&(i-=dw[o],Yr(r,i,a)),n--,o=uS(n),Ui(r,o,t),a=Hd[o],a!==0&&(n-=Gd[o],Yr(r,n,a)));while(s<r.last_lit);Ui(r,fw,e)}function lw(r,e){var t=e.dyn_tree,n=e.stat_desc.static_tree,i=e.stat_desc.has_stree,s=e.stat_desc.elems,o,a,l=-1,c;for(r.heap_len=0,r.heap_max=rS,o=0;o<s;o++)t[o*2]!==0?(r.heap[++r.heap_len]=l=o,r.depth[o]=0):t[o*2+1]=0;for(;r.heap_len<2;)c=r.heap[++r.heap_len]=l<2?++l:0,t[c*2]=1,r.depth[c]=0,r.opt_len--,i&&(r.static_len-=n[c*2+1]);for(e.max_code=l,o=r.heap_len>>1;o>=1;o--)ow(r,t,o);c=s;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],ow(r,t,1),a=r.heap[1],r.heap[--r.heap_max]=o,r.heap[--r.heap_max]=a,t[c*2]=t[o*2]+t[a*2],r.depth[c]=(r.depth[o]>=r.depth[a]?r.depth[o]:r.depth[a])+1,t[o*2+1]=t[a*2+1]=c,r.heap[1]=c++,ow(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],HD(r,e),dS(t,l,r.bl_count)}function QE(r,e,t){var n,i=-1,s,o=e[1],a=0,l=7,c=4;for(o===0&&(l=138,c=3),e[(t+1)*2+1]=65535,n=0;n<=t;n++)s=o,o=e[(n+1)*2+1],!(++a<l&&s===o)&&(a<c?r.bl_tree[s*2]+=a:s!==0?(s!==i&&r.bl_tree[s*2]++,r.bl_tree[nS*2]++):a<=10?r.bl_tree[iS*2]++:r.bl_tree[sS*2]++,a=0,i=s,o===0?(l=138,c=3):s===o?(l=6,c=3):(l=7,c=4))}function JE(r,e,t){var n,i=-1,s,o=e[1],a=0,l=7,c=4;for(o===0&&(l=138,c=3),n=0;n<=t;n++)if(s=o,o=e[(n+1)*2+1],!(++a<l&&s===o)){if(a<c)do Ui(r,s,r.bl_tree);while(--a!==0);else s!==0?(s!==i&&(Ui(r,s,r.bl_tree),a--),Ui(r,nS,r.bl_tree),Yr(r,a-3,2)):a<=10?(Ui(r,iS,r.bl_tree),Yr(r,a-3,3)):(Ui(r,sS,r.bl_tree),Yr(r,a-11,7));a=0,i=s,o===0?(l=138,c=3):s===o?(l=6,c=3):(l=7,c=4)}}function jD(r){var e;for(QE(r,r.dyn_ltree,r.l_desc.max_code),QE(r,r.dyn_dtree,r.d_desc.max_code),lw(r,r.bl_desc),e=uw-1;e>=3&&r.bl_tree[oS[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e}function zD(r,e,t,n){var i;for(Yr(r,e-257,5),Yr(r,t-1,5),Yr(r,n-4,4),i=0;i<n;i++)Yr(r,r.bl_tree[oS[i]*2+1],3);JE(r,r.dyn_ltree,e-1),JE(r,r.dyn_dtree,t-1)}function VD(r){var e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return YE;if(r.dyn_ltree[18]!==0||r.dyn_ltree[20]!==0||r.dyn_ltree[26]!==0)return KE;for(t=32;t<ou;t++)if(r.dyn_ltree[t*2]!==0)return KE;return YE}var eS=!1;function WD(r){eS||(GD(),eS=!0),r.l_desc=new sw(r.dyn_ltree,aS),r.d_desc=new sw(r.dyn_dtree,lS),r.bl_desc=new sw(r.bl_tree,cS),r.bi_buf=0,r.bi_valid=0,hS(r)}function mS(r,e,t,n){Yr(r,(ID<<1)+(n?1:0),3),UD(r,e,t,!0)}function qD(r){Yr(r,tS<<1,3),Ui(r,fw,bs),BD(r)}function YD(r,e,t,n){var i,s,o=0;r.level>0?(r.strm.data_type===PD&&(r.strm.data_type=VD(r)),lw(r,r.l_desc),lw(r,r.d_desc),o=jD(r),i=r.opt_len+3+7>>>3,s=r.static_len+3+7>>>3,s<=i&&(i=s)):i=s=t+5,t+4<=i&&e!==-1?mS(r,e,t,n):r.strategy===$D||s===i?(Yr(r,(tS<<1)+(n?1:0),3),XE(r,bs,tu)):(Yr(r,(OD<<1)+(n?1:0),3),zD(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),XE(r,r.dyn_ltree,r.dyn_dtree)),hS(r),n&&pS(r)}function KD(r,e,t){return r.pending_buf[r.d_buf+r.last_lit*2]=e>>>8&255,r.pending_buf[r.d_buf+r.last_lit*2+1]=e&255,r.pending_buf[r.l_buf+r.last_lit]=t&255,r.last_lit++,e===0?r.dyn_ltree[t*2]++:(r.matches++,e--,r.dyn_ltree[(iu[t]+ou+1)*2]++,r.dyn_dtree[uS(e)*2]++),r.last_lit===r.lit_bufsize-1}gl._tr_init=WD;gl._tr_stored_block=mS;gl._tr_flush_block=YD;gl._tr_tally=KD;gl._tr_align=qD});var hw=G((d7,wS)=>{"use strict";g();function ZD(r,e,t,n){for(var i=r&65535|0,s=r>>>16&65535|0,o=0;t!==0;){o=t>2e3?2e3:t,t-=o;do i=i+e[n++]|0,s=s+i|0;while(--o);i%=65521,s%=65521}return i|s<<16|0}wS.exports=ZD});var pw=G((p7,vS)=>{"use strict";g();function XD(){for(var r,e=[],t=0;t<256;t++){r=t;for(var n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r}return e}var QD=XD();function JD(r,e,t,n){var i=QD,s=n+t;r^=-1;for(var o=n;o<s;o++)r=r>>>8^i[(r^e[o])&255];return r^-1}vS.exports=JD});var Ud=G((g7,bS)=>{"use strict";g();bS.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 TS=G(Vi=>{"use strict";g();var Or=vs(),Wn=gS(),ES=hw(),eo=pw(),eL=Ud(),Xo=0,tL=1,rL=3,so=4,yS=5,zi=0,_S=1,qn=-2,nL=-3,mw=-5,iL=-1,sL=1,jd=2,oL=3,aL=4,lL=0,cL=2,qd=8,uL=9,fL=15,dL=8,hL=29,pL=256,ww=pL+1+hL,mL=30,gL=19,wL=2*ww+1,vL=15,je=3,no=258,hi=no+je+1,bL=32,Yd=42,vw=69,zd=73,Vd=91,Wd=103,Yo=113,lu=666,Kt=1,cu=2,Ko=3,bl=4,yL=3;function io(r,e){return r.msg=eL[e],e}function xS(r){return(r<<1)-(r>4?9:0)}function ro(r){for(var e=r.length;--e>=0;)r[e]=0}function to(r){var e=r.state,t=e.pending;t>r.avail_out&&(t=r.avail_out),t!==0&&(Or.arraySet(r.output,e.pending_buf,e.pending_out,t,r.next_out),r.next_out+=t,e.pending_out+=t,r.total_out+=t,r.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))}function pr(r,e){Wn._tr_flush_block(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,to(r.strm)}function Qe(r,e){r.pending_buf[r.pending++]=e}function au(r,e){r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255}function _L(r,e,t,n){var i=r.avail_in;return i>n&&(i=n),i===0?0:(r.avail_in-=i,Or.arraySet(e,r.input,r.next_in,i,t),r.state.wrap===1?r.adler=ES(r.adler,e,i,t):r.state.wrap===2&&(r.adler=eo(r.adler,e,i,t)),r.next_in+=i,r.total_in+=i,i)}function SS(r,e){var t=r.max_chain_length,n=r.strstart,i,s,o=r.prev_length,a=r.nice_match,l=r.strstart>r.w_size-hi?r.strstart-(r.w_size-hi):0,c=r.window,u=r.w_mask,f=r.prev,d=r.strstart+no,h=c[n+o-1],p=c[n+o];r.prev_length>=r.good_match&&(t>>=2),a>r.lookahead&&(a=r.lookahead);do if(i=e,!(c[i+o]!==p||c[i+o-1]!==h||c[i]!==c[n]||c[++i]!==c[n+1])){n+=2,i++;do;while(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]===c[++i]&&n<d);if(s=no-(d-n),n=d-no,s>o){if(r.match_start=e,o=s,s>=a)break;h=c[n+o-1],p=c[n+o]}}while((e=f[e&u])>l&&--t!==0);return o<=r.lookahead?o:r.lookahead}function Zo(r){var e=r.w_size,t,n,i,s,o;do{if(s=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-hi)){Or.arraySet(r.window,r.window,e,e,0),r.match_start-=e,r.strstart-=e,r.block_start-=e,n=r.hash_size,t=n;do i=r.head[--t],r.head[t]=i>=e?i-e:0;while(--n);n=e,t=n;do i=r.prev[--t],r.prev[t]=i>=e?i-e:0;while(--n);s+=e}if(r.strm.avail_in===0)break;if(n=_L(r.strm,r.window,r.strstart+r.lookahead,s),r.lookahead+=n,r.lookahead+r.insert>=je)for(o=r.strstart-r.insert,r.ins_h=r.window[o],r.ins_h=(r.ins_h<<r.hash_shift^r.window[o+1])&r.hash_mask;r.insert&&(r.ins_h=(r.ins_h<<r.hash_shift^r.window[o+je-1])&r.hash_mask,r.prev[o&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=o,o++,r.insert--,!(r.lookahead+r.insert<je)););}while(r.lookahead<hi&&r.strm.avail_in!==0)}function xL(r,e){var t=65535;for(t>r.pending_buf_size-5&&(t=r.pending_buf_size-5);;){if(r.lookahead<=1){if(Zo(r),r.lookahead===0&&e===Xo)return Kt;if(r.lookahead===0)break}r.strstart+=r.lookahead,r.lookahead=0;var n=r.block_start+t;if((r.strstart===0||r.strstart>=n)&&(r.lookahead=r.strstart-n,r.strstart=n,pr(r,!1),r.strm.avail_out===0)||r.strstart-r.block_start>=r.w_size-hi&&(pr(r,!1),r.strm.avail_out===0))return Kt}return r.insert=0,e===so?(pr(r,!0),r.strm.avail_out===0?Ko:bl):(r.strstart>r.block_start&&(pr(r,!1),r.strm.avail_out===0),Kt)}function gw(r,e){for(var t,n;;){if(r.lookahead<hi){if(Zo(r),r.lookahead<hi&&e===Xo)return Kt;if(r.lookahead===0)break}if(t=0,r.lookahead>=je&&(r.ins_h=(r.ins_h<<r.hash_shift^r.window[r.strstart+je-1])&r.hash_mask,t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),t!==0&&r.strstart-t<=r.w_size-hi&&(r.match_length=SS(r,t)),r.match_length>=je)if(n=Wn._tr_tally(r,r.strstart-r.match_start,r.match_length-je),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=je){r.match_length--;do r.strstart++,r.ins_h=(r.ins_h<<r.hash_shift^r.window[r.strstart+je-1])&r.hash_mask,t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=(r.ins_h<<r.hash_shift^r.window[r.strstart+1])&r.hash_mask;else n=Wn._tr_tally(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(n&&(pr(r,!1),r.strm.avail_out===0))return Kt}return r.insert=r.strstart<je-1?r.strstart:je-1,e===so?(pr(r,!0),r.strm.avail_out===0?Ko:bl):r.last_lit&&(pr(r,!1),r.strm.avail_out===0)?Kt:cu}function wl(r,e){for(var t,n,i;;){if(r.lookahead<hi){if(Zo(r),r.lookahead<hi&&e===Xo)return Kt;if(r.lookahead===0)break}if(t=0,r.lookahead>=je&&(r.ins_h=(r.ins_h<<r.hash_shift^r.window[r.strstart+je-1])&r.hash_mask,t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=je-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-hi&&(r.match_length=SS(r,t),r.match_length<=5&&(r.strategy===sL||r.match_length===je&&r.strstart-r.match_start>4096)&&(r.match_length=je-1)),r.prev_length>=je&&r.match_length<=r.prev_length){i=r.strstart+r.lookahead-je,n=Wn._tr_tally(r,r.strstart-1-r.prev_match,r.prev_length-je),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=i&&(r.ins_h=(r.ins_h<<r.hash_shift^r.window[r.strstart+je-1])&r.hash_mask,t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=je-1,r.strstart++,n&&(pr(r,!1),r.strm.avail_out===0))return Kt}else if(r.match_available){if(n=Wn._tr_tally(r,0,r.window[r.strstart-1]),n&&pr(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return Kt}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(n=Wn._tr_tally(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<je-1?r.strstart:je-1,e===so?(pr(r,!0),r.strm.avail_out===0?Ko:bl):r.last_lit&&(pr(r,!1),r.strm.avail_out===0)?Kt:cu}function EL(r,e){for(var t,n,i,s,o=r.window;;){if(r.lookahead<=no){if(Zo(r),r.lookahead<=no&&e===Xo)return Kt;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=je&&r.strstart>0&&(i=r.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){s=r.strstart+no;do;while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&i<s);r.match_length=no-(s-i),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=je?(t=Wn._tr_tally(r,1,r.match_length-je),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=Wn._tr_tally(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&(pr(r,!1),r.strm.avail_out===0))return Kt}return r.insert=0,e===so?(pr(r,!0),r.strm.avail_out===0?Ko:bl):r.last_lit&&(pr(r,!1),r.strm.avail_out===0)?Kt:cu}function SL(r,e){for(var t;;){if(r.lookahead===0&&(Zo(r),r.lookahead===0)){if(e===Xo)return Kt;break}if(r.match_length=0,t=Wn._tr_tally(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&(pr(r,!1),r.strm.avail_out===0))return Kt}return r.insert=0,e===so?(pr(r,!0),r.strm.avail_out===0?Ko:bl):r.last_lit&&(pr(r,!1),r.strm.avail_out===0)?Kt:cu}function ji(r,e,t,n,i){this.good_length=r,this.max_lazy=e,this.nice_length=t,this.max_chain=n,this.func=i}var vl;vl=[new ji(0,0,0,0,xL),new ji(4,4,8,4,gw),new ji(4,5,16,8,gw),new ji(4,6,32,32,gw),new ji(4,4,16,16,wl),new ji(8,16,32,32,wl),new ji(8,16,128,128,wl),new ji(8,32,128,256,wl),new ji(32,128,258,1024,wl),new ji(32,258,258,4096,wl)];function kL(r){r.window_size=2*r.w_size,ro(r.head),r.max_lazy_match=vl[r.level].max_lazy,r.good_match=vl[r.level].good_length,r.nice_match=vl[r.level].nice_length,r.max_chain_length=vl[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=je-1,r.match_available=0,r.ins_h=0}function AL(){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=qd,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 Or.Buf16(wL*2),this.dyn_dtree=new Or.Buf16((2*mL+1)*2),this.bl_tree=new Or.Buf16((2*gL+1)*2),ro(this.dyn_ltree),ro(this.dyn_dtree),ro(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Or.Buf16(vL+1),this.heap=new Or.Buf16(2*ww+1),ro(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Or.Buf16(2*ww+1),ro(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 kS(r){var e;return!r||!r.state?io(r,qn):(r.total_in=r.total_out=0,r.data_type=cL,e=r.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?Yd:Yo,r.adler=e.wrap===2?0:1,e.last_flush=Xo,Wn._tr_init(e),zi)}function AS(r){var e=kS(r);return e===zi&&kL(r.state),e}function CL(r,e){return!r||!r.state||r.state.wrap!==2?qn:(r.state.gzhead=e,zi)}function CS(r,e,t,n,i,s){if(!r)return qn;var o=1;if(e===iL&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>uL||t!==qd||n<8||n>15||e<0||e>9||s<0||s>aL)return io(r,qn);n===8&&(n=9);var a=new AL;return r.state=a,a.strm=r,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=i+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+je-1)/je),a.window=new Or.Buf8(a.w_size*2),a.head=new Or.Buf16(a.hash_size),a.prev=new Or.Buf16(a.w_size),a.lit_bufsize=1<<i+6,a.pending_buf_size=a.lit_bufsize*4,a.pending_buf=new Or.Buf8(a.pending_buf_size),a.d_buf=1*a.lit_bufsize,a.l_buf=3*a.lit_bufsize,a.level=e,a.strategy=s,a.method=t,AS(r)}function TL(r,e){return CS(r,e,qd,fL,dL,lL)}function RL(r,e){var t,n,i,s;if(!r||!r.state||e>yS||e<0)return r?io(r,qn):qn;if(n=r.state,!r.output||!r.input&&r.avail_in!==0||n.status===lu&&e!==so)return io(r,r.avail_out===0?mw:qn);if(n.strm=r,t=n.last_flush,n.last_flush=e,n.status===Yd)if(n.wrap===2)r.adler=0,Qe(n,31),Qe(n,139),Qe(n,8),n.gzhead?(Qe(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Qe(n,n.gzhead.time&255),Qe(n,n.gzhead.time>>8&255),Qe(n,n.gzhead.time>>16&255),Qe(n,n.gzhead.time>>24&255),Qe(n,n.level===9?2:n.strategy>=jd||n.level<2?4:0),Qe(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Qe(n,n.gzhead.extra.length&255),Qe(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(r.adler=eo(r.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=vw):(Qe(n,0),Qe(n,0),Qe(n,0),Qe(n,0),Qe(n,0),Qe(n,n.level===9?2:n.strategy>=jd||n.level<2?4:0),Qe(n,yL),n.status=Yo);else{var o=qd+(n.w_bits-8<<4)<<8,a=-1;n.strategy>=jd||n.level<2?a=0:n.level<6?a=1:n.level===6?a=2:a=3,o|=a<<6,n.strstart!==0&&(o|=bL),o+=31-o%31,n.status=Yo,au(n,o),n.strstart!==0&&(au(n,r.adler>>>16),au(n,r.adler&65535)),r.adler=1}if(n.status===vw)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(n.gzhead.extra.length&65535)&&!(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(r.adler=eo(r.adler,n.pending_buf,n.pending-i,i)),to(r),i=n.pending,n.pending===n.pending_buf_size));)Qe(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(r.adler=eo(r.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=zd)}else n.status=zd;if(n.status===zd)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(r.adler=eo(r.adler,n.pending_buf,n.pending-i,i)),to(r),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}n.gzindex<n.gzhead.name.length?s=n.gzhead.name.charCodeAt(n.gzindex++)&255:s=0,Qe(n,s)}while(s!==0);n.gzhead.hcrc&&n.pending>i&&(r.adler=eo(r.adler,n.pending_buf,n.pending-i,i)),s===0&&(n.gzindex=0,n.status=Vd)}else n.status=Vd;if(n.status===Vd)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(r.adler=eo(r.adler,n.pending_buf,n.pending-i,i)),to(r),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}n.gzindex<n.gzhead.comment.length?s=n.gzhead.comment.charCodeAt(n.gzindex++)&255:s=0,Qe(n,s)}while(s!==0);n.gzhead.hcrc&&n.pending>i&&(r.adler=eo(r.adler,n.pending_buf,n.pending-i,i)),s===0&&(n.status=Wd)}else n.status=Wd;if(n.status===Wd&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&to(r),n.pending+2<=n.pending_buf_size&&(Qe(n,r.adler&255),Qe(n,r.adler>>8&255),r.adler=0,n.status=Yo)):n.status=Yo),n.pending!==0){if(to(r),r.avail_out===0)return n.last_flush=-1,zi}else if(r.avail_in===0&&xS(e)<=xS(t)&&e!==so)return io(r,mw);if(n.status===lu&&r.avail_in!==0)return io(r,mw);if(r.avail_in!==0||n.lookahead!==0||e!==Xo&&n.status!==lu){var l=n.strategy===jd?SL(n,e):n.strategy===oL?EL(n,e):vl[n.level].func(n,e);if((l===Ko||l===bl)&&(n.status=lu),l===Kt||l===Ko)return r.avail_out===0&&(n.last_flush=-1),zi;if(l===cu&&(e===tL?Wn._tr_align(n):e!==yS&&(Wn._tr_stored_block(n,0,0,!1),e===rL&&(ro(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),to(r),r.avail_out===0))return n.last_flush=-1,zi}return e!==so?zi:n.wrap<=0?_S:(n.wrap===2?(Qe(n,r.adler&255),Qe(n,r.adler>>8&255),Qe(n,r.adler>>16&255),Qe(n,r.adler>>24&255),Qe(n,r.total_in&255),Qe(n,r.total_in>>8&255),Qe(n,r.total_in>>16&255),Qe(n,r.total_in>>24&255)):(au(n,r.adler>>>16),au(n,r.adler&65535)),to(r),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?zi:_S)}function $L(r){var e;return!r||!r.state?qn:(e=r.state.status,e!==Yd&&e!==vw&&e!==zd&&e!==Vd&&e!==Wd&&e!==Yo&&e!==lu?io(r,qn):(r.state=null,e===Yo?io(r,nL):zi))}function PL(r,e){var t=e.length,n,i,s,o,a,l,c,u;if(!r||!r.state||(n=r.state,o=n.wrap,o===2||o===1&&n.status!==Yd||n.lookahead))return qn;for(o===1&&(r.adler=ES(r.adler,e,t,0)),n.wrap=0,t>=n.w_size&&(o===0&&(ro(n.head),n.strstart=0,n.block_start=0,n.insert=0),u=new Or.Buf8(n.w_size),Or.arraySet(u,e,t-n.w_size,n.w_size,0),e=u,t=n.w_size),a=r.avail_in,l=r.next_in,c=r.input,r.avail_in=t,r.next_in=0,r.input=e,Zo(n);n.lookahead>=je;){i=n.strstart,s=n.lookahead-(je-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[i+je-1])&n.hash_mask,n.prev[i&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=i,i++;while(--s);n.strstart=i,n.lookahead=je-1,Zo(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=je-1,n.match_available=0,r.next_in=l,r.input=c,r.avail_in=a,n.wrap=o,zi}Vi.deflateInit=TL;Vi.deflateInit2=CS;Vi.deflateReset=AS;Vi.deflateResetKeep=kS;Vi.deflateSetHeader=CL;Vi.deflate=RL;Vi.deflateEnd=$L;Vi.deflateSetDictionary=PL;Vi.deflateInfo="pako deflate (from Nodeca project)"});var bw=G(yl=>{"use strict";g();var Kd=vs(),RS=!0,$S=!0;try{String.fromCharCode.apply(null,[0])}catch(r){RS=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){$S=!1}var uu=new Kd.Buf8(256);for(ys=0;ys<256;ys++)uu[ys]=ys>=252?6:ys>=248?5:ys>=240?4:ys>=224?3:ys>=192?2:1;var ys;uu[254]=uu[254]=1;yl.string2buf=function(r){var e,t,n,i,s,o=r.length,a=0;for(i=0;i<o;i++)t=r.charCodeAt(i),(t&64512)===55296&&i+1<o&&(n=r.charCodeAt(i+1),(n&64512)===56320&&(t=65536+(t-55296<<10)+(n-56320),i++)),a+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Kd.Buf8(a),s=0,i=0;s<a;i++)t=r.charCodeAt(i),(t&64512)===55296&&i+1<o&&(n=r.charCodeAt(i+1),(n&64512)===56320&&(t=65536+(t-55296<<10)+(n-56320),i++)),t<128?e[s++]=t:t<2048?(e[s++]=192|t>>>6,e[s++]=128|t&63):t<65536?(e[s++]=224|t>>>12,e[s++]=128|t>>>6&63,e[s++]=128|t&63):(e[s++]=240|t>>>18,e[s++]=128|t>>>12&63,e[s++]=128|t>>>6&63,e[s++]=128|t&63);return e};function PS(r,e){if(e<65534&&(r.subarray&&$S||!r.subarray&&RS))return String.fromCharCode.apply(null,Kd.shrinkBuf(r,e));for(var t="",n=0;n<e;n++)t+=String.fromCharCode(r[n]);return t}yl.buf2binstring=function(r){return PS(r,r.length)};yl.binstring2buf=function(r){for(var e=new Kd.Buf8(r.length),t=0,n=e.length;t<n;t++)e[t]=r.charCodeAt(t);return e};yl.buf2string=function(r,e){var t,n,i,s,o=e||r.length,a=new Array(o*2);for(n=0,t=0;t<o;){if(i=r[t++],i<128){a[n++]=i;continue}if(s=uu[i],s>4){a[n++]=65533,t+=s-1;continue}for(i&=s===2?31:s===3?15:7;s>1&&t<o;)i=i<<6|r[t++]&63,s--;if(s>1){a[n++]=65533;continue}i<65536?a[n++]=i:(i-=65536,a[n++]=55296|i>>10&1023,a[n++]=56320|i&1023)}return PS(a,n)};yl.utf8border=function(r,e){var t;for(e=e||r.length,e>r.length&&(e=r.length),t=e-1;t>=0&&(r[t]&192)===128;)t--;return t<0||t===0?e:t+uu[r[t]]>e?t:e}});var yw=G((x7,IS)=>{"use strict";g();function IL(){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}IS.exports=IL});var DS=G(hu=>{"use strict";g();var fu=TS(),du=vs(),xw=bw(),Ew=Ud(),OL=yw(),MS=Object.prototype.toString,FL=0,_w=4,_l=0,OS=1,FS=2,ML=-1,DL=0,LL=8;function Qo(r){if(!(this instanceof Qo))return new Qo(r);this.options=du.assign({level:ML,method:LL,chunkSize:16384,windowBits:15,memLevel:8,strategy:DL,to:""},r||{});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 OL,this.strm.avail_out=0;var t=fu.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==_l)throw new Error(Ew[t]);if(e.header&&fu.deflateSetHeader(this.strm,e.header),e.dictionary){var n;if(typeof e.dictionary=="string"?n=xw.string2buf(e.dictionary):MS.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,t=fu.deflateSetDictionary(this.strm,n),t!==_l)throw new Error(Ew[t]);this._dict_set=!0}}Qo.prototype.push=function(r,e){var t=this.strm,n=this.options.chunkSize,i,s;if(this.ended)return!1;s=e===~~e?e:e===!0?_w:FL,typeof r=="string"?t.input=xw.string2buf(r):MS.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;do{if(t.avail_out===0&&(t.output=new du.Buf8(n),t.next_out=0,t.avail_out=n),i=fu.deflate(t,s),i!==OS&&i!==_l)return this.onEnd(i),this.ended=!0,!1;(t.avail_out===0||t.avail_in===0&&(s===_w||s===FS))&&(this.options.to==="string"?this.onData(xw.buf2binstring(du.shrinkBuf(t.output,t.next_out))):this.onData(du.shrinkBuf(t.output,t.next_out)))}while((t.avail_in>0||t.avail_out===0)&&i!==OS);return s===_w?(i=fu.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===_l):(s===FS&&(this.onEnd(_l),t.avail_out=0),!0)};Qo.prototype.onData=function(r){this.chunks.push(r)};Qo.prototype.onEnd=function(r){r===_l&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=du.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Sw(r,e){var t=new Qo(e);if(t.push(r,!0),t.err)throw t.msg||Ew[t.err];return t.result}function NL(r,e){return e=e||{},e.raw=!0,Sw(r,e)}function BL(r,e){return e=e||{},e.gzip=!0,Sw(r,e)}hu.Deflate=Qo;hu.deflate=Sw;hu.deflateRaw=NL;hu.gzip=BL});var NS=G((A7,LS)=>{"use strict";g();var Zd=30,HL=12;LS.exports=function(e,t){var n,i,s,o,a,l,c,u,f,d,h,p,m,w,y,v,A,C,S,T,b,x,E,k,$;n=e.state,i=e.next_in,k=e.input,s=i+(e.avail_in-5),o=e.next_out,$=e.output,a=o-(t-e.avail_out),l=o+(e.avail_out-257),c=n.dmax,u=n.wsize,f=n.whave,d=n.wnext,h=n.window,p=n.hold,m=n.bits,w=n.lencode,y=n.distcode,v=(1<<n.lenbits)-1,A=(1<<n.distbits)-1;e:do{m<15&&(p+=k[i++]<<m,m+=8,p+=k[i++]<<m,m+=8),C=w[p&v];t:for(;;){if(S=C>>>24,p>>>=S,m-=S,S=C>>>16&255,S===0)$[o++]=C&65535;else if(S&16){T=C&65535,S&=15,S&&(m<S&&(p+=k[i++]<<m,m+=8),T+=p&(1<<S)-1,p>>>=S,m-=S),m<15&&(p+=k[i++]<<m,m+=8,p+=k[i++]<<m,m+=8),C=y[p&A];r:for(;;){if(S=C>>>24,p>>>=S,m-=S,S=C>>>16&255,S&16){if(b=C&65535,S&=15,m<S&&(p+=k[i++]<<m,m+=8,m<S&&(p+=k[i++]<<m,m+=8)),b+=p&(1<<S)-1,b>c){e.msg="invalid distance too far back",n.mode=Zd;break e}if(p>>>=S,m-=S,S=o-a,b>S){if(S=b-S,S>f&&n.sane){e.msg="invalid distance too far back",n.mode=Zd;break e}if(x=0,E=h,d===0){if(x+=u-S,S<T){T-=S;do $[o++]=h[x++];while(--S);x=o-b,E=$}}else if(d<S){if(x+=u+d-S,S-=d,S<T){T-=S;do $[o++]=h[x++];while(--S);if(x=0,d<T){S=d,T-=S;do $[o++]=h[x++];while(--S);x=o-b,E=$}}}else if(x+=d-S,S<T){T-=S;do $[o++]=h[x++];while(--S);x=o-b,E=$}for(;T>2;)$[o++]=E[x++],$[o++]=E[x++],$[o++]=E[x++],T-=3;T&&($[o++]=E[x++],T>1&&($[o++]=E[x++]))}else{x=o-b;do $[o++]=$[x++],$[o++]=$[x++],$[o++]=$[x++],T-=3;while(T>2);T&&($[o++]=$[x++],T>1&&($[o++]=$[x++]))}}else if((S&64)===0){C=y[(C&65535)+(p&(1<<S)-1)];continue r}else{e.msg="invalid distance code",n.mode=Zd;break e}break}}else if((S&64)===0){C=w[(C&65535)+(p&(1<<S)-1)];continue t}else if(S&32){n.mode=HL;break e}else{e.msg="invalid literal/length code",n.mode=Zd;break e}break}}while(i<s&&o<l);T=m>>3,i-=T,m-=T<<3,p&=(1<<m)-1,e.next_in=i,e.next_out=o,e.avail_in=i<s?5+(s-i):5-(i-s),e.avail_out=o<l?257+(l-o):257-(o-l),n.hold=p,n.bits=m}});var VS=G((T7,zS)=>{"use strict";g();var BS=vs(),xl=15,HS=852,GS=592,US=0,kw=1,jS=2,GL=[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],UL=[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],jL=[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],zL=[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];zS.exports=function(e,t,n,i,s,o,a,l){var c=l.bits,u=0,f=0,d=0,h=0,p=0,m=0,w=0,y=0,v=0,A=0,C,S,T,b,x,E=null,k=0,$,M=new BS.Buf16(xl+1),D=new BS.Buf16(xl+1),P=null,F=0,_e,Q,oe;for(u=0;u<=xl;u++)M[u]=0;for(f=0;f<i;f++)M[t[n+f]]++;for(p=c,h=xl;h>=1&&M[h]===0;h--);if(p>h&&(p=h),h===0)return s[o++]=1<<24|64<<16|0,s[o++]=1<<24|64<<16|0,l.bits=1,0;for(d=1;d<h&&M[d]===0;d++);for(p<d&&(p=d),y=1,u=1;u<=xl;u++)if(y<<=1,y-=M[u],y<0)return-1;if(y>0&&(e===US||h!==1))return-1;for(D[1]=0,u=1;u<xl;u++)D[u+1]=D[u]+M[u];for(f=0;f<i;f++)t[n+f]!==0&&(a[D[t[n+f]]++]=f);if(e===US?(E=P=a,$=19):e===kw?(E=GL,k-=257,P=UL,F-=257,$=256):(E=jL,P=zL,$=-1),A=0,f=0,u=d,x=o,m=p,w=0,T=-1,v=1<<p,b=v-1,e===kw&&v>HS||e===jS&&v>GS)return 1;for(;;){_e=u-w,a[f]<$?(Q=0,oe=a[f]):a[f]>$?(Q=P[F+a[f]],oe=E[k+a[f]]):(Q=96,oe=0),C=1<<u-w,S=1<<m,d=S;do S-=C,s[x+(A>>w)+S]=_e<<24|Q<<16|oe|0;while(S!==0);for(C=1<<u-1;A&C;)C>>=1;if(C!==0?(A&=C-1,A+=C):A=0,f++,--M[u]===0){if(u===h)break;u=t[n+a[f]]}if(u>p&&(A&b)!==T){for(w===0&&(w=p),x+=d,m=u-w,y=1<<m;m+w<h&&(y-=M[m+w],!(y<=0));)m++,y<<=1;if(v+=1<<m,e===kw&&v>HS||e===jS&&v>GS)return 1;T=A&b,s[T]=p<<24|m<<16|x-o|0}}return A!==0&&(s[x+A]=u-w<<24|64<<16|0),l.bits=p,0}});var Ak=G(pi=>{"use strict";g();var yn=vs(),Pw=hw(),Wi=pw(),VL=NS(),pu=VS(),WL=0,wk=1,vk=2,WS=4,qL=5,Xd=6,Jo=0,YL=1,KL=2,Yn=-2,bk=-3,Iw=-4,ZL=-5,qS=8,yk=1,YS=2,KS=3,ZS=4,XS=5,QS=6,JS=7,ek=8,tk=9,rk=10,eh=11,_s=12,Aw=13,nk=14,Cw=15,ik=16,sk=17,ok=18,ak=19,Qd=20,Jd=21,lk=22,ck=23,uk=24,fk=25,dk=26,Tw=27,hk=28,pk=29,yt=30,Ow=31,XL=32,QL=852,JL=592,eN=15,tN=eN;function mk(r){return(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24)}function rN(){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 yn.Buf16(320),this.work=new yn.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _k(r){var e;return!r||!r.state?Yn:(e=r.state,r.total_in=r.total_out=e.total=0,r.msg="",e.wrap&&(r.adler=e.wrap&1),e.mode=yk,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new yn.Buf32(QL),e.distcode=e.distdyn=new yn.Buf32(JL),e.sane=1,e.back=-1,Jo)}function xk(r){var e;return!r||!r.state?Yn:(e=r.state,e.wsize=0,e.whave=0,e.wnext=0,_k(r))}function Ek(r,e){var t,n;return!r||!r.state||(n=r.state,e<0?(t=0,e=-e):(t=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?Yn:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=t,n.wbits=e,xk(r))}function Sk(r,e){var t,n;return r?(n=new rN,r.state=n,n.window=null,t=Ek(r,e),t!==Jo&&(r.state=null),t):Yn}function nN(r){return Sk(r,tN)}var gk=!0,Rw,$w;function iN(r){if(gk){var e;for(Rw=new yn.Buf32(512),$w=new yn.Buf32(32),e=0;e<144;)r.lens[e++]=8;for(;e<256;)r.lens[e++]=9;for(;e<280;)r.lens[e++]=7;for(;e<288;)r.lens[e++]=8;for(pu(wk,r.lens,0,288,Rw,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;pu(vk,r.lens,0,32,$w,0,r.work,{bits:5}),gk=!1}r.lencode=Rw,r.lenbits=9,r.distcode=$w,r.distbits=5}function kk(r,e,t,n){var i,s=r.state;return s.window===null&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new yn.Buf8(s.wsize)),n>=s.wsize?(yn.arraySet(s.window,e,t-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>n&&(i=n),yn.arraySet(s.window,e,t-n,i,s.wnext),n-=i,n?(yn.arraySet(s.window,e,t-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=i))),0}function sN(r,e){var t,n,i,s,o,a,l,c,u,f,d,h,p,m,w=0,y,v,A,C,S,T,b,x,E=new yn.Buf8(4),k,$,M=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!r||!r.state||!r.output||!r.input&&r.avail_in!==0)return Yn;t=r.state,t.mode===_s&&(t.mode=Aw),o=r.next_out,i=r.output,l=r.avail_out,s=r.next_in,n=r.input,a=r.avail_in,c=t.hold,u=t.bits,f=a,d=l,x=Jo;e:for(;;)switch(t.mode){case yk:if(t.wrap===0){t.mode=Aw;break}for(;u<16;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}if(t.wrap&2&&c===35615){t.check=0,E[0]=c&255,E[1]=c>>>8&255,t.check=Wi(t.check,E,2,0),c=0,u=0,t.mode=YS;break}if(t.flags=0,t.head&&(t.head.done=!1),!(t.wrap&1)||(((c&255)<<8)+(c>>8))%31){r.msg="incorrect header check",t.mode=yt;break}if((c&15)!==qS){r.msg="unknown compression method",t.mode=yt;break}if(c>>>=4,u-=4,b=(c&15)+8,t.wbits===0)t.wbits=b;else if(b>t.wbits){r.msg="invalid window size",t.mode=yt;break}t.dmax=1<<b,r.adler=t.check=1,t.mode=c&512?rk:_s,c=0,u=0;break;case YS:for(;u<16;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}if(t.flags=c,(t.flags&255)!==qS){r.msg="unknown compression method",t.mode=yt;break}if(t.flags&57344){r.msg="unknown header flags set",t.mode=yt;break}t.head&&(t.head.text=c>>8&1),t.flags&512&&(E[0]=c&255,E[1]=c>>>8&255,t.check=Wi(t.check,E,2,0)),c=0,u=0,t.mode=KS;case KS:for(;u<32;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}t.head&&(t.head.time=c),t.flags&512&&(E[0]=c&255,E[1]=c>>>8&255,E[2]=c>>>16&255,E[3]=c>>>24&255,t.check=Wi(t.check,E,4,0)),c=0,u=0,t.mode=ZS;case ZS:for(;u<16;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}t.head&&(t.head.xflags=c&255,t.head.os=c>>8),t.flags&512&&(E[0]=c&255,E[1]=c>>>8&255,t.check=Wi(t.check,E,2,0)),c=0,u=0,t.mode=XS;case XS:if(t.flags&1024){for(;u<16;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}t.length=c,t.head&&(t.head.extra_len=c),t.flags&512&&(E[0]=c&255,E[1]=c>>>8&255,t.check=Wi(t.check,E,2,0)),c=0,u=0}else t.head&&(t.head.extra=null);t.mode=QS;case QS:if(t.flags&1024&&(h=t.length,h>a&&(h=a),h&&(t.head&&(b=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Array(t.head.extra_len)),yn.arraySet(t.head.extra,n,s,h,b)),t.flags&512&&(t.check=Wi(t.check,n,h,s)),a-=h,s+=h,t.length-=h),t.length))break e;t.length=0,t.mode=JS;case JS:if(t.flags&2048){if(a===0)break e;h=0;do b=n[s+h++],t.head&&b&&t.length<65536&&(t.head.name+=String.fromCharCode(b));while(b&&h<a);if(t.flags&512&&(t.check=Wi(t.check,n,h,s)),a-=h,s+=h,b)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=ek;case ek:if(t.flags&4096){if(a===0)break e;h=0;do b=n[s+h++],t.head&&b&&t.length<65536&&(t.head.comment+=String.fromCharCode(b));while(b&&h<a);if(t.flags&512&&(t.check=Wi(t.check,n,h,s)),a-=h,s+=h,b)break e}else t.head&&(t.head.comment=null);t.mode=tk;case tk:if(t.flags&512){for(;u<16;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}if(c!==(t.check&65535)){r.msg="header crc mismatch",t.mode=yt;break}c=0,u=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),r.adler=t.check=0,t.mode=_s;break;case rk:for(;u<32;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}r.adler=t.check=mk(c),c=0,u=0,t.mode=eh;case eh:if(t.havedict===0)return r.next_out=o,r.avail_out=l,r.next_in=s,r.avail_in=a,t.hold=c,t.bits=u,KL;r.adler=t.check=1,t.mode=_s;case _s:if(e===qL||e===Xd)break e;case Aw:if(t.last){c>>>=u&7,u-=u&7,t.mode=Tw;break}for(;u<3;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}switch(t.last=c&1,c>>>=1,u-=1,c&3){case 0:t.mode=nk;break;case 1:if(iN(t),t.mode=Qd,e===Xd){c>>>=2,u-=2;break e}break;case 2:t.mode=sk;break;case 3:r.msg="invalid block type",t.mode=yt}c>>>=2,u-=2;break;case nk:for(c>>>=u&7,u-=u&7;u<32;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){r.msg="invalid stored block lengths",t.mode=yt;break}if(t.length=c&65535,c=0,u=0,t.mode=Cw,e===Xd)break e;case Cw:t.mode=ik;case ik:if(h=t.length,h){if(h>a&&(h=a),h>l&&(h=l),h===0)break e;yn.arraySet(i,n,s,h,o),a-=h,s+=h,l-=h,o+=h,t.length-=h;break}t.mode=_s;break;case sk:for(;u<14;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}if(t.nlen=(c&31)+257,c>>>=5,u-=5,t.ndist=(c&31)+1,c>>>=5,u-=5,t.ncode=(c&15)+4,c>>>=4,u-=4,t.nlen>286||t.ndist>30){r.msg="too many length or distance symbols",t.mode=yt;break}t.have=0,t.mode=ok;case ok:for(;t.have<t.ncode;){for(;u<3;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}t.lens[M[t.have++]]=c&7,c>>>=3,u-=3}for(;t.have<19;)t.lens[M[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,k={bits:t.lenbits},x=pu(WL,t.lens,0,19,t.lencode,0,t.work,k),t.lenbits=k.bits,x){r.msg="invalid code lengths set",t.mode=yt;break}t.have=0,t.mode=ak;case ak:for(;t.have<t.nlen+t.ndist;){for(;w=t.lencode[c&(1<<t.lenbits)-1],y=w>>>24,v=w>>>16&255,A=w&65535,!(y<=u);){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}if(A<16)c>>>=y,u-=y,t.lens[t.have++]=A;else{if(A===16){for($=y+2;u<$;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}if(c>>>=y,u-=y,t.have===0){r.msg="invalid bit length repeat",t.mode=yt;break}b=t.lens[t.have-1],h=3+(c&3),c>>>=2,u-=2}else if(A===17){for($=y+3;u<$;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}c>>>=y,u-=y,b=0,h=3+(c&7),c>>>=3,u-=3}else{for($=y+7;u<$;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}c>>>=y,u-=y,b=0,h=11+(c&127),c>>>=7,u-=7}if(t.have+h>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=yt;break}for(;h--;)t.lens[t.have++]=b}}if(t.mode===yt)break;if(t.lens[256]===0){r.msg="invalid code -- missing end-of-block",t.mode=yt;break}if(t.lenbits=9,k={bits:t.lenbits},x=pu(wk,t.lens,0,t.nlen,t.lencode,0,t.work,k),t.lenbits=k.bits,x){r.msg="invalid literal/lengths set",t.mode=yt;break}if(t.distbits=6,t.distcode=t.distdyn,k={bits:t.distbits},x=pu(vk,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,k),t.distbits=k.bits,x){r.msg="invalid distances set",t.mode=yt;break}if(t.mode=Qd,e===Xd)break e;case Qd:t.mode=Jd;case Jd:if(a>=6&&l>=258){r.next_out=o,r.avail_out=l,r.next_in=s,r.avail_in=a,t.hold=c,t.bits=u,VL(r,d),o=r.next_out,i=r.output,l=r.avail_out,s=r.next_in,n=r.input,a=r.avail_in,c=t.hold,u=t.bits,t.mode===_s&&(t.back=-1);break}for(t.back=0;w=t.lencode[c&(1<<t.lenbits)-1],y=w>>>24,v=w>>>16&255,A=w&65535,!(y<=u);){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}if(v&&(v&240)===0){for(C=y,S=v,T=A;w=t.lencode[T+((c&(1<<C+S)-1)>>C)],y=w>>>24,v=w>>>16&255,A=w&65535,!(C+y<=u);){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}c>>>=C,u-=C,t.back+=C}if(c>>>=y,u-=y,t.back+=y,t.length=A,v===0){t.mode=dk;break}if(v&32){t.back=-1,t.mode=_s;break}if(v&64){r.msg="invalid literal/length code",t.mode=yt;break}t.extra=v&15,t.mode=lk;case lk:if(t.extra){for($=t.extra;u<$;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}t.length+=c&(1<<t.extra)-1,c>>>=t.extra,u-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=ck;case ck:for(;w=t.distcode[c&(1<<t.distbits)-1],y=w>>>24,v=w>>>16&255,A=w&65535,!(y<=u);){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}if((v&240)===0){for(C=y,S=v,T=A;w=t.distcode[T+((c&(1<<C+S)-1)>>C)],y=w>>>24,v=w>>>16&255,A=w&65535,!(C+y<=u);){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}c>>>=C,u-=C,t.back+=C}if(c>>>=y,u-=y,t.back+=y,v&64){r.msg="invalid distance code",t.mode=yt;break}t.offset=A,t.extra=v&15,t.mode=uk;case uk:if(t.extra){for($=t.extra;u<$;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}t.offset+=c&(1<<t.extra)-1,c>>>=t.extra,u-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){r.msg="invalid distance too far back",t.mode=yt;break}t.mode=fk;case fk:if(l===0)break e;if(h=d-l,t.offset>h){if(h=t.offset-h,h>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=yt;break}h>t.wnext?(h-=t.wnext,p=t.wsize-h):p=t.wnext-h,h>t.length&&(h=t.length),m=t.window}else m=i,p=o-t.offset,h=t.length;h>l&&(h=l),l-=h,t.length-=h;do i[o++]=m[p++];while(--h);t.length===0&&(t.mode=Jd);break;case dk:if(l===0)break e;i[o++]=t.length,l--,t.mode=Jd;break;case Tw:if(t.wrap){for(;u<32;){if(a===0)break e;a--,c|=n[s++]<<u,u+=8}if(d-=l,r.total_out+=d,t.total+=d,d&&(r.adler=t.check=t.flags?Wi(t.check,i,d,o-d):Pw(t.check,i,d,o-d)),d=l,(t.flags?c:mk(c))!==t.check){r.msg="incorrect data check",t.mode=yt;break}c=0,u=0}t.mode=hk;case hk:if(t.wrap&&t.flags){for(;u<32;){if(a===0)break e;a--,c+=n[s++]<<u,u+=8}if(c!==(t.total&4294967295)){r.msg="incorrect length check",t.mode=yt;break}c=0,u=0}t.mode=pk;case pk:x=YL;break e;case yt:x=bk;break e;case Ow:return Iw;case XL:default:return Yn}return r.next_out=o,r.avail_out=l,r.next_in=s,r.avail_in=a,t.hold=c,t.bits=u,(t.wsize||d!==r.avail_out&&t.mode<yt&&(t.mode<Tw||e!==WS))&&kk(r,r.output,r.next_out,d-r.avail_out)?(t.mode=Ow,Iw):(f-=r.avail_in,d-=r.avail_out,r.total_in+=f,r.total_out+=d,t.total+=d,t.wrap&&d&&(r.adler=t.check=t.flags?Wi(t.check,i,d,r.next_out-d):Pw(t.check,i,d,r.next_out-d)),r.data_type=t.bits+(t.last?64:0)+(t.mode===_s?128:0)+(t.mode===Qd||t.mode===Cw?256:0),(f===0&&d===0||e===WS)&&x===Jo&&(x=ZL),x)}function oN(r){if(!r||!r.state)return Yn;var e=r.state;return e.window&&(e.window=null),r.state=null,Jo}function aN(r,e){var t;return!r||!r.state||(t=r.state,(t.wrap&2)===0)?Yn:(t.head=e,e.done=!1,Jo)}function lN(r,e){var t=e.length,n,i,s;return!r||!r.state||(n=r.state,n.wrap!==0&&n.mode!==eh)?Yn:n.mode===eh&&(i=1,i=Pw(i,e,t,0),i!==n.check)?bk:(s=kk(r,e,t,t),s?(n.mode=Ow,Iw):(n.havedict=1,Jo))}pi.inflateReset=xk;pi.inflateReset2=Ek;pi.inflateResetKeep=_k;pi.inflateInit=nN;pi.inflateInit2=Sk;pi.inflate=sN;pi.inflateEnd=oN;pi.inflateGetHeader=aN;pi.inflateSetDictionary=lN;pi.inflateInfo="pako inflate (from Nodeca project)"});var Fw=G((I7,Ck)=>{"use strict";g();Ck.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 Rk=G((F7,Tk)=>{"use strict";g();function cN(){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}Tk.exports=cN});var Pk=G(gu=>{"use strict";g();var El=Ak(),mu=vs(),th=bw(),Ft=Fw(),Mw=Ud(),uN=yw(),fN=Rk(),$k=Object.prototype.toString;function ea(r){if(!(this instanceof ea))return new ea(r);this.options=mu.assign({chunkSize:16384,windowBits:0,to:""},r||{});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&&!(r&&r.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 uN,this.strm.avail_out=0;var t=El.inflateInit2(this.strm,e.windowBits);if(t!==Ft.Z_OK)throw new Error(Mw[t]);if(this.header=new fN,El.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=th.string2buf(e.dictionary):$k.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=El.inflateSetDictionary(this.strm,e.dictionary),t!==Ft.Z_OK)))throw new Error(Mw[t])}ea.prototype.push=function(r,e){var t=this.strm,n=this.options.chunkSize,i=this.options.dictionary,s,o,a,l,c,u=!1;if(this.ended)return!1;o=e===~~e?e:e===!0?Ft.Z_FINISH:Ft.Z_NO_FLUSH,typeof r=="string"?t.input=th.binstring2buf(r):$k.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;do{if(t.avail_out===0&&(t.output=new mu.Buf8(n),t.next_out=0,t.avail_out=n),s=El.inflate(t,Ft.Z_NO_FLUSH),s===Ft.Z_NEED_DICT&&i&&(s=El.inflateSetDictionary(this.strm,i)),s===Ft.Z_BUF_ERROR&&u===!0&&(s=Ft.Z_OK,u=!1),s!==Ft.Z_STREAM_END&&s!==Ft.Z_OK)return this.onEnd(s),this.ended=!0,!1;t.next_out&&(t.avail_out===0||s===Ft.Z_STREAM_END||t.avail_in===0&&(o===Ft.Z_FINISH||o===Ft.Z_SYNC_FLUSH))&&(this.options.to==="string"?(a=th.utf8border(t.output,t.next_out),l=t.next_out-a,c=th.buf2string(t.output,a),t.next_out=l,t.avail_out=n-l,l&&mu.arraySet(t.output,t.output,a,l,0),this.onData(c)):this.onData(mu.shrinkBuf(t.output,t.next_out))),t.avail_in===0&&t.avail_out===0&&(u=!0)}while((t.avail_in>0||t.avail_out===0)&&s!==Ft.Z_STREAM_END);return s===Ft.Z_STREAM_END&&(o=Ft.Z_FINISH),o===Ft.Z_FINISH?(s=El.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===Ft.Z_OK):(o===Ft.Z_SYNC_FLUSH&&(this.onEnd(Ft.Z_OK),t.avail_out=0),!0)};ea.prototype.onData=function(r){this.chunks.push(r)};ea.prototype.onEnd=function(r){r===Ft.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=mu.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Dw(r,e){var t=new ea(e);if(t.push(r,!0),t.err)throw t.msg||Mw[t.err];return t.result}function dN(r,e){return e=e||{},e.raw=!0,Dw(r,e)}gu.Inflate=ea;gu.inflate=Dw;gu.inflateRaw=dN;gu.ungzip=Dw});var Lw=G((N7,Ok)=>{"use strict";g();var hN=vs().assign,pN=DS(),mN=Pk(),gN=Fw(),Ik={};hN(Ik,pN,mN,gN);Ok.exports=Ik});var Nw=G((H7,Mk)=>{"use strict";g();var Fk=(r,e)=>function(...t){let n=e.promiseModule;return new n((i,s)=>{e.multiArgs?t.push((...o)=>{e.errorFirst?o[0]?s(o):(o.shift(),i(o)):i(o)}):e.errorFirst?t.push((o,a)=>{o?s(o):i(a)}):t.push(i),r.apply(this,t)})};Mk.exports=(r,e)=>{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);let t=typeof r;if(!(r!==null&&(t==="object"||t==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${r===null?"null":t}\``);let n=s=>{let o=a=>typeof a=="string"?s===a:a.test(s);return e.include?e.include.some(o):!e.exclude.some(o)},i;t==="function"?i=function(...s){return e.excludeMain?r(...s):Fk(r,e).apply(this,s)}:i=Object.create(Object.getPrototypeOf(r));for(let s in r){let o=r[s];i[s]=typeof o=="function"&&n(s)?Fk(o,e):o}return i}});var Vw=G((U7,jk)=>{g();function Dk(r){return Array.isArray(r)?r:[r]}var Gw="",Lk=" ",Bw="\\",wN=/^\s+$/,vN=/(?:[^\\]|^)\\$/,bN=/^\\!/,yN=/^\\#/,_N=/\r?\n/g,xN=/^\.*\/|^\.+$/,Hw="/",Hk="node-ignore";typeof Symbol!="undefined"&&(Hk=Symbol.for("node-ignore"));var Nk=Hk,EN=(r,e,t)=>Object.defineProperty(r,e,{value:t}),SN=/([0-z])-([0-z])/g,Gk=()=>!1,kN=r=>r.replace(SN,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:Gw),AN=r=>{let{length:e}=r;return r.slice(0,e-e%2)},CN=[[/^\uFEFF/,()=>Gw],[/((?:\\\\)*?)(\\?\s+)$/,(r,e,t)=>e+(t.indexOf("\\")===0?Lk:Gw)],[/(\\+?)\s/g,(r,e)=>{let{length:t}=e;return e.slice(0,t-t%2)+Lk}],[/[\\$.|*+(){^]/g,r=>`\\${r}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(r,e,t)=>e+6<t.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(r,e,t)=>{let n=t.replace(/\\\*/g,"[^\\/]*");return e+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>Bw],[/\\\\/g,()=>Bw],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(r,e,t,n,i)=>e===Bw?`\\[${t}${AN(n)}${i}`:i==="]"&&n.length%2===0?`[${kN(t)}${n}]`:"[]"],[/(?:[^*])$/,r=>/\/$/.test(r)?`${r}$`:`${r}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(r,e)=>`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`]],Bk=Object.create(null),TN=(r,e)=>{let t=Bk[r];return t||(t=CN.reduce((n,[i,s])=>n.replace(i,s.bind(r)),r),Bk[r]=t),e?new RegExp(t,"i"):new RegExp(t)},zw=r=>typeof r=="string",RN=r=>r&&zw(r)&&!wN.test(r)&&!vN.test(r)&&r.indexOf("#")!==0,$N=r=>r.split(_N),Uw=class{constructor(e,t,n,i){this.origin=e,this.pattern=t,this.negative=n,this.regex=i}},PN=(r,e)=>{let t=r,n=!1;r.indexOf("!")===0&&(n=!0,r=r.substr(1)),r=r.replace(bN,"!").replace(yN,"#");let i=TN(r,e);return new Uw(t,r,n,i)},IN=(r,e)=>{throw new e(r)},xs=(r,e,t)=>zw(r)?r?xs.isNotRelative(r)?t(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:t("path must not be empty",TypeError):t(`path must be a string, but got \`${e}\``,TypeError),Uk=r=>xN.test(r);xs.isNotRelative=Uk;xs.convert=r=>r;var jw=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){EN(this,Nk,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[Nk]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(RN(e)){let t=PN(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,Dk(zw(e)?$N(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,i=!1;return this._rules.forEach(s=>{let{negative:o}=s;if(i===o&&n!==i||o&&!n&&!i&&!t)return;s.regex.test(e)&&(n=!o,i=o)}),{ignored:n,unignored:i}}_test(e,t,n,i){let s=e&&xs.convert(e);return xs(s,e,this._allowRelativePaths?Gk:IN),this._t(s,t,n,i)}_t(e,t,n,i){if(e in t)return t[e];if(i||(i=e.split(Hw)),i.pop(),!i.length)return t[e]=this._testOne(e,n);let s=this._t(i.join(Hw)+Hw,t,n,i);return t[e]=s.ignored?s:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return Dk(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},rh=r=>new jw(r),ON=r=>xs(r&&xs.convert(r),r,Gk);rh.isPathValid=ON;rh.default=rh;jk.exports=rh;if(typeof process!="undefined"&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform==="win32")){let r=t=>/^\\\\\?\\/.test(t)||/["<>|\u0000-\u001F]+/u.test(t)?t:t.replace(/\\/g,"/");xs.convert=r;let e=/^[a-z]:\//i;xs.isNotRelative=t=>e.test(t)||Uk(t)}});var Vk=G((z7,zk)=>{g();zk.exports=function(r,e){var t=r,n=e,i=t.length,s=n.length,o=!1,a=null,l=i+1,c=[],u=[],f=[],d="",h=-1,p=0,m=1,w,y,v=function(){i>=s&&(w=t,y=i,t=n,n=w,i=s,s=y,o=!0,l=i+1)},A=function(b,x,E){return{x:b,y:x,k:E}},C=function(b,x){return{elem:b,t:x}},S=function(b,x,E){var k,$,M;for(x>E?k=c[b-1+l]:k=c[b+1+l],M=Math.max(x,E),$=M-b;$<i&&M<s&&t[$]===n[M];)++$,++M;return c[b+l]=u.length,u[u.length]=new A($,M,k),M},T=function(b){var x,E,k,$,M;for(x=E=1,k=$=0,M=b.length-1;M>=0;--M)for(;k<b[M].x||$<b[M].y;)b[M].y-b[M].x>$-k?(o?f[f.length]=new C(n[$],h):f[f.length]=new C(n[$],m),++E,++$):b[M].y-b[M].x<$-k?(o?f[f.length]=new C(t[k],m):f[f.length]=new C(t[k],h),++x,++k):(f[f.length]=new C(t[k],p),d+=t[k],++x,++E,++k,++$)};return v(),{SES_DELETE:-1,SES_COMMON:0,SES_ADD:1,editdistance:function(){return a},getlcs:function(){return d},getses:function(){return f},compose:function(){var b,x,E,k,$,M,D,P;for(b=s-i,x=i+s+3,E={},D=0;D<x;++D)E[D]=-1,c[D]=-1;k=-1;do{for(++k,P=-k;P<=b-1;++P)E[P+l]=S(P,E[P-1+l]+1,E[P+1+l]);for(P=b+k;P>=b+1;--P)E[P+l]=S(P,E[P-1+l]+1,E[P+1+l]);E[b+l]=S(b,E[b-1+l]+1,E[b+1+l])}while(E[b+l]!==s);for(a=b+2*k,$=c[b+l],M=[];$!==-1;)M[M.length]=new A(u[$].x,u[$].y,null),$=u[$].k;T(M)}}}});var Yk=G((W7,qk)=>{g();var FN=Vk();function MN(r,e){var t=new FN(r,e);t.compose();for(var n=t.getses(),i,s,o=r.length-1,a=e.length-1,l=n.length-1;l>=0;--l)n[l].t===t.SES_COMMON?(s?(s.chain={file1index:o,file2index:a,chain:null},s=s.chain):(i={file1index:o,file2index:a,chain:null},s=i),o--,a--):n[l].t===t.SES_DELETE?o--:n[l].t===t.SES_ADD&&a--;var c={file1index:-1,file2index:-1,chain:null};return s?(s.chain=c,i):c}function Wk(r,e){for(var t=[],n=r.length,i=e.length,s=MN(r,e);s!==null;s=s.chain){var o=n-s.file1index-1,a=i-s.file2index-1;n=s.file1index,i=s.file2index,(o||a)&&t.push({file1:[n+1,o],file2:[i+1,a]})}return t.reverse(),t}function DN(r,e,t){var n,i=Wk(e,r),s=Wk(e,t),o=[];function a(D,P){o.push([D.file1[0],P,D.file1[1],D.file2[0],D.file2[1]])}for(n=0;n<i.length;n++)a(i[n],0);for(n=0;n<s.length;n++)a(s[n],2);o.sort(function(D,P){return D[0]-P[0]});var l=[],c=0;function u(D){D>c&&(l.push([1,c,D-c]),c=D)}for(var f=0;f<o.length;f++){for(var d=f,h=o[f],p=h[0],m=p+h[2];f<o.length-1;){var w=o[f+1],y=w[0];if(y>m)break;m=Math.max(m,y+w[2]),f++}if(u(p),d==f)h[4]>0&&l.push([h[1],h[3],h[4]]);else{var v={0:[r.length,-1,e.length,-1],2:[t.length,-1,e.length,-1]};for(n=d;n<=f;n++){h=o[n];var A=h[1],C=v[A],S=h[0],T=S+h[2],b=h[3],x=b+h[4];C[0]=Math.min(b,C[0]),C[1]=Math.max(x,C[1]),C[2]=Math.min(S,C[2]),C[3]=Math.max(T,C[3])}var E=v[0][0]+(p-v[0][2]),k=v[0][1]+(m-v[0][3]),$=v[2][0]+(p-v[2][2]),M=v[2][1]+(m-v[2][3]);l.push([-1,E,k-E,p,m-p,$,M-$])}c=m}return u(e.length),l}function LN(r,e,t){var n=[],i=[r,e,t],s=DN(r,e,t),o=[];function a(){o.length&&n.push({ok:o}),o=[]}function l(h){for(var p=0;p<h.length;p++)o.push(h[p])}function c(h){if(h[2]!=h[6])return!0;for(var p=h[1],m=h[5],w=0;w<h[2];w++)if(r[w+p]!=t[w+m])return!0;return!1}for(var u=0;u<s.length;u++){var f=s[u],d=f[0];d==-1?c(f)?(a(),n.push({conflict:{a:r.slice(f[1],f[1]+f[2]),aIndex:f[1],o:e.slice(f[3],f[3]+f[4]),oIndex:f[3],b:t.slice(f[5],f[5]+f[6]),bIndex:f[5]}})):l(i[0].slice(f[1],f[1]+f[2])):l(i[d].slice(f[1],f[1]+f[2]))}return a(),n}qk.exports=LN});var Zu=G((TY,HC)=>{"use strict";g();var DC="[^\\\\/]",N8="(?=.)",LC="[^/]",_0="(?:\\/|$)",NC="(?:^|\\/)",x0=`\\.{1,2}${_0}`,B8="(?!\\.)",H8=`(?!${NC}${x0})`,G8=`(?!\\.{0,1}${_0})`,U8=`(?!${x0})`,j8="[^.\\/]",z8=`${LC}*?`,V8="/",BC={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:N8,QMARK:LC,END_ANCHOR:_0,DOTS_SLASH:x0,NO_DOT:B8,NO_DOTS:H8,NO_DOT_SLASH:G8,NO_DOTS_SLASH:U8,QMARK_NO_DOT:j8,STAR:z8,START_ANCHOR:NC,SEP:V8},W8={...BC,SLASH_LITERAL:"[\\\\/]",QMARK:DC,STAR:`${DC}*?`,DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},q8={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};HC.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:q8,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(r){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${r.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(r){return r===!0?W8:BC}}});var Xu=G(rn=>{"use strict";g();var{REGEX_BACKSLASH:Y8,REGEX_REMOVE_BACKSLASH:K8,REGEX_SPECIAL_CHARS:Z8,REGEX_SPECIAL_CHARS_GLOBAL:X8}=Zu();rn.isObject=r=>r!==null&&typeof r=="object"&&!Array.isArray(r);rn.hasRegexChars=r=>Z8.test(r);rn.isRegexChar=r=>r.length===1&&rn.hasRegexChars(r);rn.escapeRegex=r=>r.replace(X8,"\\$1");rn.toPosixSlashes=r=>r.replace(Y8,"/");rn.isWindows=()=>{if(typeof navigator!="undefined"&&navigator.platform){let r=navigator.platform.toLowerCase();return r==="win32"||r==="windows"}return typeof process!="undefined"&&process.platform?process.platform==="win32":!1};rn.removeBackslashes=r=>r.replace(K8,e=>e==="\\"?"":e);rn.escapeLast=(r,e,t)=>{let n=r.lastIndexOf(e,t);return n===-1?r:r[n-1]==="\\"?rn.escapeLast(r,e,n-1):`${r.slice(0,n)}\\${r.slice(n)}`};rn.removePrefix=(r,e={})=>{let t=r;return t.startsWith("./")&&(t=t.slice(2),e.prefix="./"),t};rn.wrapOutput=(r,e={},t={})=>{let n=t.contains?"":"^",i=t.contains?"":"$",s=`${n}(?:${r})${i}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s};rn.basename=(r,{windows:e}={})=>{let t=r.split(e?/[\\/]/:"/"),n=t[t.length-1];return n===""?t[t.length-2]:n}});var YC=G((IY,qC)=>{"use strict";g();var GC=Xu(),{CHAR_ASTERISK:E0,CHAR_AT:Q8,CHAR_BACKWARD_SLASH:Gl,CHAR_COMMA:J8,CHAR_DOT:S0,CHAR_EXCLAMATION_MARK:k0,CHAR_FORWARD_SLASH:WC,CHAR_LEFT_CURLY_BRACE:A0,CHAR_LEFT_PARENTHESES:Th,CHAR_LEFT_SQUARE_BRACKET:eG,CHAR_PLUS:tG,CHAR_QUESTION_MARK:UC,CHAR_RIGHT_CURLY_BRACE:rG,CHAR_RIGHT_PARENTHESES:jC,CHAR_RIGHT_SQUARE_BRACKET:nG}=Zu(),zC=r=>r===WC||r===Gl,VC=r=>{r.isPrefix!==!0&&(r.depth=r.isGlobstar?1/0:1)},iG=(r,e)=>{let t=e||{},n=r.length-1,i=t.parts===!0||t.tokens===!0||t.scanToEnd===!0,s=[],o=[],a=[],l=r,c=-1,u=0,f=0,d=!1,h=!1,p=!1,m=!1,w=!1,y=!1,v=!1,A=!1,C=!1,S=!1,T=0,b,x,E={value:"",depth:0,isGlob:!1},k=()=>c>=n,$=()=>l.charCodeAt(c+1),M=()=>(b=x,l.charCodeAt(++c));for(;c<n;){x=M();let Q;if(x===Gl){v=E.backslashes=!0,x=M(),x===A0&&(y=!0);continue}if(y===!0||x===A0){for(T++;k()!==!0&&(x=M());){if(x===Gl){v=E.backslashes=!0,M();continue}if(x===A0){T++;continue}if(y!==!0&&x===S0&&(x=M())===S0){if(d=E.isBrace=!0,p=E.isGlob=!0,S=!0,i===!0)continue;break}if(y!==!0&&x===J8){if(d=E.isBrace=!0,p=E.isGlob=!0,S=!0,i===!0)continue;break}if(x===rG&&(T--,T===0)){y=!1,d=E.isBrace=!0,S=!0;break}}if(i===!0)continue;break}if(x===WC){if(s.push(c),o.push(E),E={value:"",depth:0,isGlob:!1},S===!0)continue;if(b===S0&&c===u+1){u+=2;continue}f=c+1;continue}if(t.noext!==!0&&(x===tG||x===Q8||x===E0||x===UC||x===k0)===!0&&$()===Th){if(p=E.isGlob=!0,m=E.isExtglob=!0,S=!0,x===k0&&c===u&&(C=!0),i===!0){let fe=0;for(;k()!==!0&&(x=M());){if(x===Gl){v=E.backslashes=!0,M();continue}if(x===Th){fe++;continue}if(x===jC&&--fe===0){S=!0;break}}continue}break}if(x===E0){if(b===E0&&(w=E.isGlobstar=!0),p=E.isGlob=!0,S=!0,i===!0)continue;break}if(x===UC){if(p=E.isGlob=!0,S=!0,i===!0)continue;break}if(x===eG){for(;k()!==!0&&(Q=M());){if(Q===Gl){v=E.backslashes=!0,M();continue}if(Q===nG){h=E.isBracket=!0,p=E.isGlob=!0,S=!0;break}}if(i===!0)continue;break}if(t.nonegate!==!0&&x===k0&&c===u){A=E.negated=!0,u++;continue}if(t.noparen!==!0&&x===Th){if(p=E.isGlob=!0,i===!0){let oe=1;for(;k()!==!0&&(x=M());){if(x===Gl){v=E.backslashes=!0,M();continue}if(x===Th){oe++;continue}if(x===jC&&--oe===0){S=!0;break}}continue}break}if(p===!0){if(S=!0,i===!0)continue;break}}t.noext===!0&&(m=!1,p=!1);let D=l,P="",F="";u>0&&(P=l.slice(0,u),l=l.slice(u),f-=u),D&&p===!0&&f>0?(D=l.slice(0,f),F=l.slice(f)):p===!0?(D="",F=l):D=l,D&&D!==""&&D!=="/"&&D!==l&&zC(D.charCodeAt(D.length-1))&&(D=D.slice(0,-1)),t.unescape===!0&&(F&&(F=GC.removeBackslashes(F)),D&&v===!0&&(D=GC.removeBackslashes(D)));let _e={prefix:P,input:r,start:u,base:D,glob:F,isBrace:d,isBracket:h,isGlob:p,isExtglob:m,isGlobstar:w,negated:A,negatedExtglob:C};if(t.tokens===!0&&(_e.maxDepth=0,zC(x)||o.push(E),_e.tokens=o),t.parts===!0||t.tokens===!0){let Q;for(let Z=0;Z<s.length;Z++){let Y=Q!==void 0?Q+1:u,J=s[Z],U=r.slice(Y,J);t.tokens&&(Z===0&&u!==0?(o[Z].isPrefix=!0,o[Z].value=P):o[Z].value=U,VC(o[Z]),_e.maxDepth+=o[Z].depth),J>=u&&(a.push(U),Q=J)}let oe=Q!==void 0?Q+1:u,fe=r.slice(oe);a.push(fe),t.tokens&&Q&&Q+1<r.length&&(o[o.length-1].value=fe,VC(o[o.length-1]),_e.maxDepth+=o[o.length-1].depth),_e.slashes=s,_e.parts=a}return _e};qC.exports=iG});var QC=G((FY,XC)=>{"use strict";g();var Qu=Zu(),xn=Xu(),{MAX_LENGTH:Rh,POSIX_REGEX_SOURCE:sG,REGEX_NON_SPECIAL_CHARS:oG,REGEX_SPECIAL_CHARS_BACKREF:aG,REPLACEMENTS:KC}=Qu,lG=(r,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...r,e);r.sort();let t=`[${r.join("-")}]`;try{new RegExp(t)}catch(n){return r.map(i=>xn.escapeRegex(i)).join("..")}return t},Ul=(r,e)=>`Missing ${r}: "${e}" - use "\\\\${e}" to match literal characters`,ZC=r=>{let e=[],t=0,n=0,i=0,s="",o=!1;for(let a of r){if(o===!0){s+=a,o=!1;continue}if(a==="\\"){s+=a,o=!0;continue}if(a==='"'){i=i===1?0:1,s+=a;continue}if(i===0){if(a==="[")t++;else if(a==="]"&&t>0)t--;else if(t===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(s),s="";continue}}}s+=a}return e.push(s),e},cG=r=>{let e=!1;for(let t of r){if(e===!0){e=!1;continue}if(t==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(t))return!1}return!0},T0=r=>{let e=r.trim(),t=!0;for(;t===!0;)t=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),t=!0);if(cG(e))return e.replace(/\\(.)/g,"$1")},uG=r=>{let e=r.map(T0).filter(Boolean);for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){let i=e[t],s=e[n],o=i[0];if(!(!o||i!==o.repeat(i.length)||s!==o.repeat(s.length))&&(i===s||i.startsWith(s)||s.startsWith(i)))return!0}return!1},C0=(r,e=!0)=>{if(r[0]!=="+"&&r[0]!=="*"||r[1]!=="(")return;let t=0,n=0,i=0,s=!1;for(let o=1;o<r.length;o++){let a=r[o];if(s===!0){s=!1;continue}if(a==="\\"){s=!0;continue}if(a==='"'){i=i===1?0:1;continue}if(i!==1){if(a==="["){t++;continue}if(a==="]"&&t>0){t--;continue}if(!(t>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&o!==r.length-1?void 0:{type:r[0],body:r.slice(2,o),end:o}}}}},fG=r=>`${r.length===1?xn.escapeRegex(r[0]):`[${r.map(t=>xn.escapeRegex(t)).join("")}]`}*`,dG=r=>{let e=0,t=[];for(;e<r.length;){let n=C0(r.slice(e),!1);if(!n||n.type!=="*")return;let i=ZC(n.body).map(o=>o.trim());if(i.length!==1)return;let s=T0(i[0]);if(!s||s.length!==1)return;t.push(s),e+=n.end+1}if(!(t.length<1))return t},hG=r=>{let e=0,t=r.trim(),n=C0(t);for(;n;)e++,t=n.body.trim(),n=C0(t);return e},pG=(r,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let t=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Qu.DEFAULT_MAX_EXTGLOB_RECURSION,n=ZC(r).map(a=>a.trim());if(n.length>1&&(n.some(a=>a==="")||n.some(a=>/^[*?]+$/.test(a))||uG(n)))return{risky:!0};let i=[],s=!1,o=!0;for(let a of n){let l=dG(a);if(l){s=!0,i.push(...l);continue}let c=T0(a);if(c&&c.length===1){i.push(c);continue}if(o=!1,hG(a)>t)return{risky:!0}}return s?o?{risky:!0,safeOutput:fG([...new Set(i)])}:{risky:!0}:{risky:!1}},R0=(r,e)=>{if(typeof r!="string")throw new TypeError("Expected a string");r=KC[r]||r;let t={...e},n=typeof t.maxLength=="number"?Math.min(Rh,t.maxLength):Rh,i=r.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let s={type:"bos",value:"",output:t.prepend||""},o=[s],a=t.capture?"":"?:",l=Qu.globChars(t.windows),c=Qu.extglobChars(l),{DOT_LITERAL:u,PLUS_LITERAL:f,SLASH_LITERAL:d,ONE_CHAR:h,DOTS_SLASH:p,NO_DOT:m,NO_DOT_SLASH:w,NO_DOTS_SLASH:y,QMARK:v,QMARK_NO_DOT:A,STAR:C,START_ANCHOR:S}=l,T=j=>`(${a}(?:(?!${S}${j.dot?p:u}).)*?)`,b=t.dot?"":m,x=t.dot?v:A,E=t.bash===!0?T(t):C;t.capture&&(E=`(${E})`),typeof t.noext=="boolean"&&(t.noextglob=t.noext);let k={input:r,index:-1,start:0,dot:t.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};r=xn.removePrefix(r,k),i=r.length;let $=[],M=[],D=[],P=s,F,_e=()=>k.index===i-1,Q=k.peek=(j=1)=>r[k.index+j],oe=k.advance=()=>r[++k.index]||"",fe=()=>r.slice(k.index+1),Z=(j="",Ce=0)=>{k.consumed+=j,k.index+=Ce},Y=j=>{k.output+=j.output!=null?j.output:j.value,Z(j.value)},J=()=>{let j=1;for(;Q()==="!"&&(Q(2)!=="("||Q(3)==="?");)oe(),k.start++,j++;return j%2===0?!1:(k.negated=!0,k.start++,!0)},U=j=>{k[j]++,D.push(j)},et=j=>{k[j]--,D.pop()},se=j=>{if(P.type==="globstar"){let Ce=k.braces>0&&(j.type==="comma"||j.type==="brace"),z=j.extglob===!0||$.length&&(j.type==="pipe"||j.type==="paren");j.type!=="slash"&&j.type!=="paren"&&!Ce&&!z&&(k.output=k.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=E,k.output+=P.output)}if($.length&&j.type!=="paren"&&($[$.length-1].inner+=j.value),(j.value||j.output)&&Y(j),P&&P.type==="text"&&j.type==="text"){P.output=(P.output||P.value)+j.value,P.value+=j.value;return}j.prev=P,o.push(j),P=j},vt=(j,Ce)=>{let z={...c[Ce],conditions:1,inner:""};z.prev=P,z.parens=k.parens,z.output=k.output,z.startIndex=k.index,z.tokensIndex=o.length;let we=(t.capture?"(":"")+z.open;U("parens"),se({type:j,value:Ce,output:k.output?"":h}),se({type:"paren",extglob:!0,value:oe(),output:we}),$.push(z)},tt=j=>{let Ce=r.slice(j.startIndex,k.index+1),z=r.slice(j.startIndex+2,k.index),we=pG(z,t);if((j.type==="plus"||j.type==="star")&&we.risky){let Te=we.safeOutput?(j.output?"":h)+(t.capture?`(${we.safeOutput})`:we.safeOutput):void 0,bt=o[j.tokensIndex];bt.type="text",bt.value=Ce,bt.output=Te||xn.escapeRegex(Ce);for(let vn=j.tokensIndex+1;vn<o.length;vn++)o[vn].value="",o[vn].output="",delete o[vn].suffix;k.output=j.output+bt.output,k.backtrack=!0,se({type:"paren",extglob:!0,value:F,output:""}),et("parens");return}let ee=j.close+(t.capture?")":""),Oe;if(j.type==="negate"){let Te=E;if(j.inner&&j.inner.length>1&&j.inner.includes("/")&&(Te=T(t)),(Te!==E||_e()||/^\)+$/.test(fe()))&&(ee=j.close=`)$))${Te}`),j.inner.includes("*")&&(Oe=fe())&&/^\.[^\\/.]+$/.test(Oe)){let bt=R0(Oe,{...e,fastpaths:!1}).output;ee=j.close=`)${bt})${Te})`}j.prev.type==="bos"&&(k.negatedExtglob=!0)}se({type:"paren",extglob:!0,value:F,output:ee}),et("parens")};if(t.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(r)){let j=!1,Ce=r.replace(aG,(z,we,ee,Oe,Te,bt)=>Oe==="\\"?(j=!0,z):Oe==="?"?we?we+Oe+(Te?v.repeat(Te.length):""):bt===0?x+(Te?v.repeat(Te.length):""):v.repeat(ee.length):Oe==="."?u.repeat(ee.length):Oe==="*"?we?we+Oe+(Te?E:""):E:we?z:`\\${z}`);return j===!0&&(t.unescape===!0?Ce=Ce.replace(/\\/g,""):Ce=Ce.replace(/\\+/g,z=>z.length%2===0?"\\\\":z?"\\":"")),Ce===r&&t.contains===!0?(k.output=r,k):(k.output=xn.wrapOutput(Ce,k,e),k)}for(;!_e();){if(F=oe(),F==="\0")continue;if(F==="\\"){let z=Q();if(z==="/"&&t.bash!==!0||z==="."||z===";")continue;if(!z){F+="\\",se({type:"text",value:F});continue}let we=/^\\+/.exec(fe()),ee=0;if(we&&we[0].length>2&&(ee=we[0].length,k.index+=ee,ee%2!==0&&(F+="\\")),t.unescape===!0?F=oe():F+=oe(),k.brackets===0){se({type:"text",value:F});continue}}if(k.brackets>0&&(F!=="]"||P.value==="["||P.value==="[^")){if(t.posix!==!1&&F===":"){let z=P.value.slice(1);if(z.includes("[")&&(P.posix=!0,z.includes(":"))){let we=P.value.lastIndexOf("["),ee=P.value.slice(0,we),Oe=P.value.slice(we+2),Te=sG[Oe];if(Te){P.value=ee+Te,k.backtrack=!0,oe(),!s.output&&o.indexOf(P)===1&&(s.output=h);continue}}}(F==="["&&Q()!==":"||F==="-"&&Q()==="]")&&(F=`\\${F}`),F==="]"&&(P.value==="["||P.value==="[^")&&(F=`\\${F}`),t.posix===!0&&F==="!"&&P.value==="["&&(F="^"),P.value+=F,Y({value:F});continue}if(k.quotes===1&&F!=='"'){F=xn.escapeRegex(F),P.value+=F,Y({value:F});continue}if(F==='"'){k.quotes=k.quotes===1?0:1,t.keepQuotes===!0&&se({type:"text",value:F});continue}if(F==="("){U("parens"),se({type:"paren",value:F});continue}if(F===")"){if(k.parens===0&&t.strictBrackets===!0)throw new SyntaxError(Ul("opening","("));let z=$[$.length-1];if(z&&k.parens===z.parens+1){tt($.pop());continue}se({type:"paren",value:F,output:k.parens?")":"\\)"}),et("parens");continue}if(F==="["){if(t.nobracket===!0||!fe().includes("]")){if(t.nobracket!==!0&&t.strictBrackets===!0)throw new SyntaxError(Ul("closing","]"));F=`\\${F}`}else U("brackets");se({type:"bracket",value:F});continue}if(F==="]"){if(t.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){se({type:"text",value:F,output:`\\${F}`});continue}if(k.brackets===0){if(t.strictBrackets===!0)throw new SyntaxError(Ul("opening","["));se({type:"text",value:F,output:`\\${F}`});continue}et("brackets");let z=P.value.slice(1);if(P.posix!==!0&&z[0]==="^"&&!z.includes("/")&&(F=`/${F}`),P.value+=F,Y({value:F}),t.literalBrackets===!1||xn.hasRegexChars(z))continue;let we=xn.escapeRegex(P.value);if(k.output=k.output.slice(0,-P.value.length),t.literalBrackets===!0){k.output+=we,P.value=we;continue}P.value=`(${a}${we}|${P.value})`,k.output+=P.value;continue}if(F==="{"&&t.nobrace!==!0){U("braces");let z={type:"brace",value:F,output:"(",outputIndex:k.output.length,tokensIndex:k.tokens.length};M.push(z),se(z);continue}if(F==="}"){let z=M[M.length-1];if(t.nobrace===!0||!z){se({type:"text",value:F,output:F});continue}let we=")";if(z.dots===!0){let ee=o.slice(),Oe=[];for(let Te=ee.length-1;Te>=0&&(o.pop(),ee[Te].type!=="brace");Te--)ee[Te].type!=="dots"&&Oe.unshift(ee[Te].value);we=lG(Oe,t),k.backtrack=!0}if(z.comma!==!0&&z.dots!==!0){let ee=k.output.slice(0,z.outputIndex),Oe=k.tokens.slice(z.tokensIndex);z.value=z.output="\\{",F=we="\\}",k.output=ee;for(let Te of Oe)k.output+=Te.output||Te.value}se({type:"brace",value:F,output:we}),et("braces"),M.pop();continue}if(F==="|"){$.length>0&&$[$.length-1].conditions++,se({type:"text",value:F});continue}if(F===","){let z=F,we=M[M.length-1];we&&D[D.length-1]==="braces"&&(we.comma=!0,z="|"),se({type:"comma",value:F,output:z});continue}if(F==="/"){if(P.type==="dot"&&k.index===k.start+1){k.start=k.index+1,k.consumed="",k.output="",o.pop(),P=s;continue}se({type:"slash",value:F,output:d});continue}if(F==="."){if(k.braces>0&&P.type==="dot"){P.value==="."&&(P.output=u);let z=M[M.length-1];P.type="dots",P.output+=F,P.value+=F,z.dots=!0;continue}if(k.braces+k.parens===0&&P.type!=="bos"&&P.type!=="slash"){se({type:"text",value:F,output:u});continue}se({type:"dot",value:F,output:u});continue}if(F==="?"){if(!(P&&P.value==="(")&&t.noextglob!==!0&&Q()==="("&&Q(2)!=="?"){vt("qmark",F);continue}if(P&&P.type==="paren"){let we=Q(),ee=F;(P.value==="("&&!/[!=<:]/.test(we)||we==="<"&&!/<([!=]|\w+>)/.test(fe()))&&(ee=`\\${F}`),se({type:"text",value:F,output:ee});continue}if(t.dot!==!0&&(P.type==="slash"||P.type==="bos")){se({type:"qmark",value:F,output:A});continue}se({type:"qmark",value:F,output:v});continue}if(F==="!"){if(t.noextglob!==!0&&Q()==="("&&(Q(2)!=="?"||!/[!=<:]/.test(Q(3)))){vt("negate",F);continue}if(t.nonegate!==!0&&k.index===0){J();continue}}if(F==="+"){if(t.noextglob!==!0&&Q()==="("&&Q(2)!=="?"){vt("plus",F);continue}if(P&&P.value==="("||t.regex===!1){se({type:"plus",value:F,output:f});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||k.parens>0){se({type:"plus",value:F});continue}se({type:"plus",value:f});continue}if(F==="@"){if(t.noextglob!==!0&&Q()==="("&&Q(2)!=="?"){se({type:"at",extglob:!0,value:F,output:""});continue}se({type:"text",value:F});continue}if(F!=="*"){(F==="$"||F==="^")&&(F=`\\${F}`);let z=oG.exec(fe());z&&(F+=z[0],k.index+=z[0].length),se({type:"text",value:F});continue}if(P&&(P.type==="globstar"||P.star===!0)){P.type="star",P.star=!0,P.value+=F,P.output=E,k.backtrack=!0,k.globstar=!0,Z(F);continue}let j=fe();if(t.noextglob!==!0&&/^\([^?]/.test(j)){vt("star",F);continue}if(P.type==="star"){if(t.noglobstar===!0){Z(F);continue}let z=P.prev,we=z.prev,ee=z.type==="slash"||z.type==="bos",Oe=we&&(we.type==="star"||we.type==="globstar");if(t.bash===!0&&(!ee||j[0]&&j[0]!=="/")){se({type:"star",value:F,output:""});continue}let Te=k.braces>0&&(z.type==="comma"||z.type==="brace"),bt=$.length&&(z.type==="pipe"||z.type==="paren");if(!ee&&z.type!=="paren"&&!Te&&!bt){se({type:"star",value:F,output:""});continue}for(;j.slice(0,3)==="/**";){let Vr=r[k.index+4];if(Vr&&Vr!=="/")break;j=j.slice(3),Z("/**",3)}let vn=_e()||k.parens>0&&j===")".repeat(k.parens)&&!$.some(Vr=>Vr.type==="negate");if(z.type==="bos"&&_e()){P.type="globstar",P.value+=F,P.output=T(t),k.output=P.output,k.globstar=!0,Z(F);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&!Oe&&vn){k.output=k.output.slice(0,-(z.output+P.output).length),z.output=`(?:${z.output}`,P.type="globstar",P.output=T(t)+(t.strictSlashes?")":"|$)"),P.value+=F,k.globstar=!0,k.output+=z.output+P.output,Z(F);continue}if(z.type==="slash"&&z.prev.type!=="bos"&&j[0]==="/"){let Vr=j[1]!==void 0?"|$":"";k.output=k.output.slice(0,-(z.output+P.output).length),z.output=`(?:${z.output}`,P.type="globstar",P.output=`${T(t)}${d}|${d}${Vr})`,P.value+=F,k.output+=z.output+P.output,k.globstar=!0,Z(F+oe()),se({type:"slash",value:"/",output:""});continue}if(z.type==="bos"&&j[0]==="/"){P.type="globstar",P.value+=F,P.output=`(?:^|${d}|${T(t)}${d})`,k.output=P.output,k.globstar=!0,Z(F+oe()),se({type:"slash",value:"/",output:""});continue}k.output=k.output.slice(0,-P.output.length),P.type="globstar",P.output=T(t),P.value+=F,k.output+=P.output,k.globstar=!0,Z(F);continue}let Ce={type:"star",value:F,output:E};if(t.bash===!0){Ce.output=".*?",(P.type==="bos"||P.type==="slash")&&(Ce.output=b+Ce.output),se(Ce);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&t.regex===!0){Ce.output=F,se(Ce);continue}(k.index===k.start||P.type==="slash"||P.type==="dot")&&(P.type==="dot"?(k.output+=w,P.output+=w):t.dot===!0?(k.output+=y,P.output+=y):(k.output+=b,P.output+=b),Q()!=="*"&&(k.output+=h,P.output+=h)),se(Ce)}for(;k.brackets>0;){if(t.strictBrackets===!0)throw new SyntaxError(Ul("closing","]"));k.output=xn.escapeLast(k.output,"["),et("brackets")}for(;k.parens>0;){if(t.strictBrackets===!0)throw new SyntaxError(Ul("closing",")"));k.output=xn.escapeLast(k.output,"("),et("parens")}for(;k.braces>0;){if(t.strictBrackets===!0)throw new SyntaxError(Ul("closing","}"));k.output=xn.escapeLast(k.output,"{"),et("braces")}if(t.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&se({type:"maybe_slash",value:"",output:`${d}?`}),k.backtrack===!0){k.output="";for(let j of k.tokens)k.output+=j.output!=null?j.output:j.value,j.suffix&&(k.output+=j.suffix)}return k};R0.fastpaths=(r,e)=>{let t={...e},n=typeof t.maxLength=="number"?Math.min(Rh,t.maxLength):Rh,i=r.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);r=KC[r]||r;let{DOT_LITERAL:s,SLASH_LITERAL:o,ONE_CHAR:a,DOTS_SLASH:l,NO_DOT:c,NO_DOTS:u,NO_DOTS_SLASH:f,STAR:d,START_ANCHOR:h}=Qu.globChars(t.windows),p=t.dot?u:c,m=t.dot?f:c,w=t.capture?"":"?:",y={negated:!1,prefix:""},v=t.bash===!0?".*?":d;t.capture&&(v=`(${v})`);let A=b=>b.noglobstar===!0?v:`(${w}(?:(?!${h}${b.dot?l:s}).)*?)`,C=b=>{switch(b){case"*":return`${p}${a}${v}`;case".*":return`${s}${a}${v}`;case"*.*":return`${p}${v}${s}${a}${v}`;case"*/*":return`${p}${v}${o}${a}${m}${v}`;case"**":return p+A(t);case"**/*":return`(?:${p}${A(t)}${o})?${m}${a}${v}`;case"**/*.*":return`(?:${p}${A(t)}${o})?${m}${v}${s}${a}${v}`;case"**/.*":return`(?:${p}${A(t)}${o})?${s}${a}${v}`;default:{let x=/^(.*?)\.(\w+)$/.exec(b);if(!x)return;let E=C(x[1]);return E?E+s+x[2]:void 0}}},S=xn.removePrefix(r,y),T=C(S);return T&&t.strictSlashes!==!0&&(T+=`${o}?`),T};XC.exports=R0});var tT=G((DY,eT)=>{"use strict";g();var mG=YC(),$0=QC(),JC=Xu(),gG=Zu(),wG=r=>r&&typeof r=="object"&&!Array.isArray(r),Mt=(r,e,t=!1)=>{if(Array.isArray(r)){let u=r.map(d=>Mt(d,e,t));return d=>{for(let h of u){let p=h(d);if(p)return p}return!1}}let n=wG(r)&&r.tokens&&r.input;if(r===""||typeof r!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},s=i.windows,o=n?Mt.compileRe(r,e):Mt.makeRe(r,e,!1,!0),a=o.state;delete o.state;let l=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};l=Mt(i.ignore,u,t)}let c=(u,f=!1)=>{let{isMatch:d,match:h,output:p}=Mt.test(u,o,e,{glob:r,posix:s}),m={glob:r,state:a,regex:o,posix:s,input:u,output:p,match:h,isMatch:d};return typeof i.onResult=="function"&&i.onResult(m),d===!1?(m.isMatch=!1,f?m:!1):l(u)?(typeof i.onIgnore=="function"&&i.onIgnore(m),m.isMatch=!1,f?m:!1):(typeof i.onMatch=="function"&&i.onMatch(m),f?m:!0)};return t&&(c.state=a),c};Mt.test=(r,e,t,{glob:n,posix:i}={})=>{if(typeof r!="string")throw new TypeError("Expected input to be a string");if(r==="")return{isMatch:!1,output:""};let s=t||{},o=s.format||(i?JC.toPosixSlashes:null),a=r===n,l=a&&o?o(r):r;return a===!1&&(l=o?o(r):r,a=l===n),(a===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?a=Mt.matchBase(r,e,t,i):a=e.exec(l)),{isMatch:!!a,match:a,output:l}};Mt.matchBase=(r,e,t,n=t&&t.windows)=>(e instanceof RegExp?e:Mt.makeRe(e,t)).test(JC.basename(r,{windows:n}));Mt.isMatch=(r,e,t)=>Mt(e,t)(r);Mt.parse=(r,e)=>Array.isArray(r)?r.map(t=>Mt.parse(t,e)):$0(r,{...e,fastpaths:!1});Mt.scan=(r,e)=>mG(r,e);Mt.compileRe=(r,e,t=!1,n=!1)=>{if(t===!0)return r.output;let i=e||{},s=i.contains?"":"^",o=i.contains?"":"$",a=`${s}(?:${r.output})${o}`;r&&r.negated===!0&&(a=`^(?!${a}).*$`);let l=Mt.toRegex(a,e);return n===!0&&(l.state=r),l};Mt.makeRe=(r,e={},t=!1,n=!1)=>{if(!r||typeof r!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(r[0]==="."||r[0]==="*")&&(i.output=$0.fastpaths(r,e)),i.output||(i=$0(r,e)),Mt.compileRe(i,e,t,n)};Mt.toRegex=(r,e)=>{try{let t=e||{};return new RegExp(r,t.flags||(t.nocase?"i":""))}catch(t){if(e&&e.debug===!0)throw t;return/$^/}};Mt.constants=gG;eT.exports=Mt});var sT=G((NY,iT)=>{"use strict";g();var rT=tT(),vG=Xu();function nT(r,e,t=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:vG.isWindows()}),rT(r,e,t)}Object.assign(nT,rT);iT.exports=nT});var cT=G((UY,lT)=>{"use strict";g();lT.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 fT=G((zY,uT)=>{g();var I0={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}};uT.exports=function(r,e,t,n){if(!I0.hasOwnProperty(t))throw new Error("Cannot convert to "+t);if(!I0[t].hasOwnProperty(e))throw new Error("Cannot convert from "+e+" to "+t);var i=I0[t][e]*r;return n!==!1?(n=Math.pow(10,parseInt(n)||5),Math.round(i*n)/n):i}});var kT=G(As=>{"use strict";g();Object.defineProperty(As,"__esModule",{value:!0});As.fromRgba=jl;As.fromRgb=O0;As.fromHsla=$h;As.fromHsl=ET;As.fromString=ST;As.default=void 0;var dT=mT(cT()),_G=mT(fT());function mT(r){return r&&r.__esModule?r:{default:r}}function xG(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function hT(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function EG(r,e,t){return e&&hT(r.prototype,e),t&&hT(r,t),r}function Mr(r,e){return CG(r)||AG(r,e)||kG(r,e)||SG()}function SG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kG(r,e){if(r){if(typeof r=="string")return pT(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return pT(r,e)}}function pT(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function AG(r,e){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(r)))){var t=[],n=!0,i=!1,s=void 0;try{for(var o=r[Symbol.iterator](),a;!(n=(a=o.next()).done)&&(t.push(a.value),!(e&&t.length===e));n=!0);}catch(l){i=!0,s=l}finally{try{!n&&o.return!=null&&o.return()}finally{if(i)throw s}}return t}}function CG(r){if(Array.isArray(r))return r}var gT=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?$/,wT=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])?$/,vT=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,bT=/^rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,yT=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,_T=/^rgba?\(\s*(\d+%)\s+(\d+%)\s+(\d+%)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,xT=/^hsla?\(\s*(\d+)(deg|rad|grad|turn)?\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/;function Ju(r,e){return r.indexOf(e)>-1}function TG(r,e,t){var n=r/255,i=e/255,s=t/255,o=Math.max(n,i,s),a=Math.min(n,i,s),l=o-a,c=(o+a)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=(function(){switch(o){case n:return(i-s)/l%6;case i:return(s-n)/l+2;default:return(n-i)/l+4}})();return[f*60,u*100,c*100]}function RG(r,e,t){var n=r/60,i=e/100,s=t/100,o=(1-Math.abs(2*s-1))*i,a=o*(1-Math.abs(n%2-1)),l=s-o/2,c=(function(){return n<1?[o,a,0]:n<2?[a,o,0]:n<3?[0,o,a]:n<4?[0,a,o]:n<5?[a,0,o]:[o,0,a]})(),u=Mr(c,3),f=u[0],d=u[1],h=u[2];return[(f+l)*255,(d+l)*255,(h+l)*255]}var $G=(function(){function r(e){var t=Mr(e,4),n=t[0],i=t[1],s=t[2],o=t[3];xG(this,r),this.values=[Math.max(Math.min(parseInt(n,10),255),0),Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(s,10),255),0),o==null?1:Math.max(Math.min(parseFloat(o),255),0)]}return EG(r,[{key:"toRgbString",value:function(){var t=Mr(this.values,4),n=t[0],i=t[1],s=t[2],o=t[3];return o===1?"rgb(".concat(n,", ").concat(i,", ").concat(s,")"):"rgba(".concat(n,", ").concat(i,", ").concat(s,", ").concat(o,")")}},{key:"toHslString",value:function(){var t=this.toHslaArray(),n=Mr(t,4),i=n[0],s=n[1],o=n[2],a=n[3];return a===1?"hsl(".concat(i,", ").concat(s,"%, ").concat(o,"%)"):"hsla(".concat(i,", ").concat(s,"%, ").concat(o,"%, ").concat(a,")")}},{key:"toHexString",value:function(){var t=Mr(this.values,4),n=t[0],i=t[1],s=t[2],o=t[3];return n=Number(n).toString(16).padStart(2,"0"),i=Number(i).toString(16).padStart(2,"0"),s=Number(s).toString(16).padStart(2,"0"),o=o<1?parseInt(o*255,10).toString(16).padStart(2,"0"):"","#".concat(n).concat(i).concat(s).concat(o)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var t=Mr(this.values,4),n=t[0],i=t[1],s=t[2],o=t[3],a=TG(n,i,s),l=Mr(a,3),c=l[0],u=l[1],f=l[2];return[c,u,f,o]}}]),r})();function jl(r){var e=Mr(r,4),t=e[0],n=e[1],i=e[2],s=e[3];return new $G([t,n,i,s])}function O0(r){var e=Mr(r,3),t=e[0],n=e[1],i=e[2];return jl([t,n,i,1])}function $h(r){var e=Mr(r,4),t=e[0],n=e[1],i=e[2],s=e[3],o=RG(t,n,i),a=Mr(o,3),l=a[0],c=a[1],u=a[2];return jl([l,c,u,s])}function ET(r){var e=Mr(r,3),t=e[0],n=e[1],i=e[2];return $h([t,n,i,1])}function PG(r){var e=gT.exec(r)||wT.exec(r),t=Mr(e,5),n=t[1],i=t[2],s=t[3],o=t[4];return n=parseInt(n.length<2?n.repeat(2):n,16),i=parseInt(i.length<2?i.repeat(2):i,16),s=parseInt(s.length<2?s.repeat(2):s,16),o=o&&(parseInt(o.length<2?o.repeat(2):o,16)/255).toPrecision(1)||1,jl([n,i,s,o])}function IG(r){var e=vT.exec(r)||yT.exec(r)||bT.exec(r)||_T.exec(r),t=Mr(e,5),n=t[1],i=t[2],s=t[3],o=t[4];return n=Ju(n,"%")?parseInt(n,10)*255/100:parseInt(n,10),i=Ju(i,"%")?parseInt(i,10)*255/100:parseInt(i,10),s=Ju(s,"%")>0?parseInt(s,10)*255/100:parseInt(s,10),o=o===void 0?1:parseFloat(o)/(Ju(o,"%")?100:1),jl([n,i,s,o])}function OG(r){var e=xT.exec(r),t=Mr(e,6),n=t[1],i=t[2],s=t[3],o=t[4],a=t[5];return i=i||"deg",n=(0,_G.default)(parseFloat(n),i,"deg"),s=parseFloat(s),o=parseFloat(o),a=a===void 0?1:parseFloat(a)/(Ju(a,"%")?100:1),$h([n,s,o,a])}function ST(r){return dT.default[r]?O0(dT.default[r]):gT.test(r)||wT.test(r)?PG(r):vT.test(r)||yT.test(r)||bT.test(r)||_T.test(r)?IG(r):xT.test(r)?OG(r):null}var FG={fromString:ST,fromRgb:O0,fromRgba:jl,fromHsl:ET,fromHsla:$h};As.default=FG});var DT=G((rK,MT)=>{g();MT.exports=function(r,e){var t=r,n=e,i=t.length,s=n.length,o=!1,a=i+1,l=[],c=[],u,f,d=function(){i>=s&&(u=t,f=i,t=n,n=u,i=s,s=f,o=!0,a=i+1)},h=function(m,w,y,v,A){return{startX:m,startY:w,endX:y,endY:v,r:A}},p=function(m,w,y){var v,A,C,S,T;for(w>y?v=l[m-1+a]:v=l[m+1+a],T=C=Math.max(w,y),S=A=C-m;A<i&&C<s&&t[A]===n[C];)++A,++C;return S==A&&T==C?l[m+a]=v:(l[m+a]=c.length,c[c.length]=new h(S,T,A,C,v)),C};return d(),{compose:function(){var m,w,y,v,A,C,S,T,b,x;for(m=s-i,w=i+s+3,y={},C=0;C<w;++C)y[C]=-1,l[C]=-1;v=-1;do{for(++v,S=-v;S<=m-1;++S)y[S+a]=p(S,y[S-1+a]+1,y[S+1+a]);for(S=m+v;S>=m+1;--S)y[S+a]=p(S,y[S-1+a]+1,y[S+1+a]);y[m+a]=p(m,y[m-1+a]+1,y[m+1+a])}while(y[m+a]!==s);for(A=l[m+a],T=i,b=s,x=[];A!==-1;){let E=c[A];(i!=E.endX||s!=E.endY)&&x.push({file1:[o?E.endY:E.endX,o?b-E.endY:T-E.endX],file2:[o?E.endX:E.endY,o?T-E.endX:b-E.endY]}),T=E.startX,b=E.startY,A=c[A].r}return(T!=0||b!=0)&&x.push({file1:[0,o?b:T],file2:[0,o?T:b]}),x.reverse(),x}}}});var BT=G((iK,NT)=>{g();var LT=DT();function LG(r,e,t){var n,i=new LT(e,r).compose(),s=new LT(e,t).compose(),o=[];function a(D,P){o.push([D.file1[0],P,D.file1[1],D.file2[0],D.file2[1]])}for(n=0;n<i.length;n++)a(i[n],0);for(n=0;n<s.length;n++)a(s[n],2);o.sort(function(D,P){return D[0]-P[0]});var l=[],c=0;function u(D){D>c&&(l.push([1,c,D-c]),c=D)}for(var f=0;f<o.length;f++){for(var d=f,h=o[f],p=h[0],m=p+h[2];f<o.length-1;){var w=o[f+1],y=w[0];if(y>m)break;m=Math.max(m,y+w[2]),f++}if(u(p),d==f)h[4]>0&&l.push([h[1],h[3],h[4]]);else{var v={0:[r.length,-1,e.length,-1],2:[t.length,-1,e.length,-1]};for(n=d;n<=f;n++){h=o[n];var A=h[1],C=v[A],S=h[0],T=S+h[2],b=h[3],x=b+h[4];C[0]=Math.min(b,C[0]),C[1]=Math.max(x,C[1]),C[2]=Math.min(S,C[2]),C[3]=Math.max(T,C[3])}var E=v[0][0]+(p-v[0][2]),k=v[0][1]+(m-v[0][3]),$=v[2][0]+(p-v[2][2]),M=v[2][1]+(m-v[2][3]);l.push([-1,E,k-E,p,m-p,$,M-$])}c=m}return u(e.length),l}function NG(r,e,t){var n=[],i=[r,e,t],s=LG(r,e,t),o=[];function a(){o.length&&n.push({ok:o}),o=[]}function l(h){for(var p=0;p<h.length;p++)o.push(h[p])}function c(h){if(h[2]!=h[6])return!0;for(var p=h[1],m=h[5],w=0;w<h[2];w++)if(r[w+p]!=t[w+m])return!0;return!1}for(var u=0;u<s.length;u++){var f=s[u],d=f[0];d==-1?c(f)?(a(),n.push({conflict:{a:r.slice(f[1],f[1]+f[2]),aIndex:f[1],o:e.slice(f[3],f[3]+f[4]),oIndex:f[3],b:t.slice(f[5],f[5]+f[6]),bIndex:f[5]}})):l(i[0].slice(f[1],f[1]+f[2])):l(i[d].slice(f[1],f[1]+f[2]))}return a(),n}NT.exports=NG});var UT=G((vK,GT)=>{g();var ql=1e3,Yl=ql*60,Kl=Yl*60,fa=Kl*24,UG=fa*7,jG=fa*365.25;GT.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return zG(r);if(t==="number"&&isFinite(r))return e.long?WG(r):VG(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function zG(r){if(r=String(r),!(r.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(r);if(e){var t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*jG;case"weeks":case"week":case"w":return t*UG;case"days":case"day":case"d":return t*fa;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Kl;case"minutes":case"minute":case"mins":case"min":case"m":return t*Yl;case"seconds":case"second":case"secs":case"sec":case"s":return t*ql;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function VG(r){var e=Math.abs(r);return e>=fa?Math.round(r/fa)+"d":e>=Kl?Math.round(r/Kl)+"h":e>=Yl?Math.round(r/Yl)+"m":e>=ql?Math.round(r/ql)+"s":r+"ms"}function WG(r){var e=Math.abs(r);return e>=fa?Dh(r,e,fa,"day"):e>=Kl?Dh(r,e,Kl,"hour"):e>=Yl?Dh(r,e,Yl,"minute"):e>=ql?Dh(r,e,ql,"second"):r+" ms"}function Dh(r,e,t,n){var i=e>=t*1.5;return Math.round(r/t)+" "+n+(i?"s":"")}});var zT=G((yK,jT)=>{g();function qG(r){t.debug=t,t.default=t,t.coerce=l,t.disable=o,t.enable=i,t.enabled=a,t.humanize=UT(),t.destroy=c,Object.keys(r).forEach(u=>{t[u]=r[u]}),t.names=[],t.skips=[],t.formatters={};function e(u){let f=0;for(let d=0;d<u.length;d++)f=(f<<5)-f+u.charCodeAt(d),f|=0;return t.colors[Math.abs(f)%t.colors.length]}t.selectColor=e;function t(u){let f,d=null,h,p;function m(...w){if(!m.enabled)return;let y=m,v=Number(new Date),A=v-(f||v);y.diff=A,y.prev=f,y.curr=v,f=v,w[0]=t.coerce(w[0]),typeof w[0]!="string"&&w.unshift("%O");let C=0;w[0]=w[0].replace(/%([a-zA-Z%])/g,(T,b)=>{if(T==="%%")return"%";C++;let x=t.formatters[b];if(typeof x=="function"){let E=w[C];T=x.call(y,E),w.splice(C,1),C--}return T}),t.formatArgs.call(y,w),(y.log||t.log).apply(y,w)}return m.namespace=u,m.useColors=t.useColors(),m.color=t.selectColor(u),m.extend=n,m.destroy=t.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(h!==t.namespaces&&(h=t.namespaces,p=t.enabled(u)),p),set:w=>{d=w}}),typeof t.init=="function"&&t.init(m),m}function n(u,f){let d=t(this.namespace+(typeof f=="undefined"?":":f)+u);return d.log=this.log,d}function i(u){t.save(u),t.namespaces=u,t.names=[],t.skips=[];let f=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of f)d[0]==="-"?t.skips.push(d.slice(1)):t.names.push(d)}function s(u,f){let d=0,h=0,p=-1,m=0;for(;d<u.length;)if(h<f.length&&(f[h]===u[d]||f[h]==="*"))f[h]==="*"?(p=h,m=d,h++):(d++,h++);else if(p!==-1)h=p+1,m++,d=m;else return!1;for(;h<f.length&&f[h]==="*";)h++;return h===f.length}function o(){let u=[...t.names,...t.skips.map(f=>"-"+f)].join(",");return t.enable(""),u}function a(u){for(let f of t.skips)if(s(u,f))return!1;for(let f of t.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 t.enable(t.load()),t}jT.exports=qG});var Nh=G((nn,Lh)=>{g();nn.formatArgs=KG;nn.save=ZG;nn.load=XG;nn.useColors=YG;nn.storage=QG();nn.destroy=(()=>{let r=!1;return()=>{r||(r=!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`."))}})();nn.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 YG(){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 r;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&&(r=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(r[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function KG(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Lh.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(t++,i==="%c"&&(n=t))}),r.splice(n,0,e)}nn.log=console.debug||console.log||(()=>{});function ZG(r){try{r?nn.storage.setItem("debug",r):nn.storage.removeItem("debug")}catch(e){}}function XG(){let r;try{r=nn.storage.getItem("debug")||nn.storage.getItem("DEBUG")}catch(e){}return!r&&typeof process!="undefined"&&"env"in process&&(r=process.env.DEBUG),r}function QG(){try{return localStorage}catch(r){}}Lh.exports=zT()(nn);var{formatters:JG}=Lh.exports;JG.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var VT=G(Sn=>{"use strict";g();var eU=Sn&&Sn.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Sn,"__esModule",{value:!0});var tU=require("fs"),rU=eU(Nh()),Xl=rU.default("@kwsites/file-exists");function nU(r,e,t){Xl("checking %s",r);try{let n=tU.statSync(r);return n.isFile()&&e?(Xl("[OK] path represents a file"),!0):n.isDirectory()&&t?(Xl("[OK] path represents a directory"),!0):(Xl("[FAIL] path represents something other than a file or directory"),!1)}catch(n){if(n.code==="ENOENT")return Xl("[FAIL] path is not accessible: %o",n),!1;throw Xl("[FATAL] %o",n),n}}function iU(r,e=Sn.READABLE){return nU(r,(e&Sn.FILE)>0,(e&Sn.FOLDER)>0)}Sn.exists=iU;Sn.FILE=1;Sn.FOLDER=2;Sn.READABLE=Sn.FILE+Sn.FOLDER});var WT=G(Bh=>{"use strict";g();function sU(r){for(var e in r)Bh.hasOwnProperty(e)||(Bh[e]=r[e])}Object.defineProperty(Bh,"__esModule",{value:!0});sU(VT())});var qT=G(da=>{"use strict";g();Object.defineProperty(da,"__esModule",{value:!0});da.createDeferred=da.deferred=void 0;function H0(){let r,e,t="pending";return{promise:new Promise((i,s)=>{r=i,e=s}),done(i){t==="pending"&&(t="resolved",r(i))},fail(i){t==="pending"&&(t="rejected",e(i))},get fulfilled(){return t!=="pending"},get status(){return t}}}da.deferred=H0;da.createDeferred=H0;da.default=H0});var WP=G(dy=>{g();(function(r){var e=/\S/,t=/\"/g,n=/\n/g,i=/\r/g,s=/\\/g,o=/\u2028/,a=/\u2029/;r.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},r.scan=function(x,E){var k=x.length,$=0,M=1,D=2,P=$,F=null,_e=null,Q="",oe=[],fe=!1,Z=0,Y=0,J="{{",U="}}";function et(){Q.length>0&&(oe.push({tag:"_t",text:new String(Q)}),Q="")}function se(){for(var j=!0,Ce=Y;Ce<oe.length;Ce++)if(j=r.tags[oe[Ce].tag]<r.tags._v||oe[Ce].tag=="_t"&&oe[Ce].text.match(e)===null,!j)return!1;return j}function vt(j,Ce){if(et(),j&&se())for(var z=Y,we;z<oe.length;z++)oe[z].text&&((we=oe[z+1])&&we.tag==">"&&(we.indent=oe[z].text.toString()),oe.splice(z,1));else Ce||oe.push({tag:`
`});fe=!1,Y=oe.length}function tt(j,Ce){var z="="+U,we=j.indexOf(z,Ce),ee=c(j.substring(j.indexOf("=",Ce)+1,we)).split(" ");return J=ee[0],U=ee[ee.length-1],we+z.length-1}for(E&&(E=E.split(" "),J=E[0],U=E[1]),Z=0;Z<k;Z++)P==$?u(J,x,Z)?(--Z,et(),P=M):x.charAt(Z)==`
`?vt(fe):Q+=x.charAt(Z):P==M?(Z+=J.length-1,_e=r.tags[x.charAt(Z+1)],F=_e?x.charAt(Z+1):"_v",F=="="?(Z=tt(x,Z),P=$):(_e&&Z++,P=D),fe=Z):u(U,x,Z)?(oe.push({tag:F,n:c(Q),otag:J,ctag:U,i:F=="/"?fe-J.length:Z+U.length}),Q="",Z+=U.length-1,P=$,F=="{"&&(U=="}}"?Z++:l(oe[oe.length-1]))):Q+=x.charAt(Z);return vt(fe,!0),oe};function l(b){b.n.substr(b.n.length-1)==="}"&&(b.n=b.n.substring(0,b.n.length-1))}function c(b){return b.trim?b.trim():b.replace(/^\s*|\s*$/g,"")}function u(b,x,E){if(x.charAt(E)!=b.charAt(0))return!1;for(var k=1,$=b.length;k<$;k++)if(x.charAt(E+k)!=b.charAt(k))return!1;return!0}var f={_t:!0,"\n":!0,$:!0,"/":!0};function d(b,x,E,k){var $=[],M=null,D=null,P=null;for(D=E[E.length-1];b.length>0;){if(P=b.shift(),D&&D.tag=="<"&&!(P.tag in f))throw new Error("Illegal content in < super tag.");if(r.tags[P.tag]<=r.tags.$||h(P,k))E.push(P),P.nodes=d(b,P.tag,E,k);else if(P.tag=="/"){if(E.length===0)throw new Error("Closing tag without opener: /"+P.n);if(M=E.pop(),P.n!=M.n&&!p(P.n,M.n,k))throw new Error("Nesting error: "+M.n+" vs. "+P.n);return M.end=P.i,$}else P.tag==`
`&&(P.last=b.length==0||b[0].tag==`
`);$.push(P)}if(E.length>0)throw new Error("missing closing tag: "+E.pop().n);return $}function h(b,x){for(var E=0,k=x.length;E<k;E++)if(x[E].o==b.n)return b.tag="#",!0}function p(b,x,E){for(var k=0,$=E.length;k<$;k++)if(E[k].c==b&&E[k].o==x)return!0}function m(b){var x=[];for(var E in b)x.push('"'+v(E)+'": function(c,p,t,i) {'+b[E]+"}");return"{ "+x.join(",")+" }"}function w(b){var x=[];for(var E in b.partials)x.push('"'+v(E)+'":{name:"'+v(b.partials[E].name)+'", '+w(b.partials[E])+"}");return"partials: {"+x.join(",")+"}, subs: "+m(b.subs)}r.stringify=function(b,x,E){return"{code: function (c,p,i) { "+r.wrapMain(b.code)+" },"+w(b)+"}"};var y=0;r.generate=function(b,x,E){y=0;var k={code:"",subs:{},partials:{}};return r.walk(b,k),E.asString?this.stringify(k,x,E):this.makeTemplate(k,x,E)},r.wrapMain=function(b){return'var t=this;t.b(i=i||"");'+b+"return t.fl();"},r.template=r.Template,r.makeTemplate=function(b,x,E){var k=this.makePartials(b);return k.code=new Function("c","p","i",this.wrapMain(b.code)),new this.template(k,x,this,E)},r.makePartials=function(b){var x,E={subs:{},partials:b.partials,name:b.name};for(x in E.partials)E.partials[x]=this.makePartials(E.partials[x]);for(x in b.subs)E.subs[x]=new Function("c","p","t","i",b.subs[x]);return E};function v(b){return b.replace(s,"\\\\").replace(t,'\\"').replace(n,"\\n").replace(i,"\\r").replace(o,"\\u2028").replace(a,"\\u2029")}function A(b){return~b.indexOf(".")?"d":"f"}function C(b,x){var E="<"+(x.prefix||""),k=E+b.n+y++;return x.partials[k]={name:b.n,partials:{}},x.code+='t.b(t.rp("'+v(k)+'",c,p,"'+(b.indent||"")+'"));',k}r.codegen={"#":function(b,x){x.code+="if(t.s(t."+A(b.n)+'("'+v(b.n)+'",c,p,1),c,p,0,'+b.i+","+b.end+',"'+b.otag+" "+b.ctag+'")){t.rs(c,p,function(c,p,t){',r.walk(b.nodes,x),x.code+="});c.pop();}"},"^":function(b,x){x.code+="if(!t.s(t."+A(b.n)+'("'+v(b.n)+'",c,p,1),c,p,1,0,0,"")){',r.walk(b.nodes,x),x.code+="};"},">":C,"<":function(b,x){var E={partials:{},code:"",subs:{},inPartial:!0};r.walk(b.nodes,E);var k=x.partials[C(b,x)];k.subs=E.subs,k.partials=E.partials},$:function(b,x){var E={subs:{},code:"",partials:x.partials,prefix:b.n};r.walk(b.nodes,E),x.subs[b.n]=E.code,x.inPartial||(x.code+='t.sub("'+v(b.n)+'",c,p,i);')},"\n":function(b,x){x.code+=T('"\\n"'+(b.last?"":" + i"))},_v:function(b,x){x.code+="t.b(t.v(t."+A(b.n)+'("'+v(b.n)+'",c,p,0)));'},_t:function(b,x){x.code+=T('"'+v(b.text)+'"')},"{":S,"&":S};function S(b,x){x.code+="t.b(t.t(t."+A(b.n)+'("'+v(b.n)+'",c,p,0)));'}function T(b){return"t.b("+b+");"}r.walk=function(b,x){for(var E,k=0,$=b.length;k<$;k++)E=r.codegen[b[k].tag],E&&E(b[k],x);return x},r.parse=function(b,x,E){return E=E||{},d(b,"",[],E.sectionTags||[])},r.cache={},r.cacheKey=function(b,x){return[b,!!x.asString,!!x.disableLambda,x.delimiters,!!x.modelGet].join("||")},r.compile=function(b,x){x=x||{};var E=r.cacheKey(b,x),k=this.cache[E];if(k){var $=k.partials;for(var M in $)delete $[M].instance;return k}return k=this.generate(this.parse(this.scan(b,x.delimiters),b,x),b,x),this.cache[E]=k}})(typeof dy!="undefined"?dy:Hogan)});var qP=G(hy=>{g();var h9={};(function(r){r.Template=function(d,h,p,m){d=d||{},this.r=d.code||this.r,this.c=p,this.options=m||{},this.text=h||"",this.partials=d.partials||{},this.subs=d.subs||{},this.buf=""},r.Template.prototype={r:function(d,h,p){return""},v:u,t:c,render:function(h,p,m){return this.ri([h],p||{},m)},ri:function(d,h,p){return this.r(d,h,p)},ep:function(d,h){var p=this.partials[d],m=h[p.name];if(p.instance&&p.base==m)return p.instance;if(typeof m=="string"){if(!this.c)throw new Error("No compiler available.");m=this.c.compile(m,this.options)}if(!m)return null;if(this.partials[d].base=m,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);m=t(m,p.subs,p.partials,this.stackSubs,this.stackPartials,h.stackText)}return this.partials[d].instance=m,m},rp:function(d,h,p,m){var w=this.ep(d,p);return w?w.ri(h,p,m):""},rs:function(d,h,p){var m=d[d.length-1];if(!f(m)){p(d,h,this);return}for(var w=0;w<m.length;w++)d.push(m[w]),p(d,h,this),d.pop()},s:function(d,h,p,m,w,y,v){var A;return f(d)&&d.length===0?!1:(typeof d=="function"&&(d=this.ms(d,h,p,m,w,y,v)),A=!!d,!m&&A&&h&&h.push(typeof d=="object"?d:h[h.length-1]),A)},d:function(d,h,p,m){var w,y=d.split("."),v=this.f(y[0],h,p,m),A=this.options.modelGet,C=null;if(d==="."&&f(h[h.length-2]))v=h[h.length-1];else for(var S=1;S<y.length;S++)w=e(y[S],v,A),w!==void 0?(C=v,v=w):v="";return m&&!v?!1:(!m&&typeof v=="function"&&(h.push(C),v=this.mv(v,h,p),h.pop()),v)},f:function(d,h,p,m){for(var w=!1,y=null,v=!1,A=this.options.modelGet,C=h.length-1;C>=0;C--)if(y=h[C],w=e(d,y,A),w!==void 0){v=!0;break}return v?(!m&&typeof w=="function"&&(w=this.mv(w,h,p)),w):m?!1:""},ls:function(d,h,p,m,w,y){var v=this.options.delimiters;return this.options.delimiters=y,this.b(this.ct(c(d.call(h,w,p)),h,m)),this.options.delimiters=v,!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,m,w,y,v){var A,C=h[h.length-1],S=d.call(C);return typeof S=="function"?m?!0:(A=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(S,C,h,p,A.substring(w,y),v)):S},mv:function(d,h,p){var m=h[h.length-1],w=d.call(m);return typeof w=="function"?this.ct(c(w.call(m)),m,p):w},sub:function(d,h,p,m){var w=this.subs[d];w&&(this.activeSub=d,w(h,p,this,m),this.activeSub=!1)}};function e(d,h,p){var m;return h&&typeof h=="object"&&(h[d]!==void 0?m=h[d]:p&&h.get&&typeof h.get=="function"&&(m=h.get(d))),m}function t(d,h,p,m,w,y){function v(){}v.prototype=d;function A(){}A.prototype=d.subs;var C,S=new v;S.subs=new A,S.subsText={},S.buf="",m=m||{},S.stackSubs=m,S.subsText=y;for(C in h)m[C]||(m[C]=h[C]);for(C in m)S.subs[C]=m[C];w=w||{},S.stackPartials=w;for(C in p)w[C]||(w[C]=p[C]);for(C in w)S.partials[C]=w[C];return S}var n=/&/g,i=/</g,s=/>/g,o=/\'/g,a=/\"/g,l=/[&<>\"\']/;function c(d){return String(d==null?"":d)}function u(d){return d=c(d),l.test(d)?d.replace(n,"&amp;").replace(i,"&lt;").replace(s,"&gt;").replace(o,"&#39;").replace(a,"&quot;"):d}var f=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"}})(typeof hy!="undefined"?hy:h9)});var py=G((NQ,YP)=>{g();var Up=WP();Up.Template=qP().Template;Up.template=Up.Template;YP.exports=Up});var XP=G(ri=>{"use strict";g();Object.defineProperty(ri,"__esModule",{value:!0});ri.ColorSchemeType=ri.DiffStyleType=ri.LineMatchingType=ri.OutputFormatType=ri.LineType=void 0;var KP;(function(r){r.INSERT="insert",r.DELETE="delete",r.CONTEXT="context"})(KP||(ri.LineType=KP={}));ri.OutputFormatType={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"};ri.LineMatchingType={LINES:"lines",WORDS:"words",NONE:"none"};ri.DiffStyleType={WORD:"word",CHAR:"char"};var ZP;(function(r){r.AUTO="auto",r.DARK="dark",r.LIGHT="light"})(ZP||(ri.ColorSchemeType=ZP={}))});var VV={};YO(VV,{default:()=>ig});module.exports=KO(VV);g();g();var yv=nt(Qg(),1),xA=nt(Jg(),1),na=nt(ew(),1),EA=nt(rw(),1),ph=nt(Lw(),1),yu=nt(Nw(),1),SA=nt(Vw(),1),kA=nt(Yk(),1),Me=class r extends Error{constructor(e){super(e),this.caller=""}toJSON(){let e=this;return{code:e.code,data:e.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){let t=new r(e.message),n=t;return n.code=e.code,n.data=e.data,t.caller=e.caller,t.stack=e.stack,t}get isIsomorphicGitError(){return!0}},_u=class r extends Me{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=r.code,this.data={filepaths:e}}};_u.code="UnmergedPathsError";var be=class r extends Me{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=r.code,this.data={message:e}}};be.code="InternalError";var ia=class r extends Me{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=r.code,this.data={filepath:e}}};ia.code="UnsafeFilepathError";var Kn=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 t=this.buffer.slice(this._start,this._start+e);return this._start+=e,t}toString(e,t){let n=this.buffer.toString(e,this._start,this._start+t);return this._start+=t,n}write(e,t,n){let i=this.buffer.write(e,this._start,t,n);return this._start+=t,i}copy(e,t,n){let i=e.copy(this.buffer,this._start,t,n);return this._start+=i,i}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let t=this.buffer.writeUInt8(e,this._start);return this._start+=1,t}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let t=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,t}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let t=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,t}},Kk=/[\ud800-￿]/;function Zk(r,e,t){if(t<55296||t>57343)return!1;if(t<56320){let i=e+1<r.length?r.charCodeAt(e+1):0;return i<56320||i>57343}let n=e>0?r.charCodeAt(e-1):0;return n<55296||n>56319}function mh(r,e){if(!Kk.test(r)&&!Kk.test(e))return-(r<e)||+(r>e);let t=Math.min(r.length,e.length);for(let n=0;n<t;n++){let i=r.charCodeAt(n),s=e.charCodeAt(n);if(i!==s){if(Zk(r,n,i)&&(i=65533),Zk(e,n,s)&&(s=65533),i===s)continue;return i>=55296&&s>=55296&&(i+=i>=57344?-2048:8192,s+=s>=57344?-2048:8192),i<s?-1:1}}return r.length<e.length?-1:r.length>e.length?1:0}function AA(r,e){return mh(r.path,e.path)}function CA(r){let e=r>0?r>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let t=r&511;return t&73?t=493:t=420,e!==8&&(t=0),(e<<12)+t}var qi=2**32;function Xk(r,e,t,n){if(r!==void 0&&e!==void 0)return[r,e];t===void 0&&(t=n.valueOf());let i=Math.floor(t/1e3),s=Math.floor((t-i*1e3)*1e6);return[i,s]}function ao(r){let[e,t]=Xk(r.ctimeSeconds,r.ctimeNanoseconds,r.ctimeMs,r.ctime),[n,i]=Xk(r.mtimeSeconds,r.mtimeNanoseconds,r.mtimeMs,r.mtime);return{ctimeSeconds:e%qi,ctimeNanoseconds:t%qi,mtimeSeconds:n%qi,mtimeNanoseconds:i%qi,dev:r.dev%qi,ino:r.ino%qi,mode:CA(r.mode%qi),uid:r.uid%qi,gid:r.gid%qi,size:r.size>-1?r.size%qi:0}}function NN(r){let e="";for(let t of new Uint8Array(r))t<16&&(e+="0"),e+=t.toString(16);return e}var Ww=null;async function mi(r){return Ww===null&&(Ww=await HN()),Ww?TA(r):BN(r)}function BN(r){return new yv.default().update(r).digest("hex")}async function TA(r){let e=await crypto.subtle.digest("SHA-1",r);return NN(e)}async function HN(){try{return await TA(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(r){}return!1}function GN(r){return{assumeValid:!!(r&32768),extended:!!(r&16384),stage:(r&12288)>>12,nameLength:r&4095,skipWorktree:!1,intentToAdd:!1}}var rv=16384,nv=8192;function iv(r){return!!(r.flags.skipWorktree||r.flags.intentToAdd)}function UN(r){let e=r.flags;return e.extended=iv(r),e.nameLength=Math.min(_.from(r.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}function jN(r){return(r.flags.skipWorktree?rv:0)+(r.flags.intentToAdd?nv:0)}var sv=class r{constructor(e,t){this._dirty=!1,this._unmergedPaths=t||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let t=this._entries.get(e.path);t||(this._entries.set(e.path,e),t=e),t.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(_.isBuffer(e))return r.fromBuffer(e);if(e===null)return new r(null);throw new be("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new be("Index file is empty (.git/index)");let t=new r,n=new Kn(e),i=n.toString("utf8",4);if(i!=="DIRC")throw new be(`Invalid dircache magic file number: ${i}`);let s=await mi(e.slice(0,-20)),o=e.slice(-20).toString("hex");if(o!==s)throw new be(`Invalid checksum in GitIndex buffer: expected ${o} but saw ${s}`);let a=n.readUInt32BE();if(a!==2&&a!==3)throw new be(`Unsupported dircache version: ${a}`);let l=n.readUInt32BE(),c=0;for(;!n.eof()&&c<l;){let u={};u.ctimeSeconds=n.readUInt32BE(),u.ctimeNanoseconds=n.readUInt32BE(),u.mtimeSeconds=n.readUInt32BE(),u.mtimeNanoseconds=n.readUInt32BE(),u.dev=n.readUInt32BE(),u.ino=n.readUInt32BE(),u.mode=n.readUInt32BE(),u.uid=n.readUInt32BE(),u.gid=n.readUInt32BE(),u.size=n.readUInt32BE(),u.oid=n.slice(20).toString("hex");let f=n.readUInt16BE();if(u.flags=GN(f),u.flags.extended){let p=n.readUInt16BE();if(p&~(rv|nv))throw new be(`Unknown index entry format: 0x${p.toString(16)}`);u.flags.skipWorktree=!!(p&rv),u.flags.intentToAdd=!!(p&nv)}let d=e.indexOf(0,n.tell()+1)-n.tell();if(d<1)throw new be(`Got a path length of: ${d}`);if(u.path=n.toString("utf8",d),u.path.includes("..\\")||u.path.includes("../"))throw new ia(u.path);let h=8-(n.tell()-12)%8;for(h===0&&(h=8);h--;){let p=n.readUInt8();if(p!==0)throw new be(`Expected 1-8 null characters but got '${p}' after ${u.path}`);if(n.eof())throw new be("Unexpected end of file")}u.stages=[],t._addEntry(u),c++}return t}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(AA)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(t=>t):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:t,oid:n,stage:i=0}){t||(t={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),t=ao(t);let s=_.from(e),o=i===0?this._entries.get(e):void 0,a={ctimeSeconds:t.ctimeSeconds,ctimeNanoseconds:t.ctimeNanoseconds,mtimeSeconds:t.mtimeSeconds,mtimeNanoseconds:t.mtimeNanoseconds,dev:t.dev,ino:t.ino,mode:t.mode||33188,uid:t.uid,gid:t.gid,size:t.size,path:e,oid:n,flags:{assumeValid:!1,extended:!1,stage:i,nameLength:s.length<4095?s.length:4095,skipWorktree:!!(o!=null&&o.flags.skipWorktree),intentToAdd:!1},stages:[]};this._addEntry(a),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let t of this._entries.keys())t.startsWith(e+"/")&&this._entries.delete(t);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(`
`)}static async _entryToBuffer(e){let t=_.from(e.path),n=iv(e),i=Math.ceil((62+(n?2:0)+t.length+1)/8)*8,s=_.alloc(i),o=new Kn(s),a=ao(e);return o.writeUInt32BE(a.ctimeSeconds),o.writeUInt32BE(a.ctimeNanoseconds),o.writeUInt32BE(a.mtimeSeconds),o.writeUInt32BE(a.mtimeNanoseconds),o.writeUInt32BE(a.dev),o.writeUInt32BE(a.ino),o.writeUInt32BE(a.mode),o.writeUInt32BE(a.uid),o.writeUInt32BE(a.gid),o.writeUInt32BE(a.size),o.write(e.oid,20,"hex"),o.writeUInt16BE(UN(e)),n&&o.writeUInt16BE(jN(e)),o.write(e.path,t.length,"utf8"),s}async toObject(){let e=_.alloc(12),t=new Kn(e);t.write("DIRC",4,"utf8"),t.writeUInt32BE(this.entriesFlat.some(iv)?3:2),t.writeUInt32BE(this.entriesFlat.length);let n=[];for(let a of this.entries)if(n.push(r._entryToBuffer(a)),a.stages.length>1)for(let l of a.stages)l&&l!==a&&n.push(r._entryToBuffer(l));n=await Promise.all(n);let i=_.concat(n),s=_.concat([e,i]),o=await mi(s);return _.concat([s,_.from(o,"hex")])}};function nh(r,e,t=!0,n=!0){let i=ao(r),s=ao(e);return t&&i.mode!==s.mode||i.mtimeSeconds!==s.mtimeSeconds||i.mtimeNanoseconds!==s.mtimeNanoseconds||i.ctimeSeconds!==s.ctimeSeconds||i.ctimeNanoseconds!==s.ctimeNanoseconds||i.uid!==s.uid||i.gid!==s.gid||n&&i.ino!==s.ino||i.size!==s.size}var qw;function zN(){return qw===void 0&&(qw=new xA.default({maxPending:1/0})),qw}function ir(r,e){return zN().acquire(r,e)}var Yw=Symbol("IndexCache");function VN(){return{map:new Map,stats:new Map}}async function WN(r,e,t){let[n,i]=await Promise.all([r.lstat(e),r.read(e)]),s=await sv.from(i);t.map.set(e,s),t.stats.set(e,n)}async function qN(r,e,t){let n=t.stats.get(e);if(n===void 0)return!0;if(n===null)return!1;let i=await r.lstat(e);if(i===null)return!1;if(nh(n,i))return!0;let s=ao(n),o=ao(i);return s.mtimeNanoseconds!==o.mtimeNanoseconds||s.ctimeNanoseconds!==o.ctimeNanoseconds}var Ct=class{static async acquire({fs:e,gitdir:t,cache:n,allowUnmerged:i=!0},s){n[Yw]||(n[Yw]=VN());let o=`${t}/index`,a,l=[];return await ir(o,async()=>{let c=n[Yw];await qN(e,o,c)&&await WN(e,o,c);let u=c.map.get(o);if(l=u.unmergedPaths,l.length&&!i)throw new _u(l);if(a=await s(u),u._dirty){let f=await u.toObject();await e.write(o,f),c.stats.set(o,await e.lstat(o)),u._dirty=!1}}),a}};function ih(r){let e=Math.max(r.lastIndexOf("/"),r.lastIndexOf("\\"));return e>-1&&(r=r.slice(e+1)),r}function sa(r){let e=Math.max(r.lastIndexOf("/"),r.lastIndexOf("\\"));return e===-1?".":e===0?"/":r.slice(0,e)}function RA(r){let e=new Map,t=function(i){if(!e.has(i)){let s={type:"tree",fullpath:i,basename:ih(i),metadata:{},children:[]};e.set(i,s),s.parent=t(sa(i)),s.parent&&s.parent!==s&&s.parent.children.push(s)}return e.get(i)},n=function(i,s){if(!e.has(i)){let o={type:"blob",fullpath:i,basename:ih(i),metadata:s,parent:t(sa(i)),children:[]};o.parent&&o.parent.children.push(o),e.set(i,o)}return e.get(i)};t(".");for(let i of r)n(i.path,i);return e}function YN(r){switch(r){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new be(`Unexpected GitTree entry mode: ${r.toString(8)}`)}var ov=class{constructor({fs:e,gitdir:t,cache:n}){this.treePromise=Ct.acquire({fs:e,gitdir:t,cache:n},async function(s){return RA(s.entries)});let i=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(e){let t=e._fullpath,i=(await this.treePromise).get(t);if(!i||i.type==="blob")return null;if(i.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${t}'`);let s=i.children.map(o=>o.fullpath);return s.sort(mh),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 n=(await this.treePromise).get(e._fullpath);if(!n)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=n.type==="tree"?{}:ao(n.metadata);e._type=n.type==="tree"?"tree":YN(i.mode),e._mode=i.mode,n.type==="tree"?e._stat=void 0:e._stat=i}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let n=(await this.treePromise).get(e._fullpath);e._oid=n.metadata.oid}return e._oid}},gh=Symbol("GitWalkSymbol");function lo(){let r=Object.create(null);return Object.defineProperty(r,gh,{value:function({fs:e,gitdir:t,cache:n}){return new ov({fs:e,gitdir:t,cache:n})}}),Object.freeze(r),r}var Be=class r extends Me{constructor(e){super(`Could not find ${e}.`),this.code=this.name=r.code,this.data={what:e}}};Be.code="NotFoundError";var sr=class r extends Me{constructor(e,t,n,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${n} but it is a ${t}.`),this.code=this.name=r.code,this.data={oid:e,actual:t,expected:n,filepath:i}}};sr.code="ObjectTypeError";var co=class r extends Me{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=r.code,this.data={value:e}}};co.code="InvalidOidError";var _n=class r extends Me{constructor(e,t){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${t}".)`),this.code=this.name=r.code,this.data={ref:e,suggestion:t}}};_n.code="InvalidRefNameError";var xu=class r extends Me{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=r.code,this.data={remote:e}}};xu.code="NoRefspecError";var sh=class r{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let t=null;this.parsedConfig=e.trim().split(`
`).map(n=>{if(/^\s*#/.test(n))return{line:n,comment:!0};let i=n.indexOf(" ");if(n.startsWith("^")){let s=n.slice(1);return this.refs.set(t+"^{}",s),{line:n,ref:t,peeled:s}}else{let s=n.slice(0,i);return t=n.slice(i+1),this.refs.set(t,s),{line:n,ref:t,oid:s}}})}return this}static from(e){return new r(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(t=>t.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(`
`)+`
`}},oh=class r{constructor({remotePath:e,localPath:t,force:n,matchPrefix:i}){Object.assign(this,{remotePath:e,localPath:t,force:n,matchPrefix:i})}static from(e){let[t,n,i,s,o]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),a=t==="+",l=i==="*";if(l!==(o==="*"))throw new be("Invalid refspec");return new r({remotePath:n,localPath:s,force:a,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}},av=class r{constructor(e=[]){this.rules=e}static from(e){let t=[];for(let n of e)t.push(oh.from(n));return new r(t)}add(e){let t=oh.from(e);this.rules.push(t)}translate(e){let t=[];for(let n of this.rules)for(let i of e){let s=n.translate(i);s&&t.push([i,s])}return t}translateOne(e){let t=null;for(let n of this.rules){let i=n.translate(e);i&&(t=i)}return t}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function KN(r,e){let t=r.replace(/\^\{\}$/,""),n=e.replace(/\^\{\}$/,""),i=-(t<n)||+(t>n);return i===0?r.endsWith("^{}")?1:-1:i}var ZN=/(^|[/.])([/.]|$)|^@$|@{|[\x00-\x20\x7f~^:?*[\\]|\.lock(\/|$)/;function Al(r,e){if(typeof r!="string")throw new TypeError("Reference name must be a string");return!ZN.test(r)&&(!!e||r.includes("/"))}function XN(r,e){let t="",n=0,i=-1,s=0,o="\0";for(let a=0;a<=r.length;++a){if(a<r.length)o=r[a];else{if(o==="/")break;o="/"}if(o==="/"){if(!(i===a-1||s===1))if(s===2){if(t.length<2||n!==2||t.at(-1)!=="."||t.at(-2)!=="."){if(t.length>2){let l=t.lastIndexOf("/");l===-1?(t="",n=0):(t=t.slice(0,l),n=t.length-1-t.lastIndexOf("/")),i=a,s=0;continue}else if(t.length!==0){t="",n=0,i=a,s=0;continue}}e&&(t+=t.length>0?"/..":"..",n=2)}else t.length>0?t+="/"+r.slice(i+1,a):t=r.slice(i+1,a),n=a-i-1;i=a,s=0}else o==="."&&s!==-1?++s:s=-1}return t}function QN(r){return r.length>=2&&/^[a-zA-Z]:/.test(r)?r.slice(0,2):null}function JN(r){if(!r.length)return".";r=r.replace(/\\/g,"/");let e=QN(r),t=r[0]==="/"||e!==null&&r[2]==="/",n=r.at(-1)==="/",i=e?r.slice(2):r,s=XN(i,!t);if(!s.length){let o=e?t?e+"/":e:t?"/":".";return n&&!t?o+"/":o}return n&&(s+="/"),e?t?`${e}/${s}`:`${e}${s}`:t?`/${s}`:s}function B(...r){if(r.length===0)return".";let e;for(let t=0;t<r.length;++t){let n=r[t].replace(/\\/g,"/");n.length!==0&&(/^[a-zA-Z]:\//.test(n)||e===void 0?e=n:e+="/"+n)}return e===void 0?".":JN(e)}var eB=r=>{if(typeof r=="number")return r;r=r.toLowerCase();let e=parseInt(r);return r.endsWith("k")&&(e*=1024),r.endsWith("m")&&(e*=1024*1024),r.endsWith("g")&&(e*=1024*1024*1024),e},wu=r=>{if(typeof r=="boolean")return r;if(r=r.trim().toLowerCase(),r==="true"||r==="yes"||r==="on")return!0;if(r==="false"||r==="no"||r==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${r}`)},Qk={core:{filemode:wu,bare:wu,logallrefupdates:wu,symlinks:wu,ignorecase:wu,bigFileThreshold:eB}},tB=/^\[([A-Za-z0-9-.]+)(?:[ \t]+"((?:[^"\\]|\\.)*)")?\][ \t]*(?:[#;].*)?$/,rB=/^[A-Za-z0-9-.]+$/,nB=/^([A-Za-z][A-Za-z0-9-]*)(?:\s*=\s*(.*))?$/,iB=/^[A-Za-z][A-Za-z0-9-]*$/,sB=r=>{let e=tB.exec(r);if(e!=null){let[t,n]=e.slice(1);return[t,n&&n.replace(/\\(.)/g,"$1")]}return null},oB=r=>{let e=nB.exec(r);if(e!=null){let[t,n="true"]=e.slice(1);return[t,aB(n)]}return null},Jk=new Map([["t"," "],["b","\b"],["n",`
`],["\\","\\"],['"','"']]),aB=r=>{let e="",t="",n=!1;for(let i=0;i<r.length;i++){let s=r[i];if(!n&&/[ \t\r\v\f]/.test(s)){e!==""&&(t+=s);continue}if(!n&&(s==="#"||s===";"))break;e+=t,t="",s==="\\"&&Jk.has(r[i+1])?e+=Jk.get(r[++i]):s==='"'?n=!n:e+=s}return e},lB=r=>{if(typeof r!="string")return r;let e=r.startsWith(" ")||r.endsWith(" ")||/[#;]/.test(r)?'"':"",t=r.replace(/[\\"\n\t]/g,n=>n===`
`?"\\n":n===" "?"\\t":`\\${n}`);return`${e}${t}${e}`},eA=r=>r!=null?r.toLowerCase():null,lv=(r,e,t)=>[eA(r),e,eA(t)].filter(n=>n!=null).join("."),tA=r=>{let e=r.split("."),t=e.shift(),n=e.pop(),i=e.length?e.join("."):void 0;return{section:t,subsection:i,name:n,path:lv(t,i,n),sectionPath:lv(t,i,null),isSection:!!t}},cB=(r,e)=>r.reduce((t,n,i)=>e(n)?i:t,-1),cv=class r{constructor(e){let t=null,n=null;this.parsedConfig=e?e.split(`
`).map(i=>{let s=null,o=null,a=i.trim(),l=sB(a),c=l!=null;if(c)[t,n]=l;else{let f=oB(a);f!=null&&([s,o]=f)}let u=lv(t,n,s);return{line:i,isSection:c,section:t,subsection:n,name:s,value:o,path:u}}):[]}static from(e){return new r(e)}async get(e,t=!1){let n=tA(e).path,i=this.parsedConfig.filter(s=>s.path===n).map(({section:s,name:o,value:a})=>{let l=Qk[s]&&Qk[s][o];return l?l(a):a});return t?i:i.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(t=>t.isSection&&t.section===e).map(t=>t.subsection)}async deleteSection(e,t){this.parsedConfig=this.parsedConfig.filter(n=>!(n.section===e&&n.subsection===t))}async append(e,t){return this.set(e,t,!0)}async set(e,t,n=!1){let{section:i,subsection:s,name:o,path:a,sectionPath:l,isSection:c}=tA(e),u=cB(this.parsedConfig,f=>f.path===a);if(t==null)u!==-1&&this.parsedConfig.splice(u,1);else if(u!==-1){let f=this.parsedConfig[u],d=Object.assign({},f,{name:o,value:t,modified:!0});n?this.parsedConfig.splice(u+1,0,d):this.parsedConfig[u]=d}else{let f=this.parsedConfig.findIndex(h=>h.path===l),d={section:i,subsection:s,name:o,value:t,modified:!0,path:a};if(rB.test(i)&&iB.test(o))if(f>=0)this.parsedConfig.splice(f+1,0,d);else{let h={isSection:c,section:i,subsection:s,modified:!0,path:l};this.parsedConfig.push(h,d)}}}toString(){return this.parsedConfig.map(({line:e,section:t,subsection:n,name:i,value:s,modified:o=!1})=>o?i!=null&&s!=null?` ${i} = ${lB(s)}`:n!=null?`[${t} "${n}"]`:`[${t}]`:e).join(`
`)}},Tt=class{static async get({fs:e,gitdir:t}){let n=await e.read(`${t}/config`,{encoding:"utf8"});return cv.from(n)}static async save({fs:e,gitdir:t,config:n}){await e.write(`${t}/config`,n.toString(),{encoding:"utf8"})}},vu=r=>[`${r}`,`refs/${r}`,`refs/tags/${r}`,`refs/heads/${r}`,`refs/remotes/${r}`,`refs/remotes/${r}/HEAD`],uv=["config","description","index","shallow","commondir"];function ta(r){if(uv.includes(r))throw new _n(r,`refs/heads/${r}`);if(!Al(r,!0))throw new _n(r,na.default.clean(r))}var q=class r{static async updateRemoteRefs({fs:e,gitdir:t,remote:n,refs:i,symrefs:s,tags:o,refspecs:a=void 0,prune:l=!1,pruneTags:c=!1}){for(let y of i.values())if(!y.match(/[0-9a-f]{40}/))throw new co(y);let u=await Tt.get({fs:e,gitdir:t});if(!a){if(a=await u.getall(`remote.${n}.fetch`),a.length===0)throw new xu(n);a.unshift(`+HEAD:refs/remotes/${n}/HEAD`)}let f=av.from(a),d=new Map,h=f.translate([...i.keys()]),p=[];for(let[y,v]of f.translate([...s.keys()])){let A=f.translateOne(s.get(y));A&&(ta(A),p.push([v,`ref: ${A}`]))}let m=o?[...i.keys()].filter(y=>y.startsWith("refs/tags")&&!y.endsWith("^{}")):[];for(let[,y]of h)ta(y);for(let[y]of p)ta(y);if(m.forEach(ta),c){let y=await r.listRefs({fs:e,gitdir:t,filepath:"refs/tags"});await r.deleteRefs({fs:e,gitdir:t,refs:y.map(v=>`refs/tags/${v}`)})}for(let y of m)if(!await r.exists({fs:e,gitdir:t,ref:y})){let v=i.get(y);d.set(y,v)}for(let[y,v]of h){let A=i.get(y);d.set(v,A)}for(let[y,v]of p)d.set(y,v);let w=[];if(l){for(let y of f.localNamespaces()){let v=(await r.listRefs({fs:e,gitdir:t,filepath:y})).map(A=>`${y}/${A}`);for(let A of v)d.has(A)||w.push(A)}w.length>0&&await r.deleteRefs({fs:e,gitdir:t,refs:w})}for(let[y,v]of d)await ir(y,async()=>e.write(B(t,y),`${v.trim()}
`,"utf8"));return{pruned:w}}static async writeRef({fs:e,gitdir:t,ref:n,value:i}){if(ta(n),!i.match(/[0-9a-f]{40}/))throw new co(i);await ir(n,async()=>e.write(B(t,n),`${i.trim()}
`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:t,ref:n,value:i}){ta(n),await ir(n,async()=>e.write(B(t,n),`ref: ${i.trim()}
`,"utf8"))}static async deleteRef({fs:e,gitdir:t,ref:n}){return r.deleteRefs({fs:e,gitdir:t,refs:[n]})}static async deleteRefs({fs:e,gitdir:t,refs:n}){n.forEach(ta),await Promise.all(n.map(a=>e.rm(B(t,a))));let i=await ir("packed-refs",async()=>e.read(`${t}/packed-refs`,{encoding:"utf8"})),s=sh.from(i),o=s.refs.size;for(let a of n)s.refs.has(a)&&s.delete(a);s.refs.size<o&&(i=s.toString(),await ir("packed-refs",async()=>e.write(`${t}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:t,ref:n,depth:i=void 0,visited:s=new Set}){if(i!==void 0&&(i--,i===-1))return n;if(n.startsWith("ref: "))return n=n.slice(5),r.resolve({fs:e,gitdir:t,ref:n,depth:i,visited:s});if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let o=await r.packedRefs({fs:e,gitdir:t}),a=vu(n).filter(l=>!uv.includes(l));for(let l of a){let c=await ir(l,async()=>await e.read(`${t}/${l}`,{encoding:"utf8"})||o.get(l));if(c){if(s.has(l))throw new be(`Circular reference detected while resolving ref "${l}"`);return s.add(l),r.resolve({fs:e,gitdir:t,ref:c.trim(),depth:i,visited:s})}}throw new Be(n)}static async isUnbornBranch({fs:e,gitdir:t,ref:n}){let i;try{i=await r.resolve({fs:e,gitdir:t,ref:"HEAD",depth:2})}catch(s){if(s instanceof Be)return!1;throw s}return i.startsWith("refs/heads/")?n==="HEAD"||vu(n).includes(i):!1}static async exists({fs:e,gitdir:t,ref:n}){try{return await r.expand({fs:e,gitdir:t,ref:n}),!0}catch(i){if(i instanceof Be)return!1;throw i}}static async expand({fs:e,gitdir:t,ref:n}){if(n.length===40&&/[0-9a-f]{40}/.test(n))return n;let i=await r.packedRefs({fs:e,gitdir:t}),s=vu(n).filter(o=>!uv.includes(o));for(let o of s)if(await ir(o,async()=>e.exists(`${t}/${o}`))||i.has(o))return o;throw new Be(n)}static async expandAgainstMap({ref:e,map:t}){let n=vu(e);for(let i of n)if(await t.has(i))return i;throw new Be(e)}static resolveAgainstMap({ref:e,fullref:t=e,depth:n=void 0,map:i}){if(n!==void 0&&(n--,n===-1))return{fullref:t,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),r.resolveAgainstMap({ref:e,fullref:t,depth:n,map:i});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:t,oid:e};let s=vu(e);for(let o of s){let a=i.get(o);if(a)return r.resolveAgainstMap({ref:a.trim(),fullref:o,depth:n,map:i})}throw new Be(e)}static async packedRefs({fs:e,gitdir:t}){let n=await ir("packed-refs",async()=>e.read(`${t}/packed-refs`,{encoding:"utf8"}));return sh.from(n).refs}static async listRefs({fs:e,gitdir:t,filepath:n}){let i=await r.packedRefs({fs:e,gitdir:t}),s=null;try{s=await e.readdirDeep(`${t}/${n}`),s=s.map(o=>o.replace(`${t}/${n}/`,""))}catch(o){s=[]}for(let o of i.keys())o.startsWith(n)&&(o=o.replace(n+"/",""),s.includes(o)||s.push(o));return s.sort(KN),s}static async listBranches({fs:e,gitdir:t,remote:n}){return n?r.listRefs({fs:e,gitdir:t,filepath:`refs/remotes/${n}`}):r.listRefs({fs:e,gitdir:t,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:t}){return(await r.listRefs({fs:e,gitdir:t,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}};function uB(r,e){return mh(rA(r),rA(e))}function rA(r){return r.mode==="040000"?r.path+"/":r.path}function $A(r){switch(r){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new be(`Unexpected GitTree entry mode: ${r}`)}function fB(r){let e=[],t=0;for(;t<r.length;){let n=r.indexOf(32,t);if(n===-1)throw new be(`GitTree: Error parsing buffer at byte location ${t}: Could not find the next space character.`);let i=r.indexOf(0,t);if(i===-1)throw new be(`GitTree: Error parsing buffer at byte location ${t}: Could not find the next null character.`);let s=r.slice(t,n).toString("utf8");s==="40000"&&(s="040000");let o=$A(s),a=r.slice(n+1,i).toString("utf8"),l=a.replace(/[\u200C-\u200F\u202A-\u202E\u206A-\u206F\uFEFF]/g,""),u=l.split(":")[0].toLowerCase().replace(/[. ]+$/,"");if(a.includes("\\")||a.includes("/")||l==="."||l===".."||u===".git"||/^\.?git~[1-9]$/.test(u))throw new ia(a);let f=r.slice(i+1,i+21).toString("hex");t=i+21,e.push({mode:s,path:a,oid:f,type:o})}return e}function dB(r){if(typeof r=="number"&&(r=r.toString(8)),r.match(/^0?4.*/))return"040000";if(r.match(/^1006.*/))return"100644";if(r.match(/^1007.*/))return"100755";if(r.match(/^120.*/))return"120000";if(r.match(/^160.*/))return"160000";throw new be(`Could not understand file mode: ${r}`)}function hB(r){return!r.oid&&r.sha&&(r.oid=r.sha),r.mode=dB(r.mode),r.type||(r.type=$A(r.mode)),r}var Zr=class r{constructor(e){if(_.isBuffer(e))this._entries=fB(e);else if(Array.isArray(e))this._entries=e.map(hB);else throw new be("invalid type passed to GitTree constructor");this._entries.sort(AA)}static from(e){return new r(e)}render(){return this._entries.map(e=>`${e.mode} ${e.type} ${e.oid} ${e.path}`).join(`
`)}toObject(){let e=[...this._entries];return e.sort(uB),_.concat(e.map(t=>{let n=_.from(t.mode.replace(/^0/,"")),i=_.from(" "),s=_.from(t.path,"utf8"),o=_.from([0]),a=_.from(t.oid,"hex");return _.concat([n,i,s,o,a])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},Ss=class{static wrap({type:e,object:t}){let n=`${e} ${t.length}\0`,i=n.length,s=i+t.length,o=new Uint8Array(s);for(let a=0;a<i;a++)o[a]=n.charCodeAt(a);return o.set(t,i),o}static unwrap(e){let t=e.indexOf(32),n=e.indexOf(0),i=e.slice(0,t).toString("utf8"),s=e.slice(t+1,n).toString("utf8"),o=e.length-(n+1);if(parseInt(s)!==o)throw new be(`Length mismatch: expected ${s} bytes but got ${o} instead.`);return{type:i,object:_.from(e.slice(n+1))}}};async function PA({fs:r,gitdir:e,oid:t}){let n=`objects/${t.slice(0,2)}/${t.slice(2)}`,i=await r.read(`${e}/${n}`);return i?{object:i,format:"deflated",source:n}:null}function IA(r,e){let t=new Kn(r),n=nA(t);if(n!==e.byteLength)throw new be(`applyDelta expected source buffer to be ${n} bytes but the provided buffer was ${e.length} bytes`);let i=nA(t),s,o=sA(t,e);if(o.byteLength===i)s=o;else{let a=[o],l=o.byteLength;for(;!t.eof();){let c=sA(t,e);a.push(c),l+=c.byteLength}if(i!==l)throw new be(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`);s=_.concat(a,i)}return s}function nA(r){let e=0,t=0,n=null;do n=r.readUInt8(),e|=(n&127)<<t,t+=7;while(n&128);return e}function iA(r,e,t){let n=0,i=0;for(;t--;)e&1&&(n|=r.readUInt8()<<i),e>>=1,i+=8;return n}function sA(r,e){let t=r.readUInt8(),n=128,i=15,s=112;if(t&n){let o=iA(r,t&i,4),a=iA(r,(t&s)>>4,3);return a===0&&(a=65536),e.slice(o,o+a)}else return r.slice(t)}function pB(r){let e=[r];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function OA(r){return r[Symbol.asyncIterator]?r[Symbol.asyncIterator]():r[Symbol.iterator]?r[Symbol.iterator]():r.next?r:pB(r)}var ah=class{constructor(e){if(typeof _=="undefined")throw new Error("Missing Buffer dependency");this.stream=OA(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:t}=await this.stream.next();return e&&(this._ended=!0,!t)?_.alloc(0):(t&&(t=_.from(t)),t)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let t=[this.buffer];for(;this.cursor+e>mB(t);){let n=await this._next();if(this._ended)break;t.push(n)}this.buffer=_.concat(t)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function mB(r){return r.reduce((e,t)=>e+t.length,0)}async function gB(r,e){let t=new ah(r),n=await t.read(4);if(n=n.toString("utf8"),n!=="PACK")throw new be(`Invalid PACK header '${n}'`);let i=await t.read(4);if(i=i.readUInt32BE(0),i!==2)throw new be(`Invalid packfile version: ${i}`);let s=await t.read(4);if(s=s.readUInt32BE(0),!(s<1))for(;!t.eof()&&s--;){let o=t.tell(),{type:a,length:l,ofs:c,reference:u}=await wB(t),f=new ph.default.Inflate;for(;!f.result;){let d=await t.chunk();if(!d)break;if(f.push(d,!1),f.err)throw new be(`Pako error: ${f.msg}`);if(f.result){if(f.result.length!==l)throw new be("Inflated object size is different from that stated in packfile.");await t.undo(),await t.read(d.length-f.strm.avail_in);let h=t.tell();await e({data:f.result,type:a,num:s,offset:o,end:h,reference:u,ofs:c})}}}}async function wB(r){let e=await r.byte(),t=e>>4&7,n=e&15;if(e&128){let o=4;do e=await r.byte(),n|=(e&127)<<o,o+=7;while(e&128)}let i,s;if(t===6){let o=0;i=0;let a=[];do e=await r.byte(),i|=(e&127)<<o,o+=7,a.push(e);while(e&128);s=_.from(a)}return t===7&&(s=await r.read(20)),{type:t,length:n,ofs:i,reference:s}}var Cl=class r extends Me{constructor(e){super(`Invalid compressed buffer: ${e}`),this.code=this.name=r.code,this.data={message:e}}};Cl.code="DecompressionError";async function vB(r){let e=new DecompressionStream("deflate"),t=new Blob([r]).stream().pipeThrough(e);try{return new Uint8Array(await new Response(t).arrayBuffer())}catch(n){throw n&&n.name==="TypeError"&&n.message===""?new Cl("decompression failed"):n}}var Kw=!1;async function FA(r){Kw===null&&(Kw=bB());try{return Kw?await vB(r):ph.default.inflate(r)}catch(e){throw typeof e=="string"?new Cl(e):e}}function bB(){try{if(new DecompressionStream("deflate"))return!0}catch(r){}return!1}function MA(r){let e=[],t=0,n=0;do{t=r.readUInt8();let i=t&127;e.push(i),n=t&128}while(n);return e.reduce((i,s)=>i+1<<7|s,-1)}function yB(r,e){let t=e,n=4,i=null;do i=r.readUInt8(),t|=(i&127)<<n,n+=7;while(i&128);return t}var _B=32*1024*1024,fv=class{constructor(e){this.maxBytes=e,this.bytes=0,this.map=new Map}get(e){let t=this.map.get(e);return t!==void 0&&(this.map.delete(e),this.map.set(e,t)),t}set(e,t){let n=t.object.byteLength;if(!(n>this.maxBytes/4)){this.map.set(e,t),this.bytes+=n;for(let[i,s]of this.map){if(this.bytes<=this.maxBytes)break;this.map.delete(i),this.bytes-=s.object.byteLength}}}};function xB({type:r,data:e,reference:t,offset:n},i,s){let o=_.from(e.buffer,e.byteOffset,e.byteLength);if(r!=="ofs-delta"&&r!=="ref-delta")return{type:r,object:o};let a=r==="ofs-delta"?n-MA(new Kn(t)):s.get(t.toString("hex")),l=i.get(a);if(!l)return null;try{return{type:l.type,object:_.from(IA(o,l.object))}}catch(c){if(c instanceof be||c instanceof RangeError)return null;throw c}}var Eu=class r{constructor(e){Object.assign(this,e),this.offsetCache={}}static async fromIdx({idx:e,getExternalRefDelta:t}){let n=new Kn(e);if(n.slice(4).toString("hex")!=="ff744f63")return;let s=n.readUInt32BE();if(s!==2)throw new be(`Unable to read version ${s} packfile IDX. (Only version 2 supported)`);if(e.byteLength>2048*1024*1024)throw new be("To keep implementation simple, I haven't implemented the layer 5 feature needed to support packfiles > 2GB in size.");n.seek(n.tell()+1020);let o=n.readUInt32BE(),a=[];for(let u=0;u<o;u++){let f=n.slice(20).toString("hex");a[u]=f}n.seek(n.tell()+4*o);let l=new Map;for(let u=0;u<o;u++)l.set(a[u],n.readUInt32BE());let c=n.slice(20).toString("hex");return new r({hashes:a,crcs:{},offsets:l,packfileSha:c,getExternalRefDelta:t})}static async fromPack({pack:e,getExternalRefDelta:t,onProgress:n}){let i={1:"commit",2:"tree",3:"blob",4:"tag",6:"ofs-delta",7:"ref-delta"},s={},o=e.slice(-20).toString("hex"),a=[],l={},c=new Map,u=null,f=null,d=new fv(_B),h=new Map;await gB([e],async({data:v,type:A,reference:C,offset:S,num:T})=>{u===null&&(u=T);let b=Math.floor((u-T)*100/u);b!==f&&n&&await n({phase:"Receiving objects",loaded:u-T,total:u}),f=b,A=i[A],["commit","tree","blob","tag"].includes(A)?s[S]={type:A,offset:S}:A==="ofs-delta"?s[S]={type:A,offset:S}:A==="ref-delta"&&(s[S]={type:A,offset:S});let x=s[S];if(!x)return;let E=xB({type:A,data:v,reference:C,offset:S},d,h);E&&(x.oid=await mi(Ss.wrap(E)),h.set(x.oid,S),d.set(S,E))});let p=Object.keys(s).map(Number);for(let[v,A]of p.entries()){let C=v+1===p.length?e.byteLength-20:p[v+1],S=s[A],T=EA.default.buf(e.slice(A,C))>>>0;S.end=C,S.crc=T}let m=new r({pack:Promise.resolve(e),packfileSha:o,crcs:l,hashes:a,offsets:c,getExternalRefDelta:t});f=null;let w=0,y=[0,0,0,0,0,0,0,0,0,0,0,0];for(let v in s){v=Number(v);let A=Math.floor(w*100/u);A!==f&&n&&await n({phase:"Resolving deltas",loaded:w,total:u}),w++,f=A;let C=s[v];if(!C.oid)try{m.readDepth=0,m.externalReadDepth=0;let{type:S,object:T}=await m.readSlice({start:v});y[m.readDepth]+=1,C.oid=await mi(Ss.wrap({type:S,object:T}))}catch(S){continue}a.push(C.oid),c.set(C.oid,v),l[C.oid]=C.crc}return a.sort(),m}async toBuffer(){let e=[],t=(c,u)=>{e.push(_.from(c,u))};t("ff744f63","hex"),t("00000002","hex");let n=new Kn(_.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++;n.writeUInt32BE(u)}e.push(n.buffer);for(let c of this.hashes)t(c,"hex");let i=new Kn(_.alloc(this.hashes.length*4));for(let c of this.hashes)i.writeUInt32BE(this.crcs[c]);e.push(i.buffer);let s=new Kn(_.alloc(this.hashes.length*4));for(let c of this.hashes)s.writeUInt32BE(this.offsets.get(c));e.push(s.buffer),t(this.packfileSha,"hex");let o=_.concat(e),a=await mi(o),l=_.alloc(20);return l.write(a,"hex"),_.concat([o,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 be(`Could not read object ${e} from packfile`)}let t=this.offsets.get(e);return this.readSlice({start:t})}async readSlice({start:e}){if(this.offsetCache[e])return Object.assign({},this.offsetCache[e]);this.readDepth++;let t={16:"commit",32:"tree",48:"blob",64:"tag",96:"ofs_delta",112:"ref_delta"},n=await this.pack;if(!n)throw new be("Could not read packfile data. The packfile may be missing, corrupted, or too large to read into memory.");let i=n.slice(e),s=new Kn(i),o=s.readUInt8(),a=o&112,l=t[a];if(l===void 0)throw new be("Unrecognized type: 0b"+a.toString(2));let c=o&15,u=c;o&128&&(u=yB(s,c));let d=null,h=null;if(l==="ofs_delta"){let m=MA(s),w=e-m;({object:d,type:l}=await this.readSlice({start:w}))}if(l==="ref_delta"){let m=s.slice(20).toString("hex");({object:d,type:l}=await this.read({oid:m}))}let p=i.slice(s.tell());if(h=_.from(await FA(p)),h.byteLength!==u)throw new be(`Packfile told us object would have length ${u} but it had length ${h.byteLength}`);return d&&(h=_.from(IA(h,d))),this.readDepth>3&&(this.offsetCache[e]={type:l,object:h}),{type:l,format:"content",object:h}}},Sl=Symbol("PackfileCache");async function EB({fs:r,filename:e,getExternalRefDelta:t,emitter:n,emitterPrefix:i}){let s=await r.read(e);return Eu.fromIdx({idx:s,getExternalRefDelta:t})}function _v({fs:r,cache:e,filename:t,getExternalRefDelta:n,emitter:i,emitterPrefix:s}){e[Sl]||(e[Sl]=new Map);let o=e[Sl].get(t);return o||(o=EB({fs:r,filename:t,getExternalRefDelta:n,emitter:i,emitterPrefix:s}),e[Sl].set(t,o),o.catch(()=>{e[Sl].get(t)===o&&e[Sl].delete(t)})),o}async function SB(r,{start:e=0,end:t=r.length}={}){return mi(r.subarray(e,t))}async function kB({fs:r,cache:e,gitdir:t,oid:n,format:i="content",getExternalRefDelta:s}){let o=await r.readdir(B(t,"objects/pack"));o=o.filter(a=>a.endsWith(".idx"));for(let a of o){let l=`${t}/objects/pack/${a}`,c=await _v({fs:r,cache:e,filename:l,getExternalRefDelta:s});if(c.error)throw new be(c.error);if(c.offsets.has(n)){let u=l.replace(/idx$/,"pack");if(!c.pack){let h=r.read(u);c.pack=h,h.catch(()=>{c.pack===h&&(c.pack=null)})}let f=await c.pack;if(!f)throw c.pack=null,new be(`Could not read packfile at ${u}. The file may be missing, corrupted, or too large to read into memory.`);c._checksumVerification||(c._checksumVerification=AB(f,c.packfileSha)),await c._checksumVerification;let d=await c.read({oid:n,getExternalRefDelta:s});return d.format="content",d.source=`objects/pack/${a.replace(/idx$/,"pack")}`,d}}return null}async function AB(r,e){let t=r.subarray(-20),n=Array.from(t).map(s=>s.toString(16).padStart(2,"0")).join("");if(n!==e)throw new be(`Packfile trailer mismatch: expected ${e}, got ${n}. The packfile may be corrupted.`);let i=await SB(r,{start:0,end:r.length-20});if(i!==e)throw new be(`Packfile payload corrupted: calculated ${i} but expected ${e}. The packfile may have been tampered with.`)}async function pt({fs:r,cache:e,gitdir:t,oid:n,format:i="content"}){if(!["deflated","wrapped","content"].includes(i))throw new be(`invalid requested format "${i}"`);let s=u=>pt({fs:r,cache:e,gitdir:t,oid:u}),o;if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904"&&(o={format:"wrapped",object:_.from("tree 0\0")}),o||(o=await PA({fs:r,gitdir:t,oid:n})),!o){if(o=await kB({fs:r,cache:e,gitdir:t,oid:n,getExternalRefDelta:s}),!o)throw new Be(n);return o}if(i==="deflated"||(o.format==="deflated"&&(o.object=_.from(await FA(o.object)),o.format="wrapped"),i==="wrapped"))return o;let a=await mi(o.object);if(a!==n)throw new be(`SHA check failed! Expected ${n}, computed ${a}`);let{object:l,type:c}=Ss.unwrap(o.object);return o.type=c,o.object=l,o.format="content",o}var wi=class r extends Me{constructor(e,t,n=!0){super(`Failed to create ${e} at ${t} because it already exists.${n?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=r.code,this.data={noun:e,where:t,canForce:n}}};wi.code="AlreadyExistsError";var Su=class r extends Me{constructor(e,t,n){super(`Found multiple ${e} matching "${t}" (${n.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=r.code,this.data={nouns:e,short:t,matches:n}}};Su.code="AmbiguousError";var ku=class r extends Me{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=r.code,this.data={filepaths:e}}};ku.code="CheckoutConflictError";var Au=class r extends Me{constructor(e){super(`Your local changes to the following files would be overwritten by cherry-pick: ${e.join(", ")}`),this.code=this.name=r.code,this.data={filepaths:e}}};Au.code="CherryPickLocalChangesError";var Cu=class r extends Me{constructor(e,t){super(`Cannot cherry-pick merge commit ${e}. Merge commits have ${t} parents and require specifying which parent to use as the base.`),this.code=this.name=r.code,this.data={oid:e,parentCount:t}}};Cu.code="CherryPickMergeCommitError";var Tu=class r extends Me{constructor(e){super(`Cannot cherry-pick root commit ${e}. Root commits have no parents.`),this.code=this.name=r.code,this.data={oid:e}}};Tu.code="CherryPickRootCommitError";var Tl=class r extends Me{constructor(e,t){super(`Failed to checkout "${e}" because commit ${t} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=r.code,this.data={ref:e,oid:t}}};Tl.code="CommitNotFetchedError";var Ru=class r extends Me{constructor(){super("Cannot create an empty commit when disallowEmpty is true."),this.code=this.name=r.code,this.data={}}};Ru.code="EmptyCommitError";var $u=class r extends Me{constructor(){super("Empty response from git server."),this.code=this.name=r.code,this.data={}}};$u.code="EmptyServerResponseError";var Pu=class r extends Me{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=r.code,this.data={}}};Pu.code="FastForwardError";var Iu=class r extends Me{constructor(e,t){super(`One or more branches were not updated: ${e}`),this.code=this.name=r.code,this.data={prettyDetails:e,result:t}}};Iu.code="GitPushError";var Rl=class r extends Me{constructor(e,t,n){super(`HTTP Error: ${e} ${t}`),this.code=this.name=r.code,this.data={statusCode:e,statusMessage:t,response:n}}};Rl.code="HttpError";var ks=class r extends Me{constructor(e){let t="invalid filepath";e==="leading-slash"||e==="trailing-slash"?t='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(t='"filepath" should not be a directory.'),super(t),this.code=this.name=r.code,this.data={reason:e}}};ks.code="InvalidFilepathError";var Ou=class r extends Me{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=r.code,this.data={depth:e}}};Ou.code="MaxDepthError";var $l=class r extends Me{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=r.code,this.data={}}};$l.code="MergeNotSupportedError";var oa=class r extends Me{constructor(e,t,n,i){super(`Automatic merge failed with one or more merge conflicts in the following files: ${e.toString()}. Fix conflicts then commit the result.`),this.code=this.name=r.code,this.data={filepaths:e,bothModified:t,deleteByUs:n,deleteByTheirs:i}}};oa.code="MergeConflictError";var gr=class r extends Me{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=r.code,this.data={role:e}}};gr.code="MissingNameError";var Kr=class r extends Me{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=r.code,this.data={parameter:e}}};Kr.code="MissingParameterError";var aa=class r extends Me{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=r.code,this.data={errors:e},this.errors=e}};aa.code="MultipleGitError";var gi=class r extends Me{constructor(e,t){super(`Expected "${e}" but received "${t}".`),this.code=this.name=r.code,this.data={expected:e,actual:t}}};gi.code="ParseError";var Pl=class r extends Me{constructor(e){let t="";e==="not-fast-forward"?t=" because it was not a simple fast-forward":e==="tag-exists"&&(t=" because tag already exists"),super(`Push rejected${t}. Use "force: true" to override.`),this.code=this.name=r.code,this.data={reason:e}}};Pl.code="PushRejectedError";var oo=class r extends Me{constructor(e,t){super(`Remote does not support the "${e}" so the "${t}" parameter cannot be used.`),this.code=this.name=r.code,this.data={capability:e,parameter:t}}};oo.code="RemoteCapabilityError";var Fu=class r extends Me{constructor(e,t){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${e}`),this.code=this.name=r.code,this.data={preview:e,response:t}}};Fu.code="SmartHttpError";var Mu=class r extends Me{constructor(e,t,n){super(`Git remote "${e}" uses an unrecognized transport protocol: "${t}"`),this.code=this.name=r.code,this.data={url:e,transport:t,suggestion:n}}};Mu.code="UnknownTransportError";var Du=class r extends Me{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=r.code,this.data={url:e}}};Du.code="UrlParseError";var Il=class r extends Me{constructor(){super("The operation was canceled."),this.code=this.name=r.code,this.data={}}};Il.code="UserCanceledError";var Lu=class r extends Me{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=r.code,this.data={filepath:e}}};Lu.code="IndexResetError";var Nu=class r extends Me{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=r.code,this.data={ref:e}}};Nu.code="NoCommitError";var Fr=Object.freeze({__proto__:null,AlreadyExistsError:wi,AmbiguousError:Su,CheckoutConflictError:ku,CherryPickLocalChangesError:Au,CherryPickMergeCommitError:Cu,CherryPickRootCommitError:Tu,CommitNotFetchedError:Tl,DecompressionError:Cl,EmptyCommitError:Ru,EmptyServerResponseError:$u,FastForwardError:Pu,GitPushError:Iu,HttpError:Rl,InternalError:be,InvalidFilepathError:ks,InvalidOidError:co,InvalidRefNameError:_n,MaxDepthError:Ou,MergeNotSupportedError:$l,MergeConflictError:oa,MissingNameError:gr,MissingParameterError:Kr,MultipleGitError:aa,NoRefspecError:xu,NotFoundError:Be,ObjectTypeError:sr,ParseError:gi,PushRejectedError:Pl,RemoteCapabilityError:oo,SmartHttpError:Fu,UnknownTransportError:Mu,UnsafeFilepathError:ia,UrlParseError:Du,UserCanceledError:Il,UnmergedPathsError:_u,IndexResetError:Lu,NoCommitError:Nu});function dv({name:r,email:e,timestamp:t,timezoneOffset:n}){return n=CB(n),`${r} <${e}> ${t} ${n}`}function CB(r){let e=TB(RB(r));r=Math.abs(r);let t=Math.floor(r/60);r-=t*60;let n=String(t),i=String(r);return n.length<2&&(n="0"+n),i.length<2&&(i="0"+i),(e===-1?"-":"+")+n+i}function TB(r){return Math.sign(r)||(Object.is(r,-0)?-1:1)}function RB(r){return r===0?r:-r}function Es(r){return r=r.replace(/\r/g,""),r=r.replace(/^\n+/,""),r=r.replace(/\n+$/,"")+`
`,r}function lh(r){let[,e,t,n,i]=r.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:t,timestamp:Number(n),timezoneOffset:$B(i)}}function $B(r){let[,e,t,n]=r.match(/(\+|-)(\d\d)(\d\d)/);return n=(e==="+"?1:-1)*(Number(t)*60+Number(n)),PB(n)}function PB(r){return r===0?r:-r}var Xr=class r{constructor(e){if(typeof e=="string")this._tag=e;else if(_.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=r.render(e);else throw new be("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new r(e)}static render(e){return`object ${e.object}
type ${e.type}
tag ${e.tag}
tagger ${dv(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(`
`),t=[];for(let s of e)s[0]===" "?t[t.length-1]+=`
`+s.slice(1):t.push(s);let n={},i=new Set;for(let s of t){let o=s.slice(0,s.indexOf(" ")),a=s.slice(s.indexOf(" ")+1);i.has(o)||(i.add(o),n[o]=a)}return n.tagger&&(n.tagger=lh(n.tagger)),n.committer&&(n.committer=lh(n.committer)),n}withoutSignature(){let e=Es(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 Es(e)}payload(){return this.withoutSignature()+`
`}toObject(){return _.from(this._tag,"utf8")}static async sign(e,t,n){let i=e.payload(),{signature:s}=await t({payload:i,secretKey:n});s=Es(s);let o=i+s;return r.from(o)}};function Zw(r){return r.trim().split(`
`).map(e=>" "+e).join(`
`)+`
`}function IB(r){return r.split(`
`).map(e=>e.replace(/^ /,"")).join(`
`)}var Qr=class r{constructor(e){if(typeof e=="string")this._commit=e;else if(_.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=r.render(e);else throw new be("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:t}){let n=r.justHeaders(e),i=r.justMessage(e),s=Es(n+`
gpgsig`+Zw(t)+`
`+i);return new r(s)}static from(e){return new r(e)}toObject(){return _.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return r.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Es(e.slice(e.indexOf(`
`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(`
`))}parseHeaders(){let e=r.justHeaders(this._commit).split(`
`),t=[];for(let l of e)l[0]===" "?t[t.length-1]+=`
`+l.slice(1):t.push(l);let n={parent:[]},i=l=>l.slice(0,l.indexOf(" ")),s=l=>l.slice(l.indexOf(" ")+1);if(t.length===0||i(t[0])!=="tree")throw new gi("tree as the first commit header",i(t[0]||""));n.tree=s(t[0]);let o=1;for(;o<t.length&&i(t[o])==="parent";)n.parent.push(s(t[o])),o++;let a=new Set(["tree","parent"]);for(;o<t.length;o++){let l=i(t[o]);a.has(l)||(a.add(l),n[l]=s(t[o]))}return n.author&&(n.author=lh(n.author)),n.committer&&(n.committer=lh(n.committer)),n}static renderHeaders(e){let t="";if(e.tree?t+=`tree ${e.tree}
`:t+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
`,e.parent){if(e.parent.length===void 0)throw new be("commit 'parent' property should be an array");for(let s of e.parent)t+=`parent ${s}
`}let n=e.author;t+=`author ${dv(n)}
`;let i=e.committer||e.author;return t+=`committer ${dv(i)}
`,e.gpgsig&&(t+="gpgsig"+Zw(e.gpgsig)),t}static render(e){return r.renderHeaders(e)+`
`+Es(e.message)}render(){return this._commit}withoutSignature(){let e=Es(this._commit);if(e.indexOf(`
gpgsig`)===-1)return e;let t=e.slice(0,e.indexOf(`
gpgsig`)),n=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
`)+28);return Es(t+`
`+n)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return IB(e)}static async sign(e,t,n){let i=e.withoutSignature(),s=r.justMessage(e._commit),{signature:o}=await t({payload:i,secretKey:n});o=Es(o);let l=r.justHeaders(e._commit)+`
gpgsig`+Zw(o)+`
`+s;return r.from(l)}};async function Ol({fs:r,cache:e,gitdir:t,oid:n}){if(n==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:Zr.from([]),oid:n};let{type:i,object:s}=await pt({fs:r,cache:e,gitdir:t,oid:n});if(i==="tag")return n=Xr.from(s).parse().object,Ol({fs:r,cache:e,gitdir:t,oid:n});if(i==="commit")return n=Qr.from(s).parse().tree,Ol({fs:r,cache:e,gitdir:t,oid:n});if(i!=="tree")throw new sr(n,i,"tree");return{tree:Zr.from(s),oid:n}}var hv=class{constructor({fs:e,gitdir:t,ref:n,cache:i}){this.fs=e,this.cache=i,this.gitdir=t,this.mapPromise=(async()=>{let o=new Map,a;try{a=await q.resolve({fs:e,gitdir:t,ref:n})}catch(c){if(c instanceof Be&&await q.isUnbornBranch({fs:e,gitdir:t,ref:n}))a="4b825dc642cb6eb9a060e54bf8d69288fbee4904";else throw c}let l=await Ol({fs:e,cache:this.cache,gitdir:t,oid:a});return l.type="tree",l.mode="40000",o.set(".",l),o})();let s=this;this.ConstructEntry=class{constructor(a){this._fullpath=a,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 t=e._fullpath,{fs:n,cache:i,gitdir:s}=this,o=await this.mapPromise,a=o.get(t);if(!a)throw new Error(`No obj for ${t}`);let l=a.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(a)}`);if(a.type!=="tree")return null;let{type:c,object:u}=await pt({fs:n,cache:i,gitdir:s,oid:l});if(c!==a.type)throw new sr(l,c,a.type);let f=Zr.from(u);for(let d of f)o.set(B(t,d.path),d);return f.entries().map(d=>B(t,d.path))}async type(e){if(e._type===!1){let t=await this.mapPromise,{type:n}=t.get(e._fullpath);e._type=n}return e._type}async mode(e){if(e._mode===!1){let t=await this.mapPromise,{mode:n}=t.get(e._fullpath);e._mode=CA(parseInt(n,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let t=await this.mapPromise,{fs:n,cache:i,gitdir:s}=this,a=t.get(e._fullpath).oid,{type:l,object:c}=await pt({fs:n,cache:i,gitdir:s,oid:a});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let n=(await this.mapPromise).get(e._fullpath);e._oid=n.oid}return e._oid}};function mr({ref:r="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,gh,{value:function({fs:t,gitdir:n,cache:i}){return new hv({fs:t,gitdir:n,ref:r,cache:i})}}),Object.freeze(e),e}var pv=class{constructor({fs:e,dir:t,gitdir:n,cache:i,refresh:s=!0}){this.fs=e,this.cache=i,this.dir=t,this.gitdir=n,this.refresh=s,this.refreshQueue=[],this.flushed=!1,this.config=null;let o=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 o.type(this)}async mode(){return o.mode(this)}async stat(){return o.stat(this)}async content(){return o.content(this)}async oid(){return o.oid(this)}}}async readdir(e){if(await e.type()!=="tree")return null;let t=e._fullpath,{fs:n,dir:i}=this,s=await n.readdir(B(i,t));return s===null?null:s.map(o=>B(t,o))}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:t,dir:n}=this,i=await t.lstat(`${n}/${e._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let s=i.isDirectory()?"tree":"blob";s==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(s="special"),e._type=s,i=ao(i),e._mode=i.mode,i.size===-1&&e._actualSize&&(i.size=e._actualSize),e._stat=i}return e._stat}async content(e){if(e._content===!1){let{fs:t,dir:n,gitdir:i}=this;if(await e.type()==="tree")e._content=void 0;else{let s;if(await e.mode()>>12===10)s=await t.readlink(`${n}/${e._fullpath}`);else{let a=await(await this._getGitConfig(t,i)).get("core.autocrlf");s=await t.read(`${n}/${e._fullpath}`,{autocrlf:a})}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 t=this,{fs:n,gitdir:i,cache:s}=this,o;await Ct.acquire({fs:n,gitdir:i,cache:s},async function(a){let l=a.entriesMap.get(e._fullpath),c=await e.stat(),f=await(await t._getGitConfig(n,i)).get("core.filemode"),d=typeof process!="undefined"?process.platform!=="win32":!0;if(!l||nh(c,l,f,d)){let h=await e.content();h===void 0?o=void 0:(o=await mi(Ss.wrap({type:"blob",object:h})),t.refresh&&l&&!l.flags.intentToAdd&&o===l.oid&&(!f||c.mode===l.mode)&&nh(c,l,f,d)&&(t.flushed?a.insert({filepath:e._fullpath,stats:c,oid:o}):t.refreshQueue.push({filepath:e._fullpath,stage:l,stats:c,oid:o})))}else o=l.oid}),e._oid=o}return e._oid}async flush(){let{fs:e,gitdir:t,cache:n,refreshQueue:i}=this;this.refreshQueue=[],this.flushed=!0,i.length!==0&&await Ct.acquire({fs:e,gitdir:t,cache:n},async s=>{for(let{filepath:o,stage:a,stats:l,oid:c}of i)s.entriesMap.get(o)===a&&s.insert({filepath:o,stats:l,oid:c})})}async _getGitConfig(e,t){return this.config?this.config:(this.config=await Tt.get({fs:e,gitdir:t}),this.config)}};function Dl({refresh:r=!0}={}){let e=Object.create(null);return Object.defineProperty(e,gh,{value:function({fs:t,dir:n,gitdir:i,cache:s}){return new pv({fs:t,dir:n,gitdir:i,cache:s,refresh:r})}}),Object.freeze(e),e}function OB(r,e){let t=e-r;return Array.from({length:t},(n,i)=>r+i)}var DA=typeof Array.prototype.flat=="undefined"?r=>r.reduce((e,t)=>e.concat(t),[]):r=>r.flat(),mv=class{constructor(){this.value=null}consider(e){e!=null&&(this.value===null?this.value=e:e<this.value&&(this.value=e))}reset(){this.value=null}};function*FB(r){let e=new mv,t,n=[],i=r.length;for(let s=0;s<i;s++)n[s]=r[s].next().value,n[s]!==void 0&&e.consider(n[s]);if(e.value!==null)for(;;){let s=[];t=e.value,e.reset();for(let o=0;o<i;o++)n[o]!==void 0&&n[o]===t?(s[o]=n[o],n[o]=r[o].next().value):s[o]=null,n[o]!==void 0&&e.consider(n[o]);if(yield s,e.value===null)return}}async function vi({fs:r,cache:e,dir:t,gitdir:n,trees:i,map:s=async(l,c)=>c,reduce:o=async(l,c)=>{let u=DA(c);return l!==void 0&&u.unshift(l),u},iterate:a=(l,c)=>Promise.all([...c].map(l))}){let l=i.map(p=>p[gh]({fs:r,dir:t,gitdir:n,cache:e})),c=new Array(l.length).fill("."),u=OB(0,l.length),f=async p=>{u.forEach(y=>{let v=p[y];p[y]=v&&new l[y].ConstructEntry(v)});let w=(await Promise.all(u.map(y=>{let v=p[y];return v?l[y].readdir(v):[]}))).map(y=>(y===null?[]:y)[Symbol.iterator]());return{entries:p,children:FB(w)}},d=async p=>{let{entries:m,children:w}=await f(p),y=m.find(A=>A&&A._fullpath)._fullpath,v=await s(y,m);if(v!==null){let A=await a(d,w);return A=A.filter(C=>C!==void 0),o(v,A)}},h=await d(c);for(let p of l)p.flush&&await p.flush();return h}async function LA(r,e,t=10){try{await r(e)}catch(n){if(n===null||n.code==="EEXIST")return;if(n.code!=="ENOENT")throw n;let i=sa(e);if(i==="."||i==="/"||i===e)throw n;await LA(r,i,t);for(let s=0;;s++)try{await r(e);return}catch(o){if(o===null||o.code==="EEXIST")return;if(o.code==="ENOENT"&&s<t){await new Promise(a=>setTimeout(a,0));continue}throw o}}}async function gv(r,e){let t=await r.readdir(e);t==null?await r.rm(e):t.length?await Promise.all(t.map(n=>{let i=B(e,n);return r.lstat(i).then(s=>{if(s)return s.isDirectory()?gv(r,i):r.rm(i)})})).then(()=>r.rmdir(e)):await r.rmdir(e)}function MB(r){return DB(r)&&oA(r.then)&&oA(r.catch)}function DB(r){return r&&typeof r=="object"}function oA(r){return typeof r=="function"}function bu(r){let e=r.code;return typeof e!="string"?!1:e==="ENOENT"||e==="ENOTDIR"||e.includes("ENS")}function aA(r){return MB((t=>{try{return t.readFile().catch(n=>n)}catch(n){return n}})(r))}var lA=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function cA(r,e){if(aA(e))for(let t of lA)r[`_${t}`]=e[t].bind(e);else for(let t of lA)r[`_${t}`]=(0,yu.default)(e[t].bind(e));aA(e)?(e.cp&&(r._cp=e.cp.bind(e)),e.rm?r._rm=e.rm.bind(e):e.rmdir.length>1?r._rm=e.rmdir.bind(e):r._rm=gv.bind(null,r)):(e.cp&&(r._cp=(0,yu.default)(e.cp.bind(e))),e.rm?r._rm=(0,yu.default)(e.rm.bind(e)):e.rmdir.length>2?r._rm=(0,yu.default)(e.rmdir.bind(e)):r._rm=gv.bind(null,r))}var re=class{constructor(e){if(typeof e._original_unwrapped_fs!="undefined")return e;let t=Object.getOwnPropertyDescriptor(e,"promises");t&&t.enumerable?cA(this,e.promises):cA(this,e),this._original_unwrapped_fs=e}async exists(e,t={}){try{return await this._stat(e),!0}catch(n){if(bu(n))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',n),n}}async read(e,t={}){let n;try{n=await this._readFile(e,t)}catch(i){if(bu(i)||i.code==="EISDIR")return null;throw i}if(n==null)return null;if(t.autocrlf==="true")try{n=new TextDecoder("utf8",{fatal:!0}).decode(n),n=n.replace(/\r\n/g,`
`),n=new TextEncoder().encode(n)}catch(i){}return typeof n!="string"&&(n=_.from(n)),n}async write(e,t,n={}){try{await this._writeFile(e,t,n)}catch(i){await this.mkdir(sa(e)),await this._writeFile(e,t,n)}}async mkdir(e){await LA(this._mkdir,e)}async rm(e){try{await this._unlink(e)}catch(t){if(t.code!=="ENOENT")throw t}}async rmdir(e,t){try{t&&t.recursive?await this._rm(e,t):await this._rmdir(e)}catch(n){if(n.code!=="ENOENT")throw n}}async readdir(e){let t;try{t=await this._readdir(e)}catch(n){if(n.code==="ENOTDIR")return null;if(bu(n))return[];throw n}return t.sort(mh),t}async readdirDeep(e){let t=await this._readdir(e);return(await Promise.all(t.map(async i=>{let s=e+"/"+i;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((i,s)=>i.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(t){if(bu(t))return null;throw t}}async readlink(e,t={encoding:"buffer"}){try{let n=await this._readlink(e,t);return _.isBuffer(n)?n:_.from(n)}catch(n){if(bu(n))return null;throw n}}async writelink(e,t){return this._symlink(t.toString("utf8"),e)}};function I(r,e){if(e===void 0)throw new Kr(r)}function LB(r){return r.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(r)}async function le({fsp:r,dotgit:e}){I("fsp",r),I("dotgit",e);let t=await r._stat(e).catch(()=>({isFile:()=>!1,isDirectory:()=>!1}));return t.isDirectory()?e:t.isFile()?r._readFile(e,"utf8").then(n=>n.trimRight().substr(8)).then(n=>LB(n)?n:B(sa(e),n)):e}async function ch(r,e){return!r&&!e?!1:r&&!e||!r&&e?!0:!(await r.type()==="tree"&&await e.type()==="tree"||await r.type()===await e.type()&&await r.mode()===await e.mode()&&await r.oid()===await e.oid())}async function NB({fs:r,dir:e,gitdir:t=B(e,".git"),commit:n="HEAD",cache:i={}}){try{I("fs",r),I("dir",e),I("gitdir",t);let s=new re(r),o=[mr({ref:n}),Dl(),lo()],a=[],l=await le({fsp:s,dotgit:t});await Ct.acquire({fs:s,gitdir:l,cache:i},async function(u){a=u.unmergedPaths});let c=await vi({fs:s,cache:i,dir:e,gitdir:l,trees:o,map:async function(u,[f,d,h]){let p=!await ch(d,h),m=a.includes(u),w=!await ch(h,f);if(p||m)return f?{path:u,mode:await f.mode(),oid:await f.oid(),type:await f.type(),content:await f.content()}:void 0;if(w)return!1;throw new Lu(u)}});await Ct.acquire({fs:s,gitdir:l,cache:i},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 uo=class{static async isIgnored({fs:e,dir:t,gitdir:n=B(t,".git"),filepath:i}){if(ih(i)===".git")return!0;if(i===".")return!1;let s="",o=B(n,"info","exclude");await e.exists(o)&&(s=await e.read(o,"utf8"));let a=[{gitignore:B(t,".gitignore"),filepath:i}],l=i.split("/").filter(Boolean);for(let u=1;u<l.length;u++){let f=l.slice(0,u).join("/"),d=l.slice(u).join("/");a.push({gitignore:B(t,f,".gitignore"),filepath:d})}let c=!1;for(let[u,f]of a.entries()){let d=await e.read(f.gitignore,"utf8"),h=(0,SA.default)();u===0&&h.add(s),h.add(d);let p=sa(f.filepath);if(p!=="."&&h.ignores(p))return!0;c?c=!h.test(f.filepath).unignored:c=h.test(f.filepath).ignored}return c}};async function BB({fs:r,gitdir:e,object:t,format:n,oid:i}){if(n!=="deflated")throw new be("GitObjectStoreLoose expects objects to write to be in deflated format");let s=`objects/${i.slice(0,2)}/${i.slice(2)}`,o=`${e}/${s}`;await r.exists(o)||await r.write(o,t)}var Xw=null;async function NA(r){return Xw===null&&(Xw=GB()),Xw?HB(r):ph.default.deflate(r)}async function HB(r){let e=new CompressionStream("deflate"),t=new Blob([r]).stream().pipeThrough(e);return new Uint8Array(await new Response(t).arrayBuffer())}function GB(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch(r){return!1}}async function Jr({fs:r,gitdir:e,type:t,object:n,format:i="content",oid:s=void 0,dryRun:o=!1}){return i!=="deflated"&&(i!=="wrapped"&&(n=Ss.wrap({type:t,object:n})),s=await mi(n),n=_.from(await NA(n))),o||await BB({fs:r,gitdir:e,object:n,format:"deflated",oid:s}),s}function BA(r){let e;for(;~(e=r.indexOf(92));)r[e]=47;return r}async function UB({fs:r,dir:e,gitdir:t=B(e,".git"),filepath:n,cache:i={},force:s=!1,parallel:o=!0}){try{I("fs",r),I("dir",e),I("gitdir",t),I("filepath",n);let a=new re(r),l=await le({fsp:a,dotgit:t});await Ct.acquire({fs:a,gitdir:l,cache:i},async c=>{let f=await(await Tt.get({fs:a,gitdir:l})).get("core.autocrlf");return wv({dir:e,gitdir:l,fs:a,filepath:n,index:c,force:s,parallel:o,autocrlf:f})})}catch(a){throw a.caller="git.add",a}}function jB(r,e){if(r.has({filepath:e}))return!0;let t=`${e}/`;for(let n of r.entriesMap.keys())if(n.startsWith(t))return!0;return!1}async function wv({dir:r,gitdir:e,fs:t,filepath:n,index:i,force:s,parallel:o,autocrlf:a}){n=Array.isArray(n)?n:[n];let l=n.map(async d=>{if(!s&&!jB(i,d)&&await uo.isIgnored({fs:t,dir:r,gitdir:e,filepath:d}))return;let h=await t.lstat(B(r,d));if(!h)throw new Be(d);if(h.isDirectory()){let p=await t.readdir(B(r,d));if(o){let m=p.map(w=>wv({dir:r,gitdir:e,fs:t,filepath:[B(d,w)],index:i,force:s,parallel:o,autocrlf:a}));await Promise.all(m)}else for(let m of p)await wv({dir:r,gitdir:e,fs:t,filepath:[B(d,m)],index:i,force:s,parallel:o,autocrlf:a})}else{let p=h.isSymbolicLink()?await t.readlink(B(r,d)).then(BA):await t.read(B(r,d),{autocrlf:a});if(p===null)throw new Be(d);let m=await Jr({fs:t,gitdir:e,type:"blob",object:p});i.insert({filepath:d,stats:h,oid:m})}}),c=await Promise.allSettled(l),u=c.filter(d=>d.status==="rejected").map(d=>d.reason);if(u.length>1)throw new aa(u);if(u.length===1)throw u[0];return c.filter(d=>d.status==="fulfilled"&&d.value).map(d=>d.value)}async function zB({fs:r,gitdir:e,oid:t}){let n=`objects/${t.slice(0,2)}/${t.slice(2)}`;return r.exists(`${e}/${n}`)}async function VB({fs:r,cache:e,gitdir:t,oid:n,getExternalRefDelta:i}){let s=await r.readdir(B(t,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let a=`${t}/objects/pack/${o}`,l=await _v({fs:r,cache:e,filename:a,getExternalRefDelta:i});if(l.error)throw new be(l.error);if(l.offsets.has(n))return!0}return!1}async function vv({fs:r,cache:e,gitdir:t,oid:n,format:i="content"}){let s=a=>pt({fs:r,cache:e,gitdir:t,oid:a}),o=await zB({fs:r,gitdir:t,oid:n});return o||(o=await VB({fs:r,cache:e,gitdir:t,oid:n,getExternalRefDelta:s})),o}async function Bu({fs:r,gitdir:e,path:t}){return(await Tt.get({fs:r,gitdir:e})).get(t)}function HA(r,...e){for(let t of e)if(t)for(let n of Object.keys(t)){let i=t[n];i!==void 0&&(r[n]=i)}return r}async function fo({fs:r,gitdir:e,author:t,commit:n}){let i=Math.floor(Date.now()/1e3),s={name:await Bu({fs:r,gitdir:e,path:"user.name"}),email:await Bu({fs:r,gitdir:e,path:"user.email"})||"",timestamp:i,timezoneOffset:new Date(i*1e3).getTimezoneOffset()},o=HA({},s,n?n.author:void 0,t);if(o.name!==void 0)return o}async function la({fs:r,gitdir:e,author:t,committer:n,commit:i}){let s=Math.floor(Date.now()/1e3),o={name:await Bu({fs:r,gitdir:e,path:"user.name"}),email:await Bu({fs:r,gitdir:e,path:"user.email"})||"",timestamp:s,timezoneOffset:new Date(s*1e3).getTimezoneOffset()},a=HA({},o,i?i.committer:void 0,t,n);if(a.name!==void 0)return a}async function Gu({fs:r,cache:e,gitdir:t,oid:n}){let{type:i,object:s}=await pt({fs:r,cache:e,gitdir:t,oid:n});if(i==="tag")return n=Xr.from(s).parse().object,Gu({fs:r,cache:e,gitdir:t,oid:n});if(i!=="commit")throw new sr(n,i,"commit");return{commit:Qr.from(s),oid:n}}async function Yi({fs:r,cache:e,gitdir:t,oid:n}){let{commit:i,oid:s}=await Gu({fs:r,cache:e,gitdir:t,oid:n});return{oid:s,commit:i.parse(),payload:i.withoutSignature()}}var WB="4b825dc642cb6eb9a060e54bf8d69288fbee4904";async function Uu({fs:r,cache:e,onSign:t,gitdir:n,message:i,author:s,committer:o,signingKey:a,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,disallowEmpty:f=!1,ref:d,parent:h,tree:p}){let m=!1,w=!1;d||(w=!(await r.read(`${n}/HEAD`,{encoding:"utf8"})).startsWith("ref:"),d=await q.resolve({fs:r,gitdir:n,ref:"HEAD",depth:2}));let y,v;try{y=await q.resolve({fs:r,gitdir:n,ref:d})}catch(S){if(!(S instanceof Be))throw S;m=!0}if(!m&&(l||f)&&(v=await Yi({fs:r,gitdir:n,oid:y,cache:e})),l&&m)throw new Nu(d);let A=l?await fo({fs:r,gitdir:n,author:s,commit:v.commit}):await fo({fs:r,gitdir:n,author:s});if(!A)throw new gr("author");let C=l?await la({fs:r,gitdir:n,author:A,committer:o,commit:v.commit}):await la({fs:r,gitdir:n,author:A,committer:o});if(!C)throw new gr("committer");return Ct.acquire({fs:r,gitdir:n,cache:e,allowUnmerged:!1},async function(S){let b=RA(S.entries.filter(k=>!k.flags.intentToAdd)).get(".");if(p||(p=await GA({fs:r,gitdir:n,inode:b,dryRun:c})),h?h=await Promise.all(h.map(async k=>{let $=await q.resolve({fs:r,gitdir:n,ref:k});for(;await vv({fs:r,cache:e,gitdir:n,oid:$});){let{type:M,object:D}=await pt({fs:r,cache:e,gitdir:n,oid:$});if(M==="commit")break;if(M!=="tag")throw new sr($,M,"commit");$=Xr.from(D).parse().object}return $})):l?h=v.commit.parent:h=y?[y]:[],f&&!l&&(m&&p===WB||!m&&p===v.commit.tree))throw new Ru;if(!i)if(l)i=v.commit.message;else throw new Kr("message");let x=Qr.from({tree:p,parent:h,author:A,committer:C,message:i});a&&(x=await Qr.sign(x,t,a));let E=await Jr({fs:r,gitdir:n,type:"commit",object:x.toObject(),dryRun:c});return!u&&!c&&await q.writeRef({fs:r,gitdir:n,ref:w?"HEAD":d,value:E}),E})}async function GA({fs:r,gitdir:e,inode:t,dryRun:n}){let i=t.children;for(let l of i)l.type==="tree"&&(l.metadata.mode="040000",l.metadata.oid=await GA({fs:r,gitdir:e,inode:l,dryRun:n}));let s=i.map(l=>({mode:l.metadata.mode,path:l.basename,oid:l.metadata.oid,type:l.type})),o=Zr.from(s);return await Jr({fs:r,gitdir:e,type:"tree",object:o.toObject(),dryRun:n})}async function wh({fs:r,cache:e,gitdir:t,oid:n,filepath:i}){return(await UA({fs:r,cache:e,gitdir:t,oid:n,filepath:i})).oid}async function UA({fs:r,cache:e,gitdir:t,oid:n,filepath:i}){if(i.startsWith("/"))throw new ks("leading-slash");if(i.endsWith("/"))throw new ks("trailing-slash");let s=n,o=await Ol({fs:r,cache:e,gitdir:t,oid:n}),a=o.tree;if(i==="")return{mode:"040000",oid:o.oid,path:"",type:"tree"};{let l=i.split("/");return jA({fs:r,cache:e,gitdir:t,tree:a,pathArray:l,oid:s,filepath:i})}}async function jA({fs:r,cache:e,gitdir:t,tree:n,pathArray:i,oid:s,filepath:o}){let a=i.shift();for(let l of n)if(l.path===a){if(i.length===0)return l;{let{type:c,object:u}=await pt({fs:r,cache:e,gitdir:t,oid:l.oid});if(c!=="tree")throw new sr(s,c,"tree",o);return n=Zr.from(u),jA({fs:r,cache:e,gitdir:t,tree:n,pathArray:i,oid:s,filepath:o})}}throw new Be(`file or directory found at "${s}:${o}"`)}async function Ll({fs:r,cache:e,gitdir:t,oid:n,filepath:i=void 0}){i!==void 0&&(n=await wh({fs:r,cache:e,gitdir:t,oid:n,filepath:i}));let{tree:s,oid:o}=await Ol({fs:r,cache:e,gitdir:t,oid:n});return{oid:o,tree:s.entries()}}async function ju({fs:r,gitdir:e,tree:t}){let n=Zr.from(t).toObject();return await Jr({fs:r,gitdir:e,type:"tree",object:n,format:"content"})}async function qB({fs:r,cache:e,onSign:t,gitdir:n,ref:i,oid:s,note:o,force:a,author:l,committer:c,signingKey:u}){let f;try{f=await q.resolve({gitdir:n,fs:r,ref:i})}catch(y){if(!(y instanceof Be))throw y}let h=(await Ll({fs:r,cache:e,gitdir:n,oid:f||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;if(a)h=h.filter(y=>y.path!==s);else for(let y of h)if(y.path===s)throw new wi("note",s);typeof o=="string"&&(o=_.from(o,"utf8"));let p=await Jr({fs:r,gitdir:n,type:"blob",object:o,format:"content"});h.push({mode:"100644",path:s,oid:p,type:"blob"});let m=await ju({fs:r,gitdir:n,tree:h});return await Uu({fs:r,cache:e,onSign:t,gitdir:n,ref:i,tree:m,parent:f&&[f],message:`Note added by 'isomorphic-git addNote'
`,author:l,committer:c,signingKey:u})}async function YB({fs:r,onSign:e,dir:t,gitdir:n=B(t,".git"),ref:i="refs/notes/commits",oid:s,note:o,force:a,author:l,committer:c,signingKey:u,cache:f={}}){try{I("fs",r),I("gitdir",n),I("oid",s),I("note",o),u&&I("onSign",e);let d=new re(r),h=await fo({fs:d,gitdir:n,author:l});if(!h)throw new gr("author");let p=await la({fs:d,gitdir:n,author:h,committer:c});if(!p)throw new gr("committer");let m=await le({fsp:d,dotgit:n});return await qB({fs:d,cache:f,onSign:e,gitdir:m,ref:i,oid:s,note:o,force:a,author:h,committer:p,signingKey:u})}catch(d){throw d.caller="git.addNote",d}}async function zA({fs:r,gitdir:e,remote:t,url:n,force:i}){if(!Al(t,!0))throw new _n(t,na.default.clean(t));let s=await Tt.get({fs:r,gitdir:e});if(!i&&(await s.getSubsections("remote")).includes(t)&&n!==await s.get(`remote.${t}.url`))throw new wi("remote",t);await s.set(`remote.${t}.url`,n),await s.set(`remote.${t}.fetch`,`+refs/heads/*:refs/remotes/${t}/*`),await Tt.save({fs:r,gitdir:e,config:s})}async function KB({fs:r,dir:e,gitdir:t=B(e,".git"),remote:n,url:i,force:s=!1}){try{I("fs",r),I("gitdir",t),I("remote",n),I("url",i);let o=new re(r),a=await le({fsp:o,dotgit:t});return await zA({fs:o,gitdir:a,remote:n,url:i,force:s})}catch(o){throw o.caller="git.addRemote",o}}async function ZB({fs:r,cache:e,onSign:t,gitdir:n,ref:i,tagger:s,message:o=i,gpgsig:a,object:l,signingKey:c,force:u=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!u&&await q.exists({fs:r,gitdir:n,ref:i}))throw new wi("tag",i);let f=await q.resolve({fs:r,gitdir:n,ref:l||"HEAD"}),{type:d}=await pt({fs:r,cache:e,gitdir:n,oid:f}),h=Xr.from({object:f,type:d,tag:i.replace("refs/tags/",""),tagger:s,message:o,gpgsig:a});c&&(h=await Xr.sign(h,t,c));let p=await Jr({fs:r,gitdir:n,type:"tag",object:h.toObject()});await q.writeRef({fs:r,gitdir:n,ref:i,value:p})}async function XB({fs:r,onSign:e,dir:t,gitdir:n=B(t,".git"),ref:i,tagger:s,message:o=i,gpgsig:a,object:l,signingKey:c,force:u=!1,cache:f={}}){try{I("fs",r),I("gitdir",n),I("ref",i),c&&I("onSign",e);let d=new re(r),h=await le({fsp:d,dotgit:n}),p=await fo({fs:d,gitdir:h,author:s});if(!p)throw new gr("tagger");return await ZB({fs:d,cache:f,onSign:e,gitdir:h,ref:i,tagger:p,message:o,gpgsig:a,object:l,signingKey:c,force:u})}catch(d){throw d.caller="git.annotatedTag",d}}async function QB({fs:r,gitdir:e,ref:t,object:n,checkout:i=!1,force:s=!1}){if(!Al(t,!0))throw new _n(t,na.default.clean(t));let o=`refs/heads/${t}`;if(!s&&await q.exists({fs:r,gitdir:e,ref:o}))throw new wi("branch",t,!1);let a;try{a=await q.resolve({fs:r,gitdir:e,ref:n||"HEAD"})}catch(l){if(!(l instanceof Be))throw l}a&&(a=(await Gu({fs:r,cache:{},gitdir:e,oid:a})).oid,await q.writeRef({fs:r,gitdir:e,ref:o,value:a})),i&&await q.writeSymbolicRef({fs:r,gitdir:e,ref:"HEAD",value:o})}async function JB({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n,object:i,checkout:s=!1,force:o=!1}){try{I("fs",r),I("gitdir",t),I("ref",n);let a=new re(r),l=await le({fsp:a,dotgit:t});return await QB({fs:a,gitdir:l,ref:n,object:i,checkout:s,force:o})}catch(a){throw a.caller="git.branch",a}}async function Hu(r,e,t){let n=t.split("/");n.pop();let i=e;for(let s of n){if(s===""||s===".")continue;i=`${i}/${s}`;let o=await r.lstat(i);if(o&&o.isSymbolicLink())throw new ia(t)}}var xv=(r,e)=>{if(r==="."||e==null||e.length===0||e===".")return!0;let t=e.endsWith("/")?e.slice(0,-1):e;return t==="."?!0:t.length>=r.length?t===r||t.startsWith(`${r}/`):r.startsWith(`${t}/`)};async function Ev({fs:r,cache:e,onProgress:t,onPostCheckout:n,dir:i,gitdir:s,remote:o,ref:a,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:d,track:h=!0,restoreFromIndex:p=!1,nonBlocking:m=!1,batchSize:w=100}){let y;if(n)try{y=await q.resolve({fs:r,gitdir:s,ref:"HEAD"})}catch(A){y="0000000000000000000000000000000000000000"}let v;try{v=await q.resolve({fs:r,gitdir:s,ref:a})}catch(A){if(a==="HEAD"||!(A instanceof Be))throw A;let C=`${o}/${a}`;if(v=await q.resolve({fs:r,gitdir:s,ref:C}),h){let S=await Tt.get({fs:r,gitdir:s});await S.set(`branch.${a}.remote`,o),await S.set(`branch.${a}.merge`,`refs/heads/${a}`),await Tt.save({fs:r,gitdir:s,config:S})}await q.writeRef({fs:r,gitdir:s,ref:`refs/heads/${a}`,value:v})}if(!u)try{v=(await Gu({fs:r,cache:e,gitdir:s,oid:v})).oid}catch(A){throw A instanceof Be?new Tl(a,A.data.what):A}if(!c){let A;try{A=await eH({fs:r,cache:e,onProgress:t,dir:i,gitdir:s,ref:a,force:d,filepaths:l,restoreFromIndex:p})}catch(x){throw x instanceof Be&&x.data.what===v?new Tl(a,v):x}let C=A.filter(([x])=>x==="conflict").map(([x,E])=>E);if(C.length>0)throw new ku(C);let S=A.filter(([x])=>x==="error").map(([x,E])=>E);if(S.length>0)throw new be(S.join(", "));if(f){n&&await n({previousHead:y,newHead:v,type:l!=null&&l.length>0?"file":"branch"});return}let T=0,b=A.length;if(await Ct.acquire({fs:r,gitdir:s,cache:e},async function(x){await Promise.all(A.filter(([E])=>E==="delete"||E==="delete-index").map(async function([E,k]){let $=`${i}/${k}`;E==="delete"&&await r.rm($),x.delete({filepath:k}),t&&await t({phase:"Updating workdir",loaded:++T,total:b})}))}),await Ct.acquire({fs:r,gitdir:s,cache:e},async function(x){for(let[E,k]of A)if(E==="rmdir"||E==="rmdir-index"){let $=`${i}/${k}`;try{E==="rmdir"&&await r.rmdir($),x.delete({filepath:k}),t&&await t({phase:"Updating workdir",loaded:++T,total:b})}catch(M){if(M.code==="ENOTEMPTY")console.log(`Did not delete ${k} because directory is not empty`);else throw M}}}),await Promise.all(A.filter(([x])=>x==="mkdir"||x==="mkdir-index").map(async function([x,E]){let k=`${i}/${E}`;await Hu(r,i,E),await r.mkdir(k),t&&await t({phase:"Updating workdir",loaded:++T,total:b})})),m){let x=A.filter(([k])=>k==="create"||k==="create-index"||k==="update"||k==="mkdir-index"),E=await uA("Update Working Dir",x.map(([k,$,M,D,P])=>()=>rH({fs:r,cache:e,gitdir:s,dir:i},[k,$,M,D,P])),t,w);await Ct.acquire({fs:r,gitdir:s,cache:e,allowUnmerged:!0},async function(k){await uA("Update Index",E.map(([$,M,D])=>()=>tH({index:k,fullpath:$,oid:M,stats:D})),t,w)})}else await Ct.acquire({fs:r,gitdir:s,cache:e,allowUnmerged:!0},async function(x){var $,M;let E=await Promise.allSettled(A.filter(([D])=>D==="create"||D==="create-index"||D==="update"||D==="mkdir-index").map(async function([D,P,F,_e,Q]){let oe=`${i}/${P}`;if(D!=="create-index"&&D!=="mkdir-index"){await Hu(r,i,P);let{object:Z}=await pt({fs:r,cache:e,gitdir:s,oid:F});if(Q&&await r.rm(oe),_e===33188)await r.write(oe,Z);else if(_e===33261)await r.write(oe,Z,{mode:511});else if(_e===40960)await r.writelink(oe,Z);else throw new be(`Invalid mode 0o${_e.toString(8)} detected in blob ${F}`)}let fe=await r.lstat(oe);_e===33261&&(fe.mode=493),D==="mkdir-index"&&(fe.mode=57344),x.insert({filepath:P,stats:fe,oid:F}),t&&await t({phase:"Updating workdir",loaded:++T,total:b})})),k=[];for(let D of E)D.status==="rejected"&&(k.push(D.reason),console.error("[isomorphic-git checkout] task rejected:",(M=($=D.reason)==null?void 0:$.stack)!=null?M:D.reason));if(k.length>0)throw new aa(k)});n&&await n({previousHead:y,newHead:v,type:l!=null&&l.length>0?"file":"branch"})}if(!u){let A=await q.expand({fs:r,gitdir:s,ref:a});A.startsWith("refs/heads")?await q.writeSymbolicRef({fs:r,gitdir:s,ref:"HEAD",value:A}):await q.writeRef({fs:r,gitdir:s,ref:"HEAD",value:v})}}async function eH({fs:r,cache:e,onProgress:t,dir:n,gitdir:i,ref:s,force:o,filepaths:a,restoreFromIndex:l}){let c=0;return vi({fs:r,cache:e,dir:n,gitdir:i,trees:[l?lo():mr({ref:s}),Dl(),lo()],map:async function(u,[f,d,h]){if(u===".")return;if(a&&!a.some(m=>xv(u,m)))return null;switch(t&&await t({phase:"Analyzing workdir",loaded:++c}),[!!h,!!f,!!d].map(Number).join("")){case"000":return;case"001":return!l&&o&&a&&a.includes(u)?["delete",u]:void 0;case"010":switch(await f.type()){case"tree":return["mkdir",u];case"blob":return["create",u,await f.oid(),await f.mode()];case"commit":return["mkdir-index",u,await f.oid(),await f.mode()];default:return["error",`new entry Unhandled type ${await f.type()}`]}case"011":switch(`${await f.type()}-${await d.type()}`){case"tree-tree":return;case"tree-blob":case"blob-tree":return["conflict",u];case"blob-blob":return await f.oid()!==await d.oid()?o?["update",u,await f.oid(),await f.mode(),await f.mode()!==await d.mode()]:["conflict",u]:await f.mode()!==await d.mode()?o?["update",u,await f.oid(),await f.mode(),!0]:["conflict",u]:["create-index",u,await f.oid(),await f.mode()];case"commit-tree":return;case"commit-blob":return["conflict",u];default:return["error",`new entry Unhandled type ${f.type}`]}case"100":return["delete-index",u];case"101":switch(await h.type()){case"tree":return["rmdir-index",u];case"blob":return await h.oid()!==await d.oid()?o?["delete",u]:["conflict",u]:["delete",u];case"commit":return["rmdir-index",u];default:return["error",`delete entry Unhandled type ${await h.type()}`]}case"110":case"111":switch(`${await h.type()}-${await f.type()}`){case"tree-tree":return;case"blob-blob":{if(await h.oid()===await f.oid()&&await h.mode()===await f.mode()&&!o)return;if(d){if(await d.oid()!==await h.oid()&&await d.oid()!==await f.oid())return o?["update",u,await f.oid(),await f.mode(),await f.mode()!==await d.mode()]:["conflict",u]}else if(o)return["update",u,await f.oid(),await f.mode(),await f.mode()!==await h.mode()];return await f.mode()!==await h.mode()?["update",u,await f.oid(),await f.mode(),!0]:await f.oid()!==await h.oid()?["update",u,await f.oid(),await f.mode(),!1]:void 0}case"tree-blob":return["update-dir-to-blob",u,await f.oid()];case"blob-tree":return["update-blob-to-tree",u];case"commit-commit":return["mkdir-index",u,await f.oid(),await f.mode()];default:return["error",`update entry Unhandled type ${await h.type()}-${await f.type()}`]}}},reduce:async function(u,f){return f=DA(f),u?u&&u[0]==="rmdir"?(f.push(u),f):(f.unshift(u),f):f}})}async function tH({index:r,fullpath:e,stats:t,oid:n}){try{r.insert({filepath:e,stats:t,oid:n})}catch(i){console.warn(`Error inserting ${e} into index:`,i)}}async function rH({fs:r,cache:e,gitdir:t,dir:n},[i,s,o,a,l]){let c=`${n}/${s}`;if(i!=="create-index"&&i!=="mkdir-index"){await Hu(r,n,s);let{object:f}=await pt({fs:r,cache:e,gitdir:t,oid:o});if(l&&await r.rm(c),a===33188)await r.write(c,f);else if(a===33261)await r.write(c,f,{mode:511});else if(a===40960)await r.writelink(c,f);else throw new be(`Invalid mode 0o${a.toString(8)} detected in blob ${o}`)}let u=await r.lstat(c);return a===33261&&(u.mode=493),i==="mkdir-index"&&(u.mode=57344),[s,o,u]}async function uA(r,e,t,n){let i=[],s=[];for(let o=0;o<e.length;o+=n){let a=e.slice(o,o+n).map(c=>c());(await Promise.allSettled(a)).forEach(c=>{var u,f;c.status==="fulfilled"?i.push(c.value):(s.push(c.reason),console.error(`[isomorphic-git ${r}] task rejected:`,(f=(u=c.reason)==null?void 0:u.stack)!=null?f:c.reason))}),t&&await t({phase:"Updating workdir",loaded:o+a.length,total:e.length})}if(s.length>0)throw new aa(s);return i}async function VA({fs:r,onProgress:e,onPostCheckout:t,dir:n,gitdir:i=B(n,".git"),remote:s="origin",ref:o,filepaths:a,noCheckout:l=!1,noUpdateHead:c=o===void 0,dryRun:u=!1,force:f=!1,track:d=!0,cache:h={},nonBlocking:p=!1,batchSize:m=100}){try{I("fs",r),I("dir",n),I("gitdir",i);let w=o||"HEAD",y=o===void 0&&a!=null&&a.length>0,v=new re(r),A=await le({fsp:v,dotgit:i});return await Ev({fs:v,cache:h,onProgress:e,onPostCheckout:t,dir:n,gitdir:A,remote:s,ref:w,filepaths:a,noCheckout:l,noUpdateHead:c,dryRun:u,force:f,track:d,restoreFromIndex:y,nonBlocking:p,batchSize:m})}catch(w){throw w.caller="git.checkout",w}}var Qw=/^.*(\r?\n|$)/gm;function nH({branches:r,contents:e}){let t=r[1],n=r[2],i=e[0],s=e[1],o=e[2],a=s.match(Qw),l=i.match(Qw),c=o.match(Qw),u=(0,kA.default)(a,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)} ${t}
`,d+=p.conflict.a.join(""),d+=`${"=".repeat(f)}
`,d+=p.conflict.b.join(""),d+=`${">".repeat(f)} ${n}
`);return{cleanMerge:h,mergedText:d}}async function WA({fs:r,cache:e,dir:t,gitdir:n=B(t,".git"),index:i,ourOid:s,baseOid:o,theirOid:a,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:d=!0,mergeDriver:h}){let p=mr({ref:s}),m=mr({ref:o}),w=mr({ref:a}),y=[],v=[],A=[],C=[],S=await vi({fs:r,cache:e,dir:t,gitdir:n,trees:[p,m,w],map:async function(T,[b,x,E]){let k=ih(T),$=await ch(b,x),M=await ch(E,x);switch(`${$}-${M}`){case"false-false":return{mode:await x.mode(),path:k,oid:await x.oid(),type:await x.type()};case"false-true":return!E&&await b.type()==="tree"?{mode:await b.mode(),path:k,oid:await b.oid(),type:await b.type()}:E?{mode:await E.mode(),path:k,oid:await E.oid(),type:await E.type()}:void 0;case"true-false":return!b&&await E.type()==="tree"?{mode:await E.mode(),path:k,oid:await E.oid(),type:await E.type()}:b?{mode:await b.mode(),path:k,oid:await b.oid(),type:await b.type()}:void 0;case"true-true":{if(b&&E&&await b.type()==="tree"&&await E.type()==="tree")return{mode:await b.mode(),path:k,oid:await b.oid(),type:"tree"};if(b&&E&&await b.type()==="blob"&&await E.type()==="blob")return iH({fs:r,gitdir:n,path:k,ours:b,base:x,theirs:E,ourName:l,baseName:c,theirName:u,mergeDriver:h}).then(async D=>{if(D.cleanMerge)d||i.insert({filepath:T,oid:D.mergeResult.oid,stage:0});else if(y.push(T),v.push(T),!d){let P="";x&&await x.type()==="blob"&&(P=await x.oid());let F=await b.oid(),_e=await E.oid();i.delete({filepath:T}),P&&i.insert({filepath:T,oid:P,stage:1}),i.insert({filepath:T,oid:F,stage:2}),i.insert({filepath:T,oid:_e,stage:3})}return D.mergeResult});if(x&&!b&&E&&await x.type()==="blob"&&await E.type()==="blob"){if(y.push(T),A.push(T),!d){let D=await x.oid(),P=await E.oid();i.delete({filepath:T}),i.insert({filepath:T,oid:D,stage:1}),i.insert({filepath:T,oid:P,stage:3})}return{mode:await E.mode(),oid:await E.oid(),type:"blob",path:k}}if(x&&b&&!E&&await x.type()==="blob"&&await b.type()==="blob"){if(y.push(T),C.push(T),!d){let D=await x.oid(),P=await b.oid();i.delete({filepath:T}),i.insert({filepath:T,oid:D,stage:1}),i.insert({filepath:T,oid:P,stage:2})}return{mode:await b.mode(),oid:await b.oid(),type:"blob",path:k}}if(x&&!b&&!E&&(await x.type()==="blob"||await x.type()==="tree"))return;throw new $l}}},reduce:y.length!==0&&(!t||d)?void 0:async(T,b)=>{let x=b.filter(Boolean);if(T&&!(T&&T.type==="tree"&&x.length===0&&T.path!==".")){if(x.length>0||T.path==="."&&x.length===0){let k=new Zr(x).toObject(),$=await Jr({fs:r,gitdir:n,type:"tree",object:k,dryRun:f});T.oid=$}return T}}});return y.length!==0?(t&&!d&&await vi({fs:r,cache:e,dir:t,gitdir:n,trees:[mr({ref:S.oid})],map:async function(T,[b]){let x=`${t}/${T}`;if(await b.type()==="blob"){let E=await b.mode(),k=await b.content();await r.write(x,k,{mode:E})}return!0}}),new oa(y,v,A,C)):S.oid}async function iH({fs:r,gitdir:e,path:t,ours:n,base:i,theirs:s,ourName:o,theirName:a,baseName:l,dryRun:c,mergeDriver:u=nH}){let f="blob",d="100755",h="",p="";i&&await i.type()==="blob"&&(d=await i.mode(),h=await i.oid(),p=_.from(await i.content()).toString("utf8"));let m=d===await n.mode()?await s.mode():await n.mode();if(await n.oid()===await s.oid())return{cleanMerge:!0,mergeResult:{mode:m,path:t,oid:await n.oid(),type:f}};if(await n.oid()===h)return{cleanMerge:!0,mergeResult:{mode:m,path:t,oid:await s.oid(),type:f}};if(await s.oid()===h)return{cleanMerge:!0,mergeResult:{mode:m,path:t,oid:await n.oid(),type:f}};let w=_.from(await n.content()).toString("utf8"),y=_.from(await s.content()).toString("utf8"),{mergedText:v,cleanMerge:A}=await u({branches:[l,o,a],contents:[p,w,y],path:t}),C=await Jr({fs:r,gitdir:e,type:"blob",object:_.from(v,"utf8"),dryRun:c});return{cleanMerge:A,mergeResult:{mode:m,path:t,oid:C,type:f}}}var sH={stage:lo,workdir:Dl};async function oH(r,e,t,n,i=null){let s=B(t,n),o=await r.lstat(s);if(!o)throw new Be(s);if(o.isDirectory())throw new be(`${s}: file expected, but found directory`);let a=i?await PA({fs:r,gitdir:e,oid:i}):void 0,l=a?i:void 0;return a||await ir(s,async()=>{let c=o.isSymbolicLink()?await r.readlink(s).then(BA):await r.read(s);if(c===null)throw new Be(s);l=await Jr({fs:r,gitdir:e,type:"blob",object:c})}),l}async function aH({fs:r,dir:e,gitdir:t,entries:n}){async function i(s){if(s.type==="tree"){if(!s.oid){let o=await Promise.all(s.children.map(i));s.oid=await ju({fs:r,gitdir:t,tree:o}),s.mode=16384}}else s.type==="blob"&&(s.oid=await oH(r,t,e,s.path,s.oid),s.mode=33188);return s.path=s.path.split("/").pop(),s}return Promise.all(n.map(i))}async function fA({fs:r,dir:e,gitdir:t,treePair:n}){let i=n[1]==="stage",s=n.map(h=>typeof h=="string"?sH[h]():h),o=[],u=await vi({fs:r,cache:{},dir:e,gitdir:t,trees:s,map:async(h,[p,m])=>{if(!(h==="."||await uo.isIgnored({fs:r,dir:e,gitdir:t,filepath:h}))&&m)return(!p||await p.oid()!==await m.oid()&&await m.oid()!==void 0)&&o.push([p,m]),{mode:await m.mode(),path:h,oid:await m.oid(),type:await m.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 m=[];for(let w of p){let[y,v]=w;i?v&&(await r.exists(`${e}/${v.toString()}`)?m.push(w):o.push([null,v])):y&&(v?m.push(w):o.push([y,null]))}return m.length?Promise.all(m.map(h)):[]}});if(o.length===0||u.length===0)return null;let d=(await aH({fs:r,dir:e,gitdir:t,entries:u})).filter(Boolean).map(h=>({mode:h.mode,path:h.path,oid:h.oid,type:h.type}));return ju({fs:r,gitdir:t,tree:d})}async function qA({fs:r,dir:e,gitdir:t,stashCommit:n,parentCommit:i,wasStaged:s}){let o=[],a=[],l=await vi({fs:r,cache:{},dir:e,gitdir:t,trees:[mr({ref:i}),mr({ref:n})],map:async(c,[u,f])=>{if(c==="."||await uo.isIgnored({fs:r,dir:e,gitdir:t,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"&&o.push(c),d==="blob"&&s&&a.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&&a.push({filepath:c,oid:h,stats:await r.lstat(B(e,c))}),{method:"write",filepath:c,oid:h})}});await ir(t,async()=>{for(let c of l){let u=B(e,c.filepath);switch(c.method){case"rmdir":await r.rmdir(u);break;case"mkdir":await Hu(r,e,c.filepath),await r.mkdir(u);break;case"rm":await r.rm(u);break;case"write":if(!o.some(f=>u.startsWith(f))){await Hu(r,e,c.filepath);let{object:f}=await pt({fs:r,cache:{},gitdir:t,oid:c.oid});await r.exists(u)&&await r.rm(u),await r.write(u,f)}break}}}),await Ct.acquire({fs:r,gitdir:t,cache:{}},async c=>{a.forEach(({filepath:u,stats:f,oid:d})=>{c.insert({filepath:u,stats:f,oid:d})})})}async function dA({fs:r,cache:e,dir:t,gitdir:n,oid:i,dryRun:s=!1,noUpdateBranch:o=!1,abortOnConflict:a=!0,committer:l,mergeDriver:c}){let{commit:u,oid:f}=await Yi({fs:r,cache:e,gitdir:n,oid:i});if(u.parent.length>1)throw new Cu(f,u.parent.length);if(u.parent.length===0)throw new Tu(f);let d=await q.resolve({fs:r,gitdir:n,ref:"HEAD"}),{commit:h}=await Yi({fs:r,cache:e,gitdir:n,oid:d}),p=u.parent[0],{commit:m}=await Yi({fs:r,cache:e,gitdir:n,oid:p});if(t&&(!s&&!o||!a)){let v=await lH({fs:r,cache:e,dir:t,gitdir:n,headTree:h.tree,baseTree:m.tree,theirTree:u.tree,allTracked:!a});if(v.length>0)throw new Au(v)}let w=await Ct.acquire({fs:r,gitdir:n,cache:e,allowUnmerged:!1},async v=>WA({fs:r,cache:e,dir:t,gitdir:n,index:v,ourOid:h.tree,baseOid:m.tree,theirOid:u.tree,ourName:"HEAD",baseName:`parent of ${f.slice(0,7)}`,theirName:f.slice(0,7),dryRun:s,abortOnConflict:a,mergeDriver:c}));if(w instanceof oa)throw w;let y=await Uu({fs:r,cache:e,gitdir:n,message:u.message,tree:w,parent:[d],author:u.author,committer:l,dryRun:s,noUpdateBranch:o});return t&&!s&&!o&&await qA({fs:r,dir:t,gitdir:n,stashCommit:y,parentCommit:d,wasStaged:!0}),y}async function lH({fs:r,cache:e,dir:t,gitdir:n,headTree:i,baseTree:s,theirTree:o,allTracked:a}){let l=await vi({fs:r,cache:e,dir:t,gitdir:n,trees:[mr({ref:s}),mr({ref:o})],map:async(c,[u,f])=>{if(c===".")return;if(u&&f&&await u.oid()===await f.oid())return null;if([u?await u.type():void 0,f?await f.type():void 0].includes("blob"))return c}});return l.length===0&&!a?[]:vi({fs:r,cache:e,dir:t,gitdir:n,trees:[mr({ref:i}),lo(),Dl()],map:async(c,[u,f,d])=>{if(c===".")return;if(!a&&!l.some(m=>xv(c,m)))return null;let h=u&&await u.type()==="blob"?await u.oid():void 0;if(!l.includes(c)&&!(a&&h))return;if((f?await f.oid():void 0)!==h)return c;if(d&&(!h||await d.type()!=="blob"||await d.oid()!==h))return c}})}async function cH({fs:r,dir:e,gitdir:t=B(e,".git"),oid:n,cache:i={},committer:s,dryRun:o=!1,noUpdateBranch:a=!1,abortOnConflict:l=!0,mergeDriver:c}){try{I("fs",r),I("gitdir",t),I("oid",n);let u=new re(r),f=await le({fsp:u,dotgit:t}),{commit:d}=await Yi({fs:u,cache:i,gitdir:f,oid:n});if(d.parent&&d.parent.length>1)return await dA({fs:u,cache:i,dir:e,gitdir:f,oid:n,dryRun:o,noUpdateBranch:a,abortOnConflict:l,committer:void 0,mergeDriver:c});let h=await la({fs:u,gitdir:f,committer:s});if(!h)throw new gr("committer");return await dA({fs:u,cache:i,dir:e,gitdir:f,oid:n,dryRun:o,noUpdateBranch:a,abortOnConflict:l,committer:h,mergeDriver:c})}catch(u){throw u.caller="git.cherryPick",u}}var uH=/^refs\/(heads\/|tags\/|remotes\/)?(.*)/;function ra(r){let e=uH.exec(r);return e?e[1]==="remotes/"&&r.endsWith("/HEAD")?e[2].slice(0,-5):e[2]:r}async function po({fs:r,gitdir:e,fullname:t=!1,test:n=!1}){let i=await q.resolve({fs:r,gitdir:e,ref:"HEAD",depth:2});if(n)try{await q.resolve({fs:r,gitdir:e,ref:i})}catch(s){if(s instanceof Be)return;throw s}if(i.startsWith("refs/"))return t?i:ra(i)}function fH(r){return r=r.replace(/^[^/@:]+@([^/@:]+):/,"https://$1/"),r=r.replace(/^ssh:\/\//,"https://"),r}function YA({username:r="",password:e=""}){return`Basic ${_.from(`${r}:${e}`).toString("base64")}`}async function zu(r,e){let t=OA(r);for(;;){let{value:n,done:i}=await t.next();if(n&&await e(n),i)break}t.return&&t.return()}async function uh(r){let e=0,t=[];await zu(r,s=>{t.push(s),e+=s.byteLength});let n=new Uint8Array(e),i=0;for(let s of t)n.set(s,i),i+=s.byteLength;return n}var hA=/^(https?:\/\/)([^/?#]+)@/i;function pA(r){let e=r.match(hA);return e==null?{url:r,auth:{}}:{url:r.replace(hA,"$1"),auth:dH(r,e[2])}}function dH(r,e){let t=hH(r),n=e.indexOf(":")!==-1;if(t!==null)return{username:mA(t.username),password:n?mA(t.password):void 0};let i=e.indexOf(":");return{username:n?e.slice(0,i):e,password:n?e.slice(i+1):void 0}}function hH(r){if(typeof URL!="function")return null;try{return new URL(r)}catch(e){return null}}function mA(r){try{return decodeURIComponent(r)}catch(e){return r}}function bv(r,e){let t=e.toString(16);return"0".repeat(r-t.length)+t}var At=class{static flush(){return _.from("0000","utf8")}static delim(){return _.from("0001","utf8")}static encode(e){typeof e=="string"&&(e=_.from(e));let t=e.length+4,n=bv(4,t);return _.concat([_.from(n,"utf8"),e])}static streamReader(e){let t=new ah(e);return async function(){try{let i=await t.read(4);if(i==null||i.length===0)return!0;let s=i.toString("utf8");if(!/^[0-9a-fA-F]{4}$/.test(s))throw new gi("four hexadecimal digits",s);let o=parseInt(s,16);if(o===0||o===1)return null;if(o<4)throw new gi("pkt-line length of 0, 1, or at least 4",s);let a=await t.read(o-4);if(a==null||a.length!==o-4)throw new gi(`${o-4} bytes of pkt-line data`,`${a==null?0:a.length} bytes`);return a}catch(i){return e.error=i,!0}}}};async function gA(r){let e={},t;for(;t=await r(),t!==!0;){if(t===null)continue;t=t.toString("utf8").replace(/\n$/,"");let n=t.indexOf("=");if(n>-1){let i=t.slice(0,n),s=t.slice(n+1);e[i]=s}else e[t]=!0}return{protocolVersion:2,capabilities2:e}}async function wA(r,{service:e}){let t=new Set,n=new Map,i=new Map,s=At.streamReader(r),o=await s();for(;o===null;)o=await s();if(o===!0)throw new $u;if(o.includes("version 2"))return gA(s);if(o.toString("utf8").replace(/\n$/,"")!==`# service=${e}`)throw new gi(`# service=${e}\\n`,o.toString("utf8"));let a=await s();for(;a===null;)a=await s();if(a===!0)return{capabilities:t,refs:n,symrefs:i};if(a=a.toString("utf8"),a.includes("version 2"))return gA(s);let[l,c]=Jw(a,"\0","\\x00");if(c.split(" ").map(u=>t.add(u)),l!=="0000000000000000000000000000000000000000 capabilities^{}"){let[u,f]=Jw(l," "," ");for(n.set(f,u);;){let d=await s();if(d===!0)break;if(d!==null){let[h,p]=Jw(d.toString("utf8")," "," ");n.set(p,h)}}}for(let u of t)if(u.startsWith("symref=")){let f=u.match(/symref=([^:]+):(.*)/);f.length===3&&i.set(f[1],f[2])}return{protocolVersion:1,capabilities:t,refs:n,symrefs:i}}function Jw(r,e,t){let n=r.trim().split(e);if(n.length!==2)throw new gi(`Two strings separated by '${t}'`,r.toString("utf8"));return n}var vA=(r,e)=>r.endsWith("?")?`${r}${e}`:`${r}/${e.replace(/^https?:\/\//,"")}`,bA=(r,e)=>{(e.username||e.password)&&(r.Authorization=YA(e)),e.headers&&Object.assign(r,e.headers)},ev=async r=>{try{let e=_.from(await uh(r.body)),t=e.toString("utf8");return{preview:t.length<256?t:t.slice(0,256)+"...",response:t,data:e}}catch(e){return{}}},Fl=class{static async capabilities(){return["discover","connect"]}static async discover({http:e,onProgress:t,onAuth:n,onAuthSuccess:i,onAuthFailure:s,corsProxy:o,service:a,url:l,headers:c,signal:u,protocolVersion:f}){let{url:d,auth:h}=pA(l),p=o?vA(o,d):d;(h.username||h.password)&&(c.Authorization=YA(h)),f===2&&(c["Git-Protocol"]="version=2");let m,w,y=!1;do if(m=await e.request({onProgress:t,method:"GET",url:`${p}/info/refs?service=${a}`,headers:c,signal:u}),w=!1,m.statusCode===401||m.statusCode===203){let v=y?s:n;if(v){if(h=await v(d,{...h,headers:{...c}}),h&&h.cancel)throw new Il;h&&(bA(c,h),y=!0,w=!0)}}else m.statusCode===200&&y&&i&&await i(d,h);while(w);if(m.statusCode!==200){let{response:v}=await ev(m);throw new Rl(m.statusCode,m.statusMessage,v)}if(m.headers["content-type"]===`application/x-${a}-advertisement`){let v=await wA(m.body,{service:a});return v.auth=h,v}else{let{preview:v,response:A,data:C}=await ev(m);try{let S=await wA([C],{service:a});return S.auth=h,S}catch(S){throw new Fu(v,A)}}}static async connect({http:e,onProgress:t,corsProxy:n,service:i,url:s,auth:o,body:a,headers:l,signal:c}){let u=pA(s);u&&(s=u.url),n&&(s=vA(n,s)),l["content-type"]=`application/x-${i}-request`,l.accept=`application/x-${i}-result`,bA(l,o);let f=await e.request({onProgress:t,method:"POST",url:`${s}/${i}`,body:a,headers:l,signal:c});if(f.statusCode!==200){let{response:d}=ev(f);throw new Rl(f.statusCode,f.statusMessage,d)}return f}},Ml=class{static getRemoteHelperFor({url:e}){let t=new Map;t.set("http",Fl),t.set("https",Fl);let n=mH({url:e});if(!n)throw new Du(e);if(t.has(n.transport))return t.get(n.transport);throw new Mu(e,n.transport,n.transport==="ssh"?fH(e):void 0)}},pH=/^[^/@:]+@[^/@:]+:/;function mH({url:r}){if(pH.test(r))return{transport:"ssh",address:r};let e=r.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 ho=class{static async read({fs:e,gitdir:t}){let n=B(t,"shallow"),i=new Set;return await ir(n,async function(){let s=await e.read(n,{encoding:"utf8"});if(s===null||s.trim()==="")return i;s.trim().split(`
`).map(o=>i.add(o))}),i}static async write({fs:e,gitdir:t,oids:n}){let i=B(t,"shallow");if(n.size>0){let s=[...n].join(`
`)+`
`;await ir(i,async function(){await e.write(i,s,{encoding:"utf8"})})}else await ir(i,async function(){await e.rm(i)})}};function fh({config:r,onAuth:e}){return e&&(async(t,n)=>{let i=n.username||await r.get(`credential.${t}.username`);return e(t,i?{...n,username:i}:n)})}function gH(r){let i="5041434b"+"00000002"+"00000000";return r.slice(0,12).toString("hex")===i}function KA(r,e){let t=r.map(n=>n.split("=",1)[0]);return e.filter(n=>{let i=n.split("=",1)[0];return t.includes(i)})}var vh={name:"isomorphic-git",version:"1.44.10",agent:"git/isomorphic-git@1.44.10"},kl=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 t=this._waiting;this._waiting=null,t({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 wH(r){let e=r.indexOf("\r"),t=r.indexOf(`
`);return e===-1&&t===-1?-1:e===-1?t+1:t===-1?e+1:t===e+1?t+1:Math.min(e,t)+1}function ZA(r){let e=new kl,t="";return(async()=>(await zu(r,n=>{for(n=n.toString("utf8"),t+=n;;){let i=wH(t);if(i===-1||i===t.length&&t[i-1]==="\r")break;e.write(t.slice(0,i)),t=t.slice(i)}}),t.length>0&&e.write(t),e.end()))(),e}var dh=class{static demux(e){let t=At.streamReader(e),n=new kl,i=new kl,s=new kl,o=async function(){let a=await t();if(a===null)return o();if(a===!0){n.end(),s.end(),e.error?i.destroy(e.error):i.end();return}switch(a[0]){case 1:{i.write(a.slice(1));break}case 2:{s.write(a.slice(1));break}case 3:{let l=a.slice(1);s.write(l),n.end(),s.end(),i.destroy(new Error(l.toString("utf8")));return}default:n.write(a)}o()};return o(),{packetlines:n,packfile:i,progress:s}}};async function vH(r){let{packetlines:e,packfile:t,progress:n}=dh.demux(r),i=[],s=[],o=[],a=!1,l=!1;return new Promise((c,u)=>{zu(e,f=>{let d=f.toString("utf8").trim();if(d.startsWith("shallow")){let h=d.slice(-41).trim();h.length!==40&&u(new co(h)),i.push(h)}else if(d.startsWith("unshallow")){let h=d.slice(-41).trim();h.length!==40&&u(new co(h)),s.push(h)}else if(d.startsWith("ACK")){let[,h,p]=d.split(" ");o.push({oid:h,status:p}),p||(l=!0)}else d.startsWith("NAK")?(a=!0,l=!0):(l=!0,a=!0);l&&(r.error?u(r.error):c({shallows:i,unshallows:s,acks:o,nak:a,packfile:t,progress:n}))}).finally(()=>{l||(r.error?u(r.error):c({shallows:i,unshallows:s,acks:o,nak:a,packfile:t,progress:n}))})})}function bH({capabilities:r=[],wants:e=[],haves:t=[],shallows:n=[],depth:i=null,since:s=null,exclude:o=[]}){let a=[];e=[...new Set(e)];let l=` ${r.join(" ")}`;for(let c of e)a.push(At.encode(`want ${c}${l}
`)),l="";for(let c of n)a.push(At.encode(`shallow ${c}
`));i!==null&&a.push(At.encode(`deepen ${i}
`)),s!==null&&a.push(At.encode(`deepen-since ${Math.floor(s.valueOf()/1e3)}
`));for(let c of o)a.push(At.encode(`deepen-not ${c}
`));a.push(At.flush());for(let c of t)a.push(At.encode(`have ${c}
`));return a.push(At.encode(`done
`)),a}async function Sv({fs:r,cache:e,http:t,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,gitdir:l,ref:c,remoteRef:u,remote:f,url:d,corsProxy:h,depth:p=null,since:m=null,exclude:w=[],relative:y=!1,tags:v=!1,singleBranch:A=!1,headers:C={},prune:S=!1,pruneTags:T=!1}){let b=c||await po({fs:r,gitdir:l,test:!0}),x=await Tt.get({fs:r,gitdir:l}),E=f||b&&await x.get(`branch.${b}.remote`)||"origin",k=d||await x.get(`remote.${E}.url`);if(typeof k=="undefined")throw new Kr("remote OR url");let $=u||b&&await x.get(`branch.${b}.merge`)||c||"HEAD";h===void 0&&(h=await x.get("http.corsProxy"));let M=Ml.getRemoteHelperFor({url:k}),D=await M.discover({http:t,onAuth:fh({config:x,onAuth:s}),onAuthSuccess:o,onAuthFailure:fh({config:x,onAuth:a}),corsProxy:h,service:"git-upload-pack",url:k,headers:C,protocolVersion:1}),P=D.auth,F=D.refs;if(F.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!D.capabilities.has("shallow"))throw new oo("shallow","depth");if(m!==null&&!D.capabilities.has("deepen-since"))throw new oo("deepen-since","since");if(w.length>0&&!D.capabilities.has("deepen-not"))throw new oo("deepen-not","exclude");if(y===!0&&!D.capabilities.has("deepen-relative"))throw new oo("deepen-relative","relative");let{oid:_e,fullref:Q}=q.resolveAgainstMap({ref:$,map:F});for(let ee of F.keys())ee===Q||ee==="HEAD"||ee.startsWith("refs/heads/")||v&&ee.startsWith("refs/tags/")||F.delete(ee);let oe=KA([...D.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${vh.agent}`]);y&&oe.push("deepen-relative");let fe=A?[_e]:F.values(),Z=A?[b]:await q.listRefs({fs:r,gitdir:l,filepath:"refs"}),Y=[];for(let ee of Z)try{ee=await q.expand({fs:r,gitdir:l,ref:ee});let Oe=await q.resolve({fs:r,gitdir:l,ref:ee});await vv({fs:r,cache:e,gitdir:l,oid:Oe})&&Y.push(Oe)}catch(Oe){}Y=[...new Set(Y)];let J=await ho.read({fs:r,gitdir:l}),U=D.capabilities.has("shallow")?[...J]:[],et=bH({capabilities:oe,wants:fe,haves:Y,shallows:U,depth:p,since:m,exclude:w}),se=_.from(await uh(et)),vt=await M.connect({http:t,onProgress:n,corsProxy:h,service:"git-upload-pack",url:k,auth:P,body:[se],headers:C}),tt=await vH(vt.body);vt.headers&&(tt.headers=vt.headers);for(let ee of tt.shallows)if(!J.has(ee))try{let{object:Oe}=await pt({fs:r,cache:e,gitdir:l,oid:ee}),Te=new Qr(Oe),bt=await Promise.all(Te.headers().parent.map(Vr=>vv({fs:r,cache:e,gitdir:l,oid:Vr})));bt.length===0||bt.every(Vr=>Vr)||J.add(ee)}catch(Oe){J.add(ee)}for(let ee of tt.unshallows)J.delete(ee);if(await ho.write({fs:r,gitdir:l,oids:J}),A){let ee=new Map([[Q,_e]]),Oe=new Map,Te=10,bt=Q;for(;Te--;){let jc=D.symrefs.get(bt);if(jc===void 0)break;Oe.set(bt,jc),bt=jc}let vn=F.get(bt);vn&&ee.set(bt,vn);let{pruned:Vr}=await q.updateRemoteRefs({fs:r,gitdir:l,remote:E,refs:ee,symrefs:Oe,tags:v,prune:S});S&&(tt.pruned=Vr)}else{let{pruned:ee}=await q.updateRemoteRefs({fs:r,gitdir:l,remote:E,refs:F,symrefs:D.symrefs,tags:v,prune:S,pruneTags:T});S&&(tt.pruned=ee)}if(tt.HEAD=D.symrefs.get("HEAD"),tt.HEAD===void 0){let{oid:ee}=q.resolveAgainstMap({ref:"HEAD",map:F});for(let[Oe,Te]of F.entries())if(Oe!=="HEAD"&&Te===ee){tt.HEAD=Oe;break}}let j=Q.startsWith("refs/tags")?"tag":"branch";if(tt.FETCH_HEAD={oid:_e,description:`${j} '${ra(Q)}' of ${k}`},n||i){let ee=ZA(tt.progress);zu(ee,async Oe=>{if(i&&await i(Oe),n){let Te=Oe.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);Te&&await n({phase:Te[1].trim(),loaded:parseInt(Te[2],10),total:parseInt(Te[3],10)})}})}let Ce=_.from(await uh(tt.packfile));if(vt.body.error)throw vt.body.error;let z=Ce.slice(-20).toString("hex"),we={defaultBranch:tt.HEAD,fetchHead:tt.FETCH_HEAD.oid,fetchHeadDescription:tt.FETCH_HEAD.description};if(tt.headers&&(we.headers=tt.headers),S&&(we.pruned=tt.pruned),z!==""&&!gH(Ce)){we.packfile=`objects/pack/pack-${z}.pack`;let ee=B(l,we.packfile);await r.write(ee,Ce);let Oe=bt=>pt({fs:r,cache:e,gitdir:l,oid:bt}),Te=await Eu.fromPack({pack:Ce,getExternalRefDelta:Oe,onProgress:n});await r.write(ee.replace(/\.pack$/,".idx"),await Te.toBuffer())}return we}async function XA({fs:r,bare:e=!1,dir:t,gitdir:n=e?t:B(t,".git"),defaultBranch:i="master"}){if(await r.exists(n+"/config"))return;let s=["hooks","info","objects/info","objects/pack","refs/heads","refs/tags"];s=s.map(o=>n+"/"+o);for(let o of s)await r.mkdir(o);await r.write(n+"/config",`[core]
repositoryformatversion = 0
filemode = false
bare = ${e}
`+(e?"":` logallrefupdates = true
`)+` symlinks = false
ignorecase = true
`),await r.write(n+"/HEAD",`ref: refs/heads/${i}
`)}async function yH({fs:r,cache:e,http:t,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:d,ref:h,remote:p,depth:m,since:w,exclude:y,relative:v,singleBranch:A,noCheckout:C,noTags:S,headers:T,nonBlocking:b,batchSize:x=100}){try{if(await XA({fs:r,gitdir:u}),await zA({fs:r,gitdir:u,remote:p,url:f,force:!1}),d){let $=await Tt.get({fs:r,gitdir:u});await $.set("http.corsProxy",d),await Tt.save({fs:r,gitdir:u,config:$})}let{defaultBranch:E,fetchHead:k}=await Sv({fs:r,cache:e,http:t,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,gitdir:u,ref:h,remote:p,corsProxy:d,depth:m,since:w,exclude:y,relative:v,singleBranch:A,headers:T,tags:!S});if(k===null)return;h=h||E,h=h.replace("refs/heads/",""),await Ev({fs:r,cache:e,onProgress:n,onPostCheckout:l,dir:c,gitdir:u,ref:h,remote:p,noCheckout:C,nonBlocking:b,batchSize:x})}catch(E){throw await r.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),E}}async function _H({fs:r,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:a,dir:l,gitdir:c=B(l,".git"),url:u,corsProxy:f=void 0,ref:d=void 0,remote:h="origin",depth:p=void 0,since:m=void 0,exclude:w=[],relative:y=!1,singleBranch:v=!1,noCheckout:A=!1,noTags:C=!1,headers:S={},cache:T={},nonBlocking:b=!1,batchSize:x=100}){try{I("fs",r),I("http",e),I("gitdir",c),A||I("dir",l),I("url",u);let E=new re(r),k=await le({fsp:E,dotgit:c});return await yH({fs:E,cache:T,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:a,dir:l,gitdir:k,url:u,corsProxy:f,ref:d,remote:h,depth:p,since:m,exclude:w,relative:y,singleBranch:v,noCheckout:A,noTags:C,headers:S,nonBlocking:b,batchSize:x})}catch(E){throw E.caller="git.clone",E}}async function xH({fs:r,onSign:e,dir:t,gitdir:n=B(t,".git"),message:i,author:s,committer:o,signingKey:a,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,disallowEmpty:f=!1,ref:d,parent:h,tree:p,cache:m={}}){try{I("fs",r),l||I("message",i),a&&I("onSign",e);let w=new re(r),y=await le({fsp:w,dotgit:n});return await Uu({fs:w,cache:m,onSign:e,gitdir:y,message:i,author:s,committer:o,signingKey:a,amend:l,dryRun:c,noUpdateBranch:u,disallowEmpty:f,ref:d,parent:h,tree:p})}catch(w){throw w.caller="git.commit",w}}async function EH({fs:r,dir:e,gitdir:t=B(e,".git"),fullname:n=!1,test:i=!1}){try{I("fs",r),I("gitdir",t);let s=new re(r),o=await le({fsp:s,dotgit:t});return await po({fs:s,gitdir:o,fullname:n,test:i})}catch(s){throw s.caller="git.currentBranch",s}}async function SH({fs:r,gitdir:e,ref:t}){if(t=t.startsWith("refs/heads/")?t:`refs/heads/${t}`,!await q.exists({fs:r,gitdir:e,ref:t}))throw new Be(t);let i=await q.expand({fs:r,gitdir:e,ref:t}),s=await po({fs:r,gitdir:e,fullname:!0});if(i===s){let l=await q.resolve({fs:r,gitdir:e,ref:i});await q.writeRef({fs:r,gitdir:e,ref:"HEAD",value:l})}await q.deleteRef({fs:r,gitdir:e,ref:i});let o=ra(t),a=await Tt.get({fs:r,gitdir:e});await a.deleteSection("branch",o),await Tt.save({fs:r,gitdir:e,config:a})}async function kH({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n}){try{I("fs",r),I("ref",n);let i=new re(r),s=await le({fsp:i,dotgit:t});return await SH({fs:i,gitdir:s,ref:n})}catch(i){throw i.caller="git.deleteBranch",i}}async function AH({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n}){try{I("fs",r),I("ref",n);let i=new re(r),s=await le({fsp:i,dotgit:t});await q.deleteRef({fs:i,gitdir:s,ref:n})}catch(i){throw i.caller="git.deleteRef",i}}async function CH({fs:r,gitdir:e,remote:t}){let n=await Tt.get({fs:r,gitdir:e});await n.deleteSection("remote",t),await Tt.save({fs:r,gitdir:e,config:n})}async function TH({fs:r,dir:e,gitdir:t=B(e,".git"),remote:n}){try{I("fs",r),I("remote",n);let i=new re(r),s=await le({fsp:i,dotgit:t});return await CH({fs:i,gitdir:s,remote:n})}catch(i){throw i.caller="git.deleteRemote",i}}async function RH({fs:r,gitdir:e,ref:t}){t=t.startsWith("refs/tags/")?t:`refs/tags/${t}`,await q.deleteRef({fs:r,gitdir:e,ref:t})}async function $H({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n}){try{I("fs",r),I("ref",n);let i=new re(r),s=await le({fsp:i,dotgit:t});return await RH({fs:i,gitdir:s,ref:n})}catch(i){throw i.caller="git.deleteTag",i}}async function PH({fs:r,gitdir:e,oid:t}){let n=t.slice(0,2);return(await r.readdir(`${e}/objects/${n}`)).map(s=>`${n}${s}`).filter(s=>s.startsWith(t))}async function IH({fs:r,cache:e,gitdir:t,oid:n,getExternalRefDelta:i}){let s=[],o=await r.readdir(B(t,"objects/pack"));o=o.filter(a=>a.endsWith(".idx"));for(let a of o){let l=`${t}/objects/pack/${a}`,c=await _v({fs:r,cache:e,filename:l,getExternalRefDelta:i});if(c.error)throw new be(c.error);for(let u of c.offsets.keys())u.startsWith(n)&&s.push(u)}return s}async function OH({fs:r,cache:e,gitdir:t,oid:n}){let i=a=>pt({fs:r,cache:e,gitdir:t,oid:a}),s=await PH({fs:r,gitdir:t,oid:n}),o=await IH({fs:r,cache:e,gitdir:t,oid:n,getExternalRefDelta:i});for(let a of o)s.indexOf(a)===-1&&s.push(a);if(s.length===1)return s[0];throw s.length>1?new Su("oids",n,s):new Be(`an object matching "${n}"`)}async function FH({fs:r,dir:e,gitdir:t=B(e,".git"),oid:n,cache:i={}}){try{I("fs",r),I("gitdir",t),I("oid",n);let s=new re(r),o=await le({fsp:s,dotgit:t});return await OH({fs:s,cache:i,gitdir:o,oid:n})}catch(s){throw s.caller="git.expandOid",s}}async function MH({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n}){try{I("fs",r),I("gitdir",t),I("ref",n);let i=new re(r),s=await le({fsp:i,dotgit:t});return await q.expand({fs:i,gitdir:s,ref:n})}catch(i){throw i.caller="git.expandRef",i}}async function kv({fs:r,cache:e,gitdir:t,oids:n}){let i={},s=n.length,o=new Set,a=new Map,l=await ho.read({fs:r,gitdir:t}),c=async d=>{if(a.has(d))return a.get(d);let{object:h,type:p}=await pt({fs:r,cache:e,gitdir:t,oid:d});if(p!=="commit")throw new sr(d,p,"commit");let m=Qr.from(h),{parent:w}=m.parseHeaders(),y=l.has(d)?[]:w;return a.set(d,y),y},u=n.map((d,h)=>({index:h,oid:d}));for(;u.length;){for(let{oid:h,index:p}of u)await c(h),i[h]||(i[h]=new Set),i[h].add(p),i[h].size===s&&o.add(h);let d=new Map;for(let{oid:h,index:p}of u)if(!o.has(h))for(let m of await c(h))(!i[m]||!i[m].has(p))&&d.set(m+":"+p,{oid:m,index:p});u=Array.from(d.values())}if(o.size<2)return[...o];let f=new Set;for(let d of o){let h=[...await c(d)],p=new Set;for(;h.length;){let m=h.pop();p.has(m)||(p.add(m),o.has(m)?f.add(m):h.push(...await c(m)))}}return[...o].filter(d=>!f.has(d))}async function QA({fs:r,cache:e,dir:t,gitdir:n,ours:i,theirs:s,fastForward:o=!0,fastForwardOnly:a=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,onSign:m,mergeDriver:w,allowUnrelatedHistories:y=!1}){i===void 0&&(i=await po({fs:r,gitdir:n,fullname:!0})),i=await q.expand({fs:r,gitdir:n,ref:i}),s=await q.expand({fs:r,gitdir:n,ref:s});let v=await q.resolve({fs:r,gitdir:n,ref:i}),{oid:A}=await Gu({fs:r,cache:e,gitdir:n,oid:await q.resolve({fs:r,gitdir:n,ref:s})}),C=await kv({fs:r,cache:e,gitdir:n,oids:[v,A]});if(C.length!==1)if(C.length===0&&y)C.push("4b825dc642cb6eb9a060e54bf8d69288fbee4904");else throw new $l;let S=C[0];if(S===A)return{oid:v,alreadyMerged:!0};if(o&&S===v)return!l&&!c&&await q.writeRef({fs:r,gitdir:n,ref:i,value:A}),{oid:A,fastForward:!0};{if(a)throw new Pu;let T=await Ct.acquire({fs:r,gitdir:n,cache:e,allowUnmerged:!1},async x=>WA({fs:r,cache:e,dir:t,gitdir:n,index:x,ourOid:v,theirOid:A,baseOid:S,ourName:ra(i),baseName:"base",theirName:ra(s),dryRun:l,abortOnConflict:u,mergeDriver:w}));if(T instanceof oa)throw T;return f||(f=`Merge branch '${ra(s)}' into ${ra(i)}`),{oid:await Uu({fs:r,cache:e,gitdir:n,message:f,ref:i,tree:T,parent:[v,A],author:d,committer:h,signingKey:p,onSign:m,dryRun:l,noUpdateBranch:c}),tree:T,mergeCommit:!0}}}async function JA({fs:r,cache:e,http:t,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,dir:l,gitdir:c,ref:u,url:f,remote:d,remoteRef:h,prune:p,pruneTags:m,fastForward:w,fastForwardOnly:y,corsProxy:v,singleBranch:A,headers:C,author:S,committer:T,signingKey:b}){try{if(!u){let k=await po({fs:r,gitdir:c});if(!k)throw new Kr("ref");u=k}let{fetchHead:x,fetchHeadDescription:E}=await Sv({fs:r,cache:e,http:t,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,gitdir:c,corsProxy:v,ref:u,url:f,remote:d,remoteRef:h,singleBranch:A,headers:C,prune:p,pruneTags:m});await QA({fs:r,cache:e,gitdir:c,ours:u,theirs:x,fastForward:w,fastForwardOnly:y,message:`Merge ${E}`,author:S,committer:T,signingKey:b,dryRun:!1,noUpdateBranch:!1}),await Ev({fs:r,cache:e,onProgress:n,dir:l,gitdir:c,ref:u,remote:d,noCheckout:!1})}catch(x){throw x.caller="git.pull",x}}async function DH({fs:r,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,dir:a,gitdir:l=B(a,".git"),ref:c,url:u,remote:f,remoteRef:d,corsProxy:h,singleBranch:p,headers:m={},cache:w={}}){try{I("fs",r),I("http",e),I("gitdir",l);let y={name:"",email:"",timestamp:Date.now(),timezoneOffset:0},v=new re(r),A=await le({fsp:v,dotgit:l});return await JA({fs:v,cache:w,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,dir:a,gitdir:A,ref:c,url:u,remote:f,remoteRef:d,fastForwardOnly:!0,corsProxy:h,singleBranch:p,headers:m,author:y,committer:y})}catch(y){throw y.caller="git.fastForward",y}}async function LH({fs:r,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,dir:a,gitdir:l=B(a,".git"),ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:p=null,since:m=null,exclude:w=[],relative:y=!1,tags:v=!1,singleBranch:A=!1,headers:C={},prune:S=!1,pruneTags:T=!1,cache:b={}}){try{I("fs",r),I("http",e),I("gitdir",l);let x=new re(r),E=await le({fsp:x,dotgit:l});return await Sv({fs:x,cache:b,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,gitdir:E,ref:c,remote:u,remoteRef:f,url:d,corsProxy:h,depth:p,since:m,exclude:w,relative:y,tags:v,singleBranch:A,headers:C,prune:S,pruneTags:T})}catch(x){throw x.caller="git.fetch",x}}async function NH({fs:r,dir:e,gitdir:t=B(e,".git"),oids:n,cache:i={}}){try{I("fs",r),I("gitdir",t),I("oids",n);let s=new re(r),o=await le({fsp:s,dotgit:t});return await kv({fs:s,cache:i,gitdir:o,oids:n})}catch(s){throw s.caller="git.findMergeBase",s}}async function eC({fs:r,filepath:e}){if(await r.exists(B(e,".git")))return e;{let t=sa(e);if(t===e)throw new Be(`git root for ${e}`);return eC({fs:r,filepath:t})}}async function BH({fs:r,filepath:e}){try{return I("fs",r),I("filepath",e),await eC({fs:new re(r),filepath:e})}catch(t){throw t.caller="git.findRoot",t}}async function HH({fs:r,dir:e,gitdir:t=B(e,".git"),path:n}){try{I("fs",r),I("gitdir",t),I("path",n);let i=new re(r),s=await le({fsp:i,dotgit:t});return await Bu({fs:i,gitdir:s,path:n})}catch(i){throw i.caller="git.getConfig",i}}async function GH({fs:r,gitdir:e,path:t}){return(await Tt.get({fs:r,gitdir:e})).getall(t)}async function UH({fs:r,dir:e,gitdir:t=B(e,".git"),path:n}){try{I("fs",r),I("gitdir",t),I("path",n);let i=new re(r),s=await le({fsp:i,dotgit:t});return await GH({fs:i,gitdir:s,path:n})}catch(i){throw i.caller="git.getConfigAll",i}}function yA(r,e,t){let n=e.split("/"),i=n.pop();if(i==="__proto__"||n.includes("__proto__"))return;let s=r;for(let o of n)Object.prototype.hasOwnProperty.call(s,o)||(s[o]={}),s=s[o];s[i]=t}async function jH({http:r,onAuth:e,onAuthSuccess:t,onAuthFailure:n,corsProxy:i,url:s,headers:o={},forPush:a=!1}){try{I("http",r),I("url",s);let c=await Ml.getRemoteHelperFor({url:s}).discover({http:r,onAuth:e,onAuthSuccess:t,onAuthFailure:n,corsProxy:i,service:a?"git-receive-pack":"git-upload-pack",url:s,headers:o,protocolVersion:1}),u={capabilities:[...c.capabilities]};for(let[f,d]of c.refs)yA(u,f,d);for(let[f,d]of c.symrefs)yA(u,f,d);return u}catch(l){throw l.caller="git.getRemoteInfo",l}}function tC(r,e,t,n){let i=[];for(let[s,o]of r.refs){if(e&&!s.startsWith(e))continue;if(s.endsWith("^{}")){if(n){let l=s.replace("^{}",""),c=i[i.length-1],u=(c==null?void 0:c.ref)===l?c:i.find(f=>f.ref===l);u!==void 0&&(u.peeled=o)}continue}let a={ref:s,oid:o};t&&r.symrefs.has(s)&&(a.target=r.symrefs.get(s)),i.push(a)}return i}async function zH({http:r,onAuth:e,onAuthSuccess:t,onAuthFailure:n,corsProxy:i,url:s,headers:o={},forPush:a=!1,protocolVersion:l=2}){try{I("http",r),I("url",s);let u=await Ml.getRemoteHelperFor({url:s}).discover({http:r,onAuth:e,onAuthSuccess:t,onAuthFailure:n,corsProxy:i,service:a?"git-receive-pack":"git-upload-pack",url:s,headers:o,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:tC(u,void 0,!0,!0)}}catch(c){throw c.caller="git.getRemoteInfo2",c}}async function VH({type:r,object:e,format:t="content",oid:n=void 0}){return t!=="deflated"&&(t!=="wrapped"&&(e=Ss.wrap({type:r,object:e})),n=await mi(e)),{oid:n,object:e}}async function WH({object:r}){try{I("object",r),typeof r=="string"?r=_.from(r,"utf8"):r instanceof Uint8Array||(r=new Uint8Array(r));let e="blob",{oid:t,object:n}=await VH({type:e,format:"content",object:r});return{oid:t,type:e,object:n,format:"wrapped"}}catch(e){throw e.caller="git.hashBlob",e}}async function qH({fs:r,cache:e,onProgress:t,dir:n,gitdir:i,filepath:s}){try{s=B(n,s);let o=await r.read(s),a=c=>pt({fs:r,cache:e,gitdir:i,oid:c}),l=await Eu.fromPack({pack:o,getExternalRefDelta:a,onProgress:t});return await r.write(s.replace(/\.pack$/,".idx"),await l.toBuffer()),{oids:[...l.hashes]}}catch(o){throw o.caller="git.indexPack",o}}async function YH({fs:r,onProgress:e,dir:t,gitdir:n=B(t,".git"),filepath:i,cache:s={}}){try{I("fs",r),I("dir",t),I("gitdir",t),I("filepath",i);let o=new re(r),a=await le({fsp:o,dotgit:n});return await qH({fs:o,cache:s,onProgress:e,dir:t,gitdir:a,filepath:i})}catch(o){throw o.caller="git.indexPack",o}}async function KH({fs:r,bare:e=!1,dir:t,gitdir:n=e?t:B(t,".git"),defaultBranch:i="master"}){try{I("fs",r),I("gitdir",n),e||I("dir",t);let s=new re(r),o=await le({fsp:s,dotgit:n});return await XA({fs:s,bare:e,dir:t,gitdir:o,defaultBranch:i})}catch(s){throw s.caller="git.init",s}}async function rC({fs:r,cache:e,gitdir:t,oid:n,ancestor:i,depth:s}){let o=await ho.read({fs:r,gitdir:t});if(!n)throw new Kr("oid");if(!i)throw new Kr("ancestor");if(n===i)return!1;let a=[n],l=new Set,c=0;for(;a.length;){if(c++===s)throw new Ou(s);let u=a.shift(),{type:f,object:d}=await pt({fs:r,cache:e,gitdir:t,oid:u});if(f!=="commit")throw new sr(u,f,"commit");let h=Qr.from(d).parse();for(let p of h.parent)if(p===i)return!0;if(!o.has(u))for(let p of h.parent)l.has(p)||(a.push(p),l.add(p))}return!1}async function ZH({fs:r,dir:e,gitdir:t=B(e,".git"),oid:n,ancestor:i,depth:s=-1,cache:o={}}){try{I("fs",r),I("gitdir",t),I("oid",n),I("ancestor",i);let a=new re(r),l=await le({fsp:a,dotgit:t});return await rC({fs:a,cache:o,gitdir:l,oid:n,ancestor:i,depth:s})}catch(a){throw a.caller="git.isDescendent",a}}async function XH({fs:r,dir:e,gitdir:t=B(e,".git"),filepath:n}){try{I("fs",r),I("dir",e),I("gitdir",t),I("filepath",n);let i=new re(r),s=await le({fsp:i,dotgit:t});return uo.isIgnored({fs:i,dir:e,gitdir:s,filepath:n})}catch(i){throw i.caller="git.isIgnored",i}}async function QH({fs:r,dir:e,gitdir:t=B(e,".git"),remote:n}){try{I("fs",r),I("gitdir",t);let i=new re(r),s=await le({fsp:i,dotgit:t});return q.listBranches({fs:i,gitdir:s,remote:n})}catch(i){throw i.caller="git.listBranches",i}}async function JH({fs:r,gitdir:e,ref:t,cache:n}){if(t){let i=await q.resolve({gitdir:e,fs:r,ref:t}),s=[];return await nC({fs:r,cache:n,gitdir:e,oid:i,filenames:s,prefix:""}),s}else return Ct.acquire({fs:r,gitdir:e,cache:n},async function(i){return i.entries.map(s=>s.path)})}async function nC({fs:r,cache:e,gitdir:t,oid:n,filenames:i,prefix:s}){let{tree:o}=await Ll({fs:r,cache:e,gitdir:t,oid:n});for(let a of o)a.type==="tree"?await nC({fs:r,cache:e,gitdir:t,oid:a.oid,filenames:i,prefix:B(s,a.path)}):i.push(B(s,a.path))}async function e3({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n,cache:i={}}){try{I("fs",r),I("gitdir",t);let s=new re(r),o=await le({fsp:s,dotgit:t});return await JH({fs:s,cache:i,gitdir:o,ref:n})}catch(s){throw s.caller="git.listFiles",s}}async function t3({fs:r,cache:e,gitdir:t,ref:n}){let i;try{i=await q.resolve({gitdir:t,fs:r,ref:n})}catch(a){if(a instanceof Be)return[];throw a}return(await Ll({fs:r,cache:e,gitdir:t,oid:i})).tree.map(a=>({target:a.path,note:a.oid}))}async function r3({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n="refs/notes/commits",cache:i={}}){try{I("fs",r),I("gitdir",t),I("ref",n);let s=new re(r),o=await le({fsp:s,dotgit:t});return await t3({fs:s,cache:i,gitdir:o,ref:n})}catch(s){throw s.caller="git.listNotes",s}}async function n3({fs:r,dir:e,gitdir:t=B(e,".git"),filepath:n}){try{I("fs",r),I("gitdir",t);let i=new re(r),s=await le({fsp:i,dotgit:t});return q.listRefs({fs:i,gitdir:s,filepath:n})}catch(i){throw i.caller="git.listRefs",i}}async function i3({fs:r,gitdir:e}){let t=await Tt.get({fs:r,gitdir:e}),n=await t.getSubsections("remote");return Promise.all(n.map(async s=>{let o=await t.get(`remote.${s}.url`);return{remote:s,url:o}}))}async function s3({fs:r,dir:e,gitdir:t=B(e,".git")}){try{I("fs",r),I("gitdir",t);let n=new re(r),i=await le({fsp:n,dotgit:t});return await i3({fs:n,gitdir:i})}catch(n){throw n.caller="git.listRemotes",n}}async function o3(r){let e=At.streamReader(r),t=[],n;for(;n=await e(),n!==!0;){if(n===null)continue;n=n.toString("utf8").replace(/\n$/,"");let[i,s,...o]=n.split(" "),a={ref:s,oid:i};for(let l of o){let[c,u]=l.split(":");c==="symref-target"?a.target=u:c==="peeled"&&(a.peeled=u)}t.push(a)}return t}async function a3({prefix:r,symrefs:e,peelTags:t}){let n=[];return n.push(At.encode(`command=ls-refs
`)),n.push(At.encode(`agent=${vh.agent}
`)),(t||e||r)&&n.push(At.delim()),t&&n.push(At.encode("peel")),e&&n.push(At.encode("symrefs")),r&&n.push(At.encode(`ref-prefix ${r}`)),n.push(At.flush()),n}async function l3({http:r,onAuth:e,onAuthSuccess:t,onAuthFailure:n,corsProxy:i,url:s,headers:o={},forPush:a=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{I("http",r),I("url",s);let d=await Fl.discover({http:r,onAuth:e,onAuthSuccess:t,onAuthFailure:n,corsProxy:i,service:a?"git-receive-pack":"git-upload-pack",url:s,headers:o,protocolVersion:l});if(d.protocolVersion===1)return tC(d,c,u,f);let h=await a3({prefix:c,symrefs:u,peelTags:f}),p=await Fl.connect({http:r,auth:d.auth,headers:o,corsProxy:i,service:a?"git-receive-pack":"git-upload-pack",url:s,body:h});return o3(p.body)}catch(d){throw d.caller="git.listServerRefs",d}}async function c3({fs:r,dir:e,gitdir:t=B(e,".git")}){try{I("fs",r),I("gitdir",t);let n=new re(r),i=await le({fsp:n,dotgit:t});return q.listTags({fs:n,gitdir:i})}catch(n){throw n.caller="git.listTags",n}}function u3(r,e){return r.committer.timestamp-e.committer.timestamp}var f3="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function _A({fs:r,cache:e,gitdir:t,oid:n,fileId:i}){if(i===f3)return;let s=n,o,a=await Ol({fs:r,cache:e,gitdir:t,oid:n}),l=a.tree;return i===a.oid?o=a.path:(o=await iC({fs:r,cache:e,gitdir:t,tree:l,fileId:i,oid:s}),Array.isArray(o)&&(o.length===0?o=void 0:o.length===1&&(o=o[0]))),o}async function iC({fs:r,cache:e,gitdir:t,tree:n,fileId:i,oid:s,filepaths:o=[],parentPath:a=""}){let l=n.entries().map(function(c){let u;return c.oid===i?(u=B(a,c.path),o.push(u)):c.type==="tree"&&(u=pt({fs:r,cache:e,gitdir:t,oid:c.oid}).then(function({object:f}){return iC({fs:r,cache:e,gitdir:t,tree:Zr.from(f),fileId:i,oid:s,filepaths:o,parentPath:B(a,c.path)})})),u});return await Promise.all(l),o}async function d3({fs:r,cache:e,gitdir:t,filepath:n,ref:i,depth:s,since:o,author:a,force:l,follow:c,includeChanges:u}){let f=typeof o=="undefined"?void 0:Math.floor(o.valueOf()/1e3),d=a==null?void 0:new RegExp(a,"i"),h=({commit:x})=>d===void 0?!0:x.author?d.test(`${x.author.name} <${x.author.email}>`):!1,p=[],m=x=>{h(x)&&p.push(x)},w=await ho.read({fs:r,gitdir:t}),y=await q.resolve({fs:r,gitdir:t,ref:i}),v=[await Yi({fs:r,cache:e,gitdir:t,oid:y})],A,C,S,T;function b(x){T&&n&&m(x)}for(;v.length>0;){let x=v.pop();if(f!==void 0&&x.commit.committer.timestamp<=f)break;if(n){let E;try{E=await UA({fs:r,cache:e,gitdir:t,oid:x.commit.tree,filepath:n}),S&&(A!==E.oid||C!==E.mode)&&m(S),A=E.oid,C=E.mode,S=x,T=!0}catch(k){if(k instanceof Be){let $=c&&A;if($&&($=await _A({fs:r,cache:e,gitdir:t,oid:x.commit.tree,fileId:A}),$))if(Array.isArray($)){if(S){let M=await _A({fs:r,cache:e,gitdir:t,oid:S.commit.tree,fileId:A});if(Array.isArray(M))if($=$.filter(D=>M.indexOf(D)===-1),$.length===1)$=$[0],n=$,S&&m(S);else{$=!1,S&&m(S);break}}}else n=$,S&&m(S);if(!$){if(T&&A&&(m(S),!l))break;if(!l&&!c)throw k}S=x,T=!1}else throw k}}else m(x);if(s!==void 0&&p.length===s){b(x);break}if(!w.has(x.oid))for(let E of x.commit.parent){let k=await Yi({fs:r,cache:e,gitdir:t,oid:E});v.map($=>$.oid).includes(k.oid)||v.push(k)}v.length===0&&b(x),v.sort((E,k)=>u3(E.commit,k.commit))}if(u)for(let x of p)x.commit.changes=await h3({fs:r,cache:e,gitdir:t,commit:x,shallow:w.has(x.oid)});return p}async function h3({fs:r,cache:e,gitdir:t,commit:n,shallow:i}){let s=i||!n.commit.parent[0]?"4b825dc642cb6eb9a060e54bf8d69288fbee4904":n.commit.parent[0];return vi({fs:r,cache:e,gitdir:t,trees:[mr({ref:n.oid}),mr({ref:s})],map:async(o,[a,l])=>{let[c,u]=await Promise.all([a&&a.type(),l&&l.type()]);if(c==="tree")return u&&u!=="tree"?[null,await l.oid(),o]:void 0;if(u==="tree")return c?[await a.oid(),null,o]:void 0;let[f,d]=await Promise.all([a?a.oid():null,l?l.oid():null]);if(f!==d)return[f,d,o]}})}async function p3({fs:r,dir:e,gitdir:t=B(e,".git"),filepath:n,ref:i="HEAD",depth:s,since:o,author:a,force:l,follow:c,includeChanges:u=!1,cache:f={}}){try{I("fs",r),I("gitdir",t),I("ref",i);let d=new re(r),h=await le({fsp:d,dotgit:t});return await d3({fs:d,cache:f,gitdir:h,filepath:n,ref:i,depth:s,since:o,author:a,force:l,follow:c,includeChanges:u})}catch(d){throw d.caller="git.log",d}}async function m3({fs:r,onSign:e,dir:t,gitdir:n=B(t,".git"),ours:i,theirs:s,fastForward:o=!0,fastForwardOnly:a=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:d,committer:h,signingKey:p,cache:m={},mergeDriver:w,allowUnrelatedHistories:y=!1}){try{I("fs",r),p&&I("onSign",e);let v=new re(r),A=await le({fsp:v,dotgit:n}),C=await fo({fs:v,gitdir:A,author:d});if(!C&&(!a||!o))throw new gr("author");let S=await la({fs:v,gitdir:A,author:C,committer:h});if(!S&&(!a||!o))throw new gr("committer");return await QA({fs:v,cache:m,dir:t,gitdir:A,ours:i,theirs:s,fastForward:o,fastForwardOnly:a,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:C,committer:S,signingKey:p,onSign:e,mergeDriver:w,allowUnrelatedHistories:y})}catch(v){throw v.caller="git.merge",v}}var g3={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function sC({fs:r,cache:e,dir:t,gitdir:n=B(t,".git"),oids:i}){let s=new yv.default,o=[];function a(u,f){let d=_.from(u,f);o.push(d),s.update(d)}async function l({stype:u,object:f}){let d=g3[u],h=f.length,p=h>15?128:0,m=h&15;h=h>>>4;let w=(p|d|m).toString(16);for(a(w,"hex");p;)p=h>127?128:0,w=p|h&127,a(bv(2,w),"hex"),h=h>>>7;a(_.from(await NA(f)))}a("PACK"),a("00000002","hex"),a(bv(8,i.length),"hex");for(let u of i){let{type:f,object:d}=await pt({fs:r,cache:e,gitdir:n,oid:u});await l({write:a,object:d,stype:f})}let c=s.digest();return o.push(c),o}async function w3({fs:r,cache:e,gitdir:t,oids:n,write:i}){let s=await sC({fs:r,cache:e,gitdir:t,oids:n}),o=_.from(await uh(s)),l=`pack-${o.slice(-20).toString("hex")}.pack`;return i?(await r.write(B(t,`objects/pack/${l}`),o),{filename:l}):{filename:l,packfile:new Uint8Array(o)}}async function v3({fs:r,dir:e,gitdir:t=B(e,".git"),oids:n,write:i=!1,cache:s={}}){try{I("fs",r),I("gitdir",t),I("oids",n);let o=new re(r),a=await le({fsp:o,dotgit:t});return await w3({fs:o,cache:s,gitdir:a,oids:n,write:i})}catch(o){throw o.caller="git.packObjects",o}}async function b3({fs:r,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,dir:a,gitdir:l=B(a,".git"),ref:c,url:u,remote:f,remoteRef:d,prune:h=!1,pruneTags:p=!1,fastForward:m=!0,fastForwardOnly:w=!1,corsProxy:y,singleBranch:v,headers:A={},author:C,committer:S,signingKey:T,cache:b={}}){try{I("fs",r),I("gitdir",l);let x=new re(r),E=await le({fsp:x,dotgit:l}),k=await fo({fs:x,gitdir:E,author:C});if(!k)throw new gr("author");let $=await la({fs:x,gitdir:E,author:k,committer:S});if(!$)throw new gr("committer");return await JA({fs:x,cache:b,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,dir:a,gitdir:E,ref:c,url:u,remote:f,remoteRef:d,fastForward:m,fastForwardOnly:w,corsProxy:y,singleBranch:v,headers:A,author:k,committer:$,signingKey:T,prune:h,pruneTags:p})}catch(x){throw x.caller="git.pull",x}}async function y3({fs:r,cache:e,dir:t,gitdir:n=B(t,".git"),start:i,finish:s}){let o=await ho.read({fs:r,gitdir:n}),a=new Set,l=new Set;for(let f of i)a.add(await q.resolve({fs:r,gitdir:n,ref:f}));for(let f of s)try{let d=await q.resolve({fs:r,gitdir:n,ref:f});l.add(d)}catch(d){}let c=new Set;async function u(f){c.add(f);let{type:d,object:h}=await pt({fs:r,cache:e,gitdir:n,oid:f});if(d==="tag"){let m=Xr.from(h).headers().object;return u(m)}if(d!=="commit")throw new sr(f,d,"commit");if(!o.has(f)){let m=Qr.from(h).headers().parent;for(f of m)!l.has(f)&&!c.has(f)&&await u(f)}}for(let f of a)await u(f);return c}async function tv({fs:r,cache:e,dir:t,gitdir:n=B(t,".git"),oids:i}){let s=new Set;async function o(a){if(s.has(a))return;s.add(a);let{type:l,object:c}=await pt({fs:r,cache:e,gitdir:n,oid:a});if(l==="tag"){let f=Xr.from(c).headers().object;await o(f)}else if(l==="commit"){let f=Qr.from(c).headers().tree;await o(f)}else if(l==="tree"){let u=Zr.from(c);for(let f of u)f.type==="blob"&&s.add(f.oid),f.type==="tree"&&await o(f.oid)}}for(let a of i)await o(a);return s}async function _3(r){let e={},t="",n=At.streamReader(r),i=await n();for(;i!==!0;)i!==null&&(t+=i.toString("utf8")+`
`),i=await n();let s=t.toString("utf8").split(`
`);if(i=s.shift(),!i.startsWith("unpack "))throw new gi('unpack ok" or "unpack [error message]',i);e.ok=i==="unpack ok",e.ok||(e.error=i.slice(7)),e.refs={};for(let o of s){if(o.trim()==="")continue;let a=o.slice(0,2),l=o.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:a==="ok",error:f}}return e}async function x3({capabilities:r=[],triplets:e=[]}){let t=[],n=`\0 ${r.join(" ")}`;for(let i of e)t.push(At.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${n}
`)),n="";return t.push(At.flush()),t}async function E3({fs:r,cache:e,http:t,onProgress:n,onMessage:i,onAuth:s,onAuthSuccess:o,onAuthFailure:a,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:d,url:h,force:p=!1,delete:m=!1,corsProxy:w,headers:y={},signal:v}){let A=u||await po({fs:r,gitdir:c});if(typeof A=="undefined")throw new Kr("ref");let C=await Tt.get({fs:r,gitdir:c});d=d||await C.get(`branch.${A}.pushRemote`)||await C.get("remote.pushDefault")||await C.get(`branch.${A}.remote`)||"origin";let S=h||await C.get(`remote.${d}.pushurl`)||await C.get(`remote.${d}.url`);if(typeof S=="undefined")throw new Kr("remote OR url");let T=f||await C.get(`branch.${A}.merge`);if(typeof S=="undefined")throw new Kr("remoteRef");w===void 0&&(w=await C.get("http.corsProxy"));let b=await q.expand({fs:r,gitdir:c,ref:A}),x=m?"0000000000000000000000000000000000000000":await q.resolve({fs:r,gitdir:c,ref:b}),E=Ml.getRemoteHelperFor({url:S}),k=await E.discover({http:t,onAuth:fh({config:C,onAuth:s}),onAuthSuccess:o,onAuthFailure:fh({config:C,onAuth:a}),corsProxy:w,service:"git-receive-pack",url:S,headers:y,protocolVersion:1,signal:v}),$=k.auth,M;if(!T)M=b;else try{M=await q.expandAgainstMap({ref:T,map:k.refs})}catch(U){if(U instanceof Be)M=T.startsWith("refs/")?T:`refs/heads/${T}`;else throw U}let D=k.refs.get(M)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:d,url:S,localRef:{ref:m?"(delete)":b,oid:x},remoteRef:{ref:M,oid:D}}))throw new Il;let P=!k.capabilities.has("no-thin"),F=new Set;if(!m){let U=[...k.refs.values()],et=new Set;if(D!=="0000000000000000000000000000000000000000"){let se=[];try{se=await kv({fs:r,cache:e,gitdir:c,oids:[x,D]})}catch(vt){se=[]}for(let vt of se)U.push(vt);P&&(et=await tv({fs:r,cache:e,gitdir:c,oids:se}))}if(!U.includes(x)){let se=await y3({fs:r,cache:e,gitdir:c,start:[x],finish:U});F=await tv({fs:r,cache:e,gitdir:c,oids:se})}if(P){try{let se=await q.resolve({fs:r,gitdir:c,ref:`refs/remotes/${d}/HEAD`,depth:2}),{oid:vt}=await q.resolveAgainstMap({ref:se.replace(`refs/remotes/${d}/`,""),fullref:se,map:k.refs}),tt=[vt];for(let j of await tv({fs:r,cache:e,gitdir:c,oids:tt}))et.add(j)}catch(se){}for(let se of et)F.delete(se)}if(x===D&&(p=!0),!p){if(b.startsWith("refs/tags")&&D!=="0000000000000000000000000000000000000000")throw new Pl("tag-exists");if(x!=="0000000000000000000000000000000000000000"&&D!=="0000000000000000000000000000000000000000"&&!await rC({fs:r,cache:e,gitdir:c,oid:x,ancestor:D,depth:-1}))throw new Pl("not-fast-forward")}}let _e=KA([...k.capabilities],["report-status","side-band-64k",`agent=${vh.agent}`]),Q=await x3({capabilities:_e,triplets:[{oldoid:D,oid:x,fullRef:M}]}),oe=m?[]:await sC({fs:r,cache:e,gitdir:c,oids:[...F]}),fe=await E.connect({http:t,onProgress:n,corsProxy:w,service:"git-receive-pack",url:S,auth:$,headers:y,body:[...Q,...oe],signal:v}),{packfile:Z,progress:Y}=await dh.demux(fe.body);if(i){let U=ZA(Y);zu(U,async et=>{await i(et)})}let J=await _3(Z);if(fe.headers&&(J.headers=fe.headers),d&&J.ok&&J.refs[M].ok&&!b.startsWith("refs/tags")){let U=`refs/remotes/${d}/${M.replace("refs/heads/","")}`;m?await q.deleteRef({fs:r,gitdir:c,ref:U}):await q.writeRef({fs:r,gitdir:c,ref:U,value:x})}if(J.ok&&Object.values(J.refs).every(U=>U.ok))return J;{let U=Object.entries(J.refs).filter(([et,se])=>!se.ok).map(([et,se])=>`
- ${et}: ${se.error}`).join("");throw new Iu(U,J)}}async function S3({fs:r,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,onPrePush:a,dir:l,gitdir:c=B(l,".git"),ref:u,remoteRef:f,remote:d="origin",url:h,force:p=!1,delete:m=!1,corsProxy:w,headers:y={},cache:v={},signal:A}){try{I("fs",r),I("http",e),I("gitdir",c);let C=new re(r),S=await le({fsp:C,dotgit:c});return await E3({fs:C,cache:v,http:e,onProgress:t,onMessage:n,onAuth:i,onAuthSuccess:s,onAuthFailure:o,onPrePush:a,gitdir:S,ref:u,remoteRef:f,remote:d,url:h,force:p,delete:m,corsProxy:w,headers:y,signal:A})}catch(C){throw C.caller="git.push",C}}async function oC({fs:r,cache:e,gitdir:t,oid:n}){let{type:i,object:s}=await pt({fs:r,cache:e,gitdir:t,oid:n});if(i==="tag")return n=Xr.from(s).parse().object,oC({fs:r,cache:e,gitdir:t,oid:n});if(i!=="blob")throw new sr(n,i,"blob");return{oid:n,blob:new Uint8Array(s)}}async function aC({fs:r,cache:e,gitdir:t,oid:n,filepath:i=void 0}){return i!==void 0&&(n=await wh({fs:r,cache:e,gitdir:t,oid:n,filepath:i})),await oC({fs:r,cache:e,gitdir:t,oid:n})}async function Nl({fs:r,dir:e,gitdir:t=B(e,".git"),oid:n,filepath:i,cache:s={}}){try{I("fs",r),I("gitdir",t),I("oid",n);let o=new re(r),a=await le({fsp:o,dotgit:t});return await aC({fs:o,cache:s,gitdir:a,oid:n,filepath:i})}catch(o){throw o.caller="git.readBlob",o}}async function lC({fs:r,dir:e,gitdir:t=B(e,".git"),oid:n,cache:i={}}){try{I("fs",r),I("gitdir",t),I("oid",n);let s=new re(r),o=await le({fsp:s,dotgit:t});return await Yi({fs:s,cache:i,gitdir:o,oid:n})}catch(s){throw s.caller="git.readCommit",s}}async function k3({fs:r,cache:e,gitdir:t,ref:n="refs/notes/commits",oid:i}){let s=await q.resolve({gitdir:t,fs:r,ref:n}),{blob:o}=await aC({fs:r,cache:e,gitdir:t,oid:s,filepath:i});return o}async function A3({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n="refs/notes/commits",oid:i,cache:s={}}){try{I("fs",r),I("gitdir",t),I("ref",n),I("oid",i);let o=new re(r),a=await le({fsp:o,dotgit:t});return await k3({fs:o,cache:s,gitdir:a,ref:n,oid:i})}catch(o){throw o.caller="git.readNote",o}}async function C3({fs:r,dir:e,gitdir:t=B(e,".git"),oid:n,format:i="parsed",filepath:s=void 0,encoding:o=void 0,cache:a={}}){try{I("fs",r),I("gitdir",t),I("oid",n);let l=new re(r),c=await le({fsp:l,dotgit:t});s!==void 0&&(n=await wh({fs:l,cache:a,gitdir:c,oid:n,filepath:s}));let f=await pt({fs:l,cache:a,gitdir:c,oid:n,format:i==="parsed"?"content":i});if(f.oid=n,i==="parsed")switch(f.format="parsed",f.type){case"commit":f.object=Qr.from(f.object).parse();break;case"tree":f.object=Zr.from(f.object).entries();break;case"blob":o?f.object=f.object.toString(o):(f.object=new Uint8Array(f.object),f.format="content");break;case"tag":f.object=Xr.from(f.object).parse();break;default:throw new sr(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 T3({fs:r,cache:e,gitdir:t,oid:n}){let{type:i,object:s}=await pt({fs:r,cache:e,gitdir:t,oid:n,format:"content"});if(i!=="tag")throw new sr(n,i,"tag");let o=Xr.from(s);return{oid:n,tag:o.parse(),payload:o.payload()}}async function R3({fs:r,dir:e,gitdir:t=B(e,".git"),oid:n,cache:i={}}){try{I("fs",r),I("gitdir",t),I("oid",n);let s=new re(r),o=await le({fsp:s,dotgit:t});return await T3({fs:s,cache:i,gitdir:o,oid:n})}catch(s){throw s.caller="git.readTag",s}}async function $3({fs:r,dir:e,gitdir:t=B(e,".git"),oid:n,filepath:i=void 0,cache:s={}}){try{I("fs",r),I("gitdir",t),I("oid",n);let o=new re(r),a=await le({fsp:o,dotgit:t});return await Ll({fs:o,cache:s,gitdir:a,oid:n,filepath:i})}catch(o){throw o.caller="git.readTree",o}}async function P3({fs:r,dir:e,gitdir:t=B(e,".git"),filepath:n,cache:i={}}){try{I("fs",r),I("gitdir",t),I("filepath",n);let s=new re(r),o=await le({fsp:s,dotgit:t});await Ct.acquire({fs:s,gitdir:o,cache:i},async function(a){let l=Array.isArray(n)?n:[n];for(let c of l)a.delete({filepath:c})})}catch(s){throw s.caller="git.remove",s}}async function I3({fs:r,cache:e,onSign:t,gitdir:n,ref:i="refs/notes/commits",oid:s,author:o,committer:a,signingKey:l}){let c;try{c=await q.resolve({gitdir:n,fs:r,ref:i})}catch(p){if(!(p instanceof Be))throw p}let f=(await Ll({fs:r,cache:e,gitdir:n,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==s);let d=await ju({fs:r,gitdir:n,tree:f});return await Uu({fs:r,cache:e,onSign:t,gitdir:n,ref:i,tree:d,parent:c&&[c],message:`Note removed by 'isomorphic-git removeNote'
`,author:o,committer:a,signingKey:l})}async function O3({fs:r,onSign:e,dir:t,gitdir:n=B(t,".git"),ref:i="refs/notes/commits",oid:s,author:o,committer:a,signingKey:l,cache:c={}}){try{I("fs",r),I("gitdir",n),I("oid",s);let u=new re(r),f=await le({fsp:u,dotgit:n}),d=await fo({fs:u,gitdir:f,author:o});if(!d)throw new gr("author");let h=await la({fs:u,gitdir:f,author:d,committer:a});if(!h)throw new gr("committer");return await I3({fs:u,cache:c,onSign:e,gitdir:f,ref:i,oid:s,author:d,committer:h,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function F3({fs:r,gitdir:e,oldref:t,ref:n,checkout:i=!1}){if(!Al(n,!0))throw new _n(n,na.default.clean(n));if(!Al(t,!0))throw new _n(t,na.default.clean(t));let s=`refs/heads/${t}`,o=`refs/heads/${n}`;if(await q.exists({fs:r,gitdir:e,ref:o}))throw new wi("branch",n,!1);let l=await q.resolve({fs:r,gitdir:e,ref:s,depth:1});await q.writeRef({fs:r,gitdir:e,ref:o,value:l}),await q.deleteRef({fs:r,gitdir:e,ref:s});let u=await po({fs:r,gitdir:e,fullname:!0})===s;(i||u)&&await q.writeSymbolicRef({fs:r,gitdir:e,ref:"HEAD",value:o})}async function M3({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n,oldref:i,checkout:s=!1}){try{I("fs",r),I("gitdir",t),I("ref",n),I("oldref",i);let o=new re(r),a=await le({fsp:o,dotgit:t});return await F3({fs:o,gitdir:a,ref:n,oldref:i,checkout:s})}catch(o){throw o.caller="git.renameBranch",o}}async function cC({gitdir:r,type:e,object:t}){return mi(Ss.wrap({type:e,object:t}))}async function D3({fs:r,dir:e,gitdir:t=B(e,".git"),filepath:n,ref:i,cache:s={}}){try{I("fs",r),I("gitdir",t),I("filepath",n);let o=new re(r),a=await le({fsp:o,dotgit:t}),l,c;try{l=await q.resolve({fs:o,gitdir:a,ref:i||"HEAD"})}catch(d){if(i||!(d instanceof Be))throw d}if(l)try{l=await wh({fs:o,cache:s,gitdir:a,oid:l,filepath:n})}catch(d){if(!(d instanceof Be)&&!(d instanceof ks)&&!(d instanceof sr&&d.data.filepath))throw 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 o.read(B(e,n));f&&(c=await cC({gitdir:a,type:"blob",object:f}),l===c&&(u=await o.lstat(B(e,n)))),await Ct.acquire({fs:o,gitdir:a,cache:s},async function(d){d.delete({filepath:n}),l&&d.insert({filepath:n,stats:u,oid:l})})}catch(o){throw o.caller="git.reset",o}}async function L3({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n,depth:i}){try{I("fs",r),I("gitdir",t),I("ref",n);let s=new re(r),o=await le({fsp:s,dotgit:t});return await q.resolve({fs:s,gitdir:o,ref:n,depth:i})}catch(s){throw s.caller="git.resolveRef",s}}async function N3({fs:r,dir:e,gitdir:t=B(e,".git"),path:n,value:i,append:s=!1}){try{I("fs",r),I("gitdir",t),I("path",n);let o=new re(r),a=await le({fsp:o,dotgit:t}),l=await Tt.get({fs:o,gitdir:a});s?await l.append(n,i):await l.set(n,i),await Tt.save({fs:o,gitdir:a,config:l})}catch(o){throw o.caller="git.setConfig",o}}async function uC({fs:r,gitdir:e,commit:t}){let n=Qr.from(t).toObject();return await Jr({fs:r,gitdir:e,type:"commit",object:n,format:"content"})}var hh=class r{static get timezoneOffsetForRefLogEntry(){let e=new Date().getTimezoneOffset(),t=Math.abs(Math.floor(e/60)),n=Math.abs(e%60).toString().padStart(2,"0");return`${e>0?"-":"+"}${t.toString().padStart(2,"0")}${n}`}static createStashReflogEntry(e,t,n){let i=e.name.replace(/\s/g,""),s="0000000000000000000000000000000000000000",o=Math.floor(Date.now()/1e3),a=r.timezoneOffsetForRefLogEntry;return`${s} ${t} ${i} ${e.email} ${o} ${a} ${n}
`}static getStashReflogEntry(e,t=!1){return e.split(`
`).filter(s=>s).reverse().map((s,o)=>t?`stash@{${o}}: ${s.split(" ")[1]}`:s)}},ca=class r{constructor({fs:e,dir:t,gitdir:n=B(t,".git")}){Object.assign(this,{fs:e,dir:t,gitdir:n,_author:null})}static get refStash(){return"refs/stash"}static get refLogsStash(){return"logs/refs/stash"}get refStashPath(){return B(this.gitdir,r.refStash)}get refLogsStashPath(){return B(this.gitdir,r.refLogsStash)}async getAuthor(){if(!this._author&&(this._author=await fo({fs:this.fs,gitdir:this.gitdir,author:{}}),!this._author))throw new gr("author");return this._author}async getStashSHA(e,t){return await this.fs.exists(this.refStashPath)?(t||await this.readStashReflogs({parsed:!1}))[e].split(" ")[1]:null}async writeStashCommit({message:e,tree:t,parent:n}){return uC({fs:this.fs,gitdir:this.gitdir,commit:{message:e,tree:t,parent:n,author:await this.getAuthor(),committer:await this.getAuthor()}})}async readStashCommit(e){let t=await this.readStashReflogs({parsed:!1});if(e!==0&&(e<0||e>t.length-1))throw new _n(`stash@${e}`,"number that is in range of [0, num of stash pushed]");let n=await this.getStashSHA(e,t);return n?Yi({fs:this.fs,cache:{},gitdir:this.gitdir,oid:n}):{}}async writeStashRef(e){return q.writeRef({fs:this.fs,gitdir:this.gitdir,ref:r.refStash,value:e})}async writeStashReflogEntry({stashCommit:e,message:t}){let n=await this.getAuthor(),i=hh.createStashReflogEntry(n,e,t),s=this.refLogsStashPath;await ir(s,async()=>{let o=await this.fs.exists(s)?await this.fs.read(s,"utf8"):"";await this.fs.write(s,o+i,"utf8")})}async readStashReflogs({parsed:e=!1}){if(!await this.fs.exists(this.refLogsStashPath))return[];let t=await this.fs.read(this.refLogsStashPath,"utf8");return hh.getStashReflogEntry(t,e)}};async function fC({fs:r,dir:e,gitdir:t,message:n=""}){let i=new ca({fs:r,dir:e,gitdir:t});await i.getAuthor();let s=await po({fs:r,gitdir:t,fullname:!1}),o=await q.resolve({fs:r,gitdir:t,ref:"HEAD"}),l=(await lC({fs:r,dir:e,gitdir:t,oid:o})).commit.message,c=[o],u=null,f=mr({ref:"HEAD"}),d=await fA({fs:r,dir:e,gitdir:t,treePair:[mr({ref:"HEAD"}),"stage"]});if(d){let w=await i.writeStashCommit({message:`stash-Index: WIP on ${s} - ${new Date().toISOString()}`,tree:d,parent:c});c.push(w),u=d,f=lo()}let h=await fA({fs:r,dir:e,gitdir:t,treePair:[f,"workdir"]});if(h){let w=await i.writeStashCommit({message:`stash-WorkDir: WIP on ${s} - ${new Date().toISOString()}`,tree:h,parent:[c[c.length-1]]});c.push(w),u=h}if(!u||!d&&!h)throw new Be("changes, nothing to stash");let p=(n.trim()||`WIP on ${s}`)+`: ${o.substring(0,7)} ${l}`;return{stashCommit:await i.writeStashCommit({message:p,tree:u,parent:c}),stashMsg:p,branch:s,stashMgr:i}}async function B3({fs:r,dir:e,gitdir:t,message:n=""}){let{stashCommit:i,stashMsg:s,branch:o,stashMgr:a}=await fC({fs:r,dir:e,gitdir:t,message:n});return await a.writeStashRef(i),await a.writeStashReflogEntry({stashCommit:i,message:s}),await VA({fs:r,dir:e,gitdir:t,ref:o,track:!1,force:!0}),i}async function H3({fs:r,dir:e,gitdir:t,message:n=""}){let{stashCommit:i}=await fC({fs:r,dir:e,gitdir:t,message:n});return i}async function dC({fs:r,dir:e,gitdir:t,refIdx:n=0}){let s=await new ca({fs:r,dir:e,gitdir:t}).readStashCommit(n),{parent:o=null}=s.commit?s.commit:{};if(!(!o||!Array.isArray(o)))for(let a=0;a<o.length-1;a++){let c=(await Yi({fs:r,cache:{},gitdir:t,oid:o[a+1]})).commit.message.startsWith("stash-Index");await qA({fs:r,dir:e,gitdir:t,stashCommit:o[a+1],parentCommit:o[a],wasStaged:c})}}async function hC({fs:r,dir:e,gitdir:t,refIdx:n=0}){let i=new ca({fs:r,dir:e,gitdir:t});if(!(await i.readStashCommit(n)).commit)return;let o=i.refStashPath;await ir(o,async()=>{await r.exists(o)&&await r.rm(o)});let a=await i.readStashReflogs({parsed:!1});if(!a.length)return;a.splice(n,1);let l=i.refLogsStashPath;await ir(l,async()=>{if(a.length){await r.write(l,a.reverse().join(`
`)+`
`,"utf8");let c=a[a.length-1].split(" ")[1];await i.writeStashRef(c)}else await r.rm(l)})}async function G3({fs:r,dir:e,gitdir:t}){return new ca({fs:r,dir:e,gitdir:t}).readStashReflogs({parsed:!0})}async function U3({fs:r,dir:e,gitdir:t}){let n=new ca({fs:r,dir:e,gitdir:t}),i=[n.refStashPath,n.refLogsStashPath];await ir(i,async()=>{await Promise.all(i.map(async s=>{if(await r.exists(s))return r.rm(s)}))})}async function j3({fs:r,dir:e,gitdir:t,refIdx:n=0}){await dC({fs:r,dir:e,gitdir:t,refIdx:n}),await hC({fs:r,dir:e,gitdir:t,refIdx:n})}async function z3({fs:r,dir:e,gitdir:t=B(e,".git"),op:n="push",message:i="",refIdx:s=0}){I("fs",r),I("dir",e),I("gitdir",t),I("op",n);let o={push:B3,apply:dC,drop:hC,list:G3,clear:U3,pop:j3,create:H3},a=["apply","drop","pop"];try{let l=new re(r),c=await le({fsp:l,dotgit:t});["refs","logs","logs/refs"].map(d=>B(c,d)).forEach(async d=>{await l.exists(d)||await l.mkdir(d)});let f=o[n];if(f){if(a.includes(n)&&s<0)throw new _n(`stash@${s}`,"number that is in range of [0, num of stash pushed]");return await f({fs:l,dir:e,gitdir:c,message:i,refIdx:s})}throw new Error(`To be implemented: ${n}`)}catch(l){throw l.caller="git.stash",l}}async function V3({fs:r,dir:e,gitdir:t=B(e,".git"),filepath:n,cache:i={},refresh:s=!0}){try{I("fs",r),I("gitdir",t),I("filepath",n);let o=new re(r),a=await le({fsp:o,dotgit:t}),l=await q3({fs:o,cache:i,gitdir:a}),c=await pC({fs:o,cache:i,gitdir:a,tree:l,path:n}),u=await Ct.acquire({fs:o,gitdir:a,cache:i},async function(w){for(let y of w)if(y.path===n)return y;return null});if(c===null&&u===null&&await uo.isIgnored({fs:o,gitdir:a,dir:e,filepath:n}))return"ignored";let f=await o.lstat(B(e,n)),d=c!==null,h=u!==null,p=f!==null&&(d||h||await W3({fs:o,dir:e,filepath:n})),m=async()=>{if(h&&!nh(u,f))return u.oid;{let y=await(await Tt.get({fs:o,gitdir:a})).get("core.autocrlf"),v=await o.read(B(e,n),{autocrlf:y}),A=await cC({gitdir:a,type:"blob",object:v});return s&&h&&!u.flags.intentToAdd&&u.oid===A&&f.size!==-1&&await Ct.acquire({fs:o,gitdir:a,cache:i},async function(C){C.insert({filepath:n,stats:f,oid:A})}),A}};if(!d&&!p&&!h)return"absent";if(!d&&!p&&h)return"*absent";if(!d&&p&&!h)return"*added";if(!d&&p&&h)return await m()===u.oid?"added":"*added";if(d&&!p&&!h)return"deleted";if(d&&!p&&h)return c===u.oid,"*deleted";if(d&&p&&!h)return await m()===c?"*undeleted":"*undeletemodified";if(d&&p&&h){let w=await m();return w===c?w===u.oid?"unmodified":"*unmodified":w===u.oid?"modified":"*modified"}}catch(o){throw o.caller="git.status",o}}async function W3({fs:r,dir:e,filepath:t}){let n=t.replace(/\\/g,"/").split("/").filter(s=>s!==""&&s!=="."),i=e;for(let s of n){let o;try{o=await r._readdir(i)}catch(a){if(a.code==="ENOENT"||a.code==="ENOTDIR")return!1;throw a}if(!o.some(a=>a.normalize()===s.normalize()))return!1;i=B(i,s)}return!0}async function pC({fs:r,cache:e,gitdir:t,tree:n,path:i}){typeof i=="string"&&(i=i.split("/"));let s=i.shift();for(let o of n)if(o.path===s){if(i.length===0)return o.oid;let{type:a,object:l}=await pt({fs:r,cache:e,gitdir:t,oid:o.oid});if(a==="tree"){let c=Zr.from(l);return pC({fs:r,cache:e,gitdir:t,tree:c,path:i})}if(a==="blob")throw new sr(o.oid,a,"blob",i.join("/"))}return null}async function q3({fs:r,cache:e,gitdir:t}){let n;try{n=await q.resolve({fs:r,gitdir:t,ref:"HEAD"})}catch(s){if(s instanceof Be)return[];throw s}let{tree:i}=await Ll({fs:r,cache:e,gitdir:t,oid:n});return i}async function Y3({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n="HEAD",filepaths:i=["."],filter:s,cache:o={},ignored:a=!1,refresh:l=!0}){try{I("fs",r),I("gitdir",t),I("ref",n);let c=new re(r),u=await le({fsp:c,dotgit:t});return await vi({fs:c,cache:o,dir:e,gitdir:u,trees:[mr({ref:n}),Dl({refresh:l}),lo()],map:async function(f,[d,h,p]){if(!d&&!p&&h&&!a&&await uo.isIgnored({fs:c,dir:e,filepath:f})||!i.some(x=>xv(f,x)))return null;if(s&&!s(f))return;let[m,w,y]=await Promise.all([d&&d.type(),h&&h.type(),p&&p.type()]),v=[m,w,y].includes("blob");if((m==="tree"||m==="special")&&!v)return;if(m==="commit")return null;if((w==="tree"||w==="special")&&!v)return;if(y==="commit")return null;if((y==="tree"||y==="special")&&!v)return;let A=m==="blob"?await d.oid():void 0,C=y==="blob"?await p.oid():void 0,S;m!=="blob"&&w==="blob"&&y!=="blob"?S="42":w==="blob"&&(S=await h.oid());let T=[void 0,A,S,C],b=T.map(x=>T.indexOf(x));return b.shift(),[f,...b]}})}catch(c){throw c.caller="git.statusMatrix",c}}async function K3({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n,object:i,force:s=!1}){try{I("fs",r),I("gitdir",t),I("ref",n);let o=new re(r);if(n===void 0)throw new Kr("ref");n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`;let a=await le({fsp:o,dotgit:t}),l=await q.resolve({fs:o,gitdir:a,ref:i||"HEAD"});if(!s&&await q.exists({fs:o,gitdir:a,ref:n}))throw new wi("tag",n);await q.writeRef({fs:o,gitdir:a,ref:n,value:l})}catch(o){throw o.caller="git.tag",o}}async function Z3({fs:r,dir:e,gitdir:t=B(e,".git"),cache:n={},filepath:i,oid:s,mode:o,add:a,remove:l,force:c}){try{I("fs",r),I("gitdir",t),I("filepath",i);let u=new re(r),f=await le({fsp:u,dotgit:t});if(l)return await Ct.acquire({fs:u,gitdir:f,cache:n},async function(h){if(!c){let p=await u.lstat(B(e,i));if(p){if(p.isDirectory())throw new ks("directory");return}}h.has({filepath:i})&&h.delete({filepath:i})});let d;if(!s){if(d=await u.lstat(B(e,i)),!d)throw new Be(`file at "${i}" on disk and "remove" not set`);if(d.isDirectory())throw new ks("directory")}return await Ct.acquire({fs:u,gitdir:f,cache:n},async function(h){if(!a&&!h.has({filepath:i}))throw new Be(`file at "${i}" in index and "add" not set`);let p;if(s)p={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:o,uid:0,gid:0,size:0};else{p=d;let m=p.isSymbolicLink()?await u.readlink(B(e,i)):await u.read(B(e,i));s=await Jr({fs:u,gitdir:f,type:"blob",format:"content",object:m})}return h.insert({filepath:i,oid:s,stats:p}),s})}catch(u){throw u.caller="git.updateIndex",u}}function X3(){try{return vh.version}catch(r){throw r.caller="git.version",r}}async function Q3({fs:r,dir:e,gitdir:t=B(e,".git"),trees:n,map:i,reduce:s,iterate:o,cache:a={}}){try{I("fs",r),I("gitdir",t),I("trees",n);let l=new re(r),c=await le({fsp:l,dotgit:t});return await vi({fs:l,cache:a,dir:e,gitdir:c,trees:n,map:i,reduce:s,iterate:o})}catch(l){throw l.caller="git.walk",l}}async function J3({fs:r,dir:e,gitdir:t=B(e,".git"),blob:n}){try{I("fs",r),I("gitdir",t),I("blob",n);let i=new re(r),s=await le({fsp:i,dotgit:t});return await Jr({fs:i,gitdir:s,type:"blob",object:n,format:"content"})}catch(i){throw i.caller="git.writeBlob",i}}async function e8({fs:r,dir:e,gitdir:t=B(e,".git"),commit:n}){try{I("fs",r),I("gitdir",t),I("commit",n);let i=new re(r),s=await le({fsp:i,dotgit:t});return await uC({fs:i,gitdir:s,commit:n})}catch(i){throw i.caller="git.writeCommit",i}}async function t8({fs:r,dir:e,gitdir:t=B(e,".git"),type:n,object:i,format:s="parsed",oid:o,encoding:a=void 0}){try{let l=new re(r),c=await le({fsp:l,dotgit:t});if(s==="parsed"){switch(n){case"commit":i=Qr.from(i).toObject();break;case"tree":i=Zr.from(i).toObject();break;case"blob":i=_.from(i,a);break;case"tag":i=Xr.from(i).toObject();break;default:throw new sr(o||"",n,"blob|commit|tag|tree")}s="content"}return o=await Jr({fs:l,gitdir:c,type:n,object:i,oid:o,format:s}),o}catch(l){throw l.caller="git.writeObject",l}}async function r8({fs:r,dir:e,gitdir:t=B(e,".git"),ref:n,value:i,force:s=!1,symbolic:o=!1}){try{I("fs",r),I("gitdir",t),I("ref",n),I("value",i);let a=new re(r);if(!Al(n,!0))throw new _n(n,na.default.clean(n));let l=await le({fsp:a,dotgit:t});if(!s&&await q.exists({fs:a,gitdir:l,ref:n}))throw new wi("ref",n);o?await q.writeSymbolicRef({fs:a,gitdir:l,ref:n,value:i}):(i=await q.resolve({fs:a,gitdir:l,ref:i}),await q.writeRef({fs:a,gitdir:l,ref:n,value:i}))}catch(a){throw a.caller="git.writeRef",a}}async function n8({fs:r,gitdir:e,tag:t}){let n=Xr.from(t).toObject();return await Jr({fs:r,gitdir:e,type:"tag",object:n,format:"content"})}async function i8({fs:r,dir:e,gitdir:t=B(e,".git"),tag:n}){try{I("fs",r),I("gitdir",t),I("tag",n);let i=new re(r),s=await le({fsp:i,dotgit:t});return await n8({fs:i,gitdir:s,tag:n})}catch(i){throw i.caller="git.writeTag",i}}async function s8({fs:r,dir:e,gitdir:t=B(e,".git"),tree:n}){try{I("fs",r),I("gitdir",t),I("tree",n);let i=new re(r),s=await le({fsp:i,dotgit:t});return await ju({fs:i,gitdir:s,tree:n})}catch(i){throw i.caller="git.writeTree",i}}var o8={Errors:Fr,STAGE:lo,TREE:mr,WORKDIR:Dl,add:UB,abortMerge:NB,addNote:YB,addRemote:KB,annotatedTag:XB,branch:JB,cherryPick:cH,checkout:VA,clone:_H,commit:xH,getConfig:HH,getConfigAll:UH,setConfig:N3,currentBranch:EH,deleteBranch:kH,deleteRef:AH,deleteRemote:TH,deleteTag:$H,expandOid:FH,expandRef:MH,fastForward:DH,fetch:LH,findMergeBase:NH,findRoot:BH,getRemoteInfo:jH,getRemoteInfo2:zH,hashBlob:WH,indexPack:YH,init:KH,isDescendent:ZH,isIgnored:XH,listBranches:QH,listFiles:e3,listNotes:r3,listRefs:n3,listRemotes:s3,listServerRefs:l3,listTags:c3,log:p3,merge:m3,packObjects:v3,pull:b3,push:S3,readBlob:Nl,readCommit:lC,readNote:A3,readObject:C3,readTag:R3,readTree:$3,remove:P3,removeNote:O3,renameBranch:M3,resetIndex:D3,updateIndex:Z3,resolveRef:L3,status:V3,statusMatrix:Y3,tag:K3,version:X3,walk:Q3,writeBlob:J3,writeCommit:e8,writeObject:t8,writeRef:r8,writeTag:i8,writeTree:s8,stash:z3},ge=o8;var Ht=require("obsidian"),yO=nt(require("path"),1);g();var Pt={};g();var bh=class{constructor(){this.tasks=[];this.currentTask=null}addTask(e,t){this.tasks.push({task:e,onFinished:n=>{t&&t(n)}}),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(t=>{try{e.onFinished(t)}catch(n){console.error(n)}},t=>{console.error("Unhandled PromiseQueue task rejection",t);try{e.onFinished(void 0)}catch(n){console.error(n)}}).finally(()=>{this.currentTask=null,this.kickstart()})}clear(){this.tasks=[]}};g();var Ve=require("obsidian");g();var mC=require("obsidian"),yh="YYYY-MM-DD",Av=`${yh} HH:mm`,Cv=`${yh} HH:mm:ss`,_h=40,en={commitMessage:"vault backup: {{date}}",autoCommitMessage:"vault backup: {{date}}",commitMessageScript:"",commitDateFormat:Cv,autoSaveInterval:0,autoPushInterval:0,autoPullInterval:0,autoPullOnBoot:!1,autoCommitGlobMode:"exclude",autoCommitGlobs:"",disablePush:!1,pullBeforePush:!0,squashCommitsBeforePush:!1,disablePopups:!1,showErrorNotices:!0,disablePopupsForNoChanges:!1,listChangedFilesInMessageBody:!1,showStatusBar:!0,updateSubmodules:!1,syncMethod:"merge",rebaseAutoStash:"enabled",mergeStrategy:"none",customMessageOnAutoBackup:!1,autoBackupAfterFileChange:!1,treeStructure:!1,gitServerPasswordSecret:"",refreshSourceControl:mC.Platform.isDesktopApp,basePath:"",differentIntervalCommitAndPush:!1,changedFilesInStatusBar:!1,limitToVault:!1,showedMobileNotice:!1,refreshSourceControlTimer:7e3,showBranchStatusBar:!0,conflictResolutionMode:"both",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:Av,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}},wr={type:"git-view",name:"Source Control",icon:"git-pull-request"},tn={type:"git-history-view",name:"History",icon:"history"},mo={type:"git-read-only-file-view",name:"File at commit",icon:"file-clock"},go={type:"split-diff-view",name:"Diff view",icon:"diff"},wo={type:"diff-view",name:"Diff View",icon:"git-pull-request"},xh="C:\\Program Files\\Git\\cmd\\git.exe",Tv="obsidian_askpass.sh",gC=`#!/bin/sh
if ! command -v curl >/dev/null 2>&1; then
echo "Obsidian Git authentication requires curl" >&2
exit 1
fi
printf '%s\\n%s' "$OBSIDIAN_GIT_ASKPASS_TOKEN" "$1" | curl -q \\
--silent --show-error --fail --noproxy '*' --proto '=http' \\
--max-time 600 --data-binary @- \\
--header 'Content-Type: application/octet-stream' \\
"http://127.0.0.1:$OBSIDIAN_GIT_ASKPASS_PORT/askpass"
`,wC=["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"];g();g();g();var Vu=class{diff(e,t,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let s=this.castInput(e,n),o=this.castInput(t,n),a=this.removeEmpty(this.tokenize(s,n)),l=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,l,n,i)}diffWithOptionsObj(e,t,n,i){var s;let o=v=>{if(v=this.postProcess(v,n),i){setTimeout(function(){i(v)},0);return}else return v},a=t.length,l=e.length,c=1,u=a+l;n.maxEditLength!=null&&(u=Math.min(u,n.maxEditLength));let f=(s=n.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],t,e,0,n);if(h[0].oldPos+1>=l&&p+1>=a)return o(this.buildValues(h[0].lastComponent,t,e));let m=-1/0,w=1/0,y=()=>{for(let v=Math.max(m,-c);v<=Math.min(w,c);v+=2){let A,C=h[v-1],S=h[v+1];C&&(h[v-1]=void 0);let T=!1;if(S){let x=S.oldPos-v;T=S&&0<=x&&x<a}let b=C&&C.oldPos+1<l;if(!T&&!b){h[v]=void 0;continue}if(!b||T&&C.oldPos<S.oldPos?A=this.addToPath(S,!0,!1,0,n):A=this.addToPath(C,!1,!0,1,n),p=this.extractCommon(A,t,e,v,n),A.oldPos+1>=l&&p+1>=a)return o(this.buildValues(A.lastComponent,t,e))||!0;h[v]=A,A.oldPos+1>=l&&(w=Math.min(w,v-1)),p+1>=a&&(m=Math.max(m,v+1))}c++};if(i)(function v(){setTimeout(function(){if(c>u||Date.now()>d)return i(void 0);y()||v()},0)})();else for(;c<=u&&Date.now()<=d;){let v=y();if(v)return v}}addToPath(e,t,n,i,s){let o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===t&&o.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:t,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:t,removed:n,previousComponent:o}}}extractCommon(e,t,n,i,s){let o=t.length,a=n.length,l=e.oldPos,c=l-i,u=0;for(;c+1<o&&l+1<a&&this.equals(n[l+1],t[c+1],s);)c++,l++,u++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!s.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let i=[],s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();let o=i.length,a=0,l=0,c=0;for(;a<o;a++){let u=i[a];if(u.removed)u.value=this.join(n.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=t.slice(l,l+u.count);f=f.map(function(d,h){let p=n[c+h];return p.length>d.length?p:d}),u.value=this.join(f)}else u.value=this.join(t.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return i}};g();var Rv=class extends Vu{constructor(){super(...arguments),this.tokenize=l8}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
`)&&(e=e.slice(0,-1)),t.endsWith(`
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}},a8=new Rv;function $v(r,e,t){return a8.diff(r,e,t)}function l8(r,e){e.stripTrailingCr&&(r=r.replace(/\r\n/g,`
`));let t=[],n=r.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(let i=0;i<n.length;i++){let s=n[i];i%2&&!e.newlineIsToken?t[t.length-1]+=s:t.push(s)}return t}g();function c8(r){for(let e=0;e<r.length;e++)if(r[e]<" "||r[e]>"~"||r[e]==='"'||r[e]==="\\")return!0;return!1}function vo(r){if(!c8(r))return r;let e='"',t=new TextEncoder().encode(r),n=0;for(;n<t.length;){let i=t[n];i===7?e+="\\a":i===8?e+="\\b":i===9?e+="\\t":i===10?e+="\\n":i===11?e+="\\v":i===12?e+="\\f":i===13?e+="\\r":i===34?e+='\\"':i===92?e+="\\\\":i>=32&&i<=126?e+=String.fromCharCode(i):e+="\\"+i.toString(8).padStart(3,"0"),n++}return e+='"',e}var Pv={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Iv(r,e,t,n,i,s,o){let a;o?typeof o=="function"?a={callback:o}:a=o:a={},typeof a.context=="undefined"&&(a.context=4);let l=a.context;if(a.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(a.callback){let{callback:u}=a;$v(t,n,Object.assign(Object.assign({},a),{callback:f=>{let d=c(f);u(d)}}))}else return c($v(t,n,a));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(v){return v.map(function(A){return" "+A})}let d=[],h=0,p=0,m=[],w=1,y=1;for(let v=0;v<u.length;v++){let A=u[v],C=A.lines||u8(A.value);if(A.lines=C,A.added||A.removed){if(!h){let S=u[v-1];h=w,p=y,S&&(m=l>0?f(S.lines.slice(-l)):[],h-=m.length,p-=m.length)}for(let S of C)m.push((A.added?"+":"-")+S);A.added?y+=C.length:w+=C.length}else{if(h)if(C.length<=l*2&&v<u.length-2)for(let S of f(C))m.push(S);else{let S=Math.min(C.length,l);for(let b of f(C.slice(0,S)))m.push(b);let T={oldStart:h,oldLines:w-h+S,newStart:p,newLines:y-p+S,lines:m};d.push(T),h=0,p=0,m=[]}w+=C.length,y+=C.length}}for(let v of d)for(let A=0;A<v.lines.length;A++)v.lines[A].endsWith(`
`)?v.lines[A]=v.lines[A].slice(0,-1):(v.lines.splice(A+1,0,"\\ No newline at end of file"),A++);return{oldFileName:r,newFileName:e,oldHeader:i,newHeader:s,hunks:d}}}function Eh(r,e){var t,n,i,s,o,a;if(e||(e=Pv),Array.isArray(r)){if(r.length>1&&!e.includeFileHeaders&&!r.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 r.map(u=>Eh(u,e)).join(`
`)}let l=[];if(r.isGit){if(e=Pv,!r.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!r.newFileName)throw new Error("newFileName must be specified for Git patches");let u=r.oldFileName,f=r.newFileName;r.isCreate&&u==="/dev/null"?u=f.replace(/^b\//,"a/"):r.isDelete&&f==="/dev/null"&&(f=u.replace(/^a\//,"b/")),l.push("diff --git "+vo(u)+" "+vo(f)),r.isDelete&&l.push("deleted file mode "+((t=r.oldMode)!==null&&t!==void 0?t:"100644")),r.isCreate&&l.push("new file mode "+((n=r.newMode)!==null&&n!==void 0?n:"100644")),r.oldMode&&r.newMode&&!r.isDelete&&!r.isCreate&&(l.push("old mode "+r.oldMode),l.push("new mode "+r.newMode)),r.isRename&&(l.push("rename from "+vo(((i=r.oldFileName)!==null&&i!==void 0?i:"").replace(/^a\//,""))),l.push("rename to "+vo(((s=r.newFileName)!==null&&s!==void 0?s:"").replace(/^b\//,"")))),r.isCopy&&(l.push("copy from "+vo(((o=r.oldFileName)!==null&&o!==void 0?o:"").replace(/^a\//,""))),l.push("copy to "+vo(((a=r.newFileName)!==null&&a!==void 0?a:"").replace(/^b\//,""))))}else e.includeIndex&&r.oldFileName==r.newFileName&&r.oldFileName!==void 0&&l.push("Index: "+r.oldFileName),e.includeUnderline&&l.push("===================================================================");let c=r.hunks.length>0;e.includeFileHeaders&&r.oldFileName!==void 0&&r.newFileName!==void 0&&(!r.isGit||c)&&(l.push("--- "+vo(r.oldFileName)+(r.oldHeader?" "+r.oldHeader:"")),l.push("+++ "+vo(r.newFileName)+(r.newHeader?" "+r.newHeader:"")));for(let u=0;u<r.hunks.length;u++){let f=r.hunks[u],d=f.oldLines===0?f.oldStart-1:f.oldStart,h=f.newLines===0?f.newStart-1:f.newStart;l.push("@@ -"+d+","+f.oldLines+" +"+h+","+f.newLines+" @@");for(let p of f.lines)l.push(p)}return l.join(`
`)+`
`}function vC(r,e,t,n,i,s,o){if(typeof o=="function"&&(o={callback:o}),o!=null&&o.callback){let{callback:a}=o;Iv(r,e,t,n,i,s,Object.assign(Object.assign({},o),{callback:l=>{a(l?Eh(l,o.headerOptions):void 0)}}))}else{let a=Iv(r,e,t,n,i,s,o);return a?Eh(a,o==null?void 0:o.headerOptions):void 0}}function Wu(r,e,t,n,i,s){return vC(r,r,e,t,n,i,s)}function u8(r){let e=r.endsWith(`
`),t=r.split(`
`).map(n=>n+`
`);return e?t.pop():t.push(t.pop().slice(0,-1)),t}g();var f8=nt(Vw(),1),EC=nt(Qg(),1),SC=nt(Jg(),1),d8=nt(ew(),1),h8=nt(rw(),1),p8=nt(Lw(),1);var De=class r extends Error{constructor(e){super(e),this.caller=""}toJSON(){let e=this;return{code:e.code,data:e.data,caller:this.caller,message:this.message,stack:this.stack}}fromJSON(e){let t=new r(e.message),n=t;return n.code=e.code,n.data=e.data,t.caller=e.caller,t.stack=e.stack,t}get isIsomorphicGitError(){return!0}},Sh=class r extends De{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=r.code,this.data={filepaths:e}}};Sh.code="UnmergedPathsError";var Zn=class r extends De{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=r.code,this.data={message:e}}};Zn.code="InternalError";var kh=class r extends De{constructor(e){super(`The filepath "${e}" contains unsafe character sequences`),this.code=this.name=r.code,this.data={filepath:e}}};kh.code="UnsafeFilepathError";var qu=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 t=this.buffer.slice(this._start,this._start+e);return this._start+=e,t}toString(e,t){let n=this.buffer.toString(e,this._start,this._start+t);return this._start+=t,n}write(e,t,n){let i=this.buffer.write(e,this._start,t,n);return this._start+=t,i}copy(e,t,n){let i=e.copy(this.buffer,this._start,t,n);return this._start+=i,i}readUInt8(){let e=this.buffer.readUInt8(this._start);return this._start+=1,e}writeUInt8(e){let t=this.buffer.writeUInt8(e,this._start);return this._start+=1,t}readUInt16BE(){let e=this.buffer.readUInt16BE(this._start);return this._start+=2,e}writeUInt16BE(e){let t=this.buffer.writeUInt16BE(e,this._start);return this._start+=2,t}readUInt32BE(){let e=this.buffer.readUInt32BE(this._start);return this._start+=4,e}writeUInt32BE(e){let t=this.buffer.writeUInt32BE(e,this._start);return this._start+=4,t}},bC=/[\ud800-￿]/;function yC(r,e,t){if(t<55296||t>57343)return!1;if(t<56320){let i=e+1<r.length?r.charCodeAt(e+1):0;return i<56320||i>57343}let n=e>0?r.charCodeAt(e-1):0;return n<55296||n>56319}function m8(r,e){if(!bC.test(r)&&!bC.test(e))return-(r<e)||+(r>e);let t=Math.min(r.length,e.length);for(let n=0;n<t;n++){let i=r.charCodeAt(n),s=e.charCodeAt(n);if(i!==s){if(yC(r,n,i)&&(i=65533),yC(e,n,s)&&(s=65533),i===s)continue;return i>=55296&&s>=55296&&(i+=i>=57344?-2048:8192,s+=s>=57344?-2048:8192),i<s?-1:1}}return r.length<e.length?-1:r.length>e.length?1:0}function g8(r,e){return m8(r.path,e.path)}function w8(r){let e=r>0?r>>12:0;e!==4&&e!==8&&e!==10&&e!==14&&(e=8);let t=r&511;return t&73?t=493:t=420,e!==8&&(t=0),(e<<12)+t}var Ki=2**32;function _C(r,e,t,n){if(r!==void 0&&e!==void 0)return[r,e];t===void 0&&(t=n.valueOf());let i=Math.floor(t/1e3),s=Math.floor((t-i*1e3)*1e6);return[i,s]}function Bl(r){let[e,t]=_C(r.ctimeSeconds,r.ctimeNanoseconds,r.ctimeMs,r.ctime),[n,i]=_C(r.mtimeSeconds,r.mtimeNanoseconds,r.mtimeMs,r.mtime);return{ctimeSeconds:e%Ki,ctimeNanoseconds:t%Ki,mtimeSeconds:n%Ki,mtimeNanoseconds:i%Ki,dev:r.dev%Ki,ino:r.ino%Ki,mode:w8(r.mode%Ki),uid:r.uid%Ki,gid:r.gid%Ki,size:r.size>-1?r.size%Ki:0}}function v8(r){let e="";for(let t of new Uint8Array(r))t<16&&(e+="0"),e+=t.toString(16);return e}var Ov=null;async function xC(r){return Ov===null&&(Ov=await y8()),Ov?kC(r):b8(r)}function b8(r){return new EC.default().update(r).digest("hex")}async function kC(r){let e=await crypto.subtle.digest("SHA-1",r);return v8(e)}async function y8(){try{return await kC(new Uint8Array([]))==="da39a3ee5e6b4b0d3255bfef95601890afd80709"}catch(r){}return!1}function _8(r){return{assumeValid:!!(r&32768),extended:!!(r&16384),stage:(r&12288)>>12,nameLength:r&4095,skipWorktree:!1,intentToAdd:!1}}var Dv=16384,Lv=8192;function Nv(r){return!!(r.flags.skipWorktree||r.flags.intentToAdd)}function x8(r){let e=r.flags;return e.extended=Nv(r),e.nameLength=Math.min(_.from(r.path).length,4095),(e.assumeValid?32768:0)+(e.extended?16384:0)+((e.stage&3)<<12)+(e.nameLength&4095)}function E8(r){return(r.flags.skipWorktree?Dv:0)+(r.flags.intentToAdd?Lv:0)}var Bv=class r{constructor(e,t){this._dirty=!1,this._unmergedPaths=t||new Set,this._entries=e||new Map}_addEntry(e){if(e.flags.stage===0)e.stages=[e],this._entries.set(e.path,e),this._unmergedPaths.delete(e.path);else{let t=this._entries.get(e.path);t||(this._entries.set(e.path,e),t=e),t.stages[e.flags.stage]=e,this._unmergedPaths.add(e.path)}}static async from(e){if(_.isBuffer(e))return r.fromBuffer(e);if(e===null)return new r(null);throw new Zn("invalid type passed to GitIndex.from")}static async fromBuffer(e){if(e.length===0)throw new Zn("Index file is empty (.git/index)");let t=new r,n=new qu(e),i=n.toString("utf8",4);if(i!=="DIRC")throw new Zn(`Invalid dircache magic file number: ${i}`);let s=await xC(e.slice(0,-20)),o=e.slice(-20).toString("hex");if(o!==s)throw new Zn(`Invalid checksum in GitIndex buffer: expected ${o} but saw ${s}`);let a=n.readUInt32BE();if(a!==2&&a!==3)throw new Zn(`Unsupported dircache version: ${a}`);let l=n.readUInt32BE(),c=0;for(;!n.eof()&&c<l;){let u={};u.ctimeSeconds=n.readUInt32BE(),u.ctimeNanoseconds=n.readUInt32BE(),u.mtimeSeconds=n.readUInt32BE(),u.mtimeNanoseconds=n.readUInt32BE(),u.dev=n.readUInt32BE(),u.ino=n.readUInt32BE(),u.mode=n.readUInt32BE(),u.uid=n.readUInt32BE(),u.gid=n.readUInt32BE(),u.size=n.readUInt32BE(),u.oid=n.slice(20).toString("hex");let f=n.readUInt16BE();if(u.flags=_8(f),u.flags.extended){let p=n.readUInt16BE();if(p&~(Dv|Lv))throw new Zn(`Unknown index entry format: 0x${p.toString(16)}`);u.flags.skipWorktree=!!(p&Dv),u.flags.intentToAdd=!!(p&Lv)}let d=e.indexOf(0,n.tell()+1)-n.tell();if(d<1)throw new Zn(`Got a path length of: ${d}`);if(u.path=n.toString("utf8",d),u.path.includes("..\\")||u.path.includes("../"))throw new kh(u.path);let h=8-(n.tell()-12)%8;for(h===0&&(h=8);h--;){let p=n.readUInt8();if(p!==0)throw new Zn(`Expected 1-8 null characters but got '${p}' after ${u.path}`);if(n.eof())throw new Zn("Unexpected end of file")}u.stages=[],t._addEntry(u),c++}return t}get unmergedPaths(){return[...this._unmergedPaths]}get entries(){return[...this._entries.values()].sort(g8)}get entriesMap(){return this._entries}get entriesFlat(){return[...this.entries].flatMap(e=>e.stages.length>1?e.stages.filter(t=>t):e)}*[Symbol.iterator](){for(let e of this.entries)yield e}insert({filepath:e,stats:t,oid:n,stage:i=0}){t||(t={ctimeSeconds:0,ctimeNanoseconds:0,mtimeSeconds:0,mtimeNanoseconds:0,dev:0,ino:0,mode:0,uid:0,gid:0,size:0}),t=Bl(t);let s=_.from(e),o=i===0?this._entries.get(e):void 0,a={ctimeSeconds:t.ctimeSeconds,ctimeNanoseconds:t.ctimeNanoseconds,mtimeSeconds:t.mtimeSeconds,mtimeNanoseconds:t.mtimeNanoseconds,dev:t.dev,ino:t.ino,mode:t.mode||33188,uid:t.uid,gid:t.gid,size:t.size,path:e,oid:n,flags:{assumeValid:!1,extended:!1,stage:i,nameLength:s.length<4095?s.length:4095,skipWorktree:!!(o!=null&&o.flags.skipWorktree),intentToAdd:!1},stages:[]};this._addEntry(a),this._dirty=!0}delete({filepath:e}){if(this._entries.has(e))this._entries.delete(e);else for(let t of this._entries.keys())t.startsWith(e+"/")&&this._entries.delete(t);this._unmergedPaths.has(e)&&this._unmergedPaths.delete(e),this._dirty=!0}clear(){this._entries.clear(),this._dirty=!0}has({filepath:e}){return this._entries.has(e)}render(){return this.entries.map(e=>`${e.mode.toString(8)} ${e.oid} ${e.path}`).join(`
`)}static async _entryToBuffer(e){let t=_.from(e.path),n=Nv(e),i=Math.ceil((62+(n?2:0)+t.length+1)/8)*8,s=_.alloc(i),o=new qu(s),a=Bl(e);return o.writeUInt32BE(a.ctimeSeconds),o.writeUInt32BE(a.ctimeNanoseconds),o.writeUInt32BE(a.mtimeSeconds),o.writeUInt32BE(a.mtimeNanoseconds),o.writeUInt32BE(a.dev),o.writeUInt32BE(a.ino),o.writeUInt32BE(a.mode),o.writeUInt32BE(a.uid),o.writeUInt32BE(a.gid),o.writeUInt32BE(a.size),o.write(e.oid,20,"hex"),o.writeUInt16BE(x8(e)),n&&o.writeUInt16BE(E8(e)),o.write(e.path,t.length,"utf8"),s}async toObject(){let e=_.alloc(12),t=new qu(e);t.write("DIRC",4,"utf8"),t.writeUInt32BE(this.entriesFlat.some(Nv)?3:2),t.writeUInt32BE(this.entriesFlat.length);let n=[];for(let a of this.entries)if(n.push(r._entryToBuffer(a)),a.stages.length>1)for(let l of a.stages)l&&l!==a&&n.push(r._entryToBuffer(l));n=await Promise.all(n);let i=_.concat(n),s=_.concat([e,i]),o=await xC(s);return _.concat([s,_.from(o,"hex")])}};function S8(r,e,t=!0,n=!0){let i=Bl(r),s=Bl(e);return t&&i.mode!==s.mode||i.mtimeSeconds!==s.mtimeSeconds||i.mtimeNanoseconds!==s.mtimeNanoseconds||i.ctimeSeconds!==s.ctimeSeconds||i.ctimeNanoseconds!==s.ctimeNanoseconds||i.uid!==s.uid||i.gid!==s.gid||n&&i.ino!==s.ino||i.size!==s.size}var Fv;function k8(){return Fv===void 0&&(Fv=new SC.default({maxPending:1/0})),Fv}function A8(r,e){return k8().acquire(r,e)}var Mv=Symbol("IndexCache");function C8(){return{map:new Map,stats:new Map}}async function T8(r,e,t){let[n,i]=await Promise.all([r.lstat(e),r.read(e)]),s=await Bv.from(i);t.map.set(e,s),t.stats.set(e,n)}async function R8(r,e,t){let n=t.stats.get(e);if(n===void 0)return!0;if(n===null)return!1;let i=await r.lstat(e);if(i===null)return!1;if(S8(n,i))return!0;let s=Bl(n),o=Bl(i);return s.mtimeNanoseconds!==o.mtimeNanoseconds||s.ctimeNanoseconds!==o.ctimeNanoseconds}var Ah=class{static async acquire({fs:e,gitdir:t,cache:n,allowUnmerged:i=!0},s){n[Mv]||(n[Mv]=C8());let o=`${t}/index`,a,l=[];return await A8(o,async()=>{let c=n[Mv];await R8(e,o,c)&&await T8(e,o,c);let u=c.map.get(o);if(l=u.unmergedPaths,l.length&&!i)throw new Sh(l);if(a=await s(u),u._dirty){let f=await u.toObject();await e.write(o,f),c.stats.set(o,await e.lstat(o)),u._dirty=!1}}),a}},Hv=class r extends De{constructor(e){super(`Expected a 40-char hex object id but saw "${e}".`),this.code=this.name=r.code,this.data={value:e}}};Hv.code="InvalidOidError";var Gv=class r extends De{constructor(e,t){super(`"${e}" would be an invalid git reference. (Hint: a valid alternative would be "${t}".)`),this.code=this.name=r.code,this.data={ref:e,suggestion:t}}};Gv.code="InvalidRefNameError";var Uv=class r extends De{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=r.code,this.data={remote:e}}};Uv.code="NoRefspecError";var jv=class r extends De{constructor(e){super(`Could not find ${e}.`),this.code=this.name=r.code,this.data={what:e}}};jv.code="NotFoundError";var zv=class r extends De{constructor(e,t,n){super(`HTTP Error: ${e} ${t}`),this.code=this.name=r.code,this.data={statusCode:e,statusMessage:t,response:n}}};zv.code="HttpError";var Vv=class r extends De{constructor(e,t){super(`Remote did not reply using the "smart" HTTP protocol. Expected "001e# service=git-upload-pack" but received: ${e}`),this.code=this.name=r.code,this.data={preview:e,response:t}}};Vv.code="SmartHttpError";var Wv=class r extends De{constructor(){super("The operation was canceled."),this.code=this.name=r.code,this.data={}}};Wv.code="UserCanceledError";var qv=class r extends De{constructor(){super("Empty response from git server."),this.code=this.name=r.code,this.data={}}};qv.code="EmptyServerResponseError";var Yv=class r extends De{constructor(e,t){super(`Expected "${e}" but received "${t}".`),this.code=this.name=r.code,this.data={expected:e,actual:t}}};Yv.code="ParseError";var Kv=class r extends De{constructor(e,t,n){super(`Git remote "${e}" uses an unrecognized transport protocol: "${t}"`),this.code=this.name=r.code,this.data={url:e,transport:t,suggestion:n}}};Kv.code="UnknownTransportError";var Zv=class r extends De{constructor(e){super(`Cannot parse remote URL: "${e}"`),this.code=this.name=r.code,this.data={url:e}}};Zv.code="UrlParseError";var Xv=class r extends De{constructor(e,t,n,i){super(`Object ${e} ${i?`at ${i}`:""}was anticipated to be a ${n} but it is a ${t}.`),this.code=this.name=r.code,this.data={oid:e,actual:t,expected:n,filepath:i}}};Xv.code="ObjectTypeError";var Qv=class r extends De{constructor(e){super(`Invalid compressed buffer: ${e}`),this.code=this.name=r.code,this.data={message:e}}};Qv.code="DecompressionError";var vY=32*1024*1024;var Jv=class r extends De{constructor(e){super(`No name was provided for ${e} in the argument or in the .git/config file.`),this.code=this.name=r.code,this.data={role:e}}};Jv.code="MissingNameError";var e0=class r extends De{constructor(e,t,n=!0){super(`Failed to create ${e} at ${t} because it already exists.${n?` (Hint: use 'force: true' parameter to overwrite existing ${e}.)`:""}`),this.code=this.name=r.code,this.data={noun:e,where:t,canForce:n}}};e0.code="AlreadyExistsError";var t0=class r extends De{constructor(e,t,n){super(`Found multiple ${e} matching "${t}" (${n.join(", ")}). Use a longer abbreviation length to disambiguate them.`),this.code=this.name=r.code,this.data={nouns:e,short:t,matches:n}}};t0.code="AmbiguousError";var r0=class r extends De{constructor(e){super(`Your local changes to the following files would be overwritten by checkout: ${e.join(", ")}`),this.code=this.name=r.code,this.data={filepaths:e}}};r0.code="CheckoutConflictError";var n0=class r extends De{constructor(e){super(`Your local changes to the following files would be overwritten by cherry-pick: ${e.join(", ")}`),this.code=this.name=r.code,this.data={filepaths:e}}};n0.code="CherryPickLocalChangesError";var i0=class r extends De{constructor(e,t){super(`Cannot cherry-pick merge commit ${e}. Merge commits have ${t} parents and require specifying which parent to use as the base.`),this.code=this.name=r.code,this.data={oid:e,parentCount:t}}};i0.code="CherryPickMergeCommitError";var s0=class r extends De{constructor(e){super(`Cannot cherry-pick root commit ${e}. Root commits have no parents.`),this.code=this.name=r.code,this.data={oid:e}}};s0.code="CherryPickRootCommitError";var o0=class r extends De{constructor(e,t){super(`Failed to checkout "${e}" because commit ${t} is not available locally. Do a git fetch to make the branch available locally.`),this.code=this.name=r.code,this.data={ref:e,oid:t}}};o0.code="CommitNotFetchedError";var a0=class r extends De{constructor(){super("Cannot create an empty commit when disallowEmpty is true."),this.code=this.name=r.code,this.data={}}};a0.code="EmptyCommitError";var l0=class r extends De{constructor(){super("A simple fast-forward merge was not possible."),this.code=this.name=r.code,this.data={}}};l0.code="FastForwardError";var c0=class r extends De{constructor(e,t){super(`One or more branches were not updated: ${e}`),this.code=this.name=r.code,this.data={prettyDetails:e,result:t}}};c0.code="GitPushError";var u0=class r extends De{constructor(e){let t="invalid filepath";e==="leading-slash"||e==="trailing-slash"?t='"filepath" parameter should not include leading or trailing directory separators because these can cause problems on some platforms.':e==="directory"&&(t='"filepath" should not be a directory.'),super(t),this.code=this.name=r.code,this.data={reason:e}}};u0.code="InvalidFilepathError";var f0=class r extends De{constructor(e){super(`Maximum search depth of ${e} exceeded.`),this.code=this.name=r.code,this.data={depth:e}}};f0.code="MaxDepthError";var d0=class r extends De{constructor(){super("Merges with conflicts are not supported yet."),this.code=this.name=r.code,this.data={}}};d0.code="MergeNotSupportedError";var h0=class r extends De{constructor(e,t,n,i){super(`Automatic merge failed with one or more merge conflicts in the following files: ${e.toString()}. Fix conflicts then commit the result.`),this.code=this.name=r.code,this.data={filepaths:e,bothModified:t,deleteByUs:n,deleteByTheirs:i}}};h0.code="MergeConflictError";var p0=class r extends De{constructor(e){super(`The function requires a "${e}" parameter but none was provided.`),this.code=this.name=r.code,this.data={parameter:e}}};p0.code="MissingParameterError";var m0=class r extends De{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=r.code,this.data={errors:e},this.errors=e}};m0.code="MultipleGitError";var g0=class r extends De{constructor(e){let t="";e==="not-fast-forward"?t=" because it was not a simple fast-forward":e==="tag-exists"&&(t=" because tag already exists"),super(`Push rejected${t}. Use "force: true" to override.`),this.code=this.name=r.code,this.data={reason:e}}};g0.code="PushRejectedError";var w0=class r extends De{constructor(e,t){super(`Remote does not support the "${e}" so the "${t}" parameter cannot be used.`),this.code=this.name=r.code,this.data={capability:e,parameter:t}}};w0.code="RemoteCapabilityError";var v0=class r extends De{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=r.code,this.data={filepath:e}}};v0.code="IndexResetError";var b0=class r extends De{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=r.code,this.data={ref:e}}};b0.code="NoCommitError";var bY=typeof Array.prototype.flat=="undefined"?r=>r.reduce((e,t)=>e.concat(t),[]):r=>r.flat();g();var Ku=nt(Nw(),1),AC=/[\ud800-￿]/;function CC(r,e,t){if(t<55296||t>57343)return!1;if(t<56320){let i=e+1<r.length?r.charCodeAt(e+1):0;return i<56320||i>57343}let n=e>0?r.charCodeAt(e-1):0;return n<55296||n>56319}function $8(r,e){if(!AC.test(r)&&!AC.test(e))return-(r<e)||+(r>e);let t=Math.min(r.length,e.length);for(let n=0;n<t;n++){let i=r.charCodeAt(n),s=e.charCodeAt(n);if(i!==s){if(CC(r,n,i)&&(i=65533),CC(e,n,s)&&(s=65533),i===s)continue;return i>=55296&&s>=55296&&(i+=i>=57344?-2048:8192,s+=s>=57344?-2048:8192),i<s?-1:1}}return r.length<e.length?-1:r.length>e.length?1:0}function IC(r){let e=Math.max(r.lastIndexOf("/"),r.lastIndexOf("\\"));return e===-1?".":e===0?"/":r.slice(0,e)}async function OC(r,e,t=10){try{await r(e)}catch(n){if(n===null||n.code==="EEXIST")return;if(n.code!=="ENOENT")throw n;let i=IC(e);if(i==="."||i==="/"||i===e)throw n;await OC(r,i,t);for(let s=0;;s++)try{await r(e);return}catch(o){if(o===null||o.code==="EEXIST")return;if(o.code==="ENOENT"&&s<t){await new Promise(a=>setTimeout(a,0));continue}throw o}}}function P8(r,e){let t="",n=0,i=-1,s=0,o="\0";for(let a=0;a<=r.length;++a){if(a<r.length)o=r[a];else{if(o==="/")break;o="/"}if(o==="/"){if(!(i===a-1||s===1))if(s===2){if(t.length<2||n!==2||t.at(-1)!=="."||t.at(-2)!=="."){if(t.length>2){let l=t.lastIndexOf("/");l===-1?(t="",n=0):(t=t.slice(0,l),n=t.length-1-t.lastIndexOf("/")),i=a,s=0;continue}else if(t.length!==0){t="",n=0,i=a,s=0;continue}}e&&(t+=t.length>0?"/..":"..",n=2)}else t.length>0?t+="/"+r.slice(i+1,a):t=r.slice(i+1,a),n=a-i-1;i=a,s=0}else o==="."&&s!==-1?++s:s=-1}return t}function I8(r){return r.length>=2&&/^[a-zA-Z]:/.test(r)?r.slice(0,2):null}function O8(r){if(!r.length)return".";r=r.replace(/\\/g,"/");let e=I8(r),t=r[0]==="/"||e!==null&&r[2]==="/",n=r.at(-1)==="/",i=e?r.slice(2):r,s=P8(i,!t);if(!s.length){let o=e?t?e+"/":e:t?"/":".";return n&&!t?o+"/":o}return n&&(s+="/"),e?t?`${e}/${s}`:`${e}${s}`:t?`/${s}`:s}function F8(...r){if(r.length===0)return".";let e;for(let t=0;t<r.length;++t){let n=r[t].replace(/\\/g,"/");n.length!==0&&(/^[a-zA-Z]:\//.test(n)||e===void 0?e=n:e+="/"+n)}return e===void 0?".":O8(e)}async function y0(r,e){let t=await r.readdir(e);t==null?await r.rm(e):t.length?await Promise.all(t.map(n=>{let i=F8(e,n);return r.lstat(i).then(s=>{if(s)return s.isDirectory()?y0(r,i):r.rm(i)})})).then(()=>r.rmdir(e)):await r.rmdir(e)}function M8(r){return D8(r)&&TC(r.then)&&TC(r.catch)}function D8(r){return r&&typeof r=="object"}function TC(r){return typeof r=="function"}function Yu(r){let e=r.code;return typeof e!="string"?!1:e==="ENOENT"||e==="ENOTDIR"||e.includes("ENS")}function RC(r){return M8((t=>{try{return t.readFile().catch(n=>n)}catch(n){return n}})(r))}var $C=["readFile","writeFile","mkdir","rmdir","unlink","stat","lstat","readdir","readlink","symlink"];function PC(r,e){if(RC(e))for(let t of $C)r[`_${t}`]=e[t].bind(e);else for(let t of $C)r[`_${t}`]=(0,Ku.default)(e[t].bind(e));RC(e)?(e.cp&&(r._cp=e.cp.bind(e)),e.rm?r._rm=e.rm.bind(e):e.rmdir.length>1?r._rm=e.rmdir.bind(e):r._rm=y0.bind(null,r)):(e.cp&&(r._cp=(0,Ku.default)(e.cp.bind(e))),e.rm?r._rm=(0,Ku.default)(e.rm.bind(e)):e.rmdir.length>2?r._rm=(0,Ku.default)(e.rmdir.bind(e)):r._rm=y0.bind(null,r))}var Ch=class{constructor(e){if(typeof e._original_unwrapped_fs!="undefined")return e;let t=Object.getOwnPropertyDescriptor(e,"promises");t&&t.enumerable?PC(this,e.promises):PC(this,e),this._original_unwrapped_fs=e}async exists(e,t={}){try{return await this._stat(e),!0}catch(n){if(Yu(n))return!1;throw console.log('Unhandled error in "FileSystem.exists()" function',n),n}}async read(e,t={}){let n;try{n=await this._readFile(e,t)}catch(i){if(Yu(i)||i.code==="EISDIR")return null;throw i}if(n==null)return null;if(t.autocrlf==="true")try{n=new TextDecoder("utf8",{fatal:!0}).decode(n),n=n.replace(/\r\n/g,`
`),n=new TextEncoder().encode(n)}catch(i){}return typeof n!="string"&&(n=_.from(n)),n}async write(e,t,n={}){try{await this._writeFile(e,t,n)}catch(i){await this.mkdir(IC(e)),await this._writeFile(e,t,n)}}async mkdir(e){await OC(this._mkdir,e)}async rm(e){try{await this._unlink(e)}catch(t){if(t.code!=="ENOENT")throw t}}async rmdir(e,t){try{t&&t.recursive?await this._rm(e,t):await this._rmdir(e)}catch(n){if(n.code!=="ENOENT")throw n}}async readdir(e){let t;try{t=await this._readdir(e)}catch(n){if(n.code==="ENOTDIR")return null;if(Yu(n))return[];throw n}return t.sort($8),t}async readdirDeep(e){let t=await this._readdir(e);return(await Promise.all(t.map(async i=>{let s=e+"/"+i;return(await this._stat(s)).isDirectory()?this.readdirDeep(s):s}))).reduce((i,s)=>i.concat(s),[])}async lstat(e){try{return await this._lstat(e)}catch(t){if(Yu(t))return null;throw t}}async readlink(e,t={encoding:"buffer"}){try{let n=await this._readlink(e,t);return _.isBuffer(n)?n:_.from(n)}catch(n){if(Yu(n))return null;throw n}}async writelink(e,t){return this._symlink(t.toString("utf8"),e)}};var bi=require("obsidian");g();function FC(r,e){let{autoCommitOnlyStaged:t,...n}=e,i=Object.assign({},r.lineAuthor,e.lineAuthor),s=Object.assign({},r,n,{lineAuthor:i});return t&&(s.autoCommitGlobMode="include",s.autoCommitGlobs=""),s}var Hl=class extends Error{constructor(t){super("No network connection available");this.originalError=t}},Xn=class extends Error{constructor(t,n){super("Git operation stopped because of merge conflicts");this.files=t;this.cause=n;this.name="GitConflictError"}};g();var MC=require("obsidian"),L8={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0,obscure:!1},_t=class extends MC.SuggestModal{constructor(e,t){if(super(e.app),this.config={...L8,...t},this.setPlaceholder(this.config.placeholder),this.config.obscure){this.inputEl.type="password";let n=this.containerEl.querySelector(".prompt-input-container");n.addClass("git-obscure-prompt"),n.setAttr("git-is-obscured","true");let i=n==null?void 0:n.createDiv({cls:"search-input-clear-button git-show-password"});i.id="git-show-password",i.addEventListener("click",()=>{n.getAttr("git-is-obscured")==="true"?(this.inputEl.type="text",n.setAttr("git-is-obscured","false")):(this.inputEl.type="password",n.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,t){this.config.obscure?t.hide():t.setText(e)}onChooseSuggestion(e,t){if(this.resolve){let n;this.config.allowEmpty&&e===" "?n="":e==="..."?n=void 0:n=e,this.resolve(n)}}};g();var oT=nt(sT(),1);function aT(r){return r.split(`
`).map(e=>e.trim()).filter(e=>e.length>0)}function bG(r){return r.replace(/\\.|[()]/g,e=>e.length===1?`\\${e}`:e)}function yG(r){let e=r.map(t=>({matches:(0,oT.default)(bG(t.replace(/\/+$/,"")||t),{dot:!0,nobrace:!0,noext:!0,nonegate:!0,posix:!0}),directoryOnly:t.endsWith("/"),literalDirectory:!t.includes("*")&&!t.includes("?")&&!t.includes("[")}));return t=>{let n=t.split("/");return e.some(({matches:i,directoryOnly:s,literalDirectory:o})=>{if(!s&&i(t))return!0;if(!o)return!1;for(let a=1;a<n.length;a++)if(i(n.slice(0,a).join("/")))return!0;return!1})}}function P0(r){if(r.mode==="include"&&r.globs.length===0)return()=>!1;let e=yG(r.globs);return t=>r.mode==="include"?e(t):!e(t)}g();var AT=nt(kT(),1),CT=require("child_process"),Cs=require("obsidian");function ef(r,e,t){return r===1?`${r} ${e}`:`${r} ${t!=null?t:e+"s"}`}var F0=(r,e)=>r==="."||e==null||e.length===0||e==="."?!0:e.length>=r.length?e.startsWith(r):r.startsWith(e);function En(r,e){let t;if(e){if(e.button===0||e.button===1){let n=Cs.Keymap.isModEvent(e);t=r.workspace.getLeaf(n)}}else t=r.workspace.getLeaf(!1);return t}function Ar(r){return r.getRoot().side==="left"?"right":"left"}function Zi(r,e,t,n,i){if(e.button==2){let s=r.vault.getAbstractFileByPath(t);if(s!=null){let o=new Cs.Menu;r.workspace.trigger("file-menu",o,s,i,n),o.showAtPosition({x:e.pageX,y:e.pageY})}else{let o=new Cs.Menu;r.workspace.trigger("obsidian-git:menu",o,t,i,n),o.showAtPosition({x:e.pageX,y:e.pageY})}}}function bo(r){throw new Error(`Impossible branch: ${String(r)}`)}function M0(r){return`rgb(${r.r},${r.g},${r.b})`}function TT(r){var s;let e=(s=AT.fromString(r))==null?void 0:s.toRgbaArray();if(e===void 0)return;let[t,n,i]=e;return{r:t,g:n,b:i}}function RT(r){return r.diff(Cs.moment.unix(0),"seconds")}function $T(r){if(r.length!==0)return r.slice().sort()[Math.floor(r.length/2)]}function tf(r,e){return new Proxy(r,{get(t,n){return n==="length"?Math.min(e,t.length):t[n]}})}function PT(r,e,t){return r.length<=e?new Array(e-r.length).fill(t).join("")+r:r.substring(r.length-e)}function IT(r,e){if(e<=0)return r;let t=new Array(e).fill(" ").join(""),n=r.substring(e,r.length);return t+n}function D0(r,e,t){return r<=e&&e<=t}function yo(r){let[e,...t]=r.split("/");return[e!=null?e:"",t.length===0?void 0:t.join("/")]}function Qn(r){return r.endsWith("/")?r:r.split("/").last().replace(/\.md$/,"")}function MG(r){let e=r.lastIndexOf(".");return r.substring(e+1)}function ua(r){if(r.endsWith(".md"))return!1;let e=MG(r);return wC.includes(e)}function L0(r){return(r.startsWith("https://github.com/")||r.startsWith("https://gitlab.com/"))&&(r.endsWith(".git")||(r=r+".git")),r}function zl(r,e){let t=e.vault.getAbstractFileByPath(r);if(!(t instanceof Cs.TFile))return!1;try{return!!e.viewRegistry.getTypeByExtension(t.extension)}catch(n){return!0}}function OT({isFolder:r,gitRelativePath:e}){let t="/";return t+=e,r&&(t+="/"),t.replace(/([\\!#*?[\]])/g,String.raw`\$1`).replace(/\s(?=\s*$)/g,String.raw`\ `)}function Vl(r,e,t,n){let i=e.target;r.workspace.trigger("hover-link",{event:e,source:t.getViewType(),hoverParent:t,targetEl:i,linktext:n})}function rf(r,e,t={}){return new Promise((n,i)=>{let s=(0,CT.spawn)(r,e,t),o="",a="";s.stdout.on("data",l=>{o+=l.toString()}),s.stderr.on("data",l=>{a+=l.toString()}),s.on("error",l=>{n({error:new Error(l.message),stdout:o,stderr:a,code:1})}),s.on("close",l=>{n({stdout:o,stderr:a,code:l!=null?l:1,error:void 0})})})}g();var FT=require("os"),Ih=require("obsidian");var Wl=class{constructor(e){this.plugin=e,this.app=e.app}async withGitOperation(e,t){var n;this.plugin.setPluginState({operation:e});try{return await t()}finally{(n=this.plugin.statusBar)==null||n.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,t=!0){if(t){let n=this.plugin.settings.basePath;if(n&&n.length>0){if(e.startsWith(n+"/"))return e.substring(n.length+1);if(e===n)return""}}return e}getVaultPathspec(){}isPathInsideVault(e){let t=this.getVaultPathspec();return t==null||e===t||e.startsWith(t+"/")}unload(){}simplify(e){var t,n,i,s;for(let o of e){for(;;){let a=((t=o.children)==null?void 0:t.length)==1,l=((i=(n=o.children)==null?void 0:n.first())==null?void 0:i.data)==null;if(!(o.children!=null&&a&&l))break;let c=o.children.first();o.title+="/"+c.title,o.data=c.data,o.path=c.path,o.vaultPath=c.vaultPath,o.children=c.children}o.children!=null&&this.simplify(o.children),(s=o.children)==null||s.sort((a,l)=>{let c=(l.data==null?1:0)-(a.data==null?1:0);return c!=0?c:a.title.localeCompare(l.title)})}return e.sort((o,a)=>{let l=(a.data==null?1:0)-(o.data==null?1:0);return l!=0?l:o.title.localeCompare(a.title)})}getTreeStructure(e,t="repository"){let n=new Map;for(let a of e){let c=(t==="vault"?a.vaultPath:a.path).split("/"),u=n,f="";for(let d=0;d<c.length;d++){let h=c[d];f=f?f+"/"+h:h;let p=d===c.length-1,m=u.get(h);if(!m){let w=t==="vault"?this.getRelativeRepoPath(f):f,y=t==="vault"?f:this.getRelativeVaultPath(f);m={title:h,path:w,vaultPath:y,children:new Map},u.set(h,m)}p&&(m.data=a),u=m.children}}let i=a=>{let l=[];for(let c of a.values())c.children.size>0?l.push({title:c.title,path:c.path,vaultPath:c.vaultPath,children:i(c.children)}):l.push({title:c.title,data:c.data,path:c.path,vaultPath:c.vaultPath});return l},s=i(n);return this.simplify(s)}async getStagedForMessage(){return this.status()}async formatCommitMessage(e){let t;if(e.includes("{{numFiles}}")){t=await this.getStagedForMessage();let n=t.staged.length+t.stagedOutsideVault;e=e.replace("{{numFiles}}",String(n))}if(e.includes("{{hostname}}")){let n=this.plugin.localStorage.getHostname()||"";!n&&Ih.Platform.isDesktopApp&&(n=(0,FT.hostname)()),e=e.replace("{{hostname}}",n)}if(e.includes("{{files}}")){t=t!=null?t:await this.getStagedForMessage();let n={},i;if(t.staged.length+t.stagedOutsideVault<100){t.staged.forEach(o=>{o.index in n?n[o.index].push(o.path):n[o.index]=[o.path]});let s=[];for(let[o,a]of Object.entries(n))s.push(o+" "+a.join(" "));i=s.join(", "),t.stagedOutsideVault>0&&(i+=`${i?", ":""}${t.stagedOutsideVault} outside vault`)}else i="Too many files to list";e=e.replace("{{files}}",i)}if(e=e.replace("{{date}}",(0,Ih.moment)().format(this.plugin.settings.commitDateFormat)),this.plugin.settings.listChangedFilesInMessageBody){let n=t!=null?t:await this.getStagedForMessage(),i;n.staged.length+n.stagedOutsideVault<100?(i=n.staged.map(s=>s.path).join(`
`),n.stagedOutsideVault>0&&(i+=`${i?`
`:""}${n.stagedOutsideVault} staged file${n.stagedOutsideVault===1?"":"s"} outside the vault`)):i="Too many files to list",e=e+`
Affected files:
`+i}return e}};g();var or=require("obsidian"),Oh={uid:0,gid:0,ino:0,dev:0},Fh=class extends Error{constructor(t){super(`File not found: ${t}`);this.code="ENOENT";this.name="FileNotFoundError"}},Mh=class{constructor(e,t){this.plugin=t;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,t){var i;if(e===void 0)return;if(e=(0,or.normalizePath)(e),this.maybeLog("Read: "+e+JSON.stringify(t)),(typeof t=="string"?t:t==null?void 0:t.encoding)==="utf8"){let s=this.vault.getAbstractFileByPath(e);return s instanceof or.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)):(i=this.index)!=null?i:this.adapter.readBinary(e);let s=this.vault.getAbstractFileByPath(e);return s instanceof or.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(s)):this.adapter.readBinary(e)}}async writeFile(e,t){var n;if(this.maybeLog("Write: "+e),e=(0,or.normalizePath)(e),typeof t=="string"){let i=this.vault.getAbstractFileByPath(e);if(i instanceof or.TFile)return this.vault.modify(i,t);if(!this.isHiddenPath(e))await this.vault.create(e,t);else return this.adapter.write(e,t)}else{let i=DG(t);if(this.isIndexPath(e)){this.index=i;let s=Date.now();(n=this.indexctime)!=null||(this.indexctime=s),this.indexmtime=s}else{let s=this.vault.getAbstractFileByPath(e);if(s instanceof or.TFile)return this.vault.modifyBinary(s,i);if(!this.isHiddenPath(e))await this.vault.createBinary(e,i);else return this.adapter.writeBinary(e,i)}}}async readdir(e){e=(0,or.normalizePath)(e),this.maybeLog("ReadDir: "+e),e==="."&&(e="/");let t=await this.adapter.list(e),n=[...t.files,...t.folders],i;return e!=="/"?i=n.map(s=>(0,or.normalizePath)(s.substring(e.length))):i=n,i}async mkdir(e){if(e=(0,or.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,t){var n,i;if(e=(0,or.normalizePath)(e),this.maybeLog("Rmdir: "+e+JSON.stringify(t)),!this.isHiddenPath(e)){let s=this.vault.getAbstractFileByPath(e);if(s instanceof or.TFolder){await this.vault.delete(s,(t==null?void 0:t.recursive)===!0||((n=t==null?void 0:t.options)==null?void 0:n.recursive)===!0);return}}return this.adapter.rmdir(e,(t==null?void 0:t.recursive)===!0||((i=t==null?void 0:t.options)==null?void 0:i.recursive)===!0)}async stat(e){if(e=(0,or.normalizePath)(e),this.isIndexPath(e)){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{...Oh,isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.byteLength,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let n=await this.adapter.stat(e);if(n==null)throw new Fh(e);return this.indexctime=n.ctime,this.indexmtime=n.mtime,{...Oh,ctimeMs:n.ctime,mtimeMs:n.mtime,size:n.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let t=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),t instanceof or.TFile)return this.maybeLog("Reuse stat"),{...Oh,ctimeMs:t.stat.ctime,mtimeMs:t.stat.mtime,size:t.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let n=await this.adapter.stat(e);if(n)return{...Oh,ctimeMs:n.ctime,mtimeMs:n.mtime,size:n.size,type:n.type==="folder"?"directory":n.type,isFile:()=>n.type==="file",isDirectory:()=>n.type==="folder",isSymbolicLink:()=>!1};throw new Fh(e)}}async unlink(e){if(e=(0,or.normalizePath)(e),!this.isHiddenPath(e)){let t=this.vault.getAbstractFileByPath(e);if(t instanceof or.TFile)return this.vault.delete(t)}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(t=>t.startsWith(".")&&t!==".")}maybeLog(e){}};function DG(r){return r instanceof ArrayBuffer?r:r.buffer instanceof ArrayBuffer&&r.byteOffset===0&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r.buffer,r.byteOffset,r.byteLength).slice().buffer}var HT=nt(BT(),1),Dr=class Dr extends Wl{constructor(t){super(t);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 Mh(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 t,n;return{username:(t=this.plugin.localStorage.getUsername())!=null?t:void 0,password:(n=this.plugin.gitServerPassword.get())!=null?n:void 0}},onAuthFailure:async()=>{new bi.Notice("Authentication failed. Please try with different credentials");let t=await new _t(this.plugin,{placeholder:"Specify your username"}).openAndGetResult();if(t){let n=await new _t(this.plugin,{placeholder:"Specify your password/personal access token",obscure:!0}).openAndGetResult();if(n)return this.plugin.localStorage.setUsername(t),await this.plugin.gitServerPassword.set(n),{username:t,password:n}}return{cancel:!0}},http:{async request({url:t,method:n,headers:i,body:s}){let o;s&&(o=await HG(s));let a=await(0,bi.requestUrl)({url:t,method:n,headers:{"Accept-Encoding":"identity",...i},body:o,throw:!1}),l=await GG(a.arrayBuffer);return{url:t,method:n,headers:a.headers,body:BG(l),statusCode:a.status,statusMessage:a.status.toString()}}}}}async wrapFS(t){try{let n=await t;return await this.fs.saveAndClear(),n}catch(n){throw await this.fs.saveAndClear(),n}}async status(t){let n,i=window.setTimeout(()=>{n=new bi.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let s={...this.getRepo()};(t==null?void 0:t.path)!=null&&(s.filepaths=[`${t.path}/`]);let o=(await this.wrapFS(ge.statusMatrix(s))).map(d=>this.getFileStatusResult(d)),a=await this.getConflictedFiles();if((t==null?void 0:t.path)!=null){let d=t.path.replace(/\/$/,"");a=a.filter(h=>h===d||h.startsWith(`${d}/`))}let l=[],c=[],u=[],f=new Set(a);for(let d of o)d.workingDir!==" "&&!f.has(d.path)&&l.push(d),d.index!==" "&&d.index!=="U"&&!f.has(d.path)&&c.push(d),(d.index!=" "||d.workingDir!=" ")&&u.push(d);return window.clearTimeout(i),n==null||n.hide(),{all:u,changed:l,staged:c,conflicted:a,stagedOutsideVault:0,conflictedOutsideVault:0}}catch(s){throw window.clearTimeout(i),n==null||n.hide(),s}}async commitAll({message:t,status:n,unstagedFiles:i,selection:s,amend:o}){return await this.checkAuthorInfo(),await this.stageAll({status:n,unstagedFiles:i,selection:s}),this.commit({message:t,amend:o})}selectAutoCommitFiles(t,n){let i=P0(n);return Promise.resolve({files:t.changed.filter(s=>i(s.path)),selection:n})}async commit({message:t,amend:n}){return this.withGitOperation(2,async()=>{try{await this.checkAuthorInfo();let i=await this.formatCommitMessage(t),s=await this.getMergeHeads(),o;s.length>0&&(o=[await this.resolveRef("HEAD"),...s]);let a=await this.wrapFS(ge.commit({...this.getRepo(),message:i,amend:n,parent:o})),l=await this.getCommittedFilesCount(a);return await this.clearMergeState(),this.plugin.setPluginState({mergeInProgress:!1}),this.app.workspace.trigger("obsidian-git:refs-changed"),l}catch(i){throw i instanceof Fr.UnmergedPathsError?new Xn(i.data.filepaths,i):i}})}async stage(t,n){let i=this.getRelativeRepoPath(t,n),s;n?s=t:s=this.getRelativeVaultPath(t),await this.app.vault.adapter.exists(s)?await this.wrapFS(ge.add({...this.getRepo(),filepath:i})):await this.wrapFS(ge.remove({...this.getRepo(),filepath:i}))}async stageAll({dir:t,status:n,unstagedFiles:i,selection:s}){let o=i!=null?i:n==null?void 0:n.changed,a=o?o.map(c=>({path:c.path,deleted:c.workingDir==="D"})):(await this.getUnstagedFiles(t!=null?t:".")).map(({path:c,type:u})=>({path:c,deleted:u==="D"})),l=s?P0(s):()=>!0;await this.stageFiles(a.filter(c=>l(c.path)))}async stageFiles(t){let i=(await this.wrapFS(Promise.allSettled(t.map(s=>s.deleted?ge.remove({...this.getRepo(),filepath:s.path}):ge.add({...this.getRepo(),filepath:s.path}))))).find(s=>s.status==="rejected");if((i==null?void 0:i.status)==="rejected")throw i.reason}async unstage(t,n){t=this.getRelativeRepoPath(t,n),await this.wrapFS(ge.resetIndex({...this.getRepo(),filepath:t}))}async unstageAll({dir:t,status:n}){let i;n?i=n.staged.map(s=>s.path):i=(await this.getStagedFiles(t!=null?t:".")).map(({path:o})=>o),await this.wrapFS(Promise.all(i.map(s=>ge.resetIndex({...this.getRepo(),filepath:s}))))}async discard(t){await this.wrapFS(ge.checkout({...this.getRepo(),filepaths:[t],force:!0}))}async discardAll({dir:t,status:n}){let i;n?t!=null?i=n.changed.filter(s=>s.workingDir!="U"&&s.path.startsWith(t)).map(s=>s.path):i=n.changed.filter(s=>s.workingDir!="U").map(s=>s.path):i=(await this.getUnstagedFiles(t)).filter(s=>s.type!="A").map(({path:s})=>s),await this.wrapFS(ge.checkout({...this.getRepo(),filepaths:i,force:!0}))}async getUntrackedPaths(t){let n=[];if(t.status)for(let i of t.status.changed)i.index=="U"&&i.workingDir==="U"&&i.path.startsWith(t.path!=null?`${t.path}/`:"")&&n.push(i.path);else{let i=await this.status({path:t==null?void 0:t.path});for(let s of i.changed)s.index==="U"&&s.workingDir==="U"&&n.push(s.path)}return n}getProgressText(t,n){let i=`${t} progress:`;return n.phase&&(i=`${i} ${n.phase}:`),n.loaded&&(i=`${i} ${n.loaded}`,n.total&&(i=`${i} of ${n.total}`)),i}resolveRef(t){return this.wrapFS(ge.resolveRef({...this.getRepo(),ref:t}))}async pull(){return this.withGitOperation(1,async()=>{let t;try{if(await this.isMergeInProgress())throw new Error("Cannot pull because a merge is still in progress. Commit or abort it first.");let n=await this.branchInfo();if(!n.current)throw new Error("No current branch found. Cannot pull.");let i=await this.resolveRef(n.current);if(!n.tracking)return this.plugin.log("No tracking branch found. Ignoring pull."),{status:"skipped",reason:"no-upstream"};await this.fetch();let s=await this.resolveRef(n.tracking);if(i===s)return{status:"up-to-date"};await this.checkAuthorInfo(),t={ours:i,theirs:s,message:`Merge branch '${n.tracking}' into ${n.current}`};let o={...this.getRepo(),ours:n.current,theirs:n.tracking,message:t.message,noUpdateBranch:!0,mergeDriver:this.plugin.settings.mergeStrategy!=="none"?this.mergeDriver.bind(this):void 0},a;try{a=await this.wrapFS(ge.merge({...o,abortOnConflict:!0}))}catch(c){throw c instanceof Fr.MergeConflictError?(await this.ensureCleanPullWorktree(i,!0),await this.ensureNoIncomingFileCollisions(await this.getFileChanges(i,s)),await this.wrapFS(ge.merge({...o,abortOnConflict:!1})),new Error("Merge conflict was not reproduced.")):c}if(a.alreadyMerged)return{status:"up-to-date"};if(!a.oid)throw new Error("Pull did not produce a commit to check out.");let l=await this.getFileChanges(i,a.oid);if(l.length>0){let c=l.map(u=>u.path);await this.ensureNoIncomingFileCollisions(l),await this.ensureCleanPullWorktree(i,!0,c),await this.wrapFS(ge.checkout({...this.getRepo(),ref:a.oid,noUpdateHead:!0,force:!!a.mergeCommit,filepaths:c}))}return await this.wrapFS(ge.writeRef({...this.getRepo(),ref:`refs/heads/${n.current}`,value:a.oid,force:!0})),this.app.workspace.trigger("obsidian-git:refs-changed"),{status:"updated",outsideVault:0,files:l.map(c=>({path:c.path,workingDir:"P",index:"P",vaultPath:this.getRelativeVaultPath(c.path)}))}}catch(n){throw n instanceof Fr.MergeConflictError?(t!==void 0&&await this.writeMergeState(t),new Xn(n.data.filepaths,n)):n}})}mergeDriver({contents:t}){var d,h,p;let n=t[0],i=t[1],s=t[2],o=/^.*(\r?\n|$)/gm,a=(d=i.match(o))!=null?d:[],l=(h=n.match(o))!=null?h:[],c=(p=s.match(o))!=null?p:[],u=(0,HT.default)(a,l,c),f="";for(let m of u)m.ok&&(f+=m.ok.join("")),m.conflict&&(f+=this.plugin.settings.mergeStrategy==="ours"?m.conflict.a.join(""):m.conflict.b.join(""));return{cleanMerge:!0,mergedText:f}}async ensureCleanPullWorktree(t,n=!1,i){let o=(await this.wrapFS(ge.statusMatrix({...this.getRepo(),ref:t,filepaths:i}))).filter(([,a,l,c])=>a!==l||n&&a!==c).map(([a])=>a);if(o.length>0)throw new Error(`Cannot pull with uncommitted working tree changes: ${o.join(", ")}`)}async ensureNoIncomingFileCollisions(t){for(let n of t)if(n.type==="A"&&await this.app.vault.adapter.exists(this.getRelativeVaultPath(n.path)))throw new Error(`Cannot pull because an untracked file would be overwritten: ${n.path}`)}async push(){let t=this.showNotice("Initializing push");return this.withGitOperation(3,async()=>{try{let n=await this.branchInfo(),i=n.tracking,s=n.current;if(!s)return t==null||t.hide(),{status:"blocked",reason:"no-branch"};if(!i)return t==null||t.hide(),this.plugin.log("No tracking branch found. Ignoring push."),{status:"skipped",reason:"no-upstream"};let o=await this.getFileChangesCount(s,i),a=await this.getCurrentRemote();return await this.wrapFS(ge.push({...this.getRepo(),remote:a,onProgress:l=>{t!==void 0&&t.setMessage(this.getProgressText("Pushing",l))}})),t==null||t.hide(),this.app.workspace.trigger("obsidian-git:refs-changed"),o===0?{status:"up-to-date"}:{status:"pushed",files:o}}catch(n){throw t==null||t.hide(),n}})}async getUnpushedCommits(){let t=await this.branchInfo(),n=t.tracking,i=t.current;if(n==null||i==null)return 0;let s=await this.resolveRef(i),o=await this.resolveRef(n);return await this.getFileChangesCount(s,o)}async canPush(){let t=await this.branchInfo(),n=t.tracking,i=t.current;if(!i)return this.plugin.log("During canPush check, no current branch found."),!1;if(!n)return!1;let s=await this.resolveRef(i),o=await this.resolveRef(n);return s!=o}async checkRequirements(){return await this.plugin.app.vault.adapter.exists((0,bi.normalizePath)(`${this.getGitDirPath()}/HEAD`))?"valid":"missing-repo"}async branchInfo(){var a,l;let t=await ge.currentBranch(this.getRepo()),n=await ge.listBranches(this.getRepo()),i=(a=t&&await this.getConfig(`branch.${t}.remote`))!=null?a:"origin",s=t?(l=await this.getConfig(`branch.${t}.merge`))==null?void 0:l.split("refs/heads")[1]:void 0,o=s?i+s:void 0;return{current:t||void 0,tracking:o,branches:n,remote:i}}async getCurrentRemote(){var i;let t=await ge.currentBranch(this.getRepo())||"";return(i=await this.getConfig(`branch.${t}.remote`))!=null?i:"origin"}async checkout(t,n){return this.withGitOperation(5,async()=>{await this.wrapFS(ge.checkout({...this.getRepo(),ref:t,force:!!n,remote:n})),this.app.workspace.trigger("obsidian-git:refs-changed")})}async createBranch(t){await this.wrapFS(ge.branch({...this.getRepo(),ref:t,checkout:!0})),this.app.workspace.trigger("obsidian-git:refs-changed")}async deleteBranch(t){await this.wrapFS(ge.deleteBranch({...this.getRepo(),ref:t})),this.app.workspace.trigger("obsidian-git:refs-changed")}branchIsMerged(t){return Promise.resolve(!0)}async init(){await this.wrapFS(ge.init(this.getRepo()))}async clone(t,n,i){let s=this.showNotice("Initializing clone");try{await this.wrapFS(ge.clone({...this.getRepo(),dir:n,url:t,depth:i,onProgress:o=>{s!==void 0&&s.setMessage(this.getProgressText("Cloning",o))}}))}finally{s==null||s.hide()}}async setConfig(t,n){return this.wrapFS(ge.setConfig({...this.getRepo(),path:t,value:n}))}async getConfig(t){return this.wrapFS(ge.getConfig({...this.getRepo(),path:t}))}async fetch(t){let n=this.showNotice("Initializing fetch");try{let i={...this.getRepo(),onProgress:s=>{n!==void 0&&n.setMessage(this.getProgressText("Fetching",s))},remote:t!=null?t:await this.getCurrentRemote()};await this.wrapFS(ge.fetch(i)),this.app.workspace.trigger("obsidian-git:refs-changed"),n==null||n.hide()}catch(i){throw n==null||n.hide(),i}}async setRemote(t,n){await this.wrapFS(ge.addRemote({...this.getRepo(),remote:t,url:n,force:!0}))}async getRemoteBranches(t){let n=[];return n.push(...await this.wrapFS(ge.listBranches({...this.getRepo(),remote:t}))),n.remove("HEAD"),n=n.map(i=>`${t}/${i}`),n}async getRemotes(){return(await this.wrapFS(ge.listRemotes({...this.getRepo()}))).map(t=>t.remote)}async removeRemote(t){await this.wrapFS(ge.deleteRemote({...this.getRepo(),remote:t})),this.app.workspace.trigger("obsidian-git:refs-changed")}async getRemoteUrl(t){var n;return(n=(await this.wrapFS(ge.listRemotes({...this.getRepo()}))).filter(i=>i.remote==t)[0])==null?void 0:n.url}async log(t,n=!0,i,s){var c;let o={},a=await this.wrapFS(ge.log({...this.getRepo(),depth:i,ref:s,cache:o})),l=[];for(let u of a){let f=u.commit.message.split(`
`);l.push({message:(c=f[0])!=null?c:"",author:{name:u.commit.author.name,email:u.commit.author.email},body:f.slice(1).join(`
`),date:new Date(u.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChanges(u.commit.parent.first(),u.oid,o)).map(d=>({path:d.path,status:d.type,vaultPath:this.getRelativeVaultPath(d.path),hash:u.oid}))},hash:u.oid,refs:[]})}return l}updateBasePath(t){return this.getRepo().dir=t,Promise.resolve()}getGitDirPath(){return(0,bi.normalizePath)(this.getRelativeVaultPath(this.plugin.settings.gitDir||".git"))}async getConflictedFiles(){let t=Ah.acquire({fs:new Ch(this.fs),gitdir:this.getGitDirPath(),cache:{}},i=>i.unmergedPaths),n=await this.wrapFS(t);if(!Array.isArray(n)||!n.every(i=>typeof i=="string"))throw new TypeError("isomorphic-git returned invalid unmerged paths");return n}getMergeStatePath(t){return(0,bi.normalizePath)(`${this.getGitDirPath()}/${t}`)}async isMergeInProgress(){return this.app.vault.adapter.exists(this.getMergeStatePath(Dr.MERGE_HEAD))}async getMergeHeads(){let t=this.getMergeStatePath(Dr.MERGE_HEAD);return await this.app.vault.adapter.exists(t)?(await this.app.vault.adapter.read(t)).split(/\r?\n/).map(n=>n.trim()).filter(n=>n.length>0):[]}async writeMergeState({ours:t,theirs:n,message:i}){let s=this.app.vault.adapter;await s.write(this.getMergeStatePath(Dr.ORIGINAL_HEAD),`${t}
`),await s.write(this.getMergeStatePath(Dr.MERGE_MESSAGE),`${i}
`),await s.write(this.getMergeStatePath(Dr.MERGE_MODE),""),await s.write(this.getMergeStatePath(Dr.MERGE_HEAD),`${n}
`)}async clearMergeState(){let t=this.app.vault.adapter;for(let n of[Dr.MERGE_HEAD,Dr.MERGE_MESSAGE,Dr.MERGE_MODE]){let i=this.getMergeStatePath(n);await t.exists(i)&&await t.remove(i)}}async updateUpstreamBranch(t){let[n,i]=yo(t),s=await this.branchInfo();await this.wrapFS(ge.push({...this.getRepo(),remote:n,remoteRef:i})),this.app.workspace.trigger("obsidian-git:refs-changed"),await this.setConfig(`branch.${s.current}.merge`,`refs/heads/${i}`)}updateGitPath(t){return Promise.resolve()}async getCommittedFilesCount(t){let{commit:n}=await this.wrapFS(ge.readCommit({...this.getRepo(),oid:t})),i=n.parent[0];return i?await this.getFileChangesCount(i,t):(await this.wrapFS(ge.listFiles({...this.getRepo(),ref:t}))).length}async getFileChangesCount(t,n,i){return(await this.getFileChanges(t,n,i)).length}async getFileChanges(t,n,i){return this.walkDifference({cache:i,walkers:[ge.TREE({ref:t}),ge.TREE({ref:n})]})}async walkDifference({walkers:t,dir:n,cache:i}){return this.wrapFS(N0({...this.getRepo(),trees:t,cache:i,map:async(s,[o,a])=>{if(!F0(s,n))return null;let l=await(o==null?void 0:o.type()),c=await(a==null?void 0:a.type());if(l==="tree"||c==="tree"){if(s!=="."&&l===c){let m=await(o==null?void 0:o.oid());if(m!==void 0&&m===await(a==null?void 0:a.oid()))return null}return}let[u,f,d,h]=await Promise.all([o==null?void 0:o.oid(),a==null?void 0:a.oid(),o==null?void 0:o.mode(),a==null?void 0:a.mode()]),p="equal";if((u!==f||d!==h)&&(p="M"),u===void 0&&(p="A"),f===void 0&&(p="D"),u===void 0&&f===void 0&&this.plugin.warn("Missing object IDs in both Git trees while comparing file:",s),p!=="equal")return{path:s,type:p}}}))}async getStagedForMessage(){try{await this.resolveRef("HEAD")}catch(n){if(n instanceof Fr.NotFoundError)return super.getStagedForMessage();throw n}return{staged:(await this.getStagedFiles()).map(({path:n,vaultPath:i,type:s})=>({path:n,vaultPath:i,index:s,workingDir:" "})),stagedOutsideVault:0}}async getStagedFiles(t="."){return(await this.walkDifference({walkers:[ge.TREE({ref:"HEAD"}),ge.STAGE()],dir:t})).map(i=>({vaultPath:this.getRelativeVaultPath(i.path),path:i.path,type:i.type}))}async getUnstagedFiles(t="."){let n,i=window.setTimeout(()=>{n=new bi.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let s=this.getRepo(),o=await this.wrapFS(N0({...s,trees:[ge.WORKDIR(),ge.STAGE()],map:async function(a,[l,c]){if(!c&&l&&await ge.isIgnored({...s,filepath:a})||!F0(a,t))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:a,type:"M"}:null:{path:a,type:"A"}:{path:a,type:"D"}}}));return window.clearTimeout(i),n==null||n.hide(),o}catch(s){throw window.clearTimeout(i),n==null||n.hide(),s}}async getDiffString(t,n=!1,i){let s=this.getRelativeVaultPath(t),o=async(c,[u])=>{if(t==c){let f=await u.oid();return(await ge.readBlob({...this.getRepo(),oid:f})).blob}};if(i){let c=await Nl({...this.getRepo(),filepath:t,oid:i}).then(p=>new TextDecoder().decode(p.blob)).catch(p=>{if(!(p instanceof ge.Errors.NotFoundError))throw p}),f=(await ge.readCommit({...this.getRepo(),oid:i})).commit.parent.first(),d;return f&&(d=await Nl({...this.getRepo(),filepath:t,oid:f}).then(p=>new TextDecoder().decode(p.blob)).catch(p=>{if(!(p instanceof ge.Errors.NotFoundError))throw p})),Wu(s,d!=null?d:"",c!=null?c:"")}let a=(await N0({...this.getRepo(),trees:[ge.STAGE()],map:o})).first(),l=new TextDecoder().decode(a);if(n){let c=await this.resolveRef("HEAD").then(f=>Nl({...this.getRepo(),filepath:t,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof ge.Errors.NotFoundError))throw f});return Wu(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="",Wu(s,l,c)}}async show(t,n,i=!0){let s=this.getRelativeRepoPath(n,i),{blob:o}=await Nl({...this.getRepo(),oid:t,filepath:s});return new TextDecoder().decode(o)}async getLastCommitTime(){let t=this.getRepo(),n=await this.resolveRef("HEAD"),s=(await ge.readCommit({...t,oid:n})).commit.committer.timestamp;return new Date(s*1e3)}getFileStatusResult(t){var s,o;let n=`${t[this.HEAD]}${t[this.WORKDIR]}${t[this.STAGE]}`,i=this.status_mapping[n];if(i===void 0)throw new Error(`Unsupported status matrix row: ${n}`);return{index:i[0]=="?"?"U":(s=i[0])!=null?s:" ",workingDir:i[1]=="?"?"U":(o=i[1])!=null?o:" ",path:t[this.FILE],vaultPath:this.getRelativeVaultPath(t[this.FILE])}}async checkAuthorInfo(){let t=await this.getConfig("user.name"),n=await this.getConfig("user.email");if(!t||!n)throw Error("Git author name and email are not set. Please set both fields in the settings.")}showNotice(t,n=!0){if(!this.plugin.settings.disablePopups)return new bi.Notice(t,n?this.noticeLength:void 0)}};Dr.MERGE_HEAD="MERGE_HEAD",Dr.MERGE_MESSAGE="MERGE_MSG",Dr.MERGE_MODE="MERGE_MODE",Dr.ORIGINAL_HEAD="ORIG_HEAD";var Ts=Dr;async function N0(r){let e=await ge.walk(r);if(!Array.isArray(e))throw new TypeError("isomorphic-git walk returned a non-array result");return e}function BG(r){let e=[new Uint8Array(r)].values();return{next:()=>Promise.resolve(e.next()),[Symbol.asyncIterator](){return this}}}async function HG(r){let e=new ReadableStream({async start(n){for await(let i of r)n.enqueue(i);n.close()}});return await new Response(e).arrayBuffer()}async function GG(r){let e=new Uint8Array(r);if(e.length<2||e[0]!==31||e[1]!==139)return r;try{let t=new Blob([r]).stream().pipeThrough(new DecompressionStream("gzip"));return await new Response(t).arrayBuffer()}catch(t){return r}}g();var l$=nt(Nh(),1),Tn=nt(require("fs/promises"),1),Eo=require("obsidian"),Fe=nt(require("path"),1),uf=require("path");g();g();var B0=new WeakMap;function nf(...r){let e=new String(r);return B0.set(e,r),e}function Xi(r){return r instanceof String&&B0.has(r)}function Zl(r){var e;return(e=B0.get(r))!=null?e:[]}var Qh=nt(WT(),1),wR=require("node:child_process"),Jh=nt(Nh(),1),_o=nt(qT(),1),vR=require("node:path");g();function*YT(r,e){let t=e==="global";for(let n of r)n.isGlobal===t&&(yield n)}var oU=new Set(["--add","--edit","--remove-section","--rename-section","--replace-all","--unset","--unset-all","-e"]),aU=new Set(["--get","--get-all","--get-color","--get-colorbool","--get-regexp","--get-urlmatch","--list","-l"]),lU=new Set(["edit","remove-section","rename-section","set","unset"]),cU=new Set(["get","get-color","get-colorbool","list"]);function uU(r,e){var n;for(let{name:i}of YT(r,"task")){if(oU.has(i))return Ql(!0,e);if(aU.has(i))return Ql(!1,e)}let t=(n=e.at(0))==null?void 0:n.toLowerCase();return t===void 0?null:lU.has(t)?Ql(!0,e.slice(1)):cU.has(t)?Ql(!1,e.slice(1)):e.length===1?Ql(!1,e):Ql(!0,e)}function Ql(r=!1,e=[]){var n;let t=(n=e.at(0))==null?void 0:n.toLowerCase();return t===void 0?null:{isWrite:r,isRead:!r,key:t,value:e.at(1)}}function fU(r,e){return e.isWrite&&e.value!==void 0?{key:e.key,value:e.value,scope:r}:{key:e.key,scope:r}}function dU(r){let e=(r==null?void 0:r.indexOf("="))||-1;return!r||e<0?null:{key:r.slice(0,e).trim().toLowerCase(),value:r.slice(e+1)}}function hU(r){for(let{name:e}of YT(r,"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 pU({name:r}){if(r==="-c"||r==="--config")return"inline";if(r==="--config-env")return"env"}function*mU(r){for(let e of r){let t=pU(e),n=t&&dU(e.value);n&&(yield{...n,scope:t})}}function gU(r,e,t){let n={read:[],write:[...mU(e)]};return r==="config"&&wU(n,hU(e),uU(e,t)),n}function wU(r,e,t){if(t===null)return;let n=fU(e,t);t.isWrite?r.write.push(n):r.read.push(n)}var KT={short:new Map([["c",!0]])},vU={short:new Map([["C",!0],["P",!1],["h",!1],["p",!1],["v",!1],...KT.short.entries()]),long:new Set(["attr-source","config-env","exec-path","git-dir","list-cmds","namespace","super-prefix","work-tree"])},bU={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"])},rebase:{short:new Map([["X",!0],["f",!1],["i",!1],["k",!1],["m",!1],["n",!1],["q",!1],["r",!1],["s",!0],["v",!1],["x",!0]]),long:new Set(["exec","onto","strategy","strategy-option"])}},yU={short:new Map,long:new Set};function _U(r){var t;let e=(t=bU[r!=null?r:""])!=null?t:yU;return{short:new Map([...KT.short.entries(),...e.short.entries()]),long:e.long}}function ZT(r,e=vU){if(r.startsWith("--")){let t=r.indexOf("=");if(t>2)return[{name:r.slice(0,t),value:r.slice(t+1),needsNext:!1}];let n=r.slice(2);return[{name:r,needsNext:e.long.has(n)}]}if(r.length===2){let t=r.charAt(1),n=e.short.get(t);return[{name:r,needsNext:n===!0}]}return xU(r,e.short)}function xU(r,e){let t=r.slice(1).split(""),n=[];for(let i=0;i<t.length;i++){let s=t[i],o=e.get(s);if(o===void 0)return[{name:r,needsNext:!1}];if(o){let a=t.slice(i+1).join("");if(a&&![...a].every(l=>e.has(l)))return n.push({name:`-${s}`,value:a,needsNext:!1}),n}n.push({name:`-${s}`,needsNext:o})}return n}function EU(r,e=[]){let t=0;for(;t<r.length;){let n=String(r[t]);if(!n.startsWith("-")||n.length<2)break;let i=ZT(n),s=t+1;for(let o of i){let a={name:o.name,value:o.value,absorbedNext:!1,isGlobal:!0};o.needsNext&&a.value===void 0&&s<r.length&&(a.value=String(r[s]),a.absorbedNext=!0,s++),e.push(a)}t=s}return{flags:e,taskIndex:t}}function SU(r,e,t=[]){let n=_U(e),i=[],s=[],o=0;for(;o<r.length;){let a=r[o];if(Xi(a)){s.push(...Zl(a)),o++;continue}let l=String(a);if(l==="--"){for(let f=o+1;f<r.length;f++){let d=r[f];Xi(d)?s.push(...Zl(d)):s.push(String(d))}break}if(!l.startsWith("-")||l.length<2){i.push(l),o++;continue}let c=ZT(l,n),u=o+1;for(let f of c){let d={name:f.name,value:f.value,absorbedNext:!1,isGlobal:!1};f.needsNext&&d.value===void 0&&u<r.length&&!Xi(r[u])&&(d.value=String(r[u]),d.absorbedNext=!0,u++),t.push(d)}o=u}return{flags:t,positionals:i,pathspecs:s}}function*kU({write:r}){for(let e of r)for(let t of AU){let n=t(e.key);n&&(yield n)}}function sn(r,e,t=String(r)){let n=typeof r=="string"?new RegExp(`\\s*${r.toLowerCase()}`):r;return function(i){if(n.test(i))return{category:e,message:`Configuring ${t} is not permitted without enabling ${e}`}}}function Dt(r,e){let t=new RegExp(`\\s*${r.toLowerCase().replace(/\./g,"(..+)?.")}`);return sn(t,e,r)}var AU=[sn("alias","allowUnsafeAlias"),sn("core.askPass","allowUnsafeAskPass"),sn("core.editor","allowUnsafeEditor"),sn("core.fsmonitor","allowUnsafeFsMonitor"),sn("core.gitProxy","allowUnsafeGitProxy"),sn("core.hooksPath","allowUnsafeHooksPath"),sn("core.pager","allowUnsafePager"),sn("core.sshCommand","allowUnsafeSshCommand"),Dt("credential.helper","allowUnsafeCredentialHelper"),Dt("diff.command","allowUnsafeDiffExternal"),sn("diff.external","allowUnsafeDiffExternal"),Dt("difftool.cmd","allowUnsafeDiffExternal"),Dt("diff.textconv","allowUnsafeDiffTextConv"),Dt("filter.clean","allowUnsafeFilter"),Dt("filter.process","allowUnsafeFilter"),Dt("filter.smudge","allowUnsafeFilter"),Dt("gpg.program","allowUnsafeGpgProgram"),sn("include.path","allowUnsafeInclude"),Dt("includeIf","allowUnsafeInclude"),sn("init.templateDir","allowUnsafeTemplateDir"),Dt("pager.","allowUnsafePager"),Dt("merge.driver","allowUnsafeMergeDriver"),Dt("mergetool.path","allowUnsafeMergeDriver"),Dt("mergetool.cmd","allowUnsafeMergeDriver"),Dt("protocol.allow","allowUnsafeProtocolOverride"),Dt("remote.receivepack","allowUnsafePack"),Dt("remote.uploadpack","allowUnsafePack"),sn("uploadpack.packObjectsHook","allowUnsafePack"),sn("sequence.editor","allowUnsafeEditor"),Dt("submodule.update","allowUnsafeSubmodule"),Dt("tar.command","allowUnsafeCommandBinaries"),Dt("trailer.cmd","allowUnsafeCommandBinaries"),Dt("trailer.command","allowUnsafeCommandBinaries"),Dt("url.insteadOf","allowUnsafeUrlRewrite")];function*CU(r,e){for(let t of e)for(let n of TU){let i=n(r,t);i&&(yield i)}}function Qi(r,e,t,{name:n=String(e),globalOnly:i=!1,withValue:s=!1}={}){let o=typeof e=="string"?new RegExp(`\\s*${e.toLowerCase()}`):e,a=`Use of ${r?`${r} with option `:""}${n} is not permitted without enabling ${t}`;return function(l,c){if(!(r&&l!==r)&&!(i&&!c.isGlobal)&&!(s&&c.value===void 0)&&o.test(c.name))return{category:t,message:a}}}var Hh={globalOnly:!0,withValue:!0},TU=[Qi(null,/--(upload|receive)-pack/,"allowUnsafePack",{name:"--upload-pack or --receive-pack"}),Qi("clone",/^-\w*u/,"allowUnsafePack"),Qi("clone","--u","allowUnsafePack"),Qi("push",/^--exec$/,"allowUnsafePack",{name:"--exec"}),Qi("rebase",/^(-x|--ex(ec?)?)$/,"allowUnsafeExec",{name:"-x or --exec"}),Qi(null,"--template","allowUnsafeTemplateDir"),Qi(null,"--exec-path","allowUnsafeExec",Hh),Qi(null,"--git-dir","allowUnsafeConfigPaths",Hh),Qi(null,"--work-tree","allowUnsafeConfigPaths",Hh),Qi(null,/^-C$/,"allowUnsafeConfigPaths",{...Hh,name:"-C"})];function XT(r,e,t){return[...CU(r,e),...kU(t)]}function RU(...r){let{flags:e,taskIndex:t}=EU(r),n=t<r.length?String(r[t]).toLowerCase():null,i=n!==null?r.slice(t+1):[],{positionals:s,pathspecs:o}=SU(i,n,e),a=gU(n,e,s);return{task:n,flags:e.map(PU),paths:o,config:a,vulnerabilities:$U(XT(n,e,a))}}function $U(r){return Object.defineProperty(r,"vulnerabilities",{value:r})}function PU({value:r,name:e}){return r!==void 0?{name:e,value:r}:{name:e}}var QT={editor:"allowUnsafeEditor",git_askpass:"allowUnsafeAskPass",git_config_global:"allowUnsafeConfigPaths",git_config_system:"allowUnsafeConfigPaths",git_config_count:"allowUnsafeConfigEnvCount",git_config_parameters:"allowUnsafeConfigEnvCount",git_config:"allowUnsafeConfigPaths",git_editor:"allowUnsafeEditor",git_exec_path:"allowUnsafeExec",git_external_diff:"allowUnsafeDiffExternal",git_pager:"allowUnsafePager",git_proxy_command:"allowUnsafeGitProxy",git_template_dir:"allowUnsafeTemplateDir",git_sequence_editor:"allowUnsafeEditor",git_ssh:"allowUnsafeSshCommand",git_ssh_command:"allowUnsafeSshCommand",pager:"allowUnsafePager",prefix:"allowUnsafeConfigPaths",ssh_askpass:"allowUnsafeAskPass",visual:"allowUnsafeEditor"};function*IU(r){var t;let e=parseInt((t=r.git_config_count)!=null?t:"0",10);for(let n=0;n<e;n++){let i=r[`git_config_key_${n}`],s=r[`git_config_value_${n}`];i!==void 0&&(yield{key:i.toLowerCase().trim(),value:s,scope:"env"})}}function*OU(r){for(let e of Object.keys(r))if(Gh(e)){let t=QT[e];yield{category:t,message:`Use of "${e.toUpperCase()}" is not permitted without enabling ${t}`}}}function Gh(r){return Object.hasOwn(QT,r)}function FU(r){let e={};for(let[t,n]of Object.entries(r)){let i=t.toLowerCase().trim();(Gh(i)||i.startsWith("git"))&&(e[i]=String(n))}return e}function MU(r){let e=FU(r),t={read:[],write:[...IU(e)]},n=[...OU(e),...XT(null,[],t)];return{config:t,vulnerabilities:n}}function JT(r,e){return[...RU(...r).vulnerabilities,...MU(e).vulnerabilities]}var bR=require("node:events"),vr=class extends Error{constructor(e,t){super(t),this.task=e,Object.setPrototypeOf(this,new.target.prototype)}},W0=class extends vr{constructor(e,t){super(void 0,t),this.config=e}},Rs=class extends vr{constructor(e,t,n){super(e,n),this.task=e,this.plugin=t,Object.setPrototypeOf(this,new.target.prototype)}},af=class extends vr{constructor(e,t){super(void 0,t||String(e)),this.git=e}},q0=class extends vr{constructor(e){super(void 0,e)}},zh="\0",ep=()=>{};function DU(r){return typeof r!="function"?ep:r}function LU(r){return typeof r=="function"&&r!==ep}function NU(r,e){let t=r.indexOf(e);return t<=0?[r,""]:[r.substr(0,t),r.substr(t+1)]}function BU(r,e=0){return yR(r)&&r.length>e?r[e]:void 0}function Jl(r,e=0){if(yR(r)&&r.length>e)return r[r.length-1-e]}function yR(r){return ER(r)}function tp(r="",e=!0,t=`
`){return r.split(t).reduce((n,i)=>{let s=e?i.trim():i;return s&&n.push(s),n},[])}function hb(r,e){return tp(r,!0).map(t=>e(t))}function _R(r){return(0,Qh.exists)(r,Qh.FOLDER)}function yi(r,e){return Array.isArray(r)?r.includes(e)||r.push(e):r.add(e),e}function HU(r,e){return Array.isArray(r)&&!r.includes(e)&&r.push(e),r}function pb(r,e){if(Array.isArray(r)){let t=r.indexOf(e);t>=0&&r.splice(t,1)}else r.delete(e);return e}var mb=Object.prototype.toString.call.bind(Object.prototype.toString);function An(r){return Array.isArray(r)?r:[r]}function xR(r){return r.replace(/[\s-]+(.)/g,(e,t)=>t.toUpperCase())}function lf(r){return An(r).map(e=>e instanceof String?e:String(e))}function mt(r,e=0){if(r==null)return e;let t=parseInt(r,10);return Number.isNaN(t)?e:t}function Vh(r,e){let t=[];for(let n=0,i=r.length;n<i;n++)t.push(e,r[n]);return t}function Wh(r){return(Array.isArray(r)?_.concat(r):r).toString("utf-8")}function GU(r){return r?_.isBuffer(r)?r.length:_.byteLength(r):0}function UU(r,e){let t={};return e.forEach(n=>{r[n]!==void 0&&(t[n]=r[n])}),t}function eR(r=0){return new Promise(e=>setTimeout(e,r))}function tR(r){if(r!==!1)return r}function xt(r,e,t){return e(r)?r:arguments.length>2?t:void 0}var rp=r=>Array.isArray(r);function Y0(r,e){let t=Xi(r)?"string":typeof r;return/number|string|boolean/.test(t)&&(!e||!e.includes(t))}var it=r=>typeof r=="string"||Xi(r),jU=r=>it(r)||_.isBuffer(r),qh=r=>it(r)||Array.isArray(r)&&r.every(it);function gb(r){return!!r&&mb(r)==="[object Object]"}function zU(r){return typeof r=="function"}var ER=r=>r==null||"number|boolean|function".includes(typeof r)?!1:typeof r.length=="number",np=(r=>(r[r.SUCCESS=0]="SUCCESS",r[r.ERROR=1]="ERROR",r[r.NOT_FOUND=-2]="NOT_FOUND",r[r.UNCLEAN=128]="UNCLEAN",r))(np||{}),Yh=class r{constructor(e,t){this.stdOut=e,this.stdErr=t}asStrings(){return new r(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}};function VU(){throw new Error("LineParser:useMatches not implemented")}var ke=class{constructor(e,t){this.matches=[],this.useMatches=VU,this.parse=(n,i)=>(this.resetMatches(),this._regExp.every((s,o)=>this.addMatch(s,o,n(o)))?this.useMatches(i,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(e)?e:[e],t&&(this.useMatches=t)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(e,t,n){let i=n&&e.exec(n);return i&&this.pushMatch(t,i),!!i}pushMatch(e,t){this.matches.push(...t.slice(1))}},xo=class extends ke{addMatch(e,t,n){return/^remote:\s/.test(String(n))&&super.addMatch(e,t,n)}pushMatch(e,t){(e>0||t.length>1)&&super.pushMatch(e,t)}},WU={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1};function qU(...r){let e=process.cwd(),t=Object.assign({baseDir:e,...WU},...r.filter(n=>typeof n=="object"&&n));return t.baseDir=t.baseDir||e,t.trimmed=t.trimmed===!0,t}function SR(r,e=[]){return gb(r)?Object.keys(r).reduce((t,n)=>{let i=r[n];if(Xi(i))t.push(i);else if(Y0(i,["boolean"]))t.push(n+"="+i);else if(Array.isArray(i))for(let s of i)Y0(s,["string","number"])||t.push(n+"="+s);else t.push(n);return t},e):e}function ze(r,e=0,t=!1){let n=[];for(let i=0,s=e<0?r.length:e;i<s;i++)"string|number".includes(typeof r[i])&&n.push(String(r[i]));return SR(wb(r),n),t||n.push(...YU(r)),n}function YU(r){let e=typeof Jl(r)=="function";return lf(xt(Jl(r,e?1:0),rp,[]))}function wb(r){let e=zU(Jl(r));return xt(Jl(r,e?1:0),gb)}function ce(r,e=!0){let t=DU(Jl(r));return e||LU(t)?t:void 0}function rR(r,e){return r(e.stdOut,e.stdErr)}function Cn(r,e,t,n=!0){return An(t).forEach(i=>{for(let s=tp(i,n),o=0,a=s.length;o<a;o++){let l=(c=0)=>{if(!(o+c>=a))return s[o+c]};e.some(({parse:c})=>c(l,r))}}),r}var vb=({exitCode:r},e,t,n)=>{if(r===np.UNCLEAN&&QU(e))return t(_.from("false"));n(e)},kR=r=>r.trim()==="true";function KU(r){switch(r){case"bare":return XU();case"root":return ZU()}return{commands:["rev-parse","--is-inside-work-tree"],format:"utf-8",onError:vb,parser:kR}}function ZU(){return{commands:["rev-parse","--git-dir"],format:"utf-8",onError:vb,parser(r){return/^\.(git)?$/.test(r.trim())}}}function XU(){return{commands:["rev-parse","--is-bare-repository"],format:"utf-8",onError:vb,parser:kR}}function QU(r){return/(Not a git repository|Kein Git-Repository)/i.test(String(r))}var K0=class{constructor(e){this.paths=[],this.files=[],this.folders=[],this.dryRun=e}},JU=/^[a-z]+\s*/i,e4=/^[a-z]+\s+[a-z]+\s*/i,t4=/\/$/;function r4(r,e){let t=new K0(r),n=r?e4:JU;return tp(e).forEach(i=>{let s=i.replace(n,"");t.paths.push(s),(t4.test(s)?t.folders:t.files).push(s)}),t}var AR=[];function n4(r){return{commands:AR,format:"empty",parser:r}}function Gt(r){return{commands:AR,format:"empty",parser(){throw typeof r=="string"?new q0(r):r}}}function Et(r,e=!1){return{commands:r,format:"utf-8",parser(t){return e?String(t).trim():t}}}function CR(r){return{commands:r,format:"buffer",parser(e){return e}}}function i4(r){return r.format==="buffer"}function nR(r){return r.format==="empty"||!r.commands.length}var s4="Git clean interactive mode is not supported",o4='Git clean mode parameter ("n" or "f") is required',a4="Git clean unknown option found in: ",cf=(r=>(r.DRY_RUN="n",r.FORCE="f",r.IGNORED_INCLUDED="x",r.IGNORED_ONLY="X",r.EXCLUDING="e",r.QUIET="q",r.RECURSIVE="d",r))(cf||{}),TR=new Set(["i",...lf(Object.values(cf))]);function l4(r,e){let{cleanMode:t,options:n,valid:i}=f4(r);return t?i.options?(n.push(...e),n.some(p4)?Gt(s4):c4(t,n)):Gt(a4+JSON.stringify(r)):Gt(o4)}function c4(r,e){return{commands:["clean",`-${r}`,...e],format:"utf-8",parser(t){return r4(r==="n",t)}}}function u4(r){return Array.isArray(r)&&r.every(e=>TR.has(e))}function f4(r){let e,t=[],n={cleanMode:!1,options:!0};return r.replace(/[^a-z]i/g,"").split("").forEach(i=>{d4(i)?(e=i,n.cleanMode=!0):n.options=n.options&&h4(t[t.length]=`-${i}`)}),{cleanMode:e,options:t,valid:n}}function d4(r){return r==="f"||r==="n"}function h4(r){return/^-[a-z]$/i.test(r)&&TR.has(r.charAt(1))}function p4(r){return/^-[^\-]/.test(r)?r.indexOf("i")>0:r==="--interactive"}var Z0=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||(this._all=this.files.reduce((e,t)=>Object.assign(e,this.values[t]),{})),this._all}addFile(e){if(!(e in this.values)){let t=Jl(this.files);this.values[e]=t?Object.create(this.values[t]):{},this.files.push(e)}return this.values[e]}addValue(e,t,n){let i=this.addFile(e);Object.hasOwn(i,t)?Array.isArray(i[t])?i[t].push(n):i[t]=[i[t],n]:i[t]=n,this._all=void 0}};function m4(r){let e=new Z0;for(let t of RR(r))e.addValue(t.file,String(t.key),t.value);return e}function g4(r,e){let t=null,n=[],i=new Map;for(let s of RR(r,e))s.key===e&&(n.push(t=s.value),i.has(s.file)||i.set(s.file,[]),i.get(s.file).push(t));return{key:e,paths:Array.from(i.keys()),scopes:i,value:t,values:n}}function w4(r){return r.replace(/^(file):/,"")}function*RR(r,e=null){let t=r.split("\0");for(let n=0,i=t.length-1;n<i;){let s=w4(t[n++]),o=t[n++],a=e;if(o.includes(`
`)){let l=NU(o,`
`);a=l[0],o=l[1]}yield{file:s,key:a,value:o}}}var $R=(r=>(r.system="system",r.global="global",r.local="local",r.worktree="worktree",r))($R||{});function G0(r,e){return typeof r=="string"&&Object.hasOwn($R,r)?r:e}function v4(r,e,t,n){let i=["config",`--${n}`];return t&&i.push("--add"),i.push(r,e),{commands:i,format:"utf-8",parser(s){return s}}}function b4(r,e){let t=["config","--null","--show-origin","--get-all",r];return e&&t.splice(1,0,`--${e}`),{commands:t,format:"utf-8",parser(n){return g4(n,r)}}}function y4(r){let e=["config","--list","--show-origin","--null"];return r&&e.push(`--${r}`),{commands:e,format:"utf-8",parser(t){return m4(t)}}}function _4(){return{addConfig(r,e,...t){return this._runTask(v4(r,e,t[0]===!0,G0(t[1],"local")),ce(arguments))},getConfig(r,e){return this._runTask(b4(r,G0(e,void 0)),ce(arguments))},listConfig(...r){return this._runTask(y4(G0(r[0],void 0)),ce(arguments))}}}var PR=(r=>(r.ADDED="A",r.COPIED="C",r.DELETED="D",r.MODIFIED="M",r.RENAMED="R",r.CHANGED="T",r.UNMERGED="U",r.UNKNOWN="X",r.BROKEN="B",r))(PR||{}),x4=new Set(Object.values(PR));function E4(r){return x4.has(r)}var iR,S4=["-h"],Uh=Symbol("grepQuery"),X0=class{constructor(){this[iR]=[]}*[(iR=Uh,Symbol.iterator)](){for(let e of this[Uh])yield e}and(...e){return e.length&&this[Uh].push("--and","(",...Vh(e,"-e"),")"),this}param(...e){return this[Uh].push(...Vh(e,"-e")),this}};function k4(...r){return new X0().param(...r)}function A4(r){let e=new Set,t={};return hb(r,n=>{let[i,s,o]=n.split(zh);e.add(i),(t[i]=t[i]||[]).push({line:mt(s),path:i,preview:o})}),{paths:e,results:t}}function C4(){return{grep(r){let e=ce(arguments),t=ze(arguments);for(let i of S4)if(t.includes(i))return this._runTask(Gt(`git.grep: use of "${i}" is not supported.`),e);typeof r=="string"&&(r=k4().param(r));let n=["grep","--null","-n","--full-name",...t,...r];return this._runTask({commands:n,format:"utf-8",parser(i){return A4(i)}},e)}}}var IR=(r=>(r.MIXED="mixed",r.SOFT="soft",r.HARD="hard",r.MERGE="merge",r.KEEP="keep",r))(IR||{}),T4=lf(Object.values(IR));function R4(r,e){let t=["reset"];return OR(r)&&t.push(`--${r}`),t.push(...e),Et(t)}function $4(r){if(OR(r))return r;switch(typeof r){case"string":case"undefined":return"soft"}}function OR(r){return typeof r=="string"&&T4.includes(r)}Jh.default.formatters.L=r=>String(ER(r)?r.length:"-");Jh.default.formatters.B=r=>_.isBuffer(r)?r.toString("utf8"):mb(r);function P4(){return(0,Jh.default)("simple-git")}function sR(r,e,t){return!e||!String(e).replace(/\s*/,"")?t?(n,...i)=>{r(n,...i),t(n,...i)}:r:(n,...i)=>{r(`%s ${n}`,e,...i),t&&t(n,...i)}}function I4(r,e,{namespace:t}){if(typeof r=="string")return r;let n=e&&e.namespace||"";return n.startsWith(t)?n.substr(t.length+1):n||t}function ec(r,e,t,n=P4()){let i=r&&`[${r}]`||"",s=[],o=typeof e=="string"?n.extend(e):e,a=I4(xt(e,it),o,n);return c(t);function l(u,f){return yi(s,ec(r,a.replace(/^[^:]+/,u),f,n))}function c(u){let f=u&&`[${u}]`||"",d=o&&sR(o,f)||ep,h=sR(n,`${i} ${f}`,d);return Object.assign(o?d:h,{label:r,sibling:l,info:h,step:c})}}var FR=class Q0{constructor(e="GitExecutor"){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(e){let t=Q0.getName(e.commands[0]),n=ec(this.logLabel,t);return{task:e,logger:n,name:t}}push(e){let t=this.createProgress(e);return t.logger("Adding task to the queue, commands = %o",e.commands),this._queue.set(e,t),t}fatal(e){for(let[t,{logger:n}]of Array.from(this._queue.entries()))t===e.task?(n.info("Failed %o",e),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",e.message),this.complete(t);if(this._queue.size!==0)throw new Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let t=this.withProgress(e);if(!t)throw new vr(void 0,"TasksPendingQueue: attempt called for an unknown task");return t.logger("Starting task"),t}static getName(e="empty"){return`task:${e}:${++Q0.counter}`}};FR.counter=0;var O4=FR,J0=class{constructor(e,t,n){this._executor=e,this._scheduler=t,this._plugins=n,this._chain=Promise.resolve(),this._queue=new O4}get cwd(){return this._cwd||this._executor.cwd}set cwd(e){this._cwd=e}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(e){return this._queue.push(e),this._chain=this._chain.then(()=>this.attemptTask(e))}async attemptTask(e){let t=await this._scheduler.next(),n=()=>this._queue.complete(e);try{let{logger:i}=this._queue.attempt(e);return await(nR(e)?this.attemptEmptyTask(e,i):this.attemptRemoteTask(e,i))}catch(i){throw this.onFatalException(e,i)}finally{n(),t()}}onFatalException(e,t){let n=t instanceof vr?Object.assign(t,{task:e}):new vr(e,t&&String(t));return this._chain=Promise.resolve(),this._queue.fatal(n),n}async attemptRemoteTask(e,t){let n=this._plugins.exec("spawn.binary","",this.taskContext(e,e.commands)),i=this._plugins.exec("spawn.args",[...e.commands],this.taskContext(e,e.commands)),s=await this.gitResponse(e,n,i,this.outputHandler,t.step("SPAWN")),o=await this.handleTaskData(e,i,s,t.step("HANDLE"));return t("passing response to task's parser as a %s",e.format),i4(e)?rR(e.parser,o):rR(e.parser,o.asStrings())}async attemptEmptyTask(e,t){return t("empty task bypassing child process to call to task's parser"),e.parser(this)}handleTaskData(e,t,n,i){let{exitCode:s,rejection:o,stdOut:a,stdErr:l}=n;return new Promise((c,u)=>{i("Preparing to handle process response exitCode=%d stdOut=",s);let{error:f}=this._plugins.exec("task.error",{error:o},{...this.taskContext(e,t),...n});if(f&&e.onError)return i.info("exitCode=%s handling with custom error handler"),e.onError(n,f,d=>{i.info("custom error handler treated as success"),i("custom error returned a %s",mb(d)),c(new Yh(Array.isArray(d)?_.concat(d):d,_.concat(l)))},u);if(f)return i.info("handling as error: exitCode=%s stdErr=%s rejection=%o",s,l.length,o),u(f);i.info("retrieving task output complete"),c(new Yh(_.concat(a),_.concat(l)))})}async gitResponse(e,t,n,i,s){let o=s.sibling("output"),a=this._plugins.exec("spawn.options",{cwd:this.cwd,env:this.env,windowsHide:!0},this.taskContext(e,e.commands));return new Promise(l=>{let c=[],u=[];s.info("%s %o",t,n),s("%O",a);let f=this._beforeSpawn(e,n);if(f)return l({stdOut:c,stdErr:u,exitCode:9901,rejection:f});this._plugins.exec("spawn.before",void 0,{...this.taskContext(e,n),kill(h){f=h||f}});let d=(0,wR.spawn)(t,n,a);d.stdout.on("data",oR(c,"stdOut",s,o.step("stdOut"))),d.stderr.on("data",oR(u,"stdErr",s,o.step("stdErr"))),d.on("error",F4(u,s)),i&&(s("Passing child process stdOut/stdErr to custom outputHandler"),i(t,d.stdout,d.stderr,[...n])),this._plugins.exec("spawn.after",void 0,{...this.taskContext(e,n),spawned:d,close(h,p){l({stdOut:c,stdErr:u,exitCode:h,rejection:f||p})},kill(h){d.killed||(f=h,d.kill("SIGINT"))}})})}_beforeSpawn(e,t){let n;return this._plugins.exec("spawn.before",void 0,{...this.taskContext(e,t),kill(i){n=i||n}}),n}taskContext(e,t){return{method:String(BU(e.commands)||""),commands:t,env:{...this.env},input:nR(e)?void 0:e.input}}};function F4(r,e){return t=>{e("[ERROR] child process exception %o",t),r.push(_.from(String(t.stack),"ascii"))}}function oR(r,e,t,n){return i=>{t("%s received %L bytes",e,i),n("%B",i),r.push(i)}}var eb=class{constructor(e,t,n){this.cwd=e,this._scheduler=t,this._plugins=n,this._chain=this.chain()}chain(){return new J0(this,this._scheduler,this._plugins)}push(e){return this._chain.push(e)}};function M4(r,e,t=ep){let n=s=>{t(null,s)},i=s=>{(s==null?void 0:s.task)===r&&t(s,void 0)};e.then(n,i)}function aR(r,e){return n4(t=>{if(!_R(r))throw new Error(`Git.cwd: cannot change to non-directory "${r}"`);return(e||t).cwd=r})}function U0(r){let e=["checkout",...r];return e[1]==="-b"&&e.includes("-B")&&(e[1]=pb(e,"-B")),Et(e)}function D4(){return{checkout(){return this._runTask(U0(ze(arguments,1)),ce(arguments))},checkoutBranch(r,e){return this._runTask(U0(["-b",r,e,...ze(arguments)]),ce(arguments))},checkoutLocalBranch(r){return this._runTask(U0(["-b",r,...ze(arguments)]),ce(arguments))}}}var MR=(r,e,t)=>{let n=["clone",...t];return it(r)&&n.push(nf(r)),it(e)&&n.push(nf(e)),Et(n)},L4=(r,e,t)=>(yi(t,"--mirror"),MR(r,e,t));function lR(r,e,t,...n){return it(t)?e(t,xt(n[0],it),ze(arguments)):Gt(`git.${r}() requires a string 'repoPath'`)}function N4(){return{clone(r,...e){return this._runTask(lR("clone",MR,xt(r,it),...e),ce(arguments))},mirror(r,...e){return this._runTask(lR("mirror",L4,xt(r,it),...e),ce(arguments))}}}var B4=[new ke(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(r,[e,t,n])=>{r.branch=e,r.commit=n,r.root=!!t}),new ke(/\s*Author:\s(.+)/i,(r,[e])=>{let t=e.split("<"),n=t.pop();!n||!n.includes("@")||(r.author={email:n.substr(0,n.length-1),name:t.join("<").trim()})}),new ke(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(r,[e,t,n])=>{r.summary.changes=parseInt(e,10)||0,r.summary.insertions=parseInt(t,10)||0,r.summary.deletions=parseInt(n,10)||0}),new ke(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(r,[e,t,n])=>{r.summary.changes=parseInt(e,10)||0;let i=parseInt(t,10)||0;n==="-"?r.summary.deletions=i:n==="+"&&(r.summary.insertions=i)})];function H4(r){return Cn({author:null,branch:"",commit:"",root:!1,summary:{changes:0,insertions:0,deletions:0}},B4,r)}function G4(r,e,t){return{commands:["-c","core.abbrev=40","commit",...Vh(r,"-m"),...e,...t],format:"utf-8",parser:H4}}function U4(){return{commit(e,...t){let n=ce(arguments),i=r(e)||G4(An(e),An(xt(t[0],qh,[])),[...lf(xt(t[1],rp,[])),...ze(arguments,0,!0)]);return this._runTask(i,n)}};function r(e){return!qh(e)&&Gt("git.commit: requires the commit message to be supplied as a string/string[]")}}function j4(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}var z4=new ke(/([a-z-]+): (\d+)$/,(r,[e,t])=>{let n=xR(e);Object.hasOwn(r,n)&&(r[n]=mt(t))});function V4(){return{countObjects(){return this._runTask({commands:["count-objects","--verbose"],format:"utf-8",parser(r){return Cn(j4(),[z4],r)}})}}}function W4(){return{firstCommit(){return this._runTask(Et(["rev-list","--max-parents=0","HEAD"],!0),ce(arguments))}}}function q4(r,e){let t=["hash-object",r];return e&&t.push("-w"),Et(t,!0)}var sf=class{constructor(e,t,n,i){this.bare=e,this.path=t,this.existing=n,this.gitDir=i}},Y4=/^Init.+ repository in (.+)$/,K4=/^Rein.+ in (.+)$/;function Z4(r,e,t){let n=String(t).trim(),i;if(i=Y4.exec(n))return new sf(r,e,!1,i[1]);if(i=K4.exec(n))return new sf(r,e,!0,i[1]);let s="",o=n.split(" ");for(;o.length;)if(o.shift()==="in"){s=o.join(" ");break}return new sf(r,e,/^re/i.test(n),s)}var DR="--bare";function X4(r){return r.includes(DR)}function Q4(r=!1,e,t){let n=["init",...t];return r&&!X4(n)&&n.splice(1,0,DR),{commands:n,format:"utf-8",parser(i){return Z4(n.includes("--bare"),e,i)}}}function J4(r){return r===void 0?Gt("interpretTrailers called without input content"):{format:"utf-8",parser(e){return Object.fromEntries(hb(e,t=>{let n=t.indexOf(":");return[xR(t.substring(0,n).toLowerCase()),t.substring(n+2).trim()]}))},commands:["interpret-trailers","--parse"],input:r}}function e6(){return{interpretTrailers(r){return this._runTask(J4(xt(r,jU)),ce(arguments))}}}var Ji=(r=>(r.NONE="",r.STAT="--stat",r.NUM_STAT="--numstat",r.NAME_ONLY="--name-only",r.NAME_STATUS="--name-status",r))(Ji||{}),LR=/^--(stat|numstat|name-only|name-status)(=|$)/;function bb(r){for(let e=0;e<r.length;e++){let t=LR.exec(r[e]);if(t)return`--${t[1]}`}return""}function t6(r){return LR.test(r)}var tb=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}},cR=[new ke(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(r,[e,t,n=""])=>{r.files.push({file:e.trim(),changes:mt(t),insertions:n.replace(/[^+]/g,"").length,deletions:n.replace(/[^-]/g,"").length,binary:!1})}),new ke(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(r,[e,t,n])=>{r.files.push({file:e.trim(),before:mt(t),after:mt(n),binary:!0})}),new ke(/^(.+)\s+\|\s+Bin\s*$/,(r,[e])=>{r.files.push({file:e.trim(),before:0,after:0,binary:!0})}),new ke(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(r,[e,t])=>{let n=/(\d+) i/.exec(t),i=/(\d+) d/.exec(t);r.changed=mt(e),r.insertions=mt(n==null?void 0:n[1]),r.deletions=mt(i==null?void 0:i[1])})],r6=[new ke(/(\d+)\t(\d+)\t(.+)$/,(r,[e,t,n])=>{let i=mt(e),s=mt(t);r.changed++,r.insertions+=i,r.deletions+=s,r.files.push({file:n,changes:i+s,insertions:i,deletions:s,binary:!1})}),new ke(/-\t-\t(.+)$/,(r,[e])=>{r.changed++,r.files.push({file:e,after:0,before:0,binary:!0})})],n6=[new ke(/(.+)$/,(r,[e])=>{r.changed++,r.files.push({file:e,changes:0,insertions:0,deletions:0,binary:!1})})],i6=[new ke(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(r,[e,t,n,i,s])=>{r.changed++,r.files.push({file:s!=null?s:n,changes:0,insertions:0,deletions:0,binary:!1,status:tR(E4(e)&&e),from:tR(!!s&&n!==s&&n),similarity:mt(t)})})],s6={[Ji.NONE]:cR,[Ji.STAT]:cR,[Ji.NUM_STAT]:r6,[Ji.NAME_STATUS]:i6,[Ji.NAME_ONLY]:n6};function NR(r=Ji.NONE){let e=s6[r];return t=>Cn(new tb,e,t,!1)}var BR="\xF2\xF2\xF2\xF2\xF2\xF2 ",HR=" \xF2\xF2",GR=" \xF2 ",o6=["hash","date","message","refs","author_name","author_email"];function a6(r,e){return e.reduce((t,n,i)=>(t[n]=r[i]||"",t),Object.create({diff:null}))}function UR(r=GR,e=o6,t=Ji.NONE){let n=NR(t);return function(i){let s=tp(i.trim(),!1,BR).map(function(o){let a=o.split(HR),l=a6(a[0].split(r),e);return a.length>1&&a[1].trim()&&(l.diff=n(a[1])),l});return{all:s,latest:s.length&&s[0]||null,total:s.length}}}function l6(r){let e=bb(r),t=["diff"];return e===Ji.NONE&&(e=Ji.STAT,t.push("--stat=4096")),t.push(...r),yb(t)||{commands:t,format:"utf-8",parser:NR(e)}}function yb(r){let e=r.filter(t6);if(e.length>1)return Gt(`Summary flags are mutually exclusive - pick one of ${e.join(",")}`);if(e.length&&r.includes("-z"))return Gt(`Summary flag ${e} parsing is not compatible with null termination option '-z'`)}var jR=(r=>(r[r["--pretty"]=0]="--pretty",r[r["max-count"]=1]="max-count",r[r.maxCount=2]="maxCount",r[r.n=3]="n",r[r.file=4]="file",r[r.format=5]="format",r[r.from=6]="from",r[r.to=7]="to",r[r.splitter=8]="splitter",r[r.symmetric=9]="symmetric",r[r.mailMap=10]="mailMap",r[r.multiLine=11]="multiLine",r[r.strictDate=12]="strictDate",r))(jR||{});function c6(r,e){let t=[],n=[];return Object.keys(r).forEach(i=>{t.push(i),n.push(String(r[i]))}),[t,n.join(e)]}function u6(r){return Object.keys(r).reduce((e,t)=>(t in jR||(e[t]=r[t]),e),{})}function zR(r={},e=[]){let t=xt(r.splitter,it,GR),n=gb(r.format)?r.format:{hash:"%H",date:r.strictDate===!1?"%ai":"%aI",message:"%s",refs:"%D",body:r.multiLine?"%B":"%b",author_name:r.mailMap!==!1?"%aN":"%an",author_email:r.mailMap!==!1?"%aE":"%ae"},[i,s]=c6(n,t),o=[],a=[`--pretty=format:${BR}${s}${HR}`,...e],l=r.n||r["max-count"]||r.maxCount;if(l&&a.push(`--max-count=${l}`),r.from||r.to){let c=r.symmetric!==!1?"...":"..";o.push(`${r.from||""}${c}${r.to||""}`)}return it(r.file)&&a.push("--follow",nf(r.file)),SR(u6(r),a),{fields:i,splitter:t,commands:[...a,...o]}}function f6(r,e,t){let n=UR(r,e,bb(t));return{commands:["log",...t],format:"utf-8",parser:n}}function d6(){return{log(...t){let n=ce(arguments),i=zR(wb(arguments),lf(xt(arguments[0],rp,[]))),s=e(...t)||yb(i.commands)||r(i);return this._runTask(s,n)}};function r(t){return f6(t.splitter,t.fields,t.commands)}function e(t,n){return it(t)&&it(n)&&Gt("git.log(string, string) should be replaced with git.log({ from: string, to: string })")}}var of=class{constructor(e,t=null,n){this.reason=e,this.file=t,this.meta=n}toString(){return`${this.file}:${this.reason}`}},rb=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"}},Kh=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},nb=class{constructor(){this.remote="",this.hash={local:"",remote:""},this.branch={local:"",remote:""},this.message=""}toString(){return this.message}};function j0(r){return r.objects=r.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function uR(r){let e=/^\s*(\d+)/.exec(r),t=/delta (\d+)/i.exec(r);return{count:mt(e&&e[1]||"0"),delta:mt(t&&t[1]||"0")}}var h6=[new xo(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(r,[e,t])=>{let n=e.toLowerCase(),i=j0(r.remoteMessages);Object.assign(i,{[n]:mt(t)})}),new xo(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(r,[e,t])=>{let n=e.toLowerCase(),i=j0(r.remoteMessages);Object.assign(i,{[n]:mt(t)})}),new xo(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(r,[e,t,n])=>{let i=j0(r.remoteMessages);i.total=uR(e),i.reused=uR(t),i.packReused=mt(n)})],p6=[new xo(/^remote:\s*(.+)$/,(r,[e])=>(r.remoteMessages.all.push(e.trim()),!1)),...h6,new xo([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(r,[e])=>{r.remoteMessages.pullRequestUrl=e}),new xo([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(r,[e,t,n])=>{r.remoteMessages.vulnerabilities={count:mt(e),summary:t,url:n}})];function VR(r,e){return Cn({remoteMessages:new ib},p6,e)}var ib=class{constructor(){this.all=[]}},m6=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,g6=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,w6=/^(create|delete) mode \d+ (.+)/,v6=[new ke(m6,(r,[e,t,n])=>{r.files.push(e),t&&(r.insertions[e]=t.length),n&&(r.deletions[e]=n.length)}),new ke(g6,(r,[e,,t,,n])=>t!==void 0||n!==void 0?(r.summary.changes=+e||0,r.summary.insertions=+t||0,r.summary.deletions=+n||0,!0):!1),new ke(w6,(r,[e,t])=>{yi(r.files,t),yi(e==="create"?r.created:r.deleted,t)})],b6=[new ke(/^from\s(.+)$/i,(r,[e])=>{r.remote=e}),new ke(/^fatal:\s(.+)$/,(r,[e])=>{r.message=e}),new ke(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(r,[e,t,n,i])=>{r.branch.local=n,r.hash.local=e,r.branch.remote=i,r.hash.remote=t})],y6=(r,e)=>Cn(new Kh,v6,[r,e]),WR=(r,e)=>Object.assign(new Kh,y6(r,e),VR(r,e));function _6(r,e){let t=Cn(new nb,b6,[r,e]);return t.message&&t}var x6=[new ke(/^Auto-merging\s+(.+)$/,(r,[e])=>{r.merges.push(e)}),new ke(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(r,[e,t])=>{r.conflicts.push(new of(e,t))}),new ke(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(r,[e,t,n])=>{r.conflicts.push(new of(e,t,{deleteRef:n}))}),new ke(/^CONFLICT\s+\((.+)\):/,(r,[e])=>{r.conflicts.push(new of(e,null))}),new ke(/^Automatic merge failed;\s+(.+)$/,(r,[e])=>{r.result=e})],E6=(r,e)=>Object.assign(S6(r),WR(r,e)),S6=r=>Cn(new rb,x6,r);function fR(r){return r.length?{commands:["merge",...r],format:"utf-8",parser(e,t){let n=E6(e,t);if(n.failed)throw new af(n);return n}}:Gt("Git.merge requires at least one option")}function k6(r,e,t){let n=t.includes("deleted"),i=t.includes("tag")||/^refs\/tags/.test(r),s=!t.includes("new");return{deleted:n,tag:i,branch:!i,new:!s,alreadyUpdated:s,local:r,remote:e}}var A6=[new ke(/^Pushing to (.+)$/,(r,[e])=>{r.repo=e}),new ke(/^updating local tracking ref '(.+)'/,(r,[e])=>{r.ref={...r.ref||{},local:e}}),new ke(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(r,[e,t,n])=>{r.pushed.push(k6(e,t,n))}),new ke(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(r,[e,t,n])=>{r.branch={...r.branch||{},local:e,remote:t,remoteName:n}}),new ke(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(r,[e,t,n,i])=>{r.update={head:{local:e,remote:t},hash:{from:n,to:i}}})],C6=(r,e)=>{let t=T6(r,e),n=VR(r,e);return{...t,...n}},T6=(r,e)=>Cn({pushed:[]},A6,[r,e]);function R6(r={},e){return yi(e,"--tags"),qR(r,e)}function qR(r={},e){let t=["push",...e];return r.branch&&t.splice(1,0,r.branch),r.remote&&t.splice(1,0,r.remote),pb(t,"-v"),yi(t,"--verbose"),yi(t,"--porcelain"),{commands:t,format:"utf-8",parser:C6}}function $6(){return{showBuffer(){let r=["show",...ze(arguments,1)];return r.includes("--binary")||r.splice(1,0,"--binary"),this._runTask(CR(r),ce(arguments))},show(){let r=["show",...ze(arguments,1)];return this._runTask(Et(r),ce(arguments))}}}var P6=/^(.+)\0(.+)$/,sb=class{constructor(e,t,n){if(this.path=e,this.index=t,this.working_dir=n,t==="R"||n==="R"){let i=P6.exec(e)||[null,e,e];this.from=i[2]||"",this.path=i[1]||""}}},ob=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}};function dR(r){let[e,t]=r.split(zh);return{from:t||e,to:e}}function kn(r,e,t){return[`${r}${e}`,t]}function z0(r,...e){return e.map(t=>kn(r,t,(n,i)=>n.conflicted.push(i)))}var I6=new Map([kn(" ","A",(r,e)=>r.created.push(e)),kn(" ","D",(r,e)=>r.deleted.push(e)),kn(" ","M",(r,e)=>r.modified.push(e)),kn("A"," ",(r,e)=>{r.created.push(e),r.staged.push(e)}),kn("A","M",(r,e)=>{r.created.push(e),r.staged.push(e),r.modified.push(e)}),kn("D"," ",(r,e)=>{r.deleted.push(e),r.staged.push(e)}),kn("M"," ",(r,e)=>{r.modified.push(e),r.staged.push(e)}),kn("M","M",(r,e)=>{r.modified.push(e),r.staged.push(e)}),kn("R"," ",(r,e)=>{r.renamed.push(dR(e))}),kn("R","M",(r,e)=>{let t=dR(e);r.renamed.push(t),r.modified.push(t.to)}),kn("!","!",(r,e)=>{(r.ignored=r.ignored||[]).push(e)}),kn("?","?",(r,e)=>r.not_added.push(e)),...z0("A","A","U"),...z0("D","D","U"),...z0("U","A","D","U"),["##",(r,e)=>{let t=/ahead (\d+)/,n=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,s=/\.{3}(\S*)/,o=/\son\s(\S+?)(?=\.{3}|$)/,a=t.exec(e);r.ahead=a&&+a[1]||0,a=n.exec(e),r.behind=a&&+a[1]||0,a=i.exec(e),r.current=xt(a==null?void 0:a[1],it,null),a=s.exec(e),r.tracking=xt(a==null?void 0:a[1],it,null),a=o.exec(e),a&&(r.current=xt(a==null?void 0:a[1],it,r.current)),r.detached=/\(no branch\)/.test(e)}]]),O6=function(r){let e=r.split(zh),t=new ob;for(let n=0,i=e.length;n<i;){let s=e[n++].trim();s&&(s.charAt(0)==="R"&&(s+=zh+(e[n++]||"")),F6(t,s))}return t};function F6(r,e){let t=e.trim();switch(" "){case t.charAt(2):return n(t.charAt(0),t.charAt(1),t.slice(3));case t.charAt(1):return n(" ",t.charAt(0),t.slice(2));default:return}function n(i,s,o){let a=`${i}${s}`,l=I6.get(a);l&&l(r,o),a!=="##"&&a!=="!!"&&r.files.push(new sb(o,i,s))}}var M6=["--null","-z"];function D6(r){return{format:"utf-8",commands:["status","--porcelain","-b","-u","--null",...r.filter(e=>!M6.includes(e))],parser(e){return O6(e)}}}var YR="installed=false";function Zh(r=0,e=0,t=0,n="",i=!0){return Object.defineProperty({major:r,minor:e,patch:t,agent:n,installed:i},"toString",{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function L6(){return Zh(0,0,0,"",!1)}function N6(){return{version(){return this._runTask({commands:["--version"],format:"utf-8",parser:H6,onError(r,e,t,n){if(r.exitCode===np.NOT_FOUND)return t(_.from(YR));n(e)}})}}}var B6=[new ke(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(r,[e,t,n,i=""])=>{Object.assign(r,Zh(mt(e),mt(t),mt(n),i))}),new ke(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(r,[e,t,n,i=""])=>{Object.assign(r,Zh(mt(e),mt(t),n,i))})];function H6(r){return r===YR?L6():Cn(Zh(0,0,0,r),B6,r)}var Xh=class{constructor(e){this._executor=e}_runTask(e,t){let n=this._executor.chain(),i=n.push(e);return t&&M4(e,i,t),Object.create(this,{then:{value:i.then.bind(i)},catch:{value:i.catch.bind(i)},_executor:{value:n}})}add(e){return this._runTask(Et(["add",...An(e)]),ce(arguments))}cwd(e){let t=ce(arguments);return typeof e=="string"?this._runTask(aR(e,this._executor),t):typeof(e==null?void 0:e.path)=="string"?this._runTask(aR(e.path,e.root&&this._executor||void 0),t):this._runTask(Gt("Git.cwd: workingDirectory must be supplied as a string"),t)}hashObject(e,t){return this._runTask(q4(e,t===!0),ce(arguments))}init(e){return this._runTask(Q4(e===!0,this._executor.cwd,ze(arguments)),ce(arguments))}merge(){return this._runTask(fR(ze(arguments)),ce(arguments))}mergeFromTo(e,t){return it(e)&&it(t)?this._runTask(fR([e,t,...ze(arguments)]),ce(arguments,!1)):this._runTask(Gt("Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings"))}outputHandler(e){return this._executor.outputHandler=e,this}push(){let e=qR({remote:xt(arguments[0],it),branch:xt(arguments[1],it)},ze(arguments));return this._runTask(e,ce(arguments))}stash(){return this._runTask(Et(["stash",...ze(arguments)]),ce(arguments))}status(){return this._runTask(D6(ze(arguments)),ce(arguments))}};Object.assign(Xh.prototype,D4(),N4(),U4(),_4(),V4(),W4(),C4(),e6(),d6(),$6(),N6());var G6=(()=>{let r=0;return()=>{r++;let{promise:e,done:t}=(0,_o.createDeferred)();return{promise:e,done:t,id:r}}})(),ab=class{constructor(e=2){this.concurrency=e,this.logger=ec("","scheduler"),this.pending=[],this.running=[],this.logger("Constructed, concurrency=%s",e)}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 e=yi(this.running,this.pending.shift());this.logger("Attempting id=%s",e.id),e.done(()=>{this.logger("Completing id=",e.id),pb(this.running,e),this.schedule()})}next(){let{promise:e,id:t}=yi(this.pending,G6());return this.logger("Scheduling id=%s",t),this.schedule(),e}};function U6(r,e){return Et(["apply",...e,...r])}var KR=(r=>(r.CURRENT="*",r.LINKED="+",r))(KR||{}),lb=class{constructor(){this.all=[],this.branches={},this.current="",this.detached=!1}push(e,t,n,i,s){e==="*"&&(this.detached=t,this.current=n),this.all.push(n),this.branches[n]={current:e==="*",linkedWorkTree:e==="+",name:n,commit:i,label:s}}},j6=[new ke(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(r,[e,t,n,i])=>{r.push(hR(e),!0,t,n,i)}),new ke(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(r,[e,t,n,i])=>{r.push(hR(e),!1,t,n,i)})],z6=new ke(/^(\S+)$/s,(r,[e])=>{r.push(KR.CURRENT,!1,e,"","")});function hR(r){return r?r.charAt(0):""}function ZR(r,e=!1){return Cn(new lb,e?[z6]:j6,r)}var cb=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}};function V6(r,e){return{branch:r,hash:e,success:!0}}function W6(r){return{branch:r,hash:null,success:!1}}var q6=/(\S+)\s+\(\S+\s([^)]+)\)/,XR=/^error[^']+'([^']+)'/m,Y6=[new ke(q6,(r,[e,t])=>{let n=V6(e,t);r.all.push(n),r.branches[e]=n}),new ke(XR,(r,[e])=>{let t=W6(e);r.errors.push(t),r.all.push(t),r.branches[e]=t})],_b=(r,e)=>Cn(new cb,Y6,[r,e]);function QR(r,e){return e===np.ERROR&&XR.test(r)}function K6(r){let e=["-d","-D","--delete"];return r.some(t=>e.includes(t))}function Z6(r){let e=K6(r),t=r.includes("--show-current"),n=["branch",...r];return n.length===1&&n.push("-a"),n.includes("-v")||n.splice(1,0,"-v"),{format:"utf-8",commands:n,parser(i,s){return e?_b(i,s).all[0]:ZR(i,t)}}}function X6(){return{format:"utf-8",commands:["branch","-v"],parser(r){return ZR(r)}}}function Q6(r,e=!1){return{format:"utf-8",commands:["branch","-v",e?"-D":"-d",...r],parser(t,n){return _b(t,n)},onError({exitCode:t,stdOut:n},i,s,o){if(!QR(String(i),t))return o(i);s(n)}}}function J6(r,e=!1){let t={format:"utf-8",commands:["branch","-v",e?"-D":"-d",r],parser(n,i){return _b(n,i).branches[r]},onError({exitCode:n,stdErr:i,stdOut:s},o,a,l){if(!QR(String(o),n))return l(o);throw new af(t.parser(Wh(s),Wh(i)),String(o))}};return t}function e5(r){return{commands:["check-ignore",...r],format:"utf-8",parser:t5}}function t5(r){return r.split(/\n/g).map(r5).filter(Boolean)}function r5(r){let e=r.trim().replace(/^["']|["']$/g,"");return e&&(0,vR.normalize)(e)}var n5=[new ke(/From (.+)$/,(r,[e])=>{r.remote=e}),new ke(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(r,[e,t])=>{r.branches.push({name:e,tracking:t})}),new ke(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(r,[e,t])=>{r.tags.push({name:e,tracking:t})}),new ke(/- \[deleted]\s+\S+\s*-> (.+)$/,(r,[e])=>{r.deleted.push({tracking:e})}),new ke(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(r,[e,t,n,i])=>{r.updated.push({name:n,tracking:i,to:t,from:e})})];function i5(r,e){return Cn({raw:r,remote:null,branches:[],tags:[],updated:[],deleted:[]},n5,[r,e])}function s5(r){return/^--upload-pack(=|$)/.test(r)}function o5(r,e,t){let n=["fetch",...t];return r&&e&&n.push(r,e),n.find(s5)?Gt("git.fetch: potential exploit argument blocked."):{commands:n,format:"utf-8",parser:i5}}var a5=[new ke(/^Renaming (.+) to (.+)$/,(r,[e,t])=>{r.moves.push({from:e,to:t})})];function l5(r){return Cn({moves:[]},a5,r)}function c5(r,e){return{commands:["mv","-v",...An(r),e],format:"utf-8",parser:l5}}function u5(r,e,t){let n=["pull",...t];return r&&e&&n.splice(1,0,r,e),{commands:n,format:"utf-8",parser(i,s){return WR(i,s)},onError(i,s,o,a){let l=_6(Wh(i.stdOut),Wh(i.stdErr));if(l)return a(new af(l));a(s)}}}function f5(r){let e={};return JR(r,([t])=>e[t]={name:t}),Object.values(e)}function d5(r){let e={};return JR(r,([t,n,i])=>{Object.hasOwn(e,t)||(e[t]={name:t,refs:{fetch:"",push:""}}),i&&n&&(e[t].refs[i.replace(/[^a-z]/g,"")]=n)}),Object.values(e)}function JR(r,e){hb(r,t=>e(t.split(/\s+/)))}function h5(r,e,t){return Et(["remote","add",...t,r,e])}function p5(r){let e=["remote"];return r&&e.push("-v"),{commands:e,format:"utf-8",parser:r?d5:f5}}function m5(r){let e=[...r];return e[0]!=="ls-remote"&&e.unshift("ls-remote"),Et(e)}function g5(r){let e=[...r];return e[0]!=="remote"&&e.unshift("remote"),Et(e)}function w5(r){return Et(["remote","remove",r])}function v5(r={},e){let t=zR(r),n=["stash","list",...t.commands,...e],i=UR(t.splitter,t.fields,bb(n));return yb(n)||{commands:n,format:"utf-8",parser:i}}function b5(r,e){return ip(["add",r,e])}function y5(r){return ip(["init",...r])}function ip(r){let e=[...r];return e[0]!=="submodule"&&e.unshift("submodule"),Et(e)}function _5(r){return ip(["update",...r])}var ub=class{constructor(e,t){this.all=e,this.latest=t}},x5=function(r,e=!1){let t=r.split(`
`).map(S5).filter(Boolean);e||t.sort(function(i,s){let o=i.split("."),a=s.split(".");if(o.length===1||a.length===1)return E5(jh(o[0]),jh(a[0]));for(let l=0,c=Math.max(o.length,a.length);l<c;l++){let u=e$(jh(o[l]),jh(a[l]));if(u)return u}return 0});let n=e?t[0]:[...t].reverse().find(i=>i.indexOf(".")>=0);return new ub(t,n)};function E5(r,e){let t=Number.isNaN(r),n=Number.isNaN(e);return t!==n?t?1:-1:t?e$(r,e):0}function e$(r,e){return r===e?0:r>e?1:-1}function S5(r){return r.trim()}function jh(r){return typeof r=="string"&&parseInt(r.replace(/^\D+/g,""),10)||0}function k5(r=[]){let e=r.some(t=>/^--sort=/.test(t));return{format:"utf-8",commands:["tag","-l",...r],parser(t){return x5(t,e)}}}function A5(r){return{format:"utf-8",commands:["tag",r],parser(){return{name:r}}}}function C5(r,e){return{format:"utf-8",commands:["tag","-a","-m",e,r],parser(){return{name:r}}}}function xe(r,e){this._plugins=e,this._executor=new eb(r.baseDir,new ab(r.maxConcurrentProcesses),e),this._trimmed=r.trimmed}(xe.prototype=Object.create(Xh.prototype)).constructor=xe;xe.prototype.customBinary=function(r){return this._plugins.reconfigure("binary",r),this};xe.prototype.env=function(r,e){return arguments.length===1&&typeof r=="object"?this._executor.env=r:(this._executor.env=this._executor.env||{})[r]=e,this};xe.prototype.stashList=function(r){return this._runTask(v5(wb(arguments)||{},rp(r)&&r||[]),ce(arguments))};xe.prototype.mv=function(r,e){return this._runTask(c5(r,e),ce(arguments))};xe.prototype.checkoutLatestTag=function(r){var e=this;return this.pull(function(){e.tags(function(t,n){e.checkout(n.latest,r)})})};xe.prototype.pull=function(r,e,t,n){return this._runTask(u5(xt(r,it),xt(e,it),ze(arguments)),ce(arguments))};xe.prototype.fetch=function(r,e){return this._runTask(o5(xt(r,it),xt(e,it),ze(arguments)),ce(arguments))};xe.prototype.tags=function(r,e){return this._runTask(k5(ze(arguments)),ce(arguments))};xe.prototype.rebase=function(){return this._runTask(Et(["rebase",...ze(arguments)]),ce(arguments))};xe.prototype.reset=function(r){return this._runTask(R4($4(r),ze(arguments)),ce(arguments))};xe.prototype.revert=function(r){let e=ce(arguments);return typeof r!="string"?this._runTask(Gt("Commit must be a string"),e):this._runTask(Et(["revert",...ze(arguments,0,!0),r]),e)};xe.prototype.addTag=function(r){let e=typeof r=="string"?A5(r):Gt("Git.addTag requires a tag name");return this._runTask(e,ce(arguments))};xe.prototype.addAnnotatedTag=function(r,e){return this._runTask(C5(r,e),ce(arguments))};xe.prototype.deleteLocalBranch=function(r,e,t){return this._runTask(J6(r,typeof e=="boolean"?e:!1),ce(arguments))};xe.prototype.deleteLocalBranches=function(r,e,t){return this._runTask(Q6(r,typeof e=="boolean"?e:!1),ce(arguments))};xe.prototype.branch=function(r,e){return this._runTask(Z6(ze(arguments)),ce(arguments))};xe.prototype.branchLocal=function(r){return this._runTask(X6(),ce(arguments))};xe.prototype.raw=function(r){let e=!Array.isArray(r),t=[].slice.call(e?arguments:r,0);for(let i=0;i<t.length&&e;i++)if(!Y0(t[i])){t.splice(i,t.length-i);break}t.push(...ze(arguments,0,!0));var n=ce(arguments);return t.length?this._runTask(Et(t,this._trimmed),n):this._runTask(Gt("Raw: must supply one or more command to execute"),n)};xe.prototype.submoduleAdd=function(r,e,t){return this._runTask(b5(r,e),ce(arguments))};xe.prototype.submoduleUpdate=function(r,e){return this._runTask(_5(ze(arguments,!0)),ce(arguments))};xe.prototype.submoduleInit=function(r,e){return this._runTask(y5(ze(arguments,!0)),ce(arguments))};xe.prototype.subModule=function(r,e){return this._runTask(ip(ze(arguments)),ce(arguments))};xe.prototype.listRemote=function(){return this._runTask(m5(ze(arguments)),ce(arguments))};xe.prototype.addRemote=function(r,e,t){return this._runTask(h5(r,e,ze(arguments)),ce(arguments))};xe.prototype.removeRemote=function(r,e){return this._runTask(w5(r),ce(arguments))};xe.prototype.getRemotes=function(r,e){return this._runTask(p5(r===!0),ce(arguments))};xe.prototype.remote=function(r,e){return this._runTask(g5(ze(arguments)),ce(arguments))};xe.prototype.tag=function(r,e){let t=ze(arguments);return t[0]!=="tag"&&t.unshift("tag"),this._runTask(Et(t),ce(arguments))};xe.prototype.updateServerInfo=function(r){return this._runTask(Et(["update-server-info"]),ce(arguments))};xe.prototype.pushTags=function(r,e){let t=R6({remote:xt(r,it)},ze(arguments));return this._runTask(t,ce(arguments))};xe.prototype.rm=function(r){return this._runTask(Et(["rm","-f",...An(r)]),ce(arguments))};xe.prototype.rmKeepLocal=function(r){return this._runTask(Et(["rm","--cached",...An(r)]),ce(arguments))};xe.prototype.catFile=function(r,e){return this._catFile("utf-8",arguments)};xe.prototype.binaryCatFile=function(){return this._catFile("buffer",arguments)};xe.prototype._catFile=function(r,e){var t=ce(e),n=["cat-file"],i=e[0];if(typeof i=="string")return this._runTask(Gt("Git.catFile: options must be supplied as an array of strings"),t);Array.isArray(i)&&n.push.apply(n,i);let s=r==="buffer"?CR(n):Et(n);return this._runTask(s,t)};xe.prototype.diff=function(r,e){let t=it(r)?Gt("git.diff: supplying options as a single string is no longer supported, switch to an array of strings"):Et(["diff",...ze(arguments)]);return this._runTask(t,ce(arguments))};xe.prototype.diffSummary=function(){return this._runTask(l6(ze(arguments,1)),ce(arguments))};xe.prototype.applyPatch=function(r){let e=qh(r)?U6(An(r),ze([].slice.call(arguments,1))):Gt("git.applyPatch requires one or more string patches as the first argument");return this._runTask(e,ce(arguments))};xe.prototype.revparse=function(){let r=["rev-parse",...ze(arguments,!0)];return this._runTask(Et(r,!0),ce(arguments))};xe.prototype.clean=function(r,e,t){let n=u4(r),i=n&&r.join("")||xt(r,it)||"",s=ze([].slice.call(arguments,n?1:0));return this._runTask(l4(i,s),ce(arguments))};xe.prototype.exec=function(r){let e={commands:[],format:"utf-8",parser(){typeof r=="function"&&r()}};return this._runTask(e)};xe.prototype.checkIgnore=function(r,e){return this._runTask(e5(An(xt(r,qh,[]))),ce(arguments))};xe.prototype.checkIsRepo=function(r,e){return this._runTask(KU(xt(r,it)),ce(arguments))};function T5(r){return r?[{type:"spawn.before",action(e,t){r.aborted&&t.kill(new Rs(void 0,"abort","Abort already signaled"))}},{type:"spawn.after",action(e,t){function n(){t.kill(new Rs(void 0,"abort","Abort signal received"))}r.addEventListener("abort",n),t.spawned.on("close",()=>r.removeEventListener("abort",n))}}]:void 0}var R5=ec("","plugin:allowEnvironment");function $5(r,e=!1){let t=new Set(r.map(n=>n.toLowerCase().trim()));return{type:"spawn.options",action(n,i){var a;let s={...(a=n.env)!=null?a:process.env},o=new Set(Object.keys(i.env).map(l=>l.toLowerCase().trim()));for(let l of Object.keys(s)){let c=l.toLowerCase().trim();if(!(!P5(c)||t.has(c))){if(o.has(c))throw new Rs(void 0,"allowEnvironment",`Use of "${l}" is blocked by the environment guard - add it to the allowEnvironment option to permit it`);R5("removing ambient guarded environment variable %s",l),delete s[l]}}return{...n,env:{...s,GIT_TEST_DISALLOW_ABBREVIATED_OPTIONS:String(!e)}}}}}function P5(r){let e=r.toLowerCase().trim();return e.startsWith("git_")||Gh(e)}function I5(r={}){return{type:"spawn.args",action(e,{env:t}){for(let n of JT(e,t))if(r[n.category]!==!0)throw new Rs(void 0,"unsafe",n.message);return e}}}function O5(r){let e=Vh(r,"-c");return{type:"spawn.args",action(t){return[...e,...t]}}}var pR=(0,_o.deferred)().promise;function F5({onClose:r=!0,onExit:e=50}={}){function t(){let i=-1,s={close:(0,_o.deferred)(),closeTimeout:(0,_o.deferred)(),exit:(0,_o.deferred)(),exitTimeout:(0,_o.deferred)()},o=Promise.race([r===!1?pR:s.closeTimeout.promise,e===!1?pR:s.exitTimeout.promise]);return n(r,s.close,s.closeTimeout),n(e,s.exit,s.exitTimeout),{close(a){i=a,s.close.done()},exit(a){i=a,s.exit.done()},get exitCode(){return i},result:o}}function n(i,s,o){i!==!1&&(i===!0?s.promise:s.promise.then(()=>eR(i))).then(o.done)}return{type:"spawn.after",async action(i,{spawned:s,close:o}){var u,f;let a=t(),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=>a.close(d)),s.on("exit",d=>a.exit(d));try{await a.result,l&&await eR(50),o(a.exitCode)}catch(d){o(a.exitCode,d)}}}}var t$=ec("","plugin:binary"),M5="Invalid value supplied for custom binary, requires a single string or an array containing either one or two strings",D5="Invalid value supplied for custom binary, restricted characters must be removed or supply the unsafe.allowUnsafeCustomBinary option";function L5(r){return!r||!/^([a-z]:)?([a-z0-9/.\\_~-]+)$/i.test(r)}function mR(r,e){if(r.length<1||r.length>2)throw new Rs(void 0,"binary",M5);if(r.some(L5))if(e)t$("permitted unsafe binary %o",r);else throw new Rs(void 0,"binary",D5);let[t,n]=r;return{binary:t,prefix:n}}function N5(r,e=["git"],t=!1){let n=mR(An(e),t);r.on("binary",i=>{n=mR(An(i),t),t$.info("reconfiguring %o",n)}),r.append("spawn.binary",()=>n.binary),r.append("spawn.args",i=>n.prefix?[n.prefix,...i]:i)}var r$={DISALLOWED_ABBREVIATED:{text:"disallowed abbreviated or ambiguous option",solution:"Unambiguous abbreviated options blocked with unsafe.allowAbbreviatedOptions setting: {message}"},UNKNOWN:{text:"~ unknown ~",solution:void 0}};function B5(r){if(!r)return"UNKNOWN";for(let[e,{text:t}]of Object.entries(r$))if(r.startsWith(`fatal: ${t}`))return e;return"UNKNOWN"}var fb=class extends vr{constructor(e=""){var n,i;let t=B5(e);super(void 0,(i=(n=r$[t].solution)==null?void 0:n.replace("{message}",e))!=null?i:e),this.reason=t}};function H5(r){return!!(r.exitCode&&r.stdErr.length)}function G5(r){return _.concat([...r.stdOut,...r.stdErr])}function U5(r=!1,e=H5,t=G5){return(n,i)=>!r&&n||!e(i)?n:t(i)}function j5(r,e){return r===128&&e.startsWith("fatal:")?new fb(e):new vr(void 0,e)}function gR(r){return{type:"task.error",action(e,t){let n=r(e.error,{stdErr:t.stdErr,stdOut:t.stdOut,exitCode:t.exitCode});return _.isBuffer(n)?{error:j5(t.exitCode,n.toString("utf-8"))}:{error:n}}}}var V0=ec("","plugin:input");function z5(r){return{type:"spawn.after",action(e,{commands:t,input:n,spawned:{stdin:i}}){var o;if(!i)return;let s=(o=r==null?void 0:r([...t]))!=null?o:n;if(!s)return V0("generated zero length content, not writing to stdin");V0("writing %s bytes to stdin",GU(s)),i.on("error",a=>{a.code!=="EPIPE"&&V0("[ERROR] stdin error %o",a)}),i.end(s)}}}var db=class{constructor(){this.plugins=new Set,this.events=new bR.EventEmitter}on(e,t){this.events.on(e,t)}reconfigure(e,t){this.events.emit(e,t)}append(e,t){let n=yi(this.plugins,{type:e,action:t});return()=>this.plugins.delete(n)}add(e){let t=[];return An(e).forEach(n=>{n&&this.plugins.add(yi(t,n))}),()=>{t.forEach(n=>{this.plugins.delete(n)})}}exec(e,t,n){let i=t,s=Object.freeze(Object.create(n));for(let o of this.plugins)o.type===e&&(i=o.action(i,s));return i}};function V5(r){let e="--progress",t=["checkout","clone","fetch","pull","push"];return[{type:"spawn.args",action(n,i){return t.includes(i.method)?HU(n,e):n}},{type:"spawn.after",action(n,i){var s;i.commands.includes(e)&&((s=i.spawned.stderr)==null||s.on("data",o=>{let a=/^([\s\S]+?):\s*(\d+)% \((\d+)\/(\d+)\)/.exec(o.toString("utf8"));a&&r({method:i.method,stage:W5(a[1]),progress:mt(a[2]),processed:mt(a[3]),total:mt(a[4])})}))}}]}function W5(r){return String(r.toLowerCase().split(" ",1))||"unknown"}function q5(r){let e=UU(r,["uid","gid"]);return{type:"spawn.options",action(t){return{...e,...t}}}}function Y5(){return{type:"spawn.args",action(r){let e=[],t;function n(i){(t=t||[]).push(...i)}for(let i=0;i<r.length;i++){let s=r[i];if(Xi(s)){n(Zl(s));continue}if(s==="--"){n(r.slice(i+1).flatMap(o=>Xi(o)&&Zl(o)||o));break}e.push(s)}return t?[...e,"--",...t.map(String)]:e}}}function K5({block:r,stdErr:e=!0,stdOut:t=!0}){if(r>0)return{type:"spawn.after",action(n,i){var c,u;let s;function o(){s&&clearTimeout(s),s=setTimeout(l,r)}function a(){var f,d;(f=i.spawned.stdout)==null||f.off("data",o),(d=i.spawned.stderr)==null||d.off("data",o),i.spawned.off("exit",a),i.spawned.off("close",a),s&&clearTimeout(s)}function l(){a(),i.kill(new Rs(void 0,"timeout","block timeout reached"))}t&&((c=i.spawned.stdout)==null||c.on("data",o)),e&&((u=i.spawned.stderr)==null||u.on("data",o)),i.spawned.on("exit",a),i.spawned.on("close",a),o()}}}var n$=(r,e)=>{var i,s,o;let t=new db,n=qU(r&&(typeof r=="string"?{baseDir:r}:r)||{},e);if(!_R(n.baseDir))throw new W0(n,"Cannot use simple-git on a directory that does not exist");return Array.isArray(n.config)&&t.add(O5(n.config)),t.add(I5(n.unsafe)),t.add(F5(n.completion)),n.abort&&t.add(T5(n.abort)),n.progress&&t.add(V5(n.progress)),n.timeout&&t.add(K5(n.timeout)),n.spawnOptions&&t.add(q5(n.spawnOptions)),t.add(Y5()),t.add(z5(n.input)),t.add(gR(U5(!0))),n.errors&&t.add(gR(n.errors)),N5(t,n.binary,(i=n.unsafe)==null?void 0:i.allowUnsafeCustomBinary),t.add($5((s=n.allowEnvironment)!=null?s:[],(o=n.unsafe)==null?void 0:o.allowAbbreviatedOptions)),new xe(n,t)};g();var op=require("node:crypto"),i$=require("node:http"),s$=require("obsidian");var Z5=16*1024,sp=class{constructor(e){this.plugin=e;this.token=(0,op.randomBytes)(32).toString("hex");this.responses=new Set;this.promptQueue=Promise.resolve();this.stopped=!1}async start(){if(this.stopped||this.server)throw new Error("Askpass server cannot be started again");let e=(0,i$.createServer)((n,i)=>{this.handleRequest(n,i).catch(s=>{this.plugin.displayError(s),this.respond(i,500)})});e.requestTimeout=1e4,this.server=e;try{await new Promise((n,i)=>{e.once("error",i),e.listen(0,"127.0.0.1",()=>{e.off("error",i),n()})})}catch(n){throw this.stop(),n}let t=e.address();if(this.stopped||!t||typeof t=="string")throw e.listening&&e.close(),this.stop(),new Error("Askpass server stopped during startup");return e.on("error",n=>{this.stopped||(this.plugin.displayError(n),this.stop())}),{port:t.port,token:this.token}}stop(){var e,t;if(!this.stopped){this.stopped=!0,(e=this.activeModal)==null||e.close();for(let n of this.responses)this.respond(n,503);(t=this.server)!=null&&t.listening&&this.server.close()}}async handleRequest(e,t){if(this.responses.add(t),t.once("close",()=>this.responses.delete(t)),this.stopped||e.method!=="POST"||e.url!=="/askpass"||e.headers.origin){this.respond(t,403);return}let n=[],i=0;for await(let f of e){let d=f;if(i+=d.length,i>Z5){this.respond(t,413);return}n.push(d)}let s=_.concat(n).toString("utf8"),o=s.indexOf(`
`),a=s.slice(0,o);if(o<0||!/^[0-9a-f]{64}$/.test(a)||!(0,op.timingSafeEqual)(_.from(a),_.from(this.token))){this.respond(t,403);return}let l=s.slice(o+1),c=this.promptQueue,u;this.promptQueue=new Promise(f=>{u=f});try{await c,!this.stopped&&!t.destroyed&&await this.showPrompt(l,t)}finally{u()}}async showPrompt(e,t){let n=e.length>60?new s$.Notice(e,999999):null,i=new _t(this.plugin,{allowEmpty:!0,obscure:!e.includes("Username for"),placeholder:e.length>60?"Enter a response to the message.":e});this.activeModal=i;let s=()=>{t.writableEnded||i.close()};t.once("close",s);try{let o=await i.openAndGetResult();if(this.stopped||t.destroyed)return;o===void 0?this.respond(t,409):this.respond(t,200,`${o}
`)}finally{t.off("close",s),n==null||n.hide(),this.activeModal===i&&(this.activeModal=void 0)}}respond(e,t,n=""){e.destroyed||e.writableEnded||(e.writeHead(t,{"Cache-Control":"no-store","Content-Type":"text/plain; charset=utf-8","X-Content-Type-Options":"nosniff"}),e.end(n))}};var Ze=class extends Wl{constructor(t){super(t);this.unloaded=!1;this.useDefaultWindowsGitPath=!1}async setGitInstance(t=!1){var i,s;if(this.unloaded)return;(i=this.askpassServer)==null||i.stop(),this.askpassServer=void 0;let n=await this.isGitInstalled();if(!this.unloaded&&n){let o=this.app.vault.adapter,a=o.getBasePath(),l=a;this.plugin.settings.basePath&&(await o.exists((0,Eo.normalizePath)(this.plugin.settings.basePath))?l=Fe.join(a,this.plugin.settings.basePath):t||new Eo.Notice("ObsidianGit: Base path does not exist")),this.absoluteRepoPath=l;let c=this.plugin.localStorage.getPATHPaths(),u=this.plugin.localStorage.getEnvVars(),f=this.plugin.settings.gitDir,d={...process.env};if(c.length>0){let C=c.join(Fe.delimiter)+Fe.delimiter+d.PATH;d.PATH=C}f&&(d.GIT_DIR=f,d.GIT_WORK_TREE=l);for(let C of u){let[S,T]=C.split("=");S!==void 0&&(d[S]=T)}this.git=n$({baseDir:l,binary:this.plugin.localStorage.getGitPath()||(this.useDefaultWindowsGitPath?xh:void 0),config:["core.quotepath=off"],allowEnvironment:[...Object.keys(d),"GIT_ASKPASS","SSH_ASKPASS","SSH_ASKPASS_REQUIRE","OBSIDIAN_GIT_ASKPASS_PORT","OBSIDIAN_GIT_ASKPASS_TOKEN","OBSIDIAN_GIT"],progress:C=>{var S;(S=this.plugin.statusBar)==null||S.displayProgress(this.toGitProgress(C))},unsafe:{allowAbbreviatedOptions:!0,allowUnsafeCustomBinary:!0,allowUnsafeEditor:!0,allowUnsafeAskPass:!0,allowUnsafeConfigEnvCount:!0,allowUnsafeConfigPaths:!0,allowUnsafeCredentialHelper:!0,allowUnsafeGitProxy:!0,allowUnsafeGpgProgram:!0,allowUnsafeHooksPath:!0,allowUnsafeMergeDriver:!0,allowUnsafeSshCommand:!0,allowUnsafePager:!0,allowUnsafeDiffTextConv:!0,allowUnsafeCommandBinaries:!0,allowUnsafeExec:!0,allowUnsafeInclude:!0,allowUnsafeSubmodule:!0,allowUnsafeUrlRewrite:!0}});let h="simple-git",p=",",w=((s=localStorage.debug)!=null?s:"").split(p);if(!w.includes(h)&&!w.includes(`-${h}`)&&(w.push(h),l$.default.enable(w.join(p))),await this.git.env(d).checkIsRepo()){let C=await this.git.revparse("--show-cdup"),S=(0,uf.resolve)(l+uf.sep+C);this.absoluteRepoPath=S,await this.git.cwd(S)}if(this.unloaded)return;let y=Fe.join(a,this.app.vault.configDir,"plugins","obsidian-git"),v=Fe.join(y,Tv),A=Fe.join(y,".git_credentials_input");if(await Tn.rm(A,{force:!0}),await Tn.rm(`${A}.response`,{force:!0}),this.unloaded)return;if(d.SSH_ASKPASS==null){if(!await this.startAskpass(v,d))return;d.SSH_ASKPASS=v,d.GIT_ASKPASS==null&&(d.GIT_ASKPASS=v),d.SSH_ASKPASS_REQUIRE="force"}if(this.unloaded)return;d.OBSIDIAN_GIT="1",this.git=this.git.env(d)}}toGitProgress(t){return{action:this.getProgressAction(t.method),stage:t.stage,progress:t.progress,processed:t.processed,total:t.total}}getProgressAction(t){switch(t){case"fetch":return"Fetching";case"push":return"Pushing";case"pull":return"Pulling";case"checkout":return"Checking out";default:return t?t.charAt(0).toUpperCase()+t.slice(1):"Working"}}getRelativeVaultPath(t){let i=this.app.vault.adapter.getBasePath(),s=Fe.join(this.absoluteRepoPath,t),o=Fe.relative(i,s);return Eo.Platform.isWin&&(o=o.replace(/\\/g,"/")),o}getRelativeRepoPath(t,n=!0){if(n){let s=this.plugin.app.vault.adapter.getBasePath(),o=this.absoluteRepoPath,a=Fe.join(s,t),l=Fe.relative(o,a);return Eo.Platform.isWin&&(l=l.replace(/\\/g,"/")),l}return t}getVaultPathspec(){if(!this.plugin.settings.limitToVault)return;let t=this.app.vault.adapter,n=Fe.resolve(t.getBasePath()),i=Fe.resolve(this.absoluteRepoPath),s=Fe.relative(i,n);if(!(s===""||s===".."||s.startsWith(".."+Fe.sep)||Fe.isAbsolute(s)))return s.split(Fe.sep).join("/")}async countPathsOutsideVault(t){return(await this.git.raw([...t,"-z"])).split("\0").filter(i=>i&&!this.isPathInsideVault(i)).length}get relPluginConfigPath(){return Fe.join(this.app.vault.configDir,"plugins","obsidian-git")}async startAskpass(t,n){var a;if(await this.addAskPassScriptToExclude(),this.unloaded||(await Tn.writeFile(t,gC),await Tn.chmod(t,493),this.unloaded))return!1;let i=new sp(this.plugin);(a=this.askpassServer)==null||a.stop(),this.askpassServer=i;let s,o;try{({port:s,token:o}=await i.start())}catch(l){if(this.unloaded||this.askpassServer!==i)return!1;throw l}return this.unloaded||this.askpassServer!==i?(i.stop(),!1):(n.OBSIDIAN_GIT_ASKPASS_PORT=`${s}`,n.OBSIDIAN_GIT_ASKPASS_TOKEN=o,!0)}async addAskPassScriptToExclude(){try{if(!await this.git.checkIsRepo())return;let t=await this.git.revparse(["--path-format=absolute","--git-path","info/exclude"]),n=Fe.join(this.app.vault.configDir,"plugins","obsidian-git",Tv),i=this.getRelativeRepoPath(n,!0);(await Tn.readFile(t,"utf-8")).split(`
`).some(l=>l.contains(i))||await Tn.appendFile(t,i+`
`)}catch(t){console.error("Error while adding askpass script to exclude file:",t)}}unload(){var t;this.unloaded=!0,(t=this.askpassServer)==null||t.stop(),this.askpassServer=void 0}async status(t){var u;let n=(u=t==null?void 0:t.path)!=null?u:this.getVaultPathspec(),[i,s,o]=await Promise.all([this.git.status(n!=null?["--",n]:[]),this.getVaultPathspec()==null?0:this.countPathsOutsideVault(["diff","--cached","--name-only","--diff-filter=ACDMRT"]),this.getVaultPathspec()==null?0:this.countPathsOutsideVault(["diff","--name-only","--diff-filter=U"])]),a=i.files.map(f=>{let d=this.formatPath(f);return{path:d.path,from:d.from,index:f.index==="?"?"U":f.index,workingDir:f.working_dir==="?"?"U":f.working_dir,vaultPath:this.getRelativeVaultPath(d.path)}}),l=i.conflicted.map(f=>this.formatPath({path:f}).path),c=new Set(l);return{all:a,changed:a.filter(f=>f.workingDir!==" "&&!c.has(f.path)),staged:a.filter(f=>f.index!==" "&&f.index!="U"),conflicted:l,stagedOutsideVault:s,conflictedOutsideVault:o}}async selectAutoCommitFiles(t,n){if(n.mode==="exclude"&&n.globs.length===0)return{files:t.changed,selection:n};if(n.mode==="include"&&n.globs.length===0)return{files:[],selection:n};let i=async a=>{let l=await this.git.status(["--untracked-files=all","--",...a]),c=new Set(l.conflicted.map(u=>this.formatPath({path:u}).path));return l.files.map(u=>{let f=this.formatPath(u);return{path:f.path,from:f.from,vaultPath:this.getRelativeVaultPath(f.path),index:u.index==="?"?"U":u.index,workingDir:u.working_dir==="?"?"U":u.working_dir}}).filter(u=>u.workingDir!==" "&&!c.has(u.path))};if(n.mode==="exclude")return{files:await i([".",...n.globs.map(l=>`:(exclude,glob)${l}`)]),selection:n};let s=new Map,o=[];for(let a of n.globs){let l=await i([`:(glob)${a}`]);if(l.length!==0){o.push(a);for(let c of l)s.set(c.path,c)}}return{files:[...s.values()],selection:{mode:"include",globs:o}}}async isMergeInProgress(){let t=await this.git.revparse(["--git-path","MERGE_HEAD"]),n=Fe.resolve(this.absoluteRepoPath,t.trim());try{return await Tn.access(n),!0}catch(i){if(i instanceof Error&&"code"in i&&i.code==="ENOENT")return!1;throw i}}async submoduleAwareHeadRevisonInContainingDirectory(t){let n=this.getRelativeRepoPath(t),s=["-C",Fe.dirname(n),"rev-parse","HEAD"],o=this.git.raw(s);return o.catch(a=>console.warn("obsidian-git: rev-parse error:",a)),(await o).trim()}async getSubmodulePaths(){return new Promise(t=>{this.git.outputHandler((n,i,s,o)=>{if(!(o.contains("submodule")&&o.contains("foreach")))return;let a="",l=this.absoluteRepoPath;i.on("data",c=>{a+=c.toString("utf8")}),i.on("end",()=>{let u=a.split(`
`).map(f=>{let d=f.match(/'([^']*)'/);if(d!=null)return l+"/"+d[1]+uf.sep}).filter(f=>!!f).filter(f=>{if(this.getVaultPathspec()==null)return!0;let d=this.app.vault.adapter,h=Fe.relative(Fe.resolve(d.getBasePath()),Fe.resolve(f));return!(h===".."||h.startsWith(".."+Fe.sep)||Fe.isAbsolute(h))});u.reverse(),t(u)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},n=>this.plugin.displayError(n))})}formatPath(t){function n(i){if(i!=null)return i.startsWith('"')&&i.endsWith('"')?i.substring(1,i.length-1):i}return t.from!=null?{from:n(t.from),path:n(t.path)}:{path:n(t.path)}}async blame(t,n,i){if(t=this.getRelativeRepoPath(t),!await this.isTracked(t))return"untracked";let s=await this.getSubmoduleOfFile(t),o=s?["-C",s.submodule]:[],a=s?s.relativeFilepath:t;o.push("blame","--porcelain"),i&&o.push("-w");let l=`-C${_h}`;switch(n){case"inactive":break;case"same-commit":o.push("-C",l);break;case"all-commits":o.push("-C","-C",l);break;default:bo(n)}o.push("--",a);let c=await this.git.raw(o);return X5(c)}async isTracked(t){let n=await this.getSubmoduleOfFile(t),i=n?["-C",n.submodule]:[],s=n?n.relativeFilepath:t;return i.push("ls-files","--",s),this.git.raw(i).then(o=>o.trim()!=="")}async commitAll({message:t,status:n,unstagedFiles:i,selection:s,amend:o}){return this.withGitOperation(2,async()=>{if(this.plugin.settings.updateSubmodules){let l=await this.getSubmodulePaths();for(let c of l)await this.git.cwd({path:c,root:!1}).add("-A"),await this.git.cwd({path:c,root:!1}).commit(await this.formatCommitMessage(t))}if((s==null?void 0:s.mode)==="include")i==null&&(s=(await this.selectAutoCommitFiles(n!=null?n:await this.status(),s)).selection),s.globs.length>0&&await this.git.add(["-A","--",...s.globs.map(l=>`:(glob)${l}`)]);else if(s!=null&&s.globs.length)await this.git.add(["-A","--",".",...s.globs.map(l=>`:(exclude,glob)${l}`)]);else{let l=this.getVaultPathspec();await this.git.add(l==null?"-A":["-A","--",l])}let a=await this.git.commit(await this.formatCommitMessage(t),o?["--amend"]:[]);return this.app.workspace.trigger("obsidian-git:head-change"),this.app.workspace.trigger("obsidian-git:refs-changed"),this.getCommittedFilesCount(a.summary.changes)})}async commit({message:t,amend:n}){return this.withGitOperation(2,async()=>{try{let i=await this.git.commit(await this.formatCommitMessage(t),n?["--amend"]:[]);return this.app.workspace.trigger("obsidian-git:head-change"),this.app.workspace.trigger("obsidian-git:refs-changed"),this.getCommittedFilesCount(i.summary.changes)}catch(i){return this.throwConflictError(i)}})}async getCommittedFilesCount(t){return t!==0?t:(await this.git.diffSummary(["HEAD^1","HEAD"])).changed}async stage(t,n){t=this.getRelativeRepoPath(t,n),await this.git.add(["--",t])}async stageAll({dir:t}){let n=t!=null?t:this.getVaultPathspec();await this.git.add(n==null?"-A":["-A","--",n])}async unstageAll({dir:t}){let n=t!=null?t:this.getVaultPathspec();await this.git.reset(n!=null?["--",n]:[])}async unstage(t,n){t=this.getRelativeRepoPath(t,n),await this.git.reset(["--",t])}async discard(t){await this.isTracked(t)&&await this.git.checkout(["--progress","--",t])}async applyPatch(t){let n=Fe.join(this.relPluginConfigPath,"patch");await this.app.vault.adapter.write(n,t),await this.git.applyPatch(n,{"--cached":null,"--unidiff-zero":null,"--whitespace":"nowarn"}),await this.app.vault.adapter.remove(n)}async getUntrackedPaths(t){var o;let n=(o=t==null?void 0:t.path)!=null?o:this.getVaultPathspec(),i=[];return n!=null&&i.push("--",n),(await this.git.clean(cf.RECURSIVE+cf.DRY_RUN,i)).paths}async hashObject(t){t=this.getRelativeRepoPath(t);let n=await this.getSubmoduleOfFile(t),i=n?["-C",n.submodule]:[],s=n?n.relativeFilepath:t;return i.push("hash-object","--",s),this.git.raw(i)}async discardAll({dir:t}){var n;return this.discard((n=t!=null?t:this.getVaultPathspec())!=null?n:".")}async pull(){return this.withGitOperation(1,async()=>{try{if(this.plugin.settings.updateSubmodules){let s=["update","--remote","--merge","--recursive"],o=this.getVaultPathspec();o!=null&&s.push("--",o),await this.git.subModule(s)}let t=await this.branchInfo();if(!t.current)throw new Error("No current branch found. Cannot pull.");let n=await this.git.revparse([t.current]);if(!t.tracking)return this.plugin.log(this.plugin.settings.updateSubmodules?"No tracking branch found. Ignoring pull of main repo and updated submodules only.":"No tracking branch found. Ignoring pull."),{status:"skipped",reason:"no-upstream"};await this.git.fetch(),this.app.workspace.trigger("obsidian-git:refs-changed");let i=await this.git.revparse([t.tracking]);if(n!==i){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{let c=[t.tracking];switch(this.plugin.settings.mergeStrategy!=="none"&&c.push(`--strategy-option=${this.plugin.settings.mergeStrategy}`),this.plugin.settings.syncMethod){case"merge":await this.git.merge(c);break;case"rebase":{this.plugin.settings.rebaseAutoStash==="enabled"?c.push("--autostash"):this.plugin.settings.rebaseAutoStash==="disabled"&&c.push("--no-autostash"),await this.git.rebase(c);break}}}catch(c){await this.throwConflictError(c)}else this.plugin.settings.syncMethod==="reset"&&(await this.git.raw(["update-ref",`refs/heads/${t.current}`,i]),await this.git.reset([]));let s=await this.git.revparse([t.current]);if(s===n)return{status:"up-to-date"};this.app.workspace.trigger("obsidian-git:head-change"),this.app.workspace.trigger("obsidian-git:refs-changed");let a=(await this.git.diff([`${n}..${s}`,"--name-only"])).split(/\r\n|\r|\n/).filter(c=>c.length>0),l=a.filter(c=>this.isPathInsideVault(c));return{status:"updated",outsideVault:a.length-l.length,files:l.map(c=>({path:c,workingDir:"P",vaultPath:this.getRelativeVaultPath(c)}))}}else return{status:"up-to-date"}}catch(t){this.convertErrors(t)}})}async throwConflictError(t){try{let n=await this.git.status();if(n.conflicted.length>0)throw new Xn(n.conflicted,t)}catch(n){if(n instanceof Xn)throw n}throw t}async push(){return this.withGitOperation(3,async()=>{try{if(this.plugin.settings.updateSubmodules)if(this.getVaultPathspec()==null)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`]);else{let s=await this.getSubmodulePaths();for(let o of s){let a=this.git.cwd({path:o,root:!1}),l=await a.status();l.tracking&&l.ahead>0&&await a.push()}}let t=await this.getCurrentBranch();if(!t)return{status:"blocked",reason:"no-branch"};let n=await this.getPushTarget(t);if(!n&&this.plugin.settings.updateSubmodules)return this.plugin.log("No push target found. Ignoring push of main repo and updating submodules only."),{status:"skipped",reason:"no-upstream"};let i=null;return n!=null&&n.exists&&(i=(await this.git.diffSummary([t,n.ref,"--"])).changed),await this.git.push(),this.app.workspace.trigger("obsidian-git:refs-changed"),i===0?{status:"up-to-date"}:{status:"pushed",files:i}}catch(t){this.convertErrors(t)}})}async getPushTarget(t){let n=(await this.git.raw(["for-each-ref","--format=%(push)",`refs/heads/${t}`])).trim();if(!n)return;let i=(await this.git.raw(["for-each-ref","--format=%(refname)",n])).trim();return{ref:n,exists:i===n}}async squashAllUnpushedCommits(){let t=await this.git.status();if(!t.current)return;let n=await this.getPushTarget(t.current);if(!(n!=null&&n.exists)||(await this.git.raw(["diff","--cached","--name-only"])).trim().length>0)return;let s=`${n.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",n.ref]),await this.git.raw(["commit","-C",l]),this.app.workspace.trigger("obsidian-git:head-change"),this.app.workspace.trigger("obsidian-git:refs-changed")})}async getUnpushedCommits(){let t=await this.getCurrentBranch();if(t==null)return 0;let n=await this.getPushTarget(t);return n?n.exists?(await this.git.diffSummary([t,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 t=await this.getCurrentBranch();if(!t)return this.plugin.log("During canPush check, no current branch found."),!1;let n=await this.getPushTarget(t);if(!n)return!1;if(!n.exists)return!0;let[i,s]=await Promise.all([this.git.revparse([t]),this.git.revparse([n.ref])]);return i!==s}async checkRequirements(){return await this.isGitInstalled()?await this.git.checkIsRepo()?"valid":"missing-repo":"missing-git"}async getCurrentBranch(){return(await this.git.raw(["symbolic-ref","--quiet","--short","HEAD"])).trim()||void 0}async branchInfo(){let[t,n]=await Promise.all([this.getCurrentBranch(),this.git.raw(["branch","--list","--no-color","--format=%(refname)%00%(upstream:short)"])]),i,s=[];for(let o of n.split(`
`)){let[a,l]=o.split("\0");if(!(a!=null&&a.startsWith("refs/heads/")))continue;let c=a.slice(11);s.push(c),c===t&&(i=l||void 0)}return{current:t,tracking:i,branches:s}}async getRemoteUrl(t){try{return await this.git.remote(["get-url",t])||void 0}catch(n){if(String(n).contains(t))return;throw n}}async log(t,n=!0,i,s){let o;t&&(o=this.getRelativeRepoPath(t,n));let a={file:o,maxCount:i,"--diff-merges":"first-parent","--name-status":null};return s&&(a[s]=null),(await this.git.log(a)).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 m="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:m,fromVaultPath:m!=null?this.getRelativeVaultPath(m):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(t,n,i=!0){let s=this.getRelativeRepoPath(n,i);return this.git.show(["--textconv",t+":"+s])}async getLocalBranchUpstream(t){try{let i=(await this.git.raw(["rev-parse","--abbrev-ref",`${t}@{upstream}`])).trim();return i.length>0?i:void 0}catch(n){return}}getAvailableLocalBranchName(t,n,i){let s=t;if(!i.includes(s))return s;let o=`${t}-${n}`,a=o,l=0;for(;i.includes(a);)l+=1,a=`${o}-${l}`;return a}async checkout(t,n){return this.withGitOperation(5,async()=>{if(n){let i=`${n}/${t}`,s=await this.branchInfo();if(s.branches.includes(t)&&await this.getLocalBranchUpstream(t)===i)await this.git.checkout(t);else{let l=this.getAvailableLocalBranchName(t,n,s.branches);await this.git.checkout(["-b",l,i])}}else await this.git.checkout(t);if(this.plugin.settings.submoduleRecurseCheckout){let i=await this.getSubmodulePaths();for(let s of i){let o=await this.git.cwd({path:s,root:!1}).branch();Object.keys(o.branches).includes(t)&&await this.git.cwd({path:s,root:!1}).checkout(t)}}this.app.workspace.trigger("obsidian-git:refs-changed")})}async createBranch(t){await this.git.checkout(["-b",t]),this.app.workspace.trigger("obsidian-git:refs-changed")}async deleteBranch(t,n){await this.git.branch([n?"-D":"-d",t]),this.app.workspace.trigger("obsidian-git:refs-changed")}async branchIsMerged(t){return!(await this.git.branch(["--no-merged"])).all.contains(t)}async init(){await this.git.init(!1)}async clone(t,n,i){await this.git.clone(t,Fe.join(this.app.vault.adapter.getBasePath(),n),i?["--depth",`${i}`]:[]),await this.setGitInstance()}async setConfig(t,n){n==null?await this.getConfig(t,"local")!==void 0&&await this.git.raw(["config","--local","--unset-all",t]):await this.git.addConfig(t,n,!1,"local")}async getConfig(t,n="local"){var s;return(s=(await this.git.getConfig(t.toLowerCase(),n=="all"?void 0:n)).value)!=null?s:void 0}async fetch(t){return this.withGitOperation(4,async()=>{await this.git.fetch(t!=null?[t]:[]),this.app.workspace.trigger("obsidian-git:refs-changed")})}async setRemote(t,n){(await this.getRemotes()).includes(t)?await this.git.remote(["set-url",t,n]):await this.git.remote(["add",t,n])}async getRemoteBranches(t){let n=await this.git.branch(["-r","--list",`${t}*`]),i=[];for(let s in n.branches)i.push(n.branches[s].name);return i}async getRemotes(){let t=await this.git.remote([]);return t?t.trim().split(`
`):[]}async removeRemote(t){await this.git.removeRemote(t),this.app.workspace.trigger("obsidian-git:refs-changed")}async updateUpstreamBranch(t){try{await this.git.branch(["--set-upstream-to",t])}catch(n){try{await this.git.branch(["--set-upstream",t])}catch(i){let[s,o]=yo(t),a=await this.branchInfo();await this.git.push(["--set-upstream",s,`${a.current}:${o}`]),this.app.workspace.trigger("obsidian-git:refs-changed")}}}updateGitPath(t){return this.setGitInstance()}updateBasePath(t){return this.setGitInstance(!0)}async getDiffString(t,n=!1,i){return n?await this.git.diff(["--cached","--",t]):i?await this.git.show([`${i}`,"--",t]):await this.git.diff(["--",t])}async diff(t,n,i){return await this.git.diff([`${n}..${i}`,"--",t])}async rawCommand(t){let n=t.split(" "),i=n[0];if(i===void 0)return"";let s=await this.git.raw(i,...n.slice(1));return this.app.workspace.trigger("obsidian-git:refs-changed"),s}async getSubmoduleOfFile(t){if(!await this.app.vault.adapter.exists(Fe.dirname(t)))return;let n=await this.git.raw(["-C",Fe.dirname(t),"rev-parse","--show-toplevel"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message));if(n=n.trim(),(await this.git.raw(["-C",Fe.dirname(t),"rev-parse","--show-superproject-working-tree"],l=>l&&console.warn("get-submodule-of-file",l==null?void 0:l.message))).trim()==="")return;let o=this.app.vault.adapter.getFullPath(Fe.normalize(t)),a=Fe.relative(n,o);return{submodule:n,relativeFilepath:a}}async getLastCommitTime(){try{let t=await this.git.log({n:1});if(t!=null&&t.latest!=null)return new Date(t.latest.date)}catch(t){if(t instanceof vr){if(t.message.contains("does not have any commits yet"))return}else throw t}}async isGitInstalled(){let t=this.plugin.localStorage.getGitPath(),n=await rf(t||"git",["--version"],{});if(n.error)if(Eo.Platform.isWin&&!t){this.plugin.log(`Git not found in PATH. Checking standard installation path(${xh}) of Git for Windows.`);let i=await rf(xh,["--version"]);if(i.error)return console.error(i.error),!1;this.useDefaultWindowsGitPath=!0}else return console.error(n.error),!1;else this.useDefaultWindowsGitPath=!1;return!0}convertErrors(t){if(t instanceof vr){let n=String(t.message);if(n.contains("Could not resolve host")||n.contains("Unable to resolve host")||n.contains("Unable to open connection")||n.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||n.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||n.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new Hl(n)}throw t}async isFileTrackedByLFS(t){try{return(await this.git.raw(["check-attr","filter",t])).includes("filter: lfs")}catch(n){let i=n instanceof Error?n.message:String(n);throw new Error(`Error checking LFS status: ${i}`)}}},c$={hash:"000000",isZeroCommit:!0,summary:""};function X5(r){let t=r.replaceAll(`\r
`,`
`).split(`
`),n={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},i=1;for(let s=0;s<t.length;){let o=t[s];if(o$(o)){let a=o.split(" "),l=Q5(a,i,n);for(s++;o$(t[s]);s++){let c=t[s].split(" ");J5(c,n,i)}ej(n.commits.get(l)),i+=1}else if(!(o===""&&s===t.length-1))throw Error(`Expected non-whitespace line or EOF, but found: ${o}`);s++}return n}function Q5(r,e,t){let n=r[0],i=r[1],s=r[2];if(n===void 0||i===void 0||s===void 0)throw Error(`Invalid git-blame line info: ${r.join(" ")}`);if(t.hashPerLine.push(n),t.originalFileLineNrPerLine.push(parseInt(i)),t.finalFileLineNrPerLine.push(parseInt(s)),r.length>=4&&t.groupSizePerStartingLine.set(e,parseInt(r[3])),parseInt(s)!==e)throw Error(`git-blame output is out of order: ${e} vs ${s}`);return n}function J5(r,e,t){let n=r[0],i=r.slice(1).join(" "),s=e.hashPerLine[t];if(s===void 0)throw Error(`No commit hash found for git-blame line ${t}`);let o=e.commits.get(s)||{hash:s,author:{},committer:{},previous:{}};switch(n){case"summary":o.summary=i;break;case"author":o.author.name=i;break;case"author-mail":o.author.email=a$(i);break;case"author-time":o.author.epochSeconds=parseInt(i);break;case"author-tz":o.author.tz=i;break;case"committer":o.committer.name=i;break;case"committer-mail":o.committer.email=a$(i);break;case"committer-time":o.committer.epochSeconds=parseInt(i);break;case"committer-tz":o.committer.tz=i;break;case"previous":o.previous.commitHash=i;break;case"filename":o.previous.filename=i;break;case void 0:break}e.commits.set(s,o)}function ej(r){if(r.summary===void 0)throw Error(`Summary not provided for commit: ${r.hash}`);xb(r.author)&&(r.author=void 0),xb(r.committer)&&(r.committer=void 0),xb(r.previous)&&(r.previous=void 0),r.isZeroCommit=!!r.hash.match(/^0*$/)}function xb(r){return!r||Object.keys(r).length===0}function o$(r){return r===void 0?!1:r.length>0&&r[0].trim()===r[0]}function a$(r){let e=r.startsWith("<")?r.substring(1):r;return e.endsWith(">")?e.substring(0,e.length-1):e}g();var N$=require("@codemirror/state");g();var Eb=class{constructor(){this.eventsPerFilepath=new Map;this.init()}ifFilepathDefinedTransformSubscribers(e,t){if(e)return this.ensureInitialized(e),t(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(t=>t.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()}},Jn=new Eb;g();var fp=require("@codemirror/state");g();g();g();var tj="input is invalid type",u$="finalize already called",rj=typeof ArrayBuffer!="undefined",Sb=function(r){var e=typeof r;if(e==="string")return[r,!0];if(Array.isArray(r))return[r,!1];if(rj&&r){if(r.constructor===ArrayBuffer)return[new Uint8Array(r),!1];if(ArrayBuffer.isView(r))return[r,!1]}throw new Error(tj)};var ne="0123456789abcdef".split(""),nj=[-2147483648,8388608,32768,128],_i=[24,16,8,0],ap=[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],lp=["hex","array","digest","arrayBuffer"],ar=[],f$=function(r,e){return function(t){return new lr(e,!0).update(t)[r]()}},h$=function(r){var e=f$("hex",r);e.create=function(){return new lr(r)},e.update=function(i){return e.create().update(i)};for(var t=0;t<lp.length;++t){var n=lp[t];e[n]=f$(n,r)}return e},d$=function(r,e){return function(t,n){return new cp(t,e,!0).update(n)[r]()}},p$=function(r){var e=d$("hex",r);e.create=function(i){return new cp(i,r)},e.update=function(i,s){return e.create(i).update(s)};for(var t=0;t<lp.length;++t){var n=lp[t];e[n]=d$(n,r)}return e};function lr(r,e){e?(ar[0]=ar[16]=ar[1]=ar[2]=ar[3]=ar[4]=ar[5]=ar[6]=ar[7]=ar[8]=ar[9]=ar[10]=ar[11]=ar[12]=ar[13]=ar[14]=ar[15]=0,this.blocks=ar):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=r}lr.prototype.update=function(r){if(this.finalized)throw new Error(u$);var e=Sb(r);r=e[0];for(var t=e[1],n,i=0,s,o=r.length,a=this.blocks;i<o;){if(this.hashed&&(this.hashed=!1,a[0]=this.block,this.block=a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),t)for(s=this.start;i<o&&s<64;++i)n=r.charCodeAt(i),n<128?a[s>>>2]|=n<<_i[s++&3]:n<2048?(a[s>>>2]|=(192|n>>>6)<<_i[s++&3],a[s>>>2]|=(128|n&63)<<_i[s++&3]):n<55296||n>=57344?(a[s>>>2]|=(224|n>>>12)<<_i[s++&3],a[s>>>2]|=(128|n>>>6&63)<<_i[s++&3],a[s>>>2]|=(128|n&63)<<_i[s++&3]):(n=65536+((n&1023)<<10|r.charCodeAt(++i)&1023),a[s>>>2]|=(240|n>>>18)<<_i[s++&3],a[s>>>2]|=(128|n>>>12&63)<<_i[s++&3],a[s>>>2]|=(128|n>>>6&63)<<_i[s++&3],a[s>>>2]|=(128|n&63)<<_i[s++&3]);else for(s=this.start;i<o&&s<64;++i)a[s>>>2]|=r[i]<<_i[s++&3];this.lastByteIndex=s,this.bytes+=s-this.start,s>=64?(this.block=a[16],this.start=s-64,this.hash(),this.hashed=!0):this.start=s}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this};lr.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var r=this.blocks,e=this.lastByteIndex;r[16]=this.block,r[e>>>2]|=nj[e&3],this.block=r[16],e>=56&&(this.hashed||this.hash(),r[0]=this.block,r[16]=r[1]=r[2]=r[3]=r[4]=r[5]=r[6]=r[7]=r[8]=r[9]=r[10]=r[11]=r[12]=r[13]=r[14]=r[15]=0),r[14]=this.hBytes<<3|this.bytes>>>29,r[15]=this.bytes<<3,this.hash()}};lr.prototype.hash=function(){var r=this.h0,e=this.h1,t=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,l=this.blocks,c,u,f,d,h,p,m,w,y,v,A;for(c=16;c<64;++c)h=l[c-15],u=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3,h=l[c-2],f=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10,l[c]=l[c-16]+u+l[c-7]+f<<0;for(A=e&t,c=0;c<64;c+=4)this.first?(this.is224?(w=300032,h=l[0]-1413257819,a=h-150054599<<0,n=h+24177077<<0):(w=704751109,h=l[0]-210244248,a=h-1521486534<<0,n=h+143694565<<0),this.first=!1):(u=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),f=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),w=r&e,d=w^r&t^A,m=i&s^~i&o,h=a+f+m+ap[c]+l[c],p=u+d,a=n+h<<0,n=h+p<<0),u=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),f=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),y=n&r,d=y^n&e^w,m=a&i^~a&s,h=o+f+m+ap[c+1]+l[c+1],p=u+d,o=t+h<<0,t=h+p<<0,u=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),f=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),v=t&n,d=v^t&r^y,m=o&a^~o&i,h=s+f+m+ap[c+2]+l[c+2],p=u+d,s=e+h<<0,e=h+p<<0,u=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),f=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),A=e&t,d=A^e&n^v,m=s&o^~s&a,h=i+f+m+ap[c+3]+l[c+3],p=u+d,i=r+h<<0,r=h+p<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+r<<0,this.h1=this.h1+e<<0,this.h2=this.h2+t<<0,this.h3=this.h3+n<<0,this.h4=this.h4+i<<0,this.h5=this.h5+s<<0,this.h6=this.h6+o<<0,this.h7=this.h7+a<<0};lr.prototype.hex=function(){this.finalize();var r=this.h0,e=this.h1,t=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,l=ne[r>>>28&15]+ne[r>>>24&15]+ne[r>>>20&15]+ne[r>>>16&15]+ne[r>>>12&15]+ne[r>>>8&15]+ne[r>>>4&15]+ne[r&15]+ne[e>>>28&15]+ne[e>>>24&15]+ne[e>>>20&15]+ne[e>>>16&15]+ne[e>>>12&15]+ne[e>>>8&15]+ne[e>>>4&15]+ne[e&15]+ne[t>>>28&15]+ne[t>>>24&15]+ne[t>>>20&15]+ne[t>>>16&15]+ne[t>>>12&15]+ne[t>>>8&15]+ne[t>>>4&15]+ne[t&15]+ne[n>>>28&15]+ne[n>>>24&15]+ne[n>>>20&15]+ne[n>>>16&15]+ne[n>>>12&15]+ne[n>>>8&15]+ne[n>>>4&15]+ne[n&15]+ne[i>>>28&15]+ne[i>>>24&15]+ne[i>>>20&15]+ne[i>>>16&15]+ne[i>>>12&15]+ne[i>>>8&15]+ne[i>>>4&15]+ne[i&15]+ne[s>>>28&15]+ne[s>>>24&15]+ne[s>>>20&15]+ne[s>>>16&15]+ne[s>>>12&15]+ne[s>>>8&15]+ne[s>>>4&15]+ne[s&15]+ne[o>>>28&15]+ne[o>>>24&15]+ne[o>>>20&15]+ne[o>>>16&15]+ne[o>>>12&15]+ne[o>>>8&15]+ne[o>>>4&15]+ne[o&15];return this.is224||(l+=ne[a>>>28&15]+ne[a>>>24&15]+ne[a>>>20&15]+ne[a>>>16&15]+ne[a>>>12&15]+ne[a>>>8&15]+ne[a>>>4&15]+ne[a&15]),l};lr.prototype.toString=lr.prototype.hex;lr.prototype.digest=function(){this.finalize();var r=this.h0,e=this.h1,t=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,l=[r>>>24&255,r>>>16&255,r>>>8&255,r&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255,i>>>24&255,i>>>16&255,i>>>8&255,i&255,s>>>24&255,s>>>16&255,s>>>8&255,s&255,o>>>24&255,o>>>16&255,o>>>8&255,o&255];return this.is224||l.push(a>>>24&255,a>>>16&255,a>>>8&255,a&255),l};lr.prototype.array=lr.prototype.digest;lr.prototype.arrayBuffer=function(){this.finalize();var r=new ArrayBuffer(this.is224?28:32),e=new DataView(r);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),r};function cp(r,e,t){var n,i=Sb(r);if(r=i[0],i[1]){var s=[],o=r.length,a=0,l;for(n=0;n<o;++n)l=r.charCodeAt(n),l<128?s[a++]=l:l<2048?(s[a++]=192|l>>>6,s[a++]=128|l&63):l<55296||l>=57344?(s[a++]=224|l>>>12,s[a++]=128|l>>>6&63,s[a++]=128|l&63):(l=65536+((l&1023)<<10|r.charCodeAt(++n)&1023),s[a++]=240|l>>>18,s[a++]=128|l>>>12&63,s[a++]=128|l>>>6&63,s[a++]=128|l&63);r=s}r.length>64&&(r=new lr(e,!0).update(r).array());var c=[],u=[];for(n=0;n<64;++n){var f=r[n]||0;c[n]=92^f,u[n]=54^f}lr.call(this,e,t),this.update(u),this.oKeyPad=c,this.inner=!0,this.sharedMemory=t}cp.prototype=new lr;cp.prototype.finalize=function(){if(lr.prototype.finalize.call(this),this.inner){this.inner=!1;var r=this.array();lr.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(r),lr.prototype.finalize.call(this)}};var $s=h$(),kb=h$(!0);$s.sha256=$s;$s.sha224=kb;$s.hmac=p$();kb.hmac=p$(!0);function m$(r,e,t){if(!(r===void 0||e===void 0||t===void 0))return`head${r}-obj${e}-path${t}`}var g$=fp.StateEffect.define();function w$(r,e,t){return t.update({effects:g$.of({key:r,la:e,lineOffsetsFromUnsavedChanges:new Map})})}var tc=fp.StateField.define({create:r=>{},update:(r,e)=>{for(let t of e.effects)if(t.is(g$))return t.value;return ij(e,r)},compare:(r,e)=>(r==null?void 0:r.key)===(e==null?void 0:e.key)});function dp(r){var s;let e=$s.create();if(!r)return e;let{la:t,key:n,lineOffsetsFromUnsavedChanges:i}=r;e.update(t==="untracked"?"t":"f"),e.update(n);for(let[o,a]of(s=i.entries())!=null?s:[])e.update([o,a]);return e}var up={get:void 0,save:void 0};function v$(r,e){up.get=r,up.save=e}function hp(r){var e,t;return(t=(e=ff(r.coloringMaxAge))==null?void 0:e.asDays())!=null?t:ff(en.lineAuthor.coloringMaxAge).asDays()}function ij(r,e){if(e)return r.changes.empty||r.changes.iterChanges((t,n,i,s)=>{var p;let o=r.startState.doc,{newDoc:a}=r,l=o.lineAt(t).number,c=o.lineAt(n).number,u=a.lineAt(i).number,f=a.lineAt(s).number,d=c-l+1,h=f-u+1;for(let m=u;m<=f;m++){let w=(p=e.lineOffsetsFromUnsavedChanges.get(m))!=null?p:0,y=f===m,v=h-d;y&&(w+=v),e.lineOffsetsFromUnsavedChanges.set(m,w)}}),e}g();function b$(){rc=void 0,Ab=[],pp=0,gp.clear(),wp.clear(),nc.clear()}var rc,mp=()=>rc;function y$(r,e){var i;let t=e.length;if(t<((i=rc==null?void 0:rc.length)!=null?i:0))return;rc={gutter:r,length:t,text:e};let n=Pt.plugin.localStorage.getGutterSpacingFallbackLength();t!==n&&Pt.plugin.localStorage.setGutterSpacingFallbackLength(t)}var Ab=[],sj=15,pp=0;function _$(r){Ab[pp]=r,pp=(pp+1)%sj}function x$(){return $T(Ab)}var gp=new Map,wp=new Map,nc=new Set;g();var M$=require("@codemirror/state"),D$=require("@codemirror/view");g();var $b=require("@codemirror/view");var ic=require("obsidian");g();g();var vp={x:-10,y:-10};function E$(){vp.x===-10&&window.addEventListener("mousedown",r=>{vp.x=r.clientX,vp.y=r.clientY})}function S$(){for(let r of nc)if(oj(r,vp))return r}function oj(r,e){let{x:t,y:n,width:i,height:s}=r.getBoundingClientRect();return t<=e.x&&e.x<=t+i&&n<=e.y&&e.y<=n+s}var k$="data-commit";function A$(r,e,t){if(e.hasFocus())return;let n=S$();if(!n)return;let i=lj(n);i&&(!i.isZeroCommit&&!i.isWaitingGutter&&aj(i,r),Cb("showCommitHash",r),Cb("authorDisplay",r),Cb("dateTimeFormatOptions",r))}function aj(r,e){e.addItem(t=>t.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-author-copy").onClick(n=>navigator.clipboard.writeText(r.hash)))}function Cb(r,e){var l,c;let t,n,i=Pt.plugin.settings.lineAuthor,s=i[r],o=typeof s=="boolean"?s:s!=="hide",a=en.lineAuthor[r];if(r==="showCommitHash")t="Show commit hash",n=s;else if(r==="authorDisplay"){let u=(l=i.lastShownAuthorDisplay)!=null?l:a;t="Show author "+(o?s:u),n=o?"hide":u}else if(r==="dateTimeFormatOptions"){let u=(c=i.lastShownDateTimeFormatOptions)!=null?c:a;t="Show "+(o?s:u),t+=t.contains("date")?"":" date",n=o?"hide":u}else bo(r);e.addItem(u=>u.setTitle(t).setSection("obs-git-line-author-configure").setChecked(o).onClick(f=>{var d,h;return(h=(d=Pt.plugin)==null?void 0:d.settingsTab)==null?void 0:h.lineAuthorSettingHandler(r,n)}))}function C$(r,e,t){t.setAttr(k$,JSON.stringify({hash:r.hash,isZeroCommit:r.isZeroCommit,isWaitingGutter:e}))}function lj(r){let e=r.getAttr(k$);return e?JSON.parse(e):void 0}g();function yp(r,e){return r==="oldest"?bp(0,!1,e).color:bp(void 0,!0,e).color}function bp(r,e,t){let n=hp(t),i=Date.now()/1e3,s=r!=null?r:0,a=(e?0:i-s)/60/60/24,l=Math.pow(Math.clamp(a/n,0,1),1/2.3),c=cj(),u=t.colorNew,f=t.colorOld,d=c?.4:1,h=Tb(u.r,f.r,l)*d,p=Tb(u.g,f.g,l)*d,m=Tb(u.b,f.b,l)*d;return{color:`rgba(${h},${p},${m},${c?.75:.25})`,daysSinceCommit:a}}function Tb(r,e,t){return r+(e-r)*t}function cj(){var r,e,t;return(t=(e=(r=Pt.plugin)==null?void 0:r.app)==null?void 0:e.isDarkMode())!=null?t:!1}function T$(r){activeDocument.body.style.setProperty("--obs-git-gutter-text",r.textColorCss)}g();function R$(r,e,t){let n;for(let i=e;i<=t;i++){let s=r.hashPerLine[i];if(s===void 0)continue;let o=r.commits.get(s);(!n||o.isZeroCommit||uj(o,n))&&(n=o)}return n}function uj(r,e){var i,s,o,a;let t=(s=(i=r.author)==null?void 0:i.epochSeconds)!=null?s:0,n=(a=(o=e.author)==null?void 0:o.epochSeconds)!=null?a:0;return t>n}var P$=require("node:util");var $$="-",fj="+",dj=3,hj="*",pj=/\S/g,mj="%",sc=class r extends $b.GutterMarker{constructor(t){super();this.text=t}eq(t){return t instanceof r&&this.text===t.text}toDOM(){return activeDocument.createTextNode(this.text)}destroy(t){}},Rb=class extends $b.GutterMarker{constructor(t,n,i,s,o,a){super();this.lineAuthoring=t;this.startLine=n;this.endLine=i;this.key=s;this.settings=o;this.options=a;this.point=!1;this.elementClass="obs-git-blame-gutter"}eq(t){return this.key===(t==null?void 0:t.key)&&this.startLine===(t==null?void 0:t.startLine)&&this.endLine===(t==null?void 0:t.endLine)&&(this==null?void 0:this.options)===(t==null?void 0:t.options)}toDOM(){var t;return this.precomputedDomProvider=(t=this.precomputedDomProvider)!=null?t:this.computeDom(),this.precomputedDomProvider()}destroy(t){t&&(activeDocument.body.contains(t)||nc.delete(t))}computeDom(){let t=R$(this.lineAuthoring,this.startLine,this.endLine),n=t.isZeroCommit?"":this.renderNonZeroCommit(t);return!t.isZeroCommit&&this.options!=="waiting-for-result"?y$(this,n):n=this.adaptTextForFakeCommit(t,n,this.options),this.createHtmlNode(t,n,this.options==="waiting-for-result")}createHtmlNode(t,n,i){var c,u,f,d,h,p;let s=window.createDiv();s.setText(n);let{color:o,daysSinceCommit:a}=bp((c=t==null?void 0:t.author)==null?void 0:c.epochSeconds,t==null?void 0:t.isZeroCommit,this.settings);s.style.backgroundColor=o,s.setAttribute("data-author",(f=(u=t==null?void 0:t.author)==null?void 0:u.name)!=null?f:""),s.setAttribute("data-author-email",(h=(d=t==null?void 0:t.author)==null?void 0:d.email)!=null?h:""),(0,ic.setTooltip)(s,(p=t==null?void 0:t.summary)!=null?p:""),C$(t,i,s);function l(){let m=s.cloneNode(!0);return nc.add(m),i||_$(a),m}return l}renderNonZeroCommit(t){let n=this.settings.showCommitHash?this.renderHash(t):"",i=this.settings.authorDisplay==="hide"?"":`${this.renderAuthorName(t,this.settings.authorDisplay)}`,s=this.settings.dateTimeFormatOptions==="hide"?"":`${this.renderAuthoringDate(t,this.settings.dateTimeFormatOptions,this.settings.dateTimeFormatCustomString,this.settings.dateTimeTimezone)}`;return[n,i,s].filter(a=>a.length>=1).join(" ")}renderHash(t){return t.hash.substring(0,6)}renderAuthorName(t,n){var a,l,c,u;let i=(l=(a=t==null?void 0:t.author)==null?void 0:a.name)!=null?l:"",s=i.split(" ").filter(f=>f.length>=1),o;switch(n){case"initials":o=s.map(f=>f[0].toUpperCase()).join("");break;case"first name":o=(c=s.first())!=null?c:$$;break;case"last name":o=(u=s.last())!=null?u:$$;break;case"full":o=i;break;default:return bo(n)}return(0,P$.isDeepStrictEqual)(t==null?void 0:t.author,t==null?void 0:t.committer)||(o=o+hj),o}renderAuthoringDate(t,n,i,s){var c;if(((c=t==null?void 0:t.author)==null?void 0:c.epochSeconds)===void 0)return"?";let a;switch(n){case"date":a=yh;break;case"datetime":a=Av;break;case"custom":a=i;break;case"natural language":a=u=>{let f=u.diff((0,ic.moment)());return ic.moment.duration(f).humanize(!0)};break;default:return bo(n)}let l=ic.moment.unix(t.author.epochSeconds);switch(s){case"viewer-local":break;case"author-local":l=l.utcOffset(t.author.tz),typeof a=="string"&&(a+=" Z");break;case"utc0000":l=l.utc(),typeof a=="string"&&(a+="[Z]");break;default:return bo(s)}return typeof a=="string"?l.format(a):a(l)}adaptTextForFakeCommit(t,n,i){var l,c,u;let s=(c=(l=mp())==null?void 0:l.text)!=null?c:n,o=i!=="waiting-for-result"&&t.isZeroCommit?fj:mj;n=s.replace(pj,o);let a=(u=Pt.plugin.localStorage.getGutterSpacingFallbackLength())!=null?u:n.length;if(n=PT(n,a,o),i!=="waiting-for-result"&&t.isZeroCommit){let f=Math.min(a,dj);n=IT(n,a-f)}return n}};function ha(r,e,t,n,i,s){let o=$s.create();o.update(JSON.stringify(i)),o.update(`s${e}-e${t}-k${n}-o${s}`);let a=o.hex(),l=gp.get(a);if(l)return l;let c=new Rb(r,e,t,n,i,s);return gp.set(a,c),c}g();var I$=require("obsidian");function Pb(){let r=Pt.plugin.localStorage.getGutterSpacingFallbackLength();return new sc(Array(r).fill("-").join(""))}function Ib(r){let{lineAuthoring:e,ageForInitialRender:t}=gj(r);return ha(e,1,1,"initialGutter"+t,r,"waiting-for-result")}function gj(r){var s;let e=(s=x$())!=null?s:hp(r)*.25,t=(0,I$.moment)().add(-e,"days"),n={name:"",epochSeconds:RT(t),tz:"+0000"},i={hash:"waiting-for-result",author:n,committer:n,isZeroCommit:!1};return{lineAuthoring:{hashPerLine:[void 0,"waiting-for-result"],commits:new Map([["waiting-for-result",i]])},ageForInitialRender:e}}g();function O$(r,e){return ha({hashPerLine:[void 0,"000000"],commits:new Map([["000000",c$]])},1,1,r,e)}var Ob=new sc(""),L$=(0,D$.gutter)({class:"line-author-gutter-container",markers(r){let e=r.state.field(tc,!1);return wj(r,e)},lineMarkerChange(r){let e=dp(r.state.field(tc));return dp(r.startState.field(tc))!==e},renderEmptyElements:!0,initialSpacer:r=>(F$(r),Pb()),updateSpacer:(r,e)=>{var t,n;return F$(e.view),(n=(t=mp())==null?void 0:t.gutter)!=null?n:Pb()}});function wj(r,e){let t=dp(e),n=r.state.doc,i=new Map;for(let u=1;u<=n.lines;u++){let f=n.line(u).from,d=r.lineBlockAt(f).to;i.set(u,[f,d]),t.update([f,d,0])}let s=up.get();t.update("s"+JSON.stringify(s));let o=t.hex(),a=wp.get(o);if(a)return a;let{result:l,allowCache:c}=vj(n,i,s,e);return c&&wp.set(o,l),l}function vj(r,e,t,n){let i=!0,s=r.lines,o=[];function a(f,d,h){return o.push(h.range(f,d))}let l=bj(s,n),c=r.length===0,u=r.iterLines(s,s+1).next().value==="";for(let f=1;f<=s;f++){let[d,h]=e.get(f),p=r.lineAt(h).number;if(c){a(d,h,Ob);continue}if(f===s&&u){a(d,h,Ob);continue}if(n===void 0){a(d,h,Ib(t)),i=!1;continue}let{key:m,la:w}=n;if(w==="untracked"){a(d,h,O$(w,t));continue}let y=w.hashPerLine.length-1,v=l[f],A=l[p];if(A&&A>y&&a(d,h,Ob),v!==void 0&&D0(1,v,y)&&A!==void 0&&D0(1,A,y)){a(d,h,ha(w,v,A,m,t));continue}if(y<1){a(d,h,Ib(t)),i=!1;continue}let C=Math.clamp(v!=null?v:f,1,y),S=Math.clamp(A!=null?A:p,1,y);a(d,h,ha(w,C,S,m+"computing",t,"waiting-for-result"))}return{result:M$.RangeSet.of(o,!0),allowCache:i}}function bj(r,e){if(!(e!=null&&e.lineOffsetsFromUnsavedChanges))return Array.from(new Array(r+1),i=>i);let t=[void 0],n=0;for(let i=1;i<=r;i++){let s=e.lineOffsetsFromUnsavedChanges.get(i);n+=s!=null?s:0,t[i]=s===void 0?i-n:void 0}return t}function F$(r){r.dom.querySelectorAll(".cm-gutters").forEach(t=>{t!=null&&t.style&&(t.style.marginLeft||t.addClass("obsidian-git-line-author-gutters"))})}var _p=class{constructor(e){this.plugin=e;this.lineAuthorings=new Map}async trackChanged(e){try{await this.trackChangedHelper(e)}catch(t){throw console.warn("Git: Error in trackChanged.",t),t}}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(),b$()}async computeLineAuthorInfo(e){let t=this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager,n=await t.submoduleAwareHeadRevisonInContainingDirectory(e),i=await t.hashObject(e),s=m$(n,i,e);if(s!==void 0){if(!this.lineAuthorings.has(s)){let o=await t.blame(e,this.plugin.settings.lineAuthor.followMovement,this.plugin.settings.lineAuthor.ignoreWhitespace);this.lineAuthorings.set(s,o)}this.notifyComputationResultToSubscribers(e,s)}}notifyComputationResultToSubscribers(e,t){Jn.ifFilepathDefinedTransformSubscribers(e,n=>n.forEach(i=>i.notifyLineAuthoring(t,this.lineAuthorings.get(t))))}},B$=N$.Prec.high([tc,L$]);var H$="https://momentjs.com/docs/#/parsing/string-format/",yj="https://publish.obsidian.md/git-doc/Line+Authoring",_j={showInformationalNotifications:"disablePopups",showNoChangesNotifications:"disablePopupsForNoChanges"},xj={differentIntervalCommitAndPush:["commit","push"],autoBackupAfterFileChange:["commit"],setLastSaveToLastCommit:["commit"],autoSaveInterval:["commit"],autoPushInterval:["push"],autoPullInterval:["pull"]},df=r=>Number.isInteger(r)?void 0:"Enter a whole number.",xp=class extends Ve.PluginSettingTab{constructor(t,n){super(t,n);this.plugin=n;this.lineAuthorColorSettings=new Map;this.icon="git-pull-request"}get settings(){return this.plugin.settings}toggle(t,n,i){return{name:t,desc:i,control:{type:"toggle",key:n}}}dropdown(t,n,i,s){return{name:t,desc:s,control:{type:"dropdown",key:n,options:i}}}get commitOrSync(){return this.settings.differentIntervalCommitAndPush?"commit":"commit-and-sync"}renderRepositoryAuthor(t,n){t.addText(i=>{let s=this.plugin.gitManager,o=!1;(async()=>{let a=await s.getConfig(n,"local");if(o||i.setValue(a!=null?a:""),s instanceof Ze){let l=await s.getConfig(n,"global");l&&i.setPlaceholder(`Global: ${l}`)}})().catch(a=>this.plugin.displayError(a)),i.onChange(async a=>{o=!0,await this.plugin.gitActions.setGitConfig(n,a||void 0)})})}resolveControl(t){let n=_j[t],i=n!=null?n:t,s=i.startsWith("hunks.");return{storedKey:i,inverted:n!==void 0,target:s?this.settings.hunks:this.settings,field:s?i.slice(6):i}}getControlValue(t){let{target:n,field:i,inverted:s}=this.resolveControl(t),o=n[i];return s?!o:o}async setControlValue(t,n){var c;let{storedKey:i,target:s,field:o,inverted:a}=this.resolveControl(t);if(i==="basePath"){let u=n;await this.plugin.changeBasePath(u);return}a&&(n=!n),i==="autoCommitMessage"&&n===""&&(n=en[i]),s[o]=n,await this.plugin.saveSettings();let l=xj[i];if(l&&this.plugin.automaticsManager.reload(...l),i==="differentIntervalCommitAndPush"&&this.update(),i.startsWith("hunks."))this.plugin.editorIntegration.refreshSignsSettings();else if(i==="conflictResolutionMode")this.plugin.editorIntegration.refreshConflictSettings();else if(i==="authorInHistoryView"||i==="dateInHistoryView"||i==="commitDateFormat")for(let u of this.app.workspace.getLeavesOfType(tn.type))(c=u.isDeferred)!=null&&c||await u.view.reload();else i==="limitToVault"?await this.plugin.refresh():i==="refreshSourceControlTimer"&&this.plugin.setRefreshDebouncer()}getSettingDefinitions(){let t=()=>this.plugin.gitReady,n=()=>this.plugin.gitManager instanceof Ze,i=()=>this.plugin.gitManager instanceof Ts,s=this.commitOrSync;return[{name:"Git is not ready",desc:"When the repository is ready, automatic routines, commit, sync, and editor settings become available. Check the repository paths and Git configuration under Advanced.",visible:()=>!this.plugin.gitReady,status:"warning"},{type:"page",name:"Automatic",desc:"Scheduled commit, pull, and push routines.",visible:t,items:[this.toggle("Use separate commit and push intervals","differentIntervalCommitAndPush","Enable to use one interval for commits and another for pushes."),{name:`Auto ${s} interval (minutes)`,desc:`${this.settings.differentIntervalCommitAndPush?"Commit":"Commit and sync"} changes every X minutes. Set to 0 to disable.`,control:{type:"number",key:"autoSaveInterval",min:0,step:1,validate:df}},{name:`Auto ${s} after stopping file edits`,desc:`Requires the ${s} interval not to be 0. Waits for file edits to stop before the next auto ${s}.`,control:{type:"toggle",key:"autoBackupAfterFileChange",disabled:()=>this.settings.setLastSaveToLastCommit}},{name:`Start the automatic ${s} timer from the latest commit`,desc:`Sets the last auto ${s} timestamp to the latest commit timestamp, reducing the frequency after manual commits.`,control:{type:"toggle",key:"setLastSaveToLastCommit",disabled:()=>this.settings.autoBackupAfterFileChange}},{name:"Auto push interval (minutes)",desc:"Push commits every X minutes. Set to 0 to disable.",control:{type:"number",key:"autoPushInterval",min:0,step:1,validate:df,disabled:()=>!this.settings.differentIntervalCommitAndPush}},{name:"Auto pull interval (minutes)",desc:"Pull changes every X minutes. Set to 0 to disable.",control:{type:"number",key:"autoPullInterval",min:0,step:1,validate:df}},{name:`Auto ${s} glob mode`,desc:"Exclude leaves matching files unstaged. Include stages only matching files; an empty include list commits staged files only. Configured globs override the vault limit for auto staging.",control:{type:"dropdown",key:"autoCommitGlobMode",options:{exclude:"Exclude matches",include:"Include matches"}}},{name:`Globs for auto ${s}`,desc:"One repository-relative Git glob per line, with / as the separator. For example, scripts/** matches a folder and **/*.tmp matches files anywhere. An empty include list stages no unstaged files.",control:{type:"textarea",key:"autoCommitGlobs",placeholder:`scripts/**
**/*.tmp`}},this.toggle(`Specify custom commit message on auto ${s}`,"customMessageOnAutoBackup","Shows a prompt to specify your message."),{name:`Commit message on auto ${s}`,desc:"Placeholders: {{date}}, {{hostname}}, {{numFiles}}, and {{files}}.",control:{type:"textarea",key:"autoCommitMessage",defaultValue:en.autoCommitMessage,disabled:()=>this.settings.customMessageOnAutoBackup}}]},{type:"page",name:"Commit",desc:"Commit messages and placeholders.",visible:t,items:[this.toggle("Stage all changes when nothing is staged","autoStageOnEmptyIndex","When using Commit with nothing staged, stage and commit all changes. Commit all changes and Commit-and-sync are unaffected."),{name:"Commit message on manual commit",desc:"Placeholders: {{date}}, {{hostname}}, {{numFiles}}, and {{files}}. Leave empty to require manual input.",render:o=>{o.addTextArea(a=>{a.setValue(this.settings.commitMessage),a.onChange(async l=>{this.settings.commitMessage=l,await this.plugin.saveSettings()}),o.addButton(l=>l.setIcon("reset").setTooltip(`Set to default: "${en.commitMessage}"`).onClick(()=>{a.setValue(en.commitMessage),a.onChanged()}))})}},{name:"Commit message script",desc:"Run with 'sh -c' to generate a commit message. Placeholders: {{hostname}}, {{date}}.",visible:()=>Ve.Platform.isDesktopApp,control:{type:"text",key:"commitMessageScript"}},{name:"{{date}} placeholder format",render:o=>{o.addMomentFormat(a=>a.setDefaultFormat(this.settings.commitDateFormat).setValue(this.settings.commitDateFormat).onChange(async l=>{await this.setControlValue("commitDateFormat",l)})),o.descEl.createSpan({text:`Example: ${Cv}. See `}),o.descEl.createEl("a",{text:"Moment.js documentation",href:H$,attr:{target:"_blank"}}),o.descEl.createSpan({text:" for more formats."})}},{name:"{{hostname}} placeholder replacement",desc:"Set a hostname for this device. Defaults to the OS hostname on desktop.",render:o=>{o.addText(a=>{var l;return a.setValue((l=this.plugin.localStorage.getHostname())!=null?l:"").onChange(c=>this.plugin.localStorage.setHostname(c))})}},{name:"Preview commit message",render:o=>{o.addButton(a=>a.setButtonText("Preview").onClick(async()=>{let l=await this.plugin.gitManager.formatCommitMessage(this.settings.commitMessage);new Ve.Notice(l)}))}},this.toggle("List filenames affected by commit in the commit body","listChangedFilesInMessageBody")]},{type:"page",name:"Sync",desc:"Pull, merge, and commit-and-sync behavior.",visible:t,items:[{type:"group",heading:"Pull",items:[{...this.dropdown("Merge strategy","syncMethod",{merge:"Merge",rebase:"Rebase",reset:"Other sync service (update HEAD only)"},"How to integrate remote commits."),visible:n},{...this.dropdown("Auto-stash changes when rebasing","rebaseAutoStash",{enabled:"Enabled",disabled:"Disabled","git-config":"Use Git configuration"},"Stash local changes before rebasing and restore them afterward. Restoring may produce conflicts."),visible:()=>n()&&this.settings.syncMethod==="rebase"},this.dropdown("Merge strategy on conflicts","mergeStrategy",{none:"None (Git default)",ours:"Our changes",theirs:"Their changes"},"Choose which side to favor when pulling remote changes."),this.toggle("Pull on startup","autoPullOnBoot","Automatically pull commits when Obsidian starts.")]},{type:"group",heading:"Commit-and-sync",items:[{name:"Push on commit-and-sync",desc:"Push after committing. Disabling turns commit-and-sync into a local commit, with an optional pull.",render:o=>{o.addToggle(a=>a.setValue(!this.settings.disablePush).onChange(async l=>{this.settings.disablePush=!l,await this.plugin.saveSettings(),this.refreshDomState()}))}},this.toggle("Pull on commit-and-sync","pullBeforePush","Pull commits as part of commit-and-sync."),{...this.toggle("Squash commits before push","squashCommitsBeforePush","Combine local unpushed commits into one before pushing. No force-push is needed."),visible:n}]}]},{type:"page",name:"Editor",desc:"Merge conflict resolution, hunk controls, and line author information.",visible:t,items:[this.dropdown("Show merge conflict resolution","conflictResolutionMode",{both:"Both editing modes","live-preview":"Live Preview only",source:"Source mode only",disabled:"Disabled"},"Choose where conflict highlights and resolution buttons appear."),{type:"group",heading:"Hunk management",visible:n,items:[this.toggle("Signs","hunks.showSigns","Show colored change markers in the editor and stage, reset, or preview hunks."),this.toggle("Hunk commands","hunks.hunkCommands","Commands to stage and reset hunks and navigate between them."),this.dropdown("Show line changes in the status bar","hunks.statusBar",{disabled:"Disabled",colored:"Colored",monochrome:"Monochrome"})]},{type:"page",name:"Line author information",desc:"Commit hash, author, date, and age coloring next to each line.",visible:n,page:()=>new Mb(this)}]},{type:"page",name:"Views",desc:"History, source control, and diff views.",items:[{type:"group",heading:"Source control view",items:[this.toggle("Automatically refresh source control view on file changes","refreshSourceControl","Disable on slower machines if this causes lag."),{name:"Source control view refresh interval",desc:"Milliseconds to wait after a file change before refreshing. Minimum 500.",control:{type:"number",key:"refreshSourceControlTimer",min:500,step:1,validate:df}}]},{type:"group",heading:"Diff view",items:[{...this.dropdown("Diff view style","diffStyle",{split:"Split",git_unified:"Unified"},"Split mode creates an editable diff in the editor, which may differ from Git's diff."),visible:n},{name:"Split diff computation time limit (ms)",desc:"Maximum milliseconds to compute a detailed split diff. Read-only diffs use ten times this value.",visible:n,control:{type:"number",key:"diffTimeout",min:1,step:1,validate:df}}]},{type:"group",heading:"History view",items:[this.dropdown("Show author","authorInHistoryView",{hide:"Hide",full:"Full",initials:"Initials"},"Show the commit author in the history view."),this.toggle("Show date","dateInHistoryView","Uses the {{date}} placeholder format.")]}]},{type:"page",name:"Interface",desc:"Notifications, status bar, and file menu.",items:[this.toggle("Show informational notifications","showInformationalNotifications","Show notices about Git operations. The status bar still shows updates when this is off."),this.toggle("Show error notifications","showErrorNotices","Show error notices for Git operations."),{...this.toggle("Show notifications when nothing changed","showNoChangesNotifications","Also notify when a commit or push finds no changes."),visible:()=>!this.settings.disablePopups},this.toggle("Show status bar","showStatusBar","Restart Obsidian for this change to take effect."),this.toggle("File menu integration","showFileMenu","Add Stage, Unstage, and Add to .gitignore actions to the file menu."),this.toggle("Show branch status bar","showBranchStatusBar","Restart Obsidian for this change to take effect."),this.toggle("Show the count of modified files in the status bar","changedFilesInStatusBar")]},{type:"page",name:"Identity",desc:"Authentication and commit author.",items:[{name:"Username on your Git server",visible:i,render:o=>{o.addText(a=>{var l;return a.setValue((l=this.plugin.localStorage.getUsername())!=null?l:"").onChange(c=>this.plugin.localStorage.setUsername(c))})}},{name:"Git server password or access token",desc:"Select or create a secret stored on this device for this vault.",visible:i,render:o=>{o.addComponent(a=>new Ve.SecretComponent(this.app,a).setValue(this.settings.gitServerPasswordSecret).onChange(async l=>{this.settings.gitServerPasswordSecret=l!=null?l:"",await this.plugin.saveSettings()}))}},{name:"Repository author name",desc:Ve.Platform.isDesktopApp?"Changes only this repository's Git config. Leave blank to use the global author name, if configured.":"Saved in this repository's Git config. Mobile Git has no global author name fallback.",visible:t,render:o=>{this.renderRepositoryAuthor(o,"user.name")}},{name:"Repository author email",desc:Ve.Platform.isDesktopApp?"Changes only this repository's Git config. Leave blank to use the global author email, if configured.":"Saved in this repository's Git config. Mobile Git has no global author email fallback.",visible:t,render:o=>{this.renderRepositoryAuthor(o,"user.email")}}]},{type:"page",name:"Advanced",desc:"Repository paths, Git environment, and device options.",items:[{...this.toggle("Update submodules","updateSubmodules","Commit-and-sync and pull update submodules. Tracking branches must be configured for each submodule."),visible:n},{...this.toggle("Submodule recurse checkout/switch","submoduleRecurseCheckout","Recurse checkout on submodules when switching the root repository."),visible:()=>n()&&this.settings.updateSubmodules},this.toggle("Limit file operations to the vault","limitToVault","Limit status, staging, unstaging, discarding, and submodule updates to the vault where possible. Configured auto commit globs take precedence for automatic staging. Repository history and remote actions remain repository-wide."),{name:"Custom Git binary path",desc:"Path to the Git executable for a custom installation.",visible:n,render:o=>{o.addText(a=>{var l;return a.setPlaceholder("git").setValue((l=this.plugin.localStorage.getGitPath())!=null?l:"").onChange(c=>{this.plugin.changeGitPath(c)})})}},{name:"Additional environment variables",desc:"One KEY=VALUE pair per line.",visible:n,render:o=>{o.addTextArea(a=>a.setPlaceholder("GIT_DIR=/path/to/git/dir").setValue(this.plugin.localStorage.getEnvVars().join(`
`)).onChange(l=>this.plugin.localStorage.setEnvVars(l.split(`
`))))}},{name:"Additional PATH environment variable paths",desc:"One path per line.",visible:n,render:o=>{o.addTextArea(a=>a.setValue(this.plugin.localStorage.getPATHPaths().join(`
`)).onChange(l=>this.plugin.localStorage.setPATHPaths(l.split(`
`))))}},{name:"Reload with new environment variables",desc:"Removing previous variables requires an Obsidian restart.",visible:n,render:o=>{o.addButton(a=>a.setButtonText("Reload").setCta().onClick(async()=>this.plugin.reloadGitManager()))}},{name:"Repository folder within the vault",desc:"Choose the folder containing the Git repository. Leave empty when the repository is at the root.",control:{type:"folder",key:"basePath",includeRoot:!1,validate:o=>{if(o!==""){if(o=="/")return"Leave empty when the repository is at the root.";if(!this.app.vault.getFolderByPath(o))return"Choose an existing folder in this vault."}}}},{name:"Custom Git directory path (instead of .git)",desc:"Resolved from the custom base path or vault root. Restart Obsidian to apply. Use backslashes on Windows.",control:{type:"text",key:"gitDir",placeholder:".git"}},{name:"Disable on this device",desc:"This setting is not synced.",render:o=>{o.addToggle(a=>a.setValue(this.plugin.localStorage.getPluginDisabled()).onChange(l=>{this.plugin.localStorage.setPluginDisabled(l),l?this.plugin.unloadPlugin():this.plugin.init({fromReload:!0}).catch(c=>this.plugin.displayError(c)),new Ve.Notice("Obsidian must be restarted for the change to take effect.")}))}},{type:"group",heading:"Debugging",items:[{name:"Copy debug information",desc:"May contain sensitive settings.",render:o=>{o.addButton(a=>a.setButtonText("Copy").onClick(async()=>{await window.navigator.clipboard.writeText(JSON.stringify({settings:this.settings,pluginVersion:this.plugin.manifest.version},null,4)),new Ve.Notice("Debug information copied to clipboard. May contain sensitive information!")}))}},{name:"Debugging and logging",desc:Ve.Platform.isDesktopApp?`Open the developer console with ${Ve.Platform.isMacOS?"CMD (\u2318) + OPTION (\u2325) + I":"CTRL + SHIFT + I"}.`:"",visible:()=>Ve.Platform.isDesktopApp}]}]},{heading:"Support",type:"group",items:[{name:"Donate",desc:"Support continued development of the plugin.",render:o=>{o.addButton(a=>{var c;let l=(c=a.buttonEl.parentElement)==null?void 0:c.createEl("a",{href:"https://ko-fi.com/F1F195IQ5",attr:{target:"_blank"}});l==null||l.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"}}),a.buttonEl.remove()})}}]}]}configureLineAuthorShowStatus(t){this.settings.lineAuthor.show=t,this.plugin.saveSettings(),t?this.plugin.editorIntegration.activateLineAuthoring():this.plugin.editorIntegration.deactiveLineAuthoring()}async lineAuthorSettingHandler(t,n){this.settings.lineAuthor[t]=n,await this.plugin.saveSettings(),this.plugin.editorIntegration.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let t=this.settings.lineAuthor;t.authorDisplay!=="hide"&&(t.lastShownAuthorDisplay=t.authorDisplay),t.dateTimeFormatOptions!=="hide"&&(t.lastShownDateTimeFormatOptions=t.dateTimeFormatOptions)}renderLineAuthorSettings(t){t.empty(),this.lineAuthorColorSettings.clear();let n=new Ve.Setting(t).setName("Show commit authoring information next to each line");if(this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform()||n.setDesc("Only available on desktop currently.").setDisabled(!0),n.descEl.createEl("a",{href:yj,text:"Feature guide and quick examples",attr:{target:"_blank"}}),n.descEl.createEl("br"),n.descEl.createSpan({text:" The commit hash, author name and authoring date can all be individually toggled."}),n.descEl.createEl("br"),n.descEl.createSpan({text:"Hide everything, to only show the age-colored sidebar."}),n.addToggle(i=>i.setValue(this.settings.lineAuthor.show).onChange(s=>{this.configureLineAuthorShowStatus(s),this.refreshLineAuthorPage(t)})),this.settings.lineAuthor.show){let i=new Ve.Setting(t).setName("Follow movement and copies across files and commits").addDropdown(c=>{c.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),c.setValue(this.settings.lineAuthor.followMovement),c.onChange(u=>this.lineAuthorSettingHandler("followMovement",u))});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 ${_h} 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 Ve.Setting(t).setName("Show commit hash").addToggle(c=>{c.setValue(this.settings.lineAuthor.showCommitHash),c.onChange(u=>this.lineAuthorSettingHandler("showCommitHash",u))}),new Ve.Setting(t).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(c=>{let u={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};c.addOptions(u),c.setValue(this.settings.lineAuthor.authorDisplay),c.onChange(async f=>this.lineAuthorSettingHandler("authorDisplay",f))}),new Ve.Setting(t).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(c=>{let u={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};c.addOptions(u),c.setValue(this.settings.lineAuthor.dateTimeFormatOptions),c.onChange(async f=>{await this.lineAuthorSettingHandler("dateTimeFormatOptions",f),this.refreshLineAuthorPage(t)})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let c=new Ve.Setting(t);c.setName("Custom authoring date format").addText(u=>{u.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),u.setPlaceholder("YYYY-MM-DD HH:mm"),u.onChange(async f=>{await this.lineAuthorSettingHandler("dateTimeFormatCustomString",f),this.setCustomDateTimeDescription(c.descEl,f)})}),this.setCustomDateTimeDescription(c.descEl,this.settings.lineAuthor.dateTimeFormatCustomString)}let s=new Ve.Setting(t).setName("Authoring date display timezone").addDropdown(c=>{let u={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};c.addOptions(u),c.setValue(this.settings.lineAuthor.dateTimeTimezone),c.onChange(async f=>this.lineAuthorSettingHandler("dateTimeTimezone",f))});s.descEl.empty(),s.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
`}),s.descEl.createEl("a",{text:"UTC\xB100:00",href:"https://en.wikipedia.org/wiki/UTC%C2%B100:00"}),s.descEl.createSpan({text:"."});let o=new Ve.Setting(t).setName("Oldest age in coloring");this.setOldestAgeDescription(o.descEl,this.settings.lineAuthor.coloringMaxAge),o.addText(c=>{c.setPlaceholder("1y"),c.setValue(this.settings.lineAuthor.coloringMaxAge),c.onChange(async u=>{let d=ff(u)!==void 0;this.setOldestAgeDescription(o.descEl,u),d&&(await this.lineAuthorSettingHandler("coloringMaxAge",u),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest",t),this.createColorSetting("oldest",t);let a=new Ve.Setting(t).setName("Text color").addText(c=>{c.setValue(this.settings.lineAuthor.textColorCss),c.onChange(async u=>{await this.lineAuthorSettingHandler("textColorCss",u)})});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 l=new Ve.Setting(t).setName("Ignore whitespace and newlines in changes").addToggle(c=>{c.setValue(this.settings.lineAuthor.ignoreWhitespace),c.onChange(u=>this.lineAuthorSettingHandler("ignoreWhitespace",u))});l.descEl.empty(),l.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."}),l.descEl.createEl("br"),l.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(t,n){let i=new Ve.Setting(n).setName("").addText(s=>{let o=Fb(t,this.settings.lineAuthor),a=Fb(t,en.lineAuthor);s.setPlaceholder(M0(a)),s.setValue(M0(o)),s.onChange(async l=>{let c=TT(l);if(c!==void 0){let u=t==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(u,c)}this.refreshColorSettingsDesc(t,c)})});this.lineAuthorColorSettings.set(t,i),this.refreshColorSettingsName(t),this.refreshColorSettingsDesc(t,Fb(t,this.settings.lineAuthor))}refreshColorSettingsName(t){let n=this.lineAuthorColorSettings.get(t);if(n){let i=t==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";n.nameEl.setText(`Color for ${i} commits`)}}refreshColorSettingsDesc(t,n){let i=this.lineAuthorColorSettings.get(t);i&&this.colorSettingPreviewDesc(i.descEl,t,this.settings.lineAuthor,n!==void 0)}colorSettingPreviewDesc(t,n,i,s){t.empty(),t.createSpan({text:"Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and named colors (e.g. 'black', 'purple'). Color preview: "});let o=s?yp(n,i):"rgba(127,127,127,0.3)",a=Ve.moment.unix(Ve.moment.now()/1e3).format("YYYY-MM-DD"),l=s?`abcdef Author Name ${a}`:"invalid color";t.createDiv({text:l,cls:"line-author-settings-preview",attr:{style:`background-color: ${o}; width: 30ch;`}})}setCustomDateTimeDescription(t,n){t.empty(),t.createEl("a",{text:"Format string",href:H$}),t.createSpan({text:" to display the authoring date."}),t.createEl("br");let i=(0,Ve.moment)().format(n);t.createSpan({text:`Currently: ${i}`})}setOldestAgeDescription(t,n){let i=ff(n),s=i!==void 0?`${i.asDays()} days`:"invalid!";t.empty(),t.createSpan({text:`The oldest age in the line author coloring. Everything older will have the same color.
Smallest valid age is "1d". Currently: ${s}`})}refreshLineAuthorPage(t){window.clearTimeout(this.lineAuthorRefreshTimer),this.lineAuthorRefreshTimer=window.setTimeout(()=>{this.lineAuthorRefreshTimer=void 0,t.isConnected&&this.renderLineAuthorSettings(t)},80)}cancelLineAuthorRefresh(){window.clearTimeout(this.lineAuthorRefreshTimer),this.lineAuthorRefreshTimer=void 0,this.lineAuthorColorSettings.clear()}},Mb=class extends Ve.SettingPage{constructor(t){super();this.tab=t;this.title="Line author information"}display(){this.tab.renderLineAuthorSettings(this.containerEl)}hide(){this.tab.cancelLineAuthorRefresh(),super.hide()}};function Fb(r,e){return r==="oldest"?e.colorOld:e.colorNew}function ff(r){let e=Ve.moment.duration("P"+r.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}g();var Lr=require("obsidian");var Ep=class{constructor(e,t){this.statusBarEl=e;this.plugin=t;this.messages=[];this.currentMessage=null;this.lastMessageTimestamp=null;this.base="obsidian-git-statusbar-";this.statusBarEl.setAttribute("data-tooltip-position","top"),t.registerEvent(t.app.workspace.on("obsidian-git:refreshed",()=>{this.refreshCommitTimestamp().catch(console.error)}))}displayMessage(e,t){this.messages.push({message:`Git: ${e.slice(0,100)}`,timeout:t}),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({cls:this.base+"conflict-indicator"}),this.conflictEl.setAttribute("data-tooltip-position","top"),this.conflictEl.setAttribute("role","button"),this.conflictEl.onclick=()=>this.plugin.openMergeConflictHelp(),this.conflictEl.onkeydown=e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),this.plugin.openMergeConflictHelp())},this.pausedEl=this.statusBarEl.createDiv({cls:this.base+"paused-indicator"}),this.pausedEl.setAttribute("data-tooltip-position","top"),this.iconEl=this.statusBarEl.createDiv({cls:this.base+"icon"}),this.textEl=this.statusBarEl.createDiv({cls:this.base+"text"})),this.plugin.state.mergeInProgress?((0,Lr.setIcon)(this.conflictEl,"git-merge"),this.conflictEl.ariaLabel="Merge in progress. Select for help resolving and finishing the merge.",this.conflictEl.tabIndex=0,this.conflictEl.addClass(this.base+"conflict")):(this.conflictEl.empty(),this.conflictEl.tabIndex=-1,this.conflictEl.removeClass(this.base+"conflict")),this.plugin.localStorage.getPausedAutomatics()?((0,Lr.setIcon)(this.pausedEl,"pause-circle"),this.pausedEl.ariaLabel="Automatic routines are currently paused.",this.pausedEl.addClass(this.base+"paused")):(this.pausedEl.empty(),this.pausedEl.removeClass(this.base+"paused")),this.progress){this.statusBarEl.ariaLabel=this.getProgressTooltip("Git operation in progress..."),(0,Lr.setIcon)(this.iconEl,this.getProgressIcon()),this.displayProgressText(),this.statusBarEl.addClass(this.base+"progress"),this.addMergeHelpToTooltip();return}switch(this.plugin.state.operation){case 0:this.displayFromNow();break;case 2:this.statusBarEl.ariaLabel="Committing changes...",(0,Lr.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,Lr.setIcon)(this.iconEl,"upload"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"push");break;case 1:this.statusBarEl.ariaLabel=this.getProgressTooltip("Pulling changes..."),(0,Lr.setIcon)(this.iconEl,"download"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"pull");break;case 4:this.statusBarEl.ariaLabel=this.getProgressTooltip("Fetching from remote..."),(0,Lr.setIcon)(this.iconEl,"download"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"fetch");break;case 5:this.statusBarEl.ariaLabel=this.getProgressTooltip("Checking out branch..."),(0,Lr.setIcon)(this.iconEl,"git-branch"),this.displayProgressText(),this.statusBarEl.addClass(this.base+"checkout");break;default:this.statusBarEl.ariaLabel="Failed on initialization!",(0,Lr.setIcon)(this.iconEl,"alert-triangle"),this.textEl.empty(),this.statusBarEl.addClass(this.base+"failed-init");break}this.addMergeHelpToTooltip()}addMergeHelpToTooltip(){if(!this.plugin.state.mergeInProgress)return;let e="Merge in progress. Select the merge icon for help resolving and finishing it.",t=this.statusBarEl.ariaLabel;this.statusBarEl.ariaLabel=t?`${e}
${t}`:e}displayProgressText(){this.progress?this.textEl.setText(this.getCompactProgressText()):this.textEl.empty()}getProgressTooltip(e){if(!this.progress)return e;let t=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 n=this.progress.processed!==void 0&&this.progress.total!==void 0?` (${this.progress.processed}/${this.progress.total})`:"";return`${this.progress.action}: ${t}${Math.round(this.progress.progress)}%${n}`}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 n;if(!this.plugin.gitReady){this.statusBarEl.ariaLabel="Git is not ready",(0,Lr.setIcon)(this.iconEl,"alert-triangle"),this.textEl.empty(),this.statusBarEl.addClass(this.base+"failed-init");return}let e=this.lastCommitTimestamp,t=this.plugin.state.offlineMode;if(e){let i=(0,Lr.moment)(e).fromNow();this.statusBarEl.ariaLabel=`${t?"Offline: ":""}Last Commit: ${i}`,((n=this.unPushedCommits)!=null?n:0)>0&&(this.statusBarEl.ariaLabel+=`
(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=t?"Git is offline":"Git is ready";t?(0,Lr.setIcon)(this.iconEl,"globe"):(0,Lr.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.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};g();var G$=require("obsidian"),hf=class{constructor(e){this.plugin=e}saveLastAuto(e,t){t==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):t==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):t==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,t,n;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((t=this.plugin.localStorage.getLastAutoPull())!=null?t:""),push:new Date((n=this.plugin.localStorage.getLastAutoPush())!=null?n:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let t=this.diff(this.plugin.settings.autoPushInterval,e.push);this.startAutoPush(t)}if(this.plugin.settings.autoPullInterval>0){let t=this.diff(this.plugin.settings.autoPullInterval,e.pull);this.startAutoPull(t)}}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 t=this.diff(this.plugin.settings.autoSaveInterval,e.backup);this.startAutoCommitAndSync(t)}}}get isAutomaticsDisabled(){return!this.plugin.gitReady||this.plugin.localStorage.getPausedAutomatics()}startAutoCommitAndSync(e){var t,n;if(!this.isAutomaticsDisabled)if(this.plugin.settings.autoBackupAfterFileChange)e===0?this.doAutoCommitAndSync():(n=(t=this.plugin).autoCommitDebouncer)!=null||(t.autoCommitDebouncer=(0,G$.debounce)(()=>this.doAutoCommitAndSync(),this.plugin.settings.autoSaveInterval*6e4,!0));else{let i=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;i>2147483647&&(i=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),i)}}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(async()=>{if(this.plugin.settings.setLastSaveToLastCommit){let e=await this.plugin.gitManager.getLastCommitTime();if(e){this.saveLastAuto(e,"backup");let t=this.diff(this.plugin.settings.autoSaveInterval,e);if(t>0)return this.startAutoCommitAndSync(t),!1}}return this.plugin.settings.differentIntervalCommitAndPush?await this.plugin.gitActions.commit({fromAuto:!0,mode:"all"}):await this.plugin.gitActions.commitAndSync({fromAutoBackup:!0,mode:"all"}),!0},e=>{e!==!1&&(this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync())})}startAutoPull(e){if(this.isAutomaticsDisabled)return;let t=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;t>2147483647&&(t=2147483647),this.timeoutIDPull=window.setTimeout(()=>this.doAutoPull(),t)}doAutoPull(){this.plugin.promiseQueue.addTask(()=>this.plugin.gitActions.pullChangesFromRemote(),()=>{this.saveLastAuto(new Date,"pull"),this.startAutoPull()})}startAutoPush(e){if(this.isAutomaticsDisabled)return;let t=(e!=null?e:this.plugin.settings.autoPushInterval)*6e4;t>2147483647&&(t=2147483647),this.timeoutIDPush=window.setTimeout(()=>this.doAutoPush(),t)}doAutoPush(){this.plugin.promiseQueue.addTask(()=>this.plugin.gitActions.push(),()=>{this.saveLastAuto(new Date,"push"),this.startAutoPush()})}clearAutoCommitAndSync(){var t;let e=!1;return this.timeoutIDCommitAndSync&&(window.clearTimeout(this.timeoutIDCommitAndSync),this.timeoutIDCommitAndSync=void 0,e=!0),this.plugin.autoCommitDebouncer&&((t=this.plugin.autoCommitDebouncer)==null||t.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,t){if(isNaN(t.getTime()))return e;let i=e-Math.round((new Date().getTime()-t.getTime())/1e3/60);return Math.max(0,i)}};g();var Af=require("obsidian");g();var pf=require("obsidian");async function U$(r,e,t){let n=await z$(e,t);if(n.result==="failure"){new pf.Notice(n.reason);return}let{isGitHub:i,branch:s,repo:o,user:a,filePath:l}=n;if(i){let c=r.getCursor("from").line+1,u=r.getCursor("to").line+1;c===u?window.open(`https://github.com/${a}/${o}/blob/${s}/${l}?plain=1#L${c}`):window.open(`https://github.com/${a}/${o}/blob/${s}/${l}?plain=1#L${c}-L${u}`)}else new pf.Notice("It seems like you are not using GitHub")}async function j$(r,e){let t=await z$(r,e);if(t.result==="failure"){new pf.Notice(t.reason);return}let{isGitHub:n,branch:i,repo:s,user:o,filePath:a}=t;n?window.open(`https://github.com/${o}/${s}/commits/${i}/${a}`):new pf.Notice("It seems like you are not using GitHub")}async function z$(r,e){var l,c;let t=await e.branchInfo(),n=t.tracking,i=t.current,s,o=e.getRelativeRepoPath(r.path);if(e instanceof Ze){let u=await e.getSubmoduleOfFile(e.getRelativeRepoPath(r.path));if(u){o=u.relativeFilepath;let f=await e.git.cwd({path:u.submodule,root:!1}).status();if(n=f.tracking||void 0,i=f.current||void 0,n){let d=n.substring(0,n.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(n==null)return{result:"failure",reason:"Remote branch is not configured"};if(i==null)return{result:"failure",reason:"Failed to get current branch name"};if(s==null){let u=n.substring(0,n.indexOf("/"));if(s=await e.getConfig(`remote.${u}.url`),s==null)return{result:"failure",reason:"Failed to get remote url"}}let a=s.match(/(?:^https:\/\/github\.com\/(.+)\/(.+?)(?:\.git)?$)|(?:^[a-zA-Z]+@github\.com:(.+)\/(.+?)(?:\.git)?$)/);if(a==null)return{result:"failure",reason:"Could not parse remote url"};{let[u,f,d,h,p]=a;return{result:"success",isGitHub:!!u,repo:(l=d!=null?d:p)!=null?l:"",user:(c=f!=null?f:h)!=null?c:"",branch:i,filePath:o}}}g();var V$=require("obsidian"),Sp=class extends V$.Modal{constructor(t,n){super(t);this.content=n;this.resolve=null}openAndGetReslt(){return new Promise(t=>{this.resolve=t,this.open()})}onOpen(){let{contentEl:t,titleEl:n}=this;n.setText("Edit .gitignore");let i=t.createDiv(),s=i.createEl("textarea",{text:this.content,cls:["obsidian-git-textarea"],attr:{rows:10,cols:30,wrap:"off"}});i.createEl("button",{cls:["mod-cta","obsidian-git-center-button"],text:"Save"}).addEventListener("click",()=>{this.resolve(s.value),this.close()})}onClose(){let{contentEl:t}=this;t.empty(),this.resolve&&this.resolve(void 0)}};g();var kf=require("@codemirror/state"),zp=require("@codemirror/view");g();var lc=require("@codemirror/state");g();var cr=class r{static createHunk(e,t,n,i){return{removed:{start:e,count:t,lines:[]},added:{start:n,count:i,lines:[]},vend:n+Math.max(i-1,0),type:i===0?"delete":t===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,t,n){let i=t,s=n-t+1,o=0;for(let a of e){let l=a.added.count-a.removed.count,c=0;if(a.added.start>=t&&a.vend<=n)c=l;else{let u=Math.max(0,n+1-(a.added.start+a.removed.count)),f=Math.max(0,t-(a.added.start+a.removed.count));a.added.start>=t&&a.added.start<=n?c=u:a.vend>=t&&a.vend<=n?(c=l-f,i=i-f):a.added.start<=t&&a.vend>=n?(c=u-f,i=i-f):o++,t>a.vend&&(i=i-l)}s=s-c}if(o!==e.length)return s===0&&(i=i-1),this.createHunk(i,s,t,n-t+1)}static patchLines(e,t=!1){let n=[];for(let i of e.removed.lines)n.push("-"+i);for(let i of e.added.lines)n.push("+"+i);return t?n.map(i=>i.replace(/\r$/,"")):n}static parseDiffLine(e){var l,c,u;let n=(l=e.split("@@")[1])==null?void 0:l.trim();if(!n)throw Error(`Invalid diff line: ${e}`);let i=n.split(" "),s=(c=i[0])==null?void 0:c.substring(1).split(","),o=(u=i[1])==null?void 0:u.substring(1).split(",");if(!s||!o||s[0]===void 0||o[0]===void 0)throw Error(`Invalid diff hunk range: ${e}`);return this.createHunk(parseInt(s[0]),parseInt(s[1]||"1"),parseInt(o[0]),parseInt(o[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,t,n,i=1,s=1/0,o){if(o&&t.type!=="add")return console.error(`Invalid hunk with untracked=${o} hunk="${r.getHunkHeader(t)}"`),[];i=Math.max(1,i);let{start:a,added:l,removed:c}={start:t.added.start,added:t.added.count,removed:t.removed.count},u=this.changeEnd(t),f=t.type==="delete"&&(a===0||e&&this.changeEnd(e)===a)&&(!n||n.added.start!==a+1);f&&i===1&&(i=0);let d=[];for(let h=Math.max(a,i);h<=Math.min(u,s);h++){let p=t.type==="change"&&(c>l&&h===u||e&&e.added.start===0);d.push({type:f?"topdelete":p?"changedelete":o?"untracked":t.type,count:h===a?t.type==="add"?l:c:void 0,lnum:h+(f?1:0)})}if(t.type==="change"&&l>c&&t.vend>=i&&u<=s)for(let h=Math.max(u,i);h<=Math.min(t.vend,s);h++)d.push({type:"add",count:h===t.vend?l-c:void 0,lnum:h});return d}static createPatch(e,t,n,i=!1){let s=[`diff --git a/${e} b/${e}`,`index 000000..000000 ${n}`,`--- a/${e}`,`+++ b/${e}`],o=0;t=structuredClone(t);for(let a of t){let l=a.removed.start,c=a.removed.count,u=a.added.count;a.type==="add"&&(l=l+1);let f=a.removed.lines,d=a.added.lines;i&&([c,u]=[u,c],[f,d]=[d,f]),s.push(`@@ -${l},${c} +${l+o},${u} @@`);for(let h of f)s.push("-"+h);(i?a.added:a.removed).no_nl_at_eof&&s.push("\\ No newline at end of file");for(let h of d)s.push("+"+h);(i?a.removed:a.added).no_nl_at_eof&&s.push("\\ No newline at end of file"),a.removed.start=l+o,o=o+(u-c)}return s}static getSummary(e){let t={added:0,changed:0,removed:0};for(let n of e)if(n.type==="add")t.added+=n.added.count;else if(n.type==="delete")t.removed+=n.removed.count;else if(n.type==="change"){let i=n.added.count,s=n.removed.count,o=Math.min(i,s);t.changed+=o,t.added+=i-o,t.removed+=s-o}return t}static findHunk(e,t){if(!t)return[void 0,void 0];for(let n=0;n<t.length;n++){let i=t[n];if(e===1&&i.added.start===0&&i.vend===0)return[i,n];if(i.added.start<=e&&i.vend>=e)return[i,n]}return[void 0,void 0]}static findNearestHunk(e,t,n,i){if(t.length!==0){if(n==="first")return 0;if(n==="last")return t.length-1;if(n==="next"){if(t[0].added.start>e)return 0;for(let s=t.length-1;s>=0;s--)if(t[s].added.start<=e){if(s+1<t.length&&t[s+1].added.start>e)return s+1;if(i)return 0}}else if(n==="prev"){if(Math.max(t[t.length-1].vend)<e)return t.length-1;for(let s=0;s<t.length;s++){let o=t[s];if(e<=Math.max(o.vend,1)){if(s>0&&Math.max(t[s-1].vend,1)<e)return s-1;if(i)return t.length-1}}}}}static compare(e,t){if(e.added.start!==t.added.start||e.added.count!==t.added.count)return!1;for(let n=0;n<e.added.count;n++)if(e.added.lines[n]!==t.added.lines[n])return!1;return!0}static filterCommon(e,t){if(!e&&!t)return;e=e||[],t=t||[];let n=0,i=0,s=[];for(let o=0;o<Math.max(e.length,t.length)+1;o++){let a=e[n],l=t[i];if(!a)break;if(!l){for(let c=n;c<e.length;c++)s.push(e[c]);break}a.added.start>l.added.start?i++:a.added.start<l.added.start?(s.push(a),n++):(this.compare(a,l)||s.push(a),n++,i++)}return s}};g();g();var Je=require("@codemirror/view"),We=require("@codemirror/state");g();var W$=typeof Symbol=="undefined"?"__\u037C":Symbol.for("\u037C"),Db=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),q$=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{},kp=class{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,c){let u=[],f=/^@(\w+)\b/.exec(o[0]),d=f&&f[1]=="keyframes";if(f&&a==null)return l.push(o[0]+";");for(let h in a){let p=a[h];if(/&/.test(h))s(h.split(/,\s*/).map(m=>o.map(w=>m.replace(/&/,w))).reduce((m,w)=>m.concat(w)),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(i(h),p,u,d)}else p!=null&&u.push(h.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(u.length||d)&&l.push((n&&!f&&!c?o.map(n):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let e=q$[W$]||1;return q$[W$]=e+1,"\u037C"+e.toString(36)}static mount(e,t,n){let i=e[Db],s=n&&n.nonce;i?s&&i.setNonce(s):i=new Lb(e,s),i.mount(Array.isArray(t)?t:[t],e)}},Y$=new Map,Lb=class{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=Y$.get(n);if(s)return e[Db]=s;this.sheet=new i.CSSStyleSheet,Y$.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Db]=this}mount(e,t){let n=this.sheet,i=0,s=0,o=!1;for(let a=0;a<e.length;a++){let l=e[a],c=this.modules.indexOf(l);if(c<s&&c>-1&&(this.modules.splice(c,1),o=!0,s--,c=-1),c==-1){if(this.modules.splice(s++,0,l),o=!0,n)for(let u=0;u<l.rules.length;u++)n.insertRule(l.rules[u],i++)}else{for(;s<c;)i+=this.modules[s++].rules.length;i+=l.rules.length,s++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{if(o){let l="";for(let c=0;c<this.modules.length;c++)l+=this.modules[c].getRules()+`
`;this.styleTag.textContent=l}let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var dP=require("@codemirror/language"),Ej=require("@lezer/highlight"),Ut=class r{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}offset(e,t=e){return new r(this.fromA+e,this.toA+e,this.fromB+t,this.toB+t)}};function ma(r,e,t,n,i,s){if(r==n)return[];let o=Vb(r,e,t,n,i,s),a=Wb(r,e+o,t,n,i+o,s);e+=o,t-=a,i+=o,s-=a;let l=t-e,c=s-i;if(!l||!c)return[new Ut(e,t,i,s)];if(l>c){let f=r.slice(e,t).indexOf(n.slice(i,s));if(f>-1)return[new Ut(e,e+f,i,i),new Ut(e+f+c,t,s,s)]}else if(c>l){let f=n.slice(i,s).indexOf(r.slice(e,t));if(f>-1)return[new Ut(e,e,i,i+f),new Ut(t,t,i+f+l,s)]}if(l==1||c==1)return[new Ut(e,t,i,s)];let u=pP(r,e,t,n,i,s);if(u){let[f,d,h]=u;return ma(r,e,f,n,i,d).concat(ma(r,f+h,t,n,d+h,s))}return Sj(r,e,t,n,i,s)}var mf=1e9,gf=0,zb=!1;function Sj(r,e,t,n,i,s){let o=t-e,a=s-i;if(mf<1e9&&Math.min(o,a)>mf*16||gf>0&&Date.now()>gf)return Math.min(o,a)>mf*64?[new Ut(e,t,i,s)]:K$(r,e,t,n,i,s);let l=Math.ceil((o+a)/2);Nb.reset(l),Bb.reset(l);let c=(h,p)=>r.charCodeAt(e+h)==n.charCodeAt(i+p),u=(h,p)=>r.charCodeAt(t-h-1)==n.charCodeAt(s-p-1),f=(o-a)%2!=0?Bb:null,d=f?null:Nb;for(let h=0;h<l;h++){if(h>mf||gf>0&&!(h&63)&&Date.now()>gf)return K$(r,e,t,n,i,s);let p=Nb.advance(h,o,a,l,f,!1,c)||Bb.advance(h,o,a,l,d,!0,u);if(p)return kj(r,e,t,e+p[0],n,i,s,i+p[1])}return[new Ut(e,t,i,s)]}var $p=class{constructor(){this.vec=[]}reset(e){this.len=e<<1;for(let t=0;t<this.len;t++)this.vec[t]=-1;this.vec[e+1]=0,this.start=this.end=0}advance(e,t,n,i,s,o,a){for(let l=-e+this.start;l<=e-this.end;l+=2){let c=i+l,u=l==-e||l!=e&&this.vec[c-1]<this.vec[c+1]?this.vec[c+1]:this.vec[c-1]+1,f=u-l;for(;u<t&&f<n&&a(u,f);)u++,f++;if(this.vec[c]=u,u>t)this.end+=2;else if(f>n)this.start+=2;else if(s){let d=i+(t-n)-l;if(d>=0&&d<this.len&&s.vec[d]!=-1)if(o){let h=s.vec[d];if(h>=t-u)return[h,i+h-d]}else{let h=t-s.vec[d];if(u>=h)return[u,f]}}}return null}},Nb=new $p,Bb=new $p;function kj(r,e,t,n,i,s,o,a){let l=!1;return!ac(r,n)&&++n==t&&(l=!0),!ac(i,a)&&++a==o&&(l=!0),l?[new Ut(e,t,s,o)]:ma(r,e,n,i,s,a).concat(ma(r,n,t,i,a,o))}function hP(r,e){let t=1,n=Math.min(r,e);for(;t<n;)t=t<<1;return t}function Vb(r,e,t,n,i,s){if(e==t||e==s||r.charCodeAt(e)!=n.charCodeAt(i))return 0;let o=hP(t-e,s-i);for(let a=e,l=i;;){let c=a+o,u=l+o;if(c>t||u>s||r.slice(a,c)!=n.slice(l,u)){if(o==1)return a-e-(ac(r,a)?0:1);o=o>>1}else{if(c==t||u==s)return c-e;a=c,l=u}}}function Wb(r,e,t,n,i,s){if(e==t||i==s||r.charCodeAt(t-1)!=n.charCodeAt(s-1))return 0;let o=hP(t-e,s-i);for(let a=t,l=s;;){let c=a-o,u=l-o;if(c<e||u<i||r.slice(c,a)!=n.slice(u,l)){if(o==1)return t-a-(ac(r,a)?0:1);o=o>>1}else{if(c==e||u==i)return t-c;a=c,l=u}}}function Hb(r,e,t,n,i,s,o,a){let l=n.slice(i,s),c=null;for(;;){if(c||o<a)return c;for(let u=e+o;;){ac(r,u)||u++;let f=u+o;if(ac(r,f)||(f+=f==u+1?1:-1),f>=t)break;let d=r.slice(u,f),h=-1;for(;(h=l.indexOf(d,h+1))!=-1;){let p=Vb(r,f,t,n,i+h+d.length,s),m=Wb(r,e,u,n,i,i+h),w=d.length+p+m;(!c||c[2]<w)&&(c=[u-m,i+h-m,w])}u=f}if(a<0)return c;o=o>>1}}function pP(r,e,t,n,i,s){let o=t-e,a=s-i;if(o<a){let l=pP(n,i,s,r,e,t);return l&&[l[1],l[0],l[2]]}return o<4||a*2<o?null:Hb(r,e,t,n,i,s,Math.floor(o/4),-1)}function K$(r,e,t,n,i,s){zb=!0;let o=t-e,a=s-i,l;if(o<a){let d=Hb(n,i,s,r,e,t,Math.floor(o/6),50);l=d&&[d[1],d[0],d[2]]}else l=Hb(r,e,t,n,i,s,Math.floor(a/6),50);if(!l)return[new Ut(e,t,i,s)];let[c,u,f]=l;return ma(r,e,c,n,i,u).concat(ma(r,c+f,t,n,u+f,s))}function mP(r,e){for(let t=1;t<r.length;t++){let n=r[t-1],i=r[t];n.toA>i.fromA-e&&n.toB>i.fromB-e&&(r[t-1]=new Ut(n.fromA,i.toA,n.fromB,i.toB),r.splice(t--,1))}}function Aj(r,e,t){for(;;){mP(t,1);let n=!1;for(let i=0;i<t.length;i++){let s=t[i],o,a;(o=Vb(r,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=t[i]=new Ut(s.fromA+o,s.toA,s.fromB+o,s.toB)),(a=Wb(r,s.fromA,s.toA,e,s.fromB,s.toB))&&(s=t[i]=new Ut(s.fromA,s.toA-a,s.fromB,s.toB-a));let l=s.toA-s.fromA,c=s.toB-s.fromB;if(l&&c)continue;let u=s.fromA-(i?t[i-1].toA:0),f=(i<t.length-1?t[i+1].fromA:r.length)-s.toA;if(!u||!f)continue;let d=l?r.slice(s.fromA,s.toA):e.slice(s.fromB,s.toB);u<=d.length&&r.slice(s.fromA-u,s.fromA)==d.slice(d.length-u)?(t[i]=new Ut(s.fromA-u,s.toA-u,s.fromB-u,s.toB-u),n=!0):f<=d.length&&r.slice(s.toA,s.toA+f)==d.slice(0,f)&&(t[i]=new Ut(s.fromA+f,s.toA+f,s.fromB+f,s.toB+f),n=!0)}if(!n)break}return t}function Cj(r,e,t){for(let n=0,i=0;i<r.length;i++){let s=r[i],o=s.toA-s.fromA,a=s.toB-s.fromB;if(o&&a||o>3||a>3){let l=i==r.length-1?e.length:r[i+1].fromA,c=s.fromA-n,u=l-s.toA,f=X$(e,s.fromA,c),d=Z$(e,s.toA,u),h=s.fromA-f,p=d-s.toA;if((!o||!a)&&h&&p){let m=Math.max(o,a),[w,y,v]=o?[e,s.fromA,s.toA]:[t,s.fromB,s.toB];m>h&&e.slice(f,s.fromA)==w.slice(v-h,v)?(s=r[i]=new Ut(f,f+o,s.fromB-h,s.toB-h),f=s.fromA,d=Z$(e,s.toA,l-s.toA)):m>p&&e.slice(s.toA,d)==w.slice(y,y+p)&&(s=r[i]=new Ut(d-o,d,s.fromB+p,s.toB+p),d=s.toA,f=X$(e,s.fromA,s.fromA-n)),h=s.fromA-f,p=d-s.toA}if(h||p)s=r[i]=new Ut(s.fromA-h,s.toA+p,s.fromB-h,s.toB+p);else if(o){if(!a){let m=J$(e,s.fromA,s.toA),w,y=m<0?-1:Q$(e,s.toA,s.fromA);m>-1&&(w=m-s.fromA)<=u&&e.slice(s.fromA,m)==e.slice(s.toA,s.toA+w)?s=r[i]=s.offset(w):y>-1&&(w=s.toA-y)<=c&&e.slice(s.fromA-w,s.fromA)==e.slice(y,s.toA)&&(s=r[i]=s.offset(-w))}}else{let m=J$(t,s.fromB,s.toB),w,y=m<0?-1:Q$(t,s.toB,s.fromB);m>-1&&(w=m-s.fromB)<=u&&t.slice(s.fromB,m)==t.slice(s.toB,s.toB+w)?s=r[i]=s.offset(w):y>-1&&(w=s.toB-y)<=c&&t.slice(s.fromB-w,s.fromB)==t.slice(y,s.toB)&&(s=r[i]=s.offset(-w))}}n=s.toA}return mP(r,3),r}var pa;try{pa=new RegExp("[\\p{Alphabetic}\\p{Number}]","u")}catch(r){}function gP(r){return r>48&&r<58||r>64&&r<91||r>96&&r<123}function wP(r,e){if(e==r.length)return 0;let t=r.charCodeAt(e);return t<192?gP(t)?1:0:pa?!yP(t)||e==r.length-1?pa.test(String.fromCharCode(t))?1:0:pa.test(r.slice(e,e+2))?2:0:0}function vP(r,e){if(!e)return 0;let t=r.charCodeAt(e-1);return t<192?gP(t)?1:0:pa?!_P(t)||e==1?pa.test(String.fromCharCode(t))?1:0:pa.test(r.slice(e-2,e))?2:0:0}var bP=8;function Z$(r,e,t){if(e==r.length||!vP(r,e))return e;for(let n=e,i=e+t,s=0;s<bP;s++){let o=wP(r,n);if(!o||n+o>i)return n;n+=o}return e}function X$(r,e,t){if(!e||!wP(r,e))return e;for(let n=e,i=e-t,s=0;s<bP;s++){let o=vP(r,n);if(!o||n-o<i)return n;n-=o}return e}function Q$(r,e,t){for(;e!=t;e--)if(r.charCodeAt(e-1)==10)return e;return-1}function J$(r,e,t){for(;e!=t;e++)if(r.charCodeAt(e)==10)return e;return-1}var yP=r=>r>=55296&&r<=56319,_P=r=>r>=56320&&r<=57343;function ac(r,e){return!e||e==r.length||!yP(r.charCodeAt(e-1))||!_P(r.charCodeAt(e))}function Tj(r,e,t){var n;let i=t==null?void 0:t.override;return i?i(r,e):(mf=((n=t==null?void 0:t.scanLimit)!==null&&n!==void 0?n:1e9)>>1,gf=t!=null&&t.timeout?Date.now()+t.timeout:0,zb=!1,Aj(r,e,ma(r,0,r.length,e,0,e.length)))}function xP(){return!zb}function EP(r,e,t){return Cj(Tj(r,e,t),r,e)}var ei=We.Facet.define({combine:r=>r[0]}),Gb=We.StateEffect.define(),Rj=We.Facet.define(),es=We.StateField.define({create(r){return null},update(r,e){for(let t of e.effects)t.is(Gb)&&(r=t.value);for(let t of e.state.facet(Rj))r=t(r,e);return r}});function qb(r){let e=r.field(es,!1);if(!e)return null;let t=r.facet(ei);return{chunks:e,side:t?t.side:null}}var Ps=class r{constructor(e,t,n,i,s,o=!0){this.changes=e,this.fromA=t,this.toA=n,this.fromB=i,this.toB=s,this.precise=o}offset(e,t){return e||t?new r(this.changes,this.fromA+e,this.toA+e,this.fromB+t,this.toB+t,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,t,n){let i=EP(e.toString(),t.toString(),n);return SP(i,e,t,0,0,xP())}static updateA(e,t,n,i,s){return iP(nP(e,i,!0,n.length),e,t,n,s)}static updateB(e,t,n,i,s){return iP(nP(e,i,!1,t.length),e,t,n,s)}};function eP(r,e,t,n){let i=t.lineAt(r),s=n.lineAt(e);return i.to==r&&s.to==e&&r<t.length&&e<n.length?[r+1,e+1]:[i.from,s.from]}function tP(r,e,t,n){let i=t.lineAt(r),s=n.lineAt(e);return i.from==r&&s.from==e?[r,e]:[i.to+1,s.to+1]}function SP(r,e,t,n,i,s){let o=[];for(let a=0;a<r.length;a++){let l=r[a],[c,u]=eP(l.fromA+n,l.fromB+i,e,t),[f,d]=tP(l.toA+n,l.toB+i,e,t),h=[l.offset(-c+n,-u+i)];for(;a<r.length-1;){let p=r[a+1],[m,w]=eP(p.fromA+n,p.fromB+i,e,t);if(m>f+1&&w>d+1)break;h.push(p.offset(-c+n,-u+i)),[f,d]=tP(p.toA+n,p.toB+i,e,t),a++}o.push(new Ps(h,c,Math.max(c,f),u,Math.max(u,d),s))}return o}var Ap=1e3;function rP(r,e,t,n){let i=0,s=r.length;for(;;){if(i==s){let u=0,f=0;i&&({toA:u,toB:f}=r[i-1]);let d=e-(t?u:f);return[u+d,f+d]}let o=i+s>>1,a=r[o],[l,c]=t?[a.fromA,a.toA]:[a.fromB,a.toB];if(l>e)s=o;else if(c<=e)i=o+1;else return n?[a.fromA,a.fromB]:[a.toA,a.toB]}}function nP(r,e,t,n){let i=[];return e.iterChangedRanges((s,o,a,l)=>{let c=0,u=t?e.length:n,f=0,d=t?n:e.length;s>Ap&&([c,f]=rP(r,s-Ap,t,!0)),o<e.length-Ap&&([u,d]=rP(r,o+Ap,t,!1));let h=l-a-(o-s),p,[m,w]=t?[h,0]:[0,h];i.length&&(p=i[i.length-1]).toA>=c?i[i.length-1]={fromA:p.fromA,fromB:p.fromB,toA:u,toB:d,diffA:p.diffA+m,diffB:p.diffB+w}:i.push({fromA:c,toA:u,fromB:f,toB:d,diffA:m,diffB:w})}),i}function iP(r,e,t,n,i){if(!r.length)return e;let s=[];for(let o=0,a=0,l=0,c=0;;o++){let u=o==r.length?null:r[o],f=u?u.fromA+a:t.length,d=u?u.fromB+l:n.length;for(;c<e.length;){let w=e[c];if(u&&(w.toA+a>f||w.toB+l>d))break;s.push(w.offset(a,l)),c++}if(!u)break;let h=u.toA+a+u.diffA,p=u.toB+l+u.diffB,m=EP(t.sliceString(f,h),n.sliceString(d,p),i);for(let w of SP(m,t,n,f,d,xP()))s.push(w);for(a+=u.diffA,l+=u.diffB;c<e.length;){let w=e[c];if(w.fromA+a>h&&w.fromB+l>p)break;c++}}return s}var $j={scanLimit:500},kP=Je.ViewPlugin.fromClass(class{constructor(r){({deco:this.deco,gutter:this.gutter}=aP(r))}update(r){(r.docChanged||r.viewportChanged||Pj(r.startState,r.state)||Ij(r.startState,r.state))&&({deco:this.deco,gutter:this.gutter}=aP(r.view))}},{decorations:r=>r.deco}),Cp=We.Prec.low((0,Je.gutter)({class:"cm-changeGutter",markers:r=>{var e;return((e=r.plugin(kP))===null||e===void 0?void 0:e.gutter)||We.RangeSet.empty}}));function Pj(r,e){return r.field(es,!1)!=e.field(es,!1)}function Ij(r,e){return r.facet(ei)!=e.facet(ei)}var sP=Je.Decoration.line({class:"cm-changedLine"}),Oj=Je.Decoration.mark({class:"cm-changedText"}),Fj=Je.Decoration.mark({tagName:"ins",class:"cm-insertedLine"}),Mj=Je.Decoration.mark({tagName:"del",class:"cm-deletedLine"}),oP=new class extends Je.GutterMarker{constructor(){super(...arguments),this.elementClass="cm-changedLineGutter"}};function Dj(r,e,t,n,i,s){let o=t?r.fromA:r.fromB,a=t?r.toA:r.toB,l=0;if(o!=a){i.add(o,o,sP),i.add(o,a,t?Mj:Fj),s&&s.add(o,o,oP);for(let c=e.iterRange(o,a-1),u=o;!c.next().done;){if(c.lineBreak){u++,i.add(u,u,sP),s&&s.add(u,u,oP);continue}let f=u+c.value.length;if(n)for(;l<r.changes.length;){let d=r.changes[l],h=o+(t?d.fromA:d.fromB),p=o+(t?d.toA:d.toB),m=Math.max(u,h),w=Math.min(f,p);if(m<w&&i.add(m,w,Oj),p<f)l++;else break}u=f}}}function aP(r){let e=r.state.field(es),{side:t,highlightChanges:n,markGutter:i,overrideChunk:s}=r.state.facet(ei),o=t=="a",a=new We.RangeSetBuilder,l=i?new We.RangeSetBuilder:null,{from:c,to:u}=r.viewport;for(let f of e){if((o?f.fromA:f.fromB)>=u)break;(o?f.toA:f.toB)>c&&(!s||!s(r.state,f,a,l))&&Dj(f,r.state.doc,o,n,a,l)}return{deco:a.finish(),gutter:l&&l.finish()}}var oc=class extends Je.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}},Pp=We.StateEffect.define({map:(r,e)=>r.map(e)}),wf=We.StateField.define({create:()=>Je.Decoration.none,update:(r,e)=>{for(let t of e.effects)if(t.is(Pp))return t.value;return r.map(e.changes)},provide:r=>Je.EditorView.decorations.from(r)}),Tp=.01;function lP(r,e){if(r.size!=e.size)return!1;let t=r.iter(),n=e.iter();for(;t.value;){if(t.from!=n.from||Math.abs(t.value.spec.widget.height-n.value.spec.widget.height)>1)return!1;t.next(),n.next()}return!0}function Lj(r,e,t){let n=new We.RangeSetBuilder,i=new We.RangeSetBuilder,s=r.state.field(wf).iter(),o=e.state.field(wf).iter(),a=0,l=0,c=0,u=0,f=r.viewport,d=e.viewport;for(let w=0;;w++){let y=w<t.length?t[w]:null,v=y?y.fromA:r.state.doc.length,A=y?y.fromB:e.state.doc.length;if(a<v){let C=r.lineBlockAt(a).top+c,S=e.lineBlockAt(l).top+u,T=C-S;T<-Tp?(c-=T,n.add(a,a,Je.Decoration.widget({widget:new oc(-T),block:!0,side:-1}))):T>Tp&&(u+=T,i.add(l,l,Je.Decoration.widget({widget:new oc(T),block:!0,side:-1})))}if(v>a+1e3&&a<f.from&&v>f.from&&l<d.from&&A>d.from){let C=Math.max(f.from-a,d.from-l);a+=C,l+=C,w--}else if(y)a=y.toA,l=y.toB;else break;for(;s.value&&s.from<a;)c-=s.value.spec.widget.height,s.next();for(;o.value&&o.from<l;)u-=o.value.spec.widget.height,o.next()}for(;s.value;)c-=s.value.spec.widget.height,s.next();for(;o.value;)u-=o.value.spec.widget.height,o.next();let h=r.contentHeight+c-(e.contentHeight+u);h<Tp?n.add(r.state.doc.length,r.state.doc.length,Je.Decoration.widget({widget:new oc(-h),block:!0,side:1})):h>Tp&&i.add(e.state.doc.length,e.state.doc.length,Je.Decoration.widget({widget:new oc(h),block:!0,side:1}));let p=n.finish(),m=i.finish();lP(p,r.state.field(wf))||r.dispatch({effects:Pp.of(p)}),lP(m,e.state.field(wf))||e.dispatch({effects:Pp.of(m)})}var Ub=We.StateEffect.define({map:(r,e)=>e.mapPos(r)});var jb=class extends Je.WidgetType{constructor(e){super(),this.lines=e}eq(e){return this.lines==e.lines}toDOM(e){let t=document.createElement("div");return t.className="cm-collapsedLines",t.textContent=e.state.phrase("$ unchanged lines",this.lines),t.addEventListener("click",n=>{let i=e.posAtDOM(n.target);e.dispatch({effects:Ub.of(i)});let{side:s,sibling:o}=e.state.facet(ei);o&&o().dispatch({effects:Ub.of(Nj(i,e.state.field(es),s=="a"))})}),t}ignoreEvent(e){return e instanceof MouseEvent}get estimatedHeight(){return 27}get type(){return"collapsed-unchanged-code"}};function Nj(r,e,t){let n=0,i=0;for(let s=0;;s++){let o=s<e.length?e[s]:null;if(!o||(t?o.fromA:o.fromB)>=r)return i+(r-n);[n,i]=t?[o.toA,o.toB]:[o.toB,o.toA]}}var Bj=We.StateField.define({create(r){return Je.Decoration.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)t.is(Ub)&&(r=r.update({filter:n=>n!=t.value}));if(r.size&&e.state.field(es)!=e.startState.field(es,!1)){let t=e.state.facet(ei).side=="a",n=[];for(let i of e.state.field(es))r.between(t?i.fromA:i.fromB,t?i.toA:i.toB,s=>{n.push(s)});n.length&&(r=r.update({filter:i=>n.indexOf(i)<0}))}return r},provide:r=>Je.EditorView.decorations.from(r)});function cP({margin:r=3,minSize:e=4}){return Bj.init(t=>Hj(t,r,e))}function Hj(r,e,t){let n=new We.RangeSetBuilder,i=r.facet(ei).side=="a",s=r.field(es),o=1;for(let a=0;;a++){let l=a<s.length?s[a]:null,c=a?o+e:1,u=l?r.doc.lineAt(i?l.fromA:l.fromB).number-1-e:r.doc.lines,f=u-c+1;if(f>=t&&n.add(r.doc.line(c).from,r.doc.line(u).to,Je.Decoration.replace({widget:new jb(f),block:!0})),!l)break;o=r.doc.lineAt(Math.min(r.doc.length,i?l.toA:l.toB)).number}return n.finish()}var Gj=Je.EditorView.styleModule.of(new kp({".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"}})),Uj=Je.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"}}),uP=new We.Compartment,Rp=new We.Compartment,Ip=class{constructor(e){this.revertDOM=null,this.revertToA=!1,this.revertToLeft=!1,this.measuring=-1,this.diffConf=e.diffConfig||$j;let t=[We.Prec.low(kP),Uj,Gj,wf,Je.EditorView.updateListener.of(f=>{this.measuring<0&&(f.heightChanged||f.viewportChanged)&&!f.transactions.some(d=>d.effects.some(h=>h.is(Pp)))&&this.measure()})],n=[ei.of({side:"a",sibling:()=>this.b,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&n.push(Cp);let i=We.EditorState.create({doc:e.a.doc,selection:e.a.selection,extensions:[e.a.extensions||[],Je.EditorView.editorAttributes.of({class:"cm-merge-a"}),Rp.of(n),t]}),s=[ei.of({side:"b",sibling:()=>this.a,highlightChanges:e.highlightChanges!==!1,markGutter:e.gutter!==!1})];e.gutter!==!1&&s.push(Cp);let o=We.EditorState.create({doc:e.b.doc,selection:e.b.selection,extensions:[e.b.extensions||[],Je.EditorView.editorAttributes.of({class:"cm-merge-b"}),Rp.of(s),t]});this.chunks=Ps.build(i.doc,o.doc,this.diffConf);let a=[es.init(()=>this.chunks),uP.of(e.collapseUnchanged?cP(e.collapseUnchanged):[])];i=i.update({effects:We.StateEffect.appendConfig.of(a)}).state,o=o.update({effects:We.StateEffect.appendConfig.of(a)}).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 Je.EditorView({state:i,parent:c,root:e.root,dispatchTransactions:f=>this.dispatch(f,this.a)}),this.b=new Je.EditorView({state:o,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,t){if(e.some(n=>n.docChanged)){let n=e[e.length-1],i=e.reduce((o,a)=>o.compose(a.changes),We.ChangeSet.empty(e[0].startState.doc.length));this.chunks=t==this.a?Ps.updateA(this.chunks,n.newDoc,this.b.state.doc,i,this.diffConf):Ps.updateB(this.chunks,this.a.state.doc,n.newDoc,i,this.diffConf),t.update([...e,n.state.update({effects:Gb.of(this.chunks)})]);let s=t==this.a?this.b:this.a;s.update([s.state.update({effects:Gb.of(this.chunks)})]),this.scheduleMeasure()}else t.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 o=this.a.dom.parentNode,a=this.b.dom.parentNode;o.remove(),a.remove(),this.editorDOM.insertBefore(s?o:a,this.editorDOM.firstChild),this.editorDOM.appendChild(s?a:o),this.revertToLeft=!this.revertToLeft,this.revertDOM&&(this.revertDOM.textContent="")}}if("revertControls"in e||"renderRevertControl"in e){let s=!!this.revertDOM,o=this.revertToA,a=this.renderRevert;"revertControls"in e&&(s=!!e.revertControls,o=e.revertControls=="b-to-a"),"renderRevertControl"in e&&(a=e.renderRevertControl),this.setupRevertControls(s,o,a)}let t="highlightChanges"in e,n="gutter"in e,i="collapseUnchanged"in e;if(t||n||i){let s=[],o=[];if(t||n){let a=this.a.state.facet(ei),l=n?e.gutter!==!1:a.markGutter,c=t?e.highlightChanges!==!1:a.highlightChanges;s.push(Rp.reconfigure([ei.of({side:"a",sibling:()=>this.b,highlightChanges:c,markGutter:l}),l?Cp:[]])),o.push(Rp.reconfigure([ei.of({side:"b",sibling:()=>this.a,highlightChanges:c,markGutter:l}),l?Cp:[]]))}if(i){let a=uP.reconfigure(e.collapseUnchanged?cP(e.collapseUnchanged):[]);s.push(a),o.push(a)}this.a.dispatch({effects:s}),this.b.dispatch({effects:o})}this.scheduleMeasure()}setupRevertControls(e,t,n){this.revertToA=t,this.revertToLeft=this.revertToA==(this.editorDOM.firstChild==this.a.dom.parentNode),this.renderRevert=n,!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",i=>this.revertClicked(i)),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(){Lj(this.a,this.b,this.chunks),this.revertDOM&&this.updateRevertButtons()}updateRevertButtons(){let e=this.revertDOM,t=e.firstChild,n=this.a.viewport,i=this.b.viewport;for(let s=0;s<this.chunks.length;s++){let o=this.chunks[s];if(o.fromA>n.to||o.fromB>i.to)break;if(o.fromA<n.from||o.fromB<i.from)continue;let a=this.a.lineBlockAt(o.fromA).top+"px";for(;t&&+t.dataset.chunk<s;)t=fP(t);t&&t.dataset.chunk==String(s)?(t.style.top!=a&&(t.style.top=a),t=t.nextSibling):e.insertBefore(this.renderRevertButton(a,s),t)}for(;t;)t=fP(t)}renderRevertButton(e,t){let n;if(this.renderRevert)n=this.renderRevert();else{n=document.createElement("button");let i=this.a.state.phrase("Revert this chunk");n.setAttribute("aria-label",i),n.setAttribute("title",i),n.textContent=this.revertToLeft?"\u21DC":"\u21DD"}return n.style.top=e,n.setAttribute("data-chunk",String(t)),n}revertClicked(e){let t=e.target,n;for(;t&&t.parentNode!=this.revertDOM;)t=t.parentNode;if(t&&(n=this.chunks[t.dataset.chunk])){let[i,s,o,a,l,c]=this.revertToA?[this.b,this.a,n.fromB,n.toB,n.fromA,n.toA]:[this.a,this.b,n.fromA,n.toA,n.fromB,n.toB],u=i.state.sliceDoc(o,Math.max(o,a-1));o!=a&&c<=s.state.doc.length&&(u+=i.state.lineBreak),s.dispatch({changes:{from:l,to:Math.min(s.state.doc.length,c),insert:u},userEvent:"revert"}),e.preventDefault()}}destroy(){this.a.destroy(),this.b.destroy(),this.measuring>-1&&(this.dom.ownerDocument.defaultView||window).cancelAnimationFrame(this.measuring),this.dom.remove()}};function fP(r){let e=r.nextSibling;return r.remove(),e}var Yb=require("@codemirror/state");function Op(r,e){let t=r.lineAt(e);return!(t.text.length==0&&t.number==r.lines)?t.number:t.number-1}function Kb(r,e,t){let n=[],i=r.split(`
`),s=e.split(`
`);for(let o of t){let{oldStart:a,oldLines:l,newStart:c,newLines:u}=o,f=cr.createHunk(a,l,c,u);if(o.oldLines>0){for(let d=a;d<a+l;d++)f.removed.lines.push(i[d-1]);a+l>i.length&&i.last()!=""&&(f.removed.no_nl_at_eof=!0)}if(o.newLines>0){for(let d=c;d<c+u;d++)f.added.lines.push(s[d-1]);c+u>s.length&&s.last()!=""&&(f.added.no_nl_at_eof=!0)}n.push(f)}return n}function Zb(r,e,t){let n=e.lineAt(r.fromA).number,i=r.fromA==r.toA?0:Op(e,r.endA)-n+1,s=t.lineAt(r.fromB).number,o=r.fromB==r.toB?0:Op(t,r.endB)-s+1,a={oldStart:n,oldLines:i,newStart:s,newLines:o};return a.oldLines==0&&(a.oldStart-=1),a.newLines==0&&(a.newStart-=1),a}var AP={scanLimit:1e3,timeout:200};function jj(r,e,t,n){let i=Yb.Text.of(r.split(`
`)),s=Yb.Text.of(e.split(`
`)),o=t&&n?Ps.updateB(t,i,s,n,AP):Ps.build(i,s,AP),a=[];for(let l=0;l<o.length;l++){let c=o[l],u=Zb(c,i,s);a.push(u)}return{hunks:Kb(r,e,a),chunks:o}}function CP(r,e,t,n){return jj(r,e,t,n)}var Is=require("obsidian"),xi=class{static hasHunksData(e){let t=e.field(on,!1);return!!t&&!t.isDirty}static getHunks(e,t){let n=e.field(on);return n?t?n.stagedHunks:n.hunks:[]}static getHunkAtPos(e,t,n){if(!e.field(on))return;let s=e.doc.lineAt(t).number,o=this.getHunks(e,n);return cr.findHunk(s,o)[0]}static getCursorHunk(e,t){if(!e.field(on))return;let i=e.selection.main.head;return this.getHunkAtPos(e,i,t)}static getHunk(e,t,n){if(n!=null)return this.getHunkAtPos(e,n,t);if(e.selection.main.empty)return this.getCursorHunk(e,t);let i=e.selection.main.from,s=e.selection.main.to,o=e.doc.lineAt(i).number,a=Op(e.doc,s),l=this.getHunks(e,t),c=cr.createPartialHunk(l,o,a);if(!c)return;let u=e.field(on);if(t){let f=o,d=a;for(let h of u.hunks)o>h.vend&&(f=f-(h.added.count-h.removed.count)),a>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(o-1,a),a===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}},on=lc.StateField.define({create:r=>{},update:(r,e)=>{var i,s,o,a;let t=r?{...r}:{maxDiffTimeMs:0,hunks:[],stagedHunks:[],chunks:void 0,isDirty:!1},n=!1;for(let l of e.effects)if(l.is(cc)&&(t.compareText=l.value.compareText,t.compareTextHead=l.value.compareTextHead,n=(r==null?void 0:r.compareText)!==l.value.compareText,n&&(t.chunks=void 0,t.changeDesc=void 0)),l.is(Fp)){let c=(i=e.startState.field(vf,!1))==null?void 0:i.revision;if(l.value.revision!==c)continue;TP(t,l.value.result,e.state),t.changeDesc=void 0}if(e.docChanged&&(!t.changeDesc||t.changeDesc.newLength===e.changes.length||((s=Pt.plugin)==null||s.warn("Hunk changes belong to different document histories. Recomputing the full diff."),t.chunks=void 0),t.changeDesc=zj(t.changeDesc,e.changes)),t.compareText!==void 0){if(n||e.docChanged){t.isDirty=!0;let l=Vj(e,t.compareText,t.chunks,t.changeDesc,t.maxDiffTimeMs);l&&(TP(t,l,e.state),t.changeDesc=void 0)}}else{t.compareText=void 0,t.compareTextHead=void 0,t.chunks=void 0,t.hunks=[],t.stagedHunks=[],t.isDirty=!1;let l=e.state.field(Is.editorInfoField).file;(a=(o=Pt.plugin)==null?void 0:o.editorIntegration.signsFeature.changeStatusBar)==null||a.display(t.hunks,l)}return t}});function TP(r,e,t){var i,s;r.hunks=e.hunks,r.chunks=e.chunks,r.isDirty=!1,r.maxDiffTimeMs=Math.max(.95*r.maxDiffTimeMs,e.diffDuration);let n=t.field(Is.editorInfoField).file;(s=(i=Pt.plugin)==null?void 0:i.editorIntegration.signsFeature.changeStatusBar)==null||s.display(r.hunks,n)}var vf=lc.StateField.define({create:r=>{var e,t;return{debouncer:(0,Is.debounce)(n=>{let{state:i,compareText:s,previousChunks:o,changeDesc:a,revision:l}=n,c=i.field(Is.editorEditorField,!1);if(!c)return;let u=c.state.field(vf,!1);if((u==null?void 0:u.revision)!==l)return;let f=RP(i,s,o,a);c.dispatch({effects:Fp.of({result:f,revision:l})})},1e3,!0),revision:{},filePath:(t=(e=r.field(Is.editorInfoField,!1))==null?void 0:e.file)==null?void 0:t.path}},update:(r,e)=>{var n,i;let t=(i=(n=e.state.field(Is.editorInfoField,!1))==null?void 0:n.file)==null?void 0:i.path;return e.docChanged||t!==r.filePath?{...r,revision:{},filePath:t}:r}});function zj(r,e){return!r||r.newLength!==e.length?e:r.composeDesc(e)}function RP(r,e,t,n){let i=r.doc.toString(),s=performance.now(),{hunks:o,chunks:a}=CP(e,i,t,n),l=performance.now()-s;return{hunks:o,chunks:a,diffDuration:l}}function Vj(r,e,t,n,i){let s=r.state,o=Math.abs(r.changes.length-r.changes.newLength),a=s.field(vf);if(o>1e3||i>16){a.debouncer({state:s,compareText:e,previousChunks:t,changeDesc:n,revision:a.revision});return}else return RP(s,e,t,n)}var cc=lc.StateEffect.define(),Fp=lc.StateEffect.define();function $P(r,e){return e.update({effects:cc.of(r)})}g();g();g();var St;(function(r){r.INSERT="insert",r.DELETE="delete",r.CONTEXT="context"})(St||(St={}));var PP={LINE_BY_LINE:"line-by-line",SIDE_BY_SIDE:"side-by-side"},IP={LINES:"lines",WORDS:"words",NONE:"none"},OP={WORD:"word",CHAR:"char"},ga;(function(r){r.AUTO="auto",r.DARK="dark",r.LIGHT="light"})(ga||(ga={}));g();var Wj=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],qj=RegExp("["+Wj.join("\\")+"]","g");function FP(r){return r.replace(qj,"\\$&")}function Xb(r){return r&&r.replace(/\\/g,"/")}function MP(r){let e,t,n,i=0;for(e=0,n=r.length;e<n;e++)t=r.charCodeAt(e),i=(i<<5)-i+t,i|=0;return i}function Mp(r){let e=r.length,t=-1/0;for(let n=0;n<e;n++)t=Math.max(t,r[n]);return t}function DP(r,e){let t=r.split(".");return t.length>1?t[t.length-1]:e}function LP(r,e){return e.reduce((t,n)=>t||r.startsWith(n),!1)}var NP=["a/","b/","i/","w/","c/","o/"];function So(r,e,t){let n=t!==void 0?[...NP,t]:NP,i=e?new RegExp(`^${FP(e)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,s=""]=i.exec(r)||[],o=n.find(l=>s.indexOf(l)===0);return(o?s.slice(o.length):s).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function Yj(r,e){return So(r,"---",e)}function Kj(r,e){return So(r,"+++",e)}function BP(r,e={}){let t=[],n=null,i=null,s=null,o=null,a=null,l=null,c=null,u="--- ",f="+++ ",d="@@",h=/^old mode (\d{6})/,p=/^new mode (\d{6})/,m=/^deleted file mode (\d{6})/,w=/^new file mode (\d{6})/,y=/^copy from "?(.+)"?/,v=/^copy to "?(.+)"?/,A=/^rename from "?(.+)"?/,C=/^rename to "?(.+)"?/,S=/^similarity index (\d+)%/,T=/^dissimilarity index (\d+)%/,b=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,x=/^Binary files (.*) and (.*) differ/,E=/^GIT binary patch/,k=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,$=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,M=/^new file mode (\d{6})/,D=/^deleted file mode (\d{6}),(\d{6})/,P=r.replace(/\\ No newline at end of file/g,"").replace(/\r\n?/g,`
`).split(`
`);function F(){i!==null&&n!==null&&(n.blocks.push(i),i=null)}function _e(){n!==null&&(!n.oldName&&l!==null&&(n.oldName=l),!n.newName&&c!==null&&(n.newName=c),n.newName&&(t.push(n),n=null)),l=null,c=null}function Q(){F(),_e(),n={blocks:[],deletedLines:0,addedLines:0}}function oe(Y){F();let J;n!==null&&((J=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(Y))?(n.isCombined=!1,s=parseInt(J[1],10),a=parseInt(J[2],10)):(J=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(Y))?(n.isCombined=!0,s=parseInt(J[1],10),o=parseInt(J[2],10),a=parseInt(J[3],10)):(Y.startsWith(d)&&console.error("Failed to parse lines, starting in 0!"),s=0,a=0,n.isCombined=!1)),i={lines:[],oldStartLine:s,oldStartLine2:o,newStartLine:a,header:Y}}function fe(Y){if(n===null||i===null||s===null||a===null)return;let J={content:Y},U=n.isCombined?["+ "," +","++"]:["+"],et=n.isCombined?["- "," -","--"]:["-"];LP(Y,U)?(n.addedLines++,J.type=St.INSERT,J.oldNumber=void 0,J.newNumber=a++):LP(Y,et)?(n.deletedLines++,J.type=St.DELETE,J.oldNumber=s++,J.newNumber=void 0):(J.type=St.CONTEXT,J.oldNumber=s++,J.newNumber=a++),i.lines.push(J)}function Z(Y,J){let U=J;for(;U<P.length-3;){if(Y.startsWith("diff"))return!1;if(P[U].startsWith(u)&&P[U+1].startsWith(f)&&P[U+2].startsWith(d))return!0;U++}return!1}return P.forEach((Y,J)=>{if(!Y||Y.startsWith("*"))return;let U,et=P[J-1],se=P[J+1],vt=P[J+2];if(Y.startsWith("diff --git")||Y.startsWith("diff --combined")){if(Q(),(U=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(Y))&&(l=So(U[1],void 0,e.dstPrefix),c=So(U[2],void 0,e.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isGitDiff=!0;return}if(Y.startsWith("Binary files")&&!(n!=null&&n.isGitDiff)){if(Q(),(U=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(Y))&&(l=So(U[1],void 0,e.dstPrefix),c=So(U[2],void 0,e.srcPrefix)),n===null)throw new Error("Where is my file !!!");n.isBinary=!0;return}if((!n||!n.isGitDiff&&n&&Y.startsWith(u)&&se.startsWith(f)&&vt.startsWith(d))&&Q(),n!=null&&n.isTooBig)return;if(n&&(typeof e.diffMaxChanges=="number"&&n.addedLines+n.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&Y.length>e.diffMaxLineLength)){n.isTooBig=!0,n.addedLines=0,n.deletedLines=0,n.blocks=[],i=null;let j=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(t.length):"Diff too big to be displayed";oe(j);return}if(Y.startsWith(u)&&se.startsWith(f)||Y.startsWith(f)&&et.startsWith(u)){if(n&&!n.oldName&&Y.startsWith("--- ")&&(U=Yj(Y,e.srcPrefix))){n.oldName=U,n.language=DP(n.oldName,n.language);return}if(n&&!n.newName&&Y.startsWith("+++ ")&&(U=Kj(Y,e.dstPrefix))){n.newName=U,n.language=DP(n.newName,n.language);return}}if(n&&(Y.startsWith(d)||n.isGitDiff&&n.oldName&&n.newName&&!i)){oe(Y);return}if(i&&(Y.startsWith("+")||Y.startsWith("-")||Y.startsWith(" "))){fe(Y);return}let tt=!Z(Y,J);if(n===null)throw new Error("Where is my file !!!");(U=h.exec(Y))?n.oldMode=U[1]:(U=p.exec(Y))?n.newMode=U[1]:(U=m.exec(Y))?(n.deletedFileMode=U[1],n.isDeleted=!0):(U=w.exec(Y))?(n.newFileMode=U[1],n.isNew=!0):(U=y.exec(Y))?(tt&&(n.oldName=U[1]),n.isCopy=!0):(U=v.exec(Y))?(tt&&(n.newName=U[1]),n.isCopy=!0):(U=A.exec(Y))?(tt&&(n.oldName=U[1]),n.isRename=!0):(U=C.exec(Y))?(tt&&(n.newName=U[1]),n.isRename=!0):(U=x.exec(Y))?(n.isBinary=!0,n.oldName=So(U[1],void 0,e.srcPrefix),n.newName=So(U[2],void 0,e.dstPrefix),oe("Binary file")):E.test(Y)?(n.isBinary=!0,oe(Y)):(U=S.exec(Y))?n.unchangedPercentage=parseInt(U[1],10):(U=T.exec(Y))?n.changedPercentage=parseInt(U[1],10):(U=b.exec(Y))?(n.checksumBefore=U[1],n.checksumAfter=U[2],U[3]&&(n.mode=U[3])):(U=k.exec(Y))?(n.checksumBefore=[U[2],U[3]],n.checksumAfter=U[1]):(U=$.exec(Y))?(n.oldMode=[U[2],U[3]],n.newMode=U[1]):(U=M.exec(Y))?(n.newFileMode=U[1],n.isNew=!0):(U=D.exec(Y))&&(n.deletedFileMode=U[1],n.isDeleted=!0)}),F(),_e(),t}g();g();g();g();var ko=class{diff(e,t,n={}){let i;typeof n=="function"?(i=n,n={}):"callback"in n&&(i=n.callback);let s=this.castInput(e,n),o=this.castInput(t,n),a=this.removeEmpty(this.tokenize(s,n)),l=this.removeEmpty(this.tokenize(o,n));return this.diffWithOptionsObj(a,l,n,i)}diffWithOptionsObj(e,t,n,i){var s;let o=v=>{if(v=this.postProcess(v,n),i){setTimeout(function(){i(v)},0);return}else return v},a=t.length,l=e.length,c=1,u=a+l;n.maxEditLength!=null&&(u=Math.min(u,n.maxEditLength));let f=(s=n.timeout)!==null&&s!==void 0?s:1/0,d=Date.now()+f,h=[{oldPos:-1,lastComponent:void 0}],p=this.extractCommon(h[0],t,e,0,n);if(h[0].oldPos+1>=l&&p+1>=a)return o(this.buildValues(h[0].lastComponent,t,e));let m=-1/0,w=1/0,y=()=>{for(let v=Math.max(m,-c);v<=Math.min(w,c);v+=2){let A,C=h[v-1],S=h[v+1];C&&(h[v-1]=void 0);let T=!1;if(S){let x=S.oldPos-v;T=S&&0<=x&&x<a}let b=C&&C.oldPos+1<l;if(!T&&!b){h[v]=void 0;continue}if(!b||T&&C.oldPos<S.oldPos?A=this.addToPath(S,!0,!1,0,n):A=this.addToPath(C,!1,!0,1,n),p=this.extractCommon(A,t,e,v,n),A.oldPos+1>=l&&p+1>=a)return o(this.buildValues(A.lastComponent,t,e))||!0;h[v]=A,A.oldPos+1>=l&&(w=Math.min(w,v-1)),p+1>=a&&(m=Math.max(m,v+1))}c++};if(i)(function v(){setTimeout(function(){if(c>u||Date.now()>d)return i(void 0);y()||v()},0)})();else for(;c<=u&&Date.now()<=d;){let v=y();if(v)return v}}addToPath(e,t,n,i,s){let o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===t&&o.removed===n?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:t,removed:n,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:t,removed:n,previousComponent:o}}}extractCommon(e,t,n,i,s){let o=t.length,a=n.length,l=e.oldPos,c=l-i,u=0;for(;c+1<o&&l+1<a&&this.equals(n[l+1],t[c+1],s);)c++,l++,u++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!s.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join("")}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let i=[],s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();let o=i.length,a=0,l=0,c=0;for(;a<o;a++){let u=i[a];if(u.removed)u.value=this.join(n.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=t.slice(l,l+u.count);f=f.map(function(d,h){let p=n[c+h];return p.length>d.length?p:d}),u.value=this.join(f)}else u.value=this.join(t.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return i}};g();var Qb=class extends ko{},HP=new Qb;function Jb(r,e,t){return HP.diff(r,e,t)}g();g();function ey(r,e){let t;for(t=0;t<r.length&&t<e.length;t++)if(r[t]!=e[t])return r.slice(0,t);return r.slice(0,t)}function ty(r,e){let t;if(!r||!e||r[r.length-1]!=e[e.length-1])return"";for(t=0;t<r.length&&t<e.length;t++)if(r[r.length-(t+1)]!=e[e.length-(t+1)])return r.slice(-t);return r.slice(-t)}function Dp(r,e,t){if(r.slice(0,e.length)!=e)throw Error(`string ${JSON.stringify(r)} doesn't start with prefix ${JSON.stringify(e)}; this is a bug`);return t+r.slice(e.length)}function Lp(r,e,t){if(!e)return r+t;if(r.slice(-e.length)!=e)throw Error(`string ${JSON.stringify(r)} doesn't end with suffix ${JSON.stringify(e)}; this is a bug`);return r.slice(0,-e.length)+t}function uc(r,e){return Dp(r,e,"")}function bf(r,e){return Lp(r,e,"")}function ry(r,e){return e.slice(0,Xj(r,e))}function Xj(r,e){let t=0;r.length>e.length&&(t=r.length-e.length);let n=e.length;r.length<e.length&&(n=r.length);let i=Array(n),s=0;i[0]=0;for(let o=1;o<n;o++){for(e[o]==e[s]?i[o]=i[s]:i[o]=s;s>0&&e[o]!=e[s];)s=i[s];e[o]==e[s]&&s++}s=0;for(let o=t;o<r.length;o++){for(;s>0&&r[o]!=e[s];)s=i[s];r[o]==e[s]&&s++}return s}function ny(r,e){let t=[];for(let n of Array.from(e.segment(r))){let i=n.segment;t.length&&/\s/.test(t[t.length-1])&&/\s/.test(i)?t[t.length-1]+=i:t.push(i)}return t}function Np(r,e){if(e)return fc(r,e)[1];let t;for(t=r.length-1;t>=0&&r[t].match(/\s/);t--);return r.substring(t+1)}function wa(r,e){if(e)return fc(r,e)[0];let t=r.match(/^\s*/);return t?t[0]:""}function fc(r,e){if(!e)return[wa(r),Np(r)];if(e.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');let t=ny(r,e),n=t[0],i=t[t.length-1],s=/\s/.test(n)?n:"",o=/\s/.test(i)?i:"";return[s,o]}var Bp="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}",Qj=new RegExp(`[${Bp}]+|\\s+|[^${Bp}]`,"ug"),iy=class extends ko{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let o=t.intlSegmenter;if(o.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');n=ny(e,o)}else n=e.match(Qj)||[];let i=[],s=null;return n.forEach(o=>{/\s/.test(o)?s==null?i.push(o):i.push(i.pop()+o):s!=null&&/\s/.test(s)?i[i.length-1]==s?i.push(i.pop()+o):i.push(s+o):i.push(o),s=o}),i}join(e){return e.map((t,n)=>n==0?t:t.replace(/^\s+/,"")).join("")}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,i=null,s=null;return e.forEach(o=>{o.added?i=o:o.removed?s=o:((i||s)&&GP(n,s,i,o,t.intlSegmenter),n=o,i=null,s=null)}),(i||s)&&GP(n,s,i,null,t.intlSegmenter),e}},Jj=new iy;function GP(r,e,t,n,i){if(e&&t){let[s,o]=fc(e.value,i),[a,l]=fc(t.value,i);if(r){let c=ey(s,a);r.value=Lp(r.value,a,c),e.value=uc(e.value,c),t.value=uc(t.value,c)}if(n){let c=ty(o,l);n.value=Dp(n.value,l,c),e.value=bf(e.value,c),t.value=bf(t.value,c)}}else if(t){if(r){let s=wa(t.value,i);t.value=t.value.substring(s.length)}if(n){let s=wa(n.value,i);n.value=n.value.substring(s.length)}}else if(r&&n){let s=wa(n.value,i),[o,a]=fc(e.value,i),l=ey(s,o);e.value=uc(e.value,l);let c=ty(uc(s,l),a);e.value=bf(e.value,c),n.value=Dp(n.value,s,c),r.value=Lp(r.value,s,s.slice(0,s.length-c.length))}else if(n){let s=wa(n.value,i),o=Np(e.value,i),a=ry(o,s);e.value=bf(e.value,a)}else if(r){let s=Np(r.value,i),o=wa(e.value,i),a=ry(s,o);e.value=uc(e.value,a)}}var sy=class extends ko{tokenize(e){let t=new RegExp(`(\\r?\\n)|[${Bp}]+|[^\\S\\n\\r]+|[^${Bp}]`,"ug");return e.match(t)||[]}},UP=new sy;function oy(r,e,t){return UP.diff(r,e,t)}g();function t9(r,e){if(r.length===0)return e.length;if(e.length===0)return r.length;let t=[],n;for(n=0;n<=e.length;n++)t[n]=[n];let i;for(i=0;i<=r.length;i++)t[0][i]=i;for(n=1;n<=e.length;n++)for(i=1;i<=r.length;i++)e.charAt(n-1)===r.charAt(i-1)?t[n][i]=t[n-1][i-1]:t[n][i]=Math.min(t[n-1][i-1]+1,Math.min(t[n][i-1]+1,t[n-1][i]+1));return t[e.length][r.length]}function dc(r){return(e,t)=>{let n=r(e).trim(),i=r(t).trim();return t9(n,i)/(n.length+i.length)}}function hc(r){function e(n,i,s=new Map){let o=1/0,a;for(let l=0;l<n.length;++l)for(let c=0;c<i.length;++c){let u=JSON.stringify([n[l],i[c]]),f;s.has(u)&&(f=s.get(u))||(f=r(n[l],i[c]),s.set(u,f)),f<o&&(o=f,a={indexA:l,indexB:c,score:o})}return a}function t(n,i,s=0,o=new Map){let a=e(n,i,o);if(!a||n.length+i.length<3)return[[n,i]];let l=n.slice(0,a.indexA),c=i.slice(0,a.indexB),u=[n[a.indexA]],f=[i[a.indexB]],d=a.indexA+1,h=a.indexB+1,p=n.slice(d),m=i.slice(h),w=t(l,c,s+1,o),y=t(u,f,s+1,o),v=t(p,m,s+1,o),A=y;return(a.indexA>0||a.indexB>0)&&(A=w.concat(A)),(n.length>d||i.length>h)&&(A=A.concat(v)),A}return t}var br={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},va={matching:IP.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:OP.WORD,colorScheme:ga.LIGHT},ts="/",jP=dc(r=>r.value),r9=hc(jP);function ly(r){return r.indexOf("dev/null")!==-1}function n9(r){return r.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,"")}function i9(r){return r.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}function pc(r){switch(r){case St.CONTEXT:return br.CONTEXT;case St.INSERT:return br.INSERTS;case St.DELETE:return br.DELETES}}function mc(r){switch(r){case ga.DARK:return"d2h-dark-color-scheme";case ga.AUTO:return"d2h-auto-color-scheme";case ga.LIGHT:default:return"d2h-light-color-scheme"}}function s9(r){return r?2:1}function Ao(r){return r.slice(0).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;")}function ti(r,e,t=!0){let n=s9(e);return{prefix:r.substring(0,n),content:t?Ao(r.substring(n)):r.substring(n)}}function ba(r){let e=Xb(r.oldName),t=Xb(r.newName);if(e!==t&&!ly(e)&&!ly(t)){let n=[],i=[],s=e.split(ts),o=t.split(ts),a=s.length,l=o.length,c=0,u=a-1,f=l-1;for(;c<u&&c<f&&s[c]===o[c];)n.push(o[c]),c+=1;for(;u>c&&f>c&&s[u]===o[f];)i.unshift(o[f]),u-=1,f-=1;let d=n.join(ts),h=i.join(ts),p=s.slice(c,u+1).join(ts),m=o.slice(c,f+1).join(ts);return d.length&&h.length?d+ts+"{"+p+" \u2192 "+m+"}"+ts+h:d.length?d+ts+"{"+p+" \u2192 "+m+"}":h.length?"{"+p+" \u2192 "+m+"}"+ts+h:e+" \u2192 "+t}else return ly(t)?e:t}function gc(r){return`d2h-${MP(ba(r)).toString().slice(-6)}`}function wc(r){let e="file-changed";return r.isRename||r.isCopy?e="file-renamed":r.isNew?e="file-added":r.isDeleted?e="file-deleted":r.newName!==r.oldName&&(e="file-renamed"),e}function Hp(r,e,t,n={}){let{matching:i,maxLineLengthHighlight:s,matchWordsThreshold:o,diffStyle:a}=Object.assign(Object.assign({},va),n),l=ti(r,t,!1),c=ti(e,t,!1);if(l.content.length>s||c.content.length>s)return{oldLine:{prefix:l.prefix,content:Ao(l.content)},newLine:{prefix:c.prefix,content:Ao(c.content)}};let u=a==="char"?Jb(l.content,c.content):oy(l.content,c.content),f=[];if(a==="word"&&i==="words"){let h=u.filter(w=>w.removed),p=u.filter(w=>w.added);r9(p,h).forEach(w=>{w[0].length===1&&w[1].length===1&&jP(w[0][0],w[1][0])<o&&(f.push(w[0][0]),f.push(w[1][0]))})}let d=u.reduce((h,p)=>{let m=p.added?"ins":p.removed?"del":null,w=f.indexOf(p)>-1?' class="d2h-change"':"",y=Ao(p.value);return m!==null?`${h}<${m}${w}>${y}</${m}>`:`${h}${y}`},"");return{oldLine:{prefix:l.prefix,content:n9(d)},newLine:{prefix:c.prefix,content:i9(d)}}}var zP="file-summary",o9="icon",a9={colorScheme:va.colorScheme},Gp=class{constructor(e,t={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},a9),t)}render(e){let t=e.map(n=>this.hoganUtils.render(zP,"line",{fileHtmlId:gc(n),oldName:n.oldName,newName:n.newName,fileName:ba(n),deletedLines:"-"+n.deletedLines,addedLines:"+"+n.addedLines},{fileIcon:this.hoganUtils.template(o9,wc(n))})).join(`
`);return this.hoganUtils.render(zP,"wrapper",{colorScheme:mc(this.config.colorScheme),filesNumber:e.length,files:t})}};g();var uy=Object.assign(Object.assign({},va),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),yf="generic",VP="line-by-line",l9="icon",c9="tag",_f=class{constructor(e,t={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},uy),t)}render(e){let t=e.map(n=>{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(`
`);return this.hoganUtils.render(yf,"wrapper",{colorScheme:mc(this.config.colorScheme),content:t})}makeFileDiffHtml(e,t){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let n=this.hoganUtils.template(VP,"file-diff"),i=this.hoganUtils.template(yf,"file-path"),s=this.hoganUtils.template(l9,"file"),o=this.hoganUtils.template(c9,wc(e));return n.render({file:e,fileHtmlId:gc(e),diffs:t,filePath:i.render({fileDiffName:ba(e)},{fileIcon:s,fileTag:o})})}generateEmptyDiff(){return this.hoganUtils.render(yf,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:br})}generateFileHtml(e){let t=hc(dc(n=>ti(n.content,e.isCombined).content));return e.blocks.map(n=>{let i=this.hoganUtils.render(yf,"block-header",{CSSLineClass:br,blockHeader:e.isTooBig?n.header:Ao(n.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(n).forEach(([s,o,a])=>{if(o.length&&a.length&&!s.length)this.applyRematchMatching(o,a,t).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);i+=u,i+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=ti(l.content,e.isCombined);i+=this.generateSingleLineHtml(e,{type:br.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(o.length||a.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,o,a);i+=l,i+=c}else console.error("Unknown state reached while processing groups of lines",s,o,a)}),i}).join(`
`)}applyLineGroupping(e){let t=[],n=[],i=[];for(let s=0;s<e.lines.length;s++){let o=e.lines[s];(o.type!==St.INSERT&&i.length||o.type===St.CONTEXT&&n.length>0)&&(t.push([[],n,i]),n=[],i=[]),o.type===St.CONTEXT?t.push([[o],[],[]]):o.type===St.INSERT&&n.length===0?t.push([[],[],[o]]):o.type===St.INSERT&&n.length>0?i.push(o):o.type===St.DELETE&&n.push(o)}return(n.length||i.length)&&(t.push([[],n,i]),n=[],i=[]),t}applyRematchMatching(e,t,n){let i=e.length*t.length,s=Mp(e.concat(t).map(a=>a.content.length));return i<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?n(e,t):[[e,t]]}processChangedLines(e,t,n,i){let s={right:"",left:""},o=Math.max(n.length,i.length);for(let a=0;a<o;a++){let l=n[a],c=i[a],u=l!==void 0&&c!==void 0?Hp(l.content,c.content,t,this.config):void 0,f=l!==void 0&&l.oldNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.oldLine.prefix,content:u.oldLine.content,type:br.DELETE_CHANGES}:Object.assign(Object.assign({},ti(l.content,t)),{type:pc(l.type)})),{oldNumber:l.oldNumber,newNumber:l.newNumber}):void 0,d=c!==void 0&&c.newNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.newLine.prefix,content:u.newLine.content,type:br.INSERT_CHANGES}:Object.assign(Object.assign({},ti(c.content,t)),{type:pc(c.type)})),{oldNumber:c.oldNumber,newNumber:c.newNumber}):void 0,{left:h,right:p}=this.generateLineHtml(e,f,d);s.left+=h,s.right+=p}return s}generateLineHtml(e,t,n){return{left:this.generateSingleLineHtml(e,t),right:this.generateSingleLineHtml(e,n)}}generateSingleLineHtml(e,t){if(t===void 0)return"";let n=this.hoganUtils.render(VP,"numbers",{oldNumber:t.oldNumber||"",newNumber:t.newNumber||""});return this.hoganUtils.render(yf,"line",{type:t.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:t.prefix===" "?"&nbsp;":t.prefix,content:t.content,lineNumber:n,line:t,file:e})}};g();var fy=Object.assign(Object.assign({},va),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),xf="generic",u9="side-by-side",f9="icon",d9="tag",Ef=class{constructor(e,t={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},fy),t)}render(e){let t=e.map(n=>{let i;return n.blocks.length?i=this.generateFileHtml(n):i=this.generateEmptyDiff(),this.makeFileDiffHtml(n,i)}).join(`
`);return this.hoganUtils.render(xf,"wrapper",{colorScheme:mc(this.config.colorScheme),content:t})}makeFileDiffHtml(e,t){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let n=this.hoganUtils.template(u9,"file-diff"),i=this.hoganUtils.template(xf,"file-path"),s=this.hoganUtils.template(f9,"file"),o=this.hoganUtils.template(d9,wc(e));return n.render({file:e,fileHtmlId:gc(e),diffs:t,filePath:i.render({fileDiffName:ba(e)},{fileIcon:s,fileTag:o})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(xf,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:br})}}generateFileHtml(e){let t=hc(dc(n=>ti(n.content,e.isCombined).content));return e.blocks.map(n=>{let i={left:this.makeHeaderHtml(n.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(n).forEach(([s,o,a])=>{if(o.length&&a.length&&!s.length)this.applyRematchMatching(o,a,t).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);i.left+=u,i.right+=f});else if(s.length)s.forEach(l=>{let{prefix:c,content:u}=ti(l.content,e.isCombined),{left:f,right:d}=this.generateLineHtml({type:br.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:br.CONTEXT,prefix:c,content:u,number:l.newNumber});i.left+=f,i.right+=d});else if(o.length||a.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,o,a);i.left+=l,i.right+=c}else console.error("Unknown state reached while processing groups of lines",s,o,a)}),i}).reduce((n,i)=>({left:n.left+i.left,right:n.right+i.right}),{left:"",right:""})}applyLineGroupping(e){let t=[],n=[],i=[];for(let s=0;s<e.lines.length;s++){let o=e.lines[s];(o.type!==St.INSERT&&i.length||o.type===St.CONTEXT&&n.length>0)&&(t.push([[],n,i]),n=[],i=[]),o.type===St.CONTEXT?t.push([[o],[],[]]):o.type===St.INSERT&&n.length===0?t.push([[],[],[o]]):o.type===St.INSERT&&n.length>0?i.push(o):o.type===St.DELETE&&n.push(o)}return(n.length||i.length)&&(t.push([[],n,i]),n=[],i=[]),t}applyRematchMatching(e,t,n){let i=e.length*t.length,s=Mp(e.concat(t).map(a=>a.content.length));return i<this.config.matchingMaxComparisons&&s<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?n(e,t):[[e,t]]}makeHeaderHtml(e,t){return this.hoganUtils.render(xf,"block-header",{CSSLineClass:br,blockHeader:t!=null&&t.isTooBig?e:Ao(e),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(e,t,n){let i={right:"",left:""},s=Math.max(t.length,n.length);for(let o=0;o<s;o++){let a=t[o],l=n[o],c=a!==void 0&&l!==void 0?Hp(a.content,l.content,e,this.config):void 0,u=a!==void 0&&a.oldNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.oldLine.prefix,content:c.oldLine.content,type:br.DELETE_CHANGES}:Object.assign(Object.assign({},ti(a.content,e)),{type:pc(a.type)})),{number:a.oldNumber}):void 0,f=l!==void 0&&l.newNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.newLine.prefix,content:c.newLine.content,type:br.INSERT_CHANGES}:Object.assign(Object.assign({},ti(l.content,e)),{type:pc(l.type)})),{number:l.newNumber}):void 0,{left:d,right:h}=this.generateLineHtml(u,f);i.left+=d,i.right+=h}return i}generateLineHtml(e,t){return{left:this.generateSingleHtml(e),right:this.generateSingleHtml(t)}}generateSingleHtml(e){let t="d2h-code-side-linenumber",n="d2h-code-side-line";return this.hoganUtils.render(xf,"line",{type:(e==null?void 0:e.type)||`${br.CONTEXT} d2h-emptyplaceholder`,lineClass:e!==void 0?t:`${t} d2h-code-side-emptyplaceholder`,contentClass:e!==void 0?n:`${n} d2h-code-side-emptyplaceholder`,prefix:(e==null?void 0:e.prefix)===" "?"&nbsp;":e==null?void 0:e.prefix,content:e==null?void 0:e.content,lineNumber:e==null?void 0:e.number})}};g();var my=nt(py());g();var jt=nt(py()),Lt={};Lt["file-summary-line"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<li class="d2h-file-list-line">'),n.b(`
`+t),n.b(' <span class="d2h-file-name-wrapper">'),n.b(`
`+t),n.b(n.rp("<fileIcon0",r,e," ")),n.b(' <a href="#'),n.b(n.v(n.f("fileHtmlId",r,e,0))),n.b('" class="d2h-file-name">'),n.b(n.v(n.f("fileName",r,e,0))),n.b("</a>"),n.b(`
`+t),n.b(' <span class="d2h-file-stats">'),n.b(`
`+t),n.b(' <span class="d2h-lines-added">'),n.b(n.v(n.f("addedLines",r,e,0))),n.b("</span>"),n.b(`
`+t),n.b(' <span class="d2h-lines-deleted">'),n.b(n.v(n.f("deletedLines",r,e,0))),n.b("</span>"),n.b(`
`+t),n.b(" </span>"),n.b(`
`+t),n.b(" </span>"),n.b(`
`+t),n.b("</li>"),n.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});Lt["file-summary-wrapper"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<div class="d2h-file-list-wrapper '),n.b(n.v(n.f("colorScheme",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="d2h-file-list-header">'),n.b(`
`+t),n.b(' <span class="d2h-file-list-title">Files changed ('),n.b(n.v(n.f("filesNumber",r,e,0))),n.b(")</span>"),n.b(`
`+t),n.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),n.b(`
`+t),n.b(' <a class="d2h-file-switch d2h-show">show</a>'),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(' <ol class="d2h-file-list">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("files",r,e,0))),n.b(`
`+t),n.b(" </ol>"),n.b(`
`+t),n.b("</div>"),n.fl()},partials:{},subs:{}});Lt["generic-block-header"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b("<tr>"),n.b(`
`+t),n.b(' <td class="'),n.b(n.v(n.f("lineClass",r,e,0))),n.b(" "),n.b(n.v(n.d("CSSLineClass.INFO",r,e,0))),n.b('"></td>'),n.b(`
`+t),n.b(' <td class="'),n.b(n.v(n.d("CSSLineClass.INFO",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="'),n.b(n.v(n.f("contentClass",r,e,0))),n.b('">'),n.s(n.f("blockHeader",r,e,1),r,e,0,156,173,"{{ }}")&&(n.rs(r,e,function(i,s,o){o.b(o.t(o.f("blockHeader",i,s,0)))}),r.pop()),n.s(n.f("blockHeader",r,e,1),r,e,1,0,0,"")||n.b("&nbsp;"),n.b("</div>"),n.b(`
`+t),n.b(" </td>"),n.b(`
`+t),n.b("</tr>"),n.fl()},partials:{},subs:{}});Lt["generic-empty-diff"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b("<tr>"),n.b(`
`+t),n.b(' <td class="'),n.b(n.v(n.d("CSSLineClass.INFO",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="'),n.b(n.v(n.f("contentClass",r,e,0))),n.b('">'),n.b(`
`+t),n.b(" File without changes"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(" </td>"),n.b(`
`+t),n.b("</tr>"),n.fl()},partials:{},subs:{}});Lt["generic-file-path"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<span class="d2h-file-name-wrapper">'),n.b(`
`+t),n.b(n.rp("<fileIcon0",r,e," ")),n.b(' <span class="d2h-file-name">'),n.b(n.v(n.f("fileDiffName",r,e,0))),n.b("</span>"),n.b(`
`+t),n.b(n.rp("<fileTag1",r,e," ")),n.b("</span>"),n.b(`
`+t),n.b('<label class="d2h-file-collapse">'),n.b(`
`+t),n.b(' <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">'),n.b(`
`+t),n.b(" Viewed"),n.b(`
`+t),n.b("</label>"),n.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});Lt["generic-line"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b("<tr>"),n.b(`
`+t),n.b(' <td class="'),n.b(n.v(n.f("lineClass",r,e,0))),n.b(" "),n.b(n.v(n.f("type",r,e,0))),n.b('">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("lineNumber",r,e,0))),n.b(`
`+t),n.b(" </td>"),n.b(`
`+t),n.b(' <td class="'),n.b(n.v(n.f("type",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="'),n.b(n.v(n.f("contentClass",r,e,0))),n.b('">'),n.b(`
`+t),n.s(n.f("prefix",r,e,1),r,e,0,162,238,"{{ }}")&&(n.rs(r,e,function(i,s,o){o.b(' <span class="d2h-code-line-prefix">'),o.b(o.t(o.f("prefix",i,s,0))),o.b("</span>"),o.b(`
`+t)}),r.pop()),n.s(n.f("prefix",r,e,1),r,e,1,0,0,"")||(n.b(' <span class="d2h-code-line-prefix">&nbsp;</span>'),n.b(`
`+t)),n.s(n.f("content",r,e,1),r,e,0,371,445,"{{ }}")&&(n.rs(r,e,function(i,s,o){o.b(' <span class="d2h-code-line-ctn">'),o.b(o.t(o.f("content",i,s,0))),o.b("</span>"),o.b(`
`+t)}),r.pop()),n.s(n.f("content",r,e,1),r,e,1,0,0,"")||(n.b(' <span class="d2h-code-line-ctn"><br></span>'),n.b(`
`+t)),n.b(" </div>"),n.b(`
`+t),n.b(" </td>"),n.b(`
`+t),n.b("</tr>"),n.fl()},partials:{},subs:{}});Lt["generic-wrapper"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<div class="d2h-wrapper '),n.b(n.v(n.f("colorScheme",r,e,0))),n.b('">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("content",r,e,0))),n.b(`
`+t),n.b("</div>"),n.fl()},partials:{},subs:{}});Lt["icon-file-added"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),n.b(`
`+t),n.b(' width="14">'),n.b(`
`+t),n.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z"></path>'),n.b(`
`+t),n.b("</svg>"),n.fl()},partials:{},subs:{}});Lt["icon-file-changed"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),n.b(`
`+t),n.b(' viewBox="0 0 14 16" width="14">'),n.b(`
`+t),n.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>'),n.b(`
`+t),n.b("</svg>"),n.fl()},partials:{},subs:{}});Lt["icon-file-deleted"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),n.b(`
`+t),n.b(' viewBox="0 0 14 16" width="14">'),n.b(`
`+t),n.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z"></path>'),n.b(`
`+t),n.b("</svg>"),n.fl()},partials:{},subs:{}});Lt["icon-file-renamed"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),n.b(`
`+t),n.b(' viewBox="0 0 14 16" width="14">'),n.b(`
`+t),n.b(' <path d="M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z"></path>'),n.b(`
`+t),n.b("</svg>"),n.fl()},partials:{},subs:{}});Lt["icon-file"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),n.b(`
`+t),n.b(' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>'),n.b(`
`+t),n.b("</svg>"),n.fl()},partials:{},subs:{}});Lt["line-by-line-file-diff"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<div id="'),n.b(n.v(n.f("fileHtmlId",r,e,0))),n.b('" class="d2h-file-wrapper" data-lang="'),n.b(n.v(n.d("file.language",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="d2h-file-header">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("filePath",r,e,0))),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(' <div class="d2h-file-diff">'),n.b(`
`+t),n.b(' <div class="d2h-code-wrapper">'),n.b(`
`+t),n.b(' <table class="d2h-diff-table">'),n.b(`
`+t),n.b(' <tbody class="d2h-diff-tbody">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("diffs",r,e,0))),n.b(`
`+t),n.b(" </tbody>"),n.b(`
`+t),n.b(" </table>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b("</div>"),n.fl()},partials:{},subs:{}});Lt["line-by-line-numbers"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<div class="line-num1">'),n.b(n.v(n.f("oldNumber",r,e,0))),n.b("</div>"),n.b(`
`+t),n.b('<div class="line-num2">'),n.b(n.v(n.f("newNumber",r,e,0))),n.b("</div>"),n.fl()},partials:{},subs:{}});Lt["side-by-side-file-diff"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<div id="'),n.b(n.v(n.f("fileHtmlId",r,e,0))),n.b('" class="d2h-file-wrapper" data-lang="'),n.b(n.v(n.d("file.language",r,e,0))),n.b('">'),n.b(`
`+t),n.b(' <div class="d2h-file-header">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.f("filePath",r,e,0))),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(' <div class="d2h-files-diff">'),n.b(`
`+t),n.b(' <div class="d2h-file-side-diff">'),n.b(`
`+t),n.b(' <div class="d2h-code-wrapper">'),n.b(`
`+t),n.b(' <table class="d2h-diff-table">'),n.b(`
`+t),n.b(' <tbody class="d2h-diff-tbody">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.d("diffs.left",r,e,0))),n.b(`
`+t),n.b(" </tbody>"),n.b(`
`+t),n.b(" </table>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(' <div class="d2h-file-side-diff">'),n.b(`
`+t),n.b(' <div class="d2h-code-wrapper">'),n.b(`
`+t),n.b(' <table class="d2h-diff-table">'),n.b(`
`+t),n.b(' <tbody class="d2h-diff-tbody">'),n.b(`
`+t),n.b(" "),n.b(n.t(n.d("diffs.right",r,e,0))),n.b(`
`+t),n.b(" </tbody>"),n.b(`
`+t),n.b(" </table>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b(" </div>"),n.b(`
`+t),n.b("</div>"),n.fl()},partials:{},subs:{}});Lt["tag-file-added"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),n.fl()},partials:{},subs:{}});Lt["tag-file-changed"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),n.fl()},partials:{},subs:{}});Lt["tag-file-deleted"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),n.fl()},partials:{},subs:{}});Lt["tag-file-renamed"]=new jt.Template({code:function(r,e,t){var n=this;return n.b(t=t||""),n.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),n.fl()},partials:{},subs:{}});var Sf=class{constructor({compiledTemplates:e={},rawTemplates:t={}}){let n=Object.entries(t).reduce((i,[s,o])=>{let a=my.compile(o,{asString:!1});return Object.assign(Object.assign({},i),{[s]:a})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},Lt),e),n)}static compile(e){return my.compile(e,{asString:!1})}render(e,t,n,i,s){let o=this.templateKey(e,t);try{return this.preCompiledTemplates[o].render(n,i,s)}catch(a){throw new Error(`Could not find template to render '${o}'`)}}template(e,t){return this.preCompiledTemplates[this.templateKey(e,t)]}templateKey(e,t){return`${e}-${t}`}};var p9=Object.assign(Object.assign(Object.assign({},uy),fy),{outputFormat:PP.LINE_BY_LINE,drawFileList:!0});function jp(r,e={}){let t=Object.assign(Object.assign({},p9),e),n=typeof r=="string"?BP(r,t):r,i=new Sf(t),{colorScheme:s}=t,o={colorScheme:s},a=t.drawFileList?new Gp(i,o).render(n):"",l=t.outputFormat==="side-by-side"?new Ef(i,t).render(n):new _f(i,t).render(n);return a+l}var JP=nt(XP(),1);var ya=require("obsidian"),gy=kf.StateEffect.define();function Co(r,e){let t=r.state,n=t.field(Vp),i=t.field(on),s=t.doc.lineAt(e!=null?e:t.selection.main.head).number,o=cr.findHunk(s,i==null?void 0:i.hunks)[0];if(!o)return;let a=t.doc.line(Math.max(1,o.added.start)).from,l=n.has(a);return t.field(ya.editorEditorField).dispatch({effects:gy.of({pos:a,add:!l})})}var Vp=kf.StateField.define({create:()=>new Set,update(r,e){let t=new Set;for(let n of e.effects)n.is(gy)&&(n.value.add?r.add(n.value.pos):r.delete(n.value.pos));for(let n of r)t.add(e.changes.mapPos(n));return t}}),e2=kf.StateField.define({create:r=>QP(r),update(r,e){return e.docChanged||e.effects.some(t=>t.is(cc)||t.is(gy))?QP(e.state):r},provide:r=>zp.showTooltip.computeN([r],e=>e.field(r))}),t2=zp.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 QP(r){let e=r.field(on);return e?[...r.field(Vp)].map(n=>{let i=r.doc.lineAt(n),s=cr.findHunk(i.number,e.hunks)[0];if(s)return{pos:n,above:!1,arrow:!1,strictSide:!0,clip:!1,create:()=>m9(s,r,n)}}).filter(n=>n!==void 0):[]}function m9(r,e,t){var m,w;let n=cr.createPatch("file",[r],"10064",!1).join(`
`)+`
`,i=jp(n,{colorScheme:JP.ColorSchemeType.AUTO,diffStyle:"word",drawFileList:!1}),s=new DOMParser().parseFromString(i,"text/html").querySelector(".d2h-file-diff"),o=createDiv();o.addClass("tooltip-toolbar");let a=(y,v)=>{let A=createDiv();return(0,ya.setIcon)(A,y),A.setAttr("aria-label",v),A.addClass("clickable-icon"),A},l=a("x","Close hunk"),c=a("plus","Stage hunk"),u=a("undo","Reset hunk");o.appendChild(l),o.appendChild(c),o.appendChild(u);let f=createDiv();f.appendChild(o),f.appendChild(s),f.addClass("git-diff-tooltip","git-diff");let d=e.field(ya.editorEditorField);l.onclick=()=>{Co(d,t)},c.onclick=()=>{let y=Pt.plugin;y&&(y.promiseQueue.addTask(()=>y.hunkActions.stageHunk(t)),Co(d,t))},u.onclick=()=>{let y=Pt.plugin;y&&(y.hunkActions.resetHunk(t),Co(d,t))};let h=(w=(m=Pt.plugin)==null?void 0:m.app.workspace.getActiveViewOfType(ya.MarkdownView))==null?void 0:w.scope,p=h==null?void 0:h.register(null,"Escape",(y,v)=>{Co(d,t)});return{dom:f,destroy:()=>{p&&(h==null||h.unregister(p))},update:y=>{t=y.changes.mapPos(t)}}}function r2(r){let e=r.app;r.addCommand({id:"edit-gitignore",name:"Edit .gitignore",callback:async()=>{let t=r.gitManager.getRelativeVaultPath(".gitignore");await e.vault.adapter.exists(t)||await e.vault.adapter.write(t,"");let n=await e.vault.adapter.read(t),s=await new Sp(e,n).openAndGetReslt();s!==void 0&&(await e.vault.adapter.write(t,s),await r.refresh())}}),r.addCommand({id:"open-git-view",name:"Open source control view",callback:async()=>{var i;let t=e.workspace.getLeavesOfType(wr.type),n;t.length===0?(n=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await n.setViewState({type:wr.type})):n=t.first(),await e.workspace.revealLeaf(n),e.workspace.trigger("obsidian-git:refresh")}}),r.addCommand({id:"open-history-view",name:"Open history view",callback:async()=>{var i;let t=e.workspace.getLeavesOfType(tn.type),n;t.length===0?(n=(i=e.workspace.getRightLeaf(!1))!=null?i:e.workspace.getLeaf(),await n.setViewState({type:tn.type})):n=t.first(),await e.workspace.revealLeaf(n),e.workspace.trigger("obsidian-git:refresh")}}),r.addCommand({id:"open-diff-view",name:"Open diff view",checkCallback:t=>{let n=e.workspace.getActiveFile();if(t)return n!==null;{let i=r.gitManager.getRelativeRepoPath(n.path,!0);return r.tools.openDiff({aFile:i,aRef:""}),!0}}}),r.addCommand({id:"view-file-on-github",name:"Open file on GitHub",editorCallback:(t,{file:n})=>{if(n)return U$(t,n,r.gitManager)}}),r.addCommand({id:"view-history-on-github",name:"Open file history on GitHub",editorCallback:(t,{file:n})=>{if(n)return j$(n,r.gitManager)}}),r.addCommand({id:"pull",name:"Pull",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.pullChangesFromRemote())}),r.addCommand({id:"fetch",name:"Fetch",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.fetch())}),r.addCommand({id:"switch-to-remote-branch",name:"Switch to remote branch",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.switchRemoteBranch())}),r.addCommand({id:"add-to-gitignore",name:"Add file to .gitignore",checkCallback:t=>{let n=e.workspace.getActiveFile();return t?n!==null:(r.promiseQueue.addTask(()=>r.gitActions.addFileToGitignore(n.path,n instanceof Af.TFolder)),!0)}}),r.addCommand({id:"push",name:"Commit-and-sync",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commitAndSync({fromAutoBackup:!1}))}),r.addCommand({id:"backup-and-close",name:"Commit-and-sync and then close Obsidian",callback:()=>r.promiseQueue.addTask(async()=>{await r.gitActions.commitAndSync({fromAutoBackup:!1}),window.close()})}),r.addCommand({id:"commit-push-specified-message",name:"Commit-and-sync with specific message",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commitAndSync({fromAutoBackup:!1,requestCustomMessage:!0}))}),r.addCommand({id:"commit",name:"Commit all changes",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,mode:"all"}))}),r.addCommand({id:"commit-specified-message",name:"Commit all changes with specific message",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCustomMessage:!0,mode:"all"}))}),r.addCommand({id:"commit-smart",name:"Commit",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCustomMessage:!1,mode:"smart"}))}),r.addCommand({id:"commit-staged",name:"Commit staged",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCustomMessage:!1,mode:"staged"}))}),r.addCommand({id:"commit-amend-staged-specified-message",name:"Amend staged",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCustomMessage:!0,mode:"staged",amend:!0}))}),r.addCommand({id:"commit-smart-specified-message",name:"Commit with specific message",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCustomMessage:!0,mode:"smart"}))}),r.addCommand({id:"commit-staged-specified-message",name:"Commit staged with specific message",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.commit({fromAuto:!1,requestCustomMessage:!0,mode:"staged"}))}),r.addCommand({id:"push2",name:"Push",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.push())}),r.addCommand({id:"stage-current-file",name:"Stage current file",checkCallback:t=>{let n=e.workspace.getActiveFile();return t?n!==null:(r.promiseQueue.addTask(()=>r.gitActions.stageFile(n)),!0)}}),r.addCommand({id:"unstage-current-file",name:"Unstage current file",checkCallback:t=>{let n=e.workspace.getActiveFile();return t?n!==null:(r.promiseQueue.addTask(()=>r.gitActions.unstageFile(n)),!0)}}),r.addCommand({id:"edit-remotes",name:"Edit remotes",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.editRemotes())}),r.addCommand({id:"remove-remote",name:"Remove remote",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.removeRemote())}),r.addCommand({id:"set-upstream-branch",name:"Set upstream branch",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.setUpstreamBranch())}),r.addCommand({id:"delete-repo",name:"CAUTION: Delete repository",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.deleteRepository())}),r.addCommand({id:"init-repo",name:"Initialize a new repo",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.createNewRepo())}),r.addCommand({id:"clone-repo",name:"Clone an existing remote repo",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.cloneNewRepo())}),r.addCommand({id:"list-changed-files",name:"List changed files",callback:()=>r.gitActions.listChangedFiles()}),r.addCommand({id:"switch-branch",name:"Switch branch",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.switchBranch())}),r.addCommand({id:"create-branch",name:"Create new branch",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.createBranch())}),r.addCommand({id:"delete-branch",name:"Delete branch",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.deleteBranch())}),r.addCommand({id:"discard-all",name:"CAUTION: Discard all changes",callback:()=>r.promiseQueue.addTask(()=>r.gitActions.discardAll())}),r.addCommand({id:"pause-automatic-routines",name:"Pause/Resume automatic routines",callback:()=>{let t=!r.localStorage.getPausedAutomatics();r.localStorage.setPausedAutomatics(t),t?(r.automaticsManager.unload(),new Af.Notice("Paused automatic routines.")):(r.automaticsManager.reload("commit","push","pull"),new Af.Notice("Resumed automatic routines."))}}),r.addCommand({id:"raw-command",name:"Raw command",checkCallback:t=>{let n=r.gitManager;return t?n instanceof Ze:(r.tools.runRawCommand(),!0)}}),r.addCommand({id:"toggle-line-author-info",name:"Toggle line author information",callback:()=>{var t;return(t=r.settingsTab)==null?void 0:t.configureLineAuthorShowStatus(!r.settings.lineAuthor.show)}}),r.addCommand({id:"reset-hunk",name:"Reset hunk",editorCheckCallback(t,n,i){return t?r.settings.hunks.hunkCommands&&r.hunkActions.editor!==void 0:(r.hunkActions.resetHunk(),!0)}}),r.addCommand({id:"stage-hunk",name:"Stage hunk",editorCheckCallback:(t,n,i)=>t?r.settings.hunks.hunkCommands&&r.hunkActions.editor!==void 0:(r.promiseQueue.addTask(()=>r.hunkActions.stageHunk()),!0)}),r.addCommand({id:"preview-hunk",name:"Preview hunk",editorCheckCallback:(t,n,i)=>{if(t)return r.settings.hunks.hunkCommands&&r.hunkActions.editor!==void 0;let s=r.hunkActions.editor.editor;return Co(s),!0}}),r.addCommand({id:"next-hunk",name:"Go to next hunk",editorCheckCallback:(t,n,i)=>t?r.settings.hunks.hunkCommands&&r.hunkActions.editor!==void 0:(r.hunkActions.goToHunk("next"),!0)}),r.addCommand({id:"prev-hunk",name:"Go to previous hunk",editorCheckCallback:(t,n,i)=>t?r.settings.hunks.hunkCommands&&r.hunkActions.editor!==void 0:(r.hunkActions.goToHunk("prev"),!0)})}g();var Wp=class{constructor(e){this.plugin=e;this.prefix=this.plugin.manifest.id+":",this.app=e.app}migrate(){let e=["password","hostname","lastAutoPull","lastAutoBackup","lastAutoPush","gitPath","pluginDisabled"];for(let t of e){let n=localStorage.getItem(this.prefix+t);this.app.loadLocalStorage(this.prefix+t)==null&&n!=null&&n!=null&&(this.app.saveLocalStorage(this.prefix+t,n),localStorage.removeItem(this.prefix+t))}}getLegacyPassword(){return this.app.loadLocalStorage(this.prefix+"password")}setLegacyPassword(e){this.app.saveLocalStorage(this.prefix+"password",e)}clearLegacyPassword(){this.app.saveLocalStorage(this.prefix+"password",null),localStorage.removeItem(this.prefix+"password")}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)}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,t;return(t=(e=this.app.loadLocalStorage(this.prefix+"PATHPaths"))==null?void 0:e.split(":"))!=null?t:[]}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)}};g();var n2="obsidian-git-password",qp=class{constructor(e){this.plugin=e}get(){let e=this.plugin.settings.gitServerPasswordSecret;return e?this.plugin.app.secretStorage.getSecret(e):null}async set(e){let t=this.plugin.settings.gitServerPasswordSecret;if(!t){t=n2;for(let n=2;this.plugin.app.secretStorage.getSecret(t)!==null;n++)t=`${n2}-${n}`}if(this.plugin.app.secretStorage.setSecret(t,e),this.plugin.settings.gitServerPasswordSecret!==t){this.plugin.settings.gitServerPasswordSecret=t;try{await this.plugin.saveSettings()}catch(n){throw this.plugin.settings.gitServerPasswordSecret="",n}}}async migrateLegacy(){let e=this.plugin.localStorage.getLegacyPassword();e!==null&&(e&&this.get()===null&&await this.set(e),this.plugin.localStorage.clearLegacyPassword())}};g();var Yp=require("obsidian");var Cf=class{constructor(e){this.plugin=e}async hasTooBigFiles(e){let t=await this.plugin.gitManager.branchInfo(),n=t.tracking?yo(t.tracking)[0]:null;if(!n)return!1;let i=await this.plugin.gitManager.getRemoteUrl(n);if(i!=null&&i.includes("github.com")){let s=[],o=this.plugin.gitManager;for(let a of e){let l=this.plugin.app.vault.getAbstractFileByPath(a.vaultPath),c=!1;if(l instanceof Yp.TFile)l.stat.size>=1e8&&(c=!0);else{let u=await this.plugin.app.vault.adapter.stat(a.vaultPath);u&&u.size>=1e8&&(c=!0)}if(c){let u=!1;o instanceof Ze&&(u=await o.isFileTrackedByLFS(a.path)),u||s.push(a)}}if(s.length>0)return this.plugin.displayError(`Aborted commit, because the following files are too big:
- ${s.map(a=>a.vaultPath).join(`
- `)}
Please remove them or add to .gitignore.`),!0}return!1}openDiff({aFile:e,bFile:t,aRef:n,bRef:i,event:s}){var l,c;let o=this.plugin.settings.diffStyle;Yp.Platform.isMobileApp&&(o="git_unified");let a={aFile:e,bFile:t!=null?t:e,aRef:n,bRef:i};o=="split"?(l=En(this.plugin.app,s))==null||l.setViewState({type:go.type,active:!0,state:a}):o=="git_unified"&&((c=En(this.plugin.app,s))==null||c.setViewState({type:wo.type,active:!0,state:a}))}async openFileAtCommit(e,t){let n={file:e,ref:t};await this.plugin.app.workspace.getLeaf("tab").setViewState({type:mo.type,active:!0,state:n})}async runRawCommand(){if(!(this.plugin.gitManager instanceof Ze))return;let t=await new _t(this.plugin,{placeholder:"push origin master",allowEmpty:!1}).openAndGetResult();t!==void 0&&this.plugin.promiseQueue.addTask(()=>this.plugin.gitActions.runRawCommand(t))}};g();var Kp=require("obsidian");var _a=class extends Kp.ItemView{constructor(t,n){super(t);this.plugin=n;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 wo.type}getDisplayText(){var t;if(((t=this.state)==null?void 0:t.bFile)!=null){let n=this.state.bFile.split("/").last();return n!=null&&n.endsWith(".md")&&(n=n.slice(0,-3)),`Diff: ${n}`}return wo.name}getIcon(){return wo.icon}async setState(t,n){this.state=t,Kp.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 t;if((t=this.state)!=null&&t.bFile&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let n=await this.plugin.gitManager.getDiffString(this.state.bFile,this.state.aRef=="HEAD",this.state.bRef);this.contentEl.empty();let i=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);if(!n){if(this.plugin.gitManager instanceof Ze&&await this.plugin.gitManager.isTracked(this.state.bFile))n=[`--- ${this.state.aFile}`,`+++ ${this.state.bFile}`,""].join(`
`);else if(await this.app.vault.adapter.exists(i)){let s=await this.app.vault.adapter.read(i);n=[...`--- /dev/null
+++ ${this.state.bFile}
@@ -0,0 +1,${s.split(`
`).length} @@`.split(`
`),...s.split(`
`).map(a=>`+${a}`)].join(`
`)}}if(n){let s=this.parser.parseFromString(jp(n),"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}}}};g();var Os=require("obsidian");var bc=require("@codemirror/commands");var Xp=require("@codemirror/search"),vc=require("@codemirror/state"),Ei=require("@codemirror/view");g();var Zp=require("obsidian"),wy=require("@codemirror/view");function g9(r){return r.selection.ranges.filter(e=>!e.empty).map(e=>r.sliceDoc(e.from,e.to)).join(r.lineBreak)}function w9(r){r.dispatch({...r.state.replaceSelection(""),userEvent:"delete.cut"})}function i2(r,e){r.dispatch({...r.state.replaceSelection(e),scrollIntoView:!0,userEvent:"input.paste"})}async function s2(r){if(!r&&navigator.clipboard.read){let e=await navigator.clipboard.read();for(let t of e)if(t.types.includes("text/html")){let n=await(await t.getType("text/html")).text();return(0,Zp.htmlToMarkdown)(n)}}return navigator.clipboard.readText()}var o2=wy.EditorView.domEventHandlers({contextmenu(r,e){r.preventDefault();let t=g9(e.state),n=!e.state.readOnly&&e.state.facet(wy.EditorView.editable),i=Zp.Menu.forEvent(r);return i.addItem(s=>s.setTitle("Cut").setIcon("scissors").setDisabled(!n||t.length===0).onClick(async()=>{await navigator.clipboard.writeText(t),w9(e)})),i.addItem(s=>s.setTitle("Copy").setIcon("copy").setDisabled(t.length===0).onClick(()=>navigator.clipboard.writeText(t))),i.addItem(s=>s.setTitle("Paste").setIcon("clipboard-paste").setDisabled(!n).onClick(async()=>i2(e,await s2(!1)))),i.addItem(s=>s.setTitle("Paste as plain text").setIcon("clipboard-type").setDisabled(!n).onClick(async()=>i2(e,await s2(!0)))),i.addItem(s=>s.setTitle("Select all").setIcon("scan").onClick(()=>e.dispatch({selection:{anchor:0,head:e.state.doc.length}}))),i.showAtMouseEvent(r),!0}});var a2=Ei.EditorView.theme({"& .cm-content":{caretColor:"transparent !important"},"&.cm-focused .cm-cursor, & .cm-dropCursor":{display:"none !important"}}),v9=10;function b9(r,e){let t=Number.isInteger(r)&&r>0?r:en.diffTimeout;return e?t:t*v9}var xa=class extends Os.ItemView{constructor(t,n){super(t);this.plugin=n;this.refreshing=!1;this.indexUnmerged=!1;this.ignoreNextModification=!1;this.navigation=!0,this.registerEvent(this.app.workspace.on("obsidian-git:status-changed",()=>{!this.mergeView||this.indexUnmerged?this.createMergeView().catch(console.error):this.updateRefEditors().catch(console.error)})),this.intervalRef=window.setInterval(()=>{this.mergeView&&this.updateRefEditors().catch(console.error)},30*1e3),this.registerEvent(this.app.vault.on("modify",i=>{this.isWorkingTreeBFile(i.path)&&(this.ignoreNextModification?this.ignoreNextModification=!1:this.updateModifiableEditor().catch(console.error))})),this.registerEvent(this.app.vault.on("delete",i=>{this.isWorkingTreeBFile(i.path)&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("create",i=>{this.isWorkingTreeBFile(i.path)&&this.createMergeView().catch(console.error)})),this.registerEvent(this.app.vault.on("rename",(i,s)=>{(this.isWorkingTreeBFile(i.path)||this.isWorkingTreeBFile(s))&&this.createMergeView().catch(console.error)})),this.fileSaveDebouncer=(0,Os.debounce)(i=>{let s=this.state.bFile;s&&(this.ignoreNextModification=!0,this.plugin.app.vault.adapter.write(this.plugin.gitManager.getRelativeVaultPath(s),i).catch(o=>this.plugin.displayError(o)))},1e3,!1)}isWorkingTreeBFile(t){var n;return((n=this.state)==null?void 0:n.bFile)==null||this.state.bRef!=null||!this.plugin.gitManager?!1:t===this.plugin.gitManager.getRelativeVaultPath(this.state.bFile)}getViewType(){return go.type}getDisplayText(){var t;if(((t=this.state)==null?void 0:t.bFile)!=null){let n=this.state.bFile.split("/").last();n!=null&&n.endsWith(".md")&&(n=n.slice(0,-3));let i;return this.state.bRef==null?i=" (Working Tree)":this.state.bRef==""?i=" (Index)":i="("+this.state.bRef.substring(0,7)+")",`Diff: ${n} ${i}`}return go.name}getIcon(){return go.icon}async setState(t,n){this.state=t,Os.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await super.setState(t,n),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(t,n){try{return await this.plugin.gitManager.show(t,n,!1)}catch(i){if(i instanceof vr){if(t===""&&i.message.includes("is in the index, but not at stage 0")){this.indexUnmerged=!0;try{return await this.plugin.gitManager.show(":2",n,!1)}catch(s){if(s instanceof vr&&s.message.includes("is in the index, but not at stage 2"))return"";throw s}}if(i.message.includes("does not exist")||i.message.includes("unknown revision or path")||i.message.includes("exists on disk, but not in")||i.message.includes("fatal: bad object"))return i.message.includes("fatal: bad object")&&this.plugin.displayError(i.message),""}throw i}}async bShouldBeEditable(){if(this.state.bRef!=null)return!1;let t=this.plugin.gitManager.getRelativeVaultPath(this.state.bFile);return await this.app.vault.adapter.exists(t)}async updateModifiableEditor(){if(!this.mergeView||this.refreshing)return;let t=this.mergeView.b;this.refreshing=!0;try{let n=await this.app.vault.adapter.read(this.plugin.gitManager.getRelativeVaultPath(this.state.bFile));if(n!=t.state.doc.toString()){let i=t.state.update({changes:{from:0,to:t.state.doc.length,insert:n},annotations:[vc.Transaction.remote.of(!0)]});t.dispatch(i)}}finally{this.refreshing=!1}}async updateRefEditors(){if(!this.mergeView||this.refreshing)return;let t=this.mergeView.a,n=this.mergeView.b;this.refreshing=!0;try{let i=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)),this.indexUnmerged){this.refreshing=!1,await this.createMergeView();return}if(i!=t.state.doc.toString()){let o=t.state.update({changes:{from:0,to:t.state.doc.length,insert:i}});t.dispatch(o)}if(s!=null&&s!=n.state.doc.toString()){let o=n.state.update({changes:{from:0,to:n.state.doc.length,insert:s}});n.dispatch(o)}}finally{this.refreshing=!1}}renderButtons(t){let n=t.createDiv(),i=n.createDiv();if(i.addClass("clickable-icon"),i.setAttr("aria-label",this.state.bRef==null?"Stage hunk":"Unstage hunk"),(0,Os.setIcon)(i,this.state.bRef==null?"plus":"minus"),i.onmousedown=async s=>{var p;let o=this.mergeView.b,a=this.mergeView.a,l=qb(o.state),c=(p=n.parentElement)==null?void 0:p.indexOf(n),u=l.chunks[c],f=Zb(u,a.state.doc,o.state.doc),d=Kb(this.mergeView.a.state.doc.toString(),this.mergeView.b.state.doc.toString(),[f])[0],h=cr.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=n.createDiv();s.addClass("clickable-icon"),s.setAttr("aria-label","Reset hunk"),(0,Os.setIcon)(s,"undo"),s.onmousedown=o=>{var d;let a=this.mergeView.a,l=this.mergeView.b,c=qb(l.state),u=(d=n.parentElement)==null?void 0:d.indexOf(n),f=c.chunks[u];if(f){let h=f.fromA,p=f.toA,m=f.fromB,w=f.toB,y=a.state.sliceDoc(h,Math.max(h,p-1));h!=p&&w<=l.state.doc.length&&(y+=a.state.lineBreak),l.dispatch({changes:{from:m,to:Math.min(l.state.doc.length,w),insert:y},userEvent:"revert"})}}}return n.onmousedown=s=>{s.preventDefault(),s.stopPropagation()},n}async createMergeView(){var t,n,i;if((t=this.state)!=null&&t.aFile&&((n=this.state)!=null&&n.bFile)&&!this.refreshing&&this.plugin.gitManager){this.refreshing=!0;try{(i=this.mergeView)==null||i.destroy();let s=this.containerEl.children[1];s.empty(),this.contentEl.addClass("git-split-diff-view","git-diff"),this.bIsEditable=await this.bShouldBeEditable(),this.indexUnmerged=!1;let o=await this.gitShow(this.state.aRef,this.state.aFile),a;if(this.state.bRef!=null)a=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)?a=await this.app.vault.adapter.read(p):a=""}let l=[(0,Ei.lineNumbers)(),(0,Xp.highlightSelectionMatches)(),(0,Ei.drawSelection)(),Ei.keymap.of([...bc.standardKeymap,bc.indentWithTab]),(0,bc.history)(),(0,Xp.search)(),Ei.EditorView.lineWrapping,o2],c=Ei.ViewPlugin.define(p=>({update:m=>{if(m.docChanged&&!m.transactions.some(w=>w.annotation(vc.Transaction.remote))){let w=p.state.doc.toString();this.fileSaveDebouncer(w)}}})),u={doc:o,extensions:[...l,vc.EditorState.readOnly.of(!0),a2]},f=[...l];this.bIsEditable?f.push(c):f.push(vc.EditorState.readOnly.of(!0),a2);let d={doc:a,extensions:f};s.addClasses(["cm-s-obsidian","mod-cm6","markdown-source-view","cm-content"]);let h=this.plugin.gitManager instanceof Ze&&!this.indexUnmerged&&(this.state.bRef===void 0||this.state.bRef==="");this.mergeView=new Ip({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:b9(this.plugin.settings.diffTimeout,this.bIsEditable)},parent:s})}finally{this.refreshing=!1}}}};g();var ZI=require("obsidian");g();g();g();var l2,c2,u2;typeof window!="undefined"&&((u2=(c2=(l2=window.__svelte)!=null?l2:window.__svelte={}).v)!=null?u2:c2.v=new Set).add("5");g();g();g();var Rn={};var lt=Symbol("uninitialized"),ni=Symbol("filename");var Qp="http://www.w3.org/1999/xhtml";g();g();g();g();var Jp=!0;g();var N=!1;g();var Fs=Array.isArray,f2=Array.prototype.indexOf,Ms=Array.prototype.includes,yc=Array.from,vy=Object.keys,ur=Object.defineProperty,an=Object.getOwnPropertyDescriptor,by=Object.getOwnPropertyDescriptors,yy=Object.prototype,d2=Array.prototype,_c=Object.getPrototypeOf,_y=Object.isExtensible;function xy(r){return typeof r=="function"}var Cr=()=>{};function em(r){for(var e=0;e<r.length;e++)r[e]()}function tm(){var r,e,t=new Promise((n,i)=>{r=n,e=i});return{promise:t,resolve:r,reject:e}}g();g();var Nr=Symbol("$state"),rm=Symbol("component"),Tf=Symbol("legacy props"),p2=Symbol(""),nm=Symbol("proxy path"),im=Symbol("attributes"),Rf=Symbol("class"),Ey=Symbol("style"),$f=Symbol("text"),Ea=Symbol("form reset"),Sy=Symbol("hmr anchor"),Ds=new class extends Error{constructor(){super(...arguments);Xe(this,"name","StaleReactionError");Xe(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}},h2,ky=!!((h2=globalThis.document)!=null&&h2.contentType)&&globalThis.document.contentType.includes("xml");var xc=3,ii=8;g();g();g();g();var Ls="font-weight: bold",Ns="font-weight: normal";function m2(r){N?console.warn(`%c[svelte] await_reactivity_loss
%cDetected reactivity loss when reading \`${r}\`. This happens when state is read in an async function after an earlier \`await\`
https://svelte.dev/e/await_reactivity_loss`,Ls,Ns):console.warn("https://svelte.dev/e/await_reactivity_loss")}function g2(r,e){N?console.warn(`%c[svelte] await_waterfall
%cAn async derived, \`${r}\` (${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`,Ls,Ns):console.warn("https://svelte.dev/e/await_waterfall")}function w2(){N?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`,Ls,Ns):console.warn("https://svelte.dev/e/derived_inert")}function v2(r,e,t){N?console.warn(`%c[svelte] hydration_attribute_changed
%cThe \`${r}\` attribute on \`${e}\` changed its value between server and client renders. The client value, \`${t}\`, will be ignored in favour of the server value
https://svelte.dev/e/hydration_attribute_changed`,Ls,Ns):console.warn("https://svelte.dev/e/hydration_attribute_changed")}function Sa(r){N?console.warn(`%c[svelte] hydration_mismatch
%c${r?`Hydration failed because the initial UI does not match what was rendered on the server. The error occurred near ${r}`:"Hydration failed because the initial UI does not match what was rendered on the server"}
https://svelte.dev/e/hydration_mismatch`,Ls,Ns):console.warn("https://svelte.dev/e/hydration_mismatch")}function b2(){N?console.warn(`%c[svelte] lifecycle_double_unmount
%cTried to unmount a component that was not mounted
https://svelte.dev/e/lifecycle_double_unmount`,Ls,Ns):console.warn("https://svelte.dev/e/lifecycle_double_unmount")}function sm(r){N?console.warn(`%c[svelte] state_proxy_equality_mismatch
%cReactive \`$state(...)\` proxies and the values they proxy have different identities. Because of this, comparisons with \`${r}\` will produce unexpected results
https://svelte.dev/e/state_proxy_equality_mismatch`,Ls,Ns):console.warn("https://svelte.dev/e/state_proxy_equality_mismatch")}function y2(){N?console.warn("%c[svelte] svelte_boundary_reset_noop\n%cA `<svelte:boundary>` `reset` function only resets the boundary the first time it is called\nhttps://svelte.dev/e/svelte_boundary_reset_noop",Ls,Ns):console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function _2(r){N?console.warn(`%c[svelte] transition_slide_display
%cThe \`slide\` transition does not work correctly for elements with \`display: ${r}\`
https://svelte.dev/e/transition_slide_display`,Ls,Ns):console.warn("https://svelte.dev/e/transition_slide_display")}var ue=!1;function Zt(r){ue=r}var Ee;function st(r){if(r===null)throw Sa(),Rn;return Ee=r}function Tr(){return st(yr(Ee))}function V(r){if(ue){if(yr(Ee)!==null)throw Sa(),Rn;Ee=r}}function ka(r=1){if(ue){for(var e=r,t=Ee;e--;)t=yr(t);Ee=t}}function rs(r=!0){for(var e=0,t=Ee;;){if(t.nodeType===ii){var n=t.data;if(n==="]"){if(e===0)return t;e-=1}else(n==="["||n==="[!"||n[0]==="["&&!isNaN(Number(n.slice(1))))&&(e+=1)}var i=yr(t);r&&t.remove(),t=i}}function Aa(r){if(!r||r.nodeType!==ii)throw Sa(),Rn;return r.data}g();g();g();g();function om(r){return r===this.v}function Ay(r,e){return r!=r?e==e:r!==e||r!==null&&typeof r=="object"||typeof r=="function"}function am(r){return!Ay(r,this.v)}g();g();function x2(r){if(N){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: "${r}"
https://svelte.dev/e/invariant_violation`);throw e.name="Svelte error",e}else throw new Error("https://svelte.dev/e/invariant_violation")}function lm(r){if(N){let e=new Error(`lifecycle_outside_component
\`${r}(...)\` 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 S2(){if(N){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/async_derived_orphan")}function Cy(){if(N){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/bind_invalid_checkbox_value")}function k2(){if(N){let r=new Error(`derived_references_self
A derived value cannot reference itself recursively
https://svelte.dev/e/derived_references_self`);throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/derived_references_self")}function Ty(r,e,t){if(N){let n=new Error(`each_key_duplicate
${t?`Keyed each block has duplicate key \`${t}\` at indexes ${r} and ${e}`:`Keyed each block has duplicate key at indexes ${r} and ${e}`}
https://svelte.dev/e/each_key_duplicate`);throw n.name="Svelte error",n}else throw new Error("https://svelte.dev/e/each_key_duplicate")}function A2(r,e,t){if(N){let n=new Error(`each_key_volatile
Keyed each block has key that is not idempotent \u2014 the key for item at index ${r} was \`${e}\` but is now \`${t}\`. Keys must be the same each time for a given item
https://svelte.dev/e/each_key_volatile`);throw n.name="Svelte error",n}else throw new Error("https://svelte.dev/e/each_key_volatile")}function C2(r){if(N){let e=new Error(`effect_in_teardown
\`${r}\` 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 T2(){if(N){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function R2(r){if(N){let e=new Error(`effect_orphan
\`${r}\` 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 $2(){if(N){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function P2(){if(N){let r=new Error(`hydration_failed
Failed to hydrate the application
https://svelte.dev/e/hydration_failed`);throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/hydration_failed")}function I2(r){if(N){let e=new Error(`props_invalid_value
Cannot do \`bind:${r}={undefined}\` when \`${r}\` 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 O2(r){if(N){let e=new Error(`rune_outside_svelte
The \`${r}\` 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 F2(){if(N){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function M2(){if(N){let r=new Error("state_prototype_fixed\nCannot set prototype of `$state` object\nhttps://svelte.dev/e/state_prototype_fixed");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/state_prototype_fixed")}function D2(){if(N){let r=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 r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function L2(){if(N){let r=new Error("svelte_boundary_reset_onerror\nA `<svelte:boundary>` `reset` function cannot be called while an error is still being handled\nhttps://svelte.dev/e/svelte_boundary_reset_onerror");throw r.name="Svelte error",r}else throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}g();var Xt=!1,Bs=!1,Si=!1;g();g();g();var If=null;function Rr(r,e){return r.label=e,um(r.v,e),r}function um(r,e){var t;return(t=r==null?void 0:r[nm])==null||t.call(r,e),r}g();function ki(r){let e=new Error,t=_9();return t.length===0?null:(t.unshift(`
`),ur(e,"stack",{value:t.join(`
`)}),ur(e,"name",{value:r}),e)}function _9(){let r=Error.stackTraceLimit;Error.stackTraceLimit=1/0;let e=new Error().stack;if(Error.stackTraceLimit=r,!e)return[];let t=e.split(`
`),n=[];for(let i=0;i<t.length;i++){let s=t[i],o=s.replaceAll("\\","/");if(s.trim()!=="Error"){if(s.includes("validate_each_keys"))return[];o.includes("svelte/src/internal")||o.includes("node_modules/.vite")||n.push(s)}}return n}function B2(r,e){if(!N)throw new Error("invariant(...) was not guarded by if (DEV)");r||x2(e)}g();g();var Pe=null;function Hs(r){Pe=r}var Ai=null;function kc(r){Ai=r}var Ci=null;function fm(r){Ci=r}function gt(r,e=!1,t){Pe={p:Pe,i:!1,c:null,e:null,s:r,x:null,r:ie,l:Bs&&!e?{s:null,u:null,$:[]}:null},N&&(Pe.function=t,Ci=t)}function wt(r){var i;var e=Pe,t=e.e;if(t!==null){e.e=null;for(var n of t)Ry(n)}return r!==void 0&&(e.x=r),e.i=!0,Pe=e.p,N&&(Ci=(i=Pe==null?void 0:Pe.function)!=null?i:null),Of(r)}function Of(r={}){return ur(r,rm,{value:!0}),r}function ns(){return!Bs||Pe!==null&&Pe.l===null}g();g();var Ca=[];function H2(){var r=Ca;Ca=[],em(r)}function Nt(r){if(Ca.length===0&&!Ta){var e=Ca;queueMicrotask(()=>{e===Ca&&H2()})}Ca.push(r)}function G2(){for(;Ca.length>0;)H2()}g();g();var x9=-7169;function ot(r,e){r.f=r.f&x9|e}function Ac(r){(r.f&512)!==0||r.deps===null?ot(r,1024):ot(r,4096)}function dm(r,e){(r.f&2048)!==0?e.set(r,2048):(r.f&4096)!==0&&e.get(r)!==2048&&e.set(r,4096),ot(r,1024)}g();function U2(r){return`{${r.toString().replace(/^async \(\) => /,"").replace(/^\(/,"").replace(/\$\.get\((.+?)\)/g,(e,t)=>t).replace(/\$\.track_reactivity_loss\((.+?)\)\(\)/g,(e,t)=>t).replace(/\)$/,"")}}`}g();g();g();function $y(r){ue&&dr(r)!==null&&Cc(r)}var j2=!1;function Py(){j2||(j2=!0,document.addEventListener("reset",r=>{Promise.resolve().then(()=>{var e;if(!r.defaultPrevented)for(let t of r.target.elements)(e=t[Ea])==null||e.call(t)})},{capture:!0}))}function Br(r){var e=he,t=ie;Jt(null),er(null);try{return r()}finally{Jt(e),er(t)}}function Iy(r,e,t,n=t){r.addEventListener(e,()=>Br(t));let i=r[Ea];i?r[Ea]=()=>{i(),n(!0)}:r[Ea]=()=>n(!0),Py()}g();function hm(r,e,t,n){let i=ns()?Ro:Pa;var s=r.filter(h=>!h.settled),o=e.map(i);if(N&&o.forEach((h,p)=>{h.label=e[p].toString().replace("() => ","").replaceAll("$.eager(() => ","$state.eager(").replace(/\$\.get\((.+?)\)/g,(m,w)=>w)}),t.length===0&&s.length===0){n(o);return}var a=ie,l=z2(),c=s.length===1?s[0].promise:s.length>1?Promise.all(s.map(h=>h.promise)):null;function u(h){if((a.f&16384)===0){l();try{n([...o,...h])}catch(p){cn(p,a)}Tc()}}var f=Oy();if(t.length===0){c.then(()=>u([])).finally(f);return}function d(){Promise.all(t.map(h=>My(h))).then(u).catch(h=>cn(h,a)).finally(f)}c?c.then(()=>{if((a.f&16384)!==0){f();return}l(),d(),Tc()}):d()}function z2(){var r=ie,e=he,t=Pe,n=ve;if(N)var i=Ai;return function(o=!0){er(r),Jt(e),Hs(t),o&&(r.f&16384)===0&&(n==null||n.activate(),n==null||n.apply()),N&&(Fy(null),kc(i))}}var E9=!1;function Tc(r=!0){var e;E9=!1,er(null),Jt(null),Hs(null),r&&((e=ve)==null||e.deactivate()),N&&(Fy(null),kc(null))}function Oy(){var r=ie,e=r.b,t=ve,n=!!(e!=null&&e.is_rendered());return e==null||e.update_pending_count(1,t),t.increment(n,r),()=>{e==null||e.update_pending_count(-1,t),t.decrement(n,r)}}var un=null;function Fy(r){un=r}var Mf=new Set;function Ro(r){var e=2050;ie!==null&&(ie.f|=524288);let t={ctx:Pe,deps:null,effects:null,equals:om,f:e,fn:r,reactions:null,rv:0,v:lt,wv:0,parent:ie,ac:null};return N&&Si&&(t.created=ki("created at")),t}var Rc=Symbol("obsolete");function My(r,e,t){let n=ie;n===null&&S2();var i=void 0,s=$r(lt);N&&(s.label=e!=null?e:U2(r));var o=!he,a=new Set;return q2(()=>{var h,p;var l=ie;N&&(un={effect:l,effect_deps:new Set,warned:!1});var c=tm();i=c.promise;try{Promise.resolve(r()).then(c.resolve,m=>{m!==Ds&&c.reject(m)}).finally(Tc)}catch(m){c.reject(m),Tc()}if(N){if(un){if(l.deps!==null)for(let m=0;m<Gr;m+=1)un.effect_deps.add(l.deps[m]);if(hr!==null)for(let m=0;m<hr.length;m+=1)un.effect_deps.add(hr[m])}un=null}var u=ve;if(o){if((l.f&32768)!==0)var f=Oy();if((h=n.b)!=null&&h.is_rendered())(p=u.async_deriveds.get(l))==null||p.reject(Rc);else for(let m of a.values())m.reject(Rc);a.add(c),u.async_deriveds.set(l,c)}let d=(m,w=void 0)=>{N&&(un=null),f==null||f(),a.delete(c),w!==Rc&&(u.activate(),w?(s.f|=8388608,Ri(s,w)):((s.f&8388608)!==0&&(s.f^=8388608),N&&t!==void 0&&!s.equals(m)&&(Mf.add(s),setTimeout(()=>{Mf.has(s)&&(l.f&16384)===0&&(g2(s.label,t),Mf.delete(s))})),Ri(s,m)),u.deactivate())};c.promise.then(d,m=>d(null,m||"unknown"))}),Sr(()=>{for(let l of a)l.reject(Rc)}),N&&(s.f|=4194304),new Promise(l=>{function c(u){function f(){u===i?l(s):c(i)}u.then(f,f)}c(i)})}function He(r){let e=Ro(r);return Xt||gm(e),e}function Pa(r){let e=Ro(r);return e.equals=am,e}function V2(r){var e=r.effects;if(e!==null){r.effects=null;for(var t=0;t<e.length;t+=1)Rt(e[t])}}var Dy=[];function Df(r){var e,t=ie,n=r.parent;if(!Pn&&n!==null&&r.v!==lt&&(n.f&24576)!==0)return w2(),r.v;if(er(n),N){let i=Ia;pm(new Set);try{Ms.call(Dy,r)&&k2(),Dy.push(r),V2(r),e=mm(r)}finally{er(t),pm(i),Dy.pop()}}else try{V2(r),e=mm(r)}finally{er(t)}return e}function Ly(r){var t,n,i;var e=Df(r);if(!r.equals(e)&&(r.wv=$c(),(!((t=ve)!=null&&t.is_fork)||r.deps===null)&&(ve!==null?(ve.capture(r,e,!0),(n=oi)==null||n.capture(r,e,!0)):r.v=e,r.deps===null))){ot(r,1024);return}Pn||(zt!==null?(To()||(i=ve)!=null&&i.is_fork)&&zt.set(r,e):Ac(r))}function W2(r){var e;if(r.effects!==null)for(let t of r.effects)(t.teardown||t.ac)&&((e=t.teardown)==null||e.call(t),t.ac!==null&&Br(()=>{t.ac.abort(Ds),t.ac=null}),t.fn!==null&&(t.teardown=Cr),Oa(t,0),Lf(t))}function Ny(r){if(r.effects!==null)for(let e of r.effects)e.teardown&&e.fn!==null&&is(e)}var wm=null,Pc=null,ve=null,oi=null,zt=null,Gy=null,Ta=!1,By=!1,Oc=null,Hf=null,Y2=0,Hy=new Set,A9=1,Fc,Mc,Dc,js,Lc,ss,Gf,os,as,Nc,$o,Le,Uy,Z2,jy,Nf,zy,X2,Vy,Q2,Ic,J2,Bf,vm=class vm{constructor(){Re(this,Le);Xe(this,"id",A9++);Xe(this,"started",!1);Xe(this,"linked",!0);Xe(this,"prev",null);Xe(this,"next",null);Xe(this,"async_deriveds",new Map);Xe(this,"current",new Map);Xe(this,"previous",new Map);Re(this,Fc,new Set);Re(this,Mc,new Set);Re(this,Dc,0);Re(this,js,new Map);Re(this,Lc,null);Re(this,ss,[]);Re(this,Gf,[]);Re(this,os,new Map);Re(this,as,new Map);Re(this,Nc,new Set);Xe(this,"is_fork",!1);Re(this,$o,!1);Pc===null?wm=Pc=this:(Pc.next=this,this.prev=Pc),Pc=this}skip_effect(e){O(this,as).has(e)||O(this,as).set(e,{d:[],m:[]}),O(this,Nc).delete(e)}unskip_effect(e,t=n=>this.schedule(n)){var n=O(this,as).get(e);if(n){O(this,as).delete(e);for(var i of n.d)ot(i,2048),t(i);for(i of n.m)ot(i,4096),t(i)}O(this,Nc).add(e)}capture(e,t,n=!1){e.v!==lt&&!this.previous.has(e)&&this.previous.set(e,e.v),(e.f&8388608)===0&&(this.current.set(e,[t,n]),zt==null||zt.set(e,t)),this.is_fork||(e.v=t)}activate(){ve=this}deactivate(){ve=null,zt=null}flush(){try{N&&Hy.clear(),By=!0,ve=this,me(this,Le,Nf).call(this)}finally{if(Y2=0,Gy=null,Oc=null,Hf=null,By=!1,ve=null,zt=null,ai.clear(),N)for(let e of Hy)e.updated=null}}discard(){var e;for(let t of O(this,Mc))t(this);O(this,Mc).clear();for(let t of this.async_deriveds.values())t.reject(Rc);me(this,Le,Bf).call(this),(e=O(this,Lc))==null||e.resolve()}register_created_effect(e){O(this,Gf).push(e)}increment(e,t){var n;if(Se(this,Dc,O(this,Dc)+1),e){let i=(n=O(this,js).get(t))!=null?n:0;O(this,js).set(t,i+1)}}decrement(e,t){var n;if(Se(this,Dc,O(this,Dc)-1),e){let i=(n=O(this,js).get(t))!=null?n:0;i===1?O(this,js).delete(t):O(this,js).set(t,i-1)}O(this,$o)||(Se(this,$o,!0),Nt(()=>{Se(this,$o,!1),this.linked&&this.flush()}))}transfer_reactions(e){for(let[t,n]of e)this.add_dirty_reaction(t,n);e.clear()}add_dirty_reaction(e,t){(t===2048||O(this,os).get(e)!==2048)&&O(this,os).set(e,t)}oncommit(e){O(this,Fc).add(e)}ondiscard(e){O(this,Mc).add(e)}settled(){var e;return((e=O(this,Lc))!=null?e:Se(this,Lc,tm())).promise}static ensure(){if(ve===null){let e=ve=new vm;!By&&!Ta&&Nt(()=>{e.started||e.flush()})}return ve}apply(){var e;if(!Xt||!this.is_fork&&this.prev===null&&this.next===null){zt=null;return}zt=new Map;for(let[t,[n]]of this.current)zt.set(t,n);for(let t=wm;t!==null;t=t.next)if(!(t===this||t.is_fork)&&(t.id>=this.id||!me(e=t,Le,Vy).call(e,this)))for(let[n,i]of t.previous)zt.has(n)||zt.set(n,i)}schedule(e){var t;if(Gy=e,(t=e.b)!=null&&t.is_pending&&(e.f&16777228)!==0&&(e.f&32768)===0){e.b.defer_effect(e);return}O(this,ss).push(e)}};Fc=new WeakMap,Mc=new WeakMap,Dc=new WeakMap,js=new WeakMap,Lc=new WeakMap,ss=new WeakMap,Gf=new WeakMap,os=new WeakMap,as=new WeakMap,Nc=new WeakMap,$o=new WeakMap,Le=new WeakSet,Uy=function(){if(this.is_fork)return!0;for(let e of O(this,js).keys())if(!me(this,Le,Z2).call(this,e))return!0;return!1},Z2=function(e){for(var t=e;t!==null;t=t.parent)if(O(this,as).has(t))return!0;return!1},jy=function(){var e=[];for(let s of O(this,ss))if(!((s.f&16384)!==0||(s.f&6144)===0)){for(var t=s,n=!1;t.parent!==null;){t=t.parent;var i=t.f;if((i&96)!==0){if((i&1024)===0){n=!0;break}t.f^=1024}}n||e.push(t)}return Se(this,ss,[]),e},Nf=function(){var a,l,c,u;if(this.started=!0,N)for(let f of this.current.keys())Hy.add(f);for(let[f,d]of O(this,os))ot(f,d),this.schedule(f);this.apply();for(var e=Oc=[],t=[],n=Hf=[];O(this,ss).length>0;){Y2++>1e3&&(me(this,Le,Bf).call(this),C9());for(let f of me(this,Le,jy).call(this))try{me(this,Le,zy).call(this,f,e,t)}catch(d){throw rI(f),me(this,Le,Uy).call(this)||this.discard(),d}}if(ve=null,n.length>0){var i=vm.ensure();for(let f of n)i.schedule(f)}if(Oc=null,Hf=null,me(this,Le,Uy).call(this)){me(this,Le,Ic).call(this,t),me(this,Le,Ic).call(this,e);for(let[f,d]of O(this,as))tI(f,d);n.length>0&&me(a=ve,Le,Nf).call(a);return}let s=me(this,Le,X2).call(this);if(s){me(this,Le,Ic).call(this,t),me(this,Le,Ic).call(this,e),me(l=s,Le,Q2).call(l,this);return}O(this,os).clear();for(let f of O(this,Fc))f(this);O(this,Fc).clear(),oi=this,K2(t),K2(e),oi=null,(c=O(this,Lc))==null||c.resolve();var o=ve;O(this,Dc)===0&&(O(this,ss).length===0||o!==null)&&(me(this,Le,Bf).call(this),Xt&&(me(this,Le,J2).call(this),ve=o)),o!==null&&(ai.clear(),me(u=o,Le,Nf).call(u))},zy=function(e,t,n){e.f^=1024;for(var i=e.first;i!==null;){var s=i.f,o=(s&96)!==0,a=o&&(s&1024)!==0,l=a||(s&8192)!==0||O(this,as).has(i);if(!l&&i.fn!==null){o?i.f^=1024:(s&4)!==0?t.push(i):Xt&&(s&16777224)!==0?n.push(i):Io(i)&&((s&16)!==0&&this.add_dirty_reaction(i,4096),is(i));var c=i.first;if(c!==null){i=c;continue}}for(;i!==null;){var u=i.next;if(u!==null){i=u;break}i=i.parent}}},X2=function(){for(var e=this.prev;e!==null;e=e.prev)if(!e.is_fork&&me(this,Le,Vy).call(this,e))return e;return null},Vy=function(e){for(let[t,[,n]]of this.current)if(!n&&e.current.has(t))return!0;return!1},Q2=function(e){var n;for(let[i,s]of e.current)!this.previous.has(i)&&e.previous.has(i)&&this.previous.set(i,e.previous.get(i)),this.current.set(i,s);for(let[i,s]of e.async_deriveds){let o=this.async_deriveds.get(i);o&&s.promise.then(o.resolve).catch(o.reject)}e.async_deriveds.clear(),this.transfer_reactions(O(e,os));let t=i=>{var s=i.reactions;if(s!==null&&!((i.f&2)!==0&&(i.f&6144)===0))for(let l of s){var o=l.f;if((o&2)!==0)t(l);else{var a=l;o&4194320&&!this.async_deriveds.has(a)&&(O(this,os).delete(a),ot(a,2048),this.schedule(a))}}};for(let i of this.current.keys())t(i);this.oncommit(()=>e.discard()),me(n=e,Le,Bf).call(n),ve=this,me(this,Le,Nf).call(this)},Ic=function(e){for(var t=0;t<e.length;t+=1)dm(e[t],O(this,os))},J2=function(){var f,d;for(let h=wm;h!==null;h=h.next){var e=h.id<this.id,t=[];for(let[p,[m,w]]of this.current){if(h.current.has(p)){var n=h.current.get(p)[0];if(e&&m!==n)h.current.set(p,[m,w]);else continue}t.push(p)}if(e)for(let[p,m]of this.async_deriveds){let w=h.async_deriveds.get(p);w&&m.promise.then(w.resolve).catch(w.reject)}var i=[...h.current.keys()].filter(p=>!h.current.get(p)[1]);if(!(!h.started||i.length===0)){var s=i.filter(p=>!this.current.has(p));if(s.length===0)e&&h.discard();else if(t.length>0){if(N&&!O(h,$o)&&B2(O(h,ss).length===0,"Batch has scheduled effects"),e)for(let p of O(this,Nc))h.unskip_effect(p,m=>{var w;(m.f&4194320)!==0?h.schedule(m):me(w=h,Le,Ic).call(w,[m])});h.activate();var o=new Set,a=new Map;for(var l of t)eI(l,s,o,a);a=new Map;var c=[...h.current].filter(([p,m])=>{let w=this.current.get(p);return w?w[0]!==m[0]||w[1]!==m[1]:!0}).map(([p])=>p);if(c.length>0)for(let p of O(this,Gf))(p.f&155648)===0&&Wy(p,c,a)&&((p.f&4194320)!==0?(ot(p,2048),h.schedule(p)):h.add_dirty_reaction(p,2048));if(O(h,ss).length>0&&!O(h,$o)){h.apply();for(var u of me(f=h,Le,jy).call(f))me(d=h,Le,zy).call(d,u,[],[])}h.deactivate()}}}},Bf=function(){if(this.linked){var e=this.prev,t=this.next;e===null?wm=t:e.next=t,t===null?Pc=e:t.prev=e,this.linked=!1}};var In=vm;function Po(r){var e=Ta,t=oi;oi=null,Ta=!0;try{var n;for(r&&(Po(),n=r());;){if(G2(),ve===null)return n;ve.flush()}}finally{Ta=e,oi=t}}function C9(){var t;if(N){var r=new Map;for(let n of ve.current.keys())for(let[i,s]of(t=n.updated)!=null?t:[]){var e=r.get(i);e||(e={error:s.error,count:0},r.set(i,e)),e.count+=s.count}for(let n of r.values())n.error&&console.error(n.error)}try{$2()}catch(n){N&&ur(n,"stack",{value:""}),cn(n,Gy)}}var fn=null;function K2(r){var e=r.length;if(e!==0){for(var t=0;t<e;){var n=r[t++];if((n.f&24576)===0&&Io(n)&&(fn=new Set,is(n),n.deps===null&&n.first===null&&n.nodes===null&&n.teardown===null&&n.ac===null&&qy(n),(fn==null?void 0:fn.size)>0)){ai.clear();for(let i of fn){if((i.f&24576)!==0)continue;let s=[i],o=i.parent;for(;o!==null;)fn.has(o)&&(fn.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){let l=s[a];(l.f&24576)===0&&is(l)}}fn.clear()}}fn=null}}function eI(r,e,t,n){if(!t.has(r)&&(t.add(r),r.reactions!==null))for(let i of r.reactions){let s=i.f;(s&2)!==0?eI(i,e,t,n):(s&4194320)!==0&&(s&2048)===0&&Wy(i,e,n)&&(ot(i,2048),Uf(i))}}function Wy(r,e,t){let n=t.get(r);if(n!==void 0)return n;if(r.deps!==null)for(let i of r.deps){if(Ms.call(e,i))return!0;if((i.f&2)!==0&&Wy(i,e,t))return t.set(i,!0),!0}return t.set(r,!1),!1}function Uf(r){ve.schedule(r)}function tI(r,e){if(!((r.f&32)!==0&&(r.f&1024)!==0)){(r.f&2048)!==0?e.d.push(r):(r.f&4096)!==0&&e.m.push(r),ot(r,1024);for(var t=r.first;t!==null;)tI(t,e),t=t.next}}function rI(r){ot(r,1024);for(var e=r.first;e!==null;)rI(e),e=e.next}var Ia=new Set,ai=new Map;function pm(r){Ia=r}var Ky=!1;function iI(){Ky=!0}function $r(r,e){var t={f:0,v:r,reactions:null,equals:om,rv:0,wv:0};return N&&Si&&(t.created=e!=null?e:ki("created at"),t.updated=null,t.set_during_effect=!1,t.trace=null),t}function Ie(r,e){let t=$r(r,e);return gm(t),t}function Da(r,e=!1,t=!0){var i,s;let n=$r(r);return e||(n.equals=am),Bs&&t&&Pe!==null&&Pe.l!==null&&((s=(i=Pe.l).s)!=null?s:i.s=[]).push(n),n}function X(r,e,t=!1){he!==null&&(!Ur||(he.f&131072)!==0)&&ns()&&(he.f&4325394)!==0&&(dn===null||!dn.has(r))&&D2();let n=t?at(e):e;return N&&um(n,r.label),Ri(r,n,Hf)}var Ma=null,Yy=0;function Ri(r,e,t=null){var i,s,o;if(!r.equals(e)){Pn?ai.set(r,e):ai.has(r)||ai.set(r,r.v);var n=In.ensure();if(n.capture(r,e),N){if(Si||ie!==null){(i=r.updated)!=null||(r.updated=new Map);let a=((o=(s=r.updated.get(""))==null?void 0:s.count)!=null?o:0)+1;if(r.updated.set("",{error:null,count:a}),Si||a>5){let l=ki("updated at");if(l!==null){let c=r.updated.get(l.stack);c||(c={error:l,count:0},r.updated.set(l.stack,c)),c.count++}}}ie!==null&&(r.set_during_effect=!0)}if((r.f&2)!==0){let a=r;(r.f&2048)!==0&&Df(a),zt===null&&Ac(a)}r.wv=$c(),Ma=null,Yy=0,sI(r,2048,t),Ma=null,ns()&&ie!==null&&(ie.f&1024)!==0&&(ie.f&96)===0&&(On===null?oI([r]):On.push(r)),!n.is_fork&&Ia.size>0&&!Ky&&bm()}return e}function bm(){Ky=!1;for(let r of Ia){(r.f&1024)!==0&&ot(r,4096);let e;try{e=Io(r)}catch(t){e=!0}e&&is(r)}Ia.clear()}function La(r){X(r,r.v+1)}function sI(r,e,t){var d;var n=r.reactions;if(n!==null){var i=ns(),s=n.length;if(Yy+=s,Yy>1e5&&Ma===null&&(Ma=new Set),Ma!==null){if(Ma.has(r))return;Ma.add(r)}for(var o=0;o<s;o++){var a=n[o],l=a.f;if(!(!i&&a===ie)){var c=(l&2048)===0;if(c&&ot(a,e),(l&131072)!==0)Ia.add(a);else if((l&2)!==0){var u=a;(d=zt)==null||d.delete(u),sI(u,4096,t)}else if(c){var f=a;(l&16)!==0&&fn!==null&&fn.add(f),t!==null?t.push(f):Uf(f)}}}}}var R9=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function at(r){if(typeof r!="object"||r===null||Nr in r||rm in r)return r;let e=_c(r);if(e!==yy&&e!==d2)return r;var t=new Map,n=Fs(r),i=Ie(0),s=N&&Si?ki("created at"):null,o=Oo,a=f=>{if(Oo===o)return f();var d=he,h=Oo;Jt(null),Zy(o);var p=f();return Jt(d),Zy(h),p};n&&(t.set("length",Ie(r.length,s)),N&&(r=P9(r)));var l="";let c=!1;function u(f){if(!c){c=!0,l=f,Rr(i,`${l} version`);for(let[d,h]of t)Rr(h,Na(l,d));c=!1}}return new Proxy(r,{defineProperty(f,d,h){(!("value"in h)||h.configurable===!1||h.enumerable===!1||h.writable===!1)&&F2();var p=t.get(d);return p===void 0?a(()=>{var m=Ie(h.value,s);return t.set(d,m),N&&typeof d=="string"&&Rr(m,Na(l,d)),m}):X(p,h.value,!0),!0},deleteProperty(f,d){var h=t.get(d);if(h===void 0){if(d in f){let p=a(()=>Ie(lt,s));t.set(d,p),La(i),N&&Rr(p,Na(l,d))}}else X(h,lt),La(i);return!0},get(f,d,h){var y;if(d===Nr)return r;if(N&&d===nm)return u;var p=t.get(d),m=d in f;if(p===void 0&&(!m||(y=an(f,d))!=null&&y.writable)&&(p=a(()=>{var v=at(m?f[d]:lt),A=Ie(v,s);return N&&Rr(A,Na(l,d)),A}),t.set(d,p)),p!==void 0){var w=R(p);return w===lt?void 0:w}return Reflect.get(f,d,h)},getOwnPropertyDescriptor(f,d){var w;(w=this.has)==null||w.call(this,f,d);var h=Reflect.getOwnPropertyDescriptor(f,d),p=t.get(d);if(p!==void 0){var m=R(p);if(m===lt)return;if(h&&"value"in h)h.value=m;else return{enumerable:!0,configurable:!0,value:m,writable:!0}}return h},has(f,d){var w;if(d===Nr)return!0;var h=t.get(d),p=h!==void 0&&h.v!==lt||Reflect.has(f,d);if(h!==void 0||(ie!==null||he!==null)&&(!p||(w=an(f,d))!=null&&w.writable)){h===void 0&&(h=a(()=>{var y=p?at(f[d]):lt,v=Ie(y,s);return N&&Rr(v,Na(l,d)),v}),t.set(d,h));var m=R(h);if(m===lt)return!1}return p},set(f,d,h,p){var b;var m=t.get(d),w=d in f;if(n&&d==="length")for(var y=h;y<m.v;y+=1){var v=t.get(y+"");v!==void 0?X(v,lt):y in f&&(v=a(()=>Ie(lt,s)),t.set(y+"",v),N&&Rr(v,Na(l,y)))}if(m===void 0)(!w||(b=an(f,d))!=null&&b.writable)&&(m=a(()=>Ie(void 0,s)),N&&Rr(m,Na(l,d)),X(m,at(h)),t.set(d,m));else{w=m.v!==lt;var A=a(()=>at(h));X(m,A)}var C=Reflect.getOwnPropertyDescriptor(f,d);if(C!=null&&C.set&&C.set.call(p,h),!w){if(n&&typeof d=="string"){var S=t.get("length"),T=Number(d);Number.isInteger(T)&&T>=S.v&&X(S,T+1)}La(i)}return!0},ownKeys(f){R(i);var d=Reflect.ownKeys(f).filter(m=>{var w=t.get(m);return w===void 0||w.v!==lt});for(var[h,p]of t)p.v!==lt&&!(h in f)&&d.push(h);return d},setPrototypeOf(){M2()}})}function Na(r,e){var t;return typeof e=="symbol"?`${r}[Symbol(${(t=e.description)!=null?t:""})]`:R9.test(e)?`${r}.${e}`:/^\d+$/.test(e)?`${r}[${e}]`:`${r}['${e}']`}function ym(r){try{if(r!==null&&typeof r=="object"&&Nr in r)return r[Nr]}catch(e){}return r}var $9=new Set(["copyWithin","fill","pop","push","reverse","shift","sort","splice","unshift"]);function P9(r){return new Proxy(r,{get(e,t,n){var i=Reflect.get(e,t,n);return $9.has(t)?function(...s){iI();var o=i.apply(this,s);return bm(),o}:i}})}function aI(){let r=Array.prototype,e=Array.__svelte_cleanup;e&&e();let{indexOf:t,lastIndexOf:n,includes:i}=r;r.indexOf=function(s,o){let a=t.call(this,s,o);if(a===-1){for(let l=o!=null?o:0;l<this.length;l+=1)if(ym(this[l])===s){sm("array.indexOf(...)");break}}return a},r.lastIndexOf=function(s,o){let a=n.call(this,s,o!=null?o:this.length-1);if(a===-1){for(let l=0;l<=(o!=null?o:this.length-1);l+=1)if(ym(this[l])===s){sm("array.lastIndexOf(...)");break}}return a},r.includes=function(s,o){let a=i.call(this,s,o);if(!a){for(let l=0;l<this.length;l+=1)if(ym(this[l])===s){sm("array.includes(...)");break}}return a},Array.__svelte_cleanup=()=>{r.indexOf=t,r.lastIndexOf=n,r.includes=i}}var Xy,lI,jf,cI,uI;function _m(){if(Xy===void 0){Xy=window,lI=document,jf=/Firefox/.test(navigator.userAgent);var r=Element.prototype,e=Node.prototype,t=Text.prototype;cI=an(e,"firstChild").get,uI=an(e,"nextSibling").get,_y(r)&&(r[Rf]=void 0,r[im]=null,r[Ey]=void 0,r.__e=void 0),_y(t)&&(t[$f]=void 0),N&&(r.__svelte_meta=null,aI())}}function Vt(r=""){return document.createTextNode(r)}function dr(r){return cI.call(r)}function yr(r){return uI.call(r)}function W(r,e){if(!ue)return dr(r);var t=dr(Ee);if(t===null)t=Ee.appendChild(Vt());else if(e&&t.nodeType!==xc){var n=Vt();return t==null||t.before(n),st(n),n}return e&&Em(t),st(t),t}function Fn(r,e=!1){var i,s;if(!ue){var t=dr(r);return t instanceof Comment&&t.data===""?yr(t):t}if(e){if(((i=Ee)==null?void 0:i.nodeType)!==xc){var n=Vt();return(s=Ee)==null||s.before(n),st(n),n}Em(Ee)}return Ee}function Ye(r,e=!1){if(!ue)return dr(r);var t=W(r,e);return V(r),t}function K(r,e=1,t=!1){let n=ue?Ee:r;for(var i;e--;)i=n,n=yr(n);if(!ue)return n;if(t){if((n==null?void 0:n.nodeType)!==xc){var s=Vt();return n===null?i==null||i.after(s):n.before(s),st(s),s}Em(n)}return st(n),n}function Cc(r){r.textContent=""}function xm(){if(!Xt||fn!==null)return!1;var r=ie.f;return(r&32768)!==0}function $i(r,e,t){return e==null||e===Qp?t?document.createElement(r,{is:t}):document.createElement(r):t?document.createElementNS(e,r,{is:t}):document.createElementNS(e,r)}function Em(r){if(r.nodeValue.length<65536)return;let e=r.nextSibling;for(;e!==null&&e.nodeType===xc;)e.remove(),r.nodeValue+=e.nodeValue,e=r.nextSibling}var Qy=new WeakMap;function fI(r){var e=ie;if(e===null)return he.f|=8388608,r;if(N&&r instanceof Error&&!Qy.has(r)&&Qy.set(r,I9(r,e)),(e.f&32768)===0&&(e.f&4)===0)throw N&&!e.parent&&r instanceof Error&&dI(r),r;cn(r,e)}function cn(r,e){if(r===Rn)throw r;if(!(e!==null&&(e.f&16384)!==0)){for(;e!==null;){if((e.f&128)!==0&&(e.f&33570816)===0){if((e.f&32768)===0)throw r;try{e.b.error(r);return}catch(t){r=t}}e=e.parent}throw N&&r instanceof Error&&dI(r),r}}function I9(r,e){var o,a,l;let t=an(r,"message");if(!(t&&!t.configurable)){for(var n=jf?" ":" ",i=`
${n}in ${((o=e.fn)==null?void 0:o.name)||"<unknown>"}`,s=e.ctx;s!==null;)i+=`
${n}in ${(a=s.function)==null?void 0:a[ni].split("/").pop()}`,s=s.p;return{message:r.message+`
${i}
`,stack:(l=r.stack)==null?void 0:l.split(`
`).filter(c=>!c.includes("svelte/src/internal")).join(`
`)}}}function dI(r){let e=Qy.get(r);e&&(ur(r,"message",{value:e.message}),ur(r,"stack",{value:e.stack}))}function pI(r){ie===null&&(he===null&&R2(r),T2()),Pn&&C2(r)}function F9(r,e){var t=e.last;t===null?e.last=e.first=r:(t.next=r,r.prev=t,e.last=r)}function Pi(r,e){var o,a;var t=ie;if(N)for(;t!==null&&(t.f&131072)!==0;)t=t.parent;t!==null&&(t.f&8192)!==0&&(r|=8192);var n={ctx:Pe,deps:null,nodes:null,f:r|2048|512,first:null,fn:e,last:null,next:null,parent:t,b:t&&t.b,prev:null,teardown:null,wv:0,ac:null};N&&(n.component_function=Ci),(o=ve)==null||o.register_created_effect(n);var i=n;if((r&4)!==0)Oc!==null?Oc.push(n):In.ensure().schedule(n);else if(e!==null){try{is(n)}catch(l){throw Rt(n),l}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&(i.f&524288)===0&&(i=i.first,(r&16)!==0&&(r&65536)!==0&&i!==null&&(i.f|=65536))}if(i!==null&&(i.parent=t,t!==null&&F9(i,t),he!==null&&(he.f&2)!==0&&(r&64)===0)){var s=he;((a=s.effects)!=null?a:s.effects=[]).push(i)}return n}function To(){return he!==null&&!Ur}function Sr(r){let e=Pi(8,null);return ot(e,1024),e.teardown=r,e}function tr(r){var i;pI("$effect"),N&&ur(r,"name",{value:"$effect"});var e=ie.f,t=!he&&(e&32)!==0&&Pe!==null&&!Pe.i;if(t){var n=Pe;((i=n.e)!=null?i:n.e=[]).push(r)}else return Ry(r)}function Ry(r){return Pi(1048580,r)}function t_(r){In.ensure();let e=Pi(524352,r);return()=>{Rt(e)}}function mI(r){In.ensure();let e=Pi(524352,r);return(t={})=>new Promise(n=>{t.outro?ls(e,()=>{Rt(e),n(void 0)}):(Rt(e),n(void 0))})}function jr(r){return Pi(4,r)}function q2(r){return Pi(4718592,r)}function kr(r,e=0){return Pi(8|e,r)}function Ue(r,e=[],t=[],n=[]){hm(n,e,t,i=>{Pi(8,()=>{r(...i.map(R))})})}function Mn(r,e=0){var t=Pi(16|e,r);return N&&(t.dev_stack=Ai),t}function r_(r,e=0){var t=Pi(16777216|e,r);return N&&(t.dev_stack=Ai),t}function Wt(r){return Pi(524320,r)}function n_(r){var e=r.teardown;if(e!==null){let t=Pn,n=he;Jy(!0),Jt(null);try{e.call(null)}catch(i){cn(i,r.parent)}finally{Jy(t),Jt(n)}}}function Lf(r,e=!1){var t=r.first;for(r.first=r.last=null;t!==null;){let i=t.ac;i!==null&&Br(()=>{i.abort(Ds)});var n=t.next;(t.f&64)!==0?t.parent=null:Rt(t,e),t=n}}function gI(r){for(var e=r.first;e!==null;){var t=e.next;(e.f&32)===0&&Rt(e),e=t}}function Rt(r,e=!0){var t=!1;(e||(r.f&262144)!==0)&&r.nodes!==null&&r.nodes.end!==null&&(wI(r.nodes.start,r.nodes.end),t=!0),r.f|=33554432,Lf(r,e&&!t),Oa(r,0);var n=r.nodes&&r.nodes.t;if(n!==null)for(let s of n)s.stop();n_(r),r.f^=33554432,r.f|=16384;var i=r.parent;i!==null&&i.first!==null&&qy(r),N&&(r.component_function=null),r.next=r.prev=r.teardown=r.ctx=r.deps=r.fn=r.nodes=r.ac=r.b=null}function wI(r,e){for(;r!==null;){var t=r===e?null:yr(r);r.remove(),r=t}}function qy(r){var e=r.parent,t=r.prev,n=r.next;t!==null&&(t.next=n),n!==null&&(n.prev=t),e!==null&&(e.first===r&&(e.first=n),e.last===r&&(e.last=t))}function ls(r,e,t=!0){var n=[];r.f|=256,vI(r,n,!0);var i=()=>{t&&Rt(r),e&&e()},s=n.length;if(s>0){var o=()=>--s||i();for(var a of n)a.out(o)}else i()}function vI(r,e,t){if((r.f&8192)===0){r.f^=8192;var n=r.nodes&&r.nodes.t;if(n!==null)for(let a of n)(a.is_global||t)&&e.push(a);for(var i=r.first;i!==null;){var s=i.next;if((i.f&64)===0){var o=(i.f&65536)!==0||(i.f&32)!==0&&(r.f&16)!==0;vI(i,e,o?t:!1)}i=s}}}function Bc(r){r.f&=-257,bI(r,!0)}function bI(r,e){if((r.f&256)===0&&(r.f&8192)!==0){r.f^=8192,(r.f&1024)===0&&(ot(r,2048),In.ensure().schedule(r));for(var t=r.first;t!==null;){var n=t.next,i=(t.f&65536)!==0||(t.f&32)!==0;bI(t,i?e:!1),t=n}var s=r.nodes&&r.nodes.t;if(s!==null)for(let o of s)(o.is_global||e)&&o.in()}}function Hc(r,e){if(r.nodes)for(var t=r.nodes.start,n=r.nodes.end;t!==null;){var i=t===n?null:yr(t);e.append(t),t=i}}g();var yI=null;var Pn=!1;function Jy(r){Pn=r}var he=null,Ur=!1;function Jt(r){he=r}var ie=null;function er(r){ie=r}var dn=null;function gm(r){he!==null&&(!Xt&&(he.f&2097152)!==0||(he.f&2)!==0)&&(dn!=null?dn:dn=new Set).add(r)}var hr=null,Gr=0,On=null;function oI(r){On=r}var xI=1,Ba=0,Oo=Ba;function Zy(r){Oo=r}function $c(){return++xI}function Io(r){var e=r.f;if((e&2048)!==0)return!0;if((e&4096)!==0){for(var t=r.deps,n=t.length,i=0;i<n;i++){var s=t[i];if(Io(s)&&Ly(s),s.wv>r.wv)return!0}(e&512)!==0&&zt===null&&ot(r,1024)}return!1}function EI(r,e,t=!0){var n=r.reactions;if(n!==null&&!(!Xt&&dn!==null&&dn.has(r)))for(var i=0;i<n.length;i++){var s=n[i];(s.f&2)!==0?EI(s,e,!1):e===s&&(t?ot(s,2048):(s.f&1024)!==0&&ot(s,4096),Uf(s))}}function mm(r){var e=hr,t=Gr,n=On,i=he,s=dn,o=Pe,a=Ur,l=Oo,c=r.f;hr=null,Gr=0,On=null,he=(c&96)===0?r:null,dn=null,Hs(r.ctx),Ur=!1,Oo=++Ba,r.ac!==null&&(Br(()=>{r.ac.abort(Ds)}),r.ac=null);try{r.f|=2097152;var u=r.fn,f=u();r.f|=32768;var d=_I(r);if(ns()&&On!==null&&!Ur&&d!==null&&(r.f&6146)===0)for(var h=0;h<On.length;h++)EI(On[h],r);if(i!==null&&i!==r){if(Ba++,i.deps!==null)for(let p=0;p<t;p+=1)i.deps[p].rv=Ba;if(e!==null)for(let p of e)p.rv=Ba;On!==null&&(n===null?n=On:n.push(...On))}return(r.f&8388608)!==0&&(r.f^=8388608),f}catch(p){return _I(r),fI(p)}finally{r.f^=2097152,hr=e,Gr=t,On=n,he=i,dn=s,Hs(o),Ur=a,Oo=l}}function _I(r){var i,s,o;var e=r.deps,t=(i=ve)==null?void 0:i.is_fork;if(hr!==null){var n;if(t||Oa(r,Gr),e!==null&&Gr>0)for(e.length=Gr+hr.length,n=0;n<hr.length;n++)e[Gr+n]=hr[n];else r.deps=e=hr;if(To()&&(r.f&512)!==0)for(n=Gr;n<e.length;n++)((o=(s=e[n]).reactions)!=null?o:s.reactions=[]).push(r)}else!t&&e!==null&&Gr<e.length&&(Oa(r,Gr),e.length=Gr);return e}function M9(r,e){let t=e.reactions;if(t!==null){var n=f2.call(t,r);if(n!==-1){var i=t.length-1;i===0?t=e.reactions=null:(t[n]=t[i],t.pop())}}if(t===null&&(e.f&2)!==0&&(hr===null||!Ms.call(hr,e))){var s=e;(s.f&512)!==0&&(s.f^=512),s.v!==lt&&Ac(s),s.ac!==null&&Br(()=>{s.ac.abort(Ds),s.ac=null,ot(s,2048)}),W2(s),Oa(s,0)}}function Oa(r,e){var t=r.deps;if(t!==null)for(var n=e;n<t.length;n++)M9(r,t[n])}function is(r){var a;var e=r.f;if((e&16384)===0){ot(r,1024);var t=ie;if(ie=r,N){var n=Ci;fm(r.component_function);var i=Ai;kc((a=r.dev_stack)!=null?a:Ai)}try{(e&16777232)!==0?gI(r):Lf(r),n_(r);var s=mm(r);if(r.teardown=typeof s=="function"?s:null,r.wv=xI,N&&Si&&(r.f&2048)!==0&&r.deps!==null)for(var o of r.deps)o.set_during_effect&&(o.wv=$c(),o.set_during_effect=!1)}finally{ie=t,N&&(fm(n),kc(i))}}}async function Sm(){if(Xt)return new Promise(r=>{requestAnimationFrame(()=>r()),setTimeout(()=>r())});await Promise.resolve(),Po()}function R(r){var h,p,m;var e=r.f,t=(e&2)!==0;if((h=yI)==null||h.add(r),he!==null&&!Ur){var n=ie!==null&&(ie.f&16384)!==0;if(!n&&(dn===null||!dn.has(r))){var i=he.deps;if((he.f&2097152)!==0)r.rv<Ba&&(r.rv=Ba,hr===null&&i!==null&&i[Gr]===r?Gr++:hr===null?hr=[r]:hr.push(r));else{(p=he.deps)!=null||(he.deps=[]),Ms.call(he.deps,r)||he.deps.push(r);var s=r.reactions;s===null?r.reactions=[he]:Ms.call(s,he)||s.push(he)}}}if(N){if(!Ur&&un&&ve===null&&oi===null&&!un.warned&&(un.effect.f&2097152)===0&&!un.effect_deps.has(r)){un.warned=!0,m2(r.label);var o=ki("traced at");o&&console.warn(o)}if(Mf.delete(r),Si&&!Ur&&If!==null&&he!==null&&If.reaction===he){if(r.trace)r.trace();else if(o=ki("traced at"),o){var a=If.entries.get(r);a===void 0&&(a={traces:[]},If.entries.set(r,a));var l=a.traces[a.traces.length-1];o.stack!==(l==null?void 0:l.stack)&&a.traces.push(o)}}}if(Pn&&ai.has(r))return ai.get(r);if(t){var c=r;if(Pn){var u=c.v;return((c.f&1024)===0&&c.reactions!==null||kI(c))&&(u=Df(c)),ai.set(c,u),u}var f=(c.f&512)===0&&!Ur&&he!==null&&(he.f&512)!==0,d=(c.f&32768)===0;Io(c)&&(f&&(c.f|=512),Ly(c)),f&&!d&&(Ny(c),SI(c))}if((m=zt)!=null&&m.has(r))return zt.get(r);if((r.f&8388608)!==0)throw r.v;return r.v}function SI(r){if(r.f|=512,r.deps!==null)for(let t of r.deps){var e=t.reactions;e===null?t.reactions=[r]:Ms.call(e,r)||e.push(r),(t.f&2)!==0&&(t.f&512)===0&&(Ny(t),SI(t))}}function kI(r){if(r.v===lt)return!0;if(r.deps===null)return!1;for(let e of r.deps)if(ai.has(e)||(e.f&2)!==0&&kI(e))return!0;return!1}function ct(r){var e=Ur;try{return Ur=!0,r()}finally{Ur=e}}g();g();g();var Ha=Symbol("events"),o_=new Set,km=new Set;function AI(r,e,t,n={}){function i(s){if(n.capture||Am.call(e,s),!s.cancelBubble)return Br(()=>t==null?void 0:t.call(this,s))}return r.startsWith("pointer")||r.startsWith("touch")||r==="wheel"?(i.__removed=!1,Nt(()=>{i.__removed||e.addEventListener(r,i,n)})):e.addEventListener(r,i,n),i}function pn(r,e,t,n,i){var s={capture:n,passive:i},o=AI(r,e,t,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&Sr(()=>{o.__removed=!0,e.removeEventListener(r,o,s)})}function de(r,e,t){var n;((n=e[Ha])!=null?n:e[Ha]={})[r]=t}function Ot(r){for(var e=0;e<r.length;e++)o_.add(r[e]);for(var t of km)t(r)}var i_=null,s_=!1;function Am(r){var m,w;var e=this,t=e.ownerDocument,n=r.type,i=((m=r.composedPath)==null?void 0:m.call(r))||[],s=i[0]||r.target;i_=r,s_||(s_=!0,setTimeout(()=>{s_=!1,i_=null}));var o=0,a=i_===r&&r[Ha];if(a){var l=i.indexOf(a);if(l!==-1&&(e===document||e===window)){r[Ha]=e;return}var c=i.indexOf(e);if(c===-1)return;l<=c&&(o=l)}if(s=i[o]||r.target,s!==e){ur(r,"currentTarget",{configurable:!0,get(){return s||t}});var u=he,f=ie;Jt(null),er(null);try{for(var d,h=[];s!==null&&s!==e;){try{var p=(w=s[Ha])==null?void 0:w[n];p!=null&&(!s.disabled||r.target===s)&&p.call(s,r)}catch(y){d?h.push(y):d=y}if(r.cancelBubble)break;o++,s=o<i.length?i[o]:null}if(d){for(let y of h)queueMicrotask(()=>{throw y});throw d}}finally{r[Ha]=e,delete r.currentTarget,Jt(u),er(f)}}}g();g();var CI,a_=((CI=globalThis==null?void 0:globalThis.window)==null?void 0:CI.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:r=>r});function TI(r){var e;return(e=a_==null?void 0:a_.createHTML(r))!=null?e:r}function l_(r){var e=$i("template");return e.innerHTML=TI(r.replaceAll("<!>","<!---->")),e.content}function Ii(r,e){var t=ie;t.nodes===null&&(t.nodes={start:r,end:e,a:null,t:null})}function pe(r,e){var t=(e&1)!==0,n=(e&2)!==0,i,s=!r.startsWith("<!>");return()=>{if(ue)return Ii(Ee,null),Ee;i===void 0&&(i=l_(s?r:"<!>"+r),t||(i=dr(i)));var o=n||jf?document.importNode(i,!0):i.cloneNode(!0);if(t){var a=dr(o),l=o.lastChild;Ii(a,l)}else Ii(o,o);return o}}function Vs(){if(ue)return Ii(Ee,null),Ee;var r=document.createDocumentFragment(),e=document.createComment(""),t=Vt();return r.append(e,t),Ii(e,t),r}function te(r,e){if(ue){var t=ie;((t.f&32768)===0||t.nodes.end===null)&&(t.nodes.end=Ee),Tr();return}r!==null&&r.before(e)}g();var G9=["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 Nie=[...G9,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var U9=["touchstart","touchmove"];function RI(r){return U9.includes(r)}var j9=["$state","$state.raw","$derived","$derived.by"],Bie=[...j9,"$state.eager","$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"];g();g();function $I(r){let e=0,t=$r(0),n;return N&&Rr(t,"createSubscriber version"),()=>{To()&&(R(t),kr(()=>(e===0&&(n=ct(()=>r(()=>La(t)))),e+=1,()=>{Nt(()=>{e-=1,e===0&&(n==null||n(),n=void 0,La(t))})})))}}var z9=589824;function m_(r,e,t,n){new u_(r,e,t,n)}var Dn,Wf,li,Ga,Pr,Ln,zr,Nn,cs,Ua,Mo,Gc,qf,us,Tm,Ge,II,OI,f_,Fo,FI,d_,Vf,Cm,h_,p_,u_=class{constructor(e,t,n,i){Re(this,Ge);Xe(this,"parent");Xe(this,"is_pending",!1);Xe(this,"transform_error");Re(this,Dn);Re(this,Wf,ue?Ee:null);Re(this,li);Re(this,Ga);Re(this,Pr);Re(this,Ln,null);Re(this,zr,null);Re(this,Nn,null);Re(this,cs,null);Re(this,Ua,0);Re(this,Mo,0);Re(this,Gc,!1);Re(this,qf,new Map);Re(this,us,null);Re(this,Tm,$I(()=>(Se(this,us,$r(O(this,Ua))),N&&Rr(O(this,us),"$effect.pending()"),()=>{Se(this,us,null)})));var s,o;Se(this,Dn,e),Se(this,li,t),Se(this,Ga,a=>{var l=ie;l.b=this,l.f|=128,n(a)}),this.parent=ie.b,this.transform_error=(o=i!=null?i:(s=this.parent)==null?void 0:s.transform_error)!=null?o:(a=>a),Se(this,Pr,Mn(()=>{if(ue){let a=Aa(O(this,Wf));Tr();let l=a==="[!";if(a.startsWith("[?")){let u=JSON.parse(a.slice("[?".length));me(this,Ge,OI).call(this,u)}else l?me(this,Ge,FI).call(this):me(this,Ge,II).call(this)}else me(this,Ge,d_).call(this)},z9)),ue&&Se(this,Dn,Ee)}defer_effect(e){dm(e,O(this,qf))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!O(this,li).pending}update_pending_count(e,t){me(this,Ge,h_).call(this,e,t),Se(this,Ua,O(this,Ua)+e),!(!O(this,us)||O(this,Gc))&&(Se(this,Gc,!0),Nt(()=>{Se(this,Gc,!1),O(this,us)&&Ri(O(this,us),O(this,Ua))}))}get_effect_pending(){return O(this,Tm).call(this),R(O(this,us))}error(e){var t;if(e===Rn||!O(this,li).onerror&&!O(this,li).failed)throw e;(t=ve)!=null&&t.is_fork?(O(this,Ln)&&ve.skip_effect(O(this,Ln)),O(this,zr)&&ve.skip_effect(O(this,zr)),O(this,Nn)&&ve.skip_effect(O(this,Nn)),ve.oncommit(()=>{me(this,Ge,Fo).call(this)||me(this,Ge,p_).call(this,e)})):me(this,Ge,p_).call(this,e)}};Dn=new WeakMap,Wf=new WeakMap,li=new WeakMap,Ga=new WeakMap,Pr=new WeakMap,Ln=new WeakMap,zr=new WeakMap,Nn=new WeakMap,cs=new WeakMap,Ua=new WeakMap,Mo=new WeakMap,Gc=new WeakMap,qf=new WeakMap,us=new WeakMap,Tm=new WeakMap,Ge=new WeakSet,II=function(){try{Se(this,Ln,Wt(()=>O(this,Ga).call(this,O(this,Dn))))}catch(e){this.error(e)}},OI=function(e){let t=O(this,li).failed,{reset:n,invoke_onerror:i}=me(this,Ge,f_).call(this,e);Nt(i),t&&Se(this,Nn,Wt(()=>{t(O(this,Dn),()=>e,()=>n)}))},f_=function(e){var t=!1,n=!1;let i=()=>{if(!me(this,Ge,Fo).call(this)){if(t){y2();return}t=!0,n&&L2(),O(this,Nn)!==null&&ls(O(this,Nn),()=>{Se(this,Nn,null)}),me(this,Ge,Cm).call(this,()=>{me(this,Ge,d_).call(this)})}};return{reset:i,invoke_onerror:()=>{var o,a;if(!me(this,Ge,Fo).call(this))try{n=!0,(a=(o=O(this,li)).onerror)==null||a.call(o,e,i),n=!1}catch(l){cn(l,O(this,Pr)&&O(this,Pr).parent)}}}},Fo=function(){return(O(this,Pr).f&33570816)!==0},FI=function(){let e=O(this,li).pending;e&&(this.is_pending=!0,Se(this,zr,Wt(()=>e(O(this,Dn)))),Nt(()=>{if(!me(this,Ge,Fo).call(this)){var t=Se(this,cs,document.createDocumentFragment()),n=Vt(),i=!1;if(t.append(n),Se(this,Ln,me(this,Ge,Cm).call(this,()=>{try{return Wt(()=>O(this,Ga).call(this,n))}catch(s){try{this.error(s),i=!0}catch(o){cn(o,O(this,Pr).parent)}return null}})),O(this,Ln)===null){Se(this,cs,null),i&&me(this,Ge,Vf).call(this,ve);return}O(this,Mo)===0&&(O(this,Dn).before(t),Se(this,cs,null),ls(O(this,zr),()=>{Se(this,zr,null)}),me(this,Ge,Vf).call(this,ve))}}))},d_=function(){try{if(this.is_pending=this.has_pending_snippet(),Se(this,Mo,0),Se(this,Ua,0),Se(this,Ln,Wt(()=>{O(this,Ga).call(this,O(this,Dn))})),O(this,Mo)>0){var e=Se(this,cs,document.createDocumentFragment());Hc(O(this,Ln),e);let t=O(this,li).pending;Se(this,zr,Wt(()=>t(O(this,Dn))))}else me(this,Ge,Vf).call(this,ve)}catch(t){this.error(t)}},Vf=function(e){this.is_pending=!1,e.transfer_reactions(O(this,qf))},Cm=function(e){var t=ie,n=he,i=Pe;er(O(this,Pr)),Jt(O(this,Pr)),Hs(O(this,Pr).ctx);try{return In.ensure(),e()}finally{er(t),Jt(n),Hs(i)}},h_=function(e,t){var n;if(!this.has_pending_snippet()){this.parent&&me(n=this.parent,Ge,h_).call(n,e,t);return}Se(this,Mo,O(this,Mo)+e),O(this,Mo)===0&&(me(this,Ge,Vf).call(this,t),O(this,zr)&&ls(O(this,zr),()=>{Se(this,zr,null)}),O(this,cs)&&(O(this,Dn).before(O(this,cs)),Se(this,cs,null)))},p_=function(e){O(this,Ln)&&(Rt(O(this,Ln)),Se(this,Ln,null)),O(this,zr)&&(Rt(O(this,zr)),Se(this,zr,null)),O(this,Nn)&&(Rt(O(this,Nn)),Se(this,Nn,null)),ue&&(st(O(this,Wf)),ka(),st(rs()));let t=O(this,li).failed,n=i=>{if(me(this,Ge,Fo).call(this))return;let{reset:s,invoke_onerror:o}=me(this,Ge,f_).call(this,i);o(),t&&!me(this,Ge,Fo).call(this)&&Se(this,Nn,me(this,Ge,Cm).call(this,()=>{try{return Wt(()=>{var a=ie;a.b=this,a.f|=128,t(O(this,Dn),()=>i,()=>s)})}catch(a){return cn(a,O(this,Pr).parent),null}}))};Nt(()=>{if(!me(this,Ge,Fo).call(this)){var i;try{i=this.transform_error(e)}catch(s){cn(s,O(this,Pr)&&O(this,Pr).parent);return}i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(n,s=>cn(s,O(this,Pr)&&O(this,Pr).parent)):n(i)}})};var $m=!0;function Ke(r,e){var n,i;var t=e==null?"":typeof e=="object"?`${e}`:e;t!==((i=r[n=$f])!=null?i:r[n]=r.nodeValue)&&(r[$f]=t,r.nodeValue=`${t}`)}function Do(r,e){return MI(r,e)}function w_(r,e){var o;_m(),e.intro=(o=e.intro)!=null?o:!1;let t=e.target,n=ue,i=Ee;try{for(var s=dr(t);s&&(s.nodeType!==ii||s.data!=="[");)s=yr(s);if(!s)throw Rn;Zt(!0),st(s);let a=MI(r,{...e,anchor:s});return Zt(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
`).some(l=>l.startsWith("https://svelte.dev/e/")))throw a;return a!==Rn&&console.warn("Failed to hydrate: ",a),e.recover===!1&&P2(),_m(),Cc(t),Zt(!1),Do(r,e)}finally{Zt(n),st(i)}}var Rm=new Map;function MI(r,{target:e,anchor:t,props:n={},events:i,context:s,intro:o=!0,transformError:a}){_m();var l=void 0,c=mI(()=>{var u=t!=null?t:e.appendChild(Vt());m_(u,{pending:()=>{}},h=>{gt({});var p=Pe;if(s&&(p.c=s),i&&(n.$$events=i),ue&&Ii(h,null),$m=o,l=r(h,n)||Of(),$m=!0,ue&&(ie.nodes.end=Ee,Ee===null||Ee.nodeType!==ii||Ee.data!=="]"))throw Sa(),Rn;wt()},a);var f=new Set,d=h=>{for(var p=0;p<h.length;p++){var m=h[p];if(!f.has(m)){f.add(m);var w=RI(m);for(let A of[e,document]){var y=Rm.get(A);y===void 0&&(y=new Map,Rm.set(A,y));var v=y.get(m);v===void 0?(A.addEventListener(m,Am,{passive:w}),y.set(m,1)):y.set(m,v+1)}}}};return d(yc(o_)),km.add(d),()=>{var w;for(var h of f)for(let y of[e,document]){var p=Rm.get(y),m=p.get(h);--m==0?(y.removeEventListener(h,Am),p.delete(h),p.size===0&&Rm.delete(y)):p.set(h,m)}km.delete(d),u!==t&&((w=u.parentNode)==null||w.removeChild(u))}});return g_.set(l,c),l}var g_=new WeakMap;function Ws(r,e){let t=g_.get(r);return t?(g_.delete(r),t(e)):(N&&b2(),Promise.resolve())}g();g();g();var Oi,fs,Bn,ja,Yf,Kf,Pm,qs=class{constructor(e,t=!0){Xe(this,"anchor");Re(this,Oi,new Map);Re(this,fs,new Map);Re(this,Bn,new Map);Re(this,ja,new Set);Re(this,Yf,!0);Re(this,Kf,e=>{if(O(this,Oi).has(e)){var t=O(this,Oi).get(e),n=O(this,fs).get(t);if(n)Bc(n),O(this,ja).delete(t);else{var i=O(this,Bn).get(t);i&&(Bc(i.effect),O(this,fs).set(t,i.effect),O(this,Bn).delete(t),N&&(i.fragment.lastChild[Sy]=this.anchor),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(let[s,o]of O(this,Oi)){if(O(this,Oi).delete(s),s===e)break;let a=O(this,Bn).get(o);a&&(Rt(a.effect),O(this,Bn).delete(o))}for(let[s,o]of O(this,fs)){if(s===t||O(this,ja).has(s))continue;let a=()=>{if(Array.from(O(this,Oi).values()).includes(s)){var c=document.createDocumentFragment();Hc(o,c),c.append(Vt()),O(this,Bn).set(s,{effect:o,fragment:c})}else Rt(o);O(this,ja).delete(s),O(this,fs).delete(s)};O(this,Yf)||!n?(O(this,ja).add(s),ls(o,a,!1)):a()}}});Re(this,Pm,e=>{O(this,Oi).delete(e);let t=Array.from(O(this,Oi).values());for(let[n,i]of O(this,Bn))t.includes(n)||(Rt(i.effect),O(this,Bn).delete(n))});this.anchor=e,Se(this,Yf,t)}ensure(e,t){var n=ve,i=xm();if(t&&!O(this,fs).has(e)&&!O(this,Bn).has(e))if(i){var s=document.createDocumentFragment(),o=Vt();s.append(o),O(this,Bn).set(e,{effect:Wt(()=>t(o)),fragment:s})}else O(this,fs).set(e,Wt(()=>t(this.anchor)));if(O(this,Oi).set(n,e),i){for(let[a,l]of O(this,fs))a===e?n.unskip_effect(l):n.skip_effect(l);for(let[a,l]of O(this,Bn))a===e?n.unskip_effect(l.effect):n.skip_effect(l.effect);n.oncommit(O(this,Kf)),n.ondiscard(O(this,Pm))}else ue&&(this.anchor=Ee),O(this,Kf).call(this,n)}};Oi=new WeakMap,fs=new WeakMap,Bn=new WeakMap,ja=new WeakMap,Yf=new WeakMap,Kf=new WeakMap,Pm=new WeakMap;if(N){let r=function(e){if(!(e in globalThis)){let t;Object.defineProperty(globalThis,e,{configurable:!0,get:()=>{if(t!==void 0)return t;O2(e)},set:n=>{t=n}})}};r("$state"),r("$effect"),r("$derived"),r("$inspect"),r("$props"),r("$bindable")}function za(r){Pe===null&&lm("onMount"),Bs&&Pe.l!==null?q9(Pe).m.push(r):tr(()=>{let e=ct(r);if(typeof e=="function")return e})}function q9(r){var t;var e=r.l;return(t=e.u)!=null?t:e.u={a:[],b:[],m:[]}}g();g();var NI=new Map;function BI(r,e){var t=NI.get(r);t||(t=new Set,NI.set(r,t)),t.add(e)}g();g();g();g();g();g();g();g();g();function Ae(r,e,t=!1){var n;ue&&(n=Ee,Tr());var i=new qs(r),s=t?65536:0;function o(a,l){if(ue){var c=Aa(n);if(a!==parseInt(c.substring(1))){var u=rs();st(u),i.anchor=u,Zt(!1),i.ensure(a,l),Zt(!0);return}}i.ensure(a,l)}Mn(()=>{var a=!1;e((l,c=0)=>{a=!0,o(c,l)}),a||o(-1,null)},s)}g();g();g();function mn(r,e){return e}function tz(r,e,t){var f;for(var n=[],i=e.length,s,o=e.length,a=0;a<i;a++){let d=e[a];ls(d,()=>{if(s){if(s.pending.delete(d),s.done.add(d),s.pending.size===0){var h=r.outrogroups;v_(r,yc(s.done)),h.delete(s),h.size===0&&(r.outrogroups=null)}}else o-=1},!1)}if(o===0){var l=n.length===0&&t!==null&&r.pending.size===0;if(l){var c=t,u=c.parentNode;Cc(u),u.append(c),r.items.clear()}v_(r,e,!l)}else s={pending:new Set(e),done:new Set},((f=r.outrogroups)!=null?f:r.outrogroups=new Set).add(s)}function v_(r,e,t=!0){var n;if(r.pending.size>0){n=new Set;for(let o of r.pending.values())for(let a of o)n.add(r.items.get(a).e)}for(var i=0;i<e.length;i++){var s=e[i];if(n!=null&&n.has(s)){s.f|=33554432;let o=document.createDocumentFragment();Hc(s,o)}else Rt(e[i],t)}}var Lo;function gn(r,e,t,n,i,s=null){var o=r,a=new Map,l=(e&4)!==0;if(l){var c=r;o=ue?st(dr(c)):c.appendChild(Vt())}ue&&Tr();var u=null,f=Pa(()=>{var v=t();return Fs(v)?v:v==null?[]:yc(v)});N&&Rr(f,"{#each ...}");var d=new Map,h=!0;function p(v){if((y.effect.f&16384)===0){y.pending.delete(v);var A=R(f);y.fallback=u,rz(y,A,o,e,n),u!==null&&(A.length===0?(u.f&33554432)===0?Bc(u):(u.f^=33554432,Xf(u,null,o)):ls(u,()=>{u=null}))}}function m(v){y.pending.delete(v)}var w=Mn(()=>{var v=R(f),A=v.length;let C=!1;if(ue){var S=Aa(o)==="[!";S!==(A===0)&&(o=rs(),st(o),Zt(!1),C=!0)}for(var T=new Set,b=ve,x=xm(),E=0;E<A;E+=1){ue&&Ee.nodeType===ii&&Ee.data==="]"&&(o=Ee,C=!0,Zt(!1));var k=v[E],$=n(k,E);if(N){var M=n(k,E);$!==M&&A2(String(E),String($),String(M))}var D=h?null:a.get($);D?(D.v&&Ri(D.v,k),D.i&&Ri(D.i,E),x&&b.unskip_effect(D.e)):(D=nz(a,h?o:Lo!=null?Lo:Lo=Vt(),k,$,E,i,e,t),h||(D.e.f|=33554432),a.set($,D)),T.add($)}if(A===0&&s&&!u&&(h?u=Wt(()=>s(o)):(u=Wt(()=>s(Lo!=null?Lo:Lo=Vt())),u.f|=33554432)),A>T.size&&(N?iz(v,n):Ty("","","")),ue&&A>0&&st(rs()),!h)if(d.set(b,T),x){for(let[P,F]of a)T.has(P)||b.skip_effect(F.e);b.oncommit(p),b.ondiscard(m)}else p(b);C&&Zt(!0),R(f)}),y={effect:w,flags:e,items:a,pending:d,outrogroups:null,fallback:u};h=!1,ue&&(o=Ee)}function Zf(r){for(;r!==null&&(r.f&32)===0;)r=r.next;return r}function rz(r,e,t,n,i){var k,$,M,D,P,F,_e,Q,oe;var s=(n&8)!==0,o=e.length,a=r.items,l=Zf(r.effect.first),c,u=null,f,d=[],h=[],p,m,w,y;if(s)for(y=0;y<o;y+=1)p=e[y],m=i(p,y),w=a.get(m).e,(w.f&33554432)===0&&(($=(k=w.nodes)==null?void 0:k.a)==null||$.measure(),(f!=null?f:f=new Set).add(w));for(y=0;y<o;y+=1){if(p=e[y],m=i(p,y),w=a.get(m).e,r.outrogroups!==null)for(let fe of r.outrogroups)fe.pending.delete(w),fe.done.delete(w);if((w.f&8192)!==0&&(Bc(w),s&&((D=(M=w.nodes)==null?void 0:M.a)==null||D.unfix(),(f!=null?f:f=new Set).delete(w))),(w.f&33554432)!==0)if(w.f^=33554432,w===l)Xf(w,null,t);else{var v=u?u.next:l;w===r.effect.last&&(r.effect.last=w.prev),w.prev&&(w.prev.next=w.next),w.next&&(w.next.prev=w.prev),No(r,u,w),No(r,w,v),Xf(w,v,t),u=w,d=[],h=[],l=Zf(u.next);continue}if(w!==l){if(c!==void 0&&c.has(w)){if(d.length<h.length){var A=h[0],C;u=A.prev;var S=d[0],T=d[d.length-1];for(C=0;C<d.length;C+=1)Xf(d[C],A,t);for(C=0;C<h.length;C+=1)c.delete(h[C]);No(r,S.prev,T.next),No(r,u,S),No(r,T,A),l=A,u=T,y-=1,d=[],h=[]}else c.delete(w),Xf(w,l,t),No(r,w.prev,w.next),No(r,w,u===null?r.effect.first:u.next),No(r,u,w),u=w;continue}for(d=[],h=[];l!==null&&l!==w;)(c!=null?c:c=new Set).add(l),h.push(l),l=Zf(l.next);if(l===null)continue}(w.f&33554432)===0&&d.push(w),u=w,l=Zf(w.next)}if(r.outrogroups!==null){for(let fe of r.outrogroups)fe.pending.size===0&&(v_(r,yc(fe.done)),(P=r.outrogroups)==null||P.delete(fe));r.outrogroups.size===0&&(r.outrogroups=null)}if(l!==null||c!==void 0){var b=[];if(c!==void 0)for(w of c)(w.f&8192)===0&&b.push(w);for(;l!==null;)(l.f&8192)===0&&l!==r.fallback&&b.push(l),l=Zf(l.next);var x=b.length;if(x>0){var E=(n&4)!==0&&o===0?t:null;if(s){for(y=0;y<x;y+=1)(_e=(F=b[y].nodes)==null?void 0:F.a)==null||_e.measure();for(y=0;y<x;y+=1)(oe=(Q=b[y].nodes)==null?void 0:Q.a)==null||oe.fix()}tz(r,b,E)}}s&&Nt(()=>{var fe,Z;if(f!==void 0)for(w of f)(Z=(fe=w.nodes)==null?void 0:fe.a)==null||Z.apply()})}function nz(r,e,t,n,i,s,o,a){var l=(o&1)!==0?(o&16)===0?Da(t,!1,!1):$r(t):null,c=(o&2)!==0?$r(i):null;return N&&l&&(l.trace=()=>{var u;a()[(u=c==null?void 0:c.v)!=null?u:i]}),{v:l,i:c,e:Wt(()=>(s(e,l!=null?l:t,c!=null?c:i,a),()=>{r.delete(n)}))}}function Xf(r,e,t){if(r.nodes)for(var n=r.nodes.start,i=r.nodes.end,s=e&&(e.f&33554432)===0?e.nodes.start:t;n!==null;){var o=yr(n);if(s.before(n),n===i)return;n=o}}function No(r,e,t){e===null?r.effect.first=t:e.next=t,t===null?r.effect.last=e:t.prev=e}function iz(r,e){let t=new Map,n=r.length;for(let i=0;i<n;i++){let s=e(r[i],i);if(t.has(s)){let o=String(t.get(s)),a=String(i),l=String(s);l.startsWith("[object ")&&(l=null),Ty(o,a,l)}t.set(s,i)}}g();g();g();g();g();g();g();var sz=Jp?()=>performance.now():()=>Date.now(),Fi={tick:r=>(Jp?requestAnimationFrame:Cr)(r),now:()=>sz(),tasks:new Set};function GI(){let r=Fi.now();Fi.tasks.forEach(e=>{e.c(r)||(Fi.tasks.delete(e),e.f())}),Fi.tasks.size!==0&&Fi.tick(GI)}function UI(r){let e;return Fi.tasks.size===0&&Fi.tick(GI),{promise:new Promise(t=>{Fi.tasks.add(e={c:r,f:t})}),abort(){Fi.tasks.delete(e)}}}function Im(r,e){Br(()=>{r.dispatchEvent(new CustomEvent(e))})}function cz(r){if(r==="float")return"cssFloat";if(r==="offset")return"cssOffset";if(r.startsWith("--"))return r;let e=r.split("-");return e.length===1?e[0]:e[0]+e.slice(1).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function jI(r){let e={},t=r.split(";");for(let n of t){let[i,s]=n.split(":");if(!i||s===void 0)break;let o=cz(i.trim());e[o]=s.trim()}return e}var uz=r=>r;function ci(r,e,t,n){var A,C;var i=(r&1)!==0,s=(r&2)!==0,o=i&&s,a=(r&4)!==0,l=o?"both":i?"in":"out",c,u=e.inert,f=e.style.overflow,d,h;function p(){return Br(()=>{var S;return c!=null?c:c=t()(e,(S=n==null?void 0:n())!=null?S:{},{direction:l})})}var m={is_global:a,in(){var S;if(e.inert=u,!i){h==null||h.abort(),(S=h==null?void 0:h.reset)==null||S.call(h);return}s||d==null||d.abort(),d=b_(e,p(),h,1,()=>{Im(e,"introstart")},()=>{Im(e,"introend"),d==null||d.abort(),d=c=void 0,e.style.overflow=f})},out(S){if(!s){S==null||S(),c=void 0;return}e.inert=!0,h=b_(e,p(),d,0,()=>{Im(e,"outrostart")},()=>{Im(e,"outroend"),S==null||S()})},stop:()=>{d==null||d.abort(),h==null||h.abort()}},w=ie;if(((C=(A=w.nodes).t)!=null?C:A.t=[]).push(m),i&&$m){var y=a;if(!y){for(var v=w.parent;v&&(v.f&65536)!==0;)for(;(v=v.parent)&&(v.f&16)===0;);y=!v||(v.f&32768)!==0}y&&jr(()=>{ct(()=>m.in())})}}function b_(r,e,t,n,i,s){var o=n===1,a=!1;if(xy(e)){var l;return Nt(()=>{if(!a){var m=e({direction:o?"in":"out"});l=b_(r,m,t,n,i,s)}}),{abort:()=>{a=!0,l==null||l.abort()},deactivate:()=>l==null?void 0:l.deactivate(),reset:()=>l==null?void 0:l.reset(),t:()=>{var m;return(m=l==null?void 0:l.t())!=null?m:1-n}}}if(t==null||t.deactivate(),!(e!=null&&e.duration)&&!(e!=null&&e.delay))return i(),s(),{abort:Cr,deactivate:Cr,reset:Cr,t:()=>n};let{delay:c=0,css:u,tick:f,easing:d=uz}=e;var h,p=()=>1-n;return Nt(()=>{if(!a){var m=[];if(o&&t===void 0&&(f&&f(0,1),u)){var w=jI(u(0,1));m.push(w,w)}h=r.animate(m,{duration:c,fill:"forwards"}),h.onfinish=()=>{var k;h.cancel(),i();var y=(k=t==null?void 0:t.t())!=null?k:1-n;t==null||t.abort();var v=n-y,A=e.duration*Math.abs(v),C=[];if(A>0){var S=!1;if(u)for(var T=Math.ceil(A/16.666666666666668),b=0;b<=T;b+=1){var x=y+v*d(b/T),E=jI(u(x,1-x));C.push(E),S||(S=E.overflow==="hidden")}S&&(r.style.overflow="hidden"),p=()=>{var $=h.currentTime;return y+v*d($/A)},f&&UI(()=>{if(h.playState!=="running")return!1;var $=p();return f($,1-$),!0})}h=r.animate(C,{duration:A,fill:"forwards"}),h.onfinish=()=>{p=()=>n,f==null||f(n,1-n),s()}}}}),{abort:()=>{a=!0,h&&(h.cancel(),h.effect=null,h.onfinish=Cr)},deactivate:()=>{s=Cr},reset:()=>{n===0&&(f==null||f(1,0))},t:()=>p()}}g();g();function Hn(r,e){jr(()=>{var i,s,o,a,l;r=(a=(o=(s=(i=ie)==null?void 0:i.parent)==null?void 0:s.nodes)==null?void 0:o.start)!=null?a:r;var t=r.getRootNode(),n=t.host?t:(l=t.head)!=null?l:t.ownerDocument.head;if(!n.querySelector("#"+e.hash)){let c=$i("style");c.id=e.hash,c.textContent=e.code,n.appendChild(c),N&&BI(e.hash,c)}})}g();g();function Qf(r,e){var t=void 0,n;r_(()=>{t!==(t=e())&&(n&&(Rt(n),n=null),t&&(n=Wt(()=>{jr(()=>t(r))})))})}g();g();g();g();var VI=[...`
\r\f\xA0\v\uFEFF`];function WI(r,e,t){var n=r==null?"":""+r;if(e&&(n=n?n+" "+e:e),t){for(var i of Object.keys(t))if(t[i])n=n?n+" "+i:i;else if(n.length)for(var s=i.length,o=0;(o=n.indexOf(i,o))>=0;){var a=o+s;(o===0||VI.includes(n[o-1]))&&(a===n.length||VI.includes(n[a]))?n=(o===0?"":n.substring(0,o))+n.substring(a+1):o=a}}return n===""?null:n}g();function dt(r,e,t,n,i,s){var o=r[Rf];if(ue||o!==t||o===void 0){var a=WI(t,n,s);(!ue||a!==r.getAttribute("class"))&&(a==null?r.removeAttribute("class"):e?r.className=a:r.setAttribute("class",a)),r[Rf]=t}else if(s&&i!==s)for(var l in s){var c=!!s[l];(i==null||c!==!!i[l])&&r.classList.toggle(l,c)}return s}g();g();var bz=Symbol("is custom element"),yz=Symbol("is html"),_z=ky?"link":"LINK";function ye(r,e,t,n){var i=xz(r);if(ue&&(i[e]=r.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&r.nodeName===_z)){n||Sz(r,e,t!=null?t:"");return}var s=i[e];s!==(i[e]=t)&&(e==="loading"&&(r[p2]=t),t==null?r.removeAttribute(e):typeof t!="string"&&Ez(r).has(e)?r[e]=t:ue&&(typeof t=="number"||typeof t=="boolean")&&s===String(t)||r.setAttribute(e,t))}function xz(r){var e,t;return(t=r[e=im])!=null?t:r[e]={[bz]:r.nodeName.includes("-"),[yz]:r.namespaceURI===Qp}}var qI=new Map;function Ez(r){var e=r.getAttribute("is")||r.nodeName,t=qI.get(e);if(t)return t;qI.set(e,t=new Set);for(var n,i=r,s=Element.prototype;s!==i;){n=by(i);for(var o in n)n[o].set&&o!=="innerHTML"&&o!=="textContent"&&o!=="innerText"&&t.add(o);i=_c(i)}return t}function Sz(r,e,t){var n;N&&(e==="srcset"&&kz(r,t)||y_((n=r.getAttribute(e))!=null?n:"",t)||v2(e,r.outerHTML.replace(r.innerHTML,r.innerHTML&&"..."),String(t)))}function y_(r,e){return r===e?!0:new URL(r,document.baseURI).href===new URL(e,document.baseURI).href}function YI(r){return r.split(",").map(e=>e.trim().split(" ").filter(Boolean))}function kz(r,e){var t=YI(r.srcset),n=YI(e);return n.length===t.length&&n.every(([i,s],o)=>s===t[o][1]&&(y_(t[o][0],i)||y_(i,t[o][0])))}g();g();g();function E_(r,e,t=e){var n=new WeakSet;Iy(r,"input",async i=>{N&&r.type==="checkbox"&&Cy();var s=i?r.defaultValue:r.value;if(s=__(r)?x_(s):s,t(s),ve!==null&&n.add(ve),await Sm(),s!==(s=e())){var o=r.selectionStart,a=r.selectionEnd,l=r.value.length;if(r.value=s!=null?s:"",a!==null){var c=r.value.length;o===a&&a===l&&c>l?(r.selectionStart=c,r.selectionEnd=c):(r.selectionStart=o,r.selectionEnd=Math.min(a,c))}}}),(ue&&r.defaultValue!==r.value||ct(e)==null&&r.value)&&(t(__(r)?x_(r.value):r.value),ve!==null&&n.add(ve)),kr(()=>{N&&r.type==="checkbox"&&Cy();var i=e();if(r===document.activeElement){var s=Xt?oi:ve;if(n.has(s))return}__(r)&&i===x_(r.value)||r.type==="date"&&!i&&!r.value||i!==r.value&&(r.value=i!=null?i:"")})}function __(r){var e=r.type;return e==="number"||e==="range"}function x_(r){return r===""?null:+r}g();g();g();g();g();function S_(r,e){return r===e||(r==null?void 0:r[Nr])===e}function rt(r=Of(),e,t,n){var i=Pe.r,s=ie;return jr(()=>{var o,a;return kr(()=>{o=a,a=(n==null?void 0:n())||[],ct(()=>{S_(t(...a),r)||(e(r,...a),o&&S_(t(...o),r)&&e(null,...o))})}),()=>{let l=s;for(;l!==i&&l.parent!==null&&l.parent.f&33554432;)l=l.parent;let c=()=>{a&&S_(t(...a),r)&&e(null,...a)},u=l.teardown;l.teardown=()=>{c(),u==null||u()}}}),r}g();g();g();g();g();g();g();g();g();var Fm=!1;function A_(r){var e=Fm;try{return Fm=!1,[r(),Fm]}finally{Fm=e}}function Gn(r,e,t,n){var C,S;var i=!Bs||(t&2)!==0,s=(t&8)!==0,o=(t&16)!==0,a=n,l=!0,c=void 0,u=()=>o&&i?(c!=null||(c=Ro(n)),R(c)):(l&&(l=!1,a=o?ct(n):n),a);let f;if(s){var d=Nr in r||Tf in r;f=(S=(C=an(r,e))==null?void 0:C.set)!=null?S:d&&e in r?T=>r[e]=T:void 0}var h,p=!1;s?[h,p]=A_(()=>r[e]):h=r[e],h===void 0&&n!==void 0&&(h=u(),f&&(i&&I2(e),f(h)));var m;if(i?m=()=>{var T=r[e];return T===void 0?u():(l=!0,T)}:m=()=>{var T=r[e];return T!==void 0&&(a=void 0),T===void 0?a:T},i&&(t&4)===0)return m;if(f){var w=r.$$legacy;return(function(T,b){return arguments.length>0?((!i||!b||w||p)&&f(b?m():T),T):m()})}var y=!1,v=((t&1)!==0?Ro:Pa)(()=>(y=!1,m()));N&&(v.label=e),s&&R(v);var A=ie;return(function(T,b){if(arguments.length>0){let x=b?R(v):i&&s?at(T):T;return X(v,x),y=!0,a!==void 0&&(a=x),T}return Pn&&y||(A.f&16384)!==0?v.v:R(v)})}g();g();g();function KI(r){return new C_(r)}var Ys,ui,C_=class{constructor(e){Re(this,Ys);Re(this,ui);var s,o;var t=new Map,n=(a,l)=>{var c=Da(l,!1,!1);return t.set(a,c),c};let i=new Proxy({...e.props||{},$$events:{}},{get(a,l){var c;return R((c=t.get(l))!=null?c:n(l,Reflect.get(a,l)))},has(a,l){var c;return l===Tf?!0:(R((c=t.get(l))!=null?c:n(l,Reflect.get(a,l))),Reflect.has(a,l))},set(a,l,c){var u;return X((u=t.get(l))!=null?u:n(l,c),c),Reflect.set(a,l,c)}});Se(this,ui,(e.hydrate?w_:Do)(e.component,{target:e.target,anchor:e.anchor,props:i,context:e.context,intro:(s=e.intro)!=null?s:!1,recover:e.recover,transformError:e.transformError})),!Xt&&(!((o=e==null?void 0:e.props)!=null&&o.$$host)||e.sync===!1)&&Po(),Se(this,Ys,i.$$events);for(let a of Object.keys(O(this,ui)))a==="$set"||a==="$destroy"||a==="$on"||ur(this,a,{get(){return O(this,ui)[a]},set(l){O(this,ui)[a]=l},enumerable:!0});O(this,ui).$set=a=>{Object.assign(i,a)},O(this,ui).$destroy=()=>{Ws(O(this,ui))}}$set(e){O(this,ui).$set(e)}$on(e,t){O(this,Ys)[e]=O(this,Ys)[e]||[];let n=(...i)=>t.call(this,...i);return O(this,Ys)[e].push(n),()=>{O(this,Ys)[e]=O(this,Ys)[e].filter(i=>i!==n)}}$destroy(){O(this,ui).$destroy()}};Ys=new WeakMap,ui=new WeakMap;var Bz;typeof HTMLElement=="function"&&(Bz=class extends HTMLElement{constructor(e,t,n){super();Xe(this,"$$ctor");Xe(this,"$$s");Xe(this,"$$c");Xe(this,"$$cn",!1);Xe(this,"$$d",{});Xe(this,"$$r",!1);Xe(this,"$$p_d",{});Xe(this,"$$l",{});Xe(this,"$$l_u",new Map);Xe(this,"$$me");Xe(this,"$$shadowRoot",null);this.$$ctor=e,this.$$s=t,n&&(this.$$shadowRoot=this.attachShadow(n))}addEventListener(e,t,n){if(this.$$l[e]=this.$$l[e]||[],this.$$l[e].push(t),this.$$c){let i=this.$$c.$on(e,t);this.$$l_u.set(t,i)}super.addEventListener(e,t,n)}removeEventListener(e,t,n){if(super.removeEventListener(e,t,n),this.$$c){let i=this.$$l_u.get(t);i&&(i(),this.$$l_u.delete(t))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let e=function(i){return s=>{let o=$i("slot");i!=="default"&&(o.name=i),te(s,o)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let t={},n=Hz(this);for(let i of this.$$s)i in n&&(i==="default"&&!this.$$d.children?(this.$$d.children=e(i),t.default=!0):t[i]=e(i));for(let i of this.attributes){let s=this.$$g_p(i.name);s in this.$$d||(this.$$d[s]=T_(s,i.value,this.$$p_d,"toProp"))}for(let i in this.$$p_d)!(i in this.$$d)&&this[i]!==void 0&&(this.$$d[i]=this[i],delete this[i]);this.$$c=KI({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:t,$$host:this}}),this.$$me=t_(()=>{kr(()=>{var i;this.$$r=!0;for(let s of vy(this.$$c)){if(!((i=this.$$p_d[s])!=null&&i.reflect))continue;this.$$d[s]=this.$$c[s];let o=T_(s,this.$$d[s],this.$$p_d,"toAttribute");o==null?this.removeAttribute(this.$$p_d[s].attribute||s):this.setAttribute(this.$$p_d[s].attribute||s,o)}this.$$r=!1})});for(let i in this.$$l)for(let s of this.$$l[i]){let o=this.$$c.$on(i,s);this.$$l_u.set(s,o)}this.$$l={}}}attributeChangedCallback(e,t,n){var i;this.$$r||(e=this.$$g_p(e),this.$$d[e]=T_(e,n,this.$$p_d,"toProp"),(i=this.$$c)==null||i.$set({[e]:this.$$d[e]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$me(),this.$$c=void 0)})}$$g_p(e){return vy(this.$$p_d).find(t=>this.$$p_d[t].attribute===e||!this.$$p_d[t].attribute&&t.toLowerCase()===e)||e}});function T_(r,e,t,n){var s;let i=(s=t[r])==null?void 0:s.type;if(e=i==="Boolean"&&typeof e!="boolean"?e!=null:e,!n||!t[r])return e;if(n==="toAttribute")switch(i){case"Object":case"Array":return e==null?null:JSON.stringify(e);case"Boolean":return e?"":null;case"Number":return e==null?null:e;default:return e}else switch(i){case"Object":case"Array":return e&&JSON.parse(e);case"Boolean":return e;case"Number":return e!=null?+e:e;default:return e}}function Hz(r){let e={};return r.childNodes.forEach(t=>{e[t.slot||"default"]=!0}),e}g();var P_=require("obsidian");g();function Mm(r){let e,t,n=()=>e?(t!=null||(t=e.catch(()=>{}).then(()=>(t=void 0,n()))),t):(e=r().finally(()=>{e=void 0}),e);return n}g();var td=require("obsidian");g();function Gz(r){let e=r-1;return e*e*e+1}function Va(r,e,t){return Number.isNaN(e)?"":`${r}: ${t*e}px;`}var R_=!1;function Di(r,{delay:e=0,duration:t=400,easing:n=Gz,axis:i="y"}={}){let s=getComputedStyle(r);N&&!R_&&/(contents|inline|table)/.test(s.display)&&(R_=!0,Promise.resolve().then(()=>R_=!1),_2(s.display));let o=+s.opacity,a=i==="y"?"height":"width",l=parseFloat(s[a]),c=i==="y"?["top","bottom"]:["left","right"],u=c.map(y=>`${y[0].toUpperCase()}${y.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]}`]),m=parseFloat(s[`border${u[0]}Width`]),w=parseFloat(s[`border${u[1]}Width`]);return{delay:e,duration:t,easing:n,css:y=>`overflow: hidden;opacity: ${Math.min(y*20,1)*o};`+Va(a,l,y)+Va(`padding-${c[0]}`,f,y)+Va(`padding-${c[1]}`,d,y)+Va(`margin-${c[0]}`,h,y)+Va(`margin-${c[1]}`,p,y)+Va(`border-${c[0]}-width`,m,y)+Va(`border-${c[1]}-width`,w,y)+`min-${a}: 0`}}g();var Dm=require("obsidian");var Uz=pe('<div data-icon="file-clock" aria-label="Open file at this commit" class="clickable-icon"></div>'),jz=pe('<div data-icon="go-to-file" aria-label="Open File" class="clickable-icon"></div>'),zz=pe('<main class="tree-item nav-file svelte-1c0jiav"><div class="tree-item-self is-clickable nav-file-title svelte-1c0jiav"><div class="tree-item-inner nav-file-title-content"> </div> <div class="git-tools"><div class="buttons"><!> <!></div> <span class="type"> </span></div></div></main>'),Vz={hash:"svelte-1c0jiav",code:"main.svelte-1c0jiav .nav-file-title:where(.svelte-1c0jiav) {align-items:center;}"};function Jf(r,e){gt(e,!0),Hn(r,Vz);let t=at([]),n=He(()=>Ar(e.view.leaf));tr(()=>{for(let T of t)T&&(0,Dm.setIcon)(T,T.getAttr("data-icon"))});function i(T){T.stopPropagation(),ua(e.diff.path)?s(T):o(T)}function s(T){var x;T.stopPropagation();let b=e.view.app.vault.getAbstractFileByPath(e.diff.vaultPath);b instanceof Dm.TFile&&((x=En(e.view.app,T))==null||x.openFile(b).catch(E=>e.view.plugin.displayError(E)))}function o(T){var b;e.view.plugin.tools.openDiff({event:T,aFile:(b=e.diff.fromPath)!=null?b:e.diff.path,aRef:`${e.diff.hash}^`,bFile:e.diff.path,bRef:e.diff.hash})}function a(T){T.stopPropagation(),e.view.plugin.tools.openFileAtCommit(e.diff.path,e.diff.hash).catch(b=>e.view.plugin.displayError(b))}var l=zz(),c=W(l),u=W(c),f=Ye(u,!0),d=K(u,2),h=W(d),p=W(h);{var m=T=>{var b=Uz();rt(b,x=>t[1]=x,()=>t==null?void 0:t[1]),pn("auxclick",b,a),de("click",b,a),te(T,b)},w=He(()=>e.diff.status!=="D"&&!e.diff.binary&&!ua(e.diff.path));Ae(p,T=>{R(w)&&T(m)})}var y=K(p,2);{var v=T=>{var b=jz();rt(b,x=>t[0]=x,()=>t==null?void 0:t[0]),pn("auxclick",b,s),de("click",b,s),te(T,b)},A=He(()=>zl(e.diff.vaultPath,e.view.app));Ae(y,T=>{R(A)&&T(v)})}V(h);var C=K(h,2),S=Ye(C,!0);V(d),V(c),V(l),Ue(T=>{ye(c,"data-path",e.diff.vaultPath),ye(c,"data-tooltip-position",R(n)),ye(c,"aria-label",e.diff.vaultPath),Ke(f,T),ye(C,"data-type",e.diff.status),Ke(S,e.diff.status)},[()=>Qn(e.diff.vaultPath)]),de("click",l,i),pn("auxclick",l,T=>{T.stopPropagation(),T.button==2?Zi(e.view.app,T,e.diff.vaultPath,e.view.leaf,"git-history"):i(T)}),te(r,l),wt()}Ot(["click"]);g();var Wz=pe("<div><!></div>"),qz=pe('<div class="tree-item-children nav-folder-children"><!></div>'),Yz=pe('<div><div class="tree-item-self is-clickable nav-folder-title"><div data-icon="folder" style="padding-right: 5px; display: flex; "></div> <div><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon right-triangle"><path d="M3 8L12 17L21 8"></path></svg></div> <div class="tree-item-inner nav-folder-title-content svelte-d9h7mp"> </div></div> <!></div>'),Kz=pe("<main></main>"),Zz={hash:"svelte-d9h7mp",code:"main.svelte-d9h7mp .nav-folder-title-content:where(.svelte-d9h7mp) {display:flex;align-items:center;}"};function ed(r,e){gt(e,!0),Hn(r,Zz);let t=Gn(e,"topLevel",3,!1),n=Gn(e,"closed",15),i=He(()=>Ar(e.view.leaf));function s(l,c){l.stopPropagation(),n(n()[c.path]=!n()[c.path],!0)}var o=Kz();let a;gn(o,21,()=>e.hierarchy.children,mn,(l,c)=>{var u=Vs(),f=Fn(u);{var d=p=>{var m=Wz(),w=W(m);Jf(w,{get diff(){return R(c).data},get view(){return e.view}}),V(m),te(p,m)},h=p=>{var m=Yz();let w;var y=W(m),v=K(W(y),2);let A;var C=K(v,2),S=Ye(C,!0);V(y);var T=K(y,2);{var b=x=>{var E=qz(),k=W(E);ed(k,{get hierarchy(){return R(c)},get plugin(){return e.plugin},get view(){return e.view},get closed(){return n()},set closed($){n($)}}),V(E),ci(3,E,()=>Di,()=>({duration:150})),te(x,E)};Ae(T,x=>{n()[R(c).path]||x(b)})}V(m),Ue(()=>{w=dt(m,1,"tree-item nav-folder",null,w,{"is-collapsed":n()[R(c).path]}),ye(y,"data-tooltip-position",R(i)),ye(y,"aria-label",R(c).vaultPath),A=dt(v,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,A,{"is-collapsed":n()[R(c).path]}),Ke(S,R(c).title)}),de("click",y,x=>s(x,R(c))),te(p,m)};Ae(f,p=>{R(c).data?p(d):p(h,-1)})}te(l,u)}),V(o),Ue(()=>a=dt(o,1,"svelte-d9h7mp",null,a,{topLevel:t()})),te(r,o),wt()}Ot(["click"]);var Xz=pe('<div class="git-ref"> </div>'),Qz=pe('<div class="git-author"> </div>'),Jz=pe('<div class="git-date"> </div>'),eV=pe('<div class="tree-item-children nav-folder-children"><!></div>'),tV=pe('<main><div><div class="tree-item-self is-clickable nav-folder-title"><div><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon right-triangle"><path d="M3 8L12 17L21 8"></path></svg></div> <div><!> <!> <!> <div class="tree-item-inner nav-folder-title-content"> </div></div></div> <!></div></main>'),rV={hash:"svelte-1edsiy5",code:""};function $_(r,e){gt(e,!0),Hn(r,rV);let t=He(()=>({title:"",path:"",vaultPath:"",children:e.plugin.gitManager.getTreeStructure(e.log.diff.files)})),n=He(()=>Ar(e.view.leaf)),i=He(()=>{var E;return`${(E=e.log.author)==null?void 0:E.name}
${(0,td.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)}
${e.log.message}
${e.log.body?`
`+e.log.body:""}`}),s=Ie(!0),o=Ie(at({}));function a(E){let k=E.author.name;return e.plugin.settings.authorInHistoryView=="full"?k:e.plugin.settings.authorInHistoryView=="initials"?k.split(" ").filter(M=>M.length>0).map(M=>M[0].toUpperCase()).join(""):""}var l=tV(),c=W(l);let u;var f=W(c),d=W(f);let h;var p=K(d,2),m=W(p);{var w=E=>{var k=Xz(),$=Ye(k,!0);Ue(M=>Ke($,M),[()=>e.log.refs.join(", ")]),te(E,k)};Ae(m,E=>{e.log.refs.length>0&&E(w)})}var y=K(m,2);{var v=E=>{var k=Qz(),$=Ye(k,!0);Ue(M=>Ke($,M),[()=>a(e.log)]),te(E,k)};Ae(y,E=>{var k;e.plugin.settings.authorInHistoryView!="hide"&&((k=e.log.author)!=null&&k.name)&&E(v)})}var A=K(y,2);{var C=E=>{var k=Jz(),$=Ye(k,!0);Ue(M=>Ke($,M),[()=>(0,td.moment)(e.log.date).format(e.plugin.settings.commitDateFormat)]),te(E,k)};Ae(A,E=>{e.plugin.settings.dateInHistoryView&&E(C)})}var S=K(A,2),T=Ye(S,!0);V(p),V(f),Qf(f,()=>E=>{(0,td.setTooltip)(E,R(i),{placement:R(n),classes:["obsidian-git-commit-tooltip"]})});var b=K(f,2);{var x=E=>{var k=eV(),$=W(k);{var M=P=>{ed(P,{get hierarchy(){return R(t)},get plugin(){return e.plugin},get view(){return e.view},topLevel:!0,get closed(){return R(o)},set closed(F){X(o,F,!0)}})},D=P=>{var F=Vs(),_e=Fn(F);gn(_e,17,()=>e.log.diff.files,mn,(Q,oe)=>{Jf(Q,{get view(){return e.view},get diff(){return R(oe)}})}),te(P,F)};Ae($,P=>{e.showTree?P(M):P(D,-1)})}V(k),ci(3,k,()=>Di,()=>({duration:150})),te(E,k)};Ae(b,E=>{R(s)||E(x)})}V(c),V(l),Ue(()=>{u=dt(c,1,"tree-item nav-folder",null,u,{"is-collapsed":R(s)}),ye(f,"aria-label",R(i)),h=dt(d,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,h,{"is-collapsed":R(s)}),Ke(T,e.log.message)}),de("click",f,()=>X(s,!R(s))),te(r,l),wt()}Ot(["click"]);var nV=pe('<div class="tree-item nav-folder mod-root"></div>'),iV=pe('<main class="git-view"><div class="nav-header"><div class="nav-buttons-container"><div id="layoutChange" class="clickable-icon nav-action-button" aria-label="Change Layout"></div> <div id="refresh" data-icon="refresh-cw" aria-label="Refresh"></div></div></div> <div class="nav-files-container" style="position: relative;"><!> <div id="sentinel"></div> <div style="margin-bottom:40px"></div></div></main>'),sV={hash:"svelte-12n6twc",code:""};function I_(r,e){gt(e,!0),Hn(r,sV);let t=Gn(e,"plugin",15),n=Ie(!1),i=at([]),s=Ie(void 0),o=Ie(at(t().settings.treeStructure)),a,l=Mm(u);tr(()=>{a&&a.empty()}),za(()=>{let S=e.view.app.workspace.on("obsidian-git:refs-changed",()=>{l().catch(console.error)});return()=>e.view.app.workspace.offref(S)}),tr(()=>{i.forEach(S=>(0,P_.setIcon)(S,S.getAttr("data-icon")))}),za(()=>{let S=new IntersectionObserver(b=>{var x;(x=b[0])!=null&&x.isIntersecting&&!R(n)&&f().catch(console.error)}),T=activeDocument.querySelector("#sentinel");return T&&S.observe(T),()=>{S.disconnect()}}),l().catch(console.error);function c(){l().catch(console.error)}async function u(){var b,x;if(!t().gitReady){X(s,void 0);return}X(n,!0);let S=t().gitManager instanceof Ze,T;((x=(b=R(s))==null?void 0:b.length)!=null?x:0)==0?T=S?50:10:T=R(s).length;try{X(s,await t().gitManager.log(void 0,!1,T),!0)}finally{X(n,!1)}}async function f(){var x;if(!t().gitReady||R(s)===void 0)return;X(n,!0);let T=t().gitManager instanceof Ze?50:10,b=await t().gitManager.log(void 0,!1,T,(x=R(s).last())==null?void 0:x.hash);R(s).push(...b.slice(1)),X(n,!1)}var d=iV(),h=W(d),p=W(h),m=W(p);rt(m,S=>i[0]=S,()=>i==null?void 0:i[0]);var w=K(m,2);let y;rt(w,S=>i[1]=S,()=>i==null?void 0:i[1]),V(p),V(h);var v=K(h,2),A=W(v);{var C=S=>{var T=nV();gn(T,21,()=>R(s),mn,(b,x)=>{$_(b,{get view(){return e.view},get showTree(){return R(o)},get log(){return R(x)},get plugin(){return t()}})}),V(T),te(S,T)};Ae(A,S=>{R(s)&&S(C)})}ka(4),V(v),V(d),Ue(()=>{ye(m,"data-icon",R(o)?"list":"folder"),y=dt(w,1,"clickable-icon nav-action-button",null,y,{loading:R(n)})}),de("click",m,()=>{X(o,!R(o)),(0,P_.setIcon)(i[0],R(o)?"list":"folder"),t(t().settings.treeStructure=R(o),!0),t().saveSettings()}),de("click",w,c),te(r,d),wt()}Ot(["click"]);var rd=class extends ZI.ItemView{constructor(e,t){super(e),this.plugin=t,this.hoverPopover=null}getViewType(){return tn.type}getDisplayText(){return tn.name}getIcon(){return tn.icon}async onClose(){return this._view&&await Ws(this._view),super.onClose()}async reload(){this._view&&await Ws(this._view),this._view=Do(I_,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}async onOpen(){return await this.reload(),super.onOpen()}};g();var XI=require("@codemirror/commands"),QI=require("@codemirror/search"),O_=require("@codemirror/state"),hs=require("@codemirror/view"),JI=require("obsidian");var oV=hs.EditorView.theme({"&":{height:"100%"},".cm-scroller":{overflow:"auto"},"& .cm-content":{caretColor:"transparent !important"},"&.cm-focused .cm-cursor, & .cm-dropCursor":{display:"none !important"}}),nd=class extends JI.ItemView{constructor(t,n){super(t);this.plugin=n;this.navigation=!0,this.contentEl.addClass("git-read-only-file-view","cm-s-obsidian","mod-cm6","markdown-source-view"),this.registerEvent(this.app.workspace.on("obsidian-git:head-change",()=>{this.editor||this.renderFile().catch(i=>this.plugin.displayError(i))}))}getViewType(){return mo.type}getDisplayText(){var n;return this.state?`${(n=this.state.file.split("/").last())!=null?n:this.state.file} (${this.state.ref.substring(0,7)})`:mo.name}getIcon(){return mo.icon}async setState(t,n){this.state=t,await super.setState(t,n),this.leaf.view.titleEl.textContent=this.getDisplayText(),await this.renderFile()}getState(){var t;return(t=this.state)!=null?t:{}}async onOpen(){await this.renderFile(),await super.onOpen()}async onClose(){var t;(t=this.editor)==null||t.destroy(),this.editor=void 0,await super.onClose()}async renderFile(){var n;if(!this.state||!this.plugin.gitReady)return;let t=await this.plugin.gitManager.show(this.state.ref,this.state.file,!1);(n=this.editor)==null||n.destroy(),this.contentEl.empty(),this.editor=new hs.EditorView({state:O_.EditorState.create({doc:t,extensions:[(0,hs.lineNumbers)(),(0,hs.drawSelection)(),hs.keymap.of(XI.standardKeymap),(0,QI.search)(),hs.EditorView.lineWrapping,O_.EditorState.readOnly.of(!0),oV]}),parent:this.contentEl})}};g();var eO=require("obsidian"),Lm=class extends eO.Modal{constructor(t){super(t.app);this.plugin=t}onOpen(){var a,l;let{contentEl:t,titleEl:n}=this,i=(l=(a=this.plugin.cachedStatus)==null?void 0:a.conflicted)!=null?l:[];if(n.setText("Merge in progress"),t.addClass("obsidian-git-merge-help"),t.createEl("p",{text:"Git is combining the version in your vault with changes from another version. The merge must be committed before Obsidian Git can push or resume automatic commits."}),i.length>0){t.createEl("h3",{text:"Resolve the conflicts"}),t.createEl("p",{text:"Git could not combine some parts automatically. Open each conflicted file and review every highlighted conflict block."});let c=t.createEl("ol");c.createEl("li",{text:"Choose \u201CKeep ours\u201D for your local text, \u201CKeep theirs\u201D for the incoming text, \u201CKeep both\u201D, or edit the block manually."}),c.createEl("li",{text:"When the file's conflict count reaches zero, select the plus icon next to it to mark it as resolved."}),c.createEl("li",{text:"Repeat this for every file in the Conflicts section."})}else{let c=t.createDiv({cls:"obsidian-git-merge-help-resolved"});c.createEl("strong",{text:"All conflicts have been marked as resolved."}),c.createDiv({text:"The merge is still active until you commit the staged changes."})}t.createEl("h3",{text:"Finish the merge"}),t.createEl("p",{text:"After the Conflicts section is empty, enter a commit message and commit the staged changes. This finishes the merge. You can then push normally."}),t.createDiv({cls:"modal-button-container"}).createEl("button",{cls:"mod-cta",text:"Got it"}).addEventListener("click",()=>this.close())}onClose(){this.contentEl.empty()}};g();var rO=require("obsidian");g();var Ks=require("obsidian");g();var id=require("obsidian");var aV=pe('<div class="type resolved svelte-sczrxn" aria-label="No conflicts left"></div>'),lV=pe('<div class="type conflict svelte-sczrxn"> </div>'),cV=pe('<main class="tree-item nav-file"><div class="tree-item-self is-clickable nav-file-title"><div class="tree-item-inner nav-file-title-content"> </div> <div class="git-tools svelte-sczrxn"><div class="buttons svelte-sczrxn"><div aria-label="Mark resolved" class="clickable-icon"></div></div> <!></div></div></main>'),uV={hash:"svelte-sczrxn",code:".git-tools.svelte-sczrxn {display:grid;grid-template-columns:var(--icon-m, 18px) 4ch;column-gap:var(--size-2-1);align-items:center;}.git-tools.svelte-sczrxn .buttons:where(.svelte-sczrxn) {width:var(--icon-m, 18px);}.git-tools.svelte-sczrxn .type.conflict:where(.svelte-sczrxn) {color:var(--git-change);width:4ch;padding:0;justify-content:flex-end;font-variant-numeric:tabular-nums;}.git-tools.svelte-sczrxn .type.resolved:where(.svelte-sczrxn) {color:var(--git-insert);width:4ch;padding:0;justify-content:flex-end;}.git-tools.svelte-sczrxn .type.resolved:where(.svelte-sczrxn) svg {width:var(--icon-m, 18px);height:var(--icon-m, 18px);}"};function sd(r,e){gt(e,!0),Hn(r,uV);let t=Ie(void 0),n=Ie(void 0),i=He(()=>e.manager.getRelativeVaultPath(e.path)),s=He(()=>Ar(e.view.leaf));tr(()=>{R(t)&&(0,id.setIcon)(R(t),e.count===0?"plus":"check")}),tr(()=>{R(n)&&(0,id.setIcon)(R(n),"check")});function o(v){var C;v.stopPropagation();let A=e.view.app.vault.getAbstractFileByPath(R(i));A instanceof id.TFile&&((C=En(e.view.app,v))==null||C.openFile(A).catch(S=>e.view.plugin.displayError(S)))}function a(v){v.stopPropagation(),e.view.plugin.promiseQueue.addTask(()=>e.view.plugin.gitActions.stage(e.path,!1))}var l=cV(),c=W(l),u=W(c),f=Ye(u,!0),d=K(u,2),h=W(d),p=W(h);rt(p,v=>X(t,v),()=>R(t)),V(h);var m=K(h,2);{var w=v=>{var A=aV();rt(A,C=>X(n,C),()=>R(n)),te(v,A)},y=v=>{var A=lV(),C=Ye(A,!0);Ue(()=>{var S;ye(A,"aria-label",`${(S=e.count)!=null?S:""} conflict(s) left`),Ke(C,e.count)}),te(v,A)};Ae(m,v=>{e.count===0?v(w):e.count!==void 0&&v(y,1)})}V(d),V(c),V(l),Ue(v=>{ye(c,"data-path",R(i)),ye(c,"data-tooltip-position",R(s)),ye(c,"aria-label",R(i)),Ke(f,v)},[()=>Qn(R(i))]),de("click",l,o),de("click",p,a),te(r,l),wt()}Ot(["click"]);g();var Nm=require("obsidian");var fV=pe('<div data-icon="go-to-file" aria-label="Open File" class="clickable-icon"></div>'),dV=pe('<main class="tree-item nav-file"><div class="tree-item-self is-clickable nav-file-title"><div class="tree-item-inner nav-file-title-content"> </div> <div class="git-tools"><div class="buttons"><!> <div data-icon="undo" aria-label="Discard" class="clickable-icon"></div> <div data-icon="plus" aria-label="Stage" class="clickable-icon"></div></div> <div class="type"> </div></div></div></main>');function od(r,e){gt(e,!0);let t=at([]),n=He(()=>Ar(e.view.leaf));tr(()=>{for(let b of t)b&&(0,Nm.setIcon)(b,b.getAttr("data-icon"))});function i(b){b.stopPropagation(),ua(e.change.path)?o(b):l(b)}function s(b){e.view.app.vault.getAbstractFileByPath(e.change.vaultPath)&&Vl(e.view.app,b,e.view,e.change.vaultPath)}function o(b){var E;b.stopPropagation();let x=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);x instanceof Nm.TFile&&((E=En(e.view.app,b))==null||E.openFile(x).catch(k=>e.view.plugin.displayError(k)))}function a(b){b.stopPropagation(),e.view.plugin.promiseQueue.addTask(()=>e.view.plugin.gitActions.stage(e.change.path,!1))}function l(b){b.stopPropagation(),e.view.plugin.tools.openDiff({aFile:e.change.path,aRef:"",event:b})}function c(b){b.stopPropagation(),e.view.plugin.promiseQueue.addTask(()=>e.view.plugin.gitActions.discardFile(e.change))}var u=dV(),f=W(u),d=W(f),h=Ye(d,!0),p=K(d,2),m=W(p),w=W(m);{var y=b=>{var x=fV();rt(x,E=>t[0]=E,()=>t==null?void 0:t[0]),pn("auxclick",x,o),de("click",x,o),te(b,x)},v=He(()=>zl(e.change.vaultPath,e.view.app));Ae(w,b=>{R(v)&&b(y)})}var A=K(w,2);rt(A,b=>t[1]=b,()=>t==null?void 0:t[1]);var C=K(A,2);rt(C,b=>t[2]=b,()=>t==null?void 0:t[2]),V(m);var S=K(m,2),T=Ye(S,!0);V(p),V(f),V(u),Ue(b=>{ye(f,"data-path",e.change.vaultPath),ye(f,"data-tooltip-position",R(n)),ye(f,"aria-label",e.change.vaultPath),Ke(h,b),ye(S,"data-type",e.change.workingDir),Ke(T,e.change.workingDir)},[()=>Qn(e.change.vaultPath)]),de("mouseover",u,s),de("click",u,i),pn("auxclick",u,b=>{b.stopPropagation(),b.button==2?Zi(e.view.app,b,e.change.vaultPath,e.view.leaf,"git-source-control"):i(b)}),de("click",A,c),de("click",C,a),te(r,u),wt()}Ot(["mouseover","click"]);g();var tO=require("obsidian");var hV=pe('<main class="tree-item nav-file"><div class="tree-item-self is-clickable nav-file-title"><div class="tree-item-inner nav-file-title-content"> </div> <div class="git-tools"><span class="type"> </span></div></div></main>');function ad(r,e){gt(e,!0);let t=He(()=>Ar(e.view.leaf));function n(d){e.view.app.vault.getAbstractFileByPath(e.change.vaultPath)&&Vl(e.view.app,d,e.view,e.change.vaultPath)}function i(d){var p;d.stopPropagation();let h=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);h instanceof tO.TFile&&((p=En(e.view.app,d))==null||p.openFile(h).catch(m=>e.view.plugin.displayError(m)))}var s=hV(),o=W(s),a=W(o),l=Ye(a,!0),c=K(a,2),u=W(c),f=Ye(u,!0);V(c),V(o),V(s),Ue(d=>{ye(o,"data-path",e.change.vaultPath),ye(o,"data-tooltip-position",R(t)),ye(o,"aria-label",e.change.vaultPath),Ke(l,d),ye(u,"data-type",e.change.workingDir),Ke(f,e.change.workingDir)},[()=>Qn(e.change.vaultPath)]),de("mouseover",s,n),de("click",s,i),pn("auxclick",s,d=>{d.stopPropagation(),d.button==2?Zi(e.view.app,d,e.change.vaultPath,e.view.leaf,"git-source-control"):i(d)}),te(r,s),wt()}Ot(["mouseover","click"]);g();var Bm=require("obsidian");var pV=pe('<div data-icon="go-to-file" aria-label="Open File" class="clickable-icon"></div>'),mV=pe('<main class="tree-item nav-file"><div class="tree-item-self is-clickable nav-file-title"><div class="tree-item-inner nav-file-title-content"> </div> <div class="git-tools"><div class="buttons"><!> <div data-icon="minus" aria-label="Unstage" class="clickable-icon"></div></div> <div class="type"> </div></div></div></main>');function ld(r,e){gt(e,!0);let t=at([]),n=He(()=>Ar(e.view.leaf));tr(()=>{for(let S of t)S&&(0,Bm.setIcon)(S,S.getAttr("data-icon"))});function i(S){S.stopPropagation(),ua(e.change.path)?o(S):a(S)}function s(S){e.view.app.vault.getFileByPath(e.change.vaultPath)&&Vl(e.view.app,S,e.view,e.change.vaultPath)}function o(S){var b;S.stopPropagation();let T=e.view.app.vault.getAbstractFileByPath(e.change.vaultPath);T instanceof Bm.TFile&&((b=En(e.view.app,S))==null||b.openFile(T).catch(x=>e.view.plugin.displayError(x)))}function a(S){var T;S.stopPropagation(),e.view.plugin.tools.openDiff({aFile:(T=e.change.from)!=null?T:e.change.path,bFile:e.change.path,aRef:"HEAD",bRef:"",event:S})}function l(S){S.stopPropagation(),e.view.plugin.promiseQueue.addTask(()=>e.view.plugin.gitActions.unstage(e.change.path,!1))}var c=mV(),u=W(c),f=W(u),d=Ye(f,!0),h=K(f,2),p=W(h),m=W(p);{var w=S=>{var T=pV();rt(T,b=>t[0]=b,()=>t==null?void 0:t[0]),de("click",T,o),te(S,T)},y=He(()=>zl(e.change.vaultPath,e.view.app));Ae(m,S=>{R(y)&&S(w)})}var v=K(m,2);rt(v,S=>t[1]=S,()=>t==null?void 0:t[1]),V(p);var A=K(p,2),C=Ye(A,!0);V(h),V(u),V(c),Ue(S=>{ye(u,"data-path",e.change.vaultPath),ye(u,"data-tooltip-position",R(n)),ye(u,"aria-label",e.change.vaultPath),Ke(d,S),ye(A,"data-type",e.change.index),Ke(C,e.change.index)},[()=>Qn(e.change.vaultPath)]),de("mouseover",c,s),de("click",c,i),pn("auxclick",c,S=>{S.stopPropagation(),S.button==2?Zi(e.view.app,S,e.change.vaultPath,e.view.leaf,"git-source-control"):i(S)}),de("click",v,l),te(r,c),wt()}Ot(["mouseover","click"]);g();g();var gV=pe('<div class="tree-item nav-file"><div class="tree-item-self nav-file-title"><div class="tree-item-inner nav-file-title-content"> </div></div></div>'),wV=pe("<main><!></main>");function Wa(r,e){gt(e,!0);var t=wV(),n=W(t);{var i=s=>{var o=gV(),a=W(o),l=W(a),c=Ye(l,!0);V(a),V(o),Ue(()=>{ye(a,"aria-label","And "+(e.files.length-500)+" more files"),Ke(c,"And "+(e.files.length-500)+" more files")}),te(s,o)};Ae(n,s=>{e.files.length>500&&s(i)})}V(t),te(r,t),wt()}var bV=pe("<div><!></div>"),yV=pe('<div data-icon="minus" aria-label="Unstage" class="clickable-icon"><svg width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-minus"><line x1="4" y1="9" x2="14" y2="9"></line></svg></div>'),_V=pe('<div data-icon="undo" aria-label="Discard" class="clickable-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-undo"><path d="M3 7v6h6"></path><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"></path></svg></div> <div data-icon="plus" aria-label="Stage" class="clickable-icon"><svg width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-plus"><line x1="9" y1="4" x2="9" y2="14"></line><line x1="4" y1="9" x2="14" y2="9"></line></svg></div>',1),xV=pe('<div class="tree-item-children nav-folder-children"><!></div>'),EV=pe('<div><div class="tree-item-self is-clickable nav-folder-title"><div data-icon="folder" style="padding-right: 5px; display: flex; "></div> <div><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon right-triangle"><path d="M3 8L12 17L21 8"></path></svg></div> <div class="tree-item-inner nav-folder-title-content"> </div> <div class="git-tools"><div class="buttons"><!> <div style="width:11px"></div></div></div></div> <!></div>'),SV=pe("<main><!> <!></main>");function Bo(r,e){gt(e,!0);let t=Gn(e,"topLevel",3,!1),n=Gn(e,"closed",15),i=Gn(e,"conflictCounts",19,()=>({}));za(()=>{var p,m;for(let w of e.hierarchy.children)((m=(p=w.children)==null?void 0:p.length)!=null?m:0)>100&&n(n()[w.path]=!0,!0)});let s=He(()=>Ar(e.view.leaf));function o(p,m){p.stopPropagation(),e.plugin.promiseQueue.addTask(()=>e.plugin.gitActions.stageAll(m))}function a(p,m){p.stopPropagation(),e.plugin.promiseQueue.addTask(()=>e.plugin.gitActions.unstageAll(m))}function l(p,m){p.stopPropagation(),e.plugin.promiseQueue.addTask(()=>e.plugin.gitActions.discardAll(m.vaultPath))}function c(p,m){p.stopPropagation(),n(n()[m.path]=!n()[m.path],!0)}var u=SV();let f;var d=W(u);gn(d,17,()=>tf(e.hierarchy.children,500),mn,(p,m)=>{var w=Vs(),y=Fn(w);{var v=C=>{var S=bV(),T=W(S);{var b=$=>{ld($,{get change(){return R(m).data},get view(){return e.view}})},x=$=>{od($,{get change(){return R(m).data},get view(){return e.view}})},E=$=>{ad($,{get change(){return R(m).data},get view(){return e.view}})},k=$=>{sd($,{get path(){return R(m).data.path},get count(){return i()[R(m).data.path]},get manager(){return e.plugin.gitManager},get view(){return e.view}})};Ae(T,$=>{e.fileType==0?$(b):e.fileType==1?$(x,1):e.fileType==2?$(E,2):e.fileType==3&&$(k,3)})}V(S),te(C,S)},A=C=>{var S=EV();let T;var b=W(S),x=K(W(b),2);let E;var k=K(x,2),$=Ye(k,!0),M=K(k,2),D=W(M),P=W(D);{var F=fe=>{var Z=yV();de("click",Z,Y=>a(Y,R(m).path)),te(fe,Z)},_e=fe=>{var Z=_V(),Y=Fn(Z),J=K(Y,2);de("click",Y,U=>l(U,R(m))),de("click",J,U=>o(U,R(m).path)),te(fe,Z)};Ae(P,fe=>{e.fileType==0?fe(F):e.fileType==1&&fe(_e,1)})}ka(2),V(D),V(M),V(b);var Q=K(b,2);{var oe=fe=>{var Z=xV(),Y=W(Z);Bo(Y,{get hierarchy(){return R(m)},get plugin(){return e.plugin},get view(){return e.view},get fileType(){return e.fileType},get conflictCounts(){return i()},get closed(){return n()},set closed(J){n(J)}}),V(Z),ci(3,Z,()=>Di,()=>({duration:150})),te(fe,Z)};Ae(Q,fe=>{n()[R(m).path]||fe(oe)})}V(S),Ue(()=>{T=dt(S,1,"tree-item nav-folder",null,T,{"is-collapsed":n()[R(m).path]}),ye(b,"data-tooltip-position",R(s)),ye(b,"aria-label",R(m).vaultPath),E=dt(x,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,E,{"is-collapsed":n()[R(m).path]}),Ke($,R(m).title)}),pn("auxclick",S,fe=>Zi(e.view.app,fe,R(m).vaultPath,e.view.leaf,"git-source-control")),de("click",b,fe=>c(fe,R(m))),te(C,S)};Ae(y,C=>{R(m).data?C(v):C(A,-1)})}te(p,w)});var h=K(d,2);Wa(h,{get files(){return e.hierarchy.children}}),V(u),Ue(()=>f=dt(u,1,"",null,f,{topLevel:t()})),te(r,u),wt()}Ot(["click"]);var kV=pe('<div class="repository-notice svelte-5wq9p"><p class="svelte-5wq9p">No Git repository found.</p> <div class="repository-actions svelte-5wq9p"><button class="mod-cta">Initialize repository</button> <button>Clone repository</button></div></div>'),AV=pe('<div id="merge-status" class="clickable-icon nav-action-button merge-status svelte-5wq9p" data-icon="git-merge" aria-label="Merge in progress \u2014 select for help"></div>'),CV=pe('<div class="git-commit-msg-clear-button svelte-5wq9p"></div>'),TV=pe('<div class="tree-item-children nav-folder-children svelte-5wq9p"><!></div>'),RV=pe('<div><div class="tree-item-self is-clickable nav-folder-title svelte-5wq9p"><div><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon right-triangle svelte-5wq9p"><path d="M3 8L12 17L21 8"></path></svg></div> <div class="tree-item-inner nav-folder-title-content">Conflicts</div> <div class="git-tools svelte-5wq9p"><div class="files-count svelte-5wq9p"> </div></div></div> <!></div>'),F_=pe("<!> <!>",1),M_=pe('<div class="tree-item-children nav-folder-children"><!></div>'),$V=pe('<div class="staged tree-item nav-folder"><div class="tree-item-self nav-folder-title svelte-5wq9p"><div class="tree-item-inner nav-folder-title-content">Staged outside vault</div> <div class="git-tools svelte-5wq9p"><div class="files-count svelte-5wq9p"> </div></div></div></div>'),PV=pe('<div class="changes tree-item nav-folder"><div class="tree-item-self nav-folder-title svelte-5wq9p"><div class="tree-item-inner nav-folder-title-content">Conflicts outside vault</div> <div class="git-tools svelte-5wq9p"><div class="files-count svelte-5wq9p"> </div></div></div></div>'),IV=pe('<div><div class="tree-item-self is-clickable nav-folder-title svelte-5wq9p"><div class="tree-item-icon nav-folder-collapse-indicator collapse-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon right-triangle"><path d="M3 8L12 17L21 8"></path></svg></div> <div class="tree-item-inner nav-folder-title-content">Recently Pulled Files</div> <span class="tree-item-flair"> </span></div> <!></div>'),OV=pe('<div class="tree-item nav-folder mod-root"><div><div class="tree-item-self is-clickable nav-folder-title svelte-5wq9p"><div><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon right-triangle"><path d="M3 8L12 17L21 8"></path></svg></div> <div class="tree-item-inner nav-folder-title-content">Staged Changes</div> <div class="git-tools svelte-5wq9p"><div class="buttons"><div data-icon="minus" aria-label="Unstage" class="clickable-icon"><svg width="18" height="18" viewBox="0 0 18 18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-minus"><line x1="4" y1="9" x2="14" y2="9"></line></svg></div></div> <div class="files-count svelte-5wq9p"> </div></div></div> <!></div> <!> <!> <div><div class="tree-item-self is-clickable nav-folder-title svelte-5wq9p"><div><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon right-triangle"><path d="M3 8L12 17L21 8"></path></svg></div> <div class="tree-item-inner nav-folder-title-content">Changes</div> <div class="git-tools svelte-5wq9p"><div class="buttons"><div data-icon="undo" aria-label="Discard" class="clickable-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-undo"><path d="M3 7v6h6"></path><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"></path></svg></div> <div data-icon="plus" aria-label="Stage" class="clickable-icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-plus"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg></div></div> <div class="files-count svelte-5wq9p"> </div></div></div> <!></div> <!></div>'),FV=pe('<main><!> <div class="nav-header svelte-5wq9p"><div class="nav-buttons-container"><div class="commit-action-group svelte-5wq9p"><div id="backup-btn" data-icon="arrow-up-circle"></div> <div id="commit-btn" data-icon="check"></div> <div id="commit-menu" data-icon="chevron-down" class="clickable-icon nav-action-button svelte-5wq9p" aria-label="More commit actions"></div></div> <div id="stage-all" class="clickable-icon nav-action-button" data-icon="plus-circle" aria-label="Stage all"></div> <div id="unstage-all" class="clickable-icon nav-action-button" data-icon="minus-circle" aria-label="Unstage all"></div> <div id="push" class="clickable-icon nav-action-button" data-icon="upload" aria-label="Push"></div> <div id="pull" class="clickable-icon nav-action-button" data-icon="download" aria-label="Pull"></div> <div id="layoutChange" class="clickable-icon nav-action-button" aria-label="Change Layout"></div> <div id="refresh" data-icon="refresh-cw" aria-label="Refresh"></div> <!></div></div> <div class="git-commit-msg svelte-5wq9p"><textarea class="commit-msg-input svelte-5wq9p" spellcheck="true" placeholder="Commit Message"></textarea> <!></div> <div class="nav-files-container svelte-5wq9p" style="position: relative;"><!> <!></div></main>'),MV={hash:"svelte-5wq9p",code:`.repository-missing.svelte-5wq9p > .nav-header:where(.svelte-5wq9p),
.repository-missing.svelte-5wq9p > .git-commit-msg:where(.svelte-5wq9p),
.repository-missing.svelte-5wq9p > .nav-files-container:where(.svelte-5wq9p) {display:none;}.repository-notice.svelte-5wq9p {flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--size-4-3);padding:var(--size-4-6);text-align:center;}.repository-notice.svelte-5wq9p p:where(.svelte-5wq9p) {margin:0;color:var(--text-muted);}.repository-actions.svelte-5wq9p {display:flex;flex-wrap:wrap;justify-content:center;gap:var(--size-4-2);}.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;}.merge-status.svelte-5wq9p {color:var(--text-warning);}.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;}.conflicts.svelte-5wq9p {--nav-indentation-guide-color: var(--text-warning);--collapse-icon-color: var(--text-warning);--collapse-icon-color-collapsed: var(--text-warning);}.conflicts.svelte-5wq9p > .nav-folder-title:where(.svelte-5wq9p) {color:var(--text-warning);}.conflicts.svelte-5wq9p .nav-folder-collapse-indicator:where(.svelte-5wq9p) {color:var(--text-warning);}.conflicts.svelte-5wq9p .nav-folder-collapse-indicator:where(.svelte-5wq9p) svg:where(.svelte-5wq9p) {color:var(--text-warning);}.conflicts.svelte-5wq9p .topLevel .nav-folder-collapse-indicator {color:var(--text-warning);}.conflicts.svelte-5wq9p .topLevel .nav-folder-collapse-indicator svg {color:var(--text-warning);}.conflicts.svelte-5wq9p .tree-item-children:where(.svelte-5wq9p) {border-inline-start-color:var(--text-warning);}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,<svg viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12ZM3.8705 3.09766L6.00003 5.22718L8.12955 3.09766L8.9024 3.8705L6.77287 6.00003L8.9024 8.12955L8.12955 8.9024L6.00003 6.77287L3.8705 8.9024L3.09766 8.12955L5.22718 6.00003L3.09766 3.8705L3.8705 3.09766Z' fill='currentColor'/></svg>");mask-repeat:no-repeat;-webkit-mask-image:url("data:image/svg+xml,<svg viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12ZM3.8705 3.09766L6.00003 5.22718L8.12955 3.09766L8.9024 3.8705L6.77287 6.00003L8.9024 8.12955L8.12955 8.9024L6.00003 6.77287L3.8705 8.9024L3.09766 8.12955L5.22718 6.00003L3.09766 3.8705L3.8705 3.09766Z' fill='currentColor'/></svg>");-webkit-mask-repeat:no-repeat;}`};function D_(r,e){gt(e,!0),Hn(r,MV);let t=Gn(e,"plugin",7),n=Gn(e,"view",7),i=Ie(!1),s=Ie(!1),o=Ie(!1),a=Ie(!1),l=Ie(void 0),c=Ie(at([])),u=He(()=>t().settings.commitMessage),f=at([]),d=Ie(void 0),h=Ie(void 0),p=Ie(void 0),m=Ie(void 0),w=Ie(!0),y=Ie(!0),v=Ie(!0),A=Ie(!0),C=Ie(at({})),S=Promise.resolve(),T=He(()=>{var H,ae;return[...(ae=(H=R(l))==null?void 0:H.conflicted)!=null?ae:[]].sort(($e,ht)=>{let qt=R(C)[$e]===0?0:1,jn=R(C)[ht]===0?0:1;return qt!==jn?qt-jn:$e.localeCompare(ht)})}),b=Ie(0),x=Ie(at({})),E=Ie(at({})),k=Ie(at({})),$=Ie(at({})),M=He(()=>{var H,ae,$e,ht;return((ae=(H=R(l))==null?void 0:H.staged.length)!=null?ae:0)+((ht=($e=R(l))==null?void 0:$e.stagedOutsideVault)!=null?ht:0)}),D=He(()=>{var H,ae;return(ae=(H=R(l))==null?void 0:H.changed.length)!=null?ae:0}),P=He(()=>{var H,ae,$e,ht;return((ae=(H=R(l))==null?void 0:H.conflicted.length)!=null?ae:0)+((ht=($e=R(l))==null?void 0:$e.conflictedOutsideVault)!=null?ht:0)>0}),F=He(()=>R(M)+R(D)>0),_e=He(()=>!J("smart")),Q=He(()=>!U("all")),oe=He(()=>Y(!1)),fe=He(()=>Y(!0)),Z=He(()=>t().settings.treeStructure);za(()=>{X(s,t().repositoryMissing,!0),n().registerEvent(n().app.workspace.on("obsidian-git:loading-status",()=>X(i,!0))),n().registerEvent(n().app.workspace.on("obsidian-git:status-changed",()=>{j().catch(console.error)})),n().registerEvent(n().app.workspace.on("obsidian-git:repository-state-changed",()=>{X(s,t().repositoryMissing,!0),j().catch(console.error)}));let H=n().app.vault.on("modify",ae=>{var ht,qt;if(!((ht=R(l))!=null&&ht.conflicted))return;let $e=t().gitManager.getRelativeRepoPath(ae.path);(qt=R(l))!=null&&qt.conflicted.includes($e)&&Ce($e)});return n().plugin.cachedStatus==null?n().plugin.refresh().catch(console.error):j().catch(console.error),n().scope=new Ks.Scope(t().app.scope),n().scope.register(["Ctrl"],"Enter",ae=>vt()),()=>n().app.vault.offref(H)}),tr(()=>{f.forEach(H=>{H&&(0,Ks.setIcon)(H,H.getAttr("data-icon"))})}),tr(()=>{f.forEach(H=>{var ae,$e;!H||H.id!="push"||(Ks.Platform.isMobile?(H.removeClass("button-border"),R(b)>0&&H.addClass("button-border")):((ae=H.firstElementChild)==null||ae.removeAttribute("color"),R(b)>0&&(($e=H.firstElementChild)==null||$e.setAttr("color","var(--text-accent)"))))})});function Y(H){let ae=H?" and sync":"";return R(P)?"Resolve conflicts before committing":R(a)&&!R(F)?H?"Finish merge and sync":"Finish merge":R(F)?H?"Commit all changes and sync":R(M)>0?`Commit ${R(M)} staged ${R(M)===1?"file":"files"}${ae}`:t().settings.autoStageOnEmptyIndex?`Stage and commit all ${R(D)} changed ${R(D)===1?"file":"files"}${ae}`:"Nothing staged \u2014 stage changes before committing":H?"Sync (no changes to commit)":"No changes to commit"}function J(H){return R(P)?!1:H==="staged"?R(M)>0:H==="all"?R(F):R(a)||R(M)>0||t().settings.autoStageOnEmptyIndex&&R(D)>0}function U(H){return R(P)?!1:H==="all"||R(M)>0}function et(H="smart"){J(H)&&(X(i,!0),R(l)&&t().promiseQueue.addTask(()=>t().gitActions.commit({fromAuto:!1,commitMessage:R(u),mode:H}).then(()=>X(u,t().settings.commitMessage)).finally(ee)))}function se(){J("staged")&&(X(i,!0),t().promiseQueue.addTask(()=>t().gitActions.commit({fromAuto:!1,commitMessage:R(u),mode:"staged",amend:!0}).then(()=>X(u,t().settings.commitMessage)).finally(ee)))}function vt(H="all"){U(H)&&(X(i,!0),R(l)&&t().promiseQueue.addTask(()=>t().gitActions.commitAndSync({fromAutoBackup:!1,commitMessage:R(u),mode:H}).then(()=>{X(u,t().settings.commitMessage)}).finally(ee)))}function tt(H){H.stopPropagation();let ae=Ks.Menu.forEvent(H);ae.addItem($e=>$e.setTitle("Commit staged").setIcon("git-commit").setDisabled(!J("staged")).onClick(()=>et("staged"))),ae.addItem($e=>$e.setTitle("Stage all and commit").setIcon("list-plus").setDisabled(!J("all")).onClick(()=>et("all"))),ae.addItem($e=>$e.setTitle("Amend staged").setIcon("git-commit").setDisabled(!J("staged")).onClick(se)),ae.addSeparator(),ae.addItem($e=>$e.setTitle("Commit staged and sync").setIcon("arrow-up-circle").setDisabled(!J("staged")).onClick(()=>vt("staged"))),ae.showAtMouseEvent(H)}async function j(){if(!t().gitReady){X(l,void 0),X(i,!1);return}if(X(b,await t().getUnpushedCommits(),!0),X(l,t().cachedStatus,!0),X(a,t().state.mergeInProgress,!0),X(i,!1),t().lastPulledFiles&&t().lastPulledFiles!=R(c)&&(X(c,t().lastPulledFiles,!0),X(m,{title:"",path:"",vaultPath:"",children:t().gitManager.getTreeStructure(R(c),t().settings.limitToVault?"vault":"repository")},!0)),R(l)){let H=(ae,$e)=>ae.vaultPath.split("/").last().localeCompare(Qn($e.vaultPath));R(l).changed.sort(H),R(l).staged.sort(H),X(d,{title:"",path:"",vaultPath:"",children:t().gitManager.getTreeStructure(R(l).changed,t().settings.limitToVault?"vault":"repository")},!0),X(h,{title:"",path:"",vaultPath:"",children:t().gitManager.getTreeStructure(R(l).staged,t().settings.limitToVault?"vault":"repository")},!0),X(p,{title:"",path:"",vaultPath:"",children:t().gitManager.getTreeStructure(R(l).conflicted.map(ae=>({path:ae,vaultPath:t().gitManager.getRelativeVaultPath(ae),index:"U",workingDir:"U"})))},!0)}else X(d,void 0),X(h,void 0),X(p,void 0);await Ce()}function Ce(H){let ae=S.then(()=>z(H));return S=ae.catch(()=>{}),ae}async function z(H){var ht,qt;let ae=H?[H]:(qt=(ht=R(l))==null?void 0:ht.conflicted)!=null?qt:[],$e=H?{...R(C)}:{};for(let jn of ae){$e[jn]=0;try{let Xs=await n().app.vault.adapter.read(t().gitManager.getRelativeVaultPath(jn));$e[jn]=we(Xs)}catch(Xs){}}X(C,$e,!0)}function we(H){var ae;return((ae=H.match(/^<{7}/gm))!=null?ae:[]).length}function ee(){n().app.workspace.trigger("obsidian-git:refresh")}function Oe(H){R(o)||(X(o,!0),t().promiseQueue.addTask(H,()=>{X(o,!1)}))}function Te(H){H.stopPropagation(),X(i,!0),t().promiseQueue.addTask(()=>t().gitActions.stageAll())}function bt(H){H.stopPropagation(),X(i,!0),t().promiseQueue.addTask(()=>t().gitActions.unstageAll())}function vn(){X(i,!0),t().promiseQueue.addTask(()=>t().gitActions.push().finally(ee))}function Vr(){X(i,!0),t().promiseQueue.addTask(()=>t().gitActions.pullChangesFromRemote().finally(ee))}function jc(H){H.stopPropagation(),t().promiseQueue.addTask(()=>t().gitActions.discardAll())}let _O=He(()=>(R(u).match(/\n/g)||[]).length+1||1);var zc=FV();let W_;var q_=W(zc);{var xO=H=>{var ae=kV(),$e=K(W(ae),2),ht=W($e),qt=K(ht,2);V($e),V(ae),Ue(()=>{ht.disabled=R(o),qt.disabled=R(o)}),de("click",ht,()=>Oe(()=>t().gitActions.createNewRepo())),de("click",qt,()=>Oe(()=>t().gitActions.cloneNewRepo())),te(H,ae)};Ae(q_,H=>{R(s)&&H(xO)})}var sg=K(q_,2),Y_=W(sg),og=W(Y_),Ka=W(og);let K_;rt(Ka,H=>f[0]=H,()=>f==null?void 0:f[0]);var Za=K(Ka,2);let Z_;rt(Za,H=>f[1]=H,()=>f==null?void 0:f[1]);var X_=K(Za,2);rt(X_,H=>f[10]=H,()=>f==null?void 0:f[10]),V(og);var ag=K(og,2);rt(ag,H=>f[2]=H,()=>f==null?void 0:f[2]);var lg=K(ag,2);rt(lg,H=>f[3]=H,()=>f==null?void 0:f[3]);var cg=K(lg,2);rt(cg,H=>f[4]=H,()=>f==null?void 0:f[4]);var ug=K(cg,2);rt(ug,H=>f[5]=H,()=>f==null?void 0:f[5]);var dd=K(ug,2);rt(dd,H=>f[6]=H,()=>f==null?void 0:f[6]);var hd=K(dd,2);let Q_;rt(hd,H=>f[7]=H,()=>f==null?void 0:f[7]);var EO=K(hd,2);{var SO=H=>{var ae=AV();rt(ae,$e=>f[11]=$e,()=>f==null?void 0:f[11]),de("click",ae,()=>t().openMergeConflictHelp()),te(H,ae)};Ae(EO,H=>{R(a)&&H(SO)})}V(Y_),V(sg);var fg=K(sg,2),pd=W(fg);$y(pd);var kO=K(pd,2);{var AO=H=>{var ae=CV();ye(ae,"aria-label","Clear"),de("click",ae,()=>X(u,"")),te(H,ae)};Ae(kO,H=>{R(u)&&H(AO)})}V(fg);var J_=K(fg,2),ex=W(J_);{var CO=H=>{var ae=RV();let $e;var ht=W(ae),qt=W(ht);let jn;var Xs=K(qt,4),md=W(Xs),Vc=Ye(md,!0);V(Xs),V(ht);var gd=K(ht,2);{var dg=Wc=>{var Xa=TV(),hg=W(Xa);{var wd=ms=>{Bo(ms,{get hierarchy(){return R(p)},get plugin(){return t()},get view(){return n()},get fileType(){return 3},get conflictCounts(){return R(C)},topLevel:!0,get closed(){return R(k)},set closed(Qa){X(k,Qa,!0)}})},pg=ms=>{var Qa=Vs(),Ja=Fn(Qa);gn(Ja,17,()=>R(T),mn,(vd,Ho)=>{sd(vd,{get path(){return R(Ho)},get count(){return R(C)[R(Ho)]},get view(){return n()},get manager(){return t().gitManager}})}),te(ms,Qa)};Ae(hg,ms=>{R(Z)&&R(p)?ms(wd):ms(pg,-1)})}V(Xa),ci(3,Xa,()=>Di,()=>({duration:150})),te(Wc,Xa)};Ae(gd,Wc=>{R(A)&&Wc(dg)})}V(ae),Ue(()=>{$e=dt(ae,1,"conflicts tree-item nav-folder svelte-5wq9p",null,$e,{"is-collapsed":!R(A)}),jn=dt(qt,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon svelte-5wq9p",null,jn,{"is-collapsed":!R(A)}),Ke(Vc,R(l).conflicted.length)}),de("click",ht,()=>X(A,!R(A))),te(H,ae)};Ae(ex,H=>{R(l)&&R(l).conflicted.length>0&&H(CO)})}var TO=K(ex,2);{var RO=H=>{var ae=OV(),$e=W(ae);let ht;var qt=W($e),jn=W(qt);let Xs;var md=K(jn,4),Vc=W(md),gd=W(Vc);rt(gd,kt=>f[8]=kt,()=>f==null?void 0:f[8]),V(Vc);var dg=K(Vc,2),Wc=Ye(dg,!0);V(md),V(qt);var Xa=K(qt,2);{var hg=kt=>{var $t=M_(),zn=W($t);{var Wr=Yt=>{Bo(Yt,{get hierarchy(){return R(h)},get plugin(){return t()},get view(){return n()},get fileType(){return 0},topLevel:!0,get closed(){return R(x)},set closed(fi){X(x,fi,!0)}})},gs=Yt=>{var fi=F_(),Go=Fn(fi);gn(Go,17,()=>tf(R(l).staged,500),mn,(Qs,qc)=>{ld(Qs,{get change(){return R(qc)},get view(){return n()}})});var Uo=K(Go,2);Wa(Uo,{get files(){return R(l).staged}}),te(Yt,fi)};Ae(zn,Yt=>{R(Z)?Yt(Wr):Yt(gs,-1)})}V($t),ci(3,$t,()=>Di,()=>({duration:150})),te(kt,$t)};Ae(Xa,kt=>{R(y)&&kt(hg)})}V($e);var wd=K($e,2);{var pg=kt=>{var $t=$V(),zn=W($t),Wr=K(W(zn),2),gs=W(Wr),Yt=Ye(gs,!0);V(Wr),V(zn),V($t),Ue(()=>Ke(Yt,R(l).stagedOutsideVault)),te(kt,$t)};Ae(wd,kt=>{R(l).stagedOutsideVault>0&&kt(pg)})}var ms=K(wd,2);{var Qa=kt=>{var $t=PV(),zn=W($t),Wr=K(W(zn),2),gs=W(Wr),Yt=Ye(gs,!0);V(Wr),V(zn),V($t),Ue(()=>Ke(Yt,R(l).conflictedOutsideVault)),te(kt,$t)};Ae(ms,kt=>{R(l).conflictedOutsideVault>0&&kt(Qa)})}var Ja=K(ms,2);let vd;var Ho=W(Ja),tx=W(Ho);let rx;var nx=K(tx,4),mg=W(nx),ix=W(mg),sx=K(ix,2);rt(sx,kt=>f[9]=kt,()=>f==null?void 0:f[9]),V(mg);var $O=K(mg,2),PO=Ye($O,!0);V(nx),V(Ho);var IO=K(Ho,2);{var OO=kt=>{var $t=M_(),zn=W($t);{var Wr=Yt=>{Bo(Yt,{get hierarchy(){return R(d)},get plugin(){return t()},get view(){return n()},get fileType(){return 1},topLevel:!0,get closed(){return R(E)},set closed(fi){X(E,fi,!0)}})},gs=Yt=>{var fi=F_(),Go=Fn(fi);gn(Go,17,()=>tf(R(l).changed,500),mn,(Qs,qc)=>{od(Qs,{get change(){return R(qc)},get view(){return n()}})});var Uo=K(Go,2);Wa(Uo,{get files(){return R(l).changed}}),te(Yt,fi)};Ae(zn,Yt=>{R(Z)?Yt(Wr):Yt(gs,-1)})}V($t),ci(3,$t,()=>Di,()=>({duration:150})),te(kt,$t)};Ae(IO,kt=>{R(w)&&kt(OO)})}V(Ja);var FO=K(Ja,2);{var MO=kt=>{var $t=IV();let zn;var Wr=W($t),gs=K(W(Wr),4),Yt=Ye(gs,!0);V(Wr);var fi=K(Wr,2);{var Go=Uo=>{var Qs=M_(),qc=W(Qs);{var DO=el=>{Bo(el,{get hierarchy(){return R(m)},get plugin(){return t()},get view(){return n()},get fileType(){return 2},topLevel:!0,get closed(){return R($)},set closed(bd){X($,bd,!0)}})},LO=el=>{var bd=F_(),ox=Fn(bd);gn(ox,17,()=>R(c),mn,(BO,HO)=>{ad(BO,{get change(){return R(HO)},get view(){return n()}})});var NO=K(ox,2);Wa(NO,{get files(){return R(c)}}),te(el,bd)};Ae(qc,el=>{R(Z)?el(DO):el(LO,-1)})}V(Qs),ci(3,Qs,()=>Di,()=>({duration:150})),te(Uo,Qs)};Ae(fi,Uo=>{R(v)&&Uo(Go)})}V($t),Ue(()=>{zn=dt($t,1,"pulled nav-folder",null,zn,{"is-collapsed":!R(v)}),Ke(Yt,R(c).length)}),de("click",Wr,()=>X(v,!R(v))),te(kt,$t)};Ae(FO,kt=>{R(c).length>0&&R(m)&&kt(MO)})}V(ae),Ue(()=>{ht=dt($e,1,"staged tree-item nav-folder",null,ht,{"is-collapsed":!R(y)}),Xs=dt(jn,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,Xs,{"is-collapsed":!R(y)}),Ke(Wc,R(l).staged.length),vd=dt(Ja,1,"changes tree-item nav-folder",null,vd,{"is-collapsed":!R(w)}),rx=dt(tx,1,"tree-item-icon nav-folder-collapse-indicator collapse-icon",null,rx,{"is-collapsed":!R(w)}),Ke(PO,R(l).changed.length)}),de("click",qt,()=>X(y,!R(y))),de("click",gd,bt),de("click",Ho,()=>X(w,!R(w))),de("click",ix,jc),de("click",sx,Te),te(H,ae)};Ae(TO,H=>{R(l)&&R(h)&&R(d)&&H(RO)})}V(J_),V(zc),Ue(()=>{ye(zc,"data-type",wr.type),W_=dt(zc,1,"git-view svelte-5wq9p",null,W_,{"repository-missing":R(s)}),K_=dt(Ka,1,"clickable-icon nav-action-button svelte-5wq9p",null,K_,{"is-disabled":R(Q)}),ye(Ka,"aria-label",R(fe)),ye(Ka,"aria-disabled",R(Q)),Z_=dt(Za,1,"clickable-icon nav-action-button svelte-5wq9p",null,Z_,{"is-disabled":R(_e)}),ye(Za,"aria-label",R(oe)),ye(Za,"aria-disabled",R(_e)),ye(dd,"data-icon",R(Z)?"list":"folder"),Q_=dt(hd,1,"clickable-icon nav-action-button",null,Q_,{loading:R(i)}),ye(pd,"rows",R(_O))}),de("click",Ka,()=>vt()),de("click",Za,()=>et()),de("click",X_,tt),de("click",ag,Te),de("click",lg,bt),de("click",cg,vn),de("click",ug,Vr),de("click",dd,()=>{X(Z,!R(Z)),(0,Ks.setIcon)(f[6],R(Z)?"list":"folder"),t().settings.treeStructure=R(Z),t().saveSettings()}),de("click",hd,ee),E_(pd,()=>R(u),H=>X(u,H)),te(r,zc),wt()}Ot(["click"]);var cd=class extends rO.ItemView{constructor(e,t){super(e),this.plugin=t,this.hoverPopover=null}getViewType(){return wr.type}getDisplayText(){return wr.name}getIcon(){return wr.icon}async onClose(){return this._view&&await Ws(this._view),super.onClose()}async reload(){this._view&&await Ws(this._view),this._view=Do(D_,{target:this.contentEl,props:{plugin:this.plugin,view:this}})}async onOpen(){return await this.reload(),super.onOpen()}};g();var Hm=class{constructor(e,t){this.statusBarEl=e;this.plugin=t;this.statusBarEl.addClass("mod-clickable"),this.statusBarEl.onClickEvent(n=>{this.plugin.promiseQueue.addTask(()=>this.plugin.gitActions.switchBranch())})}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()}};g();var nO=require("obsidian");var Gm=class{constructor(e){this.plugin=e}get editor(){var n;let e=(n=this.plugin.app.workspace.activeEditor)==null?void 0:n.editor,t=e==null?void 0:e.cm;if(!(!e||!xi.hasHunksData(t.state)))return{editor:t,obEditor:e}}resetHunk(e){if(!this.editor)return;let{editor:t,obEditor:n}=this.editor,i=xi.getHunk(t.state,!1,e);if(i){let s,o;i.type==="delete"?(s=i.added.start+1,o=i.added.start+1):(s=i.added.start-0,o=i.added.start-1+i.added.count);let a=t.state.doc.line(s).from,l=i.type==="delete"?t.state.doc.line(o).from:t.state.doc.line(o).to+1,c=i.removed.lines.join(`
`);i.removed.lines.length>0&&!i.removed.no_nl_at_eof&&(c+=`
`),n.replaceRange(c,n.offsetToPos(a),n.offsetToPos(l)),n.setSelection(n.offsetToPos(a))}}async stageHunk(e){if(!this.editor)return;let{editor:t}=this.editor,n=xi.getHunk(t.state,!1,e),i=!1;if(n||(n=xi.getHunk(t.state,!0,e),i=!0),!n)return;let s=t.state.field(nO.editorInfoField).file.path,o=cr.createPatch(s,[n],"100644",i).join(`
`)+`
`;await this.plugin.gitActions.applyPatch(o)}goToHunk(e){if(!this.editor)return;let{editor:t,obEditor:n}=this.editor,i=xi.getHunks(t.state,!1),s=n.getCursor().line+1,o=cr.findNearestHunk(s,i,e,!0);if(o==null)return;let a=i[o];if(a){let l=a.added.start-1;n.setCursor(l,0),n.scrollIntoView({from:{line:l,ch:0},to:{line:l+1,ch:0}},!0)}}};g();g();var qa=require("obsidian");var Um=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.lineAuthorInfoProvider){this.plg.warn("undefined lineAuthorInfoProvider. Unexpected situation.");return}let t=e==null?void 0:e.view;!(t instanceof qa.MarkdownView)||t.file==null||(t==null?void 0:t.allowNoFile)===!0||this.lineAuthorInfoProvider.trackChanged(t.file).catch(console.error)}}onLoadPlugin(){this.plg.registerEditorExtension(this.codeMirrorExtensions),v$(()=>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;T$(this.plg.settings.lineAuthor),this.lineAuthorInfoProvider=new _p(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions()}catch(e){this.plg.warn("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}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&qa.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Ze?this.plg.gitManager:void 0}}refreshLineAuthorViews(){this.plg.settings.lineAuthor.show&&(this.deactivateFeature(),this.activateFeature())}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(B$),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(),E$(),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 t;e&&((t=this.lineAuthorInfoProvider)==null||t.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,t)=>{var n;return e instanceof qa.TFile&&((n=this.lineAuthorInfoProvider)==null?void 0:n.trackChanged(e))})}createVaultFileModificationHandler(){return this.plg.app.vault.on("modify",e=>{var t;return e instanceof qa.TFile&&((t=this.lineAuthorInfoProvider)==null?void 0:t.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",A$)}};g();var Uc=require("obsidian");g();g();var Ya=require("@codemirror/state"),zm=require("@codemirror/view");var jm=class extends zm.GutterMarker{constructor(t,n){super();this.type=t;this.staged=n}toDOM(t){let n=createDiv();return n.className=`git-gutter-marker git-${this.type} ${this.staged?"staged":"unstaged"}`,this.type=="changedelete"&&n.setText("~"),n}},L_=Ya.StateField.define({create:()=>Ya.RangeSet.empty,update:(r,e)=>{let t=e.state.field(on,!1);if(!t)return Ya.RangeSet.empty;let n=e.effects.some(s=>s.is(Fp)),i=e.effects.some(s=>s.is(cc));if(n||i||(e.docChanged||r.size==0)&&t.isDirty==!1){let s=new Set,o=iO(e,t.hunks,!1,s),a=iO(e,t.stagedHunks,!0,s);return r=Ya.RangeSet.of([...o,...a],!0),r}else e.docChanged&&(r=r.map(e.changes));return r}});function iO(r,e,t,n){let i=[];for(let o=0;o<e.length;o++){let a=o>0?e[o-1]:void 0,l=o<e.length-1?e[o+1]:void 0,c=e[o];i.push(...cr.calcSigns(a,c,l))}let s=[];for(let o of i){if(n.has(o.lnum))continue;let a=r.state.doc.line(o.lnum);n.add(o.lnum),s.push(new jm(o.type,t).range(a.from,a.to))}return s}var sO=(0,zm.gutter)({class:"git-signs-gutter",markers:r=>{var e;return(e=r.state.field(L_,!1))!=null?e:Ya.RangeSet.empty},initialSpacer:r=>new jm("delete",!1),domEventHandlers:{click:(r,e,t)=>{var i;return((i=xi.getHunkAtPos(r.state,e.from,!1))!=null?i:xi.getHunkAtPos(r.state,e.from,!0))&&(Co(r,e.from),t.preventDefault()),!1}}});var Vm=class{constructor(e){this.plugin=e}async trackChanged(e){try{await this.trackChangedHelper(e)}catch(t){throw console.warn("Git: Error in trackChanged.",t),t}}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 n=await this.plugin.editorIntegration.lineAuthoringFeature.isAvailableOnCurrentPlatform().gitManager.show("",e).catch(()=>{});this.notifySignComputationResultToSubscribers(e,{compareText:n,compareTextHead:void 0})}notifySignComputationResultToSubscribers(e,t){Jn.ifFilepathDefinedTransformSubscribers(e,n=>n.forEach(i=>i.notifyGitCompare(t)))}},oO=[e2,t2,sO,L_,Vp],aO=[on,vf];g();var Wm=require("obsidian"),qm=class{constructor(e,t){this.statusBarEl=e;this.plugin=t;var n;e.addClass("git-changes-status-bar"),t.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=(n=t.app.workspace.getActiveViewOfType(Wm.MarkdownView))!=null?n:void 0,t.app.workspace.on("active-leaf-change",i=>{!i||i.getRoot()==t.app.workspace.rootSplit&&!(i.view instanceof Wm.MarkdownView)?this.statusBarEl.empty():i.view instanceof Wm.MarkdownView&&(this.view=i.view)})}display(e,t){var o;if(!this.view||((o=this.view.file)==null?void 0:o.path)!==(t==null?void 0:t.path))return;let n=0,i=0,s=0;for(let a of e)n+=Math.max(0,a.added.count-a.removed.count),i+=Math.min(a.added.count,a.removed.count),s+=Math.max(0,a.removed.count-a.added.count);this.statusBarEl.empty(),n>0&&this.statusBarEl.createSpan({text:`+${n} `,cls:"git-add"}),i>0&&this.statusBarEl.createSpan({text:`~${i} `,cls:"git-change"}),s>0&&this.statusBarEl.createSpan({text:`-${s}`,cls:"git-delete"})}remove(){this.statusBarEl.remove()}};var Ym=class{constructor(e){this.plg=e;this.codeMirrorExtensions=[];this.handleWorkspaceLeaf=e=>{if(!this.signsProvider){console.warn("Git: undefined signsProvider. Unexpected situation.");return}let t=e==null?void 0:e.view;!(t instanceof Uc.MarkdownView)||t.file==null||(t==null?void 0:t.allowNoFile)===!0||this.signsProvider.trackChanged(t.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 Vm(this.plg),this.createEventHandlers(),this.activateCodeMirrorExtensions(),this.plg.settings.hunks.statusBar!="disabled"){let e=this.plg.addStatusBarItem();this.changeStatusBar=new qm(e,this.plg)}}catch(e){console.warn("Git: Error while loading signs feature.",e),this.deactivateFeature()}}deactivateFeature(){var e,t;this.destroyEventHandlers(),this.deactivateCodeMirrorExtensions(),(e=this.signsProvider)==null||e.destroy(),this.signsProvider=void 0,(t=this.changeStatusBar)==null||t.remove(),this.changeStatusBar=void 0}isAvailableOnCurrentPlatform(){return{available:this.plg.useSimpleGit&&Uc.Platform.isDesktopApp,gitManager:this.plg.gitManager instanceof Ze?this.plg.gitManager:void 0}}refresh(){this.signsProvider&&this.plg.app.workspace.iterateAllLeaves(this.handleWorkspaceLeaf)}activateCodeMirrorExtensions(){this.codeMirrorExtensions.push(aO),this.plg.settings.hunks.showSigns&&this.codeMirrorExtensions.push(...oO),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,t)=>{var n;return Jn.ifFilepathDefinedTransformSubscribers(t,i=>i.forEach(s=>{s.changeToNewFilepath(e.path)})),e instanceof Uc.TFile&&((n=this.signsProvider)==null?void 0:n.trackChanged(e))})}createPluginRefreshedEvent(){return this.plg.app.workspace.on("obsidian-git:refreshed",()=>{this.refresh()})}createIntervalRefreshEvent(){return window.setInterval(()=>{var e,t;(e=this.plg.app.workspace.activeEditor)!=null&&e.file&&((t=this.signsProvider)==null||t.trackChanged(this.plg.app.workspace.activeEditor.file).catch(console.error))},10*1e3)}};g();var ud=require("@codemirror/state"),wn=require("@codemirror/view"),Zs=require("obsidian");g();g();var lO=/^<{7}(?:[ \t].*)?$/,DV=/^\|{7}(?:[ \t].*)?$/,LV=/^={7}(?:[ \t].*)?$/,NV=/^>{7}(?:[ \t].*)?$/;function BV(r){let e=[],t=0;for(;t<=r.length;){let n=r.indexOf(`
`,t),i=n===-1?r.length:n;if(e.push({from:t,to:i,text:r.slice(t,i)}),n===-1)break;t=n+1}return e}function Km(r){let e=BV(r),t=[];for(let n=0;n<e.length;n++){let i=e[n];if(!lO.test(i.text))continue;let s=-1,o=-1;for(let d=n+1;d<e.length;d++){let h=e[d];if(LV.test(h.text)){o=d;break}s===-1&&DV.test(h.text)&&(s=d)}if(o===-1)continue;let a=-1;for(let d=o+1;d<e.length;d++){let h=e[d];if(NV.test(h.text)){a=d;break}if(lO.test(h.text))break}if(a===-1)continue;let l=e[o],c=e[a],u=s!==-1?e[s]:void 0,f=[{from:i.from,to:i.to}];u!==void 0&&f.push({from:u.from,to:u.to}),f.push({from:l.from,to:l.to},{from:c.from,to:c.to}),t.push({from:i.from,to:c.to<r.length?c.to+1:c.to,ours:r.slice(i.to+1,u!==void 0?u.from:l.from),theirs:r.slice(l.to+1,c.from),base:u!==void 0?r.slice(u.to+1,l.from):void 0,markers:f,oursRange:{from:i.to+1,to:u!==void 0?u.from:l.from},baseRange:u!==void 0?{from:u.to+1,to:l.from}:void 0,theirsRange:{from:l.to+1,to:c.from}}),n=a}return t}function N_(r,e){switch(e){case"ours":return r.ours;case"theirs":return r.theirs;case"base":if(r.base===void 0)throw new Error("Cannot keep the base of a two-way conflict");return r.base;case"both":return r.ours+r.theirs}}function cO(r,e,t){r.dispatch({changes:{from:e.from,to:e.to,insert:N_(e,t)}}),r.focus()}function uO(r,e){let t=Km(r.state.doc.toString());r.dispatch({changes:t.map(n=>({from:n.from,to:n.to,insert:N_(n,e)}))}),r.focus()}var HV=["ours","base","theirs","both"],j_=ud.Facet.define({combine:r=>{var e;return(e=r[0])!=null?e:"both"}});function fO(r){var i;let e=r.facet(j_),t=(i=r.field(Zs.editorLivePreviewField,!1))!=null?i:!1;if(e==="disabled"||e==="source"&&t||e==="live-preview"&&!t)return[];let n=r.doc.toString();return n.includes("<<<<<<<")?Km(n):[]}var ps=ud.StateField.define({create:fO,update:(r,e)=>e.docChanged||e.reconfigured||e.startState.field(Zs.editorLivePreviewField,!1)!==e.state.field(Zs.editorLivePreviewField,!1)?fO(e.state):r});function hO(r,e,t){for(let n of HV){let i=e[n];if(i===void 0)continue;new Zs.ButtonComponent(r).setButtonText(i).onClick(o=>{o.preventDefault(),t(n)}).buttonEl.addClass("clickable-icon","nav-action-button",`git-conflict-choose-${n}`)}}var H_=class extends wn.WidgetType{constructor(t){super();this.block=t}eq(t){return t.block.from===this.block.from&&t.block.to===this.block.to&&t.block.ours===this.block.ours&&t.block.theirs===this.block.theirs&&t.block.base===this.block.base}toDOM(t){let n=createDiv({cls:"git-conflict-actions-group git-conflict-actions-widget"}),i={ours:"Keep ours",theirs:"Keep theirs",both:"Keep both"};return this.block.base!==void 0&&(i.base="Keep base"),hO(n,i,s=>cO(t,this.block,s)),n}};function pO(r,e){var i;let t=(i=e.state.field(ps,!1))!=null?i:[];r.createSpan({cls:"git-conflict-panel-label",text:`${t.length} conflict${t.length===1?"":"s"} in file`});let n={ours:"Keep all ours",theirs:"Keep all theirs",both:"Keep both"};t.every(s=>s.base!==void 0)&&(n.base="Keep all base"),hO(r.createDiv({cls:"git-conflict-actions-group"}),n,s=>uO(e,s))}var G_=class extends wn.WidgetType{constructor(t,n){super();this.count=t;this.hasBase=n}eq(t){return t.count===this.count&&t.hasBase===this.hasBase}toDOM(t){let n=createDiv({cls:"git-conflict-panel"});return pO(n,t),n}};function B_(r,e,t,n){if(t.from>=t.to)return;let i=e.doc.lineAt(t.from).number,s=e.doc.lineAt(t.to-1).number;for(let o=i;o<=s;o++)r.push(wn.Decoration.line({class:n}).range(e.doc.line(o).from))}function dO(r){var n;let e=(n=r.field(ps,!1))!=null?n:[],t=[];Zs.Platform.isMobile&&e.length>0&&t.push(wn.Decoration.widget({widget:new G_(e.length,e.every(i=>i.base!==void 0)),block:!0,side:-1}).range(0));for(let i of e){let s=i.markers[0];for(let[o,a]of i.markers.entries()){let l=o===0?" git-conflict-marker-ours":o===i.markers.length-1?" git-conflict-marker-theirs":"";t.push(wn.Decoration.line({class:`git-conflict-marker-line${l}`}).range(a.from),wn.Decoration.mark({class:`git-conflict-marker${l}`}).range(a.from,a.to))}t.push(wn.Decoration.widget({widget:new H_(i),side:1}).range(s.to)),B_(t,r,i.oursRange,"git-conflict-ours-line"),i.baseRange!==void 0&&B_(t,r,i.baseRange,"git-conflict-base-line"),B_(t,r,i.theirsRange,"git-conflict-theirs-line")}return wn.Decoration.set(t,!0)}var GV=ud.StateField.define({create:r=>dO(r),update:(r,e)=>e.docChanged||e.reconfigured||e.startState.field(ps)!==e.state.field(ps)?dO(e.state):r,provide:r=>wn.EditorView.decorations.from(r)}),U_=class{constructor(e){this.view=e;this.dom=createDiv({cls:"git-conflict-panel"});this.top=!0;this.render()}update(e){(e.docChanged||e.transactions.some(t=>t.reconfigured)||e.startState.field(ps)!==e.state.field(ps))&&this.render()}render(){var t;this.dom.empty(),((t=this.view.state.field(ps,!1))!=null?t:[]).length!==0&&pO(this.dom,this.view)}},UV=r=>new U_(r),jV=wn.showPanel.compute([ps],r=>!Zs.Platform.isMobile&&r.field(ps).length>0?UV:null),mO=[ps,GV,jV];g();var gO=require("@codemirror/state"),Zm=require("obsidian");var z_=class{constructor(e){this.state=e;this.subscribeMe()}notifyLineAuthoring(e,t){if(this.view===void 0){console.warn(`Git: View is not defined for editor cache key. Unforeseen situation. id: ${e}`);return}let n=this.view.state,i=w$(e,t,n);this.view.dispatch(i)}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 t=this.view.state,n=t.field(on);if(!n||n.compareText!=e.compareText||n.compareTextHead!=e.compareTextHead){let i=$P(e,t);this.view.dispatch(i)}}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(V_,!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&&(Jn.ifFilepathDefinedTransformSubscribers(e,t=>t.add(this)),this.lastSeenPath=e)}unsubscribeMe(e){Jn.ifFilepathDefinedTransformSubscribers(e,t=>t.delete(this))}get filepath(){var e,t;return(t=(e=this.state.field(Zm.editorInfoField))==null?void 0:e.file)==null?void 0:t.path}get view(){return this.state.field(Zm.editorEditorField)}},V_=gO.StateField.define({create:r=>new z_(r),update:(r,e)=>r.updateToNewState(e.state),compare:(r,e)=>r===e});var Xm=class{constructor(e){this.plg=e;this.conflictEditorExtensions=[];this.lineAuthoringFeature=new Um(this.plg);this.signsFeature=new Ym(this.plg)}onUnloadPlugin(){this.lineAuthoringFeature.deactivateFeature(),this.signsFeature.deactivateFeature(),Jn.clear()}onLoadPlugin(){Jn.init(),this.plg.registerEditorExtension(V_),this.conflictEditorExtensions=this.getConflictExtensions(),this.plg.registerEditorExtension(this.conflictEditorExtensions),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()}refreshConflictSettings(){this.conflictEditorExtensions.splice(0,this.conflictEditorExtensions.length,...this.getConflictExtensions()),this.plg.app.workspace.updateOptions()}getConflictExtensions(){let e=this.plg.settings.conflictResolutionMode;return e==="disabled"?[]:[j_.of(e),mO]}};g();async function Li(r,e){try{return{status:"success",value:await e()}}catch(t){return await zV(r,t),{status:t instanceof Fr.UserCanceledError?"cancelled":"failed"}}}async function zV(r,e){if(!(e instanceof Fr.UserCanceledError)){if(e instanceof Xn){let t=e.files;try{t=(await r.updateCachedStatus()).conflicted}catch(n){console.error("Failed to refresh conflict status",n)}r.log("Git conflict:",e.cause),r.handleConflict(t);return}if(e instanceof Hl){r.handleNoNetworkError(e);return}if(e instanceof Fr.PushRejectedError){r.log("Push rejected:",e),r.displayError(e.data.reason==="tag-exists"?"Push rejected because the tag already exists on the remote.":"Push rejected. Pull changes from the remote, resolve any conflicts, then push again.");return}r.displayError(e)}}g();var Un=require("obsidian"),ng=nt(require("fs/promises"),1);g();var Jm=require("obsidian"),Qm=class extends Jm.SuggestModal{constructor(t){super(t.app);this.plugin=t;this.resolve=null;this.setPlaceholder("Type your message and select optional the version with the added date.")}openAndGetResult(){return new Promise(t=>{this.resolve=t,this.open()})}onClose(){new Promise(t=>window.setTimeout(t,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(t){let n=(0,Jm.moment)().format(this.plugin.settings.commitDateFormat);return t==""&&(t="..."),[t,`${n}: ${t}`,`${t}: ${n}`]}renderSuggestion(t,n){n.innerText=t}onChooseSuggestion(t,n){this.resolve&&this.resolve(t)}};g();var wO=require("obsidian"),eg=class extends wO.FuzzySuggestModal{constructor(t,n){super(t.app);this.branches=n;this.setPlaceholder("Select branch to checkout")}getItems(){return this.branches}getItemText(t){return t}onChooseItem(t,n){this.resolve(t)}openAndGetReslt(){return new Promise(t=>{this.resolve=t,this.open()})}onClose(){new Promise(t=>window.setTimeout(t,10)).then(()=>{this.resolve&&this.resolve(void 0)})}};g();var vO=require("obsidian"),tg=class extends vO.FuzzySuggestModal{constructor(e,t){super(e.app),this.plugin=e,this.changedFiles=t,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 t="",n="";return e.workingDir!=" "&&(t=`Working Dir: ${e.workingDir} `),e.index!=" "&&(n=`Index: ${e.index}`),`${t}${n} | ${e.vaultPath}`}onChooseItem(e,t){this.plugin.app.metadataCache.getFirstLinkpathDest(e.vaultPath,"")==null?this.app.openWithDefaultApp(e.vaultPath):this.plugin.app.workspace.openLinkText(e.vaultPath,"/")}};g();var bO=require("obsidian");var fd=class extends bO.Modal{constructor({app:t,path:n,filesToDeleteCount:i,filesToDiscardCount:s}){super(t);this.resolve=null;this.path=n,this.deleteCount=i,this.discardCount=s}openAndGetResult(){return this.open(),new Promise(t=>{this.resolve=t})}onOpen(){let t=this.deleteCount+this.discardCount,{contentEl:n,titleEl:i}=this,s="";this.path!=""&&(t>1?s=`files in "${this.path}"`:s=`"${this.path}"`),i.setText(`${this.discardCount==0?"Delete":"Discard"} ${s}`),this.deleteCount>0&&n.createEl("p").setText(`Are you sure you want to DELETE the ${ef(this.deleteCount,"untracked file")}? They are deleted according to your Obsidian trash settting.`),this.discardCount>0&&n.createEl("p").setText(`Are you sure you want to discard ALL changes in ${ef(this.discardCount,"tracked file")}?`);let o=n.createDiv({cls:"modal-button-container"});if(this.deleteCount>0){let l=o.createEl("button",{cls:"mod-warning",text:`${this.discardCount>0?"Discard":"Delete"} all ${ef(t,"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=o.createEl("button",{cls:"mod-warning",text:`Discard all ${ef(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 a=o.createEl("button",{text:"Cancel"});a.addEventListener("click",()=>(this.resolve&&this.resolve(!1),this.close())),a.addEventListener("keypress",()=>(this.resolve&&this.resolve(!1),this.close()))}onClose(){let{contentEl:t}=this;t.empty()}};var rg=class{constructor(e){this.plugin=e}async addFileToGitignore(e,t){return this.runFileStateMutation(async()=>{let n=this.plugin.gitManager.getRelativeRepoPath(e,!0),i=OT({isFolder:t,gitRelativePath:n});await this.plugin.app.vault.adapter.append(this.plugin.gitManager.getRelativeVaultPath(".gitignore"),`
`+i)})}async createNewRepo(){let e=await Li(this.plugin,async()=>(await this.plugin.gitManager.init(),await this.plugin.init({fromReload:!0}),{status:"initialized"}));return e.status==="success"&&this.reportInitRepositoryResult(e.value),e}reportInitRepositoryResult(e){if(e.status==="initialized"){this.plugin.displayMessage("Initialized new repo");return}}async deleteRepository(){let e=await Li(this.plugin,async()=>{let t=this.plugin.settings.basePath?`${this.plugin.settings.basePath}/.git`:".git";return await this.plugin.app.vault.adapter.exists(t)?await new _t(this.plugin,{options:["NO","YES"],placeholder:"Do you really want to delete the repository (.git directory)? This action cannot be undone.",onlySelection:!0}).openAndGetResult()==="YES"?(await this.plugin.app.vault.adapter.rmdir(t,!0),{status:"deleted"}):{status:"cancelled"}:{status:"not-found"}});return e.status==="success"&&(this.reportDeleteRepositoryResult(e.value),e.value.status==="deleted"&&(this.plugin.unloadPlugin(),await this.plugin.init({fromReload:!0}))),e}reportDeleteRepositoryResult(e){switch(e.status){case"deleted":this.plugin.displayMessage("Successfully deleted repository. Reloading plugin...");return;case"not-found":this.plugin.displayMessage("No repository found");return;case"cancelled":return}}async cloneNewRepo(){let e=await Li(this.plugin,()=>this.performCloneNewRepo());return e.status==="success"&&this.reportCloneRepositoryResult(e.value),e}async performCloneNewRepo(){let e=await new _t(this.plugin,{placeholder:"Enter remote URL"}).openAndGetResult();if(!e)return{status:"cancelled",reason:"no-url"};let t="Vault Root",n=await new _t(this.plugin,{options:this.plugin.gitManager instanceof Ts?[t]:[],placeholder:"Enter directory for clone. It needs to be empty or not existent.",allowEmpty:this.plugin.gitManager instanceof Ts}).openAndGetResult();if(n===void 0)return{status:"cancelled",reason:"no-directory"};if(n===t&&(n="."),n=(0,Un.normalizePath)(n),n==="/"&&(n="."),n==="."){let l=await new _t(this.plugin,{options:["NO","YES"],placeholder:`Does your remote repo contain a ${this.plugin.app.vault.configDir} directory at the root?`,onlySelection:!0}).openAndGetResult();if(l===void 0)return{status:"cancelled",reason:"safety-declined"};if(l==="YES"){let c="DELETE ALL YOUR LOCAL CONFIG AND PLUGINS";if(!(await new _t(this.plugin,{options:["Abort clone",c],placeholder:`To avoid conflicts, the local ${this.plugin.app.vault.configDir} directory needs to be deleted.`,onlySelection:!0}).openAndGetResult()===c))return{status:"cancelled",reason:"safety-declined"};await this.plugin.app.vault.adapter.rmdir(this.plugin.app.vault.configDir,!0)}}let i=await new _t(this.plugin,{placeholder:"Specify depth of clone. Leave empty for full clone.",allowEmpty:!0}).openAndGetResult();if(i===void 0)return{status:"cancelled",reason:"no-depth"};let s;if(i!==""&&(s=parseInt(i),isNaN(s)))return{status:"invalid",reason:"depth"};new Un.Notice(`Cloning new repo into "${n}"`);let o=this.plugin.settings.basePath,a=n!==".";a&&(this.plugin.settings.basePath=n);try{return await this.plugin.gitManager.clone(L0(e),n,s),a&&await this.plugin.saveSettings(),{status:"cloned"}}catch(l){throw this.plugin.settings.basePath=o,await this.plugin.saveSettings(),l}}reportCloneRepositoryResult(e){switch(e.status){case"cloned":this.plugin.displayMessage("Cloned new repo."),this.plugin.displayMessage("Please restart Obsidian");return;case"cancelled":{switch(e.reason){case"safety-declined":case"no-depth":this.plugin.displayMessage("Aborted clone");return;case"no-url":case"no-directory":return}return}case"invalid":if(e.reason==="depth"){this.plugin.displayMessage("Invalid depth. Aborting clone.");return}}}runReadyGitAction(e){return Li(this.plugin,async()=>await this.plugin.isAllInitialized()?e():{status:"skipped",reason:"not-ready"})}async listChangedFiles(){let e=await this.runReadyGitAction(async()=>{let t=await this.plugin.updateCachedStatus(),n=t.changed.length+t.staged.length;return n>500?{status:"blocked",reason:"too-many-changes",files:n}:(new tg(this.plugin,t.all).open(),{status:"displayed"})});return e.status==="success"&&this.reportListChangedFilesResult(e.value),e}reportListChangedFilesResult(e){switch(e.status){case"displayed":case"skipped":return;case"blocked":if(e.reason==="too-many-changes"){this.plugin.displayError("Too many changes to display");return}}}async pullChangesFromRemote(){let e=await this.pull();if(e.status!=="success")return;let t=e.value;t.status!=="skipped"&&(this.reportPullResult(t),this.plugin.app.workspace.trigger("obsidian-git:refresh"))}reportPullResult(e){switch(e.status){case"updated":{let t=e.files.length+e.outsideVault,n=e.outsideVault>0?` (${e.files.length} in the vault, ${e.outsideVault} outside)`:"";this.plugin.displayMessage(`Pulled ${t} ${t==1?"file":"files"} from remote${n}`),this.plugin.lastPulledFiles=e.files;return}case"up-to-date":this.plugin.displayMessage("Pull: Everything is up-to-date");return;case"skipped":switch(e.reason){case"not-ready":case"no-upstream":return}}}resolveCommitMode(e,t){return e==="all"?"all":t>0?"staged":e==="staged"?"nothing":this.plugin.settings.autoStageOnEmptyIndex?"all":"nothing"}async commitAndSync(e){return this.runReadyGitAction(()=>this.performCommitAndSync(e))}async performCommitAndSync({fromAutoBackup:e,requestCustomMessage:t=!1,commitMessage:n,mode:i="all"}){this.plugin.settings.syncMethod=="reset"&&this.plugin.settings.pullBeforePush&&this.reportPullResult(await this.performPull());let s=await this.performCommit({fromAuto:e,requestCustomMessage:t,commitMessage:n,mode:i});switch(this.reportCommitResult(s),s.status){case"committed":case"nothing-to-commit":break;case"skipped":return{status:"skipped",reason:"commit-skipped",commit:s}}if(this.plugin.settings.syncMethod!="reset"&&this.plugin.settings.pullBeforePush&&this.reportPullResult(await this.performPull()),this.plugin.settings.disablePush)return{status:"commit-only",reason:"push-disabled",commit:s};if(!await this.isPushRemoteSet())return{status:"skipped",reason:"push-skipped",commit:s};if(await this.plugin.gitManager.canPush()){let o=await this.performPush({refreshStatus:!1});switch(this.reportPushResult(o),o.status){case"pushed":return{status:"synced",commit:s};case"up-to-date":return{status:"nothing-to-push",commit:s};case"blocked":case"skipped":return{status:"skipped",reason:"push-skipped",commit:s}}}return this.reportPushResult({status:"up-to-date"}),{status:"nothing-to-push",commit:s}}async commit(e){let t=await this.runReadyGitAction(()=>this.performCommit(e));return t.status==="success"&&this.reportCommitResult(t.value),t}async performCommit({fromAuto:e,requestCustomMessage:t=!1,mode:n="all",commitMessage:i,amend:s=!1}){let o=await this.plugin.updateCachedStatus(),a=this.plugin.state.mergeInProgress,l=e?aT(this.plugin.settings.autoCommitGlobs):[];e&&this.plugin.settings.autoCommitGlobMode==="include"&&l.length===0&&(n="staged");let c=o.staged,u=o.changed,f=this.resolveCommitMode(n,c.length+o.stagedOutsideVault);if(e&&a){if(o.conflicted.length+o.conflictedOutsideVault>0)throw new Xn(o.conflicted,new Error("Automatic commit stopped because of unresolved conflicts"));return{status:"skipped",reason:"merge-in-progress"}}if(f==="nothing"&&a&&n==="smart"&&(f="staged"),f==="nothing")return{status:"nothing-to-commit",reason:"nothing-staged"};let d=f==="staged",h=e&&!d?{mode:this.plugin.settings.autoCommitGlobMode,globs:l}:void 0;if(h){let m=await this.plugin.gitManager.selectAutoCommitFiles(o,h);u=m.files,h=m.selection}if(await this.plugin.tools.hasTooBigFiles(d?c:[...c,...u]))return{status:"skipped",reason:"files-too-large"};if((d?0:u.length)+c.length+o.stagedOutsideVault!==0||a){let m=i!=null?i:e?this.plugin.settings.autoCommitMessage:this.plugin.settings.commitMessage,w=e&&this.plugin.settings.customMessageOnAutoBackup||t;if(!w&&this.plugin.gitManager instanceof Ze&&this.plugin.settings.commitMessageScript&&(m=await this.getMessageFromScript(m)),w||!e&&!(m!=null&&m.trim())){!this.plugin.settings.disablePopups&&e&&new Un.Notice("Auto backup: Please enter a custom commit message. Leave empty to abort");let v=await new Qm(this.plugin).openAndGetResult();if(v!=null&&v!=""&&v!="...")m=v;else throw new Fr.UserCanceledError}if(!m||m.trim()==="")throw new Fr.UserCanceledError;let y;return d?y=await this.plugin.gitManager.commit({message:m,amend:s}):y=await this.plugin.gitManager.commitAll({message:m,status:o,unstagedFiles:u,selection:h,amend:s}),this.plugin.gitManager instanceof Ze&&await this.plugin.updateCachedStatus(),this.plugin.app.workspace.trigger("obsidian-git:refresh"),y===0&&!a?{status:"nothing-to-commit",reason:"no-changes"}:{status:"committed",files:y}}else return this.plugin.app.workspace.trigger("obsidian-git:refresh"),{status:"nothing-to-commit",reason:"no-changes"}}async getMessageFromScript(e){let t=this.plugin.settings.commitMessageScript,n=this.plugin.localStorage.getHostname()||"",i=t.replace("{{hostname}}",n);i=i.replace("{{date}}",(0,Un.moment)().format(this.plugin.settings.commitDateFormat));let s="sh";if(Un.Platform.isWin){s=process.env.PROGRAMFILES+"\\Git\\bin\\sh.exe";let a;try{await ng.access(s,ng.constants.X_OK),a=!0}catch(l){a=!1}if(!a)throw new Error(`Cannot find sh.exe at ${s}. Please make sure Git is properly installed.`)}let o=await rf(s,["-c",i],{cwd:this.plugin.gitManager.absoluteRepoPath});if(o.code!=0)throw new Error(o.stderr||`Commit message script exited with code ${o.code}`);return o.stdout.trim().length==0?this.plugin.displayMessage("Stdout from commit message script is empty. Using default message."):e=o.stdout,e}reportCommitResult(e){switch(e.status){case"committed":this.plugin.displayMessage(`Committed ${e.files} ${e.files==1?"file":"files"}`);return;case"nothing-to-commit":{switch(e.reason){case"nothing-staged":this.plugin.displayMessage("Nothing staged. Stage changes first or use Commit all changes.");return;case"no-changes":this.plugin.displayMessage("No changes to commit");return}return}case"skipped":switch(e.reason){case"merge-in-progress":this.plugin.displayError("Did not commit automatically because a merge is in progress. Commit it manually.");return;case"not-ready":case"files-too-large":return}}}async push(){let e=await this.runReadyGitAction(()=>this.performPush());return e.status==="success"&&this.reportPushResult(e.value),e}async performPush({refreshStatus:e=!0}={}){if(!await this.isPushRemoteSet())return{status:"skipped",reason:"no-upstream"};if(e){let n=await this.plugin.updateCachedStatus(),i=n.conflicted.length+n.conflictedOutsideVault;if(i>0)return{status:"blocked",reason:"conflicts",files:i}}if(this.plugin.state.mergeInProgress)return{status:"blocked",reason:"merge-in-progress"};this.plugin.settings.squashCommitsBeforePush&&this.plugin.gitManager instanceof Ze&&await this.plugin.gitManager.squashAllUnpushedCommits(),this.plugin.log("Pushing....");let t=await this.plugin.gitManager.push();return this.plugin.setPluginState({offlineMode:!1}),this.plugin.app.workspace.trigger("obsidian-git:refresh"),t}reportPushResult(e){switch(e.status){case"pushed":e.files===null?this.plugin.displayMessage("Pushed to remote"):this.plugin.displayMessage(`Pushed ${e.files} ${e.files==1?"file":"files"} to remote`);return;case"up-to-date":this.plugin.displayMessage("No commits to push");return;case"blocked":{switch(e.reason){case"no-branch":this.plugin.displayError("No current branch found. Cannot push.");return;case"conflicts":this.plugin.displayError(`Cannot push. You have conflicts in ${e.files} ${e.files==1?"file":"files"}`);return;case"merge-in-progress":this.plugin.displayError("Cannot push while a merge is still in progress");return}return}case"skipped":switch(e.reason){case"not-ready":case"no-upstream":return}}}async pull(){return this.runReadyGitAction(()=>this.performPull())}async performPull(){if(!await this.isPullRemoteSet())return{status:"skipped",reason:"no-upstream"};this.plugin.log("Pulling....");let e=await this.plugin.gitManager.pull();return this.plugin.setPluginState({offlineMode:!1}),e}async fetch(){let e=await this.runReadyGitAction(async()=>await this.isPushRemoteSet()?(await this.plugin.gitManager.fetch(),this.plugin.setPluginState({offlineMode:!1}),this.plugin.app.workspace.trigger("obsidian-git:refresh"),{status:"fetched"}):{status:"skipped",reason:"no-upstream"});return e.status==="success"&&this.reportFetchResult(e.value),e}reportFetchResult(e){switch(e.status){case"fetched":this.plugin.displayMessage("Fetched from remote");return;case"skipped":switch(e.reason){case"not-ready":case"no-upstream":return}}}async stageFile(e){return this.stage(e.path,!0)}async stage(e,t){return this.runFileStateMutation(()=>this.plugin.gitManager.stage(e,t))}async stageAll(e){return this.runFileStateMutation(()=>this.plugin.gitManager.stageAll({dir:e}))}async unstageFile(e){return this.unstage(e.path,!0)}async unstage(e,t){return this.runFileStateMutation(()=>this.plugin.gitManager.unstage(e,t))}async unstageAll(e){return this.runFileStateMutation(()=>this.plugin.gitManager.unstageAll({dir:e}))}async applyPatch(e){return this.runFileStateMutation(async()=>{if(!(this.plugin.gitManager instanceof Ze))throw new Error("Applying a patch is only supported on desktop");await this.plugin.gitManager.applyPatch(e)})}async runFileStateMutation(e){return this.runReadyGitAction(async()=>(await e(),this.plugin.app.workspace.trigger("obsidian-git:refresh"),{status:"updated"}))}async setGitConfig(e,t){return Li(this.plugin,()=>this.plugin.gitManager.setConfig(e,t))}async runRawCommand(e){let t=new Un.Notice(`Running '${e}'...`,999999),n=await Li(this.plugin,async()=>{if(!(this.plugin.gitManager instanceof Ze))throw new Error("Raw Git commands are only supported on desktop");return{status:"completed",output:await this.plugin.gitManager.rawCommand(e)}});return n.status==="success"&&n.value.output?(t.setMessage(n.value.output),window.setTimeout(()=>t.hide(),5e3)):t.hide(),n}async switchBranch(){let e=await this.runReadyGitAction(async()=>{var i;let t=await this.plugin.gitManager.branchInfo(),n=await new eg(this.plugin,t.branches).openAndGetReslt();return n===void 0?{status:"cancelled"}:(await this.plugin.gitManager.checkout(n),this.plugin.app.workspace.trigger("obsidian-git:refresh"),await((i=this.plugin.branchBar)==null?void 0:i.display()),{status:"switched",branch:n})});return e.status==="success"&&this.reportSwitchBranchResult(e.value),e}async switchRemoteBranch(){let e=await this.runReadyGitAction(async()=>{var s;let t=await this.selectRemoteBranch();if(t===void 0)return{status:"cancelled"};let[n,i]=yo(t);return i===void 0||n===void 0?{status:"cancelled"}:(await this.plugin.gitManager.checkout(i,n),await((s=this.plugin.branchBar)==null?void 0:s.display()),{status:"switched",branch:t})});return e.status==="success"&&this.reportSwitchBranchResult(e.value),e}reportSwitchBranchResult(e){switch(e.status){case"switched":this.plugin.displayMessage(`Switched to ${e.branch}`);return;case"cancelled":case"skipped":return}}async createBranch(){let e=await this.runReadyGitAction(async()=>{var n;let t=await new _t(this.plugin,{placeholder:"Create new branch"}).openAndGetResult();return t===void 0?{status:"cancelled"}:(await this.plugin.gitManager.createBranch(t),await((n=this.plugin.branchBar)==null?void 0:n.display()),{status:"created",branch:t})});return e.status==="success"&&this.reportCreateBranchResult(e.value),e}reportCreateBranchResult(e){switch(e.status){case"created":this.plugin.displayMessage(`Created new branch ${e.branch}`);return;case"cancelled":case"skipped":return}}async deleteBranch(){let e=await this.runReadyGitAction(async()=>{var o;let t=await this.plugin.gitManager.branchInfo();t.current&&t.branches.remove(t.current);let n=await new _t(this.plugin,{options:t.branches,placeholder:"Delete branch",onlySelection:!0}).openAndGetResult();if(n===void 0)return{status:"cancelled"};let i=!1;if(!await this.plugin.gitManager.branchIsMerged(n)){if(await new _t(this.plugin,{options:["YES","NO"],placeholder:"This branch isn't merged into HEAD. Force delete?",onlySelection:!0}).openAndGetResult()!=="YES")return{status:"cancelled"};i=!0}return await this.plugin.gitManager.deleteBranch(n,i),await((o=this.plugin.branchBar)==null?void 0:o.display()),{status:"deleted",branch:n}});return e.status==="success"&&this.reportDeleteBranchResult(e.value),e}reportDeleteBranchResult(e){switch(e.status){case"deleted":this.plugin.displayMessage(`Deleted branch ${e.branch}`);return;case"cancelled":case"skipped":return}}async canAutoSetupPushRemote(){return this.plugin.gitManager instanceof Ze&&await this.plugin.gitManager.getConfig("push.autoSetupRemote","all")=="true"}async isPullRemoteSet(){if(this.plugin.settings.updateSubmodules||(await this.plugin.gitManager.branchInfo()).tracking)return!0;if(await this.canAutoSetupPushRemote())return new Un.Notice(`Upstream branch will be created on first push. Skipping pull.
Use set upstream branch command to set it manually if desired.`),!1;new Un.Notice("No upstream branch is set. Please select one.");let e=await this.performSetUpstreamBranch();return this.reportSetUpstreamResult(e),e.status==="updated"}async isPushRemoteSet(){if(this.plugin.settings.updateSubmodules||await this.canAutoSetupPushRemote())return!0;if(!(await this.plugin.gitManager.branchInfo()).tracking){new Un.Notice("No upstream branch is set. Please select one.");let e=await this.performSetUpstreamBranch();return this.reportSetUpstreamResult(e),e.status==="updated"}return!0}async setUpstreamBranch(){let e=await this.runReadyGitAction(async()=>this.performSetUpstreamBranch());return e.status==="success"&&this.reportSetUpstreamResult(e.value),e}async performSetUpstreamBranch(){let e=await this.selectRemoteBranch();return e==null?{status:"cancelled"}:(await this.plugin.gitManager.updateUpstreamBranch(e),{status:"updated",branch:e})}reportSetUpstreamResult(e){switch(e.status){case"updated":this.plugin.displayMessage(`Set upstream branch to ${e.branch}`);return;case"cancelled":this.plugin.displayError("Aborted. No upstream-branch is set!",1e4);return;case"skipped":return}}async discardFile(e){let t=await this.runReadyGitAction(async()=>{let n=e.workingDir==="U",i=await new fd({app:this.plugin.app,filesToDeleteCount:n?1:0,filesToDiscardCount:n?0:1,path:e.vaultPath}).openAndGetResult();if(i===!1)return{status:"cancelled"};if(i==="delete"){let s=this.plugin.app.vault.getAbstractFileByPath(e.vaultPath);s?await this.plugin.app.fileManager.trashFile(s):await this.plugin.app.vault.adapter.remove(e.vaultPath)}else await this.plugin.gitManager.discard(e.path);return this.plugin.app.workspace.trigger("obsidian-git:refresh"),{status:"discarded",target:"file"}});return t.status==="success"&&this.reportDiscardResult(t.value,!1),t}async discardAll(e){let t=await this.runReadyGitAction(async()=>{let n=await this.plugin.gitManager.status({path:e}),i=0,s=0;for(let a of n.changed)a.workingDir=="U"?i++:s++;if(i+s==0)return{status:"skipped",reason:"no-changes"};let o=await new fd({app:this.plugin.app,filesToDeleteCount:i,filesToDiscardCount:s,path:e!=null?e:""}).openAndGetResult();if(o===!1)return{status:"cancelled"};if(await this.plugin.gitManager.discardAll({dir:e,status:n}),o==="delete"){let a=await this.plugin.gitManager.getUntrackedPaths({path:e,status:n});for(let l of a){let c=this.plugin.gitManager.getRelativeVaultPath(l),u=this.plugin.app.vault.getAbstractFileByPath(c);u?await this.plugin.app.fileManager.trashFile(u):l.endsWith("/")?await this.plugin.app.vault.adapter.rmdir(c,!0):await this.plugin.app.vault.adapter.remove(c)}}return this.plugin.app.workspace.trigger("obsidian-git:refresh"),{status:"discarded",target:o==="delete"?"all":"tracked"}});return t.status==="success"&&this.reportDiscardResult(t.value,e===void 0),t}reportDiscardResult(e,t){switch(e.status){case"discarded":if(!t||e.target==="file")return;this.plugin.displayMessage(e.target==="all"?"Discarded all files.":"Discarded all changes in tracked files.");return;case"cancelled":case"skipped":return}}async editRemotes(){let e=await this.runReadyGitAction(async()=>this.performEditRemotes());return e.status==="success"&&this.reportEditRemoteResult(e.value),e}async performEditRemotes(){let e=await this.plugin.gitManager.getRemotes(),t=await new _t(this.plugin,{options:e,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(!t)return{status:"cancelled"};let n=await this.plugin.gitManager.getRemoteUrl(t),i=await new _t(this.plugin,{initialValue:n,placeholder:"Enter remote URL"}).openAndGetResult();return i?(await this.plugin.gitManager.setRemote(t,L0(i)),{status:"updated",remote:t}):{status:"cancelled"}}reportEditRemoteResult(e){switch(e.status){case"updated":case"cancelled":case"skipped":return}}async selectRemoteBranch(){let e=await this.plugin.gitManager.getRemotes(),t;if(e.length===0){let s=await this.performEditRemotes();s.status==="updated"&&(t=s.remote),t==null&&(e=await this.plugin.gitManager.getRemotes())}let n=new _t(this.plugin,{options:e,placeholder:"Select or create a new remote by typing its name and selecting it"}),i=t!=null?t:await n.openAndGetResult();if(i){this.plugin.displayMessage("Fetching remote branches"),await this.plugin.gitManager.fetch(i);let s=await this.plugin.gitManager.getRemoteBranches(i),a=await new _t(this.plugin,{options:s,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult();return a==null?void 0:a.startsWith(i+"/")?a:`${i}/${a}`}}async removeRemote(){let e=await this.runReadyGitAction(async()=>{let t=await this.plugin.gitManager.getRemotes(),n=await new _t(this.plugin,{options:t,placeholder:"Select a remote"}).openAndGetResult();return n?(await this.plugin.gitManager.removeRemote(n),{status:"removed",remote:n}):{status:"cancelled"}});return e.status==="success"&&this.reportRemoveRemoteResult(e.value),e}reportRemoveRemoteResult(e){switch(e.status){case"removed":case"cancelled":case"skipped":return}}};var ig=class extends Ht.Plugin{constructor(){super(...arguments);this.gitActions=new rg(this);this.automaticsManager=new hf(this);this.tools=new Cf(this);this.localStorage=new Wp(this);this.gitServerPassword=new qp(this);this.state={operation:0,offlineMode:!1,mergeInProgress:!1};this.gitReady=!1;this.repositoryMissing=!1;this.promiseQueue=new bh;this.intervalsToClear=[];this.editorIntegration=new Xm(this);this.hunkActions=new Gm(this);this.refresh=Mm(()=>this.refreshNow())}setPluginState(t){var n;this.state=Object.assign(this.state,t),(n=this.statusBar)==null||n.display()}async updateCachedStatus(){var n;this.unpushedCommits=void 0,this.app.workspace.trigger("obsidian-git:loading-status"),this.cachedStatus=await this.gitManager.status();let t=await this.gitManager.isMergeInProgress();return this.setPluginState({mergeInProgress:t}),await((n=this.branchBar)==null?void 0:n.display()),this.app.workspace.trigger("obsidian-git:status-changed",this.cachedStatus),this.cachedStatus}getUnpushedCommits(){if(!this.unpushedCommits){let t=this.gitManager.getUnpushedCommits();this.unpushedCommits=t,t.catch(()=>{this.unpushedCommits===t&&(this.unpushedCommits=void 0)})}return this.unpushedCommits}async refreshNow(){if(!this.gitReady)return;this.unpushedCommits=void 0;let t=this.app.workspace.getLeavesOfType(wr.type),n=this.app.workspace.getLeavesOfType(tn.type);(this.settings.changedFilesInStatusBar||t.some(i=>{var s;return!((s=i.isDeferred)!=null&&s)})||n.some(i=>{var s;return!((s=i.isDeferred)!=null&&s)}))&&await this.updateCachedStatus().catch(i=>this.displayError(i)),this.app.workspace.trigger("obsidian-git:refreshed")}refreshUpdatedHead(){}async onload(){Pt.plugin=this,this.localStorage.migrate(),await this.loadSettings(),await this.migrateSettings(),this.settingsTab=new xp(this.app,this),this.addSettingTab(this.settingsTab),this.localStorage.getPluginDisabled()||(this.registerStuff(),this.app.workspace.onLayoutReady(()=>this.init({fromReload:!1}).catch(t=>this.displayError(t))))}onExternalSettingsChange(){this.reloadSettings().catch(t=>this.displayError(t))}async reloadSettings(){var i,s;let t=JSON.stringify(this.settings);await this.loadSettings();let n=JSON.stringify(this.settings);if(t!==n){this.log("Reloading settings"),this.unloadPlugin(),await this.init({fromReload:!0});for(let o of this.app.workspace.getLeavesOfType(wr.type))(i=o.isDeferred)!=null&&i||await o.view.reload();for(let o of this.app.workspace.getLeavesOfType(tn.type))(s=o.isDeferred)!=null&&s||await o.view.reload()}}registerStuff(){this.registerEvent(this.app.workspace.on("obsidian-git:refresh",()=>{this.refresh().catch(t=>this.displayError(t))})),this.registerEvent(this.app.workspace.on("obsidian-git:head-change",()=>{this.refreshUpdatedHead()})),this.registerEvent(this.app.workspace.on("file-menu",(t,n,i)=>{this.handleFileMenu(t,n,i,"file-manu")})),this.registerEvent(this.app.workspace.on("obsidian-git:menu",(t,n,i)=>{this.handleFileMenu(t,n,i,"obsidian-git:menu")})),this.registerEvent(this.app.workspace.on("active-leaf-change",t=>{this.onActiveLeafChange(t)})),this.registerEvent(this.app.vault.on("modify",()=>{var t;this.debRefresh(),(t=this.autoCommitDebouncer)==null||t.call(this)})),this.registerEvent(this.app.vault.on("delete",()=>{var t;this.debRefresh(),(t=this.autoCommitDebouncer)==null||t.call(this)})),this.registerEvent(this.app.vault.on("create",()=>{var t;this.debRefresh(),(t=this.autoCommitDebouncer)==null||t.call(this)})),this.registerEvent(this.app.vault.on("rename",()=>{var t;this.debRefresh(),(t=this.autoCommitDebouncer)==null||t.call(this)})),this.registerView(wr.type,t=>new cd(t,this)),this.registerView(tn.type,t=>new rd(t,this)),this.registerView(mo.type,t=>new nd(t,this)),this.registerView(wo.type,t=>new _a(t,this)),this.registerView(go.type,t=>new xa(t,this)),this.addRibbonIcon("git-pull-request","Open Git source control",async()=>{var i;let t=this.app.workspace.getLeavesOfType(wr.type),n;t.length===0?(n=(i=this.app.workspace.getRightLeaf(!1))!=null?i:this.app.workspace.getLeaf(),await n.setViewState({type:wr.type})):n=t.first(),await this.app.workspace.revealLeaf(n)}),this.registerHoverLinkSource(wr.type,{display:"Git View",defaultMod:!0}),this.editorIntegration.onLoadPlugin(),this.setRefreshDebouncer(),r2(this)}setRefreshDebouncer(){var t;(t=this.debRefresh)==null||t.cancel(),this.debRefresh=(0,Ht.debounce)(()=>{this.settings.refreshSourceControl&&this.refresh().catch(console.error)},this.settings.refreshSourceControlTimer,!0)}handleFileMenu(t,n,i,s){if(!this.gitReady||!this.settings.showFileMenu||!n)return;let o;if(typeof n=="string"?o=n:o=n.path,i=="file-explorer-context-menu"&&(t.addItem(a=>{a.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{n instanceof Ht.TFile?await this.gitActions.stageFile(n):await this.gitActions.stageAll(this.gitManager.getRelativeRepoPath(o,!0))})})}),t.addItem(a=>{a.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(l=>{this.promiseQueue.addTask(async()=>{n instanceof Ht.TFile?await this.gitActions.unstageFile(n):await this.gitActions.unstageAll(this.gitManager.getRelativeRepoPath(o,!0))})})}),t.addItem(a=>{a.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(l=>{this.promiseQueue.addTask(()=>this.gitActions.addFileToGitignore(o,n instanceof Ht.TFolder))})})),i=="git-source-control"){t.addItem(l=>{l.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(c=>{this.promiseQueue.addTask(()=>this.gitActions.addFileToGitignore(o,n instanceof Ht.TFolder))})});let a=this.app.vault.adapter;s==="obsidian-git:menu"&&a instanceof Ht.FileSystemAdapter&&(t.addItem(l=>{l.setTitle("Open in default app").setIcon("arrow-up-right").setSection("action").onClick(c=>{this.app.openWithDefaultApp(o)})}),t.addItem(l=>{l.setTitle("Show in system explorer").setIcon("arrow-up-right").setSection("action").onClick(c=>{window.electron.shell.showItemInFolder(yO.join(a.getBasePath(),o))})}))}}async migrateSettings(){this.settings.mergeOnPull!=null&&(this.settings.syncMethod=this.settings.mergeOnPull?"merge":"rebase",this.settings.mergeOnPull=void 0,await this.saveSettings()),this.settings.autoCommitMessage===void 0&&(this.settings.autoCommitMessage=this.settings.commitMessage,await this.saveSettings()),this.settings.gitPath!=null&&(this.localStorage.setGitPath(this.settings.gitPath),this.settings.gitPath=void 0,await this.saveSettings()),this.settings.username!=null&&(this.localStorage.setLegacyPassword(this.settings.username),this.settings.username=void 0,await this.saveSettings()),await this.gitServerPassword.migrateLegacy()}unloadPlugin(){var t,n;this.gitReady=!1,this.repositoryMissing=!1,this.app.workspace.trigger("obsidian-git:repository-state-changed"),this.editorIntegration.onUnloadPlugin(),this.automaticsManager.unload(),(t=this.branchBar)==null||t.remove(),(n=this.statusBar)==null||n.remove(),this.statusBar=void 0,this.branchBar=void 0,this.gitManager.unload(),this.promiseQueue.clear();for(let i of this.intervalsToClear)window.clearInterval(i);this.intervalsToClear=[],this.debRefresh.cancel()}onunload(){this.unloadPlugin()}async loadSettings(){let t=await this.loadData();t==null&&(t={showedMobileNotice:!0}),this.settings=FC(en,t)}async saveSettings(){var t;(t=this.settingsTab)==null||t.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return Ht.Platform.isDesktopApp}async init({fromReload:t=!1}){var n;if(!this.localStorage.getPluginDisabled()){if(this.gitReady=!1,this.repositoryMissing=!1,this.app.workspace.trigger("obsidian-git:repository-state-changed"),this.settings.showStatusBar&&!this.statusBar){let i=this.addStatusBarItem();this.statusBar=new Ep(i,this),this.intervalsToClear.push(window.setInterval(()=>{var s;return(s=this.statusBar)==null?void 0:s.display()},1e3))}try{this.useSimpleGit?(this.gitManager=new Ze(this),await this.gitManager.setGitInstance()):this.gitManager=new Ts(this);let i=await this.gitManager.checkRequirements();this.repositoryMissing=i==="missing-repo",i==="valid"&&(this.gitReady=!0),this.app.workspace.trigger("obsidian-git:repository-state-changed");let s=this.localStorage.getPausedAutomatics();switch(i){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new Ht.Notice("Cannot find a Git repository. Please create one via the given command, clone an existing repo or configure repo location.",1e4);break;case"valid":if(Ht.Platform.isDesktop&&this.settings.showBranchStatusBar&&!this.branchBar){let o=this.addStatusBarItem();this.branchBar=new Hm(o,this),this.intervalsToClear.push(window.setInterval(()=>{var a;(a=this.branchBar)==null?void 0:a.display().catch(console.error)},6e4))}await((n=this.branchBar)==null?void 0:n.display()),this.editorIntegration.onReady(),this.app.workspace.trigger("obsidian-git:refresh"),this.app.workspace.trigger("obsidian-git:head-change"),this.app.workspace.trigger("obsidian-git:refs-changed"),!t&&this.settings.autoPullOnBoot&&!s&&this.promiseQueue.addTask(()=>this.gitActions.pullChangesFromRemote()),s||await this.automaticsManager.init(),s&&new Ht.Notice("Automatic routines are currently paused.");break;default:this.warn("Unexpected 'checkRequirements' result: "+String(i))}}catch(i){this.displayError(i),console.error(i)}}}async isAllInitialized(){return this.gitReady||await this.init({fromReload:!0}),this.gitReady}async changeGitPath(t){return Li(this,async()=>{this.localStorage.setGitPath(t),await this.gitManager.updateGitPath(t||"git")})}async reloadGitManager(){return Li(this,async()=>{if(!(this.gitManager instanceof Ze))throw new Error("Reloading native Git is only supported on desktop");await this.gitManager.setGitInstance()})}async changeBasePath(t){return Li(this,async()=>{this.settings.basePath=t,await this.saveSettings(),await this.gitManager.updateBasePath(t)})}handleConflict(t){let n=t.length;this.displayError(n>0?`Merge conflict in ${n} ${n==1?"file":"files"}. Resolve conflicts and commit manually.`:"Merge conflict. Resolve conflicts and commit manually.")}openMergeConflictHelp(){new Lm(this).open()}onActiveLeafChange(t){var o,a;let n=t==null?void 0:t.view;if(!(n!=null&&n.getState().file)&&!(n instanceof _a||n instanceof xa))return;let i=this.app.workspace.getLeavesOfType(wr.type).first(),s=this.app.workspace.getLeavesOfType(tn.type).first();if((o=i==null?void 0:i.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||o.removeClass("is-active"),(a=s==null?void 0:s.view.containerEl.querySelector("div.tree-item-self.is-active"))==null||a.removeClass("is-active"),(t==null?void 0:t.view)instanceof _a||(t==null?void 0:t.view)instanceof xa){let c=t.view.state.bFile.replace(/["\\]/g,"\\$&");this.lastDiffViewState=t.view.getState();let u;i&&t.view.state.aRef=="HEAD"?u=i.view.containerEl.querySelector(`div.staged div.tree-item-self[data-path="${c}"]`):i&&t.view.state.aRef==""?u=i.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(t){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(t,n=4*1e3){var i;(i=this.statusBar)==null||i.displayMessage(t.toLowerCase(),n),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!t.startsWith("No changes"))&&new Ht.Notice(t,5*1e3),this.log(t)}displayError(t,n=10*1e3){var s;if(t instanceof Fr.UserCanceledError){new Ht.Notice("Aborted");return}let i;t instanceof Error?i=t:i=new Error(String(t)),this.settings.showErrorNotices&&new Ht.Notice(i.message,n),console.error(`${this.manifest.id}:`,i.stack),(s=this.statusBar)==null||s.displayMessage(i.message.toLowerCase(),n)}log(...t){console.debug(`${this.manifest.id}:`,...t)}warn(...t){console.warn(`${this.manifest.id}:`,...t)}};
/*! Bundled license information:
ieee754/index.js:
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
buffer/index.js:
(*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*)
safe-buffer/index.js:
(*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
crc-32/crc32.js:
(*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com *)
isomorphic-git/index.js:
isomorphic-git/managers/index.js:
isomorphic-git/models/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.
*)
*/
/* nosourcemap */