@withgraphite/graphite-cli 1.3.10 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/16.js CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- "use strict";exports.id=16,exports.ids=[16],exports.modules={42161:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.sendAnalyticsEvent=void 0;const i=n(79379),o=n(90103),s=n(17891);t.sendAnalyticsEvent=function({event:e,timestampISOString:t,logger:n,details:a}){(()=>r(this,void 0,void 0,(function*(){const n=yield(0,s.composeUserConfigFactory)().load(),r=(0,o.composeRequest)({userConfig:n});yield r({route:i.API_ROUTES.logActions,params:{actions:[{details:a,name:e,timestamp:t}]}})})))().catch((e=>{n.error(`sendAnaltyicsEvent threw an error: ${e}`)}))}},4740:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.cuteString=void 0,t.cuteString=e=>JSON.stringify(e,null,2)},98126:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PreconditionsFailedError=t.ExitFailedError=void 0;class n extends Error{constructor(e){super(e),this.name="ExitFailed"}}t.ExitFailedError=n;class r extends Error{constructor(e){super(e),this.name="PreconditionsFailed"}}t.PreconditionsFailedError=r},79115:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(42161),t),i(n(4740),t),i(n(98126),t),i(n(90103),t),i(n(75357),t),i(n(17891),t),i(n(52081),t)},90103:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeRequest=void 0;const i=n(53977);t.composeRequest=function({userConfig:e}){const t=e.getAuthToken(),n=e.getApiServerUrl();return({route:e,params:o,queryParams:s,urlParams:a,headers:u})=>r(this,void 0,void 0,(function*(){return yield i.request.requestWithArgs({apiServer:n,route:e,params:o,queryParams:s,urlParams:a,headers:Object.assign({authorization:t?`token ${t}`:void 0},u)})}))}},75357:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.spiffy=void 0;const o=i(n(32856)),s=n(4740),a=n(98126);t.spiffy=function(e){const t=()=>r(this,void 0,void 0,(function*(){var t;const n=yield function({filePath:e,oldFilepath:t,schema:n,initialize:i,removeIfInvalid:s,debug:u}){return r(this,void 0,void 0,(function*(){null==u||u(`Reading JSON for ${e}`);const r=e&&(yield o.default.pathExists(e));t&&(yield o.default.pathExists(t))&&(null==u||u(`Migrating old JSON for ${e}`),r?o.default.removeSync(t):o.default.moveSync(t,e));try{const t=r?yield o.default.readJson(e):i();if(!n(t,{logFailures:!1}))throw new Error("Malformed data");return null==u||u(`Successfully parsed JSON at ${e}`),t}catch(t){if(null==u||u(`Failed to parse JSON at ${e}`),s)return null==u||u(`Removing invalid JSON and re-initializing ${e}`),yield o.default.remove(e),i();throw new a.ExitFailedError(`Malformed JSON at ${e}`)}}))}({filePath:e.filepath,oldFilepath:e.oldFilepath,schema:e.schema,initialize:e.initialize,removeIfInvalid:(null===(t=e.options)||void 0===t?void 0:t.removeIfEmpty)||!1,debug:e.debug}),i=t=>r(this,void 0,void 0,(function*(){var r;t(n),(null===(r=e.options)||void 0===r?void 0:r.removeIfEmpty)&&(0,s.cuteString)(n)===(0,s.cuteString)({})?yield o.default.remove(e.filepath):yield o.default.outputFile(e.filepath,(0,s.cuteString)(n),{mode:384})}));return Object.assign({data:n,update:i,path:e.filepath,delete:()=>r(this,void 0,void 0,(function*(){(yield o.default.pathExists(e.filepath))&&(yield o.default.remove(e.filepath))}))},e.helperFunctions(n,i))}));return{load:t,loadIfExists:()=>r(this,void 0,void 0,(function*(){if(yield o.default.pathExists(e.filepath))return t()}))}}},17891:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.composeUserConfigFactory=t.DEFAULT_GRAPHITE_APP_SERVER=t.DEFAULT_GRAPHITE_API_SERVER=void 0;const u=n(34490),c=o(n(8296)),l=a(n(22037)),d=a(n(71017)),h=n(98126),f=n(75357),m=n(52081),p=c.shape({branchPrefix:c.optional(c.string),branchDate:c.optional(c.boolean),branchReplacement:c.optional(c.unionMany([c.literal("_"),c.literal("-"),c.literal("")])),skipApplyingPrefixToNonGeneratedBranchNames:c.optional(c.boolean),allowSlashesInGeneratedBranchNames:c.optional(c.boolean),allowUpperCaseInGeneratedBranchNames:c.optional(c.boolean),authToken:c.optional(c.string),tips:c.optional(c.boolean),yubikey:c.optional(c.boolean),editor:c.optional(c.string),pager:c.optional(c.string),restackCommitterDateIsAuthorDate:c.optional(c.boolean),submitIncludeCommitMessages:c.optional(c.boolean),excludeTemplatesWithCommitMessages:c.optional(c.boolean),submitViaCli:c.optional(c.boolean),connectCliToLocalServer:c.optional(c.boolean),gtiConfigs:c.optional(c.array(c.shape({key:c.string,value:c.string}))),alternativeProfiles:c.optional(c.array(c.shape({name:c.string,hostPrefix:c.string,authToken:c.optional(c.string)}))),systemTrayConfig:c.optional(c.shape({sections:c.array(c.shape({sectionId:c.string,display:c.boolean}))})),debugExpiryMs:c.optional(c.number)});t.DEFAULT_GRAPHITE_API_SERVER="https://api.graphite.dev/v1",t.DEFAULT_GRAPHITE_APP_SERVER="https://app.graphite.dev",t.composeUserConfigFactory=()=>(0,f.spiffy)({schema:p,oldFilepath:d.default.join(l.default.homedir(),".graphite_user_config"),filepath:d.default.join((0,m.getGtConfigDir)(),"user_config"),initialize:()=>({}),helperFunctions:(e,n)=>{const r=()=>{var t,n,r;if(!process.env.GRAPHITE_PROFILE)return null!==(n=null===(t=e.alternativeProfiles)||void 0===t?void 0:t.find((e=>"default"===e.name)))&&void 0!==n?n:null;const i=null===(r=e.alternativeProfiles)||void 0===r?void 0:r.find((e=>e.name===process.env.GRAPHITE_PROFILE));if(!i)throw new Error(`Unknown profile ${process.env.GRAPHITE_PROFILE}`);return i},i=()=>{var e;const n=null===(e=r())||void 0===e?void 0:e.hostPrefix;return n?`https://app.${n}.graphite.dev`:t.DEFAULT_GRAPHITE_APP_SERVER},o=()=>`${i()}/activate`,a=()=>{var t,n;return null!==(n=null===(t=r())||void 0===t?void 0:t.authToken)&&void 0!==n?n:e.authToken};return{getBranchReplacement:()=>{var t;return null!==(t=e.branchReplacement)&&void 0!==t?t:"_"},getEditor:t=>s(void 0,void 0,void 0,(function*(){var n,r,i,o,s,a;return null!==(a=null!==(s=null!==(o=null!==(i=null!==(r=null!==(n=process.env.GT_EDITOR)&&void 0!==n?n:e.editor)&&void 0!==r?r:yield t())&&void 0!==i?i:process.env.GIT_EDITOR)&&void 0!==o?o:process.env.VISUAL)&&void 0!==s?s:process.env.EDITOR)&&void 0!==a?a:"vi"})),getPager:t=>s(void 0,void 0,void 0,(function*(){var n,r,i,o,s;const a=null!==(s=null!==(o=null!==(i=null!==(r=null!==(n=process.env.GT_PAGER)&&void 0!==n?n:e.pager)&&void 0!==r?r:yield t())&&void 0!==i?i:process.env.GIT_PAGER)&&void 0!==o?o:process.env.PAGER)&&void 0!==s?s:"less";return""===a?void 0:a})),getApiServerUrl:()=>{var n;if(e.connectCliToLocalServer)return process.env.NODE_TLS_REJECT_UNAUTHORIZED="0","https://localhost:8000/v1";const i=null===(n=r())||void 0===n?void 0:n.hostPrefix;return i?`https://api.${i}.graphite.dev/v1`:t.DEFAULT_GRAPHITE_API_SERVER},getAppServerUrl:i,getAuthToken:a,setAuthToken:e=>s(void 0,void 0,void 0,(function*(){var t;const i=null===(t=r())||void 0===t?void 0:t.name;yield n(i?t=>{var n;const r=null===(n=t.alternativeProfiles)||void 0===n?void 0:n.find((({name:e})=>e===i));if(!r)throw new Error(`Unknown profile ${i}`);r.authToken=e}:t=>t.authToken=e)})),getProfileName:()=>{var e;return null===(e=r())||void 0===e?void 0:e.name},authTokenPrecondition:()=>{const e=a();if(!e||0===e.length)throw new h.PreconditionsFailedError(`Please authenticate your Graphite CLI by visiting ${o()}`)},getDefaultPrDescriptionBehavior:()=>e.submitIncludeCommitMessages?e.excludeTemplatesWithCommitMessages?"messages":"both":"template",getSubmitViaCli:()=>{var t;return null!==(t=e.submitViaCli)&&void 0!==t&&t},getCLIAuthUrl:o,setSectionConfig:({sectionId:e,display:t})=>s(void 0,void 0,void 0,(function*(){yield n((n=>{var r,i,o;n.systemTrayConfig&&(n.systemTrayConfig.sections=null===(r=n.systemTrayConfig)||void 0===r?void 0:r.sections.filter((t=>t.sectionId!==e))),n.systemTrayConfig={sections:[...null!==(o=null===(i=n.systemTrayConfig)||void 0===i?void 0:i.sections)&&void 0!==o?o:[],{sectionId:e,display:t}]}}))})),getSectionConfig:t=>{var n;const r=null===(n=e.systemTrayConfig)||void 0===n?void 0:n.sections.find((e=>t===e.sectionId));return null!=r?r:{sectionId:t,display:!0}},getDebugExpiryMs:()=>{var t;return null!==(t=e.debugExpiryMs)&&void 0!==t?t:g},initialized:()=>!(0,u.isEmptyObject)(e)}}});const g=864e5},52081:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getGtDataDir=t.getGtConfigDir=void 0;const r=n(22037),i=n(71017);t.getGtConfigDir=()=>{var e;return(0,i.join)(null!==(e=process.env.XDG_CONFIG_HOME)&&void 0!==e?e:(0,i.join)((0,r.homedir)(),".config"),"graphite")},t.getGtDataDir=()=>{var e;return(0,i.join)(null!==(e=process.env.XDG_DATA_HOME)&&void 0!==e?e:(0,i.join)((0,r.homedir)(),".local","share"),"graphite")}},79379:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.API_ROUTES=t.pullRequestInfoShape=void 0;const s=n(27716),a=o(n(8296)),u={repoOwner:a.string,repoName:a.string,prNumbers:a.array(a.number),prHeadRefNames:a.optional(a.array(a.string)),trunkBranchNames:a.optional(a.array(a.string)),consistent:a.optional(a.boolean)};t.pullRequestInfoShape=a.shape({prNumber:a.number,title:a.string,body:a.string,state:a.literals(["OPEN","CLOSED","MERGED"]),reviewDecision:a.literals(["CHANGES_REQUESTED","APPROVED","REVIEW_REQUIRED",null,void 0]),headRefName:a.string,baseRefName:a.string,url:a.string,isDraft:a.boolean,versions:a.array(a.shape({headSha:a.string,baseSha:a.string,baseName:a.string,createdAt:a.string,authorGithubHandle:a.optional(a.string)})),dependentPrNumber:a.optional(a.number)}),t.API_ROUTES={logActions:{method:"POST",url:"/graphite/cli/log-actions",params:{actions:a.array(a.shape({name:a.string,details:a.optional(a.shape({})),timestamp:a.string}))}},logCommand:{method:"POST",url:"/graphite/log-command",params:{commandName:a.string,durationMiliSeconds:a.number,user:a.string,version:a.optional(a.string),err:a.optional(a.shape({name:a.string,message:a.string,stackTrace:a.string,debugContext:a.optional(a.string)}))}},downstackDependencies:{method:"GET",url:"/graphite/downstack-dependencies",queryParams:{org:a.string,repo:a.string,trunkName:a.string,branchName:a.string},response:{downstackBranchNames:a.array(a.string)}},upgradePrompt:{method:"GET",url:"/graphite/upgrade",queryParams:{currentVersion:a.string,installationMethod:a.optional(a.string)},response:{prompt:a.optional(a.shape({message:a.string,blocking:a.boolean}))}},featureFlags:{method:"GET",url:"/graphite/feature-flags",queryParams:{currentVersion:a.string},response:{flags:a.array(a.shape({flagName:a.string,flagValue:a.boolean}))}},feedback:{method:"POST",url:"/graphite/feedback",params:{user:a.string,message:a.string,debugContext:a.optional(a.string)}},generateBranchNameAndCommitMessage:{method:"POST",url:"/graphite/generate-branch-name-and-commit-message",params:{diff:a.string,template:a.optional(a.string),owner:a.optional(a.string),repo:a.optional(a.string)},response:{result:a.union(a.shape({branchName:a.string,commitMessage:a.string}),a.shape({error:a.string}))}},generateTitleAndDescription:{method:"POST",url:"/graphite/generate-title-and-description",params:{diff:a.string,template:a.optional(a.string),owner:a.string,repo:a.string},response:{result:a.union(a.shape({title:a.string,description:a.string}),a.shape({error:a.string}))}},traces:{method:"POST",url:"/graphite/traces",params:{jsonTraces:a.string,cliVersion:a.string}},submitPullRequests:{method:"POST",url:"/graphite/submit/pull-requests",params:{repoOwner:a.string,repoName:a.string,trunkBranchName:a.optional(a.string),mergeWhenReady:a.optional(a.boolean),rerequestReview:a.optional(a.boolean),comment:a.optional(a.string),gti:a.optional(a.boolean),useWebSubmit:a.optional(a.boolean),prs:a.array(a.unionMany([a.shape({action:a.literals(["create"]),head:a.string,headSha:a.optional(a.string),base:a.string,baseSha:a.optional(a.string),title:a.string,body:a.optional(a.string),draft:a.optional(a.boolean),reviewers:a.optional(a.array(a.string))}),a.shape({action:a.literals(["update"]),head:a.string,headSha:a.optional(a.string),base:a.string,baseSha:a.optional(a.string),title:a.optional(a.string),body:a.optional(a.string),prNumber:a.number,draft:a.optional(a.boolean),reviewers:a.optional(a.array(a.string))})])),webSubmitAnalytics:a.optional(a.shape({eligible:a.boolean,usedWebSubmit:a.boolean,prompted:a.boolean,suppressedPrompt:a.boolean,submitViaCliSetting:a.optional(a.boolean)}))},response:{prs:a.array(a.unionMany([a.shape({head:a.string,prNumber:a.number,prURL:a.string,status:a.literals(["updated","created"]),repoOwner:a.string,repoName:a.string}),a.shape({head:a.string,error:a.string,status:a.literals(["error"])})]))}},pullRequestInfo__DEPRECATED:{method:"POST",url:"/graphite/pull-requests",params:u,response:{prs:a.array(t.pullRequestInfoShape)}},pullRequestInfo:{method:"POST",url:"/graphite/cli/pull-request-info",params:u,response:{result:a.taggedUnion("status",{ok:{status:a.literal("ok"),prs:a.array(t.pullRequestInfoShape)},error:{status:a.literal("error"),message:a.string}})}},mergeabilityStatus:{method:"POST",url:"/graphite/mergeability-status",params:{repoOwner:a.string,repoName:a.string,prNumbers:a.array(a.number)},response:{mergeabilityStatuses:a.array(a.shape({prNumber:a.number,mergeabilityStatus:a.literals(s.PrMetastatuses)}))}},merge:{method:"POST",url:"/graphite/merge",params:{repoOwner:a.string,repoName:a.string,trunkBranchName:a.string,prNumbers:a.array(a.number)}},getRepoMessage:{method:"GET",url:"/graphite/cli-repo-message",queryParams:{org:a.string,repo:a.string},response:{message:a.nullable(a.shape({text:a.string,status:a.literals(["warning","info","error"])}))}},getSectionsSummary:{method:"GET",url:"/graphite/sections-summary",queryParams:{first:a.string},headers:{"User-Agent":a.string},response:{sections:a.array(a.shape({name:a.string,sectionId:a.string,includeInTotalCount:a.boolean,totalUnpaginatedPrs:a.number,prs:a.array(a.shape({number:a.number,title:a.string,state:a.literals(["OPEN","CLOSED","MERGED"]),createdAt:a.string,updatedAt:a.string,repo:a.shape({name:a.string,owner:a.string}),author:a.nullable(a.shape({name:a.nullable(a.string),login:a.string,avatarUrl:a.string})),reviewDecision:a.literals(["CHANGES_REQUESTED","APPROVED","REVIEW_REQUIRED"])}))}))}},checkAuth:{method:"POST",url:"/graphite/check-auth",params:{repoOwner:a.optional(a.string),repoName:a.optional(a.string)},response:{githubLogin:a.optional(a.string),canSubmitPrs:a.optional(a.boolean)}},checkIsRepoSynced:{method:"GET",url:"/graphite/cli/is-repo-synced",queryParams:{repoOwner:a.string,repoName:a.string},response:{result:a.unionMany([a.shape({status:a.literals(["SYNCED","NOT_SYNCED_ADDABLE"])}),a.shape({status:a.literals(["NOT_SYNCED_UNADDABLE"]),message:a.string})])}},addSyncedRepo:{method:"POST",url:"/graphite/cli/add-synced-repo",params:{repoOwner:a.string,repoName:a.string},response:{err:a.optional(a.string)}}}},9164:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeGit=void 0;const i=n(34490),o=n(1284),s=n(49690),a=n(42548),u=n(22917),c=n(51674),l=n(66809),d=n(45960),h=n(67397),f=n(31176),m=n(50279),p=n(26055),g=n(16681),v=n(68012),y=n(55044),b=n(83002),E=n(71852),_=n(64645),w=n(13729),C=n(61093),R=n(14397),O=n(87803),S=n(27373),P=n(42178),A=n(37385),T=n(73777),M=n(2250),D=n(42517),N=n(71735),I=n(5755),k=n(60770),j=n(22925),x=n(58468),F=n(52282),G=n(19963),H=n(19109),B=n(75122),L=n(64568),U=n(70081),q=n(93333);t.composeGit=function({cwd:e,debug:t,quiet:n}){return r(this,void 0,void 0,(function*(){const r=(0,q.composeGitRunner)({cwd:e,debug:t}),[$,W]=yield Promise.all([(0,x.getRepoPaths)({runner:r}),(0,w.getGitVersion)({runner:r})]),V=(0,m.composeGitConfig)(r);return $?Object.assign(Object.assign(Object.assign({gitVersion:W,repo:!0,config:V},$),(0,_.composeGetRemoteSha)(r)),{addAll:(0,i.bindWithEmptyObject)((0,i.bind)(s.addAll,{runner:r})),addUpdates:(0,i.bindWithEmptyObject)((0,i.bind)(s.addUpdates,{runner:r})),addPatch:(0,i.bindWithEmptyObject)((0,i.bind)(s.addPatch,{runner:r})),findUntrackedFiles:(0,i.bindWithEmptyObject)((0,i.bind)(U.findUntrackedFiles,{runner:r})),trackFiles:(0,i.bind)(U.trackFiles,{runner:r}),trackAllNewFiles:(0,i.bindWithEmptyObject)((0,i.bind)(U.trackAllNewFiles,{runner:r})),getCommitAuthor:(0,i.bind)(d.getCommitAuthor,{runner:r}),getCommitDate:(0,i.bind)(d.getCommitDate,{runner:r}),getFilesChanged:(0,i.bind)(y.getFilesChanged,{runner:r}),getStatus:(0,i.bindWithEmptyObject)((0,i.bind)(L.getStatus,{runner:r})),getCurrentBranchName:(0,i.bindWithEmptyObject)((0,i.bind)(a.getCurrentBranchName,{runner:r})),getPreviousBranchName:(0,i.bindWithEmptyObject)((0,i.bind)(a.getPreviousBranchName,{runner:r})),moveBranch:(0,i.bind)(a.moveBranch,{runner:r}),deleteBranch:(0,i.bind)(a.deleteBranch,{runner:r}),switchBranch:(0,i.bind)(a.switchBranch,{runner:r}),getDiff:(0,i.bind)(p.getDiff,{runner:r}),getDiffOfStagedChanges:(0,i.bindWithEmptyObject)((0,i.bind)(p.getDiffOfStagedChanges,{runner:r})),forceCheckoutNewBranch:(0,i.bind)(a.forceCheckoutNewBranch,{runner:r}),forceCreateBranch:(0,i.bind)(a.forceCreateBranch,{runner:r}),getNumberOfCommitsInRange:(0,i.bind)(h.getNumberOfCommitsInRange,{runner:r}),getFormattedCommitOrRange:(0,i.bind)(h.getFormattedCommitOrRange,{runner:r}),getCommitTree:(0,i.bind)(f.getCommitTree,{runner:r}),commit:(0,i.bind)(l.commit,{quiet:n,runner:r}),revert:(0,i.bind)(l.revert,{quiet:n,runner:r}),detectStagedChanges:(0,i.bindWithEmptyObject)((0,i.bind)(L.detectStagedChanges,{runner:r})),getUnstagedChanges:(0,i.bindWithEmptyObject)((0,i.bind)(p.getUnstagedChanges,{runner:r})),showDiff:(0,i.bind)(p.showDiff,{runner:r}),isDiffEmpty:(0,i.bind)(p.isDiffEmpty,{runner:r}),fetchBranches:(0,i.bind)(g.fetchBranches,{runner:r}),readFetchHead:(0,i.bind)(g.readFetchHead,{runner:r}),findRemoteHeadBranch:(0,i.bind)(b.findRemoteHeadBranch,{runner:r}),getShaOrThrow:(0,i.bind)(_.getShaOrThrow,{runner:r}),getSha:(0,i.bind)(_.getSha,{runner:r}),detectUntrackedChanges:(0,i.bindWithEmptyObject)((0,i.bind)(L.detectUntrackedChanges,{runner:r})),trackedUnstagedChanges:(0,i.bindWithEmptyObject)((0,i.bind)(L.trackedUnstagedChanges,{runner:r})),isMerged:(0,i.bind)(C.isMerged,{runner:r}),logLong:(0,i.bindWithEmptyObject)((0,i.bind)(R.logLong,{runner:r})),getMergeBase:(0,i.bind)(O.getMergeBase,{runner:r}),isAncestor:(0,i.bind)(O.isAncestor,{runner:r}),getUnmergedFiles:(0,i.bindWithEmptyObject)((0,i.bind)(L.getUnmergedFiles,{runner:r})),getRebaseHead:(0,i.bindWithEmptyObject)((0,i.bind)(S.getRebaseHead,{gitDir:$.gitDir})),pruneRemote:(0,i.bind)(A.pruneRemote,{runner:r}),getRemoteUrl:(0,i.bind)(j.getRemoteUrl,{runner:r}),showCommits:(0,i.bind)(H.showCommits,{runner:r}),getFileContents:(0,i.bind)(v.getFileContents,{runner:r}),fetchRemoteTrackingBranch:(0,i.bind)(T.fetchRemoteTrackingBranch,{runner:r}),fastForwardBranchToRemoteTracking:(0,i.bind)(T.fastForwardBranchToRemoteTracking,{runner:r}),pushBranch:(0,i.bind)(M.pushBranch,{runner:r,gitConfig:V,gitCommonDir:$.gitCommonDir,repoRoot:$.repoRoot}),getHookExecutablePath:(0,i.bind)(E.getHookExecutablePath,{gitConfig:V,gitCommonDir:$.gitCommonDir,repoRoot:$.repoRoot}),getCleanlyReconciledSquashedHead:(0,i.bind)(k.getCleanlyReconciledSquashedHead,{runner:r,gitConfig:V}),rebaseInProgress:(0,i.bindWithEmptyObject)((0,i.bind)(I.rebaseInProgress,{gitDir:$.gitDir})),cleanRebase:(0,i.bind)(c.cleanRebase,{runner:r,gitConfig:V}),rebase:(0,i.bind)(N.rebase,{gitDir:$.gitDir,runner:r}),rebaseContinue:(0,i.bindWithEmptyObject)((0,i.bind)(N.rebaseContinue,{gitDir:$.gitDir,runner:r})),rebaseAbort:(0,i.bindWithEmptyObject)((0,i.bind)(N.rebaseAbort,{runner:r})),rebaseInteractive:(0,i.bind)(N.rebaseInteractive,{gitDir:$.gitDir,runner:r}),softReset:(0,i.bind)(F.softReset,{runner:r}),mixedReset:(0,i.bind)(F.mixedReset,{runner:r}),keepReset:(0,i.bind)(F.keepReset,{runner:r}),trackedReset:(0,i.bind)(F.trackedReset,{runner:r}),setRemoteTracking:(0,i.bind)(G.setRemoteTracking,{runner:r}),getBranchNamesAndRevisions:(0,i.bindWithEmptyObject)((0,i.bind)(B.getBranchNamesAndRevisions,{runner:r})),clean:(0,i.bindWithEmptyObject)((0,i.bind)(u.clean,{runner:r})),createNewObject:(0,i.bind)(P.createNewObject,{runner:r}),updateRef:(0,i.bind)(P.updateRef,{runner:r}),readRef:(0,i.bind)(P.readRef,{runner:r}),deleteRef:(0,i.bind)(P.deleteRef,{runner:r}),getShaForEachRefWithPrefix:(0,i.bind)(P.getShaForEachRefWithPrefix,{runner:r}),commitRangesAreEquivalent:(0,i.bind)(D.commitRangesAreEquivalent,{runner:r}),getBranchesInCommitRange:(0,i.bind)(h.getBranchesInCommitRange,{runner:r}),absorbPatchesIntoCommitStack:(0,i.bind)(o.absorbPatchesIntoCommitStack,{repoRoot:$.repoRoot,gitCommonDir:$.gitCommonDir,runner:r,gitConfig:V}),refreshIndex:(0,i.bindWithEmptyObject)((0,i.bind)(L.refreshIndex,{runner:r}))}):{gitVersion:W,repo:!1,config:V}}))}},1284:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.absorbPatchesIntoCommitStack=void 0;const o=i(n(32856)),s=i(n(71017)),a=n(67397),u=n(64645),c=n(70341);function l({sha:e,patch:t,runner:n,repoRoot:i,gitCommonDir:a}){return r(this,void 0,void 0,(function*(){const r=s.default.join(a,`.gt-${process.pid}-${Date.now()}.index`);yield(0,c.readTreeIntoIndexFile)({treeish:e,indexFile:r,runner:n,repoRoot:i}),yield(0,c.applyPatchToIndexFile)({patch:t,indexFile:r,runner:n,repoRoot:i});const u=yield(0,c.writeTreeFromIndexFile)({indexFile:r,runner:n,repoRoot:i});return o.default.rmSync(r),u}))}t.absorbPatchesIntoCommitStack=function({shas:e,patches:t,runner:n,restackCommitterDateIsAuthorDate:i,gitConfig:o,gitCommonDir:s,repoRoot:c}){return r(this,void 0,void 0,(function*(){const r=yield o("commit.gpgSign"),d=r&&"false"!==r&&"0"!==r,h=[];let f=yield(0,u.getSha)({runner:n,ref:`${e[0]}~`}),m=!1;for(let r=0;r<t.length;r++){const o=e[r],u=t[r];if(!m&&null===u){h.push(o),f=o;continue}m=!0;const p=(0,a.getRebaseMetadataForCommit)({runner:n,sha:o}),g=null===u?`${o}^{tree}`:yield l({gitCommonDir:s,repoRoot:c,sha:o,patch:u,runner:n}),{message:v,authorDate:y,authorEmail:b,authorName:E}=yield p,_=yield n.runGitCommand({args:["commit-tree",g,"-p",f,"-m",v,...d?["-S"]:[]],onError:"throw",resource:"absorbPatchesIntoCommitStackCommitTree",options:{env:Object.assign(Object.assign(Object.assign({},process.env),{GIT_AUTHOR_NAME:E,GIT_AUTHOR_EMAIL:b,GIT_AUTHOR_DATE:y}),i&&{GIT_COMMITTER_DATE:y})},cwd:c});h.push(_),f=_}return h}))}},49690:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.addPatch=t.addUpdates=t.addAll=void 0,t.addAll=function({runner:e}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["add","--all"],onError:"throw",resource:"addAll"})}))},t.addUpdates=function({runner:e}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["add","--update"],onError:"throw",resource:"addUpdates"})}))},t.addPatch=function({runner:e}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["add","--patch"],options:{stdio:"inherit"},onError:"throw",resource:"addPatch"})}))}},42548:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.forceCreateBranch=t.forceCheckoutNewBranch=t.switchBranch=t.deleteBranch=t.moveBranch=t.getPreviousBranchName=t.getCurrentBranchName=void 0,t.getCurrentBranchName=function({runner:e}){return n(this,void 0,void 0,(function*(){const t=yield e.runGitCommand({args:["branch","--show-current"],onError:"ignore",resource:"getCurrentBranchName"});return t.length>0?t:void 0}))},t.getPreviousBranchName=function({runner:e}){return n(this,void 0,void 0,(function*(){const t=yield e.runGitCommand({args:["rev-parse","--symbolic-full-name","--abbrev-ref=loose","@{-1}"],onError:"ignore",resource:"getPreviousBranchName"});return t.length>0?t:void 0}))},t.moveBranch=function({runner:e,newName:t}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["branch","-m",t],options:{stdio:"pipe"},onError:"throw",resource:"moveBranch"})}))},t.deleteBranch=function({runner:e,branchName:t}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["branch","-D",t],options:{stdio:"pipe"},onError:"throw",resource:"deleteBranch"})}))},t.switchBranch=function({branch:e,newBranch:t,detach:r,force:i,runner:o}){return n(this,void 0,void 0,(function*(){yield o.runGitCommand({args:["switch","-q",...r?["-d"]:[],...i?["-f"]:[],...t?["-c"]:[],e],options:{stdio:"inherit"},onError:"throw",resource:"switchBranch"})}))},t.forceCheckoutNewBranch=function({branchName:e,sha:t,runner:r}){return n(this,void 0,void 0,(function*(){yield r.runGitCommand({args:["switch","-q","-C",e,t],options:{stdio:"inherit"},onError:"throw",resource:"forceCheckoutNewBranch"})}))},t.forceCreateBranch=function({branchName:e,sha:t,runner:r}){return n(this,void 0,void 0,(function*(){yield r.runGitCommand({args:["branch","-f",e,t],options:{stdio:"pipe"},onError:"throw",resource:"forceCreateBranch"})}))}},22917:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.clean=void 0,t.clean=function({runner:e}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["clean","--force"],options:{stdio:"ignore"},onError:"throw",resource:"clean"})}))}},51674:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.cleanRebase=void 0;const i=n(93333),o=n(67397);t.cleanRebase=function({onto:e,from:t,head:n,restackCommitterDateIsAuthorDate:s,runner:a,gitConfig:u}){var c,l;return r(this,void 0,void 0,(function*(){const d=yield u("commit.gpgSign"),h=d&&"false"!==d&&"0"!==d;return null!==(l=null===(c=yield(yield(0,o.getFormattedCommitOrRange)({base:t,head:n,format:"SHA",runner:a})).reverse().map((e=>({sha:e,metadataPromise:(0,o.getRebaseMetadataForCommit)({runner:a,sha:e})}))).reduce(((e,{sha:t,metadataPromise:n})=>r(this,void 0,void 0,(function*(){const[r,{message:o,authorDate:u,authorEmail:c,authorName:l}]=yield Promise.all([e,n]);if(!r)return null;const d=r.tree,f=yield a.runGitCommand({args:["commit-tree",d,"-p",`${t}~`,"-m","_"],onError:"throw",resource:"cleanRebaseOntoCommitTree"}),m=yield a.runGitCommand({args:["merge-tree",f,t],onError:"throw",resource:"cleanRebaseMergeTree"}).catch((e=>{if(e instanceof i.CommandFailedError&&1===e.exitCode)return null;throw e}));return m?m==d?r:{tree:m,commitPromise:a.runGitCommand({args:["commit-tree",m,"-p",yield r.commitPromise,"-m",o,...h?["-S"]:[]],options:{env:Object.assign(Object.assign(Object.assign({},process.env),{GIT_AUTHOR_NAME:l,GIT_AUTHOR_EMAIL:c,GIT_AUTHOR_DATE:u}),s&&{GIT_COMMITTER_DATE:u})},onError:"throw",resource:"cleanRebaseCommitTree"})}:null}))),Promise.resolve({commitPromise:Promise.resolve(e),tree:`${e}^{tree}`})))||void 0===c?void 0:c.commitPromise)&&void 0!==l?l:null}))}},66809:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.revert=t.commit=void 0,t.commit=function({amend:e,message:t,noEdit:r,edit:i,patch:o,quiet:s,noVerify:a,runner:u}){return n(this,void 0,void 0,(function*(){yield u.runGitCommand({args:["commit",...e?["--amend"]:[],...t?["-m",t]:[],...r?["--no-edit"]:[],...i?["-e"]:[],...o?["-p"]:[],...a?["-n"]:[],...s?["-q"]:[]],options:{stdio:"inherit"},onError:"throw",resource:"commit"})}))},t.revert=function({runner:e,sha:t,edit:r,quiet:i}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["revert",t,...i?["-q"]:[],...r?[]:["--no-edit"]],options:{stdio:"inherit"},onError:"throw",resource:"revert"})}))}},45960:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getCommitDate=t.getCommitAuthor=void 0,t.getCommitAuthor=function({ref:e,runner:t}){return t.runGitCommand({args:["log","--format=%an","-n","1",e,"--"],onError:"throw",resource:"commitInfoAuthor"})},t.getCommitDate=function({ref:e,runner:t}){return n(this,void 0,void 0,(function*(){const n=yield t.runGitCommand({args:["log","--format=%cd","-n","1",e,"--"],onError:"throw",resource:"commitInfoBody"});return new Date(n)}))}},67397:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getRebaseMetadataForCommit=t.getBranchesInCommitRange=t.getFormattedCommitOrRange=t.getNumberOfCommitsInRange=void 0;const o=i(n(62637));t.getNumberOfCommitsInRange=function({runner:e,base:t,head:n}){return r(this,void 0,void 0,(function*(){return Number(yield e.runGitCommand({args:["rev-list","--count",`${t}..${n}`,"--"],onError:"throw",resource:"getNumberOfCommitsInRange"}))}))};const s={READABLE:"%h - %s",SUBJECT:"%s",MESSAGE:"%B%n",REBASE_METADATA:"%aN%n%aE%n%aI%n%B",AUTHOR_METADATA:"%aN%n%aE%n%aI",COMMITTER_DATE_RELATIVE:"%cr",SHA:"%H",AUTHOR_NAME:"%aN",COMMITTER_DATE:"%cI"};function a({runner:e,base:t,head:n,format:i}){return r(this,void 0,void 0,(function*(){if(!t)return[yield e.runGitCommand({args:["--no-pager","log","-1",`--pretty=format:${s[i]}`,n,"--"],onError:"throw",resource:"getCommitRangeFormatted"})];const r=yield e.runGitCommandAndSplitLines({args:["--no-pager","log","--pretty=format:%H",`${t}..${n}`,"--"],onError:"throw",resource:"getCommitRangeHashes"}),a=[];for(const t of o.default.chunk(r,500)){const n=yield Promise.all(t.map((t=>"SHA"===i?t:e.runGitCommand({args:["--no-pager","log","-1",`--pretty=format:${s[i]}`,t,"--"],onError:"throw",resource:"getCommitRangeFormatted"}))));a.push(...n)}return a}))}t.getFormattedCommitOrRange=a,t.getBranchesInCommitRange=function({runner:e,base:t,head:n}){return r(this,void 0,void 0,(function*(){return(yield e.runGitCommandAndSplitLines({args:["--no-pager","log","--pretty=%D",`${t}..${n}`,"--"],onError:"throw",resource:"getBranchesInCommitRange"})).map((e=>e.split(", "))).flat().map((e=>e.replace("HEAD -> ",""))).filter(Boolean)}))},t.getRebaseMetadataForCommit=function({runner:e,sha:t}){return r(this,void 0,void 0,(function*(){return a({runner:e,base:void 0,head:t,format:"REBASE_METADATA"}).then((([e])=>e.split("\n"))).then((([e,t,n,...r])=>({authorName:e,authorEmail:t,authorDate:n,message:r.join("\n")})))}))}},31176:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getCommitTree=void 0;const i=n(64645);t.getCommitTree=function({runner:e,branchNames:t}){return r(this,void 0,void 0,(function*(){const n=yield(0,i.getSha)({runner:e,ref:`${yield e.runGitCommand({args:["merge-base","--octopus",...t],onError:"ignore",resource:"parentOfMergeBase"})}~`}),r={};return(yield e.runGitCommandAndSplitLines({args:["rev-list","--parents",...n?[`^${n}`,...t]:["--all"],"--"],onError:"throw",resource:"getCommitTree"})).map((e=>e.split(" "))).forEach((e=>r[e[0]]=e.slice(1))),r}))}},50279:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeGitConfig=void 0,t.composeGitConfig=e=>{const t=new Map;return r=>n(void 0,void 0,void 0,(function*(){const i=t.get(r);if(void 0!==i)return i;const o=yield function({runner:e,key:t}){return n(this,void 0,void 0,(function*(){return(yield e.runGitCommand({args:["config","--get",t],onError:"ignore",resource:"inferRepoGitHubInfo"}))||null}))}({runner:e,key:r});return t.set(r,o),o}))}},26055:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getDiffOfStagedChanges=t.getDiff=t.isDiffEmpty=t.showDiff=t.getUnstagedChanges=void 0,t.getUnstagedChanges=function({runner:e}){return n(this,void 0,void 0,(function*(){return e.runGitCommand({args:["-c","color.ui=always","--no-pager","diff","--no-ext-diff","--stat"],onError:"throw",resource:"getUnstagedChanges"})}))},t.showDiff=function({runner:e,left:t,right:n,stat:r}){return e.runGitCommand({args:["-c","color.ui=always","--no-pager","diff","--no-ext-diff",t,n,...r?["--stat"]:[],"--"],onError:"throw",resource:"showDiff"})},t.isDiffEmpty=function({runner:e,left:t,right:r}){return n(this,void 0,void 0,(function*(){return 0===(yield e.runGitCommand({args:["--no-pager","diff","--no-ext-diff","--shortstat",t,r,"--"],onError:"throw",resource:"isDiffEmpty"})).length}))};const r=["--no-pager","-c","diff.renames=true","diff","--no-ext-diff","--no-prefix","--unified"];t.getDiff=function({runner:e,left:t,right:n}){return e.runGitCommand({args:[...r,t,...n?[n]:[],"--"],noTrim:!0,onError:"throw",resource:"getDiff"})},t.getDiffOfStagedChanges=function({runner:e}){return e.runGitCommand({args:[...r,"--cached","--"],noTrim:!0,onError:"throw",resource:"getDiffOfStagedChanges"})}},16681:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.readFetchHead=t.fetchBranches=void 0;const i=n(64645),o=e=>`refs/gt-fetch-head/${e}`;t.fetchBranches=function({runner:e,remote:t,branchNames:n}){return r(this,void 0,void 0,(function*(){0!==n.length&&(yield e.runGitCommand({args:["fetch","--no-write-fetch-head","-f",t,...n.map((e=>`refs/heads/${e}:${o(e)}`))],options:{stdio:"pipe"},onError:"throw",resource:"fetchBranch"}))}))},t.readFetchHead=function({runner:e,branchName:t}){return r(this,void 0,void 0,(function*(){return(0,i.getShaOrThrow)({runner:e,ref:o(t)})}))}},68012:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getFileContents=void 0,t.getFileContents=function({runner:e,ref:t,file:r}){return n(this,void 0,void 0,(function*(){return e.runGitCommand({args:["show",`${t}:${r}`],onError:"throw",resource:"fileContents"})}))}},55044:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};function r(e){switch(e){case"A":return"added";case"C":return"copied";case"D":return"deleted";case"M":default:return"modified";case"R":return"renamed"}}Object.defineProperty(t,"__esModule",{value:!0}),t.getFilesChanged=void 0,t.getFilesChanged=function({runner:e,from:t,to:i}){return n(this,void 0,void 0,(function*(){const n=[],o=(yield e.runGitCommand({args:["diff","-z","--name-status",t,i],onError:"ignore",resource:"getFilesChanged"})).split("\0");for(let e=0;e<o.length-1;e){const t=r(o[e][0]);if("copied"===t||"renamed"===t){const r=o[e+1],i=o[e+2];n.push({path:i,status:t,from:r}),e+=3}else{const r=o[e+1];n.push({path:r,status:t,from:void 0}),e+=2}}return n}))}},83002:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.findRemoteHeadBranch=void 0,t.findRemoteHeadBranch=function({runner:e,remote:t}){return n(this,void 0,void 0,(function*(){const n=yield e.runGitCommand({args:["rev-parse","--abbrev-ref",`refs/remotes/${t}/HEAD`],onError:"ignore",resource:"findRemoteHeadBranch"});if(!n)return null;const r=`${t}/`;return n.startsWith(r)?n.slice(r.length):null}))}},71852:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getHookExecutablePath=void 0;const o=i(n(32856)),s=i(n(71017));t.getHookExecutablePath=function({hook:e,gitConfig:t,repoRoot:n,gitCommonDir:i}){return r(this,void 0,void 0,(function*(){const r=yield t("core.hooksPath"),a=r?s.default.join(n,r):s.default.join(i,"hooks"),u=s.default.join(a,e);return o.default.pathExistsSync(u)?u:null}))}},64645:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeGetRemoteSha=t.getSha=t.getShaOrThrow=void 0,t.getShaOrThrow=function({ref:e,runner:t}){return n(this,void 0,void 0,(function*(){return t.runGitCommand({args:["rev-parse",e],onError:"throw",resource:"getShaOrThrow"})}))},t.getSha=function({ref:e,runner:t}){return n(this,void 0,void 0,(function*(){return t.runGitCommand({args:["rev-parse",e],onError:"ignore",resource:"getSha"})}))},t.composeGetRemoteSha=function(e){let t;return{populateRemoteShas:r=>n(this,void 0,void 0,(function*(){t=yield function({remote:e,runner:t}){return n(this,void 0,void 0,(function*(){const n={};return(yield t.runGitCommandAndSplitLines({args:["ls-remote","--heads",e],onError:"ignore",resource:"fetchRemoteShas"})).map((e=>e.split(/\s+/))).filter((e=>2===e.length&&e.every((e=>e.length>0))&&e[1].startsWith("refs/heads/"))).forEach((([e,t])=>n[t.slice(11)]=e)),n}))}({remote:r,runner:e})})),getRemoteSha:e=>null==t?void 0:t[e]}}},13729:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getGitVersion=void 0,t.getGitVersion=function({runner:e}){return n(this,void 0,void 0,(function*(){return(yield e.runGitCommand({args:["--version"],onError:"throw",resource:"getGitVersion"})).split(" ")[2]}))}},70341:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.writeTreeFromIndexFile=t.applyPatchToIndexFile=t.readTreeIntoIndexFile=void 0,t.readTreeIntoIndexFile=function({treeish:e,indexFile:t,runner:r,repoRoot:i}){return n(this,void 0,void 0,(function*(){yield r.runGitCommand({args:["read-tree","--index-output",t,e],cwd:i,onError:"throw",resource:"readTreeIntoIndexFile"})}))},t.applyPatchToIndexFile=function({patch:e,runner:t,indexFile:r,repoRoot:i}){return n(this,void 0,void 0,(function*(){yield t.runGitCommand({args:["apply","--verbose","--cached","-p0","--unidiff-zero","-"],input:e,options:{env:Object.assign(Object.assign({},process.env),{GIT_INDEX_FILE:r})},cwd:i,onError:"throw",resource:"applyPatchToIndexFile"})}))},t.writeTreeFromIndexFile=function({indexFile:e,runner:t,repoRoot:r}){return n(this,void 0,void 0,(function*(){return t.runGitCommand({args:["write-tree"],options:{env:Object.assign(Object.assign({},process.env),{GIT_INDEX_FILE:e})},cwd:r,onError:"throw",resource:"writeTreeFromIndexFile"})}))}},61093:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isMerged=void 0;const i=n(67397),o=n(64645),s=n(87803);t.isMerged=function({branchName:e,trunkName:t,runner:n}){return r(this,void 0,void 0,(function*(){const a=(0,s.getMergeBase)({runner:n,left:e,right:t}),u=(yield(0,i.getFormattedCommitOrRange)({base:t,head:e,format:"SHA",runner:n})).reverse();return(yield u.reduce(((e,i)=>r(this,void 0,void 0,(function*(){const r=yield e,o=yield n.runGitCommand({args:["commit-tree",`${i}^{tree}`,"-p",r,"-m","_"],onError:"ignore",resource:"mergeBaseCommitTree"});return(yield n.runGitCommand({args:["cherry",t,o,r],onError:"ignore",resource:"isMerged"})).startsWith("-")?i:r}))),Promise.resolve(a)))===(yield(0,o.getSha)({runner:n,ref:e}))}))}},14397:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.logLong=void 0,t.logLong=function({runner:e}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["log","--graph","--abbrev-commit","--decorate","--format=format:%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)","--branches"],options:{stdio:"inherit"},onError:"throw",resource:"logLong"})}))}},87803:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isAncestor=t.getMergeBase=void 0;const i=n(93333);t.getMergeBase=function({runner:e,left:t,right:n}){return e.runGitCommand({args:["merge-base",t,n],onError:"throw",resource:"getMergeBase"})},t.isAncestor=function({runner:e,left:t,right:n}){return r(this,void 0,void 0,(function*(){try{return yield e.runGitCommand({args:["merge-base","--is-ancestor",t,n],onError:"throw",resource:"getMergeBase"}),!0}catch(e){if(e instanceof i.CommandFailedError&&1===e.exitCode)return!1;throw e}}))}},27373:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getRebaseHead=void 0;const o=i(n(32856)),s=i(n(71017));t.getRebaseHead=function({gitDir:e}){return r(this,void 0,void 0,(function*(){const t=s.default.join(`${e}`,"rebase-merge","head-name");if(yield o.default.pathExists(t))return(yield o.default.readFile(t,{encoding:"utf-8"})).trim().slice(11)}))}},42178:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getShaForEachRefWithPrefix=t.deleteRef=t.readRef=t.updateRef=t.createNewObject=void 0,t.createNewObject=function({content:e,runner:t}){return t.runGitCommand({args:["hash-object","-w","--stdin"],input:e,onError:"throw",resource:"createNewObject"})},t.updateRef=function({ref:e,sha:t,runner:r}){return n(this,void 0,void 0,(function*(){yield r.runGitCommand({args:["update-ref",e,t],options:{stdio:"pipe"},onError:"throw",resource:"updateRef"})}))},t.readRef=function({ref:e,runner:t}){return n(this,void 0,void 0,(function*(){return t.runGitCommand({args:["cat-file","-p",e],onError:"throw",resource:"readRef"})}))},t.deleteRef=function({ref:e,runner:t}){return n(this,void 0,void 0,(function*(){yield t.runGitCommand({args:["update-ref","-d",e],onError:"throw",resource:"deleteRef"})}))},t.getShaForEachRefWithPrefix=function({runner:e,prefix:t}){return n(this,void 0,void 0,(function*(){const n={};return(yield e.runGitCommandAndSplitLines({args:["for-each-ref","--format=%(refname):%(objectname)",t],onError:"throw",resource:"getShaForEachRefWithPrefix"})).map((e=>e.split(":"))).filter((e=>2===e.length)).forEach((([e,r])=>n[e.substring(t.length)]=r)),n}))}},37385:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.pruneRemote=void 0,t.pruneRemote=function({runner:e,remote:t}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["remote","prune",t],onError:"ignore",resource:"pruneRemote"})}))}},73777:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.fastForwardBranchToRemoteTracking=t.fetchRemoteTrackingBranch=void 0;const i=n(93333);t.fetchRemoteTrackingBranch=function({runner:e,remote:t,branchName:n}){return r(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["fetch",t,n],onError:"throw",resource:"fetchRemoteTrackingBranch"})}))},t.fastForwardBranchToRemoteTracking=function({runner:e,remote:t,branchName:n}){return r(this,void 0,void 0,(function*(){try{return yield e.runGitCommand({args:["merge","--ff-only",`${t}/${n}`],onError:"throw",resource:"fastForwardBranchToRemoteTracking"}),"OK"}catch(e){if(e instanceof i.CommandFailedError&&e.message.includes("fatal: Not possible to fast-forward, aborting."))return"CONFLICT";throw e}}))}},2250:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.pushBranch=void 0;const i=n(32081),o=n(71852),s=n(22925);t.pushBranch=function({remote:e,branchName:t,noVerify:n,forcePush:a,runner:u,gitConfig:c,gitCommonDir:l,repoRoot:d,prePushHookInput:h}){return r(this,void 0,void 0,(function*(){!n&&h&&(yield function({runner:e,gitConfig:t,remote:n,repoRoot:a,gitCommonDir:u,branchName:c,localSha:l,remoteSha:d}){return r(this,void 0,void 0,(function*(){const r=yield(0,o.getHookExecutablePath)({hook:"pre-push",gitConfig:t,repoRoot:a,gitCommonDir:u});if(!r)return;const h=yield(0,s.getRemoteUrl)({runner:e,remote:n}),f=`refs/heads/${c}`,m=`${f} ${l} ${f} ${d||"0000000000000000000000000000000000000000"}\n`;try{(0,i.execSync)(`(cd ${a} ; '${r}' ${n} ${h})`,{stdio:["pipe","inherit","inherit"],input:m,encoding:"utf-8"})}catch(e){throw new Error(`pre-push git hook failed while pushing branch ${c}`)}}))}(Object.assign(Object.assign({runner:u,remote:e,gitConfig:c,gitCommonDir:l,repoRoot:d},h),{branchName:t})));const f=a?"--force":"--force-with-lease";yield u.runGitCommand({args:["push","-u",e,f,t,"--no-verify"],onError:"throw",resource:"pushBranch"})}))}},42517:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.commitRangesAreEquivalent=void 0,t.commitRangesAreEquivalent=function({runner:e,base1:t,head1:r,base2:i,head2:o,remote:s}){return n(this,void 0,void 0,(function*(){if(t===r||i===o)return t===r&&i===o;const a=(yield Promise.all([t,r,i,o].map((t=>n(this,void 0,void 0,(function*(){try{return yield e.runGitCommand({args:["show",t,"--"],onError:"throw",resource:"rangeDiffShow"}),{sha:t,toFetch:!1}}catch(e){return{sha:t,toFetch:!0}}})))))).filter((({toFetch:e})=>e)).map((({sha:e})=>e));a.length>0&&(yield e.runGitCommand({args:["fetch","--no-write-fetch-head",s,...a],onError:"throw",resource:"rangeDiffFetch"}));const u=`${t}..${r}`,c=`${i}..${o}`,l=yield e.runGitCommandAndSplitLines({args:["range-diff",u,c],onError:"throw",resource:"rangeDiff"});for(const e of l){const t=e.trim().split(/\s+/);if(t.length<3)return!1;if("="!==t[2])return!1}return!0}))}},71735:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.rebaseInteractive=t.rebaseAbort=t.rebaseContinue=t.rebase=void 0;const i=n(93333),o=n(5755);function s({runner:e}){return r(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["rebase","--abort"],options:{stdio:"pipe"},onError:"throw",resource:"rebaseAbort"})}))}function a({args:e,options:t,resource:n,runner:u,gitDir:c}){return r(this,void 0,void 0,(function*(){try{yield u.runGitCommand({args:["rebase",...e],options:Object.assign({stdio:"pipe"},t),onError:"throw",resource:n})}catch(r){if(r instanceof i.CommandFailedError&&r.message.includes("It seems that there is already a rebase-merge directory")){try{yield s({runner:u})}catch(e){throw r}return a({runner:u,args:e,options:t,resource:n,gitDir:c})}if(yield(0,o.rebaseInProgress)({gitDir:c}))return"REBASE_CONFLICT";throw r}return"REBASE_DONE"}))}t.rebase=function({onto:e,from:t,branchName:n,restackCommitterDateIsAuthorDate:i,runner:o,gitDir:s}){return r(this,void 0,void 0,(function*(){return a({runner:o,args:[...i?["--committer-date-is-author-date"]:[],"--onto",e,t,n],resource:"rebase",gitDir:s})}))},t.rebaseContinue=function({runner:e,gitDir:t}){return r(this,void 0,void 0,(function*(){return a({runner:e,args:["--continue"],options:{env:Object.assign(Object.assign({},process.env),{GIT_EDITOR:"true"})},resource:"rebaseContinue",gitDir:t})}))},t.rebaseAbort=s,t.rebaseInteractive=function({runner:e,parentBranchRevision:t,branchName:n,gitDir:i}){return r(this,void 0,void 0,(function*(){return a({runner:e,args:["-i",t,n],resource:"rebaseInteractive",options:{stdio:"inherit"},gitDir:i})}))}},5755:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.rebaseInProgress=void 0;const o=i(n(32856)),s=i(n(71017));t.rebaseInProgress=function({gitDir:e}){return r(this,void 0,void 0,(function*(){return o.default.pathExists(s.default.join(e,"rebase-merge"))}))}},60770:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getCleanlyReconciledSquashedHead=void 0;const i=n(93333),o=n(67397);function s({onto:e,from:t,head:n,runner:o}){return r(this,void 0,void 0,(function*(){const r=yield o.runGitCommand({args:["commit-tree",`${e}^{tree}`,"-p",t,"-m","_"],onError:"throw",resource:"getRebasedTreeOntoCommitTree"});return o.runGitCommand({args:["merge-tree",r,n],onError:"throw",resource:"getRebasedTreeMergeTree"}).catch((e=>{if(e instanceof i.CommandFailedError&&1===e.exitCode)return null;throw e}))}))}t.getCleanlyReconciledSquashedHead=function({oldBase:e,oldHead:t,newBase:n,newHead:a,updatedBase:u,updatedHead:c,restackCommitterDateIsAuthorDate:l,runner:d,gitConfig:h}){return r(this,void 0,void 0,(function*(){const r=yield h("commit.gpgSign"),f=r&&"false"!==r&&"0"!==r,m=yield s({runner:d,onto:n,from:e,head:t});if(null===m)return null;const p=yield s({runner:d,onto:n,from:u,head:c});if(null===p)return null;const g=yield d.runGitCommand({args:["commit-tree",m,"-p",n,"-m","_"],onError:"throw",resource:"getCleanlyReconciledSquashedHeadOldTreeCommit"}),v=yield d.runGitCommand({args:["commit-tree",p,"-p",g,"-m","_"],onError:"throw",resource:"getCleanlyReconciledSquashedHeadUpdatedTreeCommit"}),y=yield d.runGitCommand({args:["commit-tree",`${a}^{tree}`,"-p",g,"-m","_"],onError:"throw",resource:"getCleanlyReconciledSquashedHeadNewHeadCommit"}),b=yield d.runGitCommand({args:["merge-tree",y,v],onError:"throw",resource:"getCleanlyReconciledSquashedHeadMergeTree"}).catch((e=>{if(e instanceof i.CommandFailedError&&1===e.exitCode)return null;throw e}));if(null===b)return null;const E=(yield(0,o.getFormattedCommitOrRange)({format:"SHA",runner:d,head:a,base:n})).at(-1);if(!E)return null;const{authorName:_,authorEmail:w,authorDate:C,message:R}=yield(0,o.getRebaseMetadataForCommit)({runner:d,sha:E});return d.runGitCommand({args:["commit-tree",b,"-p",n,"-m",R,...f?["-S"]:[]],onError:"throw",resource:"getCleanlyReconciledSquashedHeadCommitTree",options:{env:Object.assign(Object.assign(Object.assign({},process.env),{GIT_AUTHOR_NAME:_,GIT_AUTHOR_EMAIL:w,GIT_AUTHOR_DATE:C}),l&&{GIT_COMMITTER_DATE:C})}})}))}},22925:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getRemoteUrl=void 0,t.getRemoteUrl=function({runner:e,remote:t}){return n(this,void 0,void 0,(function*(){return e.runGitCommand({args:["remote","get-url",t,"--push"],onError:"throw",resource:"getRemoteUrl"})}))}},58468:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getRepoPaths=void 0,t.getRepoPaths=function({runner:e}){return n(this,void 0,void 0,(function*(){try{const[t,n,r]=yield e.runGitCommandAndSplitLines({args:["rev-parse","--path-format=absolute","--show-toplevel","--git-common-dir","--git-dir"],onError:"throw",resource:"getRepoPaths"});return{repoRoot:t,gitCommonDir:n,gitDir:r}}catch(e){return}}))}},52282:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.trackedReset=t.keepReset=t.mixedReset=t.softReset=void 0,t.softReset=function({sha:e,runner:t}){return n(this,void 0,void 0,(function*(){yield t.runGitCommand({args:["reset","-q","--soft",e,"--"],onError:"throw",resource:"softReset"})}))},t.mixedReset=function({sha:e,runner:t}){return n(this,void 0,void 0,(function*(){yield t.runGitCommand({args:["reset","-q","--mixed",...e?[e,"--"]:[]],onError:"throw",resource:"mixedReset"})}))},t.keepReset=function({sha:e,runner:t}){return n(this,void 0,void 0,(function*(){yield t.runGitCommand({args:["reset","-q","--keep",e,"--"],onError:"throw",resource:"keepReset"})}))},t.trackedReset=function({sha:e,runner:t}){return n(this,void 0,void 0,(function*(){yield t.runGitCommand({args:["reset","-Nq",e,"--"],onError:"throw",resource:"trackedReset"})}))}},19963:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.setRemoteTracking=void 0,t.setRemoteTracking=function({remote:e,branchName:t,sha:r,runner:i}){return n(this,void 0,void 0,(function*(){yield i.runGitCommand({args:["update-ref",`refs/remotes/${e}/${t}`,r],onError:"throw",resource:"setRemoteTracking"}),yield i.runGitCommand({args:["branch","-u",`${e}/${t}`,t],onError:"ignore",resource:"setRemoteTrackingUpstream"})}))}},19109:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.showCommits=void 0,t.showCommits=function({base:e,head:t,patch:r,runner:i}){return n(this,void 0,void 0,(function*(){return i.runGitCommand({args:["-c","color.ui=always","--no-pager","log",..."patch"===r?["-p"]:"stat"===r?["--stat"]:[],`${e}..${t}`,"--"],onError:"throw",resource:"showCommits"})}))}},75122:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getBranchNamesAndRevisions=void 0,t.getBranchNamesAndRevisions=function({runner:e}){return n(this,void 0,void 0,(function*(){const t={};return(yield e.runGitCommandAndSplitLines({args:["for-each-ref","--format=%(refname:short):%(objectname)","--sort=-committerdate","refs/heads/"],onError:"throw",resource:"getBranchNamesAndRevisions"})).map((e=>e.split(":"))).filter((e=>2===e.length&&e.every((e=>e.length>0)))).forEach((([e,n])=>t[e]=n)),t}))}},64568:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};function r({runner:e}){return n(this,void 0,void 0,(function*(){const t=yield e.runGitCommand({args:["--no-optional-locks","status","-z"],onError:"throw",resource:"getRawStatus",noTrim:!0}),n=t.split("\0"),r=[];for(let e=0;e<n.length-1;e++){const i=n[e],s=i[0],a=i[1];if(!o(s)||!o(a))throw new Error("Invalid status output:\n"+t);const u=i.slice(3),c=["R","C"].includes(s)||["R","C"].includes(a)?n[++e]:void 0;r.push({path:u,from:c,indexStatus:s,workingTreeStatus:a})}return r}))}Object.defineProperty(t,"__esModule",{value:!0}),t.getStatus=t.getUnmergedFiles=t.detectUntrackedChanges=t.trackedUnstagedChanges=t.detectStagedChanges=t.refreshIndex=void 0,t.refreshIndex=function({runner:e}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["status"],onError:"ignore",resource:"refreshIndex"})}))},t.detectStagedChanges=function({runner:e}){return n(this,void 0,void 0,(function*(){return(yield r({runner:e})).some((({indexStatus:e,workingTreeStatus:t})=>["M","T","C","R"].includes(e)||["A","D"].includes(e)&&e!==t))}))},t.trackedUnstagedChanges=function({runner:e}){return n(this,void 0,void 0,(function*(){return(yield r({runner:e})).some((({indexStatus:e,workingTreeStatus:t})=>"U"===e||["U","M","T","A","D","C","R"].includes(t)))}))},t.detectUntrackedChanges=function({runner:e}){return n(this,void 0,void 0,(function*(){return(yield r({runner:e})).some((({indexStatus:e,workingTreeStatus:t})=>"?"===e||"?"===t))}))},t.getUnmergedFiles=function({runner:e}){return n(this,void 0,void 0,(function*(){return(yield r({runner:e})).filter((({indexStatus:e,workingTreeStatus:t})=>"U"===e||"U"===t||"A"===e&&"A"===t||"D"===e&&"D"===t)).map((({path:e})=>e))}))},t.getStatus=function({runner:e}){return n(this,void 0,void 0,(function*(){return(yield r({runner:e})).map((({indexStatus:e,workingTreeStatus:t,path:n,from:r})=>Object.assign(Object.assign({},function(e,t){if("A"===e&&"A"===t||"D"===e&&"D"===t||"U"===e||"U"===t)return{status:"unresolved",staged:"none"};if("?"===t)return{status:"added",staged:"none"};if(" "===e){if("M"===t||"T"===t)return{status:"modified",staged:"none"};if("D"===t)return{status:"deleted",staged:"none"};if("C"===t)return{status:"copied",staged:"none"};if("R"===t)return{status:"renamed",staged:"none"};if("A"===t)return{status:"added",staged:"none"}}return"M"===e||"T"===e?{status:"modified",staged:" "===t?"full":"partial"}:"A"===e?{status:"added",staged:" "===t?"full":"partial"}:"D"===e?{status:"deleted",staged:" "===t?"full":"partial"}:"C"===e?{status:"copied",staged:" "===t?"full":"partial"}:"R"===e?{status:"renamed",staged:" "===t?"full":"partial"}:{status:"modified",staged:"none"}}(e,t)),{path:n,from:r})))}))};const i=["M","T","A","D","C","R","U"," ","?","!"];function o(e){return i.includes(e)}},70081:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};function r({runner:e}){return n(this,void 0,void 0,(function*(){return(yield e.runGitCommandAndSplitLines({args:["-c","color.ui=false","status","-s"],onError:"throw",resource:"findUntrackedFiles"})).filter((e=>e.startsWith("??"))).map((e=>e.substring(3)))}))}function i({runner:e,filePaths:t}){return n(this,void 0,void 0,(function*(){yield e.runGitCommandAndSplitLines({args:["add","--intent-to-add",...t],onError:"throw",resource:"trackFiles"})}))}Object.defineProperty(t,"__esModule",{value:!0}),t.trackAllNewFiles=t.trackFiles=t.findUntrackedFiles=void 0,t.findUntrackedFiles=r,t.trackFiles=i,t.trackAllNewFiles=function({runner:e}){return n(this,void 0,void 0,(function*(){const t=yield r({runner:e});yield i({runner:e,filePaths:t})}))}},70435:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.commuteHunkBefore=t.getNetChangeInHunk=t.translateNewLinesInHunk=t.translateHunk=t.getBoundsOfHunk=void 0;const r=n(34490);function i(e){const{oldStart:t,newStart:n}=e,r=e.lines.filter((({type:e})=>"remove"===e)),i=e.lines.filter((({type:e})=>"add"===e));return{oldStart:t,oldEnd:r.length?t+r.length-1:void 0,newStart:n,newEnd:i.length?n+i.length-1:void 0}}function o(e,t){return Object.assign(Object.assign({},e),{oldStart:e.oldStart+t,newStart:e.newStart+t})}function s(e){return e.lines.reduce(((e,t)=>{switch(t.type){case"remove":return e-1;case"add":return e+1;default:(0,r.assertUnreachable)(t)}}),0)}t.getBoundsOfHunk=i,t.translateHunk=o,t.translateNewLinesInHunk=function(e,t){return Object.assign(Object.assign({},e),{newStart:e.newStart+t})},t.getNetChangeInHunk=s,t.commuteHunkBefore=function({originalBeforeHunk:e,originalAfterHunk:t}){const{newStart:n,newEnd:r}=i(e),{oldStart:a,oldEnd:u}=i(t);return(null!=u?u:a)<n||void 0===r&&void 0!==u&&u===n?t:(null!=r?r:n)<a||void 0!==r&&void 0===u&&r===a?o(t,-1*s(e)):void 0}},39314:(e,t)=>{function n({hunk:e}){const t=e.lines.filter((e=>"remove"===e.type)),n=e.lines.filter((e=>"add"===e.type));return[`@@ -${e.oldStart},${t.length} +${e.newStart},${n.length} @@`,...t.map((e=>`-${e.text}`)),...e.oldNoNewlineAtEndOfFile?["\"]:[],...n.map((e=>`+${e.text}`)),...e.newNoNewlineAtEndOfFile?["\"]:[]].join("\n")}Object.defineProperty(t,"__esModule",{value:!0}),t.computePatchFromHunk=t.computePatchFromHunks=void 0,t.computePatchFromHunks=function({path:e,hunks:t}){return 0===t.length?null:[`diff --git ${e} ${e}`,`--- ${e}`,`+++ ${e}`,...t.sort(((e,t)=>e.oldStart-t.oldStart)).map((e=>n({hunk:e})))].join("\n")},t.computePatchFromHunk=n},4541:(e,t)=>{function n(e){const[t,...n]=e.split("\n@@");if(!t)throw new Error("empty diff file");const i=t.split("\n"),o=i[0];if(!o)throw new Error("empty diff file prefix");let[s,a]=o.split(" ");if(!s||!a)throw new Error("invalid diff file prefix line "+o);for(const e of i.slice(1))if(e.startsWith("new file"))s="/dev/null";else if(e.startsWith("deleted file"))a="/dev/null";else if(!(e.startsWith("---")||e.startsWith("+++")||e.startsWith("new mode")||e.startsWith("old mode")||e.startsWith("index")||e.startsWith("rename")||e.startsWith("similarity")||e.startsWith("dissimilarity")||e.startsWith("Binary")||""===e))throw new Error("invalid diff file prefix line "+e);return{oldFilename:s,newFilename:a,hunks:n.map((e=>{try{return r(e)}catch(t){throw new Error(`Error parsing hunk for file ${s} ${a}:\n${"object"==typeof t&&t&&"message"in t&&t.message}\n${e}`)}}))}}function r(e){const[t,...n]=e.split("\n");if(!t)throw new Error("empty hunk");const[r]=t.split("@@");if(!r)throw new Error("invalid hunk header "+t);const[i,o]=r.trim().split(" ");if(!i||!o)throw new Error("invalid hunk header "+t);const[s,a]=i.slice(1).split(","),[u,c]=o.slice(1).split(",");if(!s||!u)throw new Error("invalid hunk header "+t);let l,d=+s,h=+u,f=!1,m=!1;const p=[];for(const e of n){if(0===e.length)continue;const t=e[0],n=e.slice(1);switch(t){case"-":d++,p.push({type:"remove",text:n});break;case"+":h++,p.push({type:"add",text:n});break;case" ":d++,h++,p.push({type:"context",text:n});break;case"\\":if(!l||" No newline at end of file"!==n)throw new Error("invalid hunk line "+e);switch(l){case"-":f=!0;break;case"+":m=!0;break;case" ":f=!0,m=!0;break;default:throw new Error("invalid hunk line "+e)}break;default:throw new Error("invalid hunk line "+e)}l=t}const g=+s+(a?+a:1);if(d!==g)throw new Error("invalid hunk old line count "+d+" should be "+g);const v=+u+(c?+c:1);if(h!==v)throw new Error("invalid hunk new line count "+h+" should be "+v);return{oldNoNewlineAtEndOfFile:f,newNoNewlineAtEndOfFile:m,oldStart:+s,newStart:+u,lines:p}}Object.defineProperty(t,"__esModule",{value:!0}),t.parseDiffHunkForTest=t.parseHunksFromDiff=void 0,t.parseHunksFromDiff=function(e){return e?("\n"+e.trimStart()).split("\ndiff --git ").filter(Boolean).map(n):[]},t.parseDiffHunkForTest=r},21542:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reduceHunksToZeroContext=void 0;const r=n(34490);t.reduceHunksToZeroContext=function(e){return e.map((e=>({oldFilename:e.oldFilename,newFilename:e.newFilename,hunks:e.hunks.flatMap((e=>{const t=[];let n=e.oldStart,i=e.newStart,o=n,s=i,a=[];for(const u of e.lines)if("context"!==u.type)switch(u.type){case"remove":a.push({type:"remove",text:u.text}),n++;break;case"add":a.push({type:"add",text:u.text}),i++;break;default:(0,r.assertUnreachable)(u)}else a.length>0&&t.push({oldStart:o,newStart:s,lines:a,oldNoNewlineAtEndOfFile:!1,newNoNewlineAtEndOfFile:!1}),o=++n,s=++i,a=[];return a.length>0&&t.push({oldStart:o,newStart:s,lines:a,oldNoNewlineAtEndOfFile:e.oldNoNewlineAtEndOfFile,newNoNewlineAtEndOfFile:e.newNoNewlineAtEndOfFile}),t.map((e=>{if(0===e.lines.length)throw new Error("empty hunk");return e.oldStart>0&&!e.lines.some((e=>"remove"===e.type))?Object.assign(Object.assign({},e),{oldStart:e.oldStart-1}):e.newStart>0&&!e.lines.some((e=>"add"===e.type))?Object.assign(Object.assign({},e),{newStart:e.newStart-1}):e}))}))})))}},9682:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GitRepo=void 0;const o=n(32081),s=i(n(32856)),a=i(n(71017)),u=n(93333),c="test.txt";t.GitRepo=class{constructor(e,t){this.dir=e,this.runner=(0,u.composeGitRunner)({cwd:e,debug:process.env.DEBUG?e=>console.log(e):()=>{}}),this.userConfigPath=a.default.join(e,".git/.graphite_user_config"),(null==t?void 0:t.existingRepo)||(0,o.spawnSync)("git",(null==t?void 0:t.repoUrl)?["clone",t.repoUrl,e]:["init",e,"-b","main"]),(0,o.spawnSync)("git",["config","user.email","test@graphite.dev"],{cwd:e}),(0,o.spawnSync)("git",["config","user.name","graphite_test"],{cwd:e})}runGitCommand(e){return r(this,void 0,void 0,(function*(){return this.runner.runGitCommand({args:e,onError:"throw",resource:"test"})}))}createChange(e,t,n){return r(this,void 0,void 0,(function*(){const r=a.default.join(`${this.dir}`,`${t?t+"_":""}${c}`);s.default.writeFileSync(r,e),n||(yield this.runGitCommand(["add",r]))}))}readFileContents(e){const t=a.default.join(`${this.dir}`,`${e?e+"_":""}${c}`);return s.default.readFileSync(t,"utf8")}createChangeAndCommit(e,t){return r(this,void 0,void 0,(function*(){yield this.createChange(e,t),yield this.runGitCommand(["add","."]),yield this.runGitCommand(["commit","-m",e])}))}createChangeAndAmend(e,t){return r(this,void 0,void 0,(function*(){yield this.createChange(e,t),yield this.runGitCommand(["add","."]),yield this.runGitCommand(["commit","--amend","--no-edit"])}))}deleteBranch(e){return r(this,void 0,void 0,(function*(){yield this.runGitCommand(["branch","-D",e])}))}hasStagedChanges(){return r(this,void 0,void 0,(function*(){return(yield this.runGitCommand(["diff","--cached"])).length>0}))}createPrecommitHook(e){s.default.mkdirpSync(`${this.dir}/.git/hooks`),s.default.writeFileSync(`${this.dir}/.git/hooks/pre-commit`,e),(0,o.spawnSync)("chmod",["+x",`${this.dir}/.git/hooks/pre-commit`])}createAndCheckoutBranch(e){return r(this,void 0,void 0,(function*(){yield this.runGitCommand(["checkout","-b",e])}))}checkoutBranch(e){return r(this,void 0,void 0,(function*(){yield this.runGitCommand(["checkout",e])}))}rebaseInProgress(){return s.default.existsSync(a.default.join(this.dir,".git","rebase-merge"))}resolveMergeConflicts(){return r(this,void 0,void 0,(function*(){yield this.runGitCommand(["checkout","--theirs","."])}))}markMergeConflictsAsResolved(){return r(this,void 0,void 0,(function*(){yield this.runGitCommand(["add","."])}))}currentBranchName(){return r(this,void 0,void 0,(function*(){return this.runGitCommand(["branch","--show-current"])}))}getBranchSha(e){return r(this,void 0,void 0,(function*(){return this.runGitCommand(["rev-parse",`refs/heads/${e}`])}))}listCurrentBranchCommitMessages(){return r(this,void 0,void 0,(function*(){return(yield this.runGitCommand(["log","--oneline","--format=%B"])).split("\n").filter((e=>e.length>0))}))}}},53649:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GitRepo=t.CommandKilledError=t.CommandFailedError=t.reduceHunksToZeroContext=t.parseHunksFromDiff=t.parseDiffHunkForTest=t.computePatchFromHunks=t.computePatchFromHunk=t.translateNewLinesInHunk=t.translateHunk=t.getNetChangeInHunk=t.getBoundsOfHunk=t.commuteHunkBefore=t.composeGitConfig=t.composeGit=void 0;var r=n(9164);Object.defineProperty(t,"composeGit",{enumerable:!0,get:function(){return r.composeGit}});var i=n(50279);Object.defineProperty(t,"composeGitConfig",{enumerable:!0,get:function(){return i.composeGitConfig}});var o=n(70435);Object.defineProperty(t,"commuteHunkBefore",{enumerable:!0,get:function(){return o.commuteHunkBefore}}),Object.defineProperty(t,"getBoundsOfHunk",{enumerable:!0,get:function(){return o.getBoundsOfHunk}}),Object.defineProperty(t,"getNetChangeInHunk",{enumerable:!0,get:function(){return o.getNetChangeInHunk}}),Object.defineProperty(t,"translateHunk",{enumerable:!0,get:function(){return o.translateHunk}}),Object.defineProperty(t,"translateNewLinesInHunk",{enumerable:!0,get:function(){return o.translateNewLinesInHunk}});var s=n(39314);Object.defineProperty(t,"computePatchFromHunk",{enumerable:!0,get:function(){return s.computePatchFromHunk}}),Object.defineProperty(t,"computePatchFromHunks",{enumerable:!0,get:function(){return s.computePatchFromHunks}});var a=n(4541);Object.defineProperty(t,"parseDiffHunkForTest",{enumerable:!0,get:function(){return a.parseDiffHunkForTest}}),Object.defineProperty(t,"parseHunksFromDiff",{enumerable:!0,get:function(){return a.parseHunksFromDiff}});var u=n(21542);Object.defineProperty(t,"reduceHunksToZeroContext",{enumerable:!0,get:function(){return u.reduceHunksToZeroContext}});var c=n(93333);Object.defineProperty(t,"CommandFailedError",{enumerable:!0,get:function(){return c.CommandFailedError}}),Object.defineProperty(t,"CommandKilledError",{enumerable:!0,get:function(){return c.CommandKilledError}});var l=n(9682);Object.defineProperty(t,"GitRepo",{enumerable:!0,get:function(){return l.GitRepo}})},93333:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.CommandKilledError=t.CommandFailedError=t.composeGitRunner=void 0;const i=n(32081),o=n(97503);t.composeGitRunner=({cwd:e,debug:t})=>{const n=n=>r(void 0,void 0,void 0,(function*(){var r;const i=null!==(r=n.cwd)&&void 0!==r?r:e,s=Object.assign(Object.assign(Object.assign({},n),i?{args:["-C",i,...n.args]}:{}),{debug:t});return n.resource&&o.tracer.currentSpanId?o.tracer.span({name:"spawnedCommand",resource:n.resource,meta:{runCommandArgs:JSON.stringify(n,null,2)}},(()=>u(s))):u(s)}));return{runGitCommand:n,runGitCommandAndSplitLines:e=>r(void 0,void 0,void 0,(function*(){return(yield n(e)).split("\n").filter((e=>e.length>0))}))}};const s=5,a=50;function u({args:e,options:t,debug:n,noTrim:r,onError:o,input:d,resource:h,numIndexLockRetries:f}){return null==n||n(`Spawning ${h}: git ${e.join(" ")}`),f&&(null==n||n(`index.lock retry: ${f}`)),new Promise(((m,p)=>{var g,v;const y=(0,i.spawn)("git",e,Object.assign(Object.assign({},t),{windowsHide:!0}));d&&(null===(g=y.stdin)||void 0===g||g.write(d),null===(v=y.stdin)||void 0===v||v.end());let b="";y.stdout&&(y.stdout.setEncoding("utf8"),y.stdout.on("data",(function(e){b+=e.toString()})));let E="";y.stderr&&(y.stderr.setEncoding("utf8"),y.stderr.on("data",(function(e){E+=e.toString()}))),y.addListener("close",((i,d)=>{return null==n||n(`Finished ${h}: git ${e.join(" ")}\n${JSON.stringify({code:i,signal:d,stdout:b,stderr:E},null,2)}`),d?p(new l({command:"git",args:e,signal:d,stdout:b,stderr:E})):0===i?m(r?b:b.trim()):(null!=f?f:0)<s&&E.includes("index.lock")?m((g=a,new Promise((e=>setTimeout(e,g)))).then((()=>u({args:e,options:t,debug:n,onError:o,resource:h,numIndexLockRetries:(null!=f?f:0)+1})))):"ignore"===o?m(""):p(new c({command:"git",args:e,status:i||1,stdout:b,stderr:E}));var g}))}))}class c extends Error{constructor(e){super([e.errno&&e.code?`Command failed with error ${e.code} (${e.errno}), exit code ${e.status}:`:`Command failed with error exit code ${e.status}:`,[e.command].concat(e.args).join(" "),e.stdout,e.stderr].join("\n")),this.exitCode=e.status,this.name="CommandFailed"}}t.CommandFailedError=c;class l extends Error{constructor(e){super([`Command killed with signal ${e.signal}:`,[e.command].concat(e.args).join(" "),e.stdout,e.stderr].join("\n")),this.name="CommandKilled"}}t.CommandKilledError=l},95808:(e,t,n)=>{t.composeGit=void 0;var r=n(53649);Object.defineProperty(t,"composeGit",{enumerable:!0,get:function(){return r.composeGit}});n(97503),n(53649)},97503:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.tracer=void 0;const r=i();function i(){return Math.ceil(1e9*Math.random())}function o(e){return null!=e}const s=BigInt(Date.now())*BigInt(1e6)-process.hrtime.bigint();function a(){return process.hrtime.bigint()+s}class u{constructor(e){this.name=e.name,this.parentId=e.parentId,this.resource=e.resource,this.meta=e.meta,this.spanId=i(),this.start=a()}end(e,t){this.endedSpan=Object.assign({error:t?1:0,meta:Object.assign(Object.assign(Object.assign({},"string"==typeof e?{result:e}:Object.assign({},e)),t?Object.assign({"error.msg":t.message,"error.type":t.constructor.name},t.stack?{"error.stack":t.stack}:{}):{}),this.meta),metrics:{},name:this.name,resource:this.resource,service:"graphite-cli",span_id:this.spanId,start:Number(this.start),trace_id:r,type:"custom",duration:Number(a()-this.start)},this.parentId?{parent_id:this.parentId}:{parent_id:0})}}t.tracer=new class{constructor(){this.allSpans=[]}startSpan(e){const t=new u(Object.assign(Object.assign({},e),this.currentSpanId?{parentId:this.currentSpanId}:{}));return this.allSpans.push(t),t}span(e,t){return n(this,void 0,void 0,(function*(){const n=this.startSpan(e);let r;this.currentSpanId=n.spanId;try{r=yield t()}catch(e){throw n.end(r,e instanceof Error?e:new Error("unknown error")),e}return n.end(r),this.currentSpanId=n.parentId,r}))}flushJson(){let e=this.allSpans.map((e=>e.endedSpan)).filter(o);const t=e.find((e=>"command"==e.name));t&&(e=e.map((e=>Object.assign(Object.assign({},e),null!=e.parent_id?{parent_id:e.parent_id}:{parent_id:t.span_id}))));const n=[e];return this.allSpans=this.allSpans.filter((e=>!e.endedSpan)),JSON.stringify(n)}}},33800:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.labelForComparison=t.ComparisonType=void 0,function(e){e.UncommittedChanges="UNCOMMITTED",e.HeadChanges="HEAD",e.StackChanges="STACK",e.Committed="InCommit",e.Commit="Commit",e.Range="Range"}(n=t.ComparisonType||(t.ComparisonType={})),t.labelForComparison=function(e){switch(e.type){case n.UncommittedChanges:return"Uncommitted changes";case n.HeadChanges:return"Changes in current commit";case n.StackChanges:return"Changes in current branch";case n.Committed:return`Changes in ${e.hash}`;case n.Commit:return`In ${e.sha}`;case n.Range:return`From ${e.fromSha} to ${e.toSha}`}}},2982:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.cached=t.LRU=void 0;const r=n(30826);class i{constructor(e,t=3){this.maxItems=e,this.maxHashCollision=t,this.cache=new Map}get(e){let t;const n=o(e),i=this.cache.get(n);if(void 0!==i){const o=i.get(e);if(void 0!==o)t=o;else for(const[n,o]of i)if((0,r.is)(e,n)){t=o;break}this.cache.delete(n),this.cache.set(n,i)}return t}set(e,t){const n=o(e);let r=this.cache.get(n);if(void 0===r||r.size>=this.maxHashCollision?r=new Map([[e,t]]):r.set(e,t),this.cache.delete(n),void 0!==t&&(this.cache.set(n,r),this.cache.size>this.maxItems)){const e=this.cache.keys().next();e.done||this.cache.delete(e.value)}}delete(e){const t=o(e);this.cache.delete(t)}clear(){this.cache.clear()}}function o(e){const t=null==e?void 0:e.hashCode;return void 0!==t?t.apply(e):e}function s(e,t){var n,o;const s=null!==(n=null==t?void 0:t.cache)&&void 0!==n?n:new i(null!==(o=null==t?void 0:t.cacheSize)&&void 0!==o?o:10),a=null==t?void 0:t.getExtraKeys,c=function(...t){var n,i,o;const c=s.stats;if(!t.every(u))return null!=c&&(c.skip=(null!==(n=c.skip)&&void 0!==n?n:0)+1),e.apply(this,t);const l=(0,r.List)(a?[...a.apply(this),...t]:t),d=s.get(l);if(void 0!==d)return null!=c&&(c.hit=(null!==(i=c.hit)&&void 0!==i?i:0)+1),d;null!=c&&(c.miss=(null!==(o=c.miss)&&void 0!==o?o:0)+1);const h=e.apply(this,t);return s.set(l,h),h};return c.cache=s,c}t.LRU=i,t.cached=function(e,t){return"function"==typeof e?s(e,t):function(e){var t;const n=null!==(t=null==e?void 0:e.getExtraKeys)&&void 0!==t?t:function(){return(0,r.isValueObject)(this)?[this]:null!=this&&"object"==typeof this?Object.values(this).filter(u):[]};return function(t,r,i){const o=i.value;i.value=s(o,Object.assign(Object.assign({},e),{getExtraKeys:n}))}}(e)};const a=new Set(["number","string","boolean","symbol","bigint","undefined","null"]);function u(e){if(null==e)return!0;const t=typeof e;return!!a.has(t)||!("object"!==t||!(0,r.isValueObject)(e))}},61110:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},5693:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(61110),t),i(n(52568),t),i(n(11268),t),i(n(66877),t)},52568:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},11268:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Tracker=void 0;const r=n(48427);class i{constructor(e,t){this.sendData=e,this.context=t}error(e,t,n,r){const i=n instanceof Error?n.message||String(n):n;return this.track(e,Object.assign(Object.assign({},null!=r?r:{}),{errorMessage:i,errorName:t}))}operation(e,t,n,i){var o;const s=Date.now(),a=null!==(o=null==n?void 0:n.id)&&void 0!==o?o:(0,r.randomId)();try{const o=i({parentId:a});if((0,r.isPromise)(o))return o.then((t=>{const r=Date.now()-s;return this.track(e,Object.assign(Object.assign({},null!=n?n:{}),{duration:r,id:a})),t})).catch((r=>{const i=Date.now()-s;return this.error(e,t,r,Object.assign(Object.assign({},null!=n?n:{}),{duration:i,id:a})),Promise.reject(r)}));{const t=Date.now()-s;return this.track(e,Object.assign(Object.assign({},null!=n?n:{}),{duration:t,id:a})),o}}catch(r){const i=Date.now()-s;throw this.error(e,t,r,Object.assign(Object.assign({},null!=n?n:{}),{duration:i,id:a})),r}}trackAsParent(e,t){var n;const o=null!==(n=null==t?void 0:t.id)&&void 0!==n?n:(0,r.randomId)();return this.trackData(Object.assign(Object.assign({},t),{eventName:e,id:o})),new i(((e,t)=>this.trackData(Object.assign(Object.assign({},e),t))),{parentId:o})}track(e,t){return this.trackData(Object.assign(Object.assign({},t),{eventName:e}))}trackData(e){var t,n;const i=null!==(t=null==e?void 0:e.id)&&void 0!==t?t:(0,r.randomId)(),o=null!==(n=null==e?void 0:e.timestamp)&&void 0!==n?n:Date.now(),s=Object.assign({timestamp:o,id:i},null!=e?e:{});this.sendData(s,this.context)}}t.Tracker=i},66877:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},66960:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=void 0,t.debounce=function(e,t,n=void 0,r=!1){let i,o=!0;function s(...a){let u;if(r){if(u=function(){o=!0,i=void 0},!o)return clearTimeout(i),void(i=setTimeout(u,t));o=!1,e.apply(n,a)}else s.reset(),u=function(){i=void 0,e.apply(n,a)};i=setTimeout(u,t)}return s.reset=function(){clearTimeout(i),i=void 0,o=!0},s.isPending=function(){return null!=i},s}},98696:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(5693),t),i(n(33800),t),i(n(66960),t),i(n(2982),t),i(n(75905),t),i(n(85249),t),i(n(40256),t),i(n(86099),t),i(n(66224),t),i(n(48427),t)},75905:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.parsePatch=t.DiffType=void 0,function(e){e.Modified="Modified",e.Added="Added",e.Removed="Removed",e.Renamed="Renamed",e.Copied="Copied"}(n=t.DiffType||(t.DiffType={}));const r=/^diff --git (.*) (.*)$/,i=/^rename from (.*)$/,o=/^rename to (.*)$/,s=/^copy from (.*)$/,a=/^copy to (.*)$/,u=/^new file mode (\d{6})$/,c=/^deleted file mode (\d{6})$/,l=/^old mode (\d{6})$/,d=/^new mode (\d{6})$/,h=/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,f=/^--- (.*)$/,m=/^\+\+\+ (.*)$/,p=/\r\n|[\n\v\f\r\x85]/g;function g(e,t){if(!1===e)throw new Error(t)}t.parsePatch=function(e){const t=e.split(p),v=e.match(p)||[],y=[];let b=0;function E(){const e={hunks:[]};for(y.push(e),function(e){for(;b<t.length;){const n=t[b],i=r.exec(n);if(i){e.oldFileName=i[1],e.newFileName=i[2],b++;break}b++}}(e);b<t.length;){const n=t[b];if(/^old mode/.test(n))_(e);else if(/^new mode/.test(n))w(e);else if(/^deleted file mode/.test(n))C(e);else if(/^new file mode/.test(n))R(e);else if(/^copy /.test(n))O(e);else if(/^rename /.test(n))S(e);else{if(/^--- /.test(n)){P(e);break}if(/^diff --git/.test(n))break;b++}}!function(e){for(;b<t.length;){const n=t[b];if(r.test(n))break;/^@@/.test(n)?e.hunks.push(A()):b++}}(e)}function _(e){const r=l.exec(t[b]);g(null!==r,`invalid format '${t[b]}'`),e.oldMode=r[1],e.type=n.Modified,b++}function w(e){const r=d.exec(t[b]);g(null!==r,`invalid format '${t[b]}'`),e.newMode=r[1],e.type=n.Modified,b++}function C(e){const r=c.exec(t[b]);g(null!==r,`invalid format '${t[b]}'`),e.newMode=r[1],e.type=n.Removed,b++}function R(e){const r=u.exec(t[b]);g(null!==r,`invalid format '${t[b]}'`),e.newMode=r[1],e.type=n.Added,b++}function O(e){g(s.test(t[b]),`invalid format '${t[b]}'`),g(a.test(t[b+1]),`invalid format '${t[b+1]}'`),e.type=n.Copied,b+=2}function S(e){g(i.test(t[b]),`invalid format '${t[b]}'`),g(o.test(t[b+1]),`invalid format '${t[b+1]}'`),e.type=n.Renamed,b+=2}function P(e){g(f.test(t[b]),`invalid format '${t[b]}'`),g(m.test(t[b+1]),`invalid format '${t[b+1]}'`),void 0===e.type&&(e.type=n.Modified),b+=2}function A(){const e=t[b++].split(h),n={oldStart:+e[1],oldLines:void 0===e[2]?1:+e[2],newStart:+e[3],newLines:void 0===e[4]?1:+e[4],lines:[],linedelimiters:[]};0===n.oldLines&&(n.oldStart+=1),0===n.newLines&&(n.newStart+=1);let r=0,i=0;for(;b<t.length&&!(0===t[b].indexOf("--- ")&&b+2<t.length&&0===t[b+1].indexOf("+++ ")&&0===t[b+2].indexOf("@@"));b++){const e=0==t[b].length&&b!=t.length-1?" ":t[b][0];if("+"!==e&&"-"!==e&&" "!==e&&"\\"!==e)break;n.lines.push(t[b]),n.linedelimiters.push(v[b]||"\n"),"+"===e?r++:"-"===e?i++:" "===e&&(r++,i++)}return r||1!==n.newLines||(n.newLines=0),i||1!==n.oldLines||(n.oldLines=0),n}for(;b<t.length;)E();return y}},85249:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeFromString=t.deserialize=t.serializeToString=t.serialize=void 0;const n={__rpcType:"undefined"};function r(e){if(void 0===e)return n;if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null===e)return e;if(e instanceof Map)return{__rpcType:"Map",data:Array.from(e.entries()).map((([e,t])=>[r(e),r(t)]))};if(e instanceof Set)return{__rpcType:"Set",data:Array.from(e.values()).map(r)};if(e instanceof Error)return{__rpcType:"Error",data:{message:e.message,stack:e.stack}};if(e instanceof Date)return{__rpcType:"Date",data:e.valueOf()};if(Array.isArray(e))return e.map((e=>r(e)));if("object"==typeof e){const t={__rpcType:"object"};for(const[n,i]of Object.entries(e))t[n]=r(i);return t}throw new Error(`cannot serialize argument ${e}`)}function i(e){if("object"!=typeof e||null==e)return e;if(Array.isArray(e))return e.map((e=>i(e)));const t=e;switch(t.__rpcType){case"undefined":return;case"Map":return new Map(t.data.map((([e,t])=>[i(e),i(t)])));case"Set":return new Set(t.data.map(i));case"Error":{const e=new Error;return e.stack=t.data.stack,e.message=t.data.message,e}case"Date":return new Date(t.data);case"object":{const t=e,n={};for(const[e,r]of Object.entries(t))"__rpcType"!==e&&(n[e]=i(r));return n}default:throw new Error(`cannot deserialize unknown type ${t}`)}}t.serialize=r,t.serializeToString=function(e){return JSON.stringify(r(e))},t.deserialize=i,t.deserializeFromString=function(e){return i(JSON.parse(e))}},40256:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},66224:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},50209:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.SucceedableRevset=t.CommandRunner=void 0,(n=t.CommandRunner||(t.CommandRunner={})).Graphite="gt",n.CodeReviewProvider="codeReviewProvider",t.SucceedableRevset=function(e){return{type:"succeedable-revset",revset:e}}},74259:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},45852:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1018:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorShortMessages=t.DEFAULT_DAYS_OF_COMMITS_TO_LOAD=t.ONE_MINUTE_MS=t.CLOSED_AND_SHOULD_NOT_RECONNECT_CODE=void 0,t.CLOSED_AND_SHOULD_NOT_RECONNECT_CODE=4100,t.ONE_MINUTE_MS=6e4,t.DEFAULT_DAYS_OF_COMMITS_TO_LOAD=void 0,(t.ErrorShortMessages||(t.ErrorShortMessages={})).NoCommitsFetched="No commits found"},29641:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},86099:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(50209),t),i(n(74259),t),i(n(45852),t),i(n(1018),t),i(n(29641),t),i(n(85119),t)},85119:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},48427:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isPromise=t.truncate=t.zip=t.generatorContains=t.mapObject=t.findParentWithClassName=t.basename=t.defer=t.randomId=t.unwrap=t.notEmpty=void 0,t.notEmpty=function(e){return null!=e},t.unwrap=function(e){if(null==e)throw new Error(`expected value not to be ${e}`);return e},t.randomId=function(){return Date.now().toString(36)+Math.random().toString(36)},t.defer=function(){const e={promise:void 0,resolve:void 0,reject:void 0};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e},t.basename=function(e,t="/"){const n=e.lastIndexOf(t);return-1===n?e:e.slice(n+1)},t.findParentWithClassName=function(e,t){var n;let r=e;for(;r;){if(null===(n=r.classList)||void 0===n?void 0:n.contains(t))return r;r=r.parentElement}},t.mapObject=function(e,t){return Object.fromEntries(Object.entries(e).map(t))},t.generatorContains=function(e,t){const n="function"==typeof t?t:e=>e===t;for(const t of e)if(n(t))return!0;return!1},t.zip=function*(e,t){const n=e[Symbol.iterator](),r=t[Symbol.iterator]();for(;;){const e=n.next(),t=r.next();if(e.done||t.done)break;yield[e.value,t.value]}},t.truncate=function(e,t=100){return e.length>t?e.substring(0,Math.max(0,t-1))+"…":e},t.isPromise=function(e){return"function"==typeof(null==e?void 0:e.then)}},66703:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isApprover=void 0,t.isApprover=function(e){return"APPROVED"===e.decision&&(e.hasWritePermission||null===e.hasWritePermission)}},27962:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.doesPrHaveMinimumRequiredApprovals=void 0;const r=n(66703);t.doesPrHaveMinimumRequiredApprovals=function({previousReviewers:e,numRequiredApproversBaseBranchRules:t,numRequiredApproversRestrictions:n}){return e.filter(r.isApprover).length>=Math.max(null!=t?t:1,...n.map((({numRequiredApprovers:e})=>e)))}},63261:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getHumanReadablePrMetastatus=t.doesPrHaveOpenReviewRequests=t.doesPrHaveClosedReviewRequests=t.doesPrHaveOpenChangesRequested=t.doesPrHaveMissingCodeownerReviews=t.mapCodeownerToKey=t.getPrMissingCodeowners=t.getPrMetastatus=t.GRAPHITE_BASE_BRANCH_PREFIX=void 0;const s=n(34490),a=o(n(57569)),u=n(66703);function c({previousReviewers:e,authorLogin:t,files:n}){const r=new Set(e.filter((e=>"APPROVED"===e.decision&&(e.hasWritePermission||null===e.hasWritePermission))).map((e=>e.username.toLowerCase())));return n.filter((e=>{var n,i,o;const a=(null!==(i=null===(n=e.codeowners)||void 0===n?void 0:n.owners)&&void 0!==i?i:[]).map((e=>{switch(e.kind){case"USER":return Object.assign(Object.assign({},e),{login:e.login.toLowerCase()});case"TEAM":return Object.assign(Object.assign({},e),{memberLogins:e.memberLogins.map((e=>e.toLowerCase()))});case"EMAIL":return Object.assign(Object.assign({},e),{email:e.email.toLowerCase()});default:(0,s.assertUnreachable)(e)}}));return e.codeowners&&e.codeowners.owners.length>0&&!function({approverLogins:e,owners:t}){return t.some((t=>{switch(t.kind){case"USER":return e.has(t.login);case"TEAM":return t.memberLogins.some((t=>e.has(t)));case"EMAIL":return!1;default:(0,s.assertUnreachable)(t)}}))}({approverLogins:r,owners:a})&&!function({authorLogin:e,owners:t}){if(null===e||1!==t.length)return!1;const n=t[0];return"USER"===n.kind&&n.login===e||!("TEAM"!==n.kind||1!==n.memberLogins.length||!n.memberLogins.includes(e))}({authorLogin:null!==(o=null==t?void 0:t.toLowerCase())&&void 0!==o?o:null,owners:a})}))}function l(e){switch(e.kind){case"USER":return e.login;case"TEAM":return`${e.org}/${e.team}`;case"EMAIL":return e.email;default:(0,s.assertUnreachable)(e)}}function d({previousReviewers:e,authorLogin:t,files:n}){return c({previousReviewers:e,authorLogin:t,files:n}).length>0}t.GRAPHITE_BASE_BRANCH_PREFIX="graphite-base",t.getPrMetastatus=function e({pr:n,downstackExclusivePrs:r,baseBranchRules:i,ignoreMergeStates:o,enableNeedsRestack:c}){var l,h,f;if("OPEN"!==n.state)return{prNumber:n.number,status:n.state};if(n.isDraft)return{prNumber:n.number,status:"DRAFT"};if(n.isQueuedToMerge&&!o)return{prNumber:n.number,status:"QUEUED_TO_MERGE"};if(n.isWaitingToMerge&&!o)return{prNumber:n.number,status:"WAITING_TO_MERGE"};const m=[],p=r[0];if(!o&&n.isInFailureHandling)return{prNumber:n.number,status:"BLOCKED",blockingReasons:[{reason:"FAILURE_HANDLING"}]};(null==i?void 0:i.lockBranch)&&m.push({reason:"BRANCH_LOCKED"}),p&&"MERGED"===p.state&&(n.parentBranch===p.branch||(null===(l=n.parentBranch)||void 0===l?void 0:l.startsWith(`${t.GRAPHITE_BASE_BRANCH_PREFIX}/`)))&&m.push({reason:"NEEDS_RESTACK__BASE_BRANCH_MERGED"}),c&&n.lastPushedAt&&n.lastBaseRefChangedAt&&n.lastPushedAt<n.lastBaseRefChangedAt&&m.push({reason:"NEEDS_RESTACK__BASE_REF_CHANGED"}),n.hasMergeConflicts&&m.push({reason:"MERGE_CONFLICTS"}),"FAILING_REQUIRED"===n.ciRollup.status&&m.push({reason:"FAILING_REQUIRED"});const g=null!==(h=null==i?void 0:i.requiresApprovingReviews)&&void 0!==h?h:null;(null===g||g)&&n.previousReviewers.some((e=>(e.hasWritePermission||null===e.hasWritePermission)&&"CHANGES_REQUESTED"===e.decision))&&m.push({reason:"CHANGES_REQUESTED"}),(null==i?void 0:i.requiresCodeOwnerReviews)&&d(n)&&m.push({reason:"NEEDS_CODEOWNER_APPROVALS"});const v=a.computeNeedsRequiredApproverBlockingReason(n);v&&m.push(v);const y=n.previousReviewers.filter(u.isApprover);(null!==(f=null==i?void 0:i.requiredApprovingReviewCount)&&void 0!==f?f:0)>y.length&&m.push({reason:"NEEDS_APPROVALS"});const b=a.computeNeedsApprovalBlockingReason(n);b&&m.push(b),"RUNNING"===n.ciRollup.status&&m.push({reason:"RUNNING"}),(null==i?void 0:i.requiresConversationResolution)&&n.unresolvedThreadCount>0&&m.push({reason:"UNRESOLVED_COMMENTS"});const E=0===r.length?void 0:e({pr:r[0],downstackExclusivePrs:r.slice(1),baseBranchRules:i,ignoreMergeStates:o}),_=function({parentMetastatus:e,hasThirdPartyMergeQueueLabel:t,hasActiveEntryInGithubMergeQueue:n,ciRollupStatus:r}){switch(e){case"BLOCKED":case"HANDED_OFF_TO_EXTERNAL_MERGE_QUEUE":return"WAITING_ON_DOWNSTACK";case"HARD_BLOCKED":case"CLOSED":case"DRAFT":case"WAITING_TO_MERGE":return"HARD_WAITING_ON_DOWNSTACK";case void 0:case"MERGED":return t||n?"HANDED_OFF_TO_EXTERNAL_MERGE_QUEUE":"PASSING_WITH_SKIPPED"===r?"READY_TO_MERGE_WITHOUT_CI":"READY_TO_MERGE";case"QUEUED_TO_MERGE":return"READY_TO_MERGE";case"READY_TO_MERGE":case"READY_TO_MERGE_AS_STACK":return"PASSING_WITH_SKIPPED"===r?"READY_TO_MERGE_AS_STACK_WITHOUT_CI":"READY_TO_MERGE_AS_STACK";case"READY_TO_MERGE_WITHOUT_CI":case"READY_TO_MERGE_AS_STACK_WITHOUT_CI":return"READY_TO_MERGE_AS_STACK_WITHOUT_CI";default:(0,s.assertUnreachable)(e)}}({parentMetastatus:null==E?void 0:E.status,hasThirdPartyMergeQueueLabel:n.hasThirdPartyMergeQueueLabel,hasActiveEntryInGithubMergeQueue:n.hasActiveEntryInGithubMergeQueue,ciRollupStatus:n.ciRollup.status});if("HARD_WAITING_ON_DOWNSTACK"===_||"WAITING_ON_DOWNSTACK"===_)m.push({reason:_});else if(0===m.length)return{prNumber:n.number,status:_};return Object.assign({prNumber:n.number,status:m.map((({reason:e})=>e)).includes("MERGE_CONFLICTS")||m.map((({reason:e})=>e)).includes("HARD_WAITING_ON_DOWNSTACK")?"HARD_BLOCKED":"BLOCKED",blockingReasons:[m[0],...m.slice(1)]},E?{parentMetastatus:E}:{})},t.getPrMissingCodeowners=function({previousReviewers:e,authorLogin:t,files:n}){const r=c({previousReviewers:e,authorLogin:t,files:n}).map((e=>e.codeowners?e.codeowners.owners:[])).flat();return[...new Map(r.map((e=>[l(e),e]))).values()]},t.mapCodeownerToKey=l,t.doesPrHaveMissingCodeownerReviews=d,t.doesPrHaveOpenChangesRequested=function({previousReviewers:e,requestedReviewers:t}){return e.filter((e=>"CHANGES_REQUESTED"===e.decision)).map((e=>e.username)).some((e=>!t.includes(e)))},t.doesPrHaveClosedReviewRequests=function({previousReviewers:e,requestedReviewers:t}){return e.filter((e=>["CHANGES_REQUESTED","COMMENTED"].includes(e.decision))).map((e=>e.username)).some((e=>!t.includes(e)))},t.doesPrHaveOpenReviewRequests=function({requestedReviewers:e}){return e.length>0},t.getHumanReadablePrMetastatus={CALCULATING:"Calculating...",MERGED:"Merged",QUEUED_TO_MERGE:"Queued to merge...",WAITING_TO_MERGE:"Waiting to merge...",HANDED_OFF_TO_EXTERNAL_MERGE_QUEUE:"Handed off to merge queue...",CLOSED:"Closed",DRAFT:"Draft",CHANGES_REQUESTED:"Changes requested",NEEDS_APPROVALS:"Needs more approvals",GT_NEEDS_APPROVALS:"Needs more approvals",NEEDS_CODEOWNER_APPROVALS:"Needs approvals from code owners",GT_NEEDS_REQUIRED_APPROVER:"Needs approvals from required file approvers",MERGE_CONFLICTS:"Merge conflicts",BRANCH_LOCKED:"Trunk branch locked",RUNNING:"Waiting on CI...",FAILING_REQUIRED:"Required CI failed",READY_TO_MERGE:"Ready to merge",MERGED_AND_DELETED:"Merged and deleted",READY_TO_MERGE_AS_STACK:"Ready to merge as stack",READY_TO_MERGE_WITHOUT_CI:"Ready to merge",READY_TO_MERGE_AS_STACK_WITHOUT_CI:"Ready to merge as stack",WAITING_ON_DOWNSTACK:"Waiting on downstack",HARD_WAITING_ON_DOWNSTACK:"Waiting on downstack",UNRESOLVED_COMMENTS:"Unresolved comments",NEEDS_RESTACK__BASE_BRANCH_MERGED:"Needs restack",NEEDS_RESTACK__DOWNSTACK_MERGING:"Needs restack",NEEDS_RESTACK__BASE_REF_CHANGED:"Needs restack",FAILURE_HANDLING:"Undergoing failure detection"}},19495:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MergeStateStatuses=t.PrMetastatuses=void 0,t.PrMetastatuses=["CALCULATING","MERGED","MERGED_AND_DELETED","CLOSED","DRAFT","QUEUED_TO_MERGE","WAITING_TO_MERGE","HANDED_OFF_TO_EXTERNAL_MERGE_QUEUE","READY_TO_MERGE","READY_TO_MERGE_AS_STACK","READY_TO_MERGE_WITHOUT_CI","READY_TO_MERGE_AS_STACK_WITHOUT_CI","CHANGES_REQUESTED","NEEDS_APPROVALS","GT_NEEDS_APPROVALS","NEEDS_CODEOWNER_APPROVALS","RUNNING","FAILING_REQUIRED","WAITING_ON_DOWNSTACK","HARD_WAITING_ON_DOWNSTACK","UNRESOLVED_COMMENTS","MERGE_CONFLICTS","BRANCH_LOCKED","NEEDS_RESTACK__BASE_BRANCH_MERGED","NEEDS_RESTACK__DOWNSTACK_MERGING","NEEDS_RESTACK__BASE_REF_CHANGED","GT_NEEDS_APPROVALS","GT_NEEDS_REQUIRED_APPROVER","FAILURE_HANDLING"],t.MergeStateStatuses=["GREEN__CLEAN__MERGEABLE_AND_PASSING_COMMIT_STATUS","GREEN__HAS_HOOKS__MERGEABLE_WITH_PASSING_COMMIT_STATUS_AND_PRERECEIVE_HOOKS_ENTERPRISE_ONLY","YELLOW__UNSTABLE__FAILING_OR_PENDING_NON_REQUIRED_STATUS_OK_TO_MERGE","RED__BEHIND__HEAD_REF_OUT_OF_DATE","RED__BLOCKED__FAILING_OR_MISSING_REQUIRED_STATUS_CHECK","RED__DIRTY__MERGE_CONFLICT","RED__DRAFT__MERGE_BLOCKED_DUE_TO_PULL_REQUEST_BEING_A_DRAFT","RED__UNKNOWN__MERGABILITY_NOT_YET_DETERMINED"]},8986:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GRAPHITE_CHECK_NAME=void 0,t.GRAPHITE_CHECK_NAME="Graphite / mergeability_check"},27716:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createTestMergeRestriction=t.prHasRequiredApproversForFile=t.filterRequiredStatusChecksPayload=t.filterRequiredApproversWithTeamMembersPayload=t.filterNumRequiredApproversPayload=t.computeMergeRulesBlockingReasons=t.GRAPHITE_CHECK_NAME=t.PrMetastatuses=t.MergeStateStatuses=t.GRAPHITE_BASE_BRANCH_PREFIX=t.getPrMissingCodeowners=t.getPrMetastatus=t.getHumanReadablePrMetastatus=t.doesPrHaveOpenReviewRequests=t.doesPrHaveOpenChangesRequested=t.doesPrHaveMissingCodeownerReviews=t.doesPrHaveClosedReviewRequests=t.doesPrHaveMinimumRequiredApprovals=t.isApprover=void 0;var r=n(66703);Object.defineProperty(t,"isApprover",{enumerable:!0,get:function(){return r.isApprover}});var i=n(27962);Object.defineProperty(t,"doesPrHaveMinimumRequiredApprovals",{enumerable:!0,get:function(){return i.doesPrHaveMinimumRequiredApprovals}});var o=n(63261);Object.defineProperty(t,"doesPrHaveClosedReviewRequests",{enumerable:!0,get:function(){return o.doesPrHaveClosedReviewRequests}}),Object.defineProperty(t,"doesPrHaveMissingCodeownerReviews",{enumerable:!0,get:function(){return o.doesPrHaveMissingCodeownerReviews}}),Object.defineProperty(t,"doesPrHaveOpenChangesRequested",{enumerable:!0,get:function(){return o.doesPrHaveOpenChangesRequested}}),Object.defineProperty(t,"doesPrHaveOpenReviewRequests",{enumerable:!0,get:function(){return o.doesPrHaveOpenReviewRequests}}),Object.defineProperty(t,"getHumanReadablePrMetastatus",{enumerable:!0,get:function(){return o.getHumanReadablePrMetastatus}}),Object.defineProperty(t,"getPrMetastatus",{enumerable:!0,get:function(){return o.getPrMetastatus}}),Object.defineProperty(t,"getPrMissingCodeowners",{enumerable:!0,get:function(){return o.getPrMissingCodeowners}}),Object.defineProperty(t,"GRAPHITE_BASE_BRANCH_PREFIX",{enumerable:!0,get:function(){return o.GRAPHITE_BASE_BRANCH_PREFIX}});var s=n(19495);Object.defineProperty(t,"MergeStateStatuses",{enumerable:!0,get:function(){return s.MergeStateStatuses}}),Object.defineProperty(t,"PrMetastatuses",{enumerable:!0,get:function(){return s.PrMetastatuses}});var a=n(8986);Object.defineProperty(t,"GRAPHITE_CHECK_NAME",{enumerable:!0,get:function(){return a.GRAPHITE_CHECK_NAME}});var u=n(57569);Object.defineProperty(t,"computeMergeRulesBlockingReasons",{enumerable:!0,get:function(){return u.computeMergeRulesBlockingReasons}});var c=n(43712);Object.defineProperty(t,"filterNumRequiredApproversPayload",{enumerable:!0,get:function(){return c.filterNumRequiredApproversPayload}}),Object.defineProperty(t,"filterRequiredApproversWithTeamMembersPayload",{enumerable:!0,get:function(){return c.filterRequiredApproversWithTeamMembersPayload}}),Object.defineProperty(t,"filterRequiredStatusChecksPayload",{enumerable:!0,get:function(){return c.filterRequiredStatusChecksPayload}});var l=n(73306);Object.defineProperty(t,"prHasRequiredApproversForFile",{enumerable:!0,get:function(){return l.prHasRequiredApproversForFile}});var d=n(23413);Object.defineProperty(t,"createTestMergeRestriction",{enumerable:!0,get:function(){return d.createTestMergeRestriction}})},57569:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.computeNeedsRequiredApproverBlockingReason=t.computePendingRequiredBlockingReason=t.computeFailingRequiredBlockingReason=t.computeNeedsApprovalBlockingReason=t.computeMergeRulesBlockingReasons=void 0;const r=n(34490),i=n(66703),o=n(73306);function s(e){const{previousReviewers:t,mergeRestrictions:n}=e,r=t.filter(i.isApprover),o=n.filter((e=>"NUM_REQUIRED_APPROVERS"===e.payload.kind)).filter((e=>e.payload.numRequiredApprovers>r.length));return o.length>0?{reason:"GT_NEEDS_APPROVALS",blockingMergeRestrictions:o,numberOfApprovalsNeeded:Math.max(...o.map((e=>e.payload.numRequiredApprovers)))-r.length}:null}function a(e){var t;const n=(null!==(t=e.ciRollup.ciMergeRestrictionsStatus)&&void 0!==t?t:[]).filter((e=>"FAILED"===e.status.status));return n.length>0?{reason:"GT_FAILING_REQUIRED",blockingMergeRestrictions:n.map((({restriction:e})=>e)),failingRequiredChecks:n.flatMap((({status:{failedChecks:e}})=>e))}:null}function u(e){var t;const n=(null!==(t=e.ciRollup.ciMergeRestrictionsStatus)&&void 0!==t?t:[]).filter((e=>"PENDING"===e.status.status));return n.length>0?{reason:"GT_PENDING_REQUIRED",blockingMergeRestrictions:n.map((({restriction:e})=>e)),pendingRequiredChecks:n.flatMap((({status:{pendingChecks:e}})=>e))}:null}function c(e){const{files:t}=e,n=t.filter((t=>!(0,o.prHasRequiredApproversForFile)({file:t,pr:e})));return n.length>0?{reason:"GT_NEEDS_REQUIRED_APPROVER",blockingMergeRestrictionsByFilePath:n.reduce(((e,{filename:t,requiredApproversMergeRestrictions:n})=>(e[t]=n,e)),{})}:null}t.computeMergeRulesBlockingReasons=function(e){return[s(e),a(e),u(e),c(e)].filter(r.filterNull)},t.computeNeedsApprovalBlockingReason=s,t.computeFailingRequiredBlockingReason=a,t.computePendingRequiredBlockingReason=u,t.computeNeedsRequiredApproverBlockingReason=c},43712:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.filterRequiredApproversWithTeamMembersPayload=t.filterRequiredStatusChecksPayload=t.filterNumRequiredApproversPayload=void 0,t.filterNumRequiredApproversPayload=function(e){return"NUM_REQUIRED_APPROVERS"===e.kind},t.filterRequiredStatusChecksPayload=function(e){return"REQUIRED_STATUS_CHECKS"===e.kind},t.filterRequiredApproversWithTeamMembersPayload=function(e){return"REQUIRED_APPROVERS"===e.kind}},73306:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.prHasRequiredApproversForFile=t.prAuthorIsRequiredApproverForFile=t.isUserRequiredApprover=t.isApprovedByRequiredApprover=void 0;const r=n(34490),i=n(66703);function o({requiredApprover:e,approvers:t}){const n=t.map((({username:e})=>e));switch(e.kind){case"USER":return n.includes(e.login);case"TEAM":return e.memberLogins.some((e=>n.includes(e)));default:(0,r.assertUnreachable)(e)}}function s({userLogin:e,payload:t}){return t.requiredApprovers.flatMap((e=>"TEAM"===e.kind?e.memberLogins:[e.login])).includes(e)}function a({authorLogin:e,file:t}){return e&&t.requiredApproversMergeRestrictions.some((({payload:t})=>s({userLogin:e,payload:t})))}t.isApprovedByRequiredApprover=o,t.isUserRequiredApprover=s,t.prAuthorIsRequiredApproverForFile=a,t.prHasRequiredApproversForFile=function({file:e,pr:t}){const{requiredApproversMergeRestrictions:n}=e,{authorLogin:r,previousReviewers:s}=t,u=s.filter(i.isApprover);return 0===n.length||a({authorLogin:r,file:e})||n.some((({payload:{requiredApprovers:e}})=>0===e.length||e.some((e=>o({requiredApprover:e,approvers:u})))))}},23413:(e,t)=>{function n({status:e="PASSING",ciMergeRestrictionsStatus:t=[]}){return{status:e,ciMergeRestrictionsStatus:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.createTestPr=t.createTestCiRollup=t.createTestMergeRestriction=t.createTestFile=t.createTestReviewer=void 0,t.createTestReviewer=function({username:e="username",decision:t="APPROVED",hasWritePermission:n=null}){return{username:e,decision:t,hasWritePermission:n}},t.createTestFile=function({filename:e="filename",codeowners:t=null,requiredApproversMergeRestrictions:n=[]}){return{filename:e,codeowners:t,requiredApproversMergeRestrictions:n}},t.createTestMergeRestriction=function({id:e="1",mergeRuleId:t="1",payload:n={kind:"NUM_REQUIRED_APPROVERS",numRequiredApprovers:1}}){return{id:e,mergeRuleId:t,payload:n}},t.createTestCiRollup=n,t.createTestPr=function({number:e=1,state:t="OPEN",isDraft:r=!1,authorLogin:i="authorLogin",previousReviewers:o=[],hasMergeConflicts:s=!1,isQueuedToMerge:a=!1,isInFailureHandling:u=!1,isWaitingToMerge:c=!1,ciRollup:l=n({}),skipRequiredCi:d=!1,branch:h="branch",parentBranch:f=null,unresolvedThreadCount:m=0,files:p=[],mergeRestrictionsDeprecated:g={},mergeRestrictions:v=[],lastPushedAt:y=new Date,lastBaseRefChangedAt:b=new Date}){return{number:e,state:t,isDraft:r,authorLogin:i,previousReviewers:o,hasMergeConflicts:s,isQueuedToMerge:a,isInFailureHandling:u,isWaitingToMerge:c,hasThirdPartyMergeQueueLabel:!1,hasActiveEntryInGithubMergeQueue:!1,ciRollup:l,skipRequiredCi:d,branch:h,parentBranch:f,unresolvedThreadCount:m,files:p,mergeRestrictionsDeprecated:g,mergeRestrictions:v,lastPushedAt:y,lastBaseRefChangedAt:b}}},8296:(e,t)=>{function n(e){return t=>JSON.stringify(e)===JSON.stringify(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.nullable=t.optional=t.literals=t.intersectMany=t.unionMany=t.intersection=t.union=t.tuple=t.array=t.taggedUnion=t._shapeWithExplicitOptionals=t.shape=t.nulltype=t.boolean=t.string=t.number=t.literal=t.undefinedtype=void 0,t.undefinedtype=e=>void 0===e,t.literal=function(e){return n(e)},t.number=e=>"number"==typeof e,t.string=e=>"string"==typeof e,t.boolean=e=>"boolean"==typeof e,t.nulltype=e=>null===e,t.shape=function(e){return(t,n)=>r(e,t,n)},t._shapeWithExplicitOptionals=function(e){return(t,n)=>r(e,t,n)};const r=(e,t,n)=>"object"==typeof t&&null!==t&&Object.keys(e).every((r=>{const i=e[r]&&e[r](t[r],n);return!i&&(null==n?void 0:n.logFailures)&&console.log(`Member of shape ${JSON.stringify(t[r])} for ${r} does not match expected type`),i}));function i(e,t){return(n,r)=>{const i=e(n,r)||t(n,r);return!i&&(null==r?void 0:r.logFailures)&&console.log(`Member of union "${JSON.stringify(n)}" does not match expected type`),i}}function o(e){return(t,n)=>{const r=e.some((e=>e(t,n)));return!r&&(null==n?void 0:n.logFailures)&&console.log(`Member of union-many ${JSON.stringify(t)} does not expected type`),r}}t.taggedUnion=function(e,t){return(n,r)=>{if("object"!=typeof n||null===n||!(e in n))return(null==r?void 0:r.logFailures)&&console.log("Tagged union is not an object or missing tag"),!1;const i=t[n[e]];return!!i&&Object.keys(i).every((e=>{const t=i[e]&&i[e](n[e],r);return!t&&(null==r?void 0:r.logFailures)&&console.log(`Member of shape ${JSON.stringify(n[e])} for ${e} does not match expected type`),t}))}},t.array=function(e){return(t,n)=>Array.isArray(t)&&t.every((t=>{const r=e(t,n);return!r&&(null==n?void 0:n.logFailures)&&console.log(`Member of array "${JSON.stringify(t)}" does not match expected type`),r}))},t.tuple=function(e){return(t,n)=>Array.isArray(t)&&t.length===e.length&&t.every(((t,r)=>{const i=e[r](t,n);return!i&&(null==n?void 0:n.logFailures)&&console.log(`Member of tuple "${JSON.stringify(t)}" does not match expected type`),i}))},t.union=i,t.intersection=function(e,t){return(n,r)=>{const i=e(n,r)&&t(n,r);return!i&&(null==r?void 0:r.logFailures)&&console.log(`Member of intersection "${JSON.stringify(n)}" does not match expected type`),i}},t.unionMany=o,t.intersectMany=function(e){return(t,n)=>{const r=e.every((e=>e(t,n)));return!r&&(null==n?void 0:n.logFailures)&&console.log(`Member of intersection-many ${JSON.stringify(t)} does not expected type`),r}},t.literals=function(e){return o(e.map((e=>n(e))))},t.optional=function(e){return i(e,t.undefinedtype)},t.nullable=function(e){return i(e,t.nulltype)}},53977:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.request=void 0,t.request=o(n(74911))},74911:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.requestWithArgs=t.formatReqDetails=void 0,n(87686);const s=o(n(16627));function a({apiServer:e,route:t,params:n,queryParams:r,urlParams:i,headers:o,opts:a}){let u=e+(i?s.compile(t.url)(i):t.url),c=null;if("GET"==t.method){if(r){const e=function(e,t){const n=[],r=Object.keys(e);t&&r.sort();for(const t of r){const r=e[t];void 0!==r&&n.push(encodeURIComponent(t)+"="+encodeURIComponent(r))}return n.join("&")}(r,null==a?void 0:a.sortQueryParams);""!=e&&(u+="?"+e)}}else c=t.rawBody?n:JSON.stringify(n);return{url:u,verb:t.method,headers:Object.assign(Object.assign({},o),{"Content-Type":"text/plain"}),body:c}}t.formatReqDetails=a,t.requestWithArgs=function({apiServer:e,route:t,params:n,queryParams:r,urlParams:i,headers:o}){return function({url:e,verb:t,headers:n,body:r}){return fetch(e,Object.assign({method:t,mode:"cors",credentials:"include",headers:n},r?{body:r}:{}))}(a({apiServer:e,route:t,params:n,queryParams:r,urlParams:i,headers:o})).then((e=>t.response&&200===e.status?e.json().then((t=>Object.assign(Object.assign({},t),{_response:e}))):{_response:e}))}},93034:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bindWithEmptyObject=t.bind=void 0,t.bind=function(e,t){return n=>e(Object.assign(Object.assign({},t),n))},t.bindWithEmptyObject=function(e){return()=>e({})}},42392:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dedup=void 0,t.dedup=function(e,t){const n=new Set,r=[];return e.forEach((e=>{const i=t(e);n.has(i)||(r.push(e),n.add(i))})),r}},64761:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setDifference=void 0,t.setDifference=function({a:e,b:t,itemIdentity:n}){const r=new Set;return t.forEach((e=>r.add(n(e)))),e.filter((e=>!r.has(n(e))))}},7846:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyObject=void 0,t.isEmptyObject=function(e){return 0===Object.keys(e).length}},73594:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.findIndexOrFail=void 0,t.findIndexOrFail=({array:e,value:t,errorFn:n})=>{const r=e.indexOf(t);if(-1===r)throw n();return r}},10199:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertGlobToRegex=void 0;const n="@@ENTIRE_STRING_IS_GLOBSTAR@@",r="@@GLOBSTAR_AT_END@@",i="@@GLOBSTAR_FOLLOWED_BY_FORWARD_SLASH@@",o="@@STAR@@",s="@@DOT@@";t.convertGlobToRegex=function(e){return[e=>"**"===e?n:e,e=>e.replace(/\*\*$/,r),e=>e.replaceAll("**/",i),e=>e.replaceAll("*",o),e=>e.replaceAll(".",s),e=>e.replaceAll(n,".*"),e=>e.replaceAll(r,".*"),e=>e.replaceAll(i,"([^/]*/)*"),e=>e.replaceAll(o,"[^/]*"),e=>e.replaceAll(s,"\\."),e=>`^${e}`,e=>`${e}$`].reduce(((e,t)=>t(e)),e)}},10458:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.runWithHeartbeat=void 0;const i=n(24938);t.runWithHeartbeat=function(e){return r(this,arguments,void 0,(function*({fn:e,heartbeat:t,heartbeatInterval:n,waitForHeartbeatOnExit:o}){let s=!1,a=!1,u=0;if(yield Promise.race([e(),(()=>r(this,void 0,void 0,(function*(){for(;!s;)yield t(),u++,yield(0,i.sleep)(n);a=!0})))()]),s=!0,o)for(;!a;)yield(0,i.sleep)({milliseconds:5});return{heartbeatCnt:u}}))}},34490:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.timeoutPromise=t.TimeoutError=t.plural=t.numberWithCommas=t.nth=t.humanizeDuration=t.humanizeDate=t.convertStringToNumberOrNull=t.commaSeparatedList=t.waitFor=t.sleep=t.semaphore=t.retryWithSleep=t.mapReduce=t.createLookupTable=t.runWithHeartbeat=t.convertGlobToRegex=t.findIndexOrFail=t.isEmptyObject=t.setDifference=t.dedup=t.bindWithEmptyObject=t.bind=void 0,i(n(23760),t);var o=n(93034);Object.defineProperty(t,"bind",{enumerable:!0,get:function(){return o.bind}}),Object.defineProperty(t,"bindWithEmptyObject",{enumerable:!0,get:function(){return o.bindWithEmptyObject}});var s=n(42392);Object.defineProperty(t,"dedup",{enumerable:!0,get:function(){return s.dedup}});var a=n(64761);Object.defineProperty(t,"setDifference",{enumerable:!0,get:function(){return a.setDifference}});var u=n(7846);Object.defineProperty(t,"isEmptyObject",{enumerable:!0,get:function(){return u.isEmptyObject}});var c=n(73594);Object.defineProperty(t,"findIndexOrFail",{enumerable:!0,get:function(){return c.findIndexOrFail}});var l=n(10199);Object.defineProperty(t,"convertGlobToRegex",{enumerable:!0,get:function(){return l.convertGlobToRegex}});var d=n(10458);Object.defineProperty(t,"runWithHeartbeat",{enumerable:!0,get:function(){return d.runWithHeartbeat}});var h=n(3475);Object.defineProperty(t,"createLookupTable",{enumerable:!0,get:function(){return h.createLookupTable}});var f=n(18655);Object.defineProperty(t,"mapReduce",{enumerable:!0,get:function(){return f.mapReduce}});var m=n(66066);Object.defineProperty(t,"retryWithSleep",{enumerable:!0,get:function(){return m.retryWithSleep}});var p=n(66496);Object.defineProperty(t,"semaphore",{enumerable:!0,get:function(){return p.semaphore}});var g=n(24938);Object.defineProperty(t,"sleep",{enumerable:!0,get:function(){return g.sleep}}),Object.defineProperty(t,"waitFor",{enumerable:!0,get:function(){return g.waitFor}});var v=n(50401);Object.defineProperty(t,"commaSeparatedList",{enumerable:!0,get:function(){return v.commaSeparatedList}}),Object.defineProperty(t,"convertStringToNumberOrNull",{enumerable:!0,get:function(){return v.convertStringToNumberOrNull}}),Object.defineProperty(t,"humanizeDate",{enumerable:!0,get:function(){return v.humanizeDate}}),Object.defineProperty(t,"humanizeDuration",{enumerable:!0,get:function(){return v.humanizeDuration}}),Object.defineProperty(t,"nth",{enumerable:!0,get:function(){return v.nth}}),Object.defineProperty(t,"numberWithCommas",{enumerable:!0,get:function(){return v.numberWithCommas}}),Object.defineProperty(t,"plural",{enumerable:!0,get:function(){return v.plural}});var y=n(69976);Object.defineProperty(t,"TimeoutError",{enumerable:!0,get:function(){return y.TimeoutError}}),Object.defineProperty(t,"timeoutPromise",{enumerable:!0,get:function(){return y.timeoutPromise}})},3475:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createLookupTable=void 0,t.createLookupTable=function({items:e,getKey:t,serializeKey:n}){const r={};return e.forEach((e=>{r[n(t(e))]=e})),e=>r[n(e)]}},18655:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.mapReduce=void 0,t.mapReduce=function(e){return n(this,arguments,void 0,(function*({fn:e,inputs:t,reducer:n,defaultReturn:r}){return(yield Promise.all(t.map(e))).reduce(((e,t)=>n(e,t)),r)}))}},66066:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.retryWithSleep=void 0;const o=i(n(62637)),s=n(24938);t.retryWithSleep=e=>r(void 0,[e],void 0,(function*({fn:e,onRetry:t,options:n}){for(const r of o.default.range(n.maxRetries))try{return yield e()}catch(e){if(r+1>=n.maxRetries)throw e;null==t||t({retryCount:r,err:e}),yield(0,s.sleep)(n.sleepDuration)}throw new Error("Unreachable")}))},66496:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.semaphore=void 0,t.semaphore=function(e,t){let n;const r=new Promise((e=>{n=e})),i=[...t];let o=0;return function t(){const r=i.shift();void 0!==r?(o++,r().catch(console.error).finally((()=>{o--,t()})),o<e&&t()):0===o&&n(void 0)}(),r}},24938:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};function r(e){return n(this,void 0,void 0,(function*(){const t=i(e);yield new Promise((e=>{setTimeout(e,t)}))}))}Object.defineProperty(t,"__esModule",{value:!0}),t.waitFor=t.sleep=void 0,t.sleep=r,t.waitFor=e=>n(void 0,[e],void 0,(function*({condition:e,sleepDuration:t,timeout:n,label:o}){const s=i(t),a=i(null!=n?n:{minutes:1});for(const t=Date.now();Date.now()-t<a;){if(yield e())return;yield r({milliseconds:s})}throw new Error(`Timeout waiting for ${null!=o?o:"condition"}`)}));const i=e=>"minutes"in e?60*e.minutes*1e3:"seconds"in e?1e3*e.seconds:e.milliseconds},50401:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.nth=t.numberWithCommas=t.commaSeparatedList=t.humanizeDuration=t.convertStringToNumberOrNull=t.humanizeDate=t.plural=void 0;const r=n(19577);t.plural=(e,t,n)=>{const r=(null==n?void 0:n.pluralSuffix)||"s";return`${(null==n?void 0:n.prependAIfSingular)&&1===t?"a ":""}${e}${1!==t?r:""}`},t.humanizeDate=(e,t)=>e.toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:null==t?void 0:t.timeZone,timeZoneName:null==t?void 0:t.includeTimeZone}),t.convertStringToNumberOrNull=e=>{if(""===e)return null;const t=+e;return isNaN(t)?null:t},t.humanizeDuration=(e,t)=>{const n=r.Duration.fromObject({seconds:e}).rescale(),i=[];return n.years>0&&i.push(`${n.years}y`),n.months>0&&i.push(`${n.months}mo`),n.days>0&&i.push(`${n.days}d`),n.hours>0&&i.push(`${n.hours}h`),n.minutes>0&&i.push(`${n.minutes}m`),t&&0===i.length&&i.push(`${n.seconds}s`),i.join(" ")},t.commaSeparatedList=e=>{var t;return 0===e.length?"":1===e.length?null!==(t=e[0])&&void 0!==t?t:"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`},t.numberWithCommas=function(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},t.nth=e=>0==e?"zeroth":e%10==1&&e%100!=11?1==e?"first":`${e}st`:e%10==2&&e%100!=12?2==e?"second":`${e}nd`:e%10==3&&e%100!=13?3==e?"third":`${e}rd`:`${e}th`},69976:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timeoutPromise=t.TimeoutError=void 0;class n extends Error{}t.TimeoutError=n,t.timeoutPromise=({promise:e,timeoutMs:t})=>Promise.race([e,new Promise((e=>setTimeout(e,t))).then((()=>{throw new n(`Timeout after ${t}ms`)}))])},23760:(e,t)=>{function n(e){return null!==e}function r(e){return void 0!==e}Object.defineProperty(t,"__esModule",{value:!0}),t.flatNonEmptyArrayOfNonEmptyArrays=t.flatMapNonEmptyArray=t.mapNonEmptyArray=t.isNonEmptyArray=t.filterNullUndefined=t.filterUndefined=t.filterNull=t.setEquals=t.isPropertyValue=t.assertUnreachable=void 0,t.assertUnreachable=function(e){throw new Error(`Didn't expect to get here, arg: ${JSON.stringify(e)}`)},t.isPropertyValue=function(e,t){return Object.values(e).includes(t)},t.setEquals=function(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0},t.filterNull=n,t.filterUndefined=r,t.filterNullUndefined=function(e){return n(e)&&r(e)},t.isNonEmptyArray=function(e){return void 0!==e[0]},t.mapNonEmptyArray=function(e,t){return e.map(t)},t.flatMapNonEmptyArray=function(e,t){return e.flatMap(t)},t.flatNonEmptyArrayOfNonEmptyArrays=function(e){return e.flat()}},6016:(e,t,n)=>{n.r(t),n.d(t,{startServer:()=>ce});var r=n(98696),i=n(57147),o=n.n(i),s=n(13685),a=n.n(s),u=n(71017),c=n.n(u),l=n(57310),d=n.n(l),h=n(95352),f=n.n(h),m=n(79115),p=n(95808),g=n(43597),v=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};const y=m.sendAnalyticsEvent;var b=n(22037),E=n.n(b);function _(){try{return E().userInfo().username}catch(e){try{const{env:e}=process;return(0,r.unwrap)(e.LOGNAME||e.USER||e.LNAME||e.USERNAME)}catch(t){throw new Error(String(t)+String(e))}}}class w{constructor(e,t){this.logger=e,this.data=t}setRepo(e){var t;this.data.repo=null===(t=null==e?void 0:e.codeReviewProvider)||void 0===t?void 0:t.getSummaryName()}}const C=e=>{};var R=n(73837),O=n.n(R);const S=console;var P=n(34987),A=n.n(P),T=n(59778),M=n.n(T),D=n(82361);class N extends D.EventEmitter{}var I=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};class k{constructor(e,t){this.codeReviewSystem=e,this.runCommand=t,this.diffSummaries=new N}onChangeDiffSummaries(e){const t=t=>e({value:t}),n=t=>e({error:t});return this.diffSummaries.on("data",t),this.diffSummaries.on("error",n),{dispose:()=>{this.diffSummaries.off("data",t),this.diffSummaries.off("error",n)}}}triggerDiffSummariesFetch(e){return I(this,void 0,void 0,(function*(){const e=yield this.runCommand(["internal-only","prs"]),t=JSON.parse(e.stdout);this.diffSummaries.emit("data",t)}))}dispose(){this.diffSummaries.removeAllListeners()}getSummaryName(){return`github:${this.codeReviewSystem.hostname}/${this.codeReviewSystem.owner}/${this.codeReviewSystem.repo}`}runExternalCommand(e,t,n,r){throw new Error("GitHub code review provider does not support running external commands")}typeahead(e,t){return I(this,void 0,void 0,(function*(){return Promise.resolve([])}))}}class j{constructor(e,t){this.logger=e,this.runCallback=t,this.queuedOperations=[],this.runningOperation=void 0,this.abortController=void 0}runOrQueueOperation(e,t,n,r){return i=this,o=void 0,a=function*(){if(null!=this.runningOperation)return this.queuedOperations.push(Object.assign(Object.assign({},e),{tracker:n})),void t({id:e.id,kind:"queue",queue:this.queuedOperations.map((e=>e.id))});this.runningOperation=e;const i=(...n)=>{switch(n[0]){case"spawn":t({id:e.id,kind:"spawn",queue:this.queuedOperations.map((e=>e.id))});break;case"stdout":t({id:e.id,kind:"stdout",message:n[1]});break;case"stderr":t({id:e.id,kind:"stderr",message:n[1]});break;case"exit":t({id:e.id,kind:"exit",exitCode:n[1],timestamp:Date.now()})}};try{const o=new AbortController;if(this.abortController=o,yield n.operation(e.trackEventName,"RunOperationError",{extras:{args:e.args,runner:e.runner}},(t=>this.runCallback(e,r,i,o.signal))),this.runningOperation=void 0,this.queuedOperations.length>0){const e=this.queuedOperations.shift();null!=e&&this.runOrQueueOperation(e,t,e.tracker,r)}}catch(n){const r=n.toString();this.logger.log("error running operation: ",e.args[0],r),t({id:e.id,kind:"error",error:r}),this.queuedOperations=[],this.runningOperation=void 0}},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{u(a.next(e))}catch(e){t(e)}}function r(e){try{u(a.throw(e))}catch(e){t(e)}}function u(t){var i;t.done?e(t.value):(i=t.value,i instanceof s?i:new s((function(e){e(i)}))).then(n,r)}u((a=a.apply(i,o||[])).next())}));var i,o,s,a}abortRunningOperation(e){var t,n;(null===(t=this.runningOperation)||void 0===t?void 0:t.id)==e&&(null===(n=this.abortController)||void 0===n||n.abort())}}class x{constructor(){this.focusedPages=new Set,this.visiblePages=new Set,this.onChangeHandlers=new Set}setState(e,t){switch(t){case"focused":this.focusedPages.add(e),this.visiblePages.add(e);break;case"visible":this.focusedPages.delete(e),this.visiblePages.add(e);break;case"hidden":this.focusedPages.delete(e),this.visiblePages.delete(e)}for(const e of this.onChangeHandlers)e(t)}disposePage(e){this.focusedPages.delete(e),this.visiblePages.delete(e)}hasPageWithFocus(){return this.focusedPages.size>0}hasVisiblePage(){return this.visiblePages.size>0}onChange(e){return this.onChangeHandlers.add(e),()=>this.onChangeHandlers.delete(e)}}class F{constructor(e,t){this.maxSimultaneousRunning=e,this.log=t,this.queued=[],this.running=[],this.runs=new N,this.nextId=1}generateId(){return this.nextId++}enqueueRun(e){var t,n,r,i,o;return n=this,r=void 0,o=function*(){const n=this.generateId();this.queued.push(n),this.tryDequeueNext(),this.running.includes(n)||(null===(t=this.log)||void 0===t||t.call(this,`${this.running.length} tasks are already running, enqueuing ID:${n}`),yield new Promise((e=>{this.runs.on("run",(t=>{var r;t===n&&(null===(r=this.log)||void 0===r||r.call(this,`now allowing ID:${n} to run`),e(void 0))}))})));try{return yield e()}finally{this.notifyFinished(n)}},new((i=void 0)||(i=Promise))((function(e,t){function s(e){try{u(o.next(e))}catch(e){t(e)}}function a(e){try{u(o.throw(e))}catch(e){t(e)}}function u(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(s,a)}u((o=o.apply(n,r||[])).next())}))}notifyFinished(e){this.running=this.running.filter((t=>t!==e)),this.tryDequeueNext()}tryDequeueNext(){if(this.running.length<this.maxSimultaneousRunning){const e=this.queued.shift();null!=e&&this.run(e)}}run(e){this.running.push(e),this.runs.emit("run",e)}}function G(e){let t,n;const r=()=>{const t=e();return n=t.then((()=>n=void 0),(()=>n=void 0)),t},i=()=>(t=void 0,r());return()=>null==n?r():(()=>{if(null==t){if(null==n)throw new Error("pendingCall must not be null!");t=n.then(i,i)}return t})()}function H(e){switch(e.type){case r.ComparisonType.UncommittedChanges:return["uncommitted"];case r.ComparisonType.HeadChanges:return["head"];case r.ComparisonType.StackChanges:return["stack"];case r.ComparisonType.Committed:return["stack","--ref",e.hash];default:throw new Error("Unsupported comparison type: "+e.type)}}var B=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};const L="1.0.14";class U{onDidDispose(e){this.disposables.push(e)}constructor(e,t,n){this.info=e,this.platform=t,this.logger=n,this.IGNORE_COMMIT_MESSAGE_LINES_REGEX=/^((?:HG|SL):.*)/gm,this.mergeConflicts=void 0,this.uncommittedChanges=null,this.smartlogCommits=null,this.mergeConflictsEmitter=new N,this.uncommittedChangesEmitter=new N,this.smartlogCommitsChangesEmitter=new N,this.smartlogCommitsBeginFetchingEmitter=new N,this.uncommittedChangesBeginFetchingEmitter=new N,this.disposables=[()=>this.mergeConflictsEmitter.removeAllListeners(),()=>this.uncommittedChangesEmitter.removeAllListeners(),()=>this.smartlogCommitsChangesEmitter.removeAllListeners(),()=>this.smartlogCommitsBeginFetchingEmitter.removeAllListeners(),()=>this.uncommittedChangesBeginFetchingEmitter.removeAllListeners()],this.pageFocusTracker=new x,this.currentVisibleCommitRangeIndex=0,this.visibleCommitRanges=[r.DEFAULT_DAYS_OF_COMMITS_TO_LOAD,60,void 0],this.checkForMergeConflicts=(0,r.debounce)(G((()=>B(this,void 0,void 0,(function*(){var e,t;this.logger.info("checking for merge conflicts");const n=null!=this.mergeConflicts;if(!n&&!(yield(r=c().join(this.info.dotdir,"rebase-merge"),o().promises.stat(r).then((()=>!0)).catch((e=>{if("ENOENT"===e.code)return!1;throw e})))))return void this.logger.info(`conflict state still the same (${n?"IN merge conflict":"NOT in conflict"})`);var r;null==this.mergeConflicts&&(this.mergeConflicts={state:"loading"},this.mergeConflictsEmitter.emit("change",this.mergeConflicts));const i=Date.now();let s;try{const e=yield this.runCommand(["internal-only","status"]);s=JSON.parse(e.stdout)}catch(e){return this.logger.error(`failed to check for merge conflicts: ${e}`),this.mergeConflicts=void 0,void this.mergeConflictsEmitter.emit("change",this.mergeConflicts)}const a=yield o().promises.readFile(c().join(this.info.dotdir,"rebase-merge","head-name")).then((e=>{const t=e.toString();return t.startsWith("refs/heads/")?t.slice(11).trimEnd():void 0}),(()=>{}));if(this.mergeConflicts=function(e,t,n,r){const i=n;if(!(null==i?void 0:i.conflicts)||!t)return;const o=i.files.filter((e=>"UNRESOLVED"===e.status)),s={state:"loaded",branchName:t,files:[],fetchStartTimestamp:r,fetchCompletedTimestamp:Date.now()};if(null!=(null==e?void 0:e.files)&&e.files.length>0){const t=new Set(o.map((e=>e.path)));s.files=e.files.map((e=>t.has(e.path)?{path:e.path,status:"UNRESOLVED"}:{path:e.path,status:"RESOLVED"}))}else s.files=o.map((e=>({path:e.path,status:"UNRESOLVED"})));return s}(this.mergeConflicts,a,s,i),this.logger.info(`repo ${this.mergeConflicts?"IS":"IS NOT"} in merge conflicts`,{mergeConflicts:this.mergeConflicts,files:null===(e=this.mergeConflicts)||void 0===e?void 0:e.files}),this.mergeConflicts){const e=20,n=(null!==(t=this.mergeConflicts.files)&&void 0!==t?t:[]).filter((e=>"UNRESOLVED"===e.status)).map((e=>e.path)).slice(0,e);this.logger.info("remaining files with conflicts: ",{branchName:a,remainingConflicts:n})}this.mergeConflictsEmitter.emit("change",this.mergeConflicts)})))),100),this.fetchUncommittedChanges=(0,r.debounce)(G((()=>B(this,void 0,void 0,(function*(){const e=Date.now();try{this.uncommittedChangesBeginFetchingEmitter.emit("start");const t=yield this.runCommand(["internal-only","status"]),n=JSON.parse(t.stdout).files.map((e=>{return Object.assign(Object.assign({},e),{path:(t=e.path,t.startsWith(c().sep)?t.slice(1):t)});var t}));this.uncommittedChanges={fetchStartTimestamp:e,fetchCompletedTimestamp:Date.now(),files:{value:n}},this.uncommittedChangesEmitter.emit("change",this.uncommittedChanges)}catch(n){if(this.logger.error("Error fetching files: ",n),null!=(t=n)&&"object"==typeof t&&"stderr"in t&&n.stderr.includes("checkout is currently in progress"))return void this.logger.info("Ignoring `hg status` error caused by in-progress checkout");this.uncommittedChangesEmitter.emit("change",{fetchStartTimestamp:e,fetchCompletedTimestamp:Date.now(),files:{error:n instanceof Error?n:new Error(n)}})}var t})))),100),this.fetchSmartlogCommits=(0,r.debounce)(G((()=>B(this,void 0,void 0,(function*(){const e=Date.now();try{this.smartlogCommitsBeginFetchingEmitter.emit("start");const t=yield this.runCommand(["internal-only","log"]),n=function(e,t){let n=[];try{n=JSON.parse(t)}catch(t){e.error("failed to parse branch info",t)}return n}(this.logger,t.stdout.trim());if(0===n.length)throw new Error(r.ErrorShortMessages.NoCommitsFetched);this.smartlogCommits={fetchStartTimestamp:e,fetchCompletedTimestamp:Date.now(),commits:{value:n}},this.smartlogCommitsChangesEmitter.emit("change",this.smartlogCommits)}catch(t){this.logger.error("Error fetching commits: ",t),this.smartlogCommitsChangesEmitter.emit("change",{fetchStartTimestamp:e,fetchCompletedTimestamp:Date.now(),commits:{error:t instanceof Error?t:new Error(t)}})}})))),100),this.catLimiter=new F(4,(e=>this.logger.info("[cat]",e)));const i=e.codeReviewSystem;"github"===i.type&&(this.codeReviewProvider=new k(i,this.runCommand.bind(this))),this.watchForChangesDisposer=t.watchForChanges(e,n,(e=>{"uncommitted changes"===e?(this.fetchUncommittedChanges(),this.checkForMergeConflicts()):"branches"===e?this.fetchSmartlogCommits():"merge conflicts"===e?this.checkForMergeConflicts():"everything"===e&&(this.fetchUncommittedChanges(),this.fetchSmartlogCommits(),this.checkForMergeConflicts())})),this.operationQueue=new j(this.logger,((e,t,n,i)=>{var o,s,a;if(e.runner===r.CommandRunner.Graphite)return this.runOperation(e,n,t,i);if(e.runner===r.CommandRunner.CodeReviewProvider){const r=this.normalizeOperationArgs(t,e.args);return null==(null===(o=this.codeReviewProvider)||void 0===o?void 0:o.runExternalCommand)?Promise.reject(Error("CodeReviewProvider does not support running external commands")):null!==(a=null===(s=this.codeReviewProvider)||void 0===s?void 0:s.runExternalCommand(t,r,n,i))&&void 0!==a?a:Promise.resolve()}return Promise.resolve()}));const s=new Set,a=this.subscribeToSmartlogCommitsChanges((e=>{var t;if(e.commits.value){const n=[],r=e.commits.value.filter((e=>e.pr)).map((e=>{var t;return null===(t=e.pr)||void 0===t?void 0:t.number}));for(const e of r)s.has(e)||(n.push(e),s.add(e));n.length>0&&(null===(t=this.codeReviewProvider)||void 0===t||t.triggerDiffSummariesFetch(this.getAllDiffIds()))}}));this.checkForMergeConflicts(),this.disposables.push((()=>a.dispose()))}nextVisibleCommitRangeInDays(){return this.currentVisibleCommitRangeIndex+1<this.visibleCommitRanges.length&&this.currentVisibleCommitRangeIndex++,this.visibleCommitRanges[this.currentVisibleCommitRangeIndex]}dispose(){var e,t;this.disposables.forEach((e=>e())),null===(e=this.codeReviewProvider)||void 0===e||e.dispose(),null===(t=this.watchForChangesDisposer)||void 0===t||t.call(this)}onChangeConflictState(e){return this.mergeConflictsEmitter.on("change",e),this.mergeConflicts&&e(this.mergeConflicts),{dispose:()=>this.mergeConflictsEmitter.off("change",e)}}getMergeConflicts(){return this.mergeConflicts}static getRepoInfo(e,t,n){return B(this,void 0,void 0,(function*(){const r=yield function(e,t,n){return B(this,void 0,void 0,(function*(){try{return(yield q({command:e,args:["--version"],logger:t,cwd:n})).stdout}catch(e){throw t.error(`Failed to find gt version in ${n}`,e),e}}))}(e,t,n).catch((e=>e));if(r instanceof Error)return{type:"invalidCommand",command:null!=e?e:"gt"};if("local"!==r&&"dev"!==r&&M().lt(r,L))return{type:"invalidVersion",command:null!=e?e:"gt",versionFound:r,versionRequired:L};const[i,o,s,a]=yield Promise.all([W(e,t,n),$(e,t,n),V(e,t,n,"graphite.branch_edit").then((e=>{var t;return null!==(t=e)&&void 0!==t?t:"amend"})),V(e,t,n,"graphite.create_prs_as").then((e=>{var t;return null!==(t=e)&&void 0!==t?t:"draft"}))]);if(null==o)return{type:"cwdNotARepository",cwd:n};let u;if(void 0===o.remote)u={type:"none"};else{const{owner:e,name:t,hostname:n}=o.remote;u={type:"github",owner:e,repo:t,hostname:n}}const c={type:"success",command:e,dotdir:o.dotDir,repoRoot:o.rootDir,codeReviewSystem:u,preferredBranchEdit:s,createPrsAs:a,profile:i,trunkBranch:o.trunkBranch};return t.info("repo info: ",c),c}))}runOrQueueOperation(e,t,n,r){return B(this,void 0,void 0,(function*(){yield this.operationQueue.runOrQueueOperation(e,t,n,r)}))}abortRunningOpeation(e){this.operationQueue.abortRunningOperation(e)}normalizeOperationArgs(e,t){const n=(0,r.unwrap)(this.info.repoRoot);return t.map((t=>{if("object"==typeof t)switch(t.type){case"repo-relative-file":return c().normalize(c().relative(e,c().join(n,t.path)));case"succeedable-revset":return`max(successors(${t.revset}))`}return t}))}runOperation(e,t,n,r){var i,o;return B(this,void 0,void 0,(function*(){const s=this.normalizeOperationArgs(n,e.args),{stdin:a}=e,{command:u,args:c,options:l}=K(this.info.command,s,n,a?{input:a}:void 0);this.logger.log("run operation: ",u,s.join(" "));const d=A()(u,c,Object.assign(Object.assign({},l),{stdout:"pipe",stderr:"pipe"}));t("spawn"),null===(i=d.stdout)||void 0===i||i.on("data",(e=>{t("stdout",e.toString())})),null===(o=d.stderr)||void 0===o||o.on("data",(e=>{t("stderr",e.toString())})),d.on("exit",(e=>{t("exit",e||0)})),r.addEventListener("abort",(()=>{this.logger.log("kill operation: ",u,s.join(" "))})),function(e,t){t.addEventListener("abort",(()=>{"win32"==E().platform()?e.kill("SIGKILL",{forceKillAfterTimeout:!1}):(e.kill("SIGCONT"),e.kill("SIGTERM",{forceKillAfterTimeout:5e3}))}))}(d,r),yield d}))}setPageFocus(e,t){this.pageFocusTracker.setState(e,t)}getUncommittedChanges(){return this.uncommittedChanges}subscribeToUncommittedChanges(e){return this.uncommittedChangesEmitter.on("change",e),{dispose:()=>{this.uncommittedChangesEmitter.off("change",e)}}}getSmartlogCommits(){return this.smartlogCommits}subscribeToSmartlogCommitsChanges(e){return this.smartlogCommitsChangesEmitter.on("change",e),{dispose:()=>{this.smartlogCommitsChangesEmitter.off("change",e)}}}subscribeToSmartlogCommitsBeginFetching(e){const t=()=>e(!0);return this.smartlogCommitsBeginFetchingEmitter.on("start",t),{dispose:()=>{this.smartlogCommitsBeginFetchingEmitter.off("start",t)}}}subscribeToUncommittedChangesBeginFetching(e){const t=()=>e(!0);return this.uncommittedChangesBeginFetchingEmitter.on("start",t),{dispose:()=>{this.uncommittedChangesBeginFetchingEmitter.off("start",t)}}}subscribeToHeadCommit(e){var t,n;let r=null===(n=null===(t=this.smartlogCommits)||void 0===t?void 0:t.commits.value)||void 0===n?void 0:n.find((e=>e.isHead));null!=r&&e(r);const i=t=>{var n;const i=null===(n=null==t?void 0:t.commits.value)||void 0===n?void 0:n.find((e=>e.isHead));null!=i&&i.branch!==(null==r?void 0:r.branch)&&(e(i),r=i)};return this.smartlogCommitsChangesEmitter.on("change",i),{dispose:()=>{this.smartlogCommitsChangesEmitter.off("change",i)}}}relativeCat(e,t){const n=c().relative(this.info.repoRoot,e);return this.catLimiter.enqueueRun((()=>B(this,void 0,void 0,(function*(){return(yield this.runCommand(["internal-only","relative-cat",...this.catArgs(t,n)],void 0,{stripFinalNewline:!1})).stdout}))))}cat(e,t){const n=c().relative(this.info.repoRoot,e);return this.catLimiter.enqueueRun((()=>B(this,void 0,void 0,(function*(){return(yield this.runCommand(["internal-only","cat",t,n],void 0,{stripFinalNewline:!1})).stdout}))))}catArgs(e,t){switch(e.type){case r.ComparisonType.UncommittedChanges:return["uncommitted",t];case r.ComparisonType.HeadChanges:return["head",t];case r.ComparisonType.StackChanges:return["stack",t];case r.ComparisonType.Committed:return["stack",t,"--ref",e.hash]}}getAllDiffIds(){var e,t,n;return null!==(n=null===(t=null===(e=this.getSmartlogCommits())||void 0===e?void 0:e.commits.value)||void 0===t?void 0:t.map((e=>{var t;return null===(t=e.pr)||void 0===t?void 0:t.number})).filter(r.notEmpty))&&void 0!==n?n:[]}runCommand(e,t,n){return q({command:this.info.command,args:e,logger:this.logger,cwd:(0,r.unwrap)(null!=t?t:this.info.repoRoot),options:n})}getConfig(e){return V(this.info.command,this.logger,this.info.repoRoot,e)}setConfig(e,t,n){return function({command:e,logger:t,cwd:n,level:r,configName:i,configValue:o}){return B(this,void 0,void 0,(function*(){yield q({command:e,args:["internal-only","set-config","--level",r,i,o],logger:t,cwd:n})}))}({command:this.info.command,logger:this.logger,cwd:this.info.repoRoot,level:e,configName:t,configValue:n})}}function q({command:e,args:t,logger:n,cwd:r,options:i}){const{command:o,args:s,options:a}=K(e,t,r,i);return n&&n.log("run command: ",o,...s,a),A()(o,s,a)}function $(e,t,n){return B(this,void 0,void 0,(function*(){try{return JSON.parse((yield q({command:e,args:["internal-only","repo-info"],logger:t,cwd:n})).stdout)}catch(e){return void t.error(`Failed to find repository info in ${n}`,e)}}))}function W(e,t,n){return B(this,void 0,void 0,(function*(){try{return JSON.parse((yield q({command:e,args:["internal-only","profile"],logger:t,cwd:n})).stdout)}catch(e){return t.error(`Failed to find repository profile in ${n}`,e),{appUrl:"https://app.graphite.dev/"}}}))}function V(e,t,n,r){return B(this,void 0,void 0,(function*(){try{return(yield q({command:e,args:["internal-only","config",r],logger:t,cwd:n})).stdout.trim()}catch(e){return}}))}function K(e,t,n,r){let i=[...t];"win32"!==process.platform&&(i=i.map((e=>e.replace(/\\\\/g,"\\"))));const o=Object.assign(Object.assign({},r),{env:{LANG:"en_US.utf-8",EDITOR:void 0,GRAPHITE_INTERACTIVE:"true",GIT_OPTIONAL_LOCKS:"0"},cwd:n});return!e&&process.argv[1].startsWith("/snapshot/")?(e=process.argv[0],i=["/snapshot/monologue/apps/public/cli/dist/graphite.js",...i]):e||(e="gt"),{command:e,args:i,options:o}}var Q=n(32081),z=n(44828);const J={platformName:"browser",watchForChanges:(e,t,n)=>{const{repoRoot:r,dotdir:i}=e,o=z.watch(i,{cwd:i});o.on("ready",(()=>{n("everything")})),o.on("all",((e,t)=>{t.startsWith("rebase-merge")&&n("merge conflicts"),(t.startsWith("index")||t.startsWith("HEAD"))&&n("uncommitted changes"),(t.startsWith("refs/heads")||t.startsWith("refs/branch-metadata")||t.startsWith("HEAD"))&&n("branches")}));const s=c().relative(r,i),a=z.watch(r,{cwd:r,ignored:`${s}/**`});return a.on("all",(()=>{n("uncommitted changes")})),()=>{a.close().catch((()=>t.error(`failed to close chokidar worktree watcher for ${r}`))),o.close().catch((()=>t.error(`failed to close chokidar dotdir watcher for ${i}`)))}},handleMessageFromClient:(e,t)=>{switch(t.type){case"platform/openFile":{const n=c().join((0,r.unwrap)(null==e?void 0:e.info.repoRoot),t.path);let i;if(null==i)switch(process.platform){case"darwin":i="/usr/bin/open";break;case"win32":i="notepad.exe";break;case"linux":i="xdg-open"}if(i){null==e||e.logger.log("open file",n);const t=(0,Q.spawn)(i,[n],{detached:!0,stdio:"ignore",windowsHide:!1,windowsVerbatimArguments:!0});t.on("error",(t=>{null==e||e.logger.log("failed to open",n,t)})),t.unref()}break}}}};var Y=n(73292),X=n(9826),Z=n.n(X);class ee{constructor(e,t){this.promise=e,this.disposeFunc=t,this.disposed=!1}unref(){this.disposed||(this.disposed=!0,this.disposeFunc())}}class te{constructor(e){this.value=e,this.references=0,this.isDisposed=!1}ref(){this.references++}getNumberOfReferences(){return this.references}dispose(){this.references--,this.isDisposed||0!==this.references||(this.isDisposed=!0,this.value.dispose())}}const ne=new class{constructor(e=U){this.RepositoryType=e,this.reposByRoot=new Map,this.activeReposEmitter=new N}lookup(e){for(const n of this.reposByRoot.values())if((e===n.value.info.repoRoot||e.startsWith((t=n.value.info.repoRoot).endsWith(c().sep)?t:t+c().sep))&&!n.isDisposed)return n;var t}getOrCreate(e,t,n,r){const i=this.lookup(r);if(i)return i.ref(),new ee(Promise.resolve(i.value),(()=>i.dispose()));let o;return o=new ee((()=>{return i=this,s=void 0,u=function*(){const i=yield this.RepositoryType.getRepoInfo(e,n,r);if(n.info("repoInfo",i),"success"!==i.type)return i;if(o.disposed)return{type:"unknownError",error:new Error("Repository already disposed")};const s=this.lookup(i.repoRoot);if(s)return s.ref(),o.internalReference=s,s.value;const a=new this.RepositoryType(i,t,n),u=new te(a);return u.ref(),o.internalReference=u,this.reposByRoot.set(i.repoRoot,u),this.activeReposEmitter.emit("change"),a},new((a=void 0)||(a=Promise))((function(e,t){function n(e){try{o(u.next(e))}catch(e){t(e)}}function r(e){try{o(u.throw(e))}catch(e){t(e)}}function o(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}o((u=u.apply(i,s||[])).next())}));var i,s,a,u})(),(()=>{o.internalReference&&o.internalReference.dispose(),o.unref()})),o}cachedRepositoryForPath(e){const t=this.lookup(e);return null==t?void 0:t.value}onChangeActiveRepos(e){const t=()=>{e([...this.reposByRoot.values()].map((e=>e.value)))};return this.activeReposEmitter.on("change",t),t(),()=>this.activeReposEmitter.off("change",t)}clearCache(){this.reposByRoot.forEach((e=>e.dispose())),this.reposByRoot=new Map,this.activeReposEmitter.removeAllListeners()}numberOfActiveServers(){let e=0;for(const t of this.reposByRoot.values())e+=t.getNumberOfReferences();return e}};class re{constructor(e,t,n,i){this.platform=e,this.connection=t,this.tracker=n,this.logger=i,this.listenersByType=new Map,this.repoDisposables=[],this.subscriptions=new Map,this.queuedMessages=[],this.currentState={type:"loading"},this.pageId=(0,r.randomId)();let o=null;this.incomingListener=this.connection.onDidReceiveMessage(((e,n)=>{var i,s,a;if(n)return null==o?void(null===(i=t.logger)||void 0===i||i.error("Error: got a binary message when not expecting one")):(this.handleIncomingMessageWithPayload(o,e),void(o=null));if(null!=o)return null===(s=t.logger)||void 0===s||s.error("Error: didnt get binary payload after a message that requires one"),void(o=null);const u=e.toString("utf-8"),c=(0,r.deserializeFromString)(u);if(function(e){return null!=e&&"object"==typeof e&&!0===e.hasBinaryPayload}(c))o=c;else if("loading"===this.currentState.type)this.queuedMessages.push(c);else try{this.handleIncomingMessage(c)}catch(e){null===(a=t.logger)||void 0===a||a.error("error handling incoming message: ",c,e)}}))}setRepoError(e){this.disposeRepoDisposables(),this.currentState={type:"error",error:e},this.tracker.context.setRepo(void 0),this.processQueuedMessages()}setCurrentRepo(e,t){this.disposeRepoDisposables(),this.currentState={type:"repo",repo:e,cwd:t},this.tracker.context.setRepo(e),null!=e.codeReviewProvider&&this.repoDisposables.push(e.codeReviewProvider.onChangeDiffSummaries((e=>{this.postMessage({type:"fetchedDiffSummaries",summaries:e})}))),this.repoDisposables.push(e.subscribeToHeadCommit((t=>{const n=e.getSmartlogCommits(),r=function(e,t){let n;if(null!=e){const r=new Map(e.map((e=>[e.branch,e])));let i=t;for(;null!=i;){if(i.partOfTrunk){n=i;break}if(null==i.parents[0])break;i=r.get(i.parents[0])}}return n}(null==n?void 0:n.commits.value,t);this.tracker.track("HeadCommitChanged",{extras:{hash:t.branch,public:null==r?void 0:r.branch}})}))),this.processQueuedMessages()}postMessage(e){this.connection.postMessage((0,r.serializeToString)(e)).catch((()=>{console.warn("Failed to post message to client")}))}setActiveRepoForCwd(e){void 0!==this.activeRepoRef&&this.activeRepoRef.unref(),this.logger.info(`Setting active repo cwd to ${e}`),this.currentState={type:"loading"};const t=this.connection.command;this.activeRepoRef=ne.getOrCreate(t,this.platform,this.logger,e),this.activeRepoRef.promise.then((t=>{t instanceof U?this.setCurrentRepo(t,e):this.setRepoError(t)}))}dispose(){this.incomingListener.dispose(),this.disposeRepoDisposables(),void 0!==this.activeRepoRef&&this.activeRepoRef.unref()}disposeRepoDisposables(){this.repoDisposables.forEach((e=>e.dispose())),this.repoDisposables=[],this.subscriptions.forEach((e=>e.dispose())),this.subscriptions.clear()}processQueuedMessages(){var e;for(const t of this.queuedMessages)try{this.handleIncomingMessage(t)}catch(n){null===(e=this.connection.logger)||void 0===e||e.error("error handling queued message: ",t,n)}this.queuedMessages=[]}handleIncomingMessageWithPayload(e,t){switch(e.type){case"uploadFile":{const{id:n,filename:i}=e,o=null;if(null==o)return;this.tracker.operation("UploadImage","UploadImageError",{},(()=>o((0,r.unwrap)(this.connection.logger),{filename:i,data:t}))).then((e=>{var t;null===(t=this.connection.logger)||void 0===t||t.info("sucessfully uploaded file",i,e),this.postMessage({type:"uploadFileResult",id:n,result:{value:e}})})).catch((e=>{var t;null===(t=this.connection.logger)||void 0===t||t.info("error uploading file",i,e),this.postMessage({type:"uploadFileResult",id:n,result:{error:e}})}));break}}}handleIncomingMessage(e){this.handleIncomingGeneralMessage(e);const{currentState:t}=this;switch(t.type){case"repo":{const{repo:n,cwd:r}=t;this.handleIncomingMessageWithRepo(e,n,r);break}case"loading":case"error":e.type.startsWith("platform/")&&(this.platform.handleMessageFromClient(void 0,e,(e=>this.postMessage(e)),(e=>{this.repoDisposables.push({dispose:e})})),this.notifyListeners(e))}}handleIncomingGeneralMessage(e){switch(this.logger.info("GeneralMessage",e),e.type){case"installCli":("brew"===e.method?A()("brew",["install","withgraphite/tap/graphite"]):A()("npm",["install","-g","@withgraphite/graphite-cli@stable"])).then((()=>{this.postMessage({type:"installCliResult",result:"success"})})).catch((e=>{const t=e instanceof Error?e.message:"Unknown error";this.postMessage({type:"installCliResult",result:"error",error:t})}));break;case"updateCli":Z()("gt").then((e=>{return t=this,n=void 0,i=function*(){const t=yield(0,Y.realpath)(e),n="lib/node_modules/@withgraphite/graphite-cli/graphite.js";if(t.endsWith(n)){const e=t.replace(n,"bin/npm");return A()(e,["install","-g","@withgraphite/graphite-cli@stable"])}if(t.endsWith("/bin/gt")&&t.includes("Cellar"))return yield A()("brew",["update"]),A()("brew",["upgrade","withgraphite/tap/graphite"]);throw new Error("Couldn't determine installation method")},new((r=void 0)||(r=Promise))((function(e,o){function s(e){try{u(i.next(e))}catch(e){o(e)}}function a(e){try{u(i.throw(e))}catch(e){o(e)}}function u(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(s,a)}u((i=i.apply(t,n||[])).next())}));var t,n,r,i})).then((()=>{this.postMessage({type:"updateCliResult",result:"success"})})).catch((e=>{this.postMessage({type:"updateCliResult",result:"error",error:e instanceof Error?e.message:"Unknown error"})}));break;case"fetchAllBranches":q({command:this.connection.command||"gt",args:["internal-only","all-branches"],cwd:this.connection.cwd}).then((e=>({value:JSON.parse(e.stdout)}))).catch((e=>{var t;return null===(t=this.logger)||void 0===t||t.error("error fetching auth status",e.toString()),{error:e}})).then((e=>{e.value&&this.postMessage({type:"fetchedAllBranches",message:e.value})}));break;case"initializeRepository":this.logger.info("init"),q({command:this.connection.command||"gt",args:["init","--trunk",e.trunkBranch],cwd:this.connection.cwd}).then((e=>{this.logger.info("initializeRepository",e),e.exitCode&&this.postMessage({type:"failedToInitializeRepository"}),this.postMessage({type:"initializedRepository"})})).catch((()=>{this.postMessage({type:"failedToInitializeRepository"})}));break;case"track":this.tracker.trackData(e.data);break;case"changeCwd":this.setActiveRepoForCwd(e.cwd);break;case"requestRepoInfo":switch(this.currentState.type){case"repo":this.postMessage({type:"repoInfo",info:this.currentState.repo.info,cwd:this.currentState.cwd});break;case"error":this.postMessage({type:"repoInfo",info:this.currentState.error})}break;case"requestApplicationInfo":this.postMessage({type:"applicationInfo",platformName:this.platform.platformName,version:this.connection.version})}}handleIncomingMessageWithRepo(e,t,n){var i,s,a,u,l;const{logger:d}=t;switch(e.type){case"subscribe":{const{subscriptionID:n,kind:r}=e;switch(r){case"uncommittedChanges":{const e=e=>{this.postMessage({type:"subscriptionResult",kind:"uncommittedChanges",subscriptionID:n,data:e})},r=t.getUncommittedChanges();null!=r&&e(r);const i=[];i.push(t.subscribeToUncommittedChanges(e)),t.fetchUncommittedChanges(),i.push(t.subscribeToUncommittedChangesBeginFetching((()=>this.postMessage({type:"beganFetchingUncommittedChangesEvent"})))),this.subscriptions.set(n,{dispose:()=>{i.forEach((e=>e.dispose()))}});break}case"smartlogCommits":{const e=e=>{this.postMessage({type:"subscriptionResult",kind:"smartlogCommits",subscriptionID:n,data:e})},r=t.getSmartlogCommits();null!=r&&e(r);const i=[];i.push(t.subscribeToSmartlogCommitsChanges(e)),t.fetchSmartlogCommits(),i.push(t.subscribeToSmartlogCommitsBeginFetching((()=>this.postMessage({type:"beganFetchingSmartlogCommitsEvent"})))),this.subscriptions.set(n,{dispose:()=>{i.forEach((e=>e.dispose()))}});break}case"mergeConflicts":{const e=e=>{this.postMessage({type:"subscriptionResult",kind:"mergeConflicts",subscriptionID:n,data:e})},r=t.getMergeConflicts();null!=r&&e(r),this.subscriptions.set(n,t.onChangeConflictState(e));break}}break}case"unsubscribe":{const t=this.subscriptions.get(e.subscriptionID);null==t||t.dispose(),this.subscriptions.delete(e.subscriptionID);break}case"runOperation":{const{operation:r}=e;t.runOrQueueOperation(r,(e=>{this.postMessage(Object.assign({type:"operationProgress"},e)),"queue"===e.kind&&this.tracker.track("QueueOperation",{extras:{operation:r.trackEventName}})}),this.tracker,n);break}case"abortRunningOperation":{const{operationId:n}=e;t.abortRunningOpeation(n);break}case"getConfig":t.getConfig(e.name).catch((()=>{})).then((t=>{d.info("got config",e.name,t),this.postMessage({type:"gotConfig",name:e.name,value:t})}));break;case"getPersistentViewState":this.postMessage({type:"gotPersistentViewState",name:e.name,value:this.connection.persistentClientSideViewState[e.name]});break;case"fetchRepoMessage":t.runCommand(["internal-only","repo-message"]).then((e=>({value:e.stdout}))).catch((e=>(null==d||d.error("error fetching repo message",e.toString()),{error:e}))).then((e=>this.postMessage({type:"fetchedRepoMessage",message:e.value||""})));break;case"fetchUpgradePrompt":d.info("fetchUpgradePrompt"),t.runCommand(["internal-only","upgrade-prompt"]).then((e=>({value:e.stdout}))).catch((e=>(null==d||d.error("error fetching upgrade prompt",e.toString()),{error:e}))).then((e=>this.postMessage({type:"fetchedUpgradePrompt",message:e.value||""})));break;case"fetchAuthStatus":t.runCommand(["internal-only","check-auth"]).then((e=>({value:JSON.parse(e.stdout)}))).catch((e=>(null==d||d.error("error fetching auth status",e.toString()),{error:e}))).then((e=>{e.value&&this.postMessage({type:"fetchedAuthStatus",message:e.value})}));break;case"fetchPotentialParents":{const{branchToTrack:n}=e;t.runCommand(["internal-only","potential-parents",n]).then((e=>({value:JSON.parse(e.stdout)}))).catch((e=>(null==d||d.error("error fetching potential parents",e.toString()),{error:e}))).then((e=>{e.value&&this.postMessage({type:"fetchedPotentialParents",message:e.value})}));break}case"setConfig":d.info("set config",e.name,e.value),t.setConfig("user",e.name,e.value).catch((t=>{d.error("error setting config",e.name,e.value,t)}));break;case"setPersistentViewState":this.connection.persistentClientSideViewState[e.name]=e.value;break;case"deleteFile":{const{filePath:n}=e,r=function(e,t,n=c()){const r=n.resolve(t.info.repoRoot,e);return r.startsWith(t.info.repoRoot+n.sep)?r:null}(n,t);if(null==r)return void d.warn("can't delete file outside of the repo",n);o().promises.rm(r).then((()=>{d.info("deleted file from filesystem",r)})).catch((e=>{d.error("unable to delete file",r,e)}));break}case"requestComparison":{const{comparison:n}=e;t.runCommand(["internal-only","diff",...H(n)]).then((e=>({value:e.stdout}))).catch((e=>(null==d||d.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"comparison",comparison:n,data:{diff:e}})));break}case"requestChangedFiles":{const{branch:n}=e;t.runCommand(["internal-only","changed-files",n]).then((e=>JSON.parse(e.stdout))).catch((e=>(null==d||d.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"changedFiles",branch:n,data:e})));break}case"requestComparisonContextLines":{const{id:{path:n,comparison:i},start:o,numLines:s}=e;if(i.type===r.ComparisonType.Commit||i.type===r.ComparisonType.Range)throw new Error("Not implemented");t.relativeCat(n,i).catch((()=>"")).then((e=>this.postMessage({type:"comparisonContextLines",lines:e.split("\n").slice(o-1,o-1+s),path:n})));break}case"requestChangedFilesInRange":{const{fromSha:n,toSha:r}=e;t.runCommand(["internal-only","changed-files",r,"--from",n]).then((e=>JSON.parse(e.stdout))).catch((e=>(null==d||d.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"changedFilesInRange",fromSha:n,toSha:r,data:e})));break}case"requestCommitsInBranch":{const{branch:n}=e;t.runCommand(["internal-only","list-commits",n]).then((e=>JSON.parse(e.stdout))).catch((e=>(null==d||d.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"commitsInBranch",branch:n,data:e})));break}case"requestChangedFilesInCommit":{const{commitSha:n}=e;t.runCommand(["internal-only","changed-files",n,"--from",`${n}~`]).then((e=>JSON.parse(e.stdout))).catch((e=>(null==d||d.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"changedFilesInCommit",commitSha:n,data:e})));break}case"refresh":null==d||d.log("refresh requested"),t.fetchSmartlogCommits(),t.fetchUncommittedChanges(),null===(i=t.codeReviewProvider)||void 0===i||i.triggerDiffSummariesFetch(t.getAllDiffIds());break;case"pageVisibility":t.setPageFocus(this.pageId,e.state);break;case"fetchCommitMessageTemplate":t.runCommand(["internal-only","templates"]).then((e=>{const n=JSON.parse(e.stdout);this.postMessage({type:"fetchedCommitMessageTemplate",templates:Object.fromEntries(Object.entries(n).map((([e,n])=>[e,n.replace(t.IGNORE_COMMIT_MESSAGE_LINES_REGEX,"")])))})})).catch((e=>{null==d||d.error("Could not fetch commit message template",e)}));break;case"typeahead":null===(u=null===(a=null===(s=t.codeReviewProvider)||void 0===s?void 0:s.typeahead)||void 0===a?void 0:a.call(s,e.kind,e.query))||void 0===u||u.then((t=>this.postMessage({type:"typeaheadResult",id:e.id,result:t})));break;case"fetchDiffSummaries":null===(l=t.codeReviewProvider)||void 0===l||l.triggerDiffSummariesFetch(t.getAllDiffIds());break;case"loadMoreCommits":{const e=t.nextVisibleCommitRangeInDays();return this.postMessage({type:"commitsShownRange",rangeInDays:e}),this.postMessage({type:"beganLoadingMoreCommits"}),t.fetchSmartlogCommits(),void this.tracker.track("LoadMoreCommits",{extras:{daysToFetch:null!=e?e:"Infinity"}})}default:this.platform.handleMessageFromClient(t,e,(e=>this.postMessage(e)),(e=>{this.repoDisposables.push({dispose:e})}))}this.notifyListeners(e)}notifyListeners(e){const t=this.listenersByType.get(e.type);t&&t.forEach((t=>t(e)))}}var ie=n(6113);const oe="win32"==process.platform?c().join((0,r.unwrap)(process.env.LOCALAPPDATA),"cache"):"darwin"==process.platform?c().join(E().homedir(),"Library/Caches"):process.env.XDG_CACHE_HOME||c().join(E().homedir(),".cache");function se(e,t){const n=Buffer.from(e),r=Buffer.from(t);return n.length===r.length&&(0,ie.timingSafeEqual)(n,r)}function ae(e){var t,n,i;const s=null!==(t=e.logger)&&void 0!==t?t:e.logFileLocation?function(e){const t=(...t)=>{const n=O().format(...t)+"\n";o().promises.appendFile(e,n)};return{info:t,log:t,warn:t,error:t,getLogFileContents:()=>o().promises.readFile(e,"utf-8")}}(e.logFileLocation):S;e.logger=s;const a=null!==(n=null==e?void 0:e.platform)&&void 0!==n?n:J,u=null!==(i=null==e?void 0:e.version)&&void 0!==i?i:"unknown";s.log(`establish client connection for ${e.cwd}`),s.log(`platform '${a.platformName}', version '${u}', command '${e.command}'`),function(e){var t,n;return v(this,void 0,void 0,(function*(){const r=yield(0,m.composeUserConfigFactory)().load();let i=null===(n=null===(t=r.data.gtiConfigs)||void 0===t?void 0:t.find((e=>"gti.install-uuid"===e.key)))||void 0===n?void 0:n.value;if(!i){const e=(0,g.Z)();yield r.update((t=>{t.gtiConfigs||(t.gtiConfigs=[]),t.gtiConfigs.push({key:"gti.install-uuid",value:e})})),i=e}const o=yield function(e){return v(this,void 0,void 0,(function*(){try{const t=yield(0,p.composeGit)({debug:t=>e.info(t)});return yield t.config("user.email")}catch(t){try{e.error("Failed to get git email",t)}catch(e){}return}}))}(e);y({event:"gti-server-startup",timestampISOString:(new Date).toISOString(),logger:e,details:{installUuid:i,gitEmail:o}})}))}(s).catch((e=>{s.error("Failed to log startup",e)}));const c=function(e,t,n,i=C){return new r.Tracker(((e,t)=>{var n,r;const{logger:o}=t;o.log("[track]",e.eventName,null!==(n=e.errorName)&&void 0!==n?n:"",null!==(r=e.errorMessage)&&void 0!==r?r:"",null!=e.extras?JSON.stringify(e.extras):"");try{Promise.resolve(i(Object.assign(Object.assign({},e),t.data))).catch((e=>{}))}catch(e){}}),new w(e,function(e,t){return{platform:e,version:t,repo:void 0,sessionId:(0,r.randomId)(),unixname:_(),osArch:E().arch(),osType:E().platform(),osRelease:E().release(),hostname:E().hostname()}}(t.platformName,n)))}(s,a,u,(t=>q({command:e.command||"gt",args:["internal-only","log-action",t.eventName||t.errorName||"UNKNOWN_CLI_EVENT",(t.timestamp?new Date(t.timestamp):new Date).toISOString(),JSON.stringify(t)],cwd:e.cwd})));c.track("ClientConnection",{extras:{cwd:e.cwd}});let l=new re(a,e,c,s);return l.setActiveRepoForCwd(e.cwd),()=>{null==l||l.dispose(),l=null}}c().join(oe,"graphite-gti");var ue=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};function ce({port:e,sensitiveToken:t,challengeToken:n,logFileLocation:i,logInfo:s,command:u,gtVersion:l,foreground:h,frontendDir:m}){return new Promise((p=>{try{const e=JSON.parse(o().readFileSync(c().join(m,"build/asset-manifest.json"),"utf-8"));for(const t of Object.values(e.files))t.startsWith("/")||p({type:"error",error:`expected entry to start with / but was: \`${t}\``}),he[t]=t.slice(1)}catch(e){}he["/favicon.ico"]="favicon.ico";const g=a().createServer(((e,r)=>ue(this,void 0,void 0,(function*(){var i,s;if(e.url){const{pathname:a}=d().parse(e.url);if(null!=a&&he.hasOwnProperty(a)){const e=he[a];let t;try{t=yield o().promises.readFile(c().join(m,"build",e))}catch(e){return r.writeHead(500,{"Content-Type":"text/plain"}),void r.end((s=e.toString(),s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#27;")))}const n=e.lastIndexOf("."),u=e.slice(n+1),l=null!==(i=de[u])&&void 0!==i?i:"text/plain";return r.writeHead(200,{"Content-Type":l}),void r.end(t)}if("/challenge_authenticity"===a){const i=le(e.url).get("token");if(i&&se(i,t)){r.writeHead(200,{"Content-Type":"text/json"});const e={challengeToken:n,pid:process.pid};r.end(JSON.stringify(e))}else r.writeHead(401,{"Content-Type":"text/json"}),r.end(JSON.stringify({error:"invalid token"}));return}}r.writeHead(404,{"Content-Type":"text/html"}),r.end("<html><body>Not Found!</body></html>")})))),v=g.listen(e),y=new(f().Server)({noServer:!0,path:"/ws"});y.on("connection",((e,n)=>{let o,a,c;if(n.url){const e=le(n.url);o=e.get("token");const t=e.get("cwd");c=e.get("platform"),t&&(a=decodeURIComponent(t))}if(!o){const t="No token provided in websocket request";return s("closing ws:",t),void e.close(r.CLOSED_AND_SHOULD_NOT_RECONNECT_CODE,t)}if(!se(o,t)){const t="Invalid token";return s("closing ws:",t),void e.close(r.CLOSED_AND_SHOULD_NOT_RECONNECT_CODE,t)}const d=ae({postMessage:t=>(e.send(t),Promise.resolve(!0)),onDidReceiveMessage(t){const n=e.on("message",t);return{dispose:()=>n.off("message",t)}},cwd:null!=a?a:process.cwd(),logFileLocation:"stdout"===i?void 0:i,command:u,version:l,persistentClientSideViewState:{},platform:void 0});e.on("close",(()=>{d(),h||setTimeout((()=>{0===ne.numberOfActiveServers()&&process.exit(0)}),6e4)}))})),v.on("upgrade",((e,t,n)=>{y.handleUpgrade(e,t,n,(t=>{y.emit("connection",t,e)}))})),g.on("error",(function(t){if("listen"!==t.syscall)throw p({type:"error",error:t.toString()}),t;switch(t.code){case"EACCES":throw p({type:"error",error:`Port ${e} requires elevated privileges`}),t;case"EADDRINUSE":return void p({type:"addressInUse"});default:throw p({type:"error",error:t.toString()}),t}})),g.on("listening",(()=>p({type:"success",port:g.address().port,pid:process.pid})))}))}function le(e){var t;const n=null===(t=d().parse(e).search)||void 0===t?void 0:t.replace(/^\?/,"").split("&").map((e=>e.split("=")));return new Map(n)}const de={css:"text/css",html:"text/html",js:"text/javascript",ttf:"font/ttf"},he={"/":"index.html"}}};
2
+ "use strict";exports.id=16,exports.ids=[16],exports.modules={42161:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.sendAnalyticsEvent=void 0;const i=n(79379),o=n(90103),s=n(17891);t.sendAnalyticsEvent=function({event:e,timestampISOString:t,logger:n,details:a}){(()=>r(this,void 0,void 0,(function*(){const n=yield(0,s.composeUserConfigFactory)().load(),r=(0,o.composeRequest)({userConfig:n});yield r({route:i.API_ROUTES.logActions,params:{actions:[{details:a,name:e,timestamp:t}]}})})))().catch((e=>{n.error(`sendAnaltyicsEvent threw an error: ${e}`)}))}},4740:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.cuteString=void 0,t.cuteString=e=>JSON.stringify(e,null,2)},98126:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PreconditionsFailedError=t.ExitFailedError=void 0;class n extends Error{constructor(e){super(e),this.name="ExitFailed"}}t.ExitFailedError=n;class r extends Error{constructor(e){super(e),this.name="PreconditionsFailed"}}t.PreconditionsFailedError=r},79115:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(42161),t),i(n(4740),t),i(n(98126),t),i(n(90103),t),i(n(75357),t),i(n(17891),t),i(n(52081),t)},90103:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeRequest=void 0;const i=n(53977);t.composeRequest=function({userConfig:e}){const t=e.getAuthToken(),n=e.getApiServerUrl();return({route:e,params:o,queryParams:s,urlParams:a,headers:u})=>r(this,void 0,void 0,(function*(){return yield i.request.requestWithArgs({apiServer:n,route:e,params:o,queryParams:s,urlParams:a,headers:Object.assign({authorization:t?`token ${t}`:void 0},u)})}))}},75357:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.spiffy=void 0;const o=i(n(32856)),s=n(4740),a=n(98126);t.spiffy=function(e){const t=()=>r(this,void 0,void 0,(function*(){var t;const n=yield function({filePath:e,oldFilepath:t,schema:n,initialize:i,removeIfInvalid:s,debug:u}){return r(this,void 0,void 0,(function*(){null==u||u(`Reading JSON for ${e}`);const r=e&&(yield o.default.pathExists(e));t&&(yield o.default.pathExists(t))&&(null==u||u(`Migrating old JSON for ${e}`),r?o.default.removeSync(t):o.default.moveSync(t,e));try{const t=r?yield o.default.readJson(e):i();if(!n(t,{logFailures:!1}))throw new Error("Malformed data");return null==u||u(`Successfully parsed JSON at ${e}`),t}catch(t){if(null==u||u(`Failed to parse JSON at ${e}`),s)return null==u||u(`Removing invalid JSON and re-initializing ${e}`),yield o.default.remove(e),i();throw new a.ExitFailedError(`Malformed JSON at ${e}`)}}))}({filePath:e.filepath,oldFilepath:e.oldFilepath,schema:e.schema,initialize:e.initialize,removeIfInvalid:(null===(t=e.options)||void 0===t?void 0:t.removeIfEmpty)||!1,debug:e.debug}),i=t=>r(this,void 0,void 0,(function*(){var r;t(n),(null===(r=e.options)||void 0===r?void 0:r.removeIfEmpty)&&(0,s.cuteString)(n)===(0,s.cuteString)({})?yield o.default.remove(e.filepath):yield o.default.outputFile(e.filepath,(0,s.cuteString)(n),{mode:384})}));return Object.assign({data:n,update:i,path:e.filepath,delete:()=>r(this,void 0,void 0,(function*(){(yield o.default.pathExists(e.filepath))&&(yield o.default.remove(e.filepath))}))},e.helperFunctions(n,i))}));return{load:t,loadIfExists:()=>r(this,void 0,void 0,(function*(){if(yield o.default.pathExists(e.filepath))return t()}))}}},17891:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t},s=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.composeUserConfigFactory=t.DEFAULT_GRAPHITE_APP_SERVER=t.DEFAULT_GRAPHITE_API_SERVER=void 0;const u=n(34490),c=o(n(8296)),l=a(n(22037)),d=a(n(71017)),h=n(98126),f=n(75357),m=n(52081),p=c.shape({branchPrefix:c.optional(c.string),branchDate:c.optional(c.boolean),branchReplacement:c.optional(c.unionMany([c.literal("_"),c.literal("-"),c.literal("")])),skipApplyingPrefixToNonGeneratedBranchNames:c.optional(c.boolean),allowSlashesInGeneratedBranchNames:c.optional(c.boolean),allowUpperCaseInGeneratedBranchNames:c.optional(c.boolean),authToken:c.optional(c.string),tips:c.optional(c.boolean),yubikey:c.optional(c.boolean),editor:c.optional(c.string),pager:c.optional(c.string),restackCommitterDateIsAuthorDate:c.optional(c.boolean),submitIncludeCommitMessages:c.optional(c.boolean),excludeTemplatesWithCommitMessages:c.optional(c.boolean),submitViaCli:c.optional(c.boolean),connectCliToLocalServer:c.optional(c.boolean),gtiConfigs:c.optional(c.array(c.shape({key:c.string,value:c.string}))),alternativeProfiles:c.optional(c.array(c.shape({name:c.string,hostPrefix:c.string,authToken:c.optional(c.string)}))),systemTrayConfig:c.optional(c.shape({sections:c.array(c.shape({sectionId:c.string,display:c.boolean}))})),debugExpiryMs:c.optional(c.number)});t.DEFAULT_GRAPHITE_API_SERVER="https://api.graphite.dev/v1",t.DEFAULT_GRAPHITE_APP_SERVER="https://app.graphite.dev",t.composeUserConfigFactory=()=>(0,f.spiffy)({schema:p,oldFilepath:d.default.join(l.default.homedir(),".graphite_user_config"),filepath:d.default.join((0,m.getGtConfigDir)(),"user_config"),initialize:()=>({}),helperFunctions:(e,n)=>{const r=()=>{var t,n,r;if(!process.env.GRAPHITE_PROFILE)return null!==(n=null===(t=e.alternativeProfiles)||void 0===t?void 0:t.find((e=>"default"===e.name)))&&void 0!==n?n:null;const i=null===(r=e.alternativeProfiles)||void 0===r?void 0:r.find((e=>e.name===process.env.GRAPHITE_PROFILE));if(!i)throw new Error(`Unknown profile ${process.env.GRAPHITE_PROFILE}`);return i},i=()=>{var e;const n=null===(e=r())||void 0===e?void 0:e.hostPrefix;return n?`https://app.${n}.graphite.dev`:t.DEFAULT_GRAPHITE_APP_SERVER},o=()=>`${i()}/activate`,a=()=>{var t,n;return null!==(n=null===(t=r())||void 0===t?void 0:t.authToken)&&void 0!==n?n:e.authToken};return{getBranchReplacement:()=>{var t;return null!==(t=e.branchReplacement)&&void 0!==t?t:"_"},getEditor:t=>s(void 0,void 0,void 0,(function*(){var n,r,i,o,s,a;return null!==(a=null!==(s=null!==(o=null!==(i=null!==(r=null!==(n=process.env.GT_EDITOR)&&void 0!==n?n:e.editor)&&void 0!==r?r:yield t())&&void 0!==i?i:process.env.GIT_EDITOR)&&void 0!==o?o:process.env.VISUAL)&&void 0!==s?s:process.env.EDITOR)&&void 0!==a?a:"vi"})),getPager:t=>s(void 0,void 0,void 0,(function*(){var n,r,i,o,s;const a=null!==(s=null!==(o=null!==(i=null!==(r=null!==(n=process.env.GT_PAGER)&&void 0!==n?n:e.pager)&&void 0!==r?r:yield t())&&void 0!==i?i:process.env.GIT_PAGER)&&void 0!==o?o:process.env.PAGER)&&void 0!==s?s:"less";return""===a?void 0:a})),getApiServerUrl:()=>{var n;if(e.connectCliToLocalServer)return process.env.NODE_TLS_REJECT_UNAUTHORIZED="0","https://localhost:8000/v1";const i=null===(n=r())||void 0===n?void 0:n.hostPrefix;return i?`https://api.${i}.graphite.dev/v1`:t.DEFAULT_GRAPHITE_API_SERVER},getAppServerUrl:i,getAuthToken:a,setAuthToken:e=>s(void 0,void 0,void 0,(function*(){var t;const i=null===(t=r())||void 0===t?void 0:t.name;yield n(i?t=>{var n;const r=null===(n=t.alternativeProfiles)||void 0===n?void 0:n.find((({name:e})=>e===i));if(!r)throw new Error(`Unknown profile ${i}`);r.authToken=e}:t=>t.authToken=e)})),getProfileName:()=>{var e;return null===(e=r())||void 0===e?void 0:e.name},authTokenPrecondition:()=>{const e=a();if(!e||0===e.length)throw new h.PreconditionsFailedError(`Please authenticate your Graphite CLI by visiting ${o()}`)},getDefaultPrDescriptionBehavior:()=>e.submitIncludeCommitMessages?e.excludeTemplatesWithCommitMessages?"messages":"both":"template",getSubmitViaCli:()=>{var t;return null!==(t=e.submitViaCli)&&void 0!==t&&t},getCLIAuthUrl:o,setSectionConfig:({sectionId:e,display:t})=>s(void 0,void 0,void 0,(function*(){yield n((n=>{var r,i,o;n.systemTrayConfig&&(n.systemTrayConfig.sections=null===(r=n.systemTrayConfig)||void 0===r?void 0:r.sections.filter((t=>t.sectionId!==e))),n.systemTrayConfig={sections:[...null!==(o=null===(i=n.systemTrayConfig)||void 0===i?void 0:i.sections)&&void 0!==o?o:[],{sectionId:e,display:t}]}}))})),getSectionConfig:t=>{var n;const r=null===(n=e.systemTrayConfig)||void 0===n?void 0:n.sections.find((e=>t===e.sectionId));return null!=r?r:{sectionId:t,display:!0}},getDebugExpiryMs:()=>{var t;return null!==(t=e.debugExpiryMs)&&void 0!==t?t:g},initialized:()=>!(0,u.isEmptyObject)(e)}}});const g=864e5},52081:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getGtDataDir=t.getGtConfigDir=void 0;const r=n(22037),i=n(71017);t.getGtConfigDir=()=>{var e;return(0,i.join)(null!==(e=process.env.XDG_CONFIG_HOME)&&void 0!==e?e:(0,i.join)((0,r.homedir)(),".config"),"graphite")},t.getGtDataDir=()=>{var e;return(0,i.join)(null!==(e=process.env.XDG_DATA_HOME)&&void 0!==e?e:(0,i.join)((0,r.homedir)(),".local","share"),"graphite")}},79379:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.API_ROUTES=t.pullRequestInfoShape=void 0;const s=n(27716),a=o(n(8296)),u={repoOwner:a.string,repoName:a.string,prNumbers:a.array(a.number),prHeadRefNames:a.optional(a.array(a.string)),trunkBranchNames:a.optional(a.array(a.string)),consistent:a.optional(a.boolean)};t.pullRequestInfoShape=a.shape({prNumber:a.number,title:a.string,body:a.string,state:a.literals(["OPEN","CLOSED","MERGED"]),reviewDecision:a.literals(["CHANGES_REQUESTED","APPROVED","REVIEW_REQUIRED",null,void 0]),headRefName:a.string,baseRefName:a.string,url:a.string,isDraft:a.boolean,versions:a.array(a.shape({headSha:a.string,baseSha:a.string,baseName:a.string,createdAt:a.string,authorGithubHandle:a.optional(a.string)})),dependentPrNumber:a.optional(a.number),mergeCommitSha:a.optional(a.string),cliTrunk:a.optional(a.string)}),t.API_ROUTES={logActions:{method:"POST",url:"/graphite/cli/log-actions",params:{actions:a.array(a.shape({name:a.string,details:a.optional(a.shape({})),timestamp:a.string}))}},logCommand:{method:"POST",url:"/graphite/log-command",params:{commandName:a.string,durationMiliSeconds:a.number,user:a.string,version:a.optional(a.string),err:a.optional(a.shape({name:a.string,message:a.string,stackTrace:a.string,debugContext:a.optional(a.string)}))}},downstackDependencies:{method:"GET",url:"/graphite/downstack-dependencies",queryParams:{org:a.string,repo:a.string,trunkName:a.string,branchName:a.string},response:{downstackBranchNames:a.array(a.string)}},upgradePrompt:{method:"GET",url:"/graphite/upgrade",queryParams:{currentVersion:a.string,installationMethod:a.optional(a.string)},response:{prompt:a.optional(a.shape({message:a.string,blocking:a.boolean}))}},featureFlags:{method:"GET",url:"/graphite/feature-flags",queryParams:{currentVersion:a.string},response:{flags:a.array(a.shape({flagName:a.string,flagValue:a.boolean}))}},feedback:{method:"POST",url:"/graphite/feedback",params:{user:a.string,message:a.string,debugContext:a.optional(a.string)}},generateBranchNameAndCommitMessage:{method:"POST",url:"/graphite/generate-branch-name-and-commit-message",params:{diff:a.string,template:a.optional(a.string),owner:a.optional(a.string),repo:a.optional(a.string)},response:{result:a.union(a.shape({branchName:a.string,commitMessage:a.string}),a.shape({error:a.string}))}},generateTitleAndDescription:{method:"POST",url:"/graphite/generate-title-and-description",params:{diff:a.string,template:a.optional(a.string),owner:a.string,repo:a.string},response:{result:a.union(a.shape({title:a.string,description:a.string}),a.shape({error:a.string}))}},traces:{method:"POST",url:"/graphite/traces",params:{jsonTraces:a.string,cliVersion:a.string}},submitPullRequests:{method:"POST",url:"/graphite/submit/pull-requests",params:{repoOwner:a.string,repoName:a.string,trunkBranchName:a.optional(a.string),targetTrunkBranchName:a.optional(a.string),mergeWhenReady:a.optional(a.boolean),rerequestReview:a.optional(a.boolean),comment:a.optional(a.string),gti:a.optional(a.boolean),useWebSubmit:a.optional(a.boolean),prs:a.array(a.unionMany([a.shape({action:a.literals(["create"]),head:a.string,headSha:a.optional(a.string),base:a.string,baseSha:a.optional(a.string),title:a.string,body:a.optional(a.string),draft:a.optional(a.boolean),reviewers:a.optional(a.array(a.string))}),a.shape({action:a.literals(["update"]),head:a.string,headSha:a.optional(a.string),base:a.string,baseSha:a.optional(a.string),title:a.optional(a.string),body:a.optional(a.string),prNumber:a.number,draft:a.optional(a.boolean),reviewers:a.optional(a.array(a.string))})])),webSubmitAnalytics:a.optional(a.shape({eligible:a.boolean,usedWebSubmit:a.boolean,prompted:a.boolean,suppressedPrompt:a.boolean,submitViaCliSetting:a.optional(a.boolean)}))},response:{prs:a.array(a.unionMany([a.shape({head:a.string,prNumber:a.number,prURL:a.string,status:a.literals(["updated","created"]),repoOwner:a.string,repoName:a.string}),a.shape({head:a.string,error:a.string,status:a.literals(["error"])})]))}},pullRequestInfo__DEPRECATED:{method:"POST",url:"/graphite/pull-requests",params:u,response:{prs:a.array(t.pullRequestInfoShape)}},pullRequestInfo:{method:"POST",url:"/graphite/cli/pull-request-info",params:u,response:{result:a.taggedUnion("status",{ok:{status:a.literal("ok"),prs:a.array(t.pullRequestInfoShape)},error:{status:a.literal("error"),message:a.string}})}},mergeabilityStatus:{method:"POST",url:"/graphite/mergeability-status",params:{repoOwner:a.string,repoName:a.string,prNumbers:a.array(a.number)},response:{mergeabilityStatuses:a.array(a.shape({prNumber:a.number,mergeabilityStatus:a.literals(s.PrMetastatuses)}))}},merge:{method:"POST",url:"/graphite/merge",params:{repoOwner:a.string,repoName:a.string,trunkBranchName:a.string,prNumbers:a.array(a.number)}},getRepoMessage:{method:"GET",url:"/graphite/cli-repo-message",queryParams:{org:a.string,repo:a.string},response:{message:a.nullable(a.shape({text:a.string,status:a.literals(["warning","info","error"])}))}},getSectionsSummary:{method:"GET",url:"/graphite/sections-summary",queryParams:{first:a.string},headers:{"User-Agent":a.string},response:{sections:a.array(a.shape({name:a.string,sectionId:a.string,includeInTotalCount:a.boolean,totalUnpaginatedPrs:a.number,prs:a.array(a.shape({number:a.number,title:a.string,state:a.literals(["OPEN","CLOSED","MERGED"]),createdAt:a.string,updatedAt:a.string,repo:a.shape({name:a.string,owner:a.string}),author:a.nullable(a.shape({name:a.nullable(a.string),login:a.string,avatarUrl:a.string})),reviewDecision:a.literals(["CHANGES_REQUESTED","APPROVED","REVIEW_REQUIRED"])}))}))}},checkAuth:{method:"POST",url:"/graphite/check-auth",params:{repoOwner:a.optional(a.string),repoName:a.optional(a.string)},response:{githubLogin:a.optional(a.string),canSubmitPrs:a.optional(a.boolean)}},checkIsRepoSynced:{method:"GET",url:"/graphite/cli/is-repo-synced",queryParams:{repoOwner:a.string,repoName:a.string},response:{result:a.unionMany([a.shape({status:a.literals(["SYNCED","NOT_SYNCED_ADDABLE"])}),a.shape({status:a.literals(["NOT_SYNCED_UNADDABLE"]),message:a.string})])}},addSyncedRepo:{method:"POST",url:"/graphite/cli/add-synced-repo",params:{repoOwner:a.string,repoName:a.string},response:{err:a.optional(a.string)}}}},9164:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeGit=void 0;const i=n(34490),o=n(1284),s=n(49690),a=n(42548),u=n(22917),c=n(51674),l=n(66809),d=n(45960),h=n(67397),f=n(31176),m=n(50279),p=n(26055),g=n(16681),v=n(68012),y=n(55044),b=n(83002),E=n(71852),_=n(64645),w=n(13729),C=n(61093),R=n(14397),O=n(87803),S=n(27373),P=n(42178),A=n(37385),T=n(73777),M=n(2250),D=n(42517),N=n(71735),I=n(5755),k=n(60770),j=n(22925),x=n(58468),F=n(52282),G=n(19963),H=n(19109),B=n(75122),L=n(64568),U=n(70081),q=n(93333);t.composeGit=function({cwd:e,debug:t,quiet:n}){return r(this,void 0,void 0,(function*(){const r=(0,q.composeGitRunner)({cwd:e,debug:t}),[$,W]=yield Promise.all([(0,x.getRepoPaths)({runner:r}),(0,w.getGitVersion)({runner:r})]),V=(0,m.composeGitConfig)(r);return $?Object.assign(Object.assign(Object.assign({gitVersion:W,repo:!0,config:V},$),(0,_.composeGetRemoteSha)(r)),{addAll:(0,i.bindWithEmptyObject)((0,i.bind)(s.addAll,{runner:r})),addUpdates:(0,i.bindWithEmptyObject)((0,i.bind)(s.addUpdates,{runner:r})),addPatch:(0,i.bindWithEmptyObject)((0,i.bind)(s.addPatch,{runner:r})),findUntrackedFiles:(0,i.bindWithEmptyObject)((0,i.bind)(U.findUntrackedFiles,{runner:r})),trackFiles:(0,i.bind)(U.trackFiles,{runner:r}),trackAllNewFiles:(0,i.bindWithEmptyObject)((0,i.bind)(U.trackAllNewFiles,{runner:r})),getCommitAuthor:(0,i.bind)(d.getCommitAuthor,{runner:r}),getCommitDate:(0,i.bind)(d.getCommitDate,{runner:r}),getFilesChanged:(0,i.bind)(y.getFilesChanged,{runner:r}),getStatus:(0,i.bindWithEmptyObject)((0,i.bind)(L.getStatus,{runner:r})),getCurrentBranchName:(0,i.bindWithEmptyObject)((0,i.bind)(a.getCurrentBranchName,{runner:r})),getPreviousBranchName:(0,i.bindWithEmptyObject)((0,i.bind)(a.getPreviousBranchName,{runner:r})),moveBranch:(0,i.bind)(a.moveBranch,{runner:r}),deleteBranch:(0,i.bind)(a.deleteBranch,{runner:r}),switchBranch:(0,i.bind)(a.switchBranch,{runner:r}),getDiff:(0,i.bind)(p.getDiff,{runner:r}),getDiffOfStagedChanges:(0,i.bindWithEmptyObject)((0,i.bind)(p.getDiffOfStagedChanges,{runner:r})),forceCheckoutNewBranch:(0,i.bind)(a.forceCheckoutNewBranch,{runner:r}),forceCreateBranch:(0,i.bind)(a.forceCreateBranch,{runner:r}),getNumberOfCommitsInRange:(0,i.bind)(h.getNumberOfCommitsInRange,{runner:r}),getFormattedCommitOrRange:(0,i.bind)(h.getFormattedCommitOrRange,{runner:r}),getCommitTree:(0,i.bind)(f.getCommitTree,{runner:r}),commit:(0,i.bind)(l.commit,{quiet:n,runner:r}),revert:(0,i.bind)(l.revert,{quiet:n,runner:r}),detectStagedChanges:(0,i.bindWithEmptyObject)((0,i.bind)(L.detectStagedChanges,{runner:r})),getUnstagedChanges:(0,i.bindWithEmptyObject)((0,i.bind)(p.getUnstagedChanges,{runner:r})),showDiff:(0,i.bind)(p.showDiff,{runner:r}),isDiffEmpty:(0,i.bind)(p.isDiffEmpty,{runner:r}),fetchBranches:(0,i.bind)(g.fetchBranches,{runner:r}),readFetchHead:(0,i.bind)(g.readFetchHead,{runner:r}),findRemoteHeadBranch:(0,i.bind)(b.findRemoteHeadBranch,{runner:r}),getShaOrThrow:(0,i.bind)(_.getShaOrThrow,{runner:r}),getSha:(0,i.bind)(_.getSha,{runner:r}),detectUntrackedChanges:(0,i.bindWithEmptyObject)((0,i.bind)(L.detectUntrackedChanges,{runner:r})),trackedUnstagedChanges:(0,i.bindWithEmptyObject)((0,i.bind)(L.trackedUnstagedChanges,{runner:r})),isMerged:(0,i.bind)(C.isMerged,{runner:r}),logLong:(0,i.bindWithEmptyObject)((0,i.bind)(R.logLong,{runner:r})),getMergeBase:(0,i.bind)(O.getMergeBase,{runner:r}),isAncestor:(0,i.bind)(O.isAncestor,{runner:r}),getUnmergedFiles:(0,i.bindWithEmptyObject)((0,i.bind)(L.getUnmergedFiles,{runner:r})),getRebaseHead:(0,i.bindWithEmptyObject)((0,i.bind)(S.getRebaseHead,{gitDir:$.gitDir})),pruneRemote:(0,i.bind)(A.pruneRemote,{runner:r}),getRemoteUrl:(0,i.bind)(j.getRemoteUrl,{runner:r}),showCommits:(0,i.bind)(H.showCommits,{runner:r}),getFileContents:(0,i.bind)(v.getFileContents,{runner:r}),fetchRemoteTrackingBranch:(0,i.bind)(T.fetchRemoteTrackingBranch,{runner:r}),fastForwardBranchToRemoteTracking:(0,i.bind)(T.fastForwardBranchToRemoteTracking,{runner:r}),pushBranch:(0,i.bind)(M.pushBranch,{runner:r,gitConfig:V,gitCommonDir:$.gitCommonDir,repoRoot:$.repoRoot}),getHookExecutablePath:(0,i.bind)(E.getHookExecutablePath,{gitConfig:V,gitCommonDir:$.gitCommonDir,repoRoot:$.repoRoot}),getCleanlyReconciledSquashedHead:(0,i.bind)(k.getCleanlyReconciledSquashedHead,{runner:r,gitConfig:V}),rebaseInProgress:(0,i.bindWithEmptyObject)((0,i.bind)(I.rebaseInProgress,{gitDir:$.gitDir})),cleanRebase:(0,i.bind)(c.cleanRebase,{runner:r,gitConfig:V}),rebase:(0,i.bind)(N.rebase,{gitDir:$.gitDir,runner:r}),rebaseContinue:(0,i.bindWithEmptyObject)((0,i.bind)(N.rebaseContinue,{gitDir:$.gitDir,runner:r})),rebaseAbort:(0,i.bindWithEmptyObject)((0,i.bind)(N.rebaseAbort,{runner:r})),rebaseInteractive:(0,i.bind)(N.rebaseInteractive,{gitDir:$.gitDir,runner:r}),softReset:(0,i.bind)(F.softReset,{runner:r}),mixedReset:(0,i.bind)(F.mixedReset,{runner:r}),keepReset:(0,i.bind)(F.keepReset,{runner:r}),trackedReset:(0,i.bind)(F.trackedReset,{runner:r}),setRemoteTracking:(0,i.bind)(G.setRemoteTracking,{runner:r}),getBranchNamesAndRevisions:(0,i.bindWithEmptyObject)((0,i.bind)(B.getBranchNamesAndRevisions,{runner:r})),clean:(0,i.bindWithEmptyObject)((0,i.bind)(u.clean,{runner:r})),createNewObject:(0,i.bind)(P.createNewObject,{runner:r}),updateRef:(0,i.bind)(P.updateRef,{runner:r}),readRef:(0,i.bind)(P.readRef,{runner:r}),doesObjectExist:(0,i.bind)(P.doesObjectExist,{runner:r}),deleteRef:(0,i.bind)(P.deleteRef,{runner:r}),getShaForEachRefWithPrefix:(0,i.bind)(P.getShaForEachRefWithPrefix,{runner:r}),commitRangesAreEquivalent:(0,i.bind)(D.commitRangesAreEquivalent,{runner:r}),getBranchesInCommitRange:(0,i.bind)(h.getBranchesInCommitRange,{runner:r}),absorbPatchesIntoCommitStack:(0,i.bind)(o.absorbPatchesIntoCommitStack,{repoRoot:$.repoRoot,gitCommonDir:$.gitCommonDir,runner:r,gitConfig:V}),refreshIndex:(0,i.bindWithEmptyObject)((0,i.bind)(L.refreshIndex,{runner:r}))}):{gitVersion:W,repo:!1,config:V}}))}},1284:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.absorbPatchesIntoCommitStack=void 0;const o=i(n(32856)),s=i(n(71017)),a=n(67397),u=n(64645),c=n(70341);function l({sha:e,patch:t,runner:n,repoRoot:i,gitCommonDir:a}){return r(this,void 0,void 0,(function*(){const r=s.default.join(a,`.gt-${process.pid}-${Date.now()}.index`);yield(0,c.readTreeIntoIndexFile)({treeish:e,indexFile:r,runner:n,repoRoot:i}),yield(0,c.applyPatchToIndexFile)({patch:t,indexFile:r,runner:n,repoRoot:i});const u=yield(0,c.writeTreeFromIndexFile)({indexFile:r,runner:n,repoRoot:i});return o.default.rmSync(r),u}))}t.absorbPatchesIntoCommitStack=function({shas:e,patches:t,runner:n,restackCommitterDateIsAuthorDate:i,gitConfig:o,gitCommonDir:s,repoRoot:c}){return r(this,void 0,void 0,(function*(){const r=yield o("commit.gpgSign"),d=r&&"false"!==r&&"0"!==r,h=[];let f=yield(0,u.getSha)({runner:n,ref:`${e[0]}~`}),m=!1;for(let r=0;r<t.length;r++){const o=e[r],u=t[r];if(!m&&null===u){h.push(o),f=o;continue}m=!0;const p=(0,a.getRebaseMetadataForCommit)({runner:n,sha:o}),g=null===u?`${o}^{tree}`:yield l({gitCommonDir:s,repoRoot:c,sha:o,patch:u,runner:n}),{message:v,authorDate:y,authorEmail:b,authorName:E}=yield p,_=yield n.runGitCommand({args:["commit-tree",g,"-p",f,"-m",v,...d?["-S"]:[]],onError:"throw",resource:"absorbPatchesIntoCommitStackCommitTree",options:{env:Object.assign(Object.assign(Object.assign({},process.env),{GIT_AUTHOR_NAME:E,GIT_AUTHOR_EMAIL:b,GIT_AUTHOR_DATE:y}),i&&{GIT_COMMITTER_DATE:y})},cwd:c});h.push(_),f=_}return h}))}},49690:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.addPatch=t.addUpdates=t.addAll=void 0,t.addAll=function({runner:e}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["add","--all"],onError:"throw",resource:"addAll"})}))},t.addUpdates=function({runner:e}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["add","--update"],onError:"throw",resource:"addUpdates"})}))},t.addPatch=function({runner:e}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["add","--patch"],options:{stdio:"inherit"},onError:"throw",resource:"addPatch"})}))}},42548:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.forceCreateBranch=t.forceCheckoutNewBranch=t.switchBranch=t.deleteBranch=t.moveBranch=t.getPreviousBranchName=t.getCurrentBranchName=void 0,t.getCurrentBranchName=function({runner:e}){return n(this,void 0,void 0,(function*(){const t=yield e.runGitCommand({args:["branch","--show-current"],onError:"ignore",resource:"getCurrentBranchName"});return t.length>0?t:void 0}))},t.getPreviousBranchName=function({runner:e}){return n(this,void 0,void 0,(function*(){const t=yield e.runGitCommand({args:["rev-parse","--symbolic-full-name","--abbrev-ref=loose","@{-1}"],onError:"ignore",resource:"getPreviousBranchName"});return t.length>0?t:void 0}))},t.moveBranch=function({runner:e,newName:t}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["branch","-m",t],options:{stdio:"pipe"},onError:"throw",resource:"moveBranch"})}))},t.deleteBranch=function({runner:e,branchName:t}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["branch","-D",t],options:{stdio:"pipe"},onError:"throw",resource:"deleteBranch"})}))},t.switchBranch=function({branch:e,newBranch:t,detach:r,force:i,runner:o}){return n(this,void 0,void 0,(function*(){yield o.runGitCommand({args:["switch","-q",...r?["-d"]:[],...i?["-f"]:[],...t?["-c"]:[],e],options:{stdio:"inherit"},onError:"throw",resource:"switchBranch"})}))},t.forceCheckoutNewBranch=function({branchName:e,sha:t,runner:r}){return n(this,void 0,void 0,(function*(){yield r.runGitCommand({args:["switch","-q","-C",e,t],options:{stdio:"inherit"},onError:"throw",resource:"forceCheckoutNewBranch"})}))},t.forceCreateBranch=function({branchName:e,sha:t,runner:r}){return n(this,void 0,void 0,(function*(){yield r.runGitCommand({args:["branch","-f",e,t],options:{stdio:"pipe"},onError:"throw",resource:"forceCreateBranch"})}))}},22917:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.clean=void 0,t.clean=function({runner:e}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["clean","--force"],options:{stdio:"ignore"},onError:"throw",resource:"clean"})}))}},51674:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.cleanRebase=void 0;const i=n(93333),o=n(67397);t.cleanRebase=function({onto:e,from:t,head:n,restackCommitterDateIsAuthorDate:s,runner:a,gitConfig:u}){var c,l;return r(this,void 0,void 0,(function*(){const d=yield u("commit.gpgSign"),h=d&&"false"!==d&&"0"!==d;return null!==(l=null===(c=yield(yield(0,o.getFormattedCommitOrRange)({base:t,head:n,format:"SHA",runner:a})).reverse().map((e=>({sha:e,metadataPromise:(0,o.getRebaseMetadataForCommit)({runner:a,sha:e})}))).reduce(((e,{sha:t,metadataPromise:n})=>r(this,void 0,void 0,(function*(){const[r,{message:o,authorDate:u,authorEmail:c,authorName:l}]=yield Promise.all([e,n]);if(!r)return null;const d=r.tree,f=yield a.runGitCommand({args:["commit-tree",d,"-p",`${t}~`,"-m","_"],onError:"throw",resource:"cleanRebaseOntoCommitTree"}),m=yield a.runGitCommand({args:["merge-tree",f,t],onError:"throw",resource:"cleanRebaseMergeTree"}).catch((e=>{if(e instanceof i.CommandFailedError&&1===e.exitCode)return null;throw e}));return m?m==d?r:{tree:m,commitPromise:a.runGitCommand({args:["commit-tree",m,"-p",yield r.commitPromise,"-m",o,...h?["-S"]:[]],options:{env:Object.assign(Object.assign(Object.assign({},process.env),{GIT_AUTHOR_NAME:l,GIT_AUTHOR_EMAIL:c,GIT_AUTHOR_DATE:u}),s&&{GIT_COMMITTER_DATE:u})},onError:"throw",resource:"cleanRebaseCommitTree"})}:null}))),Promise.resolve({commitPromise:Promise.resolve(e),tree:`${e}^{tree}`})))||void 0===c?void 0:c.commitPromise)&&void 0!==l?l:null}))}},66809:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.revert=t.commit=void 0,t.commit=function({amend:e,message:t,noEdit:r,edit:i,patch:o,quiet:s,noVerify:a,runner:u}){return n(this,void 0,void 0,(function*(){yield u.runGitCommand({args:["commit",...e?["--amend"]:[],...t?["-m",t]:[],...r?["--no-edit"]:[],...i?["-e"]:[],...o?["-p"]:[],...a?["-n"]:[],...s?["-q"]:[]],options:{stdio:"inherit"},onError:"throw",resource:"commit"})}))},t.revert=function({runner:e,sha:t,edit:r,quiet:i}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["revert",t,...i?["-q"]:[],...r?[]:["--no-edit"]],options:{stdio:"inherit"},onError:"throw",resource:"revert"})}))}},45960:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getCommitDate=t.getCommitAuthor=void 0,t.getCommitAuthor=function({ref:e,runner:t}){return t.runGitCommand({args:["log","--format=%an","-n","1",e,"--"],onError:"throw",resource:"commitInfoAuthor"})},t.getCommitDate=function({ref:e,runner:t}){return n(this,void 0,void 0,(function*(){const n=yield t.runGitCommand({args:["log","--format=%cd","-n","1",e,"--"],onError:"throw",resource:"commitInfoBody"});return new Date(n)}))}},67397:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getRebaseMetadataForCommit=t.getBranchesInCommitRange=t.getFormattedCommitOrRange=t.getNumberOfCommitsInRange=void 0;const o=i(n(62637));t.getNumberOfCommitsInRange=function({runner:e,base:t,head:n}){return r(this,void 0,void 0,(function*(){return Number(yield e.runGitCommand({args:["rev-list","--count",`${t}..${n}`,"--"],onError:"throw",resource:"getNumberOfCommitsInRange"}))}))};const s={READABLE:"%h - %s",SUBJECT:"%s",MESSAGE:"%B%n",REBASE_METADATA:"%aN%n%aE%n%aI%n%B",AUTHOR_METADATA:"%aN%n%aE%n%aI",COMMITTER_DATE_RELATIVE:"%cr",SHA:"%H",AUTHOR_NAME:"%aN",COMMITTER_DATE:"%cI"};function a({runner:e,base:t,head:n,format:i}){return r(this,void 0,void 0,(function*(){if(!t)return[yield e.runGitCommand({args:["--no-pager","log","-1",`--pretty=format:${s[i]}`,n,"--"],onError:"throw",resource:"getCommitRangeFormatted"})];const r=yield e.runGitCommandAndSplitLines({args:["--no-pager","log","--pretty=format:%H",`${t}..${n}`,"--"],onError:"throw",resource:"getCommitRangeHashes"}),a=[];for(const t of o.default.chunk(r,500)){const n=yield Promise.all(t.map((t=>"SHA"===i?t:e.runGitCommand({args:["--no-pager","log","-1",`--pretty=format:${s[i]}`,t,"--"],onError:"throw",resource:"getCommitRangeFormatted"}))));a.push(...n)}return a}))}t.getFormattedCommitOrRange=a,t.getBranchesInCommitRange=function({runner:e,base:t,head:n}){return r(this,void 0,void 0,(function*(){return(yield e.runGitCommandAndSplitLines({args:["--no-pager","log","--pretty=%D",`${t}..${n}`,"--"],onError:"throw",resource:"getBranchesInCommitRange"})).map((e=>e.split(", "))).flat().map((e=>e.replace("HEAD -> ",""))).filter(Boolean)}))},t.getRebaseMetadataForCommit=function({runner:e,sha:t}){return r(this,void 0,void 0,(function*(){return a({runner:e,base:void 0,head:t,format:"REBASE_METADATA"}).then((([e])=>e.split("\n"))).then((([e,t,n,...r])=>({authorName:e,authorEmail:t,authorDate:n,message:r.join("\n")})))}))}},31176:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getCommitTree=void 0;const i=n(64645);t.getCommitTree=function({runner:e,branchNames:t}){return r(this,void 0,void 0,(function*(){const n=yield(0,i.getSha)({runner:e,ref:`${yield e.runGitCommand({args:["merge-base","--octopus",...t],onError:"ignore",resource:"parentOfMergeBase"})}~`}),r={};return(yield e.runGitCommandAndSplitLines({args:["rev-list","--parents",...n?[`^${n}`,...t]:["--all"],"--"],onError:"throw",resource:"getCommitTree"})).map((e=>e.split(" "))).forEach((e=>r[e[0]]=e.slice(1))),r}))}},50279:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeGitConfig=void 0,t.composeGitConfig=e=>{const t=new Map;return r=>n(void 0,void 0,void 0,(function*(){const i=t.get(r);if(void 0!==i)return i;const o=yield function({runner:e,key:t}){return n(this,void 0,void 0,(function*(){return(yield e.runGitCommand({args:["config","--get",t],onError:"ignore",resource:"inferRepoGitHubInfo"}))||null}))}({runner:e,key:r});return t.set(r,o),o}))}},26055:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getDiffOfStagedChanges=t.getDiff=t.isDiffEmpty=t.showDiff=t.getUnstagedChanges=void 0,t.getUnstagedChanges=function({runner:e}){return n(this,void 0,void 0,(function*(){return e.runGitCommand({args:["-c","color.ui=always","--no-pager","diff","--no-ext-diff","--stat"],onError:"throw",resource:"getUnstagedChanges"})}))},t.showDiff=function({runner:e,left:t,right:n,stat:r}){return e.runGitCommand({args:["-c","color.ui=always","--no-pager","diff","--no-ext-diff",t,n,...r?["--stat"]:[],"--"],onError:"throw",resource:"showDiff"})},t.isDiffEmpty=function({runner:e,left:t,right:r}){return n(this,void 0,void 0,(function*(){return 0===(yield e.runGitCommand({args:["--no-pager","diff","--no-ext-diff","--shortstat",t,r,"--"],onError:"throw",resource:"isDiffEmpty"})).length}))};const r=["--no-pager","-c","diff.renames=true","diff","--no-ext-diff","--no-prefix","--unified"];t.getDiff=function({runner:e,left:t,right:n}){return e.runGitCommand({args:[...r,t,...n?[n]:[],"--"],noTrim:!0,onError:"throw",resource:"getDiff"})},t.getDiffOfStagedChanges=function({runner:e}){return e.runGitCommand({args:[...r,"--cached","--"],noTrim:!0,onError:"throw",resource:"getDiffOfStagedChanges"})}},16681:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.readFetchHead=t.fetchBranches=void 0;const i=n(64645),o=e=>`refs/gt-fetch-head/${e}`;t.fetchBranches=function({runner:e,remote:t,branchNames:n}){return r(this,void 0,void 0,(function*(){0!==n.length&&(yield e.runGitCommand({args:["fetch","--no-write-fetch-head","-f",t,...n.map((e=>`refs/heads/${e}:${o(e)}`))],options:{stdio:"pipe"},onError:"throw",resource:"fetchBranch"}))}))},t.readFetchHead=function({runner:e,branchName:t}){return r(this,void 0,void 0,(function*(){return(0,i.getShaOrThrow)({runner:e,ref:o(t)})}))}},68012:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getFileContents=void 0,t.getFileContents=function({runner:e,ref:t,file:r}){return n(this,void 0,void 0,(function*(){return e.runGitCommand({args:["show",`${t}:${r}`],onError:"throw",resource:"fileContents"})}))}},55044:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};function r(e){switch(e){case"A":return"added";case"C":return"copied";case"D":return"deleted";case"M":default:return"modified";case"R":return"renamed"}}Object.defineProperty(t,"__esModule",{value:!0}),t.getFilesChanged=void 0,t.getFilesChanged=function({runner:e,from:t,to:i}){return n(this,void 0,void 0,(function*(){const n=[],o=(yield e.runGitCommand({args:["diff","-z","--name-status",t,i],onError:"ignore",resource:"getFilesChanged"})).split("\0");for(let e=0;e<o.length-1;e){const t=r(o[e][0]);if("copied"===t||"renamed"===t){const r=o[e+1],i=o[e+2];n.push({path:i,status:t,from:r}),e+=3}else{const r=o[e+1];n.push({path:r,status:t,from:void 0}),e+=2}}return n}))}},83002:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.findRemoteHeadBranch=void 0,t.findRemoteHeadBranch=function({runner:e,remote:t}){return n(this,void 0,void 0,(function*(){const n=yield e.runGitCommand({args:["rev-parse","--abbrev-ref",`refs/remotes/${t}/HEAD`],onError:"ignore",resource:"findRemoteHeadBranch"});if(!n)return null;const r=`${t}/`;return n.startsWith(r)?n.slice(r.length):null}))}},71852:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getHookExecutablePath=void 0;const o=i(n(32856)),s=i(n(71017));t.getHookExecutablePath=function({hook:e,gitConfig:t,repoRoot:n,gitCommonDir:i}){return r(this,void 0,void 0,(function*(){const r=yield t("core.hooksPath"),a=r?s.default.join(n,r):s.default.join(i,"hooks"),u=s.default.join(a,e);return o.default.pathExistsSync(u)?u:null}))}},64645:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.composeGetRemoteSha=t.getSha=t.getShaOrThrow=void 0,t.getShaOrThrow=function({ref:e,runner:t}){return n(this,void 0,void 0,(function*(){return t.runGitCommand({args:["rev-parse",e],onError:"throw",resource:"getShaOrThrow"})}))},t.getSha=function({ref:e,runner:t}){return n(this,void 0,void 0,(function*(){return t.runGitCommand({args:["rev-parse",e],onError:"ignore",resource:"getSha"})}))},t.composeGetRemoteSha=function(e){let t;return{populateRemoteShas:r=>n(this,void 0,void 0,(function*(){t=yield function({remote:e,runner:t}){return n(this,void 0,void 0,(function*(){const n={};return(yield t.runGitCommandAndSplitLines({args:["ls-remote","--heads",e],onError:"ignore",resource:"fetchRemoteShas"})).map((e=>e.split(/\s+/))).filter((e=>2===e.length&&e.every((e=>e.length>0))&&e[1].startsWith("refs/heads/"))).forEach((([e,t])=>n[t.slice(11)]=e)),n}))}({remote:r,runner:e})})),getRemoteSha:e=>null==t?void 0:t[e]}}},13729:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getGitVersion=void 0,t.getGitVersion=function({runner:e}){return n(this,void 0,void 0,(function*(){return(yield e.runGitCommand({args:["--version"],onError:"throw",resource:"getGitVersion"})).split(" ")[2]}))}},70341:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.writeTreeFromIndexFile=t.applyPatchToIndexFile=t.readTreeIntoIndexFile=void 0,t.readTreeIntoIndexFile=function({treeish:e,indexFile:t,runner:r,repoRoot:i}){return n(this,void 0,void 0,(function*(){yield r.runGitCommand({args:["read-tree","--index-output",t,e],cwd:i,onError:"throw",resource:"readTreeIntoIndexFile"})}))},t.applyPatchToIndexFile=function({patch:e,runner:t,indexFile:r,repoRoot:i}){return n(this,void 0,void 0,(function*(){yield t.runGitCommand({args:["apply","--verbose","--cached","-p0","--unidiff-zero","-"],input:e,options:{env:Object.assign(Object.assign({},process.env),{GIT_INDEX_FILE:r})},cwd:i,onError:"throw",resource:"applyPatchToIndexFile"})}))},t.writeTreeFromIndexFile=function({indexFile:e,runner:t,repoRoot:r}){return n(this,void 0,void 0,(function*(){return t.runGitCommand({args:["write-tree"],options:{env:Object.assign(Object.assign({},process.env),{GIT_INDEX_FILE:e})},cwd:r,onError:"throw",resource:"writeTreeFromIndexFile"})}))}},61093:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isMerged=void 0;const i=n(67397),o=n(64645),s=n(87803);t.isMerged=function({branchName:e,trunkName:t,runner:n}){return r(this,void 0,void 0,(function*(){const a=(0,s.getMergeBase)({runner:n,left:e,right:t}),u=(yield(0,i.getFormattedCommitOrRange)({base:t,head:e,format:"SHA",runner:n})).reverse();return(yield u.reduce(((e,i)=>r(this,void 0,void 0,(function*(){const r=yield e,o=yield n.runGitCommand({args:["commit-tree",`${i}^{tree}`,"-p",r,"-m","_"],onError:"ignore",resource:"mergeBaseCommitTree"});return(yield n.runGitCommand({args:["cherry",t,o,r],onError:"ignore",resource:"isMerged"})).startsWith("-")?i:r}))),Promise.resolve(a)))===(yield(0,o.getSha)({runner:n,ref:e}))}))}},14397:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.logLong=void 0,t.logLong=function({runner:e}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["log","--graph","--abbrev-commit","--decorate","--format=format:%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)","--branches"],options:{stdio:"inherit"},onError:"throw",resource:"logLong"})}))}},87803:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isAncestor=t.getMergeBase=void 0;const i=n(93333);t.getMergeBase=function({runner:e,left:t,right:n}){return e.runGitCommand({args:["merge-base",t,n],onError:"throw",resource:"getMergeBase"})},t.isAncestor=function({runner:e,left:t,right:n}){return r(this,void 0,void 0,(function*(){try{return yield e.runGitCommand({args:["merge-base","--is-ancestor",t,n],onError:"throw",resource:"getMergeBase"}),!0}catch(e){if(e instanceof i.CommandFailedError&&1===e.exitCode)return!1;throw e}}))}},27373:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getRebaseHead=void 0;const o=i(n(32856)),s=i(n(71017));t.getRebaseHead=function({gitDir:e}){return r(this,void 0,void 0,(function*(){const t=s.default.join(`${e}`,"rebase-merge","head-name");if(yield o.default.pathExists(t))return(yield o.default.readFile(t,{encoding:"utf-8"})).trim().slice(11)}))}},42178:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};function r({ref:e,runner:t}){return n(this,void 0,void 0,(function*(){return t.runGitCommand({args:["cat-file","-p",e],onError:"throw",resource:"readRef"})}))}Object.defineProperty(t,"__esModule",{value:!0}),t.getShaForEachRefWithPrefix=t.deleteRef=t.readRef=t.doesObjectExist=t.updateRef=t.createNewObject=void 0,t.createNewObject=function({content:e,runner:t}){return t.runGitCommand({args:["hash-object","-w","--stdin"],input:e,onError:"throw",resource:"createNewObject"})},t.updateRef=function({ref:e,sha:t,runner:r}){return n(this,void 0,void 0,(function*(){yield r.runGitCommand({args:["update-ref",e,t],options:{stdio:"pipe"},onError:"throw",resource:"updateRef"})}))},t.doesObjectExist=function({ref:e,runner:t}){return n(this,void 0,void 0,(function*(){try{return yield r({ref:e,runner:t}),!0}catch(e){return!1}}))},t.readRef=r,t.deleteRef=function({ref:e,runner:t}){return n(this,void 0,void 0,(function*(){yield t.runGitCommand({args:["update-ref","-d",e],onError:"throw",resource:"deleteRef"})}))},t.getShaForEachRefWithPrefix=function({runner:e,prefix:t}){return n(this,void 0,void 0,(function*(){const n={};return(yield e.runGitCommandAndSplitLines({args:["for-each-ref","--format=%(refname):%(objectname)",t],onError:"throw",resource:"getShaForEachRefWithPrefix"})).map((e=>e.split(":"))).filter((e=>2===e.length)).forEach((([e,r])=>n[e.substring(t.length)]=r)),n}))}},37385:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.pruneRemote=void 0,t.pruneRemote=function({runner:e,remote:t}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["remote","prune",t],onError:"ignore",resource:"pruneRemote"})}))}},73777:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.fastForwardBranchToRemoteTracking=t.fetchRemoteTrackingBranch=void 0;const i=n(93333);t.fetchRemoteTrackingBranch=function({runner:e,remote:t,branchName:n}){return r(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["fetch",t,n],onError:"throw",resource:"fetchRemoteTrackingBranch"})}))},t.fastForwardBranchToRemoteTracking=function({runner:e,remote:t,branchName:n}){return r(this,void 0,void 0,(function*(){try{return yield e.runGitCommand({args:["merge","--ff-only",`${t}/${n}`],onError:"throw",resource:"fastForwardBranchToRemoteTracking"}),"OK"}catch(e){if(e instanceof i.CommandFailedError&&e.message.includes("fatal: Not possible to fast-forward, aborting."))return"CONFLICT";throw e}}))}},2250:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.pushBranch=void 0;const i=n(32081),o=n(71852),s=n(22925);t.pushBranch=function({remote:e,branchName:t,noVerify:n,forcePush:a,runner:u,gitConfig:c,gitCommonDir:l,repoRoot:d,prePushHookInput:h}){return r(this,void 0,void 0,(function*(){!n&&h&&(yield function({runner:e,gitConfig:t,remote:n,repoRoot:a,gitCommonDir:u,branchName:c,localSha:l,remoteSha:d}){return r(this,void 0,void 0,(function*(){const r=yield(0,o.getHookExecutablePath)({hook:"pre-push",gitConfig:t,repoRoot:a,gitCommonDir:u});if(!r)return;const h=yield(0,s.getRemoteUrl)({runner:e,remote:n}),f=`refs/heads/${c}`,m=`${f} ${l} ${f} ${d||"0000000000000000000000000000000000000000"}\n`;try{(0,i.execSync)(`(cd ${a} ; '${r}' ${n} ${h})`,{stdio:["pipe","inherit","inherit"],input:m,encoding:"utf-8"})}catch(e){throw new Error(`pre-push git hook failed while pushing branch ${c}`)}}))}(Object.assign(Object.assign({runner:u,remote:e,gitConfig:c,gitCommonDir:l,repoRoot:d},h),{branchName:t})));const f=a?"--force":"--force-with-lease";yield u.runGitCommand({args:["push","-u",e,f,t,"--no-verify"],onError:"throw",resource:"pushBranch"})}))}},42517:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.commitRangesAreEquivalent=void 0,t.commitRangesAreEquivalent=function({runner:e,base1:t,head1:r,base2:i,head2:o,remote:s}){return n(this,void 0,void 0,(function*(){if(t===r||i===o)return t===r&&i===o;const a=(yield Promise.all([t,r,i,o].map((t=>n(this,void 0,void 0,(function*(){try{return yield e.runGitCommand({args:["show",t,"--"],onError:"throw",resource:"rangeDiffShow"}),{sha:t,toFetch:!1}}catch(e){return{sha:t,toFetch:!0}}})))))).filter((({toFetch:e})=>e)).map((({sha:e})=>e));a.length>0&&(yield e.runGitCommand({args:["fetch","--no-write-fetch-head",s,...a],onError:"throw",resource:"rangeDiffFetch"}));const u=`${t}..${r}`,c=`${i}..${o}`,l=yield e.runGitCommandAndSplitLines({args:["range-diff",u,c],onError:"throw",resource:"rangeDiff"});for(const e of l){const t=e.trim().split(/\s+/);if(t.length<3)return!1;if("="!==t[2])return!1}return!0}))}},71735:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.rebaseInteractive=t.rebaseAbort=t.rebaseContinue=t.rebase=void 0;const i=n(93333),o=n(5755);function s({runner:e}){return r(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["rebase","--abort"],options:{stdio:"pipe"},onError:"throw",resource:"rebaseAbort"})}))}function a({args:e,options:t,resource:n,runner:u,gitDir:c}){return r(this,void 0,void 0,(function*(){try{yield u.runGitCommand({args:["rebase",...e],options:Object.assign({stdio:"pipe"},t),onError:"throw",resource:n})}catch(r){if(r instanceof i.CommandFailedError&&r.message.includes("It seems that there is already a rebase-merge directory")){try{yield s({runner:u})}catch(e){throw r}return a({runner:u,args:e,options:t,resource:n,gitDir:c})}if(yield(0,o.rebaseInProgress)({gitDir:c}))return"REBASE_CONFLICT";throw r}return"REBASE_DONE"}))}t.rebase=function({onto:e,from:t,branchName:n,restackCommitterDateIsAuthorDate:i,runner:o,gitDir:s}){return r(this,void 0,void 0,(function*(){return a({runner:o,args:[...i?["--committer-date-is-author-date"]:[],"--onto",e,t,n],resource:"rebase",gitDir:s})}))},t.rebaseContinue=function({runner:e,gitDir:t}){return r(this,void 0,void 0,(function*(){return a({runner:e,args:["--continue"],options:{env:Object.assign(Object.assign({},process.env),{GIT_EDITOR:"true"})},resource:"rebaseContinue",gitDir:t})}))},t.rebaseAbort=s,t.rebaseInteractive=function({runner:e,parentBranchRevision:t,branchName:n,gitDir:i}){return r(this,void 0,void 0,(function*(){return a({runner:e,args:["-i",t,n],resource:"rebaseInteractive",options:{stdio:"inherit"},gitDir:i})}))}},5755:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.rebaseInProgress=void 0;const o=i(n(32856)),s=i(n(71017));t.rebaseInProgress=function({gitDir:e}){return r(this,void 0,void 0,(function*(){return o.default.pathExists(s.default.join(e,"rebase-merge"))}))}},60770:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getCleanlyReconciledSquashedHead=void 0;const i=n(93333),o=n(67397);function s({onto:e,from:t,head:n,runner:o}){return r(this,void 0,void 0,(function*(){const r=yield o.runGitCommand({args:["commit-tree",`${e}^{tree}`,"-p",t,"-m","_"],onError:"throw",resource:"getRebasedTreeOntoCommitTree"});return o.runGitCommand({args:["merge-tree",r,n],onError:"throw",resource:"getRebasedTreeMergeTree"}).catch((e=>{if(e instanceof i.CommandFailedError&&1===e.exitCode)return null;throw e}))}))}t.getCleanlyReconciledSquashedHead=function({oldBase:e,oldHead:t,newBase:n,newHead:a,updatedBase:u,updatedHead:c,restackCommitterDateIsAuthorDate:l,runner:d,gitConfig:h}){return r(this,void 0,void 0,(function*(){const r=yield h("commit.gpgSign"),f=r&&"false"!==r&&"0"!==r,m=yield s({runner:d,onto:n,from:e,head:t});if(null===m)return null;const p=yield s({runner:d,onto:n,from:u,head:c});if(null===p)return null;const g=yield d.runGitCommand({args:["commit-tree",m,"-p",n,"-m","_"],onError:"throw",resource:"getCleanlyReconciledSquashedHeadOldTreeCommit"}),v=yield d.runGitCommand({args:["commit-tree",p,"-p",g,"-m","_"],onError:"throw",resource:"getCleanlyReconciledSquashedHeadUpdatedTreeCommit"}),y=yield d.runGitCommand({args:["commit-tree",`${a}^{tree}`,"-p",g,"-m","_"],onError:"throw",resource:"getCleanlyReconciledSquashedHeadNewHeadCommit"}),b=yield d.runGitCommand({args:["merge-tree",y,v],onError:"throw",resource:"getCleanlyReconciledSquashedHeadMergeTree"}).catch((e=>{if(e instanceof i.CommandFailedError&&1===e.exitCode)return null;throw e}));if(null===b)return null;const E=(yield(0,o.getFormattedCommitOrRange)({format:"SHA",runner:d,head:a,base:n})).at(-1);if(!E)return null;const{authorName:_,authorEmail:w,authorDate:C,message:R}=yield(0,o.getRebaseMetadataForCommit)({runner:d,sha:E});return d.runGitCommand({args:["commit-tree",b,"-p",n,"-m",R,...f?["-S"]:[]],onError:"throw",resource:"getCleanlyReconciledSquashedHeadCommitTree",options:{env:Object.assign(Object.assign(Object.assign({},process.env),{GIT_AUTHOR_NAME:_,GIT_AUTHOR_EMAIL:w,GIT_AUTHOR_DATE:C}),l&&{GIT_COMMITTER_DATE:C})}})}))}},22925:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getRemoteUrl=void 0,t.getRemoteUrl=function({runner:e,remote:t}){return n(this,void 0,void 0,(function*(){return e.runGitCommand({args:["remote","get-url",t,"--push"],onError:"throw",resource:"getRemoteUrl"})}))}},58468:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getRepoPaths=void 0,t.getRepoPaths=function({runner:e}){return n(this,void 0,void 0,(function*(){try{const[t,n,r]=yield e.runGitCommandAndSplitLines({args:["rev-parse","--path-format=absolute","--show-toplevel","--git-common-dir","--git-dir"],onError:"throw",resource:"getRepoPaths"});return{repoRoot:t,gitCommonDir:n,gitDir:r}}catch(e){return}}))}},52282:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.trackedReset=t.keepReset=t.mixedReset=t.softReset=void 0,t.softReset=function({sha:e,runner:t}){return n(this,void 0,void 0,(function*(){yield t.runGitCommand({args:["reset","-q","--soft",e,"--"],onError:"throw",resource:"softReset"})}))},t.mixedReset=function({sha:e,runner:t}){return n(this,void 0,void 0,(function*(){yield t.runGitCommand({args:["reset","-q","--mixed",...e?[e,"--"]:[]],onError:"throw",resource:"mixedReset"})}))},t.keepReset=function({sha:e,runner:t}){return n(this,void 0,void 0,(function*(){yield t.runGitCommand({args:["reset","-q","--keep",e,"--"],onError:"throw",resource:"keepReset"})}))},t.trackedReset=function({sha:e,runner:t}){return n(this,void 0,void 0,(function*(){yield t.runGitCommand({args:["reset","-Nq",e,"--"],onError:"throw",resource:"trackedReset"})}))}},19963:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.setRemoteTracking=void 0,t.setRemoteTracking=function({remote:e,branchName:t,sha:r,runner:i}){return n(this,void 0,void 0,(function*(){yield i.runGitCommand({args:["update-ref",`refs/remotes/${e}/${t}`,r],onError:"throw",resource:"setRemoteTracking"}),yield i.runGitCommand({args:["branch","-u",`${e}/${t}`,t],onError:"ignore",resource:"setRemoteTrackingUpstream"})}))}},19109:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.showCommits=void 0,t.showCommits=function({base:e,head:t,patch:r,runner:i}){return n(this,void 0,void 0,(function*(){return i.runGitCommand({args:["-c","color.ui=always","--no-pager","log",..."patch"===r?["-p"]:"stat"===r?["--stat"]:[],`${e}..${t}`,"--"],onError:"throw",resource:"showCommits"})}))}},75122:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getBranchNamesAndRevisions=void 0,t.getBranchNamesAndRevisions=function({runner:e}){return n(this,void 0,void 0,(function*(){const t={};return(yield e.runGitCommandAndSplitLines({args:["for-each-ref","--format=%(refname:short):%(objectname)","--sort=-committerdate","refs/heads/"],onError:"throw",resource:"getBranchNamesAndRevisions"})).map((e=>e.split(":"))).filter((e=>2===e.length&&e.every((e=>e.length>0)))).forEach((([e,n])=>t[e]=n)),t}))}},64568:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};function r({runner:e}){return n(this,void 0,void 0,(function*(){const t=yield e.runGitCommand({args:["--no-optional-locks","status","-z"],onError:"throw",resource:"getRawStatus",noTrim:!0}),n=t.split("\0"),r=[];for(let e=0;e<n.length-1;e++){const i=n[e],s=i[0],a=i[1];if(!o(s)||!o(a))throw new Error("Invalid status output:\n"+t);const u=i.slice(3),c=["R","C"].includes(s)||["R","C"].includes(a)?n[++e]:void 0;r.push({path:u,from:c,indexStatus:s,workingTreeStatus:a})}return r}))}Object.defineProperty(t,"__esModule",{value:!0}),t.getStatus=t.getUnmergedFiles=t.detectUntrackedChanges=t.trackedUnstagedChanges=t.detectStagedChanges=t.refreshIndex=void 0,t.refreshIndex=function({runner:e}){return n(this,void 0,void 0,(function*(){yield e.runGitCommand({args:["status"],onError:"ignore",resource:"refreshIndex"})}))},t.detectStagedChanges=function({runner:e}){return n(this,void 0,void 0,(function*(){return(yield r({runner:e})).some((({indexStatus:e,workingTreeStatus:t})=>["M","T","C","R"].includes(e)||["A","D"].includes(e)&&e!==t))}))},t.trackedUnstagedChanges=function({runner:e}){return n(this,void 0,void 0,(function*(){return(yield r({runner:e})).some((({indexStatus:e,workingTreeStatus:t})=>"U"===e||["U","M","T","A","D","C","R"].includes(t)))}))},t.detectUntrackedChanges=function({runner:e}){return n(this,void 0,void 0,(function*(){return(yield r({runner:e})).some((({indexStatus:e,workingTreeStatus:t})=>"?"===e||"?"===t))}))},t.getUnmergedFiles=function({runner:e}){return n(this,void 0,void 0,(function*(){return(yield r({runner:e})).filter((({indexStatus:e,workingTreeStatus:t})=>"U"===e||"U"===t||"A"===e&&"A"===t||"D"===e&&"D"===t)).map((({path:e})=>e))}))},t.getStatus=function({runner:e}){return n(this,void 0,void 0,(function*(){return(yield r({runner:e})).map((({indexStatus:e,workingTreeStatus:t,path:n,from:r})=>Object.assign(Object.assign({},function(e,t){if("A"===e&&"A"===t||"D"===e&&"D"===t||"U"===e||"U"===t)return{status:"unresolved",staged:"none"};if("?"===t)return{status:"added",staged:"none"};if(" "===e){if("M"===t||"T"===t)return{status:"modified",staged:"none"};if("D"===t)return{status:"deleted",staged:"none"};if("C"===t)return{status:"copied",staged:"none"};if("R"===t)return{status:"renamed",staged:"none"};if("A"===t)return{status:"added",staged:"none"}}return"M"===e||"T"===e?{status:"modified",staged:" "===t?"full":"partial"}:"A"===e?{status:"added",staged:" "===t?"full":"partial"}:"D"===e?{status:"deleted",staged:" "===t?"full":"partial"}:"C"===e?{status:"copied",staged:" "===t?"full":"partial"}:"R"===e?{status:"renamed",staged:" "===t?"full":"partial"}:{status:"modified",staged:"none"}}(e,t)),{path:n,from:r})))}))};const i=["M","T","A","D","C","R","U"," ","?","!"];function o(e){return i.includes(e)}},70081:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};function r({runner:e}){return n(this,void 0,void 0,(function*(){return(yield e.runGitCommandAndSplitLines({args:["-c","color.ui=false","status","-s"],onError:"throw",resource:"findUntrackedFiles"})).filter((e=>e.startsWith("??"))).map((e=>e.substring(3)))}))}function i({runner:e,filePaths:t}){return n(this,void 0,void 0,(function*(){yield e.runGitCommandAndSplitLines({args:["add","--intent-to-add",...t],onError:"throw",resource:"trackFiles"})}))}Object.defineProperty(t,"__esModule",{value:!0}),t.trackAllNewFiles=t.trackFiles=t.findUntrackedFiles=void 0,t.findUntrackedFiles=r,t.trackFiles=i,t.trackAllNewFiles=function({runner:e}){return n(this,void 0,void 0,(function*(){const t=yield r({runner:e});yield i({runner:e,filePaths:t})}))}},70435:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.commuteHunkBefore=t.getNetChangeInHunk=t.translateNewLinesInHunk=t.translateHunk=t.getBoundsOfHunk=void 0;const r=n(34490);function i(e){const{oldStart:t,newStart:n}=e,r=e.lines.filter((({type:e})=>"remove"===e)),i=e.lines.filter((({type:e})=>"add"===e));return{oldStart:t,oldEnd:r.length?t+r.length-1:void 0,newStart:n,newEnd:i.length?n+i.length-1:void 0}}function o(e,t){return Object.assign(Object.assign({},e),{oldStart:e.oldStart+t,newStart:e.newStart+t})}function s(e){return e.lines.reduce(((e,t)=>{switch(t.type){case"remove":return e-1;case"add":return e+1;default:(0,r.assertUnreachable)(t)}}),0)}t.getBoundsOfHunk=i,t.translateHunk=o,t.translateNewLinesInHunk=function(e,t){return Object.assign(Object.assign({},e),{newStart:e.newStart+t})},t.getNetChangeInHunk=s,t.commuteHunkBefore=function({originalBeforeHunk:e,originalAfterHunk:t}){const{newStart:n,newEnd:r}=i(e),{oldStart:a,oldEnd:u}=i(t);return(null!=u?u:a)<n||void 0===r&&void 0!==u&&u===n?t:(null!=r?r:n)<a||void 0!==r&&void 0===u&&r===a?o(t,-1*s(e)):void 0}},39314:(e,t)=>{function n({hunk:e}){const t=e.lines.filter((e=>"remove"===e.type)),n=e.lines.filter((e=>"add"===e.type));return[`@@ -${e.oldStart},${t.length} +${e.newStart},${n.length} @@`,...t.map((e=>`-${e.text}`)),...e.oldNoNewlineAtEndOfFile?["\"]:[],...n.map((e=>`+${e.text}`)),...e.newNoNewlineAtEndOfFile?["\"]:[]].join("\n")}Object.defineProperty(t,"__esModule",{value:!0}),t.computePatchFromHunk=t.computePatchFromHunks=void 0,t.computePatchFromHunks=function({path:e,hunks:t}){return 0===t.length?null:[`diff --git ${e} ${e}`,`--- ${e}`,`+++ ${e}`,...t.sort(((e,t)=>e.oldStart-t.oldStart)).map((e=>n({hunk:e})))].join("\n")},t.computePatchFromHunk=n},4541:(e,t)=>{function n(e){const[t,...n]=e.split("\n@@");if(!t)throw new Error("empty diff file");const i=t.split("\n"),o=i[0];if(!o)throw new Error("empty diff file prefix");let[s,a]=o.split(" ");if(!s||!a)throw new Error("invalid diff file prefix line "+o);for(const e of i.slice(1))if(e.startsWith("new file"))s="/dev/null";else if(e.startsWith("deleted file"))a="/dev/null";else if(!(e.startsWith("---")||e.startsWith("+++")||e.startsWith("new mode")||e.startsWith("old mode")||e.startsWith("index")||e.startsWith("rename")||e.startsWith("similarity")||e.startsWith("dissimilarity")||e.startsWith("Binary")||""===e))throw new Error("invalid diff file prefix line "+e);return{oldFilename:s,newFilename:a,hunks:n.map((e=>{try{return r(e)}catch(t){throw new Error(`Error parsing hunk for file ${s} ${a}:\n${"object"==typeof t&&t&&"message"in t&&t.message}\n${e}`)}}))}}function r(e){const[t,...n]=e.split("\n");if(!t)throw new Error("empty hunk");const[r]=t.split("@@");if(!r)throw new Error("invalid hunk header "+t);const[i,o]=r.trim().split(" ");if(!i||!o)throw new Error("invalid hunk header "+t);const[s,a]=i.slice(1).split(","),[u,c]=o.slice(1).split(",");if(!s||!u)throw new Error("invalid hunk header "+t);let l,d=+s,h=+u,f=!1,m=!1;const p=[];for(const e of n){if(0===e.length)continue;const t=e[0],n=e.slice(1);switch(t){case"-":d++,p.push({type:"remove",text:n});break;case"+":h++,p.push({type:"add",text:n});break;case" ":d++,h++,p.push({type:"context",text:n});break;case"\\":if(!l||" No newline at end of file"!==n)throw new Error("invalid hunk line "+e);switch(l){case"-":f=!0;break;case"+":m=!0;break;case" ":f=!0,m=!0;break;default:throw new Error("invalid hunk line "+e)}break;default:throw new Error("invalid hunk line "+e)}l=t}const g=+s+(a?+a:1);if(d!==g)throw new Error("invalid hunk old line count "+d+" should be "+g);const v=+u+(c?+c:1);if(h!==v)throw new Error("invalid hunk new line count "+h+" should be "+v);return{oldNoNewlineAtEndOfFile:f,newNoNewlineAtEndOfFile:m,oldStart:+s,newStart:+u,lines:p}}Object.defineProperty(t,"__esModule",{value:!0}),t.parseDiffHunkForTest=t.parseHunksFromDiff=void 0,t.parseHunksFromDiff=function(e){return e?("\n"+e.trimStart()).split("\ndiff --git ").filter(Boolean).map(n):[]},t.parseDiffHunkForTest=r},21542:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reduceHunksToZeroContext=void 0;const r=n(34490);t.reduceHunksToZeroContext=function(e){return e.map((e=>({oldFilename:e.oldFilename,newFilename:e.newFilename,hunks:e.hunks.flatMap((e=>{const t=[];let n=e.oldStart,i=e.newStart,o=n,s=i,a=[];for(const u of e.lines)if("context"!==u.type)switch(u.type){case"remove":a.push({type:"remove",text:u.text}),n++;break;case"add":a.push({type:"add",text:u.text}),i++;break;default:(0,r.assertUnreachable)(u)}else a.length>0&&t.push({oldStart:o,newStart:s,lines:a,oldNoNewlineAtEndOfFile:!1,newNoNewlineAtEndOfFile:!1}),o=++n,s=++i,a=[];return a.length>0&&t.push({oldStart:o,newStart:s,lines:a,oldNoNewlineAtEndOfFile:e.oldNoNewlineAtEndOfFile,newNoNewlineAtEndOfFile:e.newNoNewlineAtEndOfFile}),t.map((e=>{if(0===e.lines.length)throw new Error("empty hunk");return e.oldStart>0&&!e.lines.some((e=>"remove"===e.type))?Object.assign(Object.assign({},e),{oldStart:e.oldStart-1}):e.newStart>0&&!e.lines.some((e=>"add"===e.type))?Object.assign(Object.assign({},e),{newStart:e.newStart-1}):e}))}))})))}},9682:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GitRepo=void 0;const o=n(32081),s=i(n(32856)),a=i(n(71017)),u=n(93333),c="test.txt";t.GitRepo=class{constructor(e,t){this.dir=e,this.runner=(0,u.composeGitRunner)({cwd:e,debug:process.env.DEBUG?e=>console.log(e):()=>{}}),this.userConfigPath=a.default.join(e,".git/.graphite_user_config"),(null==t?void 0:t.existingRepo)||(0,o.spawnSync)("git",(null==t?void 0:t.repoUrl)?["clone",t.repoUrl,e]:["init",e,"-b","main"]),(0,o.spawnSync)("git",["config","user.email","test@graphite.dev"],{cwd:e}),(0,o.spawnSync)("git",["config","user.name","graphite_test"],{cwd:e})}runGitCommand(e){return r(this,void 0,void 0,(function*(){return this.runner.runGitCommand({args:e,onError:"throw",resource:"test"})}))}createChange(e,t,n){return r(this,void 0,void 0,(function*(){const r=a.default.join(`${this.dir}`,`${t?t+"_":""}${c}`);s.default.writeFileSync(r,e),n||(yield this.runGitCommand(["add",r]))}))}readFileContents(e){const t=a.default.join(`${this.dir}`,`${e?e+"_":""}${c}`);return s.default.readFileSync(t,"utf8")}createChangeAndCommit(e,t){return r(this,void 0,void 0,(function*(){yield this.createChange(e,t),yield this.runGitCommand(["add","."]),yield this.runGitCommand(["commit","-m",e])}))}createChangeAndAmend(e,t){return r(this,void 0,void 0,(function*(){yield this.createChange(e,t),yield this.runGitCommand(["add","."]),yield this.runGitCommand(["commit","--amend","--no-edit"])}))}deleteBranch(e){return r(this,void 0,void 0,(function*(){yield this.runGitCommand(["branch","-D",e])}))}hasStagedChanges(){return r(this,void 0,void 0,(function*(){return(yield this.runGitCommand(["diff","--cached"])).length>0}))}createPrecommitHook(e){s.default.mkdirpSync(`${this.dir}/.git/hooks`),s.default.writeFileSync(`${this.dir}/.git/hooks/pre-commit`,e),(0,o.spawnSync)("chmod",["+x",`${this.dir}/.git/hooks/pre-commit`])}createAndCheckoutBranch(e){return r(this,void 0,void 0,(function*(){yield this.runGitCommand(["checkout","-b",e])}))}checkoutBranch(e){return r(this,void 0,void 0,(function*(){yield this.runGitCommand(["checkout",e])}))}rebaseInProgress(){return s.default.existsSync(a.default.join(this.dir,".git","rebase-merge"))}resolveMergeConflicts(){return r(this,void 0,void 0,(function*(){yield this.runGitCommand(["checkout","--theirs","."])}))}markMergeConflictsAsResolved(){return r(this,void 0,void 0,(function*(){yield this.runGitCommand(["add","."])}))}currentBranchName(){return r(this,void 0,void 0,(function*(){return this.runGitCommand(["branch","--show-current"])}))}getBranchSha(e){return r(this,void 0,void 0,(function*(){return this.runGitCommand(["rev-parse",`refs/heads/${e}`])}))}listCurrentBranchCommitMessages(){return r(this,void 0,void 0,(function*(){return(yield this.runGitCommand(["log","--oneline","--format=%B"])).split("\n").filter((e=>e.length>0))}))}}},53649:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GitRepo=t.CommandKilledError=t.CommandFailedError=t.reduceHunksToZeroContext=t.parseHunksFromDiff=t.parseDiffHunkForTest=t.computePatchFromHunks=t.computePatchFromHunk=t.translateNewLinesInHunk=t.translateHunk=t.getNetChangeInHunk=t.getBoundsOfHunk=t.commuteHunkBefore=t.composeGitConfig=t.composeGit=void 0;var r=n(9164);Object.defineProperty(t,"composeGit",{enumerable:!0,get:function(){return r.composeGit}});var i=n(50279);Object.defineProperty(t,"composeGitConfig",{enumerable:!0,get:function(){return i.composeGitConfig}});var o=n(70435);Object.defineProperty(t,"commuteHunkBefore",{enumerable:!0,get:function(){return o.commuteHunkBefore}}),Object.defineProperty(t,"getBoundsOfHunk",{enumerable:!0,get:function(){return o.getBoundsOfHunk}}),Object.defineProperty(t,"getNetChangeInHunk",{enumerable:!0,get:function(){return o.getNetChangeInHunk}}),Object.defineProperty(t,"translateHunk",{enumerable:!0,get:function(){return o.translateHunk}}),Object.defineProperty(t,"translateNewLinesInHunk",{enumerable:!0,get:function(){return o.translateNewLinesInHunk}});var s=n(39314);Object.defineProperty(t,"computePatchFromHunk",{enumerable:!0,get:function(){return s.computePatchFromHunk}}),Object.defineProperty(t,"computePatchFromHunks",{enumerable:!0,get:function(){return s.computePatchFromHunks}});var a=n(4541);Object.defineProperty(t,"parseDiffHunkForTest",{enumerable:!0,get:function(){return a.parseDiffHunkForTest}}),Object.defineProperty(t,"parseHunksFromDiff",{enumerable:!0,get:function(){return a.parseHunksFromDiff}});var u=n(21542);Object.defineProperty(t,"reduceHunksToZeroContext",{enumerable:!0,get:function(){return u.reduceHunksToZeroContext}});var c=n(93333);Object.defineProperty(t,"CommandFailedError",{enumerable:!0,get:function(){return c.CommandFailedError}}),Object.defineProperty(t,"CommandKilledError",{enumerable:!0,get:function(){return c.CommandKilledError}});var l=n(9682);Object.defineProperty(t,"GitRepo",{enumerable:!0,get:function(){return l.GitRepo}})},93333:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.CommandKilledError=t.CommandFailedError=t.composeGitRunner=void 0;const i=n(32081),o=n(97503);t.composeGitRunner=({cwd:e,debug:t})=>{const n=n=>r(void 0,void 0,void 0,(function*(){var r;const i=null!==(r=n.cwd)&&void 0!==r?r:e,s=Object.assign(Object.assign(Object.assign({},n),i?{args:["-C",i,...n.args]}:{}),{debug:t});return n.resource&&o.tracer.currentSpanId?o.tracer.span({name:"spawnedCommand",resource:n.resource,meta:{runCommandArgs:JSON.stringify(n,null,2)}},(()=>u(s))):u(s)}));return{runGitCommand:n,runGitCommandAndSplitLines:e=>r(void 0,void 0,void 0,(function*(){return(yield n(e)).split("\n").filter((e=>e.length>0))}))}};const s=5,a=50;function u({args:e,options:t,debug:n,noTrim:r,onError:o,input:d,resource:h,numIndexLockRetries:f}){return null==n||n(`Spawning ${h}: git ${e.join(" ")}`),f&&(null==n||n(`index.lock retry: ${f}`)),new Promise(((m,p)=>{var g,v;const y=(0,i.spawn)("git",e,Object.assign(Object.assign({},t),{windowsHide:!0}));d&&(null===(g=y.stdin)||void 0===g||g.write(d),null===(v=y.stdin)||void 0===v||v.end());let b="";y.stdout&&(y.stdout.setEncoding("utf8"),y.stdout.on("data",(function(e){b+=e.toString()})));let E="";y.stderr&&(y.stderr.setEncoding("utf8"),y.stderr.on("data",(function(e){E+=e.toString()}))),y.addListener("close",((i,d)=>{return null==n||n(`Finished ${h}: git ${e.join(" ")}\n${JSON.stringify({code:i,signal:d,stdout:b,stderr:E},null,2)}`),d?p(new l({command:"git",args:e,signal:d,stdout:b,stderr:E})):0===i?m(r?b:b.trim()):(null!=f?f:0)<s&&E.includes("index.lock")?m((g=a,new Promise((e=>setTimeout(e,g)))).then((()=>u({args:e,options:t,debug:n,onError:o,resource:h,numIndexLockRetries:(null!=f?f:0)+1})))):"ignore"===o?m(""):p(new c({command:"git",args:e,status:i||1,stdout:b,stderr:E}));var g}))}))}class c extends Error{constructor(e){super([e.errno&&e.code?`Command failed with error ${e.code} (${e.errno}), exit code ${e.status}:`:`Command failed with error exit code ${e.status}:`,[e.command].concat(e.args).join(" "),e.stdout,e.stderr].join("\n")),this.exitCode=e.status,this.name="CommandFailed"}}t.CommandFailedError=c;class l extends Error{constructor(e){super([`Command killed with signal ${e.signal}:`,[e.command].concat(e.args).join(" "),e.stdout,e.stderr].join("\n")),this.name="CommandKilled"}}t.CommandKilledError=l},95808:(e,t,n)=>{t.composeGit=void 0;var r=n(53649);Object.defineProperty(t,"composeGit",{enumerable:!0,get:function(){return r.composeGit}});n(97503),n(53649)},97503:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.tracer=void 0;const r=i();function i(){return Math.ceil(1e9*Math.random())}function o(e){return null!=e}const s=BigInt(Date.now())*BigInt(1e6)-process.hrtime.bigint();function a(){return process.hrtime.bigint()+s}class u{constructor(e){this.name=e.name,this.parentId=e.parentId,this.resource=e.resource,this.meta=e.meta,this.spanId=i(),this.start=a()}end(e,t){this.endedSpan=Object.assign({error:t?1:0,meta:Object.assign(Object.assign(Object.assign({},"string"==typeof e?{result:e}:Object.assign({},e)),t?Object.assign({"error.msg":t.message,"error.type":t.constructor.name},t.stack?{"error.stack":t.stack}:{}):{}),this.meta),metrics:{},name:this.name,resource:this.resource,service:"graphite-cli",span_id:this.spanId,start:Number(this.start),trace_id:r,type:"custom",duration:Number(a()-this.start)},this.parentId?{parent_id:this.parentId}:{parent_id:0})}}t.tracer=new class{constructor(){this.allSpans=[]}startSpan(e){const t=new u(Object.assign(Object.assign({},e),this.currentSpanId?{parentId:this.currentSpanId}:{}));return this.allSpans.push(t),t}span(e,t){return n(this,void 0,void 0,(function*(){const n=this.startSpan(e);let r;this.currentSpanId=n.spanId;try{r=yield t()}catch(e){throw n.end(r,e instanceof Error?e:new Error("unknown error")),e}return n.end(r),this.currentSpanId=n.parentId,r}))}flushJson(){let e=this.allSpans.map((e=>e.endedSpan)).filter(o);const t=e.find((e=>"command"==e.name));t&&(e=e.map((e=>Object.assign(Object.assign({},e),null!=e.parent_id?{parent_id:e.parent_id}:{parent_id:t.span_id}))));const n=[e];return this.allSpans=this.allSpans.filter((e=>!e.endedSpan)),JSON.stringify(n)}}},33800:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.labelForComparison=t.ComparisonType=void 0,function(e){e.UncommittedChanges="UNCOMMITTED",e.HeadChanges="HEAD",e.StackChanges="STACK",e.Committed="InCommit",e.Commit="Commit",e.Range="Range"}(n=t.ComparisonType||(t.ComparisonType={})),t.labelForComparison=function(e){switch(e.type){case n.UncommittedChanges:return"Uncommitted changes";case n.HeadChanges:return"Changes in current commit";case n.StackChanges:return"Changes in current branch";case n.Committed:return`Changes in ${e.hash}`;case n.Commit:return`In ${e.sha}`;case n.Range:return`From ${e.fromSha} to ${e.toSha}`}}},2982:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.cached=t.LRU=void 0;const r=n(30826);class i{constructor(e,t=3){this.maxItems=e,this.maxHashCollision=t,this.cache=new Map}get(e){let t;const n=o(e),i=this.cache.get(n);if(void 0!==i){const o=i.get(e);if(void 0!==o)t=o;else for(const[n,o]of i)if((0,r.is)(e,n)){t=o;break}this.cache.delete(n),this.cache.set(n,i)}return t}set(e,t){const n=o(e);let r=this.cache.get(n);if(void 0===r||r.size>=this.maxHashCollision?r=new Map([[e,t]]):r.set(e,t),this.cache.delete(n),void 0!==t&&(this.cache.set(n,r),this.cache.size>this.maxItems)){const e=this.cache.keys().next();e.done||this.cache.delete(e.value)}}delete(e){const t=o(e);this.cache.delete(t)}clear(){this.cache.clear()}}function o(e){const t=null==e?void 0:e.hashCode;return void 0!==t?t.apply(e):e}function s(e,t){var n,o;const s=null!==(n=null==t?void 0:t.cache)&&void 0!==n?n:new i(null!==(o=null==t?void 0:t.cacheSize)&&void 0!==o?o:10),a=null==t?void 0:t.getExtraKeys,c=function(...t){var n,i,o;const c=s.stats;if(!t.every(u))return null!=c&&(c.skip=(null!==(n=c.skip)&&void 0!==n?n:0)+1),e.apply(this,t);const l=(0,r.List)(a?[...a.apply(this),...t]:t),d=s.get(l);if(void 0!==d)return null!=c&&(c.hit=(null!==(i=c.hit)&&void 0!==i?i:0)+1),d;null!=c&&(c.miss=(null!==(o=c.miss)&&void 0!==o?o:0)+1);const h=e.apply(this,t);return s.set(l,h),h};return c.cache=s,c}t.LRU=i,t.cached=function(e,t){return"function"==typeof e?s(e,t):function(e){var t;const n=null!==(t=null==e?void 0:e.getExtraKeys)&&void 0!==t?t:function(){return(0,r.isValueObject)(this)?[this]:null!=this&&"object"==typeof this?Object.values(this).filter(u):[]};return function(t,r,i){const o=i.value;i.value=s(o,Object.assign(Object.assign({},e),{getExtraKeys:n}))}}(e)};const a=new Set(["number","string","boolean","symbol","bigint","undefined","null"]);function u(e){if(null==e)return!0;const t=typeof e;return!!a.has(t)||!("object"!==t||!(0,r.isValueObject)(e))}},61110:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},5693:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(61110),t),i(n(52568),t),i(n(11268),t),i(n(66877),t)},52568:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},11268:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Tracker=void 0;const r=n(48427);class i{constructor(e,t){this.sendData=e,this.context=t}error(e,t,n,r){const i=n instanceof Error?n.message||String(n):n;return this.track(e,Object.assign(Object.assign({},null!=r?r:{}),{errorMessage:i,errorName:t}))}operation(e,t,n,i){var o;const s=Date.now(),a=null!==(o=null==n?void 0:n.id)&&void 0!==o?o:(0,r.randomId)();try{const o=i({parentId:a});if((0,r.isPromise)(o))return o.then((t=>{const r=Date.now()-s;return this.track(e,Object.assign(Object.assign({},null!=n?n:{}),{duration:r,id:a})),t})).catch((r=>{const i=Date.now()-s;return this.error(e,t,r,Object.assign(Object.assign({},null!=n?n:{}),{duration:i,id:a})),Promise.reject(r)}));{const t=Date.now()-s;return this.track(e,Object.assign(Object.assign({},null!=n?n:{}),{duration:t,id:a})),o}}catch(r){const i=Date.now()-s;throw this.error(e,t,r,Object.assign(Object.assign({},null!=n?n:{}),{duration:i,id:a})),r}}trackAsParent(e,t){var n;const o=null!==(n=null==t?void 0:t.id)&&void 0!==n?n:(0,r.randomId)();return this.trackData(Object.assign(Object.assign({},t),{eventName:e,id:o})),new i(((e,t)=>this.trackData(Object.assign(Object.assign({},e),t))),{parentId:o})}track(e,t){return this.trackData(Object.assign(Object.assign({},t),{eventName:e}))}trackData(e){var t,n;const i=null!==(t=null==e?void 0:e.id)&&void 0!==t?t:(0,r.randomId)(),o=null!==(n=null==e?void 0:e.timestamp)&&void 0!==n?n:Date.now(),s=Object.assign({timestamp:o,id:i},null!=e?e:{});this.sendData(s,this.context)}}t.Tracker=i},66877:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},66960:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.debounce=void 0,t.debounce=function(e,t,n=void 0,r=!1){let i,o=!0;function s(...a){let u;if(r){if(u=function(){o=!0,i=void 0},!o)return clearTimeout(i),void(i=setTimeout(u,t));o=!1,e.apply(n,a)}else s.reset(),u=function(){i=void 0,e.apply(n,a)};i=setTimeout(u,t)}return s.reset=function(){clearTimeout(i),i=void 0,o=!0},s.isPending=function(){return null!=i},s}},98696:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(5693),t),i(n(33800),t),i(n(66960),t),i(n(2982),t),i(n(75905),t),i(n(85249),t),i(n(40256),t),i(n(86099),t),i(n(66224),t),i(n(48427),t)},75905:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.parsePatch=t.DiffType=void 0,function(e){e.Modified="Modified",e.Added="Added",e.Removed="Removed",e.Renamed="Renamed",e.Copied="Copied"}(n=t.DiffType||(t.DiffType={}));const r=/^diff --git (.*) (.*)$/,i=/^rename from (.*)$/,o=/^rename to (.*)$/,s=/^copy from (.*)$/,a=/^copy to (.*)$/,u=/^new file mode (\d{6})$/,c=/^deleted file mode (\d{6})$/,l=/^old mode (\d{6})$/,d=/^new mode (\d{6})$/,h=/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,f=/^--- (.*)$/,m=/^\+\+\+ (.*)$/,p=/\r\n|[\n\v\f\r\x85]/g;function g(e,t){if(!1===e)throw new Error(t)}t.parsePatch=function(e){const t=e.split(p),v=e.match(p)||[],y=[];let b=0;function E(){const e={hunks:[]};for(y.push(e),function(e){for(;b<t.length;){const n=t[b],i=r.exec(n);if(i){e.oldFileName=i[1],e.newFileName=i[2],b++;break}b++}}(e);b<t.length;){const n=t[b];if(/^old mode/.test(n))_(e);else if(/^new mode/.test(n))w(e);else if(/^deleted file mode/.test(n))C(e);else if(/^new file mode/.test(n))R(e);else if(/^copy /.test(n))O(e);else if(/^rename /.test(n))S(e);else{if(/^--- /.test(n)){P(e);break}if(/^diff --git/.test(n))break;b++}}!function(e){for(;b<t.length;){const n=t[b];if(r.test(n))break;/^@@/.test(n)?e.hunks.push(A()):b++}}(e)}function _(e){const r=l.exec(t[b]);g(null!==r,`invalid format '${t[b]}'`),e.oldMode=r[1],e.type=n.Modified,b++}function w(e){const r=d.exec(t[b]);g(null!==r,`invalid format '${t[b]}'`),e.newMode=r[1],e.type=n.Modified,b++}function C(e){const r=c.exec(t[b]);g(null!==r,`invalid format '${t[b]}'`),e.newMode=r[1],e.type=n.Removed,b++}function R(e){const r=u.exec(t[b]);g(null!==r,`invalid format '${t[b]}'`),e.newMode=r[1],e.type=n.Added,b++}function O(e){g(s.test(t[b]),`invalid format '${t[b]}'`),g(a.test(t[b+1]),`invalid format '${t[b+1]}'`),e.type=n.Copied,b+=2}function S(e){g(i.test(t[b]),`invalid format '${t[b]}'`),g(o.test(t[b+1]),`invalid format '${t[b+1]}'`),e.type=n.Renamed,b+=2}function P(e){g(f.test(t[b]),`invalid format '${t[b]}'`),g(m.test(t[b+1]),`invalid format '${t[b+1]}'`),void 0===e.type&&(e.type=n.Modified),b+=2}function A(){const e=t[b++].split(h),n={oldStart:+e[1],oldLines:void 0===e[2]?1:+e[2],newStart:+e[3],newLines:void 0===e[4]?1:+e[4],lines:[],linedelimiters:[]};0===n.oldLines&&(n.oldStart+=1),0===n.newLines&&(n.newStart+=1);let r=0,i=0;for(;b<t.length&&!(0===t[b].indexOf("--- ")&&b+2<t.length&&0===t[b+1].indexOf("+++ ")&&0===t[b+2].indexOf("@@"));b++){const e=0==t[b].length&&b!=t.length-1?" ":t[b][0];if("+"!==e&&"-"!==e&&" "!==e&&"\\"!==e)break;n.lines.push(t[b]),n.linedelimiters.push(v[b]||"\n"),"+"===e?r++:"-"===e?i++:" "===e&&(r++,i++)}return r||1!==n.newLines||(n.newLines=0),i||1!==n.oldLines||(n.oldLines=0),n}for(;b<t.length;)E();return y}},85249:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeFromString=t.deserialize=t.serializeToString=t.serialize=void 0;const n={__rpcType:"undefined"};function r(e){if(void 0===e)return n;if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null===e)return e;if(e instanceof Map)return{__rpcType:"Map",data:Array.from(e.entries()).map((([e,t])=>[r(e),r(t)]))};if(e instanceof Set)return{__rpcType:"Set",data:Array.from(e.values()).map(r)};if(e instanceof Error)return{__rpcType:"Error",data:{message:e.message,stack:e.stack}};if(e instanceof Date)return{__rpcType:"Date",data:e.valueOf()};if(Array.isArray(e))return e.map((e=>r(e)));if("object"==typeof e){const t={__rpcType:"object"};for(const[n,i]of Object.entries(e))t[n]=r(i);return t}throw new Error(`cannot serialize argument ${e}`)}function i(e){if("object"!=typeof e||null==e)return e;if(Array.isArray(e))return e.map((e=>i(e)));const t=e;switch(t.__rpcType){case"undefined":return;case"Map":return new Map(t.data.map((([e,t])=>[i(e),i(t)])));case"Set":return new Set(t.data.map(i));case"Error":{const e=new Error;return e.stack=t.data.stack,e.message=t.data.message,e}case"Date":return new Date(t.data);case"object":{const t=e,n={};for(const[e,r]of Object.entries(t))"__rpcType"!==e&&(n[e]=i(r));return n}default:throw new Error(`cannot deserialize unknown type ${t}`)}}t.serialize=r,t.serializeToString=function(e){return JSON.stringify(r(e))},t.deserialize=i,t.deserializeFromString=function(e){return i(JSON.parse(e))}},40256:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},66224:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},50209:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.SucceedableRevset=t.CommandRunner=void 0,(n=t.CommandRunner||(t.CommandRunner={})).Graphite="gt",n.CodeReviewProvider="codeReviewProvider",t.SucceedableRevset=function(e){return{type:"succeedable-revset",revset:e}}},74259:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},45852:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1018:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorShortMessages=t.DEFAULT_DAYS_OF_COMMITS_TO_LOAD=t.ONE_MINUTE_MS=t.CLOSED_AND_SHOULD_NOT_RECONNECT_CODE=void 0,t.CLOSED_AND_SHOULD_NOT_RECONNECT_CODE=4100,t.ONE_MINUTE_MS=6e4,t.DEFAULT_DAYS_OF_COMMITS_TO_LOAD=void 0,(t.ErrorShortMessages||(t.ErrorShortMessages={})).NoCommitsFetched="No commits found"},29641:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},86099:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),i(n(50209),t),i(n(74259),t),i(n(45852),t),i(n(1018),t),i(n(29641),t),i(n(85119),t)},85119:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},48427:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isPromise=t.truncate=t.zip=t.generatorContains=t.mapObject=t.findParentWithClassName=t.basename=t.defer=t.randomId=t.unwrap=t.notEmpty=void 0,t.notEmpty=function(e){return null!=e},t.unwrap=function(e){if(null==e)throw new Error(`expected value not to be ${e}`);return e},t.randomId=function(){return Date.now().toString(36)+Math.random().toString(36)},t.defer=function(){const e={promise:void 0,resolve:void 0,reject:void 0};return e.promise=new Promise(((t,n)=>{e.resolve=t,e.reject=n})),e},t.basename=function(e,t="/"){const n=e.lastIndexOf(t);return-1===n?e:e.slice(n+1)},t.findParentWithClassName=function(e,t){var n;let r=e;for(;r;){if(null===(n=r.classList)||void 0===n?void 0:n.contains(t))return r;r=r.parentElement}},t.mapObject=function(e,t){return Object.fromEntries(Object.entries(e).map(t))},t.generatorContains=function(e,t){const n="function"==typeof t?t:e=>e===t;for(const t of e)if(n(t))return!0;return!1},t.zip=function*(e,t){const n=e[Symbol.iterator](),r=t[Symbol.iterator]();for(;;){const e=n.next(),t=r.next();if(e.done||t.done)break;yield[e.value,t.value]}},t.truncate=function(e,t=100){return e.length>t?e.substring(0,Math.max(0,t-1))+"…":e},t.isPromise=function(e){return"function"==typeof(null==e?void 0:e.then)}},66703:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isApprover=void 0,t.isApprover=function(e){return"APPROVED"===e.decision&&(e.hasWritePermission||null===e.hasWritePermission)}},27962:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.doesPrHaveMinimumRequiredApprovals=void 0;const r=n(66703);t.doesPrHaveMinimumRequiredApprovals=function({previousReviewers:e,numRequiredApproversBaseBranchRules:t,numRequiredApproversRestrictions:n}){return e.filter(r.isApprover).length>=Math.max(null!=t?t:1,...n.map((({numRequiredApprovers:e})=>e)))}},63261:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getHumanReadablePrMetastatus=t.doesPrHaveOpenReviewRequests=t.doesPrHaveClosedReviewRequests=t.doesPrHaveOpenChangesRequested=t.doesPrHaveMissingCodeownerReviews=t.mapCodeownerToKey=t.getPrMissingCodeowners=t.getPrMetastatus=t.GRAPHITE_BASE_BRANCH_PREFIX=void 0;const s=n(34490),a=o(n(57569)),u=n(66703);function c({previousReviewers:e,authorLogin:t,files:n}){const r=new Set(e.filter((e=>"APPROVED"===e.decision&&(e.hasWritePermission||null===e.hasWritePermission))).map((e=>e.username.toLowerCase())));return n.filter((e=>{var n,i,o;const a=(null!==(i=null===(n=e.codeowners)||void 0===n?void 0:n.owners)&&void 0!==i?i:[]).map((e=>{switch(e.kind){case"USER":return Object.assign(Object.assign({},e),{login:e.login.toLowerCase()});case"TEAM":return Object.assign(Object.assign({},e),{memberLogins:e.memberLogins.map((e=>e.toLowerCase()))});case"EMAIL":return Object.assign(Object.assign({},e),{email:e.email.toLowerCase()});default:(0,s.assertUnreachable)(e)}}));return e.codeowners&&e.codeowners.owners.length>0&&!function({approverLogins:e,owners:t}){return t.some((t=>{switch(t.kind){case"USER":return e.has(t.login);case"TEAM":return t.memberLogins.some((t=>e.has(t)));case"EMAIL":return!1;default:(0,s.assertUnreachable)(t)}}))}({approverLogins:r,owners:a})&&!function({authorLogin:e,owners:t}){if(null===e||1!==t.length)return!1;const n=t[0];return"USER"===n.kind&&n.login===e||!("TEAM"!==n.kind||1!==n.memberLogins.length||!n.memberLogins.includes(e))}({authorLogin:null!==(o=null==t?void 0:t.toLowerCase())&&void 0!==o?o:null,owners:a})}))}function l(e){switch(e.kind){case"USER":return e.login;case"TEAM":return`${e.org}/${e.team}`;case"EMAIL":return e.email;default:(0,s.assertUnreachable)(e)}}function d({previousReviewers:e,authorLogin:t,files:n}){return c({previousReviewers:e,authorLogin:t,files:n}).length>0}t.GRAPHITE_BASE_BRANCH_PREFIX="graphite-base",t.getPrMetastatus=function e({pr:n,downstackExclusivePrs:r,baseBranchRules:i,ignoreMergeStates:o,enableNeedsRestack:c}){var l,h,f;if("OPEN"!==n.state)return{prNumber:n.number,status:n.state};if(n.isDraft)return{prNumber:n.number,status:"DRAFT"};if(n.isQueuedToMerge&&!o)return{prNumber:n.number,status:"QUEUED_TO_MERGE"};if(n.isWaitingToMerge&&!o)return{prNumber:n.number,status:"WAITING_TO_MERGE"};const m=[],p=r[0];if(!o&&n.isInFailureHandling)return{prNumber:n.number,status:"BLOCKED",blockingReasons:[{reason:"FAILURE_HANDLING"}]};(null==i?void 0:i.lockBranch)&&m.push({reason:"BRANCH_LOCKED"}),p&&"MERGED"===p.state&&(n.parentBranch===p.branch||(null===(l=n.parentBranch)||void 0===l?void 0:l.startsWith(`${t.GRAPHITE_BASE_BRANCH_PREFIX}/`)))&&m.push({reason:"NEEDS_RESTACK__BASE_BRANCH_MERGED"}),c&&n.lastPushedAt&&n.lastBaseRefChangedAt&&n.lastPushedAt<n.lastBaseRefChangedAt&&m.push({reason:"NEEDS_RESTACK__BASE_REF_CHANGED"}),n.hasMergeConflicts&&m.push({reason:"MERGE_CONFLICTS"}),"FAILING_REQUIRED"===n.ciRollup.status&&m.push({reason:"FAILING_REQUIRED"});const g=null!==(h=null==i?void 0:i.requiresApprovingReviews)&&void 0!==h?h:null;(null===g||g)&&n.previousReviewers.some((e=>(e.hasWritePermission||null===e.hasWritePermission)&&"CHANGES_REQUESTED"===e.decision))&&m.push({reason:"CHANGES_REQUESTED"}),(null==i?void 0:i.requiresCodeOwnerReviews)&&d(n)&&m.push({reason:"NEEDS_CODEOWNER_APPROVALS"});const v=a.computeNeedsRequiredApproverBlockingReason(n);v&&m.push(v);const y=n.previousReviewers.filter(u.isApprover);(null!==(f=null==i?void 0:i.requiredApprovingReviewCount)&&void 0!==f?f:0)>y.length&&m.push({reason:"NEEDS_APPROVALS"});const b=a.computeNeedsApprovalBlockingReason(n);b&&m.push(b),"RUNNING"===n.ciRollup.status&&m.push({reason:"RUNNING"}),(null==i?void 0:i.requiresConversationResolution)&&n.unresolvedThreadCount>0&&m.push({reason:"UNRESOLVED_COMMENTS"});const E=0===r.length?void 0:e({pr:r[0],downstackExclusivePrs:r.slice(1),baseBranchRules:i,ignoreMergeStates:o}),_=function({parentMetastatus:e,hasThirdPartyMergeQueueLabel:t,hasActiveEntryInGithubMergeQueue:n,ciRollupStatus:r}){switch(e){case"BLOCKED":case"HANDED_OFF_TO_EXTERNAL_MERGE_QUEUE":return"WAITING_ON_DOWNSTACK";case"HARD_BLOCKED":case"CLOSED":case"DRAFT":case"WAITING_TO_MERGE":return"HARD_WAITING_ON_DOWNSTACK";case void 0:case"MERGED":return t||n?"HANDED_OFF_TO_EXTERNAL_MERGE_QUEUE":"PASSING_WITH_SKIPPED"===r?"READY_TO_MERGE_WITHOUT_CI":"READY_TO_MERGE";case"QUEUED_TO_MERGE":return"READY_TO_MERGE";case"READY_TO_MERGE":case"READY_TO_MERGE_AS_STACK":return"PASSING_WITH_SKIPPED"===r?"READY_TO_MERGE_AS_STACK_WITHOUT_CI":"READY_TO_MERGE_AS_STACK";case"READY_TO_MERGE_WITHOUT_CI":case"READY_TO_MERGE_AS_STACK_WITHOUT_CI":return"READY_TO_MERGE_AS_STACK_WITHOUT_CI";default:(0,s.assertUnreachable)(e)}}({parentMetastatus:null==E?void 0:E.status,hasThirdPartyMergeQueueLabel:n.hasThirdPartyMergeQueueLabel,hasActiveEntryInGithubMergeQueue:n.hasActiveEntryInGithubMergeQueue,ciRollupStatus:n.ciRollup.status});if("HARD_WAITING_ON_DOWNSTACK"===_||"WAITING_ON_DOWNSTACK"===_)m.push({reason:_});else if(0===m.length)return{prNumber:n.number,status:_};return Object.assign({prNumber:n.number,status:m.map((({reason:e})=>e)).includes("MERGE_CONFLICTS")||m.map((({reason:e})=>e)).includes("HARD_WAITING_ON_DOWNSTACK")?"HARD_BLOCKED":"BLOCKED",blockingReasons:[m[0],...m.slice(1)]},E?{parentMetastatus:E}:{})},t.getPrMissingCodeowners=function({previousReviewers:e,authorLogin:t,files:n}){const r=c({previousReviewers:e,authorLogin:t,files:n}).map((e=>e.codeowners?e.codeowners.owners:[])).flat();return[...new Map(r.map((e=>[l(e),e]))).values()]},t.mapCodeownerToKey=l,t.doesPrHaveMissingCodeownerReviews=d,t.doesPrHaveOpenChangesRequested=function({previousReviewers:e,requestedReviewers:t}){return e.filter((e=>"CHANGES_REQUESTED"===e.decision)).map((e=>e.username)).some((e=>!t.includes(e)))},t.doesPrHaveClosedReviewRequests=function({previousReviewers:e,requestedReviewers:t}){return e.filter((e=>["CHANGES_REQUESTED","COMMENTED"].includes(e.decision))).map((e=>e.username)).some((e=>!t.includes(e)))},t.doesPrHaveOpenReviewRequests=function({requestedReviewers:e}){return e.length>0},t.getHumanReadablePrMetastatus={CALCULATING:"Calculating...",MERGED:"Merged",QUEUED_TO_MERGE:"Queued to merge...",WAITING_TO_MERGE:"Waiting to merge...",HANDED_OFF_TO_EXTERNAL_MERGE_QUEUE:"Handed off to merge queue...",CLOSED:"Closed",DRAFT:"Draft",CHANGES_REQUESTED:"Changes requested",NEEDS_APPROVALS:"Needs more approvals",GT_NEEDS_APPROVALS:"Needs more approvals",NEEDS_CODEOWNER_APPROVALS:"Needs approvals from code owners",GT_NEEDS_REQUIRED_APPROVER:"Needs approvals from required file approvers",MERGE_CONFLICTS:"Merge conflicts",BRANCH_LOCKED:"Trunk branch locked",RUNNING:"Waiting on CI...",FAILING_REQUIRED:"Required CI failed",READY_TO_MERGE:"Ready to merge",MERGED_AND_DELETED:"Merged and deleted",READY_TO_MERGE_AS_STACK:"Ready to merge as stack",READY_TO_MERGE_WITHOUT_CI:"Ready to merge",READY_TO_MERGE_AS_STACK_WITHOUT_CI:"Ready to merge as stack",WAITING_ON_DOWNSTACK:"Waiting on downstack",HARD_WAITING_ON_DOWNSTACK:"Waiting on downstack",UNRESOLVED_COMMENTS:"Unresolved comments",NEEDS_RESTACK__BASE_BRANCH_MERGED:"Needs restack",NEEDS_RESTACK__DOWNSTACK_MERGING:"Needs restack",NEEDS_RESTACK__BASE_REF_CHANGED:"Needs restack",FAILURE_HANDLING:"Undergoing failure detection"}},19495:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MergeStateStatuses=t.PrMetastatuses=void 0,t.PrMetastatuses=["CALCULATING","MERGED","MERGED_AND_DELETED","CLOSED","DRAFT","QUEUED_TO_MERGE","WAITING_TO_MERGE","HANDED_OFF_TO_EXTERNAL_MERGE_QUEUE","READY_TO_MERGE","READY_TO_MERGE_AS_STACK","READY_TO_MERGE_WITHOUT_CI","READY_TO_MERGE_AS_STACK_WITHOUT_CI","CHANGES_REQUESTED","NEEDS_APPROVALS","GT_NEEDS_APPROVALS","NEEDS_CODEOWNER_APPROVALS","RUNNING","FAILING_REQUIRED","WAITING_ON_DOWNSTACK","HARD_WAITING_ON_DOWNSTACK","UNRESOLVED_COMMENTS","MERGE_CONFLICTS","BRANCH_LOCKED","NEEDS_RESTACK__BASE_BRANCH_MERGED","NEEDS_RESTACK__DOWNSTACK_MERGING","NEEDS_RESTACK__BASE_REF_CHANGED","GT_NEEDS_APPROVALS","GT_NEEDS_REQUIRED_APPROVER","FAILURE_HANDLING"],t.MergeStateStatuses=["GREEN__CLEAN__MERGEABLE_AND_PASSING_COMMIT_STATUS","GREEN__HAS_HOOKS__MERGEABLE_WITH_PASSING_COMMIT_STATUS_AND_PRERECEIVE_HOOKS_ENTERPRISE_ONLY","YELLOW__UNSTABLE__FAILING_OR_PENDING_NON_REQUIRED_STATUS_OK_TO_MERGE","RED__BEHIND__HEAD_REF_OUT_OF_DATE","RED__BLOCKED__FAILING_OR_MISSING_REQUIRED_STATUS_CHECK","RED__DIRTY__MERGE_CONFLICT","RED__DRAFT__MERGE_BLOCKED_DUE_TO_PULL_REQUEST_BEING_A_DRAFT","RED__UNKNOWN__MERGABILITY_NOT_YET_DETERMINED"]},8986:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GRAPHITE_CHECK_NAME=void 0,t.GRAPHITE_CHECK_NAME="Graphite / mergeability_check"},27716:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createTestMergeRestriction=t.prHasRequiredApproversForFile=t.filterRequiredStatusChecksPayload=t.filterRequiredApproversWithTeamMembersPayload=t.filterNumRequiredApproversPayload=t.computeMergeRulesBlockingReasons=t.GRAPHITE_CHECK_NAME=t.PrMetastatuses=t.MergeStateStatuses=t.GRAPHITE_BASE_BRANCH_PREFIX=t.getPrMissingCodeowners=t.getPrMetastatus=t.getHumanReadablePrMetastatus=t.doesPrHaveOpenReviewRequests=t.doesPrHaveOpenChangesRequested=t.doesPrHaveMissingCodeownerReviews=t.doesPrHaveClosedReviewRequests=t.doesPrHaveMinimumRequiredApprovals=t.isApprover=void 0;var r=n(66703);Object.defineProperty(t,"isApprover",{enumerable:!0,get:function(){return r.isApprover}});var i=n(27962);Object.defineProperty(t,"doesPrHaveMinimumRequiredApprovals",{enumerable:!0,get:function(){return i.doesPrHaveMinimumRequiredApprovals}});var o=n(63261);Object.defineProperty(t,"doesPrHaveClosedReviewRequests",{enumerable:!0,get:function(){return o.doesPrHaveClosedReviewRequests}}),Object.defineProperty(t,"doesPrHaveMissingCodeownerReviews",{enumerable:!0,get:function(){return o.doesPrHaveMissingCodeownerReviews}}),Object.defineProperty(t,"doesPrHaveOpenChangesRequested",{enumerable:!0,get:function(){return o.doesPrHaveOpenChangesRequested}}),Object.defineProperty(t,"doesPrHaveOpenReviewRequests",{enumerable:!0,get:function(){return o.doesPrHaveOpenReviewRequests}}),Object.defineProperty(t,"getHumanReadablePrMetastatus",{enumerable:!0,get:function(){return o.getHumanReadablePrMetastatus}}),Object.defineProperty(t,"getPrMetastatus",{enumerable:!0,get:function(){return o.getPrMetastatus}}),Object.defineProperty(t,"getPrMissingCodeowners",{enumerable:!0,get:function(){return o.getPrMissingCodeowners}}),Object.defineProperty(t,"GRAPHITE_BASE_BRANCH_PREFIX",{enumerable:!0,get:function(){return o.GRAPHITE_BASE_BRANCH_PREFIX}});var s=n(19495);Object.defineProperty(t,"MergeStateStatuses",{enumerable:!0,get:function(){return s.MergeStateStatuses}}),Object.defineProperty(t,"PrMetastatuses",{enumerable:!0,get:function(){return s.PrMetastatuses}});var a=n(8986);Object.defineProperty(t,"GRAPHITE_CHECK_NAME",{enumerable:!0,get:function(){return a.GRAPHITE_CHECK_NAME}});var u=n(57569);Object.defineProperty(t,"computeMergeRulesBlockingReasons",{enumerable:!0,get:function(){return u.computeMergeRulesBlockingReasons}});var c=n(43712);Object.defineProperty(t,"filterNumRequiredApproversPayload",{enumerable:!0,get:function(){return c.filterNumRequiredApproversPayload}}),Object.defineProperty(t,"filterRequiredApproversWithTeamMembersPayload",{enumerable:!0,get:function(){return c.filterRequiredApproversWithTeamMembersPayload}}),Object.defineProperty(t,"filterRequiredStatusChecksPayload",{enumerable:!0,get:function(){return c.filterRequiredStatusChecksPayload}});var l=n(73306);Object.defineProperty(t,"prHasRequiredApproversForFile",{enumerable:!0,get:function(){return l.prHasRequiredApproversForFile}});var d=n(23413);Object.defineProperty(t,"createTestMergeRestriction",{enumerable:!0,get:function(){return d.createTestMergeRestriction}})},57569:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.computeNeedsRequiredApproverBlockingReason=t.computePendingRequiredBlockingReason=t.computeFailingRequiredBlockingReason=t.computeNeedsApprovalBlockingReason=t.computeMergeRulesBlockingReasons=void 0;const r=n(34490),i=n(66703),o=n(73306);function s(e){const{previousReviewers:t,mergeRestrictions:n}=e,r=t.filter(i.isApprover),o=n.filter((e=>"NUM_REQUIRED_APPROVERS"===e.payload.kind)).filter((e=>e.payload.numRequiredApprovers>r.length));return o.length>0?{reason:"GT_NEEDS_APPROVALS",blockingMergeRestrictions:o,numberOfApprovalsNeeded:Math.max(...o.map((e=>e.payload.numRequiredApprovers)))-r.length}:null}function a(e){var t;const n=(null!==(t=e.ciRollup.ciMergeRestrictionsStatus)&&void 0!==t?t:[]).filter((e=>"FAILED"===e.status.status));return n.length>0?{reason:"GT_FAILING_REQUIRED",blockingMergeRestrictions:n.map((({restriction:e})=>e)),failingRequiredChecks:n.flatMap((({status:{failedChecks:e}})=>e))}:null}function u(e){var t;const n=(null!==(t=e.ciRollup.ciMergeRestrictionsStatus)&&void 0!==t?t:[]).filter((e=>"PENDING"===e.status.status));return n.length>0?{reason:"GT_PENDING_REQUIRED",blockingMergeRestrictions:n.map((({restriction:e})=>e)),pendingRequiredChecks:n.flatMap((({status:{pendingChecks:e}})=>e))}:null}function c(e){const{files:t}=e,n=t.filter((t=>!(0,o.prHasRequiredApproversForFile)({file:t,pr:e})));return n.length>0?{reason:"GT_NEEDS_REQUIRED_APPROVER",blockingMergeRestrictionsByFilePath:n.reduce(((e,{filename:t,requiredApproversMergeRestrictions:n})=>(e[t]=n,e)),{})}:null}t.computeMergeRulesBlockingReasons=function(e){return[s(e),a(e),u(e),c(e)].filter(r.filterNull)},t.computeNeedsApprovalBlockingReason=s,t.computeFailingRequiredBlockingReason=a,t.computePendingRequiredBlockingReason=u,t.computeNeedsRequiredApproverBlockingReason=c},43712:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.filterRequiredApproversWithTeamMembersPayload=t.filterRequiredStatusChecksPayload=t.filterNumRequiredApproversPayload=void 0,t.filterNumRequiredApproversPayload=function(e){return"NUM_REQUIRED_APPROVERS"===e.kind},t.filterRequiredStatusChecksPayload=function(e){return"REQUIRED_STATUS_CHECKS"===e.kind},t.filterRequiredApproversWithTeamMembersPayload=function(e){return"REQUIRED_APPROVERS"===e.kind}},73306:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.prHasRequiredApproversForFile=t.prAuthorIsRequiredApproverForFile=t.isUserRequiredApprover=t.isApprovedByRequiredApprover=void 0;const r=n(34490),i=n(66703);function o({requiredApprover:e,approvers:t}){const n=t.map((({username:e})=>e));switch(e.kind){case"USER":return n.includes(e.login);case"TEAM":return e.memberLogins.some((e=>n.includes(e)));default:(0,r.assertUnreachable)(e)}}function s({userLogin:e,payload:t}){return t.requiredApprovers.flatMap((e=>"TEAM"===e.kind?e.memberLogins:[e.login])).includes(e)}function a({authorLogin:e,file:t}){return e&&t.requiredApproversMergeRestrictions.some((({payload:t})=>s({userLogin:e,payload:t})))}t.isApprovedByRequiredApprover=o,t.isUserRequiredApprover=s,t.prAuthorIsRequiredApproverForFile=a,t.prHasRequiredApproversForFile=function({file:e,pr:t}){const{requiredApproversMergeRestrictions:n}=e,{authorLogin:r,previousReviewers:s}=t,u=s.filter(i.isApprover);return 0===n.length||a({authorLogin:r,file:e})||n.some((({payload:{requiredApprovers:e}})=>0===e.length||e.some((e=>o({requiredApprover:e,approvers:u})))))}},23413:(e,t)=>{function n({status:e="PASSING",ciMergeRestrictionsStatus:t=[]}){return{status:e,ciMergeRestrictionsStatus:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.createTestPr=t.createTestCiRollup=t.createTestMergeRestriction=t.createTestFile=t.createTestReviewer=void 0,t.createTestReviewer=function({username:e="username",decision:t="APPROVED",hasWritePermission:n=null}){return{username:e,decision:t,hasWritePermission:n}},t.createTestFile=function({filename:e="filename",codeowners:t=null,requiredApproversMergeRestrictions:n=[]}){return{filename:e,codeowners:t,requiredApproversMergeRestrictions:n}},t.createTestMergeRestriction=function({id:e="1",mergeRuleId:t="1",payload:n={kind:"NUM_REQUIRED_APPROVERS",numRequiredApprovers:1}}){return{id:e,mergeRuleId:t,payload:n}},t.createTestCiRollup=n,t.createTestPr=function({number:e=1,state:t="OPEN",isDraft:r=!1,authorLogin:i="authorLogin",previousReviewers:o=[],hasMergeConflicts:s=!1,isQueuedToMerge:a=!1,isInFailureHandling:u=!1,isWaitingToMerge:c=!1,ciRollup:l=n({}),skipRequiredCi:d=!1,branch:h="branch",parentBranch:f=null,unresolvedThreadCount:m=0,files:p=[],mergeRestrictionsDeprecated:g={},mergeRestrictions:v=[],lastPushedAt:y=new Date,lastBaseRefChangedAt:b=new Date}){return{number:e,state:t,isDraft:r,authorLogin:i,previousReviewers:o,hasMergeConflicts:s,isQueuedToMerge:a,isInFailureHandling:u,isWaitingToMerge:c,hasThirdPartyMergeQueueLabel:!1,hasActiveEntryInGithubMergeQueue:!1,ciRollup:l,skipRequiredCi:d,branch:h,parentBranch:f,unresolvedThreadCount:m,files:p,mergeRestrictionsDeprecated:g,mergeRestrictions:v,lastPushedAt:y,lastBaseRefChangedAt:b}}},8296:(e,t)=>{function n(e){return t=>JSON.stringify(e)===JSON.stringify(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.nullable=t.optional=t.literals=t.intersectMany=t.unionMany=t.intersection=t.union=t.tuple=t.array=t.taggedUnion=t._shapeWithExplicitOptionals=t.shape=t.nulltype=t.boolean=t.string=t.number=t.literal=t.undefinedtype=void 0,t.undefinedtype=e=>void 0===e,t.literal=function(e){return n(e)},t.number=e=>"number"==typeof e,t.string=e=>"string"==typeof e,t.boolean=e=>"boolean"==typeof e,t.nulltype=e=>null===e,t.shape=function(e){return(t,n)=>r(e,t,n)},t._shapeWithExplicitOptionals=function(e){return(t,n)=>r(e,t,n)};const r=(e,t,n)=>"object"==typeof t&&null!==t&&Object.keys(e).every((r=>{const i=e[r]&&e[r](t[r],n);return!i&&(null==n?void 0:n.logFailures)&&console.log(`Member of shape ${JSON.stringify(t[r])} for ${r} does not match expected type`),i}));function i(e,t){return(n,r)=>{const i=e(n,r)||t(n,r);return!i&&(null==r?void 0:r.logFailures)&&console.log(`Member of union "${JSON.stringify(n)}" does not match expected type`),i}}function o(e){return(t,n)=>{const r=e.some((e=>e(t,n)));return!r&&(null==n?void 0:n.logFailures)&&console.log(`Member of union-many ${JSON.stringify(t)} does not expected type`),r}}t.taggedUnion=function(e,t){return(n,r)=>{if("object"!=typeof n||null===n||!(e in n))return(null==r?void 0:r.logFailures)&&console.log("Tagged union is not an object or missing tag"),!1;const i=t[n[e]];return!!i&&Object.keys(i).every((e=>{const t=i[e]&&i[e](n[e],r);return!t&&(null==r?void 0:r.logFailures)&&console.log(`Member of shape ${JSON.stringify(n[e])} for ${e} does not match expected type`),t}))}},t.array=function(e){return(t,n)=>Array.isArray(t)&&t.every((t=>{const r=e(t,n);return!r&&(null==n?void 0:n.logFailures)&&console.log(`Member of array "${JSON.stringify(t)}" does not match expected type`),r}))},t.tuple=function(e){return(t,n)=>Array.isArray(t)&&t.length===e.length&&t.every(((t,r)=>{const i=e[r](t,n);return!i&&(null==n?void 0:n.logFailures)&&console.log(`Member of tuple "${JSON.stringify(t)}" does not match expected type`),i}))},t.union=i,t.intersection=function(e,t){return(n,r)=>{const i=e(n,r)&&t(n,r);return!i&&(null==r?void 0:r.logFailures)&&console.log(`Member of intersection "${JSON.stringify(n)}" does not match expected type`),i}},t.unionMany=o,t.intersectMany=function(e){return(t,n)=>{const r=e.every((e=>e(t,n)));return!r&&(null==n?void 0:n.logFailures)&&console.log(`Member of intersection-many ${JSON.stringify(t)} does not expected type`),r}},t.literals=function(e){return o(e.map((e=>n(e))))},t.optional=function(e){return i(e,t.undefinedtype)},t.nullable=function(e){return i(e,t.nulltype)}},53977:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.request=void 0,t.request=o(n(74911))},74911:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.requestWithArgs=t.formatReqDetails=void 0,n(87686);const s=o(n(16627));function a({apiServer:e,route:t,params:n,queryParams:r,urlParams:i,headers:o,opts:a}){let u=e+(i?s.compile(t.url)(i):t.url),c=null;if("GET"==t.method){if(r){const e=function(e,t){const n=[],r=Object.keys(e);t&&r.sort();for(const t of r){const r=e[t];void 0!==r&&n.push(encodeURIComponent(t)+"="+encodeURIComponent(r))}return n.join("&")}(r,null==a?void 0:a.sortQueryParams);""!=e&&(u+="?"+e)}}else c=t.rawBody?n:JSON.stringify(n);return{url:u,verb:t.method,headers:Object.assign(Object.assign({},o),{"Content-Type":"text/plain"}),body:c}}t.formatReqDetails=a,t.requestWithArgs=function({apiServer:e,route:t,params:n,queryParams:r,urlParams:i,headers:o}){return function({url:e,verb:t,headers:n,body:r}){return fetch(e,Object.assign({method:t,mode:"cors",credentials:"include",headers:n},r?{body:r}:{}))}(a({apiServer:e,route:t,params:n,queryParams:r,urlParams:i,headers:o})).then((e=>t.response&&200===e.status?e.json().then((t=>Object.assign(Object.assign({},t),{_response:e}))):{_response:e}))}},93034:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.bindWithEmptyObject=t.bind=void 0,t.bind=function(e,t){return n=>e(Object.assign(Object.assign({},t),n))},t.bindWithEmptyObject=function(e){return()=>e({})}},42392:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dedup=void 0,t.dedup=function(e,t){const n=new Set,r=[];return e.forEach((e=>{const i=t(e);n.has(i)||(r.push(e),n.add(i))})),r}},64761:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setDifference=void 0,t.setDifference=function({a:e,b:t,itemIdentity:n}){const r=new Set;return t.forEach((e=>r.add(n(e)))),e.filter((e=>!r.has(n(e))))}},7846:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isEmptyObject=void 0,t.isEmptyObject=function(e){return 0===Object.keys(e).length}},73594:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.findIndexOrFail=void 0,t.findIndexOrFail=({array:e,value:t,errorFn:n})=>{const r=e.indexOf(t);if(-1===r)throw n();return r}},10199:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertGlobToRegex=void 0;const n="@@ENTIRE_STRING_IS_GLOBSTAR@@",r="@@GLOBSTAR_AT_END@@",i="@@GLOBSTAR_FOLLOWED_BY_FORWARD_SLASH@@",o="@@STAR@@",s="@@DOT@@";t.convertGlobToRegex=function(e){return[e=>"**"===e?n:e,e=>e.replace(/\*\*$/,r),e=>e.replaceAll("**/",i),e=>e.replaceAll("*",o),e=>e.replaceAll(".",s),e=>e.replaceAll(n,".*"),e=>e.replaceAll(r,".*"),e=>e.replaceAll(i,"([^/]*/)*"),e=>e.replaceAll(o,"[^/]*"),e=>e.replaceAll(s,"\\."),e=>`^${e}`,e=>`${e}$`].reduce(((e,t)=>t(e)),e)}},10458:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.runWithHeartbeat=void 0;const i=n(24938);t.runWithHeartbeat=function(e){return r(this,arguments,void 0,(function*({fn:e,heartbeat:t,heartbeatInterval:n,waitForHeartbeatOnExit:o}){let s=!1,a=!1,u=0;if(yield Promise.race([e(),(()=>r(this,void 0,void 0,(function*(){for(;!s;)yield t(),u++,yield(0,i.sleep)(n);a=!0})))()]),s=!0,o)for(;!a;)yield(0,i.sleep)({milliseconds:5});return{heartbeatCnt:u}}))}},34490:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.timeoutPromise=t.TimeoutError=t.plural=t.numberWithCommas=t.nth=t.humanizeDuration=t.humanizeDate=t.convertStringToNumberOrNull=t.commaSeparatedList=t.waitFor=t.sleep=t.semaphore=t.retryWithSleep=t.mapReduce=t.createLookupTable=t.runWithHeartbeat=t.convertGlobToRegex=t.findIndexOrFail=t.isEmptyObject=t.setDifference=t.dedup=t.bindWithEmptyObject=t.bind=void 0,i(n(23760),t);var o=n(93034);Object.defineProperty(t,"bind",{enumerable:!0,get:function(){return o.bind}}),Object.defineProperty(t,"bindWithEmptyObject",{enumerable:!0,get:function(){return o.bindWithEmptyObject}});var s=n(42392);Object.defineProperty(t,"dedup",{enumerable:!0,get:function(){return s.dedup}});var a=n(64761);Object.defineProperty(t,"setDifference",{enumerable:!0,get:function(){return a.setDifference}});var u=n(7846);Object.defineProperty(t,"isEmptyObject",{enumerable:!0,get:function(){return u.isEmptyObject}});var c=n(73594);Object.defineProperty(t,"findIndexOrFail",{enumerable:!0,get:function(){return c.findIndexOrFail}});var l=n(10199);Object.defineProperty(t,"convertGlobToRegex",{enumerable:!0,get:function(){return l.convertGlobToRegex}});var d=n(10458);Object.defineProperty(t,"runWithHeartbeat",{enumerable:!0,get:function(){return d.runWithHeartbeat}});var h=n(3475);Object.defineProperty(t,"createLookupTable",{enumerable:!0,get:function(){return h.createLookupTable}});var f=n(18655);Object.defineProperty(t,"mapReduce",{enumerable:!0,get:function(){return f.mapReduce}});var m=n(66066);Object.defineProperty(t,"retryWithSleep",{enumerable:!0,get:function(){return m.retryWithSleep}});var p=n(66496);Object.defineProperty(t,"semaphore",{enumerable:!0,get:function(){return p.semaphore}});var g=n(24938);Object.defineProperty(t,"sleep",{enumerable:!0,get:function(){return g.sleep}}),Object.defineProperty(t,"waitFor",{enumerable:!0,get:function(){return g.waitFor}});var v=n(50401);Object.defineProperty(t,"commaSeparatedList",{enumerable:!0,get:function(){return v.commaSeparatedList}}),Object.defineProperty(t,"convertStringToNumberOrNull",{enumerable:!0,get:function(){return v.convertStringToNumberOrNull}}),Object.defineProperty(t,"humanizeDate",{enumerable:!0,get:function(){return v.humanizeDate}}),Object.defineProperty(t,"humanizeDuration",{enumerable:!0,get:function(){return v.humanizeDuration}}),Object.defineProperty(t,"nth",{enumerable:!0,get:function(){return v.nth}}),Object.defineProperty(t,"numberWithCommas",{enumerable:!0,get:function(){return v.numberWithCommas}}),Object.defineProperty(t,"plural",{enumerable:!0,get:function(){return v.plural}});var y=n(69976);Object.defineProperty(t,"TimeoutError",{enumerable:!0,get:function(){return y.TimeoutError}}),Object.defineProperty(t,"timeoutPromise",{enumerable:!0,get:function(){return y.timeoutPromise}})},3475:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createLookupTable=void 0,t.createLookupTable=function({items:e,getKey:t,serializeKey:n}){const r={};return e.forEach((e=>{r[n(t(e))]=e})),e=>r[n(e)]}},18655:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.mapReduce=void 0,t.mapReduce=function(e){return n(this,arguments,void 0,(function*({fn:e,inputs:t,reducer:n,defaultReturn:r}){return(yield Promise.all(t.map(e))).reduce(((e,t)=>n(e,t)),r)}))}},66066:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.retryWithSleep=void 0;const o=i(n(62637)),s=n(24938);t.retryWithSleep=e=>r(void 0,[e],void 0,(function*({fn:e,onRetry:t,options:n}){for(const r of o.default.range(n.maxRetries))try{return yield e()}catch(e){if(r+1>=n.maxRetries)throw e;null==t||t({retryCount:r,err:e}),yield(0,s.sleep)(n.sleepDuration)}throw new Error("Unreachable")}))},66496:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.semaphore=void 0,t.semaphore=function(e,t){let n;const r=new Promise((e=>{n=e})),i=[...t];let o=0;return function t(){const r=i.shift();void 0!==r?(o++,r().catch(console.error).finally((()=>{o--,t()})),o<e&&t()):0===o&&n(void 0)}(),r}},24938:function(e,t){var n=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};function r(e){return n(this,void 0,void 0,(function*(){const t=i(e);yield new Promise((e=>{setTimeout(e,t)}))}))}Object.defineProperty(t,"__esModule",{value:!0}),t.waitFor=t.sleep=void 0,t.sleep=r,t.waitFor=e=>n(void 0,[e],void 0,(function*({condition:e,sleepDuration:t,timeout:n,label:o}){const s=i(t),a=i(null!=n?n:{minutes:1});for(const t=Date.now();Date.now()-t<a;){if(yield e())return;yield r({milliseconds:s})}throw new Error(`Timeout waiting for ${null!=o?o:"condition"}`)}));const i=e=>"minutes"in e?60*e.minutes*1e3:"seconds"in e?1e3*e.seconds:e.milliseconds},50401:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.nth=t.numberWithCommas=t.commaSeparatedList=t.humanizeDuration=t.convertStringToNumberOrNull=t.humanizeDate=t.plural=void 0;const r=n(19577);t.plural=(e,t,n)=>{const r=(null==n?void 0:n.pluralSuffix)||"s";return`${(null==n?void 0:n.prependAIfSingular)&&1===t?"a ":""}${e}${1!==t?r:""}`},t.humanizeDate=(e,t)=>e.toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:null==t?void 0:t.timeZone,timeZoneName:null==t?void 0:t.includeTimeZone}),t.convertStringToNumberOrNull=e=>{if(""===e)return null;const t=+e;return isNaN(t)?null:t},t.humanizeDuration=(e,t)=>{const n=r.Duration.fromObject({seconds:e}).rescale(),i=[];return n.years>0&&i.push(`${n.years}y`),n.months>0&&i.push(`${n.months}mo`),n.days>0&&i.push(`${n.days}d`),n.hours>0&&i.push(`${n.hours}h`),n.minutes>0&&i.push(`${n.minutes}m`),t&&0===i.length&&i.push(`${n.seconds}s`),i.join(" ")},t.commaSeparatedList=e=>{var t;return 0===e.length?"":1===e.length?null!==(t=e[0])&&void 0!==t?t:"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`},t.numberWithCommas=function(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,",")},t.nth=e=>0==e?"zeroth":e%10==1&&e%100!=11?1==e?"first":`${e}st`:e%10==2&&e%100!=12?2==e?"second":`${e}nd`:e%10==3&&e%100!=13?3==e?"third":`${e}rd`:`${e}th`},69976:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timeoutPromise=t.TimeoutError=void 0;class n extends Error{}t.TimeoutError=n,t.timeoutPromise=({promise:e,timeoutMs:t})=>Promise.race([e,new Promise((e=>setTimeout(e,t))).then((()=>{throw new n(`Timeout after ${t}ms`)}))])},23760:(e,t)=>{function n(e){return null!==e}function r(e){return void 0!==e}Object.defineProperty(t,"__esModule",{value:!0}),t.flatNonEmptyArrayOfNonEmptyArrays=t.flatMapNonEmptyArray=t.mapNonEmptyArray=t.isNonEmptyArray=t.filterNullUndefined=t.filterUndefined=t.filterNull=t.setEquals=t.isPropertyValue=t.assertUnreachable=void 0,t.assertUnreachable=function(e){throw new Error(`Didn't expect to get here, arg: ${JSON.stringify(e)}`)},t.isPropertyValue=function(e,t){return Object.values(e).includes(t)},t.setEquals=function(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0},t.filterNull=n,t.filterUndefined=r,t.filterNullUndefined=function(e){return n(e)&&r(e)},t.isNonEmptyArray=function(e){return void 0!==e[0]},t.mapNonEmptyArray=function(e,t){return e.map(t)},t.flatMapNonEmptyArray=function(e,t){return e.flatMap(t)},t.flatNonEmptyArrayOfNonEmptyArrays=function(e){return e.flat()}},6016:(e,t,n)=>{n.r(t),n.d(t,{startServer:()=>ce});var r=n(98696),i=n(57147),o=n.n(i),s=n(13685),a=n.n(s),u=n(71017),c=n.n(u),l=n(57310),d=n.n(l),h=n(95352),f=n.n(h),m=n(79115),p=n(95808),g=n(43597),v=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};const y=m.sendAnalyticsEvent;var b=n(22037),E=n.n(b);function _(){try{return E().userInfo().username}catch(e){try{const{env:e}=process;return(0,r.unwrap)(e.LOGNAME||e.USER||e.LNAME||e.USERNAME)}catch(t){throw new Error(String(t)+String(e))}}}class w{constructor(e,t){this.logger=e,this.data=t}setRepo(e){var t;this.data.repo=null===(t=null==e?void 0:e.codeReviewProvider)||void 0===t?void 0:t.getSummaryName()}}const C=e=>{};var R=n(73837),O=n.n(R);const S=console;var P=n(34987),A=n.n(P),T=n(59778),M=n.n(T),D=n(82361);class N extends D.EventEmitter{}var I=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};class k{constructor(e,t){this.codeReviewSystem=e,this.runCommand=t,this.diffSummaries=new N}onChangeDiffSummaries(e){const t=t=>e({value:t}),n=t=>e({error:t});return this.diffSummaries.on("data",t),this.diffSummaries.on("error",n),{dispose:()=>{this.diffSummaries.off("data",t),this.diffSummaries.off("error",n)}}}triggerDiffSummariesFetch(e){return I(this,void 0,void 0,(function*(){const e=yield this.runCommand(["internal-only","prs"]),t=JSON.parse(e.stdout);this.diffSummaries.emit("data",t)}))}dispose(){this.diffSummaries.removeAllListeners()}getSummaryName(){return`github:${this.codeReviewSystem.hostname}/${this.codeReviewSystem.owner}/${this.codeReviewSystem.repo}`}runExternalCommand(e,t,n,r){throw new Error("GitHub code review provider does not support running external commands")}typeahead(e,t){return I(this,void 0,void 0,(function*(){return Promise.resolve([])}))}}class j{constructor(e,t){this.logger=e,this.runCallback=t,this.queuedOperations=[],this.runningOperation=void 0,this.abortController=void 0}runOrQueueOperation(e,t,n,r){return i=this,o=void 0,a=function*(){if(null!=this.runningOperation)return this.queuedOperations.push(Object.assign(Object.assign({},e),{tracker:n})),void t({id:e.id,kind:"queue",queue:this.queuedOperations.map((e=>e.id))});this.runningOperation=e;const i=(...n)=>{switch(n[0]){case"spawn":t({id:e.id,kind:"spawn",queue:this.queuedOperations.map((e=>e.id))});break;case"stdout":t({id:e.id,kind:"stdout",message:n[1]});break;case"stderr":t({id:e.id,kind:"stderr",message:n[1]});break;case"exit":t({id:e.id,kind:"exit",exitCode:n[1],timestamp:Date.now()})}};try{const o=new AbortController;if(this.abortController=o,yield n.operation(e.trackEventName,"RunOperationError",{extras:{args:e.args,runner:e.runner}},(t=>this.runCallback(e,r,i,o.signal))),this.runningOperation=void 0,this.queuedOperations.length>0){const e=this.queuedOperations.shift();null!=e&&this.runOrQueueOperation(e,t,e.tracker,r)}}catch(n){const r=n.toString();this.logger.log("error running operation: ",e.args[0],r),t({id:e.id,kind:"error",error:r}),this.queuedOperations=[],this.runningOperation=void 0}},new((s=void 0)||(s=Promise))((function(e,t){function n(e){try{u(a.next(e))}catch(e){t(e)}}function r(e){try{u(a.throw(e))}catch(e){t(e)}}function u(t){var i;t.done?e(t.value):(i=t.value,i instanceof s?i:new s((function(e){e(i)}))).then(n,r)}u((a=a.apply(i,o||[])).next())}));var i,o,s,a}abortRunningOperation(e){var t,n;(null===(t=this.runningOperation)||void 0===t?void 0:t.id)==e&&(null===(n=this.abortController)||void 0===n||n.abort())}}class x{constructor(){this.focusedPages=new Set,this.visiblePages=new Set,this.onChangeHandlers=new Set}setState(e,t){switch(t){case"focused":this.focusedPages.add(e),this.visiblePages.add(e);break;case"visible":this.focusedPages.delete(e),this.visiblePages.add(e);break;case"hidden":this.focusedPages.delete(e),this.visiblePages.delete(e)}for(const e of this.onChangeHandlers)e(t)}disposePage(e){this.focusedPages.delete(e),this.visiblePages.delete(e)}hasPageWithFocus(){return this.focusedPages.size>0}hasVisiblePage(){return this.visiblePages.size>0}onChange(e){return this.onChangeHandlers.add(e),()=>this.onChangeHandlers.delete(e)}}class F{constructor(e,t){this.maxSimultaneousRunning=e,this.log=t,this.queued=[],this.running=[],this.runs=new N,this.nextId=1}generateId(){return this.nextId++}enqueueRun(e){var t,n,r,i,o;return n=this,r=void 0,o=function*(){const n=this.generateId();this.queued.push(n),this.tryDequeueNext(),this.running.includes(n)||(null===(t=this.log)||void 0===t||t.call(this,`${this.running.length} tasks are already running, enqueuing ID:${n}`),yield new Promise((e=>{this.runs.on("run",(t=>{var r;t===n&&(null===(r=this.log)||void 0===r||r.call(this,`now allowing ID:${n} to run`),e(void 0))}))})));try{return yield e()}finally{this.notifyFinished(n)}},new((i=void 0)||(i=Promise))((function(e,t){function s(e){try{u(o.next(e))}catch(e){t(e)}}function a(e){try{u(o.throw(e))}catch(e){t(e)}}function u(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(s,a)}u((o=o.apply(n,r||[])).next())}))}notifyFinished(e){this.running=this.running.filter((t=>t!==e)),this.tryDequeueNext()}tryDequeueNext(){if(this.running.length<this.maxSimultaneousRunning){const e=this.queued.shift();null!=e&&this.run(e)}}run(e){this.running.push(e),this.runs.emit("run",e)}}function G(e){let t,n;const r=()=>{const t=e();return n=t.then((()=>n=void 0),(()=>n=void 0)),t},i=()=>(t=void 0,r());return()=>null==n?r():(()=>{if(null==t){if(null==n)throw new Error("pendingCall must not be null!");t=n.then(i,i)}return t})()}function H(e){switch(e.type){case r.ComparisonType.UncommittedChanges:return["uncommitted"];case r.ComparisonType.HeadChanges:return["head"];case r.ComparisonType.StackChanges:return["stack"];case r.ComparisonType.Committed:return["stack","--ref",e.hash];default:throw new Error("Unsupported comparison type: "+e.type)}}var B=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};const L="1.0.14";class U{onDidDispose(e){this.disposables.push(e)}constructor(e,t,n){this.info=e,this.platform=t,this.logger=n,this.IGNORE_COMMIT_MESSAGE_LINES_REGEX=/^((?:HG|SL):.*)/gm,this.mergeConflicts=void 0,this.uncommittedChanges=null,this.smartlogCommits=null,this.mergeConflictsEmitter=new N,this.uncommittedChangesEmitter=new N,this.smartlogCommitsChangesEmitter=new N,this.smartlogCommitsBeginFetchingEmitter=new N,this.uncommittedChangesBeginFetchingEmitter=new N,this.disposables=[()=>this.mergeConflictsEmitter.removeAllListeners(),()=>this.uncommittedChangesEmitter.removeAllListeners(),()=>this.smartlogCommitsChangesEmitter.removeAllListeners(),()=>this.smartlogCommitsBeginFetchingEmitter.removeAllListeners(),()=>this.uncommittedChangesBeginFetchingEmitter.removeAllListeners()],this.pageFocusTracker=new x,this.currentVisibleCommitRangeIndex=0,this.visibleCommitRanges=[r.DEFAULT_DAYS_OF_COMMITS_TO_LOAD,60,void 0],this.checkForMergeConflicts=(0,r.debounce)(G((()=>B(this,void 0,void 0,(function*(){var e,t;this.logger.info("checking for merge conflicts");const n=null!=this.mergeConflicts;if(!n&&!(yield(r=c().join(this.info.dotdir,"rebase-merge"),o().promises.stat(r).then((()=>!0)).catch((e=>{if("ENOENT"===e.code)return!1;throw e})))))return void this.logger.info(`conflict state still the same (${n?"IN merge conflict":"NOT in conflict"})`);var r;null==this.mergeConflicts&&(this.mergeConflicts={state:"loading"},this.mergeConflictsEmitter.emit("change",this.mergeConflicts));const i=Date.now();let s;try{const e=yield this.runCommand(["internal-only","status"]);s=JSON.parse(e.stdout)}catch(e){return this.logger.error(`failed to check for merge conflicts: ${e}`),this.mergeConflicts=void 0,void this.mergeConflictsEmitter.emit("change",this.mergeConflicts)}const a=yield o().promises.readFile(c().join(this.info.dotdir,"rebase-merge","head-name")).then((e=>{const t=e.toString();return t.startsWith("refs/heads/")?t.slice(11).trimEnd():void 0}),(()=>{}));if(this.mergeConflicts=function(e,t,n,r){const i=n;if(!(null==i?void 0:i.conflicts)||!t)return;const o=i.files.filter((e=>"UNRESOLVED"===e.status)),s={state:"loaded",branchName:t,files:[],fetchStartTimestamp:r,fetchCompletedTimestamp:Date.now()};if(null!=(null==e?void 0:e.files)&&e.files.length>0){const t=new Set(o.map((e=>e.path)));s.files=e.files.map((e=>t.has(e.path)?{path:e.path,status:"UNRESOLVED"}:{path:e.path,status:"RESOLVED"}))}else s.files=o.map((e=>({path:e.path,status:"UNRESOLVED"})));return s}(this.mergeConflicts,a,s,i),this.logger.info(`repo ${this.mergeConflicts?"IS":"IS NOT"} in merge conflicts`,{mergeConflicts:this.mergeConflicts,files:null===(e=this.mergeConflicts)||void 0===e?void 0:e.files}),this.mergeConflicts){const e=20,n=(null!==(t=this.mergeConflicts.files)&&void 0!==t?t:[]).filter((e=>"UNRESOLVED"===e.status)).map((e=>e.path)).slice(0,e);this.logger.info("remaining files with conflicts: ",{branchName:a,remainingConflicts:n})}this.mergeConflictsEmitter.emit("change",this.mergeConflicts)})))),100),this.fetchUncommittedChanges=(0,r.debounce)(G((()=>B(this,void 0,void 0,(function*(){const e=Date.now();try{this.uncommittedChangesBeginFetchingEmitter.emit("start");const t=yield this.runCommand(["internal-only","status"]),n=JSON.parse(t.stdout).files.map((e=>{return Object.assign(Object.assign({},e),{path:(t=e.path,t.startsWith(c().sep)?t.slice(1):t)});var t}));this.uncommittedChanges={fetchStartTimestamp:e,fetchCompletedTimestamp:Date.now(),files:{value:n}},this.uncommittedChangesEmitter.emit("change",this.uncommittedChanges)}catch(n){if(this.logger.error("Error fetching files: ",n),null!=(t=n)&&"object"==typeof t&&"stderr"in t&&n.stderr.includes("checkout is currently in progress"))return void this.logger.info("Ignoring `hg status` error caused by in-progress checkout");this.uncommittedChangesEmitter.emit("change",{fetchStartTimestamp:e,fetchCompletedTimestamp:Date.now(),files:{error:n instanceof Error?n:new Error(n)}})}var t})))),100),this.fetchSmartlogCommits=(0,r.debounce)(G((()=>B(this,void 0,void 0,(function*(){const e=Date.now();try{this.smartlogCommitsBeginFetchingEmitter.emit("start");const t=yield this.runCommand(["internal-only","log"]),n=function(e,t){let n=[];try{n=JSON.parse(t)}catch(t){e.error("failed to parse branch info",t)}return n}(this.logger,t.stdout.trim());if(0===n.length)throw new Error(r.ErrorShortMessages.NoCommitsFetched);this.smartlogCommits={fetchStartTimestamp:e,fetchCompletedTimestamp:Date.now(),commits:{value:n}},this.smartlogCommitsChangesEmitter.emit("change",this.smartlogCommits)}catch(t){this.logger.error("Error fetching commits: ",t),this.smartlogCommitsChangesEmitter.emit("change",{fetchStartTimestamp:e,fetchCompletedTimestamp:Date.now(),commits:{error:t instanceof Error?t:new Error(t)}})}})))),100),this.catLimiter=new F(4,(e=>this.logger.info("[cat]",e)));const i=e.codeReviewSystem;"github"===i.type&&(this.codeReviewProvider=new k(i,this.runCommand.bind(this))),this.watchForChangesDisposer=t.watchForChanges(e,n,(e=>{"uncommitted changes"===e?(this.fetchUncommittedChanges(),this.checkForMergeConflicts()):"branches"===e?this.fetchSmartlogCommits():"merge conflicts"===e?this.checkForMergeConflicts():"everything"===e&&(this.fetchUncommittedChanges(),this.fetchSmartlogCommits(),this.checkForMergeConflicts())})),this.operationQueue=new j(this.logger,((e,t,n,i)=>{var o,s,a;if(e.runner===r.CommandRunner.Graphite)return this.runOperation(e,n,t,i);if(e.runner===r.CommandRunner.CodeReviewProvider){const r=this.normalizeOperationArgs(t,e.args);return null==(null===(o=this.codeReviewProvider)||void 0===o?void 0:o.runExternalCommand)?Promise.reject(Error("CodeReviewProvider does not support running external commands")):null!==(a=null===(s=this.codeReviewProvider)||void 0===s?void 0:s.runExternalCommand(t,r,n,i))&&void 0!==a?a:Promise.resolve()}return Promise.resolve()}));const s=new Set,a=this.subscribeToSmartlogCommitsChanges((e=>{var t;if(e.commits.value){const n=[],r=e.commits.value.filter((e=>e.pr)).map((e=>{var t;return null===(t=e.pr)||void 0===t?void 0:t.number}));for(const e of r)s.has(e)||(n.push(e),s.add(e));n.length>0&&(null===(t=this.codeReviewProvider)||void 0===t||t.triggerDiffSummariesFetch(this.getAllDiffIds()))}}));this.checkForMergeConflicts(),this.disposables.push((()=>a.dispose()))}nextVisibleCommitRangeInDays(){return this.currentVisibleCommitRangeIndex+1<this.visibleCommitRanges.length&&this.currentVisibleCommitRangeIndex++,this.visibleCommitRanges[this.currentVisibleCommitRangeIndex]}dispose(){var e,t;this.disposables.forEach((e=>e())),null===(e=this.codeReviewProvider)||void 0===e||e.dispose(),null===(t=this.watchForChangesDisposer)||void 0===t||t.call(this)}onChangeConflictState(e){return this.mergeConflictsEmitter.on("change",e),this.mergeConflicts&&e(this.mergeConflicts),{dispose:()=>this.mergeConflictsEmitter.off("change",e)}}getMergeConflicts(){return this.mergeConflicts}static getRepoInfo(e,t,n){return B(this,void 0,void 0,(function*(){const r=yield function(e,t,n){return B(this,void 0,void 0,(function*(){try{return(yield q({command:e,args:["--version"],logger:t,cwd:n})).stdout}catch(e){throw t.error(`Failed to find gt version in ${n}`,e),e}}))}(e,t,n).catch((e=>e));if(r instanceof Error)return{type:"invalidCommand",command:null!=e?e:"gt"};if("local"!==r&&"dev"!==r&&M().lt(r,L))return{type:"invalidVersion",command:null!=e?e:"gt",versionFound:r,versionRequired:L};const[i,o,s,a]=yield Promise.all([W(e,t,n),$(e,t,n),V(e,t,n,"graphite.branch_edit").then((e=>{var t;return null!==(t=e)&&void 0!==t?t:"amend"})),V(e,t,n,"graphite.create_prs_as").then((e=>{var t;return null!==(t=e)&&void 0!==t?t:"draft"}))]);if(null==o)return{type:"cwdNotARepository",cwd:n};let u;if(void 0===o.remote)u={type:"none"};else{const{owner:e,name:t,hostname:n}=o.remote;u={type:"github",owner:e,repo:t,hostname:n}}const c={type:"success",command:e,dotdir:o.dotDir,repoRoot:o.rootDir,codeReviewSystem:u,preferredBranchEdit:s,createPrsAs:a,profile:i,trunkBranch:o.trunkBranch};return t.info("repo info: ",c),c}))}runOrQueueOperation(e,t,n,r){return B(this,void 0,void 0,(function*(){yield this.operationQueue.runOrQueueOperation(e,t,n,r)}))}abortRunningOpeation(e){this.operationQueue.abortRunningOperation(e)}normalizeOperationArgs(e,t){const n=(0,r.unwrap)(this.info.repoRoot);return t.map((t=>{if("object"==typeof t)switch(t.type){case"repo-relative-file":return c().normalize(c().relative(e,c().join(n,t.path)));case"succeedable-revset":return`max(successors(${t.revset}))`}return t}))}runOperation(e,t,n,r){var i,o;return B(this,void 0,void 0,(function*(){const s=this.normalizeOperationArgs(n,e.args),{stdin:a}=e,{command:u,args:c,options:l}=K(this.info.command,s,n,a?{input:a}:void 0);this.logger.log("run operation: ",u,s.join(" "));const d=A()(u,c,Object.assign(Object.assign({},l),{stdout:"pipe",stderr:"pipe"}));t("spawn"),null===(i=d.stdout)||void 0===i||i.on("data",(e=>{t("stdout",e.toString())})),null===(o=d.stderr)||void 0===o||o.on("data",(e=>{t("stderr",e.toString())})),d.on("exit",(e=>{t("exit",e||0)})),r.addEventListener("abort",(()=>{this.logger.log("kill operation: ",u,s.join(" "))})),function(e,t){t.addEventListener("abort",(()=>{"win32"==E().platform()?e.kill("SIGKILL",{forceKillAfterTimeout:!1}):(e.kill("SIGCONT"),e.kill("SIGTERM",{forceKillAfterTimeout:5e3}))}))}(d,r),yield d}))}setPageFocus(e,t){this.pageFocusTracker.setState(e,t)}getUncommittedChanges(){return this.uncommittedChanges}subscribeToUncommittedChanges(e){return this.uncommittedChangesEmitter.on("change",e),{dispose:()=>{this.uncommittedChangesEmitter.off("change",e)}}}getSmartlogCommits(){return this.smartlogCommits}subscribeToSmartlogCommitsChanges(e){return this.smartlogCommitsChangesEmitter.on("change",e),{dispose:()=>{this.smartlogCommitsChangesEmitter.off("change",e)}}}subscribeToSmartlogCommitsBeginFetching(e){const t=()=>e(!0);return this.smartlogCommitsBeginFetchingEmitter.on("start",t),{dispose:()=>{this.smartlogCommitsBeginFetchingEmitter.off("start",t)}}}subscribeToUncommittedChangesBeginFetching(e){const t=()=>e(!0);return this.uncommittedChangesBeginFetchingEmitter.on("start",t),{dispose:()=>{this.uncommittedChangesBeginFetchingEmitter.off("start",t)}}}subscribeToHeadCommit(e){var t,n;let r=null===(n=null===(t=this.smartlogCommits)||void 0===t?void 0:t.commits.value)||void 0===n?void 0:n.find((e=>e.isHead));null!=r&&e(r);const i=t=>{var n;const i=null===(n=null==t?void 0:t.commits.value)||void 0===n?void 0:n.find((e=>e.isHead));null!=i&&i.branch!==(null==r?void 0:r.branch)&&(e(i),r=i)};return this.smartlogCommitsChangesEmitter.on("change",i),{dispose:()=>{this.smartlogCommitsChangesEmitter.off("change",i)}}}relativeCat(e,t){const n=c().relative(this.info.repoRoot,e);return this.catLimiter.enqueueRun((()=>B(this,void 0,void 0,(function*(){return(yield this.runCommand(["internal-only","relative-cat",...this.catArgs(t,n)],void 0,{stripFinalNewline:!1})).stdout}))))}cat(e,t){const n=c().relative(this.info.repoRoot,e);return this.catLimiter.enqueueRun((()=>B(this,void 0,void 0,(function*(){return(yield this.runCommand(["internal-only","cat",t,n],void 0,{stripFinalNewline:!1})).stdout}))))}catArgs(e,t){switch(e.type){case r.ComparisonType.UncommittedChanges:return["uncommitted",t];case r.ComparisonType.HeadChanges:return["head",t];case r.ComparisonType.StackChanges:return["stack",t];case r.ComparisonType.Committed:return["stack",t,"--ref",e.hash]}}getAllDiffIds(){var e,t,n;return null!==(n=null===(t=null===(e=this.getSmartlogCommits())||void 0===e?void 0:e.commits.value)||void 0===t?void 0:t.map((e=>{var t;return null===(t=e.pr)||void 0===t?void 0:t.number})).filter(r.notEmpty))&&void 0!==n?n:[]}runCommand(e,t,n){return q({command:this.info.command,args:e,logger:this.logger,cwd:(0,r.unwrap)(null!=t?t:this.info.repoRoot),options:n})}getConfig(e){return V(this.info.command,this.logger,this.info.repoRoot,e)}setConfig(e,t,n){return function({command:e,logger:t,cwd:n,level:r,configName:i,configValue:o}){return B(this,void 0,void 0,(function*(){yield q({command:e,args:["internal-only","set-config","--level",r,i,o],logger:t,cwd:n})}))}({command:this.info.command,logger:this.logger,cwd:this.info.repoRoot,level:e,configName:t,configValue:n})}}function q({command:e,args:t,logger:n,cwd:r,options:i}){const{command:o,args:s,options:a}=K(e,t,r,i);return n&&n.log("run command: ",o,...s,a),A()(o,s,a)}function $(e,t,n){return B(this,void 0,void 0,(function*(){try{return JSON.parse((yield q({command:e,args:["internal-only","repo-info"],logger:t,cwd:n})).stdout)}catch(e){return void t.error(`Failed to find repository info in ${n}`,e)}}))}function W(e,t,n){return B(this,void 0,void 0,(function*(){try{return JSON.parse((yield q({command:e,args:["internal-only","profile"],logger:t,cwd:n})).stdout)}catch(e){return t.error(`Failed to find repository profile in ${n}`,e),{appUrl:"https://app.graphite.dev/"}}}))}function V(e,t,n,r){return B(this,void 0,void 0,(function*(){try{return(yield q({command:e,args:["internal-only","config",r],logger:t,cwd:n})).stdout.trim()}catch(e){return}}))}function K(e,t,n,r){let i=[...t];"win32"!==process.platform&&(i=i.map((e=>e.replace(/\\\\/g,"\\"))));const o=Object.assign(Object.assign({},r),{env:{LANG:"en_US.utf-8",EDITOR:void 0,GRAPHITE_INTERACTIVE:"true",GIT_OPTIONAL_LOCKS:"0"},cwd:n});return!e&&process.argv[1].startsWith("/snapshot/")?(e=process.argv[0],i=["/snapshot/monologue/apps/public/cli/dist/graphite.js",...i]):e||(e="gt"),{command:e,args:i,options:o}}var Q=n(32081),z=n(44828);const J={platformName:"browser",watchForChanges:(e,t,n)=>{const{repoRoot:r,dotdir:i}=e,o=z.watch(i,{cwd:i});o.on("ready",(()=>{n("everything")})),o.on("all",((e,t)=>{t.startsWith("rebase-merge")&&n("merge conflicts"),(t.startsWith("index")||t.startsWith("HEAD"))&&n("uncommitted changes"),(t.startsWith("refs/heads")||t.startsWith("refs/branch-metadata")||t.startsWith("HEAD"))&&n("branches")}));const s=c().relative(r,i),a=z.watch(r,{cwd:r,ignored:`${s}/**`});return a.on("all",(()=>{n("uncommitted changes")})),()=>{a.close().catch((()=>t.error(`failed to close chokidar worktree watcher for ${r}`))),o.close().catch((()=>t.error(`failed to close chokidar dotdir watcher for ${i}`)))}},handleMessageFromClient:(e,t)=>{switch(t.type){case"platform/openFile":{const n=c().join((0,r.unwrap)(null==e?void 0:e.info.repoRoot),t.path);let i;if(null==i)switch(process.platform){case"darwin":i="/usr/bin/open";break;case"win32":i="notepad.exe";break;case"linux":i="xdg-open"}if(i){null==e||e.logger.log("open file",n);const t=(0,Q.spawn)(i,[n],{detached:!0,stdio:"ignore",windowsHide:!1,windowsVerbatimArguments:!0});t.on("error",(t=>{null==e||e.logger.log("failed to open",n,t)})),t.unref()}break}}}};var Y=n(73292),X=n(9826),Z=n.n(X);class ee{constructor(e,t){this.promise=e,this.disposeFunc=t,this.disposed=!1}unref(){this.disposed||(this.disposed=!0,this.disposeFunc())}}class te{constructor(e){this.value=e,this.references=0,this.isDisposed=!1}ref(){this.references++}getNumberOfReferences(){return this.references}dispose(){this.references--,this.isDisposed||0!==this.references||(this.isDisposed=!0,this.value.dispose())}}const ne=new class{constructor(e=U){this.RepositoryType=e,this.reposByRoot=new Map,this.activeReposEmitter=new N}lookup(e){for(const n of this.reposByRoot.values())if((e===n.value.info.repoRoot||e.startsWith((t=n.value.info.repoRoot).endsWith(c().sep)?t:t+c().sep))&&!n.isDisposed)return n;var t}getOrCreate(e,t,n,r){const i=this.lookup(r);if(i)return i.ref(),new ee(Promise.resolve(i.value),(()=>i.dispose()));let o;return o=new ee((()=>{return i=this,s=void 0,u=function*(){const i=yield this.RepositoryType.getRepoInfo(e,n,r);if(n.info("repoInfo",i),"success"!==i.type)return i;if(o.disposed)return{type:"unknownError",error:new Error("Repository already disposed")};const s=this.lookup(i.repoRoot);if(s)return s.ref(),o.internalReference=s,s.value;const a=new this.RepositoryType(i,t,n),u=new te(a);return u.ref(),o.internalReference=u,this.reposByRoot.set(i.repoRoot,u),this.activeReposEmitter.emit("change"),a},new((a=void 0)||(a=Promise))((function(e,t){function n(e){try{o(u.next(e))}catch(e){t(e)}}function r(e){try{o(u.throw(e))}catch(e){t(e)}}function o(t){var i;t.done?e(t.value):(i=t.value,i instanceof a?i:new a((function(e){e(i)}))).then(n,r)}o((u=u.apply(i,s||[])).next())}));var i,s,a,u})(),(()=>{o.internalReference&&o.internalReference.dispose(),o.unref()})),o}cachedRepositoryForPath(e){const t=this.lookup(e);return null==t?void 0:t.value}onChangeActiveRepos(e){const t=()=>{e([...this.reposByRoot.values()].map((e=>e.value)))};return this.activeReposEmitter.on("change",t),t(),()=>this.activeReposEmitter.off("change",t)}clearCache(){this.reposByRoot.forEach((e=>e.dispose())),this.reposByRoot=new Map,this.activeReposEmitter.removeAllListeners()}numberOfActiveServers(){let e=0;for(const t of this.reposByRoot.values())e+=t.getNumberOfReferences();return e}};class re{constructor(e,t,n,i){this.platform=e,this.connection=t,this.tracker=n,this.logger=i,this.listenersByType=new Map,this.repoDisposables=[],this.subscriptions=new Map,this.queuedMessages=[],this.currentState={type:"loading"},this.pageId=(0,r.randomId)();let o=null;this.incomingListener=this.connection.onDidReceiveMessage(((e,n)=>{var i,s,a;if(n)return null==o?void(null===(i=t.logger)||void 0===i||i.error("Error: got a binary message when not expecting one")):(this.handleIncomingMessageWithPayload(o,e),void(o=null));if(null!=o)return null===(s=t.logger)||void 0===s||s.error("Error: didnt get binary payload after a message that requires one"),void(o=null);const u=e.toString("utf-8"),c=(0,r.deserializeFromString)(u);if(function(e){return null!=e&&"object"==typeof e&&!0===e.hasBinaryPayload}(c))o=c;else if("loading"===this.currentState.type)this.queuedMessages.push(c);else try{this.handleIncomingMessage(c)}catch(e){null===(a=t.logger)||void 0===a||a.error("error handling incoming message: ",c,e)}}))}setRepoError(e){this.disposeRepoDisposables(),this.currentState={type:"error",error:e},this.tracker.context.setRepo(void 0),this.processQueuedMessages()}setCurrentRepo(e,t){this.disposeRepoDisposables(),this.currentState={type:"repo",repo:e,cwd:t},this.tracker.context.setRepo(e),null!=e.codeReviewProvider&&this.repoDisposables.push(e.codeReviewProvider.onChangeDiffSummaries((e=>{this.postMessage({type:"fetchedDiffSummaries",summaries:e})}))),this.repoDisposables.push(e.subscribeToHeadCommit((t=>{const n=e.getSmartlogCommits(),r=function(e,t){let n;if(null!=e){const r=new Map(e.map((e=>[e.branch,e])));let i=t;for(;null!=i;){if(i.partOfTrunk){n=i;break}if(null==i.parents[0])break;i=r.get(i.parents[0])}}return n}(null==n?void 0:n.commits.value,t);this.tracker.track("HeadCommitChanged",{extras:{hash:t.branch,public:null==r?void 0:r.branch}})}))),this.processQueuedMessages()}postMessage(e){this.connection.postMessage((0,r.serializeToString)(e)).catch((()=>{console.warn("Failed to post message to client")}))}setActiveRepoForCwd(e){void 0!==this.activeRepoRef&&this.activeRepoRef.unref(),this.logger.info(`Setting active repo cwd to ${e}`),this.currentState={type:"loading"};const t=this.connection.command;this.activeRepoRef=ne.getOrCreate(t,this.platform,this.logger,e),this.activeRepoRef.promise.then((t=>{t instanceof U?this.setCurrentRepo(t,e):this.setRepoError(t)}))}dispose(){this.incomingListener.dispose(),this.disposeRepoDisposables(),void 0!==this.activeRepoRef&&this.activeRepoRef.unref()}disposeRepoDisposables(){this.repoDisposables.forEach((e=>e.dispose())),this.repoDisposables=[],this.subscriptions.forEach((e=>e.dispose())),this.subscriptions.clear()}processQueuedMessages(){var e;for(const t of this.queuedMessages)try{this.handleIncomingMessage(t)}catch(n){null===(e=this.connection.logger)||void 0===e||e.error("error handling queued message: ",t,n)}this.queuedMessages=[]}handleIncomingMessageWithPayload(e,t){switch(e.type){case"uploadFile":{const{id:n,filename:i}=e,o=null;if(null==o)return;this.tracker.operation("UploadImage","UploadImageError",{},(()=>o((0,r.unwrap)(this.connection.logger),{filename:i,data:t}))).then((e=>{var t;null===(t=this.connection.logger)||void 0===t||t.info("sucessfully uploaded file",i,e),this.postMessage({type:"uploadFileResult",id:n,result:{value:e}})})).catch((e=>{var t;null===(t=this.connection.logger)||void 0===t||t.info("error uploading file",i,e),this.postMessage({type:"uploadFileResult",id:n,result:{error:e}})}));break}}}handleIncomingMessage(e){this.handleIncomingGeneralMessage(e);const{currentState:t}=this;switch(t.type){case"repo":{const{repo:n,cwd:r}=t;this.handleIncomingMessageWithRepo(e,n,r);break}case"loading":case"error":e.type.startsWith("platform/")&&(this.platform.handleMessageFromClient(void 0,e,(e=>this.postMessage(e)),(e=>{this.repoDisposables.push({dispose:e})})),this.notifyListeners(e))}}handleIncomingGeneralMessage(e){switch(this.logger.info("GeneralMessage",e),e.type){case"installCli":("brew"===e.method?A()("brew",["install","withgraphite/tap/graphite"]):A()("npm",["install","-g","@withgraphite/graphite-cli@stable"])).then((()=>{this.postMessage({type:"installCliResult",result:"success"})})).catch((e=>{const t=e instanceof Error?e.message:"Unknown error";this.postMessage({type:"installCliResult",result:"error",error:t})}));break;case"updateCli":Z()("gt").then((e=>{return t=this,n=void 0,i=function*(){const t=yield(0,Y.realpath)(e),n="lib/node_modules/@withgraphite/graphite-cli/graphite.js";if(t.endsWith(n)){const e=t.replace(n,"bin/npm");return A()(e,["install","-g","@withgraphite/graphite-cli@stable"])}if(t.endsWith("/bin/gt")&&t.includes("Cellar"))return yield A()("brew",["update"]),A()("brew",["upgrade","withgraphite/tap/graphite"]);throw new Error("Couldn't determine installation method")},new((r=void 0)||(r=Promise))((function(e,o){function s(e){try{u(i.next(e))}catch(e){o(e)}}function a(e){try{u(i.throw(e))}catch(e){o(e)}}function u(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(s,a)}u((i=i.apply(t,n||[])).next())}));var t,n,r,i})).then((()=>{this.postMessage({type:"updateCliResult",result:"success"})})).catch((e=>{this.postMessage({type:"updateCliResult",result:"error",error:e instanceof Error?e.message:"Unknown error"})}));break;case"fetchAllBranches":q({command:this.connection.command||"gt",args:["internal-only","all-branches"],cwd:this.connection.cwd}).then((e=>({value:JSON.parse(e.stdout)}))).catch((e=>{var t;return null===(t=this.logger)||void 0===t||t.error("error fetching auth status",e.toString()),{error:e}})).then((e=>{e.value&&this.postMessage({type:"fetchedAllBranches",message:e.value})}));break;case"initializeRepository":this.logger.info("init"),q({command:this.connection.command||"gt",args:["init","--trunk",e.trunkBranch],cwd:this.connection.cwd}).then((e=>{this.logger.info("initializeRepository",e),e.exitCode&&this.postMessage({type:"failedToInitializeRepository"}),this.postMessage({type:"initializedRepository"})})).catch((()=>{this.postMessage({type:"failedToInitializeRepository"})}));break;case"track":this.tracker.trackData(e.data);break;case"changeCwd":this.setActiveRepoForCwd(e.cwd);break;case"requestRepoInfo":switch(this.currentState.type){case"repo":this.postMessage({type:"repoInfo",info:this.currentState.repo.info,cwd:this.currentState.cwd});break;case"error":this.postMessage({type:"repoInfo",info:this.currentState.error})}break;case"requestApplicationInfo":this.postMessage({type:"applicationInfo",platformName:this.platform.platformName,version:this.connection.version})}}handleIncomingMessageWithRepo(e,t,n){var i,s,a,u,l;const{logger:d}=t;switch(e.type){case"subscribe":{const{subscriptionID:n,kind:r}=e;switch(r){case"uncommittedChanges":{const e=e=>{this.postMessage({type:"subscriptionResult",kind:"uncommittedChanges",subscriptionID:n,data:e})},r=t.getUncommittedChanges();null!=r&&e(r);const i=[];i.push(t.subscribeToUncommittedChanges(e)),t.fetchUncommittedChanges(),i.push(t.subscribeToUncommittedChangesBeginFetching((()=>this.postMessage({type:"beganFetchingUncommittedChangesEvent"})))),this.subscriptions.set(n,{dispose:()=>{i.forEach((e=>e.dispose()))}});break}case"smartlogCommits":{const e=e=>{this.postMessage({type:"subscriptionResult",kind:"smartlogCommits",subscriptionID:n,data:e})},r=t.getSmartlogCommits();null!=r&&e(r);const i=[];i.push(t.subscribeToSmartlogCommitsChanges(e)),t.fetchSmartlogCommits(),i.push(t.subscribeToSmartlogCommitsBeginFetching((()=>this.postMessage({type:"beganFetchingSmartlogCommitsEvent"})))),this.subscriptions.set(n,{dispose:()=>{i.forEach((e=>e.dispose()))}});break}case"mergeConflicts":{const e=e=>{this.postMessage({type:"subscriptionResult",kind:"mergeConflicts",subscriptionID:n,data:e})},r=t.getMergeConflicts();null!=r&&e(r),this.subscriptions.set(n,t.onChangeConflictState(e));break}}break}case"unsubscribe":{const t=this.subscriptions.get(e.subscriptionID);null==t||t.dispose(),this.subscriptions.delete(e.subscriptionID);break}case"runOperation":{const{operation:r}=e;t.runOrQueueOperation(r,(e=>{this.postMessage(Object.assign({type:"operationProgress"},e)),"queue"===e.kind&&this.tracker.track("QueueOperation",{extras:{operation:r.trackEventName}})}),this.tracker,n);break}case"abortRunningOperation":{const{operationId:n}=e;t.abortRunningOpeation(n);break}case"getConfig":t.getConfig(e.name).catch((()=>{})).then((t=>{d.info("got config",e.name,t),this.postMessage({type:"gotConfig",name:e.name,value:t})}));break;case"getPersistentViewState":this.postMessage({type:"gotPersistentViewState",name:e.name,value:this.connection.persistentClientSideViewState[e.name]});break;case"fetchRepoMessage":t.runCommand(["internal-only","repo-message"]).then((e=>({value:e.stdout}))).catch((e=>(null==d||d.error("error fetching repo message",e.toString()),{error:e}))).then((e=>this.postMessage({type:"fetchedRepoMessage",message:e.value||""})));break;case"fetchUpgradePrompt":d.info("fetchUpgradePrompt"),t.runCommand(["internal-only","upgrade-prompt"]).then((e=>({value:e.stdout}))).catch((e=>(null==d||d.error("error fetching upgrade prompt",e.toString()),{error:e}))).then((e=>this.postMessage({type:"fetchedUpgradePrompt",message:e.value||""})));break;case"fetchAuthStatus":t.runCommand(["internal-only","check-auth"]).then((e=>({value:JSON.parse(e.stdout)}))).catch((e=>(null==d||d.error("error fetching auth status",e.toString()),{error:e}))).then((e=>{e.value&&this.postMessage({type:"fetchedAuthStatus",message:e.value})}));break;case"fetchPotentialParents":{const{branchToTrack:n}=e;t.runCommand(["internal-only","potential-parents",n]).then((e=>({value:JSON.parse(e.stdout)}))).catch((e=>(null==d||d.error("error fetching potential parents",e.toString()),{error:e}))).then((e=>{e.value&&this.postMessage({type:"fetchedPotentialParents",message:e.value})}));break}case"setConfig":d.info("set config",e.name,e.value),t.setConfig("user",e.name,e.value).catch((t=>{d.error("error setting config",e.name,e.value,t)}));break;case"setPersistentViewState":this.connection.persistentClientSideViewState[e.name]=e.value;break;case"deleteFile":{const{filePath:n}=e,r=function(e,t,n=c()){const r=n.resolve(t.info.repoRoot,e);return r.startsWith(t.info.repoRoot+n.sep)?r:null}(n,t);if(null==r)return void d.warn("can't delete file outside of the repo",n);o().promises.rm(r).then((()=>{d.info("deleted file from filesystem",r)})).catch((e=>{d.error("unable to delete file",r,e)}));break}case"requestComparison":{const{comparison:n}=e;t.runCommand(["internal-only","diff",...H(n)]).then((e=>({value:e.stdout}))).catch((e=>(null==d||d.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"comparison",comparison:n,data:{diff:e}})));break}case"requestChangedFiles":{const{branch:n}=e;t.runCommand(["internal-only","changed-files",n]).then((e=>JSON.parse(e.stdout))).catch((e=>(null==d||d.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"changedFiles",branch:n,data:e})));break}case"requestComparisonContextLines":{const{id:{path:n,comparison:i},start:o,numLines:s}=e;if(i.type===r.ComparisonType.Commit||i.type===r.ComparisonType.Range)throw new Error("Not implemented");t.relativeCat(n,i).catch((()=>"")).then((e=>this.postMessage({type:"comparisonContextLines",lines:e.split("\n").slice(o-1,o-1+s),path:n})));break}case"requestChangedFilesInRange":{const{fromSha:n,toSha:r}=e;t.runCommand(["internal-only","changed-files",r,"--from",n]).then((e=>JSON.parse(e.stdout))).catch((e=>(null==d||d.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"changedFilesInRange",fromSha:n,toSha:r,data:e})));break}case"requestCommitsInBranch":{const{branch:n}=e;t.runCommand(["internal-only","list-commits",n]).then((e=>JSON.parse(e.stdout))).catch((e=>(null==d||d.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"commitsInBranch",branch:n,data:e})));break}case"requestChangedFilesInCommit":{const{commitSha:n}=e;t.runCommand(["internal-only","changed-files",n,"--from",`${n}~`]).then((e=>JSON.parse(e.stdout))).catch((e=>(null==d||d.error("error running diff",e.toString()),{error:e}))).then((e=>this.postMessage({type:"changedFilesInCommit",commitSha:n,data:e})));break}case"refresh":null==d||d.log("refresh requested"),t.fetchSmartlogCommits(),t.fetchUncommittedChanges(),null===(i=t.codeReviewProvider)||void 0===i||i.triggerDiffSummariesFetch(t.getAllDiffIds());break;case"pageVisibility":t.setPageFocus(this.pageId,e.state);break;case"fetchCommitMessageTemplate":t.runCommand(["internal-only","templates"]).then((e=>{const n=JSON.parse(e.stdout);this.postMessage({type:"fetchedCommitMessageTemplate",templates:Object.fromEntries(Object.entries(n).map((([e,n])=>[e,n.replace(t.IGNORE_COMMIT_MESSAGE_LINES_REGEX,"")])))})})).catch((e=>{null==d||d.error("Could not fetch commit message template",e)}));break;case"typeahead":null===(u=null===(a=null===(s=t.codeReviewProvider)||void 0===s?void 0:s.typeahead)||void 0===a?void 0:a.call(s,e.kind,e.query))||void 0===u||u.then((t=>this.postMessage({type:"typeaheadResult",id:e.id,result:t})));break;case"fetchDiffSummaries":null===(l=t.codeReviewProvider)||void 0===l||l.triggerDiffSummariesFetch(t.getAllDiffIds());break;case"loadMoreCommits":{const e=t.nextVisibleCommitRangeInDays();return this.postMessage({type:"commitsShownRange",rangeInDays:e}),this.postMessage({type:"beganLoadingMoreCommits"}),t.fetchSmartlogCommits(),void this.tracker.track("LoadMoreCommits",{extras:{daysToFetch:null!=e?e:"Infinity"}})}default:this.platform.handleMessageFromClient(t,e,(e=>this.postMessage(e)),(e=>{this.repoDisposables.push({dispose:e})}))}this.notifyListeners(e)}notifyListeners(e){const t=this.listenersByType.get(e.type);t&&t.forEach((t=>t(e)))}}var ie=n(6113);const oe="win32"==process.platform?c().join((0,r.unwrap)(process.env.LOCALAPPDATA),"cache"):"darwin"==process.platform?c().join(E().homedir(),"Library/Caches"):process.env.XDG_CACHE_HOME||c().join(E().homedir(),".cache");function se(e,t){const n=Buffer.from(e),r=Buffer.from(t);return n.length===r.length&&(0,ie.timingSafeEqual)(n,r)}function ae(e){var t,n,i;const s=null!==(t=e.logger)&&void 0!==t?t:e.logFileLocation?function(e){const t=(...t)=>{const n=O().format(...t)+"\n";o().promises.appendFile(e,n)};return{info:t,log:t,warn:t,error:t,getLogFileContents:()=>o().promises.readFile(e,"utf-8")}}(e.logFileLocation):S;e.logger=s;const a=null!==(n=null==e?void 0:e.platform)&&void 0!==n?n:J,u=null!==(i=null==e?void 0:e.version)&&void 0!==i?i:"unknown";s.log(`establish client connection for ${e.cwd}`),s.log(`platform '${a.platformName}', version '${u}', command '${e.command}'`),function(e){var t,n;return v(this,void 0,void 0,(function*(){const r=yield(0,m.composeUserConfigFactory)().load();let i=null===(n=null===(t=r.data.gtiConfigs)||void 0===t?void 0:t.find((e=>"gti.install-uuid"===e.key)))||void 0===n?void 0:n.value;if(!i){const e=(0,g.Z)();yield r.update((t=>{t.gtiConfigs||(t.gtiConfigs=[]),t.gtiConfigs.push({key:"gti.install-uuid",value:e})})),i=e}const o=yield function(e){return v(this,void 0,void 0,(function*(){try{const t=yield(0,p.composeGit)({debug:t=>e.info(t)});return yield t.config("user.email")}catch(t){try{e.error("Failed to get git email",t)}catch(e){}return}}))}(e);y({event:"gti-server-startup",timestampISOString:(new Date).toISOString(),logger:e,details:{installUuid:i,gitEmail:o}})}))}(s).catch((e=>{s.error("Failed to log startup",e)}));const c=function(e,t,n,i=C){return new r.Tracker(((e,t)=>{var n,r;const{logger:o}=t;o.log("[track]",e.eventName,null!==(n=e.errorName)&&void 0!==n?n:"",null!==(r=e.errorMessage)&&void 0!==r?r:"",null!=e.extras?JSON.stringify(e.extras):"");try{Promise.resolve(i(Object.assign(Object.assign({},e),t.data))).catch((e=>{}))}catch(e){}}),new w(e,function(e,t){return{platform:e,version:t,repo:void 0,sessionId:(0,r.randomId)(),unixname:_(),osArch:E().arch(),osType:E().platform(),osRelease:E().release(),hostname:E().hostname()}}(t.platformName,n)))}(s,a,u,(t=>q({command:e.command||"gt",args:["internal-only","log-action",t.eventName||t.errorName||"UNKNOWN_CLI_EVENT",(t.timestamp?new Date(t.timestamp):new Date).toISOString(),JSON.stringify(t)],cwd:e.cwd})));c.track("ClientConnection",{extras:{cwd:e.cwd}});let l=new re(a,e,c,s);return l.setActiveRepoForCwd(e.cwd),()=>{null==l||l.dispose(),l=null}}c().join(oe,"graphite-gti");var ue=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{u(r.next(e))}catch(e){o(e)}}function a(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}u((r=r.apply(e,t||[])).next())}))};function ce({port:e,sensitiveToken:t,challengeToken:n,logFileLocation:i,logInfo:s,command:u,gtVersion:l,foreground:h,frontendDir:m}){return new Promise((p=>{try{const e=JSON.parse(o().readFileSync(c().join(m,"build/asset-manifest.json"),"utf-8"));for(const t of Object.values(e.files))t.startsWith("/")||p({type:"error",error:`expected entry to start with / but was: \`${t}\``}),he[t]=t.slice(1)}catch(e){}he["/favicon.ico"]="favicon.ico";const g=a().createServer(((e,r)=>ue(this,void 0,void 0,(function*(){var i,s;if(e.url){const{pathname:a}=d().parse(e.url);if(null!=a&&he.hasOwnProperty(a)){const e=he[a];let t;try{t=yield o().promises.readFile(c().join(m,"build",e))}catch(e){return r.writeHead(500,{"Content-Type":"text/plain"}),void r.end((s=e.toString(),s.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#27;")))}const n=e.lastIndexOf("."),u=e.slice(n+1),l=null!==(i=de[u])&&void 0!==i?i:"text/plain";return r.writeHead(200,{"Content-Type":l}),void r.end(t)}if("/challenge_authenticity"===a){const i=le(e.url).get("token");if(i&&se(i,t)){r.writeHead(200,{"Content-Type":"text/json"});const e={challengeToken:n,pid:process.pid};r.end(JSON.stringify(e))}else r.writeHead(401,{"Content-Type":"text/json"}),r.end(JSON.stringify({error:"invalid token"}));return}}r.writeHead(404,{"Content-Type":"text/html"}),r.end("<html><body>Not Found!</body></html>")})))),v=g.listen(e),y=new(f().Server)({noServer:!0,path:"/ws"});y.on("connection",((e,n)=>{let o,a,c;if(n.url){const e=le(n.url);o=e.get("token");const t=e.get("cwd");c=e.get("platform"),t&&(a=decodeURIComponent(t))}if(!o){const t="No token provided in websocket request";return s("closing ws:",t),void e.close(r.CLOSED_AND_SHOULD_NOT_RECONNECT_CODE,t)}if(!se(o,t)){const t="Invalid token";return s("closing ws:",t),void e.close(r.CLOSED_AND_SHOULD_NOT_RECONNECT_CODE,t)}const d=ae({postMessage:t=>(e.send(t),Promise.resolve(!0)),onDidReceiveMessage(t){const n=e.on("message",t);return{dispose:()=>n.off("message",t)}},cwd:null!=a?a:process.cwd(),logFileLocation:"stdout"===i?void 0:i,command:u,version:l,persistentClientSideViewState:{},platform:void 0});e.on("close",(()=>{d(),h||setTimeout((()=>{0===ne.numberOfActiveServers()&&process.exit(0)}),6e4)}))})),v.on("upgrade",((e,t,n)=>{y.handleUpgrade(e,t,n,(t=>{y.emit("connection",t,e)}))})),g.on("error",(function(t){if("listen"!==t.syscall)throw p({type:"error",error:t.toString()}),t;switch(t.code){case"EACCES":throw p({type:"error",error:`Port ${e} requires elevated privileges`}),t;case"EADDRINUSE":return void p({type:"addressInUse"});default:throw p({type:"error",error:t.toString()}),t}})),g.on("listening",(()=>p({type:"success",port:g.address().port,pid:process.pid})))}))}function le(e){var t;const n=null===(t=d().parse(e).search)||void 0===t?void 0:t.replace(/^\?/,"").split("&").map((e=>e.split("=")));return new Map(n)}const de={css:"text/css",html:"text/html",js:"text/javascript",ttf:"font/ttf"},he={"/":"index.html"}}};
3
3
  //# sourceMappingURL=16.js.map