import{n as e}from"./rolldown-runtime-BG2f4sTM.js";import{Aut as t,BV as n,BX as r,Cpt as i,Dvt as a,E3 as o,GU as s,H9 as c,I3 as l,KU as u,L3 as d,Mft as f,Mk as p,Mlt as m,Mvt as h,N_t as g,Nlt as ee,Nut as te,OL as _,O_t as v,P_t as ne,Qw as re,Rft as y,SW as b,T0 as x,UX as S,VV as C,Vft as w,W9 as ie,WU as ae,Wft as T,XR as E,YR as D,Zut as O,Zw as k,_ut as oe,cst as A,d3 as j,dE as M,ddt as N,e0 as P,eG as se,fst as F,g8 as I,gut as L,hut as ce,jft as R,jk as le,k3 as z,kL as ue,lst as B,lvt as V,m2 as H,npt as de,odt as U,p8 as fe,pvt as W,qut as G,sdt as pe,t0 as me,tG as K,u3 as q,udt as J,vE as he,vut as Y,w0 as X,wW as ge,wtt as _e,z2 as Z,ztt as Q}from"./app-initial-BHB6SClA.js";import{n as ve,t as ye}from"./use-git-recent-branches-C-3Xty1U.js";var be,xe=e((()=>{be=`# Review Guidelines

You are acting as a reviewer for a proposed code change made by another engineer.

Review the change and respond in normal Markdown. Do not return JSON, XML, a findings object, or any structured review schema.

When feedback should be attached directly to a changed line, emit one \`::code-comment{...}\` directive for that issue. The directive creates an inline code comment in the review UI; keep the visible response as normal Markdown. Emit no directives when there are no actionable inline comments.

Required \`code-comment\` attributes: \`title\`, \`body\`, and \`file\`. Optional attributes: \`start\`, \`end\`, and \`priority\`. Use the shortest useful line range. \`file\` should be an absolute path or include the workspace folder segment.

Focus on discrete, actionable issues the original author would likely fix if they knew about them. Prefer no issues over speculative or low-signal feedback.

General guidelines for whether to call out an issue:

1. It meaningfully impacts correctness, performance, security, or maintainability.
2. It is discrete and actionable.
3. It was introduced by the change under review.
4. The author would likely fix it once aware.
5. It does not rely on unstated assumptions about intent.
6. It identifies the affected behavior clearly rather than speculating broadly.

When you call out an issue, include the relevant file and line or function in prose, explain the scenario where it matters, and keep the explanation concise. Use priority labels such as \`[P1]\` or \`[P2]\` only when helpful to communicate severity.

If there are no actionable issues, say that directly and briefly.
`}));function Se({reviewInstructions:e,requestMessage:t}){return[A,be.trim(),e.trim(),B,t].join(`
`)}async function Ce({context:e,hostId:t,intl:n}){if(e.mode===`uncommitted`){let e=n.formatMessage({id:`quickAction.request.codeReview.uncommitted`,defaultMessage:`Please review my uncommitted changes`,description:`User message used when reviewing uncommitted changes`});return{diffFilter:`unstaged`,prompt:Se({reviewInstructions:De,requestMessage:e}),baseBranch:null}}let r=await G(`git-merge-base`,{source:`review_model`,params:{gitRoot:e.gitRoot,baseBranch:e.baseBranch,hostId:t}});if(!r.mergeBaseSha)throw Error(`Failed to resolve a merge base between HEAD and ${e.baseBranch}.`);let i=n.formatMessage({id:`quickAction.request.codeReview.branches`,defaultMessage:`Please review changes on {from} against {to}`,description:`User message used when reviewing against a selected base branch`},{from:e.sourceBranch,to:e.baseBranch});return{diffFilter:`branch`,prompt:Se({reviewInstructions:Ee.replaceAll(`{baseBranch}`,e.baseBranch).replaceAll(`{mergeBaseSha}`,r.mergeBaseSha.trim()),requestMessage:i}),baseBranch:e.baseBranch}}function we(e){let t=(0,Te.c)(13),{hostId:n,onError:r,onSuccess:i}=e,a=g(R),o=T(),s=S(n),c;t[0]!==n||t[1]!==s||t[2]!==o||t[3]!==a?(c=async e=>{let{context:t,conversationId:r,delivery:i}=e,{gitRoot:c,cwd:l}=t,u=await Ce({context:t,hostId:n,intl:o}),d=r==null?null:a.get(Z,r);if(i===`inline`&&r!=null&&d===n){if(s==null)throw Error(`Code review host is unavailable`);return await N(`start-turn-for-host`,{hostId:s.getHostId(),conversationId:r,params:{cwd:l,input:[{type:`text`,text:u.prompt,text_elements:[]}],approvalsReviewer:`user`,collaborationMode:null,inheritThreadSettings:!1,serviceTier:await C(a,n,null)}}),{delivery:`inline`,diffFilter:u.diffFilter,baseBranch:u.baseBranch}}let f=await N(`start-conversation`,{hostId:n,input:[{type:`text`,text:u.prompt,text_elements:[]}],cwd:l,workspaceRoots:[c],collaborationMode:null,serviceTier:await C(a,n,null),approvalsReviewer:`user`});return{baseBranch:u.baseBranch,conversationId:f,delivery:`detached`,diffFilter:u.diffFilter}},t[0]=n,t[1]=s,t[2]=o,t[3]=a,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=e=>{i(e)},t[5]=i,t[6]=l);let u;t[7]===r?u=t[8]:(u=e=>{pe.error(`Failed to start quick review conversation`,{safe:{},sensitive:{error:e}}),r(e)},t[7]=r,t[8]=u);let d;return t[9]!==c||t[10]!==l||t[11]!==u?(d={mutationFn:c,onSuccess:l,onError:u},t[9]=c,t[10]=l,t[11]=u,t[12]=d):d=t[12],W(d)}var Te,Ee,De,Oe=e((()=>{Te=h(),V(),v(),y(),r(),H(),J(),n(),xe(),F(),f(),U(),O(),Ee="Review the code changes against the base branch '{baseBranch}'. The merge base commit for this comparison is {mergeBaseSha}. Run `git diff {mergeBaseSha}` to inspect the changes relative to {baseBranch}. Provide concise, actionable feedback in a normal Markdown response.",De=`Review the current code changes (staged, unstaged, and untracked files) and provide concise, actionable feedback in a normal Markdown response.`}));function ke(e,t,n,r){let i=(0,je.c)(4),a;i[0]===n?a=i[1]:(a=e=>{let{root:t}=e;return{operationSource:n,root:t}},i[0]=n,i[1]=a);let o;return i[2]===r?o=i[3]:(o={liveQuery:Ae,staleTime:1/0,...r},i[2]=r,i[3]=o),z(e,t,`base-branch`,a,n,o)}function Ae(e){return{method:`base-branch`,params:e}}var je,Me=e((()=>{je=h(),o()}));function Ne({currentBranch:e,defaultTargetBranch:t,recentBranches:n}){let r=[],i=[t??Pe],a=new Set;return e&&a.add(e),n!=null&&i.push(...n),i.forEach(e=>{!e||a.has(e)||(r.push(e),a.add(e))}),r}var Pe,Fe=e((()=>{Pe=`main`}));function Ie(e){let t=(0,Re.c)(116),{conversationId:n,cwd:r,gitRoot:a,hostConfig:o,reviewSubmissionLock:s}=e,c=g(fe),l=T(),f=ue(),p=ne(j),m;t[0]===p?m=t[1]:(m={retainRepoWatch:p},t[0]=p,t[1]=m);let{data:h,error:_,isFetching:v,isLoading:y,refetch:b}=E(a,o,`review_mode_content`,m),S;t[2]===p?S=t[3]:(S={retainRepoWatch:p},t[2]=p,t[3]=S);let{data:C,isLoading:D,isError:O,refetch:k}=ke(a,o,`review_mode_content`,S),A;t[4]===p?A=t[5]:(A={retainRepoWatch:p},t[4]=p,t[5]=A);let{data:M,isLoading:N,isError:P,refetch:F}=ve(a,o,`review_mode_content`,A),I=te(i.reviewDelivery),L;t[6]!==l||t[7]!==s||t[8]!==c?(L=e=>{s.release(),pe.error(`Failed to start code review`,{safe:{},sensitive:{error:e}}),c.get(ee).danger(l.formatMessage({id:`composer.reviewMode.quickReviewError`,defaultMessage:`Failed to start code review`,description:`Toast shown when quick review action fails`}))},t[6]=l,t[7]=s,t[8]=c,t[9]=L):L=t[9];let R;t[10]!==n||t[11]!==f||t[12]!==s||t[13]!==c?(R=e=>{if(s.release(),ge(c,e.diffFilter),e.delivery===`detached`){u(c,e.conversationId,e.baseBranch),f(e.conversationId);return}u(c,n,e.baseBranch);let t=c.get(me.activeTab$)?.tabId;he(c,!t?.startsWith(`sidechat:`)),c.set(x,!1)},t[10]=n,t[11]=f,t[12]=s,t[13]=c,t[14]=R):R=t[14];let z;t[15]!==o.id||t[16]!==L||t[17]!==R?(z={hostId:o.id,onError:L,onSuccess:R},t[15]=o.id,t[16]=L,t[17]=R,t[18]=z):z=t[18];let{mutate:B,isPending:V,variables:H}=we(z),de=V&&H?.context.mode===`uncommitted`,U=V&&H?.context.mode===`base-branch`?H.context.baseBranch:null,W,G,K,q,J,Y,X;if(t[19]!==C||t[20]!==n||t[21]!==h||t[22]!==_||t[23]!==r||t[24]!==a||t[25]!==l||t[26]!==O||t[27]!==D||t[28]!==v||t[29]!==y||t[30]!==P||t[31]!==N||t[32]!==de||t[33]!==V||t[34]!==M||t[35]!==k||t[36]!==b||t[37]!==F||t[38]!==I||t[39]!==s||t[40]!==c||t[41]!==B||t[42]!==U){let e=Ne({currentBranch:h,defaultTargetBranch:ae(C??null),recentBranches:M}),i=y||D||N,o=O||P,u;t[50]!==k||t[51]!==F?(u=()=>{Promise.all([k(),F()])},t[50]=k,t[51]=F,t[52]=u):u=t[52];let f=u,p;t[53]!==n||t[54]!==h||t[55]!==r||t[56]!==a||t[57]!==I||t[58]!==s||t[59]!==c||t[60]!==B?(p=e=>{s.acquire()&&(ie(c,_e,{target:`unstaged`}),B({conversationId:n,context:{mode:`uncommitted`,sourceBranch:h??`HEAD`,gitRoot:a,cwd:r},delivery:I??`inline`},{onSuccess:e}))},t[53]=n,t[54]=h,t[55]=r,t[56]=a,t[57]=I,t[58]=s,t[59]=c,t[60]=B,t[61]=p):p=t[61];let m=p,g;t[62]!==n||t[63]!==h||t[64]!==r||t[65]!==a||t[66]!==I||t[67]!==s||t[68]!==c||t[69]!==B?(g=(e,t)=>{s.acquire()&&(ie(c,_e,{target:`base_branch`}),B({conversationId:n,context:{mode:`base-branch`,sourceBranch:h??`HEAD`,baseBranch:e,gitRoot:a,cwd:r},delivery:I??`inline`},{onSuccess:t}))},t[62]=n,t[63]=h,t[64]=r,t[65]=a,t[66]=I,t[67]=s,t[68]=c,t[69]=B,t[70]=g):g=t[70];let ee=g,te;if(i){let e;t[71]===l?e=t[72]:(e=l.formatMessage({id:`composer.reviewMode.branches.loading`,defaultMessage:`Loading branches…`,description:`Loading message while review mode branches load`}),t[71]=l,t[72]=e),te=e}else if(o){let e;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{className:`text-center text-xs text-token-foreground/70`,children:(0,$.jsx)(w,{id:`composer.reviewMode.branches.error`,defaultMessage:`Unable to load branches`,description:`Error message when branch list could not be loaded`})}),t[73]=e):e=t[73];let n;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(w,{id:`composer.reviewMode.branches.retry`,defaultMessage:`Retry`,description:`Retry button for branch list error`}),t[74]=n):n=t[74];let r;t[75]===f?r=t[76]:(r=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e,(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-token-text-link-foreground`,onClick:f,children:n})]}),t[75]=f,t[76]=r),te=r}let ne=d(_),x;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(le,{className:`icon-xs shrink-0 text-token-charts-red`}),t[77]=x):x=t[77];let S;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(`span`,{className:`font-medium text-token-foreground`,children:(0,$.jsx)(w,{id:`composer.reviewMode.xcodeLicenseRequired.title`,defaultMessage:`Review the Xcode license to use Git`,description:`Title shown when Git cannot run until the user accepts the Xcode license`})}),t[78]=S):S=t[78];let T;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[S,(0,$.jsx)(`span`,{className:`text-token-description-foreground`,children:(0,$.jsx)(w,{id:`composer.reviewMode.xcodeLicenseRequired.detail`,defaultMessage:`In your terminal, run <command>sudo xcodebuild -license</command>, follow the prompts, and try again`,description:`Instructions shown when Git cannot run until the user accepts the Xcode license`,values:{command:Le}})})]}),t[79]=T):T=t[79];let E;t[80]===b?E=t[81]:(E=()=>{b()},t[80]=b,t[81]=E);let A;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(w,{id:`composer.reviewMode.xcodeLicenseRequired.retry`,defaultMessage:`Try again`,description:`Button label for retrying Git after accepting the Xcode license`}),t[82]=A):A=t[82];let j;t[83]!==v||t[84]!==E?(j=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,role:`alert`,children:[x,T,(0,$.jsx)(ce,{className:`shrink-0`,loading:v,onClick:E,size:`composerSm`,children:A})]}),t[83]=v,t[84]=E,t[85]=j):j=t[85];let L=j;K=re,J=`review-mode`,t[86]===l?Y=t[87]:(Y=l.formatMessage({id:`composer.reviewMode.title`,defaultMessage:`Code review`,description:`Title for the review mode slash command`}),t[86]=l,t[87]=Y),t[88]===l?X=t[89]:(X=l.formatMessage({id:`composer.reviewMode.description`,defaultMessage:`Review uncommitted changes or compare against a branch`,description:`Description for the review mode slash command`}),t[88]=l,t[89]=X),W=!0,G=se,q={sections:ne?[{id:`review-mode-xcode-license`,isLoading:v,emptyState:L,items:[]}]:[{id:`review-mode-uncommitted`,isLoading:V,items:[{id:`review-mode-uncommitted`,title:l.formatMessage({id:`composer.reviewMode.option.unstaged.simple`,defaultMessage:`Review uncommitted changes`,description:`Button label for reviewing unstaged changes`}),disabled:V||y,RightIcon:y||de?oe:void 0,keepOpenOnSelect:!0,onSelect:e=>{let{close:t}=e;return m(t)}}]},{id:`review-mode-base-branches`,title:(0,$.jsx)(w,{id:`composer.reviewMode.option.baseBranch.simple`,defaultMessage:`Review against a base branch`,description:`Section label for reviewing against a base branch`}),showTitle:!0,isLoading:i||V,emptyState:te,items:i||o?[]:e.map(e=>({id:`review-mode-base-branch:${e}`,title:e,disabled:V,RightIcon:U===e?oe:void 0,keepOpenOnSelect:!0,onSelect:t=>{let{close:n}=t;return ee(e,n)}}))}]},t[19]=C,t[20]=n,t[21]=h,t[22]=_,t[23]=r,t[24]=a,t[25]=l,t[26]=O,t[27]=D,t[28]=v,t[29]=y,t[30]=P,t[31]=N,t[32]=de,t[33]=V,t[34]=M,t[35]=k,t[36]=b,t[37]=F,t[38]=I,t[39]=s,t[40]=c,t[41]=B,t[42]=U,t[43]=W,t[44]=G,t[45]=K,t[46]=q,t[47]=J,t[48]=Y,t[49]=X}else W=t[43],G=t[44],K=t[45],q=t[46],J=t[47],Y=t[48],X=t[49];let Z;t[90]!==C||t[91]!==n||t[92]!==h||t[93]!==_||t[94]!==r||t[95]!==a||t[96]!==o.id||t[97]!==O||t[98]!==D||t[99]!==v||t[100]!==y||t[101]!==P||t[102]!==N||t[103]!==V||t[104]!==M||t[105]!==I||t[106]!==H?(Z=[C,n,h,_,r,a,o.id,O,D,v,y,P,N,V,M,I,H],t[90]=C,t[91]=n,t[92]=h,t[93]=_,t[94]=r,t[95]=a,t[96]=o.id,t[97]=O,t[98]=D,t[99]=v,t[100]=y,t[101]=P,t[102]=N,t[103]=V,t[104]=M,t[105]=I,t[106]=H,t[107]=Z):Z=t[107];let Q;return t[108]!==W||t[109]!==G||t[110]!==q||t[111]!==Z||t[112]!==J||t[113]!==Y||t[114]!==X?(Q={id:J,title:Y,description:X,requiresEmptyComposer:W,Icon:G,submenu:q,dependencies:Z},t[108]=W,t[109]=G,t[110]=q,t[111]=Z,t[112]=J,t[113]=Y,t[114]=X,t[115]=Q):Q=t[115],K(Q),null}function Le(e){return(0,$.jsx)(`code`,{className:`font-mono`,children:e},`command`)}var Re,$;e((()=>{Re=h(),Q(),v(),de(),y(),Oe(),X(),P(),L(),Y(),m(),l(),Me(),D(),ye(),K(),p(),c(),b(),q(),s(),I(),t(),M(),U(),_(),k(),Fe(),$=a()}))();export{Ie as ReviewSlashCommandSubmenuRegistration};
//# sourceMappingURL=review-slash-command-submenu-registration-B3zRjvHe.js.map