diffstalkerd 0.14.3 → 0.14.4
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/CHANGELOG.md +16 -0
- package/README.md +1 -1
- package/dist/index.js +66 -65
- package/dist/web/assets/{index-BoTqAumP.js → index-BWpIPCb9.js} +7 -7
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
|
@@ -18,12 +18,12 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
|
|
|
18
18
|
`),r=Jb(n),i=Wb(t);if(r===null)return i;let a=n.slice(r).join(`
|
|
19
19
|
`);return i===``?a:`${i}\n\n${a}`}function Xb(e,t){return qb(e)!==Wb(t)}function Zb(e,t){return e.branch===t?!0:e.prefix?e.branch===``||t.startsWith(`${e.branch}/`):!1}var Qb=`absent`;function $b(e){let t=new Xs,n=H(null),r=H(null),i=H(``),a=H(Qb),o=H(`idle`),s=H(null),c=H(null),l=H(!1),u=H(!1),d=H(!1),f=H(!1),p=$(()=>{let e=c.value?.pr??null;return e===null||e.state!==`open`||e.body===null?null:qb(e.body)}),m=0,h=null,g=!1,_=null,v=!1,y=null,b=!0;function x(){return g||_!==null||o.value===`error`}function S(){h!==null&&(clearTimeout(h),h=null)}function C(e){r.value=e,d.value=!1,i.value=e.top??``,a.value=e.version,o.value=`idle`,s.value=null}async function w(e,n){try{let r=await t.branchPr(e.id,e.branch);n===m&&(c.value=r)}catch(t){n===m&&Qs(`read the PR of a branch`,t,{branch:e.branch})}}async function T(e,n){l.value=!0;try{let r=await t.draft(e.id,e.branch);if(n!==m)return;C(r)}catch(t){if(n!==m)return;Zs(`read PR draft`,t,{branch:e.branch}),s.value=`Could not read the draft: ${Rs(t)}`}finally{n===m&&(l.value=!1)}}async function E(){S();let e=n.value,r=_;if(e===null||!g&&o.value!==`error`){r!==null&&await r;return}g=!1;let s=i.value,c=a.value,l=(r===null?null:await r)??c;try{await t.putDraft(e.id,{branch:e.branch,top:s,version:l})}catch(t){Zs(`save PR draft`,t,{branch:e.branch})}}function D(){m+=1,n.value=null,S(),g=!1,_=null,v=!1,r.value=null,i.value=``,d.value=!1,b=!0,a.value=Qb,o.value=`idle`,s.value=null,c.value=null,l.value=!1,f.value=!1}function O(e){if(e===null)return;let t={id:e.id,branch:e.branch};n.value=t;let r=m;T(t,r),w(t,r)}function k(){h=null;let e=n.value;if(_!==null||!g||e===null)return;g=!1;let t=m,r=i.value;o.value=`saving`,_=A(e,r,t)}async function A(e,n,i){let c=null;try{let l=await t.putDraft(e.id,{branch:e.branch,top:n,version:a.value});if(c=l.version,i!==m)return c;r.value=l,a.value=l.version,o.value=g?`dirty`:`idle`,s.value=null}catch(t){if(i!==m)return null;t instanceof Is&&t.status===409?(Zs(`save PR draft`,t,{branch:e.branch}),o.value=`conflict`,g=!1,S()):(Zs(`save PR draft`,t,{branch:e.branch}),o.value=`error`,s.value=`Could not save: ${Rs(t)}`)}return i===m&&M(),c}function j(){o.value===`error`&&(g=!0),S(),k()}function M(){_=null,v&&(v=!1,R()),g&&h===null&&o.value!==`conflict`&&k()}function N(e){i.value=e,d.value=!1,b=!1,o.value!==`conflict`&&n.value!==null&&(g=!0,_===null&&(o.value=`dirty`),S(),h=setTimeout(k,400))}async function P(){let e=n.value;e!==null&&(S(),g=!1,b=!0,m+=1,_=null,await T(e,m))}async function F(){let e=n.value;if(e===null||x())return;let r=m;try{let n=await t.adoptDraft(e.id,{branch:e.branch,version:a.value});r===m&&C(n)}catch(t){if(r!==m)return;Zs(`start from the suggestion`,t,{branch:e.branch}),await T(e,r),r===m&&(s.value=`Could not start from the suggestion: ${Rs(t)}`)}}async function I(){let e=n.value;if(e===null)return;let r=m;u.value=!0;try{if(c.value?.pr){let n=await t.checkBranchPr(e.id,e.branch);r===m&&(c.value=n)}else await t.refreshWorkPrs(),await w(e,r)}catch(e){if(r!==m)return;Zs(`check PRs`,e),s.value=`Could not check PRs: ${Rs(e)}`}finally{u.value=!1}}async function L(){let e=n.value;if(e===null||x()||o.value===`conflict`)return;await I();let t=p.value;t!==null&&n.value===e&&(N(t),j())}async function ee(){let e=n.value,i=p.value;if(e===null||i===null||x()||r.value?.top==null)return;let o=m;f.value=!0;try{let n=await t.setPrTopZone(e.id,{branch:e.branch,version:a.value,expectedTop:i});if(o!==m)return;c.value=n,s.value=null}catch(n){if(o!==m)return;if(Zs(`update the PR top zone`,n,{branch:e.branch}),s.value=`Could not update GitHub: ${Rs(n)}`,n instanceof Is&&n.status===409)try{let n=await t.checkBranchPr(e.id,e.branch);o===m&&(c.value=n)}catch(t){Qs(`read the PR of a branch`,t,{branch:e.branch})}}finally{o===m&&(f.value=!1)}}async function R(){let e=n.value;if(e===null)return;let i=m,s=a.value,c;try{c=await t.draft(e.id,e.branch)}catch(t){i===m&&Qs(`re-read PR draft`,t,{branch:e.branch});return}i===m&&(_===null?a.value===s?(c.version===a.value||o.value===`conflict`?r.value!==null&&(r.value={...r.value,suggested:c.suggested,ai:c.ai,adoptedUnedited:c.adoptedUnedited}):x()?(o.value=`conflict`,g=!1,S()):C(c),w(e,i)):R():v=!0)}function te(e){let t=n.value;t!==null&&Zb(e,t.branch)&&(_===null?R():v=!0)}function ne(){let e=p.value;b&&e!==null&&e!==``&&r.value!==null&&r.value.top===null&&(x()||o.value!==`idle`||i.value!==``||(i.value=e,d.value=!0))}let re=De(!0);re.run(()=>{W([r,p],ne),W(e,e=>{let t=n.value;(e?.id!==t?.id||e?.branch!==t?.branch)&&(E(),D(),O(e))},{immediate:!0})});function ie(){if(y===null){let e=E();re.stop(),D(),y=e}return y}return Bt({branch:$(()=>n.value?.branch??null),draft:r,text:i,baseVersion:a,save:o,error:s,pr:c,loading:l,checkingPrs:u,githubTop:p,prefilled:d,pushing:f,setText:N,reload:P,adopt:F,checkPrs:I,takeGithub:L,pushTop:ee,saveNow:j,onDraftChange:te,dispose:ie})}var ex=Ps(`draft`,()=>{let e=new Xs,t=Vl(),n=H(null),r=H(null),i=H(null),a=null,o=$(()=>{let e=t.shared.status?.branch?.current||null,n=t.selectedStackHead;if(n===null)return e===null?[]:[e];let r=t.pickedLayer;return r===null?[n]:r.isHead&&e!==null?[e,...r.refs.filter(t=>t!==e)]:r.refs}),s=$(()=>{let e=n.value;return e===null||e.id!==t.repoId?null:o.value.find(t=>e.names.includes(t))??null}),c=$(()=>n.value?.id===t.repoId),l=$(()=>i.value?.draft??null),u=$(()=>i.value?.text??``),d=$(()=>i.value?.baseVersion??`absent`),f=$(()=>i.value?.save??`idle`),p=$(()=>r.value??i.value?.error??null),m=$(()=>i.value?.pr??null),h=$(()=>i.value?.loading??!1),g=$(()=>i.value?.checkingPrs??!1),_=$(()=>i.value?.githubTop??null),v=$(()=>i.value?.prefilled??!1),y=$(()=>i.value?.pushing??!1);function b(){let e=t.repoId,n=s.value;return e===null||n===null?null:{id:e,branch:n}}async function x(){let i=t.repoId;if(i===null)n.value=null,r.value=null;else try{let a=await e.localBranches(i);if(i!==t.repoId)return;n.value={id:i,names:a.map(e=>e.name)},r.value=null}catch(e){if(i!==t.repoId)return;Zs(`list local branches`,e),r.value=`Could not list branches: ${Rs(e)}`}}let S=$(()=>t.compareStack?.layers.map(e=>e.refs.join(`,`)).join(`|`)??``);function C(){a===null&&(a=De(!0),a.run(()=>{W([()=>t.repoId,()=>t.shared.status?.branch?.current??null,S],()=>void x(),{immediate:!0}),W(()=>t.lastDraftChange,e=>{e!==null&&i.value?.onDraftChange(e.event)}),W(()=>t.switchStarts,()=>i.value?.saveNow(),{flush:`sync`})}),i.value=$b(b))}function w(){i.value?.dispose(),i.value=null,a?.stop(),a=null,n.value=null,r.value=null}function T(e){i.value?.setText(e)}async function E(){await i.value?.reload()}async function D(){await i.value?.adopt()}async function O(){await i.value?.checkPrs()}async function k(){await i.value?.takeGithub()}async function A(){await i.value?.pushTop()}return{branch:s,branchesKnown:c,draft:l,text:u,baseVersion:d,save:f,error:p,pr:m,loading:h,checkingPrs:g,githubTop:_,prefilled:v,pushing:y,start:C,stop:w,setText:T,reload:E,adopt:D,checkPrs:O,takeGithub:k,pushTop:A}}),tx=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],nx=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],rx=864e5,ix=rx;function ax(e){return String(e).padStart(2,`0`)}function ox(e){let t=new Date(e);return`${ax(t.getHours())}:${ax(t.getMinutes())}`}function sx(e){let t=new Date(e);return`${t.getDate()} ${tx[t.getMonth()]}`}function cx(e,t){let n=new Date(e),r=new Date(t);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()?ox(e):`${sx(e)} ${ox(e)}`}var lx=6e4,ux=[[`year`,365*rx],[`month`,30*rx],[`day`,rx],[`hour`,60*lx],[`minute`,lx]];function dx(e,t){let n=t-e;for(let e=0;e<ux.length;e++){let[t,r]=ux[e],i=Math.floor(n/r);if(i<1)continue;let a=[Kx(i,t)],o=ux[e+1];if(o!==void 0){let e=Math.min(Math.floor((n-i*r)/o[1]),t===`year`?11:1/0);e>0&&a.push(Kx(e,o[0]))}return`${a.join(` `)} ago`}return`just now`}function fx(e){let t=new Date(e);return`${nx[t.getDay()]} ${sx(e)} ${t.getFullYear()}, ${ox(e)}`}function px(e,t){return mx(e,t,ix)}function mx(e,t,n){return e.activity!==null&&t-e.activity<=n}var hx={local:`local only`,pushed:`pushed, no PR`,draft:`draft PR`,review:`in review`,changes:`changes requested`,approved:`approved`,merged:`merged`,closed:`closed`,gone:`branch gone`},gx={local:1,pushed:2,draft:3,review:4,changes:4,approved:5,merged:5,closed:0,gone:0},_x=[`local`,`pushed`,`draft`,`review`,`changes`,`approved`,`merged`,`closed`,`gone`],vx={approved:`approved`,"changes-requested":`changes requested`,reviewed:`reviewed`,commented:`commented`},yx={...vx,edited:`files edited`,git:`commit or checkout`,"head-commit":`new commit on the PR`,draft:`draft edited`,merged:`merged`,closed:`closed`};function bx(e){let t=yx[e.kind];return e.author===null?t:`${t} · ${e.author}`}function xx(e,t){let n=[];for(let r of e.pr?.progress?.events??[]){let e=Date.parse(r.at);Number.isNaN(e)||n.push({at:e,text:`${vx[r.kind]} · ${r.author}`,other:t!==null&&r.author!==t})}let r=e.pr,i=r?.state===`open`?Date.parse(r.progress?.headCommittedAt??``):NaN;if(Number.isNaN(i)||n.push({at:i,text:yx[`head-commit`],other:!1}),r!==null&&r.state!==`open`){let e=Date.parse(r.mergedAt??r.closedAt??``);Number.isNaN(e)||n.push({at:e,text:r.state,other:!1})}let a=[[e.times.edited,yx.edited],[e.times.git,yx.git],[e.times.draft,yx.draft]];for(let[e,t]of a)e!==null&&n.push({at:e,text:t,other:!1});return n.sort((e,t)=>t.at-e.at)}function Sx(e){let t=[e.decision===null?`no decision`:e.decision.replace(`-`,` `)];e.pendingReviewers>0&&t.push(`${e.pendingReviewers} asked`),e.unresolvedThreads>0&&t.push(Kx(e.unresolvedThreads,`open thread`));let n=[[`Review`,t.join(`, `)],[`Checks`,e.checks===null?`none`:e.checks]];return e.conflicting&&n.push([`Merge`,`conflicts with the base branch`]),n}function Cx(e){let t=[];return e.uncommitted>0&&t.push(`${e.uncommitted} uncommitted`),e.unpushed>0&&t.push(`${e.unpushed} unpushed`),e.ahead>0&&t.push(e.base===null?`${e.ahead} ahead`:`${e.ahead} ahead of ${e.base}`),t.join(`, `)}function wx(e){let t=[[`Stage`,hx[e.stage]]],n=e.pr?.baseRefName??e.facts.base;n&&t.push([`Base`,n]),e.stack&&t.push([`Stack`,`layer ${e.stack.position} of ${e.stack.size}, on ${e.stack.root}`]),e.pr?.progress&&t.push(...Sx(e.pr.progress)),e.worktreePath&&t.push([`Worktree`,e.worktreePath]);let r=Cx(e.facts);return r!==``&&t.push([`Local`,r]),e.note&&t.push([`Note`,Gx[e.note]]),e.tracked&&t.push([`Marks`,`tracked`]),t}function Tx(e,t,n){return{text:e,turn:t,why:n}}function Ex(e,t,n){let r=e.progress;if(e.isDraft)return Tx(`draft`,`you`,`A draft on GitHub: not asking for review yet`);if(r===null)return Tx(`open`,`none`,`GitHub did not say more about this PR`);if(r.conflicting)return Tx(`conflicts`,`you`,`GitHub says it has merge conflicts`);if(r.checks===`failure`)return Tx(`checks failing`,`you`,`The checks on its head failed`);if(t.attention.includes(`changes-requested`))return Tx(`changes requested`,`you`,kx(t)[0]??``);let i=r.events.find(e=>e.kind===`approved`&&e.author!==n);if(r.decision===`approved`||r.decision===null&&i)return Tx(`approved`,`you`,`Approved: ready to merge`);let a=r.requestedReviewers.join(`, `);if(r.decision===`changes-requested`)return Tx(`awaiting re-review`,`others`,`Asked to review again: ${a}`);if(r.requestedReviewers.length>0||r.pendingReviewers>0)return Tx(`awaiting review`,`others`,`Asked to review: ${a}`);let o=r.events.find(e=>e.kind===`reviewed`&&e.author!==n);return o?Tx(`reviewed, no decision`,`you`,`${o.author} reviewed with comments only, and nobody is asked to review now`):Tx(`needs reviewer`,`you`,`Nobody is asked to review it yet`)}var Dx={"pushed-no-pr":Tx(`no PR yet`,`you`,`Pushed, and no PR for it yet`),"not-pushed":Tx(`not pushed`,`you`,`Commits that are on no remote yet`),uncommitted:Tx(`uncommitted`,`you`,`Changes that are not committed`),empty:Tx(`nothing yet`,`none`,`A new worktree with nothing in it yet`),"branch-gone":Tx(`branch gone`,`none`,`The branch no longer exists`)};function Ox(e,t){let n=e.pr;return n?.reviewRequested?Tx(`your review`,`you`,`${n.author??`Someone`} asks you to review this`):n!==null&&n.state!==`open`?e.facts.uncommitted>0?Tx(`${n.state}, leftovers`,`you`,`The PR is done; the worktree still has changes`):Tx(n.state,`none`,`The PR is ${n.state}`):n===null?Dx[e.state]??Tx(e.state,`none`,``):Ex(n,e,t)}function kx(e){let t=e.pr,n=t?.progress??null;return e.attention.map(e=>e===`review-requested`?`${t?.author??`Someone`} asks you to review this`:`Changes requested by ${(n?.changesRequestedBy??[]).filter(e=>!(n?.requestedReviewers??[]).includes(e)).join(`, `)}, not asked to review again yet`)}function Ax(e){let t=[],n=e.pr;if(n!==null){t.push(`Pull request: ${n.url}`,`Title: ${n.title}`),n.author!==null&&t.push(`Author: ${n.author}${n.reviewRequested?` (I am asked to review it)`:``}`);let e=n.headOwner===null?``:` from ${n.headOwner}`;t.push(`Branch: ${n.headRefName}${e}, into ${n.baseRefName} of ${n.repo}`,`Head commit: ${n.headRefOid}`)}else if(e.branch!==null){let n=e.facts.base===null?``:`, ahead of ${e.facts.base}`;t.push(`Branch: ${e.branch}${n}`)}return e.repoRoot===null?n!==null&&t.push(`Local clone: none; git clone https://github.com/${n.repo}.git`):t.push(`Local clone: ${e.repoRoot}`),e.worktreePath!==null&&t.push(`Worktree: ${e.worktreePath}`),t.join(`
|
|
20
20
|
`)}var jx={you:0,others:1,none:2},Mx={"changes-requested":0,"review-required":1,approved:2},Nx={failure:0,pending:1,success:2};function Px(e){return(e.decision===null?1:Mx[e.decision])*1e4-e.unresolvedThreads}function Fx(e){let t=e.checks===null?3:Nx[e.checks];return(e.conflicting?0:10)+t}function Ix(e){return e.draft?e.placeholders>0?0:e.bodyDiffers?1:2:null}function Lx(e){let t=e.stack;return t===null?null:`${t.root}\u0000${String(t.position).padStart(4,`0`)}`}function Rx(e,t){let n=e.pr?.progress??null;return n===null?null:t(n)}var zx={stage:e=>_x.indexOf(e.stage),branch:e=>e.branch,stack:Lx,pr:e=>e.pr?.number??null,review:e=>Rx(e,Px),ci:e=>Rx(e,Fx),local:e=>e.facts.uncommitted+e.facts.unpushed||null,draft:e=>Ix(e.facts),status:e=>jx[Ox(e,null).turn],activity:e=>e.activity};function Bx(e,t){let n=t.dir===`asc`?1:-1,r=zx[t.key],i=e.map(e=>({item:e,value:r(e)}));return i.sort((e,t)=>e.value===t.value?0:e.value===null?1:t.value===null?-1:(e.value<t.value?-1:1)*n),i.map(e=>e.item)}function Vx(e,t=null){let n=new Map;for(let t of e){let e=t.repoRoot??t.repoName,r=n.get(e);r===void 0&&(r={key:e,name:t.repoName,items:[]},n.set(e,r)),r.items.push(t)}for(let e of n.values())e.items=t===null?Ux(e.items):Bx(e.items,t);return[...n.values()]}function Hx(e){return e.stack===null?null:`${e.repoRoot??e.repoName}\n${e.stack.root}`}function Ux(e){let t=new Map;for(let n of e){let e=Hx(n);if(e===null)continue;let r=t.get(e)??[];r.push(n),t.set(e,r)}let n=new Set,r=[];for(let i of e){let e=Hx(i);if(e===null){r.push(i);continue}if(n.has(e))continue;n.add(e);let a=t.get(e)??[i];r.push(...[...a].sort((e,t)=>(e.stack?.position??0)-(t.stack?.position??0)))}return r}var Wx={"no-local-clone":`no clone`,"no-local-branch":`no branch`,"worktree-on-disk":`on disk`},Gx={"no-local-clone":`no local clone`,"no-local-branch":`no local branch`,"worktree-on-disk":`worktree still on disk`};function Kx(e,t){return`${e} ${t}${e===1?``:`s`}`}function qx(e,t){switch(e){case`gh-missing`:return`gh not found — PR state unknown`;case`gh-logged-out`:return`gh not logged in — PR state unknown`;case`error`:return`could not reach GitHub: ${t??`unknown error`}`;default:return null}}function Jx(e,t,n){let r=t===null?``:` as ${t}`;return`PRs checked ${dx(e,n)}${r}`}function Yx(e,t,n){let r=t===null?``:` as ${t}`;return`PRs checked ${cx(e,n)}${r}`}var Xx=[{key:`day`,label:`Last day`,within:rx},{key:`week`,label:`Last week`,within:7*rx},{key:`two-weeks`,label:`Last 2 weeks`,within:14*rx},{key:`month`,label:`Last month`,within:30*rx},{key:`older`,label:`Older`,within:1/0}];function Zx(e,t){return t===null?Ux(e):Bx(e,t)}function Qx(e,t){let n=Xx.map(e=>({...e,items:[]}));for(let r of e){let e=r.activity===null?1/0:t-r.activity;(n.find(t=>e<=t.within)??n[n.length-1]).items.push(r)}return n.filter(e=>e.items.length>0)}function $x(e,t){let n=t.byTime?Qx(e,t.now):[{key:`all`,label:``,items:[...e]}],r=[];for(let e of n)if(t.byTime&&r.push({kind:`time`,key:`t:${e.key}`,label:e.label,count:e.items.length}),!t.byRepo)for(let n of Zx(e.items,t.sort))r.push({kind:`item`,key:n.key,item:n});else for(let n of Vx(e.items,t.sort)){r.push({kind:`repo`,key:`r:${e.key}:${n.key}`,name:n.name,count:n.items.length});for(let e of n.items)r.push({kind:`item`,key:e.key,item:e})}return r}var eS={class:`draft-panel`,"data-testid":`pr-draft-panel`,"aria-label":`PR draft`},tS={class:`panel-head`},nS=[`data-tip`],rS={key:0,class:`note`},iS={key:1,class:`note`,"data-testid":`draft-no-branch`},aS={class:`pr-line`,"data-testid":`draft-pr-line`},oS=[`href`,`data-tip`],sS={class:`pr-state`},cS=[`disabled`],lS={class:`dim`},uS=[`disabled`],dS={key:0,class:`note dim`,"data-testid":`draft-prefilled`},fS=[`value`,`disabled`],pS={class:`save-line`,"data-testid":`draft-save-line`},mS={key:1,class:`note view-error`,"data-testid":`draft-error`},hS={key:2,class:`sync`,"data-testid":`draft-body-differs`},gS={class:`sync-line`},_S=[`disabled`],vS=[`disabled`,`data-tip`],yS={key:0,class:`sync-line confirm`,"data-testid":`draft-push-confirm`},bS={class:`github-top`},xS={class:`text-block mono`,"data-testid":`draft-github-top`},SS={key:3,class:`suggestion offered`,"data-testid":`draft-suggestion`},CS={class:`text-block mono`},wS={key:4,class:`suggestion`,"data-testid":`draft-suggestion`},TS={class:`text-block mono`},ES={key:5,class:`ai-zone`,"data-testid":`draft-ai`},DS={class:`text-block mono`},OS={class:`preview-section`},kS={class:`eyebrow`},AS={key:0,class:`holes`,"data-testid":`draft-placeholder-count`},jS={class:`text-block preview mono`,"data-testid":`draft-preview`},MS={key:0,class:`hole`},NS=sf(gr({__name:`PrDraftPanel`,props:{session:{}},setup(e){let t=e,n=t.session===void 0?ex():null;jr(()=>n?.start()),Pr(()=>n?.stop());let r=$(()=>t.session??ex()),i=$(()=>n!==null&&!n.branchesKnown),a=$(()=>n!==null&&n.branch===null),o=$(()=>r.value.text.trim()===``),s=$(()=>r.value.draft?.suggested??null),c=$(()=>r.value.draft?.ai??null),l=$(()=>s.value!==null&&o.value&&r.value.save===`idle`),u=$(()=>r.value.pr?.pr??null),d=$(()=>{let e=u.value;return e===null?``:e.state===`open`?e.isDraft?`draft`:`open`:e.state}),f=$(()=>{let e=u.value;return e!==null&&e.state===`open`&&e.body!==null&&!o.value&&Xb(e.body,r.value.text)}),p=$(()=>f.value&&r.value.save===`idle`&&r.value.draft?.top!=null),m=$(()=>Ub(r.value.text)),h=V(!1);W(p,e=>{e||(h.value=!1)});async function g(){h.value=!1,await r.value.pushTop()}let _=$(()=>{let e=r.value.pr;if(e===null||e.pr!==null)return null;if(e.status===`never`)return`PR state not checked`;let t=qx(e.status,e.message);return t===null?`No PR for this branch${e.checkedAt===null?``:` · ${Yx(e.checkedAt,e.viewer,Date.now())}`}`:t}),v=$(()=>{switch(r.value.save){case`dirty`:case`saving`:return`saving…`;case`conflict`:return`changed elsewhere`;case`error`:return r.value.error;default:return r.value.draft?.adoptedUnedited?`agent text, not edited`:null}}),y=$(()=>{let e=u.value;return e!==null&&e.state===`open`&&e.body!==null?e.body:null}),b=$(()=>y.value===null?Gb(r.value.text,c.value):Yb(y.value,r.value.text)),x=$(()=>Ub(b.value)),S=$(()=>{let e=b.value,t=[],n=0;for(let r of Hb(e))r.start>n&&t.push({text:e.slice(n,r.start),hole:!1}),t.push({text:e.slice(r.start,r.end),hole:!0}),n=r.end;return n<e.length&&t.push({text:e.slice(n),hole:!1}),t});function C(e){r.value.setText(e.target.value)}return(e,t)=>(q(),J(`aside`,eS,[X(`header`,tS,[t[8]||=X(`span`,{class:`eyebrow`},`PR draft`,-1),r.value.branch?(q(),J(`span`,{key:0,class:`branch mono`,"data-tip":r.value.branch},B(r.value.branch),9,nS)):Q(``,!0)]),i.value?(q(),J(`p`,rS,`Loading…`)):a.value?(q(),J(`p`,iS,` No local branch to draft for. Pick a layer that is a local branch, or check one out. `)):(q(),J(K,{key:2},[X(`p`,aS,[u.value?(q(),J(K,{key:0},[X(`a`,{class:`pr-link mono`,href:u.value.url,target:`_blank`,rel:`noopener noreferrer`,"data-tip":u.value.title},`PR #`+B(u.value.number),9,oS),X(`span`,sS,B(d.value),1),X(`button`,{class:`small-btn`,"data-testid":`draft-check-pr`,disabled:r.value.checkingPrs,"data-tip":`Read this PR from GitHub again`,onClick:t[0]||=e=>r.value.checkPrs()},B(r.value.checkingPrs?`checking…`:`check again`),9,cS)],64)):_.value?(q(),J(K,{key:1},[X(`span`,lS,B(_.value),1),X(`button`,{class:`small-btn`,"data-testid":`draft-check-prs`,disabled:r.value.checkingPrs,onClick:t[1]||=e=>r.value.checkPrs()},B(r.value.checkingPrs?`checking…`:`check PRs`),9,uS)],64)):Q(``,!0)]),t[14]||=X(`label`,{class:`editor-label eyebrow`,for:`pr-draft-top`},`Your words (top.md)`,-1),r.value.prefilled?(q(),J(`p`,dS,` From the PR on GitHub. Saved as top.md once you edit. `)):Q(``,!0),X(`textarea`,{id:`pr-draft-top`,class:`editor mono`,"data-testid":`draft-editor`,spellcheck:`true`,value:r.value.text,disabled:r.value.loading,placeholder:`What this change is and why. {{like this}} marks a gap to fill.`,onInput:C},null,40,fS),X(`p`,pS,[v.value?(q(),J(`span`,{key:0,class:z({warn:r.value.save===`conflict`||r.value.save===`error`})},B(v.value),3)):Q(``,!0),r.value.save===`conflict`?(q(),J(`button`,{key:1,class:`small-btn`,"data-testid":`draft-reload`,"data-tip":`Drop what is typed here and take the file's text`,onClick:t[2]||=e=>r.value.reload()},` reload `)):Q(``,!0)]),r.value.error&&r.value.save!==`error`?(q(),J(`p`,mS,B(r.value.error),1)):Q(``,!0),p.value?(q(),J(`section`,hS,[X(`p`,gS,[t[9]||=X(`span`,{class:`differs`},`Your words differ from the PR on GitHub.`,-1),X(`button`,{class:`small-btn`,"data-testid":`draft-take-github`,disabled:r.value.checkingPrs||r.value.pushing,"data-tip":`Read the PR again and save its top zone as top.md`,onClick:t[3]||=e=>r.value.takeGithub()},` Take GitHub's text `,8,_S),h.value?Q(``,!0):(q(),J(`button`,{key:0,class:`small-btn`,"data-testid":`draft-push`,disabled:r.value.pushing||m.value>0,"data-tip":m.value>0?`Fill the {{…}} placeholders first`:`Put your words in the PR's top zone on GitHub`,onClick:t[4]||=e=>h.value=!0},B(r.value.pushing?`updating…`:`Update GitHub…`),9,vS))]),h.value?(q(),J(`p`,yS,[X(`span`,null,`Replace the top zone of PR #`+B(u.value?.number)+` on GitHub with your words? The part below the line stays as it is.`,1),X(`button`,{class:`small-btn primary`,"data-testid":`draft-push-yes`,onClick:t[5]||=e=>g()},` Update GitHub `),X(`button`,{class:`small-btn`,onClick:t[6]||=e=>h.value=!1},`Cancel`)])):Q(``,!0),X(`details`,bS,[t[10]||=X(`summary`,{class:`eyebrow`},`GitHub's text`,-1),X(`pre`,xS,B(r.value.githubTop),1)])])):Q(``,!0),l.value?(q(),J(`section`,SS,[t[11]||=X(`span`,{class:`eyebrow`},`agent suggestion`,-1),X(`pre`,CS,B(s.value),1),X(`button`,{class:`small-btn`,"data-testid":`draft-adopt`,onClick:t[7]||=e=>r.value.adopt()},` start from this `)])):s.value===null?Q(``,!0):(q(),J(`details`,wS,[t[12]||=X(`summary`,{class:`eyebrow`},`agent suggestion`,-1),X(`pre`,TS,B(s.value),1)])),c.value===null?Q(``,!0):(q(),J(`details`,ES,[t[13]||=X(`summary`,{class:`eyebrow`},`AI zone (ai.md)`,-1),X(`pre`,DS,B(c.value),1)])),X(`section`,OS,[X(`span`,kS,[Z(B(y.value===null?`body as sent`:`body after Update GitHub`)+` `,1),x.value>0?(q(),J(`span`,AS,`· `+B(x.value)+` `+B(x.value===1?`placeholder`:`placeholders`),1)):Q(``,!0)]),X(`pre`,jS,[(q(!0),J(K,null,G(S.value,(e,t)=>(q(),J(K,{key:t},[e.hole?(q(),J(`mark`,MS,B(e.text),1)):(q(),J(K,{key:1},[Z(B(e.text),1)],64))],64))),128))])])],64))]))}}),[[`__scopeId`,`data-v-9e67b4c6`]]),PS={class:`topbar`,"data-testid":`compare-topbar`},FS={class:`base-select`},IS=[`title`],LS={key:1,class:`arrow`,"aria-hidden":`true`},RS=[`disabled`,`value`],zS={key:0,value:``,disabled:``},BS=[`value`],VS={key:1,class:`uncommitted-toggles`,"data-testid":`uncommitted-toggles`},HS=[`data-testid`,`checked`,`disabled`,`title`,`onChange`],US={key:2,class:`stats mono`,"data-testid":`compare-stats`},WS={class:`files-changed`},GS={class:`count-add`},KS={class:`count-del`},qS={key:3,class:`topbar-busy mono`,"data-testid":`compare-busy`},JS=[`aria-pressed`],YS={class:`compare-body`},XS={key:0,class:`view-error error-banner`,"data-testid":`compare-error-banner`},ZS={key:1,class:`panel-note view-error`,"data-testid":`compare-error`},QS={key:2,class:`state-block`,"data-testid":`no-base-branch`},$S={key:3,class:`panel-note`,"data-testid":`compare-loading`},eC={key:4,class:`panel-note`,"data-testid":`compare-clean`},tC={key:0,class:`commits-section`},nC=[`aria-expanded`],rC={class:`chevron`},iC={class:`commits-count`},aC={key:0,class:`commit-list mono`,"data-testid":`compare-commits`},oC={class:`hash`},sC=[`title`],cC={class:`meta`},lC={class:`author`},uC={class:`date`},dC=[`aria-busy`],fC=sf(gr({__name:`CompareView`,setup(e){let t=Vl(),n=ql(),{compare:r,compareStack:i,selectedStackHead:a,pickedLayer:o,comparePair:s,compareUncommitted:c}=Fs(t),l=[{key:`staged`,label:`staged`},{key:`unstaged`,label:`unstaged`},{key:`untracked`,label:`untracked`}],u=V([]),d=V(!1),f=Bt(new Set),p=V(null),m=$(()=>p.value?.scrollerEl??null);jr(()=>{h(),g()});async function h(){await t.refreshCompare()}async function g(){try{u.value=await t.getCandidateBaseBranches()}catch{u.value=[]}}let _=$(()=>r.value.compareDiff),v=$(()=>_.value?.files??[]),y=$(()=>t.shared.status?.branch?.current||null),b=$(()=>s.value.head??y.value),x=$(()=>{let e=r.value.baseBranch;return e!==null&&!u.value.includes(e)?[e,...u.value]:u.value});async function S(e){let n=e.target.value;n&&n!==r.value.baseBranch&&(su({view:`compare`}),await t.setSelectedCompareBase(n))}let C=$(()=>(i.value?.layers.length??0)>=2);async function w(e){e!==a.value&&(su({view:`compare`}),await t.setSelectedStackHead(e))}let T=$(()=>a.value!==null&&o.value?.isHead!==!0),E=$(()=>c.value.unstaged);async function D(e,n){let r={...c.value,[e]:n.target.checked};r.unstaged&&(r.staged=!0),await t.setCompareUncommitted(r)}function O(e){return Pd(e.date.getTime())}let k=$(()=>r.value.selection.type===`file`?r.value.selection.index:null);function A(e){su({view:`compare`}),j(e)}function j(e){t.selectCompareFile(e);let n=v.value[e];if(!n)return;let r=Nl(n);f.delete(r),On(()=>p.value?.scrollToFile(r))}W(()=>n.stackScrollRequest,e=>{e&&On(()=>p.value?.scrollToFile(e.key,{smooth:!1}))}),W(()=>n.expandGatedRequest,e=>{e!==0&&p.value?.expandAllGated()});function M(e){let n=v.value.findIndex(t=>Nl(t)===e);n!==-1&&t.selectCompareFile(n)}W(()=>v.value,e=>{let n=Yy(e)[0];n&&k.value===null&&t.selectCompareFile(e.indexOf(n))},{immediate:!0});function N(e){f.has(e)?f.delete(e):f.add(e)}function P(e){if(su({view:`compare`}),t.wholeFile?.key===e){t.setWholeFile(null);return}let n=F.value.find(t=>Nl(t)===e);if(!n)return;let r=v.value.findIndex(t=>Nl(t)===e);r!==-1&&j(r),t.setWholeFile({view:`compare`,key:e,path:n.path,side:n.uncommitted})}let F=$(()=>Yy(v.value)),I=$(()=>F.value.map(e=>({key:Nl(e),path:e.path,status:e.status,uncommitted:e.uncommitted,stats:{insertions:e.additions,deletions:e.deletions},diff:t.wholeFile?.key===Nl(e)?t.wholeFile.diff:e.diff,collapsed:f.has(Nl(e)),refPair:e.uncommitted?{kind:`compare-uncommitted`,base:s.value.base,side:e.uncommitted}:{kind:`compare`,base:s.value.base,head:s.value.head}}))),L=$(()=>{let e=k.value;if(e===null)return null;let t=v.value[e];return t?Nl(t):null}),ee=Su(),R=V(null),te=Gm({container:R,isRow:ee,row:{pref:`compareTop`,defaultRatio:.22,min:gl,max:_l}}),ne=Ym(ee,m,`File diffs`,{self:!0});return(e,o)=>(q(),J(`div`,{class:z([`compare`,{portrait:U(ee)}]),style:le(U(ee)?{"--compare-top":`${(U(te).rowRatio.value*100).toFixed(2)}%`}:void 0)},[X(`header`,PS,[(q(),Y(lr,{defer:``,to:`#view-toolbar-slot`,disabled:!U(ee)},[X(`label`,FS,[b.value?(q(),J(`span`,{key:0,class:`head-branch mono`,title:b.value},B(b.value),9,IS)):Q(``,!0),b.value?(q(),J(`span`,LS,`→`)):Q(``,!0),o[2]||=X(`span`,{class:`eyebrow`},`base`,-1),X(`select`,{class:`mono`,"data-testid":`base-select`,"aria-label":`Base branch`,disabled:U(r).loading,value:U(r).baseBranch??``,onChange:S},[U(r).baseBranch===null?(q(),J(`option`,zS,`pick a base…`)):Q(``,!0),(q(!0),J(K,null,G(x.value,e=>(q(),J(`option`,{key:e,value:e},B(e),9,BS))),128))],40,RS)])],8,[`disabled`])),C.value&&U(i)?(q(),Y(zb,{key:0,stack:U(i),active:U(a),disabled:U(r).loading,onPick:w},null,8,[`stack`,`active`,`disabled`])):Q(``,!0),T.value?Q(``,!0):(q(),J(`fieldset`,VS,[o[3]||=X(`legend`,null,`include`,-1),(q(),J(K,null,G(l,e=>X(`label`,{key:e.key,class:`uncommitted-toggle`},[X(`input`,{type:`checkbox`,"data-testid":`uncommitted-toggle-${e.key}`,checked:U(c)[e.key],disabled:e.key===`staged`&&E.value,title:e.key===`staged`&&E.value?`Unstaged edits sit on top of staged ones, so unstaged includes these`:void 0,onChange:t=>D(e.key,t)},null,40,HS),X(`span`,null,B(e.label),1)])),64))])),_.value?(q(),J(`p`,US,[X(`span`,WS,B(_.value.stats.filesChanged)+` `+B(_.value.stats.filesChanged===1?`file`:`files`)+` changed`,1),X(`span`,GS,`+`+B(_.value.stats.additions),1),X(`span`,KS,`−`+B(_.value.stats.deletions),1)])):Q(``,!0),U(r).loading&&_.value?(q(),J(`span`,qS,`Loading…`)):Q(``,!0),X(`button`,{class:z([`draft-toggle mono`,{on:U(n).prDraftOpen}]),"data-testid":`pr-draft-toggle`,"aria-pressed":U(n).prDraftOpen,title:`The PR description for this branch: your words, an agent's, and the body as sent`,onClick:o[0]||=e=>U(n).togglePrDraft()},[...o[4]||=[X(`span`,{class:`dot`,"aria-hidden":`true`},null,-1),Z(`PR draft `,-1)]],10,JS)]),X(`div`,{class:z([`compare-main`,{"with-draft":U(n).prDraftOpen}])},[X(`div`,YS,[U(r).error&&_.value?(q(),J(`p`,XS,B(U(r).error),1)):Q(``,!0),U(r).error&&!_.value?(q(),J(`p`,ZS,B(U(r).error),1)):U(r).noBaseBranch?(q(),J(`div`,QS,[...o[5]||=[X(`p`,{class:`state-title`},`No base branch detected.`,-1),X(`p`,{class:`state-hint`},` Base detection uses remote refs (like origin/main) — this repo has none that qualify. Pick a base branch above to compare against. `,-1)]])):U(r).loading&&!_.value?(q(),J(`p`,$S,` Loading compare… `)):_.value&&v.value.length===0?(q(),J(`p`,eC,` No changes`+B(b.value?` on ${b.value}`:``)+` compared to `+B(U(s).base)+`. `,1)):_.value?(q(),J(K,{key:5},[_.value.commits.length>0?(q(),J(`section`,tC,[(q(),Y(lr,{defer:``,to:`#view-toolbar-slot`,disabled:!U(ee)},[X(`button`,{class:`commits-toggle eyebrow`,"data-testid":`commits-toggle`,"aria-expanded":d.value,onClick:o[1]||=e=>d.value=!d.value},[X(`span`,rC,B(d.value?`▾`:`▸`),1),o[6]||=Z(` Commits `,-1),X(`span`,iC,B(_.value.commits.length),1)],8,nC)],8,[`disabled`])),d.value?(q(),J(`ul`,aC,[(q(!0),J(K,null,G(_.value.commits,e=>(q(),J(`li`,{key:e.hash,class:`commit-row`},[X(`span`,oC,B(e.shortHash),1),X(`span`,{class:`message`,title:e.message},B(e.message),9,sC),X(`span`,cC,[X(`span`,lC,B(e.author),1),X(`span`,uC,B(O(e)),1)])]))),128))])):Q(``,!0)])):Q(``,!0),X(`div`,{ref_key:`prBodyEl`,ref:R,class:`pr-body`,"aria-busy":U(r).loading&&!!_.value},[ba(Xy,{"data-testid":`compare-files`,files:v.value,"selected-index":k.value,portrait:U(ee),onActivate:A,onSelect:j},null,8,[`files`,`selected-index`,`portrait`]),U(ee)?(q(),Y(Bv,{key:0,split:U(te),label:`Resize file list`},null,8,[`split`])):Q(``,!0),ba(cv,Oa({ref_key:`stackEl`,ref:p,class:`diffs-col`,"data-testid":`compare-diffs`,files:I.value,"active-key":L.value,syntax:U(n).diffSyntaxEnabled,mode:U(n).diffMode,wrap:U(n).wrapEnabled,"show-whole-toggle":``,"whole-key":U(t).wholeFile?.key??null,"whole-loading":U(t).wholeFileLoading,"whole-refusal":U(t).wholeFileRefusal},U(ne),{onActiveFile:M,onToggleCollapse:N,onToggleWhole:P}),null,16,[`files`,`active-key`,`syntax`,`mode`,`wrap`,`whole-key`,`whole-loading`,`whole-refusal`])],8,dC)],64)):Q(``,!0)]),U(n).prDraftOpen?(q(),Y(NS,{key:0,class:`draft-col`})):Q(``,!0)],2)],6))}}),[[`__scopeId`,`data-v-35ba9c8c`]]),pC=[`title`],mC=sf(gr({__name:`ShowChangesButton`,props:{path:{}},setup(e){let t=e,n=Vl(),r=ql(),i=$(()=>{let e=(n.shared.status?.files??[]).filter(e=>e.path===t.path);return e.length===0?null:e.find(e=>!e.staged)??e[0]});function a(){let e=i.value;if(!e)return;let t=Ml(e);su({view:`changes`}),r.setActiveView(`changes`),n.selectFile(e),r.setActiveStackKey(t),r.requestStackScroll(t)}return(e,n)=>i.value?(q(),J(`button`,{key:0,class:`show-changes mono`,"data-testid":`show-changes`,title:`Show what changed in ${t.path}`,onClick:n[0]||=Jo(e=>a(),[`stop`])},` show changes `,8,pC)):Q(``,!0)}}),[[`__scopeId`,`data-v-786aa840`]]),hC={key:0,class:`image-view`,"data-testid":`image-view`},gC={class:`image-controls`},_C=[`aria-pressed`,`title`],vC=sf(gr({__name:`ImageView`,props:{path:{},media:{}},emits:[`fail`],setup(e,{emit:t}){let n=e,r=t,i=Vl(),a=V(`fit`),o=$(()=>i.repoId===null?null:Us(i.repoId,{path:n.path,side:`worktree`,version:n.media.version}));return(t,n)=>o.value!==null&&e.media.image?(q(),J(`div`,hC,[X(`div`,gC,[X(`button`,{class:z([`fit-toggle mono`,{on:a.value===`actual`}]),"data-testid":`image-fit-toggle`,"aria-pressed":a.value===`actual`,"aria-label":`Show the image at its actual size`,title:a.value===`actual`?`Actual size: on. Click to shrink the image to fit`:`Actual size: off. Click to show every pixel 1:1 and scroll`,onClick:n[0]||=e=>a.value=a.value===`actual`?`fit`:`actual`},` 1:1 `,10,_C)]),ba(wv,{src:o.value,width:e.media.image.width,height:e.media.image.height,fit:a.value,onFail:n[1]||=e=>r(`fail`)},null,8,[`src`,`width`,`height`,`fit`])])):Q(``,!0)}}),[[`__scopeId`,`data-v-94ee96d6`]]),yC={class:`file-pane`},bC={key:0,class:`pane-header mono`,"data-testid":`file-header`},xC=[`title`],SC={class:`file-meta`},CC={key:0,class:`file-lang`},wC={key:1,class:`file-lang`,"data-testid":`file-format`},TC={key:2,class:`mono`,"data-testid":`file-dimensions`},EC={key:3,"data-testid":`file-frames`},DC={key:4,class:`file-size`},OC={class:`pane-body`},kC={key:0,class:`pane-note`,"data-testid":`file-prompt`},AC={key:1,class:`pane-note pane-error mono`,"data-testid":`file-error`},jC={key:2,class:`pane-note`,"data-testid":`file-loading`},MC={key:4,class:`pane-note`,"data-testid":`file-binary`},NC={key:0,"data-testid":`image-refused`},PC={key:5,class:`pane-note`,"data-testid":`file-too-large`},FC={key:6,class:`pane-note`,"data-testid":`file-empty`},IC=[`data-ln`],LC={class:`ln code-gutter`},RC=[`innerHTML`],zC={key:0,class:`truncated-note mono`,"data-testid":`file-truncated`},BC=sf(gr({__name:`FileContentPane`,props:{path:{},file:{},loading:{type:Boolean},error:{},wrap:{type:Boolean}},setup(e){let t=e,n=$(()=>{if(t.path===null||t.file===null)return null;let{binary:e,tooLarge:n,content:r}=t.file;return e||n||r===``?null:kg(r,t.path)}),r=Hl(),i=V(null),a=V(null),o=null;W(()=>r.lineRequest,e=>{e&&On(()=>{let t=i.value?.querySelector(`[data-ln="${e.line}"]`);t&&(t.scrollIntoView({block:`center`}),a.value=e.line,o&&clearTimeout(o),o=setTimeout(()=>{a.value=null,o=null},1200))})});let s=$(()=>{let e=n.value?.lines.length??0;return`${Math.max(3,String(e).length)}ch`}),c=$(()=>t.file!==null&&!t.file.binary&&!t.file.tooLarge&&t.file.content===``),l=V(!1);W(()=>[t.path,t.file],()=>{l.value=!1});let u=$(()=>{if(l.value)return` · preview failed to decode`;let e=t.file?.media?.refusal??null,n=e===null?null:vv[e];return n===null?``:` · ${n}`}),d=$(()=>t.file?.media?.image??null),f=$(()=>{let e=d.value?.frames??1;return e>1?e:null});return(t,r)=>(q(),J(`div`,yC,[e.path?(q(),J(`header`,bC,[X(`span`,{class:`file-path`,title:e.path},B(e.path),9,xC),X(`span`,SC,[n.value?.language?(q(),J(`span`,CC,B(n.value.language),1)):Q(``,!0),d.value?(q(),J(`span`,wC,B(d.value.format),1)):Q(``,!0),d.value?(q(),J(`span`,TC,B(d.value.width)+` × `+B(d.value.height),1)):Q(``,!0),f.value?(q(),J(`span`,EC,B(f.value)+` frames`,1)):Q(``,!0),e.file?(q(),J(`span`,DC,B(U(Ql)(e.file.size)),1)):Q(``,!0),e.path?(q(),Y(mC,{key:5,path:e.path},null,8,[`path`])):Q(``,!0),ba(R_)])])):Q(``,!0),X(`div`,OC,[e.path===null?(q(),J(`p`,kC,`Select a file`)):e.error&&e.file===null?(q(),J(`p`,AC,B(e.error),1)):e.file===null?(q(),J(`p`,jC,B(e.loading?`Loading…`:``),1)):e.file.media?.image&&!l.value?(q(),Y(vC,{key:3,path:e.path,media:e.file.media,onFail:r[0]||=e=>l.value=!0},null,8,[`path`,`media`])):e.file.binary||e.file.media?(q(),J(`p`,MC,[Z(` Binary file — `+B(U(Ql)(e.file.size)),1),u.value?(q(),J(`span`,NC,B(u.value),1)):Q(``,!0)])):e.file.tooLarge?(q(),J(`p`,PC,` File too large to display (`+B(U(Ql)(e.file.size))+`) `,1)):c.value?(q(),J(`p`,FC,`Empty file`)):n.value?(q(),J(`div`,{key:7,ref_key:`scrollEl`,ref:i,class:z([`code-scroll mono`,{wrap:e.wrap}]),"data-testid":`file-content`},[X(`div`,{class:z([`code-lines`,{stale:e.loading}]),style:le({"--ln-w":s.value})},[(q(!0),J(K,null,G(n.value.lines,(e,t)=>(q(),J(`div`,{key:t,class:z([`code-row`,{"line-flash":a.value===t+1}]),"data-ln":t+1},[X(`span`,LC,B(t+1),1),X(`span`,{class:`code code-cell`,innerHTML:e},null,8,RC)],10,IC))),128))],6),e.file.truncated?(q(),J(`p`,zC,` Truncated — showing the first `+B(n.value.lines.length.toLocaleString())+` of `+B(e.file.totalLines.toLocaleString())+` lines. `,1)):Q(``,!0)],2)):Q(``,!0)])]))}}),[[`__scopeId`,`data-v-19236ad9`]]),VC=5e3;function HC(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n>0?t.slice(n):t}function UC(e,t){if(e.binary)return{kind:`note`,note:`Binary file — no outline.`};if(e.tooLarge)return{kind:`note`,note:`File too large to outline.`};if(t===null)return{kind:`note`,note:`Loading outline…`};if(t.status===`unavailable`)return{kind:`note`,note:`Outline unavailable for this file.`};if(t.status===`unsupported`)return t.reason===`no-script-block`?{kind:`note`,note:`No <script> block in this component.`}:{kind:`note`,note:`No outline for ${HC(e.path)} files.`};if(t.symbols.length===0)return{kind:`note`,note:`No symbols in this file.`};let n=e.truncated&&e.totalLines>VC?`Outline of the first ${VC.toLocaleString()} of ${e.totalLines.toLocaleString()} lines.`:null;return{kind:`symbols`,symbols:t.symbols,note:n}}var WC=[`value`],GC={key:0,class:`outline-note`,"data-testid":`outline-note`},KC={key:0,class:`outline-note`,"data-testid":`outline-partial`},qC={key:1,class:`outline-note`,"data-testid":`outline-no-match`},JC={key:2,class:`outline-list`,role:`listbox`,"aria-label":`Symbols`},YC=[`title`,`aria-selected`,`onMousemove`,`onClick`],XC={class:`outline-kind`},ZC={class:`outline-name`},QC={key:0,class:`outline-parent`},$C={class:`outline-line`},ew=sf(gr({__name:`OutlinePopover`,setup(e,{expose:t}){let n=Hl(),{open:r,rootEl:i}=lf(),a=V(null),o=V(``),s=V(0),c=null;function l(){o.value=``,s.value=0,c=document.activeElement instanceof HTMLElement?document.activeElement:null,r.value=!0,On(()=>a.value?.focus())}W(r,e=>{if(e)return;let t=i.value?.contains(document.activeElement)??!1,n=c;c=null,t&&n?.isConnected===!0&&n.focus()}),t({openPopover:l});let u=$(()=>n.file===null||n.selectedPath===null?{kind:`note`,note:`No file open.`}:UC({path:n.selectedPath,binary:n.file.binary,tooLarge:n.file.tooLarge,truncated:n.file.truncated,totalLines:n.file.totalLines},n.fileSymbols)),d=$(()=>u.value.kind===`symbols`?u.value.symbols:[]),f=$(()=>{let e=o.value.trim();if(e===``)return d.value;let t=d.value.map(e=>e.name),n=new Set(kd(t,t.length).find(e).map(e=>e.text));return d.value.filter(e=>n.has(e.name))});W(f,()=>{s.value=0}),W(()=>n.selectedPath,()=>{r.value=!1});function p(e){n.requestLine(e.startLine),r.value=!1}function m(e){if(e.key===`ArrowDown`||e.ctrlKey&&e.key===`j`)e.preventDefault(),s.value=jd(s.value,1,f.value.length);else if(e.key===`ArrowUp`||e.ctrlKey&&e.key===`k`)e.preventDefault(),s.value=jd(s.value,-1,f.value.length);else if(e.key===`Enter`){e.preventDefault();let t=f.value[s.value];t!==void 0&&p(t)}else e.key===`Escape`&&(e.preventDefault(),r.value=!1)}return(e,t)=>U(r)?(q(),J(`div`,{key:0,ref_key:`rootEl`,ref:i,class:`outline mono`,"data-testid":`outline-popover`},[X(`input`,{ref_key:`inputEl`,ref:a,class:`outline-input mono`,"data-testid":`outline-input`,type:`text`,autocomplete:`off`,spellcheck:`false`,placeholder:`filter symbols`,"aria-label":`Filter symbols`,value:o.value,onInput:t[0]||=e=>o.value=e.target.value,onKeydown:m},null,40,WC),u.value.kind===`note`?(q(),J(`p`,GC,B(u.value.note),1)):(q(),J(K,{key:1},[u.value.note?(q(),J(`p`,KC,B(u.value.note),1)):Q(``,!0),f.value.length===0?(q(),J(`p`,qC,` No symbol matches “`+B(o.value.trim())+`”. `,1)):(q(),J(`ul`,JC,[(q(!0),J(K,null,G(f.value,(e,t)=>(q(),J(`li`,{key:`${e.name}:${e.startLine}`,class:z([`outline-row`,{selected:t===s.value}]),title:e.parent?`${e.name} in ${e.parent}`:e.name,role:`option`,"aria-selected":t===s.value,onMousemove:e=>s.value=t,onClick:t=>p(e)},[X(`span`,XC,B(e.kind),1),X(`span`,ZC,B(e.name),1),e.parent?(q(),J(`span`,QC,`in `+B(e.parent),1)):Q(``,!0),X(`span`,$C,B(e.startLine),1)],42,YC))),128))]))],64))],512)):Q(``,!0)}}),[[`__scopeId`,`data-v-6a76fb9b`]]),tw={class:`tree-col`},nw={class:`tree-toolbar`,role:`toolbar`,"aria-label":`Explorer filters`},rw=[`aria-pressed`,`title`],iw=[`aria-pressed`,`title`],aw=[`aria-pressed`,`title`],ow=[`disabled`],sw={class:`tree-scroll`},cw={key:0,class:`panel-note`},lw={key:1,class:`panel-note view-error`,"data-testid":`tree-error`},uw={key:2,class:`panel-note`,"data-testid":`tree-empty`},dw=[`aria-level`,`aria-expanded`,`aria-selected`,`aria-busy`,`tabindex`,`title`,`onClick`,`onKeydown`],fw={class:`chevron`,"aria-hidden":`true`},pw={key:0,class:`changes-dot`,title:`Contains changes`},mw={key:1,class:`staged-dot`,title:`Staged`},hw={key:2,class:`status-letter`,"data-testid":`status-letter`},gw={key:4,class:`panel-note view-error`,"data-testid":`tree-error`},_w=sf(gr({__name:`ExplorerView`,setup(e){let t=Vl(),n=ql(),r=Hl(),i=V(null);W(()=>n.outlineRequest,e=>{e!==0&&(i.value?.openPopover(),r.loadSymbols())});let{rows:a,rootLoading:o,error:s,showHidden:c,showIgnored:l,changedOnly:u,selectedPath:d,file:f,fileLoading:p,fileError:m}=Fs(r),h=V(null);async function g(){await r.ensureRoot()}async function _(e){await r.toggleDir(e)}async function v(e){await r.openFile(e)}jr(()=>{g()}),W(()=>t.repoId,()=>{g()});function y(e){b.value=e.entry.path,su({view:`explorer`}),e.entry.type===`dir`?_(e.entry.path):v(e.entry.path)}let b=V(null),x=$(()=>{for(let e of[b.value,d.value]){if(e===null)continue;let t=a.value.findIndex(t=>t.entry.path===e);if(t!==-1)return t}return 0});function S(e){let t=a.value[e];t&&(b.value=t.entry.path,On(()=>{h.value?.querySelectorAll(`.tree-row`)[e]?.focus()}))}function C(e){return a.value.findIndex(t=>t.entry.path===e.entry.path)}function w(e,t){let n=C(e);n!==-1&&S(Math.min(a.value.length-1,Math.max(0,n+t)))}function T(e){if(e.entry.type!==`dir`)return;if(!e.isExpanded){_(e.entry.path);return}let t=C(e);if(t===-1)return;let n=a.value[t+1];n&&n.depth>e.depth&&S(t+1)}function E(e){if(e.entry.type===`dir`&&e.isExpanded){r.collapseDir(e.entry.path);return}let t=e.entry.path;for(let e=t.lastIndexOf(`/`);e!==-1;e=t.lastIndexOf(`/`)){t=t.slice(0,e);let n=a.value.findIndex(e=>e.entry.path===t);if(n!==-1){S(n);return}}}W(()=>a.value,()=>{let e=h.value?.contains(document.activeElement)??!1;On(()=>{let t=h.value;if(!e||!t||t.contains(document.activeElement))return;let n=x.value,r=a.value[n];r&&(b.value=r.entry.path,t.querySelectorAll(`.tree-row`)[n]?.focus())})}),W(d,()=>{On(()=>{h.value?.querySelector(`.tree-row.selected`)?.scrollIntoView({block:`nearest`})})});function D(e){return e.entry.gitStatus?`st-${e.entry.gitStatus}`:null}let O=Su(),k=V(null),A=Gm({container:k,isRow:O,row:{pref:`explorerTop`,defaultRatio:.34,min:gl,max:_l}}),j=V(null),M=Ym(O,j,`File content`),N=qm(O,(e,t)=>w(t,e));return(e,t)=>(q(),J(`div`,{ref_key:`containerEl`,ref:k,class:z([`explorer`,{portrait:U(O)}]),style:le(U(O)?{"--explorer-top":`${(U(A).rowRatio.value*100).toFixed(2)}%`}:void 0)},[X(`aside`,tw,[(q(),Y(lr,{defer:``,to:`#view-toolbar-slot`,disabled:!U(O)},[X(`div`,nw,[X(`button`,{class:`tool-toggle mono`,"data-testid":`toggle-hidden`,"aria-pressed":U(c),title:U(c)?`Dotfiles are shown. Click to hide them`:`Dotfiles are hidden. Click to show them`,onClick:t[0]||=e=>U(r).setShowHidden(!U(c))},` dotfiles `,8,rw),X(`button`,{class:`tool-toggle mono`,"data-testid":`toggle-ignored`,"aria-pressed":U(l),title:U(l)?`Gitignored files are shown. Click to hide them`:`Gitignored files are hidden. Click to show them`,onClick:t[1]||=e=>U(r).setShowIgnored(!U(l))},` ignored `,8,iw),X(`button`,{class:`tool-toggle mono`,"data-testid":`toggle-changed`,"aria-pressed":U(u),title:U(u)?`Showing only files with changes. Click to show every file`:`Showing every file. Click to show only files with changes`,onClick:t[2]||=e=>U(r).setChangedOnly(!U(u))},` changed `,8,aw),X(`button`,{class:`tool-refresh mono`,"data-testid":`tree-refresh`,"aria-label":`Reload the tree`,title:`Reload the tree`,disabled:U(o),onClick:t[3]||=e=>U(r).refresh()},` ↻ `,8,ow)])],8,[`disabled`])),X(`div`,sw,[U(o)&&U(a).length===0?(q(),J(`p`,cw,`Loading tree…`)):U(s)&&U(a).length===0?(q(),J(`p`,lw,B(U(s)),1)):U(a).length===0?(q(),J(`p`,uw,B(U(u)?`No changed files.`:`Empty repository.`),1)):(q(),J(`div`,{key:3,ref_key:`treeEl`,ref:h,class:`tree mono`,role:`tree`,"aria-label":`Repository files`},[(q(!0),J(K,null,G(U(a),(e,n)=>(q(),J(K,{key:e.entry.path},[X(`div`,{class:z([`tree-row list-row`,[D(e),{selected:e.entry.path===U(d)}]]),role:`treeitem`,"aria-level":e.depth+1,"aria-expanded":e.entry.type===`dir`?e.isExpanded:void 0,"aria-selected":e.entry.path===U(d),"aria-busy":e.isLoading||void 0,tabindex:n===x.value?0:-1,title:e.entry.path,onClick:t=>y(e),onKeydown:[Xo(Jo(t=>w(e,1),[`prevent`]),[`down`]),Xo(Jo(t=>w(e,-1),[`prevent`]),[`up`]),Xo(Jo(t=>T(e),[`prevent`]),[`right`]),Xo(Jo(t=>E(e),[`prevent`]),[`left`]),Xo(Jo(t=>y(e),[`prevent`]),[`enter`]),Xo(Jo(t=>y(e),[`prevent`]),[`space`]),t[4]||=Xo(Jo(e=>S(0),[`prevent`]),[`home`]),t[5]||=Xo(Jo(e=>S(U(a).length-1),[`prevent`]),[`end`]),t=>U(N)(t,e)]},[(q(!0),J(K,null,G(e.depth,e=>(q(),J(`span`,{key:e,class:`guide`,"aria-hidden":`true`}))),128)),X(`span`,fw,B(e.entry.type===`dir`?e.isExpanded?`▾`:`▸`:``),1),X(`span`,{class:z([`name`,{dir:e.entry.type===`dir`}])},B(e.displayName),3),e.entry.type===`dir`&&e.entry.hasChanges?(q(),J(`span`,pw,`●`)):Q(``,!0),e.entry.type===`file`&&e.entry.staged?(q(),J(`span`,mw,`●`)):Q(``,!0),e.entry.type===`file`&&e.entry.gitStatus?(q(),J(`span`,hw,B(U($l)(e.entry.gitStatus)),1)):Q(``,!0)],42,dw),e.isExpanded&&e.isLoading?(q(),J(`div`,{key:0,class:`tree-loading mono`,role:`presentation`,"data-testid":`dir-loading`,style:le({paddingLeft:`${(e.depth+1)*1.25+1.75}ch`})},` Loading… `,4)):Q(``,!0)],64))),128))],512)),U(s)&&U(a).length>0?(q(),J(`p`,gw,B(U(s)),1)):Q(``,!0)])]),U(O)?(q(),Y(Bv,{key:0,split:U(A),label:`Resize file tree`},null,8,[`split`])):Q(``,!0),X(`section`,Oa({ref_key:`payloadEl`,ref:j,class:`content-col`},U(M)),[ba(ew,{ref_key:`outlineEl`,ref:i},null,512),ba(BC,{path:U(d),file:U(f),loading:U(p),error:U(m),wrap:U(n).wrapEnabled},null,8,[`path`,`file`,`loading`,`error`,`wrap`])],16)],6))}}),[[`__scopeId`,`data-v-48316821`]]),vw=`pr:`;function yw(e,t){return`${e}\n${t}`}function bw(e){return`${vw}${e.repo}#${e.number}`}function xw(e){let t=e.lastIndexOf(`
|
|
21
|
-
`);return t===-1?null:{root:e.slice(0,t),branch:e.slice(t+1)}}function Sw(e,t,n){return e.find(e=>e.headRefName===n&&t.includes(e.repoKey))??null}function Cw(e){if(e.state===`open`)return null;let t=Date.parse(e.mergedAt??e.closedAt??``);return Number.isNaN(t)?null:t}function ww(e,t){if(e.state===`open`)return!0;let n=Cw(e);return n!==null&&t-n<=6048e5}function Tw(e){return e.status===`ok`&&!e.capped}function Ew(e,t){let n=Cw(e);return n!==null&&t-n>6048e5}function Dw(e,t,n){return(t?.tip??n?.head??null)===e.headRefOid}function Ow(e){let t=Date.parse(e);return Number.isNaN(t)?null:t}function kw(e){let t=e.indexOf(`/`);return t===-1?e:e.slice(t+1)}function Aw(e){return e.branch===null?!1:e.base===null?!e.isMain:e.branch!==kw(e.base)}function jw(e){return e!==null&&e.top!==null&&e.top.trim()!==``}function Mw(e){return jw(e)||e?.hasSuggested===!0||e?.hasAi===!0}function Nw(e,t){if(t!==null){if(t.state!==`open`)return t.state;if(t.isDraft)return`draft`;let e=t.progress?.decision??null;return e===`changes-requested`?`changes`:e===`approved`?`approved`:`review`}return e===`branch-gone`?`gone`:e===`pushed-no-pr`?`pushed`:`local`}function Pw(e){let t=e.filter(e=>e.state===`open`),n=new Map;for(let e of t){let t=`${e.repoKey}\n${e.headRefName}`;n.has(t)||n.set(t,e)}let r=e=>n.get(`${e.repoKey}\n${e.baseRefName}`)??null,i=new Map,a=new Map;for(let e of t){let t=new Set([e]),n=e;for(let e=r(n);e!==null&&!t.has(e);e=r(n))t.add(e),n=e;i.set(e,{depth:t.size,root:n}),a.set(n,(a.get(n)??0)+1)}let o=new Map;for(let[e,{depth:t,root:n}]of i){let r=a.get(n)??1;r>1&&o.set(e,{position:t,size:r,root:n.headRefName})}return o}function Fw(e,t){if(e===null||e.state!==`open`)return[];let n=[],r=e.progress;return t!==null&&e.author===t&&r!==null&&r.decision===`changes-requested`&&r.changesRequestedBy.some(e=>!r.requestedReviewers.includes(e))&&n.push(`changes-requested`),e.reviewRequested&&n.push(`review-requested`),n}function Iw(e,t,n){let r=[],i=(e,t)=>{e!==null&&r.push({at:e,kind:t,author:null,other:!1})};i(e.edited,`edited`),i(e.git,`git`),i(e.draft,`draft`);let a=t?.state===`open`?Ow(t.progress?.headCommittedAt??``):null;t!==null&&a!==null&&r.push({at:a,kind:`head-commit`,author:t.author,other:n!==null&&t.author!==null&&t.author!==n});let o=t?.progress?.events[0],s=o===void 0?null:Ow(o.at);o!==void 0&&s!==null&&r.push({at:s,kind:o.kind,author:o.author,other:n!==null&&o.author!==n});let c=t===null?null:Cw(t);t!==null&&t.state!==`open`&&c!==null&&r.push({at:c,kind:t.state,author:null,other:!1});let l=null;for(let e of r)(l===null||e.at>l.at)&&(l=e);return l}function Lw(e){let t=null;for(let n of e.worktrees)if(!n.isBare){if(n.isMain)return n;(t===null||(n.lastActivity??-1/0)>(t.lastActivity??-1/0))&&(t=n)}return t}function Rw(e){let t=jw(e.draft)?e.draft?.top??``:null;return{uncommitted:e.worktree?.uncommitted??0,unpushed:e.branchFact?.unpushed??0,ahead:e.worktree?.aheadOfBase??0,base:e.worktree?.base??null,draft:t!==null,placeholders:t===null?0:Ub(t),adoptedUnedited:t!==null&&(e.draft?.adoptedUnedited??!1),bodyDiffers:t!==null&&e.pr?.state===`open`&&e.pr.body!==null&&Xb(e.pr.body,t)}}function zw(e,t){return e.pr!==null&&!e.leftover?e.pr.state===`open`?`work`:`done`:Mw(e.draft)||e.tracked?`work`:e.worktree===null?null:t.uncommitted>0||t.ahead>0||e.kind===`branch`&&(t.unpushed>0||Aw(e.worktree))?`candidates`:null}function Bw(e){return e.state===`open`?e.isDraft?`pr-draft`:`pr-open`:e.state}function Vw(e,t){if(e.pr!==null)return Bw(e.pr);if(e.gone)return`branch-gone`;let n=e.branchFact?.remoteCopy??!1;return n&&t.unpushed===0?`pushed-no-pr`:t.unpushed>0||!n&&(t.ahead>0||e.worktree===null)?`not-pushed`:t.uncommitted>0?`uncommitted`:`empty`}function Hw(e){if(e.worktree!==null)return{path:e.worktree.path,head:null};if(e.gone||e.branch===null)return null;let t=Lw(e.repo);return t===null?null:{path:t.path,head:e.branch}}function Uw(e,t){let n=+(t.uncommitted>0);return e.kind===`detached`?`${e.worktree?.head??``}|${n}`:`${e.branchFact?.tip??e.worktree?.head??``}|${n}|${e.draft?.mtime??0}`}function Ww(e,t){let n=Rw(e),r=zw(e,n);if(r===null)return null;let i=Vw(e,n),a={edited:e.worktree?.changedAt??null,git:e.worktree?.lastActivity??null,draft:e.draft?.mtime??null},o=Iw(a,e.pr,t.viewer);return{key:e.key,kind:e.kind,section:r,repoRoot:e.repo.root,repoName:e.repo.name,worktreePath:e.worktree?.path??null,branch:e.branch,state:i,facts:n,pr:e.pr,note:r===`done`&&e.worktree!==null?`worktree-on-disk`:null,open:Hw(e),stage:Nw(i,e.pr),stack:e.pr===null?null:t.stacks.get(e.pr)??null,attention:Fw(e.pr,t.viewer),lastActivity:o,times:a,activity:o?.at??null,fingerprint:Uw(e,n),tracked:e.tracked}}function Gw(e,t){let{shown:n,marks:r}=t,i=new Set;for(let t of e.worktrees)!t.isBare&&t.branch!==null&&i.add(t.branch);for(let t of e.drafts)i.add(t.branch);for(let t of e.branches)Sw(n,e.identities,t.name)!==null&&i.add(t.name);for(let t of Object.keys(r.tracked)){let n=xw(t);n!==null&&n.root===e.root&&i.add(n.branch)}return i}function Kw(e,t,n){let{repo:r}=e,{marks:i,now:a}=n,o=yw(r.root,t),s=e.worktrees.find(e=>e.branch===t)??null,c=e.branches.get(t)??null,l=c===null&&s===null&&!r.branchesCapped,u=Sw(n.prs,r.identities,t),d=u!==null&&Ew(u,a)&&(l||Dw(u,c,s)),f=s===null||s.uncommitted===0;if(d&&f&&n.canFinish)return null;let p=d&&(s?.uncommitted??0)>0;return Ww({key:o,kind:`branch`,repo:r,worktree:s,branch:t,branchFact:c,draft:e.drafts.get(t)??null,pr:u!==null&&(ww(u,a)||p)?u:null,leftover:p,gone:l,tracked:i.tracked[o]!==void 0},n)}function qw(e,t){let{marks:n}=t,r=e.worktrees.filter(e=>!e.isBare),i={repo:e,worktrees:r,branches:new Map(e.branches.map(e=>[e.name,e])),drafts:new Map(e.drafts.map(e=>[e.branch,e]))},a=[];for(let n of Gw(e,t)){let e=Kw(i,n,t);e!==null&&a.push(e)}for(let i of r){if(i.branch!==null)continue;let r=Ww({key:i.path,kind:`detached`,repo:e,worktree:i,branch:null,branchFact:null,draft:null,pr:null,leftover:!1,gone:!1,tracked:n.tracked[i.path]!==void 0},t);r!==null&&a.push(r)}return a}var Jw={uncommitted:0,unpushed:0,ahead:0,base:null,draft:!1,placeholders:0,adoptedUnedited:!1,bodyDiffers:!1},Yw={edited:null,git:null,draft:null};function Xw(e,t,n){let{marks:r}=n,i=bw(e),a=r.tracked[i]!==void 0,o=Bw(e),s=Iw(Yw,e,n.viewer),c=t.find(t=>t.identities.includes(e.repoKey))??null;return{key:i,kind:`pr`,section:e.state===`open`?`work`:`done`,repoRoot:c?.root??null,repoName:c?.name??e.repo,worktreePath:null,branch:e.headRefName,state:o,facts:{...Jw},pr:e,note:c===null?`no-local-clone`:`no-local-branch`,open:null,stage:Nw(o,e),stack:n.stacks.get(e)??null,attention:Fw(e,n.viewer),lastActivity:s,times:{...Yw},activity:s?.at??null,fingerprint:e.updatedAt,tracked:a}}function Zw(e,t){return e.key===t.key?0:e.key<t.key?-1:1}function Qw(e,t){return e.activity===t.activity?Zw(e,t):e.activity===null?1:t.activity===null?-1:t.activity-e.activity}function $w(e,t){return e.activity!==null&&t-e.activity<=12096e5}function eT(e,t){let n=e.pr===null?null:Cw(e.pr),r=t.pr===null?null:Cw(t.pr);return n===r?Zw(e,t):n===null?1:r===null?-1:r-n}function tT(e,t,n){let r=new Set(t.map(e=>e.key)),i=Tw(n),a=new Set;for(let t of[...Object.keys(e.tracked),...Object.keys(e.dismissed)])r.has(t)||(i||!t.startsWith(vw))&&a.add(t);return[...a].sort()}function nT(e,t,n,r,i=!1){let a=new Set,o=e.filter(e=>!a.has(e.root)&&(a.add(e.root),!0)),s=t.prs.filter(e=>!e.reviewRequested),c={prs:s,shown:s.filter(e=>ww(e,r)),marks:n,now:r,canFinish:Tw(t),viewer:t.viewer,stacks:Pw(t.prs)},l=o.flatMap(e=>qw(e,c)),u=new Set(l.map(e=>e.pr).filter(e=>e!==null));for(let e of c.shown)u.has(e)||l.push(Xw(e,o,c));for(let e of t.prs)e.reviewRequested&&e.state===`open`&&l.push(Xw(e,o,c));let d={work:[],candidates:[],older:[],done:[],dismissed:[],staleMarks:i?tT(n,l,t):[]};for(let e of l)n.dismissed[e.key]?.fingerprint===e.fingerprint?d.dismissed.push(e):e.section===`candidates`&&!$w(e,r)?d.older.push(e):d[e.section].push(e);return d.work.sort(Qw),d.candidates.sort(Qw),d.older.sort(Qw),d.dismissed.sort(Qw),d.done.sort(eT),d}var rT=3e5,iT={status:`never`,message:null,checkedAt:null,viewer:null,prs:[],capped:!1};async function aT(e,t,n){let r=0;async function i(){for(;r<e.length;){let t=e[r];r+=1,await n(t)}}await Promise.all(Array.from({length:Math.min(t,e.length)},i))}function oT(e){return e.roots.flatMap(e=>e.error===null?e.capped?[{path:e.path,message:`more repos than listed`}]:[]:[{path:e.path,message:e.error}])}function sT(e,t){let n=e.findIndex(e=>e.root===t.root);if(n===-1)return[...e,t];let r=[...e];return r[n]=t,r}var cT=Ps(`work`,()=>{let e=new Xs,t=H([]),n=H({total:0,done:0,running:!1}),r=H(!1),i=H([]),a=H([]),o=H(!1),s=H(null),c=H(!1),l=H({tracked:{},dismissed:{}}),u=H(null),d=H(Date.now()),f=H(null),p=0,m=$(()=>r.value&&o.value&&i.value.length===0&&!c.value&&s.value!==null&&s.value.checkedAt!==null),h=$(()=>nT(t.value,s.value??iT,l.value,d.value,m.value));function g(e,t,n){Zs(e,t),u.value=`${n}: ${Rs(t)}`}async function _(){try{l.value=await e.workMarks()}catch(e){g(`load Work marks`,e,`Could not load marks`)}}function v(e){return e===null||e.status===`never`||e.checkedAt===null||Date.now()-e.checkedAt>rT}async function y(){c.value=!0;try{let t=await e.workPrs();s.value=t,v(t)&&(s.value=await e.refreshWorkPrs())}catch(e){g(`load PRs`,e,`Could not load PRs`)}finally{c.value=!1}}async function b(){c.value=!0;try{s.value=await e.refreshWorkPrs()}catch(e){g(`check PRs`,e,`Could not check PRs`)}finally{c.value=!1}}async function x(r,a,o){try{let n=await e.workRepo(r);if(a!==p||o.has(n.root))return;o.set(n.root,n),t.value=sT(t.value,n)}catch(e){if(a!==p)return;Qs(`scan repo for the Work page`,e,{path:r}),i.value=[...i.value,{path:r,message:Rs(e)}]}finally{a===p&&(n.value={...n.value,done:n.value.done+1})}}async function S(){p+=1;let s=p;r.value=!1,i.value=[],a.value=[],o.value=!1,n.value={total:0,done:0,running:!0};let c,l;try{let[t,n]=await Promise.all([e.discovered(),e.listRepos()]);c=t,l=n.map(e=>e.path)}catch(e){if(s!==p)return;g(`list repos for the Work page`,e,`Could not list repos`),n.value={...n.value,running:!1};return}if(s!==p)return;a.value=oT(c),o.value=c.roots.every(e=>e.error===null&&!e.capped&&e.repos.length>0);let u=[...new Set(c.roots.flatMap(e=>e.repos.map(e=>e.path)))],d=new Map;if(n.value={total:u.length,done:0,running:!0},await aT(u,4,e=>x(e,s,d)),s!==p)return;let m=new Set(u);for(let e of d.values())for(let t of e.worktrees)m.add(t.path);let h=[...new Set(l)].filter(e=>!m.has(e));n.value={...n.value,total:u.length+h.length},await aT(h,4,e=>x(e,s,d)),s===p&&(t.value=[...d.values()],n.value={...n.value,running:!1},r.value=!0,f.value=Date.now())}async function C(){d.value=Date.now(),u.value=null,await Promise.all([_(),y(),S()])}async function w(){let e=Date.now(),t=!n.value.running&&(f.value===null||e-f.value>6e4),r=!c.value&&v(s.value);(t||r)&&(d.value=e,await Promise.all([r?b():null,t?S():null]))}async function T(){d.value=Date.now(),u.value=null,await Promise.all([b(),S()])}async function E(t,n,r){let i=h.value.staleMarks.filter(e=>e!==t),a={key:t,action:n};r!==void 0&&(a.fingerprint=r),i.length>0&&(a.prune=i);try{l.value=await e.putWorkMark(a)}catch(e){g(`save a Work mark`,e,`Could not save`)}}return{repos:t,scan:n,scanFinished:r,repoErrors:i,rootErrors:a,prs:s,prsLoading:c,marks:l,error:u,now:d,scannedAt:f,complete:m,classification:h,load:C,catchUp:w,refresh:T,runScan:S,mark:E}}),lT=[`data-icon`],uT=[`d`],dT=sf(gr({__name:`WorkIcon`,props:{name:{}},setup(e){let t={stack:`M2.5 5.5 8 2.5l5.5 3L8 8.5ZM2.5 8.5 8 11.5l5.5-3M2.5 11 8 14l5.5-3`,check:`m3 8.5 3 3 7-7`,cross:`m4 4 8 8m0-8-8 8`,pending:`M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z`,comment:`M2.5 3.5h11v7.5h-6l-3 2.5V11h-2Z`,approved:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2Zm-2.75 6.25 1.75 1.75 3.75-3.75`,changes:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2ZM8 5v4.5M5.75 7.25h4.5M5.75 11h4.5`,waiting:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2Zm0 3v3.25l2 1.25`,pencil:`m10.5 2.5 3 3-8 8h-3v-3Z`,compare:`M2.5 5.5h10L10 3M13.5 10.5h-10L6 13`,chevron:`m6 3.5 4.5 4.5L6 12.5`,differs:`M3 6h10M3 10h10m-2.5-7-5 10`,alert:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2ZM8 5v3.75m0 2.25v.25`,copy:`M5.5 5.5h7.5v8H5.5ZM3 10.5v-8h7.5`},n=e,r=$(()=>t[n.name]);return(t,n)=>(q(),J(`svg`,{class:`work-icon`,viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`,"data-icon":e.name},[X(`path`,{d:r.value},null,8,uT)],8,lT))}}),[[`__scopeId`,`data-v-a1673a3c`]]),fT={key:0,class:`view-error`,"data-testid":`work-draft-error`},pT={key:2,class:`loading`},mT=sf(gr({__name:`WorkDraftEditor`,props:{path:{},branch:{}},setup(e){let t=e,n=new Xs,r=H(null),i=H(null),a=$b(()=>r.value===null?null:{id:r.value,branch:t.branch}),o=!1;return jr(async()=>{try{let e=await n.openRepo(t.path);if(o){await n.closeRepo(e.id);return}r.value=e.id}catch(e){Zs(`open a repo for its PR draft`,e,{path:t.path}),i.value=`Could not open the repo: ${Rs(e)}`}}),Fr(()=>{o=!0;let e=r.value;(async()=>{if(await a.dispose(),e!==null)try{await n.closeRepo(e)}catch(e){Zs(`release a repo after its PR draft`,e,{path:t.path})}})()}),(e,t)=>i.value?(q(),J(`p`,fT,B(i.value),1)):r.value?(q(),Y(NS,{key:1,session:U(a)},null,8,[`session`])):(q(),J(`p`,pT,`Opening the draft…`))}}),[[`__scopeId`,`data-v-f26ea9b4`]]),hT=1500;function gT(){let e=H(null),t=null;function n(n){e.value=n,t!==null&&clearTimeout(t),t=setTimeout(()=>e.value=null,hT)}async function r(e){try{await navigator.clipboard.writeText(e),n(`copied`)}catch(e){Zs(`copy to the clipboard`,e),n(`failed`)}}return Fr(()=>{t!==null&&clearTimeout(t)}),{state:e,copy:r}}var _T={class:`block events`},vT={key:0,class:`none`},yT={key:1,class:`event-list`},bT=[`data-tip`],xT={class:`text`},ST={class:`block facts`},CT={class:`fact-list`},wT=[`data-tip`],TT={class:`actions`},ET=[`href`],DT={key:0,class:`block draft`},OT=8,kT=sf(gr({__name:`WorkRowDetail`,props:{item:{},now:{},dismissed:{type:Boolean}},emits:[`open`,`mark`],setup(e,{emit:t}){let n=e,r=t,i=cT(),a=$(()=>xx(n.item,i.prs?.viewer??null).slice(0,OT)),o=$(()=>wx(n.item)),s=$(()=>kx(n.item)),{state:c,copy:l}=gT(),u=$(()=>c.value===`copied`?`Copied`:c.value===`failed`?`Could not copy`:`Copy for a session`),d=$(()=>{let{item:e}=n;return e.kind!==`branch`||e.branch===null||e.open===null?null:{path:e.open.path,branch:e.branch}});return(t,n)=>(q(),J(`div`,{class:`detail`,"data-testid":`work-detail`,onClick:n[5]||=Jo(()=>{},[`stop`])},[X(`section`,_T,[n[6]||=X(`h3`,{class:`eyebrow`},`Activity`,-1),a.value.length===0?(q(),J(`p`,vT,`Nothing recorded.`)):(q(),J(`ol`,yT,[(q(!0),J(K,null,G(a.value,(t,n)=>(q(),J(`li`,{key:n,class:z([`event`,{other:t.other}])},[X(`span`,{class:`at`,"data-tip":U(fx)(t.at)},B(U(dx)(t.at,e.now)),9,bT),X(`span`,xT,B(t.text),1)],2))),128))]))]),X(`section`,ST,[n[7]||=X(`h3`,{class:`eyebrow`},`Facts`,-1),(q(!0),J(K,null,G(s.value,e=>(q(),J(`p`,{key:e,class:`wants`,"data-testid":`work-detail-attention`},B(e),1))),128)),X(`dl`,CT,[(q(!0),J(K,null,G(o.value,([e,t])=>(q(),J(K,{key:e},[X(`dt`,null,B(e),1),X(`dd`,{"data-tip":t},B(t),9,wT)],64))),128))]),X(`div`,TT,[e.item.open?(q(),J(`button`,{key:0,class:`action`,onClick:n[0]||=e=>r(`open`)},`Open in Compare`)):Q(``,!0),X(`button`,{class:`action`,"data-testid":`work-detail-copy`,"data-tip":`The PR, repo, local clone and branch, to paste into a session`,onClick:n[1]||=t=>U(l)(U(Ax)(e.item))},B(u.value),1),e.item.pr?(q(),J(`a`,{key:1,class:`action`,href:e.item.pr.url,target:`_blank`,rel:`noopener noreferrer`},`Open #`+B(e.item.pr.number)+` on GitHub`,9,ET)):Q(``,!0),e.item.tracked?(q(),J(`button`,{key:2,class:`action`,"data-testid":`work-drop`,onClick:n[2]||=e=>r(`mark`,`drop`)},` Stop tracking `)):Q(``,!0),e.dismissed?(q(),J(`button`,{key:3,class:`action`,"data-testid":`work-detail-undismiss`,onClick:n[3]||=e=>r(`mark`,`undismiss`)},` Show again `)):(q(),J(`button`,{key:4,class:`action`,"data-testid":`work-dismiss`,"data-tip":`Hide this until something about it changes`,onClick:n[4]||=e=>r(`mark`,`dismiss`)},` Dismiss `))])]),d.value?(q(),J(`section`,DT,[ba(mT,{path:d.value.path,branch:d.value.branch},null,8,[`path`,`branch`])])):Q(``,!0)]))}}),[[`__scopeId`,`data-v-d98ae195`]]),AT=[`data-stage`],jT=[`data-tip`],MT={class:`pips`,"aria-hidden":`true`},NT={class:`sr-only`},PT=[`data-tip`,`aria-label`],FT=[`data-tip`],IT={class:`branch mono`},LT=[`data-tip`],RT={key:1,class:`by`,"data-testid":`work-by`},zT={key:2,class:`pr-title`},BT=[`data-tip`],VT={class:`mono`},HT={class:`cell pr`},UT=[`href`,`data-tip`],WT=[`data-tip`],GT={key:1,class:`threads`},KT={class:`mono`},qT=[`data-tip`],JT={class:`cell local mono`,"data-testid":`work-local`},YT=[`data-tip`],XT=[`data-tip`],ZT=[`data-tip`],QT=[`data-tip`],$T={key:1,class:`placeholders mono`},eE=[`data-tip`],tE=[`data-tip`],nE={class:`cell act`},rE=[`data-tip`],iE=[`data-tip`,`aria-label`],aE=[`aria-expanded`,`aria-label`],oE=sf(gr({__name:`WorkRow`,props:{item:{},now:{},dismissed:{type:Boolean}},emits:[`open`,`mark`],setup(e,{emit:t}){let n=e,r=t,i=V(!1);function a(){i.value=!i.value}let o=$(()=>gx[n.item.stage]),s=cT(),c=$(()=>Ox(n.item,s.prs?.viewer??null)),l=$(()=>{let e=n.item.lastActivity;return e===null?void 0:`${bx(e)}\n${fx(e.at)}`}),u=$(()=>kx(n.item).join(`
|
|
22
|
-
`)),d=$(()=>n.item.pr?.reviewRequested?n.item.pr.author:null),{state:f,copy:p}=
|
|
23
|
-
`)});return(t,n)=>(q(),J(`li`,{class:z([`work-row`,{expanded:i.value,dim:e.dismissed}]),"data-stage":e.item.stage,"data-testid":`work-row`},[X(`div`,{class:`line`,"data-testid":`work-row-line`,onClick:a},[X(`span`,{class:`cell prog`,"data-tip":U(hx)[e.item.stage],"data-testid":`work-stage`},[X(`span`,MT,[(q(),J(K,null,G(5,e=>X(`i`,{key:e,class:z({on:e<=o.value})},null,2)),64))]),X(`span`,NT,B(U(hx)[e.item.stage]),1),e.item.attention.length>0?(q(),J(`span`,{key:0,class:`alert`,"data-testid":`work-attention`,"data-tip":u.value,"aria-label":u.value},[ba(dT,{name:`alert`})],8,PT)):Q(``,!0)],8,jT),X(`span`,{class:`cell name`,"data-tip":E.value},[X(`span`,IT,B(e.item.branch??`detached`),1),y.value?(q(),J(`span`,{key:0,class:`conflicts`,"data-testid":`work-conflicts`,"data-tip":`GitHub says this branch has merge conflicts with ${e.item.pr?.baseRefName}`},`conflicts`,8,LT)):Q(``,!0),d.value?(q(),J(`span`,RT,`by `+B(d.value),1)):Q(``,!0),e.item.pr?(q(),J(`span`,zT,B(e.item.pr.title),1)):Q(``,!0)],8,FT),X(`span`,{class:`cell stack`,"data-tip":x.value,"data-testid":`work-stack`},[e.item.stack?(q(),J(K,{key:0},[ba(dT,{name:`stack`}),X(`span`,VT,B(e.item.stack.position)+`/`+B(e.item.stack.size),1)],64)):Q(``,!0)],8,BT),X(`span`,HT,[e.item.pr?(q(),J(`a`,{key:0,class:`pr-link mono`,"data-testid":`work-pr-link`,href:e.item.pr.url,target:`_blank`,rel:`noopener noreferrer`,"data-tip":`Open #${e.item.pr.number} on GitHub`,onClick:n[0]||=Jo(()=>{},[`stop`])},`#`+B(e.item.pr.number),9,UT)):Q(``,!0)]),X(`span`,{class:`cell review`,"data-tip":g.value,"data-testid":`work-review`},[_.value?(q(),Y(dT,{key:0,name:_.value,class:z(_.value)},null,8,[`name`,`class`])):Q(``,!0),h.value&&h.value.unresolvedThreads>0?(q(),J(`span`,GT,[ba(dT,{name:`comment`}),X(`span`,KT,B(h.value.unresolvedThreads),1)])):Q(``,!0)],8,WT),X(`span`,{class:`cell checks`,"data-tip":v.value,"data-testid":`work-checks`},[b.value?(q(),Y(dT,{key:0,name:b.value,class:z(b.value)},null,8,[`name`,`class`])):Q(``,!0)],8,qT),X(`span`,JT,[e.item.facts.uncommitted>0?(q(),J(`span`,{key:0,class:`uncommitted`,"data-tip":`${e.item.facts.uncommitted} uncommitted`},`●`+B(e.item.facts.uncommitted),9,YT)):Q(``,!0),e.item.facts.unpushed>0?(q(),J(`span`,{key:1,class:`unpushed`,"data-tip":`${e.item.facts.unpushed} unpushed`},`↑`+B(e.item.facts.unpushed),9,XT)):Q(``,!0),e.item.note?(q(),J(`span`,{key:2,class:`note`,"data-tip":U(Gx)[e.item.note]},B(U(Wx)[e.item.note]),9,ZT)):Q(``,!0)]),X(`span`,{class:`cell draft`,"data-tip":S.value,"data-testid":`work-draft`},[e.item.facts.draft?(q(),Y(dT,{key:0,name:`pencil`,class:z({agent:e.item.facts.adoptedUnedited})},null,8,[`class`])):Q(``,!0),e.item.facts.placeholders>0?(q(),J(`span`,$T,B(`{`)+B(e.item.facts.placeholders)+B(`}`),1)):Q(``,!0),e.item.facts.bodyDiffers?(q(),Y(dT,{key:2,name:`differs`,class:`differs`})):Q(``,!0)],8,QT),X(`span`,{class:z([`cell status`,c.value.turn]),"data-tip":c.value.why||void 0,"data-testid":`work-status`},B(c.value.text),11,eE),X(`span`,{class:z([`cell when`,{recent:w.value}]),"data-tip":l.value,"data-testid":`work-when`},B(C.value?U(dx)(C.value.at,e.now):``),11,tE),X(`span`,nE,[T.value?(q(),J(`button`,{key:0,class:`action`,"data-testid":`work-track`,"data-tip":`Keep this in Work`,onClick:n[1]||=Jo(t=>r(`mark`,e.item,`track`),[`stop`])},` Track `)):Q(``,!0),e.dismissed?(q(),J(`button`,{key:1,class:`action`,"data-testid":`work-undismiss`,onClick:n[2]||=Jo(t=>r(`mark`,e.item,`undismiss`),[`stop`])},` Show `)):Q(``,!0),!e.item.open&&e.item.pr?(q(),J(`button`,{key:2,class:z([`icon-btn`,{done:U(f)===`copied`}]),"data-testid":`work-copy`,"data-tip":m.value,"aria-label":`Copy for a session`,onClick:n[3]||=Jo(t=>U(p)(U(Ax)(e.item)),[`stop`])},[ba(dT,{name:U(f)===`copied`?`check`:`copy`},null,8,[`name`])],10,rE)):Q(``,!0),e.item.open?(q(),J(`button`,{key:3,class:`icon-btn`,"data-testid":`work-compare`,"data-tip":`Open ${e.item.branch??`this worktree`} in Compare`,"aria-label":`Open ${e.item.branch??`this worktree`} in Compare`,onClick:n[4]||=Jo(t=>r(`open`,e.item),[`stop`])},[ba(dT,{name:`compare`})],8,iE)):Q(``,!0),X(`button`,{class:`icon-btn expand`,"data-testid":`work-expand`,"aria-expanded":i.value,"aria-label":i.value?`Close`:`Show activity and draft`,onClick:Jo(a,[`stop`])},[ba(dT,{name:`chevron`})],8,aE)])]),i.value?(q(),Y(kT,{key:0,item:e.item,now:e.now,dismissed:e.dismissed,onOpen:n[5]||=t=>r(`open`,e.item),onMark:n[6]||=t=>r(`mark`,e.item,t)},null,8,[`item`,`now`,`dismissed`])):Q(``,!0)],10,AT))}}),[[`__scopeId`,`data-v-9a0e5bad`]]),sE={class:`work-page`,"data-testid":`work-page`},cE={class:`work-head`},lE={class:`head-text`},uE=[`data-tip`],dE=[`data-tip`],fE={class:`filters`,role:`group`,"aria-label":`Show`},pE=[`aria-pressed`],mE=[`aria-pressed`,`data-testid`,`data-tip`,`onClick`],hE={class:`filter-count`},gE={class:`filters`,role:`group`,"aria-label":`Group`},_E=[`aria-pressed`],vE=[`aria-pressed`],yE=[`disabled`],bE={key:0,class:`page-error view-error`,"data-testid":`work-error`},xE=[`data-tip`],SE=[`data-tip`],CE={key:3,class:`state-block`,"data-testid":`work-no-repos`},wE={class:`state-hint`},TE={key:4,class:`panel-note`,"data-testid":`work-clear`},EE={key:5,class:`panel-note`,"data-testid":`work-within-empty`},DE={key:6,class:`col-heads`,"data-testid":`work-col-heads`},OE=[`aria-sort`,`data-tip`,`onClick`],kE={key:0,class:`sort-mark`,"aria-hidden":`true`},AE={key:1,class:`col-head`},jE=[`open`,`data-testid`,`onToggle`],ME={key:0,class:`eyebrow`},NE={key:1,class:`section-title eyebrow`},PE={class:`section-name`},FE={class:`count`},IE={class:`rows`},LE={key:0,class:`time-head`,"data-testid":`work-time`},RE={class:`time-name`},zE={class:`group-count`},BE={class:`group-name`},VE={class:`group-count`},HE={key:7,class:`work-section dismissed`,"data-testid":`work-dismissed`},UE={class:`eyebrow`},WE={class:`rows`},GE=3e4,KE=sf(gr({__name:`WorkView`,setup(e){let t=ic(),n=Vl(),r=ql(),i=cT(),{openByPath:a}=Jl(),o=V(Date.now()),s=null;function c(){document.visibilityState===`visible`&&(o.value=Date.now(),i.catchUp())}jr(()=>{s=setInterval(()=>o.value=Date.now(),GE),document.addEventListener(`visibilitychange`,c),window.addEventListener(`focus`,c)}),Fr(()=>{s!==null&&clearInterval(s),document.removeEventListener(`visibilitychange`,c),window.removeEventListener(`focus`,c)}),jr(()=>{i.load()});let l={work:`Work`,candidates:`Candidates`,done:`Done`},u=[`work`,`candidates`,`older`,`done`],d=[`work`,`done`,`candidates`,`older`],f=[{label:`Stage`,key:`stage`,order:`how far along: local only first, merged last`},{label:`Branch`,key:`branch`,order:`branch name, A to Z`},{label:`Stack`,key:`stack`,order:`stack, each one bottom layer first`},{label:`PR`,key:`pr`,order:`PR number, lowest first`},{label:`Review`,key:`review`,order:`review: changes requested first, then waiting, then approved`},{label:`CI`,key:`ci`,order:`CI: conflicts first, then failed, running, passed`},{label:`Local`,key:`local`,order:`uncommitted plus unpushed, fewest first`},{label:`Draft`,key:`draft`,order:`PR draft: drafts with {{…}} gaps first, then drafts that differ from GitHub, then the rest`},{label:`Status`,key:`status`,order:`whose move: yours first, then someone else's, then done`},{label:`When`,key:`activity`,order:`last activity, newest first`,right:!0},{label:``,key:null}];function p(e){let t=r.workByRepo?`inside each repo`:`inside each section`;return`Sort by ${e.order} (${t}). Again to reverse, a third time for the default order. Rows with none go last.`}let m=V(null);function h(e){let t=e===`activity`?`desc`:`asc`,n=m.value;n===null||n.key!==e?m.value={key:e,dir:t}:n.dir===t?m.value={key:e,dir:t===`asc`?`desc`:`asc`}:m.value=null}function g(e){if(e!==null&&m.value?.key===e)return m.value.dir===`asc`?`ascending`:`descending`}let _=$(()=>i.classification),v=Xx.filter(e=>e.key!==`older`);function y(e){return v.find(t=>t.key===e)?.within??null}function b(e,t){let n=y(t);return n===null?e:e.filter(e=>mx(e,o.value,n))}let x=$(()=>{let e=u.flatMap(e=>_.value[e]);return Object.fromEntries(v.map(t=>[t.key,b(e,t.key).length]))}),S=V(!1);function C(e){return e===`older`?S.value:!r.workFolded.includes(e)}function w(e,t){let n=t.target.open;e===`older`?S.value=n:r.setWorkFolded(e,!n)}let T=$(()=>{let e=(r.workWithin===null?u:d).map(e=>{let t=b(_.value[e],r.workWithin),n=$x(t,{byRepo:r.workByRepo,byTime:r.workByTime,sort:m.value,now:o.value});return{name:e,title:e===`older`?``:l[e],items:t,lines:n}}).filter(e=>e.items.length>0);return e.some(e=>e.name===`candidates`&&!C(`candidates`))?e.filter(e=>e.name!==`older`):e});function E(e){return`${e} older ${e===1?`candidate`:`candidates`}`}let D=$(()=>i.scan.running||i.prsLoading),O=$(()=>{let e=i.prs;if(e===null)return i.prsLoading?{text:`checking PRs…`,failed:!1}:null;let t=e.checkedAt===null?null:Jx(e.checkedAt,e.viewer,o.value),n=e.checkedAt===null?void 0:fx(e.checkedAt),r=qx(e.status,e.message);if(r!==null)return{text:t===null?r:`${r} · ${t}`,failed:!0,tip:n};if(t===null)return i.prsLoading?{text:`checking PRs…`,failed:!1}:null;let a=e.capped?`${t} · more PRs than listed`:t;return{text:i.prsLoading?`${a} · checking…`:a,failed:!1,tip:n}}),k=$(()=>{if(i.scan.running)return{text:`scanned ${i.scan.done} of ${i.scan.total} repos`};let e=i.scannedAt;return e===null?null:{text:`Repos scanned ${dx(e,o.value)}`,tip:fx(e)}}),A=$(()=>i.scanFinished&&i.repos.length===0&&i.repoErrors.length===0&&i.rootErrors.length===0),j=$(()=>i.scanFinished&&!A.value&&u.every(e=>_.value[e].length===0)&&_.value.dismissed.length===0);async function M(e){let i=e.open;i!==null&&(t.activeRepoPath===i.path||await a(i.path))&&(su({repo:n.repoPath??i.path,view:`compare`}),r.setActiveView(`compare`),await n.setComparePick({head:i.head}))}function N(e,t){i.mark(e.key,t,t===`dismiss`?e.fingerprint:void 0)}return(e,t)=>(q(),J(`div`,sE,[X(`header`,cE,[X(`div`,lE,[t[5]||=X(`h1`,{class:`title`},`Work`,-1),O.value?(q(),J(`p`,{key:0,class:z([`gh-line mono`,{failed:O.value.failed}]),"data-tip":O.value.tip,"data-testid":`gh-line`},B(O.value.text),11,uE)):Q(``,!0),k.value?(q(),J(`p`,{key:1,class:`scan-line mono`,"data-tip":k.value.tip,"data-testid":`scan-line`},B(k.value.text),9,dE)):Q(``,!0)]),X(`div`,fE,[X(`button`,{class:z([`filter chrome-chip`,{on:U(r).workWithin===null}]),"aria-pressed":U(r).workWithin===null,"data-testid":`work-within-all`,onClick:t[0]||=e=>U(r).setWorkWithin(null)},` All `,10,pE),(q(!0),J(K,null,G(U(v),e=>(q(),J(`button`,{key:e.key,class:z([`filter chrome-chip`,{on:U(r).workWithin===e.key}]),"aria-pressed":U(r).workWithin===e.key,"data-testid":`work-within-${e.key}`,"data-tip":`Only what moved in the ${e.label.toLowerCase()}`,onClick:t=>U(r).setWorkWithin(e.key)},[Z(B(e.label)+` `,1),X(`span`,hE,B(x.value[e.key]),1)],10,mE))),128))]),X(`div`,gE,[X(`button`,{class:z([`filter chrome-chip`,{on:U(r).workByRepo}]),"aria-pressed":U(r).workByRepo,"data-testid":`work-by-repo`,"data-tip":`Group the rows under a heading per repo`,onClick:t[1]||=e=>U(r).toggleWorkByRepo()},` By repository `,10,_E),X(`button`,{class:z([`filter chrome-chip`,{on:U(r).workByTime}]),"aria-pressed":U(r).workByTime,"data-testid":`work-by-time`,"data-tip":`Group the rows by their last activity: last day, week, 2 weeks, month, older`,onClick:t[2]||=e=>U(r).toggleWorkByTime()},` By time `,10,vE)]),X(`button`,{class:`refresh-btn chrome-chip`,"data-testid":`work-refresh`,disabled:D.value,"data-tip":`Check GitHub and rescan every repo`,onClick:t[3]||=e=>U(i).refresh()},` Refresh `,8,yE)]),U(i).error?(q(),J(`p`,bE,B(U(i).error),1)):Q(``,!0),U(i).repoErrors.length>0?(q(),J(`p`,{key:1,class:`page-error view-error`,"data-testid":`work-repo-errors`,"data-tip":U(i).repoErrors.map(e=>`${e.path}: ${e.message}`).join(`
|
|
24
|
-
`)},B(U(i).repoErrors.length)+` `+B(U(i).repoErrors.length===1?`repo`:`repos`)+` could not be scanned: `+B(U(i).repoErrors.map(e=>U(Yl)(e.path)).join(`, `)),9,
|
|
25
|
-
`)},B(U(i).rootErrors.length)+` watch `+B(U(i).rootErrors.length===1?`directory`:`directories`)+` not fully scanned: `+B(U(i).rootErrors.map(e=>U(Yl)(e.path)).join(`, `)),9,
|
|
26
|
-
`)}\n}`}function
|
|
21
|
+
`);return t===-1?null:{root:e.slice(0,t),branch:e.slice(t+1)}}function Sw(e,t,n){return e.find(e=>e.headRefName===n&&t.includes(e.repoKey))??null}function Cw(e){if(e.state===`open`)return null;let t=Date.parse(e.mergedAt??e.closedAt??``);return Number.isNaN(t)?null:t}function ww(e,t){if(e.state===`open`)return!0;let n=Cw(e);return n!==null&&t-n<=6048e5}function Tw(e){return e.status===`ok`&&!e.capped}function Ew(e,t){let n=Cw(e);return n!==null&&t-n>6048e5}function Dw(e,t,n){return(t?.tip??n?.head??null)===e.headRefOid}function Ow(e){let t=Date.parse(e);return Number.isNaN(t)?null:t}function kw(e){let t=e.indexOf(`/`);return t===-1?e:e.slice(t+1)}function Aw(e){return e.branch===null?!1:e.base===null?!e.isMain:e.branch!==kw(e.base)}function jw(e){return e!==null&&e.top!==null&&e.top.trim()!==``}function Mw(e){return jw(e)||e?.hasSuggested===!0||e?.hasAi===!0}function Nw(e,t){if(t!==null){if(t.state!==`open`)return t.state;if(t.isDraft)return`draft`;let e=t.progress?.decision??null;return e===`changes-requested`?`changes`:e===`approved`?`approved`:`review`}return e===`branch-gone`?`gone`:e===`pushed-no-pr`?`pushed`:`local`}function Pw(e){return e.pr===null?e.kind===`branch`:e.pr.state===`open`}function Fw(e,t,n){e.has(t)||e.set(t,n)}function Iw(e){let t=new Map,n=new Map;for(let r of e){let e=r.pr;e!==null&&Fw(t,`${r.repoRoot}\n${e.repoKey}\n${e.headRefName}`,r),r.repoRoot!==null&&e?.reviewRequested!==!0&&Fw(n,`${r.repoRoot}\n${r.branch}`,r)}return{byPrHead:t,byBranch:n}}function Lw(e,t){for(let n=1;n<t.length;n++)t[n]!==t[n-1]&&t[n].pr===null&&Fw(e,t[n],t[n-1])}function Rw(e,t){let{byPrHead:n,byBranch:r}=Iw(e),i=new Map;for(let t of e){let e=t.pr,r=e===null?null:`${t.repoRoot}\n${e.repoKey}\n${e.baseRefName}`,a=r===null?void 0:n.get(r);a!==void 0&&a!==t&&i.set(t,a)}for(let e of t)for(let t of e.stacks)Lw(i,t.layers.map(t=>r.get(`${e.root}\n${t}`)).filter(e=>e!==void 0));return i}function zw(e){return e.section===`candidates`&&e.worktreePath===null}function Bw(e,t){let n=e.filter(Pw),r=Rw(n,t),i=new Map,a=new Map;for(let e of n){let t=new Set([e]),n=e;for(let e=r.get(n);e!==void 0&&!t.has(e);e=r.get(n))t.add(e),n=e;i.set(e,{depth:t.size,root:n}),a.set(n,(a.get(n)??0)+1)}let o=new Map;for(let[e,{depth:t,root:n}]of i){let r=a.get(n)??1;r>1&&o.set(e,{position:t,size:r,root:n.branch??n.key})}return o}function Vw(e,t){if(e===null||e.state!==`open`)return[];let n=[],r=e.progress;return t!==null&&e.author===t&&r!==null&&r.decision===`changes-requested`&&r.changesRequestedBy.some(e=>!r.requestedReviewers.includes(e))&&n.push(`changes-requested`),e.reviewRequested&&n.push(`review-requested`),n}function Hw(e,t,n){let r=[],i=(e,t)=>{e!==null&&r.push({at:e,kind:t,author:null,other:!1})};i(e.edited,`edited`),i(e.git,`git`),i(e.draft,`draft`);let a=t?.state===`open`?Ow(t.progress?.headCommittedAt??``):null;t!==null&&a!==null&&r.push({at:a,kind:`head-commit`,author:t.author,other:n!==null&&t.author!==null&&t.author!==n});let o=t?.progress?.events[0],s=o===void 0?null:Ow(o.at);o!==void 0&&s!==null&&r.push({at:s,kind:o.kind,author:o.author,other:n!==null&&o.author!==n});let c=t===null?null:Cw(t);t!==null&&t.state!==`open`&&c!==null&&r.push({at:c,kind:t.state,author:null,other:!1});let l=null;for(let e of r)(l===null||e.at>l.at)&&(l=e);return l}function Uw(e){let t=null;for(let n of e.worktrees)if(!n.isBare){if(n.isMain)return n;(t===null||(n.lastActivity??-1/0)>(t.lastActivity??-1/0))&&(t=n)}return t}function Ww(e){let t=jw(e.draft)?e.draft?.top??``:null;return{uncommitted:e.worktree?.uncommitted??0,unpushed:e.branchFact?.unpushed??0,ahead:e.worktree?.aheadOfBase??0,base:e.worktree?.base??null,draft:t!==null,placeholders:t===null?0:Ub(t),adoptedUnedited:t!==null&&(e.draft?.adoptedUnedited??!1),bodyDiffers:t!==null&&e.pr?.state===`open`&&e.pr.body!==null&&Xb(e.pr.body,t)}}function Gw(e,t){return e.pr!==null&&!e.leftover?e.pr.state===`open`?`work`:`done`:Mw(e.draft)||e.tracked?`work`:e.worktree===null?e.layerHost===null?null:`candidates`:t.uncommitted>0||t.ahead>0||e.kind===`branch`&&(t.unpushed>0||Aw(e.worktree))?`candidates`:null}function Kw(e){return e.state===`open`?e.isDraft?`pr-draft`:`pr-open`:e.state}function qw(e,t){if(e.pr!==null)return Kw(e.pr);if(e.gone)return`branch-gone`;let n=e.branchFact?.remoteCopy??!1;return n&&t.unpushed===0?`pushed-no-pr`:t.unpushed>0||!n&&(t.ahead>0||e.worktree===null)?`not-pushed`:t.uncommitted>0?`uncommitted`:`empty`}function Jw(e){if(e.worktree!==null)return{path:e.worktree.path,head:null};if(e.gone||e.branch===null)return null;let t=e.layerHost??Uw(e.repo);return t===null?null:{path:t.path,head:e.branch}}function Yw(e,t){let n=+(t.uncommitted>0);return e.kind===`detached`?`${e.worktree?.head??``}|${n}`:`${e.branchFact?.tip??e.worktree?.head??``}|${n}|${e.draft?.mtime??0}`}function Xw(e,t){let n=Ww(e),r=Gw(e,n);if(r===null)return null;let i=qw(e,n),a={edited:e.worktree?.changedAt??null,git:e.worktree===null?e.branchFact?.committedAt??null:e.worktree.lastActivity,draft:e.draft?.mtime??null},o=Hw(a,e.pr,t.viewer);return{key:e.key,kind:e.kind,section:r,repoRoot:e.repo.root,repoName:e.repo.name,worktreePath:e.worktree?.path??null,branch:e.branch,state:i,facts:n,pr:e.pr,note:r===`done`&&e.worktree!==null?`worktree-on-disk`:null,open:Jw(e),stage:Nw(i,e.pr),stack:null,attention:Vw(e.pr,t.viewer),lastActivity:o,times:a,activity:o?.at??null,fingerprint:Yw(e,n),tracked:e.tracked}}function Zw(e,t){let{repo:n}=e,{shown:r,marks:i}=t,a=new Set;for(let e of n.worktrees)!e.isBare&&e.branch!==null&&a.add(e.branch);for(let e of n.drafts)a.add(e.branch);for(let e of n.branches)Sw(r,n.identities,e.name)!==null&&a.add(e.name);for(let t of e.layerHosts.keys())e.branches.has(t)&&a.add(t);for(let e of Object.keys(i.tracked)){let t=xw(e);t!==null&&t.root===n.root&&a.add(t.branch)}return a}function Qw(e,t){let n=new Map;for(let r of e.stacks){let e=t.find(e=>e.path===r.worktree);if(e!==void 0)for(let t of r.layers)n.has(t)||n.set(t,e)}return n}function $w(e,t,n){let{repo:r}=e,{marks:i,now:a}=n,o=yw(r.root,t),s=e.worktrees.find(e=>e.branch===t)??null,c=e.branches.get(t)??null,l=c===null&&s===null&&!r.branchesCapped,u=Sw(n.prs,r.identities,t),d=u!==null&&Ew(u,a)&&(l||Dw(u,c,s)),f=s===null||s.uncommitted===0;if(d&&f&&n.canFinish)return null;let p=d&&(s?.uncommitted??0)>0;return Xw({key:o,kind:`branch`,repo:r,worktree:s,branch:t,branchFact:c,draft:e.drafts.get(t)??null,pr:u!==null&&(ww(u,a)||p)?u:null,leftover:p,gone:l,tracked:i.tracked[o]!==void 0,layerHost:e.layerHosts.get(t)??null},n)}function eT(e,t){let{marks:n}=t,r=e.worktrees.filter(e=>!e.isBare),i={repo:e,worktrees:r,branches:new Map(e.branches.map(e=>[e.name,e])),drafts:new Map(e.drafts.map(e=>[e.branch,e])),layerHosts:Qw(e,r)},a=[];for(let e of Zw(i,t)){let n=$w(i,e,t);n!==null&&a.push(n)}for(let i of r){if(i.branch!==null)continue;let r=Xw({key:i.path,kind:`detached`,repo:e,worktree:i,branch:null,branchFact:null,draft:null,pr:null,leftover:!1,gone:!1,tracked:n.tracked[i.path]!==void 0,layerHost:null},t);r!==null&&a.push(r)}return a}var tT={uncommitted:0,unpushed:0,ahead:0,base:null,draft:!1,placeholders:0,adoptedUnedited:!1,bodyDiffers:!1},nT={edited:null,git:null,draft:null};function rT(e,t,n){let{marks:r}=n,i=bw(e),a=r.tracked[i]!==void 0,o=Kw(e),s=Hw(nT,e,n.viewer),c=t.find(t=>t.identities.includes(e.repoKey))??null;return{key:i,kind:`pr`,section:e.state===`open`?`work`:`done`,repoRoot:c?.root??null,repoName:c?.name??e.repo,worktreePath:null,branch:e.headRefName,state:o,facts:{...tT},pr:e,note:c===null?`no-local-clone`:`no-local-branch`,open:null,stage:Nw(o,e),stack:null,attention:Vw(e,n.viewer),lastActivity:s,times:{...nT},activity:s?.at??null,fingerprint:e.updatedAt,tracked:a}}function iT(e,t){return e.key===t.key?0:e.key<t.key?-1:1}function aT(e,t){return e.activity===t.activity?iT(e,t):e.activity===null?1:t.activity===null?-1:t.activity-e.activity}function oT(e,t){return e!==null&&t-e<=12096e5}function sT(e){return e.stack===null?null:`${e.repoRoot??e.repoName}\n${e.stack.root}`}function cT(e){let t=new Map;for(let n of e){let e=sT(n);e!==null&&n.activity!==null&&t.set(e,Math.max(t.get(e)??n.activity,n.activity))}return e=>{let n=sT(e);return n===null?e.activity:t.get(n)??null}}function lT(e,t){let n=e.pr===null?null:Cw(e.pr),r=t.pr===null?null:Cw(t.pr);return n===r?iT(e,t):n===null?1:r===null?-1:r-n}function uT(e,t,n){let r=new Set(t.map(e=>e.key)),i=Tw(n),a=new Set;for(let t of[...Object.keys(e.tracked),...Object.keys(e.dismissed)])r.has(t)||(i||!t.startsWith(vw))&&a.add(t);return[...a].sort()}function dT(e,t,n,r,i=!1){let a=new Set,o=e.filter(e=>!a.has(e.root)&&(a.add(e.root),!0)),s=t.prs.filter(e=>!e.reviewRequested),c={prs:s,shown:s.filter(e=>ww(e,r)),marks:n,now:r,canFinish:Tw(t),viewer:t.viewer},l=o.flatMap(e=>eT(e,c)),u=new Set(l.map(e=>e.pr).filter(e=>e!==null));for(let e of c.shown)u.has(e)||l.push(rT(e,o,c));for(let e of t.prs)e.reviewRequested&&e.state===`open`&&l.push(rT(e,o,c));let d=Bw(l,o),f=l.filter(e=>d.has(e)||!zw(e)).map(e=>({...e,stack:d.get(e)??null})),p={work:[],candidates:[],older:[],done:[],dismissed:[],staleMarks:i?uT(n,f,t):[]},m=cT(f);for(let e of f)n.dismissed[e.key]?.fingerprint===e.fingerprint?p.dismissed.push(e):e.section===`candidates`&&!oT(m(e),r)?p.older.push(e):p[e.section].push(e);return p.work.sort(aT),p.candidates.sort(aT),p.older.sort(aT),p.dismissed.sort(aT),p.done.sort(lT),p}var fT=3e5,pT={status:`never`,message:null,checkedAt:null,viewer:null,prs:[],capped:!1};async function mT(e,t,n){let r=0;async function i(){for(;r<e.length;){let t=e[r];r+=1,await n(t)}}await Promise.all(Array.from({length:Math.min(t,e.length)},i))}function hT(e){return e.roots.flatMap(e=>e.error===null?e.capped?[{path:e.path,message:`more repos than listed`}]:[]:[{path:e.path,message:e.error}])}function gT(e,t){let n=e.findIndex(e=>e.root===t.root);if(n===-1)return[...e,t];let r=[...e];return r[n]=t,r}var _T=Ps(`work`,()=>{let e=new Xs,t=H([]),n=H({total:0,done:0,running:!1}),r=H(!1),i=H([]),a=H([]),o=H(!1),s=H(null),c=H(!1),l=H({tracked:{},dismissed:{}}),u=H(null),d=H(Date.now()),f=H(null),p=0,m=$(()=>r.value&&o.value&&i.value.length===0&&!c.value&&s.value!==null&&s.value.checkedAt!==null),h=$(()=>dT(t.value,s.value??pT,l.value,d.value,m.value));function g(e,t,n){Zs(e,t),u.value=`${n}: ${Rs(t)}`}async function _(){try{l.value=await e.workMarks()}catch(e){g(`load Work marks`,e,`Could not load marks`)}}function v(e){return e===null||e.status===`never`||e.checkedAt===null||Date.now()-e.checkedAt>fT}async function y(){c.value=!0;try{let t=await e.workPrs();s.value=t,v(t)&&(s.value=await e.refreshWorkPrs())}catch(e){g(`load PRs`,e,`Could not load PRs`)}finally{c.value=!1}}async function b(){c.value=!0;try{s.value=await e.refreshWorkPrs()}catch(e){g(`check PRs`,e,`Could not check PRs`)}finally{c.value=!1}}async function x(r,a,o){try{let n=await e.workRepo(r);if(a!==p||o.has(n.root))return;o.set(n.root,n),t.value=gT(t.value,n)}catch(e){if(a!==p)return;Qs(`scan repo for the Work page`,e,{path:r}),i.value=[...i.value,{path:r,message:Rs(e)}]}finally{a===p&&(n.value={...n.value,done:n.value.done+1})}}async function S(){p+=1;let s=p;r.value=!1,i.value=[],a.value=[],o.value=!1,n.value={total:0,done:0,running:!0};let c,l;try{let[t,n]=await Promise.all([e.discovered(),e.listRepos()]);c=t,l=n.map(e=>e.path)}catch(e){if(s!==p)return;g(`list repos for the Work page`,e,`Could not list repos`),n.value={...n.value,running:!1};return}if(s!==p)return;a.value=hT(c),o.value=c.roots.every(e=>e.error===null&&!e.capped&&e.repos.length>0);let u=[...new Set(c.roots.flatMap(e=>e.repos.map(e=>e.path)))],d=new Map;if(n.value={total:u.length,done:0,running:!0},await mT(u,4,e=>x(e,s,d)),s!==p)return;let m=new Set(u);for(let e of d.values())for(let t of e.worktrees)m.add(t.path);let h=[...new Set(l)].filter(e=>!m.has(e));n.value={...n.value,total:u.length+h.length},await mT(h,4,e=>x(e,s,d)),s===p&&(t.value=[...d.values()],n.value={...n.value,running:!1},r.value=!0,f.value=Date.now())}async function C(){d.value=Date.now(),u.value=null,await Promise.all([_(),y(),S()])}async function w(){let e=Date.now(),t=!n.value.running&&(f.value===null||e-f.value>6e4),r=!c.value&&v(s.value);(t||r)&&(d.value=e,await Promise.all([r?b():null,t?S():null]))}async function T(){d.value=Date.now(),u.value=null,await Promise.all([b(),S()])}async function E(t,n,r){let i=h.value.staleMarks.filter(e=>e!==t),a={key:t,action:n};r!==void 0&&(a.fingerprint=r),i.length>0&&(a.prune=i);try{l.value=await e.putWorkMark(a)}catch(e){g(`save a Work mark`,e,`Could not save`)}}return{repos:t,scan:n,scanFinished:r,repoErrors:i,rootErrors:a,prs:s,prsLoading:c,marks:l,error:u,now:d,scannedAt:f,complete:m,classification:h,load:C,catchUp:w,refresh:T,runScan:S,mark:E}}),vT=[`data-icon`],yT=[`d`],bT=sf(gr({__name:`WorkIcon`,props:{name:{}},setup(e){let t={stack:`M2.5 5.5 8 2.5l5.5 3L8 8.5ZM2.5 8.5 8 11.5l5.5-3M2.5 11 8 14l5.5-3`,check:`m3 8.5 3 3 7-7`,cross:`m4 4 8 8m0-8-8 8`,pending:`M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z`,comment:`M2.5 3.5h11v7.5h-6l-3 2.5V11h-2Z`,approved:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2Zm-2.75 6.25 1.75 1.75 3.75-3.75`,changes:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2ZM8 5v4.5M5.75 7.25h4.5M5.75 11h4.5`,waiting:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2Zm0 3v3.25l2 1.25`,pencil:`m10.5 2.5 3 3-8 8h-3v-3Z`,compare:`M2.5 5.5h10L10 3M13.5 10.5h-10L6 13`,chevron:`m6 3.5 4.5 4.5L6 12.5`,differs:`M3 6h10M3 10h10m-2.5-7-5 10`,alert:`M8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2ZM8 5v3.75m0 2.25v.25`,copy:`M5.5 5.5h7.5v8H5.5ZM3 10.5v-8h7.5`},n=e,r=$(()=>t[n.name]);return(t,n)=>(q(),J(`svg`,{class:`work-icon`,viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`,"data-icon":e.name},[X(`path`,{d:r.value},null,8,yT)],8,vT))}}),[[`__scopeId`,`data-v-a1673a3c`]]),xT={key:0,class:`view-error`,"data-testid":`work-draft-error`},ST={key:2,class:`loading`},CT=sf(gr({__name:`WorkDraftEditor`,props:{path:{},branch:{}},setup(e){let t=e,n=new Xs,r=H(null),i=H(null),a=$b(()=>r.value===null?null:{id:r.value,branch:t.branch}),o=!1;return jr(async()=>{try{let e=await n.openRepo(t.path);if(o){await n.closeRepo(e.id);return}r.value=e.id}catch(e){Zs(`open a repo for its PR draft`,e,{path:t.path}),i.value=`Could not open the repo: ${Rs(e)}`}}),Fr(()=>{o=!0;let e=r.value;(async()=>{if(await a.dispose(),e!==null)try{await n.closeRepo(e)}catch(e){Zs(`release a repo after its PR draft`,e,{path:t.path})}})()}),(e,t)=>i.value?(q(),J(`p`,xT,B(i.value),1)):r.value?(q(),Y(NS,{key:1,session:U(a)},null,8,[`session`])):(q(),J(`p`,ST,`Opening the draft…`))}}),[[`__scopeId`,`data-v-f26ea9b4`]]),wT=1500;function TT(){let e=H(null),t=null;function n(n){e.value=n,t!==null&&clearTimeout(t),t=setTimeout(()=>e.value=null,wT)}async function r(e){try{await navigator.clipboard.writeText(e),n(`copied`)}catch(e){Zs(`copy to the clipboard`,e),n(`failed`)}}return Fr(()=>{t!==null&&clearTimeout(t)}),{state:e,copy:r}}var ET={class:`block events`},DT={key:0,class:`none`},OT={key:1,class:`event-list`},kT=[`data-tip`],AT={class:`text`},jT={class:`block facts`},MT={class:`fact-list`},NT=[`data-tip`],PT={class:`actions`},FT=[`href`],IT={key:0,class:`block draft`},LT=8,RT=sf(gr({__name:`WorkRowDetail`,props:{item:{},now:{},dismissed:{type:Boolean}},emits:[`open`,`mark`],setup(e,{emit:t}){let n=e,r=t,i=_T(),a=$(()=>xx(n.item,i.prs?.viewer??null).slice(0,LT)),o=$(()=>wx(n.item)),s=$(()=>kx(n.item)),{state:c,copy:l}=TT(),u=$(()=>c.value===`copied`?`Copied`:c.value===`failed`?`Could not copy`:`Copy for a session`),d=$(()=>{let{item:e}=n;return e.kind!==`branch`||e.branch===null||e.open===null?null:{path:e.open.path,branch:e.branch}});return(t,n)=>(q(),J(`div`,{class:`detail`,"data-testid":`work-detail`,onClick:n[5]||=Jo(()=>{},[`stop`])},[X(`section`,ET,[n[6]||=X(`h3`,{class:`eyebrow`},`Activity`,-1),a.value.length===0?(q(),J(`p`,DT,`Nothing recorded.`)):(q(),J(`ol`,OT,[(q(!0),J(K,null,G(a.value,(t,n)=>(q(),J(`li`,{key:n,class:z([`event`,{other:t.other}])},[X(`span`,{class:`at`,"data-tip":U(fx)(t.at)},B(U(dx)(t.at,e.now)),9,kT),X(`span`,AT,B(t.text),1)],2))),128))]))]),X(`section`,jT,[n[7]||=X(`h3`,{class:`eyebrow`},`Facts`,-1),(q(!0),J(K,null,G(s.value,e=>(q(),J(`p`,{key:e,class:`wants`,"data-testid":`work-detail-attention`},B(e),1))),128)),X(`dl`,MT,[(q(!0),J(K,null,G(o.value,([e,t])=>(q(),J(K,{key:e},[X(`dt`,null,B(e),1),X(`dd`,{"data-tip":t},B(t),9,NT)],64))),128))]),X(`div`,PT,[e.item.open?(q(),J(`button`,{key:0,class:`action`,onClick:n[0]||=e=>r(`open`)},`Open in Compare`)):Q(``,!0),X(`button`,{class:`action`,"data-testid":`work-detail-copy`,"data-tip":`The PR, repo, local clone and branch, to paste into a session`,onClick:n[1]||=t=>U(l)(U(Ax)(e.item))},B(u.value),1),e.item.pr?(q(),J(`a`,{key:1,class:`action`,href:e.item.pr.url,target:`_blank`,rel:`noopener noreferrer`},`Open #`+B(e.item.pr.number)+` on GitHub`,9,FT)):Q(``,!0),e.item.tracked?(q(),J(`button`,{key:2,class:`action`,"data-testid":`work-drop`,onClick:n[2]||=e=>r(`mark`,`drop`)},` Stop tracking `)):Q(``,!0),e.dismissed?(q(),J(`button`,{key:3,class:`action`,"data-testid":`work-detail-undismiss`,onClick:n[3]||=e=>r(`mark`,`undismiss`)},` Show again `)):(q(),J(`button`,{key:4,class:`action`,"data-testid":`work-dismiss`,"data-tip":`Hide this until something about it changes`,onClick:n[4]||=e=>r(`mark`,`dismiss`)},` Dismiss `))])]),d.value?(q(),J(`section`,IT,[ba(CT,{path:d.value.path,branch:d.value.branch},null,8,[`path`,`branch`])])):Q(``,!0)]))}}),[[`__scopeId`,`data-v-d98ae195`]]),zT=[`data-stage`],BT=[`data-tip`],VT={class:`pips`,"aria-hidden":`true`},HT={class:`sr-only`},UT=[`data-tip`,`aria-label`],WT=[`data-tip`],GT={class:`branch mono`},KT=[`data-tip`],qT={key:1,class:`by`,"data-testid":`work-by`},JT={key:2,class:`pr-title`},YT=[`data-tip`],XT={class:`mono`},ZT={class:`cell pr`},QT=[`href`,`data-tip`],$T=[`data-tip`],eE={key:1,class:`threads`},tE={class:`mono`},nE=[`data-tip`],rE={class:`cell local mono`,"data-testid":`work-local`},iE=[`data-tip`],aE=[`data-tip`],oE=[`data-tip`],sE=[`data-tip`],cE={key:1,class:`placeholders mono`},lE=[`data-tip`],uE=[`data-tip`],dE={class:`cell act`},fE=[`data-tip`],pE=[`data-tip`,`aria-label`],mE=[`aria-expanded`,`aria-label`],hE=sf(gr({__name:`WorkRow`,props:{item:{},now:{},dismissed:{type:Boolean}},emits:[`open`,`mark`],setup(e,{emit:t}){let n=e,r=t,i=V(!1);function a(){i.value=!i.value}let o=$(()=>gx[n.item.stage]),s=_T(),c=$(()=>Ox(n.item,s.prs?.viewer??null)),l=$(()=>{let e=n.item.lastActivity;return e===null?void 0:`${bx(e)}\n${fx(e.at)}`}),u=$(()=>kx(n.item).join(`
|
|
22
|
+
`)),d=$(()=>n.item.pr?.reviewRequested?n.item.pr.author:null),{state:f,copy:p}=TT(),m=$(()=>f.value===`copied`?`Copied`:f.value===`failed`?`Could not copy`:`Copy the PR, repo and branch, to paste into a session`),h=$(()=>n.item.pr?.progress??null),g=$(()=>{let e=h.value;if(e===null)return;let t=[e.decision===null?`no review decision`:e.decision.replace(`-`,` `)];return e.unresolvedThreads>0&&t.push(`${e.unresolvedThreads} open threads`),e.pendingReviewers>0&&t.push(`${e.pendingReviewers} reviewers asked`),t.join(` · `)}),_=$(()=>{let e=h.value;return e===null||n.item.stage===`draft`?null:e.decision===`approved`?`approved`:e.decision===`changes-requested`?`changes`:`waiting`}),v=$(()=>{let e=h.value;if(e!==null)return e.checks===null?`no checks`:`checks: ${e.checks}`}),y=$(()=>h.value?.conflicting??!1),b=$(()=>{let e=h.value?.checks??null;return e===`success`?`check`:e===`failure`?`cross`:e===`pending`?`pending`:null}),x=$(()=>{let e=n.item.stack;return e===null?void 0:`Layer ${e.position} of ${e.size} in the stack on ${e.root}`}),S=$(()=>{let e=n.item.facts,t=[];return e.draft&&t.push(e.adoptedUnedited?`draft: agent text, not edited`:`draft`),e.placeholders>0&&t.push(`${e.placeholders} placeholders`),e.bodyDiffers&&t.push(`differs from the PR on GitHub`),t.length===0?void 0:t.join(` · `)}),C=$(()=>n.item.lastActivity),w=$(()=>px(n.item,n.now)),T=$(()=>!n.dismissed&&n.item.section===`candidates`&&!n.item.tracked),E=$(()=>{let e=[n.item.branch??`detached`];return n.item.pr&&e.push(n.item.pr.title),n.item.worktreePath&&e.push(n.item.worktreePath),e.join(`
|
|
23
|
+
`)});return(t,n)=>(q(),J(`li`,{class:z([`work-row`,{expanded:i.value,dim:e.dismissed}]),"data-stage":e.item.stage,"data-testid":`work-row`},[X(`div`,{class:`line`,"data-testid":`work-row-line`,onClick:a},[X(`span`,{class:`cell prog`,"data-tip":U(hx)[e.item.stage],"data-testid":`work-stage`},[X(`span`,VT,[(q(),J(K,null,G(5,e=>X(`i`,{key:e,class:z({on:e<=o.value})},null,2)),64))]),X(`span`,HT,B(U(hx)[e.item.stage]),1),e.item.attention.length>0?(q(),J(`span`,{key:0,class:`alert`,"data-testid":`work-attention`,"data-tip":u.value,"aria-label":u.value},[ba(bT,{name:`alert`})],8,UT)):Q(``,!0)],8,BT),X(`span`,{class:`cell name`,"data-tip":E.value},[X(`span`,GT,B(e.item.branch??`detached`),1),y.value?(q(),J(`span`,{key:0,class:`conflicts`,"data-testid":`work-conflicts`,"data-tip":`GitHub says this branch has merge conflicts with ${e.item.pr?.baseRefName}`},`conflicts`,8,KT)):Q(``,!0),d.value?(q(),J(`span`,qT,`by `+B(d.value),1)):Q(``,!0),e.item.pr?(q(),J(`span`,JT,B(e.item.pr.title),1)):Q(``,!0)],8,WT),X(`span`,{class:`cell stack`,"data-tip":x.value,"data-testid":`work-stack`},[e.item.stack?(q(),J(K,{key:0},[ba(bT,{name:`stack`}),X(`span`,XT,B(e.item.stack.position)+`/`+B(e.item.stack.size),1)],64)):Q(``,!0)],8,YT),X(`span`,ZT,[e.item.pr?(q(),J(`a`,{key:0,class:`pr-link mono`,"data-testid":`work-pr-link`,href:e.item.pr.url,target:`_blank`,rel:`noopener noreferrer`,"data-tip":`Open #${e.item.pr.number} on GitHub`,onClick:n[0]||=Jo(()=>{},[`stop`])},`#`+B(e.item.pr.number),9,QT)):Q(``,!0)]),X(`span`,{class:`cell review`,"data-tip":g.value,"data-testid":`work-review`},[_.value?(q(),Y(bT,{key:0,name:_.value,class:z(_.value)},null,8,[`name`,`class`])):Q(``,!0),h.value&&h.value.unresolvedThreads>0?(q(),J(`span`,eE,[ba(bT,{name:`comment`}),X(`span`,tE,B(h.value.unresolvedThreads),1)])):Q(``,!0)],8,$T),X(`span`,{class:`cell checks`,"data-tip":v.value,"data-testid":`work-checks`},[b.value?(q(),Y(bT,{key:0,name:b.value,class:z(b.value)},null,8,[`name`,`class`])):Q(``,!0)],8,nE),X(`span`,rE,[e.item.facts.uncommitted>0?(q(),J(`span`,{key:0,class:`uncommitted`,"data-tip":`${e.item.facts.uncommitted} uncommitted`},`●`+B(e.item.facts.uncommitted),9,iE)):Q(``,!0),e.item.facts.unpushed>0?(q(),J(`span`,{key:1,class:`unpushed`,"data-tip":`${e.item.facts.unpushed} unpushed`},`↑`+B(e.item.facts.unpushed),9,aE)):Q(``,!0),e.item.note?(q(),J(`span`,{key:2,class:`note`,"data-tip":U(Gx)[e.item.note]},B(U(Wx)[e.item.note]),9,oE)):Q(``,!0)]),X(`span`,{class:`cell draft`,"data-tip":S.value,"data-testid":`work-draft`},[e.item.facts.draft?(q(),Y(bT,{key:0,name:`pencil`,class:z({agent:e.item.facts.adoptedUnedited})},null,8,[`class`])):Q(``,!0),e.item.facts.placeholders>0?(q(),J(`span`,cE,B(`{`)+B(e.item.facts.placeholders)+B(`}`),1)):Q(``,!0),e.item.facts.bodyDiffers?(q(),Y(bT,{key:2,name:`differs`,class:`differs`})):Q(``,!0)],8,sE),X(`span`,{class:z([`cell status`,c.value.turn]),"data-tip":c.value.why||void 0,"data-testid":`work-status`},B(c.value.text),11,lE),X(`span`,{class:z([`cell when`,{recent:w.value}]),"data-tip":l.value,"data-testid":`work-when`},B(C.value?U(dx)(C.value.at,e.now):``),11,uE),X(`span`,dE,[T.value?(q(),J(`button`,{key:0,class:`action`,"data-testid":`work-track`,"data-tip":`Keep this in Work`,onClick:n[1]||=Jo(t=>r(`mark`,e.item,`track`),[`stop`])},` Track `)):Q(``,!0),e.dismissed?(q(),J(`button`,{key:1,class:`action`,"data-testid":`work-undismiss`,onClick:n[2]||=Jo(t=>r(`mark`,e.item,`undismiss`),[`stop`])},` Show `)):Q(``,!0),!e.item.open&&e.item.pr?(q(),J(`button`,{key:2,class:z([`icon-btn`,{done:U(f)===`copied`}]),"data-testid":`work-copy`,"data-tip":m.value,"aria-label":`Copy for a session`,onClick:n[3]||=Jo(t=>U(p)(U(Ax)(e.item)),[`stop`])},[ba(bT,{name:U(f)===`copied`?`check`:`copy`},null,8,[`name`])],10,fE)):Q(``,!0),e.item.open?(q(),J(`button`,{key:3,class:`icon-btn`,"data-testid":`work-compare`,"data-tip":`Open ${e.item.branch??`this worktree`} in Compare`,"aria-label":`Open ${e.item.branch??`this worktree`} in Compare`,onClick:n[4]||=Jo(t=>r(`open`,e.item),[`stop`])},[ba(bT,{name:`compare`})],8,pE)):Q(``,!0),X(`button`,{class:`icon-btn expand`,"data-testid":`work-expand`,"aria-expanded":i.value,"aria-label":i.value?`Close`:`Show activity and draft`,onClick:Jo(a,[`stop`])},[ba(bT,{name:`chevron`})],8,mE)])]),i.value?(q(),Y(RT,{key:0,item:e.item,now:e.now,dismissed:e.dismissed,onOpen:n[5]||=t=>r(`open`,e.item),onMark:n[6]||=t=>r(`mark`,e.item,t)},null,8,[`item`,`now`,`dismissed`])):Q(``,!0)],10,zT))}}),[[`__scopeId`,`data-v-9a0e5bad`]]),gE={class:`work-page`,"data-testid":`work-page`},_E={class:`work-head`},vE={class:`head-text`},yE=[`data-tip`],bE=[`data-tip`],xE={class:`filters`,role:`group`,"aria-label":`Show`},SE=[`aria-pressed`],CE=[`aria-pressed`,`data-testid`,`data-tip`,`onClick`],wE={class:`filter-count`},TE={class:`filters`,role:`group`,"aria-label":`Group`},EE=[`aria-pressed`],DE=[`aria-pressed`],OE=[`disabled`],kE={key:0,class:`page-error view-error`,"data-testid":`work-error`},AE=[`data-tip`],jE=[`data-tip`],ME={key:3,class:`state-block`,"data-testid":`work-no-repos`},NE={class:`state-hint`},PE={key:4,class:`panel-note`,"data-testid":`work-clear`},FE={key:5,class:`panel-note`,"data-testid":`work-within-empty`},IE={key:6,class:`col-heads`,"data-testid":`work-col-heads`},LE=[`aria-sort`,`data-tip`,`onClick`],RE={key:0,class:`sort-mark`,"aria-hidden":`true`},zE={key:1,class:`col-head`},BE=[`open`,`data-testid`,`onToggle`],VE={key:0,class:`eyebrow`},HE={key:1,class:`section-title eyebrow`},UE={class:`section-name`},WE={class:`count`},GE={class:`rows`},KE={key:0,class:`time-head`,"data-testid":`work-time`},qE={class:`time-name`},JE={class:`group-count`},YE={class:`group-name`},XE={class:`group-count`},ZE={key:7,class:`work-section dismissed`,"data-testid":`work-dismissed`},QE={class:`eyebrow`},$E={class:`rows`},eD=3e4,tD=sf(gr({__name:`WorkView`,setup(e){let t=ic(),n=Vl(),r=ql(),i=_T(),{openByPath:a}=Jl(),o=V(Date.now()),s=null;function c(){document.visibilityState===`visible`&&(o.value=Date.now(),i.catchUp())}jr(()=>{s=setInterval(()=>o.value=Date.now(),eD),document.addEventListener(`visibilitychange`,c),window.addEventListener(`focus`,c)}),Fr(()=>{s!==null&&clearInterval(s),document.removeEventListener(`visibilitychange`,c),window.removeEventListener(`focus`,c)}),jr(()=>{i.load()});let l={work:`Work`,candidates:`Candidates`,done:`Done`},u=[`work`,`candidates`,`older`,`done`],d=[`work`,`done`,`candidates`,`older`],f=[{label:`Stage`,key:`stage`,order:`how far along: local only first, merged last`},{label:`Branch`,key:`branch`,order:`branch name, A to Z`},{label:`Stack`,key:`stack`,order:`stack, each one bottom layer first`},{label:`PR`,key:`pr`,order:`PR number, lowest first`},{label:`Review`,key:`review`,order:`review: changes requested first, then waiting, then approved`},{label:`CI`,key:`ci`,order:`CI: conflicts first, then failed, running, passed`},{label:`Local`,key:`local`,order:`uncommitted plus unpushed, fewest first`},{label:`Draft`,key:`draft`,order:`PR draft: drafts with {{…}} gaps first, then drafts that differ from GitHub, then the rest`},{label:`Status`,key:`status`,order:`whose move: yours first, then someone else's, then done`},{label:`When`,key:`activity`,order:`last activity, newest first`,right:!0},{label:``,key:null}];function p(e){let t=r.workByRepo?`inside each repo`:`inside each section`;return`Sort by ${e.order} (${t}). Again to reverse, a third time for the default order. Rows with none go last.`}let m=V(null);function h(e){let t=e===`activity`?`desc`:`asc`,n=m.value;n===null||n.key!==e?m.value={key:e,dir:t}:n.dir===t?m.value={key:e,dir:t===`asc`?`desc`:`asc`}:m.value=null}function g(e){if(e!==null&&m.value?.key===e)return m.value.dir===`asc`?`ascending`:`descending`}let _=$(()=>i.classification),v=Xx.filter(e=>e.key!==`older`);function y(e){return v.find(t=>t.key===e)?.within??null}function b(e,t){let n=y(t);return n===null?e:e.filter(e=>mx(e,o.value,n))}let x=$(()=>{let e=u.flatMap(e=>_.value[e]);return Object.fromEntries(v.map(t=>[t.key,b(e,t.key).length]))}),S=V(!1);function C(e){return e===`older`?S.value:!r.workFolded.includes(e)}function w(e,t){let n=t.target.open;e===`older`?S.value=n:r.setWorkFolded(e,!n)}let T=$(()=>{let e=(r.workWithin===null?u:d).map(e=>{let t=b(_.value[e],r.workWithin),n=$x(t,{byRepo:r.workByRepo,byTime:r.workByTime,sort:m.value,now:o.value});return{name:e,title:e===`older`?``:l[e],items:t,lines:n}}).filter(e=>e.items.length>0);return e.some(e=>e.name===`candidates`&&!C(`candidates`))?e.filter(e=>e.name!==`older`):e});function E(e){return`${e} older ${e===1?`candidate`:`candidates`}`}let D=$(()=>i.scan.running||i.prsLoading),O=$(()=>{let e=i.prs;if(e===null)return i.prsLoading?{text:`checking PRs…`,failed:!1}:null;let t=e.checkedAt===null?null:Jx(e.checkedAt,e.viewer,o.value),n=e.checkedAt===null?void 0:fx(e.checkedAt),r=qx(e.status,e.message);if(r!==null)return{text:t===null?r:`${r} · ${t}`,failed:!0,tip:n};if(t===null)return i.prsLoading?{text:`checking PRs…`,failed:!1}:null;let a=e.capped?`${t} · more PRs than listed`:t;return{text:i.prsLoading?`${a} · checking…`:a,failed:!1,tip:n}}),k=$(()=>{if(i.scan.running)return{text:`scanned ${i.scan.done} of ${i.scan.total} repos`};let e=i.scannedAt;return e===null?null:{text:`Repos scanned ${dx(e,o.value)}`,tip:fx(e)}}),A=$(()=>i.scanFinished&&i.repos.length===0&&i.repoErrors.length===0&&i.rootErrors.length===0),j=$(()=>i.scanFinished&&!A.value&&u.every(e=>_.value[e].length===0)&&_.value.dismissed.length===0);async function M(e){let i=e.open;i!==null&&(t.activeRepoPath===i.path||await a(i.path))&&(su({repo:n.repoPath??i.path,view:`compare`}),r.setActiveView(`compare`),await n.setComparePick({head:i.head}))}function N(e,t){i.mark(e.key,t,t===`dismiss`?e.fingerprint:void 0)}return(e,t)=>(q(),J(`div`,gE,[X(`header`,_E,[X(`div`,vE,[t[5]||=X(`h1`,{class:`title`},`Work`,-1),O.value?(q(),J(`p`,{key:0,class:z([`gh-line mono`,{failed:O.value.failed}]),"data-tip":O.value.tip,"data-testid":`gh-line`},B(O.value.text),11,yE)):Q(``,!0),k.value?(q(),J(`p`,{key:1,class:`scan-line mono`,"data-tip":k.value.tip,"data-testid":`scan-line`},B(k.value.text),9,bE)):Q(``,!0)]),X(`div`,xE,[X(`button`,{class:z([`filter chrome-chip`,{on:U(r).workWithin===null}]),"aria-pressed":U(r).workWithin===null,"data-testid":`work-within-all`,onClick:t[0]||=e=>U(r).setWorkWithin(null)},` All `,10,SE),(q(!0),J(K,null,G(U(v),e=>(q(),J(`button`,{key:e.key,class:z([`filter chrome-chip`,{on:U(r).workWithin===e.key}]),"aria-pressed":U(r).workWithin===e.key,"data-testid":`work-within-${e.key}`,"data-tip":`Only what moved in the ${e.label.toLowerCase()}`,onClick:t=>U(r).setWorkWithin(e.key)},[Z(B(e.label)+` `,1),X(`span`,wE,B(x.value[e.key]),1)],10,CE))),128))]),X(`div`,TE,[X(`button`,{class:z([`filter chrome-chip`,{on:U(r).workByRepo}]),"aria-pressed":U(r).workByRepo,"data-testid":`work-by-repo`,"data-tip":`Group the rows under a heading per repo`,onClick:t[1]||=e=>U(r).toggleWorkByRepo()},` By repository `,10,EE),X(`button`,{class:z([`filter chrome-chip`,{on:U(r).workByTime}]),"aria-pressed":U(r).workByTime,"data-testid":`work-by-time`,"data-tip":`Group the rows by their last activity: last day, week, 2 weeks, month, older`,onClick:t[2]||=e=>U(r).toggleWorkByTime()},` By time `,10,DE)]),X(`button`,{class:`refresh-btn chrome-chip`,"data-testid":`work-refresh`,disabled:D.value,"data-tip":`Check GitHub and rescan every repo`,onClick:t[3]||=e=>U(i).refresh()},` Refresh `,8,OE)]),U(i).error?(q(),J(`p`,kE,B(U(i).error),1)):Q(``,!0),U(i).repoErrors.length>0?(q(),J(`p`,{key:1,class:`page-error view-error`,"data-testid":`work-repo-errors`,"data-tip":U(i).repoErrors.map(e=>`${e.path}: ${e.message}`).join(`
|
|
24
|
+
`)},B(U(i).repoErrors.length)+` `+B(U(i).repoErrors.length===1?`repo`:`repos`)+` could not be scanned: `+B(U(i).repoErrors.map(e=>U(Yl)(e.path)).join(`, `)),9,AE)):Q(``,!0),U(i).rootErrors.length>0?(q(),J(`p`,{key:2,class:`page-error view-error`,"data-testid":`work-root-errors`,"data-tip":U(i).rootErrors.map(e=>`${e.path}: ${e.message}`).join(`
|
|
25
|
+
`)},B(U(i).rootErrors.length)+` watch `+B(U(i).rootErrors.length===1?`directory`:`directories`)+` not fully scanned: `+B(U(i).rootErrors.map(e=>U(Yl)(e.path)).join(`, `)),9,jE)):Q(``,!0),A.value?(q(),J(`div`,ME,[t[8]||=X(`p`,{class:`state-title`},`No repos to scan.`,-1),X(`p`,NE,[t[6]||=Z(` Add a watch directory in `,-1),X(`button`,{class:`link-btn`,onClick:t[4]||=e=>U(r).openOverlay(`settings`)},`Settings`),t[7]||=Z(`, and its repos show up here. `,-1)])])):j.value?(q(),J(`p`,PE,` Nothing open. A worktree with changes, a branch ahead of its base, or an open PR shows up here. `)):U(r).workWithin!==null&&T.value.length===0&&U(i).scanFinished?(q(),J(`p`,FE,` Nothing moved in the `+B(U(v).find(e=>e.key===U(r).workWithin)?.label.toLowerCase())+`. `,1)):Q(``,!0),T.value.length>0?(q(),J(`div`,IE,[(q(),J(K,null,G(f,e=>(q(),J(K,{key:e.label},[e.key?(q(),J(`button`,{key:0,class:z([`col-head`,{right:e.right,sorted:m.value?.key===e.key}]),"aria-sort":g(e.key),"data-tip":p(e),onClick:t=>h(e.key)},[Z(B(e.label),1),m.value?.key===e.key?(q(),J(`span`,RE,B(m.value.dir===`asc`?` ↑`:` ↓`),1)):Q(``,!0)],10,LE)):(q(),J(`span`,zE,B(e.label),1))],64))),64))])):Q(``,!0),(q(!0),J(K,null,G(T.value,e=>(q(),J(`details`,{key:e.name,class:z([`work-section`,{fold:e.name===`older`}]),open:C(e.name),"data-testid":`work-section-${e.name}`,onToggle:t=>w(e.name,t)},[e.name===`older`?(q(),J(`summary`,VE,B(E(e.items.length)),1)):(q(),J(`summary`,HE,[X(`h2`,UE,[Z(B(e.title)+` `,1),X(`span`,WE,B(e.items.length),1)])])),X(`ul`,GE,[(q(!0),J(K,null,G(e.lines,e=>(q(),J(K,{key:e.key},[e.kind===`time`?(q(),J(`li`,KE,[X(`span`,qE,B(e.label),1),X(`span`,JE,B(e.count),1)])):e.kind===`repo`?(q(),J(`li`,{key:1,class:z([`group-head`,{nested:U(r).workByTime}]),"data-testid":`work-group`},[X(`span`,YE,B(e.name),1),X(`span`,XE,B(e.count),1)],2)):(q(),Y(hE,{key:2,item:e.item,now:o.value,onOpen:M,onMark:N},null,8,[`item`,`now`]))],64))),128))])],42,BE))),128)),_.value.dismissed.length>0?(q(),J(`details`,ZE,[X(`summary`,QE,B(_.value.dismissed.length)+` dismissed`,1),X(`ul`,$E,[(q(!0),J(K,null,G(_.value.dismissed,e=>(q(),Y(hE,{key:e.key,item:e,now:o.value,dismissed:``,onOpen:M,onMark:N},null,8,[`item`,`now`]))),128))])])):Q(``,!0)]))}}),[[`__scopeId`,`data-v-38892698`]]),nD=12,rD=8,iD=sf(gr({__name:`HoverTip`,setup(e){let t=H(null),n=V(0),r=V(0),i=V(null),a={width:0,height:0},o={x:0,y:0};function s(){let{width:e,height:t}=a,i=window.innerWidth-e-rD;n.value=Math.max(rD,Math.min(o.x-e/2,i));let s=o.y-t-nD;r.value=s>=rD?s:o.y+24}async function c(e){if(e!==t.value){t.value=e,await On();let n=i.value;a=n===null?{width:0,height:0}:{width:n.offsetWidth,height:n.offsetHeight}}s()}function l(){t.value=null}function u(e){if(e.pointerType===`touch`)return;o={x:e.clientX,y:e.clientY};let t=(e.target instanceof Element?e.target.closest(`[data-tip]`):null)?.getAttribute(`data-tip`)??``;t===``?l():c(t)}return jr(()=>{document.addEventListener(`pointermove`,u,{passive:!0}),document.addEventListener(`pointerdown`,l,{passive:!0}),document.addEventListener(`scroll`,l,{capture:!0,passive:!0}),document.documentElement.addEventListener(`pointerleave`,l)}),Pr(()=>{document.removeEventListener(`pointermove`,u),document.removeEventListener(`pointerdown`,l),document.removeEventListener(`scroll`,l,{capture:!0}),document.documentElement.removeEventListener(`pointerleave`,l)}),(e,a)=>(q(),Y(lr,{to:`body`},[t.value===null?Q(``,!0):(q(),J(`div`,{key:0,ref_key:`tipEl`,ref:i,class:`hover-tip`,role:`tooltip`,"data-testid":`hover-tip`,style:le({left:`${n.value}px`,top:`${r.value}px`})},B(t.value),5))]))}}),[[`__scopeId`,`data-v-662bb016`]]),aD={class:`shell`},oD={class:`workspace`},sD=3e3,cD=1500,lD=sf(gr({__name:`App`,setup(e){let t=ic(),n=Hl(),r=Vl(),i=ql();Cu();let{activate:a,openByPath:o}=Jl();i.init(),pu(),mu(),yu();let s={changes:oy,journal:Ny,history:Cb,compare:fC,explorer:_w},c=$(()=>s[i.activeView]),l=$(()=>t.activeRepoId!==null);jr(()=>{t.connect()});let u=()=>{r.releaseOnUnload()};jr(()=>{window.addEventListener(`pagehide`,u)}),Fr(()=>{window.removeEventListener(`pagehide`,u)});let d=!0,f=null;function p(){d=!1,f!==null&&(clearTimeout(f),f=null)}function m(e){t.activeRepoId===null&&e.length!==0&&a(e[0])}let h=cu({onRestore:_}),g=V(null);async function _(e,n){if(i.setWorkOpen(e.work),e.work||e.view===null&&e.repo===null)return;e.repo!==null&&t.suspendFollowNavigation(cD);let r=t.activeRepoId===null;r&&e.view!==null&&i.setActiveView(e.view),(await y(e,n)||v(e,n))&&(!r&&e.view!==null&&i.setActiveView(e.view),e.view!==null&&await b(e,n))}function v(e,t){return!t.isStale()&&e.repo!==null&&r.repoId===null&&r.repoPath===h.toAbsolute(e.repo)}async function y(e,t){return e.repo===null||h.isActiveRepo(e.repo)?!0:(await h.whenHomeReady,t.isStale()||!await o(h.toAbsolute(e.repo))||t.isStale()?!1:(await On(),!t.isStale()))}async function b(e,t){switch(g.value=null,e.view){case`explorer`:e.at===null?n.clearSelection():e.at!==n.selectedPath&&await n.revealFile(e.at);return;case`history`:await S(e.at,e.whole,t);return;case`compare`:await C(e,t);return;case`changes`:x(e.at,e.whole);return;default:return}}function x(e,t=null){if(e===null){r.selectFile(null),i.setActiveStackKey(null),r.setWholeFile(null);return}let n=r.shared.status?.files;if(!n){g.value={view:`changes`,at:e,whole:t,repoPath:r.repoPath};return}let a=e.slice(e.indexOf(`:`)+1),o=n.find(t=>Ml(t)===e)??n.find(e=>e.path===a)??null;if(!o)return;r.selectFile(o);let s=Ml(o);i.setActiveStackKey(s),i.requestStackScroll(s),r.setWholeFile(t===o.path?{view:`changes`,key:s,path:o.path}:null)}async function S(e,t,n){if(e===null){await r.selectHistoryCommit(null),r.setWholeFile(null);return}let i=e=>{r.setWholeFile(t===null?null:{view:`history`,key:`h:${e}:${t}`,path:t,hash:e})};if(r.history.selectedCommit?.hash.startsWith(e)){i(r.history.selectedCommit.hash);return}let a=r.history.commits.find(t=>t.hash.startsWith(e));if(a){await r.selectHistoryCommit(a),i(a.hash);return}let o=await r.resolveCommit(e);o===null||n.isStale()||(await r.selectHistoryCommit(o),i(o.hash))}async function C(e,t){let n=e.base!==null&&e.base!==r.selectedCompareBase?e.base:void 0;if((n!==void 0||e.head!==r.selectedStackHead)&&(await r.setComparePick({base:n,head:e.head}),t.isStale()))return;if(e.at===null){r.setWholeFile(null);return}let a=r.compare.compareDiff?.files;if(!a){g.value={view:`compare`,at:e.at,whole:e.whole,repoPath:r.repoPath};return}let o=a.findIndex(t=>t.path===e.at);if(o===-1)return;r.selectCompareFile(o);let s=a[o];i.requestStackScroll(Nl(s)),r.setWholeFile(e.whole===s.path?{view:`compare`,key:Nl(s),path:s.path,side:s.uncommitted}:null)}function w(e){return e.repoPath===r.repoPath||(g.value=null,!1)}return W(()=>r.shared.status,()=>{let e=g.value;e?.view===`changes`&&i.activeView===`changes`&&w(e)&&(g.value=null,x(e.at,e.whole??null))}),W(()=>r.compare.compareDiff,e=>{let t=g.value;if(t?.view!==`compare`||i.activeView!==`compare`||!e||!w(t))return;g.value=null;let n=e.files.findIndex(e=>e.path===t.at);if(n===-1)return;r.selectCompareFile(n);let a=e.files[n];i.requestStackScroll(Nl(a)),r.setWholeFile(t.whole===a.path?{view:`compare`,key:Nl(a),path:a.path,side:a.uncommitted}:null)}),(h.initial.view!==null||h.initial.repo!==null||h.initial.work)&&(h.initial.repo!==null&&(p(),t.skipInitialFollow=!0),h.restore(h.initial)),W([()=>t.repos,()=>t.follow],([e,n])=>{d&&(n===null?f===null&&e.length>0&&(f=setTimeout(()=>{f=null,d&&(p(),m(t.repos))},sD)):(p(),!(t.followEnabled&&n.followedRepoId!==null&&n.followedPath!==null)&&m(e)))}),Fr(()=>{f!==null&&clearTimeout(f)}),(e,n)=>(q(),J(`div`,aD,[ba(Bf),U(i).workOpen?Q(``,!0):(q(),Y(ep,{key:0})),U(i).workOpen?Q(``,!0):(q(),Y(tp,{key:1})),X(`main`,oD,[U(i).workOpen?(q(),Y(tD,{key:0})):l.value?(q(),Y(Hr(c.value),{key:U(t).activeRepoId??``})):(q(),Y(pp,{key:1}))]),ba(up),U(i).activeOverlay===`finder`?(q(),Y(Op,{key:2})):U(i).activeOverlay===`search`?(q(),Y(Hp,{key:3})):U(i).activeOverlay===`help`?(q(),Y(Qp,{key:4})):U(i).activeOverlay===`settings`?(q(),Y(Pm,{key:5})):Q(``,!0),ba(iD)]))}}),[[`__scopeId`,`data-v-7d8dd518`]]),uD={black:`#000000`,red:`#cd0000`,green:`#00cd00`,yellow:`#cdcd00`,blue:`#0000ee`,magenta:`#cd00cd`,cyan:`#00cdcd`,white:`#e5e5e5`,gray:`#7f7f7f`,grey:`#7f7f7f`,blackBright:`#7f7f7f`,redBright:`#ff0000`,greenBright:`#00ff00`,yellowBright:`#ffff00`,blueBright:`#5c5cff`,magentaBright:`#ff00ff`,cyanBright:`#00ffff`,whiteBright:`#ffffff`};function dD(e){if(e.startsWith(`#`))return e.toLowerCase();let t=uD[e];if(!t)throw Error(`unknown color name: ${e}`);return t}function fD(e){return[`--diff-add-bg: ${dD(e.addBg)};`,`--diff-del-bg: ${dD(e.delBg)};`,`--diff-add-highlight: ${dD(e.addHighlight)};`,`--diff-del-highlight: ${dD(e.delHighlight)};`,`--diff-text: ${dD(e.text)};`,`--diff-add-line-num: ${dD(e.addLineNum)};`,`--diff-del-line-num: ${dD(e.delLineNum)};`,`--diff-context-line-num: ${dD(e.contextLineNum)};`,`--diff-add-symbol: ${dD(e.addSymbol)};`,`--diff-del-symbol: ${dD(e.delSymbol)};`]}function pD(e){return[`--bg: ${e.bg};`,`--surface: ${e.surface};`,`--surface-raised: ${e.surfaceRaised};`,`--border: ${e.border};`,`--text: ${e.text};`,`--text-dim: ${e.textDim};`,`--accent: ${e.accent};`,`--selection: ${e.selection};`,`--add: ${e.add};`,`--del: ${e.del};`,`--warn: ${e.warn};`,`--status-modified: ${e.statusModified};`,`--status-added: ${e.statusAdded};`,`--status-deleted: ${e.statusDeleted};`,`--status-untracked: ${e.statusUntracked};`,`--status-renamed: ${e.statusRenamed};`,`--status-copied: ${e.statusCopied};`,`--status-conflicted: ${e.statusConflicted};`,`--uncommitted: ${e.uncommitted};`,`--flash: ${e.flash};`]}function mD(e){return[`--syn-keyword: ${e.keyword};`,`--syn-string: ${e.string};`,`--syn-comment: ${e.comment};`,`--syn-number: ${e.number};`,`--syn-literal: ${e.literal};`,`--syn-title: ${e.title};`,`--syn-attr: ${e.attr};`,`--syn-meta: ${e.meta};`]}function hD(e){let t=[`color-scheme: ${e.scheme};`,...pD(e.chrome),...fD(e.colors),...mD(e.syntax)];return`:root[data-theme='${e.name}'] {\n ${t.join(`
|
|
26
|
+
`)}\n}`}function gD(){return Kc.map(e=>hD(Jc[e])).join(`
|
|
27
27
|
|
|
28
28
|
`)+`
|
|
29
|
-
`}function
|
|
29
|
+
`}function _D(e=document){let t=`diffstalker-themes`;if(e.getElementById(t))return;let n=e.createElement(`style`);n.id=t,n.textContent=gD(),e.head.appendChild(n)}async function vD(){_D();let e=es(lD);e.use(bs()),e.mount(`#app`)}vD();
|
package/dist/web/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
7
7
|
<title>diffstalker</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-BWpIPCb9.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-GxZ4XP1Z.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|