@fabiofiorita/porcelain 0.82.2 → 0.83.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/server/src/cli/main.mjs +145 -71
  4. package/web/dist/assets/_-16pZD2GN.js +1 -0
  5. package/web/dist/assets/_paired-B0WyT4V9.js +1 -0
  6. package/web/dist/assets/_paired-Dr6SPIr0.js +1 -0
  7. package/web/dist/assets/{_paired--LzhIV8q.js → _paired-DtlvYTx3.js} +1 -1
  8. package/web/dist/assets/_paired-DwhFACbc.js +1 -0
  9. package/web/dist/assets/{_section-C3rzCQs1.js → _section-BtREvi1c.js} +1 -1
  10. package/web/dist/assets/_worktreeId-B0WyT4V9.js +1 -0
  11. package/web/dist/assets/_worktreeId-BqvleVW2.js +1 -0
  12. package/web/dist/assets/_worktreeId-DwhFACbc.js +1 -0
  13. package/web/dist/assets/{_worktreeId-BDJbQ5Cn.js → _worktreeId-mENbJ8d6.js} +1 -1
  14. package/web/dist/assets/access-FSq50_zr.js +17 -0
  15. package/web/dist/assets/cloneFileDiffMetadata-Cmt5VYmb.js +1 -0
  16. package/web/dist/assets/connected-workspace-CoqMh8ZH.js +1 -0
  17. package/web/dist/assets/desktop-actions-Dp7uXLpd.js +40 -0
  18. package/web/dist/assets/edit-file-u4Jh7DaZ.js +271 -0
  19. package/web/dist/assets/file-editor-CnQvPWI-.js +67 -0
  20. package/web/dist/assets/{index-Bk8Ig0Ne.js → index-C-VbrrPp.js} +3 -3
  21. package/web/dist/assets/index-HBCxqMtr.css +2 -0
  22. package/web/dist/assets/{lazyRouteComponent-DpO3HGey.js → lazyRouteComponent-1k1cz2Rs.js} +1 -1
  23. package/web/dist/assets/pair-B0WyT4V9.js +1 -0
  24. package/web/dist/assets/{pair-CqLMCfsc.js → pair-CDRRpeB2.js} +1 -1
  25. package/web/dist/assets/{settings-page-RYnO3e6i.js → settings-page-C4F13mjh.js} +102 -114
  26. package/web/dist/assets/{useMatch-Dht53RCg.js → useMatch-CfGvegwy.js} +1 -1
  27. package/web/dist/assets/useRouterState-CWTR8rVi.js +1 -0
  28. package/web/dist/assets/{workspace-error-CIsCnenX.js → workspace-error-Cufx_WLE.js} +1 -1
  29. package/web/dist/assets/{workspace-pending-oH5nDvO6.js → workspace-pending-jNTTS2oy.js} +1 -1
  30. package/web/dist/index.html +8 -9
  31. package/web/dist/assets/_-b1prKmSp.js +0 -1
  32. package/web/dist/assets/_paired-B07BAuB3.js +0 -1
  33. package/web/dist/assets/_paired-CqcR1ikJ.js +0 -1
  34. package/web/dist/assets/_paired-D-U8zru5.js +0 -1
  35. package/web/dist/assets/_worktreeId-B07BAuB3.js +0 -1
  36. package/web/dist/assets/_worktreeId-D-U8zru5.js +0 -1
  37. package/web/dist/assets/_worktreeId-D1NaqSVx.js +0 -1
  38. package/web/dist/assets/access-WT1uwdZk.js +0 -17
  39. package/web/dist/assets/cloneFileDiffMetadata-OfK4h7R8.js +0 -1
  40. package/web/dist/assets/connected-workspace-DcS6e5zB.js +0 -1
  41. package/web/dist/assets/desktop-actions-WJQHB849.js +0 -28
  42. package/web/dist/assets/edit-file-CG3WhqLS.js +0 -271
  43. package/web/dist/assets/file-editor-DGtg0rP2.js +0 -67
  44. package/web/dist/assets/index-BoONRxa4.css +0 -2
  45. package/web/dist/assets/pair-D-U8zru5.js +0 -1
  46. package/web/dist/assets/useRouterState-DCsGUMtp.js +0 -1
  47. /package/web/dist/assets/{worker-CcC2iNVI.js → pierre-worker-CcC2iNVI.js} +0 -0
@@ -0,0 +1 @@
1
+ import{t as e}from"./rolldown-runtime-XKyaHtl9.js";var t=e(((e,t,n)=>{(function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):r((n||=self).lru_map=n.lru_map||{})})(n,function(e){let t=Symbol(`newer`),n=Symbol(`older`);class r{constructor(e,t){typeof e!=`number`&&(t=e,e=0),this.size=0,this.limit=e,this.oldest=this.newest=void 0,this._keymap=new Map,t&&(this.assign(t),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[t]&&(e===this.oldest&&(this.oldest=e[t]),e[t][n]=e[n]),e[n]&&(e[n][t]=e[t]),e[t]=void 0,e[n]=this.newest,this.newest&&(this.newest[t]=e),this.newest=e)}assign(e){let r,a=this.limit||Number.MAX_VALUE;this._keymap.clear();let o=e[Symbol.iterator]();for(let e=o.next();!e.done;e=o.next()){let o=new i(e.value[0],e.value[1]);if(this._keymap.set(o.key,o),r?(r[t]=o,o[n]=r):this.oldest=o,r=o,a--==0)throw Error(`overflow`)}this.newest=r,this.size=this._keymap.size}get(e){var t=this._keymap.get(e);return t?(this._markEntryAsUsed(t),t.value):void 0}set(e,r){var a=this._keymap.get(e);return a?(a.value=r,this._markEntryAsUsed(a),this):(this._keymap.set(e,a=new i(e,r)),this.newest?(this.newest[t]=a,a[n]=this.newest):this.oldest=a,this.newest=a,++this.size,this.size>this.limit&&this.shift(),this)}shift(){var e=this.oldest;if(e)return this.oldest[t]?(this.oldest=this.oldest[t],this.oldest[n]=void 0):(this.oldest=void 0,this.newest=void 0),e[t]=e[n]=void 0,this._keymap.delete(e.key),--this.size,[e.key,e.value]}find(e){let t=this._keymap.get(e);return t?t.value:void 0}has(e){return this._keymap.has(e)}delete(e){var r=this._keymap.get(e);return r?(this._keymap.delete(r.key),r[t]&&r[n]?(r[n][t]=r[t],r[t][n]=r[n]):r[t]?(r[t][n]=void 0,this.oldest=r[t]):r[n]?(r[n][t]=void 0,this.newest=r[n]):this.oldest=this.newest=void 0,this.size--,r.value):void 0}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new o(this.oldest)}values(){return new s(this.oldest)}entries(){return this}[Symbol.iterator](){return new a(this.oldest)}forEach(e,n){typeof n!=`object`&&(n=this);let r=this.oldest;for(;r;)e.call(n,r.value,r.key,this),r=r[t]}toJSON(){for(var e=Array(this.size),n=0,r=this.oldest;r;)e[n++]={key:r.key,value:r.value},r=r[t];return e}toString(){for(var e=``,n=this.oldest;n;)e+=String(n.key)+`:`+n.value,n=n[t],n&&(e+=` < `);return e}}e.LRUMap=r;function i(e,r){this.key=e,this.value=r,this[t]=void 0,this[n]=void 0}function a(e){this.entry=e}a.prototype[Symbol.iterator]=function(){return this},a.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}};function o(e){this.entry=e}o.prototype[Symbol.iterator]=function(){return this},o.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.key}):{done:!0,value:void 0}};function s(e){this.entry=e}s.prototype[Symbol.iterator]=function(){return this},s.prototype.next=function(){let e=this.entry;return e?(this.entry=e[t],{done:!1,value:e.value}):{done:!0,value:void 0}}})}));function n({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:r=!1,fitPerfectlyOverscroll:i=0,overscrollSize:a}){let o=n+a*2,s=r?n+i*2:o;if(t=Math.max(t,s),o>=t||r){let n=Math.max(e-i,0),r=Math.min(e+s,t);return{top:n,bottom:Math.max(r,n)}}let c=e+n/2-o/2,l=c+o;return c<0&&(c=0),l>t&&(l=t),c=Math.floor(Math.max(c,0)),{top:c,bottom:Math.ceil(Math.max(Math.min(l,t),c))}}function r(e){return e.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))}))}function i(e){return{...e,hunks:r(e.hunks),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}export{t as i,r as n,n as r,i as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$s as t,Aa as n,B as r,Bs as i,Ca as a,Ci as o,Da as s,Fs as c,Gs as l,Hc as u,Ho as d,Io as f,Ko as p,L as m,Lo as h,Ma as g,Ms as _,N as v,Oa as y,On as b,Qo as x,R as S,Ui as C,Us as w,V as T,Wo as E,Yi as D,Yo as O,ai as k,bi as A,c as ee,ca as j,cc as te,ci as ne,cn as re,da as M,dc as N,fi as P,g as ie,h as F,hl as I,ja as ae,jn as oe,ka as L,lc as se,li as ce,oc as R,ol as le,pa as z,qi as B,to as ue,ts as de,ua as V,uc as fe,ul as pe,xi as H,xn as me,z as he,zo as U}from"./access-FSq50_zr.js";import{$ as ge,B as W,En as G,L as _e,M as ve,N as ye,On as be,P as xe,Qt as K,V as Se,Y as Ce,_t as we,at as Te,bn as Ee,et as De,it as Oe,lt as ke,m as Ae,n as je,nt as Me,rt as Ne,tt as Pe,vt as q,x as Fe,xn as Ie,z as Le}from"./settings-page-C4F13mjh.js";import{$r as Re,G as ze,Qr as J,W as Be,Xr as Y,Yr as Ve,Zr as He}from"./edit-file-u4Jh7DaZ.js";import{_ as Ue,a as We,c as Ge,d as Ke,f as qe,g as Je,h as Ye,i as Xe,l as Ze,m as Qe,n as $e,o as et,p as tt,r as nt,s as rt,u as it,v as at,x as ot,y as st}from"./desktop-actions-Dp7uXLpd.js";var ct={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};ct.node;var lt=y(ct),ut={name:`compass`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]};ut.node;var dt=y(ut),ft={name:`folder-x`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}],[`path`,{d:`m9.5 10.5 5 5`,key:`ra9qjz`}],[`path`,{d:`m14.5 10.5-5 5`,key:`l2rkpq`}]]};ft.node;var pt=y(ft);function mt(e){let t=e.walkthrough;if(t===void 0)return{kind:`unwritten`};switch(t.state.status){case`queued`:case`running`:return{kind:`writing`,run:t};case`failed`:return{kind:`failed`,run:t,failure:t.state.failure};case`ready`:return{kind:`ready`,run:t,content:t.state.content,freshness:e.freshness,attempt:e.attempt}}}function ht(e){return e.walkthrough===void 0?`changes`:`walkthrough`}var gt=[`One`,`Two`,`Three`,`Four`,`Five`];function _t(e){return e.stops.flatMap((e,t)=>e.attention===void 0?[]:[{stop:e,step:t+1,attention:e.attention}])}function vt(e){let t=_t(e).length;return e.outcome===`nothing`?`Nothing needs you.`:e.outcome===`worth_knowing`||t===0?`Worth knowing.`:t===1?`One call is yours.`:`${gt[t-1]??t} calls are yours.`}function yt(e,t=[]){let n=[...e.excerpts.map(e=>e.path),...e.files.map(e=>e.path)],r=t.flatMap(e=>e.oldPath!==void 0&&n.includes(e.oldPath)?[e.path]:[]);return[...new Set([...n,...r])]}function bt(e){return new Set(e.stops.flatMap(e=>yt(e))).size}function xt(e,t){return e.has(t.path)||t.oldPath!==void 0&&e.has(t.oldPath)}function St(e,t,n=[]){let r=new Set;return{steps:e.stops.map((e,i)=>{let a=new Set(yt(e,n)),o=t.filter(e=>xt(a,e));for(let e of o)r.add(e);return{stop:e,step:i+1,files:o}}),outside:t.filter(e=>!r.has(e))}}var Ct={claude:`Claude`,codex:`Codex`},wt={claude:`claude auth login`,codex:`codex login`};function Tt(e,t){let n=Ct[t.provider];switch(e.kind){case`signed_out`:return{title:`Sign in to ${n} again with ${wt[t.provider]}, then try again.`,message:``,command:wt[t.provider]};case`agent_not_installed`:return{title:`${n} isn't installed here.`,message:e.message};case`timed_out`:return{title:`The walkthrough took too long.`,message:e.message};case`unusable_output`:return{title:`${n} wrote something unreadable.`,message:e.message};case`other`:return{title:`The walkthrough didn't finish.`,message:e.message}}}var Et=new Set([`signed_out`,`agent_not_installed`,`timed_out`,`unusable_output`,`other`]);function Dt(e){return typeof e==`string`&&Et.has(e)}function Ot(e){return typeof e==`object`&&e&&`kind`in e&&`message`in e&&Dt(e.kind)&&typeof e.message==`string`?{kind:e.kind,message:e.message}:{kind:`other`,message:e instanceof Error&&e.message!==``?e.message:`Porcelain could not start the walkthrough.`}}function kt(e){let t=(e.branch===void 0?void 0:e.pullRequests?.find(t=>t.headBranch===e.branch&&t.state===`open`)?.number)??e.displayedRun?.pullRequestNumber;return{...e.base===void 0?{}:{base:e.base},...t===void 0?{}:{pullRequestNumber:t}}}function At(e){let t=mt(e);return t.kind===`ready`?jt(t.content.title).replace(/\.$/,``):`Walkthrough`}function jt(e){return e.replaceAll("`",``)}function Mt(e){return e.split(/(`[^`]+`)/).filter(e=>e!==``).map(e=>e.length>2&&e.startsWith("`")&&e.endsWith("`")?{kind:`code`,text:e.slice(1,-1)}:{kind:`text`,text:e})}function Nt({branch:e,worktree:t,only:n}){let r=e=>[...new Set(e.filter(e=>n===void 0||n.includes(e.path)||e.oldPath!==void 0&&n.includes(e.oldPath)).map(e=>e.path))],i=t.flatMap(e=>[e,...(e.comparisons??[]).flatMap(t=>`oldPath`in t?[{path:e.path,oldPath:t.oldPath}]:[])]);return{branch:r(e),worktree:r(i)}}var X=e(_(),1),Z=E(),Pt=c(e=>B(e.connection).fn(u(`Walkthroughs.start`)(function*(n){let r=yield*D(e.connection,t=>t.walkthroughs.startWalkthrough({params:{worktreeId:e.scope.worktreeId},payload:n}));return yield*t([C.reviewSurface(e.connection.environmentId,e.scope,[`walkthrough`])]),r})));function Ft([e,t],n){let r=I(N(n.pulls)),i=kt({...n,pullRequests:r?.kind===`available`?r.pullRequests:void 0}),a=I(N(e));return{accepted:a?.branch===n.branch?a:void 0,waiting:se(e),failure:R(e)?Ot(pe(e.cause)):void 0,start:()=>void t(i)}}var It=c(({connection:e,scope:n,runId:r})=>{let i=B(e),a={worktreeId:n.worktreeId,runId:r},o=t([C.reviewSurface(e.environmentId,n,[`walkthrough-conversations`])]),s=e=>({...a,messageId:e});return{addMessage:i.fn(u(`Walkthroughs.addMessage`)(function*(t){let n=yield*D(e,e=>e.walkthroughs.addWalkthroughMessage({params:a,payload:t}));return yield*o,n})),retryAnswer:i.fn(u(`Walkthroughs.retryAnswer`)(function*(t){let n=yield*D(e,e=>e.walkthroughs.retryWalkthroughAnswer({params:s(t)}));return yield*o,n})),saveMessage:i.fn(u(`Walkthroughs.saveMessage`)(function*(t){let n=yield*D(e,e=>e.walkthroughs.saveWalkthroughMessage({params:s(t.messageId),payload:{saved:t.saved}}));return yield*o,n})),postMessage:i.fn(u(`Walkthroughs.postMessage`)(function*(t){let n=yield*D(e,e=>e.walkthroughs.postWalkthroughMessage({params:s(t)}));return yield*o,n})),readBrief:i.fn(u(`Walkthroughs.readBrief`)(function*(t){return(yield*D(e,e=>e.walkthroughs.readWalkthroughBrief({params:a,query:t===void 0?{}:{messageId:t}}))).text})),postSavedMessages:i.fn(u(`Walkthroughs.postSavedMessages`)(function*(){let t=yield*D(e,e=>e.walkthroughs.postSavedWalkthroughMessages({params:a}));return yield*o,t}))}});function Lt([e,t]){return{waiting:se(e),run:async e=>{let n=await t(e);if(le(n))throw pe(n.cause);return n.value}}}var Rt=u(`Walkthroughs.readConversations`)(function*({connection:e,scope:t,runId:n}){return yield*D(e,e=>e.walkthroughs.listWalkthroughConversations({params:{worktreeId:t.worktreeId,runId:n}}))}),zt=c(e=>o(e.connection,e.scope,[`walkthrough-conversations`,e.runId],Rt(e),B(e.connection)).pipe(H)),Bt=c(e=>A(e,[`walkthrough`],t=>t.walkthroughs.readWalkthrough({params:{worktreeId:e.scope.worktreeId}}),t=>t.walkthrough===void 0||t.walkthrough.worktreeId===e.scope.worktreeId)),Vt=c(e=>A(e,[`walkthrough-asset`,e.runId,e.assetId],t=>t.walkthroughs.readWalkthroughAsset({params:{worktreeId:e.scope.worktreeId,runId:e.runId,assetId:e.assetId}})));function Ht(e,t){let n=I(N(e));return n===void 0?R(e)?{status:`failed`}:{status:`reading`}:{status:`read`,value:t(n)}}function Ut(e,t){return e.conversations.filter(e=>e.anchor.kind===t.kind&&(e.anchor.kind===`walkthrough`||t.kind===`stop`&&e.anchor.title===t.title))}function Wt(e){return e.messages.filter(e=>e.author===`developer`)}function Gt(e,t){return e.messages.find(e=>e.author===`agent`&&e.replyTo===t)}function Kt(e){return e.conversations.flatMap(Wt).filter(e=>e.post.status===`saved`).length}function qt(e){return e===void 0||e.post.status===`none`?`available`:e.post.status}function Jt(e,t){return(e?.conversations??[]).filter(({anchor:e})=>e.kind===`walkthrough`||!t.includes(e.title))}function Yt(e){return typeof e==`object`&&e&&(`status`in e&&e.status===409||`name`in e&&e.name===`WalkthroughRepositoryChangedError`)?{text:`Nothing was posted. Copy the brief instead.`,copy:!0}:{text:e instanceof Error?e.message:`The request failed. Try again.`,copy:!1}}var Xt=/^[a-z][a-z\d+.-]*:\/\/[^/?#\s]+(\/[^?#\s]*)?(?:[?#]\S*)?$/i,Zt=/\/(?:pull|issues)\/([1-9]\d*)\/?$/;function Qt(e){let t=Xt.exec(e)?.[1]??``,n=Zt.exec(t)?.[1];return n===void 0?`Posted comment`:`Posted on #${n}`}function $t(e){return e===void 0?{single:`Copy as prompt`,together:`Copy together`}:{single:`Post on #${e}`,together:`Post together on #${e}`}}function en(e){return Wt(e).map(t=>({message:t,reply:Gt(e,t.id)}))}function tn(e,t){return e?Ut(e,{kind:`stop`,title:t}):[]}function nn(e){let t=e?Kt(e):0;if(t!==0)return t===1?`1 comment saved`:`${t} comments saved`}function rn(e){let{outcome:t}=e;return t.status===`brief`?{kind:`brief`,text:t.text}:t.status!==`posted`||t.notPosted.length===0?{kind:`done`}:{kind:`still-saved`,messages:e.view.conversations.flatMap(Wt).filter(e=>t.notPosted.includes(e.id))}}function an(e){let t=e.walkthrough.status===`read`?e.walkthrough.value:void 0;return{name:ht(t??{walkthrough:void 0,freshness:`unknown`}),pending:e.walkthrough.status===`reading`,guided:t?.walkthrough!==void 0,companion:t!==void 0&&t.walkthrough===void 0}}var on={product:`Product call`,contract:`Contract call`,tradeoff:`Tradeoff`,risk:`Risk to accept`,accessibility:`Accessibility call`};function sn(e){return on[e.kind]}var cn={added:`+`,changed:`~`,removed:`−`};function ln(e){return cn[e.change]}var un=4,dn=7,fn=3;function pn(e,t){let n=e.growth;return{shown:t?n:n.slice(0,un),hidden:t?0:Math.max(0,n.length-un)}}function mn(e,t){let n=e.onlyInTranscript.length+e.stillUnclear.length,r=t?e.onlyInTranscript:e.onlyInTranscript.slice(0,fn),i=t?e.stillUnclear:e.stillUnclear.slice(0,Math.max(0,fn-r.length));return{explained:r,unclear:i,total:n,hidden:n-r.length-i.length}}function hn(e,t){let n=t?bt(t):0;return[...e.pullRequestNumber===void 0?[]:[`#${e.pullRequestNumber}`],...n>0?[n===1?`1 file`:`${n} files`]:[],`written for ${e.headOid.slice(0,dn)}${e.includesUncommitted?` and uncommitted work`:``}`].join(` · `)}function gn(e,t){return Tt(e,t?.writer??{provider:`claude`,model:``,effort:`high`})}function _n(e,t){let n=e.attempt,r=n?.state.status,i=n?.state.status===`failed`?{failure:n.state.failure,writer:n.writer}:void 0;return{updating:t.waiting||r===`queued`||r===`running`,failure:t.failure?{failure:t.failure,writer:n?.writer??e.run.writer}:i}}function vn(e){switch(e.evidenceUnavailable){case`head_mismatch`:return`Screenshots and checks are not shown: the pull request is at another commit. Push, then update.`;case`github_account`:return`Screenshots and checks are not shown: choose a GitHub account for this project, then update.`;case`github_unavailable`:return`Screenshots and checks are not shown: GitHub could not be reached. Try updating later.`;case void 0:return}}var yn=[`queued`,`evidence`,`transcript`,`writing`,`validating`,`ready`],bn={queued:`Queued`,evidence:`Reading pull request evidence`,transcript:`Reading the coding conversation`,writing:`Writing the walkthrough`,validating:`Checking the walkthrough`,ready:`Walkthrough saved`,failed:`Update failed`};function xn(e,t){if(!t)return e;let n=e.attempt??e.walkthrough;return n&&(n.id===t.id||n.createdAt>t.createdAt||n.branch!==t.branch)?e:e.walkthrough?.state.status===`ready`&&t.state.status!==`ready`?{...e,attempt:t}:{walkthrough:t,freshness:`unknown`}}function Sn(e,t){let n=e.progress??[],r=n.at(-1),i=e.state.status===`failed`?`failed`:e.state.status===`ready`?`ready`:r?.stage??(e.state.status===`queued`?`queued`:`writing`),a=n.filter(e=>e.stage!==`failed`).at(-1)?.stage,o=i===`failed`?Math.max(0,yn.findIndex(e=>e===a)):Math.max(0,yn.findIndex(e=>e===i));return{label:t?`Requesting update`:bn[i],completed:t?0:o,total:yn.length-1,entries:n,steps:yn.map(e=>bn[e]),active:t||e.state.status===`queued`||e.state.status===`running`}}function Cn(e){switch(e){case`current`:return`Up to date with the current work.`;case`unknown`:return`Couldn’t check whether the work changed. Your saved walkthrough is still available.`;case`changed`:return`The work changed after this walkthrough’s snapshot. Update to include the latest changes.`}}function wn(e,t){return{connection:t.connection,scope:{projectId:e.projectId,worktreeId:e.worktreeId}}}var Tn=c(e=>Bt(e).pipe(w,l(0)));function En(e,t){let n=(0,Z.c)(12),r;n[0]!==t||n[1]!==e?(r=Tn(wn(e,t)),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i=r,a=d(i),o,s,c;if(n[3]!==a){let e=I(N(a));o=a,s=e,c=e?mt(e):void 0,n[3]=a,n[4]=o,n[5]=s,n[6]=c}else o=n[4],s=n[5],c=n[6];let l=U(i),u;return n[7]!==o||n[8]!==s||n[9]!==c||n[10]!==l?(u={result:o,read:s,phase:c,refresh:l},n[7]=o,n[8]=s,n[9]=c,n[10]=l,n[11]=u):u=n[11],u}function Dn(e,t){let{phase:n}=En(e,t);return n?.kind===`ready`?n:void 0}function On(e,t,n){let r=(0,Z.c)(2),i=ke(e,t.connection,n).result,a;return r[0]===i?a=r[1]:(a=I(N(i))?.files??[],r[0]=i,r[1]=a),a}function kn(e,t){let n=(0,Z.c)(2),{read:r}=En(e,t),i;return n[0]===r?i=n[1]:(i=r?At(r):`Walkthrough`,n[0]=r,n[1]=i),i}function An(e,t){let n=(0,Z.c)(2),{result:r}=En(e,t),i;return n[0]===r?i=n[1]:(i=an({walkthrough:Ht(r,jn)}),n[0]=r,n[1]=i),i}function jn(e){return e}var Mn=c(e=>i(t=>{let n=t(Vt(e));return fe(n,e=>{let n=URL.createObjectURL(new Blob([Uint8Array.from(e)]));return t.addFinalizer(()=>URL.revokeObjectURL(n)),n})}));function Nn(e){let t=(0,Z.c)(5),n;return t[0]!==e.assetId||t[1]!==e.context||t[2]!==e.runId||t[3]!==e.scope?(n=Mn({...wn(e.scope,e.context),runId:e.runId,assetId:e.assetId}),t[0]=e.assetId,t[1]=e.context,t[2]=e.runId,t[3]=e.scope,t[4]=n):n=t[4],d(n)}function Pn(e,t,n,r){let i=(0,Z.c)(8),a;i[0]!==t.connection||i[1]!==e.projectId||i[2]!==e.worktreeId?(a=Pt({connection:t.connection,scope:{projectId:e.projectId,worktreeId:e.worktreeId}}),i[0]=t.connection,i[1]=e.projectId,i[2]=e.worktreeId,i[3]=a):a=i[3];let o;i[4]===Symbol.for(`react.memo_cache_sentinel`)?(o={mode:`promiseExit`},i[4]=o):o=i[4];let[s,c]=f(a,o),l=I(N(q(e,t.connection))),u;i[5]!==t.connection||i[6]!==e.projectId?(u=P({connection:t.connection,projectId:e.projectId}),i[5]=t.connection,i[6]=e.projectId,i[7]=u):u=i[7];let p=d(u);return Ft([s,c],{pulls:p,branch:l?.branch?.name??r?.branch,displayedRun:r,base:n})}var Q=de();function $(e){let t=(0,Z.c)(4),{text:n}=e,r;t[0]===n?r=t[1]:(r=Mt(n).map(Fn),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Q.jsx)(Q.Fragment,{children:r}),t[2]=r,t[3]=i),i}function Fn(e,t){return e.kind===`code`?(0,Q.jsx)(`code`,{className:`rounded bg-muted px-1 py-px font-mono text-[0.86em]`,children:e.text},t):e.text}var In=ae(`group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full`,{variants:{variant:{default:`*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80`,secondary:`*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]`,muted:`*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]`,tinted:`*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]`,outline:`*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30`,ghost:`border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50`,destructive:`*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30`}},defaultVariants:{variant:`default`}});function Ln({variant:e=`default`,align:t=`start`,className:n,...r}){return(0,Q.jsx)(`div`,{"data-slot":`bubble`,"data-variant":e,"data-align":t,className:g(In({variant:e}),n),...r})}function Rn({className:e,render:t,...n}){return re({defaultTagName:`div`,props:ue({className:g(`w-fit max-w-full min-w-0 overflow-hidden rounded-lg border border-transparent px-2.5 py-1.5 text-xs/relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-2 [button,a]:focus-visible:ring-ring/30`,e)},n),render:t,state:{slot:`bubble-content`}})}ae(`absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-xs ring-2 ring-card has-[button]:p-0`,{variants:{side:{top:`top-0 -translate-y-3/4`,bottom:`bottom-0 translate-y-3/4`},align:{start:`left-3`,end:`right-3`}},defaultVariants:{side:`bottom`,align:`end`}});function zn({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`message-group`,className:g(`flex min-w-0 flex-col gap-1.5`,e),...t})}function Bn({className:e,align:t=`start`,...n}){return(0,Q.jsx)(`div`,{"data-slot":`message`,"data-align":t,className:g(`group/message relative flex w-full min-w-0 gap-1.5 text-xs/relaxed data-[align=end]:flex-row-reverse`,e),...n})}function Vn({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`message-content`,className:g(`flex w-full min-w-0 flex-col gap-2 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end`,e),...t})}function Hn({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`message-header`,className:g(`flex max-w-full min-w-0 items-center px-2.5 text-[0.625rem] font-medium text-muted-foreground group-has-data-[variant=ghost]/message:px-0`,e),...t})}function Un({scope:e,context:t,runId:n}){return{connection:t.connection,runId:n,scope:{projectId:e.projectId,worktreeId:e.worktreeId}}}function Wn(e){let t=(0,Z.c)(10),n;t[0]===e?n=t[1]:(n=zt(Un(e)),t[0]=e,t[1]=n);let r=n,i=d(r),a;t[2]===i?a=t[3]:(a=I(N(i)),t[2]=i,t[3]=a);let o;t[4]===i?o=t[5]:(o=R(i),t[4]=i,t[5]=o);let s=U(r),c;return t[6]!==a||t[7]!==o||t[8]!==s?(c={view:a,failed:o,refresh:s},t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function Gn(e){let t=(0,Z.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={mode:`promiseExit`},t[0]=n):n=t[0];let r=f(e,n),i;return t[1]===r?i=t[2]:(i=Lt(r),t[1]=r,t[2]=i),i}function Kn(e){let t=(0,Z.c)(9),n;t[0]===e?n=t[1]:(n=It(Un(e)),t[0]=e,t[1]=n);let r=n,i=Gn(r.addMessage),a=Gn(r.retryAnswer),o=Gn(r.saveMessage),s=Gn(r.postMessage),c=Gn(r.postSavedMessages),l=Gn(r.readBrief),u;return t[2]!==i||t[3]!==a||t[4]!==o||t[5]!==s||t[6]!==c||t[7]!==l?(u={add:i,retry:a,save:o,post:s,postSaved:c,brief:l},t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u):u=t[8],u}function qn(e,t){let n=(0,Z.c)(17),r=Kn(e),[i,a]=(0,X.useState)(),o=r.post.waiting||r.postSaved.waiting||r.save.waiting||r.brief.waiting,s;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=e=>a(Yt(e)),n[0]=s):s=n[0];let c=s,l;n[1]!==r.brief||n[2]!==t?.id?(l=()=>void r.brief.run(t?.id).then(Yn,c),n[1]=r.brief,n[2]=t?.id,n[3]=l):l=n[3];let u=l,d;n[4]!==r.save||n[5]!==t?(d=e=>{t&&r.save.run({messageId:t.id,saved:e}).catch(c)},n[4]=r.save,n[5]=t,n[6]=d):d=n[6];let f=d,p;n[7]!==r.post||n[8]!==r.postSaved||n[9]!==t?(p=()=>{a(void 0),(t?r.post.run(t.id):r.postSaved.run(void 0)).then(e=>{let t=rn(e);t.kind===`brief`&&j(t.text,`brief`,!1),t.kind===`still-saved`&&a({text:`Still saved: ${t.messages.map(Jn).join(`; `)}. These comments belong to a different repository.`,copy:!1})},c)},n[7]=r.post,n[8]=r.postSaved,n[9]=t,n[10]=p):p=n[10];let m=p,h;return n[11]!==u||n[12]!==i||n[13]!==m||n[14]!==f||n[15]!==o?(h={notice:i,waiting:o,copy:u,save:f,post:m},n[11]=u,n[12]=i,n[13]=m,n[14]=f,n[15]=o,n[16]=h):h=n[16],h}function Jn(e){return e.text}function Yn(e){e&&j(e,`brief`,!1)}function Xn(e,t){let n=(0,Z.c)(7),[r,i]=(0,X.useState)(),a=Kn(e),o;n[0]!==a.retry||n[1]!==t?(o=()=>{i(void 0),a.retry.run(t).catch(e=>i(Yt(e).text))},n[0]=a.retry,n[1]=t,n[2]=o):o=n[2];let s=o,c;return n[3]!==a.retry.waiting||n[4]!==r||n[5]!==s?(c={failure:r,waiting:a.retry.waiting,retry:s},n[3]=a.retry.waiting,n[4]=r,n[5]=s,n[6]=c):c=n[6],c}function Zn(e){let t=(0,Z.c)(6),[n,r]=(0,X.useState)(),i=Kn(e),a;t[0]===i.add?a=t[1]:(a=(e,t)=>{r(void 0),i.add.run(e).then(t,e=>r(Yt(e).text))},t[0]=i.add,t[1]=a);let o;return t[2]!==i.add.waiting||t[3]!==n||t[4]!==a?(o={failure:n,waiting:i.add.waiting,send:a},t[2]=i.add.waiting,t[3]=n,t[4]=a,t[5]=o):o=t[5],o}function Qn(e){let t=(0,Z.c)(27),{owner:n,message:r,number:i}=e,{notice:a,waiting:o,copy:s,save:c,post:l}=qn(n,r),u;t[0]===r?u=t[1]:(u=qt(r),t[0]=r,t[1]=u);let d=u,f=i===void 0?s:l,p;t[2]===i?p=t[3]:(p=$t(i),t[2]=i,t[3]=p);let m=p,h;t[4]!==r||t[5]!==d?(h=d===`posted`&&r?.post.status===`posted`?(0,Q.jsx)(`a`,{className:`text-caption text-muted-foreground hover:underline`,href:r.post.url,target:`_blank`,rel:`noreferrer`,children:Qt(r.post.url)}):null,t[4]=r,t[5]=d,t[6]=h):h=t[6];let g;t[7]!==c||t[8]!==d||t[9]!==o?(g=d===`saved`&&(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 text-caption text-muted-foreground`,children:[`Saved for later`,(0,Q.jsx)(L,{variant:`link`,size:`sm`,disabled:o,onClick:()=>c(!1),children:`Undo`})]}),t[7]=c,t[8]=d,t[9]=o,t[10]=g):g=t[10];let _;t[11]!==f||t[12]!==m||t[13]!==r||t[14]!==c||t[15]!==d||t[16]!==o?(_=d===`available`&&(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Q.jsx)(L,{size:`sm`,variant:r?`outline`:`default`,disabled:o,onClick:f,children:r?m.single:m.together}),r&&(0,Q.jsx)(L,{variant:`link`,size:`sm`,disabled:o,onClick:()=>c(!0),children:`Save for later`})]}),t[11]=f,t[12]=m,t[13]=r,t[14]=c,t[15]=d,t[16]=o,t[17]=_):_=t[17];let v;t[18]!==s||t[19]!==a||t[20]!==o?(v=a&&(0,Q.jsxs)(`div`,{role:`status`,className:`text-caption text-muted-foreground`,children:[a.text,a.copy&&(0,Q.jsx)(L,{variant:`link`,size:`sm`,disabled:o,onClick:()=>s(),children:`Copy`})]}),t[18]=s,t[19]=a,t[20]=o,t[21]=v):v=t[21];let y;return t[22]!==h||t[23]!==g||t[24]!==_||t[25]!==v?(y=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[h,g,_,v]}),t[22]=h,t[23]=g,t[24]=_,t[25]=v,t[26]=y):y=t[26],y}function $n(e){let t=(0,Z.c)(33),{message:n,children:r,owner:i}=e,[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(!1),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>e=>{if(!e)return;let t=()=>c(e.scrollHeight>e.clientHeight);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},t[0]=l):l=t[0];let[u]=(0,X.useState)(l),{failure:d,waiting:f,retry:p}=Xn(i,n.replyTo),m=n.state,h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(Hn,{children:`Walkthrough agent`}),t[1]=h):h=t[1];let g;t[2]!==a||t[3]!==m.status||t[4]!==m.text?(g=m.status===`answered`?(0,Q.jsx)(`span`,{ref:u,className:a?void 0:`line-clamp-3`,children:(0,Q.jsx)($,{text:m.text})}):null,t[2]=a,t[3]=m.status,t[4]=m.text,t[5]=g):g=t[5];let _;t[6]===m.status?_=t[7]:(_=m.status===`answering`&&(0,Q.jsx)(`span`,{role:`status`,className:`text-muted-foreground`,children:`Working…`}),t[6]=m.status,t[7]=_);let v;t[8]!==m.failure||t[9]!==m.status?(v=m.status===`failed`&&(0,Q.jsx)(`span`,{children:m.failure.message}),t[8]=m.failure,t[9]=m.status,t[10]=v):v=t[10];let y;t[11]!==g||t[12]!==_||t[13]!==v?(y=(0,Q.jsx)(Ln,{variant:`ghost`,className:`max-w-full`,children:(0,Q.jsxs)(Rn,{className:`whitespace-pre-wrap`,children:[g,_,v]})}),t[11]=g,t[12]=_,t[13]=v,t[14]=y):y=t[14];let b;t[15]!==s||t[16]!==a||t[17]!==m.status?(b=m.status===`answered`&&!a&&s&&(0,Q.jsx)(L,{variant:`link`,size:`sm`,onClick:()=>o(!0),children:`Read all`}),t[15]=s,t[16]=a,t[17]=m.status,t[18]=b):b=t[18];let x;t[19]!==p||t[20]!==m.status||t[21]!==f?(x=m.status===`failed`&&(0,Q.jsx)(L,{variant:`link`,size:`sm`,disabled:f,onClick:()=>p(),children:`Try again`}),t[19]=p,t[20]=m.status,t[21]=f,t[22]=x):x=t[22];let S;t[23]!==r||t[24]!==b||t[25]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[b,x,r]}),t[23]=r,t[24]=b,t[25]=x,t[26]=S):S=t[26];let C;t[27]===d?C=t[28]:(C=d&&(0,Q.jsx)(`p`,{role:`alert`,children:d}),t[27]=d,t[28]=C);let w;return t[29]!==C||t[30]!==y||t[31]!==S?(w=(0,Q.jsx)(Bn,{children:(0,Q.jsxs)(Vn,{children:[h,y,S,C]})}),t[29]=C,t[30]=y,t[31]=S,t[32]=w):w=t[32],w}function er({conversation:e,owner:t,number:n}){return en(e).map(({message:e,reply:r})=>{let i=(0,Q.jsx)(Qn,{owner:t,message:e,number:n});return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(Bn,{align:`end`,children:(0,Q.jsx)(Vn,{children:(0,Q.jsx)(Ln,{align:`end`,variant:`secondary`,children:(0,Q.jsx)(Rn,{className:`whitespace-pre-wrap`,children:(0,Q.jsx)($,{text:e.text})})})})}),r?(0,Q.jsx)($n,{owner:t,message:r,children:i}):(0,Q.jsx)(`div`,{className:`flex justify-end`,children:i})]},e.id)})}function tr(e){let t=(0,Z.c)(32),{owner:n,anchor:r,placeholder:i}=e,[a,o]=(0,X.useState)(``),{failure:s,waiting:c,send:l}=Zn(n),u;t[0]!==r||t[1]!==a||t[2]!==l||t[3]!==c?(u=()=>{let e=a.trim();e&&!c&&l({anchor:r,text:e},()=>o(e=>e===a?``:e))},t[0]=r,t[1]=a,t[2]=l,t[3]=c,t[4]=u):u=t[4];let d=u,f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>o(e.target.value),t[5]=f):f=t[5];let p;t[6]===d?p=t[7]:(p=e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),d())},t[6]=d,t[7]=p);let m;t[8]!==a||t[9]!==i||t[10]!==p?(m=(0,Q.jsx)(_e,{value:a,rows:1,maxLength:8e3,"aria-label":i,placeholder:i,className:`min-h-9`,onChange:f,onKeyDown:p}),t[8]=a,t[9]=i,t[10]=p,t[11]=m):m=t[11];let h;t[12]!==a||t[13]!==c?(h=!a.trim()||c,t[12]=a,t[13]=c,t[14]=h):h=t[14];let g;t[15]===d?g=t[16]:(g=()=>d(),t[15]=d,t[16]=g);let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(be,{}),t[17]=_):_=t[17];let v;t[18]!==h||t[19]!==g?(v=(0,Q.jsx)(z,{render:(0,Q.jsx)(xe,{size:`icon-xs`,variant:`default`,"aria-label":`Send`,disabled:h,onClick:g,children:_})}),t[18]=h,t[19]=g,t[20]=v):v=t[20];let y;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(M,{children:`Send`}),t[21]=y):y=t[21];let b;t[22]===v?b=t[23]:(b=(0,Q.jsx)(ye,{align:`inline-end`,children:(0,Q.jsxs)(V,{children:[v,y]})}),t[22]=v,t[23]=b);let x;t[24]!==b||t[25]!==m?(x=(0,Q.jsxs)(ve,{children:[m,b]}),t[24]=b,t[25]=m,t[26]=x):x=t[26];let S;t[27]===s?S=t[28]:(S=s&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-caption text-destructive`,children:s}),t[27]=s,t[28]=S);let C;return t[29]!==x||t[30]!==S?(C=(0,Q.jsxs)(Q.Fragment,{children:[x,S]}),t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function nr(e){let t=(0,Z.c)(22),{owner:n,title:r,call:i}=e,{view:a,failed:o,refresh:s}=Wn(n),c,l,u;if(t[0]!==o||t[1]!==n||t[2]!==s||t[3]!==r||t[4]!==a){let e=tn(a,r);c=`flex flex-col gap-3`,t[8]!==o||t[9]!==s?(l=o&&(0,Q.jsxs)(`p`,{role:`alert`,className:`text-caption`,children:[`Comments could not be read.`,` `,(0,Q.jsx)(L,{variant:`link`,size:`sm`,onClick:s,children:`Try again`})]}),t[8]=o,t[9]=s,t[10]=l):l=t[10],u=e.length>0&&(0,Q.jsx)(`div`,{className:`border-t pt-3`,children:(0,Q.jsx)(zn,{children:e.map(e=>(0,Q.jsx)(er,{owner:n,conversation:e,number:a?.pullRequestNumber},e.runId))})}),t[0]=o,t[1]=n,t[2]=s,t[3]=r,t[4]=a,t[5]=c,t[6]=l,t[7]=u}else c=t[5],l=t[6],u=t[7];let d;t[11]===r?d=t[12]:(d={kind:`stop`,title:r},t[11]=r,t[12]=d);let f=i?`Decide, or ask about this`:`Ask about this step`,p;t[13]!==n||t[14]!==d||t[15]!==f?(p=(0,Q.jsx)(tr,{owner:n,anchor:d,placeholder:f}),t[13]=n,t[14]=d,t[15]=f,t[16]=p):p=t[16];let m;return t[17]!==c||t[18]!==l||t[19]!==u||t[20]!==p?(m=(0,Q.jsxs)(`div`,{className:c,children:[l,u,p]}),t[17]=c,t[18]=l,t[19]=u,t[20]=p,t[21]=m):m=t[21],m}function rr(e){let t=(0,Z.c)(19),{owner:n,titles:r}=e,{view:i}=Wn(n),a,o,s,c,l;if(t[0]!==n||t[1]!==r||t[2]!==i){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Jt(i,r);if(e.length===0){l=null;break bb0}s=`flex flex-col gap-3 border-t pt-5`,t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`h2`,{className:`text-ui font-semibold`,children:`Earlier comments`}),t[8]=c):c=t[8],a=zn;let u;t[9]!==n||t[10]!==i?.pullRequestNumber?(u=(e,t)=>(0,Q.jsx)(er,{owner:n,conversation:e,number:i?.pullRequestNumber},`${e.runId}:${t}`),t[9]=n,t[10]=i?.pullRequestNumber,t[11]=u):u=t[11],o=e.map(u)}t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;t[12]!==a||t[13]!==o?(u=(0,Q.jsx)(a,{children:o}),t[12]=a,t[13]=o,t[14]=u):u=t[14];let d;return t[15]!==s||t[16]!==c||t[17]!==u?(d=(0,Q.jsxs)(`section`,{className:s,children:[c,u]}),t[15]=s,t[16]=c,t[17]=u,t[18]=d):d=t[18],d}function ir(e){let t=(0,Z.c)(10),{owner:n}=e,{view:r}=Wn(n),i;t[0]===r?i=t[1]:(i=nn(r),t[0]=r,t[1]=i);let a=i;if(!a)return null;let o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(`span`,{children:a}),t[2]=a,t[3]=o);let s=r?.pullRequestNumber,c;t[4]!==n||t[5]!==s?(c=(0,Q.jsx)(Qn,{owner:n,number:s}),t[4]=n,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==o||t[8]!==c?(l=(0,Q.jsx)(`div`,{className:`sticky bottom-4 z-30 flex justify-center`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-3 rounded-full border bg-popover py-1.5 pr-1.5 pl-4 text-ui shadow-sm`,children:[o,c]})}),t[7]=o,t[8]=c,t[9]=l):l=t[9],l}function ar(e){let t=(0,Z.c)(54),{run:n,requesting:r,reused:i,freshness:a,failure:o,onUpdate:s}=e,c=r!==void 0&&r,l=i!==void 0&&i,u,d,f,p,m,h,g,_,v,y,b,x,S,C;if(t[0]!==o||t[1]!==a||t[2]!==s||t[3]!==c||t[4]!==l||t[5]!==n){u=Sn(n,c),b=`Walkthrough status`,x=`flex flex-col gap-3 rounded-lg border p-4 text-ui`,S=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`p`,{role:`status`,className:`font-medium`,children:u.label}),!u.active&&s&&(0,Q.jsx)(L,{size:`sm`,variant:`outline`,onClick:s,children:o?`Try again`:`Update walkthrough`})]}),t[20]!==n.state.status||t[21]!==n.state.writtenAt?(C=n.state.status===`ready`&&(0,Q.jsxs)(`p`,{className:`text-caption text-muted-foreground`,children:[`Last written`,` `,(0,Q.jsx)(`time`,{dateTime:n.state.writtenAt,children:new Date(n.state.writtenAt).toLocaleString()})]}),t[20]=n.state.status,t[21]=n.state.writtenAt,t[22]=C):C=t[22],t[23]!==c||t[24]!==l?(d=l&&!c&&(0,Q.jsx)(`p`,{className:`text-caption text-muted-foreground`,children:`This snapshot already has a walkthrough. The saved version was reused.`}),t[23]=c,t[24]=l,t[25]=d):d=t[25];let e=`${u.completed/u.total*100}%`,r;t[26]===e?r=t[27]:(r=(0,Q.jsx)(`div`,{className:`h-full bg-primary`,style:{width:e}}),t[26]=e,t[27]=r),f=(0,Q.jsx)(`div`,{role:`progressbar`,"aria-label":`Walkthrough stages`,"aria-valuemin":0,"aria-valuemax":u.total,"aria-valuenow":u.completed,"aria-valuetext":u.label,className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:r}),p=(0,Q.jsx)(`ol`,{"aria-label":`Update stages`,className:`flex flex-wrap gap-x-3 gap-y-1 text-caption text-muted-foreground`,children:u.steps.map((e,t)=>(0,Q.jsxs)(`li`,{"aria-current":!c&&t===u.completed?`step`:void 0,children:[t+1,`. `,e]},e))}),t[28]===c?m=t[29]:(m=c&&(0,Q.jsx)(`p`,{children:`Sending the request and capturing the current work.`}),t[28]=c,t[29]=m),h=a&&(0,Q.jsx)(`p`,{className:`text-foreground-2`,children:u.active?`Showing the saved walkthrough while the update runs.`:Cn(a)}),t[30]===o?g=t[31]:(g=o&&(0,Q.jsxs)(`p`,{role:`alert`,children:[Tt(o.failure,o.writer).title,o.failure.kind!==`signed_out`&&` ${o.failure.message}`]}),t[30]=o,t[31]=g),t[32]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:`Update log`}),t[32]=y):y=t[32],_=`mt-2 flex flex-col gap-2 text-caption text-foreground-2`,v=u.entries.map(or),t[0]=o,t[1]=a,t[2]=s,t[3]=c,t[4]=l,t[5]=n,t[6]=u,t[7]=d,t[8]=f,t[9]=p,t[10]=m,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=b,t[17]=x,t[18]=S,t[19]=C}else u=t[6],d=t[7],f=t[8],p=t[9],m=t[10],h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],b=t[16],x=t[17],S=t[18],C=t[19];let w;t[33]===u.entries.length?w=t[34]:(w=u.entries.length===0&&(0,Q.jsx)(`li`,{children:`This walkthrough predates the update log. Its recorded status is shown above.`}),t[33]=u.entries.length,t[34]=w);let T;t[35]!==w||t[36]!==_||t[37]!==v?(T=(0,Q.jsxs)(`ol`,{className:_,children:[v,w]}),t[35]=w,t[36]=_,t[37]=v,t[38]=T):T=t[38];let E;t[39]!==T||t[40]!==y?(E=(0,Q.jsxs)(`details`,{children:[y,T]}),t[39]=T,t[40]=y,t[41]=E):E=t[41];let D;return t[42]!==d||t[43]!==f||t[44]!==p||t[45]!==m||t[46]!==h||t[47]!==g||t[48]!==E||t[49]!==b||t[50]!==x||t[51]!==S||t[52]!==C?(D=(0,Q.jsxs)(`section`,{"aria-label":b,className:x,children:[S,C,d,f,p,m,h,g,E]}),t[42]=d,t[43]=f,t[44]=p,t[45]=m,t[46]=h,t[47]=g,t[48]=E,t[49]=b,t[50]=x,t[51]=S,t[52]=C,t[53]=D):D=t[53],D}function or(e,t){return(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`time`,{dateTime:e.at,className:`mr-2 font-mono`,children:new Date(e.at).toLocaleString()}),e.message]},`${e.at}:${t}`)}function sr(e){let t=(0,Z.c)(12),{label:n,icon:r,disabled:i,onClick:a}=e,o;t[0]!==i||t[1]!==n||t[2]!==a?(o=(0,Q.jsx)(L,{size:`icon-sm`,variant:`ghost`,"aria-label":n,disabled:i,onClick:a}),t[0]=i,t[1]=n,t[2]=a,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==o?(s=(0,Q.jsx)(z,{render:o,children:r}),t[4]=r,t[5]=o,t[6]=s):s=t[6];let c;t[7]===n?c=t[8]:(c=(0,Q.jsx)(M,{children:n}),t[7]=n,t[8]=c);let l;return t[9]!==s||t[10]!==c?(l=(0,Q.jsxs)(V,{children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function cr(e){let t=(0,Z.c)(11),{scope:n,context:r,run:i,item:a,className:o,placeholder:s}=e,c;t[0]!==r||t[1]!==a.assetId||t[2]!==i.id||t[3]!==n?(c={scope:n,context:r,runId:i.id,assetId:a.assetId},t[0]=r,t[1]=a.assetId,t[2]=i.id,t[3]=n,t[4]=c):c=t[4];let l=Nn(c);if(R(l)){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`span`,{className:`flex h-56 w-full items-center justify-center rounded-lg border p-3 text-center text-caption text-muted-foreground`,children:`This screenshot could not be loaded.`}),t[5]=e):e=t[5],e}if(!te(l)){let e;return t[6]===s?e=t[7]:(e=(0,Q.jsx)(`span`,{className:`block overflow-hidden rounded-lg border`,children:(0,Q.jsx)(T,{className:s})}),t[6]=s,t[7]=e),e}let u;return t[8]!==o||t[9]!==l.value?(u=(0,Q.jsx)(`img`,{src:l.value,alt:``,loading:`lazy`,decoding:`async`,className:o}),t[8]=o,t[9]=l.value,t[10]=u):u=t[10],u}function lr(e){let t=(0,Z.c)(34),{scope:n,context:r,run:i,items:o}=e,[s,c]=(0,X.useState)(null),l=s===null?void 0:o[s],u;if(t[0]!==r||t[1]!==o||t[2]!==i||t[3]!==n){let e;t[5]!==r||t[6]!==i||t[7]!==n?(e=(e,t)=>(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Enlarge screenshot ${t+1}`,onClick:()=>c(t),className:`group flex w-34 shrink-0 flex-col gap-1.5 text-left`,children:[(0,Q.jsx)(cr,{scope:n,context:r,run:i,item:e,className:`h-56 w-full rounded-lg border object-cover object-top transition-opacity group-hover:opacity-85`,placeholder:`h-56 w-full`}),(0,Q.jsx)(`span`,{className:`line-clamp-3 text-caption leading-4 text-muted-foreground`,children:(0,Q.jsx)($,{text:e.shows})})]},e.assetId),t[5]=r,t[6]=i,t[7]=n,t[8]=e):e=t[8],u=o.map(e),t[0]=r,t[1]=o,t[2]=i,t[3]=n,t[4]=u}else u=t[4];let d;t[9]===u?d=t[10]:(d=(0,Q.jsx)(`div`,{className:`-mx-5 flex gap-3 overflow-x-auto px-5 pb-1 @3xl:-mx-0 @3xl:px-0`,children:u}),t[9]=u,t[10]=d);let f=l!==void 0,p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=e=>{e||c(null)},t[11]=p):p=t[11];let m;t[12]===l?m=t[13]:(m=l&&(0,Q.jsx)($,{text:l.shows}),t[12]=l,t[13]=m);let h;t[14]===m?h=t[15]:(h=(0,Q.jsx)(Ne,{children:m}),t[14]=m,t[15]=h);let g;t[16]!==r||t[17]!==i||t[18]!==n||t[19]!==l?(g=l&&(0,Q.jsx)(cr,{scope:n,context:r,run:i,item:l,className:`mx-auto max-h-[72vh] rounded-lg border`,placeholder:`h-96 w-full`}),t[16]=r,t[17]=i,t[18]=n,t[19]=l,t[20]=g):g=t[20];let _;t[21]!==o.length||t[22]!==s?(_=o.length>1&&s!==null&&(0,Q.jsxs)(`div`,{className:`flex items-center justify-center gap-3 text-caption text-muted-foreground`,children:[(0,Q.jsx)(sr,{label:`Previous screenshot`,icon:(0,Q.jsx)(lt,{}),disabled:s===0,onClick:()=>c(s-1)}),s+1,` of `,o.length,(0,Q.jsx)(sr,{label:`Next screenshot`,icon:(0,Q.jsx)(a,{}),disabled:s===o.length-1,onClick:()=>c(s+1)})]}),t[21]=o.length,t[22]=s,t[23]=_):_=t[23];let v;t[24]!==h||t[25]!==g||t[26]!==_?(v=(0,Q.jsxs)(De,{className:`max-h-[92vh] overflow-auto sm:max-w-[min(92vw,52rem)]`,children:[h,g,_]}),t[24]=h,t[25]=g,t[26]=_,t[27]=v):v=t[27];let y;t[28]!==f||t[29]!==v?(y=(0,Q.jsx)(ge,{open:f,onOpenChange:p,children:v}),t[28]=f,t[29]=v,t[30]=y):y=t[30];let b;return t[31]!==y||t[32]!==d?(b=(0,Q.jsxs)(Q.Fragment,{children:[d,y]}),t[31]=y,t[32]=d,t[33]=b):b=t[33],b}var ur=e=>document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`}),dr=e=>`walkthrough-step-${e}`;function fr(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-180 flex-col gap-10 px-5 py-8 @3xl:px-8 @3xl:py-12`,children:n}),t[0]=n,t[1]=r),r}function pr(e){let t=(0,Z.c)(8),{run:n,content:r}=e,i;t[0]!==r||t[1]!==n?(i=hn(n,r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=vn(n)?`\n${vn(n)}`:``,t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,Q.jsxs)(`p`,{className:`whitespace-pre-line font-mono text-caption text-muted-foreground`,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function mr(e){let t=(0,Z.c)(10),{content:n}=e,r;if(t[0]!==n.title){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\.$/,t[2]=e):e=t[2],r=n.title.replace(e,``),t[0]=n.title,t[1]=r}else r=t[1];let i;t[3]===r?i=t[4]:(i=(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[r,`.`]}),t[3]=r,t[4]=i);let a;t[5]===n?a=t[6]:(a=vt(n),t[5]=n,t[6]=a);let o;return t[7]!==i||t[8]!==a?(o=(0,Q.jsxs)(`h1`,{className:`text-subpage-title font-semibold tracking-tight text-balance @3xl:text-page-title`,children:[i,` `,a]}),t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function hr(e){let t=(0,Z.c)(8),[n,r]=(0,X.useState)(!1),i;t[0]!==e||t[1]!==n?(i=e(n),t[0]=e,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===a.hidden?o=t[4]:(o=a.hidden>0?(0,Q.jsx)(gr,{hidden:a.hidden,onClick:()=>r(!0)}):null,t[3]=a.hidden,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s={...a,more:o},t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function gr(e){let t=(0,Z.c)(3),{hidden:n,onClick:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(`div`,{className:`-ml-2`,children:(0,Q.jsxs)(L,{variant:`link`,size:`sm`,onClick:r,children:[n,` more`]})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function _r(e){let t=(0,Z.c)(10),{content:n}=e,r;t[0]===n?r=t[1]:(r=e=>pn(n,e),t[0]=n,t[1]=r);let{shown:i,more:a}=hr(r),o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(`h2`,{className:`text-ui font-semibold`,children:`How the system grew`}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=i.map(vr),t[3]=i,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:s}),t[5]=s,t[6]=c);let l;return t[7]!==a||t[8]!==c?(l=(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[o,c,a]}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function vr(e,t){return(0,Q.jsxs)(`li`,{className:`grid grid-cols-[1rem_minmax(0,1fr)] text-prose`,children:[(0,Q.jsx)(`span`,{"aria-label":e.change,className:g(`font-mono`,e.change===`added`&&`text-add-fg`,e.change===`removed`&&`text-del-fg`,e.change===`changed`&&`text-muted-foreground`),children:ln(e)}),(0,Q.jsxs)(`span`,{className:`wrap-anywhere`,children:[(0,Q.jsxs)(`span`,{className:`font-medium`,children:[(0,Q.jsx)($,{text:e.what}),`.`]}),` `,(0,Q.jsx)(`span`,{className:`text-foreground-2`,children:(0,Q.jsx)($,{text:e.note})})]})]},`${t}:${e.what}`)}function yr(e){let t=(0,Z.c)(13),{content:n}=e,r;t[0]===n?r=t[1]:(r=e=>mn(n,e),t[0]=n,t[1]=r);let{explained:i,unclear:a,total:o,more:s}=hr(r);if(o===0)return null;let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`h2`,{className:`text-ui font-semibold`,children:`What the code doesn't say`}),t[2]=c):c=t[2];let l;t[3]===i?l=t[4]:(l=i.map(xr),t[3]=i,t[4]=l);let u;t[5]===a?u=t[6]:(u=a.map(br),t[5]=a,t[6]=u);let d;t[7]!==l||t[8]!==u?(d=(0,Q.jsxs)(`ul`,{className:`flex flex-col gap-2 text-prose`,children:[l,u]}),t[7]=l,t[8]=u,t[9]=d):d=t[9];let f;return t[10]!==s||t[11]!==d?(f=(0,Q.jsxs)(`section`,{className:`flex flex-col gap-2 border-t pt-5`,children:[c,d,s]}),t[10]=s,t[11]=d,t[12]=f):f=t[12],f}function br(e,t){return(0,Q.jsx)(`li`,{className:`text-foreground-2`,children:(0,Q.jsx)($,{text:e})},`${t}:${e}`)}function xr(e,t){return(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`span`,{children:(0,Q.jsx)($,{text:e.point})}),` `,(0,Q.jsx)(`span`,{className:`text-foreground-2`,children:(0,Q.jsx)($,{text:e.answer})})]},`${t}:${e.point}`)}function Sr(e){let t=(0,Z.c)(12),{content:n,conversation:r}=e,i,a,o,s;if(t[0]!==n||t[1]!==r){s=Symbol.for(`react.early_return_sentinel`);bb0:{let e=_t(n);if(e.length===0){s=null;break bb0}i=`your-calls`,a=`flex scroll-mt-6 flex-col gap-3`;let c;t[6]===r?c=t[7]:(c=e=>{let{attention:t,step:n}=e;return(0,Q.jsxs)(`article`,{className:`flex flex-col gap-3 rounded-xl border bg-card p-4 @3xl:p-5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 text-caption text-muted-foreground`,children:[(0,Q.jsx)(`span`,{children:sn(t)}),(0,Q.jsxs)(`button`,{type:`button`,className:`hover:text-foreground`,onClick:()=>ur(dr(n)),children:[`Step `,n]})]}),(0,Q.jsx)(`h2`,{className:`text-section font-semibold text-pretty`,children:(0,Q.jsx)($,{text:t.question})}),(0,Q.jsx)(`p`,{className:`text-prose text-foreground-2`,children:(0,Q.jsx)($,{text:t.note})}),r?.({kind:`call`,step:n})]},n)},t[6]=r,t[7]=c),o=e.map(c)}t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s}else i=t[2],a=t[3],o=t[4],s=t[5];if(s!==Symbol.for(`react.early_return_sentinel`))return s;let c;return t[8]!==i||t[9]!==a||t[10]!==o?(c=(0,Q.jsx)(`section`,{id:i,className:a,children:o}),t[8]=i,t[9]=a,t[10]=o,t[11]=c):c=t[11],c}function Cr(e){let t=(0,Z.c)(30),{stop:n,step:r,run:i,props:a,conversation:o}=e,c;t[0]===r?c=t[1]:(c=dr(r),t[0]=r,t[1]=c);let l;t[2]===n.attention?l=t[3]:(l=n.attention&&(0,Q.jsx)(`button`,{type:`button`,className:`ml-2 text-foreground hover:underline`,onClick:wr,children:`Your call`}),t[2]=n.attention,t[3]=l);let u;t[4]!==r||t[5]!==l?(u=(0,Q.jsxs)(`p`,{className:`whitespace-pre-line font-mono text-caption text-muted-foreground`,children:[`Step `,r,l]}),t[4]=r,t[5]=l,t[6]=u):u=t[6];let d;t[7]===n.title?d=t[8]:(d=(0,Q.jsx)(`h2`,{className:`text-lg leading-6 font-semibold text-pretty`,children:(0,Q.jsx)($,{text:n.title})}),t[7]=n.title,t[8]=d);let f;t[9]===n.explanation?f=t[10]:(f=(0,Q.jsx)(`p`,{className:`text-prose text-foreground-2`,children:(0,Q.jsx)($,{text:n.explanation})}),t[9]=n.explanation,t[10]=f);let p;t[11]!==a||t[12]!==i||t[13]!==n.evidence?(p=n.evidence.length>0&&(0,Q.jsx)(lr,{scope:a.scope,context:a.context,run:i,items:n.evidence}),t[11]=a,t[12]=i,t[13]=n.evidence,t[14]=p):p=t[14];let m;t[15]!==a||t[16]!==r||t[17]!==n?(m=yt(n).length>0&&(0,Q.jsxs)(Ye,{"aria-label":`See the code for step ${r}`,children:[(0,Q.jsx)(Je,{children:`See the code`}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(z,{render:(0,Q.jsx)(L,{variant:`outline`,size:`icon`,"aria-label":`Open code for step ${r} in split view`,onClick:()=>a.onOpen({kind:`walkthrough-step`,step:r},{toSide:!0})}),children:(0,Q.jsx)(G,{"aria-hidden":`true`})}),(0,Q.jsx)(M,{children:`Open in split view`})]}),(0,Q.jsxs)(V,{children:[(0,Q.jsx)(z,{render:(0,Q.jsx)(L,{variant:`outline`,size:`icon`,"aria-label":`See the code for step ${r}`,onClick:()=>a.onOpen({kind:`walkthrough-step`,step:r})}),children:(0,Q.jsx)(s,{"aria-hidden":`true`})}),(0,Q.jsx)(M,{children:`Open in a new tab`})]})]}),t[15]=a,t[16]=r,t[17]=n,t[18]=m):m=t[18];let h;t[19]!==o||t[20]!==r?(h=o?.({kind:`step`,step:r}),t[19]=o,t[20]=r,t[21]=h):h=t[21];let g;return t[22]!==c||t[23]!==u||t[24]!==d||t[25]!==f||t[26]!==p||t[27]!==m||t[28]!==h?(g=(0,Q.jsxs)(`li`,{id:c,className:`flex scroll-mt-6 flex-col gap-2.5 border-t pt-5`,children:[u,d,f,p,m,h]}),t[22]=c,t[23]=u,t[24]=d,t[25]=f,t[26]=p,t[27]=m,t[28]=h,t[29]=g):g=t[29],g}function wr(){return ur(`your-calls`)}function Tr(e){let t=(0,Z.c)(84),{run:n,content:r,freshness:i,props:a,onUpdate:o,updateFailure:s,progressRun:c,requesting:l,reused:u}=e,d;t[0]!==a||t[1]!==n.id?(d={...a,runId:n.id},t[0]=a,t[1]=n.id,t[2]=d):d=t[2];let f=d,p;t[3]!==r.stops||t[4]!==f?(p=e=>{let{kind:t,step:n}=e,i=r.stops[n-1].title;return(0,Q.jsx)(nr,{owner:f,title:i,call:t===`call`},i)},t[3]=r.stops,t[4]=f,t[5]=p):p=t[5];let m=p,h;t[6]!==i||t[7]!==o||t[8]!==c||t[9]!==l||t[10]!==u||t[11]!==s?(h=(0,Q.jsx)(ar,{run:c,requesting:l,reused:u,freshness:i,failure:s,onUpdate:o}),t[6]=i,t[7]=o,t[8]=c,t[9]=l,t[10]=u,t[11]=s,t[12]=h):h=t[12];let g=h;if(r.outcome===`nothing`){let e;t[13]!==r||t[14]!==n?(e=(0,Q.jsx)(pr,{run:n,content:r}),t[13]=r,t[14]=n,t[15]=e):e=t[15];let i;t[16]===r?i=t[17]:(i=(0,Q.jsx)(mr,{content:r}),t[16]=r,t[17]=i);let o;t[18]===r.summary?o=t[19]:(o=(0,Q.jsx)(`p`,{className:`text-prose text-foreground-2`,children:(0,Q.jsx)($,{text:r.summary})}),t[18]=r.summary,t[19]=o);let s;t[20]===a?s=t[21]:(s=(0,Q.jsx)(`div`,{className:`-ml-2`,children:(0,Q.jsx)(L,{variant:`link`,size:`sm`,onClick:()=>a.onOpen({kind:`walkthrough-changes`}),children:`See the change`})}),t[20]=a,t[21]=s);let c;t[22]!==g||t[23]!==e||t[24]!==i||t[25]!==o||t[26]!==s?(c=(0,Q.jsxs)(`header`,{className:`flex flex-col gap-3`,children:[e,i,o,g,s]}),t[22]=g,t[23]=e,t[24]=i,t[25]=o,t[26]=s,t[27]=c):c=t[27];let l;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],t[28]=l):l=t[28];let u,d;t[29]===f?(u=t[30],d=t[31]):(u=(0,Q.jsx)(rr,{owner:f,titles:l}),d=(0,Q.jsx)(ir,{owner:f}),t[29]=f,t[30]=u,t[31]=d);let p;return t[32]!==u||t[33]!==d||t[34]!==c?(p=(0,Q.jsxs)(fr,{children:[c,u,d]}),t[32]=u,t[33]=d,t[34]=c,t[35]=p):p=t[35],p}let _;t[36]!==r||t[37]!==n?(_=(0,Q.jsx)(pr,{run:n,content:r}),t[36]=r,t[37]=n,t[38]=_):_=t[38];let v;t[39]===r?v=t[40]:(v=(0,Q.jsx)(mr,{content:r}),t[39]=r,t[40]=v);let y;t[41]===r.summary?y=t[42]:(y=(0,Q.jsx)(`p`,{className:`text-prose text-foreground-2`,children:(0,Q.jsx)($,{text:r.summary})}),t[41]=r.summary,t[42]=y);let b;t[43]!==g||t[44]!==_||t[45]!==v||t[46]!==y?(b=(0,Q.jsxs)(`header`,{className:`flex flex-col gap-3`,children:[_,v,y,g]}),t[43]=g,t[44]=_,t[45]=v,t[46]=y,t[47]=b):b=t[47];let x;t[48]!==r||t[49]!==m?(x=(0,Q.jsx)(Sr,{content:r,conversation:m}),t[48]=r,t[49]=m,t[50]=x):x=t[50];let S;t[51]===r?S=t[52]:(S=r.growth.length>0&&(0,Q.jsx)(_r,{content:r}),t[51]=r,t[52]=S);let C;if(t[53]!==r.stops||t[54]!==m||t[55]!==a||t[56]!==n){let e;t[58]!==m||t[59]!==a||t[60]!==n?(e=(e,t)=>(0,Q.jsx)(Cr,{stop:e,step:t+1,run:n,props:a,conversation:m},t),t[58]=m,t[59]=a,t[60]=n,t[61]=e):e=t[61],C=r.stops.map(e),t[53]=r.stops,t[54]=m,t[55]=a,t[56]=n,t[57]=C}else C=t[57];let w;t[62]===C?w=t[63]:(w=(0,Q.jsx)(`ol`,{className:`flex flex-col gap-10`,children:C}),t[62]=C,t[63]=w);let T;t[64]===r?T=t[65]:(T=(0,Q.jsx)(yr,{content:r}),t[64]=r,t[65]=T);let E;t[66]===r.stops?E=t[67]:(E=r.stops.map(Er),t[66]=r.stops,t[67]=E);let D;t[68]!==f||t[69]!==E?(D=(0,Q.jsx)(rr,{owner:f,titles:E}),t[68]=f,t[69]=E,t[70]=D):D=t[70];let O;t[71]===a?O=t[72]:(O=(0,Q.jsx)(`footer`,{className:`border-t pt-5`,children:(0,Q.jsx)(`div`,{className:`-ml-2`,children:(0,Q.jsx)(L,{variant:`link`,size:`sm`,onClick:()=>a.onOpen({kind:`walkthrough-changes`}),children:`See every changed file`})})}),t[71]=a,t[72]=O);let k;t[73]===f?k=t[74]:(k=(0,Q.jsx)(ir,{owner:f}),t[73]=f,t[74]=k);let A;return t[75]!==w||t[76]!==T||t[77]!==D||t[78]!==O||t[79]!==k||t[80]!==b||t[81]!==x||t[82]!==S?(A=(0,Q.jsxs)(fr,{children:[b,x,S,w,T,D,O,k]}),t[75]=w,t[76]=T,t[77]=D,t[78]=O,t[79]=k,t[80]=b,t[81]=x,t[82]=S,t[83]=A):A=t[83],A}function Er(e){return e.title}function Dr(e){let t=(0,Z.c)(6),{waiting:n,onWrite:r}=e,i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(`h1`,{className:`text-subpage-title font-semibold tracking-tight @3xl:text-page-title`,children:`No walkthrough yet.`}),a=(0,Q.jsx)(`p`,{className:`text-prose text-foreground-2`,children:`A fresh agent reads this change and explains it. It never edits the code.`}),t[0]=i,t[1]=a):(i=t[0],a=t[1]);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(ot,{"data-icon":`inline-start`}),t[2]=o):o=t[2];let s;return t[3]!==r||t[4]!==n?(s=(0,Q.jsx)(fr,{children:(0,Q.jsxs)(`header`,{className:`flex flex-col items-start gap-3`,children:[i,a,(0,Q.jsxs)(L,{disabled:n,onClick:r,children:[o,`Write walkthrough`]})]})}),t[3]=r,t[4]=n,t[5]=s):s=t[5],s}function Or(e){let t=(0,Z.c)(8),{run:n}=e,r,i;t[0]===n?(r=t[1],i=t[2]):(r=(0,Q.jsx)(pr,{run:n}),i=(0,Q.jsx)(ar,{run:n}),t[0]=n,t[1]=r,t[2]=i);let a,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(T,{className:`h-9 w-4/5`}),o=(0,Q.jsx)(T,{className:`h-20 w-full`}),t[3]=a,t[4]=o):(a=t[3],o=t[4]);let s;return t[5]!==r||t[6]!==i?(s=(0,Q.jsx)(fr,{children:(0,Q.jsxs)(`header`,{className:`flex flex-col gap-3`,children:[r,i,a,o]})}),t[5]=r,t[6]=i,t[7]=s):s=t[7],s}function kr(e){let t=(0,Z.c)(18),{run:n,failure:r,waiting:i,onRetry:a}=e,o;t[0]!==r||t[1]!==n?(o=gn(r,n),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s=o,c;t[3]===s.title?c=t[4]:(c=(0,Q.jsx)(`h1`,{className:`text-subpage-title font-semibold tracking-tight`,children:s.title}),t[3]=s.title,t[4]=c);let l;t[5]!==n||t[6]!==i?(l=n&&(0,Q.jsx)(ar,{run:n,requesting:i}),t[5]=n,t[6]=i,t[7]=l):l=t[7];let u;t[8]===s.message?u=t[9]:(u=s.message&&(0,Q.jsx)(`p`,{className:`text-prose text-foreground-2`,children:s.message}),t[8]=s.message,t[9]=u);let d;t[10]!==a||t[11]!==i?(d=(0,Q.jsx)(L,{disabled:i,onClick:a,children:`Try again`}),t[10]=a,t[11]=i,t[12]=d):d=t[12];let f;return t[13]!==c||t[14]!==l||t[15]!==u||t[16]!==d?(f=(0,Q.jsx)(fr,{children:(0,Q.jsxs)(`header`,{className:`flex flex-col items-start gap-3`,children:[c,l,u,d]})}),t[13]=c,t[14]=l,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function Ar(e){let t=(0,Z.c)(15),{result:n,phase:i,read:a,refresh:o}=En(e.scope,e.context),s=Pn(e.scope,e.context,e.base,i&&i.kind!==`unwritten`?i.run:void 0),c;t[0]!==i||t[1]!==a||t[2]!==s?(c=a?mt(xn(a,s.accepted)):i,t[0]=i,t[1]=a,t[2]=s,t[3]=c):c=t[3];let l=c;if(l===void 0){let e;return t[4]!==o||t[5]!==n?(e=R(n)?(0,Q.jsx)(S,{description:`The walkthrough could not be read.`,onRetry:o}):(0,Q.jsx)(r,{label:`Loading walkthrough`}),t[4]=o,t[5]=n,t[6]=e):e=t[6],e}let u;t[7]!==l||t[8]!==e||t[9]!==s?(u=()=>{let t=s.failure&&(l.kind===`unwritten`||l.kind===`failed`)?s.failure:void 0;if(t)return(0,Q.jsx)(kr,{run:l.kind===`failed`?l.run:void 0,failure:t,waiting:s.waiting,onRetry:s.start});switch(l.kind){case`unwritten`:return(0,Q.jsx)(Dr,{waiting:s.waiting,onWrite:s.start});case`writing`:return(0,Q.jsx)(Or,{run:l.run});case`failed`:return(0,Q.jsx)(kr,{run:l.run,failure:l.failure,waiting:s.waiting,onRetry:s.start});case`ready`:{let t=_n(l,s);return(0,Q.jsx)(Tr,{run:l.run,content:l.content,freshness:l.freshness,props:e,onUpdate:s.start,progressRun:l.attempt??l.run,requesting:s.waiting,reused:s.accepted?.state.status===`ready`&&s.accepted.id===l.run.id,updateFailure:t.failure},l.run.id)}}},t[7]=l,t[8]=e,t[9]=s,t[10]=u):u=t[10];let d=u,f;t[11]===d?f=t[12]:(f=d(),t[11]=d,t[12]=f);let p;return t[13]===f?p=t[14]:(p=(0,Q.jsx)(`div`,{className:`@container h-full overflow-auto`,children:f}),t[13]=f,t[14]=p),p}function jr(e){let t=(0,Z.c)(14),{steps:n,activeEntry:r,onOpen:i,row:a}=e,[o,s]=(0,X.useState)(null);if(n.length===0)return null;let c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`p`,{className:`px-2 pt-2 pb-1 text-2xs text-muted-foreground`,children:`By step`}),t[0]=c):c=t[0];let l;if(t[1]!==r||t[2]!==i||t[3]!==o||t[4]!==a||t[5]!==n){let e;t[7]!==r||t[8]!==i||t[9]!==o||t[10]!==a?(e=e=>{let{stop:t,step:n,files:c}=e,l={kind:`walkthrough-step`,step:n},u=r===at(l);return(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsxs)(We,{plain:!0,label:`Step ${n}`,active:u,onOpen:()=>{s(n),i(l)},children:[(0,Q.jsx)(`span`,{className:`w-3.5 shrink-0 text-center font-mono text-2xs text-muted-foreground`,children:n}),(0,Q.jsx)(me,{className:`min-w-0 flex-1`,text:jt(t.title)}),t.attention&&(0,Q.jsx)(`span`,{role:`img`,"aria-label":`Your call`,className:`size-1.5 shrink-0 rounded-full bg-foreground`}),(0,Q.jsx)(`span`,{className:`ml-auto text-2xs text-muted-foreground tabular-nums`,children:c.length})]}),(o===n||u)&&(0,Q.jsx)(`div`,{className:`pl-3`,children:c.map(a)})]},n)},t[7]=r,t[8]=i,t[9]=o,t[10]=a,t[11]=e):e=t[11],l=n.map(e),t[1]=r,t[2]=i,t[3]=o,t[4]=a,t[5]=n,t[6]=l}else l=t[6];let u;return t[12]===l?u=t[13]:(u=(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-col`,children:[c,l]}),t[12]=l,t[13]=u),u}function Mr(e){let t=(0,Z.c)(6),{files:n,row:r}=e;if(n.length===0)return null;let i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(`p`,{className:`px-2 pt-2 pb-1 text-2xs text-muted-foreground`,children:`Not in the walkthrough yet`}),t[0]=i):i=t[0];let a;t[1]!==n||t[2]!==r?(a=n.map(r),t[1]=n,t[2]=r,t[3]=a):a=t[3];let o;return t[4]===a?o=t[5]:(o=(0,Q.jsxs)(`div`,{className:`mt-1 flex flex-col`,children:[i,a]}),t[4]=a,t[5]=o),o}function Nr(e){let t=(0,Z.c)(22),{scope:n,context:r,items:i,row:a,activeEntry:o,onOpen:s}=e,c=Dn(n,r);if(!c||c.content.stops.length===0){let e;t[0]!==i||t[1]!==a?(e=i.map(a),t[0]=i,t[1]=a,t[2]=e):e=t[2];let n;return t[3]===e?n=t[4]:(n=(0,Q.jsx)(Q.Fragment,{children:e}),t[3]=e,t[4]=n),n}let l,u,d;t[5]!==i||t[6]!==c.content?(u=St(c.content,i),l=jr,d=u.steps.filter(Pr),t[5]=i,t[6]=c.content,t[7]=l,t[8]=u,t[9]=d):(l=t[7],u=t[8],d=t[9]);let f;t[10]!==l||t[11]!==o||t[12]!==s||t[13]!==a||t[14]!==d?(f=(0,Q.jsx)(l,{steps:d,activeEntry:o,onOpen:s,row:a}),t[10]=l,t[11]=o,t[12]=s,t[13]=a,t[14]=d,t[15]=f):f=t[15];let p;t[16]!==u.outside||t[17]!==a?(p=(0,Q.jsx)(Mr,{files:u.outside,row:a}),t[16]=u.outside,t[17]=a,t[18]=p):p=t[18];let m;return t[19]!==f||t[20]!==p?(m=(0,Q.jsxs)(Q.Fragment,{children:[f,p]}),t[19]=f,t[20]=p,t[21]=m):m=t[21],m}function Pr(e){return e.files.length>0}function Fr(e){let t=(0,Z.c)(38),{scope:n,context:r,base:i,paths:a,row:o,activeEntry:s,onOpen:c}=e,l=Dn(n,r),u=On(n,r,i);if(a.length===0){let e=l?`Nothing uncommitted.`:`No changes`,n;return t[0]===e?n=t[1]:(n=(0,Q.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:e}),t[0]=e,t[1]=n),n}let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=at(Ue),t[2]=d):d=t[2];let f=s===d,p;t[3]===c?p=t[4]:(p=()=>c(Ue),t[3]=c,t[4]=p);let m,h;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(Ie,{className:`size-3.5 shrink-0 text-muted-foreground`}),h=(0,Q.jsx)(`span`,{className:`min-w-0 flex-1`,children:`All changes`}),t[5]=m,t[6]=h):(m=t[5],h=t[6]);let g;t[7]===a.length?g=t[8]:(g=(0,Q.jsx)(`span`,{className:`ml-auto text-2xs text-muted-foreground tabular-nums`,children:a.length}),t[7]=a.length,t[8]=g);let _;t[9]!==f||t[10]!==p||t[11]!==g?(_=(0,Q.jsxs)(We,{plain:!0,label:`All changes`,active:f,onOpen:p,children:[m,h,g]}),t[9]=f,t[10]=p,t[11]=g,t[12]=_):_=t[12];let v=_;if(!l||l.content.stops.length===0){let e;t[13]!==a||t[14]!==o?(e=a.map(o),t[13]=a,t[14]=o,t[15]=e):e=t[15];let n;return t[16]!==v||t[17]!==e?(n=(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[v,e]}),t[16]=v,t[17]=e,t[18]=n):n=t[18],n}let y,b;if(t[19]!==a||t[20]!==l.content||t[21]!==u){let e=a.map(Lr);y=St(l.content,e,u),b=y.steps.filter(Ir),t[19]=a,t[20]=l.content,t[21]=u,t[22]=y,t[23]=b}else y=t[22],b=t[23];let x=b,S;t[24]!==s||t[25]!==c||t[26]!==o||t[27]!==x?(S=x.length>0&&(0,Q.jsx)(jr,{steps:x,activeEntry:s,onOpen:c,row:e=>o(e.path)}),t[24]=s,t[25]=c,t[26]=o,t[27]=x,t[28]=S):S=t[28];let C;t[29]===o?C=t[30]:(C=e=>o(e.path),t[29]=o,t[30]=C);let w;t[31]!==y.outside||t[32]!==C?(w=(0,Q.jsx)(Mr,{files:y.outside,row:C}),t[31]=y.outside,t[32]=C,t[33]=w):w=t[33];let T;return t[34]!==v||t[35]!==w||t[36]!==S?(T=(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[v,S,w]}),t[34]=v,t[35]=w,t[36]=S,t[37]=T):T=t[37],T}function Ir(e){return e.files.length>0}function Lr(e){return{path:e}}var Rr={branch:Nr,uncommitted:Fr};function zr(e){let t=(0,Z.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Q.jsx)(Xe,{...e,grouping:Rr}),t[0]=e,t[1]=n),n}function Br(e){let t=(0,Z.c)(45),n,r;t[0]===e?(n=t[1],r=t[2]):({document:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=Dn(r.scope,r.context),o=On(r.scope,r.context,r.base),s=n.kind===`walkthrough-step`?n.step:void 0,c=s===void 0?void 0:i?.content.stops[s-1];if(!i||n.kind===`walkthrough-step`&&!c){let e;return t[3]===r?e=t[4]:(e=(0,Q.jsx)(he,{title:`This step isn't available`,description:`The walkthrough changed since this tab was opened. Open the Walkthrough tab for the current steps.`,children:(0,Q.jsx)(L,{variant:`outline`,onClick:()=>r.onOpen({kind:`walkthrough`}),children:`Open walkthrough`})}),t[3]=r,t[4]=e),e}if(s===void 0||c===void 0){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e={title:`All changes`,titleLabel:`All changes`},t[5]=e):e=t[5];let n;return t[6]===r?n=t[7]:(n=(0,Q.jsx)(Vr,{...r,heading:e}),t[6]=r,t[7]=n),n}let l=i.content.stops.length,u=`Step ${s} of ${l}`,d;t[8]===u?d=t[9]:(d=(0,Q.jsx)(`span`,{className:`mr-2 font-normal text-muted-foreground`,children:u}),t[8]=u,t[9]=d);let f;t[10]===c.title?f=t[11]:(f=(0,Q.jsx)($,{text:c.title}),t[10]=c.title,t[11]=f);let p;t[12]!==d||t[13]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;t[15]===c.title?m=t[16]:(m=jt(c.title),t[15]=c.title,t[16]=m);let h=`${u}: ${m}`,g;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(lt,{}),t[17]=g):g=t[17];let _=s===1,v;t[18]!==r||t[19]!==s?(v=()=>r.onOpen({kind:`walkthrough-step`,step:s-1}),t[18]=r,t[19]=s,t[20]=v):v=t[20];let y;t[21]!==_||t[22]!==v?(y=(0,Q.jsx)(sr,{label:`Previous step`,icon:g,disabled:_,onClick:v}),t[21]=_,t[22]=v,t[23]=y):y=t[23];let b;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(a,{}),t[24]=b):b=t[24];let x=s===l,S;t[25]!==r||t[26]!==s?(S=()=>r.onOpen({kind:`walkthrough-step`,step:s+1}),t[25]=r,t[26]=s,t[27]=S):S=t[27];let C;t[28]!==x||t[29]!==S?(C=(0,Q.jsx)(sr,{label:`Next step`,icon:b,disabled:x,onClick:S}),t[28]=x,t[29]=S,t[30]=C):C=t[30];let w;t[31]!==C||t[32]!==y?(w=(0,Q.jsxs)(`span`,{className:`flex items-center`,children:[y,C]}),t[31]=C,t[32]=y,t[33]=w):w=t[33];let T;t[34]!==w||t[35]!==p||t[36]!==h?(T={title:p,titleLabel:h,after:w},t[34]=w,t[35]=p,t[36]=h,t[37]=T):T=t[37];let E=T,D;t[38]!==o||t[39]!==c?(D=yt(c,o),t[38]=o,t[39]=c,t[40]=D):D=t[40];let O=D,k;return t[41]!==E||t[42]!==O||t[43]!==r?(k=(0,Q.jsx)(Vr,{...r,only:O,heading:E}),t[41]=E,t[42]=O,t[43]=r,t[44]=k):k=t[44],k}function Vr(e){let t=(0,Z.c)(9),n=we(e.scope,e.context.connection),[r,i]=(0,X.useState)(`branch`),a;t[0]!==n||t[1]!==r||t[2]!==e?(a=t=>{let{branch:a,worktree:o}=Nt({branch:t.files,worktree:n.changes,only:e.only}),s=a.length>0&&o.length>0,c=t=>({...e.interaction,active:e.interaction.active&&(!s||r===t),toolbarTarget:s&&r!==t?null:e.interaction.toolbarTarget,entry:s?`${e.interaction.entry}:${t}`:e.interaction.entry});return(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[e.only&&(0,Q.jsx)(it,{scope:e.scope,context:e.context,interaction:e.interaction,branchFiles:t.files,changes:n,committed:a,dirty:o,range:K(t)}),s&&(0,Q.jsx)(Ke,{inline:!0,title:e.heading.title,titleLabel:e.heading.titleLabel,children:e.heading.after}),(0,Q.jsxs)(`div`,{className:s?`min-h-0 flex-1 overflow-auto`:`flex min-h-0 flex-1 flex-col`,children:[a.length>0&&(0,Q.jsx)(`section`,{"aria-label":`Branch code`,className:`flex min-h-0 flex-1 flex-col`,onFocusCapture:()=>i(`branch`),onPointerDownCapture:()=>i(`branch`),children:(0,Q.jsx)(Ze,{...e,only:a,fullHeight:s,interaction:c(`branch`),heading:s?{title:`Branch`,titleLabel:`Branch`}:e.heading})}),o.length>0&&(0,Q.jsx)(`section`,{"aria-label":`Uncommitted code`,className:`flex min-h-0 flex-1 flex-col`,onFocusCapture:()=>i(`uncommitted`),onPointerDownCapture:()=>i(`uncommitted`),children:(0,Q.jsx)(Ge,{...e,only:o,fullHeight:s,interaction:c(`uncommitted`),heading:s?{title:`Uncommitted`,titleLabel:`Uncommitted`}:e.heading})}),a.length===0&&o.length===0&&(0,Q.jsx)(he,{title:`No changed files`,description:`These files no longer have changes in the branch or working tree.`})]})]})},t[0]=n,t[1]=r,t[2]=e,t[3]=a):a=t[3];let o;return t[4]!==e.base||t[5]!==e.context||t[6]!==e.scope||t[7]!==a?(o=(0,Q.jsx)(qe,{scope:e.scope,context:e.context,base:e.base,children:a}),t[4]=e.base,t[5]=e.context,t[6]=e.scope,t[7]=a,t[8]=o):o=t[8],o}function Hr(e){let t=(0,Z.c)(9),n;t[0]!==e.projectId||t[1]!==e.worktree.id?(n={projectId:e.projectId,worktreeId:e.worktree.id},t[0]=e.projectId,t[1]=e.worktree.id,t[2]=n):n=t[2];let r;t[3]===e?r=t[4]:(r=(0,Q.jsx)(Ur,{...e}),t[3]=e,t[4]=r);let i;return t[5]!==e.context.connection||t[6]!==n||t[7]!==r?(i=(0,Q.jsx)(rt,{connection:e.context.connection,scope:n,children:r}),t[5]=e.context.connection,t[6]=n,t[7]=r,t[8]=i):i=t[8],i}function Ur(e){let t=(0,Z.c)(15),n;t[0]!==e.projectId||t[1]!==e.worktree.id?(n={projectId:e.projectId,worktreeId:e.worktree.id},t[0]=e.projectId,t[1]=e.worktree.id,t[2]=n):n=t[2];let r=n,i=An(r,e.context),a=i.name===`walkthrough`,o=kn(r,e.context),s=a||e.search.entry===`walkthrough`?o:`Changes`,c;t[3]!==e.worktree.id||t[4]!==s?(c=Qe({worktreeId:e.worktree.id,title:s}),t[3]=e.worktree.id,t[4]=s,t[5]=c):c=t[5],h(c);let l=a?`Walkthrough`:void 0,u;t[6]!==l||t[7]!==i.companion||t[8]!==i.guided||t[9]!==i.pending?(u={title:l,pending:i.pending,guided:i.guided,companion:i.companion},t[6]=l,t[7]=i.companion,t[8]=i.guided,t[9]=i.pending,t[10]=u):u=t[10];let d=u,f=i.guided?zr:Xe,p;return t[11]!==d||t[12]!==e||t[13]!==f?(p=(0,Q.jsx)(et,{...e,walkthrough:Ar,changesNavigation:f,walkthroughCode:Br,firstDocument:d}),t[11]=d,t[12]=e,t[13]=f,t[14]=p):p=t[14],p}function Wr(e){let t=(0,Z.c)(2),n;t[0]===e?n=t[1]:(n=v(e),t[0]=e,t[1]=n),h(n)}function Gr(e){let t=(0,Z.c)(7),{icon:n,tone:r}=e,i=(r===void 0?`default`:r)===`destructive`?`bg-destructive/10 text-destructive`:`bg-muted text-foreground`,a;t[0]===i?a=t[1]:(a=g(`grid size-10 shrink-0 place-items-center rounded-xl`,i),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,Q.jsx)(n,{className:`size-5`}),t[2]=n,t[3]=o);let s;return t[4]!==a||t[5]!==o?(s=(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:a,children:o}),t[4]=a,t[5]=o,t[6]=s):s=t[6],s}function Kr(e){let t=(0,Z.c)(4),{keys:n}=e,r;t[0]===n?r=t[1]:(r=n.split(`+`).map(qr),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Q.jsx)(Se,{children:r}),t[2]=r,t[3]=i),i}function qr(e){return(0,Q.jsx)(W,{className:`min-w-6 justify-center`,children:Y(e)},e)}function Jr(e){let t=(0,Z.c)(6),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Gr,{icon:Ee}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(Me,{className:`flex-row items-center text-left`,children:[i,(0,Q.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Q.jsx)(Ne,{children:`Keyboard shortcuts`}),(0,Q.jsx)(Pe,{children:`None of them fire while you are typing.`})]})]}),t[1]=a):a=t[1];let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsxs)(De,{className:`max-h-[85svh] grid-rows-[auto_minmax(0,1fr)] overflow-hidden sm:max-w-xl`,children:[a,(0,Q.jsx)(Ce,{className:`-mr-3 min-h-0`,children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-5 pr-3`,children:ze.map(Yr)})})]}),t[2]=o):o=t[2];let s;return t[3]!==r||t[4]!==n?(s=(0,Q.jsx)(ge,{open:n,onOpenChange:r,children:o}),t[3]=r,t[4]=n,t[5]=s):s=t[5],s}function Yr(e){return(0,Q.jsxs)(`section`,{"aria-labelledby":`shortcuts-${e.title}`,children:[(0,Q.jsx)(`h3`,{id:`shortcuts-${e.title}`,className:`mb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase`,children:e.title}),(0,Q.jsx)(`dl`,{className:`divide-y rounded-xl border`,children:e.items.map(Xr)})]},e.title)}function Xr(e){return(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-3 py-2`,children:[(0,Q.jsx)(`dt`,{className:`text-sm`,children:e.label}),(0,Q.jsx)(`dd`,{className:`shrink-0`,children:(0,Q.jsx)(Kr,{keys:e.keys})})]},e.keys)}var Zr={"not-found":{title:`Page not found`,description:`This URL does not open a page in Porcelain.`,icon:dt},"missing-worktree":{title:`Worktree not found`,description:`This URL has an invalid or unavailable worktree ID.`,icon:pt},empty:{title:`Select a worktree`,description:`Choose one on the left to open its review.`,icon:Ie}};function Qr(e){let t=(0,Z.c)(111),{review:r,remote:i,unavailable:a,notice:o,children:s,settingsOpen:c}=e,l=c!==void 0&&c,u=Le(),[f,h]=(0,X.useState)(!1),[_,v]=(0,X.useState)(!1),{setOpenMobile:y,isMobile:S,open:C,openMobile:w}=ie(),T;t[0]===y?T=t[1]:(T=(e,t)=>{h(!e&&t.reason===`escape-key`),y(e)},t[0]=y,t[1]=T);let E;t[2]!==u||t[3]!==f?(E=e=>{!e&&f&&(h(!1),u.element?.focus())},t[2]=u,t[3]=f,t[4]=E):E=t[4];let D;t[5]!==T||t[6]!==E?(D={onOpenChange:T,onOpenChangeComplete:E},t[5]=T,t[6]=E,t[7]=D):D=t[7];let A=D,j=O(),te=x(),re=b(),M=Oe(re.connection),N,P,F,I,ae;if(t[8]!==M||t[9]!==o){I=ne(M,k(M)?.id),P=!o&&M.projects.length===0;let e;t[15]!==P||t[16]!==o?(e=P?{title:`Open your first project`,description:`Open a Git repository to see its worktrees and review changes.`,icon:Ie}:Zr[o??`empty`],t[15]=P,t[16]=o,t[17]=e):e=t[17],F=e,N=F.icon,ae=ce(I?.worktree.branch||void 0),t[8]=M,t[9]=o,t[10]=N,t[11]=P,t[12]=F,t[13]=I,t[14]=ae}else N=t[10],P=t[11],F=t[12],I=t[13],ae=t[14];let se=ae;oe();let R=b(i?.connection),le=i?.remote.environmentId??null,z;t[18]!==r||t[19]!==le?(z=r&&{remote:le,projectId:r.selection.projectId,worktreeId:r.selection.worktree.id},t[18]=r,t[19]=le,t[20]=z):z=t[20];let B=z,ue=r?.selection.worktree.id??``,de;t[21]===ue?de=t[22]:(de=tt(ue),t[21]=ue,t[22]=de);let V=d(de),fe;t[23]!==V||t[24]!==i||t[25]!==r?(fe=r?st({firstDocument:V,entry:r.search.entry,surface:r.search.surface,project:r.inventory.projects.find(e=>e.id===r.selection.projectId)?.name,environment:i||r.inventory.environment.custom?r.inventory.environment.name:void 0}):`Porcelain`,t[23]=V,t[24]=i,t[25]=r,t[26]=fe):fe=t[26],Wr(fe);let pe;t[27]!==j||t[28]!==r?(pe=e=>j({...nt(e),replace:r===void 0}),t[27]=j,t[28]=r,t[29]=pe):pe=t[29];let H=pe,U=$e(re.connection,H),ge;t[30]!==j||t[31]!==y?(ge=e=>{let t=e===void 0?je:e;y(!1),j({to:`/settings/$section`,params:{section:t}})},t[30]=j,t[31]=y,t[32]=ge):ge=t[32];let W=ge,G;t[33]!==re.connection||t[34]!==j||t[35]!==r?.search||t[36]!==y||t[37]!==B?(G=e=>{if(e.pullRequest.state!==`available`||!e.pullRequest.number)return;let t=at({kind:`pull-request`,projectId:e.projectId,number:e.pullRequest.number,environmentId:e.environmentId});y(!1);let n=B??(e.worktreeId?{remote:e.environmentId===re.connection.environmentId?null:e.environmentId,projectId:e.projectId,worktreeId:e.worktreeId}:void 0);n&&j({...nt(n),search:{...r?.search??{},entry:t}})},t[33]=re.connection,t[34]=j,t[35]=r?.search,t[36]=y,t[37]=B,t[38]=G):G=t[38];let _e;t[39]===U?_e=t[40]:(_e=e=>e?Te.openWithPayload({remote:e.remote.environmentId}):U(),t[39]=U,t[40]=_e);let ve;t[41]===W?ve=t[42]:(ve=()=>W(),t[41]=W,t[42]=ve);let ye;t[43]!==j||t[44]!==y?(ye=e=>{y(!1),j({to:`/settings/$section/$environmentId`,params:{section:`computers`,environmentId:e}})},t[43]=j,t[44]=y,t[45]=ye):ye=t[45];let be;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(be=()=>v(!0),t[46]=be):be=t[46];let xe;t[47]!==l||t[48]!==B||t[49]!==void 0||t[50]!==G||t[51]!==_e||t[52]!==ve||t[53]!==ye?(xe={settingsOpen:l,remotes:void 0,selected:B,onOpenPullRequest:G,onOpenProject:_e,onOpenSettings:ve,onOpenRemotes:ye,onOpenShortcuts:be},t[47]=l,t[48]=B,t[49]=void 0,t[50]=G,t[51]=_e,t[52]=ve,t[53]=ye,t[54]=xe):xe=t[54];let K=xe,Se;t[55]!==j||t[56]!==te||t[57]!==B?(Se=(e,t)=>{if(!B)return;let n=nt(B);te.buildLocation({}).pathname===te.buildLocation(n).pathname&&j({...n,search:t=>({...t,...e}),...t})},t[55]=j,t[56]=te,t[57]=B,t[58]=Se):Se=t[58];let Ce=Se,we;t[59]===W?we=t[60]:(we=()=>W(),t[59]=W,t[60]=we);let Ee;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ee={ignoreInputs:!0},t[61]=Ee):Ee=t[61],Ve(Be.openSettings,we,Ee);let De,ke;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(De=()=>v(!0),ke={ignoreInputs:!0},t[62]=De,t[63]=ke):(De=t[62],ke=t[63]),Ve(Be.openShortcuts,De,ke);let Me;t[64]!==s||t[65]!==u?(Me=typeof s==`function`?s(u):s,t[64]=s,t[65]=u,t[66]=Me):Me=t[66];let Ne=Me,Pe;t[67]!==S||t[68]!==A||t[69]!==K||t[70]!==H||t[71]!==y?(Pe=S&&(0,Q.jsx)(ee,{variant:`floating`,...A,children:(0,Q.jsx)(Fe,{...K,onSelect:e=>{H(e),y(!1)}})}),t[67]=S,t[68]=A,t[69]=K,t[70]=H,t[71]=y,t[72]=Pe):Pe=t[72];let q;t[73]===H?q=t[74]:(q=e=>void H(e),t[73]=H,t[74]=q);let Re;t[75]!==K||t[76]!==q?(Re={...K,onSelect:q},t[75]=K,t[76]=q,t[77]=Re):Re=t[77];let ze;t[78]!==N||t[79]!==Ne||t[80]!==R||t[81]!==P||t[82]!==S||t[83]!==F.description||t[84]!==F.title||t[85]!==u||t[86]!==K||t[87]!==o||t[88]!==Ce||t[89]!==C||t[90]!==U||t[91]!==w||t[92]!==I||t[93]!==se||t[94]!==i||t[95]!==r||t[96]!==y||t[97]!==le||t[98]!==a?(ze=Ne??(r?(0,Q.jsx)(Hr,{navigationTrigger:u,worktree:r.selection.worktree,projectId:r.selection.projectId,search:r.search,onSearch:Ce,context:R},`${le??``}:${r.selection.worktree.id}`):(0,Q.jsx)($r,{navigationTrigger:u,isMobile:S,open:C,openMobile:w,children:i&&a?(0,Q.jsx)(m,{name:i.remote.name,status:a,onOpenRemotes:()=>K.onOpenRemotes(i.remote.environmentId)}):(0,Q.jsxs)(he,{title:F.title,description:F.description,icon:(0,Q.jsx)(N,{}),children:[P&&(0,Q.jsx)(L,{variant:`outline`,onClick:()=>{y(!1),U()},children:`Open project`}),!o&&I&&(0,Q.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`First that needs you`}),(0,Q.jsx)(p,{className:`flex min-w-0 flex-col rounded-lg border p-3 text-ui hover:bg-accent`,to:`/$projectId/$worktreeId`,params:{projectId:I.projectId,worktreeId:I.worktree.id},children:(0,Q.jsx)(me,{text:se,className:`font-medium`})})]}),o===`missing-worktree`&&I&&(0,Q.jsx)(p,{className:g(n()),to:`/$projectId/$worktreeId`,params:{projectId:I.projectId,worktreeId:I.worktree.id},children:`Open available worktree`}),o&&(0,Q.jsx)(p,{className:g(n({variant:`outline`})),to:`/`,search:{},children:`Back to workspace`})]})})),t[78]=N,t[79]=Ne,t[80]=R,t[81]=P,t[82]=S,t[83]=F.description,t[84]=F.title,t[85]=u,t[86]=K,t[87]=o,t[88]=Ce,t[89]=C,t[90]=U,t[91]=w,t[92]=I,t[93]=se,t[94]=i,t[95]=r,t[96]=y,t[97]=le,t[98]=a,t[99]=ze):ze=t[99];let J;t[100]!==S||t[101]!==C||t[102]!==Re||t[103]!==ze?(J=(0,Q.jsx)(Ae,{navigator:Re,isMobile:S,open:C,children:ze}),t[100]=S,t[101]=C,t[102]=Re,t[103]=ze,t[104]=J):J=t[104];let Y;t[105]===_?Y=t[106]:(Y=(0,Q.jsx)(Jr,{open:_,onOpenChange:v}),t[105]=_,t[106]=Y);let He;return t[107]!==Pe||t[108]!==J||t[109]!==Y?(He=(0,Q.jsxs)(Q.Fragment,{children:[Pe,J,Y]}),t[107]=Pe,t[108]=J,t[109]=Y,t[110]=He):He=t[110],He}function $r(e){let t=(0,Z.c)(12),{navigationTrigger:n,isMobile:r,open:i,openMobile:a,children:o}=e,s;t[0]===n?s=t[1]:(s=e=>n.attach(e),t[0]=n,t[1]=s);let c=r?a:i,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=He(J(Be.toggleNavigator,Re())),t[2]=l):l=t[2];let u;t[3]!==s||t[4]!==c?(u=(0,Q.jsx)(z,{render:(0,Q.jsx)(F,{ref:s,className:`absolute top-3 left-3`,"aria-label":`Toggle Sidebar`,"aria-expanded":c,"aria-keyshortcuts":l})}),t[3]=s,t[4]=c,t[5]=u):u=t[5];let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsxs)(M,{side:`right`,children:[`Toggle sidebar`,(0,Q.jsx)(W,{children:Y(Be.toggleNavigator)})]}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,Q.jsxs)(V,{children:[u,d]}),t[7]=u,t[8]=f);let p;return t[9]!==o||t[10]!==f?(p=(0,Q.jsxs)(`div`,{className:`relative grid h-full min-h-0 place-items-center rounded-paper border bg-card p-8`,children:[f,o]}),t[9]=o,t[10]=f,t[11]=p):p=t[11],p}export{Wr as n,Qr as t};