360 lines
682 KiB
JavaScript
360 lines
682 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)
|
||
|
*/
|
||
|
|
||
|
var Jk=Object.create;var Ca=Object.defineProperty;var Qk=Object.getOwnPropertyDescriptor;var eA=Object.getOwnPropertyNames;var tA=Object.getPrototypeOf,nA=Object.prototype.hasOwnProperty;var rA=(t,e,n)=>e in t?Ca(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var iA=(t,e)=>()=>(t&&(e=t(t=0)),e);var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),aA=(t,e)=>{for(var n in e)Ca(t,n,{get:e[n],enumerable:!0})},om=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of eA(e))!nA.call(t,i)&&i!==n&&Ca(t,i,{get:()=>e[i],enumerable:!(r=Qk(e,i))||r.enumerable});return t};var Ze=(t,e,n)=>(n=t!=null?Jk(tA(t)):{},om(e||!t||!t.__esModule?Ca(n,"default",{value:t,enumerable:!0}):n,t)),sA=t=>om(Ca({},"__esModule",{value:!0}),t);var ct=(t,e,n)=>rA(t,typeof e!="symbol"?e+"":e,n);var um=R(co=>{"use strict";v();co.byteLength=lA;co.toByteArray=uA;co.fromByteArray=dA;var vn=[],Zt=[],oA=typeof Uint8Array!="undefined"?Uint8Array:Array,pu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Tr=0,lm=pu.length;Tr<lm;++Tr)vn[Tr]=pu[Tr],Zt[pu.charCodeAt(Tr)]=Tr;var Tr,lm;Zt[45]=62;Zt[95]=63;function cm(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");n===-1&&(n=e);var r=n===e?0:4-n%4;return[n,r]}function lA(t){var e=cm(t),n=e[0],r=e[1];return(n+r)*3/4-r}function cA(t,e,n){return(e+n)*3/4-n}function uA(t){var e,n=cm(t),r=n[0],i=n[1],a=new oA(cA(t,r,i)),s=0,o=i>0?r-4:r,l;for(l=0;l<o;l+=4)e=Zt[t.charCodeAt(l)]<<18|Zt[t.charCodeAt(l+1)]<<12|Zt[t.charCodeAt(l+2)]<<6|Zt[t.charCodeAt(l+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=e&255;return i===2&&(e=Zt[t.charCodeAt(l)]<<2|Zt[t.charCodeAt(l+1)]>>4,a[s++]=e&255),i===1&&(e=Zt[t.charCodeAt(l)]<<10|Zt[t.charCodeAt(l+1)]<<4|Zt[t.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function fA(t){return vn[t>>18&63]+vn[t>>12&63]+vn[t>>6&63]+vn[t&63]}function hA(t,e,n){for(var r,i=[],a=e;a<n;a+=3)r=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(t[a+2]&255),i.push(fA(r));return i.join("")}function dA(t){for(var e,n=t.length,r=n%3,i=[],a=16383,s=0,o=n-r;s<o;s+=a)i.push(hA(t,s,s+a>o?o:s+a));return r===1?(e=t[n-1],i.push(vn[e>>2]+vn[e<<4&63]+"==")):r===2&&(e=(t[n-2]<<8)+t[n-1],i.push(vn[e>>10]+vn[e>>4&63]+vn[e<<2&63]+"=")),i.join("")}});var fm=R(mu=>{v();mu.read=function(t,e,n,r,i){var a,s,o=i*8-r-1,l=(1<<o)-1,c=l>>1,u=-7,f=n?i-1:0,h=n?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-u)-1,d>>=-u,u+=o;u>0;a=a*256+t[e+f],f+=h,u-=8);for(s=a&(1<<-u)-1,a>>=-u,u+=r;u>0;s=s*256+t[e+f],f+=h,u-=8);if(a===0)a=1-c;else{if(a===l)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,r),a=a-c}return(d?-1:1)*s*Math.pow(2,a-r)};mu.write=function(t,e,n,r,i,a){var s,o,l,c=a*8-i-1,u=(1<<c)-1,f=u>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:a-1,p=r?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,s=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+f>=1?e+=h/l:e+=h*Math.pow(2,1-f),e*l>=2&&(s++,l/=2),s+f>=u?(o=0,s=u):s+f>=1?(o=(e*l-1)*Math.pow(2,i),s=s+f):(o=e*Math.pow(2,f-1)*Math.pow(2,i),s=0));i>=8;t[n+d]=o&255,d+=p,o/=256,i-=8);for(s=s<<i|o,c+=i;c>0;t[n+d]=s&255,d+=p,s/=256,c-=8);t[n+d-p]|=g*128}});var Eu=R(ui=>{"use strict";v();var gu=um(),li=fm(),hm=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ui.Buffer=P;ui.SlowBuffer=wA;ui.INSPECT_MAX_BYTES=50;var uo=2147483647;ui.kMaxLength=uo;P.TYPED_ARRAY_SUPPORT=pA();!P.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function pA(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch(t){return!1}}Object.defineProperty(P.prototype,"parent",{enumerable:!0,get:function(){if(P.isBuffer(this))return this.buffer}});Object.defineProperty(P.prototype,"offset",{enumerable:!0,get:function(){if(P.isBuffer(
|
||
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UM(t,e){if(t){if(typeof t=="string")return Xw(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xw(t,e)}}function Xw(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function zM(t,e){if(!(typeof Symbol=="undefined"||!(Symbol.iterator in Object(t)))){var n=[],r=!0,i=!1,a=void 0;try{for(var s=t[Symbol.iterator](),o;!(r=(o=s.next()).done)&&(n.push(o.value),!(e&&n.length===e));r=!0);}catch(l){i=!0,a=l}finally{try{!r&&s.return!=null&&s.return()}finally{if(i)throw a}}return n}}function GM(t){if(Array.isArray(t))return t}var Zw=/^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?$/,Kw=/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])?$/,Jw=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,Qw=/^rgba?\(\s*(\d+)\s+(\d+)\s+(\d+)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,e2=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,t2=/^rgba?\(\s*(\d+%)\s+(\d+%)\s+(\d+%)(?:\s*\/\s*(0|1|0?\.\d+|\d+%))?\s*\)$/,n2=/^hsla?\(\s*(\d+)(deg|rad|grad|turn)?\s*,\s*(\d+)%\s*,\s*(\d+)%(?:\s*,\s*(0|1|0?\.\d+|\d+%))?\s*\)$/;function Cs(t,e){return t.indexOf(e)>-1}function VM(t,e,n){var r=t/255,i=e/255,a=n/255,s=Math.max(r,i,a),o=Math.min(r,i,a),l=s-o,c=(s+o)/2;if(l===0)return[0,0,c*100];var u=l/(1-Math.abs(2*c-1)),f=function(){switch(s){case r:return(i-a)/l%6;case i:return(a-r)/l+2;default:return(r-i)/l+4}}();return[f*60,u*100,c*100]}function WM(t,e,n){var r=t/60,i=e/100,a=n/100,s=(1-Math.abs(2*a-1))*i,o=s*(1-Math.abs(r%2-1)),l=a-s/2,c=function(){return r<1?[s,o,0]:r<2?[o,s,0]:r<3?[0,s,o]:r<4?[0,o,s]:r<5?[o,0,s]:[s,0,o]}(),u=Ft(c,3),f=u[0],h=u[1],d=u[2];return[(f+l)*255,(h+l)*255,(d+l)*255]}var qM=function(){function t(e){var n=Ft(e,4),r=n[0],i=n[1],a=n[2],s=n[3];NM(this,t),this.values=[Math.max(Math.min(parseInt(r,10),255),0),Math.max(Math.min(parseInt(i,10),255),0),Math.max(Math.min(parseInt(a,10),255),0),s==null?1:Math.max(Math.min(parseFloat(s),255),0)]}return $M(t,[{key:"toRgbString",value:function(){var n=Ft(this.values,4),r=n[0],i=n[1],a=n[2],s=n[3];return s===1?"rgb(".concat(r,", ").concat(i,", ").concat(a,")"):"rgba(".concat(r,", ").concat(i,", ").concat(a,", ").concat(s,")")}},{key:"toHslString",value:function(){var n=this.toHslaArray(),r=Ft(n,4),i=r[0],a=r[1],s=r[2],o=r[3];return o===1?"hsl(".concat(i,", ").concat(a,"%, ").concat(s,"%)"):"hsla(".concat(i,", ").concat(a,"%, ").concat(s,"%, ").concat(o,")")}},{key:"toHexString",value:function(){var n=Ft(this.values,4),r=n[0],i=n[1],a=n[2],s=n[3];return r=Number(r).toString(16).padStart(2,"0"),i=Number(i).toString(16).padStart(2,"0"),a=Number(a).toString(16).padStart(2,"0"),s=s<1?parseInt(s*255,10).toString(16).padStart(2,"0"):"","#".concat(r).concat(i).concat(a).concat(s)}},{key:"toRgbaArray",value:function(){return this.values}},{key:"toHslaArray",value:function(){var n=Ft(this.values,4),r=n[0],i=n[1],a=n[2],s=n[3],o=VM(r,i,a),l=Ft(o,3),c=l[0],u=l[1],f=l[2];return[c,u,f,s]}}]),t}();function qi(t){var e=Ft(t,4),n=e[0],r=e[1],i=e[2],a=e[3];return new qM([n,r,i,a])}function Nh(t){var e=Ft(t,3),n=e[0],r=e[1],i=e[2];return qi([n,r,i,1])}function El(t){var e=Ft(t,4),n=e[0],r=e[1],i=e[2],a=e[3],s=WM(n,r,i),o=Ft(s,3),l=o[0],c=o[1],u=o[2];return qi([l,c,u,a])}function r2(t){var e=Ft(t,3),n=e[0],r=e[1],i=e[2];return El([n,r,i,1])}function XM(t){var e=Zw.exec(t)||Kw.exec(t),n=Ft(e,5),r=n[1],i=n[2],a=n[3],s=n[4];return r=parseInt(r.length<2?r.repeat(2):r,16),i=parseInt(i.length<2?i.repeat(2):i,16),a=parseInt(a.length<2?a.repeat(2):a,16),s=s&&(parseInt(s.length<2?s.repeat(2):s,16)/255).toPrecision(1)||1,qi([r,i,a,s])}function YM(t){var e=Jw.exec(t)||e2.exec(t)||Qw.exec(t)||t2.exec(t),n=Ft(e,5),r=n[1],i=n[2],a=n[3],s=n[4];return r=Cs(r,"%")?parseInt(r,10)*255/100:parseInt(r,10),i=Cs(i,"%")?parseInt(i,10)*255/100:pa
|
||
|
`)>=0)return!1;return!0}function JP(t,e){var n;if(t.indent===" ")n=" ";else if(typeof t.indent=="number"&&t.indent>0)n=On.call(Array(t.indent+1)," ");else return null;return{base:n,prev:On.call(Array(e+1),n)}}function fd(t,e){if(t.length===0)return"";var n=`
|
||
|
`+e.prev+e.base;return n+On.call(t,","+n)+`
|
||
|
`+e.prev}function Hl(t,e){var n=ud(t),r=[];if(n){r.length=t.length;for(var i=0;i<t.length;i++)r[i]=pr(t,i)?e(t[i],t):""}var a=typeof ad=="function"?ad(t):[],s;if(Qi){s={};for(var o=0;o<a.length;o++)s["$"+a[o]]=a[o]}for(var l in t)pr(t,l)&&(n&&String(Number(l))===l&&l<t.length||Qi&&s["$"+l]instanceof Symbol||(ax.call(/[^\w$]/,l)?r.push(e(l,t)+": "+e(t[l],t)):r.push(l+": "+e(t[l],t))));if(typeof ad=="function")for(var c=0;c<a.length;c++)sx.call(t,a[c])&&r.push("["+e(a[c])+"]: "+e(t[a[c]],t));return r}});var gd=R((zB,px)=>{"use strict";v();var dx=pn(),ea=qt(),QP=hx(),eI=Wn(),Gl=dx("%WeakMap%",!0),Vl=dx("%Map%",!0),tI=ea("WeakMap.prototype.get",!0),nI=ea("WeakMap.prototype.set",!0),rI=ea("WeakMap.prototype.has",!0),iI=ea("Map.prototype.get",!0),aI=ea("Map.prototype.set",!0),sI=ea("Map.prototype.has",!0),md=function(t,e){for(var n=t,r;(r=n.next)!==null;n=r)if(r.key===e)return n.next=r.next,r.next=t.next,t.next=r,r},oI=function(t,e){var n=md(t,e);return n&&n.value},lI=function(t,e,n){var r=md(t,e);r?r.value=n:t.next={key:e,next:t.next,value:n}},cI=function(t,e){return!!md(t,e)};px.exports=function(){var e,n,r,i={assert:function(a){if(!i.has(a))throw new eI("Side channel does not contain "+QP(a))},get:function(a){if(Gl&&a&&(typeof a=="object"||typeof a=="function")){if(e)return tI(e,a)}else if(Vl){if(n)return iI(n,a)}else if(r)return oI(r,a)},has:function(a){if(Gl&&a&&(typeof a=="object"||typeof a=="function")){if(e)return rI(e,a)}else if(Vl){if(n)return sI(n,a)}else if(r)return cI(r,a);return!1},set:function(a,s){Gl&&a&&(typeof a=="object"||typeof a=="function")?(e||(e=new Gl),nI(e,a,s)):Vl?(n||(n=new Vl),aI(n,a,s)):(r||(r={key:{},next:null}),lI(r,a,s))}};return i}});var gx=R((VB,mx)=>{"use strict";v();var uI=Vh(),Bs=gd()(),qn=Wn(),yd={assert:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new qn("`O` is not an object");if(typeof e!="string")throw new qn("`slot` must be a string");if(Bs.assert(t),!yd.has(t,e))throw new qn("`"+e+"` is not present on `O`")},get:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new qn("`O` is not an object");if(typeof e!="string")throw new qn("`slot` must be a string");var n=Bs.get(t);return n&&n["$"+e]},has:function(t,e){if(!t||typeof t!="object"&&typeof t!="function")throw new qn("`O` is not an object");if(typeof e!="string")throw new qn("`slot` must be a string");var n=Bs.get(t);return!!n&&uI(n,"$"+e)},set:function(t,e,n){if(!t||typeof t!="object"&&typeof t!="function")throw new qn("`O` is not an object");if(typeof e!="string")throw new qn("`slot` must be a string");var r=Bs.get(t);r||(r={},Bs.set(t,r)),r["$"+e]=n}};Object.freeze&&Object.freeze(yd);mx.exports=yd});var wx=R((qB,vx)=>{"use strict";v();var Ns=gx(),fI=SyntaxError,yx=typeof StopIteration=="object"?StopIteration:null;vx.exports=function(e){if(!yx)throw new fI("this environment lacks StopIteration");Ns.set(e,"[[Done]]",!1);var n={next:function(){var i=Ns.get(this,"[[Iterator]]"),a=Ns.get(i,"[[Done]]");try{return{done:a,value:a?void 0:i.next()}}catch(s){if(Ns.set(i,"[[Done]]",!0),s!==yx)throw s;return{done:!0,value:void 0}}}};return Ns.set(n,"[[Iterator]]",e),n}});var vd=R((YB,bx)=>{v();var hI={}.toString;bx.exports=Array.isArray||function(t){return hI.call(t)=="[object Array]"}});var wd=R((KB,xx)=>{"use strict";v();var dI=String.prototype.valueOf,pI=function(e){try{return dI.call(e),!0}catch(n){return!1}},mI=Object.prototype.toString,gI="[object String]",yI=dr()();xx.exports=function(e){return typeof e=="string"?!0:typeof e!="object"?!1:yI?pI(e):mI.call(e)===gI}});var xd=R((QB,Ex)=>{"use strict";v();var bd=typeof Map=="function"&&Map.prototype?Map:null,vI=typeof Set=="function"&&Set.prototype?Set:null,Wl;bd||(Wl=function(e){return!1});var Sx=bd?Map.prototype.has:null,_x=vI?Set.prototype.has:null;!Wl&&!Sx&&(Wl=function(e){return!1});Ex.exports=Wl||function(e){if(!e||typeof e!="object")return!1;try{if(Sx.call(e),_x)try{_x.call(e)}catch(n){return!0}return e instanceof bd}catch(n){}return!1}});var Sd=R((tN,Tx)=>{"use strict";v();var wI=typeof Map=="function"&&Map.prototype?Map:null,_d=typeof Set=="f
|
||
|
`});Me=!1,$=ie.length}function be(st,ee){var Ie="="+D,Ee=st.indexOf(Ie,ee),z=c(st.substring(st.indexOf("=",ee)+1,Ee)).split(" ");return G=z[0],D=z[z.length-1],Ee+Ie.length-1}for(_&&(_=_.split(" "),G=_[0],D=_[1]),de=0;de<C;de++)j==M?u(G,E,de)?(--de,se(),j=L):E.charAt(de)==`
|
||
|
`?mt(Me):he+=E.charAt(de):j==L?(de+=G.length-1,le=t.tags[E.charAt(de+1)],Y=le?E.charAt(de+1):"_v",Y=="="?(de=be(E,de),j=M):(le&&de++,j=N),Me=de):u(D,E,de)?(ie.push({tag:Y,n:c(he),otag:G,ctag:D,i:Y=="/"?Me-G.length:de+D.length}),he="",de+=D.length-1,j=M,Y=="{"&&(D=="}}"?de++:l(ie[ie.length-1]))):he+=E.charAt(de);return mt(Me,!0),ie};function l(y){y.n.substr(y.n.length-1)==="}"&&(y.n=y.n.substring(0,y.n.length-1))}function c(y){return y.trim?y.trim():y.replace(/^\s*|\s*$/g,"")}function u(y,E,_){if(E.charAt(_)!=y.charAt(0))return!1;for(var C=1,M=y.length;C<M;C++)if(E.charAt(_+C)!=y.charAt(C))return!1;return!0}var f={_t:!0,"\n":!0,$:!0,"/":!0};function h(y,E,_,C){var M=[],L=null,N=null,j=null;for(N=_[_.length-1];y.length>0;){if(j=y.shift(),N&&N.tag=="<"&&!(j.tag in f))throw new Error("Illegal content in < super tag.");if(t.tags[j.tag]<=t.tags.$||d(j,C))_.push(j),j.nodes=h(y,j.tag,_,C);else if(j.tag=="/"){if(_.length===0)throw new Error("Closing tag without opener: /"+j.n);if(L=_.pop(),j.n!=L.n&&!p(j.n,L.n,C))throw new Error("Nesting error: "+L.n+" vs. "+j.n);return L.end=j.i,M}else j.tag==`
|
||
|
`&&(j.last=y.length==0||y[0].tag==`
|
||
|
`);M.push(j)}if(_.length>0)throw new Error("missing closing tag: "+_.pop().n);return M}function d(y,E){for(var _=0,C=E.length;_<C;_++)if(E[_].o==y.n)return y.tag="#",!0}function p(y,E,_){for(var C=0,M=_.length;C<M;C++)if(_[C].c==y&&_[C].o==E)return!0}function g(y){var E=[];for(var _ in y)E.push('"'+b(_)+'": function(c,p,t,i) {'+y[_]+"}");return"{ "+E.join(",")+" }"}function m(y){var E=[];for(var _ in y.partials)E.push('"'+b(_)+'":{name:"'+b(y.partials[_].name)+'", '+m(y.partials[_])+"}");return"partials: {"+E.join(",")+"}, subs: "+g(y.subs)}t.stringify=function(y,E,_){return"{code: function (c,p,i) { "+t.wrapMain(y.code)+" },"+m(y)+"}"};var w=0;t.generate=function(y,E,_){w=0;var C={code:"",subs:{},partials:{}};return t.walk(y,C),_.asString?this.stringify(C,E,_):this.makeTemplate(C,E,_)},t.wrapMain=function(y){return'var t=this;t.b(i=i||"");'+y+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(y,E,_){var C=this.makePartials(y);return C.code=new Function("c","p","i",this.wrapMain(y.code)),new this.template(C,E,this,_)},t.makePartials=function(y){var E,_={subs:{},partials:y.partials,name:y.name};for(E in _.partials)_.partials[E]=this.makePartials(_.partials[E]);for(E in y.subs)_.subs[E]=new Function("c","p","t","i",y.subs[E]);return _};function b(y){return y.replace(a,"\\\\").replace(n,'\\"').replace(r,"\\n").replace(i,"\\r").replace(s,"\\u2028").replace(o,"\\u2029")}function S(y){return~y.indexOf(".")?"d":"f"}function k(y,E){var _="<"+(E.prefix||""),C=_+y.n+w++;return E.partials[C]={name:y.n,partials:{}},E.code+='t.b(t.rp("'+b(C)+'",c,p,"'+(y.indent||"")+'"));',C}t.codegen={"#":function(y,E){E.code+="if(t.s(t."+S(y.n)+'("'+b(y.n)+'",c,p,1),c,p,0,'+y.i+","+y.end+',"'+y.otag+" "+y.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(y.nodes,E),E.code+="});c.pop();}"},"^":function(y,E){E.code+="if(!t.s(t."+S(y.n)+'("'+b(y.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(y.nodes,E),E.code+="};"},">":k,"<":function(y,E){var _={partials:{},code:"",subs:{},inPartial:!0};t.walk(y.nodes,_);var C=E.partials[k(y,E)];C.subs=_.subs,C.partials=_.partials},$:function(y,E){var _={subs:{},code:"",partials:E.partials,prefix:y.n};t.walk(y.nodes,_),E.subs[y.n]=_.code,E.inPartial||(E.code+='t.sub("'+b(y.n)+'",c,p,i);')},"\n":function(y,E){E.code+=A('"\\n"'+(y.last?"":" + i"))},_v:function(y,E){E.code+="t.b(t.v(t."+S(y.n)+'("'+b(y.n)+'",c,p,0)));'},_t:function(y,E){E.code+=A('"'+b(y.text)+'"')},"{":x,"&":x};function x(y,E){E.code+="t.b(t.t(t."+S(y.n)+'("'+b(y.n)+'",c,p,0)));'}function A(y){return"t.b("+y+");"}t.walk=function(y,E){for(var _,C=0,M=y.length;C<M;C++)_=t.codegen[y[C].tag],_&&_(y[C],E);return E},t.parse=function(y,E,_){return _=_||{},h(y,"",[],_.sectionTags||[])},t.cache={},t.cacheKey=function(y,E){return[y,!!E.asString,!!E.disableLambda,E.delimiters,!!E.modelGet].join("||")},t.compile=function(y,E){E=E||{};var _=t.cacheKey(y,E),C=this.cache[_];if(C){var M=C.partials;for(var L in M)delete M[L].instance;return C}return C=this.generate(this.parse(this.scan(y,E.delimiters),y,E),y,E),this.cache[_]=C}})(typeof Bp!="undefined"?Bp:Hogan)});var VE=R(Np=>{v();var KL={};(function(t){t.Template=function(h,d,p,g){h=h||{},this.r=h.code||this.r,this.c=p,this.options=g||{},this.text=d||"",this.partials=h.partials||{},this.subs=h.subs||{},this.buf=""},t.Template.prototype={r:function(h,d,p){return""},v:u,t:c,render:function(d,p,g){return this.ri([d],p||{},g)},ri:function(h,d,p){return this.r(h,d,p)},ep:function(h,d){var p=this.partials[h],g=d[p.name];if(p.instance&&p.base==g)return p.instance;if(typeof g=="string"){if(!this.c)throw new Error("No compiler available.");g=this.c.compile(g,this.options)}if(!g)return null;if(this.partials[h].base=g,p.subs){d.stackText||(d.stackText={});for(key in p.subs)d.stackText[key]||(d.stackText[key]=this.activeSub!==void 0&&d.stackText[this.activeSub]?d.stackText[this.activeSub]:this.text);g=n(g,p.subs,p.partials,this.stackSubs,this.stackPartials,d.stackText)}return this.partials[h].instance=g,g},rp:function(h,d,p,g){var m=this.ep(h,p);return m?m.ri(d,p,g):""},rs:function(h,d,p){var g=h[h.length-1];if(!f(g)){p(h,d,this);
|
||
|
`)}static async _entryToBuffer(e){let n=Buffer.from(e.path),r=Math.ceil((62+n.length+1)/8)*8,i=Buffer.alloc(r),a=new en(i),s=Ei(e);return a.writeUInt32BE(s.ctimeSeconds),a.writeUInt32BE(s.ctimeNanoseconds),a.writeUInt32BE(s.mtimeSeconds),a.writeUInt32BE(s.mtimeNanoseconds),a.writeUInt32BE(s.dev),a.writeUInt32BE(s.ino),a.writeUInt32BE(s.mode),a.writeUInt32BE(s.uid),a.writeUInt32BE(s.gid),a.writeUInt32BE(s.size),a.write(e.oid,20,"hex"),a.writeUInt16BE(h5(e)),a.write(e.path,n.length,"utf8"),i}async toObject(){let e=Buffer.alloc(12),n=new en(e);n.write("DIRC",4,"utf8"),n.writeUInt32BE(2),n.writeUInt32BE(this.entriesFlat.length);let r=[];for(let o of this.entries)if(r.push(t._entryToBuffer(o)),o.stages.length>1)for(let l of o.stages)l&&l!==o&&r.push(t._entryToBuffer(l));r=await Promise.all(r);let i=Buffer.concat(r),a=Buffer.concat([e,i]),s=await Un(a);return Buffer.concat([a,Buffer.from(s,"hex")])}};function Lo(t,e,n=!0,r=!0){let i=Ei(t),a=Ei(e);return n&&i.mode!==a.mode||i.mtimeSeconds!==a.mtimeSeconds||i.ctimeSeconds!==a.ctimeSeconds||i.uid!==a.uid||i.gid!==a.gid||r&&i.ino!==a.ino||i.size!==a.size}var vf=null,xi=Symbol("IndexCache");function d5(){return{map:new Map,stats:new Map}}async function p5(t,e,n){let r=await t.lstat(e),i=await t.read(e),a=await Tf.from(i);n.map.set(e,a),n.stats.set(e,r)}async function m5(t,e,n){let r=n.stats.get(e);if(r===void 0)return!0;let i=await t.lstat(e);return r===null||i===null?!1:Lo(r,i)}var lt=class{static async acquire({fs:e,gitdir:n,cache:r,allowUnmerged:i=!0},a){r[xi]||(r[xi]=d5());let s=`${n}/index`;vf===null&&(vf=new Xa.default({maxPending:1/0}));let o,l=[];return await vf.acquire(s,async()=>{await m5(e,s,r[xi])&&await p5(e,s,r[xi]);let c=r[xi].map.get(s);if(l=c.unmergedPaths,l.length&&!i)throw new Ya(l);if(o=await a(c),c._dirty){let u=await c.toObject();await e.write(s,u),r[xi].stats.set(s,await e.lstat(s)),c._dirty=!1}}),o}};function jo(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e>-1&&(t=t.slice(e+1)),t}function ki(t){let e=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return e===-1?".":e===0?"/":t.slice(0,e)}function E1(t){let e=new Map,n=function(i){if(!e.has(i)){let a={type:"tree",fullpath:i,basename:jo(i),metadata:{},children:[]};e.set(i,a),a.parent=n(ki(i)),a.parent&&a.parent!==a&&a.parent.children.push(a)}return e.get(i)},r=function(i,a){if(!e.has(i)){let s={type:"blob",fullpath:i,basename:jo(i),metadata:a,parent:n(ki(i)),children:[]};s.parent&&s.parent.children.push(s),e.set(i,s)}return e.get(i)};n(".");for(let i of t)r(i.path,i);return e}function g5(t){switch(t){case 16384:return"tree";case 33188:return"blob";case 33261:return"blob";case 40960:return"blob";case 57344:return"commit"}throw new ue(`Unexpected GitTree entry mode: ${t.toString(8)}`)}var Cf=class{constructor({fs:e,gitdir:n,cache:r}){this.treePromise=lt.acquire({fs:e,gitdir:n,cache:r},async function(a){return E1(a.entries)});let i=this;this.ConstructEntry=class{constructor(s){this._fullpath=s,this._type=!1,this._mode=!1,this._stat=!1,this._oid=!1}async type(){return i.type(this)}async mode(){return i.mode(this)}async stat(){return i.stat(this)}async content(){return i.content(this)}async oid(){return i.oid(this)}}}async readdir(e){let n=e._fullpath,i=(await this.treePromise).get(n);if(!i||i.type==="blob")return null;if(i.type!=="tree")throw new Error(`ENOTDIR: not a directory, scandir '${n}'`);let a=i.children.map(s=>s.fullpath);return a.sort(Wo),a}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let r=(await this.treePromise).get(e._fullpath);if(!r)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let i=r.type==="tree"?{}:Ei(r.metadata);e._type=r.type==="tree"?"tree":g5(i.mode),e._mode=i.mode,r.type==="tree"?e._stat=void 0:e._stat=i}return e._stat}async content(e){}async oid(e){if(e._oid===!1){let r=(await this.treePromise).get(e._fullpath);e._oid=r.metadata.oid}return e._oid}},qo=Symbol("GitWalkSymbol");function Xo(){let t=Object.create(null);return Object.definePr
|
||
|
[remote "${e}"]
|
||
|
fetch = +refs/heads/*:refs/remotes/origin/*
|
||
|
`),this.code=this.name=t.code,this.data={remote:e}}};Za.code="NoRefspecError";var Do=class t{constructor(e){if(this.refs=new Map,this.parsedConfig=[],e){let n=null;this.parsedConfig=e.trim().split(`
|
||
|
`).map(r=>{if(/^\s*#/.test(r))return{line:r,comment:!0};let i=r.indexOf(" ");if(r.startsWith("^")){let a=r.slice(1);return this.refs.set(n+"^{}",a),{line:r,ref:n,peeled:a}}else{let a=r.slice(0,i);return n=r.slice(i+1),this.refs.set(n,a),{line:r,ref:n,oid:a}}})}return this}static from(e){return new t(e)}delete(e){this.parsedConfig=this.parsedConfig.filter(n=>n.ref!==e),this.refs.delete(e)}toString(){return this.parsedConfig.map(({line:e})=>e).join(`
|
||
|
`)+`
|
||
|
`}},Bo=class t{constructor({remotePath:e,localPath:n,force:r,matchPrefix:i}){Object.assign(this,{remotePath:e,localPath:n,force:r,matchPrefix:i})}static from(e){let[n,r,i,a,s]=e.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1),o=n==="+",l=i==="*";if(l!==(s==="*"))throw new ue("Invalid refspec");return new t({remotePath:r,localPath:a,force:o,matchPrefix:l})}translate(e){if(this.matchPrefix){if(e.startsWith(this.remotePath))return this.localPath+e.replace(this.remotePath,"")}else if(e===this.remotePath)return this.localPath;return null}reverseTranslate(e){if(this.matchPrefix){if(e.startsWith(this.localPath))return this.remotePath+e.replace(this.localPath,"")}else if(e===this.localPath)return this.remotePath;return null}},Ff=class t{constructor(e=[]){this.rules=e}static from(e){let n=[];for(let r of e)n.push(Bo.from(r));return new t(n)}add(e){let n=Bo.from(e);this.rules.push(n)}translate(e){let n=[];for(let r of this.rules)for(let i of e){let a=r.translate(i);a&&n.push([i,a])}return n}translateOne(e){let n=null;for(let r of this.rules){let i=r.translate(e);i&&(n=i)}return n}localNamespaces(){return this.rules.filter(e=>e.matchPrefix).map(e=>e.localPath.replace(/\/$/,""))}};function y5(t,e){let n=t.replace(/\^\{\}$/,""),r=e.replace(/\^\{\}$/,""),i=-(n<r)||+(n>r);return i===0?t.endsWith("^{}")?1:-1:i}var K0=new Map;function J0(t){let e=K0.get(t);return e||(e=v5(t),K0.set(t,e)),e}function v5(t){return t=t.split("/./").join("/").replace(/\/{2,}/g,"/"),t==="/."?"/":t==="./"||(t.startsWith("./")&&(t=t.slice(2)),t.endsWith("/.")&&(t=t.slice(0,-2)),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t==="")?".":t}function B(...t){return J0(t.map(J0).join("/"))}var w5=t=>{t=t.toLowerCase();let e=parseInt(t);return t.endsWith("k")&&(e*=1024),t.endsWith("m")&&(e*=1024*1024),t.endsWith("g")&&(e*=1024*1024*1024),e},qa=t=>{if(t=t.trim().toLowerCase(),t==="true"||t==="yes"||t==="on")return!0;if(t==="false"||t==="no"||t==="off")return!1;throw Error(`Expected 'true', 'false', 'yes', 'no', 'on', or 'off', but got ${t}`)},Q0={core:{filemode:qa,bare:qa,logallrefupdates:qa,symlinks:qa,ignorecase:qa,bigFileThreshold:w5}},b5=/^\[([A-Za-z0-9-.]+)(?: "(.*)")?\]$/,x5=/^[A-Za-z0-9-.]+$/,_5=/^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/,S5=/^[A-Za-z][A-Za-z-]*$/,E5=/^(.*?)( *[#;].*)$/,k5=t=>{let e=b5.exec(t);if(e!=null){let[n,r]=e.slice(1);return[n,r]}return null},A5=t=>{let e=_5.exec(t);if(e!=null){let[n,r="true"]=e.slice(1),i=T5(r),a=C5(i);return[n,a]}return null},T5=t=>{let e=E5.exec(t);if(e==null)return t;let[n,r]=e.slice(1);return e1(n)&&e1(r)?`${n}${r}`:n},e1=t=>(t.match(/(?:^|[^\\])"/g)||[]).length%2!==0,C5=t=>t.split("").reduce((e,n,r,i)=>{let a=n==='"'&&i[r-1]!=="\\",s=n==="\\"&&i[r+1]==='"';return a||s?e:e+n},""),t1=t=>t!=null?t.toLowerCase():null,Mf=(t,e,n)=>[t1(t),e,t1(n)].filter(r=>r!=null).join("."),n1=t=>{let e=t.split("."),n=e.shift(),r=e.pop(),i=e.length?e.join("."):void 0;return{section:n,subsection:i,name:r,path:Mf(n,i,r),sectionPath:Mf(n,i,null)}},F5=(t,e)=>t.reduce((n,r,i)=>e(r)?i:n,-1),Of=class t{constructor(e){let n=null,r=null;this.parsedConfig=e?e.split(`
|
||
|
`).map(i=>{let a=null,s=null,o=i.trim(),l=k5(o),c=l!=null;if(c)[n,r]=l;else{let f=A5(o);f!=null&&([a,s]=f)}let u=Mf(n,r,a);return{line:i,isSection:c,section:n,subsection:r,name:a,value:s,path:u}}):[]}static from(e){return new t(e)}async get(e,n=!1){let r=n1(e).path,i=this.parsedConfig.filter(a=>a.path===r).map(({section:a,name:s,value:o})=>{let l=Q0[a]&&Q0[a][s];return l?l(o):o});return n?i:i.pop()}async getall(e){return this.get(e,!0)}async getSubsections(e){return this.parsedConfig.filter(n=>n.section===e&&n.isSection).map(n=>n.subsection)}async deleteSection(e,n){this.parsedConfig=this.parsedConfig.filter(r=>!(r.section===e&&r.subsection===n))}async append(e,n){return this.set(e,n,!0)}async set(e,n,r=!1){let{section:i,subsection:a,name:s,path:o,sectionPath:l}=n1(e),c=F5(this.parsedConfig,u=>u.path===o);if(n==null)c!==-1&&this.parsedConfig.splice(c,1);else if(c!==-1){let u=this.parsedConfig[c],f=Object.assign({},u,{name:s,value:n,modified:!0});r?this.parsedConfig.splice(c+1,0,f):this.parsedConfig[c]=f}else{let u=this.parsedConfig.findIndex(h=>h.path===l),f={section:i,subsection:a,name:s,value:n,modified:!0,path:o};if(x5.test(i)&&S5.test(s))if(u>=0)this.parsedConfig.splice(u+1,0,f);else{let h={section:i,subsection:a,modified:!0,path:l};this.parsedConfig.push(h,f)}}}toString(){return this.parsedConfig.map(({line:e,section:n,subsection:r,name:i,value:a,modified:s=!1})=>s?i!=null&&a!=null?typeof a=="string"&&/[#;]/.test(a)?` ${i} = "${a}"`:` ${i} = ${a}`:r!=null?`[${n} "${r}"]`:`[${n}]`:e).join(`
|
||
|
`)}},ze=class{static async get({fs:e,gitdir:n}){let r=await e.read(`${n}/config`,{encoding:"utf8"});return Of.from(r)}static async save({fs:e,gitdir:n,config:r}){await e.write(`${n}/config`,r.toString(),{encoding:"utf8"})}},Po=t=>[`${t}`,`refs/${t}`,`refs/tags/${t}`,`refs/heads/${t}`,`refs/remotes/${t}`,`refs/remotes/${t}/HEAD`],M5=["config","description","index","shallow","commondir"],wf;async function ir(t,e){return wf===void 0&&(wf=new Xa.default),wf.acquire(t,e)}var q=class t{static async updateRemoteRefs({fs:e,gitdir:n,remote:r,refs:i,symrefs:a,tags:s,refspecs:o=void 0,prune:l=!1,pruneTags:c=!1}){for(let m of i.values())if(!m.match(/[0-9a-f]{40}/))throw new or(m);let u=await ze.get({fs:e,gitdir:n});if(!o){if(o=await u.getall(`remote.${r}.fetch`),o.length===0)throw new Za(r);o.unshift(`+HEAD:refs/remotes/${r}/HEAD`)}let f=Ff.from(o),h=new Map;if(c){let m=await t.listRefs({fs:e,gitdir:n,filepath:"refs/tags"});await t.deleteRefs({fs:e,gitdir:n,refs:m.map(w=>`refs/tags/${w}`)})}if(s){for(let m of i.keys())if(m.startsWith("refs/tags")&&!m.endsWith("^{}")&&!await t.exists({fs:e,gitdir:n,ref:m})){let w=i.get(m);h.set(m,w)}}let d=f.translate([...i.keys()]);for(let[m,w]of d){let b=i.get(m);h.set(w,b)}let p=f.translate([...a.keys()]);for(let[m,w]of p){let b=a.get(m),S=f.translateOne(b);S&&h.set(w,`ref: ${S}`)}let g=[];if(l){for(let m of f.localNamespaces()){let w=(await t.listRefs({fs:e,gitdir:n,filepath:m})).map(b=>`${m}/${b}`);for(let b of w)h.has(b)||g.push(b)}g.length>0&&await t.deleteRefs({fs:e,gitdir:n,refs:g})}for(let[m,w]of h)await ir(m,async()=>e.write(B(n,m),`${w.trim()}
|
||
|
`,"utf8"));return{pruned:g}}static async writeRef({fs:e,gitdir:n,ref:r,value:i}){if(!i.match(/[0-9a-f]{40}/))throw new or(i);await ir(r,async()=>e.write(B(n,r),`${i.trim()}
|
||
|
`,"utf8"))}static async writeSymbolicRef({fs:e,gitdir:n,ref:r,value:i}){await ir(r,async()=>e.write(B(n,r),`ref: ${i.trim()}
|
||
|
`,"utf8"))}static async deleteRef({fs:e,gitdir:n,ref:r}){return t.deleteRefs({fs:e,gitdir:n,refs:[r]})}static async deleteRefs({fs:e,gitdir:n,refs:r}){await Promise.all(r.map(o=>e.rm(B(n,o))));let i=await ir("packed-refs",async()=>e.read(`${n}/packed-refs`,{encoding:"utf8"})),a=Do.from(i),s=a.refs.size;for(let o of r)a.refs.has(o)&&a.delete(o);a.refs.size<s&&(i=a.toString(),await ir("packed-refs",async()=>e.write(`${n}/packed-refs`,i,{encoding:"utf8"})))}static async resolve({fs:e,gitdir:n,ref:r,depth:i=void 0}){if(i!==void 0&&(i--,i===-1))return r;if(r.startsWith("ref: "))return r=r.slice(5),t.resolve({fs:e,gitdir:n,ref:r,depth:i});if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let a=await t.packedRefs({fs:e,gitdir:n}),s=Po(r).filter(o=>!M5.includes(o));for(let o of s){let l=await ir(o,async()=>await e.read(`${n}/${o}`,{encoding:"utf8"})||a.get(o));if(l)return t.resolve({fs:e,gitdir:n,ref:l.trim(),depth:i})}throw new Re(r)}static async exists({fs:e,gitdir:n,ref:r}){try{return await t.expand({fs:e,gitdir:n,ref:r}),!0}catch(i){return!1}}static async expand({fs:e,gitdir:n,ref:r}){if(r.length===40&&/[0-9a-f]{40}/.test(r))return r;let i=await t.packedRefs({fs:e,gitdir:n}),a=Po(r);for(let s of a)if(await ir(s,async()=>e.exists(`${n}/${s}`))||i.has(s))return s;throw new Re(r)}static async expandAgainstMap({ref:e,map:n}){let r=Po(e);for(let i of r)if(await n.has(i))return i;throw new Re(e)}static resolveAgainstMap({ref:e,fullref:n=e,depth:r=void 0,map:i}){if(r!==void 0&&(r--,r===-1))return{fullref:n,oid:e};if(e.startsWith("ref: "))return e=e.slice(5),t.resolveAgainstMap({ref:e,fullref:n,depth:r,map:i});if(e.length===40&&/[0-9a-f]{40}/.test(e))return{fullref:n,oid:e};let a=Po(e);for(let s of a){let o=i.get(s);if(o)return t.resolveAgainstMap({ref:o.trim(),fullref:s,depth:r,map:i})}throw new Re(e)}static async packedRefs({fs:e,gitdir:n}){let r=await ir("packed-refs",async()=>e.read(`${n}/packed-refs`,{encoding:"utf8"}));return Do.from(r).refs}static async listRefs({fs:e,gitdir:n,filepath:r}){let i=t.packedRefs({fs:e,gitdir:n}),a=null;try{a=await e.readdirDeep(`${n}/${r}`),a=a.map(s=>s.replace(`${n}/${r}/`,""))}catch(s){a=[]}for(let s of(await i).keys())s.startsWith(r)&&(s=s.replace(r+"/",""),a.includes(s)||a.push(s));return a.sort(y5),a}static async listBranches({fs:e,gitdir:n,remote:r}){return r?t.listRefs({fs:e,gitdir:n,filepath:`refs/remotes/${r}`}):t.listRefs({fs:e,gitdir:n,filepath:"refs/heads"})}static async listTags({fs:e,gitdir:n}){return(await t.listRefs({fs:e,gitdir:n,filepath:"refs/tags"})).filter(i=>!i.endsWith("^{}"))}};function O5(t,e){return Wo(r1(t),r1(e))}function r1(t){return t.mode==="040000"?t.path+"/":t.path}function k1(t){switch(t){case"040000":return"tree";case"100644":return"blob";case"100755":return"blob";case"120000":return"blob";case"160000":return"commit"}throw new ue(`Unexpected GitTree entry mode: ${t}`)}function P5(t){let e=[],n=0;for(;n<t.length;){let r=t.indexOf(32,n);if(r===-1)throw new ue(`GitTree: Error parsing buffer at byte location ${n}: Could not find the next space character.`);let i=t.indexOf(0,n);if(i===-1)throw new ue(`GitTree: Error parsing buffer at byte location ${n}: Could not find the next null character.`);let a=t.slice(n,r).toString("utf8");a==="40000"&&(a="040000");let s=k1(a),o=t.slice(r+1,i).toString("utf8");if(o.includes("\\")||o.includes("/"))throw new Si(o);let l=t.slice(i+1,i+21).toString("hex");n=i+21,e.push({mode:a,path:o,oid:l,type:s})}return e}function I5(t){if(typeof t=="number"&&(t=t.toString(8)),t.match(/^0?4.*/))return"040000";if(t.match(/^1006.*/))return"100644";if(t.match(/^1007.*/))return"100755";if(t.match(/^120.*/))return"120000";if(t.match(/^160.*/))return"160000";throw new ue(`Could not understand file mode: ${t}`)}function R5(t){return!t.oid&&t.sha&&(t.oid=t.sha),t.mode=I5(t.mode),t.type||(t.type=k1(t.mode)),t}var It=class t{constructor(e){if(Buffer.isBuffer(e))this._entries=P5(e);else if(Array.isArray(e))this._entries=e.map(R5);else throw new ue("invalid type passed to GitTree constructor");this._entries.sort(x1)}static from(e){return new t(e)}render(){
|
||
|
`)}toObject(){let e=[...this._entries];return e.sort(O5),Buffer.concat(e.map(n=>{let r=Buffer.from(n.mode.replace(/^0/,"")),i=Buffer.from(" "),a=Buffer.from(n.path,"utf8"),s=Buffer.from([0]),o=Buffer.from(n.oid,"hex");return Buffer.concat([r,i,a,s,o])}))}entries(){return this._entries}*[Symbol.iterator](){for(let e of this._entries)yield e}},lr=class{static wrap({type:e,object:n}){return Buffer.concat([Buffer.from(`${e} ${n.byteLength.toString()}\0`),Buffer.from(n)])}static unwrap(e){let n=e.indexOf(32),r=e.indexOf(0),i=e.slice(0,n).toString("utf8"),a=e.slice(n+1,r).toString("utf8"),s=e.length-(r+1);if(parseInt(a)!==s)throw new ue(`Length mismatch: expected ${a} bytes but got ${s} instead.`);return{type:i,object:Buffer.from(e.slice(r+1))}}};async function L5({fs:t,gitdir:e,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`,i=await t.read(`${e}/${r}`);return i?{object:i,format:"deflated",source:r}:null}function j5(t,e){let n=new en(t),r=i1(n);if(r!==e.byteLength)throw new ue(`applyDelta expected source buffer to be ${r} bytes but the provided buffer was ${e.length} bytes`);let i=i1(n),a,s=s1(n,e);if(s.byteLength===i)a=s;else{a=Buffer.alloc(i);let o=new en(a);for(o.copy(s);!n.eof();)o.copy(s1(n,e));let l=o.tell();if(i!==l)throw new ue(`applyDelta expected target buffer to be ${i} bytes but the resulting buffer was ${l} bytes`)}return a}function i1(t){let e=0,n=0,r=null;do r=t.readUInt8(),e|=(r&127)<<n,n+=7;while(r&128);return e}function a1(t,e,n){let r=0,i=0;for(;n--;)e&1&&(r|=t.readUInt8()<<i),e>>=1,i+=8;return r}function s1(t,e){let n=t.readUInt8(),r=128,i=15,a=112;if(n&r){let s=a1(t,n&i,4),o=a1(t,(n&a)>>4,3);return o===0&&(o=65536),e.slice(s,s+o)}else return t.slice(n)}function D5(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator](){return this}}}function A1(t){return t[Symbol.asyncIterator]?t[Symbol.asyncIterator]():t[Symbol.iterator]?t[Symbol.iterator]():t.next?t:D5(t)}var No=class{constructor(e){if(typeof Buffer=="undefined")throw new Error("Missing Buffer dependency");this.stream=A1(e),this.buffer=null,this.cursor=0,this.undoCursor=0,this.started=!1,this._ended=!1,this._discardedBytes=0}eof(){return this._ended&&this.cursor===this.buffer.length}tell(){return this._discardedBytes+this.cursor}async byte(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(1),this.buffer[this.undoCursor]}async chunk(){if(!this.eof()&&(this.started||await this._init(),!(this.cursor===this.buffer.length&&(await this._loadnext(),this._ended))))return this._moveCursor(this.buffer.length),this.buffer.slice(this.undoCursor,this.cursor)}async read(e){if(!this.eof())return this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e),this.buffer.slice(this.undoCursor,this.cursor)}async skip(e){this.eof()||(this.started||await this._init(),this.cursor+e>this.buffer.length&&(this._trim(),await this._accumulate(e)),this._moveCursor(e))}async undo(){this.cursor=this.undoCursor}async _next(){this.started=!0;let{done:e,value:n}=await this.stream.next();return e&&(this._ended=!0,!n)?Buffer.alloc(0):(n&&(n=Buffer.from(n)),n)}_trim(){this.buffer=this.buffer.slice(this.undoCursor),this.cursor-=this.undoCursor,this._discardedBytes+=this.undoCursor,this.undoCursor=0}_moveCursor(e){this.undoCursor=this.cursor,this.cursor+=e,this.cursor>this.buffer.length&&(this.cursor=this.buffer.length)}async _accumulate(e){if(this._ended)return;let n=[this.buffer];for(;this.cursor+e>B5(n);){let r=await this._next();if(this._ended)break;n.push(r)}this.buffer=Buffer.concat(n)}async _loadnext(){this._discardedBytes+=this.buffer.length,this.undoCursor=0,this.cursor=0,this.buffer=await this._next()}async _init(){this.buffer=await this._next()}};function B5(t){return t.reduce((e,n)=>e+n.length,0)}async function N5(t,e){let n=new No(t),r=await n.read(4);if(r=r.toString("utf8"),r!=="PACK")throw new ue(`Invalid PACK header '${r}'`);l
|
||
|
`,t}function $o(t){let[,e,n,r,i]=t.match(/^(.*) <(.*)> (.*) (.*)$/);return{name:e,email:n,timestamp:Number(r),timezoneOffset:Z5(i)}}function Z5(t){let[,e,n,r]=t.match(/(\+|-)(\d\d)(\d\d)/);return r=(e==="+"?1:-1)*(Number(n)*60+Number(r)),K5(r)}function K5(t){return t===0?t:-t}var Ut=class t{constructor(e){if(typeof e=="string")this._tag=e;else if(Buffer.isBuffer(e))this._tag=e.toString("utf8");else if(typeof e=="object")this._tag=t.render(e);else throw new ue("invalid type passed to GitAnnotatedTag constructor")}static from(e){return new t(e)}static render(e){return`object ${e.object}
|
||
|
type ${e.type}
|
||
|
tag ${e.tag}
|
||
|
tagger ${Pf(e.tagger)}
|
||
|
|
||
|
${e.message}
|
||
|
${e.gpgsig?e.gpgsig:""}`}justHeaders(){return this._tag.slice(0,this._tag.indexOf(`
|
||
|
|
||
|
`))}message(){let e=this.withoutSignature();return e.slice(e.indexOf(`
|
||
|
|
||
|
`)+2)}parse(){return Object.assign(this.headers(),{message:this.message(),gpgsig:this.gpgsig()})}render(){return this._tag}headers(){let e=this.justHeaders().split(`
|
||
|
`),n=[];for(let i of e)i[0]===" "?n[n.length-1]+=`
|
||
|
`+i.slice(1):n.push(i);let r={};for(let i of n){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(r[a])?r[a].push(s):r[a]=s}return r.tagger&&(r.tagger=$o(r.tagger)),r.committer&&(r.committer=$o(r.committer)),r}withoutSignature(){let e=Hn(this._tag);return e.indexOf(`
|
||
|
-----BEGIN PGP SIGNATURE-----`)===-1?e:e.slice(0,e.lastIndexOf(`
|
||
|
-----BEGIN PGP SIGNATURE-----`))}gpgsig(){if(this._tag.indexOf(`
|
||
|
-----BEGIN PGP SIGNATURE-----`)===-1)return;let e=this._tag.slice(this._tag.indexOf("-----BEGIN PGP SIGNATURE-----"),this._tag.indexOf("-----END PGP SIGNATURE-----")+27);return Hn(e)}payload(){return this.withoutSignature()+`
|
||
|
`}toObject(){return Buffer.from(this._tag,"utf8")}static async sign(e,n,r){let i=e.payload(),{signature:a}=await n({payload:i,secretKey:r});a=Hn(a);let s=i+a;return t.from(s)}};function xf(t){return t.trim().split(`
|
||
|
`).map(e=>" "+e).join(`
|
||
|
`)+`
|
||
|
`}function J5(t){return t.split(`
|
||
|
`).map(e=>e.replace(/^ /,"")).join(`
|
||
|
`)}var Rt=class t{constructor(e){if(typeof e=="string")this._commit=e;else if(Buffer.isBuffer(e))this._commit=e.toString("utf8");else if(typeof e=="object")this._commit=t.render(e);else throw new ue("invalid type passed to GitCommit constructor")}static fromPayloadSignature({payload:e,signature:n}){let r=t.justHeaders(e),i=t.justMessage(e),a=Hn(r+`
|
||
|
gpgsig`+xf(n)+`
|
||
|
`+i);return new t(a)}static from(e){return new t(e)}toObject(){return Buffer.from(this._commit,"utf8")}headers(){return this.parseHeaders()}message(){return t.justMessage(this._commit)}parse(){return Object.assign({message:this.message()},this.headers())}static justMessage(e){return Hn(e.slice(e.indexOf(`
|
||
|
|
||
|
`)+2))}static justHeaders(e){return e.slice(0,e.indexOf(`
|
||
|
|
||
|
`))}parseHeaders(){let e=t.justHeaders(this._commit).split(`
|
||
|
`),n=[];for(let i of e)i[0]===" "?n[n.length-1]+=`
|
||
|
`+i.slice(1):n.push(i);let r={parent:[]};for(let i of n){let a=i.slice(0,i.indexOf(" ")),s=i.slice(i.indexOf(" ")+1);Array.isArray(r[a])?r[a].push(s):r[a]=s}return r.author&&(r.author=$o(r.author)),r.committer&&(r.committer=$o(r.committer)),r}static renderHeaders(e){let n="";if(e.tree?n+=`tree ${e.tree}
|
||
|
`:n+=`tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904
|
||
|
`,e.parent){if(e.parent.length===void 0)throw new ue("commit 'parent' property should be an array");for(let a of e.parent)n+=`parent ${a}
|
||
|
`}let r=e.author;n+=`author ${Pf(r)}
|
||
|
`;let i=e.committer||e.author;return n+=`committer ${Pf(i)}
|
||
|
`,e.gpgsig&&(n+="gpgsig"+xf(e.gpgsig)),n}static render(e){return t.renderHeaders(e)+`
|
||
|
`+Hn(e.message)}render(){return this._commit}withoutSignature(){let e=Hn(this._commit);if(e.indexOf(`
|
||
|
gpgsig`)===-1)return e;let n=e.slice(0,e.indexOf(`
|
||
|
gpgsig`)),r=e.slice(e.indexOf(`-----END PGP SIGNATURE-----
|
||
|
`)+28);return Hn(n+`
|
||
|
`+r)}isolateSignature(){let e=this._commit.slice(this._commit.indexOf("-----BEGIN PGP SIGNATURE-----"),this._commit.indexOf("-----END PGP SIGNATURE-----")+27);return J5(e)}static async sign(e,n,r){let i=e.withoutSignature(),a=t.justMessage(e._commit),{signature:s}=await n({payload:i,secretKey:r});s=Hn(s);let l=t.justHeaders(e._commit)+`
|
||
|
gpgsig`+xf(s)+`
|
||
|
`+a;return t.from(l)}};async function Oi({fs:t,cache:e,gitdir:n,oid:r}){if(r==="4b825dc642cb6eb9a060e54bf8d69288fbee4904")return{tree:It.from([]),oid:r};let{type:i,object:a}=await Ge({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=Ut.from(a).parse().object,Oi({fs:t,cache:e,gitdir:n,oid:r});if(i==="commit")return r=Rt.from(a).parse().tree,Oi({fs:t,cache:e,gitdir:n,oid:r});if(i!=="tree")throw new kt(r,i,"tree");return{tree:It.from(a),oid:r}}var If=class{constructor({fs:e,gitdir:n,ref:r,cache:i}){this.fs=e,this.cache=i,this.gitdir=n,this.mapPromise=(async()=>{let s=new Map,o;try{o=await q.resolve({fs:e,gitdir:n,ref:r})}catch(c){c instanceof Re&&(o="4b825dc642cb6eb9a060e54bf8d69288fbee4904")}let l=await Oi({fs:e,cache:this.cache,gitdir:n,oid:o});return l.type="tree",l.mode="40000",s.set(".",l),s})();let a=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(e){let n=e._fullpath,{fs:r,cache:i,gitdir:a}=this,s=await this.mapPromise,o=s.get(n);if(!o)throw new Error(`No obj for ${n}`);let l=o.oid;if(!l)throw new Error(`No oid for obj ${JSON.stringify(o)}`);if(o.type!=="tree")return null;let{type:c,object:u}=await Ge({fs:r,cache:i,gitdir:a,oid:l});if(c!==o.type)throw new kt(l,c,o.type);let f=It.from(u);for(let h of f)s.set(B(n,h.path),h);return f.entries().map(h=>B(n,h.path))}async type(e){if(e._type===!1){let n=await this.mapPromise,{type:r}=n.get(e._fullpath);e._type=r}return e._type}async mode(e){if(e._mode===!1){let n=await this.mapPromise,{mode:r}=n.get(e._fullpath);e._mode=_1(parseInt(r,8))}return e._mode}async stat(e){}async content(e){if(e._content===!1){let n=await this.mapPromise,{fs:r,cache:i,gitdir:a}=this,o=n.get(e._fullpath).oid,{type:l,object:c}=await Ge({fs:r,cache:i,gitdir:a,oid:o});l!=="blob"?e._content=void 0:e._content=new Uint8Array(c)}return e._content}async oid(e){if(e._oid===!1){let r=(await this.mapPromise).get(e._fullpath);e._oid=r.oid}return e._oid}};function sr({ref:t="HEAD"}={}){let e=Object.create(null);return Object.defineProperty(e,qo,{value:function({fs:n,gitdir:r,cache:i}){return new If({fs:n,gitdir:r,ref:t,cache:i})}}),Object.freeze(e),e}var Rf=class{constructor({fs:e,dir:n,gitdir:r,cache:i}){this.fs=e,this.cache=i,this.dir=n,this.gitdir=r;let a=this;this.ConstructEntry=class{constructor(o){this._fullpath=o,this._type=!1,this._mode=!1,this._stat=!1,this._content=!1,this._oid=!1}async type(){return a.type(this)}async mode(){return a.mode(this)}async stat(){return a.stat(this)}async content(){return a.content(this)}async oid(){return a.oid(this)}}}async readdir(e){let n=e._fullpath,{fs:r,dir:i}=this,a=await r.readdir(B(i,n));return a===null?null:a.map(s=>B(n,s))}async type(e){return e._type===!1&&await e.stat(),e._type}async mode(e){return e._mode===!1&&await e.stat(),e._mode}async stat(e){if(e._stat===!1){let{fs:n,dir:r}=this,i=await n.lstat(`${r}/${e._fullpath}`);if(!i)throw new Error(`ENOENT: no such file or directory, lstat '${e._fullpath}'`);let a=i.isDirectory()?"tree":"blob";a==="blob"&&!i.isFile()&&!i.isSymbolicLink()&&(a="special"),e._type=a,i=Ei(i),e._mode=i.mode,i.size===-1&&e._actualSize&&(i.size=e._actualSize),e._stat=i}return e._stat}async content(e){if(e._content===!1){let{fs:n,dir:r,gitdir:i}=this;if(await e.type()==="tree")e._content=void 0;else{let s=await(await ze.get({fs:n,gitdir:i})).get("core.autocrlf"),o=await n.read(`${r}/${e._fullpath}`,{autocrlf:s});e._actualSize=o.length,e._stat&&e._stat.size===-1&&(e._stat.size=e._actualSize),e._content=new Uint8Array(o)}}return e._content}async oid(e){if(e._oid===!1){let{fs:n,gitdir:r,cache:i}=this,a;await lt.acquire({fs:n,gitdir:r,cache:i},async function(s){let o=s.entriesMap.get(e._fullpath),l=await e.stat(),u=await(await ze.get({fs:n,gitdir:r})).get("core.filemode"),f=typeof process!="undefined"?process.platform!=="win32":!0;!o||Lo(l,o,u,f)?await e.content()===void
|
||
|
`),r=new TextEncoder().encode(r)}catch(i){}return typeof r!="string"&&(r=Buffer.from(r)),r}catch(r){return null}}async write(e,n,r={}){try{await this._writeFile(e,n,r);return}catch(i){await this.mkdir(ki(e)),await this._writeFile(e,n,r)}}async mkdir(e,n=!1){try{await this._mkdir(e);return}catch(r){if(r===null||r.code==="EEXIST")return;if(n)throw r;if(r.code==="ENOENT"){let i=ki(e);if(i==="."||i==="/"||i===e)throw r;await this.mkdir(i),await this.mkdir(e,!0)}}}async rm(e){try{await this._unlink(e)}catch(n){if(n.code!=="ENOENT")throw n}}async rmdir(e,n){try{n&&n.recursive?await this._rm(e,n):await this._rmdir(e)}catch(r){if(r.code!=="ENOENT")throw r}}async readdir(e){try{let n=await this._readdir(e);return n.sort(Wo),n}catch(n){return n.code==="ENOTDIR"?null:[]}}async readdirDeep(e){let n=await this._readdir(e);return(await Promise.all(n.map(async i=>{let a=e+"/"+i;return(await this._stat(a)).isDirectory()?this.readdirDeep(a):a}))).reduce((i,a)=>i.concat(a),[])}async lstat(e){try{return await this._lstat(e)}catch(n){if(n.code==="ENOENT")return null;throw n}}async readlink(e,n={encoding:"buffer"}){try{let r=await this._readlink(e,n);return Buffer.isBuffer(r)?r:Buffer.from(r)}catch(r){if(r.code==="ENOENT")return null;throw r}}async writelink(e,n){return this._symlink(n.toString("utf8"),e)}};function F(t,e){if(e===void 0)throw new Pt(t)}async function Ho(t,e){return!t&&!e?!1:t&&!e||!t&&e?!0:!(await t.type()==="tree"&&await e.type()==="tree"||await t.type()===await e.type()&&await t.mode()===await e.mode()&&await t.oid()===await e.oid())}async function rC({fs:t,dir:e,gitdir:n=B(e,".git"),commit:r="HEAD",cache:i={}}){try{F("fs",t),F("dir",e),F("gitdir",n);let a=new Q(t),s=[sr({ref:r}),Yo(),Xo()],o=[];await lt.acquire({fs:a,gitdir:n,cache:i},async function(c){o=c.unmergedPaths});let l=await Pi({fs:a,cache:i,dir:e,gitdir:n,trees:s,map:async function(c,[u,f,h]){let d=!await Ho(f,h),p=o.includes(c),g=!await Ho(h,u);if(d||p)return u?{path:c,mode:await u.mode(),oid:await u.oid(),type:await u.type(),content:await u.content()}:void 0;if(g)return!1;throw new cs(c)}});await lt.acquire({fs:a,gitdir:n,cache:i},async function(c){for(let u of l)if(u!==!1){if(!u){await a.rmdir(`${e}/${u.path}`,{recursive:!0}),c.delete({filepath:u.path});continue}if(u.type==="blob"){let f=new TextDecoder().decode(u.content);await a.write(`${e}/${u.path}`,f,{mode:u.mode}),c.insert({filepath:u.path,oid:u.oid,stage:0})}}})}catch(a){throw a.caller="git.abortMerge",a}}var Ii=class{static async isIgnored({fs:e,dir:n,gitdir:r=B(n,".git"),filepath:i}){if(jo(i)===".git")return!0;if(i===".")return!1;let a="",s=B(r,"info","exclude");await e.exists(s)&&(a=await e.read(s,"utf8"));let o=[{gitignore:B(n,".gitignore"),filepath:i}],l=i.split("/").filter(Boolean);for(let u=1;u<l.length;u++){let f=l.slice(0,u).join("/"),h=l.slice(u).join("/");o.push({gitignore:B(n,f,".gitignore"),filepath:h})}let c=!1;for(let u of o){let f;try{f=await e.read(u.gitignore,"utf8")}catch(p){if(p.code==="NOENT")continue}let h=(0,w1.default)().add(a);h.add(f);let d=ki(u.filepath);if(d!=="."&&h.ignores(d))return!0;c?c=!h.test(u.filepath).unignored:c=h.test(u.filepath).ignored}return c}};async function iC({fs:t,gitdir:e,object:n,format:r,oid:i}){if(r!=="deflated")throw new ue("GitObjectStoreLoose expects objects to write to be in deflated format");let a=`objects/${i.slice(0,2)}/${i.slice(2)}`,s=`${e}/${a}`;await t.exists(s)||await t.write(s,n)}var _f=null;async function F1(t){return _f===null&&(_f=sC()),_f?aC(t):Vo.default.deflate(t)}async function aC(t){let e=new CompressionStream("deflate"),n=new Blob([t]).stream().pipeThrough(e);return new Uint8Array(await new Response(n).arrayBuffer())}function sC(){try{return new CompressionStream("deflate").writable.close(),new Blob([]).stream().cancel(),!0}catch(t){return!1}}async function zt({fs:t,gitdir:e,type:n,object:r,format:i="content",oid:a=void 0,dryRun:s=!1}){return i!=="deflated"&&(i!=="wrapped"&&(r=lr.wrap({type:n,object:r})),a=await Un(r),r=Buffer.from(await F1(r))),s||await iC({fs:t,gitdir:e,object:r,format:"deflated",oid:a}),a}function oC(t){let e;
|
||
|
`,author:l,committer:c,signingKey:u})}async function uC({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ref:i="refs/notes/commits",oid:a,note:s,force:o,author:l,committer:c,signingKey:u,cache:f={}}){try{F("fs",t),F("gitdir",r),F("oid",a),F("note",s),u&&F("onSign",e);let h=new Q(t),d=await Hr({fs:h,gitdir:r,author:l});if(!d)throw new At("author");let p=await Ri({fs:h,gitdir:r,author:d,committer:c});if(!p)throw new At("committer");return await cC({fs:new Q(h),cache:f,onSign:e,gitdir:r,ref:i,oid:a,note:s,force:o,author:d,committer:p,signingKey:u})}catch(h){throw h.caller="git.addNote",h}}async function R1({fs:t,gitdir:e,remote:n,url:r,force:i}){if(n!==fn.default.clean(n))throw new zn(n,fn.default.clean(n));let a=await ze.get({fs:t,gitdir:e});if(!i&&(await a.getSubsections("remote")).includes(n)&&r!==await a.get(`remote.${n}.url`))throw new hn("remote",n);await a.set(`remote.${n}.url`,r),await a.set(`remote.${n}.fetch`,`+refs/heads/*:refs/remotes/${n}/*`),await ze.save({fs:t,gitdir:e,config:a})}async function fC({fs:t,dir:e,gitdir:n=B(e,".git"),remote:r,url:i,force:a=!1}){try{return F("fs",t),F("gitdir",n),F("remote",r),F("url",i),await R1({fs:new Q(t),gitdir:n,remote:r,url:i,force:a})}catch(s){throw s.caller="git.addRemote",s}}async function hC({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:c,force:u=!1}){if(i=i.startsWith("refs/tags/")?i:`refs/tags/${i}`,!u&&await q.exists({fs:t,gitdir:r,ref:i}))throw new hn("tag",i);let f=await q.resolve({fs:t,gitdir:r,ref:l||"HEAD"}),{type:h}=await Ge({fs:t,cache:e,gitdir:r,oid:f}),d=Ut.from({object:f,type:h,tag:i.replace("refs/tags/",""),tagger:a,message:s,gpgsig:o});c&&(d=await Ut.sign(d,n,c));let p=await zt({fs:t,gitdir:r,type:"tag",object:d.toObject()});await q.writeRef({fs:t,gitdir:r,ref:i,value:p})}async function dC({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ref:i,tagger:a,message:s=i,gpgsig:o,object:l,signingKey:c,force:u=!1,cache:f={}}){try{F("fs",t),F("gitdir",r),F("ref",i),c&&F("onSign",e);let h=new Q(t),d=await Hr({fs:h,gitdir:r,author:a});if(!d)throw new At("tagger");return await hC({fs:h,cache:f,onSign:e,gitdir:r,ref:i,tagger:d,message:s,gpgsig:o,object:l,signingKey:c,force:u})}catch(h){throw h.caller="git.annotatedTag",h}}async function pC({fs:t,gitdir:e,ref:n,object:r,checkout:i=!1,force:a=!1}){if(n!==fn.default.clean(n))throw new zn(n,fn.default.clean(n));let s=`refs/heads/${n}`;if(!a&&await q.exists({fs:t,gitdir:e,ref:s}))throw new hn("branch",n,!1);let o;try{o=await q.resolve({fs:t,gitdir:e,ref:r||"HEAD"})}catch(l){}o&&await q.writeRef({fs:t,gitdir:e,ref:s,value:o}),i&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function mC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,object:i,checkout:a=!1,force:s=!1}){try{return F("fs",t),F("gitdir",n),F("ref",r),await pC({fs:new Q(t),gitdir:n,ref:r,object:i,checkout:a,force:s})}catch(o){throw o.caller="git.branch",o}}var L1=(t,e)=>t==="."||e==null||e.length===0||e==="."?!0:e.length>=t.length?e.startsWith(t):t.startsWith(e);async function Uf({fs:t,cache:e,onProgress:n,onPostCheckout:r,dir:i,gitdir:a,remote:s,ref:o,filepaths:l,noCheckout:c,noUpdateHead:u,dryRun:f,force:h,track:d=!0}){let p;if(r)try{p=await q.resolve({fs:t,gitdir:a,ref:"HEAD"})}catch(m){p="0000000000000000000000000000000000000000"}let g;try{g=await q.resolve({fs:t,gitdir:a,ref:o})}catch(m){if(o==="HEAD")throw m;let w=`${s}/${o}`;if(g=await q.resolve({fs:t,gitdir:a,ref:w}),d){let b=await ze.get({fs:t,gitdir:a});await b.set(`branch.${o}.remote`,s),await b.set(`branch.${o}.merge`,`refs/heads/${o}`),await ze.save({fs:t,gitdir:a,config:b})}await q.writeRef({fs:t,gitdir:a,ref:`refs/heads/${o}`,value:g})}if(!c){let m;try{m=await gC({fs:t,cache:e,onProgress:n,dir:i,gitdir:a,ref:o,force:h,filepaths:l})}catch(x){throw x instanceof Re&&x.data.what===g?new es(o,g):x}let w=m.filter(([x])=>x==="conflict").map(([x,A])=>A);if(w.length>0)throw new Qa(w);let b=m.filter(([x])=>x==="error").map(([x,A])=>A);if(b.length>0)throw new ue(b.join(", "));if(f){r&&await r({previousHead:p,newHead:g,type:l!=null&&l.length>0?"file":"branch"});return}
|
||
|
`).map(s=>i.add(s))}),i}static async write({fs:e,gitdir:n,oids:r}){Br===null&&(Br=new Xa.default);let i=B(n,"shallow");if(r.size>0){let a=[...r].join(`
|
||
|
`)+`
|
||
|
`;await Br.acquire(i,async function(){await e.write(i,a,{encoding:"utf8"})})}else await Br.acquire(i,async function(){await e.rm(i)})}};async function xC({fs:t,gitdir:e,oid:n}){let r=`objects/${n.slice(0,2)}/${n.slice(2)}`;return t.exists(`${e}/${r}`)}async function _C({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i}){let a=await t.readdir(B(n,"objects/pack"));a=a.filter(s=>s.endsWith(".idx"));for(let s of a){let o=`${n}/objects/pack/${s}`,l=await $f({fs:t,cache:e,filename:o,getExternalRefDelta:i});if(l.error)throw new ue(l.error);if(l.offsets.has(r))return!0}return!1}async function g1({fs:t,cache:e,gitdir:n,oid:r,format:i="content"}){let a=o=>Ge({fs:t,cache:e,gitdir:n,oid:o}),s=await xC({fs:t,gitdir:n,oid:r});return s||(s=await _C({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:a})),s}function SC(t){let i="5041434b"+"00000002"+"00000000";return t.slice(0,12).toString("hex")===i}function D1(t,e){let n=t.map(r=>r.split("=",1)[0]);return e.filter(r=>{let i=r.split("=",1)[0];return n.includes(i)})}var Ko={name:"isomorphic-git",version:"1.27.1",agent:"git/[email protected]"},_i=class{constructor(){this._queue=[]}write(e){if(this._ended)throw Error("You cannot write to a FIFO that has already been ended!");if(this._waiting){let n=this._waiting;this._waiting=null,n({value:e})}else this._queue.push(e)}end(){if(this._ended=!0,this._waiting){let e=this._waiting;this._waiting=null,e({done:!0})}}destroy(e){this.error=e,this.end()}async next(){if(this._queue.length>0)return{value:this._queue.shift()};if(this._ended)return{done:!0};if(this._waiting)throw Error("You cannot call read until the previous call to read has returned!");return new Promise(e=>{this._waiting=e})}};function EC(t){let e=t.indexOf("\r"),n=t.indexOf(`
|
||
|
`);return e===-1&&n===-1?-1:e===-1?n+1:n===-1?e+1:n===e+1?n+1:Math.min(e,n)+1}function B1(t){let e=new _i,n="";return(async()=>(await ps(t,r=>{for(r=r.toString("utf8"),n+=r;;){let i=EC(n);if(i===-1)break;e.write(n.slice(0,i)),n=n.slice(i)}}),n.length>0&&e.write(n),e.end()))(),e}var Go=class{static demux(e){let n=Ue.streamReader(e),r=new _i,i=new _i,a=new _i,s=async function(){let o=await n();if(o===null)return s();if(o===!0){r.end(),a.end(),e.error?i.destroy(e.error):i.end();return}switch(o[0]){case 1:{i.write(o.slice(1));break}case 2:{a.write(o.slice(1));break}case 3:{let l=o.slice(1);a.write(l),r.end(),a.end(),i.destroy(new Error(l.toString("utf8")));return}default:r.write(o)}s()};return s(),{packetlines:r,packfile:i,progress:a}}};async function kC(t){let{packetlines:e,packfile:n,progress:r}=Go.demux(t),i=[],a=[],s=[],o=!1,l=!1;return new Promise((c,u)=>{ps(e,f=>{let h=f.toString("utf8").trim();if(h.startsWith("shallow")){let d=h.slice(-41).trim();d.length!==40&&u(new or(d)),i.push(d)}else if(h.startsWith("unshallow")){let d=h.slice(-41).trim();d.length!==40&&u(new or(d)),a.push(d)}else if(h.startsWith("ACK")){let[,d,p]=h.split(" ");s.push({oid:d,status:p}),p||(l=!0)}else h.startsWith("NAK")?(o=!0,l=!0):(l=!0,o=!0);l&&(t.error?u(t.error):c({shallows:i,unshallows:a,acks:s,nak:o,packfile:n,progress:r}))}).finally(()=>{l||(t.error?u(t.error):c({shallows:i,unshallows:a,acks:s,nak:o,packfile:n,progress:r}))})})}function AC({capabilities:t=[],wants:e=[],haves:n=[],shallows:r=[],depth:i=null,since:a=null,exclude:s=[]}){let o=[];e=[...new Set(e)];let l=` ${t.join(" ")}`;for(let c of e)o.push(Ue.encode(`want ${c}${l}
|
||
|
`)),l="";for(let c of r)o.push(Ue.encode(`shallow ${c}
|
||
|
`));i!==null&&o.push(Ue.encode(`deepen ${i}
|
||
|
`)),a!==null&&o.push(Ue.encode(`deepen-since ${Math.floor(a.valueOf()/1e3)}
|
||
|
`));for(let c of s)o.push(Ue.encode(`deepen-not ${c}
|
||
|
`));o.push(Ue.flush());for(let c of n)o.push(Ue.encode(`have ${c}
|
||
|
`));return o.push(Ue.encode(`done
|
||
|
`)),o}async function zf({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:l,ref:c,remoteRef:u,remote:f,url:h,corsProxy:d,depth:p=null,since:g=null,exclude:m=[],relative:w=!1,tags:b=!1,singleBranch:S=!1,headers:k={},prune:x=!1,pruneTags:A=!1}){let y=c||await zr({fs:t,gitdir:l,test:!0}),E=await ze.get({fs:t,gitdir:l}),_=f||y&&await E.get(`branch.${y}.remote`)||"origin",C=h||await E.get(`remote.${_}.url`);if(typeof C=="undefined")throw new Pt("remote OR url");let M=u||y&&await E.get(`branch.${y}.merge`)||c||"HEAD";d===void 0&&(d=await E.get("http.corsProxy"));let L=ji.getRemoteHelperFor({url:C}),N=await L.discover({http:n,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:d,service:"git-upload-pack",url:C,headers:k,protocolVersion:1}),j=N.auth,Y=N.refs;if(Y.size===0)return{defaultBranch:null,fetchHead:null,fetchHeadDescription:null};if(p!==null&&!N.capabilities.has("shallow"))throw new ar("shallow","depth");if(g!==null&&!N.capabilities.has("deepen-since"))throw new ar("deepen-since","since");if(m.length>0&&!N.capabilities.has("deepen-not"))throw new ar("deepen-not","exclude");if(w===!0&&!N.capabilities.has("deepen-relative"))throw new ar("deepen-relative","relative");let{oid:le,fullref:he}=q.resolveAgainstMap({ref:M,map:Y});for(let z of Y.keys())z===he||z==="HEAD"||z.startsWith("refs/heads/")||b&&z.startsWith("refs/tags/")||Y.delete(z);let ie=D1([...N.capabilities],["multi_ack_detailed","no-done","side-band-64k","ofs-delta",`agent=${Ko.agent}`]);w&&ie.push("deepen-relative");let Me=S?[le]:Y.values(),de=S?[y]:await q.listRefs({fs:t,gitdir:l,filepath:"refs"}),$=[];for(let z of de)try{z=await q.expand({fs:t,gitdir:l,ref:z});let nt=await q.resolve({fs:t,gitdir:l,ref:z});await g1({fs:t,cache:e,gitdir:l,oid:nt})&&$.push(nt)}catch(nt){}$=[...new Set($)];let G=await Ur.read({fs:t,gitdir:l}),D=N.capabilities.has("shallow")?[...G]:[],se=AC({capabilities:ie,wants:Me,haves:$,shallows:D,depth:p,since:g,exclude:m}),Se=Buffer.from(await zo(se)),mt=await L.connect({http:n,onProgress:r,corsProxy:d,service:"git-upload-pack",url:C,auth:j,body:[Se],headers:k}),be=await kC(mt.body);mt.headers&&(be.headers=mt.headers);for(let z of be.shallows)if(!G.has(z))try{let{object:nt}=await Ge({fs:t,cache:e,gitdir:l,oid:z}),H=new Rt(nt),Z=await Promise.all(H.headers().parent.map(Ye=>g1({fs:t,cache:e,gitdir:l,oid:Ye})));Z.length===0||Z.every(Ye=>Ye)||G.add(z)}catch(nt){G.add(z)}for(let z of be.unshallows)G.delete(z);if(await Ur.write({fs:t,gitdir:l,oids:G}),S){let z=new Map([[he,le]]),nt=new Map,H=10,Z=he;for(;H--;){let _t=N.symrefs.get(Z);if(_t===void 0)break;nt.set(Z,_t),Z=_t}let ye=Y.get(Z);ye&&z.set(Z,ye);let{pruned:Ye}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:z,symrefs:nt,tags:b,prune:x});x&&(be.pruned=Ye)}else{let{pruned:z}=await q.updateRemoteRefs({fs:t,gitdir:l,remote:_,refs:Y,symrefs:N.symrefs,tags:b,prune:x,pruneTags:A});x&&(be.pruned=z)}if(be.HEAD=N.symrefs.get("HEAD"),be.HEAD===void 0){let{oid:z}=q.resolveAgainstMap({ref:"HEAD",map:Y});for(let[nt,H]of Y.entries())if(nt!=="HEAD"&&H===z){be.HEAD=nt;break}}let st=he.startsWith("refs/tags")?"tag":"branch";if(be.FETCH_HEAD={oid:le,description:`${st} '${Nr(he)}' of ${C}`},r||i){let z=B1(be.progress);ps(z,async nt=>{if(i&&await i(nt),r){let H=nt.match(/([^:]*).*\((\d+?)\/(\d+?)\)/);H&&await r({phase:H[1].trim(),loaded:parseInt(H[2],10),total:parseInt(H[3],10)})}})}let ee=Buffer.from(await zo(be.packfile));if(mt.body.error)throw mt.body.error;let Ie=ee.slice(-20).toString("hex"),Ee={defaultBranch:be.HEAD,fetchHead:be.FETCH_HEAD.oid,fetchHeadDescription:be.FETCH_HEAD.description};if(be.headers&&(Ee.headers=be.headers),x&&(Ee.pruned=be.pruned),Ie!==""&&!SC(ee)){Ee.packfile=`objects/pack/pack-${Ie}.pack`;let z=B(l,Ee.packfile);await t.write(z,ee);let nt=Z=>Ge({fs:t,cache:e,gitdir:l,oid:Z}),H=await Ka.fromPack({pack:ee,getExternalRefDelta:nt,onProgress:r});await t.write(z.replace(/\.pack$/,".idx"),await H.toBuffer())}return Ee}async function N1({fs:t,bare:e=!1,dir:n,gitdir:r=e?n:B(n,".git"),defaultBranch:i="master"}){if(await t.exists(r+"/config"))re
|
||
|
repositoryformatversion = 0
|
||
|
filemode = false
|
||
|
bare = ${e}
|
||
|
`+(e?"":` logallrefupdates = true
|
||
|
`)+` symlinks = false
|
||
|
ignorecase = true
|
||
|
`),await t.write(r+"/HEAD",`ref: refs/heads/${i}
|
||
|
`)}async function TC({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPostCheckout:l,dir:c,gitdir:u,url:f,corsProxy:h,ref:d,remote:p,depth:g,since:m,exclude:w,relative:b,singleBranch:S,noCheckout:k,noTags:x,headers:A}){try{if(await N1({fs:t,gitdir:u}),await R1({fs:t,gitdir:u,remote:p,url:f,force:!1}),h){let _=await ze.get({fs:t,gitdir:u});await _.set("http.corsProxy",h),await ze.save({fs:t,gitdir:u,config:_})}let{defaultBranch:y,fetchHead:E}=await zf({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,gitdir:u,ref:d,remote:p,corsProxy:h,depth:g,since:m,exclude:w,relative:b,singleBranch:S,headers:A,tags:!x});if(E===null)return;d=d||y,d=d.replace("refs/heads/",""),await Uf({fs:t,cache:e,onProgress:r,onPostCheckout:l,dir:c,gitdir:u,ref:d,remote:p,noCheckout:k})}catch(y){throw await t.rmdir(u,{recursive:!0,maxRetries:10}).catch(()=>{}),y}}async function CC({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:c=B(l,".git"),url:u,corsProxy:f=void 0,ref:h=void 0,remote:d="origin",depth:p=void 0,since:g=void 0,exclude:m=[],relative:w=!1,singleBranch:b=!1,noCheckout:S=!1,noTags:k=!1,headers:x={},cache:A={}}){try{return F("fs",t),F("http",e),F("gitdir",c),S||F("dir",l),F("url",u),await TC({fs:new Q(t),cache:A,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPostCheckout:o,dir:l,gitdir:c,url:u,corsProxy:f,ref:h,remote:d,depth:p,since:g,exclude:m,relative:w,singleBranch:b,noCheckout:S,noTags:k,headers:x})}catch(y){throw y.caller="git.clone",y}}async function FC({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),message:i,author:a,committer:s,signingKey:o,amend:l=!1,dryRun:c=!1,noUpdateBranch:u=!1,ref:f,parent:h,tree:d,cache:p={}}){try{F("fs",t),l||F("message",i),o&&F("onSign",e);let g=new Q(t);return await Zo({fs:g,cache:p,onSign:e,gitdir:r,message:i,author:a,committer:s,signingKey:o,amend:l,dryRun:c,noUpdateBranch:u,ref:f,parent:h,tree:d})}catch(g){throw g.caller="git.commit",g}}async function MC({fs:t,dir:e,gitdir:n=B(e,".git"),fullname:r=!1,test:i=!1}){try{return F("fs",t),F("gitdir",n),await zr({fs:new Q(t),gitdir:n,fullname:r,test:i})}catch(a){throw a.caller="git.currentBranch",a}}async function OC({fs:t,gitdir:e,ref:n}){if(n=n.startsWith("refs/heads/")?n:`refs/heads/${n}`,!await q.exists({fs:t,gitdir:e,ref:n}))throw new Re(n);let i=await q.expand({fs:t,gitdir:e,ref:n}),a=await zr({fs:t,gitdir:e,fullname:!0});if(i===a){let l=await q.resolve({fs:t,gitdir:e,ref:i});await q.writeRef({fs:t,gitdir:e,ref:"HEAD",value:l})}await q.deleteRef({fs:t,gitdir:e,ref:i});let s=Nr(n),o=await ze.get({fs:t,gitdir:e});await o.deleteSection("branch",s),await ze.save({fs:t,gitdir:e,config:o})}async function PC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{return F("fs",t),F("ref",r),await OC({fs:new Q(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.deleteBranch",i}}async function IC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{F("fs",t),F("ref",r),await q.deleteRef({fs:new Q(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.deleteRef",i}}async function RC({fs:t,gitdir:e,remote:n}){let r=await ze.get({fs:t,gitdir:e});await r.deleteSection("remote",n),await ze.save({fs:t,gitdir:e,config:r})}async function LC({fs:t,dir:e,gitdir:n=B(e,".git"),remote:r}){try{return F("fs",t),F("remote",r),await RC({fs:new Q(t),gitdir:n,remote:r})}catch(i){throw i.caller="git.deleteRemote",i}}async function jC({fs:t,gitdir:e,ref:n}){n=n.startsWith("refs/tags/")?n:`refs/tags/${n}`,await q.deleteRef({fs:t,gitdir:e,ref:n})}async function DC({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r}){try{return F("fs",t),F("ref",r),await jC({fs:new Q(t),gitdir:n,ref:r})}catch(i){throw i.caller="git.deleteTag",i}}async function BC({fs:t,gitdir:e,oid:n}){let r=n.slice(0,2);return(await t.readdir(`${e}/objects/${r}`)).map(a=>`${r}${a}`).filter(a=>a.startsWith(n))}async function NC({fs:t,cache:e,gitdir:n,oid:r,getExternalRefDelta:i}){let a=[],s=await t.readdir(B(n,"objects/pack"));s=s.filter(o=>o.endsWith(".idx"));for(let o of s){let l=`${n}/objects/pac
|
||
|
`,h+=p.conflict.a.join(""),h+=`${"=".repeat(f)}
|
||
|
`,h+=p.conflict.b.join(""),h+=`${">".repeat(f)} ${r}
|
||
|
`);return{cleanMerge:d,mergedText:h}}async function GC({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),index:i,ourOid:a,baseOid:s,theirOid:o,ourName:l="ours",baseName:c="base",theirName:u="theirs",dryRun:f=!1,abortOnConflict:h=!0,mergeDriver:d}){let p=sr({ref:a}),g=sr({ref:s}),m=sr({ref:o}),w=[],b=[],S=[],k=[],x=await Pi({fs:t,cache:e,dir:n,gitdir:r,trees:[p,g,m],map:async function(A,[y,E,_]){let C=jo(A),M=await Ho(y,E),L=await Ho(_,E);switch(`${M}-${L}`){case"false-false":return{mode:await E.mode(),path:C,oid:await E.oid(),type:await E.type()};case"false-true":return _?{mode:await _.mode(),path:C,oid:await _.oid(),type:await _.type()}:void 0;case"true-false":return y?{mode:await y.mode(),path:C,oid:await y.oid(),type:await y.type()}:void 0;case"true-true":{if(y&&E&&_&&await y.type()==="blob"&&await E.type()==="blob"&&await _.type()==="blob")return VC({fs:t,gitdir:r,path:C,ours:y,base:E,theirs:_,ourName:l,baseName:c,theirName:u,mergeDriver:d}).then(async N=>{if(N.cleanMerge)h||i.insert({filepath:A,oid:N.mergeResult.oid,stage:0});else if(w.push(A),b.push(A),!h){let j=await E.oid(),Y=await y.oid(),le=await _.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:j,stage:1}),i.insert({filepath:A,oid:Y,stage:2}),i.insert({filepath:A,oid:le,stage:3})}return N.mergeResult});if(E&&!y&&_&&await E.type()==="blob"&&await _.type()==="blob"){if(w.push(A),S.push(A),!h){let N=await E.oid(),j=await _.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:N,stage:1}),i.insert({filepath:A,oid:j,stage:3})}return{mode:await _.mode(),oid:await _.oid(),type:"blob",path:C}}if(E&&y&&!_&&await E.type()==="blob"&&await y.type()==="blob"){if(w.push(A),k.push(A),!h){let N=await E.oid(),j=await y.oid();i.delete({filepath:A}),i.insert({filepath:A,oid:N,stage:1}),i.insert({filepath:A,oid:j,stage:2})}return{mode:await y.mode(),oid:await y.oid(),type:"blob",path:C}}if(E&&!y&&!_&&await E.type()==="blob")return;throw new Ti}}},reduce:w.length!==0&&(!n||h)?void 0:async(A,y)=>{let E=y.filter(Boolean);if(A&&!(A&&A.type==="tree"&&E.length===0)){if(E.length>0){let C=new It(E).toObject(),M=await zt({fs:t,gitdir:r,type:"tree",object:C,dryRun:f});A.oid=M}return A}}});return w.length!==0?(n&&!h&&await Pi({fs:t,cache:e,dir:n,gitdir:r,trees:[sr({ref:x.oid})],map:async function(A,[y]){let E=`${n}/${A}`;if(await y.type()==="blob"){let _=await y.mode(),C=new TextDecoder().decode(await y.content());await t.write(E,C,{mode:_})}return!0}}),new Ci(w,b,S,k)):x.oid}async function VC({fs:t,gitdir:e,path:n,ours:r,base:i,theirs:a,ourName:s,theirName:o,baseName:l,dryRun:c,mergeDriver:u=zC}){let f="blob",h=await i.mode()===await r.mode()?await a.mode():await r.mode();if(await r.oid()===await a.oid())return{cleanMerge:!0,mergeResult:{mode:h,path:n,oid:await r.oid(),type:f}};if(await r.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:h,path:n,oid:await a.oid(),type:f}};if(await a.oid()===await i.oid())return{cleanMerge:!0,mergeResult:{mode:h,path:n,oid:await r.oid(),type:f}};let d=Buffer.from(await r.content()).toString("utf8"),p=Buffer.from(await i.content()).toString("utf8"),g=Buffer.from(await a.content()).toString("utf8"),{mergedText:m,cleanMerge:w}=await u({branches:[l,s,o],contents:[p,d,g],path:n}),b=await zt({fs:t,gitdir:e,type:"blob",object:Buffer.from(m,"utf8"),dryRun:c});return{cleanMerge:w,mergeResult:{mode:h,path:n,oid:b,type:f}}}async function $1({fs:t,cache:e,dir:n,gitdir:r,ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:h,committer:d,signingKey:p,onSign:g,mergeDriver:m}){i===void 0&&(i=await zr({fs:t,gitdir:r,fullname:!0})),i=await q.expand({fs:t,gitdir:r,ref:i}),a=await q.expand({fs:t,gitdir:r,ref:a});let w=await q.resolve({fs:t,gitdir:r,ref:i}),b=await q.resolve({fs:t,gitdir:r,ref:a}),S=await Gf({fs:t,cache:e,gitdir:r,oids:[w,b]});if(S.length!==1)throw new Ti;let k=S[0];if(k===b)return{oid:w,alreadyMerged:!0};if(s&&k===w)return!l&&!c&&await q.writeRef({fs:t,gitdir:r,ref:i,value:b}),{oid:b,fastForward:!0};{if(o)throw new ns;let x=await lt.acquire({fs:t,gitdir:r,cache:e,allowUnmerged:!1}
|
||
|
`)),r.push(Ue.encode(`agent=${Ko.agent}
|
||
|
`)),(n||e||t)&&r.push(Ue.delim()),n&&r.push(Ue.encode("peel")),e&&r.push(Ue.encode("symrefs")),t&&r.push(Ue.encode(`ref-prefix ${t}`)),r.push(Ue.flush()),r}async function y8({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,url:a,headers:s={},forPush:o=!1,protocolVersion:l=2,prefix:c,symrefs:u,peelTags:f}){try{F("http",t),F("url",a);let h=await Li.discover({http:t,onAuth:e,onAuthSuccess:n,onAuthFailure:r,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,headers:s,protocolVersion:l});if(h.protocolVersion===1)return z1(h,c,u,f);let d=await g8({prefix:c,symrefs:u,peelTags:f}),p=await Li.connect({http:t,auth:h.auth,headers:s,corsProxy:i,service:o?"git-receive-pack":"git-upload-pack",url:a,body:d});return m8(p.body)}catch(h){throw h.caller="git.listServerRefs",h}}async function v8({fs:t,dir:e,gitdir:n=B(e,".git")}){try{return F("fs",t),F("gitdir",n),q.listTags({fs:new Q(t),gitdir:n})}catch(r){throw r.caller="git.listTags",r}}function w8(t,e){return t.committer.timestamp-e.committer.timestamp}var b8="e69de29bb2d1d6434b8b29ae775ad8c2e48c5391";async function y1({fs:t,cache:e,gitdir:n,oid:r,fileId:i}){if(i===b8)return;let a=r,s,o=await Oi({fs:t,cache:e,gitdir:n,oid:r}),l=o.tree;return i===o.oid?s=o.path:(s=await W1({fs:t,cache:e,gitdir:n,tree:l,fileId:i,oid:a}),Array.isArray(s)&&(s.length===0?s=void 0:s.length===1&&(s=s[0]))),s}async function W1({fs:t,cache:e,gitdir:n,tree:r,fileId:i,oid:a,filepaths:s=[],parentPath:o=""}){let l=r.entries().map(function(c){let u;return c.oid===i?(u=B(o,c.path),s.push(u)):c.type==="tree"&&(u=Ge({fs:t,cache:e,gitdir:n,oid:c.oid}).then(function({object:f}){return W1({fs:t,cache:e,gitdir:n,tree:It.from(f),fileId:i,oid:a,filepaths:s,parentPath:B(o,c.path)})})),u});return await Promise.all(l),s}async function x8({fs:t,cache:e,gitdir:n,filepath:r,ref:i,depth:a,since:s,force:o,follow:l}){let c=typeof s=="undefined"?void 0:Math.floor(s.valueOf()/1e3),u=[],f=await Ur.read({fs:t,gitdir:n}),h=await q.resolve({fs:t,gitdir:n,ref:i}),d=[await Uo({fs:t,cache:e,gitdir:n,oid:h})],p,g,m;function w(b){m&&r&&u.push(b)}for(;d.length>0;){let b=d.pop();if(c!==void 0&&b.commit.committer.timestamp<=c)break;if(r){let S;try{S=await ds({fs:t,cache:e,gitdir:n,oid:b.commit.tree,filepath:r}),g&&p!==S&&u.push(g),p=S,g=b,m=!0}catch(k){if(k instanceof Re){let x=l&&p;if(x&&(x=await y1({fs:t,cache:e,gitdir:n,oid:b.commit.tree,fileId:p}),x))if(Array.isArray(x)){if(g){let A=await y1({fs:t,cache:e,gitdir:n,oid:g.commit.tree,fileId:p});if(Array.isArray(A))if(x=x.filter(y=>A.indexOf(y)===-1),x.length===1)x=x[0],r=x,g&&u.push(g);else{x=!1,g&&u.push(g);break}}}else r=x,g&&u.push(g);if(!x){if(m&&p&&(u.push(g),!o))break;if(!o&&!l)throw k}g=b,m=!1}else throw k}}else u.push(b);if(a!==void 0&&u.length===a){w(b);break}if(!f.has(b.oid))for(let S of b.commit.parent){let k=await Uo({fs:t,cache:e,gitdir:n,oid:S});d.map(x=>x.oid).includes(k.oid)||d.push(k)}d.length===0&&w(b),d.sort((S,k)=>w8(S.commit,k.commit))}return u}async function _8({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,ref:i="HEAD",depth:a,since:s,force:o,follow:l,cache:c={}}){try{return F("fs",t),F("gitdir",n),F("ref",i),await x8({fs:new Q(t),cache:c,gitdir:n,filepath:r,ref:i,depth:a,since:s,force:o,follow:l})}catch(u){throw u.caller="git.log",u}}async function S8({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ours:i,theirs:a,fastForward:s=!0,fastForwardOnly:o=!1,dryRun:l=!1,noUpdateBranch:c=!1,abortOnConflict:u=!0,message:f,author:h,committer:d,signingKey:p,cache:g={},mergeDriver:m}){try{F("fs",t),p&&F("onSign",e);let w=new Q(t),b=await Hr({fs:w,gitdir:r,author:h});if(!b&&(!o||!s))throw new At("author");let S=await Ri({fs:w,gitdir:r,author:b,committer:d});if(!S&&(!o||!s))throw new At("committer");return await $1({fs:w,cache:g,dir:n,gitdir:r,ours:i,theirs:a,fastForward:s,fastForwardOnly:o,dryRun:l,noUpdateBranch:c,abortOnConflict:u,message:f,author:b,committer:S,signingKey:p,onSign:e,mergeDriver:m})}catch(w){throw w.caller="git.merge",w}}var E8={commit:16,tree:32,blob:48,tag:64,ofs_delta:96,ref_delta:112};async function q1({fs:t,cache:e,dir:n,gitdir:r=B(n,".git"),oid
|
||
|
`),i=await r();let a=n.toString("utf8").split(`
|
||
|
`);if(i=a.shift(),!i.startsWith("unpack "))throw new $r('unpack ok" or "unpack [error message]',i);e.ok=i==="unpack ok",e.ok||(e.error=i.slice(7)),e.refs={};for(let s of a){if(s.trim()==="")continue;let o=s.slice(0,2),l=s.slice(3),c=l.indexOf(" ");c===-1&&(c=l.length);let u=l.slice(0,c),f=l.slice(c+1);e.refs[u]={ok:o==="ok",error:f}}return e}async function M8({capabilities:t=[],triplets:e=[]}){let n=[],r=`\0 ${t.join(" ")}`;for(let i of e)n.push(Ue.encode(`${i.oldoid} ${i.oid} ${i.fullRef}${r}
|
||
|
`)),r="";return n.push(Ue.flush()),n}async function O8({fs:t,cache:e,http:n,onProgress:r,onMessage:i,onAuth:a,onAuthSuccess:s,onAuthFailure:o,onPrePush:l,gitdir:c,ref:u,remoteRef:f,remote:h,url:d,force:p=!1,delete:g=!1,corsProxy:m,headers:w={}}){let b=u||await zr({fs:t,gitdir:c});if(typeof b=="undefined")throw new Pt("ref");let S=await ze.get({fs:t,gitdir:c});h=h||await S.get(`branch.${b}.pushRemote`)||await S.get("remote.pushDefault")||await S.get(`branch.${b}.remote`)||"origin";let k=d||await S.get(`remote.${h}.pushurl`)||await S.get(`remote.${h}.url`);if(typeof k=="undefined")throw new Pt("remote OR url");let x=f||await S.get(`branch.${b}.merge`);if(typeof k=="undefined")throw new Pt("remoteRef");m===void 0&&(m=await S.get("http.corsProxy"));let A=await q.expand({fs:t,gitdir:c,ref:b}),y=g?"0000000000000000000000000000000000000000":await q.resolve({fs:t,gitdir:c,ref:A}),E=ji.getRemoteHelperFor({url:k}),_=await E.discover({http:n,onAuth:a,onAuthSuccess:s,onAuthFailure:o,corsProxy:m,service:"git-receive-pack",url:k,headers:w,protocolVersion:1}),C=_.auth,M;if(!x)M=A;else try{M=await q.expandAgainstMap({ref:x,map:_.refs})}catch(G){if(G instanceof Re)M=x.startsWith("refs/")?x:`refs/heads/${x}`;else throw G}let L=_.refs.get(M)||"0000000000000000000000000000000000000000";if(l&&!await l({remote:h,url:k,localRef:{ref:g?"(delete)":A,oid:y},remoteRef:{ref:M,oid:L}}))throw new Mi;let N=!_.capabilities.has("no-thin"),j=new Set;if(!g){let G=[..._.refs.values()],D=new Set;if(L!=="0000000000000000000000000000000000000000"){let se=await Gf({fs:t,cache:e,gitdir:c,oids:[y,L]});for(let Se of se)G.push(Se);N&&(D=await Af({fs:t,cache:e,gitdir:c,oids:se}))}if(!G.includes(y)){let se=await C8({fs:t,cache:e,gitdir:c,start:[y],finish:G});j=await Af({fs:t,cache:e,gitdir:c,oids:se})}if(N){try{let se=await q.resolve({fs:t,gitdir:c,ref:`refs/remotes/${h}/HEAD`,depth:2}),{oid:Se}=await q.resolveAgainstMap({ref:se.replace(`refs/remotes/${h}/`,""),fullref:se,map:_.refs}),mt=[Se];for(let be of await Af({fs:t,cache:e,gitdir:c,oids:mt}))D.add(be)}catch(se){}for(let se of D)j.delete(se)}if(y===L&&(p=!0),!p){if(A.startsWith("refs/tags")&&L!=="0000000000000000000000000000000000000000")throw new Fi("tag-exists");if(y!=="0000000000000000000000000000000000000000"&&L!=="0000000000000000000000000000000000000000"&&!await G1({fs:t,cache:e,gitdir:c,oid:y,ancestor:L,depth:-1}))throw new Fi("not-fast-forward")}}let Y=D1([..._.capabilities],["report-status","side-band-64k",`agent=${Ko.agent}`]),le=await M8({capabilities:Y,triplets:[{oldoid:L,oid:y,fullRef:M}]}),he=g?[]:await q1({fs:t,cache:e,gitdir:c,oids:[...j]}),ie=await E.connect({http:n,onProgress:r,corsProxy:m,service:"git-receive-pack",url:k,auth:C,headers:w,body:[...le,...he]}),{packfile:Me,progress:de}=await Go.demux(ie.body);if(i){let G=B1(de);ps(G,async D=>{await i(D)})}let $=await F8(Me);if(ie.headers&&($.headers=ie.headers),h&&$.ok&&$.refs[M].ok&&!A.startsWith("refs/tags")){let G=`refs/remotes/${h}/${M.replace("refs/heads","")}`;g?await q.deleteRef({fs:t,gitdir:c,ref:G}):await q.writeRef({fs:t,gitdir:c,ref:G,value:y})}if($.ok&&Object.values($.refs).every(G=>G.ok))return $;{let G=Object.entries($.refs).filter(([D,se])=>!se.ok).map(([D,se])=>`
|
||
|
- ${D}: ${se.error}`).join("");throw new rs(G,$)}}async function P8({fs:t,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,dir:l,gitdir:c=B(l,".git"),ref:u,remoteRef:f,remote:h="origin",url:d,force:p=!1,delete:g=!1,corsProxy:m,headers:w={},cache:b={}}){try{return F("fs",t),F("http",e),F("gitdir",c),await O8({fs:new Q(t),cache:b,http:e,onProgress:n,onMessage:r,onAuth:i,onAuthSuccess:a,onAuthFailure:s,onPrePush:o,gitdir:c,ref:u,remoteRef:f,remote:h,url:d,force:p,delete:g,corsProxy:m,headers:w})}catch(S){throw S.caller="git.push",S}}async function X1({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:a}=await Ge({fs:t,cache:e,gitdir:n,oid:r});if(i==="tag")return r=Ut.from(a).parse().object,X1({fs:t,cache:e,gitdir:n,oid:r});if(i!=="blob")throw new kt(r,i,"blob");return{oid:r,blob:new Uint8Array(a)}}async function Y1({fs:t,cache:e,gitdir:n,oid:r,filepath:i=void 0}){return i!==void 0&&(r=await ds({fs:t,cache:e,gitdir:n,oid:r,filepath:i})),await X1({fs:t,cache:e,gitdir:n,oid:r})}async function ms({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,filepath:i,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await Y1({fs:new Q(t),cache:a,gitdir:n,oid:r,filepath:i})}catch(s){throw s.caller="git.readBlob",s}}async function I8({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await Uo({fs:new Q(t),cache:i,gitdir:n,oid:r})}catch(a){throw a.caller="git.readCommit",a}}async function R8({fs:t,cache:e,gitdir:n,ref:r="refs/notes/commits",oid:i}){let a=await q.resolve({gitdir:n,fs:t,ref:r}),{blob:s}=await Y1({fs:t,cache:e,gitdir:n,oid:a,filepath:i});return s}async function L8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r="refs/notes/commits",oid:i,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("ref",r),F("oid",i),await R8({fs:new Q(t),cache:a,gitdir:n,ref:r,oid:i})}catch(s){throw s.caller="git.readNote",s}}async function j8({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,format:i="parsed",filepath:a=void 0,encoding:s=void 0,cache:o={}}){try{F("fs",t),F("gitdir",n),F("oid",r);let l=new Q(t);a!==void 0&&(r=await ds({fs:l,cache:o,gitdir:n,oid:r,filepath:a}));let u=await Ge({fs:l,cache:o,gitdir:n,oid:r,format:i==="parsed"?"content":i});if(u.oid=r,i==="parsed")switch(u.format="parsed",u.type){case"commit":u.object=Rt.from(u.object).parse();break;case"tree":u.object=It.from(u.object).entries();break;case"blob":s?u.object=u.object.toString(s):(u.object=new Uint8Array(u.object),u.format="content");break;case"tag":u.object=Ut.from(u.object).parse();break;default:throw new kt(u.oid,u.type,"blob|commit|tag|tree")}else(u.format==="deflated"||u.format==="wrapped")&&(u.type=u.format);return u}catch(l){throw l.caller="git.readObject",l}}async function D8({fs:t,cache:e,gitdir:n,oid:r}){let{type:i,object:a}=await Ge({fs:t,cache:e,gitdir:n,oid:r,format:"content"});if(i!=="tag")throw new kt(r,i,"tag");let s=Ut.from(a);return{oid:r,tag:s.parse(),payload:s.payload()}}async function B8({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,cache:i={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await D8({fs:new Q(t),cache:i,gitdir:n,oid:r})}catch(a){throw a.caller="git.readTag",a}}async function N8({fs:t,dir:e,gitdir:n=B(e,".git"),oid:r,filepath:i=void 0,cache:a={}}){try{return F("fs",t),F("gitdir",n),F("oid",r),await Di({fs:new Q(t),cache:a,gitdir:n,oid:r,filepath:i})}catch(s){throw s.caller="git.readTree",s}}async function $8({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,cache:i={}}){try{F("fs",t),F("gitdir",n),F("filepath",r),await lt.acquire({fs:new Q(t),gitdir:n,cache:i},async function(a){a.delete({filepath:r})})}catch(a){throw a.caller="git.remove",a}}async function H8({fs:t,cache:e,onSign:n,gitdir:r,ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l}){let c;try{c=await q.resolve({gitdir:r,fs:t,ref:i})}catch(p){if(!(p instanceof Re))throw p}let f=(await Di({fs:t,gitdir:r,oid:c||"4b825dc642cb6eb9a060e54bf8d69288fbee4904"})).tree;f=f.filter(p=>p.path!==a);let h=await Hf({fs:t,gitdir:r,tree:f});return await Zo({fs:t,cache:e,onSign:n,gitdir:r,ref:i,tree:h,parent:c&&[c],message:`Note removed
|
||
|
`,author:s,committer:o,signingKey:l})}async function U8({fs:t,onSign:e,dir:n,gitdir:r=B(n,".git"),ref:i="refs/notes/commits",oid:a,author:s,committer:o,signingKey:l,cache:c={}}){try{F("fs",t),F("gitdir",r),F("oid",a);let u=new Q(t),f=await Hr({fs:u,gitdir:r,author:s});if(!f)throw new At("author");let h=await Ri({fs:u,gitdir:r,author:f,committer:o});if(!h)throw new At("committer");return await H8({fs:u,cache:c,onSign:e,gitdir:r,ref:i,oid:a,author:f,committer:h,signingKey:l})}catch(u){throw u.caller="git.removeNote",u}}async function z8({fs:t,gitdir:e,oldref:n,ref:r,checkout:i=!1}){if(r!==fn.default.clean(r))throw new zn(r,fn.default.clean(r));if(n!==fn.default.clean(n))throw new zn(n,fn.default.clean(n));let a=`refs/heads/${n}`,s=`refs/heads/${r}`;if(await q.exists({fs:t,gitdir:e,ref:s}))throw new hn("branch",r,!1);let l=await q.resolve({fs:t,gitdir:e,ref:a,depth:1});await q.writeRef({fs:t,gitdir:e,ref:s,value:l}),await q.deleteRef({fs:t,gitdir:e,ref:a});let u=await zr({fs:t,gitdir:e,fullname:!0})===a;(i||u)&&await q.writeSymbolicRef({fs:t,gitdir:e,ref:"HEAD",value:s})}async function G8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,oldref:i,checkout:a=!1}){try{return F("fs",t),F("gitdir",n),F("ref",r),F("oldref",i),await z8({fs:new Q(t),gitdir:n,ref:r,oldref:i,checkout:a})}catch(s){throw s.caller="git.renameBranch",s}}async function Z1({gitdir:t,type:e,object:n}){return Un(lr.wrap({type:e,object:n}))}async function V8({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,ref:i,cache:a={}}){try{F("fs",t),F("gitdir",n),F("filepath",r);let s=new Q(t),o,l;try{o=await q.resolve({fs:s,gitdir:n,ref:i||"HEAD"})}catch(f){if(i)throw f}if(o)try{o=await ds({fs:s,cache:a,gitdir:n,oid:o,filepath:r})}catch(f){o=null}let c={ctime:new Date(0),mtime:new Date(0),dev:0,ino:0,mode:0,uid:0,gid:0,size:0},u=e&&await s.read(B(e,r));u&&(l=await Z1({gitdir:n,type:"blob",object:u}),o===l&&(c=await s.lstat(B(e,r)))),await lt.acquire({fs:s,gitdir:n,cache:a},async function(f){f.delete({filepath:r}),o&&f.insert({filepath:r,stats:c,oid:o})})}catch(s){throw s.caller="git.reset",s}}async function W8({fs:t,dir:e,gitdir:n=B(e,".git"),ref:r,depth:i}){try{return F("fs",t),F("gitdir",n),F("ref",r),await q.resolve({fs:new Q(t),gitdir:n,ref:r,depth:i})}catch(a){throw a.caller="git.resolveRef",a}}async function q8({fs:t,dir:e,gitdir:n=B(e,".git"),path:r,value:i,append:a=!1}){try{F("fs",t),F("gitdir",n),F("path",r);let s=new Q(t),o=await ze.get({fs:s,gitdir:n});a?await o.append(r,i):await o.set(r,i),await ze.save({fs:s,gitdir:n,config:o})}catch(s){throw s.caller="git.setConfig",s}}async function X8({fs:t,dir:e,gitdir:n=B(e,".git"),filepath:r,cache:i={}}){try{F("fs",t),F("gitdir",n),F("filepath",r);let a=new Q(t);if(await Ii.isIgnored({fs:a,gitdir:n,dir:e,filepath:r}))return"ignored";let o=await Y8({fs:a,cache:i,gitdir:n}),l=await K1({fs:a,cache:i,gitdir:n,tree:o,path:r}),c=await lt.acquire({fs:a,gitdir:n,cache:i},async function(g){for(let m of g)if(m.path===r)return m;return null}),u=await a.lstat(B(e,r)),f=l!==null,h=c!==null,d=u!==null,p=async()=>{if(h&&!Lo(c,u))return c.oid;{let g=await a.read(B(e,r)),m=await Z1({gitdir:n,type:"blob",object:g});return h&&c.oid===m&&u.size!==-1&<.acquire({fs:a,gitdir:n,cache:i},async function(w){w.insert({filepath:r,stats:u,oid:m})}),m}};if(!f&&!d&&!h)return"absent";if(!f&&!d&&h)return"*absent";if(!f&&d&&!h)return"*added";if(!f&&d&&h)return await p()===c.oid?"added":"*added";if(f&&!d&&!h)return"deleted";if(f&&!d&&h)return l===c.oid,"*deleted";if(f&&d&&!h)return await p()===l?"*undeleted":"*undeletemodified";if(f&&d&&h){let g=await p();return g===l?g===c.oid?"unmodified":"*unmodified":g===c.oid?"modified":"*modified"}}catch(a){throw a.caller="git.status",a}}async function K1({fs:t,cache:e,gitdir:n,tree:r,path:i}){typeof i=="string"&&(i=i.split("/"));let a=i.shift();for(let s of r)if(s.path===a){if(i.length===0)return s.oid;let{type:o,object:l}=await Ge({fs:t,cache:e,gitdir:n,oid:s.oid});if(o==="tree"){let c=It.from(l);return K1({fs:t,cache:e,gitdir:n,tree:c,path:i})}if(o==="blob")throw new kt(s.oid,o,"blob",i.join("/"))}return null}async functi
|
||
|
`){return t.split(n).reduce((r,i)=>{let a=e?i.trim():i;return a&&r.push(a),r},[])}function dh(t,e){return Es(t,!0).map(n=>e(n))}function ph(t){return(0,pl.exists)(t,pl.FOLDER)}function we(t,e){return Array.isArray(t)?t.includes(e)||t.push(e):t.add(e),e}function Vy(t,e){return Array.isArray(t)&&!t.includes(e)&&t.push(e),t}function ml(t,e){if(Array.isArray(t)){let n=t.indexOf(e);n>=0&&t.splice(n,1)}else t.delete(e);return e}function Cn(t){return Array.isArray(t)?t:[t]}function Wy(t){return t.replace(/[\s-]+(.)/g,(e,n)=>n.toUpperCase())}function qy(t){return Cn(t).map(String)}function Pe(t,e=0){if(t==null)return e;let n=parseInt(t,10);return isNaN(n)?e:n}function ws(t,e){let n=[];for(let r=0,i=t.length;r<i;r++)n.push(e,t[r]);return n}function bs(t){return(Array.isArray(t)?Buffer.concat(t):t).toString("utf-8")}function Xy(t,e){return Object.assign({},...e.map(n=>n in t?{[n]:t[n]}:{}))}function Qf(t=0){return new Promise(e=>setTimeout(e,t))}function eh(t){if(t!==!1)return t}var zi,Xr,ks,gl=W({"src/lib/utils/util.ts"(){"use strict";zi="\0",Xr=()=>{},ks=Object.prototype.toString.call.bind(Object.prototype.toString)}});function Fn(t,e,n){return e(t)?t:arguments.length>2?n:void 0}function mh(t,e){let n=ll(t)?"string":typeof t;return/number|string|boolean/.test(n)&&(!e||!e.includes(n))}function gh(t){return!!t&&ks(t)==="[object Object]"}function Yy(t){return typeof t=="function"}var As,gt,Zy,cl,yh,Ky=W({"src/lib/utils/argument-filters.ts"(){"use strict";gl(),_s(),As=t=>Array.isArray(t),gt=t=>typeof t=="string",Zy=t=>Array.isArray(t)&&t.every(gt),cl=t=>gt(t)||Array.isArray(t)&&t.every(gt),yh=t=>t==null||"number|boolean|function".includes(typeof t)?!1:Array.isArray(t)||typeof t=="string"||typeof t.length=="number"}}),th,L6=W({"src/lib/utils/exit-codes.ts"(){"use strict";th=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.NOT_FOUND=-2]="NOT_FOUND",t[t.UNCLEAN=128]="UNCLEAN",t))(th||{})}}),xs,j6=W({"src/lib/utils/git-output-streams.ts"(){"use strict";xs=class{constructor(t,e){this.stdOut=t,this.stdErr=e}asStrings(){return new xs(this.stdOut.toString("utf8"),this.stdErr.toString("utf8"))}}}}),fe,ur,D6=W({"src/lib/utils/line-parser.ts"(){"use strict";fe=class{constructor(t,e){this.matches=[],this.parse=(n,r)=>(this.resetMatches(),this._regExp.every((i,a)=>this.addMatch(i,a,n(a)))?this.useMatches(r,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(t)?t:[t],e&&(this.useMatches=e)}useMatches(t,e){throw new Error("LineParser:useMatches not implemented")}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(t,e,n){let r=n&&t.exec(n);return r&&this.pushMatch(e,r),!!r}pushMatch(t,e){this.matches.push(...e.slice(1))}},ur=class extends fe{addMatch(t,e,n){return/^remote:\s/.test(String(n))&&super.addMatch(t,e,n)}pushMatch(t,e){(t>0||e.length>1)&&super.pushMatch(t,e)}}}});function Jy(...t){let e=process.cwd(),n=Object.assign(tn({baseDir:e},Qy),...t.filter(r=>typeof r=="object"&&r));return n.baseDir=n.baseDir||e,n.trimmed=n.trimmed===!0,n}var Qy,B6=W({"src/lib/utils/simple-git-options.ts"(){"use strict";Qy={binary:"git",maxConcurrentProcesses:5,config:[],trimmed:!1}}});function vh(t,e=[]){return gh(t)?Object.keys(t).reduce((n,r)=>{let i=t[r];return ll(i)?n.push(i):mh(i,["boolean"])?n.push(r+"="+i):n.push(r),n},e):e}function Lt(t,e=0,n=!1){let r=[];for(let i=0,a=e<0?t.length:e;i<a;i++)"string|number".includes(typeof t[i])&&r.push(String(t[i]));return vh(wh(t),r),n||r.push(...N6(t)),r}function N6(t){let e=typeof qr(t)=="function";return Fn(qr(t,e?1:0),As,[])}function wh(t){let e=Yy(qr(t));return Fn(qr(t,e?1:0),gh)}function qe(t,e=!0){let n=$y(qr(t));return e||Hy(n)?n:void 0}var $6=W({"src/lib/utils/task-options.ts"(){"use strict";Ky(),gl(),_s()}});function nh(t,e){return t(e.stdOut,e.stdErr)}function Dt(t,e,n,r=!0){return Cn(n).forEach(i=>{for(let a=Es(i,r),s=0,o=a.length;s<o;s++){let l=(c=0)=>{if(!(s+c>=o))return a[s+c]};e.some(({parse:c})=>c(l,t))}}),t}var H6=W({"src/lib/utils/task-parser.ts"(){"use strict";gl()}}),ev={};Qe(ev,{ExitCodes:()=>th,GitOutputStreams:()=>xs,LineParser:()=>fe,NOOP:()=>Xr,NULL:(
|
||
|
`)){let l=Uy(s,`
|
||
|
`);o=l[0],s=l[1]}yield{file:a,key:o,value:s}}}var yv,t4=W({"src/lib/responses/ConfigList.ts"(){"use strict";oe(),yv=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||(this._all=this.files.reduce((t,e)=>Object.assign(t,this.values[e]),{})),this._all}addFile(t){if(!(t in this.values)){let e=qr(this.files);this.values[t]=e?Object.create(this.values[e]):{},this.files.push(t)}return this.values[t]}addValue(t,e,n){let r=this.addFile(t);r.hasOwnProperty(e)?Array.isArray(r[e])?r[e].push(n):r[e]=[r[e],n]:r[e]=n,this._all=void 0}}}});function qf(t,e){return typeof t=="string"&&ah.hasOwnProperty(t)?t:e}function n4(t,e,n,r){let i=["config",`--${r}`];return n&&i.push("--add"),i.push(t,e),{commands:i,format:"utf-8",parser(a){return a}}}function r4(t,e){let n=["config","--null","--show-origin","--get-all",t];return e&&n.splice(1,0,`--${e}`),{commands:n,format:"utf-8",parser(r){return Q6(r,t)}}}function i4(t){let e=["config","--list","--show-origin","--null"];return t&&e.push(`--${t}`),{commands:e,format:"utf-8",parser(n){return J6(n)}}}function a4(){return{addConfig(t,e,...n){return this._runTask(n4(t,e,n[0]===!0,qf(n[1],"local")),qe(arguments))},getConfig(t,e){return this._runTask(r4(t,qf(e,void 0)),qe(arguments))},listConfig(...t){return this._runTask(i4(qf(t[0],void 0)),qe(arguments))}}}var ah,vv=W({"src/lib/tasks/config.ts"(){"use strict";t4(),oe(),ah=(t=>(t.system="system",t.global="global",t.local="local",t.worktree="worktree",t))(ah||{})}});function s4(t){return wv.has(t)}var Xf,wv,bv=W({"src/lib/tasks/diff-name-status.ts"(){"use strict";Xf=(t=>(t.ADDED="A",t.COPIED="C",t.DELETED="D",t.MODIFIED="M",t.RENAMED="R",t.CHANGED="T",t.UNMERGED="U",t.UNKNOWN="X",t.BROKEN="B",t))(Xf||{}),wv=new Set(Object.values(Xf))}});function o4(...t){return new _v().param(...t)}function l4(t){let e=new Set,n={};return dh(t,r=>{let[i,a,s]=r.split(zi);e.add(i),(n[i]=n[i]||[]).push({line:Pe(a),path:i,preview:s})}),{paths:e,results:n}}function c4(){return{grep(t){let e=qe(arguments),n=Lt(arguments);for(let i of xv)if(n.includes(i))return this._runTask(jt(`git.grep: use of "${i}" is not supported.`),e);typeof t=="string"&&(t=o4().param(t));let r=["grep","--null","-n","--full-name",...n,...t];return this._runTask({commands:r,format:"utf-8",parser(i){return l4(i)}},e)}}}var xv,gs,oy,_v,Sv=W({"src/lib/tasks/grep.ts"(){"use strict";oe(),Je(),xv=["-h"],gs=Symbol("grepQuery"),_v=class{constructor(){this[oy]=[]}*[(oy=gs,Symbol.iterator)](){for(let t of this[gs])yield t}and(...t){return t.length&&this[gs].push("--and","(",...ws(t,"-e"),")"),this}param(...t){return this[gs].push(...ws(t,"-e")),this}}}}),Ev={};Qe(Ev,{ResetMode:()=>al,getResetMode:()=>f4,resetTask:()=>u4});function u4(t,e){let n=["reset"];return kv(t)&&n.push(`--${t}`),n.push(...e),Tt(n)}function f4(t){if(kv(t))return t;switch(typeof t){case"string":case"undefined":return"soft"}}function kv(t){return Av.includes(t)}var al,Av,Tv=W({"src/lib/tasks/reset.ts"(){"use strict";Je(),al=(t=>(t.MIXED="mixed",t.SOFT="soft",t.HARD="hard",t.MERGE="merge",t.KEEP="keep",t))(al||{}),Av=Array.from(Object.values(al))}});function h4(){return(0,ul.default)("simple-git")}function ly(t,e,n){return!e||!String(e).replace(/\s*/,"")?n?(r,...i)=>{t(r,...i),n(r,...i)}:t:(r,...i)=>{t(`%s ${r}`,e,...i),n&&n(r,...i)}}function d4(t,e,{namespace:n}){if(typeof t=="string")return t;let r=e&&e.namespace||"";return r.startsWith(n)?r.substr(n.length+1):r||n}function kh(t,e,n,r=h4()){let i=t&&`[${t}]`||"",a=[],s=typeof e=="string"?r.extend(e):e,o=d4(Fn(e,gt),s,r);return c(n);function l(u,f){return we(a,kh(t,o.replace(/^[^:]+/,u),f,r))}function c(u){let f=u&&`[${u}]`||"",h=s&&ly(s,f)||Xr,d=ly(r,`${i} ${f}`,h);return Object.assign(s?h:d,{label:t,sibling:l,info:d,step:c})}}var Cv=W({"src/lib/git-logger.ts"(){"use strict";oe(),ul.default.formatters.L=t=>String(yh(t)?t.length:"-"),ul.default.formatters.B=t=>Buffer.isBuffer(t)?t.toString("utf8"):ks(t)}}),nl,sh,p4=W({"src/lib/runners/tasks-pending-queue.ts"(){"use strict";fr(),Cv(),nl=class{constructor(t="GitExecutor"){this.logLabel=t,this._queue=new
|
||
|
`).map(cM).filter(Boolean);e||n.sort(function(i,a){let s=i.split("."),o=a.split(".");if(s.length===1||o.length===1)return lM(rl(s[0]),rl(o[0]));for(let l=0,c=Math.max(s.length,o.length);l<c;l++){let u=Lw(rl(s[l]),rl(o[l]));if(u)return u}return 0});let r=e?n[0]:[...n].reverse().find(i=>i.indexOf(".")>=0);return new Py(n,r)}}}),Dw={};Qe(Dw,{addAnnotatedTagTask:()=>dM,addTagTask:()=>hM,tagListTask:()=>fM});function fM(t=[]){let e=t.some(n=>/^--sort=/.test(n));return{format:"utf-8",commands:["tag","-l",...t],parser(n){return jw(n,e)}}}function hM(t){return{format:"utf-8",commands:["tag",t],parser(){return{name:t}}}}function dM(t,e){return{format:"utf-8",commands:["tag","-a","-m",e,t],parser(){return{name:t}}}}var pM=W({"src/lib/tasks/tag.ts"(){"use strict";uM()}}),mM=P6({"src/git.js"(t,e){"use strict";var{GitExecutor:n}=(y4(),We(Mv)),{SimpleGitApi:r}=(mF(),We(uw)),{Scheduler:i}=(gF(),We(fw)),{configurationErrorTask:a}=(Je(),We(ih)),{asArray:s,filterArray:o,filterPrimitives:l,filterString:c,filterStringOrStringArray:u,filterType:f,getTrailingOptions:h,trailingFunctionArgument:d,trailingOptionsArgument:p}=(oe(),We(ev)),{applyPatchTask:g}=(vF(),We(pw)),{branchTask:m,branchLocalTask:w,deleteBranchesTask:b,deleteBranchTask:S}=(FF(),We(bw)),{checkIgnoreTask:k}=(PF(),We(Sw)),{checkIsRepoTask:x}=(iv(),We(tv)),{cloneTask:A,cloneMirrorTask:y}=(LF(),We(Ew)),{cleanWithOptionsTask:E,isCleanOptionsArray:_}=(mv(),We(dv)),{diffSummaryTask:C}=(Ph(),We(zv)),{fetchTask:M}=($F(),We(Tw)),{moveTask:L}=(GF(),We(Fw)),{pullTask:N}=(WF(),We(Mw)),{pushTagsTask:j}=(iw(),We(rw)),{addRemoteTask:Y,getRemotesTask:le,listRemotesTask:he,remoteTask:ie,removeRemoteTask:Me}=(tM(),We(Pw)),{getResetMode:de,resetTask:$}=(Tv(),We(Ev)),{stashListTask:G}=(rM(),We(Iw)),{addSubModuleTask:D,initSubModuleTask:se,subModuleTask:Se,updateSubModuleTask:mt}=(oM(),We(Rw)),{addAnnotatedTagTask:be,addTagTask:st,tagListTask:ee}=(pM(),We(Dw)),{straightThroughBufferTask:Ie,straightThroughStringTask:Ee}=(Je(),We(ih));function z(H,Z){this._plugins=Z,this._executor=new n(H.baseDir,new i(H.maxConcurrentProcesses),Z),this._trimmed=H.trimmed}(z.prototype=Object.create(r.prototype)).constructor=z,z.prototype.customBinary=function(H){return this._plugins.reconfigure("binary",H),this},z.prototype.env=function(H,Z){return arguments.length===1&&typeof H=="object"?this._executor.env=H:(this._executor.env=this._executor.env||{})[H]=Z,this},z.prototype.stashList=function(H){return this._runTask(G(p(arguments)||{},o(H)&&H||[]),d(arguments))};function nt(H,Z,ye,Ye){return typeof ye!="string"?a(`git.${H}() requires a string 'repoPath'`):Z(ye,f(Ye,c),h(arguments))}z.prototype.clone=function(){return this._runTask(nt("clone",A,...arguments),d(arguments))},z.prototype.mirror=function(){return this._runTask(nt("mirror",y,...arguments),d(arguments))},z.prototype.mv=function(H,Z){return this._runTask(L(H,Z),d(arguments))},z.prototype.checkoutLatestTag=function(H){var Z=this;return this.pull(function(){Z.tags(function(ye,Ye){Z.checkout(Ye.latest,H)})})},z.prototype.pull=function(H,Z,ye,Ye){return this._runTask(N(f(H,c),f(Z,c),h(arguments)),d(arguments))},z.prototype.fetch=function(H,Z){return this._runTask(M(f(H,c),f(Z,c),h(arguments)),d(arguments))},z.prototype.silent=function(H){return console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3"),this},z.prototype.tags=function(H,Z){return this._runTask(ee(h(arguments)),d(arguments))},z.prototype.rebase=function(){return this._runTask(Ee(["rebase",...h(arguments)]),d(arguments))},z.prototype.reset=function(H){return this._runTask($(de(H),h(arguments)),d(arguments))},z.prototype.revert=function(H){let Z=d(arguments);return typeof H!="string"?this._runTask(a("Commit must be a string"),Z):this._runTask(Ee(["revert",...h(arguments,0,!0),H]),Z)},z.prototype.addTag=function(H){let Z=typeof H=="string"?st(H):a("Git.addTag requires a tag name");return this._runTask(Z,d(arguments))},z.prototype.addAnnotatedTag=function(H,Z){return this._runTask
|
||
|
`):i="Too many files to list",e=e+`
|
||
|
|
||
|
Affected files:
|
||
|
`+i}return e}};var Le=class extends ia{constructor(e){super(e)}async setGitInstance(e=!1){if(this.isGitInstalled()){let n=this.app.vault.adapter,r=n.getBasePath(),i=r;this.plugin.settings.basePath&&(await n.exists((0,Jr.normalizePath)(this.plugin.settings.basePath))?i=vt.join(r,this.plugin.settings.basePath):e||new Jr.Notice("ObsidianGit: Base path does not exist")),this.absoluteRepoPath=i,this.git=Nw({baseDir:i,binary:this.plugin.localStorage.getGitPath()||void 0,config:["core.quotepath=off"]});let a=this.plugin.localStorage.getPATHPaths(),s=this.plugin.localStorage.getEnvVars(),o=this.plugin.settings.gitDir;if(a.length>0){let l=process.env.PATH+":"+a.join(":");process.env.PATH=l}o&&(process.env.GIT_DIR=o);for(let l of s){let[c,u]=l.split("=");process.env[c]=u}if(LS.default.enable("simple-git"),await this.git.checkIsRepo()){let l=await this.git.revparse("--show-cdup"),c=(0,Hs.resolve)(i+Hs.sep+l);this.absoluteRepoPath=c,await this.git.cwd(c)}}}getRelativeVaultPath(e){let r=this.app.vault.adapter.getBasePath(),i=vt.join(this.absoluteRepoPath,e),a=vt.relative(r,i);return Jr.Platform.isWin&&(a=a.replace(/\\/g,"/")),a}getRelativeRepoPath(e,n=!0){if(n){let i=this.plugin.app.vault.adapter.getBasePath(),a=this.absoluteRepoPath,s=vt.join(i,e),o=vt.relative(a,s);return Jr.Platform.isWin&&(o=o.replace(/\\/g,"/")),o}return e}async status(){this.plugin.setPluginState({gitAction:1});let e=await this.git.status();this.plugin.setPluginState({gitAction:0});let n=e.files.map(r=>{let i=this.formatPath(r);return{path:i.path,from:i.from,index:r.index==="?"?"U":r.index,working_dir:r.working_dir==="?"?"U":r.working_dir,vault_path:this.getRelativeVaultPath(i.path)}});return{all:n,changed:n.filter(r=>r.working_dir!==" "),staged:n.filter(r=>r.index!==" "&&r.index!="U"),conflicted:e.conflicted.map(r=>this.formatPath({path:r}).path)}}async submoduleAwareHeadRevisonInContainingDirectory(e){let n=this.getRelativeRepoPath(e),i=["-C",vt.dirname(n),"rev-parse","HEAD"],a=this.git.raw(i);return a.catch(s=>console.warn("obsidian-git: rev-parse error:",s)),a}async getSubmodulePaths(){return new Promise(e=>{this.git.outputHandler((n,r,i,a)=>{if(!(a.contains("submodule")&&a.contains("foreach")))return;let s="",o=this.app.vault.adapter.getBasePath()+(this.plugin.settings.basePath?"/"+this.plugin.settings.basePath:"");r.on("data",l=>{s+=l.toString("utf8")}),r.on("end",()=>{let c=s.split(`
|
||
|
`).map(u=>{let f=u.match(/'([^']*)'/);if(f!=null)return o+"/"+f[1]+Hs.sep}).filter(u=>!!u);c.reverse(),e(c)})}),this.git.subModule(["foreach","--recursive",""]).then(()=>{this.git.outputHandler(()=>{})},n=>this.plugin.displayError(n))})}formatPath(e,n=!1){function r(i){if(i!=null)return i.startsWith('"')&&i.endsWith('"')?i.substring(1,i.length-1):i}return n?{from:r(e.from),path:r(e.path)}:{path:r(e.path)}}async blame(e,n,r){if(e=this.getRelativeRepoPath(e),!await this.isTracked(e))return"untracked";let i=await this.getSubmoduleOfFile(e),a=i?["-C",i.submodule]:[],s=i?i.relativeFilepath:e;a.push("blame","--porcelain"),r&&a.push("-w");let o=`-C${Sl}`;switch(n){case"inactive":break;case"same-commit":a.push("-C",o);break;case"all-commits":a.push("-C","-C",o);break;default:yr(n)}a.push("--",s);let l=await this.git.raw(a);return NR(l)}async isTracked(e){let n=await this.getSubmoduleOfFile(e),r=n?["-C",n.submodule]:[],i=n?n.relativeFilepath:e;return r.push("ls-files","--",i),this.git.raw(r).then(a=>a.trim()!=="")}async commitAll({message:e}){if(this.plugin.settings.updateSubmodules){this.plugin.setPluginState({gitAction:4});let r=await this.getSubmodulePaths();for(let i of r)await this.git.cwd({path:i,root:!1}).add("-A"),await this.git.cwd({path:i,root:!1}).commit(await this.formatCommitMessage(e))}this.plugin.setPluginState({gitAction:3}),await this.git.add("-A"),this.plugin.setPluginState({gitAction:4});let n=await this.git.commit(await this.formatCommitMessage(e));return this.app.workspace.trigger("obsidian-git:head-change"),n.summary.changes}async commit({message:e,amend:n}){this.plugin.setPluginState({gitAction:4});let r=(await this.git.commit(await this.formatCommitMessage(e),n?["--amend"]:[])).summary.changes;return this.app.workspace.trigger("obsidian-git:head-change"),this.plugin.setPluginState({gitAction:0}),r}async stage(e,n){this.plugin.setPluginState({gitAction:3}),e=this.getRelativeRepoPath(e,n),await this.git.add(["--",e]),this.plugin.setPluginState({gitAction:0})}async stageAll({dir:e}){this.plugin.setPluginState({gitAction:3}),await this.git.add(e!=null?e:"-A"),this.plugin.setPluginState({gitAction:0})}async unstageAll({dir:e}){this.plugin.setPluginState({gitAction:3}),await this.git.reset(e!=null?["--",e]:[]),this.plugin.setPluginState({gitAction:0})}async unstage(e,n){this.plugin.setPluginState({gitAction:3}),e=this.getRelativeRepoPath(e,n),await this.git.reset(["--",e]),this.plugin.setPluginState({gitAction:0})}async discard(e){this.plugin.setPluginState({gitAction:3}),await this.isTracked(e)?await this.git.checkout(["--",e]):await this.app.vault.adapter.rmdir(this.getRelativeVaultPath(e),!0),this.plugin.setPluginState({gitAction:0})}async hashObject(e){e=this.getRelativeRepoPath(e);let n=await this.getSubmoduleOfFile(e),r=n?["-C",n.submodule]:[],i=n?n.relativeFilepath:e;return r.push("hash-object","--",i),this.git.raw(r)}async discardAll({dir:e}){return this.discard(e!=null?e:".")}async pull(){this.plugin.setPluginState({gitAction:2});try{this.plugin.settings.updateSubmodules&&await this.git.subModule(["update","--remote","--merge","--recursive"]);let e=await this.branchInfo(),n=await this.git.revparse([e.current]);if(!e.tracking&&this.plugin.settings.updateSubmodules){this.plugin.log("No tracking branch found. Ignoring pull of main repo and updating submodules only.");return}await this.git.fetch();let r=await this.git.revparse([e.tracking]);if(n!==r){if(this.plugin.settings.syncMethod==="merge"||this.plugin.settings.syncMethod==="rebase")try{switch(this.plugin.settings.syncMethod){case"merge":await this.git.merge([e.tracking]);break;case"rebase":await this.git.rebase([e.tracking])}}catch(s){this.plugin.displayError(`Pull failed (${this.plugin.settings.syncMethod}): ${"message"in s?s.message:s}`);return}else if(this.plugin.settings.syncMethod==="reset")try{await this.git.raw(["update-ref",`refs/heads/${e.current}`,r]),await this.unstageAll({})}catch(s){this.plugin.displayError(`Sync failed (${this.plugin.settings.syncMethod}): ${"message"in s?s.message:s}`)}this.app.workspace.trigger("obsidian-git:head-chan
|
||
|
`):[]}async removeRemote(e){await this.git.removeRemote(e)}async updateUpstreamBranch(e){try{await this.git.branch(["--set-upstream-to",e])}catch(n){console.error(n);try{await this.git.branch(["--set-upstream",e])}catch(r){console.error(r),await this.git.push(["--set-upstream",...wr(e)])}}}updateGitPath(e){return this.setGitInstance()}updateBasePath(e){return this.setGitInstance(!0)}async getDiffString(e,n=!1,r){return n?await this.git.diff(["--cached","--",e]):r?await this.git.show([`${r}`,"--",e]):await this.git.diff(["--",e])}async diff(e,n,r){return await this.git.diff([`${n}..${r}`,"--",e])}async getSubmoduleOfFile(e){if(!await this.app.vault.adapter.exists(vt.dirname(e)))return;let n=await this.git.raw(["-C",vt.dirname(e),"rev-parse","--show-toplevel"],o=>o&&console.warn("get-submodule-of-file",o==null?void 0:o.message));if(n=n.trim(),(await this.git.raw(["-C",vt.dirname(e),"rev-parse","--show-superproject-working-tree"],o=>o&&console.warn("get-submodule-of-file",o==null?void 0:o.message))).trim()==="")return;let a=this.app.vault.adapter.getFullPath(vt.normalize(e)),s=vt.relative(n,a);return{submodule:n,relativeFilepath:s}}async getLastCommitTime(){let e=await this.git.log({n:1});if(e!=null&&e.latest!=null)return new Date(e.latest.date)}isGitInstalled(){let e=(0,RS.spawnSync)(this.plugin.localStorage.getGitPath()||"git",["--version"],{stdio:"ignore"});return e.error?(console.error(e.error),!1):!0}convertErrors(e){if(e instanceof dn){let n=String(e.message);if(n.contains("Could not resolve host")||n.contains("Unable to resolve host")||n.match(/ssh: connect to host .*? port .*?: Operation timed out/)!=null||n.match(/ssh: connect to host .*? port .*?: Network is unreachable/)!=null||n.match(/ssh: connect to host .*? port .*?: Undefined error: 0/)!=null)throw new Wi(n)}throw e}},jS={hash:"000000",isZeroCommit:!0,summary:""};function NR(t){let n=t.replace(`\r
|
||
|
`,`
|
||
|
`).split(`
|
||
|
`),r={commits:new Map,hashPerLine:[void 0],originalFileLineNrPerLine:[void 0],finalFileLineNrPerLine:[void 0],groupSizePerStartingLine:new Map},i=1;for(let a=0;a<n.length;){if(PS(n[a])){let s=n[a].split(" "),o=$R(s,i,r);for(a++;PS(n[a]);a++){let l=n[a].split(" ");HR(l,r,i)}UR(r.commits.get(o)),i+=1}else if(!(n[a]===""&&a===n.length-1))throw Error(`Expected non-whitespace line or EOF, but found: ${n[a]}`);a++}return r}function $R(t,e,n){let r=t[0];if(n.hashPerLine.push(r),n.originalFileLineNrPerLine.push(parseInt(t[1])),n.finalFileLineNrPerLine.push(parseInt(t[2])),t.length>=4&&n.groupSizePerStartingLine.set(e,parseInt(t[3])),parseInt(t[2])!==e)throw Error(`git-blame output is out of order: ${e} vs ${t[2]}`);return r}function HR(t,e,n){let r=t[0],i=t.slice(1).join(" "),a=e.hashPerLine[n],s=e.commits.get(a)||{hash:a,author:{},committer:{},previous:{}};switch(r){case"summary":s.summary=i;break;case"author":s.author.name=i;break;case"author-mail":s.author.email=IS(i);break;case"author-time":s.author.epochSeconds=parseInt(i);break;case"author-tz":s.author.tz=i;break;case"committer":s.committer.name=i;break;case"committer-mail":s.committer.email=IS(i);break;case"committer-time":s.committer.epochSeconds=parseInt(i);break;case"committer-tz":s.committer.tz=i;break;case"previous":s.previous.commitHash=i;break;case"filename":s.previous.filename=i;break}e.commits.set(a,s)}function UR(t){if(t.summary===void 0)throw Error(`Summary not provided for commit: ${t.hash}`);op(t.author)&&(t.author=void 0),op(t.committer)&&(t.committer=void 0),op(t.previous)&&(t.previous=void 0),t.isZeroCommit=!!t.hash.match(/^0*$/)}function op(t){return!t||Object.keys(t).length===0}function PS(t){return t.length>0&&t[0].trim()===t[0]}function IS(t){let e=t.startsWith("<")?t.substring(1):t;return e.endsWith(">")?e.substring(0,e.length-1):e}v();var vE=require("@codemirror/state");v();var KS=require("@codemirror/state"),kc=require("obsidian");v();var lp=class{constructor(){this.eventsPerFilepath=new Map;this.startRemoveStalesSubscribersInterval()}ifFilepathDefinedTransformSubscribers(e,n){if(e)return this.ensureInitialized(e),n(this.eventsPerFilepath.get(e))}forEachSubscriber(e){this.eventsPerFilepath.forEach(n=>n.forEach(e))}ensureInitialized(e){this.eventsPerFilepath.get(e)||this.eventsPerFilepath.set(e,new Set)}startRemoveStalesSubscribersInterval(){this.removeStalesSubscribersTimer=window.setInterval(()=>this==null?void 0:this.forEachSubscriber(e=>e==null?void 0:e.removeIfStale()),6e4)}clear(){window.clearInterval(this.removeStalesSubscribersTimer),this.eventsPerFilepath.clear()}},aa=new lp;v();var _c=require("@codemirror/state"),WS=Ze(cp());v();var V=require("obsidian");v();v();function gn(){}gn.prototype={diff:function(e,n){var r,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=i.callback;typeof i=="function"&&(a=i,i={});var s=this;function o(k){return k=s.postProcess(k,i),a?(setTimeout(function(){a(k)},0),!0):k}e=this.castInput(e,i),n=this.castInput(n,i),e=this.removeEmpty(this.tokenize(e,i)),n=this.removeEmpty(this.tokenize(n,i));var l=n.length,c=e.length,u=1,f=l+c;i.maxEditLength!=null&&(f=Math.min(f,i.maxEditLength));var h=(r=i.timeout)!==null&&r!==void 0?r:1/0,d=Date.now()+h,p=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(p[0],n,e,0,i);if(p[0].oldPos+1>=c&&g+1>=l)return o(DS(s,p[0].lastComponent,n,e,s.useLongestToken));var m=-1/0,w=1/0;function b(){for(var k=Math.max(m,-u);k<=Math.min(w,u);k+=2){var x=void 0,A=p[k-1],y=p[k+1];A&&(p[k-1]=void 0);var E=!1;if(y){var _=y.oldPos-k;E=y&&0<=_&&_<l}var C=A&&A.oldPos+1<c;if(!E&&!C){p[k]=void 0;continue}if(!C||E&&A.oldPos<y.oldPos?x=s.addToPath(y,!0,!1,0,i):x=s.addToPath(A,!1,!0,1,i),g=s.extractCommon(x,n,e,k,i),x.oldPos+1>=c&&g+1>=l)return o(DS(s,x.lastComponent,n,e,s.useLongestToken));p[k]=x,x.oldPos+1>=c&&(w=Math.min(w,k-1)),g+1>=l&&(m=Math.max(m,k+1))}u++}if(a)(function k(){setTimeout(function(){if(u>f||Date.now()>d)return a();b()||k()},0)})();else for(;u<=f&&Date.now()<=d;){var S=b();if(S)return S}},addToPath:function(e,n,r,i,a){var s=e.lastComponent;return s&&!a.oneChangePerToken&
|
||
|
`));var n=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(var i=0;i<r.length;i++){var a=r[i];i%2&&!e.newlineIsToken?n[n.length-1]+=a:n.push(a)}return n};yc.equals=function(t,e,n){return n.ignoreWhitespace?((!n.newlineIsToken||!t.includes(`
|
||
|
`))&&(t=t.trim()),(!n.newlineIsToken||!e.includes(`
|
||
|
`))&&(e=e.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(t.endsWith(`
|
||
|
`)&&(t=t.slice(0,-1)),e.endsWith(`
|
||
|
`)&&(e=e.slice(0,-1))),gn.prototype.equals.call(this,t,e,n)};function US(t,e,n){return yc.diff(t,e,n)}var WR=new gn;WR.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};var qR=new gn;qR.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};function zS(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function mc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?zS(Object(n),!0).forEach(function(r){ZR(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):zS(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function XR(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function YR(t){var e=XR(t,"string");return typeof e=="symbol"?e:e+""}function dp(t){"@babel/helpers - typeof";return dp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},dp(t)}function ZR(t,e,n){return e=YR(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function up(t){return KR(t)||JR(t)||QR(t)||eL()}function KR(t){if(Array.isArray(t))return pp(t)}function JR(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function QR(t,e){if(t){if(typeof t=="string")return pp(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pp(t,e)}}function pp(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function eL(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
||
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var zs=new gn;zs.useLongestToken=!0;zs.tokenize=yc.tokenize;zs.castInput=function(t,e){var n=e.undefinedReplacement,r=e.stringifyReplacer,i=r===void 0?function(a,s){return typeof s=="undefined"?n:s}:r;return typeof t=="string"?t:JSON.stringify(mp(t,null,null,i),i," ")};zs.equals=function(t,e,n){return gn.prototype.equals.call(zs,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"),n)};function mp(t,e,n,r,i){e=e||[],n=n||[],r&&(t=r(i,t));var a;for(a=0;a<e.length;a+=1)if(e[a]===t)return n[a];var s;if(Object.prototype.toString.call(t)==="[object Array]"){for(e.push(t),s=new Array(t.length),n.push(s),a=0;a<t.length;a+=1)s[a]=mp(t[a],e,n,r,i);return e.pop(),n.pop(),s}if(t&&t.toJSON&&(t=t.toJSON()),dp(t)==="object"&&t!==null){e.push(t),s={},n.push(s);var o=[],l;for(l in t)Object.prototype.hasOwnProperty.call(t,l)&&o.push(l);for(o.sort(),a=0;a<o.length;a+=1)l=o[a],s[l]=mp(t[l],e,n,r,l);e.pop(),n.pop()}else s=t;return s}var gp=new gn;gp.tokenize=function(t){return t.slice()};gp.join=gp.removeEmpty=function(t){return t};function GS(t,e,n,r,i,a,s){if(s||(s={}),typeof s=="function"&&(s={callback:s}),typeof s.context=="undefined"&&(s.context=4),s.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(s.callback){var o=s,l=o.callback;US(n,r,mc(mc({},s),{},{callback:function(f){var h=c(f);l(h)}}))}else return c(US(n,r,s));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(E){return E.map(function(_){return" "+_})}for(var h=[],d=0,p=0,g=[],m=1,w=1,b=function(){var _=u[S],C=_.lines||nL(_.value);if(_.lines=C,_.added||_.removed){var M;if(!d){var L=u[S-1];d=m,p=w,L&&(g=s.context>0?f(L.lines.slice(-s.context)):[],d-=g.length,p-=g.length)}(M=g).push.apply(M,up(C.map(function(he){return(_.added?"+":"-")+he}))),_.added?w+=C.length:m+=C.length}else{if(d)if(C.length<=s.context*2&&S<u.length-2){var N;(N=g).push.apply(N,up(f(C)))}else{var j,Y=Math.min(C.length,s.context);(j=g).push.apply(j,up(f(C.slice(0,Y))));var le={oldStart:d,oldLines:m-d+Y,newStart:p,newLines:w-p+Y,lines:g};h.push(le),d=0,p=0,g=[]}m+=C.length,w+=C.length}},S=0;S<u.length;S++)b();for(var k=0,x=h;k<x.length;k++)for(var A=x[k],y=0;y<A.lines.length;y++)A.lines[y].endsWith(`
|
||
|
`)?A.lines[y]=A.lines[y].slice(0,-1):(A.lines.splice(y+1,0,"\\ No newline at end of file"),y++);return{oldFileName:t,newFileName:e,oldHeader:i,newHeader:a,hunks:h}}}function yp(t){if(Array.isArray(t))return t.map(yp).join(`
|
||
|
`);var e=[];t.oldFileName==t.newFileName&&e.push("Index: "+t.oldFileName),e.push("==================================================================="),e.push("--- "+t.oldFileName+(typeof t.oldHeader=="undefined"?"":" "+t.oldHeader)),e.push("+++ "+t.newFileName+(typeof t.newHeader=="undefined"?"":" "+t.newHeader));for(var n=0;n<t.hunks.length;n++){var r=t.hunks[n];r.oldLines===0&&(r.oldStart-=1),r.newLines===0&&(r.newStart-=1),e.push("@@ -"+r.oldStart+","+r.oldLines+" +"+r.newStart+","+r.newLines+" @@"),e.push.apply(e,r.lines)}return e.join(`
|
||
|
`)+`
|
||
|
`}function tL(t,e,n,r,i,a,s){var o;if(typeof s=="function"&&(s={callback:s}),(o=s)!==null&&o!==void 0&&o.callback){var c=s,u=c.callback;GS(t,e,n,r,i,a,mc(mc({},s),{},{callback:function(h){h?u(yp(h)):u()}}))}else{var l=GS(t,e,n,r,i,a,s);return l?yp(l):void 0}}function vc(t,e,n,r,i,a){return tL(t,t,e,n,r,i,a)}function nL(t){var e=t.endsWith(`
|
||
|
`),n=t.split(`
|
||
|
`).map(function(r){return r+`
|
||
|
`});return e?n.pop():n.push(n.pop().slice(0,-1)),n}var Qr=require("obsidian");v();var VS=require("obsidian"),rL={options:[],placeholder:"",allowEmpty:!1,onlySelection:!1,initialValue:void 0},Xe=class extends VS.SuggestModal{constructor(e,n){super(e.app),this.config={...rL,...n},this.setPlaceholder(this.config.placeholder)}openAndGetResult(){return this.config.initialValue!=null&&(this.inputEl.value=this.config.initialValue,this.inputEl.dispatchEvent(new Event("input"))),new Promise(e=>{this.resolve=e,this.open()})}onClose(){new Promise(e=>setTimeout(e,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(e){return this.config.onlySelection?this.config.options:this.config.allowEmpty?[e.length>0?e:" ",...this.config.options]:[e.length>0?e:"...",...this.config.options]}renderSuggestion(e,n){n.setText(e)}onChooseSuggestion(e,n){if(this.resolve){let r;this.config.allowEmpty&&e===" "?r="":e==="..."?r=void 0:r=e,this.resolve(r)}}};v();var br=require("obsidian"),wc=class{constructor(e,n){this.plugin=n;this.promises={};this.adapter=e.adapter,this.vault=e,this.lastBasePath=this.plugin.settings.basePath,this.promises.readFile=this.readFile.bind(this),this.promises.writeFile=this.writeFile.bind(this),this.promises.readdir=this.readdir.bind(this),this.promises.mkdir=this.mkdir.bind(this),this.promises.rmdir=this.rmdir.bind(this),this.promises.stat=this.stat.bind(this),this.promises.unlink=this.unlink.bind(this),this.promises.lstat=this.lstat.bind(this),this.promises.readlink=this.readlink.bind(this),this.promises.symlink=this.symlink.bind(this)}async readFile(e,n){var r;if(this.maybeLog("Read: "+e+JSON.stringify(n)),n=="utf8"||n.encoding=="utf8"){let i=this.vault.getAbstractFileByPath(e);return i instanceof br.TFile?(this.maybeLog("Reuse"),this.vault.read(i)):this.adapter.read(e)}else{if(e.endsWith(this.gitDir+"/index"))return this.plugin.settings.basePath!=this.lastBasePath?(this.clearIndex(),this.lastBasePath=this.plugin.settings.basePath,this.adapter.readBinary(e)):(r=this.index)!=null?r:this.adapter.readBinary(e);let i=this.vault.getAbstractFileByPath(e);return i instanceof br.TFile?(this.maybeLog("Reuse"),this.vault.readBinary(i)):this.adapter.readBinary(e)}}async writeFile(e,n){if(this.maybeLog("Write: "+e),typeof n=="string"){let r=this.vault.getAbstractFileByPath(e);return r instanceof br.TFile?this.vault.modify(r,n):this.adapter.write(e,n)}else if(e.endsWith(this.gitDir+"/index"))this.index=n,this.indexmtime=Date.now();else{let r=this.vault.getAbstractFileByPath(e);return r instanceof br.TFile?this.vault.modifyBinary(r,n):this.adapter.writeBinary(e,n)}}async readdir(e){e==="."&&(e="/");let n=await this.adapter.list(e),r=[...n.files,...n.folders],i;return e!=="/"?i=r.map(a=>(0,br.normalizePath)(a.substring(e.length))):i=r,i}async mkdir(e){return this.adapter.mkdir(e)}async rmdir(e,n){var r,i;return this.adapter.rmdir(e,(i=(r=n==null?void 0:n.options)==null?void 0:r.recursive)!=null?i:!1)}async stat(e){if(e.endsWith(this.gitDir+"/index")){if(this.index!==void 0&&this.indexctime!=null&&this.indexmtime!=null)return{isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1,size:this.index.length,type:"file",ctimeMs:this.indexctime,mtimeMs:this.indexmtime};{let r=await this.adapter.stat(e);if(r==null)throw{code:"ENOENT"};return this.indexctime=r.ctime,this.indexmtime=r.mtime,{ctimeMs:r.ctime,mtimeMs:r.mtime,size:r.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1}}}e==="."&&(e="/");let n=this.vault.getAbstractFileByPath(e);if(this.maybeLog("Stat: "+e),n instanceof br.TFile)return this.maybeLog("Reuse stat"),{ctimeMs:n.stat.ctime,mtimeMs:n.stat.mtime,size:n.stat.size,type:"file",isFile:()=>!0,isDirectory:()=>!1,isSymbolicLink:()=>!1};{let r=await this.adapter.stat(e);if(r)return{ctimeMs:r.ctime,mtimeMs:r.mtime,size:r.size,type:r.type==="folder"?"directory":r.type,isFile:()=>r.type==="file",isDirectory:()=>r.type==="folder",isSymbolicLink:()=>!1};throw{code:"ENOENT"}}}async unlink(e){return this.adapter.remove(e)}async lstat(e){return this.stat(e)}async readlink(e){throw new Error(`readlink of (${e})
|
||
|
|
||
|
`);return{message:o[0],author:{name:s.commit.author.name,email:s.commit.author.email},body:o.slice(1).join(`
|
||
|
|
||
|
`),date:new Date(s.commit.committer.timestamp).toDateString(),diff:{changed:0,files:(await this.getFileChangesCount(s.commit.parent.first(),s.oid)).map(l=>({path:l.path,status:l.type,vault_path:this.getRelativeVaultPath(l.path),hash:s.oid,binary:void 0}))},hash:s.oid,refs:[]}}))}updateBasePath(n){return this.getRepo().dir=n,Promise.resolve()}async updateUpstreamBranch(n){let[r,i]=wr(n),a=await this.branchInfo();await this.setConfig(`branch.${a.current}.merge`,`refs/heads/${i}`),await this.setConfig(`branch.${i}.remote`,r)}updateGitPath(n){return Promise.resolve()}async getFileChangesCount(n,r){return this.walkDifference({walkers:[ae.TREE({ref:n}),ae.TREE({ref:r})]})}async walkDifference({walkers:n,dir:r}){return await this.wrapFS(ae.walk({...this.getRepo(),trees:n,map:async function(a,[s,o]){if(!ip(a,r))return null;if(await(s==null?void 0:s.type())==="tree"||await(o==null?void 0:o.type())==="tree")return;let l=await(s==null?void 0:s.oid()),c=await(o==null?void 0:o.oid()),u="equal";if(l!==c&&(u="M"),l===void 0&&(u="A"),c===void 0&&(u="D"),l===void 0&&c===void 0&&(console.log("Something weird happened:"),console.log(s),console.log(o)),u!=="equal")return{path:a,type:u}}}))}async getStagedFiles(n="."){return(await this.walkDifference({walkers:[ae.TREE({ref:"HEAD"}),ae.STAGE()],dir:n})).map(i=>({vault_path:this.getRelativeVaultPath(i.path),filepath:i.path}))}async getUnstagedFiles(n="."){let r,i=window.setTimeout(()=>{r=new Qr.Notice("This takes longer: Getting status",this.noticeLength)},2e4);try{let a=this.getRepo(),s=await this.wrapFS(ae.walk({...a,trees:[ae.WORKDIR(),ae.STAGE()],map:async function(o,[l,c]){if(!c&&l&&await ae.isIgnored({...a,filepath:o})||!ip(o,n))return null;let[u,f]=await Promise.all([l&&l.type(),c&&c.type()]),h=[u,f].includes("blob");if((u==="tree"||u==="special")&&!h)return;if(f==="commit")return null;if((f==="tree"||f==="special")&&!h)return;let d=f==="blob"?await c.oid():void 0,p;return u==="blob"&&f!=="blob"?p="42":u==="blob"&&(p=await l.oid()),p?p!==d?{filepath:o,deleted:!1}:null:{filepath:o,deleted:!0}}}));return window.clearTimeout(i),r==null||r.hide(),s}catch(a){throw window.clearTimeout(i),r==null||r.hide(),this.plugin.displayError(a),a}}async getDiffString(n,r=!1,i){let a=this.getRelativeVaultPath(n),s=async(c,[u])=>{if(n==c){let f=await u.oid();return(await ae.readBlob({...this.getRepo(),oid:f})).blob}};if(i){let c=await ms({...this.getRepo(),filepath:n,oid:i}).then(d=>new TextDecoder().decode(d.blob)).catch(d=>{if(!(d instanceof ae.Errors.NotFoundError))throw d}),u=await ae.readCommit({...this.getRepo(),oid:i}),f=await ms({...this.getRepo(),filepath:n,oid:u.commit.parent.first()}).then(d=>new TextDecoder().decode(d.blob)).catch(d=>{if(!(d instanceof ae.Errors.NotFoundError))throw d});return vc(a,f!=null?f:"",c!=null?c:"")}let o=(await ae.walk({...this.getRepo(),trees:[ae.STAGE()],map:s})).first(),l=new TextDecoder().decode(o);if(r){let c=await this.resolveRef("HEAD").then(f=>ms({...this.getRepo(),filepath:n,oid:f})).then(f=>new TextDecoder().decode(f.blob)).catch(f=>{if(!(f instanceof ae.Errors.NotFoundError))throw f});return vc(a,c!=null?c:"",l)}else{let c;return await this.app.vault.adapter.exists(a)?c=await this.app.vault.adapter.read(a):c="",vc(a,l,c)}}async getLastCommitTime(){let n=this.getRepo(),r=await this.resolveRef("HEAD"),a=(await ae.readCommit({...n,oid:r})).commit.committer.timestamp;return new Date(a*1e3)}getFileStatusResult(n){let r=this.status_mapping[`${n[this.HEAD]}${n[this.WORKDIR]}${n[this.STAGE]}`];return{index:r[0]=="?"?"U":r[0],working_dir:r[1]=="?"?"U":r[1],path:n[this.FILE],vault_path:this.getRelativeVaultPath(n[this.FILE])}}async checkAuthorInfo(){let n=await this.getConfig("user.name"),r=await this.getConfig("user.email");if(!n||!r)throw Error("Git author information is not set. Please set it in the settings.")}showNotice(n,r=!0){if(!this.plugin.settings.disablePopups)return new Qr.Notice(n,r?this.noticeLength:void 0)}};function iL(t){let e=[t];return{next(){return Promise.resolve({done:e.length===0,value:e.pop()})},return(){return e=[],{}},[Symbol.asyncIterator]
|
||
|
If turned on, do auto ${i} every ${$s(r.settings.autoSaveInterval)} after stopping file edits.
|
||
|
This also prevents auto ${i} while editing a file. If turned off, it's independent from the last file edit.`).addToggle(u=>u.setValue(r.settings.autoBackupAfterFileChange).onChange(async f=>{r.settings.autoBackupAfterFileChange=f,this.display(),await r.saveSettings(),r.automaticsManager.reload("commit")})),this.mayDisableSetting(s,r.settings.setLastSaveToLastCommit),s=new V.Setting(n).setName(`Auto ${i} after latest commit`).setDesc(`If turned on, sets last auto ${i} timestamp to the latest commit timestamp. This reduces the frequency of auto ${i} when doing manual commits.`).addToggle(u=>u.setValue(r.settings.setLastSaveToLastCommit).onChange(async f=>{r.settings.setLastSaveToLastCommit=f,await r.saveSettings(),r.automaticsManager.reload("commit"),this.display()})),this.mayDisableSetting(s,r.settings.autoBackupAfterFileChange),s=new V.Setting(n).setName("Auto push interval (minutes)").setDesc("Push commits every X minutes. Set to 0 (default) to disable.").addText(u=>u.setValue(String(r.settings.autoPushInterval)).onChange(async f=>{isNaN(Number(f))?new V.Notice("Please specify a valid number."):(r.settings.autoPushInterval=Number(f),await r.saveSettings(),r.settings.autoPushInterval>0?(r.automaticsManager.reload("push"),new V.Notice(`Automatic push enabled! Every ${$s(r.settings.autoPushInterval)}.`)):r.settings.autoPushInterval<=0&&new V.Notice("Automatic push disabled!"))})),this.mayDisableSetting(s,!r.settings.differentIntervalCommitAndPush),new V.Setting(n).setName("Auto pull interval (minutes)").setDesc("Pull changes every X minutes. Set to 0 (default) to disable.").addText(u=>u.setValue(String(r.settings.autoPullInterval)).onChange(async f=>{isNaN(Number(f))?new V.Notice("Please specify a valid number."):(r.settings.autoPullInterval=Number(f),await r.saveSettings(),r.settings.autoPullInterval>0?(r.automaticsManager.reload("pull"),new V.Notice(`Automatic pull enabled! Every ${$s(r.settings.autoPullInterval)}.`)):r.settings.autoPullInterval<=0&&new V.Notice("Automatic pull disabled!"))})),new V.Setting(n).setName(`Specify custom commit message on auto ${i}`).setDesc("You will get a pop up to specify your message.").addToggle(u=>u.setValue(r.settings.customMessageOnAutoBackup).onChange(async f=>{r.settings.customMessageOnAutoBackup=f,await r.saveSettings(),this.display()})),s=new V.Setting(n).setName(`Commit message on auto ${i}`).setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(u=>u.setPlaceholder("vault backup: {{date}}").setValue(r.settings.autoCommitMessage).onChange(async f=>{r.settings.autoCommitMessage=f,await r.saveSettings()})),this.mayDisableSetting(s,r.settings.customMessageOnAutoBackup),new V.Setting(n).setName("Commit message").setHeading(),new V.Setting(n).setName("Commit message on manual commit").setDesc("Available placeholders: {{date}} (see below), {{hostname}} (see below), {{numFiles}} (number of changed files in the commit) and {{files}} (changed files in commit message).").addTextArea(u=>u.setPlaceholder("vault backup: {{date}}").setValue(r.settings.commitMessage?r.settings.commitMessage:"").onChange(async f=>{r.settings.commitMessage=f,await r.saveSettings()}));let c=new V.Setting(n).setName("{{date}} placeholder format").addMomentFormat(u=>u.setDefaultFormat(r.settings.commitDateFormat).setValue(r.settings.commitDateFormat).onChange(async f=>{r.settings.commitDateFormat=f,await r.saveSettings()}));c.descEl.innerHTML=`
|
||
|
Specify custom date format. E.g. "${Dh}. See <a href="https://momentjs.com">Moment.js</a> for more formats.`,new V.Setting(n).setName("{{hostname}} placeholder replacement").setDesc("Specify custom hostname for every device.").addText(u=>{var f;return u.setValue((f=r.localStorage.getHostname())!=null?f:"").onChange(h=>{r.localStorage.setHostname(h)})}),new V.Setting(n).setName("Preview commit message").addButton(u=>u.setButtonText("Preview").onClick(async()=>{let f=await r.gitManager.formatCommitMessage(r.settings.commitMessage);new V.Notice(`${f}`)})),new V.Setting(n).setName("List filenames affected by commit in the commit body").addToggle(u=>u.setValue(r.settings.listChangedFilesInMessageBody).onChange(async f=>{r.settings.listChangedFilesInMessageBody=f,await r.saveSettings()})),new V.Setting(n).setName("Pull").setHeading(),r.gitManager instanceof Le&&new V.Setting(n).setName("Merge strategy").setDesc("Decide how to integrate commits from your remote branch into your local branch.").addDropdown(u=>{let f={merge:"Merge",rebase:"Rebase",reset:"Other sync service (Only updates the HEAD without touching the working directory)"};u.addOptions(f),u.setValue(r.settings.syncMethod),u.onChange(async h=>{r.settings.syncMethod=h,await r.saveSettings()})}),new V.Setting(n).setName("Pull on startup").setDesc("Automatically pull commits when Obsidian starts.").addToggle(u=>u.setValue(r.settings.autoPullOnBoot).onChange(async f=>{r.settings.autoPullOnBoot=f,await r.saveSettings()})),new V.Setting(n).setName("Commit-and-sync").setDesc("Commit-and-sync with default settings means staging everything -> committing -> pulling -> pushing. Ideally this is a single action that you do regularly to keep your local and remote repository in sync.").setHeading(),s=new V.Setting(n).setName("Push on commit-and-sync").setDesc(`Most of the time you want to push after committing. Turning this off turns a commit-and-sync action into commit ${r.settings.pullBeforePush?"and pull ":""}only. It will still be called commit-and-sync.`).addToggle(u=>u.setValue(!r.settings.disablePush).onChange(async f=>{r.settings.disablePush=!f,this.display(),await r.saveSettings()})),new V.Setting(n).setName("Pull on commit-and-sync").setDesc(`On commit-and-sync, pull commits as well. Turning this off turns a commit-and-sync action into commit ${r.settings.disablePush?"":"and push "}only.`).addToggle(u=>u.setValue(r.settings.pullBeforePush).onChange(async f=>{r.settings.pullBeforePush=f,this.display(),await r.saveSettings()})),r.gitManager instanceof Le&&(new V.Setting(n).setName("Line author information").setHeading(),this.addLineAuthorInfoSettings())}new V.Setting(n).setName("History view").setHeading(),new V.Setting(n).setName("Show Author").setDesc("Show the author of the commit in the history view.").addDropdown(c=>{let u={hide:"Hide",full:"Full",initials:"Initials"};c.addOptions(u),c.setValue(r.settings.authorInHistoryView),c.onChange(async f=>{r.settings.authorInHistoryView=f,await r.saveSettings(),await r.refresh()})}),new V.Setting(n).setName("Show Date").setDesc("Show the date of the commit in the history view. The {{date}} placeholder format is used to display the date.").addToggle(c=>c.setValue(r.settings.dateInHistoryView).onChange(async u=>{r.settings.dateInHistoryView=u,await r.saveSettings(),await r.refresh()})),new V.Setting(n).setName("Source control view").setHeading(),new V.Setting(n).setName("Automatically refresh source control view on file changes").setDesc("On slower machines this may cause lags. If so, just disable this option.").addToggle(c=>c.setValue(r.settings.refreshSourceControl).onChange(async u=>{r.settings.refreshSourceControl=u,await r.saveSettings()})),new V.Setting(n).setName("Source control view refresh interval").setDesc("Milliseconds to wait after file change before refreshing the Source Control View.").addText(c=>c.setValue(r.settings.refreshSourceControlTimer.toString()).setPlaceholder("7000").onChange(async u=>{r.settings.refreshSourceControlTimer=Math.max(parseInt(u),500),await r.saveSettings(),r.setRefreshDebouncer(
|
||
|
`)),c.onChange(u=>{r.localStorage.setEnvVars(u.split(`
|
||
|
`))})}),r.gitManager instanceof Le&&new V.Setting(n).setName("Additional PATH environment variable paths").setDesc("Use each line for one path").addTextArea(c=>{c.setValue(r.localStorage.getPATHPaths().join(`
|
||
|
`)),c.onChange(u=>{r.localStorage.setPATHPaths(u.split(`
|
||
|
`))})}),r.gitManager instanceof Le&&new V.Setting(n).setName("Reload with new environment variables").setDesc("Removing previously added environment variables will not take effect until Obsidian is restarted.").addButton(c=>{c.setButtonText("Reload"),c.setCta(),c.onClick(async()=>{await r.gitManager.setGitInstance()})}),new V.Setting(n).setName("Custom base path (Git repository path)").setDesc(`
|
||
|
Sets the relative path to the vault from which the Git binary should be executed.
|
||
|
Mostly used to set the path to the Git repository, which is only required if the Git repository is below the vault root directory. Use "\\" instead of "/" on Windows.
|
||
|
`).addText(c=>{c.setValue(r.settings.basePath),c.setPlaceholder("directory/directory-with-git-repo"),c.onChange(async u=>{r.settings.basePath=u,await r.saveSettings(),r.gitManager.updateBasePath(u||"").catch(f=>r.displayError(f))})}),new V.Setting(n).setName("Custom Git directory path (Instead of '.git')").setDesc('Requires restart of Obsidian to take effect. Use "\\" instead of "/" on Windows.').addText(c=>{c.setValue(r.settings.gitDir),c.setPlaceholder(".git"),c.onChange(async u=>{r.settings.gitDir=u,await r.saveSettings()})}),new V.Setting(n).setName("Disable on this device").setDesc("Disables the plugin on this device. This setting is not synced.").addToggle(c=>c.setValue(r.localStorage.getPluginDisabled()).onChange(u=>{r.localStorage.setPluginDisabled(u),u?r.unloadPlugin():r.init({fromReload:!0}).catch(f=>r.displayError(f)),new V.Notice("Obsidian must be restarted for the changes to take affect.")})),new V.Setting(n).setName("Support").setHeading(),new V.Setting(n).setName("Donate").setDesc("If you like this Plugin, consider donating to support continued development.").addButton(c=>{c.buttonEl.outerHTML="<a href='https://ko-fi.com/F1F195IQ5' target='_blank'><img 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>"});let o=n.createDiv();o.setAttr("align","center"),o.setAttr("style","margin: var(--size-4-2)");let l=o.createEl("button");if(l.setText("Copy Debug Information"),l.onclick=async()=>{await window.navigator.clipboard.writeText(JSON.stringify({settings:this.plugin.settings,pluginVersion:this.plugin.manifest.version},null,4)),new V.Notice("Debug information copied to clipboard. May contain sensitive information!")},V.Platform.isDesktopApp){let c=n.createDiv();c.setAttr("align","center"),c.setText(`Debugging and logging:
|
||
|
You can always see the logs of this and every other plugin by opening the console with`);let u=n.createDiv();u.setAttr("align","center"),u.addClass("obsidian-git-shortcuts"),V.Platform.isMacOS===!0?u.createEl("kbd",{text:"CMD (\u2318) + OPTION (\u2325) + I"}):u.createEl("kbd",{text:"CTRL + SHIFT + I"})}}mayDisableSetting(n,r){r&&(n.setDisabled(r),n.setClass("obsidian-git-disabled"))}configureLineAuthorShowStatus(n){this.settings.lineAuthor.show=n,this.plugin.saveSettings(),n?this.plugin.lineAuthoringFeature.activateFeature():this.plugin.lineAuthoringFeature.deactivateFeature()}async lineAuthorSettingHandler(n,r){this.settings.lineAuthor[n]=r,await this.plugin.saveSettings(),this.plugin.lineAuthoringFeature.refreshLineAuthorViews()}beforeSaveSettings(){let n=this.settings.lineAuthor;n.authorDisplay!=="hide"&&(n.lastShownAuthorDisplay=n.authorDisplay),n.dateTimeFormatOptions!=="hide"&&(n.lastShownDateTimeFormatOptions=n.dateTimeFormatOptions)}addLineAuthorInfoSettings(){let n=new V.Setting(this.containerEl).setName("Show commit authoring information next to each line");if(this.plugin.lineAuthoringFeature.isAvailableOnCurrentPlatform()||n.setDesc("Only available on desktop currently.").setDisabled(!0),n.descEl.innerHTML=`
|
||
|
<a href="${cL}">Feature guide and quick examples</a></br>
|
||
|
The commit hash, author name and authoring date can all be individually toggled.</br>Hide everything, to only show the age-colored sidebar.`,n.addToggle(r=>r.setValue(this.settings.lineAuthor.show).onChange(i=>{this.configureLineAuthorShowStatus(i),this.display()})),this.settings.lineAuthor.show){let r=new V.Setting(this.containerEl).setName("Follow movement and copies across files and commits").setDesc("").addDropdown(a=>{a.addOptions({inactive:"Do not follow (default)","same-commit":"Follow within same commit","all-commits":"Follow within all commits (maybe slow)"}),a.setValue(this.settings.lineAuthor.followMovement),a.onChange(s=>this.lineAuthorSettingHandler("followMovement",s))});if(r.descEl.innerHTML=`
|
||
|
By default (deactivated), each line only shows the newest commit where it was changed.
|
||
|
<br/>
|
||
|
With <i>same commit</i>, cut-copy-paste-ing of text is followed within the same commit and the original commit of authoring will be shown.
|
||
|
<br/>
|
||
|
With <i>all commits</i>, cut-copy-paste-ing text inbetween multiple commits will be detected.
|
||
|
<br/>
|
||
|
It uses <a href="https://git-scm.com/docs/git-blame">git-blame</a> and
|
||
|
for matches (at least ${Sl} characters) within the same (or all) commit(s), <em>the originating</em> commit's information is shown.`,new V.Setting(this.containerEl).setName("Show commit hash").addToggle(a=>{a.setValue(this.settings.lineAuthor.showCommitHash),a.onChange(s=>this.lineAuthorSettingHandler("showCommitHash",s))}),new V.Setting(this.containerEl).setName("Author name display").setDesc("If and how the author is displayed").addDropdown(a=>{let s={hide:"Hide",initials:"Initials (default)","first name":"First name","last name":"Last name",full:"Full name"};a.addOptions(s),a.setValue(this.settings.lineAuthor.authorDisplay),a.onChange(async o=>this.lineAuthorSettingHandler("authorDisplay",o))}),new V.Setting(this.containerEl).setName("Authoring date display").setDesc("If and how the date and time of authoring the line is displayed").addDropdown(a=>{let s={hide:"Hide",date:"Date (default)",datetime:"Date and time","natural language":"Natural language",custom:"Custom"};a.addOptions(s),a.setValue(this.settings.lineAuthor.dateTimeFormatOptions),a.onChange(async o=>{await this.lineAuthorSettingHandler("dateTimeFormatOptions",o),this.display()})}),this.settings.lineAuthor.dateTimeFormatOptions==="custom"){let a=new V.Setting(this.containerEl);a.setName("Custom authoring date format").addText(s=>{s.setValue(this.settings.lineAuthor.dateTimeFormatCustomString),s.setPlaceholder("YYYY-MM-DD HH:mm"),s.onChange(async o=>{await this.lineAuthorSettingHandler("dateTimeFormatCustomString",o),a.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(o)})}),a.descEl.innerHTML=this.previewCustomDateTimeDescriptionHtml(this.settings.lineAuthor.dateTimeFormatCustomString)}new V.Setting(this.containerEl).setName("Authoring date display timezone").addDropdown(a=>{let s={"viewer-local":"My local (default)","author-local":"Author's local",utc0000:"UTC+0000/Z"};a.addOptions(s),a.setValue(this.settings.lineAuthor.dateTimeTimezone),a.onChange(async o=>this.lineAuthorSettingHandler("dateTimeTimezone",o))}).descEl.innerHTML=`
|
||
|
The time-zone in which the authoring date should be shown.
|
||
|
Either your local time-zone (default),
|
||
|
the author's time-zone during commit creation or
|
||
|
<a href="https://en.wikipedia.org/wiki/UTC%C2%B100:00">UTC\xB100:00</a>.
|
||
|
`;let i=new V.Setting(this.containerEl).setName("Oldest age in coloring");i.descEl.innerHTML=this.previewOldestAgeDescriptionHtml(this.settings.lineAuthor.coloringMaxAge)[0],i.addText(a=>{a.setPlaceholder("1y"),a.setValue(this.settings.lineAuthor.coloringMaxAge),a.onChange(async s=>{let[o,l]=this.previewOldestAgeDescriptionHtml(s);i.descEl.innerHTML=o,l&&(await this.lineAuthorSettingHandler("coloringMaxAge",s),this.refreshColorSettingsName("oldest"))})}),this.createColorSetting("newest"),this.createColorSetting("oldest"),new V.Setting(this.containerEl).setName("Text color").addText(a=>{a.setValue(this.settings.lineAuthor.textColorCss),a.onChange(async s=>{await this.lineAuthorSettingHandler("textColorCss",s)})}).descEl.innerHTML=`
|
||
|
The CSS color of the gutter text.<br/>
|
||
|
|
||
|
It is higly recommended to use
|
||
|
<a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties">
|
||
|
CSS variables</a>
|
||
|
defined by themes
|
||
|
(e.g. <pre style="display:inline">var(--text-muted)</pre> or
|
||
|
<pre style="display:inline">var(--text-on-accent)</pre>,
|
||
|
because they automatically adapt to theme changes.<br/>
|
||
|
|
||
|
See: <a href="https://github.com/obsidian-community/obsidian-theme-template/blob/main/obsidian.css">
|
||
|
List of available CSS variables in Obsidian
|
||
|
<a/>
|
||
|
`,new V.Setting(this.containerEl).setName("Ignore whitespace and newlines in changes").addToggle(a=>{a.setValue(this.settings.lineAuthor.ignoreWhitespace),a.onChange(s=>this.lineAuthorSettingHandler("ignoreWhitespace",s))}).descEl.innerHTML=`
|
||
|
Whitespace and newlines are interpreted as
|
||
|
part of the document and in changes
|
||
|
by default (hence not ignored).
|
||
|
This makes the last line being shown as 'changed'
|
||
|
when a new subsequent line is added,
|
||
|
even if the previously last line's text is the same.
|
||
|
<br>
|
||
|
If you don't care about purely-whitespace changes
|
||
|
(e.g. list nesting / quote indentation changes),
|
||
|
then activating this will provide more meaningful change detection.
|
||
|
`}}createColorSetting(n){let r=new V.Setting(this.containerEl).setName("").addText(i=>{let a=vp(n,this.settings.lineAuthor),s=vp(n,Mn.lineAuthor);i.setPlaceholder(ap(s)),i.setValue(ap(a)),i.onChange(async o=>{let l=kS(o);if(l!==void 0){let c=n==="newest"?"colorNew":"colorOld";await this.lineAuthorSettingHandler(c,l)}this.refreshColorSettingsDesc(n,l)})});this.lineAuthorColorSettings.set(n,r),this.refreshColorSettingsName(n),this.refreshColorSettingsDesc(n,vp(n,this.settings.lineAuthor))}refreshColorSettingsName(n){let r=this.lineAuthorColorSettings.get(n);if(r){let i=n==="oldest"?`oldest (${this.settings.lineAuthor.coloringMaxAge} or older)`:"newest";r.nameEl.innerText=`Color for ${i} commits`}}refreshColorSettingsDesc(n,r){let i=this.lineAuthorColorSettings.get(n);i&&(i.descEl.innerHTML=this.colorSettingPreviewDescHtml(n,this.settings.lineAuthor,r!==void 0))}colorSettingPreviewDescHtml(n,r,i){let a=i?wp(n,r):"rgba(127,127,127,0.3)",s=V.moment.unix(V.moment.now()/1e3).format("YYYY-MM-DD"),o=i?`abcdef Author Name ${s}`:"invalid color";return`Supports 'rgb(r,g,b)', 'hsl(h,s,l)', hex (#) and
|
||
|
named colors (e.g. 'black', 'purple'). Color preview: ${`<div
|
||
|
class="line-author-settings-preview"
|
||
|
style="background-color: ${a}; width: 30ch;"
|
||
|
>${o}</div>`}`}previewCustomDateTimeDescriptionHtml(n){let r=(0,V.moment)().format(n);return`<a href="${lL}">Format string</a> to display the authoring date.</br>Currently: ${r}`}previewOldestAgeDescriptionHtml(n){let r=xc(n);return[`The oldest age in the line author coloring. Everything older will have the same color.
|
||
|
</br>Smallest valid age is "1d". Currently: ${r!==void 0?`${r.asDays()} days`:"invalid!"}`,r]}};function vp(t,e){return t==="oldest"?e.colorOld:e.colorNew}function xc(t){let e=V.moment.duration("P"+t.toUpperCase());return e.isValid()&&e.asDays()&&e.asDays()>=1?e:void 0}function qS(t,e,n){if(!(t===void 0||e===void 0||n===void 0))return`head${t}-obj${e}-path${n}`}var XS=_c.Annotation.define();function YS(t,e,n){return n.update({annotations:XS.of({key:t,la:e,lineOffsetsFromUnsavedChanges:new Map})})}function uL(t){return t.annotation(XS)}var sa=_c.StateField.define({create:t=>{},update:(t,e)=>{var n;return(n=uL(e))!=null?n:fL(e,t)},compare:(t,e)=>(t==null?void 0:t.key)===(e==null?void 0:e.key)});function Sc(t){var a;let e=WS.sha256.create();if(!t)return e;let{la:n,key:r,lineOffsetsFromUnsavedChanges:i}=t;e.update(n==="untracked"?"t":"f"),e.update(r);for(let[s,o]of(a=i.entries())!=null?a:[])e.update([s,o]);return e}var an={get:void 0,save:void 0};function ZS(t,e){an.get=t,an.save=e}function Ec(t){var e,n;return(n=(e=xc(t.coloringMaxAge))==null?void 0:e.asDays())!=null?n:xc(Mn.lineAuthor.coloringMaxAge).asDays()}function fL(t,e){if(e)return t.changes.empty||t.changes.iterChanges((n,r,i,a)=>{var p;let s=t.startState.doc,{newDoc:o}=t,l=s.lineAt(n).number,c=s.lineAt(r).number,u=o.lineAt(i).number,f=o.lineAt(a).number,h=c-l+1,d=f-u+1;for(let g=u;g<=f;g++){let m=(p=e.lineOffsetsFromUnsavedChanges.get(g))!=null?p:0,w=f===g,b=d-h;w&&(m+=b),e.lineOffsetsFromUnsavedChanges.set(g,m)}}),e}var bp=class{constructor(e){this.state=e;this.subscribeMe()}notifyLineAuthoring(e,n){if(this.view===void 0){console.warn(`Git: View is not defined for editor cache key. Unforeseen situation. id: ${e}`);return}let r=this.view.state,i=YS(e,n,r);this.view.dispatch(i)}updateToNewState(e){let n=this.lastSeenPath&&this.filepath!=this.lastSeenPath;return this.state=e,n&&(this.unsubscribeMe(this.lastSeenPath),this.subscribeMe()),this}removeIfStale(){this.view.destroyed&&this.unsubscribeMe(this.lastSeenPath)}subscribeMe(){this.filepath!==void 0&&(aa.ifFilepathDefinedTransformSubscribers(this.filepath,e=>e.add(this)),this.lastSeenPath=this.filepath)}unsubscribeMe(e){aa.ifFilepathDefinedTransformSubscribers(e,n=>n.delete(this))}get filepath(){var e,n;return(n=(e=this.state.field(kc.editorInfoField))==null?void 0:e.file)==null?void 0:n.path}get view(){return this.state.field(kc.editorEditorField)}},JS=KS.StateField.define({create:t=>new bp(t),update:(t,e)=>t.updateToNewState(e.state),compare:(t,e)=>t===e});v();function QS(){oa=void 0,xp=[],Ac=0,Cc.clear(),Fc.clear(),la.clear()}var oa,Tc=()=>oa;function eE(t,e){var i;let n=e.length;if(n<((i=oa==null?void 0:oa.length)!=null?i:0))return;oa={gutter:t,length:n,text:e};let r=an.get();n!==r.gutterSpacingFallbackLength&&(r.gutterSpacingFallbackLength=n,an.save(r))}var xp=[],hL=15,Ac=0;function tE(t){xp[Ac]=t,Ac=(Ac+1)%hL}function nE(){return TS(xp)}var Cc=new Map,Fc=new Map,la=new Set;v();var mE=require("@codemirror/state"),gE=require("@codemirror/view");v();var kp=require("@codemirror/view"),fE=Ze(cp()),Pc=require("obsidian");v();v();var Mc={x:-10,y:-10};function rE(){Mc.x===-10&&window.addEventListener("mousedown",t=>{Mc.x=t.clientX,Mc.y=t.clientY})}function iE(){for(let t of la)if(dL(t,Mc))return t}function dL(t,e){let{x:n,y:r,width:i,height:a}=t.getBoundingClientRect();return n<=e.x&&e.x<=n+i&&r<=e.y&&e.y<=r+a}v();var Gs={};var aE="data-commit";function sE(t,e,n){if(e.hasFocus())return;let r=iE();if(!r)return;let i=mL(r);i&&(!i.isZeroCommit&&!i.isWaitingGutter&&pL(i,t),_p("showCommitHash",t),_p("authorDisplay",t),_p("dateTimeFormatOptions",t))}function pL(t,e){e.addItem(n=>n.setTitle("Copy commit hash").setIcon("copy").setSection("obs-git-line-author-copy").onClick(r=>navigator.clipboard.writeText(t.hash)))}function _p(t,e){var l,c;let n,r,i=Gs.plugin.settings.lineAuthor,a=i[t],s=typeof a=="boolean"?a:a!=="hide",o=Mn.lineAuthor[t];if(t==="showCommitHash")n="Show commit hash",r=a;else if(t==="authorDisplay"){let u=(l=i.lastShownAuthorDisplay)!=null?l:o;n="Show author "+(s?a:u),r=s?"hide":u}else if(t==="dat
|
||
|
(${this.unPushedCommits} unpushed commits)`)}else this.statusBarEl.ariaLabel=n?"Git is offline":"Git is ready";n?(0,sn.setIcon)(this.iconEl,"globe"):(0,sn.setIcon)(this.iconEl,"check"),this.plugin.settings.changedFilesInStatusBar&&this.plugin.cachedStatus&&this.textEl.setText(this.plugin.cachedStatus.changed.length.toString()),this.statusBarEl.addClass(this.base+"idle")}async refreshCommitTimestamp(){this.lastCommitTimestamp=await this.plugin.gitManager.getLastCommitTime(),this.unPushedCommits=await this.plugin.gitManager.getUnpushedCommits()}remove(){this.statusBarEl.remove()}};v();var Bc=require("obsidian"),Dc=class extends Bc.SuggestModal{constructor(n){super(n.app);this.plugin=n;this.resolve=null;this.setPlaceholder("Type your message and select optional the version with the added date.")}openAndGetResult(){return new Promise(n=>{this.resolve=n,this.open()})}onClose(){new Promise(n=>setTimeout(n,10)).then(()=>{this.resolve&&this.resolve(void 0)})}getSuggestions(n){let r=(0,Bc.moment)().format(this.plugin.settings.commitDateFormat);return n==""&&(n="..."),[n,`${r}: ${n}`,`${n}: ${r}`]}renderSuggestion(n,r){r.innerText=n}onChooseSuggestion(n,r){this.resolve&&this.resolve(n)}};v();var bE=require("obsidian"),Vs=class{constructor(e){this.plugin=e}saveLastAuto(e,n){n==="backup"?this.plugin.localStorage.setLastAutoBackup(e.toString()):n==="pull"?this.plugin.localStorage.setLastAutoPull(e.toString()):n==="push"&&this.plugin.localStorage.setLastAutoPush(e.toString())}loadLastAuto(){var e,n,r;return{backup:new Date((e=this.plugin.localStorage.getLastAutoBackup())!=null?e:""),pull:new Date((n=this.plugin.localStorage.getLastAutoPull())!=null?n:""),push:new Date((r=this.plugin.localStorage.getLastAutoPush())!=null?r:"")}}async init(){await this.setUpAutoCommitAndSync();let e=this.loadLastAuto();if(this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0){let n=new Date,r=this.plugin.settings.autoPushInterval-Math.round((n.getTime()-e.push.getTime())/1e3/60);this.startAutoPush(r<=0?0:r)}if(this.plugin.settings.autoPullInterval>0){let n=new Date,r=this.plugin.settings.autoPullInterval-Math.round((n.getTime()-e.pull.getTime())/1e3/60);this.startAutoPull(r<=0?0:r)}}unload(){this.clearAutoPull(),this.clearAutoPush(),this.clearAutoCommitAndSync()}reload(...e){e.contains("commit")&&(this.clearAutoCommitAndSync(),this.plugin.settings.autoSaveInterval>0&&this.startAutoCommitAndSync(this.plugin.settings.autoSaveInterval)),e.contains("push")&&(this.clearAutoPush(),this.plugin.settings.differentIntervalCommitAndPush&&this.plugin.settings.autoPushInterval>0&&this.startAutoPush(this.plugin.settings.autoPushInterval)),e.contains("pull")&&(this.clearAutoPull(),this.plugin.settings.autoPullInterval>0&&this.startAutoPull(this.plugin.settings.autoPullInterval))}async setUpAutoCommitAndSync(){if(this.plugin.settings.setLastSaveToLastCommit){this.clearAutoCommitAndSync();let e=await this.plugin.gitManager.getLastCommitTime();e&&this.plugin.localStorage.setLastAutoBackup(e.toString())}if(!this.timeoutIDCommitAndSync&&!this.plugin.autoCommitDebouncer){let e=this.loadLastAuto();if(this.plugin.settings.autoSaveInterval>0){let n=new Date,r=this.plugin.settings.autoSaveInterval-Math.round((n.getTime()-e.backup.getTime())/1e3/60);this.startAutoCommitAndSync(r<=0?0:r)}}}startAutoCommitAndSync(e){let n=(e!=null?e:this.plugin.settings.autoSaveInterval)*6e4;this.plugin.settings.autoBackupAfterFileChange?e===0?this.doAutoCommitAndSync():this.plugin.autoCommitDebouncer=(0,bE.debounce)(()=>this.doAutoCommitAndSync(),n,!0):(n>2147483647&&(n=2147483647),this.timeoutIDCommitAndSync=window.setTimeout(()=>this.doAutoCommitAndSync(),n))}doAutoCommitAndSync(){this.plugin.promiseQueue.addTask(()=>this.plugin.settings.differentIntervalCommitAndPush?this.plugin.commit({fromAuto:!0}):this.plugin.commitAndSync(!0)),this.saveLastAuto(new Date,"backup"),this.startAutoCommitAndSync()}startAutoPull(e){let n=(e!=null?e:this.plugin.settings.autoPullInterval)*6e4;n>2147483647&&(n=2147483647),this.timeoutIDPull=window.setTimeout(()=>{this.plugin.
|
||
|
`).split(`
|
||
|
`);function Y(){i!==null&&r!==null&&(r.blocks.push(i),i=null)}function le(){r!==null&&(!r.oldName&&l!==null&&(r.oldName=l),!r.newName&&c!==null&&(r.newName=c),r.newName&&(n.push(r),r=null)),l=null,c=null}function he(){Y(),le(),r={blocks:[],deletedLines:0,addedLines:0}}function ie($){Y();let G;r!==null&&((G=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec($))?(r.isCombined=!1,a=parseInt(G[1],10),o=parseInt(G[2],10)):(G=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec($))?(r.isCombined=!0,a=parseInt(G[1],10),s=parseInt(G[2],10),o=parseInt(G[3],10)):($.startsWith(h)&&console.error("Failed to parse lines, starting in 0!"),a=0,o=0,r.isCombined=!1)),i={lines:[],oldStartLine:a,oldStartLine2:s,newStartLine:o,header:$}}function Me($){if(r===null||i===null||a===null||o===null)return;let G={content:$},D=r.isCombined?["+ "," +","++"]:["+"],se=r.isCombined?["- "," -","--"]:["-"];IE($,D)?(r.addedLines++,G.type=$e.INSERT,G.oldNumber=void 0,G.newNumber=o++):IE($,se)?(r.deletedLines++,G.type=$e.DELETE,G.oldNumber=a++,G.newNumber=void 0):(G.type=$e.CONTEXT,G.oldNumber=a++,G.newNumber=o++),i.lines.push(G)}function de($,G){let D=G;for(;D<j.length-3;){if($.startsWith("diff"))return!1;if(j[D].startsWith(u)&&j[D+1].startsWith(f)&&j[D+2].startsWith(h))return!0;D++}return!1}return j.forEach(($,G)=>{if(!$||$.startsWith("*"))return;let D,se=j[G-1],Se=j[G+1],mt=j[G+2];if($.startsWith("diff --git")||$.startsWith("diff --combined")){if(he(),(D=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec($))&&(l=xr(D[1],void 0,e.dstPrefix),c=xr(D[2],void 0,e.srcPrefix)),r===null)throw new Error("Where is my file !!!");r.isGitDiff=!0;return}if($.startsWith("Binary files")&&!(r!=null&&r.isGitDiff)){if(he(),(D=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec($))&&(l=xr(D[1],void 0,e.dstPrefix),c=xr(D[2],void 0,e.srcPrefix)),r===null)throw new Error("Where is my file !!!");r.isBinary=!0;return}if((!r||!r.isGitDiff&&r&&$.startsWith(u)&&Se.startsWith(f)&&mt.startsWith(h))&&he(),r!=null&&r.isTooBig)return;if(r&&(typeof e.diffMaxChanges=="number"&&r.addedLines+r.deletedLines>e.diffMaxChanges||typeof e.diffMaxLineLength=="number"&&$.length>e.diffMaxLineLength)){r.isTooBig=!0,r.addedLines=0,r.deletedLines=0,r.blocks=[],i=null;let st=typeof e.diffTooBigMessage=="function"?e.diffTooBigMessage(n.length):"Diff too big to be displayed";ie(st);return}if($.startsWith(u)&&Se.startsWith(f)||$.startsWith(f)&&se.startsWith(u)){if(r&&!r.oldName&&$.startsWith("--- ")&&(D=FL($,e.srcPrefix))){r.oldName=D,r.language=PE(r.oldName,r.language);return}if(r&&!r.newName&&$.startsWith("+++ ")&&(D=ML($,e.dstPrefix))){r.newName=D,r.language=PE(r.newName,r.language);return}}if(r&&($.startsWith(h)||r.isGitDiff&&r.oldName&&r.newName&&!i)){ie($);return}if(i&&($.startsWith("+")||$.startsWith("-")||$.startsWith(" "))){Me($);return}let be=!de($,G);if(r===null)throw new Error("Where is my file !!!");(D=d.exec($))?r.oldMode=D[1]:(D=p.exec($))?r.newMode=D[1]:(D=g.exec($))?(r.deletedFileMode=D[1],r.isDeleted=!0):(D=m.exec($))?(r.newFileMode=D[1],r.isNew=!0):(D=w.exec($))?(be&&(r.oldName=D[1]),r.isCopy=!0):(D=b.exec($))?(be&&(r.newName=D[1]),r.isCopy=!0):(D=S.exec($))?(be&&(r.oldName=D[1]),r.isRename=!0):(D=k.exec($))?(be&&(r.newName=D[1]),r.isRename=!0):(D=E.exec($))?(r.isBinary=!0,r.oldName=xr(D[1],void 0,e.srcPrefix),r.newName=xr(D[2],void 0,e.dstPrefix),ie("Binary file")):_.test($)?(r.isBinary=!0,ie($)):(D=x.exec($))?r.unchangedPercentage=parseInt(D[1],10):(D=A.exec($))?r.changedPercentage=parseInt(D[1],10):(D=y.exec($))?(r.checksumBefore=D[1],r.checksumAfter=D[2],D[3]&&(r.mode=D[3])):(D=C.exec($))?(r.checksumBefore=[D[2],D[3]],r.checksumAfter=D[1]):(D=M.exec($))?(r.oldMode=[D[2],D[3]],r.newMode=D[1]):(D=L.exec($))?(r.newFileMode=D[1],r.isNew=!0):(D=N.exec($))&&(r.deletedFileMode=D[1],r.isDeleted=!0)}),Y(),le(),n}v();v();v();function Xn(){}Xn.prototype={diff:function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.callback;typeof r=="function"&&(i=r,r={}),this.options=r;var a=this;function s(g){return i?(setTimeout(function(){i(void
|
||
|
`);return this.hoganUtils.render(UE,"wrapper",{colorScheme:da(this.config.colorScheme),filesNumber:e.length,files:n})}};v();var jp=Object.assign(Object.assign({},ri),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Ys="generic",zE="line-by-line",WL="icon",qL="tag",Zs=class{constructor(e,n={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},jp),n)}render(e){let n=e.map(r=>{let i;return r.blocks.length?i=this.generateFileHtml(r):i=this.generateEmptyDiff(),this.makeFileDiffHtml(r,i)}).join(`
|
||
|
`);return this.hoganUtils.render(Ys,"wrapper",{colorScheme:da(this.config.colorScheme),content:n})}makeFileDiffHtml(e,n){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let r=this.hoganUtils.template(zE,"file-diff"),i=this.hoganUtils.template(Ys,"file-path"),a=this.hoganUtils.template(WL,"file"),s=this.hoganUtils.template(qL,ma(e));return r.render({file:e,fileHtmlId:pa(e),diffs:n,filePath:i.render({fileDiffName:ii(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return this.hoganUtils.render(Ys,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:pt})}generateFileHtml(e){let n=fa(ua(r=>on(r.content,e.isCombined).content));return e.blocks.map(r=>{let i=this.hoganUtils.render(Ys,"block-header",{CSSLineClass:pt,blockHeader:e.isTooBig?r.header:_r(r.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(r).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,n).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e,e.isCombined,l,c);i+=u,i+=f});else if(a.length)a.forEach(l=>{let{prefix:c,content:u}=on(l.content,e.isCombined);i+=this.generateSingleLineHtml(e,{type:pt.CONTEXT,prefix:c,content:u,oldNumber:l.oldNumber,newNumber:l.newNumber})});else if(s.length||o.length){let{left:l,right:c}=this.processChangedLines(e,e.isCombined,s,o);i+=l,i+=c}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).join(`
|
||
|
`)}applyLineGroupping(e){let n=[],r=[],i=[];for(let a=0;a<e.lines.length;a++){let s=e.lines[a];(s.type!==$e.INSERT&&i.length||s.type===$e.CONTEXT&&r.length>0)&&(n.push([[],r,i]),r=[],i=[]),s.type===$e.CONTEXT?n.push([[s],[],[]]):s.type===$e.INSERT&&r.length===0?n.push([[],[],[s]]):s.type===$e.INSERT&&r.length>0?i.push(s):s.type===$e.DELETE&&r.push(s)}return(r.length||i.length)&&(n.push([[],r,i]),r=[],i=[]),n}applyRematchMatching(e,n,r){let i=e.length*n.length,a=Math.max.apply(null,[0].concat(e.concat(n).map(o=>o.content.length)));return i<this.config.matchingMaxComparisons&&a<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?r(e,n):[[e,n]]}processChangedLines(e,n,r,i){let a={right:"",left:""},s=Math.max(r.length,i.length);for(let o=0;o<s;o++){let l=r[o],c=i[o],u=l!==void 0&&c!==void 0?zc(l.content,c.content,n,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:pt.DELETE_CHANGES}:Object.assign(Object.assign({},on(l.content,n)),{type:ha(l.type)})),{oldNumber:l.oldNumber,newNumber:l.newNumber}):void 0,h=c!==void 0&&c.newNumber!==void 0?Object.assign(Object.assign({},u!==void 0?{prefix:u.newLine.prefix,content:u.newLine.content,type:pt.INSERT_CHANGES}:Object.assign(Object.assign({},on(c.content,n)),{type:ha(c.type)})),{oldNumber:c.oldNumber,newNumber:c.newNumber}):void 0,{left:d,right:p}=this.generateLineHtml(e,f,h);a.left+=d,a.right+=p}return a}generateLineHtml(e,n,r){return{left:this.generateSingleLineHtml(e,n),right:this.generateSingleLineHtml(e,r)}}generateSingleLineHtml(e,n){if(n===void 0)return"";let r=this.hoganUtils.render(zE,"numbers",{oldNumber:n.oldNumber||"",newNumber:n.newNumber||""});return this.hoganUtils.render(Ys,"line",{type:n.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:n.prefix===" "?" ":n.prefix,content:n.content,lineNumber:r,line:n,file:e})}};v();var Dp=Object.assign(Object.assign({},ri),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),Ks="generic",XL="side-by-side",YL="icon",ZL="tag",Js=class{constructor(e,n={}){this.hoganUtils=e,this.config=Object.assign(Object.assign({},Dp),n)}render(e){let n=e.map(r=>{let i;return r.blocks.length?i=this.generateFileHtml(r):i=this.generateEmptyDiff(),this.makeFileDiffHtml(r,i)}).join(`
|
||
|
`);return this.hoganUtils.render(Ks,"wrapper",{colorScheme:da(this.config.colorScheme),content:n})}makeFileDiffHtml(e,n){if(this.config.renderNothingWhenEmpty&&Array.isArray(e.blocks)&&e.blocks.length===0)return"";let r=this.hoganUtils.template(XL,"file-diff"),i=this.hoganUtils.template(Ks,"file-path"),a=this.hoganUtils.template(YL,"file"),s=this.hoganUtils.template(ZL,ma(e));return r.render({file:e,fileHtmlId:pa(e),diffs:n,filePath:i.render({fileDiffName:ii(e)},{fileIcon:a,fileTag:s})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(Ks,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:pt})}}generateFileHtml(e){let n=fa(ua(r=>on(r.content,e.isCombined).content));return e.blocks.map(r=>{let i={left:this.makeHeaderHtml(r.header,e),right:this.makeHeaderHtml("")};return this.applyLineGroupping(r).forEach(([a,s,o])=>{if(s.length&&o.length&&!a.length)this.applyRematchMatching(s,o,n).map(([l,c])=>{let{left:u,right:f}=this.processChangedLines(e.isCombined,l,c);i.left+=u,i.right+=f});else if(a.length)a.forEach(l=>{let{prefix:c,content:u}=on(l.content,e.isCombined),{left:f,right:h}=this.generateLineHtml({type:pt.CONTEXT,prefix:c,content:u,number:l.oldNumber},{type:pt.CONTEXT,prefix:c,content:u,number:l.newNumber});i.left+=f,i.right+=h});else if(s.length||o.length){let{left:l,right:c}=this.processChangedLines(e.isCombined,s,o);i.left+=l,i.right+=c}else console.error("Unknown state reached while processing groups of lines",a,s,o)}),i}).reduce((r,i)=>({left:r.left+i.left,right:r.right+i.right}),{left:"",right:""})}applyLineGroupping(e){let n=[],r=[],i=[];for(let a=0;a<e.lines.length;a++){let s=e.lines[a];(s.type!==$e.INSERT&&i.length||s.type===$e.CONTEXT&&r.length>0)&&(n.push([[],r,i]),r=[],i=[]),s.type===$e.CONTEXT?n.push([[s],[],[]]):s.type===$e.INSERT&&r.length===0?n.push([[],[],[s]]):s.type===$e.INSERT&&r.length>0?i.push(s):s.type===$e.DELETE&&r.push(s)}return(r.length||i.length)&&(n.push([[],r,i]),r=[],i=[]),n}applyRematchMatching(e,n,r){let i=e.length*n.length,a=Math.max.apply(null,[0].concat(e.concat(n).map(o=>o.content.length)));return i<this.config.matchingMaxComparisons&&a<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?r(e,n):[[e,n]]}makeHeaderHtml(e,n){return this.hoganUtils.render(Ks,"block-header",{CSSLineClass:pt,blockHeader:n!=null&&n.isTooBig?e:_r(e),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(e,n,r){let i={right:"",left:""},a=Math.max(n.length,r.length);for(let s=0;s<a;s++){let o=n[s],l=r[s],c=o!==void 0&&l!==void 0?zc(o.content,l.content,e,this.config):void 0,u=o!==void 0&&o.oldNumber!==void 0?Object.assign(Object.assign({},c!==void 0?{prefix:c.oldLine.prefix,content:c.oldLine.content,type:pt.DELETE_CHANGES}:Object.assign(Object.assign({},on(o.content,e)),{type:ha(o.type)})),{number:o.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:pt.INSERT_CHANGES}:Object.assign(Object.assign({},on(l.content,e)),{type:ha(l.type)})),{number:l.newNumber}):void 0,{left:h,right:d}=this.generateLineHtml(u,f);i.left+=h,i.right+=d}return i}generateLineHtml(e,n){return{left:this.generateSingleHtml(e),right:this.generateSingleHtml(n)}}generateSingleHtml(e){let n="d2h-code-side-linenumber",r="d2h-code-side-line";return this.hoganUtils.render(Ks,"line",{type:(e==null?void 0:e.type)||`${pt.CONTEXT} d2h-emptyplaceholder`,lineClass:e!==void 0?n:`${n} d2h-code-side-emptyplaceholder`,contentClass:e!==void 0?r:`${r} d2h-code-side-emptyplaceholder`,prefix:(e==null?void 0:e.prefix)===" "?" ":e==null?void 0:e.prefix,content:e==null?void 0:e.content,lineNumber:e==null?void 0:e.number})}};v();var Hp=Ze($p());v();var rt=Ze($p()),et={};et["file-summary-line"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<li class="d2h-file-list-line">'),r.b(`
|
||
|
`+n),r.b(' <span class="d2h-file-name-wrapper">'),r.b(`
|
||
|
`+n),r.b(r.rp("<fileIcon0",t,e," ")),r.b(' <a href="#'),r.b(r.v(r.f("fileHtmlId",t,e,0))),r.b('" class="d2h-file-name">'),r.b(r.v(r.f("fileName",t,e,0))),r.b("</a>"),r.b(`
|
||
|
`+n),r.b(' <span class="d2h-file-stats">'),r.b(`
|
||
|
`+n),r.b(' <span class="d2h-lines-added">'),r.b(r.v(r.f("addedLines",t,e,0))),r.b("</span>"),r.b(`
|
||
|
`+n),r.b(' <span class="d2h-lines-deleted">'),r.b(r.v(r.f("deletedLines",t,e,0))),r.b("</span>"),r.b(`
|
||
|
`+n),r.b(" </span>"),r.b(`
|
||
|
`+n),r.b(" </span>"),r.b(`
|
||
|
`+n),r.b("</li>"),r.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});et["file-summary-wrapper"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<div class="d2h-file-list-wrapper '),r.b(r.v(r.f("colorScheme",t,e,0))),r.b('">'),r.b(`
|
||
|
`+n),r.b(' <div class="d2h-file-list-header">'),r.b(`
|
||
|
`+n),r.b(' <span class="d2h-file-list-title">Files changed ('),r.b(r.v(r.f("filesNumber",t,e,0))),r.b(")</span>"),r.b(`
|
||
|
`+n),r.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),r.b(`
|
||
|
`+n),r.b(' <a class="d2h-file-switch d2h-show">show</a>'),r.b(`
|
||
|
`+n),r.b(" </div>"),r.b(`
|
||
|
`+n),r.b(' <ol class="d2h-file-list">'),r.b(`
|
||
|
`+n),r.b(" "),r.b(r.t(r.f("files",t,e,0))),r.b(`
|
||
|
`+n),r.b(" </ol>"),r.b(`
|
||
|
`+n),r.b("</div>"),r.fl()},partials:{},subs:{}});et["generic-block-header"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b("<tr>"),r.b(`
|
||
|
`+n),r.b(' <td class="'),r.b(r.v(r.f("lineClass",t,e,0))),r.b(" "),r.b(r.v(r.d("CSSLineClass.INFO",t,e,0))),r.b('"></td>'),r.b(`
|
||
|
`+n),r.b(' <td class="'),r.b(r.v(r.d("CSSLineClass.INFO",t,e,0))),r.b('">'),r.b(`
|
||
|
`+n),r.b(' <div class="'),r.b(r.v(r.f("contentClass",t,e,0))),r.b('">'),r.s(r.f("blockHeader",t,e,1),t,e,0,156,173,"{{ }}")&&(r.rs(t,e,function(i,a,s){s.b(s.t(s.f("blockHeader",i,a,0)))}),t.pop()),r.s(r.f("blockHeader",t,e,1),t,e,1,0,0,"")||r.b(" "),r.b("</div>"),r.b(`
|
||
|
`+n),r.b(" </td>"),r.b(`
|
||
|
`+n),r.b("</tr>"),r.fl()},partials:{},subs:{}});et["generic-empty-diff"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b("<tr>"),r.b(`
|
||
|
`+n),r.b(' <td class="'),r.b(r.v(r.d("CSSLineClass.INFO",t,e,0))),r.b('">'),r.b(`
|
||
|
`+n),r.b(' <div class="'),r.b(r.v(r.f("contentClass",t,e,0))),r.b('">'),r.b(`
|
||
|
`+n),r.b(" File without changes"),r.b(`
|
||
|
`+n),r.b(" </div>"),r.b(`
|
||
|
`+n),r.b(" </td>"),r.b(`
|
||
|
`+n),r.b("</tr>"),r.fl()},partials:{},subs:{}});et["generic-file-path"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<span class="d2h-file-name-wrapper">'),r.b(`
|
||
|
`+n),r.b(r.rp("<fileIcon0",t,e," ")),r.b(' <span class="d2h-file-name">'),r.b(r.v(r.f("fileDiffName",t,e,0))),r.b("</span>"),r.b(`
|
||
|
`+n),r.b(r.rp("<fileTag1",t,e," ")),r.b("</span>"),r.b(`
|
||
|
`+n),r.b('<label class="d2h-file-collapse">'),r.b(`
|
||
|
`+n),r.b(' <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">'),r.b(`
|
||
|
`+n),r.b(" Viewed"),r.b(`
|
||
|
`+n),r.b("</label>"),r.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});et["generic-line"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b("<tr>"),r.b(`
|
||
|
`+n),r.b(' <td class="'),r.b(r.v(r.f("lineClass",t,e,0))),r.b(" "),r.b(r.v(r.f("type",t,e,0))),r.b('">'),r.b(`
|
||
|
`+n),r.b(" "),r.b(r.t(r.f("lineNumber",t,e,0))),r.b(`
|
||
|
`+n),r.b(" </td>"),r.b(`
|
||
|
`+n),r.b(' <td class="'),r.b(r.v(r.f("type",t,e,0))),r.b('">'),r.b(`
|
||
|
`+n),r.b(' <div class="'),r.b(r.v(r.f("contentClass",t,e,0))),r.b('">'),r.b(`
|
||
|
`+n),r.s(r.f("prefix",t,e,1),t,e,0,162,238,"{{ }}")&&(r.rs(t,e,function(i,a,s){s.b(' <span class="d2h-code-line-prefix">'),s.b(s.t(s.f("prefix",i,a,0))),s.b("</span>"),s.b(`
|
||
|
`+n)}),t.pop()),r.s(r.f("prefix",t,e,1),t,e,1,0,0,"")||(r.b(' <span class="d2h-code-line-prefix"> </span>'),r.b(`
|
||
|
`+n)),r.s(r.f("content",t,e,1),t,e,0,371,445,"{{ }}")&&(r.rs(t,e,function(i,a,s){s.b(' <span class="d2h-code-line-ctn">'),s.b(s.t(s.f("content",i,a,0))),s.b("</span>"),s.b(`
|
||
|
`+n)}),t.pop()),r.s(r.f("content",t,e,1),t,e,1,0,0,"")||(r.b(' <span class="d2h-code-line-ctn"><br></span>'),r.b(`
|
||
|
`+n)),r.b(" </div>"),r.b(`
|
||
|
`+n),r.b(" </td>"),r.b(`
|
||
|
`+n),r.b("</tr>"),r.fl()},partials:{},subs:{}});et["generic-wrapper"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<div class="d2h-wrapper '),r.b(r.v(r.f("colorScheme",t,e,0))),r.b('">'),r.b(`
|
||
|
`+n),r.b(" "),r.b(r.t(r.f("content",t,e,0))),r.b(`
|
||
|
`+n),r.b("</div>"),r.fl()},partials:{},subs:{}});et["icon-file-added"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),r.b(`
|
||
|
`+n),r.b(' width="14">'),r.b(`
|
||
|
`+n),r.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>'),r.b(`
|
||
|
`+n),r.b("</svg>"),r.fl()},partials:{},subs:{}});et["icon-file-changed"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),r.b(`
|
||
|
`+n),r.b(' viewBox="0 0 14 16" width="14">'),r.b(`
|
||
|
`+n),r.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>'),r.b(`
|
||
|
`+n),r.b("</svg>"),r.fl()},partials:{},subs:{}});et["icon-file-deleted"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),r.b(`
|
||
|
`+n),r.b(' viewBox="0 0 14 16" width="14">'),r.b(`
|
||
|
`+n),r.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>'),r.b(`
|
||
|
`+n),r.b("</svg>"),r.fl()},partials:{},subs:{}});et["icon-file-renamed"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),r.b(`
|
||
|
`+n),r.b(' viewBox="0 0 14 16" width="14">'),r.b(`
|
||
|
`+n),r.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>'),r.b(`
|
||
|
`+n),r.b("</svg>"),r.fl()},partials:{},subs:{}});et["icon-file"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),r.b(`
|
||
|
`+n),r.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>'),r.b(`
|
||
|
`+n),r.b("</svg>"),r.fl()},partials:{},subs:{}});et["line-by-line-file-diff"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<div id="'),r.b(r.v(r.f("fileHtmlId",t,e,0))),r.b('" class="d2h-file-wrapper" data-lang="'),r.b(r.v(r.d("file.language",t,e,0))),r.b('">'),r.b(`
|
||
|
`+n),r.b(' <div class="d2h-file-header">'),r.b(`
|
||
|
`+n),r.b(" "),r.b(r.t(r.f("filePath",t,e,0))),r.b(`
|
||
|
`+n),r.b(" </div>"),r.b(`
|
||
|
`+n),r.b(' <div class="d2h-file-diff">'),r.b(`
|
||
|
`+n),r.b(' <div class="d2h-code-wrapper">'),r.b(`
|
||
|
`+n),r.b(' <table class="d2h-diff-table">'),r.b(`
|
||
|
`+n),r.b(' <tbody class="d2h-diff-tbody">'),r.b(`
|
||
|
`+n),r.b(" "),r.b(r.t(r.f("diffs",t,e,0))),r.b(`
|
||
|
`+n),r.b(" </tbody>"),r.b(`
|
||
|
`+n),r.b(" </table>"),r.b(`
|
||
|
`+n),r.b(" </div>"),r.b(`
|
||
|
`+n),r.b(" </div>"),r.b(`
|
||
|
`+n),r.b("</div>"),r.fl()},partials:{},subs:{}});et["line-by-line-numbers"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<div class="line-num1">'),r.b(r.v(r.f("oldNumber",t,e,0))),r.b("</div>"),r.b(`
|
||
|
`+n),r.b('<div class="line-num2">'),r.b(r.v(r.f("newNumber",t,e,0))),r.b("</div>"),r.fl()},partials:{},subs:{}});et["side-by-side-file-diff"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<div id="'),r.b(r.v(r.f("fileHtmlId",t,e,0))),r.b('" class="d2h-file-wrapper" data-lang="'),r.b(r.v(r.d("file.language",t,e,0))),r.b('">'),r.b(`
|
||
|
`+n),r.b(' <div class="d2h-file-header">'),r.b(`
|
||
|
`+n),r.b(" "),r.b(r.t(r.f("filePath",t,e,0))),r.b(`
|
||
|
`+n),r.b(" </div>"),r.b(`
|
||
|
`+n),r.b(' <div class="d2h-files-diff">'),r.b(`
|
||
|
`+n),r.b(' <div class="d2h-file-side-diff">'),r.b(`
|
||
|
`+n),r.b(' <div class="d2h-code-wrapper">'),r.b(`
|
||
|
`+n),r.b(' <table class="d2h-diff-table">'),r.b(`
|
||
|
`+n),r.b(' <tbody class="d2h-diff-tbody">'),r.b(`
|
||
|
`+n),r.b(" "),r.b(r.t(r.d("diffs.left",t,e,0))),r.b(`
|
||
|
`+n),r.b(" </tbody>"),r.b(`
|
||
|
`+n),r.b(" </table>"),r.b(`
|
||
|
`+n),r.b(" </div>"),r.b(`
|
||
|
`+n),r.b(" </div>"),r.b(`
|
||
|
`+n),r.b(' <div class="d2h-file-side-diff">'),r.b(`
|
||
|
`+n),r.b(' <div class="d2h-code-wrapper">'),r.b(`
|
||
|
`+n),r.b(' <table class="d2h-diff-table">'),r.b(`
|
||
|
`+n),r.b(' <tbody class="d2h-diff-tbody">'),r.b(`
|
||
|
`+n),r.b(" "),r.b(r.t(r.d("diffs.right",t,e,0))),r.b(`
|
||
|
`+n),r.b(" </tbody>"),r.b(`
|
||
|
`+n),r.b(" </table>"),r.b(`
|
||
|
`+n),r.b(" </div>"),r.b(`
|
||
|
`+n),r.b(" </div>"),r.b(`
|
||
|
`+n),r.b(" </div>"),r.b(`
|
||
|
`+n),r.b("</div>"),r.fl()},partials:{},subs:{}});et["tag-file-added"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),r.fl()},partials:{},subs:{}});et["tag-file-changed"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),r.fl()},partials:{},subs:{}});et["tag-file-deleted"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),r.fl()},partials:{},subs:{}});et["tag-file-renamed"]=new rt.Template({code:function(t,e,n){var r=this;return r.b(n=n||""),r.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),r.fl()},partials:{},subs:{}});var Qs=class{constructor({compiledTemplates:e={},rawTemplates:n={}}){let r=Object.entries(n).reduce((i,[a,s])=>{let o=Hp.compile(s,{asString:!1});return Object.assign(Object.assign({},i),{[a]:o})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},et),e),r)}static compile(e){return Hp.compile(e,{asString:!1})}render(e,n,r,i,a){let s=this.templateKey(e,n);try{return this.preCompiledTemplates[s].render(r,i,a)}catch(o){throw new Error(`Could not find template to render '${s}'`)}}template(e,n){return this.preCompiledTemplates[this.templateKey(e,n)]}templateKey(e,n){return`${e}-${n}`}};var JL=Object.assign(Object.assign(Object.assign({},jp),Dp),{outputFormat:TE.LINE_BY_LINE,drawFileList:!0});function qE(t,e={}){let n=Object.assign(Object.assign({},JL),e),r=typeof t=="string"?LE(t,n):t,i=new Qs(n),{colorScheme:a}=n,s={colorScheme:a},o=n.drawFileList?new Gc(i,s).render(r):"",l=n.outputFormat==="side-by-side"?new Js(i,n).render(r):new Zs(i,n).render(r);return o+l}var Wc=require("obsidian");var ga=class extends Wc.ItemView{constructor(n,r){super(n);this.plugin=r;this.gettingDiff=!1;this.parser=new DOMParser,this.navigation=!0,this.gitRefreshRef=this.app.workspace.on("obsidian-git:refresh",()=>{this.refresh().catch(console.error)}),this.gitViewRefreshRef=this.app.workspace.on("obsidian-git:view-refresh",()=>{this.refresh().catch(console.error)})}getViewType(){return Ct.type}getDisplayText(){var n;if(((n=this.state)==null?void 0:n.file)!=null){let r=this.state.file.split("/").last();return r!=null&&r.endsWith(".md")&&(r=r.slice(0,-3)),Ct.name+` (${r})`}return Ct.name}getIcon(){return Ct.icon}async setState(n,r){this.state=n,Wc.Platform.isMobile&&(this.leaf.view.titleEl.textContent=this.getDisplayText()),await this.refresh()}getState(){return this.state}onClose(){return this.app.workspace.offref(this.gitRefreshRef),this.app.workspace.offref(this.gitViewRefreshRef),super.onClose()}async onOpen(){return await this.refresh(),super.onOpen()}async refresh(){var n;if((n=this.state)!=null&&n.file&&!this.gettingDiff&&this.plugin.gitManager){this.gettingDiff=!0;try{let r=await this.plugin.gitManager.getDiffString(this.state.file,this.state.staged,this.state.hash);this.contentEl.empty();let i=this.plugin.gitManager.getRelativeVaultPath(this.state.file);if(!r){if(this.plugin.gitManager instanceof Le&&await this.plugin.gitManager.isTracked(this.state.file))r=[`--- ${this.state.file}`,`+++ ${this.state.file}`,""].join(`
|
||
|
`);else if(await this.app.vault.adapter.exists(i)){let a=await this.app.vault.adapter.read(i);r=[...`--- /dev/null
|
||
|
+++ ${this.state.file}
|
||
|
@@ -0,0 +1,${a.split(`
|
||
|
`).length} @@`.split(`
|
||
|
`),...a.split(`
|
||
|
`).map(o=>`+${o}`)].join(`
|
||
|
`)}}if(r){let a=this.parser.parseFromString(qE(r),"text/html").querySelector(".d2h-file-diff");this.contentEl.append(a)}else{let a=this.contentEl.createDiv({cls:"obsidian-git-center"});a.createSpan({text:"\u26A0\uFE0F",attr:{style:"font-size: 2em"}}),a.createEl("br"),a.createSpan({text:"File not found: "+this.state.file})}}finally{this.gettingDiff=!1}}}};v();var Ak=require("obsidian");v();v();v();v();function ke(){}var eo=t=>t;function Up(t){return t()}function qc(){return Object.create(null)}function Ae(t){t.forEach(Up)}function ya(t){return typeof t=="function"}function it(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function XE(t){return Object.keys(t).length===0}v();var YE=typeof window!="undefined",zp=YE?()=>window.performance.now():()=>Date.now(),to=YE?t=>requestAnimationFrame(t):ke;v();var va=new Set;function ZE(t){va.forEach(e=>{e.c(t)||(va.delete(e),e.f())}),va.size!==0&&to(ZE)}function Gp(t){let e;return va.size===0&&to(ZE),{promise:new Promise(n=>{va.add(e={c:t,f:n})}),abort(){va.delete(e)}}}v();v();v();v();var Vp=typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:global;var Xc=class t{constructor(e){ct(this,"_listeners","WeakMap"in Vp?new WeakMap:void 0);ct(this,"_observer");ct(this,"options");this.options=e}observe(e,n){return this._listeners.set(e,n),this._getObserver().observe(e,this.options),()=>{this._listeners.delete(e),this._observer.unobserve(e)}}_getObserver(){var e;return(e=this._observer)!=null?e:this._observer=new ResizeObserver(n=>{var r;for(let i of n)t.entries.set(i.target,i),(r=this._listeners.get(i.target))==null||r(i)})}};Xc.entries="WeakMap"in Vp?new WeakMap:void 0;var KE=!1;function JE(){KE=!0}function QE(){KE=!1}function O(t,e){t.appendChild(e)}function Nt(t,e,n){let r=Yc(t);if(!r.getElementById(e)){let i=I("style");i.id=e,i.textContent=n,tk(r,i)}}function Yc(t){if(!t)return document;let e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function ek(t){let e=I("style");return e.textContent="/* empty */",tk(Yc(t),e),e.sheet}function tk(t,e){return O(t.head||t,e),e.sheet}function re(t,e,n){t.insertBefore(e,n||null)}function ne(t){t.parentNode&&t.parentNode.removeChild(t)}function ln(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function I(t){return document.createElement(t)}function Te(t){return document.createTextNode(t)}function J(){return Te(" ")}function wa(){return Te("")}function te(t,e,n,r){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}function xe(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function T(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function nk(t){return Array.from(t.childNodes)}function Oe(t,e){e=""+e,t.data!==e&&(t.data=e)}function Wp(t,e){t.value=e==null?"":e}function Yt(t,e,n,r){n==null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function ce(t,e,n){t.classList.toggle(e,!!n)}function Zc(t,e,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:r})}function rk(t){let e={};return t.childNodes.forEach(n=>{e[n.slot||"default"]=!0}),e}var Kc=new Map,Jc=0;function ej(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}function tj(t,e){let n={stylesheet:ek(e),rules:{}};return Kc.set(t,n),n}function Qc(t,e,n,r,i,a,s,o=0){let l=16.666/r,c=`{
|
||
|
`;for(let m=0;m<=1;m+=l){let w=e+(n-e)*a(m);c+=m*100+`%{${s(w,1-w)}}
|
||
|
`}let u=c+`100% {${s(n,1-n)}}
|
||
|
}`,f=`__svelte_${ej(u)}_${o}`,h=Yc(t),{stylesheet:d,rules:p}=Kc.get(h)||tj(h,t);p[f]||(p[f]=!0,d.insertRule(`@keyframes ${f} ${u}`,d.cssRules.length));let g=t.style.animation||"";return t.style.animation=`${g?`${g}, `:""}${f} ${r}ms linear ${i}ms 1 both`,Jc+=1,f}function qp(t,e){let n=(t.style.animation||"").split(", "),r=n.filter(e?a=>a.indexOf(e)<0:a=>a.indexOf("__svelte")===-1),i=n.length-r.length;i&&(t.style.animation=r.join(", "),Jc-=i,Jc||nj())}function nj(){to(()=>{Jc||(Kc.forEach(t=>{let{ownerNode:e}=t.stylesheet;e&&ne(e)}),Kc.clear())})}v();v();v();v();var Sr;function Yn(t){Sr=t}function ik(){if(!Sr)throw new Error("Function called outside component initialization");return Sr}function no(t){ik().$$.on_destroy.push(t)}function Er(t,e){let n=t.$$.callbacks[e.type];n&&n.slice().forEach(r=>r.call(this,e))}var ai=[];var je=[],xa=[],ak=[],rj=Promise.resolve(),Yp=!1;function sk(){Yp||(Yp=!0,rj.then(eu))}function wt(t){xa.push(t)}var Xp=new Set,ba=0;function eu(){if(ba!==0)return;let t=Sr;do{try{for(;ba<ai.length;){let e=ai[ba];ba++,Yn(e),ij(e.$$)}}catch(e){throw ai.length=0,ba=0,e}for(Yn(null),ai.length=0,ba=0;je.length;)je.pop()();for(let e=0;e<xa.length;e+=1){let n=xa[e];Xp.has(n)||(Xp.add(n),n())}xa.length=0}while(ai.length);for(;ak.length;)ak.pop()();Yp=!1,Xp.clear(),Yn(t)}function ij(t){if(t.fragment!==null){t.update(),Ae(t.before_update);let e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(wt)}}function ok(t){let e=[],n=[];xa.forEach(r=>t.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),xa=e}var ro;function aj(){return ro||(ro=Promise.resolve(),ro.then(()=>{ro=null})),ro}function Zp(t,e,n){t.dispatchEvent(Zc(`${e?"intro":"outro"}${n}`))}var tu=new Set,Zn;function Ce(){Zn={r:0,c:[],p:Zn}}function Fe(){Zn.r||Ae(Zn.c),Zn=Zn.p}function U(t,e){t&&t.i&&(tu.delete(t),t.i(e))}function X(t,e,n,r){if(t&&t.o){if(tu.has(t))return;tu.add(t),Zn.c.push(()=>{tu.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}var sj={duration:0};function bt(t,e,n,r){let a=e(t,n,{direction:"both"}),s=r?0:1,o=null,l=null,c=null,u;function f(){c&&qp(t,c)}function h(p,g){let m=p.b-s;return g*=Math.abs(m),{a:s,b:p.b,d:m,duration:g,start:p.start,end:p.start+g,group:p.group}}function d(p){let{delay:g=0,duration:m=300,easing:w=eo,tick:b=ke,css:S}=a||sj,k={start:zp()+g,b:p};p||(k.group=Zn,Zn.r+=1),"inert"in t&&(p?u!==void 0&&(t.inert=u):(u=t.inert,t.inert=!0)),o||l?l=k:(S&&(f(),c=Qc(t,s,p,m,g,w,S)),p&&b(0,1),o=h(k,m),wt(()=>Zp(t,p,"start")),Gp(x=>{if(l&&x>l.start&&(o=h(l,m),l=null,Zp(t,o.b,"start"),S&&(f(),c=Qc(t,s,o.b,o.duration,0,w,a.css))),o){if(x>=o.end)b(s=o.b,1-s),Zp(t,o.b,"end"),l||(o.b?f():--o.group.r||Ae(o.group.c)),o=null;else if(x>=o.start){let A=x-o.start;s=o.a+o.d*w(A/o.duration),b(s,1-s)}}return!!(o||l)}))}return{run(p){ya(a)?aj().then(()=>{a=a({direction:p?"in":"out"}),d(p)}):d(p)},end(){f(),o=l=null}}}v();function tt(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}v();v();v();var oj=["allowfullscreen","allowpaymentrequest","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],lj=new Set([...oj]);v();v();v();function He(t){t&&t.c()}function De(t,e,n){let{fragment:r,after_update:i}=t.$$;r&&r.m(e,n),wt(()=>{let a=t.$$.on_mount.map(Up).filter(ya);t.$$.on_destroy?t.$$.on_destroy.push(...a):Ae(a),t.$$.on_mount=[]}),i.forEach(wt)}function Be(t,e){let n=t.$$;n.fragment!==null&&(ok(n.after_update),Ae(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function uj(t,e){t.$$.dirty[0]===-1&&(ai.push(t),sk(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function at(t,e,n,r,i,a,s=null,o=[-1]){let l=Sr;Yn(t);let c=t.$$={fragment:null,ctx:[],props:a,update:ke,not_equal:i,bound:qc(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(l?l.$$.context:[])),callbacks:qc(),dirty:o,skip_bound:!1,root:e.target||l.$$.root};s&&s(c.root);let u=!1;if(c.
|
||
|
`:""}${(y=t[0].author)==null?void 0:y.name}
|
||
|
${(0,io.moment)(t[0].date).format(t[3].settings.commitDateFormat)}
|
||
|
${t[0].message}`),T(r,"data-tooltip-position",t[5]),T(n,"class","tree-item nav-folder"),ce(n,"is-collapsed",t[4])},m(y,E){re(y,e,E),O(e,n),O(n,r),O(r,i),O(r,a),O(r,s),b&&b.m(s,null),O(s,o),S&&S.m(s,null),O(s,l),k&&k.m(s,null),O(s,c),O(s,u),O(u,h),O(n,p),x&&x.m(n,null),g=!0,m||(w=te(r,"click",t[8]),m=!0)},p(y,[E]){var _,C;(!g||E&16)&&ce(i,"is-collapsed",y[4]),y[0].refs.length>0?b?b.p(y,E):(b=gk(y),b.c(),b.m(s,o)):b&&(b.d(1),b=null),y[3].settings.authorInHistoryView!="hide"&&((_=y[0].author)!=null&&_.name)?S?S.p(y,E):(S=yk(y),S.c(),S.m(s,l)):S&&(S.d(1),S=null),y[3].settings.dateInHistoryView?k?k.p(y,E):(k=vk(y),k.c(),k.m(s,c)):k&&(k.d(1),k=null),(!g||E&1)&&f!==(f=y[0].message+"")&&Oe(h,f),(!g||E&9&&d!==(d=`${y[0].refs.length>0?y[0].refs.join(", ")+`
|
||
|
`:""}${(C=y[0].author)==null?void 0:C.name}
|
||
|
${(0,io.moment)(y[0].date).format(y[3].settings.commitDateFormat)}
|
||
|
${y[0].message}`))&&T(r,"aria-label",d),(!g||E&32)&&T(r,"data-tooltip-position",y[5]),y[4]?x&&(Ce(),X(x,1,1,()=>{x=null}),Fe()):x?(x.p(y,E),E&16&&U(x,1)):(x=wk(y),x.c(),U(x,1),x.m(n,null)),(!g||E&16)&&ce(n,"is-collapsed",y[4])},i(y){g||(U(x),g=!0)},o(y){X(x),g=!1},d(y){y&&ne(e),b&&b.d(),S&&S.d(),k&&k.d(),x&&x.d(),m=!1,w()}}}function Sj(t,e,n){let r,i,{log:a}=e,{view:s}=e,{showTree:o}=e,{plugin:l}=e,c=!0;function u(h){let d=h.author.name;if(l.settings.authorInHistoryView=="full")return d;if(l.settings.authorInHistoryView=="initials")return d.split(" ").filter(g=>g.length>0).map(g=>g[0].toUpperCase()).join("")}let f=()=>n(4,c=!c);return t.$$set=h=>{"log"in h&&n(0,a=h.log),"view"in h&&n(1,s=h.view),"showTree"in h&&n(2,o=h.showTree),"plugin"in h&&n(3,l=h.plugin)},t.$$.update=()=>{t.$$.dirty&9&&n(6,r={title:"",path:"",vaultPath:"",children:l.gitManager.getTreeStructure(a.diff.files)}),t.$$.dirty&2&&n(5,i=s.leaf.getRoot().side=="left"?"right":"left")},[a,s,o,l,c,i,r,u,f]}var Qp=class extends Ve{constructor(e){super(),at(this,e,Sj,_j,it,{log:0,view:1,showTree:2,plugin:3})}},xk=Qp;function _k(t,e,n){let r=t.slice();return r[13]=e[n],r}function Sk(t){let e,n,r=tt(t[6]),i=[];for(let s=0;s<r.length;s+=1)i[s]=Ek(_k(t,r,s));let a=s=>X(i[s],1,1,()=>{i[s]=null});return{c(){e=I("div");for(let s=0;s<i.length;s+=1)i[s].c();T(e,"class","tree-item nav-folder mod-root")},m(s,o){re(s,e,o);for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(e,null);n=!0},p(s,o){if(o&71){r=tt(s[6]);let l;for(l=0;l<r.length;l+=1){let c=_k(s,r,l);i[l]?(i[l].p(c,o),U(i[l],1)):(i[l]=Ek(c),i[l].c(),U(i[l],1),i[l].m(e,null))}for(Ce(),l=r.length;l<i.length;l+=1)a(l);Fe()}},i(s){if(!n){for(let o=0;o<r.length;o+=1)U(i[o]);n=!0}},o(s){i=i.filter(Boolean);for(let o=0;o<i.length;o+=1)X(i[o]);n=!1},d(s){s&&ne(e),ln(i,s)}}}function Ek(t){let e,n;return e=new xk({props:{view:t[1],showTree:t[2],log:t[13],plugin:t[0]}}),{c(){He(e.$$.fragment)},m(r,i){De(e,r,i),n=!0},p(r,i){let a={};i&2&&(a.view=r[1]),i&4&&(a.showTree=r[2]),i&64&&(a.log=r[13]),i&1&&(a.plugin=r[0]),e.$set(a)},i(r){n||(U(e.$$.fragment,r),n=!0)},o(r){X(e.$$.fragment,r),n=!1},d(r){Be(e,r)}}}function Ej(t){let e,n,r,i,a,s,o,l,c,u,f,h=t[6]&&Sk(t);return{c(){e=I("main"),n=I("div"),r=I("div"),i=I("div"),a=J(),s=I("div"),o=J(),l=I("div"),h&&h.c(),T(i,"id","layoutChange"),T(i,"class","clickable-icon nav-action-button"),T(i,"aria-label","Change Layout"),T(s,"id","refresh"),T(s,"class","clickable-icon nav-action-button"),T(s,"data-icon","refresh-cw"),T(s,"aria-label","Refresh"),Yt(s,"margin","1px"),ce(s,"loading",t[4]),T(r,"class","nav-buttons-container"),T(n,"class","nav-header"),T(l,"class","nav-files-container"),Yt(l,"position","relative")},m(d,p){re(d,e,p),O(e,n),O(n,r),O(r,i),t[8](i),O(r,a),O(r,s),t[10](s),O(e,o),O(e,l),h&&h.m(l,null),c=!0,u||(f=[te(i,"click",t[9]),te(s,"click",t[7])],u=!0)},p(d,[p]){(!c||p&16)&&ce(s,"loading",d[4]),d[6]?h?(h.p(d,p),p&64&&U(h,1)):(h=Sk(d),h.c(),U(h,1),h.m(l,null)):h&&(Ce(),X(h,1,1,()=>{h=null}),Fe())},i(d){c||(U(h),c=!0)},o(d){X(h),c=!1},d(d){d&&ne(e),t[8](null),t[10](null),h&&h.d(),u=!1,Ae(f)}}}function kj(t,e,n){let{plugin:r}=e,{view:i}=e,a,s=[],o,l=r.settings.treeStructure,c,u;c=i.app.workspace.on("obsidian-git:view-refresh",()=>void h().catch(console.error)),h().catch(console.error),r.app.workspace.onLayoutReady(()=>{window.setTimeout(()=>{s.forEach(m=>(0,iu.setIcon)(m,m.getAttr("data-icon"))),(0,iu.setIcon)(u,l?"list":"folder")},0)}),no(()=>{i.app.workspace.offref(c)});function f(){i.app.workspace.trigger("obsidian-git:refresh")}function h(){return _a(this,void 0,void 0,function*(){if(!r.gitReady){n(6,o=void 0);return}n(4,a=!0);let m=r.gitManager instanceof Le;n(6,o=yield r.gitManager.log(void 0,!1,m?50:10)),n(4,a=!1)})}function d(m){je[m?"unshift":"push"](()=>{u=m,n(3,u)})}let p=()=>{n(2,l=!l),n(0,r.settings.treeStructure=l,r),r.saveSettings()};function g(m){je[m?"unshift":"push"](()=>{s[6]=m,n(5,s)})}return t.$$set=m=>{"plugin"in m&&n(0,r=m.plugin),"view"in m&&n(1,i=m.view)},t.$$.update=()=>{t.$$.dirty&12&&u&&(u.empty(),(0,iu.setIcon)(u,l?"list":"folder"))},[r,i,l,u,a,s,o,f,d,p,g]}var em=
|
||
|
`)}. Please remove them.`),!0}}return!1}async writeAndOpenFile(e){e!==void 0&&await this.plugin.app.vault.adapter.write(Vi,e);let n=!1;this.plugin.app.workspace.iterateAllLeaves(r=>{r.getDisplayText()!=""&&Vi.startsWith(r.getDisplayText())&&(n=!0)}),n||await this.plugin.app.workspace.openLinkText(Vi,"/",!0)}};var hu=class extends _e.Plugin{constructor(){super(...arguments);this.tools=new lo(this);this.state={gitAction:0,loading:!1,offlineMode:!1};this.gitReady=!1;this.promiseQueue=new Lc(this);this.loading=!1;this.intervalsToClear=[];this.lineAuthoringFeature=new Rc(this)}setPluginState(n){var r;this.state=Object.assign(this.state,n),(r=this.statusBar)==null||r.display()}async updateCachedStatus(){var n,r;return this.cachedStatus=await this.gitManager.status(),this.cachedStatus.conflicted.length>0?(this.localStorage.setConflict(!0),await((n=this.branchBar)==null?void 0:n.display())):(this.localStorage.setConflict(!1),await((r=this.branchBar)==null?void 0:r.display())),this.cachedStatus}async refresh(){if(!this.gitReady)return;let n=this.app.workspace.getLeavesOfType(dt.type),r=this.app.workspace.getLeavesOfType(nn.type);(this.settings.changedFilesInStatusBar||n.some(i=>{var a;return!((a=i.isDeferred)!=null&&a)})||r.some(i=>{var a;return!((a=i.isDeferred)!=null&&a)}))&&(this.loading=!0,this.app.workspace.trigger("obsidian-git:view-refresh"),await this.updateCachedStatus().catch(i=>this.displayError(i)),this.loading=!1,this.app.workspace.trigger("obsidian-git:view-refresh"))}refreshUpdatedHead(){this.lineAuthoringFeature.refreshLineAuthorViews()}async onload(){console.log("loading "+this.manifest.name+" plugin: v"+this.manifest.version),Gs.plugin=this,this.localStorage=new Hc(this),this.localStorage.migrate(),await this.loadSettings(),await this.migrateSettings(),this.settingsTab=new bc(this.app,this),this.addSettingTab(this.settingsTab),this.localStorage.getPluginDisabled()||(this.registerStuff(),this.app.workspace.onLayoutReady(()=>this.init({fromReload:!1}).catch(n=>this.displayError(n))))}onExternalSettingsChange(){this.reloadSettings().catch(n=>this.displayError(n))}async reloadSettings(){let n=JSON.stringify(this.settings);await this.loadSettings();let r=JSON.stringify(this.settings);n!==r&&(this.log("Reloading settings"),this.unloadPlugin(),await this.init({fromReload:!0}),this.app.workspace.getLeavesOfType(dt.type).forEach(i=>{var a;if(!((a=i.isDeferred)!=null&&a))return i.view.reload()}),this.app.workspace.getLeavesOfType(nn.type).forEach(i=>{var a;if(!((a=i.isDeferred)!=null&&a))return i.view.reload()}))}registerStuff(){this.registerEvent(this.app.workspace.on("obsidian-git:refresh",()=>{this.refresh().catch(n=>this.displayError(n))})),this.registerEvent(this.app.workspace.on("obsidian-git:head-change",()=>{this.refreshUpdatedHead()})),this.registerEvent(this.app.workspace.on("file-menu",(n,r,i)=>{this.handleFileMenu(n,r,i)})),this.registerEvent(this.app.workspace.on("active-leaf-change",n=>{this.handleViewActiveState(n)})),this.registerEvent(this.app.vault.on("modify",()=>{var n;this.debRefresh(),(n=this.autoCommitDebouncer)==null||n.call(this)})),this.registerEvent(this.app.vault.on("delete",()=>{var n;this.debRefresh(),(n=this.autoCommitDebouncer)==null||n.call(this)})),this.registerEvent(this.app.vault.on("create",()=>{var n;this.debRefresh(),(n=this.autoCommitDebouncer)==null||n.call(this)})),this.registerEvent(this.app.vault.on("rename",()=>{var n;this.debRefresh(),(n=this.autoCommitDebouncer)==null||n.call(this)})),this.registerView(dt.type,n=>new oo(n,this)),this.registerView(nn.type,n=>new ao(n,this)),this.registerView(Ct.type,n=>new ga(n,this)),this.addRibbonIcon("git-pull-request","Open Git source control",async()=>{var i;let n=this.app.workspace.getLeavesOfType(dt.type),r;n.length===0?(r=(i=this.app.workspace.getRightLeaf(!1))!=null?i:this.app.workspace.getLeaf(),await r.setViewState({type:dt.type})):r=n.first(),await this.app.workspace.revealLeaf(r),this.app.workspace.trigger("obsidian-git:refresh")}),this.registerHoverLinkSource(dt.type,{display:"Git View",defaultMod:!0}),this.lineAuthoringFeature.
|
||
|
`+this.gitManager.getRelativeRepoPath(n.path,!0)),this.refresh()}handleFileMenu(n,r,i){this.gitReady&&this.settings.showFileMenu&&r&&(this.settings.showFileMenu&&i=="file-explorer-context-menu"&&(n.addItem(a=>{a.setTitle("Git: Stage").setIcon("plus-circle").setSection("action").onClick(s=>{this.promiseQueue.addTask(async()=>{r instanceof _e.TFile?await this.gitManager.stage(r.path,!0):await this.gitManager.stageAll({dir:this.gitManager.getRelativeRepoPath(r.path,!0)}),this.displayMessage(`Staged ${r.path}`)})})}),n.addItem(a=>{a.setTitle("Git: Unstage").setIcon("minus-circle").setSection("action").onClick(s=>{this.promiseQueue.addTask(async()=>{r instanceof _e.TFile?await this.gitManager.unstage(r.path,!0):await this.gitManager.unstageAll({dir:this.gitManager.getRelativeRepoPath(r.path,!0)}),this.displayMessage(`Unstaged ${r.path}`)})})}),n.addItem(a=>{a.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(s=>{this.addFileToGitignore(r).catch(o=>this.displayError(o))})})),i=="git-source-control"&&n.addItem(a=>{a.setTitle("Git: Add to .gitignore").setIcon("file-x").setSection("action").onClick(s=>{this.addFileToGitignore(r).catch(o=>this.displayError(o))})}))}async migrateSettings(){this.settings.mergeOnPull!=null&&(this.settings.syncMethod=this.settings.mergeOnPull?"merge":"rebase",this.settings.mergeOnPull=void 0,await this.saveSettings()),this.settings.autoCommitMessage===void 0&&(this.settings.autoCommitMessage=this.settings.commitMessage,await this.saveSettings()),this.settings.gitPath!=null&&(this.localStorage.setGitPath(this.settings.gitPath),this.settings.gitPath=void 0,await this.saveSettings()),this.settings.username!=null&&(this.localStorage.setPassword(this.settings.username),this.settings.username=void 0,await this.saveSettings())}unloadPlugin(){var n,r;this.gitReady=!1,this.app.workspace.trigger("obsidian-git:refresh"),this.lineAuthoringFeature.deactivateFeature(),this.automaticsManager.unload(),(n=this.branchBar)==null||n.remove(),(r=this.statusBar)==null||r.remove();for(let i of this.intervalsToClear)window.clearInterval(i);this.intervalsToClear=[],this.debRefresh.cancel()}onunload(){this.unloadPlugin(),console.log("unloading "+this.manifest.name+" plugin")}async loadSettings(){let n=await this.loadData();n==null&&(n={showedMobileNotice:!0}),this.settings=Hw(Mn,n)}async saveSettings(){var n;(n=this.settingsTab)==null||n.beforeSaveSettings(),await this.saveData(this.settings)}get useSimpleGit(){return _e.Platform.isDesktopApp}async init({fromReload:n=!1}){var r;if(this.settings.showStatusBar){let i=this.addStatusBarItem();this.statusBar=new jc(i,this),this.intervalsToClear.push(window.setInterval(()=>{var a;return(a=this.statusBar)==null?void 0:a.display()},1e3))}try{this.useSimpleGit?(this.gitManager=new Le(this),await this.gitManager.setGitInstance()):this.gitManager=new yn(this);let i=await this.gitManager.checkRequirements();switch(i){case"missing-git":this.displayError(`Cannot run git command. Trying to run: '${this.localStorage.getGitPath()||"git"}' .`);break;case"missing-repo":new _e.Notice("Can't find a valid git repository. Please create one via the given command or clone an existing repo.",1e4);break;case"valid":if(this.gitReady=!0,this.setPluginState({gitAction:0}),_e.Platform.isDesktop&&this.settings.showBranchStatusBar){let a=this.addStatusBarItem();this.branchBar=new fu(a,this),this.intervalsToClear.push(window.setInterval(()=>{var s;return void((s=this.branchBar)==null?void 0:s.display().catch(console.error))},6e4))}await((r=this.branchBar)==null?void 0:r.display()),this.lineAuthoringFeature.conditionallyActivateBySettings(),this.app.workspace.trigger("obsidian-git:refresh"),!n&&this.settings.autoPullOnBoot&&this.promiseQueue.addTask(()=>this.pullChangesFromRemote()),this.automaticsManager=new Vs(this),await this.automaticsManager.init();break;default:this.log("Something weird happened. The 'checkRequirements' result is "+i)}}catch(i){this.displayError(i),console.error(i)}}async createNewRepo(){try{await this.gitManager.init(),new _e.Notice("Initialized new repo"
|
||
|
# Additional Instructions
|
||
|
I strongly recommend to use "Source mode" for viewing the conflicted files. For simple conflicts, in each file listed above replace every occurrence of the following text blocks with the desired text.
|
||
|
|
||
|
\`\`\`diff
|
||
|
<<<<<<< HEAD
|
||
|
File changes in local repository
|
||
|
=======
|
||
|
File changes in remote repository
|
||
|
>>>>>>> origin/main
|
||
|
\`\`\``]),await this.tools.writeAndOpenFile(r==null?void 0:r.join(`
|
||
|
`))}async editRemotes(){if(!await this.isAllInitialized())return;let n=await this.gitManager.getRemotes(),i=await new Xe(this,{options:n,placeholder:"Select or create a new remote by typing its name and selecting it"}).openAndGetResult();if(i){let a=await this.gitManager.getRemoteUrl(i),o=await new Xe(this,{initialValue:a}).openAndGetResult();if(o)return await this.gitManager.setRemote(i,o),i}}async selectRemoteBranch(){let n=await this.gitManager.getRemotes(),r;n.length===0&&(r=await this.editRemotes(),r==null&&(n=await this.gitManager.getRemotes()));let i=new Xe(this,{options:n,placeholder:"Select or create a new remote by typing its name and selecting it"}),a=r!=null?r:await i.openAndGetResult();if(a){this.displayMessage("Fetching remote branches"),await this.gitManager.fetch(a);let s=await this.gitManager.getRemoteBranches(a);return await new Xe(this,{options:s,placeholder:"Select or create a new remote branch by typing its name and selecting it"}).openAndGetResult()}}async removeRemote(){if(!await this.isAllInitialized())return;let n=await this.gitManager.getRemotes(),i=await new Xe(this,{options:n,placeholder:"Select a remote"}).openAndGetResult();i&&await this.gitManager.removeRemote(i)}handleViewActiveState(n){var a,s;if(!(n!=null&&n.view.getState().file))return;let r=this.app.workspace.getLeavesOfType(dt.type).first(),i=this.app.workspace.getLeavesOfType(nn.type).first();if((a=r==null?void 0:r.view.containerEl.querySelector("div.nav-file-title.is-active"))==null||a.removeClass("is-active"),(s=i==null?void 0:i.view.containerEl.querySelector("div.nav-file-title.is-active"))==null||s.removeClass("is-active"),(n==null?void 0:n.view)instanceof ga){let o=n.view.state.file;this.lastDiffViewState=n.view.getState();let l;r&&n.view.state.staged?l=r.view.containerEl.querySelector(`div.staged div.nav-file-title[data-path='${o}']`):r&&n.view.state.staged===!1&&!n.view.state.hash?l=r.view.containerEl.querySelector(`div.changes div.nav-file-title[data-path='${o}']`):i&&n.view.state.hash&&(l=i.view.containerEl.querySelector(`div.nav-file-title[data-path='${o}']`)),l==null||l.addClass("is-active")}else this.lastDiffViewState=void 0}handleNoNetworkError(n){this.state.offlineMode?this.log("Encountered network error, but already in offline mode"):this.displayError("Git: Going into offline mode. Future network errors will no longer be displayed.",2e3),this.setPluginState({gitAction:0,offlineMode:!0})}displayMessage(n,r=4*1e3){var i;(i=this.statusBar)==null||i.displayMessage(n.toLowerCase(),r),this.settings.disablePopups||(!this.settings.disablePopupsForNoChanges||!n.startsWith("No changes"))&&new _e.Notice(n,5*1e3),this.log(n)}displayError(n,r=10*1e3){var a;if(n instanceof hs.UserCanceledError){new _e.Notice("Aborted");return}let i;n instanceof Error?i=n:i=new Error(String(n)),this.setPluginState({gitAction:0}),new _e.Notice(i.message,r),console.error(`${this.manifest.id}:`,i.stack),(a=this.statusBar)==null||a.displayMessage(i.message.toLowerCase(),r)}log(...n){console.log(`${this.manifest.id}:`,...n)}};
|
||
|
/*! Bundled license information:
|
||
|
|
||
|
ieee754/index.js:
|
||
|
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <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 *)
|
||
|
|
||
|
js-sha256/src/sha256.js:
|
||
|
(**
|
||
|
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
||
|
*
|
||
|
* @version 0.9.0
|
||
|
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||
|
* @copyright Chen, Yi-Cyuan 2014-2017
|
||
|
* @license MIT
|
||
|
*)
|
||
|
|
||
|
feather-icons/dist/feather.js:
|
||
|
(*!
|
||
|
Copyright (c) 2016 Jed Watson.
|
||
|
Licensed under the MIT License (MIT), see
|
||
|
http://jedwatson.github.io/classnames
|
||
|
*)
|
||
|
*/
|
||
|
|
||
|
/* nosourcemap */
|