var Dd=Object.defineProperty;var n=(jc,Yc)=>Dd(jc,"name",{value:Yc,configurable:!0});(()=>{var jc={8054:function(Se,ae,v){"use strict";var r=this&&this.__importDefault||function(U){return U&&U.__esModule?U:{default:U}};const B=v(2361),_=r(v(5158)),R=r(v(6304)),b=_.default("agent-base");function p(U){return Boolean(U)&&typeof U.addRequest=="function"}n(p,"isAgent");function M(){const{stack:U}=new Error;return typeof U!="string"?!1:U.split(` `).some(O=>O.indexOf("(https.js:")!==-1||O.indexOf("node:https:")!==-1)}n(M,"isSecureEndpoint");function z(U,O){return new z.Agent(U,O)}n(z,"createAgent"),function(U){class O extends B.EventEmitter{constructor(y,V){super();let I=V;typeof y=="function"?this.callback=y:y&&(I=y),this.timeout=null,I&&typeof I.timeout=="number"&&(this.timeout=I.timeout),this.maxFreeSockets=1,this.maxSockets=1,this.maxTotalSockets=1/0,this.sockets={},this.freeSockets={},this.requests={},this.options={}}get defaultPort(){return typeof this.explicitDefaultPort=="number"?this.explicitDefaultPort:M()?443:80}set defaultPort(y){this.explicitDefaultPort=y}get protocol(){return typeof this.explicitProtocol=="string"?this.explicitProtocol:M()?"https:":"http:"}set protocol(y){this.explicitProtocol=y}callback(y,V,I){throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(y,V){const I=Object.assign({},V);typeof I.secureEndpoint!="boolean"&&(I.secureEndpoint=M()),I.host==null&&(I.host="localhost"),I.port==null&&(I.port=I.secureEndpoint?443:80),I.protocol==null&&(I.protocol=I.secureEndpoint?"https:":"http:"),I.host&&I.path&&delete I.path,delete I.agent,delete I.hostname,delete I._defaultAgent,delete I.defaultPort,delete I.createConnection,y._last=!0,y.shouldKeepAlive=!1;let Y=!1,D=null;const x=I.timeout||this.timeout,L=n(N=>{y._hadError||(y.emit("error",N),y._hadError=!0)},"onerror"),h=n(()=>{D=null,Y=!0;const N=new Error(`A "socket" was not created for HTTP request before ${x}ms`);N.code="ETIMEOUT",L(N)},"ontimeout"),E=n(N=>{Y||(D!==null&&(clearTimeout(D),D=null),L(N))},"callbackError"),T=n(N=>{if(Y)return;if(D!=null&&(clearTimeout(D),D=null),p(N)){b("Callback returned another Agent instance %o",N.constructor.name),N.addRequest(y,I);return}if(N){N.once("free",()=>{this.freeSocket(N,I)}),y.onSocket(N);return}const j=new Error(`no Duplex stream was returned to agent-base for \`${y.method} ${y.path}\``);L(j)},"onsocket");if(typeof this.callback!="function"){L(new Error("`callback` is not defined"));return}this.promisifiedCallback||(this.callback.length>=3?(b("Converting legacy callback function to promise"),this.promisifiedCallback=R.default(this.callback)):this.promisifiedCallback=this.callback),typeof x=="number"&&x>0&&(D=setTimeout(h,x)),"port"in I&&typeof I.port!="number"&&(I.port=Number(I.port));try{b("Resolving socket for %o request: %o",I.protocol,`${y.method} ${y.path}`),Promise.resolve(this.promisifiedCallback(y,I)).then(T,E)}catch(N){Promise.reject(N).catch(E)}}freeSocket(y,V){b("Freeing socket %o %o",y.constructor.name,V),y.destroy()}destroy(){b("Destroying agent %o",this.constructor.name)}}n(O,"Agent"),U.Agent=O,U.prototype=U.Agent.prototype}(z||(z={})),Se.exports=z},6304:(Se,ae)=>{"use strict";Object.defineProperty(ae,"__esModule",{value:!0});function v(r){return function(B,_){return new Promise((R,b)=>{r.call(this,B,_,(p,M)=>{p?b(p):R(M)})})}}n(v,"promisify"),ae.default=v},1227:(Se,ae,v)=>{ae.formatArgs=B,ae.save=_,ae.load=R,ae.useColors=r,ae.storage=b(),ae.destroy=(()=>{let M=!1;return()=>{M||(M=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),ae.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}n(r,"useColors");function B(M){if(M[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+M[0]+(this.useColors?"%c ":" ")+"+"+Se.exports.humanize(this.diff),!this.useColors)return;const z="color: "+this.color;M.splice(1,0,z,"color: inherit");let U=0,O=0;M[0].replace(/%[a-zA-Z%]/g,F=>{F!=="%%"&&(U++,F==="%c"&&(O=U))}),M.splice(O,0,z)}n(B,"formatArgs"),ae.log=console.debug||console.log||(()=>{});function _(M){try{M?ae.storage.setItem("debug",M):ae.storage.removeItem("debug")}catch{}}n(_,"save");function R(){let M;try{M=ae.storage.getItem("debug")}catch{}return!M&&typeof process<"u"&&"env"in process&&(M=process.env.DEBUG),M}n(R,"load");function b(){try{return localStorage}catch{}}n(b,"localstorage"),Se.exports=v(2447)(ae);const{formatters:p}=Se.exports;p.j=function(M){try{return JSON.stringify(M)}catch(z){return"[UnexpectedJSONParseError]: "+z.message}}},2447:(Se,ae,v)=>{function r(B){R.debug=R,R.default=R,R.coerce=O,R.disable=M,R.enable=p,R.enabled=z,R.humanize=v(7824),R.destroy=F,Object.keys(B).forEach(y=>{R[y]=B[y]}),R.names=[],R.skips=[],R.formatters={};function _(y){let V=0;for(let I=0;I{if($==="%%")return"%";N++;const k=R.formatters[A];if(typeof k=="function"){const te=L[N];$=k.call(h,te),L.splice(N,1),N--}return $}),R.formatArgs.call(h,L),(h.log||R.log).apply(h,L)}return n(x,"debug"),x.namespace=y,x.useColors=R.useColors(),x.color=R.selectColor(y),x.extend=b,x.destroy=R.destroy,Object.defineProperty(x,"enabled",{enumerable:!0,configurable:!1,get:()=>I!==null?I:(Y!==R.namespaces&&(Y=R.namespaces,D=R.enabled(y)),D),set:L=>{I=L}}),typeof R.init=="function"&&R.init(x),x}n(R,"createDebug");function b(y,V){const I=R(this.namespace+(typeof V>"u"?":":V)+y);return I.log=this.log,I}n(b,"extend");function p(y){R.save(y),R.namespaces=y,R.names=[],R.skips=[];let V;const I=(typeof y=="string"?y:"").split(/[\s,]+/),Y=I.length;for(V=0;V"-"+V)].join(",");return R.enable(""),y}n(M,"disable");function z(y){if(y[y.length-1]==="*")return!0;let V,I;for(V=0,I=R.skips.length;V{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?Se.exports=v(1227):Se.exports=v(39)},39:(Se,ae,v)=>{const r=v(6224),B=v(3837);ae.init=U,ae.log=p,ae.formatArgs=R,ae.save=M,ae.load=z,ae.useColors=_,ae.destroy=B.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),ae.colors=[6,2,3,4,5,1];try{const F=v(2130);F&&(F.stderr||F).level>=2&&(ae.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}ae.inspectOpts=Object.keys(process.env).filter(F=>/^debug_/i.test(F)).reduce((F,y)=>{const V=y.substring(6).toLowerCase().replace(/_([a-z])/g,(Y,D)=>D.toUpperCase());let I=process.env[y];return/^(yes|on|true|enabled)$/i.test(I)?I=!0:/^(no|off|false|disabled)$/i.test(I)?I=!1:I==="null"?I=null:I=Number(I),F[V]=I,F},{});function _(){return"colors"in ae.inspectOpts?Boolean(ae.inspectOpts.colors):r.isatty(process.stderr.fd)}n(_,"useColors");function R(F){const{namespace:y,useColors:V}=this;if(V){const I=this.color,Y="\x1B[3"+(I<8?I:"8;5;"+I),D=` ${Y};1m${y} \x1B[0m`;F[0]=D+F[0].split(` `).join(` `+D),F.push(Y+"m+"+Se.exports.humanize(this.diff)+"\x1B[0m")}else F[0]=b()+y+" "+F[0]}n(R,"formatArgs");function b(){return ae.inspectOpts.hideDate?"":new Date().toISOString()+" "}n(b,"getDate");function p(...F){return process.stderr.write(B.format(...F)+` `)}n(p,"log");function M(F){F?process.env.DEBUG=F:delete process.env.DEBUG}n(M,"save");function z(){return process.env.DEBUG}n(z,"load");function U(F){F.inspectOpts={};const y=Object.keys(ae.inspectOpts);for(let V=0;Vy.trim()).join(" ")},O.O=function(F){return this.inspectOpts.colors=this.useColors,B.inspect(F,this.inspectOpts)}},5647:(Se,ae,v)=>{"use strict";v.d(ae,{AR:()=>te,vj:()=>T});var r=v(9496),B=v.n(r),_=v(9179),R=v(1045),b=v(313),p=v(2971),M=v(320),z=Object.defineProperty,U=Object.defineProperties,O=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable,I=n((Q,K,Z)=>K in Q?z(Q,K,{enumerable:!0,configurable:!0,writable:!0,value:Z}):Q[K]=Z,"__defNormalProp"),Y=n((Q,K)=>{for(var Z in K||(K={}))y.call(K,Z)&&I(Q,Z,K[Z]);if(F)for(var Z of F(K))V.call(K,Z)&&I(Q,Z,K[Z]);return Q},"__spreadValues"),D=n((Q,K)=>U(Q,O(K)),"__spreadProps"),x=n((Q,K,Z)=>(I(Q,typeof K!="symbol"?K+"":K,Z),Z),"__publicField");const L=2**30,h=["createPullRequest","openPullRequest","hover.commands"];var E=(Q=>(Q[Q.BuiltIn=0]="BuiltIn",Q[Q.BuiltInPartner=1]="BuiltInPartner",Q[Q.Partner=2]="Partner",Q[Q.BuiltInPartnerInstaller=3]="BuiltInPartnerInstaller",Q))(E||{});const T="Built In";class N{constructor(K,Z){this.runner=K,x(this,"_label"),this._label=typeof K.label=="string"?K.label:K.label(Z)}get label(){return this._label}get detail(){return this.runner.name}}n(N,"ActionRunnerQuickPickItem");class j{constructor(){x(this,"runner")}get label(){return"No actions were found"}get detail(){}}n(j,"NoActionRunnersQuickPickItem");let $=0;function A(){return $===L?$=1:$++,$}n(A,"nextRunnerId");class k{constructor(K,Z,ie){this.type=K,this.runner=Z,this.unregister=ie,x(this,"id"),this.id=A()}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(K){return this.runner.run(K)}}n(k,"RegisteredActionRunner");class te{constructor(K){this.container=K,x(this,"_onDidChange",new r.EventEmitter),x(this,"_actionRunners",new Map),x(this,"_disposable");const Z=[_.DN.onDidChange(ie=>{!_.DN.changed(ie,"partners")||this._updateAllContextKeys()})];for(const ie of h)Z.push(r.commands.registerCommand(`${R.Gh.ActionPrefix}${ie}`,(ne,ge)=>this.run(ne,ge)));this._disposable=r.Disposable.from(...Z)}get onDidChange(){return this._onDidChange.event}dispose(){this._disposable.dispose();for(const K of this._actionRunners.values())for(const Z of K)Z.dispose();this._actionRunners.clear()}count(K){var Z;return((Z=this.get(K))==null?void 0:Z.length)??0}get(K){return ce(this.container.config,this._actionRunners.get(K))}has(K){return this.count(K)>0}register(K,Z,ie=2){let ne=this._actionRunners.get(K);ne==null&&(ne=[],this._actionRunners.set(K,ne));const ge=n(Fe=>{this._updateContextKeys(Fe),this._onDidChange.fire(Fe)},"onChanged"),q=this._actionRunners,we=new k(ie,Z,function(){if(ne.length===1)q.delete(K),ge(K);else{const Fe=ne.indexOf(this);Fe!==-1&&ne.splice(Fe,1)}});return ne.push(we),ge(K),{dispose:()=>we.dispose()}}registerBuiltIn(K,Z){return this.register(K,D(Y({},Z),{partnerId:void 0,name:T}),0)}registerBuiltInPartner(K,Z,ie){return this.register(Z,D(Y({},ie),{partnerId:K}),1)}registerBuiltInPartnerInstaller(K,Z,ie){return this.register(Z,D(Y({},ie),{partnerId:K,name:`${ie.name} (Not Installed)`}),3)}async run(K,Z){let ie=this.get(K.type);if(ie==null||ie.length===0||(Z!=null&&(ie=ie.filter(ge=>ge.id===Z)),ie.length===0))return;let ne;if(ie.length>1||ie.every(ge=>ge.type!==0)){const ge=ie.sort((Fe,Ge)=>Fe.order-Ge.order||(0,p.dm)(Fe.name,Ge.name)).map(Fe=>new N(Fe,K));ge.length===0&&ge.push(new j);const q=r.window.createQuickPick();q.ignoreFocusOut=(0,M.hE)();const we=[];try{const Fe=await new Promise(Ge=>{we.push(q.onDidHide(()=>Ge(void 0)),q.onDidAccept(()=>{q.activeItems.length!==0&&Ge(q.activeItems[0])}));let tt,Me;switch(K.type){case"createPullRequest":tt="Create Pull Request",Me="Choose how to create a pull request";break;case"openPullRequest":tt="Open Pull Request",Me="Choose how to open the pull request";break;case"hover.commands":tt="Need Help or Want to Collaborate?",Me="Choose what you would like to do";break;default:break}q.title=tt,q.placeholder=Me,q.matchOnDetail=!0,q.items=ge,q.show()});if(Fe==null)return;ne=Fe.runner}finally{q.dispose(),we.forEach(Fe=>Fe.dispose())}}else[ne]=ie;await ne?.run(K)}async _updateContextKeys(K){await(0,b.v)(`${R.zf.ActionPrefix}${K}`,this.count(K))}async _updateAllContextKeys(){for(const K of h)await this._updateContextKeys(K)}}n(te,"ActionRunners");function ce(Q,K){if(K==null||K.length===0)return;const Z=Q.partners;return Z==null?K:K.filter(ie=>{var ne;return ie.partnerId==null||ie.partnerId!=null&&((ne=Z[ie.partnerId])==null?void 0:ne.enabled)!==!1})}n(ce,"filterOnlyEnabledRunners")},1505:(Se,ae,v)=>{"use strict";v.d(ae,{E3:()=>we,OV:()=>x,TU:()=>q,oP:()=>te});var r=v(9496),B=v.n(r),_=v(2078),R=v(7778),b=v(6410),p=v(9510),M=v(2886),z=v(2971),U=Object.defineProperty,O=Object.getOwnPropertySymbols,F=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,V=n((Fe,Ge,tt)=>Ge in Fe?U(Fe,Ge,{enumerable:!0,configurable:!0,writable:!0,value:tt}):Fe[Ge]=tt,"__defNormalProp"),I=n((Fe,Ge)=>{for(var tt in Ge||(Ge={}))F.call(Ge,tt)&&V(Fe,tt,Ge[tt]);if(O)for(var tt of O(Ge))y.call(Ge,tt)&&V(Fe,tt,Ge[tt]);return Fe},"__spreadValues");const Y=2**30,D=new r.EventEmitter;D.event((0,p.Ds)(()=>{const Fe=L!=null?[...(0,M.DZ)(L,([Ge,tt])=>tt.uri!=null?[Ge,{uri:tt.uri.toString(),timestamp:tt.timestamp}]:void 0)]:void 0;R.W.instance.storage.store(b.BU.Avatars,Fe)},1e3));var x;(Fe=>{Fe.onDidFetch=D.event})(x||(x={}));let L;const h=new Map,E="00000000000000000000000000000000",T=new Map,N=/^(?:(?\d+)\+)?(?[a-zA-Z\d-]{1,39})@users\.noreply\.github\.com$/,j=60*1e3,$=60*60*1e3,A=24*60*60*1e3,k=[A*7,j,j*5,j*10,$,A,A*7];function te(Fe,Ge,{defaultStyle:tt,size:Me=16}={}){if(Q(L),Me*=2,!Fe){const rt=ce(`${E}:${Me}`,void 0,Me,E,tt);return rt.uri??rt.fallback}const Ne=(0,z.FB)(Fe.trim().toLowerCase(),"hex"),Ue=`${Ne}:${Me}`,Ze=ce(Ue,Fe,Me,Ne,tt);if(Ze.uri!=null)return Ze.uri;let it=h.get(Ue);return it==null&&Ge!=null&&K(Ze)&&(it=ne(Ze,Ue,Fe,Ge,{size:Me}).then(rt=>rt??Ze.uri??Ze.fallback),h.set(Ue,it.finally(()=>h.delete(Ue)))),it??Ze.uri??Ze.fallback}n(te,"getAvatarUri");function ce(Fe,Ge,tt,Me,Ne){let Ue=L.get(Fe);return Ue==null?(Ue={uri:Ge!=null&&Ge.length!==0?ie(Ge,tt):void 0,fallback:Z(Me,tt,Ne),timestamp:0,retries:0},L.set(Fe,Ue)):Ue.fallback==null&&(Ue.fallback=Z(Me,tt,Ne)),Ue}n(ce,"createOrUpdateAvatar");function Q(Fe){var Ge;if(Fe==null){const tt=(Ge=R.W.instance.storage.get(b.BU.Avatars))==null?void 0:Ge.map(([Me,Ne])=>[Me,{uri:r.Uri.parse(Ne.uri),timestamp:Ne.timestamp,retries:0}]);L=new Map(tt)}}n(Q,"ensureAvatarCache");function K(Fe){return Date.now()>=Fe.timestamp+k[Math.min(Fe.retries,k.length-1)]}n(K,"hasAvatarExpired");function Z(Fe,Ge,tt=_.il.Robot){return r.Uri.parse(`https://www.gravatar.com/avatar/${Fe}?s=${Ge}&d=${tt}`)}n(Z,"getAvatarUriFromGravatar");function ie(Fe,Ge=16){const tt=N.exec(Fe);if(tt==null)return;const[,Me,Ne]=tt;return r.Uri.parse(`https://avatars.githubusercontent.com/${Me?`u/${Me}`:Ne}?size=${Ge}`)}n(ie,"getAvatarUriFromGitHubNoReplyAddress");async function ne(Fe,Ge,tt,Me,{size:Ne=16}={}){Q(L);try{let Ue;if(R.W.instance.config.integrations.enabled&&typeof Me!="string"){const Ze=await R.W.instance.git.getRichRemoteProvider(Me.repoPath);Ue=await Ze?.provider.getAccountForCommit(Me.ref,{avatarSize:Ne})}if(Ue==null){Fe.uri=void 0,Fe.timestamp=Y,Fe.retries=0;return}return Fe.uri=r.Uri.parse(Ue.avatarUrl),Fe.timestamp=Date.now(),Fe.retries=0,Ue.email!=null&&(0,z.qq)(tt,Ue.email)&&L.set(`${(0,z.FB)(Ue.email.trim().toLowerCase(),"hex")}:${Ne}`,I({},Fe)),D.fire({email:tt}),Fe.uri}catch{Fe.uri=void 0,Fe.timestamp=Date.now(),Fe.retries++;return}}n(ne,"getAvatarUriFromRemoteProvider");const ge=new Map([["online","#28ca42"],["away","#cecece"],["busy","#ca5628"],["dnd","#ca5628"],["offline","#cecece"]]);function q(Fe){let Ge=T.get(Fe);if(Ge==null){const tt=(0,z.US)(` `);Ge=encodeURI(`data:image/svg+xml;base64,${tt}`),T.set(Fe,Ge)}return Ge}n(q,"getPresenceDataUri");function we(Fe){switch(Fe){case"all":R.W.instance.storage.delete(b.BU.Avatars),L?.clear(),h.clear();break;case"failed":for(const Ge of L?.values()??[])Ge.uri==null&&(Ge.timestamp=0,Ge.retries=0);break;case"fallback":for(const Ge of L?.values()??[])Ge.fallback=void 0;break}}n(we,"resetAvatarCache")},9850:(Se,ae,v)=>{"use strict";v.d(ae,{tM:()=>fn,V:()=>ki,_f:()=>la,DA:()=>Hi,oc:()=>qn,MZ:()=>$c});var r=v(1045),B=v(1161),_=v(6983),R=v(5387),b=Object.defineProperty,p=Object.getOwnPropertyDescriptor,M=n((l,u,f,H)=>{for(var C=H>1?void 0:H?p(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&b(u,f,C),C},"__decorateClass");let z=n(class extends _.mY{constructor(l){super(r.Gh.AddAuthors);this.container=l}execute(l){let u;return l?.rootUri!=null&&(u=this.container.git.getRepository(l.rootUri)),(0,R.m)({command:"co-authors",state:{repo:u,contributors:void 0}})}},"AddAuthorsCommand");z=M([(0,B.WD)()],z);var U=v(2324),O=v(2436),F=v(1999),y=v(516),V=v(320),I=Object.defineProperty,Y=Object.defineProperties,D=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,h=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable,T=n((l,u,f)=>u in l?I(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"__defNormalProp"),N=n((l,u)=>{for(var f in u||(u={}))h.call(u,f)&&T(l,f,u[f]);if(L)for(var f of L(u))E.call(u,f)&&T(l,f,u[f]);return l},"__spreadValues"),j=n((l,u)=>Y(l,x(u)),"__spreadProps"),$=n((l,u,f,H)=>{for(var C=H>1?void 0:H?D(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&I(u,f,C),C},"browseRepoAtRevision_decorateClass");let A=n(class extends _.pu{constructor(l){super([r.Gh.BrowseRepoAtRevision,r.Gh.BrowseRepoAtRevisionInNewWindow,r.Gh.BrowseRepoBeforeRevision,r.Gh.BrowseRepoBeforeRevisionInNewWindow]);this.container=l}preExecute(l,u){switch(l.command){case r.Gh.BrowseRepoAtRevisionInNewWindow:u=j(N({},u),{before:!1,openInNewWindow:!0});break;case r.Gh.BrowseRepoBeforeRevision:u=j(N({},u),{before:!0,openInNewWindow:!1});break;case r.Gh.BrowseRepoBeforeRevisionInNewWindow:u=j(N({},u),{before:!0,openInNewWindow:!0});break}return this.execute(l.editor,l.uri,u)}async execute(l,u,f){f=N({},f);try{if(f.uri==null){if(u=(0,_.SX)(u,l),u==null)return}else u=f.uri;let H=await U.YY.fromUri(u);if(H.sha==null)return;const C=f?.before?await this.container.git.resolveReference(H.repoPath,`${H.sha}^`):H.sha;u=this.container.git.getRevisionUri(C,H.repoPath,H.repoPath),H=U.YY.fromRevisionUri(u),(0,V.ic)(u,{location:f.openInNewWindow?V.Tc.NewWindow:V.Tc.AddToWorkspace,name:`${(0,y.EZ)(H.repoPath)} @ ${H.shortSha}`}),f.openInNewWindow||(0,B.dO)(r.nA.FocusFilesExplorer)}catch(H){O.Y.error(H,"BrowseRepoAtRevisionCommand"),F.V.showGenericErrorMessage("Unable to open the repository at the specified revision")}}},"BrowseRepoAtRevisionCommand");A=$([(0,B.WD)()],A);var k=v(9496),te=v(5078),ce=v(8690),Q=v(9510),K=Object.defineProperty,Z=Object.getOwnPropertyDescriptor,ie=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,q=n((l,u,f)=>u in l?K(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"closeUnchangedFiles_defNormalProp"),we=n((l,u)=>{for(var f in u||(u={}))ne.call(u,f)&&q(l,f,u[f]);if(ie)for(var f of ie(u))ge.call(u,f)&&q(l,f,u[f]);return l},"closeUnchangedFiles_spreadValues"),Fe=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Z(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&K(u,f,C),C},"closeUnchangedFiles_decorateClass"),Ge=n((l,u,f)=>(q(l,typeof u!="symbol"?u+"":u,f),f),"__publicField");let tt=n(class extends _.mY{constructor(l){super(r.Gh.CloseUnchangedFiles);this.container=l,Ge(this,"_onEditorChangedFn")}async execute(l){l=we({},l);try{if(l.uris==null){const ee=await ce.I.getRepositoryOrShow("Close All Unchanged Files");if(ee==null)return;const ft=await this.container.git.getStatusForRepo(ee.uri);if(ft==null){k.window.showWarningMessage("Unable to close unchanged files");return}l.uris=ft.files.map(kt=>kt.uri)}if(l.uris.length===0){(0,B.dO)(r.nA.CloseAllEditors);return}const u=k.window.onDidChangeActiveTextEditor((0,Q.Ds)(ee=>{var ft;return(ft=this._onEditorChangedFn)==null?void 0:ft.call(this,ee)},50));let f=k.window.activeTextEditor,H=0,C=0;const J=[];for(;;){if(f!=null){let ee=!1;for(const ft of J)if(te.o.equals(ft,f,{usePosition:!0})){ee=!0;break}if(ee)break;H++,J.push(f)}else H!==0&&H++;if(f=await this.nextEditor(),C++,C>=4&&J.length===0)break}if(J.length){f=k.window.activeTextEditor;for(let ee=0;ee<=H;ee++)f==null||f.document.isDirty||l.uris.some(ft=>te.n.equals(ft,f?.document.uri))?f=await this.nextEditor():f=await this.closeEditor()}u.dispose()}catch(u){O.Y.error(u,"CloseUnchangedFilesCommand"),F.V.showGenericErrorMessage("Unable to close all unchanged files")}}async closeEditor(l=500){const u=k.window.activeTextEditor;return await(0,B.dO)(r.nA.CloseActiveEditor),u!==k.window.activeTextEditor?k.window.activeTextEditor:this.waitForEditorChange(l)}async nextEditor(l=500){const u=k.window.activeTextEditor;return await(0,B.dO)(r.nA.NextEditor),u!==k.window.activeTextEditor?k.window.activeTextEditor:this.waitForEditorChange(l)}waitForEditorChange(l=500){return new Promise(u=>{let f;this._onEditorChangedFn=H=>{f!=null&&(clearTimeout(f),f=void 0,u(H))},f=setTimeout(()=>{f=void 0,u(k.window.activeTextEditor)},l)})}},"CloseUnchangedFilesCommand");tt=Fe([(0,B.WD)()],tt);var Me=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,Ue=Object.getOwnPropertySymbols,Ze=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable,rt=n((l,u,f)=>u in l?Me(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"compareWith_defNormalProp"),ut=n((l,u)=>{for(var f in u||(u={}))Ze.call(u,f)&&rt(l,f,u[f]);if(Ue)for(var f of Ue(u))it.call(u,f)&&rt(l,f,u[f]);return l},"compareWith_spreadValues"),xt=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Ne(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Me(u,f,C),C},"compareWith_decorateClass");let Ft=n(class extends _.pu{constructor(l){super([r.Gh.CompareWith,r.Gh.CompareHeadWith,r.Gh.CompareWorkingWith,r.Gh.Deprecated_DiffHeadWith,r.Gh.Deprecated_DiffWorkingWith]);this.container=l}preExecute(l,u){switch(l.command){case r.Gh.CompareWith:u=ut({},u);break;case r.Gh.CompareHeadWith:case r.Gh.Deprecated_DiffHeadWith:u=ut({},u),u.ref1="HEAD";break;case r.Gh.CompareWorkingWith:case r.Gh.Deprecated_DiffWorkingWith:u=ut({},u),u.ref1="";break}return this.execute(l.editor,l.uri,u)}async execute(l,u,f){var H;u=(0,_.SX)(u,l),f=ut({},f);try{let C;switch(f.ref1){case null:C="Compare";break;case"":C="Compare Working Tree with";break;case"HEAD":C="Compare HEAD with";break;default:C=`Compare ${f.ref1} with`;break}const J=(H=await ce.I.getBestRepositoryOrShow(u,l,C))==null?void 0:H.path;if(!J)return;f.ref1!=null&&f.ref2!=null?await this.container.searchAndCompareView.compare(J,f.ref1,f.ref2):this.container.searchAndCompareView.selectForCompare(J,f.ref1,{prompt:!0})}catch(C){O.Y.error(C,"CompareWithCommmand"),F.V.showGenericErrorMessage("Unable to open comparison")}}},"CompareWithCommand");Ft=xt([(0,B.WD)()],Ft);var Ee=Object.defineProperty,$e=Object.getOwnPropertyDescriptor,lt=n((l,u,f,H)=>{for(var C=H>1?void 0:H?$e(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Ee(u,f,C),C},"copyCurrentBranch_decorateClass");let ht=n(class extends _.pu{constructor(l){super(r.Gh.CopyCurrentBranch);this.container=l}async execute(l,u){u=(0,_.SX)(u,l);const f=u!=null?await U.YY.fromUri(u):void 0,H=await ce.I.getBestRepositoryOrShow(f,l,"Copy Current Branch Name");if(H!=null)try{const C=await H.getBranch();C?.name&&await k.env.clipboard.writeText(C.name)}catch(C){O.Y.error(C,"CopyCurrentBranchCommand"),k.window.showErrorMessage("Unable to copy current branch name. See output channel for more details")}}},"CopyCurrentBranchCommand");ht=lt([(0,B.WD)()],ht);var St=v(2886),Ut=Object.defineProperty,ri=Object.getOwnPropertyDescriptor,We=Object.getOwnPropertySymbols,le=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,De=n((l,u,f)=>u in l?Ut(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"copyMessageToClipboard_defNormalProp"),Re=n((l,u)=>{for(var f in u||(u={}))le.call(u,f)&&De(l,f,u[f]);if(We)for(var f of We(u))Ae.call(u,f)&&De(l,f,u[f]);return l},"copyMessageToClipboard_spreadValues"),Je=n((l,u,f,H)=>{for(var C=H>1?void 0:H?ri(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Ut(u,f,C),C},"copyMessageToClipboard_decorateClass");let mt=n(class extends _.pu{constructor(l){super(r.Gh.CopyMessageToClipboard);this.container=l}async preExecute(l,u){var f,H;return(0,_.en)(l)?(u=Re({},u),u.sha=l.node.commit.sha,l.node.commit.message!=null&&await l.node.commit.ensureFullDetails(),u.message=l.node.commit.message,this.execute(l.editor,((f=l.node.commit.file)==null?void 0:f.uri)??((H=l.node.commit.getRepository())==null?void 0:H.uri),u)):(0,_.Qo)(l)?(u=Re({},u),u.sha=l.node.branch.sha,this.execute(l.editor,l.node.uri,u)):(0,_._5)(l)?(u=Re({},u),u.sha=l.node.tag.sha,this.execute(l.editor,l.node.uri,u)):this.execute(l.editor,l.uri,u)}async execute(l,u,f){var H;u=(0,_.SX)(u,l),f=Re({},f);try{if(!f.message){let C;if(u==null){if(C=(H=this.container.git.getBestRepository(l))==null?void 0:H.path,!C)return;const J=await this.container.git.getLog(C,{limit:1});if(J==null)return;const ee=(0,St.Ps)(J.commits.values());if(ee?.message==null)return;f.message=ee.message}else if(f.message==null){const J=await U.YY.fromUri(u);if(C=J.repoPath,f.sha==null){const ee=l?.selection.active.line??0;if(ee<0)return;try{const ft=await this.container.git.getBlameForLine(J,ee,l?.document);if(ft==null||ft.commit.isUncommitted)return;await R.u.Commit.copyMessageToClipboard(ft.commit);return}catch(ft){O.Y.error(ft,"CopyMessageToClipboardCommand",`getBlameForLine(${ee})`),F.V.showGenericErrorMessage("Unable to copy message");return}}else{await R.u.Commit.copyMessageToClipboard({ref:f.sha,repoPath:C});return}}}await k.env.clipboard.writeText(f.message)}catch(C){O.Y.error(C,"CopyMessageToClipboardCommand"),F.V.showGenericErrorMessage("Unable to copy message")}}},"CopyMessageToClipboardCommand");mt=Je([(0,B.WD)()],mt);var vt=Object.defineProperty,ot=Object.getOwnPropertyDescriptor,Zt=Object.getOwnPropertySymbols,Ri=Object.prototype.hasOwnProperty,Oi=Object.prototype.propertyIsEnumerable,Ht=n((l,u,f)=>u in l?vt(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"copyShaToClipboard_defNormalProp"),Rt=n((l,u)=>{for(var f in u||(u={}))Ri.call(u,f)&&Ht(l,f,u[f]);if(Zt)for(var f of Zt(u))Oi.call(u,f)&&Ht(l,f,u[f]);return l},"copyShaToClipboard_spreadValues"),Pi=n((l,u,f,H)=>{for(var C=H>1?void 0:H?ot(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&vt(u,f,C),C},"copyShaToClipboard_decorateClass");let Bi=n(class extends _.pu{constructor(l){super(r.Gh.CopyShaToClipboard);this.container=l}preExecute(l,u){var f,H;return(0,_.en)(l)?(u=Rt({},u),u.sha=this.container.config.advanced.abbreviateShaOnCopy?l.node.commit.shortSha:l.node.commit.sha,this.execute(l.editor,((f=l.node.commit.file)==null?void 0:f.uri)??((H=l.node.commit.getRepository())==null?void 0:H.uri),u)):(0,_.Qo)(l)?(u=Rt({},u),u.sha=l.node.branch.sha,this.execute(l.editor,l.node.uri,u)):(0,_._5)(l)?(u=Rt({},u),u.sha=l.node.tag.sha,this.execute(l.editor,l.node.uri,u)):this.execute(l.editor,l.uri,u)}async execute(l,u,f){var H;u=(0,_.SX)(u,l),f=Rt({},f);try{if(!f.sha){if(u==null){const C=(H=this.container.git.getBestRepository(l))==null?void 0:H.path;if(!C)return;const J=await this.container.git.getLog(C,{limit:1});if(J==null)return;f.sha=(0,St.Ps)(J.commits.values()).sha}else if(f.sha==null){const C=l?.selection.active.line??0;if(C<0)return;try{const J=await U.YY.fromUri(u),ee=await this.container.git.getBlameForLine(J,C,l?.document);if(ee==null)return;f.sha=ee.commit.sha}catch(J){O.Y.error(J,"CopyShaToClipboardCommand",`getBlameForLine(${C})`),F.V.showGenericErrorMessage("Unable to copy commit SHA");return}}}await k.env.clipboard.writeText(f.sha)}catch(C){O.Y.error(C,"CopyShaToClipboardCommand"),F.V.showGenericErrorMessage("Unable to copy commit SHA")}}},"CopyShaToClipboardCommand");Bi=Pi([(0,B.WD)()],Bi);var wi=v(4504),Zi=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,be=n((l,u,f,H)=>{for(var C=H>1?void 0:H?gt(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Zi(u,f,C),C},"createPullRequestOnRemote_decorateClass");let Te=n(class extends _.mY{constructor(l){super(r.Gh.CreatePullRequestOnRemote);this.container=l}async execute(l){if(l?.repoPath==null)return;const u=this.container.git.getRepository(l.repoPath);if(u==null)return;const f=await u.getRemote(l.remote);if(f?.provider==null)return;const H=f.provider.id,C=await u.getRemotes({filter:ee=>{var ft;return((ft=ee.provider)==null?void 0:ft.id)===H}}),J={type:wi.JD.CreatePullRequest,base:{branch:l.base,remote:void 0},compare:{branch:l.compare,remote:{path:f.path,url:f.url}}};await(0,B.P0)(r.Gh.OpenOnRemote,{resource:J,remotes:C})}},"CreatePullRequestOnRemoteCommand");Te=be([(0,B.WD)()],Te);var Ke=v(5518),qe=v(3422),at=Object.defineProperty,Lt=Object.getOwnPropertyDescriptor,Dt=Object.getOwnPropertySymbols,Pt=Object.prototype.hasOwnProperty,Xt=Object.prototype.propertyIsEnumerable,hi=n((l,u,f)=>u in l?at(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"openDirectoryCompare_defNormalProp"),Yt=n((l,u)=>{for(var f in u||(u={}))Pt.call(u,f)&&hi(l,f,u[f]);if(Dt)for(var f of Dt(u))Xt.call(u,f)&&hi(l,f,u[f]);return l},"openDirectoryCompare_spreadValues"),Wt=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Lt(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&at(u,f,C),C},"openDirectoryCompare_decorateClass");let di=n(class extends _.pu{constructor(l){super([r.Gh.DiffDirectory,r.Gh.DiffDirectoryWithHead,r.Gh.ViewsOpenDirectoryDiff,r.Gh.ViewsOpenDirectoryDiffWithWorking]);this.container=l}async preExecute(l,u){switch(l.command){case r.Gh.DiffDirectoryWithHead:u=Yt({},u),u.ref1="HEAD",u.ref2=void 0;break;case r.Gh.ViewsOpenDirectoryDiff:l.type==="viewItem"&&l.node instanceof qe.fc&&(u=Yt({},u),[u.ref1,u.ref2]=await l.node.getDiffRefs());break;case r.Gh.ViewsOpenDirectoryDiffWithWorking:(0,_.DW)(l)&&(u=Yt({},u),u.ref1=l.node.ref.ref,u.ref2=void 0);break}return this.execute(l.editor,l.uri,u)}async execute(l,u,f){var H;u=(0,_.SX)(u,l),f=Yt({},f);try{const C=(H=await ce.I.getBestRepositoryOrShow(u,l,"Directory Compare Working Tree With"))==null?void 0:H.path;if(!C)return;if(!f.ref1){const J=await Ke.e.show(C,"Directory Compare Working Tree with","Choose a branch or tag to compare with",{allowEnteringRefs:!0});if(J==null||(f.ref1=J.ref,f.ref1==null))return}R.u.Commit.openDirectoryCompare(C,f.ref1,f.ref2)}catch(C){O.Y.error(C,"OpenDirectoryCompareCommand"),F.V.showGenericErrorMessage("Unable to open directory compare")}}},"OpenDirectoryCompareCommand");di=Wt([(0,B.WD)()],di);var Ii=Object.defineProperty,lr=Object.getOwnPropertyDescriptor,cr=Object.getOwnPropertySymbols,Nr=Object.prototype.hasOwnProperty,pn=Object.prototype.propertyIsEnumerable,Gr=n((l,u,f)=>u in l?Ii(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"diffLineWithPrevious_defNormalProp"),ue=n((l,u)=>{for(var f in u||(u={}))Nr.call(u,f)&&Gr(l,f,u[f]);if(cr)for(var f of cr(u))pn.call(u,f)&&Gr(l,f,u[f]);return l},"diffLineWithPrevious_spreadValues"),xe=n((l,u,f,H)=>{for(var C=H>1?void 0:H?lr(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Ii(u,f,C),C},"diffLineWithPrevious_decorateClass");let Ce=n(class extends _.pu{constructor(l){super(r.Gh.DiffLineWithPrevious);this.container=l}async execute(l,u,f){var H;if(u=(0,_.SX)(u,l),u==null)return;f=ue({},f),f.line==null&&(f.line=l?.selection.active.line??0);const C=((H=f.commit)==null?void 0:H.getGitUri())??await U.YY.fromUri(u);try{const J=await this.container.git.getPreviousComparisonUrisForLine(C.repoPath,C,f.line,C.sha);if(J==null||J.previous==null){F.V.showCommitHasNoPreviousCommitWarningMessage();return}await(0,B.P0)(r.Gh.DiffWith,{repoPath:J.current.repoPath,lhs:{sha:J.previous.sha??"",uri:J.previous.documentUri()},rhs:{sha:J.current.sha??"",uri:J.current.documentUri()},line:J.line,showOptions:f.showOptions})}catch(J){O.Y.error(J,"DiffLineWithPreviousCommand",`getPreviousLineDiffUris(${C.repoPath}, ${C.fsPath}, ${C.sha})`),F.V.showGenericErrorMessage("Unable to open compare")}}},"DiffLineWithPreviousCommand");Ce=xe([(0,B.WD)()],Ce);var Oe=v(2833),nt=Object.defineProperty,Ct=Object.getOwnPropertyDescriptor,Vt=Object.getOwnPropertySymbols,ti=Object.prototype.hasOwnProperty,vi=Object.prototype.propertyIsEnumerable,ke=n((l,u,f)=>u in l?nt(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"diffLineWithWorking_defNormalProp"),ji=n((l,u)=>{for(var f in u||(u={}))ti.call(u,f)&&ke(l,f,u[f]);if(Vt)for(var f of Vt(u))vi.call(u,f)&&ke(l,f,u[f]);return l},"diffLineWithWorking_spreadValues"),nr=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Ct(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&nt(u,f,C),C},"diffLineWithWorking_decorateClass");let qi=n(class extends _.pu{constructor(l){super(r.Gh.DiffLineWithWorking);this.container=l}async execute(l,u,f){var H,C;if(u=(0,_.SX)(u,l),u==null)return;const J=await U.YY.fromUri(u);f=ji({},f),f.line==null&&(f.line=l?.selection.active.line??0);let ee,ft;if(f.commit==null||f.commit.isUncommitted){const pi=f.line;if(pi<0)return;try{const ii=await this.container.git.getBlameForLine(J,pi,l?.document);if(ii==null){F.V.showFileNotUnderSourceControlWarningMessage("Unable to open compare");return}if(f.commit=ii.commit,f.commit.isUncommitted){const qt=await this.container.git.getStatusForFile(J.repoPath,J);qt?.indexStatus!=null?(ee=Oe.GitRevision.uncommittedStaged,ft=this.container.git.getAbsoluteUri(qt.originalPath||qt.path,f.commit.repoPath)):(ee=f.commit.unresolvedPreviousSha,ft=f.commit.file.originalUri??f.commit.file.uri)}else ee=f.commit.sha,ft=f.commit.file.uri;f.line=ii.line.line-1}catch(ii){O.Y.error(ii,"DiffLineWithWorkingCommand",`getBlameForLine(${pi})`),F.V.showGenericErrorMessage("Unable to open compare");return}}else ee=f.commit.sha,ft=((H=f.commit.file)==null?void 0:H.uri)??J;const kt=await((C=f.commit.file)==null?void 0:C.getWorkingUri());if(kt==null){k.window.showWarningMessage("Unable to open compare. File has been deleted from the working tree");return}await(0,B.P0)(r.Gh.DiffWith,{repoPath:f.commit.repoPath,lhs:{sha:ee,uri:ft},rhs:{sha:"",uri:kt},line:f.line,showOptions:f.showOptions})}},"DiffLineWithWorkingCommand");qi=nr([(0,B.WD)()],qi);var Xi=Object.defineProperty,Li=Object.defineProperties,Rr=Object.getOwnPropertyDescriptor,ir=Object.getOwnPropertyDescriptors,er=Object.getOwnPropertySymbols,yr=Object.prototype.hasOwnProperty,Cr=Object.prototype.propertyIsEnumerable,ur=n((l,u,f)=>u in l?Xi(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"diffWith_defNormalProp"),Hr=n((l,u)=>{for(var f in u||(u={}))yr.call(u,f)&&ur(l,f,u[f]);if(er)for(var f of er(u))Cr.call(u,f)&&ur(l,f,u[f]);return l},"diffWith_spreadValues"),Or=n((l,u)=>Li(l,ir(u)),"diffWith_spreadProps"),xr=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Rr(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Xi(u,f,C),C},"diffWith_decorateClass");let ki=n(class extends _.mY{constructor(l){super(r.Gh.DiffWith);this.container=l}static getMarkdownCommandArgs(l,u){let f;if(Oe.GitCommit.is(l)){const H=l;if(H.file==null||H.unresolvedPreviousSha==null)throw new Error("Commit has no file");H.isUncommitted?f={repoPath:H.repoPath,lhs:{sha:"HEAD",uri:H.file.uri},rhs:{sha:"",uri:H.file.uri},line:u}:f={repoPath:H.repoPath,lhs:{sha:H.unresolvedPreviousSha,uri:H.file.originalUri??H.file.uri},rhs:{sha:H.sha,uri:H.file.uri},line:u}}else f=l;return super.getMarkdownCommandArgsCore(r.Gh.DiffWith,f)}async execute(l){if(!(l?.lhs==null||l?.rhs==null)&&(l=Or(Hr({},l),{lhs:Hr({},l.lhs),rhs:Hr({},l.rhs),showOptions:l.showOptions==null?void 0:Hr({},l.showOptions)}),l.repoPath!=null))try{let u=l.lhs.sha,f=l.rhs.sha;if([l.lhs.sha,l.rhs.sha]=await Promise.all([await this.container.git.resolveReference(l.repoPath,l.lhs.sha,l.lhs.uri,{timeout:Oe.GitRevision.isSha(l.lhs.sha)?100:void 0}),await this.container.git.resolveReference(l.repoPath,l.rhs.sha,l.rhs.uri,{timeout:Oe.GitRevision.isSha(l.rhs.sha)?100:void 0})]),l.lhs.sha!==Oe.GitRevision.deletedOrMissing&&(u=l.lhs.sha),l.rhs.sha&&l.rhs.sha!==Oe.GitRevision.deletedOrMissing){const kt=await this.container.git.getFileStatusForCommit(l.repoPath,l.rhs.uri,l.rhs.sha);kt?.status==="D"?l.rhs.sha=Oe.GitRevision.deletedOrMissing:f=l.rhs.sha,kt?.status==="A"&&l.lhs.sha.endsWith("^")&&(l.lhs.sha=Oe.GitRevision.deletedOrMissing)}const[H,C]=await Promise.all([this.container.git.getBestRevisionUri(l.repoPath,l.lhs.uri.fsPath,l.lhs.sha),this.container.git.getBestRevisionUri(l.repoPath,l.rhs.uri.fsPath,l.rhs.sha)]);let J=Oe.GitRevision.shorten(f,{strings:{uncommitted:"Working Tree"}});C==null?Oe.GitRevision.isUncommitted(l.rhs.sha)?J="deleted":J.length===0&&l.rhs.sha===Oe.GitRevision.deletedOrMissing?J="not in Working Tree":J=`deleted${J.length===0?"":` in ${J}`}`:H==null&&(J=`added${J.length===0?"":` in ${J}`}`);let ee=l.lhs.sha!==Oe.GitRevision.deletedOrMissing?Oe.GitRevision.shorten(u):"";H==null&&l.rhs.sha.length===0&&(C!=null?(ee=ee.length===0?"":`not in ${ee}`,J=""):ee=`deleted${ee.length===0?"":` in ${ee}`}`),l.lhs.title==null&&(H!=null||ee.length!==0)&&(l.lhs.title=`${(0,y.EZ)(l.lhs.uri.fsPath)}${ee?` (${ee})`:""}`),l.rhs.title==null&&(l.rhs.title=`${(0,y.EZ)(l.rhs.uri.fsPath)}${J?` (${J})`:""}`);const ft=l.lhs.title!=null&&l.rhs.title!=null?`${l.lhs.title} ${r.NE.ArrowLeftRightLong} ${l.rhs.title}`:l.lhs.title??l.rhs.title;l.showOptions==null&&(l.showOptions={}),l.showOptions.viewColumn==null&&(l.showOptions.viewColumn=k.ViewColumn.Active),l.line!=null&&l.line!==0&&(l.showOptions.selection=new k.Range(l.line,0,l.line,0)),await(0,B.dO)(r.nA.Diff,H??this.container.git.getRevisionUri(Oe.GitRevision.deletedOrMissing,l.lhs.uri.fsPath,l.repoPath),C??this.container.git.getRevisionUri(Oe.GitRevision.deletedOrMissing,l.rhs.uri.fsPath,l.repoPath),ft,l.showOptions)}catch(u){O.Y.error(u,"DiffWithCommand","getVersionedFile"),F.V.showGenericErrorMessage("Unable to open compare")}}},"DiffWithCommand");ki=xr([(0,B.WD)()],ki);var ai=Object.defineProperty,se=Object.defineProperties,ye=Object.getOwnPropertyDescriptor,je=Object.getOwnPropertyDescriptors,Xe=Object.getOwnPropertySymbols,Qe=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable,pt=n((l,u,f)=>u in l?ai(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"diffWithNext_defNormalProp"),Ot=n((l,u)=>{for(var f in u||(u={}))Qe.call(u,f)&&pt(l,f,u[f]);if(Xe)for(var f of Xe(u))ct.call(u,f)&&pt(l,f,u[f]);return l},"diffWithNext_spreadValues"),ni=n((l,u)=>se(l,je(u)),"diffWithNext_spreadProps"),oi=n((l,u,f,H)=>{for(var C=H>1?void 0:H?ye(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&ai(u,f,C),C},"diffWithNext_decorateClass");let At=n(class extends _.pu{constructor(l){super([r.Gh.DiffWithNext,r.Gh.DiffWithNextInDiffLeft,r.Gh.DiffWithNextInDiffRight]);this.container=l}preExecute(l,u){return l.command===r.Gh.DiffWithNextInDiffLeft&&(u=ni(Ot({},u),{inDiffLeftEditor:!0})),this.execute(l.editor,l.uri,u)}async execute(l,u,f){var H;if(u=(0,_.SX)(u,l),u==null)return;f=Ot({},f),f.line==null&&(f.line=l?.selection.active.line??0);const C=((H=f.commit)==null?void 0:H.getGitUri())??await U.YY.fromUri(u);try{const J=await this.container.git.getNextComparisonUris(C.repoPath,C,C.sha,f.inDiffLeftEditor?1:0);if(J==null||J.next==null)return;await(0,B.P0)(r.Gh.DiffWith,{repoPath:J.current.repoPath,lhs:{sha:J.current.sha??"",uri:J.current.documentUri()},rhs:{sha:J.next.sha??"",uri:J.next.documentUri()},line:f.line,showOptions:f.showOptions})}catch(J){O.Y.error(J,"DiffWithNextCommand",`getNextDiffUris(${C.repoPath}, ${C.fsPath}, ${C.sha})`),F.V.showGenericErrorMessage("Unable to open compare")}}},"DiffWithNextCommand");At=oi([(0,B.WD)()],At);var Kt=Object.defineProperty,Nt=Object.defineProperties,Jt=Object.getOwnPropertyDescriptor,jt=Object.getOwnPropertyDescriptors,Mt=Object.getOwnPropertySymbols,Gi=Object.prototype.hasOwnProperty,gn=Object.prototype.propertyIsEnumerable,_n=n((l,u,f)=>u in l?Kt(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"diffWithPrevious_defNormalProp"),or=n((l,u)=>{for(var f in u||(u={}))Gi.call(u,f)&&_n(l,f,u[f]);if(Mt)for(var f of Mt(u))gn.call(u,f)&&_n(l,f,u[f]);return l},"diffWithPrevious_spreadValues"),Nn=n((l,u)=>Nt(l,jt(u)),"diffWithPrevious_spreadProps"),cs=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Jt(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Kt(u,f,C),C},"diffWithPrevious_decorateClass");let Vr=n(class extends _.pu{constructor(l){super([r.Gh.DiffWithPrevious,r.Gh.DiffWithPreviousInDiffLeft,r.Gh.DiffWithPreviousInDiffRight]);this.container=l}preExecute(l,u){return l.command===r.Gh.DiffWithPreviousInDiffRight&&(u=Nn(or({},u),{inDiffRightEditor:!0})),this.execute(l.editor,l.uri,u)}async execute(l,u,f){var H,C;if(f=or({},f),f.uri==null){if(u=(0,_.SX)(u,l),u==null)return}else u=f.uri;f.line==null&&(f.line=l?.selection.active.line??0);let J;if(((H=f.commit)==null?void 0:H.file)!=null){if(!f.commit.isUncommitted){await(0,B.P0)(r.Gh.DiffWith,{repoPath:f.commit.repoPath,lhs:{sha:`${f.commit.sha}^`,uri:f.commit.file.originalUri??f.commit.file.uri},rhs:{sha:f.commit.sha||"",uri:f.commit.file.uri},line:f.line,showOptions:f.showOptions});return}J=(C=f.commit)==null?void 0:C.getGitUri()}else J=await U.YY.fromUri(u);try{const ee=await this.container.git.getPreviousComparisonUris(J.repoPath,J,J.sha,f.inDiffRightEditor?1:0);if(ee==null||ee.previous==null){if(ee==null){F.V.showCommitHasNoPreviousCommitWarningMessage();return}if(ee.current.sha==null){await(0,V.GR)(ee.current,f.showOptions);return}if(!ee.current.isUncommittedStaged){F.V.showCommitHasNoPreviousCommitWarningMessage();return}ee.previous=U.YY.fromFile(ee.current.fileName,ee.current.repoPath,Oe.GitRevision.deletedOrMissing)}await(0,B.P0)(r.Gh.DiffWith,{repoPath:ee.current.repoPath,lhs:{sha:ee.previous.sha??"",uri:ee.previous.documentUri()},rhs:{sha:ee.current.sha??"",uri:ee.current.documentUri()},line:f.line,showOptions:f.showOptions})}catch(ee){O.Y.error(ee,"DiffWithPreviousCommand",`getPreviousDiffUris(${J.repoPath}, ${J.fsPath}, ${J.sha})`),F.V.showGenericErrorMessage("Unable to open compare")}}},"DiffWithPreviousCommand");Vr=cs([(0,B.WD)()],Vr);var Ei=v(9179),Ki=v(7778),rr=v(3708),nn=v(680),Fi=v(4761),io=v(5355),Ir;(l=>{async function u(f,H,C,J){const ee=k.window.createQuickPick();ee.ignoreFocusOut=(0,V.hE)(),ee.title=H,ee.placeholder=C,ee.matchOnDescription=!0,ee.matchOnDetail=!0,(0,nn.tI)(f)&&(ee.busy=!0,ee.enabled=!1,ee.show(),f=await f,f==null&&(ee.placeholder="Unable to show commit history")),ee.items=ft(f),J?.picked&&(ee.activeItems=ee.items.filter(qt=>rr.$w.is(qt)?!1:qt.picked));function ft(qt){return qt==null?[Fi.x.create(Fi.X.Cancel)]:[...J?.showOtherReferences??[],...(0,St.UI)(qt.commits.values(),Gt=>io.zK.create(Gt,J?.picked===Gt.ref,{compact:!0,icon:!0})),...qt?.hasMore?[Fi.x.create(Fi.X.LoadMore)]:[]]}n(ft,"getItems");async function kt(){var qt,Gt;ee.busy=!0,ee.enabled=!1;try{f=await((Gt=(qt=await f)==null?void 0:qt.more)==null?void 0:Gt.call(qt,Ei.DN.get("advanced.maxListItems")));const Ti=ft(f);let br=-1;if(ee.activeItems.length!==0){const Sr=ee.activeItems[0];br=ee.items.indexOf(Sr),Fi.x.is(Sr)&&br--}ee.items=Ti,br&&(ee.activeItems=[ee.items[br]])}finally{ee.busy=!1,ee.enabled=!0}}n(kt,"loadMore");const pi=[];let ii;J?.keys!=null&&J.keys.length!==0&&J?.onDidPressKey!==null&&(ii=Ki.W.instance.keyboard.createScope(Object.fromEntries(J.keys.map(qt=>[qt,{onDidPressKey:Gt=>{if(ee.activeItems.length!==0){const[Ti]=ee.activeItems;Ti!=null&&!Fi.x.is(Ti)&&!rr.$w.is(Ti)&&J.onDidPressKey(Gt,Ti)}}}]))),ii.start(),pi.push(ii));try{const qt=await new Promise(Gt=>{pi.push(ee.onDidHide(()=>Gt(void 0)),ee.onDidAccept(()=>{if(ee.activeItems.length!==0){const[Ti]=ee.activeItems;if(Fi.x.is(Ti))switch(Ti.directive){case Fi.X.LoadMore:kt();return;default:Gt(void 0);return}Gt(Ti)}}),ee.onDidChangeValue(async Ti=>{ii!=null&&(Ti.length!==0?await ii.pause(["left","right"]):await ii.resume())})),ee.busy=!1,ee.enabled=!0,ee.show()});if(qt==null||Fi.x.is(qt))return;if(qt instanceof rr.$w){await qt.execute();return}return qt.item}finally{ee.dispose(),pi.forEach(qt=>qt.dispose())}}n(u,"show"),l.show=u})(Ir||(Ir={}));var zr;(l=>{async function u(f,H,C,J){var ee;const ft=k.window.createQuickPick();ft.ignoreFocusOut=(0,V.hE)(),ft.title=H,ft.placeholder=C,ft.matchOnDescription=!0,ft.matchOnDetail=!0,(0,nn.tI)(f)&&(ft.busy=!0,ft.enabled=!1,ft.show(),f=await f),f!=null&&(ft.items=[...J?.showOtherReferences??[],...(0,St.UI)(J?.filter!=null?(0,St.hX)(f.commits.values(),J.filter):f.commits.values(),ii=>io.zK.create(ii,J?.picked===ii.ref,{compact:!0,icon:!0}))]),(f==null||ft.items.length<=(((ee=J?.showOtherReferences)==null?void 0:ee.length)??0))&&(ft.placeholder=f==null?"No stashes found":J?.empty??"No matching stashes found",ft.items=[Fi.x.create(Fi.X.Cancel)]),J?.picked&&(ft.activeItems=ft.items.filter(ii=>rr.$w.is(ii)?!1:ii.picked));const kt=[];let pi;J?.keys!=null&&J.keys.length!==0&&J?.onDidPressKey!==null&&(pi=Ki.W.instance.keyboard.createScope(Object.fromEntries(J.keys.map(ii=>[ii,{onDidPressKey:qt=>{if(ft.activeItems.length!==0){const[Gt]=ft.activeItems;Gt!=null&&!Fi.x.is(Gt)&&!rr.$w.is(Gt)&&J.onDidPressKey(qt,Gt)}}}]))),pi.start(),kt.push(pi));try{const ii=await new Promise(qt=>{kt.push(ft.onDidHide(()=>qt(void 0)),ft.onDidAccept(()=>{if(ft.activeItems.length!==0){const[Gt]=ft.activeItems;if(Fi.x.is(Gt)){qt(void 0);return}qt(Gt)}}),ft.onDidChangeValue(async Gt=>{pi!=null&&(Gt.length!==0?await pi.pause(["left","right"]):await pi.resume())})),ft.busy=!1,ft.enabled=!0,ft.show()});if(ii==null||Fi.x.is(ii))return;if(ii instanceof rr.$w){await ii.execute();return}return ii.item}finally{ft.dispose(),kt.forEach(ii=>ii.dispose())}}n(u,"show"),l.show=u})(zr||(zr={}));var ve=v(2971),ro=Object.defineProperty,Pr=Object.getOwnPropertyDescriptor,_r=Object.getOwnPropertySymbols,Dn=Object.prototype.hasOwnProperty,Di=Object.prototype.propertyIsEnumerable,vr=n((l,u,f)=>u in l?ro(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"diffWithRevision_defNormalProp"),To=n((l,u)=>{for(var f in u||(u={}))Dn.call(u,f)&&vr(l,f,u[f]);if(_r)for(var f of _r(u))Di.call(u,f)&&vr(l,f,u[f]);return l},"diffWithRevision_spreadValues"),Qi=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Pr(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&ro(u,f,C),C},"diffWithRevision_decorateClass");let si=n(class extends _.pu{constructor(l){super(r.Gh.DiffWithRevision);this.container=l}async execute(l,u,f){if(u=(0,_.SX)(u,l),u==null)return;const H=await U.YY.fromUri(u);f=To({},f),f.line==null&&(f.line=l?.selection.active.line??0);try{const C=this.container.git.getLogForFile(H.repoPath,H.fsPath).then(ft=>ft??(H.sha?this.container.git.getLogForFile(H.repoPath,H.fsPath,{ref:H.sha}):void 0)),J=`Open Changes with Revision${(0,ve.vk)(r.NE.Dot,2,2)}`,ee=await Ir.show(C,`${J}${H.getFormattedFileName({suffix:H.sha?`:${Oe.GitRevision.shorten(H.sha)}`:void 0,truncateTo:r.d$-J.length})}`,"Choose a commit to compare with",{picked:H.sha,keys:["right","alt+right","ctrl+right"],onDidPressKey:async(ft,kt)=>{await(0,B.P0)(r.Gh.DiffWith,{repoPath:H.repoPath,lhs:{sha:kt.item.ref,uri:H},rhs:{sha:"",uri:H},line:f.line,showOptions:f.showOptions})},showOtherReferences:[rr.$w.fromCommand("Choose a Branch or Tag...",r.Gh.DiffWithRevisionFrom),rr.$w.fromCommand("Choose a Stash...",r.Gh.DiffWithRevisionFrom,{stash:!0})]});if(ee==null)return;await(0,B.P0)(r.Gh.DiffWith,{repoPath:H.repoPath,lhs:{sha:ee.ref,uri:H},rhs:{sha:"",uri:H},line:f.line,showOptions:f.showOptions})}catch(C){O.Y.error(C,"DiffWithRevisionCommand"),F.V.showGenericErrorMessage("Unable to open compare")}}},"DiffWithRevisionCommand");si=Qi([(0,B.WD)()],si);var bi=Object.defineProperty,li=Object.getOwnPropertyDescriptor,Yi=Object.getOwnPropertySymbols,no=Object.prototype.hasOwnProperty,Mn=Object.prototype.propertyIsEnumerable,Eo=n((l,u,f)=>u in l?bi(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"diffWithRevisionFrom_defNormalProp"),oo=n((l,u)=>{for(var f in u||(u={}))no.call(u,f)&&Eo(l,f,u[f]);if(Yi)for(var f of Yi(u))Mn.call(u,f)&&Eo(l,f,u[f]);return l},"diffWithRevisionFrom_spreadValues"),so=n((l,u,f,H)=>{for(var C=H>1?void 0:H?li(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&bi(u,f,C),C},"diffWithRevisionFrom_decorateClass");let ao=n(class extends _.pu{constructor(l){super(r.Gh.DiffWithRevisionFrom);this.container=l}async execute(l,u,f){if(u=(0,_.SX)(u,l),u==null)return;const H=await U.YY.fromUri(u);if(!H.repoPath){F.V.showNoRepositoryWarningMessage("Unable to open file compare");return}f=oo({},f),f.line==null&&(f.line=l?.selection.active.line??0);const C=this.container.git.getRelativePath(H,H.repoPath);let J,ee;if(f?.stash){const ii=`Open Changes with Stash${(0,ve.vk)(r.NE.Dot,2,2)}`,qt=await zr.show(this.container.git.getStash(H.repoPath),`${ii}${H.getFormattedFileName({truncateTo:r.d$-ii.length})}`,"Choose a stash to compare with",{empty:`No stashes with '${H.getFormattedFileName()}' found`,filter:Gt=>{var Ti;return((Ti=Gt.files)==null?void 0:Ti.some(br=>br.path===C||br.originalPath===C))??!0}});if(qt==null)return;J=qt.ref,ee=J}else{const ii=`Open Changes with Branch or Tag${(0,ve.vk)(r.NE.Dot,2,2)}`,qt=await Ke.e.show(H.repoPath,`${ii}${H.getFormattedFileName({truncateTo:r.d$-ii.length})}`,"Choose a branch or tag to compare with",{allowEnteringRefs:!0});if(qt==null)return;J=qt.ref,ee=Oe.GitReference.isBranch(qt)&&qt.remote?`remotes/${J}`:J}if(J==null)return;let ft,kt;const pi=await this.container.git.getDiffStatus(H.repoPath,"HEAD",J,{filters:["R","C"]});if(pi!=null){const ii=pi.find(qt=>qt.path===C);ii?.originalPath!=null&&(ft=this.container.git.getAbsoluteUri(ii.originalPath,H.repoPath),kt=`${(0,y.EZ)(ii.originalPath)} (${Oe.GitRevision.shorten(J)})`)}await(0,B.P0)(r.Gh.DiffWith,{repoPath:H.repoPath,lhs:{sha:ee,uri:ft??H,title:kt??`${(0,y.EZ)(H.fsPath)} (${Oe.GitRevision.shorten(J)})`},rhs:{sha:"",uri:H},line:f.line,showOptions:f.showOptions})}},"DiffWithRevisionFromCommand");ao=so([(0,B.WD)()],ao);var kn=Object.defineProperty,Qr=Object.getOwnPropertyDescriptor,Sn=Object.getOwnPropertySymbols,Ks=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable,sr=n((l,u,f)=>u in l?kn(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"diffWithWorking_defNormalProp"),us=n((l,u)=>{for(var f in u||(u={}))Ks.call(u,f)&&sr(l,f,u[f]);if(Sn)for(var f of Sn(u))wt.call(u,f)&&sr(l,f,u[f]);return l},"diffWithWorking_spreadValues"),lo=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Qr(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&kn(u,f,C),C},"diffWithWorking_decorateClass");let co=n(class extends _.pu{constructor(l){super([r.Gh.DiffWithWorking,r.Gh.DiffWithWorkingInDiffLeft,r.Gh.DiffWithWorkingInDiffRight]);this.container=l}async execute(l,u,f){if(f=us({},f),f.uri==null){if(u=(0,_.SX)(u,l),u==null)return}else u=f.uri;let H=await U.YY.fromUri(u);if(f.line==null&&(f.line=l?.selection.active.line??0),f.inDiffRightEditor)try{const J=await this.container.git.getPreviousComparisonUris(H.repoPath,H,H.sha);H=J?.previous??H}catch(J){O.Y.error(J,"DiffWithWorkingCommand",`getPreviousDiffUris(${H.repoPath}, ${H.fsPath}, ${H.sha})`),F.V.showGenericErrorMessage("Unable to open compare");return}if(H.sha==null){k.window.showInformationMessage("File matches the working tree");return}if(H.sha===Oe.GitRevision.deletedOrMissing){k.window.showWarningMessage("Unable to open compare. File has been deleted from the working tree");return}if(H.isUncommittedStaged){const J=await this.container.git.getStatusForFile(H.repoPath,H);if(J?.indexStatus!=null){await(0,B.P0)(r.Gh.DiffWith,{repoPath:H.repoPath,lhs:{sha:Oe.GitRevision.uncommittedStaged,uri:H.documentUri()},rhs:{sha:"",uri:H.documentUri()},line:f.line,showOptions:f.showOptions});return}}u=H.toFileUri();const C=await this.container.git.getWorkingUri(H.repoPath,u);if(C==null){k.window.showWarningMessage("Unable to open compare. File has been deleted from the working tree");return}await(0,B.P0)(r.Gh.DiffWith,{repoPath:H.repoPath,lhs:{sha:H.sha,uri:u},rhs:{sha:"",uri:C},line:f.line,showOptions:f.showOptions})}},"DiffWithWorkingCommand");co=lo([(0,B.WD)()],co);var Fo=(l=>(l[l.Head=0]="Head",l[l.RemoteHead=1]="RemoteHead",l[l.Tag=2]="Tag",l))(Fo||{}),_t=(l=>(l[l.INDEX_MODIFIED=0]="INDEX_MODIFIED",l[l.INDEX_ADDED=1]="INDEX_ADDED",l[l.INDEX_DELETED=2]="INDEX_DELETED",l[l.INDEX_RENAMED=3]="INDEX_RENAMED",l[l.INDEX_COPIED=4]="INDEX_COPIED",l[l.MODIFIED=5]="MODIFIED",l[l.DELETED=6]="DELETED",l[l.UNTRACKED=7]="UNTRACKED",l[l.IGNORED=8]="IGNORED",l[l.INTENT_TO_ADD=9]="INTENT_TO_ADD",l[l.ADDED_BY_US=10]="ADDED_BY_US",l[l.ADDED_BY_THEM=11]="ADDED_BY_THEM",l[l.DELETED_BY_US=12]="DELETED_BY_US",l[l.DELETED_BY_THEM=13]="DELETED_BY_THEM",l[l.BOTH_ADDED=14]="BOTH_ADDED",l[l.BOTH_DELETED=15]="BOTH_DELETED",l[l.BOTH_MODIFIED=16]="BOTH_MODIFIED",l))(_t||{}),ci=(l=>(l.BadConfigFile="BadConfigFile",l.AuthenticationFailed="AuthenticationFailed",l.NoUserNameConfigured="NoUserNameConfigured",l.NoUserEmailConfigured="NoUserEmailConfigured",l.NoRemoteRepositorySpecified="NoRemoteRepositorySpecified",l.NotAGitRepository="NotAGitRepository",l.NotAtRepositoryRoot="NotAtRepositoryRoot",l.Conflict="Conflict",l.StashConflict="StashConflict",l.UnmergedChanges="UnmergedChanges",l.PushRejected="PushRejected",l.RemoteConnectionError="RemoteConnectionError",l.DirtyWorkTree="DirtyWorkTree",l.CantOpenResource="CantOpenResource",l.GitNotFound="GitNotFound",l.CantCreatePipe="CantCreatePipe",l.PermissionDenied="PermissionDenied",l.CantAccessRemote="CantAccessRemote",l.RepositoryNotFound="RepositoryNotFound",l.RepositoryIsLocked="RepositoryIsLocked",l.BranchNotFullyMerged="BranchNotFullyMerged",l.NoRemoteReference="NoRemoteReference",l.InvalidBranchName="InvalidBranchName",l.BranchAlreadyExists="BranchAlreadyExists",l.NoLocalChanges="NoLocalChanges",l.NoStashFound="NoStashFound",l.LocalChangesOverwritten="LocalChangesOverwritten",l.NoUpstreamBranch="NoUpstreamBranch",l.IsInSubmodule="IsInSubmodule",l.WrongCase="WrongCase",l.CantLockRef="CantLockRef",l.CantRebaseMultipleBranches="CantRebaseMultipleBranches",l.PatchDoesNotApply="PatchDoesNotApply",l.NoPathFound="NoPathFound",l.UnknownPath="UnknownPath",l))(ci||{}),vn=(l=>(l[l.Merge=0]="Merge",l[l.Index=1]="Index",l[l.WorkingTree=2]="WorkingTree",l))(vn||{}),hs=v(7042),Br=Object.defineProperty,Rn=Object.getOwnPropertyDescriptor,on=Object.getOwnPropertySymbols,hr=Object.prototype.hasOwnProperty,jr=Object.prototype.propertyIsEnumerable,Un=n((l,u,f)=>u in l?Br(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"externalDiff_defNormalProp"),Zr=n((l,u)=>{for(var f in u||(u={}))hr.call(u,f)&&Un(l,f,u[f]);if(on)for(var f of on(u))jr.call(u,f)&&Un(l,f,u[f]);return l},"externalDiff_spreadValues"),Wn=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Rn(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Br(u,f,C),C},"externalDiff_decorateClass");let Ln=n(class extends _.mY{constructor(l){super([r.Gh.ExternalDiff,r.Gh.ExternalDiffAll]);this.container=l}async preExecute(l,u){if(u=Zr({},u),(0,_.d$)(l)){const f=await l.node.commit.getPreviousSha(),H=Oe.GitRevision.isUncommitted(f)?"":f,C=l.node.commit.isUncommitted?"":l.node.commit.sha;return u.files=[{uri:U.YY.fromFile(l.node.file,l.node.file.repoPath??l.node.repoPath),staged:l.node.commit.isUncommittedStaged||l.node.file.indexStatus!=null,ref1:H,ref2:C}],this.execute(u)}if((0,_.O$)(l))return u.files=[{uri:U.YY.fromFile(l.node.file,l.node.file.repoPath??l.node.repoPath),staged:l.node.file.indexStatus!=null,ref1:l.node.ref1,ref2:l.node.ref2}],this.execute(u);if(u.files==null&&(l.type==="scm-states"?u.files=l.scmResourceStates.map(f=>({uri:f.resourceUri,staged:f.resourceGroupType===vn.Index})):l.type==="scm-groups"&&(u.files=(0,hs.DZ)(l.scmResourceGroups[0].resourceStates,f=>this.isModified(f)?{uri:f.resourceUri,staged:f.resourceGroupType===vn.Index}:void 0))),l.command===r.Gh.ExternalDiffAll&&u.files==null){const f=await ce.I.getRepositoryOrShow("Open All Changes (difftool)");if(f==null)return;const H=await this.container.git.getStatusForRepo(f.uri);if(H==null)return k.window.showInformationMessage("The repository doesn't have any changes");u.files=[];for(const C of H.files)C.indexStatus==="M"&&u.files.push({uri:C.uri,staged:!0}),C.workingTreeStatus==="M"&&u.files.push({uri:C.uri,staged:!1})}return this.execute(u)}isModified(l){const u=l.type;return u===_t.BOTH_MODIFIED||u===_t.INDEX_MODIFIED||u===_t.MODIFIED}async execute(l){var u,f;l=Zr({},l);try{let H;if(l.files==null){const J=k.window.activeTextEditor;if(J==null||(H=(u=this.container.git.getBestRepository(J))==null?void 0:u.path,!H))return;const ee=J.document.uri,ft=await this.container.git.getStatusForFile(H,ee);if(ft==null){k.window.showInformationMessage("The current file doesn't have any changes");return}l.files=[],ft.indexStatus==="M"&&l.files.push({uri:ft.uri,staged:!0}),ft.workingTreeStatus==="M"&&l.files.push({uri:ft.uri,staged:!1})}else if(H=(f=await this.container.git.getOrOpenRepository(l.files[0].uri))==null?void 0:f.path,!H)return;const C=this.container.config.advanced.externalDiffTool||await this.container.git.getDiffTool(H);if(!C){const J="View Git Docs";await k.window.showWarningMessage("Unable to open changes because no Git diff tool is configured",J)===J&&k.env.openExternal(k.Uri.parse("https://git-scm.com/docs/git-config#Documentation/git-config.txt-difftool"));return}for(const J of l.files)this.container.git.openDiffTool(H,J.uri,{ref1:J.ref1,ref2:J.ref2,staged:J.staged,tool:C})}catch(H){O.Y.error(H,"ExternalDiffCommand"),F.V.showGenericErrorMessage("Unable to open changes in diff tool")}}},"ExternalDiffCommand");Ln=Wn([(0,B.WD)()],Ln);var uo=v(7369),Gn=v(9268),dr=v(3222),sn=v(8318),$r=Object.defineProperty,Ao=Object.getOwnPropertyDescriptor,Be=n((l,u,f)=>u in l?$r(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"gitCommands_defNormalProp"),a=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Ao(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&$r(u,f,C),C},"gitCommands_decorateClass"),P=n((l,u,f)=>(Be(l,typeof u!="symbol"?u+"":u,f),f),"gitCommands_publicField");const de=/\$\(.+?\)|\s/g,me=Symbol("ShowLoading");let fe=n(class extends _.mY{constructor(l){super([r.Gh.GitCommands,r.Gh.GitCommandsBranch,r.Gh.GitCommandsCherryPick,r.Gh.GitCommandsMerge,r.Gh.GitCommandsRebase,r.Gh.GitCommandsReset,r.Gh.GitCommandsRevert,r.Gh.GitCommandsSwitch,r.Gh.GitCommandsTag,r.Gh.GitCommandsWorktree]);this.container=l,P(this,"startedWith","menu")}preExecute(l,u){switch(l.command){case r.Gh.GitCommandsBranch:u={command:"branch"};break;case r.Gh.GitCommandsCherryPick:u={command:"cherry-pick"};break;case r.Gh.GitCommandsMerge:u={command:"merge"};break;case r.Gh.GitCommandsRebase:u={command:"rebase"};break;case r.Gh.GitCommandsReset:u={command:"reset"};break;case r.Gh.GitCommandsRevert:u={command:"revert"};break;case r.Gh.GitCommandsSwitch:u={command:"switch"};break;case r.Gh.GitCommandsTag:u={command:"tag"};break;case r.Gh.GitCommandsWorktree:u={command:"worktree"};break}return this.execute(u)}async execute(l){const u=new Gn.K(this.container,l),f=l?.command!=null?u.find(l.command):void 0;this.startedWith=f!=null?"command":"menu";let H,C;for(f==null?C=u:C=await this.showLoadingIfNeeded(f,this.getCommandStep(f,u)),C?.ignoreFocusOut===!0&&(C.ignoreFocusOut=void 0);C!=null;){if(C===u&&f!=null){C=await this.getCommandStep(f,u);continue}if(H&&C.ignoreFocusOut==null&&(C.ignoreFocusOut=!0),(0,dr.Dr)(C)){C=await this.showPickStep(C,u),C?.ignoreFocusOut===!0&&(H=!0);continue}if((0,dr.Gj)(C)){C=await this.showInputStep(C,u),C?.ignoreFocusOut===!0&&(H=!0);continue}if((0,dr.a)(C)){C=await this.showCustomStep(C,u),C?.ignoreFocusOut===!0&&(H=!0);continue}break}}async showLoadingIfNeeded(l,u){const f=await Promise.race([u,new Promise(ee=>setTimeout(()=>ee(me),250))]);if(f!==me)return f;const H=k.window.createQuickPick();H.ignoreFocusOut=!1;const C=[];let J;try{return await new Promise(async ee=>{C.push(H.onDidHide(()=>ee(J))),H.title=l.title,H.placeholder="Loading...",H.busy=!0,H.enabled=!1,H.show(),J=await u,H.hide()})}finally{H.dispose(),C.forEach(ee=>ee.dispose())}}getButtons(l,u){const f=[];if(l!=null){if(l.buttons!=null)return f.push(...l.buttons),f;f.push(k.QuickInputButtons.Back),l.additionalButtons!=null&&f.push(...l.additionalButtons)}if(u?.canConfirm)if(u.canSkipConfirm){const H=new sn.rO.WillConfirmToggle(u.confirm(),async()=>{if(u?.skipConfirmKey==null)return;const C=Ei.DN.get("gitCommands.skipConfirmations")??[],J=C.indexOf(u.skipConfirmKey);J!==-1?C.splice(J,1):C.push(u.skipConfirmKey),await Ei.DN.updateEffective("gitCommands.skipConfirmations",C)});f.push(H)}else f.push(sn.rO.WillConfirmForced);return f}async getCommandStep(l,u){u.setCommand(l,"command");const f=await l.next();if(!f.done)return f.value}async nextStep(l,u,f){f!=null&&(f.busy=!0);const H=await l.next(u);if(!H.done)return f!=null&&(f.value=""),H.value}async showCustomStep(l,u){var f,H;const C=await l.show(l);if(C!==dr.oo.Break)if(Fi.X.is(C))switch(C){case Fi.X.Back:return await((f=u?.command)==null?void 0:f.previous())??u;case Fi.X.Noop:return(H=u.command)==null?void 0:H.retry();case Fi.X.Cancel:default:return}else return this.nextStep(u.command,C)}async showInputStep(l,u){const f=k.window.createInputBox();f.ignoreFocusOut=Ei.DN.get("gitCommands.closeOnFocusOut")?l.ignoreFocusOut??!1:!0;const H=[];try{return await new Promise(C=>{const J=n(async()=>{f.value="",u.command!=null&&(f.busy=!0,C(await u.command.previous()??u))},"goBack"),ee={left:{onDidPressKey:J}};if(l.onDidPressKey!=null&&l.keys!=null&&l.keys.length!==0)for(const kt of l.keys)ee[kt]={onDidPressKey:pi=>l.onDidPressKey(f,pi)};const ft=this.container.keyboard.createScope(ee);ft.start(),H.push(ft,f.onDidHide(()=>C(void 0)),f.onDidTriggerButton(async kt=>{var pi,ii;if(kt===k.QuickInputButtons.Back){J();return}if(kt!==sn.rO.WillConfirmForced){if(kt instanceof sn.jQ&&kt.onDidClick!=null){const qt=kt.onDidClick(f);if(f.buttons=this.getButtons(l,u.command),await qt===!0){C((pi=u.command)==null?void 0:pi.retry());return}(0,nn.tI)(qt)&&(f.buttons=this.getButtons(l,u.command));return}if(l.onDidClickButton!=null){const qt=l.onDidClickButton(f,kt);f.buttons=this.getButtons(l,u.command),await qt===!0&&C((ii=u.command)==null?void 0:ii.retry())}}}),f.onDidChangeValue(async kt=>{if(ft!=null&&(kt.length!==0?await ft.pause(["left","right"]):await ft.resume()),l.validate==null)return;const[,pi]=await l.validate(kt);f.validationMessage=pi}),f.onDidAccept(async()=>{C(await this.nextStep(u.command,f.value,f))})),f.buttons=this.getButtons(l,u.command),f.title=l.title,f.placeholder=l.placeholder,f.prompt=l.prompt,l.value!=null&&(f.value=l.value),u.command!=null&&l===u&&u.setCommand(void 0,"menu"),f.show(),l.value!=null&&f._onDidChangeValueEmitter.fire(f.value)})}finally{f.dispose(),H.forEach(C=>C.dispose())}}async showPickStep(l,u){const f=Ei.DN.get("gitCommands.closeOnFocusOut")?l.ignoreFocusOut??!1:!0,H=l.ignoreFocusOut,C=k.window.createQuickPick();C.ignoreFocusOut=f;const J=[];try{return await new Promise(ee=>{async function ft(){C.value="",u.command!=null&&(C.busy=!0,ee(await u.command.previous()??u))}n(ft,"goBack");async function kt(){var Gt;if(l.onDidLoadMore!=null){C.busy=!0,C.enabled=!1;try{const Ti=await((Gt=l.onDidLoadMore)==null?void 0:Gt.call(l,C));let br=-1;if(C.activeItems.length!==0){const Sr=C.activeItems[0];br=C.items.indexOf(Sr),Fi.x.is(Sr)&&br--}C.items=l.items=Ti,br&&(C.activeItems=[C.items[br]])}finally{C.busy=!1,C.enabled=!0}}}n(kt,"loadMore");const pi={left:{onDidPressKey:ft}};if(l.onDidPressKey!=null&&l.keys!=null&&l.keys.length!==0)for(const Gt of l.keys)pi[Gt]={onDidPressKey:Ti=>l.onDidPressKey(C,Ti)};const ii=this.container.keyboard.createScope(pi);ii.start();let qt=!1;J.push(ii,C.onDidHide(()=>ee(void 0)),C.onDidTriggerItemButton(async Gt=>{var Ti;await((Ti=l.onDidClickItemButton)==null?void 0:Ti.call(l,C,Gt.button,Gt.item))===!0&&ee(await this.nextStep(u.command,[Gt.item],C))}),C.onDidTriggerButton(async Gt=>{var Ti,br;if(Gt===k.QuickInputButtons.Back){ft();return}if(Gt!==sn.rO.WillConfirmForced){if(Gt===sn.rO.LoadMore){kt();return}if(Gt instanceof sn.jQ&&Gt.onDidClick!=null){let Sr;if(u.command==null&&C.activeItems.length!==0){const Xa=C.activeItems[0];dr.tR.is(Xa)&&(Sr=Xa)}const ss=Gt.onDidClick(C);if(C.buttons=this.getButtons(Sr!=null?Sr.value:l,Sr??u.command),await ss===!0){ee((Ti=u.command)==null?void 0:Ti.retry());return}(0,nn.tI)(ss)&&(C.buttons=this.getButtons(Sr!=null?Sr.value:l,Sr??u.command));return}if(l.onDidClickButton!=null){const Sr=l.onDidClickButton(C,Gt);C.buttons=this.getButtons(l,u.command),await Sr===!0&&ee((br=u.command)==null?void 0:br.retry())}}}),C.onDidChangeValue(async Gt=>{if(ii!=null&&(Gt.length!==0?await ii.pause(["left","right"]):await ii.resume()),!(l.onDidChangeValue!=null&&await l.onDidChangeValue(C))){if(Gt.length!==0&&!C.ignoreFocusOut?(C.ignoreFocusOut=!0,l.ignoreFocusOut=!0):Gt.length===0&&C.ignoreFocusOut&&!f&&(C.ignoreFocusOut=f,l.ignoreFocusOut=H),!qt){if(C.canSelectMany&&Gt===" "){C.value="",C.selectedItems=C.selectedItems.length===C.items.length?[]:C.items;return}if(Gt.endsWith(" ")){if(C.canSelectMany&&C.selectedItems.length!==0)return;let Ti;if(u.command==null){const br=u.find(C.value.trim(),!0);if(br==null)return;u.setCommand(br,this.startedWith)}else{const br=C.value.trim().toLowerCase(),Sr=l.items.find(ss=>ss.label.replace(de,"").toLowerCase()===br);if(Sr==null)return;Ti=[Sr]}ee(await this.nextStep(u.command,Ti,C));return}}if(!C.canSelectMany&&u.command!=null&&Gt.trim().length!==0&&(qt||C.activeItems.length===0)){if(l.onValidateValue==null)return;qt=await l.onValidateValue(C,Gt.trim(),l.items)}else qt=!1;!qt&&C.items.length!==l.items.length&&(C.items=l.items)}}),C.onDidChangeActive(()=>{if(u.command!=null||C.activeItems.length===0)return;const Gt=C.activeItems[0];!dr.tR.is(Gt)||(C.buttons=this.getButtons(void 0,Gt))}),C.onDidChangeSelection(Gt=>{!C.canSelectMany||(Gt.length!==0&&!C.ignoreFocusOut?(C.ignoreFocusOut=!0,l.ignoreFocusOut=!0):Gt?.length===0&&C.ignoreFocusOut&&!f&&(C.ignoreFocusOut=f,l.ignoreFocusOut=H))}),C.onDidAccept(async()=>{let Gt=C.selectedItems;if(Gt.length===0){if(!C.canSelectMany||C.activeItems.length===0){const Ti=C.value.trim();if(Ti.length===0&&!l.allowEmpty)return;if(l.onDidAccept==null){l.allowEmpty&&ee(await this.nextStep(u.command,[],C));return}C.busy=!0,await l.onDidAccept(C)&&ee(await this.nextStep(u.command,Ti,C)),C.busy=!1;return}Gt=C.activeItems}if(Gt.length===1){const[Ti]=Gt;if(Fi.x.is(Ti))switch(Ti.directive){case Fi.X.Cancel:ee(void 0);return;case Fi.X.Back:ft();return;case Fi.X.LoadMore:kt();return;case Fi.X.StartPreviewTrial:Ki.W.instance.subscription.startPreviewTrial(),ee(void 0);return;case Fi.X.RequiresVerification:Ki.W.instance.subscription.resendVerification(),ee(void 0);return;case Fi.X.RequiresFreeSubscription:Ki.W.instance.subscription.loginOrSignUp(),ee(void 0);return;case Fi.X.RequiresPaidSubscription:Ki.W.instance.subscription.purchase(),ee(void 0);return}}if(u.command==null){const[Ti]=Gt;if(!dr.tR.is(Ti))return;u.setCommand(Ti,this.startedWith)}if(!C.canSelectMany&&l.onDidAccept!=null){C.busy=!0;const Ti=await l.onDidAccept(C);if(C.busy=!1,!Ti)return}ee(await this.nextStep(u.command,Gt,C))})),C.title=l.title,C.placeholder=l.placeholder,C.matchOnDescription=Boolean(l.matchOnDescription),C.matchOnDetail=Boolean(l.matchOnDetail),C.canSelectMany=Boolean(l.multiselect),C.items=l.items,C.canSelectMany?(C.selectedItems=l.selectedItems??C.items.filter(Gt=>Gt.picked),C.activeItems=C.selectedItems):C.activeItems=l.selectedItems??C.items.filter(Gt=>Gt.picked),u.command!=null&&l===u&&u.setCommand(void 0,"menu"),C.buttons=this.getButtons(l,u.command),l.value!=null&&(C.value=l.value),C.show(),l.value!=null&&C._onDidChangeValueEmitter.fire(C.value)})}finally{C.dispose(),J.forEach(ee=>ee.dispose())}}},"GitCommandsCommand");a([(0,uo.cM)({args:!1,correlate:!0,singleLine:!0,timed:!1})],fe.prototype,"execute",1),fe=a([(0,B.WD)()],fe);var He=Object.defineProperty,ze=Object.getOwnPropertyDescriptor,Ye=Object.getOwnPropertySymbols,yt=Object.prototype.hasOwnProperty,zt=Object.prototype.propertyIsEnumerable,mi=n((l,u,f)=>u in l?He(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"inviteToLiveShare_defNormalProp"),Ji=n((l,u)=>{for(var f in u||(u={}))yt.call(u,f)&&mi(l,f,u[f]);if(Ye)for(var f of Ye(u))zt.call(u,f)&&mi(l,f,u[f]);return l},"inviteToLiveShare_spreadValues"),Dr=n((l,u,f,H)=>{for(var C=H>1?void 0:H?ze(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&He(u,f,C),C},"inviteToLiveShare_decorateClass");let On=n(class extends _.mY{constructor(l){super(r.Gh.InviteToLiveShare);this.container=l}static getMarkdownCommandArgs(l){const u=l===void 0||typeof l=="string"?{email:l}:l;return super.getMarkdownCommandArgsCore(r.Gh.InviteToLiveShare,u)}preExecute(l,u){return(0,_.Mg)(l)?(u=Ji({},u),u.email=l.node.contributor.email,this.execute(u)):this.execute(u)}async execute(l){if(l?.email){const u=await this.container.vsls.getContact(l.email);if(u!=null)return u.invite()}return this.container.vsls.startSession()}},"InviteToLiveShareCommand");On=Dr([(0,B.WD)()],On);var ec=Object.defineProperty,tc=Object.getOwnPropertyDescriptor,xo=n((l,u,f,H)=>{for(var C=H>1?void 0:H?tc(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&ec(u,f,C),C},"logging_decorateClass");let Tt=n(class extends _.mY{constructor(l){super(r.Gh.EnableDebugLogging);this.container=l}async execute(){await Ei.DN.updateEffective("outputLevel",Ei.M7.Debug)}},"EnableDebugLoggingCommand");Tt=xo([(0,B.WD)()],Tt);let qa=n(class extends _.mY{constructor(l){super(r.Gh.DisableDebugLogging);this.container=l}async execute(){await Ei.DN.updateEffective("outputLevel",Ei.M7.Errors)}},"DisableDebugLoggingCommand");qa=xo([(0,B.WD)()],qa);var ic=Object.defineProperty,el=Object.getOwnPropertyDescriptor,zs=n((l,u,f,H)=>{for(var C=H>1?void 0:H?el(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&ic(u,f,C),C},"openAssociatedPullRequestOnRemote_decorateClass");let Io=n(class extends _.pu{constructor(l){super(r.Gh.OpenAssociatedPullRequestOnRemote);this.container=l}async execute(l,u){if(l==null||(u=(0,_.SX)(u,l),u==null))return;const f=await U.YY.fromUri(u),H=l.selection.active.line;if(!(H<0))try{const C=await this.container.git.getBlameForLine(f,H);if(C==null)return;await(0,B.P0)(r.Gh.OpenPullRequestOnRemote,{clipboard:!1,ref:C.commit.sha,repoPath:C.commit.repoPath})}catch(C){O.Y.error(C,"OpenAssociatedPullRequestOnRemoteCommand",`getBlameForLine(${H})`)}}},"OpenAssociatedPullRequestOnRemoteCommand");Io=zs([(0,B.WD)()],Io);var ds=Object.defineProperty,tl=Object.defineProperties,rc=Object.getOwnPropertyDescriptor,nc=Object.getOwnPropertyDescriptors,Tr=Object.getOwnPropertySymbols,fs=Object.prototype.hasOwnProperty,Qs=Object.prototype.propertyIsEnumerable,Zs=n((l,u,f)=>u in l?ds(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"openBranchesOnRemote_defNormalProp"),il=n((l,u)=>{for(var f in u||(u={}))fs.call(u,f)&&Zs(l,f,u[f]);if(Tr)for(var f of Tr(u))Qs.call(u,f)&&Zs(l,f,u[f]);return l},"openBranchesOnRemote_spreadValues"),Xs=n((l,u)=>tl(l,nc(u)),"openBranchesOnRemote_spreadProps"),Js=n((l,u,f,H)=>{for(var C=H>1?void 0:H?rc(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&ds(u,f,C),C},"openBranchesOnRemote_decorateClass");let Hn=n(class extends _.pu{constructor(l){super([r.Gh.OpenBranchesOnRemote,r.Gh.Deprecated_OpenBranchesInRemote,r.Gh.CopyRemoteBranchesUrl]);this.container=l}preExecute(l,u){return(0,_.C$)(l)&&(u=Xs(il({},u),{remote:l.node.remote.name})),l.command===r.Gh.CopyRemoteBranchesUrl&&(u=Xs(il({},u),{clipboard:!0})),this.execute(l.editor,l.uri,u)}async execute(l,u,f){var H;u=(0,_.SX)(u,l);const C=u!=null?await U.YY.fromUri(u):void 0,J=(H=await ce.I.getBestRepositoryOrShow(C,l,f?.clipboard?"Copy Remote Branches Url":"Open Branches on Remote"))==null?void 0:H.path;if(!!J)try{await(0,B.P0)(r.Gh.OpenOnRemote,{resource:{type:wi.JD.Branches},repoPath:J,remote:f?.remote,clipboard:f?.clipboard})}catch(ee){O.Y.error(ee,"OpenBranchesOnRemoteCommand"),k.window.showErrorMessage("Unable to open branches on remote provider. See output channel for more details")}}},"OpenBranchesOnRemoteCommand");Hn=Js([(0,B.WD)()],Hn);var qs=Object.defineProperty,ms=Object.defineProperties,Bo=Object.getOwnPropertyDescriptor,Vn=Object.getOwnPropertyDescriptors,Er=Object.getOwnPropertySymbols,Yr=Object.prototype.hasOwnProperty,ps=Object.prototype.propertyIsEnumerable,ea=n((l,u,f)=>u in l?qs(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"openBranchOnRemote_defNormalProp"),Xr=n((l,u)=>{for(var f in u||(u={}))Yr.call(u,f)&&ea(l,f,u[f]);if(Er)for(var f of Er(u))ps.call(u,f)&&ea(l,f,u[f]);return l},"openBranchOnRemote_spreadValues"),an=n((l,u)=>ms(l,Vn(u)),"openBranchOnRemote_spreadProps"),ln=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Bo(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&qs(u,f,C),C},"openBranchOnRemote_decorateClass");let Fr=n(class extends _.pu{constructor(l){super([r.Gh.OpenBranchOnRemote,r.Gh.Deprecated_OpenBranchInRemote,r.Gh.CopyRemoteBranchUrl]);this.container=l}preExecute(l,u){return(0,_.Qo)(l)&&(u=an(Xr({},u),{branch:l.node.branch.name,remote:l.node.branch.getRemoteName()})),l.command===r.Gh.CopyRemoteBranchUrl&&(u=an(Xr({},u),{clipboard:!0})),this.execute(l.editor,l.uri,u)}async execute(l,u,f){var H;u=(0,_.SX)(u,l);const C=u!=null?await U.YY.fromUri(u):void 0,J=(H=await ce.I.getBestRepositoryOrShow(C,l,f?.clipboard?"Copy Remote Branch Url":"Open Branch On Remote"))==null?void 0:H.path;if(!!J){f=Xr({},f);try{if(f.branch==null){const ee=await Ke.e.show(J,f.clipboard?"Copy Remote Branch Url":"Open Branch On Remote",f.clipboard?"Choose a branch to copy the url from":"Choose a branch to open",{autoPick:!0,filter:{branches:ft=>ft.upstream!=null},include:Ke.H.Branches,sort:{branches:{current:!0},tags:{}}});if(ee==null||ee instanceof rr.$w)return;f.branch=ee.ref}await(0,B.P0)(r.Gh.OpenOnRemote,{resource:{type:wi.JD.Branch,branch:f.branch||"HEAD"},repoPath:J,remote:f.remote,clipboard:f.clipboard})}catch(ee){O.Y.error(ee,"OpenBranchOnRemoteCommand"),k.window.showErrorMessage("Unable to open branch on remote provider. See output channel for more details")}}}},"OpenBranchOnRemoteCommand");Fr=ln([(0,B.WD)()],Fr);var ta=Object.defineProperty,oc=Object.getOwnPropertyDescriptor,gs=Object.getOwnPropertySymbols,sc=Object.prototype.hasOwnProperty,_s=Object.prototype.propertyIsEnumerable,rl=n((l,u,f)=>u in l?ta(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"openChangedFiles_defNormalProp"),ia=n((l,u)=>{for(var f in u||(u={}))sc.call(u,f)&&rl(l,f,u[f]);if(gs)for(var f of gs(u))_s.call(u,f)&&rl(l,f,u[f]);return l},"openChangedFiles_spreadValues"),ac=n((l,u,f,H)=>{for(var C=H>1?void 0:H?oc(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&ta(u,f,C),C},"openChangedFiles_decorateClass");let nl=n(class extends _.mY{constructor(l){super(r.Gh.OpenChangedFiles);this.container=l}async execute(l){l=ia({},l);try{if(l.uris==null){const u=await ce.I.getRepositoryOrShow("Open All Changed Files");if(u==null)return;const f=await this.container.git.getStatusForRepo(u.uri);if(f==null){k.window.showWarningMessage("Unable to open changed files");return}l.uris=(0,hs.DZ)(f.files,H=>H.status!=="D"?H.uri:void 0)}(0,V.$_)(l.uris)}catch(u){O.Y.error(u,"OpenChangedFilesCommand"),F.V.showGenericErrorMessage("Unable to open all changed files")}}},"OpenChangedFilesCommand");nl=ac([(0,B.WD)()],nl);var ra=Object.defineProperty,na=Object.defineProperties,No=Object.getOwnPropertyDescriptor,ol=Object.getOwnPropertyDescriptors,oa=Object.getOwnPropertySymbols,sl=Object.prototype.hasOwnProperty,lc=Object.prototype.propertyIsEnumerable,sa=n((l,u,f)=>u in l?ra(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"openCommitOnRemote_defNormalProp"),Mo=n((l,u)=>{for(var f in u||(u={}))sl.call(u,f)&&sa(l,f,u[f]);if(oa)for(var f of oa(u))lc.call(u,f)&&sa(l,f,u[f]);return l},"openCommitOnRemote_spreadValues"),aa=n((l,u)=>na(l,ol(u)),"openCommitOnRemote_spreadProps"),vs=n((l,u,f,H)=>{for(var C=H>1?void 0:H?No(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&ra(u,f,C),C},"openCommitOnRemote_decorateClass");let la=n(class extends _.pu{constructor(l){super([r.Gh.OpenCommitOnRemote,r.Gh.Deprecated_OpenCommitInRemote,r.Gh.CopyRemoteCommitUrl]);this.container=l}static getMarkdownCommandArgs(l){const u=typeof l=="string"?{sha:l}:l;return super.getMarkdownCommandArgsCore(r.Gh.OpenCommitOnRemote,u)}preExecute(l,u){let f=l.uri;if((0,_.en)(l)){if(l.node.commit.isUncommitted)return Promise.resolve(void 0);u=aa(Mo({},u),{sha:l.node.commit.sha}),f=l.node.uri}return(0,_.jT)(l)&&(u={sha:l.item.ref},f=l.uri),l.command===r.Gh.CopyRemoteCommitUrl&&(u=aa(Mo({},u),{clipboard:!0})),this.execute(l.editor,f,u)}async execute(l,u,f){if(u=(0,_.SX)(u,l),u==null)return;const H=await U.YY.fromUri(u);if(!!H.repoPath){f=Mo({},f);try{if(f.sha==null){const C=l==null?0:l.selection.active.line;if(C<0)return;const J=await this.container.git.getBlameForLine(H,C,l?.document);if(J==null){F.V.showFileNotUnderSourceControlWarningMessage("Unable to open commit on remote provider");return}f.sha=J.commit.isUncommitted?await J.commit.getPreviousSha()??Oe.GitRevision.deletedOrMissing:J.commit.sha}await(0,B.P0)(r.Gh.OpenOnRemote,{resource:{type:wi.JD.Commit,sha:f.sha},repoPath:H.repoPath,clipboard:f.clipboard})}catch(C){O.Y.error(C,"OpenCommitOnRemoteCommand"),k.window.showErrorMessage("Unable to open commit on remote provider. See output channel for more details")}}}},"OpenCommitOnRemoteCommand");la=vs([(0,B.WD)()],la);var jn=Object.defineProperty,cn=Object.defineProperties,wn=Object.getOwnPropertyDescriptor,ho=Object.getOwnPropertyDescriptors,ca=Object.getOwnPropertySymbols,cc=Object.prototype.hasOwnProperty,uc=Object.prototype.propertyIsEnumerable,ua=n((l,u,f)=>u in l?jn(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"openComparisonOnRemote_defNormalProp"),ha=n((l,u)=>{for(var f in u||(u={}))cc.call(u,f)&&ua(l,f,u[f]);if(ca)for(var f of ca(u))uc.call(u,f)&&ua(l,f,u[f]);return l},"openComparisonOnRemote_spreadValues"),ko=n((l,u)=>cn(l,ho(u)),"openComparisonOnRemote_spreadProps"),da=n((l,u,f,H)=>{for(var C=H>1?void 0:H?wn(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&jn(u,f,C),C},"openComparisonOnRemote_decorateClass");let Uo=n(class extends _.mY{constructor(l){super([r.Gh.OpenComparisonOnRemote,r.Gh.CopyRemoteComparisonUrl]);this.container=l}preExecute(l,u){return l.type==="viewItem"&&l.node instanceof qe.J2&&(u=ko(ha({},u),{repoPath:l.node.repoPath,ref1:l.node.ref1,ref2:l.node.ref2})),l.command===r.Gh.CopyRemoteBranchesUrl&&(u=ko(ha({},u),{clipboard:!0})),this.execute(u)}async execute(l){if(!(l?.repoPath==null||l.ref1==null||l.ref2==null))try{await(0,B.P0)(r.Gh.OpenOnRemote,{resource:{type:wi.JD.Comparison,base:l.ref1,compare:l.ref2,notation:l.notation},repoPath:l.repoPath,clipboard:l?.clipboard})}catch(u){O.Y.error(u,"OpenComparisonOnRemoteCommand"),k.window.showErrorMessage("Unable to open comparison on remote provider. See output channel for more details")}}},"OpenComparisonOnRemoteCommand");Uo=da([(0,B.WD)()],Uo);var hc=Object.defineProperty,dc=Object.getOwnPropertyDescriptor,al=n((l,u,f,H)=>{for(var C=H>1?void 0:H?dc(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&hc(u,f,C),C},"openFileFromRemote_decorateClass");let ws=n(class extends _.mY{constructor(l){super(r.Gh.OpenFileFromRemote);this.container=l}async execute(){let l=await k.env.clipboard.readText();try{k.Uri.parse(l,!0)}catch{l=void 0}const u=await k.window.showInputBox({prompt:"Enter a remote file url to open",placeHolder:"Remote file url",value:l,ignoreFocusOut:!0});if(u==null||u.length===0)return;let f=await this.container.git.getLocalInfoFromRemoteUri(k.Uri.parse(u));if(f==null){if(f=await this.container.git.getLocalInfoFromRemoteUri(k.Uri.parse(u),{validate:!1}),f==null){k.window.showWarningMessage("Unable to parse the provided remote url.");return}const C="Open File...";if(await k.window.showWarningMessage("Unable to find a workspace folder that matches the provided remote url.",C)!==C)return}let H;f.startLine&&(f.endLine?H=new k.Range(f.startLine-1,0,f.endLine,0):H=new k.Range(f.startLine-1,0,f.startLine-1,0));try{await(0,V.bM)(f.uri,{selection:H,rethrow:!0})}catch{const C=await k.window.showOpenDialog({title:"Open local file",defaultUri:f.uri,canSelectMany:!1,canSelectFolders:!1});if(C==null||C.length===0)return;await(0,V.bM)(C[0])}}},"OpenFileFromRemoteCommand");ws=al([(0,B.WD)()],ws);var Wo=Object.defineProperty,ll=Object.defineProperties,fa=Object.getOwnPropertyDescriptor,ma=Object.getOwnPropertyDescriptors,pa=Object.getOwnPropertySymbols,ga=Object.prototype.hasOwnProperty,_a=Object.prototype.propertyIsEnumerable,fo=n((l,u,f)=>u in l?Wo(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"openFileOnRemote_defNormalProp"),Jr=n((l,u)=>{for(var f in u||(u={}))ga.call(u,f)&&fo(l,f,u[f]);if(pa)for(var f of pa(u))_a.call(u,f)&&fo(l,f,u[f]);return l},"openFileOnRemote_spreadValues"),mo=n((l,u)=>ll(l,ma(u)),"openFileOnRemote_spreadProps"),fc=n((l,u,f,H)=>{for(var C=H>1?void 0:H?fa(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Wo(u,f,C),C},"openFileOnRemote_decorateClass");let cl=n(class extends _.pu{constructor(l){super([r.Gh.OpenFileOnRemote,r.Gh.Deprecated_OpenFileInRemote,r.Gh.CopyRemoteFileUrl,r.Gh.CopyRemoteFileUrlWithoutRange,r.Gh.OpenFileOnRemoteFrom,r.Gh.CopyRemoteFileUrlFrom]);this.container=l}async preExecute(l,u){var f;let H=l.uri;if(l.command===r.Gh.CopyRemoteFileUrlWithoutRange&&(u=mo(Jr({},u),{range:!1})),(0,_.en)(l)?(u=mo(Jr({},u),{range:!1}),l.command===r.Gh.CopyRemoteFileUrl||l.command===r.Gh.CopyRemoteFileUrlWithoutRange||l.command===r.Gh.CopyRemoteFileUrlFrom?u.sha=l.node instanceof qe.$q?void 0:l.node.commit.sha:(0,_.Qo)(l)&&(u.branchOrTag=(f=l.node.branch)==null?void 0:f.name),H=l.node.uri):l.type==="viewItem"&&(u=mo(Jr({},u),{range:!1}),H=l.node.uri??l.uri),(l.command===r.Gh.CopyRemoteFileUrl||l.command===r.Gh.CopyRemoteFileUrlWithoutRange||l.command===r.Gh.CopyRemoteFileUrlFrom)&&(u=mo(Jr({},u),{clipboard:!0}),u.sha==null)){const C=(0,_.SX)(l.uri,l.editor);if(C!=null){const J=await U.YY.fromUri(C);if(J.repoPath)if(J.sha==null){const ee=await this.container.git.getCommitForFile(J.repoPath,J,{firstIfNotFound:!0});ee!=null&&(u.sha=ee.sha)}else u.sha=J.sha}}return(l.command===r.Gh.OpenFileOnRemoteFrom||l.command===r.Gh.CopyRemoteFileUrlFrom)&&(u=mo(Jr({},u),{pickBranchOrTag:!0,range:!1})),this.execute(l.editor,H,u)}async execute(l,u,f){if(u=(0,_.SX)(u,l),u==null)return;const H=await U.YY.fromUri(u);if(!!H.repoPath){f=Jr({range:!0},f);try{let C=await this.container.git.getRemotesWithProviders(H.repoPath);const J=f.range&&l!=null&&te.n.equals(l.document.uri,u)?new k.Range(l.selection.start.with({line:l.selection.start.line+1}),l.selection.end.with({line:l.selection.end.line+(l.selection.end.character===0?0:1)})):void 0;let ee=f.sha??H.sha;if(f.branchOrTag==null&&ee!=null&&!Oe.GitRevision.isSha(ee)&&C.length!==0){const[ft,kt]=(0,ve.pW)(ee,"/");if(kt!=null){const pi=C.find(ii=>ii.name===ft);pi!=null&&(f.branchOrTag=kt,ee=void 0,C=[pi])}}if(f.sha==null&&f.branchOrTag==null||f.pickBranchOrTag){let ft;if(f.pickBranchOrTag||(ft=await this.container.git.getBranch(H.repoPath)),ft?.upstream==null){const kt=await Ke.e.show(H.repoPath,f.clipboard?`Copy Remote File Url From${(0,ve.vk)(r.NE.Dot,2,2)}${H.relativePath}`:`Open File on Remote From${(0,ve.vk)(r.NE.Dot,2,2)}${H.relativePath}`,`Choose a branch or tag to ${f.clipboard?"copy":"open"} the file revision from`,{allowEnteringRefs:!0,autoPick:!0,filter:{branches:pi=>pi.remote||pi.upstream!=null},picked:f.branchOrTag,sort:{branches:{current:!0,orderBy:Ei.Vz.DateDesc},tags:{orderBy:Ei.RV.DateDesc}}});if(kt==null)return;if(kt.refType==="branch"){if(kt.remote){f.branchOrTag=Oe.GitBranch.getNameWithoutRemote(kt.name);const pi=Oe.GitBranch.getRemote(kt.name),ii=C.find(qt=>qt.name===pi);ii!=null&&(C=[ii])}else f.branchOrTag=kt.name;ee=void 0}else kt.refType==="tag"?(f.branchOrTag=kt.ref,ee=void 0):(f.branchOrTag=void 0,ee=kt.ref)}else f.branchOrTag=ft.name}await(0,B.P0)(r.Gh.OpenOnRemote,{resource:{type:ee==null?wi.JD.File:wi.JD.Revision,branchOrTag:f.branchOrTag??"HEAD",fileName:H.relativePath,range:J,sha:ee??void 0},repoPath:H.repoPath,remotes:C,clipboard:f.clipboard})}catch(C){O.Y.error(C,"OpenFileOnRemoteCommand"),k.window.showErrorMessage("Unable to open file on remote provider. See output channel for more details")}}}},"OpenFileOnRemoteCommand");cl=fc([(0,B.WD)()],cl);var va=Object.defineProperty,wa=Object.defineProperties,bs=Object.getOwnPropertyDescriptor,Lo=Object.getOwnPropertyDescriptors,ul=Object.getOwnPropertySymbols,hl=Object.prototype.hasOwnProperty,ba=Object.prototype.propertyIsEnumerable,dl=n((l,u,f)=>u in l?va(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"openFileAtRevision_defNormalProp"),po=n((l,u)=>{for(var f in u||(u={}))hl.call(u,f)&&dl(l,f,u[f]);if(ul)for(var f of ul(u))ba.call(u,f)&&dl(l,f,u[f]);return l},"openFileAtRevision_spreadValues"),bn=n((l,u)=>wa(l,Lo(u)),"openFileAtRevision_spreadProps"),go=n((l,u,f,H)=>{for(var C=H>1?void 0:H?bs(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&va(u,f,C),C},"openFileAtRevision_decorateClass");let Hi=n(class extends _.pu{constructor(l){super([r.Gh.OpenFileAtRevision,r.Gh.OpenBlamePriorToChange]);this.container=l}static getMarkdownCommandArgs(l,u,f){let H;return l instanceof k.Uri?H={revisionUri:l,line:f,annotationType:u}:H=l,super.getMarkdownCommandArgsCore(r.Gh.OpenFileAtRevision,H)}async preExecute(l,u){if(l.command===r.Gh.OpenBlamePriorToChange){if(u=bn(po({},u),{annotationType:Ei.VP.Blame}),u.revisionUri==null&&l.editor!=null){const f=l.editor.selection.active.line;if(f>=0)try{const H=await U.YY.fromUri(l.editor.document.uri),C=await this.container.git.getBlameForLine(H,f);if(C!=null)if(C.commit.isUncommitted){const J=await C.commit.getPreviousComparisonUrisForLine(f);if(J?.previous!=null)u.revisionUri=this.container.git.getRevisionUri(J.previous);else{F.V.showCommitHasNoPreviousCommitWarningMessage(C.commit);return}}else if((C!=null?await C?.commit.getPreviousSha():void 0)!=null)u.revisionUri=this.container.git.getRevisionUri(C.commit.getGitUri(!0));else{F.V.showCommitHasNoPreviousCommitWarningMessage(C.commit);return}}catch(H){O.Y.error(H,"OpenBlamePriorToChangeCommand")}}if(u.revisionUri==null){F.V.showGenericErrorMessage("Unable to open blame");return}}return this.execute(l.editor,l.uri,u)}async execute(l,u,f){if(u=(0,_.SX)(u,l),u==null)return;const H=await U.YY.fromUri(u);f=po({},f),f.line==null&&(f.line=l?.selection.active.line??0);try{if(f.revisionUri==null){const C=this.container.git.getLogForFile(H.repoPath,H.fsPath).then(ft=>ft??(H.sha?this.container.git.getLogForFile(H.repoPath,H.fsPath,{ref:H.sha}):void 0)),J=`Open ${f.annotationType===Ei.VP.Blame?"Blame":"File"} at Revision${(0,ve.vk)(r.NE.Dot,2,2)}`,ee=await Ir.show(C,`${J}${H.getFormattedFileName({suffix:H.sha?`:${Oe.GitRevision.shorten(H.sha)}`:void 0,truncateTo:r.d$-J.length})}`,`Choose a commit to ${f.annotationType===Ei.VP.Blame?"blame":"open"} the file revision from`,{picked:H.sha,keys:["right","alt+right","ctrl+right"],onDidPressKey:async(ft,kt)=>{await R.u.Commit.openFileAtRevision(kt.item.file,kt.item,{annotationType:f.annotationType,line:f.line,preserveFocus:!0,preview:!1})},showOtherReferences:[rr.$w.fromCommand("Choose a Branch or Tag...",r.Gh.OpenFileAtRevisionFrom),rr.$w.fromCommand("Choose a Stash...",r.Gh.OpenFileAtRevisionFrom,{stash:!0})]});if(ee?.file==null)return;await R.u.Commit.openFileAtRevision(ee.file,ee,po({annotationType:f.annotationType,line:f.line},f.showOptions));return}await R.u.Commit.openFileAtRevision(f.revisionUri,po({annotationType:f.annotationType,line:f.line},f.showOptions))}catch(C){O.Y.error(C,"OpenFileAtRevisionCommand"),F.V.showGenericErrorMessage("Unable to open file at revision")}}},"OpenFileAtRevisionCommand");Hi=go([(0,B.WD)()],Hi);var ya=Object.defineProperty,fl=Object.getOwnPropertyDescriptor,Ca=Object.getOwnPropertySymbols,ml=Object.prototype.hasOwnProperty,Yn=Object.prototype.propertyIsEnumerable,Kn=n((l,u,f)=>u in l?ya(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"openFileAtRevisionFrom_defNormalProp"),Pa=n((l,u)=>{for(var f in u||(u={}))ml.call(u,f)&&Kn(l,f,u[f]);if(Ca)for(var f of Ca(u))Yn.call(u,f)&&Kn(l,f,u[f]);return l},"openFileAtRevisionFrom_spreadValues"),pl=n((l,u,f,H)=>{for(var C=H>1?void 0:H?fl(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&ya(u,f,C),C},"openFileAtRevisionFrom_decorateClass");let un=n(class extends _.pu{constructor(l){super(r.Gh.OpenFileAtRevisionFrom);this.container=l}async execute(l,u,f){if(u=(0,_.SX)(u,l),u==null)return;const H=await U.YY.fromUri(u);if(!H.repoPath){F.V.showNoRepositoryWarningMessage("Unable to open file revision");return}if(f=Pa({},f),f.line==null&&(f.line=l?.selection.active.line??0),f.reference==null)if(f?.stash){const C=this.container.git.getRelativePath(H,H.repoPath),J=`Open Changes with Stash${(0,ve.vk)(r.NE.Dot,2,2)}`,ee=await zr.show(this.container.git.getStash(H.repoPath),`${J}${H.getFormattedFileName({truncateTo:r.d$-J.length})}`,"Choose a stash to compare with",{filter:ft=>{var kt;return((kt=ft.files)==null?void 0:kt.some(pi=>pi.path===C||pi.originalPath===C))??!0}});if(ee==null)return;f.reference=ee}else{const C=`Open File at Branch or Tag${(0,ve.vk)(r.NE.Dot,2,2)}`,J=await Ke.e.show(H.repoPath,`${C}${H.getFormattedFileName({truncateTo:r.d$-C.length})}`,"Choose a branch or tag to open the file revision from",{allowEnteringRefs:!0,keys:["right","alt+right","ctrl+right"],onDidPressKey:async(ee,ft)=>{const[kt]=ft.activeItems;kt!=null&&await R.u.Commit.openFileAtRevision(this.container.git.getRevisionUri(kt.ref,H.fsPath,H.repoPath),{annotationType:f.annotationType,line:f.line,preserveFocus:!0,preview:!1})}});if(J==null)return;f.reference=J}await R.u.Commit.openFileAtRevision(this.container.git.getRevisionUri(f.reference.ref,H.fsPath,H.repoPath),Pa({annotationType:f.annotationType,line:f.line},f.showOptions))}},"OpenFileAtRevisionFromCommand");un=pl([(0,B.WD)()],un);var _o=v(3542),yi=Object.defineProperty,Go=Object.getOwnPropertyDescriptor,gl=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Go(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&yi(u,f,C),C},"openOnRemote_decorateClass");let Da=n(class extends _.mY{constructor(l){super([r.Gh.OpenOnRemote,r.Gh.Deprecated_OpenInRemote]);this.container=l}async execute(l){var u;if(l?.resource==null)return;let f="remotes"in l?l.remotes:await this.container.git.getRemotesWithProviders(l.repoPath);if(l.remote!=null){const H=f.filter(C=>C.name===l.remote);f.length>0&&(f=H)}try{if(l.resource.type===wi.JD.Branch){const[pi,ii]=(0,ve.pW)(l.resource.branch,"/");if(ii!=null){const qt=f.find(Gt=>Gt.name===pi);qt!=null&&(l.resource.branch=ii,f=[qt])}}else if(l.resource.type===wi.JD.Revision){const{commit:pi,fileName:ii}=l.resource;if(pi!=null){const qt=await pi.findFile(ii);qt?.status==="D"?l.resource.sha=await this.container.git.resolveReference(pi.repoPath,`${pi.sha}^`,ii):l.resource.sha=pi.sha}}const H=Oe.GitRemote.getHighlanderProviders(f),C=H?.length?H[0].name:"Remote",J={autoPick:"default",clipboard:l.clipboard,setDefault:!0};let ee,ft=`Choose which remote to ${l.clipboard?"copy the url for":"open on"}`;switch(l.resource.type){case wi.JD.Branch:ee=`${l.clipboard?`Copy ${C} Branch Url`:`Open Branch on ${C}`}${(0,ve.vk)(r.NE.Dot,2,2)}${l.resource.branch}`;break;case wi.JD.Branches:ee=`${l.clipboard?`Copy ${C} Branches Url`:`Open Branches on ${C}`}`;break;case wi.JD.Commit:ee=`${l.clipboard?`Copy ${C} Commit Url`:`Open Commit on ${C}`}${(0,ve.vk)(r.NE.Dot,2,2)}${Oe.GitRevision.shorten(l.resource.sha)}`;break;case wi.JD.Comparison:ee=`${l.clipboard?`Copy ${C} Comparison Url`:`Open Comparison on ${C}`}${(0,ve.vk)(r.NE.Dot,2,2)}${Oe.GitRevision.createRange(l.resource.base,l.resource.compare,l.resource.notation??"...")}`;break;case wi.JD.CreatePullRequest:J.autoPick=!0,J.setDefault=!1,ee=`${l.clipboard?`Copy ${C} Create Pull Request Url`:`Create Pull Request on ${C}`}${(0,ve.vk)(r.NE.Dot,2,2)}${(u=l.resource.base)!=null&&u.branch?Oe.GitRevision.createRange(l.resource.base.branch,l.resource.compare.branch,"..."):l.resource.compare.branch}`,ft=`Choose which remote to ${l.clipboard?"copy the create pull request url for":"create the pull request on"}`;break;case wi.JD.File:ee=`${l.clipboard?`Copy ${C} File Url`:`Open File on ${C}`}${(0,ve.vk)(r.NE.Dot,2,2)}${l.resource.fileName}`;break;case wi.JD.Repo:ee=`${l.clipboard?`Copy ${C} Repository Url`:`Open Repository on ${C}`}`;break;case wi.JD.Revision:{ee=`${l.clipboard?`Copy ${C} File Url`:`Open File on ${C}`}${(0,ve.vk)(r.NE.Dot,2,2)}${Oe.GitRevision.shorten(l.resource.sha)}${(0,ve.vk)(r.NE.Dot,1,1)}${l.resource.fileName}`;break}}const kt=await _o.ld.show(ee,ft,l.resource,f,J);await kt?.execute()}catch(H){O.Y.error(H,"OpenOnRemoteCommand"),F.V.showGenericErrorMessage("Unable to open in remote provider")}}},"OpenOnRemoteCommand");Da=gl([(0,B.WD)()],Da);var ys=v(6814),Ho=Object.defineProperty,Vo=Object.defineProperties,hn=Object.getOwnPropertyDescriptor,jo=Object.getOwnPropertyDescriptors,Sa=Object.getOwnPropertySymbols,mc=Object.prototype.hasOwnProperty,Cs=Object.prototype.propertyIsEnumerable,qr=n((l,u,f)=>u in l?Ho(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"openIssueOnRemote_defNormalProp"),Ra=n((l,u)=>{for(var f in u||(u={}))mc.call(u,f)&&qr(l,f,u[f]);if(Sa)for(var f of Sa(u))Cs.call(u,f)&&qr(l,f,u[f]);return l},"openIssueOnRemote_spreadValues"),_l=n((l,u)=>Vo(l,jo(u)),"openIssueOnRemote_spreadProps"),fi=n((l,u,f,H)=>{for(var C=H>1?void 0:H?hn(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Ho(u,f,C),C},"openIssueOnRemote_decorateClass");let vl=n(class extends _.mY{constructor(l){super([r.Gh.OpenIssueOnRemote,r.Gh.CopyRemoteIssueUrl]);this.container=l}preExecute(l,u){return l.type==="viewItem"&&l.node instanceof ys.Z&&(u=_l(Ra({},u),{issue:{url:l.node.issue.url},clipboard:l.command===r.Gh.CopyRemotePullRequestUrl})),this.execute(u)}async execute(l){l.clipboard?await k.env.clipboard.writeText(l.issue.url):k.env.openExternal(k.Uri.parse(l.issue.url))}},"OpenIssueOnRemoteCommand");vl=fi([(0,B.WD)()],vl);var Oa=Object.defineProperty,Yo=Object.defineProperties,vo=Object.getOwnPropertyDescriptor,dn=Object.getOwnPropertyDescriptors,Mr=Object.getOwnPropertySymbols,wl=Object.prototype.hasOwnProperty,pc=Object.prototype.propertyIsEnumerable,Ko=n((l,u,f)=>u in l?Oa(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"openPullRequestOnRemote_defNormalProp"),Ps=n((l,u)=>{for(var f in u||(u={}))wl.call(u,f)&&Ko(l,f,u[f]);if(Mr)for(var f of Mr(u))pc.call(u,f)&&Ko(l,f,u[f]);return l},"openPullRequestOnRemote_spreadValues"),bl=n((l,u)=>Yo(l,dn(u)),"openPullRequestOnRemote_spreadProps"),zo=n((l,u,f,H)=>{for(var C=H>1?void 0:H?vo(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Oa(u,f,C),C},"openPullRequestOnRemote_decorateClass");let wo=n(class extends _.mY{constructor(l){super([r.Gh.OpenPullRequestOnRemote,r.Gh.CopyRemotePullRequestUrl]);this.container=l}preExecute(l,u){return l.type==="viewItem"&&l.node instanceof qe.Zt&&(u=bl(Ps({},u),{pr:{url:l.node.pullRequest.url},clipboard:l.command===r.Gh.CopyRemotePullRequestUrl})),this.execute(u)}async execute(l){if(l?.pr==null){if(l?.repoPath==null||l?.ref==null)return;const u=await this.container.git.getRichRemoteProvider(l.repoPath);if(u?.provider==null)return;const f=await this.container.git.getPullRequestForCommit(l.ref,u.provider);if(f==null)return;l=Ps({},l),l.pr=f}l.clipboard?await k.env.clipboard.writeText(l.pr.url):k.env.openExternal(k.Uri.parse(l.pr.url))}},"OpenPullRequestOnRemoteCommand");wo=zo([(0,B.WD)()],wo);var Ds=Object.defineProperty,Ss=Object.defineProperties,$a=Object.getOwnPropertyDescriptor,kr=Object.getOwnPropertyDescriptors,Ta=Object.getOwnPropertySymbols,Ea=Object.prototype.hasOwnProperty,Rs=Object.prototype.propertyIsEnumerable,Qo=n((l,u,f)=>u in l?Ds(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"openRepoOnRemote_defNormalProp"),bo=n((l,u)=>{for(var f in u||(u={}))Ea.call(u,f)&&Qo(l,f,u[f]);if(Ta)for(var f of Ta(u))Rs.call(u,f)&&Qo(l,f,u[f]);return l},"openRepoOnRemote_spreadValues"),Zo=n((l,u)=>Ss(l,kr(u)),"openRepoOnRemote_spreadProps"),gc=n((l,u,f,H)=>{for(var C=H>1?void 0:H?$a(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Ds(u,f,C),C},"openRepoOnRemote_decorateClass");let yo=n(class extends _.pu{constructor(l){super([r.Gh.OpenRepoOnRemote,r.Gh.Deprecated_OpenRepoInRemote,r.Gh.CopyRemoteRepositoryUrl]);this.container=l}preExecute(l,u){return(0,_.C$)(l)&&(u=Zo(bo({},u),{remote:l.node.remote.name})),l.command===r.Gh.CopyRemoteRepositoryUrl&&(u=Zo(bo({},u),{clipboard:!0})),this.execute(l.editor,l.uri,u)}async execute(l,u,f){var H;u=(0,_.SX)(u,l);const C=u!=null?await U.YY.fromUri(u):void 0,J=(H=await ce.I.getBestRepositoryOrShow(C,l,f?.clipboard?"Choose which repository to copy the url from":"Choose which repository to open on remote"))==null?void 0:H.path;if(!!J)try{await(0,B.P0)(r.Gh.OpenOnRemote,{resource:{type:wi.JD.Repo},repoPath:J,remote:f?.remote,clipboard:f?.clipboard})}catch(ee){O.Y.error(ee,"OpenRepoOnRemoteCommand"),k.window.showErrorMessage("Unable to open repository on remote provider. See output channel for more details")}}},"OpenRepoOnRemoteCommand");yo=gc([(0,B.WD)()],yo);var $n=Object.defineProperty,yl=Object.getOwnPropertyDescriptor,wr=Object.getOwnPropertySymbols,Cl=Object.prototype.hasOwnProperty,Tn=Object.prototype.propertyIsEnumerable,Os=n((l,u,f)=>u in l?$n(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"openRevisionFile_defNormalProp"),Pl=n((l,u)=>{for(var f in u||(u={}))Cl.call(u,f)&&Os(l,f,u[f]);if(wr)for(var f of wr(u))Tn.call(u,f)&&Os(l,f,u[f]);return l},"openRevisionFile_spreadValues"),Fa=n((l,u,f,H)=>{for(var C=H>1?void 0:H?yl(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&$n(u,f,C),C},"openRevisionFile_decorateClass");let ar=n(class extends _.pu{constructor(l){super([r.Gh.OpenRevisionFile,r.Gh.OpenRevisionFileInDiffLeft,r.Gh.OpenRevisionFileInDiffRight]);this.container=l}async execute(l,u,f){var H;if(u=(0,_.SX)(u,l),u==null)return;const C=await U.YY.fromUri(u);f=Pl({},f),f.line==null&&(f.line=l?.selection.active.line??0);try{if(f.revisionUri==null)if(C?.sha){const J=await this.container.git.getCommit(C.repoPath,C.sha);f.revisionUri=((H=J?.file)==null?void 0:H.status)==="D"?this.container.git.getRevisionUri(await J.getPreviousSha()??Oe.GitRevision.deletedOrMissing,J.file,J.repoPath):this.container.git.getRevisionUri(C)}else f.revisionUri=this.container.git.getRevisionUri(C);await R.u.Commit.openFileAtRevision(f.revisionUri,Pl({annotationType:f.annotationType,line:f.line},f.showOptions))}catch(J){O.Y.error(J,"OpenRevisionFileCommand"),F.V.showGenericErrorMessage("Unable to open file revision")}}},"OpenRevisionFileCommand");ar=Fa([(0,B.WD)()],ar);var en=Object.defineProperty,$s=Object.defineProperties,Dl=Object.getOwnPropertyDescriptor,_c=Object.getOwnPropertyDescriptors,Xo=Object.getOwnPropertySymbols,En=Object.prototype.hasOwnProperty,Ts=Object.prototype.propertyIsEnumerable,Sl=n((l,u,f)=>u in l?en(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"openWorkingFile_defNormalProp"),Es=n((l,u)=>{for(var f in u||(u={}))En.call(u,f)&&Sl(l,f,u[f]);if(Xo)for(var f of Xo(u))Ts.call(u,f)&&Sl(l,f,u[f]);return l},"openWorkingFile_spreadValues"),zn=n((l,u)=>$s(l,_c(u)),"openWorkingFile_spreadProps"),Vi=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Dl(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&en(u,f,C),C},"openWorkingFile_decorateClass");let Aa=n(class extends _.pu{constructor(l){super([r.Gh.OpenWorkingFile,r.Gh.OpenWorkingFileInDiffLeft,r.Gh.OpenWorkingFileInDiffRight]);this.container=l}async execute(l,u,f){f=Es({},f),f.line==null&&(f.line=l?.selection.active.line);try{if(f.uri==null){if(u=(0,_.SX)(u,l),u==null)return}else u=f.uri;if(f.uri=await U.YY.fromUri(u),U.YY.is(f.uri)&&f.uri.sha){const C=await this.container.git.getWorkingUri(f.uri.repoPath,f.uri);if(C===void 0){k.window.showWarningMessage("Unable to open working file. File could not be found in the working tree");return}f.uri=new U.YY(C,f.uri.repoPath)}f.line!==void 0&&f.line!==0&&(f.showOptions===void 0&&(f.showOptions={}),f.showOptions.selection=new k.Range(f.line,0,f.line,0));const H=await(0,V.GR)(f.uri,zn(Es({},f.showOptions),{throwOnError:!0}));if(f.annotationType===void 0)return;await this.container.fileAnnotations.show(H,f.annotationType,{selection:{line:f.line}})}catch(H){O.Y.error(H,"OpenWorkingFileCommand"),F.V.showGenericErrorMessage("Unable to open working file")}}},"OpenWorkingFileCommand");Aa=Vi([(0,B.WD)()],Aa);var Rl=Object.defineProperty,Ol=Object.getOwnPropertyDescriptor,Fs=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Ol(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Rl(u,f,C),C},"rebaseEditor_decorateClass");let As=n(class extends _.mY{constructor(l){super(r.Gh.DisableRebaseEditor);this.container=l}execute(){return this.container.rebaseEditor.setEnabled(!1)}},"DisableRebaseEditorCommand");As=Fs([(0,B.WD)()],As);let $l=n(class extends _.mY{constructor(l){super(r.Gh.EnableRebaseEditor);this.container=l}execute(){return this.container.rebaseEditor.setEnabled(!0)}},"EnableRebaseEditorCommand");$l=Fs([(0,B.WD)()],$l);var Tl=Object.defineProperty,vc=Object.getOwnPropertyDescriptor,El=n((l,u,f,H)=>{for(var C=H>1?void 0:H?vc(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Tl(u,f,C),C},"refreshHover_decorateClass");let xs=n(class extends _.mY{constructor(l){super(r.Gh.RefreshHover);this.container=l}async execute(){await(0,B.dO)(r.nA.EditorShowHover)}},"RefreshHoverCommand");xs=El([(0,B.WD)()],xs);var Fl=Object.defineProperty,Co=Object.defineProperties,Is=Object.getOwnPropertyDescriptor,wc=Object.getOwnPropertyDescriptors,Fn=Object.getOwnPropertySymbols,yn=Object.prototype.hasOwnProperty,fr=Object.prototype.propertyIsEnumerable,tn=n((l,u,f)=>u in l?Fl(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"remoteProviders_defNormalProp"),xa=n((l,u)=>{for(var f in u||(u={}))yn.call(u,f)&&tn(l,f,u[f]);if(Fn)for(var f of Fn(u))fr.call(u,f)&&tn(l,f,u[f]);return l},"remoteProviders_spreadValues"),Al=n((l,u)=>Co(l,wc(u)),"remoteProviders_spreadProps"),Jo=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Is(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Fl(u,f,C),C},"remoteProviders_decorateClass");let fn=n(class extends _.mY{constructor(l){super(r.Gh.ConnectRemoteProvider);this.container=l}static getMarkdownCommandArgs(l){let u;return Oe.GitRemote.is(l)?u={remote:l.id,repoPath:l.repoPath}:u=l,super.getMarkdownCommandArgsCore(r.Gh.ConnectRemoteProvider,u)}preExecute(l,u){return(0,_.C$)(l)&&(u=Al(xa({},u),{remote:l.node.remote.id,repoPath:l.node.remote.repoPath})),this.execute(u)}async execute(l){let u,f,H;if(l?.repoPath==null){const J=new Map;for(const ee of this.container.git.openRepositories){const ft=await ee.getRichRemote();ft?.provider!=null&&!await ft.provider.isConnected()&&J.set(ee,ft)}if(J.size===0)return!1;if(J.size===1){let ee;[ee,u]=(0,St.Ps)(J),H=ee.path}else{const ee=await ce.I.show(void 0,"Choose which repository to connect to the remote provider",[...J.keys()]);if(ee?.item==null)return;H=ee.repoPath,u=J.get(ee.item)}}else if(l?.remote==null){if(H=l.repoPath,u=await this.container.git.getRichRemoteProvider(H,{includeDisconnected:!0}),u==null)return!1}else if(H=l.repoPath,f=await this.container.git.getRemotesWithProviders(H),u=f.find(J=>J.id===l.remote),!u?.hasRichProvider())return!1;const C=await u.provider.connect();return C&&!(f??await this.container.git.getRemotesWithProviders(H)).some(J=>J.default)&&await u.setAsDefault(!0),C}},"ConnectRemoteProviderCommand");fn=Jo([(0,B.WD)()],fn);let An=n(class extends _.mY{constructor(l){super(r.Gh.DisconnectRemoteProvider);this.container=l}static getMarkdownCommandArgs(l){let u;return Oe.GitRemote.is(l)?u={remote:l.id,repoPath:l.repoPath}:u=l,super.getMarkdownCommandArgsCore(r.Gh.DisconnectRemoteProvider,u)}preExecute(l,u){return(0,_.C$)(l)&&(u=Al(xa({},u),{remote:l.node.remote.id,repoPath:l.node.remote.repoPath})),this.execute(u)}async execute(l){let u,f;if(l?.repoPath==null){const H=new Map;for(const C of this.container.git.openRepositories){const J=await C.getRichRemote(!0);J!=null&&H.set(C,J)}if(H.size===0)return;if(H.size===1){let C;[C,u]=(0,St.Ps)(H),f=C.path}else{const C=await ce.I.show(void 0,"Choose which repository to disconnect from the remote provider",[...H.keys()]);if(C?.item==null)return;f=C.repoPath,u=H.get(C.item)}}else if(l?.remote==null){if(f=l.repoPath,u=await this.container.git.getRichRemoteProvider(f,{includeDisconnected:!1}),u==null)return}else if(f=l.repoPath,u=(await this.container.git.getRemotesWithProviders(f)).find(H=>H.id===l.remote),!u?.hasRichProvider())return;return u.provider.disconnect()}},"DisconnectRemoteProviderCommand");An=Jo([(0,B.WD)()],An);var Kr=Object.defineProperty,Bs=Object.getOwnPropertyDescriptor,Ia=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Bs(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Kr(u,f,C),C},"repositories_decorateClass");let Qn=n(class extends _.mY{constructor(l){super(r.Gh.FetchRepositories);this.container=l}async execute(){return(0,R.m)({command:"fetch",state:{repos:this.container.git.openRepositories}})}},"FetchRepositoriesCommand");Qn=Ia([(0,B.WD)()],Qn);let Ba=n(class extends _.mY{constructor(l){super(r.Gh.PullRepositories);this.container=l}async execute(){return(0,R.m)({command:"pull",state:{repos:this.container.git.openRepositories}})}},"PullRepositoriesCommand");Ba=Ia([(0,B.WD)()],Ba);let Na=n(class extends _.mY{constructor(l){super(r.Gh.PushRepositories);this.container=l}async execute(){return(0,R.m)({command:"push",state:{repos:this.container.git.openRepositories}})}},"PushRepositoriesCommand");Na=Ia([(0,B.WD)()],Na);var bc=v(1505),yc=Object.defineProperty,Ns=Object.getOwnPropertyDescriptor,Cc=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Ns(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&yc(u,f,C),C},"resetAvatarCache_decorateClass");let xl=n(class extends _.mY{constructor(l){super(r.Gh.ResetAvatarCache);this.container=l}execute(){(0,bc.E3)("all")}},"ResetAvatarCacheCommand");xl=Cc([(0,B.WD)()],xl);var xn=Object.defineProperty,Cn=Object.getOwnPropertyDescriptor,Ur=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Cn(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&xn(u,f,C),C},"resetSuppressedWarnings_decorateClass");let mr=n(class extends _.mY{constructor(l){super(r.Gh.ResetSuppressedWarnings);this.container=l}async execute(){await Ei.DN.update("advanced.messages",void 0,k.ConfigurationTarget.Global)}},"ResetSuppressedWarningsCommand");mr=Ur([(0,B.WD)()],mr);var rn=Object.defineProperty,Il=Object.getOwnPropertyDescriptor,Zn=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Il(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&rn(u,f,C),C},"setViewsLayout_decorateClass"),tr=(l=>(l.GitLens="gitlens",l.SourceControl="scm",l))(tr||{});let Bl=n(class extends _.mY{constructor(l){super(r.Gh.SetViewsLayout);this.container=l}async execute(l){let u=l?.layout;if(u==null){const f=await k.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(f==null)return;u=f.layout}switch(u){case"gitlens":try{let f=0;for(;f++<2;)await(0,B.dO)(r.nA.MoveViews,{viewIds:Ei.S4.map(H=>`gitlens.views.${H}`),destinationId:"workbench.view.extension.gitlens"})}catch{}break;case"scm":try{let f=0;for(;f++<2;)await(0,B.dO)(r.nA.MoveViews,{viewIds:Ei.S4.map(H=>`gitlens.views.${H}`),destinationId:"workbench.view.scm"})}catch{for(const f of Ei.S4)await(0,B.P0)(`gitlens.views.${f}.resetViewLocation`)}break}}},"SetViewsLayoutCommand");Bl=Zn([(0,B.WD)()],Bl);var Wr=Object.defineProperty,qo=Object.defineProperties,Pc=Object.getOwnPropertyDescriptor,Dc=Object.getOwnPropertyDescriptors,Po=Object.getOwnPropertySymbols,Ma=Object.prototype.hasOwnProperty,pr=Object.prototype.propertyIsEnumerable,In=n((l,u,f)=>u in l?Wr(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"searchCommits_defNormalProp"),gr=n((l,u)=>{for(var f in u||(u={}))Ma.call(u,f)&&In(l,f,u[f]);if(Po)for(var f of Po(u))pr.call(u,f)&&In(l,f,u[f]);return l},"searchCommits_spreadValues"),es=n((l,u)=>qo(l,Dc(u)),"searchCommits_spreadProps"),Ms=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Pc(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Wr(u,f,C),C},"searchCommits_decorateClass");let ka=n(class extends _.mY{constructor(l){super([r.Gh.SearchCommits,r.Gh.SearchCommitsInView]);this.container=l}preExecute(l,u){return l.type==="viewItem"?(u=gr({},u),u.showResultsInSideBar=!0,l.node instanceof qe.V5&&(u.repoPath=l.node.repoPath,u.search=l.node.search,u.prefillOnly=!0),(0,_.pT)(l)&&(u.repoPath=l.node.repo.path)):l.command===r.Gh.SearchCommitsInView&&(u=gr({},u),u.showResultsInSideBar=!0),this.execute(u)}async execute(l){await(0,R.m)({command:"search",prefillOnly:l?.prefillOnly,state:es(gr({repo:l?.repoPath},l?.search),{showResultsInSideBar:this.container.config.gitCommands.search.showResultsInSideBar??l?.showResultsInSideBar})})}},"SearchCommitsCommand");ka=Ms([(0,B.WD)()],ka);var Nl=v(3969),Ua=Object.defineProperty,Sc=Object.getOwnPropertyDescriptor,Wa=Object.getOwnPropertySymbols,ts=Object.prototype.hasOwnProperty,Rc=Object.prototype.propertyIsEnumerable,Ml=n((l,u,f)=>u in l?Ua(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"showCommitsInView_defNormalProp"),Xn=n((l,u)=>{for(var f in u||(u={}))ts.call(u,f)&&Ml(l,f,u[f]);if(Wa)for(var f of Wa(u))Rc.call(u,f)&&Ml(l,f,u[f]);return l},"showCommitsInView_spreadValues"),is=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Sc(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Ua(u,f,C),C},"showCommitsInView_decorateClass");let rs=n(class extends _.pu{constructor(l){super([r.Gh.ShowCommitInView,r.Gh.ShowCommitsInView]);this.container=l}async execute(l,u,f){if(f=Xn({},f),f.refs===void 0){if(u=(0,_.SX)(u,l),u==null)return;const H=await U.YY.fromUri(u);if(f.repoPath=H.repoPath,l!=null)try{const C=l.document.isDirty?await this.container.git.getBlameForRangeContents(H,l.selection,l.document.getText()):await this.container.git.getBlameForRange(H,l.selection);if(C===void 0)return F.V.showFileNotUnderSourceControlWarningMessage("Unable to find commits");f.refs=[...(0,St.DZ)(C.commits.values(),J=>J.isUncommitted?void 0:J.ref)]}catch(C){return O.Y.error(C,"ShowCommitsInViewCommand","getBlameForRange"),F.V.showGenericErrorMessage("Unable to find commits")}else{if(H.sha==null)return;f.refs=[H.sha]}}return(0,R.m)({command:"search",state:{repo:f?.repoPath,pattern:Nl.n.fromCommits(f.refs),showResultsInSideBar:!0}})}},"ShowCommitsInViewCommand");rs=is([(0,B.WD)()],rs);var ks=Object.defineProperty,Jn=Object.getOwnPropertyDescriptor,Us=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Jn(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&ks(u,f,C),C},"showLastQuickPick_decorateClass");let m=n(class extends _.mY{constructor(l){super(r.Gh.ShowLastQuickPick);this.container=l}execute(){const l=(0,_.l8)();if(l===void 0)return Promise.resolve(void 0);try{return k.commands.executeCommand(l.command,...l.args)}catch(u){return O.Y.error(u,"ShowLastQuickPickCommand"),F.V.showGenericErrorMessage("Unable to show last quick pick")}}},"ShowLastQuickPickCommand");m=Us([(0,B.WD)()],m);var c=Object.defineProperty,g=Object.getOwnPropertyDescriptor,G=Object.getOwnPropertySymbols,W=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable,Pe=n((l,u,f)=>u in l?c(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"showQuickBranchHistory_defNormalProp"),st=n((l,u)=>{for(var f in u||(u={}))W.call(u,f)&&Pe(l,f,u[f]);if(G)for(var f of G(u))oe.call(u,f)&&Pe(l,f,u[f]);return l},"showQuickBranchHistory_spreadValues"),$t=n((l,u,f,H)=>{for(var C=H>1?void 0:H?g(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&c(u,f,C),C},"showQuickBranchHistory_decorateClass");let Et=n(class extends _.Lk{constructor(l){super([r.Gh.ShowQuickBranchHistory,r.Gh.ShowQuickCurrentBranchHistory]);this.container=l}preExecute(l,u){return l.command===r.Gh.ShowQuickCurrentBranchHistory&&(u=st({},u),u.branch="HEAD"),this.execute(l.editor,l.uri,u)}async execute(l,u,f){var H;u=(0,_.SX)(u,l);const C=u!=null?await U.YY.fromUri(u):void 0,J=f?.repoPath??C?.repoPath??((H=this.container.git.highlander)==null?void 0:H.path);let ee;return J!=null&&(f?.branch!=null?ee=f.branch==="HEAD"?"HEAD":Oe.GitReference.create(f.branch,J,{refType:"branch",name:f.branch,remote:!1}):f?.tag!=null&&(ee=Oe.GitReference.create(f.tag,J,{refType:"tag",name:f.tag}))),(0,R.m)({command:"log",state:J!=null?{repo:J,reference:ee}:{}})}},"ShowQuickBranchHistoryCommand");Et=$t([(0,B.WD)()],Et);var _i=Object.defineProperty,ui=Object.getOwnPropertyDescriptor,Ni=Object.getOwnPropertySymbols,Mi=Object.prototype.hasOwnProperty,Ar=Object.prototype.propertyIsEnumerable,Ai=n((l,u,f)=>u in l?_i(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"showQuickCommit_defNormalProp"),mn=n((l,u)=>{for(var f in u||(u={}))Mi.call(u,f)&&Ai(l,f,u[f]);if(Ni)for(var f of Ni(u))Ar.call(u,f)&&Ai(l,f,u[f]);return l},"showQuickCommit_spreadValues"),Pn=n((l,u,f,H)=>{for(var C=H>1?void 0:H?ui(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&_i(u,f,C),C},"showQuickCommit_decorateClass");let qn=n(class extends _.Lk{constructor(l){super([r.Gh.RevealCommitInView,r.Gh.ShowQuickCommit]);this.container=l}static getMarkdownCommandArgs(l,u){const f=typeof l=="string"?{sha:l,repoPath:u}:l;return super.getMarkdownCommandArgsCore(r.Gh.ShowQuickCommit,f)}preExecute(l,u){return l.command===r.Gh.RevealCommitInView&&(u=mn({},u),u.revealInView=!0),l.type==="viewItem"&&(u=mn({},u),u.sha=l.node.uri.sha,(0,_.en)(l)&&(u.commit=l.node.commit)),this.execute(l.editor,l.uri,u)}async execute(l,u,f){var H;let C,J;if(f?.commit==null)if(f?.repoPath!=null&&f.sha!=null)J=f.repoPath,C=U.YY.fromRepoPath(J);else{if(u=(0,_.SX)(u,l),u==null)return;C=await U.YY.fromUri(u),J=C.repoPath}else f.sha==null&&(f.sha=f.commit.sha),C=f.commit.getGitUri(),J=f.commit.repoPath,u==null&&(u=(H=f.commit.file)==null?void 0:H.uri);if(f=mn({},f),f.sha==null){if(l==null)return;const ee=l.selection.active.line;if(ee<0)return;try{const ft=await this.container.git.getBlameForLine(C,ee);if(ft==null){F.V.showFileNotUnderSourceControlWarningMessage("Unable to show commit");return}if(ft.commit.isUncommitted){F.V.showLineUncommittedWarningMessage("Unable to show commit");return}f.sha=ft.commit.sha,J=ft.commit.repoPath,f.commit=ft.commit}catch(ft){O.Y.error(ft,"ShowQuickCommitCommand",`getBlameForLine(${ee})`),F.V.showGenericErrorMessage("Unable to show commit");return}}try{if((f.commit==null||f.commit.file!=null)&&(f.repoLog!=null&&(f.commit=f.repoLog.commits.get(f.sha),f.commit==null&&(f.repoLog=void 0)),f.repoLog==null&&(f.commit=await this.container.git.getCommit(J,f.sha))),f.commit==null){F.V.showCommitNotFoundWarningMessage("Unable to show commit");return}if(f.revealInView){await R.u.Commit.reveal(f.commit,{select:!0,focus:!0,expand:!0});return}await(0,R.m)({command:"show",state:{repo:J,reference:f.commit}})}catch(ee){O.Y.error(ee,"ShowQuickCommitCommand"),F.V.showGenericErrorMessage("Unable to show commit")}}},"ShowQuickCommitCommand");qn=Pn([(0,B.WD)()],qn);var La=Object.defineProperty,Oc=Object.getOwnPropertyDescriptor,Bn=Object.getOwnPropertySymbols,Kc=Object.prototype.hasOwnProperty,zc=Object.prototype.propertyIsEnumerable,Qc=n((l,u,f)=>u in l?La(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"showQuickCommitFile_defNormalProp"),kl=n((l,u)=>{for(var f in u||(u={}))Kc.call(u,f)&&Qc(l,f,u[f]);if(Bn)for(var f of Bn(u))zc.call(u,f)&&Qc(l,f,u[f]);return l},"showQuickCommitFile_spreadValues"),Pu=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Oc(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&La(u,f,C),C},"showQuickCommitFile_decorateClass");let $c=n(class extends _.Lk{constructor(l){super([r.Gh.ShowQuickCommitFile,r.Gh.ShowQuickCommitRevision,r.Gh.ShowQuickCommitRevisionInDiffLeft,r.Gh.ShowQuickCommitRevisionInDiffRight]);this.container=l}static getMarkdownCommandArgs(l){return super.getMarkdownCommandArgsCore(r.Gh.ShowQuickCommitFile,l)}async preExecute(l,u){if(l.editor!=null&&l.command.startsWith(r.Gh.ShowQuickCommitRevision)){u=kl({},u);const f=await U.YY.fromUri(l.editor.document.uri);u.sha=f.sha}return l.type==="viewItem"&&(u=kl({},u),u.sha=l.node.uri.sha,(0,_.en)(l)&&(u.commit=l.node.commit)),this.execute(l.editor,l.uri,u)}async execute(l,u,f){var H,C,J;if(u=(0,_.SX)(u,l),u==null)return;f=kl({},f);let ee;if(f.revisionUri!=null?(ee=U.YY.fromRevisionUri(k.Uri.parse(f.revisionUri,!0)),f.sha=ee.sha):ee=await U.YY.fromUri(u),f.sha==null){if(l==null)return;const ft=l.selection.active.line;if(ft<0)return;try{const kt=await this.container.git.getBlameForLine(ee,ft);if(kt==null){F.V.showFileNotUnderSourceControlWarningMessage("Unable to show commit file details");return}if(kt.commit.isUncommitted){F.V.showLineUncommittedWarningMessage("Unable to show commit file details");return}f.sha=kt.commit.sha,f.commit=kt.commit}catch(kt){O.Y.error(kt,"ShowQuickCommitFileDetailsCommand",`getBlameForLine(${ft})`),k.window.showErrorMessage("Unable to show commit file details. See output channel for more details");return}}try{if(f.commit==null&&(f.fileLog!=null&&(f.commit=f.fileLog.commits.get(f.sha),f.commit==null&&(f.fileLog=void 0)),f.fileLog==null)){const kt=((H=f.commit)==null?void 0:H.repoPath)??ee.repoPath;if(f.commit=await this.container.git.getCommitForFile(kt,ee,{ref:f.sha}),f.commit==null){F.V.showCommitNotFoundWarningMessage("Unable to show commit file details");return}}if(f.commit==null){F.V.showCommitNotFoundWarningMessage("Unable to show commit file details");return}const ft=((J=(C=f.commit)==null?void 0:C.file)==null?void 0:J.path)??ee.fsPath;Oe.GitCommit.is(f.commit)&&f.commit.files==null&&await f.commit.ensureFullDetails(),await(0,R.m)({command:"show",state:{repo:f.commit.repoPath,reference:f.commit,fileName:ft}})}catch(ft){O.Y.error(ft,"ShowQuickCommitFileDetailsCommand"),F.V.showGenericErrorMessage("Unable to show commit file details")}}},"ShowQuickCommitFileCommand");$c=Pu([(0,B.WD)()],$c);var Ul=Object.defineProperty,Do=Object.getOwnPropertyDescriptor,Ws=Object.getOwnPropertySymbols,Ga=Object.prototype.hasOwnProperty,Tc=Object.prototype.propertyIsEnumerable,So=n((l,u,f)=>u in l?Ul(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"showQuickFileHistory_defNormalProp"),Zc=n((l,u)=>{for(var f in u||(u={}))Ga.call(u,f)&&So(l,f,u[f]);if(Ws)for(var f of Ws(u))Tc.call(u,f)&&So(l,f,u[f]);return l},"showQuickFileHistory_spreadValues"),Du=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Do(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Ul(u,f,C),C},"showQuickFileHistory_decorateClass");let Xc=n(class extends _.Lk{constructor(l){super([r.Gh.OpenFileHistory,r.Gh.OpenFolderHistory,r.Gh.ShowQuickFileHistory,r.Gh.QuickOpenFileHistory,r.Gh.Deprecated_ShowFileHistoryInView]);this.container=l}preExecute(l,u){return(l.command===r.Gh.OpenFileHistory||l.command===r.Gh.OpenFolderHistory||l.command===r.Gh.Deprecated_ShowFileHistoryInView)&&(u=Zc({},u),u.showInSideBar=!0),this.execute(l.editor,l.uri,u)}async execute(l,u,f){if(u=(0,_.SX)(u,l),u==null)return;const H=await U.YY.fromUri(u);if(f?.showInSideBar){await this.container.fileHistoryView.showHistoryForUri(H);return}await(0,R.m)({command:"log",state:H?.repoPath!=null?{repo:H.repoPath,reference:f?.reference??"HEAD",fileName:H.relativePath}:{}})}},"ShowQuickFileHistoryCommand");Xc=Du([(0,B.WD)()],Xc);var Jc=Object.defineProperty,Ls=Object.getOwnPropertyDescriptor,Wl=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Ls(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Jc(u,f,C),C},"showQuickRepoStatus_decorateClass");let qc=n(class extends _.mY{constructor(l){super(r.Gh.ShowQuickRepoStatus);this.container=l}async execute(l){return(0,R.m)({command:"status",state:{repo:l?.repoPath}})}},"ShowQuickRepoStatusCommand");qc=Wl([(0,B.WD)()],qc);var Su=Object.defineProperty,Ru=Object.getOwnPropertyDescriptor,eu=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Ru(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Su(u,f,C),C},"showQuickStashList_decorateClass");let Ec=n(class extends _.mY{constructor(l){super(r.Gh.ShowQuickStashList);this.container=l}execute(l){return(0,R.m)({command:"stash",state:{subcommand:"list",repo:l?.repoPath}})}},"ShowQuickStashListCommand");Ec=eu([(0,B.WD)()],Ec);var Ou=Object.defineProperty,$u=Object.getOwnPropertyDescriptor,Fc=n((l,u,f,H)=>{for(var C=H>1?void 0:H?$u(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Ou(u,f,C),C},"showView_decorateClass");let Ac=n(class extends _.mY{constructor(l){super([r.Gh.ShowBranchesView,r.Gh.ShowCommitsView,r.Gh.ShowContributorsView,r.Gh.ShowFileHistoryView,r.Gh.ShowLineHistoryView,r.Gh.ShowRemotesView,r.Gh.ShowRepositoriesView,r.Gh.ShowSearchAndCompareView,r.Gh.ShowStashesView,r.Gh.ShowTagsView,r.Gh.ShowTimelineView,r.Gh.ShowWorktreesView,r.Gh.ShowHomeView]);this.container=l}preExecute(l){return this.execute(l.command)}async execute(l){switch(l){case r.Gh.ShowBranchesView:return this.container.branchesView.show();case r.Gh.ShowCommitsView:return this.container.commitsView.show();case r.Gh.ShowContributorsView:return this.container.contributorsView.show();case r.Gh.ShowFileHistoryView:return this.container.fileHistoryView.show();case r.Gh.ShowHomeView:return this.container.homeView.show();case r.Gh.ShowLineHistoryView:return this.container.lineHistoryView.show();case r.Gh.ShowRemotesView:return this.container.remotesView.show();case r.Gh.ShowRepositoriesView:return this.container.repositoriesView.show();case r.Gh.ShowSearchAndCompareView:return this.container.searchAndCompareView.show();case r.Gh.ShowStashesView:return this.container.stashesView.show();case r.Gh.ShowTagsView:return this.container.tagsView.show();case r.Gh.ShowTimelineView:return this.container.timelineView.show();case r.Gh.ShowWorktreesView:return this.container.worktreesView.show()}return Promise.resolve(void 0)}},"ShowViewCommand");Ac=Fc([(0,B.WD)()],Ac);var tu=Object.defineProperty,Tu=Object.defineProperties,Eu=Object.getOwnPropertyDescriptor,iu=Object.getOwnPropertyDescriptors,ru=Object.getOwnPropertySymbols,Fu=Object.prototype.hasOwnProperty,xc=Object.prototype.propertyIsEnumerable,nu=n((l,u,f)=>u in l?tu(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"stashApply_defNormalProp"),ou=n((l,u)=>{for(var f in u||(u={}))Fu.call(u,f)&&nu(l,f,u[f]);if(ru)for(var f of ru(u))xc.call(u,f)&&nu(l,f,u[f]);return l},"stashApply_spreadValues"),Ha=n((l,u)=>Tu(l,iu(u)),"stashApply_spreadProps"),Ro=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Eu(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&tu(u,f,C),C},"stashApply_decorateClass");let ns=n(class extends _.mY{constructor(l){super(r.Gh.StashApply);this.container=l}async preExecute(l,u){return(0,_.en)(l)?(l.node.commit.message==null&&await l.node.commit.ensureFullDetails(),u=Ha(ou({},u),{stashItem:l.node.commit})):(0,_.pT)(l)&&(u=Ha(ou({},u),{repoPath:l.node.repo.path})),this.execute(u)}async execute(l){var u,f;return l?.deleteAfter?R.u.Stash.pop(l?.repoPath??((u=l?.stashItem)==null?void 0:u.repoPath),l?.stashItem):R.u.Stash.apply(l?.repoPath??((f=l?.stashItem)==null?void 0:f.repoPath),l?.stashItem)}},"StashApplyCommand");ns=Ro([(0,B.WD)()],ns);var Gs=Object.defineProperty,su=Object.getOwnPropertyDescriptor,au=Object.getOwnPropertySymbols,Au=Object.prototype.hasOwnProperty,xu=Object.prototype.propertyIsEnumerable,Ic=n((l,u,f)=>u in l?Gs(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"stashSave_defNormalProp"),Va=n((l,u)=>{for(var f in u||(u={}))Au.call(u,f)&&Ic(l,f,u[f]);if(au)for(var f of au(u))xu.call(u,f)&&Ic(l,f,u[f]);return l},"stashSave_spreadValues"),Iu=n((l,u,f,H)=>{for(var C=H>1?void 0:H?su(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Gs(u,f,C),C},"stashSave_decorateClass");let Ll=n(class extends _.mY{constructor(l){super([r.Gh.StashSave,r.Gh.StashSaveFiles]);this.container=l}async preExecute(l,u){var f,H;if((0,_.E9)(l))u=Va({},u),u.repoPath=l.node.file.repoPath??l.node.repoPath,u.uris=[U.YY.fromFile(l.node.file,u.repoPath)];else if((0,_.pT)(l))u=Va({},u),u.repoPath=l.node.repo.path;else if((0,_.l7)(l))u=Va({},u),u.repoPath=l.node.repoPath;else if(l.type==="scm-states"){u=Va({},u),u.uris=l.scmResourceStates.map(J=>J.resourceUri),u.repoPath=(f=await this.container.git.getOrOpenRepository(u.uris[0]))==null?void 0:f.path;const C=await this.container.git.getStatusForRepo(u.repoPath);C?.computeWorkingTreeStatus().staged&&(l.scmResourceStates.some(J=>J.resourceGroupType===vn.Index)||(u.keepStaged=!0))}else if(l.type==="scm-groups"){u=Va({},u),u.uris=l.scmResourceGroups.reduce((J,ee)=>J.concat(ee.resourceStates.map(ft=>ft.resourceUri)),[]),u.repoPath=(H=await this.container.git.getOrOpenRepository(u.uris[0]))==null?void 0:H.path;const C=await this.container.git.getStatusForRepo(u.repoPath);C?.computeWorkingTreeStatus().staged&&(l.scmResourceGroups.some(J=>J.id==="index")||(u.keepStaged=!0))}return this.execute(u)}execute(l){return R.u.Stash.push(l?.repoPath,l?.uris,l?.message,l?.keepStaged)}},"StashSaveCommand");Ll=Iu([(0,B.WD)()],Ll);var Bc;(l=>{async function u(){if(Ki.W.instance.config.modes==null)return;const f=Ki.W.instance.config.modes,H=Object.keys(f);if(H.length===0)return;const C=Ki.W.instance.config.mode.active,J=H.map(ft=>{const kt=f[ft];return{label:`${C===ft?"$(check)\xA0\xA0":"\xA0\xA0\xA0\xA0\xA0"}${kt.name} mode`,description:kt.description?`\xA0${r.NE.Dash}\xA0 ${kt.description}`:"",key:ft}});return C&&J.splice(0,0,{label:`Exit ${f[C].name} mode`,key:void 0}),await k.window.showQuickPick(J,{placeHolder:"select a GitLens mode to enter"})}n(u,"show"),l.show=u})(Bc||(Bc={}));var Bu=Object.defineProperty,ja=Object.getOwnPropertyDescriptor,Hs=n((l,u,f,H)=>{for(var C=H>1?void 0:H?ja(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Bu(u,f,C),C},"switchMode_decorateClass");let Ya=n(class extends _.mY{constructor(l){super(r.Gh.SwitchMode);this.container=l}async execute(){var l,u;const f=O.Y.getCorrelationContext(),H=await Bc.show();if(H===void 0)return;f!=null&&(f.exitDetails=` \u2014 mode=${H.key??""}`);const C=this.container.config.mode.active;if(C!==H.key){if(C!=null&&C.length!==0){const J=(l=this.container.config.modes)==null?void 0:l[C].annotations;if(J!=null){const ee=H.key!=null?(u=this.container.config.modes)==null?void 0:u[H.key].annotations:void 0;J!==ee&&await this.container.fileAnnotations.clearAll()}}await Ei.DN.update("mode.active",H.key,k.ConfigurationTarget.Global)}}},"SwitchModeCommand");Hs([(0,uo.cM)({args:!1,correlate:!0,singleLine:!0,timed:!1})],Ya.prototype,"execute",1),Ya=Hs([(0,B.WD)()],Ya);let eo=n(class extends _.mY{constructor(l){super(r.Gh.ToggleReviewMode);this.container=l}async execute(){if(this.container.config.modes==null||!Object.keys(this.container.config.modes).includes("review"))return;const l=this.container.config.mode.active==="review"?void 0:"review";await Ei.DN.update("mode.active",l,k.ConfigurationTarget.Global)}},"ToggleReviewModeCommand");Hs([(0,uo.cM)({args:!1,singleLine:!0,timed:!1})],eo.prototype,"execute",1),eo=Hs([(0,B.WD)()],eo);let Le=n(class extends _.mY{constructor(l){super(r.Gh.ToggleZenMode);this.container=l}async execute(){if(this.container.config.modes==null||!Object.keys(this.container.config.modes).includes("zen"))return;const l=this.container.config.mode.active==="zen"?void 0:"zen";await Ei.DN.update("mode.active",l,k.ConfigurationTarget.Global)}},"ToggleZenModeCommand");Hs([(0,uo.cM)({args:!1,singleLine:!0,timed:!1})],Le.prototype,"execute",1),Le=Hs([(0,B.WD)()],Le);var Vs=Object.defineProperty,lu=Object.getOwnPropertyDescriptor,Nu=n((l,u,f,H)=>{for(var C=H>1?void 0:H?lu(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Vs(u,f,C),C},"toggleCodeLens_decorateClass");let cu=n(class extends _.mY{constructor(l){super(r.Gh.ToggleCodeLens);this.container=l}execute(){return this.container.codeLens.toggleCodeLens()}},"ToggleCodeLensCommand");cu=Nu([(0,B.WD)()],cu);var Gl=Object.defineProperty,Mu=Object.defineProperties,Hl=Object.getOwnPropertyDescriptor,Ka=Object.getOwnPropertyDescriptors,os=Object.getOwnPropertySymbols,uu=Object.prototype.hasOwnProperty,ku=Object.prototype.propertyIsEnumerable,hu=n((l,u,f)=>u in l?Gl(l,u,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[u]=f,"toggleFileAnnotations_defNormalProp"),Oo=n((l,u)=>{for(var f in u||(u={}))uu.call(u,f)&&hu(l,f,u[f]);if(os)for(var f of os(u))ku.call(u,f)&&hu(l,f,u[f]);return l},"toggleFileAnnotations_spreadValues"),Vl=n((l,u)=>Mu(l,Ka(u)),"toggleFileAnnotations_spreadProps"),to=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Hl(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Gl(u,f,C),C},"toggleFileAnnotations_decorateClass");let za=n(class extends _._l{constructor(l){super([r.Gh.ClearFileAnnotations,r.Gh.ComputingFileAnnotations]);this.container=l}async execute(l,u,f){if(l!=null&&!(0,V.PH)(l)&&f!=null&&!te.n.equals(f,l.document.uri)){const H=k.window.visibleTextEditors.find(C=>te.n.equals(f,C.document.uri));H!=null&&(l=H)}try{await this.container.fileAnnotations.clear(l)}catch(H){O.Y.error(H,"ClearFileAnnotationsCommand"),F.V.showGenericErrorMessage("Unable to clear file annotations")}}},"ClearFileAnnotationsCommand");za=to([(0,B.WD)()],za);let js=n(class extends _.pu{constructor(l){super([r.Gh.ToggleFileBlame,r.Gh.ToggleFileBlameInDiffLeft,r.Gh.ToggleFileBlameInDiffRight]);this.container=l}execute(l,u,f){return Mc(this.container,l,u,Vl(Oo({},f),{type:Ei.VP.Blame}))}},"ToggleFileBlameCommand");js=to([(0,B.WD)()],js);let Nc=n(class extends _.pu{constructor(l){super(r.Gh.ToggleFileChanges);this.container=l}execute(l,u,f){return Mc(this.container,l,u,Vl(Oo({},f),{type:Ei.VP.Changes}))}},"ToggleFileChangesCommand");Nc=to([(0,B.WD)()],Nc);let du=n(class extends _.pu{constructor(l){super([r.Gh.ToggleFileHeatmap,r.Gh.ToggleFileHeatmapInDiffLeft,r.Gh.ToggleFileHeatmapInDiffRight]);this.container=l}execute(l,u,f){return Mc(this.container,l,u,Vl(Oo({},f),{type:Ei.VP.Heatmap}))}},"ToggleFileHeatmapCommand");du=to([(0,B.WD)()],du);async function Mc(l,u,f,H){var C;if(u!=null&&!(0,V.PH)(u)&&f!=null&&!te.n.equals(f,u.document.uri)){const J=k.window.visibleTextEditors.find(ee=>te.n.equals(f,ee.document.uri));J!=null&&(u=J)}try{H=Oo({type:Ei.VP.Blame},H),await l.fileAnnotations.toggle(u,H.type,Oo({selection:((C=H.context)==null?void 0:C.selection)??{line:u?.selection.active.line}},H.context),H.on)}catch(J){O.Y.error(J,"ToggleFileAnnotationsCommand"),k.window.showErrorMessage(`Unable to toggle file ${H.type} annotations. See output channel for more details`)}}n(Mc,"toggleFileAnnotations");var kc=Object.defineProperty,Uu=Object.getOwnPropertyDescriptor,jl=n((l,u,f,H)=>{for(var C=H>1?void 0:H?Uu(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&kc(u,f,C),C},"toggleLineBlame_decorateClass");let Qa=n(class extends _.pu{constructor(l){super(r.Gh.ToggleLineBlame);this.container=l}async execute(l,u){try{await this.container.lineAnnotations.toggle(l)}catch(f){O.Y.error(f,"ToggleLineBlameCommand"),k.window.showErrorMessage("Unable to toggle line blame annotations. See output channel for more details")}}},"ToggleLineBlameCommand");Qa=jl([(0,B.WD)()],Qa);var Za=Object.defineProperty,fu=Object.getOwnPropertyDescriptor,mu=n((l,u,f,H)=>{for(var C=H>1?void 0:H?fu(u,f):u,J=l.length-1,ee;J>=0;J--)(ee=l[J])&&(C=(H?ee(u,f,C):ee(C))||C);return H&&C&&Za(u,f,C),C},"walkthroughs_decorateClass");let pu=n(class extends _.mY{constructor(l){super(r.Gh.GetStarted);this.container=l}execute(l){const u=this.container.context.extension.id;l===u&&(l=void 0),(0,V.lN)(u,l??"gitlens.welcome")}},"GetStartedCommand");pu=mu([(0,B.WD)()],pu);let gu=n(class extends _.mY{constructor(l){super(r.Gh.OpenWalkthrough);this.container=l}execute(l){const[u,f]=l?.split("|")??"gitlens.welcome";(0,V.lN)(this.container.context.extension.id,u,f)}},"OpenWalkthroughCommand");gu=mu([(0,B.WD)()],gu)},6983:(Se,ae,v)=>{"use strict";v.d(ae,{C$:()=>T,DW:()=>E,E9:()=>x,Lk:()=>ne,Mg:()=>D,O$:()=>h,Qo:()=>I,SX:()=>y,_5:()=>$,_l:()=>ge,d$:()=>L,en:()=>Y,jT:()=>V,l7:()=>j,l8:()=>ie,mY:()=>Q,pT:()=>N,pu:()=>K});var r=v(9496),B=v.n(r),_=v(2833),R=v(3422),b=Object.defineProperty,p=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,U=n((q,we,Fe)=>we in q?b(q,we,{enumerable:!0,configurable:!0,writable:!0,value:Fe}):q[we]=Fe,"__defNormalProp"),O=n((q,we)=>{for(var Fe in we||(we={}))M.call(we,Fe)&&U(q,Fe,we[Fe]);if(p)for(var Fe of p(we))z.call(we,Fe)&&U(q,Fe,we[Fe]);return q},"__spreadValues"),F=n((q,we,Fe)=>(U(q,typeof we!="symbol"?we+"":we,Fe),Fe),"__publicField");function y(q,we){var Fe;return((Fe=we?.document)==null?void 0:Fe.uri)??q}n(y,"getCommandUri");function V(q){return q.type==="timeline-item:git"}n(V,"isCommandContextGitTimelineItem");function I(q){return q.type!=="viewItem"?!1:_.GitBranch.is(q.node.branch)}n(I,"isCommandContextViewNodeHasBranch");function Y(q){return q.type!=="viewItem"?!1:_.GitCommit.is(q.node.commit)}n(Y,"isCommandContextViewNodeHasCommit");function D(q){return q.type!=="viewItem"?!1:_.GitContributor.is(q.node.contributor)}n(D,"isCommandContextViewNodeHasContributor");function x(q){if(q.type!=="viewItem")return!1;const we=q.node;return we.file!=null&&(we.file.repoPath!=null||we.repoPath!=null)}n(x,"isCommandContextViewNodeHasFile");function L(q){if(q.type!=="viewItem")return!1;const we=q.node;return we.file!=null&&_.GitCommit.is(we.commit)&&(we.file.repoPath!=null||we.repoPath!=null)}n(L,"isCommandContextViewNodeHasFileCommit");function h(q){if(q.type!=="viewItem")return!1;const we=q.node;return we.file!=null&&we.ref1!=null&&we.ref2!=null&&(we.file.repoPath!=null||we.repoPath!=null)}n(h,"isCommandContextViewNodeHasFileRefs");function E(q){return q.type==="viewItem"&&q.node instanceof R.bT}n(E,"isCommandContextViewNodeHasRef");function T(q){return q.type!=="viewItem"?!1:_.GitRemote.is(q.node.remote)}n(T,"isCommandContextViewNodeHasRemote");function N(q){return q.type!=="viewItem"?!1:q.node.repo instanceof _.Repository}n(N,"isCommandContextViewNodeHasRepository");function j(q){return q.type!=="viewItem"?!1:typeof q.node.repoPath=="string"}n(j,"isCommandContextViewNodeHasRepoPath");function $(q){return q.type!=="viewItem"?!1:_.GitTag.is(q.node.tag)}n($,"isCommandContextViewNodeHasTag");function A(q){return q==null?!1:q.id!=null&&q.label!=null&&q.resourceStates!=null&&Array.isArray(q.resourceStates)}n(A,"isScmResourceGroup");function k(q){return q==null?!1:q.resourceUri!=null}n(k,"isScmResourceState");function te(q){return q==null?!1:q.timestamp!=null&&q.label!=null}n(te,"isTimelineItem");function ce(q){return q==null?!1:te(q)&&q.ref!=null&&q.previousRef!=null&&q.message!=null}n(ce,"isGitTimelineItem");class Q{constructor(we){if(F(this,"contextParsingOptions",{expectsEditor:!1}),F(this,"_disposable"),typeof we=="string"){this._disposable=r.commands.registerCommand(we,(...Ge)=>this._execute(we,...Ge),this);return}const Fe=we.map(Ge=>r.commands.registerCommand(Ge,(...tt)=>this._execute(Ge,...tt),this));this._disposable=r.Disposable.from(...Fe)}static getMarkdownCommandArgsCore(we,Fe){return`command:${we}?${encodeURIComponent(JSON.stringify(Fe))}`}dispose(){this._disposable.dispose()}preExecute(we,...Fe){return this.execute(...Fe)}_execute(we,...Fe){const[Ge,tt]=Q.parseContext(we,O({},this.contextParsingOptions),...Fe);return this.preExecute(Ge,...tt)}static parseContext(we,Fe,...Ge){var tt,Me;let Ne,Ue=Ge[0];if(Fe.expectsEditor)if((Ue==null||Ue.id!=null&&((tt=Ue.document)==null?void 0:tt.uri)!=null)&&(Ne=Ue,Ge=Ge.slice(1),Ue=Ge[0]),Ge.length>0&&(Ue==null||Ue instanceof r.Uri)){const[Ze,...it]=Ge;if(Ze!=null){Ne==null&&(Ze.toString()===((Me=r.window.activeTextEditor)==null?void 0:Me.document.uri.toString())||we.endsWith("InDiffLeft"))&&(Ne=r.window.activeTextEditor);const rt=it[0];return rt!=null&&Array.isArray(rt)&&rt.length!==0&&rt[0]instanceof r.Uri?[{command:we,type:"uris",editor:Ne,uri:Ze,uris:rt},it.slice(1)]:[{command:we,type:"uri",editor:Ne,uri:Ze},it]}Ge=Ge.slice(1)}else Ne==null&&(Ne=r.window.activeTextEditor);if(Ue instanceof R.Re){const[Ze,...it]=Ge;return[{command:we,type:"viewItem",node:Ze,uri:Ze.uri},it]}if(k(Ue)){const Ze=[];let it=0;for(const rt of Ge){if(!k(rt))break;it++,Ze.push(rt)}return[{command:we,type:"scm-states",scmResourceStates:Ze,uri:Ze[0].resourceUri},Ge.slice(it)]}if(A(Ue)){const Ze=[];let it=0;for(const rt of Ge){if(!A(rt))break;it++,Ze.push(rt)}return[{command:we,type:"scm-groups",scmResourceGroups:Ze},Ge.slice(it)]}if(ce(Ue)){const[Ze,it,...rt]=Ge;return[{command:we,type:"timeline-item:git",item:Ze,uri:it},rt]}return[{command:we,type:"unknown",editor:Ne,uri:Ne?.document.uri},Ge]}}n(Q,"Command");class K extends Q{constructor(we){super(we);F(this,"contextParsingOptions",{expectsEditor:!0})}preExecute(we,...Fe){return this.execute(we.editor,we.uri,...Fe)}_execute(we,...Fe){return super._execute(we,void 0,...Fe)}}n(K,"ActiveEditorCommand");let Z;function ie(){return Z}n(ie,"getLastCommand");class ne extends K{constructor(we){super(we)}_execute(we,...Fe){return Z={command:we,args:Fe},super._execute(we,...Fe)}}n(ne,"ActiveEditorCachedCommand");class ge{constructor(we){F(this,"_disposable"),Array.isArray(we)||(we=[we]);const Fe=[];for(const Ge of we)Fe.push(r.commands.registerTextEditorCommand(Ge,(tt,Me,...Ne)=>this.executeCore(Ge,tt,Me,...Ne),this));this._disposable=r.Disposable.from(...Fe)}dispose(){this._disposable.dispose()}executeCore(we,Fe,Ge,...tt){return this.execute(Fe,Ge,...tt)}}n(ge,"EditorCommand")},5387:(Se,ae,v)=>{"use strict";v.d(ae,{m:()=>L,u:()=>E});var r=v(9496),B=v.n(r),_=v(1045),R=v(7778),b=v(2324),p=v(2833),M=v(8690),z=v(7042),U=v(1161),O=v(320),F=Object.defineProperty,y=Object.getOwnPropertySymbols,V=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,Y=n((T,N,j)=>N in T?F(T,N,{enumerable:!0,configurable:!0,writable:!0,value:j}):T[N]=j,"__defNormalProp"),D=n((T,N)=>{for(var j in N||(N={}))V.call(N,j)&&Y(T,j,N[j]);if(y)for(var j of y(N))I.call(N,j)&&Y(T,j,N[j]);return T},"__spreadValues"),x=n((T,N)=>{var j={};for(var $ in T)V.call(T,$)&&N.indexOf($)<0&&(j[$]=T[$]);if(T!=null&&y)for(var $ of y(T))N.indexOf($)<0&&I.call(T,$)&&(j[$]=T[$]);return j},"__objRest");async function L(T){await(0,U.P0)(_.Gh.GitCommands,T)}n(L,"executeGitCommand");function h(T){const N=typeof T=="string"?R.W.instance.git.getRepository(T):T;if(N==null)throw new Error("Repository not found");return N}n(h,"ensureRepo");var E;(T=>{async function N(Me,Ne){await(0,U.b2)(_.Gh.BrowseRepoAtRevision,void 0,{uri:Me,before:Ne?.before,openInNewWindow:Ne?.openInNewWindow})}n(N,"browseAtRevision"),T.browseAtRevision=N;function j(Me,Ne){return L({command:"cherry-pick",state:{repo:Me,references:Ne}})}n(j,"cherryPick"),T.cherryPick=j;function $(Me,Ne){return L({command:"fetch",state:{repos:Me,reference:Ne}})}n($,"fetch"),T.fetch=$;function A(Me,Ne){return L({command:"merge",state:{repo:Me,reference:Ne}})}n(A,"merge"),T.merge=A;function k(Me,Ne){return L({command:"pull",state:{repos:Me,reference:Ne}})}n(k,"pull"),T.pull=k;function te(Me,Ne,Ue){return L({command:"push",state:{repos:Me,flags:Ne?["--force"]:[],reference:Ue}})}n(te,"push"),T.push=te;function ce(Me,Ne,Ue=!0){return L({command:"rebase",state:{repo:Me,reference:Ne,flags:Ue?["--interactive"]:[]}})}n(ce,"rebase"),T.rebase=ce;function Q(Me,Ne,Ue){return L({command:"reset",confirm:Ue==null||Ue.includes("--hard"),state:{repo:Me,reference:Ne,flags:Ue}})}n(Q,"reset"),T.reset=Q;function K(Me,Ne){return L({command:"revert",state:{repo:Me,references:Ne}})}n(K,"revert"),T.revert=K;function Z(Me,Ne){return L({command:"switch",state:{repos:Me,reference:Ne}})}n(Z,"switchTo"),T.switchTo=Z;let ie;(Me=>{function Ne(rt,ut,xt){return L({command:"branch",state:{subcommand:"create",repo:rt,reference:ut,name:xt}})}n(Ne,"create"),Me.create=Ne;function Ue(rt,ut){return L({command:"branch",state:{subcommand:"delete",repo:rt,references:ut}})}n(Ue,"remove"),Me.remove=Ue;function Ze(rt,ut,xt){return L({command:"branch",state:{subcommand:"rename",repo:rt,reference:ut,name:xt}})}n(Ze,"rename"),Me.rename=Ze;async function it(rt,ut){const xt=rt.remote?R.W.instance.remotesView:R.W.instance.branchesView;return xt.canReveal?await xt.revealBranch(rt,ut):await R.W.instance.repositoriesView.revealBranch(rt,ut)}n(it,"reveal"),Me.reveal=it})(ie=T.Branch||(T.Branch={}));let ne;(Me=>{async function Ne(De,Re,Je){await T.Commit.openFile(De,Re,{preserveFocus:!0,preview:!1}),await R.W.instance.git.applyChangesToWorkingFile(b.YY.fromFile(De,Re.repoPath,Re.ref),Re.ref,Je?.ref)}n(Ne,"applyChanges"),Me.applyChanges=Ne;async function Ue(De){await r.env.clipboard.writeText(De.ref)}n(Ue,"copyIdToClipboard"),Me.copyIdToClipboard=Ue;async function Ze(De){let Re;if(p.GitCommit.is(De))Re=De,Re.message==null&&await Re.ensureFullDetails();else if(Re=await R.W.instance.git.getCommit(De.repoPath,De.ref),Re==null)return;const Je=Re.message??Re.summary;await r.env.clipboard.writeText(Je)}n(Ze,"copyMessageToClipboard"),Me.copyMessageToClipboard=Ze;async function it(De,Re,Je){let mt,vt;if(p.GitCommit.is(De)?(De.files==null&&await De.ensureFullDetails(),mt=De.files??[],vt={repoPath:De.repoPath,ref1:De.unresolvedPreviousSha,ref2:De.sha},Je=Re):(mt=De,vt=Re),mt.length>10){const ot=await r.window.showWarningMessage(`Are your sure you want to open the changes for all ${mt.length} files?`,{title:"Yes"},{title:"No",isCloseAffordance:!0});if(ot==null||ot.title==="No")return}Je=D({preserveFocus:!0,preview:!1},Je);for(const ot of mt)await xt(ot,vt,Je)}n(it,"openAllChanges"),Me.openAllChanges=it;async function rt(De,Re){let Je;if(p.GitCommit.is(De)?(De.files==null&&await De.ensureFullDetails(),Je=De.files??[],Re={repoPath:De.repoPath,ref:De.sha}):Je=De,Je.length>10){const mt=await r.window.showWarningMessage(`Are your sure you want to open the changes for all ${Je.length} files?`,{title:"Yes"},{title:"No",isCloseAffordance:!0});if(mt==null||mt.title==="No")return}for(const mt of Je)Ft(mt,Re)}n(rt,"openAllChangesWithDiffTool"),Me.openAllChangesWithDiffTool=rt;async function ut(De,Re,Je){let mt,vt;if(p.GitCommit.is(De)?(De.files==null&&await De.ensureFullDetails(),mt=De.files??[],vt={repoPath:De.repoPath,ref:De.sha},Je=Re):(mt=De,vt=Re),mt.length>10){const ot=await r.window.showWarningMessage(`Are your sure you want to open the changes for all ${mt.length} files?`,{title:"Yes"},{title:"No",isCloseAffordance:!0});if(ot==null||ot.title==="No")return}Je=D({preserveFocus:!0,preview:!1},Je);for(const ot of mt)await Ee(ot,vt,Je)}n(ut,"openAllChangesWithWorking"),Me.openAllChangesWithWorking=ut;async function xt(De,Re,Je){if(typeof De=="string"){if(!p.GitCommit.is(Re))throw new Error("Invalid arguments");const Zt=await Re.findFile(De);if(Zt==null)throw new Error("Invalid arguments");De=Zt}if(De.status==="A")return;const mt=p.GitCommit.is(Re)?{repoPath:Re.repoPath,ref1:Re.unresolvedPreviousSha,ref2:Re.sha}:Re;Je=D({preserveFocus:!0,preview:!1},Je);const vt=b.YY.fromFile(De,mt.repoPath),ot=De.status==="R"||De.status==="C"?b.YY.fromFile(De,mt.repoPath,mt.ref2,!0):vt;await(0,U.P0)(_.Gh.DiffWith,{repoPath:mt.repoPath,lhs:{uri:vt,sha:mt.ref1},rhs:{uri:ot,sha:mt.ref2},showOptions:Je})}n(xt,"openChanges"),Me.openChanges=xt;async function Ft(De,Re,Je){if(typeof De=="string"){if(!p.GitCommit.is(Re))throw new Error("Invalid arguments");const mt=await Re.findFile(De);if(mt==null)throw new Error("Invalid arguments");De=mt}return R.W.instance.git.openDiffTool(Re.repoPath,b.YY.fromFile(De,De.repoPath??Re.repoPath),{ref1:p.GitRevision.isUncommitted(Re.ref)?"":`${Re.ref}^`,ref2:p.GitRevision.isUncommitted(Re.ref)?"":Re.ref,staged:p.GitRevision.isUncommittedStaged(Re.ref)||De.indexStatus!=null,tool:Je})}n(Ft,"openChangesWithDiffTool"),Me.openChangesWithDiffTool=Ft;async function Ee(De,Re,Je){if(typeof De=="string"){if(!p.GitCommit.is(Re))throw new Error("Invalid arguments");const vt=await Re.findFile(De);if(vt==null)throw new Error("Invalid arguments");De=vt}if(De.status==="D")return;let mt;p.GitCommit.is(Re)?mt={repoPath:Re.repoPath,ref:Re.sha}:mt=Re,Je=D({preserveFocus:!0,preview:!1},Je),await(0,U.b2)(_.Gh.DiffWithWorking,void 0,{uri:b.YY.fromFile(De,mt.repoPath,mt.ref),showOptions:Je})}n(Ee,"openChangesWithWorking"),Me.openChangesWithWorking=Ee;async function $e(De,Re,Je,mt){return R.W.instance.git.openDirectoryCompare(De,Re,Je,mt)}n($e,"openDirectoryCompare"),Me.openDirectoryCompare=$e;async function lt(De){return $e(De.repoPath,De.ref,`${De.ref}^`)}n(lt,"openDirectoryCompareWithPrevious"),Me.openDirectoryCompareWithPrevious=lt;async function ht(De){return $e(De.repoPath,De.ref,void 0)}n(ht,"openDirectoryCompareWithWorking"),Me.openDirectoryCompareWithWorking=ht;async function St(De,Re,Je){let mt;if(De instanceof r.Uri)mt=De,Je=Re;else{const vt=Re;mt=b.YY.fromFile(De,vt.repoPath,vt.ref)}Je=D({preserveFocus:!0,preview:!1},Je),await(0,U.b2)(_.Gh.OpenWorkingFile,void 0,{uri:mt,showOptions:Je})}n(St,"openFile"),Me.openFile=St;async function Ut(De,Re,Je){let mt;if(De instanceof r.Uri){if(p.GitCommit.is(Re))throw new Error("Invalid arguments");mt=De,Je=Re}else{if(!p.GitCommit.is(Re))throw new Error("Invalid arguments");const Ht=Re;let Rt;if(typeof De=="string"){const Pi=await Ht.findFile(De);if(Pi==null)throw new Error("Invalid arguments");Rt=Pi}else Rt=De;mt=R.W.instance.git.getRevisionUri(Rt.status==="D"?await Ht.getPreviousSha()??p.GitRevision.deletedOrMissing:Ht.sha,Rt,Ht.repoPath)}const vt=D({preserveFocus:!0,preview:!1},Je),{annotationType:ot,line:Zt}=vt,Ri=x(vt,["annotationType","line"]);Zt!=null&&Zt!==0&&(Ri.selection=new r.Range(Zt,0,Zt,0));const Oi=await(0,O.GR)(mt,Ri);ot!=null&&Oi!=null&&await R.W.instance.fileAnnotations.show(Oi,ot,{selection:{line:Zt}})}n(Ut,"openFileAtRevision"),Me.openFileAtRevision=Ut;async function ri(De,Re,Je){let mt;if(p.GitCommit.is(De)?(De.files==null&&await De.ensureFullDetails(),mt=De.files??[],Re=De.repoPath,Je=De.sha):mt=De,mt.length>10){const ot=await r.window.showWarningMessage(`Are your sure you want to open all ${mt.length} files?`,{title:"Yes"},{title:"No",isCloseAffordance:!0});if(ot==null||ot.title==="No")return}const vt=(await Promise.all(mt.map(ot=>R.W.instance.git.getWorkingUri(Re,b.YY.fromFile(ot,Re,Je))))).filter(ot=>Boolean(ot));(0,O.$_)(vt)}n(ri,"openFiles"),Me.openFiles=ri;async function We(De,Re,Je,mt){let vt;if(p.GitCommit.is(De)?(De.files==null&&await De.ensureFullDetails(),vt=De.files??[],Re=De.repoPath,Je=De.sha,mt=await De.getPreviousSha()):vt=De,vt.length>10){const ot=await r.window.showWarningMessage(`Are your sure you want to open all ${vt.length} file revisions?`,{title:"Yes"},{title:"No",isCloseAffordance:!0});if(ot==null||ot.title==="No")return}(0,O.$_)(vt.map(ot=>R.W.instance.git.getRevisionUri(ot.status==="D"?mt:Je,ot,Re)))}n(We,"openFilesAtRevision"),Me.openFilesAtRevision=We;async function le(De,Re){let Je,mt;typeof De=="string"?(Je=De,mt=Re.ref):(Je=De.path,mt=De.status==="D"?`${Re.ref}^`:Re.ref),await R.W.instance.git.checkout(Re.repoPath,mt,{path:Je})}n(le,"restoreFile"),Me.restoreFile=le;async function Ae(De,Re){const Je=[R.W.instance.commitsView,R.W.instance.branchesView,R.W.instance.remotesView];for(const mt of Je){const vt=mt.canReveal?await mt.revealCommit(De,Re):await R.W.instance.repositoriesView.revealCommit(De,Re);if(vt!=null)return vt}}n(Ae,"reveal"),Me.reveal=Ae})(ne=T.Commit||(T.Commit={}));let ge;(Me=>{function Ne(Ze,it){return L({command:"co-authors",state:{repo:Ze,contributors:it}})}n(Ne,"addAuthors"),Me.addAuthors=Ne;async function Ue(Ze,it){const rt=R.W.instance.contributorsView;return rt.canReveal?await rt.revealContributor(Ze,it):await R.W.instance.repositoriesView.revealContributor(Ze,it)}n(Ue,"reveal"),Me.reveal=Ue})(ge=T.Contributor||(T.Contributor={}));let q;(Me=>{async function Ne(rt){if(rt==null&&(rt=R.W.instance.git.highlander,rt==null)){const Ft=await M.I.show(void 0,"Choose a repository to add a remote to");if(rt=Ft?.item,rt==null)return}const ut=await r.window.showInputBox({prompt:"Please provide a name for the remote",placeHolder:"Remote name",value:void 0,ignoreFocusOut:!0});if(ut==null||ut.length===0)return;const xt=await r.window.showInputBox({prompt:"Please provide the repository url for the remote",placeHolder:"Remote repository url",value:void 0,ignoreFocusOut:!0});if(!(xt==null||xt.length===0))return rt=h(rt),await R.W.instance.git.addRemote(rt.path,ut,xt),await rt.fetch({remote:ut}),ut}n(Ne,"add"),Me.add=Ne;async function Ue(rt,ut){if(typeof rt=="string"){const xt=R.W.instance.git.getRepository(rt);if(xt==null)return;rt=xt}await rt.fetch({remote:ut})}n(Ue,"fetch2"),Me.fetch=Ue;async function Ze(rt,ut){await R.W.instance.git.pruneRemote(typeof rt=="string"?rt:rt.path,ut)}n(Ze,"prune"),Me.prune=Ze;async function it(rt,ut){const xt=R.W.instance.remotesView;return xt.canReveal?await xt.revealRemote(rt,ut):await R.W.instance.repositoriesView.revealRemote(rt,ut)}n(it,"reveal"),Me.reveal=it})(q=T.Remote||(T.Remote={}));let we;(Me=>{async function Ne(Ue,Ze,it){return Ze?.canReveal?await Ze.revealRepository(Ue,it):await R.W.instance.repositoriesView.revealRepository(Ue,it)}n(Ne,"reveal"),Me.reveal=Ne})(we=T.Repository||(T.Repository={}));let Fe;(Me=>{function Ne(ut,xt){return L({command:"stash",state:{subcommand:"apply",repo:ut,reference:xt}})}n(Ne,"apply"),Me.apply=Ne;function Ue(ut,xt){return L({command:"stash",state:{subcommand:"drop",repo:ut,reference:xt}})}n(Ue,"drop"),Me.drop=Ue;function Ze(ut,xt){return L({command:"stash",state:{subcommand:"pop",repo:ut,reference:xt}})}n(Ze,"pop"),Me.pop=Ze;function it(ut,xt,Ft,Ee=!1){return L({command:"stash",state:{subcommand:"push",repo:ut,uris:xt,message:Ft,flags:Ee?["--keep-index"]:void 0}})}n(it,"push2"),Me.push=it;async function rt(ut,xt){const Ft=R.W.instance.stashesView;return Ft.canReveal?await Ft.revealStash(ut,xt):await R.W.instance.repositoriesView.revealStash(ut,xt)}n(rt,"reveal"),Me.reveal=rt})(Fe=T.Stash||(T.Stash={}));let Ge;(Me=>{function Ne(it,rt,ut){return L({command:"tag",state:{subcommand:"create",repo:it,reference:rt,name:ut}})}n(Ne,"create"),Me.create=Ne;function Ue(it,rt){return L({command:"tag",state:{subcommand:"delete",repo:it,references:rt}})}n(Ue,"remove"),Me.remove=Ue;async function Ze(it,rt){const ut=R.W.instance.tagsView;return ut.canReveal?await ut.revealTag(it,rt):await R.W.instance.repositoriesView.revealTag(it,rt)}n(Ze,"reveal"),Me.reveal=Ze})(Ge=T.Tag||(T.Tag={}));let tt;(Me=>{function Ne(ut,xt,Ft){return L({command:"worktree",state:{subcommand:"create",repo:ut,uri:xt,reference:Ft}})}n(Ne,"create"),Me.create=Ne;function Ue(ut,xt){return(0,O.ic)(ut.uri,xt)}n(Ue,"open"),Me.open=Ue;function Ze(ut,xt){return L({command:"worktree",state:{subcommand:"delete",repo:ut,uris:(0,z.zx)(xt)}})}n(Ze,"remove"),Me.remove=Ze;async function it(ut,xt){const Ft=R.W.instance.worktreesView;return Ft.canReveal?await Ft.revealWorktree(ut,xt):await R.W.instance.repositoriesView.revealWorktree(ut,xt)}n(it,"reveal"),Me.reveal=it;async function rt(ut){await(0,U.dO)(_.nA.RevealInFileExplorer,ut.uri)}n(rt,"revealInFileExplorer"),Me.revealInFileExplorer=rt})(tt=T.Worktree||(T.Worktree={}))})(E||(E={}))},9268:(Se,ae,v)=>{"use strict";v.d(ae,{K:()=>Ao,I:()=>$r});var r=v(2078),B=v(1045),_=v(313),R=v(6410),b=v(9496),p=v(2833),M=Object.defineProperty,z=Object.defineProperties,U=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,F=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,V=n((Be,a,P)=>a in Be?M(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"__defNormalProp"),I=n((Be,a)=>{for(var P in a||(a={}))F.call(a,P)&&V(Be,P,a[P]);if(O)for(var P of O(a))y.call(a,P)&&V(Be,P,a[P]);return Be},"__spreadValues"),Y=n((Be,a)=>z(Be,U(a)),"__spreadProps"),D;(Be=>{function a(P,de,me,fe){return Y(I({},me),{item:de,picked:x(P,de),context:fe})}n(a,"create"),Be.create=a})(D||(D={}));function x(Be,a){return a===void 0?Be.length===0:Array.isArray(a)?a.length===0?Be.length===0:a.every(P=>Be.includes(P)):Be.includes(a)}n(x,"hasFlags");var L=v(2971),h=v(3222),E=Object.defineProperty,T=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable,$=n((Be,a,P)=>a in Be?E(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"branch_defNormalProp"),A=n((Be,a)=>{for(var P in a||(a={}))N.call(a,P)&&$(Be,P,a[P]);if(T)for(var P of T(a))j.call(a,P)&&$(Be,P,a[P]);return Be},"branch_spreadValues"),k=n((Be,a,P)=>($(Be,typeof a!="symbol"?a+"":a,P),P),"__publicField");function te(Be){if(!(Be.repo instanceof p.Repository&&Be.subcommand==="create"))throw new Error("Missing repository")}n(te,"assertStateStepCreate");function ce(Be){if(!(Be.repo instanceof p.Repository&&Be.subcommand==="delete"))throw new Error("Missing repository")}n(ce,"assertStateStepDelete");function Q(Be){if(!(Be.repo instanceof p.Repository&&Be.subcommand==="rename"))throw new Error("Missing repository")}n(Q,"assertStateStepRename");function K(Be){if(!Array.isArray(Be.references))throw new Error("Missing branches")}n(K,"assertStateStepDeleteBranches");const Z=new Map([["create","Create"],["delete","Delete"],["rename","Rename"]]);function ie(Be,a){return a==null?Be:`${Z.get(a)} ${Be}`}n(ie,"getTitle");class ne extends h.tR{constructor(a,P){super(a,"branch","branch","Branch",{description:"create, rename, or delete branches"});k(this,"subcommand");var de,me;let fe=0;if(((de=P?.state)==null?void 0:de.subcommand)!=null)switch(fe++,P?.state.subcommand){case"create":P.state.reference!=null&&fe++,P.state.name!=null&&fe++;break;case"delete":P.state.references!=null&&(!Array.isArray(P.state.references)||P.state.references.length!==0)&&fe++;break;case"rename":P.state.reference!=null&&fe++,P.state.name!=null&&fe++;break}((me=P?.state)==null?void 0:me.repo)!=null&&fe++,this.initialState=A({counter:fe,confirm:P?.confirm},P?.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 P={associatedView:this.container.branchesView,repos:this.container.git.openRepositories,showTags:!1,title:this.title};let de=!1;for(;this.canStepsContinue(a);){if(P.title=this.title,a.counter<1||a.subcommand==null){this.subcommand=void 0;const me=yield*this.pickSubcommandStep(a);if(me===h.oo.Break)break;a.subcommand=me}if(this.subcommand=a.subcommand,P.title=ie(a.subcommand==="delete"?"Branches":this.title,a.subcommand),a.counter<2||a.repo==null||typeof a.repo=="string")if(de=!1,P.repos.length===1)de=!0,a.counter++,a.repo=P.repos[0];else{const me=yield*(0,h.lA)(a,P);if(me===h.oo.Break)continue;a.repo=me}switch(a.subcommand){case"create":te(a),yield*this.createCommandSteps(a,P),a.name=void 0;break;case"delete":ce(a),yield*this.deleteCommandSteps(a,P);break;case"rename":Q(a),yield*this.renameCommandSteps(a,P),a.name=void 0;break;default:h.tR.endSteps(a);break}de&&a.counter--}return a.counter<0?h.oo.Break:void 0}*pickSubcommandStep(a){const P=h.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:[b.QuickInputButtons.Back]}),de=yield P;return h.tR.canPickStepContinue(P,a,de)?de[0].item:h.oo.Break}async*createCommandSteps(a,P){var de,me;for(a.flags==null&&(a.flags=[]);this.canStepsContinue(a);){if(a.counter<3||a.reference==null){const fe=yield*(0,h.Yv)(a,P,{placeholder:He=>`Choose a branch${He.showTags?" or tag":""} to create the new branch from`,picked:((de=a.reference)==null?void 0:de.ref)??((me=await a.repo.getBranch())==null?void 0:me.ref),titleContext:" from",value:p.GitReference.isRevision(a.reference)?a.reference.ref:void 0});if(fe===h.oo.Break)break;a.reference=fe}if(a.counter<4||a.name==null){const fe=yield*(0,h.f6)(a,P,{placeholder:"Please provide a name for the new branch",titleContext:` from ${p.GitReference.toString(a.reference,{capitalize:!0,icon:!1,label:a.reference.refType!=="branch"})}`,value:a.name??p.GitReference.getNameWithoutRemote(a.reference)});if(fe===h.oo.Break)continue;a.name=fe}if(this.confirm(a.confirm)){const fe=yield*this.createCommandConfirmStep(a,P);if(fe===h.oo.Break)continue;a.flags=fe}h.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,P){const de=h.tR.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[D.create(a.flags,[],{label:P.title,detail:`Will create a new branch named ${a.name} from ${p.GitReference.toString(a.reference)}`}),D.create(a.flags,["--switch"],{label:`${P.title} and Switch`,description:"--switch",detail:`Will create and switch to a new branch named ${a.name} from ${p.GitReference.toString(a.reference)}`})],P),me=yield de;return h.tR.canPickStepContinue(de,a,me)?me[0].item:h.oo.Break}async*deleteCommandSteps(a,P){var de;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){P.title=ie("Branches",a.subcommand);const fe=yield*(0,h.FO)(a,P,{filter:He=>!He.current,picked:(de=a.references)==null?void 0:de.map(He=>He.ref),placeholder:"Choose branches to delete",sort:{current:!1,missingUpstream:!0}});if(fe===h.oo.Break)break;a.references=fe}P.title=ie((0,L._6)("Branch",a.references.length,{only:!0,plural:"Branches"}),a.subcommand),K(a);const me=yield*this.deleteCommandConfirmStep(a,P);me!==h.oo.Break&&(a.flags=me,h.tR.endSteps(a),a.repo.branchDelete(a.references,{force:a.flags.includes("--force"),remote:a.flags.includes("--remotes")}))}}*deleteCommandConfirmStep(a,P){const de=[D.create(a.flags,[],{label:P.title,detail:`Will delete ${p.GitReference.toString(a.references)}`})];a.references.every(He=>He.remote)||(de.push(D.create(a.flags,["--force"],{label:`Force ${P.title}`,description:"--force",detail:`Will forcibly delete ${p.GitReference.toString(a.references)}`})),a.references.some(He=>He.upstream!=null)&&de.push(D.create(a.flags,["--remotes"],{label:`${P.title} & Remote${a.references.filter(He=>!He.remote).length>1?"s":""}`,description:"--remotes",detail:`Will delete ${p.GitReference.toString(a.references)} and any remote tracking branches`}),D.create(a.flags,["--force","--remotes"],{label:`Force ${P.title} & Remote${a.references.filter(He=>!He.remote).length>1?"s":""}`,description:"--force --remotes",detail:`Will forcibly delete ${p.GitReference.toString(a.references)} and any remote tracking branches`})));const me=h.tR.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),de,P),fe=yield me;return h.tR.canPickStepContinue(me,a,fe)?fe[0].item:h.oo.Break}async*renameCommandSteps(a,P){var de;for(a.flags==null&&(a.flags=[]);this.canStepsContinue(a);){if(a.counter<3||a.reference==null){const fe=yield*(0,h.sd)(a,P,{filter:He=>!He.remote,picked:(de=a.reference)==null?void 0:de.ref,placeholder:"Choose a branch to rename"});if(fe===h.oo.Break)break;a.reference=fe}if(a.counter<4||a.name==null){const fe=yield*(0,h.f6)(a,P,{placeholder:`Please provide a new name for ${p.GitReference.toString(a.reference,{icon:!1})}`,titleContext:` ${p.GitReference.toString(a.reference,!1)}`,value:a.name??a.reference.name});if(fe===h.oo.Break)continue;a.name=fe}const me=yield*this.renameCommandConfirmStep(a,P);me!==h.oo.Break&&(a.flags=me,h.tR.endSteps(a),a.repo.branch(...a.flags,a.reference.ref,a.name))}}*renameCommandConfirmStep(a,P){const de=h.tR.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[D.create(a.flags,["-m"],{label:P.title,detail:`Will rename ${p.GitReference.toString(a.reference)} to ${a.name}`})],P),me=yield de;return h.tR.canPickStepContinue(de,a,me)?me[0].item:h.oo.Break}}n(ne,"BranchGitCommand");var ge=Object.defineProperty,q=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,Fe=Object.prototype.propertyIsEnumerable,Ge=n((Be,a,P)=>a in Be?ge(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"cherry_pick_defNormalProp"),tt=n((Be,a)=>{for(var P in a||(a={}))we.call(a,P)&&Ge(Be,P,a[P]);if(q)for(var P of q(a))Fe.call(a,P)&&Ge(Be,P,a[P]);return Be},"cherry_pick_spreadValues");class Me extends h.tR{constructor(a,P){super(a,"cherry-pick","cherry-pick","Cherry Pick",{description:"integrates changes from specified commits into the current branch"});var de,me;let fe=0;((de=P?.state)==null?void 0:de.repo)!=null&&fe++,((me=P?.state)==null?void 0:me.references)!=null&&(!Array.isArray(P.state.references)||P.state.references.length!==0)&&fe++,this.initialState=tt({counter:fe,confirm:!0},P?.state)}get canSkipConfirm(){return!1}execute(a){a.repo.cherryPick(...a.flags,...a.references.map(P=>P.ref).reverse())}isFuzzyMatch(a){return super.isFuzzyMatch(a)||a==="cherry"}async*steps(a){var P,de,me,fe;const He={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 ze=!1;for(;this.canStepsContinue(a);){if(He.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(ze=!1,He.repos.length===1)ze=!0,a.repo==null&&a.counter++,a.repo=He.repos[0];else{const Ye=yield*(0,h.lA)(a,He);if(Ye===h.oo.Break)break;a.repo=Ye}if(He.destination==null){const Ye=await a.repo.getBranch();if(Ye==null)break;He.destination=Ye}if(He.title=`${this.title} into ${p.GitReference.toString(He.destination,{icon:!1})}`,a.counter<2||a.references==null||a.references.length===0){const Ye=yield*(0,h.Yv)(a,He,{filter:{branches:yt=>yt.id!==He.destination.id},placeholder:yt=>`Choose a branch${yt.showTags?" or tag":""} to cherry-pick from`,picked:(P=He.selectedBranchOrTag)==null?void 0:P.ref,value:He.selectedBranchOrTag==null?(me=(de=a.references)==null?void 0:de[0])==null?void 0:me.ref:void 0});if(Ye===h.oo.Break){ze&&a.counter--;continue}p.GitReference.isRevision(Ye)?(a.references=[Ye],He.selectedBranchOrTag=void 0):He.selectedBranchOrTag=Ye}if(a.counter<3&&He.selectedBranchOrTag!=null){const Ye=p.GitRevision.createRange(He.destination.ref,He.selectedBranchOrTag.ref);let yt=He.cache.get(Ye);yt==null&&(yt=this.container.git.getLog(a.repo.path,{ref:Ye,merges:!1}),He.cache.set(Ye,yt));const zt=yield*(0,h.Rj)(a,He,{log:await yt,onDidLoadMore:mi=>He.cache.set(Ye,Promise.resolve(mi)),picked:(fe=a.references)==null?void 0:fe.map(mi=>mi.ref),placeholder:(mi,Ji)=>Ji==null?`No pickable commits found on ${p.GitReference.toString(mi.selectedBranchOrTag,{icon:!1})}`:`Choose commits to cherry-pick into ${p.GitReference.toString(mi.destination,{icon:!1})}`});if(zt===h.oo.Break)continue;a.references=zt}if(this.confirm(a.confirm)){const Ye=yield*this.confirmStep(a,He);if(Ye===h.oo.Break)continue;a.flags=Ye}h.tR.endSteps(a),this.execute(a)}return a.counter<0?h.oo.Break:void 0}*confirmStep(a,P){const de=h.tR.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[D.create(a.flags,[],{label:this.title,detail:`Will apply ${p.GitReference.toString(a.references)} to ${p.GitReference.toString(P.destination)}`}),D.create(a.flags,["--edit"],{label:`${this.title} & Edit`,description:"--edit",detail:`Will edit and apply ${p.GitReference.toString(a.references)} to ${p.GitReference.toString(P.destination)}`}),D.create(a.flags,["--no-commit"],{label:`${this.title} without Committing`,description:"--no-commit",detail:`Will apply ${p.GitReference.toString(a.references)} to ${p.GitReference.toString(P.destination)} without Committing`})],P),me=yield de;return h.tR.canPickStepContinue(de,a,me)?me[0].item:h.oo.Break}}n(Me,"CherryPickGitCommand");var Ne=v(1161),Ue=v(516),Ze=Object.defineProperty,it=Object.getOwnPropertySymbols,rt=Object.prototype.hasOwnProperty,ut=Object.prototype.propertyIsEnumerable,xt=n((Be,a,P)=>a in Be?Ze(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"coauthors_defNormalProp"),Ft=n((Be,a)=>{for(var P in a||(a={}))rt.call(a,P)&&xt(Be,P,a[P]);if(it)for(var P of it(a))ut.call(a,P)&&xt(Be,P,a[P]);return Be},"coauthors_spreadValues");class Ee extends h.tR{constructor(a,P){super(a,"co-authors","co-authors","Add Co-Authors",{description:"adds co-authors to a commit message"});var de,me;let fe=0;((de=P?.state)==null?void 0:de.repo)!=null&&fe++,((me=P?.state)==null?void 0:me.contributors)!=null&&(!Array.isArray(P.state.contributors)||P.state.contributors.length!==0)&&fe++,this.initialState=Ft({counter:fe,confirm:!1},P?.state)}get canConfirm(){return!1}async execute(a){const P=await this.container.git.getOrOpenScmRepository(a.repo.path);if(P==null)return;let de=P.inputBox.value;const me=de.indexOf("Co-authored-by: ");me!==-1&&(de=de.substring(0,me-1).trimRight()),a.contributors!=null&&!Array.isArray(a.contributors)&&(a.contributors=[a.contributors]);for(const fe of a.contributors){let He;de.includes("Co-authored-by: ")?He=` `:de.length!==0&&de.endsWith(` `)?He=` `:He=` `,de+=`${He}Co-authored-by: ${fe.getCoauthor()}`}P.inputBox.value=de,await(0,Ne.dO)(B.nA.ShowSCM)}async*steps(a){const P={repos:this.container.git.openRepositories,activeRepo:void 0,associatedView:this.container.contributorsView,title:this.title},de=await this.container.git.getOpenScmRepositories();de.length&&(P.repos=P.repos.filter(fe=>de.find(He=>(0,Ue.AH)(He.rootUri.fsPath)===fe.path)),P.activeRepo=await this.container.git.getOrOpenRepositoryForEditor(),P.activeRepo!=null&&!de.some(fe=>fe.rootUri.fsPath===P.activeRepo.path)&&(P.activeRepo=void 0));let me=!1;for(;this.canStepsContinue(a);){if(P.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(me=!1,P.repos.length===1)me=!0,a.repo==null&&a.counter++,a.repo=P.repos[0];else{const fe=yield*(0,h.lA)(a,P);if(fe===h.oo.Break)break;a.repo=fe}if(a.counter<2||a.contributors==null){const fe=yield*(0,h.bR)(a,P,"Choose contributors to add as co-authors");if(fe===h.oo.Break){me&&a.counter--;continue}a.contributors=fe}h.tR.endSteps(a),this.execute(a)}return a.counter<0?h.oo.Break:void 0}}n(Ee,"CoAuthorsGitCommand");var $e=v(7042),lt=v(6277),ht=Object.defineProperty,St=Object.getOwnPropertySymbols,Ut=Object.prototype.hasOwnProperty,ri=Object.prototype.propertyIsEnumerable,We=n((Be,a,P)=>a in Be?ht(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"fetch_defNormalProp"),le=n((Be,a)=>{for(var P in a||(a={}))Ut.call(a,P)&&We(Be,P,a[P]);if(St)for(var P of St(a))ri.call(a,P)&&We(Be,P,a[P]);return Be},"fetch_spreadValues");class Ae extends h.tR{constructor(a,P){super(a,"fetch","fetch","Fetch",{description:"fetches changes from one or more remotes"});var de;let me=0;((de=P?.state)==null?void 0:de.repos)!=null&&(!Array.isArray(P.state.repos)||P.state.repos.length!==0)&&me++,this.initialState=le({counter:me,confirm:P?.confirm},P?.state)}execute(a){return p.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 P={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 de=!1;for(;this.canStepsContinue(a);){if(P.title=this.title,a.counter<1||a.repos==null||a.repos.length===0||(0,$e.GI)(a.repos))if(de=!1,P.repos.length===1)de=!0,a.counter++,a.repos=[P.repos[0]];else{const me=yield*(0,h.j8)(a,P,{skipIfPossible:a.counter>=1});if(me===h.oo.Break)break;a.repos=me}if(this.confirm(a.confirm)){const me=yield*this.confirmStep(a,P);if(me===h.oo.Break){de&&a.counter--;continue}a.flags=me}h.tR.endSteps(a),this.execute(a)}return a.counter<0?h.oo.Break:void 0}async*confirmStep(a,P){let de="";if(a.repos.length===1){const He=await a.repos[0].getLastFetched();He!==0&&(de=`${(0,L.vk)(B.NE.Dot,2,2)}Last fetched ${(0,lt.Zh)(new Date(He))}`)}let me;if(a.repos.length===1&&p.GitReference.isBranch(a.reference))me=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P,de),[D.create(a.flags,[],{label:this.title,detail:`Will fetch ${p.GitReference.toString(a.reference)}`})]);else{const He=a.repos.length===1?`$(repo) ${a.repos[0].formattedName}`:`${a.repos.length} repositories`;me=h.tR.createConfirmStep((0,h.C8)(`Confirm ${this.title}`,a,P,de),[D.create(a.flags,[],{label:this.title,detail:`Will fetch ${He}`}),D.create(a.flags,["--prune"],{label:`${this.title} & Prune`,description:"--prune",detail:`Will fetch and prune ${He}`}),D.create(a.flags,["--all"],{label:`${this.title} All`,description:"--all",detail:`Will fetch all remotes of ${He}`}),D.create(a.flags,["--all","--prune"],{label:`${this.title} All & Prune`,description:"--all --prune",detail:`Will fetch and prune all remotes of ${He}`})],P)}const fe=yield me;return h.tR.canPickStepContinue(me,a,fe)?fe[0].item:h.oo.Break}}n(Ae,"FetchGitCommand");var De=v(1677),Re=Object.defineProperty,Je=Object.getOwnPropertySymbols,mt=Object.prototype.hasOwnProperty,vt=Object.prototype.propertyIsEnumerable,ot=n((Be,a,P)=>a in Be?Re(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"log_defNormalProp"),Zt=n((Be,a)=>{for(var P in a||(a={}))mt.call(a,P)&&ot(Be,P,a[P]);if(Je)for(var P of Je(a))vt.call(a,P)&&ot(Be,P,a[P]);return Be},"log_spreadValues");function Ri(Be){if(!(Be.repo instanceof p.Repository))throw new Error("Missing repository")}n(Ri,"assertStateStepRepository");class Oi extends h.tR{constructor(a,P){super(a,"log","history","Commits",{description:"aka log, shows commit history"});var de,me;let fe=0;((de=P?.state)==null?void 0:de.repo)!=null&&fe++,((me=P?.state)==null?void 0:me.reference)!=null&&(fe++,P.state.reference!=="HEAD"&&p.GitReference.isRevision(P.state.reference)&&!p.GitReference.isRevisionRange(P.state.reference)&&fe++),this.initialState=Zt({counter:fe,confirm:!1},P?.state)}get canConfirm(){return!1}isFuzzyMatch(a){return super.isFuzzyMatch(a)||a==="log"}async*steps(a){var P,de,me;const fe={repos:this.container.git.openRepositories,associatedView:this.container.commitsView,cache:new Map,selectedBranchOrTag:void 0,title:this.title};let He=!1;for(;this.canStepsContinue(a);){if(fe.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(He=!1,fe.repos.length===1)He=!0,a.repo==null&&a.counter++,a.repo=fe.repos[0];else{const Ye=yield*(0,h.lA)(a,fe);if(Ye===h.oo.Break)break;a.repo=Ye}if(Ri(a),a.reference==="HEAD"){const Ye=await a.repo.getBranch();a.reference=Ye}if(a.counter<2||a.reference==null){const Ye=yield*(0,h.Yv)(a,fe,{placeholder:"Choose a branch or tag to show its commit history",picked:(P=fe.selectedBranchOrTag)==null?void 0:P.ref,value:fe.selectedBranchOrTag==null?(de=a.reference)==null?void 0:de.ref:void 0,ranges:!0});if(Ye===h.oo.Break){He&&a.counter--;continue}a.reference=Ye,fe.selectedBranchOrTag=void 0}if((!p.GitReference.isRevision(a.reference)||p.GitReference.isRevisionRange(a.reference))&&(fe.selectedBranchOrTag=a.reference),fe.title=`${this.title}${(0,L.vk)(B.NE.Dot,2,2)}${p.GitReference.toString(fe.selectedBranchOrTag,{icon:!1})}`,a.fileName&&(fe.title+=`${(0,L.vk)(B.NE.Dot,2,2)}${(0,De.d)(a.fileName,{fileOnly:!0,truncateTo:B.d$-fe.title.length-3})}`),a.counter<3&&fe.selectedBranchOrTag!=null){const Ye=fe.selectedBranchOrTag.ref;let yt=fe.cache.get(Ye);yt==null&&(yt=a.fileName!=null?this.container.git.getLogForFile(a.repo.path,a.fileName,{ref:Ye}):this.container.git.getLog(a.repo.path,{ref:Ye}),fe.cache.set(Ye,yt));const zt=yield*(0,h.s4)(a,fe,{ignoreFocusOut:!0,log:await yt,onDidLoadMore:mi=>fe.cache.set(Ye,Promise.resolve(mi)),placeholder:(mi,Ji)=>Ji==null?`No commits found in ${p.GitReference.toString(mi.selectedBranchOrTag,{icon:!1})}`:"Choose a commit",picked:(me=a.reference)==null?void 0:me.ref});if(zt===h.oo.Break)continue;a.reference=zt}(!(a.reference instanceof p.GitCommit)||a.reference.file!=null)&&(a.reference=await this.container.git.getCommit(a.repo.path,a.reference.ref));const ze=yield*$r(this.container,{command:"show",state:{repo:a.repo,reference:a.reference,fileName:a.fileName}},this.pickedVia);a.counter--,ze===h.oo.Break&&h.tR.endSteps(a)}return a.counter<0?h.oo.Break:void 0}}n(Oi,"LogGitCommand");var Ht=v(4761),Rt=Object.defineProperty,Pi=Object.getOwnPropertySymbols,Bi=Object.prototype.hasOwnProperty,wi=Object.prototype.propertyIsEnumerable,Zi=n((Be,a,P)=>a in Be?Rt(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"merge_defNormalProp"),gt=n((Be,a)=>{for(var P in a||(a={}))Bi.call(a,P)&&Zi(Be,P,a[P]);if(Pi)for(var P of Pi(a))wi.call(a,P)&&Zi(Be,P,a[P]);return Be},"merge_spreadValues");class be extends h.tR{constructor(a,P){super(a,"merge","merge","Merge",{description:"integrates changes from a specified branch into the current branch"});var de,me;let fe=0;((de=P?.state)==null?void 0:de.repo)!=null&&fe++,((me=P?.state)==null?void 0:me.reference)!=null&&fe++,this.initialState=gt({counter:fe,confirm:!0},P?.state)}get canSkipConfirm(){return!1}execute(a){return a.repo.merge(...a.flags,a.reference.ref)}async*steps(a){var P,de,me;const fe={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 He=!1;for(;this.canStepsContinue(a);){if(fe.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(He=!1,fe.repos.length===1)He=!0,a.repo==null&&a.counter++,a.repo=fe.repos[0];else{const Ye=yield*(0,h.lA)(a,fe);if(Ye===h.oo.Break)break;a.repo=Ye}if(fe.destination==null){const Ye=await a.repo.getBranch();if(Ye==null)break;fe.destination=Ye}if(fe.title=`${this.title} into ${p.GitReference.toString(fe.destination,{icon:!1})}`,fe.pickCommitForItem=!1,a.counter<2||a.reference==null){const Ye=new h.rO.PickCommitToggle(fe.pickCommit,fe,()=>{fe.pickCommit=!fe.pickCommit,Ye.on=fe.pickCommit}),yt=yield*(0,h.Yv)(a,fe,{placeholder:zt=>`Choose a branch${zt.showTags?" or tag":""} to merge`,picked:(P=fe.selectedBranchOrTag)==null?void 0:P.ref,value:fe.selectedBranchOrTag==null?(de=a.reference)==null?void 0:de.ref:void 0,additionalButtons:[Ye]});if(yt===h.oo.Break){He&&a.counter--;continue}a.reference=yt,fe.selectedBranchOrTag=void 0}if(p.GitReference.isRevision(a.reference)||(fe.selectedBranchOrTag=a.reference),a.counter<3&&fe.selectedBranchOrTag!=null&&(fe.pickCommit||fe.pickCommitForItem||a.reference.ref===fe.destination.ref)){const Ye=fe.selectedBranchOrTag.ref;let yt=fe.cache.get(Ye);yt==null&&(yt=this.container.git.getLog(a.repo.path,{ref:Ye,merges:!1}),fe.cache.set(Ye,yt));const zt=yield*(0,h.s4)(a,fe,{ignoreFocusOut:!0,log:await yt,onDidLoadMore:mi=>fe.cache.set(Ye,Promise.resolve(mi)),placeholder:(mi,Ji)=>Ji==null?`No commits found on ${p.GitReference.toString(mi.selectedBranchOrTag,{icon:!1})}`:`Choose a commit to merge into ${p.GitReference.toString(mi.destination,{icon:!1})}`,picked:(me=a.reference)==null?void 0:me.ref});if(zt===h.oo.Break)continue;a.reference=zt}const ze=yield*this.confirmStep(a,fe);ze!==h.oo.Break&&(a.flags=ze,h.tR.endSteps(a),this.execute(a))}return a.counter<0?h.oo.Break:void 0}async*confirmStep(a,P){const de=await this.container.git.getAheadBehindCommitCount(a.repo.path,[p.GitRevision.createRange(P.destination.name,a.reference.name)]),me=de!=null?de.ahead+de.behind:0;if(me===0){const ze=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[],Ht.x.create(Ht.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:`${p.GitReference.toString(P.destination,{capitalize:!0})} is up to date with ${p.GitReference.toString(a.reference)}`})),Ye=yield ze;return h.tR.canPickStepContinue(ze,a,Ye),h.oo.Break}const fe=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[D.create(a.flags,[],{label:this.title,detail:`Will merge ${(0,L._6)("commit",me)} from ${p.GitReference.toString(a.reference)} into ${p.GitReference.toString(P.destination)}`}),D.create(a.flags,["--ff-only"],{label:`Fast-forward ${this.title}`,description:"--ff-only",detail:`Will fast-forward merge ${(0,L._6)("commit",me)} from ${p.GitReference.toString(a.reference)} into ${p.GitReference.toString(P.destination)}`}),D.create(a.flags,["--squash"],{label:`Squash ${this.title}`,description:"--squash",detail:`Will squash ${(0,L._6)("commit",me)} from ${p.GitReference.toString(a.reference)} into one when merging into ${p.GitReference.toString(P.destination)}`}),D.create(a.flags,["--no-ff"],{label:`${this.title} without Fast-Forwarding`,description:"--no-ff",detail:`Will create a merge commit when merging ${(0,L._6)("commit",me)} from ${p.GitReference.toString(a.reference)} into ${p.GitReference.toString(P.destination)}`}),D.create(a.flags,["--no-ff","--no-commit"],{label:`${this.title} without Fast-Forwarding or Committing`,description:"--no-ff --no-commit",detail:`Will merge ${(0,L._6)("commit",me)} from ${p.GitReference.toString(a.reference)} into ${p.GitReference.toString(P.destination)} without Committing`})]),He=yield fe;return h.tR.canPickStepContinue(fe,a,He)?He[0].item:h.oo.Break}}n(be,"MergeGitCommand");var Te=Object.defineProperty,Ke=Object.getOwnPropertySymbols,qe=Object.prototype.hasOwnProperty,at=Object.prototype.propertyIsEnumerable,Lt=n((Be,a,P)=>a in Be?Te(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"pull_defNormalProp"),Dt=n((Be,a)=>{for(var P in a||(a={}))qe.call(a,P)&&Lt(Be,P,a[P]);if(Ke)for(var P of Ke(a))at.call(a,P)&&Lt(Be,P,a[P]);return Be},"pull_spreadValues");class Pt extends h.tR{constructor(a,P){super(a,"pull","pull","Pull",{description:"fetches and integrates changes from a remote into the current branch"});var de;let me=0;((de=P?.state)==null?void 0:de.repos)!=null&&(!Array.isArray(P.state.repos)||P.state.repos.length!==0)&&me++,this.initialState=Dt({counter:me,confirm:P?.confirm},P?.state)}async execute(a){if(p.GitReference.isBranch(a.reference)&&(!p.GitBranch.is(a.reference)||!a.reference.current)){const P=await a.repos[0].getBranch();if(P?.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 P={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 de=!1;for(;this.canStepsContinue(a);){if(P.title=this.title,a.counter<1||a.repos==null||a.repos.length===0||(0,$e.GI)(a.repos))if(de=!1,P.repos.length===1)de=!0,a.counter++,a.repos=[P.repos[0]];else{const me=yield*(0,h.j8)(a,P,{skipIfPossible:a.counter>=1});if(me===h.oo.Break)break;a.repos=me}if(this.confirm(a.confirm)){const me=yield*this.confirmStep(a,P);if(me===h.oo.Break){de&&a.counter--;continue}a.flags=me}h.tR.endSteps(a),this.execute(a)}return a.counter<0?h.oo.Break:void 0}async*confirmStep(a,P){let de;if(a.repos.length>1)de=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[D.create(a.flags,[],{label:this.title,detail:`Will pull ${a.repos.length} repositories`}),D.create(a.flags,["--rebase"],{label:`${this.title} with Rebase`,description:"--rebase",detail:`Will pull ${a.repos.length} repositories by rebasing`})]);else if(p.GitReference.isBranch(a.reference))if(a.reference.remote)de=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[],Ht.x.create(Ht.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:"Cannot pull a remote branch"}));else{const[fe]=a.repos,He=await fe.getBranch(a.reference.name);He?.upstream==null?de=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[],Ht.x.create(Ht.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:"Cannot pull a branch until it has been published"})):de=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[D.create(a.flags,[],{label:this.title,detail:`Will pull${He.state.behind?` ${(0,L._6)("commit",He.state.behind)} into ${p.GitReference.toString(He)}`:` into ${p.GitReference.toString(He)}`}`})])}else{const[fe]=a.repos,[He,ze]=await Promise.all([fe.getStatus(),fe.getLastFetched()]);let Ye="";ze!==0&&(Ye=`${(0,L.vk)(B.NE.Dot,2,2)}Last fetched ${(0,lt.Zh)(new Date(ze))}`);const yt=He?.state.behind!=null?` ${(0,L._6)("commit",He.state.behind)} into $(repo) ${fe.formattedName}`:` into $(repo) ${fe.formattedName}`;de=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P,Ye),[D.create(a.flags,[],{label:this.title,detail:`Will pull${yt}`}),D.create(a.flags,["--rebase"],{label:`${this.title} with Rebase`,description:"--rebase",detail:`Will pull and rebase${yt}`})],void 0,{additionalButtons:[h.rO.Fetch],onDidClickButton:async(zt,mi)=>{if(mi!==h.rO.Fetch||zt.busy)return!1;zt.title=`Confirm ${P.title}${(0,L.vk)(B.NE.Dot,2,2)}Fetching${B.NE.Ellipsis}`,zt.busy=!0,zt.enabled=!1;try{return await fe.fetch({progress:!0}),!0}finally{zt.busy=!1,zt.enabled=!0}}})}const me=yield de;return h.tR.canPickStepContinue(de,a,me)?me[0].item:h.oo.Break}}n(Pt,"PullGitCommand");var Xt=v(9179),hi=Object.defineProperty,Yt=Object.defineProperties,Wt=Object.getOwnPropertyDescriptors,di=Object.getOwnPropertySymbols,Ii=Object.prototype.hasOwnProperty,lr=Object.prototype.propertyIsEnumerable,cr=n((Be,a,P)=>a in Be?hi(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"push_defNormalProp"),Nr=n((Be,a)=>{for(var P in a||(a={}))Ii.call(a,P)&&cr(Be,P,a[P]);if(di)for(var P of di(a))lr.call(a,P)&&cr(Be,P,a[P]);return Be},"push_spreadValues"),pn=n((Be,a)=>Yt(Be,Wt(a)),"push_spreadProps");class Gr extends h.tR{constructor(a,P){super(a,"push","push","Push",{description:"pushes changes from the current branch to a remote"});var de;let me=0;((de=P?.state)==null?void 0:de.repos)!=null&&(!Array.isArray(P.state.repos)||P.state.repos.length!==0)&&me++,this.initialState=Nr({counter:me,confirm:P?.confirm},P?.state)}execute(a){const P=a.flags.indexOf("--set-upstream");return P!==-1?p.GitReference.isBranch(a.reference)?this.container.git.pushAll(a.repos,{force:!1,publish:{remote:a.flags[P+1]},reference:a.reference}):Promise.resolve():this.container.git.pushAll(a.repos,{force:a.flags.includes("--force"),reference:a.reference})}async*steps(a){const P={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 de=!1;for(;this.canStepsContinue(a);){if(P.title=this.title,a.counter<1||a.repos==null||a.repos.length===0||(0,$e.GI)(a.repos))if(de=!1,P.repos.length===1)de=!0,a.counter++,a.repos=[P.repos[0]];else if(a.reference!=null){const me=yield*(0,h.lA)(pn(Nr({},a),{repos:void 0,repo:a.reference.repoPath}),P);if(me===h.oo.Break)break;a.repos=[me]}else{const me=yield*(0,h.j8)(a,P,{skipIfPossible:a.counter>=1});if(me===h.oo.Break)break;a.repos=me}if(this.confirm(a.confirm)){const me=yield*this.confirmStep(a,P);if(me===h.oo.Break){de&&a.counter--;continue}a.flags=me}h.tR.endSteps(a),this.execute(a)}return a.counter<0?h.oo.Break:void 0}async*confirmStep(a,P){const de=Xt.DN.getAny(B.eq.UseForcePushWithLease)??!1;let me;if(a.repos.length>1)me=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[D.create(a.flags,[],{label:this.title,detail:`Will push ${a.repos.length} repositories`}),D.create(a.flags,["--force"],{label:`Force ${this.title}${de?" (with lease)":""}`,description:`--force${de?"-with-lease":""}`,detail:`Will force push${de?" (with lease)":""} ${a.repos.length} repositories`})]);else{const[He]=a.repos,ze=[];if(p.GitReference.isBranch(a.reference))if(a.reference.remote)me=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[],Ht.x.create(Ht.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:"Cannot push remote branch"}));else{const Ye=await He.getBranch(a.reference.name);if(Ye!=null&&Ye?.upstream==null){for(const yt of await He.getRemotes())ze.push(D.create(a.flags,["--set-upstream",yt.name,Ye.name],{label:`Publish ${Ye.name} to ${yt.name}`,detail:`Will publish ${p.GitReference.toString(Ye)} to ${yt.name}`}));ze.length?me=this.createConfirmStep((0,h.C8)("Confirm Publish",a,P),ze,void 0,{placeholder:"Confirm Publish"}):me=this.createConfirmStep((0,h.C8)("Confirm Publish",a,P),[],Ht.x.create(Ht.X.Cancel,!0,{label:"Cancel Publish",detail:"Cannot publish; No remotes found"}),{placeholder:"Confirm Publish"})}else if(Ye!=null&&Ye?.state.behind>0){const yt=await He.getBranch();me=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),Ye.id===yt?.id?[D.create(a.flags,["--force"],{label:`Force ${this.title}${de?" (with lease)":""}`,description:`--force${de?"-with-lease":""}`,detail:`Will force push${de?" (with lease)":""} ${Ye?.state.ahead?` ${(0,L._6)("commit",Ye.state.ahead)}`:""}${Ye.getRemoteName()?` to ${Ye.getRemoteName()}`:""}${Ye!=null&&Ye.state.behind>0?`, overwriting ${(0,L._6)("commit",Ye.state.behind)}${Ye?.getRemoteName()?` on ${Ye.getRemoteName()}`:""}`:""}`})]:[],Ht.x.create(Ht.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:`Cannot push; ${p.GitReference.toString(Ye)} is behind ${Ye.getRemoteName()} by ${(0,L._6)("commit",Ye.state.behind)}`}))}else Ye!=null&&Ye?.state.ahead>0?me=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[D.create(a.flags,[Ye.getRemoteName()],{label:this.title,detail:`Will push ${(0,L._6)("commit",Ye.state.ahead)} from ${p.GitReference.toString(Ye)} to ${Ye.getRemoteName()}`})]):me=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[],Ht.x.create(Ht.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:"No commits found to push"}))}else{const Ye=await He.getStatus(),yt={refType:"branch",name:Ye?.branch??"HEAD",ref:Ye?.branch??"HEAD",remote:!1,repoPath:He.path};if(Ye?.state.ahead===0){if(a.reference==null&&Ye.upstream==null){a.reference=yt;for(const zt of await He.getRemotes())ze.push(D.create(a.flags,["--set-upstream",zt.name,Ye.branch],{label:`Publish ${yt.name} to ${zt.name}`,detail:`Will publish ${p.GitReference.toString(yt)} to ${zt.name}`}))}ze.length?me=this.createConfirmStep((0,h.C8)("Confirm Publish",a,P),ze,void 0,{placeholder:"Confirm Publish"}):Ye.upstream==null?me=this.createConfirmStep((0,h.C8)("Confirm Publish",a,P),[],Ht.x.create(Ht.X.Cancel,!0,{label:"Cancel Publish",detail:"Cannot publish; No remotes found"}),{placeholder:"Confirm Publish"}):me=this.createConfirmStep((0,h.C8)("Confirm Push",a,P),[],Ht.x.create(Ht.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:`Cannot push; No commits ahead of ${p.GitBranch.getRemote(Ye.upstream)}`}))}else{let zt="";const mi=await He.getLastFetched();mi!==0&&(zt=`${(0,L.vk)(B.NE.Dot,2,2)}Last fetched ${(0,lt.Zh)(new Date(mi))}`);let Ji;a.reference!=null?Ji=`${Ye?.state.ahead?` commits up to and including ${p.GitReference.toString(a.reference,{label:!1})}`:""}${Ye?.upstream?` to ${p.GitBranch.getRemote(Ye.upstream)}`:""}`:Ji=`${Ye?.state.ahead?` ${(0,L._6)("commit",Ye.state.ahead)}`:""}${Ye?.upstream?` to ${p.GitBranch.getRemote(Ye.upstream)}`:""}`,me=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P,zt),[...Ye?.state.behind?[]:[D.create(a.flags,[],{label:this.title,detail:`Will push${Ji}`})],D.create(a.flags,["--force"],{label:`Force ${this.title}${de?" (with lease)":""}`,description:`--force${de?"-with-lease":""}`,detail:`Will force push${de?" (with lease)":""} ${Ji}${Ye!=null&&Ye.state.behind>0?`, overwriting ${(0,L._6)("commit",Ye.state.behind)}${Ye?.upstream?` on ${p.GitBranch.getRemote(Ye.upstream)}`:""}`:""}`})],Ye?.state.behind?Ht.x.create(Ht.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:`Cannot push; ${p.GitReference.toString(yt)} is behind${Ye?.upstream?` ${p.GitBranch.getRemote(Ye.upstream)}`:""} by ${(0,L._6)("commit",Ye.state.behind)}`}):void 0),me.additionalButtons=[h.rO.Fetch],me.onDidClickButton=async(Dr,On)=>{if(On!==h.rO.Fetch||Dr.busy)return!1;Dr.title=`Confirm ${P.title}${(0,L.vk)(B.NE.Dot,2,2)}Fetching${B.NE.Ellipsis}`,Dr.busy=!0,Dr.enabled=!1;try{return await He.fetch({progress:!0}),!0}finally{Dr.busy=!1,Dr.enabled=!0}}}}}const fe=yield me;return h.tR.canPickStepContinue(me,a,fe)?fe[0].item:h.oo.Break}}n(Gr,"PushGitCommand");var ue=Object.defineProperty,xe=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,nt=n((Be,a,P)=>a in Be?ue(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"rebase_defNormalProp"),Ct=n((Be,a)=>{for(var P in a||(a={}))Ce.call(a,P)&&nt(Be,P,a[P]);if(xe)for(var P of xe(a))Oe.call(a,P)&&nt(Be,P,a[P]);return Be},"rebase_spreadValues");class Vt extends h.tR{constructor(a,P){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 de,me;let fe=0;((de=P?.state)==null?void 0:de.repo)!=null&&fe++,((me=P?.state)==null?void 0:me.reference)!=null&&fe++,this.initialState=Ct({counter:fe,confirm:!0},P?.state)}get canSkipConfirm(){return!1}async execute(a){let P;if(a.flags.includes("--interactive")){await this.container.rebaseEditor.enableForNextUse();let de;switch(b.env.appName){case"Visual Studio Code - Insiders":de="code-insiders --wait --reuse-window";break;case"Visual Studio Code - Exploration":de="code-exploration --wait --reuse-window";break;case"VSCodium":de="codium --wait --reuse-window";break;default:de="code --wait --reuse-window";break}P=["-c",`sequence.editor="${de}"`]}return a.repo.rebase(P,...a.flags,a.reference.ref)}async*steps(a){var P,de,me;const fe={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 He=!1;for(;this.canStepsContinue(a);){if(fe.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(He=!1,fe.repos.length===1)He=!0,a.repo==null&&a.counter++,a.repo=fe.repos[0];else{const Ye=yield*(0,h.lA)(a,fe);if(Ye===h.oo.Break)break;a.repo=Ye}if(fe.destination==null){const Ye=await a.repo.getBranch();if(Ye==null)break;fe.destination=Ye}if(fe.title=`${this.title} ${p.GitReference.toString(fe.destination,{icon:!1})}`,fe.pickCommitForItem=!1,a.counter<2||a.reference==null){const Ye=new h.rO.PickCommitToggle(fe.pickCommit,fe,()=>{fe.pickCommit=!fe.pickCommit,Ye.on=fe.pickCommit}),yt=yield*(0,h.Yv)(a,fe,{placeholder:zt=>`Choose a branch${zt.showTags?" or tag":""} to rebase`,picked:(P=fe.selectedBranchOrTag)==null?void 0:P.ref,value:fe.selectedBranchOrTag==null?(de=a.reference)==null?void 0:de.ref:void 0,additionalButtons:[Ye]});if(yt===h.oo.Break){He&&a.counter--;continue}a.reference=yt,fe.selectedBranchOrTag=void 0}if(p.GitReference.isRevision(a.reference)||(fe.selectedBranchOrTag=a.reference),a.counter<3&&fe.selectedBranchOrTag!=null&&(fe.pickCommit||fe.pickCommitForItem||a.reference.ref===fe.destination.ref)){const Ye=fe.selectedBranchOrTag.ref;let yt=fe.cache.get(Ye);yt==null&&(yt=this.container.git.getLog(a.repo.path,{ref:Ye,merges:!1}),fe.cache.set(Ye,yt));const zt=yield*(0,h.s4)(a,fe,{ignoreFocusOut:!0,log:await yt,onDidLoadMore:mi=>fe.cache.set(Ye,Promise.resolve(mi)),placeholder:(mi,Ji)=>Ji==null?`No commits found on ${p.GitReference.toString(mi.selectedBranchOrTag,{icon:!1})}`:`Choose a commit to rebase ${p.GitReference.toString(mi.destination,{icon:!1})} onto`,picked:(me=a.reference)==null?void 0:me.ref});if(zt===h.oo.Break)continue;a.reference=zt}const ze=yield*this.confirmStep(a,fe);ze!==h.oo.Break&&(a.flags=ze,h.tR.endSteps(a),this.execute(a))}return a.counter<0?h.oo.Break:void 0}async*confirmStep(a,P){const de=await this.container.git.getAheadBehindCommitCount(a.repo.path,[a.reference.refType==="revision"?p.GitRevision.createRange(a.reference.ref,P.destination.ref):p.GitRevision.createRange(P.destination.name,a.reference.name)]),me=de!=null?de.ahead+de.behind:0;if(me===0){const ze=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[],Ht.x.create(Ht.X.Cancel,!0,{label:`Cancel ${this.title}`,detail:`${p.GitReference.toString(P.destination,{capitalize:!0})} is up to date with ${p.GitReference.toString(a.reference)}`})),Ye=yield ze;return h.tR.canPickStepContinue(ze,a,Ye),h.oo.Break}const fe=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[D.create(a.flags,[],{label:this.title,detail:`Will update ${p.GitReference.toString(P.destination)} by applying ${(0,L._6)("commit",me)} on top of ${p.GitReference.toString(a.reference)}`}),D.create(a.flags,["--interactive"],{label:`Interactive ${this.title}`,description:"--interactive",detail:`Will interactively update ${p.GitReference.toString(P.destination)} by applying ${(0,L._6)("commit",me)} on top of ${p.GitReference.toString(a.reference)}`})]),He=yield fe;return h.tR.canPickStepContinue(fe,a,He)?He[0].item:h.oo.Break}}n(Vt,"RebaseGitCommand");var ti=Object.defineProperty,vi=Object.getOwnPropertySymbols,ke=Object.prototype.hasOwnProperty,ji=Object.prototype.propertyIsEnumerable,nr=n((Be,a,P)=>a in Be?ti(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"reset_defNormalProp"),qi=n((Be,a)=>{for(var P in a||(a={}))ke.call(a,P)&&nr(Be,P,a[P]);if(vi)for(var P of vi(a))ji.call(a,P)&&nr(Be,P,a[P]);return Be},"reset_spreadValues"),Xi=n((Be,a,P)=>(nr(Be,typeof a!="symbol"?a+"":a,P),P),"reset_publicField");class Li extends h.tR{constructor(a,P){super(a,"reset","reset","Reset",{description:"resets the current branch to a specified commit"});Xi(this,"_canSkipConfirm",!1);var de,me;let fe=0;((de=P?.state)==null?void 0:de.repo)!=null&&fe++,((me=P?.state)==null?void 0:me.reference)!=null&&fe++,this.initialState=qi({counter:fe,confirm:P?.confirm??!0},P?.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 P;const de={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(de.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(me=!1,de.repos.length===1)me=!0,a.repo==null&&a.counter++,a.repo=de.repos[0];else{const fe=yield*(0,h.lA)(a,de);if(fe===h.oo.Break)break;a.repo=fe}if(de.destination==null){const fe=await a.repo.getBranch();if(fe==null)break;de.destination=fe}if(de.title=`${this.title} ${p.GitReference.toString(de.destination,{icon:!1})}`,a.counter<2||a.reference==null){const fe=de.destination.ref;let He=de.cache.get(fe);He==null&&(He=this.container.git.getLog(a.repo.path,{ref:fe,merges:!1}),de.cache.set(fe,He));const ze=yield*(0,h.s4)(a,de,{log:await He,onDidLoadMore:Ye=>de.cache.set(fe,Promise.resolve(Ye)),placeholder:(Ye,yt)=>yt==null?`${Ye.destination.name} has no commits`:`Choose a commit to reset ${Ye.destination.name} to`,picked:(P=a.reference)==null?void 0:P.ref});if(ze===h.oo.Break){me&&a.counter--;continue}a.reference=ze}if(this.confirm(a.confirm)){const fe=yield*this.confirmStep(a,de);if(fe===h.oo.Break)continue;a.flags=fe}h.tR.endSteps(a),this.execute(a)}return a.counter<0?h.oo.Break:void 0}*confirmStep(a,P){const de=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[D.create(a.flags,[],{label:this.title,detail:`Will reset (leaves changes in the working tree) ${p.GitReference.toString(P.destination)} to ${p.GitReference.toString(a.reference)}`}),D.create(a.flags,["--soft"],{label:`Soft ${this.title}`,description:"--soft",detail:`Will soft reset (leaves changes in the index and working tree) ${p.GitReference.toString(P.destination)} to ${p.GitReference.toString(a.reference)}`}),D.create(a.flags,["--hard"],{label:`Hard ${this.title}`,description:"--hard",detail:`Will hard reset (discards all changes) ${p.GitReference.toString(P.destination)} to ${p.GitReference.toString(a.reference)}`})]),me=yield de;return h.tR.canPickStepContinue(de,a,me)?me[0].item:h.oo.Break}}n(Li,"ResetGitCommand");var Rr=Object.defineProperty,ir=Object.getOwnPropertySymbols,er=Object.prototype.hasOwnProperty,yr=Object.prototype.propertyIsEnumerable,Cr=n((Be,a,P)=>a in Be?Rr(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"revert_defNormalProp"),ur=n((Be,a)=>{for(var P in a||(a={}))er.call(a,P)&&Cr(Be,P,a[P]);if(ir)for(var P of ir(a))yr.call(a,P)&&Cr(Be,P,a[P]);return Be},"revert_spreadValues");class Hr extends h.tR{constructor(a,P){super(a,"revert","revert","Revert",{description:"undoes the changes of specified commits, by creating new commits with inverted changes"});var de,me;let fe=0;((de=P?.state)==null?void 0:de.repo)!=null&&fe++,((me=P?.state)==null?void 0:me.references)!=null&&(!Array.isArray(P.state.references)||P.state.references.length!==0)&&fe++,this.initialState=ur({counter:fe,confirm:!0},P?.state)}get canSkipConfirm(){return!1}execute(a){return a.repo.revert(...a.flags,...a.references.map(P=>P.ref).reverse())}async*steps(a){var P;const de={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(de.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(me=!1,de.repos.length===1)me=!0,a.repo==null&&a.counter++,a.repo=de.repos[0];else{const He=yield*(0,h.lA)(a,de);if(He===h.oo.Break)break;a.repo=He}if(de.destination==null){const He=await a.repo.getBranch();if(He==null)break;de.destination=He}if(a.counter<2||a.references==null||a.references.length===0){const He=de.destination.ref;let ze=de.cache.get(He);ze==null&&(ze=this.container.git.getLog(a.repo.path,{ref:He,merges:!1}),de.cache.set(He,ze));const Ye=yield*(0,h.Rj)(a,de,{log:await ze,onDidLoadMore:yt=>de.cache.set(He,Promise.resolve(yt)),placeholder:(yt,zt)=>zt==null?`${yt.destination.name} has no commits`:"Choose commits to revert",picked:(P=a.references)==null?void 0:P.map(yt=>yt.ref)});if(Ye===h.oo.Break){me&&a.counter--;continue}a.references=Ye}const fe=yield*this.confirmStep(a,de);fe!==h.oo.Break&&(a.flags=fe,h.tR.endSteps(a),this.execute(a))}return a.counter<0?h.oo.Break:void 0}*confirmStep(a,P){const de=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[D.create(a.flags,["--no-edit"],{label:this.title,description:"--no-edit",detail:`Will revert ${p.GitReference.toString(a.references)}`}),D.create(a.flags,["--edit"],{label:`${this.title} & Edit`,description:"--edit",detail:`Will revert and edit ${p.GitReference.toString(a.references)}`})]),me=yield de;return h.tR.canPickStepContinue(de,a,me)?me[0].item:h.oo.Break}}n(Hr,"RevertGitCommand");var Or=v(3969),xr=v(3708),ki=v(3422),ai=Object.defineProperty,se=Object.getOwnPropertySymbols,ye=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,Xe=n((Be,a,P)=>a in Be?ai(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"search_defNormalProp"),Qe=n((Be,a)=>{for(var P in a||(a={}))ye.call(a,P)&&Xe(Be,P,a[P]);if(se)for(var P of se(a))je.call(a,P)&&Xe(Be,P,a[P]);return Be},"search_spreadValues");const ct=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 h.tR{constructor(a,P){super(a,"search","search","Commit Search",{description:"aka grep, searches for commits"});var de,me;let fe=0;((de=P?.state)==null?void 0:de.repo)!=null&&fe++,((me=P?.state)==null?void 0:me.pattern)!=null&&!P.prefillOnly&&fe++,this.initialState=Qe({counter:fe,confirm:!1},P?.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 P;const de={repos:this.container.git.openRepositories,associatedView:this.container.searchAndCompareView,commit:void 0,hasVirtualFolders:(0,_.f)(B.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 fe=!1;for(;this.canStepsContinue(a);){if(de.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(fe=!1,de.repos.length===1)fe=!0,a.repo==null&&a.counter++,a.repo=de.repos[0];else{const yt=yield*(0,h.lA)(a,de);if(yt===h.oo.Break)break;a.repo=yt}if(a.counter<2||a.pattern==null){const yt=yield*this.pickSearchOperatorStep(a,de);if(yt===h.oo.Break){fe&&a.counter--,a.pattern=void 0;continue}a.pattern=yt}const He={pattern:a.pattern,matchAll:a.matchAll,matchCase:a.matchCase,matchRegex:a.matchRegex},ze=Or.n.toKey(He);if((de.resultsPromise==null||de.resultsKey!==ze)&&(de.resultsPromise=a.repo.searchForCommits(He),de.resultsKey=ze),a.showResultsInSideBar){this.container.searchAndCompareView.search(a.repo.path,He,{label:{label:`for ${a.pattern}`}},de.resultsPromise,a.showResultsInSideBar instanceof ki.V5?a.showResultsInSideBar:void 0);break}if(a.counter<3||de.commit==null){const yt=a.repo.path,zt=yield*(0,h.s4)(a,de,{ignoreFocusOut:!0,log:await de.resultsPromise,onDidLoadMore:mi=>de.resultsPromise=Promise.resolve(mi),placeholder:(mi,Ji)=>Ji==null?`No results for ${a.pattern}`:`${(0,L._6)("result",Ji.count,{format:Dr=>Ji.hasMore?`${Dr}+`:void 0})} for ${a.pattern}`,picked:(P=de.commit)==null?void 0:P.ref,showInSideBarCommand:new xr.qv("$(link-external) Show Results in Side Bar",()=>void this.container.searchAndCompareView.search(yt,He,{label:{label:`for ${a.pattern}`},reveal:{select:!0,focus:!1,expand:!0}},de.resultsPromise)),showInSideBarButton:{button:h.rO.ShowResultsInSideBar,onDidClick:()=>void this.container.searchAndCompareView.search(yt,He,{label:{label:`for ${a.pattern}`},reveal:{select:!0,focus:!1,expand:!0}},de.resultsPromise)}});if(zt===h.oo.Break){a.counter--;continue}de.commit=zt}const Ye=yield*$r(this.container,{command:"show",state:{repo:a.repo,reference:de.commit}},this.pickedVia);a.counter--,Ye===h.oo.Break&&h.tR.endSteps(a)}return a.counter<0?h.oo.Break:void 0}*pickSearchOperatorStep(a,P){const de=[{label:ct.get(""),description:`pattern or message: pattern or =: pattern ${B.NE.Dash} use quotes to search for phrases`,item:"message:"},{label:ct.get("author:"),description:"author: pattern or @: pattern",item:"author:"},{label:ct.get("commit:"),description:"commit: sha or #: sha",item:"commit:"},P.hasVirtualFolders?void 0:{label:ct.get("file:"),description:"file: glob or ?: glob",item:"file:"},P.hasVirtualFolders?void 0:{label:ct.get("change:"),description:"change: pattern or ~: pattern",item:"change:"}].filter(yt=>yt!=null),me=new h.rO.MatchCaseToggle(a.matchCase),fe=new h.rO.MatchAllToggle(a.matchAll),He=new h.rO.MatchRegexToggle(a.matchRegex),ze=h.tR.createPickStep({title:(0,h.C8)(P.title,a,P),placeholder:'e.g. "Updates dependencies" author:eamodio',matchOnDescription:!0,matchOnDetail:!0,additionalButtons:[me,fe,He],items:de,value:a.pattern,onDidAccept:yt=>{const zt=yt.selectedItems[0];if(!Or.W.has(zt.item))return!0;const mi=yt.value.trim();return mi.length===0||Or.W.has(mi)?yt.value=zt.item:yt.value=`${mi} ${zt.item}`,ze.onDidChangeValue(yt),!1},onDidClickButton:(yt,zt)=>{zt===me?(a.matchCase=!a.matchCase,me.on=a.matchCase):zt===fe?(a.matchAll=!a.matchAll,fe.on=a.matchAll):zt===He&&(a.matchRegex=!a.matchRegex,He.on=a.matchRegex)},onDidChangeValue:yt=>{const zt=yt.value.trim();a.counter=zt?3:2;const mi=Or.n.parseSearchOperations(zt);return yt.title=(0,h.C8)(mi.size===0||mi.size>1?P.title:`Commit ${ct.get(mi.keys().next().value)}`,a,P),yt.value.length===0?yt.items=de:(yt.ignoreFocusOut=!0,ze.ignoreFocusOut=!0,yt.items=[{label:"Search for",description:yt.value,item:yt.value}]),!0}}),Ye=yield ze;return h.tR.canPickStepContinue(ze,a,Ye)?(a.counter--,Ye[0].item.trim()):(a.counter--,h.oo.Break)}}n(pt,"SearchGitCommand");var Ot=v(4338),ni=v(5355),oi=Object.defineProperty,At=Object.defineProperties,Kt=Object.getOwnPropertyDescriptors,Nt=Object.getOwnPropertySymbols,Jt=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable,Mt=n((Be,a,P)=>a in Be?oi(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"show_defNormalProp"),Gi=n((Be,a)=>{for(var P in a||(a={}))Jt.call(a,P)&&Mt(Be,P,a[P]);if(Nt)for(var P of Nt(a))jt.call(a,P)&&Mt(Be,P,a[P]);return Be},"show_spreadValues"),gn=n((Be,a)=>At(Be,Kt(a)),"show_spreadProps");function _n(Be){if(!(Be.repo instanceof p.Repository))throw new Error("Missing repository")}n(_n,"show_assertStateStepRepository");function or(Be){if(!p.GitCommit.is(Be.reference))throw new Error("Missing reference")}n(or,"assertsStateStepCommit");function Nn(Be){if(!Be.fileName)throw new Error("Missing filename")}n(Nn,"assertsStateStepFileName");class cs extends h.tR{constructor(a,P){super(a,"show","show","Show",{description:"shows information about a git reference"});var de,me,fe;let He=0;((de=P?.state)==null?void 0:de.repo)!=null&&He++,((me=P?.state)==null?void 0:me.reference)!=null&&He++,((fe=P?.state)==null?void 0:fe.fileName)!=null&&(He+=2),this.initialState=Gi({counter:He,confirm:!1},P?.state)}get canConfirm(){return!1}getStepState(a){const P=super.getStepState(a);return gn(Gi({},P),{startingStep:a?Math.min(P.startingStep??0,1):0})}async*steps(a){var P;const de={repos:this.container.git.openRepositories,associatedView:this.container.commitsView,title:this.title};let me=!1;for(;this.canStepsContinue(a);){if(de.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(me=!1,de.repos.length===1)me=!0,a.repo==null&&a.counter++,a.repo=de.repos[0];else{const He=yield*(0,h.lA)(a,de);if(He===h.oo.Break)break;a.repo=He}if(_n(a),(a.counter<2||a.reference==null||!p.GitCommit.is(a.reference)||a.reference.file!=null)&&(a.reference!=null&&!p.GitCommit.is(a.reference)&&(a.reference=await this.container.git.getCommit(a.reference.repoPath,a.reference.ref)),a.counter<2||a.reference==null)){const He=yield*(0,h.s4)(a,de,{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:(P=a.reference)==null?void 0:P.ref});if(He===h.oo.Break){me&&a.counter--;continue}a.reference=He}if(or(a),a.counter<3){a.reference.files==null&&await a.reference.ensureFullDetails();const He=yield*(0,h.KT)(a,de);if(He===h.oo.Break)continue;if(He instanceof ni.Wv){const ze=yield*He.executeSteps(this.pickedVia);a.counter--,ze===h.oo.Break&&h.tR.endSteps(a);continue}if(He instanceof xr.$w&&!(He instanceof Ot.PF)){h.tR.endSteps(a),He.execute();break}}if(a.counter<4||a.fileName==null){const He=yield*(0,h.fD)(a,de,{picked:a.fileName});if(He===h.oo.Break)continue;if(He instanceof Ot.PF){a.counter-=2;continue}a.fileName=He.file.path}Nn(a);const fe=yield*(0,h.nI)(a,de);if(fe!==h.oo.Break){if(fe instanceof Ot.PF){a.counter-=2;continue}if(fe instanceof ni.Wv){yield*fe.executeSteps(this.pickedVia),a.counter--;continue}if(fe instanceof xr.$w){h.tR.endSteps(a),fe.execute();break}}}return a.counter<0?h.oo.Break:void 0}}n(cs,"ShowGitCommand");var Vr=v(3497),Ei=v(2436),Ki=v(1999),rr=v(5387),nn=Object.defineProperty,Fi=Object.getOwnPropertySymbols,io=Object.prototype.hasOwnProperty,Ir=Object.prototype.propertyIsEnumerable,zr=n((Be,a,P)=>a in Be?nn(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"stash_defNormalProp"),ve=n((Be,a)=>{for(var P in a||(a={}))io.call(a,P)&&zr(Be,P,a[P]);if(Fi)for(var P of Fi(a))Ir.call(a,P)&&zr(Be,P,a[P]);return Be},"stash_spreadValues"),ro=n((Be,a,P)=>(zr(Be,typeof a!="symbol"?a+"":a,P),P),"stash_publicField");const Pr=new Map([["apply","Apply"],["drop","Drop"],["list","List"],["pop","Pop"],["push","Push"]]);function _r(Be,a){return a==null?Be:`${Pr.get(a)} ${Be}`}n(_r,"stash_getTitle");class Dn extends h.tR{constructor(a,P){super(a,"stash","stash","Stash",{description:"shelves (stashes) local changes to be reapplied later"});ro(this,"subcommand");var de,me;let fe=0;if(((de=P?.state)==null?void 0:de.subcommand)!=null)switch(fe++,P.state.subcommand){case"apply":case"drop":case"pop":P.state.reference!=null&&fe++;break;case"push":P.state.message!=null&&fe++;break}((me=P?.state)==null?void 0:me.repo)!=null&&fe++,this.initialState=ve({counter:fe,confirm:P?.confirm},P?.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 P={repos:this.container.git.openRepositories,associatedView:this.container.stashesView,readonly:(0,_.f)(B.zf.Readonly,!1)||(0,_.f)(B.zf.Untrusted,!1)||(0,_.f)(B.zf.HasVirtualFolders,!1),title:this.title};let de=!1;for(;this.canStepsContinue(a);){if(P.title=this.title,P.readonly&&(a.subcommand="list"),a.counter<1||a.subcommand==null){this.subcommand=void 0;const me=yield*this.pickSubcommandStep(a);if(me===h.oo.Break)break;a.subcommand=me}if(this.subcommand=a.subcommand,P.title=_r(this.title,a.subcommand),a.counter<2||a.repo==null||typeof a.repo=="string")if(de=!1,P.repos.length===1)de=!0,a.counter++,a.repo=P.repos[0];else{const me=yield*(0,h.lA)(a,P);if(me===h.oo.Break)continue;a.repo=me}switch(a.subcommand){case"apply":case"pop":yield*this.applyOrPopCommandSteps(a,P);break;case"drop":yield*this.dropCommandSteps(a,P);break;case"list":yield*this.listCommandSteps(a,P);break;case"push":yield*this.pushCommandSteps(a,P);break;default:h.tR.endSteps(a);break}de&&a.counter--}return a.counter<0?h.oo.Break:void 0}*pickSubcommandStep(a){const P=h.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:[b.QuickInputButtons.Back]}),de=yield P;return h.tR.canPickStepContinue(P,a,de)?de[0].item:h.oo.Break}async*applyOrPopCommandSteps(a,P){for(var de;this.canStepsContinue(a);){if(a.counter<3||a.reference==null){const me=yield*(0,h.Qp)(a,P,{stash:await this.container.git.getStash(a.repo.path),placeholder:(fe,He)=>He==null?`No stashes found in ${a.repo.formattedName}`:"Choose a stash to apply to your working tree",picked:(de=a.reference)==null?void 0:de.ref});if(me===h.oo.Break)break;a.reference=me}if(this.confirm(a.confirm)){const me=yield*this.applyOrPopCommandConfirmStep(a,P);if(me===h.oo.Break)continue;a.subcommand=me}h.tR.endSteps(a);try{await a.repo.stashApply(a.subcommand==="pop"?`stash@{${a.reference.number}}`:a.reference.ref,{deleteAfter:a.subcommand==="pop"})}catch(me){Ei.Y.error(me,P.title),Vr.ef.is(me,Vr.bk.WorkingChanges)?b.window.showWarningMessage("Unable to apply stash. Your working tree changes would be overwritten. Please commit or stash your changes before trying again"):Ki.V.showGenericErrorMessage(me.message)}}}*applyOrPopCommandConfirmStep(a,P){const de=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[{label:P.title,detail:a.subcommand==="pop"?`Will delete ${p.GitReference.toString(a.reference)} and apply the changes to the working tree`:`Will apply the changes from ${p.GitReference.toString(a.reference)} to the working tree`,item:a.subcommand},{label:_r(this.title,a.subcommand==="pop"?"apply":"pop"),detail:a.subcommand==="pop"?`Will apply the changes from ${p.GitReference.toString(a.reference)} to the working tree`:`Will delete ${p.GitReference.toString(a.reference)} and apply the changes to the working tree`,item:a.subcommand==="pop"?"apply":"pop"}],void 0,{placeholder:`Confirm ${P.title}`,additionalButtons:[h.rO.RevealInSideBar],onDidClickButton:(fe,He)=>{He===h.rO.RevealInSideBar&&rr.u.Stash.reveal(a.reference,{select:!0,expand:!0})}}),me=yield de;return h.tR.canPickStepContinue(de,a,me)?me[0].item:h.oo.Break}async*dropCommandSteps(a,P){for(var de;this.canStepsContinue(a);){if(a.counter<3||a.reference==null){const fe=yield*(0,h.Qp)(a,P,{stash:await this.container.git.getStash(a.repo.path),placeholder:(He,ze)=>ze==null?`No stashes found in ${a.repo.formattedName}`:"Choose a stash to delete",picked:(de=a.reference)==null?void 0:de.ref});if(fe===h.oo.Break)break;a.reference=fe}if((yield*this.dropCommandConfirmStep(a,P))!==h.oo.Break){h.tR.endSteps(a);try{await a.repo.stashDelete(`stash@{${a.reference.number}}`,a.reference.ref)}catch(fe){Ei.Y.error(fe,P.title),Ki.V.showGenericErrorMessage("Unable to delete stash");return}}}}*dropCommandConfirmStep(a,P){const de=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[{label:P.title,detail:`Will delete ${p.GitReference.toString(a.reference)}`}],void 0,{placeholder:`Confirm ${P.title}`,additionalButtons:[h.rO.RevealInSideBar],onDidClickButton:(fe,He)=>{He===h.rO.RevealInSideBar&&rr.u.Stash.reveal(a.reference,{select:!0,expand:!0})}}),me=yield de;return h.tR.canPickStepContinue(de,a,me)?void 0:h.oo.Break}async*listCommandSteps(a,P){var de;for(P.title="Stashes";this.canStepsContinue(a);){if(a.counter<3||a.reference==null){const fe=yield*(0,h.Qp)(a,P,{stash:await this.container.git.getStash(a.repo.path),placeholder:(He,ze)=>ze==null?`No stashes found in ${a.repo.formattedName}`:"Choose a stash",picked:(de=a.reference)==null?void 0:de.ref});if(fe===h.oo.Break)break;a.reference=fe}const me=yield*$r(this.container,{command:"show",state:{repo:a.repo,reference:a.reference}},this.pickedVia);a.counter--,me===h.oo.Break&&h.tR.endSteps(a)}}async*pushCommandSteps(a,P){for(a.flags==null&&(a.flags=[]);this.canStepsContinue(a);){if(a.counter<3||a.message==null){const de=yield*this.pushCommandInputMessageStep(a,P);if(de===h.oo.Break)break;a.message=de}if(this.confirm(a.confirm)){const de=yield*this.pushCommandConfirmStep(a,P);if(de===h.oo.Break)continue;a.flags=de}h.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(de){Ei.Y.error(de,P.title);const me=de?.message??de?.toString()??"";if(me.includes("newer version of Git")){b.window.showErrorMessage(`Unable to stash changes. ${me}`);return}Ki.V.showGenericErrorMessage("Unable to stash changes");return}}}async*pushCommandInputMessageStep(a,P){const de=h.tR.createInputStep({title:(0,h.C8)(P.title,a,P,a.uris!=null?`${(0,L.vk)(B.NE.Dot,2,2)}${a.uris.length===1?(0,De.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 de;return!h.tR.canStepContinue(de,a,me)||!await h.tR.canInputStepContinue(de,a,me)?h.oo.Break:me}*pushCommandConfirmStep(a,P){const de=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),a.uris==null||a.uris.length===0?[D.create(a.flags,[],{label:P.title,detail:"Will stash uncommitted changes"}),D.create(a.flags,["--include-untracked"],{label:`${P.title} & Include Untracked`,description:"--include-untracked",detail:"Will stash uncommitted changes, including untracked files"}),D.create(a.flags,["--keep-index"],{label:`${P.title} & Keep Staged`,description:"--keep-index",detail:"Will stash uncommitted changes, but will keep staged files intact"})]:[D.create(a.flags,[],{label:P.title,detail:`Will stash changes from ${a.uris.length===1?(0,De.d)(a.uris[0],{fileOnly:!0}):`${a.uris.length} files`}`}),D.create(a.flags,["--keep-index"],{label:`${P.title} & Keep Staged`,detail:`Will stash changes from ${a.uris.length===1?(0,De.d)(a.uris[0],{fileOnly:!0}):`${a.uris.length} files`}, but will keep staged files intact`})],void 0,{placeholder:`Confirm ${P.title}`}),me=yield de;return h.tR.canPickStepContinue(de,a,me)?me[0].item:h.oo.Break}}n(Dn,"StashGitCommand");var Di=Object.defineProperty,vr=Object.getOwnPropertySymbols,To=Object.prototype.hasOwnProperty,Qi=Object.prototype.propertyIsEnumerable,si=n((Be,a,P)=>a in Be?Di(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"status_defNormalProp"),bi=n((Be,a)=>{for(var P in a||(a={}))To.call(a,P)&&si(Be,P,a[P]);if(vr)for(var P of vr(a))Qi.call(a,P)&&si(Be,P,a[P]);return Be},"status_spreadValues");class li extends h.tR{constructor(a,P){super(a,"status","status","Status",{description:"shows status information about a repository"});var de;let me=0;((de=P?.state)==null?void 0:de.repo)!=null&&me++,this.initialState=bi({counter:me,confirm:!1},P?.state)}get canConfirm(){return!1}async*steps(a){const P={repos:this.container.git.openRepositories,associatedView:this.container.commitsView,status:void 0,title:this.title};let de=!1;for(;this.canStepsContinue(a);){if(P.title=this.title,a.counter<1||a.repo==null||typeof a.repo=="string")if(de=!1,P.repos.length===1)de=!0,a.repo==null&&a.counter++,a.repo=P.repos[0];else{const fe=yield*(0,h.lA)(a,P);if(fe===h.oo.Break)break;a.repo=fe}if(P.status=await a.repo.getStatus(),P.status==null)return;P.title=`${this.title}${(0,L.vk)(B.NE.Dot,2,2)}${p.GitReference.toString(p.GitReference.create(P.status.branch,a.repo.path,{refType:"branch",name:P.status.branch,remote:!1,upstream:P.status.upstream!=null?{name:P.status.upstream,missing:!1}:void 0}),{icon:!1})}`;const me=yield*(0,h.up)(a,P);if(me===h.oo.Break){de&&a.counter--;continue}if(me instanceof ni.Wv){const fe=yield*me.executeSteps(this.pickedVia);a.counter--,fe===h.oo.Break&&h.tR.endSteps(a);continue}if(me instanceof xr.$w){h.tR.endSteps(a),me.execute();break}}}}n(li,"StatusGitCommand");var Yi=Object.defineProperty,no=Object.getOwnPropertySymbols,Mn=Object.prototype.hasOwnProperty,Eo=Object.prototype.propertyIsEnumerable,oo=n((Be,a,P)=>a in Be?Yi(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"switch_defNormalProp"),so=n((Be,a)=>{for(var P in a||(a={}))Mn.call(a,P)&&oo(Be,P,a[P]);if(no)for(var P of no(a))Eo.call(a,P)&&oo(Be,P,a[P]);return Be},"switch_spreadValues");class ao extends h.tR{constructor(a,P){super(a,"switch","switch","Switch",{description:"aka checkout, switches the current branch to a specified branch"});var de,me;let fe=0;((de=P?.state)==null?void 0:de.repos)!=null&&(!Array.isArray(P.state.repos)||P.state.repos.length!==0)&&fe++,((me=P?.state)==null?void 0:me.reference)!=null&&fe++,this.initialState=so({counter:fe,confirm:P?.confirm},P?.state)}async execute(a){return void await b.window.withProgress({location:b.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(P=>P.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 P={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 de=!1;for(;this.canStepsContinue(a);){if(P.title=this.title,a.counter<1||a.repos==null||a.repos.length===0||(0,$e.GI)(a.repos))if(de=!1,P.repos.length===1)de=!0,a.counter++,a.repos=[P.repos[0]];else{const me=yield*(0,h.j8)(a,P,{skipIfPossible:a.counter>=1});if(me===h.oo.Break)break;a.repos=me}if(a.counter<2||a.reference==null){const me=yield*(0,h.xC)(a,P,{placeholder:fe=>`Choose a branch${fe.showTags?" or tag":""} to switch to`});if(me===h.oo.Break){de&&a.counter--;continue}a.reference=me}if(p.GitReference.isBranch(a.reference)&&a.reference.remote){P.title=`Create Branch and ${this.title}`;const{values:me}=await this.container.git.getBranches(a.reference.repoPath,{filter:fe=>{var He;return((He=fe.upstream)==null?void 0:He.name)===a.reference.name},sort:{orderBy:r.Vz.DateDesc}});if(me.length===0){const fe=yield*(0,h.f6)(a,P,{placeholder:"Please provide a name for the new branch",titleContext:` based on ${p.GitReference.toString(a.reference,{icon:!1})}`,value:a.createBranch??p.GitReference.getNameWithoutRemote(a.reference)});if(fe===h.oo.Break)continue;a.createBranch=fe}else a.createBranch=void 0}else a.createBranch=void 0;this.confirm(a.confirm)&&(yield*this.confirmStep(a,P))===h.oo.Break||(h.tR.endSteps(a),this.execute(a))}return a.counter<0?h.oo.Break:void 0}*confirmStep(a,P){const de=this.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[{label:P.title,description:a.createBranch?"-b":"",detail:`Will ${a.createBranch?`create and switch to a new branch named ${a.createBranch} from ${p.GitReference.toString(a.reference)}`:`switch to ${p.GitReference.toString(a.reference)}`} in ${a.repos.length===1?`$(repo) ${a.repos[0].formattedName}`:`${a.repos.length} repositories`}`}],void 0,{placeholder:`Confirm ${P.title}`}),me=yield de;return h.tR.canPickStepContinue(de,a,me)?void 0:h.oo.Break}}n(ao,"SwitchGitCommand");var kn=Object.defineProperty,Qr=Object.getOwnPropertySymbols,Sn=Object.prototype.hasOwnProperty,Ks=Object.prototype.propertyIsEnumerable,wt=n((Be,a,P)=>a in Be?kn(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"tag_defNormalProp"),sr=n((Be,a)=>{for(var P in a||(a={}))Sn.call(a,P)&&wt(Be,P,a[P]);if(Qr)for(var P of Qr(a))Ks.call(a,P)&&wt(Be,P,a[P]);return Be},"tag_spreadValues"),us=n((Be,a,P)=>(wt(Be,typeof a!="symbol"?a+"":a,P),P),"tag_publicField");const lo=new Map([["create","Create"],["delete","Delete"]]);function co(Be,a){return a==null?Be:`${lo.get(a)} ${Be}`}n(co,"tag_getTitle");class Fo extends h.tR{constructor(a,P){super(a,"tag","tag","Tag",{description:"create, or delete tags"});us(this,"subcommand");var de,me;let fe=0;if(((de=P?.state)==null?void 0:de.subcommand)!=null)switch(fe++,P.state.subcommand){case"create":P.state.reference!=null&&fe++,P.state.name!=null&&fe++,P.state.message!=null&&fe++;break;case"delete":P.state.references!=null&&(!Array.isArray(P.state.references)||P.state.references.length!==0)&&fe++;break}((me=P?.state)==null?void 0:me.repo)!=null&&fe++,this.initialState=sr({counter:fe,confirm:P?.confirm},P?.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 P={repos:this.container.git.openRepositories,associatedView:this.container.tagsView,showTags:!1,title:this.title};let de=!1;for(;this.canStepsContinue(a);){if(P.title=this.title,a.counter<1||a.subcommand==null){this.subcommand=void 0;const me=yield*this.pickSubcommandStep(a);if(me===h.oo.Break)break;a.subcommand=me}if(this.subcommand=a.subcommand,a.counter<2||a.repo==null||typeof a.repo=="string")if(de=!1,P.repos.length===1)de=!0,a.counter++,a.repo=P.repos[0];else{const me=yield*(0,h.lA)(a,P);if(me===h.oo.Break)continue;a.repo=me}switch(P.title=co(a.subcommand==="delete"?"Tags":this.title,a.subcommand),a.subcommand){case"create":{yield*this.createCommandSteps(a,P),a.name=void 0;break}case"delete":yield*this.deleteCommandSteps(a,P);break;default:h.tR.endSteps(a);break}de&&a.counter--}return a.counter<0?h.oo.Break:void 0}*pickSubcommandStep(a){const P=h.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:[b.QuickInputButtons.Back]}),de=yield P;return h.tR.canPickStepContinue(P,a,de)?de[0].item:h.oo.Break}async*createCommandSteps(a,P){var de,me;for(a.flags==null&&(a.flags=[]);this.canStepsContinue(a);){if(a.counter<3||a.reference==null){const fe=yield*(0,h.Yv)(a,P,{placeholder:He=>`Choose a branch${He.showTags?" or tag":""} to create the new tag from`,picked:((de=a.reference)==null?void 0:de.ref)??((me=await a.repo.getBranch())==null?void 0:me.ref),titleContext:" from",value:p.GitReference.isRevision(a.reference)?a.reference.ref:void 0});if(fe===h.oo.Break)break;a.reference=fe}if(a.counter<4||a.name==null){const fe=yield*(0,h.fG)(a,P,{placeholder:"Please provide a name for the new tag",titleContext:` at ${p.GitReference.toString(a.reference,{capitalize:!0,icon:!1})}`,value:a.name??p.GitReference.getNameWithoutRemote(a.reference)});if(fe===h.oo.Break)continue;a.name=fe}if(a.counter<5||a.message==null){const fe=yield*this.createCommandInputMessageStep(a,P);if(fe===h.oo.Break)continue;a.message=fe}if(a.message.length!==0&&!a.flags.includes("-m")&&a.flags.push("-m"),this.confirm(a.confirm)){const fe=yield*this.createCommandConfirmStep(a,P);if(fe===h.oo.Break)continue;a.flags=fe}h.tR.endSteps(a),a.repo.tag(...a.flags,...a.message.length!==0?[`"${a.message}"`]:[],a.name,a.reference.ref)}}async*createCommandInputMessageStep(a,P){const de=h.tR.createInputStep({title:(0,h.C8)(`${P.title} at ${p.GitReference.toString(a.reference,{capitalize:!0,icon:!1})}`,a,P),placeholder:"Please provide an optional message to annotate the tag",value:a.message,prompt:"Enter optional message"}),me=yield de;return!h.tR.canStepContinue(de,a,me)||!await h.tR.canInputStepContinue(de,a,me)?h.oo.Break:me}*createCommandConfirmStep(a,P){const de=h.tR.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[D.create(a.flags,a.message.length!==0?["-m"]:[],{label:P.title,description:a.message.length!==0?"-m":"",detail:`Will create a new tag named ${a.name} at ${p.GitReference.toString(a.reference)}`}),D.create(a.flags,a.message.length!==0?["--force","-m"]:["--force"],{label:`Force ${P.title}`,description:`--force${a.message.length!==0?" -m":""}`,detail:`Will forcibly create a new tag named ${a.name} at ${p.GitReference.toString(a.reference)}`})],P),me=yield de;return h.tR.canPickStepContinue(de,a,me)?me[0].item:h.oo.Break}async*deleteCommandSteps(a,P){for(var de;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){P.title=co("Tags",a.subcommand);const fe=yield*(0,h.yY)(a,P,{picked:(de=a.references)==null?void 0:de.map(He=>He.ref),placeholder:"Choose tags to delete"});if(fe===h.oo.Break)break;a.references=fe}P.title=co((0,L._6)("Tag",a.references.length,{only:!0}),a.subcommand),(yield*this.deleteCommandConfirmStep(a,P))!==h.oo.Break&&(h.tR.endSteps(a),a.repo.tagDelete(a.references))}}*deleteCommandConfirmStep(a,P){const de=h.tR.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[{label:P.title,detail:`Will delete ${p.GitReference.toString(a.references)}`}],P),me=yield de;return h.tR.canPickStepContinue(de,a,me)?void 0:h.oo.Break}}n(Fo,"TagGitCommand");var _t=v(7778),ci=v(6532),vn=v(320),hs=Object.defineProperty,Br=Object.getOwnPropertySymbols,Rn=Object.prototype.hasOwnProperty,on=Object.prototype.propertyIsEnumerable,hr=n((Be,a,P)=>a in Be?hs(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"worktree_defNormalProp"),jr=n((Be,a)=>{for(var P in a||(a={}))Rn.call(a,P)&&hr(Be,P,a[P]);if(Br)for(var P of Br(a))on.call(a,P)&&hr(Be,P,a[P]);return Be},"worktree_spreadValues"),Un=n((Be,a,P)=>(hr(Be,typeof a!="symbol"?a+"":a,P),P),"worktree_publicField");const Zr=new Map([["create","Create"],["delete","Delete"],["open","Open"]]);function Wn(Be,a){return a==null?Be:`${Zr.get(a)} ${Be}`}n(Wn,"worktree_getTitle");class Ln extends h.tR{constructor(a,P){super(a,"worktree","worktree","Worktree",{description:"open, create, or delete worktrees"});Un(this,"subcommand"),Un(this,"canSkipConfirmOverride");var de,me;let fe=0;if(((de=P?.state)==null?void 0:de.subcommand)!=null)switch(fe++,P.state.subcommand){case"create":P.state.uri!=null&&fe++,P.state.reference!=null&&fe++;break;case"delete":P.state.uris!=null&&(!Array.isArray(P.state.uris)||P.state.uris.length!==0)&&fe++;break;case"open":P.state.uri!=null&&fe++;break}((me=P?.state)==null?void 0:me.repo)!=null&&fe++,this.initialState=jr({counter:fe,confirm:P?.confirm},P?.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 P={repos:_t.W.instance.git.openRepositories,associatedView:_t.W.instance.worktreesView,showTags:!1,title:this.title};let de=!1;for(;this.canStepsContinue(a);){if(P.title=this.title,a.counter<1||a.subcommand==null){this.subcommand=void 0;const fe=yield*this.pickSubcommandStep(a);if(fe===h.oo.Break)break;a.subcommand=fe}if(this.subcommand=a.subcommand,a.counter<2||a.repo==null||typeof a.repo=="string")if(de=!1,P.repos.length===1)de=!0,a.counter++,a.repo=P.repos[0];else{const fe=yield*(0,h.lA)(a,P);if(fe===h.oo.Break)continue;a.repo=fe}if((yield*(0,h.Oz)(a,P,ci.x.Worktrees))===h.oo.Break)break;switch(P.title=Wn(a.subcommand==="delete"?"Worktrees":this.title,a.subcommand),a.subcommand){case"create":{yield*this.createCommandSteps(a,P),a.uri=void 0;break}case"delete":{a.uris!=null&&!Array.isArray(a.uris)&&(a.uris=[a.uris]),yield*this.deleteCommandSteps(a,P);break}case"open":{yield*this.openCommandSteps(a,P);break}default:h.tR.endSteps(a);break}de&&a.counter--}return a.counter<0?h.oo.Break:void 0}*pickSubcommandStep(a){const P=h.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:[b.QuickInputButtons.Back]}),de=yield P;return h.tR.canPickStepContinue(P,a,de)?de[0].item:h.oo.Break}async*createCommandSteps(a,P){var de,me,fe;for(P.defaultUri==null&&(P.defaultUri=await a.repo.getWorktreesDefaultUri()),a.flags==null&&(a.flags=[]),P.pickedUri=void 0,a.confirm=!0,this.canSkipConfirmOverride=void 0;this.canStepsContinue(a);){if(a.counter<3||a.reference==null){const ze=yield*(0,h.Yv)(a,P,{placeholder:Ye=>`Choose a branch${Ye.showTags?" or tag":""} to create the new worktree for`,picked:((de=a.reference)==null?void 0:de.ref)??((me=await a.repo.getBranch())==null?void 0:me.ref),titleContext:" for",value:p.GitReference.isRevision(a.reference)?a.reference.ref:void 0});if(ze===h.oo.Break)break;a.reference=ze}if(a.counter<4||a.uri==null)if(a.reference!=null&&!Xt.DN.get("worktrees.promptForLocation",a.repo.folder)&&P.defaultUri!=null)a.uri=P.defaultUri;else{const ze=yield*this.createCommandChoosePathStep(a,P,{titleContext:` for ${p.GitReference.toString(a.reference,{capitalize:!0,icon:!1,label:a.reference.refType!=="branch"})}`});if(ze===h.oo.Break)continue;a.uri=ze,P.pickedUri=a.uri}if(this.confirm(a.confirm)){const ze=yield*this.createCommandConfirmStep(a,P);if(ze===h.oo.Break)continue;[a.uri,a.flags]=ze}if(a.confirm=!0,this.canSkipConfirmOverride=void 0,a.flags.includes("-b")&&a.createBranch==null){const ze=yield*(0,h.f6)(a,P,{placeholder:"Please provide a name for the new branch",titleContext:` from ${p.GitReference.toString(a.reference,{capitalize:!0,icon:!1,label:a.reference.refType!=="branch"})}`,value:a.createBranch??p.GitReference.getNameWithoutRemote(a.reference)});if(ze===h.oo.Break){a.flags=[];continue}a.createBranch=ze}const He=a.flags.includes("--direct")?a.uri:b.Uri.joinPath(a.uri,...(a.createBranch??a.reference.name).replace(/\\/g,"/").split("/"));try{await a.repo.createWorktree(He,{commitish:(fe=a.reference)==null?void 0:fe.name,createBranch:a.flags.includes("-b")?a.createBranch:void 0,detach:a.flags.includes("--detach"),force:a.flags.includes("--force")})}catch(ze){if(Vr.P6.is(ze,Vr.hK.AlreadyCheckedOut)&&!a.flags.includes("--force")){const Ye={title:"Create New Branch"},yt={title:"Create Anyway"},zt={title:"Cancel",isCloseAffordance:!0},mi=await b.window.showWarningMessage(`Unable to create the new worktree because ${p.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},Ye,yt,zt);if(mi===Ye){a.flags.push("-b"),this.canSkipConfirmOverride=!0,a.confirm=!1;continue}if(mi===yt){a.flags.push("--force"),this.canSkipConfirmOverride=!0,a.confirm=!1;continue}}else Vr.P6.is(ze,Vr.hK.AlreadyExists)?b.window.showErrorMessage(`Unable to create a new worktree in '${p.GitWorktree.getFriendlyPath(He)}' because the folder already exists and is not empty.`,"OK"):Ki.V.showGenericErrorMessage(`Unable to create a new worktree in '${p.GitWorktree.getFriendlyPath(He)}.`)}h.tR.endSteps(a)}}async*createCommandChoosePathStep(a,P,de){const me=h.tR.createCustomStep({show:async He=>{const ze=await b.window.showOpenDialog({canSelectFiles:!1,canSelectFolders:!0,canSelectMany:!1,defaultUri:P.pickedUri??a.uri??P.defaultUri,openLabel:"Select Worktree Location",title:`${(0,h.C8)(`Choose Worktree Location${de?.titleContext??""}`,a,P)}`});return ze==null||ze.length===0?Ht.X.Back:ze[0]}}),fe=yield me;return!h.tR.canStepContinue(me,a,fe)||!await h.tR.canInputStepContinue(me,a,fe)?h.oo.Break:fe}*createCommandConfirmStep(a,P){const de=P.pickedUri??a.uri,me=(0,L.AO)(p.GitWorktree.getFriendlyPath(de),60);let fe=!0,He;const ze=a.repo.uri;ze.toString()!==de.toString()?(0,Ue.$d)(de,ze)?He=b.Uri.joinPath(ze,"..",`${(0,Ue.EZ)(ze.path)}.worktrees`):He=b.Uri.joinPath(de,`${(0,Ue.EZ)(ze.path)}.worktrees`):(He=b.Uri.joinPath(ze,"..",`${(0,Ue.EZ)(ze.path)}.worktrees`),fe=!1);const Ye=a.reference!=null?b.Uri.joinPath(He,...a.reference.name.replace(/\\/g,"/").split("/")):He,yt=(0,L.AO)(p.GitWorktree.getFriendlyPath(Ye),65),zt=(0,L.AO)(p.GitWorktree.getFriendlyPath(b.Uri.joinPath(He,"")),60),mi=h.tR.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[D.create(a.flags,[],{label:P.title,description:` for ${p.GitReference.toString(a.reference)}`,detail:`Will create worktree in $(folder) ${yt}`},He),D.create(a.flags,["-b"],{label:"Create New Branch and Worktree",description:` from ${p.GitReference.toString(a.reference)}`,detail:`Will create worktree in $(folder) ${zt}`},He),...fe?[xr.HH.create(),D.create(a.flags,["--direct"],{label:`${P.title} (directly in folder)`,description:` for ${p.GitReference.toString(a.reference)}`,detail:`Will create worktree directly in $(folder) ${me}`},de),D.create(a.flags,["-b","--direct"],{label:"Create New Branch and Worktree (directly in folder)",description:` from ${p.GitReference.toString(a.reference)}`,detail:`Will create worktree directly in $(folder) ${me}`},de)]:[]],P),Ji=yield mi;return h.tR.canPickStepContinue(mi,a,Ji)?[Ji[0].context,Ji[0].item]:h.oo.Break}async*deleteCommandSteps(a,P){var de;for(P.worktrees=await a.repo.getWorktrees(),a.flags==null&&(a.flags=[]);this.canStepsContinue(a);){if(a.counter<3||a.uris==null||a.uris.length===0){P.title=Wn("Worktrees",a.subcommand);const fe=yield*(0,h.Mb)(a,P,{filter:He=>He.main||!He.opened,includeStatus:!0,picked:(de=a.uris)==null?void 0:de.map(He=>He.toString()),placeholder:"Choose worktrees to delete"});if(fe===h.oo.Break)break;a.uris=fe.map(He=>He.uri)}P.title=Wn((0,L._6)("Worktree",a.uris.length,{only:!0}),a.subcommand);const me=yield*this.deleteCommandConfirmStep(a,P);if(me!==h.oo.Break){a.flags=me,h.tR.endSteps(a);for(const fe of a.uris){let He=!1;do{He=!1;const ze=a.flags.includes("--force");try{if(ze){const Ye=P.worktrees.find(zt=>zt.uri.toString()===fe.toString()),yt=await Ye?.getStatus();if(yt?.hasChanges??!1){const zt={title:"Force Delete"},mi={title:"Cancel",isCloseAffordance:!0};if(await b.window.showWarningMessage(`The worktree in '${fe.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},zt,mi)!==zt)return}}await a.repo.deleteWorktree(fe,{force:ze})}catch(Ye){if(Vr.Nk.is(Ye)){if(Ye.reason===Vr.xe.MainWorkingTree)b.window.showErrorMessage("Unable to delete the main worktree");else if(!ze){const yt={title:"Force Delete"},zt={title:"Cancel",isCloseAffordance:!0};await b.window.showErrorMessage(Ye.reason===Vr.xe.HasChanges?`Unable to delete worktree because there are UNCOMMITTED changes in '${fe.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 '${fe.fsPath}'. Would you like to try to forcibly delete it?`,{modal:!0},yt,zt)===yt&&(a.flags.push("--force"),He=!0)}}else Ki.V.showGenericErrorMessage(`Unable to delete worktree in '${fe.fsPath}.`)}}while(He)}}}}*deleteCommandConfirmStep(a,P){const de=h.tR.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[D.create(a.flags,[],{label:P.title,detail:`Will delete ${(0,L._6)("worktree",a.uris.length,{only:a.uris.length===1})}${a.uris.length===1?` in $(folder) ${p.GitWorktree.getFriendlyPath(a.uris[0])}`:""}`}),D.create(a.flags,["--force"],{label:`Force ${P.title}`,description:"including ANY UNCOMMITTED changes",detail:`Will forcibly delete ${(0,L._6)("worktree",a.uris.length,{only:a.uris.length===1})} ${a.uris.length===1?` in $(folder) ${p.GitWorktree.getFriendlyPath(a.uris[0])}`:""}`})],P),me=yield de;return h.tR.canPickStepContinue(de,a,me)?me[0].item:h.oo.Break}async*openCommandSteps(a,P){var de;for(P.worktrees=await a.repo.getWorktrees(),a.flags==null&&(a.flags=[]);this.canStepsContinue(a);){if(a.counter<3||a.uri==null){P.title=Wn("Worktree",a.subcommand);const He=yield*(0,h.UP)(a,P,{includeStatus:!0,picked:(de=a.uri)==null?void 0:de.toString(),placeholder:"Choose worktree to open"});if(He===h.oo.Break)break;a.uri=He.uri}P.title=Wn("Worktree",a.subcommand);const me=yield*this.openCommandConfirmStep(a,P);if(me===h.oo.Break)continue;a.flags=me,h.tR.endSteps(a);const fe=P.worktrees.find(He=>He.uri.toString()===a.uri.toString());a.flags.includes("--reveal-explorer")?rr.u.Worktree.revealInFileExplorer(fe):rr.u.Worktree.open(fe,{location:a.flags.includes("--new-window")?vn.Tc.NewWindow:vn.Tc.CurrentWindow})}}*openCommandConfirmStep(a,P){const de=h.tR.createConfirmStep((0,h.C8)(`Confirm ${P.title}`,a,P),[D.create(a.flags,[],{label:P.title,detail:`Will open, in the current window, the worktree in $(folder) ${p.GitWorktree.getFriendlyPath(a.uri)}`}),D.create(a.flags,["--new-window"],{label:`${P.title} in a New Window`,detail:`Will open, in a new window, the worktree in $(folder) ${p.GitWorktree.getFriendlyPath(a.uri)}`}),D.create(a.flags,["--reveal-explorer"],{label:"Reveal in File Explorer",detail:`Will open, in the File Explorer, the worktree in $(folder) ${p.GitWorktree.getFriendlyPath(a.uri)}`})],P),me=yield de;return h.tR.canPickStepContinue(de,a,me)?me[0].item:h.oo.Break}}n(Ln,"WorktreeGitCommand");var uo=Object.defineProperty,Gn=n((Be,a,P)=>a in Be?uo(Be,a,{enumerable:!0,configurable:!0,writable:!0,value:P}):Be[a]=P,"gitCommands_utils_defNormalProp"),dr=n((Be,a,P)=>(Gn(Be,typeof a!="symbol"?a+"":a,P),P),"gitCommands_utils_publicField");function*sn(){}n(sn,"nullSteps");function $r(Be,a,P){const de=new Ao(Be,a),me=de.find(a.command);return me==null?sn():(de.setCommand(me,P),me.executeSteps())}n($r,"getSteps");class Ao{constructor(a,P){this.container=a,dr(this,"buttons",[]),dr(this,"hiddenItems"),dr(this,"ignoreFocusOut",!1),dr(this,"items"),dr(this,"matchOnDescription",!0),dr(this,"placeholder","Choose a git command"),dr(this,"title","GitLens"),dr(this,"_command");const de=(0,_.f)(B.zf.HasVirtualFolders,!1),me=de||(0,_.f)(B.zf.Readonly,!1)||(0,_.f)(B.zf.Untrusted,!1);if(this.items=[me?void 0:new ne(a,P?.command==="branch"?P:void 0),me?void 0:new Me(a,P?.command==="cherry-pick"?P:void 0),de?void 0:new Ee(a,P?.command==="co-authors"?P:void 0),me?void 0:new Ae(a,P?.command==="fetch"?P:void 0),new Oi(a,P?.command==="log"?P:void 0),me?void 0:new be(a,P?.command==="merge"?P:void 0),me?void 0:new Pt(a,P?.command==="pull"?P:void 0),me?void 0:new Gr(a,P?.command==="push"?P:void 0),me?void 0:new Vt(a,P?.command==="rebase"?P:void 0),me?void 0:new Li(a,P?.command==="reset"?P:void 0),me?void 0:new Hr(a,P?.command==="revert"?P:void 0),new pt(a,P?.command==="search"||P?.command==="grep"?P:void 0),new cs(a,P?.command==="show"?P:void 0),de?void 0:new Dn(a,P?.command==="stash"?P:void 0),de?void 0:new li(a,P?.command==="status"?P:void 0),me?void 0:new ao(a,P?.command==="switch"||P?.command==="checkout"?P:void 0),me?void 0:new Fo(a,P?.command==="tag"?P:void 0),de?void 0:new Ln(a,P?.command==="worktree"?P:void 0)].filter(fe=>fe!=null),this.container.config.gitCommands.sortBy===r.zL.Usage){const fe=this.container.storage.getWorkspace(R.sZ.GitCommandPaletteUsage);fe!=null&&this.items.sort((He,ze)=>(fe[ze.key]??0)-(fe[He.key]??0))}this.hiddenItems=[]}get command(){return this._command}find(a,P=!1){if(P){const de=a.toLowerCase();return this.items.find(me=>me.isFuzzyMatch(de))??this.hiddenItems.find(me=>me.isFuzzyMatch(de))}return this.items.find(de=>de.isMatch(a))??this.hiddenItems.find(de=>de.isMatch(a))}setCommand(a,P){this._command!=null&&(this._command.picked=!1),a!=null&&(a.picked=!0,a.pickedVia=P),this._command=a,a!=null&&this.updateCommandUsage(a.key,Date.now())}async updateCommandUsage(a,P){let de=this.container.storage.getWorkspace(R.sZ.GitCommandPaletteUsage);de===void 0&&(de=Object.create(null)),de[a]=P,await this.container.storage.storeWorkspace(R.sZ.GitCommandPaletteUsage,de)}}n(Ao,"PickCommandStep")},8318:(Se,ae,v)=>{"use strict";v.d(ae,{jQ:()=>R,rO:()=>p});var r=v(9496),B=v.n(r),_=v(7778);class R{constructor(z,U=!1){this.state=z,this._on=U}get iconPath(){const z=this.getToggledState().icon;return typeof z=="string"?{dark:r.Uri.file(_.W.instance.context.asAbsolutePath(`images/dark/${z}.svg`)),light:r.Uri.file(_.W.instance.context.asAbsolutePath(`images/light/${z}.svg`))}:z}get tooltip(){return this.getToggledState().tooltip}get on(){return this._on}set on(z){this._on=z}getState(){return typeof this.state=="function"?this.state():this.state}getToggledState(){return this.on?this.getState().on:this.getState().off}}n(R,"ToggleQuickInputButton");class b extends R{constructor(z,U,O=!1){super({off:{tooltip:z,icon:U.off},on:{tooltip:z,icon:U.on}},O)}}n(b,"SelectableQuickInputButton");var p;(M=>{M.Fetch={iconPath:new r.ThemeIcon("sync"),tooltip:"Fetch"},M.LoadMore={iconPath:new r.ThemeIcon("refresh"),tooltip:"Load More"},M.MatchCaseToggle=class extends b{constructor(z=!1){super("Match Case",{off:"icon-match-case",on:"icon-match-case-selected"},z)}},M.MatchAllToggle=class extends b{constructor(z=!1){super("Match All",{off:"icon-match-all",on:"icon-match-all-selected"},z)}},M.MatchRegexToggle=class extends b{constructor(z=!1){super("Match using Regular Expressions",{off:"icon-match-regex",on:"icon-match-regex-selected"},z)}},M.PickCommit={iconPath:new r.ThemeIcon("git-commit"),tooltip:"Choose a Specific Commit"},M.PickCommitToggle=class extends R{constructor(z=!1,U,O){super(()=>({on:{tooltip:"Choose a Specific Commit",icon:new r.ThemeIcon("git-commit")},off:{tooltip:`Choose a Branch${U.showTags?" or Tag":""}`,icon:new r.ThemeIcon("git-branch")}}),z);this.onDidClick=O}},M.OpenInNewWindow={iconPath:new r.ThemeIcon("empty-window"),tooltip:"Open in New Window"},M.RevealInSideBar={iconPath:new r.ThemeIcon("eye"),tooltip:"Reveal in Side Bar"},M.SearchInSideBar={iconPath:new r.ThemeIcon("search"),tooltip:"Search in Side Bar"},M.ShowResultsInSideBar={iconPath:new r.ThemeIcon("link-external"),tooltip:"Show Results in Side Bar"},M.ShowTagsToggle=class extends b{constructor(z=!1){super("Show Tags",{off:new r.ThemeIcon("tag"),on:"icon-tag-selected"},z)}},M.WillConfirmForced={iconPath:new r.ThemeIcon("check"),tooltip:"Will always confirm"},M.WillConfirmToggle=class extends R{constructor(z=!1,U){super(()=>({on:{tooltip:"Will confirm",icon:{dark:r.Uri.file(_.W.instance.context.asAbsolutePath("images/dark/icon-check.svg")),light:r.Uri.file(_.W.instance.context.asAbsolutePath("images/light/icon-check.svg"))}},off:{tooltip:"Skips confirm",icon:{dark:r.Uri.file(_.W.instance.context.asAbsolutePath("images/dark/icon-no-check.svg")),light:r.Uri.file(_.W.instance.context.asAbsolutePath("images/light/icon-no-check.svg"))}}}),z);this.onDidClick=U}}})(p||(p={}))},3222:(Se,ae,v)=>{"use strict";v.d(ae,{tR:()=>ai,rO:()=>B.rO,oo:()=>ki,C8:()=>Te,Oz:()=>ji,B$:()=>Lt,v$:()=>Dt,f6:()=>Pt,fG:()=>Xt,a:()=>Hr,Gj:()=>Or,Dr:()=>xr,Yv:()=>Wt,xC:()=>di,sd:()=>hi,FO:()=>Yt,s4:()=>Ii,Rj:()=>lr,bR:()=>cr,j8:()=>pn,lA:()=>Nr,Qp:()=>Gr,yY:()=>ue,UP:()=>xe,Mb:()=>Ce,nI:()=>Vt,fD:()=>Ct,KT:()=>Oe,up:()=>vi});var r=v(4761),B=v(8318),_=v(9179),R=v(1045),b=v(7778),p=v(2833),M=v(4504),z=v(3969),U=v(4338),O=v(3708),F=v(5355),y=v(3542),V=v(2062),I=v(7042),Y=v(4073),D=v(5084),x=v(1692);function L(se){return se!==se}n(L,"baseIsNaN");const h=L;function E(se,ye,je){for(var Xe=je-1,Qe=se.length;++Xe-1}n($,"arrayIncludes");const A=$;function k(se,ye,je){for(var Xe=-1,Qe=se==null?0:se.length;++Xe=120&&At.length>=120)?new D.Z(pt&&At):void 0}At=se[0];var Kt=-1,Nt=Ot[0];e:for(;++Kt0){if(++ye>=ut)return arguments[0]}else ye=0;return se.apply(void 0,arguments)}}n(Ee,"shortOut");var lt=Ee(rt);const ht=lt;function St(se,ye){return ht(Ge(se,ye,ne.Z),se+"")}n(St,"baseRest");const Ut=St;var ri=v(585),We=v(8533);function le(se){return(0,We.Z)(se)&&(0,ri.Z)(se)}n(le,"isArrayLikeObject");const Ae=le;function De(se){return Ae(se)?se:[]}n(De,"castArrayLikeObject");const Re=De;function Je(se){var ye=se==null?0:se.length;return ye?se[ye-1]:void 0}n(Je,"last");const mt=Je;var vt=Ut(function(se){var ye=mt(se),je=(0,Y.Z)(se,Re);return ye=typeof ye=="function"?ye:void 0,ye&&je.pop(),je.length&&je[0]===se[0]?ie(je,void 0,ye):[]});const ot=vt;var Zt=v(1677),Ri=v(2886),Oi=v(2971),Ht=v(320),Rt=v(5387),Pi=Object.defineProperty,Bi=Object.getOwnPropertySymbols,wi=Object.prototype.hasOwnProperty,Zi=Object.prototype.propertyIsEnumerable,gt=n((se,ye,je)=>ye in se?Pi(se,ye,{enumerable:!0,configurable:!0,writable:!0,value:je}):se[ye]=je,"__defNormalProp"),be=n((se,ye)=>{for(var je in ye||(ye={}))wi.call(ye,je)&>(se,je,ye[je]);if(Bi)for(var je of Bi(ye))Zi.call(ye,je)&>(se,je,ye[je]);return se},"__spreadValues");function Te(se,ye,je,Xe){if(je.repos.length===1)return`${se}${(0,Oi.$G)(Xe??"",R.d$-se.length)}`;let Qe;return ye.repo!=null?Qe=`${Xe??""}${(0,Oi.vk)(R.NE.Dot,2,2)}${ye.repo.formattedName}`:ye.repos.length===1?Qe=`${Xe??""}${(0,Oi.vk)(R.NE.Dot,2,2)}${ye.repos[0].formattedName}`:Qe=`${(0,Oi.vk)(R.NE.Dot,2,2)}${ye.repos.length} repositories`,`${se}${(0,Oi.$G)(Qe,R.d$-se.length)}`}n(Te,"appendReposToTitle");async function Ke(se,ye){return Lt(se,["branches"],{buttons:ye?.buttons,filter:ye?.filter!=null?{branches:ye.filter}:void 0,picked:ye?.picked,sort:ye?.sort!=null?{branches:ye.sort}:!0})}n(Ke,"getBranches");async function qe(se,ye){return Lt(se,["tags"],{buttons:ye?.buttons,filter:ye?.filter!=null?{tags:ye.filter}:void 0,picked:ye?.picked,sort:ye?.sort!=null?{tags:ye.sort}:!0})}n(qe,"getTags");async function at(se,{buttons:ye,filter:je,includeStatus:Xe,picked:Qe}){const ct=se instanceof p.Repository?await se.getWorktrees():se;return Promise.all([...ct.filter(pt=>je==null||je(pt)).map(async pt=>F.dO.create(pt,Qe!=null&&(typeof Qe=="string"?pt.uri.toString()===Qe:Qe.includes(pt.uri.toString())),{buttons:ye,path:!0,status:Xe?await pt.getStatus():void 0}))])}n(at,"getWorktrees");async function Lt(se,ye,{buttons:je,filter:Xe,picked:Qe,sort:ct}={}){var pt,Ot,ni,oi,At,Kt;if(se==null)return[];let Nt,Jt,jt=!1;if(se instanceof p.Repository||se.length===1){jt=!0;const Mt=se instanceof p.Repository?se:se[0],[Gi,gn]=await Promise.allSettled([ye.includes("branches")?Mt.getBranches({filter:Xe?.branches,sort:typeof ct=="boolean"?ct:ct?.branches}):void 0,ye.includes("tags")?Mt.getTags({filter:Xe?.tags,sort:!0}):void 0]);Nt=(Gi.status==="fulfilled"?(pt=Gi.value)==null?void 0:pt.values:void 0)??[],Jt=(gn.status==="fulfilled"?(Ot=gn.value)==null?void 0:Ot.values:void 0)??[]}else{const[Mt,Gi]=await Promise.allSettled([ye.includes("branches")?Promise.allSettled(se.map(or=>or.getBranches({filter:Xe?.branches,sort:typeof ct=="boolean"?ct:ct?.branches}))):void 0,ye.includes("tags")?Promise.allSettled(se.map(or=>or.getTags({filter:Xe?.tags,sort:typeof ct=="boolean"?ct:ct?.tags}))):void 0]),gn=Mt.status==="fulfilled"?(oi=(ni=Mt.value)==null?void 0:ni.filter(or=>or.status==="fulfilled"))==null?void 0:oi.map(or=>or.value.values):void 0,_n=Gi.status==="fulfilled"?(Kt=(At=Gi.value)==null?void 0:At.filter(or=>or.status==="fulfilled"))==null?void 0:Kt.map(or=>or.value.values):void 0;ye.includes("branches")&&gn!=null&&(Nt=p.GitBranch.sort(ot(...gn,(or,Nn)=>or.name===Nn.name))),ye.includes("tags")&&_n!=null&&(Jt=p.GitTag.sort(ot(..._n,(or,Nn)=>or.name===Nn.name)))}return(Nt==null||Nt.length===0)&&(Jt==null||Jt.length===0)?[]:Nt!=null&&Nt.length!==0&&(Jt==null||Jt.length===0)?[O.HH.create("Branches"),...await Promise.all(Nt.filter(Mt=>!Mt.remote).map(Mt=>F.Oh.create(Mt,Qe!=null&&(typeof Qe=="string"?Mt.ref===Qe:Qe.includes(Mt.ref)),{buttons:je,current:jt?"checkmark":!1,ref:jt,status:jt,type:"remote"}))),O.HH.create("Remote Branches"),...await Promise.all(Nt.filter(Mt=>Mt.remote).map(Mt=>F.Oh.create(Mt,Qe!=null&&(typeof Qe=="string"?Mt.ref===Qe:Qe.includes(Mt.ref)),{buttons:je,current:jt?"checkmark":!1,ref:jt,status:jt,type:"remote"})))]:Jt!=null&&Jt.length!==0&&(Nt==null||Nt.length===0)?Jt.map(Mt=>F.WG.create(Mt,Qe!=null&&(typeof Qe=="string"?Mt.ref===Qe:Qe.includes(Mt.ref)),{buttons:je,message:!1,ref:jt})):[O.HH.create("Branches"),...await Promise.all(Nt.filter(Mt=>!Mt.remote).map(Mt=>F.Oh.create(Mt,Qe!=null&&(typeof Qe=="string"?Mt.ref===Qe:Qe.includes(Mt.ref)),{buttons:je,current:jt?"checkmark":!1,ref:jt,status:jt}))),O.HH.create("Tags"),...Jt.map(Mt=>F.WG.create(Mt,Qe!=null&&(typeof Qe=="string"?Mt.ref===Qe:Qe.includes(Mt.ref)),{buttons:je,message:!1,ref:jt,type:!0})),O.HH.create("Remote Branches"),...await Promise.all(Nt.filter(Mt=>Mt.remote).map(Mt=>F.Oh.create(Mt,Qe!=null&&(typeof Qe=="string"?Mt.ref===Qe:Qe.includes(Mt.ref)),{buttons:je,current:jt?"checkmark":!1,ref:jt,status:jt,type:"remote"})))]}n(Lt,"getBranchesAndOrTags");function Dt(se,ye){return async(je,Xe)=>{let Qe=!1;if(Xe.startsWith("#")&&(Qe=!0,Xe=Xe.substring(1)),se==null)return!1;if(Array.isArray(se)){if(se.length!==1)return!1;se=se[0]}if(Qe&&ye?.ranges&&p.GitRevision.isRange(Xe))return je.items=[F.Em.create(Xe,se.path,!0,{alwaysShow:!0,buttons:ye?.buttons,ref:!1,icon:!1})],!0;if(!await b.W.instance.git.validateReference(se.path,Xe))return Qe?(je.items=[r.x.create(r.X.Back,!0,{label:"Enter a reference or commit SHA"})],!0):!1;if(!Qe&&await b.W.instance.git.hasBranchOrTag(se.path,{filter:{branches:pt=>pt.name.includes(Xe),tags:pt=>pt.name.includes(Xe)}}))return!1;const ct=await b.W.instance.git.getCommit(se.path,Xe);return je.items=[F.zK.create(ct,!0,{alwaysShow:!0,buttons:ye?.buttons,compact:!0,icon:!0})],!0}}n(Dt,"getValidateGitReferenceFn");async function*Pt(se,ye,je){const Xe=ai.createInputStep({title:Te(`${ye.title}${je.titleContext??""}`,se,ye),placeholder:je.placeholder,value:je.value,prompt:"Enter branch name",validate:async ct=>{if(ct==null)return[!1,void 0];if(ct=ct.trim(),ct.length===0)return[!1,"Please enter a valid branch name"];if("repo"in se){const Ot=await b.W.instance.git.validateBranchOrTagName(se.repo.path,ct);return[Ot,Ot?void 0:`'${ct}' isn't a valid branch name`]}let pt=!0;for(const Ot of se.repos)if(pt=await b.W.instance.git.validateBranchOrTagName(Ot.path,ct),!pt)return[!1,`'${ct}' isn't a valid branch name`];return[!0,void 0]}}),Qe=yield Xe;return!ai.canStepContinue(Xe,se,Qe)||!await ai.canInputStepContinue(Xe,se,Qe)?ki.Break:Qe}n(Pt,"inputBranchNameStep");async function*Xt(se,ye,je){const Xe=ai.createInputStep({title:Te(`${ye.title}${je.titleContext??""}`,se,ye),placeholder:je.placeholder,value:je.value,prompt:"Enter tag name",validate:async ct=>{if(ct==null)return[!1,void 0];if(ct=ct.trim(),ct.length===0)return[!1,"Please enter a valid tag name"];if("repo"in se){const Ot=await b.W.instance.git.validateBranchOrTagName(se.repo.path,ct);return[Ot,Ot?void 0:`'${ct}' isn't a valid tag name`]}let pt=!0;for(const Ot of se.repos)if(pt=await b.W.instance.git.validateBranchOrTagName(Ot.path,ct),!pt)return[!1,`'${ct}' isn't a valid branch name`];return[!0,void 0]}}),Qe=yield Xe;return!ai.canStepContinue(Xe,se,Qe)||!await ai.canInputStepContinue(Xe,se,Qe)?ki.Break:Qe}n(Xt,"inputTagNameStep");async function*hi(se,ye,{filter:je,picked:Xe,placeholder:Qe,titleContext:ct}){const pt=await Ke(se.repo,{buttons:[B.rO.RevealInSideBar],filter:je,picked:Xe}),Ot=ai.createPickStep({title:Te(`${ye.title}${ct??""}`,se,ye),placeholder:pt.length===0?`No branches found in ${se.repo.formattedName}`:Qe,matchOnDetail:!0,items:pt.length===0?[r.x.create(r.X.Back,!0),r.x.create(r.X.Cancel)]:pt,onDidClickItemButton:(oi,At,{item:Kt})=>{At===B.rO.RevealInSideBar&&Rt.u.Branch.reveal(Kt,{select:!0,focus:!1,expand:!0})},keys:["right","alt+right","ctrl+right"],onDidPressKey:async oi=>{oi.activeItems.length!==0&&await Rt.u.Branch.reveal(oi.activeItems[0].item,{select:!0,focus:!1,expand:!0})}}),ni=yield Ot;return ai.canPickStepContinue(Ot,se,ni)?ni[0].item:ki.Break}n(hi,"pickBranchStep");async function*Yt(se,ye,{filter:je,picked:Xe,placeholder:Qe,sort:ct,titleContext:pt}){const Ot=await Ke(se.repo,{buttons:[B.rO.RevealInSideBar],filter:je,picked:Xe,sort:ct}),ni=ai.createPickStep({multiselect:Ot.length!==0,title:Te(`${ye.title}${pt??""}`,se,ye),placeholder:Ot.length===0?`No branches found in ${se.repo.formattedName}`:Qe,matchOnDetail:!0,items:Ot.length===0?[r.x.create(r.X.Back,!0),r.x.create(r.X.Cancel)]:Ot,onDidClickItemButton:(At,Kt,{item:Nt})=>{Kt===B.rO.RevealInSideBar&&Rt.u.Branch.reveal(Nt,{select:!0,focus:!1,expand:!0})},keys:["right","alt+right","ctrl+right"],onDidPressKey:async At=>{At.activeItems.length!==0&&await Rt.u.Branch.reveal(At.activeItems[0].item,{select:!0,focus:!1,expand:!0})}}),oi=yield ni;return ai.canPickStepContinue(ni,se,oi)?oi.map(At=>At.item):ki.Break}n(Yt,"pickBranchesStep");async function*Wt(se,ye,{filter:je,picked:Xe,placeholder:Qe,titleContext:ct,value:pt,additionalButtons:Ot,ranges:ni}){ye.showTags=!0;const oi=new B.rO.ShowTagsToggle(ye.showTags),At=n(async()=>Lt(se.repo,ye.showTags?["branches","tags"]:["branches"],{buttons:typeof ye.pickCommitForItem=="boolean"?[B.rO.PickCommit,B.rO.RevealInSideBar]:[B.rO.RevealInSideBar],filter:je,picked:Xe,sort:!0}),"getBranchesAndOrTagsFn"),Kt=await At(),Nt=ai.createPickStep({title:Te(`${ye.title}${ct??""}`,se,ye),placeholder:Kt.length===0?`No branches${ye.showTags?" or tags":""} found in ${se.repo.formattedName}`:`${typeof Qe=="string"?Qe:Qe(ye)}${R.NE.Space.repeat(3)}(or enter a reference using #)`,matchOnDescription:!0,matchOnDetail:!0,value:pt,items:Kt.length===0?[r.x.create(r.X.Back,!0),r.x.create(r.X.Cancel)]:Kt,additionalButtons:[...Ot??[],oi],onDidClickItemButton:(jt,Mt,{item:Gi})=>Mt===B.rO.PickCommit?(ye.pickCommitForItem=!0,!0):(Mt===B.rO.RevealInSideBar&&(p.GitReference.isBranch(Gi)?Rt.u.Branch.reveal(Gi,{select:!0,focus:!1,expand:!0}):p.GitReference.isTag(Gi)?Rt.u.Tag.reveal(Gi,{select:!0,focus:!1,expand:!0}):p.GitReference.isRevision(Gi)&&Rt.u.Commit.reveal(Gi,{select:!0,focus:!1,expand:!0})),!1),onDidClickButton:async(jt,Mt)=>{if(Mt===oi){jt.busy=!0,jt.enabled=!1;try{ye.showTags=!ye.showTags,oi.on=ye.showTags;const Gi=await At();jt.placeholder=Gi.length===0?`${se.repo.formattedName} has no branches${ye.showTags?" or tags":""}`:`${typeof Qe=="string"?Qe:Qe(ye)}${R.NE.Space.repeat(3)}(or enter a reference using #)`,jt.items=Gi}finally{jt.busy=!1,jt.enabled=!0}}},keys:["right","alt+right","ctrl+right"],onDidPressKey:jt=>{if(jt.activeItems.length===0)return;const Mt=jt.activeItems[0].item;p.GitReference.isBranch(Mt)?Rt.u.Branch.reveal(Mt,{select:!0,focus:!1,expand:!0}):p.GitReference.isTag(Mt)?Rt.u.Tag.reveal(Mt,{select:!0,focus:!1,expand:!0}):p.GitReference.isRevision(Mt)&&Rt.u.Commit.reveal(Mt,{select:!0,focus:!1,expand:!0})},onValidateValue:Dt(se.repo,{ranges:ni})}),Jt=yield Nt;return ai.canPickStepContinue(Nt,se,Jt)?Jt[0].item:ki.Break}n(Wt,"pickBranchOrTagStep");async function*di(se,ye,{filter:je,picked:Xe,placeholder:Qe,titleContext:ct,value:pt}){ye.showTags=se.repos.length===1;const Ot=new B.rO.ShowTagsToggle(ye.showTags),ni=n(()=>{var Nt;return Lt(se.repos,ye.showTags?["branches","tags"]:["branches"],{buttons:[B.rO.RevealInSideBar],filter:be({branches:se.repos.length===1?void 0:Jt=>!Jt.remote},je),picked:Xe??((Nt=se.reference)==null?void 0:Nt.ref),sort:{branches:{orderBy:_.Vz.DateDesc},tags:{orderBy:_.RV.DateDesc}}})},"getBranchesAndOrTagsFn"),oi=await ni(),At=ai.createPickStep({title:Te(`${ye.title}${ct??""}`,se,ye),placeholder:oi.length===0?`No ${se.repos.length===1?"":"common "}branches${ye.showTags?" or tags":""} found in ${se.repos.length===1?se.repos[0].formattedName:`${se.repos.length} repositories`}`:`${typeof Qe=="string"?Qe:Qe(ye)}${R.NE.Space.repeat(3)}(or enter a reference using #)`,matchOnDescription:!0,matchOnDetail:!0,value:pt??(p.GitReference.isRevision(se.reference)?se.reference.ref:void 0),items:oi.length===0?[r.x.create(r.X.Back,!0),r.x.create(r.X.Cancel)]:oi,additionalButtons:[Ot],onDidClickItemButton:(Nt,Jt,{item:jt})=>{Jt===B.rO.RevealInSideBar&&(p.GitReference.isBranch(jt)?Rt.u.Branch.reveal(jt,{select:!0,focus:!1,expand:!0}):p.GitReference.isTag(jt)?Rt.u.Tag.reveal(jt,{select:!0,focus:!1,expand:!0}):p.GitReference.isRevision(jt)&&Rt.u.Commit.reveal(jt,{select:!0,focus:!1,expand:!0}))},onDidClickButton:async(Nt,Jt)=>{if(Jt===Ot){Nt.busy=!0,Nt.enabled=!1;try{ye.showTags=!ye.showTags,Ot.on=ye.showTags;const jt=await ni();Nt.placeholder=jt.length===0?`No ${se.repos.length===1?"":"common "}branches${ye.showTags?" or tags":""} found in ${se.repos.length===1?se.repos[0].formattedName:`${se.repos.length} repositories`}`:`${typeof Qe=="string"?Qe:Qe(ye)}${R.NE.Space.repeat(3)}(or enter a reference using #)`,Nt.items=jt}finally{Nt.busy=!1,Nt.enabled=!0}}},keys:["right","alt+right","ctrl+right"],onDidPressKey:Nt=>{if(Nt.activeItems.length===0)return;const Jt=Nt.activeItems[0].item;p.GitReference.isBranch(Jt)?Rt.u.Branch.reveal(Jt,{select:!0,focus:!1,expand:!0}):p.GitReference.isTag(Jt)?Rt.u.Tag.reveal(Jt,{select:!0,focus:!1,expand:!0}):p.GitReference.isRevision(Jt)&&Rt.u.Commit.reveal(Jt,{select:!0,focus:!1,expand:!0})},onValidateValue:Dt(se.repos)}),Kt=yield At;return ai.canPickStepContinue(At,se,Kt)?Kt[0].item:ki.Break}n(di,"pickBranchOrTagStepMultiRepo");async function*Ii(se,ye,{ignoreFocusOut:je,log:Xe,onDidLoadMore:Qe,picked:ct,placeholder:pt,showInSideBarCommand:Ot,showInSideBarButton:ni,titleContext:oi}){function At(Jt){return Jt==null?[r.x.create(r.X.Back,!0),r.x.create(r.X.Cancel)]:[...(0,Ri.UI)(Jt.commits.values(),jt=>F.zK.create(jt,ct!=null&&(typeof ct=="string"?jt.ref===ct:ct.includes(jt.ref)),{buttons:[B.rO.RevealInSideBar,B.rO.SearchInSideBar],compact:!0,icon:!0})),...Jt?.hasMore?[r.x.create(r.X.LoadMore)]:[]]}n(At,"getItems");const Kt=ai.createPickStep({title:Te(`${ye.title}${oi??""}`,se,ye),placeholder:typeof pt=="string"?pt:pt(ye,Xe),ignoreFocusOut:je,matchOnDescription:!0,matchOnDetail:!0,value:typeof ct=="string"&&Xe?.count===0?ct:void 0,items:Ot!=null?[Ot,...At(Xe)]:At(Xe),onDidLoadMore:async Jt=>{var jt;return Jt.keepScrollPosition=!0,Xe=await((jt=Xe?.more)==null?void 0:jt.call(Xe,_.DN.get("advanced.maxListItems"))),Qe?.(Xe),typeof pt!="string"&&(Jt.placeholder=pt(ye,Xe)),At(Xe)},additionalButtons:[...ni?.button!=null?[ni?.button]:[],...Xe?.hasMore?[B.rO.LoadMore]:[]],onDidClickItemButton:(Jt,jt,Mt)=>{if(!O.$w.is(Mt))switch(jt){case B.rO.RevealInSideBar:Rt.u.Commit.reveal(Mt.item,{select:!0,focus:!1,expand:!0});break;case B.rO.SearchInSideBar:b.W.instance.searchAndCompareView.search(se.repo.path,{pattern:z.n.fromCommit(Mt.item.ref)},{label:{label:`for ${p.GitReference.toString(Mt.item,{icon:!1})}`},reveal:{select:!0,focus:!1,expand:!0}});break}},onDidClickButton:(Jt,jt)=>{if(Xe==null)return;const Mt=Jt.activeItems.filter(Gi=>!O.$w.is(Gi));jt===ni?.button&&ni.onDidClick(Mt)},keys:["right","alt+right","ctrl+right"],onDidPressKey:async(Jt,jt)=>{if(Jt.activeItems.length===0)return;const Mt=Jt.activeItems.filter(Gi=>!O.$w.is(Gi));if(jt==="ctrl+right")await Rt.u.Commit.reveal(Mt[0].item,{select:!0,focus:!1,expand:!0});else{const Gi=Mt[0].item;await b.W.instance.searchAndCompareView.search(Gi.repoPath,{pattern:z.n.fromCommit(Gi)},{label:{label:`for ${p.GitReference.toString(Gi,{icon:!1})}`},reveal:{select:!0,focus:!1,expand:!0}})}},onValidateValue:Dt(se.repo,{buttons:[B.rO.RevealInSideBar,B.rO.SearchInSideBar]})}),Nt=yield Kt;return ai.canPickStepContinue(Kt,se,Nt)?O.$w.is(Nt[0])?(ai.endSteps(se),await Nt[0].execute(),ki.Break):Nt[0].item:ki.Break}n(Ii,"pickCommitStep");function*lr(se,ye,{log:je,onDidLoadMore:Xe,picked:Qe,placeholder:ct,titleContext:pt}){function Ot(At){return At==null?[r.x.create(r.X.Back,!0),r.x.create(r.X.Cancel)]:[...(0,Ri.UI)(At.commits.values(),Kt=>F.zK.create(Kt,Qe!=null&&(typeof Qe=="string"?Kt.ref===Qe:Qe.includes(Kt.ref)),{buttons:[B.rO.RevealInSideBar,B.rO.SearchInSideBar],compact:!0,icon:!0}))]}n(Ot,"getItems");const ni=ai.createPickStep({title:Te(`${ye.title}${pt??""}`,se,ye),multiselect:je!=null,placeholder:typeof ct=="string"?ct:ct(ye,je),matchOnDescription:!0,matchOnDetail:!0,items:Ot(je),onDidLoadMore:async At=>{var Kt;return At.keepScrollPosition=!0,je=await((Kt=je?.more)==null?void 0:Kt.call(je,_.DN.get("advanced.maxListItems"))),Xe?.(je),typeof ct!="string"&&(At.placeholder=ct(ye,je)),Ot(je)},additionalButtons:[...je?.hasMore?[B.rO.LoadMore]:[]],onDidClickItemButton:(At,Kt,{item:Nt})=>{switch(Kt){case B.rO.RevealInSideBar:Rt.u.Commit.reveal(Nt,{select:!0,focus:!1,expand:!0});break;case B.rO.SearchInSideBar:b.W.instance.searchAndCompareView.search(se.repo.path,{pattern:z.n.fromCommit(Nt.ref)},{label:{label:`for ${p.GitReference.toString(Nt,{icon:!1})}`},reveal:{select:!0,focus:!1,expand:!0}});break}},keys:["right","alt+right","ctrl+right"],onDidPressKey:async(At,Kt)=>{if(At.activeItems.length!==0)if(Kt==="ctrl+right")await Rt.u.Commit.reveal(At.activeItems[0].item,{select:!0,focus:!1,expand:!0});else{const Nt=At.activeItems[0].item;await b.W.instance.searchAndCompareView.search(Nt.repoPath,{pattern:z.n.fromCommit(Nt)},{label:{label:`for ${p.GitReference.toString(Nt,{icon:!1})}`},reveal:{select:!0,focus:!1,expand:!0}})}}}),oi=yield ni;return ai.canPickStepContinue(ni,se,oi)?oi.map(At=>At.item):ki.Break}n(lr,"pickCommitsStep");async function*cr(se,ye,je="Choose contributors"){var Xe;const Qe=(Xe=await b.W.instance.git.getOrOpenScmRepository(se.repo.path))==null?void 0:Xe.inputBox.value,ct=ai.createPickStep({title:Te(ye.title,se,ye),allowEmpty:!0,multiselect:!0,placeholder:je,matchOnDescription:!0,items:(await b.W.instance.git.getContributors(se.repo.path)).map(Ot=>F.YG.create(Ot,Qe?.includes(Ot.getCoauthor()),{buttons:[B.rO.RevealInSideBar]})),onDidClickItemButton:(Ot,ni,{item:oi})=>{ni===B.rO.RevealInSideBar&&Rt.u.Contributor.reveal(oi,{select:!0,focus:!1,expand:!0})},keys:["right","alt+right","ctrl+right"],onDidPressKey:Ot=>{Ot.activeItems.length!==0&&Rt.u.Contributor.reveal(Ot.activeItems[0].item,{select:!0,focus:!1,expand:!0})}}),pt=yield ct;return ai.canPickStepContinue(ct,se,pt)?pt.map(Ot=>Ot.item):ki.Break}n(cr,"pickContributorsStep");async function*Nr(se,ye,je="Choose a repository"){if(typeof se.repo=="string"&&(se.repo=b.W.instance.git.getRepository(se.repo),se.repo!=null))return se.repo;const Xe=se.repo??await b.W.instance.git.getOrOpenRepositoryForEditor(),Qe=ai.createPickStep({title:ye.title,placeholder:je,items:ye.repos.length===0?[r.x.create(r.X.Cancel)]:await Promise.all(ye.repos.map(pt=>F.JF.create(pt,pt.id===Xe?.id,{branch:!0,buttons:[B.rO.RevealInSideBar],fetched:!0,status:!0}))),onDidClickItemButton:(pt,Ot,{item:ni})=>{Ot===B.rO.RevealInSideBar&&Rt.u.Repository.reveal(ni.path,ye.associatedView,{select:!0,focus:!1,expand:!0})},keys:["right","alt+right","ctrl+right"],onDidPressKey:pt=>{pt.activeItems.length!==0&&Rt.u.Repository.reveal(pt.activeItems[0].item.path,ye.associatedView,{select:!0,focus:!1,expand:!0})}}),ct=yield Qe;return ai.canPickStepContinue(Qe,se,ct)?ct[0].item:ki.Break}n(Nr,"pickRepositoryStep");async function*pn(se,ye,je){je=be({placeholder:"Choose repositories",skipIfPossible:!1},je);let Xe;if(se.repos!=null)if((0,I.GI)(se.repos)){if(Xe=(0,I.DZ)(se.repos,pt=>ye.repos.find(Ot=>Ot.path===pt)),je.skipIfPossible&&Xe.length!==0&&se.repos.length===Xe.length)return Xe}else Xe=se.repos;else{const pt=await b.W.instance.git.getOrOpenRepositoryForEditor();Xe=pt!=null?[pt]:[]}const Qe=ai.createPickStep({multiselect:!0,title:ye.title,placeholder:je.placeholder,items:ye.repos.length===0?[r.x.create(r.X.Cancel)]:await Promise.all(ye.repos.map(pt=>F.JF.create(pt,Xe.some(Ot=>Ot.id===pt.id),{branch:!0,buttons:[B.rO.RevealInSideBar],fetched:!0,status:!0}))),onDidClickItemButton:(pt,Ot,{item:ni})=>{Ot===B.rO.RevealInSideBar&&Rt.u.Repository.reveal(ni.path,ye.associatedView,{select:!0,focus:!1,expand:!0})},keys:["right","alt+right","ctrl+right"],onDidPressKey:pt=>{pt.activeItems.length!==0&&Rt.u.Repository.reveal(pt.activeItems[0].item.path,ye.associatedView,{select:!0,focus:!1,expand:!0})}}),ct=yield Qe;return ai.canPickStepContinue(Qe,se,ct)?ct.map(pt=>pt.item):ki.Break}n(pn,"pickRepositoriesStep");function*Gr(se,ye,{ignoreFocusOut:je,stash:Xe,picked:Qe,placeholder:ct,titleContext:pt}){const Ot=ai.createPickStep({title:Te(`${ye.title}${pt??""}`,se,ye),placeholder:typeof ct=="string"?ct:ct(ye,Xe),ignoreFocusOut:je,matchOnDescription:!0,matchOnDetail:!0,items:Xe==null?[r.x.create(r.X.Back,!0),r.x.create(r.X.Cancel)]:[...(0,Ri.UI)(Xe.commits.values(),oi=>F.zK.create(oi,Qe!=null&&(typeof Qe=="string"?oi.ref===Qe:Qe.includes(oi.ref)),{buttons:[B.rO.RevealInSideBar],compact:!0,icon:!0}))],onDidClickItemButton:(oi,At,{item:Kt})=>{At===B.rO.RevealInSideBar&&Rt.u.Stash.reveal(Kt,{select:!0,focus:!1,expand:!0})},keys:["right","alt+right","ctrl+right"],onDidPressKey:async oi=>{oi.activeItems.length!==0&&await Rt.u.Stash.reveal(oi.activeItems[0].item,{select:!0,focus:!1,expand:!0})}}),ni=yield Ot;return ai.canPickStepContinue(Ot,se,ni)?ni[0].item:ki.Break}n(Gr,"pickStashStep");async function*ue(se,ye,{filter:je,picked:Xe,placeholder:Qe,titleContext:ct}){const pt=await qe(se.repo,{buttons:[B.rO.RevealInSideBar],filter:je,picked:Xe}),Ot=ai.createPickStep({multiselect:pt.length!==0,title:Te(`${ye.title}${ct??""}`,se,ye),placeholder:pt.length===0?`No tags found in ${se.repo.formattedName}`:Qe,matchOnDetail:!0,items:pt.length===0?[r.x.create(r.X.Back,!0),r.x.create(r.X.Cancel)]:pt,onDidClickItemButton:(oi,At,{item:Kt})=>{At===B.rO.RevealInSideBar&&Rt.u.Tag.reveal(Kt,{select:!0,focus:!1,expand:!0})},keys:["right","alt+right","ctrl+right"],onDidPressKey:async oi=>{oi.activeItems.length!==0&&await Rt.u.Tag.reveal(oi.activeItems[0].item,{select:!0,focus:!1,expand:!0})}}),ni=yield Ot;return ai.canPickStepContinue(Ot,se,ni)?ni.map(oi=>oi.item):ki.Break}n(ue,"pickTagsStep");async function*xe(se,ye,{filter:je,includeStatus:Xe,picked:Qe,placeholder:ct,titleContext:pt}){const Ot=await at(ye.worktrees??se.repo,{buttons:[B.rO.OpenInNewWindow,B.rO.RevealInSideBar],filter:je,includeStatus:Xe,picked:Qe}),ni=ai.createPickStep({title:Te(`${ye.title}${pt??""}`,se,ye),placeholder:Ot.length===0?`No worktrees found in ${se.repo.formattedName}`:ct,matchOnDetail:!0,items:Ot.length===0?[r.x.create(r.X.Back,!0),r.x.create(r.X.Cancel)]:Ot,onDidClickItemButton:(At,Kt,{item:Nt})=>{switch(Kt){case B.rO.OpenInNewWindow:Rt.u.Worktree.open(Nt,{location:Ht.Tc.NewWindow});break;case B.rO.RevealInSideBar:Rt.u.Worktree.reveal(Nt,{select:!0,focus:!1,expand:!0});break}},keys:["right","alt+right","ctrl+right"],onDidPressKey:async At=>{At.activeItems.length!==0&&await Rt.u.Worktree.reveal(At.activeItems[0].item,{select:!0,focus:!1,expand:!0})}}),oi=yield ni;return ai.canPickStepContinue(ni,se,oi)?oi[0].item:ki.Break}n(xe,"pickWorktreeStep");async function*Ce(se,ye,{filter:je,includeStatus:Xe,picked:Qe,placeholder:ct,titleContext:pt}){const Ot=await at(ye.worktrees??se.repo,{buttons:[B.rO.OpenInNewWindow,B.rO.RevealInSideBar],filter:je,includeStatus:Xe,picked:Qe}),ni=ai.createPickStep({multiselect:Ot.length!==0,title:Te(`${ye.title}${pt??""}`,se,ye),placeholder:Ot.length===0?`No worktrees found in ${se.repo.formattedName}`:ct,matchOnDetail:!0,items:Ot.length===0?[r.x.create(r.X.Back,!0),r.x.create(r.X.Cancel)]:Ot,onDidClickItemButton:(At,Kt,{item:Nt})=>{switch(Kt){case B.rO.OpenInNewWindow:Rt.u.Worktree.open(Nt,{location:Ht.Tc.NewWindow});break;case B.rO.RevealInSideBar:Rt.u.Worktree.reveal(Nt,{select:!0,focus:!1,expand:!0});break}},keys:["right","alt+right","ctrl+right"],onDidPressKey:async At=>{At.activeItems.length!==0&&await Rt.u.Worktree.reveal(At.activeItems[0].item,{select:!0,focus:!1,expand:!0})}}),oi=yield ni;return ai.canPickStepContinue(ni,se,oi)?oi.map(At=>At.item):ki.Break}n(Ce,"pickWorktreesStep");async function*Oe(se,ye){const je=ai.createPickStep({title:Te(p.GitReference.toString(se.reference,{capitalize:!0,icon:!1}),se,ye),placeholder:p.GitReference.toString(se.reference,{capitalize:!0,icon:!1}),ignoreFocusOut:!0,items:await nt(se),onDidClickItemButton:(Qe,ct,pt)=>{if(ct===B.rO.SearchInSideBar){b.W.instance.searchAndCompareView.search(se.repo.path,{pattern:z.n.fromCommit(se.reference.ref)},{label:{label:`for ${p.GitReference.toString(se.reference,{icon:!1})}`},reveal:{select:!0,focus:!1,expand:!0}});return}ct===B.rO.RevealInSideBar&&(p.GitReference.isStash(se.reference)?Rt.u.Stash.reveal(se.reference,{select:!0,focus:!1,expand:!0}):Rt.u.Commit.reveal(se.reference,{select:!0,focus:!1,expand:!0}))},keys:["right","alt+right","ctrl+right"],onDidPressKey:async(Qe,ct)=>{Qe.activeItems.length!==0&&await Qe.activeItems[0].onDidPressKey(ct)}}),Xe=yield je;return ai.canPickStepContinue(je,se,Xe)?Xe[0]:ki.Break}n(Oe,"showCommitOrStashStep");async function nt(se){const ye=[];let je;if(p.GitCommit.isStash(se.reference))ye.push(O.HH.create("Actions"),new F.Wv("Apply Stash...",{command:"stash",state:{subcommand:"apply",repo:se.repo,reference:se.reference}}),new F.Wv("Delete Stash...",{command:"stash",state:{subcommand:"drop",repo:se.repo,reference:se.reference}}),O.HH.create(),new U.NC(se.reference));else{const Xe=await b.W.instance.git.getRemotesWithProviders(se.repo.path,{sort:!0});Xe?.length&&ye.push(O.HH.create(p.GitRemote.getHighlanderProviderName(Xe)??"Remote"),new y.az(Xe,{type:M.JD.Commit,sha:se.reference.sha}),new y.eO(Xe,{type:M.JD.Commit,sha:se.reference.sha})),ye.push(O.HH.create("Actions"));const Qe=await b.W.instance.git.getBranch(se.repo.path),[ct,pt]=await Promise.all([Qe!=null?b.W.instance.git.getCommitBranches(se.repo.path,se.reference.ref,{branch:Qe.name,commitDate:p.GitCommit.is(se.reference)?se.reference.committer.date:void 0}):void 0,!Qe?.remote&&Qe?.upstream!=null?se.reference.isPushed():void 0]);Boolean(ct?.length)?(je=!pt,je&&ye.push(new F.Wv("Push to Commit...",{command:"push",state:{repos:se.repo,reference:se.reference}})),ye.push(new F.Wv("Revert Commit...",{command:"revert",state:{repo:se.repo,references:[se.reference]}}),new F.Wv(`Reset ${Qe?.name??"Current Branch"} to Commit...`,{command:"reset",state:{repo:se.repo,reference:se.reference}}),new F.Wv(`Reset ${Qe?.name??"Current Branch"} to Previous Commit...`,{command:"reset",state:{repo:se.repo,reference:p.GitReference.create(`${se.reference.ref}^`,se.reference.repoPath,{refType:"revision",name:`${se.reference.name}^`,message:se.reference.message})}}))):ye.push(new F.Wv("Cherry Pick Commit...",{command:"cherry-pick",state:{repo:se.repo,references:[se.reference]}})),ye.push(new F.Wv(`Rebase ${Qe?.name??"Current Branch"} onto Commit...`,{command:"rebase",state:{repo:se.repo,reference:se.reference}}),new F.Wv("Switch to Commit...",{command:"switch",state:{repos:[se.repo],reference:se.reference}}),O.HH.create(),new F.Wv("Create Branch at Commit...",{command:"branch",state:{subcommand:"create",repo:se.repo,reference:se.reference}}),new F.Wv("Create Tag at Commit...",{command:"tag",state:{subcommand:"create",repo:se.repo,reference:se.reference}}),O.HH.create("Copy"),new U.OT(se.reference),new U.NC(se.reference))}return ye.push(O.HH.create("Open"),new U.CV(se.reference),new U.Y4(se.reference),new U.o$(se.reference),O.HH.create(),new U.lN(se.reference),new U.A1(se.reference)),ye.push(O.HH.create("Compare"),new U.Jw(se.reference),new U.m5(se.reference)),ye.push(O.HH.create(),new U.eG(se.reference),new U.nl(se.reference)),ye.push(O.HH.create("Browse"),new U.Lf(se.reference,{openInNewWindow:!1}),new U.Lf(se.reference,{before:!0,openInNewWindow:!1}),new U.Lf(se.reference,{openInNewWindow:!0}),new U.Lf(se.reference,{before:!0,openInNewWindow:!0})),ye.splice(0,0,new U.PF(se.reference,{unpublished:je,hint:"Click to see all changed files"})),ye}n(nt,"getShowCommitOrStashStepItems");function*Ct(se,ye,je){var Xe;se.reference.files==null;const Qe=ai.createPickStep({title:Te(p.GitReference.toString(se.reference,{capitalize:!0,icon:!1}),se,ye),placeholder:p.GitReference.toString(se.reference,{capitalize:!0,icon:!1}),ignoreFocusOut:!0,items:[new U.PF(se.reference,{picked:se.fileName==null,hint:`Click to see ${p.GitCommit.isStash(se.reference)?"stash":"commit"} actions`}),O.HH.create("Files"),...((Xe=se.reference.files)==null?void 0:Xe.map(pt=>new U.zr(se.reference,pt,je?.picked===pt.path)))??[]],matchOnDescription:!0,onDidClickItemButton:(pt,Ot,ni)=>{if(Ot===B.rO.SearchInSideBar){b.W.instance.searchAndCompareView.search(se.repo.path,{pattern:z.n.fromCommit(se.reference.ref)},{label:{label:`for ${p.GitReference.toString(se.reference,{icon:!1})}`},reveal:{select:!0,focus:!1,expand:!0}});return}Ot===B.rO.RevealInSideBar&&(p.GitReference.isStash(se.reference)?Rt.u.Stash.reveal(se.reference,{select:!0,focus:!1,expand:!0}):Rt.u.Commit.reveal(se.reference,{select:!0,focus:!1,expand:!0}))},keys:["right","alt+right","ctrl+right"],onDidPressKey:async(pt,Ot)=>{pt.activeItems.length!==0&&await pt.activeItems[0].onDidPressKey(Ot)}}),ct=yield Qe;return ai.canPickStepContinue(Qe,se,ct)?ct[0]:ki.Break}n(Ct,"showCommitOrStashFilesStep");async function*Vt(se,ye){const je=ai.createPickStep({title:Te(p.GitReference.toString(se.reference,{capitalize:!0,icon:!1}),se,ye,`${(0,Oi.vk)(R.NE.Dot,2,2)}${(0,Zt.d)(se.fileName,{fileOnly:!0})}`),placeholder:`${(0,Zt.d)(se.fileName,{relativeTo:se.repo.path})} in ${p.GitReference.toString(se.reference,{icon:!1})}`,ignoreFocusOut:!0,items:await ti(se),matchOnDescription:!0,onDidClickItemButton:(Qe,ct,pt)=>{if(ct===B.rO.SearchInSideBar){b.W.instance.searchAndCompareView.search(se.repo.path,{pattern:z.n.fromCommit(se.reference.ref)},{label:{label:`for ${p.GitReference.toString(se.reference,{icon:!1})}`},reveal:{select:!0,focus:!1,expand:!0}});return}ct===B.rO.RevealInSideBar&&(p.GitReference.isStash(se.reference)?Rt.u.Stash.reveal(se.reference,{select:!0,focus:!1,expand:!0}):Rt.u.Commit.reveal(se.reference,{select:!0,focus:!1,expand:!0}))},keys:["right","alt+right","ctrl+right"],onDidPressKey:async(Qe,ct)=>{Qe.activeItems.length!==0&&await Qe.activeItems[0].onDidPressKey(ct)}}),Xe=yield je;return ai.canPickStepContinue(je,se,Xe)?Xe[0]:ki.Break}n(Vt,"showCommitOrStashFileStep");async function ti(se){const ye=await se.reference.findFile(se.fileName);if(ye==null)return[];const je=[];if(p.GitCommit.isStash(se.reference))je.push(O.HH.create(),new U.NC(se.reference),O.HH.create("Actions"),new U.do(se.reference,ye),new U.QP(se.reference,ye),O.HH.create(),new U.NC(se.reference));else{const Xe=await b.W.instance.git.getRemotesWithProviders(se.repo.path,{sort:!0});Xe?.length&&je.push(O.HH.create(p.GitRemote.getHighlanderProviderName(Xe)??"Remote"),new y.az(Xe,{type:M.JD.Revision,fileName:se.fileName,commit:se.reference}),new y.eO(Xe,{type:M.JD.Revision,fileName:se.fileName,commit:se.reference}),O.HH.create(),new y.az(Xe,{type:M.JD.Commit,sha:se.reference.ref}),new y.eO(Xe,{type:M.JD.Commit,sha:se.reference.sha})),je.push(O.HH.create("Actions"),new U.do(se.reference,ye),new U.QP(se.reference,ye),O.HH.create("Copy"),new U.OT(se.reference),new U.NC(se.reference))}return je.push(O.HH.create("Open"),new U.lp(se.reference,se.fileName),new U.aU(se.reference,se.fileName),new U.xL(se.reference,se.fileName),O.HH.create()),ye.status!=="D"&&je.push(new U.ZO(se.reference,ye)),je.push(new U.Wt(se.reference,ye)),je.push(O.HH.create("Compare"),new U.Jw(se.reference),new U.m5(se.reference)),je.push(O.HH.create("Browse"),new U.Lf(se.reference,{openInNewWindow:!1}),new U.Lf(se.reference,{before:!0,openInNewWindow:!1}),new U.Lf(se.reference,{openInNewWindow:!0}),new U.Lf(se.reference,{before:!0,openInNewWindow:!0})),je.splice(0,0,new U.PF(se.reference,{file:ye,hint:"Click to see all changed files"})),je}n(ti,"getShowCommitOrStashFileStepItems");function*vi(se,ye){const je=ye.status.getUpstreamStatus({expand:!0,separator:", "}),Xe=ye.status.getFormattedDiffStatus({expand:!0,separator:", "}),Qe=ai.createPickStep({title:Te(ye.title,se,ye),placeholder:`${je?`${je}, ${Xe}`:Xe}`,ignoreFocusOut:!0,items:ke(se,ye),keys:["right","alt+right","ctrl+right"],onDidPressKey:async(pt,Ot)=>{pt.activeItems.length!==0&&await pt.activeItems[0].onDidPressKey(Ot)}}),ct=yield Qe;return ai.canPickStepContinue(Qe,se,ct)?ct[0]:ki.Break}n(vi,"showRepositoryStatusStep");function ke(se,ye){const je=[],Xe=ye.status.computeWorkingTreeStatus();let Qe;return Xe.staged===0&&Xe.unstaged===0?Qe="No working tree changes":Qe=`$(files) ${Xe.staged?`${(0,Oi._6)("staged file",Xe.staged)} (${Xe.stagedStatus})`:""}${Xe.unstaged?`${Xe.staged?", ":""}${(0,Oi._6)("unstaged file",Xe.unstaged)} (${Xe.unstagedStatus})`:""}`,ye.status.upstream?(ye.status.state.ahead===0&&ye.status.state.behind===0?je.push(r.x.create(r.X.Noop,!0,{label:`$(git-branch) ${ye.status.branch} is up to date with $(git-branch) ${ye.status.upstream}`,detail:Qe})):ye.status.state.ahead!==0&&ye.status.state.behind!==0?je.push(r.x.create(r.X.Noop,!0,{label:`$(git-branch) ${ye.status.branch} has diverged from $(git-branch) ${ye.status.upstream}`,detail:Qe})):ye.status.state.ahead!==0?je.push(r.x.create(r.X.Noop,!0,{label:`$(git-branch) ${ye.status.branch} is ahead of $(git-branch) ${ye.status.upstream}`,detail:Qe})):ye.status.state.behind!==0&&je.push(r.x.create(r.X.Noop,!0,{label:`$(git-branch) ${ye.status.branch} is behind $(git-branch) ${ye.status.upstream}`,detail:Qe})),ye.status.state.behind!==0&&je.push(new F.Wv(`$(cloud-download) ${(0,Oi._6)("commit",ye.status.state.behind)} behind`,{command:"log",state:{repo:se.repo,reference:p.GitReference.create(p.GitRevision.createRange(ye.status.ref,ye.status.upstream),se.repo.path)}})),ye.status.state.ahead!==0&&je.push(new F.Wv(`$(cloud-upload) ${(0,Oi._6)("commit",ye.status.state.ahead)} ahead`,{command:"log",state:{repo:se.repo,reference:p.GitReference.create(p.GitRevision.createRange(ye.status.upstream,ye.status.ref),se.repo.path)}}))):je.push(r.x.create(r.X.Noop,!0,{label:`$(git-branch) ${ye.status.branch} has no upstream`,detail:Qe})),ye.status.files.length&&je.push(new U.K6(Xe.stagedAddsAndChanges.concat(Xe.unstagedAddsAndChanges))),Xe.staged>0&&je.push(new U.K6(Xe.stagedAddsAndChanges,{label:"$(files) Open Staged Files"})),Xe.unstaged>0&&je.push(new U.K6(Xe.unstagedAddsAndChanges,{label:"$(files) Open Unstaged Files"})),ye.status.files.length&&je.push(new O.$w("$(x) Close Unchanged Files",R.Gh.CloseUnchangedFiles)),je}n(ke,"getShowRepositoryStatusStepItems");async function*ji(se,ye,je){var Xe;const Qe=await b.W.instance.git.access(je,se.repo.path);if(Qe.allowed)return void 0;const ct=[];let pt;if(((Xe=Qe.subscription.current.account)==null?void 0:Xe.verified)===!1)ct.push(r.x.create(r.X.RequiresVerification,!0)),pt="You must verify your account email address before you can continue";else{if(Qe.subscription.required==null)return void 0;(0,V.aG)(Qe.subscription.required)&&Qe.subscription.current.account!=null?(ct.push(r.x.create(r.X.RequiresPaidSubscription,!0)),pt="GitLens+ features require an upgraded account"):(Qe.subscription.current.account==null&&!(0,V.gA)(Qe.subscription.current)?ct.push(r.x.create(r.X.StartPreviewTrial,!0),r.x.create(r.X.RequiresFreeSubscription)):ct.push(r.x.create(r.X.RequiresFreeSubscription)),pt="GitLens+ features require a free account")}const Ot=ai.createPickStep({title:Te(ye.title,se,ye),placeholder:pt,items:[...ct,r.x.create(r.X.Cancel)]}),ni=yield Ot;return ai.canPickStepContinue(Ot,se,ni)?void 0:ki.Break}n(ji,"ensureAccessStep");var nr=Object.defineProperty,qi=Object.defineProperties,Xi=Object.getOwnPropertyDescriptors,Li=Object.getOwnPropertySymbols,Rr=Object.prototype.hasOwnProperty,ir=Object.prototype.propertyIsEnumerable,er=n((se,ye,je)=>ye in se?nr(se,ye,{enumerable:!0,configurable:!0,writable:!0,value:je}):se[ye]=je,"quickCommand_defNormalProp"),yr=n((se,ye)=>{for(var je in ye||(ye={}))Rr.call(ye,je)&&er(se,je,ye[je]);if(Li)for(var je of Li(ye))ir.call(ye,je)&&er(se,je,ye[je]);return se},"quickCommand_spreadValues"),Cr=n((se,ye)=>qi(se,Xi(ye)),"__spreadProps"),ur=n((se,ye,je)=>(er(se,typeof ye!="symbol"?ye+"":ye,je),je),"__publicField");function Hr(se){return typeof se=="object"&&se.show!=null}n(Hr,"isCustomStep");function Or(se){return typeof se=="object"&&se.items==null&&se.show==null}n(Or,"isQuickInputStep");function xr(se){return typeof se=="object"&&se.items!=null}n(xr,"isQuickPickStep");var ki;(se=>{se.Break=Symbol("BreakStep")})(ki||(ki={}));class ai{constructor(ye,je,Xe,Qe,ct={}){this.container=ye,this.key=je,this.label=Xe,this.title=Qe,ur(this,"description"),ur(this,"detail"),ur(this,"initialState"),ur(this,"_currentStep"),ur(this,"_stepsIterator"),ur(this,"_picked",!1),ur(this,"_pickedVia","menu"),this.description=ct.description,this.detail=ct.detail}get canConfirm(){return!0}get canSkipConfirm(){return!0}get picked(){return this._picked}set picked(ye){this._picked=ye,ye||(this._pickedVia="menu")}get pickedVia(){return this._pickedVia}set pickedVia(ye){this._pickedVia=ye}get skipConfirmKey(){return`${this.key}:${this.pickedVia}`}get value(){return this._currentStep}confirm(ye){return!this.canConfirm||!this.canSkipConfirm?!0:ye??!this.container.config.gitCommands.skipConfirmations.includes(this.skipConfirmKey)}isMatch(ye){return this.key===ye}isFuzzyMatch(ye){return this.label===ye}executeSteps(){return this.steps(this.getStepState(!0))}async previous(){return(await this.next(r.X.Back)).value}async next(ye){this._stepsIterator==null&&(this._stepsIterator=this.steps(this.getStepState(!1)));const je=await this._stepsIterator.next(ye);return je.done&&(this.initialState=void 0,this._stepsIterator=void 0),je.value===ki.Break?(this._currentStep=void 0,Cr(yr({},je),{value:void 0})):(this._currentStep=je.value,je)}async retry(){return await this.next(r.X.Noop),this.value}canStepsContinue(ye){return ye.counter>=(ye.startingStep??0)}createConfirmStep(ye,je,Xe,Qe={}){return ai.createConfirmStep(ye,je,{title:this.title},Xe,Qe)}getStepState(ye){var je;return Cr(yr({counter:0},this.initialState),{startingStep:ye?((je=this.initialState)==null?void 0:je.counter)??0:0})}}n(ai,"QuickCommand"),(se=>{function ye(At){return At instanceof se}n(ye,"is"),se.is=ye;async function je(At,Kt,Nt){var Jt;if(!Qe(At,Kt,Nt))return!1;const[jt]=await((Jt=At.validate)==null?void 0:Jt.call(At,Nt))??[!0];return jt?(Kt.counter++,!0):!1}n(je,"canInputStepContinue"),se.canInputStepContinue=je;function Xe(At,Kt,Nt){var Jt;return Qe(At,Kt,Nt)&&(((Jt=At.validate)==null?void 0:Jt.call(At,Nt))??!0)?(Kt.counter++,!0):!1}n(Xe,"canPickStepContinue"),se.canPickStepContinue=Xe;function Qe(At,Kt,Nt){if(Nt==null)return!1;if(r.X.is(Nt)){switch(Nt){case r.X.Back:Kt.counter--,Kt.counter<=(Kt.startingStep??0)&&(Kt.counter=0);break;case r.X.Cancel:oi(Kt);break}return!1}return!0}n(Qe,"canStepContinue"),se.canStepContinue=Qe;function ct(At,Kt,Nt,Jt,jt={}){return yr({placeholder:`Confirm ${Nt.title}`,title:At,ignoreFocusOut:!0,items:[...Kt,Jt??r.x.create(r.X.Cancel)],selectedItems:[Kt.find(Mt=>Mt.picked)??Kt[0]]},jt)}n(ct,"createConfirmStep"),se.createConfirmStep=ct;function pt(At){return At.ignoreFocusOut=!0,At}n(pt,"createInputStep"),se.createInputStep=pt;function Ot(At){return At}n(Ot,"createPickStep"),se.createPickStep=Ot;function ni(At){return At}n(ni,"createCustomStep"),se.createCustomStep=ni;function oi(At){At.counter=-1}n(oi,"endSteps"),se.endSteps=oi})(ai||(ai={}))},5078:(Se,ae,v)=>{"use strict";v.d(ae,{n:()=>b,o:()=>R});class r{}n(r,"Comparer");class B extends r{equals(M,z,U={exact:!1}){return M===z?!0:M==null||z==null?!1:U.exact?M.toString()===z.toString():M.scheme===z.scheme&&M.fsPath===z.fsPath}}n(B,"UriComparer");class _ extends r{equals(M,z,U={usePosition:!1}){return M===z?!0:M==null||z==null||U.usePosition&&M.viewColumn!==z.viewColumn?!1:M.document===z.document}}n(_,"TextEditorComparer");const R=new _,b=new B},2078:(Se,ae,v)=>{"use strict";v.d(ae,{CZ:()=>h,DH:()=>T,Dn:()=>O,M7:()=>D,N4:()=>b,RV:()=>L,S4:()=>j,TA:()=>N,TF:()=>r,Uy:()=>p,VP:()=>F,Vc:()=>E,Vn:()=>U,Vz:()=>_,ef:()=>x,hp:()=>R,iP:()=>M,il:()=>V,o9:()=>I,y0:()=>B,zL:()=>y,zW:()=>z});var r=($=>($.File="file",$.Window="window",$))(r||{}),B=($=>($.Gutter="gutter",$.Line="line",$.Overview="overview",$))(B||{}),_=($=>($.DateDesc="date:desc",$.DateAsc="date:asc",$.NameAsc="name:asc",$.NameDesc="name:desc",$))(_||{}),R=($=>($.Gutter="gutter",$.Overview="overview",$))(R||{}),b=($=>($.CopyRemoteCommitUrl="gitlens.copyRemoteCommitUrl",$.CopyRemoteFileUrl="gitlens.copyRemoteFileUrl",$.DiffWithPrevious="gitlens.diffWithPrevious",$.OpenCommitOnRemote="gitlens.openCommitOnRemote",$.OpenFileOnRemote="gitlens.openFileOnRemote",$.RevealCommitInView="gitlens.revealCommitInView",$.ShowCommitsInView="gitlens.showCommitsInView",$.ShowQuickCommitDetails="gitlens.showQuickCommitDetails",$.ShowQuickCommitFileDetails="gitlens.showQuickCommitFileDetails",$.ShowQuickCurrentBranchHistory="gitlens.showQuickRepoHistory",$.ShowQuickFileHistory="gitlens.showQuickFileHistory",$.ToggleFileBlame="gitlens.toggleFileBlame",$.ToggleFileChanges="gitlens.toggleFileChanges",$.ToggleFileChangesOnly="gitlens.toggleFileChangesOnly",$.ToggleFileHeatmap="gitlens.toggleFileHeatmap",$))(b||{}),p=($=>($.Document="document",$.Containers="containers",$.Blocks="blocks",$))(p||{}),M=($=>($.CountDesc="count:desc",$.CountAsc="count:asc",$.DateDesc="date:desc",$.DateAsc="date:asc",$.NameAsc="name:asc",$.NameDesc="name:desc",$))(M||{}),z=($=>($.AzureDevOps="AzureDevOps",$.Bitbucket="Bitbucket",$.BitbucketServer="BitbucketServer",$.Custom="Custom",$.Gerrit="Gerrit",$.Gitea="Gitea",$.GitHub="GitHub",$.GitLab="GitLab",$))(z||{}),U=($=>($.Authored="authored",$.Committed="committed",$))(U||{}),O=($=>($.Absolute="absolute",$.Relative="relative",$))(O||{}),F=($=>($.Blame="blame",$.Changes="changes",$.Heatmap="heatmap",$))(F||{}),y=($=>($.Name="name",$.Usage="usage",$))(y||{}),V=($=>($.Faces="wavatar",$.Geometric="identicon",$.Monster="monsterid",$.MysteryPerson="mp",$.Retro="retro",$.Robot="robohash",$))(V||{}),I=($=>($.Gutter="gutter",$.Overview="overview",$))(I||{}),Y=($=>($.Alternate="alternate",$.Chorded="chorded",$.None="none",$))(Y||{}),D=($=>($.Silent="silent",$.Errors="errors",$.Verbose="verbose",$.Debug="debug",$))(D||{}),x=($=>($.CopyRemoteCommitUrl="gitlens.copyRemoteCommitUrl",$.CopyRemoteFileUrl="gitlens.copyRemoteFileUrl",$.DiffWithPrevious="gitlens.diffWithPrevious",$.DiffWithWorking="gitlens.diffWithWorking",$.OpenCommitOnRemote="gitlens.openCommitOnRemote",$.OpenFileOnRemote="gitlens.openFileOnRemote",$.RevealCommitInView="gitlens.revealCommitInView",$.ShowCommitsInView="gitlens.showCommitsInView",$.ShowQuickCommitDetails="gitlens.showQuickCommitDetails",$.ShowQuickCommitFileDetails="gitlens.showQuickCommitFileDetails",$.ShowQuickCurrentBranchHistory="gitlens.showQuickRepoHistory",$.ShowQuickFileHistory="gitlens.showQuickFileHistory",$.ToggleCodeLens="gitlens.toggleCodeLens",$.ToggleFileBlame="gitlens.toggleFileBlame",$.ToggleFileChanges="gitlens.toggleFileChanges",$.ToggleFileChangesOnly="gitlens.toggleFileChangesOnly",$.ToggleFileHeatmap="gitlens.toggleFileHeatmap",$))(x||{}),L=($=>($.DateDesc="date:desc",$.DateAsc="date:asc",$.NameAsc="name:asc",$.NameDesc="name:desc",$))(L||{}),h=($=>($.List="list",$.Tree="tree",$))(h||{}),E=($=>($.Auto="auto",$.List="list",$.Tree="tree",$))(E||{}),T=($=>($.Branch="branch",$.Working="working",$))(T||{});const N=["defaultItemLimit","formats","pageItemLimit","showRelativeDateMarkers"],j=["commits","repositories","fileHistory","lineHistory","branches","remotes","stashes","tags","contributors","searchAndCompare","worktrees"]},9179:(Se,ae,v)=>{"use strict";v.d(ae,{TF:()=>r.TF,y0:()=>r.y0,Vz:()=>r.Vz,hp:()=>r.hp,N4:()=>r.N4,Uy:()=>r.Uy,VK:()=>O,iP:()=>r.iP,zW:()=>r.zW,Vn:()=>r.Vn,Dn:()=>r.Dn,VP:()=>r.VP,M7:()=>r.M7,ef:()=>r.ef,RV:()=>r.RV,CZ:()=>r.CZ,Vc:()=>r.Vc,DH:()=>r.DH,DN:()=>F,TA:()=>r.TA,S4:()=>r.S4});var r=v(2078),B=v(9496),_=v(9433);function R(y,V){return(0,_.Z)(y,V)}n(R,"isEqual");const b=R;var p=Object.defineProperty,M=n((y,V,I)=>V in y?p(y,V,{enumerable:!0,configurable:!0,writable:!0,value:I}):y[V]=I,"__defNormalProp"),z=n((y,V,I)=>(M(y,typeof V!="symbol"?V+"":V,I),I),"__publicField");const U="gitlens";class O{constructor(){z(this,"_onDidChange",new B.EventEmitter),z(this,"_onDidChangeAny",new B.EventEmitter),z(this,"_onWillChange",new B.EventEmitter)}static configure(V){V.subscriptions.push(B.workspace.onDidChangeConfiguration(F.onConfigurationChanged,F))}get onDidChange(){return this._onDidChange.event}get onDidChangeAny(){return this._onDidChangeAny.event}get onWillChange(){return this._onWillChange.event}onConfigurationChanged(V){if(!V.affectsConfiguration(U)){this._onDidChangeAny.fire(V);return}const I={change:V};this._onWillChange.fire(I),I.transform!==void 0&&(V=I.transform(V)),this._onDidChangeAny.fire(V),this._onDidChange.fire(V)}get(V,I,Y){return Y===void 0?B.workspace.getConfiguration(V===void 0?void 0:U,I).get(V===void 0?U:V):B.workspace.getConfiguration(V===void 0?void 0:U,I).get(V===void 0?U:V,Y)}getAny(V,I,Y){return Y===void 0?B.workspace.getConfiguration(void 0,I).get(V):B.workspace.getConfiguration(void 0,I).get(V,Y)}changed(V,I,Y){return V?.affectsConfiguration(`${U}.${I}`,Y)??!0}inspect(V,I){return B.workspace.getConfiguration(V===void 0?void 0:U,I).inspect(V===void 0?U:V)}inspectAny(V,I){return B.workspace.getConfiguration(void 0,I).inspect(V)}async migrate(V,I,Y){const D=F.inspect(V);if(D===void 0)return!1;let x=!1;return D.globalValue!==void 0&&(await this.update(I,Y.migrationFn!=null?Y.migrationFn(D.globalValue):D.globalValue,B.ConfigurationTarget.Global),x=!0),D.workspaceValue!==void 0&&(await this.update(I,Y.migrationFn!=null?Y.migrationFn(D.workspaceValue):D.workspaceValue,B.ConfigurationTarget.Workspace),x=!0),D.workspaceFolderValue!==void 0&&(await this.update(I,Y.migrationFn!=null?Y.migrationFn(D.workspaceFolderValue):D.workspaceFolderValue,B.ConfigurationTarget.WorkspaceFolder),x=!0),!x&&Y.fallbackValue!==void 0&&(await this.update(I,Y.fallbackValue,B.ConfigurationTarget.Global),x=!0),x}async migrateIfMissing(V,I,Y){const D=F.inspect(V);if(D===void 0)return;const x=F.inspect(I);D.globalValue!==void 0&&(x===void 0||x.globalValue===void 0)&&await this.update(I,Y.migrationFn!=null?Y.migrationFn(D.globalValue):D.globalValue,B.ConfigurationTarget.Global),D.workspaceValue!==void 0&&(x===void 0||x.workspaceValue===void 0)&&await this.update(I,Y.migrationFn!=null?Y.migrationFn(D.workspaceValue):D.workspaceValue,B.ConfigurationTarget.Workspace),D.workspaceFolderValue!==void 0&&(x===void 0||x.workspaceFolderValue===void 0)&&await this.update(I,Y.migrationFn!=null?Y.migrationFn(D.workspaceFolderValue):D.workspaceFolderValue,B.ConfigurationTarget.WorkspaceFolder)}name(V){return V}update(V,I,Y){return B.workspace.getConfiguration(U).update(V,I,Y)}updateAny(V,I,Y,D){return B.workspace.getConfiguration(void 0,Y===B.ConfigurationTarget.Global?void 0:D).update(V,I,Y)}updateEffective(V,I){const Y=F.inspect(V);return Y.workspaceFolderValue!==void 0?I===Y.workspaceFolderValue?Promise.resolve(void 0):F.update(V,I,B.ConfigurationTarget.WorkspaceFolder):Y.workspaceValue!==void 0?I===Y.workspaceValue?Promise.resolve(void 0):F.update(V,I,B.ConfigurationTarget.Workspace):Y.globalValue===I||Y.globalValue===void 0&&I===Y.defaultValue?Promise.resolve(void 0):F.update(V,b(I,Y.defaultValue)?void 0:I,B.ConfigurationTarget.Global)}}n(O,"Configuration");const F=new O},1045:(Se,ae,v)=>{"use strict";v.d(ae,{Gh:()=>b,NE:()=>O,S8:()=>z,ZY:()=>B,d$:()=>r,eq:()=>U,mN:()=>_,nA:()=>M,sN:()=>F,wL:()=>R,zf:()=>p});const r=80,B={".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 _=(y=>(y[y.Slash=47]="Slash",y[y.Backslash=92]="Backslash",y[y.A=65]="A",y[y.Z=90]="Z",y[y.a=97]="a",y[y.z=122]="z",y))(_||{}),R=(y=>(y.GutterBackgroundColor="gitlens.gutterBackgroundColor",y.GutterForegroundColor="gitlens.gutterForegroundColor",y.GutterUncommittedForegroundColor="gitlens.gutterUncommittedForegroundColor",y.TrailingLineBackgroundColor="gitlens.trailingLineBackgroundColor",y.TrailingLineForegroundColor="gitlens.trailingLineForegroundColor",y.LineHighlightBackgroundColor="gitlens.lineHighlightBackgroundColor",y.LineHighlightOverviewRulerColor="gitlens.lineHighlightOverviewRulerColor",y.ClosedAutolinkedIssueIconColor="gitlens.closedAutolinkedIssueIconColor",y.ClosedPullRequestIconColor="gitlens.closedPullRequestIconColor",y.OpenAutolinkedIssueIconColor="gitlens.openAutolinkedIssueIconColor",y.OpenPullRequestIconColor="gitlens.openPullRequestIconColor",y.MergedPullRequestIconColor="gitlens.mergedPullRequestIconColor",y.UnpublishedChangesIconColor="gitlens.unpublishedChangesIconColor",y.UnpublishedCommitIconColor="gitlens.unpublishedCommitIconColor",y.UnpulledChangesIconColor="gitlens.unpulledChangesIconColor",y))(R||{}),b=(y=>(y.ActionPrefix="gitlens.action.",y.AddAuthors="gitlens.addAuthors",y.BrowseRepoAtRevision="gitlens.browseRepoAtRevision",y.BrowseRepoAtRevisionInNewWindow="gitlens.browseRepoAtRevisionInNewWindow",y.BrowseRepoBeforeRevision="gitlens.browseRepoBeforeRevision",y.BrowseRepoBeforeRevisionInNewWindow="gitlens.browseRepoBeforeRevisionInNewWindow",y.ClearFileAnnotations="gitlens.clearFileAnnotations",y.CloseUnchangedFiles="gitlens.closeUnchangedFiles",y.CloseWelcomeView="gitlens.closeWelcomeView",y.CompareWith="gitlens.compareWith",y.CompareHeadWith="gitlens.compareHeadWith",y.CompareWorkingWith="gitlens.compareWorkingWith",y.ComputingFileAnnotations="gitlens.computingFileAnnotations",y.ConnectRemoteProvider="gitlens.connectRemoteProvider",y.CopyCurrentBranch="gitlens.copyCurrentBranch",y.CopyMessageToClipboard="gitlens.copyMessageToClipboard",y.CopyRemoteBranchesUrl="gitlens.copyRemoteBranchesUrl",y.CopyRemoteBranchUrl="gitlens.copyRemoteBranchUrl",y.CopyRemoteCommitUrl="gitlens.copyRemoteCommitUrl",y.CopyRemoteComparisonUrl="gitlens.copyRemoteComparisonUrl",y.CopyRemoteFileUrl="gitlens.copyRemoteFileUrlToClipboard",y.CopyRemoteFileUrlWithoutRange="gitlens.copyRemoteFileUrlWithoutRange",y.CopyRemoteFileUrlFrom="gitlens.copyRemoteFileUrlFrom",y.CopyRemoteIssueUrl="gitlens.copyRemoteIssueUrl",y.CopyRemotePullRequestUrl="gitlens.copyRemotePullRequestUrl",y.CopyRemoteRepositoryUrl="gitlens.copyRemoteRepositoryUrl",y.CopyShaToClipboard="gitlens.copyShaToClipboard",y.CreatePullRequestOnRemote="gitlens.createPullRequestOnRemote",y.DiffDirectory="gitlens.diffDirectory",y.DiffDirectoryWithHead="gitlens.diffDirectoryWithHead",y.DiffWith="gitlens.diffWith",y.DiffWithNext="gitlens.diffWithNext",y.DiffWithNextInDiffLeft="gitlens.diffWithNextInDiffLeft",y.DiffWithNextInDiffRight="gitlens.diffWithNextInDiffRight",y.DiffWithPrevious="gitlens.diffWithPrevious",y.DiffWithPreviousInDiffLeft="gitlens.diffWithPreviousInDiffLeft",y.DiffWithPreviousInDiffRight="gitlens.diffWithPreviousInDiffRight",y.DiffLineWithPrevious="gitlens.diffLineWithPrevious",y.DiffWithRevision="gitlens.diffWithRevision",y.DiffWithRevisionFrom="gitlens.diffWithRevisionFrom",y.DiffWithWorking="gitlens.diffWithWorking",y.DiffWithWorkingInDiffLeft="gitlens.diffWithWorkingInDiffLeft",y.DiffWithWorkingInDiffRight="gitlens.diffWithWorkingInDiffRight",y.DiffLineWithWorking="gitlens.diffLineWithWorking",y.DisconnectRemoteProvider="gitlens.disconnectRemoteProvider",y.DisableDebugLogging="gitlens.disableDebugLogging",y.EnableDebugLogging="gitlens.enableDebugLogging",y.DisableRebaseEditor="gitlens.disableRebaseEditor",y.EnableRebaseEditor="gitlens.enableRebaseEditor",y.ExternalDiff="gitlens.externalDiff",y.ExternalDiffAll="gitlens.externalDiffAll",y.FetchRepositories="gitlens.fetchRepositories",y.GetStarted="gitlens.getStarted",y.InviteToLiveShare="gitlens.inviteToLiveShare",y.OpenBlamePriorToChange="gitlens.openBlamePriorToChange",y.OpenBranchesOnRemote="gitlens.openBranchesOnRemote",y.OpenBranchOnRemote="gitlens.openBranchOnRemote",y.OpenChangedFiles="gitlens.openChangedFiles",y.OpenCommitOnRemote="gitlens.openCommitOnRemote",y.OpenComparisonOnRemote="gitlens.openComparisonOnRemote",y.OpenFileHistory="gitlens.openFileHistory",y.OpenFileFromRemote="gitlens.openFileFromRemote",y.OpenFileOnRemote="gitlens.openFileOnRemote",y.OpenFileOnRemoteFrom="gitlens.openFileOnRemoteFrom",y.OpenFileAtRevision="gitlens.openFileRevision",y.OpenFileAtRevisionFrom="gitlens.openFileRevisionFrom",y.OpenFolderHistory="gitlens.openFolderHistory",y.OpenOnRemote="gitlens.openOnRemote",y.OpenIssueOnRemote="gitlens.openIssueOnRemote",y.OpenPullRequestOnRemote="gitlens.openPullRequestOnRemote",y.OpenAssociatedPullRequestOnRemote="gitlens.openAssociatedPullRequestOnRemote",y.OpenRepoOnRemote="gitlens.openRepoOnRemote",y.OpenRevisionFile="gitlens.openRevisionFile",y.OpenRevisionFileInDiffLeft="gitlens.openRevisionFileInDiffLeft",y.OpenRevisionFileInDiffRight="gitlens.openRevisionFileInDiffRight",y.OpenWalkthrough="gitlens.openWalkthrough",y.OpenWorkingFile="gitlens.openWorkingFile",y.OpenWorkingFileInDiffLeft="gitlens.openWorkingFileInDiffLeft",y.OpenWorkingFileInDiffRight="gitlens.openWorkingFileInDiffRight",y.PullRepositories="gitlens.pullRepositories",y.PushRepositories="gitlens.pushRepositories",y.GitCommands="gitlens.gitCommands",y.GitCommandsBranch="gitlens.gitCommands.branch",y.GitCommandsCherryPick="gitlens.gitCommands.cherryPick",y.GitCommandsMerge="gitlens.gitCommands.merge",y.GitCommandsRebase="gitlens.gitCommands.rebase",y.GitCommandsReset="gitlens.gitCommands.reset",y.GitCommandsRevert="gitlens.gitCommands.revert",y.GitCommandsSwitch="gitlens.gitCommands.switch",y.GitCommandsTag="gitlens.gitCommands.tag",y.GitCommandsWorktree="gitlens.gitCommands.worktree",y.PlusHide="gitlens.plus.hide",y.PlusLearn="gitlens.plus.learn",y.PlusLoginOrSignUp="gitlens.plus.loginOrSignUp",y.PlusLogout="gitlens.plus.logout",y.PlusManage="gitlens.plus.manage",y.PlusPurchase="gitlens.plus.purchase",y.PlusResendVerification="gitlens.plus.resendVerification",y.PlusRestore="gitlens.plus.restore",y.PlusShowPlans="gitlens.plus.showPlans",y.PlusStartPreviewTrial="gitlens.plus.startPreviewTrial",y.PlusValidate="gitlens.plus.validate",y.QuickOpenFileHistory="gitlens.quickOpenFileHistory",y.RefreshHover="gitlens.refreshHover",y.ResetAvatarCache="gitlens.resetAvatarCache",y.ResetSuppressedWarnings="gitlens.resetSuppressedWarnings",y.RevealCommitInView="gitlens.revealCommitInView",y.SearchCommits="gitlens.showCommitSearch",y.SearchCommitsInView="gitlens.views.searchAndCompare.searchCommits",y.SetViewsLayout="gitlens.setViewsLayout",y.ShowBranchesView="gitlens.showBranchesView",y.ShowCommitInView="gitlens.showCommitInView",y.ShowCommitsInView="gitlens.showCommitsInView",y.ShowCommitsView="gitlens.showCommitsView",y.ShowContributorsView="gitlens.showContributorsView",y.ShowHomeView="gitlens.showHomeView",y.ShowFileHistoryView="gitlens.showFileHistoryView",y.ShowLastQuickPick="gitlens.showLastQuickPick",y.ShowLineHistoryView="gitlens.showLineHistoryView",y.ShowQuickBranchHistory="gitlens.showQuickBranchHistory",y.ShowQuickCommit="gitlens.showQuickCommitDetails",y.ShowQuickCommitFile="gitlens.showQuickCommitFileDetails",y.ShowQuickCurrentBranchHistory="gitlens.showQuickRepoHistory",y.ShowQuickFileHistory="gitlens.showQuickFileHistory",y.ShowQuickRepoStatus="gitlens.showQuickRepoStatus",y.ShowQuickCommitRevision="gitlens.showQuickRevisionDetails",y.ShowQuickCommitRevisionInDiffLeft="gitlens.showQuickRevisionDetailsInDiffLeft",y.ShowQuickCommitRevisionInDiffRight="gitlens.showQuickRevisionDetailsInDiffRight",y.ShowQuickStashList="gitlens.showQuickStashList",y.ShowRemotesView="gitlens.showRemotesView",y.ShowRepositoriesView="gitlens.showRepositoriesView",y.ShowSearchAndCompareView="gitlens.showSearchAndCompareView",y.ShowSettingsPage="gitlens.showSettingsPage",y.ShowSettingsPageAndJumpToBranchesView="gitlens.showSettingsPage#branches-view",y.ShowSettingsPageAndJumpToCommitsView="gitlens.showSettingsPage#commits-view",y.ShowSettingsPageAndJumpToContributorsView="gitlens.showSettingsPage#contributors-view",y.ShowSettingsPageAndJumpToFileHistoryView="gitlens.showSettingsPage#file-history-view",y.ShowSettingsPageAndJumpToLineHistoryView="gitlens.showSettingsPage#line-history-view",y.ShowSettingsPageAndJumpToRemotesView="gitlens.showSettingsPage#remotes-view",y.ShowSettingsPageAndJumpToRepositoriesView="gitlens.showSettingsPage#repositories-view",y.ShowSettingsPageAndJumpToSearchAndCompareView="gitlens.showSettingsPage#search-compare-view",y.ShowSettingsPageAndJumpToStashesView="gitlens.showSettingsPage#stashes-view",y.ShowSettingsPageAndJumpToTagsView="gitlens.showSettingsPage#tags-view",y.ShowSettingsPageAndJumpToWorkTreesView="gitlens.showSettingsPage#worktrees-view",y.ShowSettingsPageAndJumpToViews="gitlens.showSettingsPage#views",y.ShowStashesView="gitlens.showStashesView",y.ShowTagsView="gitlens.showTagsView",y.ShowWorktreesView="gitlens.showWorktreesView",y.RefreshTimelinePage="gitlens.refreshTimelinePage",y.ShowTimelinePage="gitlens.showTimelinePage",y.ShowTimelineView="gitlens.showTimelineView",y.ShowWelcomePage="gitlens.showWelcomePage",y.StashApply="gitlens.stashApply",y.StashSave="gitlens.stashSave",y.StashSaveFiles="gitlens.stashSaveFiles",y.SwitchMode="gitlens.switchMode",y.ToggleCodeLens="gitlens.toggleCodeLens",y.ToggleFileBlame="gitlens.toggleFileBlame",y.ToggleFileBlameInDiffLeft="gitlens.toggleFileBlameInDiffLeft",y.ToggleFileBlameInDiffRight="gitlens.toggleFileBlameInDiffRight",y.ToggleFileChanges="gitlens.toggleFileChanges",y.ToggleFileChangesOnly="gitlens.toggleFileChangesOnly",y.ToggleFileHeatmap="gitlens.toggleFileHeatmap",y.ToggleFileHeatmapInDiffLeft="gitlens.toggleFileHeatmapInDiffLeft",y.ToggleFileHeatmapInDiffRight="gitlens.toggleFileHeatmapInDiffRight",y.ToggleLineBlame="gitlens.toggleLineBlame",y.ToggleReviewMode="gitlens.toggleReviewMode",y.ToggleZenMode="gitlens.toggleZenMode",y.ViewsCopy="gitlens.views.copy",y.ViewsOpenDirectoryDiff="gitlens.views.openDirectoryDiff",y.ViewsOpenDirectoryDiffWithWorking="gitlens.views.openDirectoryDiffWithWorking",y.Deprecated_DiffHeadWith="gitlens.diffHeadWith",y.Deprecated_DiffWorkingWith="gitlens.diffWorkingWith",y.Deprecated_OpenBranchesInRemote="gitlens.openBranchesInRemote",y.Deprecated_OpenBranchInRemote="gitlens.openBranchInRemote",y.Deprecated_OpenCommitInRemote="gitlens.openCommitInRemote",y.Deprecated_OpenFileInRemote="gitlens.openFileInRemote",y.Deprecated_OpenInRemote="gitlens.openInRemote",y.Deprecated_OpenRepoInRemote="gitlens.openRepoInRemote",y.Deprecated_ShowFileHistoryInView="gitlens.showFileHistoryInView",y))(b||{}),p=(y=>(y.ActionPrefix="gitlens:action:",y.KeyPrefix="gitlens:key:",y.ActiveFileStatus="gitlens:activeFileStatus",y.AnnotationStatus="gitlens:annotationStatus",y.Debugging="gitlens:debugging",y.DisabledToggleCodeLens="gitlens:disabledToggleCodeLens",y.Disabled="gitlens:disabled",y.Enabled="gitlens:enabled",y.HasConnectedRemotes="gitlens:hasConnectedRemotes",y.HasRemotes="gitlens:hasRemotes",y.HasRichRemotes="gitlens:hasRichRemotes",y.HasVirtualFolders="gitlens:hasVirtualFolders",y.Readonly="gitlens:readonly",y.TimelinePageFocused="gitlens:timelinePage:focused",y.Untrusted="gitlens:untrusted",y.ViewsCanCompare="gitlens:views:canCompare",y.ViewsCanCompareFile="gitlens:views:canCompare:file",y.ViewsCommitsMyCommitsOnly="gitlens:views:commits:myCommitsOnly",y.ViewsFileHistoryCanPin="gitlens:views:fileHistory:canPin",y.ViewsFileHistoryCursorFollowing="gitlens:views:fileHistory:cursorFollowing",y.ViewsFileHistoryEditorFollowing="gitlens:views:fileHistory:editorFollowing",y.ViewsLineHistoryEditorFollowing="gitlens:views:lineHistory:editorFollowing",y.ViewsRepositoriesAutoRefresh="gitlens:views:repositories:autoRefresh",y.ViewsSearchAndCompareKeepResults="gitlens:views:searchAndCompare:keepResults",y.Vsls="gitlens:vsls",y.Plus="gitlens:plus",y.PlusAllowed="gitlens:plus:allowed",y.PlusRequired="gitlens:plus:required",y.PlusState="gitlens:plus:state",y))(p||{}),M=(y=>(y.CloseActiveEditor="workbench.action.closeActiveEditor",y.CloseAllEditors="workbench.action.closeAllEditors",y.CursorMove="cursorMove",y.Diff="vscode.diff",y.EditorScroll="editorScroll",y.EditorShowHover="editor.action.showHover",y.ExecuteDocumentSymbolProvider="vscode.executeDocumentSymbolProvider",y.ExecuteCodeLensProvider="vscode.executeCodeLensProvider",y.FocusFilesExplorer="workbench.files.action.focusFilesExplorer",y.InstallExtension="workbench.extensions.installExtension",y.MoveViews="vscode.moveViews",y.Open="vscode.open",y.OpenFolder="vscode.openFolder",y.OpenInTerminal="openInTerminal",y.OpenWalkthrough="workbench.action.openWalkthrough",y.OpenWith="vscode.openWith",y.NextEditor="workbench.action.nextEditor",y.PreviewHtml="vscode.previewHtml",y.RevealLine="revealLine",y.RevealInExplorer="revealInExplorer",y.RevealInFileExplorer="revealFileInOS",y.SetContext="setContext",y.ShowExplorer="workbench.view.explorer",y.ShowReferences="editor.action.showReferences",y.ShowSCM="workbench.view.scm",y.UninstallExtension="workbench.extensions.uninstallExtension",y))(M||{}),z=(y=>(y.Publish="git.publish",y.Pull="git.pull",y.PullRebase="git.pullRebase",y.Push="git.push",y.PushForce="git.pushForce",y.UndoCommit="git.undoCommit",y))(z||{}),U=(y=>(y.AutoRepositoryDetection="git.autoRepositoryDetection",y.RepositoryScanMaxDepth="git.repositoryScanMaxDepth",y.FetchOnPull="git.fetchOnPull",y.UseForcePushWithLease="git.useForcePushWithLease",y))(U||{}),O=(y=>(y.AngleBracketLeftHeavy="\u2770",y.AngleBracketRightHeavy="\u2771",y.ArrowBack="\u21A9",y.ArrowDown="\u2193",y.ArrowDownUp="\u21F5",y.ArrowDropRight="\u2937",y.ArrowHeadRight="\u27A4",y.ArrowLeft="\u2190",y.ArrowLeftDouble="\u21D0",y.ArrowLeftRight="\u2194",y.ArrowLeftRightDouble="\u21D4",y.ArrowLeftRightDoubleStrike="\u21CE",y.ArrowLeftRightLong="\u27F7",y.ArrowRight="\u2192",y.ArrowRightDouble="\u21D2",y.ArrowRightHollow="\u21E8",y.ArrowUp="\u2191",y.ArrowUpDown="\u21C5",y.ArrowUpRight="\u2197",y.ArrowsHalfLeftRight="\u21CB",y.ArrowsHalfRightLeft="\u21CC",y.ArrowsLeftRight="\u21C6",y.ArrowsRightLeft="\u21C4",y.Asterisk="\u2217",y.Check="\u2714",y.Dash="\u2014",y.Dot="\u2022",y.Ellipsis="\u2026",y.EnDash="\u2013",y.Envelope="\u2709",y.EqualsTriple="\u2261",y.Flag="\u2691",y.FlagHollow="\u2690",y.MiddleEllipsis="\u22EF",y.MuchLessThan="\u226A",y.MuchGreaterThan="\u226B",y.Pencil="\u270E",y.Space="\xA0",y.SpaceThin="\u2009",y.SpaceThinnest="\u200A",y.SquareWithBottomShadow="\u274F",y.SquareWithTopShadow="\u2750",y.Warning="\u26A0",y.ZeroWidthSpace="\u200B",y))(O||{}),F=(y=>(y.DebugConsole="debug",y.File="file",y.Git="git",y.GitHub="github",y.GitLens="gitlens",y.Output="output",y.PRs="pr",y.Vsls="vsls",y.VslsScc="vsls-scc",y.Virtual="vscode-vfs",y))(F||{})},7778:(Se,ae,v)=>{"use strict";v.d(ae,{W:()=>zi});var r=v(9496),B=v(2589),_=v(1045),R=(s=>(s[s.Throw=0]="Throw",s[s.Ignore=1]="Ignore",s))(R||{}),b=v(2833),p=v(7369),M=v(2971),z=Object.defineProperty,U=Object.getOwnPropertyDescriptor,O=n((s,e,t,i)=>{for(var o=i>1?void 0:i?U(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&z(e,t,o),o},"__decorateClass");const F=n(class{static parse(s,e,t,i){if(!e)return;const o=new Map,d=new Map,w=[];let S,X,re,he;for(re of(0,M.UM)(e))if(he=re.split(" "),!(he.length<2)){if([X]=he,S==null){S={sha:X,originalLine:parseInt(he[1],10),line:parseInt(he[2],10),lineCount:parseInt(he[3],10)};continue}switch(X){case"author":S.sha===b.GitRevision.uncommitted?S.author="You":S.author=re.slice(X.length+1).trim();break;case"author-mail":{if(S.sha===b.GitRevision.uncommitted){S.authorEmail=i?.email;continue}S.authorEmail=re.slice(X.length+1).trim();const Ie=S.authorEmail.indexOf("<");if(Ie>=0){const Ve=S.authorEmail.indexOf(">",Ie);Ve>Ie?S.authorEmail=S.authorEmail.substring(Ie+1,Ve):S.authorEmail=S.authorEmail.substring(Ie+1)}break}case"author-time":S.authorDate=he[1];break;case"author-tz":S.authorTimeZone=he[1];break;case"committer":b.GitRevision.isUncommitted(S.sha)?S.committer="You":S.committer=re.slice(X.length+1).trim();break;case"committer-mail":{if(b.GitRevision.isUncommitted(S.sha)){S.committerEmail=i?.email;continue}S.committerEmail=re.slice(X.length+1).trim();const Ie=S.committerEmail.indexOf("<");if(Ie>=0){const Ve=S.committerEmail.indexOf(">",Ie);Ve>Ie?S.committerEmail=S.committerEmail.substring(Ie+1,Ve):S.committerEmail=S.committerEmail.substring(Ie+1)}break}case"committer-time":S.committerDate=he[1];break;case"committer-tz":S.committerTimeZone=he[1];break;case"summary":S.summary=re.slice(X.length+1).trim();break;case"previous":S.previousSha=he[1],S.previousPath=he.slice(2).join(" ");break;case"filename":S.path=re.slice(X.length+1),F.parseEntry(s,S,t,d,o,w,i),S=void 0;break;default:break}}for(const[,Ie]of d){if(!Ie.author.name)continue;const Ve=o.get(Ie.author.name);if(Ve==null)return;Ve.lineCount+=Ie.lines.length}const pe=new Map([...o.entries()].sort((Ie,Ve)=>Ve[1].lineCount-Ie[1].lineCount));return{repoPath:t,authors:pe,commits:d,lines:w}}static parseEntry(s,e,t,i,o,d,w){let S=i.get(e.sha);if(S==null){if(e.author!=null){w!=null&&(w.name!=null||w.email!=null)&&(w.name==null||w.name===e.author)&&(w.email==null||w.email===e.authorEmail)&&(e.author="You");let X=o.get(e.author);X==null&&(X={name:e.author,lineCount:0},o.set(e.author,X))}S=new b.GitCommit(s,t,e.sha,new b.GitCommitIdentity(e.author,e.authorEmail,new Date(e.authorDate*1e3)),new b.GitCommitIdentity(e.committer,e.committerEmail,new Date(e.committerDate*1e3)),e.summary,[],void 0,new b.GitFileChange(t,e.path,b.GitFileIndexStatus.Modified,e.previousPath&&e.previousPath!==e.path?e.previousPath:void 0,e.previousSha),void 0,[]),i.set(e.sha,S)}for(let X=0,re=e.lineCount;Xe in s?I(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"__defNormalProp"),x=n((s,e,t,i)=>{for(var o=i>1?void 0:i?Y(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&I(e,t,o),o},"branchParser_decorateClass"),L=n((s,e,t)=>(D(s,typeof e!="symbol"?e+"":e,t),t),"__publicField");const h=/^(.+)(.+)(.*)(?:\[(?:ahead ([0-9]+))?[,\s]*(?:behind ([0-9]+))?]|\[(gone)])?(.*)(.*)$/gm,E="%3c",T="%3e";class N{static parse(e,t){const i=[];if(!e)return i;let o,d,w,S,X,re,he,pe,_e,Ie;do{if(Ie=h.exec(e),Ie==null)break;if([,o,d,w,S,X,re,he,pe]=Ie,d.startsWith("refs/remotes/")){if(d=d.substr(13),d.endsWith("/HEAD"))continue;_e=!0}else d=d.substr(11),_e=!1;i.push(new V.X(t,d,_e,o.charCodeAt(0)===42,new Date(pe),he==null||he.length===0?void 0:` ${he}`.substr(1),w==null||w.length===0?void 0:{name:` ${w}`.substr(1),missing:Boolean(re)},Number(S)||0,Number(X)||0))}while(!0);return i}}n(N,"GitBranchParser"),L(N,"defaultFormat",[`${E}h${T}%(HEAD)`,`${E}n${T}%(refname)`,`${E}u${T}%(upstream:short)`,`${E}t${T}%(upstream:track)`,`${E}r${T}%(objectname)`,`${E}d${T}%(committerdate:iso8601)`].join("")),x([(0,p.fF)({args:!1,singleLine:!0})],N,"parse",1);var j=v(1691),$=v(7042),A=v(516),k=Object.defineProperty,te=Object.getOwnPropertyDescriptor,ce=n((s,e,t)=>e in s?k(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"logParser_defNormalProp"),Q=n((s,e,t,i)=>{for(var o=i>1?void 0:i?te(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&k(e,t,o),o},"logParser_decorateClass"),K=n((s,e,t)=>(ce(s,typeof e!="symbol"?e+"":e,t),t),"logParser_publicField");const Z=/diff --git a\/(.*) b\/(.*)/,ie=/^@@ -(\d+?),(\d+?) \+(\d+?),(\d+?) @@/,ne=/(\S)\S*\t([^\t\n]+)(?:\t(.+))?/,ge=/^(\d+?|-)\s+?(\d+?|-)\s+?(.*)(?:\n\s(delete|rename|copy|create))?/,q=/(.+)\s=>\s(.+)/,we=/(.*?){(.+?)\s=>\s(.*?)}(.*)/,Fe=/^ (.*)\s*(?:(?:diff --git a\/(.*) b\/(.*))|(?:(\S)\S*\t([^\t\n]+)(?:\t(.+))?))/gm,Ge=/^ (\S+)\s*(.*)$/s,tt=/^(\S)\S*\t([^\t\n]+)(?:\t(.+)?)?$/gm,Me="%x3c",Ne="%x3e",Ue="%x2f",Ze="%x20";var it=(s=>(s[s.Log=0]="Log",s[s.LogFile=1]="LogFile",s))(it||{});const rt=n(class{static get defaultParser(){return this._defaultParser==null&&(this._defaultParser=rt.createWithFiles({sha:"%H",author:"%aN",authorEmail:"%aE",authorDate:"%at",committer:"%cN",committerEmail:"%cE",committerDate:"%ct",message:"%B",parents:"%P"})),this._defaultParser}static create(s,e){let t=e?.prefix??"";const i=[];for(const w in s)i.push(w),t+=`${e?.fieldPrefix??""}${s[w]}${e?.fieldSuffix??(e?.fieldPrefix==null?"%x00":"")}`;const o=["-z",`--format=${t}`];e?.additionalArgs!=null&&e.additionalArgs.length>0&&o.push(...e.additionalArgs);function*d(w){var S;let X={},re=0,he;const pe=(0,M.UM)(w,e?.separator??"\0");if(e?.skip)for(let _e=0;_e`);let It=bt.next();if(It.done)return;i!==void 0&&(i=(0,A.AH)(i));const Bt=new Map;let gi=S,xi,Ui,Wi;e:for(;It=bt.next(),!(It.done||(Ie=It.value,X&&S&&dt>=S));)switch(Ve=Ie.charCodeAt(1),Ve){case 114:_e={sha:Ie.substring(4)};break;case 97:b.GitRevision.uncommitted===_e.sha?_e.author="You":_e.author=Ie.substring(4);break;case 101:_e.authorEmail=Ie.substring(4);break;case 100:_e.authorDate=Ie.substring(4);break;case 110:_e.committer=Ie.substring(4);break;case 109:_e.committedDate=Ie.substring(4);break;case 99:_e.committedDate=Ie.substring(4);break;case 112:_e.parentShas=Ie.substring(4).split(" ");break;case 115:for(;It=bt.next(),!(It.done||(Ie=It.value,Ie===""));)_e.summary===void 0?_e.summary=Ie:_e.summary+=` ${Ie}`;_e.summary!=null&&_e.summary.charCodeAt(_e.summary.length-1)===10&&(_e.summary=_e.summary.slice(0,-1));break;case 102:{It=bt.next();let Jl=!0;if(It.done||It.value===""){if((((he=_e.parentShas)==null?void 0:he.length)??0)>1){gi&&gi--;break}Jl=!1}for(;Jl&&(It=bt.next(),!(It.done||(Ie=It.value,Ie==="")));)if(!Ie.startsWith("warning:"))if(t===0)xi=ne.exec(Ie),xi!=null&&(_e.files===void 0&&(_e.files=[]),Ui=xi[3],Ui!==void 0?_e.files.push({status:xi[1],path:Ui,originalPath:xi[2]}):_e.files.push({status:xi[1],path:xi[2]}));else if(xi=Z.exec(Ie),xi!=null){for([,_e.originalPath,_e.path]=xi,_e.path===_e.originalPath?(_e.originalPath=void 0,_e.status=b.GitFileIndexStatus.Modified):_e.status=b.GitFileIndexStatus.Renamed,bt.next(),bt.next(),It=bt.next(),xi=ie.exec(It.value),xi!==null&&(_e.line={sha:_e.sha,originalLine:parseInt(xi[1],10),line:parseInt(xi[3],10)});It=bt.next(),!(It.done||It.value===""););break}else{if(It=bt.next(),xi=ge.exec(`${Ie} ${It.value}`),xi!=null)switch(_e.fileStats={additions:Number(xi[1])||0,deletions:Number(xi[2])||0,changes:0},xi[4]){case void 0:_e.status="M",_e.path=xi[3];break;case"copy":case"rename":_e.status=xi[4]==="copy"?"C":"R",Ui=xi[3],Wi=we.exec(Ui),Wi!=null?(_e.path=Wi[3]===""?`${Wi[1]}${Wi[4]}`.replace("//","/"):`${Wi[1]}${Wi[3]}${Wi[4]}`,_e.originalPath=`${Wi[1]}${Wi[2]}${Wi[4]}`):(Wi=q.exec(Ui),Wi!=null?(_e.path=Wi[2],_e.originalPath=Wi[1]):_e.path=Ui);break;case"create":_e.status="A",_e.path=xi[3];break;case"delete":_e.status="D",_e.path=xi[3];break;default:_e.status="M",_e.path=xi[3];break}if(It.done||It.value==="")break}_e.files!==void 0&&(_e.path=(0,$.DZ)(_e.files,Th=>Th.path?Th.path:void 0).join(", ")),et&&i===void 0&&t===1&&o!==void 0?(i=(0,A.AH)(o.replace(o.startsWith("/")?`/${_e.path}`:_e.path,"")),pe=(0,A.AH)((0,A.Gf)(i,o))):pe=_e.path,et=!1;const ql=Bt.get(_e.sha);if(ql===void 0){if(dt++,S&&dt>S)break e}else gi&&gi--;rt.parseEntry(s,_e,ql,t,i,pe,Bt,w);break}}return{repoPath:i,commits:Bt,sha:d,count:dt,limit:S,range:re,hasMore:Boolean(gi&&dt>gi&&gi!==1)}}static parseEntry(s,e,t,i,o,d,w,S){var X,re;if(t==null){e.author!=null&&(0,b.isUserMatch)(S,e.author,e.authorEmail)&&(e.author="You"),e.committer!=null&&(0,b.isUserMatch)(S,e.committer,e.committerEmail)&&(e.committer="You");const he=e.originalPath??(d!==e.path?e.path:void 0),pe={files:(X=e.files)==null?void 0:X.map(_e=>new b.GitFileChange(o,_e.path,_e.status,_e.originalPath))};i===1&&(pe.file=new b.GitFileChange(o,d,e.status,he,void 0,e.fileStats)),t=new b.GitCommit(s,o,e.sha,new b.GitCommitIdentity(e.author,e.authorEmail,new Date(e.authorDate*1e3)),new b.GitCommitIdentity(e.committer,e.committerEmail,new Date(e.committedDate*1e3)),((re=e.summary)==null?void 0:re.split(` `,1)[0])??"",e.parentShas??[],e.summary??"",pe,void 0,e.line!=null?[e.line]:[]),w.set(e.sha,t)}}static parseSimple(s,e,t){let i,o,d,w,S,X,re;do{if(re=Fe.exec(s),re==null)break;re[1]!==t&&(e-- >0||([,i,o,d,w,S,X]=re,S=` ${d||o||X||S}`.substr(1),w=w==null||w.length===0?void 0:` ${w}`.substr(1)))}while(e>=0);return Fe.lastIndex=0,[i==null||i.length===0?void 0:` ${i}`.substr(1),S,w]}static parseSimpleRenamed(s,e){let t=Ge.exec(s);if(t==null)return[void 0,void 0,void 0];const[,i,o]=t;let d,w,S;do{if(t=tt.exec(o),t==null)break;if([,d,w,S]=t,e!==w){d=void 0,w=void 0,S=void 0;continue}w=` ${S||w}`.substr(1),d=d==null||d.length===0?void 0:` ${d}`.substr(1);break}while(!0);return tt.lastIndex=0,[i==null||i.length===0||w==null?void 0:` ${i}`.substr(1),w,d]}},"_GitLogParser");let ut=rt;K(ut,"shortstatRegex",/(?\d+) files? changed(?:, (?\d+) insertions?\(\+\))?(?:, (?\d+) deletions?\(-\))?/),K(ut,"_defaultParser"),K(ut,"defaultFormat",[`${Me}${Ue}f${Ne}`,`${Me}r${Ne}${Ze}%H`,`${Me}a${Ne}${Ze}%aN`,`${Me}e${Ne}${Ze}%aE`,`${Me}d${Ne}${Ze}%at`,`${Me}n${Ne}${Ze}%cN`,`${Me}m${Ne}${Ze}%cE`,`${Me}c${Ne}${Ze}%ct`,`${Me}p${Ne}${Ze}%P`,`${Me}s${Ne}`,"%B",`${Me}${Ue}s${Ne}`,`${Me}f${Ne}`].join("%n")),K(ut,"simpleRefs",`${Me}r${Ne}${Ze}%H`),K(ut,"simpleFormat",`${Me}r${Ne}${Ze}%H`),K(ut,"shortlog","%H%x00%aN%x00%aE%x00%at"),Q([(0,p.fF)({args:!1})],ut,"parse",1),Q([(0,p.fF)({args:!1})],ut,"parseSimple",1),Q([(0,p.fF)({args:!1})],ut,"parseSimpleRenamed",1);var xt=v(9425),Ft=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,$e=n((s,e,t)=>e in s?Ft(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"reflogParser_defNormalProp"),lt=n((s,e,t,i)=>{for(var o=i>1?void 0:i?Ee(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&Ft(e,t,o),o},"reflogParser_decorateClass"),ht=n((s,e,t)=>($e(s,typeof e!="symbol"?e+"":e,t),t),"reflogParser_publicField");const St=/^(.+)(.+?)@{(.+)}(\w*)(.*?)(?::(.*))?$/gm,Ut=/.*?\/?HEAD$/,ri="%x3c",We="%x3e";class le{static parse(e,t,i,o,d){if(!e)return;const w=[];let S,X,re,he,pe,_e,Ie,Ve,dt,et=0,bt=0,It,Bt,gi;do{if(gi=St.exec(e),gi==null)break;if([,S,X,re,he,pe,_e]=gi,bt++,Bt!==void 0){if(S===Bt.sha&&(re!==It||!Ut.test(Bt.selector)||Ut.test(X)))continue;if(S!==Bt.sha&&(Ie!=null&&Ve===It&&dt==Bt.sha&&Ut.test(Bt.selector)?Bt.update(S,Ie):Bt.update(S),w.push(Bt),Bt=void 0,It=void 0,et++,o!==0&&et>=o))break}if(he==="HEAD"){Ie=X,Ve=re,dt=S;continue}i.includes(he)&&(Bt=new xt.$(t,` ${S}`.substr(1),` ${X}`.substr(1),new Date(re),` ${he}`.substr(1),pe==null||pe.length===0?void 0:pe.substr(1),_e==null||_e.length===0?void 0:_e.substr(1)),It=re)}while(!0);return St.lastIndex=0,{repoPath:t,records:w,count:et,total:bt,limit:o,hasMore:o!==0&&et>=o||d!==0&&bt>=d}}}n(le,"GitReflogParser"),ht(le,"defaultFormat",[`${ri}r${We}%H`,`${ri}d${We}%gD`,`${ri}s${We}%gs`].join("")),lt([(0,p.fF)({args:!1})],le,"parse",1);var Ae=Object.defineProperty,De=Object.getOwnPropertyDescriptor,Re=n((s,e,t,i)=>{for(var o=i>1?void 0:i?De(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&Ae(e,t,o),o},"remoteParser_decorateClass");const Je="",mt=/^(.*)\t(.*)\s\((.*)\)$/gm,vt=/^(?:(git:\/\/)(.*?)\/|(https?:\/\/)(?:.*?@)?(.*?)\/|git@(.*):|(ssh:\/\/)(?:.*@)?(.*?)(?::.*?)?(?:\/|(?=~))|(?:.*?@)(.*?):)(.*)$/;class ot{static parse(e,t,i){if(!e)return;const o=[],d=Object.create(null);let w,S,X,re,he,pe,_e,Ie,Ve;do{if(Ve=mt.exec(e),Ve==null)break;if([,w,S,X]=Ve,S=` ${S}`.substr(1),[re,he,pe]=this.parseGitUrl(S),_e=`${he?`${he}/`:""}${pe}`,Ie=d[_e],Ie===void 0){const dt=i(S,he,pe);Ie=new b.GitRemote(t,_e,` ${w}`.substr(1),re,dt!==void 0?dt.domain:he,dt!==void 0?dt.path:pe,dt,[{url:S,type:` ${X}`.substr(1)}]),o.push(Ie),d[_e]=Ie}else Ie.urls.push({url:S,type:` ${X}`.substr(1)})}while(!0);return o}static parseGitUrl(e){const t=vt.exec(e);return t==null?[Je,Je,e]:[t[1]||t[3]||t[6],t[2]||t[4]||t[5]||t[7]||t[8],t[9].replace(/\.git\/?$/,Je)]}}n(ot,"GitRemoteParser"),Re([(0,p.fF)({args:!1,singleLine:!0})],ot,"parse",1);var Zt=Object.defineProperty,Ri=Object.getOwnPropertyDescriptor,Oi=n((s,e,t)=>e in s?Zt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"stashParser_defNormalProp"),Ht=n((s,e,t,i)=>{for(var o=i>1?void 0:i?Ri(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&Zt(e,t,o),o},"stashParser_decorateClass"),Rt=n((s,e,t)=>(Oi(s,typeof e!="symbol"?e+"":e,t),t),"stashParser_publicField");const Pi="%x3c",Bi="%x3e",wi="%x2f",Zi="%x20",gt=n(class{static parse(s,e,t){if(!e)return;const i=(0,M.UM)(`${e}`);let o=i.next();if(o.done)return;t!==void 0&&(t=(0,A.AH)(t));const d=new Map;let w={},S,X,re,he;for(;o=i.next(),!o.done;)switch(S=o.value,X=S.charCodeAt(1),X){case 114:w={ref:S.substring(4)};break;case 100:w.date=S.substring(4);break;case 99:w.committedDate=S.substring(4);break;case 108:w.stashName=S.substring(4);break;case 115:for(;o=i.next(),!(o.done||(S=o.value,S===""));)w.summary===void 0?w.summary=S:w.summary+=` ${S}`;w.summary!=null&&w.summary.charCodeAt(w.summary.length-1)===10&&(w.summary=w.summary.slice(0,-1));break;case 102:if(o=i.next(),!o.done&&o.value!==""){for(;o=i.next(),!(o.done||(S=o.value,S===""));)S.startsWith("warning:")||(re=ne.exec(S),re!=null&&(w.files===void 0&&(w.files=[]),he=re[3],he!==void 0?w.files.push({status:re[1],path:he,originalPath:re[2]}):w.files.push({status:re[1],path:re[2]})));w.files!=null&&(w.fileNames=(0,$.DZ)(w.files,_e=>_e.path?_e.path:void 0).join(", "))}gt.parseEntry(s,w,t,d),w={}}return{repoPath:t,commits:d}}static parseEntry(s,e,t,i){var o,d;let w=i.get(e.ref);w==null&&(w=new b.GitCommit(s,t,e.ref,new b.GitCommitIdentity("You",void 0,new Date(e.date*1e3)),new b.GitCommitIdentity("You",void 0,new Date(e.committedDate*1e3)),((o=e.summary)==null?void 0:o.split(` `,1)[0])??"",[],e.summary??"",((d=e.files)==null?void 0:d.map(S=>new b.GitFileChange(t,S.path,S.status,S.originalPath)))??[],void 0,[],e.stashName)),i.set(e.ref,w)}},"_GitStashParser");let be=gt;Rt(be,"defaultFormat",[`${Pi}${wi}f${Bi}`,`${Pi}r${Bi}${Zi}%H`,`${Pi}d${Bi}${Zi}%at`,`${Pi}c${Bi}${Zi}%ct`,`${Pi}l${Bi}${Zi}%gd`,`${Pi}s${Bi}`,"%B",`${Pi}${wi}s${Bi}`,`${Pi}f${Bi}`].join("%n")),Ht([(0,p.fF)({args:!1,singleLine:!0})],be,"parse",1);var Te=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,qe=n((s,e,t,i)=>{for(var o=i>1?void 0:i?Ke(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&Te(e,t,o),o},"statusParser_decorateClass");const at="",Lt=/(?:ahead ([0-9]+))/,Dt=/(?:behind ([0-9]+))/;class Pt{static parse(e,t,i){if(!e)return;const o=e.split(` `).filter(d=>Boolean(d));if(o.length!==0)return i<2?this.parseV1(o,t):this.parseV2(o,t)}static parseV1(e,t){let i;const o=[],d={ahead:0,behind:0};let w,S=-1;for(;++S2){const he=re.slice(2).join(" "),pe=Lt.exec(he);d.ahead=pe==null?0:Number(pe[1])||0;const _e=Dt.exec(he);d.behind=_e==null?0:Number(_e[1])||0}}else{const re=X.substring(0,2),he=X.substring(3);if(re.startsWith("R")||re.startsWith("C")){const[pe,_e]=he.replace(/"/g,at).split("->");o.push(this.parseStatusFile(t,re,_e.trim(),pe.trim()))}else o.push(this.parseStatusFile(t,re,he))}}return new b.GitStatus((0,A.AH)(t),i??at,at,o,d,w)}static parseV2(e,t){let i;const o=[];let d;const w={ahead:0,behind:0};let S,X=-1;for(;++X1&&(w=t[1]!=="."?t[1].trim():void 0,(w==null||w.length===0)&&(w=void 0)),new b.GitStatusFile(e,d,w,i,o)}}n(Pt,"GitStatusParser"),qe([(0,p.fF)({args:!1,singleLine:!0})],Pt,"parse",1),qe([(0,p.fF)({args:!1,singleLine:!0})],Pt,"parseV1",1),qe([(0,p.fF)({args:!1,singleLine:!0})],Pt,"parseV2",1);var Xt=Object.defineProperty,hi=Object.getOwnPropertyDescriptor,Yt=n((s,e,t)=>e in s?Xt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"tagParser_defNormalProp"),Wt=n((s,e,t,i)=>{for(var o=i>1?void 0:i?hi(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&Xt(e,t,o),o},"tagParser_decorateClass"),di=n((s,e,t)=>(Yt(s,typeof e!="symbol"?e+"":e,t),t),"tagParser_publicField");const Ii=/^(.+)<\*r>(.*)(.*)(.*)(.*)(.*)$/gm,lr="%3c",cr="%3e";class Nr{static parse(e,t){if(!e)return;const i=[];let o,d,w,S,X,re,he;do{if(he=Ii.exec(e),he==null)break;[,o,d,w,S,X,re]=he,o=o.substr(10),i.push(new b.GitTag(t,o,` ${d||w}`.substr(1),` ${re}`.substr(1),S?new Date(S):void 0,X==null||X.length===0?void 0:new Date(X)))}while(!0);return i}}n(Nr,"GitTagParser"),di(Nr,"defaultFormat",[`${lr}n${cr}%(refname)`,`${lr}*r${cr}%(*objectname)`,`${lr}r${cr}%(objectname)`,`${lr}d${cr}%(creatordate:iso8601)`,`${lr}ad${cr}%(authordate:iso8601)`,`${lr}s${cr}%(subject)`].join("")),Wt([(0,p.fF)({args:!1,singleLine:!0})],Nr,"parse",1);var pn=Object.defineProperty,Gr=Object.getOwnPropertyDescriptor,ue=n((s,e,t,i)=>{for(var o=i>1?void 0:i?Gr(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&pn(e,t,o),o},"treeParser_decorateClass");const xe="",Ce=/(?:.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+)/gm;class Oe{static parse(e){if(!e)return;const t=[];let i,o,d,w,S;do{if(S=Ce.exec(e),S==null)break;[,i,o,d,w]=S,t.push({commitSha:o==null||o.length===0?xe:` ${o}`.substr(1),path:w==null||w.length===0?xe:` ${w}`.substr(1),size:Number(d)||0,type:i==null||i.length===0?xe:` ${i}`.substr(1)})}while(!0);return t}}n(Oe,"GitTreeParser"),ue([(0,p.fF)({args:!1,singleLine:!0})],Oe,"parse",1);var nt=v(5649),Ct=Object.defineProperty,Vt=Object.getOwnPropertyDescriptor,ti=n((s,e,t,i)=>{for(var o=i>1?void 0:i?Vt(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&Ct(e,t,o),o},"worktreeParser_decorateClass");class vi{static parse(e,t){if(!e)return[];t!=null&&(t=(0,A.AH)(t));const i=[];let o,d,w,S,X,re,he,pe=!0;for(d of(0,M.UM)(e)){if(w=d.indexOf(" "),w===-1?(S=d,X=""):(S=d.substring(0,w),X=d.substring(w+1)),S.length===0&&o!=null){i.push(new nt.e(pe,o.bare?"bare":o.detached?"detached":"branch",t,r.Uri.file(o.path),o.locked??!1,o.prunable??!1,o.sha,o.branch)),o=void 0,pe=!1;continue}switch(o==null&&(o={}),S){case"worktree":o.path=X;break;case"bare":o.bare=!0;break;case"HEAD":o.sha=X;break;case"branch":o.branch=X.substr(11);break;case"detached":o.detached=!0;break;case"locked":[,re]=X.split(" ",2),o.locked=re?.trim()||!0;break;case"prunable":[,he]=X.split(" ",2),o.prunable=he?.trim()||!0;break}}return i}}n(vi,"GitWorktreeParser"),ti([(0,p.fF)({args:!1,singleLine:!0})],vi,"parse",1);var ke=v(2436),ji=v(565);const nr=require("child_process"),qi=require("fs");var Xi=v(1017),Li=v(4914),Rr=Object.defineProperty,ir=Object.getOwnPropertySymbols,er=Object.prototype.hasOwnProperty,yr=Object.prototype.propertyIsEnumerable,Cr=n((s,e,t)=>e in s?Rr(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"shell_defNormalProp"),ur=n((s,e)=>{for(var t in e||(e={}))er.call(e,t)&&Cr(s,t,e[t]);if(ir)for(var t of ir(e))yr.call(e,t)&&Cr(s,t,e[t]);return s},"__spreadValues"),Hr=n((s,e)=>{var t={};for(var i in s)er.call(s,i)&&e.indexOf(i)<0&&(t[i]=s[i]);if(s!=null&&ir)for(var i of ir(s))e.indexOf(i)<0&&yr.call(s,i)&&(t[i]=s[i]);return t},"__objRest");const Or=process.platform==="win32",xr=/[\\/]/,ki=/\.ps1$/i,ai=/\.(bat|cmd)$/i,se=/\.(js)$/i;function ye(s){if(xr.test(s))return s;const e=(0,Xi.join)(".",s);try{const i=(0,qi.statSync)(e);if(i?.isFile()&&je(i))return e}catch{}const t=process.env.PATH;if(t!=null&&t.length!==0){const i=t.split(Or?";":":");let o;for(const d of i){const w=(0,Xi.join)(d,s);try{if(o=(0,qi.statSync)(w),o?.isFile()&&je(o))return w}catch{}}}return s}n(ye,"runDownPath");function je(s){if(Or)return!0;const e=s.gid?process.getgid!=null&&s.gid===process.getgid():!0,t=s.uid?process.getuid!=null&&s.uid===process.getuid():!0;return Boolean(s.mode&1||s.mode&8&&e||s.mode&64&&t)}n(je,"isExecutable");function Xe(s,e){if(!Or)return{cmd:ye(s),args:e};if(!(0,qi.existsSync)(s)){const t=[".exe",".bat",".cmd",".ps1"];for(const i of t){const o=ye(`${s}${i}`);if((0,qi.existsSync)(o))return Xe(o,e)}}if(ki.test(s))return{cmd:(0,Xi.join)(process.env.SYSTEMROOT??"C:\\WINDOWS","System32","WindowsPowerShell","v1.0","PowerShell.exe"),args:["-ExecutionPolicy","Unrestricted","-NoLogo","-NonInteractive","-File",s].concat(e)};if(ai.test(s)){const t=(0,Xi.join)(process.env.SYSTEMROOT??"C:\\WINDOWS","System32","cmd.exe"),i=["/C",s,...e];return{cmd:t,args:i}}return se.test(s)?{cmd:process.execPath,args:[s].concat(e)}:{cmd:s,args:e}}n(Xe,"findExecutable");const Qe=/stdout maxBuffer( length)? exceeded/;class ct extends Error{constructor(e,t,i){super(e.message);this.original=e,this.stdout=t,this.stderr=i;var o;t=t.trim(),i=i.trim(),(o=Error.captureStackTrace)==null||o.call(Error,this,ct)}get cmd(){return this.original.cmd}get killed(){return this.original.killed}get code(){return this.original.code}get signal(){return this.original.signal}}n(ct,"RunError");function pt(s,e,t,i){const o=ur({maxBuffer:104857600},i),{stdin:d,stdinEncoding:w}=o,S=Hr(o,["stdin","stdinEncoding"]);return new Promise((X,re)=>{var he;const pe=(0,nr.execFile)(s,e,S,(_e,Ie,Ve)=>{if(i?.exitCodeOnly){X(_e?.code??pe.exitCode);return}if(_e!=null){Qe.test(_e.message)&&(_e.message=`Command output exceeded the allocated stdout buffer. Set 'options.maxBuffer' to a larger value than ${S.maxBuffer} bytes`),re(new ct(_e,t==="utf8"||t==="binary"||t==="buffer"?Ie:(0,Li.decode)(Buffer.from(Ie,"binary"),t),t==="utf8"||t==="binary"||t==="buffer"?Ve:(0,Li.decode)(Buffer.from(Ve,"binary"),t)));return}Ve&&ke.Y.warn(`Warning(${s} ${e.join(" ")}): ${Ve}`),X(t==="utf8"||t==="binary"||t==="buffer"?Ie:(0,Li.decode)(Buffer.from(Ie,"binary"),t))});d!=null&&((he=pe.stdin)==null||he.end(d,w??"utf8"))})}n(pt,"run");function Ot(s){return new Promise(e=>(0,qi.exists)(s,t=>e(t)))}n(Ot,"fsExists");var ni=Object.defineProperty,oi=Object.defineProperties,At=Object.getOwnPropertyDescriptors,Kt=Object.getOwnPropertySymbols,Nt=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable,jt=n((s,e,t)=>e in s?ni(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"git_defNormalProp"),Mt=n((s,e)=>{for(var t in e||(e={}))Nt.call(e,t)&&jt(s,t,e[t]);if(Kt)for(var t of Kt(e))Jt.call(e,t)&&jt(s,t,e[t]);return s},"git_spreadValues"),Gi=n((s,e)=>oi(s,At(e)),"__spreadProps"),gn=n((s,e)=>{var t={};for(var i in s)Nt.call(s,i)&&e.indexOf(i)<0&&(t[i]=s[i]);if(s!=null&&Kt)for(var i of Kt(s))e.indexOf(i)<0&&Jt.call(s,i)&&(t[i]=s[i]);return t},"git_objRest"),_n=n((s,e,t)=>(jt(s,typeof e!="symbol"?e+"":e,t),t),"git_publicField");const or=Object.freeze([]),Nn=Object.freeze({}),cs=3e4,Vr=new TextDecoder("utf8"),Ei="4b825dc642cb6eb9a060e54bf8d69288fbee4904",Ki={badRevision:/bad revision '(.*?)'/i,noFastForward:/\(non-fast-forward\)/i,noMergeBase:/no merge base/i,notAValidObjectName:/Not a valid object name/i,invalidLineCount:/file .+? has only \d+ lines/i,uncommittedChanges:/contains modified or untracked files/i,alreadyExists:/already exists/i,alreadyCheckedOut:/already checked out/i,mainWorkingTree:/is a main working tree/i},rr={notARepository:/Not a git repository/i,outsideRepository:/is outside repository/i,noPath:/no such path/i,noCommits:/does not have any commits/i,notFound:/Path '.*?' does not exist in/i,foundButNotInRevision:/Path '.*?' exists on disk, but not in/i,headNotABranch:/HEAD does not point to a branch/i,noUpstream:/no upstream configured for branch '(.*?)'/i,unknownRevision:/ambiguous argument '.*?': unknown revision or path not in the working tree|not stored as a remote-tracking branch/i,mustRunInWorkTree:/this operation must be run in a work tree/i,patchWithConflicts:/Applied patch to '.*?' with conflicts/i,noRemoteRepositorySpecified:/No remote repository specified\./i,remoteConnectionError:/Could not read from remote repository/i,notAGitCommand:/'.+' is not a git command/i};function nn(s,e,t){const i=s.message||s.toString();if(i!=null&&i.length!==0){for(const d of Object.values(rr))if(d.test(i)){const w=t!==void 0?`${(0,M.qk)(t)} ms`:"";return ke.Y.warn(`[${e}] Git ${i.trim().replace(/fatal: /g,"").replace(/\r?\n|\r/g,` ${_.NE.Dot} `)} ${_.NE.Dot} ${w}`),""}const o=Ki.badRevision.exec(i);if(o!=null){const[,d]=o;if(d?.endsWith("^3"))return""}}throw s}n(nn,"defaultExceptionHandler");class Fi{constructor(){_n(this,"pendingCommands",new Map),_n(this,"gitLocator"),_n(this,"ignoreRevsFileMap",new Map)}async git(e,...t){const i=(0,B.a)(),o=e,{configs:d,correlationKey:w,errors:S,encoding:X}=o,re=gn(o,["configs","correlationKey","errors","encoding"]),he=Gi(Mt({},re),{encoding:(X??"utf8")==="utf8"?"utf8":"buffer",env:Gi(Mt(Mt({},process.env),e.env??Nn),{GCM_INTERACTIVE:"NEVER",GCM_PRESERVE_CREDS:"TRUE",LC_ALL:"C"})}),pe=`[${he.cwd}] git ${t.join(" ")}`,_e=`${w!==void 0?`${w}:`:""}${pe}`;let Ie,Ve=this.pendingCommands.get(_e);Ve===void 0?(Ie=!1,t.splice(0,0,"-c","core.quotepath=false","-c","color.ui=false",...d!==void 0?d:or),process.platform==="win32"&&t.splice(0,0,"-c","core.longpaths=true"),Ve=pt(await this.path(),t,X??"utf8",he),this.pendingCommands.set(_e,Ve)):(Ie=!0,ke.Y.debug(`[GIT ] ${pe} ${_.NE.Dot} waiting...`));let dt;try{return await Ve}catch(et){switch(dt=et,S){case R.Ignore:return dt=void 0,"";case R.Throw:throw et;default:{const bt=nn(et,e.cwd,i);return dt=void 0,bt}}}finally{this.pendingCommands.delete(_e);const et=(0,M.qk)(i),bt=et>ke.Y.slowCallWarningThreshold,It=bt||Ie?` (${bt?`slow${Ie?", waiting":""}`:""}${Ie?"waiting":""})`:"";dt!=null?ke.Y.error("",`[GIT ] ${pe} ${_.NE.Dot} ${(dt.message||String(dt)||"").trim().replace(/fatal: /g,"").replace(/\r?\n|\r/g,` ${_.NE.Dot} `)} ${_.NE.Dot} ${et} ms${It}`):bt?ke.Y.warn(`[GIT ] ${pe} ${_.NE.Dot} ${et} ms${It}`):ke.Y.log(`[GIT ] ${pe} ${_.NE.Dot} ${et} ms${It}`),ke.Y.logGitCommand(`${pe}${dt!=null?` ${_.NE.Dot} FAILED`:""}${Ie?" (waited)":""}`,et,dt)}}setLocator(e){this.gitLocator=e}async path(){return(await this.gitLocator()).path}async version(){return(await this.gitLocator()).version}async isAtLeastVersion(e){return(0,ji.qu)((0,ji.mL)(await this.version()),(0,ji.mL)(e))!==-1}add(e,t){return this.git({cwd:e},"add","-A","--",t)}apply(e,t,i={}){const o=["apply","--whitespace=warn"];return i.allowConflicts&&o.push("-3"),this.git({cwd:e,stdin:t},...o)}async blame(e,t,i,o={}){const[d,w]=(0,A.uo)(t,e,!0),S=["blame","--root","--incremental"];if(o.ignoreWhitespace&&S.push("-w"),o.startLine!=null&&o.endLine!=null&&S.push(`-L ${o.startLine},${o.endLine}`),o.args!=null){S.push(...o.args);const re=S.indexOf("--ignore-revs-file");if(re!==-1){let he=await this.isAtLeastVersion("2.23");if(he){let pe=S[re+1];(0,A.YP)(pe)||(pe=(0,A.RQ)(e??"",pe));const _e=this.ignoreRevsFileMap.get(pe);if(_e!==void 0)he=_e;else{try{he=await Ot(pe)}catch{he=!1}this.ignoreRevsFileMap.set(pe,he)}}he||S.splice(re,2)}}let X;return i&&(b.GitRevision.isUncommittedStaged(i)?(S.push("--contents","-"),X=await this.show(e,t,":")):S.push(i)),this.git({cwd:w,stdin:X},...S,"--",d)}blame__contents(e,t,i,o={}){const[d,w]=(0,A.uo)(t,e,!0),S=["blame","--root","--incremental"];return o.ignoreWhitespace&&S.push("-w"),o.startLine!=null&&o.endLine!=null&&S.push(`-L ${o.startLine},${o.endLine}`),o.args!=null&&S.push(...o.args),S.push("--contents","-"),this.git({cwd:w,stdin:i,correlationKey:o.correlationKey},...S,"--",d)}branch__containsOrPointsAt(e,t,{mode:i="contains",name:o=void 0,remotes:d=!1}={}){const w=["branch"];return d&&w.push("-r"),w.push(i==="pointsAt"?`--points-at=${t}`:`--contains=${t}`,"--format=%(refname:short)"),o!=null&&w.push(o),this.git({cwd:e,configs:["-c","color.branch=false"],errors:R.Ignore},...w)}check_ignore(e,...t){return this.git({cwd:e,errors:R.Ignore,stdin:t.join("\0")},"check-ignore","-z","--stdin")}check_mailmap(e,t){return this.git({cwd:e,errors:R.Ignore},"check-mailmap",t)}async check_ref_format(e,t,i={branch:!0}){const o=["check-ref-format"];i.branch?o.push("--branch"):o.push("--normalize");try{const d=await this.git({cwd:t??"",errors:R.Throw},...o,e);return Boolean(d.trim())}catch{return!1}}checkout(e,t,{createBranch:i,path:o}={}){const d=["checkout"];return i?d.push("-b",i,t,"--"):(d.push(t,"--"),o&&([o,e]=(0,A.uo)(o,e,!0),d.push(o))),this.git({cwd:e},...d)}async config__get(e,t,i={}){const o=await this.git({cwd:t??"",errors:R.Ignore,local:i.local},"config","--get",e);return o.length===0?void 0:o.trim()}async config__get_regex(e,t,i={}){const o=await this.git({cwd:t??"",errors:R.Ignore,local:i.local},"config","--get-regex",e);return o.length===0?void 0:o.trim()}async diff(e,t,i,o,d={}){const w=["diff","--no-ext-diff","--minimal"];d.linesOfContext!=null&&w.push(`-U${d.linesOfContext}`),d.renames&&w.push(`-M${d.similarityThreshold==null?"":`${d.similarityThreshold}%`}`),d.filters!=null&&d.filters.length!==0&&w.push(`--diff-filter=${d.filters.join("")}`),i&&(i.endsWith("^3^")&&(i=Ei),w.push(b.GitRevision.isUncommittedStaged(i)?"--staged":i)),o&&w.push(b.GitRevision.isUncommittedStaged(o)?"--staged":o);try{return await this.git({cwd:e,configs:["-c","color.diff=false"],encoding:d.encoding},...w,"--",t)}catch(S){const X=Ki.badRevision.exec(S.message);if(X!==null){const[,re]=X;if(re===i&&re!=null&&re.endsWith("^"))return this.diff(e,t,Ei,o,d)}throw S}}async diff__contents(e,t,i,o,d={}){const w=["diff",`-M${d.similarityThreshold==null?"":`${d.similarityThreshold}%`}`,"--no-ext-diff","-U0","--minimal"];d.filters!=null&&d.filters.length!==0&&w.push(`--diff-filter=${d.filters.join("")}`),w.push("--no-index");try{return await this.git({cwd:e,configs:["-c","color.diff=false"],encoding:d.encoding,stdin:o},...w,"--",t,"-")}catch(S){if(S instanceof ct&&S.stdout)return S.stdout;const X=Ki.badRevision.exec(S.message);if(X!==null){const[,re]=X;if(re===i&&re!=null&&re.endsWith("^"))return this.diff__contents(e,t,Ei,o,d)}throw S}}diff__name_status(e,t,i,{filters:o,similarityThreshold:d}={}){const w=["diff","--name-status",`-M${d==null?"":`${d}%`}`,"--no-ext-diff"];return o!=null&&o.length!==0&&w.push(`--diff-filter=${o.join("")}`),t&&w.push(t),i&&w.push(i),this.git({cwd:e,configs:["-c","color.diff=false"]},...w,"--")}async diff__shortstat(e,t){const i=["diff","--shortstat","--no-ext-diff"];t&&i.push(t);try{return await this.git({cwd:e,configs:["-c","color.diff=false"]},...i,"--")}catch(o){const d=o?.toString()??"";if(Ki.noMergeBase.test(d))return;throw o}}difftool(e,t,i,o={}){const d=["difftool","--no-prompt",`--tool=${i}`];return o.staged&&d.push("--staged"),o.ref1&&d.push(o.ref1),o.ref2&&d.push(o.ref2),this.git({cwd:e},...d,"--",t)}difftool__dir_diff(e,t,i,o){const d=["difftool","--dir-diff",`--tool=${t}`,i];return o&&d.push(o),this.git({cwd:e},...d)}async fetch(e,t={}){const i=["fetch"];if(t.prune&&i.push("--prune"),t.branch&&t.remote)if(t.upstream&&t.pull){i.push("-u",t.remote,`${t.upstream}:${t.branch}`);try{await this.git({cwd:e},...i);return}catch(o){const d=o?.toString()??"";if(Ki.noFastForward.test(d)){r.window.showErrorMessage(`Unable to pull the '${t.branch}' branch, as it can't be fast-forwarded.`);return}throw o}}else i.push(t.remote,t.branch);else t.remote?i.push(t.remote):t.all&&i.push("--all");await this.git({cwd:e},...i)}for_each_ref__branch(e,t={all:!1}){const i=["for-each-ref",`--format=${N.defaultFormat}`,"refs/heads"];return t.all&&i.push("refs/remotes"),this.git({cwd:e},...i)}log(e,t,{all:i,argsOrFormat:o,authors:d,limit:w,merges:S,ordering:X,similarityThreshold:re,since:he}){o==null&&(o=["--name-status",`--format=${ut.defaultFormat}`]),typeof o=="string"&&(o=[`--format=${o}`]);const pe=["log",...o,"--full-history",`-M${re==null?"":`${re}%`}`,"-m"];return X&&pe.push(`--${X}-order`),w&&pe.push(`-n${w+1}`),he&&pe.push(`--since="${he}"`),S||pe.push("--first-parent"),d!=null&&d.length!==0&&(pe.includes("--use-mailmap")||pe.push("--use-mailmap"),pe.push(...d.map(_e=>`--author=^${_e.name} <${_e.email}>$`))),i&&pe.push("--all"),t&&!b.GitRevision.isUncommittedStaged(t)&&pe.push(t),this.git({cwd:e,configs:["-c","diff.renameLimit=0","-c","log.showSignature=false"]},...pe,"--")}log__file(e,t,i,{all:o,argsOrFormat:d,fileMode:w="full",filters:S,firstParent:X=!1,limit:re,ordering:he,renames:pe=!0,reverse:_e=!1,since:Ie,skip:Ve,startLine:dt,endLine:et}={}){const[bt,It]=(0,A.uo)(t,e,!0);d==null&&(d=[`--format=${ut.defaultFormat}`]),typeof d=="string"&&(d=[`--format=${d}`]);const Bt=["log",...d];return he&&Bt.push(`--${he}-order`),re&&!_e&&Bt.push(`-n${re+1}`),Ve&&Bt.push(`--skip=${Ve}`),Ie&&Bt.push(`--since="${Ie}"`),o&&Bt.push("--all"),pe&&(o||dt!=null)&&(pe=!1),Bt.push(pe?"--follow":"-m"),X&&(Bt.push("--first-parent"),pe&&Bt.push("-m")),S!=null&&S.length!==0&&Bt.push(`--diff-filter=${S.join("")}`),w!=="none"&&(dt==null?w==="simple"||(0,A.Mh)(bt)?Bt.push("--name-status"):Bt.push("--numstat","--summary"):Bt.push(`-L ${dt},${et??dt}:${bt}`)),i&&!b.GitRevision.isUncommittedStaged(i)&&(_e?Bt.push("--reverse","--ancestry-path",`${i}..HEAD`):Bt.push(i)),dt==null&&Bt.push("--",bt),this.git({cwd:It,configs:["-c","log.showSignature=false"]},...Bt)}async log__file_recent(e,t,{ordering:i,ref:o,similarityThreshold:d}={}){const w=["log",`-M${d==null?"":`${d}%`}`,"-n1","--format=%H"];i&&w.push(`--${i}-order`),o&&w.push(o);const S=await this.git({cwd:e,configs:["-c","log.showSignature=false"],errors:R.Ignore},...w,"--",t);return S.length===0?void 0:S.trim()}async log__find_object(e,t,i,o,d){const w=["log","-n1","--no-renames","--format=%H",`--find-object=${t}`,i];o&&w.push(`--${o}-order`),d&&w.push("--",d);const S=await this.git({cwd:e,configs:["-c","log.showSignature=false"],errors:R.Ignore},...w);return S.length===0?void 0:S.trim()}async log__recent(e,t){const i=["log","-n1","--format=%H"];t&&i.push(`--${t}-order`);const o=await this.git({cwd:e,configs:["-c","log.showSignature=false"],errors:R.Ignore},...i,"--");return o.length===0?void 0:o.trim()}async log__recent_committerdate(e,t){const i=["log","-n1","--format=%ct"];t&&i.push(`--${t}-order`);const o=await this.git({cwd:e,configs:["-c","log.showSignature=false"],errors:R.Ignore},...i,"--");return o.length===0?void 0:o.trim()}log__search(e,t=or,{limit:i,ordering:o,skip:d,useShow:w}={}){const S=[w?"show":"log","--name-status",`--format=${ut.defaultFormat}`,"--use-mailmap"];return i&&!w&&S.push(`-n${i+1}`),d&&!w&&S.push(`--skip=${d}`),o&&!w&&S.push(`--${o}-order`),this.git({cwd:e,configs:w?void 0:["-c","log.showSignature=false"]},...S,...t)}async ls_files(e,t,{ref:i,untracked:o}={}){const d=["ls-files"];i&&!b.GitRevision.isUncommitted(i)&&d.push(`--with-tree=${i}`),!i&&o&&d.push("-o");const w=await this.git({cwd:e,errors:R.Ignore},...d,"--",t);return w.length===0?void 0:w.trim()}ls_remote(e,t,i){return this.git({cwd:e},"ls-remote",t,i)}ls_remote__HEAD(e,t){return this.git({cwd:e},"ls-remote","--symref",t,"HEAD")}async ls_tree(e,t,i){const o=["ls-tree"];i?o.push("-l",t,"--",i):o.push("-lrt",t,"--");const d=await this.git({cwd:e,errors:R.Ignore},...o);return d.length===0?void 0:d.trim()}merge_base(e,t,i,o){const d=["merge-base"];return o?.forkPoint&&d.push("--fork-point"),this.git({cwd:e},...d,t,i)}async merge_base__is_ancestor(e,t,i){const o=["merge-base","--is-ancestor"];return await this.git({cwd:e,exitCodeOnly:!0},...o,t,i)===0}reflog(e,{all:t,branch:i,limit:o,ordering:d,skip:w}={}){const S=["log","--walk-reflogs",`--format=${le.defaultFormat}`,"--date=iso8601"];return d&&S.push(`--${d}-order`),t&&S.push("--all"),o&&S.push(`-n${o}`),w&&S.push(`--skip=${w}`),i&&S.push(i),this.git({cwd:e,configs:["-c","log.showSignature=false"]},...S,"--")}remote(e){return this.git({cwd:e},"remote","-v")}remote__add(e,t,i){return this.git({cwd:e},"remote","add",t,i)}remote__prune(e,t){return this.git({cwd:e},"remote","prune",t)}remote__get_url(e,t){return this.git({cwd:e},"remote","get-url",t)}reset(e,t){return this.git({cwd:e},"reset","-q","--",t)}async rev_list__count(e,t){let i=await this.git({cwd:e,errors:R.Ignore},"rev-list","--count",t,"--");if(i=i.trim(),i.length===0)return;const o=parseInt(i,10);return isNaN(o)?void 0:o}async rev_list__left_right(e,t){const i=await this.git({cwd:e,errors:R.Ignore},"rev-list","--left-right","--count",...t,"--");if(i.length===0)return;const o=i.split(" ");if(o.length!==2)return;const[d,w]=o,S={ahead:parseInt(d,10),behind:parseInt(w,10)};if(!(isNaN(S.ahead)||isNaN(S.behind)))return S}async rev_parse__currentBranch(e,t){try{return[await this.git({cwd:e,errors:R.Throw},"rev-parse","--abbrev-ref","--symbolic-full-name","@","@{u}","--"),void 0]}catch(i){const o=i?.toString()??"";if(Ki.badRevision.test(o)||rr.noUpstream.test(o)){if(i.stdout!=null&&i.stdout.length!==0)return[i.stdout,void 0];try{const re=await this.symbolic_ref(e,"HEAD");if(re!=null)return[re.trim(),void 0]}catch{}try{const re=await this.symbolic_ref(e,"refs/remotes/origin/HEAD");if(re!=null)return[re.trim().substr(7),void 0]}catch(re){if(/is not a symbolic ref/.test(re.stderr))try{const he=await this.ls_remote__HEAD(e,"origin");if(he!=null){const pe=/ref:\s(\S+)\s+HEAD/m.exec(he);if(pe!=null){const[,_e]=pe;return[_e.substr(11),void 0]}}}catch{}}const d=await this.config__get("init.defaultBranch",e)??"main",w=await this.config__get_regex(`branch\\.${d}\\.+`,e,{local:!0});let S,X;if(w){let re=/^branch\..+\.remote\s(.+)$/m.exec(w);re!=null&&(S=re[1]),re=/^branch\..+\.merge\srefs\/heads\/(.+)$/m.exec(w),re!=null&&(X=re[1])}return[`${d}${S&&X?` ${S}/${X}`:""}`,void 0]}if(rr.headNotABranch.test(o)){const d=await this.log__recent(e,t);return d===void 0?void 0:[`(HEAD detached at ${b.GitRevision.shorten(d)})`,d]}nn(i,e);return}}async rev_parse__git_dir(e){const t=await this.git({cwd:e,errors:R.Ignore},"rev-parse","--git-dir");return t.length===0?void 0:(0,A.AH)(t.trimLeft().replace(/[\r|\n]+$/,""))}async rev_parse__show_toplevel(e){try{const t=await this.git({cwd:e,errors:R.Throw},"rev-parse","--show-toplevel");return t.length===0?void 0:(0,A.AH)(t.trimLeft().replace(/[\r|\n]+$/,""))}catch(t){const i=/this operation must be run in a work tree/.test(t.stderr);if(i||t.code==="ENOENT"){let o=i?!1:await Ot(e);if(!o){do{const d=(0,A.XX)(e);if(d===e||d.length===0)return;e=d,o=await Ot(e)}while(!o);return this.rev_parse__show_toplevel(e)}}return}}async rev_parse__verify(e,t,i){const o=["rev-parse","--verify"];await this.isAtLeastVersion("2.30")&&o.push("--end-of-options");const d=await this.git({cwd:e,errors:R.Ignore},...o,i?`${t}:./${i}`:`${t}^{commit}`);return d.length===0?void 0:d.trim()}async show(e,t,i,o={}){const[d,w]=(0,A.uo)(t,e,!0);if(b.GitRevision.isUncommittedStaged(i)&&(i=":"),b.GitRevision.isUncommitted(i))throw new Error(`ref=${i} is uncommitted`);const S={configs:["-c","log.showSignature=false"],cwd:w,encoding:o.encoding??"utf8",errors:R.Throw},X=i.endsWith(":")?`${i}./${d}`:`${i}:./${d}`;try{return await this.git(S,"show","--textconv",X,"--")}catch(re){const he=re?.toString()??"";return i===":"&&Ki.badRevision.test(he)?this.show(e,t,"HEAD:",o):Ki.badRevision.test(he)||rr.notFound.test(he)||rr.foundButNotInRevision.test(he)?void 0:nn(re,S.cwd)}}show__diff(e,t,i,o,{similarityThreshold:d}={}){const w=["show",`-M${d==null?"":`${d}%`}`,"--format=","--minimal","-U0",i,"--",t];return o!=null&&o.length!==0&&w.push(o),this.git({cwd:e},...w)}show__name_status(e,t,i){return this.git({cwd:e},"show","--name-status","--format=",i,"--",t)}show_ref__tags(e){return this.git({cwd:e,errors:R.Ignore},"show-ref","--tags")}stash__apply(e,t,i){return t?this.git({cwd:e},"stash",i?"pop":"apply",t):Promise.resolve(void 0)}async stash__delete(e,t,i){if(!!t){if(i){const o=await this.git({cwd:e,errors:R.Ignore},"show","--format=%H","--no-patch",t);if(o?.trim()!==i)throw new Error("Unable to delete stash; mismatch with stash number")}return this.git({cwd:e},"stash","drop",t)}}stash__list(e,{format:t=be.defaultFormat,similarityThreshold:i}={}){return this.git({cwd:e},"stash","list","--name-status",`-M${i==null?"":`${i}%`}`,`--format=${t}`)}async stash__push(e,t,{includeUntracked:i,keepIndex:o,pathspecs:d,stdin:w}={}){const S=["stash","push"];if((i||d!=null&&d.length!==0)&&S.push("-u"),o&&S.push("-k"),t&&S.push("-m",t),w&&d!=null&&d.length!==0){await this.git({cwd:e,stdin:d.join("\0")},...S,"--pathspec-from-file=-","--pathspec-file-nul");return}S.push("--"),d!=null&&d.length!==0&&S.push(...d),await this.git({cwd:e},...S)}async status(e,t=1,{similarityThreshold:i}={}){const o=["status",t>=2?`--porcelain=v${t}`:"--porcelain","--branch","-u"];return await this.isAtLeastVersion("2.18")&&o.push(`--find-renames${i==null?"":`=${i}%`}`),this.git({cwd:e,configs:["-c","color.status=false"],env:{GIT_OPTIONAL_LOCKS:"0"}},...o,"--")}async status__file(e,t,i=1,{similarityThreshold:o}={}){const[d,w]=(0,A.uo)(t,e,!0),S=["status",i>=2?`--porcelain=v${i}`:"--porcelain"];return await this.isAtLeastVersion("2.18")&&S.push(`--find-renames${o==null?"":`=${o}%`}`),this.git({cwd:w,configs:["-c","color.status=false"],env:{GIT_OPTIONAL_LOCKS:"0"}},...S,"--",d)}symbolic_ref(e,t){return this.git({cwd:e},"symbolic-ref","--short",t)}tag(e){return this.git({cwd:e},"tag","-l",`--format=${Nr.defaultFormat}`)}worktree__add(e,t,{commitish:i,createBranch:o,detach:d,force:w}={}){const S=["worktree","add"];return w&&S.push("--force"),o&&S.push("-b",o),d&&S.push("--detach"),S.push(t),i&&S.push(i),this.git({cwd:e},...S)}worktree__list(e){return this.git({cwd:e},"worktree","list","--porcelain")}worktree__remove(e,t,{force:i}={}){const o=["worktree","remove"];return i&&o.push("--force"),o.push(t),this.git({cwd:e,errors:R.Throw},...o)}async readDotGitFile(e,t,i){try{const o=await r.workspace.fs.readFile(r.Uri.file((0,A.RQ)(e,".git",...t)));let d=Vr.decode(o);if(d=i?.trim??!0?d.trim():d,i?.numeric){const w=Number.parseInt(d,10);return isNaN(w)?void 0:w}return d}catch(o){if(i?.throw)throw o;return}}}n(Fi,"Git");var io=v(2037),Ir=v(1149),zr=v(4673),ve=v(9179),ro=v(6532),Pr=v(3497),_r=v(5059),Dn=v(1505),Di=v(313),vr=v(5396),To=v(2090),Qi=v(6410),si=v(2062),bi=v(5861),li=v(2886),Yi=v(680),no=v(3866),Mn=v(4504),Eo=Object.defineProperty,oo=Object.getOwnPropertyDescriptor,so=Object.getOwnPropertySymbols,ao=Object.prototype.hasOwnProperty,kn=Object.prototype.propertyIsEnumerable,Qr=n((s,e,t)=>e in s?Eo(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"gitProviderService_defNormalProp"),Sn=n((s,e)=>{for(var t in e||(e={}))ao.call(e,t)&&Qr(s,t,e[t]);if(so)for(var t of so(e))kn.call(e,t)&&Qr(s,t,e[t]);return s},"gitProviderService_spreadValues"),Ks=n((s,e)=>{var t={};for(var i in s)ao.call(s,i)&&e.indexOf(i)<0&&(t[i]=s[i]);if(s!=null&&so)for(var i of so(s))e.indexOf(i)<0&&kn.call(s,i)&&(t[i]=s[i]);return t},"gitProviderService_objRest"),wt=n((s,e,t,i)=>{for(var o=i>1?void 0:i?oo(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&Eo(e,t,o),o},"gitProviderService_decorateClass"),sr=n((s,e,t)=>(Qr(s,typeof e!="symbol"?e+"":e,t),t),"gitProviderService_publicField");const us=100,lo=new Map([["master",us],["main",15],["default",10],["develop",5],["development",1]]);var co=(s=>(s.Private="private",s.Public="public",s.Local="local",s.Mixed="mixed",s))(co||{});const Fo=n(class{constructor(s){this.container=s,sr(this,"_onDidChangeProviders",new r.EventEmitter),sr(this,"_onDidChangeRepositories",new r.EventEmitter),sr(this,"_onDidChangeRepository",new r.EventEmitter),sr(this,"supportedSchemes",new Set),sr(this,"_disposable"),sr(this,"_pendingRepositories",new Map),sr(this,"_providers",new Map),sr(this,"_repositories",new To.x8),sr(this,"_richRemotesCache",new Map),sr(this,"_visitedPaths",new no.u$),sr(this,"_etag",0),sr(this,"_initializing",!0),sr(this,"_discoveredWorkspaceFolders",new Map),sr(this,"_subscription"),sr(this,"_accessCache",new Map),sr(this,"_visibilityCache",new Map),sr(this,"_context",{enabled:!1,disabled:!1}),this._disposable=r.Disposable.from(s.subscription.onDidChange(this.onSubscriptionChanged,this),r.window.onDidChangeWindowState(this.onWindowStateChanged,this),r.workspace.onDidChangeWorkspaceFolders(this.onWorkspaceFoldersChanged,this),ve.DN.onDidChange(this.onConfigurationChanged,this),Mn.Vy.onDidChange(e=>{e.reason==="connected"&&(0,Dn.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(s,e){this._etag=Date.now(),this._onDidChangeProviders.fire({added:s??[],removed:e??[],etag:this._etag})}get onDidChangeRepositories(){return this._onDidChangeRepositories.event}fireRepositoriesChanged(s,e){this._etag=Date.now(),this._accessCache.clear(),this._visibilityCache.delete(void 0),e?.length&&this._visibilityCache.clear(),this._onDidChangeRepositories.fire({added:s??[],removed:e??[],etag:this._etag})}get onDidChangeRepository(){return this._onDidChangeRepository.event}dispose(){this._disposable.dispose(),this._providers.clear(),this._repositories.forEach(s=>s.dispose()),this._repositories.clear()}get etag(){return this._etag}onConfigurationChanged(s){(ve.DN.changed(s,"defaultDateFormat")||ve.DN.changed(s,"defaultDateSource")||ve.DN.changed(s,"defaultDateStyle"))&&(this.container.BranchDateFormatting.reset(),this.container.CommitDateFormatting.reset(),this.container.PullRequestDateFormatting.reset()),ve.DN.changed(s,"advanced.abbreviatedShaLength")&&this.container.CommitShaFormatting.reset(),ve.DN.changed(s,"views.contributors.showAllBranches")&&this.resetCaches("contributors")}onSubscriptionChanged(s){this._accessCache.clear(),this._subscription=s.current}onWindowStateChanged(s){s.focused?this._repositories.forEach(e=>e.resume()):this._repositories.forEach(e=>e.suspend())}onWorkspaceFoldersChanged(s){if(s.added.length&&this.discoverRepositories(s.added),s.removed.length){const e=[];for(const t of s.removed){const i=this._repositories.getClosest(t.uri);i!=null&&(this._repositories.remove(i.uri),e.push(i))}e.length&&(this.updateContext(),queueMicrotask(()=>{this.fireRepositoriesChanged([],e),e.forEach(t=>t.dispose())}))}}get hasProviders(){return this._providers.size!==0}get registeredProviders(){return[...(0,li.UI)(this._providers.values(),s=>Sn({},s.descriptor))]}get openRepositories(){const s=[...(0,li.hX)(this.repositories,e=>!e.closed)];return s.length===0?s:b.Repository.sort(s)}get openRepositoryCount(){return(0,li.QX)(this.repositories,s=>!s.closed)}get repositories(){return this._repositories.values()}get repositoryCount(){return this._repositories.count}get highlander(){return this.repositoryCount===1?(0,li.Ps)(this._repositories.values()):void 0}register(s,e){var t;if(s!==e.descriptor.id)throw new Error(`Id '${s}' must match provider id '${e.descriptor.id}'`);if(this._providers.has(s))throw new Error(`Provider '${s}' has already been registered`);this._providers.set(s,e);for(const w of e.supportedSchemes)this.supportedSchemes.add(w);const i=[],o=(t=e.openRepositoryInitWatcher)==null?void 0:t.call(e);o!=null&&i.push(o,o.onDidCreate(w=>{const S=r.workspace.getWorkspaceFolder(w);S!=null&&this.discoverRepositories([S],{force:!0})}));const d=r.Disposable.from(e,...i,e.onDidChangeRepository(w=>{w.changed(b.RepositoryChange.Remotes,b.RepositoryChange.RemoteProviders,b.RepositoryChangeComparisonMode.Any)&&this._richRemotesCache.clear(),w.changed(b.RepositoryChange.Closed,b.RepositoryChangeComparisonMode.Any)&&(this.updateContext(),queueMicrotask(()=>this.fireRepositoriesChanged([],[w.repository]))),this._visibilityCache.delete(w.repository.path),this._onDidChangeRepository.fire(w)}),e.onDidCloseRepository(w=>{const S=this._repositories.get(w.uri);S!=null&&(S.closed=!0)}),e.onDidOpenRepository(w=>{const S=this._repositories.get(w.uri);S!=null?S.closed=!1:this.getOrOpenRepository(w.uri)}));return this.fireProvidersChanged([e]),this._initializing||this.onWorkspaceFoldersChanged({added:r.workspace.workspaceFolders??[],removed:[]}),{dispose:()=>{d.dispose(),this._providers.delete(s);const w=[];for(const S of[...this._repositories.values()])S?.provider.id===s&&(this._repositories.remove(S.uri),w.push(S));this.updateContext(),w.length&&queueMicrotask(()=>{this.fireRepositoriesChanged([],w),w.forEach(S=>S.dispose())}),this.fireProvidersChanged([],[e])}}}registrationComplete(){const s=ke.Y.getCorrelationContext();this._initializing=!1;const{workspaceFolders:e}=r.workspace;e?.length?this.discoverRepositories(e):this.updateContext(),s!=null&&(s.exitDetails=` ${_.NE.Dot} workspaceFolders=${e?.length}, git.autoRepositoryDetection=${ve.DN.getAny(_.eq.AutoRepositoryDetection)}`)}getOpenProviders(){return[...this.getOpenRepositoriesByProvider().keys()].map(e=>this._providers.get(e))}getOpenRepositories(s){return(0,li.hX)(this.repositories,e=>!e.closed&&(s==null||s===e.provider.id))}getOpenRepositoriesByProvider(){const s=[...(0,li.hX)(this.repositories,e=>!e.closed)];return s.length===0?new Map:(0,$.XI)(s,e=>e.provider.id)}hasOpenRepositories(s){return(0,li.G)(this.repositories,e=>!e.closed&&(s==null||s===e.provider.id))}async discoverRepositories(s,e){const t=[];for(const w of s){if(!e?.force&&this._discoveredWorkspaceFolders.has(w))continue;const S=this.discoverRepositoriesCore(w);t.push(S),this._discoveredWorkspaceFolders.set(w,S)}if(t.length===0)return;const i=await Promise.allSettled(t),o=(0,li.VS)((0,li.hX)(i,w=>w.status==="fulfilled"),w=>w.value),d=[];for(const w of o)this._repositories.add(w)&&d.push(w);this.updateContext(),d.length!==0&&queueMicrotask(()=>this.fireRepositoriesChanged(d))}async discoverRepositoriesCore(s){const{provider:e}=this.getProvider(s.uri);try{return await e.discoverRepositories(s.uri)}catch(t){return this._discoveredWorkspaceFolders.delete(s),ke.Y.error(t,`${e.descriptor.name} Provider(${e.descriptor.id}) failed discovering repositories in ${s.uri.toString(!0)}`),[]}}async getSubscription(){return this._subscription??(this._subscription=await this.container.subscription.getSubscription())}async access(s,e){let t;if(e!=null){const{path:o}=this.getProvider(e);t=o}let i=this._accessCache.get(t);return i==null&&(i=this.accessCore(s,e),this._accessCache.set(t,i)),i}async accessCore(s,e){var t,i;const o=await this.getSubscription();if(((t=o.account)==null?void 0:t.verified)===!1)return{allowed:!1,subscription:{current:o}};const d=o.plan.effective.id;if((0,si.aG)(d)||((i=Fo.previewFeatures)==null?void 0:i.get(s)))return{allowed:!0,subscription:{current:o}};function w(S,X){const{path:re}=this.getProvider(S);let he=this._accessCache.get(re);return he==null&&(he=this.visibility(S).then(pe=>{if(pe!==_r.q.Private)switch(X){case si.Cx.Free:return{allowed:!1,subscription:{current:o,required:si.Cx.FreePlus}};case si.Cx.FreePlus:return{allowed:!0,subscription:{current:o}}}return{allowed:!1,subscription:{current:o,required:si.Cx.Pro}}}),this._accessCache.set(re,he)),he}if(n(w,"getRepoAccess"),e==null){const S=this.openRepositories;if(S.length===0)return{allowed:!1,subscription:{current:o}};if(S.length===1)return w.call(this,S[0].path,d);let X=!0,re,he=-1;const pe=(0,si.kU)(si.Cx.Pro);for await(const _e of(0,Yi.Wx)(S.map(Ie=>w.call(this,Ie.path,d)))){if(_e.status!=="fulfilled"||_e.value.allowed)continue;X=!1;const Ie=(0,si.kU)(_e.value.subscription.required);if(he=pe)break}return X?{allowed:!0,subscription:{current:o}}:{allowed:!1,subscription:{current:o,required:re}}}return w.call(this,e,d)}async ensureAccess(s,e){const{allowed:t,subscription:i}=await this.access(s,e);if(!t)throw new vr.$y(i.current,i.required)}supports(s,e){const{provider:t}=this.getProvider(s);return t.supports(e)}async visibility(s){if(s==null){let i=this._visibilityCache.get(void 0);return i==null&&(i=this.visibilityCore(),this._visibilityCache.set(void 0,i)),i}const{path:e}=this.getProvider(s);let t=this._visibilityCache.get(e);return t==null&&(t=this.visibilityCore(s),this._visibilityCache.set(e,t)),t}async visibilityCore(s){function e(t){const{provider:i,path:o}=this.getProvider(t);let d=this._visibilityCache.get(o);return d==null&&(d=i.visibility(o),this._visibilityCache.set(o,d)),d}if(n(e,"getRepoVisibility"),s==null){const t=this.openRepositories;if(t.length===0)return"private";if(t.length===1)return e.call(this,t[0].path);let i=!1,o=!1,d=!1;for await(const w of(0,Yi.Wx)(t.map(S=>e.call(this,S.path))))if(w.status==="fulfilled"){if(w.value===_r.q.Public){if(d||o)return"mixed";i=!0}else if(w.value===_r.q.Local){if(i||o)return"mixed";d=!0}else if(w.value===_r.q.Private){if(i||d)return"mixed";o=!0}}return i?"public":d?"local":"private"}return e.call(this,s)}async setEnabledContext(s){let e=!s;if(!s&&this._initializing&&(e=!(this.container.storage.getWorkspace(Qi.sZ.AssumeRepositoriesOnStartup)??!0)),this._context.enabled===s&&this._context.disabled===e)return;const t=[];this._context.enabled!==s&&(this._context.enabled=s,t.push((0,Di.v)(_.zf.Enabled,s))),this._context.disabled!==e&&(this._context.disabled=e,t.push((0,Di.v)(_.zf.Disabled,e))),await Promise.all(t),this._initializing||this.container.storage.storeWorkspace(Qi.sZ.AssumeRepositoriesOnStartup,s)}updateContext(){const s=this.openRepositoryCount!==0;if(this.setEnabledContext(s),!s&&this._initializing)return;async function e(){let t=!1,i=!1,o=!1;if(s){for(const d of this._repositories.values())if(o||(o=await d.hasRichRemote(!0),o&&(i=!0,t=!0)),i||(i=await d.hasRichRemote(),i&&(t=!0)),t||(t=await d.hasRemotes()),t&&i&&o)break}await Promise.all([(0,Di.v)(_.zf.HasRemotes,t),(0,Di.v)(_.zf.HasRichRemotes,i),(0,Di.v)(_.zf.HasConnectedRemotes,o)])}n(e,"updateRemoteContext"),e.call(this),this._providers.forEach(t=>{var i;return(i=t.updateContext)==null?void 0:i.call(t)})}getProvider(s){if(s==null||typeof s!="string"&&!this.supportedSchemes.has(s.scheme))throw new vr.MO(s);let e;typeof s=="string"?e=(0,A.UG)(s)??_.sN.File:{scheme:e}=s;for(const t of this._providers.values()){const i=t.canHandlePathOrUri(e,s);if(i==null)continue;return{provider:t,path:i}}throw new vr.MO(s)}getAbsoluteUri(s,e){if(e==null)return typeof s=="string"?(0,A.tE)(s)?r.Uri.parse(s,!0):r.Uri.file(s):s;if(typeof e!="string"&&typeof s=="string"&&!(0,A.YP)(s))return r.Uri.joinPath(e,(0,A.AH)(s));const{provider:t}=this.getProvider(e);return t.getAbsoluteUri(s,e)}async getBestRevisionUri(s,e,t){if(s==null||t===b.GitRevision.deletedOrMissing)return;const{provider:i,path:o}=this.getProvider(s);return i.getBestRevisionUri(o,i.getRelativePath(e,o),t)}getRelativePath(s,e){const{provider:t}=this.getProvider(s instanceof r.Uri?s:e);return t.getRelativePath(s,e)}getRevisionUri(s,e,t){let i,o;typeof s=="string"?(o=s,typeof e=="string"?i=e:i=e.originalPath??e.path):(o=s.sha,t=s.repoPath,i=(0,A.M)(s));const{provider:d,path:w}=this.getProvider(t);return d.getRevisionUri(w,d.getRelativePath(i,w),o)}async getWorkingUri(s,e){const{provider:t,path:i}=this.getProvider(s);return t.getWorkingUri(i,e)}addRemote(s,e,t){const{provider:i,path:o}=this.getProvider(s);return i.addRemote(o,e,t)}pruneRemote(s,e){const{provider:t,path:i}=this.getProvider(s);return t.pruneRemote(i,e)}async applyChangesToWorkingFile(s,e,t){const{provider:i}=this.getProvider(s);return i.applyChangesToWorkingFile(s,e,t)}async checkout(s,e,t){const{provider:i,path:o}=this.getProvider(s);return i.checkout(o,e,t)}resetCaches(...s){(s.length===0||s.includes("providers"))&&this._richRemotesCache.clear();const e=s.filter(t=>t==="branches"||t==="remotes");if(s.length===0||e.length>0)for(const t of this.repositories)t.resetCaches(...e);for(const t of this._providers.values())t.resetCaches(...s)}async excludeIgnoredUris(s,e){const{provider:t,path:i}=this.getProvider(s);return t.excludeIgnoredUris(i,e)}async fetch(s,e){const{provider:t,path:i}=this.getProvider(s);return t.fetch(i,e)}async fetchAll(s,e){if(s==null&&(s=this.openRepositories),s.length!==0){if(s.length===1){await s[0].fetch(e);return}await r.window.withProgress({location:r.ProgressLocation.Notification,title:`Fetching ${s.length} repositories`},()=>Promise.all(s.map(t=>t.fetch(Sn({progress:!1},e)))))}}async pullAll(s,e){if(s==null&&(s=this.openRepositories),s.length!==0){if(s.length===1){await s[0].pull(e);return}await r.window.withProgress({location:r.ProgressLocation.Notification,title:`Pulling ${s.length} repositories`},()=>Promise.all(s.map(t=>t.pull(Sn({progress:!1},e)))))}}async pushAll(s,e){if(s==null&&(s=this.openRepositories),s.length!==0){if(s.length===1){await s[0].push(e);return}await r.window.withProgress({location:r.ProgressLocation.Notification,title:`Pushing ${s.length} repositories`},()=>Promise.all(s.map(t=>t.push(Sn({progress:!1},e)))))}}getAheadBehindCommitCount(s,e){const{provider:t,path:i}=this.getProvider(s);return t.getAheadBehindCommitCount(i,e)}async getBlame(s,e){const{provider:t}=this.getProvider(s);return t.getBlame(s,e)}async getBlameContents(s,e){const{provider:t}=this.getProvider(s);return t.getBlameContents(s,e)}async getBlameForLine(s,e,t,i){const{provider:o}=this.getProvider(s);return o.getBlameForLine(s,e,t,i)}async getBlameForLineContents(s,e,t,i){const{provider:o}=this.getProvider(s);return o.getBlameForLineContents(s,e,t,i)}async getBlameForRange(s,e){const{provider:t}=this.getProvider(s);return t.getBlameForRange(s,e)}async getBlameForRangeContents(s,e,t){const{provider:i}=this.getProvider(s);return i.getBlameForRangeContents(s,e,t)}getBlameRange(s,e,t){const{provider:i}=this.getProvider(e);return i.getBlameRange(s,e,t)}async getBranch(s){if(s==null)return;const{provider:e,path:t}=this.getProvider(s);return e.getBranch(t)}async getBranchAheadRange(s){var e,t;if(s.state.ahead>0)return b.GitRevision.createRange((e=s.upstream)==null?void 0:e.name,s.ref);if(s.upstream==null){const{values:i}=await this.getBranches(s.repoPath,{filter:o=>lo.has(o.name)});if(i.length>0){let o;for(const w of i){const S=lo.get(w.name);if((o==null||o.weightd.sha,d=>{if(e){if(d.name===e)return;if(d.refType==="branch"&&d.getNameWithoutRemote()===e)return{name:d.name,compactName:d.getRemoteName(),type:d.refType}}return{name:d.name,compactName:void 0,type:d.refType}});return(d,w)=>{const S=o.get(d);if(!(S==null||S.length===0)){if(!w?.compact)return S.map(X=>`${w?.icons?`${X.type==="tag"?"$(tag)":"$(git-branch)"} `:""}${X.name}`).join(", ");if(S.length>1){const[X]=S;return`${w?.icons?`${X.type==="tag"?"$(tag)":"$(git-branch)"} `:""}${X.compactName??X.name}, ${_.NE.Ellipsis}`}return S.map(X=>`${w?.icons?`${X.type==="tag"?"$(tag)":"$(git-branch)"} `:""}${X.compactName??X.name}`).join(", ")}}}getChangedFilesCount(s,e){const{provider:t,path:i}=this.getProvider(s);return t.getChangedFilesCount(i,e)}getCommit(s,e){const{provider:t,path:i}=this.getProvider(s);return t.getCommit(i,e)}getCommitBranches(s,e,t){const{provider:i,path:o}=this.getProvider(s);return i.getCommitBranches(o,e,t)}getCommitCount(s,e){const{provider:t,path:i}=this.getProvider(s);return t.getCommitCount(i,e)}async getCommitForFile(s,e,t){if(s==null)return;const{provider:i,path:o}=this.getProvider(s);return i.getCommitForFile(o,e,t)}async getOldestUnpushedRefForFile(s,e){const{provider:t,path:i}=this.getProvider(s);return t.getOldestUnpushedRefForFile(i,e)}async getContributors(s,e){if(s==null)return[];const{provider:t,path:i}=this.getProvider(s);return t.getContributors(i,e)}async getCurrentUser(s){const{provider:e,path:t}=this.getProvider(s);return e.getCurrentUser(t)}async getDefaultBranchName(s,e){if(s==null)return;const{provider:t,path:i}=this.getProvider(s);return t.getDefaultBranchName(i,e)}async getDiffForFile(s,e,t){const{provider:i}=this.getProvider(s);return i.getDiffForFile(s,e,t)}async getDiffForFileContents(s,e,t){const{provider:i}=this.getProvider(s);return i.getDiffForFileContents(s,e,t)}async getDiffForLine(s,e,t,i){const{provider:o}=this.getProvider(s);return o.getDiffForLine(s,e,t,i)}async getDiffStatus(s,e,t,i){const{provider:o,path:d}=this.getProvider(s);return o.getDiffStatus(d,e,t,i)}async getFileStatusForCommit(s,e,t){if(t===b.GitRevision.deletedOrMissing||b.GitRevision.isUncommitted(t))return;const{provider:i,path:o}=this.getProvider(s);return i.getFileStatusForCommit(o,e,t)}getLastFetchedTimestamp(s){const{provider:e,path:t}=this.getProvider(s);return e.getLastFetchedTimestamp(t)}async getLog(s,e){const{provider:t,path:i}=this.getProvider(s);return t.getLog(i,e)}async getLogRefsOnly(s,e){const{provider:t,path:i}=this.getProvider(s);return t.getLogRefsOnly(i,e)}async getLogForSearch(s,e,t){const{provider:i,path:o}=this.getProvider(s);return i.getLogForSearch(o,e,t)}async getLogForFile(s,e,t){if(s==null)return;const{provider:i,path:o}=this.getProvider(s);return i.getLogForFile(o,e,t)}async getMergeBase(s,e,t,i){const{provider:o,path:d}=this.getProvider(s);return o.getMergeBase(d,e,t,i)}async getMergeStatus(s){const{provider:e,path:t}=this.getProvider(s);return e.getMergeStatus(t)}async getRebaseStatus(s){const{provider:e,path:t}=this.getProvider(s);return e.getRebaseStatus(t)}getNextComparisonUris(s,e,t,i=0){if(!t)return Promise.resolve(void 0);const{provider:o,path:d}=this.getProvider(s);return o.getNextComparisonUris(d,e,t,i)}getPreviousComparisonUris(s,e,t,i=0,o=!1){if(t===b.GitRevision.deletedOrMissing)return Promise.resolve(void 0);const{provider:d,path:w}=this.getProvider(s);return d.getPreviousComparisonUris(w,e,t,i,o)}getPreviousComparisonUrisForLine(s,e,t,i,o=0){if(i===b.GitRevision.deletedOrMissing)return Promise.resolve(void 0);const{provider:d,path:w}=this.getProvider(s);return d.getPreviousComparisonUrisForLine(w,e,t,i,o)}async getPullRequestForBranch(s,e,t){var i;let o;if(b.GitRemote.is(e)){if({provider:o}=e,!o?.hasRichApi())return}else o=e;let d;t!=null&&(i=t,{timeout:d}=i,t=Ks(i,["timeout"]));let w=o.getPullRequestForBranch(s,t);if(w==null||!(0,Yi.tI)(w))return w;d!=null&&d>0&&(w=(0,Yi.HO)(w,d));try{return await w}catch(S){if(S instanceof Yi.PK)throw S;return}}async getPullRequestForCommit(s,e,t){if(b.GitRevision.isUncommitted(s))return;let i;if(b.GitRemote.is(e)){if({provider:i}=e,!i?.hasRichApi())return}else i=e;let o=i.getPullRequestForCommit(s);if(o==null||!(0,Yi.tI)(o))return o;t?.timeout!=null&&t.timeout>0&&(o=(0,Yi.HO)(o,t.timeout));try{return await o}catch(d){if(d instanceof Yi.PK)throw d;return}}async getIncomingActivity(s,e){const{provider:t,path:i}=this.getProvider(s);return t.getIncomingActivity(i,e)}async getRichRemoteProvider(s,e){if(s==null)return;let t;if(Array.isArray(s)){if(s.length===0)return;t=s,s=s[0].repoPath}typeof s=="string"&&(s=this.getAbsoluteUri(s));const i=(0,To.YW)(s);let o=this._richRemotesCache.get(i);if(o!=null)return o;if(o===null&&!e?.includeDisconnected)return;if(e?.includeDisconnected&&(o=this._richRemotesCache.get(`disconnected|${i}`),o!==void 0))return o??void 0;if(t=(t??await this.getRemotesWithProviders(s)).filter(X=>X.provider!=null),t.length===0)return;let d;if(t.length===1)d=t[0];else{const X=new Map([["upstream",15],["origin",10]]),re=await this.getBranch(t[0].repoPath),he=re?.getRemoteName();he!=null&&X.set(he,100);let pe,_e=0;for(const Ie of t){if(Ie.default){pe=Ie;break}const Ve=X.get(Ie.name)??-1;Ve>_e&&(pe=Ie,_e=Ve)}d=pe??null}if(!d?.hasRichProvider()){this._richRemotesCache.set(i,null);return}const{provider:w}=d;if(w.maybeConnected??await w.isConnected())this._richRemotesCache.set(i,d);else if(this._richRemotesCache.set(i,null),this._richRemotesCache.set(`disconnected|${i}`,d),!e?.includeDisconnected)return;return d}async getRemotes(s,e){if(s==null)return[];const{provider:t,path:i}=this.getProvider(s);return t.getRemotes(i,e)}async getRemotesWithProviders(s,e){if(s==null)return[];const t=this.container.git.getRepository(s);return(await(t!=null?t.getRemotes(e):this.getRemotes(s,e))).filter(o=>o.provider!=null)}getBestRepository(s,e){if(this.repositoryCount!==0){if(s!=null&&s instanceof r.Uri){const t=this.getRepository(s);if(t!=null)return t;s=void 0}return e=s??e??r.window.activeTextEditor,(e!=null?this.getRepository(e.document.uri):void 0)??this.highlander}}async getOrOpenRepository(s,e){const t=ke.Y.getCorrelationContext(),i=(0,A.XX)((0,A.M)(s)),o=this.getRepository(s);if(e=e??ve.DN.get("detectNestedRepositories"),e){if(this._visitedPaths.has(i))return o}else if(o!=null)return o;const d=(0,To.YW)(s);let w=this._pendingRepositories.get(d);if(w==null){async function S(){const{provider:X}=this.getProvider(s),re=await X.findRepositoryUri(s);if(this._visitedPaths.set(i),re==null)return;let he=this._repositories.get(re);if(he!=null)return he;const pe=this._repositories.getClosest(X.getAbsoluteUri(s,re)),_e=ve.DN.getAny(_.eq.AutoRepositoryDetection)??!0,Ie=_e!==!0&&_e!=="openEditors";return ke.Y.log(t,`Repository found in '${re.toString(!1)}'`),he=X.openRepository(pe?.folder,re,!1,void 0,Ie),this._repositories.add(he),this._pendingRepositories.delete(d),this.updateContext(),queueMicrotask(()=>this.fireRepositoriesChanged([he])),he}n(S,"findRepository"),w=S.call(this),this._pendingRepositories.set(d,w)}return w}async getOrOpenRepositoryForEditor(s){return s=s??r.window.activeTextEditor,s==null?this.highlander:this.getOrOpenRepository(s.document.uri)}getRepository(s){if(this.repositoryCount!==0&&s!=null)return typeof s=="string"?s?this._repositories.getClosest(this.getAbsoluteUri(s)):void 0:this._repositories.getClosest(s)}async getLocalInfoFromRemoteUri(s,e){var t;for(const i of this.openRepositories)for(const o of await i.getRemotes()){const d=await((t=o?.provider)==null?void 0:t.getLocalInfoFromRemoteUri(i,s,e));if(d!=null)return d}}async getStash(s){if(s==null)return;const{provider:e,path:t}=this.getProvider(s);return e.getStash(t)}async getStatusForFile(s,e){const{provider:t,path:i}=this.getProvider(s);return t.getStatusForFile(i,e)}async getStatusForFiles(s,e){const{provider:t,path:i}=this.getProvider(s);return t.getStatusForFiles(i,e)}async getStatusForRepo(s){if(s==null)return;const{provider:e,path:t}=this.getProvider(s);return e.getStatusForRepo(t)}async getTags(s,e){if(s==null)return{values:[]};const{provider:t,path:i}=this.getProvider(s);return t.getTags(i,e)}async getTreeEntryForRevision(s,e,t){if(s==null||!e)return;const{provider:i,path:o}=this.getProvider(s);return i.getTreeEntryForRevision(o,i.getRelativePath(e,o),t)}async getTreeForRevision(s,e){if(s==null)return[];const{provider:t,path:i}=this.getProvider(s);return t.getTreeForRevision(i,e)}getRevisionContent(s,e,t){const{provider:i,path:o}=this.getProvider(s);return i.getRevisionContent(o,e,t)}async hasBranchOrTag(s,e){if(s==null)return!1;const{provider:t,path:i}=this.getProvider(s);return t.hasBranchOrTag(i,e)}async hasCommitBeenPushed(s,e){if(s==null)return!1;const{provider:t,path:i}=this.getProvider(s);return t.hasCommitBeenPushed(i,e)}async hasRemotes(s){if(s==null)return!1;const e=this.getRepository(s);return e==null?!1:e.hasRemotes()}async hasTrackingBranch(s){if(s==null)return!1;const e=this.getRepository(s);return e==null?!1:e.hasUpstreamBranch()}isRepositoryForEditor(s,e){return e=e??r.window.activeTextEditor,e==null?!1:s===this.getRepository(e.document.uri)}isTrackable(s){if(!this.supportedSchemes.has(s.scheme))return!1;const{provider:e}=this.getProvider(s);return e.isTrackable(s)}async isTracked(s){if(!this.supportedSchemes.has(s.scheme))return!1;const{provider:e}=this.getProvider(s);return e.isTracked(s)}async getDiffTool(s){if(s==null)return;const{provider:e,path:t}=this.getProvider(s);return e.getDiffTool(t)}async openDiffTool(s,e,t){const{provider:i,path:o}=this.getProvider(s);return i.openDiffTool(o,e,t)}async openDirectoryCompare(s,e,t,i){const{provider:o,path:d}=this.getProvider(s);return o.openDirectoryCompare(d,e,t,i)}async resolveReference(s,e,t,i){if(!e||e===b.GitRevision.deletedOrMissing||t==null&&b.GitRevision.isSha(e)||t!=null&&b.GitRevision.isUncommitted(e))return e;const{provider:o,path:d}=this.getProvider(s);return o.resolveReference(d,e,t,i)}validateBranchOrTagName(s,e){const{provider:t,path:i}=this.getProvider(s);return t.validateBranchOrTagName(i,e)}async validateReference(s,e){if(e==null||e.length===0)return!1;if(e===b.GitRevision.deletedOrMissing||b.GitRevision.isUncommitted(e))return!0;const{provider:t,path:i}=this.getProvider(s);return t.validateReference(i,e)}stageFile(s,e){const{provider:t,path:i}=this.getProvider(s);return t.stageFile(i,e)}stageDirectory(s,e){const{provider:t,path:i}=this.getProvider(s);return t.stageDirectory(i,e)}unStageFile(s,e){const{provider:t,path:i}=this.getProvider(s);return t.unStageFile(i,e)}unStageDirectory(s,e){const{provider:t,path:i}=this.getProvider(s);return t.unStageDirectory(i,e)}stashApply(s,e,t){const{provider:i,path:o}=this.getProvider(s);return i.stashApply(o,e,t)}stashDelete(s,e,t){const{provider:i,path:o}=this.getProvider(s);return i.stashDelete(o,e,t)}stashSave(s,e,t,i){const{provider:o,path:d}=this.getProvider(s);return o.stashSave(d,e,t,i)}createWorktree(s,e,t){var i;const{provider:o,path:d}=this.getProvider(s);return Promise.resolve((i=o.createWorktree)==null?void 0:i.call(o,d,e,t))}async getWorktrees(s){var e;const{provider:t,path:i}=this.getProvider(s);return await((e=t.getWorktrees)==null?void 0:e.call(t,i))??[]}async getWorktreesDefaultUri(s){var e,t;const{provider:i,path:o}=this.getProvider(s);let d=await((e=i.getWorktreesDefaultUri)==null?void 0:e.call(i,o));return d!=null||(d=(t=this.getRepository(o))==null?void 0:t.uri,d!=null&&(d=r.Uri.joinPath(d,".."))),d}deleteWorktree(s,e,t){var i;const{provider:o,path:d}=this.getProvider(s);return Promise.resolve((i=o.deleteWorktree)==null?void 0:i.call(o,d,e,t))}async getOpenScmRepositories(){const s=await Promise.allSettled([...this._providers.values()].map(t=>t.getOpenScmRepositories()));return[...(0,li.VS)((0,li.hX)(s,t=>t.status==="fulfilled"),t=>t.value)]}async getOrOpenScmRepository(s){const{provider:e,path:t}=this.getProvider(s);return e.getOrOpenScmRepository(t)}static getEncoding(s){const e=ve.DN.getAny("files.encoding",s);return e!=null&&(0,Li.encodingExists)(e)?e:"utf8"}},"_GitProviderService");let _t=Fo;sr(_t,"previewFeatures"),wt([(0,p.fF)()],_t.prototype,"onSubscriptionChanged",1),wt([(0,p.fF)({args:{0:s=>`focused=${s.focused}`}})],_t.prototype,"onWindowStateChanged",1),wt([(0,p.fF)({args:{0:s=>`added=${s.added.length}, removed=${s.removed.length}`},singleLine:!0})],_t.prototype,"onWorkspaceFoldersChanged",1),wt([(0,p.cM)({args:{1:!1},singleLine:!0})],_t.prototype,"register",1),wt([(0,p.cM)({singleLine:!0})],_t.prototype,"registrationComplete",1),wt([(0,p.cM)({args:{0:s=>s.length}})],_t.prototype,"discoverRepositories",1),wt([(0,p.fF)()],_t.prototype,"accessCore",1),wt([(0,p.fF)()],_t.prototype,"visibilityCore",1),wt([(0,p.cM)()],_t.prototype,"getBestRevisionUri",1),wt([(0,p.cM)()],_t.prototype,"getRevisionUri",1),wt([(0,p.cM)()],_t.prototype,"getWorkingUri",1),wt([(0,p.cM)()],_t.prototype,"addRemote",1),wt([(0,p.cM)()],_t.prototype,"pruneRemote",1),wt([(0,p.cM)()],_t.prototype,"applyChangesToWorkingFile",1),wt([(0,p.cM)()],_t.prototype,"checkout",1),wt([(0,p.cM)()],_t.prototype,"resetCaches",1),wt([(0,p.cM)({args:{1:s=>s.length}})],_t.prototype,"excludeIgnoredUris",1),wt([(0,bi.H)(),(0,p.cM)()],_t.prototype,"fetch",1),wt([(0,bi.H)((s,e)=>`${s==null?"":s.map(t=>t.id).join(",")}|${JSON.stringify(e)}`),(0,p.cM)({args:{0:s=>s?.map(e=>e.name).join(", ")}})],_t.prototype,"fetchAll",1),wt([(0,bi.H)((s,e)=>`${s==null?"":s.map(t=>t.id).join(",")}|${JSON.stringify(e)}`),(0,p.cM)({args:{0:s=>s?.map(e=>e.name).join(", ")}})],_t.prototype,"pullAll",1),wt([(0,bi.H)(s=>`${s==null?"":s.map(e=>e.id).join(",")}`),(0,p.cM)({args:{0:s=>s?.map(e=>e.name).join(", ")}})],_t.prototype,"pushAll",1),wt([(0,p.cM)({args:{1:s=>s.join(",")}})],_t.prototype,"getAheadBehindCommitCount",1),wt([(0,p.cM)()],_t.prototype,"getBlame",1),wt([(0,p.cM)({args:{1:""}})],_t.prototype,"getBlameContents",1),wt([(0,p.cM)()],_t.prototype,"getBlameForLine",1),wt([(0,p.cM)({args:{2:""}})],_t.prototype,"getBlameForLineContents",1),wt([(0,p.cM)()],_t.prototype,"getBlameForRange",1),wt([(0,p.cM)({args:{2:""}})],_t.prototype,"getBlameForRangeContents",1),wt([(0,p.cM)({args:{0:""}})],_t.prototype,"getBlameRange",1),wt([(0,p.cM)()],_t.prototype,"getBranch",1),wt([(0,p.cM)({args:{0:s=>s.name}})],_t.prototype,"getBranchAheadRange",1),wt([(0,p.cM)({args:{1:!1}})],_t.prototype,"getBranches",1),wt([(0,p.cM)()],_t.prototype,"getBranchesAndTagsTipsFn",1),wt([(0,p.cM)()],_t.prototype,"getChangedFilesCount",1),wt([(0,p.cM)()],_t.prototype,"getCommit",1),wt([(0,p.cM)()],_t.prototype,"getCommitBranches",1),wt([(0,p.cM)()],_t.prototype,"getCommitCount",1),wt([(0,p.cM)()],_t.prototype,"getCommitForFile",1),wt([(0,p.cM)()],_t.prototype,"getOldestUnpushedRefForFile",1),wt([(0,p.cM)()],_t.prototype,"getContributors",1),wt([(0,bi.H)(),(0,p.cM)()],_t.prototype,"getCurrentUser",1),wt([(0,p.cM)()],_t.prototype,"getDefaultBranchName",1),wt([(0,p.cM)()],_t.prototype,"getDiffForFile",1),wt([(0,p.cM)({args:{1:""}})],_t.prototype,"getDiffForFileContents",1),wt([(0,p.cM)()],_t.prototype,"getDiffForLine",1),wt([(0,p.cM)()],_t.prototype,"getDiffStatus",1),wt([(0,p.cM)()],_t.prototype,"getFileStatusForCommit",1),wt([(0,p.fF)()],_t.prototype,"getLastFetchedTimestamp",1),wt([(0,p.cM)()],_t.prototype,"getLog",1),wt([(0,p.cM)()],_t.prototype,"getLogRefsOnly",1),wt([(0,p.cM)()],_t.prototype,"getLogForSearch",1),wt([(0,p.cM)()],_t.prototype,"getLogForFile",1),wt([(0,p.cM)()],_t.prototype,"getMergeBase",1),wt([(0,bi.H)(),(0,p.cM)()],_t.prototype,"getMergeStatus",1),wt([(0,bi.H)(),(0,p.cM)()],_t.prototype,"getRebaseStatus",1),wt([(0,p.cM)()],_t.prototype,"getNextComparisonUris",1),wt([(0,p.cM)()],_t.prototype,"getPreviousComparisonUris",1),wt([(0,p.cM)()],_t.prototype,"getPreviousComparisonUrisForLine",1),wt([(0,bi.H)((s,e,t)=>{const i=b.GitRemote.is(e)?e.provider:e;return`${s}${i!=null?`|${i.id}:${i.domain}/${i.path}`:""}|${JSON.stringify(t)}`}),(0,p.fF)({args:{1:s=>s.name}})],_t.prototype,"getPullRequestForBranch",1),wt([(0,bi.H)((s,e,t)=>{const i=b.GitRemote.is(e)?e.provider:e;return`${s}${i!=null?`|${i.id}:${i.domain}/${i.path}`:""}|${t?.timeout}`}),(0,p.fF)({args:{1:s=>s.name}})],_t.prototype,"getPullRequestForCommit",1),wt([(0,p.cM)()],_t.prototype,"getIncomingActivity",1),wt([(0,bi.H)((s,e)=>{var t;return`${s==null||typeof s=="string"?s:s instanceof r.Uri?s.toString():`${(t=s[0])==null?void 0:t.repoPath}|${s?.map(i=>i.id).join(",")??""}`}|${e?.includeDisconnected??!1}`}),(0,p.cM)({args:{0:s=>Array.isArray(s)?s.map(e=>e.name).join(","):s}})],_t.prototype,"getRichRemoteProvider",1),wt([(0,p.cM)({args:{1:!1}})],_t.prototype,"getRemotes",1),wt([(0,p.cM)()],_t.prototype,"getRemotesWithProviders",1),wt([(0,p.cM)({exit:s=>`returned ${s?.path}`})],_t.prototype,"getBestRepository",1),wt([(0,p.cM)({exit:s=>`returned ${s?.path}`})],_t.prototype,"getOrOpenRepository",1),wt([(0,p.cM)({args:{0:s=>s!=null?`TextEditor(${ke.Y.toLoggable(s.document.uri)})`:void 0}})],_t.prototype,"getOrOpenRepositoryForEditor",1),wt([(0,p.cM)({exit:s=>`returned ${s?.path}`})],_t.prototype,"getRepository",1),wt([(0,bi.H)(),(0,p.cM)()],_t.prototype,"getStash",1),wt([(0,p.cM)()],_t.prototype,"getStatusForFile",1),wt([(0,p.cM)()],_t.prototype,"getStatusForFiles",1),wt([(0,p.cM)()],_t.prototype,"getStatusForRepo",1),wt([(0,p.cM)({args:{1:!1}})],_t.prototype,"getTags",1),wt([(0,p.cM)()],_t.prototype,"getTreeEntryForRevision",1),wt([(0,p.cM)()],_t.prototype,"getTreeForRevision",1),wt([(0,bi.H)(),(0,p.cM)()],_t.prototype,"getRevisionContent",1),wt([(0,p.cM)({args:{1:!1}})],_t.prototype,"hasBranchOrTag",1),wt([(0,p.cM)({args:{1:!1}})],_t.prototype,"hasCommitBeenPushed",1),wt([(0,p.cM)()],_t.prototype,"hasRemotes",1),wt([(0,p.cM)()],_t.prototype,"hasTrackingBranch",1),wt([(0,p.cM)({args:{0:s=>s.uri.toString(!1),1:s=>s!=null?`TextEditor(${ke.Y.toLoggable(s.document.uri)})`:void 0}})],_t.prototype,"isRepositoryForEditor",1),wt([(0,p.cM)()],_t.prototype,"getDiffTool",1),wt([(0,p.cM)()],_t.prototype,"openDiffTool",1),wt([(0,p.cM)()],_t.prototype,"openDirectoryCompare",1),wt([(0,p.cM)()],_t.prototype,"resolveReference",1),wt([(0,p.cM)()],_t.prototype,"validateBranchOrTagName",1),wt([(0,p.cM)()],_t.prototype,"validateReference",1),wt([(0,p.cM)()],_t.prototype,"stageFile",1),wt([(0,p.cM)()],_t.prototype,"stageDirectory",1),wt([(0,p.cM)()],_t.prototype,"unStageFile",1),wt([(0,p.cM)()],_t.prototype,"unStageDirectory",1),wt([(0,p.cM)()],_t.prototype,"stashApply",1),wt([(0,p.cM)()],_t.prototype,"stashDelete",1),wt([(0,p.cM)({args:{2:s=>s?.length}})],_t.prototype,"stashSave",1),wt([(0,p.cM)()],_t.prototype,"createWorktree",1),wt([(0,p.cM)()],_t.prototype,"getWorktrees",1),wt([(0,p.cM)()],_t.prototype,"getWorktreesDefaultUri",1),wt([(0,p.cM)()],_t.prototype,"deleteWorktree",1),wt([(0,p.cM)()],_t.prototype,"getOpenScmRepositories",1),wt([(0,p.cM)()],_t.prototype,"getOrOpenScmRepository",1);var ci=v(2324),vn=v(7358),hs=v(3969),Br=v(1999),Rn=v(2378),on=v(9417);class hr extends Error{constructor(e){super("Unable to find git");this.original=e;var t;(t=Error.captureStackTrace)==null||t.call(Error,this,hr)}}n(hr,"UnableToFindGitError");class jr extends Error{constructor(e){super("Invalid Git configuration");this.original=e;var t;(t=Error.captureStackTrace)==null||t.call(Error,this,jr)}}n(jr,"InvalidGitConfigError");function Un(s){return s?.replace(/^git version /,"")}n(Un,"parseVersion");async function Zr(s){const e=new on.u(`findSpecificGit(${s})`,{logLevel:ke.i.Debug});let t;try{t=await pt(s,["--version"],"utf8")}catch(i){throw e.stop({message:` ${_.NE.Dot} Unable to find git`}),/bad config/i.test(i.message)?new jr(i):i}if(!s||s==="git"){const i=Xe(s,["--version"]).cmd;try{t=await pt(i,["--version"],"utf8")}catch(o){throw e.stop({message:` ${_.NE.Dot} Unable to find git`}),/bad config/i.test(o.message)?new jr(o):o}s=i}return e.stop({message:` ${_.NE.Dot} Found git @ ${s}`}),{path:s,version:Un(t.trim())}}n(Zr,"findSpecificGit");async function Wn(){try{const s=(await pt("which",["git"],"utf8")).trim();if(s!=="/usr/bin/git")return Zr(s);try{return await pt("xcode-select",["-p"],"utf8"),Zr(s)}catch(e){return e.code===2?Promise.reject(new hr(e)):Zr(s)}}catch(s){return Promise.reject(s instanceof jr||s instanceof hr?s:new hr(s))}}n(Wn,"findGitDarwin");function Ln(s){return s==null||s.length===0?Promise.reject(new hr):Zr((0,Xi.join)(s,"Git","cmd","git.exe"))}n(Ln,"findSystemGitWin32");function uo(){return Ln(process.env.ProgramW6432).then(null,()=>Ln(process.env["ProgramFiles(x86)"])).then(null,()=>Ln(process.env.ProgramFiles)).then(null,()=>Zr("git"))}n(uo,"findGitWin32");async function Gn(s,e=!0){try{if(s==null||typeof s=="string")return await Zr(s??"git");try{return(0,Yi.Yj)(...s.map(t=>Zr(t)))}catch(t){throw new hr(t)}}catch(t){if(!e)return Promise.reject(t instanceof jr||t instanceof hr?t:new hr(t));try{switch(process.platform){case"darwin":return await Wn();case"win32":return await uo();default:return Promise.reject(new hr)}}catch(i){return Promise.reject(i instanceof jr||i instanceof hr?i:new hr(i))}}}n(Gn,"findGitPath");var dr=Object.defineProperty,sn=Object.defineProperties,$r=Object.getOwnPropertyDescriptor,Ao=Object.getOwnPropertyDescriptors,Be=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,de=n((s,e,t)=>e in s?dr(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"localGitProvider_defNormalProp"),me=n((s,e)=>{for(var t in e||(e={}))a.call(e,t)&&de(s,t,e[t]);if(Be)for(var t of Be(e))P.call(e,t)&&de(s,t,e[t]);return s},"localGitProvider_spreadValues"),fe=n((s,e)=>sn(s,Ao(e)),"localGitProvider_spreadProps"),He=n((s,e)=>{var t={};for(var i in s)a.call(s,i)&&e.indexOf(i)<0&&(t[i]=s[i]);if(s!=null&&Be)for(var i of Be(s))e.indexOf(i)<0&&P.call(s,i)&&(t[i]=s[i]);return t},"localGitProvider_objRest"),ze=n((s,e,t,i)=>{for(var o=i>1?void 0:i?$r(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&dr(e,t,o),o},"localGitProvider_decorateClass"),Ye=n((s,e,t)=>(de(s,typeof e!="symbol"?e+"":e,t),t),"localGitProvider_publicField");const yt=Promise.resolve(void 0),zt=Object.freeze({values:[]}),mi=47,Ji={doesNotExist:/no such file or directory/i},Dr=/"/g,On=/(?<=^\/?)([a-zA-Z])(?=:\/)/,ec=/^user\.(name|email) (.*)$/gm,tc=/(.+)\s<(.+)>/,xo=["merge","pull"];class Tt{constructor(e,t){this.container=e,this.git=t,Ye(this,"descriptor",{id:_r.p.Git,name:"Git"}),Ye(this,"supportedSchemes",new Set([_.sN.File,_.sN.Git,_.sN.GitLens,_.sN.PRs])),Ye(this,"_onDidChangeRepository",new r.EventEmitter),Ye(this,"_onDidCloseRepository",new r.EventEmitter),Ye(this,"_onDidOpenRepository",new r.EventEmitter),Ye(this,"_branchesCache",new Map),Ye(this,"_contributorsCache",new Map),Ye(this,"_mergeStatusCache",new Map),Ye(this,"_rebaseStatusCache",new Map),Ye(this,"_repoInfoCache",new Map),Ye(this,"_stashesCache",new Map),Ye(this,"_tagsCache",new Map),Ye(this,"_trackedPaths",new no.bM),Ye(this,"_disposables",[]),Ye(this,"_gitLocator"),Ye(this,"_supportedFeatures",new Map),Ye(this,"_scmGitApi"),this.git.setLocator(this.ensureGit.bind(this))}get onDidChangeRepository(){return this._onDidChangeRepository.event}get onDidCloseRepository(){return this._onDidCloseRepository.event}get onDidOpenRepository(){return this._onDidOpenRepository.event}dispose(){r.Disposable.from(...this._disposables).dispose()}get useCaching(){return this.container.config.advanced.caching.enabled}onRepositoryChanged(e,t){t.changed(b.RepositoryChange.Config,b.RepositoryChangeComparisonMode.Any)&&this._repoInfoCache.delete(e.path),t.changed(b.RepositoryChange.Heads,b.RepositoryChange.Remotes,b.RepositoryChangeComparisonMode.Any)&&(this._branchesCache.delete(e.path),this._contributorsCache.delete(e.path),this._contributorsCache.delete(`stats|${e.path}`)),t.changed(b.RepositoryChange.Index,b.RepositoryChange.Unknown,b.RepositoryChangeComparisonMode.Any)&&this._trackedPaths.clear(),t.changed(b.RepositoryChange.Merge,b.RepositoryChangeComparisonMode.Any)&&this._mergeStatusCache.delete(e.path),t.changed(b.RepositoryChange.Rebase,b.RepositoryChangeComparisonMode.Any)&&this._rebaseStatusCache.delete(e.path),t.changed(b.RepositoryChange.Stash,b.RepositoryChangeComparisonMode.Any)&&this._stashesCache.delete(e.path),t.changed(b.RepositoryChange.Tags,b.RepositoryChangeComparisonMode.Any)&&this._tagsCache.delete(e.path),this._onDidChangeRepository.fire(t)}async ensureGit(){return this._gitLocator==null&&(this._gitLocator=this.findGit()),this._gitLocator}async findGit(){const e=ke.Y.getCorrelationContext();if(!ve.DN.getAny("git.enabled",null,!0))throw ke.Y.log(e,'Built-in Git is disabled ("git.enabled": false)'),Br.V.showGitDisabledErrorMessage(),new hr;const t=this.getScmGitApi();async function i(){const re=await t;if(re!=null){this._disposables.push(re.onDidCloseRepository(he=>this._onDidCloseRepository.fire({uri:he.rootUri})),re.onDidOpenRepository(he=>this._onDidOpenRepository.fire({uri:he.rootUri})));for(const he of re.repositories)this._onDidOpenRepository.fire({uri:he.rootUri})}}n(i,"subscribeToScmOpenCloseRepository"),i.call(this);const o=ve.DN.getAny("git.path")??this.container.storage.getWorkspace(Qi.sZ.GitPath,void 0),d=(0,B.a)(),w=Gn(o),S=t.then(re=>{const he=re?.git.path;if(!he)return w;if(o!=null){if(typeof o=="string"){if(he===o)return w}else if(o.includes(he))return w}return Gn(he,!1)}),X=await(0,Yi.Yj)(w,S);return setTimeout(()=>{this.container.storage.storeWorkspace(Qi.sZ.GitPath,X.path)},1e3),e!=null?e.exitDetails=` ${_.NE.Dot} Git found (${(0,M.qk)(d)} ms): ${X.version} @ ${X.path==="git"?"PATH":X.path}`:ke.Y.log(e,`Git found: ${X.version} @ ${X.path==="git"?"PATH":X.path} ${_.NE.Dot} ${(0,M.qk)(d)} ms`),(0,ji.qu)((0,ji.mL)(X.version),(0,ji.mL)("2.7.2"))===-1&&(ke.Y.log(e,`Git version (${X.version}) is outdated`),Br.V.showGitVersionUnsupportedErrorMessage(X.version,"2.7.2")),X}async discoverRepositories(e){if(e.scheme!==_.sN.File)return[];try{await this.ensureGit();const t=ve.DN.getAny(_.eq.AutoRepositoryDetection,e)??!0,i=await this.repositorySearch(r.workspace.getWorkspaceFolder(e),t===!1||t==="openEditors"?0:void 0);if(t===!0||t==="subFolders")for(const o of i)this.openScmRepository(o.uri);return i.length>0&&this._trackedPaths.clear(),i}catch(t){if(t instanceof jr)Br.V.showGitInvalidConfigErrorMessage();else if(t instanceof hr)Br.V.showGitMissingErrorMessage();else{const i=t?.message??"";i&&r.window.showErrorMessage(`Unable to initialize Git; ${i}`)}throw t}}openRepository(e,t,i,o,d){return d||this.openScmRepository(t),new b.Repository(this.container,this.onRepositoryChanged.bind(this),this.descriptor,e,t,i,o??!r.window.state.focused,d)}openRepositoryInitWatcher(){const e=r.workspace.createFileSystemWatcher("**/.git",!1,!0,!0);return{onDidCreate:e.onDidCreate,dispose:()=>e.dispose()}}async supports(e){let t=this._supportedFeatures.get(e);if(t!=null)return t;switch(e){case ro.A.Worktrees:return t=await this.git.isAtLeastVersion("2.17.0"),this._supportedFeatures.set(e,t),t;default:return!0}}async visibility(e){const t=await this.getRemotes(e);if(t.length===0)return _r.q.Local;const i=t.find(d=>d.name==="origin");if(i!=null)return this.getRemoteVisibility(i);const o=t.find(d=>d.name==="upstream");if(o!=null)return this.getRemoteVisibility(o);for await(const d of(0,Yi.Wx)(t.map(w=>this.getRemoteVisibility(w))))if(d.status==="fulfilled"&&d.value===_r.q.Public)return _r.q.Public;return _r.q.Private}async getRemoteVisibility(e){var t;switch((t=e.provider)==null?void 0:t.id){case"github":case"gitlab":case"bitbucket":case"azure-devops":case"gitea":case"gerrit":{const i=e.provider.url({type:Mn.JD.Repo});if(i==null)return _r.q.Private;try{if((await(0,Ir.h)(i,{method:"HEAD",agent:(0,Ir.N)()})).status===200)return _r.q.Public}catch{}return _r.q.Private}default:return _r.q.Private}}async repositorySearch(e,t){const i=ke.Y.getCorrelationContext();t=t??ve.DN.get("advanced.repositorySearchDepth",e.uri)??ve.DN.getAny(_.eq.RepositoryScanMaxDepth,e.uri,1),ke.Y.log(i,`searching (depth=${t})...`);const o=[],d=await this.findRepositoryUri(e.uri,!0);if(d!=null&&(ke.Y.log(i,`found root repository in '${d.fsPath}'`),o.push(this.openRepository(e,d,!0))),t<=0)return o;const w=me(me({},ve.DN.getAny("files.exclude",e.uri,{})),ve.DN.getAny("search.exclude",e.uri,{})),X=[...(0,li.DZ)(Object.entries(w),([pe,_e])=>{if(!!_e)return pe.startsWith("**/")?pe.substring(3):pe})].reduce((pe,_e)=>(pe.add(_e),pe),new Set);let re;try{re=await this.repositorySearchCore(e.uri.fsPath,t,X)}catch(pe){const _e=pe?.toString()??"";return Ji.doesNotExist.test(_e)?ke.Y.log(i,`FAILED${_e?` Error: ${_e}`:""}`):ke.Y.error(pe,i,"FAILED"),o}const he=d!=null?(0,A.AH)(d.fsPath):void 0;for(let pe of re){pe=(0,A.XX)(pe);const _e=(0,A.AH)(pe);if(zr.IJ){if(_e===he)continue}else if((0,M.qq)(_e,he))continue;ke.Y.log(i,`searching in '${pe}'...`),ke.Y.debug(i,`normalizedRepoPath=${_e}, rootPath=${he}`);const Ie=await this.findRepositoryUri(r.Uri.file(pe),!0);Ie!=null&&(ke.Y.log(i,`found repository in '${Ie.fsPath}'`),o.push(this.openRepository(e,Ie,!1)))}return o}repositorySearchCore(e,t,i,o=[]){const d=ke.Y.getCorrelationContext();return new Promise((w,S)=>{(0,qi.readdir)(e,{withFileTypes:!0},async(X,re)=>{if(X!=null){S(X);return}if(re.length===0){w(o);return}t--;let he;for(he of re)if(he.name===".git")o.push((0,Xi.resolve)(e,he.name));else if(t>=0&&he.isDirectory()&&!i.has(he.name))try{await this.repositorySearchCore((0,Xi.resolve)(e,he.name),t,i,o)}catch(pe){ke.Y.error(pe,d,"FAILED")}w(o)})})}canHandlePathOrUri(e,t){if(!!this.supportedSchemes.has(e))return(0,A.M)(t)}getAbsoluteUri(e,t){if(typeof t=="string")if((0,A.tE)(t))t=r.Uri.parse(t,!0);else{if(!(0,A.YP)(t))throw r.window.showErrorMessage(`Unable to get absolute uri between ${typeof e=="string"?e:e.toString(!1)} and ${t}; Base path '${t}' must be an absolute path`),new Error(`Base path '${t}' must be an absolute path`);t=r.Uri.file(t)}if(typeof e=="string"&&!(0,A.YP)(e))return r.Uri.joinPath(t,(0,A.AH)(e));const i=this.getRelativePath(e,t);return r.Uri.joinPath(t,i)}async getBestRevisionUri(e,t,i){if(i!==b.GitRevision.deletedOrMissing){if(!i||b.GitRevision.isUncommitted(i)&&!b.GitRevision.isUncommittedStaged(i)){let o=await this.git.ls_files(e,t);return o!=null?this.getAbsoluteUri(t,e):(o=await this.git.ls_files(e,t,{untracked:!0}),o!=null?this.getAbsoluteUri(t,e):void 0)}return b.GitRevision.isUncommittedStaged(i)?this.getScmGitUri(t,e):this.getRevisionUri(e,t,i)}}getRelativePath(e,t){if(typeof t=="string")if((0,A.tE)(t))t=r.Uri.parse(t,!0);else{if(!(0,A.YP)(t))throw r.window.showErrorMessage(`Unable to get relative path between ${typeof e=="string"?e:e.toString(!1)} and ${t}; Base path '${t}' must be an absolute path`),new Error(`Base path '${t}' must be an absolute path`);t=r.Uri.file(t)}if(typeof e=="string")if((0,A.tE)(e))e=r.Uri.parse(e,!0);else{if(!(0,A.YP)(e))return(0,A.AH)(e);e=r.Uri.file(e)}const i=(0,A.Gf)(t.fsPath,e.fsPath);return(0,A.AH)(i)}getRevisionUri(e,t,i){if(b.GitRevision.isUncommitted(i))return b.GitRevision.isUncommittedStaged(i)?this.getScmGitUri(t,e):this.getAbsoluteUri(t,e);t=(0,A.AH)(this.getAbsoluteUri(t,e).fsPath),t.charCodeAt(0)!==mi&&(t=`/${t}`);const o={ref:i,repoPath:(0,A.AH)(e)};return r.Uri.from({scheme:_.sN.GitLens,authority:(0,ci.Tg)(o),path:t,query:i?JSON.stringify({ref:b.GitRevision.shorten(i)}):void 0})}async getWorkingUri(e,t){let i=this.getRelativePath(t,e),o,d;do{if(o=await this.git.ls_files(e,i),o!=null){i=(0,M.pW)(o,` `)[0];break}if(d=await this.git.log__file_recent(e,i,{ordering:this.container.config.advanced.commitOrdering,similarityThreshold:this.container.config.advanced.similarityThreshold}),d==null)return;if(o=await this.git.log__file(e,".",d,{argsOrFormat:ut.simpleFormat,fileMode:"simple",filters:["R","C","D"],limit:1,ordering:this.container.config.advanced.commitOrdering}),o==null||o.length===0)break;const[w,S,X]=ut.parseSimpleRenamed(o,i);if(X==="D"&&S!=null)return;if(w==null||S==null)break;i=S}while(!0);return t=this.getAbsoluteUri(i,e),await Ot(t.fsPath)?t:void 0}async addRemote(e,t,i){await this.git.remote__add(e,t,i)}async pruneRemote(e,t){await this.git.remote__prune(e,t)}async applyChangesToWorkingFile(e,t,i){const o=ke.Y.getCorrelationContext();if(t=t??e.sha,t==null||e.repoPath==null)return;i==null&&(i=t,t=`${t}^`);const[d,w]=(0,A.uo)(e,e.repoPath);let S;try{S=await this.git.diff(w,d,t,i),await this.git.apply(w,S)}catch(X){const re=X?.toString()??"";if(S&&/patch does not apply/i.test(re)){const he=await r.window.showWarningMessage("Unable to apply changes cleanly. Retry and allow conflicts?",{title:"Yes"},{title:"No",isCloseAffordance:!0});if(he==null||he.title!=="Yes")return;if(he.title==="Yes")try{await this.git.apply(w,S,{allowConflicts:!0});return}catch(pe){X=pe}}ke.Y.error(X,o),Br.V.showGenericErrorMessage("Unable to apply changes")}}async checkout(e,t,i){const o=ke.Y.getCorrelationContext();try{await this.git.checkout(e,t,i)}catch(d){const w=d?.toString()??"";if(/overwritten by checkout/i.test(w)){Br.V.showGenericErrorMessage(`Unable to checkout '${t}'. Please commit or stash your changes before switching branches`);return}ke.Y.error(d,o),Br.V.showGenericErrorMessage(`Unable to checkout '${t}'`)}}resetCaches(...e){(e.length===0||e.includes("branches"))&&this._branchesCache.clear(),(e.length===0||e.includes("contributors"))&&this._contributorsCache.clear(),(e.length===0||e.includes("stashes"))&&this._stashesCache.clear(),(e.length===0||e.includes("status"))&&(this._mergeStatusCache.clear(),this._rebaseStatusCache.clear()),(e.length===0||e.includes("tags"))&&this._tagsCache.clear(),e.length===0&&(this._trackedPaths.clear(),this._repoInfoCache.clear())}async excludeIgnoredUris(e,t){const i=new Map(t.map(w=>[(0,A.AH)(w.fsPath),w])),o=await this.git.check_ignore(e,...i.keys());if(o==null)return t;const d=o.split("\0").filter(w=>Boolean(w));if(d.length===0)return t;for(const w of d)i.delete(w);return[...i.values()]}async fetch(e,t){const i=t??{},{branch:o}=i,d=He(i,["branch"]);if(b.GitReference.isBranch(o)){const w=this.container.git.getRepository(e),S=await w?.getBranch(o?.name);return!S?.remote&&S?.upstream==null?void 0:this.git.fetch(e,{branch:S.getNameWithoutRemote(),remote:S.getRemoteName(),upstream:S.getTrackingWithoutRemote(),pull:t?.pull})}return this.git.fetch(e,d)}async findRepositoryUri(e,t){const i=ke.Y.getCorrelationContext();let o;try{if(!t){const d=await r.workspace.fs.stat(e);e=d?.type===r.FileType.Directory?e:r.Uri.file((0,A.XX)(e.fsPath))}if(o=await this.git.rev_parse__show_toplevel(e.fsPath),!o)return;if(zr.ED){const d=r.Uri.file(o);if(d.authority.length!==0&&e.authority.length===0){const w=On.exec(e.path);if(w!=null){const[,S]=w;try{const X=await new Promise(re=>qi.realpath.native(`${S}:\\`,{encoding:"utf8"},(he,pe)=>re(he!=null?void 0:pe)));if(X!=null)return o=(0,A.AH)(d.fsPath.replace(X,`${S.toLowerCase()}:${X.endsWith("\\")?"\\":""}`)),r.Uri.file(o)}catch{}}return r.Uri.file((0,A.AH)(e.fsPath))}return d}return o=await new Promise(d=>{(0,qi.realpath)(e.fsPath,{encoding:"utf8"},(w,S)=>{if(w!=null){ke.Y.debug(i,`fs.realpath failed; repoPath=${o}`),d(o);return}if((0,M.qq)(e.fsPath,S)){ke.Y.debug(i,`No symlink detected; repoPath=${o}`),d(o);return}const X=(0,A.AH)(S);o=o.replace(X,e.fsPath),ke.Y.debug(i,`Symlink detected; repoPath=${o}, path=${e.fsPath}, resolvedPath=${S}`),d(o)})}),o?r.Uri.file(o):void 0}catch(d){ke.Y.error(d,i);return}}getAheadBehindCommitCount(e,t){return this.git.rev_list__left_right(e,t)}async getBlame(e,t){const i=ke.Y.getCorrelationContext();if(t?.isDirty)return this.getBlameContents(e,t.getText());let o="blame";e.sha!=null&&(o+=`:${e.sha}`);const d=await this.container.tracker.getOrAdd(e);if(this.useCaching){if(d.state!=null){const S=d.state.getBlame(o);if(S!=null)return ke.Y.debug(i,`Cache hit: '${o}'`),S.item}ke.Y.debug(i,`Cache miss: '${o}'`),d.state==null&&(d.state=new Rn.p2(d.key))}const w=this.getBlameCore(e,d,o,i);if(d.state!=null){ke.Y.debug(i,`Cache add: '${o}'`);const S={item:w};d.state.setBlame(o,S)}return w}async getBlameCore(e,t,i,o){const d=await this.isTrackedPrivate(e);if(d==null)return ke.Y.log(o,`Skipping blame; '${e.fsPath}' is not tracked`),yt;const[w,S]=d;try{const X=await this.git.blame(S,w,e.sha,{args:this.container.config.advanced.blame.customArguments,ignoreWhitespace:this.container.config.blame.ignoreWhitespace});return y.parse(this.container,X,S,await this.getCurrentUser(S))}catch(X){if(t.state!=null){const re=X?.toString()??"";ke.Y.debug(o,`Cache replace (with empty promise): '${i}'`);const he={item:yt,errorMessage:re};return t.state.setBlame(i,he),t.setBlameFailure(),yt}return}}async getBlameContents(e,t){const i=ke.Y.getCorrelationContext(),o=`blame:${(0,M.FB)(t)}`,d=await this.container.tracker.getOrAdd(e);if(this.useCaching){if(d.state!=null){const S=d.state.getBlame(o);if(S!=null)return ke.Y.debug(i,`Cache hit: ${o}`),S.item}ke.Y.debug(i,`Cache miss: ${o}`),d.state==null&&(d.state=new Rn.p2(d.key))}const w=this.getBlameContentsCore(e,t,d,o,i);if(d.state!=null){ke.Y.debug(i,`Cache add: '${o}'`);const S={item:w};d.state.setBlame(o,S)}return w}async getBlameContentsCore(e,t,i,o,d){const w=await this.isTrackedPrivate(e);if(w==null)return ke.Y.log(d,`Skipping blame; '${e.fsPath}' is not tracked`),yt;const[S,X]=w;try{const re=await this.git.blame__contents(X,S,t,{args:this.container.config.advanced.blame.customArguments,correlationKey:`:${o}`,ignoreWhitespace:this.container.config.blame.ignoreWhitespace});return y.parse(this.container,re,X,await this.getCurrentUser(X))}catch(re){if(i.state!=null){const he=re?.toString()??"";ke.Y.debug(d,`Cache replace (with empty promise): '${o}'`);const pe={item:yt,errorMessage:he};return i.state.setBlame(o,pe),i.setBlameFailure(),yt}return}}async getBlameForLine(e,t,i,o){if(i?.isDirty)return this.getBlameForLineContents(e,t,i.getText(),o);if(!o?.forceSingleLine&&this.useCaching){const X=await this.getBlame(e);if(X==null)return;let re=X.lines[t];if(re==null){if(X.lines.length!==t)return;re=X.lines[t-1]}const he=X.commits.get(re.sha);if(he==null)return;const pe=X.authors.get(he.author.name);return{author:fe(me({},pe),{lineCount:he.lines.length}),commit:he,line:re}}const d=t+1,[w,S]=(0,A.uo)(e,e.repoPath);try{const X=await this.git.blame(S,w,e.sha,{args:this.container.config.advanced.blame.customArguments,ignoreWhitespace:this.container.config.blame.ignoreWhitespace,startLine:d,endLine:d}),re=y.parse(this.container,X,S,await this.getCurrentUser(S));return re==null?void 0:{author:(0,li.Ps)(re.authors.values()),commit:(0,li.Ps)(re.commits.values()),line:re.lines[t]}}catch{return}}async getBlameForLineContents(e,t,i,o){if(!o?.forceSingleLine&&this.useCaching){const X=await this.getBlameContents(e,i);if(X==null)return;let re=X.lines[t];if(re==null){if(X.lines.length!==t)return;re=X.lines[t-1]}const he=X.commits.get(re.sha);if(he==null)return;const pe=X.authors.get(he.author.name);return{author:fe(me({},pe),{lineCount:he.lines.length}),commit:he,line:re}}const d=t+1,[w,S]=(0,A.uo)(e,e.repoPath);try{const X=await this.git.blame__contents(S,w,i,{args:this.container.config.advanced.blame.customArguments,ignoreWhitespace:this.container.config.blame.ignoreWhitespace,startLine:d,endLine:d}),re=y.parse(this.container,X,S,await this.getCurrentUser(S));return re==null?void 0:{author:(0,li.Ps)(re.authors.values()),commit:(0,li.Ps)(re.commits.values()),line:re.lines[t]}}catch{return}}async getBlameForRange(e,t){const i=await this.getBlame(e);if(i!=null)return this.getBlameRange(i,e,t)}async getBlameForRangeContents(e,t,i){const o=await this.getBlameContents(e,i);if(o!=null)return this.getBlameRange(o,e,t)}getBlameRange(e,t,i){if(e.lines.length===0)return me({allLines:e.lines},e);if(i.start.line===0&&i.end.line===e.lines.length-1)return me({allLines:e.lines},e);const o=e.lines.slice(i.start.line,i.end.line+1),d=new Set(o.map(pe=>pe.sha)),w=i.start.line+1,S=i.end.line+1,X=new Map,re=new Map;for(const pe of e.commits.values()){if(!d.has(pe.sha))continue;const _e=pe.with({lines:pe.lines.filter(Ve=>Ve.line>=w&&Ve.line<=S)});re.set(pe.sha,_e);let Ie=X.get(_e.author.name);Ie==null&&(Ie={name:_e.author.name,lineCount:0},X.set(Ie.name,Ie)),Ie.lineCount+=_e.lines.length}const he=new Map([...X.entries()].sort((pe,_e)=>_e[1].lineCount-pe[1].lineCount));return{repoPath:t.repoPath,authors:he,commits:re,lines:o,allLines:e.lines}}async getBranch(e){let{values:[t]}=await this.getBranches(e,{filter:w=>w.current});if(t!=null)return t;const i=await this.git.rev_parse__currentBranch(e,this.container.config.advanced.commitOrdering);if(i==null)return;const[o,d]=i[0].split(` `);if(b.GitBranch.isDetached(o)){const[w,S]=await Promise.all([this.getRebaseStatus(e),this.git.log__recent_committerdate(e,this.container.config.advanced.commitOrdering)]);t=new b.GitBranch(e,w?.incoming.name??o,!1,!0,S!=null?new Date(Number(S)*1e3):void 0,i[1],d?{name:d,missing:!1}:void 0,void 0,void 0,void 0,w!=null)}return t}async getBranches(e,t){if(e==null)return zt;let i=this.useCaching?this._branchesCache.get(e):void 0;if(i==null){async function d(){try{const w=await this.git.for_each_ref__branch(e,{all:!0});if(w==null||w.length===0){let S;const X=await this.git.rev_parse__currentBranch(e,this.container.config.advanced.commitOrdering);if(X!=null){const[re,he]=X[0].split(` `),[pe,_e]=await Promise.all([b.GitBranch.isDetached(re)?this.getRebaseStatus(e):void 0,this.git.log__recent_committerdate(e,this.container.config.advanced.commitOrdering)]);S=new b.GitBranch(e,pe?.incoming.name??re,!1,!0,_e!=null?new Date(Number(_e)*1e3):void 0,X[1],{name:he,missing:!1},void 0,void 0,void 0,pe!=null)}return S!=null?{values:[S]}:zt}return{values:N.parse(w,e)}}catch{return this._branchesCache.delete(e),zt}}n(d,"load"),i=d.call(this),this.useCaching&&t?.cursor==null&&this._branchesCache.set(e,i)}let o=await i;return t?.filter!=null&&(o=fe(me({},o),{values:o.values.filter(t.filter)})),t?.sort&&b.GitBranch.sort(o.values,typeof t.sort=="boolean"?void 0:t.sort),o}async getChangedFilesCount(e,t){const i=await this.git.diff__shortstat(e,t);if(!!i)return j.n.parseShortStat(i)}async getCommit(e,t){const i=await this.getLog(e,{limit:2,ref:t});if(i!=null)return i.commits.get(t)??(0,li.Ps)(i.commits.values())}async getCommitBranches(e,t,i){if(i?.branch){const d=await this.git.branch__containsOrPointsAt(e,t,{mode:"contains",name:i.branch});return d?[d?.trim()]:[]}const o=await this.git.branch__containsOrPointsAt(e,t,i);return o?(0,$.DZ)(o.split(` `),d=>d.trim()||void 0):[]}getCommitCount(e,t){return this.git.rev_list__count(e,t)}async getCommitForFile(e,t,i){const o=ke.Y.getCorrelationContext(),[d,w]=(0,A.uo)(t,e);try{const S=await this.getLogForFile(w,d,{limit:2,ref:i?.ref,range:i?.range});if(S==null)return;let X;return i?.ref&&S.commits.get(i.ref)==null&&!i?.firstIfNotFound&&(b.GitRevision.isSha(i.ref)||b.GitRevision.isUncommitted(i.ref))?void 0:X??(0,li.Ps)(S.commits.values())}catch(S){ke.Y.error(S,o);return}}async getOldestUnpushedRefForFile(e,t){const[i,o]=(0,A.uo)(t,e),d=await this.git.log__file(o,i,"@{push}..",{argsOrFormat:["-z","--format=%H"],fileMode:"none",ordering:this.container.config.advanced.commitOrdering,renames:!0});if(!d)return;const w=d.lastIndexOf("\0",d.length-2);return w===-1?void 0:d.slice(w+1,d.length-2)}async getContributors(e,t){if(e==null)return[];const i=t?.stats?`stats|${e}`:e;let o=this.useCaching?this._contributorsCache.get(i):void 0;if(o==null){async function d(){try{e=(0,A.AH)(e);const w=await this.getCurrentUser(e),S=ut.create({sha:"%H",author:"%aN",email:"%aE",date:"%at"},t?.stats?{additionalArgs:["--shortstat","--use-mailmap"],parseEntry:(pe,_e)=>{const Ie=pe.next().value,Ve=ut.shortstatRegex.exec(Ie);if(Ve?.groups!=null){const{files:dt,additions:et,deletions:bt}=Ve.groups;_e.stats={files:Number(dt||0),additions:Number(et||0),deletions:Number(bt||0)}}return _e},prefix:"%x00",fieldSuffix:"%x00",skip:1}:void 0),X=await this.git.log(e,t?.ref,{all:t?.all,argsOrFormat:S.arguments}),re=new Map,he=S.parse(X);for(const pe of he){const _e=`${pe.author}|${pe.email}`;let Ie=re.get(_e);if(Ie==null)Ie=new b.GitContributor(e,pe.author,pe.email,1,new Date(Number(pe.date)*1e3),(0,b.isUserMatch)(w,pe.author,pe.email),pe.stats),re.set(_e,Ie);else{Ie.count++;const Ve=new Date(Number(pe.date)*1e3);Ve>Ie.date&&(Ie.date=Ve)}}return[...re.values()]}catch{return this._contributorsCache.delete(i),[]}}n(d,"load"),o=d.call(this),this.useCaching&&this._contributorsCache.set(i,o)}return o}async getCurrentUser(e){var t;if(!e)return;const i=ke.Y.getCorrelationContext(),o=this._repoInfoCache.get(e);let d=o?.user;if(d!=null)return d;if(d!==null){d={name:void 0,email:void 0};try{const w=await this.git.config__get_regex("^user\\.",e,{local:!0});if(w){let re,he,pe;do{if(pe=ec.exec(w),pe==null)break;[,re,he]=pe,d[re]=` ${he}`.substr(1)}while(!0)}else{if(d.name=process.env.GIT_AUTHOR_NAME||process.env.GIT_COMMITTER_NAME||((t=(0,io.userInfo)())==null?void 0:t.username)||void 0,!d.name){this._repoInfoCache.set(e,fe(me({},o),{user:null}));return}d.email=process.env.GIT_AUTHOR_EMAIL||process.env.GIT_COMMITTER_EMAIL||process.env.EMAIL||`${d.name}@${(0,io.hostname)()}`}const S=`${d.name} <${d.email}>`,X=await this.git.check_mailmap(e,S);if(X!=null&&X.length!==0&&S!==X){const re=tc.exec(X);re!=null&&([,d.name,d.email]=re)}return this._repoInfoCache.set(e,fe(me({},o),{user:d})),d}catch(w){ke.Y.error(w,i),this._repoInfoCache.set(e,fe(me({},o),{user:null}));return}}}async getDefaultBranchName(e,t){if(e!=null){if(!t)try{const i=await this.git.symbolic_ref(e,"HEAD");if(i!=null)return i.trim()}catch{}t=t??"origin";try{const i=await this.git.ls_remote__HEAD(e,t);if(i==null)return;const o=/ref:\s(\S+)\s+HEAD/m.exec(i);if(o==null)return;const[,d]=o;return d.substr(11)}catch{return}}}async getDiffForFile(e,t,i){const o=ke.Y.getCorrelationContext();let d="diff";t!=null&&(d+=`:${t}`),i!=null&&(d+=`:${i}`);const w=await this.container.tracker.getOrAdd(e);if(this.useCaching){if(w.state!=null){const X=w.state.getDiff(d);if(X!=null)return ke.Y.debug(o,`Cache hit: '${d}'`),X.item}ke.Y.debug(o,`Cache miss: '${d}'`),w.state==null&&(w.state=new Rn.p2(w.key))}const S=this.getDiffForFileCore(e.repoPath,e.fsPath,t,i,{encoding:_t.getEncoding(e)},w,d,o);if(w.state!=null){ke.Y.debug(o,`Cache add: '${d}'`);const X={item:S};w.state.setDiff(d,X)}return S}async getDiffForFileCore(e,t,i,o,d,w,S,X){const[re,he]=(0,A.uo)(t,e);try{const pe=await this.git.diff(he,re,i,o,fe(me({},d),{filters:["M"],linesOfContext:0,renames:!0,similarityThreshold:this.container.config.advanced.similarityThreshold}));return j.n.parse(pe)}catch(pe){if(w.state!=null){const _e=pe?.toString()??"";ke.Y.debug(X,`Cache replace (with empty promise): '${S}'`);const Ie={item:yt,errorMessage:_e};return w.state.setDiff(S,Ie),yt}return}}async getDiffForFileContents(e,t,i){const o=ke.Y.getCorrelationContext(),d=`diff:${(0,M.FB)(i)}`,w=await this.container.tracker.getOrAdd(e);if(this.useCaching){if(w.state!=null){const X=w.state.getDiff(d);if(X!=null)return ke.Y.debug(o,`Cache hit: ${d}`),X.item}ke.Y.debug(o,`Cache miss: ${d}`),w.state==null&&(w.state=new Rn.p2(w.key))}const S=this.getDiffForFileContentsCore(e.repoPath,e.fsPath,t,i,{encoding:_t.getEncoding(e)},w,d,o);if(w.state!=null){ke.Y.debug(o,`Cache add: '${d}'`);const X={item:S};w.state.setDiff(d,X)}return S}async getDiffForFileContentsCore(e,t,i,o,d,w,S,X){const[re,he]=(0,A.uo)(t,e);try{const pe=await this.git.diff__contents(he,re,i,o,fe(me({},d),{filters:["M"],similarityThreshold:this.container.config.advanced.similarityThreshold}));return j.n.parse(pe)}catch(pe){if(w.state!=null){const _e=pe?.toString()??"";ke.Y.debug(X,`Cache replace (with empty promise): '${S}'`);const Ie={item:yt,errorMessage:_e};return w.state.setDiff(S,Ie),yt}return}}async getDiffForLine(e,t,i,o){try{const d=await this.getDiffForFile(e,i,o);if(d==null)return;const w=t+1,S=d.hunks.find(X=>X.current.position.start<=w&&X.current.position.end>=w);return S?.lines[w-Math.min(S.current.position.start,S.previous.position.start)]}catch{return}}async getDiffStatus(e,t,i,o){try{const d=await this.git.diff__name_status(e,t,i,me({similarityThreshold:this.container.config.advanced.similarityThreshold},o)),w=j.n.parseNameStatus(d,e);return w==null||w.length===0?void 0:w}catch{return}}async getFileStatusForCommit(e,t,i){if(i===b.GitRevision.deletedOrMissing||b.GitRevision.isUncommitted(i))return;const[o,d]=(0,A.uo)(t,e),w=await this.git.show__name_status(d,o,i);if(!w)return;const S=j.n.parseNameStatus(w,e);if(!(S==null||S.length===0))return S[0]}async getLastFetchedTimestamp(e){try{const t=await this.getGitDir(e),i=await r.workspace.fs.stat(this.container.git.getAbsoluteUri(`${t}/FETCH_HEAD`,e));if(i.size>0)return i.mtime}catch{}}async getGitDir(e){const t=this._repoInfoCache.get(e);if(t?.gitDir!=null)return t.gitDir;const i=(0,A.AH)(await this.git.rev_parse__git_dir(e)||".git");return this._repoInfoCache.set(e,fe(me({},t),{gitDir:i})),i}async getLog(e,t){const i=ke.Y.getCorrelationContext(),o=t?.limit??this.container.config.advanced.maxListItems??0;try{const d=await this.git.log(e,t?.ref,fe(me({},t),{limit:o,merges:t?.merges==null?!0:t.merges,ordering:t?.ordering??this.container.config.advanced.commitOrdering,similarityThreshold:this.container.config.advanced.similarityThreshold})),w=ut.parse(this.container,d,it.Log,e,void 0,t?.ref,await this.getCurrentUser(e),o,!1,void 0);return w!=null&&(w.query=S=>this.getLog(e,fe(me({},t),{limit:S})),w.hasMore&&(w.more=this.getLogMoreFn(w,t))),w}catch(d){ke.Y.error(d,i);return}}async getLogRefsOnly(e,t){const i=ke.Y.getCorrelationContext(),o=t?.limit??this.container.config.advanced.maxListItems??0;try{const d=ut.createSingle("%H"),w=await this.git.log(e,t?.ref,{authors:t?.authors,argsOrFormat:d.arguments,limit:o,merges:t?.merges==null?!0:t.merges,similarityThreshold:this.container.config.advanced.similarityThreshold,since:t?.since,ordering:t?.ordering??this.container.config.advanced.commitOrdering});return new Set(d.parse(w))}catch(d){ke.Y.error(d,i);return}}getLogMoreFn(e,t){return async i=>{var o;const d=i!=null&&typeof i=="object"?i.until:void 0;let w=typeof i=="number"?i:void 0;if(d&&(0,li.G)(e.commits.values(),pe=>pe.ref===d))return e;if(w=w??this.container.config.advanced.maxSearchItems??0,b.GitRevision.isRange(e.sha)){const pe=await this.getLog(e.repoPath,fe(me({},t),{limit:w===0?0:(t?.limit??0)+w}));return pe??fe(me({},e),{hasMore:!1})}const S=(o=(0,li.Z$)(e.commits.values()))==null?void 0:o.ref,X=await this.getLog(e.repoPath,fe(me({},t),{limit:d==null?w:0,ref:d==null?`${S}^`:`${d}^..${S}^`}));if(X==null)return fe(me({},e),{hasMore:!1});const re=new Map([...e.commits,...X.commits]),he={repoPath:e.repoPath,commits:re,sha:e.sha,range:void 0,count:re.size,limit:d==null?(e.limit??0)+w:void 0,hasMore:d==null?X.hasMore:!0,query:pe=>this.getLog(e.repoPath,fe(me({},t),{limit:pe}))};return he.more=this.getLogMoreFn(he,t),he}}async getLogForSearch(e,t,i){t=me({matchAll:!1,matchCase:!1,matchRegex:!0},t);try{const o=i?.limit??this.container.config.advanced.maxSearchItems??0,d=this.container.config.advanced.similarityThreshold,w=hs.n.parseSearchOperations(t.pattern),S=new Set,X=[];let re=!1,he,pe=w.get("commit:");if(pe!=null){re=!0,S.add("-m"),S.add(`-M${d==null?"":`${d}%`}`);for(const dt of pe)S.add(dt.replace(Dr,""))}else{S.add(`-M${d==null?"":`${d}%`}`),S.add("--all"),S.add("--full-history"),S.add(t.matchRegex?"--extended-regexp":"--fixed-strings"),t.matchRegex&&!t.matchCase&&S.add("--regexp-ignore-case");for([he,pe]of w.entries())switch(he){case"message:":S.add("-m"),t.matchAll&&S.add("--all-match");for(const dt of pe)S.add(`--grep=${dt.replace(Dr,t.matchRegex?"\\b":"")}`);break;case"author:":S.add("-m");for(const dt of pe)S.add(`--author=${dt.replace(Dr,t.matchRegex?"\\b":"")}`);break;case"change:":for(const dt of pe)S.add(t.matchRegex?`-G${dt.replace(Dr,"")}`:`-S${dt.replace(Dr,"")}`);break;case"file:":for(const dt of pe)X.push(dt.replace(Dr,""));break}}const _e=[...S.values(),"--"];X.length!==0&&_e.push(...X);const Ie=await this.git.log__search(e,_e,fe(me({ordering:this.container.config.advanced.commitOrdering},i),{limit:o,useShow:re})),Ve=ut.parse(this.container,Ie,it.Log,e,void 0,void 0,await this.getCurrentUser(e),o,!1,void 0);return Ve!=null&&(Ve.query=dt=>this.getLogForSearch(e,t,fe(me({},i),{limit:dt})),Ve.hasMore&&(Ve.more=this.getLogForSearchMoreFn(Ve,t,i))),Ve}catch{return}}getLogForSearchMoreFn(e,t,i){return async o=>{o=o??this.container.config.advanced.maxSearchItems??0;const d=await this.getLogForSearch(e.repoPath,t,fe(me({},i),{limit:o,skip:e.count}));if(d==null)return fe(me({},e),{hasMore:!1});const w=new Map([...e.commits,...d.commits]),S={repoPath:e.repoPath,commits:w,sha:e.sha,range:e.range,count:w.size,limit:(e.limit??0)+o,hasMore:d.hasMore,query:X=>this.getLogForSearch(e.repoPath,t,fe(me({},i),{limit:X}))};return S.more=this.getLogForSearchMoreFn(S,t,i),S}}async getLogForFile(e,t,i){if(e==null)return;const o=ke.Y.getCorrelationContext(),d=this.getRelativePath(t,e);if(e!=null&&e===d)throw new Error(`File name cannot match the repository path; path=${d}`);i=me({reverse:!1},i),i.renames==null&&(i.renames=this.container.config.advanced.fileHistoryFollowsRenames);let w="log";i.ref!=null&&(w+=`:${i.ref}`),i.all==null&&(i.all=this.container.config.advanced.fileHistoryShowAllBranches),i.all&&(w+=":all"),i.limit=i.limit??this.container.config.advanced.maxListItems??0,i.limit&&(w+=`:n${i.limit}`),i.renames&&(w+=":follow"),i.reverse&&(w+=":reverse"),i.since&&(w+=`:since=${i.since}`),i.skip&&(w+=`:skip${i.skip}`);const S=await this.container.tracker.getOrAdd(ci.YY.fromFile(d,e,i.ref));if(!i.force&&this.useCaching&&i.range==null){if(S.state!=null){const re=S.state.getLog(w);if(re!=null)return ke.Y.debug(o,`Cache hit: '${w}'`),re.item;if(i.ref!=null||i.limit!=null){const he=S.state.getLog(`log${i.renames?":follow":""}${i.reverse?":reverse":""}`);if(he!=null){if(i.ref==null)return ke.Y.debug(o,`Cache hit: ~'${w}'`),he.item;ke.Y.debug(o,`Cache ?: '${w}'`);let pe=await he.item;if(pe!=null&&!pe.hasMore&&pe.commits.has(i.ref)){ke.Y.debug(o,`Cache hit: '${w}'`);let _e=!0,Ie=0;const Ve=new Map((0,li.DZ)(pe.commits.entries(),([et,bt])=>{if(_e){if(et!==i?.ref)return;_e=!1}if(Ie++,!(i?.limit!=null&&Ie>i.limit))return[et,bt]})),dt=me({},i);return pe=fe(me({},pe),{limit:i.limit,count:Ve.size,commits:Ve,query:et=>this.getLogForFile(e,t,fe(me({},dt),{limit:et}))}),pe}}}}ke.Y.debug(o,`Cache miss: '${w}'`),S.state==null&&(S.state=new Rn.p2(S.key))}const X=this.getLogForFileCore(e,d,i,S,w,o);if(S.state!=null&&i.range==null){ke.Y.debug(o,`Cache add: '${w}'`);const re={item:X};S.state.setLog(w,re)}return X}async getLogForFileCore(e,t,i,o,d,w){var S=i,{ref:X,range:re}=S,he=He(S,["ref","range"]);const pe=await this.isTrackedPrivate(t,e,X);if(pe==null)return ke.Y.log(w,`Skipping blame; '${t}' is not tracked`),yt;const[_e,Ie]=pe;try{re!=null&&re.start.line>re.end.line&&(re=new r.Range(re.end,re.start));const Ve=await this.git.log__file(Ie,_e,X,fe(me({ordering:this.container.config.advanced.commitOrdering},he),{firstParent:he.renames,startLine:re==null?void 0:re.start.line+1,endLine:re==null?void 0:re.end.line+1})),dt=ut.parse(this.container,Ve,(0,A.Mh)(_e)?it.Log:it.LogFile,Ie,_e,X,await this.getCurrentUser(Ie),he.limit,he.reverse??!1,re);if(dt!=null){const et=fe(me({},he),{ref:X,range:re});dt.query=bt=>this.getLogForFile(e,t,fe(me({},et),{limit:bt})),dt.hasMore&&(dt.more=this.getLogForFileMoreFn(dt,t,et))}return dt}catch(Ve){if(o.state!=null&&re==null&&!he.reverse){const dt=Ve?.toString()??"";ke.Y.debug(w,`Cache replace (with empty promise): '${d}'`);const et={item:yt,errorMessage:dt};return o.state.setLog(d,et),yt}return}}getLogForFileMoreFn(e,t,i){return async o=>{var d,w;const S=o!=null&&typeof o=="object"?o.until:void 0;let X=typeof o=="number"?o:void 0;if(S&&(0,li.G)(e.commits.values(),Ie=>Ie.ref===S))return e;X=X??this.container.config.advanced.maxSearchItems??0;const re=(d=(0,li.Z$)(e.commits.values()))==null?void 0:d.ref,he=await this.getLogForFile(e.repoPath,t,fe(me({},i),{limit:S==null?X:0,ref:i.all?void 0:S==null?`${re}^`:`${S}^..${re}^`,skip:i.all?e.count:void 0}));if(he==null)return fe(me({},e),{hasMore:!1});const pe=new Map([...e.commits,...he.commits]),_e={repoPath:e.repoPath,commits:pe,sha:e.sha,range:e.range,count:pe.size,limit:S==null?(e.limit??0)+X:void 0,hasMore:S==null?he.hasMore:!0,query:Ie=>this.getLogForFile(e.repoPath,t,fe(me({},i),{limit:Ie}))};if(i.renames){const Ie=(0,li.sE)(he.commits.values(),Ve=>{var dt,et;return Boolean((dt=Ve.file)==null?void 0:dt.originalPath)&&((et=Ve.file)==null?void 0:et.originalPath)!==t});t=((w=Ie?.file)==null?void 0:w.originalPath)??t}return _e.more=this.getLogForFileMoreFn(_e,t,i),_e}}async getMergeBase(e,t,i,o){const d=ke.Y.getCorrelationContext();try{const w=await this.git.merge_base(e,t,i,o);return w==null?void 0:w.split(` `)[0].trim()||void 0}catch(w){ke.Y.error(w,d);return}}async getMergeStatus(e){let t=this.useCaching?this._mergeStatusCache.get(e):void 0;if(t===void 0){const i=await this.git.rev_parse__verify(e,"MERGE_HEAD");if(i!=null){const[o,d,w]=await Promise.all([this.getBranch(e),this.getMergeBase(e,"MERGE_HEAD","HEAD"),this.getCommitBranches(e,"MERGE_HEAD",{mode:"pointsAt"})]);t={type:"merge",repoPath:e,mergeBase:d,HEAD:b.GitReference.create(i,e,{refType:"revision"}),current:b.GitReference.fromBranch(o),incoming:w?.length===1?b.GitReference.create(w[0],e,{refType:"branch",name:w[0],remote:!1}):void 0}}this.useCaching&&this._mergeStatusCache.set(e,t??null)}return t??void 0}async getRebaseStatus(e){let t=this.useCaching?this._rebaseStatusCache.get(e):void 0;if(t===void 0){const i=await this.git.rev_parse__verify(e,"REBASE_HEAD");if(i!=null){let[o,d,w,S,X,re]=await Promise.all([this.getMergeBase(e,"REBASE_HEAD","HEAD"),this.git.readDotGitFile(e,["rebase-merge","head-name"]),this.git.readDotGitFile(e,["rebase-merge","onto"]),this.git.readDotGitFile(e,["rebase-merge","msgnum"],{numeric:!0}),this.git.readDotGitFile(e,["rebase-merge","message"],{throw:!0}).catch(()=>this.git.readDotGitFile(e,["rebase-merge","message-squashed"])),this.git.readDotGitFile(e,["rebase-merge","end"],{numeric:!0})]);if(d==null||w==null)return;d.startsWith("refs/heads/")&&(d=d.substr(11).trim());const he=await this.getCommitBranches(e,w,{mode:"pointsAt"});let pe;for(const _e of he)if(!_e.startsWith("(no branch, rebasing")){pe=_e;break}t={type:"rebase",repoPath:e,mergeBase:o,HEAD:b.GitReference.create(i,e,{refType:"revision"}),onto:b.GitReference.create(w,e,{refType:"revision"}),current:pe!=null?b.GitReference.create(pe,e,{refType:"branch",name:pe,remote:!1}):void 0,incoming:b.GitReference.create(d,e,{refType:"branch",name:d,remote:!1}),steps:{current:{number:S??0,commit:b.GitReference.create(i,e,{refType:"revision",message:X})},total:re??0}}}this.useCaching&&this._rebaseStatusCache.set(e,t??null)}return t??void 0}async getNextComparisonUris(e,t,i,o=0){if(!i)return;const d=this.getRelativePath(t,e);if(b.GitRevision.isUncommittedStaged(i))return{current:ci.YY.fromFile(d,e,i),next:ci.YY.fromFile(d,e,void 0)};const w=await this.getNextUri(e,t,i,o);if(w==null){const S=await this.getStatusForFile(e,t);return S!=null&&S.indexStatus!=null?{current:ci.YY.fromFile(d,e,i),next:ci.YY.fromFile(d,e,b.GitRevision.uncommittedStaged)}:{current:ci.YY.fromFile(d,e,i),next:ci.YY.fromFile(d,e,void 0)}}return{current:o===0?ci.YY.fromFile(d,e,i):await this.getNextUri(e,t,i,o-1),next:w}}async getNextUri(e,t,i,o=0){if(!i||b.GitRevision.isUncommittedStaged(i))return;let d;i===b.GitRevision.deletedOrMissing&&(i=void 0,d=["A"]);const w=this.getRelativePath(t,e);let S=await this.git.log__file(e,w,i,{argsOrFormat:ut.simpleFormat,fileMode:"simple",filters:d,limit:o+1,ordering:this.container.config.advanced.commitOrdering,reverse:!0});if(S==null||S.length===0)return;const[X,re,he]=ut.parseSimple(S,o);if(he==="D"){if(S=await this.git.log__file(e,".",X,{argsOrFormat:ut.simpleFormat,fileMode:"simple",filters:["R","C"],limit:1,ordering:this.container.config.advanced.commitOrdering}),S==null||S.length===0)return ci.YY.fromFile(re??w,e,X);const[pe,_e]=ut.parseSimpleRenamed(S,re??w);return ci.YY.fromFile(_e??re??w,e,pe??X??b.GitRevision.deletedOrMissing)}return ci.YY.fromFile(re??w,e,X)}async getPreviousComparisonUris(e,t,i,o=0,d=!1){if(i===b.GitRevision.deletedOrMissing)return;const w=this.getRelativePath(t,e);if(i){if(b.GitRevision.isUncommittedStaged(i)){const X=o===0?ci.YY.fromFile(w,e,i):await this.getPreviousUri(e,t,void 0,o-1,void 0,d);return X==null||X.sha===b.GitRevision.deletedOrMissing?void 0:{current:X,previous:await this.getPreviousUri(e,t,void 0,o,void 0,d)}}}else{const X=await this.getStatusForFile(e,t);if(X!=null){if(X.indexStatus!=null)return X.workingTreeStatus==null&&o++,o===0?{current:ci.YY.fromFile(w,e,void 0),previous:ci.YY.fromFile(w,e,b.GitRevision.uncommittedStaged)}:{current:ci.YY.fromFile(w,e,b.GitRevision.uncommittedStaged),previous:await this.getPreviousUri(e,t,i,o-1,void 0,d)};if(X.workingTreeStatus!=null&&o===0)return{current:ci.YY.fromFile(w,e,void 0),previous:await this.getPreviousUri(e,t,void 0,o,void 0,d)}}else o===0&&o++}const S=o===0?ci.YY.fromFile(w,e,i):await this.getPreviousUri(e,t,i,o-1,void 0,d);if(!(S==null||S.sha===b.GitRevision.deletedOrMissing))return{current:S,previous:await this.getPreviousUri(e,t,i,o,void 0,d)}}async getPreviousComparisonUrisForLine(e,t,i,o,d=0){var w,S,X,re,he,pe;if(o===b.GitRevision.deletedOrMissing)return;let _e=this.getRelativePath(t,e),Ie;if(o){if(b.GitRevision.isUncommittedStaged(o)){const bt=d===0?ci.YY.fromFile(_e,e,o):await this.getPreviousUri(e,t,void 0,d-1,i);return bt.sha===b.GitRevision.deletedOrMissing?void 0:{current:bt,previous:await this.getPreviousUri(e,t,void 0,d,i),line:i}}const dt=new ci.YY(t,{repoPath:e,sha:o}),et=await this.getBlameForLine(dt,i);if(et==null)return;o=et.commit.sha,_e=((re=et.commit.file)==null?void 0:re.path)??((he=et.commit.file)==null?void 0:he.originalPath)??_e,t=this.getAbsoluteUri(_e,e),i=et.line.originalLine-1,d===0&&((pe=et.commit.file)==null?void 0:pe.previousSha)&&(Ie=ci.YY.fromFile(_e,e,et.commit.file.previousSha))}else{const dt=new ci.YY(t,e),et=await r.workspace.openTextDocument(t),bt=et.isDirty?await this.getBlameForLineContents(dt,i,et.getText()):await this.getBlameForLine(dt,i);if(bt==null)return;if(bt.commit.isUncommitted){if(et.isDirty){const Bt=await this.getStatusForFile(e,t);return Bt!=null&&Bt.indexStatus!=null?{current:ci.YY.fromFile(_e,e,void 0),previous:ci.YY.fromFile(_e,e,b.GitRevision.uncommittedStaged),line:i}:{current:ci.YY.fromFile(_e,e,void 0),previous:await this.getPreviousUri(e,t,void 0,d,i),line:i}}let It=await this.getDiffForLine(dt,i,void 0);It==null&&(It=await this.getDiffForLine(dt,i,void 0,b.GitRevision.uncommittedStaged),It!=null?o=b.GitRevision.uncommittedStaged:d++)}else o=bt.commit.sha,_e=((w=bt.commit.file)==null?void 0:w.path)??((S=bt.commit.file)==null?void 0:S.originalPath)??_e,t=this.getAbsoluteUri(_e,e),i=bt.line.originalLine-1,d===0&&((X=bt.commit.file)==null?void 0:X.previousSha)&&(Ie=ci.YY.fromFile(_e,e,bt.commit.file.previousSha))}const Ve=d===0?ci.YY.fromFile(_e,e,o):await this.getPreviousUri(e,t,o,d-1,i);if(Ve.sha!==b.GitRevision.deletedOrMissing)return{current:Ve,previous:Ie??await this.getPreviousUri(e,t,o,d,i),line:i}}async getPreviousUri(e,t,i,o=0,d,w=!1){if(i===b.GitRevision.deletedOrMissing)return;const S=ke.Y.getCorrelationContext();i===b.GitRevision.uncommitted&&(i=void 0);const X=this.getRelativePath(t,e);let re;try{re=await this.git.log__file(e,X,i,{argsOrFormat:ut.simpleFormat,fileMode:"simple",firstParent:w,limit:o+2,ordering:this.container.config.advanced.commitOrdering,startLine:d!=null?d+1:void 0})}catch(_e){const Ie=_e?.toString()??"";if((i==null||b.GitRevision.isUncommittedStaged(i))&&Ki.invalidLineCount.test(Ie)){if(i==null){const Ve=await this.getStatusForFile(e,t);if(Ve?.indexStatus!=null)return ci.YY.fromFile(X,e,b.GitRevision.uncommittedStaged)}return i=await this.git.log__file_recent(e,X,{ordering:this.container.config.advanced.commitOrdering}),ci.YY.fromFile(X,e,i??b.GitRevision.deletedOrMissing)}throw ke.Y.error(_e,S),_e}if(re==null||re.length===0)return;const[he,pe]=ut.parseSimple(re,o,i);if(!(i!=null&&i===he))return ci.YY.fromFile(pe??X,e,he??b.GitRevision.deletedOrMissing)}async getIncomingActivity(e,t){const i=ke.Y.getCorrelationContext(),o=t?.limit??this.container.config.advanced.maxListItems??0;try{const d=await this.git.reflog(e,fe(me({ordering:this.container.config.advanced.commitOrdering},t),{limit:o*100}));if(d==null)return;const w=le.parse(d,e,xo,o,o*100);return w?.hasMore&&(w.more=this.getReflogMoreFn(w,t)),w}catch(d){ke.Y.error(d,i);return}}getReflogMoreFn(e,t){return async i=>{i=i??this.container.config.advanced.maxSearchItems??0;const o=await this.getIncomingActivity(e.repoPath,fe(me({},t),{limit:i,skip:e.total}));if(o==null)return fe(me({},e),{hasMore:!1});const d={repoPath:e.repoPath,records:[...e.records,...o.records],count:e.count+o.count,total:e.total+o.total,limit:(e.limit??0)+i,hasMore:o.hasMore};return d.more=this.getReflogMoreFn(d,t),d}}async getRemotes(e,t){if(e==null)return[];const i=t?.providers??vn.c.loadProviders(ve.DN.get("remotes",null));try{const o=await this.git.remote(e),d=ot.parse(o,e,vn.c.factory(i));return d==null?[]:(t?.sort&&b.GitRemote.sort(d),d)}catch(o){return ke.Y.error(o),[]}}getRevisionContent(e,t,i){const[o,d]=(0,A.uo)(t,e);return this.git.show(d,o,i,{encoding:"buffer"})}async getStash(e){if(e==null)return;let t=this.useCaching?this._stashesCache.get(e):void 0;if(t===void 0){const i=await this.git.stash__list(e,{similarityThreshold:this.container.config.advanced.similarityThreshold});t=be.parse(this.container,i,e),this.useCaching&&this._stashesCache.set(e,t??null)}return t??void 0}async getStatusForFile(e,t){const i=await this.git.isAtLeastVersion("2.11")?2:1,[o,d]=(0,A.uo)(t,e),w=await this.git.status__file(d,o,i,{similarityThreshold:this.container.config.advanced.similarityThreshold}),S=Pt.parse(w,d,i);if(!(S==null||!S.files.length))return S.files[0]}async getStatusForFiles(e,t){const i=await this.git.isAtLeastVersion("2.11")?2:1,[o,d]=(0,A.uo)(t,e),w=await this.git.status__file(d,o,i,{similarityThreshold:this.container.config.advanced.similarityThreshold}),S=Pt.parse(w,d,i);return S==null||!S.files.length?[]:S.files}async getStatusForRepo(e){if(e==null)return;const t=await this.git.isAtLeastVersion("2.11")?2:1,i=await this.git.status(e,t,{similarityThreshold:this.container.config.advanced.similarityThreshold}),o=Pt.parse(i,e,t);if(o?.detached){const d=await this.getRebaseStatus(e);if(d!=null)return new b.GitStatus(e,d.incoming.name,o.sha,o.files,o.state,o.upstream,!0)}return o}async getTags(e,t){if(e==null)return zt;let i=this.useCaching?this._tagsCache.get(e):void 0;if(i==null){async function d(){try{const w=await this.git.tag(e);return{values:Nr.parse(w,e)??[]}}catch{return this._tagsCache.delete(e),zt}}n(d,"load"),i=d.call(this),this.useCaching&&this._tagsCache.set(e,i)}let o=await i;return t?.filter!=null&&(o=fe(me({},o),{values:o.values.filter(t.filter)})),t?.sort&&b.GitTag.sort(o.values,typeof t.sort=="boolean"?void 0:t.sort),o}async getTreeEntryForRevision(e,t,i){if(e==null||!t)return;const[o,d]=(0,A.uo)(t,e),w=await this.git.ls_tree(d,i,o),S=Oe.parse(w);return S?.length?S[0]:void 0}async getTreeForRevision(e,t){if(e==null)return[];const i=await this.git.ls_tree(e,t);return Oe.parse(i)??[]}async hasBranchOrTag(e,t){var i,o;const[{values:d},{values:w}]=await Promise.all([this.getBranches(e,{filter:(i=t?.filter)==null?void 0:i.branches,sort:!1}),this.getTags(e,{filter:(o=t?.filter)==null?void 0:o.tags,sort:!1})]);return d.length!==0||w.length!==0}async hasCommitBeenPushed(e,t){return e==null?!1:this.git.merge_base__is_ancestor(e,t,"@{u}")}isTrackable(e){return this.supportedSchemes.has(e.scheme)}async isTracked(e){return await this.isTrackedPrivate(e)!=null}async isTrackedPrivate(e,t,i){let o,d;if(typeof e=="string"){if(i===b.GitRevision.deletedOrMissing)return;d=this.container.git.getRepository(r.Uri.file(e)),t=t||d?.path,[o,t]=(0,A.uo)(e,t)}else{if(!this.isTrackable(e)||e instanceof ci.YY&&(i=e.sha,i===b.GitRevision.deletedOrMissing))return;d=this.container.git.getRepository(e),t=t||d?.path,[o,t]=(0,A.uo)(e,t)}const w=t?`${t}/${o}`:o;let S=w;S=`${i??""}:${S[0]==="/"?S:`/${S}`}`;let X=this._trackedPaths.get(S);return X!=null||(X=this.isTrackedCore(w,o,t??"",i,d),this._trackedPaths.set(S,X),X=await X,this._trackedPaths.set(S,X)),X}async isTrackedCore(e,t,i,o,d){if(o!==b.GitRevision.deletedOrMissing)try{for(;;){i||([t,i]=(0,A.uo)(e,"",!0));let w=Boolean(await this.git.ls_files(i,t));if(w)return[t,i];if(i){const[S,X]=(0,A.uo)(e,"",!0);if(S!==t&&(w=Boolean(await this.git.ls_files(X,S)),w))return d=await this.container.git.getOrOpenRepository(r.Uri.file(e),!0),d!=null?(0,A.uo)(e,d.path):[S,X]}if(!w&&o&&!b.GitRevision.isUncommitted(o)&&(w=Boolean(await this.git.ls_files(i,t,{ref:o})),w||(w=Boolean(await this.git.ls_files(i,t,{ref:`${o}^`})))),!w){if(d!=null){const S=t.indexOf("/");if(S<0||S===t.length-1)return;const X=await this.container.git.getOrOpenRepository(r.Uri.file(e),!0);if(X!=null&&X!==d){[t,i]=(0,A.uo)(e,d.path),d=void 0;continue}}return}return[t,i]}}catch(w){ke.Y.error(w);return}}async getDiffTool(e){return await this.git.config__get("diff.guitool",e,{local:!0})??this.git.config__get("diff.tool",e,{local:!0})}async openDiffTool(e,t,i){const[o,d]=(0,A.uo)(t,e);try{let w=i?.tool;if(!w){const S=ke.Y.getCorrelationContext();if(w=this.container.config.advanced.externalDiffTool||await this.getDiffTool(d),w==null)throw new Error("No diff tool found");ke.Y.log(S,`Using tool=${w}`)}await this.git.difftool(d,o,w,i)}catch(w){const S=w?.toString()??"";if(S==="No diff tool found"||/Unknown .+? tool/.test(S)){const X="View Git Docs";await r.window.showWarningMessage("Unable to open changes because the specified diff tool cannot be found or no Git diff tool is configured",X)===X&&r.env.openExternal(r.Uri.parse("https://git-scm.com/docs/git-config#Documentation/git-config.txt-difftool"));return}ke.Y.error(w,"openDiffTool"),Br.V.showGenericErrorMessage("Unable to open compare")}}async openDirectoryCompare(e,t,i,o){try{if(!o){const d=ke.Y.getCorrelationContext();if(o=this.container.config.advanced.externalDirectoryDiffTool||await this.getDiffTool(e),o==null)throw new Error("No diff tool found");ke.Y.log(d,`Using tool=${o}`)}await this.git.difftool__dir_diff(e,o,t,i)}catch(d){const w=d?.toString()??"";if(w==="No diff tool found"||/Unknown .+? tool/.test(w)){const S="View Git Docs";await r.window.showWarningMessage("Unable to open directory compare because the specified diff tool cannot be found or no Git diff tool is configured",S)===S&&r.env.openExternal(r.Uri.parse("https://git-scm.com/docs/git-config#Documentation/git-config.txt-difftool"));return}ke.Y.error(d,"openDirectoryCompare"),Br.V.showGenericErrorMessage("Unable to open directory compare")}}async resolveReference(e,t,i,o){if(!t||t===b.GitRevision.deletedOrMissing||i==null&&b.GitRevision.isSha(t)||i!=null&&b.GitRevision.isUncommitted(t))return t;if(i==null)return!b.GitRevision.isShaLike(t)||t.endsWith("^3")?t:await this.git.rev_parse__verify(e,t)??t;const d=this.getRelativePath(i,e),w=await this.git.rev_parse__verify(e,t,d);if(w==null)return b.GitRevision.deletedOrMissing;let S=this.git.log__find_object(e,w,t,this.container.config.advanced.commitOrdering,d);return o?.timeout!=null&&(S=Promise.race([S,(0,Yi.Dc)(o.timeout)])),await S??t}validateBranchOrTagName(e,t){return this.git.check_ref_format(t,e)}async validateReference(e,t){return t==null||t.length===0?!1:t===b.GitRevision.deletedOrMissing||b.GitRevision.isUncommitted(t)?!0:await this.git.rev_parse__verify(e,t)!=null}async stageFile(e,t){await this.git.add(e,typeof t=="string"?t:(0,A.uo)(t,e)[0])}async stageDirectory(e,t){await this.git.add(e,typeof t=="string"?t:(0,A.uo)(t,e)[0])}async unStageFile(e,t){await this.git.reset(e,typeof t=="string"?t:(0,A.uo)(t,e)[0])}async unStageDirectory(e,t){await this.git.reset(e,typeof t=="string"?t:(0,A.uo)(t,e)[0])}async stashApply(e,t,i){try{await this.git.stash__apply(e,t,Boolean(i?.deleteAfter))}catch(o){if(o instanceof Error){const d=o.message??"";if(d.includes("Your local changes to the following files would be overwritten by merge"))throw new Pr.ef(Pr.bk.WorkingChanges,o);if(d.includes("Auto-merging")&&d.includes("CONFLICT")||o instanceof ct&&(o.stdout.includes("Auto-merging")&&o.stdout.includes("CONFLICT")||o.stdout.includes("needs merge"))){r.window.showInformationMessage("Stash applied with conflicts");return}throw new Pr.ef(`Unable to apply stash \u2014 ${d.trim().replace(/\n+?/g,"; ")}`,o)}throw new Pr.ef(`Unable to apply stash \u2014 ${String(o)}`,o)}}async stashDelete(e,t,i){await this.git.stash__delete(e,t,i)}async stashSave(e,t,i,o){if(i==null)return this.git.stash__push(e,t,o);await this.ensureGitVersion("2.13.2","Stashing individual files"," Please retry by stashing everything or install a more recent version of Git and try again.");const d=i.map(X=>`./${(0,A.uo)(X,e)[0]}`),w="2.30.0",S=await this.git.isAtLeastVersion(w);return!S&&(0,$.IP)(d)>cs&&await this.ensureGitVersion(w,`Stashing so many files (${d.length}) at once`," Please retry by stashing fewer files or install a more recent version of Git and try again."),this.git.stash__push(e,t,fe(me({},o),{pathspecs:d,stdin:S}))}async createWorktree(e,t,i){try{await this.git.worktree__add(e,t,i)}catch(o){ke.Y.error(o);const d=String(o);throw Ki.alreadyCheckedOut.test(d)?new Pr.P6(Pr.hK.AlreadyCheckedOut,o):Ki.alreadyExists.test(d)?new Pr.P6(Pr.hK.AlreadyExists,o):new Pr.P6(void 0,o)}}async getWorktrees(e){await this.ensureGitVersion("2.7.6","Displaying worktrees"," Please install a more recent version of Git and try again.");const t=await this.git.worktree__list(e);return vi.parse(t,e)}async getWorktreesDefaultUri(e){let t=ve.DN.get("worktrees.defaultLocation");if(t!=null)return t.startsWith("~")&&(t=(0,A.RQ)((0,io.homedir)(),t.slice(1))),this.getAbsoluteUri(t,e)}async deleteWorktree(e,t,i){await this.ensureGitVersion("2.17.0","Deleting worktrees"," Please install a more recent version of Git and try again.");try{await this.git.worktree__remove(e,t,i)}catch(o){ke.Y.error(o);const d=String(o);throw Ki.mainWorkingTree.test(d)?new Pr.Nk(Pr.xe.MainWorkingTree,o):Ki.uncommittedChanges.test(d)?new Pr.Nk(Pr.xe.HasChanges,o):new Pr.Nk(void 0,o)}}async getScmGitApi(){return this._scmGitApi??(this._scmGitApi=this.getScmGitApiCore())}async getScmGitApiCore(){try{const e=r.extensions.getExtension("vscode.git");if(e==null)return;const t=e.isActive?e.exports:await e.activate();return t?.getAPI(1)}catch{return}}getScmGitUri(e,t){const i=this.getAbsoluteUri(e,t);return r.Uri.from({scheme:_.sN.Git,path:i.path,query:JSON.stringify({path:i.fsPath,ref:"~"})})}async getOpenScmRepositories(){const e=ke.Y.getCorrelationContext();try{const t=await this.getScmGitApi();return t?.repositories??[]}catch(t){return ke.Y.error(t,e),[]}}async getOrOpenScmRepository(e){var t;const i=ke.Y.getCorrelationContext();try{const o=await this.getScmGitApi();return o?.openRepository!=null?await((t=o?.openRepository)==null?void 0:t.call(o,r.Uri.file(e)))??void 0:o?.getRepository(r.Uri.file(e))??void 0}catch(o){ke.Y.error(o,i);return}}async openScmRepository(e){var t;const i=ke.Y.getCorrelationContext();try{const o=await this.getScmGitApi();return await((t=o?.openRepository)==null?void 0:t.call(o,e))??void 0}catch(o){ke.Y.error(o,i);return}}async ensureGitVersion(e,t,i){if(!await this.git.isAtLeastVersion(e))throw new Error(`${t} requires a newer version of Git (>= ${e}) than is currently installed (${await this.git.version()}).${i}`)}}n(Tt,"LocalGitProvider"),ze([(0,p.cM)()],Tt.prototype,"findGit",1),ze([(0,p.cM)({args:!1,singleLine:!0,prefix:(s,e)=>`${s.prefix}(${e.uri.fsPath})`,exit:s=>`returned ${s.length} repositories${s.length!==0?` (${s.map(e=>e.path).join(", ")})`:""}`})],Tt.prototype,"repositorySearch",1),ze([(0,p.fF)({args:{2:!1,3:!1}})],Tt.prototype,"repositorySearchCore",1),ze([(0,p.cM)()],Tt.prototype,"getBestRevisionUri",1),ze([(0,p.cM)()],Tt.prototype,"getWorkingUri",1),ze([(0,p.cM)()],Tt.prototype,"addRemote",1),ze([(0,p.cM)()],Tt.prototype,"pruneRemote",1),ze([(0,p.cM)()],Tt.prototype,"applyChangesToWorkingFile",1),ze([(0,p.cM)()],Tt.prototype,"checkout",1),ze([(0,p.cM)()],Tt.prototype,"resetCaches",1),ze([(0,p.cM)({args:{1:s=>s.length}})],Tt.prototype,"excludeIgnoredUris",1),ze([(0,bi.H)(),(0,p.cM)()],Tt.prototype,"fetch",1),ze([(0,bi.H)(),(0,p.fF)()],Tt.prototype,"findRepositoryUri",1),ze([(0,p.cM)({args:{1:s=>s.join(",")}})],Tt.prototype,"getAheadBehindCommitCount",1),ze([(0,bi.H)(),(0,p.cM)()],Tt.prototype,"getBlame",1),ze([(0,p.cM)({args:{1:""}})],Tt.prototype,"getBlameContents",1),ze([(0,bi.H)(),(0,p.cM)()],Tt.prototype,"getBlameForLine",1),ze([(0,p.cM)({args:{2:""}})],Tt.prototype,"getBlameForLineContents",1),ze([(0,p.cM)()],Tt.prototype,"getBlameForRange",1),ze([(0,p.cM)({args:{2:""}})],Tt.prototype,"getBlameForRangeContents",1),ze([(0,p.cM)({args:{0:""}})],Tt.prototype,"getBlameRange",1),ze([(0,p.cM)()],Tt.prototype,"getBranch",1),ze([(0,p.cM)({args:{1:!1}})],Tt.prototype,"getBranches",1),ze([(0,p.cM)()],Tt.prototype,"getChangedFilesCount",1),ze([(0,p.cM)()],Tt.prototype,"getCommit",1),ze([(0,p.cM)()],Tt.prototype,"getCommitBranches",1),ze([(0,p.cM)()],Tt.prototype,"getCommitCount",1),ze([(0,p.cM)()],Tt.prototype,"getCommitForFile",1),ze([(0,p.cM)()],Tt.prototype,"getOldestUnpushedRefForFile",1),ze([(0,p.cM)()],Tt.prototype,"getContributors",1),ze([(0,bi.H)(),(0,p.cM)()],Tt.prototype,"getCurrentUser",1),ze([(0,p.cM)()],Tt.prototype,"getDefaultBranchName",1),ze([(0,p.cM)()],Tt.prototype,"getDiffForFile",1),ze([(0,p.cM)({args:{1:""}})],Tt.prototype,"getDiffForFileContents",1),ze([(0,p.cM)()],Tt.prototype,"getDiffForLine",1),ze([(0,p.cM)()],Tt.prototype,"getDiffStatus",1),ze([(0,p.cM)()],Tt.prototype,"getFileStatusForCommit",1),ze([(0,p.fF)()],Tt.prototype,"getLastFetchedTimestamp",1),ze([(0,p.cM)()],Tt.prototype,"getLog",1),ze([(0,p.cM)()],Tt.prototype,"getLogRefsOnly",1),ze([(0,p.cM)()],Tt.prototype,"getLogForSearch",1),ze([(0,p.cM)()],Tt.prototype,"getLogForFile",1),ze([(0,p.cM)()],Tt.prototype,"getMergeBase",1),ze([(0,bi.H)(),(0,p.cM)()],Tt.prototype,"getMergeStatus",1),ze([(0,bi.H)(),(0,p.cM)()],Tt.prototype,"getRebaseStatus",1),ze([(0,p.cM)()],Tt.prototype,"getNextComparisonUris",1),ze([(0,p.cM)()],Tt.prototype,"getNextUri",1),ze([(0,p.cM)()],Tt.prototype,"getPreviousComparisonUris",1),ze([(0,p.cM)()],Tt.prototype,"getPreviousComparisonUrisForLine",1),ze([(0,p.cM)()],Tt.prototype,"getPreviousUri",1),ze([(0,p.cM)()],Tt.prototype,"getIncomingActivity",1),ze([(0,p.cM)({args:{1:!1}})],Tt.prototype,"getRemotes",1),ze([(0,bi.H)(),(0,p.cM)()],Tt.prototype,"getRevisionContent",1),ze([(0,bi.H)(),(0,p.cM)()],Tt.prototype,"getStash",1),ze([(0,p.cM)()],Tt.prototype,"getStatusForFile",1),ze([(0,p.cM)()],Tt.prototype,"getStatusForFiles",1),ze([(0,p.cM)()],Tt.prototype,"getStatusForRepo",1),ze([(0,p.cM)({args:{1:!1}})],Tt.prototype,"getTags",1),ze([(0,p.cM)()],Tt.prototype,"getTreeEntryForRevision",1),ze([(0,p.cM)()],Tt.prototype,"getTreeForRevision",1),ze([(0,p.cM)({args:{1:!1}})],Tt.prototype,"hasBranchOrTag",1),ze([(0,p.cM)()],Tt.prototype,"hasCommitBeenPushed",1),ze([(0,p.cM)({exit:s=>`returned ${Boolean(s)}`})],Tt.prototype,"isTrackedPrivate",1),ze([(0,p.fF)()],Tt.prototype,"isTrackedCore",1),ze([(0,p.cM)()],Tt.prototype,"getDiffTool",1),ze([(0,p.cM)()],Tt.prototype,"openDiffTool",1),ze([(0,p.cM)()],Tt.prototype,"openDirectoryCompare",1),ze([(0,p.cM)()],Tt.prototype,"resolveReference",1),ze([(0,p.cM)()],Tt.prototype,"validateBranchOrTagName",1),ze([(0,p.cM)()],Tt.prototype,"validateReference",1),ze([(0,p.cM)()],Tt.prototype,"stageFile",1),ze([(0,p.cM)()],Tt.prototype,"stageDirectory",1),ze([(0,p.cM)()],Tt.prototype,"unStageFile",1),ze([(0,p.cM)()],Tt.prototype,"unStageDirectory",1),ze([(0,p.cM)()],Tt.prototype,"stashApply",1),ze([(0,p.cM)()],Tt.prototype,"stashDelete",1),ze([(0,p.cM)({args:{2:s=>s?.length}})],Tt.prototype,"stashSave",1),ze([(0,p.cM)()],Tt.prototype,"createWorktree",1),ze([(0,bi.H)(),(0,p.cM)()],Tt.prototype,"getWorktrees",1),ze([(0,p.cM)()],Tt.prototype,"getWorktreesDefaultUri",1),ze([(0,p.cM)()],Tt.prototype,"deleteWorktree",1),ze([(0,p.cM)()],Tt.prototype,"getScmGitApiCore",1),ze([(0,p.cM)()],Tt.prototype,"getOpenScmRepositories",1),ze([(0,p.cM)()],Tt.prototype,"getOrOpenScmRepository",1),ze([(0,p.cM)()],Tt.prototype,"openScmRepository",1);var qa=Object.defineProperty,ic=n((s,e,t)=>e in s?qa(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"vslsGitProvider_defNormalProp"),el=n((s,e,t)=>(ic(s,typeof e!="symbol"?e+"":e,t),t),"vslsGitProvider_publicField");class zs extends Fi{constructor(e){super();this.localGit=e}async git(e,...t){if(e.local)return e.cwd="",this.localGit.git(e,...t);const i=await zi.instance.vsls.guest();if(i==null)throw new Error("No guest");return i.git(e,...t)}}n(zs,"VslsGit");class Io extends Tt{constructor(){super(...arguments);el(this,"descriptor",{id:_r.p.Vsls,name:"Live Share"}),el(this,"supportedSchemes",new Set([_.sN.Vsls,_.sN.VslsScc]))}async discoverRepositories(e){if(!this.supportedSchemes.has(e.scheme))return[];const t=ke.Y.getCorrelationContext();try{const i=await this.container.vsls.guest(),o=await i?.getRepositoriesForUri(e);return o==null||o.length===0?[]:o.map(d=>this.openRepository(void 0,r.Uri.parse(d.folderUri,!0),d.root,void 0,d.closed))}catch(i){return ke.Y.error(i,t),[]}}canHandlePathOrUri(e,t){return super.canHandlePathOrUri(e,t)}getAbsoluteUri(e,t){e=(0,A.IC)(e);const i=(typeof t!="string"?t.scheme:void 0)??(typeof e!="string"?e.scheme:void 0)??_.sN.Vsls;return super.getAbsoluteUri(e,t).with({scheme:i})}async findRepositoryUri(e,t){const i=ke.Y.getCorrelationContext();let o;try{if(!t)try{const d=await r.workspace.fs.stat(e);e=d?.type===r.FileType.Directory?e:e.with({path:(0,A.XX)(e.fsPath)})}catch{}return o=await this.git.rev_parse__show_toplevel(e.fsPath),o&&o?r.Uri.parse(o,!0):void 0}catch(d){ke.Y.error(d,i);return}}getLastFetchedTimestamp(e){return Promise.resolve(void 0)}}n(Io,"VslsGitProvider");let ds;function tl(){return ds==null&&(ds=new Fi),ds}n(tl,"ensureGit");function rc(s,...e){return tl().git(s,...e)}n(rc,"git");async function nc(s){const e=tl(),t=[new Tt(s,e),new Io(s,new zs(e))];if(s.config.virtualRepositories.enabled){const i=(await v.e(457).then(v.bind(v,3333))).GitHubGitProvider;t.push(new i(s))}return t}n(nc,"getSupportedGitProviders");var Tr=v(6277),fs=v(6216),Qs=Object.defineProperty,Zs=Object.getOwnPropertyDescriptor,il=n((s,e,t)=>e in s?Qs(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"autolinks_defNormalProp"),Xs=n((s,e,t,i)=>{for(var o=i>1?void 0:i?Zs(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&Qs(e,t,o),o},"autolinks_decorateClass"),Js=n((s,e,t)=>(il(s,typeof e!="symbol"?e+"":e,t),t),"autolinks_publicField");const Hn=//g;function qs(s){return s.prefix===void 0&&s.url===void 0}n(qs,"isDynamic");function ms(s){return s.prefix!==void 0&&s.url!==void 0}n(ms,"isCacheable");class Bo{constructor(e){this.container=e,Js(this,"_disposable"),Js(this,"_references",[]),this._disposable=r.Disposable.from(ve.DN.onDidChange(this.onConfigurationChanged,this)),this.onConfigurationChanged()}dispose(){var e;(e=this._disposable)==null||e.dispose()}onConfigurationChanged(e){ve.DN.changed(e,"autolinks")&&(this._references=this.container.config.autolinks??[])}async getIssueOrPullRequestLinks(e,t,{timeout:i}={}){if(!t.hasRichProvider())return;const{provider:o}=t;if(!(o.maybeConnected??await o.isConnected()))return;const w=new Set;let S,X;for(const he of o.autolinks)if(!!ms(he)){he.messageRegex===void 0&&(he.messageRegex=new RegExp(`(?<=^|\\s|\\(|\\\\\\[)(${(0,M.yI)(he.prefix)}([${he.alphanumeric?"\\w":"0-9"}]+))\\b`,he.ignoreCase?"gi":"g"));do{if(S=he.messageRegex.exec(e),S==null)break;[,,X]=S,w.add(X)}while(!0)}if(w.size===0)return;const re=await(0,Yi.xu)(w.values(),he=>o.getIssueOrPullRequest(he),i);if(!(re.size===0||(0,li.yW)(re.values(),he=>he===void 0)))return re}linkify(e,t,i,o,d){for(const w of this._references)this.ensureAutolinkCached(w,o)&&w.linkify!=null&&(e=w.linkify(e,t,d));if(i!=null&&i.length!==0){for(const w of i)if(w.provider!==void 0)for(const S of w.provider.autolinks)this.ensureAutolinkCached(S,o)&&S.linkify!=null&&(e=S.linkify(e,t,d))}return e}ensureAutolinkCached(e,t){if(qs(e))return!0;try{if(e.messageMarkdownRegex===void 0&&(e.messageMarkdownRegex=new RegExp(`(?<=^|\\s|\\(|\\\\\\[)(${(0,M.yI)((0,M.ry)(e.prefix))}([${e.alphanumeric?"\\w":"0-9"}]+))\\b`,e.ignoreCase?"gi":"g")),t==null||t.size===0){const i=`[$1](${(0,fs.M)(e.url.replace(Hn,"$2"))}${e.title?` "${e.title.replace(Hn,"$2")}"`:""})`;return e.linkify=(o,d)=>d?o.replace(e.messageMarkdownRegex,i):o,!0}e.linkify=(i,o,d)=>{const w=d==null;let S;return o?i.replace(e.messageMarkdownRegex,(X,re,he)=>{const pe=t?.get(he),_e=(0,fs.M)(e.url.replace(Hn,he));let Ie="";if(e.title){if(Ie=` "${e.title.replace(Hn,he)}`,pe!=null)if(pe instanceof Yi.PK)Ie+=` ${_.NE.Dash.repeat(2)} Details timed out`;else{const Ve=pe.title.replace(/([")\\])/g,"\\$1").trim();d!=null&&(S=d.size+1,d.set(S,`${b.IssueOrPullRequest.getMarkdownIcon(pe)} [**${Ve}**](${_e}${Ie}")\\ ${_.NE.Space.repeat(5)}${re} ${pe.closed?"closed":"opened"} ${(0,Tr.Zh)(pe.closedDate??pe.date)}`)),Ie+=` ${_.NE.Dash.repeat(2)} ${Ve} ${pe.closed?"Closed":"Opened"}, ${(0,Tr.Zh)(pe.closedDate??pe.date)}`}Ie+='"'}return`[${re}](${_e}${Ie})`}):(i=i.replace(e.messageRegex,(X,re,he)=>{const pe=t?.get(he);return pe==null?re:(d===void 0&&(d=new Map),S=d.size+1,d.set(S,`${re}: ${pe instanceof Yi.PK?"Details timed out":`${pe.title} ${_.NE.Dot} ${pe.closed?"Closed":"Opened"}, ${(0,Tr.Zh)(pe.closedDate??pe.date)}`}`),`${re}${(0,M.sC)(S)}`)}),w&&d!=null&&d.size!==0?`${i} ${_.NE.Dash.repeat(2)} ${(0,li.v_)((0,li.UI)(d,([X,re])=>`${(0,M.sC)(X)} ${re}`),` `)}`:i)}}catch(i){ke.Y.error(i,`Failed to create autolink generator: prefix=${e.prefix}, url=${e.url}, title=${e.title}`),e.linkify=null}return!0}}n(Bo,"Autolinks"),Xs([(0,p.fF)({args:{0:"",1:!1,2:s=>s?.timeout}})],Bo.prototype,"getIssueOrPullRequestLinks",1),Xs([(0,p.fF)({args:{0:"",2:s=>s?.length,3:s=>s?.size,4:s=>s?.size}})],Bo.prototype,"linkify",1);var Vn=v(2246),Er=v(9510),Yr=v(320),ps=Object.defineProperty,ea=n((s,e,t)=>e in s?ps(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"annotationProvider_defNormalProp"),Xr=n((s,e,t)=>(ea(s,typeof e!="symbol"?e+"":e,t),t),"annotationProvider_publicField"),an=(s=>(s.Computing="computing",s.Computed="computed",s))(an||{});class ln{constructor(e,t,i){this.annotationType=e,this.editor=t,this.trackedDocument=i,Xr(this,"annotationContext"),Xr(this,"correlationKey"),Xr(this,"document"),Xr(this,"status"),Xr(this,"decorations"),Xr(this,"disposable"),this.correlationKey=ln.getCorrelationKey(this.editor),this.document=this.editor.document,this.disposable=r.Disposable.from(r.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,t;return(t=(e=this.editor)==null?void 0:e.document)==null?void 0:t.uri}clear(){var e;if(this.annotationContext=void 0,this.status=void 0,this.editor!=null&&(e=this.decorations)!=null&&e.length){for(const t of this.decorations)try{this.editor.setDecorations(t.decorationType,[])}catch{}this.decorations=void 0}}mustReopen(e){return!1}refresh(e){var t;if(this.editor==null||!((t=this.decorations)!=null&&t.length))return;const i=[];for(const o of this.decorations){const d=e.get(o.decorationType);d!==null&&(d!=null&&(o.decorationType=d),i.push(o))}this.setDecorations(this.decorations)}async restore(e){var t;if(this.editor._disposed!==!1){if(this.status="computing",e===r.window.activeTextEditor&&await(0,Di.v)(_.zf.AnnotationStatus,this.status),this.editor=e,this.correlationKey=ln.getCorrelationKey(e),this.document=e.document,(t=this.decorations)!=null&&t.length)for(const i of this.decorations)this.editor.setDecorations(i.decorationType,i.rangesOrOptions);this.status="computed",e===r.window.activeTextEditor&&await(0,Di.v)(_.zf.AnnotationStatus,this.status)}}async provideAnnotation(e){this.status="computing";try{if(await this.onProvideAnnotation(e))return this.status="computed",!0}catch(t){ke.Y.error(t)}return this.status=void 0,!1}setDecorations(e){var t,i;if((t=this.decorations)!=null&&t.length&&this.clear(),this.decorations=e,(i=this.decorations)!=null&&i.length)for(const o of this.decorations)this.editor.setDecorations(o.decorationType,o.rangesOrOptions)}}n(ln,"AnnotationProviderBase");var Fr=v(7640),ta=v(2078);const oc=/^(?:(#?)([0-9a-f]{3}|[0-9a-f]{6})|((?:rgb|hsl)a?)\((-?\d+%?)[,\s]+(-?\d+%?)[,\s]+(-?\d+%?)[,\s]*(-?[\d.]+%?)?\))$/i;function gs(s,e){const t=s+e,i=e<0?t<0?0:t:t>255?255:t;return Math.round(i)}n(gs,"adjustLight");function sc(s,e){return _s(s,-e)}n(sc,"darken");function _s(s,e){const t=ia(s);if(t==null)return s;const[i,o,d,w]=t,S=255*e/100;return`rgba(${gs(i,S)}, ${gs(o,S)}, ${gs(d,S)}, ${w})`}n(_s,"lighten");function rl(s,e){const t=ia(s);if(t==null)return s;const[i,o,d,w]=t;return`rgba(${i}, ${o}, ${d}, ${w*(e/100)})`}n(rl,"opacity");function ia(s){s=s.trim();const e=oc.exec(s);if(e==null)return null;if(e[1]==="#"){const t=e[2];switch(t.length){case 3:return[parseInt(t[0]+t[0],16),parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),1];case 6:return[parseInt(t.substring(0,2),16),parseInt(t.substring(2,4),16),parseInt(t.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}}n(ia,"toRgba");var ac=Object.defineProperty,nl=Object.defineProperties,ra=Object.getOwnPropertyDescriptors,na=Object.getOwnPropertySymbols,No=Object.prototype.hasOwnProperty,ol=Object.prototype.propertyIsEnumerable,oa=n((s,e,t)=>e in s?ac(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"annotations_defNormalProp"),sl=n((s,e)=>{for(var t in e||(e={}))No.call(e,t)&&oa(s,t,e[t]);if(na)for(var t of na(e))ol.call(e,t)&&oa(s,t,e[t]);return s},"annotations_spreadValues"),lc=n((s,e)=>nl(s,ra(e)),"annotations_spreadProps");const sa="#f66a0a",Mo="#0a60f6",aa=["#f66a0a","#ef6939","#e96950","#e26862","#db6871","#d3677e","#cc678a","#c46696","#bb66a0","#b365a9","#a965b3","#a064bb","#9664c4","#8a63cc","#7e63d3","#7162db","#6262e2","#5061e9","#3961ef","#0a60f6"];let vs;async function la(){if(vs==null){let s;zi.instance.config.heatmap.coldColor===Mo&&zi.instance.config.heatmap.hotColor===sa?s=aa:s=(await v.e(795).then(v.t.bind(v,8670,23))).default.scale([zi.instance.config.heatmap.hotColor,zi.instance.config.heatmap.coldColor]).mode("lrgb").classes(20).colors(20),vs={hot:s.slice(0,10),cold:s.slice(10,20)};const e=ve.DN.onDidChange(t=>{(ve.DN.changed(t,"heatmap.ageThreshold")||ve.DN.changed(t,"heatmap.hotColor")||ve.DN.changed(t,"heatmap.coldColor"))&&(e.dispose(),vs=void 0)})}return vs}n(la,"getHeatmapColors");class jn{static applyHeatmap(e,t,i){const[o,d,w,S]=this.getHeatmapColor(t,i);e.renderOptions.before.borderColor=`rgba(${o},${d},${w},${S})`}static addOrUpdateGutterHeatmapDecoration(e,t,i,o){const[d,w,S,X]=this.getHeatmapColor(e,t),{locations:re}=zi.instance.config.heatmap,he=re.includes(ta.o9.Gutter),pe=re.includes(ta.o9.Overview),_e=`${d},${w},${S},${X}`;let Ie=o.get(_e);return Ie==null?(Ie={decorationType:r.window.createTextEditorDecorationType({gutterIconPath:he?r.Uri.parse(`data:image/svg+xml,${encodeURIComponent(``)}`):void 0,gutterIconSize:he?"contain":void 0,overviewRulerLane:pe?r.OverviewRulerLane.Center:void 0,overviewRulerColor:pe?`rgba(${d},${w},${S},${X})`:void 0}),rangesOrOptions:[i]},o.set(_e,Ie)):Ie.rangesOrOptions.push(i),Ie.decorationType}static gutter(e,t,i,o){const d={renderOptions:{before:sl({},o)}};e.isUncommitted&&(d.renderOptions.before.color=o.uncommittedColor);const w=Fr.i.fromTemplate(t,e,i);return d.renderOptions.before.contentText=(0,M.vk)(w.replace(/ /g,_.NE.Space),1,1),d}static gutterRenderOptions(e,t,i,o,d){let w=0;for(const he of Object.values(d.tokenOptions))if(he!==void 0){if(he.truncateTo==null){w=-1;break}w+=he.truncateTo}w>=0&&(w+=(0,M.dz)((0,M.sX)(o,void 0)),w>0&&(w+=3));let S,X;t.enabled&&(S="solid",X=t.location==="left"?"0 0 0 2px":"0 2px 0 0");let re;if(w>=0){const he=ve.DN.getAny("editor.letterSpacing");he!=null&&he!==0?re=`calc(${w}ch + ${Math.round(w*he)+(i?13:-6)}px)`:re=`calc(${w}ch ${i?"+ 13px":"- 6px"})`}return{backgroundColor:new r.ThemeColor(_.wL.GutterBackgroundColor),borderStyle:S,borderWidth:X,color:new r.ThemeColor(_.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${i?";padding: 0 0 0 18px":""}`,width:re,uncommittedColor:new r.ThemeColor(_.wL.GutterUncommittedForegroundColor)}}static trailing(e,t,i,o=!0){const d=Fr.i.fromTemplate(t,e,lc(sl({},i),{messageTruncateAtNewLine:!0}));return{renderOptions:{after:{backgroundColor:new r.ThemeColor(_.wL.TrailingLineBackgroundColor),color:new r.ThemeColor(_.wL.TrailingLineForegroundColor),contentText:(0,M.vk)(d.replace(/ /g,_.NE.Space),1,1),fontWeight:"normal",fontStyle:"normal",textDecoration:`none;${o?"":" position: absolute;"}`}}}}static getHeatmapColor(e,t){const i=t.computeRelativeAge(e),o=e.getTime(){async function e(X,re,he,pe){const _e=re.sha;let Ie=null;async function Ve(){if(X.file==null)return;let gi;if(X.isUncommitted)b.GitRevision.isUncommittedStaged(_e)&&(gi=_e);else if(Ie=await X.getPreviousSha(),gi=Ie,gi==null)return`\`\`\`diff + ${pe.lineAt(he).text} \`\`\``;const xi=he+1,Ui=X.lines.find(Jl=>Jl.line===xi)??X.lines[0];let Wi=X.file.originalPath;Wi==null&&re.fsPath!==X.file.uri.fsPath&&(Wi=X.file.path),he=Ui.line-1;let $o=await zi.instance.git.getDiffForLine(re,he,gi,_e);return $o==null&&gi==null&&_e!==b.GitRevision.uncommittedStaged&&($o=await zi.instance.git.getDiffForLine(re,he,void 0,b.GitRevision.uncommittedStaged)),$o!=null?d($o):void 0}n(Ve,"getDiff");const dt=await Ve();if(dt==null)return;let et,bt,It;if(X.isUncommitted){const gi=await X.getPreviousComparisonUrisForLine(he,_e);if(gi?.previous==null)return;et=`[$(compare-changes)](${cn.V.getMarkdownCommandArgs({lhs:{sha:gi.previous.sha??"",uri:gi.previous.documentUri()},rhs:{sha:gi.current.sha??"",uri:gi.current.documentUri()},repoPath:X.repoPath,line:he})} "Open Changes")`,bt=gi.previous.sha==null||gi.previous.isUncommitted?`  _${b.GitRevision.shorten(gi.previous.sha,{strings:{working:"Working Tree"}})}_  ${_.NE.ArrowLeftRightLong}  `:`  [$(git-commit) ${b.GitRevision.shorten(gi.previous.sha||"")}](${cn.oc.getMarkdownCommandArgs(gi.previous.sha||"")} "Show Commit")  ${_.NE.ArrowLeftRightLong}  `,It=gi.current.sha==null||gi.current.isUncommitted?`_${b.GitRevision.shorten(gi.current.sha,{strings:{working:"Working Tree"}})}_`:`[$(git-commit) ${b.GitRevision.shorten(gi.current.sha||"")}](${cn.oc.getMarkdownCommandArgs(gi.current.sha||"")} "Show Commit")`}else et=`[$(compare-changes)](${cn.V.getMarkdownCommandArgs(X,he)} "Open Changes")`,Ie===null&&(Ie=await X.getPreviousSha()),Ie&&(bt=`  [$(git-commit) ${b.GitRevision.shorten(Ie)}](${cn.oc.getMarkdownCommandArgs(Ie)} "Show Commit")  ${_.NE.ArrowLeftRightLong} `),It=`[$(git-commit) ${X.shortSha}](${cn.oc.getMarkdownCommandArgs(X.sha)} "Show Commit")`;et=`${dt} --- Changes${bt??" added in "}${It}   |   ${et}`;const Bt=new r.MarkdownString(et,!0);return Bt.supportHtml=!0,Bt.isTrusted=!0,Bt}n(e,"changesMessage"),s.changesMessage=e;async function t(X,re,he,pe){const _e=o(pe);let Ie,Ve,dt;if(X==null)Ve="_Working Tree_",dt="_Unsaved_";else{const bt=await X.findFile(re);if(bt==null)return;Ie=`[$(compare-changes)](${cn.V.getMarkdownCommandArgs({lhs:{sha:X.sha,uri:ci.YY.fromFile(bt,re.repoPath,void 0,!0).toFileUri()},rhs:{sha:"",uri:re.toFileUri()},repoPath:re.repoPath,line:he})} "Open Changes")`,Ve=`[$(git-commit) ${X.shortSha}](${cn.oc.getMarkdownCommandArgs(X.sha)} "Show Commit")`,dt="_Working Tree_"}Ie=`${_e} --- Local Changes  ${Ve}  ${_.NE.ArrowLeftRightLong}  ${dt}${Ie==null?"":`   |   ${Ie}`}`;const et=new r.MarkdownString(Ie,!0);return et.supportHtml=!0,et.isTrusted=!0,et}n(t,"localChangesMessage"),s.localChangesMessage=t;async function i(X,re,he,pe,_e,Ie){var Ve,dt,et,bt,It;_e===null&&(_e="MMMM Do, YYYY h:mma");let Bt=X.message??X.summary;if(X.message==null&&!X.isUncommitted&&(await X.ensureFullDetails(),Bt=X.message??X.summary,(Ve=Ie?.cancellationToken)!=null&&Ve.isCancellationRequested))return new r.MarkdownString;const gi=await zi.instance.git.getRemotesWithProviders(X.repoPath,{sort:!0});if((dt=Ie?.cancellationToken)!=null&&dt.isCancellationRequested)return new r.MarkdownString;const[xi,Ui,Wi,$o]=await Promise.all([X.isUncommitted?X.getPreviousComparisonUrisForLine(he,re.sha):void 0,w(Bt,gi),((et=Ie?.pullRequests)==null?void 0:et.pr)??S(X.ref,gi,{pullRequests:((bt=Ie?.pullRequests)==null?void 0:bt.enabled)!==!1&&Fr.i.has(pe,"pullRequest","pullRequestAgo","pullRequestAgoOrDate","pullRequestDate","pullRequestState")}),zi.instance.vsls.maybeGetPresence(X.author.email)]);if((It=Ie?.cancellationToken)!=null&&It.isCancellationRequested)return new r.MarkdownString;const Jl=await Fr.i.fromTemplateAsync(pe,X,{autolinkedIssuesOrPullRequests:Ui,dateFormat:_e,editor:{line:he,uri:re},getBranchAndTagTips:Ie?.getBranchAndTagTips,markdown:!0,messageAutolinks:Ie?.autolinks,pullRequestOrRemote:Wi,presence:$o,previousLineComparisonUris:xi,remotes:gi}),ql=new r.MarkdownString(Jl,!0);return ql.supportHtml=!0,ql.isTrusted=!0,ql}n(i,"detailsMessage"),s.detailsMessage=i;function o(X){return`\`\`\`diff ${X.diff.trim()} \`\`\``}n(o,"getDiffFromHunk");function d(X,re){return re==="hunk"||re==null&&zi.instance.config.hovers.changesDiff==="hunk"?o(X.hunk):`\`\`\`diff${X.previous==null?"":` - ${X.previous.line.trim()}`}${X.current==null?"":` + ${X.current.line.trim()}`} \`\`\``}n(d,"getDiffFromHunkLine");async function w(X,re){const he=ke.Y.getNewCorrelationContext("Hovers.getAutoLinkedIssuesOrPullRequests");ke.Y.debug(he,`${_.NE.Dash} message=`);const pe=(0,B.a)();if(!zi.instance.config.hovers.autolinks.enabled||!zi.instance.config.hovers.autolinks.enhanced||!Fr.i.has(zi.instance.config.hovers.detailsMarkdownFormat,"message")){ke.Y.debug(he,`completed ${_.NE.Dot} ${(0,M.qk)(pe)} ms`);return}const _e=await zi.instance.git.getRichRemoteProvider(re);if(_e?.provider==null){ke.Y.debug(he,`completed ${_.NE.Dot} ${(0,M.qk)(pe)} ms`);return}const Ie=250;try{const Ve=await zi.instance.autolinks.getIssueOrPullRequestLinks(X,_e,{timeout:Ie});if(Ve!=null&&ke.Y.enabled(ke.i.Debug)){const dt=(0,li.QX)(Ve.values(),et=>et instanceof Yi.PK);if(dt!==0)return ke.Y.debug(he,`timed out ${_.NE.Dash} ${dt} issue/pull request queries took too long (over ${Ie} ms) ${_.NE.Dot} ${(0,M.qk)(pe)} ms`),Ve}return ke.Y.debug(he,`completed ${_.NE.Dot} ${(0,M.qk)(pe)} ms`),Ve}catch(Ve){ke.Y.error(Ve,he,`failed ${_.NE.Dot} ${(0,M.qk)(pe)} ms`);return}}n(w,"getAutoLinkedIssuesOrPullRequests");async function S(X,re,he){const pe=ke.Y.getNewCorrelationContext("Hovers.getPullRequestForCommit");ke.Y.debug(pe,`${_.NE.Dash} ref=${X}`);const _e=(0,B.a)();if(!he?.pullRequests){ke.Y.debug(pe,`completed ${_.NE.Dot} ${(0,M.qk)(_e)} ms`);return}const Ie=await zi.instance.git.getRichRemoteProvider(re,{includeDisconnected:!0});if(Ie?.provider==null){ke.Y.debug(pe,`completed ${_.NE.Dot} ${(0,M.qk)(_e)} ms`);return}const{provider:Ve}=Ie;if(!(Ve.maybeConnected??await Ve.isConnected()))return ke.Y.debug(pe,`completed ${_.NE.Dot} ${(0,M.qk)(_e)} ms`),Ie;try{const et=await zi.instance.git.getPullRequestForCommit(X,Ve,{timeout:250});return ke.Y.debug(pe,`completed ${_.NE.Dot} ${(0,M.qk)(_e)} ms`),et}catch(et){if(et instanceof Yi.PK)return ke.Y.debug(pe,`timed out ${_.NE.Dot} ${(0,M.qk)(_e)} ms`),et;ke.Y.error(et,pe,`failed ${_.NE.Dot} ${(0,M.qk)(_e)} ms`);return}}n(S,"getPullRequestForCommit")})(wn||(wn={}));var ho=Object.defineProperty,ca=Object.getOwnPropertyDescriptor,cc=n((s,e,t)=>e in s?ho(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"blameAnnotationProvider_defNormalProp"),uc=n((s,e,t,i)=>{for(var o=i>1?void 0:i?ca(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&ho(e,t,o),o},"blameAnnotationProvider_decorateClass"),ua=n((s,e,t)=>(cc(s,typeof e!="symbol"?e+"":e,t),t),"blameAnnotationProvider_publicField");const ha=2**30;class ko extends ln{constructor(e,t,i,o){super(e,t,i);this.container=o,ua(this,"blame"),ua(this,"hoverProviderDisposable"),this.blame=this.container.git.getBlame(this.trackedDocument.uri,t.document),t.document.isDirty&&i.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 t=[];let i,o;for(const he of e.lines)o!==he.sha&&(o=he.sha,i=e.commits.get(he.sha),i!=null&&t.push(i.date));t.sort((he,pe)=>he.getTime()-pe.getTime());const d=new Date;d.setDate(d.getDate()-(this.container.config.heatmap.ageThreshold||90));const w=d.getTime(),S=[],X=[];for(const he of t)he.getTime(){const pe=Array.isArray(re)?re:he.getTime()=pe[Ve]));Ve++);return Ie}}}registerHoverProviders(e){!this.container.config.hovers.enabled||!this.container.config.hovers.annotations.enabled||!e.details&&!e.changes||(this.hoverProviderDisposable=r.languages.registerHoverProvider({pattern:this.document.uri.fsPath},{provideHover:(t,i,o)=>this.provideHover(e,t,i,o)}))}async provideHover(e,t,i,o){if(this.container.config.hovers.annotations.over!=="line"&&i.character!==0||this.document.uri.toString()!==t.uri.toString())return;const d=await this.getBlame();if(d==null)return;const w=d.lines[i.line],S=d.commits.get(w.sha);if(S==null)return;const X=(await Promise.all([e.details?this.getDetailsHoverMessage(S,t):void 0,e.changes?wn.changesMessage(S,await ci.YY.fromUri(t.uri),i.line,t):void 0])).filter(re=>Boolean(re));return new r.Hover(X,t.validateRange(new r.Range(i.line,0,i.line,ha)))}async getDetailsHoverMessage(e,t){let i=this.editor.selection.active.line;const o=i+1;return i=(e.lines.find(w=>w.line===o)??e.lines[0]).originalLine-1,wn.detailsMessage(e,await ci.YY.fromUri(t.uri),i,this.container.config.hovers.detailsMarkdownFormat,this.container.config.defaultDateFormat,{autolinks:this.container.config.hovers.autolinks.enabled,pullRequests:{enabled:this.container.config.hovers.pullRequests.enabled}})}}n(ko,"BlameAnnotationProviderBase"),uc([(0,p.cM)({args:!1})],ko.prototype,"getComputedHeatmap",1);function da(s){const e=[],t=Math.floor(s.length/2),i=s.length%2?s[t].getTime():(s[t-1].getTime()+s[t].getTime())/2;let d=(s[s.length-1].getTime()-i)/5;for(let S=5;S>0;S--)e.push(i+d*S);e.push(i);const w=s[0].getTime();d=(i-w)/4;for(let S=1;S<=4;S++)e.push(i-d*S);return e}n(da,"getRelativeAgeLookupTable");var Uo=Object.defineProperty,hc=Object.defineProperties,dc=Object.getOwnPropertyDescriptor,al=Object.getOwnPropertyDescriptors,ws=Object.getOwnPropertySymbols,Wo=Object.prototype.hasOwnProperty,ll=Object.prototype.propertyIsEnumerable,fa=n((s,e,t)=>e in s?Uo(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"gutterBlameAnnotationProvider_defNormalProp"),ma=n((s,e)=>{for(var t in e||(e={}))Wo.call(e,t)&&fa(s,t,e[t]);if(ws)for(var t of ws(e))ll.call(e,t)&&fa(s,t,e[t]);return s},"gutterBlameAnnotationProvider_spreadValues"),pa=n((s,e)=>hc(s,al(e)),"gutterBlameAnnotationProvider_spreadProps"),ga=n((s,e,t,i)=>{for(var o=i>1?void 0:i?dc(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&Uo(e,t,o),o},"gutterBlameAnnotationProvider_decorateClass");const _a=2**30;class fo extends ko{constructor(e,t,i){super(ve.VP.Blame,e,t,i)}clear(){if(super.clear(),Hi.gutterBlameHighlight!=null)try{this.editor.setDecorations(Hi.gutterBlameHighlight,[])}catch{}}async onProvideAnnotation(e,t){const i=ke.Y.getCorrelationContext();this.annotationContext=e;const o=await this.getBlame();if(o==null)return!1;const d=new on.u(i),w=this.container.config.blame,S=(0,M.Gg)(w.format).reduce((Ui,Wi)=>(Ui[Wi.key]=Wi.options,Ui),Object.create(null));let X;Fr.i.has(w.format,"tips")&&(X=await this.container.git.getBranchesAndTagsTipsFn(o.repoPath));const re={dateFormat:w.dateFormat===null?this.container.config.defaultDateFormat:w.dateFormat,getBranchAndTagTips:X,tokenOptions:S},he=w.avatars,pe=this.container.config.defaultGravatarsStyle,_e=w.separateLines,Ie=jn.gutterRenderOptions(_e,w.heatmap,w.avatars,w.format,re),Ve=[],dt=new Map,et=he?new Map:void 0;let bt,It=!1,Bt,gi,xi;w.heatmap.enabled&&(xi=await this.getComputedHeatmap(o));for(const Ui of o.lines){const Wi=Ui.line-1;if(gi===Ui.sha){if(Bt==null)continue;Bt=ma({},Bt),w.compact&&!It&&(Bt.renderOptions={before:pa(ma({},Bt.renderOptions.before),{contentText:_.NE.Space.repeat((0,M.dz)(Bt.renderOptions.before.contentText))})},_e&&(Bt.renderOptions.before.textDecoration=`none;box-sizing: border-box${he?";padding: 0 0 0 18px":""}`),It=!0),Bt.range=new r.Range(Wi,0,Wi,0),Ve.push(Bt);continue}if(It=!1,gi=Ui.sha,bt=o.commits.get(Ui.sha),bt!=null){if(Bt=dt.get(Ui.sha),Bt!=null){Bt=pa(ma({},Bt),{range:new r.Range(Wi,0,Wi,0)}),Ve.push(Bt);continue}Bt=jn.gutter(bt,w.format,re,Ie),xi!=null&&jn.applyHeatmap(Bt,bt.date,xi),Bt.range=new r.Range(Wi,0,Wi,0),Ve.push(Bt),he&&bt.author.email!=null&&await this.applyAvatarDecoration(bt,Bt,pe,et),dt.set(Ui.sha,Bt)}}return d.restart({suffix:" to compute gutter blame annotations"}),Ve.length&&(this.setDecorations([{decorationType:Hi.gutterBlameAnnotation,rangesOrOptions:Ve}]),d.stop({suffix:" to apply all gutter blame annotations"})),this.registerHoverProviders(this.container.config.hovers.annotations),!0}async selection(e,t){if(e===!1||Hi.gutterBlameHighlight==null||t==null&&(t=await this.blame,!t?.lines.length))return;let i;if(e?.sha!=null)i=e.sha;else if(e?.line!=null){if(e.line>=0){const d=t.lines[e.line];i=d?.sha}}else i=(0,li.Ps)(t.commits.values()).sha;if(!i){this.editor.setDecorations(Hi.gutterBlameHighlight,[]);return}const o=(0,$.DZ)(t.lines,d=>d.sha===i?this.editor.document.validateRange(new r.Range(d.line-1,0,d.line-1,_a)):void 0);this.editor.setDecorations(Hi.gutterBlameHighlight,o)}async applyAvatarDecoration(e,t,i,o){let d=o.get(e.author.email??"");if(d==null){const w=(await e.getAvatarUri({defaultStyle:i,size:16})).toString(!0);d={contentText:"",height:"16px",width:"16px",textDecoration:`none;position:absolute;top:1px;left:5px;background:url(${encodeURI(w)});background-size:16px 16px;margin-left: 0 !important`},o.set(e.author.email??"",d)}t.renderOptions.after=d}}n(fo,"GutterBlameAnnotationProvider"),ga([(0,p.cM)()],fo.prototype,"onProvideAnnotation",1),ga([(0,p.cM)({args:!1})],fo.prototype,"selection",1);var Jr=Object.defineProperty,mo=Object.getOwnPropertyDescriptor,fc=n((s,e,t)=>e in s?Jr(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"gutterChangesAnnotationProvider_defNormalProp"),cl=n((s,e,t,i)=>{for(var o=i>1?void 0:i?mo(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&Jr(e,t,o),o},"gutterChangesAnnotationProvider_decorateClass"),va=n((s,e,t)=>(fc(s,typeof e!="symbol"?e+"":e,t),t),"gutterChangesAnnotationProvider_publicField");const wa=2**30;class bs extends ln{constructor(e,t,i){super(ve.VP.Changes,e,t);this.container=i,va(this,"state"),va(this,"hoverProviderDisposable")}mustReopen(e){var t,i;return((t=this.annotationContext)==null?void 0:t.sha)!==e?.sha||((i=this.annotationContext)==null?void 0:i.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 t,i,o,d;const w=ke.Y.getCorrelationContext();this.mustReopen(e)&&this.clear(),this.annotationContext=e;let S=this.trackedDocument.uri.sha,X=e?.sha!=null&&e.sha!==S?`${e.sha}^`:void 0,re,he=S==null&&X==null;if(he){let et=await this.container.git.getOldestUnpushedRefForFile(this.trackedDocument.uri.repoPath,this.trackedDocument.uri);if(et!=null)et=`${et}^`,re=await this.container.git.getCommitForFile(this.trackedDocument.uri.repoPath,this.trackedDocument.uri,{ref:et}),re!=null?X!=null?X=et:(S=et,X=""):he=!1;else{const bt=await this.container.git.getStatusForFile(this.trackedDocument.uri.repoPath,this.trackedDocument.uri),It=bt?.getPseudoCommits(this.container,await this.container.git.getCurrentUser(this.trackedDocument.uri.repoPath));It?.length?(re=await this.container.git.getCommitForFile(this.trackedDocument.uri.repoPath,this.trackedDocument.uri),S="HEAD"):this.trackedDocument.dirty?S="HEAD":he=!1}}if(!he){if(re=await this.container.git.getCommitForFile(this.trackedDocument.uri.repoPath,this.trackedDocument.uri,{ref:X??S}),re==null)return!1;X!=null||(S=`${re.ref}^`),X=re.ref}const pe=(await Promise.all(X==null&&this.editor.document.isDirty?[this.container.git.getDiffForFileContents(this.trackedDocument.uri,S,this.editor.document.getText()),this.container.git.getDiffForFile(this.trackedDocument.uri,S,X)]:[this.container.git.getDiffForFile(this.trackedDocument.uri,S,X)])).filter(et=>Boolean(et));if(!pe?.length)return!1;const _e=new on.u(w),Ie=new Map,Ve=e?.sha!=null&&e?.only?await this.container.git.getBlame(this.trackedDocument.uri,(t=this.editor)==null?void 0:t.document):void 0;let dt;for(const et of pe)for(const bt of et.hunks){if(Ve!=null){let gi=!0;const xi=e.sha;for(let Ui=bt.current.position.start-1;Uibt.current.count)Ui="removed";else{It--;continue}else{It--;continue}}else if(((o=gi.current)==null?void 0:o.state)==="added")((d=gi.previous)==null?void 0:d.state)==="removed"?Ui="changed":Ui="added";else if(gi?.current.state==="removed")if(bt.previous.count>bt.current.count)Ui="removed";else{It--;continue}else Ui="changed";let Wi=Ie.get(Ui);Wi==null?(Wi={decorationType:Ui==="added"?Hi.changesLineAddedAnnotation:Ui==="removed"?Hi.changesLineDeletedAnnotation:Hi.changesLineChangedAnnotation,rangesOrOptions:[{range:xi}]},Ie.set(Ui,Wi)):Wi.rangesOrOptions.push({range:xi})}}return _e.restart({suffix:" to compute recent changes annotations"}),Ie.size&&(this.setDecorations([...Ie.values()]),_e.stop({suffix:" to apply all recent changes annotations"}),dt!=null&&e?.selection!==!1&&(this.editor.selection=dt,this.editor.revealRange(dt,r.TextEditorRevealType.InCenterIfOutsideViewport))),this.state={commit:re,diffs:pe},this.registerHoverProvider(),!0}registerHoverProvider(){!this.container.config.hovers.enabled||!this.container.config.hovers.annotations.enabled||(this.hoverProviderDisposable=r.languages.registerHoverProvider({pattern:this.document.uri.fsPath},{provideHover:(e,t,i)=>this.provideHover(e,t,i)}))}async provideHover(e,t,i){if(this.state==null||this.container.config.hovers.annotations.over!=="line"&&t.character!==0)return;const{commit:o,diffs:d}=this.state;for(const w of d)for(const S of w.hunks){const X=S.state==="changed"&&S.previous.count>S.current.count;if(t.line>=S.current.position.start-1&&t.line<=S.current.position.end-(X?0:1)){const re=await wn.localChangesMessage(o,this.trackedDocument.uri,t.line,S);return re==null?void 0:new r.Hover(re,e.validateRange(new r.Range(S.current.position.start-1,0,S.current.position.end-(X?0:1),wa)))}}}}n(bs,"GutterChangesAnnotationProvider"),cl([(0,p.cM)()],bs.prototype,"onProvideAnnotation",1);var Lo=Object.defineProperty,ul=Object.getOwnPropertyDescriptor,hl=n((s,e,t,i)=>{for(var o=i>1?void 0:i?ul(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&Lo(e,t,o),o},"gutterHeatmapBlameAnnotationProvider_decorateClass");class ba extends ko{constructor(e,t,i){super(ve.VP.Heatmap,e,t,i)}async onProvideAnnotation(e,t){const i=ke.Y.getCorrelationContext();this.annotationContext=e;const o=await this.getBlame();if(o==null)return!1;const d=new on.u(i),w=new Map,S=await this.getComputedHeatmap(o);let X;for(const re of o.lines){const he=re.line-1;X=o.commits.get(re.sha),X!=null&&jn.addOrUpdateGutterHeatmapDecoration(X.date,S,new r.Range(he,0,he,0),w)}return d.restart({suffix:" to compute heatmap annotations"}),w.size&&(this.setDecorations([...w.values()]),d.stop({suffix:" to apply all heatmap annotations"})),!0}selection(e){return Promise.resolve()}}n(ba,"GutterHeatmapBlameAnnotationProvider"),hl([(0,p.cM)()],ba.prototype,"onProvideAnnotation",1);var dl=Object.defineProperty,po=n((s,e,t)=>e in s?dl(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"fileAnnotationController_defNormalProp"),bn=n((s,e,t)=>(po(s,typeof e!="symbol"?e+"":e,t),t),"fileAnnotationController_publicField"),go=(s=>(s.User="User",s.BlameabilityChanged="BlameabilityChanged",s.ColumnChanged="ColumnChanged",s.Disposing="Disposing",s.DocumentChanged="DocumentChanged",s.DocumentClosed="DocumentClosed",s))(go||{});const Hi={gutterBlameAnnotation:r.window.createTextEditorDecorationType({rangeBehavior:r.DecorationRangeBehavior.ClosedOpen,textDecoration:"none"}),gutterBlameHighlight:void 0,changesLineChangedAnnotation:void 0,changesLineAddedAnnotation:void 0,changesLineDeletedAnnotation:void 0};class ya{constructor(e){this.container=e,bn(this,"_onDidToggleAnnotations",new r.EventEmitter),bn(this,"_annotationsDisposable"),bn(this,"_annotationProviders",new Map),bn(this,"_disposable"),bn(this,"_editor"),bn(this,"_keyboardScope"),bn(this,"_toggleModes"),bn(this,"_windowAnnotationType"),this._disposable=r.Disposable.from((0,Vn.IH)(e.onReady)(this.onReady,this),ve.DN.onDidChange(this.onConfigurationChanged,this),r.window.onDidChangeActiveColorTheme(this.onThemeChanged,this)),this._toggleModes=new Map}get onDidToggleAnnotations(){return this._onDidToggleAnnotations.event}dispose(){var e,t,i,o,d,w,S;this.clearAll(),(e=Hi.gutterBlameAnnotation)==null||e.dispose(),(t=Hi.gutterBlameHighlight)==null||t.dispose(),(i=Hi.changesLineChangedAnnotation)==null||i.dispose(),(o=Hi.changesLineAddedAnnotation)==null||o.dispose(),(d=Hi.changesLineDeletedAnnotation)==null||d.dispose(),(w=this._annotationsDisposable)==null||w.dispose(),(S=this._disposable)==null||S.dispose()}onReady(){this.onConfigurationChanged()}onConfigurationChanged(e){const t=this.container.config,i=e==null;if((ve.DN.changed(e,"blame.highlight")||ve.DN.changed(e,"changes.locations"))&&this.updateDecorations(!1),ve.DN.changed(e,"blame.toggleMode")&&(this._toggleModes.set(ve.VP.Blame,t.blame.toggleMode),!i&&t.blame.toggleMode===ve.TF.File&&this.clearAll()),ve.DN.changed(e,"changes.toggleMode")&&(this._toggleModes.set(ve.VP.Changes,t.changes.toggleMode),!i&&t.changes.toggleMode===ve.TF.File&&this.clearAll()),ve.DN.changed(e,"heatmap.toggleMode")&&(this._toggleModes.set(ve.VP.Heatmap,t.heatmap.toggleMode),!i&&t.heatmap.toggleMode===ve.TF.File&&this.clearAll()),!i&&(ve.DN.changed(e,"blame")||ve.DN.changed(e,"changes")||ve.DN.changed(e,"heatmap")||ve.DN.changed(e,"hovers")||ve.DN.changed(e,"defaultDateFormat")||ve.DN.changed(e,"defaultDateSource")||ve.DN.changed(e,"defaultDateStyle")||ve.DN.changed(e,"defaultGravatarsStyle")))for(const o of this._annotationProviders.values())o!=null&&this.show(o.editor,o.annotationType??ve.VP.Blame)}onThemeChanged(e){this.updateDecorations(!0)}async onActiveTextEditorChanged(e){if(e!=null&&!(0,Yr.PH)(e))return;if(this._editor=e,this.isInWindowToggle()){await this.show(e,this._windowAnnotationType);return}const t=this.getProvider(e);t==null?((0,Di.v)(_.zf.AnnotationStatus,void 0),this.detachKeyboardHook()):((0,Di.v)(_.zf.AnnotationStatus,t.status),this.attachKeyboardHook())}onBlameStateChanged(e){if(e.blameable)return;const t=r.window.activeTextEditor;t!=null&&this.clear(t,"BlameabilityChanged")}onDirtyStateChanged(e){for(const[t,i]of this._annotationProviders)!e.document.is(i.document)||this.clearCore(t,"DocumentChanged")}onTextDocumentClosed(e){if(!!this.container.git.isTrackable(e.uri))for(const[t,i]of this._annotationProviders)i.document===e&&this.clearCore(t,"DocumentClosed")}onTextEditorViewColumnChanged(e){const t=this.getProvider(e.textEditor);if(t==null){const i=(0,li.sE)(this._annotationProviders.values(),o=>o.editor.document===e.textEditor.document);if(i==null)return;this.clearCore(i.correlationKey,"ColumnChanged");return}t.restore(e.textEditor)}onVisibleTextEditorsChanged(e){var t;for(const i of e)(t=this.getProvider(i))==null||t.restore(i)}isInWindowToggle(){return this.getToggleMode(this._windowAnnotationType)===ve.TF.Window}getToggleMode(e){return e==null?ve.TF.File:this._toggleModes.get(e)??ve.TF.File}clear(e,t="User"){return this.isInWindowToggle()?this.clearAll():this.clearCore(ln.getCorrelationKey(e),t)}async clearAll(){this._windowAnnotationType=void 0;for(const[e]of this._annotationProviders)await this.clearCore(e,"Disposing")}async getAnnotationType(e){const t=this.getProvider(e);if(t==null)return;const i=await this.container.tracker.get(e.document);if(!(i==null||!i.isBlameable))return t.annotationType}getProvider(e){if(!(e==null||e.document==null))return this._annotationProviders.get(ln.getCorrelationKey(e))}async show(e,t,i){if(this.getToggleMode(t)===ve.TF.Window){let S=this._windowAnnotationType==null;const X=!S&&this._windowAnnotationType!==t;if(this._windowAnnotationType=t,X&&(await this.clearAll(),S=!0),S)for(const re of r.window.visibleTextEditors)re!==e&&this.show(re,t)}if(e==null||(this._editor=e,!(await this.container.tracker.getOrAdd(e.document)).isBlameable))return!1;const d=this.getProvider(e);return d?.annotationType===t?(await d.provideAnnotation(i),await d.selection(i?.selection),!0):await r.window.withProgress({location:r.ProgressLocation.Window},async S=>{await(0,Di.v)(_.zf.AnnotationStatus,an.Computing);const X=this.showAnnotationsCore(d,e,t,i,S),re=await X;return e===this._editor&&await(0,Di.v)(_.zf.AnnotationStatus,re?.status),X})!=null}async toggle(e,t,i,o){if(e!=null){const S=await this.container.tracker.getOrAdd(e.document);if(t===ve.VP.Changes&&!S.isTracked||!S.isBlameable)return!1}const d=this.getProvider(e);if(d==null)return this.show(e,t,i);const w=d.annotationType!==t||d.mustReopen(i);return o===!0&&!w?!0:(this.isInWindowToggle()?await this.clearAll():await this.clearCore(d.correlationKey,"User"),w?this.show(e,t,i):!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,t){var i;const o=this._annotationProviders.get(e);o!=null&&(ke.Y.log(`${t}:`,`Clear annotations for ${e}`),this._annotationProviders.delete(e),o.dispose(),(this._annotationProviders.size===0||e===ln.getCorrelationKey(this._editor))&&(await(0,Di.v)(_.zf.AnnotationStatus,void 0),await this.detachKeyboardHook()),this._annotationProviders.size===0&&(ke.Y.log("Remove all listener registrations for annotations"),(i=this._annotationsDisposable)==null||i.dispose(),this._annotationsDisposable=void 0),this._onDidToggleAnnotations.fire())}async detachKeyboardHook(){this._keyboardScope!=null&&(await this._keyboardScope.dispose(),this._keyboardScope=void 0)}async showAnnotationsCore(e,t,i,o,d){if(d!=null){let X="annotations";switch(i){case ve.VP.Blame:X="blame annotations";break;case ve.VP.Changes:X="changes annotations";break;case ve.VP.Heatmap:X="heatmap annotations";break}d.report({message:`Computing ${X} for ${(0,A.EZ)(t.document.fileName)}`})}await this.attachKeyboardHook();const w=await this.container.tracker.getOrAdd(t.document);let S;switch(i){case ve.VP.Blame:S=new fo(t,w,this.container);break;case ve.VP.Changes:S=new bs(t,w,this.container);break;case ve.VP.Heatmap:S=new ba(t,w,this.container);break}if(!(S==null||!await S.validate())){if(e!=null&&await this.clearCore(e.correlationKey,"User"),this._annotationsDisposable==null&&this._annotationProviders.size===0&&(ke.Y.log("Add listener registrations for annotations"),this._annotationsDisposable=r.Disposable.from(r.window.onDidChangeActiveTextEditor((0,Er.Ds)(this.onActiveTextEditorChanged,50),this),r.window.onDidChangeTextEditorViewColumn(this.onTextEditorViewColumnChanged,this),r.window.onDidChangeVisibleTextEditors((0,Er.Ds)(this.onVisibleTextEditorsChanged,50),this),r.workspace.onDidCloseTextDocument(this.onTextDocumentClosed,this),this.container.tracker.onDidChangeBlameState(this.onBlameStateChanged,this),this.container.tracker.onDidChangeDirtyState(this.onDirtyStateChanged,this))),this._annotationProviders.set(S.correlationKey,S),await S.provideAnnotation(o))return this._onDidToggleAnnotations.fire(),S;await this.clearCore(S.correlationKey,"Disposing")}}updateDecorations(e){var t;const i=e?Object.entries(Hi):void 0;if(this.updateHighlightDecoration(),this.updateChangedDecorations(),!e)return;const o=new Map;for(const[d,w]of i){if(w==null)continue;const S=Hi[d]??null;w!==S&&o.set(w,Hi[d]??null)}if(o.size!==0)for(const d of r.window.visibleTextEditors)(t=this.getProvider(d))==null||t.refresh(o)}updateChangedDecorations(){var e,t,i;(e=Hi.changesLineAddedAnnotation)==null||e.dispose(),(t=Hi.changesLineChangedAnnotation)==null||t.dispose(),(i=Hi.changesLineDeletedAnnotation)==null||i.dispose();const{locations:o}=this.container.config.changes;let d,w,S;switch(r.window.activeColorTheme.kind){case r.ColorThemeKind.Light:d="#48985D",w="#2090D3",S="#E51400";break;case r.ColorThemeKind.HighContrast:d="#487E02",w="#1B81A8",S="#F14C4C";break;default:d="#487E02",w="#1B81A8",S="#F14C4C";break}Hi.changesLineAddedAnnotation=r.window.createTextEditorDecorationType({gutterIconPath:o.includes(ve.hp.Gutter)?r.Uri.parse(`data:image/svg+xml,${encodeURIComponent(``)}`):void 0,gutterIconSize:"contain",overviewRulerLane:r.OverviewRulerLane.Left,overviewRulerColor:o.includes(ve.hp.Overview)?new r.ThemeColor("editorOverviewRuler.addedForeground"):void 0}),Hi.changesLineChangedAnnotation=r.window.createTextEditorDecorationType({gutterIconPath:o.includes(ve.hp.Gutter)?r.Uri.parse(`data:image/svg+xml,${encodeURIComponent(``)}`):void 0,gutterIconSize:"contain",overviewRulerLane:r.OverviewRulerLane.Left,overviewRulerColor:o.includes(ve.hp.Overview)?new r.ThemeColor("editorOverviewRuler.modifiedForeground"):void 0}),Hi.changesLineDeletedAnnotation=r.window.createTextEditorDecorationType({gutterIconPath:o.includes(ve.hp.Gutter)?r.Uri.parse(`data:image/svg+xml,${encodeURIComponent(``)}`):void 0,gutterIconSize:"contain",overviewRulerLane:r.OverviewRulerLane.Left,overviewRulerColor:o.includes(ve.hp.Overview)?new r.ThemeColor("editorOverviewRuler.deletedForeground"):void 0})}updateHighlightDecoration(){var e;(e=Hi.gutterBlameHighlight)==null||e.dispose(),Hi.gutterBlameHighlight=void 0;const{highlight:t}=this.container.config.blame;if(t.enabled){const{locations:i}=t,o="#00bcf2",d=i.includes(ve.y0.Gutter)?r.Uri.parse(`data:image/svg+xml,${encodeURIComponent(``)}`):void 0;Hi.gutterBlameHighlight=r.window.createTextEditorDecorationType({gutterIconPath:d,gutterIconSize:"contain",isWholeLine:!0,overviewRulerLane:r.OverviewRulerLane.Right,backgroundColor:i.includes(ve.y0.Line)?new r.ThemeColor(_.wL.LineHighlightBackgroundColor):void 0,overviewRulerColor:i.includes(ve.y0.Overview)?new r.ThemeColor(_.wL.LineHighlightOverviewRulerColor):void 0})}}}n(ya,"FileAnnotationController");var fl=Object.defineProperty,Ca=Object.getOwnPropertyDescriptor,ml=n((s,e,t)=>e in s?fl(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"lineAnnotationController_defNormalProp"),Yn=n((s,e,t,i)=>{for(var o=i>1?void 0:i?Ca(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&fl(e,t,o),o},"lineAnnotationController_decorateClass"),Kn=n((s,e,t)=>(ml(s,typeof e!="symbol"?e+"":e,t),t),"lineAnnotationController_publicField");const Pa=r.window.createTextEditorDecorationType({after:{margin:"0 0 0 3em",textDecoration:"none"},rangeBehavior:r.DecorationRangeBehavior.ClosedOpen}),pl=2**30;class un{constructor(e){this.container=e,Kn(this,"_cancellation"),Kn(this,"_disposable"),Kn(this,"_editor"),Kn(this,"_enabled",!1),Kn(this,"_suspended",!1),this._disposable=r.Disposable.from((0,Vn.IH)(e.onReady)(this.onReady,this),ve.DN.onDidChange(this.onConfigurationChanged,this),e.fileAnnotations.onDidToggleAnnotations(this.onFileAnnotationsToggled,this),Mn.Vy.onDidChange(()=>void this.refresh(r.window.activeTextEditor)))}dispose(){this.clearAnnotations(this._editor),this.container.lineTracker.unsubscribe(this),this._disposable.dispose()}onReady(){this.onConfigurationChanged()}onConfigurationChanged(e){!ve.DN.changed(e,"currentLine")||(ve.DN.changed(e,"currentLine.enabled")&&(this.container.config.currentLine.enabled?(this._enabled=!0,this.resume()):(this._enabled=!1,this.setLineTracker(!1))),this.refresh(r.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(r.window.activeTextEditor)}clear(e){var t;(t=this._cancellation)==null||t.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(Pa,[])}async getPullRequests(e,t,{timeout:i}={}){if(t.length===0)return;const o=await this.container.git.getRichRemoteProvider(e);if(o?.provider==null)return;const d=new Set;for(const[,X]of t)d.add(X.ref);if(d.size===0)return;const{provider:w}=o,S=await(0,Yi.xu)(d.values(),X=>this.container.git.getPullRequestForCommit(X,w),i);if(!(S.size===0||(0,li.yW)(S.values(),X=>X==null)))return S}async refresh(e,t){var i;if(e==null&&this._editor==null)return;const o=ke.Y.getCorrelationContext(),d=this.container.lineTracker.selections;if(e==null||d==null||!(0,Yr.PH)(e)){o!=null&&(o.exitDetails=` ${_.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 w=this.container.config.currentLine;if(this.suspended){o!=null&&(o.exitDetails=` ${_.NE.Dot} Skipped because the controller is suspended`),this.clear(e);return}const S=await this.container.tracker.getOrAdd(e.document);if(!S.isBlameable&&this.suspended){o!=null&&(o.exitDetails=` ${_.NE.Dot} Skipped because the ${this.suspended?"controller is suspended":`document(${S.uri.toString(!0)}) is not blameable`}`),this.clear(e);return}if(e.document==null||!this.container.lineTracker.includes(d)){o!=null&&(o.exitDetails=` ${_.NE.Dot} Skipped because the ${e.document==null?"editor is gone":`selection(s)=${d.map(Ve=>`[${Ve.anchor}-${Ve.active}]`).join()} are no longer current`}`);return}o!=null&&(o.exitDetails=` ${_.NE.Dot} selection(s)=${d.map(Ve=>`[${Ve.anchor}-${Ve.active}]`).join()}`);const X=[...(0,li.DZ)(d,Ve=>{const dt=this.container.lineTracker.getState(Ve.active);if(dt?.commit==null){ke.Y.debug(o,`Line ${Ve.active} returned no commit`);return}return[Ve.active,dt.commit]})],re=S.uri.repoPath,he=100,[pe,_e]=await Promise.all([Fr.i.has(w.format,"tips")?this.container.git.getBranchesAndTagsTipsFn(re):void 0,re!=null&&w.pullRequests.enabled&&Fr.i.has(w.format,"pullRequest","pullRequestAgo","pullRequestAgoOrDate","pullRequestDate","pullRequestState")?t?.prs??this.getPullRequests(re,X.filter(([,Ve])=>!Ve.isUncommitted),{timeout:he}):void 0]);_e!=null&&((i=this._cancellation)==null||i.cancel(),this._cancellation=new r.CancellationTokenSource,this.waitForAnyPendingPullRequests(e,_e,this._cancellation.token,he,o));const Ie=[];for(const[Ve,dt]of X){const et=jn.trailing(dt,w.format,{dateFormat:w.dateFormat===null?this.container.config.defaultDateFormat:w.dateFormat,getBranchAndTagTips:pe,pullRequestOrRemote:_e?.get(dt.ref),pullRequestPendingMessage:`PR ${_.NE.Ellipsis}`},w.scrollable);et.range=e.document.validateRange(new r.Range(Ve,pl,Ve,pl)),Ie.push(et)}e.setDecorations(Pa,Ie)}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,t,i,o,d){const w=(0,li.QX)(t.values(),X=>X instanceof Yi.PK);if(i.isCancellationRequested||w===0)return;ke.Y.debug(d,`${_.NE.Dot} ${w} pull request queries took too long (over ${o} ms)`);const S=new Map;for(const[X,re]of t)S.set(X,re instanceof Yi.PK?await re.promise:re);i.isCancellationRequested||e!==this._editor||(ke.Y.debug(d,`${_.NE.Dot} ${w} pull request queries completed; refreshing...`),this.refresh(e,{prs:S}))}}n(un,"LineAnnotationController"),Yn([(0,p.cM)()],un.prototype,"resume",1),Yn([(0,p.cM)()],un.prototype,"suspend",1),Yn([(0,p.fF)({args:{0:s=>{var e,t;return`editor=${(e=s.editor)==null?void 0:e.document.uri.toString(!0)}, selections=${(t=s.selections)==null?void 0:t.map(i=>`[${i.anchor}-${i.active}]`).join(",")}, pending=${Boolean(s.pending)}, reason=${s.reason}`}}})],un.prototype,"onActiveLinesChanged",1),Yn([(0,p.fF)({args:!1,singleLine:!0})],un.prototype,"clear",1),Yn([(0,p.cM)({args:!1})],un.prototype,"toggle",1),Yn([(0,p.fF)({args:!1})],un.prototype,"refresh",1);var _o=v(5647),yi=v(1161),Go=Object.defineProperty,gl=n((s,e,t)=>e in s?Go(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"codeLensProvider_defNormalProp"),Da=n((s,e,t)=>(gl(s,typeof e!="symbol"?e+"":e,t),t),"codeLensProvider_publicField");class ys extends r.CodeLens{constructor(e,t,i,o,d,w,S,X,re,he){super(X,he);this.languageId=e,this.symbol=t,this.uri=i,this.dateFormat=o,this.blame=d,this.blameRange=w,this.isFullRange=S,this.desiredCommand=re}getBlame(){var e;return(e=this.blame)==null?void 0:e.call(this)}}n(ys,"GitRecentChangeCodeLens");class Ho extends r.CodeLens{constructor(e,t,i,o,d,w,S,X){super(S);this.languageId=e,this.symbol=t,this.uri=i,this.blame=o,this.blameRange=d,this.isFullRange=w,this.desiredCommand=X}getBlame(){return this.blame()}}n(Ho,"GitAuthorsCodeLens");class Vo{constructor(e){this.container=e,Da(this,"_onDidChangeCodeLenses",new r.EventEmitter)}get onDidChangeCodeLenses(){return this._onDidChangeCodeLenses.event}reset(e){this._onDidChangeCodeLenses.fire()}async provideCodeLenses(e,t){var i;if(e.isDirty&&(0,Yr.pt)(e.uri))return[];const o=await this.container.tracker.getOrAdd(e);if(!o.isBlameable)return[];let d=!1;if(e.isDirty)if(o.isDirtyIdle){const Ve=this.container.config.advanced.blame.sizeThresholdAfterEdit;Ve>0&&e.lineCount>Ve&&(d=!0)}else d=!0;const w=ve.DN.get("codeLens",e);let S=(i=w.scopesByLanguage)==null?void 0:i.find(Ve=>{var dt;return((dt=Ve.language)==null?void 0:dt.toLowerCase())===e.languageId});S==null&&(S={language:e.languageId}),S.scopes==null&&(S.scopes=w.scopes),S.symbolScopes==null&&(S.symbolScopes=w.symbolScopes),S.symbolScopes=S.symbolScopes!=null?S.symbolScopes=S.symbolScopes.map(Ve=>Ve.toLowerCase()):[];const X=[],re=o.uri;let he,pe;if(d){if(S.scopes.length!==1||!S.scopes.includes(ve.Uy.Document)){let Ve;if([Ve,pe]=await Promise.all([this.container.git.isTracked(re),(0,yi.dO)(_.nA.ExecuteDocumentSymbolProvider,e.uri)]),!Ve)return X}}else if(t.isCancellationRequested||(S.scopes.length===1&&S.scopes.includes(ve.Uy.Document)?he=await this.container.git.getBlame(re,e):[he,pe]=await Promise.all([this.container.git.getBlame(re,e),(0,yi.dO)(_.nA.ExecuteDocumentSymbolProvider,e.uri)]),he==null||he?.lines.length===0))return X;if(t.isCancellationRequested)return X;const _e=(0,Er.IH)(()=>e.validateRange(new r.Range(0,0,1e6,1e6))),Ie=d?{command:void 0,title:this.getDirtyTitle(w)}:void 0;if(pe!==void 0){ke.Y.log("GitCodeLensProvider.provideCodeLenses:",`${pe.length} symbol(s) found`);for(const Ve of pe)this.provideCodeLens(X,e,Ve,S,_e,he,re,w,d,Ie)}if((S.scopes.includes(ve.Uy.Document)||S.symbolScopes.includes("file"))&&!S.symbolScopes.includes("!file")&&X.find(Ve=>Ve.range.start.line===0&&Ve.range.end.line===0)==null){const Ve=_e();let dt;if(d||w.recentChange.enabled){d||(dt=(0,Er.IH)(()=>this.container.git.getBlameRange(he,re,Ve)));const et=new r.SymbolInformation(re.fileName,r.SymbolKind.File,"",new r.Location(re.documentUri(),new r.Range(0,0,0,Ve.start.character)));X.push(new ys(e.languageId,et,re,w.dateFormat,dt,Ve,!0,hn(et),w.recentChange.command,Ie))}if(!d&&w.authors.enabled){dt===void 0&&(dt=(0,Er.IH)(()=>this.container.git.getBlameRange(he,re,Ve)));const et=new r.SymbolInformation(re.fileName,r.SymbolKind.File,"",new r.Location(re.documentUri(),new r.Range(0,1,0,Ve.start.character)));X.push(new Ho(e.languageId,et,re,dt,Ve,!0,hn(et),w.authors.command))}}return X}getValidateSymbolRange(e,t,i,o){let d=!1,w;const S=r.SymbolKind[e.kind].toLowerCase();switch(e.kind){case r.SymbolKind.File:(t.scopes.includes(ve.Uy.Containers)||t.symbolScopes.includes(S))&&(d=!t.symbolScopes.includes(`!${S}`)),d&&(w=i());break;case r.SymbolKind.Package:(t.scopes.includes(ve.Uy.Containers)||t.symbolScopes.includes(S))&&(d=!t.symbolScopes.includes(`!${S}`)),d&&(w=hn(e),w.start.line===0&&w.end.line===0&&(w=i()));break;case r.SymbolKind.Class:case r.SymbolKind.Interface:case r.SymbolKind.Module:case r.SymbolKind.Namespace:case r.SymbolKind.Struct:(t.scopes.includes(ve.Uy.Containers)||t.symbolScopes.includes(S))&&(w=hn(e),d=!t.symbolScopes.includes(`!${S}`)&&(o||!w.isSingleLine));break;case r.SymbolKind.Constructor:case r.SymbolKind.Enum:case r.SymbolKind.Function:case r.SymbolKind.Method:case r.SymbolKind.Property:(t.scopes.includes(ve.Uy.Blocks)||t.symbolScopes.includes(S))&&(w=hn(e),d=!t.symbolScopes.includes(`!${S}`)&&(o||!w.isSingleLine));break;case r.SymbolKind.String:(t.symbolScopes.includes(S)||t.language==="markdown"&&t.scopes.includes(ve.Uy.Containers))&&(w=hn(e),d=!t.symbolScopes.includes(`!${S}`)&&(o||!w.isSingleLine));break;default:t.symbolScopes.includes(S)&&(w=hn(e),d=!t.symbolScopes.includes(`!${S}`)&&(o||!w.isSingleLine));break}return d?w??hn(e):void 0}provideCodeLens(e,t,i,o,d,w,S,X,re,he){try{const pe=this.getValidateSymbolRange(i,o,d,X.includeSingleLineSymbols);if(pe===void 0)return;const _e=t.lineAt(hn(i).start);if(e.length&&e[e.length-1].range.start.line===_e.lineNumber)return;let Ie=0,Ve;if((re||X.recentChange.enabled)&&(re||(Ve=(0,Er.IH)(()=>this.container.git.getBlameRange(w,S,pe))),e.push(new ys(t.languageId,i,S,X.dateFormat,Ve,pe,!1,_e.range.with(new r.Position(_e.range.start.line,Ie)),X.recentChange.command,he)),Ie++),X.authors.enabled){let dt=!pe.isSingleLine;if(!dt&&t.languageId==="csharp")switch(i.kind){case r.SymbolKind.File:break;case r.SymbolKind.Package:case r.SymbolKind.Module:case r.SymbolKind.Namespace:case r.SymbolKind.Class:case r.SymbolKind.Interface:case r.SymbolKind.Constructor:case r.SymbolKind.Method:case r.SymbolKind.Function:case r.SymbolKind.Enum:dt=!0;break}dt&&!re&&(Ve===void 0&&(Ve=(0,Er.IH)(()=>this.container.git.getBlameRange(w,S,pe))),e.push(new Ho(t.languageId,i,S,Ve,pe,!1,_e.range.with(new r.Position(_e.range.start.line,Ie)),X.authors.command)))}}finally{if(jo(i))for(const pe of i.children)this.provideCodeLens(e,t,pe,o,d,w,S,X,re,he)}}resolveCodeLens(e,t){return e instanceof ys?this.resolveGitRecentChangeCodeLens(e,t):e instanceof Ho?this.resolveGitAuthorsCodeLens(e,t):Promise.reject(void 0)}resolveGitRecentChangeCodeLens(e,t){const i=e.getBlame();if(i===void 0)return e;const o=(0,li.Ps)(i.commits.values());let d=`${o.author.name}, ${e.dateFormat==null?o.formattedDate:o.formatDate(e.dateFormat)}`;if(this.container.config.debug&&(d+=` [${e.languageId}: ${r.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 (${o.shortSha})]`),e.desiredCommand===!1)return this.applyCommandWithNoClickAction(d,e);switch(e.desiredCommand){case ve.N4.CopyRemoteCommitUrl:return this.applyCopyOrOpenCommitOnRemoteCommand(d,e,o,!0);case ve.N4.CopyRemoteFileUrl:return this.applyCopyOrOpenFileOnRemoteCommand(d,e,o,!0);case ve.N4.DiffWithPrevious:return this.applyDiffWithPreviousCommand(d,e,o);case ve.N4.OpenCommitOnRemote:return this.applyCopyOrOpenCommitOnRemoteCommand(d,e,o);case ve.N4.OpenFileOnRemote:return this.applyCopyOrOpenFileOnRemoteCommand(d,e,o);case ve.N4.RevealCommitInView:return this.applyRevealCommitInViewCommand(d,e,o);case ve.N4.ShowCommitsInView:return this.applyShowCommitsInViewCommand(d,e,i,o);case ve.N4.ShowQuickCommitDetails:return this.applyShowQuickCommitDetailsCommand(d,e,o);case ve.N4.ShowQuickCommitFileDetails:return this.applyShowQuickCommitFileDetailsCommand(d,e,o);case ve.N4.ShowQuickCurrentBranchHistory:return this.applyShowQuickCurrentBranchHistoryCommand(d,e);case ve.N4.ShowQuickFileHistory:return this.applyShowQuickFileHistoryCommand(d,e);case ve.N4.ToggleFileBlame:return this.applyToggleFileBlameCommand(d,e);case ve.N4.ToggleFileChanges:return this.applyToggleFileChangesCommand(d,e,o);case ve.N4.ToggleFileChangesOnly:return this.applyToggleFileChangesCommand(d,e,o,!0);case ve.N4.ToggleFileHeatmap:return this.applyToggleFileHeatmapCommand(d,e);default:return e}}resolveGitAuthorsCodeLens(e,t){const i=e.getBlame();if(i===void 0)return e;const o=i.authors.size,d=(0,li.Ps)(i.authors.values()).name;let w=`${o} ${o>1?"authors":"author"} (${d}${o>1?" and others":""})`;if(this.container.config.debug&&(w+=` [${e.languageId}: ${r.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,li.v_)((0,li.UI)(i.authors.values(),X=>X.name),", ")})]`),e.desiredCommand===!1)return this.applyCommandWithNoClickAction(w,e);const S=(0,li.sE)(i.commits.values(),X=>X.author.name===d)??(0,li.Ps)(i.commits.values());switch(e.desiredCommand){case ve.N4.CopyRemoteCommitUrl:return this.applyCopyOrOpenCommitOnRemoteCommand(w,e,S,!0);case ve.N4.CopyRemoteFileUrl:return this.applyCopyOrOpenFileOnRemoteCommand(w,e,S,!0);case ve.N4.DiffWithPrevious:return this.applyDiffWithPreviousCommand(w,e,S);case ve.N4.OpenCommitOnRemote:return this.applyCopyOrOpenCommitOnRemoteCommand(w,e,S);case ve.N4.OpenFileOnRemote:return this.applyCopyOrOpenFileOnRemoteCommand(w,e,S);case ve.N4.RevealCommitInView:return this.applyRevealCommitInViewCommand(w,e,S);case ve.N4.ShowCommitsInView:return this.applyShowCommitsInViewCommand(w,e,i);case ve.N4.ShowQuickCommitDetails:return this.applyShowQuickCommitDetailsCommand(w,e,S);case ve.N4.ShowQuickCommitFileDetails:return this.applyShowQuickCommitFileDetailsCommand(w,e,S);case ve.N4.ShowQuickCurrentBranchHistory:return this.applyShowQuickCurrentBranchHistoryCommand(w,e);case ve.N4.ShowQuickFileHistory:return this.applyShowQuickFileHistoryCommand(w,e);case ve.N4.ToggleFileBlame:return this.applyToggleFileBlameCommand(w,e);case ve.N4.ToggleFileChanges:return this.applyToggleFileChangesCommand(w,e,S);case ve.N4.ToggleFileChangesOnly:return this.applyToggleFileChangesCommand(w,e,S,!0);case ve.N4.ToggleFileHeatmap:return this.applyToggleFileHeatmapCommand(w,e);default:return e}}applyDiffWithPreviousCommand(e,t,i){return t.command=(0,yi._N)({title:e,command:_.Gh.DiffWithPrevious,arguments:[void 0,{commit:i,uri:t.uri.toFileUri()}]}),t}applyCopyOrOpenCommitOnRemoteCommand(e,t,i,o=!1){return t.command=(0,yi._N)({title:e,command:_.Gh.OpenOnRemote,arguments:[{resource:{type:Mn.JD.Commit,sha:i.sha},repoPath:i.repoPath,clipboard:o}]}),t}applyCopyOrOpenFileOnRemoteCommand(e,t,i,o=!1){var d;return t.command=(0,yi._N)({title:e,command:_.Gh.OpenOnRemote,arguments:[{resource:{type:Mn.JD.Revision,fileName:((d=i.file)==null?void 0:d.path)??"",sha:i.sha},repoPath:i.repoPath,clipboard:o}]}),t}applyRevealCommitInViewCommand(e,t,i){return t.command=(0,yi._N)({title:e,command:i?.isUncommitted?"":ve.N4.RevealCommitInView,arguments:[t.uri.toFileUri(),{commit:i,sha:i===void 0?void 0:i.sha}]}),t}applyShowCommitsInViewCommand(e,t,i,o){let d;return o===void 0?d=[...(0,li.DZ)(i.commits.values(),w=>w.isUncommitted?void 0:w.ref)]:d=[o.ref],t.command=(0,yi._N)({title:e,command:d.length===0?"":_.Gh.ShowCommitsInView,arguments:[{repoPath:i.repoPath,refs:d}]}),t}applyShowQuickCommitDetailsCommand(e,t,i){return t.command=(0,yi._N)({title:e,command:i?.isUncommitted?"":ve.N4.ShowQuickCommitDetails,arguments:[t.uri.toFileUri(),{commit:i,sha:i===void 0?void 0:i.sha}]}),t}applyShowQuickCommitFileDetailsCommand(e,t,i){return t.command=(0,yi._N)({title:e,command:i?.isUncommitted?"":ve.N4.ShowQuickCommitFileDetails,arguments:[t.uri.toFileUri(),{commit:i,sha:i===void 0?void 0:i.sha}]}),t}applyShowQuickCurrentBranchHistoryCommand(e,t){return t.command=(0,yi._N)({title:e,command:ve.N4.ShowQuickCurrentBranchHistory,arguments:[t.uri.toFileUri()]}),t}applyShowQuickFileHistoryCommand(e,t){return t.command=(0,yi._N)({title:e,command:ve.N4.ShowQuickFileHistory,arguments:[t.uri.toFileUri(),{range:t.isFullRange?void 0:t.blameRange}]}),t}applyToggleFileBlameCommand(e,t){return t.command=(0,yi._N)({title:e,command:_.Gh.ToggleFileBlame,arguments:[t.uri.toFileUri()]}),t}applyToggleFileChangesCommand(e,t,i,o){return t.command=(0,yi._N)({title:e,command:_.Gh.ToggleFileChanges,arguments:[t.uri.toFileUri(),{type:ve.VP.Changes,context:{sha:i.sha,only:o,selection:!1}}]}),t}applyToggleFileHeatmapCommand(e,t){return t.command=(0,yi._N)({title:e,command:_.Gh.ToggleFileHeatmap,arguments:[t.uri.toFileUri()]}),t}applyCommandWithNoClickAction(e,t){return t.command={title:e,command:""},t}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}}n(Vo,"GitCodeLensProvider"),Da(Vo,"selector",[{scheme:_.sN.File},{scheme:_.sN.Git},{scheme:_.sN.GitLens},{scheme:_.sN.PRs},{scheme:_.sN.Vsls},{scheme:_.sN.VslsScc},{scheme:_.sN.Virtual},{scheme:_.sN.GitHub}]);function hn(s){return jo(s)?s.range:s.location.range}n(hn,"getRangeFromSymbol");function jo(s){return(0,Er.is)(s,"children")}n(jo,"isDocumentSymbol");var Sa=Object.defineProperty,mc=n((s,e,t)=>e in s?Sa(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"codeLensController_defNormalProp"),Cs=n((s,e,t)=>(mc(s,typeof e!="symbol"?e+"":e,t),t),"codeLensController_publicField");class qr{constructor(e){this.container=e,Cs(this,"_canToggle",!1),Cs(this,"_disposable"),Cs(this,"_provider"),Cs(this,"_providerDisposable"),this._disposable=r.Disposable.from((0,Vn.IH)(e.onReady)(this.onReady,this),ve.DN.onDidChange(this.onConfigurationChanged,this))}dispose(){var e,t;(e=this._providerDisposable)==null||e.dispose(),(t=this._disposable)==null||t.dispose()}onReady(){this.onConfigurationChanged()}onConfigurationChanged(e){var t;if(ve.DN.changed(e,"codeLens")||ve.DN.changed(e,"defaultDateFormat")||ve.DN.changed(e,"defaultDateSource")||ve.DN.changed(e,"defaultDateStyle")){e!=null&&ke.Y.log("CodeLens config changed; resetting CodeLens provider");const i=this.container.config.codeLens;i.enabled&&(i.recentChange.enabled||i.authors.enabled)?this.ensureProvider():((t=this._providerDisposable)==null||t.dispose(),this._provider=void 0),this._canToggle=i.recentChange.enabled||i.authors.enabled,(0,Di.v)(_.zf.DisabledToggleCodeLens,!this._canToggle)}}onBlameStateChanged(e){this._provider===void 0||!e.blameable||(ke.Y.log("Blame state changed; resetting CodeLens provider"),this._provider.reset("saved"))}onDirtyIdleTriggered(e){if(this._provider===void 0||!e.document.isBlameable)return;const t=this.container.config.advanced.blame.sizeThresholdAfterEdit;t>0&&e.document.lineCount>t||(ke.Y.log("Dirty idle triggered; resetting CodeLens provider"),this._provider.reset("idle"))}toggleCodeLens(){var e;if(!!this._canToggle){if(ke.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 Vo(this.container),this._providerDisposable=r.Disposable.from(r.languages.registerCodeLensProvider(Vo.selector,this._provider),this.container.tracker.onDidChangeBlameState(this.onBlameStateChanged,this),this.container.tracker.onDidTriggerDirtyIdle(this.onDirtyIdleTriggered,this))}}n(qr,"GitCodeLensController");var Ra=Object.defineProperty,_l=n((s,e,t)=>e in s?Ra(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"searchTree_defNormalProp"),fi=n((s,e,t)=>(_l(s,typeof e!="symbol"?e+"":e,t),t),"searchTree_publicField");const vl={done:!0,value:void 0};class Oa{constructor(){fi(this,"_value",""),fi(this,"_pos",0)}reset(e){return this._value=e,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos0)o.left||(o.left=new vo,o.left.segment=i.value()),o=o.left;else if(w<0)o.right||(o.right=new vo,o.right.segment=i.value()),o=o.right;else if(i.hasNext())i.next(),o.mid||(o.mid=new vo,o.mid.segment=i.value()),o=o.mid;else break}const d=o.value;return o.value=t,o.key=e,d}get(e){var t;return(t=this._getNode(e))==null?void 0:t.value}_getNode(e){const t=this._iter.reset(e);let i=this._root;for(;i;){const o=t.cmp(i.segment);if(o>0)i=i.left;else if(o<0)i=i.right;else if(t.hasNext())t.next(),i=i.mid;else break}return i}has(e){const t=this._getNode(e);return!(t?.value===void 0&&t?.mid===void 0)}delete(e){return this._delete(e,!1)}deleteSuperstr(e){return this._delete(e,!0)}_delete(e,t){const i=this._iter.reset(e),o=[];let d=this._root;for(;d;){const w=i.cmp(d.segment);if(w>0)o.push([1,d]),d=d.left;else if(w<0)o.push([-1,d]),d=d.right;else if(i.hasNext())i.next(),o.push([0,d]),d=d.mid;else{for(t?(d.left=void 0,d.mid=void 0,d.right=void 0):d.value=void 0;o.length>0&&d.isEmpty();){const[S,X]=o.pop();switch(S){case 1:X.left=void 0;break;case 0:X.mid=void 0;break;case-1:X.right=void 0;break}d=X}break}}}findSubstr(e){const t=this._iter.reset(e);let i=this._root,o;for(;i;){const d=t.cmp(i.segment);if(d>0)i=i.left;else if(d<0)i=i.right;else if(t.hasNext())t.next(),o=i.value||o,i=i.mid;else break}return i?.value||o}findSuperstr(e,t=!1){const i=this._iter.reset(e);let o=this._root;for(;o;){const d=i.cmp(o.segment);if(d>0)o=o.left;else if(d<0)o=o.right;else if(i.hasNext())i.next(),o=o.mid;else return o.mid?(o=o.mid,{[Symbol.iterator]:()=>this._nodeIterator(o,t)}):void 0}}_nodeIterator(e,t=!1){let i,o,d;return{next:n(()=>(d||(d=[],o=0,this._forEach(e,S=>d.push(S),t)),o>=d.length?vl:(i?i.value=d[o++]:i={done:!1,value:d[o++]},i)),"next")}}forEach(e){this._forEach(this._root,e)}_forEach(e,t,i=!1){e!==void 0&&(this._forEach(e.left,t,i),e.value&&t(e.value,e.key),i||this._forEach(e.mid,t,i),this._forEach(e.right,t,i))}any(){return this._root!==void 0&&!this._root.isEmpty()}count(e){return this._root===void 0||this._root.isEmpty()?0:(0,li.QX)(this.entries(),e===void 0?void 0:([,t])=>e(t))}entries(){return this._iterator(this._root)}values(){return(0,li.UI)(this.entries(),([,e])=>e)}highlander(){if(this._root===void 0||this._root.isEmpty())return;const e=this.entries();let t=0,i,o;for(;i=e.next(),!i.done;)if(o=i.value,t++,t>1)return;return o}some(e){return this._root===void 0||this._root.isEmpty()?!1:(0,li.G)(this.entries(),([,t])=>e(t))}*[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))}}n(dn,"TernarySearchTree");var Mr=Object.defineProperty,wl=Object.getOwnPropertyDescriptor,pc=n((s,e,t)=>e in s?Mr(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"fsProvider_defNormalProp"),Ko=n((s,e,t,i)=>{for(var o=i>1?void 0:i?wl(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&Mr(e,t,o),o},"fsProvider_decorateClass"),Ps=n((s,e,t)=>(pc(s,typeof e!="symbol"?e+"":e,t),t),"fsProvider_publicField");const bl=new Uint8Array(0);function zo(s){const e=ci.YY.is(s)?s:ci.YY.fromRevisionUri(s);return{path:e.relativePath,ref:e.sha,repoPath:e.repoPath}}n(zo,"fromGitLensFSUri");class wo{constructor(e){this.container=e,Ps(this,"_disposable"),Ps(this,"_searchTreeMap",new Map),Ps(this,"_onDidChangeFile",new r.EventEmitter),this._disposable=r.Disposable.from(r.workspace.registerFileSystemProvider(_.sN.GitLens,this,{isCaseSensitive:zr.IJ,isReadonly:!0}))}dispose(){this._disposable.dispose()}get onDidChangeFile(){return this._onDidChangeFile.event}copy(){throw r.FileSystemError.NoPermissions}createDirectory(){throw r.FileSystemError.NoPermissions}delete(){throw r.FileSystemError.NoPermissions}async readDirectory(e){const{path:t,ref:i,repoPath:o}=zo(e),d=await this.getTree(t,i,o);if(d===void 0)throw r.FileSystemError.FileNotFound(e);return[...(0,li.UI)(d,S=>[t!=null&&t.length!==0?(0,A.AH)((0,A.Gf)(t,S.path)):S.path,Ds(S.type)])]}async readFile(e){const{path:t,ref:i,repoPath:o}=zo(e);if(i===b.GitRevision.deletedOrMissing)return bl;const d=await this.container.git.getRevisionContent(o,t,i);return d??bl}rename(){throw r.FileSystemError.NoPermissions}async stat(e){const{path:t,ref:i,repoPath:o}=zo(e);if(i===b.GitRevision.deletedOrMissing)return{type:r.FileType.File,size:0,ctime:0,mtime:0};let d;const w=this._searchTreeMap.get(i);if(w!==void 0)d=(await w).get(`/~/${t}`);else{if(t==null||t.length===0){if(await this.getTree(t,i,o)===void 0)throw r.FileSystemError.FileNotFound(e);return{type:r.FileType.Directory,size:0,ctime:0,mtime:0}}d=await this.container.git.getTreeEntryForRevision(o,t,i)}if(d===void 0)throw r.FileSystemError.FileNotFound(e);return{type:Ds(d.type),size:d.size,ctime:0,mtime:0}}watch(){return{dispose:()=>{}}}writeFile(){throw r.FileSystemError.NoPermissions}async createSearchTree(e,t){const i=dn.forPaths(),o=await this.container.git.getTreeForRevision(t,e);i.set("~",{commitSha:"",path:"~",size:0,type:"tree"});for(const d of o)i.set(`~/${d.path}`,d);return i}getOrCreateSearchTree(e,t){let i=this._searchTreeMap.get(e);return i===void 0&&(i=this.createSearchTree(e,t),this._searchTreeMap.set(e,i)),i}async getTree(e,t,i){return(await this.getOrCreateSearchTree(t,i)).findSuperstr(`/~/${e}`,!0)}}n(wo,"GitFileSystemProvider"),Ko([(0,p.fF)()],wo.prototype,"readDirectory",1),Ko([(0,p.fF)()],wo.prototype,"readFile",1),Ko([(0,p.fF)()],wo.prototype,"stat",1);function Ds(s){switch(s){case"blob":return r.FileType.File;case"tree":return r.FileType.Directory;default:return r.FileType.Unknown}}n(Ds,"typeToFileType");var Ss=v(5078),$a=Object.defineProperty,kr=Object.getOwnPropertyDescriptor,Ta=n((s,e,t)=>e in s?$a(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"lineHoverController_defNormalProp"),Ea=n((s,e,t,i)=>{for(var o=i>1?void 0:i?kr(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&$a(e,t,o),o},"lineHoverController_decorateClass"),Rs=n((s,e,t)=>(Ta(s,typeof e!="symbol"?e+"":e,t),t),"lineHoverController_publicField");const Qo=2**30;class bo{constructor(e){this.container=e,Rs(this,"_disposable"),Rs(this,"_hoverProviderDisposable"),Rs(this,"_uri"),this._disposable=r.Disposable.from((0,Vn.IH)(e.onReady)(this.onReady,this),ve.DN.onDidChange(this.onConfigurationChanged,this))}dispose(){this.unregister(),this.container.lineTracker.unsubscribe(this),this._disposable.dispose()}onReady(){this.onConfigurationChanged()}onConfigurationChanged(e){!ve.DN.changed(e,"hovers.enabled")&&!ve.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(r.window.activeTextEditor)):(this.container.lineTracker.unsubscribe(this),this.unregister()))}onActiveLinesChanged(e){var t;if(!e.pending){if(e.editor==null||e.selections==null){this.unregister();return}this.isRegistered((t=e.editor)==null?void 0:t.document.uri)||this.register(e.editor)}}async provideDetailsHover(e,t,i){if(!this.container.lineTracker.includes(t.line))return;const o=this.container.lineTracker.getState(t.line),d=o?.commit;if(d==null||this.container.config.hovers.annotations.details&&await this.container.fileAnnotations.getAnnotationType(r.window.activeTextEditor)===ve.VP.Blame)return;const w=this.container.config.hovers.currentLine.over==="line";if(!w&&this.container.lineAnnotations.suspended)return;const S=e.validateRange(new r.Range(t.line,w?t.character:Qo,t.line,Qo));if(!w&&S.start.character!==t.character)return;let X=t.line;const re=X+1;X=(d.lines.find(Ie=>Ie.line===re)??d.lines[0]).originalLine-1;const pe=await this.container.tracker.get(e);if(pe==null)return;const _e=await wn.detailsMessage(d,pe.uri,X,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 r.Hover(_e,S)}async provideChangesHover(e,t,i){if(!this.container.lineTracker.includes(t.line))return;const o=this.container.lineTracker.getState(t.line),d=o?.commit;if(d==null||this.container.config.hovers.annotations.changes&&await this.container.fileAnnotations.getAnnotationType(r.window.activeTextEditor)===ve.VP.Blame)return;const w=this.container.config.hovers.currentLine.over==="line";if(!w&&this.container.lineAnnotations.suspended)return;const S=e.validateRange(new r.Range(t.line,w?t.character:Qo,t.line,Qo));if(!w&&S.start.character!==t.character)return;const X=await this.container.tracker.get(e);if(X==null)return;const re=await wn.changesMessage(d,X.uri,t.line,X.document);if(re!=null)return new r.Hover(re,S)}isRegistered(e){return this._hoverProviderDisposable!=null&&Ss.n.equals(this._uri,e)}register(e){if(this.unregister(),e==null)return;const t=this.container.config.hovers;if(!t.enabled||!t.currentLine.enabled||!t.currentLine.details&&!t.currentLine.changes)return;this._uri=e.document.uri;const i=[];t.currentLine.changes&&i.push(r.languages.registerHoverProvider({pattern:this._uri.fsPath},{provideHover:this.provideChangesHover.bind(this)})),t.currentLine.details&&i.push(r.languages.registerHoverProvider({pattern:this._uri.fsPath},{provideHover:this.provideDetailsHover.bind(this)})),this._hoverProviderDisposable=r.Disposable.from(...i)}unregister(){this._uri=void 0,this._hoverProviderDisposable!=null&&(this._hoverProviderDisposable.dispose(),this._hoverProviderDisposable=void 0)}}n(bo,"LineHoverController"),Ea([(0,p.fF)({args:{0:s=>{var e,t;return`editor=${(e=s.editor)==null?void 0:e.document.uri.toString(!0)}, selections=${(t=s.selections)==null?void 0:t.map(i=>`[${i.anchor}-${i.active}]`).join(",")}, pending=${Boolean(s.pending)}, reason=${s.reason}`}}})],bo.prototype,"onActiveLinesChanged",1),Ea([(0,p.fF)({args:{0:s=>ke.Y.toLoggable(s.uri),1:s=>`${s.line}:${s.character}`,2:!1}})],bo.prototype,"provideDetailsHover",1),Ea([(0,p.fF)({args:{0:s=>ke.Y.toLoggable(s.uri),1:s=>`${s.line}:${s.character}`,2:!1}})],bo.prototype,"provideChangesHover",1);var Zo=Object.defineProperty,gc=Object.getOwnPropertyDescriptor,yo=Object.getOwnPropertySymbols,$n=Object.prototype.hasOwnProperty,yl=Object.prototype.propertyIsEnumerable,wr=n((s,e,t)=>e in s?Zo(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"keyboard_defNormalProp"),Cl=n((s,e)=>{for(var t in e||(e={}))$n.call(e,t)&&wr(s,t,e[t]);if(yo)for(var t of yo(e))yl.call(e,t)&&wr(s,t,e[t]);return s},"keyboard_spreadValues"),Tn=n((s,e,t,i)=>{for(var o=i>1?void 0:i?gc(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&Zo(e,t,o),o},"keyboard_decorateClass"),Os=n((s,e,t)=>(wr(s,typeof e!="symbol"?e+"":e,t),t),"keyboard_publicField");const Pl=Object.create(null),Fa=["left","alt+left","ctrl+left","right","alt+right","ctrl+right","alt+,","alt+.","escape"],ar=[];class en{constructor(e){Os(this,"_mapping"),Os(this,"_paused",!0),this._mapping=e;for(const t in this._mapping)this._mapping[t]=this._mapping[t]??Pl;ar.push(this._mapping)}async dispose(){const e=ar.indexOf(this._mapping),t=ke.Y.getCorrelationContext();t!=null&&(t.exitDetails=` \u2022 index=${e}`),e===ar.length-1?(ar.pop(),await this.updateKeyCommandsContext(ar[ar.length-1])):ar.splice(e,1)}get paused(){return this._paused}async clearKeyCommand(e){const t=ke.Y.getCorrelationContext(),i=ar[ar.length-1];if(i!==this._mapping||i[e]==null){t!=null&&(t.exitDetails=" \u2022 skipped");return}i[e]=void 0,await(0,Di.v)(`${_.zf.KeyPrefix}${e}`,!1)}async pause(e){if(this._paused)return;this._paused=!0;const t=Object.keys(this._mapping).reduce((i,o)=>(i[o]=e==null||e.includes(o)?void 0:this._mapping[o],i),Object.create(null));await this.updateKeyCommandsContext(t)}async resume(){!this._paused||(this._paused=!1,await this.updateKeyCommandsContext(this._mapping))}async start(){await this.resume()}async setKeyCommand(e,t){const i=ke.Y.getCorrelationContext(),o=ar[ar.length-1];if(o!==this._mapping){i!=null&&(i.exitDetails=" \u2022 skipped");return}const d=Boolean(o[e]);o[e]=t,d||await(0,Di.v)(`${_.zf.KeyPrefix}${e}`,!0)}async updateKeyCommandsContext(e){await Promise.all(Fa.map(t=>(0,Di.v)(`${_.zf.KeyPrefix}${t}`,Boolean(e?.[t]))))}}n(en,"KeyboardScope"),Tn([(0,p.cM)({args:!1,prefix:s=>`${s.prefix}[${ar.length}]`})],en.prototype,"dispose",1),Tn([(0,p.cM)({args:!1,prefix:(s,e)=>`${s.prefix}[${ar.length}](${e})`})],en.prototype,"clearKeyCommand",1),Tn([(0,p.cM)({args:!1,prefix:s=>`${s.prefix}(paused=${s.instance._paused})`})],en.prototype,"pause",1),Tn([(0,p.cM)({args:!1,prefix:s=>`${s.prefix}(paused=${s.instance._paused})`})],en.prototype,"resume",1),Tn([(0,p.cM)({args:!1,prefix:(s,e)=>`${s.prefix}[${ar.length}](${e})`})],en.prototype,"setKeyCommand",1);class $s{constructor(){Os(this,"_disposable");const e=Fa.map(t=>r.commands.registerCommand(`gitlens.key.${t}`,()=>this.execute(t),this));this._disposable=r.Disposable.from(...e)}dispose(){this._disposable.dispose()}createScope(e){return new en(Cl({},e))}async beginScope(e){const t=this.createScope(e);return await t.start(),t}async execute(e){const t=ke.Y.getCorrelationContext();if(!ar.length){t!=null&&(t.exitDetails=" \u2022 skipped, no mappings");return}try{let o=ar[ar.length-1][e];if(typeof o=="function"&&(o=await o()),typeof o?.onDidPressKey!="function"){t!=null&&(t.exitDetails=" \u2022 skipped, no callback");return}await o.onDidPressKey(e)}catch(i){ke.Y.error(i,t)}}}n($s,"Keyboard"),Tn([(0,p.cM)({args:!1,prefix:(s,e)=>`${s.prefix}[${ar.length}](${e===void 0?"":Object.keys(e).join(",")})`})],$s.prototype,"createScope",1),Tn([(0,p.cM)({args:!1,prefix:(s,e)=>`${s.prefix}[${ar.length}](${e===void 0?"":Object.keys(e).join(",")})`})],$s.prototype,"beginScope",1),Tn([(0,p.cM)()],$s.prototype,"execute",1);var Dl=v(6113),_c=v.n(Dl);const Xo=new Uint8Array(256);let En=Xo.length;function Ts(){return En>Xo.length-16&&(_c().randomFillSync(Xo),En=0),Xo.slice(En,En+=16)}n(Ts,"rng");const Sl=/^(?:[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 Es(s){return typeof s=="string"&&Sl.test(s)}n(Es,"validate");const zn=Es,Vi=[];for(let s=0;s<256;++s)Vi.push((s+256).toString(16).substr(1));function Aa(s,e=0){const t=(Vi[s[e+0]]+Vi[s[e+1]]+Vi[s[e+2]]+Vi[s[e+3]]+"-"+Vi[s[e+4]]+Vi[s[e+5]]+"-"+Vi[s[e+6]]+Vi[s[e+7]]+"-"+Vi[s[e+8]]+Vi[s[e+9]]+"-"+Vi[s[e+10]]+Vi[s[e+11]]+Vi[s[e+12]]+Vi[s[e+13]]+Vi[s[e+14]]+Vi[s[e+15]]).toLowerCase();if(!zn(t))throw TypeError("Stringified UUID is invalid");return t}n(Aa,"stringify");const Rl=Aa;function Ol(s,e,t){s=s||{};const i=s.random||(s.rng||Ts)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e){t=t||0;for(let o=0;o<16;++o)e[t+o]=i[o];return e}return Rl(i)}n(Ol,"v4");const Fs=Ol;var As=Object.defineProperty,$l=Object.getOwnPropertyDescriptor,Tl=Object.getOwnPropertySymbols,vc=Object.prototype.hasOwnProperty,El=Object.prototype.propertyIsEnumerable,xs=n((s,e,t)=>e in s?As(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"authenticationProvider_defNormalProp"),Fl=n((s,e)=>{for(var t in e||(e={}))vc.call(e,t)&&xs(s,t,e[t]);if(Tl)for(var t of Tl(e))El.call(e,t)&&xs(s,t,e[t]);return s},"authenticationProvider_spreadValues"),Co=n((s,e,t,i)=>{for(var o=i>1?void 0:i?$l(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&As(e,t,o),o},"authenticationProvider_decorateClass"),Is=n((s,e,t)=>(xs(s,typeof e!="symbol"?e+"":e,t),t),"authenticationProvider_publicField");const wc="gitlens+",Fn="GitLens+";class yn{constructor(e,t){this.container=e,this.server=t,Is(this,"_onDidChangeSessions",new r.EventEmitter),Is(this,"_disposable"),Is(this,"_sessionsPromise"),Is(this,"_migrated"),this._sessionsPromise=this.getSessionsFromStorage(),this._disposable=r.Disposable.from(r.authentication.registerAuthenticationProvider(wc,Fn,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 t=ke.Y.getCorrelationContext();e=e.sort();const i=fr(e);try{const o=await this.server.login(e,i),d=await this.createSessionForToken(o,e),w=await this._sessionsPromise,S=w.findIndex(X=>X.id===d.id||fr(X.scopes)===i);return S>-1?w.splice(S,1,d):w.push(d),await this.storeSessions(w),this._onDidChangeSessions.fire({added:[d],removed:[],changed:[]}),d}catch(o){throw o==="Cancelled"||(ke.Y.error(o,t),r.window.showErrorMessage(`Unable to sign in to GitLens+: ${o}`)),o}}async getSessions(e){const t=ke.Y.getCorrelationContext();e=e?.sort();const i=fr(e),o=await this._sessionsPromise,d=e!=null?o.filter(w=>fr(w.scopes)===i):o;return t!=null&&(t.exitDetails=` \u2022 Found ${d.length} sessions`),d}async removeSession(e){const t=ke.Y.getCorrelationContext();try{const i=await this._sessionsPromise,o=i.findIndex(w=>w.id===e);if(o===-1){ke.Y.log(`Unable to remove session ${e}; Not found`);return}const d=i[o];i.splice(o,1),await this.storeSessions(i),this._onDidChangeSessions.fire({added:[],removed:[d],changed:[]})}catch(i){throw ke.Y.error(i,t),r.window.showErrorMessage(`Unable to sign out of GitLens+: ${i}`),i}}async removeSessionsByScopes(e){const t=ke.Y.getCorrelationContext();try{e=e?.sort();const i=fr(e),o=[];let d=0;const w=await this._sessionsPromise;for(const S of w){if(fr(S.scopes)!==i){d++;continue}w.splice(d,1),o.push(S)}if(o.length===0)return;await this.storeSessions(w),this._onDidChangeSessions.fire({added:[],removed:o,changed:[]})}catch(i){throw ke.Y.error(i,t),r.window.showErrorMessage(`Unable to sign out of GitLens+: ${i}`),i}}async tryMigrateSession(){if(this._migrated==null&&(this._migrated=this.container.storage.get(Qi.BU.MigratedAuthentication,!1)),this._migrated)return;let e;try{if(r.extensions.getExtension("gitkraken.gitkraken-authentication")==null||(e=await r.authentication.getSession("gitkraken",["gitlens"],{createIfNone:!1}),e==null))return;e={id:Fs(),accessToken:e.accessToken,account:Fl({},e.account),scopes:e.scopes};const t=await this._sessionsPromise,i=fr(e.scopes),o=t.findIndex(d=>d.id===e.id||fr(d.scopes)===i);o>-1?t.splice(o,1,e):t.push(e),await this.storeSessions(t),this._onDidChangeSessions.fire({added:[e],removed:[],changed:[]})}catch(t){ke.Y.error(t,"Unable to migrate authentication")}finally{this._migrated=!0,this.container.storage.store(Qi.BU.MigratedAuthentication,!0)}return e}async checkForUpdates(){const e=await this._sessionsPromise;this._sessionsPromise=this.getSessionsFromStorage();const t=await this._sessionsPromise,i=[],o=[];for(const d of t)e.some(w=>w.id===d.id)||i.push(d);for(const d of e)t.some(w=>w.id===d.id)||o.push(d);(i.length||o.length)&&(ke.Y.debug(`Firing sessions changed event; added=${i.length}, removed=${o.length}`),this._onDidChangeSessions.fire({added:i,removed:o,changed:[]}))}async createSessionForToken(e,t){const i=await this.server.getAccountInfo(e);return{id:Fs(),accessToken:e,account:{label:i.accountName,id:i.id},scopes:t}}async getSessionsFromStorage(){let e;try{const o=await this.container.storage.getSecret(this.secretStorageKey);if(!o||o==="[]")return[];try{e=JSON.parse(o)}catch(d){try{await this.container.storage.deleteSecret(this.secretStorageKey)}catch{}throw d}}catch(o){return ke.Y.error(o,"Unable to read sessions from storage"),[]}const t=e.map(async o=>{var d;const w=fr(o.scopes);ke.Y.debug(`Read session from storage with scopes=${w}`);let S;if(o.account==null)try{S=await this.server.getAccountInfo(o.accessToken),ke.Y.debug(`Verified session with scopes=${w}`)}catch(X){if(X.message==="Unauthorized")return}return{id:o.id,account:{label:o.account!=null?o.account.label??o.account.displayName??"":S?.accountName??"",id:((d=o.account)==null?void 0:d.id)??S?.id??""},scopes:o.scopes,accessToken:o.accessToken}}),i=(await Promise.allSettled(t)).filter(o=>o.status==="fulfilled").map(o=>o.value).filter(o=>Boolean(o));return ke.Y.debug(`Found ${i.length} verified sessions`),i.length!==e.length&&await this.storeSessions(i),i}async storeSessions(e){try{this._sessionsPromise=Promise.resolve(e),await this.container.storage.storeSecret(this.secretStorageKey,JSON.stringify(e))}catch(t){ke.Y.error(t,`Unable to store ${e.length} sessions`)}}}n(yn,"SubscriptionAuthenticationProvider"),Co([(0,p.fF)()],yn.prototype,"createSession",1),Co([(0,p.fF)()],yn.prototype,"getSessions",1),Co([(0,p.fF)()],yn.prototype,"removeSession",1),Co([(0,p.fF)()],yn.prototype,"removeSessionsByScopes",1);function fr(s){return s?.join("|")}n(fr,"getScopesKey");var tn=v(8538),xa=Object.defineProperty,Al=Object.getOwnPropertyDescriptor,Jo=n((s,e,t)=>e in s?xa(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"serverConnection_defNormalProp"),fn=n((s,e,t,i)=>{for(var o=i>1?void 0:i?Al(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&xa(e,t,o),o},"serverConnection_decorateClass"),An=n((s,e,t)=>(Jo(s,typeof e!="symbol"?e+"":e,t),t),"serverConnection_publicField");class Kr{constructor(e){this.container=e,An(this,"_cancellationSource"),An(this,"_deferredCodeExchanges",new Map),An(this,"_disposable"),An(this,"_pendingStates",new Map),An(this,"_statusBarItem"),An(this,"_uriHandler",new Bs),this._disposable=r.window.registerUriHandler(this._uriHandler)}dispose(){this._disposable.dispose()}get baseApiUri(){return this.container.env==="staging"?r.Uri.parse("https://stagingapi.gitkraken.com"):this.container.env==="dev"?r.Uri.parse("https://devapi.gitkraken.com"):r.Uri.parse("https://api.gitkraken.com")}get baseAccountUri(){return this.container.env==="staging"?r.Uri.parse("https://stagingaccount.gitkraken.com"):this.container.env==="dev"?r.Uri.parse("https://devaccount.gitkraken.com"):r.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 t=ke.Y.getCorrelationContext();let i;try{i=await(0,Ir.h)(r.Uri.joinPath(this.baseApiUri,"user").toString(),{agent:(0,Ir.N)(),headers:{Authorization:`Bearer ${e}`,"User-Agent":"Visual-Studio-Code-GitLens"}})}catch(d){throw ke.Y.error(d,t),d}if(!i.ok)throw ke.Y.error(void 0,`Getting account info failed: (${i.status}) ${i.statusText}`),new Error(i.statusText);const o=await i.json();return{id:o.id,accountName:o.username}}async login(e,t){this.updateStatusBarItem(!0);const i=Fs(),o=this._pendingStates.get(t)??[];this._pendingStates.set(t,[...o,i]);const d=await r.env.asExternalUri(r.Uri.parse(`${r.env.uriScheme}://${this.container.context.extension.id}/did-authenticate?gkstate=${i}`)),w=r.Uri.joinPath(this.baseAccountUri,"register").with({query:`${e.includes("gitlens")?"referrer=gitlens&":""}pass-token=true&return-url=${encodeURIComponent(d.toString())}`});await r.env.openExternal(w);let S=this._deferredCodeExchanges.get(t);return S==null&&(S=(0,Vn.ue)(this._uriHandler.event,this.getUriHandlerDeferredExecutor(t)),this._deferredCodeExchanges.set(t,S)),this._cancellationSource!=null&&(this._cancellationSource.cancel(),this._cancellationSource.dispose(),this._cancellationSource=void 0),this._cancellationSource=new r.CancellationTokenSource,this.openCompletionInputFallback(this._cancellationSource.token),Promise.race([S.promise,new Promise((X,re)=>{var he;return(he=this._cancellationSource)==null?void 0:he.token.onCancellationRequested(()=>re("Cancelled"))}),new Promise((X,re)=>setTimeout(()=>re("Cancelled"),12e4))]).finally(()=>{var X,re;(X=this._cancellationSource)==null||X.cancel(),(re=this._cancellationSource)==null||re.dispose(),this._cancellationSource=void 0,this._pendingStates.delete(t),S?.cancel(),this._deferredCodeExchanges.delete(t),this.updateStatusBarItem(!1)})}async openCompletionInputFallback(e){const t=r.window.createInputBox();t.ignoreFocusOut=!0;const i=[];try{if(e.isCancellationRequested)return;const o=await new Promise(d=>{i.push(e.onCancellationRequested(()=>t.hide()),t.onDidHide(()=>d(void 0)),t.onDidChangeValue(w=>{if(!w){t.validationMessage=void 0;return}try{const S=r.Uri.parse(w.trim());if(S.scheme&&S.scheme!=="file"){t.validationMessage=void 0;return}}catch{}t.validationMessage="Please enter a valid authorization URL"}),t.onDidAccept(()=>d(r.Uri.parse(t.value.trim())))),t.title="GitLens+ Sign In",t.placeholder="Please enter the provided authorization URL",t.prompt="If the auto-redirect fails, paste the authorization URL",t.show()});o!=null&&this._uriHandler.handleUri(o)}finally{t.dispose(),i.forEach(o=>o.dispose())}}getUriHandlerDeferredExecutor(e){return(t,i,o)=>{const d=Ia(t),w=this._pendingStates.get(e);if(w==null||!w.includes(d.gkstate)){ke.Y.log("State not found in accepted state. Skipping this execution...");return}const S=d["access-token"]??d.code;S==null?o("Token not returned"):i(S)}}updateStatusBarItem(e){e&&this._statusBarItem==null&&(this._statusBarItem=r.window.createStatusBarItem("gitlens.plus.signIn",r.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)}}n(Kr,"ServerConnection"),fn([(0,tn.H)()],Kr.prototype,"baseApiUri",1),fn([(0,tn.H)()],Kr.prototype,"baseAccountUri",1),fn([(0,p.fF)({args:!1})],Kr.prototype,"getAccountInfo",1),fn([(0,p.fF)()],Kr.prototype,"login",1);class Bs extends r.EventEmitter{handleUri(e){this.fire(e)}}n(Bs,"UriEventHandler"),fn([(0,p.cM)({args:{0:s=>s.with({query:""}).toString(!1)}})],Bs.prototype,"handleUri",1);function Ia(s){return s.query.split("&").reduce((e,t)=>{const i=t.split("=");return e[i[0]]=i[1],e},{})}n(Ia,"parseQuery");var Qn=v(7514),Ba=Object.defineProperty,Na=Object.defineProperties,bc=Object.getOwnPropertyDescriptor,yc=Object.getOwnPropertyDescriptors,Ns=Object.getOwnPropertySymbols,Cc=Object.prototype.hasOwnProperty,xl=Object.prototype.propertyIsEnumerable,xn=n((s,e,t)=>e in s?Ba(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"subscriptionService_defNormalProp"),Cn=n((s,e)=>{for(var t in e||(e={}))Cc.call(e,t)&&xn(s,t,e[t]);if(Ns)for(var t of Ns(e))xl.call(e,t)&&xn(s,t,e[t]);return s},"subscriptionService_spreadValues"),Ur=n((s,e)=>Na(s,yc(e)),"subscriptionService_spreadProps"),mr=n((s,e,t,i)=>{for(var o=i>1?void 0:i?bc(e,t):e,d=s.length-1,w;d>=0;d--)(w=s[d])&&(o=(i?w(e,t,o):w(o))||o);return i&&o&&Ba(e,t,o),o},"subscriptionService_decorateClass"),rn=n((s,e,t)=>(xn(s,typeof e!="symbol"?e+"":e,t),t),"subscriptionService_publicField");const Il="Visual-Studio-Code-GitLens",Zn=n(class{constructor(s){this.container=s,rn(this,"_onDidChange",new r.EventEmitter),rn(this,"_disposable"),rn(this,"_subscription"),rn(this,"_statusBarSubscription"),rn(this,"_validationTimer"),rn(this,"_etag",0),rn(this,"_lastCheckInDate"),rn(this,"_sessionPromise"),rn(this,"_session"),this._disposable=r.Disposable.from((0,Er.IH)(s.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 s;(s=this._statusBarSubscription)==null||s.dispose(),this._disposable.dispose()}async onAuthenticationChanged(s){var e,t,i;let o=this._session;if(o==null&&this._sessionPromise!=null&&(o=await this._sessionPromise),o!=null&&((e=s.removed)==null?void 0:e.some(w=>w.id===o.id))){this._session=void 0,this._sessionPromise=void 0,this.logout();return}const d=((t=s.added)==null?void 0:t[0])??((i=s.changed)==null?void 0:i[0]);d!=null&&(d.id===o?.id&&d.accessToken===o?.accessToken||(this._session=o,this.validate()))}get baseApiUri(){const{env:s}=this.container;return s==="staging"?r.Uri.parse("https://stagingapi.gitkraken.com"):s==="dev"?r.Uri.parse("https://devapi.gitkraken.com"):r.Uri.parse("https://api.gitkraken.com")}get baseAccountUri(){const{env:s}=this.container;return s==="staging"?r.Uri.parse("https://stagingaccount.gitkraken.com"):s==="dev"?r.Uri.parse("https://devaccount.gitkraken.com"):r.Uri.parse("https://account.gitkraken.com")}get baseSiteUri(){const{env:s}=this.container;return s==="staging"?r.Uri.parse("https://staging.gitkraken.com"):s==="dev"?r.Uri.parse("https://dev.gitkraken.com"):r.Uri.parse("https://gitkraken.com")}get etag(){return this._etag}onReady(){this._disposable=r.Disposable.from(this._disposable,this.container.git.onDidChangeRepositories(this.onRepositoriesChanged,this),...this.registerCommands()),this.updateContext()}onRepositoriesChanged(s){this.updateContext()}registerCommands(){return this.container.viewCommands,[r.commands.registerCommand(_.Gh.PlusLearn,s=>this.learn(s)),r.commands.registerCommand(_.Gh.PlusLoginOrSignUp,()=>this.loginOrSignUp()),r.commands.registerCommand(_.Gh.PlusLogout,()=>this.logout()),r.commands.registerCommand(_.Gh.PlusStartPreviewTrial,()=>this.startPreviewTrial()),r.commands.registerCommand(_.Gh.PlusManage,()=>this.manage()),r.commands.registerCommand(_.Gh.PlusPurchase,()=>this.purchase()),r.commands.registerCommand(_.Gh.PlusResendVerification,()=>this.resendVerification()),r.commands.registerCommand(_.Gh.PlusValidate,()=>this.validate()),r.commands.registerCommand(_.Gh.PlusShowPlans,()=>this.showPlans()),r.commands.registerCommand(_.Gh.PlusHide,()=>ve.DN.updateEffective("plusFeatures.enabled",!1)),r.commands.registerCommand(_.Gh.PlusRestore,()=>ve.DN.updateEffective("plusFeatures.enabled",!0)),r.commands.registerCommand("gitlens.plus.reset",()=>this.logout(!0))]}async getSubscription(){return await this.ensureSession(!1),this._subscription}learn(s=!0){(0,Yr.lN)(this.container.context.extension.id,"gitlens.plus",void 0,s)}async loginOrSignUp(){if(!await(0,Qn.C)())return!1;await this.container.subscriptionAuthentication.abort(),this.showHomeView();const s=await this.ensureSession(!0),e=Boolean(s);if(e){const{account:t,plan:{actual:i,effective:o}}=this._subscription;if(t?.verified===!1){const d={title:"Resend Verification",isCloseAffordance:!0},w={title:"Cancel"};await r.window.showInformationMessage(`Before you can access your ${i.name} account, you must verify your email address.`,d,w)===d&&this.resendVerification()}else if((0,si.dz)(this._subscription)){const d=(0,si.PY)(this._subscription,"days"),w={title:"OK",isCloseAffordance:!0},S={title:"Learn More"};await r.window.showInformationMessage(`You are now signed in to your ${i.name} account which gives you access to GitLens+ features on public repos. You were also granted a trial of ${o.name} for both public and private repos for ${(0,M._6)("more day",d??0)}.`,{modal:!0},w,S)===S&&this.learn()}else r.window.showInformationMessage(`You are now signed in to your ${i.name} account.`,"OK")}return e}async logout(s=!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(Zn.authenticationScopes),s&&this.container.debugging){this.changeSubscription(void 0);return}this.changeSubscription(Ur(Cn({},this._subscription),{plan:{actual:(0,si.fV)(si.Cx.Free),effective:(0,si.fV)(si.Cx.Free)},account:void 0}))}manage(){r.env.openExternal(this.baseAccountUri)}async purchase(){!await(0,Qn.C)()||(this._subscription.account==null?this.showPlans():r.env.openExternal(r.Uri.joinPath(this.baseAccountUri,"subscription").with({query:"product=gitlens"})),await this.showHomeView())}async resendVerification(){var s;if((s=this._subscription.account)!=null&&s.verified)return;const e=ke.Y.getCorrelationContext();this.showHomeView(!0);const t=await this.ensureSession(!1);if(t!=null)try{const i=await(0,Ir.h)(r.Uri.joinPath(this.baseApiUri,"resend-email").toString(),{method:"POST",agent:(0,Ir.N)(),headers:{Authorization:`Bearer ${t.accessToken}`,"User-Agent":Il,"Content-Type":"application/json"},body:JSON.stringify({id:t.account.id})});if(!i.ok){ke.Y.error("",e,`Unable to resend verification email; status=(${i.status}): ${i.statusText}`),r.window.showErrorMessage(`Unable to resend verification email; Status: ${i.statusText}`,"OK");return}const o={title:"Recheck"},d={title:"Cancel"};await r.window.showInformationMessage("Once you have verified your email address, click 'Recheck'.",o,d)===o&&await this.validate()}catch(i){ke.Y.error(i,e),r.window.showErrorMessage("Unable to resend verification email","OK")}}async showHomeView(s=!1){s&&!ve.DN.get("plusFeatures.enabled",void 0,!0)||this.container.homeView.visible||await(0,yi.P0)(_.Gh.ShowHomeView)}showPlans(){r.env.openExternal(r.Uri.joinPath(this.baseSiteUri,"gitlens/pricing"))}async startPreviewTrial(){if(!await(0,Qn.C)())return;let{plan:s,previewTrial:e}=this._subscription;if(e!=null||s.effective.id!==si.Cx.Free){if(this.showHomeView(),s.effective.id===si.Cx.Free){const X={title:"Sign in to GitLens+",isCloseAffordance:!0},re={title:"Cancel"};await r.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},X,re)===X&&this.loginOrSignUp()}return}const t=new Date;let i,o=new Date(t);this.container.debugging?(o=(0,Tr.IH)(o,{minutes:1}),i=0):(o.setHours(23,59,59,999),o=(0,Tr.IH)(o,{days:3}),i=3),e={startedOn:t.toISOString(),expiresOn:o.toISOString()},this.changeSubscription(Ur(Cn({},this._subscription),{plan:Ur(Cn({},this._subscription.plan),{effective:(0,si.fV)(si.Cx.Pro,t,o)}),previewTrial:e}));const d={title:"OK",isCloseAffordance:!0},w={title:"Learn More"};await r.window.showInformationMessage(`You have started a ${i} day trial of GitLens+ features for both public and private repos.`,{modal:!0},d,w)===w&&this.learn()}async validate(){const s=ke.Y.getCorrelationContext(),e=await this.ensureSession(!1);if(e==null){this.changeSubscription(this._subscription);return}try{await this.checkInAndValidate(e)}catch(t){ke.Y.error(t,s)}}async checkInAndValidate(s,e=!1){if(!e)return this.checkInAndValidateCore(s);const t=this.checkInAndValidateCore(s);await Promise.race([t,new Promise(o=>setTimeout(()=>o(!0),3e3))])&&await r.window.withProgress({location:r.ProgressLocation.Notification,title:"Validating your GitLens+ account..."},()=>t)}async checkInAndValidateCore(s){var e,t;const i=ke.Y.getCorrelationContext();try{const o={id:s.account.id,platform:(0,zr.Xf)(),gitlensVersion:this.container.version,vscodeEdition:r.env.appName,vscodeHost:r.env.appHost,vscodeVersion:r.version,previewStartedOn:(e=this._subscription.previewTrial)==null?void 0:e.startedOn,previewExpiresOn:(t=this._subscription.previewTrial)==null?void 0:t.expiresOn},d=await(0,Ir.h)(r.Uri.joinPath(this.baseApiUri,"gitlens/checkin").toString(),{method:"POST",agent:(0,Ir.N)(),headers:{Authorization:`Bearer ${s.accessToken}`,"User-Agent":Il,"Content-Type":"application/json"},body:JSON.stringify(o)});if(!d.ok)throw new vr.dt("Unable to validate account",void 0,d.status,d.statusText);const w=await d.json();this.validateSubscription(w),this._lastCheckInDate=new Date}catch(o){throw ke.Y.error(o,i),o instanceof vr.dt?o:new vr.dt("Unable to validate account",o)}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(s){const e={id:s.user.id,name:s.user.name,email:s.user.email,verified:s.user.status==="activated"},t=Object.entries(s.licenses.effectiveLicenses),i=Object.entries(s.licenses.paidLicenses);let o;if(i.length>0){i.sort((X,re)=>qo(re[1].latestStatus)-qo(X[1].latestStatus)||(0,si.kU)(Wr(re[0]))-(0,si.kU)(Wr(X[0])));const[w,S]=i[0];o=(0,si.fV)(Wr(w),new Date(S.latestStartDate),new Date(S.latestEndDate))}o==null&&(o=(0,si.fV)(si.Cx.FreePlus,s.user.firstGitLensCheckIn!=null?new Date(s.user.firstGitLensCheckIn):void 0));let d;if(t.length>0){t.sort((X,re)=>qo(re[1].latestStatus)-qo(X[1].latestStatus)||(0,si.kU)(Wr(re[0]))-(0,si.kU)(Wr(X[0])));const[w,S]=t[0];d=(0,si.fV)(Wr(w),new Date(S.latestStartDate),new Date(S.latestEndDate))}d==null&&(d=Cn({},o)),this.changeSubscription(Ur(Cn({},this._subscription),{plan:{actual:o,effective:d},account:e}))}async ensureSession(s,e){return this._sessionPromise!=null&&this._session===void 0&&await this._sessionPromise,!e&&this._session!=null?this._session:this._session===null&&!s?void 0:(this._sessionPromise===void 0&&(this._sessionPromise=this.getOrCreateSession(s).then(i=>(this._session=i,this._sessionPromise=void 0,this._session),()=>(this._session=null,this._sessionPromise=void 0,this._session))),await this._sessionPromise??void 0)}async getOrCreateSession(s){const e=ke.Y.getCorrelationContext();let t;try{t=await r.authentication.getSession(Zn.authenticationProviderId,Zn.authenticationScopes,{createIfNone:s,silent:!s})}catch(i){if(t=null,i instanceof Error&&i.message.includes("User did not consent"))return await this.logout(),null;ke.Y.error(i,e)}if(t===void 0&&(t=await this.container.subscriptionAuthentication.tryMigrateSession()),t==null)return await this.logout(),t??null;try{await this.checkInAndValidate(t,s)}catch(i){ke.Y.error(i,e);const o=t.account.label;if(t=null,i instanceof vr.dt)if(i.statusCode==null||i.statusCode<500){if(await this.logout(),s){const d=i.statusCode===401;queueMicrotask(async()=>{const w={title:"Retry Sign In"};await r.window.showErrorMessage(`Unable to sign in to your (${o}) GitLens+ account. Please try again. If this issue persists, please contact support.${d?"":` Error=${i.message}`}`,w)===w&&this.loginOrSignUp()})}}else r.window.showErrorMessage(`Unable to sign in to your (${o}) GitLens+ account right now. Please try again in a few minutes. If this issue persists, please contact support. Error=${i.message}`,"OK")}return t}changeSubscription(s,e=!1){s==null&&(s={plan:{actual:(0,si.fV)(si.Cx.Free),effective:(0,si.fV)(si.Cx.Free)},account:void 0,state:si.jc.Free}),s.plan.effective.id===si.Cx.Free&&s.previewTrial!=null&&((0,si.EE)(s.previewTrial.expiresOn)??0)>0&&(s.plan.effective=(0,si.fV)(si.Cx.Pro,new Date(s.previewTrial.startedOn),new Date(s.previewTrial.expiresOn))),(0,si.Z1)(s)&&(s.plan.effective=s.plan.actual),s.state=(0,si.RE)(s);const t=this._subscription;t!=null&&JSON.stringify(t)===JSON.stringify(s)||(this.storeSubscription(s),this._subscription=s,this._etag=Date.now(),this.updateContext(),!e&&t!=null&&this._onDidChange.fire({current:s,previous:t,etag:this._etag}))}getStoredSubscription(){const s=this.container.storage.get(Qi.BU.Subscription),e=s?.data;return e!=null&&(e.plan.actual.name=(0,si.tL)(e.plan.actual.id),e.plan.effective.name=(0,si.tL)(e.plan.effective.id)),e}async storeSubscription(s){return this.container.storage.store(Qi.BU.Subscription,{v:1,data:s})}updateContext(){this.updateStatusBar(),queueMicrotask(async()=>{const{allowed:t,subscription:i}=await this.container.git.access(),o=t?!1:i.required!=null&&(0,si.aG)(i.required)?"paid":"free+";(0,Di.v)(_.zf.PlusAllowed,t),(0,Di.v)(_.zf.PlusRequired,o)});const{plan:{actual:s},state:e}=this._subscription;(0,Di.v)(_.zf.Plus,s.id!=si.Cx.Free?s.id:void 0),(0,Di.v)(_.zf.PlusState,e)}updateStatusBar(){var s,e;const{account:t,plan:{effective:i}}=this._subscription;if(i.id===si.Cx.Free){(s=this._statusBarSubscription)==null||s.dispose(),this._statusBarSubscription=void 0;return}const o=(0,si.dz)(this._subscription);if(!o&&t?.verified!==!1){(e=this._statusBarSubscription)==null||e.dispose(),this._statusBarSubscription=void 0;return}if(this._statusBarSubscription==null&&(this._statusBarSubscription=r.window.createStatusBarItem("gitlens.plus.subscription",r.StatusBarAlignment.Left,1)),this._statusBarSubscription.name="GitLens+ Subscription",this._statusBarSubscription.command=_.Gh.ShowHomeView,t?.verified===!1)this._statusBarSubscription.text=`$(warning) ${i.name} (Unverified)`,this._statusBarSubscription.backgroundColor=new r.ThemeColor("statusBarItem.warningBackground"),this._statusBarSubscription.tooltip=new r.MarkdownString(o?`**Please verify your email** Before you can start your **${i.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 d=(0,si.PY)(this._subscription,"days");this._statusBarSubscription.text=`${i.name} (Trial)`,this._statusBarSubscription.tooltip=new r.MarkdownString(`You are currently trialing **${i.name}**, which gives you access to GitLens+ features on both public and private repos. You have ${(0,M._6)("day",d??0)} remaining in your trial. Click for details`,!0)}this._statusBarSubscription.show()}},"_SubscriptionService");let tr=Zn;rn(tr,"authenticationProviderId","gitlens+"),rn(tr,"authenticationScopes",["gitlens"]),mr([(0,tn.H)()],tr.prototype,"baseApiUri",1),mr([(0,tn.H)()],tr.prototype,"baseAccountUri",1),mr([(0,tn.H)()],tr.prototype,"baseSiteUri",1),mr([(0,p.fF)()],tr.prototype,"learn",1),mr([(0,p.cM)()],tr.prototype,"loginOrSignUp",1),mr([(0,p.cM)()],tr.prototype,"logout",1),mr([(0,p.cM)()],tr.prototype,"manage",1),mr([(0,p.cM)()],tr.prototype,"purchase",1),mr([(0,bi.H)(),(0,p.cM)()],tr.prototype,"resendVerification",1),mr([(0,p.cM)()],tr.prototype,"showHomeView",1),mr([(0,bi.H)(),(0,p.cM)()],tr.prototype,"startPreviewTrial",1),mr([(0,bi.H)(),(0,p.cM)()],tr.prototype,"validate",1),mr([(0,p.fF)({args:{0:s=>s?.account.label}})],tr.prototype,"checkInAndValidateCore",1),mr([(0,p.fF)()],tr.prototype,"validateSubscription",1),mr([(0,bi.H)(),(0,p.fF)()],tr.prototype,"ensureSession",1),mr([(0,p.fF)()],tr.prototype,"getOrCreateSession",1),mr([(0,p.fF)()],tr.prototype,"changeSubscription",1);function Bl(s){}n(Bl,"assertSubscriptionState");function Wr(s){switch(s){case"gitlens-pro":case"bundle-pro":return si.Cx.Pro;case"gitlens-teams":case"bundle-teams":return si.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 si.Cx.Enterprise;default:return si.Cx.FreePlus}}n(Wr,"convertLicenseTypeToPlanId");function qo(s){switch(s){case"active":return 100;case"expired":case"cancelled":return-100;case"in_trial":case"trial":return 1;case"canceled":case"non_renewing":return 0}}n(qo,"licenseStatusPriority");var Pc=Object.defineProperty,Dc=n((s,e,t)=>e in s?Pc(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"protocol_defNormalProp"),Po=n((s,e,t)=>(Dc(s,typeof e!="symbol"?e+"":e,t),t),"protocol_publicField");class Ma{constructor(e){this.method=e,Po(this,"_")}}n(Ma,"IpcMessageType");class pr extends Ma{}n(pr,"IpcCommandType");class In extends Ma{}n(In,"IpcNotificationType");function gr(s,e,t){s.method===e.method&&t(e.params)}n(gr,"onIpc");const es=new pr("webview/ready"),Ms=new pr("command/execute"),ka=new pr("configuration/preview"),Nl=new pr("configuration/update"),Ua=new In("configuration/didChange"),Sc=new In("configuration/didPreview"),Wa=new In("webview/didOpenAnchor");var ts=v(7927),Rc=Object.defineProperty,Ml=n((s,e,t)=>e in s?Rc(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,"webviewBase_defNormalProp"),Xn=n((s,e,t)=>(Ml(s,typeof e!="symbol"?e+"":e,t),t),"webviewBase_publicField");const is=2**30;let rs=0;function ks(){return rs===is?rs=1:rs++,`host:${rs}`}n(ks,"nextIpcId");class Jn{constructor(e,t,i,o,d,w){this.container=e,this.id=t,this.fileName=i,this.iconPath=o,Xn(this,"disposables",[]),Xn(this,"isReady",!1),Xn(this,"_disposablePanel"),Xn(this,"_panel"),Xn(this,"_title"),this._title=d,this.disposables.push(r.commands.registerCommand(w,this.onShowCommand,this))}dispose(){var e;this.disposables.forEach(t=>t.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=r.ViewColumn.Beside){var t,i;if(this._panel==null)this._panel=r.window.createWebviewPanel(this.id,this._title,{viewColumn:e,preserveFocus:!1},{retainContextWhenHidden:!0,enableFindWidget:!0,enableCommandUris:!0,enableScripts:!0}),this._panel.iconPath=r.Uri.file(this.container.context.asAbsolutePath(this.iconPath)),this._disposablePanel=r.Disposable.from(this._panel,this._panel.onDidDispose(this.onPanelDisposed,this),this._panel.onDidChangeViewState(this.onViewStateChanged,this),this._panel.webview.onDidReceiveMessage(this.onMessageReceivedCore,this),...((t=this.onInitializing)==null?void 0:t.call(this))??[],...((i=this.registerCommands)==null?void 0:i.call(this))??[]),this._panel.webview.html=await this.getHtml(this._panel.webview);else{const o=await this.getHtml(this._panel.webview);this._panel.webview.html="",this._panel.webview.html=o,this._panel.reveal(this._panel.viewColumn??r.ViewColumn.Active,!1)}}async refresh(){this._panel!=null&&(this._panel.webview.html=await this.getHtml(this._panel.webview))}onPanelDisposed(){var e,t,i;(e=this.onVisibilityChanged)==null||e.call(this,!1),(t=this.onFocusChanged)==null||t.call(this,!1),(i=this._disposablePanel)==null||i.dispose(),this._disposablePanel=void 0,this._panel=void 0}onShowCommand(){this.show()}onViewStateChanged(e){var t,i;ke.Y.debug(`Webview(${this.id}).onViewStateChanged`,`active=${e.webviewPanel.active}, visible=${e.webviewPanel.visible}`),(t=this.onVisibilityChanged)==null||t.call(this,e.webviewPanel.visible),(i=this.onFocusChanged)==null||i.call(this,e.webviewPanel.active)}onMessageReceivedCore(e){var t;if(e!=null)switch(ke.Y.debug(`Webview(${this.id}).onMessageReceived: method=${e.method}`),e.method){case es.method:gr(es,e,()=>{var i;this.isReady=!0,(i=this.onReady)==null||i.call(this)});break;case Ms.method:gr(Ms,e,i=>{i.args!=null?(0,yi.P0)(i.command,...i.args):(0,yi.P0)(i.command)});break;default:(t=this.onMessageReceived)==null||t.call(this,e);break}}async getHtml(e){var t,i,o,d;const w=r.Uri.joinPath(this.container.context.extensionUri,"dist","webviews"),S=r.Uri.joinPath(w,this.fileName),X=new TextDecoder("utf8").decode(await r.workspace.fs.readFile(S)),[re,he,pe,_e]=await Promise.all([(t=this.includeBootstrap)==null?void 0:t.call(this),(i=this.includeHead)==null?void 0:i.call(this),(o=this.includeBody)==null?void 0:o.call(this),(d=this.includeEndOfBody)==null?void 0:d.call(this)]),Ie=e.cspSource,Ve=(0,ts.V)(),dt=e.asWebviewUri(this.container.context.extensionUri).toString(),et=e.asWebviewUri(w).toString();return X.replace(/#{(head|body|endOfBody)}/i,(It,Bt)=>{switch(Bt){case"head":return he??"";case"body":return pe??"";case"endOfBody":return re!=null?`