farming-code 2.2.6 → 2.2.8
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/README.md +102 -204
- package/README.zh_cn.md +102 -246
- package/backend/acp-runtime.js +93 -1
- package/backend/agent-manager.js +81 -20
- package/backend/cli-agents.js +1 -1
- package/backend/farming-app-cli.js +52 -1
- package/backend/farming-session-store.js +1 -0
- package/backend/npm-update-helper.js +4 -0
- package/backend/server.js +5 -1
- package/backend/update-service.js +14 -2
- package/dist/assets/App-8dYAM6ql.js +124 -0
- package/dist/assets/{FileEditorPane-BQLocXOp.js → FileEditorPane-RWiFD2cq.js} +1 -1
- package/dist/assets/{IconGlyphs-RkMAdBXF.js → IconGlyphs-DfL0EBnj.js} +1 -1
- package/dist/assets/{ProjectFilesSection-lS1azbgj.js → ProjectFilesSection-Q4PDsWmM.js} +1 -1
- package/dist/assets/{ReviewPage-DgnmgU2T.js → ReviewPage-BaXu1ZdX.js} +1 -1
- package/dist/assets/{code-dark-Cjb1QGhu.css → code-dark-CDkOQAtK.css} +1 -1
- package/dist/assets/{index-BpHPeJf0.js → index-BrbljRqn.js} +2 -2
- package/dist/assets/main-D073SnW4.css +1 -0
- package/dist/index.html +1 -1
- package/frontend/skins/crt/app.js +58 -2
- package/frontend/skins/crt/index.html +1 -1
- package/frontend/skins/crt/styles/billing.css +6 -0
- package/frontend/skins/crt/styles/effects.css +11 -3
- package/package.json +1 -1
- package/dist/assets/App-Dza5yEDe.js +0 -124
- package/dist/assets/main-DTJwH51M.css +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as e}from"./chunk-DECur_0Z.js";import{i as t,t as n}from"./jsx-runtime-BthL93pI.js";import{C as r,d as i,h as a,l as o,m as s,o as c,p as l,s as u}from"./IconGlyphs-RkMAdBXF.js";import{a as d,c as f,d as p,i as m,l as h,n as g,o as _,r as v,s as y,t as b,u as x}from"./core-ZlAPicox.js";import{A as S,C as ee,D as te,E as ne,F as re,M as ie,N as C,O as ae,P as oe,S as se,T as ce,_ as le,a as ue,b as w,c as de,d as fe,f as pe,g as me,h as he,i as ge,j as T,k as _e,l as ve,m as ye,n as be,p as xe,r as Se,s as Ce,t as we,u as Te,v as Ee,w as De,x as Oe,y as ke}from"./api-D1lyBYIQ.js";var E=e(t());function D(e){let t=[`package`,`import`,`option`,`optional`,`required`,`repeated`,`group`,`oneof`],n=[`double`,`float`,`int32`,`int64`,`uint32`,`uint64`,`sint32`,`sint64`,`fixed32`,`fixed64`,`sfixed32`,`sfixed64`,`bool`,`string`,`bytes`],r={match:[/(message|enum|service)\s+/,e.IDENT_RE],scope:{1:`keyword`,2:`title.class`}};return{name:`Protocol Buffers`,aliases:[`proto`],keywords:{keyword:t,type:n,literal:[`true`,`false`]},contains:[e.QUOTE_STRING_MODE,e.NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,r,{className:`function`,beginKeywords:`rpc`,end:/[{;]/,excludeEnd:!0,keywords:`rpc returns`},{begin:/^\s*[A-Z_]+(?=\s*=[^\n]+;$)/}]}}function Ae(e){return e instanceof Error&&e.message.trim()?e.message.trim():typeof e==`string`&&e.trim()?e.trim():`review file diff request failed`}function O(e){return e.diffLoaded===!1&&!ie(e)}function je(e,t,n,r={}){if(t.reviewId!==void 0&&r.reviewId!==t.reviewId)throw Error(`loaded review file belongs to a stale review`);if(n.path!==t.path)throw Error(`loaded review file path does not match requested path`);if(O(n))throw Error(`loaded review file is still a metadata-only row`);if(!e[t.patchset]?.some(e=>e.path===t.path))throw Error(`loaded review file path is no longer in the review catalog`);return{action:{patchset:t.patchset,path:t.path,...t.reviewId?{reviewId:t.reviewId}:{},type:`commit-file-diff-load`},catalog:se(e,t.patchset,{...n,diffLoaded:!0})}}function Me(e,t){return{error:Ae(t),patchset:e.patchset,path:e.path,...e.reviewId?{reviewId:e.reviewId}:{},type:`fail-file-diff-load`}}function k(e){return e===`added`?`A`:e===`copied`?`C`:e===`deleted`?`D`:e===`renamed`?`R`:e===`rewritten`?`W`:e===`unmodified`?`U`:e===`reverted`?`X`:`M`}function A(e){return e.status?e.status:k(e.kind)}function j(e){return _e(e)}function Ne(e){return e.binary?`binary`:ie(e)?`too-expensive`:e.diffLoaded===!1?`not-loaded`:`loaded`}function Pe(e,t,n={}){let r=n.patchset??e.patchRange.patchset,i=C(e,t.path,r),a=oe(e,r),o=i.loaded?i.status===`reviewed`:null;return{action:o===null?null:{ariaLabel:o?`Mark as unreviewed`:`Mark as reviewed`,disabled:!!n.mutationPending,label:o?`MARK UNREVIEWED`:`MARK REVIEWED`,nextReviewed:!o,visibility:`on-row-interaction`},added:t.added,binary:t.binary===!0,changeLabel:A(t),commentPaths:j(t),deleted:t.removed,...T(e,t.path,r)?{diffLoadError:T(e,t.path,r)}:{},diffLoadPending:a.pendingDiffPaths.includes(t.path),diffStatus:Ne(t),diffTooExpensive:t.diffTooExpensive===!0||t.diff.truncated===!0,expanded:a.expandedPaths.includes(t.path),...t.newMode?{newMode:t.newMode}:{},...t.newSha?{newSha:t.newSha}:{},...t.oldMode?{oldMode:t.oldMode}:{},...t.oldSha?{oldSha:t.oldSha}:{},path:t.path,pending:i.pending,...t.previousPath?{previousPath:t.previousPath}:{},reviewed:o,reviewedLabel:o===!0?`Reviewed`:null,reviewStatusLoaded:i.loaded,...Number.isInteger(t.size)?{size:t.size}:{},...Number.isInteger(t.sizeDelta)?{sizeDelta:t.sizeDelta}:{}}}function Fe(e){let t=typeof e==`string`?new URLSearchParams(e):e,n=t.get(`agentId`)?.trim()||``,r=[...new Set(t.getAll(`acpItem`).map(e=>e.trim()).filter(Boolean))];return!n||r.length===0||r.length>256?null:{agentId:n,itemIds:r}}function M(e,t,n){let r=e.get(t);if(r===null||r.trim()===``||!/^\d+$/.test(r.trim()))return;let i=Number(r.trim());return Number.isSafeInteger(i)&&i>=n?i:void 0}function Ie(e){let t=e.get(`ignoreWhitespace`);if(t===`ALL`||t===`IGNORE_ALL`)return`ALL`;if(t===`TRAILING`||t===`IGNORE_TRAILING`)return`TRAILING`;if(t===`LEADING_AND_TRAILING`||t===`IGNORE_LEADING_AND_TRAILING`)return`LEADING_AND_TRAILING`}function Le(e){let t=e.get(`metadataOnly`);return t===`1`||t===`true`?!0:void 0}function N(e){let t=e.get(`scope`);return t===`tracked`||t===`untracked`?t:void 0}function Re(e){let t=M(e,`context`,0),n=Ie(e),r=M(e,`limit`,1),i=Le(e),a=M(e,`modifiedWithinDays`,1),o=N(e),s=e.getAll(`path`).map(e=>e.trim()).filter(Boolean);return{...t===void 0?{}:{context:t},...n?{ignoreWhitespace:n}:{},...r===void 0?{}:{limit:r},...i===!0?{metadataOnly:i}:{},...o?{scope:o}:{},...s.length>0?{paths:s}:{},...o===`untracked`&&a!==void 0?{modifiedWithinDays:a}:{}}}function P(e){let t=typeof e==`string`?new URLSearchParams(e):e,n=t.get(`agentId`)?.trim()||``,r=t.get(`root`)?.trim()||``;if(n&&r)return{error:`only one review workspace target is allowed`,request:null};if(!n&&!r)return{request:null};let i=n?{agentId:n}:{root:r},a=Re(t),o=t.get(`reviewId`)?.trim()||``,s=t.get(`base`),c=t.get(`head`);if(!(s!==null||c!==null))return{request:{...i,...a,source:`working-copy`}};let l=w(s||``),u=w(c||``);return!l||!u?{error:`base and head revisions are invalid`,request:null}:{request:{...i,base:l,head:u,...a,...o?{reviewId:o}:{},source:`git-range`}}}function ze(e){return P(e?.search??``)}var F=n();async function Be(e,t){let n=[],r=[],i=0;return await Promise.all(Array.from({length:Math.min(4,t.length)},async()=>{for(;i<t.length;){let a=t[i++];if(a)try{n.push(await fe(e,a))}catch(e){r.push(e instanceof Error?e:Error(`review file diff request failed`))}}})),{errors:r,files:n}}function I(e){let t=nt(e.path),n=t===`python`,r=Ze(e.path).replace(/\W/g,`_`),i=(e,t)=>({kind:`context`,left:{line:e,text:t},right:{line:e,text:t}}),a=Array.from({length:128},(e,n)=>{let r=n+1,a=t===`python`?`#`:t===`markdown`?`<!--`:`//`,o=t===`markdown`?` -->`:``,s=r>=29?`unchanged review context ${r-28}`:`unchanged review prelude ${r}`;return i(r,`${r===29||r===128?` `:``}${a} ${s}${o}`)});if(e.kind===`added`){let t=n?`${r} = create_review_snapshot()`:`export const ${r} = createReviewSnapshot()`,i=n?`__all__ = ["${r}"]`:`export default ${r}`;return{hunks:[{header:`@@ -0,0 +1,2 @@ ${e.path}`,oldStart:0,oldLines:0,newStart:1,newLines:2,rows:[{kind:`added`,right:{line:1,text:t}},{kind:`added`,right:{line:2,text:i}}]}]}}if(e.kind===`deleted`){let t=n?`def summarize_changes():`:`export function summarizeChanges() {`,r=n?` return "legacy summary"`:` return 'legacy summary'`;return{hunks:[{header:`@@ -1,2 +0,0 @@ ${e.path}`,oldStart:1,oldLines:2,newStart:0,newLines:0,rows:[{kind:`deleted`,left:{line:1,text:t}},{kind:`deleted`,left:{line:2,text:r}}]}]}}let o=n?`def create_change_set(input: ChangeInput) -> list[ReviewEntry]:`:`export function createChangeSet(input: ChangeInput) {`,s=n?` return normalize_changes(input.files)`:` return normalizeChanges(input.files)`,c=n?` return create_review_entries(input.files, input.base)`:` return createReviewEntries(input.files, input.base)`,l=n?`def mark_reviewed(path: str) -> ReviewState:`:`export function markReviewed(path: string) {`,u=n?` return {"path": path, "reviewed_at": time.time()}`:` return { path, reviewedAt: Date.now() }`,d=n?`if not path:`:` if (!path) return null`,f=n?` return None`:` const snapshot = readSnapshot(input.base)`,p=n?`return {**snapshot, "files": input.files}`:` return { ...snapshot, files: input.files }`,m=n?``:`}`,h=n?` return finalize_change_set(input) `:` return finalizeChangeSet(input) `;return{hunks:[{commonContext:a,header:`@@ -129,7 +129,10 @@ ${e.path}`,oldStart:129,oldLines:7,newStart:129,newLines:10,rows:[i(129,o),{kind:`deleted`,left:{line:130,text:s}},{kind:`added`,right:{line:130,text:c}},i(131,m),{kind:`added`,right:{line:133,text:l}},{kind:`added`,right:{line:134,text:u}},i(135,d),i(136,f),{kind:`added`,right:{line:137,text:p}},i(138,m),{kind:`deleted`,left:{line:139,text:h},whitespaceOnly:!0},{kind:`added`,right:{line:139,text:h.trimEnd()},whitespaceOnly:!0}]}]}}function Ve(e){return{...e,diff:I(e)}}var He=Object.fromEntries(Object.entries({"Patchset 20":[{path:`clis/dataflow.py`,kind:`modified`,added:2,removed:85},{path:`clis/diagnose.py`,kind:`modified`,added:8,removed:11},{path:`clis/fetch_instance_log.py`,kind:`deleted`,added:0,removed:573},{path:`clis/fetch_logview.py`,kind:`modified`,added:2,removed:2},{path:`clis/fetch_meta_timeline.py`,kind:`modified`,added:0,removed:2},{path:`clis/fetch_quota_snapshot.py`,kind:`deleted`,added:0,removed:290},{path:`clis/hbo_plan_diagnose.py`,kind:`deleted`,added:0,removed:119},{path:`clis/parse_logview.py`,kind:`modified`,added:6,removed:2},{path:`clis/query_sls.py`,kind:`modified`,added:14,removed:2},{path:`devclis/README.md`,kind:`added`,added:15,removed:0},{path:`docs/cli/studio.md`,kind:`modified`,added:1,removed:2},{path:`tests/review/change-set.spec.ts`,kind:`renamed`,previousPath:`tests/changes/change-summary.spec.ts`,added:28,removed:6}],"Patchset 19":[{path:`clis/dataflow.py`,kind:`modified`,added:1,removed:52},{path:`clis/diagnose.py`,kind:`modified`,added:5,removed:6},{path:`clis/fetch_instance_log.py`,kind:`deleted`,added:0,removed:573},{path:`clis/fetch_logview.py`,kind:`modified`,added:1,removed:2},{path:`clis/fetch_meta_timeline.py`,kind:`modified`,added:0,removed:2},{path:`clis/hbo_plan_diagnose.py`,kind:`deleted`,added:0,removed:119},{path:`clis/parse_logview.py`,kind:`modified`,added:4,removed:2},{path:`clis/query_sls.py`,kind:`modified`,added:7,removed:1},{path:`docs/cli/studio.md`,kind:`modified`,added:1,removed:1}]}).map(([e,t])=>[e,t.map(Ve)])),Ue=`Working copy`,L=`Review`,R={"Patchset 20":[`clis/dataflow.py`,`clis/fetch_instance_log.py`],"Patchset 19":[`clis/fetch_instance_log.py`]},We=De,Ge=`farming.review.diff-preferences`;b.registerLanguage(`typescript`,m),b.registerLanguage(`python`,_),b.registerLanguage(`sql`,d),b.registerLanguage(`markdown`,y),b.registerLanguage(`cpp`,x),b.registerLanguage(`java`,h),b.registerLanguage(`protobuf`,D),b.registerLanguage(`json`,f),b.registerLanguage(`yaml`,g),b.registerLanguage(`bash`,p),b.registerLanguage(`xml`,v);function Ke(){if(typeof window>`u`)return We;try{return te(JSON.parse(window.localStorage.getItem(Ge)||`{}`))}catch{return We}}function qe(e,t=!0){return e?e.source===`git-range`?e.head:Ue:t?`Patchset 20`:L}function Je(e,t=!0){return e?e.source===`git-range`?e.base:`HEAD`:`Base`}function Ye(e,t=!0){return e?{[qe(e,t)]:[]}:t?He:{[L]:[]}}function Xe({catalog:e,comments:t,initialPatchset:n,basePatchset:r,initiallyExpand:i,reviewId:a}){let o=ne({catalog:e,comments:t,patchRange:{basePatchset:r,patchset:n},preferences:Ke(),reviewId:a,reviewedPathsByPatchset:n===`Patchset 20`||n===`Patchset 19`?R:{}});return i?{...o,patchsets:Object.fromEntries(Object.keys(e).map(t=>{let n=e[t]??[],r=n[1]?.path??n[0]?.path;return[t,{...oe(o,t),expandedPaths:r?[r]:[]}]}))}:o}function Ze(e){let t=e.split(`/`);return t[t.length-1]||e}function z(e){let t=Math.abs(e);return t<1024?`${e} B`:t<1024*1024?`${(e/1024).toFixed(1)} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function B(e){return e.replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e]??e)}function Qe(e,t,n){return Array.from(e).slice(t,n).join(``)}function $e({action:e,pending:t,reviewed:n,reviewedLabel:r,onToggle:i}){return(0,F.jsxs)(`div`,{className:`review-review-status ${n?`reviewed`:``} ${t?`pending`:``}`,children:[r?(0,F.jsx)(`span`,{className:`review-reviewed-label`,children:r}):null,e?(0,F.jsx)(`button`,{type:`button`,"aria-checked":n===!0,"aria-label":`Reviewed`,"data-action-visibility":e.visibility,disabled:e.disabled,role:`switch`,title:t?`Saving review status`:e.ariaLabel,onClick:i,children:t?`SAVING…`:e.label}):(0,F.jsx)(`span`,{className:`review-review-loading`,children:`Reviewed status loading`})]})}function et({file:e,maxChangeSize:t}){if(e.binary)return(0,F.jsx)(`span`,{className:`review-change-bar binary`,"aria-label":`Binary file`});let n=e=>e===0?0:Math.max(2,Math.round(e/t*72));return(0,F.jsxs)(`span`,{className:`review-change-bar`,"aria-label":`+${e.added} −${e.removed}`,children:[(0,F.jsx)(`i`,{className:`added`,style:{width:`${n(e.added)}px`}}),(0,F.jsx)(`i`,{className:`deleted`,style:{width:`${n(e.removed)}px`}})]})}function tt({file:e}){if(e.binary){let t=typeof e.sizeDelta==`number`&&Number.isInteger(e.sizeDelta)?e.sizeDelta:null;return(0,F.jsx)(`span`,{className:`review-file-stats binary`,children:t===null?`Binary`:z(t)})}return(0,F.jsxs)(`span`,{className:`review-file-stats`,children:[e.added?(0,F.jsxs)(`span`,{className:`added`,children:[`+`,e.added]}):null,e.removed?(0,F.jsxs)(`span`,{className:`removed`,children:[`−`,e.removed]}):null]})}function nt(e){let t=e.toLowerCase();return t.endsWith(`.osql`)||t.endsWith(`.odpsql`)?`sql`:t.endsWith(`.py`)?`python`:t.endsWith(`.md`)||t.endsWith(`.mdx`)?`markdown`:/\.(c|cc|cpp|cxx|h|hh|hpp|hxx)$/.test(t)?`cpp`:t.endsWith(`.java`)?`java`:t.endsWith(`.proto`)?`protobuf`:t.endsWith(`.json`)?`json`:t.endsWith(`.yaml`)||t.endsWith(`.yml`)?`yaml`:/\.(bash|sh|zsh)$/.test(t)?`bash`:/\.(html|htm|xml)$/.test(t)?`xml`:`typescript`}function rt({intraline:e,language:t,line:n,side:r,text:i,preferences:a}){let o=n&&r?{"data-review-line":n,"data-review-side":r}:{},s=a.showTrailingWhitespace?i.match(/[ \t]+$/)?.[0]:void 0,c=s?i.slice(0,-s.length):i,l=a.intralineDifference?e:void 0,u=l?.length?it(c,l,t,a):V(c,t,a);return a.showTabs&&(u=u.replace(/\t/g,`<span class="review-tab-marker">⇥</span>`)),s&&(u+=`<span class="review-trailing-whitespace">${s.replace(/[ \t]/g,`·`)}</span>`),(0,F.jsx)(`code`,{...o,dangerouslySetInnerHTML:{__html:u}})}function V(e,t,n){return n.syntaxHighlighting&&e?b.highlight(e,{language:t,ignoreIllegals:!0}).value:B(e)}function it(e,t,n,r){let i=``,a=0,o=Array.from(e).length;for(let s of t){let t=Math.max(a,Math.min(s.start,o)),c=Math.max(t,Math.min(s.end,o));i+=V(Qe(e,a,t),n,r),c>t&&(i+=`<span class="review-intraline">${V(Qe(e,t,c),n,r)}</span>`),a=c}return i+=V(Qe(e,a),n,r),i}function H({kind:e,intraline:t,language:n,line:r,side:i,text:a,preferences:o,renderAttachment:s}){return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`review-diff-row unified ${e}`,children:[(0,F.jsx)(`span`,{children:r??``}),(0,F.jsx)(rt,{intraline:t,language:n,line:r,side:i,text:a,preferences:o})]}),r?s?.(r,[i]):null]})}function at({kind:e,language:t,leftLine:n,leftIntraline:r,leftText:i,rightLine:a,rightIntraline:o,rightText:s,preferences:c,renderAttachment:l}){let u=a??n,d=[...n?[`left`]:[],...a?[`right`]:[]];return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`review-diff-row ${e}`,children:[(0,F.jsx)(`span`,{children:n??``}),(0,F.jsx)(rt,{intraline:r,language:t,line:n,side:`left`,text:i??``,preferences:c}),(0,F.jsx)(`span`,{children:a??``}),(0,F.jsx)(rt,{intraline:o,language:t,line:a,side:`right`,text:s??``,preferences:c})]}),u?l?.(u,d):null]})}function U(e){let t=e.findIndex(e=>e.kind!==`context`);if(t<0)return{body:e,leading:[],trailing:[]};let n=e.length-1;for(;n>t&&e[n]?.kind===`context`;)--n;return{body:e.slice(t,n+1),leading:e.slice(0,t),trailing:e.slice(n+1)}}function W(e,t,n){let r=e.filter(e=>e.kind!==`context`&&e.kind!==`skipped`);return(t===`first`?r:[...r].reverse()).find(e=>e[n]?.line)?.[n]?.line}function ot(e,t){let n=e[t]?.rows??[],r=e[t-1]?.rows??[],i=[`left`,`right`].flatMap(e=>{let t=W(n,`first`,e);if(!t)return[];let i=W(r,`last`,e);return[Math.max(0,t-(i??0)-1)]});return i.length?Math.min(...i):0}function G(e,t){let n=e[t];if(!n)return 0;let r=e[t-1],i=r?r.oldStart+r.oldLines-1:0,a=r?r.newStart+r.newLines-1:0;return Math.max(0,Math.min(n.oldStart-i-1,n.newStart-a-1))}function K(e){let t=e.diff.hunks[e.diff.hunks.length-1],n=e.diff.leftMeta?.lines,r=e.diff.rightMeta?.lines;if(!t||!Number.isInteger(n)||!Number.isInteger(r))return 0;let i=t.oldStart+t.oldLines-1,a=t.newStart+t.newLines-1;return Math.max(0,Math.min((n??0)-i,(r??0)-a))}function st(e,t,n,r){let i=n[r-1],a=n[r];return`${e}:${t}:${i?`${i.oldStart+i.oldLines-1}:${i.newStart+i.newLines-1}`:`0:0`}>${a?`${a.oldStart}:${a.newStart}`:`0:0`}`}function q(e,t){let n=t.diff.hunks[t.diff.hunks.length-1],r=n?`${n.oldStart+n.oldLines-1}:${n.newStart+n.newLines-1}`:`0:0`;return`${e}:${t.path}:${r}>eof:${t.diff.leftMeta?.lines??0}:${t.diff.rightMeta?.lines??0}`}function ct(){return{aboveRows:[],belowRows:[]}}function lt(e,t,n,r,i){let a=n.diff.hunks[r],o=n.diff.hunks[r-1],s=U(a?.rows??[]),c=o?U(o.rows):null,l=[...a?.commonContext??[],...s.leading],u=!!a?.commonContext?.length,d=u?ot(n.diff.hunks,r):G(n.diff.hunks,r),f=st(e,n.path,n.diff.hunks,r),p=t[f]??ct(),m=c?.trailing.slice(0,r>0?Math.min(d,i):0)??[],h=Math.min(Math.max(0,d-m.length),i),g=h>0?l.slice(-h):[],_=Math.max(0,d-(u?m.length+g.length:0)-p.aboveRows.length-p.belowRows.length),v=u?W(o?.rows??[],`last`,`left`)??0:o?o.oldStart+o.oldLines-1:0,y=u?W(o?.rows??[],`last`,`right`)??0:o?o.newStart+o.newLines-1:0,b=v+(u?m.length:0)+p.aboveRows.length+1,x=y+(u?m.length:0)+p.aboveRows.length+1;return{availableRows:[...c?.trailing??[],...a?.commonContext??[],...s.leading].filter(e=>{let t=e.left?.line,n=e.right?.line;return t!==void 0&&n!==void 0&&t>=b&&t<b+_&&n>=x&&n<x+_}),baseAboveRows:m,baseBelowRows:g,expansion:p,header:a?.header??``,hiddenLines:_,key:f,location:r===0?`top`:`middle`,newHiddenStart:x,oldHiddenStart:b}}function ut(e,t,n,r){let i=n.diff.hunks[n.diff.hunks.length-1];if(!i)return null;let a=K(n),o=q(e,n),s=t[o]??ct(),c=U(i.rows).trailing,l=c.slice(0,Math.min(a,r)),u=Math.max(0,a-s.aboveRows.length),d=i.oldStart+i.oldLines-1,f=i.newStart+i.newLines-1,p=d+s.aboveRows.length+1,m=f+s.aboveRows.length+1;return{availableRows:c.filter(e=>{let t=e.left?.line,n=e.right?.line;return t!==void 0&&n!==void 0&&t>=p&&n>=m}),baseAboveRows:l,baseBelowRows:[],expansion:s,header:``,hiddenLines:u,key:o,location:`bottom`,newHiddenStart:m,oldHiddenStart:p}}function J({gap:e,onExpand:t}){let n=e.hiddenLines>10,r=!!e.expansion.pending;return(0,F.jsxs)(`div`,{className:`review-diff-hunk interactive`,role:`group`,"aria-label":`${e.hiddenLines} hidden common lines`,children:[(0,F.jsx)(`span`,{children:e.header}),(0,F.jsxs)(`span`,{className:`review-context-controls`,children:[n&&e.location!==`top`?(0,F.jsx)(`button`,{type:`button`,disabled:r,"aria-label":`Show 10 lines above`,onClick:()=>t(`above`),children:`+10↑`}):null,n&&e.location!==`top`?(0,F.jsx)(`span`,{"aria-hidden":`true`,children:`−`}):null,(0,F.jsxs)(`button`,{type:`button`,disabled:r,"aria-label":`Show all ${e.hiddenLines} common lines`,onClick:()=>t(`all`),children:[`+`,e.hiddenLines,` common `,e.hiddenLines===1?`line`:`lines`]}),n&&e.location!==`bottom`?(0,F.jsx)(`span`,{"aria-hidden":`true`,children:`−`}):null,n&&e.location!==`bottom`?(0,F.jsx)(`button`,{type:`button`,disabled:r,"aria-label":`Show 10 lines below`,onClick:()=>t(`below`),children:`+10↓`}):null]}),e.expansion.error?(0,F.jsx)(`span`,{className:`review-context-error`,role:`alert`,children:e.expansion.error}):null]})}function dt({contextKeyPrefix:e,contextGapExpansions:t,file:n,mode:r,preferences:i,renderAttachment:a,onExpandContext:o,onExpandSkippedContext:s}){let c=nt(n.path),l=n.diff.hunks.reduce((e,t)=>{for(let n of[...t.commonContext??[],...t.rows])n.left?.missingNewlineAtEnd&&(e.left=!0),n.right?.missingNewlineAtEnd&&(e.right=!0);return e},{left:!1,right:!1}),u=(t,r,a)=>{let o=Math.max(t.leftLines??0,t.rightLines??0),c=st(e,n.path,n.diff.hunks,a),l=i.context,u=Math.min(10,o);return(0,F.jsxs)(`button`,{type:`button`,className:`review-skipped-row`,onClick:()=>s(c,a,Math.min(1e4,l+u)),children:[`Show `,u,` more common lines (`,o,` hidden)`]},r)},d=(e,t,n)=>(0,F.jsx)(F.Fragment,{children:(i.ignoreWhitespace===`NONE`?e:e.filter(e=>!e.whitespaceOnly)).map((e,o)=>{let s=`${n}:${t}:${e.left?.line??``}:${e.right?.line??``}:${o}`;if(r===`unified`){if(e.kind===`skipped`)return u(e,s,t);if(e.kind===`context`){let t=e.right??e.left;return(0,F.jsx)(H,{intraline:t?.intraline,kind:`context`,language:c,line:t?.line,side:S(`context`,!!e.right),text:t?.text??``,preferences:i,renderAttachment:a},s)}return e.kind===`changed`?(0,F.jsxs)(E.Fragment,{children:[(0,F.jsx)(H,{intraline:e.left?.intraline,kind:`deleted`,language:c,line:e.left?.line,side:S(`deleted`,!1),text:e.left?.text??``,preferences:i,renderAttachment:a}),(0,F.jsx)(H,{intraline:e.right?.intraline,kind:`added`,language:c,line:e.right?.line,side:S(`added`,!0),text:e.right?.text??``,preferences:i,renderAttachment:a})]},s):e.left?(0,F.jsx)(H,{intraline:e.left.intraline,kind:`deleted`,language:c,line:e.left.line,side:S(`deleted`,!1),text:e.left.text,preferences:i,renderAttachment:a},s):(0,F.jsx)(H,{intraline:e.right?.intraline,kind:`added`,language:c,line:e.right?.line,side:S(`added`,!!e.right),text:e.right?.text??``,preferences:i,renderAttachment:a},s)}return e.kind===`skipped`?u(e,s,t):(0,F.jsx)(at,{kind:e.kind,language:c,leftIntraline:e.left?.intraline,leftLine:e.left?.line,leftText:e.left?.text,rightIntraline:e.right?.intraline,rightLine:e.right?.line,rightText:e.right?.text,preferences:i,renderAttachment:a},s)})}),f=n.diff.hunks.map((r,a)=>lt(e,t,n,a,i.context)),p=ut(e,t,n,i.context),m=[...f,...p?[p]:[]].filter(e=>e.hiddenLines>0&&e.hiddenLines<=3&&!e.expansion.pending&&!e.expansion.error),h=m.map(e=>`${e.key}:${e.hiddenLines}:${e.oldHiddenStart}:${e.newHiddenStart}`).join(`|`),g=(0,E.useRef)(o);g.current=o,(0,E.useEffect)(()=>{for(let e of m)g.current(e,`all`,{lines:e.hiddenLines,newStart:e.newHiddenStart,oldStart:e.oldHiddenStart})},[h]);let _=(e,t)=>{let n=t===`all`?e.hiddenLines:Math.min(10,e.hiddenLines),r=t===`below`?e.hiddenLines-n:0;o(e,t,{lines:n,newStart:e.newHiddenStart+r,oldStart:e.oldHiddenStart+r})},v=(e,t)=>{let n=e.expansion.aboveRows.length>0||e.expansion.belowRows.length>0,r=e.hiddenLines>3||!!e.expansion.error;return(0,F.jsxs)(F.Fragment,{children:[d(e.baseAboveRows,t,`context`),d(e.expansion.aboveRows,t,`context`),r?(0,F.jsx)(J,{gap:e,onExpand:t=>_(e,t)}):null,!r&&e.hiddenLines>0?(0,F.jsxs)(`div`,{className:`review-diff-hunk interactive loading`,role:`status`,children:[(0,F.jsx)(`span`,{children:e.header}),(0,F.jsxs)(`span`,{children:[`Loading `,e.hiddenLines,` common `,e.hiddenLines===1?`line`:`lines`,`…`]})]}):null,!r&&e.hiddenLines===0&&!n&&e.location!==`bottom`?(0,F.jsx)(`div`,{className:`review-diff-hunk ${t>0?`secondary`:``}`,children:(0,F.jsx)(`span`,{children:e.header})}):null,d(e.expansion.belowRows,t,`context`),d(e.baseBelowRows,t,`context`)]})};return(0,F.jsxs)(F.Fragment,{children:[n.diff.hunks.map((e,t)=>(0,F.jsxs)(E.Fragment,{children:[v(f[t],t),d(U(e.rows).body,t,`change`)]},`${e.header}:${t}`)),p?v(p,n.diff.hunks.length):null,l.left||l.right?(0,F.jsx)(`div`,{className:`review-newline-warning`,role:`note`,children:[l.left?`No newline at end of left file.`:``,l.right?`No newline at end of right file.`:``].filter(Boolean).join(` — `)}):null]})}function ft({row:e}){return e.diffLoadError?(0,F.jsxs)(`div`,{className:`review-diff-message error`,role:`alert`,children:[`Could not load diff: `,e.diffLoadError]}):e.diffLoadPending?(0,F.jsx)(`div`,{className:`review-diff-message`,role:`status`,children:`Loading diff…`}):e.diffStatus===`binary`?(0,F.jsx)(`div`,{className:`review-diff-message`,children:`Binary file changed`}):e.diffStatus===`too-expensive`?(0,F.jsx)(`div`,{className:`review-diff-message`,children:`Diff too large to render`}):e.diffStatus===`not-loaded`?(0,F.jsx)(`div`,{className:`review-diff-message`,children:`Diff not loaded yet`}):null}function pt({disabled:e,draft:t,target:n,onCancel:r,onDraftChange:i,onSave:a}){let o=n.side===`right`?`Patchset`:n.side===`left`?`Base`:`file`;return(0,F.jsxs)(`form`,{className:`review-comment-editor`,onSubmit:e=>{e.preventDefault(),a()},children:[(0,F.jsxs)(`header`,{children:[`Comment on `,n.range?n.range.start_line===n.range.end_line?`${o} line ${n.range.start_line}, columns ${n.range.start_character+1}–${n.range.end_character}`:`${o} lines ${n.range.start_line}–${n.range.end_line}`:`${o} line ${n.line}`]}),(0,F.jsx)(`textarea`,{"aria-label":`Review comment`,name:`farming-review-comment`,inputMode:`text`,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,enterKeyHint:`done`,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-bwignore":`true`,"data-form-type":`other`,autoFocus:!0,placeholder:`Leave a review comment…`,value:t,onChange:e=>i(e.target.value)}),(0,F.jsxs)(`footer`,{children:[(0,F.jsx)(`button`,{type:`button`,onClick:r,children:`CANCEL`}),(0,F.jsx)(`button`,{type:`submit`,disabled:e||!t.trim(),children:e?`SAVING…`:`SAVE COMMENT`})]})]})}function mt({comment:e,disabled:t,onDelete:n,onStatusChange:r}){let a=e.side===`right`?`Patchset`:e.side===`left`?`Base`:`File`,o=e.status||`open`,s=e.range?e.range.start_line===e.range.end_line?`${a} line ${e.range.start_line}, columns ${e.range.start_character+1}–${e.range.end_character}`:`${a} lines ${e.range.start_line}–${e.range.end_line}`:`${a} line ${e.line}`;return(0,F.jsxs)(`article`,{className:`review-comment-thread ${o}`,children:[(0,F.jsxs)(`header`,{children:[(0,F.jsx)(`span`,{children:o===`outdated`?`Outdated · ${s}`:s}),(0,F.jsxs)(`span`,{className:`review-comment-actions`,children:[(0,F.jsx)(`button`,{type:`button`,disabled:t,onClick:()=>r(o===`resolved`?`open`:`resolved`),children:o===`resolved`?`REOPEN`:`RESOLVE`}),(0,F.jsx)(`button`,{type:`button`,"aria-label":`Delete comment on line ${e.line}`,disabled:t,onClick:n,children:(0,F.jsx)(i,{})})]})]}),(0,F.jsx)(`p`,{children:e.body})]})}function ht(e,t){let n=(e instanceof Element?e:e?.parentElement)?.closest(`code[data-review-line][data-review-side]`)??null;return n&&t.contains(n)?n:null}function gt(e,t,n){let r=document.createRange();r.selectNodeContents(e);try{r.setEnd(t,n)}catch{return 0}return r.toString().length}function _t(e){let t=window.getSelection();if(!t||t.isCollapsed||!t.anchorNode||!t.focusNode)return null;let n=ht(t.anchorNode,e),r=ht(t.focusNode,e);if(!n||!r)return null;let i=n.dataset.reviewSide;if(i!==r.dataset.reviewSide||i!==`left`&&i!==`right`&&i!==`unified`)return null;let a=Number(n.dataset.reviewLine),o=Number(r.dataset.reviewLine);if(!Number.isInteger(a)||!Number.isInteger(o))return null;let s={character:gt(n,t.anchorNode,t.anchorOffset),line:a},c={character:gt(r,t.focusNode,t.focusOffset),line:o},l=s.line<c.line||s.line===c.line&&s.character<=c.character,u=l?s:c,d=l?c:s;return u.line===d.line&&u.character===d.character?null:{line:d.line,range:{end_character:d.character,end_line:d.line,start_character:u.character,start_line:u.line},side:i}}function Y(){let e=typeof window<`u`&&new URLSearchParams(window.location.search).get(`fixture`)===`1`,[t]=(0,E.useState)(()=>{let e=typeof window>`u`?``:window.location.search;return{requested:new URLSearchParams(e).has(`acpItem`),route:Fe(e)}}),n=t.route,[i]=(0,E.useState)(()=>ze(typeof window>`u`?null:window.location)),d=!e&&!t.requested&&i.request&&(i.request.source===`working-copy`||i.request.head===`now`)?i.request:null,[f,p]=(0,E.useState)(()=>d||t.requested?null:i.request),[m,h]=(0,E.useState)(null),[g,_]=(0,E.useState)(`final`),[v,y]=(0,E.useState)(!!(d||n)),b=t.requested?!n:!!i.error,x=!e,S=f?.source===`working-copy`,ne=f?.source===`git-range`,[ie,C]=(0,E.useState)(()=>b?{[L]:[]}:Ye(f,e)),[w,T]=(0,E.useState)(t.requested?n?``:`ACP review target is invalid`:i.error??``),[_e,De]=(0,E.useState)(null),[D,Ae]=(0,E.useState)(()=>{let t=b?{[L]:[]}:Ye(f,e);return Xe({basePatchset:b?`Base`:Je(f,e),catalog:t,comments:[],initialPatchset:b?L:qe(f,e),initiallyExpand:!x,reviewId:x?void 0:we})}),O=(0,E.useRef)(D),k=(0,E.useRef)(ie);k.current=ie;let[A,j]=(0,E.useState)(We),[Ne,M]=(0,E.useState)(!1),[Ie,Le]=(0,E.useState)(!1),[N,Re]=(0,E.useState)(``),[P,I]=(0,E.useState)(``),[Ve,He]=(0,E.useState)(``),[Ue,R]=(0,E.useState)([]),[Ze,z]=(0,E.useState)({}),[B,Qe]=(0,E.useState)(null),[nt,rt]=(0,E.useState)(``),[V,it]=(0,E.useState)(!1),[H,at]=(0,E.useState)(()=>new URLSearchParams(window.location.search).get(`comparison`)||``),[U,W]=(0,E.useState)(!1),ot=(0,E.useRef)(null),G=x?D.reviewId??``:we,K=D.patchRange.patchset,st=D.patchRange.basePatchset,q=oe(D,K),lt=new Set(q.expandedPaths),ut=D.diffMode,J=!!(m&&f?.source===`git-range`&&f.reviewId===m.reviewId&&f.head===m.head),ht=J?m?.scope:f?.source===`working-copy`?f.scope:void 0,gt=ht===`untracked`?`unified`:ut,Y=D.preferences,vt=f?{...f,context:Y.context,ignoreWhitespace:Y.ignoreWhitespace}:null,yt=(0,E.useRef)(vt);yt.current=vt;let X=J?{..._e??{workingTree:!0},head:void 0,workingTree:!0}:_e,Z=D.commentDraft,bt=D.commentDraft?.body??``,Q=ie[K]??[],xt=Q.reduce((e,t)=>e+t.added,0),St=Q.reduce((e,t)=>e+t.removed,0),Ct=Math.max(1,...Q.map(e=>e.added+e.removed)),$=e=>{let t=re(O.current,e,k.current);if(t.state!==O.current){O.current=t.state,Ae(t.state);for(let e of t.effects){if(e.type===`load-file-diff`){let t=yt.current;if(!t){$(Me(e,`review file diff source is unavailable`));continue}fe(t,e.path).then(t=>{let n=je(k.current,e,t,{reviewId:O.current.reviewId});k.current=n.catalog,C(n.catalog),$(n.action)}).catch(t=>$(Me(e,t)))}if(e.type===`save-reviewed-status`){let t=e.reviewId??G;le({...e,reviewId:t}).then(t=>$({patchset:e.patchset,paths:e.changes.map(e=>e.path),reviewedPaths:t.reviewedPaths,...e.reviewId?{reviewId:e.reviewId}:{},revision:t.revision,type:`commit-reviewed-status`})).catch(async n=>{let r=n instanceof be&&n.state?n.state:await xe(t,e.patchset).catch(()=>null);if(!r){let t=oe(O.current,e.patchset),n=new Set(t.reviewedPaths);for(let t of e.changes)t.reviewed?n.delete(t.path):n.add(t.path);r={reviewedPaths:[...n],revision:e.revision}}$({patchset:e.patchset,reviewedPaths:r.reviewedPaths,...e.reviewId?{reviewId:e.reviewId}:{},revision:r.revision,type:`restore-reviewed-status`}),Re(n instanceof Error?`Could not save Reviewed: ${n.message}`:`Could not save Reviewed status`)})}if(e.type===`save-comment`){let t=e.reviewId??G;me(t,e.comment).then(()=>$({id:e.comment.id,patchset:e.comment.patchset,pendingType:`save`,...e.reviewId?{reviewId:e.reviewId}:{},type:`commit-comment`})).catch(async n=>{$({comments:await Ce(t,e.comment.patchset).catch(()=>O.current.comments.filter(t=>t.id!==e.comment.id)),id:e.comment.id,patchset:e.comment.patchset,pendingType:`save`,...e.reviewId?{reviewId:e.reviewId}:{},type:`restore-comments`}),I(n instanceof Error?`Could not save comment: ${n.message}`:`Could not save comment`)})}if(e.type===`delete-comment`){let t=e.reviewId??G;ue(t,e.comment.patchset,e.comment.id).then(()=>$({id:e.comment.id,patchset:e.comment.patchset,pendingType:`delete`,...e.reviewId?{reviewId:e.reviewId}:{},type:`commit-comment`})).catch(async n=>{$({comments:await Ce(t,e.comment.patchset).catch(()=>[...O.current.comments,e.comment]),id:e.comment.id,patchset:e.comment.patchset,pendingType:`delete`,...e.reviewId?{reviewId:e.reviewId}:{},type:`restore-comments`}),I(n instanceof Error?`Could not delete comment: ${n.message}`:`Could not delete comment`)})}}}};(0,E.useEffect)(()=>(document.body.classList.add(`review-body`),()=>document.body.classList.remove(`review-body`)),[]),(0,E.useEffect)(()=>{if(!U)return;let e=e=>{ot.current?.contains(e.target)||W(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[U]),(0,E.useEffect)(()=>{if(!d&&!n)return;let e=!0;return y(!0),(n?Se(n.agentId,n.itemIds):(()=>{let e=d;return ge(`root`in e&&typeof e.root==`string`?{root:e.root}:{agentId:e.agentId},e.source===`git-range`?e.base:`HEAD`,e.source===`working-copy`?{modifiedWithinDays:e.modifiedWithinDays,paths:e.paths,scope:e.scope}:void 0)})()).then(t=>{if(!e)return;let n=he(t,`final`),r=new URLSearchParams(window.location.search);r.delete(`agentId`),r.delete(`acpItem`),r.set(`root`,t.root),r.set(`base`,n.base),r.set(`head`,n.head),r.set(`reviewId`,t.reviewId),r.set(`comparison`,`last-turn`),window.history.replaceState(null,``,`${window.location.pathname}?${r.toString()}`),h(t),_(`final`),at(`last-turn`),p(n),T(``)}).catch(t=>{e&&T(t instanceof Error?t.message:`review capture failed`)}).finally(()=>{e&&y(!1)}),()=>{e=!1}},[n,d]),(0,E.useEffect)(()=>{if(d||n||f?.source!==`git-range`||!f.reviewId)return;let e=!0;return pe(f.reviewId).then(t=>{if(!e)return;let n=t.revisions.find(e=>e.head===f.head)??t;h(n),at(e=>e||`last-turn`),_(f.base===n.fixesBase&&n.fixesBase!==n.base?`fixes`:`final`)}).catch(()=>{}),()=>{e=!1}},[n,d,f]),(0,E.useEffect)(()=>{if(!f)return;let e=!0,t=Ke();return ve({...f,context:t.context,ignoreWhitespace:t.ignoreWhitespace,metadataOnly:!0}).then(async n=>{let[r,i]=await Promise.all([xe(n.reviewId,n.patchset).catch(()=>null),Ce(n.reviewId,n.patchset).catch(()=>[])]);if(!e)return;let a=ee(Oe(n),n.patchset,i.map(e=>e.path)),o=ke({comments:i,preferences:t,...r?{reviewedPaths:r.reviewedPaths}:{},snapshot:n});r&&(o=re(o,{patchset:n.patchset,reviewedPaths:r.reviewedPaths,reviewId:n.reviewId,revision:r.revision,type:`hydrate-reviewed-status`},a).state),O.current=o,k.current=a,De(n.comparison??null),C(a),Ae(o),T(``)}).catch(t=>{e&&T(t instanceof Error?t.message:`review diff request failed`)}),()=>{e=!1}},[f]),(0,E.useEffect)(()=>{if(!N)return;let e=window.setTimeout(()=>Re(``),4e3);return()=>window.clearTimeout(e)},[N]),(0,E.useEffect)(()=>{if(!P)return;let e=window.setTimeout(()=>I(``),4e3);return()=>window.clearTimeout(e)},[P]),(0,E.useEffect)(()=>{try{window.localStorage.setItem(Ge,JSON.stringify(Y))}catch{}},[D.preferences]),(0,E.useEffect)(()=>{if(x||!G||!k.current[K])return;let e=!0;return xe(G,K).then(t=>{e&&$({patchset:K,reviewedPaths:t.reviewedPaths,reviewId:G,revision:t.revision,type:`hydrate-reviewed-status`})}).catch(()=>{}),Ce(G,K).then(t=>{if(!e)return;let n=ee(k.current,K,t.map(e=>e.path));n!==k.current&&(k.current=n,C(n)),$({comments:t,patchset:K,reviewId:G,type:`hydrate-comments`})}).catch(()=>{}),()=>{e=!1}},[x,K,G]),(0,E.useEffect)(()=>{let e=()=>{let e=``;for(let t of document.querySelectorAll(`.review-file-change.expanded[data-file-path]`)){let n=t.querySelector(`.review-file-change-header`);if(!n)continue;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect();i.top<=1&&r.bottom>i.bottom&&(e=t.dataset.filePath??``)}He(t=>t===e?t:e)};return e(),window.addEventListener(`scroll`,e,{passive:!0}),document.body.addEventListener(`scroll`,e,{passive:!0}),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e),document.body.removeEventListener(`scroll`,e),window.removeEventListener(`resize`,e)}},[K,q.expandedPaths.join(`\0`)]);let wt=!!q.pendingReview,Tt=!!q.pendingComment,Et=(e,t)=>{$({path:e,reviewed:t,type:`set-file-reviewed`})},Dt=e=>{$({patchset:e,type:`select-patchset`})},Ot=Q.length>0&&Q.every(e=>lt.has(e.path)),kt=e=>{$({path:e,type:`toggle-file-expanded`})},At=()=>{j(Y),M(!0)},jt=()=>{let e=Y,t=te(A),n=e.context!==t.context||e.ignoreWhitespace!==t.ignoreWhitespace;if($({preferences:t,type:`set-preferences`}),M(!1),n&&z({}),!x||!f||!n)return;let r=K,i=new Map(Q.map(e=>[e.path,e])),a=q.expandedPaths.filter(e=>{let t=i.get(e);return!!(t&&t.kind!==`unmodified`&&!t.binary&&!t.diffTooExpensive)});a.length&&(R(e=>[...new Set([...e,...a])]),Be({...f,context:t.context,ignoreWhitespace:t.ignoreWhitespace},a).then(e=>{if(O.current.patchRange.patchset!==r)return;let t=k.current;for(let n of e.files)t=se(t,r,n);k.current=t,C(t);let n=e.errors[0];n&&T(n.message)}).finally(()=>R(e=>e.filter(e=>!a.includes(e)))))},Mt=()=>{navigator.clipboard&&navigator.clipboard.writeText(`34a15ae`).catch(()=>{}),Le(!0),window.setTimeout(()=>Le(!1),1200)},Nt=(e,t)=>{let n=yt.current;if(!n||Ue.includes(e))return;let r=K;R(t=>[...t,e]),fe({...n,context:t},e).then(e=>{let t=se(k.current,r,e);k.current=t,C(t)}).catch(e=>T(e instanceof Error?e.message:`review context request failed`)).finally(()=>R(t=>t.filter(t=>t!==e)))},Pt=(e,t,n,r)=>{let i=yt.current;if(t.expansion.pending||r.lines<1)return;let a=e=>{z(r=>{let i=r[t.key]??ct();return{...r,[t.key]:n===`below`?{...i,belowRows:[...e,...i.belowRows],error:void 0,pending:void 0}:{...i,aboveRows:[...i.aboveRows,...e],error:void 0,pending:void 0}}})},o=e=>{let n=e instanceof Error?e.message:`review context request failed`;z(e=>{let r=e[t.key]??ct();return{...e,[t.key]:{...r,error:n,pending:void 0}}})};if(z(e=>{let r=e[t.key]??ct();return{...e,[t.key]:{...r,error:void 0,pending:n}}}),!i){let e=t.availableRows.filter(e=>{let t=e.left?.line,n=e.right?.line;return t!==void 0&&n!==void 0&&t>=r.oldStart&&t<r.oldStart+r.lines&&n>=r.newStart&&n<r.newStart+r.lines});e.length===r.lines?a(e):o(Error(`review context is unavailable`));return}Te(i,e.path,r).then(e=>a(e.rows)).catch(o)},Ft=(e,t,n,r)=>{$({line:t,path:e,range:r,side:n,type:`start-comment`})},It=()=>{!Z||!bt.trim()||$({id:typeof crypto?.randomUUID==`function`?crypto.randomUUID():`comment-${Date.now()}-${Math.random().toString(36).slice(2)}`,type:`save-comment`})},Lt=(e,t)=>{G&&Ee(G,e.patchset,e.id,t).then(()=>Ce(G,e.patchset)).then(t=>$({comments:t,patchset:e.patchset,reviewId:G,type:`hydrate-comments`})).catch(e=>I(e instanceof Error?e.message:`review comment status failed`))},Rt=(e,t)=>{let n=he(e,t),r=new URLSearchParams(window.location.search);r.delete(`agentId`),r.set(`root`,e.root),r.set(`base`,n.base),r.set(`head`,n.head),r.set(`reviewId`,e.reviewId),r.set(`comparison`,`last-turn`),window.history.replaceState(null,``,`${window.location.pathname}?${r.toString()}`),h(e),_(t),at(`last-turn`),W(!1),p(n)},zt=f&&`root`in f&&f.root?{root:f.root}:f&&`agentId`in f&&f.agentId?{agentId:f.agentId}:m?{root:m.root}:null,Bt=()=>{let e=!U;W(e),!(!e||B||V||!zt)&&(it(!0),rt(``),de(zt).then(Qe).catch(e=>rt(e instanceof Error?e.message:`Comparison sources could not be loaded`)).finally(()=>it(!1)))},Vt=e=>{if(!B)return;let t={base:e.base,head:e.head,metadataOnly:!0,root:B.root,source:`git-range`},n=new URLSearchParams(window.location.search);n.delete(`agentId`),n.delete(`reviewId`),n.delete(`path`),n.delete(`scope`),n.delete(`modifiedWithinDays`),n.set(`root`,B.root),n.set(`base`,e.base),n.set(`head`,e.head),n.set(`comparison`,e.id),window.history.replaceState(null,``,`${window.location.pathname}?${n.toString()}`),at(e.id),W(!1),_(`final`),p(t)},Ht=()=>{!m||v||(y(!0),ye(m.reviewId).then(e=>{Rt(e,e.number>1?`fixes`:`final`),T(``)}).catch(e=>T(e instanceof Error?e.message:`review refresh failed`)).finally(()=>y(!1)))},Ut=e=>{!m||e===g||Rt(m,e)},Wt=ht,Gt=Wt===`tracked`?`Changes`:Wt===`untracked`?`Untracked`:`Files`,Kt=B?[B.unstaged,B.staged,...B.commits,...B.branches].find(e=>e.id===H):null,qt=J?`Last Turn`:Kt?.id.startsWith(`commit:`)?`Commit · ${Kt.label}`:Kt?.id.startsWith(`branch:`)?`Branch · ${Kt.label}`:Kt?.label??(S?`Working copy`:ne?`Changes`:Gt),Jt=H===`staged`?`Staged changes`:X?.workingTree?`Workspace changes`:X?.head?.message.split(`
|
|
1
|
+
import{r as e}from"./chunk-DECur_0Z.js";import{i as t,t as n}from"./jsx-runtime-BthL93pI.js";import{C as r,d as i,h as a,l as o,m as s,o as c,p as l,s as u}from"./IconGlyphs-DfL0EBnj.js";import{a as d,c as f,d as p,i as m,l as h,n as g,o as _,r as v,s as y,t as b,u as x}from"./core-ZlAPicox.js";import{A as S,C as ee,D as te,E as ne,F as re,M as ie,N as C,O as ae,P as oe,S as se,T as ce,_ as le,a as ue,b as w,c as de,d as fe,f as pe,g as me,h as he,i as ge,j as T,k as _e,l as ve,m as ye,n as be,p as xe,r as Se,s as Ce,t as we,u as Te,v as Ee,w as De,x as Oe,y as ke}from"./api-D1lyBYIQ.js";var E=e(t());function D(e){let t=[`package`,`import`,`option`,`optional`,`required`,`repeated`,`group`,`oneof`],n=[`double`,`float`,`int32`,`int64`,`uint32`,`uint64`,`sint32`,`sint64`,`fixed32`,`fixed64`,`sfixed32`,`sfixed64`,`bool`,`string`,`bytes`],r={match:[/(message|enum|service)\s+/,e.IDENT_RE],scope:{1:`keyword`,2:`title.class`}};return{name:`Protocol Buffers`,aliases:[`proto`],keywords:{keyword:t,type:n,literal:[`true`,`false`]},contains:[e.QUOTE_STRING_MODE,e.NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,r,{className:`function`,beginKeywords:`rpc`,end:/[{;]/,excludeEnd:!0,keywords:`rpc returns`},{begin:/^\s*[A-Z_]+(?=\s*=[^\n]+;$)/}]}}function Ae(e){return e instanceof Error&&e.message.trim()?e.message.trim():typeof e==`string`&&e.trim()?e.trim():`review file diff request failed`}function O(e){return e.diffLoaded===!1&&!ie(e)}function je(e,t,n,r={}){if(t.reviewId!==void 0&&r.reviewId!==t.reviewId)throw Error(`loaded review file belongs to a stale review`);if(n.path!==t.path)throw Error(`loaded review file path does not match requested path`);if(O(n))throw Error(`loaded review file is still a metadata-only row`);if(!e[t.patchset]?.some(e=>e.path===t.path))throw Error(`loaded review file path is no longer in the review catalog`);return{action:{patchset:t.patchset,path:t.path,...t.reviewId?{reviewId:t.reviewId}:{},type:`commit-file-diff-load`},catalog:se(e,t.patchset,{...n,diffLoaded:!0})}}function Me(e,t){return{error:Ae(t),patchset:e.patchset,path:e.path,...e.reviewId?{reviewId:e.reviewId}:{},type:`fail-file-diff-load`}}function k(e){return e===`added`?`A`:e===`copied`?`C`:e===`deleted`?`D`:e===`renamed`?`R`:e===`rewritten`?`W`:e===`unmodified`?`U`:e===`reverted`?`X`:`M`}function A(e){return e.status?e.status:k(e.kind)}function j(e){return _e(e)}function Ne(e){return e.binary?`binary`:ie(e)?`too-expensive`:e.diffLoaded===!1?`not-loaded`:`loaded`}function Pe(e,t,n={}){let r=n.patchset??e.patchRange.patchset,i=C(e,t.path,r),a=oe(e,r),o=i.loaded?i.status===`reviewed`:null;return{action:o===null?null:{ariaLabel:o?`Mark as unreviewed`:`Mark as reviewed`,disabled:!!n.mutationPending,label:o?`MARK UNREVIEWED`:`MARK REVIEWED`,nextReviewed:!o,visibility:`on-row-interaction`},added:t.added,binary:t.binary===!0,changeLabel:A(t),commentPaths:j(t),deleted:t.removed,...T(e,t.path,r)?{diffLoadError:T(e,t.path,r)}:{},diffLoadPending:a.pendingDiffPaths.includes(t.path),diffStatus:Ne(t),diffTooExpensive:t.diffTooExpensive===!0||t.diff.truncated===!0,expanded:a.expandedPaths.includes(t.path),...t.newMode?{newMode:t.newMode}:{},...t.newSha?{newSha:t.newSha}:{},...t.oldMode?{oldMode:t.oldMode}:{},...t.oldSha?{oldSha:t.oldSha}:{},path:t.path,pending:i.pending,...t.previousPath?{previousPath:t.previousPath}:{},reviewed:o,reviewedLabel:o===!0?`Reviewed`:null,reviewStatusLoaded:i.loaded,...Number.isInteger(t.size)?{size:t.size}:{},...Number.isInteger(t.sizeDelta)?{sizeDelta:t.sizeDelta}:{}}}function Fe(e){let t=typeof e==`string`?new URLSearchParams(e):e,n=t.get(`agentId`)?.trim()||``,r=[...new Set(t.getAll(`acpItem`).map(e=>e.trim()).filter(Boolean))];return!n||r.length===0||r.length>256?null:{agentId:n,itemIds:r}}function M(e,t,n){let r=e.get(t);if(r===null||r.trim()===``||!/^\d+$/.test(r.trim()))return;let i=Number(r.trim());return Number.isSafeInteger(i)&&i>=n?i:void 0}function Ie(e){let t=e.get(`ignoreWhitespace`);if(t===`ALL`||t===`IGNORE_ALL`)return`ALL`;if(t===`TRAILING`||t===`IGNORE_TRAILING`)return`TRAILING`;if(t===`LEADING_AND_TRAILING`||t===`IGNORE_LEADING_AND_TRAILING`)return`LEADING_AND_TRAILING`}function Le(e){let t=e.get(`metadataOnly`);return t===`1`||t===`true`?!0:void 0}function N(e){let t=e.get(`scope`);return t===`tracked`||t===`untracked`?t:void 0}function Re(e){let t=M(e,`context`,0),n=Ie(e),r=M(e,`limit`,1),i=Le(e),a=M(e,`modifiedWithinDays`,1),o=N(e),s=e.getAll(`path`).map(e=>e.trim()).filter(Boolean);return{...t===void 0?{}:{context:t},...n?{ignoreWhitespace:n}:{},...r===void 0?{}:{limit:r},...i===!0?{metadataOnly:i}:{},...o?{scope:o}:{},...s.length>0?{paths:s}:{},...o===`untracked`&&a!==void 0?{modifiedWithinDays:a}:{}}}function P(e){let t=typeof e==`string`?new URLSearchParams(e):e,n=t.get(`agentId`)?.trim()||``,r=t.get(`root`)?.trim()||``;if(n&&r)return{error:`only one review workspace target is allowed`,request:null};if(!n&&!r)return{request:null};let i=n?{agentId:n}:{root:r},a=Re(t),o=t.get(`reviewId`)?.trim()||``,s=t.get(`base`),c=t.get(`head`);if(!(s!==null||c!==null))return{request:{...i,...a,source:`working-copy`}};let l=w(s||``),u=w(c||``);return!l||!u?{error:`base and head revisions are invalid`,request:null}:{request:{...i,base:l,head:u,...a,...o?{reviewId:o}:{},source:`git-range`}}}function ze(e){return P(e?.search??``)}var F=n();async function Be(e,t){let n=[],r=[],i=0;return await Promise.all(Array.from({length:Math.min(4,t.length)},async()=>{for(;i<t.length;){let a=t[i++];if(a)try{n.push(await fe(e,a))}catch(e){r.push(e instanceof Error?e:Error(`review file diff request failed`))}}})),{errors:r,files:n}}function I(e){let t=nt(e.path),n=t===`python`,r=Ze(e.path).replace(/\W/g,`_`),i=(e,t)=>({kind:`context`,left:{line:e,text:t},right:{line:e,text:t}}),a=Array.from({length:128},(e,n)=>{let r=n+1,a=t===`python`?`#`:t===`markdown`?`<!--`:`//`,o=t===`markdown`?` -->`:``,s=r>=29?`unchanged review context ${r-28}`:`unchanged review prelude ${r}`;return i(r,`${r===29||r===128?` `:``}${a} ${s}${o}`)});if(e.kind===`added`){let t=n?`${r} = create_review_snapshot()`:`export const ${r} = createReviewSnapshot()`,i=n?`__all__ = ["${r}"]`:`export default ${r}`;return{hunks:[{header:`@@ -0,0 +1,2 @@ ${e.path}`,oldStart:0,oldLines:0,newStart:1,newLines:2,rows:[{kind:`added`,right:{line:1,text:t}},{kind:`added`,right:{line:2,text:i}}]}]}}if(e.kind===`deleted`){let t=n?`def summarize_changes():`:`export function summarizeChanges() {`,r=n?` return "legacy summary"`:` return 'legacy summary'`;return{hunks:[{header:`@@ -1,2 +0,0 @@ ${e.path}`,oldStart:1,oldLines:2,newStart:0,newLines:0,rows:[{kind:`deleted`,left:{line:1,text:t}},{kind:`deleted`,left:{line:2,text:r}}]}]}}let o=n?`def create_change_set(input: ChangeInput) -> list[ReviewEntry]:`:`export function createChangeSet(input: ChangeInput) {`,s=n?` return normalize_changes(input.files)`:` return normalizeChanges(input.files)`,c=n?` return create_review_entries(input.files, input.base)`:` return createReviewEntries(input.files, input.base)`,l=n?`def mark_reviewed(path: str) -> ReviewState:`:`export function markReviewed(path: string) {`,u=n?` return {"path": path, "reviewed_at": time.time()}`:` return { path, reviewedAt: Date.now() }`,d=n?`if not path:`:` if (!path) return null`,f=n?` return None`:` const snapshot = readSnapshot(input.base)`,p=n?`return {**snapshot, "files": input.files}`:` return { ...snapshot, files: input.files }`,m=n?``:`}`,h=n?` return finalize_change_set(input) `:` return finalizeChangeSet(input) `;return{hunks:[{commonContext:a,header:`@@ -129,7 +129,10 @@ ${e.path}`,oldStart:129,oldLines:7,newStart:129,newLines:10,rows:[i(129,o),{kind:`deleted`,left:{line:130,text:s}},{kind:`added`,right:{line:130,text:c}},i(131,m),{kind:`added`,right:{line:133,text:l}},{kind:`added`,right:{line:134,text:u}},i(135,d),i(136,f),{kind:`added`,right:{line:137,text:p}},i(138,m),{kind:`deleted`,left:{line:139,text:h},whitespaceOnly:!0},{kind:`added`,right:{line:139,text:h.trimEnd()},whitespaceOnly:!0}]}]}}function Ve(e){return{...e,diff:I(e)}}var He=Object.fromEntries(Object.entries({"Patchset 20":[{path:`clis/dataflow.py`,kind:`modified`,added:2,removed:85},{path:`clis/diagnose.py`,kind:`modified`,added:8,removed:11},{path:`clis/fetch_instance_log.py`,kind:`deleted`,added:0,removed:573},{path:`clis/fetch_logview.py`,kind:`modified`,added:2,removed:2},{path:`clis/fetch_meta_timeline.py`,kind:`modified`,added:0,removed:2},{path:`clis/fetch_quota_snapshot.py`,kind:`deleted`,added:0,removed:290},{path:`clis/hbo_plan_diagnose.py`,kind:`deleted`,added:0,removed:119},{path:`clis/parse_logview.py`,kind:`modified`,added:6,removed:2},{path:`clis/query_sls.py`,kind:`modified`,added:14,removed:2},{path:`devclis/README.md`,kind:`added`,added:15,removed:0},{path:`docs/cli/studio.md`,kind:`modified`,added:1,removed:2},{path:`tests/review/change-set.spec.ts`,kind:`renamed`,previousPath:`tests/changes/change-summary.spec.ts`,added:28,removed:6}],"Patchset 19":[{path:`clis/dataflow.py`,kind:`modified`,added:1,removed:52},{path:`clis/diagnose.py`,kind:`modified`,added:5,removed:6},{path:`clis/fetch_instance_log.py`,kind:`deleted`,added:0,removed:573},{path:`clis/fetch_logview.py`,kind:`modified`,added:1,removed:2},{path:`clis/fetch_meta_timeline.py`,kind:`modified`,added:0,removed:2},{path:`clis/hbo_plan_diagnose.py`,kind:`deleted`,added:0,removed:119},{path:`clis/parse_logview.py`,kind:`modified`,added:4,removed:2},{path:`clis/query_sls.py`,kind:`modified`,added:7,removed:1},{path:`docs/cli/studio.md`,kind:`modified`,added:1,removed:1}]}).map(([e,t])=>[e,t.map(Ve)])),Ue=`Working copy`,L=`Review`,R={"Patchset 20":[`clis/dataflow.py`,`clis/fetch_instance_log.py`],"Patchset 19":[`clis/fetch_instance_log.py`]},We=De,Ge=`farming.review.diff-preferences`;b.registerLanguage(`typescript`,m),b.registerLanguage(`python`,_),b.registerLanguage(`sql`,d),b.registerLanguage(`markdown`,y),b.registerLanguage(`cpp`,x),b.registerLanguage(`java`,h),b.registerLanguage(`protobuf`,D),b.registerLanguage(`json`,f),b.registerLanguage(`yaml`,g),b.registerLanguage(`bash`,p),b.registerLanguage(`xml`,v);function Ke(){if(typeof window>`u`)return We;try{return te(JSON.parse(window.localStorage.getItem(Ge)||`{}`))}catch{return We}}function qe(e,t=!0){return e?e.source===`git-range`?e.head:Ue:t?`Patchset 20`:L}function Je(e,t=!0){return e?e.source===`git-range`?e.base:`HEAD`:`Base`}function Ye(e,t=!0){return e?{[qe(e,t)]:[]}:t?He:{[L]:[]}}function Xe({catalog:e,comments:t,initialPatchset:n,basePatchset:r,initiallyExpand:i,reviewId:a}){let o=ne({catalog:e,comments:t,patchRange:{basePatchset:r,patchset:n},preferences:Ke(),reviewId:a,reviewedPathsByPatchset:n===`Patchset 20`||n===`Patchset 19`?R:{}});return i?{...o,patchsets:Object.fromEntries(Object.keys(e).map(t=>{let n=e[t]??[],r=n[1]?.path??n[0]?.path;return[t,{...oe(o,t),expandedPaths:r?[r]:[]}]}))}:o}function Ze(e){let t=e.split(`/`);return t[t.length-1]||e}function z(e){let t=Math.abs(e);return t<1024?`${e} B`:t<1024*1024?`${(e/1024).toFixed(1)} KiB`:`${(e/(1024*1024)).toFixed(1)} MiB`}function B(e){return e.replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e]??e)}function Qe(e,t,n){return Array.from(e).slice(t,n).join(``)}function $e({action:e,pending:t,reviewed:n,reviewedLabel:r,onToggle:i}){return(0,F.jsxs)(`div`,{className:`review-review-status ${n?`reviewed`:``} ${t?`pending`:``}`,children:[r?(0,F.jsx)(`span`,{className:`review-reviewed-label`,children:r}):null,e?(0,F.jsx)(`button`,{type:`button`,"aria-checked":n===!0,"aria-label":`Reviewed`,"data-action-visibility":e.visibility,disabled:e.disabled,role:`switch`,title:t?`Saving review status`:e.ariaLabel,onClick:i,children:t?`SAVING…`:e.label}):(0,F.jsx)(`span`,{className:`review-review-loading`,children:`Reviewed status loading`})]})}function et({file:e,maxChangeSize:t}){if(e.binary)return(0,F.jsx)(`span`,{className:`review-change-bar binary`,"aria-label":`Binary file`});let n=e=>e===0?0:Math.max(2,Math.round(e/t*72));return(0,F.jsxs)(`span`,{className:`review-change-bar`,"aria-label":`+${e.added} −${e.removed}`,children:[(0,F.jsx)(`i`,{className:`added`,style:{width:`${n(e.added)}px`}}),(0,F.jsx)(`i`,{className:`deleted`,style:{width:`${n(e.removed)}px`}})]})}function tt({file:e}){if(e.binary){let t=typeof e.sizeDelta==`number`&&Number.isInteger(e.sizeDelta)?e.sizeDelta:null;return(0,F.jsx)(`span`,{className:`review-file-stats binary`,children:t===null?`Binary`:z(t)})}return(0,F.jsxs)(`span`,{className:`review-file-stats`,children:[e.added?(0,F.jsxs)(`span`,{className:`added`,children:[`+`,e.added]}):null,e.removed?(0,F.jsxs)(`span`,{className:`removed`,children:[`−`,e.removed]}):null]})}function nt(e){let t=e.toLowerCase();return t.endsWith(`.osql`)||t.endsWith(`.odpsql`)?`sql`:t.endsWith(`.py`)?`python`:t.endsWith(`.md`)||t.endsWith(`.mdx`)?`markdown`:/\.(c|cc|cpp|cxx|h|hh|hpp|hxx)$/.test(t)?`cpp`:t.endsWith(`.java`)?`java`:t.endsWith(`.proto`)?`protobuf`:t.endsWith(`.json`)?`json`:t.endsWith(`.yaml`)||t.endsWith(`.yml`)?`yaml`:/\.(bash|sh|zsh)$/.test(t)?`bash`:/\.(html|htm|xml)$/.test(t)?`xml`:`typescript`}function rt({intraline:e,language:t,line:n,side:r,text:i,preferences:a}){let o=n&&r?{"data-review-line":n,"data-review-side":r}:{},s=a.showTrailingWhitespace?i.match(/[ \t]+$/)?.[0]:void 0,c=s?i.slice(0,-s.length):i,l=a.intralineDifference?e:void 0,u=l?.length?it(c,l,t,a):V(c,t,a);return a.showTabs&&(u=u.replace(/\t/g,`<span class="review-tab-marker">⇥</span>`)),s&&(u+=`<span class="review-trailing-whitespace">${s.replace(/[ \t]/g,`·`)}</span>`),(0,F.jsx)(`code`,{...o,dangerouslySetInnerHTML:{__html:u}})}function V(e,t,n){return n.syntaxHighlighting&&e?b.highlight(e,{language:t,ignoreIllegals:!0}).value:B(e)}function it(e,t,n,r){let i=``,a=0,o=Array.from(e).length;for(let s of t){let t=Math.max(a,Math.min(s.start,o)),c=Math.max(t,Math.min(s.end,o));i+=V(Qe(e,a,t),n,r),c>t&&(i+=`<span class="review-intraline">${V(Qe(e,t,c),n,r)}</span>`),a=c}return i+=V(Qe(e,a),n,r),i}function H({kind:e,intraline:t,language:n,line:r,side:i,text:a,preferences:o,renderAttachment:s}){return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`review-diff-row unified ${e}`,children:[(0,F.jsx)(`span`,{children:r??``}),(0,F.jsx)(rt,{intraline:t,language:n,line:r,side:i,text:a,preferences:o})]}),r?s?.(r,[i]):null]})}function at({kind:e,language:t,leftLine:n,leftIntraline:r,leftText:i,rightLine:a,rightIntraline:o,rightText:s,preferences:c,renderAttachment:l}){let u=a??n,d=[...n?[`left`]:[],...a?[`right`]:[]];return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`review-diff-row ${e}`,children:[(0,F.jsx)(`span`,{children:n??``}),(0,F.jsx)(rt,{intraline:r,language:t,line:n,side:`left`,text:i??``,preferences:c}),(0,F.jsx)(`span`,{children:a??``}),(0,F.jsx)(rt,{intraline:o,language:t,line:a,side:`right`,text:s??``,preferences:c})]}),u?l?.(u,d):null]})}function U(e){let t=e.findIndex(e=>e.kind!==`context`);if(t<0)return{body:e,leading:[],trailing:[]};let n=e.length-1;for(;n>t&&e[n]?.kind===`context`;)--n;return{body:e.slice(t,n+1),leading:e.slice(0,t),trailing:e.slice(n+1)}}function W(e,t,n){let r=e.filter(e=>e.kind!==`context`&&e.kind!==`skipped`);return(t===`first`?r:[...r].reverse()).find(e=>e[n]?.line)?.[n]?.line}function ot(e,t){let n=e[t]?.rows??[],r=e[t-1]?.rows??[],i=[`left`,`right`].flatMap(e=>{let t=W(n,`first`,e);if(!t)return[];let i=W(r,`last`,e);return[Math.max(0,t-(i??0)-1)]});return i.length?Math.min(...i):0}function G(e,t){let n=e[t];if(!n)return 0;let r=e[t-1],i=r?r.oldStart+r.oldLines-1:0,a=r?r.newStart+r.newLines-1:0;return Math.max(0,Math.min(n.oldStart-i-1,n.newStart-a-1))}function K(e){let t=e.diff.hunks[e.diff.hunks.length-1],n=e.diff.leftMeta?.lines,r=e.diff.rightMeta?.lines;if(!t||!Number.isInteger(n)||!Number.isInteger(r))return 0;let i=t.oldStart+t.oldLines-1,a=t.newStart+t.newLines-1;return Math.max(0,Math.min((n??0)-i,(r??0)-a))}function st(e,t,n,r){let i=n[r-1],a=n[r];return`${e}:${t}:${i?`${i.oldStart+i.oldLines-1}:${i.newStart+i.newLines-1}`:`0:0`}>${a?`${a.oldStart}:${a.newStart}`:`0:0`}`}function q(e,t){let n=t.diff.hunks[t.diff.hunks.length-1],r=n?`${n.oldStart+n.oldLines-1}:${n.newStart+n.newLines-1}`:`0:0`;return`${e}:${t.path}:${r}>eof:${t.diff.leftMeta?.lines??0}:${t.diff.rightMeta?.lines??0}`}function ct(){return{aboveRows:[],belowRows:[]}}function lt(e,t,n,r,i){let a=n.diff.hunks[r],o=n.diff.hunks[r-1],s=U(a?.rows??[]),c=o?U(o.rows):null,l=[...a?.commonContext??[],...s.leading],u=!!a?.commonContext?.length,d=u?ot(n.diff.hunks,r):G(n.diff.hunks,r),f=st(e,n.path,n.diff.hunks,r),p=t[f]??ct(),m=c?.trailing.slice(0,r>0?Math.min(d,i):0)??[],h=Math.min(Math.max(0,d-m.length),i),g=h>0?l.slice(-h):[],_=Math.max(0,d-(u?m.length+g.length:0)-p.aboveRows.length-p.belowRows.length),v=u?W(o?.rows??[],`last`,`left`)??0:o?o.oldStart+o.oldLines-1:0,y=u?W(o?.rows??[],`last`,`right`)??0:o?o.newStart+o.newLines-1:0,b=v+(u?m.length:0)+p.aboveRows.length+1,x=y+(u?m.length:0)+p.aboveRows.length+1;return{availableRows:[...c?.trailing??[],...a?.commonContext??[],...s.leading].filter(e=>{let t=e.left?.line,n=e.right?.line;return t!==void 0&&n!==void 0&&t>=b&&t<b+_&&n>=x&&n<x+_}),baseAboveRows:m,baseBelowRows:g,expansion:p,header:a?.header??``,hiddenLines:_,key:f,location:r===0?`top`:`middle`,newHiddenStart:x,oldHiddenStart:b}}function ut(e,t,n,r){let i=n.diff.hunks[n.diff.hunks.length-1];if(!i)return null;let a=K(n),o=q(e,n),s=t[o]??ct(),c=U(i.rows).trailing,l=c.slice(0,Math.min(a,r)),u=Math.max(0,a-s.aboveRows.length),d=i.oldStart+i.oldLines-1,f=i.newStart+i.newLines-1,p=d+s.aboveRows.length+1,m=f+s.aboveRows.length+1;return{availableRows:c.filter(e=>{let t=e.left?.line,n=e.right?.line;return t!==void 0&&n!==void 0&&t>=p&&n>=m}),baseAboveRows:l,baseBelowRows:[],expansion:s,header:``,hiddenLines:u,key:o,location:`bottom`,newHiddenStart:m,oldHiddenStart:p}}function J({gap:e,onExpand:t}){let n=e.hiddenLines>10,r=!!e.expansion.pending;return(0,F.jsxs)(`div`,{className:`review-diff-hunk interactive`,role:`group`,"aria-label":`${e.hiddenLines} hidden common lines`,children:[(0,F.jsx)(`span`,{children:e.header}),(0,F.jsxs)(`span`,{className:`review-context-controls`,children:[n&&e.location!==`top`?(0,F.jsx)(`button`,{type:`button`,disabled:r,"aria-label":`Show 10 lines above`,onClick:()=>t(`above`),children:`+10↑`}):null,n&&e.location!==`top`?(0,F.jsx)(`span`,{"aria-hidden":`true`,children:`−`}):null,(0,F.jsxs)(`button`,{type:`button`,disabled:r,"aria-label":`Show all ${e.hiddenLines} common lines`,onClick:()=>t(`all`),children:[`+`,e.hiddenLines,` common `,e.hiddenLines===1?`line`:`lines`]}),n&&e.location!==`bottom`?(0,F.jsx)(`span`,{"aria-hidden":`true`,children:`−`}):null,n&&e.location!==`bottom`?(0,F.jsx)(`button`,{type:`button`,disabled:r,"aria-label":`Show 10 lines below`,onClick:()=>t(`below`),children:`+10↓`}):null]}),e.expansion.error?(0,F.jsx)(`span`,{className:`review-context-error`,role:`alert`,children:e.expansion.error}):null]})}function dt({contextKeyPrefix:e,contextGapExpansions:t,file:n,mode:r,preferences:i,renderAttachment:a,onExpandContext:o,onExpandSkippedContext:s}){let c=nt(n.path),l=n.diff.hunks.reduce((e,t)=>{for(let n of[...t.commonContext??[],...t.rows])n.left?.missingNewlineAtEnd&&(e.left=!0),n.right?.missingNewlineAtEnd&&(e.right=!0);return e},{left:!1,right:!1}),u=(t,r,a)=>{let o=Math.max(t.leftLines??0,t.rightLines??0),c=st(e,n.path,n.diff.hunks,a),l=i.context,u=Math.min(10,o);return(0,F.jsxs)(`button`,{type:`button`,className:`review-skipped-row`,onClick:()=>s(c,a,Math.min(1e4,l+u)),children:[`Show `,u,` more common lines (`,o,` hidden)`]},r)},d=(e,t,n)=>(0,F.jsx)(F.Fragment,{children:(i.ignoreWhitespace===`NONE`?e:e.filter(e=>!e.whitespaceOnly)).map((e,o)=>{let s=`${n}:${t}:${e.left?.line??``}:${e.right?.line??``}:${o}`;if(r===`unified`){if(e.kind===`skipped`)return u(e,s,t);if(e.kind===`context`){let t=e.right??e.left;return(0,F.jsx)(H,{intraline:t?.intraline,kind:`context`,language:c,line:t?.line,side:S(`context`,!!e.right),text:t?.text??``,preferences:i,renderAttachment:a},s)}return e.kind===`changed`?(0,F.jsxs)(E.Fragment,{children:[(0,F.jsx)(H,{intraline:e.left?.intraline,kind:`deleted`,language:c,line:e.left?.line,side:S(`deleted`,!1),text:e.left?.text??``,preferences:i,renderAttachment:a}),(0,F.jsx)(H,{intraline:e.right?.intraline,kind:`added`,language:c,line:e.right?.line,side:S(`added`,!0),text:e.right?.text??``,preferences:i,renderAttachment:a})]},s):e.left?(0,F.jsx)(H,{intraline:e.left.intraline,kind:`deleted`,language:c,line:e.left.line,side:S(`deleted`,!1),text:e.left.text,preferences:i,renderAttachment:a},s):(0,F.jsx)(H,{intraline:e.right?.intraline,kind:`added`,language:c,line:e.right?.line,side:S(`added`,!!e.right),text:e.right?.text??``,preferences:i,renderAttachment:a},s)}return e.kind===`skipped`?u(e,s,t):(0,F.jsx)(at,{kind:e.kind,language:c,leftIntraline:e.left?.intraline,leftLine:e.left?.line,leftText:e.left?.text,rightIntraline:e.right?.intraline,rightLine:e.right?.line,rightText:e.right?.text,preferences:i,renderAttachment:a},s)})}),f=n.diff.hunks.map((r,a)=>lt(e,t,n,a,i.context)),p=ut(e,t,n,i.context),m=[...f,...p?[p]:[]].filter(e=>e.hiddenLines>0&&e.hiddenLines<=3&&!e.expansion.pending&&!e.expansion.error),h=m.map(e=>`${e.key}:${e.hiddenLines}:${e.oldHiddenStart}:${e.newHiddenStart}`).join(`|`),g=(0,E.useRef)(o);g.current=o,(0,E.useEffect)(()=>{for(let e of m)g.current(e,`all`,{lines:e.hiddenLines,newStart:e.newHiddenStart,oldStart:e.oldHiddenStart})},[h]);let _=(e,t)=>{let n=t===`all`?e.hiddenLines:Math.min(10,e.hiddenLines),r=t===`below`?e.hiddenLines-n:0;o(e,t,{lines:n,newStart:e.newHiddenStart+r,oldStart:e.oldHiddenStart+r})},v=(e,t)=>{let n=e.expansion.aboveRows.length>0||e.expansion.belowRows.length>0,r=e.hiddenLines>3||!!e.expansion.error;return(0,F.jsxs)(F.Fragment,{children:[d(e.baseAboveRows,t,`context`),d(e.expansion.aboveRows,t,`context`),r?(0,F.jsx)(J,{gap:e,onExpand:t=>_(e,t)}):null,!r&&e.hiddenLines>0?(0,F.jsxs)(`div`,{className:`review-diff-hunk interactive loading`,role:`status`,children:[(0,F.jsx)(`span`,{children:e.header}),(0,F.jsxs)(`span`,{children:[`Loading `,e.hiddenLines,` common `,e.hiddenLines===1?`line`:`lines`,`…`]})]}):null,!r&&e.hiddenLines===0&&!n&&e.location!==`bottom`?(0,F.jsx)(`div`,{className:`review-diff-hunk ${t>0?`secondary`:``}`,children:(0,F.jsx)(`span`,{children:e.header})}):null,d(e.expansion.belowRows,t,`context`),d(e.baseBelowRows,t,`context`)]})};return(0,F.jsxs)(F.Fragment,{children:[n.diff.hunks.map((e,t)=>(0,F.jsxs)(E.Fragment,{children:[v(f[t],t),d(U(e.rows).body,t,`change`)]},`${e.header}:${t}`)),p?v(p,n.diff.hunks.length):null,l.left||l.right?(0,F.jsx)(`div`,{className:`review-newline-warning`,role:`note`,children:[l.left?`No newline at end of left file.`:``,l.right?`No newline at end of right file.`:``].filter(Boolean).join(` — `)}):null]})}function ft({row:e}){return e.diffLoadError?(0,F.jsxs)(`div`,{className:`review-diff-message error`,role:`alert`,children:[`Could not load diff: `,e.diffLoadError]}):e.diffLoadPending?(0,F.jsx)(`div`,{className:`review-diff-message`,role:`status`,children:`Loading diff…`}):e.diffStatus===`binary`?(0,F.jsx)(`div`,{className:`review-diff-message`,children:`Binary file changed`}):e.diffStatus===`too-expensive`?(0,F.jsx)(`div`,{className:`review-diff-message`,children:`Diff too large to render`}):e.diffStatus===`not-loaded`?(0,F.jsx)(`div`,{className:`review-diff-message`,children:`Diff not loaded yet`}):null}function pt({disabled:e,draft:t,target:n,onCancel:r,onDraftChange:i,onSave:a}){let o=n.side===`right`?`Patchset`:n.side===`left`?`Base`:`file`;return(0,F.jsxs)(`form`,{className:`review-comment-editor`,onSubmit:e=>{e.preventDefault(),a()},children:[(0,F.jsxs)(`header`,{children:[`Comment on `,n.range?n.range.start_line===n.range.end_line?`${o} line ${n.range.start_line}, columns ${n.range.start_character+1}–${n.range.end_character}`:`${o} lines ${n.range.start_line}–${n.range.end_line}`:`${o} line ${n.line}`]}),(0,F.jsx)(`textarea`,{"aria-label":`Review comment`,name:`farming-review-comment`,inputMode:`text`,autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,enterKeyHint:`done`,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-bwignore":`true`,"data-form-type":`other`,autoFocus:!0,placeholder:`Leave a review comment…`,value:t,onChange:e=>i(e.target.value)}),(0,F.jsxs)(`footer`,{children:[(0,F.jsx)(`button`,{type:`button`,onClick:r,children:`CANCEL`}),(0,F.jsx)(`button`,{type:`submit`,disabled:e||!t.trim(),children:e?`SAVING…`:`SAVE COMMENT`})]})]})}function mt({comment:e,disabled:t,onDelete:n,onStatusChange:r}){let a=e.side===`right`?`Patchset`:e.side===`left`?`Base`:`File`,o=e.status||`open`,s=e.range?e.range.start_line===e.range.end_line?`${a} line ${e.range.start_line}, columns ${e.range.start_character+1}–${e.range.end_character}`:`${a} lines ${e.range.start_line}–${e.range.end_line}`:`${a} line ${e.line}`;return(0,F.jsxs)(`article`,{className:`review-comment-thread ${o}`,children:[(0,F.jsxs)(`header`,{children:[(0,F.jsx)(`span`,{children:o===`outdated`?`Outdated · ${s}`:s}),(0,F.jsxs)(`span`,{className:`review-comment-actions`,children:[(0,F.jsx)(`button`,{type:`button`,disabled:t,onClick:()=>r(o===`resolved`?`open`:`resolved`),children:o===`resolved`?`REOPEN`:`RESOLVE`}),(0,F.jsx)(`button`,{type:`button`,"aria-label":`Delete comment on line ${e.line}`,disabled:t,onClick:n,children:(0,F.jsx)(i,{})})]})]}),(0,F.jsx)(`p`,{children:e.body})]})}function ht(e,t){let n=(e instanceof Element?e:e?.parentElement)?.closest(`code[data-review-line][data-review-side]`)??null;return n&&t.contains(n)?n:null}function gt(e,t,n){let r=document.createRange();r.selectNodeContents(e);try{r.setEnd(t,n)}catch{return 0}return r.toString().length}function _t(e){let t=window.getSelection();if(!t||t.isCollapsed||!t.anchorNode||!t.focusNode)return null;let n=ht(t.anchorNode,e),r=ht(t.focusNode,e);if(!n||!r)return null;let i=n.dataset.reviewSide;if(i!==r.dataset.reviewSide||i!==`left`&&i!==`right`&&i!==`unified`)return null;let a=Number(n.dataset.reviewLine),o=Number(r.dataset.reviewLine);if(!Number.isInteger(a)||!Number.isInteger(o))return null;let s={character:gt(n,t.anchorNode,t.anchorOffset),line:a},c={character:gt(r,t.focusNode,t.focusOffset),line:o},l=s.line<c.line||s.line===c.line&&s.character<=c.character,u=l?s:c,d=l?c:s;return u.line===d.line&&u.character===d.character?null:{line:d.line,range:{end_character:d.character,end_line:d.line,start_character:u.character,start_line:u.line},side:i}}function Y(){let e=typeof window<`u`&&new URLSearchParams(window.location.search).get(`fixture`)===`1`,[t]=(0,E.useState)(()=>{let e=typeof window>`u`?``:window.location.search;return{requested:new URLSearchParams(e).has(`acpItem`),route:Fe(e)}}),n=t.route,[i]=(0,E.useState)(()=>ze(typeof window>`u`?null:window.location)),d=!e&&!t.requested&&i.request&&(i.request.source===`working-copy`||i.request.head===`now`)?i.request:null,[f,p]=(0,E.useState)(()=>d||t.requested?null:i.request),[m,h]=(0,E.useState)(null),[g,_]=(0,E.useState)(`final`),[v,y]=(0,E.useState)(!!(d||n)),b=t.requested?!n:!!i.error,x=!e,S=f?.source===`working-copy`,ne=f?.source===`git-range`,[ie,C]=(0,E.useState)(()=>b?{[L]:[]}:Ye(f,e)),[w,T]=(0,E.useState)(t.requested?n?``:`ACP review target is invalid`:i.error??``),[_e,De]=(0,E.useState)(null),[D,Ae]=(0,E.useState)(()=>{let t=b?{[L]:[]}:Ye(f,e);return Xe({basePatchset:b?`Base`:Je(f,e),catalog:t,comments:[],initialPatchset:b?L:qe(f,e),initiallyExpand:!x,reviewId:x?void 0:we})}),O=(0,E.useRef)(D),k=(0,E.useRef)(ie);k.current=ie;let[A,j]=(0,E.useState)(We),[Ne,M]=(0,E.useState)(!1),[Ie,Le]=(0,E.useState)(!1),[N,Re]=(0,E.useState)(``),[P,I]=(0,E.useState)(``),[Ve,He]=(0,E.useState)(``),[Ue,R]=(0,E.useState)([]),[Ze,z]=(0,E.useState)({}),[B,Qe]=(0,E.useState)(null),[nt,rt]=(0,E.useState)(``),[V,it]=(0,E.useState)(!1),[H,at]=(0,E.useState)(()=>new URLSearchParams(window.location.search).get(`comparison`)||``),[U,W]=(0,E.useState)(!1),ot=(0,E.useRef)(null),G=x?D.reviewId??``:we,K=D.patchRange.patchset,st=D.patchRange.basePatchset,q=oe(D,K),lt=new Set(q.expandedPaths),ut=D.diffMode,J=!!(m&&f?.source===`git-range`&&f.reviewId===m.reviewId&&f.head===m.head),ht=J?m?.scope:f?.source===`working-copy`?f.scope:void 0,gt=ht===`untracked`?`unified`:ut,Y=D.preferences,vt=f?{...f,context:Y.context,ignoreWhitespace:Y.ignoreWhitespace}:null,yt=(0,E.useRef)(vt);yt.current=vt;let X=J?{..._e??{workingTree:!0},head:void 0,workingTree:!0}:_e,Z=D.commentDraft,bt=D.commentDraft?.body??``,Q=ie[K]??[],xt=Q.reduce((e,t)=>e+t.added,0),St=Q.reduce((e,t)=>e+t.removed,0),Ct=Math.max(1,...Q.map(e=>e.added+e.removed)),$=e=>{let t=re(O.current,e,k.current);if(t.state!==O.current){O.current=t.state,Ae(t.state);for(let e of t.effects){if(e.type===`load-file-diff`){let t=yt.current;if(!t){$(Me(e,`review file diff source is unavailable`));continue}fe(t,e.path).then(t=>{let n=je(k.current,e,t,{reviewId:O.current.reviewId});k.current=n.catalog,C(n.catalog),$(n.action)}).catch(t=>$(Me(e,t)))}if(e.type===`save-reviewed-status`){let t=e.reviewId??G;le({...e,reviewId:t}).then(t=>$({patchset:e.patchset,paths:e.changes.map(e=>e.path),reviewedPaths:t.reviewedPaths,...e.reviewId?{reviewId:e.reviewId}:{},revision:t.revision,type:`commit-reviewed-status`})).catch(async n=>{let r=n instanceof be&&n.state?n.state:await xe(t,e.patchset).catch(()=>null);if(!r){let t=oe(O.current,e.patchset),n=new Set(t.reviewedPaths);for(let t of e.changes)t.reviewed?n.delete(t.path):n.add(t.path);r={reviewedPaths:[...n],revision:e.revision}}$({patchset:e.patchset,reviewedPaths:r.reviewedPaths,...e.reviewId?{reviewId:e.reviewId}:{},revision:r.revision,type:`restore-reviewed-status`}),Re(n instanceof Error?`Could not save Reviewed: ${n.message}`:`Could not save Reviewed status`)})}if(e.type===`save-comment`){let t=e.reviewId??G;me(t,e.comment).then(()=>$({id:e.comment.id,patchset:e.comment.patchset,pendingType:`save`,...e.reviewId?{reviewId:e.reviewId}:{},type:`commit-comment`})).catch(async n=>{$({comments:await Ce(t,e.comment.patchset).catch(()=>O.current.comments.filter(t=>t.id!==e.comment.id)),id:e.comment.id,patchset:e.comment.patchset,pendingType:`save`,...e.reviewId?{reviewId:e.reviewId}:{},type:`restore-comments`}),I(n instanceof Error?`Could not save comment: ${n.message}`:`Could not save comment`)})}if(e.type===`delete-comment`){let t=e.reviewId??G;ue(t,e.comment.patchset,e.comment.id).then(()=>$({id:e.comment.id,patchset:e.comment.patchset,pendingType:`delete`,...e.reviewId?{reviewId:e.reviewId}:{},type:`commit-comment`})).catch(async n=>{$({comments:await Ce(t,e.comment.patchset).catch(()=>[...O.current.comments,e.comment]),id:e.comment.id,patchset:e.comment.patchset,pendingType:`delete`,...e.reviewId?{reviewId:e.reviewId}:{},type:`restore-comments`}),I(n instanceof Error?`Could not delete comment: ${n.message}`:`Could not delete comment`)})}}}};(0,E.useEffect)(()=>(document.body.classList.add(`review-body`),()=>document.body.classList.remove(`review-body`)),[]),(0,E.useEffect)(()=>{if(!U)return;let e=e=>{ot.current?.contains(e.target)||W(!1)};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[U]),(0,E.useEffect)(()=>{if(!d&&!n)return;let e=!0;return y(!0),(n?Se(n.agentId,n.itemIds):(()=>{let e=d;return ge(`root`in e&&typeof e.root==`string`?{root:e.root}:{agentId:e.agentId},e.source===`git-range`?e.base:`HEAD`,e.source===`working-copy`?{modifiedWithinDays:e.modifiedWithinDays,paths:e.paths,scope:e.scope}:void 0)})()).then(t=>{if(!e)return;let n=he(t,`final`),r=new URLSearchParams(window.location.search);r.delete(`agentId`),r.delete(`acpItem`),r.set(`root`,t.root),r.set(`base`,n.base),r.set(`head`,n.head),r.set(`reviewId`,t.reviewId),r.set(`comparison`,`last-turn`),window.history.replaceState(null,``,`${window.location.pathname}?${r.toString()}`),h(t),_(`final`),at(`last-turn`),p(n),T(``)}).catch(t=>{e&&T(t instanceof Error?t.message:`review capture failed`)}).finally(()=>{e&&y(!1)}),()=>{e=!1}},[n,d]),(0,E.useEffect)(()=>{if(d||n||f?.source!==`git-range`||!f.reviewId)return;let e=!0;return pe(f.reviewId).then(t=>{if(!e)return;let n=t.revisions.find(e=>e.head===f.head)??t;h(n),at(e=>e||`last-turn`),_(f.base===n.fixesBase&&n.fixesBase!==n.base?`fixes`:`final`)}).catch(()=>{}),()=>{e=!1}},[n,d,f]),(0,E.useEffect)(()=>{if(!f)return;let e=!0,t=Ke();return ve({...f,context:t.context,ignoreWhitespace:t.ignoreWhitespace,metadataOnly:!0}).then(async n=>{let[r,i]=await Promise.all([xe(n.reviewId,n.patchset).catch(()=>null),Ce(n.reviewId,n.patchset).catch(()=>[])]);if(!e)return;let a=ee(Oe(n),n.patchset,i.map(e=>e.path)),o=ke({comments:i,preferences:t,...r?{reviewedPaths:r.reviewedPaths}:{},snapshot:n});r&&(o=re(o,{patchset:n.patchset,reviewedPaths:r.reviewedPaths,reviewId:n.reviewId,revision:r.revision,type:`hydrate-reviewed-status`},a).state),O.current=o,k.current=a,De(n.comparison??null),C(a),Ae(o),T(``)}).catch(t=>{e&&T(t instanceof Error?t.message:`review diff request failed`)}),()=>{e=!1}},[f]),(0,E.useEffect)(()=>{if(!N)return;let e=window.setTimeout(()=>Re(``),4e3);return()=>window.clearTimeout(e)},[N]),(0,E.useEffect)(()=>{if(!P)return;let e=window.setTimeout(()=>I(``),4e3);return()=>window.clearTimeout(e)},[P]),(0,E.useEffect)(()=>{try{window.localStorage.setItem(Ge,JSON.stringify(Y))}catch{}},[D.preferences]),(0,E.useEffect)(()=>{if(x||!G||!k.current[K])return;let e=!0;return xe(G,K).then(t=>{e&&$({patchset:K,reviewedPaths:t.reviewedPaths,reviewId:G,revision:t.revision,type:`hydrate-reviewed-status`})}).catch(()=>{}),Ce(G,K).then(t=>{if(!e)return;let n=ee(k.current,K,t.map(e=>e.path));n!==k.current&&(k.current=n,C(n)),$({comments:t,patchset:K,reviewId:G,type:`hydrate-comments`})}).catch(()=>{}),()=>{e=!1}},[x,K,G]),(0,E.useEffect)(()=>{let e=()=>{let e=``;for(let t of document.querySelectorAll(`.review-file-change.expanded[data-file-path]`)){let n=t.querySelector(`.review-file-change-header`);if(!n)continue;let r=t.getBoundingClientRect(),i=n.getBoundingClientRect();i.top<=1&&r.bottom>i.bottom&&(e=t.dataset.filePath??``)}He(t=>t===e?t:e)};return e(),window.addEventListener(`scroll`,e,{passive:!0}),document.body.addEventListener(`scroll`,e,{passive:!0}),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e),document.body.removeEventListener(`scroll`,e),window.removeEventListener(`resize`,e)}},[K,q.expandedPaths.join(`\0`)]);let wt=!!q.pendingReview,Tt=!!q.pendingComment,Et=(e,t)=>{$({path:e,reviewed:t,type:`set-file-reviewed`})},Dt=e=>{$({patchset:e,type:`select-patchset`})},Ot=Q.length>0&&Q.every(e=>lt.has(e.path)),kt=e=>{$({path:e,type:`toggle-file-expanded`})},At=()=>{j(Y),M(!0)},jt=()=>{let e=Y,t=te(A),n=e.context!==t.context||e.ignoreWhitespace!==t.ignoreWhitespace;if($({preferences:t,type:`set-preferences`}),M(!1),n&&z({}),!x||!f||!n)return;let r=K,i=new Map(Q.map(e=>[e.path,e])),a=q.expandedPaths.filter(e=>{let t=i.get(e);return!!(t&&t.kind!==`unmodified`&&!t.binary&&!t.diffTooExpensive)});a.length&&(R(e=>[...new Set([...e,...a])]),Be({...f,context:t.context,ignoreWhitespace:t.ignoreWhitespace},a).then(e=>{if(O.current.patchRange.patchset!==r)return;let t=k.current;for(let n of e.files)t=se(t,r,n);k.current=t,C(t);let n=e.errors[0];n&&T(n.message)}).finally(()=>R(e=>e.filter(e=>!a.includes(e)))))},Mt=()=>{navigator.clipboard&&navigator.clipboard.writeText(`34a15ae`).catch(()=>{}),Le(!0),window.setTimeout(()=>Le(!1),1200)},Nt=(e,t)=>{let n=yt.current;if(!n||Ue.includes(e))return;let r=K;R(t=>[...t,e]),fe({...n,context:t},e).then(e=>{let t=se(k.current,r,e);k.current=t,C(t)}).catch(e=>T(e instanceof Error?e.message:`review context request failed`)).finally(()=>R(t=>t.filter(t=>t!==e)))},Pt=(e,t,n,r)=>{let i=yt.current;if(t.expansion.pending||r.lines<1)return;let a=e=>{z(r=>{let i=r[t.key]??ct();return{...r,[t.key]:n===`below`?{...i,belowRows:[...e,...i.belowRows],error:void 0,pending:void 0}:{...i,aboveRows:[...i.aboveRows,...e],error:void 0,pending:void 0}}})},o=e=>{let n=e instanceof Error?e.message:`review context request failed`;z(e=>{let r=e[t.key]??ct();return{...e,[t.key]:{...r,error:n,pending:void 0}}})};if(z(e=>{let r=e[t.key]??ct();return{...e,[t.key]:{...r,error:void 0,pending:n}}}),!i){let e=t.availableRows.filter(e=>{let t=e.left?.line,n=e.right?.line;return t!==void 0&&n!==void 0&&t>=r.oldStart&&t<r.oldStart+r.lines&&n>=r.newStart&&n<r.newStart+r.lines});e.length===r.lines?a(e):o(Error(`review context is unavailable`));return}Te(i,e.path,r).then(e=>a(e.rows)).catch(o)},Ft=(e,t,n,r)=>{$({line:t,path:e,range:r,side:n,type:`start-comment`})},It=()=>{!Z||!bt.trim()||$({id:typeof crypto?.randomUUID==`function`?crypto.randomUUID():`comment-${Date.now()}-${Math.random().toString(36).slice(2)}`,type:`save-comment`})},Lt=(e,t)=>{G&&Ee(G,e.patchset,e.id,t).then(()=>Ce(G,e.patchset)).then(t=>$({comments:t,patchset:e.patchset,reviewId:G,type:`hydrate-comments`})).catch(e=>I(e instanceof Error?e.message:`review comment status failed`))},Rt=(e,t)=>{let n=he(e,t),r=new URLSearchParams(window.location.search);r.delete(`agentId`),r.set(`root`,e.root),r.set(`base`,n.base),r.set(`head`,n.head),r.set(`reviewId`,e.reviewId),r.set(`comparison`,`last-turn`),window.history.replaceState(null,``,`${window.location.pathname}?${r.toString()}`),h(e),_(t),at(`last-turn`),W(!1),p(n)},zt=f&&`root`in f&&f.root?{root:f.root}:f&&`agentId`in f&&f.agentId?{agentId:f.agentId}:m?{root:m.root}:null,Bt=()=>{let e=!U;W(e),!(!e||B||V||!zt)&&(it(!0),rt(``),de(zt).then(Qe).catch(e=>rt(e instanceof Error?e.message:`Comparison sources could not be loaded`)).finally(()=>it(!1)))},Vt=e=>{if(!B)return;let t={base:e.base,head:e.head,metadataOnly:!0,root:B.root,source:`git-range`},n=new URLSearchParams(window.location.search);n.delete(`agentId`),n.delete(`reviewId`),n.delete(`path`),n.delete(`scope`),n.delete(`modifiedWithinDays`),n.set(`root`,B.root),n.set(`base`,e.base),n.set(`head`,e.head),n.set(`comparison`,e.id),window.history.replaceState(null,``,`${window.location.pathname}?${n.toString()}`),at(e.id),W(!1),_(`final`),p(t)},Ht=()=>{!m||v||(y(!0),ye(m.reviewId).then(e=>{Rt(e,e.number>1?`fixes`:`final`),T(``)}).catch(e=>T(e instanceof Error?e.message:`review refresh failed`)).finally(()=>y(!1)))},Ut=e=>{!m||e===g||Rt(m,e)},Wt=ht,Gt=Wt===`tracked`?`Changes`:Wt===`untracked`?`Untracked`:`Files`,Kt=B?[B.unstaged,B.staged,...B.commits,...B.branches].find(e=>e.id===H):null,qt=J?`Last Turn`:Kt?.id.startsWith(`commit:`)?`Commit · ${Kt.label}`:Kt?.id.startsWith(`branch:`)?`Branch · ${Kt.label}`:Kt?.label??(S?`Working copy`:ne?`Changes`:Gt),Jt=H===`staged`?`Staged changes`:X?.workingTree?`Workspace changes`:X?.head?.message.split(`
|
|
2
2
|
`)[0]||`Commit details`,Yt=X?.head?`Commit message`:H===`staged`?`Index summary`:`Change summary`,Xt=H===`staged`?`Staged changes are stored in the Git index and do not have a commit author or commit message yet.`:`Uncommitted workspace changes do not have a commit author or commit message yet.`,Zt=v?`Capturing an immutable workspace revision…`:f?S?Wt===`tracked`?`No tracked changes in this workspace.`:Wt===`untracked`?`No untracked files modified in the last ${f.modifiedWithinDays??3} days.`:`No uncommitted files in this workspace.`:`No changed files in this range.`:`Open a real review with: farming review <git-dir> <base> <head|now>`,Qt=b?`Could not load review target`:ne?`Could not load git range`:`Could not load working copy`;return(0,F.jsxs)(`main`,{className:`review-root`,"data-testid":`review-page`,children:[(0,F.jsxs)(`section`,{className:`review-files`,"aria-label":`Changed files`,children:[(0,F.jsxs)(`header`,{className:`review-files-toolbar`,children:[(0,F.jsxs)(`div`,{className:`review-patch-info`,children:[(0,F.jsxs)(`div`,{className:`review-source-control`,ref:ot,children:[(0,F.jsxs)(`button`,{type:`button`,className:`review-source-trigger`,"aria-expanded":U,onClick:Bt,children:[(0,F.jsx)(`strong`,{children:qt}),(0,F.jsx)(u,{})]}),U?(0,F.jsxs)(`div`,{className:`review-source-menu`,role:`menu`,"aria-label":`Compare changes from`,children:[V?(0,F.jsx)(`p`,{children:`Loading comparisons…`}):null,nt?(0,F.jsx)(`p`,{className:`error`,children:nt}):null,B?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":H===`unstaged`,disabled:!B.unstaged.available,onClick:()=>Vt(B.unstaged),children:[(0,F.jsx)(`span`,{children:`Unstaged`}),H===`unstaged`?(0,F.jsx)(c,{}):null]}),(0,F.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":H===`staged`,disabled:!B.staged.available,onClick:()=>Vt(B.staged),children:[(0,F.jsx)(`span`,{children:`Staged`}),H===`staged`?(0,F.jsx)(c,{}):null]}),(0,F.jsxs)(`details`,{className:`review-source-submenu`,children:[(0,F.jsxs)(`summary`,{children:[`Commit `,(0,F.jsx)(o,{})]}),(0,F.jsx)(`div`,{children:B.commits.length?B.commits.map(e=>(0,F.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":H===e.id,onClick:()=>Vt(e),children:[(0,F.jsx)(`span`,{children:e.label}),H===e.id?(0,F.jsx)(c,{}):null]},e.id)):(0,F.jsx)(`p`,{children:`No commits available`})})]}),(0,F.jsxs)(`details`,{className:`review-source-submenu`,children:[(0,F.jsxs)(`summary`,{children:[`Branch `,(0,F.jsx)(o,{})]}),(0,F.jsx)(`div`,{children:B.branches.length?B.branches.map(e=>(0,F.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":H===e.id,onClick:()=>Vt(e),children:[(0,F.jsx)(`span`,{children:e.label}),H===e.id?(0,F.jsx)(c,{}):null]},e.id)):(0,F.jsx)(`p`,{children:`No other branches`})})]}),m?(0,F.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":J,onClick:()=>Rt(m,g),children:[(0,F.jsx)(`span`,{children:`Last Turn`}),J?(0,F.jsx)(c,{}):null]}):null]}):null]}):null]}),(0,F.jsxs)(`span`,{className:`review-total-stats`,children:[(0,F.jsxs)(`b`,{children:[`+`,xt]}),(0,F.jsxs)(`i`,{children:[`−`,St]})]}),x?null:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`select`,{"aria-label":`Patch set`,value:K,onChange:e=>Dt(e.target.value),children:[(0,F.jsx)(`option`,{value:`Patchset 20`,children:`Patchset 20`}),(0,F.jsx)(`option`,{value:`Patchset 19`,children:`Patchset 19`})]}),(0,F.jsxs)(`button`,{type:`button`,className:`review-commit`,onClick:Mt,title:`Copy commit`,children:[Ie?`Copied`:`34a15ae`,(0,F.jsx)(l,{})]})]}),J?(0,F.jsxs)(`span`,{className:`review-revision-label`,children:[`Revision `,m?.number]}):null]}),(0,F.jsxs)(`div`,{className:`review-files-actions`,children:[J&&m?(0,F.jsxs)(F.Fragment,{children:[m.number>1?(0,F.jsx)(`button`,{type:`button`,className:g===`fixes`?`active`:``,onClick:()=>Ut(`fixes`),children:`FIXES SINCE REVIEW`}):null,(0,F.jsx)(`button`,{type:`button`,disabled:v,onClick:Ht,children:v?`CAPTURING…`:`REFRESH`}),(0,F.jsx)(`span`,{className:`review-toolbar-separator`})]}):null,(0,F.jsx)(`button`,{type:`button`,onClick:()=>$({expanded:!Ot,paths:Q.map(e=>e.path),type:`set-all-files-expanded`}),children:Ot?`COLLAPSE ALL`:`EXPAND ALL`}),(0,F.jsx)(`span`,{className:`review-toolbar-separator`}),ht===`untracked`?null:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{children:`Diff view:`}),(0,F.jsx)(`button`,{type:`button`,className:`review-icon-action ${ut===`split`?`active`:``}`,"aria-label":`Side-by-side diff`,title:`Side-by-side diff`,onClick:()=>$({mode:`split`,type:`set-diff-mode`}),children:(0,F.jsx)(s,{})}),(0,F.jsx)(`button`,{type:`button`,className:`review-icon-action ${ut===`unified`?`active`:``}`,"aria-label":`Unified diff`,title:`Unified diff`,onClick:()=>$({mode:`unified`,type:`set-diff-mode`}),children:(0,F.jsx)(a,{})})]}),(0,F.jsx)(`button`,{type:`button`,className:`review-icon-action`,"aria-label":`Diff preferences`,title:`Diff preferences`,onClick:At,children:(0,F.jsx)(r,{})})]}),N||P?(0,F.jsx)(`span`,{className:`review-review-error`,role:`status`,children:N||P}):null]}),x&&X?(0,F.jsxs)(`details`,{className:`review-commit-message`,children:[(0,F.jsxs)(`summary`,{children:[(0,F.jsx)(`span`,{children:Yt}),(0,F.jsx)(`strong`,{children:Jt}),(0,F.jsx)(o,{})]}),(0,F.jsx)(`div`,{children:X.head?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{children:[(0,F.jsx)(`span`,{children:`Author`}),(0,F.jsx)(`strong`,{children:X.head.authorName}),X.head.authorEmail?` <${X.head.authorEmail}>`:``]}),X.head.authoredAt?(0,F.jsxs)(`p`,{children:[(0,F.jsx)(`span`,{children:`Date`}),new Date(X.head.authoredAt).toLocaleString()]}):null,(0,F.jsx)(`pre`,{children:X.head.message})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{children:[(0,F.jsx)(`span`,{children:`Based on`}),(0,F.jsx)(`strong`,{children:X.base?.message.split(`
|
|
3
3
|
`)[0]||st})]}),X.base?(0,F.jsxs)(`p`,{children:[(0,F.jsx)(`span`,{children:`Base author`}),X.base.authorName,X.base.authorEmail?` <${X.base.authorEmail}>`:``]}):null,(0,F.jsx)(`pre`,{children:Xt})]})})]}):null,(0,F.jsxs)(`div`,{className:`review-files-list`,children:[w?(0,F.jsxs)(`p`,{className:`review-working-copy-message`,role:`alert`,children:[Qt,`: `,w]}):null,x&&!w&&Q.length===0?(0,F.jsx)(`p`,{className:`review-working-copy-message`,role:`status`,children:Zt}):null,Q.map(e=>{let t=Pe(D,e,{mutationPending:wt}),n=ce(D,t.commentPaths),r=n.filter(e=>e.status===`outdated`),i=t=>ae(e,t);return(0,F.jsxs)(`article`,{className:`review-file-change ${t.expanded?`expanded`:``} ${Ve===e.path?`reviewing`:``}`,"data-testid":`review-file-row`,"data-change-kind":e.kind,"data-file-path":e.path,children:[(0,F.jsxs)(`header`,{className:`review-file-change-header`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`review-file-select`,onClick:()=>kt(e.path),children:[(0,F.jsx)(`span`,{className:`review-file-status`,children:t.changeLabel}),(0,F.jsxs)(`span`,{className:`review-file-paths`,children:[(0,F.jsx)(`span`,{className:`review-file-name`,children:e.path}),e.previousPath?(0,F.jsx)(`span`,{className:`review-file-previous-path`,title:`Previous path: ${e.previousPath}`,children:e.previousPath}):null]}),(0,F.jsx)(et,{file:e,maxChangeSize:Ct}),(0,F.jsx)(tt,{file:e})]}),(0,F.jsx)($e,{action:t.action,pending:t.pending,reviewed:t.reviewed,reviewedLabel:t.reviewedLabel,onToggle:()=>{t.action&&Et(e.path,t.action.nextReviewed)}}),(0,F.jsx)(`button`,{type:`button`,className:`review-file-expand`,"aria-label":t.expanded?`Collapse file diff`:`Expand file diff`,onClick:()=>kt(e.path),children:t.expanded?(0,F.jsx)(u,{}):(0,F.jsx)(o,{})})]}),t.expanded?(0,F.jsxs)(`section`,{className:`review-inline-diff ${gt} ${Y.fitToScreen?`fit-to-screen`:``}`,"aria-label":`Diff for ${e.path}`,children:[r.length?(0,F.jsx)(`div`,{className:`review-outdated-comments`,children:r.map(e=>(0,F.jsx)(mt,{comment:e,disabled:Tt,onDelete:()=>$({id:e.id,type:`delete-comment`}),onStatusChange:t=>Lt(e,t)},e.id))}):null,(0,F.jsxs)(`div`,{className:`review-diff-columns`,children:[(0,F.jsx)(`span`,{children:`File`}),gt===`split`?(0,F.jsx)(`span`,{children:`File`}):null]}),t.diffStatus!==`loaded`||t.diffLoadPending||t.diffLoadError?(0,F.jsx)(ft,{row:t}):(0,F.jsx)(F.Fragment,{children:(0,F.jsx)(`div`,{className:`review-diff-code`,style:{fontSize:`${Y.fontSize}px`,tabSize:Y.tabSize,minWidth:Y.fitToScreen?void 0:`${Math.round(Y.lineLength*Y.fontSize*.62)}px`},onClick:e=>{let t=window.getSelection();if(t&&!t.isCollapsed||!(e.target instanceof Element))return;let n=e.target.closest(`code[data-review-line][data-review-side]`);if(!n)return;let r=Number(n.dataset.reviewLine),a=n.dataset.reviewSide;!Number.isFinite(r)||a!==`left`&&a!==`right`&&a!==`unified`||Ft(i(a),r,a)},onMouseUp:e=>{let t=_t(e.currentTarget);t&&Ft(i(t.side),t.line,t.side,t.range)},children:(0,F.jsx)(dt,{contextKeyPrefix:`${G}:${K}`,contextGapExpansions:Ze,file:e,mode:gt,preferences:Y,renderAttachment:(e,t)=>{let r=Z&&Z.path===i(Z.side)&&Z.line===e&&t.includes(Z.side)?Z:null,a=n.filter(n=>n.status!==`outdated`&&n.line===e&&t.includes(n.side)&&n.path===i(n.side));return!r&&a.length===0?null:(0,F.jsxs)(`div`,{className:`review-line-attachment`,"data-review-comment-line":e,children:[r?(0,F.jsx)(pt,{disabled:Tt,draft:bt,target:r,onCancel:()=>$({type:`cancel-comment`}),onDraftChange:e=>$({body:e,type:`update-comment-draft`}),onSave:It}):null,a.map(e=>(0,F.jsx)(mt,{comment:e,disabled:Tt,onDelete:()=>$({id:e.id,type:`delete-comment`}),onStatusChange:t=>Lt(e,t)},e.id))]})},onExpandContext:(t,n,r)=>Pt(e,t,n,r),onExpandSkippedContext:(t,n,r)=>Nt(e.path,r)})})})]}):null]},e.path)})]})]}),Ne?(0,F.jsx)(`div`,{className:`review-preferences-backdrop`,role:`presentation`,onMouseDown:()=>M(!1),children:(0,F.jsxs)(`section`,{className:`review-preferences`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`review-preferences-title`,onMouseDown:e=>e.stopPropagation(),children:[(0,F.jsx)(`header`,{children:(0,F.jsx)(`h2`,{id:`review-preferences-title`,children:`Diff Preferences`})}),(0,F.jsxs)(`div`,{className:`review-preferences-form`,children:[(0,F.jsxs)(`label`,{children:[`Context`,(0,F.jsxs)(`select`,{"aria-label":`Context`,value:A.context,onChange:e=>j(t=>({...t,context:Number(e.target.value)})),children:[(0,F.jsx)(`option`,{value:3,children:`3 lines`}),(0,F.jsx)(`option`,{value:10,children:`10 lines`}),(0,F.jsx)(`option`,{value:25,children:`25 lines`}),(0,F.jsx)(`option`,{value:100,children:`100 lines`})]})]}),(0,F.jsxs)(`label`,{className:`checkbox-row`,children:[`Fit to screen`,(0,F.jsx)(`input`,{"aria-label":`Fit to screen`,type:`checkbox`,checked:A.fitToScreen,onChange:e=>j(t=>({...t,fitToScreen:e.target.checked}))})]}),(0,F.jsxs)(`label`,{children:[`Diff width`,(0,F.jsx)(`input`,{"aria-label":`Diff width`,type:`number`,autoComplete:`off`,"data-form-type":`other`,min:40,max:240,value:A.lineLength,onChange:e=>j(t=>({...t,lineLength:Number(e.target.value)||t.lineLength}))})]}),(0,F.jsxs)(`label`,{children:[`Tab width`,(0,F.jsx)(`input`,{"aria-label":`Tab width`,type:`number`,autoComplete:`off`,"data-form-type":`other`,min:2,max:16,value:A.tabSize,onChange:e=>j(t=>({...t,tabSize:Number(e.target.value)||t.tabSize}))})]}),(0,F.jsxs)(`label`,{children:[`Font size`,(0,F.jsx)(`input`,{"aria-label":`Font size`,type:`number`,autoComplete:`off`,"data-form-type":`other`,min:10,max:20,value:A.fontSize,onChange:e=>j(t=>({...t,fontSize:Number(e.target.value)||t.fontSize}))})]}),(0,F.jsxs)(`label`,{className:`checkbox-row`,children:[`Intraline differences`,(0,F.jsx)(`input`,{"aria-label":`Intraline differences`,type:`checkbox`,checked:A.intralineDifference,onChange:e=>j(t=>({...t,intralineDifference:e.target.checked}))})]}),(0,F.jsxs)(`label`,{className:`checkbox-row`,children:[`Show tabs`,(0,F.jsx)(`input`,{"aria-label":`Show tabs`,type:`checkbox`,checked:A.showTabs,onChange:e=>j(t=>({...t,showTabs:e.target.checked}))})]}),(0,F.jsxs)(`label`,{className:`checkbox-row`,children:[`Show trailing whitespace`,(0,F.jsx)(`input`,{"aria-label":`Show trailing whitespace`,type:`checkbox`,checked:A.showTrailingWhitespace,onChange:e=>j(t=>({...t,showTrailingWhitespace:e.target.checked}))})]}),(0,F.jsxs)(`label`,{className:`checkbox-row`,children:[`Syntax highlighting`,(0,F.jsx)(`input`,{"aria-label":`Syntax highlighting`,type:`checkbox`,checked:A.syntaxHighlighting,onChange:e=>j(t=>({...t,syntaxHighlighting:e.target.checked}))})]}),(0,F.jsxs)(`label`,{children:[`Ignore Whitespace`,(0,F.jsxs)(`select`,{"aria-label":`Ignore Whitespace`,value:A.ignoreWhitespace,onChange:e=>j(t=>({...t,ignoreWhitespace:e.target.value})),children:[(0,F.jsx)(`option`,{value:`NONE`,children:`None`}),(0,F.jsx)(`option`,{value:`TRAILING`,children:`Trailing`}),(0,F.jsx)(`option`,{value:`LEADING_AND_TRAILING`,children:`Leading + trailing`}),(0,F.jsx)(`option`,{value:`ALL`,children:`All`})]})]})]}),(0,F.jsxs)(`footer`,{children:[(0,F.jsx)(`button`,{type:`button`,onClick:()=>M(!1),children:`CANCEL`}),(0,F.jsx)(`button`,{type:`button`,onClick:jt,children:`SAVE`})]})]})}):null]})}export{Y as ReviewPage,nt as diffLanguageForPath};
|