var Qc=Object.defineProperty;var o=(ic,rc)=>Qc(ic,"name",{value:rc,configurable:!0});(()=>{var ic={9742:(Re,ne)=>{"use strict";ne.byteLength=$,ne.toByteArray=A,ne.fromByteArray=R;for(var g=[],s=[],I=typeof Uint8Array<"u"?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w=0,y=f.length;w0)throw new Error("Invalid string. Length must be a multiple of 4");var _=P.indexOf("=");_===-1&&(_=F);var C=_===F?0:4-_%4;return[_,C]}o(b,"getLens");function $(P){var F=b(P),_=F[0],C=F[1];return(_+C)*3/4-C}o($,"byteLength");function L(P,F,_){return(F+_)*3/4-_}o(L,"_byteLength");function A(P){var F,_=b(P),C=_[0],k=_[1],x=new I(L(P,C,k)),c=0,O=k>0?C-4:C,E;for(E=0;E>16&255,x[c++]=F>>8&255,x[c++]=F&255;return k===2&&(F=s[P.charCodeAt(E)]<<2|s[P.charCodeAt(E+1)]>>4,x[c++]=F&255),k===1&&(F=s[P.charCodeAt(E)]<<10|s[P.charCodeAt(E+1)]<<4|s[P.charCodeAt(E+2)]>>2,x[c++]=F>>8&255,x[c++]=F&255),x}o(A,"toByteArray");function v(P){return g[P>>18&63]+g[P>>12&63]+g[P>>6&63]+g[P&63]}o(v,"tripletToBase64");function T(P,F,_){for(var C,k=[],x=F;x<_;x+=3)C=(P[x]<<16&16711680)+(P[x+1]<<8&65280)+(P[x+2]&255),k.push(v(C));return k.join("")}o(T,"encodeChunk");function R(P){for(var F,_=P.length,C=_%3,k=[],x=16383,c=0,O=_-C;cO?O:c+x));return C===1?(F=P[_-1],k.push(g[F>>2]+g[F<<4&63]+"==")):C===2&&(F=(P[_-2]<<8)+P[_-1],k.push(g[F>>10]+g[F>>4&63]+g[F<<2&63]+"=")),k.join("")}o(R,"fromByteArray")},5186:(Re,ne,g)=>{var s=g(3698),I=g(2505),f=g(6417),w=Function.bind,y=w.bind(w);function b(T,R,P){var F=y(f,null).apply(null,P?[R,P]:[R]);T.api={remove:F},T.remove=F,["before","error","after","wrap"].forEach(function(_){var C=P?[R,_,P]:[R,_];T[_]=T.api[_]=y(I,null).apply(null,C)})}o(b,"bindApi");function $(){var T="h",R={registry:{}},P=s.bind(null,R,T);return b(P,R,T),P}o($,"HookSingular");function L(){var T={registry:{}},R=s.bind(null,T);return b(R,T),R}o(L,"HookCollection");var A=!1;function v(){return A||(console.warn('[before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4'),A=!0),L()}o(v,"Hook"),v.Singular=$.bind(),v.Collection=L.bind(),Re.exports=v,Re.exports.Hook=v,Re.exports.Singular=v.Singular,Re.exports.Collection=v.Collection},2505:Re=>{Re.exports=ne;function ne(g,s,I,f){var w=f;g.registry[I]||(g.registry[I]=[]),s==="before"&&(f=o(function(y,b){return Promise.resolve().then(w.bind(null,b)).then(y.bind(null,b))},"hook")),s==="after"&&(f=o(function(y,b){var $;return Promise.resolve().then(y.bind(null,b)).then(function(L){return $=L,w($,b)}).then(function(){return $})},"hook")),s==="error"&&(f=o(function(y,b){return Promise.resolve().then(y.bind(null,b)).catch(function($){return w($,b)})},"hook")),g.registry[I].push({hook:f,orig:w})}o(ne,"addHook")},3698:Re=>{Re.exports=ne;function ne(g,s,I,f){if(typeof I!="function")throw new Error("method for before hook must be a function");return f||(f={}),Array.isArray(s)?s.reverse().reduce(function(w,y){return ne.bind(null,g,y,w,f)},I)():Promise.resolve().then(function(){return g.registry[s]?g.registry[s].reduce(function(w,y){return y.hook.bind(null,w,f)},I)():I(f)})}o(ne,"register")},6417:Re=>{Re.exports=ne;function ne(g,s,I){if(!!g.registry[s]){var f=g.registry[s].map(function(w){return w.orig}).indexOf(I);f!==-1&&g.registry[s].splice(f,1)}}o(ne,"removeHook")},8764:(Re,ne,g)=>{"use strict";/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */var s=g(9742),I=g(645),f=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;ne.Buffer=$,ne.SlowBuffer=x,ne.INSPECT_MAX_BYTES=50;var w=2147483647;ne.kMaxLength=w,$.TYPED_ARRAY_SUPPORT=y(),!$.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&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 y(){try{var Z=new Uint8Array(1),Y={foo:function(){return 42}};return Object.setPrototypeOf(Y,Uint8Array.prototype),Object.setPrototypeOf(Z,Y),Z.foo()===42}catch{return!1}}o(y,"typedArraySupport"),Object.defineProperty($.prototype,"parent",{enumerable:!0,get:function(){if(!!$.isBuffer(this))return this.buffer}}),Object.defineProperty($.prototype,"offset",{enumerable:!0,get:function(){if(!!$.isBuffer(this))return this.byteOffset}});function b(Z){if(Z>w)throw new RangeError('The value "'+Z+'" is invalid for option "size"');var Y=new Uint8Array(Z);return Object.setPrototypeOf(Y,$.prototype),Y}o(b,"createBuffer");function $(Z,Y,K){if(typeof Z=="number"){if(typeof Y=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return T(Z)}return L(Z,Y,K)}o($,"Buffer"),$.poolSize=8192;function L(Z,Y,K){if(typeof Z=="string")return R(Z,Y);if(ArrayBuffer.isView(Z))return F(Z);if(Z==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Z);if(fe(Z,ArrayBuffer)||Z&&fe(Z.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(fe(Z,SharedArrayBuffer)||Z&&fe(Z.buffer,SharedArrayBuffer)))return _(Z,Y,K);if(typeof Z=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var _e=Z.valueOf&&Z.valueOf();if(_e!=null&&_e!==Z)return $.from(_e,Y,K);var ie=C(Z);if(ie)return ie;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Z[Symbol.toPrimitive]=="function")return $.from(Z[Symbol.toPrimitive]("string"),Y,K);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Z)}o(L,"from"),$.from=function(Z,Y,K){return L(Z,Y,K)},Object.setPrototypeOf($.prototype,Uint8Array.prototype),Object.setPrototypeOf($,Uint8Array);function A(Z){if(typeof Z!="number")throw new TypeError('"size" argument must be of type number');if(Z<0)throw new RangeError('The value "'+Z+'" is invalid for option "size"')}o(A,"assertSize");function v(Z,Y,K){return A(Z),Z<=0?b(Z):Y!==void 0?typeof K=="string"?b(Z).fill(Y,K):b(Z).fill(Y):b(Z)}o(v,"alloc"),$.alloc=function(Z,Y,K){return v(Z,Y,K)};function T(Z){return A(Z),b(Z<0?0:k(Z)|0)}o(T,"allocUnsafe"),$.allocUnsafe=function(Z){return T(Z)},$.allocUnsafeSlow=function(Z){return T(Z)};function R(Z,Y){if((typeof Y!="string"||Y==="")&&(Y="utf8"),!$.isEncoding(Y))throw new TypeError("Unknown encoding: "+Y);var K=c(Z,Y)|0,_e=b(K),ie=_e.write(Z,Y);return ie!==K&&(_e=_e.slice(0,ie)),_e}o(R,"fromString");function P(Z){for(var Y=Z.length<0?0:k(Z.length)|0,K=b(Y),_e=0;_e=w)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+w.toString(16)+" bytes");return Z|0}o(k,"checked");function x(Z){return+Z!=Z&&(Z=0),$.alloc(+Z)}o(x,"SlowBuffer"),$.isBuffer=o(function(Y){return Y!=null&&Y._isBuffer===!0&&Y!==$.prototype},"isBuffer"),$.compare=o(function(Y,K){if(fe(Y,Uint8Array)&&(Y=$.from(Y,Y.offset,Y.byteLength)),fe(K,Uint8Array)&&(K=$.from(K,K.offset,K.byteLength)),!$.isBuffer(Y)||!$.isBuffer(K))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(Y===K)return 0;for(var _e=Y.length,ie=K.length,Ne=0,Ce=Math.min(_e,ie);Neie.length?$.from(Ce).copy(ie,Ne):Uint8Array.prototype.set.call(ie,Ce,Ne);else if($.isBuffer(Ce))Ce.copy(ie,Ne);else throw new TypeError('"list" argument must be an Array of Buffers');Ne+=Ce.length}return ie},"concat");function c(Z,Y){if($.isBuffer(Z))return Z.length;if(ArrayBuffer.isView(Z)||fe(Z,ArrayBuffer))return Z.byteLength;if(typeof Z!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Z);var K=Z.length,_e=arguments.length>2&&arguments[2]===!0;if(!_e&&K===0)return 0;for(var ie=!1;;)switch(Y){case"ascii":case"latin1":case"binary":return K;case"utf8":case"utf-8":return ye(Z).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K*2;case"hex":return K>>>1;case"base64":return at(Z).length;default:if(ie)return _e?-1:ye(Z).length;Y=(""+Y).toLowerCase(),ie=!0}}o(c,"byteLength"),$.byteLength=c;function O(Z,Y,K){var _e=!1;if((Y===void 0||Y<0)&&(Y=0),Y>this.length||((K===void 0||K>this.length)&&(K=this.length),K<=0)||(K>>>=0,Y>>>=0,K<=Y))return"";for(Z||(Z="utf8");;)switch(Z){case"hex":return oe(this,Y,K);case"utf8":case"utf-8":return ee(this,Y,K);case"ascii":return Te(this,Y,K);case"latin1":case"binary":return je(this,Y,K);case"base64":return Q(this,Y,K);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ce(this,Y,K);default:if(_e)throw new TypeError("Unknown encoding: "+Z);Z=(Z+"").toLowerCase(),_e=!0}}o(O,"slowToString"),$.prototype._isBuffer=!0;function E(Z,Y,K){var _e=Z[Y];Z[Y]=Z[K],Z[K]=_e}o(E,"swap"),$.prototype.swap16=o(function(){var Y=this.length;if(Y%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var K=0;KK&&(Y+=" ... "),""},"inspect"),f&&($.prototype[f]=$.prototype.inspect),$.prototype.compare=o(function(Y,K,_e,ie,Ne){if(fe(Y,Uint8Array)&&(Y=$.from(Y,Y.offset,Y.byteLength)),!$.isBuffer(Y))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof Y);if(K===void 0&&(K=0),_e===void 0&&(_e=Y?Y.length:0),ie===void 0&&(ie=0),Ne===void 0&&(Ne=this.length),K<0||_e>Y.length||ie<0||Ne>this.length)throw new RangeError("out of range index");if(ie>=Ne&&K>=_e)return 0;if(ie>=Ne)return-1;if(K>=_e)return 1;if(K>>>=0,_e>>>=0,ie>>>=0,Ne>>>=0,this===Y)return 0;for(var Ce=Ne-ie,Ie=_e-K,nt=Math.min(Ce,Ie),wt=this.slice(ie,Ne),pt=Y.slice(K,_e),ct=0;ct2147483647?K=2147483647:K<-2147483648&&(K=-2147483648),K=+K,pe(K)&&(K=ie?0:Z.length-1),K<0&&(K=Z.length+K),K>=Z.length){if(ie)return-1;K=Z.length-1}else if(K<0)if(ie)K=0;else return-1;if(typeof Y=="string"&&(Y=$.from(Y,_e)),$.isBuffer(Y))return Y.length===0?-1:G(Z,Y,K,_e,ie);if(typeof Y=="number")return Y=Y&255,typeof Uint8Array.prototype.indexOf=="function"?ie?Uint8Array.prototype.indexOf.call(Z,Y,K):Uint8Array.prototype.lastIndexOf.call(Z,Y,K):G(Z,[Y],K,_e,ie);throw new TypeError("val must be string, number or Buffer")}o(B,"bidirectionalIndexOf");function G(Z,Y,K,_e,ie){var Ne=1,Ce=Z.length,Ie=Y.length;if(_e!==void 0&&(_e=String(_e).toLowerCase(),_e==="ucs2"||_e==="ucs-2"||_e==="utf16le"||_e==="utf-16le")){if(Z.length<2||Y.length<2)return-1;Ne=2,Ce/=2,Ie/=2,K/=2}function nt(Gt,Ai){return Ne===1?Gt[Ai]:Gt.readUInt16BE(Ai*Ne)}o(nt,"read");var wt;if(ie){var pt=-1;for(wt=K;wtCe&&(K=Ce-Ie),wt=K;wt>=0;wt--){for(var ct=!0,$t=0;$tie&&(_e=ie)):_e=ie;var Ne=Y.length;_e>Ne/2&&(_e=Ne/2);for(var Ce=0;Ce<_e;++Ce){var Ie=parseInt(Y.substr(Ce*2,2),16);if(pe(Ie))return Ce;Z[K+Ce]=Ie}return Ce}o(U,"hexWrite");function H(Z,Y,K,_e){return Ct(ye(Y,Z.length-K),Z,K,_e)}o(H,"utf8Write");function j(Z,Y,K,_e){return Ct(De(Y),Z,K,_e)}o(j,"asciiWrite");function q(Z,Y,K,_e){return Ct(at(Y),Z,K,_e)}o(q,"base64Write");function de(Z,Y,K,_e){return Ct(qe(Y,Z.length-K),Z,K,_e)}o(de,"ucs2Write"),$.prototype.write=o(function(Y,K,_e,ie){if(K===void 0)ie="utf8",_e=this.length,K=0;else if(_e===void 0&&typeof K=="string")ie=K,_e=this.length,K=0;else if(isFinite(K))K=K>>>0,isFinite(_e)?(_e=_e>>>0,ie===void 0&&(ie="utf8")):(ie=_e,_e=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var Ne=this.length-K;if((_e===void 0||_e>Ne)&&(_e=Ne),Y.length>0&&(_e<0||K<0)||K>this.length)throw new RangeError("Attempt to write outside buffer bounds");ie||(ie="utf8");for(var Ce=!1;;)switch(ie){case"hex":return U(this,Y,K,_e);case"utf8":case"utf-8":return H(this,Y,K,_e);case"ascii":case"latin1":case"binary":return j(this,Y,K,_e);case"base64":return q(this,Y,K,_e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return de(this,Y,K,_e);default:if(Ce)throw new TypeError("Unknown encoding: "+ie);ie=(""+ie).toLowerCase(),Ce=!0}},"write"),$.prototype.toJSON=o(function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},"toJSON");function Q(Z,Y,K){return Y===0&&K===Z.length?s.fromByteArray(Z):s.fromByteArray(Z.slice(Y,K))}o(Q,"base64Slice");function ee(Z,Y,K){K=Math.min(Z.length,K);for(var _e=[],ie=Y;ie239?4:Ne>223?3:Ne>191?2:1;if(ie+Ie<=K){var nt,wt,pt,ct;switch(Ie){case 1:Ne<128&&(Ce=Ne);break;case 2:nt=Z[ie+1],(nt&192)===128&&(ct=(Ne&31)<<6|nt&63,ct>127&&(Ce=ct));break;case 3:nt=Z[ie+1],wt=Z[ie+2],(nt&192)===128&&(wt&192)===128&&(ct=(Ne&15)<<12|(nt&63)<<6|wt&63,ct>2047&&(ct<55296||ct>57343)&&(Ce=ct));break;case 4:nt=Z[ie+1],wt=Z[ie+2],pt=Z[ie+3],(nt&192)===128&&(wt&192)===128&&(pt&192)===128&&(ct=(Ne&15)<<18|(nt&63)<<12|(wt&63)<<6|pt&63,ct>65535&&ct<1114112&&(Ce=ct))}}Ce===null?(Ce=65533,Ie=1):Ce>65535&&(Ce-=65536,_e.push(Ce>>>10&1023|55296),Ce=56320|Ce&1023),_e.push(Ce),ie+=Ie}return Pe(_e)}o(ee,"utf8Slice");var We=4096;function Pe(Z){var Y=Z.length;if(Y<=We)return String.fromCharCode.apply(String,Z);for(var K="",_e=0;_e_e)&&(K=_e);for(var ie="",Ne=Y;Ne_e&&(Y=_e),K<0?(K+=_e,K<0&&(K=0)):K>_e&&(K=_e),KK)throw new RangeError("Trying to access beyond buffer length")}o(ue,"checkOffset"),$.prototype.readUintLE=$.prototype.readUIntLE=o(function(Y,K,_e){Y=Y>>>0,K=K>>>0,_e||ue(Y,K,this.length);for(var ie=this[Y],Ne=1,Ce=0;++Ce>>0,K=K>>>0,_e||ue(Y,K,this.length);for(var ie=this[Y+--K],Ne=1;K>0&&(Ne*=256);)ie+=this[Y+--K]*Ne;return ie},"readUIntBE"),$.prototype.readUint8=$.prototype.readUInt8=o(function(Y,K){return Y=Y>>>0,K||ue(Y,1,this.length),this[Y]},"readUInt8"),$.prototype.readUint16LE=$.prototype.readUInt16LE=o(function(Y,K){return Y=Y>>>0,K||ue(Y,2,this.length),this[Y]|this[Y+1]<<8},"readUInt16LE"),$.prototype.readUint16BE=$.prototype.readUInt16BE=o(function(Y,K){return Y=Y>>>0,K||ue(Y,2,this.length),this[Y]<<8|this[Y+1]},"readUInt16BE"),$.prototype.readUint32LE=$.prototype.readUInt32LE=o(function(Y,K){return Y=Y>>>0,K||ue(Y,4,this.length),(this[Y]|this[Y+1]<<8|this[Y+2]<<16)+this[Y+3]*16777216},"readUInt32LE"),$.prototype.readUint32BE=$.prototype.readUInt32BE=o(function(Y,K){return Y=Y>>>0,K||ue(Y,4,this.length),this[Y]*16777216+(this[Y+1]<<16|this[Y+2]<<8|this[Y+3])},"readUInt32BE"),$.prototype.readIntLE=o(function(Y,K,_e){Y=Y>>>0,K=K>>>0,_e||ue(Y,K,this.length);for(var ie=this[Y],Ne=1,Ce=0;++Ce=Ne&&(ie-=Math.pow(2,8*K)),ie},"readIntLE"),$.prototype.readIntBE=o(function(Y,K,_e){Y=Y>>>0,K=K>>>0,_e||ue(Y,K,this.length);for(var ie=K,Ne=1,Ce=this[Y+--ie];ie>0&&(Ne*=256);)Ce+=this[Y+--ie]*Ne;return Ne*=128,Ce>=Ne&&(Ce-=Math.pow(2,8*K)),Ce},"readIntBE"),$.prototype.readInt8=o(function(Y,K){return Y=Y>>>0,K||ue(Y,1,this.length),this[Y]&128?(255-this[Y]+1)*-1:this[Y]},"readInt8"),$.prototype.readInt16LE=o(function(Y,K){Y=Y>>>0,K||ue(Y,2,this.length);var _e=this[Y]|this[Y+1]<<8;return _e&32768?_e|4294901760:_e},"readInt16LE"),$.prototype.readInt16BE=o(function(Y,K){Y=Y>>>0,K||ue(Y,2,this.length);var _e=this[Y+1]|this[Y]<<8;return _e&32768?_e|4294901760:_e},"readInt16BE"),$.prototype.readInt32LE=o(function(Y,K){return Y=Y>>>0,K||ue(Y,4,this.length),this[Y]|this[Y+1]<<8|this[Y+2]<<16|this[Y+3]<<24},"readInt32LE"),$.prototype.readInt32BE=o(function(Y,K){return Y=Y>>>0,K||ue(Y,4,this.length),this[Y]<<24|this[Y+1]<<16|this[Y+2]<<8|this[Y+3]},"readInt32BE"),$.prototype.readFloatLE=o(function(Y,K){return Y=Y>>>0,K||ue(Y,4,this.length),I.read(this,Y,!0,23,4)},"readFloatLE"),$.prototype.readFloatBE=o(function(Y,K){return Y=Y>>>0,K||ue(Y,4,this.length),I.read(this,Y,!1,23,4)},"readFloatBE"),$.prototype.readDoubleLE=o(function(Y,K){return Y=Y>>>0,K||ue(Y,8,this.length),I.read(this,Y,!0,52,8)},"readDoubleLE"),$.prototype.readDoubleBE=o(function(Y,K){return Y=Y>>>0,K||ue(Y,8,this.length),I.read(this,Y,!1,52,8)},"readDoubleBE");function Ae(Z,Y,K,_e,ie,Ne){if(!$.isBuffer(Z))throw new TypeError('"buffer" argument must be a Buffer instance');if(Y>ie||YZ.length)throw new RangeError("Index out of range")}o(Ae,"checkInt"),$.prototype.writeUintLE=$.prototype.writeUIntLE=o(function(Y,K,_e,ie){if(Y=+Y,K=K>>>0,_e=_e>>>0,!ie){var Ne=Math.pow(2,8*_e)-1;Ae(this,Y,K,_e,Ne,0)}var Ce=1,Ie=0;for(this[K]=Y&255;++Ie<_e&&(Ce*=256);)this[K+Ie]=Y/Ce&255;return K+_e},"writeUIntLE"),$.prototype.writeUintBE=$.prototype.writeUIntBE=o(function(Y,K,_e,ie){if(Y=+Y,K=K>>>0,_e=_e>>>0,!ie){var Ne=Math.pow(2,8*_e)-1;Ae(this,Y,K,_e,Ne,0)}var Ce=_e-1,Ie=1;for(this[K+Ce]=Y&255;--Ce>=0&&(Ie*=256);)this[K+Ce]=Y/Ie&255;return K+_e},"writeUIntBE"),$.prototype.writeUint8=$.prototype.writeUInt8=o(function(Y,K,_e){return Y=+Y,K=K>>>0,_e||Ae(this,Y,K,1,255,0),this[K]=Y&255,K+1},"writeUInt8"),$.prototype.writeUint16LE=$.prototype.writeUInt16LE=o(function(Y,K,_e){return Y=+Y,K=K>>>0,_e||Ae(this,Y,K,2,65535,0),this[K]=Y&255,this[K+1]=Y>>>8,K+2},"writeUInt16LE"),$.prototype.writeUint16BE=$.prototype.writeUInt16BE=o(function(Y,K,_e){return Y=+Y,K=K>>>0,_e||Ae(this,Y,K,2,65535,0),this[K]=Y>>>8,this[K+1]=Y&255,K+2},"writeUInt16BE"),$.prototype.writeUint32LE=$.prototype.writeUInt32LE=o(function(Y,K,_e){return Y=+Y,K=K>>>0,_e||Ae(this,Y,K,4,4294967295,0),this[K+3]=Y>>>24,this[K+2]=Y>>>16,this[K+1]=Y>>>8,this[K]=Y&255,K+4},"writeUInt32LE"),$.prototype.writeUint32BE=$.prototype.writeUInt32BE=o(function(Y,K,_e){return Y=+Y,K=K>>>0,_e||Ae(this,Y,K,4,4294967295,0),this[K]=Y>>>24,this[K+1]=Y>>>16,this[K+2]=Y>>>8,this[K+3]=Y&255,K+4},"writeUInt32BE"),$.prototype.writeIntLE=o(function(Y,K,_e,ie){if(Y=+Y,K=K>>>0,!ie){var Ne=Math.pow(2,8*_e-1);Ae(this,Y,K,_e,Ne-1,-Ne)}var Ce=0,Ie=1,nt=0;for(this[K]=Y&255;++Ce<_e&&(Ie*=256);)Y<0&&nt===0&&this[K+Ce-1]!==0&&(nt=1),this[K+Ce]=(Y/Ie>>0)-nt&255;return K+_e},"writeIntLE"),$.prototype.writeIntBE=o(function(Y,K,_e,ie){if(Y=+Y,K=K>>>0,!ie){var Ne=Math.pow(2,8*_e-1);Ae(this,Y,K,_e,Ne-1,-Ne)}var Ce=_e-1,Ie=1,nt=0;for(this[K+Ce]=Y&255;--Ce>=0&&(Ie*=256);)Y<0&&nt===0&&this[K+Ce+1]!==0&&(nt=1),this[K+Ce]=(Y/Ie>>0)-nt&255;return K+_e},"writeIntBE"),$.prototype.writeInt8=o(function(Y,K,_e){return Y=+Y,K=K>>>0,_e||Ae(this,Y,K,1,127,-128),Y<0&&(Y=255+Y+1),this[K]=Y&255,K+1},"writeInt8"),$.prototype.writeInt16LE=o(function(Y,K,_e){return Y=+Y,K=K>>>0,_e||Ae(this,Y,K,2,32767,-32768),this[K]=Y&255,this[K+1]=Y>>>8,K+2},"writeInt16LE"),$.prototype.writeInt16BE=o(function(Y,K,_e){return Y=+Y,K=K>>>0,_e||Ae(this,Y,K,2,32767,-32768),this[K]=Y>>>8,this[K+1]=Y&255,K+2},"writeInt16BE"),$.prototype.writeInt32LE=o(function(Y,K,_e){return Y=+Y,K=K>>>0,_e||Ae(this,Y,K,4,2147483647,-2147483648),this[K]=Y&255,this[K+1]=Y>>>8,this[K+2]=Y>>>16,this[K+3]=Y>>>24,K+4},"writeInt32LE"),$.prototype.writeInt32BE=o(function(Y,K,_e){return Y=+Y,K=K>>>0,_e||Ae(this,Y,K,4,2147483647,-2147483648),Y<0&&(Y=4294967295+Y+1),this[K]=Y>>>24,this[K+1]=Y>>>16,this[K+2]=Y>>>8,this[K+3]=Y&255,K+4},"writeInt32BE");function ut(Z,Y,K,_e,ie,Ne){if(K+_e>Z.length)throw new RangeError("Index out of range");if(K<0)throw new RangeError("Index out of range")}o(ut,"checkIEEE754");function Le(Z,Y,K,_e,ie){return Y=+Y,K=K>>>0,ie||ut(Z,Y,K,4,34028234663852886e22,-34028234663852886e22),I.write(Z,Y,K,_e,23,4),K+4}o(Le,"writeFloat"),$.prototype.writeFloatLE=o(function(Y,K,_e){return Le(this,Y,K,!0,_e)},"writeFloatLE"),$.prototype.writeFloatBE=o(function(Y,K,_e){return Le(this,Y,K,!1,_e)},"writeFloatBE");function Me(Z,Y,K,_e,ie){return Y=+Y,K=K>>>0,ie||ut(Z,Y,K,8,17976931348623157e292,-17976931348623157e292),I.write(Z,Y,K,_e,52,8),K+8}o(Me,"writeDouble"),$.prototype.writeDoubleLE=o(function(Y,K,_e){return Me(this,Y,K,!0,_e)},"writeDoubleLE"),$.prototype.writeDoubleBE=o(function(Y,K,_e){return Me(this,Y,K,!1,_e)},"writeDoubleBE"),$.prototype.copy=o(function(Y,K,_e,ie){if(!$.isBuffer(Y))throw new TypeError("argument should be a Buffer");if(_e||(_e=0),!ie&&ie!==0&&(ie=this.length),K>=Y.length&&(K=Y.length),K||(K=0),ie>0&&ie<_e&&(ie=_e),ie===_e||Y.length===0||this.length===0)return 0;if(K<0)throw new RangeError("targetStart out of bounds");if(_e<0||_e>=this.length)throw new RangeError("Index out of range");if(ie<0)throw new RangeError("sourceEnd out of bounds");ie>this.length&&(ie=this.length),Y.length-K>>0,_e=_e===void 0?this.length:_e>>>0,Y||(Y=0);var Ce;if(typeof Y=="number")for(Ce=K;Ce<_e;++Ce)this[Ce]=Y;else{var Ie=$.isBuffer(Y)?Y:$.from(Y,ie),nt=Ie.length;if(nt===0)throw new TypeError('The value "'+Y+'" is invalid for argument "value"');for(Ce=0;Ce<_e-K;++Ce)this[Ce+K]=Ie[Ce%nt]}return this},"fill");var Ye=/[^+/0-9A-Za-z-_]/g;function et(Z){if(Z=Z.split("=")[0],Z=Z.trim().replace(Ye,""),Z.length<2)return"";for(;Z.length%4!==0;)Z=Z+"=";return Z}o(et,"base64clean");function ye(Z,Y){Y=Y||1/0;for(var K,_e=Z.length,ie=null,Ne=[],Ce=0;Ce<_e;++Ce){if(K=Z.charCodeAt(Ce),K>55295&&K<57344){if(!ie){if(K>56319){(Y-=3)>-1&&Ne.push(239,191,189);continue}else if(Ce+1===_e){(Y-=3)>-1&&Ne.push(239,191,189);continue}ie=K;continue}if(K<56320){(Y-=3)>-1&&Ne.push(239,191,189),ie=K;continue}K=(ie-55296<<10|K-56320)+65536}else ie&&(Y-=3)>-1&&Ne.push(239,191,189);if(ie=null,K<128){if((Y-=1)<0)break;Ne.push(K)}else if(K<2048){if((Y-=2)<0)break;Ne.push(K>>6|192,K&63|128)}else if(K<65536){if((Y-=3)<0)break;Ne.push(K>>12|224,K>>6&63|128,K&63|128)}else if(K<1114112){if((Y-=4)<0)break;Ne.push(K>>18|240,K>>12&63|128,K>>6&63|128,K&63|128)}else throw new Error("Invalid code point")}return Ne}o(ye,"utf8ToBytes");function De(Z){for(var Y=[],K=0;K>8,ie=K%256,Ne.push(ie),Ne.push(_e);return Ne}o(qe,"utf16leToBytes");function at(Z){return s.toByteArray(et(Z))}o(at,"base64ToBytes");function Ct(Z,Y,K,_e){for(var ie=0;ie<_e&&!(ie+K>=Y.length||ie>=Z.length);++ie)Y[ie+K]=Z[ie];return ie}o(Ct,"blitBuffer");function fe(Z,Y){return Z instanceof Y||Z!=null&&Z.constructor!=null&&Z.constructor.name!=null&&Z.constructor.name===Y.name}o(fe,"isInstance");function pe(Z){return Z!==Z}o(pe,"numberIsNaN");var ht=function(){for(var Z="0123456789abcdef",Y=new Array(256),K=0;K<16;++K)for(var _e=K*16,ie=0;ie<16;++ie)Y[_e+ie]=Z[K]+Z[ie];return Y}()},5647:(Re,ne,g)=>{"use strict";g.d(ne,{AR:()=>q,vj:()=>E});var s=g(9496),I=g.n(s),f=g(9179),w=g(1045),y=g(313),b=g(3430),$=g(320),L=Object.defineProperty,A=Object.defineProperties,v=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,F=o((Q,ee,We)=>ee in Q?L(Q,ee,{enumerable:!0,configurable:!0,writable:!0,value:We}):Q[ee]=We,"__defNormalProp"),_=o((Q,ee)=>{for(var We in ee||(ee={}))R.call(ee,We)&&F(Q,We,ee[We]);if(T)for(var We of T(ee))P.call(ee,We)&&F(Q,We,ee[We]);return Q},"__spreadValues"),C=o((Q,ee)=>A(Q,v(ee)),"__spreadProps"),k=o((Q,ee,We)=>(F(Q,typeof ee!="symbol"?ee+"":ee,We),We),"__publicField");const x=2**30,c=["createPullRequest","openPullRequest","hover.commands"];var O=(Q=>(Q[Q.BuiltIn=0]="BuiltIn",Q[Q.BuiltInPartner=1]="BuiltInPartner",Q[Q.Partner=2]="Partner",Q[Q.BuiltInPartnerInstaller=3]="BuiltInPartnerInstaller",Q))(O||{});const E="Built In";class B{constructor(ee,We){this.runner=ee,k(this,"_label"),this._label=typeof ee.label=="string"?ee.label:ee.label(We)}get label(){return this._label}get detail(){return this.runner.name}}o(B,"ActionRunnerQuickPickItem");class G{constructor(){k(this,"runner")}get label(){return"No actions were found"}get detail(){}}o(G,"NoActionRunnersQuickPickItem");let U=0;function H(){return U===x?U=1:U++,U}o(H,"nextRunnerId");class j{constructor(ee,We,Pe){this.type=ee,this.runner=We,this.unregister=Pe,k(this,"id"),this.id=H()}dispose(){this.unregister()}get name(){return this.runner.name}get label(){return this.runner.label}get order(){switch(this.type){case 0:return 0;case 1:return 1;case 2:return this.partnerId?1:2;case 3:return 3;default:return 100}}get partnerId(){return this.runner.partnerId}run(ee){return this.runner.run(ee)}}o(j,"RegisteredActionRunner");class q{constructor(ee){this.container=ee,k(this,"_onDidChange",new s.EventEmitter),k(this,"_actionRunners",new Map),k(this,"_disposable");const We=[f.DN.onDidChange(Pe=>{!f.DN.changed(Pe,"partners")||this._updateAllContextKeys()})];for(const Pe of c)We.push(s.commands.registerCommand(`${w.Gh.ActionPrefix}${Pe}`,(Te,je)=>this.run(Te,je)));this._disposable=s.Disposable.from(...We)}get onDidChange(){return this._onDidChange.event}dispose(){this._disposable.dispose();for(const ee of this._actionRunners.values())for(const We of ee)We.dispose();this._actionRunners.clear()}count(ee){var We;return((We=this.get(ee))==null?void 0:We.length)??0}get(ee){return de(this.container.config,this._actionRunners.get(ee))}has(ee){return this.count(ee)>0}register(ee,We,Pe=2){let Te=this._actionRunners.get(ee);Te==null&&(Te=[],this._actionRunners.set(ee,Te));const je=o(ue=>{this._updateContextKeys(ue),this._onDidChange.fire(ue)},"onChanged"),oe=this._actionRunners,ce=new j(Pe,We,function(){if(Te.length===1)oe.delete(ee),je(ee);else{const ue=Te.indexOf(this);ue!==-1&&Te.splice(ue,1)}});return Te.push(ce),je(ee),{dispose:()=>ce.dispose()}}registerBuiltIn(ee,We){return this.register(ee,C(_({},We),{partnerId:void 0,name:E}),0)}registerBuiltInPartner(ee,We,Pe){return this.register(We,C(_({},Pe),{partnerId:ee}),1)}registerBuiltInPartnerInstaller(ee,We,Pe){return this.register(We,C(_({},Pe),{partnerId:ee,name:`${Pe.name} (Not Installed)`}),3)}async run(ee,We){let Pe=this.get(ee.type);if(Pe==null||Pe.length===0||(We!=null&&(Pe=Pe.filter(je=>je.id===We)),Pe.length===0))return;let Te;if(Pe.length>1||Pe.every(je=>je.type!==0)){const je=Pe.sort((ue,Ae)=>ue.order-Ae.order||(0,b.dm)(ue.name,Ae.name)).map(ue=>new B(ue,ee));je.length===0&&je.push(new G);const oe=s.window.createQuickPick();oe.ignoreFocusOut=(0,$.hE)();const ce=[];try{const ue=await new Promise(Ae=>{ce.push(oe.onDidHide(()=>Ae(void 0)),oe.onDidAccept(()=>{oe.activeItems.length!==0&&Ae(oe.activeItems[0])}));let ut,Le;switch(ee.type){case"createPullRequest":ut="Create Pull Request",Le="Choose how to create a pull request";break;case"openPullRequest":ut="Open Pull Request",Le="Choose how to open the pull request";break;case"hover.commands":ut="Need Help or Want to Collaborate?",Le="Choose what you would like to do";break;default:break}oe.title=ut,oe.placeholder=Le,oe.matchOnDetail=!0,oe.items=je,oe.show()});if(ue==null)return;Te=ue.runner}finally{oe.dispose(),ce.forEach(ue=>ue.dispose())}}else[Te]=Pe;await Te?.run(ee)}async _updateContextKeys(ee){await(0,y.v)(`${w.zf.ActionPrefix}${ee}`,this.count(ee))}async _updateAllContextKeys(){for(const ee of c)await this._updateContextKeys(ee)}}o(q,"ActionRunners");function de(Q,ee){if(ee==null||ee.length===0)return;const We=Q.partners;return We==null?ee:ee.filter(Pe=>{var Te;return Pe.partnerId==null||Pe.partnerId!=null&&((Te=We[Pe.partnerId])==null?void 0:Te.enabled)!==!1})}o(de,"filterOnlyEnabledRunners")},1505:(Re,ne,g)=>{"use strict";g.d(ne,{E3:()=>ce,OV:()=>k,TU:()=>oe,oP:()=>q});var s=g(9496),I=g.n(s),f=g(2078),w=g(7785),y=g(6410),b=g(9510),$=g(2886),L=g(3430),A=Object.defineProperty,v=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable,P=o((ue,Ae,ut)=>Ae in ue?A(ue,Ae,{enumerable:!0,configurable:!0,writable:!0,value:ut}):ue[Ae]=ut,"__defNormalProp"),F=o((ue,Ae)=>{for(var ut in Ae||(Ae={}))T.call(Ae,ut)&&P(ue,ut,Ae[ut]);if(v)for(var ut of v(Ae))R.call(Ae,ut)&&P(ue,ut,Ae[ut]);return ue},"__spreadValues");const _=2**30,C=new s.EventEmitter;C.event((0,b.Ds)(()=>{const ue=x!=null?[...(0,$.DZ)(x,([Ae,ut])=>ut.uri!=null?[Ae,{uri:ut.uri.toString(),timestamp:ut.timestamp}]:void 0)]:void 0;w.W.instance.storage.store(y.BU.Avatars,ue)},1e3));var k;(ue=>{ue.onDidFetch=C.event})(k||(k={}));let x;const c=new Map,O="00000000000000000000000000000000",E=new Map,B=/^(?:(?\d+)\+)?(?[a-zA-Z\d-]{1,39})@users\.noreply\.github\.com$/,G=60*1e3,U=60*60*1e3,H=24*60*60*1e3,j=[H*7,G,G*5,G*10,U,H,H*7];function q(ue,Ae,{defaultStyle:ut,size:Le=16}={}){if(Q(x),Le*=2,!ue){const De=de(`${O}:${Le}`,void 0,Le,O,ut);return De.uri??De.fallback}const Me=(0,L.FB)(ue.trim().toLowerCase(),"hex"),Ye=`${Me}:${Le}`,et=de(Ye,ue,Le,Me,ut);if(et.uri!=null)return et.uri;let ye=c.get(Ye);return ye==null&&Ae!=null&&ee(et)&&(ye=Te(et,Ye,ue,Ae,{size:Le}).then(De=>De??et.uri??et.fallback),c.set(Ye,ye.finally(()=>c.delete(Ye)))),ye??et.uri??et.fallback}o(q,"getAvatarUri");function de(ue,Ae,ut,Le,Me){let Ye=x.get(ue);return Ye==null?(Ye={uri:Ae!=null&&Ae.length!==0?Pe(Ae,ut):void 0,fallback:We(Le,ut,Me),timestamp:0,retries:0},x.set(ue,Ye)):Ye.fallback==null&&(Ye.fallback=We(Le,ut,Me)),Ye}o(de,"createOrUpdateAvatar");function Q(ue){var Ae;if(ue==null){const ut=(Ae=w.W.instance.storage.get(y.BU.Avatars))==null?void 0:Ae.map(([Le,Me])=>[Le,{uri:s.Uri.parse(Me.uri),timestamp:Me.timestamp,retries:0}]);x=new Map(ut)}}o(Q,"ensureAvatarCache");function ee(ue){return Date.now()>=ue.timestamp+j[Math.min(ue.retries,j.length-1)]}o(ee,"hasAvatarExpired");function We(ue,Ae,ut=f.il.Robot){return s.Uri.parse(`https://www.gravatar.com/avatar/${ue}?s=${Ae}&d=${ut}`)}o(We,"getAvatarUriFromGravatar");function Pe(ue,Ae=16){const ut=B.exec(ue);if(ut==null)return;const[,Le,Me]=ut;return s.Uri.parse(`https://avatars.githubusercontent.com/${Le?`u/${Le}`:Me}?size=${Ae}`)}o(Pe,"getAvatarUriFromGitHubNoReplyAddress");async function Te(ue,Ae,ut,Le,{size:Me=16}={}){Q(x);try{let Ye;if(w.W.instance.config.integrations.enabled&&typeof Le!="string"){const et=await w.W.instance.git.getRichRemoteProvider(Le.repoPath);Ye=await et?.provider.getAccountForCommit(Le.ref,{avatarSize:Me})}if(Ye==null){ue.uri=void 0,ue.timestamp=_,ue.retries=0;return}return ue.uri=s.Uri.parse(Ye.avatarUrl),ue.timestamp=Date.now(),ue.retries=0,Ye.email!=null&&(0,L.qq)(ut,Ye.email)&&x.set(`${(0,L.FB)(Ye.email.trim().toLowerCase(),"hex")}:${Me}`,F({},ue)),C.fire({email:ut}),ue.uri}catch{ue.uri=void 0,ue.timestamp=Date.now(),ue.retries++;return}}o(Te,"getAvatarUriFromRemoteProvider");const je=new Map([["online","#28ca42"],["away","#cecece"],["busy","#ca5628"],["dnd","#ca5628"],["offline","#cecece"]]);function oe(ue){let Ae=E.get(ue);if(Ae==null){const ut=(0,L.US)(` `);Ae=encodeURI(`data:image/svg+xml;base64,${ut}`),E.set(ue,Ae)}return Ae}o(oe,"getPresenceDataUri");function ce(ue){switch(ue){case"all":w.W.instance.storage.delete(y.BU.Avatars),x?.clear(),c.clear();break;case"failed":for(const Ae of x?.values()??[])Ae.uri==null&&(Ae.timestamp=0,Ae.retries=0);break;case"fallback":for(const Ae of x?.values()??[])Ae.fallback=void 0;break}}o(ce,"resetAvatarCache")},9850:(Re,ne,g)=>{"use strict";g.d(ne,{tM:()=>ln,V:()=>Ii,_f:()=>qs,DA:()=>jn,oc:()=>Gl,MZ:()=>Vl});var s=g(1045),I=g(1161),f=g(6983),w=g(5387),y=Object.defineProperty,b=Object.getOwnPropertyDescriptor,$=o((t,i,n,d)=>{for(var h=d>1?void 0:d?b(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&y(i,n,h),h},"__decorateClass");let L=o(class extends f.mY{constructor(t){super(s.Gh.AddAuthors);this.container=t}execute(t){let i;return t?.rootUri!=null&&(i=this.container.git.getRepository(t.rootUri)),(0,w.m)({command:"co-authors",state:{repo:i,contributors:void 0}})}},"AddAuthorsCommand");L=$([(0,I.WD)()],L);var A=g(2324),v=g(2436),T=g(1999),R=g(516),P=g(320),F=Object.defineProperty,_=Object.defineProperties,C=Object.getOwnPropertyDescriptor,k=Object.getOwnPropertyDescriptors,x=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable,E=o((t,i,n)=>i in t?F(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"__defNormalProp"),B=o((t,i)=>{for(var n in i||(i={}))c.call(i,n)&&E(t,n,i[n]);if(x)for(var n of x(i))O.call(i,n)&&E(t,n,i[n]);return t},"__spreadValues"),G=o((t,i)=>_(t,k(i)),"__spreadProps"),U=o((t,i,n,d)=>{for(var h=d>1?void 0:d?C(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&F(i,n,h),h},"browseRepoAtRevision_decorateClass");let H=o(class extends f.pu{constructor(t){super([s.Gh.BrowseRepoAtRevision,s.Gh.BrowseRepoAtRevisionInNewWindow,s.Gh.BrowseRepoBeforeRevision,s.Gh.BrowseRepoBeforeRevisionInNewWindow]);this.container=t}preExecute(t,i){switch(t.command){case s.Gh.BrowseRepoAtRevisionInNewWindow:i=G(B({},i),{before:!1,openInNewWindow:!0});break;case s.Gh.BrowseRepoBeforeRevision:i=G(B({},i),{before:!0,openInNewWindow:!1});break;case s.Gh.BrowseRepoBeforeRevisionInNewWindow:i=G(B({},i),{before:!0,openInNewWindow:!0});break}return this.execute(t.editor,t.uri,i)}async execute(t,i,n){n=B({},n);try{if(n.uri==null){if(i=(0,f.SX)(i,t),i==null)return}else i=n.uri;let d=await A.YY.fromUri(i);if(d.sha==null)return;const h=n?.before?await this.container.git.resolveReference(d.repoPath,`${d.sha}^`):d.sha;i=this.container.git.getRevisionUri(h,d.repoPath,d.repoPath),d=A.YY.fromRevisionUri(i),(0,P.ic)(i,{location:n.openInNewWindow?P.Tc.NewWindow:P.Tc.AddToWorkspace,name:`${(0,R.EZ)(d.repoPath)} @ ${d.shortSha}`}),n.openInNewWindow||(0,I.dO)(s.nA.FocusFilesExplorer)}catch(d){v.Y.error(d,"BrowseRepoAtRevisionCommand"),T.V.showGenericErrorMessage("Unable to open the repository at the specified revision")}}},"BrowseRepoAtRevisionCommand");H=U([(0,I.WD)()],H);var j=g(9496),q=g(5078),de=g(8690),Q=g(9510),ee=Object.defineProperty,We=Object.getOwnPropertyDescriptor,Pe=Object.getOwnPropertySymbols,Te=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,oe=o((t,i,n)=>i in t?ee(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"closeUnchangedFiles_defNormalProp"),ce=o((t,i)=>{for(var n in i||(i={}))Te.call(i,n)&&oe(t,n,i[n]);if(Pe)for(var n of Pe(i))je.call(i,n)&&oe(t,n,i[n]);return t},"closeUnchangedFiles_spreadValues"),ue=o((t,i,n,d)=>{for(var h=d>1?void 0:d?We(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&ee(i,n,h),h},"closeUnchangedFiles_decorateClass"),Ae=o((t,i,n)=>(oe(t,typeof i!="symbol"?i+"":i,n),n),"__publicField");let ut=o(class extends f.mY{constructor(t){super(s.Gh.CloseUnchangedFiles);this.container=t,Ae(this,"_onEditorChangedFn")}async execute(t){t=ce({},t);try{if(t.uris==null){const M=await de.I.getRepositoryOrShow("Close All Unchanged Files");if(M==null)return;const le=await this.container.git.getStatusForRepo(M.uri);if(le==null){j.window.showWarningMessage("Unable to close unchanged files");return}t.uris=le.files.map(be=>be.uri)}if(t.uris.length===0){(0,I.dO)(s.nA.CloseAllEditors);return}const i=j.window.onDidChangeActiveTextEditor((0,Q.Ds)(M=>{var le;return(le=this._onEditorChangedFn)==null?void 0:le.call(this,M)},50));let n=j.window.activeTextEditor,d=0,h=0;const D=[];for(;;){if(n!=null){let M=!1;for(const le of D)if(q.o.equals(le,n,{usePosition:!0})){M=!0;break}if(M)break;d++,D.push(n)}else d!==0&&d++;if(n=await this.nextEditor(),h++,h>=4&&D.length===0)break}if(D.length){n=j.window.activeTextEditor;for(let M=0;M<=d;M++)n==null||n.document.isDirty||t.uris.some(le=>q.n.equals(le,n?.document.uri))?n=await this.nextEditor():n=await this.closeEditor()}i.dispose()}catch(i){v.Y.error(i,"CloseUnchangedFilesCommand"),T.V.showGenericErrorMessage("Unable to close all unchanged files")}}async closeEditor(t=500){const i=j.window.activeTextEditor;return await(0,I.dO)(s.nA.CloseActiveEditor),i!==j.window.activeTextEditor?j.window.activeTextEditor:this.waitForEditorChange(t)}async nextEditor(t=500){const i=j.window.activeTextEditor;return await(0,I.dO)(s.nA.NextEditor),i!==j.window.activeTextEditor?j.window.activeTextEditor:this.waitForEditorChange(t)}waitForEditorChange(t=500){return new Promise(i=>{let n;this._onEditorChangedFn=d=>{n!=null&&(clearTimeout(n),n=void 0,i(d))},n=setTimeout(()=>{n=void 0,i(j.window.activeTextEditor)},t)})}},"CloseUnchangedFilesCommand");ut=ue([(0,I.WD)()],ut);var Le=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,Ye=Object.getOwnPropertySymbols,et=Object.prototype.hasOwnProperty,ye=Object.prototype.propertyIsEnumerable,De=o((t,i,n)=>i in t?Le(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"compareWith_defNormalProp"),qe=o((t,i)=>{for(var n in i||(i={}))et.call(i,n)&&De(t,n,i[n]);if(Ye)for(var n of Ye(i))ye.call(i,n)&&De(t,n,i[n]);return t},"compareWith_spreadValues"),at=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Me(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Le(i,n,h),h},"compareWith_decorateClass");let Ct=o(class extends f.pu{constructor(t){super([s.Gh.CompareWith,s.Gh.CompareHeadWith,s.Gh.CompareWorkingWith,s.Gh.Deprecated_DiffHeadWith,s.Gh.Deprecated_DiffWorkingWith]);this.container=t}preExecute(t,i){switch(t.command){case s.Gh.CompareWith:i=qe({},i);break;case s.Gh.CompareHeadWith:case s.Gh.Deprecated_DiffHeadWith:i=qe({},i),i.ref1="HEAD";break;case s.Gh.CompareWorkingWith:case s.Gh.Deprecated_DiffWorkingWith:i=qe({},i),i.ref1="";break}return this.execute(t.editor,t.uri,i)}async execute(t,i,n){var d;i=(0,f.SX)(i,t),n=qe({},n);try{let h;switch(n.ref1){case null:h="Compare";break;case"":h="Compare Working Tree with";break;case"HEAD":h="Compare HEAD with";break;default:h=`Compare ${n.ref1} with`;break}const D=(d=await de.I.getBestRepositoryOrShow(i,t,h))==null?void 0:d.path;if(!D)return;n.ref1!=null&&n.ref2!=null?await this.container.searchAndCompareView.compare(D,n.ref1,n.ref2):this.container.searchAndCompareView.selectForCompare(D,n.ref1,{prompt:!0})}catch(h){v.Y.error(h,"CompareWithCommmand"),T.V.showGenericErrorMessage("Unable to open comparison")}}},"CompareWithCommand");Ct=at([(0,I.WD)()],Ct);var fe=Object.defineProperty,pe=Object.getOwnPropertyDescriptor,ht=o((t,i,n,d)=>{for(var h=d>1?void 0:d?pe(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&fe(i,n,h),h},"copyCurrentBranch_decorateClass");let Z=o(class extends f.pu{constructor(t){super(s.Gh.CopyCurrentBranch);this.container=t}async execute(t,i){i=(0,f.SX)(i,t);const n=i!=null?await A.YY.fromUri(i):void 0,d=await de.I.getBestRepositoryOrShow(n,t,"Copy Current Branch Name");if(d!=null)try{const h=await d.getBranch();h?.name&&await j.env.clipboard.writeText(h.name)}catch(h){v.Y.error(h,"CopyCurrentBranchCommand"),j.window.showErrorMessage("Unable to copy current branch name. See output channel for more details")}}},"CopyCurrentBranchCommand");Z=ht([(0,I.WD)()],Z);var Y=g(2886),K=Object.defineProperty,_e=Object.getOwnPropertyDescriptor,ie=Object.getOwnPropertySymbols,Ne=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,Ie=o((t,i,n)=>i in t?K(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"copyMessageToClipboard_defNormalProp"),nt=o((t,i)=>{for(var n in i||(i={}))Ne.call(i,n)&&Ie(t,n,i[n]);if(ie)for(var n of ie(i))Ce.call(i,n)&&Ie(t,n,i[n]);return t},"copyMessageToClipboard_spreadValues"),wt=o((t,i,n,d)=>{for(var h=d>1?void 0:d?_e(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&K(i,n,h),h},"copyMessageToClipboard_decorateClass");let pt=o(class extends f.pu{constructor(t){super(s.Gh.CopyMessageToClipboard);this.container=t}async preExecute(t,i){var n,d;return(0,f.en)(t)?(i=nt({},i),i.sha=t.node.commit.sha,t.node.commit.message!=null&&await t.node.commit.ensureFullDetails(),i.message=t.node.commit.message,this.execute(t.editor,((n=t.node.commit.file)==null?void 0:n.uri)??((d=t.node.commit.getRepository())==null?void 0:d.uri),i)):(0,f.Qo)(t)?(i=nt({},i),i.sha=t.node.branch.sha,this.execute(t.editor,t.node.uri,i)):(0,f._5)(t)?(i=nt({},i),i.sha=t.node.tag.sha,this.execute(t.editor,t.node.uri,i)):this.execute(t.editor,t.uri,i)}async execute(t,i,n){var d;i=(0,f.SX)(i,t),n=nt({},n);try{if(!n.message){let h;if(i==null){if(h=(d=this.container.git.getBestRepository(t))==null?void 0:d.path,!h)return;const D=await this.container.git.getLog(h,{limit:1});if(D==null)return;const M=(0,Y.Ps)(D.commits.values());if(M?.message==null)return;n.message=M.message}else if(n.message==null){const D=await A.YY.fromUri(i);if(h=D.repoPath,n.sha==null){const M=t?.selection.active.line??0;if(M<0)return;try{const le=await this.container.git.getBlameForLine(D,M,t?.document);if(le==null||le.commit.isUncommitted)return;await w.u.Commit.copyMessageToClipboard(le.commit);return}catch(le){v.Y.error(le,"CopyMessageToClipboardCommand",`getBlameForLine(${M})`),T.V.showGenericErrorMessage("Unable to copy message");return}}else{await w.u.Commit.copyMessageToClipboard({ref:n.sha,repoPath:h});return}}}await j.env.clipboard.writeText(n.message)}catch(h){v.Y.error(h,"CopyMessageToClipboardCommand"),T.V.showGenericErrorMessage("Unable to copy message")}}},"CopyMessageToClipboardCommand");pt=wt([(0,I.WD)()],pt);var ct=Object.defineProperty,$t=Object.getOwnPropertyDescriptor,Gt=Object.getOwnPropertySymbols,Ai=Object.prototype.hasOwnProperty,Ti=Object.prototype.propertyIsEnumerable,Pi=o((t,i,n)=>i in t?ct(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"copyShaToClipboard_defNormalProp"),Lt=o((t,i)=>{for(var n in i||(i={}))Ai.call(i,n)&&Pi(t,n,i[n]);if(Gt)for(var n of Gt(i))Ti.call(i,n)&&Pi(t,n,i[n]);return t},"copyShaToClipboard_spreadValues"),ti=o((t,i,n,d)=>{for(var h=d>1?void 0:d?$t(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&ct(i,n,h),h},"copyShaToClipboard_decorateClass");let Ei=o(class extends f.pu{constructor(t){super(s.Gh.CopyShaToClipboard);this.container=t}preExecute(t,i){var n,d;return(0,f.en)(t)?(i=Lt({},i),i.sha=this.container.config.advanced.abbreviateShaOnCopy?t.node.commit.shortSha:t.node.commit.sha,this.execute(t.editor,((n=t.node.commit.file)==null?void 0:n.uri)??((d=t.node.commit.getRepository())==null?void 0:d.uri),i)):(0,f.Qo)(t)?(i=Lt({},i),i.sha=t.node.branch.sha,this.execute(t.editor,t.node.uri,i)):(0,f._5)(t)?(i=Lt({},i),i.sha=t.node.tag.sha,this.execute(t.editor,t.node.uri,i)):this.execute(t.editor,t.uri,i)}async execute(t,i,n){var d;i=(0,f.SX)(i,t),n=Lt({},n);try{if(!n.sha){if(i==null){const h=(d=this.container.git.getBestRepository(t))==null?void 0:d.path;if(!h)return;const D=await this.container.git.getLog(h,{limit:1});if(D==null)return;n.sha=(0,Y.Ps)(D.commits.values()).sha}else if(n.sha==null){const h=t?.selection.active.line??0;if(h<0)return;try{const D=await A.YY.fromUri(i),M=await this.container.git.getBlameForLine(D,h,t?.document);if(M==null)return;n.sha=M.commit.sha}catch(D){v.Y.error(D,"CopyShaToClipboardCommand",`getBlameForLine(${h})`),T.V.showGenericErrorMessage("Unable to copy commit SHA");return}}}await j.env.clipboard.writeText(n.sha)}catch(h){v.Y.error(h,"CopyShaToClipboardCommand"),T.V.showGenericErrorMessage("Unable to copy commit SHA")}}},"CopyShaToClipboardCommand");Ei=ti([(0,I.WD)()],Ei);var Hi=g(4504),dr=Object.defineProperty,St=Object.getOwnPropertyDescriptor,we=o((t,i,n,d)=>{for(var h=d>1?void 0:d?St(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&dr(i,n,h),h},"createPullRequestOnRemote_decorateClass");let Fe=o(class extends f.mY{constructor(t){super(s.Gh.CreatePullRequestOnRemote);this.container=t}async execute(t){if(t?.repoPath==null)return;const i=this.container.git.getRepository(t.repoPath);if(i==null)return;const n=await i.getRemote(t.remote);if(n?.provider==null)return;const d=n.provider.id,h=await i.getRemotes({filter:M=>{var le;return((le=M.provider)==null?void 0:le.id)===d}}),D={type:Hi.JD.CreatePullRequest,base:{branch:t.base,remote:void 0},compare:{branch:t.compare,remote:{path:n.path,url:n.url}}};await(0,I.P0)(s.Gh.OpenOnRemote,{resource:D,remotes:h})}},"CreatePullRequestOnRemoteCommand");Fe=we([(0,I.WD)()],Fe);var Je=g(5518),dt=g(3422),ft=Object.defineProperty,kt=Object.getOwnPropertyDescriptor,Rt=Object.getOwnPropertySymbols,Dt=Object.prototype.hasOwnProperty,ri=Object.prototype.propertyIsEnumerable,jt=o((t,i,n)=>i in t?ft(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"openDirectoryCompare_defNormalProp"),qt=o((t,i)=>{for(var n in i||(i={}))Dt.call(i,n)&&jt(t,n,i[n]);if(Rt)for(var n of Rt(i))ri.call(i,n)&&jt(t,n,i[n]);return t},"openDirectoryCompare_spreadValues"),Ht=o((t,i,n,d)=>{for(var h=d>1?void 0:d?kt(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&ft(i,n,h),h},"openDirectoryCompare_decorateClass");let vi=o(class extends f.pu{constructor(t){super([s.Gh.DiffDirectory,s.Gh.DiffDirectoryWithHead,s.Gh.ViewsOpenDirectoryDiff,s.Gh.ViewsOpenDirectoryDiffWithWorking]);this.container=t}async preExecute(t,i){switch(t.command){case s.Gh.DiffDirectoryWithHead:i=qt({},i),i.ref1="HEAD",i.ref2=void 0;break;case s.Gh.ViewsOpenDirectoryDiff:t.type==="viewItem"&&t.node instanceof dt.fc&&(i=qt({},i),[i.ref1,i.ref2]=await t.node.getDiffRefs());break;case s.Gh.ViewsOpenDirectoryDiffWithWorking:(0,f.DW)(t)&&(i=qt({},i),i.ref1=t.node.ref.ref,i.ref2=void 0);break}return this.execute(t.editor,t.uri,i)}async execute(t,i,n){var d;i=(0,f.SX)(i,t),n=qt({},n);try{const h=(d=await de.I.getBestRepositoryOrShow(i,t,"Directory Compare Working Tree With"))==null?void 0:d.path;if(!h)return;if(!n.ref1){const D=await Je.e.show(h,"Directory Compare Working Tree with","Choose a branch or tag to compare with",{allowEnteringRefs:!0});if(D==null||(n.ref1=D.ref,n.ref1==null))return}w.u.Commit.openDirectoryCompare(h,n.ref1,n.ref2)}catch(h){v.Y.error(h,"OpenDirectoryCompareCommand"),T.V.showGenericErrorMessage("Unable to open directory compare")}}},"OpenDirectoryCompareCommand");vi=Ht([(0,I.WD)()],vi);var ii=Object.defineProperty,ar=Object.getOwnPropertyDescriptor,Rr=Object.getOwnPropertySymbols,ze=Object.prototype.hasOwnProperty,$e=Object.prototype.propertyIsEnumerable,ke=o((t,i,n)=>i in t?ii(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"diffLineWithPrevious_defNormalProp"),Ge=o((t,i)=>{for(var n in i||(i={}))ze.call(i,n)&&ke(t,n,i[n]);if(Rr)for(var n of Rr(i))$e.call(i,n)&&ke(t,n,i[n]);return t},"diffLineWithPrevious_spreadValues"),Ke=o((t,i,n,d)=>{for(var h=d>1?void 0:d?ar(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&ii(i,n,h),h},"diffLineWithPrevious_decorateClass");let Oe=o(class extends f.pu{constructor(t){super(s.Gh.DiffLineWithPrevious);this.container=t}async execute(t,i,n){var d;if(i=(0,f.SX)(i,t),i==null)return;n=Ge({},n),n.line==null&&(n.line=t?.selection.active.line??0);const h=((d=n.commit)==null?void 0:d.getGitUri())??await A.YY.fromUri(i);try{const D=await this.container.git.getPreviousComparisonUrisForLine(h.repoPath,h,n.line,h.sha);if(D==null||D.previous==null){T.V.showCommitHasNoPreviousCommitWarningMessage();return}await(0,I.P0)(s.Gh.DiffWith,{repoPath:D.current.repoPath,lhs:{sha:D.previous.sha??"",uri:D.previous.documentUri()},rhs:{sha:D.current.sha??"",uri:D.current.documentUri()},line:D.line,showOptions:n.showOptions})}catch(D){v.Y.error(D,"DiffLineWithPreviousCommand",`getPreviousLineDiffUris(${h.repoPath}, ${h.fsPath}, ${h.sha})`),T.V.showGenericErrorMessage("Unable to open compare")}}},"DiffLineWithPreviousCommand");Oe=Ke([(0,I.WD)()],Oe);var Se=g(2976),Xe=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,gt=Object.getOwnPropertySymbols,_t=Object.prototype.hasOwnProperty,It=Object.prototype.propertyIsEnumerable,Qt=o((t,i,n)=>i in t?Xe(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"diffLineWithWorking_defNormalProp"),ui=o((t,i)=>{for(var n in i||(i={}))_t.call(i,n)&&Qt(t,n,i[n]);if(gt)for(var n of gt(i))It.call(i,n)&&Qt(t,n,i[n]);return t},"diffLineWithWorking_spreadValues"),zt=o((t,i,n,d)=>{for(var h=d>1?void 0:d?lt(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Xe(i,n,h),h},"diffLineWithWorking_decorateClass");let di=o(class extends f.pu{constructor(t){super(s.Gh.DiffLineWithWorking);this.container=t}async execute(t,i,n){var d,h;if(i=(0,f.SX)(i,t),i==null)return;const D=await A.YY.fromUri(i);n=ui({},n),n.line==null&&(n.line=t?.selection.active.line??0);let M,le;if(n.commit==null||n.commit.isUncommitted){const Ee=n.line;if(Ee<0)return;try{const xe=await this.container.git.getBlameForLine(D,Ee,t?.document);if(xe==null){T.V.showFileNotUnderSourceControlWarningMessage("Unable to open compare");return}if(n.commit=xe.commit,n.commit.isUncommitted){const Ue=await this.container.git.getStatusForFile(D.repoPath,D);Ue?.indexStatus!=null?(M=Se.GitRevision.uncommittedStaged,le=this.container.git.getAbsoluteUri(Ue.originalPath||Ue.path,n.commit.repoPath)):(M=n.commit.unresolvedPreviousSha,le=n.commit.file.originalUri??n.commit.file.uri)}else M=n.commit.sha,le=n.commit.file.uri;n.line=xe.line.line-1}catch(xe){v.Y.error(xe,"DiffLineWithWorkingCommand",`getBlameForLine(${Ee})`),T.V.showGenericErrorMessage("Unable to open compare");return}}else M=n.commit.sha,le=((d=n.commit.file)==null?void 0:d.uri)??D;const be=await((h=n.commit.file)==null?void 0:h.getWorkingUri());if(be==null){j.window.showWarningMessage("Unable to open compare. File has been deleted from the working tree");return}await(0,I.P0)(s.Gh.DiffWith,{repoPath:n.commit.repoPath,lhs:{sha:M,uri:le},rhs:{sha:"",uri:be},line:n.line,showOptions:n.showOptions})}},"DiffLineWithWorkingCommand");di=zt([(0,I.WD)()],di);var _i=Object.defineProperty,Si=Object.defineProperties,zi=Object.getOwnPropertyDescriptor,Yi=Object.getOwnPropertyDescriptors,Ki=Object.getOwnPropertySymbols,nr=Object.prototype.hasOwnProperty,ir=Object.prototype.propertyIsEnumerable,Zi=o((t,i,n)=>i in t?_i(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"diffWith_defNormalProp"),Qi=o((t,i)=>{for(var n in i||(i={}))nr.call(i,n)&&Zi(t,n,i[n]);if(Ki)for(var n of Ki(i))ir.call(i,n)&&Zi(t,n,i[n]);return t},"diffWith_spreadValues"),or=o((t,i)=>Si(t,Yi(i)),"diffWith_spreadProps"),fr=o((t,i,n,d)=>{for(var h=d>1?void 0:d?zi(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&_i(i,n,h),h},"diffWith_decorateClass");let Ii=o(class extends f.mY{constructor(t){super(s.Gh.DiffWith);this.container=t}static getMarkdownCommandArgs(t,i){let n;if(Se.GitCommit.is(t)){const d=t;if(d.file==null||d.unresolvedPreviousSha==null)throw new Error("Commit has no file");d.isUncommitted?n={repoPath:d.repoPath,lhs:{sha:"HEAD",uri:d.file.uri},rhs:{sha:"",uri:d.file.uri},line:i}:n={repoPath:d.repoPath,lhs:{sha:d.unresolvedPreviousSha,uri:d.file.originalUri??d.file.uri},rhs:{sha:d.sha,uri:d.file.uri},line:i}}else n=t;return super.getMarkdownCommandArgsCore(s.Gh.DiffWith,n)}async execute(t){if(!(t?.lhs==null||t?.rhs==null)&&(t=or(Qi({},t),{lhs:Qi({},t.lhs),rhs:Qi({},t.rhs),showOptions:t.showOptions==null?void 0:Qi({},t.showOptions)}),t.repoPath!=null))try{let i=t.lhs.sha,n=t.rhs.sha;if([t.lhs.sha,t.rhs.sha]=await Promise.all([await this.container.git.resolveReference(t.repoPath,t.lhs.sha,t.lhs.uri,{timeout:Se.GitRevision.isSha(t.lhs.sha)?100:void 0}),await this.container.git.resolveReference(t.repoPath,t.rhs.sha,t.rhs.uri,{timeout:Se.GitRevision.isSha(t.rhs.sha)?100:void 0})]),t.lhs.sha!==Se.GitRevision.deletedOrMissing&&(i=t.lhs.sha),t.rhs.sha&&t.rhs.sha!==Se.GitRevision.deletedOrMissing){const be=await this.container.git.getFileStatusForCommit(t.repoPath,t.rhs.uri,t.rhs.sha);be?.status==="D"?t.rhs.sha=Se.GitRevision.deletedOrMissing:n=t.rhs.sha,be?.status==="A"&&t.lhs.sha.endsWith("^")&&(t.lhs.sha=Se.GitRevision.deletedOrMissing)}const[d,h]=await Promise.all([this.container.git.getBestRevisionUri(t.repoPath,t.lhs.uri.fsPath,t.lhs.sha),this.container.git.getBestRevisionUri(t.repoPath,t.rhs.uri.fsPath,t.rhs.sha)]);let D=Se.GitRevision.shorten(n,{strings:{uncommitted:"Working Tree"}});h==null?Se.GitRevision.isUncommitted(t.rhs.sha)?D="deleted":D.length===0&&t.rhs.sha===Se.GitRevision.deletedOrMissing?D="not in Working Tree":D=`deleted${D.length===0?"":` in ${D}`}`:d==null&&(D=`added${D.length===0?"":` in ${D}`}`);let M=t.lhs.sha!==Se.GitRevision.deletedOrMissing?Se.GitRevision.shorten(i):"";d==null&&t.rhs.sha.length===0&&(h!=null?(M=M.length===0?"":`not in ${M}`,D=""):M=`deleted${M.length===0?"":` in ${M}`}`),t.lhs.title==null&&(d!=null||M.length!==0)&&(t.lhs.title=`${(0,R.EZ)(t.lhs.uri.fsPath)}${M?` (${M})`:""}`),t.rhs.title==null&&(t.rhs.title=`${(0,R.EZ)(t.rhs.uri.fsPath)}${D?` (${D})`:""}`);const le=t.lhs.title!=null&&t.rhs.title!=null?`${t.lhs.title} ${s.NE.ArrowLeftRightLong} ${t.rhs.title}`:t.lhs.title??t.rhs.title;t.showOptions==null&&(t.showOptions={}),t.showOptions.viewColumn==null&&(t.showOptions.viewColumn=j.ViewColumn.Active),t.line!=null&&t.line!==0&&(t.showOptions.selection=new j.Range(t.line,0,t.line,0)),await(0,I.dO)(s.nA.Diff,d??this.container.git.getRevisionUri(Se.GitRevision.deletedOrMissing,t.lhs.uri.fsPath,t.repoPath),h??this.container.git.getRevisionUri(Se.GitRevision.deletedOrMissing,t.rhs.uri.fsPath,t.repoPath),le,t.showOptions)}catch(i){v.Y.error(i,"DiffWithCommand","getVersionedFile"),T.V.showGenericErrorMessage("Unable to open compare")}}},"DiffWithCommand");Ii=fr([(0,I.WD)()],Ii);var li=Object.defineProperty,te=Object.defineProperties,ve=Object.getOwnPropertyDescriptor,Ze=Object.getOwnPropertyDescriptors,ot=Object.getOwnPropertySymbols,tt=Object.prototype.hasOwnProperty,bt=Object.prototype.propertyIsEnumerable,Pt=o((t,i,n)=>i in t?li(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"diffWithNext_defNormalProp"),Ft=o((t,i)=>{for(var n in i||(i={}))tt.call(i,n)&&Pt(t,n,i[n]);if(ot)for(var n of ot(i))bt.call(i,n)&&Pt(t,n,i[n]);return t},"diffWithNext_spreadValues"),ni=o((t,i)=>te(t,Ze(i)),"diffWithNext_spreadProps"),oi=o((t,i,n,d)=>{for(var h=d>1?void 0:d?ve(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&li(i,n,h),h},"diffWithNext_decorateClass");let Ut=o(class extends f.pu{constructor(t){super([s.Gh.DiffWithNext,s.Gh.DiffWithNextInDiffLeft,s.Gh.DiffWithNextInDiffRight]);this.container=t}preExecute(t,i){return t.command===s.Gh.DiffWithNextInDiffLeft&&(i=ni(Ft({},i),{inDiffLeftEditor:!0})),this.execute(t.editor,t.uri,i)}async execute(t,i,n){var d;if(i=(0,f.SX)(i,t),i==null)return;n=Ft({},n),n.line==null&&(n.line=t?.selection.active.line??0);const h=((d=n.commit)==null?void 0:d.getGitUri())??await A.YY.fromUri(i);try{const D=await this.container.git.getNextComparisonUris(h.repoPath,h,h.sha,n.inDiffLeftEditor?1:0);if(D==null||D.next==null)return;await(0,I.P0)(s.Gh.DiffWith,{repoPath:D.current.repoPath,lhs:{sha:D.current.sha??"",uri:D.current.documentUri()},rhs:{sha:D.next.sha??"",uri:D.next.documentUri()},line:n.line,showOptions:n.showOptions})}catch(D){v.Y.error(D,"DiffWithNextCommand",`getNextDiffUris(${h.repoPath}, ${h.fsPath}, ${h.sha})`),T.V.showGenericErrorMessage("Unable to open compare")}}},"DiffWithNextCommand");Ut=oi([(0,I.WD)()],Ut);var si=Object.defineProperty,Yt=Object.defineProperties,Zt=Object.getOwnPropertyDescriptor,Xt=Object.getOwnPropertyDescriptors,Kt=Object.getOwnPropertySymbols,Wi=Object.prototype.hasOwnProperty,Gi=Object.prototype.propertyIsEnumerable,ji=o((t,i,n)=>i in t?si(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"diffWithPrevious_defNormalProp"),rr=o((t,i)=>{for(var n in i||(i={}))Wi.call(i,n)&&ji(t,n,i[n]);if(Kt)for(var n of Kt(i))Gi.call(i,n)&&ji(t,n,i[n]);return t},"diffWithPrevious_spreadValues"),Zr=o((t,i)=>Yt(t,Xt(i)),"diffWithPrevious_spreadProps"),kn=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Zt(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&si(i,n,h),h},"diffWithPrevious_decorateClass");let Dr=o(class extends f.pu{constructor(t){super([s.Gh.DiffWithPrevious,s.Gh.DiffWithPreviousInDiffLeft,s.Gh.DiffWithPreviousInDiffRight]);this.container=t}preExecute(t,i){return t.command===s.Gh.DiffWithPreviousInDiffRight&&(i=Zr(rr({},i),{inDiffRightEditor:!0})),this.execute(t.editor,t.uri,i)}async execute(t,i,n){var d,h;if(n=rr({},n),n.uri==null){if(i=(0,f.SX)(i,t),i==null)return}else i=n.uri;n.line==null&&(n.line=t?.selection.active.line??0);let D;if(((d=n.commit)==null?void 0:d.file)!=null){if(!n.commit.isUncommitted){await(0,I.P0)(s.Gh.DiffWith,{repoPath:n.commit.repoPath,lhs:{sha:`${n.commit.sha}^`,uri:n.commit.file.originalUri??n.commit.file.uri},rhs:{sha:n.commit.sha||"",uri:n.commit.file.uri},line:n.line,showOptions:n.showOptions});return}D=(h=n.commit)==null?void 0:h.getGitUri()}else D=await A.YY.fromUri(i);try{const M=await this.container.git.getPreviousComparisonUris(D.repoPath,D,D.sha,n.inDiffRightEditor?1:0);if(M==null||M.previous==null){if(M==null){T.V.showCommitHasNoPreviousCommitWarningMessage();return}if(M.current.sha==null){await(0,P.GR)(M.current,n.showOptions);return}if(!M.current.isUncommittedStaged){T.V.showCommitHasNoPreviousCommitWarningMessage();return}M.previous=A.YY.fromFile(M.current.fileName,M.current.repoPath,Se.GitRevision.deletedOrMissing)}await(0,I.P0)(s.Gh.DiffWith,{repoPath:M.current.repoPath,lhs:{sha:M.previous.sha??"",uri:M.previous.documentUri()},rhs:{sha:M.current.sha??"",uri:M.current.documentUri()},line:n.line,showOptions:n.showOptions})}catch(M){v.Y.error(M,"DiffWithPreviousCommand",`getPreviousDiffUris(${D.repoPath}, ${D.fsPath}, ${D.sha})`),T.V.showGenericErrorMessage("Unable to open compare")}}},"DiffWithPreviousCommand");Dr=kn([(0,I.WD)()],Dr);var Ui=g(9179),yi=g(7785),Fi=g(3708),wr=g(680),Ni=g(4761),Nr=g(5355),Wr;(t=>{async function i(n,d,h,D){const M=j.window.createQuickPick();M.ignoreFocusOut=(0,P.hE)(),M.title=d,M.placeholder=h,M.matchOnDescription=!0,M.matchOnDetail=!0,(0,wr.tI)(n)&&(M.busy=!0,M.enabled=!1,M.show(),n=await n,n==null&&(M.placeholder="Unable to show commit history")),M.items=le(n),D?.picked&&(M.activeItems=M.items.filter(Ue=>Fi.$w.is(Ue)?!1:Ue.picked));function le(Ue){return Ue==null?[Ni.x.create(Ni.X.Cancel)]:[...D?.showOtherReferences??[],...(0,Y.UI)(Ue.commits.values(),st=>Nr.zK.create(st,D?.picked===st.ref,{compact:!0,icon:!0})),...Ue?.hasMore?[Ni.x.create(Ni.X.LoadMore)]:[]]}o(le,"getItems");async function be(){var Ue,st;M.busy=!0,M.enabled=!1;try{n=await((st=(Ue=await n)==null?void 0:Ue.more)==null?void 0:st.call(Ue,Ui.DN.get("advanced.maxListItems")));const He=le(n);let vt=-1;if(M.activeItems.length!==0){const Et=M.activeItems[0];vt=M.items.indexOf(Et),Ni.x.is(Et)&&vt--}M.items=He,vt&&(M.activeItems=[M.items[vt]])}finally{M.busy=!1,M.enabled=!0}}o(be,"loadMore");const Ee=[];let xe;D?.keys!=null&&D.keys.length!==0&&D?.onDidPressKey!==null&&(xe=yi.W.instance.keyboard.createScope(Object.fromEntries(D.keys.map(Ue=>[Ue,{onDidPressKey:st=>{if(M.activeItems.length!==0){const[He]=M.activeItems;He!=null&&!Ni.x.is(He)&&!Fi.$w.is(He)&&D.onDidPressKey(st,He)}}}]))),xe.start(),Ee.push(xe));try{const Ue=await new Promise(st=>{Ee.push(M.onDidHide(()=>st(void 0)),M.onDidAccept(()=>{if(M.activeItems.length!==0){const[He]=M.activeItems;if(Ni.x.is(He))switch(He.directive){case Ni.X.LoadMore:be();return;default:st(void 0);return}st(He)}}),M.onDidChangeValue(async He=>{xe!=null&&(He.length!==0?await xe.pause(["left","right"]):await xe.resume())})),M.busy=!1,M.enabled=!0,M.show()});if(Ue==null||Ni.x.is(Ue))return;if(Ue instanceof Fi.$w){await Ue.execute();return}return Ue.item}finally{M.dispose(),Ee.forEach(Ue=>Ue.dispose())}}o(i,"show"),t.show=i})(Wr||(Wr={}));var gr;(t=>{async function i(n,d,h,D){var M;const le=j.window.createQuickPick();le.ignoreFocusOut=(0,P.hE)(),le.title=d,le.placeholder=h,le.matchOnDescription=!0,le.matchOnDetail=!0,(0,wr.tI)(n)&&(le.busy=!0,le.enabled=!1,le.show(),n=await n),n!=null&&(le.items=[...D?.showOtherReferences??[],...(0,Y.UI)(D?.filter!=null?(0,Y.hX)(n.commits.values(),D.filter):n.commits.values(),xe=>Nr.zK.create(xe,D?.picked===xe.ref,{compact:!0,icon:!0}))]),(n==null||le.items.length<=(((M=D?.showOtherReferences)==null?void 0:M.length)??0))&&(le.placeholder=n==null?"No stashes found":D?.empty??"No matching stashes found",le.items=[Ni.x.create(Ni.X.Cancel)]),D?.picked&&(le.activeItems=le.items.filter(xe=>Fi.$w.is(xe)?!1:xe.picked));const be=[];let Ee;D?.keys!=null&&D.keys.length!==0&&D?.onDidPressKey!==null&&(Ee=yi.W.instance.keyboard.createScope(Object.fromEntries(D.keys.map(xe=>[xe,{onDidPressKey:Ue=>{if(le.activeItems.length!==0){const[st]=le.activeItems;st!=null&&!Ni.x.is(st)&&!Fi.$w.is(st)&&D.onDidPressKey(Ue,st)}}}]))),Ee.start(),be.push(Ee));try{const xe=await new Promise(Ue=>{be.push(le.onDidHide(()=>Ue(void 0)),le.onDidAccept(()=>{if(le.activeItems.length!==0){const[st]=le.activeItems;if(Ni.x.is(st)){Ue(void 0);return}Ue(st)}}),le.onDidChangeValue(async st=>{Ee!=null&&(st.length!==0?await Ee.pause(["left","right"]):await Ee.resume())})),le.busy=!1,le.enabled=!0,le.show()});if(xe==null||Ni.x.is(xe))return;if(xe instanceof Fi.$w){await xe.execute();return}return xe.item}finally{le.dispose(),be.forEach(xe=>xe.dispose())}}o(i,"show"),t.show=i})(gr||(gr={}));var Xi=g(3430),Lr=Object.defineProperty,Mr=Object.getOwnPropertyDescriptor,Fr=Object.getOwnPropertySymbols,Gr=Object.prototype.hasOwnProperty,Vr=Object.prototype.propertyIsEnumerable,hi=o((t,i,n)=>i in t?Lr(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"diffWithRevision_defNormalProp"),Xr=o((t,i)=>{for(var n in i||(i={}))Gr.call(i,n)&&hi(t,n,i[n]);if(Fr)for(var n of Fr(i))Vr.call(i,n)&&hi(t,n,i[n]);return t},"diffWithRevision_spreadValues"),ps=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Mr(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Lr(i,n,h),h},"diffWithRevision_decorateClass");let Jr=o(class extends f.pu{constructor(t){super(s.Gh.DiffWithRevision);this.container=t}async execute(t,i,n){if(i=(0,f.SX)(i,t),i==null)return;const d=await A.YY.fromUri(i);n=Xr({},n),n.line==null&&(n.line=t?.selection.active.line??0);try{const h=this.container.git.getLogForFile(d.repoPath,d.fsPath).then(le=>le??(d.sha?this.container.git.getLogForFile(d.repoPath,d.fsPath,{ref:d.sha}):void 0)),D=`Open Changes with Revision${(0,Xi.vk)(s.NE.Dot,2,2)}`,M=await Wr.show(h,`${D}${d.getFormattedFileName({suffix:d.sha?`:${Se.GitRevision.shorten(d.sha)}`:void 0,truncateTo:s.d$-D.length})}`,"Choose a commit to compare with",{picked:d.sha,keys:["right","alt+right","ctrl+right"],onDidPressKey:async(le,be)=>{await(0,I.P0)(s.Gh.DiffWith,{repoPath:d.repoPath,lhs:{sha:be.item.ref,uri:d},rhs:{sha:"",uri:d},line:n.line,showOptions:n.showOptions})},showOtherReferences:[Fi.$w.fromCommand("Choose a Branch or Tag...",s.Gh.DiffWithRevisionFrom),Fi.$w.fromCommand("Choose a Stash...",s.Gh.DiffWithRevisionFrom,{stash:!0})]});if(M==null)return;await(0,I.P0)(s.Gh.DiffWith,{repoPath:d.repoPath,lhs:{sha:M.ref,uri:d},rhs:{sha:"",uri:d},line:n.line,showOptions:n.showOptions})}catch(h){v.Y.error(h,"DiffWithRevisionCommand"),T.V.showGenericErrorMessage("Unable to open compare")}}},"DiffWithRevisionCommand");Jr=ps([(0,I.WD)()],Jr);var kr=Object.defineProperty,en=Object.getOwnPropertyDescriptor,tn=Object.getOwnPropertySymbols,Sr=Object.prototype.hasOwnProperty,wn=Object.prototype.propertyIsEnumerable,bn=o((t,i,n)=>i in t?kr(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"diffWithRevisionFrom_defNormalProp"),cn=o((t,i)=>{for(var n in i||(i={}))Sr.call(i,n)&&bn(t,n,i[n]);if(tn)for(var n of tn(i))wn.call(i,n)&&bn(t,n,i[n]);return t},"diffWithRevisionFrom_spreadValues"),W=o((t,i,n,d)=>{for(var h=d>1?void 0:d?en(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&kr(i,n,h),h},"diffWithRevisionFrom_decorateClass");let z=o(class extends f.pu{constructor(t){super(s.Gh.DiffWithRevisionFrom);this.container=t}async execute(t,i,n){if(i=(0,f.SX)(i,t),i==null)return;const d=await A.YY.fromUri(i);if(!d.repoPath){T.V.showNoRepositoryWarningMessage("Unable to open file compare");return}n=cn({},n),n.line==null&&(n.line=t?.selection.active.line??0);const h=this.container.git.getRelativePath(d,d.repoPath);let D,M;if(n?.stash){const xe=`Open Changes with Stash${(0,Xi.vk)(s.NE.Dot,2,2)}`,Ue=await gr.show(this.container.git.getStash(d.repoPath),`${xe}${d.getFormattedFileName({truncateTo:s.d$-xe.length})}`,"Choose a stash to compare with",{empty:`No stashes with '${d.getFormattedFileName()}' found`,filter:st=>{var He;return((He=st.files)==null?void 0:He.some(vt=>vt.path===h||vt.originalPath===h))??!0}});if(Ue==null)return;D=Ue.ref,M=D}else{const xe=`Open Changes with Branch or Tag${(0,Xi.vk)(s.NE.Dot,2,2)}`,Ue=await Je.e.show(d.repoPath,`${xe}${d.getFormattedFileName({truncateTo:s.d$-xe.length})}`,"Choose a branch or tag to compare with",{allowEnteringRefs:!0});if(Ue==null)return;D=Ue.ref,M=Se.GitReference.isBranch(Ue)&&Ue.remote?`remotes/${D}`:D}if(D==null)return;let le,be;const Ee=await this.container.git.getDiffStatus(d.repoPath,"HEAD",D,{filters:["R","C"]});if(Ee!=null){const xe=Ee.find(Ue=>Ue.path===h);xe?.originalPath!=null&&(le=this.container.git.getAbsoluteUri(xe.originalPath,d.repoPath),be=`${(0,R.EZ)(xe.originalPath)} (${Se.GitRevision.shorten(D)})`)}await(0,I.P0)(s.Gh.DiffWith,{repoPath:d.repoPath,lhs:{sha:M,uri:le??d,title:be??`${(0,R.EZ)(d.fsPath)} (${Se.GitRevision.shorten(D)})`},rhs:{sha:"",uri:d},line:n.line,showOptions:n.showOptions})}},"DiffWithRevisionFromCommand");z=W([(0,I.WD)()],z);var X=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,Be=Object.getOwnPropertySymbols,rt=Object.prototype.hasOwnProperty,yt=Object.prototype.propertyIsEnumerable,Jt=o((t,i,n)=>i in t?X(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"diffWithWorking_defNormalProp"),ei=o((t,i)=>{for(var n in i||(i={}))rt.call(i,n)&&Jt(t,n,i[n]);if(Be)for(var n of Be(i))yt.call(i,n)&&Jt(t,n,i[n]);return t},"diffWithWorking_spreadValues"),mi=o((t,i,n,d)=>{for(var h=d>1?void 0:d?ge(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&X(i,n,h),h},"diffWithWorking_decorateClass");let Vt=o(class extends f.pu{constructor(t){super([s.Gh.DiffWithWorking,s.Gh.DiffWithWorkingInDiffLeft,s.Gh.DiffWithWorkingInDiffRight]);this.container=t}async execute(t,i,n){if(n=ei({},n),n.uri==null){if(i=(0,f.SX)(i,t),i==null)return}else i=n.uri;let d=await A.YY.fromUri(i);if(n.line==null&&(n.line=t?.selection.active.line??0),n.inDiffRightEditor)try{const D=await this.container.git.getPreviousComparisonUris(d.repoPath,d,d.sha);d=D?.previous??d}catch(D){v.Y.error(D,"DiffWithWorkingCommand",`getPreviousDiffUris(${d.repoPath}, ${d.fsPath}, ${d.sha})`),T.V.showGenericErrorMessage("Unable to open compare");return}if(d.sha==null){j.window.showInformationMessage("File matches the working tree");return}if(d.sha===Se.GitRevision.deletedOrMissing){j.window.showWarningMessage("Unable to open compare. File has been deleted from the working tree");return}if(d.isUncommittedStaged){const D=await this.container.git.getStatusForFile(d.repoPath,d);if(D?.indexStatus!=null){await(0,I.P0)(s.Gh.DiffWith,{repoPath:d.repoPath,lhs:{sha:Se.GitRevision.uncommittedStaged,uri:d.documentUri()},rhs:{sha:"",uri:d.documentUri()},line:n.line,showOptions:n.showOptions});return}}i=d.toFileUri();const h=await this.container.git.getWorkingUri(d.repoPath,i);if(h==null){j.window.showWarningMessage("Unable to open compare. File has been deleted from the working tree");return}await(0,I.P0)(s.Gh.DiffWith,{repoPath:d.repoPath,lhs:{sha:d.sha,uri:i},rhs:{sha:"",uri:h},line:n.line,showOptions:n.showOptions})}},"DiffWithWorkingCommand");Vt=mi([(0,I.WD)()],Vt);var xt=(t=>(t[t.Head=0]="Head",t[t.RemoteHead=1]="RemoteHead",t[t.Tag=2]="Tag",t))(xt||{}),ci=(t=>(t[t.INDEX_MODIFIED=0]="INDEX_MODIFIED",t[t.INDEX_ADDED=1]="INDEX_ADDED",t[t.INDEX_DELETED=2]="INDEX_DELETED",t[t.INDEX_RENAMED=3]="INDEX_RENAMED",t[t.INDEX_COPIED=4]="INDEX_COPIED",t[t.MODIFIED=5]="MODIFIED",t[t.DELETED=6]="DELETED",t[t.UNTRACKED=7]="UNTRACKED",t[t.IGNORED=8]="IGNORED",t[t.INTENT_TO_ADD=9]="INTENT_TO_ADD",t[t.ADDED_BY_US=10]="ADDED_BY_US",t[t.ADDED_BY_THEM=11]="ADDED_BY_THEM",t[t.DELETED_BY_US=12]="DELETED_BY_US",t[t.DELETED_BY_THEM=13]="DELETED_BY_THEM",t[t.BOTH_ADDED=14]="BOTH_ADDED",t[t.BOTH_DELETED=15]="BOTH_DELETED",t[t.BOTH_MODIFIED=16]="BOTH_MODIFIED",t))(ci||{}),xi=(t=>(t.BadConfigFile="BadConfigFile",t.AuthenticationFailed="AuthenticationFailed",t.NoUserNameConfigured="NoUserNameConfigured",t.NoUserEmailConfigured="NoUserEmailConfigured",t.NoRemoteRepositorySpecified="NoRemoteRepositorySpecified",t.NotAGitRepository="NotAGitRepository",t.NotAtRepositoryRoot="NotAtRepositoryRoot",t.Conflict="Conflict",t.StashConflict="StashConflict",t.UnmergedChanges="UnmergedChanges",t.PushRejected="PushRejected",t.RemoteConnectionError="RemoteConnectionError",t.DirtyWorkTree="DirtyWorkTree",t.CantOpenResource="CantOpenResource",t.GitNotFound="GitNotFound",t.CantCreatePipe="CantCreatePipe",t.PermissionDenied="PermissionDenied",t.CantAccessRemote="CantAccessRemote",t.RepositoryNotFound="RepositoryNotFound",t.RepositoryIsLocked="RepositoryIsLocked",t.BranchNotFullyMerged="BranchNotFullyMerged",t.NoRemoteReference="NoRemoteReference",t.InvalidBranchName="InvalidBranchName",t.BranchAlreadyExists="BranchAlreadyExists",t.NoLocalChanges="NoLocalChanges",t.NoStashFound="NoStashFound",t.LocalChangesOverwritten="LocalChangesOverwritten",t.NoUpstreamBranch="NoUpstreamBranch",t.IsInSubmodule="IsInSubmodule",t.WrongCase="WrongCase",t.CantLockRef="CantLockRef",t.CantRebaseMultipleBranches="CantRebaseMultipleBranches",t.PatchDoesNotApply="PatchDoesNotApply",t.NoPathFound="NoPathFound",t.UnknownPath="UnknownPath",t))(xi||{}),Ji=(t=>(t[t.Merge=0]="Merge",t[t.Index=1]="Index",t[t.WorkingTree=2]="WorkingTree",t))(Ji||{}),Ri=g(7042),mr=Object.defineProperty,xr=Object.getOwnPropertyDescriptor,_r=Object.getOwnPropertySymbols,so=Object.prototype.hasOwnProperty,Bo=Object.prototype.propertyIsEnumerable,yn=o((t,i,n)=>i in t?mr(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"externalDiff_defNormalProp"),er=o((t,i)=>{for(var n in i||(i={}))so.call(i,n)&&yn(t,n,i[n]);if(_r)for(var n of _r(i))Bo.call(i,n)&&yn(t,n,i[n]);return t},"externalDiff_spreadValues"),wi=o((t,i,n,d)=>{for(var h=d>1?void 0:d?xr(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&mr(i,n,h),h},"externalDiff_decorateClass");let No=o(class extends f.mY{constructor(t){super([s.Gh.ExternalDiff,s.Gh.ExternalDiffAll]);this.container=t}async preExecute(t,i){if(i=er({},i),(0,f.d$)(t)){const n=await t.node.commit.getPreviousSha(),d=Se.GitRevision.isUncommitted(n)?"":n,h=t.node.commit.isUncommitted?"":t.node.commit.sha;return i.files=[{uri:A.YY.fromFile(t.node.file,t.node.file.repoPath??t.node.repoPath),staged:t.node.commit.isUncommittedStaged||t.node.file.indexStatus!=null,ref1:d,ref2:h}],this.execute(i)}if((0,f.O$)(t))return i.files=[{uri:A.YY.fromFile(t.node.file,t.node.file.repoPath??t.node.repoPath),staged:t.node.file.indexStatus!=null,ref1:t.node.ref1,ref2:t.node.ref2}],this.execute(i);if(i.files==null&&(t.type==="scm-states"?i.files=t.scmResourceStates.map(n=>({uri:n.resourceUri,staged:n.resourceGroupType===Ji.Index})):t.type==="scm-groups"&&(i.files=(0,Ri.DZ)(t.scmResourceGroups[0].resourceStates,n=>this.isModified(n)?{uri:n.resourceUri,staged:n.resourceGroupType===Ji.Index}:void 0))),t.command===s.Gh.ExternalDiffAll&&i.files==null){const n=await de.I.getRepositoryOrShow("Open All Changes (difftool)");if(n==null)return;const d=await this.container.git.getStatusForRepo(n.uri);if(d==null)return j.window.showInformationMessage("The repository doesn't have any changes");i.files=[];for(const h of d.files)h.indexStatus==="M"&&i.files.push({uri:h.uri,staged:!0}),h.workingTreeStatus==="M"&&i.files.push({uri:h.uri,staged:!1})}return this.execute(i)}isModified(t){const i=t.type;return i===ci.BOTH_MODIFIED||i===ci.INDEX_MODIFIED||i===ci.MODIFIED}async execute(t){var i,n;t=er({},t);try{let d;if(t.files==null){const D=j.window.activeTextEditor;if(D==null||(d=(i=this.container.git.getBestRepository(D))==null?void 0:i.path,!d))return;const M=D.document.uri,le=await this.container.git.getStatusForFile(d,M);if(le==null){j.window.showInformationMessage("The current file doesn't have any changes");return}t.files=[],le.indexStatus==="M"&&t.files.push({uri:le.uri,staged:!0}),le.workingTreeStatus==="M"&&t.files.push({uri:le.uri,staged:!1})}else if(d=(n=await this.container.git.getOrOpenRepository(t.files[0].uri))==null?void 0:n.path,!d)return;const h=this.container.config.advanced.externalDiffTool||await this.container.git.getDiffTool(d);if(!h){const D="View Git Docs";await j.window.showWarningMessage("Unable to open changes because no Git diff tool is configured",D)===D&&j.env.openExternal(j.Uri.parse("https://git-scm.com/docs/git-config#Documentation/git-config.txt-difftool"));return}for(const D of t.files)this.container.git.openDiffTool(d,D.uri,{ref1:D.ref1,ref2:D.ref2,staged:D.staged,tool:h})}catch(d){v.Y.error(d,"ExternalDiffCommand"),T.V.showGenericErrorMessage("Unable to open changes in diff tool")}}},"ExternalDiffCommand");No=wi([(0,I.WD)()],No);var Un=g(7369),ao=g(1265),br=g(3222),Hr=g(8318),Or=Object.defineProperty,Mo=Object.getOwnPropertyDescriptor,rn=o((t,i,n)=>i in t?Or(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"gitCommands_defNormalProp"),lo=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Mo(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Or(i,n,h),h},"gitCommands_decorateClass"),Ot=o((t,i,n)=>(rn(t,typeof i!="symbol"?i+"":i,n),n),"gitCommands_publicField");const cr=/\$\(.+?\)|\s/g,Ar=Symbol("ShowLoading");let Cn=o(class extends f.mY{constructor(t){super([s.Gh.GitCommands,s.Gh.GitCommandsBranch,s.Gh.GitCommandsCherryPick,s.Gh.GitCommandsMerge,s.Gh.GitCommandsRebase,s.Gh.GitCommandsReset,s.Gh.GitCommandsRevert,s.Gh.GitCommandsSwitch,s.Gh.GitCommandsTag,s.Gh.GitCommandsWorktree]);this.container=t,Ot(this,"startedWith","menu")}preExecute(t,i){switch(t.command){case s.Gh.GitCommandsBranch:i={command:"branch"};break;case s.Gh.GitCommandsCherryPick:i={command:"cherry-pick"};break;case s.Gh.GitCommandsMerge:i={command:"merge"};break;case s.Gh.GitCommandsRebase:i={command:"rebase"};break;case s.Gh.GitCommandsReset:i={command:"reset"};break;case s.Gh.GitCommandsRevert:i={command:"revert"};break;case s.Gh.GitCommandsSwitch:i={command:"switch"};break;case s.Gh.GitCommandsTag:i={command:"tag"};break;case s.Gh.GitCommandsWorktree:i={command:"worktree"};break}return this.execute(i)}async execute(t){const i=new ao.K(this.container,t),n=t?.command!=null?i.find(t.command):void 0;this.startedWith=n!=null?"command":"menu";let d,h;for(n==null?h=i:h=await this.showLoadingIfNeeded(n,this.getCommandStep(n,i)),h?.ignoreFocusOut===!0&&(h.ignoreFocusOut=void 0);h!=null;){if(h===i&&n!=null){h=await this.getCommandStep(n,i);continue}if(d&&h.ignoreFocusOut==null&&(h.ignoreFocusOut=!0),(0,br.Dr)(h)){h=await this.showPickStep(h,i),h?.ignoreFocusOut===!0&&(d=!0);continue}if((0,br.Gj)(h)){h=await this.showInputStep(h,i),h?.ignoreFocusOut===!0&&(d=!0);continue}if((0,br.a)(h)){h=await this.showCustomStep(h,i),h?.ignoreFocusOut===!0&&(d=!0);continue}break}}async showLoadingIfNeeded(t,i){const n=await Promise.race([i,new Promise(M=>setTimeout(()=>M(Ar),250))]);if(n!==Ar)return n;const d=j.window.createQuickPick();d.ignoreFocusOut=!1;const h=[];let D;try{return await new Promise(async M=>{h.push(d.onDidHide(()=>M(D))),d.title=t.title,d.placeholder="Loading...",d.busy=!0,d.enabled=!1,d.show(),D=await i,d.hide()})}finally{d.dispose(),h.forEach(M=>M.dispose())}}getButtons(t,i){const n=[];if(t!=null){if(t.buttons!=null)return n.push(...t.buttons),n;n.push(j.QuickInputButtons.Back),t.additionalButtons!=null&&n.push(...t.additionalButtons)}if(i?.canConfirm)if(i.canSkipConfirm){const d=new Hr.rO.WillConfirmToggle(i.confirm(),async()=>{if(i?.skipConfirmKey==null)return;const h=Ui.DN.get("gitCommands.skipConfirmations")??[],D=h.indexOf(i.skipConfirmKey);D!==-1?h.splice(D,1):h.push(i.skipConfirmKey),await Ui.DN.updateEffective("gitCommands.skipConfirmations",h)});n.push(d)}else n.push(Hr.rO.WillConfirmForced);return n}async getCommandStep(t,i){i.setCommand(t,"command");const n=await t.next();if(!n.done)return n.value}async nextStep(t,i,n){n!=null&&(n.busy=!0);const d=await t.next(i);if(!d.done)return n!=null&&(n.value=""),d.value}async showCustomStep(t,i){var n,d;const h=await t.show(t);if(h!==br.oo.Break)if(Ni.X.is(h))switch(h){case Ni.X.Back:return await((n=i?.command)==null?void 0:n.previous())??i;case Ni.X.Noop:return(d=i.command)==null?void 0:d.retry();case Ni.X.Cancel:default:return}else return this.nextStep(i.command,h)}async showInputStep(t,i){const n=j.window.createInputBox();n.ignoreFocusOut=Ui.DN.get("gitCommands.closeOnFocusOut")?t.ignoreFocusOut??!1:!0;const d=[];try{return await new Promise(h=>{const D=o(async()=>{n.value="",i.command!=null&&(n.busy=!0,h(await i.command.previous()??i))},"goBack"),M={left:{onDidPressKey:D}};if(t.onDidPressKey!=null&&t.keys!=null&&t.keys.length!==0)for(const be of t.keys)M[be]={onDidPressKey:Ee=>t.onDidPressKey(n,Ee)};const le=this.container.keyboard.createScope(M);le.start(),d.push(le,n.onDidHide(()=>h(void 0)),n.onDidTriggerButton(async be=>{var Ee,xe;if(be===j.QuickInputButtons.Back){D();return}if(be!==Hr.rO.WillConfirmForced){if(be instanceof Hr.jQ&&be.onDidClick!=null){const Ue=be.onDidClick(n);if(n.buttons=this.getButtons(t,i.command),await Ue===!0){h((Ee=i.command)==null?void 0:Ee.retry());return}(0,wr.tI)(Ue)&&(n.buttons=this.getButtons(t,i.command));return}if(t.onDidClickButton!=null){const Ue=t.onDidClickButton(n,be);n.buttons=this.getButtons(t,i.command),await Ue===!0&&h((xe=i.command)==null?void 0:xe.retry())}}}),n.onDidChangeValue(async be=>{if(le!=null&&(be.length!==0?await le.pause(["left","right"]):await le.resume()),t.validate==null)return;const[,Ee]=await t.validate(be);n.validationMessage=Ee}),n.onDidAccept(async()=>{h(await this.nextStep(i.command,n.value,n))})),n.buttons=this.getButtons(t,i.command),n.title=t.title,n.placeholder=t.placeholder,n.prompt=t.prompt,t.value!=null&&(n.value=t.value),i.command!=null&&t===i&&i.setCommand(void 0,"menu"),n.show(),t.value!=null&&n._onDidChangeValueEmitter.fire(n.value)})}finally{n.dispose(),d.forEach(h=>h.dispose())}}async showPickStep(t,i){const n=Ui.DN.get("gitCommands.closeOnFocusOut")?t.ignoreFocusOut??!1:!0,d=t.ignoreFocusOut,h=j.window.createQuickPick();h.ignoreFocusOut=n;const D=[];try{return await new Promise(M=>{async function le(){h.value="",i.command!=null&&(h.busy=!0,M(await i.command.previous()??i))}o(le,"goBack");async function be(){var st;if(t.onDidLoadMore!=null){h.busy=!0,h.enabled=!1;try{const He=await((st=t.onDidLoadMore)==null?void 0:st.call(t,h));let vt=-1;if(h.activeItems.length!==0){const Et=h.activeItems[0];vt=h.items.indexOf(Et),Ni.x.is(Et)&&vt--}h.items=t.items=He,vt&&(h.activeItems=[h.items[vt]])}finally{h.busy=!1,h.enabled=!0}}}o(be,"loadMore");const Ee={left:{onDidPressKey:le}};if(t.onDidPressKey!=null&&t.keys!=null&&t.keys.length!==0)for(const st of t.keys)Ee[st]={onDidPressKey:He=>t.onDidPressKey(h,He)};const xe=this.container.keyboard.createScope(Ee);xe.start();let Ue=!1;D.push(xe,h.onDidHide(()=>M(void 0)),h.onDidTriggerItemButton(async st=>{var He;await((He=t.onDidClickItemButton)==null?void 0:He.call(t,h,st.button,st.item))===!0&&M(await this.nextStep(i.command,[st.item],h))}),h.onDidTriggerButton(async st=>{var He,vt;if(st===j.QuickInputButtons.Back){le();return}if(st!==Hr.rO.WillConfirmForced){if(st===Hr.rO.LoadMore){be();return}if(st instanceof Hr.jQ&&st.onDidClick!=null){let Et;if(i.command==null&&h.activeItems.length!==0){const Nt=h.activeItems[0];br.tR.is(Nt)&&(Et=Nt)}const Wt=st.onDidClick(h);if(h.buttons=this.getButtons(Et!=null?Et.value:t,Et??i.command),await Wt===!0){M((He=i.command)==null?void 0:He.retry());return}(0,wr.tI)(Wt)&&(h.buttons=this.getButtons(Et!=null?Et.value:t,Et??i.command));return}if(t.onDidClickButton!=null){const Et=t.onDidClickButton(h,st);h.buttons=this.getButtons(t,i.command),await Et===!0&&M((vt=i.command)==null?void 0:vt.retry())}}}),h.onDidChangeValue(async st=>{if(xe!=null&&(st.length!==0?await xe.pause(["left","right"]):await xe.resume()),!(t.onDidChangeValue!=null&&await t.onDidChangeValue(h))){if(st.length!==0&&!h.ignoreFocusOut?(h.ignoreFocusOut=!0,t.ignoreFocusOut=!0):st.length===0&&h.ignoreFocusOut&&!n&&(h.ignoreFocusOut=n,t.ignoreFocusOut=d),!Ue){if(h.canSelectMany&&st===" "){h.value="",h.selectedItems=h.selectedItems.length===h.items.length?[]:h.items;return}if(st.endsWith(" ")){if(h.canSelectMany&&h.selectedItems.length!==0)return;let He;if(i.command==null){const vt=i.find(h.value.trim(),!0);if(vt==null)return;i.setCommand(vt,this.startedWith)}else{const vt=h.value.trim().toLowerCase(),Et=t.items.find(Wt=>Wt.label.replace(cr,"").toLowerCase()===vt);if(Et==null)return;He=[Et]}M(await this.nextStep(i.command,He,h));return}}if(!h.canSelectMany&&i.command!=null&&st.trim().length!==0&&(Ue||h.activeItems.length===0)){if(t.onValidateValue==null)return;Ue=await t.onValidateValue(h,st.trim(),t.items)}else Ue=!1;!Ue&&h.items.length!==t.items.length&&(h.items=t.items)}}),h.onDidChangeActive(()=>{if(i.command!=null||h.activeItems.length===0)return;const st=h.activeItems[0];!br.tR.is(st)||(h.buttons=this.getButtons(void 0,st))}),h.onDidChangeSelection(st=>{!h.canSelectMany||(st.length!==0&&!h.ignoreFocusOut?(h.ignoreFocusOut=!0,t.ignoreFocusOut=!0):st?.length===0&&h.ignoreFocusOut&&!n&&(h.ignoreFocusOut=n,t.ignoreFocusOut=d))}),h.onDidAccept(async()=>{let st=h.selectedItems;if(st.length===0){if(!h.canSelectMany||h.activeItems.length===0){const He=h.value.trim();if(He.length===0&&!t.allowEmpty)return;if(t.onDidAccept==null){t.allowEmpty&&M(await this.nextStep(i.command,[],h));return}h.busy=!0,await t.onDidAccept(h)&&M(await this.nextStep(i.command,He,h)),h.busy=!1;return}st=h.activeItems}if(st.length===1){const[He]=st;if(Ni.x.is(He))switch(He.directive){case Ni.X.Cancel:M(void 0);return;case Ni.X.Back:le();return;case Ni.X.LoadMore:be();return;case Ni.X.StartPreviewTrial:yi.W.instance.subscription.startPreviewTrial(),M(void 0);return;case Ni.X.RequiresVerification:yi.W.instance.subscription.resendVerification(),M(void 0);return;case Ni.X.RequiresFreeSubscription:yi.W.instance.subscription.loginOrSignUp(),M(void 0);return;case Ni.X.RequiresPaidSubscription:yi.W.instance.subscription.purchase(),M(void 0);return}}if(i.command==null){const[He]=st;if(!br.tR.is(He))return;i.setCommand(He,this.startedWith)}if(!h.canSelectMany&&t.onDidAccept!=null){h.busy=!0;const He=await t.onDidAccept(h);if(h.busy=!1,!He)return}M(await this.nextStep(i.command,st,h))})),h.title=t.title,h.placeholder=t.placeholder,h.matchOnDescription=Boolean(t.matchOnDescription),h.matchOnDetail=Boolean(t.matchOnDetail),h.canSelectMany=Boolean(t.multiselect),h.items=t.items,h.canSelectMany?(h.selectedItems=t.selectedItems??h.items.filter(st=>st.picked),h.activeItems=h.selectedItems):h.activeItems=t.selectedItems??h.items.filter(st=>st.picked),i.command!=null&&t===i&&i.setCommand(void 0,"menu"),h.buttons=this.getButtons(t,i.command),t.value!=null&&(h.value=t.value),h.show(),t.value!=null&&h._onDidChangeValueEmitter.fire(h.value)})}finally{h.dispose(),D.forEach(M=>M.dispose())}}},"GitCommandsCommand");lo([(0,Un.cM)({args:!1,correlate:!0,singleLine:!0,timed:!1})],Cn.prototype,"execute",1),Cn=lo([(0,I.WD)()],Cn);var Pn=Object.defineProperty,nn=Object.getOwnPropertyDescriptor,se=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,re=o((t,i,n)=>i in t?Pn(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"inviteToLiveShare_defNormalProp"),me=o((t,i)=>{for(var n in i||(i={}))a.call(i,n)&&re(t,n,i[n]);if(se)for(var n of se(i))S.call(i,n)&&re(t,n,i[n]);return t},"inviteToLiveShare_spreadValues"),he=o((t,i,n,d)=>{for(var h=d>1?void 0:d?nn(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Pn(i,n,h),h},"inviteToLiveShare_decorateClass");let Qe=o(class extends f.mY{constructor(t){super(s.Gh.InviteToLiveShare);this.container=t}static getMarkdownCommandArgs(t){const i=t===void 0||typeof t=="string"?{email:t}:t;return super.getMarkdownCommandArgsCore(s.Gh.InviteToLiveShare,i)}preExecute(t,i){return(0,f.Mg)(t)?(i=me({},i),i.email=t.node.contributor.email,this.execute(i)):this.execute(i)}async execute(t){if(t?.email){const i=await this.container.vsls.getContact(t.email);if(i!=null)return i.invite()}return this.container.vsls.startSession()}},"InviteToLiveShareCommand");Qe=he([(0,I.WD)()],Qe);var Mt=Object.defineProperty,it=Object.getOwnPropertyDescriptor,Tt=o((t,i,n,d)=>{for(var h=d>1?void 0:d?it(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Mt(i,n,h),h},"logging_decorateClass");let ai=o(class extends f.mY{constructor(t){super(s.Gh.EnableDebugLogging);this.container=t}async execute(){await Ui.DN.updateEffective("outputLevel",Ui.M7.Debug)}},"EnableDebugLoggingCommand");ai=Tt([(0,I.WD)()],ai);let bi=o(class extends f.mY{constructor(t){super(s.Gh.DisableDebugLogging);this.container=t}async execute(){await Ui.DN.updateEffective("outputLevel",Ui.M7.Errors)}},"DisableDebugLoggingCommand");bi=Tt([(0,I.WD)()],bi);var sr=Object.defineProperty,on=Object.getOwnPropertyDescriptor,co=o((t,i,n,d)=>{for(var h=d>1?void 0:d?on(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&sr(i,n,h),h},"openAssociatedPullRequestOnRemote_decorateClass");let gs=o(class extends f.pu{constructor(t){super(s.Gh.OpenAssociatedPullRequestOnRemote);this.container=t}async execute(t,i){if(t==null||(i=(0,f.SX)(i,t),i==null))return;const n=await A.YY.fromUri(i),d=t.selection.active.line;if(!(d<0))try{const h=await this.container.git.getBlameForLine(n,d);if(h==null)return;await(0,I.P0)(s.Gh.OpenPullRequestOnRemote,{clipboard:!1,ref:h.commit.sha,repoPath:h.commit.repoPath})}catch(h){v.Y.error(h,"OpenAssociatedPullRequestOnRemoteCommand",`getBlameForLine(${d})`)}}},"OpenAssociatedPullRequestOnRemoteCommand");gs=co([(0,I.WD)()],gs);var un=Object.defineProperty,Ys=Object.defineProperties,Dl=Object.getOwnPropertyDescriptor,Oa=Object.getOwnPropertyDescriptors,lr=Object.getOwnPropertySymbols,hn=Object.prototype.hasOwnProperty,uo=Object.prototype.propertyIsEnumerable,ho=o((t,i,n)=>i in t?un(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"openBranchesOnRemote_defNormalProp"),$a=o((t,i)=>{for(var n in i||(i={}))hn.call(i,n)&&ho(t,n,i[n]);if(lr)for(var n of lr(i))uo.call(i,n)&&ho(t,n,i[n]);return t},"openBranchesOnRemote_spreadValues"),Ea=o((t,i)=>Ys(t,Oa(i)),"openBranchesOnRemote_spreadProps"),Ta=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Dl(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&un(i,n,h),h},"openBranchesOnRemote_decorateClass");let vs=o(class extends f.pu{constructor(t){super([s.Gh.OpenBranchesOnRemote,s.Gh.Deprecated_OpenBranchesInRemote,s.Gh.CopyRemoteBranchesUrl]);this.container=t}preExecute(t,i){return(0,f.C$)(t)&&(i=Ea($a({},i),{remote:t.node.remote.name})),t.command===s.Gh.CopyRemoteBranchesUrl&&(i=Ea($a({},i),{clipboard:!0})),this.execute(t.editor,t.uri,i)}async execute(t,i,n){var d;i=(0,f.SX)(i,t);const h=i!=null?await A.YY.fromUri(i):void 0,D=(d=await de.I.getBestRepositoryOrShow(h,t,n?.clipboard?"Copy Remote Branches Url":"Open Branches on Remote"))==null?void 0:d.path;if(!!D)try{await(0,I.P0)(s.Gh.OpenOnRemote,{resource:{type:Hi.JD.Branches},repoPath:D,remote:n?.remote,clipboard:n?.clipboard})}catch(M){v.Y.error(M,"OpenBranchesOnRemoteCommand"),j.window.showErrorMessage("Unable to open branches on remote provider. See output channel for more details")}}},"OpenBranchesOnRemoteCommand");vs=Ta([(0,I.WD)()],vs);var Ks=Object.defineProperty,ur=Object.defineProperties,_s=Object.getOwnPropertyDescriptor,Ol=Object.getOwnPropertyDescriptors,Fa=Object.getOwnPropertySymbols,$l=Object.prototype.hasOwnProperty,fo=Object.prototype.propertyIsEnumerable,ws=o((t,i,n)=>i in t?Ks(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"openBranchOnRemote_defNormalProp"),mo=o((t,i)=>{for(var n in i||(i={}))$l.call(i,n)&&ws(t,n,i[n]);if(Fa)for(var n of Fa(i))fo.call(i,n)&&ws(t,n,i[n]);return t},"openBranchOnRemote_spreadValues"),sn=o((t,i)=>ur(t,Ol(i)),"openBranchOnRemote_spreadProps"),xa=o((t,i,n,d)=>{for(var h=d>1?void 0:d?_s(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Ks(i,n,h),h},"openBranchOnRemote_decorateClass");let Aa=o(class extends f.pu{constructor(t){super([s.Gh.OpenBranchOnRemote,s.Gh.Deprecated_OpenBranchInRemote,s.Gh.CopyRemoteBranchUrl]);this.container=t}preExecute(t,i){return(0,f.Qo)(t)&&(i=sn(mo({},i),{branch:t.node.branch.name,remote:t.node.branch.getRemoteName()})),t.command===s.Gh.CopyRemoteBranchUrl&&(i=sn(mo({},i),{clipboard:!0})),this.execute(t.editor,t.uri,i)}async execute(t,i,n){var d;i=(0,f.SX)(i,t);const h=i!=null?await A.YY.fromUri(i):void 0,D=(d=await de.I.getBestRepositoryOrShow(h,t,n?.clipboard?"Copy Remote Branch Url":"Open Branch On Remote"))==null?void 0:d.path;if(!!D){n=mo({},n);try{if(n.branch==null){const M=await Je.e.show(D,n.clipboard?"Copy Remote Branch Url":"Open Branch On Remote",n.clipboard?"Choose a branch to copy the url from":"Choose a branch to open",{autoPick:!0,filter:{branches:le=>le.upstream!=null},include:Je.H.Branches,sort:{branches:{current:!0},tags:{}}});if(M==null||M instanceof Fi.$w)return;n.branch=M.ref}await(0,I.P0)(s.Gh.OpenOnRemote,{resource:{type:Hi.JD.Branch,branch:n.branch||"HEAD"},repoPath:D,remote:n.remote,clipboard:n.clipboard})}catch(M){v.Y.error(M,"OpenBranchOnRemoteCommand"),j.window.showErrorMessage("Unable to open branch on remote provider. See output channel for more details")}}}},"OpenBranchOnRemoteCommand");Aa=xa([(0,I.WD)()],Aa);var bs=Object.defineProperty,El=Object.getOwnPropertyDescriptor,ko=Object.getOwnPropertySymbols,Uo=Object.prototype.hasOwnProperty,ys=Object.prototype.propertyIsEnumerable,zs=o((t,i,n)=>i in t?bs(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"openChangedFiles_defNormalProp"),po=o((t,i)=>{for(var n in i||(i={}))Uo.call(i,n)&&zs(t,n,i[n]);if(ko)for(var n of ko(i))ys.call(i,n)&&zs(t,n,i[n]);return t},"openChangedFiles_spreadValues"),dn=o((t,i,n,d)=>{for(var h=d>1?void 0:d?El(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&bs(i,n,h),h},"openChangedFiles_decorateClass");let Wn=o(class extends f.mY{constructor(t){super(s.Gh.OpenChangedFiles);this.container=t}async execute(t){t=po({},t);try{if(t.uris==null){const i=await de.I.getRepositoryOrShow("Open All Changed Files");if(i==null)return;const n=await this.container.git.getStatusForRepo(i.uri);if(n==null){j.window.showWarningMessage("Unable to open changed files");return}t.uris=(0,Ri.DZ)(n.files,d=>d.status!=="D"?d.uri:void 0)}(0,P.$_)(t.uris)}catch(i){v.Y.error(i,"OpenChangedFilesCommand"),T.V.showGenericErrorMessage("Unable to open all changed files")}}},"OpenChangedFilesCommand");Wn=dn([(0,I.WD)()],Wn);var jr=Object.defineProperty,Qs=Object.defineProperties,Wo=Object.getOwnPropertyDescriptor,Ia=Object.getOwnPropertyDescriptors,go=Object.getOwnPropertySymbols,vo=Object.prototype.hasOwnProperty,_o=Object.prototype.propertyIsEnumerable,Lo=o((t,i,n)=>i in t?jr(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"openCommitOnRemote_defNormalProp"),Go=o((t,i)=>{for(var n in i||(i={}))vo.call(i,n)&&Lo(t,n,i[n]);if(go)for(var n of go(i))_o.call(i,n)&&Lo(t,n,i[n]);return t},"openCommitOnRemote_spreadValues"),Sn=o((t,i)=>Qs(t,Ia(i)),"openCommitOnRemote_spreadProps"),Ba=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Wo(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&jr(i,n,h),h},"openCommitOnRemote_decorateClass");let qs=o(class extends f.pu{constructor(t){super([s.Gh.OpenCommitOnRemote,s.Gh.Deprecated_OpenCommitInRemote,s.Gh.CopyRemoteCommitUrl]);this.container=t}static getMarkdownCommandArgs(t){const i=typeof t=="string"?{sha:t}:t;return super.getMarkdownCommandArgsCore(s.Gh.OpenCommitOnRemote,i)}preExecute(t,i){let n=t.uri;if((0,f.en)(t)){if(t.node.commit.isUncommitted)return Promise.resolve(void 0);i=Sn(Go({},i),{sha:t.node.commit.sha}),n=t.node.uri}return(0,f.jT)(t)&&(i={sha:t.item.ref},n=t.uri),t.command===s.Gh.CopyRemoteCommitUrl&&(i=Sn(Go({},i),{clipboard:!0})),this.execute(t.editor,n,i)}async execute(t,i,n){if(i=(0,f.SX)(i,t),i==null)return;const d=await A.YY.fromUri(i);if(!!d.repoPath){n=Go({},n);try{if(n.sha==null){const h=t==null?0:t.selection.active.line;if(h<0)return;const D=await this.container.git.getBlameForLine(d,h,t?.document);if(D==null){T.V.showFileNotUnderSourceControlWarningMessage("Unable to open commit on remote provider");return}n.sha=D.commit.isUncommitted?await D.commit.getPreviousSha()??Se.GitRevision.deletedOrMissing:D.commit.sha}await(0,I.P0)(s.Gh.OpenOnRemote,{resource:{type:Hi.JD.Commit,sha:n.sha},repoPath:d.repoPath,clipboard:n.clipboard})}catch(h){v.Y.error(h,"OpenCommitOnRemoteCommand"),j.window.showErrorMessage("Unable to open commit on remote provider. See output channel for more details")}}}},"OpenCommitOnRemoteCommand");qs=Ba([(0,I.WD)()],qs);var Na=Object.defineProperty,Ma=Object.defineProperties,Zs=Object.getOwnPropertyDescriptor,Vo=Object.getOwnPropertyDescriptors,Xs=Object.getOwnPropertySymbols,Js=Object.prototype.hasOwnProperty,Ho=Object.prototype.propertyIsEnumerable,jo=o((t,i,n)=>i in t?Na(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"openComparisonOnRemote_defNormalProp"),pr=o((t,i)=>{for(var n in i||(i={}))Js.call(i,n)&&jo(t,n,i[n]);if(Xs)for(var n of Xs(i))Ho.call(i,n)&&jo(t,n,i[n]);return t},"openComparisonOnRemote_spreadValues"),Ur=o((t,i)=>Ma(t,Vo(i)),"openComparisonOnRemote_spreadProps"),ka=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Zs(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Na(i,n,h),h},"openComparisonOnRemote_decorateClass");let Ln=o(class extends f.mY{constructor(t){super([s.Gh.OpenComparisonOnRemote,s.Gh.CopyRemoteComparisonUrl]);this.container=t}preExecute(t,i){return t.type==="viewItem"&&t.node instanceof dt.J2&&(i=Ur(pr({},i),{repoPath:t.node.repoPath,ref1:t.node.ref1,ref2:t.node.ref2})),t.command===s.Gh.CopyRemoteBranchesUrl&&(i=Ur(pr({},i),{clipboard:!0})),this.execute(i)}async execute(t){if(!(t?.repoPath==null||t.ref1==null||t.ref2==null))try{await(0,I.P0)(s.Gh.OpenOnRemote,{resource:{type:Hi.JD.Comparison,base:t.ref1,compare:t.ref2,notation:t.notation},repoPath:t.repoPath,clipboard:t?.clipboard})}catch(i){v.Y.error(i,"OpenComparisonOnRemoteCommand"),j.window.showErrorMessage("Unable to open comparison on remote provider. See output channel for more details")}}},"OpenComparisonOnRemoteCommand");Ln=ka([(0,I.WD)()],Ln);var hr=Object.defineProperty,nc=Object.getOwnPropertyDescriptor,Gn=o((t,i,n,d)=>{for(var h=d>1?void 0:d?nc(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&hr(i,n,h),h},"openFileFromRemote_decorateClass");let wo=o(class extends f.mY{constructor(t){super(s.Gh.OpenFileFromRemote);this.container=t}async execute(){let t=await j.env.clipboard.readText();try{j.Uri.parse(t,!0)}catch{t=void 0}const i=await j.window.showInputBox({prompt:"Enter a remote file url to open",placeHolder:"Remote file url",value:t,ignoreFocusOut:!0});if(i==null||i.length===0)return;let n=await this.container.git.getLocalInfoFromRemoteUri(j.Uri.parse(i));if(n==null){if(n=await this.container.git.getLocalInfoFromRemoteUri(j.Uri.parse(i),{validate:!1}),n==null){j.window.showWarningMessage("Unable to parse the provided remote url.");return}const h="Open File...";if(await j.window.showWarningMessage("Unable to find a workspace folder that matches the provided remote url.",h)!==h)return}let d;n.startLine&&(n.endLine?d=new j.Range(n.startLine-1,0,n.endLine,0):d=new j.Range(n.startLine-1,0,n.startLine-1,0));try{await(0,P.bM)(n.uri,{selection:d,rethrow:!0})}catch{const h=await j.window.showOpenDialog({title:"Open local file",defaultUri:n.uri,canSelectMany:!1,canSelectFolders:!1});if(h==null||h.length===0)return;await(0,P.bM)(h[0])}}},"OpenFileFromRemoteCommand");wo=Gn([(0,I.WD)()],wo);var Yo=Object.defineProperty,Ua=Object.defineProperties,Wa=Object.getOwnPropertyDescriptor,ea=Object.getOwnPropertyDescriptors,$r=Object.getOwnPropertySymbols,Rn=Object.prototype.hasOwnProperty,vr=Object.prototype.propertyIsEnumerable,bo=o((t,i,n)=>i in t?Yo(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"openFileOnRemote_defNormalProp"),Ir=o((t,i)=>{for(var n in i||(i={}))Rn.call(i,n)&&bo(t,n,i[n]);if($r)for(var n of $r(i))vr.call(i,n)&&bo(t,n,i[n]);return t},"openFileOnRemote_spreadValues"),Vn=o((t,i)=>Ua(t,ea(i)),"openFileOnRemote_spreadProps"),La=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Wa(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Yo(i,n,h),h},"openFileOnRemote_decorateClass");let Ga=o(class extends f.pu{constructor(t){super([s.Gh.OpenFileOnRemote,s.Gh.Deprecated_OpenFileInRemote,s.Gh.CopyRemoteFileUrl,s.Gh.CopyRemoteFileUrlWithoutRange,s.Gh.OpenFileOnRemoteFrom,s.Gh.CopyRemoteFileUrlFrom]);this.container=t}async preExecute(t,i){var n;let d=t.uri;if(t.command===s.Gh.CopyRemoteFileUrlWithoutRange&&(i=Vn(Ir({},i),{range:!1})),(0,f.en)(t)?(i=Vn(Ir({},i),{range:!1}),t.command===s.Gh.CopyRemoteFileUrl||t.command===s.Gh.CopyRemoteFileUrlWithoutRange||t.command===s.Gh.CopyRemoteFileUrlFrom?i.sha=t.node instanceof dt.$q?void 0:t.node.commit.sha:(0,f.Qo)(t)&&(i.branchOrTag=(n=t.node.branch)==null?void 0:n.name),d=t.node.uri):t.type==="viewItem"&&(i=Vn(Ir({},i),{range:!1}),d=t.node.uri??t.uri),(t.command===s.Gh.CopyRemoteFileUrl||t.command===s.Gh.CopyRemoteFileUrlWithoutRange||t.command===s.Gh.CopyRemoteFileUrlFrom)&&(i=Vn(Ir({},i),{clipboard:!0}),i.sha==null)){const h=(0,f.SX)(t.uri,t.editor);if(h!=null){const D=await A.YY.fromUri(h);if(D.repoPath)if(D.sha==null){const M=await this.container.git.getCommitForFile(D.repoPath,D,{firstIfNotFound:!0});M!=null&&(i.sha=M.sha)}else i.sha=D.sha}}return(t.command===s.Gh.OpenFileOnRemoteFrom||t.command===s.Gh.CopyRemoteFileUrlFrom)&&(i=Vn(Ir({},i),{pickBranchOrTag:!0,range:!1})),this.execute(t.editor,d,i)}async execute(t,i,n){if(i=(0,f.SX)(i,t),i==null)return;const d=await A.YY.fromUri(i);if(!!d.repoPath){n=Ir({range:!0},n);try{let h=await this.container.git.getRemotesWithProviders(d.repoPath);const D=n.range&&t!=null&&q.n.equals(t.document.uri,i)?new j.Range(t.selection.start.with({line:t.selection.start.line+1}),t.selection.end.with({line:t.selection.end.line+(t.selection.end.character===0?0:1)})):void 0;let M=n.sha??d.sha;if(n.branchOrTag==null&&M!=null&&!Se.GitRevision.isSha(M)&&h.length!==0){const[le,be]=(0,Xi.pW)(M,"/");if(be!=null){const Ee=h.find(xe=>xe.name===le);Ee!=null&&(n.branchOrTag=be,M=void 0,h=[Ee])}}if(n.sha==null&&n.branchOrTag==null||n.pickBranchOrTag){let le;if(n.pickBranchOrTag||(le=await this.container.git.getBranch(d.repoPath)),le?.upstream==null){const be=await Je.e.show(d.repoPath,n.clipboard?`Copy Remote File Url From${(0,Xi.vk)(s.NE.Dot,2,2)}${d.relativePath}`:`Open File on Remote From${(0,Xi.vk)(s.NE.Dot,2,2)}${d.relativePath}`,`Choose a branch or tag to ${n.clipboard?"copy":"open"} the file revision from`,{allowEnteringRefs:!0,autoPick:!0,filter:{branches:Ee=>Ee.remote||Ee.upstream!=null},picked:n.branchOrTag,sort:{branches:{current:!0,orderBy:Ui.Vz.DateDesc},tags:{orderBy:Ui.RV.DateDesc}}});if(be==null)return;if(be.refType==="branch"){if(be.remote){n.branchOrTag=Se.GitBranch.getNameWithoutRemote(be.name);const Ee=Se.GitBranch.getRemote(be.name),xe=h.find(Ue=>Ue.name===Ee);xe!=null&&(h=[xe])}else n.branchOrTag=be.name;M=void 0}else be.refType==="tag"?(n.branchOrTag=be.ref,M=void 0):(n.branchOrTag=void 0,M=be.ref)}else n.branchOrTag=le.name}await(0,I.P0)(s.Gh.OpenOnRemote,{resource:{type:M==null?Hi.JD.File:Hi.JD.Revision,branchOrTag:n.branchOrTag??"HEAD",fileName:d.relativePath,range:D,sha:M??void 0},repoPath:d.repoPath,remotes:h,clipboard:n.clipboard})}catch(h){v.Y.error(h,"OpenFileOnRemoteCommand"),j.window.showErrorMessage("Unable to open file on remote provider. See output channel for more details")}}}},"OpenFileOnRemoteCommand");Ga=La([(0,I.WD)()],Ga);var Va=Object.defineProperty,ta=Object.defineProperties,Cs=Object.getOwnPropertyDescriptor,Ko=Object.getOwnPropertyDescriptors,Ha=Object.getOwnPropertySymbols,yo=Object.prototype.hasOwnProperty,Tl=Object.prototype.propertyIsEnumerable,zo=o((t,i,n)=>i in t?Va(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"openFileAtRevision_defNormalProp"),Co=o((t,i)=>{for(var n in i||(i={}))yo.call(i,n)&&zo(t,n,i[n]);if(Ha)for(var n of Ha(i))Tl.call(i,n)&&zo(t,n,i[n]);return t},"openFileAtRevision_spreadValues"),Ps=o((t,i)=>ta(t,Ko(i)),"openFileAtRevision_spreadProps"),Hn=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Cs(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Va(i,n,h),h},"openFileAtRevision_decorateClass");let jn=o(class extends f.pu{constructor(t){super([s.Gh.OpenFileAtRevision,s.Gh.OpenBlamePriorToChange]);this.container=t}static getMarkdownCommandArgs(t,i,n){let d;return t instanceof j.Uri?d={revisionUri:t,line:n,annotationType:i}:d=t,super.getMarkdownCommandArgsCore(s.Gh.OpenFileAtRevision,d)}async preExecute(t,i){if(t.command===s.Gh.OpenBlamePriorToChange){if(i=Ps(Co({},i),{annotationType:Ui.VP.Blame}),i.revisionUri==null&&t.editor!=null){const n=t.editor.selection.active.line;if(n>=0)try{const d=await A.YY.fromUri(t.editor.document.uri),h=await this.container.git.getBlameForLine(d,n);if(h!=null)if(h.commit.isUncommitted){const D=await h.commit.getPreviousComparisonUrisForLine(n);if(D?.previous!=null)i.revisionUri=this.container.git.getRevisionUri(D.previous);else{T.V.showCommitHasNoPreviousCommitWarningMessage(h.commit);return}}else if((h!=null?await h?.commit.getPreviousSha():void 0)!=null)i.revisionUri=this.container.git.getRevisionUri(h.commit.getGitUri(!0));else{T.V.showCommitHasNoPreviousCommitWarningMessage(h.commit);return}}catch(d){v.Y.error(d,"OpenBlamePriorToChangeCommand")}}if(i.revisionUri==null){T.V.showGenericErrorMessage("Unable to open blame");return}}return this.execute(t.editor,t.uri,i)}async execute(t,i,n){if(i=(0,f.SX)(i,t),i==null)return;const d=await A.YY.fromUri(i);n=Co({},n),n.line==null&&(n.line=t?.selection.active.line??0);try{if(n.revisionUri==null){const h=this.container.git.getLogForFile(d.repoPath,d.fsPath).then(le=>le??(d.sha?this.container.git.getLogForFile(d.repoPath,d.fsPath,{ref:d.sha}):void 0)),D=`Open ${n.annotationType===Ui.VP.Blame?"Blame":"File"} at Revision${(0,Xi.vk)(s.NE.Dot,2,2)}`,M=await Wr.show(h,`${D}${d.getFormattedFileName({suffix:d.sha?`:${Se.GitRevision.shorten(d.sha)}`:void 0,truncateTo:s.d$-D.length})}`,`Choose a commit to ${n.annotationType===Ui.VP.Blame?"blame":"open"} the file revision from`,{picked:d.sha,keys:["right","alt+right","ctrl+right"],onDidPressKey:async(le,be)=>{await w.u.Commit.openFileAtRevision(be.item.file,be.item,{annotationType:n.annotationType,line:n.line,preserveFocus:!0,preview:!1})},showOtherReferences:[Fi.$w.fromCommand("Choose a Branch or Tag...",s.Gh.OpenFileAtRevisionFrom),Fi.$w.fromCommand("Choose a Stash...",s.Gh.OpenFileAtRevisionFrom,{stash:!0})]});if(M?.file==null)return;await w.u.Commit.openFileAtRevision(M.file,M,Co({annotationType:n.annotationType,line:n.line},n.showOptions));return}await w.u.Commit.openFileAtRevision(n.revisionUri,Co({annotationType:n.annotationType,line:n.line},n.showOptions))}catch(h){v.Y.error(h,"OpenFileAtRevisionCommand"),T.V.showGenericErrorMessage("Unable to open file at revision")}}},"OpenFileAtRevisionCommand");jn=Hn([(0,I.WD)()],jn);var Qo=Object.defineProperty,ja=Object.getOwnPropertyDescriptor,ia=Object.getOwnPropertySymbols,Ya=Object.prototype.hasOwnProperty,Ka=Object.prototype.propertyIsEnumerable,Yn=o((t,i,n)=>i in t?Qo(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"openFileAtRevisionFrom_defNormalProp"),za=o((t,i)=>{for(var n in i||(i={}))Ya.call(i,n)&&Yn(t,n,i[n]);if(ia)for(var n of ia(i))Ka.call(i,n)&&Yn(t,n,i[n]);return t},"openFileAtRevisionFrom_spreadValues"),Ss=o((t,i,n,d)=>{for(var h=d>1?void 0:d?ja(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Qo(i,n,h),h},"openFileAtRevisionFrom_decorateClass");let ra=o(class extends f.pu{constructor(t){super(s.Gh.OpenFileAtRevisionFrom);this.container=t}async execute(t,i,n){if(i=(0,f.SX)(i,t),i==null)return;const d=await A.YY.fromUri(i);if(!d.repoPath){T.V.showNoRepositoryWarningMessage("Unable to open file revision");return}if(n=za({},n),n.line==null&&(n.line=t?.selection.active.line??0),n.reference==null)if(n?.stash){const h=this.container.git.getRelativePath(d,d.repoPath),D=`Open Changes with Stash${(0,Xi.vk)(s.NE.Dot,2,2)}`,M=await gr.show(this.container.git.getStash(d.repoPath),`${D}${d.getFormattedFileName({truncateTo:s.d$-D.length})}`,"Choose a stash to compare with",{filter:le=>{var be;return((be=le.files)==null?void 0:be.some(Ee=>Ee.path===h||Ee.originalPath===h))??!0}});if(M==null)return;n.reference=M}else{const h=`Open File at Branch or Tag${(0,Xi.vk)(s.NE.Dot,2,2)}`,D=await Je.e.show(d.repoPath,`${h}${d.getFormattedFileName({truncateTo:s.d$-h.length})}`,"Choose a branch or tag to open the file revision from",{allowEnteringRefs:!0,keys:["right","alt+right","ctrl+right"],onDidPressKey:async(M,le)=>{const[be]=le.activeItems;be!=null&&await w.u.Commit.openFileAtRevision(this.container.git.getRevisionUri(be.ref,d.fsPath,d.repoPath),{annotationType:n.annotationType,line:n.line,preserveFocus:!0,preview:!1})}});if(D==null)return;n.reference=D}await w.u.Commit.openFileAtRevision(this.container.git.getRevisionUri(n.reference.ref,d.fsPath,d.repoPath),za({annotationType:n.annotationType,line:n.line},n.showOptions))}},"OpenFileAtRevisionFromCommand");ra=Ss([(0,I.WD)()],ra);var Dn=g(3542),na=Object.defineProperty,qo=Object.getOwnPropertyDescriptor,oa=o((t,i,n,d)=>{for(var h=d>1?void 0:d?qo(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&na(i,n,h),h},"openOnRemote_decorateClass");let Qa=o(class extends f.mY{constructor(t){super([s.Gh.OpenOnRemote,s.Gh.Deprecated_OpenInRemote]);this.container=t}async execute(t){var i;if(t?.resource==null)return;let n="remotes"in t?t.remotes:await this.container.git.getRemotesWithProviders(t.repoPath);if(t.remote!=null){const d=n.filter(h=>h.name===t.remote);n.length>0&&(n=d)}try{if(t.resource.type===Hi.JD.Branch){const[Ee,xe]=(0,Xi.pW)(t.resource.branch,"/");if(xe!=null){const Ue=n.find(st=>st.name===Ee);Ue!=null&&(t.resource.branch=xe,n=[Ue])}}else if(t.resource.type===Hi.JD.Revision){const{commit:Ee,fileName:xe}=t.resource;if(Ee!=null){const Ue=await Ee.findFile(xe);Ue?.status==="D"?t.resource.sha=await this.container.git.resolveReference(Ee.repoPath,`${Ee.sha}^`,xe):t.resource.sha=Ee.sha}}const d=Se.GitRemote.getHighlanderProviders(n),h=d?.length?d[0].name:"Remote",D={autoPick:"default",clipboard:t.clipboard,setDefault:!0};let M,le=`Choose which remote to ${t.clipboard?"copy the url for":"open on"}`;switch(t.resource.type){case Hi.JD.Branch:M=`${t.clipboard?`Copy ${h} Branch Url`:`Open Branch on ${h}`}${(0,Xi.vk)(s.NE.Dot,2,2)}${t.resource.branch}`;break;case Hi.JD.Branches:M=`${t.clipboard?`Copy ${h} Branches Url`:`Open Branches on ${h}`}`;break;case Hi.JD.Commit:M=`${t.clipboard?`Copy ${h} Commit Url`:`Open Commit on ${h}`}${(0,Xi.vk)(s.NE.Dot,2,2)}${Se.GitRevision.shorten(t.resource.sha)}`;break;case Hi.JD.Comparison:M=`${t.clipboard?`Copy ${h} Comparison Url`:`Open Comparison on ${h}`}${(0,Xi.vk)(s.NE.Dot,2,2)}${Se.GitRevision.createRange(t.resource.base,t.resource.compare,t.resource.notation??"...")}`;break;case Hi.JD.CreatePullRequest:D.autoPick=!0,D.setDefault=!1,M=`${t.clipboard?`Copy ${h} Create Pull Request Url`:`Create Pull Request on ${h}`}${(0,Xi.vk)(s.NE.Dot,2,2)}${(i=t.resource.base)!=null&&i.branch?Se.GitRevision.createRange(t.resource.base.branch,t.resource.compare.branch,"..."):t.resource.compare.branch}`,le=`Choose which remote to ${t.clipboard?"copy the create pull request url for":"create the pull request on"}`;break;case Hi.JD.File:M=`${t.clipboard?`Copy ${h} File Url`:`Open File on ${h}`}${(0,Xi.vk)(s.NE.Dot,2,2)}${t.resource.fileName}`;break;case Hi.JD.Repo:M=`${t.clipboard?`Copy ${h} Repository Url`:`Open Repository on ${h}`}`;break;case Hi.JD.Revision:{M=`${t.clipboard?`Copy ${h} File Url`:`Open File on ${h}`}${(0,Xi.vk)(s.NE.Dot,2,2)}${Se.GitRevision.shorten(t.resource.sha)}${(0,Xi.vk)(s.NE.Dot,1,1)}${t.resource.fileName}`;break}}const be=await Dn.ld.show(M,le,t.resource,n,D);await be?.execute()}catch(d){v.Y.error(d,"OpenOnRemoteCommand"),T.V.showGenericErrorMessage("Unable to open in remote provider")}}},"OpenOnRemoteCommand");Qa=oa([(0,I.WD)()],Qa);var Fl=g(6814),Rs=Object.defineProperty,Kn=Object.defineProperties,On=Object.getOwnPropertyDescriptor,zn=Object.getOwnPropertyDescriptors,Zo=Object.getOwnPropertySymbols,fn=Object.prototype.hasOwnProperty,qa=Object.prototype.propertyIsEnumerable,Yr=o((t,i,n)=>i in t?Rs(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"openIssueOnRemote_defNormalProp"),sa=o((t,i)=>{for(var n in i||(i={}))fn.call(i,n)&&Yr(t,n,i[n]);if(Zo)for(var n of Zo(i))qa.call(i,n)&&Yr(t,n,i[n]);return t},"openIssueOnRemote_spreadValues"),aa=o((t,i)=>Kn(t,zn(i)),"openIssueOnRemote_spreadProps"),Bi=o((t,i,n,d)=>{for(var h=d>1?void 0:d?On(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Rs(i,n,h),h},"openIssueOnRemote_decorateClass");let Za=o(class extends f.mY{constructor(t){super([s.Gh.OpenIssueOnRemote,s.Gh.CopyRemoteIssueUrl]);this.container=t}preExecute(t,i){return t.type==="viewItem"&&t.node instanceof Fl.Z&&(i=aa(sa({},i),{issue:{url:t.node.issue.url},clipboard:t.command===s.Gh.CopyRemotePullRequestUrl})),this.execute(i)}async execute(t){t.clipboard?await j.env.clipboard.writeText(t.issue.url):j.env.openExternal(j.Uri.parse(t.issue.url))}},"OpenIssueOnRemoteCommand");Za=Bi([(0,I.WD)()],Za);var Ds=Object.defineProperty,Kr=Object.defineProperties,Po=Object.getOwnPropertyDescriptor,an=Object.getOwnPropertyDescriptors,Er=Object.getOwnPropertySymbols,$n=Object.prototype.hasOwnProperty,Xa=Object.prototype.propertyIsEnumerable,la=o((t,i,n)=>i in t?Ds(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"openPullRequestOnRemote_defNormalProp"),Ja=o((t,i)=>{for(var n in i||(i={}))$n.call(i,n)&&la(t,n,i[n]);if(Er)for(var n of Er(i))Xa.call(i,n)&&la(t,n,i[n]);return t},"openPullRequestOnRemote_spreadValues"),el=o((t,i)=>Kr(t,an(i)),"openPullRequestOnRemote_spreadProps"),En=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Po(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Ds(i,n,h),h},"openPullRequestOnRemote_decorateClass");let Xo=o(class extends f.mY{constructor(t){super([s.Gh.OpenPullRequestOnRemote,s.Gh.CopyRemotePullRequestUrl]);this.container=t}preExecute(t,i){return t.type==="viewItem"&&t.node instanceof dt.Zt&&(i=el(Ja({},i),{pr:{url:t.node.pullRequest.url},clipboard:t.command===s.Gh.CopyRemotePullRequestUrl})),this.execute(i)}async execute(t){if(t?.pr==null){if(t?.repoPath==null||t?.ref==null)return;const i=await this.container.git.getRichRemoteProvider(t.repoPath);if(i?.provider==null)return;const n=await this.container.git.getPullRequestForCommit(t.ref,i.provider);if(n==null)return;t=Ja({},t),t.pr=n}t.clipboard?await j.env.clipboard.writeText(t.pr.url):j.env.openExternal(j.Uri.parse(t.pr.url))}},"OpenPullRequestOnRemoteCommand");Xo=En([(0,I.WD)()],Xo);var ca=Object.defineProperty,Os=Object.defineProperties,tl=Object.getOwnPropertyDescriptor,Tr=Object.getOwnPropertyDescriptors,$s=Object.getOwnPropertySymbols,xl=Object.prototype.hasOwnProperty,il=Object.prototype.propertyIsEnumerable,Es=o((t,i,n)=>i in t?ca(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"openRepoOnRemote_defNormalProp"),ua=o((t,i)=>{for(var n in i||(i={}))xl.call(i,n)&&Es(t,n,i[n]);if($s)for(var n of $s(i))il.call(i,n)&&Es(t,n,i[n]);return t},"openRepoOnRemote_spreadValues"),Ts=o((t,i)=>Os(t,Tr(i)),"openRepoOnRemote_spreadProps"),Al=o((t,i,n,d)=>{for(var h=d>1?void 0:d?tl(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&ca(i,n,h),h},"openRepoOnRemote_decorateClass");let Jo=o(class extends f.pu{constructor(t){super([s.Gh.OpenRepoOnRemote,s.Gh.Deprecated_OpenRepoInRemote,s.Gh.CopyRemoteRepositoryUrl]);this.container=t}preExecute(t,i){return(0,f.C$)(t)&&(i=Ts(ua({},i),{remote:t.node.remote.name})),t.command===s.Gh.CopyRemoteRepositoryUrl&&(i=Ts(ua({},i),{clipboard:!0})),this.execute(t.editor,t.uri,i)}async execute(t,i,n){var d;i=(0,f.SX)(i,t);const h=i!=null?await A.YY.fromUri(i):void 0,D=(d=await de.I.getBestRepositoryOrShow(h,t,n?.clipboard?"Choose which repository to copy the url from":"Choose which repository to open on remote"))==null?void 0:d.path;if(!!D)try{await(0,I.P0)(s.Gh.OpenOnRemote,{resource:{type:Hi.JD.Repo},repoPath:D,remote:n?.remote,clipboard:n?.clipboard})}catch(M){v.Y.error(M,"OpenRepoOnRemoteCommand"),j.window.showErrorMessage("Unable to open repository on remote provider. See output channel for more details")}}},"OpenRepoOnRemoteCommand");Jo=Al([(0,I.WD)()],Jo);var mn=Object.defineProperty,rl=Object.getOwnPropertyDescriptor,yr=Object.getOwnPropertySymbols,Fs=Object.prototype.hasOwnProperty,Il=Object.prototype.propertyIsEnumerable,nl=o((t,i,n)=>i in t?mn(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"openRevisionFile_defNormalProp"),es=o((t,i)=>{for(var n in i||(i={}))Fs.call(i,n)&&nl(t,n,i[n]);if(yr)for(var n of yr(i))Il.call(i,n)&&nl(t,n,i[n]);return t},"openRevisionFile_spreadValues"),pn=o((t,i,n,d)=>{for(var h=d>1?void 0:d?rl(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&mn(i,n,h),h},"openRevisionFile_decorateClass");let Tn=o(class extends f.pu{constructor(t){super([s.Gh.OpenRevisionFile,s.Gh.OpenRevisionFileInDiffLeft,s.Gh.OpenRevisionFileInDiffRight]);this.container=t}async execute(t,i,n){var d;if(i=(0,f.SX)(i,t),i==null)return;const h=await A.YY.fromUri(i);n=es({},n),n.line==null&&(n.line=t?.selection.active.line??0);try{if(n.revisionUri==null)if(h?.sha){const D=await this.container.git.getCommit(h.repoPath,h.sha);n.revisionUri=((d=D?.file)==null?void 0:d.status)==="D"?this.container.git.getRevisionUri(await D.getPreviousSha()??Se.GitRevision.deletedOrMissing,D.file,D.repoPath):this.container.git.getRevisionUri(h)}else n.revisionUri=this.container.git.getRevisionUri(h);await w.u.Commit.openFileAtRevision(n.revisionUri,es({annotationType:n.annotationType,line:n.line},n.showOptions))}catch(D){v.Y.error(D,"OpenRevisionFileCommand"),T.V.showGenericErrorMessage("Unable to open file revision")}}},"OpenRevisionFileCommand");Tn=pn([(0,I.WD)()],Tn);var gn=Object.defineProperty,Bl=Object.defineProperties,ol=Object.getOwnPropertyDescriptor,Nl=Object.getOwnPropertyDescriptors,sl=Object.getOwnPropertySymbols,So=Object.prototype.hasOwnProperty,xs=Object.prototype.propertyIsEnumerable,al=o((t,i,n)=>i in t?gn(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"openWorkingFile_defNormalProp"),Ro=o((t,i)=>{for(var n in i||(i={}))So.call(i,n)&&al(t,n,i[n]);if(sl)for(var n of sl(i))xs.call(i,n)&&al(t,n,i[n]);return t},"openWorkingFile_spreadValues"),Qn=o((t,i)=>Bl(t,Nl(i)),"openWorkingFile_spreadProps"),Br=o((t,i,n,d)=>{for(var h=d>1?void 0:d?ol(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&gn(i,n,h),h},"openWorkingFile_decorateClass");let qn=o(class extends f.pu{constructor(t){super([s.Gh.OpenWorkingFile,s.Gh.OpenWorkingFileInDiffLeft,s.Gh.OpenWorkingFileInDiffRight]);this.container=t}async execute(t,i,n){n=Ro({},n),n.line==null&&(n.line=t?.selection.active.line);try{if(n.uri==null){if(i=(0,f.SX)(i,t),i==null)return}else i=n.uri;if(n.uri=await A.YY.fromUri(i),A.YY.is(n.uri)&&n.uri.sha){const h=await this.container.git.getWorkingUri(n.uri.repoPath,n.uri);if(h===void 0){j.window.showWarningMessage("Unable to open working file. File could not be found in the working tree");return}n.uri=new A.YY(h,n.uri.repoPath)}n.line!==void 0&&n.line!==0&&(n.showOptions===void 0&&(n.showOptions={}),n.showOptions.selection=new j.Range(n.line,0,n.line,0));const d=await(0,P.GR)(n.uri,Qn(Ro({},n.showOptions),{throwOnError:!0}));if(n.annotationType===void 0)return;await this.container.fileAnnotations.show(d,n.annotationType,{selection:{line:n.line}})}catch(d){v.Y.error(d,"OpenWorkingFileCommand"),T.V.showGenericErrorMessage("Unable to open working file")}}},"OpenWorkingFileCommand");qn=Br([(0,I.WD)()],qn);var ll=Object.defineProperty,As=Object.getOwnPropertyDescriptor,Fn=o((t,i,n,d)=>{for(var h=d>1?void 0:d?As(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&ll(i,n,h),h},"rebaseEditor_decorateClass");let Ve=o(class extends f.mY{constructor(t){super(s.Gh.DisableRebaseEditor);this.container=t}execute(){return this.container.rebaseEditor.setEnabled(!1)}},"DisableRebaseEditorCommand");Ve=Fn([(0,I.WD)()],Ve);let Zn=o(class extends f.mY{constructor(t){super(s.Gh.EnableRebaseEditor);this.container=t}execute(){return this.container.rebaseEditor.setEnabled(!0)}},"EnableRebaseEditorCommand");Zn=Fn([(0,I.WD)()],Zn);var cl=Object.defineProperty,Ml=Object.getOwnPropertyDescriptor,ul=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Ml(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&cl(i,n,h),h},"refreshHover_decorateClass");let Is=o(class extends f.mY{constructor(t){super(s.Gh.RefreshHover);this.container=t}async execute(){await(0,I.dO)(s.nA.EditorShowHover)}},"RefreshHoverCommand");Is=ul([(0,I.WD)()],Is);var hl=Object.defineProperty,Do=Object.defineProperties,ts=Object.getOwnPropertyDescriptor,Oo=Object.getOwnPropertyDescriptors,vn=Object.getOwnPropertySymbols,Bs=Object.prototype.hasOwnProperty,zr=Object.prototype.propertyIsEnumerable,$o=o((t,i,n)=>i in t?hl(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"remoteProviders_defNormalProp"),ha=o((t,i)=>{for(var n in i||(i={}))Bs.call(i,n)&&$o(t,n,i[n]);if(vn)for(var n of vn(i))zr.call(i,n)&&$o(t,n,i[n]);return t},"remoteProviders_spreadValues"),Xn=o((t,i)=>Do(t,Oo(i)),"remoteProviders_spreadProps"),xn=o((t,i,n,d)=>{for(var h=d>1?void 0:d?ts(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&hl(i,n,h),h},"remoteProviders_decorateClass");let ln=o(class extends f.mY{constructor(t){super(s.Gh.ConnectRemoteProvider);this.container=t}static getMarkdownCommandArgs(t){let i;return Se.GitRemote.is(t)?i={remote:t.id,repoPath:t.repoPath}:i=t,super.getMarkdownCommandArgsCore(s.Gh.ConnectRemoteProvider,i)}preExecute(t,i){return(0,f.C$)(t)&&(i=Xn(ha({},i),{remote:t.node.remote.id,repoPath:t.node.remote.repoPath})),this.execute(i)}async execute(t){let i,n,d;if(t?.repoPath==null){const D=new Map;for(const M of this.container.git.openRepositories){const le=await M.getRichRemote();le?.provider!=null&&!await le.provider.isConnected()&&D.set(M,le)}if(D.size===0)return!1;if(D.size===1){let M;[M,i]=(0,Y.Ps)(D),d=M.path}else{const M=await de.I.show(void 0,"Choose which repository to connect to the remote provider",[...D.keys()]);if(M?.item==null)return;d=M.repoPath,i=D.get(M.item)}}else if(t?.remote==null){if(d=t.repoPath,i=await this.container.git.getRichRemoteProvider(d,{includeDisconnected:!0}),i==null)return!1}else if(d=t.repoPath,n=await this.container.git.getRemotesWithProviders(d),i=n.find(D=>D.id===t.remote),!i?.hasRichProvider())return!1;const h=await i.provider.connect();return h&&!(n??await this.container.git.getRemotesWithProviders(d)).some(D=>D.default)&&await i.setAsDefault(!0),h}},"ConnectRemoteProviderCommand");ln=xn([(0,I.WD)()],ln);let Ns=o(class extends f.mY{constructor(t){super(s.Gh.DisconnectRemoteProvider);this.container=t}static getMarkdownCommandArgs(t){let i;return Se.GitRemote.is(t)?i={remote:t.id,repoPath:t.repoPath}:i=t,super.getMarkdownCommandArgsCore(s.Gh.DisconnectRemoteProvider,i)}preExecute(t,i){return(0,f.C$)(t)&&(i=Xn(ha({},i),{remote:t.node.remote.id,repoPath:t.node.remote.repoPath})),this.execute(i)}async execute(t){let i,n;if(t?.repoPath==null){const d=new Map;for(const h of this.container.git.openRepositories){const D=await h.getRichRemote(!0);D!=null&&d.set(h,D)}if(d.size===0)return;if(d.size===1){let h;[h,i]=(0,Y.Ps)(d),n=h.path}else{const h=await de.I.show(void 0,"Choose which repository to disconnect from the remote provider",[...d.keys()]);if(h?.item==null)return;n=h.repoPath,i=d.get(h.item)}}else if(t?.remote==null){if(n=t.repoPath,i=await this.container.git.getRichRemoteProvider(n,{includeDisconnected:!1}),i==null)return}else if(n=t.repoPath,i=(await this.container.git.getRemotesWithProviders(n)).find(d=>d.id===t.remote),!i?.hasRichProvider())return;return i.provider.disconnect()}},"DisconnectRemoteProviderCommand");Ns=xn([(0,I.WD)()],Ns);var Jn=Object.defineProperty,dl=Object.getOwnPropertyDescriptor,is=o((t,i,n,d)=>{for(var h=d>1?void 0:d?dl(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Jn(i,n,h),h},"repositories_decorateClass");let fl=o(class extends f.mY{constructor(t){super(s.Gh.FetchRepositories);this.container=t}async execute(){return(0,w.m)({command:"fetch",state:{repos:this.container.git.openRepositories}})}},"FetchRepositoriesCommand");fl=is([(0,I.WD)()],fl);let rs=o(class extends f.mY{constructor(t){super(s.Gh.PullRepositories);this.container=t}async execute(){return(0,w.m)({command:"pull",state:{repos:this.container.git.openRepositories}})}},"PullRepositoriesCommand");rs=is([(0,I.WD)()],rs);let Eo=o(class extends f.mY{constructor(t){super(s.Gh.PushRepositories);this.container=t}async execute(){return(0,w.m)({command:"push",state:{repos:this.container.git.openRepositories}})}},"PushRepositoriesCommand");Eo=is([(0,I.WD)()],Eo);var ns=g(1505),ml=Object.defineProperty,da=Object.getOwnPropertyDescriptor,kl=o((t,i,n,d)=>{for(var h=d>1?void 0:d?da(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&ml(i,n,h),h},"resetAvatarCache_decorateClass");let pl=o(class extends f.mY{constructor(t){super(s.Gh.ResetAvatarCache);this.container=t}execute(){(0,ns.E3)("all")}},"ResetAvatarCacheCommand");pl=kl([(0,I.WD)()],pl);var An=Object.defineProperty,eo=Object.getOwnPropertyDescriptor,Qr=o((t,i,n,d)=>{for(var h=d>1?void 0:d?eo(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&An(i,n,h),h},"resetSuppressedWarnings_decorateClass");let Ms=o(class extends f.mY{constructor(t){super(s.Gh.ResetSuppressedWarnings);this.container=t}async execute(){await Ui.DN.update("advanced.messages",void 0,j.ConfigurationTarget.Global)}},"ResetSuppressedWarningsCommand");Ms=Qr([(0,I.WD)()],Ms);var In=Object.defineProperty,Ul=Object.getOwnPropertyDescriptor,os=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Ul(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&In(i,n,h),h},"setViewsLayout_decorateClass"),ss=(t=>(t.GitLens="gitlens",t.SourceControl="scm",t))(ss||{});let fa=o(class extends f.mY{constructor(t){super(s.Gh.SetViewsLayout);this.container=t}async execute(t){let i=t?.layout;if(i==null){const n=await j.window.showQuickPick([{label:"Source Control Layout",description:"(default)",detail:"Shows all the views together on the Source Control side bar",layout:"scm"},{label:"GitLens Layout",description:"",detail:"Shows all the views together on the GitLens side bar",layout:"gitlens"}],{placeHolder:"Choose a GitLens views layout"});if(n==null)return;i=n.layout}switch(i){case"gitlens":try{let n=0;for(;n++<2;)await(0,I.dO)(s.nA.MoveViews,{viewIds:Ui.S4.map(d=>`gitlens.views.${d}`),destinationId:"workbench.view.extension.gitlens"})}catch{}break;case"scm":try{let n=0;for(;n++<2;)await(0,I.dO)(s.nA.MoveViews,{viewIds:Ui.S4.map(d=>`gitlens.views.${d}`),destinationId:"workbench.view.scm"})}catch{for(const n of Ui.S4)await(0,I.P0)(`gitlens.views.${n}.resetViewLocation`)}break}}},"SetViewsLayoutCommand");fa=os([(0,I.WD)()],fa);var qr=Object.defineProperty,ma=Object.defineProperties,gl=Object.getOwnPropertyDescriptor,pa=Object.getOwnPropertyDescriptors,To=Object.getOwnPropertySymbols,Wl=Object.prototype.hasOwnProperty,to=Object.prototype.propertyIsEnumerable,as=o((t,i,n)=>i in t?qr(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"searchCommits_defNormalProp"),io=o((t,i)=>{for(var n in i||(i={}))Wl.call(i,n)&&as(t,n,i[n]);if(To)for(var n of To(i))to.call(i,n)&&as(t,n,i[n]);return t},"searchCommits_spreadValues"),ro=o((t,i)=>ma(t,pa(i)),"searchCommits_spreadProps"),ks=o((t,i,n,d)=>{for(var h=d>1?void 0:d?gl(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&qr(i,n,h),h},"searchCommits_decorateClass");let ga=o(class extends f.mY{constructor(t){super([s.Gh.SearchCommits,s.Gh.SearchCommitsInView]);this.container=t}preExecute(t,i){return t.type==="viewItem"?(i=io({},i),i.showResultsInSideBar=!0,t.node instanceof dt.V5&&(i.repoPath=t.node.repoPath,i.search=t.node.search,i.prefillOnly=!0),(0,f.pT)(t)&&(i.repoPath=t.node.repo.path)):t.command===s.Gh.SearchCommitsInView&&(i=io({},i),i.showResultsInSideBar=!0),this.execute(i)}async execute(t){await(0,w.m)({command:"search",prefillOnly:t?.prefillOnly,state:ro(io({repo:t?.repoPath},t?.search),{showResultsInSideBar:this.container.config.gitCommands.search.showResultsInSideBar??t?.showResultsInSideBar})})}},"SearchCommitsCommand");ga=ks([(0,I.WD)()],ga);var Ll=g(3969),va=Object.defineProperty,vl=Object.getOwnPropertyDescriptor,_l=Object.getOwnPropertySymbols,ls=Object.prototype.hasOwnProperty,Us=Object.prototype.propertyIsEnumerable,Fo=o((t,i,n)=>i in t?va(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"showCommitsInView_defNormalProp"),Ws=o((t,i)=>{for(var n in i||(i={}))ls.call(i,n)&&Fo(t,n,i[n]);if(_l)for(var n of _l(i))Us.call(i,n)&&Fo(t,n,i[n]);return t},"showCommitsInView_spreadValues"),pi=o((t,i,n,d)=>{for(var h=d>1?void 0:d?vl(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&va(i,n,h),h},"showCommitsInView_decorateClass");let wl=o(class extends f.pu{constructor(t){super([s.Gh.ShowCommitInView,s.Gh.ShowCommitsInView]);this.container=t}async execute(t,i,n){if(n=Ws({},n),n.refs===void 0){if(i=(0,f.SX)(i,t),i==null)return;const d=await A.YY.fromUri(i);if(n.repoPath=d.repoPath,t!=null)try{const h=t.document.isDirty?await this.container.git.getBlameForRangeContents(d,t.selection,t.document.getText()):await this.container.git.getBlameForRange(d,t.selection);if(h===void 0)return T.V.showFileNotUnderSourceControlWarningMessage("Unable to find commits");n.refs=[...(0,Y.DZ)(h.commits.values(),D=>D.isUncommitted?void 0:D.ref)]}catch(h){return v.Y.error(h,"ShowCommitsInViewCommand","getBlameForRange"),T.V.showGenericErrorMessage("Unable to find commits")}else{if(d.sha==null)return;n.refs=[d.sha]}}return(0,w.m)({command:"search",state:{repo:n?.repoPath,pattern:Ll.n.fromCommits(n.refs),showResultsInSideBar:!0}})}},"ShowCommitsInViewCommand");wl=pi([(0,I.WD)()],wl);var cs=Object.defineProperty,us=Object.getOwnPropertyDescriptor,Ls=o((t,i,n,d)=>{for(var h=d>1?void 0:d?us(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&cs(i,n,h),h},"showLastQuickPick_decorateClass");let m=o(class extends f.mY{constructor(t){super(s.Gh.ShowLastQuickPick);this.container=t}execute(){const t=(0,f.l8)();if(t===void 0)return Promise.resolve(void 0);try{return j.commands.executeCommand(t.command,...t.args)}catch(i){return v.Y.error(i,"ShowLastQuickPickCommand"),T.V.showGenericErrorMessage("Unable to show last quick pick")}}},"ShowLastQuickPickCommand");m=Ls([(0,I.WD)()],m);var u=Object.defineProperty,p=Object.getOwnPropertyDescriptor,V=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,ae=o((t,i,n)=>i in t?u(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"showQuickBranchHistory_defNormalProp"),mt=o((t,i)=>{for(var n in i||(i={}))N.call(i,n)&&ae(t,n,i[n]);if(V)for(var n of V(i))J.call(i,n)&&ae(t,n,i[n]);return t},"showQuickBranchHistory_spreadValues"),Bt=o((t,i,n,d)=>{for(var h=d>1?void 0:d?p(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&u(i,n,h),h},"showQuickBranchHistory_decorateClass");let At=o(class extends f.Lk{constructor(t){super([s.Gh.ShowQuickBranchHistory,s.Gh.ShowQuickCurrentBranchHistory]);this.container=t}preExecute(t,i){return t.command===s.Gh.ShowQuickCurrentBranchHistory&&(i=mt({},i),i.branch="HEAD"),this.execute(t.editor,t.uri,i)}async execute(t,i,n){var d;i=(0,f.SX)(i,t);const h=i!=null?await A.YY.fromUri(i):void 0,D=n?.repoPath??h?.repoPath??((d=this.container.git.highlander)==null?void 0:d.path);let M;return D!=null&&(n?.branch!=null?M=n.branch==="HEAD"?"HEAD":Se.GitReference.create(n.branch,D,{refType:"branch",name:n.branch,remote:!1}):n?.tag!=null&&(M=Se.GitReference.create(n.tag,D,{refType:"tag",name:n.tag}))),(0,w.m)({command:"log",state:D!=null?{repo:D,reference:M}:{}})}},"ShowQuickBranchHistoryCommand");At=Bt([(0,I.WD)()],At);var Di=Object.defineProperty,fi=Object.getOwnPropertyDescriptor,Vi=Object.getOwnPropertySymbols,Li=Object.prototype.hasOwnProperty,Cr=Object.prototype.propertyIsEnumerable,Mi=o((t,i,n)=>i in t?Di(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"showQuickCommit_defNormalProp"),_n=o((t,i)=>{for(var n in i||(i={}))Li.call(i,n)&&Mi(t,n,i[n]);if(Vi)for(var n of Vi(i))Cr.call(i,n)&&Mi(t,n,i[n]);return t},"showQuickCommit_spreadValues"),Gs=o((t,i,n,d)=>{for(var h=d>1?void 0:d?fi(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Di(i,n,h),h},"showQuickCommit_decorateClass");let Gl=o(class extends f.Lk{constructor(t){super([s.Gh.RevealCommitInView,s.Gh.ShowQuickCommit]);this.container=t}static getMarkdownCommandArgs(t,i){const n=typeof t=="string"?{sha:t,repoPath:i}:t;return super.getMarkdownCommandArgsCore(s.Gh.ShowQuickCommit,n)}preExecute(t,i){return t.command===s.Gh.RevealCommitInView&&(i=_n({},i),i.revealInView=!0),t.type==="viewItem"&&(i=_n({},i),i.sha=t.node.uri.sha,(0,f.en)(t)&&(i.commit=t.node.commit)),this.execute(t.editor,t.uri,i)}async execute(t,i,n){var d;let h,D;if(n?.commit==null)if(n?.repoPath!=null&&n.sha!=null)D=n.repoPath,h=A.YY.fromRepoPath(D);else{if(i=(0,f.SX)(i,t),i==null)return;h=await A.YY.fromUri(i),D=h.repoPath}else n.sha==null&&(n.sha=n.commit.sha),h=n.commit.getGitUri(),D=n.commit.repoPath,i==null&&(i=(d=n.commit.file)==null?void 0:d.uri);if(n=_n({},n),n.sha==null){if(t==null)return;const M=t.selection.active.line;if(M<0)return;try{const le=await this.container.git.getBlameForLine(h,M);if(le==null){T.V.showFileNotUnderSourceControlWarningMessage("Unable to show commit");return}if(le.commit.isUncommitted){T.V.showLineUncommittedWarningMessage("Unable to show commit");return}n.sha=le.commit.sha,D=le.commit.repoPath,n.commit=le.commit}catch(le){v.Y.error(le,"ShowQuickCommitCommand",`getBlameForLine(${M})`),T.V.showGenericErrorMessage("Unable to show commit");return}}try{if((n.commit==null||n.commit.file!=null)&&(n.repoLog!=null&&(n.commit=n.repoLog.commits.get(n.sha),n.commit==null&&(n.repoLog=void 0)),n.repoLog==null&&(n.commit=await this.container.git.getCommit(D,n.sha))),n.commit==null){T.V.showCommitNotFoundWarningMessage("Unable to show commit");return}if(n.revealInView){await w.u.Commit.reveal(n.commit,{select:!0,focus:!0,expand:!0});return}await(0,w.m)({command:"show",state:{repo:D,reference:n.commit}})}catch(M){v.Y.error(M,"ShowQuickCommitCommand"),T.V.showGenericErrorMessage("Unable to show commit")}}},"ShowQuickCommitCommand");Gl=Gs([(0,I.WD)()],Gl);var hs=Object.defineProperty,Vs=Object.getOwnPropertyDescriptor,Pr=Object.getOwnPropertySymbols,xc=Object.prototype.hasOwnProperty,oc=Object.prototype.propertyIsEnumerable,sc=o((t,i,n)=>i in t?hs(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"showQuickCommitFile_defNormalProp"),_a=o((t,i)=>{for(var n in i||(i={}))xc.call(i,n)&&sc(t,n,i[n]);if(Pr)for(var n of Pr(i))oc.call(i,n)&&sc(t,n,i[n]);return t},"showQuickCommitFile_spreadValues"),no=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Vs(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&hs(i,n,h),h},"showQuickCommitFile_decorateClass");let Vl=o(class extends f.Lk{constructor(t){super([s.Gh.ShowQuickCommitFile,s.Gh.ShowQuickCommitRevision,s.Gh.ShowQuickCommitRevisionInDiffLeft,s.Gh.ShowQuickCommitRevisionInDiffRight]);this.container=t}static getMarkdownCommandArgs(t){return super.getMarkdownCommandArgsCore(s.Gh.ShowQuickCommitFile,t)}async preExecute(t,i){if(t.editor!=null&&t.command.startsWith(s.Gh.ShowQuickCommitRevision)){i=_a({},i);const n=await A.YY.fromUri(t.editor.document.uri);i.sha=n.sha}return t.type==="viewItem"&&(i=_a({},i),i.sha=t.node.uri.sha,(0,f.en)(t)&&(i.commit=t.node.commit)),this.execute(t.editor,t.uri,i)}async execute(t,i,n){var d,h,D;if(i=(0,f.SX)(i,t),i==null)return;n=_a({},n);let M;if(n.revisionUri!=null?(M=A.YY.fromRevisionUri(j.Uri.parse(n.revisionUri,!0)),n.sha=M.sha):M=await A.YY.fromUri(i),n.sha==null){if(t==null)return;const le=t.selection.active.line;if(le<0)return;try{const be=await this.container.git.getBlameForLine(M,le);if(be==null){T.V.showFileNotUnderSourceControlWarningMessage("Unable to show commit file details");return}if(be.commit.isUncommitted){T.V.showLineUncommittedWarningMessage("Unable to show commit file details");return}n.sha=be.commit.sha,n.commit=be.commit}catch(be){v.Y.error(be,"ShowQuickCommitFileDetailsCommand",`getBlameForLine(${le})`),j.window.showErrorMessage("Unable to show commit file details. See output channel for more details");return}}try{if(n.commit==null&&(n.fileLog!=null&&(n.commit=n.fileLog.commits.get(n.sha),n.commit==null&&(n.fileLog=void 0)),n.fileLog==null)){const be=((d=n.commit)==null?void 0:d.repoPath)??M.repoPath;if(n.commit=await this.container.git.getCommitForFile(be,M,{ref:n.sha}),n.commit==null){T.V.showCommitNotFoundWarningMessage("Unable to show commit file details");return}}if(n.commit==null){T.V.showCommitNotFoundWarningMessage("Unable to show commit file details");return}const le=((D=(h=n.commit)==null?void 0:h.file)==null?void 0:D.path)??M.fsPath;Se.GitCommit.is(n.commit)&&n.commit.files==null&&await n.commit.ensureFullDetails(),await(0,w.m)({command:"show",state:{repo:n.commit.repoPath,reference:n.commit,fileName:le}})}catch(le){v.Y.error(le,"ShowQuickCommitFileDetailsCommand"),T.V.showGenericErrorMessage("Unable to show commit file details")}}},"ShowQuickCommitFileCommand");Vl=no([(0,I.WD)()],Vl);var ac=Object.defineProperty,wa=Object.getOwnPropertyDescriptor,Hl=Object.getOwnPropertySymbols,Hs=Object.prototype.hasOwnProperty,lc=Object.prototype.propertyIsEnumerable,cc=o((t,i,n)=>i in t?ac(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"showQuickFileHistory_defNormalProp"),Ac=o((t,i)=>{for(var n in i||(i={}))Hs.call(i,n)&&cc(t,n,i[n]);if(Hl)for(var n of Hl(i))lc.call(i,n)&&cc(t,n,i[n]);return t},"showQuickFileHistory_spreadValues"),ba=o((t,i,n,d)=>{for(var h=d>1?void 0:d?wa(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&ac(i,n,h),h},"showQuickFileHistory_decorateClass");let ds=o(class extends f.Lk{constructor(t){super([s.Gh.OpenFileHistory,s.Gh.OpenFolderHistory,s.Gh.ShowQuickFileHistory,s.Gh.QuickOpenFileHistory,s.Gh.Deprecated_ShowFileHistoryInView]);this.container=t}preExecute(t,i){return(t.command===s.Gh.OpenFileHistory||t.command===s.Gh.OpenFolderHistory||t.command===s.Gh.Deprecated_ShowFileHistoryInView)&&(i=Ac({},i),i.showInSideBar=!0),this.execute(t.editor,t.uri,i)}async execute(t,i,n){if(i=(0,f.SX)(i,t),i==null)return;const d=await A.YY.fromUri(i);if(n?.showInSideBar){await this.container.fileHistoryView.showHistoryForUri(d);return}await(0,w.m)({command:"log",state:d?.repoPath!=null?{repo:d.repoPath,reference:n?.reference??"HEAD",fileName:d.relativePath}:{}})}},"ShowQuickFileHistoryCommand");ds=ba([(0,I.WD)()],ds);var uc=Object.defineProperty,fs=Object.getOwnPropertyDescriptor,bl=o((t,i,n,d)=>{for(var h=d>1?void 0:d?fs(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&uc(i,n,h),h},"showQuickRepoStatus_decorateClass");let hc=o(class extends f.mY{constructor(t){super(s.Gh.ShowQuickRepoStatus);this.container=t}async execute(t){return(0,w.m)({command:"status",state:{repo:t?.repoPath}})}},"ShowQuickRepoStatusCommand");hc=bl([(0,I.WD)()],hc);var Ic=Object.defineProperty,Bc=Object.getOwnPropertyDescriptor,Nc=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Bc(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Ic(i,n,h),h},"showQuickStashList_decorateClass");let yl=o(class extends f.mY{constructor(t){super(s.Gh.ShowQuickStashList);this.container=t}execute(t){return(0,w.m)({command:"stash",state:{subcommand:"list",repo:t?.repoPath}})}},"ShowQuickStashListCommand");yl=Nc([(0,I.WD)()],yl);var Mc=Object.defineProperty,dc=Object.getOwnPropertyDescriptor,fc=o((t,i,n,d)=>{for(var h=d>1?void 0:d?dc(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Mc(i,n,h),h},"showView_decorateClass");let jl=o(class extends f.mY{constructor(t){super([s.Gh.ShowBranchesView,s.Gh.ShowCommitsView,s.Gh.ShowContributorsView,s.Gh.ShowFileHistoryView,s.Gh.ShowLineHistoryView,s.Gh.ShowRemotesView,s.Gh.ShowRepositoriesView,s.Gh.ShowSearchAndCompareView,s.Gh.ShowStashesView,s.Gh.ShowTagsView,s.Gh.ShowTimelineView,s.Gh.ShowWorktreesView,s.Gh.ShowHomeView]);this.container=t}preExecute(t){return this.execute(t.command)}async execute(t){switch(t){case s.Gh.ShowBranchesView:return this.container.branchesView.show();case s.Gh.ShowCommitsView:return this.container.commitsView.show();case s.Gh.ShowContributorsView:return this.container.contributorsView.show();case s.Gh.ShowFileHistoryView:return this.container.fileHistoryView.show();case s.Gh.ShowHomeView:return this.container.homeView.show();case s.Gh.ShowLineHistoryView:return this.container.lineHistoryView.show();case s.Gh.ShowRemotesView:return this.container.remotesView.show();case s.Gh.ShowRepositoriesView:return this.container.repositoriesView.show();case s.Gh.ShowSearchAndCompareView:return this.container.searchAndCompareView.show();case s.Gh.ShowStashesView:return this.container.stashesView.show();case s.Gh.ShowTagsView:return this.container.tagsView.show();case s.Gh.ShowTimelineView:return this.container.timelineView.show();case s.Gh.ShowWorktreesView:return this.container.worktreesView.show()}return Promise.resolve(void 0)}},"ShowViewCommand");jl=fc([(0,I.WD)()],jl);var Yl=Object.defineProperty,mc=Object.defineProperties,pc=Object.getOwnPropertyDescriptor,kc=Object.getOwnPropertyDescriptors,Kl=Object.getOwnPropertySymbols,Uc=Object.prototype.hasOwnProperty,Wc=Object.prototype.propertyIsEnumerable,gc=o((t,i,n)=>i in t?Yl(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"stashApply_defNormalProp"),zl=o((t,i)=>{for(var n in i||(i={}))Uc.call(i,n)&&gc(t,n,i[n]);if(Kl)for(var n of Kl(i))Wc.call(i,n)&&gc(t,n,i[n]);return t},"stashApply_spreadValues"),vc=o((t,i)=>mc(t,kc(i)),"stashApply_spreadProps"),Lc=o((t,i,n,d)=>{for(var h=d>1?void 0:d?pc(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Yl(i,n,h),h},"stashApply_decorateClass");let Cl=o(class extends f.mY{constructor(t){super(s.Gh.StashApply);this.container=t}async preExecute(t,i){return(0,f.en)(t)?(t.node.commit.message==null&&await t.node.commit.ensureFullDetails(),i=vc(zl({},i),{stashItem:t.node.commit})):(0,f.pT)(t)&&(i=vc(zl({},i),{repoPath:t.node.repo.path})),this.execute(i)}async execute(t){var i,n;return t?.deleteAfter?w.u.Stash.pop(t?.repoPath??((i=t?.stashItem)==null?void 0:i.repoPath),t?.stashItem):w.u.Stash.apply(t?.repoPath??((n=t?.stashItem)==null?void 0:n.repoPath),t?.stashItem)}},"StashApplyCommand");Cl=Lc([(0,I.WD)()],Cl);var _c=Object.defineProperty,Gc=Object.getOwnPropertyDescriptor,Ql=Object.getOwnPropertySymbols,wc=Object.prototype.hasOwnProperty,ya=Object.prototype.propertyIsEnumerable,Ca=o((t,i,n)=>i in t?_c(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"stashSave_defNormalProp"),Pa=o((t,i)=>{for(var n in i||(i={}))wc.call(i,n)&&Ca(t,n,i[n]);if(Ql)for(var n of Ql(i))ya.call(i,n)&&Ca(t,n,i[n]);return t},"stashSave_spreadValues"),Pl=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Gc(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&_c(i,n,h),h},"stashSave_decorateClass");let bc=o(class extends f.mY{constructor(t){super([s.Gh.StashSave,s.Gh.StashSaveFiles]);this.container=t}async preExecute(t,i){var n,d;if((0,f.E9)(t))i=Pa({},i),i.repoPath=t.node.file.repoPath??t.node.repoPath,i.uris=[A.YY.fromFile(t.node.file,i.repoPath)];else if((0,f.pT)(t))i=Pa({},i),i.repoPath=t.node.repo.path;else if((0,f.l7)(t))i=Pa({},i),i.repoPath=t.node.repoPath;else if(t.type==="scm-states"){i=Pa({},i),i.uris=t.scmResourceStates.map(D=>D.resourceUri),i.repoPath=(n=await this.container.git.getOrOpenRepository(i.uris[0]))==null?void 0:n.path;const h=await this.container.git.getStatusForRepo(i.repoPath);h?.computeWorkingTreeStatus().staged&&(t.scmResourceStates.some(D=>D.resourceGroupType===Ji.Index)||(i.keepStaged=!0))}else if(t.type==="scm-groups"){i=Pa({},i),i.uris=t.scmResourceGroups.reduce((D,M)=>D.concat(M.resourceStates.map(le=>le.resourceUri)),[]),i.repoPath=(d=await this.container.git.getOrOpenRepository(i.uris[0]))==null?void 0:d.path;const h=await this.container.git.getStatusForRepo(i.repoPath);h?.computeWorkingTreeStatus().staged&&(t.scmResourceGroups.some(D=>D.id==="index")||(i.keepStaged=!0))}return this.execute(i)}execute(t){return w.u.Stash.push(t?.repoPath,t?.uris,t?.message,t?.keepStaged)}},"StashSaveCommand");bc=Pl([(0,I.WD)()],bc);var ql;(t=>{async function i(){if(yi.W.instance.config.modes==null)return;const n=yi.W.instance.config.modes,d=Object.keys(n);if(d.length===0)return;const h=yi.W.instance.config.mode.active,D=d.map(le=>{const be=n[le];return{label:`${h===le?"$(check)\xA0\xA0":"\xA0\xA0\xA0\xA0\xA0"}${be.name} mode`,description:be.description?`\xA0${s.NE.Dash}\xA0 ${be.description}`:"",key:le}});return h&&D.splice(0,0,{label:`Exit ${n[h].name} mode`,key:void 0}),await j.window.showQuickPick(D,{placeHolder:"select a GitLens mode to enter"})}o(i,"show"),t.show=i})(ql||(ql={}));var Vc=Object.defineProperty,Hc=Object.getOwnPropertyDescriptor,Bn=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Hc(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Vc(i,n,h),h},"switchMode_decorateClass");let Zl=o(class extends f.mY{constructor(t){super(s.Gh.SwitchMode);this.container=t}async execute(){var t,i;const n=v.Y.getCorrelationContext(),d=await ql.show();if(d===void 0)return;n!=null&&(n.exitDetails=` \u2014 mode=${d.key??""}`);const h=this.container.config.mode.active;if(h!==d.key){if(h!=null&&h.length!==0){const D=(t=this.container.config.modes)==null?void 0:t[h].annotations;if(D!=null){const M=d.key!=null?(i=this.container.config.modes)==null?void 0:i[d.key].annotations:void 0;D!==M&&await this.container.fileAnnotations.clearAll()}}await Ui.DN.update("mode.active",d.key,j.ConfigurationTarget.Global)}}},"SwitchModeCommand");Bn([(0,Un.cM)({args:!1,correlate:!0,singleLine:!0,timed:!1})],Zl.prototype,"execute",1),Zl=Bn([(0,I.WD)()],Zl);let Sa=o(class extends f.mY{constructor(t){super(s.Gh.ToggleReviewMode);this.container=t}async execute(){if(this.container.config.modes==null||!Object.keys(this.container.config.modes).includes("review"))return;const t=this.container.config.mode.active==="review"?void 0:"review";await Ui.DN.update("mode.active",t,j.ConfigurationTarget.Global)}},"ToggleReviewModeCommand");Bn([(0,Un.cM)({args:!1,singleLine:!0,timed:!1})],Sa.prototype,"execute",1),Sa=Bn([(0,I.WD)()],Sa);let Xl=o(class extends f.mY{constructor(t){super(s.Gh.ToggleZenMode);this.container=t}async execute(){if(this.container.config.modes==null||!Object.keys(this.container.config.modes).includes("zen"))return;const t=this.container.config.mode.active==="zen"?void 0:"zen";await Ui.DN.update("mode.active",t,j.ConfigurationTarget.Global)}},"ToggleZenModeCommand");Bn([(0,Un.cM)({args:!1,singleLine:!0,timed:!1})],Xl.prototype,"execute",1),Xl=Bn([(0,I.WD)()],Xl);var jc=Object.defineProperty,yc=Object.getOwnPropertyDescriptor,Jl=o((t,i,n,d)=>{for(var h=d>1?void 0:d?yc(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&jc(i,n,h),h},"toggleCodeLens_decorateClass");let Cc=o(class extends f.mY{constructor(t){super(s.Gh.ToggleCodeLens);this.container=t}execute(){return this.container.codeLens.toggleCodeLens()}},"ToggleCodeLensCommand");Cc=Jl([(0,I.WD)()],Cc);var ec=Object.defineProperty,Pc=Object.defineProperties,Sc=Object.getOwnPropertyDescriptor,Yc=Object.getOwnPropertyDescriptors,Rc=Object.getOwnPropertySymbols,Kc=Object.prototype.hasOwnProperty,Dc=Object.prototype.propertyIsEnumerable,Oc=o((t,i,n)=>i in t?ec(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n,"toggleFileAnnotations_defNormalProp"),Ra=o((t,i)=>{for(var n in i||(i={}))Kc.call(i,n)&&Oc(t,n,i[n]);if(Rc)for(var n of Rc(i))Dc.call(i,n)&&Oc(t,n,i[n]);return t},"toggleFileAnnotations_spreadValues"),Da=o((t,i)=>Pc(t,Yc(i)),"toggleFileAnnotations_spreadProps"),Sl=o((t,i,n,d)=>{for(var h=d>1?void 0:d?Sc(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&ec(i,n,h),h},"toggleFileAnnotations_decorateClass");let $c=o(class extends f._l{constructor(t){super([s.Gh.ClearFileAnnotations,s.Gh.ComputingFileAnnotations]);this.container=t}async execute(t,i,n){if(t!=null&&!(0,P.PH)(t)&&n!=null&&!q.n.equals(n,t.document.uri)){const d=j.window.visibleTextEditors.find(h=>q.n.equals(n,h.document.uri));d!=null&&(t=d)}try{await this.container.fileAnnotations.clear(t)}catch(d){v.Y.error(d,"ClearFileAnnotationsCommand"),T.V.showGenericErrorMessage("Unable to clear file annotations")}}},"ClearFileAnnotationsCommand");$c=Sl([(0,I.WD)()],$c);let js=o(class extends f.pu{constructor(t){super([s.Gh.ToggleFileBlame,s.Gh.ToggleFileBlameInDiffLeft,s.Gh.ToggleFileBlameInDiffRight]);this.container=t}execute(t,i,n){return xo(this.container,t,i,Da(Ra({},n),{type:Ui.VP.Blame}))}},"ToggleFileBlameCommand");js=Sl([(0,I.WD)()],js);let Oi=o(class extends f.pu{constructor(t){super(s.Gh.ToggleFileChanges);this.container=t}execute(t,i,n){return xo(this.container,t,i,Da(Ra({},n),{type:Ui.VP.Changes}))}},"ToggleFileChangesCommand");Oi=Sl([(0,I.WD)()],Oi);let tc=o(class extends f.pu{constructor(t){super([s.Gh.ToggleFileHeatmap,s.Gh.ToggleFileHeatmapInDiffLeft,s.Gh.ToggleFileHeatmapInDiffRight]);this.container=t}execute(t,i,n){return xo(this.container,t,i,Da(Ra({},n),{type:Ui.VP.Heatmap}))}},"ToggleFileHeatmapCommand");tc=Sl([(0,I.WD)()],tc);async function xo(t,i,n,d){var h;if(i!=null&&!(0,P.PH)(i)&&n!=null&&!q.n.equals(n,i.document.uri)){const D=j.window.visibleTextEditors.find(M=>q.n.equals(n,M.document.uri));D!=null&&(i=D)}try{d=Ra({type:Ui.VP.Blame},d),await t.fileAnnotations.toggle(i,d.type,Ra({selection:((h=d.context)==null?void 0:h.selection)??{line:i?.selection.active.line}},d.context),d.on)}catch(D){v.Y.error(D,"ToggleFileAnnotationsCommand"),j.window.showErrorMessage(`Unable to toggle file ${d.type} annotations. See output channel for more details`)}}o(xo,"toggleFileAnnotations");var Ec=Object.defineProperty,zc=Object.getOwnPropertyDescriptor,Ao=o((t,i,n,d)=>{for(var h=d>1?void 0:d?zc(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&Ec(i,n,h),h},"toggleLineBlame_decorateClass");let Rl=o(class extends f.pu{constructor(t){super(s.Gh.ToggleLineBlame);this.container=t}async execute(t,i){try{await this.container.lineAnnotations.toggle(t)}catch(n){v.Y.error(n,"ToggleLineBlameCommand"),j.window.showErrorMessage("Unable to toggle line blame annotations. See output channel for more details")}}},"ToggleLineBlameCommand");Rl=Ao([(0,I.WD)()],Rl);var oo=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,l=o((t,i,n,d)=>{for(var h=d>1?void 0:d?qi(i,n):i,D=t.length-1,M;D>=0;D--)(M=t[D])&&(h=(d?M(i,n,h):M(h))||h);return d&&h&&oo(i,n,h),h},"walkthroughs_decorateClass");let e=o(class extends f.mY{constructor(t){super(s.Gh.GetStarted);this.container=t}execute(t){const i=this.container.context.extension.id;t===i&&(t=void 0),(0,P.lN)(i,t??"gitlens.welcome")}},"GetStartedCommand");e=l([(0,I.WD)()],e);let r=o(class extends f.mY{constructor(t){super(s.Gh.OpenWalkthrough);this.container=t}execute(t){const[i,n]=t?.split("|")??"gitlens.welcome";(0,P.lN)(this.container.context.extension.id,i,n)}},"OpenWalkthroughCommand");r=l([(0,I.WD)()],r)},6983:(Re,ne,g)=>{"use strict";g.d(ne,{C$:()=>E,DW:()=>O,E9:()=>k,Lk:()=>Te,Mg:()=>C,O$:()=>c,Qo:()=>F,SX:()=>R,_5:()=>U,_l:()=>je,d$:()=>x,en:()=>_,jT:()=>P,l7:()=>G,l8:()=>Pe,mY:()=>Q,pT:()=>B,pu:()=>ee});var s=g(9496),I=g.n(s),f=g(2976),w=g(3422),y=Object.defineProperty,b=Object.getOwnPropertySymbols,$=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,A=o((oe,ce,ue)=>ce in oe?y(oe,ce,{enumerable:!0,configurable:!0,writable:!0,value:ue}):oe[ce]=ue,"__defNormalProp"),v=o((oe,ce)=>{for(var ue in ce||(ce={}))$.call(ce,ue)&&A(oe,ue,ce[ue]);if(b)for(var ue of b(ce))L.call(ce,ue)&&A(oe,ue,ce[ue]);return oe},"__spreadValues"),T=o((oe,ce,ue)=>(A(oe,typeof ce!="symbol"?ce+"":ce,ue),ue),"__publicField");function R(oe,ce){var ue;return((ue=ce?.document)==null?void 0:ue.uri)??oe}o(R,"getCommandUri");function P(oe){return oe.type==="timeline-item:git"}o(P,"isCommandContextGitTimelineItem");function F(oe){return oe.type!=="viewItem"?!1:f.GitBranch.is(oe.node.branch)}o(F,"isCommandContextViewNodeHasBranch");function _(oe){return oe.type!=="viewItem"?!1:f.GitCommit.is(oe.node.commit)}o(_,"isCommandContextViewNodeHasCommit");function C(oe){return oe.type!=="viewItem"?!1:f.GitContributor.is(oe.node.contributor)}o(C,"isCommandContextViewNodeHasContributor");function k(oe){if(oe.type!=="viewItem")return!1;const ce=oe.node;return ce.file!=null&&(ce.file.repoPath!=null||ce.repoPath!=null)}o(k,"isCommandContextViewNodeHasFile");function x(oe){if(oe.type!=="viewItem")return!1;const ce=oe.node;return ce.file!=null&&f.GitCommit.is(ce.commit)&&(ce.file.repoPath!=null||ce.repoPath!=null)}o(x,"isCommandContextViewNodeHasFileCommit");function c(oe){if(oe.type!=="viewItem")return!1;const ce=oe.node;return ce.file!=null&&ce.ref1!=null&&ce.ref2!=null&&(ce.file.repoPath!=null||ce.repoPath!=null)}o(c,"isCommandContextViewNodeHasFileRefs");function O(oe){return oe.type==="viewItem"&&oe.node instanceof w.bT}o(O,"isCommandContextViewNodeHasRef");function E(oe){return oe.type!=="viewItem"?!1:f.GitRemote.is(oe.node.remote)}o(E,"isCommandContextViewNodeHasRemote");function B(oe){return oe.type!=="viewItem"?!1:oe.node.repo instanceof f.Repository}o(B,"isCommandContextViewNodeHasRepository");function G(oe){return oe.type!=="viewItem"?!1:typeof oe.node.repoPath=="string"}o(G,"isCommandContextViewNodeHasRepoPath");function U(oe){return oe.type!=="viewItem"?!1:f.GitTag.is(oe.node.tag)}o(U,"isCommandContextViewNodeHasTag");function H(oe){return oe==null?!1:oe.id!=null&&oe.label!=null&&oe.resourceStates!=null&&Array.isArray(oe.resourceStates)}o(H,"isScmResourceGroup");function j(oe){return oe==null?!1:oe.resourceUri!=null}o(j,"isScmResourceState");function q(oe){return oe==null?!1:oe.timestamp!=null&&oe.label!=null}o(q,"isTimelineItem");function de(oe){return oe==null?!1:q(oe)&&oe.ref!=null&&oe.previousRef!=null&&oe.message!=null}o(de,"isGitTimelineItem");class Q{constructor(ce){if(T(this,"contextParsingOptions",{expectsEditor:!1}),T(this,"_disposable"),typeof ce=="string"){this._disposable=s.commands.registerCommand(ce,(...Ae)=>this._execute(ce,...Ae),this);return}const ue=ce.map(Ae=>s.commands.registerCommand(Ae,(...ut)=>this._execute(Ae,...ut),this));this._disposable=s.Disposable.from(...ue)}static getMarkdownCommandArgsCore(ce,ue){return`command:${ce}?${encodeURIComponent(JSON.stringify(ue))}`}dispose(){this._disposable.dispose()}preExecute(ce,...ue){return this.execute(...ue)}_execute(ce,...ue){const[Ae,ut]=Q.parseContext(ce,v({},this.contextParsingOptions),...ue);return this.preExecute(Ae,...ut)}static parseContext(ce,ue,...Ae){var ut,Le;let Me,Ye=Ae[0];if(ue.expectsEditor)if((Ye==null||Ye.id!=null&&((ut=Ye.document)==null?void 0:ut.uri)!=null)&&(Me=Ye,Ae=Ae.slice(1),Ye=Ae[0]),Ae.length>0&&(Ye==null||Ye instanceof s.Uri)){const[et,...ye]=Ae;if(et!=null){Me==null&&(et.toString()===((Le=s.window.activeTextEditor)==null?void 0:Le.document.uri.toString())||ce.endsWith("InDiffLeft"))&&(Me=s.window.activeTextEditor);const De=ye[0];return De!=null&&Array.isArray(De)&&De.length!==0&&De[0]instanceof s.Uri?[{command:ce,type:"uris",editor:Me,uri:et,uris:De},ye.slice(1)]:[{command:ce,type:"uri",editor:Me,uri:et},ye]}Ae=Ae.slice(1)}else Me==null&&(Me=s.window.activeTextEditor);if(Ye instanceof w.Re){const[et,...ye]=Ae;return[{command:ce,type:"viewItem",node:et,uri:et.uri},ye]}if(j(Ye)){const et=[];let ye=0;for(const De of Ae){if(!j(De))break;ye++,et.push(De)}return[{command:ce,type:"scm-states",scmResourceStates:et,uri:et[0].resourceUri},Ae.slice(ye)]}if(H(Ye)){const et=[];let ye=0;for(const De of Ae){if(!H(De))break;ye++,et.push(De)}return[{command:ce,type:"scm-groups",scmResourceGroups:et},Ae.slice(ye)]}if(de(Ye)){const[et,ye,...De]=Ae;return[{command:ce,type:"timeline-item:git",item:et,uri:ye},De]}return[{command:ce,type:"unknown",editor:Me,uri:Me?.document.uri},Ae]}}o(Q,"Command");class ee extends Q{constructor(ce){super(ce);T(this,"contextParsingOptions",{expectsEditor:!0})}preExecute(ce,...ue){return this.execute(ce.editor,ce.uri,...ue)}_execute(ce,...ue){return super._execute(ce,void 0,...ue)}}o(ee,"ActiveEditorCommand");let We;function Pe(){return We}o(Pe,"getLastCommand");class Te extends ee{constructor(ce){super(ce)}_execute(ce,...ue){return We={command:ce,args:ue},super._execute(ce,...ue)}}o(Te,"ActiveEditorCachedCommand");class je{constructor(ce){T(this,"_disposable"),Array.isArray(ce)||(ce=[ce]);const ue=[];for(const Ae of ce)ue.push(s.commands.registerTextEditorCommand(Ae,(ut,Le,...Me)=>this.executeCore(Ae,ut,Le,...Me),this));this._disposable=s.Disposable.from(...ue)}dispose(){this._disposable.dispose()}executeCore(ce,ue,Ae,...ut){return this.execute(ue,Ae,...ut)}}o(je,"EditorCommand")},5387:(Re,ne,g)=>{"use strict";g.d(ne,{m:()=>x,u:()=>O});var s=g(9496),I=g.n(s),f=g(1045),w=g(7785),y=g(2324),b=g(2976),$=g(8690),L=g(7042),A=g(1161),v=g(320),T=Object.defineProperty,R=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable,_=o((E,B,G)=>B in E?T(E,B,{enumerable:!0,configurable:!0,writable:!0,value:G}):E[B]=G,"__defNormalProp"),C=o((E,B)=>{for(var G in B||(B={}))P.call(B,G)&&_(E,G,B[G]);if(R)for(var G of R(B))F.call(B,G)&&_(E,G,B[G]);return E},"__spreadValues"),k=o((E,B)=>{var G={};for(var U in E)P.call(E,U)&&B.indexOf(U)<0&&(G[U]=E[U]);if(E!=null&&R)for(var U of R(E))B.indexOf(U)<0&&F.call(E,U)&&(G[U]=E[U]);return G},"__objRest");async function x(E){await(0,A.P0)(f.Gh.GitCommands,E)}o(x,"executeGitCommand");function c(E){const B=typeof E=="string"?w.W.instance.git.getRepository(E):E;if(B==null)throw new Error("Repository not found");return B}o(c,"ensureRepo");var O;(E=>{async function B(Le,Me){await(0,A.b2)(f.Gh.BrowseRepoAtRevision,void 0,{uri:Le,before:Me?.before,openInNewWindow:Me?.openInNewWindow})}o(B,"browseAtRevision"),E.browseAtRevision=B;function G(Le,Me){return x({command:"cherry-pick",state:{repo:Le,references:Me}})}o(G,"cherryPick"),E.cherryPick=G;function U(Le,Me){return x({command:"fetch",state:{repos:Le,reference:Me}})}o(U,"fetch"),E.fetch=U;function H(Le,Me){return x({command:"merge",state:{repo:Le,reference:Me}})}o(H,"merge"),E.merge=H;function j(Le,Me){return x({command:"pull",state:{repos:Le,reference:Me}})}o(j,"pull"),E.pull=j;function q(Le,Me,Ye){return x({command:"push",state:{repos:Le,flags:Me?["--force"]:[],reference:Ye}})}o(q,"push"),E.push=q;function de(Le,Me,Ye=!0){return x({command:"rebase",state:{repo:Le,reference:Me,flags:Ye?["--interactive"]:[]}})}o(de,"rebase"),E.rebase=de;function Q(Le,Me,Ye){return x({command:"reset",confirm:Ye==null||Ye.includes("--hard"),state:{repo:Le,reference:Me,flags:Ye}})}o(Q,"reset"),E.reset=Q;function ee(Le,Me){return x({command:"revert",state:{repo:Le,references:Me}})}o(ee,"revert"),E.revert=ee;function We(Le,Me){return x({command:"switch",state:{repos:Le,reference:Me}})}o(We,"switchTo"),E.switchTo=We;let Pe;(Le=>{function Me(De,qe,at){return x({command:"branch",state:{subcommand:"create",repo:De,reference:qe,name:at}})}o(Me,"create"),Le.create=Me;function Ye(De,qe){return x({command:"branch",state:{subcommand:"delete",repo:De,references:qe}})}o(Ye,"remove"),Le.remove=Ye;function et(De,qe,at){return x({command:"branch",state:{subcommand:"rename",repo:De,reference:qe,name:at}})}o(et,"rename"),Le.rename=et;async function ye(De,qe){const at=De.remote?w.W.instance.remotesView:w.W.instance.branchesView;return at.canReveal?await at.revealBranch(De,qe):await w.W.instance.repositoriesView.revealBranch(De,qe)}o(ye,"reveal"),Le.reveal=ye})(Pe=E.Branch||(E.Branch={}));let Te;(Le=>{async function Me(Ie,nt,wt){await E.Commit.openFile(Ie,nt,{preserveFocus:!0,preview:!1}),await w.W.instance.git.applyChangesToWorkingFile(y.YY.fromFile(Ie,nt.repoPath,nt.ref),nt.ref,wt?.ref)}o(Me,"applyChanges"),Le.applyChanges=Me;async function Ye(Ie){await s.env.clipboard.writeText(Ie.ref)}o(Ye,"copyIdToClipboard"),Le.copyIdToClipboard=Ye;async function et(Ie){let nt;if(b.GitCommit.is(Ie))nt=Ie,nt.message==null&&await nt.ensureFullDetails();else if(nt=await w.W.instance.git.getCommit(Ie.repoPath,Ie.ref),nt==null)return;const wt=nt.message??nt.summary;await s.env.clipboard.writeText(wt)}o(et,"copyMessageToClipboard"),Le.copyMessageToClipboard=et;async function ye(Ie,nt,wt){let pt,ct;if(b.GitCommit.is(Ie)?(Ie.files==null&&await Ie.ensureFullDetails(),pt=Ie.files??[],ct={repoPath:Ie.repoPath,ref1:Ie.unresolvedPreviousSha,ref2:Ie.sha},wt=nt):(pt=Ie,ct=nt),pt.length>10){const $t=await s.window.showWarningMessage(`Are your sure you want to open the changes for all ${pt.length} files?`,{title:"Yes"},{title:"No",isCloseAffordance:!0});if($t==null||$t.title==="No")return}wt=C({preserveFocus:!0,preview:!1},wt);for(const $t of pt)await at($t,ct,wt)}o(ye,"openAllChanges"),Le.openAllChanges=ye;async function De(Ie,nt){let wt;if(b.GitCommit.is(Ie)?(Ie.files==null&&await Ie.ensureFullDetails(),wt=Ie.files??[],nt={repoPath:Ie.repoPath,ref:Ie.sha}):wt=Ie,wt.length>10){const pt=await s.window.showWarningMessage(`Are your sure you want to open the changes for all ${wt.length} files?`,{title:"Yes"},{title:"No",isCloseAffordance:!0});if(pt==null||pt.title==="No")return}for(const pt of wt)Ct(pt,nt)}o(De,"openAllChangesWithDiffTool"),Le.openAllChangesWithDiffTool=De;async function qe(Ie,nt,wt){let pt,ct;if(b.GitCommit.is(Ie)?(Ie.files==null&&await Ie.ensureFullDetails(),pt=Ie.files??[],ct={repoPath:Ie.repoPath,ref:Ie.sha},wt=nt):(pt=Ie,ct=nt),pt.length>10){const $t=await s.window.showWarningMessage(`Are your sure you want to open the changes for all ${pt.length} files?`,{title:"Yes"},{title:"No",isCloseAffordance:!0});if($t==null||$t.title==="No")return}wt=C({preserveFocus:!0,preview:!1},wt);for(const $t of pt)await fe($t,ct,wt)}o(qe,"openAllChangesWithWorking"),Le.openAllChangesWithWorking=qe;async function at(Ie,nt,wt){if(typeof Ie=="string"){if(!b.GitCommit.is(nt))throw new Error("Invalid arguments");const Gt=await nt.findFile(Ie);if(Gt==null)throw new Error("Invalid arguments");Ie=Gt}if(Ie.status==="A")return;const pt=b.GitCommit.is(nt)?{repoPath:nt.repoPath,ref1:nt.unresolvedPreviousSha,ref2:nt.sha}:nt;wt=C({preserveFocus:!0,preview:!1},wt);const ct=y.YY.fromFile(Ie,pt.repoPath),$t=Ie.status==="R"||Ie.status==="C"?y.YY.fromFile(Ie,pt.repoPath,pt.ref2,!0):ct;await(0,A.P0)(f.Gh.DiffWith,{repoPath:pt.repoPath,lhs:{uri:ct,sha:pt.ref1},rhs:{uri:$t,sha:pt.ref2},showOptions:wt})}o(at,"openChanges"),Le.openChanges=at;async function Ct(Ie,nt,wt){if(typeof Ie=="string"){if(!b.GitCommit.is(nt))throw new Error("Invalid arguments");const pt=await nt.findFile(Ie);if(pt==null)throw new Error("Invalid arguments");Ie=pt}return w.W.instance.git.openDiffTool(nt.repoPath,y.YY.fromFile(Ie,Ie.repoPath??nt.repoPath),{ref1:b.GitRevision.isUncommitted(nt.ref)?"":`${nt.ref}^`,ref2:b.GitRevision.isUncommitted(nt.ref)?"":nt.ref,staged:b.GitRevision.isUncommittedStaged(nt.ref)||Ie.indexStatus!=null,tool:wt})}o(Ct,"openChangesWithDiffTool"),Le.openChangesWithDiffTool=Ct;async function fe(Ie,nt,wt){if(typeof Ie=="string"){if(!b.GitCommit.is(nt))throw new Error("Invalid arguments");const ct=await nt.findFile(Ie);if(ct==null)throw new Error("Invalid arguments");Ie=ct}if(Ie.status==="D")return;let pt;b.GitCommit.is(nt)?pt={repoPath:nt.repoPath,ref:nt.sha}:pt=nt,wt=C({preserveFocus:!0,preview:!1},wt),await(0,A.b2)(f.Gh.DiffWithWorking,void 0,{uri:y.YY.fromFile(Ie,pt.repoPath,pt.ref),showOptions:wt})}o(fe,"openChangesWithWorking"),Le.openChangesWithWorking=fe;async function pe(Ie,nt,wt,pt){return w.W.instance.git.openDirectoryCompare(Ie,nt,wt,pt)}o(pe,"openDirectoryCompare"),Le.openDirectoryCompare=pe;async function ht(Ie){return pe(Ie.repoPath,Ie.ref,`${Ie.ref}^`)}o(ht,"openDirectoryCompareWithPrevious"),Le.openDirectoryCompareWithPrevious=ht;async function Z(Ie){return pe(Ie.repoPath,Ie.ref,void 0)}o(Z,"openDirectoryCompareWithWorking"),Le.openDirectoryCompareWithWorking=Z;async function Y(Ie,nt,wt){let pt;if(Ie instanceof s.Uri)pt=Ie,wt=nt;else{const ct=nt;pt=y.YY.fromFile(Ie,ct.repoPath,ct.ref)}wt=C({preserveFocus:!0,preview:!1},wt),await(0,A.b2)(f.Gh.OpenWorkingFile,void 0,{uri:pt,showOptions:wt})}o(Y,"openFile"),Le.openFile=Y;async function K(Ie,nt,wt){let pt;if(Ie instanceof s.Uri){if(b.GitCommit.is(nt))throw new Error("Invalid arguments");pt=Ie,wt=nt}else{if(!b.GitCommit.is(nt))throw new Error("Invalid arguments");const Pi=nt;let Lt;if(typeof Ie=="string"){const ti=await Pi.findFile(Ie);if(ti==null)throw new Error("Invalid arguments");Lt=ti}else Lt=Ie;pt=w.W.instance.git.getRevisionUri(Lt.status==="D"?await Pi.getPreviousSha()??b.GitRevision.deletedOrMissing:Pi.sha,Lt,Pi.repoPath)}const ct=C({preserveFocus:!0,preview:!1},wt),{annotationType:$t,line:Gt}=ct,Ai=k(ct,["annotationType","line"]);Gt!=null&&Gt!==0&&(Ai.selection=new s.Range(Gt,0,Gt,0));const Ti=await(0,v.GR)(pt,Ai);$t!=null&&Ti!=null&&await w.W.instance.fileAnnotations.show(Ti,$t,{selection:{line:Gt}})}o(K,"openFileAtRevision"),Le.openFileAtRevision=K;async function _e(Ie,nt,wt){let pt;if(b.GitCommit.is(Ie)?(Ie.files==null&&await Ie.ensureFullDetails(),pt=Ie.files??[],nt=Ie.repoPath,wt=Ie.sha):pt=Ie,pt.length>10){const $t=await s.window.showWarningMessage(`Are your sure you want to open all ${pt.length} files?`,{title:"Yes"},{title:"No",isCloseAffordance:!0});if($t==null||$t.title==="No")return}const ct=(await Promise.all(pt.map($t=>w.W.instance.git.getWorkingUri(nt,y.YY.fromFile($t,nt,wt))))).filter($t=>Boolean($t));(0,v.$_)(ct)}o(_e,"openFiles"),Le.openFiles=_e;async function ie(Ie,nt,wt,pt){let ct;if(b.GitCommit.is(Ie)?(Ie.files==null&&await Ie.ensureFullDetails(),ct=Ie.files??[],nt=Ie.repoPath,wt=Ie.sha,pt=await Ie.getPreviousSha()):ct=Ie,ct.length>10){const $t=await s.window.showWarningMessage(`Are your sure you want to open all ${ct.length} file revisions?`,{title:"Yes"},{title:"No",isCloseAffordance:!0});if($t==null||$t.title==="No")return}(0,v.$_)(ct.map($t=>w.W.instance.git.getRevisionUri($t.status==="D"?pt:wt,$t,nt)))}o(ie,"openFilesAtRevision"),Le.openFilesAtRevision=ie;async function Ne(Ie,nt){let wt,pt;typeof Ie=="string"?(wt=Ie,pt=nt.ref):(wt=Ie.path,pt=Ie.status==="D"?`${nt.ref}^`:nt.ref),await w.W.instance.git.checkout(nt.repoPath,pt,{path:wt})}o(Ne,"restoreFile"),Le.restoreFile=Ne;async function Ce(Ie,nt){const wt=[w.W.instance.commitsView,w.W.instance.branchesView,w.W.instance.remotesView];for(const pt of wt){const ct=pt.canReveal?await pt.revealCommit(Ie,nt):await w.W.instance.repositoriesView.revealCommit(Ie,nt);if(ct!=null)return ct}}o(Ce,"reveal"),Le.reveal=Ce})(Te=E.Commit||(E.Commit={}));let je;(Le=>{function Me(et,ye){return x({command:"co-authors",state:{repo:et,contributors:ye}})}o(Me,"addAuthors"),Le.addAuthors=Me;async function Ye(et,ye){const De=w.W.instance.contributorsView;return De.canReveal?await De.revealContributor(et,ye):await w.W.instance.repositoriesView.revealContributor(et,ye)}o(Ye,"reveal"),Le.reveal=Ye})(je=E.Contributor||(E.Contributor={}));let oe;(Le=>{async function Me(De){if(De==null&&(De=w.W.instance.git.highlander,De==null)){const Ct=await $.I.show(void 0,"Choose a repository to add a remote to");if(De=Ct?.item,De==null)return}const qe=await s.window.showInputBox({prompt:"Please provide a name for the remote",placeHolder:"Remote name",value:void 0,ignoreFocusOut:!0});if(qe==null||qe.length===0)return;const at=await s.window.showInputBox({prompt:"Please provide the repository url for the remote",placeHolder:"Remote repository url",value:void 0,ignoreFocusOut:!0});if(!(at==null||at.length===0))return De=c(De),await w.W.instance.git.addRemote(De.path,qe,at),await De.fetch({remote:qe}),qe}o(Me,"add"),Le.add=Me;async function Ye(De,qe){if(typeof De=="string"){const at=w.W.instance.git.getRepository(De);if(at==null)return;De=at}await De.fetch({remote:qe})}o(Ye,"fetch2"),Le.fetch=Ye;async function et(De,qe){await w.W.instance.git.pruneRemote(typeof De=="string"?De:De.path,qe)}o(et,"prune"),Le.prune=et;async function ye(De,qe){const at=w.W.instance.remotesView;return at.canReveal?await at.revealRemote(De,qe):await w.W.instance.repositoriesView.revealRemote(De,qe)}o(ye,"reveal"),Le.reveal=ye})(oe=E.Remote||(E.Remote={}));let ce;(Le=>{async function Me(Ye,et,ye){return et?.canReveal?await et.revealRepository(Ye,ye):await w.W.instance.repositoriesView.revealRepository(Ye,ye)}o(Me,"reveal"),Le.reveal=Me})(ce=E.Repository||(E.Repository={}));let ue;(Le=>{function Me(qe,at){return x({command:"stash",state:{subcommand:"apply",repo:qe,reference:at}})}o(Me,"apply"),Le.apply=Me;function Ye(qe,at){return x({command:"stash",state:{subcommand:"drop",repo:qe,reference:at}})}o(Ye,"drop"),Le.drop=Ye;function et(qe,at){return x({command:"stash",state:{subcommand:"pop",repo:qe,reference:at}})}o(et,"pop"),Le.pop=et;function ye(qe,at,Ct,fe=!1){return x({command:"stash",state:{subcommand:"push",repo:qe,uris:at,message:Ct,flags:fe?["--keep-index"]:void 0}})}o(ye,"push2"),Le.push=ye;async function De(qe,at){const Ct=w.W.instance.stashesView;return Ct.canReveal?await Ct.revealStash(qe,at):await w.W.instance.repositoriesView.revealStash(qe,at)}o(De,"reveal"),Le.reveal=De})(ue=E.Stash||(E.Stash={}));let Ae;(Le=>{function Me(ye,De,qe){return x({command:"tag",state:{subcommand:"create",repo:ye,reference:De,name:qe}})}o(Me,"create"),Le.create=Me;function Ye(ye,De){return x({command:"tag",state:{subcommand:"delete",repo:ye,references:De}})}o(Ye,"remove"),Le.remove=Ye;async function et(ye,De){const qe=w.W.instance.tagsView;return qe.canReveal?await qe.revealTag(ye,De):await w.W.instance.repositoriesView.revealTag(ye,De)}o(et,"reveal"),Le.reveal=et})(Ae=E.Tag||(E.Tag={}));let ut;(Le=>{function Me(qe,at,Ct){return x({command:"worktree",state:{subcommand:"create",repo:qe,uri:at,reference:Ct}})}o(Me,"create"),Le.create=Me;function Ye(qe,at){return(0,v.ic)(qe.uri,at)}o(Ye,"open"),Le.open=Ye;function et(qe,at){return x({command:"worktree",state:{subcommand:"delete",repo:qe,uris:(0,L.zx)(at)}})}o(et,"remove"),Le.remove=et;async function ye(qe,at){const Ct=w.W.instance.worktreesView;return Ct.canReveal?await Ct.revealWorktree(qe,at):await w.W.instance.repositoriesView.revealWorktree(qe,at)}o(ye,"reveal"),Le.reveal=ye;async function De(qe){await(0,A.dO)(f.nA.RevealInFileExplorer,qe.uri)}o(De,"revealInFileExplorer"),Le.revealInFileExplorer=De})(ut=E.Worktree||(E.Worktree={}))})(O||(O={}))},1265:(Re,ne,g)=>{"use strict";g.d(ne,{K:()=>nn,I:()=>Pn});var s=g(2078),I=g(1045),f=g(313),w=g(6410),y=g(9496),b=g(2976),$=Object.defineProperty,L=Object.defineProperties,A=Object.getOwnPropertyDescriptors,v=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable,P=o((se,a,S)=>a in se?$(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"__defNormalProp"),F=o((se,a)=>{for(var S in a||(a={}))T.call(a,S)&&P(se,S,a[S]);if(v)for(var S of v(a))R.call(a,S)&&P(se,S,a[S]);return se},"__spreadValues"),_=o((se,a)=>L(se,A(a)),"__spreadProps"),C;(se=>{function a(S,re,me,he){return _(F({},me),{item:re,picked:k(S,re),context:he})}o(a,"create"),se.create=a})(C||(C={}));function k(se,a){return a===void 0?se.length===0:Array.isArray(a)?a.length===0?se.length===0:a.every(S=>se.includes(S)):se.includes(a)}o(k,"hasFlags");var x=g(3430),c=g(3222),O=Object.defineProperty,E=Object.getOwnPropertySymbols,B=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable,U=o((se,a,S)=>a in se?O(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"branch_defNormalProp"),H=o((se,a)=>{for(var S in a||(a={}))B.call(a,S)&&U(se,S,a[S]);if(E)for(var S of E(a))G.call(a,S)&&U(se,S,a[S]);return se},"branch_spreadValues"),j=o((se,a,S)=>(U(se,typeof a!="symbol"?a+"":a,S),S),"__publicField");function q(se){if(!(se.repo instanceof b.Repository&&se.subcommand==="create"))throw new Error("Missing repository")}o(q,"assertStateStepCreate");function de(se){if(!(se.repo instanceof b.Repository&&se.subcommand==="delete"))throw new Error("Missing repository")}o(de,"assertStateStepDelete");function Q(se){if(!(se.repo instanceof b.Repository&&se.subcommand==="rename"))throw new Error("Missing repository")}o(Q,"assertStateStepRename");function ee(se){if(!Array.isArray(se.references))throw new Error("Missing branches")}o(ee,"assertStateStepDeleteBranches");const We=new Map([["create","Create"],["delete","Delete"],["rename","Rename"]]);function Pe(se,a){return a==null?se:`${We.get(a)} ${se}`}o(Pe,"getTitle");class Te extends c.tR{constructor(a,S){super(a,"branch","branch","Branch",{description:"create, rename, or delete branches"});j(this,"subcommand");var re,me;let he=0;if(((re=S?.state)==null?void 0:re.subcommand)!=null)switch(he++,S?.state.subcommand){case"create":S.state.reference!=null&&he++,S.state.name!=null&&he++;break;case"delete":S.state.references!=null&&(!Array.isArray(S.state.references)||S.state.references.length!==0)&&he++;break;case"rename":S.state.reference!=null&&he++,S.state.name!=null&&he++;break}((me=S?.state)==null?void 0:me.repo)!=null&&he++,this.initialState=H({counter:he,confirm:S?.confirm},S?.state)}get canConfirm(){return this.subcommand!=null}get canSkipConfirm(){return this.subcommand==="delete"||this.subcommand==="rename"?!1:super.canSkipConfirm}get skipConfirmKey(){return`${this.key}${this.subcommand==null?"":`-${this.subcommand}`}:${this.pickedVia}`}async*steps(a){const S={associatedView:this.container.branchesView,repos:this.container.git.openRepositories,showTags:!1,title:this.title};let re=!1;for(;this.canStepsContinue(a);){if(S.title=this.title,a.counter<1||a.subcommand==null){this.subcommand=void 0;const me=yield*this.pickSubcommandStep(a);if(me===c.oo.Break)break;a.subcommand=me}if(this.subcommand=a.subcommand,S.title=Pe(a.subcommand==="delete"?"Branches":this.title,a.subcommand),a.counter<2||a.repo==null||typeof a.repo=="string")if(re=!1,S.repos.length===1)re=!0,a.counter++,a.repo=S.repos[0];else{const me=yield*(0,c.lA)(a,S);if(me===c.oo.Break)continue;a.repo=me}switch(a.subcommand){case"create":q(a),yield*this.createCommandSteps(a,S),a.name=void 0;break;case"delete":de(a),yield*this.deleteCommandSteps(a,S);break;case"rename":Q(a),yield*this.renameCommandSteps(a,S),a.name=void 0;break;default:c.tR.endSteps(a);break}re&&a.counter--}return a.counter<0?c.oo.Break:void 0}*pickSubcommandStep(a){const S=c.tR.createPickStep({title:this.title,placeholder:`Choose a ${this.label} command`,items:[{label:"create",description:"creates a new branch",picked:a.subcommand==="create",item:"create"},{label:"delete",description:"deletes the specified branches",picked:a.subcommand==="delete",item:"delete"},{label:"rename",description:"renames the specified branch",picked:a.subcommand==="rename",item:"rename"}],buttons:[y.QuickInputButtons.Back]}),re=yield S;return c.tR.canPickStepContinue(S,a,re)?re[0].item:c.oo.Break}async*createCommandSteps(a,S){var re,me;for(a.flags==null&&(a.flags=[]);this.canStepsContinue(a);){if(a.counter<3||a.reference==null){const he=yield*(0,c.Yv)(a,S,{placeholder:Qe=>`Choose a branch${Qe.showTags?" or tag":""} to create the new branch from`,picked:((re=a.reference)==null?void 0:re.ref)??((me=await a.repo.getBranch())==null?void 0:me.ref),titleContext:" from",value:b.GitReference.isRevision(a.reference)?a.reference.ref:void 0});if(he===c.oo.Break)break;a.reference=he}if(a.counter<4||a.name==null){const he=yield*(0,c.f6)(a,S,{placeholder:"Please provide a name for the new branch",titleContext:` from ${b.GitReference.toString(a.reference,{capitalize:!0,icon:!1,label:a.reference.refType!=="branch"})}`,value:a.name??b.GitReference.getNameWithoutRemote(a.reference)});if(he===c.oo.Break)continue;a.name=he}if(this.confirm(a.confirm)){const he=yield*this.createCommandConfirmStep(a,S);if(he===c.oo.Break)continue;a.flags=he}c.tR.endSteps(a),a.flags.includes("--switch")?await a.repo.switch(a.reference.ref,{createBranch:a.name}):a.repo.branch(...a.flags,a.name,a.reference.ref)}}*createCommandConfirmStep(a,S){const re=c.tR.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[C.create(a.flags,[],{label:S.title,detail:`Will create a new branch named ${a.name} from ${b.GitReference.toString(a.reference)}`}),C.create(a.flags,["--switch"],{label:`${S.title} and Switch`,description:"--switch",detail:`Will create and switch to a new branch named ${a.name} from ${b.GitReference.toString(a.reference)}`})],S),me=yield re;return c.tR.canPickStepContinue(re,a,me)?me[0].item:c.oo.Break}async*deleteCommandSteps(a,S){var re;for(a.flags==null&&(a.flags=[]);this.canStepsContinue(a);){if(a.references!=null&&!Array.isArray(a.references)&&(a.references=[a.references]),a.counter<3||a.references==null||Array.isArray(a.references)&&a.references.length===0){S.title=Pe("Branches",a.subcommand);const he=yield*(0,c.FO)(a,S,{filter:Qe=>!Qe.current,picked:(re=a.references)==null?void 0:re.map(Qe=>Qe.ref),placeholder:"Choose branches to delete",sort:{current:!1,missingUpstream:!0}});if(he===c.oo.Break)break;a.references=he}S.title=Pe((0,x._6)("Branch",a.references.length,{only:!0,plural:"Branches"}),a.subcommand),ee(a);const me=yield*this.deleteCommandConfirmStep(a,S);me!==c.oo.Break&&(a.flags=me,c.tR.endSteps(a),a.repo.branchDelete(a.references,{force:a.flags.includes("--force"),remote:a.flags.includes("--remotes")}))}}*deleteCommandConfirmStep(a,S){const re=[C.create(a.flags,[],{label:S.title,detail:`Will delete ${b.GitReference.toString(a.references)}`})];a.references.every(Qe=>Qe.remote)||(re.push(C.create(a.flags,["--force"],{label:`Force ${S.title}`,description:"--force",detail:`Will forcibly delete ${b.GitReference.toString(a.references)}`})),a.references.some(Qe=>Qe.upstream!=null)&&re.push(C.create(a.flags,["--remotes"],{label:`${S.title} & Remote${a.references.filter(Qe=>!Qe.remote).length>1?"s":""}`,description:"--remotes",detail:`Will delete ${b.GitReference.toString(a.references)} and any remote tracking branches`}),C.create(a.flags,["--force","--remotes"],{label:`Force ${S.title} & Remote${a.references.filter(Qe=>!Qe.remote).length>1?"s":""}`,description:"--force --remotes",detail:`Will forcibly delete ${b.GitReference.toString(a.references)} and any remote tracking branches`})));const me=c.tR.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),re,S),he=yield me;return c.tR.canPickStepContinue(me,a,he)?he[0].item:c.oo.Break}async*renameCommandSteps(a,S){var re;for(a.flags==null&&(a.flags=[]);this.canStepsContinue(a);){if(a.counter<3||a.reference==null){const he=yield*(0,c.sd)(a,S,{filter:Qe=>!Qe.remote,picked:(re=a.reference)==null?void 0:re.ref,placeholder:"Choose a branch to rename"});if(he===c.oo.Break)break;a.reference=he}if(a.counter<4||a.name==null){const he=yield*(0,c.f6)(a,S,{placeholder:`Please provide a new name for ${b.GitReference.toString(a.reference,{icon:!1})}`,titleContext:` ${b.GitReference.toString(a.reference,!1)}`,value:a.name??a.reference.name});if(he===c.oo.Break)continue;a.name=he}const me=yield*this.renameCommandConfirmStep(a,S);me!==c.oo.Break&&(a.flags=me,c.tR.endSteps(a),a.repo.branch(...a.flags,a.reference.ref,a.name))}}*renameCommandConfirmStep(a,S){const re=c.tR.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[C.create(a.flags,["-m"],{label:S.title,detail:`Will rename ${b.GitReference.toString(a.reference)} to ${a.name}`})],S),me=yield re;return c.tR.canPickStepContinue(re,a,me)?me[0].item:c.oo.Break}}o(Te,"BranchGitCommand");var je=Object.defineProperty,oe=Object.getOwnPropertySymbols,ce=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable,Ae=o((se,a,S)=>a in se?je(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"cherry_pick_defNormalProp"),ut=o((se,a)=>{for(var S in a||(a={}))ce.call(a,S)&&Ae(se,S,a[S]);if(oe)for(var S of oe(a))ue.call(a,S)&&Ae(se,S,a[S]);return se},"cherry_pick_spreadValues");class Le extends c.tR{constructor(a,S){super(a,"cherry-pick","cherry-pick","Cherry Pick",{description:"integrates changes from specified commits into the current branch"});var re,me;let he=0;((re=S?.state)==null?void 0:re.repo)!=null&&he++,((me=S?.state)==null?void 0:me.references)!=null&&(!Array.isArray(S.state.references)||S.state.references.length!==0)&&he++,this.initialState=ut({counter:he,confirm:!0},S?.state)}get canSkipConfirm(){return!1}execute(a){a.repo.cherryPick(...a.flags,...a.references.map(S=>S.ref).reverse())}isFuzzyMatch(a){return super.isFuzzyMatch(a)||a==="cherry"}async*steps(a){var S,re,me,he;const Qe={repos:this.container.git.openRepositories,associatedView:this.container.commitsView,cache:new Map,destination:void 0,selectedBranchOrTag:void 0,showTags:!0,title:this.title};a.flags==null&&(a.flags=[]),a.references!=null&&!Array.isArray(a.references)&&(a.references=[a.references]);let Mt=!1;for(;this.canStepsContinue(a);){if(Qe.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(Mt=!1,Qe.repos.length===1)Mt=!0,a.repo==null&&a.counter++,a.repo=Qe.repos[0];else{const it=yield*(0,c.lA)(a,Qe);if(it===c.oo.Break)break;a.repo=it}if(Qe.destination==null){const it=await a.repo.getBranch();if(it==null)break;Qe.destination=it}if(Qe.title=`${this.title} into ${b.GitReference.toString(Qe.destination,{icon:!1})}`,a.counter<2||a.references==null||a.references.length===0){const it=yield*(0,c.Yv)(a,Qe,{filter:{branches:Tt=>Tt.id!==Qe.destination.id},placeholder:Tt=>`Choose a branch${Tt.showTags?" or tag":""} to cherry-pick from`,picked:(S=Qe.selectedBranchOrTag)==null?void 0:S.ref,value:Qe.selectedBranchOrTag==null?(me=(re=a.references)==null?void 0:re[0])==null?void 0:me.ref:void 0});if(it===c.oo.Break){Mt&&a.counter--;continue}b.GitReference.isRevision(it)?(a.references=[it],Qe.selectedBranchOrTag=void 0):Qe.selectedBranchOrTag=it}if(a.counter<3&&Qe.selectedBranchOrTag!=null){const it=b.GitRevision.createRange(Qe.destination.ref,Qe.selectedBranchOrTag.ref);let Tt=Qe.cache.get(it);Tt==null&&(Tt=this.container.git.getLog(a.repo.path,{ref:it,merges:!1}),Qe.cache.set(it,Tt));const ai=yield*(0,c.Rj)(a,Qe,{log:await Tt,onDidLoadMore:bi=>Qe.cache.set(it,Promise.resolve(bi)),picked:(he=a.references)==null?void 0:he.map(bi=>bi.ref),placeholder:(bi,sr)=>sr==null?`No pickable commits found on ${b.GitReference.toString(bi.selectedBranchOrTag,{icon:!1})}`:`Choose commits to cherry-pick into ${b.GitReference.toString(bi.destination,{icon:!1})}`});if(ai===c.oo.Break)continue;a.references=ai}if(this.confirm(a.confirm)){const it=yield*this.confirmStep(a,Qe);if(it===c.oo.Break)continue;a.flags=it}c.tR.endSteps(a),this.execute(a)}return a.counter<0?c.oo.Break:void 0}*confirmStep(a,S){const re=c.tR.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[C.create(a.flags,[],{label:this.title,detail:`Will apply ${b.GitReference.toString(a.references)} to ${b.GitReference.toString(S.destination)}`}),C.create(a.flags,["--edit"],{label:`${this.title} & Edit`,description:"--edit",detail:`Will edit and apply ${b.GitReference.toString(a.references)} to ${b.GitReference.toString(S.destination)}`}),C.create(a.flags,["--no-commit"],{label:`${this.title} without Committing`,description:"--no-commit",detail:`Will apply ${b.GitReference.toString(a.references)} to ${b.GitReference.toString(S.destination)} without Committing`})],S),me=yield re;return c.tR.canPickStepContinue(re,a,me)?me[0].item:c.oo.Break}}o(Le,"CherryPickGitCommand");var Me=g(1161),Ye=g(516),et=Object.defineProperty,ye=Object.getOwnPropertySymbols,De=Object.prototype.hasOwnProperty,qe=Object.prototype.propertyIsEnumerable,at=o((se,a,S)=>a in se?et(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"coauthors_defNormalProp"),Ct=o((se,a)=>{for(var S in a||(a={}))De.call(a,S)&&at(se,S,a[S]);if(ye)for(var S of ye(a))qe.call(a,S)&&at(se,S,a[S]);return se},"coauthors_spreadValues");class fe extends c.tR{constructor(a,S){super(a,"co-authors","co-authors","Add Co-Authors",{description:"adds co-authors to a commit message"});var re,me;let he=0;((re=S?.state)==null?void 0:re.repo)!=null&&he++,((me=S?.state)==null?void 0:me.contributors)!=null&&(!Array.isArray(S.state.contributors)||S.state.contributors.length!==0)&&he++,this.initialState=Ct({counter:he,confirm:!1},S?.state)}get canConfirm(){return!1}async execute(a){const S=await this.container.git.getOrOpenScmRepository(a.repo.path);if(S==null)return;let re=S.inputBox.value;const me=re.indexOf("Co-authored-by: ");me!==-1&&(re=re.substring(0,me-1).trimRight()),a.contributors!=null&&!Array.isArray(a.contributors)&&(a.contributors=[a.contributors]);for(const he of a.contributors){let Qe;re.includes("Co-authored-by: ")?Qe=` `:re.length!==0&&re.endsWith(` `)?Qe=` `:Qe=` `,re+=`${Qe}Co-authored-by: ${he.getCoauthor()}`}S.inputBox.value=re,await(0,Me.dO)(I.nA.ShowSCM)}async*steps(a){const S={repos:this.container.git.openRepositories,activeRepo:void 0,associatedView:this.container.contributorsView,title:this.title},re=await this.container.git.getOpenScmRepositories();re.length&&(S.repos=S.repos.filter(he=>re.find(Qe=>(0,Ye.AH)(Qe.rootUri.fsPath)===he.path)),S.activeRepo=await this.container.git.getOrOpenRepositoryForEditor(),S.activeRepo!=null&&!re.some(he=>he.rootUri.fsPath===S.activeRepo.path)&&(S.activeRepo=void 0));let me=!1;for(;this.canStepsContinue(a);){if(S.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(me=!1,S.repos.length===1)me=!0,a.repo==null&&a.counter++,a.repo=S.repos[0];else{const he=yield*(0,c.lA)(a,S);if(he===c.oo.Break)break;a.repo=he}if(a.counter<2||a.contributors==null){const he=yield*(0,c.bR)(a,S,"Choose contributors to add as co-authors");if(he===c.oo.Break){me&&a.counter--;continue}a.contributors=he}c.tR.endSteps(a),this.execute(a)}return a.counter<0?c.oo.Break:void 0}}o(fe,"CoAuthorsGitCommand");var pe=g(7042),ht=g(6277),Z=Object.defineProperty,Y=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,ie=o((se,a,S)=>a in se?Z(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"fetch_defNormalProp"),Ne=o((se,a)=>{for(var S in a||(a={}))K.call(a,S)&&ie(se,S,a[S]);if(Y)for(var S of Y(a))_e.call(a,S)&&ie(se,S,a[S]);return se},"fetch_spreadValues");class Ce extends c.tR{constructor(a,S){super(a,"fetch","fetch","Fetch",{description:"fetches changes from one or more remotes"});var re;let me=0;((re=S?.state)==null?void 0:re.repos)!=null&&(!Array.isArray(S.state.repos)||S.state.repos.length!==0)&&me++,this.initialState=Ne({counter:me,confirm:S?.confirm},S?.state)}execute(a){return b.GitReference.isBranch(a.reference)?a.repos[0].fetch({branch:a.reference}):this.container.git.fetchAll(a.repos,{all:a.flags.includes("--all"),prune:a.flags.includes("--prune")})}async*steps(a){const S={repos:this.container.git.openRepositories,associatedView:this.container.commitsView,title:this.title};a.flags==null&&(a.flags=[]),a.repos!=null&&!Array.isArray(a.repos)&&(a.repos=[a.repos]);let re=!1;for(;this.canStepsContinue(a);){if(S.title=this.title,a.counter<1||a.repos==null||a.repos.length===0||(0,pe.GI)(a.repos))if(re=!1,S.repos.length===1)re=!0,a.counter++,a.repos=[S.repos[0]];else{const me=yield*(0,c.j8)(a,S,{skipIfPossible:a.counter>=1});if(me===c.oo.Break)break;a.repos=me}if(this.confirm(a.confirm)){const me=yield*this.confirmStep(a,S);if(me===c.oo.Break){re&&a.counter--;continue}a.flags=me}c.tR.endSteps(a),this.execute(a)}return a.counter<0?c.oo.Break:void 0}async*confirmStep(a,S){let re="";if(a.repos.length===1){const Qe=await a.repos[0].getLastFetched();Qe!==0&&(re=`${(0,x.vk)(I.NE.Dot,2,2)}Last fetched ${(0,ht.Zh)(new Date(Qe))}`)}let me;if(a.repos.length===1&&b.GitReference.isBranch(a.reference))me=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S,re),[C.create(a.flags,[],{label:this.title,detail:`Will fetch ${b.GitReference.toString(a.reference)}`})]);else{const Qe=a.repos.length===1?`$(repo) ${a.repos[0].formattedName}`:`${a.repos.length} repositories`;me=c.tR.createConfirmStep((0,c.C8)(`Confirm ${this.title}`,a,S,re),[C.create(a.flags,[],{label:this.title,detail:`Will fetch ${Qe}`}),C.create(a.flags,["--prune"],{label:`${this.title} & Prune`,description:"--prune",detail:`Will fetch and prune ${Qe}`}),C.create(a.flags,["--all"],{label:`${this.title} All`,description:"--all",detail:`Will fetch all remotes of ${Qe}`}),C.create(a.flags,["--all","--prune"],{label:`${this.title} All & Prune`,description:"--all --prune",detail:`Will fetch and prune all remotes of ${Qe}`})],S)}const he=yield me;return c.tR.canPickStepContinue(me,a,he)?he[0].item:c.oo.Break}}o(Ce,"FetchGitCommand");var Ie=g(1677),nt=Object.defineProperty,wt=Object.getOwnPropertySymbols,pt=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable,$t=o((se,a,S)=>a in se?nt(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"log_defNormalProp"),Gt=o((se,a)=>{for(var S in a||(a={}))pt.call(a,S)&&$t(se,S,a[S]);if(wt)for(var S of wt(a))ct.call(a,S)&&$t(se,S,a[S]);return se},"log_spreadValues");function Ai(se){if(!(se.repo instanceof b.Repository))throw new Error("Missing repository")}o(Ai,"assertStateStepRepository");class Ti extends c.tR{constructor(a,S){super(a,"log","history","Commits",{description:"aka log, shows commit history"});var re,me;let he=0;((re=S?.state)==null?void 0:re.repo)!=null&&he++,((me=S?.state)==null?void 0:me.reference)!=null&&(he++,S.state.reference!=="HEAD"&&b.GitReference.isRevision(S.state.reference)&&!b.GitReference.isRevisionRange(S.state.reference)&&he++),this.initialState=Gt({counter:he,confirm:!1},S?.state)}get canConfirm(){return!1}isFuzzyMatch(a){return super.isFuzzyMatch(a)||a==="log"}async*steps(a){var S,re,me;const he={repos:this.container.git.openRepositories,associatedView:this.container.commitsView,cache:new Map,selectedBranchOrTag:void 0,title:this.title};let Qe=!1;for(;this.canStepsContinue(a);){if(he.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(Qe=!1,he.repos.length===1)Qe=!0,a.repo==null&&a.counter++,a.repo=he.repos[0];else{const it=yield*(0,c.lA)(a,he);if(it===c.oo.Break)break;a.repo=it}if(Ai(a),a.reference==="HEAD"){const it=await a.repo.getBranch();a.reference=it}if(a.counter<2||a.reference==null){const it=yield*(0,c.Yv)(a,he,{placeholder:"Choose a branch or tag to show its commit history",picked:(S=he.selectedBranchOrTag)==null?void 0:S.ref,value:he.selectedBranchOrTag==null?(re=a.reference)==null?void 0:re.ref:void 0,ranges:!0});if(it===c.oo.Break){Qe&&a.counter--;continue}a.reference=it,he.selectedBranchOrTag=void 0}if((!b.GitReference.isRevision(a.reference)||b.GitReference.isRevisionRange(a.reference))&&(he.selectedBranchOrTag=a.reference),he.title=`${this.title}${(0,x.vk)(I.NE.Dot,2,2)}${b.GitReference.toString(he.selectedBranchOrTag,{icon:!1})}`,a.fileName&&(he.title+=`${(0,x.vk)(I.NE.Dot,2,2)}${(0,Ie.d)(a.fileName,{fileOnly:!0,truncateTo:I.d$-he.title.length-3})}`),a.counter<3&&he.selectedBranchOrTag!=null){const it=he.selectedBranchOrTag.ref;let Tt=he.cache.get(it);Tt==null&&(Tt=a.fileName!=null?this.container.git.getLogForFile(a.repo.path,a.fileName,{ref:it}):this.container.git.getLog(a.repo.path,{ref:it}),he.cache.set(it,Tt));const ai=yield*(0,c.s4)(a,he,{ignoreFocusOut:!0,log:await Tt,onDidLoadMore:bi=>he.cache.set(it,Promise.resolve(bi)),placeholder:(bi,sr)=>sr==null?`No commits found in ${b.GitReference.toString(bi.selectedBranchOrTag,{icon:!1})}`:"Choose a commit",picked:(me=a.reference)==null?void 0:me.ref});if(ai===c.oo.Break)continue;a.reference=ai}(!(a.reference instanceof b.GitCommit)||a.reference.file!=null)&&(a.reference=await this.container.git.getCommit(a.repo.path,a.reference.ref));const Mt=yield*Pn(this.container,{command:"show",state:{repo:a.repo,reference:a.reference,fileName:a.fileName}},this.pickedVia);a.counter--,Mt===c.oo.Break&&c.tR.endSteps(a)}return a.counter<0?c.oo.Break:void 0}}o(Ti,"LogGitCommand");var Pi=g(4761),Lt=Object.defineProperty,ti=Object.getOwnPropertySymbols,Ei=Object.prototype.hasOwnProperty,Hi=Object.prototype.propertyIsEnumerable,dr=o((se,a,S)=>a in se?Lt(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"merge_defNormalProp"),St=o((se,a)=>{for(var S in a||(a={}))Ei.call(a,S)&&dr(se,S,a[S]);if(ti)for(var S of ti(a))Hi.call(a,S)&&dr(se,S,a[S]);return se},"merge_spreadValues");class we extends c.tR{constructor(a,S){super(a,"merge","merge","Merge",{description:"integrates changes from a specified branch into the current branch"});var re,me;let he=0;((re=S?.state)==null?void 0:re.repo)!=null&&he++,((me=S?.state)==null?void 0:me.reference)!=null&&he++,this.initialState=St({counter:he,confirm:!0},S?.state)}get canSkipConfirm(){return!1}execute(a){return a.repo.merge(...a.flags,a.reference.ref)}async*steps(a){var S,re,me;const he={repos:this.container.git.openRepositories,associatedView:this.container.commitsView,cache:new Map,destination:void 0,pickCommit:!1,pickCommitForItem:!1,selectedBranchOrTag:void 0,showTags:!0,title:this.title};a.flags==null&&(a.flags=[]);let Qe=!1;for(;this.canStepsContinue(a);){if(he.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(Qe=!1,he.repos.length===1)Qe=!0,a.repo==null&&a.counter++,a.repo=he.repos[0];else{const it=yield*(0,c.lA)(a,he);if(it===c.oo.Break)break;a.repo=it}if(he.destination==null){const it=await a.repo.getBranch();if(it==null)break;he.destination=it}if(he.title=`${this.title} into ${b.GitReference.toString(he.destination,{icon:!1})}`,he.pickCommitForItem=!1,a.counter<2||a.reference==null){const it=new c.rO.PickCommitToggle(he.pickCommit,he,()=>{he.pickCommit=!he.pickCommit,it.on=he.pickCommit}),Tt=yield*(0,c.Yv)(a,he,{placeholder:ai=>`Choose a branch${ai.showTags?" or tag":""} to merge`,picked:(S=he.selectedBranchOrTag)==null?void 0:S.ref,value:he.selectedBranchOrTag==null?(re=a.reference)==null?void 0:re.ref:void 0,additionalButtons:[it]});if(Tt===c.oo.Break){Qe&&a.counter--;continue}a.reference=Tt,he.selectedBranchOrTag=void 0}if(b.GitReference.isRevision(a.reference)||(he.selectedBranchOrTag=a.reference),a.counter<3&&he.selectedBranchOrTag!=null&&(he.pickCommit||he.pickCommitForItem||a.reference.ref===he.destination.ref)){const it=he.selectedBranchOrTag.ref;let Tt=he.cache.get(it);Tt==null&&(Tt=this.container.git.getLog(a.repo.path,{ref:it,merges:!1}),he.cache.set(it,Tt));const ai=yield*(0,c.s4)(a,he,{ignoreFocusOut:!0,log:await Tt,onDidLoadMore:bi=>he.cache.set(it,Promise.resolve(bi)),placeholder:(bi,sr)=>sr==null?`No commits found on ${b.GitReference.toString(bi.selectedBranchOrTag,{icon:!1})}`:`Choose a commit to merge into ${b.GitReference.toString(bi.destination,{icon:!1})}`,picked:(me=a.reference)==null?void 0:me.ref});if(ai===c.oo.Break)continue;a.reference=ai}const Mt=yield*this.confirmStep(a,he);Mt!==c.oo.Break&&(a.flags=Mt,c.tR.endSteps(a),this.execute(a))}return a.counter<0?c.oo.Break:void 0}async*confirmStep(a,S){const re=await this.container.git.getAheadBehindCommitCount(a.repo.path,[b.GitRevision.createRange(S.destination.name,a.reference.name)]),me=re!=null?re.ahead+re.behind:0;if(me===0){const Mt=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[],Pi.x.create(Pi.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:`${b.GitReference.toString(S.destination,{capitalize:!0})} is up to date with ${b.GitReference.toString(a.reference)}`})),it=yield Mt;return c.tR.canPickStepContinue(Mt,a,it),c.oo.Break}const he=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[C.create(a.flags,[],{label:this.title,detail:`Will merge ${(0,x._6)("commit",me)} from ${b.GitReference.toString(a.reference)} into ${b.GitReference.toString(S.destination)}`}),C.create(a.flags,["--ff-only"],{label:`Fast-forward ${this.title}`,description:"--ff-only",detail:`Will fast-forward merge ${(0,x._6)("commit",me)} from ${b.GitReference.toString(a.reference)} into ${b.GitReference.toString(S.destination)}`}),C.create(a.flags,["--squash"],{label:`Squash ${this.title}`,description:"--squash",detail:`Will squash ${(0,x._6)("commit",me)} from ${b.GitReference.toString(a.reference)} into one when merging into ${b.GitReference.toString(S.destination)}`}),C.create(a.flags,["--no-ff"],{label:`${this.title} without Fast-Forwarding`,description:"--no-ff",detail:`Will create a merge commit when merging ${(0,x._6)("commit",me)} from ${b.GitReference.toString(a.reference)} into ${b.GitReference.toString(S.destination)}`}),C.create(a.flags,["--no-ff","--no-commit"],{label:`${this.title} without Fast-Forwarding or Committing`,description:"--no-ff --no-commit",detail:`Will merge ${(0,x._6)("commit",me)} from ${b.GitReference.toString(a.reference)} into ${b.GitReference.toString(S.destination)} without Committing`})]),Qe=yield he;return c.tR.canPickStepContinue(he,a,Qe)?Qe[0].item:c.oo.Break}}o(we,"MergeGitCommand");var Fe=Object.defineProperty,Je=Object.getOwnPropertySymbols,dt=Object.prototype.hasOwnProperty,ft=Object.prototype.propertyIsEnumerable,kt=o((se,a,S)=>a in se?Fe(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"pull_defNormalProp"),Rt=o((se,a)=>{for(var S in a||(a={}))dt.call(a,S)&&kt(se,S,a[S]);if(Je)for(var S of Je(a))ft.call(a,S)&&kt(se,S,a[S]);return se},"pull_spreadValues");class Dt extends c.tR{constructor(a,S){super(a,"pull","pull","Pull",{description:"fetches and integrates changes from a remote into the current branch"});var re;let me=0;((re=S?.state)==null?void 0:re.repos)!=null&&(!Array.isArray(S.state.repos)||S.state.repos.length!==0)&&me++,this.initialState=Rt({counter:me,confirm:S?.confirm},S?.state)}async execute(a){if(b.GitReference.isBranch(a.reference)&&(!b.GitBranch.is(a.reference)||!a.reference.current)){const S=await a.repos[0].getBranch();if(S?.name!==a.reference.name)return a.repos[0].fetch({branch:a.reference,pull:!0})}return this.container.git.pullAll(a.repos,{rebase:a.flags.includes("--rebase")})}async*steps(a){const S={repos:this.container.git.openRepositories,associatedView:this.container.commitsView,title:this.title};a.flags==null&&(a.flags=[]),a.repos!=null&&!Array.isArray(a.repos)&&(a.repos=[a.repos]);let re=!1;for(;this.canStepsContinue(a);){if(S.title=this.title,a.counter<1||a.repos==null||a.repos.length===0||(0,pe.GI)(a.repos))if(re=!1,S.repos.length===1)re=!0,a.counter++,a.repos=[S.repos[0]];else{const me=yield*(0,c.j8)(a,S,{skipIfPossible:a.counter>=1});if(me===c.oo.Break)break;a.repos=me}if(this.confirm(a.confirm)){const me=yield*this.confirmStep(a,S);if(me===c.oo.Break){re&&a.counter--;continue}a.flags=me}c.tR.endSteps(a),this.execute(a)}return a.counter<0?c.oo.Break:void 0}async*confirmStep(a,S){let re;if(a.repos.length>1)re=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[C.create(a.flags,[],{label:this.title,detail:`Will pull ${a.repos.length} repositories`}),C.create(a.flags,["--rebase"],{label:`${this.title} with Rebase`,description:"--rebase",detail:`Will pull ${a.repos.length} repositories by rebasing`})]);else if(b.GitReference.isBranch(a.reference))if(a.reference.remote)re=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[],Pi.x.create(Pi.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:"Cannot pull a remote branch"}));else{const[he]=a.repos,Qe=await he.getBranch(a.reference.name);Qe?.upstream==null?re=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[],Pi.x.create(Pi.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:"Cannot pull a branch until it has been published"})):re=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[C.create(a.flags,[],{label:this.title,detail:`Will pull${Qe.state.behind?` ${(0,x._6)("commit",Qe.state.behind)} into ${b.GitReference.toString(Qe)}`:` into ${b.GitReference.toString(Qe)}`}`})])}else{const[he]=a.repos,[Qe,Mt]=await Promise.all([he.getStatus(),he.getLastFetched()]);let it="";Mt!==0&&(it=`${(0,x.vk)(I.NE.Dot,2,2)}Last fetched ${(0,ht.Zh)(new Date(Mt))}`);const Tt=Qe?.state.behind!=null?` ${(0,x._6)("commit",Qe.state.behind)} into $(repo) ${he.formattedName}`:` into $(repo) ${he.formattedName}`;re=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S,it),[C.create(a.flags,[],{label:this.title,detail:`Will pull${Tt}`}),C.create(a.flags,["--rebase"],{label:`${this.title} with Rebase`,description:"--rebase",detail:`Will pull and rebase${Tt}`})],void 0,{additionalButtons:[c.rO.Fetch],onDidClickButton:async(ai,bi)=>{if(bi!==c.rO.Fetch||ai.busy)return!1;ai.title=`Confirm ${S.title}${(0,x.vk)(I.NE.Dot,2,2)}Fetching${I.NE.Ellipsis}`,ai.busy=!0,ai.enabled=!1;try{return await he.fetch({progress:!0}),!0}finally{ai.busy=!1,ai.enabled=!0}}})}const me=yield re;return c.tR.canPickStepContinue(re,a,me)?me[0].item:c.oo.Break}}o(Dt,"PullGitCommand");var ri=g(9179),jt=Object.defineProperty,qt=Object.defineProperties,Ht=Object.getOwnPropertyDescriptors,vi=Object.getOwnPropertySymbols,ii=Object.prototype.hasOwnProperty,ar=Object.prototype.propertyIsEnumerable,Rr=o((se,a,S)=>a in se?jt(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"push_defNormalProp"),ze=o((se,a)=>{for(var S in a||(a={}))ii.call(a,S)&&Rr(se,S,a[S]);if(vi)for(var S of vi(a))ar.call(a,S)&&Rr(se,S,a[S]);return se},"push_spreadValues"),$e=o((se,a)=>qt(se,Ht(a)),"push_spreadProps");class ke extends c.tR{constructor(a,S){super(a,"push","push","Push",{description:"pushes changes from the current branch to a remote"});var re;let me=0;((re=S?.state)==null?void 0:re.repos)!=null&&(!Array.isArray(S.state.repos)||S.state.repos.length!==0)&&me++,this.initialState=ze({counter:me,confirm:S?.confirm},S?.state)}execute(a){const S=a.flags.indexOf("--set-upstream");return S!==-1?b.GitReference.isBranch(a.reference)?this.container.git.pushAll(a.repos,{force:!1,publish:{remote:a.flags[S+1]},reference:a.reference}):Promise.resolve():this.container.git.pushAll(a.repos,{force:a.flags.includes("--force"),reference:a.reference})}async*steps(a){const S={repos:this.container.git.openRepositories,associatedView:this.container.commitsView,title:this.title};a.flags==null&&(a.flags=[]),a.repos!=null&&!Array.isArray(a.repos)&&(a.repos=[a.repos]);let re=!1;for(;this.canStepsContinue(a);){if(S.title=this.title,a.counter<1||a.repos==null||a.repos.length===0||(0,pe.GI)(a.repos))if(re=!1,S.repos.length===1)re=!0,a.counter++,a.repos=[S.repos[0]];else if(a.reference!=null){const me=yield*(0,c.lA)($e(ze({},a),{repos:void 0,repo:a.reference.repoPath}),S);if(me===c.oo.Break)break;a.repos=[me]}else{const me=yield*(0,c.j8)(a,S,{skipIfPossible:a.counter>=1});if(me===c.oo.Break)break;a.repos=me}if(this.confirm(a.confirm)){const me=yield*this.confirmStep(a,S);if(me===c.oo.Break){re&&a.counter--;continue}a.flags=me}c.tR.endSteps(a),this.execute(a)}return a.counter<0?c.oo.Break:void 0}async*confirmStep(a,S){const re=ri.DN.getAny(I.eq.UseForcePushWithLease)??!1;let me;if(a.repos.length>1)me=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[C.create(a.flags,[],{label:this.title,detail:`Will push ${a.repos.length} repositories`}),C.create(a.flags,["--force"],{label:`Force ${this.title}${re?" (with lease)":""}`,description:`--force${re?"-with-lease":""}`,detail:`Will force push${re?" (with lease)":""} ${a.repos.length} repositories`})]);else{const[Qe]=a.repos,Mt=[];if(b.GitReference.isBranch(a.reference))if(a.reference.remote)me=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[],Pi.x.create(Pi.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:"Cannot push remote branch"}));else{const it=await Qe.getBranch(a.reference.name);if(it!=null&&it?.upstream==null){for(const Tt of await Qe.getRemotes())Mt.push(C.create(a.flags,["--set-upstream",Tt.name,it.name],{label:`Publish ${it.name} to ${Tt.name}`,detail:`Will publish ${b.GitReference.toString(it)} to ${Tt.name}`}));Mt.length?me=this.createConfirmStep((0,c.C8)("Confirm Publish",a,S),Mt,void 0,{placeholder:"Confirm Publish"}):me=this.createConfirmStep((0,c.C8)("Confirm Publish",a,S),[],Pi.x.create(Pi.X.Cancel,!0,{label:"Cancel Publish",detail:"Cannot publish; No remotes found"}),{placeholder:"Confirm Publish"})}else if(it!=null&&it?.state.behind>0){const Tt=await Qe.getBranch();me=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),it.id===Tt?.id?[C.create(a.flags,["--force"],{label:`Force ${this.title}${re?" (with lease)":""}`,description:`--force${re?"-with-lease":""}`,detail:`Will force push${re?" (with lease)":""} ${it?.state.ahead?` ${(0,x._6)("commit",it.state.ahead)}`:""}${it.getRemoteName()?` to ${it.getRemoteName()}`:""}${it!=null&&it.state.behind>0?`, overwriting ${(0,x._6)("commit",it.state.behind)}${it?.getRemoteName()?` on ${it.getRemoteName()}`:""}`:""}`})]:[],Pi.x.create(Pi.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:`Cannot push; ${b.GitReference.toString(it)} is behind ${it.getRemoteName()} by ${(0,x._6)("commit",it.state.behind)}`}))}else it!=null&&it?.state.ahead>0?me=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[C.create(a.flags,[it.getRemoteName()],{label:this.title,detail:`Will push ${(0,x._6)("commit",it.state.ahead)} from ${b.GitReference.toString(it)} to ${it.getRemoteName()}`})]):me=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[],Pi.x.create(Pi.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:"No commits found to push"}))}else{const it=await Qe.getStatus(),Tt={refType:"branch",name:it?.branch??"HEAD",ref:it?.branch??"HEAD",remote:!1,repoPath:Qe.path};if(it?.state.ahead===0){if(a.reference==null&&it.upstream==null){a.reference=Tt;for(const ai of await Qe.getRemotes())Mt.push(C.create(a.flags,["--set-upstream",ai.name,it.branch],{label:`Publish ${Tt.name} to ${ai.name}`,detail:`Will publish ${b.GitReference.toString(Tt)} to ${ai.name}`}))}Mt.length?me=this.createConfirmStep((0,c.C8)("Confirm Publish",a,S),Mt,void 0,{placeholder:"Confirm Publish"}):it.upstream==null?me=this.createConfirmStep((0,c.C8)("Confirm Publish",a,S),[],Pi.x.create(Pi.X.Cancel,!0,{label:"Cancel Publish",detail:"Cannot publish; No remotes found"}),{placeholder:"Confirm Publish"}):me=this.createConfirmStep((0,c.C8)("Confirm Push",a,S),[],Pi.x.create(Pi.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:`Cannot push; No commits ahead of ${b.GitBranch.getRemote(it.upstream)}`}))}else{let ai="";const bi=await Qe.getLastFetched();bi!==0&&(ai=`${(0,x.vk)(I.NE.Dot,2,2)}Last fetched ${(0,ht.Zh)(new Date(bi))}`);let sr;a.reference!=null?sr=`${it?.state.ahead?` commits up to and including ${b.GitReference.toString(a.reference,{label:!1})}`:""}${it?.upstream?` to ${b.GitBranch.getRemote(it.upstream)}`:""}`:sr=`${it?.state.ahead?` ${(0,x._6)("commit",it.state.ahead)}`:""}${it?.upstream?` to ${b.GitBranch.getRemote(it.upstream)}`:""}`,me=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S,ai),[...it?.state.behind?[]:[C.create(a.flags,[],{label:this.title,detail:`Will push${sr}`})],C.create(a.flags,["--force"],{label:`Force ${this.title}${re?" (with lease)":""}`,description:`--force${re?"-with-lease":""}`,detail:`Will force push${re?" (with lease)":""} ${sr}${it!=null&&it.state.behind>0?`, overwriting ${(0,x._6)("commit",it.state.behind)}${it?.upstream?` on ${b.GitBranch.getRemote(it.upstream)}`:""}`:""}`})],it?.state.behind?Pi.x.create(Pi.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:`Cannot push; ${b.GitReference.toString(Tt)} is behind${it?.upstream?` ${b.GitBranch.getRemote(it.upstream)}`:""} by ${(0,x._6)("commit",it.state.behind)}`}):void 0),me.additionalButtons=[c.rO.Fetch],me.onDidClickButton=async(on,co)=>{if(co!==c.rO.Fetch||on.busy)return!1;on.title=`Confirm ${S.title}${(0,x.vk)(I.NE.Dot,2,2)}Fetching${I.NE.Ellipsis}`,on.busy=!0,on.enabled=!1;try{return await Qe.fetch({progress:!0}),!0}finally{on.busy=!1,on.enabled=!0}}}}}const he=yield me;return c.tR.canPickStepContinue(me,a,he)?he[0].item:c.oo.Break}}o(ke,"PushGitCommand");var Ge=Object.defineProperty,Ke=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable,Xe=o((se,a,S)=>a in se?Ge(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"rebase_defNormalProp"),lt=o((se,a)=>{for(var S in a||(a={}))Oe.call(a,S)&&Xe(se,S,a[S]);if(Ke)for(var S of Ke(a))Se.call(a,S)&&Xe(se,S,a[S]);return se},"rebase_spreadValues");class gt extends c.tR{constructor(a,S){super(a,"rebase","rebase","Rebase",{description:"integrates changes from a specified branch into the current branch, by changing the base of the branch and reapplying the commits on top"});var re,me;let he=0;((re=S?.state)==null?void 0:re.repo)!=null&&he++,((me=S?.state)==null?void 0:me.reference)!=null&&he++,this.initialState=lt({counter:he,confirm:!0},S?.state)}get canSkipConfirm(){return!1}async execute(a){let S;if(a.flags.includes("--interactive")){await this.container.rebaseEditor.enableForNextUse();let re;switch(y.env.appName){case"Visual Studio Code - Insiders":re="code-insiders --wait --reuse-window";break;case"Visual Studio Code - Exploration":re="code-exploration --wait --reuse-window";break;case"VSCodium":re="codium --wait --reuse-window";break;default:re="code --wait --reuse-window";break}S=["-c",`sequence.editor="${re}"`]}return a.repo.rebase(S,...a.flags,a.reference.ref)}async*steps(a){var S,re,me;const he={repos:this.container.git.openRepositories,associatedView:this.container.commitsView,cache:new Map,destination:void 0,pickCommit:!1,pickCommitForItem:!1,selectedBranchOrTag:void 0,showTags:!0,title:this.title};a.flags==null&&(a.flags=[]);let Qe=!1;for(;this.canStepsContinue(a);){if(he.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(Qe=!1,he.repos.length===1)Qe=!0,a.repo==null&&a.counter++,a.repo=he.repos[0];else{const it=yield*(0,c.lA)(a,he);if(it===c.oo.Break)break;a.repo=it}if(he.destination==null){const it=await a.repo.getBranch();if(it==null)break;he.destination=it}if(he.title=`${this.title} ${b.GitReference.toString(he.destination,{icon:!1})}`,he.pickCommitForItem=!1,a.counter<2||a.reference==null){const it=new c.rO.PickCommitToggle(he.pickCommit,he,()=>{he.pickCommit=!he.pickCommit,it.on=he.pickCommit}),Tt=yield*(0,c.Yv)(a,he,{placeholder:ai=>`Choose a branch${ai.showTags?" or tag":""} to rebase`,picked:(S=he.selectedBranchOrTag)==null?void 0:S.ref,value:he.selectedBranchOrTag==null?(re=a.reference)==null?void 0:re.ref:void 0,additionalButtons:[it]});if(Tt===c.oo.Break){Qe&&a.counter--;continue}a.reference=Tt,he.selectedBranchOrTag=void 0}if(b.GitReference.isRevision(a.reference)||(he.selectedBranchOrTag=a.reference),a.counter<3&&he.selectedBranchOrTag!=null&&(he.pickCommit||he.pickCommitForItem||a.reference.ref===he.destination.ref)){const it=he.selectedBranchOrTag.ref;let Tt=he.cache.get(it);Tt==null&&(Tt=this.container.git.getLog(a.repo.path,{ref:it,merges:!1}),he.cache.set(it,Tt));const ai=yield*(0,c.s4)(a,he,{ignoreFocusOut:!0,log:await Tt,onDidLoadMore:bi=>he.cache.set(it,Promise.resolve(bi)),placeholder:(bi,sr)=>sr==null?`No commits found on ${b.GitReference.toString(bi.selectedBranchOrTag,{icon:!1})}`:`Choose a commit to rebase ${b.GitReference.toString(bi.destination,{icon:!1})} onto`,picked:(me=a.reference)==null?void 0:me.ref});if(ai===c.oo.Break)continue;a.reference=ai}const Mt=yield*this.confirmStep(a,he);Mt!==c.oo.Break&&(a.flags=Mt,c.tR.endSteps(a),this.execute(a))}return a.counter<0?c.oo.Break:void 0}async*confirmStep(a,S){const re=await this.container.git.getAheadBehindCommitCount(a.repo.path,[a.reference.refType==="revision"?b.GitRevision.createRange(a.reference.ref,S.destination.ref):b.GitRevision.createRange(S.destination.name,a.reference.name)]),me=re!=null?re.ahead+re.behind:0;if(me===0){const Mt=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[],Pi.x.create(Pi.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:`${b.GitReference.toString(S.destination,{capitalize:!0})} is up to date with ${b.GitReference.toString(a.reference)}`})),it=yield Mt;return c.tR.canPickStepContinue(Mt,a,it),c.oo.Break}const he=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[C.create(a.flags,[],{label:this.title,detail:`Will update ${b.GitReference.toString(S.destination)} by applying ${(0,x._6)("commit",me)} on top of ${b.GitReference.toString(a.reference)}`}),C.create(a.flags,["--interactive"],{label:`Interactive ${this.title}`,description:"--interactive",detail:`Will interactively update ${b.GitReference.toString(S.destination)} by applying ${(0,x._6)("commit",me)} on top of ${b.GitReference.toString(a.reference)}`})]),Qe=yield he;return c.tR.canPickStepContinue(he,a,Qe)?Qe[0].item:c.oo.Break}}o(gt,"RebaseGitCommand");var _t=Object.defineProperty,It=Object.getOwnPropertySymbols,Qt=Object.prototype.hasOwnProperty,ui=Object.prototype.propertyIsEnumerable,zt=o((se,a,S)=>a in se?_t(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"reset_defNormalProp"),di=o((se,a)=>{for(var S in a||(a={}))Qt.call(a,S)&&zt(se,S,a[S]);if(It)for(var S of It(a))ui.call(a,S)&&zt(se,S,a[S]);return se},"reset_spreadValues"),_i=o((se,a,S)=>(zt(se,typeof a!="symbol"?a+"":a,S),S),"reset_publicField");class Si extends c.tR{constructor(a,S){super(a,"reset","reset","Reset",{description:"resets the current branch to a specified commit"});_i(this,"_canSkipConfirm",!1);var re,me;let he=0;((re=S?.state)==null?void 0:re.repo)!=null&&he++,((me=S?.state)==null?void 0:me.reference)!=null&&he++,this.initialState=di({counter:he,confirm:S?.confirm??!0},S?.state),this._canSkipConfirm=!this.initialState.confirm}get canSkipConfirm(){return this._canSkipConfirm}execute(a){return a.repo.reset(...a.flags,a.reference.ref)}async*steps(a){var S;const re={repos:this.container.git.openRepositories,associatedView:this.container.commitsView,cache:new Map,destination:void 0,title:this.title};a.flags==null&&(a.flags=[]);let me=!1;for(;this.canStepsContinue(a);){if(re.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(me=!1,re.repos.length===1)me=!0,a.repo==null&&a.counter++,a.repo=re.repos[0];else{const he=yield*(0,c.lA)(a,re);if(he===c.oo.Break)break;a.repo=he}if(re.destination==null){const he=await a.repo.getBranch();if(he==null)break;re.destination=he}if(re.title=`${this.title} ${b.GitReference.toString(re.destination,{icon:!1})}`,a.counter<2||a.reference==null){const he=re.destination.ref;let Qe=re.cache.get(he);Qe==null&&(Qe=this.container.git.getLog(a.repo.path,{ref:he,merges:!1}),re.cache.set(he,Qe));const Mt=yield*(0,c.s4)(a,re,{log:await Qe,onDidLoadMore:it=>re.cache.set(he,Promise.resolve(it)),placeholder:(it,Tt)=>Tt==null?`${it.destination.name} has no commits`:`Choose a commit to reset ${it.destination.name} to`,picked:(S=a.reference)==null?void 0:S.ref});if(Mt===c.oo.Break){me&&a.counter--;continue}a.reference=Mt}if(this.confirm(a.confirm)){const he=yield*this.confirmStep(a,re);if(he===c.oo.Break)continue;a.flags=he}c.tR.endSteps(a),this.execute(a)}return a.counter<0?c.oo.Break:void 0}*confirmStep(a,S){const re=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[C.create(a.flags,[],{label:this.title,detail:`Will reset (leaves changes in the working tree) ${b.GitReference.toString(S.destination)} to ${b.GitReference.toString(a.reference)}`}),C.create(a.flags,["--soft"],{label:`Soft ${this.title}`,description:"--soft",detail:`Will soft reset (leaves changes in the index and working tree) ${b.GitReference.toString(S.destination)} to ${b.GitReference.toString(a.reference)}`}),C.create(a.flags,["--hard"],{label:`Hard ${this.title}`,description:"--hard",detail:`Will hard reset (discards all changes) ${b.GitReference.toString(S.destination)} to ${b.GitReference.toString(a.reference)}`})]),me=yield re;return c.tR.canPickStepContinue(re,a,me)?me[0].item:c.oo.Break}}o(Si,"ResetGitCommand");var zi=Object.defineProperty,Yi=Object.getOwnPropertySymbols,Ki=Object.prototype.hasOwnProperty,nr=Object.prototype.propertyIsEnumerable,ir=o((se,a,S)=>a in se?zi(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"revert_defNormalProp"),Zi=o((se,a)=>{for(var S in a||(a={}))Ki.call(a,S)&&ir(se,S,a[S]);if(Yi)for(var S of Yi(a))nr.call(a,S)&&ir(se,S,a[S]);return se},"revert_spreadValues");class Qi extends c.tR{constructor(a,S){super(a,"revert","revert","Revert",{description:"undoes the changes of specified commits, by creating new commits with inverted changes"});var re,me;let he=0;((re=S?.state)==null?void 0:re.repo)!=null&&he++,((me=S?.state)==null?void 0:me.references)!=null&&(!Array.isArray(S.state.references)||S.state.references.length!==0)&&he++,this.initialState=Zi({counter:he,confirm:!0},S?.state)}get canSkipConfirm(){return!1}execute(a){return a.repo.revert(...a.flags,...a.references.map(S=>S.ref).reverse())}async*steps(a){var S;const re={repos:this.container.git.openRepositories,associatedView:this.container.commitsView,cache:new Map,destination:void 0,title:this.title};a.flags==null&&(a.flags=[]),a.references!=null&&!Array.isArray(a.references)&&(a.references=[a.references]);let me=!1;for(;this.canStepsContinue(a);){if(re.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(me=!1,re.repos.length===1)me=!0,a.repo==null&&a.counter++,a.repo=re.repos[0];else{const Qe=yield*(0,c.lA)(a,re);if(Qe===c.oo.Break)break;a.repo=Qe}if(re.destination==null){const Qe=await a.repo.getBranch();if(Qe==null)break;re.destination=Qe}if(a.counter<2||a.references==null||a.references.length===0){const Qe=re.destination.ref;let Mt=re.cache.get(Qe);Mt==null&&(Mt=this.container.git.getLog(a.repo.path,{ref:Qe,merges:!1}),re.cache.set(Qe,Mt));const it=yield*(0,c.Rj)(a,re,{log:await Mt,onDidLoadMore:Tt=>re.cache.set(Qe,Promise.resolve(Tt)),placeholder:(Tt,ai)=>ai==null?`${Tt.destination.name} has no commits`:"Choose commits to revert",picked:(S=a.references)==null?void 0:S.map(Tt=>Tt.ref)});if(it===c.oo.Break){me&&a.counter--;continue}a.references=it}const he=yield*this.confirmStep(a,re);he!==c.oo.Break&&(a.flags=he,c.tR.endSteps(a),this.execute(a))}return a.counter<0?c.oo.Break:void 0}*confirmStep(a,S){const re=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[C.create(a.flags,["--no-edit"],{label:this.title,description:"--no-edit",detail:`Will revert ${b.GitReference.toString(a.references)}`}),C.create(a.flags,["--edit"],{label:`${this.title} & Edit`,description:"--edit",detail:`Will revert and edit ${b.GitReference.toString(a.references)}`})]),me=yield re;return c.tR.canPickStepContinue(re,a,me)?me[0].item:c.oo.Break}}o(Qi,"RevertGitCommand");var or=g(3969),fr=g(3708),Ii=g(3422),li=Object.defineProperty,te=Object.getOwnPropertySymbols,ve=Object.prototype.hasOwnProperty,Ze=Object.prototype.propertyIsEnumerable,ot=o((se,a,S)=>a in se?li(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"search_defNormalProp"),tt=o((se,a)=>{for(var S in a||(a={}))ve.call(a,S)&&ot(se,S,a[S]);if(te)for(var S of te(a))Ze.call(a,S)&&ot(se,S,a[S]);return se},"search_spreadValues");const bt=new Map([["","Search by Message"],["=:","Search by Message"],["message:","Search by Message"],["@:","Search by Author"],["author:","Search by Author"],["#:","Search by Commit SHA"],["commit:","Search by Commit SHA"],["?:","Search by File"],["file:","Search by File"],["~:","Search by Changes"],["change:","Search by Changes"]]);class Pt extends c.tR{constructor(a,S){super(a,"search","search","Commit Search",{description:"aka grep, searches for commits"});var re,me;let he=0;((re=S?.state)==null?void 0:re.repo)!=null&&he++,((me=S?.state)==null?void 0:me.pattern)!=null&&!S.prefillOnly&&he++,this.initialState=tt({counter:he,confirm:!1},S?.state)}get canConfirm(){return!1}isMatch(a){return super.isMatch(a)||a==="grep"}isFuzzyMatch(a){return super.isFuzzyMatch(a)||a==="grep"}async*steps(a){var S;const re={repos:this.container.git.openRepositories,associatedView:this.container.searchAndCompareView,commit:void 0,hasVirtualFolders:(0,f.f)(I.zf.HasVirtualFolders,!1),resultsKey:void 0,resultsPromise:void 0,title:this.title},me=this.container.config.gitCommands.search;a.matchAll==null&&(a.matchAll=me.matchAll),a.matchCase==null&&(a.matchCase=me.matchCase),a.matchRegex==null&&(a.matchRegex=me.matchRegex),a.showResultsInSideBar==null&&(a.showResultsInSideBar=me.showResultsInSideBar??void 0);let he=!1;for(;this.canStepsContinue(a);){if(re.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(he=!1,re.repos.length===1)he=!0,a.repo==null&&a.counter++,a.repo=re.repos[0];else{const Tt=yield*(0,c.lA)(a,re);if(Tt===c.oo.Break)break;a.repo=Tt}if(a.counter<2||a.pattern==null){const Tt=yield*this.pickSearchOperatorStep(a,re);if(Tt===c.oo.Break){he&&a.counter--,a.pattern=void 0;continue}a.pattern=Tt}const Qe={pattern:a.pattern,matchAll:a.matchAll,matchCase:a.matchCase,matchRegex:a.matchRegex},Mt=or.n.toKey(Qe);if((re.resultsPromise==null||re.resultsKey!==Mt)&&(re.resultsPromise=a.repo.searchForCommits(Qe),re.resultsKey=Mt),a.showResultsInSideBar){this.container.searchAndCompareView.search(a.repo.path,Qe,{label:{label:`for ${a.pattern}`}},re.resultsPromise,a.showResultsInSideBar instanceof Ii.V5?a.showResultsInSideBar:void 0);break}if(a.counter<3||re.commit==null){const Tt=a.repo.path,ai=yield*(0,c.s4)(a,re,{ignoreFocusOut:!0,log:await re.resultsPromise,onDidLoadMore:bi=>re.resultsPromise=Promise.resolve(bi),placeholder:(bi,sr)=>sr==null?`No results for ${a.pattern}`:`${(0,x._6)("result",sr.count,{format:on=>sr.hasMore?`${on}+`:void 0})} for ${a.pattern}`,picked:(S=re.commit)==null?void 0:S.ref,showInSideBarCommand:new fr.qv("$(link-external) Show Results in Side Bar",()=>void this.container.searchAndCompareView.search(Tt,Qe,{label:{label:`for ${a.pattern}`},reveal:{select:!0,focus:!1,expand:!0}},re.resultsPromise)),showInSideBarButton:{button:c.rO.ShowResultsInSideBar,onDidClick:()=>void this.container.searchAndCompareView.search(Tt,Qe,{label:{label:`for ${a.pattern}`},reveal:{select:!0,focus:!1,expand:!0}},re.resultsPromise)}});if(ai===c.oo.Break){a.counter--;continue}re.commit=ai}const it=yield*Pn(this.container,{command:"show",state:{repo:a.repo,reference:re.commit}},this.pickedVia);a.counter--,it===c.oo.Break&&c.tR.endSteps(a)}return a.counter<0?c.oo.Break:void 0}*pickSearchOperatorStep(a,S){const re=[{label:bt.get(""),description:`pattern or message: pattern or =: pattern ${I.NE.Dash} use quotes to search for phrases`,item:"message:"},{label:bt.get("author:"),description:"author: pattern or @: pattern",item:"author:"},{label:bt.get("commit:"),description:"commit: sha or #: sha",item:"commit:"},S.hasVirtualFolders?void 0:{label:bt.get("file:"),description:"file: glob or ?: glob",item:"file:"},S.hasVirtualFolders?void 0:{label:bt.get("change:"),description:"change: pattern or ~: pattern",item:"change:"}].filter(Tt=>Tt!=null),me=new c.rO.MatchCaseToggle(a.matchCase),he=new c.rO.MatchAllToggle(a.matchAll),Qe=new c.rO.MatchRegexToggle(a.matchRegex),Mt=c.tR.createPickStep({title:(0,c.C8)(S.title,a,S),placeholder:'e.g. "Updates dependencies" author:eamodio',matchOnDescription:!0,matchOnDetail:!0,additionalButtons:[me,he,Qe],items:re,value:a.pattern,onDidAccept:Tt=>{const ai=Tt.selectedItems[0];if(!or.W.has(ai.item))return!0;const bi=Tt.value.trim();return bi.length===0||or.W.has(bi)?Tt.value=ai.item:Tt.value=`${bi} ${ai.item}`,Mt.onDidChangeValue(Tt),!1},onDidClickButton:(Tt,ai)=>{ai===me?(a.matchCase=!a.matchCase,me.on=a.matchCase):ai===he?(a.matchAll=!a.matchAll,he.on=a.matchAll):ai===Qe&&(a.matchRegex=!a.matchRegex,Qe.on=a.matchRegex)},onDidChangeValue:Tt=>{const ai=Tt.value.trim();a.counter=ai?3:2;const bi=or.n.parseSearchOperations(ai);return Tt.title=(0,c.C8)(bi.size===0||bi.size>1?S.title:`Commit ${bt.get(bi.keys().next().value)}`,a,S),Tt.value.length===0?Tt.items=re:(Tt.ignoreFocusOut=!0,Mt.ignoreFocusOut=!0,Tt.items=[{label:"Search for",description:Tt.value,item:Tt.value}]),!0}}),it=yield Mt;return c.tR.canPickStepContinue(Mt,a,it)?(a.counter--,it[0].item.trim()):(a.counter--,c.oo.Break)}}o(Pt,"SearchGitCommand");var Ft=g(4338),ni=g(5355),oi=Object.defineProperty,Ut=Object.defineProperties,si=Object.getOwnPropertyDescriptors,Yt=Object.getOwnPropertySymbols,Zt=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable,Kt=o((se,a,S)=>a in se?oi(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"show_defNormalProp"),Wi=o((se,a)=>{for(var S in a||(a={}))Zt.call(a,S)&&Kt(se,S,a[S]);if(Yt)for(var S of Yt(a))Xt.call(a,S)&&Kt(se,S,a[S]);return se},"show_spreadValues"),Gi=o((se,a)=>Ut(se,si(a)),"show_spreadProps");function ji(se){if(!(se.repo instanceof b.Repository))throw new Error("Missing repository")}o(ji,"show_assertStateStepRepository");function rr(se){if(!b.GitCommit.is(se.reference))throw new Error("Missing reference")}o(rr,"assertsStateStepCommit");function Zr(se){if(!se.fileName)throw new Error("Missing filename")}o(Zr,"assertsStateStepFileName");class kn extends c.tR{constructor(a,S){super(a,"show","show","Show",{description:"shows information about a git reference"});var re,me,he;let Qe=0;((re=S?.state)==null?void 0:re.repo)!=null&&Qe++,((me=S?.state)==null?void 0:me.reference)!=null&&Qe++,((he=S?.state)==null?void 0:he.fileName)!=null&&(Qe+=2),this.initialState=Wi({counter:Qe,confirm:!1},S?.state)}get canConfirm(){return!1}getStepState(a){const S=super.getStepState(a);return Gi(Wi({},S),{startingStep:a?Math.min(S.startingStep??0,1):0})}async*steps(a){var S;const re={repos:this.container.git.openRepositories,associatedView:this.container.commitsView,title:this.title};let me=!1;for(;this.canStepsContinue(a);){if(re.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(me=!1,re.repos.length===1)me=!0,a.repo==null&&a.counter++,a.repo=re.repos[0];else{const Qe=yield*(0,c.lA)(a,re);if(Qe===c.oo.Break)break;a.repo=Qe}if(ji(a),(a.counter<2||a.reference==null||!b.GitCommit.is(a.reference)||a.reference.file!=null)&&(a.reference!=null&&!b.GitCommit.is(a.reference)&&(a.reference=await this.container.git.getCommit(a.reference.repoPath,a.reference.ref)),a.counter<2||a.reference==null)){const Qe=yield*(0,c.s4)(a,re,{log:{repoPath:a.repo.path,commits:new Map,sha:void 0,range:void 0,count:0,limit:void 0,hasMore:!1},placeholder:"Enter a reference or commit SHA",picked:(S=a.reference)==null?void 0:S.ref});if(Qe===c.oo.Break){me&&a.counter--;continue}a.reference=Qe}if(rr(a),a.counter<3){a.reference.files==null&&await a.reference.ensureFullDetails();const Qe=yield*(0,c.KT)(a,re);if(Qe===c.oo.Break)continue;if(Qe instanceof ni.Wv){const Mt=yield*Qe.executeSteps(this.pickedVia);a.counter--,Mt===c.oo.Break&&c.tR.endSteps(a);continue}if(Qe instanceof fr.$w&&!(Qe instanceof Ft.PF)){c.tR.endSteps(a),Qe.execute();break}}if(a.counter<4||a.fileName==null){const Qe=yield*(0,c.fD)(a,re,{picked:a.fileName});if(Qe===c.oo.Break)continue;if(Qe instanceof Ft.PF){a.counter-=2;continue}a.fileName=Qe.file.path}Zr(a);const he=yield*(0,c.nI)(a,re);if(he!==c.oo.Break){if(he instanceof Ft.PF){a.counter-=2;continue}if(he instanceof ni.Wv){yield*he.executeSteps(this.pickedVia),a.counter--;continue}if(he instanceof fr.$w){c.tR.endSteps(a),he.execute();break}}}return a.counter<0?c.oo.Break:void 0}}o(kn,"ShowGitCommand");var Dr=Object.defineProperty,Ui=o((se,a,S)=>a in se?Dr(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"errors_defNormalProp"),yi=o((se,a,S)=>(Ui(se,typeof a!="symbol"?a+"":a,S),S),"errors_publicField"),Fi=(se=>(se[se.WorkingChanges=1]="WorkingChanges",se))(Fi||{});class wr extends Error{constructor(a,S){var re;let me,he;a==null?me="Unable to apply stash":typeof a=="string"?(me=a,he=void 0):(he=a,me="Unable to apply stash. Your working tree changes would be overwritten. Please commit or stash your changes before trying again");super(me);yi(this,"original"),yi(this,"reason"),this.original=S,this.reason=he,(re=Error.captureStackTrace)==null||re.call(Error,this,wr)}static is(a,S){return a instanceof wr&&(S==null||a.reason===S)}}o(wr,"StashApplyError");var Ni=(se=>(se[se.AlreadyCheckedOut=1]="AlreadyCheckedOut",se[se.AlreadyExists=2]="AlreadyExists",se))(Ni||{});class Nr extends Error{constructor(a,S){var re;let me,he;if(a==null)me="Unable to create worktree";else if(typeof a=="string")me=a,he=void 0;else switch(he=a,he){case 1:me="Unable to create worktree because it is already checked out";break;case 2:me="Unable to create worktree because it already exists";break}super(me);yi(this,"original"),yi(this,"reason"),this.original=S,this.reason=he,(re=Error.captureStackTrace)==null||re.call(Error,this,Nr)}static is(a,S){return a instanceof Nr&&(S==null||a.reason===S)}}o(Nr,"WorktreeCreateError");var Wr=(se=>(se[se.HasChanges=1]="HasChanges",se[se.MainWorkingTree=2]="MainWorkingTree",se))(Wr||{});class gr extends Error{constructor(a,S){var re;let me,he;if(a==null)me="Unable to delete worktree";else if(typeof a=="string")me=a,he=void 0;else switch(he=a,he){case 1:me="Unable to delete worktree because there are uncommitted changes";break;case 2:me="Unable to delete worktree because it is a main working tree";break}super(me);yi(this,"original"),yi(this,"reason"),this.original=S,this.reason=he,(re=Error.captureStackTrace)==null||re.call(Error,this,gr)}static is(a,S){return a instanceof gr&&(S==null||a.reason===S)}}o(gr,"WorktreeDeleteError");var Xi=g(2436),Lr=g(1999),Mr=g(5387),Fr=Object.defineProperty,Gr=Object.getOwnPropertySymbols,Vr=Object.prototype.hasOwnProperty,hi=Object.prototype.propertyIsEnumerable,Xr=o((se,a,S)=>a in se?Fr(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"stash_defNormalProp"),ps=o((se,a)=>{for(var S in a||(a={}))Vr.call(a,S)&&Xr(se,S,a[S]);if(Gr)for(var S of Gr(a))hi.call(a,S)&&Xr(se,S,a[S]);return se},"stash_spreadValues"),Jr=o((se,a,S)=>(Xr(se,typeof a!="symbol"?a+"":a,S),S),"stash_publicField");const kr=new Map([["apply","Apply"],["drop","Drop"],["list","List"],["pop","Pop"],["push","Push"]]);function en(se,a){return a==null?se:`${kr.get(a)} ${se}`}o(en,"stash_getTitle");class tn extends c.tR{constructor(a,S){super(a,"stash","stash","Stash",{description:"shelves (stashes) local changes to be reapplied later"});Jr(this,"subcommand");var re,me;let he=0;if(((re=S?.state)==null?void 0:re.subcommand)!=null)switch(he++,S.state.subcommand){case"apply":case"drop":case"pop":S.state.reference!=null&&he++;break;case"push":S.state.message!=null&&he++;break}((me=S?.state)==null?void 0:me.repo)!=null&&he++,this.initialState=ps({counter:he,confirm:S?.confirm},S?.state)}get canConfirm(){return this.subcommand!=null&&this.subcommand!=="list"}get canSkipConfirm(){return this.subcommand==="drop"?!1:super.canSkipConfirm}get skipConfirmKey(){return`${this.key}${this.subcommand==null?"":`-${this.subcommand}`}:${this.pickedVia}`}async*steps(a){const S={repos:this.container.git.openRepositories,associatedView:this.container.stashesView,readonly:(0,f.f)(I.zf.Readonly,!1)||(0,f.f)(I.zf.Untrusted,!1)||(0,f.f)(I.zf.HasVirtualFolders,!1),title:this.title};let re=!1;for(;this.canStepsContinue(a);){if(S.title=this.title,S.readonly&&(a.subcommand="list"),a.counter<1||a.subcommand==null){this.subcommand=void 0;const me=yield*this.pickSubcommandStep(a);if(me===c.oo.Break)break;a.subcommand=me}if(this.subcommand=a.subcommand,S.title=en(this.title,a.subcommand),a.counter<2||a.repo==null||typeof a.repo=="string")if(re=!1,S.repos.length===1)re=!0,a.counter++,a.repo=S.repos[0];else{const me=yield*(0,c.lA)(a,S);if(me===c.oo.Break)continue;a.repo=me}switch(a.subcommand){case"apply":case"pop":yield*this.applyOrPopCommandSteps(a,S);break;case"drop":yield*this.dropCommandSteps(a,S);break;case"list":yield*this.listCommandSteps(a,S);break;case"push":yield*this.pushCommandSteps(a,S);break;default:c.tR.endSteps(a);break}re&&a.counter--}return a.counter<0?c.oo.Break:void 0}*pickSubcommandStep(a){const S=c.tR.createPickStep({title:this.title,placeholder:`Choose a ${this.label} command`,items:[{label:"apply",description:"integrates changes from the specified stash into the current branch",picked:a.subcommand==="apply",item:"apply"},{label:"drop",description:"deletes the specified stash",picked:a.subcommand==="drop",item:"drop"},{label:"list",description:"lists the saved stashes",picked:a.subcommand==="list",item:"list"},{label:"pop",description:"integrates changes from the specified stash into the current branch and deletes the stash",picked:a.subcommand==="pop",item:"pop"},{label:"push",description:"saves your local changes to a new stash and discards them from the working tree and index",picked:a.subcommand==="push",item:"push"}],buttons:[y.QuickInputButtons.Back]}),re=yield S;return c.tR.canPickStepContinue(S,a,re)?re[0].item:c.oo.Break}async*applyOrPopCommandSteps(a,S){for(var re;this.canStepsContinue(a);){if(a.counter<3||a.reference==null){const me=yield*(0,c.Qp)(a,S,{stash:await this.container.git.getStash(a.repo.path),placeholder:(he,Qe)=>Qe==null?`No stashes found in ${a.repo.formattedName}`:"Choose a stash to apply to your working tree",picked:(re=a.reference)==null?void 0:re.ref});if(me===c.oo.Break)break;a.reference=me}if(this.confirm(a.confirm)){const me=yield*this.applyOrPopCommandConfirmStep(a,S);if(me===c.oo.Break)continue;a.subcommand=me}c.tR.endSteps(a);try{await a.repo.stashApply(a.subcommand==="pop"?`stash@{${a.reference.number}}`:a.reference.ref,{deleteAfter:a.subcommand==="pop"})}catch(me){Xi.Y.error(me,S.title),wr.is(me,Fi.WorkingChanges)?y.window.showWarningMessage("Unable to apply stash. Your working tree changes would be overwritten. Please commit or stash your changes before trying again"):Lr.V.showGenericErrorMessage(me.message)}}}*applyOrPopCommandConfirmStep(a,S){const re=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[{label:S.title,detail:a.subcommand==="pop"?`Will delete ${b.GitReference.toString(a.reference)} and apply the changes to the working tree`:`Will apply the changes from ${b.GitReference.toString(a.reference)} to the working tree`,item:a.subcommand},{label:en(this.title,a.subcommand==="pop"?"apply":"pop"),detail:a.subcommand==="pop"?`Will apply the changes from ${b.GitReference.toString(a.reference)} to the working tree`:`Will delete ${b.GitReference.toString(a.reference)} and apply the changes to the working tree`,item:a.subcommand==="pop"?"apply":"pop"}],void 0,{placeholder:`Confirm ${S.title}`,additionalButtons:[c.rO.RevealInSideBar],onDidClickButton:(he,Qe)=>{Qe===c.rO.RevealInSideBar&&Mr.u.Stash.reveal(a.reference,{select:!0,expand:!0})}}),me=yield re;return c.tR.canPickStepContinue(re,a,me)?me[0].item:c.oo.Break}async*dropCommandSteps(a,S){for(var re;this.canStepsContinue(a);){if(a.counter<3||a.reference==null){const he=yield*(0,c.Qp)(a,S,{stash:await this.container.git.getStash(a.repo.path),placeholder:(Qe,Mt)=>Mt==null?`No stashes found in ${a.repo.formattedName}`:"Choose a stash to delete",picked:(re=a.reference)==null?void 0:re.ref});if(he===c.oo.Break)break;a.reference=he}if((yield*this.dropCommandConfirmStep(a,S))!==c.oo.Break){c.tR.endSteps(a);try{await a.repo.stashDelete(`stash@{${a.reference.number}}`,a.reference.ref)}catch(he){Xi.Y.error(he,S.title),Lr.V.showGenericErrorMessage("Unable to delete stash");return}}}}*dropCommandConfirmStep(a,S){const re=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[{label:S.title,detail:`Will delete ${b.GitReference.toString(a.reference)}`}],void 0,{placeholder:`Confirm ${S.title}`,additionalButtons:[c.rO.RevealInSideBar],onDidClickButton:(he,Qe)=>{Qe===c.rO.RevealInSideBar&&Mr.u.Stash.reveal(a.reference,{select:!0,expand:!0})}}),me=yield re;return c.tR.canPickStepContinue(re,a,me)?void 0:c.oo.Break}async*listCommandSteps(a,S){var re;for(S.title="Stashes";this.canStepsContinue(a);){if(a.counter<3||a.reference==null){const he=yield*(0,c.Qp)(a,S,{stash:await this.container.git.getStash(a.repo.path),placeholder:(Qe,Mt)=>Mt==null?`No stashes found in ${a.repo.formattedName}`:"Choose a stash",picked:(re=a.reference)==null?void 0:re.ref});if(he===c.oo.Break)break;a.reference=he}const me=yield*Pn(this.container,{command:"show",state:{repo:a.repo,reference:a.reference}},this.pickedVia);a.counter--,me===c.oo.Break&&c.tR.endSteps(a)}}async*pushCommandSteps(a,S){for(a.flags==null&&(a.flags=[]);this.canStepsContinue(a);){if(a.counter<3||a.message==null){const re=yield*this.pushCommandInputMessageStep(a,S);if(re===c.oo.Break)break;a.message=re}if(this.confirm(a.confirm)){const re=yield*this.pushCommandConfirmStep(a,S);if(re===c.oo.Break)continue;a.flags=re}c.tR.endSteps(a);try{await a.repo.stashSave(a.message,a.uris,{includeUntracked:a.flags.includes("--include-untracked"),keepIndex:a.flags.includes("--keep-index")})}catch(re){Xi.Y.error(re,S.title);const me=re?.message??re?.toString()??"";if(me.includes("newer version of Git")){y.window.showErrorMessage(`Unable to stash changes. ${me}`);return}Lr.V.showGenericErrorMessage("Unable to stash changes");return}}}async*pushCommandInputMessageStep(a,S){const re=c.tR.createInputStep({title:(0,c.C8)(S.title,a,S,a.uris!=null?`${(0,x.vk)(I.NE.Dot,2,2)}${a.uris.length===1?(0,Ie.d)(a.uris[0],{fileOnly:!0}):`${a.uris.length} files`}`:void 0),placeholder:"Please provide a stash message",value:a.message,prompt:"Enter stash message"}),me=yield re;return!c.tR.canStepContinue(re,a,me)||!await c.tR.canInputStepContinue(re,a,me)?c.oo.Break:me}*pushCommandConfirmStep(a,S){const re=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),a.uris==null||a.uris.length===0?[C.create(a.flags,[],{label:S.title,detail:"Will stash uncommitted changes"}),C.create(a.flags,["--include-untracked"],{label:`${S.title} & Include Untracked`,description:"--include-untracked",detail:"Will stash uncommitted changes, including untracked files"}),C.create(a.flags,["--keep-index"],{label:`${S.title} & Keep Staged`,description:"--keep-index",detail:"Will stash uncommitted changes, but will keep staged files intact"})]:[C.create(a.flags,[],{label:S.title,detail:`Will stash changes from ${a.uris.length===1?(0,Ie.d)(a.uris[0],{fileOnly:!0}):`${a.uris.length} files`}`}),C.create(a.flags,["--keep-index"],{label:`${S.title} & Keep Staged`,detail:`Will stash changes from ${a.uris.length===1?(0,Ie.d)(a.uris[0],{fileOnly:!0}):`${a.uris.length} files`}, but will keep staged files intact`})],void 0,{placeholder:`Confirm ${S.title}`}),me=yield re;return c.tR.canPickStepContinue(re,a,me)?me[0].item:c.oo.Break}}o(tn,"StashGitCommand");var Sr=Object.defineProperty,wn=Object.getOwnPropertySymbols,bn=Object.prototype.hasOwnProperty,cn=Object.prototype.propertyIsEnumerable,W=o((se,a,S)=>a in se?Sr(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"status_defNormalProp"),z=o((se,a)=>{for(var S in a||(a={}))bn.call(a,S)&&W(se,S,a[S]);if(wn)for(var S of wn(a))cn.call(a,S)&&W(se,S,a[S]);return se},"status_spreadValues");class X extends c.tR{constructor(a,S){super(a,"status","status","Status",{description:"shows status information about a repository"});var re;let me=0;((re=S?.state)==null?void 0:re.repo)!=null&&me++,this.initialState=z({counter:me,confirm:!1},S?.state)}get canConfirm(){return!1}async*steps(a){const S={repos:this.container.git.openRepositories,associatedView:this.container.commitsView,status:void 0,title:this.title};let re=!1;for(;this.canStepsContinue(a);){if(S.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(re=!1,S.repos.length===1)re=!0,a.repo==null&&a.counter++,a.repo=S.repos[0];else{const he=yield*(0,c.lA)(a,S);if(he===c.oo.Break)break;a.repo=he}if(S.status=await a.repo.getStatus(),S.status==null)return;S.title=`${this.title}${(0,x.vk)(I.NE.Dot,2,2)}${b.GitReference.toString(b.GitReference.create(S.status.branch,a.repo.path,{refType:"branch",name:S.status.branch,remote:!1,upstream:S.status.upstream!=null?{name:S.status.upstream,missing:!1}:void 0}),{icon:!1})}`;const me=yield*(0,c.up)(a,S);if(me===c.oo.Break){re&&a.counter--;continue}if(me instanceof ni.Wv){const he=yield*me.executeSteps(this.pickedVia);a.counter--,he===c.oo.Break&&c.tR.endSteps(a);continue}if(me instanceof fr.$w){c.tR.endSteps(a),me.execute();break}}}}o(X,"StatusGitCommand");var ge=Object.defineProperty,Be=Object.getOwnPropertySymbols,rt=Object.prototype.hasOwnProperty,yt=Object.prototype.propertyIsEnumerable,Jt=o((se,a,S)=>a in se?ge(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"switch_defNormalProp"),ei=o((se,a)=>{for(var S in a||(a={}))rt.call(a,S)&&Jt(se,S,a[S]);if(Be)for(var S of Be(a))yt.call(a,S)&&Jt(se,S,a[S]);return se},"switch_spreadValues");class mi extends c.tR{constructor(a,S){super(a,"switch","switch","Switch",{description:"aka checkout, switches the current branch to a specified branch"});var re,me;let he=0;((re=S?.state)==null?void 0:re.repos)!=null&&(!Array.isArray(S.state.repos)||S.state.repos.length!==0)&&he++,((me=S?.state)==null?void 0:me.reference)!=null&&he++,this.initialState=ei({counter:he,confirm:S?.confirm},S?.state)}async execute(a){return void await y.window.withProgress({location:y.ProgressLocation.Notification,title:`Switching ${a.repos.length===1?a.repos[0].formattedName:`${a.repos.length} repositories`} to ${a.reference.name}`},()=>Promise.all(a.repos.map(S=>S.switch(a.reference.ref,{createBranch:a.createBranch,progress:!1}))))}isMatch(a){return super.isMatch(a)||a==="checkout"}isFuzzyMatch(a){return super.isFuzzyMatch(a)||a==="checkout"}async*steps(a){const S={repos:this.container.git.openRepositories,associatedView:this.container.commitsView,showTags:!1,title:this.title};a.repos!=null&&!Array.isArray(a.repos)&&(a.repos=[a.repos]);let re=!1;for(;this.canStepsContinue(a);){if(S.title=this.title,a.counter<1||a.repos==null||a.repos.length===0||(0,pe.GI)(a.repos))if(re=!1,S.repos.length===1)re=!0,a.counter++,a.repos=[S.repos[0]];else{const me=yield*(0,c.j8)(a,S,{skipIfPossible:a.counter>=1});if(me===c.oo.Break)break;a.repos=me}if(a.counter<2||a.reference==null){const me=yield*(0,c.xC)(a,S,{placeholder:he=>`Choose a branch${he.showTags?" or tag":""} to switch to`});if(me===c.oo.Break){re&&a.counter--;continue}a.reference=me}if(b.GitReference.isBranch(a.reference)&&a.reference.remote){S.title=`Create Branch and ${this.title}`;const{values:me}=await this.container.git.getBranches(a.reference.repoPath,{filter:he=>{var Qe;return((Qe=he.upstream)==null?void 0:Qe.name)===a.reference.name},sort:{orderBy:s.Vz.DateDesc}});if(me.length===0){const he=yield*(0,c.f6)(a,S,{placeholder:"Please provide a name for the new branch",titleContext:` based on ${b.GitReference.toString(a.reference,{icon:!1})}`,value:a.createBranch??b.GitReference.getNameWithoutRemote(a.reference)});if(he===c.oo.Break)continue;a.createBranch=he}else a.createBranch=void 0}else a.createBranch=void 0;this.confirm(a.confirm)&&(yield*this.confirmStep(a,S))===c.oo.Break||(c.tR.endSteps(a),this.execute(a))}return a.counter<0?c.oo.Break:void 0}*confirmStep(a,S){const re=this.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[{label:S.title,description:a.createBranch?"-b":"",detail:`Will ${a.createBranch?`create and switch to a new branch named ${a.createBranch} from ${b.GitReference.toString(a.reference)}`:`switch to ${b.GitReference.toString(a.reference)}`} in ${a.repos.length===1?`$(repo) ${a.repos[0].formattedName}`:`${a.repos.length} repositories`}`}],void 0,{placeholder:`Confirm ${S.title}`}),me=yield re;return c.tR.canPickStepContinue(re,a,me)?void 0:c.oo.Break}}o(mi,"SwitchGitCommand");var Vt=Object.defineProperty,xt=Object.getOwnPropertySymbols,ci=Object.prototype.hasOwnProperty,xi=Object.prototype.propertyIsEnumerable,Ji=o((se,a,S)=>a in se?Vt(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"tag_defNormalProp"),Ri=o((se,a)=>{for(var S in a||(a={}))ci.call(a,S)&&Ji(se,S,a[S]);if(xt)for(var S of xt(a))xi.call(a,S)&&Ji(se,S,a[S]);return se},"tag_spreadValues"),mr=o((se,a,S)=>(Ji(se,typeof a!="symbol"?a+"":a,S),S),"tag_publicField");const xr=new Map([["create","Create"],["delete","Delete"]]);function _r(se,a){return a==null?se:`${xr.get(a)} ${se}`}o(_r,"tag_getTitle");class so extends c.tR{constructor(a,S){super(a,"tag","tag","Tag",{description:"create, or delete tags"});mr(this,"subcommand");var re,me;let he=0;if(((re=S?.state)==null?void 0:re.subcommand)!=null)switch(he++,S.state.subcommand){case"create":S.state.reference!=null&&he++,S.state.name!=null&&he++,S.state.message!=null&&he++;break;case"delete":S.state.references!=null&&(!Array.isArray(S.state.references)||S.state.references.length!==0)&&he++;break}((me=S?.state)==null?void 0:me.repo)!=null&&he++,this.initialState=Ri({counter:he,confirm:S?.confirm},S?.state)}get canConfirm(){return this.subcommand!=null}get canSkipConfirm(){return this.subcommand==="delete"?!1:super.canSkipConfirm}get skipConfirmKey(){return`${this.key}${this.subcommand==null?"":`-${this.subcommand}`}:${this.pickedVia}`}async*steps(a){const S={repos:this.container.git.openRepositories,associatedView:this.container.tagsView,showTags:!1,title:this.title};let re=!1;for(;this.canStepsContinue(a);){if(S.title=this.title,a.counter<1||a.subcommand==null){this.subcommand=void 0;const me=yield*this.pickSubcommandStep(a);if(me===c.oo.Break)break;a.subcommand=me}if(this.subcommand=a.subcommand,a.counter<2||a.repo==null||typeof a.repo=="string")if(re=!1,S.repos.length===1)re=!0,a.counter++,a.repo=S.repos[0];else{const me=yield*(0,c.lA)(a,S);if(me===c.oo.Break)continue;a.repo=me}switch(S.title=_r(a.subcommand==="delete"?"Tags":this.title,a.subcommand),a.subcommand){case"create":{yield*this.createCommandSteps(a,S),a.name=void 0;break}case"delete":yield*this.deleteCommandSteps(a,S);break;default:c.tR.endSteps(a);break}re&&a.counter--}return a.counter<0?c.oo.Break:void 0}*pickSubcommandStep(a){const S=c.tR.createPickStep({title:this.title,placeholder:`Choose a ${this.label} command`,items:[{label:"create",description:"creates a new tag",picked:a.subcommand==="create",item:"create"},{label:"delete",description:"deletes the specified tags",picked:a.subcommand==="delete",item:"delete"}],buttons:[y.QuickInputButtons.Back]}),re=yield S;return c.tR.canPickStepContinue(S,a,re)?re[0].item:c.oo.Break}async*createCommandSteps(a,S){var re,me;for(a.flags==null&&(a.flags=[]);this.canStepsContinue(a);){if(a.counter<3||a.reference==null){const he=yield*(0,c.Yv)(a,S,{placeholder:Qe=>`Choose a branch${Qe.showTags?" or tag":""} to create the new tag from`,picked:((re=a.reference)==null?void 0:re.ref)??((me=await a.repo.getBranch())==null?void 0:me.ref),titleContext:" from",value:b.GitReference.isRevision(a.reference)?a.reference.ref:void 0});if(he===c.oo.Break)break;a.reference=he}if(a.counter<4||a.name==null){const he=yield*(0,c.fG)(a,S,{placeholder:"Please provide a name for the new tag",titleContext:` at ${b.GitReference.toString(a.reference,{capitalize:!0,icon:!1})}`,value:a.name??b.GitReference.getNameWithoutRemote(a.reference)});if(he===c.oo.Break)continue;a.name=he}if(a.counter<5||a.message==null){const he=yield*this.createCommandInputMessageStep(a,S);if(he===c.oo.Break)continue;a.message=he}if(a.message.length!==0&&!a.flags.includes("-m")&&a.flags.push("-m"),this.confirm(a.confirm)){const he=yield*this.createCommandConfirmStep(a,S);if(he===c.oo.Break)continue;a.flags=he}c.tR.endSteps(a),a.repo.tag(...a.flags,...a.message.length!==0?[`"${a.message}"`]:[],a.name,a.reference.ref)}}async*createCommandInputMessageStep(a,S){const re=c.tR.createInputStep({title:(0,c.C8)(`${S.title} at ${b.GitReference.toString(a.reference,{capitalize:!0,icon:!1})}`,a,S),placeholder:"Please provide an optional message to annotate the tag",value:a.message,prompt:"Enter optional message"}),me=yield re;return!c.tR.canStepContinue(re,a,me)||!await c.tR.canInputStepContinue(re,a,me)?c.oo.Break:me}*createCommandConfirmStep(a,S){const re=c.tR.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[C.create(a.flags,a.message.length!==0?["-m"]:[],{label:S.title,description:a.message.length!==0?"-m":"",detail:`Will create a new tag named ${a.name} at ${b.GitReference.toString(a.reference)}`}),C.create(a.flags,a.message.length!==0?["--force","-m"]:["--force"],{label:`Force ${S.title}`,description:`--force${a.message.length!==0?" -m":""}`,detail:`Will forcibly create a new tag named ${a.name} at ${b.GitReference.toString(a.reference)}`})],S),me=yield re;return c.tR.canPickStepContinue(re,a,me)?me[0].item:c.oo.Break}async*deleteCommandSteps(a,S){for(var re;this.canStepsContinue(a);){if(a.references!=null&&!Array.isArray(a.references)&&(a.references=[a.references]),a.counter<3||a.references==null||a.references.length===0){S.title=_r("Tags",a.subcommand);const he=yield*(0,c.yY)(a,S,{picked:(re=a.references)==null?void 0:re.map(Qe=>Qe.ref),placeholder:"Choose tags to delete"});if(he===c.oo.Break)break;a.references=he}S.title=_r((0,x._6)("Tag",a.references.length,{only:!0}),a.subcommand),(yield*this.deleteCommandConfirmStep(a,S))!==c.oo.Break&&(c.tR.endSteps(a),a.repo.tagDelete(a.references))}}*deleteCommandConfirmStep(a,S){const re=c.tR.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[{label:S.title,detail:`Will delete ${b.GitReference.toString(a.references)}`}],S),me=yield re;return c.tR.canPickStepContinue(re,a,me)?void 0:c.oo.Break}}o(so,"TagGitCommand");var Bo=g(7785),yn=g(6532),er=g(320),wi=Object.defineProperty,No=Object.getOwnPropertySymbols,Un=Object.prototype.hasOwnProperty,ao=Object.prototype.propertyIsEnumerable,br=o((se,a,S)=>a in se?wi(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"worktree_defNormalProp"),Hr=o((se,a)=>{for(var S in a||(a={}))Un.call(a,S)&&br(se,S,a[S]);if(No)for(var S of No(a))ao.call(a,S)&&br(se,S,a[S]);return se},"worktree_spreadValues"),Or=o((se,a,S)=>(br(se,typeof a!="symbol"?a+"":a,S),S),"worktree_publicField");const Mo=new Map([["create","Create"],["delete","Delete"],["open","Open"]]);function rn(se,a){return a==null?se:`${Mo.get(a)} ${se}`}o(rn,"worktree_getTitle");class lo extends c.tR{constructor(a,S){super(a,"worktree","worktree","Worktree",{description:"open, create, or delete worktrees"});Or(this,"subcommand"),Or(this,"canSkipConfirmOverride");var re,me;let he=0;if(((re=S?.state)==null?void 0:re.subcommand)!=null)switch(he++,S.state.subcommand){case"create":S.state.uri!=null&&he++,S.state.reference!=null&&he++;break;case"delete":S.state.uris!=null&&(!Array.isArray(S.state.uris)||S.state.uris.length!==0)&&he++;break;case"open":S.state.uri!=null&&he++;break}((me=S?.state)==null?void 0:me.repo)!=null&&he++,this.initialState=Hr({counter:he,confirm:S?.confirm},S?.state)}get canConfirm(){return this.subcommand!=null}get canSkipConfirm(){return this.canSkipConfirmOverride??!1}get skipConfirmKey(){return`${this.key}${this.subcommand==null?"":`-${this.subcommand}`}:${this.pickedVia}`}async*steps(a){const S={repos:Bo.W.instance.git.openRepositories,associatedView:Bo.W.instance.worktreesView,showTags:!1,title:this.title};let re=!1;for(;this.canStepsContinue(a);){if(S.title=this.title,a.counter<1||a.subcommand==null){this.subcommand=void 0;const he=yield*this.pickSubcommandStep(a);if(he===c.oo.Break)break;a.subcommand=he}if(this.subcommand=a.subcommand,a.counter<2||a.repo==null||typeof a.repo=="string")if(re=!1,S.repos.length===1)re=!0,a.counter++,a.repo=S.repos[0];else{const he=yield*(0,c.lA)(a,S);if(he===c.oo.Break)continue;a.repo=he}if((yield*(0,c.Oz)(a,S,yn.x.Worktrees))===c.oo.Break)break;switch(S.title=rn(a.subcommand==="delete"?"Worktrees":this.title,a.subcommand),a.subcommand){case"create":{yield*this.createCommandSteps(a,S),a.uri=void 0;break}case"delete":{a.uris!=null&&!Array.isArray(a.uris)&&(a.uris=[a.uris]),yield*this.deleteCommandSteps(a,S);break}case"open":{yield*this.openCommandSteps(a,S);break}default:c.tR.endSteps(a);break}re&&a.counter--}return a.counter<0?c.oo.Break:void 0}*pickSubcommandStep(a){const S=c.tR.createPickStep({title:this.title,placeholder:`Choose a ${this.label} command`,items:[{label:"open",description:"opens the specified worktree",picked:a.subcommand==="open",item:"open"},{label:"create",description:"creates a new worktree",picked:a.subcommand==="create",item:"create"},{label:"delete",description:"deletes the specified worktrees",picked:a.subcommand==="delete",item:"delete"}],buttons:[y.QuickInputButtons.Back]}),re=yield S;return c.tR.canPickStepContinue(S,a,re)?re[0].item:c.oo.Break}async*createCommandSteps(a,S){var re,me,he;for(S.defaultUri==null&&(S.defaultUri=await a.repo.getWorktreesDefaultUri()),a.flags==null&&(a.flags=[]),S.pickedUri=void 0,a.confirm=!0,this.canSkipConfirmOverride=void 0;this.canStepsContinue(a);){if(a.counter<3||a.reference==null){const Mt=yield*(0,c.Yv)(a,S,{placeholder:it=>`Choose a branch${it.showTags?" or tag":""} to create the new worktree for`,picked:((re=a.reference)==null?void 0:re.ref)??((me=await a.repo.getBranch())==null?void 0:me.ref),titleContext:" for",value:b.GitReference.isRevision(a.reference)?a.reference.ref:void 0});if(Mt===c.oo.Break)break;a.reference=Mt}if(a.counter<4||a.uri==null)if(a.reference!=null&&!ri.DN.get("worktrees.promptForLocation",a.repo.folder)&&S.defaultUri!=null)a.uri=S.defaultUri;else{const Mt=yield*this.createCommandChoosePathStep(a,S,{titleContext:` for ${b.GitReference.toString(a.reference,{capitalize:!0,icon:!1,label:a.reference.refType!=="branch"})}`});if(Mt===c.oo.Break)continue;a.uri=Mt,S.pickedUri=a.uri}if(this.confirm(a.confirm)){const Mt=yield*this.createCommandConfirmStep(a,S);if(Mt===c.oo.Break)continue;[a.uri,a.flags]=Mt}if(a.confirm=!0,this.canSkipConfirmOverride=void 0,a.flags.includes("-b")&&a.createBranch==null){const Mt=yield*(0,c.f6)(a,S,{placeholder:"Please provide a name for the new branch",titleContext:` from ${b.GitReference.toString(a.reference,{capitalize:!0,icon:!1,label:a.reference.refType!=="branch"})}`,value:a.createBranch??b.GitReference.getNameWithoutRemote(a.reference)});if(Mt===c.oo.Break){a.flags=[];continue}a.createBranch=Mt}const Qe=a.flags.includes("--direct")?a.uri:y.Uri.joinPath(a.uri,...(a.createBranch??a.reference.name).replace(/\\/g,"/").split("/"));try{await a.repo.createWorktree(Qe,{commitish:(he=a.reference)==null?void 0:he.name,createBranch:a.flags.includes("-b")?a.createBranch:void 0,detach:a.flags.includes("--detach"),force:a.flags.includes("--force")})}catch(Mt){if(Nr.is(Mt,Ni.AlreadyCheckedOut)&&!a.flags.includes("--force")){const it={title:"Create New Branch"},Tt={title:"Create Anyway"},ai={title:"Cancel",isCloseAffordance:!0},bi=await y.window.showWarningMessage(`Unable to create the new worktree because ${b.GitReference.toString(a.reference,{icon:!1,quoted:!0})} is already checked out. Would you like to create a new branch for this worktree or forcibly create it anyway?`,{modal:!0},it,Tt,ai);if(bi===it){a.flags.push("-b"),this.canSkipConfirmOverride=!0,a.confirm=!1;continue}if(bi===Tt){a.flags.push("--force"),this.canSkipConfirmOverride=!0,a.confirm=!1;continue}}else Nr.is(Mt,Ni.AlreadyExists)?y.window.showErrorMessage(`Unable to create a new worktree in '${b.GitWorktree.getFriendlyPath(Qe)}' because the folder already exists and is not empty.`,"OK"):Lr.V.showGenericErrorMessage(`Unable to create a new worktree in '${b.GitWorktree.getFriendlyPath(Qe)}.`)}c.tR.endSteps(a)}}async*createCommandChoosePathStep(a,S,re){const me=c.tR.createCustomStep({show:async Qe=>{const Mt=await y.window.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,defaultUri:S.pickedUri??a.uri??S.defaultUri,openLabel:"Select Worktree Location",title:`${(0,c.C8)(`Choose Worktree Location${re?.titleContext??""}`,a,S)}`});return Mt==null||Mt.length===0?Pi.X.Back:Mt[0]}}),he=yield me;return!c.tR.canStepContinue(me,a,he)||!await c.tR.canInputStepContinue(me,a,he)?c.oo.Break:he}*createCommandConfirmStep(a,S){const re=S.pickedUri??a.uri,me=(0,x.AO)(b.GitWorktree.getFriendlyPath(re),60);let he=!0,Qe;const Mt=a.repo.uri;Mt.toString()!==re.toString()?(0,Ye.$d)(re,Mt)?Qe=y.Uri.joinPath(Mt,"..",`${(0,Ye.EZ)(Mt.path)}.worktrees`):Qe=y.Uri.joinPath(re,`${(0,Ye.EZ)(Mt.path)}.worktrees`):(Qe=y.Uri.joinPath(Mt,"..",`${(0,Ye.EZ)(Mt.path)}.worktrees`),he=!1);const it=a.reference!=null?y.Uri.joinPath(Qe,...a.reference.name.replace(/\\/g,"/").split("/")):Qe,Tt=(0,x.AO)(b.GitWorktree.getFriendlyPath(it),65),ai=(0,x.AO)(b.GitWorktree.getFriendlyPath(y.Uri.joinPath(Qe,"")),60),bi=c.tR.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[C.create(a.flags,[],{label:S.title,description:` for ${b.GitReference.toString(a.reference)}`,detail:`Will create worktree in $(folder) ${Tt}`},Qe),C.create(a.flags,["-b"],{label:"Create New Branch and Worktree",description:` from ${b.GitReference.toString(a.reference)}`,detail:`Will create worktree in $(folder) ${ai}`},Qe),...he?[fr.HH.create(),C.create(a.flags,["--direct"],{label:`${S.title} (directly in folder)`,description:` for ${b.GitReference.toString(a.reference)}`,detail:`Will create worktree directly in $(folder) ${me}`},re),C.create(a.flags,["-b","--direct"],{label:"Create New Branch and Worktree (directly in folder)",description:` from ${b.GitReference.toString(a.reference)}`,detail:`Will create worktree directly in $(folder) ${me}`},re)]:[]],S),sr=yield bi;return c.tR.canPickStepContinue(bi,a,sr)?[sr[0].context,sr[0].item]:c.oo.Break}async*deleteCommandSteps(a,S){var re;for(S.worktrees=await a.repo.getWorktrees(),a.flags==null&&(a.flags=[]);this.canStepsContinue(a);){if(a.counter<3||a.uris==null||a.uris.length===0){S.title=rn("Worktrees",a.subcommand);const he=yield*(0,c.Mb)(a,S,{filter:Qe=>Qe.main||!Qe.opened,includeStatus:!0,picked:(re=a.uris)==null?void 0:re.map(Qe=>Qe.toString()),placeholder:"Choose worktrees to delete"});if(he===c.oo.Break)break;a.uris=he.map(Qe=>Qe.uri)}S.title=rn((0,x._6)("Worktree",a.uris.length,{only:!0}),a.subcommand);const me=yield*this.deleteCommandConfirmStep(a,S);if(me!==c.oo.Break){a.flags=me,c.tR.endSteps(a);for(const he of a.uris){let Qe=!1;do{Qe=!1;const Mt=a.flags.includes("--force");try{if(Mt){const it=S.worktrees.find(ai=>ai.uri.toString()===he.toString()),Tt=await it?.getStatus();if(Tt?.hasChanges??!1){const ai={title:"Force Delete"},bi={title:"Cancel",isCloseAffordance:!0};if(await y.window.showWarningMessage(`The worktree in '${he.fsPath}' has uncommitted changes. Deleting it will cause those changes to be FOREVER LOST. This is IRREVERSIBLE! Are you sure you still want to delete it?`,{modal:!0},ai,bi)!==ai)return}}await a.repo.deleteWorktree(he,{force:Mt})}catch(it){if(gr.is(it)){if(it.reason===Wr.MainWorkingTree)y.window.showErrorMessage("Unable to delete the main worktree");else if(!Mt){const Tt={title:"Force Delete"},ai={title:"Cancel",isCloseAffordance:!0};await y.window.showErrorMessage(it.reason===Wr.HasChanges?`Unable to delete worktree because there are UNCOMMITTED changes in '${he.fsPath}'. Forcibly deleting it will cause those changes to be FOREVER LOST. This is IRREVERSIBLE! Would you like to forcibly delete it?`:`Unable to delete worktree in '${he.fsPath}'. Would you like to try to forcibly delete it?`,{modal:!0},Tt,ai)===Tt&&(a.flags.push("--force"),Qe=!0)}}else Lr.V.showGenericErrorMessage(`Unable to delete worktree in '${he.fsPath}.`)}}while(Qe)}}}}*deleteCommandConfirmStep(a,S){const re=c.tR.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[C.create(a.flags,[],{label:S.title,detail:`Will delete ${(0,x._6)("worktree",a.uris.length,{only:a.uris.length===1})}${a.uris.length===1?` in $(folder) ${b.GitWorktree.getFriendlyPath(a.uris[0])}`:""}`}),C.create(a.flags,["--force"],{label:`Force ${S.title}`,description:"including ANY UNCOMMITTED changes",detail:`Will forcibly delete ${(0,x._6)("worktree",a.uris.length,{only:a.uris.length===1})} ${a.uris.length===1?` in $(folder) ${b.GitWorktree.getFriendlyPath(a.uris[0])}`:""}`})],S),me=yield re;return c.tR.canPickStepContinue(re,a,me)?me[0].item:c.oo.Break}async*openCommandSteps(a,S){var re;for(S.worktrees=await a.repo.getWorktrees(),a.flags==null&&(a.flags=[]);this.canStepsContinue(a);){if(a.counter<3||a.uri==null){S.title=rn("Worktree",a.subcommand);const Qe=yield*(0,c.UP)(a,S,{includeStatus:!0,picked:(re=a.uri)==null?void 0:re.toString(),placeholder:"Choose worktree to open"});if(Qe===c.oo.Break)break;a.uri=Qe.uri}S.title=rn("Worktree",a.subcommand);const me=yield*this.openCommandConfirmStep(a,S);if(me===c.oo.Break)continue;a.flags=me,c.tR.endSteps(a);const he=S.worktrees.find(Qe=>Qe.uri.toString()===a.uri.toString());a.flags.includes("--reveal-explorer")?Mr.u.Worktree.revealInFileExplorer(he):Mr.u.Worktree.open(he,{location:a.flags.includes("--new-window")?er.Tc.NewWindow:er.Tc.CurrentWindow})}}*openCommandConfirmStep(a,S){const re=c.tR.createConfirmStep((0,c.C8)(`Confirm ${S.title}`,a,S),[C.create(a.flags,[],{label:S.title,detail:`Will open, in the current window, the worktree in $(folder) ${b.GitWorktree.getFriendlyPath(a.uri)}`}),C.create(a.flags,["--new-window"],{label:`${S.title} in a New Window`,detail:`Will open, in a new window, the worktree in $(folder) ${b.GitWorktree.getFriendlyPath(a.uri)}`}),C.create(a.flags,["--reveal-explorer"],{label:"Reveal in File Explorer",detail:`Will open, in the File Explorer, the worktree in $(folder) ${b.GitWorktree.getFriendlyPath(a.uri)}`})],S),me=yield re;return c.tR.canPickStepContinue(re,a,me)?me[0].item:c.oo.Break}}o(lo,"WorktreeGitCommand");var Ot=Object.defineProperty,cr=o((se,a,S)=>a in se?Ot(se,a,{enumerable:!0,configurable:!0,writable:!0,value:S}):se[a]=S,"gitCommands_utils_defNormalProp"),Ar=o((se,a,S)=>(cr(se,typeof a!="symbol"?a+"":a,S),S),"gitCommands_utils_publicField");function*Cn(){}o(Cn,"nullSteps");function Pn(se,a,S){const re=new nn(se,a),me=re.find(a.command);return me==null?Cn():(re.setCommand(me,S),me.executeSteps())}o(Pn,"getSteps");class nn{constructor(a,S){this.container=a,Ar(this,"buttons",[]),Ar(this,"hiddenItems"),Ar(this,"ignoreFocusOut",!1),Ar(this,"items"),Ar(this,"matchOnDescription",!0),Ar(this,"placeholder","Choose a git command"),Ar(this,"title","GitLens"),Ar(this,"_command");const re=(0,f.f)(I.zf.HasVirtualFolders,!1),me=re||(0,f.f)(I.zf.Readonly,!1)||(0,f.f)(I.zf.Untrusted,!1);if(this.items=[me?void 0:new Te(a,S?.command==="branch"?S:void 0),me?void 0:new Le(a,S?.command==="cherry-pick"?S:void 0),re?void 0:new fe(a,S?.command==="co-authors"?S:void 0),me?void 0:new Ce(a,S?.command==="fetch"?S:void 0),new Ti(a,S?.command==="log"?S:void 0),me?void 0:new we(a,S?.command==="merge"?S:void 0),me?void 0:new Dt(a,S?.command==="pull"?S:void 0),me?void 0:new ke(a,S?.command==="push"?S:void 0),me?void 0:new gt(a,S?.command==="rebase"?S:void 0),me?void 0:new Si(a,S?.command==="reset"?S:void 0),me?void 0:new Qi(a,S?.command==="revert"?S:void 0),new Pt(a,S?.command==="search"||S?.command==="grep"?S:void 0),new kn(a,S?.command==="show"?S:void 0),re?void 0:new tn(a,S?.command==="stash"?S:void 0),re?void 0:new X(a,S?.command==="status"?S:void 0),me?void 0:new mi(a,S?.command==="switch"||S?.command==="checkout"?S:void 0),me?void 0:new so(a,S?.command==="tag"?S:void 0),re?void 0:new lo(a,S?.command==="worktree"?S:void 0)].filter(he=>he!=null),this.container.config.gitCommands.sortBy===s.zL.Usage){const he=this.container.storage.getWorkspace(w.sZ.GitCommandPaletteUsage);he!=null&&this.items.sort((Qe,Mt)=>(he[Mt.key]??0)-(he[Qe.key]??0))}this.hiddenItems=[]}get command(){return this._command}find(a,S=!1){if(S){const re=a.toLowerCase();return this.items.find(me=>me.isFuzzyMatch(re))??this.hiddenItems.find(me=>me.isFuzzyMatch(re))}return this.items.find(re=>re.isMatch(a))??this.hiddenItems.find(re=>re.isMatch(a))}setCommand(a,S){this._command!=null&&(this._command.picked=!1),a!=null&&(a.picked=!0,a.pickedVia=S),this._command=a,a!=null&&this.updateCommandUsage(a.key,Date.now())}async updateCommandUsage(a,S){let re=this.container.storage.getWorkspace(w.sZ.GitCommandPaletteUsage);re===void 0&&(re=Object.create(null)),re[a]=S,await this.container.storage.storeWorkspace(w.sZ.GitCommandPaletteUsage,re)}}o(nn,"PickCommandStep")},8318:(Re,ne,g)=>{"use strict";g.d(ne,{jQ:()=>w,rO:()=>b});var s=g(9496),I=g.n(s),f=g(7785);class w{constructor(L,A=!1){this.state=L,this._on=A}get iconPath(){const L=this.getToggledState().icon;return typeof L=="string"?{dark:s.Uri.file(f.W.instance.context.asAbsolutePath(`images/dark/${L}.svg`)),light:s.Uri.file(f.W.instance.context.asAbsolutePath(`images/light/${L}.svg`))}:L}get tooltip(){return this.getToggledState().tooltip}get on(){return this._on}set on(L){this._on=L}getState(){return typeof this.state=="function"?this.state():this.state}getToggledState(){return this.on?this.getState().on:this.getState().off}}o(w,"ToggleQuickInputButton");class y extends w{constructor(L,A,v=!1){super({off:{tooltip:L,icon:A.off},on:{tooltip:L,icon:A.on}},v)}}o(y,"SelectableQuickInputButton");var b;($=>{$.Fetch={iconPath:new s.ThemeIcon("sync"),tooltip:"Fetch"},$.LoadMore={iconPath:new s.ThemeIcon("refresh"),tooltip:"Load More"},$.MatchCaseToggle=class extends y{constructor(L=!1){super("Match Case",{off:"icon-match-case",on:"icon-match-case-selected"},L)}},$.MatchAllToggle=class extends y{constructor(L=!1){super("Match All",{off:"icon-match-all",on:"icon-match-all-selected"},L)}},$.MatchRegexToggle=class extends y{constructor(L=!1){super("Match using Regular Expressions",{off:"icon-match-regex",on:"icon-match-regex-selected"},L)}},$.PickCommit={iconPath:new s.ThemeIcon("git-commit"),tooltip:"Choose a Specific Commit"},$.PickCommitToggle=class extends w{constructor(L=!1,A,v){super(()=>({on:{tooltip:"Choose a Specific Commit",icon:new s.ThemeIcon("git-commit")},off:{tooltip:`Choose a Branch${A.showTags?" or Tag":""}`,icon:new s.ThemeIcon("git-branch")}}),L);this.onDidClick=v}},$.OpenInNewWindow={iconPath:new s.ThemeIcon("empty-window"),tooltip:"Open in New Window"},$.RevealInSideBar={iconPath:new s.ThemeIcon("eye"),tooltip:"Reveal in Side Bar"},$.SearchInSideBar={iconPath:new s.ThemeIcon("search"),tooltip:"Search in Side Bar"},$.ShowResultsInSideBar={iconPath:new s.ThemeIcon("link-external"),tooltip:"Show Results in Side Bar"},$.ShowTagsToggle=class extends y{constructor(L=!1){super("Show Tags",{off:new s.ThemeIcon("tag"),on:"icon-tag-selected"},L)}},$.WillConfirmForced={iconPath:new s.ThemeIcon("check"),tooltip:"Will always confirm"},$.WillConfirmToggle=class extends w{constructor(L=!1,A){super(()=>({on:{tooltip:"Will confirm",icon:{dark:s.Uri.file(f.W.instance.context.asAbsolutePath("images/dark/icon-check.svg")),light:s.Uri.file(f.W.instance.context.asAbsolutePath("images/light/icon-check.svg"))}},off:{tooltip:"Skips confirm",icon:{dark:s.Uri.file(f.W.instance.context.asAbsolutePath("images/dark/icon-no-check.svg")),light:s.Uri.file(f.W.instance.context.asAbsolutePath("images/light/icon-no-check.svg"))}}}),L);this.onDidClick=A}}})(b||(b={}))},3222:(Re,ne,g)=>{"use strict";g.d(ne,{tR:()=>li,rO:()=>I.rO,oo:()=>Ii,C8:()=>Fe,Oz:()=>ui,B$:()=>kt,v$:()=>Rt,f6:()=>Dt,fG:()=>ri,a:()=>Qi,Gj:()=>or,Dr:()=>fr,Yv:()=>Ht,xC:()=>vi,sd:()=>jt,FO:()=>qt,s4:()=>ii,Rj:()=>ar,bR:()=>Rr,j8:()=>$e,lA:()=>ze,Qp:()=>ke,yY:()=>Ge,UP:()=>Ke,Mb:()=>Oe,nI:()=>gt,fD:()=>lt,KT:()=>Se,up:()=>It});var s=g(4761),I=g(8318),f=g(9179),w=g(1045),y=g(7785),b=g(2976),$=g(4504),L=g(3969),A=g(4338),v=g(3708),T=g(5355),R=g(3542),P=g(2062),F=g(7042),_=g(4073),C=g(5084),k=g(1692);function x(te){return te!==te}o(x,"baseIsNaN");const c=x;function O(te,ve,Ze){for(var ot=Ze-1,tt=te.length;++ot-1}o(U,"arrayIncludes");const H=U;function j(te,ve,Ze){for(var ot=-1,tt=te==null?0:te.length;++ot=120&&Ut.length>=120)?new C.Z(Pt&&Ut):void 0}Ut=te[0];var si=-1,Yt=Ft[0];e:for(;++si0){if(++ve>=qe)return arguments[0]}else ve=0;return te.apply(void 0,arguments)}}o(fe,"shortOut");var ht=fe(De);const Z=ht;function Y(te,ve){return Z(Ae(te,ve,Te.Z),te+"")}o(Y,"baseRest");const K=Y;var _e=g(585),ie=g(8533);function Ne(te){return(0,ie.Z)(te)&&(0,_e.Z)(te)}o(Ne,"isArrayLikeObject");const Ce=Ne;function Ie(te){return Ce(te)?te:[]}o(Ie,"castArrayLikeObject");const nt=Ie;function wt(te){var ve=te==null?0:te.length;return ve?te[ve-1]:void 0}o(wt,"last");const pt=wt;var ct=K(function(te){var ve=pt(te),Ze=(0,_.Z)(te,nt);return ve=typeof ve=="function"?ve:void 0,ve&&Ze.pop(),Ze.length&&Ze[0]===te[0]?Pe(Ze,void 0,ve):[]});const $t=ct;var Gt=g(1677),Ai=g(2886),Ti=g(3430),Pi=g(320),Lt=g(5387),ti=Object.defineProperty,Ei=Object.getOwnPropertySymbols,Hi=Object.prototype.hasOwnProperty,dr=Object.prototype.propertyIsEnumerable,St=o((te,ve,Ze)=>ve in te?ti(te,ve,{enumerable:!0,configurable:!0,writable:!0,value:Ze}):te[ve]=Ze,"__defNormalProp"),we=o((te,ve)=>{for(var Ze in ve||(ve={}))Hi.call(ve,Ze)&&St(te,Ze,ve[Ze]);if(Ei)for(var Ze of Ei(ve))dr.call(ve,Ze)&&St(te,Ze,ve[Ze]);return te},"__spreadValues");function Fe(te,ve,Ze,ot){if(Ze.repos.length===1)return`${te}${(0,Ti.$G)(ot??"",w.d$-te.length)}`;let tt;return ve.repo!=null?tt=`${ot??""}${(0,Ti.vk)(w.NE.Dot,2,2)}${ve.repo.formattedName}`:ve.repos.length===1?tt=`${ot??""}${(0,Ti.vk)(w.NE.Dot,2,2)}${ve.repos[0].formattedName}`:tt=`${(0,Ti.vk)(w.NE.Dot,2,2)}${ve.repos.length} repositories`,`${te}${(0,Ti.$G)(tt,w.d$-te.length)}`}o(Fe,"appendReposToTitle");async function Je(te,ve){return kt(te,["branches"],{buttons:ve?.buttons,filter:ve?.filter!=null?{branches:ve.filter}:void 0,picked:ve?.picked,sort:ve?.sort!=null?{branches:ve.sort}:!0})}o(Je,"getBranches");async function dt(te,ve){return kt(te,["tags"],{buttons:ve?.buttons,filter:ve?.filter!=null?{tags:ve.filter}:void 0,picked:ve?.picked,sort:ve?.sort!=null?{tags:ve.sort}:!0})}o(dt,"getTags");async function ft(te,{buttons:ve,filter:Ze,includeStatus:ot,picked:tt}){const bt=te instanceof b.Repository?await te.getWorktrees():te;return Promise.all([...bt.filter(Pt=>Ze==null||Ze(Pt)).map(async Pt=>T.dO.create(Pt,tt!=null&&(typeof tt=="string"?Pt.uri.toString()===tt:tt.includes(Pt.uri.toString())),{buttons:ve,path:!0,status:ot?await Pt.getStatus():void 0}))])}o(ft,"getWorktrees");async function kt(te,ve,{buttons:Ze,filter:ot,picked:tt,sort:bt}={}){var Pt,Ft,ni,oi,Ut,si;if(te==null)return[];let Yt,Zt,Xt=!1;if(te instanceof b.Repository||te.length===1){Xt=!0;const Kt=te instanceof b.Repository?te:te[0],[Wi,Gi]=await Promise.allSettled([ve.includes("branches")?Kt.getBranches({filter:ot?.branches,sort:typeof bt=="boolean"?bt:bt?.branches}):void 0,ve.includes("tags")?Kt.getTags({filter:ot?.tags,sort:!0}):void 0]);Yt=(Wi.status==="fulfilled"?(Pt=Wi.value)==null?void 0:Pt.values:void 0)??[],Zt=(Gi.status==="fulfilled"?(Ft=Gi.value)==null?void 0:Ft.values:void 0)??[]}else{const[Kt,Wi]=await Promise.allSettled([ve.includes("branches")?Promise.allSettled(te.map(rr=>rr.getBranches({filter:ot?.branches,sort:typeof bt=="boolean"?bt:bt?.branches}))):void 0,ve.includes("tags")?Promise.allSettled(te.map(rr=>rr.getTags({filter:ot?.tags,sort:typeof bt=="boolean"?bt:bt?.tags}))):void 0]),Gi=Kt.status==="fulfilled"?(oi=(ni=Kt.value)==null?void 0:ni.filter(rr=>rr.status==="fulfilled"))==null?void 0:oi.map(rr=>rr.value.values):void 0,ji=Wi.status==="fulfilled"?(si=(Ut=Wi.value)==null?void 0:Ut.filter(rr=>rr.status==="fulfilled"))==null?void 0:si.map(rr=>rr.value.values):void 0;ve.includes("branches")&&Gi!=null&&(Yt=b.GitBranch.sort($t(...Gi,(rr,Zr)=>rr.name===Zr.name))),ve.includes("tags")&&ji!=null&&(Zt=b.GitTag.sort($t(...ji,(rr,Zr)=>rr.name===Zr.name)))}return(Yt==null||Yt.length===0)&&(Zt==null||Zt.length===0)?[]:Yt!=null&&Yt.length!==0&&(Zt==null||Zt.length===0)?[v.HH.create("Branches"),...await Promise.all(Yt.filter(Kt=>!Kt.remote).map(Kt=>T.Oh.create(Kt,tt!=null&&(typeof tt=="string"?Kt.ref===tt:tt.includes(Kt.ref)),{buttons:Ze,current:Xt?"checkmark":!1,ref:Xt,status:Xt,type:"remote"}))),v.HH.create("Remote Branches"),...await Promise.all(Yt.filter(Kt=>Kt.remote).map(Kt=>T.Oh.create(Kt,tt!=null&&(typeof tt=="string"?Kt.ref===tt:tt.includes(Kt.ref)),{buttons:Ze,current:Xt?"checkmark":!1,ref:Xt,status:Xt,type:"remote"})))]:Zt!=null&&Zt.length!==0&&(Yt==null||Yt.length===0)?Zt.map(Kt=>T.WG.create(Kt,tt!=null&&(typeof tt=="string"?Kt.ref===tt:tt.includes(Kt.ref)),{buttons:Ze,message:!1,ref:Xt})):[v.HH.create("Branches"),...await Promise.all(Yt.filter(Kt=>!Kt.remote).map(Kt=>T.Oh.create(Kt,tt!=null&&(typeof tt=="string"?Kt.ref===tt:tt.includes(Kt.ref)),{buttons:Ze,current:Xt?"checkmark":!1,ref:Xt,status:Xt}))),v.HH.create("Tags"),...Zt.map(Kt=>T.WG.create(Kt,tt!=null&&(typeof tt=="string"?Kt.ref===tt:tt.includes(Kt.ref)),{buttons:Ze,message:!1,ref:Xt,type:!0})),v.HH.create("Remote Branches"),...await Promise.all(Yt.filter(Kt=>Kt.remote).map(Kt=>T.Oh.create(Kt,tt!=null&&(typeof tt=="string"?Kt.ref===tt:tt.includes(Kt.ref)),{buttons:Ze,current:Xt?"checkmark":!1,ref:Xt,status:Xt,type:"remote"})))]}o(kt,"getBranchesAndOrTags");function Rt(te,ve){return async(Ze,ot)=>{let tt=!1;if(ot.startsWith("#")&&(tt=!0,ot=ot.substring(1)),te==null)return!1;if(Array.isArray(te)){if(te.length!==1)return!1;te=te[0]}if(tt&&ve?.ranges&&b.GitRevision.isRange(ot))return Ze.items=[T.Em.create(ot,te.path,!0,{alwaysShow:!0,buttons:ve?.buttons,ref:!1,icon:!1})],!0;if(!await y.W.instance.git.validateReference(te.path,ot))return tt?(Ze.items=[s.x.create(s.X.Back,!0,{label:"Enter a reference or commit SHA"})],!0):!1;if(!tt&&await y.W.instance.git.hasBranchOrTag(te.path,{filter:{branches:Pt=>Pt.name.includes(ot),tags:Pt=>Pt.name.includes(ot)}}))return!1;const bt=await y.W.instance.git.getCommit(te.path,ot);return Ze.items=[T.zK.create(bt,!0,{alwaysShow:!0,buttons:ve?.buttons,compact:!0,icon:!0})],!0}}o(Rt,"getValidateGitReferenceFn");async function*Dt(te,ve,Ze){const ot=li.createInputStep({title:Fe(`${ve.title}${Ze.titleContext??""}`,te,ve),placeholder:Ze.placeholder,value:Ze.value,prompt:"Enter branch name",validate:async bt=>{if(bt==null)return[!1,void 0];if(bt=bt.trim(),bt.length===0)return[!1,"Please enter a valid branch name"];if("repo"in te){const Ft=await y.W.instance.git.validateBranchOrTagName(te.repo.path,bt);return[Ft,Ft?void 0:`'${bt}' isn't a valid branch name`]}let Pt=!0;for(const Ft of te.repos)if(Pt=await y.W.instance.git.validateBranchOrTagName(Ft.path,bt),!Pt)return[!1,`'${bt}' isn't a valid branch name`];return[!0,void 0]}}),tt=yield ot;return!li.canStepContinue(ot,te,tt)||!await li.canInputStepContinue(ot,te,tt)?Ii.Break:tt}o(Dt,"inputBranchNameStep");async function*ri(te,ve,Ze){const ot=li.createInputStep({title:Fe(`${ve.title}${Ze.titleContext??""}`,te,ve),placeholder:Ze.placeholder,value:Ze.value,prompt:"Enter tag name",validate:async bt=>{if(bt==null)return[!1,void 0];if(bt=bt.trim(),bt.length===0)return[!1,"Please enter a valid tag name"];if("repo"in te){const Ft=await y.W.instance.git.validateBranchOrTagName(te.repo.path,bt);return[Ft,Ft?void 0:`'${bt}' isn't a valid tag name`]}let Pt=!0;for(const Ft of te.repos)if(Pt=await y.W.instance.git.validateBranchOrTagName(Ft.path,bt),!Pt)return[!1,`'${bt}' isn't a valid branch name`];return[!0,void 0]}}),tt=yield ot;return!li.canStepContinue(ot,te,tt)||!await li.canInputStepContinue(ot,te,tt)?Ii.Break:tt}o(ri,"inputTagNameStep");async function*jt(te,ve,{filter:Ze,picked:ot,placeholder:tt,titleContext:bt}){const Pt=await Je(te.repo,{buttons:[I.rO.RevealInSideBar],filter:Ze,picked:ot}),Ft=li.createPickStep({title:Fe(`${ve.title}${bt??""}`,te,ve),placeholder:Pt.length===0?`No branches found in ${te.repo.formattedName}`:tt,matchOnDetail:!0,items:Pt.length===0?[s.x.create(s.X.Back,!0),s.x.create(s.X.Cancel)]:Pt,onDidClickItemButton:(oi,Ut,{item:si})=>{Ut===I.rO.RevealInSideBar&&Lt.u.Branch.reveal(si,{select:!0,focus:!1,expand:!0})},keys:["right","alt+right","ctrl+right"],onDidPressKey:async oi=>{oi.activeItems.length!==0&&await Lt.u.Branch.reveal(oi.activeItems[0].item,{select:!0,focus:!1,expand:!0})}}),ni=yield Ft;return li.canPickStepContinue(Ft,te,ni)?ni[0].item:Ii.Break}o(jt,"pickBranchStep");async function*qt(te,ve,{filter:Ze,picked:ot,placeholder:tt,sort:bt,titleContext:Pt}){const Ft=await Je(te.repo,{buttons:[I.rO.RevealInSideBar],filter:Ze,picked:ot,sort:bt}),ni=li.createPickStep({multiselect:Ft.length!==0,title:Fe(`${ve.title}${Pt??""}`,te,ve),placeholder:Ft.length===0?`No branches found in ${te.repo.formattedName}`:tt,matchOnDetail:!0,items:Ft.length===0?[s.x.create(s.X.Back,!0),s.x.create(s.X.Cancel)]:Ft,onDidClickItemButton:(Ut,si,{item:Yt})=>{si===I.rO.RevealInSideBar&&Lt.u.Branch.reveal(Yt,{select:!0,focus:!1,expand:!0})},keys:["right","alt+right","ctrl+right"],onDidPressKey:async Ut=>{Ut.activeItems.length!==0&&await Lt.u.Branch.reveal(Ut.activeItems[0].item,{select:!0,focus:!1,expand:!0})}}),oi=yield ni;return li.canPickStepContinue(ni,te,oi)?oi.map(Ut=>Ut.item):Ii.Break}o(qt,"pickBranchesStep");async function*Ht(te,ve,{filter:Ze,picked:ot,placeholder:tt,titleContext:bt,value:Pt,additionalButtons:Ft,ranges:ni}){ve.showTags=!0;const oi=new I.rO.ShowTagsToggle(ve.showTags),Ut=o(async()=>kt(te.repo,ve.showTags?["branches","tags"]:["branches"],{buttons:typeof ve.pickCommitForItem=="boolean"?[I.rO.PickCommit,I.rO.RevealInSideBar]:[I.rO.RevealInSideBar],filter:Ze,picked:ot,sort:!0}),"getBranchesAndOrTagsFn"),si=await Ut(),Yt=li.createPickStep({title:Fe(`${ve.title}${bt??""}`,te,ve),placeholder:si.length===0?`No branches${ve.showTags?" or tags":""} found in ${te.repo.formattedName}`:`${typeof tt=="string"?tt:tt(ve)}${w.NE.Space.repeat(3)}(or enter a reference using #)`,matchOnDescription:!0,matchOnDetail:!0,value:Pt,items:si.length===0?[s.x.create(s.X.Back,!0),s.x.create(s.X.Cancel)]:si,additionalButtons:[...Ft??[],oi],onDidClickItemButton:(Xt,Kt,{item:Wi})=>Kt===I.rO.PickCommit?(ve.pickCommitForItem=!0,!0):(Kt===I.rO.RevealInSideBar&&(b.GitReference.isBranch(Wi)?Lt.u.Branch.reveal(Wi,{select:!0,focus:!1,expand:!0}):b.GitReference.isTag(Wi)?Lt.u.Tag.reveal(Wi,{select:!0,focus:!1,expand:!0}):b.GitReference.isRevision(Wi)&&Lt.u.Commit.reveal(Wi,{select:!0,focus:!1,expand:!0})),!1),onDidClickButton:async(Xt,Kt)=>{if(Kt===oi){Xt.busy=!0,Xt.enabled=!1;try{ve.showTags=!ve.showTags,oi.on=ve.showTags;const Wi=await Ut();Xt.placeholder=Wi.length===0?`${te.repo.formattedName} has no branches${ve.showTags?" or tags":""}`:`${typeof tt=="string"?tt:tt(ve)}${w.NE.Space.repeat(3)}(or enter a reference using #)`,Xt.items=Wi}finally{Xt.busy=!1,Xt.enabled=!0}}},keys:["right","alt+right","ctrl+right"],onDidPressKey:Xt=>{if(Xt.activeItems.length===0)return;const Kt=Xt.activeItems[0].item;b.GitReference.isBranch(Kt)?Lt.u.Branch.reveal(Kt,{select:!0,focus:!1,expand:!0}):b.GitReference.isTag(Kt)?Lt.u.Tag.reveal(Kt,{select:!0,focus:!1,expand:!0}):b.GitReference.isRevision(Kt)&&Lt.u.Commit.reveal(Kt,{select:!0,focus:!1,expand:!0})},onValidateValue:Rt(te.repo,{ranges:ni})}),Zt=yield Yt;return li.canPickStepContinue(Yt,te,Zt)?Zt[0].item:Ii.Break}o(Ht,"pickBranchOrTagStep");async function*vi(te,ve,{filter:Ze,picked:ot,placeholder:tt,titleContext:bt,value:Pt}){ve.showTags=te.repos.length===1;const Ft=new I.rO.ShowTagsToggle(ve.showTags),ni=o(()=>{var Yt;return kt(te.repos,ve.showTags?["branches","tags"]:["branches"],{buttons:[I.rO.RevealInSideBar],filter:we({branches:te.repos.length===1?void 0:Zt=>!Zt.remote},Ze),picked:ot??((Yt=te.reference)==null?void 0:Yt.ref),sort:{branches:{orderBy:f.Vz.DateDesc},tags:{orderBy:f.RV.DateDesc}}})},"getBranchesAndOrTagsFn"),oi=await ni(),Ut=li.createPickStep({title:Fe(`${ve.title}${bt??""}`,te,ve),placeholder:oi.length===0?`No ${te.repos.length===1?"":"common "}branches${ve.showTags?" or tags":""} found in ${te.repos.length===1?te.repos[0].formattedName:`${te.repos.length} repositories`}`:`${typeof tt=="string"?tt:tt(ve)}${w.NE.Space.repeat(3)}(or enter a reference using #)`,matchOnDescription:!0,matchOnDetail:!0,value:Pt??(b.GitReference.isRevision(te.reference)?te.reference.ref:void 0),items:oi.length===0?[s.x.create(s.X.Back,!0),s.x.create(s.X.Cancel)]:oi,additionalButtons:[Ft],onDidClickItemButton:(Yt,Zt,{item:Xt})=>{Zt===I.rO.RevealInSideBar&&(b.GitReference.isBranch(Xt)?Lt.u.Branch.reveal(Xt,{select:!0,focus:!1,expand:!0}):b.GitReference.isTag(Xt)?Lt.u.Tag.reveal(Xt,{select:!0,focus:!1,expand:!0}):b.GitReference.isRevision(Xt)&&Lt.u.Commit.reveal(Xt,{select:!0,focus:!1,expand:!0}))},onDidClickButton:async(Yt,Zt)=>{if(Zt===Ft){Yt.busy=!0,Yt.enabled=!1;try{ve.showTags=!ve.showTags,Ft.on=ve.showTags;const Xt=await ni();Yt.placeholder=Xt.length===0?`No ${te.repos.length===1?"":"common "}branches${ve.showTags?" or tags":""} found in ${te.repos.length===1?te.repos[0].formattedName:`${te.repos.length} repositories`}`:`${typeof tt=="string"?tt:tt(ve)}${w.NE.Space.repeat(3)}(or enter a reference using #)`,Yt.items=Xt}finally{Yt.busy=!1,Yt.enabled=!0}}},keys:["right","alt+right","ctrl+right"],onDidPressKey:Yt=>{if(Yt.activeItems.length===0)return;const Zt=Yt.activeItems[0].item;b.GitReference.isBranch(Zt)?Lt.u.Branch.reveal(Zt,{select:!0,focus:!1,expand:!0}):b.GitReference.isTag(Zt)?Lt.u.Tag.reveal(Zt,{select:!0,focus:!1,expand:!0}):b.GitReference.isRevision(Zt)&&Lt.u.Commit.reveal(Zt,{select:!0,focus:!1,expand:!0})},onValidateValue:Rt(te.repos)}),si=yield Ut;return li.canPickStepContinue(Ut,te,si)?si[0].item:Ii.Break}o(vi,"pickBranchOrTagStepMultiRepo");async function*ii(te,ve,{ignoreFocusOut:Ze,log:ot,onDidLoadMore:tt,picked:bt,placeholder:Pt,showInSideBarCommand:Ft,showInSideBarButton:ni,titleContext:oi}){function Ut(Zt){return Zt==null?[s.x.create(s.X.Back,!0),s.x.create(s.X.Cancel)]:[...(0,Ai.UI)(Zt.commits.values(),Xt=>T.zK.create(Xt,bt!=null&&(typeof bt=="string"?Xt.ref===bt:bt.includes(Xt.ref)),{buttons:[I.rO.RevealInSideBar,I.rO.SearchInSideBar],compact:!0,icon:!0})),...Zt?.hasMore?[s.x.create(s.X.LoadMore)]:[]]}o(Ut,"getItems");const si=li.createPickStep({title:Fe(`${ve.title}${oi??""}`,te,ve),placeholder:typeof Pt=="string"?Pt:Pt(ve,ot),ignoreFocusOut:Ze,matchOnDescription:!0,matchOnDetail:!0,value:typeof bt=="string"&&ot?.count===0?bt:void 0,items:Ft!=null?[Ft,...Ut(ot)]:Ut(ot),onDidLoadMore:async Zt=>{var Xt;return Zt.keepScrollPosition=!0,ot=await((Xt=ot?.more)==null?void 0:Xt.call(ot,f.DN.get("advanced.maxListItems"))),tt?.(ot),typeof Pt!="string"&&(Zt.placeholder=Pt(ve,ot)),Ut(ot)},additionalButtons:[...ni?.button!=null?[ni?.button]:[],...ot?.hasMore?[I.rO.LoadMore]:[]],onDidClickItemButton:(Zt,Xt,Kt)=>{if(!v.$w.is(Kt))switch(Xt){case I.rO.RevealInSideBar:Lt.u.Commit.reveal(Kt.item,{select:!0,focus:!1,expand:!0});break;case I.rO.SearchInSideBar:y.W.instance.searchAndCompareView.search(te.repo.path,{pattern:L.n.fromCommit(Kt.item.ref)},{label:{label:`for ${b.GitReference.toString(Kt.item,{icon:!1})}`},reveal:{select:!0,focus:!1,expand:!0}});break}},onDidClickButton:(Zt,Xt)=>{if(ot==null)return;const Kt=Zt.activeItems.filter(Wi=>!v.$w.is(Wi));Xt===ni?.button&&ni.onDidClick(Kt)},keys:["right","alt+right","ctrl+right"],onDidPressKey:async(Zt,Xt)=>{if(Zt.activeItems.length===0)return;const Kt=Zt.activeItems.filter(Wi=>!v.$w.is(Wi));if(Xt==="ctrl+right")await Lt.u.Commit.reveal(Kt[0].item,{select:!0,focus:!1,expand:!0});else{const Wi=Kt[0].item;await y.W.instance.searchAndCompareView.search(Wi.repoPath,{pattern:L.n.fromCommit(Wi)},{label:{label:`for ${b.GitReference.toString(Wi,{icon:!1})}`},reveal:{select:!0,focus:!1,expand:!0}})}},onValidateValue:Rt(te.repo,{buttons:[I.rO.RevealInSideBar,I.rO.SearchInSideBar]})}),Yt=yield si;return li.canPickStepContinue(si,te,Yt)?v.$w.is(Yt[0])?(li.endSteps(te),await Yt[0].execute(),Ii.Break):Yt[0].item:Ii.Break}o(ii,"pickCommitStep");function*ar(te,ve,{log:Ze,onDidLoadMore:ot,picked:tt,placeholder:bt,titleContext:Pt}){function Ft(Ut){return Ut==null?[s.x.create(s.X.Back,!0),s.x.create(s.X.Cancel)]:[...(0,Ai.UI)(Ut.commits.values(),si=>T.zK.create(si,tt!=null&&(typeof tt=="string"?si.ref===tt:tt.includes(si.ref)),{buttons:[I.rO.RevealInSideBar,I.rO.SearchInSideBar],compact:!0,icon:!0}))]}o(Ft,"getItems");const ni=li.createPickStep({title:Fe(`${ve.title}${Pt??""}`,te,ve),multiselect:Ze!=null,placeholder:typeof bt=="string"?bt:bt(ve,Ze),matchOnDescription:!0,matchOnDetail:!0,items:Ft(Ze),onDidLoadMore:async Ut=>{var si;return Ut.keepScrollPosition=!0,Ze=await((si=Ze?.more)==null?void 0:si.call(Ze,f.DN.get("advanced.maxListItems"))),ot?.(Ze),typeof bt!="string"&&(Ut.placeholder=bt(ve,Ze)),Ft(Ze)},additionalButtons:[...Ze?.hasMore?[I.rO.LoadMore]:[]],onDidClickItemButton:(Ut,si,{item:Yt})=>{switch(si){case I.rO.RevealInSideBar:Lt.u.Commit.reveal(Yt,{select:!0,focus:!1,expand:!0});break;case I.rO.SearchInSideBar:y.W.instance.searchAndCompareView.search(te.repo.path,{pattern:L.n.fromCommit(Yt.ref)},{label:{label:`for ${b.GitReference.toString(Yt,{icon:!1})}`},reveal:{select:!0,focus:!1,expand:!0}});break}},keys:["right","alt+right","ctrl+right"],onDidPressKey:async(Ut,si)=>{if(Ut.activeItems.length!==0)if(si==="ctrl+right")await Lt.u.Commit.reveal(Ut.activeItems[0].item,{select:!0,focus:!1,expand:!0});else{const Yt=Ut.activeItems[0].item;await y.W.instance.searchAndCompareView.search(Yt.repoPath,{pattern:L.n.fromCommit(Yt)},{label:{label:`for ${b.GitReference.toString(Yt,{icon:!1})}`},reveal:{select:!0,focus:!1,expand:!0}})}}}),oi=yield ni;return li.canPickStepContinue(ni,te,oi)?oi.map(Ut=>Ut.item):Ii.Break}o(ar,"pickCommitsStep");async function*Rr(te,ve,Ze="Choose contributors"){var ot;const tt=(ot=await y.W.instance.git.getOrOpenScmRepository(te.repo.path))==null?void 0:ot.inputBox.value,bt=li.createPickStep({title:Fe(ve.title,te,ve),allowEmpty:!0,multiselect:!0,placeholder:Ze,matchOnDescription:!0,items:(await y.W.instance.git.getContributors(te.repo.path)).map(Ft=>T.YG.create(Ft,tt?.includes(Ft.getCoauthor()),{buttons:[I.rO.RevealInSideBar]})),onDidClickItemButton:(Ft,ni,{item:oi})=>{ni===I.rO.RevealInSideBar&&Lt.u.Contributor.reveal(oi,{select:!0,focus:!1,expand:!0})},keys:["right","alt+right","ctrl+right"],onDidPressKey:Ft=>{Ft.activeItems.length!==0&&Lt.u.Contributor.reveal(Ft.activeItems[0].item,{select:!0,focus:!1,expand:!0})}}),Pt=yield bt;return li.canPickStepContinue(bt,te,Pt)?Pt.map(Ft=>Ft.item):Ii.Break}o(Rr,"pickContributorsStep");async function*ze(te,ve,Ze="Choose a repository"){if(typeof te.repo=="string"&&(te.repo=y.W.instance.git.getRepository(te.repo),te.repo!=null))return te.repo;const ot=te.repo??await y.W.instance.git.getOrOpenRepositoryForEditor(),tt=li.createPickStep({title:ve.title,placeholder:Ze,items:ve.repos.length===0?[s.x.create(s.X.Cancel)]:await Promise.all(ve.repos.map(Pt=>T.JF.create(Pt,Pt.id===ot?.id,{branch:!0,buttons:[I.rO.RevealInSideBar],fetched:!0,status:!0}))),onDidClickItemButton:(Pt,Ft,{item:ni})=>{Ft===I.rO.RevealInSideBar&&Lt.u.Repository.reveal(ni.path,ve.associatedView,{select:!0,focus:!1,expand:!0})},keys:["right","alt+right","ctrl+right"],onDidPressKey:Pt=>{Pt.activeItems.length!==0&&Lt.u.Repository.reveal(Pt.activeItems[0].item.path,ve.associatedView,{select:!0,focus:!1,expand:!0})}}),bt=yield tt;return li.canPickStepContinue(tt,te,bt)?bt[0].item:Ii.Break}o(ze,"pickRepositoryStep");async function*$e(te,ve,Ze){Ze=we({placeholder:"Choose repositories",skipIfPossible:!1},Ze);let ot;if(te.repos!=null)if((0,F.GI)(te.repos)){if(ot=(0,F.DZ)(te.repos,Pt=>ve.repos.find(Ft=>Ft.path===Pt)),Ze.skipIfPossible&&ot.length!==0&&te.repos.length===ot.length)return ot}else ot=te.repos;else{const Pt=await y.W.instance.git.getOrOpenRepositoryForEditor();ot=Pt!=null?[Pt]:[]}const tt=li.createPickStep({multiselect:!0,title:ve.title,placeholder:Ze.placeholder,items:ve.repos.length===0?[s.x.create(s.X.Cancel)]:await Promise.all(ve.repos.map(Pt=>T.JF.create(Pt,ot.some(Ft=>Ft.id===Pt.id),{branch:!0,buttons:[I.rO.RevealInSideBar],fetched:!0,status:!0}))),onDidClickItemButton:(Pt,Ft,{item:ni})=>{Ft===I.rO.RevealInSideBar&&Lt.u.Repository.reveal(ni.path,ve.associatedView,{select:!0,focus:!1,expand:!0})},keys:["right","alt+right","ctrl+right"],onDidPressKey:Pt=>{Pt.activeItems.length!==0&&Lt.u.Repository.reveal(Pt.activeItems[0].item.path,ve.associatedView,{select:!0,focus:!1,expand:!0})}}),bt=yield tt;return li.canPickStepContinue(tt,te,bt)?bt.map(Pt=>Pt.item):Ii.Break}o($e,"pickRepositoriesStep");function*ke(te,ve,{ignoreFocusOut:Ze,stash:ot,picked:tt,placeholder:bt,titleContext:Pt}){const Ft=li.createPickStep({title:Fe(`${ve.title}${Pt??""}`,te,ve),placeholder:typeof bt=="string"?bt:bt(ve,ot),ignoreFocusOut:Ze,matchOnDescription:!0,matchOnDetail:!0,items:ot==null?[s.x.create(s.X.Back,!0),s.x.create(s.X.Cancel)]:[...(0,Ai.UI)(ot.commits.values(),oi=>T.zK.create(oi,tt!=null&&(typeof tt=="string"?oi.ref===tt:tt.includes(oi.ref)),{buttons:[I.rO.RevealInSideBar],compact:!0,icon:!0}))],onDidClickItemButton:(oi,Ut,{item:si})=>{Ut===I.rO.RevealInSideBar&&Lt.u.Stash.reveal(si,{select:!0,focus:!1,expand:!0})},keys:["right","alt+right","ctrl+right"],onDidPressKey:async oi=>{oi.activeItems.length!==0&&await Lt.u.Stash.reveal(oi.activeItems[0].item,{select:!0,focus:!1,expand:!0})}}),ni=yield Ft;return li.canPickStepContinue(Ft,te,ni)?ni[0].item:Ii.Break}o(ke,"pickStashStep");async function*Ge(te,ve,{filter:Ze,picked:ot,placeholder:tt,titleContext:bt}){const Pt=await dt(te.repo,{buttons:[I.rO.RevealInSideBar],filter:Ze,picked:ot}),Ft=li.createPickStep({multiselect:Pt.length!==0,title:Fe(`${ve.title}${bt??""}`,te,ve),placeholder:Pt.length===0?`No tags found in ${te.repo.formattedName}`:tt,matchOnDetail:!0,items:Pt.length===0?[s.x.create(s.X.Back,!0),s.x.create(s.X.Cancel)]:Pt,onDidClickItemButton:(oi,Ut,{item:si})=>{Ut===I.rO.RevealInSideBar&&Lt.u.Tag.reveal(si,{select:!0,focus:!1,expand:!0})},keys:["right","alt+right","ctrl+right"],onDidPressKey:async oi=>{oi.activeItems.length!==0&&await Lt.u.Tag.reveal(oi.activeItems[0].item,{select:!0,focus:!1,expand:!0})}}),ni=yield Ft;return li.canPickStepContinue(Ft,te,ni)?ni.map(oi=>oi.item):Ii.Break}o(Ge,"pickTagsStep");async function*Ke(te,ve,{filter:Ze,includeStatus:ot,picked:tt,placeholder:bt,titleContext:Pt}){const Ft=await ft(ve.worktrees??te.repo,{buttons:[I.rO.OpenInNewWindow,I.rO.RevealInSideBar],filter:Ze,includeStatus:ot,picked:tt}),ni=li.createPickStep({title:Fe(`${ve.title}${Pt??""}`,te,ve),placeholder:Ft.length===0?`No worktrees found in ${te.repo.formattedName}`:bt,matchOnDetail:!0,items:Ft.length===0?[s.x.create(s.X.Back,!0),s.x.create(s.X.Cancel)]:Ft,onDidClickItemButton:(Ut,si,{item:Yt})=>{switch(si){case I.rO.OpenInNewWindow:Lt.u.Worktree.open(Yt,{location:Pi.Tc.NewWindow});break;case I.rO.RevealInSideBar:Lt.u.Worktree.reveal(Yt,{select:!0,focus:!1,expand:!0});break}},keys:["right","alt+right","ctrl+right"],onDidPressKey:async Ut=>{Ut.activeItems.length!==0&&await Lt.u.Worktree.reveal(Ut.activeItems[0].item,{select:!0,focus:!1,expand:!0})}}),oi=yield ni;return li.canPickStepContinue(ni,te,oi)?oi[0].item:Ii.Break}o(Ke,"pickWorktreeStep");async function*Oe(te,ve,{filter:Ze,includeStatus:ot,picked:tt,placeholder:bt,titleContext:Pt}){const Ft=await ft(ve.worktrees??te.repo,{buttons:[I.rO.OpenInNewWindow,I.rO.RevealInSideBar],filter:Ze,includeStatus:ot,picked:tt}),ni=li.createPickStep({multiselect:Ft.length!==0,title:Fe(`${ve.title}${Pt??""}`,te,ve),placeholder:Ft.length===0?`No worktrees found in ${te.repo.formattedName}`:bt,matchOnDetail:!0,items:Ft.length===0?[s.x.create(s.X.Back,!0),s.x.create(s.X.Cancel)]:Ft,onDidClickItemButton:(Ut,si,{item:Yt})=>{switch(si){case I.rO.OpenInNewWindow:Lt.u.Worktree.open(Yt,{location:Pi.Tc.NewWindow});break;case I.rO.RevealInSideBar:Lt.u.Worktree.reveal(Yt,{select:!0,focus:!1,expand:!0});break}},keys:["right","alt+right","ctrl+right"],onDidPressKey:async Ut=>{Ut.activeItems.length!==0&&await Lt.u.Worktree.reveal(Ut.activeItems[0].item,{select:!0,focus:!1,expand:!0})}}),oi=yield ni;return li.canPickStepContinue(ni,te,oi)?oi.map(Ut=>Ut.item):Ii.Break}o(Oe,"pickWorktreesStep");async function*Se(te,ve){const Ze=li.createPickStep({title:Fe(b.GitReference.toString(te.reference,{capitalize:!0,icon:!1}),te,ve),placeholder:b.GitReference.toString(te.reference,{capitalize:!0,icon:!1}),ignoreFocusOut:!0,items:await Xe(te),onDidClickItemButton:(tt,bt,Pt)=>{if(bt===I.rO.SearchInSideBar){y.W.instance.searchAndCompareView.search(te.repo.path,{pattern:L.n.fromCommit(te.reference.ref)},{label:{label:`for ${b.GitReference.toString(te.reference,{icon:!1})}`},reveal:{select:!0,focus:!1,expand:!0}});return}bt===I.rO.RevealInSideBar&&(b.GitReference.isStash(te.reference)?Lt.u.Stash.reveal(te.reference,{select:!0,focus:!1,expand:!0}):Lt.u.Commit.reveal(te.reference,{select:!0,focus:!1,expand:!0}))},keys:["right","alt+right","ctrl+right"],onDidPressKey:async(tt,bt)=>{tt.activeItems.length!==0&&await tt.activeItems[0].onDidPressKey(bt)}}),ot=yield Ze;return li.canPickStepContinue(Ze,te,ot)?ot[0]:Ii.Break}o(Se,"showCommitOrStashStep");async function Xe(te){const ve=[];let Ze;if(b.GitCommit.isStash(te.reference))ve.push(v.HH.create("Actions"),new T.Wv("Apply Stash...",{command:"stash",state:{subcommand:"apply",repo:te.repo,reference:te.reference}}),new T.Wv("Delete Stash...",{command:"stash",state:{subcommand:"drop",repo:te.repo,reference:te.reference}}),v.HH.create(),new A.NC(te.reference));else{const ot=await y.W.instance.git.getRemotesWithProviders(te.repo.path,{sort:!0});ot?.length&&ve.push(v.HH.create(b.GitRemote.getHighlanderProviderName(ot)??"Remote"),new R.az(ot,{type:$.JD.Commit,sha:te.reference.sha}),new R.eO(ot,{type:$.JD.Commit,sha:te.reference.sha})),ve.push(v.HH.create("Actions"));const tt=await y.W.instance.git.getBranch(te.repo.path),[bt,Pt]=await Promise.all([tt!=null?y.W.instance.git.getCommitBranches(te.repo.path,te.reference.ref,{branch:tt.name,commitDate:b.GitCommit.is(te.reference)?te.reference.committer.date:void 0}):void 0,!tt?.remote&&tt?.upstream!=null?te.reference.isPushed():void 0]);Boolean(bt?.length)?(Ze=!Pt,Ze&&ve.push(new T.Wv("Push to Commit...",{command:"push",state:{repos:te.repo,reference:te.reference}})),ve.push(new T.Wv("Revert Commit...",{command:"revert",state:{repo:te.repo,references:[te.reference]}}),new T.Wv(`Reset ${tt?.name??"Current Branch"} to Commit...`,{command:"reset",state:{repo:te.repo,reference:te.reference}}),new T.Wv(`Reset ${tt?.name??"Current Branch"} to Previous Commit...`,{command:"reset",state:{repo:te.repo,reference:b.GitReference.create(`${te.reference.ref}^`,te.reference.repoPath,{refType:"revision",name:`${te.reference.name}^`,message:te.reference.message})}}))):ve.push(new T.Wv("Cherry Pick Commit...",{command:"cherry-pick",state:{repo:te.repo,references:[te.reference]}})),ve.push(new T.Wv(`Rebase ${tt?.name??"Current Branch"} onto Commit...`,{command:"rebase",state:{repo:te.repo,reference:te.reference}}),new T.Wv("Switch to Commit...",{command:"switch",state:{repos:[te.repo],reference:te.reference}}),v.HH.create(),new T.Wv("Create Branch at Commit...",{command:"branch",state:{subcommand:"create",repo:te.repo,reference:te.reference}}),new T.Wv("Create Tag at Commit...",{command:"tag",state:{subcommand:"create",repo:te.repo,reference:te.reference}}),v.HH.create("Copy"),new A.OT(te.reference),new A.NC(te.reference))}return ve.push(v.HH.create("Open"),new A.CV(te.reference),new A.Y4(te.reference),new A.o$(te.reference),v.HH.create(),new A.lN(te.reference),new A.A1(te.reference)),ve.push(v.HH.create("Compare"),new A.Jw(te.reference),new A.m5(te.reference)),ve.push(v.HH.create(),new A.eG(te.reference),new A.nl(te.reference)),ve.push(v.HH.create("Browse"),new A.Lf(te.reference,{openInNewWindow:!1}),new A.Lf(te.reference,{before:!0,openInNewWindow:!1}),new A.Lf(te.reference,{openInNewWindow:!0}),new A.Lf(te.reference,{before:!0,openInNewWindow:!0})),ve.splice(0,0,new A.PF(te.reference,{unpublished:Ze,hint:"Click to see all changed files"})),ve}o(Xe,"getShowCommitOrStashStepItems");function*lt(te,ve,Ze){var ot;te.reference.files==null;const tt=li.createPickStep({title:Fe(b.GitReference.toString(te.reference,{capitalize:!0,icon:!1}),te,ve),placeholder:b.GitReference.toString(te.reference,{capitalize:!0,icon:!1}),ignoreFocusOut:!0,items:[new A.PF(te.reference,{picked:te.fileName==null,hint:`Click to see ${b.GitCommit.isStash(te.reference)?"stash":"commit"} actions`}),v.HH.create("Files"),...((ot=te.reference.files)==null?void 0:ot.map(Pt=>new A.zr(te.reference,Pt,Ze?.picked===Pt.path)))??[]],matchOnDescription:!0,onDidClickItemButton:(Pt,Ft,ni)=>{if(Ft===I.rO.SearchInSideBar){y.W.instance.searchAndCompareView.search(te.repo.path,{pattern:L.n.fromCommit(te.reference.ref)},{label:{label:`for ${b.GitReference.toString(te.reference,{icon:!1})}`},reveal:{select:!0,focus:!1,expand:!0}});return}Ft===I.rO.RevealInSideBar&&(b.GitReference.isStash(te.reference)?Lt.u.Stash.reveal(te.reference,{select:!0,focus:!1,expand:!0}):Lt.u.Commit.reveal(te.reference,{select:!0,focus:!1,expand:!0}))},keys:["right","alt+right","ctrl+right"],onDidPressKey:async(Pt,Ft)=>{Pt.activeItems.length!==0&&await Pt.activeItems[0].onDidPressKey(Ft)}}),bt=yield tt;return li.canPickStepContinue(tt,te,bt)?bt[0]:Ii.Break}o(lt,"showCommitOrStashFilesStep");async function*gt(te,ve){const Ze=li.createPickStep({title:Fe(b.GitReference.toString(te.reference,{capitalize:!0,icon:!1}),te,ve,`${(0,Ti.vk)(w.NE.Dot,2,2)}${(0,Gt.d)(te.fileName,{fileOnly:!0})}`),placeholder:`${(0,Gt.d)(te.fileName,{relativeTo:te.repo.path})} in ${b.GitReference.toString(te.reference,{icon:!1})}`,ignoreFocusOut:!0,items:await _t(te),matchOnDescription:!0,onDidClickItemButton:(tt,bt,Pt)=>{if(bt===I.rO.SearchInSideBar){y.W.instance.searchAndCompareView.search(te.repo.path,{pattern:L.n.fromCommit(te.reference.ref)},{label:{label:`for ${b.GitReference.toString(te.reference,{icon:!1})}`},reveal:{select:!0,focus:!1,expand:!0}});return}bt===I.rO.RevealInSideBar&&(b.GitReference.isStash(te.reference)?Lt.u.Stash.reveal(te.reference,{select:!0,focus:!1,expand:!0}):Lt.u.Commit.reveal(te.reference,{select:!0,focus:!1,expand:!0}))},keys:["right","alt+right","ctrl+right"],onDidPressKey:async(tt,bt)=>{tt.activeItems.length!==0&&await tt.activeItems[0].onDidPressKey(bt)}}),ot=yield Ze;return li.canPickStepContinue(Ze,te,ot)?ot[0]:Ii.Break}o(gt,"showCommitOrStashFileStep");async function _t(te){const ve=await te.reference.findFile(te.fileName);if(ve==null)return[];const Ze=[];if(b.GitCommit.isStash(te.reference))Ze.push(v.HH.create(),new A.NC(te.reference),v.HH.create("Actions"),new A.do(te.reference,ve),new A.QP(te.reference,ve),v.HH.create(),new A.NC(te.reference));else{const ot=await y.W.instance.git.getRemotesWithProviders(te.repo.path,{sort:!0});ot?.length&&Ze.push(v.HH.create(b.GitRemote.getHighlanderProviderName(ot)??"Remote"),new R.az(ot,{type:$.JD.Revision,fileName:te.fileName,commit:te.reference}),new R.eO(ot,{type:$.JD.Revision,fileName:te.fileName,commit:te.reference}),v.HH.create(),new R.az(ot,{type:$.JD.Commit,sha:te.reference.ref}),new R.eO(ot,{type:$.JD.Commit,sha:te.reference.sha})),Ze.push(v.HH.create("Actions"),new A.do(te.reference,ve),new A.QP(te.reference,ve),v.HH.create("Copy"),new A.OT(te.reference),new A.NC(te.reference))}return Ze.push(v.HH.create("Open"),new A.lp(te.reference,te.fileName),new A.aU(te.reference,te.fileName),new A.xL(te.reference,te.fileName),v.HH.create()),ve.status!=="D"&&Ze.push(new A.ZO(te.reference,ve)),Ze.push(new A.Wt(te.reference,ve)),Ze.push(v.HH.create("Compare"),new A.Jw(te.reference),new A.m5(te.reference)),Ze.push(v.HH.create("Browse"),new A.Lf(te.reference,{openInNewWindow:!1}),new A.Lf(te.reference,{before:!0,openInNewWindow:!1}),new A.Lf(te.reference,{openInNewWindow:!0}),new A.Lf(te.reference,{before:!0,openInNewWindow:!0})),Ze.splice(0,0,new A.PF(te.reference,{file:ve,hint:"Click to see all changed files"})),Ze}o(_t,"getShowCommitOrStashFileStepItems");function*It(te,ve){const Ze=ve.status.getUpstreamStatus({expand:!0,separator:", "}),ot=ve.status.getFormattedDiffStatus({expand:!0,separator:", "}),tt=li.createPickStep({title:Fe(ve.title,te,ve),placeholder:`${Ze?`${Ze}, ${ot}`:ot}`,ignoreFocusOut:!0,items:Qt(te,ve),keys:["right","alt+right","ctrl+right"],onDidPressKey:async(Pt,Ft)=>{Pt.activeItems.length!==0&&await Pt.activeItems[0].onDidPressKey(Ft)}}),bt=yield tt;return li.canPickStepContinue(tt,te,bt)?bt[0]:Ii.Break}o(It,"showRepositoryStatusStep");function Qt(te,ve){const Ze=[],ot=ve.status.computeWorkingTreeStatus();let tt;return ot.staged===0&&ot.unstaged===0?tt="No working tree changes":tt=`$(files) ${ot.staged?`${(0,Ti._6)("staged file",ot.staged)} (${ot.stagedStatus})`:""}${ot.unstaged?`${ot.staged?", ":""}${(0,Ti._6)("unstaged file",ot.unstaged)} (${ot.unstagedStatus})`:""}`,ve.status.upstream?(ve.status.state.ahead===0&&ve.status.state.behind===0?Ze.push(s.x.create(s.X.Noop,!0,{label:`$(git-branch) ${ve.status.branch} is up to date with $(git-branch) ${ve.status.upstream}`,detail:tt})):ve.status.state.ahead!==0&&ve.status.state.behind!==0?Ze.push(s.x.create(s.X.Noop,!0,{label:`$(git-branch) ${ve.status.branch} has diverged from $(git-branch) ${ve.status.upstream}`,detail:tt})):ve.status.state.ahead!==0?Ze.push(s.x.create(s.X.Noop,!0,{label:`$(git-branch) ${ve.status.branch} is ahead of $(git-branch) ${ve.status.upstream}`,detail:tt})):ve.status.state.behind!==0&&Ze.push(s.x.create(s.X.Noop,!0,{label:`$(git-branch) ${ve.status.branch} is behind $(git-branch) ${ve.status.upstream}`,detail:tt})),ve.status.state.behind!==0&&Ze.push(new T.Wv(`$(cloud-download) ${(0,Ti._6)("commit",ve.status.state.behind)} behind`,{command:"log",state:{repo:te.repo,reference:b.GitReference.create(b.GitRevision.createRange(ve.status.ref,ve.status.upstream),te.repo.path)}})),ve.status.state.ahead!==0&&Ze.push(new T.Wv(`$(cloud-upload) ${(0,Ti._6)("commit",ve.status.state.ahead)} ahead`,{command:"log",state:{repo:te.repo,reference:b.GitReference.create(b.GitRevision.createRange(ve.status.upstream,ve.status.ref),te.repo.path)}}))):Ze.push(s.x.create(s.X.Noop,!0,{label:`$(git-branch) ${ve.status.branch} has no upstream`,detail:tt})),ve.status.files.length&&Ze.push(new A.K6(ot.stagedAddsAndChanges.concat(ot.unstagedAddsAndChanges))),ot.staged>0&&Ze.push(new A.K6(ot.stagedAddsAndChanges,{label:"$(files) Open Staged Files"})),ot.unstaged>0&&Ze.push(new A.K6(ot.unstagedAddsAndChanges,{label:"$(files) Open Unstaged Files"})),ve.status.files.length&&Ze.push(new v.$w("$(x) Close Unchanged Files",w.Gh.CloseUnchangedFiles)),Ze}o(Qt,"getShowRepositoryStatusStepItems");async function*ui(te,ve,Ze){var ot;const tt=await y.W.instance.git.access(Ze,te.repo.path);if(tt.allowed)return void 0;const bt=[];let Pt;if(((ot=tt.subscription.current.account)==null?void 0:ot.verified)===!1)bt.push(s.x.create(s.X.RequiresVerification,!0)),Pt="You must verify your account email address before you can continue";else{if(tt.subscription.required==null)return void 0;(0,P.aG)(tt.subscription.required)&&tt.subscription.current.account!=null?(bt.push(s.x.create(s.X.RequiresPaidSubscription,!0)),Pt="GitLens+ features require an upgraded account"):(tt.subscription.current.account==null&&!(0,P.gA)(tt.subscription.current)?bt.push(s.x.create(s.X.StartPreviewTrial,!0),s.x.create(s.X.RequiresFreeSubscription)):bt.push(s.x.create(s.X.RequiresFreeSubscription)),Pt="GitLens+ features require a free account")}const Ft=li.createPickStep({title:Fe(ve.title,te,ve),placeholder:Pt,items:[...bt,s.x.create(s.X.Cancel)]}),ni=yield Ft;return li.canPickStepContinue(Ft,te,ni)?void 0:Ii.Break}o(ui,"ensureAccessStep");var zt=Object.defineProperty,di=Object.defineProperties,_i=Object.getOwnPropertyDescriptors,Si=Object.getOwnPropertySymbols,zi=Object.prototype.hasOwnProperty,Yi=Object.prototype.propertyIsEnumerable,Ki=o((te,ve,Ze)=>ve in te?zt(te,ve,{enumerable:!0,configurable:!0,writable:!0,value:Ze}):te[ve]=Ze,"quickCommand_defNormalProp"),nr=o((te,ve)=>{for(var Ze in ve||(ve={}))zi.call(ve,Ze)&&Ki(te,Ze,ve[Ze]);if(Si)for(var Ze of Si(ve))Yi.call(ve,Ze)&&Ki(te,Ze,ve[Ze]);return te},"quickCommand_spreadValues"),ir=o((te,ve)=>di(te,_i(ve)),"__spreadProps"),Zi=o((te,ve,Ze)=>(Ki(te,typeof ve!="symbol"?ve+"":ve,Ze),Ze),"__publicField");function Qi(te){return typeof te=="object"&&te.show!=null}o(Qi,"isCustomStep");function or(te){return typeof te=="object"&&te.items==null&&te.show==null}o(or,"isQuickInputStep");function fr(te){return typeof te=="object"&&te.items!=null}o(fr,"isQuickPickStep");var Ii;(te=>{te.Break=Symbol("BreakStep")})(Ii||(Ii={}));class li{constructor(ve,Ze,ot,tt,bt={}){this.container=ve,this.key=Ze,this.label=ot,this.title=tt,Zi(this,"description"),Zi(this,"detail"),Zi(this,"initialState"),Zi(this,"_currentStep"),Zi(this,"_stepsIterator"),Zi(this,"_picked",!1),Zi(this,"_pickedVia","menu"),this.description=bt.description,this.detail=bt.detail}get canConfirm(){return!0}get canSkipConfirm(){return!0}get picked(){return this._picked}set picked(ve){this._picked=ve,ve||(this._pickedVia="menu")}get pickedVia(){return this._pickedVia}set pickedVia(ve){this._pickedVia=ve}get skipConfirmKey(){return`${this.key}:${this.pickedVia}`}get value(){return this._currentStep}confirm(ve){return!this.canConfirm||!this.canSkipConfirm?!0:ve??!this.container.config.gitCommands.skipConfirmations.includes(this.skipConfirmKey)}isMatch(ve){return this.key===ve}isFuzzyMatch(ve){return this.label===ve}executeSteps(){return this.steps(this.getStepState(!0))}async previous(){return(await this.next(s.X.Back)).value}async next(ve){this._stepsIterator==null&&(this._stepsIterator=this.steps(this.getStepState(!1)));const Ze=await this._stepsIterator.next(ve);return Ze.done&&(this.initialState=void 0,this._stepsIterator=void 0),Ze.value===Ii.Break?(this._currentStep=void 0,ir(nr({},Ze),{value:void 0})):(this._currentStep=Ze.value,Ze)}async retry(){return await this.next(s.X.Noop),this.value}canStepsContinue(ve){return ve.counter>=(ve.startingStep??0)}createConfirmStep(ve,Ze,ot,tt={}){return li.createConfirmStep(ve,Ze,{title:this.title},ot,tt)}getStepState(ve){var Ze;return ir(nr({counter:0},this.initialState),{startingStep:ve?((Ze=this.initialState)==null?void 0:Ze.counter)??0:0})}}o(li,"QuickCommand"),(te=>{function ve(Ut){return Ut instanceof te}o(ve,"is"),te.is=ve;async function Ze(Ut,si,Yt){var Zt;if(!tt(Ut,si,Yt))return!1;const[Xt]=await((Zt=Ut.validate)==null?void 0:Zt.call(Ut,Yt))??[!0];return Xt?(si.counter++,!0):!1}o(Ze,"canInputStepContinue"),te.canInputStepContinue=Ze;function ot(Ut,si,Yt){var Zt;return tt(Ut,si,Yt)&&(((Zt=Ut.validate)==null?void 0:Zt.call(Ut,Yt))??!0)?(si.counter++,!0):!1}o(ot,"canPickStepContinue"),te.canPickStepContinue=ot;function tt(Ut,si,Yt){if(Yt==null)return!1;if(s.X.is(Yt)){switch(Yt){case s.X.Back:si.counter--,si.counter<=(si.startingStep??0)&&(si.counter=0);break;case s.X.Cancel:oi(si);break}return!1}return!0}o(tt,"canStepContinue"),te.canStepContinue=tt;function bt(Ut,si,Yt,Zt,Xt={}){return nr({placeholder:`Confirm ${Yt.title}`,title:Ut,ignoreFocusOut:!0,items:[...si,Zt??s.x.create(s.X.Cancel)],selectedItems:[si.find(Kt=>Kt.picked)??si[0]]},Xt)}o(bt,"createConfirmStep"),te.createConfirmStep=bt;function Pt(Ut){return Ut.ignoreFocusOut=!0,Ut}o(Pt,"createInputStep"),te.createInputStep=Pt;function Ft(Ut){return Ut}o(Ft,"createPickStep"),te.createPickStep=Ft;function ni(Ut){return Ut}o(ni,"createCustomStep"),te.createCustomStep=ni;function oi(Ut){Ut.counter=-1}o(oi,"endSteps"),te.endSteps=oi})(li||(li={}))},5078:(Re,ne,g)=>{"use strict";g.d(ne,{n:()=>y,o:()=>w});class s{}o(s,"Comparer");class I extends s{equals($,L,A={exact:!1}){return $===L?!0:$==null||L==null?!1:A.exact?$.toString()===L.toString():$.scheme===L.scheme&&$.fsPath===L.fsPath}}o(I,"UriComparer");class f extends s{equals($,L,A={usePosition:!1}){return $===L?!0:$==null||L==null||A.usePosition&&$.viewColumn!==L.viewColumn?!1:$.document===L.document}}o(f,"TextEditorComparer");const w=new f,y=new I},2078:(Re,ne,g)=>{"use strict";g.d(ne,{CZ:()=>c,DH:()=>E,Dn:()=>v,M7:()=>C,N4:()=>y,RV:()=>x,S4:()=>G,TA:()=>B,TF:()=>s,Uy:()=>b,VP:()=>T,Vc:()=>O,Vn:()=>A,Vz:()=>f,ef:()=>k,hp:()=>w,iP:()=>$,il:()=>P,o9:()=>F,y0:()=>I,zL:()=>R,zW:()=>L});var s=(U=>(U.File="file",U.Window="window",U))(s||{}),I=(U=>(U.Gutter="gutter",U.Line="line",U.Overview="overview",U))(I||{}),f=(U=>(U.DateDesc="date:desc",U.DateAsc="date:asc",U.NameAsc="name:asc",U.NameDesc="name:desc",U))(f||{}),w=(U=>(U.Gutter="gutter",U.Overview="overview",U))(w||{}),y=(U=>(U.CopyRemoteCommitUrl="gitlens.copyRemoteCommitUrl",U.CopyRemoteFileUrl="gitlens.copyRemoteFileUrl",U.DiffWithPrevious="gitlens.diffWithPrevious",U.OpenCommitOnRemote="gitlens.openCommitOnRemote",U.OpenFileOnRemote="gitlens.openFileOnRemote",U.RevealCommitInView="gitlens.revealCommitInView",U.ShowCommitsInView="gitlens.showCommitsInView",U.ShowQuickCommitDetails="gitlens.showQuickCommitDetails",U.ShowQuickCommitFileDetails="gitlens.showQuickCommitFileDetails",U.ShowQuickCurrentBranchHistory="gitlens.showQuickRepoHistory",U.ShowQuickFileHistory="gitlens.showQuickFileHistory",U.ToggleFileBlame="gitlens.toggleFileBlame",U.ToggleFileChanges="gitlens.toggleFileChanges",U.ToggleFileChangesOnly="gitlens.toggleFileChangesOnly",U.ToggleFileHeatmap="gitlens.toggleFileHeatmap",U))(y||{}),b=(U=>(U.Document="document",U.Containers="containers",U.Blocks="blocks",U))(b||{}),$=(U=>(U.CountDesc="count:desc",U.CountAsc="count:asc",U.DateDesc="date:desc",U.DateAsc="date:asc",U.NameAsc="name:asc",U.NameDesc="name:desc",U))($||{}),L=(U=>(U.AzureDevOps="AzureDevOps",U.Bitbucket="Bitbucket",U.BitbucketServer="BitbucketServer",U.Custom="Custom",U.Gerrit="Gerrit",U.Gitea="Gitea",U.GitHub="GitHub",U.GitLab="GitLab",U))(L||{}),A=(U=>(U.Authored="authored",U.Committed="committed",U))(A||{}),v=(U=>(U.Absolute="absolute",U.Relative="relative",U))(v||{}),T=(U=>(U.Blame="blame",U.Changes="changes",U.Heatmap="heatmap",U))(T||{}),R=(U=>(U.Name="name",U.Usage="usage",U))(R||{}),P=(U=>(U.Faces="wavatar",U.Geometric="identicon",U.Monster="monsterid",U.MysteryPerson="mp",U.Retro="retro",U.Robot="robohash",U))(P||{}),F=(U=>(U.Gutter="gutter",U.Overview="overview",U))(F||{}),_=(U=>(U.Alternate="alternate",U.Chorded="chorded",U.None="none",U))(_||{}),C=(U=>(U.Silent="silent",U.Errors="errors",U.Verbose="verbose",U.Debug="debug",U))(C||{}),k=(U=>(U.CopyRemoteCommitUrl="gitlens.copyRemoteCommitUrl",U.CopyRemoteFileUrl="gitlens.copyRemoteFileUrl",U.DiffWithPrevious="gitlens.diffWithPrevious",U.DiffWithWorking="gitlens.diffWithWorking",U.OpenCommitOnRemote="gitlens.openCommitOnRemote",U.OpenFileOnRemote="gitlens.openFileOnRemote",U.RevealCommitInView="gitlens.revealCommitInView",U.ShowCommitsInView="gitlens.showCommitsInView",U.ShowQuickCommitDetails="gitlens.showQuickCommitDetails",U.ShowQuickCommitFileDetails="gitlens.showQuickCommitFileDetails",U.ShowQuickCurrentBranchHistory="gitlens.showQuickRepoHistory",U.ShowQuickFileHistory="gitlens.showQuickFileHistory",U.ToggleCodeLens="gitlens.toggleCodeLens",U.ToggleFileBlame="gitlens.toggleFileBlame",U.ToggleFileChanges="gitlens.toggleFileChanges",U.ToggleFileChangesOnly="gitlens.toggleFileChangesOnly",U.ToggleFileHeatmap="gitlens.toggleFileHeatmap",U))(k||{}),x=(U=>(U.DateDesc="date:desc",U.DateAsc="date:asc",U.NameAsc="name:asc",U.NameDesc="name:desc",U))(x||{}),c=(U=>(U.List="list",U.Tree="tree",U))(c||{}),O=(U=>(U.Auto="auto",U.List="list",U.Tree="tree",U))(O||{}),E=(U=>(U.Branch="branch",U.Working="working",U))(E||{});const B=["defaultItemLimit","formats","pageItemLimit","showRelativeDateMarkers"],G=["commits","repositories","fileHistory","lineHistory","branches","remotes","stashes","tags","contributors","searchAndCompare","worktrees"]},9179:(Re,ne,g)=>{"use strict";g.d(ne,{TF:()=>s.TF,y0:()=>s.y0,Vz:()=>s.Vz,hp:()=>s.hp,N4:()=>s.N4,Uy:()=>s.Uy,VK:()=>v,iP:()=>s.iP,zW:()=>s.zW,Vn:()=>s.Vn,Dn:()=>s.Dn,VP:()=>s.VP,M7:()=>s.M7,ef:()=>s.ef,RV:()=>s.RV,CZ:()=>s.CZ,Vc:()=>s.Vc,DH:()=>s.DH,DN:()=>T,TA:()=>s.TA,S4:()=>s.S4});var s=g(2078),I=g(9496),f=g(9433);function w(R,P){return(0,f.Z)(R,P)}o(w,"isEqual");const y=w;var b=Object.defineProperty,$=o((R,P,F)=>P in R?b(R,P,{enumerable:!0,configurable:!0,writable:!0,value:F}):R[P]=F,"__defNormalProp"),L=o((R,P,F)=>($(R,typeof P!="symbol"?P+"":P,F),F),"__publicField");const A="gitlens";class v{constructor(){L(this,"_onDidChange",new I.EventEmitter),L(this,"_onDidChangeAny",new I.EventEmitter),L(this,"_onWillChange",new I.EventEmitter)}static configure(P){P.subscriptions.push(I.workspace.onDidChangeConfiguration(T.onConfigurationChanged,T))}get onDidChange(){return this._onDidChange.event}get onDidChangeAny(){return this._onDidChangeAny.event}get onWillChange(){return this._onWillChange.event}onConfigurationChanged(P){if(!P.affectsConfiguration(A)){this._onDidChangeAny.fire(P);return}const F={change:P};this._onWillChange.fire(F),F.transform!==void 0&&(P=F.transform(P)),this._onDidChangeAny.fire(P),this._onDidChange.fire(P)}get(P,F,_){return _===void 0?I.workspace.getConfiguration(P===void 0?void 0:A,F).get(P===void 0?A:P):I.workspace.getConfiguration(P===void 0?void 0:A,F).get(P===void 0?A:P,_)}getAny(P,F,_){return _===void 0?I.workspace.getConfiguration(void 0,F).get(P):I.workspace.getConfiguration(void 0,F).get(P,_)}changed(P,F,_){return P?.affectsConfiguration(`${A}.${F}`,_)??!0}inspect(P,F){return I.workspace.getConfiguration(P===void 0?void 0:A,F).inspect(P===void 0?A:P)}inspectAny(P,F){return I.workspace.getConfiguration(void 0,F).inspect(P)}async migrate(P,F,_){const C=T.inspect(P);if(C===void 0)return!1;let k=!1;return C.globalValue!==void 0&&(await this.update(F,_.migrationFn!=null?_.migrationFn(C.globalValue):C.globalValue,I.ConfigurationTarget.Global),k=!0),C.workspaceValue!==void 0&&(await this.update(F,_.migrationFn!=null?_.migrationFn(C.workspaceValue):C.workspaceValue,I.ConfigurationTarget.Workspace),k=!0),C.workspaceFolderValue!==void 0&&(await this.update(F,_.migrationFn!=null?_.migrationFn(C.workspaceFolderValue):C.workspaceFolderValue,I.ConfigurationTarget.WorkspaceFolder),k=!0),!k&&_.fallbackValue!==void 0&&(await this.update(F,_.fallbackValue,I.ConfigurationTarget.Global),k=!0),k}async migrateIfMissing(P,F,_){const C=T.inspect(P);if(C===void 0)return;const k=T.inspect(F);C.globalValue!==void 0&&(k===void 0||k.globalValue===void 0)&&await this.update(F,_.migrationFn!=null?_.migrationFn(C.globalValue):C.globalValue,I.ConfigurationTarget.Global),C.workspaceValue!==void 0&&(k===void 0||k.workspaceValue===void 0)&&await this.update(F,_.migrationFn!=null?_.migrationFn(C.workspaceValue):C.workspaceValue,I.ConfigurationTarget.Workspace),C.workspaceFolderValue!==void 0&&(k===void 0||k.workspaceFolderValue===void 0)&&await this.update(F,_.migrationFn!=null?_.migrationFn(C.workspaceFolderValue):C.workspaceFolderValue,I.ConfigurationTarget.WorkspaceFolder)}name(P){return P}update(P,F,_){return I.workspace.getConfiguration(A).update(P,F,_)}updateAny(P,F,_,C){return I.workspace.getConfiguration(void 0,_===I.ConfigurationTarget.Global?void 0:C).update(P,F,_)}updateEffective(P,F){const _=T.inspect(P);return _.workspaceFolderValue!==void 0?F===_.workspaceFolderValue?Promise.resolve(void 0):T.update(P,F,I.ConfigurationTarget.WorkspaceFolder):_.workspaceValue!==void 0?F===_.workspaceValue?Promise.resolve(void 0):T.update(P,F,I.ConfigurationTarget.Workspace):_.globalValue===F||_.globalValue===void 0&&F===_.defaultValue?Promise.resolve(void 0):T.update(P,y(F,_.defaultValue)?void 0:F,I.ConfigurationTarget.Global)}}o(v,"Configuration");const T=new v},1045:(Re,ne,g)=>{"use strict";g.d(ne,{Gh:()=>y,NE:()=>v,S8:()=>L,ZY:()=>I,d$:()=>s,eq:()=>A,mN:()=>f,nA:()=>$,sN:()=>T,wL:()=>w,zf:()=>b});const s=80,I={".png":"image/png",".gif":"image/gif",".jpg":"image/jpeg",".jpeg":"image/jpeg",".jpe":"image/jpeg",".webp":"image/webp",".tif":"image/tiff",".tiff":"image/tiff",".bmp":"image/bmp"};var f=(R=>(R[R.Slash=47]="Slash",R[R.Backslash=92]="Backslash",R[R.A=65]="A",R[R.Z=90]="Z",R[R.a=97]="a",R[R.z=122]="z",R))(f||{}),w=(R=>(R.GutterBackgroundColor="gitlens.gutterBackgroundColor",R.GutterForegroundColor="gitlens.gutterForegroundColor",R.GutterUncommittedForegroundColor="gitlens.gutterUncommittedForegroundColor",R.TrailingLineBackgroundColor="gitlens.trailingLineBackgroundColor",R.TrailingLineForegroundColor="gitlens.trailingLineForegroundColor",R.LineHighlightBackgroundColor="gitlens.lineHighlightBackgroundColor",R.LineHighlightOverviewRulerColor="gitlens.lineHighlightOverviewRulerColor",R.ClosedAutolinkedIssueIconColor="gitlens.closedAutolinkedIssueIconColor",R.ClosedPullRequestIconColor="gitlens.closedPullRequestIconColor",R.OpenAutolinkedIssueIconColor="gitlens.openAutolinkedIssueIconColor",R.OpenPullRequestIconColor="gitlens.openPullRequestIconColor",R.MergedPullRequestIconColor="gitlens.mergedPullRequestIconColor",R.UnpublishedChangesIconColor="gitlens.unpublishedChangesIconColor",R.UnpublishedCommitIconColor="gitlens.unpublishedCommitIconColor",R.UnpulledChangesIconColor="gitlens.unpulledChangesIconColor",R))(w||{}),y=(R=>(R.ActionPrefix="gitlens.action.",R.AddAuthors="gitlens.addAuthors",R.BrowseRepoAtRevision="gitlens.browseRepoAtRevision",R.BrowseRepoAtRevisionInNewWindow="gitlens.browseRepoAtRevisionInNewWindow",R.BrowseRepoBeforeRevision="gitlens.browseRepoBeforeRevision",R.BrowseRepoBeforeRevisionInNewWindow="gitlens.browseRepoBeforeRevisionInNewWindow",R.ClearFileAnnotations="gitlens.clearFileAnnotations",R.CloseUnchangedFiles="gitlens.closeUnchangedFiles",R.CloseWelcomeView="gitlens.closeWelcomeView",R.CompareWith="gitlens.compareWith",R.CompareHeadWith="gitlens.compareHeadWith",R.CompareWorkingWith="gitlens.compareWorkingWith",R.ComputingFileAnnotations="gitlens.computingFileAnnotations",R.ConnectRemoteProvider="gitlens.connectRemoteProvider",R.CopyCurrentBranch="gitlens.copyCurrentBranch",R.CopyMessageToClipboard="gitlens.copyMessageToClipboard",R.CopyRemoteBranchesUrl="gitlens.copyRemoteBranchesUrl",R.CopyRemoteBranchUrl="gitlens.copyRemoteBranchUrl",R.CopyRemoteCommitUrl="gitlens.copyRemoteCommitUrl",R.CopyRemoteComparisonUrl="gitlens.copyRemoteComparisonUrl",R.CopyRemoteFileUrl="gitlens.copyRemoteFileUrlToClipboard",R.CopyRemoteFileUrlWithoutRange="gitlens.copyRemoteFileUrlWithoutRange",R.CopyRemoteFileUrlFrom="gitlens.copyRemoteFileUrlFrom",R.CopyRemoteIssueUrl="gitlens.copyRemoteIssueUrl",R.CopyRemotePullRequestUrl="gitlens.copyRemotePullRequestUrl",R.CopyRemoteRepositoryUrl="gitlens.copyRemoteRepositoryUrl",R.CopyShaToClipboard="gitlens.copyShaToClipboard",R.CreatePullRequestOnRemote="gitlens.createPullRequestOnRemote",R.DiffDirectory="gitlens.diffDirectory",R.DiffDirectoryWithHead="gitlens.diffDirectoryWithHead",R.DiffWith="gitlens.diffWith",R.DiffWithNext="gitlens.diffWithNext",R.DiffWithNextInDiffLeft="gitlens.diffWithNextInDiffLeft",R.DiffWithNextInDiffRight="gitlens.diffWithNextInDiffRight",R.DiffWithPrevious="gitlens.diffWithPrevious",R.DiffWithPreviousInDiffLeft="gitlens.diffWithPreviousInDiffLeft",R.DiffWithPreviousInDiffRight="gitlens.diffWithPreviousInDiffRight",R.DiffLineWithPrevious="gitlens.diffLineWithPrevious",R.DiffWithRevision="gitlens.diffWithRevision",R.DiffWithRevisionFrom="gitlens.diffWithRevisionFrom",R.DiffWithWorking="gitlens.diffWithWorking",R.DiffWithWorkingInDiffLeft="gitlens.diffWithWorkingInDiffLeft",R.DiffWithWorkingInDiffRight="gitlens.diffWithWorkingInDiffRight",R.DiffLineWithWorking="gitlens.diffLineWithWorking",R.DisconnectRemoteProvider="gitlens.disconnectRemoteProvider",R.DisableDebugLogging="gitlens.disableDebugLogging",R.EnableDebugLogging="gitlens.enableDebugLogging",R.DisableRebaseEditor="gitlens.disableRebaseEditor",R.EnableRebaseEditor="gitlens.enableRebaseEditor",R.ExternalDiff="gitlens.externalDiff",R.ExternalDiffAll="gitlens.externalDiffAll",R.FetchRepositories="gitlens.fetchRepositories",R.GetStarted="gitlens.getStarted",R.InviteToLiveShare="gitlens.inviteToLiveShare",R.OpenBlamePriorToChange="gitlens.openBlamePriorToChange",R.OpenBranchesOnRemote="gitlens.openBranchesOnRemote",R.OpenBranchOnRemote="gitlens.openBranchOnRemote",R.OpenChangedFiles="gitlens.openChangedFiles",R.OpenCommitOnRemote="gitlens.openCommitOnRemote",R.OpenComparisonOnRemote="gitlens.openComparisonOnRemote",R.OpenFileHistory="gitlens.openFileHistory",R.OpenFileFromRemote="gitlens.openFileFromRemote",R.OpenFileOnRemote="gitlens.openFileOnRemote",R.OpenFileOnRemoteFrom="gitlens.openFileOnRemoteFrom",R.OpenFileAtRevision="gitlens.openFileRevision",R.OpenFileAtRevisionFrom="gitlens.openFileRevisionFrom",R.OpenFolderHistory="gitlens.openFolderHistory",R.OpenOnRemote="gitlens.openOnRemote",R.OpenIssueOnRemote="gitlens.openIssueOnRemote",R.OpenPullRequestOnRemote="gitlens.openPullRequestOnRemote",R.OpenAssociatedPullRequestOnRemote="gitlens.openAssociatedPullRequestOnRemote",R.OpenRepoOnRemote="gitlens.openRepoOnRemote",R.OpenRevisionFile="gitlens.openRevisionFile",R.OpenRevisionFileInDiffLeft="gitlens.openRevisionFileInDiffLeft",R.OpenRevisionFileInDiffRight="gitlens.openRevisionFileInDiffRight",R.OpenWalkthrough="gitlens.openWalkthrough",R.OpenWorkingFile="gitlens.openWorkingFile",R.OpenWorkingFileInDiffLeft="gitlens.openWorkingFileInDiffLeft",R.OpenWorkingFileInDiffRight="gitlens.openWorkingFileInDiffRight",R.PullRepositories="gitlens.pullRepositories",R.PushRepositories="gitlens.pushRepositories",R.GitCommands="gitlens.gitCommands",R.GitCommandsBranch="gitlens.gitCommands.branch",R.GitCommandsCherryPick="gitlens.gitCommands.cherryPick",R.GitCommandsMerge="gitlens.gitCommands.merge",R.GitCommandsRebase="gitlens.gitCommands.rebase",R.GitCommandsReset="gitlens.gitCommands.reset",R.GitCommandsRevert="gitlens.gitCommands.revert",R.GitCommandsSwitch="gitlens.gitCommands.switch",R.GitCommandsTag="gitlens.gitCommands.tag",R.GitCommandsWorktree="gitlens.gitCommands.worktree",R.PlusHide="gitlens.plus.hide",R.PlusLearn="gitlens.plus.learn",R.PlusLoginOrSignUp="gitlens.plus.loginOrSignUp",R.PlusLogout="gitlens.plus.logout",R.PlusManage="gitlens.plus.manage",R.PlusPurchase="gitlens.plus.purchase",R.PlusResendVerification="gitlens.plus.resendVerification",R.PlusRestore="gitlens.plus.restore",R.PlusShowPlans="gitlens.plus.showPlans",R.PlusStartPreviewTrial="gitlens.plus.startPreviewTrial",R.PlusValidate="gitlens.plus.validate",R.QuickOpenFileHistory="gitlens.quickOpenFileHistory",R.RefreshHover="gitlens.refreshHover",R.ResetAvatarCache="gitlens.resetAvatarCache",R.ResetSuppressedWarnings="gitlens.resetSuppressedWarnings",R.RevealCommitInView="gitlens.revealCommitInView",R.SearchCommits="gitlens.showCommitSearch",R.SearchCommitsInView="gitlens.views.searchAndCompare.searchCommits",R.SetViewsLayout="gitlens.setViewsLayout",R.ShowBranchesView="gitlens.showBranchesView",R.ShowCommitInView="gitlens.showCommitInView",R.ShowCommitsInView="gitlens.showCommitsInView",R.ShowCommitsView="gitlens.showCommitsView",R.ShowContributorsView="gitlens.showContributorsView",R.ShowHomeView="gitlens.showHomeView",R.ShowFileHistoryView="gitlens.showFileHistoryView",R.ShowLastQuickPick="gitlens.showLastQuickPick",R.ShowLineHistoryView="gitlens.showLineHistoryView",R.ShowQuickBranchHistory="gitlens.showQuickBranchHistory",R.ShowQuickCommit="gitlens.showQuickCommitDetails",R.ShowQuickCommitFile="gitlens.showQuickCommitFileDetails",R.ShowQuickCurrentBranchHistory="gitlens.showQuickRepoHistory",R.ShowQuickFileHistory="gitlens.showQuickFileHistory",R.ShowQuickRepoStatus="gitlens.showQuickRepoStatus",R.ShowQuickCommitRevision="gitlens.showQuickRevisionDetails",R.ShowQuickCommitRevisionInDiffLeft="gitlens.showQuickRevisionDetailsInDiffLeft",R.ShowQuickCommitRevisionInDiffRight="gitlens.showQuickRevisionDetailsInDiffRight",R.ShowQuickStashList="gitlens.showQuickStashList",R.ShowRemotesView="gitlens.showRemotesView",R.ShowRepositoriesView="gitlens.showRepositoriesView",R.ShowSearchAndCompareView="gitlens.showSearchAndCompareView",R.ShowSettingsPage="gitlens.showSettingsPage",R.ShowSettingsPageAndJumpToBranchesView="gitlens.showSettingsPage#branches-view",R.ShowSettingsPageAndJumpToCommitsView="gitlens.showSettingsPage#commits-view",R.ShowSettingsPageAndJumpToContributorsView="gitlens.showSettingsPage#contributors-view",R.ShowSettingsPageAndJumpToFileHistoryView="gitlens.showSettingsPage#file-history-view",R.ShowSettingsPageAndJumpToLineHistoryView="gitlens.showSettingsPage#line-history-view",R.ShowSettingsPageAndJumpToRemotesView="gitlens.showSettingsPage#remotes-view",R.ShowSettingsPageAndJumpToRepositoriesView="gitlens.showSettingsPage#repositories-view",R.ShowSettingsPageAndJumpToSearchAndCompareView="gitlens.showSettingsPage#search-compare-view",R.ShowSettingsPageAndJumpToStashesView="gitlens.showSettingsPage#stashes-view",R.ShowSettingsPageAndJumpToTagsView="gitlens.showSettingsPage#tags-view",R.ShowSettingsPageAndJumpToWorkTreesView="gitlens.showSettingsPage#worktrees-view",R.ShowSettingsPageAndJumpToViews="gitlens.showSettingsPage#views",R.ShowStashesView="gitlens.showStashesView",R.ShowTagsView="gitlens.showTagsView",R.ShowWorktreesView="gitlens.showWorktreesView",R.RefreshTimelinePage="gitlens.refreshTimelinePage",R.ShowTimelinePage="gitlens.showTimelinePage",R.ShowTimelineView="gitlens.showTimelineView",R.ShowWelcomePage="gitlens.showWelcomePage",R.StashApply="gitlens.stashApply",R.StashSave="gitlens.stashSave",R.StashSaveFiles="gitlens.stashSaveFiles",R.SwitchMode="gitlens.switchMode",R.ToggleCodeLens="gitlens.toggleCodeLens",R.ToggleFileBlame="gitlens.toggleFileBlame",R.ToggleFileBlameInDiffLeft="gitlens.toggleFileBlameInDiffLeft",R.ToggleFileBlameInDiffRight="gitlens.toggleFileBlameInDiffRight",R.ToggleFileChanges="gitlens.toggleFileChanges",R.ToggleFileChangesOnly="gitlens.toggleFileChangesOnly",R.ToggleFileHeatmap="gitlens.toggleFileHeatmap",R.ToggleFileHeatmapInDiffLeft="gitlens.toggleFileHeatmapInDiffLeft",R.ToggleFileHeatmapInDiffRight="gitlens.toggleFileHeatmapInDiffRight",R.ToggleLineBlame="gitlens.toggleLineBlame",R.ToggleReviewMode="gitlens.toggleReviewMode",R.ToggleZenMode="gitlens.toggleZenMode",R.ViewsCopy="gitlens.views.copy",R.ViewsOpenDirectoryDiff="gitlens.views.openDirectoryDiff",R.ViewsOpenDirectoryDiffWithWorking="gitlens.views.openDirectoryDiffWithWorking",R.Deprecated_DiffHeadWith="gitlens.diffHeadWith",R.Deprecated_DiffWorkingWith="gitlens.diffWorkingWith",R.Deprecated_OpenBranchesInRemote="gitlens.openBranchesInRemote",R.Deprecated_OpenBranchInRemote="gitlens.openBranchInRemote",R.Deprecated_OpenCommitInRemote="gitlens.openCommitInRemote",R.Deprecated_OpenFileInRemote="gitlens.openFileInRemote",R.Deprecated_OpenInRemote="gitlens.openInRemote",R.Deprecated_OpenRepoInRemote="gitlens.openRepoInRemote",R.Deprecated_ShowFileHistoryInView="gitlens.showFileHistoryInView",R))(y||{}),b=(R=>(R.ActionPrefix="gitlens:action:",R.KeyPrefix="gitlens:key:",R.ActiveFileStatus="gitlens:activeFileStatus",R.AnnotationStatus="gitlens:annotationStatus",R.Debugging="gitlens:debugging",R.DisabledToggleCodeLens="gitlens:disabledToggleCodeLens",R.Disabled="gitlens:disabled",R.Enabled="gitlens:enabled",R.HasConnectedRemotes="gitlens:hasConnectedRemotes",R.HasRemotes="gitlens:hasRemotes",R.HasRichRemotes="gitlens:hasRichRemotes",R.HasVirtualFolders="gitlens:hasVirtualFolders",R.Readonly="gitlens:readonly",R.TimelinePageFocused="gitlens:timelinePage:focused",R.Untrusted="gitlens:untrusted",R.ViewsCanCompare="gitlens:views:canCompare",R.ViewsCanCompareFile="gitlens:views:canCompare:file",R.ViewsCommitsMyCommitsOnly="gitlens:views:commits:myCommitsOnly",R.ViewsFileHistoryCanPin="gitlens:views:fileHistory:canPin",R.ViewsFileHistoryCursorFollowing="gitlens:views:fileHistory:cursorFollowing",R.ViewsFileHistoryEditorFollowing="gitlens:views:fileHistory:editorFollowing",R.ViewsLineHistoryEditorFollowing="gitlens:views:lineHistory:editorFollowing",R.ViewsRepositoriesAutoRefresh="gitlens:views:repositories:autoRefresh",R.ViewsSearchAndCompareKeepResults="gitlens:views:searchAndCompare:keepResults",R.Vsls="gitlens:vsls",R.Plus="gitlens:plus",R.PlusAllowed="gitlens:plus:allowed",R.PlusRequired="gitlens:plus:required",R.PlusState="gitlens:plus:state",R))(b||{}),$=(R=>(R.CloseActiveEditor="workbench.action.closeActiveEditor",R.CloseAllEditors="workbench.action.closeAllEditors",R.CursorMove="cursorMove",R.Diff="vscode.diff",R.EditorScroll="editorScroll",R.EditorShowHover="editor.action.showHover",R.ExecuteDocumentSymbolProvider="vscode.executeDocumentSymbolProvider",R.ExecuteCodeLensProvider="vscode.executeCodeLensProvider",R.FocusFilesExplorer="workbench.files.action.focusFilesExplorer",R.InstallExtension="workbench.extensions.installExtension",R.MoveViews="vscode.moveViews",R.Open="vscode.open",R.OpenFolder="vscode.openFolder",R.OpenInTerminal="openInTerminal",R.OpenWalkthrough="workbench.action.openWalkthrough",R.OpenWith="vscode.openWith",R.NextEditor="workbench.action.nextEditor",R.PreviewHtml="vscode.previewHtml",R.RevealLine="revealLine",R.RevealInExplorer="revealInExplorer",R.RevealInFileExplorer="revealFileInOS",R.SetContext="setContext",R.ShowExplorer="workbench.view.explorer",R.ShowReferences="editor.action.showReferences",R.ShowSCM="workbench.view.scm",R.UninstallExtension="workbench.extensions.uninstallExtension",R))($||{}),L=(R=>(R.Publish="git.publish",R.Pull="git.pull",R.PullRebase="git.pullRebase",R.Push="git.push",R.PushForce="git.pushForce",R.UndoCommit="git.undoCommit",R))(L||{}),A=(R=>(R.AutoRepositoryDetection="git.autoRepositoryDetection",R.RepositoryScanMaxDepth="git.repositoryScanMaxDepth",R.FetchOnPull="git.fetchOnPull",R.UseForcePushWithLease="git.useForcePushWithLease",R))(A||{}),v=(R=>(R.AngleBracketLeftHeavy="\u2770",R.AngleBracketRightHeavy="\u2771",R.ArrowBack="\u21A9",R.ArrowDown="\u2193",R.ArrowDownUp="\u21F5",R.ArrowDropRight="\u2937",R.ArrowHeadRight="\u27A4",R.ArrowLeft="\u2190",R.ArrowLeftDouble="\u21D0",R.ArrowLeftRight="\u2194",R.ArrowLeftRightDouble="\u21D4",R.ArrowLeftRightDoubleStrike="\u21CE",R.ArrowLeftRightLong="\u27F7",R.ArrowRight="\u2192",R.ArrowRightDouble="\u21D2",R.ArrowRightHollow="\u21E8",R.ArrowUp="\u2191",R.ArrowUpDown="\u21C5",R.ArrowUpRight="\u2197",R.ArrowsHalfLeftRight="\u21CB",R.ArrowsHalfRightLeft="\u21CC",R.ArrowsLeftRight="\u21C6",R.ArrowsRightLeft="\u21C4",R.Asterisk="\u2217",R.Check="\u2714",R.Dash="\u2014",R.Dot="\u2022",R.Ellipsis="\u2026",R.EnDash="\u2013",R.Envelope="\u2709",R.EqualsTriple="\u2261",R.Flag="\u2691",R.FlagHollow="\u2690",R.MiddleEllipsis="\u22EF",R.MuchLessThan="\u226A",R.MuchGreaterThan="\u226B",R.Pencil="\u270E",R.Space="\xA0",R.SpaceThin="\u2009",R.SpaceThinnest="\u200A",R.SquareWithBottomShadow="\u274F",R.SquareWithTopShadow="\u2750",R.Warning="\u26A0",R.ZeroWidthSpace="\u200B",R))(v||{}),T=(R=>(R.DebugConsole="debug",R.File="file",R.Git="git",R.GitHub="github",R.GitLens="gitlens",R.Output="output",R.PRs="pr",R.Vsls="vsls",R.VslsScc="vsls-scc",R.Virtual="vscode-vfs",R))(T||{})},7785:(Re,ne,g)=>{"use strict";g.d(ne,{W:()=>qi});var s=g(9496),I=g(6540),f=g(9179),w=g(1045),y=g(313),b=g(5396),$=g(6532),L=g(5059),A=g(2324),v=g(2976),T=g(7358),R=g(3969),P=g(2436),F=g(5861),_=g(7369),C=g(2886),k=g(516),x=g(2246),c=g(9510),O=g(320),E=Object.defineProperty,B=o((l,e,r)=>e in l?E(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"__defNormalProp"),G=o((l,e,r)=>(B(l,typeof e!="symbol"?e+"":e,r),r),"__publicField");class U{constructor(e,r,t,i,n){this.document=e,this.key=r,this.dirty=t,this._eventDelegates=i,this.container=n,G(this,"_onDidBlameStateChange",new s.EventEmitter),G(this,"state"),G(this,"_disposable"),G(this,"_disposed",!1),G(this,"_uri"),G(this,"initializing",!0),G(this,"_forceDirtyStateChangeOnNextDocumentChange",!1),G(this,"_hasRemotes",!1),G(this,"_isDirtyIdle",!1),G(this,"_isTracked",!1),G(this,"_updateDebounced"),G(this,"_blameFailed",!1),G(this,"_requiresUpdate",!0)}static async create(e,r,t,i,n){const d=new U(e,r,t,i,n);return await d.initialize(),d}get onDidBlameStateChange(){return this._onDidBlameStateChange.event}dispose(){var e;this.state=void 0,this._disposed=!0,(e=this._disposable)==null||e.dispose()}async initialize(){const e=this.document.uri;this._uri=await A.YY.fromUri(e),this._disposed||await this.update(),this.initializing=!1}get forceDirtyStateChangeOnNextDocumentChange(){return this._forceDirtyStateChangeOnNextDocumentChange}get hasRemotes(){return this._hasRemotes}get isBlameable(){return this._blameFailed?!1:this._isTracked}get isDirtyIdle(){return this._isDirtyIdle}set isDirtyIdle(e){this._isDirtyIdle=e}get isRevision(){return this._uri!=null?Boolean(this._uri.sha)&&this._uri.sha!==v.GitRevision.deletedOrMissing:!1}get isTracked(){return this._isTracked}get lineCount(){return this.document.lineCount}get uri(){return this._uri}async activate(){this._requiresUpdate&&await this.update(),(0,y.v)(w.zf.ActiveFileStatus,this.getStatus())}is(e){return e===this.document}reset(e){this._requiresUpdate=!0,this._blameFailed=!1,this._isDirtyIdle=!1,this.state!=null&&(this.state=void 0,P.Y.log(`Reset state for '${this.key}', reason=${e}`)),e==="repository"&&(0,O.$S)(this.document)&&(this._updateDebounced==null&&(this._updateDebounced=(0,c.Ds)(this.update.bind(this),250)),this._updateDebounced())}setBlameFailure(){const e=this.isBlameable;this._blameFailed=!0,e&&(0,O.$S)(this.document)&&this.update({forceBlameChange:!0})}resetForceDirtyStateChangeOnNextDocumentChange(){this._forceDirtyStateChangeOnNextDocumentChange=!1}setForceDirtyStateChangeOnNextDocumentChange(){this._forceDirtyStateChangeOnNextDocumentChange=!0}async update({forceBlameChange:e}={}){if(this._requiresUpdate=!1,this._disposed||this._uri==null){this._hasRemotes=!1,this._isTracked=!1;return}this._isDirtyIdle=!1;const r=(0,O.aW)(this.document),t=e?void 0:this.isBlameable,i=this.container.git.getRepository(this._uri);if(i==null?(this._isTracked=!1,this._hasRemotes=!1):[this._isTracked,this._hasRemotes]=await Promise.all([this.container.git.isTracked(this._uri),i.hasRemotes()]),r!=null){const n=this.isBlameable;if((0,y.v)(w.zf.ActiveFileStatus,this.getStatus()),!this.initializing&&t!==n){const d={editor:r,document:this,blameable:n};this._onDidBlameStateChange.fire(d),this._eventDelegates.onDidBlameStateChange(d)}}}getStatus(){let e="";return this.isTracked&&(e+="tracked|"),this.isBlameable&&(e+="blameable|"),this.isRevision&&(e+="revision|"),this.hasRemotes&&(e+="remotes|"),e||void 0}}o(U,"TrackedDocument");var H=Object.defineProperty,j=o((l,e,r)=>e in l?H(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"documentTracker_defNormalProp"),q=o((l,e,r)=>(j(l,typeof e!="symbol"?e+"":e,r),r),"documentTracker_publicField");class de{constructor(e){this.container=e,q(this,"_onDidChangeBlameState",new s.EventEmitter),q(this,"_onDidChangeContent",new s.EventEmitter),q(this,"_onDidChangeDirtyState",new s.EventEmitter),q(this,"_onDidTriggerDirtyIdle",new s.EventEmitter),q(this,"_dirtyIdleTriggerDelay"),q(this,"_disposable"),q(this,"_documentMap",new Map),q(this,"_timer"),q(this,"_dirtyIdleTriggeredDebounced"),q(this,"_dirtyStateChangedDebounced"),this._disposable=s.Disposable.from((0,x.IH)(e.onReady)(this.onReady,this),f.DN.onDidChange(this.onConfigurationChanged,this),s.window.onDidChangeActiveTextEditor(this.onActiveTextEditorChanged,this),s.workspace.onDidChangeTextDocument((0,c.Ds)(this.onTextDocumentChanged,50),this),s.workspace.onDidCloseTextDocument(this.onTextDocumentClosed,this),s.workspace.onDidSaveTextDocument(this.onTextDocumentSaved,this),this.container.git.onDidChangeRepositories(this.onRepositoriesChanged,this),this.container.git.onDidChangeRepository(this.onRepositoryChanged,this)),this._dirtyIdleTriggerDelay=f.DN.get("advanced.blame.delayAfterEdit")}get onDidChangeBlameState(){return this._onDidChangeBlameState.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onDidChangeDirtyState(){return this._onDidChangeDirtyState.event}get onDidTriggerDirtyIdle(){return this._onDidTriggerDirtyIdle.event}dispose(){this._disposable.dispose(),this.clear()}onReady(){this.onConfigurationChanged(),this.onActiveTextEditorChanged(s.window.activeTextEditor)}onActiveTextEditorChanged(e){if(e!=null&&!(0,O.PH)(e))return;if(this._timer!=null&&(clearTimeout(this._timer),this._timer=void 0),e==null){this._timer=setTimeout(()=>{this._timer=void 0,(0,y.v)(w.zf.ActiveFileStatus,void 0)},250);return}const r=this._documentMap.get(e.document);if(r!=null){r.then(t=>t.activate(),()=>{});return}this.addCore(e.document)}onConfigurationChanged(e){e!=null&&(f.DN.changed(e,"blame.ignoreWhitespace")||f.DN.changed(e,"advanced.caching.enabled"))&&this.reset("config"),f.DN.changed(e,"advanced.blame.delayAfterEdit")&&(this._dirtyIdleTriggerDelay=f.DN.get("advanced.blame.delayAfterEdit"),this._dirtyIdleTriggeredDebounced=void 0)}onRepositoriesChanged(e){this.reset("repository",e.added.length?new Set(e.added.map(r=>r.path)):void 0,e.removed.length?new Set(e.removed.map(r=>r.path)):void 0)}onRepositoryChanged(e){e.changed(v.RepositoryChange.Index,v.RepositoryChange.Heads,v.RepositoryChange.Status,v.RepositoryChange.Unknown,v.RepositoryChangeComparisonMode.Any)&&this.reset("repository",new Set([e.repository.path]))}async onTextDocumentChanged(e){const{scheme:r}=e.document.uri;if(!this.container.git.supportedSchemes.has(r))return;const t=await(this._documentMap.get(e.document)??this.addCore(e.document));t.reset("document");const i=e.document.isDirty,n=s.window.activeTextEditor;this._dirtyIdleTriggeredDebounced!=null&&(i?this._dirtyIdleTriggeredDebounced({editor:n,document:t}):this._dirtyIdleTriggeredDebounced.cancel()),n?.document===e.document&&this._onDidChangeContent.fire({editor:n,document:t,contentChanges:e.contentChanges}),!(!t.forceDirtyStateChangeOnNextDocumentChange&&t.dirty===i)&&(t.resetForceDirtyStateChangeOnNextDocumentChange(),t.dirty=i,!(n==null||n.document!==e.document)&&this.fireDocumentDirtyStateChanged({editor:n,document:t,dirty:t.dirty}))}onTextDocumentClosed(e){this.remove(e)}async onTextDocumentSaved(e){const r=this._documentMap.get(e);if(r!=null){(await r).update({forceBlameChange:!0});return}(0,O.$S)(e)&&this.addCore(e)}async add(e){let r;if(A.YY.is(e))try{r=await s.workspace.openTextDocument(e.documentUri())}catch(i){const n=i?.toString()??"";if(n.includes("File seems to be binary and cannot be opened as text"))r=new ee(e);else if(n.includes("File not found")||n.includes("Unable to read file")||n.includes("Unable to resolve non-existing file"))r=new We(e);else throw i}else e instanceof s.Uri?r=await s.workspace.openTextDocument(e):r=e;return this.addCore(r)}async addCore(e){const r=Pe(e.uri),t=U.create(e,r,!1,{onDidBlameStateChange:i=>this._onDidChangeBlameState.fire(i)},this.container);return this._documentMap.set(e,t),this._documentMap.set(r,t),t}async clear(){for(const e of this._documentMap.values())(await e).dispose();this._documentMap.clear()}get(e){let r;return A.YY.is(e)?r=Pe(e.documentUri()):e instanceof s.Uri?r=Pe(e):r=e,this._documentMap.get(r)}async getOrAdd(e){return this.get(e)??this.add(e)}has(e){return e instanceof s.Uri?this._documentMap.has(Pe(e)):this._documentMap.has(e)}async remove(e,r){var t;let i;r!=null&&(i=this._documentMap.get(e)),this._documentMap.delete(e),this._documentMap.delete(Pe(e.uri)),(t=r??await i)==null||t.dispose()}fireDocumentDirtyStateChanged(e){if(e.dirty){queueMicrotask(()=>{var r;(r=this._dirtyStateChangedDebounced)==null||r.cancel(),s.window.activeTextEditor===e.editor&&this._onDidChangeDirtyState.fire(e)}),this._dirtyIdleTriggerDelay>0&&(this._dirtyIdleTriggeredDebounced==null&&(this._dirtyIdleTriggeredDebounced=(0,c.Ds)(r=>{var t;(t=this._dirtyIdleTriggeredDebounced)!=null&&t.pending()||(r.document.isDirtyIdle=!0,this._onDidTriggerDirtyIdle.fire(r))},this._dirtyIdleTriggerDelay,{track:!0})),this._dirtyIdleTriggeredDebounced({editor:e.editor,document:e.document}));return}this._dirtyStateChangedDebounced==null&&(this._dirtyStateChangedDebounced=(0,c.Ds)(r=>{s.window.activeTextEditor===r.editor&&this._onDidChangeDirtyState.fire(r)},250)),this._dirtyStateChangedDebounced(e)}reset(e,r,t){Promise.allSettled((0,C.UI)((0,C.hX)(this._documentMap,([i])=>typeof i=="string"),async([,i])=>{const n=await i;if(t?.has(n.uri.repoPath)){this.remove(n.document,n);return}(r==null||r.has(n.uri.repoPath))&&n.reset(e)}))}}o(de,"DocumentTracker");class Q{constructor(e){this.gitUri=e,q(this,"eol"),q(this,"fileName"),q(this,"isClosed"),q(this,"isDirty"),q(this,"isUntitled"),q(this,"languageId"),q(this,"lineCount"),q(this,"uri"),q(this,"version"),this.uri=e.documentUri(),this.eol=s.EndOfLine.LF,this.fileName=this.uri.fsPath,this.isClosed=!1,this.isDirty=!1,this.isUntitled=!1,this.languageId="",this.lineCount=0,this.version=0}getText(e){throw new Error("Method not supported.")}getWordRangeAtPosition(e,r){throw new Error("Method not supported.")}lineAt(e){throw new Error("Method not supported.")}offsetAt(e){throw new Error("Method not supported.")}positionAt(e){throw new Error("Method not supported.")}save(){throw new Error("Method not supported.")}validatePosition(e){throw new Error("Method not supported.")}validateRange(e){throw new Error("Method not supported.")}}o(Q,"EmptyTextDocument");class ee extends Q{}o(ee,"BinaryTextDocument");class We extends Q{}o(We,"MissingRevisionTextDocument");function Pe(l){return(0,k.M)(l)}o(Pe,"getUriKey");var Te=Object.defineProperty,je=o((l,e,r)=>e in l?Te(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"gitDocumentTracker_defNormalProp"),oe=o((l,e,r)=>(je(l,typeof e!="symbol"?e+"":e,r),r),"gitDocumentTracker_publicField");class ce{constructor(e){this.key=e,oe(this,"blameCache",new Map),oe(this,"diffCache",new Map),oe(this,"logCache",new Map)}clearBlame(e){if(e==null){this.blameCache.clear();return}this.blameCache.delete(e)}clearDiff(e){if(e==null){this.diffCache.clear();return}this.diffCache.delete(e)}clearLog(e){if(e==null){this.logCache.clear();return}this.logCache.delete(e)}getBlame(e){return this.blameCache.get(e)}getDiff(e){return this.diffCache.get(e)}getLog(e){return this.logCache.get(e)}setBlame(e,r){if(r==null){this.blameCache.delete(e);return}this.blameCache.set(e,r)}setDiff(e,r){if(r==null){this.diffCache.delete(e);return}this.diffCache.set(e,r)}setLog(e,r){if(r==null){this.logCache.delete(e);return}this.logCache.set(e,r)}}o(ce,"GitDocumentState");class ue extends de{async resetCache(e,r){var t,i,n;const d=this.get(e);if(d!=null)switch(r){case"blame":(t=(await d).state)==null||t.clearBlame();break;case"diff":(i=(await d).state)==null||i.clearDiff();break;case"log":(n=(await d).state)==null||n.clearLog();break}}}o(ue,"GitDocumentTracker");async function Ae(l){try{const e=s.extensions.getExtension("ms-vscode.remote-repositories")??s.extensions.getExtension("GitHub.remotehub");if(e==null)throw P.Y.log("GitHub Repositories extension is not installed or enabled"),new b.R5("GitHub Repositories","GitHub.remotehub");return e.isActive?e.exports:await e.activate()}catch(e){if(P.Y.error(e,"Unable to get required api from the GitHub Repositories extension"),e instanceof b.R5,l)return;throw e}}o(Ae,"getRemoteHubApi");var ut=(l=>(l[l.Branch=0]="Branch",l[l.RemoteBranch=1]="RemoteBranch",l[l.Tag=2]="Tag",l[l.Commit=3]="Commit",l))(ut||{}),Le=(l=>(l[l.Branch=0]="Branch",l[l.Tag=1]="Tag",l[l.Commit=2]="Commit",l[l.PullRequest=3]="PullRequest",l[l.Tree=4]="Tree",l))(Le||{}),Me=g(8026),Ye=Object.defineProperty,et=Object.defineProperties,ye=Object.getOwnPropertyDescriptor,De=Object.getOwnPropertyDescriptors,qe=Object.getOwnPropertySymbols,at=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable,fe=o((l,e,r)=>e in l?Ye(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"githubGitProvider_defNormalProp"),pe=o((l,e)=>{for(var r in e||(e={}))at.call(e,r)&&fe(l,r,e[r]);if(qe)for(var r of qe(e))Ct.call(e,r)&&fe(l,r,e[r]);return l},"__spreadValues"),ht=o((l,e)=>et(l,De(e)),"__spreadProps"),Z=o((l,e,r,t)=>{for(var i=t>1?void 0:t?ye(e,r):e,n=l.length-1,d;n>=0;n--)(d=l[n])&&(i=(t?d(e,r,i):d(i))||i);return t&&i&&Ye(e,r,i),i},"__decorateClass"),Y=o((l,e,r)=>(fe(l,typeof e!="symbol"?e+"":e,r),r),"githubGitProvider_publicField");const K=Object.freeze({values:[]}),_e=Promise.resolve(void 0),ie=["repo","read:user","user:email"],Ne=/^[^/](?!.*\/\.)(?!.*\.\.)(?!.*\/\/)(?!.*@\{)[^\000-\037\177 ~^:?*[\\]+[^./]$/;class Ce{constructor(e){this.container=e,Y(this,"descriptor",{id:L.p.GitHub,name:"GitHub"}),Y(this,"supportedSchemes",new Set([w.sN.Virtual,w.sN.GitHub,w.sN.PRs])),Y(this,"_onDidChangeRepository",new s.EventEmitter),Y(this,"_onDidCloseRepository",new s.EventEmitter),Y(this,"_onDidOpenRepository",new s.EventEmitter),Y(this,"_branchesCache",new Map),Y(this,"_repoInfoCache",new Map),Y(this,"_tagsCache",new Map),Y(this,"_disposables",[]),Y(this,"_github"),Y(this,"_remotehub"),Y(this,"_remotehubPromise"),Y(this,"_sessionPromise")}get onDidChangeRepository(){return this._onDidChangeRepository.event}get onDidCloseRepository(){return this._onDidCloseRepository.event}get onDidOpenRepository(){return this._onDidOpenRepository.event}dispose(){this._disposables.forEach(e=>e.dispose())}onRepositoryChanged(e,r){this._branchesCache.delete(e.path),this._tagsCache.delete(e.path),this._repoInfoCache.delete(e.path),this._onDidChangeRepository.fire(r)}async discoverRepositories(e){if(!this.supportedSchemes.has(e.scheme))return[];try{const{remotehub:r}=await this.ensureRepositoryContext(e.toString(),!0),t=r.getVirtualWorkspaceUri(e);return t==null?[]:[this.openRepository(void 0,t,!0)]}catch{return[]}}updateContext(){(0,y.v)(w.zf.HasVirtualFolders,this.container.git.hasOpenRepositories(this.descriptor.id))}openRepository(e,r,t,i,n){return new v.Repository(this.container,this.onRepositoryChanged.bind(this),this.descriptor,e,r,t,i??!s.window.state.focused,n)}async supports(e){switch(e){case $.A.Worktrees:return!1;default:return!0}}async visibility(e){const r=await this.getRemotes(e);if(r.length===0)return L.q.Local;const t=r.find(i=>i.name==="origin");return t!=null?this.getRemoteVisibility(t):L.q.Private}async getRemoteVisibility(e){var r;switch((r=e.provider)==null?void 0:r.id){case"github":{const{github:t,metadata:i,session:n}=await this.ensureRepositoryContext(e.repoPath);return await t.getRepositoryVisibility(n.accessToken,i.repo.owner,i.repo.name)??L.q.Private}default:return L.q.Private}}async getOpenScmRepositories(){return[]}async getOrOpenScmRepository(e){}canHandlePathOrUri(e,r){if(!!this.supportedSchemes.has(e))return typeof r=="string"?r:r.toString()}getAbsoluteUri(e,r){if(typeof r=="string")if((0,k.tE)(r))r=s.Uri.parse(r,!0);else throw s.window.showErrorMessage(`Unable to get absolute uri between ${typeof e=="string"?e:e.toString(!1)} and ${r}; Base path '${r}' must be a uri`),new Error(`Base path '${r}' must be a uri`);if(typeof e=="string"&&!(0,k.tE)(e)&&!(0,k.YP)(e))return s.Uri.joinPath(r,(0,k.AH)(e));const t=this.getRelativePath(e,r);return s.Uri.joinPath(r,t)}async getBestRevisionUri(e,r,t){return t?this.createProviderUri(e,t,r):this.createVirtualUri(e,t,r)}getRelativePath(e,r){if(typeof r=="string")if((0,k.tE)(r))r=s.Uri.parse(r,!0);else throw s.window.showErrorMessage(`Unable to get relative path between ${typeof e=="string"?e:e.toString(!1)} and ${r}; Base path '${r}' must be a uri`),new Error(`Base path '${r}' must be a uri`);let t;if(typeof e=="string")if((0,k.tE)(e))e=s.Uri.parse(e,!0);else return e=(0,k.AH)(e),t=(0,k.YP)(e)&&e.startsWith(r.path)?e.slice(r.path.length):e,t.charCodeAt(0)===w.mN.Slash&&(t=t.slice(1)),t;return t=(0,k.AH)((0,k.Gf)(r.path.slice(1),e.path.slice(1))),t}getRevisionUri(e,r,t){const i=this.createProviderUri(e,t,r);return t===v.GitRevision.deletedOrMissing?i.with({query:"~"}):i}async getWorkingUri(e,r){return this.createVirtualUri(e,void 0,r.path)}async addRemote(e,r,t){}async pruneRemote(e,r){}async applyChangesToWorkingFile(e,r,t){}async branchContainsCommit(e,r,t){return!1}async checkout(e,r,t){}resetCaches(...e){(e.length===0||e.includes("branches"))&&this._branchesCache.clear(),(e.length===0||e.includes("tags"))&&this._tagsCache.clear(),e.length===0&&this._repoInfoCache.clear()}async excludeIgnoredUris(e,r){return r}async fetch(e,r){}async findRepositoryUri(e,r){const t=P.Y.getCorrelationContext();try{return(await this.ensureRemoteHubApi()).getProviderRootUri(e).with({scheme:w.sN.Virtual})}catch(i){i instanceof b.R5,P.Y.error(i,t);return}}async getAheadBehindCommitCount(e,r){}async getBlame(e,r){const t=P.Y.getCorrelationContext();if(r?.isDirty)return;let i="blame";e.sha!=null&&(i+=`:${e.sha}`);const n=await this.container.tracker.getOrAdd(e);if(n.state!=null){const h=n.state.getBlame(i);if(h!=null)return P.Y.debug(t,`Cache hit: '${i}'`),h.item}P.Y.debug(t,`Cache miss: '${i}'`),n.state==null&&(n.state=new ce(n.key));const d=this.getBlameCore(e,n,i,t);if(n.state!=null){P.Y.debug(t,`Cache add: '${i}'`);const h={item:d};n.state.setBlame(i,h)}return d}async getBlameCore(e,r,t,i){var n,d;try{const h=await this.ensureRepositoryContext(e.repoPath);if(h==null)return;const{metadata:D,github:M,remotehub:le,session:be}=h,Ee=le.getVirtualUri(le.getProviderRootUri(e)),xe=this.getRelativePath(e,Ee);if(e.scheme===w.sN.Virtual){const[Nt,Ci]=await Promise.allSettled([s.workspace.fs.stat(e),s.workspace.fs.stat(e.with({scheme:w.sN.GitHub}))]);if(Nt.status!=="fulfilled"||Ci.status!=="fulfilled"||Nt.value.mtime!==Ci.value.mtime)return}const Ue=!e.sha||e.sha==="HEAD"?(await D.getRevision()).revision:e.sha,st=await M.getBlame(be.accessToken,D.repo.owner,D.repo.name,Ue,xe),He=new Map,vt=new Map,Et=[];for(const Nt of st.ranges){const Ci=Nt.commit,{viewer:ki=be.account.label}=st,gi=ki!=null&&Ci.author.name===ki?"You":Ci.author.name,tr=ki!=null&&Ci.committer.name===ki?"You":Ci.committer.name;let Nn=He.get(gi);Nn==null&&(Nn={name:gi,lineCount:0},He.set(gi,Nn)),Nn.lineCount+=Nt.endingLine-Nt.startingLine+1;let Mn=vt.get(Ci.oid);Mn==null&&(Mn=new v.GitCommit(this.container,e.repoPath,Ci.oid,new v.GitCommitIdentity(gi,Ci.author.email,new Date(Ci.author.date),Ci.author.avatarUrl),new v.GitCommitIdentity(tr,Ci.committer.email,new Date(Ci.author.date)),Ci.message.split(` `,1)[0],(n=Ci.parents.nodes[0])!=null&&n.oid?[(d=Ci.parents.nodes[0])==null?void 0:d.oid]:[],Ci.message,new v.GitFileChange(Ee.toString(),xe,v.GitFileIndexStatus.Modified),{changedFiles:Ci.changedFiles??0,additions:Ci.additions??0,deletions:Ci.deletions??0},[]),vt.set(Ci.oid,Mn));for(let ms=Nt.startingLine;ms<=Nt.endingLine;ms++){const Tc={sha:Ci.oid,originalLine:ms,line:ms};Mn.lines.push(Tc),Et[ms-1]=Tc}}const Wt=new Map([...He.entries()].sort((Nt,Ci)=>Ci[1].lineCount-Nt[1].lineCount));return{repoPath:e.repoPath,authors:Wt,commits:vt,lines:Et}}catch(h){if(r.state!=null&&!/No provider registered with/.test(String(h))){const D=h?.toString()??"";P.Y.debug(i,`Cache replace (with empty promise): '${t}'`);const M={item:_e,errorMessage:D};return r.state.setBlame(t,M),r.setBlameFailure(),_e}return}}async getBlameContents(e,r){}async getBlameForLine(e,r,t,i){var n,d;const h=P.Y.getCorrelationContext();if(!t?.isDirty){if(!i?.forceSingleLine){const D=await this.getBlame(e);if(D==null)return;let M=D.lines[r];if(M==null){if(D.lines.length!==r)return;M=D.lines[r-1]}const le=D.commits.get(M.sha);if(le==null)return;const be=D.authors.get(le.author.name);return{author:ht(pe({},be),{lineCount:le.lines.length}),commit:le,line:M}}try{const D=await this.ensureRepositoryContext(e.repoPath);if(D==null)return;const{metadata:M,github:le,remotehub:be,session:Ee}=D,xe=be.getVirtualUri(be.getProviderRootUri(e)),Ue=this.getRelativePath(e,xe),st=!e.sha||e.sha==="HEAD"?(await M.getRevision()).revision:e.sha,He=await le.getBlame(Ee.accessToken,M.repo.owner,M.repo.name,st,Ue),vt=r+1,Et=He.ranges.find(tr=>tr.startingLine===vt);if(Et==null)return;const Wt=Et.commit,{viewer:Nt=Ee.account.label}=He,Ci=Nt!=null&&Wt.author.name===Nt?"You":Wt.author.name,ki=Nt!=null&&Wt.committer.name===Nt?"You":Wt.committer.name,gi=new v.GitCommit(this.container,e.repoPath,Wt.oid,new v.GitCommitIdentity(Ci,Wt.author.email,new Date(Wt.author.date),Wt.author.avatarUrl),new v.GitCommitIdentity(ki,Wt.committer.email,new Date(Wt.author.date)),Wt.message.split(` `,1)[0],(n=Wt.parents.nodes[0])!=null&&n.oid?[(d=Wt.parents.nodes[0])==null?void 0:d.oid]:[],Wt.message,new v.GitFileChange(xe.toString(),Ue,v.GitFileIndexStatus.Modified),{changedFiles:Wt.changedFiles??0,additions:Wt.additions??0,deletions:Wt.deletions??0},[]);for(let tr=Et.startingLine;tr<=Et.endingLine;tr++){const Nn={sha:Wt.oid,originalLine:tr,line:tr};gi.lines.push(Nn)}return{author:{name:Ci,lineCount:Et.endingLine-Et.startingLine+1},commit:gi,line:{sha:Wt.oid,originalLine:Et.startingLine,line:Et.startingLine}}}catch(D){P.Y.error(h,D);return}}}async getBlameForLineContents(e,r,t,i){}async getBlameForRange(e,r){const t=await this.getBlame(e);if(t!=null)return this.getBlameRange(t,e,r)}async getBlameForRangeContents(e,r,t){const i=await this.getBlameContents(e,t);if(i!=null)return this.getBlameRange(i,e,r)}getBlameRange(e,r,t){if(e.lines.length===0)return pe({allLines:e.lines},e);if(t.start.line===0&&t.end.line===e.lines.length-1)return pe({allLines:e.lines},e);const i=e.lines.slice(t.start.line,t.end.line+1),n=new Set(i.map(be=>be.sha)),d=t.start.line+1,h=t.end.line+1,D=new Map,M=new Map;for(const be of e.commits.values()){if(!n.has(be.sha))continue;const Ee=be.with({lines:be.lines.filter(Ue=>Ue.line>=d&&Ue.line<=h)});M.set(be.sha,Ee);let xe=D.get(Ee.author.name);xe==null&&(xe={name:Ee.author.name,lineCount:0},D.set(xe.name,xe)),xe.lineCount+=Ee.lines.length}const le=new Map([...D.entries()].sort((be,Ee)=>Ee[1].lineCount-be[1].lineCount));return{repoPath:r.repoPath,authors:le,commits:M,lines:i,allLines:e.lines}}async getBranch(e){const{values:[r]}=await this.getBranches(e,{filter:t=>t.current});return r}async getBranches(e,r){if(e==null)return K;const t=P.Y.getCorrelationContext();let i=r?.cursor?void 0:this._branchesCache.get(e);if(i==null){async function d(){var h;try{const{metadata:D,github:M,session:le}=await this.ensureRepositoryContext(e),be=await D.getRevision(),Ee=be.type===0?be.name:void 0,xe=[];let Ue=r?.cursor;const st=Ue==null;for(;;){const He=await M.getBranches(le.accessToken,D.repo.owner,D.repo.name,{cursor:Ue});for(const vt of He.values){const Et=new Date(this.container.config.advanced.commitOrdering==="author-date"?vt.target.authoredDate:vt.target.committedDate),Wt=vt.target.oid;xe.push(new v.GitBranch(e,vt.name,!1,vt.name===Ee,Et,Wt,{name:`origin/${vt.name}`,missing:!1}),new v.GitBranch(e,`origin/${vt.name}`,!0,!1,Et,Wt))}if(!((h=He.paging)!=null&&h.more)||!st)return ht(pe({},He),{values:xe});Ue=He.paging.cursor}}catch(D){return P.Y.error(D,t),this._branchesCache.delete(e),K}}o(d,"load"),i=d.call(this),r?.cursor==null&&this._branchesCache.set(e,i)}let n=await i;return r?.filter!=null&&(n=ht(pe({},n),{values:n.values.filter(r.filter)})),r?.sort!=null&&v.GitBranch.sort(n.values,typeof r.sort=="boolean"?void 0:r.sort),n}async getChangedFilesCount(e,r){if(!r)return;const t=await this.getCommit(e,r);if(t?.stats==null)return;const{stats:i}=t,n=typeof i.changedFiles=="number"?i.changedFiles:i.changedFiles.added+i.changedFiles.changed+i.changedFiles.deleted;return{additions:i.additions,deletions:i.deletions,changedFiles:n}}async getCommit(e,r){var t;if(e==null)return;const i=P.Y.getCorrelationContext();try{const{metadata:n,github:d,session:h}=await this.ensureRepositoryContext(e),D=await d.getCommit(h.accessToken,n.repo.owner,n.repo.name,r);if(D==null)return;const{viewer:M=h.account.label}=D,le=M!=null&&D.author.name===M?"You":D.author.name,be=M!=null&&D.committer.name===M?"You":D.committer.name;return new v.GitCommit(this.container,e,D.oid,new v.GitCommitIdentity(le,D.author.email,new Date(D.author.date),D.author.avatarUrl),new v.GitCommitIdentity(be,D.committer.email,new Date(D.committer.date)),D.message.split(` `,1)[0],D.parents.nodes.map(Ee=>Ee.oid),D.message,((t=D.files)==null?void 0:t.map(Ee=>new v.GitFileChange(e,Ee.filename??"",(0,Me.fromCommitFileStatus)(Ee.status)??v.GitFileIndexStatus.Modified,Ee.previous_filename,void 0,{additions:Ee.additions??0,deletions:Ee.deletions??0,changes:Ee.changes??0})))??[],{changedFiles:D.changedFiles??0,additions:D.additions??0,deletions:D.deletions??0},[])}catch(n){P.Y.error(n,i);return}}async getCommitBranches(e,r,t){if(e==null||t?.commitDate==null)return[];const i=P.Y.getCorrelationContext();try{const{metadata:n,github:d,session:h}=await this.ensureRepositoryContext(e);let D;return t?.branch?D=await d.getCommitOnBranch(h.accessToken,n.repo.owner,n.repo.name,t?.branch,r,t?.commitDate):D=await d.getCommitBranches(h.accessToken,n.repo.owner,n.repo.name,r,t?.commitDate),D}catch(n){return P.Y.error(n,i),[]}}async getCommitCount(e,r){if(e==null)return;const t=P.Y.getCorrelationContext();try{const{metadata:i,github:n,session:d}=await this.ensureRepositoryContext(e);return await n.getCommitCount(d?.accessToken,i.repo.owner,i.repo.name,r)}catch(i){P.Y.error(i,t);return}}async getCommitForFile(e,r,t){var i;if(e==null)return;const n=P.Y.getCorrelationContext();try{const{metadata:d,github:h,remotehub:D,session:M}=await this.ensureRepositoryContext(e),le=this.getRelativePath(r,D.getProviderRootUri(r)),be=!t?.ref||t.ref==="HEAD"?(await d.getRevision()).revision:t.ref,Ee=await h.getCommitForFile(M.accessToken,d.repo.owner,d.repo.name,be,le);if(Ee==null)return;const{viewer:xe=M.account.label}=Ee,Ue=xe!=null&&Ee.author.name===xe?"You":Ee.author.name,st=xe!=null&&Ee.committer.name===xe?"You":Ee.committer.name,He=(i=Ee.files)==null?void 0:i.map(Et=>new v.GitFileChange(e,Et.filename??"",(0,Me.fromCommitFileStatus)(Et.status)??v.GitFileIndexStatus.Modified,Et.previous_filename,void 0,{additions:Et.additions??0,deletions:Et.deletions??0,changes:Et.changes??0})),vt=He?.find(Et=>Et.path===le);return new v.GitCommit(this.container,e,Ee.oid,new v.GitCommitIdentity(Ue,Ee.author.email,new Date(Ee.author.date),Ee.author.avatarUrl),new v.GitCommitIdentity(st,Ee.committer.email,new Date(Ee.committer.date)),Ee.message.split(` `,1)[0],Ee.parents.nodes.map(Et=>Et.oid),Ee.message,{file:vt,files:He},{changedFiles:Ee.changedFiles??0,additions:Ee.additions??0,deletions:Ee.deletions??0},[])}catch(d){P.Y.error(d,n);return}}async getOldestUnpushedRefForFile(e,r){}async getContributors(e,r){if(e==null)return[];const t=P.Y.getCorrelationContext();try{const{metadata:i,github:n,session:d}=await this.ensureRepositoryContext(e),h=await n.getContributors(d.accessToken,i.repo.owner,i.repo.name),D=await this.getCurrentUser(e),M=[];for(const le of h)le.type==="User"&&M.push(new v.GitContributor(e,le.name,le.email,le.contributions,void 0,(0,v.isUserMatch)(D,le.name,le.email,le.login),void 0,le.login,le.avatar_url,le.node_id));return M}catch(i){return P.Y.error(i,t),[]}}async getCurrentUser(e){if(!e)return;const r=P.Y.getCorrelationContext(),t=this._repoInfoCache.get(e);let i=t?.user;if(i!=null)return i;if(i!==null)try{const{metadata:n,github:d,session:h}=await this.ensureRepositoryContext(e);return i=await d.getCurrentUser(h.accessToken,n.repo.owner,n.repo.name),this._repoInfoCache.set(e,ht(pe({},t),{user:i??null})),i}catch(n){P.Y.error(n,r),this._repoInfoCache.set(e,ht(pe({},t),{user:null}));return}}async getDefaultBranchName(e,r){if(e==null)return;const t=P.Y.getCorrelationContext();try{const{metadata:i,github:n,session:d}=await this.ensureRepositoryContext(e);return await n.getDefaultBranchName(d.accessToken,i.repo.owner,i.repo.name)}catch(i){P.Y.error(i,t);return}}async getDiffForFile(e,r,t){}async getDiffForFileContents(e,r,t){}async getDiffForLine(e,r,t,i){}async getDiffStatus(e,r,t,i){}async getFileStatusForCommit(e,r,t){if(t===v.GitRevision.deletedOrMissing||v.GitRevision.isUncommitted(t))return;const i=await this.getCommitForFile(e,r,{ref:t});if(i!=null)return i.findFile(r)}async getLastFetchedTimestamp(e){}async getLog(e,r){var t,i,n;if(e==null)return;const d=P.Y.getCorrelationContext(),h=this.getPagingLimit(r?.limit);try{const{metadata:D,github:M,session:le}=await this.ensureRepositoryContext(e),be=!r?.ref||r.ref==="HEAD"?(await D.getRevision()).revision:r.ref,Ee=await M.getCommits(le.accessToken,D.repo.owner,D.repo.name,be,{all:r?.all,authors:r?.authors,after:r?.cursor,limit:h,since:r?.since?new Date(r.since):void 0}),xe=new Map,{viewer:Ue=le.account.label}=Ee;for(const He of Ee.values){const vt=Ue!=null&&He.author.name===Ue?"You":He.author.name,Et=Ue!=null&&He.committer.name===Ue?"You":He.committer.name;let Wt=xe.get(He.oid);Wt==null&&(Wt=new v.GitCommit(this.container,e,He.oid,new v.GitCommitIdentity(vt,He.author.email,new Date(He.author.date),He.author.avatarUrl),new v.GitCommitIdentity(Et,He.committer.email,new Date(He.committer.date)),He.message.split(` `,1)[0],He.parents.nodes.map(Nt=>Nt.oid),He.message,(t=He.files)==null?void 0:t.map(Nt=>new v.GitFileChange(e,Nt.filename??"",(0,Me.fromCommitFileStatus)(Nt.status)??v.GitFileIndexStatus.Modified,Nt.previous_filename,void 0,{additions:Nt.additions??0,deletions:Nt.deletions??0,changes:Nt.changes??0})),{changedFiles:He.changedFiles??0,additions:He.additions??0,deletions:He.deletions??0},[]),xe.set(He.oid,Wt))}const st={repoPath:e,commits:xe,sha:be,range:void 0,count:xe.size,limit:h,hasMore:((i=Ee.paging)==null?void 0:i.more)??!1,cursor:(n=Ee.paging)==null?void 0:n.cursor,query:He=>this.getLog(e,ht(pe({},r),{limit:He}))};return st.hasMore&&(st.more=this.getLogMoreFn(st,r)),st}catch(D){P.Y.error(D,d);return}}async getLogRefsOnly(e,r){const t=await this.getLog(e,r);if(t!=null)return new Set([...t.commits.values()].map(i=>i.ref))}getLogMoreFn(e,r){return async t=>{const i=t!=null&&typeof t=="object"?t.until:void 0;let n=typeof t=="number"?t:void 0;if(i&&(0,C.G)(e.commits.values(),M=>M.ref===i))return e;n=this.getPagingLimit(n);const d=await this.getLog(e.repoPath,ht(pe({},r),{limit:n,cursor:e.cursor}));if(d==null)return ht(pe({},e),{hasMore:!1});const h=new Map([...e.commits,...d.commits]),D={repoPath:e.repoPath,commits:h,sha:e.sha,range:void 0,count:h.size,limit:i==null?(e.limit??0)+n:void 0,hasMore:i==null?d.hasMore:!0,cursor:d.cursor,query:e.query};return D.more=this.getLogMoreFn(D,r),D}}async getLogForSearch(e,r,t){var i,n,d;if(e==null)return;const h=P.Y.getCorrelationContext(),D=R.n.parseSearchOperations(r.pattern);let M,le=D.get("commit:");if(le!=null){const xe=await this.getCommit(e,le[0]);return xe==null?void 0:{repoPath:e,commits:new Map([[xe.sha,xe]]),sha:xe.sha,range:void 0,count:1,limit:1,hasMore:!1}}const be=[];for([M,le]of D.entries())switch(M){case"message:":be.push(...le.map(xe=>xe.replace(/ /g,"+")));break;case"author:":be.push(...le.map(xe=>(xe=xe.replace(/ /g,"+"),xe.startsWith("@")?`author:${xe.slice(1)}`:xe.startsWith('"@')?`author:"${xe.slice(2)}`:xe.includes("@")?`author-email:${xe}`:`author-name:${xe}`)));break}if(be.length===0)return;const Ee=this.getPagingLimit(t?.limit);try{const{metadata:xe,github:Ue,session:st}=await this.ensureRepositoryContext(e),He=await Ue.searchCommits(st.accessToken,`repo:${xe.repo.owner}/${xe.repo.name}+${be.join("+").trim()}`,{cursor:t?.cursor,limit:Ee,sort:t?.ordering==="date"?"committer-date":t?.ordering==="author-date"?"author-date":void 0});if(He==null)return;const vt=new Map,Et=st.account.label;for(const Nt of He.values){const Ci=Et!=null&&Nt.author.name===Et?"You":Nt.author.name,ki=Et!=null&&Nt.committer.name===Et?"You":Nt.committer.name;let gi=vt.get(Nt.oid);gi==null&&(gi=new v.GitCommit(this.container,e,Nt.oid,new v.GitCommitIdentity(Ci,Nt.author.email,new Date(Nt.author.date),Nt.author.avatarUrl),new v.GitCommitIdentity(ki,Nt.committer.email,new Date(Nt.committer.date)),Nt.message.split(` `,1)[0],Nt.parents.nodes.map(tr=>tr.oid),Nt.message,(i=Nt.files)==null?void 0:i.map(tr=>new v.GitFileChange(e,tr.filename??"",(0,Me.fromCommitFileStatus)(tr.status)??v.GitFileIndexStatus.Modified,tr.previous_filename,void 0,{additions:tr.additions??0,deletions:tr.deletions??0,changes:tr.changes??0})),{changedFiles:Nt.changedFiles??0,additions:Nt.additions??0,deletions:Nt.deletions??0},[]),vt.set(Nt.oid,gi))}const Wt={repoPath:e,commits:vt,sha:void 0,range:void 0,count:vt.size,limit:Ee,hasMore:((n=He.pageInfo)==null?void 0:n.hasNextPage)??!1,cursor:((d=He.pageInfo)==null?void 0:d.endCursor)??void 0,query:Nt=>this.getLog(e,ht(pe({},t),{limit:Nt}))};return Wt.hasMore&&(Wt.more=this.getLogForSearchMoreFn(Wt,r,t)),Wt}catch(xe){P.Y.error(xe,h);return}}getLogForSearchMoreFn(e,r,t){return async i=>{i=this.getPagingLimit(i);const n=await this.getLogForSearch(e.repoPath,r,ht(pe({},t),{limit:i,cursor:e.cursor}));if(n==null)return ht(pe({},e),{hasMore:!1});const d=new Map([...e.commits,...n.commits]),h={repoPath:e.repoPath,commits:d,sha:e.sha,range:void 0,count:d.size,limit:(e.limit??0)+i,hasMore:n.hasMore,cursor:n.cursor,query:e.query};return h.more=this.getLogForSearchMoreFn(h,r,t),h}}async getLogForFile(e,r,t){if(e==null)return;const i=P.Y.getCorrelationContext(),n=this.getRelativePath(r,e);if(e!=null&&e===n)throw new Error(`File name cannot match the repository path; path=${n}`);t=pe({reverse:!1},t),t.renames=!1,t.all=!1;let d="log";t.ref!=null&&(d+=`:${t.ref}`),t.limit=this.getPagingLimit(t?.limit),t.limit&&(d+=`:n${t.limit}`),t.renames&&(d+=":follow"),t.reverse&&(d+=":reverse"),t.since&&(d+=`:since=${t.since}`),t.skip&&(d+=`:skip${t.skip}`),t.cursor&&(d+=`:cursor=${t.cursor}`);const h=await this.container.tracker.getOrAdd(A.YY.fromFile(n,e,t.ref));if(!t.force&&t.range==null){if(h.state!=null){const M=h.state.getLog(d);if(M!=null)return P.Y.debug(i,`Cache hit: '${d}'`),M.item;if(t.ref!=null||t.limit!=null){const le=h.state.getLog(`log${t.renames?":follow":""}${t.reverse?":reverse":""}`);if(le!=null){if(t.ref==null)return P.Y.debug(i,`Cache hit: ~'${d}'`),le.item;P.Y.debug(i,`Cache ?: '${d}'`);let be=await le.item;if(be!=null&&!be.hasMore&&be.commits.has(t.ref)){P.Y.debug(i,`Cache hit: '${d}'`);let Ee=!0,xe=0;const Ue=new Map((0,C.DZ)(be.commits.entries(),([He,vt])=>{if(Ee){if(He!==t?.ref)return;Ee=!1}if(xe++,!(t?.limit!=null&&xe>t.limit))return[He,vt]})),st=pe({},t);return be=ht(pe({},be),{limit:t.limit,count:Ue.size,commits:Ue,query:He=>this.getLogForFile(e,r,ht(pe({},st),{limit:He}))}),be}}}}P.Y.debug(i,`Cache miss: '${d}'`),h.state==null&&(h.state=new ce(h.key))}const D=this.getLogForFileCore(e,n,h,d,i,t);if(h.state!=null&&t.range==null){P.Y.debug(i,`Cache add: '${d}'`);const M={item:D};h.state.setLog(d,M)}return D}async getLogForFileCore(e,r,t,i,n,d){var h,D,M;if(e==null)return;const le=this.getPagingLimit(d?.limit);try{const be=await this.ensureRepositoryContext(e);if(be==null)return;const{metadata:Ee,github:xe,remotehub:Ue,session:st}=be,He=this.getAbsoluteUri(r,e),vt=this.getRelativePath(He,Ue.getProviderRootUri(He)),Et=!d?.ref||d.ref==="HEAD"?(await Ee.getRevision()).revision:d.ref,Wt=await xe.getCommits(st.accessToken,Ee.repo.owner,Ee.repo.name,Et,{all:d?.all,after:d?.cursor,path:vt,limit:le,since:d?.since?new Date(d.since):void 0}),Nt=new Map,{viewer:Ci=st.account.label}=Wt;for(const gi of Wt.values){const tr=Ci!=null&&gi.author.name===Ci?"You":gi.author.name,Nn=Ci!=null&&gi.committer.name===Ci?"You":gi.committer.name;let Mn=Nt.get(gi.oid);if(Mn==null){const ms=(h=gi.files)==null?void 0:h.map(Io=>new v.GitFileChange(e,Io.filename??"",(0,Me.fromCommitFileStatus)(Io.status)??v.GitFileIndexStatus.Modified,Io.previous_filename,void 0,{additions:Io.additions??0,deletions:Io.deletions??0,changes:Io.changes??0})),Tc=(0,k.Mh)(vt)?void 0:ms?.find(Io=>Io.path===vt)??new v.GitFileChange(e,vt,v.GitFileIndexStatus.Modified,void 0,void 0,gi.changedFiles===1?{additions:gi.additions??0,deletions:gi.deletions??0,changes:0}:void 0);Mn=new v.GitCommit(this.container,e,gi.oid,new v.GitCommitIdentity(tr,gi.author.email,new Date(gi.author.date),gi.author.avatarUrl),new v.GitCommitIdentity(Nn,gi.committer.email,new Date(gi.committer.date)),gi.message.split(` `,1)[0],gi.parents.nodes.map(Io=>Io.oid),gi.message,{file:Tc,files:ms},{changedFiles:gi.changedFiles??0,additions:gi.additions??0,deletions:gi.deletions??0},[]),Nt.set(gi.oid,Mn)}}const ki={repoPath:e,commits:Nt,sha:Et,range:void 0,count:Nt.size,limit:le,hasMore:((D=Wt.paging)==null?void 0:D.more)??!1,cursor:(M=Wt.paging)==null?void 0:M.cursor,query:gi=>this.getLogForFile(e,r,ht(pe({},d),{limit:gi}))};return ki.hasMore&&(ki.more=this.getLogForFileMoreFn(ki,r,d)),ki}catch(be){if(t.state!=null&&d?.range==null&&!d?.reverse){const Ee=be?.toString()??"";P.Y.debug(n,`Cache replace (with empty promise): '${i}'`);const xe={item:_e,errorMessage:Ee};return t.state.setLog(i,xe),_e}return}}getLogForFileMoreFn(e,r,t){return async i=>{const n=i!=null&&typeof i=="object"?i.until:void 0;let d=typeof i=="number"?i:void 0;if(n&&(0,C.G)(e.commits.values(),le=>le.ref===n))return e;d=this.getPagingLimit(d);const h=await this.getLogForFile(e.repoPath,r,ht(pe({},t),{limit:n==null?d:0,cursor:e.cursor}));if(h==null)return ht(pe({},e),{hasMore:!1});const D=new Map([...e.commits,...h.commits]),M={repoPath:e.repoPath,commits:D,sha:e.sha,range:e.range,count:D.size,limit:n==null?(e.limit??0)+d:void 0,hasMore:n==null?h.hasMore:!0,cursor:h.cursor,query:e.query};return M.more=this.getLogForFileMoreFn(M,r,t),M}}async getMergeBase(e,r,t,i){}async getMergeStatus(e){}async getRebaseStatus(e){}async getNextComparisonUris(e,r,t,i=0){if(!t)return;const n=P.Y.getCorrelationContext();try{const d=await this.ensureRepositoryContext(e);if(d==null)return;const{metadata:h,github:D,remotehub:M,session:le}=d,be=this.getRelativePath(r,M.getProviderRootUri(r)),Ee=(await h.getRevision()).revision;t==="HEAD"&&(t=Ee);const xe=await D.getNextCommitRefs(le.accessToken,h.repo.owner,h.repo.name,Ee,be,t);return{current:i===0?A.YY.fromFile(be,e,t):new A.YY(await this.getBestRevisionUri(e,be,xe[i-1])),next:new A.YY(await this.getBestRevisionUri(e,be,xe[i]))}}catch(d){throw P.Y.error(d,n),d}}async getPreviousComparisonUris(e,r,t,i=0,n=!1){var d,h;if(t===v.GitRevision.deletedOrMissing)return;const D=P.Y.getCorrelationContext();t===v.GitRevision.uncommitted&&(t=void 0);try{const M=await this.ensureRepositoryContext(e);if(M==null)return;const{metadata:le,github:be,remotehub:Ee,session:xe}=M,Ue=this.getRelativePath(r,Ee.getProviderRootUri(r)),st=t!=null?1:0,He=await be.getCommitRefs(xe.accessToken,le.repo.owner,le.repo.name,!t||t==="HEAD"?(await le.getRevision()).revision:t,{path:Ue,first:st+i+1});if(He==null)return;const vt=i===0?A.YY.fromFile(Ue,e,t):new A.YY(await this.getBestRevisionUri(e,Ue,((d=He.values[st+i-1])==null?void 0:d.oid)??v.GitRevision.deletedOrMissing));return vt==null||vt.sha===v.GitRevision.deletedOrMissing?void 0:{current:vt,previous:new A.YY(await this.getBestRevisionUri(e,Ue,((h=He.values[st+i])==null?void 0:h.oid)??v.GitRevision.deletedOrMissing))}}catch(M){throw P.Y.error(M,D),M}}async getPreviousComparisonUrisForLine(e,r,t,i,n=0){var d,h;if(i===v.GitRevision.deletedOrMissing)return;const D=P.Y.getCorrelationContext();try{const M=await this.ensureRepositoryContext(e);if(M==null)return;const{remotehub:le}=M;let be=this.getRelativePath(r,le.getProviderRootUri(r)),Ee=A.YY.fromFile(be,e,i),xe=t,Ue,st=t,He=t;for(let vt=0;vt{this._sessionPromise=void 0,this.ensureSession(!0)})),this._github=e}return this._github}async ensureRemoteHubApi(e){if(this._remotehubPromise==null&&(this._remotehubPromise=Ae(),this._remotehubPromise.then(r=>this._remotehub=r,()=>this._remotehub=void 0)),!e)return this._remotehubPromise;try{return await this._remotehubPromise}catch{return}}async ensureSession(e=!1){if(this._sessionPromise==null){async function r(){try{return e?await s.authentication.getSession("github",ie,{forceNewSession:!0}):await s.authentication.getSession("github",ie,{createIfNone:!0})}catch(t){throw t instanceof Error&&t.message.includes("User did not consent")?new b._7("github",b.Jx.UserDidNotConsent):(P.Y.error(t),new b._7("github",void 0,t))}}o(r,"getSession"),this._sessionPromise=r()}return this._sessionPromise}createVirtualUri(e,r,t){let i;if(typeof r=="string")r&&(v.GitRevision.isSha(r)?i={v:1,ref:{id:r,type:2}}:i={v:1,ref:{id:r,type:4}});else switch(r?.refType){case"revision":case"stash":i={v:1,ref:{id:r.ref,type:2}};break;case"branch":case"tag":i={v:1,ref:{id:r.name,type:4}};break}if(typeof e=="string"&&(e=s.Uri.parse(e,!0)),t){let n=e.path;n.endsWith("/")&&(n=n.slice(0,-1)),t=this.getRelativePath(t,e),t=`${n}/${t.startsWith("/")?t.slice(0,-1):t}`}return e.with({scheme:w.sN.Virtual,authority:Ie("github",i),path:t??e.path})}createProviderUri(e,r,t){const i=this.createVirtualUri(e,r,t);return this._remotehub==null?i.scheme!==w.sN.Virtual?i:i.with({scheme:w.sN.GitHub}):this._remotehub.getProviderUri(i)}getPagingLimit(e){return e=Math.min(100,e??this.container.config.advanced.maxListItems??100),e===0&&(e=100),e}async resolveReferenceCore(e,r,t){var i,n;if(t==null||t==="HEAD")return(await r.getRevision()).revision;if(v.GitRevision.isSha(t))return t;if(v.GitRevision.isRange(t))return;const[d,h]=await Promise.allSettled([this.getBranches(e,{filter:D=>D.name===t}),this.getTags(e,{filter:D=>D.name===t})]);return t=(d.status==="fulfilled"?(i=d.value.values[0])==null?void 0:i.sha:void 0)??(h.status==="fulfilled"?(n=h.value.values[0])==null?void 0:n.sha:void 0),t==null,t}}o(Ce,"GitHubGitProvider"),Z([(0,_.cM)()],Ce.prototype,"getBestRevisionUri",1),Z([(0,_.cM)()],Ce.prototype,"getWorkingUri",1),Z([(0,_.cM)()],Ce.prototype,"addRemote",1),Z([(0,_.cM)()],Ce.prototype,"pruneRemote",1),Z([(0,_.cM)()],Ce.prototype,"applyChangesToWorkingFile",1),Z([(0,_.cM)()],Ce.prototype,"branchContainsCommit",1),Z([(0,_.cM)()],Ce.prototype,"checkout",1),Z([(0,_.cM)()],Ce.prototype,"resetCaches",1),Z([(0,_.cM)({args:{1:l=>l.length}})],Ce.prototype,"excludeIgnoredUris",1),Z([(0,_.cM)()],Ce.prototype,"fetch",1),Z([(0,F.H)(),(0,_.fF)()],Ce.prototype,"findRepositoryUri",1),Z([(0,_.cM)({args:{1:l=>l.join(",")}})],Ce.prototype,"getAheadBehindCommitCount",1),Z([(0,F.H)(),(0,_.cM)()],Ce.prototype,"getBlame",1),Z([(0,_.cM)({args:{1:""}})],Ce.prototype,"getBlameContents",1),Z([(0,F.H)(),(0,_.cM)()],Ce.prototype,"getBlameForLine",1),Z([(0,_.cM)({args:{2:""}})],Ce.prototype,"getBlameForLineContents",1),Z([(0,_.cM)()],Ce.prototype,"getBlameForRange",1),Z([(0,_.cM)({args:{2:""}})],Ce.prototype,"getBlameForRangeContents",1),Z([(0,_.cM)({args:{0:""}})],Ce.prototype,"getBlameRange",1),Z([(0,_.cM)()],Ce.prototype,"getBranch",1),Z([(0,_.cM)({args:{1:!1}})],Ce.prototype,"getBranches",1),Z([(0,_.cM)()],Ce.prototype,"getChangedFilesCount",1),Z([(0,_.cM)()],Ce.prototype,"getCommit",1),Z([(0,_.cM)()],Ce.prototype,"getCommitBranches",1),Z([(0,_.cM)()],Ce.prototype,"getCommitCount",1),Z([(0,_.cM)()],Ce.prototype,"getCommitForFile",1),Z([(0,_.cM)()],Ce.prototype,"getOldestUnpushedRefForFile",1),Z([(0,_.cM)()],Ce.prototype,"getContributors",1),Z([(0,F.H)(),(0,_.cM)()],Ce.prototype,"getCurrentUser",1),Z([(0,_.cM)()],Ce.prototype,"getDefaultBranchName",1),Z([(0,_.cM)()],Ce.prototype,"getDiffForFile",1),Z([(0,_.cM)({args:{1:l=>""}})],Ce.prototype,"getDiffForFileContents",1),Z([(0,_.cM)()],Ce.prototype,"getDiffForLine",1),Z([(0,_.cM)()],Ce.prototype,"getDiffStatus",1),Z([(0,_.cM)()],Ce.prototype,"getFileStatusForCommit",1),Z([(0,_.cM)()],Ce.prototype,"getLog",1),Z([(0,_.cM)()],Ce.prototype,"getLogRefsOnly",1),Z([(0,_.cM)()],Ce.prototype,"getLogForSearch",1),Z([(0,_.cM)()],Ce.prototype,"getLogForFile",1),Z([(0,_.cM)()],Ce.prototype,"getMergeBase",1),Z([(0,_.cM)()],Ce.prototype,"getMergeStatus",1),Z([(0,_.cM)()],Ce.prototype,"getRebaseStatus",1),Z([(0,_.cM)()],Ce.prototype,"getNextComparisonUris",1),Z([(0,_.cM)()],Ce.prototype,"getPreviousComparisonUris",1),Z([(0,_.cM)()],Ce.prototype,"getPreviousComparisonUrisForLine",1),Z([(0,_.cM)()],Ce.prototype,"getIncomingActivity",1),Z([(0,_.cM)({args:{1:!1}})],Ce.prototype,"getRemotes",1),Z([(0,_.cM)()],Ce.prototype,"getRevisionContent",1),Z([(0,_.cM)()],Ce.prototype,"getStash",1),Z([(0,_.cM)()],Ce.prototype,"getStatusForFile",1),Z([(0,_.cM)()],Ce.prototype,"getStatusForFiles",1),Z([(0,_.cM)()],Ce.prototype,"getStatusForRepo",1),Z([(0,_.cM)({args:{1:!1}})],Ce.prototype,"getTags",1),Z([(0,_.cM)()],Ce.prototype,"getTreeEntryForRevision",1),Z([(0,_.cM)()],Ce.prototype,"getTreeForRevision",1),Z([(0,_.cM)()],Ce.prototype,"hasBranchOrTag",1),Z([(0,_.cM)()],Ce.prototype,"hasCommitBeenPushed",1),Z([(0,_.cM)()],Ce.prototype,"getDiffTool",1),Z([(0,_.cM)()],Ce.prototype,"openDiffTool",1),Z([(0,_.cM)()],Ce.prototype,"openDirectoryCompare",1),Z([(0,_.cM)()],Ce.prototype,"resolveReference",1),Z([(0,_.cM)()],Ce.prototype,"validateBranchOrTagName",1),Z([(0,_.cM)()],Ce.prototype,"validateReference",1),Z([(0,_.cM)()],Ce.prototype,"stageFile",1),Z([(0,_.cM)()],Ce.prototype,"stageDirectory",1),Z([(0,_.cM)()],Ce.prototype,"unStageFile",1),Z([(0,_.cM)()],Ce.prototype,"unStageDirectory",1),Z([(0,_.cM)()],Ce.prototype,"stashApply",1),Z([(0,_.cM)()],Ce.prototype,"stashDelete",1),Z([(0,_.cM)({args:{2:l=>l?.length}})],Ce.prototype,"stashSave",1),Z([(0,F.H)()],Ce.prototype,"ensureRepositoryContext",1),Z([(0,F.H)()],Ce.prototype,"ensureGitHub",1);function Ie(l,e){return`${l}${e!=null?`+${(0,I.e)(JSON.stringify(e))}`:""}`}o(Ie,"encodeAuthority");function nt(l,...e){return Promise.resolve("")}o(nt,"git");async function wt(l){return[new Ce(l)]}o(wt,"getSupportedGitProviders");var pt=g(6277),ct=g(6216),$t=g(680),Gt=g(3430),Ai=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,Pi=o((l,e,r)=>e in l?Ai(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"autolinks_defNormalProp"),Lt=o((l,e,r,t)=>{for(var i=t>1?void 0:t?Ti(e,r):e,n=l.length-1,d;n>=0;n--)(d=l[n])&&(i=(t?d(e,r,i):d(i))||i);return t&&i&&Ai(e,r,i),i},"autolinks_decorateClass"),ti=o((l,e,r)=>(Pi(l,typeof e!="symbol"?e+"":e,r),r),"autolinks_publicField");const Ei=//g;function Hi(l){return l.prefix===void 0&&l.url===void 0}o(Hi,"isDynamic");function dr(l){return l.prefix!==void 0&&l.url!==void 0}o(dr,"isCacheable");class St{constructor(e){this.container=e,ti(this,"_disposable"),ti(this,"_references",[]),this._disposable=s.Disposable.from(f.DN.onDidChange(this.onConfigurationChanged,this)),this.onConfigurationChanged()}dispose(){var e;(e=this._disposable)==null||e.dispose()}onConfigurationChanged(e){f.DN.changed(e,"autolinks")&&(this._references=this.container.config.autolinks??[])}async getIssueOrPullRequestLinks(e,r,{timeout:t}={}){if(!r.hasRichProvider())return;const{provider:i}=r;if(!(i.maybeConnected??await i.isConnected()))return;const d=new Set;let h,D;for(const le of i.autolinks)if(!!dr(le)){le.messageRegex===void 0&&(le.messageRegex=new RegExp(`(?<=^|\\s|\\(|\\\\\\[)(${(0,Gt.yI)(le.prefix)}([${le.alphanumeric?"\\w":"0-9"}]+))\\b`,le.ignoreCase?"gi":"g"));do{if(h=le.messageRegex.exec(e),h==null)break;[,,D]=h,d.add(D)}while(!0)}if(d.size===0)return;const M=await(0,$t.xu)(d.values(),le=>i.getIssueOrPullRequest(le),t);if(!(M.size===0||(0,C.yW)(M.values(),le=>le===void 0)))return M}linkify(e,r,t,i,n){for(const d of this._references)this.ensureAutolinkCached(d,i)&&d.linkify!=null&&(e=d.linkify(e,r,n));if(t!=null&&t.length!==0){for(const d of t)if(d.provider!==void 0)for(const h of d.provider.autolinks)this.ensureAutolinkCached(h,i)&&h.linkify!=null&&(e=h.linkify(e,r,n))}return e}ensureAutolinkCached(e,r){if(Hi(e))return!0;try{if(e.messageMarkdownRegex===void 0&&(e.messageMarkdownRegex=new RegExp(`(?<=^|\\s|\\(|\\\\\\[)(${(0,Gt.yI)((0,Gt.ry)(e.prefix))}([${e.alphanumeric?"\\w":"0-9"}]+))\\b`,e.ignoreCase?"gi":"g")),r==null||r.size===0){const t=`[$1](${(0,ct.M)(e.url.replace(Ei,"$2"))}${e.title?` "${e.title.replace(Ei,"$2")}"`:""})`;return e.linkify=(i,n)=>n?i.replace(e.messageMarkdownRegex,t):i,!0}e.linkify=(t,i,n)=>{const d=n==null;let h;return i?t.replace(e.messageMarkdownRegex,(D,M,le)=>{const be=r?.get(le),Ee=(0,ct.M)(e.url.replace(Ei,le));let xe="";if(e.title){if(xe=` "${e.title.replace(Ei,le)}`,be!=null)if(be instanceof $t.PK)xe+=` ${w.NE.Dash.repeat(2)} Details timed out`;else{const Ue=be.title.replace(/([")\\])/g,"\\$1").trim();n!=null&&(h=n.size+1,n.set(h,`${v.IssueOrPullRequest.getMarkdownIcon(be)} [**${Ue}**](${Ee}${xe}")\\ ${w.NE.Space.repeat(5)}${M} ${be.closed?"closed":"opened"} ${(0,pt.Zh)(be.closedDate??be.date)}`)),xe+=` ${w.NE.Dash.repeat(2)} ${Ue} ${be.closed?"Closed":"Opened"}, ${(0,pt.Zh)(be.closedDate??be.date)}`}xe+='"'}return`[${M}](${Ee}${xe})`}):(t=t.replace(e.messageRegex,(D,M,le)=>{const be=r?.get(le);return be==null?M:(n===void 0&&(n=new Map),h=n.size+1,n.set(h,`${M}: ${be instanceof $t.PK?"Details timed out":`${be.title} ${w.NE.Dot} ${be.closed?"Closed":"Opened"}, ${(0,pt.Zh)(be.closedDate??be.date)}`}`),`${M}${(0,Gt.sC)(h)}`)}),d&&n!=null&&n.size!==0?`${t} ${w.NE.Dash.repeat(2)} ${(0,C.v_)((0,C.UI)(n,([D,M])=>`${(0,Gt.sC)(D)} ${M}`),` `)}`:t)}}catch(t){P.Y.error(t,`Failed to create autolink generator: prefix=${e.prefix}, url=${e.url}, title=${e.title}`),e.linkify=null}return!0}}o(St,"Autolinks"),Lt([(0,_.fF)({args:{0:"",1:!1,2:l=>l?.timeout}})],St.prototype,"getIssueOrPullRequestLinks",1),Lt([(0,_.fF)({args:{0:"",2:l=>l?.length,3:l=>l?.size,4:l=>l?.size}})],St.prototype,"linkify",1);var we=Object.defineProperty,Fe=o((l,e,r)=>e in l?we(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"annotationProvider_defNormalProp"),Je=o((l,e,r)=>(Fe(l,typeof e!="symbol"?e+"":e,r),r),"annotationProvider_publicField"),dt=(l=>(l.Computing="computing",l.Computed="computed",l))(dt||{});class ft{constructor(e,r,t){this.annotationType=e,this.editor=r,this.trackedDocument=t,Je(this,"annotationContext"),Je(this,"correlationKey"),Je(this,"document"),Je(this,"status"),Je(this,"decorations"),Je(this,"disposable"),this.correlationKey=ft.getCorrelationKey(this.editor),this.document=this.editor.document,this.disposable=s.Disposable.from(s.window.onDidChangeTextEditorSelection(this.onTextEditorSelectionChanged,this))}static getCorrelationKey(e){return`${e?.document.uri.toString()}|${e?.viewColumn}`}dispose(){this.clear(),this.disposable.dispose()}onTextEditorSelectionChanged(e){this.document===e.textEditor.document&&this.selection({line:e.selections[0].active.line})}get editorUri(){var e,r;return(r=(e=this.editor)==null?void 0:e.document)==null?void 0:r.uri}clear(){var e;if(this.annotationContext=void 0,this.status=void 0,this.editor!=null&&(e=this.decorations)!=null&&e.length){for(const r of this.decorations)try{this.editor.setDecorations(r.decorationType,[])}catch{}this.decorations=void 0}}mustReopen(e){return!1}refresh(e){var r;if(this.editor==null||!((r=this.decorations)!=null&&r.length))return;const t=[];for(const i of this.decorations){const n=e.get(i.decorationType);n!==null&&(n!=null&&(i.decorationType=n),t.push(i))}this.setDecorations(this.decorations)}async restore(e){var r;if(this.editor._disposed!==!1){if(this.status="computing",e===s.window.activeTextEditor&&await(0,y.v)(w.zf.AnnotationStatus,this.status),this.editor=e,this.correlationKey=ft.getCorrelationKey(e),this.document=e.document,(r=this.decorations)!=null&&r.length)for(const t of this.decorations)this.editor.setDecorations(t.decorationType,t.rangesOrOptions);this.status="computed",e===s.window.activeTextEditor&&await(0,y.v)(w.zf.AnnotationStatus,this.status)}}async provideAnnotation(e){this.status="computing";try{if(await this.onProvideAnnotation(e))return this.status="computed",!0}catch(r){P.Y.error(r)}return this.status=void 0,!1}setDecorations(e){var r,t;if((r=this.decorations)!=null&&r.length&&this.clear(),this.decorations=e,(t=this.decorations)!=null&&t.length)for(const i of this.decorations)this.editor.setDecorations(i.decorationType,i.rangesOrOptions)}}o(ft,"AnnotationProviderBase");var kt=g(7640),Rt=g(7042),Dt=g(9417),ri=g(2078);const jt=/^(?:(#?)([0-9a-f]{3}|[0-9a-f]{6})|((?:rgb|hsl)a?)\((-?\d+%?)[,\s]+(-?\d+%?)[,\s]+(-?\d+%?)[,\s]*(-?[\d.]+%?)?\))$/i;function qt(l,e){const r=l+e,t=e<0?r<0?0:r:r>255?255:r;return Math.round(t)}o(qt,"adjustLight");function Ht(l,e){return vi(l,-e)}o(Ht,"darken");function vi(l,e){const r=ar(l);if(r==null)return l;const[t,i,n,d]=r,h=255*e/100;return`rgba(${qt(t,h)}, ${qt(i,h)}, ${qt(n,h)}, ${d})`}o(vi,"lighten");function ii(l,e){const r=ar(l);if(r==null)return l;const[t,i,n,d]=r;return`rgba(${t}, ${i}, ${n}, ${d*(e/100)})`}o(ii,"opacity");function ar(l){l=l.trim();const e=jt.exec(l);if(e==null)return null;if(e[1]==="#"){const r=e[2];switch(r.length){case 3:return[parseInt(r[0]+r[0],16),parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),1];case 6:return[parseInt(r.substring(0,2),16),parseInt(r.substring(2,4),16),parseInt(r.substring(4,6),16),1]}return null}switch(e[3]){case"rgb":return[parseInt(e[4],10),parseInt(e[5],10),parseInt(e[6],10),1];case"rgba":return[parseInt(e[4],10),parseInt(e[5],10),parseInt(e[6],10),parseFloat(e[7])];default:return null}}o(ar,"toRgba");var Rr=Object.defineProperty,ze=Object.defineProperties,$e=Object.getOwnPropertyDescriptors,ke=Object.getOwnPropertySymbols,Ge=Object.prototype.hasOwnProperty,Ke=Object.prototype.propertyIsEnumerable,Oe=o((l,e,r)=>e in l?Rr(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"annotations_defNormalProp"),Se=o((l,e)=>{for(var r in e||(e={}))Ge.call(e,r)&&Oe(l,r,e[r]);if(ke)for(var r of ke(e))Ke.call(e,r)&&Oe(l,r,e[r]);return l},"annotations_spreadValues"),Xe=o((l,e)=>ze(l,$e(e)),"annotations_spreadProps");const lt="#f66a0a",gt="#0a60f6",_t=["#f66a0a","#ef6939","#e96950","#e26862","#db6871","#d3677e","#cc678a","#c46696","#bb66a0","#b365a9","#a965b3","#a064bb","#9664c4","#8a63cc","#7e63d3","#7162db","#6262e2","#5061e9","#3961ef","#0a60f6"];let It;async function Qt(){if(It==null){let l;qi.instance.config.heatmap.coldColor===gt&&qi.instance.config.heatmap.hotColor===lt?l=_t:l=(await g.e(795).then(g.t.bind(g,8670,23))).default.scale([qi.instance.config.heatmap.hotColor,qi.instance.config.heatmap.coldColor]).mode("lrgb").classes(20).colors(20),It={hot:l.slice(0,10),cold:l.slice(10,20)};const e=f.DN.onDidChange(r=>{(f.DN.changed(r,"heatmap.ageThreshold")||f.DN.changed(r,"heatmap.hotColor")||f.DN.changed(r,"heatmap.coldColor"))&&(e.dispose(),It=void 0)})}return It}o(Qt,"getHeatmapColors");class ui{static applyHeatmap(e,r,t){const[i,n,d,h]=this.getHeatmapColor(r,t);e.renderOptions.before.borderColor=`rgba(${i},${n},${d},${h})`}static addOrUpdateGutterHeatmapDecoration(e,r,t,i){const[n,d,h,D]=this.getHeatmapColor(e,r),{locations:M}=qi.instance.config.heatmap,le=M.includes(ri.o9.Gutter),be=M.includes(ri.o9.Overview),Ee=`${n},${d},${h},${D}`;let xe=i.get(Ee);return xe==null?(xe={decorationType:s.window.createTextEditorDecorationType({gutterIconPath:le?s.Uri.parse(`data:image/svg+xml,${encodeURIComponent(``)}`):void 0,gutterIconSize:le?"contain":void 0,overviewRulerLane:be?s.OverviewRulerLane.Center:void 0,overviewRulerColor:be?`rgba(${n},${d},${h},${D})`:void 0}),rangesOrOptions:[t]},i.set(Ee,xe)):xe.rangesOrOptions.push(t),xe.decorationType}static gutter(e,r,t,i){const n={renderOptions:{before:Se({},i)}};e.isUncommitted&&(n.renderOptions.before.color=i.uncommittedColor);const d=kt.i.fromTemplate(r,e,t);return n.renderOptions.before.contentText=(0,Gt.vk)(d.replace(/ /g,w.NE.Space),1,1),n}static gutterRenderOptions(e,r,t,i,n){let d=0;for(const le of Object.values(n.tokenOptions))if(le!==void 0){if(le.truncateTo==null){d=-1;break}d+=le.truncateTo}d>=0&&(d+=(0,Gt.dz)((0,Gt.sX)(i,void 0)),d>0&&(d+=3));let h,D;r.enabled&&(h="solid",D=r.location==="left"?"0 0 0 2px":"0 2px 0 0");let M;if(d>=0){const le=f.DN.getAny("editor.letterSpacing");le!=null&&le!==0?M=`calc(${d}ch + ${Math.round(d*le)+(t?13:-6)}px)`:M=`calc(${d}ch ${t?"+ 13px":"- 6px"})`}return{backgroundColor:new s.ThemeColor(w.wL.GutterBackgroundColor),borderStyle:h,borderWidth:D,color:new s.ThemeColor(w.wL.GutterForegroundColor),fontWeight:"normal",fontStyle:"normal",height:"100%",margin:"0 26px -1px 0",textDecoration:`${e?"overline solid rgba(0, 0, 0, .2)":"none"};box-sizing: border-box${t?";padding: 0 0 0 18px":""}`,width:M,uncommittedColor:new s.ThemeColor(w.wL.GutterUncommittedForegroundColor)}}static trailing(e,r,t,i=!0){const n=kt.i.fromTemplate(r,e,Xe(Se({},t),{messageTruncateAtNewLine:!0}));return{renderOptions:{after:{backgroundColor:new s.ThemeColor(w.wL.TrailingLineBackgroundColor),color:new s.ThemeColor(w.wL.TrailingLineForegroundColor),contentText:(0,Gt.vk)(n.replace(/ /g,w.NE.Space),1,1),fontWeight:"normal",fontStyle:"normal",textDecoration:`none;${i?"":" position: absolute;"}`}}}}static getHeatmapColor(e,r){const t=r.computeRelativeAge(e),i=e.getTime(){async function e(D,M,le,be){const Ee=M.sha;let xe=null;async function Ue(){if(D.file==null)return;let Nt;if(D.isUncommitted)v.GitRevision.isUncommittedStaged(Ee)&&(Nt=Ee);else if(xe=await D.getPreviousSha(),Nt=xe,Nt==null)return`\`\`\`diff + ${be.lineAt(le).text} \`\`\``;const Ci=le+1,ki=D.lines.find(Nn=>Nn.line===Ci)??D.lines[0];let gi=D.file.originalPath;gi==null&&M.fsPath!==D.file.uri.fsPath&&(gi=D.file.path),le=ki.line-1;let tr=await qi.instance.git.getDiffForLine(M,le,Nt,Ee);return tr==null&&Nt==null&&Ee!==v.GitRevision.uncommittedStaged&&(tr=await qi.instance.git.getDiffForLine(M,le,void 0,v.GitRevision.uncommittedStaged)),tr!=null?n(tr):void 0}o(Ue,"getDiff");const st=await Ue();if(st==null)return;let He,vt,Et;if(D.isUncommitted){const Nt=await D.getPreviousComparisonUrisForLine(le,Ee);if(Nt?.previous==null)return;He=`[$(compare-changes)](${di.V.getMarkdownCommandArgs({lhs:{sha:Nt.previous.sha??"",uri:Nt.previous.documentUri()},rhs:{sha:Nt.current.sha??"",uri:Nt.current.documentUri()},repoPath:D.repoPath,line:le})} "Open Changes")`,vt=Nt.previous.sha==null||Nt.previous.isUncommitted?`  _${v.GitRevision.shorten(Nt.previous.sha,{strings:{working:"Working Tree"}})}_  ${w.NE.ArrowLeftRightLong}  `:`  [$(git-commit) ${v.GitRevision.shorten(Nt.previous.sha||"")}](${di.oc.getMarkdownCommandArgs(Nt.previous.sha||"")} "Show Commit")  ${w.NE.ArrowLeftRightLong}  `,Et=Nt.current.sha==null||Nt.current.isUncommitted?`_${v.GitRevision.shorten(Nt.current.sha,{strings:{working:"Working Tree"}})}_`:`[$(git-commit) ${v.GitRevision.shorten(Nt.current.sha||"")}](${di.oc.getMarkdownCommandArgs(Nt.current.sha||"")} "Show Commit")`}else He=`[$(compare-changes)](${di.V.getMarkdownCommandArgs(D,le)} "Open Changes")`,xe===null&&(xe=await D.getPreviousSha()),xe&&(vt=`  [$(git-commit) ${v.GitRevision.shorten(xe)}](${di.oc.getMarkdownCommandArgs(xe)} "Show Commit")  ${w.NE.ArrowLeftRightLong} `),Et=`[$(git-commit) ${D.shortSha}](${di.oc.getMarkdownCommandArgs(D.sha)} "Show Commit")`;He=`${st} --- Changes${vt??" added in "}${Et}   |   ${He}`;const Wt=new s.MarkdownString(He,!0);return Wt.supportHtml=!0,Wt.isTrusted=!0,Wt}o(e,"changesMessage"),l.changesMessage=e;async function r(D,M,le,be){const Ee=i(be);let xe,Ue,st;if(D==null)Ue="_Working Tree_",st="_Unsaved_";else{const vt=await D.findFile(M);if(vt==null)return;xe=`[$(compare-changes)](${di.V.getMarkdownCommandArgs({lhs:{sha:D.sha,uri:A.YY.fromFile(vt,M.repoPath,void 0,!0).toFileUri()},rhs:{sha:"",uri:M.toFileUri()},repoPath:M.repoPath,line:le})} "Open Changes")`,Ue=`[$(git-commit) ${D.shortSha}](${di.oc.getMarkdownCommandArgs(D.sha)} "Show Commit")`,st="_Working Tree_"}xe=`${Ee} --- Local Changes  ${Ue}  ${w.NE.ArrowLeftRightLong}  ${st}${xe==null?"":`   |   ${xe}`}`;const He=new s.MarkdownString(xe,!0);return He.supportHtml=!0,He.isTrusted=!0,He}o(r,"localChangesMessage"),l.localChangesMessage=r;async function t(D,M,le,be,Ee,xe){var Ue,st,He,vt,Et;Ee===null&&(Ee="MMMM Do, YYYY h:mma");let Wt=D.message??D.summary;if(D.message==null&&!D.isUncommitted&&(await D.ensureFullDetails(),Wt=D.message??D.summary,(Ue=xe?.cancellationToken)!=null&&Ue.isCancellationRequested))return new s.MarkdownString;const Nt=await qi.instance.git.getRemotesWithProviders(D.repoPath,{sort:!0});if((st=xe?.cancellationToken)!=null&&st.isCancellationRequested)return new s.MarkdownString;const[Ci,ki,gi,tr]=await Promise.all([D.isUncommitted?D.getPreviousComparisonUrisForLine(le,M.sha):void 0,d(Wt,Nt),((He=xe?.pullRequests)==null?void 0:He.pr)??h(D.ref,Nt,{pullRequests:((vt=xe?.pullRequests)==null?void 0:vt.enabled)!==!1&&kt.i.has(be,"pullRequest","pullRequestAgo","pullRequestAgoOrDate","pullRequestDate","pullRequestState")}),qi.instance.vsls.maybeGetPresence(D.author.email)]);if((Et=xe?.cancellationToken)!=null&&Et.isCancellationRequested)return new s.MarkdownString;const Nn=await kt.i.fromTemplateAsync(be,D,{autolinkedIssuesOrPullRequests:ki,dateFormat:Ee,editor:{line:le,uri:M},getBranchAndTagTips:xe?.getBranchAndTagTips,markdown:!0,messageAutolinks:xe?.autolinks,pullRequestOrRemote:gi,presence:tr,previousLineComparisonUris:Ci,remotes:Nt}),Mn=new s.MarkdownString(Nn,!0);return Mn.supportHtml=!0,Mn.isTrusted=!0,Mn}o(t,"detailsMessage"),l.detailsMessage=t;function i(D){return`\`\`\`diff ${D.diff.trim()} \`\`\``}o(i,"getDiffFromHunk");function n(D,M){return M==="hunk"||M==null&&qi.instance.config.hovers.changesDiff==="hunk"?i(D.hunk):`\`\`\`diff${D.previous==null?"":` - ${D.previous.line.trim()}`}${D.current==null?"":` + ${D.current.line.trim()}`} \`\`\``}o(n,"getDiffFromHunkLine");async function d(D,M){const le=P.Y.getNewCorrelationContext("Hovers.getAutoLinkedIssuesOrPullRequests");P.Y.debug(le,`${w.NE.Dash} message=`);const be=(0,zt.a)();if(!qi.instance.config.hovers.autolinks.enabled||!qi.instance.config.hovers.autolinks.enhanced||!kt.i.has(qi.instance.config.hovers.detailsMarkdownFormat,"message")){P.Y.debug(le,`completed ${w.NE.Dot} ${(0,Gt.qk)(be)} ms`);return}const Ee=await qi.instance.git.getRichRemoteProvider(M);if(Ee?.provider==null){P.Y.debug(le,`completed ${w.NE.Dot} ${(0,Gt.qk)(be)} ms`);return}const xe=250;try{const Ue=await qi.instance.autolinks.getIssueOrPullRequestLinks(D,Ee,{timeout:xe});if(Ue!=null&&P.Y.enabled(P.i.Debug)){const st=(0,C.QX)(Ue.values(),He=>He instanceof $t.PK);if(st!==0)return P.Y.debug(le,`timed out ${w.NE.Dash} ${st} issue/pull request queries took too long (over ${xe} ms) ${w.NE.Dot} ${(0,Gt.qk)(be)} ms`),Ue}return P.Y.debug(le,`completed ${w.NE.Dot} ${(0,Gt.qk)(be)} ms`),Ue}catch(Ue){P.Y.error(Ue,le,`failed ${w.NE.Dot} ${(0,Gt.qk)(be)} ms`);return}}o(d,"getAutoLinkedIssuesOrPullRequests");async function h(D,M,le){const be=P.Y.getNewCorrelationContext("Hovers.getPullRequestForCommit");P.Y.debug(be,`${w.NE.Dash} ref=${D}`);const Ee=(0,zt.a)();if(!le?.pullRequests){P.Y.debug(be,`completed ${w.NE.Dot} ${(0,Gt.qk)(Ee)} ms`);return}const xe=await qi.instance.git.getRichRemoteProvider(M,{includeDisconnected:!0});if(xe?.provider==null){P.Y.debug(be,`completed ${w.NE.Dot} ${(0,Gt.qk)(Ee)} ms`);return}const{provider:Ue}=xe;if(!(Ue.maybeConnected??await Ue.isConnected()))return P.Y.debug(be,`completed ${w.NE.Dot} ${(0,Gt.qk)(Ee)} ms`),xe;try{const He=await qi.instance.git.getPullRequestForCommit(D,Ue,{timeout:250});return P.Y.debug(be,`completed ${w.NE.Dot} ${(0,Gt.qk)(Ee)} ms`),He}catch(He){if(He instanceof $t.PK)return P.Y.debug(be,`timed out ${w.NE.Dot} ${(0,Gt.qk)(Ee)} ms`),He;P.Y.error(He,be,`failed ${w.NE.Dot} ${(0,Gt.qk)(Ee)} ms`);return}}o(h,"getPullRequestForCommit")})(_i||(_i={}));var Si=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,Yi=o((l,e,r)=>e in l?Si(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"blameAnnotationProvider_defNormalProp"),Ki=o((l,e,r,t)=>{for(var i=t>1?void 0:t?zi(e,r):e,n=l.length-1,d;n>=0;n--)(d=l[n])&&(i=(t?d(e,r,i):d(i))||i);return t&&i&&Si(e,r,i),i},"blameAnnotationProvider_decorateClass"),nr=o((l,e,r)=>(Yi(l,typeof e!="symbol"?e+"":e,r),r),"blameAnnotationProvider_publicField");const ir=2**30;class Zi extends ft{constructor(e,r,t,i){super(e,r,t);this.container=i,nr(this,"blame"),nr(this,"hoverProviderDisposable"),this.blame=this.container.git.getBlame(this.trackedDocument.uri,r.document),r.document.isDirty&&t.setForceDirtyStateChangeOnNextDocumentChange()}clear(){this.hoverProviderDisposable!=null&&(this.hoverProviderDisposable.dispose(),this.hoverProviderDisposable=void 0),super.clear()}async validate(){const e=await this.blame;return e!=null&&e.lines.length!==0}async getBlame(){const e=await this.blame;if(!(e==null||e.lines.length===0))return e}async getComputedHeatmap(e){const r=[];let t,i;for(const le of e.lines)i!==le.sha&&(i=le.sha,t=e.commits.get(le.sha),t!=null&&r.push(t.date));r.sort((le,be)=>le.getTime()-be.getTime());const n=new Date;n.setDate(n.getDate()-(this.container.config.heatmap.ageThreshold||90));const d=n.getTime(),h=[],D=[];for(const le of r)le.getTime(){const be=Array.isArray(M)?M:le.getTime()=be[Ue]));Ue++);return xe}}}registerHoverProviders(e){!this.container.config.hovers.enabled||!this.container.config.hovers.annotations.enabled||!e.details&&!e.changes||(this.hoverProviderDisposable=s.languages.registerHoverProvider({pattern:this.document.uri.fsPath},{provideHover:(r,t,i)=>this.provideHover(e,r,t,i)}))}async provideHover(e,r,t,i){if(this.container.config.hovers.annotations.over!=="line"&&t.character!==0||this.document.uri.toString()!==r.uri.toString())return;const n=await this.getBlame();if(n==null)return;const d=n.lines[t.line],h=n.commits.get(d.sha);if(h==null)return;const D=(await Promise.all([e.details?this.getDetailsHoverMessage(h,r):void 0,e.changes?_i.changesMessage(h,await A.YY.fromUri(r.uri),t.line,r):void 0])).filter(M=>Boolean(M));return new s.Hover(D,r.validateRange(new s.Range(t.line,0,t.line,ir)))}async getDetailsHoverMessage(e,r){let t=this.editor.selection.active.line;const i=t+1;return t=(e.lines.find(d=>d.line===i)??e.lines[0]).originalLine-1,_i.detailsMessage(e,await A.YY.fromUri(r.uri),t,this.container.config.hovers.detailsMarkdownFormat,this.container.config.defaultDateFormat,{autolinks:this.container.config.hovers.autolinks.enabled,pullRequests:{enabled:this.container.config.hovers.pullRequests.enabled}})}}o(Zi,"BlameAnnotationProviderBase"),Ki([(0,_.cM)({args:!1})],Zi.prototype,"getComputedHeatmap",1);function Qi(l){const e=[],r=Math.floor(l.length/2),t=l.length%2?l[r].getTime():(l[r-1].getTime()+l[r].getTime())/2;let n=(l[l.length-1].getTime()-t)/5;for(let h=5;h>0;h--)e.push(t+n*h);e.push(t);const d=l[0].getTime();n=(t-d)/4;for(let h=1;h<=4;h++)e.push(t-n*h);return e}o(Qi,"getRelativeAgeLookupTable");var or=Object.defineProperty,fr=Object.defineProperties,Ii=Object.getOwnPropertyDescriptor,li=Object.getOwnPropertyDescriptors,te=Object.getOwnPropertySymbols,ve=Object.prototype.hasOwnProperty,Ze=Object.prototype.propertyIsEnumerable,ot=o((l,e,r)=>e in l?or(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"gutterBlameAnnotationProvider_defNormalProp"),tt=o((l,e)=>{for(var r in e||(e={}))ve.call(e,r)&&ot(l,r,e[r]);if(te)for(var r of te(e))Ze.call(e,r)&&ot(l,r,e[r]);return l},"gutterBlameAnnotationProvider_spreadValues"),bt=o((l,e)=>fr(l,li(e)),"gutterBlameAnnotationProvider_spreadProps"),Pt=o((l,e,r,t)=>{for(var i=t>1?void 0:t?Ii(e,r):e,n=l.length-1,d;n>=0;n--)(d=l[n])&&(i=(t?d(e,r,i):d(i))||i);return t&&i&&or(e,r,i),i},"gutterBlameAnnotationProvider_decorateClass");const Ft=2**30;class ni extends Zi{constructor(e,r,t){super(f.VP.Blame,e,r,t)}clear(){if(super.clear(),yi.gutterBlameHighlight!=null)try{this.editor.setDecorations(yi.gutterBlameHighlight,[])}catch{}}async onProvideAnnotation(e,r){const t=P.Y.getCorrelationContext();this.annotationContext=e;const i=await this.getBlame();if(i==null)return!1;const n=new Dt.u(t),d=this.container.config.blame,h=(0,Gt.Gg)(d.format).reduce((ki,gi)=>(ki[gi.key]=gi.options,ki),Object.create(null));let D;kt.i.has(d.format,"tips")&&(D=await this.container.git.getBranchesAndTagsTipsFn(i.repoPath));const M={dateFormat:d.dateFormat===null?this.container.config.defaultDateFormat:d.dateFormat,getBranchAndTagTips:D,tokenOptions:h},le=d.avatars,be=this.container.config.defaultGravatarsStyle,Ee=d.separateLines,xe=ui.gutterRenderOptions(Ee,d.heatmap,d.avatars,d.format,M),Ue=[],st=new Map,He=le?new Map:void 0;let vt,Et=!1,Wt,Nt,Ci;d.heatmap.enabled&&(Ci=await this.getComputedHeatmap(i));for(const ki of i.lines){const gi=ki.line-1;if(Nt===ki.sha){if(Wt==null)continue;Wt=tt({},Wt),d.compact&&!Et&&(Wt.renderOptions={before:bt(tt({},Wt.renderOptions.before),{contentText:w.NE.Space.repeat((0,Gt.dz)(Wt.renderOptions.before.contentText))})},Ee&&(Wt.renderOptions.before.textDecoration=`none;box-sizing: border-box${le?";padding: 0 0 0 18px":""}`),Et=!0),Wt.range=new s.Range(gi,0,gi,0),Ue.push(Wt);continue}if(Et=!1,Nt=ki.sha,vt=i.commits.get(ki.sha),vt!=null){if(Wt=st.get(ki.sha),Wt!=null){Wt=bt(tt({},Wt),{range:new s.Range(gi,0,gi,0)}),Ue.push(Wt);continue}Wt=ui.gutter(vt,d.format,M,xe),Ci!=null&&ui.applyHeatmap(Wt,vt.date,Ci),Wt.range=new s.Range(gi,0,gi,0),Ue.push(Wt),le&&vt.author.email!=null&&await this.applyAvatarDecoration(vt,Wt,be,He),st.set(ki.sha,Wt)}}return n.restart({suffix:" to compute gutter blame annotations"}),Ue.length&&(this.setDecorations([{decorationType:yi.gutterBlameAnnotation,rangesOrOptions:Ue}]),n.stop({suffix:" to apply all gutter blame annotations"})),this.registerHoverProviders(this.container.config.hovers.annotations),!0}async selection(e,r){if(e===!1||yi.gutterBlameHighlight==null||r==null&&(r=await this.blame,!r?.lines.length))return;let t;if(e?.sha!=null)t=e.sha;else if(e?.line!=null){if(e.line>=0){const n=r.lines[e.line];t=n?.sha}}else t=(0,C.Ps)(r.commits.values()).sha;if(!t){this.editor.setDecorations(yi.gutterBlameHighlight,[]);return}const i=(0,Rt.DZ)(r.lines,n=>n.sha===t?this.editor.document.validateRange(new s.Range(n.line-1,0,n.line-1,Ft)):void 0);this.editor.setDecorations(yi.gutterBlameHighlight,i)}async applyAvatarDecoration(e,r,t,i){let n=i.get(e.author.email??"");if(n==null){const d=(await e.getAvatarUri({defaultStyle:t,size:16})).toString(!0);n={contentText:"",height:"16px",width:"16px",textDecoration:`none;position:absolute;top:1px;left:5px;background:url(${encodeURI(d)});background-size:16px 16px;margin-left: 0 !important`},i.set(e.author.email??"",n)}r.renderOptions.after=n}}o(ni,"GutterBlameAnnotationProvider"),Pt([(0,_.cM)()],ni.prototype,"onProvideAnnotation",1),Pt([(0,_.cM)({args:!1})],ni.prototype,"selection",1);var oi=Object.defineProperty,Ut=Object.getOwnPropertyDescriptor,si=o((l,e,r)=>e in l?oi(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"gutterChangesAnnotationProvider_defNormalProp"),Yt=o((l,e,r,t)=>{for(var i=t>1?void 0:t?Ut(e,r):e,n=l.length-1,d;n>=0;n--)(d=l[n])&&(i=(t?d(e,r,i):d(i))||i);return t&&i&&oi(e,r,i),i},"gutterChangesAnnotationProvider_decorateClass"),Zt=o((l,e,r)=>(si(l,typeof e!="symbol"?e+"":e,r),r),"gutterChangesAnnotationProvider_publicField");const Xt=2**30;class Kt extends ft{constructor(e,r,t){super(f.VP.Changes,e,r);this.container=t,Zt(this,"state"),Zt(this,"hoverProviderDisposable")}mustReopen(e){var r,t;return((r=this.annotationContext)==null?void 0:r.sha)!==e?.sha||((t=this.annotationContext)==null?void 0:t.only)!==e?.only}clear(){this.state=void 0,this.hoverProviderDisposable!=null&&(this.hoverProviderDisposable.dispose(),this.hoverProviderDisposable=void 0),super.clear()}selection(e){return Promise.resolve()}validate(){return Promise.resolve(!0)}async onProvideAnnotation(e){var r,t,i,n;const d=P.Y.getCorrelationContext();this.mustReopen(e)&&this.clear(),this.annotationContext=e;let h=this.trackedDocument.uri.sha,D=e?.sha!=null&&e.sha!==h?`${e.sha}^`:void 0,M,le=h==null&&D==null;if(le){let He=await this.container.git.getOldestUnpushedRefForFile(this.trackedDocument.uri.repoPath,this.trackedDocument.uri);if(He!=null)He=`${He}^`,M=await this.container.git.getCommitForFile(this.trackedDocument.uri.repoPath,this.trackedDocument.uri,{ref:He}),M!=null?D!=null?D=He:(h=He,D=""):le=!1;else{const vt=await this.container.git.getStatusForFile(this.trackedDocument.uri.repoPath,this.trackedDocument.uri),Et=vt?.getPseudoCommits(this.container,await this.container.git.getCurrentUser(this.trackedDocument.uri.repoPath));Et?.length?(M=await this.container.git.getCommitForFile(this.trackedDocument.uri.repoPath,this.trackedDocument.uri),h="HEAD"):this.trackedDocument.dirty?h="HEAD":le=!1}}if(!le){if(M=await this.container.git.getCommitForFile(this.trackedDocument.uri.repoPath,this.trackedDocument.uri,{ref:D??h}),M==null)return!1;D!=null||(h=`${M.ref}^`),D=M.ref}const be=(await Promise.all(D==null&&this.editor.document.isDirty?[this.container.git.getDiffForFileContents(this.trackedDocument.uri,h,this.editor.document.getText()),this.container.git.getDiffForFile(this.trackedDocument.uri,h,D)]:[this.container.git.getDiffForFile(this.trackedDocument.uri,h,D)])).filter(He=>Boolean(He));if(!be?.length)return!1;const Ee=new Dt.u(d),xe=new Map,Ue=e?.sha!=null&&e?.only?await this.container.git.getBlame(this.trackedDocument.uri,(r=this.editor)==null?void 0:r.document):void 0;let st;for(const He of be)for(const vt of He.hunks){if(Ue!=null){let Nt=!0;const Ci=e.sha;for(let ki=vt.current.position.start-1;kivt.current.count)ki="removed";else{Et--;continue}else{Et--;continue}}else if(((i=Nt.current)==null?void 0:i.state)==="added")((n=Nt.previous)==null?void 0:n.state)==="removed"?ki="changed":ki="added";else if(Nt?.current.state==="removed")if(vt.previous.count>vt.current.count)ki="removed";else{Et--;continue}else ki="changed";let gi=xe.get(ki);gi==null?(gi={decorationType:ki==="added"?yi.changesLineAddedAnnotation:ki==="removed"?yi.changesLineDeletedAnnotation:yi.changesLineChangedAnnotation,rangesOrOptions:[{range:Ci}]},xe.set(ki,gi)):gi.rangesOrOptions.push({range:Ci})}}return Ee.restart({suffix:" to compute recent changes annotations"}),xe.size&&(this.setDecorations([...xe.values()]),Ee.stop({suffix:" to apply all recent changes annotations"}),st!=null&&e?.selection!==!1&&(this.editor.selection=st,this.editor.revealRange(st,s.TextEditorRevealType.InCenterIfOutsideViewport))),this.state={commit:M,diffs:be},this.registerHoverProvider(),!0}registerHoverProvider(){!this.container.config.hovers.enabled||!this.container.config.hovers.annotations.enabled||(this.hoverProviderDisposable=s.languages.registerHoverProvider({pattern:this.document.uri.fsPath},{provideHover:(e,r,t)=>this.provideHover(e,r,t)}))}async provideHover(e,r,t){if(this.state==null||this.container.config.hovers.annotations.over!=="line"&&r.character!==0)return;const{commit:i,diffs:n}=this.state;for(const d of n)for(const h of d.hunks){const D=h.state==="changed"&&h.previous.count>h.current.count;if(r.line>=h.current.position.start-1&&r.line<=h.current.position.end-(D?0:1)){const M=await _i.localChangesMessage(i,this.trackedDocument.uri,r.line,h);return M==null?void 0:new s.Hover(M,e.validateRange(new s.Range(h.current.position.start-1,0,h.current.position.end-(D?0:1),Xt)))}}}}o(Kt,"GutterChangesAnnotationProvider"),Yt([(0,_.cM)()],Kt.prototype,"onProvideAnnotation",1);var Wi=Object.defineProperty,Gi=Object.getOwnPropertyDescriptor,ji=o((l,e,r,t)=>{for(var i=t>1?void 0:t?Gi(e,r):e,n=l.length-1,d;n>=0;n--)(d=l[n])&&(i=(t?d(e,r,i):d(i))||i);return t&&i&&Wi(e,r,i),i},"gutterHeatmapBlameAnnotationProvider_decorateClass");class rr extends Zi{constructor(e,r,t){super(f.VP.Heatmap,e,r,t)}async onProvideAnnotation(e,r){const t=P.Y.getCorrelationContext();this.annotationContext=e;const i=await this.getBlame();if(i==null)return!1;const n=new Dt.u(t),d=new Map,h=await this.getComputedHeatmap(i);let D;for(const M of i.lines){const le=M.line-1;D=i.commits.get(M.sha),D!=null&&ui.addOrUpdateGutterHeatmapDecoration(D.date,h,new s.Range(le,0,le,0),d)}return n.restart({suffix:" to compute heatmap annotations"}),d.size&&(this.setDecorations([...d.values()]),n.stop({suffix:" to apply all heatmap annotations"})),!0}selection(e){return Promise.resolve()}}o(rr,"GutterHeatmapBlameAnnotationProvider"),ji([(0,_.cM)()],rr.prototype,"onProvideAnnotation",1);var Zr=Object.defineProperty,kn=o((l,e,r)=>e in l?Zr(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"fileAnnotationController_defNormalProp"),Dr=o((l,e,r)=>(kn(l,typeof e!="symbol"?e+"":e,r),r),"fileAnnotationController_publicField"),Ui=(l=>(l.User="User",l.BlameabilityChanged="BlameabilityChanged",l.ColumnChanged="ColumnChanged",l.Disposing="Disposing",l.DocumentChanged="DocumentChanged",l.DocumentClosed="DocumentClosed",l))(Ui||{});const yi={gutterBlameAnnotation:s.window.createTextEditorDecorationType({rangeBehavior:s.DecorationRangeBehavior.ClosedOpen,textDecoration:"none"}),gutterBlameHighlight:void 0,changesLineChangedAnnotation:void 0,changesLineAddedAnnotation:void 0,changesLineDeletedAnnotation:void 0};class Fi{constructor(e){this.container=e,Dr(this,"_onDidToggleAnnotations",new s.EventEmitter),Dr(this,"_annotationsDisposable"),Dr(this,"_annotationProviders",new Map),Dr(this,"_disposable"),Dr(this,"_editor"),Dr(this,"_keyboardScope"),Dr(this,"_toggleModes"),Dr(this,"_windowAnnotationType"),this._disposable=s.Disposable.from((0,x.IH)(e.onReady)(this.onReady,this),f.DN.onDidChange(this.onConfigurationChanged,this),s.window.onDidChangeActiveColorTheme(this.onThemeChanged,this)),this._toggleModes=new Map}get onDidToggleAnnotations(){return this._onDidToggleAnnotations.event}dispose(){var e,r,t,i,n,d,h;this.clearAll(),(e=yi.gutterBlameAnnotation)==null||e.dispose(),(r=yi.gutterBlameHighlight)==null||r.dispose(),(t=yi.changesLineChangedAnnotation)==null||t.dispose(),(i=yi.changesLineAddedAnnotation)==null||i.dispose(),(n=yi.changesLineDeletedAnnotation)==null||n.dispose(),(d=this._annotationsDisposable)==null||d.dispose(),(h=this._disposable)==null||h.dispose()}onReady(){this.onConfigurationChanged()}onConfigurationChanged(e){const r=this.container.config,t=e==null;if((f.DN.changed(e,"blame.highlight")||f.DN.changed(e,"changes.locations"))&&this.updateDecorations(!1),f.DN.changed(e,"blame.toggleMode")&&(this._toggleModes.set(f.VP.Blame,r.blame.toggleMode),!t&&r.blame.toggleMode===f.TF.File&&this.clearAll()),f.DN.changed(e,"changes.toggleMode")&&(this._toggleModes.set(f.VP.Changes,r.changes.toggleMode),!t&&r.changes.toggleMode===f.TF.File&&this.clearAll()),f.DN.changed(e,"heatmap.toggleMode")&&(this._toggleModes.set(f.VP.Heatmap,r.heatmap.toggleMode),!t&&r.heatmap.toggleMode===f.TF.File&&this.clearAll()),!t&&(f.DN.changed(e,"blame")||f.DN.changed(e,"changes")||f.DN.changed(e,"heatmap")||f.DN.changed(e,"hovers")||f.DN.changed(e,"defaultDateFormat")||f.DN.changed(e,"defaultDateSource")||f.DN.changed(e,"defaultDateStyle")||f.DN.changed(e,"defaultGravatarsStyle")))for(const i of this._annotationProviders.values())i!=null&&this.show(i.editor,i.annotationType??f.VP.Blame)}onThemeChanged(e){this.updateDecorations(!0)}async onActiveTextEditorChanged(e){if(e!=null&&!(0,O.PH)(e))return;if(this._editor=e,this.isInWindowToggle()){await this.show(e,this._windowAnnotationType);return}const r=this.getProvider(e);r==null?((0,y.v)(w.zf.AnnotationStatus,void 0),this.detachKeyboardHook()):((0,y.v)(w.zf.AnnotationStatus,r.status),this.attachKeyboardHook())}onBlameStateChanged(e){if(e.blameable)return;const r=s.window.activeTextEditor;r!=null&&this.clear(r,"BlameabilityChanged")}onDirtyStateChanged(e){for(const[r,t]of this._annotationProviders)!e.document.is(t.document)||this.clearCore(r,"DocumentChanged")}onTextDocumentClosed(e){if(!!this.container.git.isTrackable(e.uri))for(const[r,t]of this._annotationProviders)t.document===e&&this.clearCore(r,"DocumentClosed")}onTextEditorViewColumnChanged(e){const r=this.getProvider(e.textEditor);if(r==null){const t=(0,C.sE)(this._annotationProviders.values(),i=>i.editor.document===e.textEditor.document);if(t==null)return;this.clearCore(t.correlationKey,"ColumnChanged");return}r.restore(e.textEditor)}onVisibleTextEditorsChanged(e){var r;for(const t of e)(r=this.getProvider(t))==null||r.restore(t)}isInWindowToggle(){return this.getToggleMode(this._windowAnnotationType)===f.TF.Window}getToggleMode(e){return e==null?f.TF.File:this._toggleModes.get(e)??f.TF.File}clear(e,r="User"){return this.isInWindowToggle()?this.clearAll():this.clearCore(ft.getCorrelationKey(e),r)}async clearAll(){this._windowAnnotationType=void 0;for(const[e]of this._annotationProviders)await this.clearCore(e,"Disposing")}async getAnnotationType(e){const r=this.getProvider(e);if(r==null)return;const t=await this.container.tracker.get(e.document);if(!(t==null||!t.isBlameable))return r.annotationType}getProvider(e){if(!(e==null||e.document==null))return this._annotationProviders.get(ft.getCorrelationKey(e))}async show(e,r,t){if(this.getToggleMode(r)===f.TF.Window){let h=this._windowAnnotationType==null;const D=!h&&this._windowAnnotationType!==r;if(this._windowAnnotationType=r,D&&(await this.clearAll(),h=!0),h)for(const M of s.window.visibleTextEditors)M!==e&&this.show(M,r)}if(e==null||(this._editor=e,!(await this.container.tracker.getOrAdd(e.document)).isBlameable))return!1;const n=this.getProvider(e);return n?.annotationType===r?(await n.provideAnnotation(t),await n.selection(t?.selection),!0):await s.window.withProgress({location:s.ProgressLocation.Window},async h=>{await(0,y.v)(w.zf.AnnotationStatus,dt.Computing);const D=this.showAnnotationsCore(n,e,r,t,h),M=await D;return e===this._editor&&await(0,y.v)(w.zf.AnnotationStatus,M?.status),D})!=null}async toggle(e,r,t,i){if(e!=null){const h=await this.container.tracker.getOrAdd(e.document);if(r===f.VP.Changes&&!h.isTracked||!h.isBlameable)return!1}const n=this.getProvider(e);if(n==null)return this.show(e,r,t);const d=n.annotationType!==r||n.mustReopen(t);return i===!0&&!d?!0:(this.isInWindowToggle()?await this.clearAll():await this.clearCore(n.correlationKey,"User"),d?this.show(e,r,t):!1)}async attachKeyboardHook(){this._keyboardScope==null&&(this._keyboardScope=await this.container.keyboard.beginScope({escape:{onDidPressKey:async()=>{const e=this._editor;e!=null&&await this.clear(e,"User")}}}))}async clearCore(e,r){var t;const i=this._annotationProviders.get(e);i!=null&&(P.Y.log(`${r}:`,`Clear annotations for ${e}`),this._annotationProviders.delete(e),i.dispose(),(this._annotationProviders.size===0||e===ft.getCorrelationKey(this._editor))&&(await(0,y.v)(w.zf.AnnotationStatus,void 0),await this.detachKeyboardHook()),this._annotationProviders.size===0&&(P.Y.log("Remove all listener registrations for annotations"),(t=this._annotationsDisposable)==null||t.dispose(),this._annotationsDisposable=void 0),this._onDidToggleAnnotations.fire())}async detachKeyboardHook(){this._keyboardScope!=null&&(await this._keyboardScope.dispose(),this._keyboardScope=void 0)}async showAnnotationsCore(e,r,t,i,n){if(n!=null){let D="annotations";switch(t){case f.VP.Blame:D="blame annotations";break;case f.VP.Changes:D="changes annotations";break;case f.VP.Heatmap:D="heatmap annotations";break}n.report({message:`Computing ${D} for ${(0,k.EZ)(r.document.fileName)}`})}await this.attachKeyboardHook();const d=await this.container.tracker.getOrAdd(r.document);let h;switch(t){case f.VP.Blame:h=new ni(r,d,this.container);break;case f.VP.Changes:h=new Kt(r,d,this.container);break;case f.VP.Heatmap:h=new rr(r,d,this.container);break}if(!(h==null||!await h.validate())){if(e!=null&&await this.clearCore(e.correlationKey,"User"),this._annotationsDisposable==null&&this._annotationProviders.size===0&&(P.Y.log("Add listener registrations for annotations"),this._annotationsDisposable=s.Disposable.from(s.window.onDidChangeActiveTextEditor((0,c.Ds)(this.onActiveTextEditorChanged,50),this),s.window.onDidChangeTextEditorViewColumn(this.onTextEditorViewColumnChanged,this),s.window.onDidChangeVisibleTextEditors((0,c.Ds)(this.onVisibleTextEditorsChanged,50),this),s.workspace.onDidCloseTextDocument(this.onTextDocumentClosed,this),this.container.tracker.onDidChangeBlameState(this.onBlameStateChanged,this),this.container.tracker.onDidChangeDirtyState(this.onDirtyStateChanged,this))),this._annotationProviders.set(h.correlationKey,h),await h.provideAnnotation(i))return this._onDidToggleAnnotations.fire(),h;await this.clearCore(h.correlationKey,"Disposing")}}updateDecorations(e){var r;const t=e?Object.entries(yi):void 0;if(this.updateHighlightDecoration(),this.updateChangedDecorations(),!e)return;const i=new Map;for(const[n,d]of t){if(d==null)continue;const h=yi[n]??null;d!==h&&i.set(d,yi[n]??null)}if(i.size!==0)for(const n of s.window.visibleTextEditors)(r=this.getProvider(n))==null||r.refresh(i)}updateChangedDecorations(){var e,r,t;(e=yi.changesLineAddedAnnotation)==null||e.dispose(),(r=yi.changesLineChangedAnnotation)==null||r.dispose(),(t=yi.changesLineDeletedAnnotation)==null||t.dispose();const{locations:i}=this.container.config.changes;let n,d,h;switch(s.window.activeColorTheme.kind){case s.ColorThemeKind.Light:n="#48985D",d="#2090D3",h="#E51400";break;case s.ColorThemeKind.HighContrast:n="#487E02",d="#1B81A8",h="#F14C4C";break;default:n="#487E02",d="#1B81A8",h="#F14C4C";break}yi.changesLineAddedAnnotation=s.window.createTextEditorDecorationType({gutterIconPath:i.includes(f.hp.Gutter)?s.Uri.parse(`data:image/svg+xml,${encodeURIComponent(``)}`):void 0,gutterIconSize:"contain",overviewRulerLane:s.OverviewRulerLane.Left,overviewRulerColor:i.includes(f.hp.Overview)?new s.ThemeColor("editorOverviewRuler.addedForeground"):void 0}),yi.changesLineChangedAnnotation=s.window.createTextEditorDecorationType({gutterIconPath:i.includes(f.hp.Gutter)?s.Uri.parse(`data:image/svg+xml,${encodeURIComponent(``)}`):void 0,gutterIconSize:"contain",overviewRulerLane:s.OverviewRulerLane.Left,overviewRulerColor:i.includes(f.hp.Overview)?new s.ThemeColor("editorOverviewRuler.modifiedForeground"):void 0}),yi.changesLineDeletedAnnotation=s.window.createTextEditorDecorationType({gutterIconPath:i.includes(f.hp.Gutter)?s.Uri.parse(`data:image/svg+xml,${encodeURIComponent(``)}`):void 0,gutterIconSize:"contain",overviewRulerLane:s.OverviewRulerLane.Left,overviewRulerColor:i.includes(f.hp.Overview)?new s.ThemeColor("editorOverviewRuler.deletedForeground"):void 0})}updateHighlightDecoration(){var e;(e=yi.gutterBlameHighlight)==null||e.dispose(),yi.gutterBlameHighlight=void 0;const{highlight:r}=this.container.config.blame;if(r.enabled){const{locations:t}=r,i="#00bcf2",n=t.includes(f.y0.Gutter)?s.Uri.parse(`data:image/svg+xml,${encodeURIComponent(``)}`):void 0;yi.gutterBlameHighlight=s.window.createTextEditorDecorationType({gutterIconPath:n,gutterIconSize:"contain",isWholeLine:!0,overviewRulerLane:s.OverviewRulerLane.Right,backgroundColor:t.includes(f.y0.Line)?new s.ThemeColor(w.wL.LineHighlightBackgroundColor):void 0,overviewRulerColor:t.includes(f.y0.Overview)?new s.ThemeColor(w.wL.LineHighlightOverviewRulerColor):void 0})}}}o(Fi,"FileAnnotationController");var wr=g(4504),Ni=Object.defineProperty,Nr=Object.getOwnPropertyDescriptor,Wr=o((l,e,r)=>e in l?Ni(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"lineAnnotationController_defNormalProp"),gr=o((l,e,r,t)=>{for(var i=t>1?void 0:t?Nr(e,r):e,n=l.length-1,d;n>=0;n--)(d=l[n])&&(i=(t?d(e,r,i):d(i))||i);return t&&i&&Ni(e,r,i),i},"lineAnnotationController_decorateClass"),Xi=o((l,e,r)=>(Wr(l,typeof e!="symbol"?e+"":e,r),r),"lineAnnotationController_publicField");const Lr=s.window.createTextEditorDecorationType({after:{margin:"0 0 0 3em",textDecoration:"none"},rangeBehavior:s.DecorationRangeBehavior.ClosedOpen}),Mr=2**30;class Fr{constructor(e){this.container=e,Xi(this,"_cancellation"),Xi(this,"_disposable"),Xi(this,"_editor"),Xi(this,"_enabled",!1),Xi(this,"_suspended",!1),this._disposable=s.Disposable.from((0,x.IH)(e.onReady)(this.onReady,this),f.DN.onDidChange(this.onConfigurationChanged,this),e.fileAnnotations.onDidToggleAnnotations(this.onFileAnnotationsToggled,this),wr.Vy.onDidChange(()=>void this.refresh(s.window.activeTextEditor)))}dispose(){this.clearAnnotations(this._editor),this.container.lineTracker.unsubscribe(this),this._disposable.dispose()}onReady(){this.onConfigurationChanged()}onConfigurationChanged(e){!f.DN.changed(e,"currentLine")||(f.DN.changed(e,"currentLine.enabled")&&(this.container.config.currentLine.enabled?(this._enabled=!0,this.resume()):(this._enabled=!1,this.setLineTracker(!1))),this.refresh(s.window.activeTextEditor))}get suspended(){return!this._enabled||this._suspended}resume(){return this.setLineTracker(!0),this._suspended?(this._suspended=!1,!0):!1}suspend(){return this.setLineTracker(!1),this._suspended?!1:(this._suspended=!0,!0)}onActiveLinesChanged(e){if(!e.pending&&e.selections!==void 0){this.refresh(e.editor);return}this.clear(e.editor)}onFileAnnotationsToggled(){this.refresh(s.window.activeTextEditor)}clear(e){var r;(r=this._cancellation)==null||r.cancel(),this._editor!==e&&this._editor!=null&&this.clearAnnotations(this._editor),this.clearAnnotations(e)}async toggle(e){this._enabled=!(this._enabled&&!this.suspended),this._enabled?this.resume()&&await this.refresh(e):this.suspend()&&await this.refresh(e)}clearAnnotations(e){e===void 0||e._disposed===!0||e.setDecorations(Lr,[])}async getPullRequests(e,r,{timeout:t}={}){if(r.length===0)return;const i=await this.container.git.getRichRemoteProvider(e);if(i?.provider==null)return;const n=new Set;for(const[,D]of r)n.add(D.ref);if(n.size===0)return;const{provider:d}=i,h=await(0,$t.xu)(n.values(),D=>this.container.git.getPullRequestForCommit(D,d),t);if(!(h.size===0||(0,C.yW)(h.values(),D=>D==null)))return h}async refresh(e,r){var t;if(e==null&&this._editor==null)return;const i=P.Y.getCorrelationContext(),n=this.container.lineTracker.selections;if(e==null||n==null||!(0,O.PH)(e)){i!=null&&(i.exitDetails=` ${w.NE.Dot} Skipped because there is no valid editor or no valid selections`),this.clear(this._editor);return}this._editor!==e&&(this.clear(this._editor),this._editor=e);const d=this.container.config.currentLine;if(this.suspended){i!=null&&(i.exitDetails=` ${w.NE.Dot} Skipped because the controller is suspended`),this.clear(e);return}const h=await this.container.tracker.getOrAdd(e.document);if(!h.isBlameable&&this.suspended){i!=null&&(i.exitDetails=` ${w.NE.Dot} Skipped because the ${this.suspended?"controller is suspended":`document(${h.uri.toString(!0)}) is not blameable`}`),this.clear(e);return}if(e.document==null||!this.container.lineTracker.includes(n)){i!=null&&(i.exitDetails=` ${w.NE.Dot} Skipped because the ${e.document==null?"editor is gone":`selection(s)=${n.map(Ue=>`[${Ue.anchor}-${Ue.active}]`).join()} are no longer current`}`);return}i!=null&&(i.exitDetails=` ${w.NE.Dot} selection(s)=${n.map(Ue=>`[${Ue.anchor}-${Ue.active}]`).join()}`);const D=[...(0,C.DZ)(n,Ue=>{const st=this.container.lineTracker.getState(Ue.active);if(st?.commit==null){P.Y.debug(i,`Line ${Ue.active} returned no commit`);return}return[Ue.active,st.commit]})],M=h.uri.repoPath,le=100,[be,Ee]=await Promise.all([kt.i.has(d.format,"tips")?this.container.git.getBranchesAndTagsTipsFn(M):void 0,M!=null&&d.pullRequests.enabled&&kt.i.has(d.format,"pullRequest","pullRequestAgo","pullRequestAgoOrDate","pullRequestDate","pullRequestState")?r?.prs??this.getPullRequests(M,D.filter(([,Ue])=>!Ue.isUncommitted),{timeout:le}):void 0]);Ee!=null&&((t=this._cancellation)==null||t.cancel(),this._cancellation=new s.CancellationTokenSource,this.waitForAnyPendingPullRequests(e,Ee,this._cancellation.token,le,i));const xe=[];for(const[Ue,st]of D){const He=ui.trailing(st,d.format,{dateFormat:d.dateFormat===null?this.container.config.defaultDateFormat:d.dateFormat,getBranchAndTagTips:be,pullRequestOrRemote:Ee?.get(st.ref),pullRequestPendingMessage:`PR ${w.NE.Ellipsis}`},d.scrollable);He.range=e.document.validateRange(new s.Range(Ue,Mr,Ue,Mr)),xe.push(He)}e.setDecorations(Lr,xe)}setLineTracker(e){if(e){this.container.lineTracker.subscribed(this)||this.container.lineTracker.subscribe(this,this.container.lineTracker.onDidChangeActiveLines(this.onActiveLinesChanged,this));return}this.container.lineTracker.unsubscribe(this)}async waitForAnyPendingPullRequests(e,r,t,i,n){const d=(0,C.QX)(r.values(),D=>D instanceof $t.PK);if(t.isCancellationRequested||d===0)return;P.Y.debug(n,`${w.NE.Dot} ${d} pull request queries took too long (over ${i} ms)`);const h=new Map;for(const[D,M]of r)h.set(D,M instanceof $t.PK?await M.promise:M);t.isCancellationRequested||e!==this._editor||(P.Y.debug(n,`${w.NE.Dot} ${d} pull request queries completed; refreshing...`),this.refresh(e,{prs:h}))}}o(Fr,"LineAnnotationController"),gr([(0,_.cM)()],Fr.prototype,"resume",1),gr([(0,_.cM)()],Fr.prototype,"suspend",1),gr([(0,_.fF)({args:{0:l=>{var e,r;return`editor=${(e=l.editor)==null?void 0:e.document.uri.toString(!0)}, selections=${(r=l.selections)==null?void 0:r.map(t=>`[${t.anchor}-${t.active}]`).join(",")}, pending=${Boolean(l.pending)}, reason=${l.reason}`}}})],Fr.prototype,"onActiveLinesChanged",1),gr([(0,_.fF)({args:!1,singleLine:!0})],Fr.prototype,"clear",1),gr([(0,_.cM)({args:!1})],Fr.prototype,"toggle",1),gr([(0,_.fF)({args:!1})],Fr.prototype,"refresh",1);var Gr=g(5647),Vr=g(1505),hi=g(1161),Xr=Object.defineProperty,ps=o((l,e,r)=>e in l?Xr(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"codeLensProvider_defNormalProp"),Jr=o((l,e,r)=>(ps(l,typeof e!="symbol"?e+"":e,r),r),"codeLensProvider_publicField");class kr extends s.CodeLens{constructor(e,r,t,i,n,d,h,D,M,le){super(D,le);this.languageId=e,this.symbol=r,this.uri=t,this.dateFormat=i,this.blame=n,this.blameRange=d,this.isFullRange=h,this.desiredCommand=M}getBlame(){var e;return(e=this.blame)==null?void 0:e.call(this)}}o(kr,"GitRecentChangeCodeLens");class en extends s.CodeLens{constructor(e,r,t,i,n,d,h,D){super(h);this.languageId=e,this.symbol=r,this.uri=t,this.blame=i,this.blameRange=n,this.isFullRange=d,this.desiredCommand=D}getBlame(){return this.blame()}}o(en,"GitAuthorsCodeLens");class tn{constructor(e){this.container=e,Jr(this,"_onDidChangeCodeLenses",new s.EventEmitter)}get onDidChangeCodeLenses(){return this._onDidChangeCodeLenses.event}reset(e){this._onDidChangeCodeLenses.fire()}async provideCodeLenses(e,r){var t;if(e.isDirty&&(0,O.pt)(e.uri))return[];const i=await this.container.tracker.getOrAdd(e);if(!i.isBlameable)return[];let n=!1;if(e.isDirty)if(i.isDirtyIdle){const Ue=this.container.config.advanced.blame.sizeThresholdAfterEdit;Ue>0&&e.lineCount>Ue&&(n=!0)}else n=!0;const d=f.DN.get("codeLens",e);let h=(t=d.scopesByLanguage)==null?void 0:t.find(Ue=>{var st;return((st=Ue.language)==null?void 0:st.toLowerCase())===e.languageId});h==null&&(h={language:e.languageId}),h.scopes==null&&(h.scopes=d.scopes),h.symbolScopes==null&&(h.symbolScopes=d.symbolScopes),h.symbolScopes=h.symbolScopes!=null?h.symbolScopes=h.symbolScopes.map(Ue=>Ue.toLowerCase()):[];const D=[],M=i.uri;let le,be;if(n){if(h.scopes.length!==1||!h.scopes.includes(f.Uy.Document)){let Ue;if([Ue,be]=await Promise.all([this.container.git.isTracked(M),(0,hi.dO)(w.nA.ExecuteDocumentSymbolProvider,e.uri)]),!Ue)return D}}else if(r.isCancellationRequested||(h.scopes.length===1&&h.scopes.includes(f.Uy.Document)?le=await this.container.git.getBlame(M,e):[le,be]=await Promise.all([this.container.git.getBlame(M,e),(0,hi.dO)(w.nA.ExecuteDocumentSymbolProvider,e.uri)]),le==null||le?.lines.length===0))return D;if(r.isCancellationRequested)return D;const Ee=(0,c.IH)(()=>e.validateRange(new s.Range(0,0,1e6,1e6))),xe=n?{command:void 0,title:this.getDirtyTitle(d)}:void 0;if(be!==void 0){P.Y.log("GitCodeLensProvider.provideCodeLenses:",`${be.length} symbol(s) found`);for(const Ue of be)this.provideCodeLens(D,e,Ue,h,Ee,le,M,d,n,xe)}if((h.scopes.includes(f.Uy.Document)||h.symbolScopes.includes("file"))&&!h.symbolScopes.includes("!file")&&D.find(Ue=>Ue.range.start.line===0&&Ue.range.end.line===0)==null){const Ue=Ee();let st;if(n||d.recentChange.enabled){n||(st=(0,c.IH)(()=>this.container.git.getBlameRange(le,M,Ue)));const He=new s.SymbolInformation(M.fileName,s.SymbolKind.File,"",new s.Location(M.documentUri(),new s.Range(0,0,0,Ue.start.character)));D.push(new kr(e.languageId,He,M,d.dateFormat,st,Ue,!0,Sr(He),d.recentChange.command,xe))}if(!n&&d.authors.enabled){st===void 0&&(st=(0,c.IH)(()=>this.container.git.getBlameRange(le,M,Ue)));const He=new s.SymbolInformation(M.fileName,s.SymbolKind.File,"",new s.Location(M.documentUri(),new s.Range(0,1,0,Ue.start.character)));D.push(new en(e.languageId,He,M,st,Ue,!0,Sr(He),d.authors.command))}}return D}getValidateSymbolRange(e,r,t,i){let n=!1,d;const h=s.SymbolKind[e.kind].toLowerCase();switch(e.kind){case s.SymbolKind.File:(r.scopes.includes(f.Uy.Containers)||r.symbolScopes.includes(h))&&(n=!r.symbolScopes.includes(`!${h}`)),n&&(d=t());break;case s.SymbolKind.Package:(r.scopes.includes(f.Uy.Containers)||r.symbolScopes.includes(h))&&(n=!r.symbolScopes.includes(`!${h}`)),n&&(d=Sr(e),d.start.line===0&&d.end.line===0&&(d=t()));break;case s.SymbolKind.Class:case s.SymbolKind.Interface:case s.SymbolKind.Module:case s.SymbolKind.Namespace:case s.SymbolKind.Struct:(r.scopes.includes(f.Uy.Containers)||r.symbolScopes.includes(h))&&(d=Sr(e),n=!r.symbolScopes.includes(`!${h}`)&&(i||!d.isSingleLine));break;case s.SymbolKind.Constructor:case s.SymbolKind.Enum:case s.SymbolKind.Function:case s.SymbolKind.Method:case s.SymbolKind.Property:(r.scopes.includes(f.Uy.Blocks)||r.symbolScopes.includes(h))&&(d=Sr(e),n=!r.symbolScopes.includes(`!${h}`)&&(i||!d.isSingleLine));break;case s.SymbolKind.String:(r.symbolScopes.includes(h)||r.language==="markdown"&&r.scopes.includes(f.Uy.Containers))&&(d=Sr(e),n=!r.symbolScopes.includes(`!${h}`)&&(i||!d.isSingleLine));break;default:r.symbolScopes.includes(h)&&(d=Sr(e),n=!r.symbolScopes.includes(`!${h}`)&&(i||!d.isSingleLine));break}return n?d??Sr(e):void 0}provideCodeLens(e,r,t,i,n,d,h,D,M,le){try{const be=this.getValidateSymbolRange(t,i,n,D.includeSingleLineSymbols);if(be===void 0)return;const Ee=r.lineAt(Sr(t).start);if(e.length&&e[e.length-1].range.start.line===Ee.lineNumber)return;let xe=0,Ue;if((M||D.recentChange.enabled)&&(M||(Ue=(0,c.IH)(()=>this.container.git.getBlameRange(d,h,be))),e.push(new kr(r.languageId,t,h,D.dateFormat,Ue,be,!1,Ee.range.with(new s.Position(Ee.range.start.line,xe)),D.recentChange.command,le)),xe++),D.authors.enabled){let st=!be.isSingleLine;if(!st&&r.languageId==="csharp")switch(t.kind){case s.SymbolKind.File:break;case s.SymbolKind.Package:case s.SymbolKind.Module:case s.SymbolKind.Namespace:case s.SymbolKind.Class:case s.SymbolKind.Interface:case s.SymbolKind.Constructor:case s.SymbolKind.Method:case s.SymbolKind.Function:case s.SymbolKind.Enum:st=!0;break}st&&!M&&(Ue===void 0&&(Ue=(0,c.IH)(()=>this.container.git.getBlameRange(d,h,be))),e.push(new en(r.languageId,t,h,Ue,be,!1,Ee.range.with(new s.Position(Ee.range.start.line,xe)),D.authors.command)))}}finally{if(wn(t))for(const be of t.children)this.provideCodeLens(e,r,be,i,n,d,h,D,M,le)}}resolveCodeLens(e,r){return e instanceof kr?this.resolveGitRecentChangeCodeLens(e,r):e instanceof en?this.resolveGitAuthorsCodeLens(e,r):Promise.reject(void 0)}resolveGitRecentChangeCodeLens(e,r){const t=e.getBlame();if(t===void 0)return e;const i=(0,C.Ps)(t.commits.values());let n=`${i.author.name}, ${e.dateFormat==null?i.formattedDate:i.formatDate(e.dateFormat)}`;if(this.container.config.debug&&(n+=` [${e.languageId}: ${s.SymbolKind[e.symbol.kind]}(${e.range.start.character}-${e.range.end.character}${e.symbol.containerName?`|${e.symbol.containerName}`:""}), Lines (${e.blameRange.start.line+1}-${e.blameRange.end.line+1}), Commit (${i.shortSha})]`),e.desiredCommand===!1)return this.applyCommandWithNoClickAction(n,e);switch(e.desiredCommand){case f.N4.CopyRemoteCommitUrl:return this.applyCopyOrOpenCommitOnRemoteCommand(n,e,i,!0);case f.N4.CopyRemoteFileUrl:return this.applyCopyOrOpenFileOnRemoteCommand(n,e,i,!0);case f.N4.DiffWithPrevious:return this.applyDiffWithPreviousCommand(n,e,i);case f.N4.OpenCommitOnRemote:return this.applyCopyOrOpenCommitOnRemoteCommand(n,e,i);case f.N4.OpenFileOnRemote:return this.applyCopyOrOpenFileOnRemoteCommand(n,e,i);case f.N4.RevealCommitInView:return this.applyRevealCommitInViewCommand(n,e,i);case f.N4.ShowCommitsInView:return this.applyShowCommitsInViewCommand(n,e,t,i);case f.N4.ShowQuickCommitDetails:return this.applyShowQuickCommitDetailsCommand(n,e,i);case f.N4.ShowQuickCommitFileDetails:return this.applyShowQuickCommitFileDetailsCommand(n,e,i);case f.N4.ShowQuickCurrentBranchHistory:return this.applyShowQuickCurrentBranchHistoryCommand(n,e);case f.N4.ShowQuickFileHistory:return this.applyShowQuickFileHistoryCommand(n,e);case f.N4.ToggleFileBlame:return this.applyToggleFileBlameCommand(n,e);case f.N4.ToggleFileChanges:return this.applyToggleFileChangesCommand(n,e,i);case f.N4.ToggleFileChangesOnly:return this.applyToggleFileChangesCommand(n,e,i,!0);case f.N4.ToggleFileHeatmap:return this.applyToggleFileHeatmapCommand(n,e);default:return e}}resolveGitAuthorsCodeLens(e,r){const t=e.getBlame();if(t===void 0)return e;const i=t.authors.size,n=(0,C.Ps)(t.authors.values()).name;let d=`${i} ${i>1?"authors":"author"} (${n}${i>1?" and others":""})`;if(this.container.config.debug&&(d+=` [${e.languageId}: ${s.SymbolKind[e.symbol.kind]}(${e.range.start.character}-${e.range.end.character}${e.symbol.containerName?`|${e.symbol.containerName}`:""}), Lines (${e.blameRange.start.line+1}-${e.blameRange.end.line+1}), Authors (${(0,C.v_)((0,C.UI)(t.authors.values(),D=>D.name),", ")})]`),e.desiredCommand===!1)return this.applyCommandWithNoClickAction(d,e);const h=(0,C.sE)(t.commits.values(),D=>D.author.name===n)??(0,C.Ps)(t.commits.values());switch(e.desiredCommand){case f.N4.CopyRemoteCommitUrl:return this.applyCopyOrOpenCommitOnRemoteCommand(d,e,h,!0);case f.N4.CopyRemoteFileUrl:return this.applyCopyOrOpenFileOnRemoteCommand(d,e,h,!0);case f.N4.DiffWithPrevious:return this.applyDiffWithPreviousCommand(d,e,h);case f.N4.OpenCommitOnRemote:return this.applyCopyOrOpenCommitOnRemoteCommand(d,e,h);case f.N4.OpenFileOnRemote:return this.applyCopyOrOpenFileOnRemoteCommand(d,e,h);case f.N4.RevealCommitInView:return this.applyRevealCommitInViewCommand(d,e,h);case f.N4.ShowCommitsInView:return this.applyShowCommitsInViewCommand(d,e,t);case f.N4.ShowQuickCommitDetails:return this.applyShowQuickCommitDetailsCommand(d,e,h);case f.N4.ShowQuickCommitFileDetails:return this.applyShowQuickCommitFileDetailsCommand(d,e,h);case f.N4.ShowQuickCurrentBranchHistory:return this.applyShowQuickCurrentBranchHistoryCommand(d,e);case f.N4.ShowQuickFileHistory:return this.applyShowQuickFileHistoryCommand(d,e);case f.N4.ToggleFileBlame:return this.applyToggleFileBlameCommand(d,e);case f.N4.ToggleFileChanges:return this.applyToggleFileChangesCommand(d,e,h);case f.N4.ToggleFileChangesOnly:return this.applyToggleFileChangesCommand(d,e,h,!0);case f.N4.ToggleFileHeatmap:return this.applyToggleFileHeatmapCommand(d,e);default:return e}}applyDiffWithPreviousCommand(e,r,t){return r.command=(0,hi._N)({title:e,command:w.Gh.DiffWithPrevious,arguments:[void 0,{commit:t,uri:r.uri.toFileUri()}]}),r}applyCopyOrOpenCommitOnRemoteCommand(e,r,t,i=!1){return r.command=(0,hi._N)({title:e,command:w.Gh.OpenOnRemote,arguments:[{resource:{type:wr.JD.Commit,sha:t.sha},repoPath:t.repoPath,clipboard:i}]}),r}applyCopyOrOpenFileOnRemoteCommand(e,r,t,i=!1){var n;return r.command=(0,hi._N)({title:e,command:w.Gh.OpenOnRemote,arguments:[{resource:{type:wr.JD.Revision,fileName:((n=t.file)==null?void 0:n.path)??"",sha:t.sha},repoPath:t.repoPath,clipboard:i}]}),r}applyRevealCommitInViewCommand(e,r,t){return r.command=(0,hi._N)({title:e,command:t?.isUncommitted?"":f.N4.RevealCommitInView,arguments:[r.uri.toFileUri(),{commit:t,sha:t===void 0?void 0:t.sha}]}),r}applyShowCommitsInViewCommand(e,r,t,i){let n;return i===void 0?n=[...(0,C.DZ)(t.commits.values(),d=>d.isUncommitted?void 0:d.ref)]:n=[i.ref],r.command=(0,hi._N)({title:e,command:n.length===0?"":w.Gh.ShowCommitsInView,arguments:[{repoPath:t.repoPath,refs:n}]}),r}applyShowQuickCommitDetailsCommand(e,r,t){return r.command=(0,hi._N)({title:e,command:t?.isUncommitted?"":f.N4.ShowQuickCommitDetails,arguments:[r.uri.toFileUri(),{commit:t,sha:t===void 0?void 0:t.sha}]}),r}applyShowQuickCommitFileDetailsCommand(e,r,t){return r.command=(0,hi._N)({title:e,command:t?.isUncommitted?"":f.N4.ShowQuickCommitFileDetails,arguments:[r.uri.toFileUri(),{commit:t,sha:t===void 0?void 0:t.sha}]}),r}applyShowQuickCurrentBranchHistoryCommand(e,r){return r.command=(0,hi._N)({title:e,command:f.N4.ShowQuickCurrentBranchHistory,arguments:[r.uri.toFileUri()]}),r}applyShowQuickFileHistoryCommand(e,r){return r.command=(0,hi._N)({title:e,command:f.N4.ShowQuickFileHistory,arguments:[r.uri.toFileUri(),{range:r.isFullRange?void 0:r.blameRange}]}),r}applyToggleFileBlameCommand(e,r){return r.command=(0,hi._N)({title:e,command:w.Gh.ToggleFileBlame,arguments:[r.uri.toFileUri()]}),r}applyToggleFileChangesCommand(e,r,t,i){return r.command=(0,hi._N)({title:e,command:w.Gh.ToggleFileChanges,arguments:[r.uri.toFileUri(),{type:f.VP.Changes,context:{sha:t.sha,only:i,selection:!1}}]}),r}applyToggleFileHeatmapCommand(e,r){return r.command=(0,hi._N)({title:e,command:w.Gh.ToggleFileHeatmap,arguments:[r.uri.toFileUri()]}),r}applyCommandWithNoClickAction(e,r){return r.command={title:e,command:""},r}getDirtyTitle(e){return e.recentChange.enabled&&e.authors.enabled?this.container.config.strings.codeLens.unsavedChanges.recentChangeAndAuthors:e.recentChange.enabled?this.container.config.strings.codeLens.unsavedChanges.recentChangeOnly:this.container.config.strings.codeLens.unsavedChanges.authorsOnly}}o(tn,"GitCodeLensProvider"),Jr(tn,"selector",[{scheme:w.sN.File},{scheme:w.sN.Git},{scheme:w.sN.GitLens},{scheme:w.sN.PRs},{scheme:w.sN.Vsls},{scheme:w.sN.VslsScc},{scheme:w.sN.Virtual},{scheme:w.sN.GitHub}]);function Sr(l){return wn(l)?l.range:l.location.range}o(Sr,"getRangeFromSymbol");function wn(l){return(0,c.is)(l,"children")}o(wn,"isDocumentSymbol");var bn=Object.defineProperty,cn=o((l,e,r)=>e in l?bn(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"codeLensController_defNormalProp"),W=o((l,e,r)=>(cn(l,typeof e!="symbol"?e+"":e,r),r),"codeLensController_publicField");class z{constructor(e){this.container=e,W(this,"_canToggle",!1),W(this,"_disposable"),W(this,"_provider"),W(this,"_providerDisposable"),this._disposable=s.Disposable.from((0,x.IH)(e.onReady)(this.onReady,this),f.DN.onDidChange(this.onConfigurationChanged,this))}dispose(){var e,r;(e=this._providerDisposable)==null||e.dispose(),(r=this._disposable)==null||r.dispose()}onReady(){this.onConfigurationChanged()}onConfigurationChanged(e){var r;if(f.DN.changed(e,"codeLens")||f.DN.changed(e,"defaultDateFormat")||f.DN.changed(e,"defaultDateSource")||f.DN.changed(e,"defaultDateStyle")){e!=null&&P.Y.log("CodeLens config changed; resetting CodeLens provider");const t=this.container.config.codeLens;t.enabled&&(t.recentChange.enabled||t.authors.enabled)?this.ensureProvider():((r=this._providerDisposable)==null||r.dispose(),this._provider=void 0),this._canToggle=t.recentChange.enabled||t.authors.enabled,(0,y.v)(w.zf.DisabledToggleCodeLens,!this._canToggle)}}onBlameStateChanged(e){this._provider===void 0||!e.blameable||(P.Y.log("Blame state changed; resetting CodeLens provider"),this._provider.reset("saved"))}onDirtyIdleTriggered(e){if(this._provider===void 0||!e.document.isBlameable)return;const r=this.container.config.advanced.blame.sizeThresholdAfterEdit;r>0&&e.document.lineCount>r||(P.Y.log("Dirty idle triggered; resetting CodeLens provider"),this._provider.reset("idle"))}toggleCodeLens(){var e;if(!!this._canToggle){if(P.Y.log("toggleCodeLens()"),this._provider!==void 0){(e=this._providerDisposable)==null||e.dispose(),this._provider=void 0;return}this.ensureProvider()}}ensureProvider(){var e;if(this._provider!==void 0){this._provider.reset();return}(e=this._providerDisposable)==null||e.dispose(),this._provider=new tn(this.container),this._providerDisposable=s.Disposable.from(s.languages.registerCodeLensProvider(tn.selector,this._provider),this.container.tracker.onDidChangeBlameState(this.onBlameStateChanged,this),this.container.tracker.onDidTriggerDirtyIdle(this.onDirtyIdleTriggered,this))}}o(z,"GitCodeLensController");var X=g(3628),ge=Object.defineProperty,Be=o((l,e,r)=>e in l?ge(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"searchTree_defNormalProp"),rt=o((l,e,r)=>(Be(l,typeof e!="symbol"?e+"":e,r),r),"searchTree_publicField");const yt={done:!0,value:void 0};class Jt{constructor(){rt(this,"_value",""),rt(this,"_pos",0)}reset(e){return this._value=e,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos0)i.left||(i.left=new mi,i.left.segment=t.value()),i=i.left;else if(d<0)i.right||(i.right=new mi,i.right.segment=t.value()),i=i.right;else if(t.hasNext())t.next(),i.mid||(i.mid=new mi,i.mid.segment=t.value()),i=i.mid;else break}const n=i.value;return i.value=r,i.key=e,n}get(e){var r;return(r=this._getNode(e))==null?void 0:r.value}_getNode(e){const r=this._iter.reset(e);let t=this._root;for(;t;){const i=r.cmp(t.segment);if(i>0)t=t.left;else if(i<0)t=t.right;else if(r.hasNext())r.next(),t=t.mid;else break}return t}has(e){const r=this._getNode(e);return!(r?.value===void 0&&r?.mid===void 0)}delete(e){return this._delete(e,!1)}deleteSuperstr(e){return this._delete(e,!0)}_delete(e,r){const t=this._iter.reset(e),i=[];let n=this._root;for(;n;){const d=t.cmp(n.segment);if(d>0)i.push([1,n]),n=n.left;else if(d<0)i.push([-1,n]),n=n.right;else if(t.hasNext())t.next(),i.push([0,n]),n=n.mid;else{for(r?(n.left=void 0,n.mid=void 0,n.right=void 0):n.value=void 0;i.length>0&&n.isEmpty();){const[h,D]=i.pop();switch(h){case 1:D.left=void 0;break;case 0:D.mid=void 0;break;case-1:D.right=void 0;break}n=D}break}}}findSubstr(e){const r=this._iter.reset(e);let t=this._root,i;for(;t;){const n=r.cmp(t.segment);if(n>0)t=t.left;else if(n<0)t=t.right;else if(r.hasNext())r.next(),i=t.value||i,t=t.mid;else break}return t?.value||i}findSuperstr(e,r=!1){const t=this._iter.reset(e);let i=this._root;for(;i;){const n=t.cmp(i.segment);if(n>0)i=i.left;else if(n<0)i=i.right;else if(t.hasNext())t.next(),i=i.mid;else return i.mid?(i=i.mid,{[Symbol.iterator]:()=>this._nodeIterator(i,r)}):void 0}}_nodeIterator(e,r=!1){let t,i,n;return{next:o(()=>(n||(n=[],i=0,this._forEach(e,h=>n.push(h),r)),i>=n.length?yt:(t?t.value=n[i++]:t={done:!1,value:n[i++]},t)),"next")}}forEach(e){this._forEach(this._root,e)}_forEach(e,r,t=!1){e!==void 0&&(this._forEach(e.left,r,t),e.value&&r(e.value,e.key),t||this._forEach(e.mid,r,t),this._forEach(e.right,r,t))}any(){return this._root!==void 0&&!this._root.isEmpty()}count(e){return this._root===void 0||this._root.isEmpty()?0:(0,C.QX)(this.entries(),e===void 0?void 0:([,r])=>e(r))}entries(){return this._iterator(this._root)}values(){return(0,C.UI)(this.entries(),([,e])=>e)}highlander(){if(this._root===void 0||this._root.isEmpty())return;const e=this.entries();let r=0,t,i;for(;t=e.next(),!t.done;)if(i=t.value,r++,r>1)return;return i}some(e){return this._root===void 0||this._root.isEmpty()?!1:(0,C.G)(this.entries(),([,r])=>e(r))}*[Symbol.iterator](){yield*this._iterator(this._root)}*_iterator(e){e&&(yield*this._iterator(e.left),e.value&&(yield[e.key,e.value]),yield*this._iterator(e.mid),yield*this._iterator(e.right))}}o(Vt,"TernarySearchTree");var xt=Object.defineProperty,ci=Object.getOwnPropertyDescriptor,xi=o((l,e,r)=>e in l?xt(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"fsProvider_defNormalProp"),Ji=o((l,e,r,t)=>{for(var i=t>1?void 0:t?ci(e,r):e,n=l.length-1,d;n>=0;n--)(d=l[n])&&(i=(t?d(e,r,i):d(i))||i);return t&&i&&xt(e,r,i),i},"fsProvider_decorateClass"),Ri=o((l,e,r)=>(xi(l,typeof e!="symbol"?e+"":e,r),r),"fsProvider_publicField");const mr=new Uint8Array(0);function xr(l){const e=A.YY.is(l)?l:A.YY.fromRevisionUri(l);return{path:e.relativePath,ref:e.sha,repoPath:e.repoPath}}o(xr,"fromGitLensFSUri");class _r{constructor(e){this.container=e,Ri(this,"_disposable"),Ri(this,"_searchTreeMap",new Map),Ri(this,"_onDidChangeFile",new s.EventEmitter),this._disposable=s.Disposable.from(s.workspace.registerFileSystemProvider(w.sN.GitLens,this,{isCaseSensitive:X.IJ,isReadonly:!0}))}dispose(){this._disposable.dispose()}get onDidChangeFile(){return this._onDidChangeFile.event}copy(){throw s.FileSystemError.NoPermissions}createDirectory(){throw s.FileSystemError.NoPermissions}delete(){throw s.FileSystemError.NoPermissions}async readDirectory(e){const{path:r,ref:t,repoPath:i}=xr(e),n=await this.getTree(r,t,i);if(n===void 0)throw s.FileSystemError.FileNotFound(e);return[...(0,C.UI)(n,h=>[r!=null&&r.length!==0?(0,k.AH)((0,k.Gf)(r,h.path)):h.path,so(h.type)])]}async readFile(e){const{path:r,ref:t,repoPath:i}=xr(e);if(t===v.GitRevision.deletedOrMissing)return mr;const n=await this.container.git.getRevisionContent(i,r,t);return n??mr}rename(){throw s.FileSystemError.NoPermissions}async stat(e){const{path:r,ref:t,repoPath:i}=xr(e);if(t===v.GitRevision.deletedOrMissing)return{type:s.FileType.File,size:0,ctime:0,mtime:0};let n;const d=this._searchTreeMap.get(t);if(d!==void 0)n=(await d).get(`/~/${r}`);else{if(r==null||r.length===0){if(await this.getTree(r,t,i)===void 0)throw s.FileSystemError.FileNotFound(e);return{type:s.FileType.Directory,size:0,ctime:0,mtime:0}}n=await this.container.git.getTreeEntryForRevision(i,r,t)}if(n===void 0)throw s.FileSystemError.FileNotFound(e);return{type:so(n.type),size:n.size,ctime:0,mtime:0}}watch(){return{dispose:()=>{}}}writeFile(){throw s.FileSystemError.NoPermissions}async createSearchTree(e,r){const t=Vt.forPaths(),i=await this.container.git.getTreeForRevision(r,e);t.set("~",{commitSha:"",path:"~",size:0,type:"tree"});for(const n of i)t.set(`~/${n.path}`,n);return t}getOrCreateSearchTree(e,r){let t=this._searchTreeMap.get(e);return t===void 0&&(t=this.createSearchTree(e,r),this._searchTreeMap.set(e,t)),t}async getTree(e,r,t){return(await this.getOrCreateSearchTree(r,t)).findSuperstr(`/~/${e}`,!0)}}o(_r,"GitFileSystemProvider"),Ji([(0,_.fF)()],_r.prototype,"readDirectory",1),Ji([(0,_.fF)()],_r.prototype,"readFile",1),Ji([(0,_.fF)()],_r.prototype,"stat",1);function so(l){switch(l){case"blob":return s.FileType.File;case"tree":return s.FileType.Directory;default:return s.FileType.Unknown}}o(so,"typeToFileType");var Bo=g(4914),yn=g(2090),er=g(6410),wi=g(2062),No=g(3866),Un=Object.defineProperty,ao=Object.getOwnPropertyDescriptor,br=Object.getOwnPropertySymbols,Hr=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,Mo=o((l,e,r)=>e in l?Un(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"gitProviderService_defNormalProp"),rn=o((l,e)=>{for(var r in e||(e={}))Hr.call(e,r)&&Mo(l,r,e[r]);if(br)for(var r of br(e))Or.call(e,r)&&Mo(l,r,e[r]);return l},"gitProviderService_spreadValues"),lo=o((l,e)=>{var r={};for(var t in l)Hr.call(l,t)&&e.indexOf(t)<0&&(r[t]=l[t]);if(l!=null&&br)for(var t of br(l))e.indexOf(t)<0&&Or.call(l,t)&&(r[t]=l[t]);return r},"__objRest"),Ot=o((l,e,r,t)=>{for(var i=t>1?void 0:t?ao(e,r):e,n=l.length-1,d;n>=0;n--)(d=l[n])&&(i=(t?d(e,r,i):d(i))||i);return t&&i&&Un(e,r,i),i},"gitProviderService_decorateClass"),cr=o((l,e,r)=>(Mo(l,typeof e!="symbol"?e+"":e,r),r),"gitProviderService_publicField");const Ar=100,Cn=new Map([["master",Ar],["main",15],["default",10],["develop",5],["development",1]]);var Pn=(l=>(l.Private="private",l.Public="public",l.Local="local",l.Mixed="mixed",l))(Pn||{});const nn=o(class{constructor(l){this.container=l,cr(this,"_onDidChangeProviders",new s.EventEmitter),cr(this,"_onDidChangeRepositories",new s.EventEmitter),cr(this,"_onDidChangeRepository",new s.EventEmitter),cr(this,"supportedSchemes",new Set),cr(this,"_disposable"),cr(this,"_pendingRepositories",new Map),cr(this,"_providers",new Map),cr(this,"_repositories",new yn.x8),cr(this,"_richRemotesCache",new Map),cr(this,"_visitedPaths",new No.u$),cr(this,"_etag",0),cr(this,"_initializing",!0),cr(this,"_discoveredWorkspaceFolders",new Map),cr(this,"_subscription"),cr(this,"_accessCache",new Map),cr(this,"_visibilityCache",new Map),cr(this,"_context",{enabled:!1,disabled:!1}),this._disposable=s.Disposable.from(l.subscription.onDidChange(this.onSubscriptionChanged,this),s.window.onDidChangeWindowState(this.onWindowStateChanged,this),s.workspace.onDidChangeWorkspaceFolders(this.onWorkspaceFoldersChanged,this),f.DN.onDidChange(this.onConfigurationChanged,this),wr.Vy.onDidChange(e=>{e.reason==="connected"&&(0,Vr.E3)("failed"),this.resetCaches("providers"),this.updateContext()})),this.container.BranchDateFormatting.reset(),this.container.CommitDateFormatting.reset(),this.container.CommitShaFormatting.reset(),this.container.PullRequestDateFormatting.reset(),this.updateContext()}get onDidChangeProviders(){return this._onDidChangeProviders.event}fireProvidersChanged(l,e){this._etag=Date.now(),this._onDidChangeProviders.fire({added:l??[],removed:e??[],etag:this._etag})}get onDidChangeRepositories(){return this._onDidChangeRepositories.event}fireRepositoriesChanged(l,e){this._etag=Date.now(),this._accessCache.clear(),this._visibilityCache.delete(void 0),e?.length&&this._visibilityCache.clear(),this._onDidChangeRepositories.fire({added:l??[],removed:e??[],etag:this._etag})}get onDidChangeRepository(){return this._onDidChangeRepository.event}dispose(){this._disposable.dispose(),this._providers.clear(),this._repositories.forEach(l=>l.dispose()),this._repositories.clear()}get etag(){return this._etag}onConfigurationChanged(l){(f.DN.changed(l,"defaultDateFormat")||f.DN.changed(l,"defaultDateSource")||f.DN.changed(l,"defaultDateStyle"))&&(this.container.BranchDateFormatting.reset(),this.container.CommitDateFormatting.reset(),this.container.PullRequestDateFormatting.reset()),f.DN.changed(l,"advanced.abbreviatedShaLength")&&this.container.CommitShaFormatting.reset(),f.DN.changed(l,"views.contributors.showAllBranches")&&this.resetCaches("contributors")}onSubscriptionChanged(l){this._accessCache.clear(),this._subscription=l.current}onWindowStateChanged(l){l.focused?this._repositories.forEach(e=>e.resume()):this._repositories.forEach(e=>e.suspend())}onWorkspaceFoldersChanged(l){if(l.added.length&&this.discoverRepositories(l.added),l.removed.length){const e=[];for(const r of l.removed){const t=this._repositories.getClosest(r.uri);t!=null&&(this._repositories.remove(t.uri),e.push(t))}e.length&&(this.updateContext(),queueMicrotask(()=>{this.fireRepositoriesChanged([],e),e.forEach(r=>r.dispose())}))}}get hasProviders(){return this._providers.size!==0}get registeredProviders(){return[...(0,C.UI)(this._providers.values(),l=>rn({},l.descriptor))]}get openRepositories(){const l=[...(0,C.hX)(this.repositories,e=>!e.closed)];return l.length===0?l:v.Repository.sort(l)}get openRepositoryCount(){return(0,C.QX)(this.repositories,l=>!l.closed)}get repositories(){return this._repositories.values()}get repositoryCount(){return this._repositories.count}get highlander(){return this.repositoryCount===1?(0,C.Ps)(this._repositories.values()):void 0}register(l,e){var r;if(l!==e.descriptor.id)throw new Error(`Id '${l}' must match provider id '${e.descriptor.id}'`);if(this._providers.has(l))throw new Error(`Provider '${l}' has already been registered`);this._providers.set(l,e);for(const d of e.supportedSchemes)this.supportedSchemes.add(d);const t=[],i=(r=e.openRepositoryInitWatcher)==null?void 0:r.call(e);i!=null&&t.push(i,i.onDidCreate(d=>{const h=s.workspace.getWorkspaceFolder(d);h!=null&&this.discoverRepositories([h],{force:!0})}));const n=s.Disposable.from(e,...t,e.onDidChangeRepository(d=>{d.changed(v.RepositoryChange.Remotes,v.RepositoryChange.RemoteProviders,v.RepositoryChangeComparisonMode.Any)&&this._richRemotesCache.clear(),d.changed(v.RepositoryChange.Closed,v.RepositoryChangeComparisonMode.Any)&&(this.updateContext(),queueMicrotask(()=>this.fireRepositoriesChanged([],[d.repository]))),this._visibilityCache.delete(d.repository.path),this._onDidChangeRepository.fire(d)}),e.onDidCloseRepository(d=>{const h=this._repositories.get(d.uri);h!=null&&(h.closed=!0)}),e.onDidOpenRepository(d=>{const h=this._repositories.get(d.uri);h!=null?h.closed=!1:this.getOrOpenRepository(d.uri)}));return this.fireProvidersChanged([e]),this._initializing||this.onWorkspaceFoldersChanged({added:s.workspace.workspaceFolders??[],removed:[]}),{dispose:()=>{n.dispose(),this._providers.delete(l);const d=[];for(const h of[...this._repositories.values()])h?.provider.id===l&&(this._repositories.remove(h.uri),d.push(h));this.updateContext(),d.length&&queueMicrotask(()=>{this.fireRepositoriesChanged([],d),d.forEach(h=>h.dispose())}),this.fireProvidersChanged([],[e])}}}registrationComplete(){const l=P.Y.getCorrelationContext();this._initializing=!1;const{workspaceFolders:e}=s.workspace;e?.length?this.discoverRepositories(e):this.updateContext(),l!=null&&(l.exitDetails=` ${w.NE.Dot} workspaceFolders=${e?.length}, git.autoRepositoryDetection=${f.DN.getAny(w.eq.AutoRepositoryDetection)}`)}getOpenProviders(){return[...this.getOpenRepositoriesByProvider().keys()].map(e=>this._providers.get(e))}getOpenRepositories(l){return(0,C.hX)(this.repositories,e=>!e.closed&&(l==null||l===e.provider.id))}getOpenRepositoriesByProvider(){const l=[...(0,C.hX)(this.repositories,e=>!e.closed)];return l.length===0?new Map:(0,Rt.XI)(l,e=>e.provider.id)}hasOpenRepositories(l){return(0,C.G)(this.repositories,e=>!e.closed&&(l==null||l===e.provider.id))}async discoverRepositories(l,e){const r=[];for(const d of l){if(!e?.force&&this._discoveredWorkspaceFolders.has(d))continue;const h=this.discoverRepositoriesCore(d);r.push(h),this._discoveredWorkspaceFolders.set(d,h)}if(r.length===0)return;const t=await Promise.allSettled(r),i=(0,C.VS)((0,C.hX)(t,d=>d.status==="fulfilled"),d=>d.value),n=[];for(const d of i)this._repositories.add(d)&&n.push(d);this.updateContext(),n.length!==0&&queueMicrotask(()=>this.fireRepositoriesChanged(n))}async discoverRepositoriesCore(l){const{provider:e}=this.getProvider(l.uri);try{return await e.discoverRepositories(l.uri)}catch(r){return this._discoveredWorkspaceFolders.delete(l),P.Y.error(r,`${e.descriptor.name} Provider(${e.descriptor.id}) failed discovering repositories in ${l.uri.toString(!0)}`),[]}}async getSubscription(){return this._subscription??(this._subscription=await this.container.subscription.getSubscription())}async access(l,e){let r;if(e!=null){const{path:i}=this.getProvider(e);r=i}let t=this._accessCache.get(r);return t==null&&(t=this.accessCore(l,e),this._accessCache.set(r,t)),t}async accessCore(l,e){var r,t;const i=await this.getSubscription();if(((r=i.account)==null?void 0:r.verified)===!1)return{allowed:!1,subscription:{current:i}};const n=i.plan.effective.id;if((0,wi.aG)(n)||((t=nn.previewFeatures)==null?void 0:t.get(l)))return{allowed:!0,subscription:{current:i}};function d(h,D){const{path:M}=this.getProvider(h);let le=this._accessCache.get(M);return le==null&&(le=this.visibility(h).then(be=>{if(be!==L.q.Private)switch(D){case wi.Cx.Free:return{allowed:!1,subscription:{current:i,required:wi.Cx.FreePlus}};case wi.Cx.FreePlus:return{allowed:!0,subscription:{current:i}}}return{allowed:!1,subscription:{current:i,required:wi.Cx.Pro}}}),this._accessCache.set(M,le)),le}if(o(d,"getRepoAccess"),e==null){const h=this.openRepositories;if(h.length===0)return{allowed:!1,subscription:{current:i}};if(h.length===1)return d.call(this,h[0].path,n);let D=!0,M,le=-1;const be=(0,wi.kU)(wi.Cx.Pro);for await(const Ee of(0,$t.Wx)(h.map(xe=>d.call(this,xe.path,n)))){if(Ee.status!=="fulfilled"||Ee.value.allowed)continue;D=!1;const xe=(0,wi.kU)(Ee.value.subscription.required);if(le=be)break}return D?{allowed:!0,subscription:{current:i}}:{allowed:!1,subscription:{current:i,required:M}}}return d.call(this,e,n)}async ensureAccess(l,e){const{allowed:r,subscription:t}=await this.access(l,e);if(!r)throw new b.$y(t.current,t.required)}supports(l,e){const{provider:r}=this.getProvider(l);return r.supports(e)}async visibility(l){if(l==null){let t=this._visibilityCache.get(void 0);return t==null&&(t=this.visibilityCore(),this._visibilityCache.set(void 0,t)),t}const{path:e}=this.getProvider(l);let r=this._visibilityCache.get(e);return r==null&&(r=this.visibilityCore(l),this._visibilityCache.set(e,r)),r}async visibilityCore(l){function e(r){const{provider:t,path:i}=this.getProvider(r);let n=this._visibilityCache.get(i);return n==null&&(n=t.visibility(i),this._visibilityCache.set(i,n)),n}if(o(e,"getRepoVisibility"),l==null){const r=this.openRepositories;if(r.length===0)return"private";if(r.length===1)return e.call(this,r[0].path);let t=!1,i=!1,n=!1;for await(const d of(0,$t.Wx)(r.map(h=>e.call(this,h.path))))if(d.status==="fulfilled"){if(d.value===L.q.Public){if(n||i)return"mixed";t=!0}else if(d.value===L.q.Local){if(t||i)return"mixed";n=!0}else if(d.value===L.q.Private){if(t||n)return"mixed";i=!0}}return t?"public":n?"local":"private"}return e.call(this,l)}async setEnabledContext(l){let e=!l;if(!l&&this._initializing&&(e=!(this.container.storage.getWorkspace(er.sZ.AssumeRepositoriesOnStartup)??!0)),this._context.enabled===l&&this._context.disabled===e)return;const r=[];this._context.enabled!==l&&(this._context.enabled=l,r.push((0,y.v)(w.zf.Enabled,l))),this._context.disabled!==e&&(this._context.disabled=e,r.push((0,y.v)(w.zf.Disabled,e))),await Promise.all(r),this._initializing||this.container.storage.storeWorkspace(er.sZ.AssumeRepositoriesOnStartup,l)}updateContext(){const l=this.openRepositoryCount!==0;if(this.setEnabledContext(l),!l&&this._initializing)return;async function e(){let r=!1,t=!1,i=!1;if(l){for(const n of this._repositories.values())if(i||(i=await n.hasRichRemote(!0),i&&(t=!0,r=!0)),t||(t=await n.hasRichRemote(),t&&(r=!0)),r||(r=await n.hasRemotes()),r&&t&&i)break}await Promise.all([(0,y.v)(w.zf.HasRemotes,r),(0,y.v)(w.zf.HasRichRemotes,t),(0,y.v)(w.zf.HasConnectedRemotes,i)])}o(e,"updateRemoteContext"),e.call(this),this._providers.forEach(r=>{var t;return(t=r.updateContext)==null?void 0:t.call(r)})}getProvider(l){if(l==null||typeof l!="string"&&!this.supportedSchemes.has(l.scheme))throw new b.MO(l);let e;typeof l=="string"?e=(0,k.UG)(l)??w.sN.File:{scheme:e}=l;for(const r of this._providers.values()){const t=r.canHandlePathOrUri(e,l);if(t==null)continue;return{provider:r,path:t}}throw new b.MO(l)}getAbsoluteUri(l,e){if(e==null)return typeof l=="string"?(0,k.tE)(l)?s.Uri.parse(l,!0):s.Uri.file(l):l;if(typeof e!="string"&&typeof l=="string"&&!(0,k.YP)(l))return s.Uri.joinPath(e,(0,k.AH)(l));const{provider:r}=this.getProvider(e);return r.getAbsoluteUri(l,e)}async getBestRevisionUri(l,e,r){if(l==null||r===v.GitRevision.deletedOrMissing)return;const{provider:t,path:i}=this.getProvider(l);return t.getBestRevisionUri(i,t.getRelativePath(e,i),r)}getRelativePath(l,e){const{provider:r}=this.getProvider(l instanceof s.Uri?l:e);return r.getRelativePath(l,e)}getRevisionUri(l,e,r){let t,i;typeof l=="string"?(i=l,typeof e=="string"?t=e:t=e.originalPath??e.path):(i=l.sha,r=l.repoPath,t=(0,k.M)(l));const{provider:n,path:d}=this.getProvider(r);return n.getRevisionUri(d,n.getRelativePath(t,d),i)}async getWorkingUri(l,e){const{provider:r,path:t}=this.getProvider(l);return r.getWorkingUri(t,e)}addRemote(l,e,r){const{provider:t,path:i}=this.getProvider(l);return t.addRemote(i,e,r)}pruneRemote(l,e){const{provider:r,path:t}=this.getProvider(l);return r.pruneRemote(t,e)}async applyChangesToWorkingFile(l,e,r){const{provider:t}=this.getProvider(l);return t.applyChangesToWorkingFile(l,e,r)}async checkout(l,e,r){const{provider:t,path:i}=this.getProvider(l);return t.checkout(i,e,r)}resetCaches(...l){(l.length===0||l.includes("providers"))&&this._richRemotesCache.clear();const e=l.filter(r=>r==="branches"||r==="remotes");if(l.length===0||e.length>0)for(const r of this.repositories)r.resetCaches(...e);for(const r of this._providers.values())r.resetCaches(...l)}async excludeIgnoredUris(l,e){const{provider:r,path:t}=this.getProvider(l);return r.excludeIgnoredUris(t,e)}async fetch(l,e){const{provider:r,path:t}=this.getProvider(l);return r.fetch(t,e)}async fetchAll(l,e){if(l==null&&(l=this.openRepositories),l.length!==0){if(l.length===1){await l[0].fetch(e);return}await s.window.withProgress({location:s.ProgressLocation.Notification,title:`Fetching ${l.length} repositories`},()=>Promise.all(l.map(r=>r.fetch(rn({progress:!1},e)))))}}async pullAll(l,e){if(l==null&&(l=this.openRepositories),l.length!==0){if(l.length===1){await l[0].pull(e);return}await s.window.withProgress({location:s.ProgressLocation.Notification,title:`Pulling ${l.length} repositories`},()=>Promise.all(l.map(r=>r.pull(rn({progress:!1},e)))))}}async pushAll(l,e){if(l==null&&(l=this.openRepositories),l.length!==0){if(l.length===1){await l[0].push(e);return}await s.window.withProgress({location:s.ProgressLocation.Notification,title:`Pushing ${l.length} repositories`},()=>Promise.all(l.map(r=>r.push(rn({progress:!1},e)))))}}getAheadBehindCommitCount(l,e){const{provider:r,path:t}=this.getProvider(l);return r.getAheadBehindCommitCount(t,e)}async getBlame(l,e){const{provider:r}=this.getProvider(l);return r.getBlame(l,e)}async getBlameContents(l,e){const{provider:r}=this.getProvider(l);return r.getBlameContents(l,e)}async getBlameForLine(l,e,r,t){const{provider:i}=this.getProvider(l);return i.getBlameForLine(l,e,r,t)}async getBlameForLineContents(l,e,r,t){const{provider:i}=this.getProvider(l);return i.getBlameForLineContents(l,e,r,t)}async getBlameForRange(l,e){const{provider:r}=this.getProvider(l);return r.getBlameForRange(l,e)}async getBlameForRangeContents(l,e,r){const{provider:t}=this.getProvider(l);return t.getBlameForRangeContents(l,e,r)}getBlameRange(l,e,r){const{provider:t}=this.getProvider(e);return t.getBlameRange(l,e,r)}async getBranch(l){if(l==null)return;const{provider:e,path:r}=this.getProvider(l);return e.getBranch(r)}async getBranchAheadRange(l){var e,r;if(l.state.ahead>0)return v.GitRevision.createRange((e=l.upstream)==null?void 0:e.name,l.ref);if(l.upstream==null){const{values:t}=await this.getBranches(l.repoPath,{filter:i=>Cn.has(i.name)});if(t.length>0){let i;for(const d of t){const h=Cn.get(d.name);if((i==null||i.weightn.sha,n=>{if(e){if(n.name===e)return;if(n.refType==="branch"&&n.getNameWithoutRemote()===e)return{name:n.name,compactName:n.getRemoteName(),type:n.refType}}return{name:n.name,compactName:void 0,type:n.refType}});return(n,d)=>{const h=i.get(n);if(!(h==null||h.length===0)){if(!d?.compact)return h.map(D=>`${d?.icons?`${D.type==="tag"?"$(tag)":"$(git-branch)"} `:""}${D.name}`).join(", ");if(h.length>1){const[D]=h;return`${d?.icons?`${D.type==="tag"?"$(tag)":"$(git-branch)"} `:""}${D.compactName??D.name}, ${w.NE.Ellipsis}`}return h.map(D=>`${d?.icons?`${D.type==="tag"?"$(tag)":"$(git-branch)"} `:""}${D.compactName??D.name}`).join(", ")}}}getChangedFilesCount(l,e){const{provider:r,path:t}=this.getProvider(l);return r.getChangedFilesCount(t,e)}getCommit(l,e){const{provider:r,path:t}=this.getProvider(l);return r.getCommit(t,e)}getCommitBranches(l,e,r){const{provider:t,path:i}=this.getProvider(l);return t.getCommitBranches(i,e,r)}getCommitCount(l,e){const{provider:r,path:t}=this.getProvider(l);return r.getCommitCount(t,e)}async getCommitForFile(l,e,r){if(l==null)return;const{provider:t,path:i}=this.getProvider(l);return t.getCommitForFile(i,e,r)}async getOldestUnpushedRefForFile(l,e){const{provider:r,path:t}=this.getProvider(l);return r.getOldestUnpushedRefForFile(t,e)}async getContributors(l,e){if(l==null)return[];const{provider:r,path:t}=this.getProvider(l);return r.getContributors(t,e)}async getCurrentUser(l){const{provider:e,path:r}=this.getProvider(l);return e.getCurrentUser(r)}async getDefaultBranchName(l,e){if(l==null)return;const{provider:r,path:t}=this.getProvider(l);return r.getDefaultBranchName(t,e)}async getDiffForFile(l,e,r){const{provider:t}=this.getProvider(l);return t.getDiffForFile(l,e,r)}async getDiffForFileContents(l,e,r){const{provider:t}=this.getProvider(l);return t.getDiffForFileContents(l,e,r)}async getDiffForLine(l,e,r,t){const{provider:i}=this.getProvider(l);return i.getDiffForLine(l,e,r,t)}async getDiffStatus(l,e,r,t){const{provider:i,path:n}=this.getProvider(l);return i.getDiffStatus(n,e,r,t)}async getFileStatusForCommit(l,e,r){if(r===v.GitRevision.deletedOrMissing||v.GitRevision.isUncommitted(r))return;const{provider:t,path:i}=this.getProvider(l);return t.getFileStatusForCommit(i,e,r)}getLastFetchedTimestamp(l){const{provider:e,path:r}=this.getProvider(l);return e.getLastFetchedTimestamp(r)}async getLog(l,e){const{provider:r,path:t}=this.getProvider(l);return r.getLog(t,e)}async getLogRefsOnly(l,e){const{provider:r,path:t}=this.getProvider(l);return r.getLogRefsOnly(t,e)}async getLogForSearch(l,e,r){const{provider:t,path:i}=this.getProvider(l);return t.getLogForSearch(i,e,r)}async getLogForFile(l,e,r){if(l==null)return;const{provider:t,path:i}=this.getProvider(l);return t.getLogForFile(i,e,r)}async getMergeBase(l,e,r,t){const{provider:i,path:n}=this.getProvider(l);return i.getMergeBase(n,e,r,t)}async getMergeStatus(l){const{provider:e,path:r}=this.getProvider(l);return e.getMergeStatus(r)}async getRebaseStatus(l){const{provider:e,path:r}=this.getProvider(l);return e.getRebaseStatus(r)}getNextComparisonUris(l,e,r,t=0){if(!r)return Promise.resolve(void 0);const{provider:i,path:n}=this.getProvider(l);return i.getNextComparisonUris(n,e,r,t)}getPreviousComparisonUris(l,e,r,t=0,i=!1){if(r===v.GitRevision.deletedOrMissing)return Promise.resolve(void 0);const{provider:n,path:d}=this.getProvider(l);return n.getPreviousComparisonUris(d,e,r,t,i)}getPreviousComparisonUrisForLine(l,e,r,t,i=0){if(t===v.GitRevision.deletedOrMissing)return Promise.resolve(void 0);const{provider:n,path:d}=this.getProvider(l);return n.getPreviousComparisonUrisForLine(d,e,r,t,i)}async getPullRequestForBranch(l,e,r){var t;let i;if(v.GitRemote.is(e)){if({provider:i}=e,!i?.hasRichApi())return}else i=e;let n;r!=null&&(t=r,{timeout:n}=t,r=lo(t,["timeout"]));let d=i.getPullRequestForBranch(l,r);if(d==null||!(0,$t.tI)(d))return d;n!=null&&n>0&&(d=(0,$t.HO)(d,n));try{return await d}catch(h){if(h instanceof $t.PK)throw h;return}}async getPullRequestForCommit(l,e,r){if(v.GitRevision.isUncommitted(l))return;let t;if(v.GitRemote.is(e)){if({provider:t}=e,!t?.hasRichApi())return}else t=e;let i=t.getPullRequestForCommit(l);if(i==null||!(0,$t.tI)(i))return i;r?.timeout!=null&&r.timeout>0&&(i=(0,$t.HO)(i,r.timeout));try{return await i}catch(n){if(n instanceof $t.PK)throw n;return}}async getIncomingActivity(l,e){const{provider:r,path:t}=this.getProvider(l);return r.getIncomingActivity(t,e)}async getRichRemoteProvider(l,e){if(l==null)return;let r;if(Array.isArray(l)){if(l.length===0)return;r=l,l=l[0].repoPath}typeof l=="string"&&(l=this.getAbsoluteUri(l));const t=(0,yn.YW)(l);let i=this._richRemotesCache.get(t);if(i!=null)return i;if(i===null&&!e?.includeDisconnected)return;if(e?.includeDisconnected&&(i=this._richRemotesCache.get(`disconnected|${t}`),i!==void 0))return i??void 0;if(r=(r??await this.getRemotesWithProviders(l)).filter(D=>D.provider!=null),r.length===0)return;let n;if(r.length===1)n=r[0];else{const D=new Map([["upstream",15],["origin",10]]),M=await this.getBranch(r[0].repoPath),le=M?.getRemoteName();le!=null&&D.set(le,100);let be,Ee=0;for(const xe of r){if(xe.default){be=xe;break}const Ue=D.get(xe.name)??-1;Ue>Ee&&(be=xe,Ee=Ue)}n=be??null}if(!n?.hasRichProvider()){this._richRemotesCache.set(t,null);return}const{provider:d}=n;if(d.maybeConnected??await d.isConnected())this._richRemotesCache.set(t,n);else if(this._richRemotesCache.set(t,null),this._richRemotesCache.set(`disconnected|${t}`,n),!e?.includeDisconnected)return;return n}async getRemotes(l,e){if(l==null)return[];const{provider:r,path:t}=this.getProvider(l);return r.getRemotes(t,e)}async getRemotesWithProviders(l,e){if(l==null)return[];const r=this.container.git.getRepository(l);return(await(r!=null?r.getRemotes(e):this.getRemotes(l,e))).filter(i=>i.provider!=null)}getBestRepository(l,e){if(this.repositoryCount!==0){if(l!=null&&l instanceof s.Uri){const r=this.getRepository(l);if(r!=null)return r;l=void 0}return e=l??e??s.window.activeTextEditor,(e!=null?this.getRepository(e.document.uri):void 0)??this.highlander}}async getOrOpenRepository(l,e){const r=P.Y.getCorrelationContext(),t=(0,k.XX)((0,k.M)(l)),i=this.getRepository(l);if(e=e??f.DN.get("detectNestedRepositories"),e){if(this._visitedPaths.has(t))return i}else if(i!=null)return i;const n=(0,yn.YW)(l);let d=this._pendingRepositories.get(n);if(d==null){async function h(){const{provider:D}=this.getProvider(l),M=await D.findRepositoryUri(l);if(this._visitedPaths.set(t),M==null)return;let le=this._repositories.get(M);if(le!=null)return le;const be=this._repositories.getClosest(D.getAbsoluteUri(l,M)),Ee=f.DN.getAny(w.eq.AutoRepositoryDetection)??!0,xe=Ee!==!0&&Ee!=="openEditors";return P.Y.log(r,`Repository found in '${M.toString(!1)}'`),le=D.openRepository(be?.folder,M,!1,void 0,xe),this._repositories.add(le),this._pendingRepositories.delete(n),this.updateContext(),queueMicrotask(()=>this.fireRepositoriesChanged([le])),le}o(h,"findRepository"),d=h.call(this),this._pendingRepositories.set(n,d)}return d}async getOrOpenRepositoryForEditor(l){return l=l??s.window.activeTextEditor,l==null?this.highlander:this.getOrOpenRepository(l.document.uri)}getRepository(l){if(this.repositoryCount!==0&&l!=null)return typeof l=="string"?l?this._repositories.getClosest(this.getAbsoluteUri(l)):void 0:this._repositories.getClosest(l)}async getLocalInfoFromRemoteUri(l,e){var r;for(const t of this.openRepositories)for(const i of await t.getRemotes()){const n=await((r=i?.provider)==null?void 0:r.getLocalInfoFromRemoteUri(t,l,e));if(n!=null)return n}}async getStash(l){if(l==null)return;const{provider:e,path:r}=this.getProvider(l);return e.getStash(r)}async getStatusForFile(l,e){const{provider:r,path:t}=this.getProvider(l);return r.getStatusForFile(t,e)}async getStatusForFiles(l,e){const{provider:r,path:t}=this.getProvider(l);return r.getStatusForFiles(t,e)}async getStatusForRepo(l){if(l==null)return;const{provider:e,path:r}=this.getProvider(l);return e.getStatusForRepo(r)}async getTags(l,e){if(l==null)return{values:[]};const{provider:r,path:t}=this.getProvider(l);return r.getTags(t,e)}async getTreeEntryForRevision(l,e,r){if(l==null||!e)return;const{provider:t,path:i}=this.getProvider(l);return t.getTreeEntryForRevision(i,t.getRelativePath(e,i),r)}async getTreeForRevision(l,e){if(l==null)return[];const{provider:r,path:t}=this.getProvider(l);return r.getTreeForRevision(t,e)}getRevisionContent(l,e,r){const{provider:t,path:i}=this.getProvider(l);return t.getRevisionContent(i,e,r)}async hasBranchOrTag(l,e){if(l==null)return!1;const{provider:r,path:t}=this.getProvider(l);return r.hasBranchOrTag(t,e)}async hasCommitBeenPushed(l,e){if(l==null)return!1;const{provider:r,path:t}=this.getProvider(l);return r.hasCommitBeenPushed(t,e)}async hasRemotes(l){if(l==null)return!1;const e=this.getRepository(l);return e==null?!1:e.hasRemotes()}async hasTrackingBranch(l){if(l==null)return!1;const e=this.getRepository(l);return e==null?!1:e.hasUpstreamBranch()}isRepositoryForEditor(l,e){return e=e??s.window.activeTextEditor,e==null?!1:l===this.getRepository(e.document.uri)}isTrackable(l){if(!this.supportedSchemes.has(l.scheme))return!1;const{provider:e}=this.getProvider(l);return e.isTrackable(l)}async isTracked(l){if(!this.supportedSchemes.has(l.scheme))return!1;const{provider:e}=this.getProvider(l);return e.isTracked(l)}async getDiffTool(l){if(l==null)return;const{provider:e,path:r}=this.getProvider(l);return e.getDiffTool(r)}async openDiffTool(l,e,r){const{provider:t,path:i}=this.getProvider(l);return t.openDiffTool(i,e,r)}async openDirectoryCompare(l,e,r,t){const{provider:i,path:n}=this.getProvider(l);return i.openDirectoryCompare(n,e,r,t)}async resolveReference(l,e,r,t){if(!e||e===v.GitRevision.deletedOrMissing||r==null&&v.GitRevision.isSha(e)||r!=null&&v.GitRevision.isUncommitted(e))return e;const{provider:i,path:n}=this.getProvider(l);return i.resolveReference(n,e,r,t)}validateBranchOrTagName(l,e){const{provider:r,path:t}=this.getProvider(l);return r.validateBranchOrTagName(t,e)}async validateReference(l,e){if(e==null||e.length===0)return!1;if(e===v.GitRevision.deletedOrMissing||v.GitRevision.isUncommitted(e))return!0;const{provider:r,path:t}=this.getProvider(l);return r.validateReference(t,e)}stageFile(l,e){const{provider:r,path:t}=this.getProvider(l);return r.stageFile(t,e)}stageDirectory(l,e){const{provider:r,path:t}=this.getProvider(l);return r.stageDirectory(t,e)}unStageFile(l,e){const{provider:r,path:t}=this.getProvider(l);return r.unStageFile(t,e)}unStageDirectory(l,e){const{provider:r,path:t}=this.getProvider(l);return r.unStageDirectory(t,e)}stashApply(l,e,r){const{provider:t,path:i}=this.getProvider(l);return t.stashApply(i,e,r)}stashDelete(l,e,r){const{provider:t,path:i}=this.getProvider(l);return t.stashDelete(i,e,r)}stashSave(l,e,r,t){const{provider:i,path:n}=this.getProvider(l);return i.stashSave(n,e,r,t)}createWorktree(l,e,r){var t;const{provider:i,path:n}=this.getProvider(l);return Promise.resolve((t=i.createWorktree)==null?void 0:t.call(i,n,e,r))}async getWorktrees(l){var e;const{provider:r,path:t}=this.getProvider(l);return await((e=r.getWorktrees)==null?void 0:e.call(r,t))??[]}async getWorktreesDefaultUri(l){var e,r;const{provider:t,path:i}=this.getProvider(l);let n=await((e=t.getWorktreesDefaultUri)==null?void 0:e.call(t,i));return n!=null||(n=(r=this.getRepository(i))==null?void 0:r.uri,n!=null&&(n=s.Uri.joinPath(n,".."))),n}deleteWorktree(l,e,r){var t;const{provider:i,path:n}=this.getProvider(l);return Promise.resolve((t=i.deleteWorktree)==null?void 0:t.call(i,n,e,r))}async getOpenScmRepositories(){const l=await Promise.allSettled([...this._providers.values()].map(r=>r.getOpenScmRepositories()));return[...(0,C.VS)((0,C.hX)(l,r=>r.status==="fulfilled"),r=>r.value)]}async getOrOpenScmRepository(l){const{provider:e,path:r}=this.getProvider(l);return e.getOrOpenScmRepository(r)}static getEncoding(l){const e=f.DN.getAny("files.encoding",l);return e!=null&&(0,Bo.encodingExists)(e)?e:"utf8"}},"_GitProviderService");let se=nn;cr(se,"previewFeatures"),Ot([(0,_.fF)()],se.prototype,"onSubscriptionChanged",1),Ot([(0,_.fF)({args:{0:l=>`focused=${l.focused}`}})],se.prototype,"onWindowStateChanged",1),Ot([(0,_.fF)({args:{0:l=>`added=${l.added.length}, removed=${l.removed.length}`},singleLine:!0})],se.prototype,"onWorkspaceFoldersChanged",1),Ot([(0,_.cM)({args:{1:!1},singleLine:!0})],se.prototype,"register",1),Ot([(0,_.cM)({singleLine:!0})],se.prototype,"registrationComplete",1),Ot([(0,_.cM)({args:{0:l=>l.length}})],se.prototype,"discoverRepositories",1),Ot([(0,_.fF)()],se.prototype,"accessCore",1),Ot([(0,_.fF)()],se.prototype,"visibilityCore",1),Ot([(0,_.cM)()],se.prototype,"getBestRevisionUri",1),Ot([(0,_.cM)()],se.prototype,"getRevisionUri",1),Ot([(0,_.cM)()],se.prototype,"getWorkingUri",1),Ot([(0,_.cM)()],se.prototype,"addRemote",1),Ot([(0,_.cM)()],se.prototype,"pruneRemote",1),Ot([(0,_.cM)()],se.prototype,"applyChangesToWorkingFile",1),Ot([(0,_.cM)()],se.prototype,"checkout",1),Ot([(0,_.cM)()],se.prototype,"resetCaches",1),Ot([(0,_.cM)({args:{1:l=>l.length}})],se.prototype,"excludeIgnoredUris",1),Ot([(0,F.H)(),(0,_.cM)()],se.prototype,"fetch",1),Ot([(0,F.H)((l,e)=>`${l==null?"":l.map(r=>r.id).join(",")}|${JSON.stringify(e)}`),(0,_.cM)({args:{0:l=>l?.map(e=>e.name).join(", ")}})],se.prototype,"fetchAll",1),Ot([(0,F.H)((l,e)=>`${l==null?"":l.map(r=>r.id).join(",")}|${JSON.stringify(e)}`),(0,_.cM)({args:{0:l=>l?.map(e=>e.name).join(", ")}})],se.prototype,"pullAll",1),Ot([(0,F.H)(l=>`${l==null?"":l.map(e=>e.id).join(",")}`),(0,_.cM)({args:{0:l=>l?.map(e=>e.name).join(", ")}})],se.prototype,"pushAll",1),Ot([(0,_.cM)({args:{1:l=>l.join(",")}})],se.prototype,"getAheadBehindCommitCount",1),Ot([(0,_.cM)()],se.prototype,"getBlame",1),Ot([(0,_.cM)({args:{1:""}})],se.prototype,"getBlameContents",1),Ot([(0,_.cM)()],se.prototype,"getBlameForLine",1),Ot([(0,_.cM)({args:{2:""}})],se.prototype,"getBlameForLineContents",1),Ot([(0,_.cM)()],se.prototype,"getBlameForRange",1),Ot([(0,_.cM)({args:{2:""}})],se.prototype,"getBlameForRangeContents",1),Ot([(0,_.cM)({args:{0:""}})],se.prototype,"getBlameRange",1),Ot([(0,_.cM)()],se.prototype,"getBranch",1),Ot([(0,_.cM)({args:{0:l=>l.name}})],se.prototype,"getBranchAheadRange",1),Ot([(0,_.cM)({args:{1:!1}})],se.prototype,"getBranches",1),Ot([(0,_.cM)()],se.prototype,"getBranchesAndTagsTipsFn",1),Ot([(0,_.cM)()],se.prototype,"getChangedFilesCount",1),Ot([(0,_.cM)()],se.prototype,"getCommit",1),Ot([(0,_.cM)()],se.prototype,"getCommitBranches",1),Ot([(0,_.cM)()],se.prototype,"getCommitCount",1),Ot([(0,_.cM)()],se.prototype,"getCommitForFile",1),Ot([(0,_.cM)()],se.prototype,"getOldestUnpushedRefForFile",1),Ot([(0,_.cM)()],se.prototype,"getContributors",1),Ot([(0,F.H)(),(0,_.cM)()],se.prototype,"getCurrentUser",1),Ot([(0,_.cM)()],se.prototype,"getDefaultBranchName",1),Ot([(0,_.cM)()],se.prototype,"getDiffForFile",1),Ot([(0,_.cM)({args:{1:""}})],se.prototype,"getDiffForFileContents",1),Ot([(0,_.cM)()],se.prototype,"getDiffForLine",1),Ot([(0,_.cM)()],se.prototype,"getDiffStatus",1),Ot([(0,_.cM)()],se.prototype,"getFileStatusForCommit",1),Ot([(0,_.fF)()],se.prototype,"getLastFetchedTimestamp",1),Ot([(0,_.cM)()],se.prototype,"getLog",1),Ot([(0,_.cM)()],se.prototype,"getLogRefsOnly",1),Ot([(0,_.cM)()],se.prototype,"getLogForSearch",1),Ot([(0,_.cM)()],se.prototype,"getLogForFile",1),Ot([(0,_.cM)()],se.prototype,"getMergeBase",1),Ot([(0,F.H)(),(0,_.cM)()],se.prototype,"getMergeStatus",1),Ot([(0,F.H)(),(0,_.cM)()],se.prototype,"getRebaseStatus",1),Ot([(0,_.cM)()],se.prototype,"getNextComparisonUris",1),Ot([(0,_.cM)()],se.prototype,"getPreviousComparisonUris",1),Ot([(0,_.cM)()],se.prototype,"getPreviousComparisonUrisForLine",1),Ot([(0,F.H)((l,e,r)=>{const t=v.GitRemote.is(e)?e.provider:e;return`${l}${t!=null?`|${t.id}:${t.domain}/${t.path}`:""}|${JSON.stringify(r)}`}),(0,_.fF)({args:{1:l=>l.name}})],se.prototype,"getPullRequestForBranch",1),Ot([(0,F.H)((l,e,r)=>{const t=v.GitRemote.is(e)?e.provider:e;return`${l}${t!=null?`|${t.id}:${t.domain}/${t.path}`:""}|${r?.timeout}`}),(0,_.fF)({args:{1:l=>l.name}})],se.prototype,"getPullRequestForCommit",1),Ot([(0,_.cM)()],se.prototype,"getIncomingActivity",1),Ot([(0,F.H)((l,e)=>{var r;return`${l==null||typeof l=="string"?l:l instanceof s.Uri?l.toString():`${(r=l[0])==null?void 0:r.repoPath}|${l?.map(t=>t.id).join(",")??""}`}|${e?.includeDisconnected??!1}`}),(0,_.cM)({args:{0:l=>Array.isArray(l)?l.map(e=>e.name).join(","):l}})],se.prototype,"getRichRemoteProvider",1),Ot([(0,_.cM)({args:{1:!1}})],se.prototype,"getRemotes",1),Ot([(0,_.cM)()],se.prototype,"getRemotesWithProviders",1),Ot([(0,_.cM)({exit:l=>`returned ${l?.path}`})],se.prototype,"getBestRepository",1),Ot([(0,_.cM)({exit:l=>`returned ${l?.path}`})],se.prototype,"getOrOpenRepository",1),Ot([(0,_.cM)({args:{0:l=>l!=null?`TextEditor(${P.Y.toLoggable(l.document.uri)})`:void 0}})],se.prototype,"getOrOpenRepositoryForEditor",1),Ot([(0,_.cM)({exit:l=>`returned ${l?.path}`})],se.prototype,"getRepository",1),Ot([(0,F.H)(),(0,_.cM)()],se.prototype,"getStash",1),Ot([(0,_.cM)()],se.prototype,"getStatusForFile",1),Ot([(0,_.cM)()],se.prototype,"getStatusForFiles",1),Ot([(0,_.cM)()],se.prototype,"getStatusForRepo",1),Ot([(0,_.cM)({args:{1:!1}})],se.prototype,"getTags",1),Ot([(0,_.cM)()],se.prototype,"getTreeEntryForRevision",1),Ot([(0,_.cM)()],se.prototype,"getTreeForRevision",1),Ot([(0,F.H)(),(0,_.cM)()],se.prototype,"getRevisionContent",1),Ot([(0,_.cM)({args:{1:!1}})],se.prototype,"hasBranchOrTag",1),Ot([(0,_.cM)({args:{1:!1}})],se.prototype,"hasCommitBeenPushed",1),Ot([(0,_.cM)()],se.prototype,"hasRemotes",1),Ot([(0,_.cM)()],se.prototype,"hasTrackingBranch",1),Ot([(0,_.cM)({args:{0:l=>l.uri.toString(!1),1:l=>l!=null?`TextEditor(${P.Y.toLoggable(l.document.uri)})`:void 0}})],se.prototype,"isRepositoryForEditor",1),Ot([(0,_.cM)()],se.prototype,"getDiffTool",1),Ot([(0,_.cM)()],se.prototype,"openDiffTool",1),Ot([(0,_.cM)()],se.prototype,"openDirectoryCompare",1),Ot([(0,_.cM)()],se.prototype,"resolveReference",1),Ot([(0,_.cM)()],se.prototype,"validateBranchOrTagName",1),Ot([(0,_.cM)()],se.prototype,"validateReference",1),Ot([(0,_.cM)()],se.prototype,"stageFile",1),Ot([(0,_.cM)()],se.prototype,"stageDirectory",1),Ot([(0,_.cM)()],se.prototype,"unStageFile",1),Ot([(0,_.cM)()],se.prototype,"unStageDirectory",1),Ot([(0,_.cM)()],se.prototype,"stashApply",1),Ot([(0,_.cM)()],se.prototype,"stashDelete",1),Ot([(0,_.cM)({args:{2:l=>l?.length}})],se.prototype,"stashSave",1),Ot([(0,_.cM)()],se.prototype,"createWorktree",1),Ot([(0,_.cM)()],se.prototype,"getWorktrees",1),Ot([(0,_.cM)()],se.prototype,"getWorktreesDefaultUri",1),Ot([(0,_.cM)()],se.prototype,"deleteWorktree",1),Ot([(0,_.cM)()],se.prototype,"getOpenScmRepositories",1),Ot([(0,_.cM)()],se.prototype,"getOrOpenScmRepository",1);var a=g(5078),S=Object.defineProperty,re=Object.getOwnPropertyDescriptor,me=o((l,e,r)=>e in l?S(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"lineHoverController_defNormalProp"),he=o((l,e,r,t)=>{for(var i=t>1?void 0:t?re(e,r):e,n=l.length-1,d;n>=0;n--)(d=l[n])&&(i=(t?d(e,r,i):d(i))||i);return t&&i&&S(e,r,i),i},"lineHoverController_decorateClass"),Qe=o((l,e,r)=>(me(l,typeof e!="symbol"?e+"":e,r),r),"lineHoverController_publicField");const Mt=2**30;class it{constructor(e){this.container=e,Qe(this,"_disposable"),Qe(this,"_hoverProviderDisposable"),Qe(this,"_uri"),this._disposable=s.Disposable.from((0,x.IH)(e.onReady)(this.onReady,this),f.DN.onDidChange(this.onConfigurationChanged,this))}dispose(){this.unregister(),this.container.lineTracker.unsubscribe(this),this._disposable.dispose()}onReady(){this.onConfigurationChanged()}onConfigurationChanged(e){!f.DN.changed(e,"hovers.enabled")&&!f.DN.changed(e,"hovers.currentLine.enabled")||(this.container.config.hovers.enabled&&this.container.config.hovers.currentLine.enabled?(this.container.lineTracker.subscribe(this,this.container.lineTracker.onDidChangeActiveLines(this.onActiveLinesChanged,this)),this.register(s.window.activeTextEditor)):(this.container.lineTracker.unsubscribe(this),this.unregister()))}onActiveLinesChanged(e){var r;if(!e.pending){if(e.editor==null||e.selections==null){this.unregister();return}this.isRegistered((r=e.editor)==null?void 0:r.document.uri)||this.register(e.editor)}}async provideDetailsHover(e,r,t){if(!this.container.lineTracker.includes(r.line))return;const i=this.container.lineTracker.getState(r.line),n=i?.commit;if(n==null||this.container.config.hovers.annotations.details&&await this.container.fileAnnotations.getAnnotationType(s.window.activeTextEditor)===f.VP.Blame)return;const d=this.container.config.hovers.currentLine.over==="line";if(!d&&this.container.lineAnnotations.suspended)return;const h=e.validateRange(new s.Range(r.line,d?r.character:Mt,r.line,Mt));if(!d&&h.start.character!==r.character)return;let D=r.line;const M=D+1;D=(n.lines.find(xe=>xe.line===M)??n.lines[0]).originalLine-1;const be=await this.container.tracker.get(e);if(be==null)return;const Ee=await _i.detailsMessage(n,be.uri,D,this.container.config.hovers.detailsMarkdownFormat,this.container.config.defaultDateFormat,{autolinks:this.container.config.hovers.autolinks.enabled,pullRequests:{enabled:this.container.config.hovers.pullRequests.enabled}});return new s.Hover(Ee,h)}async provideChangesHover(e,r,t){if(!this.container.lineTracker.includes(r.line))return;const i=this.container.lineTracker.getState(r.line),n=i?.commit;if(n==null||this.container.config.hovers.annotations.changes&&await this.container.fileAnnotations.getAnnotationType(s.window.activeTextEditor)===f.VP.Blame)return;const d=this.container.config.hovers.currentLine.over==="line";if(!d&&this.container.lineAnnotations.suspended)return;const h=e.validateRange(new s.Range(r.line,d?r.character:Mt,r.line,Mt));if(!d&&h.start.character!==r.character)return;const D=await this.container.tracker.get(e);if(D==null)return;const M=await _i.changesMessage(n,D.uri,r.line,D.document);if(M!=null)return new s.Hover(M,h)}isRegistered(e){return this._hoverProviderDisposable!=null&&a.n.equals(this._uri,e)}register(e){if(this.unregister(),e==null)return;const r=this.container.config.hovers;if(!r.enabled||!r.currentLine.enabled||!r.currentLine.details&&!r.currentLine.changes)return;this._uri=e.document.uri;const t=[];r.currentLine.changes&&t.push(s.languages.registerHoverProvider({pattern:this._uri.fsPath},{provideHover:this.provideChangesHover.bind(this)})),r.currentLine.details&&t.push(s.languages.registerHoverProvider({pattern:this._uri.fsPath},{provideHover:this.provideDetailsHover.bind(this)})),this._hoverProviderDisposable=s.Disposable.from(...t)}unregister(){this._uri=void 0,this._hoverProviderDisposable!=null&&(this._hoverProviderDisposable.dispose(),this._hoverProviderDisposable=void 0)}}o(it,"LineHoverController"),he([(0,_.fF)({args:{0:l=>{var e,r;return`editor=${(e=l.editor)==null?void 0:e.document.uri.toString(!0)}, selections=${(r=l.selections)==null?void 0:r.map(t=>`[${t.anchor}-${t.active}]`).join(",")}, pending=${Boolean(l.pending)}, reason=${l.reason}`}}})],it.prototype,"onActiveLinesChanged",1),he([(0,_.fF)({args:{0:l=>P.Y.toLoggable(l.uri),1:l=>`${l.line}:${l.character}`,2:!1}})],it.prototype,"provideDetailsHover",1),he([(0,_.fF)({args:{0:l=>P.Y.toLoggable(l.uri),1:l=>`${l.line}:${l.character}`,2:!1}})],it.prototype,"provideChangesHover",1);var Tt=Object.defineProperty,ai=Object.getOwnPropertyDescriptor,bi=Object.getOwnPropertySymbols,sr=Object.prototype.hasOwnProperty,on=Object.prototype.propertyIsEnumerable,co=o((l,e,r)=>e in l?Tt(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"keyboard_defNormalProp"),gs=o((l,e)=>{for(var r in e||(e={}))sr.call(e,r)&&co(l,r,e[r]);if(bi)for(var r of bi(e))on.call(e,r)&&co(l,r,e[r]);return l},"keyboard_spreadValues"),un=o((l,e,r,t)=>{for(var i=t>1?void 0:t?ai(e,r):e,n=l.length-1,d;n>=0;n--)(d=l[n])&&(i=(t?d(e,r,i):d(i))||i);return t&&i&&Tt(e,r,i),i},"keyboard_decorateClass"),Ys=o((l,e,r)=>(co(l,typeof e!="symbol"?e+"":e,r),r),"keyboard_publicField");const Dl=Object.create(null),Oa=["left","alt+left","ctrl+left","right","alt+right","ctrl+right","alt+,","alt+.","escape"],lr=[];class hn{constructor(e){Ys(this,"_mapping"),Ys(this,"_paused",!0),this._mapping=e;for(const r in this._mapping)this._mapping[r]=this._mapping[r]??Dl;lr.push(this._mapping)}async dispose(){const e=lr.indexOf(this._mapping),r=P.Y.getCorrelationContext();r!=null&&(r.exitDetails=` \u2022 index=${e}`),e===lr.length-1?(lr.pop(),await this.updateKeyCommandsContext(lr[lr.length-1])):lr.splice(e,1)}get paused(){return this._paused}async clearKeyCommand(e){const r=P.Y.getCorrelationContext(),t=lr[lr.length-1];if(t!==this._mapping||t[e]==null){r!=null&&(r.exitDetails=" \u2022 skipped");return}t[e]=void 0,await(0,y.v)(`${w.zf.KeyPrefix}${e}`,!1)}async pause(e){if(this._paused)return;this._paused=!0;const r=Object.keys(this._mapping).reduce((t,i)=>(t[i]=e==null||e.includes(i)?void 0:this._mapping[i],t),Object.create(null));await this.updateKeyCommandsContext(r)}async resume(){!this._paused||(this._paused=!1,await this.updateKeyCommandsContext(this._mapping))}async start(){await this.resume()}async setKeyCommand(e,r){const t=P.Y.getCorrelationContext(),i=lr[lr.length-1];if(i!==this._mapping){t!=null&&(t.exitDetails=" \u2022 skipped");return}const n=Boolean(i[e]);i[e]=r,n||await(0,y.v)(`${w.zf.KeyPrefix}${e}`,!0)}async updateKeyCommandsContext(e){await Promise.all(Oa.map(r=>(0,y.v)(`${w.zf.KeyPrefix}${r}`,Boolean(e?.[r]))))}}o(hn,"KeyboardScope"),un([(0,_.cM)({args:!1,prefix:l=>`${l.prefix}[${lr.length}]`})],hn.prototype,"dispose",1),un([(0,_.cM)({args:!1,prefix:(l,e)=>`${l.prefix}[${lr.length}](${e})`})],hn.prototype,"clearKeyCommand",1),un([(0,_.cM)({args:!1,prefix:l=>`${l.prefix}(paused=${l.instance._paused})`})],hn.prototype,"pause",1),un([(0,_.cM)({args:!1,prefix:l=>`${l.prefix}(paused=${l.instance._paused})`})],hn.prototype,"resume",1),un([(0,_.cM)({args:!1,prefix:(l,e)=>`${l.prefix}[${lr.length}](${e})`})],hn.prototype,"setKeyCommand",1);class uo{constructor(){Ys(this,"_disposable");const e=Oa.map(r=>s.commands.registerCommand(`gitlens.key.${r}`,()=>this.execute(r),this));this._disposable=s.Disposable.from(...e)}dispose(){this._disposable.dispose()}createScope(e){return new hn(gs({},e))}async beginScope(e){const r=this.createScope(e);return await r.start(),r}async execute(e){const r=P.Y.getCorrelationContext();if(!lr.length){r!=null&&(r.exitDetails=" \u2022 skipped, no mappings");return}try{let i=lr[lr.length-1][e];if(typeof i=="function"&&(i=await i()),typeof i?.onDidPressKey!="function"){r!=null&&(r.exitDetails=" \u2022 skipped, no callback");return}await i.onDidPressKey(e)}catch(t){P.Y.error(t,r)}}}o(uo,"Keyboard"),un([(0,_.cM)({args:!1,prefix:(l,e)=>`${l.prefix}[${lr.length}](${e===void 0?"":Object.keys(e).join(",")})`})],uo.prototype,"createScope",1),un([(0,_.cM)({args:!1,prefix:(l,e)=>`${l.prefix}[${lr.length}](${e===void 0?"":Object.keys(e).join(",")})`})],uo.prototype,"beginScope",1),un([(0,_.cM)()],uo.prototype,"execute",1);var ho,$a=new Uint8Array(16);function Ea(){if(!ho&&(ho=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!ho))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ho($a)}o(Ea,"rng");const Ta=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function vs(l){return typeof l=="string"&&Ta.test(l)}o(vs,"validate");const Ks=vs;for(var ur=[],_s=0;_s<256;++_s)ur.push((_s+256).toString(16).substr(1));function Ol(l){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(ur[l[e+0]]+ur[l[e+1]]+ur[l[e+2]]+ur[l[e+3]]+"-"+ur[l[e+4]]+ur[l[e+5]]+"-"+ur[l[e+6]]+ur[l[e+7]]+"-"+ur[l[e+8]]+ur[l[e+9]]+"-"+ur[l[e+10]]+ur[l[e+11]]+ur[l[e+12]]+ur[l[e+13]]+ur[l[e+14]]+ur[l[e+15]]).toLowerCase();if(!Ks(r))throw TypeError("Stringified UUID is invalid");return r}o(Ol,"stringify");const Fa=Ol;function $l(l,e,r){l=l||{};var t=l.random||(l.rng||Ea)();if(t[6]=t[6]&15|64,t[8]=t[8]&63|128,e){r=r||0;for(var i=0;i<16;++i)e[r+i]=t[i];return e}return Fa(t)}o($l,"v4");const fo=$l;var ws=Object.defineProperty,mo=Object.getOwnPropertyDescriptor,sn=Object.getOwnPropertySymbols,xa=Object.prototype.hasOwnProperty,Aa=Object.prototype.propertyIsEnumerable,bs=o((l,e,r)=>e in l?ws(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"authenticationProvider_defNormalProp"),El=o((l,e)=>{for(var r in e||(e={}))xa.call(e,r)&&bs(l,r,e[r]);if(sn)for(var r of sn(e))Aa.call(e,r)&&bs(l,r,e[r]);return l},"authenticationProvider_spreadValues"),ko=o((l,e,r,t)=>{for(var i=t>1?void 0:t?mo(e,r):e,n=l.length-1,d;n>=0;n--)(d=l[n])&&(i=(t?d(e,r,i):d(i))||i);return t&&i&&ws(e,r,i),i},"authenticationProvider_decorateClass"),Uo=o((l,e,r)=>(bs(l,typeof e!="symbol"?e+"":e,r),r),"authenticationProvider_publicField");const ys="gitlens+",zs="GitLens+";class po{constructor(e,r){this.container=e,this.server=r,Uo(this,"_onDidChangeSessions",new s.EventEmitter),Uo(this,"_disposable"),Uo(this,"_sessionsPromise"),Uo(this,"_migrated"),this._sessionsPromise=this.getSessionsFromStorage(),this._disposable=s.Disposable.from(s.authentication.registerAuthenticationProvider(ys,zs,this,{supportsMultipleAccounts:!1}),this.container.storage.onDidChangeSecrets(()=>this.checkForUpdates()))}get onDidChangeSessions(){return this._onDidChangeSessions.event}dispose(){this._disposable.dispose()}get secretStorageKey(){return`gitlens.plus.auth:${this.container.env}`}abort(){return this.server.abort()}async createSession(e){const r=P.Y.getCorrelationContext();e=e.sort();const t=dn(e);try{const i=await this.server.login(e,t),n=await this.createSessionForToken(i,e),d=await this._sessionsPromise,h=d.findIndex(D=>D.id===n.id||dn(D.scopes)===t);return h>-1?d.splice(h,1,n):d.push(n),await this.storeSessions(d),this._onDidChangeSessions.fire({added:[n],removed:[],changed:[]}),n}catch(i){throw i==="Cancelled"||(P.Y.error(i,r),s.window.showErrorMessage(`Unable to sign in to GitLens+: ${i}`)),i}}async getSessions(e){const r=P.Y.getCorrelationContext();e=e?.sort();const t=dn(e),i=await this._sessionsPromise,n=e!=null?i.filter(d=>dn(d.scopes)===t):i;return r!=null&&(r.exitDetails=` \u2022 Found ${n.length} sessions`),n}async removeSession(e){const r=P.Y.getCorrelationContext();try{const t=await this._sessionsPromise,i=t.findIndex(d=>d.id===e);if(i===-1){P.Y.log(`Unable to remove session ${e}; Not found`);return}const n=t[i];t.splice(i,1),await this.storeSessions(t),this._onDidChangeSessions.fire({added:[],removed:[n],changed:[]})}catch(t){throw P.Y.error(t,r),s.window.showErrorMessage(`Unable to sign out of GitLens+: ${t}`),t}}async removeSessionsByScopes(e){const r=P.Y.getCorrelationContext();try{e=e?.sort();const t=dn(e),i=[];let n=0;const d=await this._sessionsPromise;for(const h of d){if(dn(h.scopes)!==t){n++;continue}d.splice(n,1),i.push(h)}if(i.length===0)return;await this.storeSessions(d),this._onDidChangeSessions.fire({added:[],removed:i,changed:[]})}catch(t){throw P.Y.error(t,r),s.window.showErrorMessage(`Unable to sign out of GitLens+: ${t}`),t}}async tryMigrateSession(){if(this._migrated==null&&(this._migrated=this.container.storage.get(er.BU.MigratedAuthentication,!1)),this._migrated)return;let e;try{if(s.extensions.getExtension("gitkraken.gitkraken-authentication")==null||(e=await s.authentication.getSession("gitkraken",["gitlens"],{createIfNone:!1}),e==null))return;e={id:fo(),accessToken:e.accessToken,account:El({},e.account),scopes:e.scopes};const r=await this._sessionsPromise,t=dn(e.scopes),i=r.findIndex(n=>n.id===e.id||dn(n.scopes)===t);i>-1?r.splice(i,1,e):r.push(e),await this.storeSessions(r),this._onDidChangeSessions.fire({added:[e],removed:[],changed:[]})}catch(r){P.Y.error(r,"Unable to migrate authentication")}finally{this._migrated=!0,this.container.storage.store(er.BU.MigratedAuthentication,!0)}return e}async checkForUpdates(){const e=await this._sessionsPromise;this._sessionsPromise=this.getSessionsFromStorage();const r=await this._sessionsPromise,t=[],i=[];for(const n of r)e.some(d=>d.id===n.id)||t.push(n);for(const n of e)r.some(d=>d.id===n.id)||i.push(n);(t.length||i.length)&&(P.Y.debug(`Firing sessions changed event; added=${t.length}, removed=${i.length}`),this._onDidChangeSessions.fire({added:t,removed:i,changed:[]}))}async createSessionForToken(e,r){const t=await this.server.getAccountInfo(e);return{id:fo(),accessToken:e,account:{label:t.accountName,id:t.id},scopes:r}}async getSessionsFromStorage(){let e;try{const i=await this.container.storage.getSecret(this.secretStorageKey);if(!i||i==="[]")return[];try{e=JSON.parse(i)}catch(n){try{await this.container.storage.deleteSecret(this.secretStorageKey)}catch{}throw n}}catch(i){return P.Y.error(i,"Unable to read sessions from storage"),[]}const r=e.map(async i=>{var n;const d=dn(i.scopes);P.Y.debug(`Read session from storage with scopes=${d}`);let h;if(i.account==null)try{h=await this.server.getAccountInfo(i.accessToken),P.Y.debug(`Verified session with scopes=${d}`)}catch(D){if(D.message==="Unauthorized")return}return{id:i.id,account:{label:i.account!=null?i.account.label??i.account.displayName??"":h?.accountName??"",id:((n=i.account)==null?void 0:n.id)??h?.id??""},scopes:i.scopes,accessToken:i.accessToken}}),t=(await Promise.allSettled(r)).filter(i=>i.status==="fulfilled").map(i=>i.value).filter(i=>Boolean(i));return P.Y.debug(`Found ${t.length} verified sessions`),t.length!==e.length&&await this.storeSessions(t),t}async storeSessions(e){try{this._sessionsPromise=Promise.resolve(e),await this.container.storage.storeSecret(this.secretStorageKey,JSON.stringify(e))}catch(r){P.Y.error(r,`Unable to store ${e.length} sessions`)}}}o(po,"SubscriptionAuthenticationProvider"),ko([(0,_.fF)()],po.prototype,"createSession",1),ko([(0,_.fF)()],po.prototype,"getSessions",1),ko([(0,_.fF)()],po.prototype,"removeSession",1),ko([(0,_.fF)()],po.prototype,"removeSessionsByScopes",1);function dn(l){return l?.join("|")}o(dn,"getScopesKey");var Wn=g(303),jr=g(8538),Qs=Object.defineProperty,Wo=Object.getOwnPropertyDescriptor,Ia=o((l,e,r)=>e in l?Qs(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"serverConnection_defNormalProp"),go=o((l,e,r,t)=>{for(var i=t>1?void 0:t?Wo(e,r):e,n=l.length-1,d;n>=0;n--)(d=l[n])&&(i=(t?d(e,r,i):d(i))||i);return t&&i&&Qs(e,r,i),i},"serverConnection_decorateClass"),vo=o((l,e,r)=>(Ia(l,typeof e!="symbol"?e+"":e,r),r),"serverConnection_publicField");class _o{constructor(e){this.container=e,vo(this,"_cancellationSource"),vo(this,"_deferredCodeExchanges",new Map),vo(this,"_disposable"),vo(this,"_pendingStates",new Map),vo(this,"_statusBarItem"),vo(this,"_uriHandler",new Lo),this._disposable=s.window.registerUriHandler(this._uriHandler)}dispose(){this._disposable.dispose()}get baseApiUri(){return this.container.env==="staging"?s.Uri.parse("https://stagingapi.gitkraken.com"):this.container.env==="dev"?s.Uri.parse("https://devapi.gitkraken.com"):s.Uri.parse("https://api.gitkraken.com")}get baseAccountUri(){return this.container.env==="staging"?s.Uri.parse("https://stagingaccount.gitkraken.com"):this.container.env==="dev"?s.Uri.parse("https://devaccount.gitkraken.com"):s.Uri.parse("https://account.gitkraken.com")}abort(){return this._cancellationSource==null?Promise.resolve():(this._cancellationSource.cancel(),new Promise(e=>setTimeout(e,50)))}async getAccountInfo(e){const r=P.Y.getCorrelationContext();let t;try{t=await(0,Wn.h)(s.Uri.joinPath(this.baseApiUri,"user").toString(),{agent:(0,Wn.N)(),headers:{Authorization:`Bearer ${e}`,"User-Agent":"Visual-Studio-Code-GitLens"}})}catch(n){throw P.Y.error(n,r),n}if(!t.ok)throw P.Y.error(void 0,`Getting account info failed: (${t.status}) ${t.statusText}`),new Error(t.statusText);const i=await t.json();return{id:i.id,accountName:i.username}}async login(e,r){this.updateStatusBarItem(!0);const t=fo(),i=this._pendingStates.get(r)??[];this._pendingStates.set(r,[...i,t]);const n=await s.env.asExternalUri(s.Uri.parse(`${s.env.uriScheme}://${this.container.context.extension.id}/did-authenticate?gkstate=${t}`)),d=s.Uri.joinPath(this.baseAccountUri,"register").with({query:`${e.includes("gitlens")?"referrer=gitlens&":""}pass-token=true&return-url=${encodeURIComponent(n.toString())}`});await s.env.openExternal(d);let h=this._deferredCodeExchanges.get(r);return h==null&&(h=(0,x.ue)(this._uriHandler.event,this.getUriHandlerDeferredExecutor(r)),this._deferredCodeExchanges.set(r,h)),this._cancellationSource!=null&&(this._cancellationSource.cancel(),this._cancellationSource.dispose(),this._cancellationSource=void 0),this._cancellationSource=new s.CancellationTokenSource,this.openCompletionInputFallback(this._cancellationSource.token),Promise.race([h.promise,new Promise((D,M)=>{var le;return(le=this._cancellationSource)==null?void 0:le.token.onCancellationRequested(()=>M("Cancelled"))}),new Promise((D,M)=>setTimeout(()=>M("Cancelled"),12e4))]).finally(()=>{var D,M;(D=this._cancellationSource)==null||D.cancel(),(M=this._cancellationSource)==null||M.dispose(),this._cancellationSource=void 0,this._pendingStates.delete(r),h?.cancel(),this._deferredCodeExchanges.delete(r),this.updateStatusBarItem(!1)})}async openCompletionInputFallback(e){const r=s.window.createInputBox();r.ignoreFocusOut=!0;const t=[];try{if(e.isCancellationRequested)return;const i=await new Promise(n=>{t.push(e.onCancellationRequested(()=>r.hide()),r.onDidHide(()=>n(void 0)),r.onDidChangeValue(d=>{if(!d){r.validationMessage=void 0;return}try{const h=s.Uri.parse(d.trim());if(h.scheme&&h.scheme!=="file"){r.validationMessage=void 0;return}}catch{}r.validationMessage="Please enter a valid authorization URL"}),r.onDidAccept(()=>n(s.Uri.parse(r.value.trim())))),r.title="GitLens+ Sign In",r.placeholder="Please enter the provided authorization URL",r.prompt="If the auto-redirect fails, paste the authorization URL",r.show()});i!=null&&this._uriHandler.handleUri(i)}finally{r.dispose(),t.forEach(i=>i.dispose())}}getUriHandlerDeferredExecutor(e){return(r,t,i)=>{const n=Go(r),d=this._pendingStates.get(e);if(d==null||!d.includes(n.gkstate)){P.Y.log("State not found in accepted state. Skipping this execution...");return}const h=n["access-token"]??n.code;h==null?i("Token not returned"):t(h)}}updateStatusBarItem(e){e&&this._statusBarItem==null&&(this._statusBarItem=s.window.createStatusBarItem("gitlens.plus.signIn",s.StatusBarAlignment.Left),this._statusBarItem.name="GitLens+ Sign in",this._statusBarItem.text="Signing in to GitLens+...",this._statusBarItem.show()),!e&&this._statusBarItem!=null&&(this._statusBarItem.dispose(),this._statusBarItem=void 0)}}o(_o,"ServerConnection"),go([(0,jr.H)()],_o.prototype,"baseApiUri",1),go([(0,jr.H)()],_o.prototype,"baseAccountUri",1),go([(0,_.fF)({args:!1})],_o.prototype,"getAccountInfo",1),go([(0,_.fF)()],_o.prototype,"login",1);class Lo extends s.EventEmitter{handleUri(e){this.fire(e)}}o(Lo,"UriEventHandler"),go([(0,_.cM)({args:{0:l=>l.with({query:""}).toString(!1)}})],Lo.prototype,"handleUri",1);function Go(l){return l.query.split("&").reduce((e,r)=>{const t=r.split("=");return e[t[0]]=t[1],e},{})}o(Go,"parseQuery");var Sn=g(7514),Ba=Object.defineProperty,qs=Object.defineProperties,Na=Object.getOwnPropertyDescriptor,Ma=Object.getOwnPropertyDescriptors,Zs=Object.getOwnPropertySymbols,Vo=Object.prototype.hasOwnProperty,Xs=Object.prototype.propertyIsEnumerable,Js=o((l,e,r)=>e in l?Ba(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"subscriptionService_defNormalProp"),Ho=o((l,e)=>{for(var r in e||(e={}))Vo.call(e,r)&&Js(l,r,e[r]);if(Zs)for(var r of Zs(e))Xs.call(e,r)&&Js(l,r,e[r]);return l},"subscriptionService_spreadValues"),jo=o((l,e)=>qs(l,Ma(e)),"subscriptionService_spreadProps"),pr=o((l,e,r,t)=>{for(var i=t>1?void 0:t?Na(e,r):e,n=l.length-1,d;n>=0;n--)(d=l[n])&&(i=(t?d(e,r,i):d(i))||i);return t&&i&&Ba(e,r,i),i},"subscriptionService_decorateClass"),Ur=o((l,e,r)=>(Js(l,typeof e!="symbol"?e+"":e,r),r),"subscriptionService_publicField");const ka="Visual-Studio-Code-GitLens",Ln=o(class{constructor(l){this.container=l,Ur(this,"_onDidChange",new s.EventEmitter),Ur(this,"_disposable"),Ur(this,"_subscription"),Ur(this,"_statusBarSubscription"),Ur(this,"_validationTimer"),Ur(this,"_etag",0),Ur(this,"_lastCheckInDate"),Ur(this,"_sessionPromise"),Ur(this,"_session"),this._disposable=s.Disposable.from((0,c.IH)(l.onReady)(this.onReady,this),this.container.subscriptionAuthentication.onDidChangeSessions(e=>setTimeout(()=>this.onAuthenticationChanged(e),0),this)),this.changeSubscription(this.getStoredSubscription(),!0),setTimeout(()=>void this.ensureSession(!1),1e4)}get onDidChange(){return this._onDidChange.event}dispose(){var l;(l=this._statusBarSubscription)==null||l.dispose(),this._disposable.dispose()}async onAuthenticationChanged(l){var e,r,t;let i=this._session;if(i==null&&this._sessionPromise!=null&&(i=await this._sessionPromise),i!=null&&((e=l.removed)==null?void 0:e.some(d=>d.id===i.id))){this._session=void 0,this._sessionPromise=void 0,this.logout();return}const n=((r=l.added)==null?void 0:r[0])??((t=l.changed)==null?void 0:t[0]);n!=null&&(n.id===i?.id&&n.accessToken===i?.accessToken||(this._session=i,this.validate()))}get baseApiUri(){const{env:l}=this.container;return l==="staging"?s.Uri.parse("https://stagingapi.gitkraken.com"):l==="dev"?s.Uri.parse("https://devapi.gitkraken.com"):s.Uri.parse("https://api.gitkraken.com")}get baseAccountUri(){const{env:l}=this.container;return l==="staging"?s.Uri.parse("https://stagingaccount.gitkraken.com"):l==="dev"?s.Uri.parse("https://devaccount.gitkraken.com"):s.Uri.parse("https://account.gitkraken.com")}get baseSiteUri(){const{env:l}=this.container;return l==="staging"?s.Uri.parse("https://staging.gitkraken.com"):l==="dev"?s.Uri.parse("https://dev.gitkraken.com"):s.Uri.parse("https://gitkraken.com")}get etag(){return this._etag}onReady(){this._disposable=s.Disposable.from(this._disposable,this.container.git.onDidChangeRepositories(this.onRepositoriesChanged,this),...this.registerCommands()),this.updateContext()}onRepositoriesChanged(l){this.updateContext()}registerCommands(){return this.container.viewCommands,[s.commands.registerCommand(w.Gh.PlusLearn,l=>this.learn(l)),s.commands.registerCommand(w.Gh.PlusLoginOrSignUp,()=>this.loginOrSignUp()),s.commands.registerCommand(w.Gh.PlusLogout,()=>this.logout()),s.commands.registerCommand(w.Gh.PlusStartPreviewTrial,()=>this.startPreviewTrial()),s.commands.registerCommand(w.Gh.PlusManage,()=>this.manage()),s.commands.registerCommand(w.Gh.PlusPurchase,()=>this.purchase()),s.commands.registerCommand(w.Gh.PlusResendVerification,()=>this.resendVerification()),s.commands.registerCommand(w.Gh.PlusValidate,()=>this.validate()),s.commands.registerCommand(w.Gh.PlusShowPlans,()=>this.showPlans()),s.commands.registerCommand(w.Gh.PlusHide,()=>f.DN.updateEffective("plusFeatures.enabled",!1)),s.commands.registerCommand(w.Gh.PlusRestore,()=>f.DN.updateEffective("plusFeatures.enabled",!0)),s.commands.registerCommand("gitlens.plus.reset",()=>this.logout(!0))]}async getSubscription(){return await this.ensureSession(!1),this._subscription}learn(l=!0){(0,O.lN)(this.container.context.extension.id,"gitlens.plus",void 0,l)}async loginOrSignUp(){if(!await(0,Sn.C)())return!1;await this.container.subscriptionAuthentication.abort(),this.showHomeView();const l=await this.ensureSession(!0),e=Boolean(l);if(e){const{account:r,plan:{actual:t,effective:i}}=this._subscription;if(r?.verified===!1){const n={title:"Resend Verification",isCloseAffordance:!0},d={title:"Cancel"};await s.window.showInformationMessage(`Before you can access your ${t.name} account, you must verify your email address.`,n,d)===n&&this.resendVerification()}else if((0,wi.dz)(this._subscription)){const n=(0,wi.PY)(this._subscription,"days"),d={title:"OK",isCloseAffordance:!0},h={title:"Learn More"};await s.window.showInformationMessage(`You are now signed in to your ${t.name} account which gives you access to GitLens+ features on public repos. You were also granted a trial of ${i.name} for both public and private repos for ${(0,Gt._6)("more day",n??0)}.`,{modal:!0},d,h)===h&&this.learn()}else s.window.showInformationMessage(`You are now signed in to your ${t.name} account.`,"OK")}return e}async logout(l=!1){if(this._validationTimer!=null&&(clearInterval(this._validationTimer),this._validationTimer=void 0),await this.container.subscriptionAuthentication.abort(),this._sessionPromise=void 0,this._session!=null?(this.container.subscriptionAuthentication.removeSession(this._session.id),this._session=void 0):this.container.subscriptionAuthentication.removeSessionsByScopes(Ln.authenticationScopes),l&&this.container.debugging){this.changeSubscription(void 0);return}this.changeSubscription(jo(Ho({},this._subscription),{plan:{actual:(0,wi.fV)(wi.Cx.Free),effective:(0,wi.fV)(wi.Cx.Free)},account:void 0}))}manage(){s.env.openExternal(this.baseAccountUri)}async purchase(){!await(0,Sn.C)()||(this._subscription.account==null?this.showPlans():s.env.openExternal(s.Uri.joinPath(this.baseAccountUri,"subscription").with({query:"product=gitlens"})),await this.showHomeView())}async resendVerification(){var l;if((l=this._subscription.account)!=null&&l.verified)return;const e=P.Y.getCorrelationContext();this.showHomeView(!0);const r=await this.ensureSession(!1);if(r!=null)try{const t=await(0,Wn.h)(s.Uri.joinPath(this.baseApiUri,"resend-email").toString(),{method:"POST",agent:(0,Wn.N)(),headers:{Authorization:`Bearer ${r.accessToken}`,"User-Agent":ka,"Content-Type":"application/json"},body:JSON.stringify({id:r.account.id})});if(!t.ok){P.Y.error("",e,`Unable to resend verification email; status=(${t.status}): ${t.statusText}`),s.window.showErrorMessage(`Unable to resend verification email; Status: ${t.statusText}`,"OK");return}const i={title:"Recheck"},n={title:"Cancel"};await s.window.showInformationMessage("Once you have verified your email address, click 'Recheck'.",i,n)===i&&await this.validate()}catch(t){P.Y.error(t,e),s.window.showErrorMessage("Unable to resend verification email","OK")}}async showHomeView(l=!1){l&&!f.DN.get("plusFeatures.enabled",void 0,!0)||this.container.homeView.visible||await(0,hi.P0)(w.Gh.ShowHomeView)}showPlans(){s.env.openExternal(s.Uri.joinPath(this.baseSiteUri,"gitlens/pricing"))}async startPreviewTrial(){if(!await(0,Sn.C)())return;let{plan:l,previewTrial:e}=this._subscription;if(e!=null||l.effective.id!==wi.Cx.Free){if(this.showHomeView(),l.effective.id===wi.Cx.Free){const D={title:"Sign in to GitLens+",isCloseAffordance:!0},M={title:"Cancel"};await s.window.showInformationMessage(`Your GitLens+ features trial has ended. Please sign in to use GitLens+ features on public repos and get a free 7-day trial for both public and private repos.`,{modal:!0},D,M)===D&&this.loginOrSignUp()}return}const r=new Date;let t,i=new Date(r);this.container.debugging?(i=(0,pt.IH)(i,{minutes:1}),t=0):(i.setHours(23,59,59,999),i=(0,pt.IH)(i,{days:3}),t=3),e={startedOn:r.toISOString(),expiresOn:i.toISOString()},this.changeSubscription(jo(Ho({},this._subscription),{plan:jo(Ho({},this._subscription.plan),{effective:(0,wi.fV)(wi.Cx.Pro,r,i)}),previewTrial:e}));const n={title:"OK",isCloseAffordance:!0},d={title:"Learn More"};await s.window.showInformationMessage(`You have started a ${t} day trial of GitLens+ features for both public and private repos.`,{modal:!0},n,d)===d&&this.learn()}async validate(){const l=P.Y.getCorrelationContext(),e=await this.ensureSession(!1);if(e==null){this.changeSubscription(this._subscription);return}try{await this.checkInAndValidate(e)}catch(r){P.Y.error(r,l)}}async checkInAndValidate(l,e=!1){if(!e)return this.checkInAndValidateCore(l);const r=this.checkInAndValidateCore(l);await Promise.race([r,new Promise(i=>setTimeout(()=>i(!0),3e3))])&&await s.window.withProgress({location:s.ProgressLocation.Notification,title:"Validating your GitLens+ account..."},()=>r)}async checkInAndValidateCore(l){var e,r;const t=P.Y.getCorrelationContext();try{const i={id:l.account.id,platform:(0,X.Xf)(),gitlensVersion:this.container.version,vscodeEdition:s.env.appName,vscodeHost:s.env.appHost,vscodeVersion:s.version,previewStartedOn:(e=this._subscription.previewTrial)==null?void 0:e.startedOn,previewExpiresOn:(r=this._subscription.previewTrial)==null?void 0:r.expiresOn},n=await(0,Wn.h)(s.Uri.joinPath(this.baseApiUri,"gitlens/checkin").toString(),{method:"POST",agent:(0,Wn.N)(),headers:{Authorization:`Bearer ${l.accessToken}`,"User-Agent":ka,"Content-Type":"application/json"},body:JSON.stringify(i)});if(!n.ok)throw new b.dt("Unable to validate account",void 0,n.status,n.statusText);const d=await n.json();this.validateSubscription(d),this._lastCheckInDate=new Date}catch(i){throw P.Y.error(i,t),i instanceof b.dt?i:new b.dt("Unable to validate account",i)}finally{this.startDailyValidationTimer()}}startDailyValidationTimer(){this._validationTimer!=null&&clearInterval(this._validationTimer),this._validationTimer=setInterval(()=>{(this._lastCheckInDate==null||this._lastCheckInDate.getDate()!==new Date().getDate())&&this.ensureSession(!1,!0)},1e3*60*60*6)}validateSubscription(l){const e={id:l.user.id,name:l.user.name,email:l.user.email,verified:l.user.status==="activated"},r=Object.entries(l.licenses.effectiveLicenses),t=Object.entries(l.licenses.paidLicenses);let i;if(t.length>0){t.sort((D,M)=>wo(M[1].latestStatus)-wo(D[1].latestStatus)||(0,wi.kU)(Gn(M[0]))-(0,wi.kU)(Gn(D[0])));const[d,h]=t[0];i=(0,wi.fV)(Gn(d),new Date(h.latestStartDate),new Date(h.latestEndDate))}i==null&&(i=(0,wi.fV)(wi.Cx.FreePlus,l.user.firstGitLensCheckIn!=null?new Date(l.user.firstGitLensCheckIn):void 0));let n;if(r.length>0){r.sort((D,M)=>wo(M[1].latestStatus)-wo(D[1].latestStatus)||(0,wi.kU)(Gn(M[0]))-(0,wi.kU)(Gn(D[0])));const[d,h]=r[0];n=(0,wi.fV)(Gn(d),new Date(h.latestStartDate),new Date(h.latestEndDate))}n==null&&(n=Ho({},i)),this.changeSubscription(jo(Ho({},this._subscription),{plan:{actual:i,effective:n},account:e}))}async ensureSession(l,e){return this._sessionPromise!=null&&this._session===void 0&&await this._sessionPromise,!e&&this._session!=null?this._session:this._session===null&&!l?void 0:(this._sessionPromise===void 0&&(this._sessionPromise=this.getOrCreateSession(l).then(t=>(this._session=t,this._sessionPromise=void 0,this._session),()=>(this._session=null,this._sessionPromise=void 0,this._session))),await this._sessionPromise??void 0)}async getOrCreateSession(l){const e=P.Y.getCorrelationContext();let r;try{r=await s.authentication.getSession(Ln.authenticationProviderId,Ln.authenticationScopes,{createIfNone:l,silent:!l})}catch(t){if(r=null,t instanceof Error&&t.message.includes("User did not consent"))return await this.logout(),null;P.Y.error(t,e)}if(r===void 0&&(r=await this.container.subscriptionAuthentication.tryMigrateSession()),r==null)return await this.logout(),r??null;try{await this.checkInAndValidate(r,l)}catch(t){P.Y.error(t,e);const i=r.account.label;if(r=null,t instanceof b.dt)if(t.statusCode==null||t.statusCode<500){if(await this.logout(),l){const n=t.statusCode===401;queueMicrotask(async()=>{const d={title:"Retry Sign In"};await s.window.showErrorMessage(`Unable to sign in to your (${i}) GitLens+ account. Please try again. If this issue persists, please contact support.${n?"":` Error=${t.message}`}`,d)===d&&this.loginOrSignUp()})}}else s.window.showErrorMessage(`Unable to sign in to your (${i}) GitLens+ account right now. Please try again in a few minutes. If this issue persists, please contact support. Error=${t.message}`,"OK")}return r}changeSubscription(l,e=!1){l==null&&(l={plan:{actual:(0,wi.fV)(wi.Cx.Free),effective:(0,wi.fV)(wi.Cx.Free)},account:void 0,state:wi.jc.Free}),l.plan.effective.id===wi.Cx.Free&&l.previewTrial!=null&&((0,wi.EE)(l.previewTrial.expiresOn)??0)>0&&(l.plan.effective=(0,wi.fV)(wi.Cx.Pro,new Date(l.previewTrial.startedOn),new Date(l.previewTrial.expiresOn))),(0,wi.Z1)(l)&&(l.plan.effective=l.plan.actual),l.state=(0,wi.RE)(l);const r=this._subscription;r!=null&&JSON.stringify(r)===JSON.stringify(l)||(this.storeSubscription(l),this._subscription=l,this._etag=Date.now(),this.updateContext(),!e&&r!=null&&this._onDidChange.fire({current:l,previous:r,etag:this._etag}))}getStoredSubscription(){const l=this.container.storage.get(er.BU.Subscription),e=l?.data;return e!=null&&(e.plan.actual.name=(0,wi.tL)(e.plan.actual.id),e.plan.effective.name=(0,wi.tL)(e.plan.effective.id)),e}async storeSubscription(l){return this.container.storage.store(er.BU.Subscription,{v:1,data:l})}updateContext(){this.updateStatusBar(),queueMicrotask(async()=>{const{allowed:r,subscription:t}=await this.container.git.access(),i=r?!1:t.required!=null&&(0,wi.aG)(t.required)?"paid":"free+";(0,y.v)(w.zf.PlusAllowed,r),(0,y.v)(w.zf.PlusRequired,i)});const{plan:{actual:l},state:e}=this._subscription;(0,y.v)(w.zf.Plus,l.id!=wi.Cx.Free?l.id:void 0),(0,y.v)(w.zf.PlusState,e)}updateStatusBar(){var l,e;const{account:r,plan:{effective:t}}=this._subscription;if(t.id===wi.Cx.Free){(l=this._statusBarSubscription)==null||l.dispose(),this._statusBarSubscription=void 0;return}const i=(0,wi.dz)(this._subscription);if(!i&&r?.verified!==!1){(e=this._statusBarSubscription)==null||e.dispose(),this._statusBarSubscription=void 0;return}if(this._statusBarSubscription==null&&(this._statusBarSubscription=s.window.createStatusBarItem("gitlens.plus.subscription",s.StatusBarAlignment.Left,1)),this._statusBarSubscription.name="GitLens+ Subscription",this._statusBarSubscription.command=w.Gh.ShowHomeView,r?.verified===!1)this._statusBarSubscription.text=`$(warning) ${t.name} (Unverified)`,this._statusBarSubscription.backgroundColor=new s.ThemeColor("statusBarItem.warningBackground"),this._statusBarSubscription.tooltip=new s.MarkdownString(i?`**Please verify your email** Before you can start your **${t.name}** trial, please verify the email for the account you created. Click for details`:`**Please verify your email** Before you can use GitLens+ features, please verify the email for the account you created. Click for details`,!0);else{const n=(0,wi.PY)(this._subscription,"days");this._statusBarSubscription.text=`${t.name} (Trial)`,this._statusBarSubscription.tooltip=new s.MarkdownString(`You are currently trialing **${t.name}**, which gives you access to GitLens+ features on both public and private repos. You have ${(0,Gt._6)("day",n??0)} remaining in your trial. Click for details`,!0)}this._statusBarSubscription.show()}},"_SubscriptionService");let hr=Ln;Ur(hr,"authenticationProviderId","gitlens+"),Ur(hr,"authenticationScopes",["gitlens"]),pr([(0,jr.H)()],hr.prototype,"baseApiUri",1),pr([(0,jr.H)()],hr.prototype,"baseAccountUri",1),pr([(0,jr.H)()],hr.prototype,"baseSiteUri",1),pr([(0,_.fF)()],hr.prototype,"learn",1),pr([(0,_.cM)()],hr.prototype,"loginOrSignUp",1),pr([(0,_.cM)()],hr.prototype,"logout",1),pr([(0,_.cM)()],hr.prototype,"manage",1),pr([(0,_.cM)()],hr.prototype,"purchase",1),pr([(0,F.H)(),(0,_.cM)()],hr.prototype,"resendVerification",1),pr([(0,_.cM)()],hr.prototype,"showHomeView",1),pr([(0,F.H)(),(0,_.cM)()],hr.prototype,"startPreviewTrial",1),pr([(0,F.H)(),(0,_.cM)()],hr.prototype,"validate",1),pr([(0,_.fF)({args:{0:l=>l?.account.label}})],hr.prototype,"checkInAndValidateCore",1),pr([(0,_.fF)()],hr.prototype,"validateSubscription",1),pr([(0,F.H)(),(0,_.fF)()],hr.prototype,"ensureSession",1),pr([(0,_.fF)()],hr.prototype,"getOrCreateSession",1),pr([(0,_.fF)()],hr.prototype,"changeSubscription",1);function nc(l){}o(nc,"assertSubscriptionState");function Gn(l){switch(l){case"gitlens-pro":case"bundle-pro":return wi.Cx.Pro;case"gitlens-teams":case"bundle-teams":return wi.Cx.Teams;case"gitlens-hosted-enterprise":case"gitlens-self-hosted-enterprise":case"gitlens-standalone-enterprise":case"bundle-hosted-enterprise":case"bundle-self-hosted-enterprise":case"bundle-standalone-enterprise":return wi.Cx.Enterprise;default:return wi.Cx.FreePlus}}o(Gn,"convertLicenseTypeToPlanId");function wo(l){switch(l){case"active":return 100;case"expired":case"cancelled":return-100;case"in_trial":case"trial":return 1;case"canceled":case"non_renewing":return 0}}o(wo,"licenseStatusPriority");var Yo=Object.defineProperty,Ua=o((l,e,r)=>e in l?Yo(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"protocol_defNormalProp"),Wa=o((l,e,r)=>(Ua(l,typeof e!="symbol"?e+"":e,r),r),"protocol_publicField");class ea{constructor(e){this.method=e,Wa(this,"_")}}o(ea,"IpcMessageType");class $r extends ea{}o($r,"IpcCommandType");class Rn extends ea{}o(Rn,"IpcNotificationType");function vr(l,e,r){l.method===e.method&&r(e.params)}o(vr,"onIpc");const bo=new $r("webview/ready"),Ir=new $r("command/execute"),Vn=new $r("configuration/preview"),La=new $r("configuration/update"),Ga=new Rn("configuration/didChange"),Va=new Rn("configuration/didPreview"),ta=new Rn("webview/didOpenAnchor");var Cs=g(1347),Ko=Object.defineProperty,Ha=o((l,e,r)=>e in l?Ko(l,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):l[e]=r,"webviewBase_defNormalProp"),yo=o((l,e,r)=>(Ha(l,typeof e!="symbol"?e+"":e,r),r),"webviewBase_publicField");const Tl=2**30;let zo=0;function Co(){return zo===Tl?zo=1:zo++,`host:${zo}`}o(Co,"nextIpcId");class Ps{constructor(e,r,t,i,n,d){this.container=e,this.id=r,this.fileName=t,this.iconPath=i,yo(this,"disposables",[]),yo(this,"isReady",!1),yo(this,"_disposablePanel"),yo(this,"_panel"),yo(this,"_title"),this._title=n,this.disposables.push(s.commands.registerCommand(d,this.onShowCommand,this))}dispose(){var e;this.disposables.forEach(r=>r.dispose()),(e=this._disposablePanel)==null||e.dispose()}get title(){var e;return((e=this._panel)==null?void 0:e.title)??this._title}set title(e){this._title=e,this._panel!=null&&(this._panel.title=e)}get visible(){var e;return((e=this._panel)==null?void 0:e.visible)??!1}hide(){var e;(e=this._panel)==null||e.dispose()}async show(e=s.ViewColumn.Beside){var r,t;if(this._panel==null)this._panel=s.window.createWebviewPanel(this.id,this._title,{viewColumn:e,preserveFocus:!1},{retainContextWhenHidden:!0,enableFindWidget:!0,enableCommandUris:!0,enableScripts:!0}),this._panel.iconPath=s.Uri.file(this.container.context.asAbsolutePath(this.iconPath)),this._disposablePanel=s.Disposable.from(this._panel,this._panel.onDidDispose(this.onPanelDisposed,this),this._panel.onDidChangeViewState(this.onViewStateChanged,this),this._panel.webview.onDidReceiveMessage(this.onMessageReceivedCore,this),...((r=this.onInitializing)==null?void 0:r.call(this))??[],...((t=this.registerCommands)==null?void 0:t.call(this))??[]),this._panel.webview.html=await this.getHtml(this._panel.webview);else{const i=await this.getHtml(this._panel.webview);this._panel.webview.html="",this._panel.webview.html=i,this._panel.reveal(this._panel.viewColumn??s.ViewColumn.Active,!1)}}async refresh(){this._panel!=null&&(this._panel.webview.html=await this.getHtml(this._panel.webview))}onPanelDisposed(){var e,r,t;(e=this.onVisibilityChanged)==null||e.call(this,!1),(r=this.onFocusChanged)==null||r.call(this,!1),(t=this._disposablePanel)==null||t.dispose(),this._disposablePanel=void 0,this._panel=void 0}onShowCommand(){this.show()}onViewStateChanged(e){var r,t;P.Y.debug(`Webview(${this.id}).onViewStateChanged`,`active=${e.webviewPanel.active}, visible=${e.webviewPanel.visible}`),(r=this.onVisibilityChanged)==null||r.call(this,e.webviewPanel.visible),(t=this.onFocusChanged)==null||t.call(this,e.webviewPanel.active)}onMessageReceivedCore(e){var r;if(e!=null)switch(P.Y.debug(`Webview(${this.id}).onMessageReceived: method=${e.method}`),e.method){case bo.method:vr(bo,e,()=>{var t;this.isReady=!0,(t=this.onReady)==null||t.call(this)});break;case Ir.method:vr(Ir,e,t=>{t.args!=null?(0,hi.P0)(t.command,...t.args):(0,hi.P0)(t.command)});break;default:(r=this.onMessageReceived)==null||r.call(this,e);break}}async getHtml(e){var r,t,i,n;const d=s.Uri.joinPath(this.container.context.extensionUri,"dist","webviews"),h=s.Uri.joinPath(d,this.fileName),D=new TextDecoder("utf8").decode(await s.workspace.fs.readFile(h)),[M,le,be,Ee]=await Promise.all([(r=this.includeBootstrap)==null?void 0:r.call(this),(t=this.includeHead)==null?void 0:t.call(this),(i=this.includeBody)==null?void 0:i.call(this),(n=this.includeEndOfBody)==null?void 0:n.call(this)]),xe=e.cspSource,Ue=(0,Cs.V)(),st=e.asWebviewUri(this.container.context.extensionUri).toString(),He=e.asWebviewUri(d).toString();return D.replace(/#{(head|body|endOfBody)}/i,(Et,Wt)=>{switch(Wt){case"head":return le??"";case"body":return be??"";case"endOfBody":return M!=null?`