@fabiofiorita/porcelain 0.88.2 → 0.88.3

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.
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Ac as t,B as n,C as r,Dc as i,Do as a,Eo as o,Fa as s,Fd as c,Fo as l,G as u,Gl as d,Gs as f,Gt as p,H as m,Hl as h,Ho as g,I as _,Io as v,It as y,Jc as b,Jt as x,K as S,Kt as C,L as w,Ll as T,Ls as E,Lt as D,Nc as O,Oa as k,Oc as A,Oo as j,P as M,Pl as N,Qc as P,R as F,Rs as I,Rt as L,So as R,T as z,Tc as B,Ti as V,To as H,Tr as U,Uo as W,Ut as ee,V as te,Vo as G,W as ne,Wc as re,Ws as ie,Wt as K,Xc as ae,Zc as oe,_a as se,_c as ce,_s as le,_u as q,bc as J,bo as ue,da as de,dn as fe,dt as pe,du as me,ea as he,el as ge,fn as _e,fu as ve,gn as ye,gs as be,ha as xe,hc as Se,hs as Ce,hu as we,ia as Te,ja as Ee,jc as De,js as Oe,l as ke,li as Ae,ma as je,mn as Me,na as Ne,nn as Pe,oa as Fe,p as Ie,pa as Le,pn as Re,pu as ze,q as Be,ql as Ve,qt as He,ra as Ue,rl as We,sa as Ge,ta as Ke,ua as qe,uo as Je,vc as Ye,vs as Xe,w as Ze,wc as Qe,wo as $e,xo as et,xs as tt,yc as nt,ys as rt,z as it,zt as at}from"./access-B1ddZlps.js";import{i as ot,n as st,t as ct}from"./useNavigate-BZWuXWB6.js";import{$ as lt,$n as ut,$t as dt,A as ft,An as pt,At as mt,B as ht,Bn as gt,Bt as _t,C as vt,Cn as yt,Ct as bt,D as xt,Dn as St,Dt as Ct,E as wt,En as Tt,Et,F as Dt,Fn as Ot,Ft as kt,G as At,Gn as jt,Gt as Mt,H as Nt,Hn as Pt,Ht as Ft,I as It,In as Lt,J as Rt,Jn as zt,Jt as Bt,K as Vt,Kn as Ht,Kt as Ut,L as Wt,Ln as Gt,Lt as Kt,M as qt,Mn as Jt,Mt as Yt,N as Xt,Nn as Zt,O as Qt,On as $t,Ot as en,P as tn,Pn as nn,Pt as rn,Q as an,Qn as on,Qt as sn,R as cn,Rn as ln,S as un,Sn as dn,St as fn,T as pn,Tn as mn,Tt as hn,U as gn,Un as _n,Ut as vn,V as yn,Vn as bn,Vt as xn,W as Sn,Wn as Cn,Wt as wn,X as Tn,Xn as En,Xt as Dn,Y as On,Yn as kn,Yt as An,Z as jn,Zn as Mn,Zt as Nn,_ as Pn,_n as Fn,_t as In,a as Ln,an as Rn,at as zn,b as Bn,bn as Vn,bt as Hn,c as Un,cn as Wn,ct as Gn,d as Kn,dn as qn,dt as Jn,en as Yn,et as Xn,f as Zn,fn as Qn,ft as $n,g as er,gn as tr,gt as nr,h as rr,hn as ir,ht as ar,i as or,in as sr,it as cr,j as lr,jn as ur,jt as dr,k as fr,kn as pr,kt as mr,l as hr,ln as gr,lt as _r,m as vr,mn as yr,mt as br,n as xr,nn as Sr,nr as Cr,nt as wr,o as Tr,on as Er,ot as Dr,p as Or,pn as kr,pt as Ar,q as jr,qn as Mr,qt as Nr,r as Pr,rn as Fr,rr as Ir,rt as Lr,s as Rr,sn as zr,st as Br,tn as Vr,tr as Hr,tt as Ur,un as Wr,ut as Gr,v as Kr,vn as qr,vt as Jr,wn as Yr,wt as Xr,x as Zr,xn as Qr,xt as $r,y as ei,yn as ti,yt as ni,z as ri,zn as ii,zt as ai}from"./settings-page-CigAPPnS.js";import{L as oi,N as si,R as ci,X as li,Z as ui,_i as di,_r as fi,an as pi,b as mi,d as hi,et as gi,fi as _i,ft as vi,g as yi,gi as bi,gr as xi,gt as Si,hi as Ci,hn as wi,ht as Ti,l as Ei,lt as Di,m as Oi,mi as ki,mt as Ai,nr as ji,p as Mi,pi as Ni,tt as Pi,v as Fi,x as Ii,y as Li,z as Ri}from"./edit-file-D4o1bywx.js";import{d as zi,f as Bi,r as Vi}from"./sides-711aNttp.js";import{t as Hi}from"./workspace-error-Dc7KW7tw.js";function Ui(e){let t=ge({warn:e?.router===void 0}),n=e?.router||t;return P(n.stores.__store,ot(e,n))}var Y=e(N(),1),X=We(),Z=b();function Wi(e,t,n){return Math.min(Math.max(e,t),n)}function Gi(e){if(!Number.isFinite(e)||Number.isInteger(e))return 0;let[t,n]=String(e).toLowerCase().split(`e`),r=(t.split(`.`)[1]??``).length;return Math.max(0,r-Number(n??0))}function Ki(e,t){return Number(e.toFixed(Math.min(t,100)))}function qi(e,t){return Number((e/t).toPrecision(15))}function Ji(e){return Number.isFinite(e.min)?e.min:0}function Yi(e){return Math.max(Gi(e.step),Gi(Ji(e)))}function Xi(e){if(!Number.isFinite(e.max)||!(e.step>0))return e.max;let t=Ji(e);return Ki(t+Math.floor(qi(e.max-t,e.step))*e.step,Yi(e))}function Zi(e,t,n=Math.round){if(!(t.step>0))return e;let r=Ji(t);return Ki(r+n(qi(e-r,t.step))*t.step,Yi(t))}function Qi(e,t){return t.step>0?Ki(Wi(Zi(e,t),t.min,Xi(t)),Yi(t)):Wi(e,t.min,t.max)}function $i(e,t,n){if(!(n.step>0))return Wi(e+t,n.min,n.max);let r=Ji(n),i=qi(e-r,n.step);return Ki(Wi(r+((Number.isInteger(i)?i:t>0?Math.floor(i):Math.ceil(i))+t)*n.step,n.min,Xi(n)),Yi(n))}function ea(e,t,n){return t.size===`large`?Qi(Wi(e+t.direction*(n.largeStep??n.step*10),n.min,n.max),n):t.size===`small`&&n.smallStep?$i(e,t.direction,{...n,step:n.smallStep}):$i(e,t.direction,n)}var ta=new Map;function na(e,t={}){let n=`${e??``}|${JSON.stringify(t)}`,r=ta.get(n);return r||(r=new Intl.NumberFormat(e,t),ta.set(n,r)),r}var ra=new WeakMap;function ia(e){let t=na(void 0,e),n=ra.get(t);return n===void 0&&(n=t.resolvedOptions().maximumFractionDigits??0,ra.set(t,n)),n}function aa(e,t){let n={...e};if(n.maximumFractionDigits===void 0&&n.maximumSignificantDigits===void 0){let r=Gi(t)+(n.style===`percent`?-2:0);n.maximumFractionDigits=Math.max(n.minimumFractionDigits??0,r,ia(e))}return n}function oa(e,t,n){if(e===null||!Number.isFinite(e))return``;if(typeof n==`function`)return n(e);let r=na(t,n),i=r.format(e);if(e<0&&!r.formatToParts(e).some(e=>e.type===`integer`)){let e=r.formatToParts(-3),t=e.findIndex(e=>e.type===`minusSign`);return`${e.slice(0,t+1).map(e=>e.value).join(``)}${i}`}return i}function sa(e){let t=e.split(`/`).map(e=>e.trim()===``?NaN:Number(e));return t.every(Number.isFinite)?t:null}var ca={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};ca.node;var la=$e(ca),ua=typeof window>`u`?Y.useEffect:Y.useLayoutEffect;function da({fileDiff:e,oldFile:t,newFile:n,options:r,editorOptions:i,editStateKey:a,lineAnnotations:o,selectedLines:s,prerenderedHTML:c,metrics:l,hasGutterRenderUtility:u,hasCustomHeader:d,disableWorkerPool:f,edit:p,onEditChange:m,onEditComplete:h}){let g=dn(),_=s!==void 0,v=(0,Y.useContext)($t),y=Jt(),[b,x]=(0,Y.useState)(),S=Zt(e=>m?.(e)),C=m==null?void 0:S,w=(0,Y.useRef)(null),T=Zt(r=>{let i=h?.(r)??`reject`;return i===`accept`&&(w.current={fileDiff:{installed:r.fileDiff,stale:r.originalFileDiff},filePair:e==null?{fileDiff:r.fileDiff,installed:{oldFile:r.oldFile,newFile:r.newFile},stale:{oldFile:t??null,newFile:n??null}}:null,annotations:{installed:r.lineAnnotations,stale:r.originalLineAnnotations}}),i}),E=h==null?void 0:T,D=fa({acceptedCache:w,fileDiff:e,newFile:n,oldFile:t,parseDiffOptions:r?.parseDiffOptions}),O=(0,Y.useRef)(null),k=Qr(),A=ma(w,D,o),j=Vn(O,A)??{fileDiff:D,lineAnnotations:o??fi},M=(0,Y.useRef)(null),N=(0,Y.useRef)(null),P=Zt(()=>{if(y==null)throw Error(`FileDiff: EditContext is not attached`);return y(`file-diff`,i??{},a)}),F=Zt(e=>{if(e!=null){if(O.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);g==null?O.current=new mn(_a({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:C,onEditComplete:E,options:r}),f?void 0:v,k):O.current=new Yr(_a({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:C,onEditComplete:E,options:r}),g,l,f?void 0:v,k),O.current.hydrate({fileDiff:D,fileContainer:e,lineAnnotations:o,prerenderedHTML:c})}else{if(O.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);N.current=null,O.current.cleanUp(),O.current=null,M.current=null}});ua(()=>{let{current:e}=O;if(e==null)return;let t=_a({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:C,onEditComplete:E,options:r}),n=!wi(e.options,t);if(e.setOptions(t),!p&&(N.current=null,M.current!=null)){let{current:e}=M;M.current=null,e()}let i=ga(D,o,w);if(e.render({forceRender:n,fileDiff:i.fileDiff,lineAnnotations:i.lineAnnotations}),s!==void 0&&e.setSelectedLines(s),!p||M.current!=null)return;if(y==null)throw Error(`FileDiff: EditContext is not attached`);let a=()=>{O.current===e&&M.current==null&&e.__canAttachEditor()&&(M.current=va(e,P),k())};if(e.__canAttachEditor()){N.current=null,a();return}let c=e.__prepareForEditing();if(c==null){N.current=null;return}if(N.current?.promise===c)return;let l={promise:c};N.current=l,c.then(()=>{N.current===l&&(a(),N.current=null)}).catch(e=>{N.current===l&&(N.current=null,x(e))})});let I=(0,Y.useCallback)(()=>O.current?.getHoveredLine(),[]),L=(0,Y.useCallback)(e=>O.current?.getAnnotationSlotName(e)??ji(e),[]);if(b!=null)throw b;return{...j,ref:F,getHoveredLine:I,getAnnotationSlotName:L}}function fa({acceptedCache:e,fileDiff:t,newFile:n,oldFile:r,parseDiffOptions:i}){return(0,Y.useMemo)(()=>{if(t!=null)return t;let{current:a}=e,o=a?.filePair;if(a!=null&&o!=null){if(pa(r,n,o.stale)||pa(r,n,o.installed))return o.fileDiff;a.filePair=null}return Tt(r??null,n??null,i)},[e,t,r,n,i])}function pa(e,t,n){return pi(e??void 0,n.oldFile??void 0)&&pi(t??void 0,n.newFile??void 0)}function ma(e,t,n){"use no memo";return ha(t,n,e.current)}function ha(e,t,n){return{fileDiff:n?.fileDiff!=null&&pr(e,n.fileDiff.stale)?n.fileDiff.installed:e,lineAnnotations:n?.annotations!=null&&t===n.annotations.stale?n.annotations.installed:t}}function ga(e,t,n){let{current:r}=n,i=ha(e,t,r);return r==null||(r.fileDiff!=null&&!pr(e,r.fileDiff.stale)&&(r.fileDiff=null),t!==r.annotations?.stale&&(r.annotations=null),r.fileDiff==null&&r.annotations==null&&r.filePair==null&&(n.current=null)),i}function _a({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return{...e,controlledSelection:t,renderCustomHeader:n?ur:e?.renderCustomHeader,renderGutterUtility:r?ur:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}}function va(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function ya({fileDiff:e,options:t,editorOptions:n,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,className:s,style:c,prerenderedHTML:l,renderAnnotation:u,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1,onEditChange:v,onEditComplete:y}){let{ref:b,getHoveredLine:x,getAnnotationSlotName:S,fileDiff:C,lineAnnotations:w}=da({fileDiff:e,options:t,editorOptions:n,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,prerenderedHTML:l,hasGutterRenderUtility:h!=null,hasCustomHeader:d!=null,disableWorkerPool:g,edit:_,onEditChange:v,onEditComplete:y}),T=pt({fileDiff:C,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderAnnotation:u,renderGutterUtility:h,lineAnnotations:w,getHoveredLine:x,getAnnotationSlotName:S});return(0,X.jsx)(xi,{ref:b,className:s,style:c,children:yt(T,l)})}var ba=7;function xa(e,t){return e!==void 0&&e!==t?e.slice(0,ba):void 0}var Sa=(e,t)=>t.length>0?`${e}: ${t.join(`, `)}`:e;function Ca(e,t){let n=mi(e,t?.status);return{checks:ci(e),live:Ii(e,t?.status),headline:n,lead:Sa(n.label,n.names),moved:xa(t?.detail?.headSha,e.headOid)}}function wa(e,t){let n=t===`failed`||t===`running`;return{names:e.results.filter(e=>!n||e.tone===t).map(e=>e.name),passing:n?e.results.filter(e=>e.tone===`passed`).length:0,more:e.more}}function Ta({passing:e,more:t}){return[e>0?` and ${e} passing`:``,t?`${e>0?`,`:``} and more`:``].join(``)}function Ea(e,t){let n=c(q(e));return n===void 0?me(e)?{status:`failed`}:{status:`reading`}:{status:`read`,value:t(n)}}function Da(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 Oa(e){return e.messages.filter(e=>e.author===`developer`)}function ka(e,t){return e.messages.find(e=>e.author===`agent`&&e.replyTo===t)}function Aa(e,t){return(e?.conversations??[]).filter(({anchor:e})=>e.kind===`walkthrough`||!t.includes(e.title))}function ja(e){return e instanceof Error&&e.message.length>0?e.message:`The request failed. Try again.`}function Ma(e){return Oa(e).map(t=>({message:t,reply:ka(e,t.id)}))}function Na(e,t){return e?Da(e,{kind:`stop`,title:t}):[]}function Pa([e,t],n,{runId:r,title:i}){let a=e.text.trim(),o=e.sending||n.waiting;return{text:e.text,failure:e.failure?.runId===r?e.failure.message:void 0,waiting:o,change:e=>t(t=>({...t,text:e,failure:void 0})),send:()=>{a&&!o&&(t(e=>({...e,failure:void 0,sending:!0})),n.run({anchor:{kind:`stop`,title:i},text:a}).then(()=>t(t=>({...t,text:t.text===e.text?``:t.text,sending:!1})),n=>t(t=>({...t,failure:t.text===e.text?{runId:r,message:ja(n)}:void 0,sending:!1}))))}}}function Fa(e){let t=e.walkthrough.status===`read`?e.walkthrough.value:void 0;return{name:jr(t??{walkthrough:void 0,freshness:`unknown`}),pending:e.walkthrough.status===`reading`,guided:t?.walkthrough!==void 0}}var Ia=[`queued`,`evidence`,`transcript`,`writing`,`validating`,`ready`],La={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 Ra(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 za(e,t,n=!1){let r=e.progress??[],i=r.at(-1),a=e.state.status===`failed`?`failed`:e.state.status===`ready`?`ready`:i?.stage??(e.state.status===`queued`?`queued`:`writing`),o=r.filter(e=>e.stage!==`failed`).at(-1)?.stage,s=a===`failed`?Math.max(0,Ia.findIndex(e=>e===o)):Math.max(0,Ia.findIndex(e=>e===a));return{label:t?`Requesting update`:n&&a===`failed`?`Writing failed`:La[a],completed:t?0:s,total:Ia.length-1,entries:r,steps:Ia.map(e=>La[e]),active:t||e.state.status===`queued`||e.state.status===`running`}}function Ba(e){switch(e){case`current`:return`Up to date with the current work.`;case`unknown`:return;case`changed`:return`The work changed after this walkthrough’s snapshot. Update to include the latest changes.`}}function Va(e,t){let n=e.worktree.find(e=>e.path===t),r=n?.comparisons.find(e=>e.scope===`unmerged`||`kind`in e&&e.kind===`deleted`);return{local:n,held:r&&{kind:`worktree`,change:r}}}function Ha(e,t){let{local:n,held:r}=Va(e,t);return r||(e.branch===void 0?e.branchFailed||n?{kind:`file`}:void 0:e.branch.find(e=>e.path===t)?.status===`deleted`?{kind:`branch`}:{kind:`file`})}var Ua=16,Wa={right:16,down:24},Ga={right:12,down:20},Ka={right:32,down:8},qa=24,Ja=16,Ya=2,Xa=6,Za=8,Qa=28,$a=32,eo=32,Q=e=>Math.round(e*10)/10;function to(e,t){let n=Math.atan2(e.y-t.y,e.x-t.x),r=Math.PI/7;return[e,{x:e.x-Xa*Math.cos(n-r),y:e.y-Xa*Math.sin(n-r)},{x:e.x-Xa*Math.cos(n+r),y:e.y-Xa*Math.sin(n+r)}].map(e=>`${Q(e.x)},${Q(e.y)}`).join(` `)}function no(e,t,n){let r=n?(t.x-e.x)/2:(t.y-e.y)/2,i=n?{x:e.x+r,y:e.y}:{x:e.x,y:e.y+r},a=n?{x:t.x-r,y:t.y}:{x:t.x,y:t.y-r};return{path:`M${Q(e.x)} ${Q(e.y)} C${Q(i.x)} ${Q(i.y)} ${Q(a.x)} ${Q(a.y)} ${Q(t.x)} ${Q(t.y)}`,arrow:to(t,a),middle:{x:Q((e.x+3*i.x+3*a.x+t.x)/8),y:Q((e.y+3*i.y+3*a.y+t.y)/8)}}}function ro(e,t){let n=new Map(e.map(e=>[e,[]]));t.forEach((e,t)=>n.get(e.from)?.push(t));let r=new Map,i=new Set,a=e=>{r.set(e,`open`);for(let o of n.get(e)??[]){let e=t[o]?.to;if(e===void 0)continue;let n=r.get(e);n===`open`?i.add(o):n===void 0&&a(e)}r.set(e,`done`)},o=new Set(t.map(e=>e.to));for(let t of e)!o.has(t)&&!r.has(t)&&a(t);for(let t of e)r.has(t)||a(t);let s=t.map((e,t)=>i.has(t)?{from:e.to,to:e.from}:e),c=new Map(e.map(e=>[e,0]));for(let t=0;t<e.length;t+=1)for(let e of s){let t=(c.get(e.from)??0)+1;(c.get(e.to)??0)<t&&c.set(e.to,t)}for(let t of e){let e=s.filter(e=>e.from===t).map(e=>c.get(e.to)??0);!s.some(e=>e.to===t)&&e.length>0&&c.set(t,Math.min(...e)-1)}let l=[...new Set(c.values())].sort((e,t)=>e-t);return new Map([...c].map(([e,t])=>[e,l.indexOf(t)]))}function io(e,t,n){let r=Math.max(...e.map(e=>n.get(e)??0))+1,i=Array.from({length:r},()=>[]);for(let t of e)i[n.get(t)??0]?.push(t);let a=()=>new Map(i.flatMap(e=>e.map((e,t)=>[e,t]))),o=(e,r)=>t.flatMap(t=>{let i=t.from===e?t.to:t.to===e?t.from:void 0;if(i===void 0)return[];let a=n.get(i)??0,o=n.get(e)??0;return(r?a<o:a>o)?[i]:[]});for(let e=0;e<4;e+=1){let t=e%2==0,n=a(),r=t?i:[...i].reverse();for(let e of r){let r=new Map(e.map((e,r)=>{let i=o(e,t);return[e,i.length===0?r:i.reduce((e,t)=>e+(n.get(t)??0),0)/i.length]}));e.sort((e,t)=>(r.get(e)??0)-(r.get(t)??0))}}return i}function ao(e,t){let n=new Map;return{points:n,chains:e.map((e,r)=>{let i=(t.get(e.from)??0)*2,a=(t.get(e.to)??0)*2,o=Math.min(i,a),s=Math.max(i,a),c=o+1+2*Math.floor((s-o-1)/4),l=[];for(let t=o+1;t<s;t+=1){let i=`\u0000${r}:${t}`;n.set(i,{id:i,edge:r,label:e.label!==void 0&&t===c}),l.push(i)}return{levels:[o,...l.map((e,t)=>o+1+t),s],ids:i<=a?l:[...l].reverse(),ahead:i<=a}})}}function oo(e,t,n){let r=n===`right`,i=e.nodes.map(e=>e.id),a=new Map(e.nodes.map(e=>[e.id,t.node(e)])),o=ro(i,e.edges),{points:s,chains:c}=ao(e.edges,o);for(let n of s.values()){let r=e.edges[n.edge]?.label,i=n.label&&r!==void 0?t.label(r):Ya;a.set(n.id,{width:i,height:n.label?Ja:Ya})}let l=new Map([...i.map(e=>[e,(o.get(e)??0)*2]),...c.flatMap(e=>e.ids.map(t=>[t,(e.ahead?e.levels[1+e.ids.indexOf(t)]:e.levels[e.ids.length-e.ids.indexOf(t)])??0]))]),u=e.edges.flatMap((e,t)=>{let n=c[t];if(n===void 0)return[];let r=[e.from,...n.ids,e.to];return r.slice(1).map((e,t)=>({from:r[t]??e,to:e}))}),d=io([...i,...s.keys()],u,l),f=e=>r?a.get(e)?.width??0:a.get(e)?.height??0,p=e=>r?a.get(e)?.height??0:a.get(e)?.width??0,m=d.map((e,t)=>Math.max(t%2==1?Ka[n]:0,...e.map(f))),h=d.map(e=>e.reduce((e,t)=>e+p(t),0)+Math.max(0,e.length-1)*Wa[n]),g=Math.max(...h),_=new Map,v=[],y=Ua;d.forEach((e,t)=>{let i=Ua+(g-(h[t]??0))/2,o=m[t]??0;for(let t of e){let e=a.get(t)?.width??0,s=a.get(t)?.height??0,c=y+(o-f(t))/2;_.set(t,r?{x:c,y:i,width:e,height:s}:{x:i,y:c,width:e,height:s}),i+=p(t)+Wa[n]}v.push({start:y,end:y+o}),y+=o+(t<d.length-1?Ga[n]:0)});let b=new Map;e.edges.forEach((e,t)=>{let n=[e.from,e.to].sort().join(`\0`);b.set(n,[...b.get(n)??[],t])});let x=(e,t)=>r?{x:e,y:t}:{x:t,y:e},S=e=>r?e.y+e.height/2:e.x+e.width/2,C=e.edges.flatMap((e,t)=>{let n=_.get(e.from),i=_.get(e.to),a=c[t];if(n===void 0||i===void 0||a===void 0)return[];let o=b.get([e.from,e.to].sort().join(`\0`))??[],u=(o.indexOf(t)-(o.length-1)/2)*2*Za,d=a.ahead?1:-1,f=e=>v[l.get(e)??0],p=f(e.from),m=f(e.to);if(p===void 0||m===void 0)return[];let h=e=>r?a.ahead?e.x+e.width:e.x:a.ahead?e.y+e.height:e.y,g=e=>r?a.ahead?e.x:e.x+e.width:a.ahead?e.y:e.y+e.height,y=[x(h(n),S(n)+u),x(a.ahead?p.end:p.start,S(n)+u)],C;for(let e of a.ids){let t=_.get(e),n=f(e);if(t===void 0||n===void 0)continue;let r=S(t);y.push(x(a.ahead?n.start:n.end,r),x(a.ahead?n.end:n.start,r)),s.get(e)?.label&&(C=x((n.start+n.end)/2,r))}y.push(x(a.ahead?m.start:m.end,S(i)+u),x(g(i),S(i)+u));let w=[];for(let e=1;e<y.length;e+=1){let t=y[e-1],n=y[e],i=r?t.y===n.y:t.x===n.x;w.push(i?`L${Q(n.x)} ${Q(n.y)}`:no(t,n,r).path.replace(/^M\S+ \S+ /,``))}let T=y[0],E=y.at(-1),D=x((r?E.x:E.y)-d*Xa,r?E.y:E.x),O=C??y[Math.floor(y.length/2)-1]??x(0,0);return[{index:t,path:`M${Q(T.x)} ${Q(T.y)} ${w.join(` `)}`,arrow:to(E,D),label:e.label===void 0?void 0:{x:Q(O.x),y:Q(O.y)}}]}),w=y+Ua,T=g+32;return{placement:n,width:Q(r?w:T),height:Q(r?T:w),nodes:i.flatMap(e=>{let t=_.get(e);return t===void 0?[]:[{id:e,x:Q(t.x),y:Q(t.y),width:t.width,height:t.height}]}),edges:C,lifelines:[]}}function so(e,t){let n=e.nodes.map(e=>t.node(e)),r=new Map(e.nodes.map((e,t)=>[e.id,t])),i=n.slice(1).map((e,t)=>(n[t]?.width??0)/2+e.width/2+eo),a=e.edges.map(e=>{let n=r.get(e.from)??0,i=r.get(e.to)??0;return{low:Math.min(n,i),high:Math.max(n,i),need:e.label?t.label(e.label)+qa:0}}).sort((e,t)=>e.high-e.low-(t.high-t.low));for(let e of a){let t=i.slice(e.low,e.high).reduce((e,t)=>e+t,0);if(t<e.need){let n=(e.need-t)/(e.high-e.low);for(let t=e.low;t<e.high;t+=1)i[t]=(i[t]??0)+n}}let o=Math.max(...n.map(e=>e.height)),s=[];n.forEach((e,t)=>{s.push(t===0?Ua+e.width/2:(s[t-1]??0)+(i[t-1]??0))});let c=Ua+o,l=c+Qa,u=l+Math.max(0,e.edges.length-1)*$a,d=e.edges.flatMap((e,t)=>{let n=s[r.get(e.from)??-1],i=s[r.get(e.to)??-1];if(n===void 0||i===void 0)return[];let a=l+t*$a,o=Math.sign(i-n),c={x:n+o*2,y:a},u={x:i-o*2,y:a};return[{index:t,path:`M${Q(c.x)} ${a} L${Q(u.x)} ${a}`,arrow:to(u,c),label:e.label===void 0?void 0:{x:Q((n+i)/2),y:a-9}}]}),f=n.at(-1)?.width??0;return{placement:`sequence`,width:Q((s.at(-1)??0)+f/2+Ua),height:Q(u+16+Ua),nodes:e.nodes.map((e,t)=>{let r=n[t]??{width:0,height:0};return{id:e.id,x:Q((s[t]??0)-r.width/2),y:Ua+(o-r.height)/2,width:r.width,height:r.height}}),edges:d,lifelines:s.map(e=>({x:Q(e),top:c,bottom:u+16}))}}function co(e,t,n){if(e.layout===`sequence`)return so(e,t);if(e.layout===`layers`)return oo(e,t,`down`);let r=oo(e,t,`right`);if(r.width<=n)return r;let i=oo(e,t,`down`);return i.width<r.width?i:r}function lo(e,t){let n=new Set,r=new Set([t]);return e.edges.forEach((e,i)=>{(e.from===t||e.to===t)&&(n.add(i),r.add(e.from),r.add(e.to))}),{nodes:r,edges:n}}function uo(e,t){let n=t=>e.nodes.find(e=>e.id===t)?.label??t,r=t=>e.layout===`sequence`?`${t+1}. `:``,i=e=>e.mark===`added`?` (new)`:e.mark===`removed`?` (removed)`:``;return e.edges.flatMap((e,a)=>{let o=e.label===void 0?``:` (${e.label})`;return e.from===t?[`${r(a)}To ${n(e.to)}${o}${i(e)}`]:e.to===t?[`${r(a)}From ${n(e.from)}${o}${i(e)}`]:[]})}function fo(e,t,n){if(n===`first`)return e.nodes[0]?.id??t;if(n===`last`)return e.nodes.at(-1)?.id??t;let r=e=>({x:e.x+e.width/2,y:e.y+e.height/2}),i=e.nodes.find(e=>e.id===t);if(i===void 0)return e.nodes[0]?.id??t;let a=r(i),o=n===`left`||n===`right`,s=n===`right`||n===`down`?1:-1,c=e.nodes.flatMap(e=>{if(e.id===t)return[];let n=r(e),c=(o?n.x-a.x:n.y-a.y)*s,l=Math.abs(o?n.y-a.y:n.x-a.x),u=o?(i.height+e.height)/2:(i.width+e.width)/2;return c>1?[{id:e.id,along:c,aside:l,band:l<u}]:[]}),l=c.filter(e=>e.band),u=l.length>0?l:c,d=Math.min(...u.map(e=>e.along));return u.filter(e=>e.along<=d+8).sort((e,t)=>e.aside-t.aside)[0]?.id??t}var po=30,mo=44,ho=8;function go(e){return{node:t=>{let n=t.mark&&t.mark!==`unchanged`?e.sign:0,r=n+t.label.length*e.label+(t.anchor?e.chevron:0),i=t.note?n+t.note.length*e.note:0;return{width:Math.round(Math.min(e.max,Math.max(e.min,Math.max(r,i)+e.padding))),height:t.note?mo:po}},label:t=>t.length*e.edge+ho}}var _o={added:`new`,changed:`changed`,removed:`removed`,unchanged:`unchanged`};function vo(e){return e.mark===void 0||e.mark===`unchanged`?void 0:tn({change:e.mark,what:``,note:``})}function yo(e){return[e.kind,e.mark===void 0?void 0:_o[e.mark]].filter(Boolean).join(`, `)}function bo(e,t){let n=yo(t),r=uo(e,t.id),i=``;return t.anchor?.kind===`lines`&&(i=`Shows ${t.anchor.excerpt.path}, ${t.anchor.excerpt.lines}.`),t.anchor?.kind===`file`&&(i=`Shows ${t.anchor.path}.`),[n?`${n}.`:``,r.length>0?`${r.join(`; `)}.`:``,i].filter(Boolean).join(` `)}function xo(e,t){return e.mark===`added`?`add`:e.mark===`removed`?`del`:t?`lit`:`rest`}function So(e){let t=(0,Z.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(Ot,{}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,X.jsxs)(X.Fragment,{children:[r,(0,X.jsx)(Yt,{children:n})]}),t[1]=n,t[2]=i),i}function Co(e){let t=(0,Z.c)(6),{children:n}=e,[r,i]=(0,Y.useState)(!0),a=_e(),o;t[0]===a?o=t[1]:(o=a&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(xn,{connection:a}),(0,X.jsx)(rn,{connection:a}),(0,X.jsx)(Ft,{connection:a})]}),t[0]=a,t[1]=o);let s;return t[2]!==n||t[3]!==r||t[4]!==o?(s=(0,X.jsx)(So,{children:(0,X.jsxs)(_t,{open:r,onOpenChange:i,children:[n,o]})}),t[2]=n,t[3]=r,t[4]=o,t[5]=s):s=t[5],s}function wo(e,t){return{connection:t.connection,scope:{projectId:e.projectId,worktreeId:e.worktreeId}}}var To=T(e=>Bn(e).pipe(d,Ve(0)));function Eo(e,n){let r=(0,Z.c)(12),i;r[0]!==n||r[1]!==e?(i=To(wo(e,n)),r[0]=n,r[1]=e,r[2]=i):i=r[2];let a=i,o=O(a),s,l,u;if(r[3]!==o){let e=c(q(o));s=o,l=e,u=e?Lr(e):void 0,r[3]=o,r[4]=s,r[5]=l,r[6]=u}else s=r[4],l=r[5],u=r[6];let d=t(a),f;return r[7]!==s||r[8]!==l||r[9]!==u||r[10]!==d?(f={result:s,read:l,phase:u,refresh:d},r[7]=s,r[8]=l,r[9]=u,r[10]=d,r[11]=f):f=r[11],f}function Do(e,t){let{phase:n}=Eo(e,t);return n?.kind===`ready`?n:void 0}function Oo(e,t,n){let r=(0,Z.c)(2),i=Wr(e,t.connection,n).result,a;return r[0]===i?a=r[1]:(a=c(q(i))?.files??[],r[0]=i,r[1]=a),a}function ko(e,t){let n=(0,Z.c)(2),{read:r}=Eo(e,t),i;return n[0]===r?i=n[1]:(i=r?cr(r):`Review`,n[0]=r,n[1]=i),i}function Ao(e,t){let n=(0,Z.c)(2),{result:r}=Eo(e,t),i;return n[0]===r?i=n[1]:(i=Fa({walkthrough:Ea(r,jo)}),n[0]=r,n[1]=i),i}function jo(e){return e}var Mo=T(e=>h(t=>{let n=t(Zr(e));return we(n,e=>{let n=URL.createObjectURL(new Blob([Uint8Array.from(e)]));return t.addFinalizer(()=>URL.revokeObjectURL(n)),n})}));function No(e){let n=(0,Z.c)(3),r={...wo(e.scope,e.context),runId:e.runId,assetId:e.assetId},i=O(Mo(r)),a=t(Zr(r)),o;return n[0]!==i||n[1]!==a?(o={url:i,retry:a},n[0]=i,n[1]=a,n[2]=o):o=n[2],o}function Po(e,n,r,i,a,o){let s=(0,Z.c)(10),c;s[0]!==a||s[1]!==n||s[2]!==o||s[3]!==r||s[4]!==e||s[5]!==i?(c=Bn({...wo(e,n),excerpt:{runId:r,step:i,block:a,...o===void 0?{}:{node:o}}}),s[0]=a,s[1]=n,s[2]=o,s[3]=r,s[4]=e,s[5]=i,s[6]=c):c=s[6];let l=c,u=O(l),d=t(l),f;return s[7]!==u||s[8]!==d?(f={result:u,retry:d},s[7]=u,s[8]=d,s[9]=f):f=s[9],f}function Fo(e,t,n,r,a){let o=(0,Z.c)(8),s;o[0]!==t.connection||o[1]!==e.projectId||o[2]!==e.worktreeId?(s=gn({connection:t.connection,scope:{projectId:e.projectId,worktreeId:e.worktreeId}}),o[0]=t.connection,o[1]=e.projectId,o[2]=e.worktreeId,o[3]=s):s=o[3];let l;o[4]===Symbol.for(`react.memo_cache_sentinel`)?(l={mode:`promiseExit`},o[4]=l):l=o[4];let[u,d]=i(s,l),f=c(q(kr(e,t.connection))),p;o[5]!==t.connection||o[6]!==e.projectId?(p=V({connection:t.connection,projectId:e.projectId}),o[5]=t.connection,o[6]=e.projectId,o[7]=p):p=o[7];let m=O(p);return Sn([u,d],{pulls:m,branch:f?.branch?.name??r?.branch,displayedRun:r,base:n,writer:a})}function Io(e,t){let n=(0,Z.c)(14),{connection:r}=e.context,{projectId:i}=e.scope,a=De(Et),o;n[0]!==r||n[1]!==i||n[2]!==t.branch||n[3]!==t.pullRequestNumber?(o=rr({connection:r,projectId:i,branch:t.branch,pullRequestNumber:t.pullRequestNumber}),n[0]=r,n[1]=i,n[2]=t.branch,n[3]=t.pullRequestNumber,n[4]=o):o=n[4];let s=O(o);if(!s)return;let c;n[5]!==r||n[6]!==e||n[7]!==a||n[8]!==i||n[9]!==s?(c=t=>{a(t===void 0?void 0:{projectId:i,number:s.number,name:t}),e.onOpen(mt({projectId:i,number:s.number,environmentId:r.environmentId,shownOn:r.environmentId}))},n[5]=r,n[6]=e,n[7]=a,n[8]=i,n[9]=s,n[10]=c):c=n[10];let l;return n[11]!==s||n[12]!==c?(l={...s,openCheck:c},n[11]=s,n[12]=c,n[13]=l):l=n[13],l}function $(e){let t=(0,Z.c)(4),{text:n}=e,r;t[0]===n?r=t[1]:(r=an(n).map(Lo),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,X.jsx)(X.Fragment,{children:r}),t[2]=r,t[3]=i),i}function Lo(e,t){return e.kind===`code`?(0,X.jsx)(`code`,{className:`rounded bg-muted px-1 py-px font-mono text-[0.86em]`,children:e.text},t):e.text}var Ro=a(`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 dark:*:data-[slot=bubble-content]:bg-input/30 [&>[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 zo({variant:e=`default`,align:t=`start`,className:n,...r}){return(0,X.jsx)(`div`,{"data-slot":`bubble`,"data-variant":e,"data-align":t,className:j(Ro({variant:e}),n),...r})}function Bo({className:e,render:t,...n}){return p({defaultTagName:`div`,props:W({className:j(`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`}})}a(`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 Vo({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`message-group`,className:j(`flex min-w-0 flex-col gap-1.5`,e),...t})}function Ho({className:e,align:t=`start`,...n}){return(0,X.jsx)(`div`,{"data-slot":`message`,"data-align":t,className:j(`group/message relative flex w-full min-w-0 gap-1.5 text-xs/relaxed data-[align=end]:flex-row-reverse`,e),...n})}function Uo({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`message-content`,className:j(`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 Wo({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`message-header`,className:j(`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 Go({scope:e,context:t,run:n}){return{connection:t.connection,runId:n.id,scope:{projectId:e.projectId,worktreeId:e.worktreeId}}}function Ko(e){let n=(0,Z.c)(10),r;n[0]===e?r=n[1]:(r=un(Go(e)),n[0]=e,n[1]=r);let i=r,a=O(i),o;n[2]===a?o=n[3]:(o=c(q(a)),n[2]=a,n[3]=o);let s;n[4]===a?s=n[5]:(s=me(a),n[4]=a,n[5]=s);let l=t(i),u;return n[6]!==o||n[7]!==s||n[8]!==l?(u={view:o,failed:s,refresh:l},n[6]=o,n[7]=s,n[8]=l,n[9]=u):u=n[9],u}function qo(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=i(e,n),a;return t[1]===r?a=t[2]:(a=Jr(r),t[1]=r,t[2]=a),a}function Jo(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:(n=Nt(Go(e)),t[0]=e,t[1]=n);let r=qo(n.retryAnswer),i;return t[2]===r?i=t[3]:(i={retry:r},t[2]=r,t[3]=i),i}function Yo(e,t){let n=(0,Z.c)(7),[r,i]=(0,Y.useState)(),a=Jo(e),o;n[0]!==a.retry||n[1]!==t?(o=()=>{i(void 0),a.retry.run(t).catch(e=>i(ja(e)))},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 Xo(e,t){let n=Go(e);return Pa(i(vr(n,e.run,t)),qo(Nt(n).addMessage),{runId:n.runId,title:t})}function Zo(e){let t=(0,Z.c)(8),n;t[0]===e?n=t[1]:(n=Nt(Go(e)),t[0]=e,t[1]=n);let r=qo(n.decideCall),[i,a]=(0,Y.useState)(),o;t[2]===r?o=t[3]:(o=e=>{a(void 0),r.run(Pn(e)).catch(e=>a(ja(e)))},t[2]=r,t[3]=o);let s;return t[4]!==r.waiting||t[5]!==i||t[6]!==o?(s={failure:i,waiting:r.waiting,decide:o},t[4]=r.waiting,t[5]=i,t[6]=o,t[7]=s):s=t[7],s}function Qo(e,t){let n=(0,Z.c)(11),r;n[0]!==e.context||n[1]!==e.scope?(r={scope:e.scope,context:e.context},n[0]=e.context,n[1]=e.scope,n[2]=r):r=n[2];let i=ar(r),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(),l;n[3]!==i.add||n[4]!==t?(l=e=>{c(void 0),i.add.run({anchor:{kind:`step`,title:t},text:e}).then(()=>o(!0),()=>c(`The comment was not saved. Try again.`))},n[3]=i.add,n[4]=t,n[5]=l):l=n[5];let u;return n[6]!==a||n[7]!==i.add.waiting||n[8]!==s||n[9]!==l?(u={added:a,failure:s,waiting:i.add.waiting,add:l},n[6]=a,n[7]=i.add.waiting,n[8]=s,n[9]=l,n[10]=u):u=n[10],u}function $o(e){let t=(0,Z.c)(40),{message:n,question:r,stepTitle:i,owner:a}=e,[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(!1),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>e=>{if(!e)return;let t=()=>l(e.scrollHeight>e.clientHeight);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},t[0]=u):u=t[0];let[d]=(0,Y.useState)(u),{failure:f,waiting:p,retry:m}=Yo(a,n.replyTo),h=n.state,g=ye(a.context),_;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(Wo,{children:`Walkthrough agent`}),t[1]=_):_=t[1];let v;t[2]!==o||t[3]!==h.status||t[4]!==h.text?(v=h.status===`answered`?(0,X.jsx)(`span`,{ref:d,className:o?void 0:`line-clamp-3`,children:(0,X.jsx)($,{text:h.text})}):null,t[2]=o,t[3]=h.status,t[4]=h.text,t[5]=v):v=t[5];let y;t[6]===h.status?y=t[7]:(y=h.status===`answering`&&(0,X.jsx)(`span`,{role:`status`,className:`text-muted-foreground`,children:`Working…`}),t[6]=h.status,t[7]=y);let b;t[8]!==h.failure||t[9]!==h.status?(b=h.status===`failed`&&(0,X.jsx)(`span`,{children:h.failure.message}),t[8]=h.failure,t[9]=h.status,t[10]=b):b=t[10];let x;t[11]!==v||t[12]!==y||t[13]!==b?(x=(0,X.jsx)(zo,{variant:`ghost`,className:`max-w-full`,children:(0,X.jsxs)(Bo,{className:`whitespace-pre-wrap`,children:[v,y,b]})}),t[11]=v,t[12]=y,t[13]=b,t[14]=x):x=t[14];let S;t[15]!==c||t[16]!==o||t[17]!==h.status?(S=h.status===`answered`&&!o&&c&&(0,X.jsx)(H,{variant:`link`,size:`flush`,onClick:()=>s(!0),children:`Read all`}),t[15]=c,t[16]=o,t[17]=h.status,t[18]=S):S=t[18];let C;t[19]!==m||t[20]!==h.status||t[21]!==p||t[22]!==g?(C=h.status===`failed`&&(0,X.jsx)(H,{variant:`link`,size:`flush`,disabled:p||!!g,"aria-description":g,onClick:()=>m(),children:`Try again`}),t[19]=m,t[20]=h.status,t[21]=p,t[22]=g,t[23]=C):C=t[23];let w;t[24]!==a||t[25]!==r||t[26]!==h.status||t[27]!==h.text||t[28]!==i?(w=h.status===`answered`&&i!==void 0&&(0,X.jsx)(es,{owner:a,stepTitle:i,text:fn(r,h.text)}),t[24]=a,t[25]=r,t[26]=h.status,t[27]=h.text,t[28]=i,t[29]=w):w=t[29];let T;t[30]!==S||t[31]!==C||t[32]!==w?(T=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[S,C,w]}),t[30]=S,t[31]=C,t[32]=w,t[33]=T):T=t[33];let E;t[34]===f?E=t[35]:(E=f&&(0,X.jsx)(`p`,{role:`alert`,className:`text-caption text-destructive`,children:f}),t[34]=f,t[35]=E);let D;return t[36]!==T||t[37]!==E||t[38]!==x?(D=(0,X.jsx)(Ho,{children:(0,X.jsxs)(Uo,{children:[_,x,T,E]})}),t[36]=T,t[37]=E,t[38]=x,t[39]=D):D=t[39],D}function es(e){let t=(0,Z.c)(13),{owner:n,stepTitle:r,text:i}=e,a=Qo(n,r),o=ye(n.context);if(a.added){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`span`,{role:`status`,className:`text-caption text-muted-foreground`,children:`Added to the review`}),t[0]=e):e=t[0],e}let s=a.waiting||!!o,c;t[1]!==a||t[2]!==i?(c=()=>a.add(i),t[1]=a,t[2]=i,t[3]=c):c=t[3];let l;t[4]!==s||t[5]!==c||t[6]!==o?(l=(0,X.jsx)(H,{variant:`link`,size:`flush`,disabled:s,"aria-description":o,onClick:c,children:`Add to review`}),t[4]=s,t[5]=c,t[6]=o,t[7]=l):l=t[7];let u;t[8]===a.failure?u=t[9]:(u=a.failure&&(0,X.jsx)(`span`,{role:`alert`,className:`text-caption text-destructive`,children:a.failure}),t[8]=a.failure,t[9]=u);let d;return t[10]!==l||t[11]!==u?(d=(0,X.jsxs)(X.Fragment,{children:[l,u]}),t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function ts({conversation:e,owner:t,stepTitle:n}){return Ma(e).map(({message:e,reply:r})=>(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(Ho,{align:`end`,children:(0,X.jsx)(Uo,{children:(0,X.jsx)(zo,{align:`end`,variant:`secondary`,children:(0,X.jsx)(Bo,{className:`whitespace-pre-wrap`,children:(0,X.jsx)($,{text:e.text})})})})}),r&&(0,X.jsx)($o,{owner:t,message:r,question:e.text,stepTitle:n})]},e.id))}function ns(e){let t=(0,Z.c)(53),{owner:n,title:r,placeholder:i,onComment:a}=e,o=ye(n.context),{text:s,failure:c,waiting:l,change:u,send:d}=Xo(n,r),f;t[0]!==d||t[1]!==o?(f=()=>{o||d()},t[0]=d,t[1]=o,t[2]=f):f=t[2];let p=f,m;t[3]===u?m=t[4]:(m=()=>u(``),t[3]=u,t[4]=m);let{waiting:h,failure:g,submit:_}=nr(a,m),v;t[5]!==_||t[6]!==s||t[7]!==o?(v=()=>{let e=s.trim();e&&!o&&_(e)},t[5]=_,t[6]=s,t[7]=o,t[8]=v):v=t[8];let y=v,b;t[9]===u?b=t[10]:(b=e=>u(e.target.value),t[9]=u,t[10]=b);let S;t[11]===p?S=t[12]:(S=e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),p())},t[11]=p,t[12]=S);let w;t[13]!==i||t[14]!==b||t[15]!==S||t[16]!==s?(w=(0,X.jsx)(Dn,{value:s,rows:1,maxLength:8e3,"aria-label":i,placeholder:i,className:`min-h-9`,onChange:b,onKeyDown:S}),t[13]=i,t[14]=b,t[15]=S,t[16]=s,t[17]=w):w=t[17];let T;t[18]!==y||t[19]!==h||t[20]!==a||t[21]!==s||t[22]!==o?(T=a&&(0,X.jsx)(An,{size:`xs`,variant:`outline`,focusableWhenDisabled:!0,disabled:!s.trim()||h||!!o,"aria-description":o,onClick:y,children:`Comment`}),t[18]=y,t[19]=h,t[20]=a,t[21]=s,t[22]=o,t[23]=T):T=t[23];let E=a?`xs`:`icon-xs`,D=a?`Ask`:`Send`,O;t[24]!==s||t[25]!==l||t[26]!==o?(O=!s.trim()||l||!!o,t[24]=s,t[25]=l,t[26]=o,t[27]=O):O=t[27];let k=a&&`Ask`,A;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(on,{}),t[28]=A):A=t[28];let j;t[29]!==p||t[30]!==O||t[31]!==k||t[32]!==E||t[33]!==D||t[34]!==o?(j=(0,X.jsx)(x,{render:(0,X.jsxs)(An,{size:E,variant:`default`,"aria-label":D,focusableWhenDisabled:!0,disabled:O,"aria-description":o,onClick:p,children:[k,A]})}),t[29]=p,t[30]=O,t[31]=k,t[32]=E,t[33]=D,t[34]=o,t[35]=j):j=t[35];let M=a?`Ask the Walkthrough agent`:`Send`,N;t[36]===M?N=t[37]:(N=(0,X.jsx)(He,{children:M}),t[36]=M,t[37]=N);let P;t[38]!==j||t[39]!==N?(P=(0,X.jsxs)(C,{children:[j,N]}),t[38]=j,t[39]=N,t[40]=P):P=t[40];let F;t[41]!==P||t[42]!==T?(F=(0,X.jsxs)(Bt,{align:`inline-end`,children:[T,P]}),t[41]=P,t[42]=T,t[43]=F):F=t[43];let I;t[44]!==F||t[45]!==w?(I=(0,X.jsxs)(Nr,{children:[w,F]}),t[44]=F,t[45]=w,t[46]=I):I=t[46];let L;t[47]!==g||t[48]!==c?(L=(c??g)&&(0,X.jsx)(`p`,{role:`alert`,className:`text-caption text-destructive`,children:c??g}),t[47]=g,t[48]=c,t[49]=L):L=t[49];let R;return t[50]!==I||t[51]!==L?(R=(0,X.jsxs)(X.Fragment,{children:[I,L]}),t[50]=I,t[51]=L,t[52]=R):R=t[52],R}function rs(e){let t=(0,Z.c)(16),{owner:n,title:r}=e,i;t[0]!==n.context||t[1]!==n.scope?(i={scope:n.scope,context:n.context},t[0]=n.context,t[1]=n.scope,t[2]=i):i=t[2];let a=i,{view:o}=In(a),s,c,l;if(t[3]!==a||t[4]!==r||t[5]!==o){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[9]===r?e=t[10]:(e=e=>e.kind===`step`&&e.title===r,t[9]=r,t[10]=e);let n=Hn(o,e);if(n.length===0){l=null;break bb0}s=`flex flex-col gap-2`;let i;t[11]===a?i=t[12]:(i=e=>(0,X.jsx)(br,{owner:a,comment:e},e.id),t[11]=a,t[12]=i),c=n.map(i)}t[3]=a,t[4]=r,t[5]=o,t[6]=s,t[7]=c,t[8]=l}else s=t[6],c=t[7],l=t[8];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;return t[13]!==s||t[14]!==c?(u=(0,X.jsx)(`div`,{className:s,children:c}),t[13]=s,t[14]=c,t[15]=u):u=t[15],u}function is(e){let t=(0,Z.c)(31),{owner:n,title:r,stepTitle:i}=e,{view:a,failed:o,refresh:s}=Ko(n),c;t[0]!==n.context||t[1]!==n.scope?(c={scope:n.scope,context:n.context},t[0]=n.context,t[1]=n.scope,t[2]=c):c=t[2];let l=ar(c),u,d,f;if(t[3]!==o||t[4]!==n||t[5]!==s||t[6]!==i||t[7]!==r||t[8]!==a){let e=Na(a,r);u=`flex flex-col gap-3`,t[12]!==o||t[13]!==s?(d=o&&(0,X.jsxs)(`p`,{role:`alert`,className:`text-caption`,children:[`Comments could not be read.`,` `,(0,X.jsx)(H,{variant:`link`,size:`flush`,onClick:s,children:`Try again`})]}),t[12]=o,t[13]=s,t[14]=d):d=t[14],f=e.length>0&&(0,X.jsx)(`div`,{className:`border-t pt-3`,children:(0,X.jsx)(Vo,{children:e.map(e=>(0,X.jsx)(ts,{owner:n,conversation:e,stepTitle:i},e.runId))})}),t[3]=o,t[4]=n,t[5]=s,t[6]=i,t[7]=r,t[8]=a,t[9]=u,t[10]=d,t[11]=f}else u=t[9],d=t[10],f=t[11];let p;t[15]!==n||t[16]!==i?(p=(0,X.jsx)(rs,{owner:n,title:i}),t[15]=n,t[16]=i,t[17]=p):p=t[17];let m;t[18]!==l.add||t[19]!==i?(m=e=>l.add.run({anchor:{kind:`step`,title:i},text:e}),t[18]=l.add,t[19]=i,t[20]=m):m=t[20];let h;t[21]!==n||t[22]!==m||t[23]!==r?(h=(0,X.jsx)(ns,{owner:n,title:r,placeholder:`Comment on this step, or ask the agent`,onComment:m}),t[21]=n,t[22]=m,t[23]=r,t[24]=h):h=t[24];let g;return t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==h?(g=(0,X.jsxs)(`div`,{className:u,children:[d,f,p,h]}),t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=h,t[30]=g):g=t[30],g}function as(e){let t=(0,Z.c)(18),{owner:n,titles:r}=e,{view:i}=Ko(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=Aa(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,X.jsx)(`h2`,{className:`text-ui font-semibold`,children:`Earlier comments`}),t[8]=c):c=t[8],a=Vo;let u;t[9]===n?u=t[10]:(u=(e,t)=>(0,X.jsx)(ts,{owner:n,conversation:e,stepTitle:void 0},`${e.runId}:${t}`),t[9]=n,t[10]=u),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[11]!==a||t[12]!==o?(u=(0,X.jsx)(a,{children:o}),t[11]=a,t[12]=o,t[13]=u):u=t[13];let d;return t[14]!==s||t[15]!==c||t[16]!==u?(d=(0,X.jsxs)(`section`,{className:s,children:[c,u]}),t[14]=s,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function os(e){let t=(0,Z.c)(3),{copy:n}=e,r=n.message&&` ${n.message}`,i;return t[0]!==n.title||t[1]!==r?(i=(0,X.jsxs)(`p`,{role:`alert`,className:`min-w-0 flex-1 basis-64 font-medium text-pretty`,children:[n.title,r]}),t[0]=n.title,t[1]=r,t[2]=i):i=t[2],i}function ss(e){let t=(0,Z.c)(76),{run:n,requesting:r,first:i,reused:a,freshness:o,failure:s,onUpdate:c,writeBlock:l,controls:u}=e,d=r!==void 0&&r,f=i!==void 0&&i,p=a!==void 0&&a,m,h,g,_,v,y,b,x,S,C,w,T,E,D;if(t[0]!==u||t[1]!==s||t[2]!==f||t[3]!==o||t[4]!==c||t[5]!==d||t[6]!==p||t[7]!==n||t[8]!==l){x=Symbol.for(`react.early_return_sentinel`);bb0:{if(m=za(n,d,f),n.state.status===`ready`&&!m.active&&!d&&!s){let e=o===`changed`,r;t[23]!==e||t[24]!==p||t[25]!==n.state.writtenAt?(r=p&&!e?`Already up to date: the saved walkthrough was reused.`:(0,X.jsxs)(X.Fragment,{children:[`Saved`,` `,(0,X.jsx)(`time`,{dateTime:n.state.writtenAt,children:new Date(n.state.writtenAt).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}),e&&` · Behind the current work`]}),t[23]=e,t[24]=p,t[25]=n.state.writtenAt,t[26]=r):r=t[26];let i;t[27]===r?i=t[28]:(i=(0,X.jsx)(`p`,{role:`status`,children:r}),t[27]=r,t[28]=i);let a;t[29]!==e||t[30]!==u||t[31]!==c||t[32]!==l?(a=c&&u?.({label:`Update walkthrough`,variant:e?`outline`:`ghost`,disabled:!!l,description:l,onClick:c}),t[29]=e,t[30]=u,t[31]=c,t[32]=l,t[33]=a):a=t[33];let s;t[34]!==i||t[35]!==a?(s=(0,X.jsxs)(`section`,{"aria-label":`Walkthrough status`,className:`flex flex-wrap items-center justify-between gap-2 text-caption text-muted-foreground`,children:[i,a]}),t[34]=i,t[35]=a,t[36]=s):s=t[36],x=s;break bb0}T=`Walkthrough status`,E=`flex flex-col gap-3 rounded-lg border p-4 text-ui`;let e=s&&!m.active?(0,X.jsx)(os,{copy:wr(s.failure,s.writer)}):(0,X.jsx)(`p`,{role:`status`,className:`font-medium`,children:m.label}),r=!m.active&&c&&u?.({label:s?`Try again`:`Update walkthrough`,disabled:!!l,description:l,onClick:c});t[37]!==e||t[38]!==r?(D=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[e,r]}),t[37]=e,t[38]=r,t[39]=D):D=t[39],t[40]!==n.state.status||t[41]!==n.state.writtenAt?(h=n.state.status===`ready`&&(0,X.jsxs)(`p`,{className:`text-caption text-muted-foreground`,children:[`Last written`,` `,(0,X.jsx)(`time`,{dateTime:n.state.writtenAt,children:new Date(n.state.writtenAt).toLocaleString()})]}),t[40]=n.state.status,t[41]=n.state.writtenAt,t[42]=h):h=t[42],t[43]!==d||t[44]!==p?(g=p&&!d&&(0,X.jsx)(`p`,{className:`text-caption text-muted-foreground`,children:`This snapshot already has a walkthrough. The saved version was reused.`}),t[43]=d,t[44]=p,t[45]=g):g=t[45];let i=m.total,a=m.completed,O=m.label,k=n.state.status===`failed`?`bg-destructive`:`bg-primary`,A;t[46]===k?A=t[47]:(A=j(`h-full`,k),t[46]=k,t[47]=A);let M=`${m.completed/m.total*100}%`,N;t[48]===M?N=t[49]:(N={width:M},t[48]=M,t[49]=N);let P;t[50]!==A||t[51]!==N?(P=(0,X.jsx)(`div`,{className:A,style:N}),t[50]=A,t[51]=N,t[52]=P):P=t[52],_=(0,X.jsx)(`div`,{role:`progressbar`,"aria-label":`Walkthrough stages`,"aria-valuemin":0,"aria-valuemax":i,"aria-valuenow":a,"aria-valuetext":O,className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:P}),v=(0,X.jsx)(`ol`,{"aria-label":`Update stages`,className:`flex flex-wrap gap-x-4 gap-y-1 text-caption text-muted-foreground`,children:m.steps.map((e,t)=>{let r=!d&&t===m.completed,i=t<m.completed;return(0,X.jsxs)(`li`,{"aria-current":r?`step`:void 0,className:j(`flex items-center gap-1`,r&&`font-medium text-foreground`,r&&n.state.status===`failed`&&`text-destructive`),children:[i?(0,X.jsx)(R,{"aria-label":`Done`,className:`size-3 shrink-0 text-add-fg`}):(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[t+1,`.`]}),e]},e)})}),t[53]===d?y=t[54]:(y=d&&(0,X.jsx)(`p`,{children:`Sending the request and capturing the current work.`}),t[53]=d,t[54]=y),b=o&&(m.active||Ba(o))&&(0,X.jsx)(`p`,{className:`text-foreground-2`,children:m.active?`Showing the saved walkthrough while the update runs.`:Ba(o)}),t[55]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,X.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:`Writing log`}),t[55]=w):w=t[55],S=`mt-2 flex flex-col gap-2 text-caption text-foreground-2`,C=m.entries.map(cs)}t[0]=u,t[1]=s,t[2]=f,t[3]=o,t[4]=c,t[5]=d,t[6]=p,t[7]=n,t[8]=l,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]=w,t[20]=T,t[21]=E,t[22]=D}else m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22];if(x!==Symbol.for(`react.early_return_sentinel`))return x;let O;t[56]===m.entries.length?O=t[57]:(O=m.entries.length===0&&(0,X.jsx)(`li`,{children:`This walkthrough predates the writing log. Its recorded status is shown above.`}),t[56]=m.entries.length,t[57]=O);let k;t[58]!==O||t[59]!==S||t[60]!==C?(k=(0,X.jsxs)(`ol`,{className:S,children:[C,O]}),t[58]=O,t[59]=S,t[60]=C,t[61]=k):k=t[61];let A;t[62]!==k||t[63]!==w?(A=(0,X.jsxs)(`details`,{children:[w,k]}),t[62]=k,t[63]=w,t[64]=A):A=t[64];let M;return t[65]!==h||t[66]!==g||t[67]!==_||t[68]!==v||t[69]!==y||t[70]!==b||t[71]!==A||t[72]!==T||t[73]!==E||t[74]!==D?(M=(0,X.jsxs)(`section`,{"aria-label":T,className:E,children:[D,h,g,_,v,y,b,A]}),t[65]=h,t[66]=g,t[67]=_,t[68]=v,t[69]=y,t[70]=b,t[71]=A,t[72]=T,t[73]=E,t[74]=D,t[75]=M):M=t[75],M}function cs(e,t){return(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`time`,{dateTime:e.at,className:`mr-2 font-mono`,children:new Date(e.at).toLocaleString()}),e.message]},`${e.at}:${t}`)}function ls(e){let t=(0,Z.c)(8),{label:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=/^(.*\s)([0-9a-f]{7})$/,t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=r.exec(n),t[1]=n,t[2]=i);let a=i;if(!a)return n;let o;t[3]===a[2]?o=t[4]:(o=(0,X.jsx)(`span`,{className:`font-mono`,children:a[2]}),t[3]=a[2],t[4]=o);let s;return t[5]!==a[1]||t[6]!==o?(s=(0,X.jsxs)(X.Fragment,{children:[a[1],o]}),t[5]=a[1],t[6]=o,t[7]=s):s=t[7],s}function us(e,{orientation:t=`horizontal`,dir:n=`ltr`,arrows:r=`all`}={}){if(Bi(e))return null;if(e.key===`Home`)return{bound:`min`};if(e.key===`End`)return{bound:`max`};if(e.key===`PageUp`||e.key===`PageDown`)return{direction:e.key===`PageUp`?1:-1,size:`large`};let i=n===`rtl`&&t===`horizontal`?-1:1,a=r===`horizontal`?0:e.key===`ArrowUp`?1:e.key===`ArrowDown`?-1:0,o=r===`vertical`?0:e.key===`ArrowRight`?i:e.key===`ArrowLeft`?-i:0,s=a||o;return s?{direction:s,size:e.shiftKey?`large`:e.altKey?`small`:`step`}:null}function ds(e,t,n){return fs(t>0?e[t-1]:void 0,e[t+1],n)}function fs(e,t,n){let r=n.minStepsBetweenThumbs*n.step,i=Xi(n),a=Wi(e===void 0?n.min:e+r,n.min,i);return{lower:a,upper:Wi(t===void 0?i:t-r,a,i)}}function ps(e,t,n,r){let{lower:i,upper:a}=ds(e,t,r),o=Wi(Qi(n,r),i,a);if(o===e[t])return e;let s=e.slice();return s[t]=o,s}function ms(e,t){return e.map(e=>Wi(e,t.min,t.max)).sort((e,t)=>e-t)}function hs(e,{shiftKey:t=!1,rtl:n=!1,orientation:r=`horizontal`}={},i,a,o){let s=us({key:e,shiftKey:t},{orientation:r,dir:n?`rtl`:`ltr`});return s?`bound`in s?s.bound===`min`?a.lower:a.upper:ea(i,s,o):null}function gs(e,t){let n=0;for(let r=1;r<e.length;r++)Math.abs(e[r]-t)<Math.abs(e[n]-t)&&(n=r);let r=_s(e,n);return r.length===1?{index:n,stack:r}:t<e[n]?{index:r[0],stack:r}:t>e[n]?{index:r[r.length-1],stack:r}:{index:null,stack:r}}function _s(e,t){let n=[];for(let r=0;r<e.length;r++)e[r]===e[t]&&n.push(r);return n}function vs(e,t){return t<0?e[0]:e[e.length-1]}function ys(e,t){return t.max>t.min?bs((Wi(e,t.min,t.max)-t.min)/(t.max-t.min)*100):0}function bs(e){return Math.round(e*1e4)/1e4}function xs(e,t,{rtl:n=!1,vertical:r=!1}={}){let i=r?(t.top+t.height-e.y)/t.height:n?(t.left+t.width-e.x)/t.width:(e.x-t.left)/t.width;return Number.isFinite(i)?Wi(i,0,1):0}function Ss(e,t){return t.min+Wi(e,0,1)*(t.max-t.min)}var Cs=e=>rt(e)||e.readOnly,ws=e=>Array.isArray(e)?e:[e];function Ts(e){let t={};return ws(e).forEach((e,n)=>t[n]=e),t}function Es(e,t){return Array.isArray(t)?e[t.length]===void 0&&t.every((t,n)=>Object.is(e[n],t)):Object.is(e[0],t)&&e[1]===void 0}var Ds=(e,t)=>Array.isArray(t)?e:e[0];function Os(e){return{min:e.min,max:e.max,step:e.step,largeStep:e.largeStep,minStepsBetweenThumbs:e.minStepsBetweenThumbs}}function ks(e){return{min:e.min??0,max:e.max??100,step:e.step&&e.step>0?e.step:1}}function As(e,t){let n=ks(t);return Array.isArray(e)?ms(e,n):Wi(e,n.min,n.max)}function js(e){let t=ks(e);return{...t,largeStep:e.largeStep??t.step*10,minStepsBetweenThumbs:e.minStepsBetweenThumbs??0,orientation:Oe(e.orientation,`horizontal`),disabled:!!e.disabled,readOnly:!!e.readOnly,required:!!e.required,name:e.name,form:e.form,format:e.format,locale:e.locale}}function Ms(e,t){let n=typeof t.format==`function`?t.format:aa(t.format,t.step);return oa(e,f(t),n)}function Ns(e){return e.join(`/`)}function Ps(e){return Array.isArray(e.value)?Ns(e.value):String(e.value)}function Fs(e){let{store:t,options:n,element:r}=e,i=E(e),a=I(e),o=Vi(e.onDestroy),s,c,l=()=>Os(t.get()),u=()=>ws(t.get().value),d=()=>{let e=r(`root`);return Xe(e)?e:r(`input`)};function f(e,n,r,a,o=!0){if(e===u())return!1;let s=i(`value`,Ds(e,t.get().value),{reason:n,event:r,thumb:a});return s&&(a!==null&&t.set({last:a}),o&&le(d(),[`input`])),s}function p(e,n,r,i=null,o=!0){let s=t.get().value;J(e,s)||(a(`value`,s,{reason:n,event:r,thumb:i}),o&&le(d(),[`change`]))}let m=e=>r(`thumb-input`,String(e));function h(e,r,a){let o=ws(As(e,n())),s=o.reduce((e,t,n)=>ps(e,n,t,l()),o);return!J(s,u())&&i(`value`,Ds(s.slice(),t.get().value),{reason:r,event:a,thumb:null})}let g={getValue:()=>t.get().value,setValue:(e,{reason:n=`imperative`,event:r}={})=>!Cs(t.get())&&h(e,n,r),focus:(e=0)=>m(e)?.focus(),internal:{press(e,n){if(!o.accepts(e)||Cs(t.get())||s)return;let i=(r(`track`)??n).getBoundingClientRect(),a=zi(n),c=t.get().orientation===`vertical`,u=(e,t)=>Ss(xs({x:e,y:t},i,{rtl:a,vertical:c}),l()),d=e.target.closest(`[data-slot="slider-thumb"]`),f=d&&n.contains(d)?Number(d.getAttribute(`data-index`)??0):null;e.preventDefault();let p=g.internal.begin(u(e.clientX,e.clientY),f,e);m(p)?.focus({preventScroll:!0}),o.start(n,e,{onMove:e=>g.internal.move(u(e.x,e.y),e.event),onEnd:e=>g.internal.end(e)})},begin(e,n,r){let i=t.get().value,a,o,c=0;n===null?({index:a,stack:o}=gs(u(),e),a!==null&&f(ps(u(),a,e,l()),`track-press`,r,a)):(o=_s(u(),n),a=o.length>1?null:n,c=e-u()[n]);let d=a??o[0];return s={index:a,stack:o,offset:c,start:i,reason:`track-press`,event:r},t.set({active:d}),d},move(e,n){if(!s)return;let r=e-s.offset;if(s.index===null){let e=Math.sign(r-u()[s.stack[0]]);if(e===0)return;s.index=vs(s.stack,e),m(s.index)?.focus({preventScroll:!0}),t.set({active:s.index})}f(ps(u(),s.index,r,l()),`drag`,n,s.index)&&(s.reason=`drag`,s.event=n)},end(e){let n=s;s=void 0,t.set({active:null}),n&&p(n.start,n.reason,e,n.index)},adjust(e,n,r){if(t.get().readOnly)return;let i=t.get().value;f(ps(u(),e,n,l()),`accessibility-adjust`,r,e,!1),p(i,`accessibility-adjust`,r,e,!1)},keydown(e,n,r){let i=t.get();if(rt(i))return;let a=u()[n]??i.min,o=hs(e.key,{shiftKey:e.shiftKey,rtl:zi(r),orientation:i.orientation},a,ds(u(),n,l()),l());o!==null&&(e.preventDefault(),i.readOnly||(c??={start:i.value,thumb:n},c.event=e,f(ps(u(),n,o,l()),`step-key`,e,n)))},commitKeys(e){if(!c)return;let{start:t,thumb:n,event:r}=c;c=void 0,p(t,`step-key`,e??r,n)},reset(){tt(n().value,n().defaultValue)||i(`value`,t.get().initial,{reason:`reset`,thumb:null})},restore(e){let n=sa(e);n&&h(Ds(n,t.get().value),`restore`)},setFormDisabled(e){t.set({formDisabled:e})},submitted:()=>t.get().name===void 0?null:Ps(t.get()),syncInput(e,n){let{lower:r,upper:i}=ds(u(),n,l()),a=String(r),o=String(i),s=String(u()[n]??t.get().min);e.min!==a&&(e.min=a),e.max!==o&&(e.max=o),e.value!==s&&(e.value=s)}}};Qe(e,[`value`],(e,t,n)=>{let{min:r,max:i}=ks(n);if(n.value!==void 0||!(r<=i))return;let a=As(t.value,n);if(!J(a,t.value))return{value:a}});let _={value:t.get().value,thumbValues:t.get().thumbValues};return B(e,[`thumbValues`],({value:e})=>{if(!Es(nt(t).thumbValues,e))return J(e,_.value)||(_={value:e,thumbValues:Ts(e)}),{thumbValues:_.thumbValues}}),t.subscribe(()=>{s&&Cs(t.get())&&(o.cancel(),g.internal.end())}),g}var Is=Fs;function Ls(e){let t=e===null?null:sa(e);if(t)return t.length===1?t[0]:t}function Rs(e){return{value:e.value,...zs(e)}}function zs(e){return{disabled:rt(e),readOnly:e.readOnly,required:e.required,dragging:e.active!==null,orientation:e.orientation}}var Bs=(e,t)=>e.thumbValues[t]??e.min;function Vs(e){return{"data-orientation":e.orientation,"data-disabled":rt(e)?``:void 0,"data-readonly":e.readOnly?``:void 0,"data-required":e.required?``:void 0,"data-dragging":e.active===null?void 0:``}}function Hs(e,t,n){n||=0;let r=e.orientation===`vertical`;return ln({position:`absolute`,...r?{bottom:`${n}%`,left:`50%`,translate:`-50% 50%`}:{"inset-inline":`calc(${n}% - 50%) calc(50% - ${n}%)`,"margin-inline":`auto`,"justify-self":`center`,top:`50%`,translate:`0 -50%`},"z-index":e.active===t?2:e.last===t?1:void 0,"--slider-thumb-position":`${n}%`})}function Us(e){let t=Os(e),n=ws(e.value),r=n.length>1?ys(n[0],t):0,i=ys(n[n.length-1],t),a=Math.round((i-r)*1e4)/1e4,o=e.orientation===`vertical`;return ln({position:`absolute`,[o?`bottom`:`inset-inline-start`]:`${r}%`,[o?`height`:`width`]:`${a}%`,...o?{left:0,right:0}:{top:0,bottom:0},"--slider-indicator-start":`${r}%`,"--slider-indicator-size":`${a}%`})}var Ws=ln({position:`absolute`,inset:0,width:`100%`,height:`100%`,margin:0,padding:0,border:0,opacity:0,overflow:`hidden`,"clip-path":`inset(50%)`,"white-space":`nowrap`,"pointer-events":`none`}),Gs=(e,t,n)=>n===0&&e.thumbInputId||`${t}-thumb-${n}`,Ks=Se({name:`slider`,options:{value:Ls,defaultValue:Ls,onValueChange:`callback`,onValueCommit:`callback`,min:`number`,max:`number`,step:`number`,largeStep:`number`,minStepsBetweenThumbs:`number`,orientation:`string`,disabled:`boolean`,readOnly:`boolean`,required:`boolean`,name:`string`,form:`string`,format:`value`,locale:`string`,controller:`value`,thumbInputId:`string`},state:e=>{let t=As(e.value??e.defaultValue??e.min??0,e);return{...js(e),value:t,initial:As(e.defaultValue??t,e),formDisabled:!1,pageLocale:null,active:null,last:null,thumbValues:Ts(t),thumbInputId:e.thumbInputId??null}},sync:e=>({...js(e),...e.defaultValue===void 0?{}:{initial:As(e.defaultValue,e)},...e.value===void 0?{}:{value:As(e.value,e)},...e.thumbInputId===void 0?{}:{thumbInputId:e.thumbInputId}}),commits:[`value`],api:Is,slots:e=>({root:e({role:`group`,state:Rs,attrs:(e,{id:t})=>({id:e.thumbInputId&&ws(e.value).length>1?`${t}-group`:void 0,...Vs(e)}),bind:(e,{api:t,store:n})=>(ie(e,e=>n.set({pageLocale:e})),Ce(e,{value:t.internal.submitted,state:()=>Ps(n.get()),restore:t.internal.restore,valueMissing:()=>!1,message:()=>``,anchor:()=>e.querySelector(`[data-slot="slider-thumb-input"]`)??e,focus:()=>t.focus(),reset:t.internal.reset,disabled:t.internal.setFormDisabled,subscribe:n.subscribe}))}),control:e({state:Rs,attrs:e=>({...Vs(e),style:`touch-action:none`}),on:{pointerdown:(e,{api:t,el:n})=>n&&t.internal.press(e,n)}}),track:e({state:Rs,attrs:e=>({...Vs(e),style:`position:relative`})}),indicator:e({state:Rs,attrs:e=>({...Vs(e),style:Us(e)})}),thumb:e({props:{index:`number`},selects:Ye({value:[],thumbValues:({props:e})=>[String(e.index??0)],last:({props:e})=>[e.index??0]}),state:(e,{props:t})=>{let n=t.index??0,r=Bs(e,n);return{...zs(e),index:n,thumbValue:r,percent:ys(r,Os(e))}},attrs:(e,{props:t})=>{let n=t.index??0,r=ys(Bs(e,n),Os(e));return{...Vs(e),"data-index":String(n),"data-dragging":e.active===n?``:void 0,style:Hs(e,n,r)}}}),"thumb-input":e({role:`slider`,focus:`native`,keys:[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`shift+ArrowUp`,`shift+ArrowDown`,`shift+ArrowLeft`,`shift+ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`],props:{index:{kind:`number`,from:`thumb`}},selects:Ye({value:[],thumbValues:({props:e})=>{let t=e.index??0;return[String(t-1),String(t),String(t+1)]},active:[],last:[]}),attrs:(e,{id:t,props:n})=>{let r=n.index??0,i=Bs(e,r),{lower:a,upper:o}=fs(e.thumbValues[r-1],e.thumbValues[r+1],Os(e));return{type:`range`,id:Gs(e,t,r),min:String(a),max:String(o),step:String(e.step),value:String(i),"aria-valuenow":void 0,"aria-valuetext":Ms(i,e),"aria-orientation":e.orientation,disabled:rt(e)?``:void 0,"aria-readonly":e.readOnly?`true`:void 0,"data-disabled":rt(e)?``:void 0,"data-readonly":e.readOnly?``:void 0,style:Ws}},on:{keydown:(e,{api:t,el:n,props:r})=>n&&t.internal.keydown(e,r.index??0,n),keyup:(e,{api:t})=>t.internal.commitKeys(e),focusout:(e,{api:t})=>t.internal.commitKeys(),input:(e,{api:t,el:n,props:r})=>{let i=n;t.internal.adjust(r.index??0,i.valueAsNumber,e),t.internal.syncInput(i,r.index??0)}},bind:(e,t)=>{let{api:n,props:r}=t,i=e,a=r.index??0,o=()=>n.internal.syncInput(i,a);o();let s=[ce(t,o)];return()=>s.forEach(e=>e())}}),value:e({role:`status`,state:e=>({...Rs(e),text:ws(e.value).map(t=>Ms(t,e)).join(` – `)}),attrs:(e,{id:t})=>({for:ws(e.value).map((n,r)=>Gs(e,t,r)).join(` `),"aria-live":`off`,...Vs(e)})}),input:e({attrs:e=>({type:`hidden`,name:e.name,value:Ps(e),form:e.form,disabled:e.disabled?``:void 0}),bind:(e,{api:t,store:n})=>be(e,{value:()=>Ps(n.get()),subscribe:n.subscribe,focus:()=>t.focus(),reset:t.internal.reset,disabled:t.internal.setFormDisabled})})}),agent:{actions:[`setValue`]}}),qs=l(Ks,{control:`div`,track:`div`,indicator:`div`,value:`output`}),Js=Y.createContext(null);function Ys(e){let t=Y.useContext(Js);if(!t)throw Error(`${e} must be used inside <Slider>.`);return t}function Xs(e,t){return n=>(0,X.jsxs)(X.Fragment,{children:[typeof e==`function`?e(n):e,t]})}function Zs({value:e,defaultValue:t,onValueChange:n,onValueCommit:i,min:a,max:o,step:s,largeStep:c,minStepsBetweenThumbs:l,orientation:u,disabled:d,readOnly:f,required:p,name:m,form:h,format:_,locale:y,controller:b,debug:x,render:S,children:C,...w}){let T=Ze(),E=z(),D=g(Ks,{value:e,defaultValue:t,onValueChange:n,onValueCommit:i,min:a,max:o,step:s,largeStep:c,minStepsBetweenThumbs:l,orientation:u,disabled:d||T?.disabled,readOnly:f,required:p,name:m??T?.name,form:h,format:_,locale:y,controller:b,debug:x,thumbInputId:E}),O=e??t,k=Array.isArray(O)&&O.length>1,A=Y.useMemo(()=>v(D,{field:k?null:T}),[D,k,T]),j={...w,children:Xs(C,(0,X.jsx)(Qs,{})),render:r(k?T:null,`div`,S)};return(0,X.jsx)(Js.Provider,{value:A,children:G(D,`root`,{},j)})}function Qs(){return G(Ks,`input`,{},{},`input`)}var $s=qs.Control,ec=qs.Track,tc=qs.Indicator;function nc({index:e=0,children:t,"aria-label":n,"aria-labelledby":r,"aria-describedby":i,...a}){let o={index:e,id:String(e)},s=(0,X.jsx)(rc,{...o,"aria-label":n,"aria-labelledby":r,"aria-describedby":i});return G(Ks,`thumb`,o,{...a,children:Xs(t,s)})}function rc({index:e,id:t,...n}){let{field:r}=Ys(`SliderThumb`),i=e=>{let{value:t,...n}=r?r.props(e):e;return(0,X.jsx)(`input`,{...n,defaultValue:t})};return G(Ks,`thumb-input`,{index:e,id:t},{...n,render:i},`input`)}function ic({className:e,thumbLabel:t,...n}){return(0,X.jsx)(Zs,{"data-slot":`slider`,className:j(`w-full touch-none select-none`,e),...n,children:(0,X.jsx)($s,{className:`flex h-5 w-full items-center`,children:(0,X.jsxs)(ec,{className:`relative h-1 w-full rounded-full bg-muted`,children:[(0,X.jsx)(tc,{className:`h-full rounded-full bg-border-strong`}),(0,X.jsx)(nc,{"aria-label":t,className:`size-3.5 rounded-full border border-border-strong bg-background shadow-sm has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring`})]})})})}function ac(e){let t=(0,Z.c)(16),{label:n,icon:r,disabled:i,onClick:a,shortcut:o}=e,s=i||void 0,c=i?void 0:a,l;t[0]!==n||t[1]!==o||t[2]!==s||t[3]!==c?(l=(0,X.jsx)(H,{size:`icon-sm`,variant:`ghost`,"aria-label":n,"aria-keyshortcuts":o,"aria-disabled":s,className:`aria-disabled:cursor-default aria-disabled:hover:bg-transparent`,onClick:c}),t[0]=n,t[1]=o,t[2]=s,t[3]=c,t[4]=l):l=t[4];let u;t[5]!==r||t[6]!==l?(u=(0,X.jsx)(x,{render:l,children:r}),t[5]=r,t[6]=l,t[7]=u):u=t[7];let d;t[8]===o?d=t[9]:(d=o&&(0,X.jsx)(sn,{children:o}),t[8]=o,t[9]=d);let f;t[10]!==n||t[11]!==d?(f=(0,X.jsxs)(He,{children:[n,d]}),t[10]=n,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==u||t[14]!==f?(p=(0,X.jsxs)(C,{children:[u,f]}),t[13]=u,t[14]=f,t[15]=p):p=t[15],p}function oc(e){let t=(0,Z.c)(6),{label:n,heading:r,children:i}=e,a;t[0]===r?a=t[1]:(a=(0,X.jsx)(`div`,{className:`flex min-h-8 items-center gap-2 border-b bg-muted/50 px-3 py-1 text-caption text-muted-foreground`,children:r}),t[0]=r,t[1]=a);let o;return t[2]!==i||t[3]!==n||t[4]!==a?(o=(0,X.jsxs)(`section`,{"aria-label":n,className:`min-w-0 overflow-hidden rounded-md border`,children:[a,i]}),t[2]=i,t[3]=n,t[4]=a,t[5]=o):o=t[5],o}function sc(e){let t=(0,Z.c)(17),{scope:n,context:r,run:i,item:a,className:o,style:s,opened:c,framed:l}=e,u=c!==void 0&&c,d=l===void 0||l,f;t[0]!==r||t[1]!==a.assetId||t[2]!==i.id||t[3]!==n?(f={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]=f):f=t[4];let{url:p,retry:m}=No(f);if(ze(p)){let e;return t[5]!==o||t[6]!==s||t[7]!==p.value?(e=(0,X.jsx)(`img`,{src:p.value,alt:``,loading:`lazy`,decoding:`async`,className:o,style:s}),t[5]=o,t[6]=s,t[7]=p.value,t[8]=e):e=t[8],e}let h;t[9]===p?h=t[10]:(h=me(p)&&!p.waiting,t[9]=p,t[10]=h);let g=h;if(!u){let e;return t[11]!==g||t[12]!==d?(e=d?(0,X.jsx)(`span`,{role:g?`alert`:void 0,className:`grid aspect-video w-full place-items-center rounded-sm border bg-muted px-3 text-center text-caption text-muted-foreground`,children:g?`This screenshot could not be loaded.`:(0,X.jsx)(y,{label:`Reading the screenshot`})}):null,t[11]=g,t[12]=d,t[13]=e):e=t[13],e}if(g){let e;return t[14]===m?e=t[15]:(e=(0,X.jsx)(L,{role:`alert`,message:`This screenshot could not be loaded.`,action:(0,X.jsx)(H,{variant:`outline`,size:`sm`,onClick:m,children:`Try again`})}),t[14]=m,t[15]=e),e}let _;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(`div`,{className:`grid min-h-48 place-items-center`,children:(0,X.jsx)(y,{label:`Reading the screenshot`})}),t[16]=_):_=t[16],_}function cc(e){let t=(0,Z.c)(11),{scope:n,context:r,run:i,items:a}=e,o;if(t[0]!==r||t[1]!==a||t[2]!==i||t[3]!==n){let e;t[5]!==r||t[6]!==i||t[7]!==n?(e=(e,t)=>(0,X.jsx)(sc,{scope:n,context:r,run:i,item:e,framed:!1,className:`h-12 w-auto max-w-20 rounded-sm border object-cover object-top`},t),t[5]=r,t[6]=i,t[7]=n,t[8]=e):e=t[8],o=a.map(e),t[0]=r,t[1]=a,t[2]=i,t[3]=n,t[4]=o}else o=t[4];let s;return t[9]===o?s=t[10]:(s=(0,X.jsx)(`span`,{"aria-hidden":!0,className:`flex shrink-0 gap-1.5`,children:o}),t[9]=o,t[10]=s),s}function lc(e){let t=(0,Z.c)(7),{item:n}=e,r;t[0]===n.label?r=t[1]:(r=(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:n.label}),t[0]=n.label,t[1]=r);let i;t[2]===n.shows?i=t[3]:(i=(0,X.jsx)($,{text:n.shows}),t[2]=n.shows,t[3]=i);let a;return t[4]!==r||t[5]!==i?(a=(0,X.jsxs)(`span`,{className:`text-caption text-muted-foreground`,children:[r,` `,i]}),t[4]=r,t[5]=i,t[6]=a):a=t[6],a}function uc(e){let t=(0,Z.c)(9),{source:n,items:r,onEnlarge:i}=e,a;if(t[0]!==r||t[1]!==i||t[2]!==n){let e;t[4]!==i||t[5]!==n?(e=(e,t)=>(0,X.jsxs)(`button`,{type:`button`,"aria-label":e.enlarge,onClick:()=>i(t),className:`group flex min-w-0 flex-col gap-1.5 text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,X.jsx)(sc,{...n,item:e,className:`max-h-80 w-auto max-w-full self-start rounded-sm border group-hover:opacity-90`}),(0,X.jsx)(lc,{item:e})]},t),t[4]=i,t[5]=n,t[6]=e):e=t[6],a=r.map(e),t[0]=r,t[1]=i,t[2]=n,t[3]=a}else a=t[3];let o;return t[7]===a?o=t[8]:(o=(0,X.jsx)(`div`,{className:`grid grid-cols-2 gap-3 p-3`,children:a}),t[7]=a,t[8]=o),o}function dc(e){let t=(0,Z.c)(33),{source:n,before:r,after:i}=e,[a,o]=(0,Y.useState)(50),s;t[0]!==r||t[1]!==n?(s=(0,X.jsx)(sc,{...n,item:r,className:`block w-full`}),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=`inset(0 0 0 ${a}%)`,l;t[3]===c?l=t[4]:(l={clipPath:c},t[3]=c,t[4]=l);let u;t[5]!==i||t[6]!==n||t[7]!==l?(u=(0,X.jsx)(sc,{...n,item:i,framed:!1,className:`absolute inset-0 size-full object-contain object-left-top`,style:l}),t[5]=i,t[6]=n,t[7]=l,t[8]=u):u=t[8];let d=`${a}%`,f;t[9]===d?f=t[10]:(f=(0,X.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-y-0 w-px bg-foreground/60`,style:{left:d}}),t[9]=d,t[10]=f);let p;t[11]!==s||t[12]!==u||t[13]!==f?(p=(0,X.jsxs)(`div`,{className:`relative mx-auto w-full max-w-56 overflow-hidden rounded-sm border bg-muted`,children:[s,u,f]}),t[11]=s,t[12]=u,t[13]=f,t[14]=p):p=t[14];let m;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(`span`,{children:`Before`}),t[15]=m):m=t[15];let h;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>o(typeof e==`number`?e:50),t[16]=h):h=t[16];let g;t[17]===a?g=t[18]:(g=(0,X.jsx)(ic,{value:a,onValueChange:h,thumbLabel:`Divide before and after`}),t[17]=a,t[18]=g);let _;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(`span`,{children:`After`}),t[19]=_):_=t[19];let v;t[20]===g?v=t[21]:(v=(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-sm items-center gap-3 text-caption text-muted-foreground`,children:[m,g,_]}),t[20]=g,t[21]=v);let y;t[22]===r?y=t[23]:(y=(0,X.jsx)(lc,{item:r}),t[22]=r,t[23]=y);let b;t[24]===i?b=t[25]:(b=(0,X.jsx)(lc,{item:i}),t[24]=i,t[25]=b);let x;t[26]!==y||t[27]!==b?(x=(0,X.jsxs)(`div`,{className:`mx-auto grid w-full max-w-sm grid-cols-2 gap-3`,children:[y,b]}),t[26]=y,t[27]=b,t[28]=x):x=t[28];let S;return t[29]!==v||t[30]!==x||t[31]!==p?(S=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 p-3`,children:[p,v,x]}),t[29]=v,t[30]=x,t[31]=p,t[32]=S):S=t[32],S}function fc(e){let t=(0,Z.c)(41),{scope:n,context:r,run:i,items:a}=e,[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(`side`),u=o===null?void 0:a[o],d;t[0]!==r||t[1]!==i||t[2]!==n?(d={scope:n,context:r,run:i},t[0]=r,t[1]=i,t[2]=n,t[3]=d):d=t[3];let f=d,[p,m]=a,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(`span`,{className:`flex-1`,children:`Before and after`}),t[4]=h):h=t[4];let g;t[5]!==m||t[6]!==p||t[7]!==c?(g=p&&m&&(0,X.jsx)(hi,{value:c,onValueChange:e=>l(e===`overlay`?`overlay`:`side`),children:(0,X.jsxs)(Mi,{"aria-label":`Compare`,className:`h-6!`,children:[(0,X.jsx)(Oi,{value:`side`,children:`Side by side`}),(0,X.jsx)(Oi,{value:`overlay`,children:`Slider`})]})}),t[5]=m,t[6]=p,t[7]=c,t[8]=g):g=t[8];let _;t[9]===g?_=t[10]:(_=(0,X.jsxs)(X.Fragment,{children:[h,g]}),t[9]=g,t[10]=_);let v;t[11]!==m||t[12]!==p||t[13]!==a||t[14]!==c||t[15]!==f?(v=c===`overlay`&&p&&m?(0,X.jsx)(dc,{source:f,before:p,after:m}):(0,X.jsx)(uc,{source:f,items:a,onEnlarge:s}),t[11]=m,t[12]=p,t[13]=a,t[14]=c,t[15]=f,t[16]=v):v=t[16];let y;t[17]!==_||t[18]!==v?(y=(0,X.jsx)(oc,{label:`Before and after`,heading:_,children:v}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let b=u!==void 0,x;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||s(null)},t[20]=x):x=t[20];let S;t[21]===u?S=t[22]:(S=u&&(0,X.jsxs)(X.Fragment,{children:[u.label,` · `,(0,X.jsx)($,{text:u.shows})]}),t[21]=u,t[22]=S);let C;t[23]===S?C=t[24]:(C=(0,X.jsx)(qr,{children:S}),t[23]=S,t[24]=C);let w;t[25]!==u||t[26]!==f?(w=u&&(0,X.jsx)(sc,{...f,item:u,className:`mx-auto max-h-[72vh] rounded-lg border`,opened:!0}),t[25]=u,t[26]=f,t[27]=w):w=t[27];let T;t[28]!==a.length||t[29]!==o?(T=a.length>1&&o!==null&&(0,X.jsxs)(`div`,{className:`flex items-center justify-center gap-3 text-caption text-muted-foreground`,children:[(0,X.jsx)(ac,{label:`Previous screenshot`,icon:(0,X.jsx)(la,{}),disabled:o===0,onClick:()=>s(o-1)}),o+1,` of `,a.length,(0,X.jsx)(ac,{label:`Next screenshot`,icon:(0,X.jsx)(ue,{}),disabled:o===a.length-1,onClick:()=>s(o+1)})]}),t[28]=a.length,t[29]=o,t[30]=T):T=t[30];let E;t[31]!==C||t[32]!==w||t[33]!==T?(E=(0,X.jsxs)(ir,{className:`max-h-[92vh] overflow-auto sm:max-w-[min(92vw,52rem)]`,children:[C,w,T]}),t[31]=C,t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==E||t[36]!==b?(D=(0,X.jsx)(yr,{open:b,onOpenChange:x,children:E}),t[35]=E,t[36]=b,t[37]=D):D=t[37];let O;return t[38]!==D||t[39]!==y?(O=(0,X.jsxs)(X.Fragment,{children:[y,D]}),t[38]=D,t[39]=y,t[40]=O):O=t[40],O}var pc=52;function mc(e,t=`smooth`){let n=document.getElementById(e),r=n?.closest(`[data-review-scroll]`);if(!n||!r)return;let i=e.startsWith(`walkthrough-`)?pc:16;r.scrollTo({top:r.scrollTop+n.getBoundingClientRect().top-r.getBoundingClientRect().top-i,behavior:t})}var hc=e=>`walkthrough-step-${e}`,gc=(e,t)=>`walkthrough-call-${e}-${t}`;function _c(e){let t=(0,Z.c)(10),{label:n,detail:r,children:i}=e,a;t[0]===r?a=t[1]:(a=r&&(0,X.jsx)(`span`,{className:`tabular-nums`,children:r}),t[0]=r,t[1]=a);let o;t[2]!==n||t[3]!==a?(o=(0,X.jsxs)(`dt`,{className:`flex flex-col pt-1 text-caption text-muted-foreground`,children:[n,a]}),t[2]=n,t[3]=a,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=(0,X.jsx)(`dd`,{className:`flex min-w-0 flex-col`,children:i}),t[5]=i,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,X.jsxs)(`div`,{className:`grid gap-x-4 gap-y-1 border-t py-2.5 first:border-t-0 @xl:grid-cols-[7rem_minmax(0,1fr)]`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function vc(e){let t=(0,Z.c)(11),{onClick:n,target:r,centered:i,children:a}=e,o=i!==void 0&&i?`items-center`:`items-baseline`,s;t[0]===o?s=t[1]:(s=j(`-mx-2 flex min-h-7 gap-2 rounded-md px-2 py-1 text-left text-ui hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,o),t[0]=o,t[1]=s);let c;t[2]===a?c=t[3]:(c=(0,X.jsx)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:a}),t[2]=a,t[3]=c);let l;t[4]===r?l=t[5]:(l=(0,X.jsx)(`span`,{className:`shrink-0 text-caption text-muted-foreground`,children:r}),t[4]=r,t[5]=l);let u;return t[6]!==n||t[7]!==s||t[8]!==c||t[9]!==l?(u=(0,X.jsxs)(`button`,{type:`button`,onClick:n,className:s,children:[c,l]}),t[6]=n,t[7]=s,t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function yc(e){let t=(0,Z.c)(8),{content:n,decisions:r,onJump:i}=e,a,o;if(t[0]!==n||t[1]!==r||t[2]!==i){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=wt(n,r);if(e.length===0){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`p`,{className:`py-1 text-ui text-muted-foreground`,children:`Nothing needs your decision.`}),t[5]=e):e=t[5],o=e;break bb0}let s;t[6]===i?s=t[7]:(s=e=>{let{attention:t,stop:n,step:r,callIndex:a,decided:o,state:s}=e;return(0,X.jsx)(vc,{target:`Step ${r}`,onClick:()=>i(gc(r,a)),children:(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5 @md:flex-row @md:items-baseline @md:gap-2`,children:[(0,X.jsxs)(`span`,{className:j(`flex shrink-0 items-baseline gap-1 text-caption @md:w-28`,s===`decided`?`text-muted-foreground`:`text-warn`),children:[s===`decided`&&(0,X.jsx)(R,{role:`img`,"aria-label":ft(s,``),className:`size-3 shrink-0 self-center text-add-fg`}),s===`needs-commit`&&(0,X.jsx)(En,{role:`img`,"aria-label":ft(s,``),className:`size-3 shrink-0 self-center`}),pn(t)]}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,X.jsxs)(`span`,{className:`font-medium text-pretty`,children:[(0,X.jsx)($,{text:t.question}),o?.option&&(0,X.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[` `,`· `,o.option]})]}),s===`needs-commit`&&(0,X.jsx)(`span`,{className:`text-caption text-warn`,children:`Needs a new commit: this change does not do this yet.`}),(0,X.jsx)(`span`,{className:`text-pretty text-foreground-2`,children:(0,X.jsx)($,{text:n.explanation})})]})]})},`${r}:${a}`)},t[6]=i,t[7]=s),a=e.map(s)}t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o}else a=t[3],o=t[4];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function bc(e){let t=(0,Z.c)(9),{name:n,pull:r}=e;if(!r){let e;return t[0]===n?e=t[1]:(e=(0,X.jsx)(`span`,{children:n}),t[0]=n,t[1]=e),e}let i=`Open on #${r.number}`,a;t[2]!==n||t[3]!==r?(a=()=>r.openCheck(n),t[2]=n,t[3]=r,t[4]=a):a=t[4];let o;return t[5]!==n||t[6]!==i||t[7]!==a?(o=(0,X.jsx)(`button`,{type:`button`,title:i,onClick:a,className:`rounded-sm underline decoration-border underline-offset-2 hover:decoration-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:n}),t[5]=n,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}function xc({names:e,pull:t}){return e.map((n,r)=>(0,X.jsxs)(`span`,{children:[(0,X.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,X.jsx)(bc,{name:n,pull:t}),r<e.length-1&&(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`,`})]}),r<e.length-1&&` `]},`${n}:${r}`))}function Sc(e){return e.stops.flatMap((e,t)=>e.blocks.flatMap(e=>e.kind===`checks`?[{block:e,step:t+1}]:[]))}function Cc(e){let t=(0,Z.c)(6),{step:n,onJump:r}=e,i;t[0]!==r||t[1]!==n?(i=()=>r(hc(n)),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;return t[3]!==n||t[4]!==i?(a=(0,X.jsxs)(`button`,{type:`button`,onClick:i,className:`shrink-0 rounded-sm text-caption leading-5 text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[`Step `,n]}),t[3]=n,t[4]=i,t[5]=a):a=t[5],a}function wc(e){let t=(0,Z.c)(41),{block:n,step:r,pull:i,onJump:a}=e,o,s,c;t[0]===n.checks?(o=t[1],s=t[2],c=t[3]):(s=ci(n.checks),o=wa(s,si(n.checks.state).tone),c=Ta(o),t[0]=n.checks,t[1]=o,t[2]=s,t[3]=c);let l=c,u=i?.status,d;t[4]!==n.checks||t[5]!==u?(d=mi(n.checks,u),t[4]=n.checks,t[5]=u,t[6]=d):d=t[6];let f=d,p=i?.detail?.headSha,m;t[7]!==n.checks.headOid||t[8]!==p?(m=xa(p,n.checks.headOid),t[7]=n.checks.headOid,t[8]=p,t[9]=m):m=t[9];let h=m,g;t[10]!==o.names||t[11]!==i?(g=(0,X.jsx)(xc,{names:o.names,pull:i}),t[10]=o.names,t[11]=i,t[12]=g):g=t[12];let _;t[13]===l?_=t[14]:(_=l&&(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:l}),t[13]=l,t[14]=_);let v;t[15]!==g||t[16]!==_?(v=(0,X.jsxs)(X.Fragment,{children:[g,_]}),t[15]=g,t[16]=_,t[17]=v):v=t[17];let y=v,b;t[18]===f.tone?b=t[19]:(b=(0,X.jsx)(`span`,{className:`flex h-5 shrink-0 items-center`,children:(0,X.jsx)(zn,{tone:f.tone})}),t[18]=f.tone,t[19]=b);let x;t[20]!==o.names.length||t[21]!==f.label||t[22]!==f.names||t[23]!==f.note||t[24]!==y||t[25]!==i||t[26]!==s?(x=f.note?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{children:[f.label,f.names.length>0&&(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`: `}),(0,X.jsx)(xc,{names:f.names,pull:i})]}),(0,X.jsxs)(`span`,{className:`text-caption text-muted-foreground`,children:[(0,X.jsx)(ls,{label:f.note}),o.names.length>0&&`: `,y]})]}):(0,X.jsxs)(`span`,{children:[(0,X.jsx)(ls,{label:s.label}),o.names.length>0&&(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`: `}),y]}),t[20]=o.names.length,t[21]=f.label,t[22]=f.names,t[23]=f.note,t[24]=y,t[25]=i,t[26]=s,t[27]=x):x=t[27];let S;t[28]!==h||t[29]!==i?(S=h&&i&&(0,X.jsxs)(`span`,{className:`text-caption text-warn`,children:[`#`,i.number,` is now at `,(0,X.jsx)(`span`,{className:`font-mono`,children:h})]}),t[28]=h,t[29]=i,t[30]=S):S=t[30];let C;t[31]!==x||t[32]!==S?(C=(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 text-pretty`,children:[x,S]}),t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==a||t[35]!==r?(w=(0,X.jsx)(Cc,{step:r,onJump:a}),t[34]=a,t[35]=r,t[36]=w):w=t[36];let T;return t[37]!==C||t[38]!==w||t[39]!==b?(T=(0,X.jsxs)(`div`,{className:`flex min-h-7 items-start gap-2 py-1 text-ui`,children:[b,C,w]}),t[37]=C,t[38]=w,t[39]=b,t[40]=T):T=t[40],T}function Tc(e){let t=(0,Z.c)(35),{run:n,content:r,owner:i,pull:a,checks:o,onJump:s}=e,c,l,u,d;if(t[0]!==o||t[1]!==r.stops||t[2]!==s||t[3]!==i||t[4]!==a||t[5]!==n){l=r.stops.flatMap(Ec);let e;if(t[10]===n?e=t[11]:(e=ri(n),t[10]=n,t[11]=e),c=e,t[12]!==o||t[13]!==s||t[14]!==a){let e;t[16]!==s||t[17]!==a?(e=e=>{let{block:t,step:n}=e;return(0,X.jsx)(wc,{block:t,step:n,pull:a,onJump:s},`checks:${n}`)},t[16]=s,t[17]=a,t[18]=e):e=t[18],u=o.map(e),t[12]=o,t[13]=s,t[14]=a,t[15]=u}else u=t[15];let f;t[19]!==s||t[20]!==i||t[21]!==n?(f=(e,t)=>{let{step:r,block:a}=e;return(0,X.jsx)(vc,{target:`Step ${r}`,centered:!0,onClick:()=>s(hc(r)),children:(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,X.jsx)(cc,{scope:i.scope,context:i.context,run:n,items:a.screenshots}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,X.jsx)(`span`,{className:`text-pretty`,children:(0,X.jsx)($,{text:Wt(a.screenshots)})}),(0,X.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:`Shown in the before and after screenshots`})]})]})},`images:${r}:${t}`)},t[19]=s,t[20]=i,t[21]=n,t[22]=f):f=t[22],d=l.map(f),t[0]=o,t[1]=r.stops,t[2]=s,t[3]=i,t[4]=a,t[5]=n,t[6]=c,t[7]=l,t[8]=u,t[9]=d}else c=t[6],l=t[7],u=t[8],d=t[9];let f;t[23]===c?f=t[24]:(f=c&&(0,X.jsx)(`p`,{className:`py-1 text-ui text-muted-foreground`,children:c}),t[23]=c,t[24]=f);let p;t[25]!==o.length||t[26]!==c||t[27]!==l||t[28]!==n?(p=!c&&o.length===0&&l.length===0&&(0,X.jsxs)(`p`,{className:`py-1 text-ui text-muted-foreground`,children:[`No checks or screenshots were captured for`,` `,(0,X.jsx)(`span`,{className:`font-mono`,children:n.headOid.slice(0,7)}),`.`]}),t[25]=o.length,t[26]=c,t[27]=l,t[28]=n,t[29]=p):p=t[29];let m;return t[30]!==u||t[31]!==d||t[32]!==f||t[33]!==p?(m=(0,X.jsxs)(X.Fragment,{children:[u,d,f,p]}),t[30]=u,t[31]=d,t[32]=f,t[33]=p,t[34]=m):m=t[34],m}function Ec(e,t){return e.blocks.flatMap(e=>e.kind===`images`?[{step:t+1,block:e}]:[])}var Dc=e=>e.stops.some(e=>e.blocks.some(e=>e.kind===`images`));function Oc(e){let t=(0,Z.c)(3),{label:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,X.jsx)(`dl`,{"aria-label":n,className:`flex flex-col rounded-lg border px-4 py-1`,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function kc(e){let t=(0,Z.c)(49),{run:n,content:r,owner:i,pull:a,onJump:o,notSaid:s,comments:c,scope:l}=e,{view:u}=Ko(i),d=u?.decisions,f;t[0]!==r||t[1]!==d?(f=At(r,d),t[0]=r,t[1]=d,t[2]=f):f=t[2];let p=f,m,h,g,_,v,y,b;if(t[3]!==r||t[4]!==o||t[5]!==p.decided||t[6]!==p.total||t[7]!==a||t[8]!==l||t[9]!==u?.decisions){let e=Sc(r);({changed:h,unchanged:b}=Ri(e.map(Ac),a?.status)),g=l?yn({...l,pullRequest:a?.number,checkedCommit:e[0]?.block.checks.headOid}):void 0,m=Oc,_=`Before you merge`;let n=p.total===1?`Your call`:`Your calls`,i=p.total===0?void 0:`${p.decided} of ${p.total} decided`,s=u?.decisions,c;t[17]!==r||t[18]!==o||t[19]!==s?(c=(0,X.jsx)(yc,{content:r,decisions:s,onJump:o}),t[17]=r,t[18]=o,t[19]=s,t[20]=c):c=t[20],t[21]!==n||t[22]!==i||t[23]!==c?(v=(0,X.jsx)(_c,{label:n,detail:i,children:c}),t[21]=n,t[22]=i,t[23]=c,t[24]=v):v=t[24],y=h.length>0&&(0,X.jsx)(_c,{label:`Checks`,children:h.map(e=>{let{block:t,step:n}=e;return(0,X.jsx)(wc,{block:t,step:n,pull:a,onJump:o},`checks:${n}`)})}),t[3]=r,t[4]=o,t[5]=p.decided,t[6]=p.total,t[7]=a,t[8]=l,t[9]=u?.decisions,t[10]=m,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=b}else m=t[10],h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],b=t[16];let x;t[25]!==h||t[26]!==r||t[27]!==o||t[28]!==i||t[29]!==a||t[30]!==n||t[31]!==b?(x=(b.length>0||h.length===0||Dc(r))&&(0,X.jsx)(_c,{label:`Verified`,children:(0,X.jsx)(Tc,{run:n,content:r,owner:i,pull:a,checks:b,onJump:o})}),t[25]=h,t[26]=r,t[27]=o,t[28]=i,t[29]=a,t[30]=n,t[31]=b,t[32]=x):x=t[32];let S;t[33]!==g||t[34]!==o?(S=(g?.uncommitted||g?.uncovered)&&(0,X.jsxs)(_c,{label:`Scope`,children:[g.uncommitted&&(0,X.jsx)(`p`,{className:`py-1 text-ui text-pretty`,children:g.uncommitted}),g.uncovered&&(0,X.jsx)(vc,{target:`Below the steps`,onClick:()=>o(`review-not-covered`),children:(0,X.jsx)(`span`,{className:`min-w-0 text-pretty`,children:g.uncovered})})]}),t[33]=g,t[34]=o,t[35]=S):S=t[35];let C;t[36]===s?C=t[37]:(C=s&&(0,X.jsx)(_c,{label:`Not verified`,children:s}),t[36]=s,t[37]=C);let w;t[38]===c?w=t[39]:(w=c&&(0,X.jsx)(_c,{label:`Comments`,children:c}),t[38]=c,t[39]=w);let T;return t[40]!==m||t[41]!==_||t[42]!==v||t[43]!==y||t[44]!==x||t[45]!==S||t[46]!==C||t[47]!==w?(T=(0,X.jsxs)(m,{label:_,children:[v,y,x,S,C,w]}),t[40]=m,t[41]=_,t[42]=v,t[43]=y,t[44]=x,t[45]=S,t[46]=C,t[47]=w,t[48]=T):T=t[48],T}function Ac(e){return{...e,checks:e.block.checks}}function jc(e,t){let n=Cn(e,[t.span],3,t.side);if(n)try{return St(n,{throwOnError:!0})}catch{return}}function Mc(e){let t=0,n=0,r=!1;for(let i of e.split(`
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Ac as t,B as n,C as r,Dc as i,Do as a,Eo as o,Fa as s,Fd as c,Fo as l,G as u,Gl as d,Gs as f,Gt as p,H as m,Hl as h,Ho as g,I as _,Io as v,It as y,Jc as b,Jt as x,K as S,Kt as C,L as w,Ll as T,Ls as E,Lt as D,Nc as O,Oa as k,Oc as A,Oo as j,P as M,Pl as N,Qc as P,R as F,Rs as I,Rt as L,So as R,T as z,Tc as B,Ti as V,To as H,Tr as U,Uo as W,Ut as ee,V as te,Vo as G,W as ne,Wc as re,Ws as ie,Wt as K,Xc as ae,Zc as oe,_a as se,_c as ce,_s as le,_u as q,bc as J,bo as ue,da as de,dn as fe,dt as pe,du as me,ea as he,el as ge,fn as _e,fu as ve,gn as ye,gs as be,ha as xe,hc as Se,hs as Ce,hu as we,ia as Te,ja as Ee,jc as De,js as Oe,l as ke,li as Ae,ma as je,mn as Me,na as Ne,nn as Pe,oa as Fe,p as Ie,pa as Le,pn as Re,pu as ze,q as Be,ql as Ve,qt as He,ra as Ue,rl as We,sa as Ge,ta as Ke,ua as qe,uo as Je,vc as Ye,vs as Xe,w as Ze,wc as Qe,wo as $e,xo as et,xs as tt,yc as nt,ys as rt,z as it,zt as at}from"./access-B1ddZlps.js";import{i as ot,n as st,t as ct}from"./useNavigate-BZWuXWB6.js";import{$ as lt,$n as ut,$t as dt,A as ft,An as pt,At as mt,B as ht,Bn as gt,Bt as _t,C as vt,Cn as yt,Ct as bt,D as xt,Dn as St,Dt as Ct,E as wt,En as Tt,Et,F as Dt,Fn as Ot,Ft as kt,G as At,Gn as jt,Gt as Mt,H as Nt,Hn as Pt,Ht as Ft,I as It,In as Lt,J as Rt,Jn as zt,Jt as Bt,K as Vt,Kn as Ht,Kt as Ut,L as Wt,Ln as Gt,Lt as Kt,M as qt,Mn as Jt,Mt as Yt,N as Xt,Nn as Zt,O as Qt,On as $t,Ot as en,P as tn,Pn as nn,Pt as rn,Q as an,Qn as on,Qt as sn,R as cn,Rn as ln,S as un,Sn as dn,St as fn,T as pn,Tn as mn,Tt as hn,U as gn,Un as _n,Ut as vn,V as yn,Vn as bn,Vt as xn,W as Sn,Wn as Cn,Wt as wn,X as Tn,Xn as En,Xt as Dn,Y as On,Yn as kn,Yt as An,Z as jn,Zn as Mn,Zt as Nn,_ as Pn,_n as Fn,_t as In,a as Ln,an as Rn,at as zn,b as Bn,bn as Vn,bt as Hn,c as Un,cn as Wn,ct as Gn,d as Kn,dn as qn,dt as Jn,en as Yn,et as Xn,f as Zn,fn as Qn,ft as $n,g as er,gn as tr,gt as nr,h as rr,hn as ir,ht as ar,i as or,in as sr,it as cr,j as lr,jn as ur,jt as dr,k as fr,kn as pr,kt as mr,l as hr,ln as gr,lt as _r,m as vr,mn as yr,mt as br,n as xr,nn as Sr,nr as Cr,nt as wr,o as Tr,on as Er,ot as Dr,p as Or,pn as kr,pt as Ar,q as jr,qn as Mr,qt as Nr,r as Pr,rn as Fr,rr as Ir,rt as Lr,s as Rr,sn as zr,st as Br,tn as Vr,tr as Hr,tt as Ur,un as Wr,ut as Gr,v as Kr,vn as qr,vt as Jr,wn as Yr,wt as Xr,x as Zr,xn as Qr,xt as $r,y as ei,yn as ti,yt as ni,z as ri,zn as ii,zt as ai}from"./settings-page-DxR05fZi.js";import{L as oi,N as si,R as ci,X as li,Z as ui,_i as di,_r as fi,an as pi,b as mi,d as hi,et as gi,fi as _i,ft as vi,g as yi,gi as bi,gr as xi,gt as Si,hi as Ci,hn as wi,ht as Ti,l as Ei,lt as Di,m as Oi,mi as ki,mt as Ai,nr as ji,p as Mi,pi as Ni,tt as Pi,v as Fi,x as Ii,y as Li,z as Ri}from"./edit-file-D4o1bywx.js";import{d as zi,f as Bi,r as Vi}from"./sides-711aNttp.js";import{t as Hi}from"./workspace-error-Dc7KW7tw.js";function Ui(e){let t=ge({warn:e?.router===void 0}),n=e?.router||t;return P(n.stores.__store,ot(e,n))}var Y=e(N(),1),X=We(),Z=b();function Wi(e,t,n){return Math.min(Math.max(e,t),n)}function Gi(e){if(!Number.isFinite(e)||Number.isInteger(e))return 0;let[t,n]=String(e).toLowerCase().split(`e`),r=(t.split(`.`)[1]??``).length;return Math.max(0,r-Number(n??0))}function Ki(e,t){return Number(e.toFixed(Math.min(t,100)))}function qi(e,t){return Number((e/t).toPrecision(15))}function Ji(e){return Number.isFinite(e.min)?e.min:0}function Yi(e){return Math.max(Gi(e.step),Gi(Ji(e)))}function Xi(e){if(!Number.isFinite(e.max)||!(e.step>0))return e.max;let t=Ji(e);return Ki(t+Math.floor(qi(e.max-t,e.step))*e.step,Yi(e))}function Zi(e,t,n=Math.round){if(!(t.step>0))return e;let r=Ji(t);return Ki(r+n(qi(e-r,t.step))*t.step,Yi(t))}function Qi(e,t){return t.step>0?Ki(Wi(Zi(e,t),t.min,Xi(t)),Yi(t)):Wi(e,t.min,t.max)}function $i(e,t,n){if(!(n.step>0))return Wi(e+t,n.min,n.max);let r=Ji(n),i=qi(e-r,n.step);return Ki(Wi(r+((Number.isInteger(i)?i:t>0?Math.floor(i):Math.ceil(i))+t)*n.step,n.min,Xi(n)),Yi(n))}function ea(e,t,n){return t.size===`large`?Qi(Wi(e+t.direction*(n.largeStep??n.step*10),n.min,n.max),n):t.size===`small`&&n.smallStep?$i(e,t.direction,{...n,step:n.smallStep}):$i(e,t.direction,n)}var ta=new Map;function na(e,t={}){let n=`${e??``}|${JSON.stringify(t)}`,r=ta.get(n);return r||(r=new Intl.NumberFormat(e,t),ta.set(n,r)),r}var ra=new WeakMap;function ia(e){let t=na(void 0,e),n=ra.get(t);return n===void 0&&(n=t.resolvedOptions().maximumFractionDigits??0,ra.set(t,n)),n}function aa(e,t){let n={...e};if(n.maximumFractionDigits===void 0&&n.maximumSignificantDigits===void 0){let r=Gi(t)+(n.style===`percent`?-2:0);n.maximumFractionDigits=Math.max(n.minimumFractionDigits??0,r,ia(e))}return n}function oa(e,t,n){if(e===null||!Number.isFinite(e))return``;if(typeof n==`function`)return n(e);let r=na(t,n),i=r.format(e);if(e<0&&!r.formatToParts(e).some(e=>e.type===`integer`)){let e=r.formatToParts(-3),t=e.findIndex(e=>e.type===`minusSign`);return`${e.slice(0,t+1).map(e=>e.value).join(``)}${i}`}return i}function sa(e){let t=e.split(`/`).map(e=>e.trim()===``?NaN:Number(e));return t.every(Number.isFinite)?t:null}var ca={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};ca.node;var la=$e(ca),ua=typeof window>`u`?Y.useEffect:Y.useLayoutEffect;function da({fileDiff:e,oldFile:t,newFile:n,options:r,editorOptions:i,editStateKey:a,lineAnnotations:o,selectedLines:s,prerenderedHTML:c,metrics:l,hasGutterRenderUtility:u,hasCustomHeader:d,disableWorkerPool:f,edit:p,onEditChange:m,onEditComplete:h}){let g=dn(),_=s!==void 0,v=(0,Y.useContext)($t),y=Jt(),[b,x]=(0,Y.useState)(),S=Zt(e=>m?.(e)),C=m==null?void 0:S,w=(0,Y.useRef)(null),T=Zt(r=>{let i=h?.(r)??`reject`;return i===`accept`&&(w.current={fileDiff:{installed:r.fileDiff,stale:r.originalFileDiff},filePair:e==null?{fileDiff:r.fileDiff,installed:{oldFile:r.oldFile,newFile:r.newFile},stale:{oldFile:t??null,newFile:n??null}}:null,annotations:{installed:r.lineAnnotations,stale:r.originalLineAnnotations}}),i}),E=h==null?void 0:T,D=fa({acceptedCache:w,fileDiff:e,newFile:n,oldFile:t,parseDiffOptions:r?.parseDiffOptions}),O=(0,Y.useRef)(null),k=Qr(),A=ma(w,D,o),j=Vn(O,A)??{fileDiff:D,lineAnnotations:o??fi},M=(0,Y.useRef)(null),N=(0,Y.useRef)(null),P=Zt(()=>{if(y==null)throw Error(`FileDiff: EditContext is not attached`);return y(`file-diff`,i??{},a)}),F=Zt(e=>{if(e!=null){if(O.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);g==null?O.current=new mn(_a({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:C,onEditComplete:E,options:r}),f?void 0:v,k):O.current=new Yr(_a({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:C,onEditComplete:E,options:r}),g,l,f?void 0:v,k),O.current.hydrate({fileDiff:D,fileContainer:e,lineAnnotations:o,prerenderedHTML:c})}else{if(O.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);N.current=null,O.current.cleanUp(),O.current=null,M.current=null}});ua(()=>{let{current:e}=O;if(e==null)return;let t=_a({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:C,onEditComplete:E,options:r}),n=!wi(e.options,t);if(e.setOptions(t),!p&&(N.current=null,M.current!=null)){let{current:e}=M;M.current=null,e()}let i=ga(D,o,w);if(e.render({forceRender:n,fileDiff:i.fileDiff,lineAnnotations:i.lineAnnotations}),s!==void 0&&e.setSelectedLines(s),!p||M.current!=null)return;if(y==null)throw Error(`FileDiff: EditContext is not attached`);let a=()=>{O.current===e&&M.current==null&&e.__canAttachEditor()&&(M.current=va(e,P),k())};if(e.__canAttachEditor()){N.current=null,a();return}let c=e.__prepareForEditing();if(c==null){N.current=null;return}if(N.current?.promise===c)return;let l={promise:c};N.current=l,c.then(()=>{N.current===l&&(a(),N.current=null)}).catch(e=>{N.current===l&&(N.current=null,x(e))})});let I=(0,Y.useCallback)(()=>O.current?.getHoveredLine(),[]),L=(0,Y.useCallback)(e=>O.current?.getAnnotationSlotName(e)??ji(e),[]);if(b!=null)throw b;return{...j,ref:F,getHoveredLine:I,getAnnotationSlotName:L}}function fa({acceptedCache:e,fileDiff:t,newFile:n,oldFile:r,parseDiffOptions:i}){return(0,Y.useMemo)(()=>{if(t!=null)return t;let{current:a}=e,o=a?.filePair;if(a!=null&&o!=null){if(pa(r,n,o.stale)||pa(r,n,o.installed))return o.fileDiff;a.filePair=null}return Tt(r??null,n??null,i)},[e,t,r,n,i])}function pa(e,t,n){return pi(e??void 0,n.oldFile??void 0)&&pi(t??void 0,n.newFile??void 0)}function ma(e,t,n){"use no memo";return ha(t,n,e.current)}function ha(e,t,n){return{fileDiff:n?.fileDiff!=null&&pr(e,n.fileDiff.stale)?n.fileDiff.installed:e,lineAnnotations:n?.annotations!=null&&t===n.annotations.stale?n.annotations.installed:t}}function ga(e,t,n){let{current:r}=n,i=ha(e,t,r);return r==null||(r.fileDiff!=null&&!pr(e,r.fileDiff.stale)&&(r.fileDiff=null),t!==r.annotations?.stale&&(r.annotations=null),r.fileDiff==null&&r.annotations==null&&r.filePair==null&&(n.current=null)),i}function _a({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return{...e,controlledSelection:t,renderCustomHeader:n?ur:e?.renderCustomHeader,renderGutterUtility:r?ur:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}}function va(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function ya({fileDiff:e,options:t,editorOptions:n,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,className:s,style:c,prerenderedHTML:l,renderAnnotation:u,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1,onEditChange:v,onEditComplete:y}){let{ref:b,getHoveredLine:x,getAnnotationSlotName:S,fileDiff:C,lineAnnotations:w}=da({fileDiff:e,options:t,editorOptions:n,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,prerenderedHTML:l,hasGutterRenderUtility:h!=null,hasCustomHeader:d!=null,disableWorkerPool:g,edit:_,onEditChange:v,onEditComplete:y}),T=pt({fileDiff:C,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderAnnotation:u,renderGutterUtility:h,lineAnnotations:w,getHoveredLine:x,getAnnotationSlotName:S});return(0,X.jsx)(xi,{ref:b,className:s,style:c,children:yt(T,l)})}var ba=7;function xa(e,t){return e!==void 0&&e!==t?e.slice(0,ba):void 0}var Sa=(e,t)=>t.length>0?`${e}: ${t.join(`, `)}`:e;function Ca(e,t){let n=mi(e,t?.status);return{checks:ci(e),live:Ii(e,t?.status),headline:n,lead:Sa(n.label,n.names),moved:xa(t?.detail?.headSha,e.headOid)}}function wa(e,t){let n=t===`failed`||t===`running`;return{names:e.results.filter(e=>!n||e.tone===t).map(e=>e.name),passing:n?e.results.filter(e=>e.tone===`passed`).length:0,more:e.more}}function Ta({passing:e,more:t}){return[e>0?` and ${e} passing`:``,t?`${e>0?`,`:``} and more`:``].join(``)}function Ea(e,t){let n=c(q(e));return n===void 0?me(e)?{status:`failed`}:{status:`reading`}:{status:`read`,value:t(n)}}function Da(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 Oa(e){return e.messages.filter(e=>e.author===`developer`)}function ka(e,t){return e.messages.find(e=>e.author===`agent`&&e.replyTo===t)}function Aa(e,t){return(e?.conversations??[]).filter(({anchor:e})=>e.kind===`walkthrough`||!t.includes(e.title))}function ja(e){return e instanceof Error&&e.message.length>0?e.message:`The request failed. Try again.`}function Ma(e){return Oa(e).map(t=>({message:t,reply:ka(e,t.id)}))}function Na(e,t){return e?Da(e,{kind:`stop`,title:t}):[]}function Pa([e,t],n,{runId:r,title:i}){let a=e.text.trim(),o=e.sending||n.waiting;return{text:e.text,failure:e.failure?.runId===r?e.failure.message:void 0,waiting:o,change:e=>t(t=>({...t,text:e,failure:void 0})),send:()=>{a&&!o&&(t(e=>({...e,failure:void 0,sending:!0})),n.run({anchor:{kind:`stop`,title:i},text:a}).then(()=>t(t=>({...t,text:t.text===e.text?``:t.text,sending:!1})),n=>t(t=>({...t,failure:t.text===e.text?{runId:r,message:ja(n)}:void 0,sending:!1}))))}}}function Fa(e){let t=e.walkthrough.status===`read`?e.walkthrough.value:void 0;return{name:jr(t??{walkthrough:void 0,freshness:`unknown`}),pending:e.walkthrough.status===`reading`,guided:t?.walkthrough!==void 0}}var Ia=[`queued`,`evidence`,`transcript`,`writing`,`validating`,`ready`],La={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 Ra(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 za(e,t,n=!1){let r=e.progress??[],i=r.at(-1),a=e.state.status===`failed`?`failed`:e.state.status===`ready`?`ready`:i?.stage??(e.state.status===`queued`?`queued`:`writing`),o=r.filter(e=>e.stage!==`failed`).at(-1)?.stage,s=a===`failed`?Math.max(0,Ia.findIndex(e=>e===o)):Math.max(0,Ia.findIndex(e=>e===a));return{label:t?`Requesting update`:n&&a===`failed`?`Writing failed`:La[a],completed:t?0:s,total:Ia.length-1,entries:r,steps:Ia.map(e=>La[e]),active:t||e.state.status===`queued`||e.state.status===`running`}}function Ba(e){switch(e){case`current`:return`Up to date with the current work.`;case`unknown`:return;case`changed`:return`The work changed after this walkthrough’s snapshot. Update to include the latest changes.`}}function Va(e,t){let n=e.worktree.find(e=>e.path===t),r=n?.comparisons.find(e=>e.scope===`unmerged`||`kind`in e&&e.kind===`deleted`);return{local:n,held:r&&{kind:`worktree`,change:r}}}function Ha(e,t){let{local:n,held:r}=Va(e,t);return r||(e.branch===void 0?e.branchFailed||n?{kind:`file`}:void 0:e.branch.find(e=>e.path===t)?.status===`deleted`?{kind:`branch`}:{kind:`file`})}var Ua=16,Wa={right:16,down:24},Ga={right:12,down:20},Ka={right:32,down:8},qa=24,Ja=16,Ya=2,Xa=6,Za=8,Qa=28,$a=32,eo=32,Q=e=>Math.round(e*10)/10;function to(e,t){let n=Math.atan2(e.y-t.y,e.x-t.x),r=Math.PI/7;return[e,{x:e.x-Xa*Math.cos(n-r),y:e.y-Xa*Math.sin(n-r)},{x:e.x-Xa*Math.cos(n+r),y:e.y-Xa*Math.sin(n+r)}].map(e=>`${Q(e.x)},${Q(e.y)}`).join(` `)}function no(e,t,n){let r=n?(t.x-e.x)/2:(t.y-e.y)/2,i=n?{x:e.x+r,y:e.y}:{x:e.x,y:e.y+r},a=n?{x:t.x-r,y:t.y}:{x:t.x,y:t.y-r};return{path:`M${Q(e.x)} ${Q(e.y)} C${Q(i.x)} ${Q(i.y)} ${Q(a.x)} ${Q(a.y)} ${Q(t.x)} ${Q(t.y)}`,arrow:to(t,a),middle:{x:Q((e.x+3*i.x+3*a.x+t.x)/8),y:Q((e.y+3*i.y+3*a.y+t.y)/8)}}}function ro(e,t){let n=new Map(e.map(e=>[e,[]]));t.forEach((e,t)=>n.get(e.from)?.push(t));let r=new Map,i=new Set,a=e=>{r.set(e,`open`);for(let o of n.get(e)??[]){let e=t[o]?.to;if(e===void 0)continue;let n=r.get(e);n===`open`?i.add(o):n===void 0&&a(e)}r.set(e,`done`)},o=new Set(t.map(e=>e.to));for(let t of e)!o.has(t)&&!r.has(t)&&a(t);for(let t of e)r.has(t)||a(t);let s=t.map((e,t)=>i.has(t)?{from:e.to,to:e.from}:e),c=new Map(e.map(e=>[e,0]));for(let t=0;t<e.length;t+=1)for(let e of s){let t=(c.get(e.from)??0)+1;(c.get(e.to)??0)<t&&c.set(e.to,t)}for(let t of e){let e=s.filter(e=>e.from===t).map(e=>c.get(e.to)??0);!s.some(e=>e.to===t)&&e.length>0&&c.set(t,Math.min(...e)-1)}let l=[...new Set(c.values())].sort((e,t)=>e-t);return new Map([...c].map(([e,t])=>[e,l.indexOf(t)]))}function io(e,t,n){let r=Math.max(...e.map(e=>n.get(e)??0))+1,i=Array.from({length:r},()=>[]);for(let t of e)i[n.get(t)??0]?.push(t);let a=()=>new Map(i.flatMap(e=>e.map((e,t)=>[e,t]))),o=(e,r)=>t.flatMap(t=>{let i=t.from===e?t.to:t.to===e?t.from:void 0;if(i===void 0)return[];let a=n.get(i)??0,o=n.get(e)??0;return(r?a<o:a>o)?[i]:[]});for(let e=0;e<4;e+=1){let t=e%2==0,n=a(),r=t?i:[...i].reverse();for(let e of r){let r=new Map(e.map((e,r)=>{let i=o(e,t);return[e,i.length===0?r:i.reduce((e,t)=>e+(n.get(t)??0),0)/i.length]}));e.sort((e,t)=>(r.get(e)??0)-(r.get(t)??0))}}return i}function ao(e,t){let n=new Map;return{points:n,chains:e.map((e,r)=>{let i=(t.get(e.from)??0)*2,a=(t.get(e.to)??0)*2,o=Math.min(i,a),s=Math.max(i,a),c=o+1+2*Math.floor((s-o-1)/4),l=[];for(let t=o+1;t<s;t+=1){let i=`\u0000${r}:${t}`;n.set(i,{id:i,edge:r,label:e.label!==void 0&&t===c}),l.push(i)}return{levels:[o,...l.map((e,t)=>o+1+t),s],ids:i<=a?l:[...l].reverse(),ahead:i<=a}})}}function oo(e,t,n){let r=n===`right`,i=e.nodes.map(e=>e.id),a=new Map(e.nodes.map(e=>[e.id,t.node(e)])),o=ro(i,e.edges),{points:s,chains:c}=ao(e.edges,o);for(let n of s.values()){let r=e.edges[n.edge]?.label,i=n.label&&r!==void 0?t.label(r):Ya;a.set(n.id,{width:i,height:n.label?Ja:Ya})}let l=new Map([...i.map(e=>[e,(o.get(e)??0)*2]),...c.flatMap(e=>e.ids.map(t=>[t,(e.ahead?e.levels[1+e.ids.indexOf(t)]:e.levels[e.ids.length-e.ids.indexOf(t)])??0]))]),u=e.edges.flatMap((e,t)=>{let n=c[t];if(n===void 0)return[];let r=[e.from,...n.ids,e.to];return r.slice(1).map((e,t)=>({from:r[t]??e,to:e}))}),d=io([...i,...s.keys()],u,l),f=e=>r?a.get(e)?.width??0:a.get(e)?.height??0,p=e=>r?a.get(e)?.height??0:a.get(e)?.width??0,m=d.map((e,t)=>Math.max(t%2==1?Ka[n]:0,...e.map(f))),h=d.map(e=>e.reduce((e,t)=>e+p(t),0)+Math.max(0,e.length-1)*Wa[n]),g=Math.max(...h),_=new Map,v=[],y=Ua;d.forEach((e,t)=>{let i=Ua+(g-(h[t]??0))/2,o=m[t]??0;for(let t of e){let e=a.get(t)?.width??0,s=a.get(t)?.height??0,c=y+(o-f(t))/2;_.set(t,r?{x:c,y:i,width:e,height:s}:{x:i,y:c,width:e,height:s}),i+=p(t)+Wa[n]}v.push({start:y,end:y+o}),y+=o+(t<d.length-1?Ga[n]:0)});let b=new Map;e.edges.forEach((e,t)=>{let n=[e.from,e.to].sort().join(`\0`);b.set(n,[...b.get(n)??[],t])});let x=(e,t)=>r?{x:e,y:t}:{x:t,y:e},S=e=>r?e.y+e.height/2:e.x+e.width/2,C=e.edges.flatMap((e,t)=>{let n=_.get(e.from),i=_.get(e.to),a=c[t];if(n===void 0||i===void 0||a===void 0)return[];let o=b.get([e.from,e.to].sort().join(`\0`))??[],u=(o.indexOf(t)-(o.length-1)/2)*2*Za,d=a.ahead?1:-1,f=e=>v[l.get(e)??0],p=f(e.from),m=f(e.to);if(p===void 0||m===void 0)return[];let h=e=>r?a.ahead?e.x+e.width:e.x:a.ahead?e.y+e.height:e.y,g=e=>r?a.ahead?e.x:e.x+e.width:a.ahead?e.y:e.y+e.height,y=[x(h(n),S(n)+u),x(a.ahead?p.end:p.start,S(n)+u)],C;for(let e of a.ids){let t=_.get(e),n=f(e);if(t===void 0||n===void 0)continue;let r=S(t);y.push(x(a.ahead?n.start:n.end,r),x(a.ahead?n.end:n.start,r)),s.get(e)?.label&&(C=x((n.start+n.end)/2,r))}y.push(x(a.ahead?m.start:m.end,S(i)+u),x(g(i),S(i)+u));let w=[];for(let e=1;e<y.length;e+=1){let t=y[e-1],n=y[e],i=r?t.y===n.y:t.x===n.x;w.push(i?`L${Q(n.x)} ${Q(n.y)}`:no(t,n,r).path.replace(/^M\S+ \S+ /,``))}let T=y[0],E=y.at(-1),D=x((r?E.x:E.y)-d*Xa,r?E.y:E.x),O=C??y[Math.floor(y.length/2)-1]??x(0,0);return[{index:t,path:`M${Q(T.x)} ${Q(T.y)} ${w.join(` `)}`,arrow:to(E,D),label:e.label===void 0?void 0:{x:Q(O.x),y:Q(O.y)}}]}),w=y+Ua,T=g+32;return{placement:n,width:Q(r?w:T),height:Q(r?T:w),nodes:i.flatMap(e=>{let t=_.get(e);return t===void 0?[]:[{id:e,x:Q(t.x),y:Q(t.y),width:t.width,height:t.height}]}),edges:C,lifelines:[]}}function so(e,t){let n=e.nodes.map(e=>t.node(e)),r=new Map(e.nodes.map((e,t)=>[e.id,t])),i=n.slice(1).map((e,t)=>(n[t]?.width??0)/2+e.width/2+eo),a=e.edges.map(e=>{let n=r.get(e.from)??0,i=r.get(e.to)??0;return{low:Math.min(n,i),high:Math.max(n,i),need:e.label?t.label(e.label)+qa:0}}).sort((e,t)=>e.high-e.low-(t.high-t.low));for(let e of a){let t=i.slice(e.low,e.high).reduce((e,t)=>e+t,0);if(t<e.need){let n=(e.need-t)/(e.high-e.low);for(let t=e.low;t<e.high;t+=1)i[t]=(i[t]??0)+n}}let o=Math.max(...n.map(e=>e.height)),s=[];n.forEach((e,t)=>{s.push(t===0?Ua+e.width/2:(s[t-1]??0)+(i[t-1]??0))});let c=Ua+o,l=c+Qa,u=l+Math.max(0,e.edges.length-1)*$a,d=e.edges.flatMap((e,t)=>{let n=s[r.get(e.from)??-1],i=s[r.get(e.to)??-1];if(n===void 0||i===void 0)return[];let a=l+t*$a,o=Math.sign(i-n),c={x:n+o*2,y:a},u={x:i-o*2,y:a};return[{index:t,path:`M${Q(c.x)} ${a} L${Q(u.x)} ${a}`,arrow:to(u,c),label:e.label===void 0?void 0:{x:Q((n+i)/2),y:a-9}}]}),f=n.at(-1)?.width??0;return{placement:`sequence`,width:Q((s.at(-1)??0)+f/2+Ua),height:Q(u+16+Ua),nodes:e.nodes.map((e,t)=>{let r=n[t]??{width:0,height:0};return{id:e.id,x:Q((s[t]??0)-r.width/2),y:Ua+(o-r.height)/2,width:r.width,height:r.height}}),edges:d,lifelines:s.map(e=>({x:Q(e),top:c,bottom:u+16}))}}function co(e,t,n){if(e.layout===`sequence`)return so(e,t);if(e.layout===`layers`)return oo(e,t,`down`);let r=oo(e,t,`right`);if(r.width<=n)return r;let i=oo(e,t,`down`);return i.width<r.width?i:r}function lo(e,t){let n=new Set,r=new Set([t]);return e.edges.forEach((e,i)=>{(e.from===t||e.to===t)&&(n.add(i),r.add(e.from),r.add(e.to))}),{nodes:r,edges:n}}function uo(e,t){let n=t=>e.nodes.find(e=>e.id===t)?.label??t,r=t=>e.layout===`sequence`?`${t+1}. `:``,i=e=>e.mark===`added`?` (new)`:e.mark===`removed`?` (removed)`:``;return e.edges.flatMap((e,a)=>{let o=e.label===void 0?``:` (${e.label})`;return e.from===t?[`${r(a)}To ${n(e.to)}${o}${i(e)}`]:e.to===t?[`${r(a)}From ${n(e.from)}${o}${i(e)}`]:[]})}function fo(e,t,n){if(n===`first`)return e.nodes[0]?.id??t;if(n===`last`)return e.nodes.at(-1)?.id??t;let r=e=>({x:e.x+e.width/2,y:e.y+e.height/2}),i=e.nodes.find(e=>e.id===t);if(i===void 0)return e.nodes[0]?.id??t;let a=r(i),o=n===`left`||n===`right`,s=n===`right`||n===`down`?1:-1,c=e.nodes.flatMap(e=>{if(e.id===t)return[];let n=r(e),c=(o?n.x-a.x:n.y-a.y)*s,l=Math.abs(o?n.y-a.y:n.x-a.x),u=o?(i.height+e.height)/2:(i.width+e.width)/2;return c>1?[{id:e.id,along:c,aside:l,band:l<u}]:[]}),l=c.filter(e=>e.band),u=l.length>0?l:c,d=Math.min(...u.map(e=>e.along));return u.filter(e=>e.along<=d+8).sort((e,t)=>e.aside-t.aside)[0]?.id??t}var po=30,mo=44,ho=8;function go(e){return{node:t=>{let n=t.mark&&t.mark!==`unchanged`?e.sign:0,r=n+t.label.length*e.label+(t.anchor?e.chevron:0),i=t.note?n+t.note.length*e.note:0;return{width:Math.round(Math.min(e.max,Math.max(e.min,Math.max(r,i)+e.padding))),height:t.note?mo:po}},label:t=>t.length*e.edge+ho}}var _o={added:`new`,changed:`changed`,removed:`removed`,unchanged:`unchanged`};function vo(e){return e.mark===void 0||e.mark===`unchanged`?void 0:tn({change:e.mark,what:``,note:``})}function yo(e){return[e.kind,e.mark===void 0?void 0:_o[e.mark]].filter(Boolean).join(`, `)}function bo(e,t){let n=yo(t),r=uo(e,t.id),i=``;return t.anchor?.kind===`lines`&&(i=`Shows ${t.anchor.excerpt.path}, ${t.anchor.excerpt.lines}.`),t.anchor?.kind===`file`&&(i=`Shows ${t.anchor.path}.`),[n?`${n}.`:``,r.length>0?`${r.join(`; `)}.`:``,i].filter(Boolean).join(` `)}function xo(e,t){return e.mark===`added`?`add`:e.mark===`removed`?`del`:t?`lit`:`rest`}function So(e){let t=(0,Z.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(Ot,{}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,X.jsxs)(X.Fragment,{children:[r,(0,X.jsx)(Yt,{children:n})]}),t[1]=n,t[2]=i),i}function Co(e){let t=(0,Z.c)(6),{children:n}=e,[r,i]=(0,Y.useState)(!0),a=_e(),o;t[0]===a?o=t[1]:(o=a&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(xn,{connection:a}),(0,X.jsx)(rn,{connection:a}),(0,X.jsx)(Ft,{connection:a})]}),t[0]=a,t[1]=o);let s;return t[2]!==n||t[3]!==r||t[4]!==o?(s=(0,X.jsx)(So,{children:(0,X.jsxs)(_t,{open:r,onOpenChange:i,children:[n,o]})}),t[2]=n,t[3]=r,t[4]=o,t[5]=s):s=t[5],s}function wo(e,t){return{connection:t.connection,scope:{projectId:e.projectId,worktreeId:e.worktreeId}}}var To=T(e=>Bn(e).pipe(d,Ve(0)));function Eo(e,n){let r=(0,Z.c)(12),i;r[0]!==n||r[1]!==e?(i=To(wo(e,n)),r[0]=n,r[1]=e,r[2]=i):i=r[2];let a=i,o=O(a),s,l,u;if(r[3]!==o){let e=c(q(o));s=o,l=e,u=e?Lr(e):void 0,r[3]=o,r[4]=s,r[5]=l,r[6]=u}else s=r[4],l=r[5],u=r[6];let d=t(a),f;return r[7]!==s||r[8]!==l||r[9]!==u||r[10]!==d?(f={result:s,read:l,phase:u,refresh:d},r[7]=s,r[8]=l,r[9]=u,r[10]=d,r[11]=f):f=r[11],f}function Do(e,t){let{phase:n}=Eo(e,t);return n?.kind===`ready`?n:void 0}function Oo(e,t,n){let r=(0,Z.c)(2),i=Wr(e,t.connection,n).result,a;return r[0]===i?a=r[1]:(a=c(q(i))?.files??[],r[0]=i,r[1]=a),a}function ko(e,t){let n=(0,Z.c)(2),{read:r}=Eo(e,t),i;return n[0]===r?i=n[1]:(i=r?cr(r):`Review`,n[0]=r,n[1]=i),i}function Ao(e,t){let n=(0,Z.c)(2),{result:r}=Eo(e,t),i;return n[0]===r?i=n[1]:(i=Fa({walkthrough:Ea(r,jo)}),n[0]=r,n[1]=i),i}function jo(e){return e}var Mo=T(e=>h(t=>{let n=t(Zr(e));return we(n,e=>{let n=URL.createObjectURL(new Blob([Uint8Array.from(e)]));return t.addFinalizer(()=>URL.revokeObjectURL(n)),n})}));function No(e){let n=(0,Z.c)(3),r={...wo(e.scope,e.context),runId:e.runId,assetId:e.assetId},i=O(Mo(r)),a=t(Zr(r)),o;return n[0]!==i||n[1]!==a?(o={url:i,retry:a},n[0]=i,n[1]=a,n[2]=o):o=n[2],o}function Po(e,n,r,i,a,o){let s=(0,Z.c)(10),c;s[0]!==a||s[1]!==n||s[2]!==o||s[3]!==r||s[4]!==e||s[5]!==i?(c=Bn({...wo(e,n),excerpt:{runId:r,step:i,block:a,...o===void 0?{}:{node:o}}}),s[0]=a,s[1]=n,s[2]=o,s[3]=r,s[4]=e,s[5]=i,s[6]=c):c=s[6];let l=c,u=O(l),d=t(l),f;return s[7]!==u||s[8]!==d?(f={result:u,retry:d},s[7]=u,s[8]=d,s[9]=f):f=s[9],f}function Fo(e,t,n,r,a){let o=(0,Z.c)(8),s;o[0]!==t.connection||o[1]!==e.projectId||o[2]!==e.worktreeId?(s=gn({connection:t.connection,scope:{projectId:e.projectId,worktreeId:e.worktreeId}}),o[0]=t.connection,o[1]=e.projectId,o[2]=e.worktreeId,o[3]=s):s=o[3];let l;o[4]===Symbol.for(`react.memo_cache_sentinel`)?(l={mode:`promiseExit`},o[4]=l):l=o[4];let[u,d]=i(s,l),f=c(q(kr(e,t.connection))),p;o[5]!==t.connection||o[6]!==e.projectId?(p=V({connection:t.connection,projectId:e.projectId}),o[5]=t.connection,o[6]=e.projectId,o[7]=p):p=o[7];let m=O(p);return Sn([u,d],{pulls:m,branch:f?.branch?.name??r?.branch,displayedRun:r,base:n,writer:a})}function Io(e,t){let n=(0,Z.c)(14),{connection:r}=e.context,{projectId:i}=e.scope,a=De(Et),o;n[0]!==r||n[1]!==i||n[2]!==t.branch||n[3]!==t.pullRequestNumber?(o=rr({connection:r,projectId:i,branch:t.branch,pullRequestNumber:t.pullRequestNumber}),n[0]=r,n[1]=i,n[2]=t.branch,n[3]=t.pullRequestNumber,n[4]=o):o=n[4];let s=O(o);if(!s)return;let c;n[5]!==r||n[6]!==e||n[7]!==a||n[8]!==i||n[9]!==s?(c=t=>{a(t===void 0?void 0:{projectId:i,number:s.number,name:t}),e.onOpen(mt({projectId:i,number:s.number,environmentId:r.environmentId,shownOn:r.environmentId}))},n[5]=r,n[6]=e,n[7]=a,n[8]=i,n[9]=s,n[10]=c):c=n[10];let l;return n[11]!==s||n[12]!==c?(l={...s,openCheck:c},n[11]=s,n[12]=c,n[13]=l):l=n[13],l}function $(e){let t=(0,Z.c)(4),{text:n}=e,r;t[0]===n?r=t[1]:(r=an(n).map(Lo),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,X.jsx)(X.Fragment,{children:r}),t[2]=r,t[3]=i),i}function Lo(e,t){return e.kind===`code`?(0,X.jsx)(`code`,{className:`rounded bg-muted px-1 py-px font-mono text-[0.86em]`,children:e.text},t):e.text}var Ro=a(`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 dark:*:data-[slot=bubble-content]:bg-input/30 [&>[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 zo({variant:e=`default`,align:t=`start`,className:n,...r}){return(0,X.jsx)(`div`,{"data-slot":`bubble`,"data-variant":e,"data-align":t,className:j(Ro({variant:e}),n),...r})}function Bo({className:e,render:t,...n}){return p({defaultTagName:`div`,props:W({className:j(`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`}})}a(`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 Vo({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`message-group`,className:j(`flex min-w-0 flex-col gap-1.5`,e),...t})}function Ho({className:e,align:t=`start`,...n}){return(0,X.jsx)(`div`,{"data-slot":`message`,"data-align":t,className:j(`group/message relative flex w-full min-w-0 gap-1.5 text-xs/relaxed data-[align=end]:flex-row-reverse`,e),...n})}function Uo({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`message-content`,className:j(`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 Wo({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`message-header`,className:j(`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 Go({scope:e,context:t,run:n}){return{connection:t.connection,runId:n.id,scope:{projectId:e.projectId,worktreeId:e.worktreeId}}}function Ko(e){let n=(0,Z.c)(10),r;n[0]===e?r=n[1]:(r=un(Go(e)),n[0]=e,n[1]=r);let i=r,a=O(i),o;n[2]===a?o=n[3]:(o=c(q(a)),n[2]=a,n[3]=o);let s;n[4]===a?s=n[5]:(s=me(a),n[4]=a,n[5]=s);let l=t(i),u;return n[6]!==o||n[7]!==s||n[8]!==l?(u={view:o,failed:s,refresh:l},n[6]=o,n[7]=s,n[8]=l,n[9]=u):u=n[9],u}function qo(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=i(e,n),a;return t[1]===r?a=t[2]:(a=Jr(r),t[1]=r,t[2]=a),a}function Jo(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:(n=Nt(Go(e)),t[0]=e,t[1]=n);let r=qo(n.retryAnswer),i;return t[2]===r?i=t[3]:(i={retry:r},t[2]=r,t[3]=i),i}function Yo(e,t){let n=(0,Z.c)(7),[r,i]=(0,Y.useState)(),a=Jo(e),o;n[0]!==a.retry||n[1]!==t?(o=()=>{i(void 0),a.retry.run(t).catch(e=>i(ja(e)))},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 Xo(e,t){let n=Go(e);return Pa(i(vr(n,e.run,t)),qo(Nt(n).addMessage),{runId:n.runId,title:t})}function Zo(e){let t=(0,Z.c)(8),n;t[0]===e?n=t[1]:(n=Nt(Go(e)),t[0]=e,t[1]=n);let r=qo(n.decideCall),[i,a]=(0,Y.useState)(),o;t[2]===r?o=t[3]:(o=e=>{a(void 0),r.run(Pn(e)).catch(e=>a(ja(e)))},t[2]=r,t[3]=o);let s;return t[4]!==r.waiting||t[5]!==i||t[6]!==o?(s={failure:i,waiting:r.waiting,decide:o},t[4]=r.waiting,t[5]=i,t[6]=o,t[7]=s):s=t[7],s}function Qo(e,t){let n=(0,Z.c)(11),r;n[0]!==e.context||n[1]!==e.scope?(r={scope:e.scope,context:e.context},n[0]=e.context,n[1]=e.scope,n[2]=r):r=n[2];let i=ar(r),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(),l;n[3]!==i.add||n[4]!==t?(l=e=>{c(void 0),i.add.run({anchor:{kind:`step`,title:t},text:e}).then(()=>o(!0),()=>c(`The comment was not saved. Try again.`))},n[3]=i.add,n[4]=t,n[5]=l):l=n[5];let u;return n[6]!==a||n[7]!==i.add.waiting||n[8]!==s||n[9]!==l?(u={added:a,failure:s,waiting:i.add.waiting,add:l},n[6]=a,n[7]=i.add.waiting,n[8]=s,n[9]=l,n[10]=u):u=n[10],u}function $o(e){let t=(0,Z.c)(40),{message:n,question:r,stepTitle:i,owner:a}=e,[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(!1),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>e=>{if(!e)return;let t=()=>l(e.scrollHeight>e.clientHeight);t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},t[0]=u):u=t[0];let[d]=(0,Y.useState)(u),{failure:f,waiting:p,retry:m}=Yo(a,n.replyTo),h=n.state,g=ye(a.context),_;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(Wo,{children:`Walkthrough agent`}),t[1]=_):_=t[1];let v;t[2]!==o||t[3]!==h.status||t[4]!==h.text?(v=h.status===`answered`?(0,X.jsx)(`span`,{ref:d,className:o?void 0:`line-clamp-3`,children:(0,X.jsx)($,{text:h.text})}):null,t[2]=o,t[3]=h.status,t[4]=h.text,t[5]=v):v=t[5];let y;t[6]===h.status?y=t[7]:(y=h.status===`answering`&&(0,X.jsx)(`span`,{role:`status`,className:`text-muted-foreground`,children:`Working…`}),t[6]=h.status,t[7]=y);let b;t[8]!==h.failure||t[9]!==h.status?(b=h.status===`failed`&&(0,X.jsx)(`span`,{children:h.failure.message}),t[8]=h.failure,t[9]=h.status,t[10]=b):b=t[10];let x;t[11]!==v||t[12]!==y||t[13]!==b?(x=(0,X.jsx)(zo,{variant:`ghost`,className:`max-w-full`,children:(0,X.jsxs)(Bo,{className:`whitespace-pre-wrap`,children:[v,y,b]})}),t[11]=v,t[12]=y,t[13]=b,t[14]=x):x=t[14];let S;t[15]!==c||t[16]!==o||t[17]!==h.status?(S=h.status===`answered`&&!o&&c&&(0,X.jsx)(H,{variant:`link`,size:`flush`,onClick:()=>s(!0),children:`Read all`}),t[15]=c,t[16]=o,t[17]=h.status,t[18]=S):S=t[18];let C;t[19]!==m||t[20]!==h.status||t[21]!==p||t[22]!==g?(C=h.status===`failed`&&(0,X.jsx)(H,{variant:`link`,size:`flush`,disabled:p||!!g,"aria-description":g,onClick:()=>m(),children:`Try again`}),t[19]=m,t[20]=h.status,t[21]=p,t[22]=g,t[23]=C):C=t[23];let w;t[24]!==a||t[25]!==r||t[26]!==h.status||t[27]!==h.text||t[28]!==i?(w=h.status===`answered`&&i!==void 0&&(0,X.jsx)(es,{owner:a,stepTitle:i,text:fn(r,h.text)}),t[24]=a,t[25]=r,t[26]=h.status,t[27]=h.text,t[28]=i,t[29]=w):w=t[29];let T;t[30]!==S||t[31]!==C||t[32]!==w?(T=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[S,C,w]}),t[30]=S,t[31]=C,t[32]=w,t[33]=T):T=t[33];let E;t[34]===f?E=t[35]:(E=f&&(0,X.jsx)(`p`,{role:`alert`,className:`text-caption text-destructive`,children:f}),t[34]=f,t[35]=E);let D;return t[36]!==T||t[37]!==E||t[38]!==x?(D=(0,X.jsx)(Ho,{children:(0,X.jsxs)(Uo,{children:[_,x,T,E]})}),t[36]=T,t[37]=E,t[38]=x,t[39]=D):D=t[39],D}function es(e){let t=(0,Z.c)(13),{owner:n,stepTitle:r,text:i}=e,a=Qo(n,r),o=ye(n.context);if(a.added){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`span`,{role:`status`,className:`text-caption text-muted-foreground`,children:`Added to the review`}),t[0]=e):e=t[0],e}let s=a.waiting||!!o,c;t[1]!==a||t[2]!==i?(c=()=>a.add(i),t[1]=a,t[2]=i,t[3]=c):c=t[3];let l;t[4]!==s||t[5]!==c||t[6]!==o?(l=(0,X.jsx)(H,{variant:`link`,size:`flush`,disabled:s,"aria-description":o,onClick:c,children:`Add to review`}),t[4]=s,t[5]=c,t[6]=o,t[7]=l):l=t[7];let u;t[8]===a.failure?u=t[9]:(u=a.failure&&(0,X.jsx)(`span`,{role:`alert`,className:`text-caption text-destructive`,children:a.failure}),t[8]=a.failure,t[9]=u);let d;return t[10]!==l||t[11]!==u?(d=(0,X.jsxs)(X.Fragment,{children:[l,u]}),t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function ts({conversation:e,owner:t,stepTitle:n}){return Ma(e).map(({message:e,reply:r})=>(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(Ho,{align:`end`,children:(0,X.jsx)(Uo,{children:(0,X.jsx)(zo,{align:`end`,variant:`secondary`,children:(0,X.jsx)(Bo,{className:`whitespace-pre-wrap`,children:(0,X.jsx)($,{text:e.text})})})})}),r&&(0,X.jsx)($o,{owner:t,message:r,question:e.text,stepTitle:n})]},e.id))}function ns(e){let t=(0,Z.c)(53),{owner:n,title:r,placeholder:i,onComment:a}=e,o=ye(n.context),{text:s,failure:c,waiting:l,change:u,send:d}=Xo(n,r),f;t[0]!==d||t[1]!==o?(f=()=>{o||d()},t[0]=d,t[1]=o,t[2]=f):f=t[2];let p=f,m;t[3]===u?m=t[4]:(m=()=>u(``),t[3]=u,t[4]=m);let{waiting:h,failure:g,submit:_}=nr(a,m),v;t[5]!==_||t[6]!==s||t[7]!==o?(v=()=>{let e=s.trim();e&&!o&&_(e)},t[5]=_,t[6]=s,t[7]=o,t[8]=v):v=t[8];let y=v,b;t[9]===u?b=t[10]:(b=e=>u(e.target.value),t[9]=u,t[10]=b);let S;t[11]===p?S=t[12]:(S=e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),p())},t[11]=p,t[12]=S);let w;t[13]!==i||t[14]!==b||t[15]!==S||t[16]!==s?(w=(0,X.jsx)(Dn,{value:s,rows:1,maxLength:8e3,"aria-label":i,placeholder:i,className:`min-h-9`,onChange:b,onKeyDown:S}),t[13]=i,t[14]=b,t[15]=S,t[16]=s,t[17]=w):w=t[17];let T;t[18]!==y||t[19]!==h||t[20]!==a||t[21]!==s||t[22]!==o?(T=a&&(0,X.jsx)(An,{size:`xs`,variant:`outline`,focusableWhenDisabled:!0,disabled:!s.trim()||h||!!o,"aria-description":o,onClick:y,children:`Comment`}),t[18]=y,t[19]=h,t[20]=a,t[21]=s,t[22]=o,t[23]=T):T=t[23];let E=a?`xs`:`icon-xs`,D=a?`Ask`:`Send`,O;t[24]!==s||t[25]!==l||t[26]!==o?(O=!s.trim()||l||!!o,t[24]=s,t[25]=l,t[26]=o,t[27]=O):O=t[27];let k=a&&`Ask`,A;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(on,{}),t[28]=A):A=t[28];let j;t[29]!==p||t[30]!==O||t[31]!==k||t[32]!==E||t[33]!==D||t[34]!==o?(j=(0,X.jsx)(x,{render:(0,X.jsxs)(An,{size:E,variant:`default`,"aria-label":D,focusableWhenDisabled:!0,disabled:O,"aria-description":o,onClick:p,children:[k,A]})}),t[29]=p,t[30]=O,t[31]=k,t[32]=E,t[33]=D,t[34]=o,t[35]=j):j=t[35];let M=a?`Ask the Walkthrough agent`:`Send`,N;t[36]===M?N=t[37]:(N=(0,X.jsx)(He,{children:M}),t[36]=M,t[37]=N);let P;t[38]!==j||t[39]!==N?(P=(0,X.jsxs)(C,{children:[j,N]}),t[38]=j,t[39]=N,t[40]=P):P=t[40];let F;t[41]!==P||t[42]!==T?(F=(0,X.jsxs)(Bt,{align:`inline-end`,children:[T,P]}),t[41]=P,t[42]=T,t[43]=F):F=t[43];let I;t[44]!==F||t[45]!==w?(I=(0,X.jsxs)(Nr,{children:[w,F]}),t[44]=F,t[45]=w,t[46]=I):I=t[46];let L;t[47]!==g||t[48]!==c?(L=(c??g)&&(0,X.jsx)(`p`,{role:`alert`,className:`text-caption text-destructive`,children:c??g}),t[47]=g,t[48]=c,t[49]=L):L=t[49];let R;return t[50]!==I||t[51]!==L?(R=(0,X.jsxs)(X.Fragment,{children:[I,L]}),t[50]=I,t[51]=L,t[52]=R):R=t[52],R}function rs(e){let t=(0,Z.c)(16),{owner:n,title:r}=e,i;t[0]!==n.context||t[1]!==n.scope?(i={scope:n.scope,context:n.context},t[0]=n.context,t[1]=n.scope,t[2]=i):i=t[2];let a=i,{view:o}=In(a),s,c,l;if(t[3]!==a||t[4]!==r||t[5]!==o){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[9]===r?e=t[10]:(e=e=>e.kind===`step`&&e.title===r,t[9]=r,t[10]=e);let n=Hn(o,e);if(n.length===0){l=null;break bb0}s=`flex flex-col gap-2`;let i;t[11]===a?i=t[12]:(i=e=>(0,X.jsx)(br,{owner:a,comment:e},e.id),t[11]=a,t[12]=i),c=n.map(i)}t[3]=a,t[4]=r,t[5]=o,t[6]=s,t[7]=c,t[8]=l}else s=t[6],c=t[7],l=t[8];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let u;return t[13]!==s||t[14]!==c?(u=(0,X.jsx)(`div`,{className:s,children:c}),t[13]=s,t[14]=c,t[15]=u):u=t[15],u}function is(e){let t=(0,Z.c)(31),{owner:n,title:r,stepTitle:i}=e,{view:a,failed:o,refresh:s}=Ko(n),c;t[0]!==n.context||t[1]!==n.scope?(c={scope:n.scope,context:n.context},t[0]=n.context,t[1]=n.scope,t[2]=c):c=t[2];let l=ar(c),u,d,f;if(t[3]!==o||t[4]!==n||t[5]!==s||t[6]!==i||t[7]!==r||t[8]!==a){let e=Na(a,r);u=`flex flex-col gap-3`,t[12]!==o||t[13]!==s?(d=o&&(0,X.jsxs)(`p`,{role:`alert`,className:`text-caption`,children:[`Comments could not be read.`,` `,(0,X.jsx)(H,{variant:`link`,size:`flush`,onClick:s,children:`Try again`})]}),t[12]=o,t[13]=s,t[14]=d):d=t[14],f=e.length>0&&(0,X.jsx)(`div`,{className:`border-t pt-3`,children:(0,X.jsx)(Vo,{children:e.map(e=>(0,X.jsx)(ts,{owner:n,conversation:e,stepTitle:i},e.runId))})}),t[3]=o,t[4]=n,t[5]=s,t[6]=i,t[7]=r,t[8]=a,t[9]=u,t[10]=d,t[11]=f}else u=t[9],d=t[10],f=t[11];let p;t[15]!==n||t[16]!==i?(p=(0,X.jsx)(rs,{owner:n,title:i}),t[15]=n,t[16]=i,t[17]=p):p=t[17];let m;t[18]!==l.add||t[19]!==i?(m=e=>l.add.run({anchor:{kind:`step`,title:i},text:e}),t[18]=l.add,t[19]=i,t[20]=m):m=t[20];let h;t[21]!==n||t[22]!==m||t[23]!==r?(h=(0,X.jsx)(ns,{owner:n,title:r,placeholder:`Comment on this step, or ask the agent`,onComment:m}),t[21]=n,t[22]=m,t[23]=r,t[24]=h):h=t[24];let g;return t[25]!==u||t[26]!==d||t[27]!==f||t[28]!==p||t[29]!==h?(g=(0,X.jsxs)(`div`,{className:u,children:[d,f,p,h]}),t[25]=u,t[26]=d,t[27]=f,t[28]=p,t[29]=h,t[30]=g):g=t[30],g}function as(e){let t=(0,Z.c)(18),{owner:n,titles:r}=e,{view:i}=Ko(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=Aa(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,X.jsx)(`h2`,{className:`text-ui font-semibold`,children:`Earlier comments`}),t[8]=c):c=t[8],a=Vo;let u;t[9]===n?u=t[10]:(u=(e,t)=>(0,X.jsx)(ts,{owner:n,conversation:e,stepTitle:void 0},`${e.runId}:${t}`),t[9]=n,t[10]=u),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[11]!==a||t[12]!==o?(u=(0,X.jsx)(a,{children:o}),t[11]=a,t[12]=o,t[13]=u):u=t[13];let d;return t[14]!==s||t[15]!==c||t[16]!==u?(d=(0,X.jsxs)(`section`,{className:s,children:[c,u]}),t[14]=s,t[15]=c,t[16]=u,t[17]=d):d=t[17],d}function os(e){let t=(0,Z.c)(3),{copy:n}=e,r=n.message&&` ${n.message}`,i;return t[0]!==n.title||t[1]!==r?(i=(0,X.jsxs)(`p`,{role:`alert`,className:`min-w-0 flex-1 basis-64 font-medium text-pretty`,children:[n.title,r]}),t[0]=n.title,t[1]=r,t[2]=i):i=t[2],i}function ss(e){let t=(0,Z.c)(76),{run:n,requesting:r,first:i,reused:a,freshness:o,failure:s,onUpdate:c,writeBlock:l,controls:u}=e,d=r!==void 0&&r,f=i!==void 0&&i,p=a!==void 0&&a,m,h,g,_,v,y,b,x,S,C,w,T,E,D;if(t[0]!==u||t[1]!==s||t[2]!==f||t[3]!==o||t[4]!==c||t[5]!==d||t[6]!==p||t[7]!==n||t[8]!==l){x=Symbol.for(`react.early_return_sentinel`);bb0:{if(m=za(n,d,f),n.state.status===`ready`&&!m.active&&!d&&!s){let e=o===`changed`,r;t[23]!==e||t[24]!==p||t[25]!==n.state.writtenAt?(r=p&&!e?`Already up to date: the saved walkthrough was reused.`:(0,X.jsxs)(X.Fragment,{children:[`Saved`,` `,(0,X.jsx)(`time`,{dateTime:n.state.writtenAt,children:new Date(n.state.writtenAt).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}),e&&` · Behind the current work`]}),t[23]=e,t[24]=p,t[25]=n.state.writtenAt,t[26]=r):r=t[26];let i;t[27]===r?i=t[28]:(i=(0,X.jsx)(`p`,{role:`status`,children:r}),t[27]=r,t[28]=i);let a;t[29]!==e||t[30]!==u||t[31]!==c||t[32]!==l?(a=c&&u?.({label:`Update walkthrough`,variant:e?`outline`:`ghost`,disabled:!!l,description:l,onClick:c}),t[29]=e,t[30]=u,t[31]=c,t[32]=l,t[33]=a):a=t[33];let s;t[34]!==i||t[35]!==a?(s=(0,X.jsxs)(`section`,{"aria-label":`Walkthrough status`,className:`flex flex-wrap items-center justify-between gap-2 text-caption text-muted-foreground`,children:[i,a]}),t[34]=i,t[35]=a,t[36]=s):s=t[36],x=s;break bb0}T=`Walkthrough status`,E=`flex flex-col gap-3 rounded-lg border p-4 text-ui`;let e=s&&!m.active?(0,X.jsx)(os,{copy:wr(s.failure,s.writer)}):(0,X.jsx)(`p`,{role:`status`,className:`font-medium`,children:m.label}),r=!m.active&&c&&u?.({label:s?`Try again`:`Update walkthrough`,disabled:!!l,description:l,onClick:c});t[37]!==e||t[38]!==r?(D=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[e,r]}),t[37]=e,t[38]=r,t[39]=D):D=t[39],t[40]!==n.state.status||t[41]!==n.state.writtenAt?(h=n.state.status===`ready`&&(0,X.jsxs)(`p`,{className:`text-caption text-muted-foreground`,children:[`Last written`,` `,(0,X.jsx)(`time`,{dateTime:n.state.writtenAt,children:new Date(n.state.writtenAt).toLocaleString()})]}),t[40]=n.state.status,t[41]=n.state.writtenAt,t[42]=h):h=t[42],t[43]!==d||t[44]!==p?(g=p&&!d&&(0,X.jsx)(`p`,{className:`text-caption text-muted-foreground`,children:`This snapshot already has a walkthrough. The saved version was reused.`}),t[43]=d,t[44]=p,t[45]=g):g=t[45];let i=m.total,a=m.completed,O=m.label,k=n.state.status===`failed`?`bg-destructive`:`bg-primary`,A;t[46]===k?A=t[47]:(A=j(`h-full`,k),t[46]=k,t[47]=A);let M=`${m.completed/m.total*100}%`,N;t[48]===M?N=t[49]:(N={width:M},t[48]=M,t[49]=N);let P;t[50]!==A||t[51]!==N?(P=(0,X.jsx)(`div`,{className:A,style:N}),t[50]=A,t[51]=N,t[52]=P):P=t[52],_=(0,X.jsx)(`div`,{role:`progressbar`,"aria-label":`Walkthrough stages`,"aria-valuemin":0,"aria-valuemax":i,"aria-valuenow":a,"aria-valuetext":O,className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:P}),v=(0,X.jsx)(`ol`,{"aria-label":`Update stages`,className:`flex flex-wrap gap-x-4 gap-y-1 text-caption text-muted-foreground`,children:m.steps.map((e,t)=>{let r=!d&&t===m.completed,i=t<m.completed;return(0,X.jsxs)(`li`,{"aria-current":r?`step`:void 0,className:j(`flex items-center gap-1`,r&&`font-medium text-foreground`,r&&n.state.status===`failed`&&`text-destructive`),children:[i?(0,X.jsx)(R,{"aria-label":`Done`,className:`size-3 shrink-0 text-add-fg`}):(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[t+1,`.`]}),e]},e)})}),t[53]===d?y=t[54]:(y=d&&(0,X.jsx)(`p`,{children:`Sending the request and capturing the current work.`}),t[53]=d,t[54]=y),b=o&&(m.active||Ba(o))&&(0,X.jsx)(`p`,{className:`text-foreground-2`,children:m.active?`Showing the saved walkthrough while the update runs.`:Ba(o)}),t[55]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,X.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:`Writing log`}),t[55]=w):w=t[55],S=`mt-2 flex flex-col gap-2 text-caption text-foreground-2`,C=m.entries.map(cs)}t[0]=u,t[1]=s,t[2]=f,t[3]=o,t[4]=c,t[5]=d,t[6]=p,t[7]=n,t[8]=l,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]=w,t[20]=T,t[21]=E,t[22]=D}else m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18],w=t[19],T=t[20],E=t[21],D=t[22];if(x!==Symbol.for(`react.early_return_sentinel`))return x;let O;t[56]===m.entries.length?O=t[57]:(O=m.entries.length===0&&(0,X.jsx)(`li`,{children:`This walkthrough predates the writing log. Its recorded status is shown above.`}),t[56]=m.entries.length,t[57]=O);let k;t[58]!==O||t[59]!==S||t[60]!==C?(k=(0,X.jsxs)(`ol`,{className:S,children:[C,O]}),t[58]=O,t[59]=S,t[60]=C,t[61]=k):k=t[61];let A;t[62]!==k||t[63]!==w?(A=(0,X.jsxs)(`details`,{children:[w,k]}),t[62]=k,t[63]=w,t[64]=A):A=t[64];let M;return t[65]!==h||t[66]!==g||t[67]!==_||t[68]!==v||t[69]!==y||t[70]!==b||t[71]!==A||t[72]!==T||t[73]!==E||t[74]!==D?(M=(0,X.jsxs)(`section`,{"aria-label":T,className:E,children:[D,h,g,_,v,y,b,A]}),t[65]=h,t[66]=g,t[67]=_,t[68]=v,t[69]=y,t[70]=b,t[71]=A,t[72]=T,t[73]=E,t[74]=D,t[75]=M):M=t[75],M}function cs(e,t){return(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`time`,{dateTime:e.at,className:`mr-2 font-mono`,children:new Date(e.at).toLocaleString()}),e.message]},`${e.at}:${t}`)}function ls(e){let t=(0,Z.c)(8),{label:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=/^(.*\s)([0-9a-f]{7})$/,t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=r.exec(n),t[1]=n,t[2]=i);let a=i;if(!a)return n;let o;t[3]===a[2]?o=t[4]:(o=(0,X.jsx)(`span`,{className:`font-mono`,children:a[2]}),t[3]=a[2],t[4]=o);let s;return t[5]!==a[1]||t[6]!==o?(s=(0,X.jsxs)(X.Fragment,{children:[a[1],o]}),t[5]=a[1],t[6]=o,t[7]=s):s=t[7],s}function us(e,{orientation:t=`horizontal`,dir:n=`ltr`,arrows:r=`all`}={}){if(Bi(e))return null;if(e.key===`Home`)return{bound:`min`};if(e.key===`End`)return{bound:`max`};if(e.key===`PageUp`||e.key===`PageDown`)return{direction:e.key===`PageUp`?1:-1,size:`large`};let i=n===`rtl`&&t===`horizontal`?-1:1,a=r===`horizontal`?0:e.key===`ArrowUp`?1:e.key===`ArrowDown`?-1:0,o=r===`vertical`?0:e.key===`ArrowRight`?i:e.key===`ArrowLeft`?-i:0,s=a||o;return s?{direction:s,size:e.shiftKey?`large`:e.altKey?`small`:`step`}:null}function ds(e,t,n){return fs(t>0?e[t-1]:void 0,e[t+1],n)}function fs(e,t,n){let r=n.minStepsBetweenThumbs*n.step,i=Xi(n),a=Wi(e===void 0?n.min:e+r,n.min,i);return{lower:a,upper:Wi(t===void 0?i:t-r,a,i)}}function ps(e,t,n,r){let{lower:i,upper:a}=ds(e,t,r),o=Wi(Qi(n,r),i,a);if(o===e[t])return e;let s=e.slice();return s[t]=o,s}function ms(e,t){return e.map(e=>Wi(e,t.min,t.max)).sort((e,t)=>e-t)}function hs(e,{shiftKey:t=!1,rtl:n=!1,orientation:r=`horizontal`}={},i,a,o){let s=us({key:e,shiftKey:t},{orientation:r,dir:n?`rtl`:`ltr`});return s?`bound`in s?s.bound===`min`?a.lower:a.upper:ea(i,s,o):null}function gs(e,t){let n=0;for(let r=1;r<e.length;r++)Math.abs(e[r]-t)<Math.abs(e[n]-t)&&(n=r);let r=_s(e,n);return r.length===1?{index:n,stack:r}:t<e[n]?{index:r[0],stack:r}:t>e[n]?{index:r[r.length-1],stack:r}:{index:null,stack:r}}function _s(e,t){let n=[];for(let r=0;r<e.length;r++)e[r]===e[t]&&n.push(r);return n}function vs(e,t){return t<0?e[0]:e[e.length-1]}function ys(e,t){return t.max>t.min?bs((Wi(e,t.min,t.max)-t.min)/(t.max-t.min)*100):0}function bs(e){return Math.round(e*1e4)/1e4}function xs(e,t,{rtl:n=!1,vertical:r=!1}={}){let i=r?(t.top+t.height-e.y)/t.height:n?(t.left+t.width-e.x)/t.width:(e.x-t.left)/t.width;return Number.isFinite(i)?Wi(i,0,1):0}function Ss(e,t){return t.min+Wi(e,0,1)*(t.max-t.min)}var Cs=e=>rt(e)||e.readOnly,ws=e=>Array.isArray(e)?e:[e];function Ts(e){let t={};return ws(e).forEach((e,n)=>t[n]=e),t}function Es(e,t){return Array.isArray(t)?e[t.length]===void 0&&t.every((t,n)=>Object.is(e[n],t)):Object.is(e[0],t)&&e[1]===void 0}var Ds=(e,t)=>Array.isArray(t)?e:e[0];function Os(e){return{min:e.min,max:e.max,step:e.step,largeStep:e.largeStep,minStepsBetweenThumbs:e.minStepsBetweenThumbs}}function ks(e){return{min:e.min??0,max:e.max??100,step:e.step&&e.step>0?e.step:1}}function As(e,t){let n=ks(t);return Array.isArray(e)?ms(e,n):Wi(e,n.min,n.max)}function js(e){let t=ks(e);return{...t,largeStep:e.largeStep??t.step*10,minStepsBetweenThumbs:e.minStepsBetweenThumbs??0,orientation:Oe(e.orientation,`horizontal`),disabled:!!e.disabled,readOnly:!!e.readOnly,required:!!e.required,name:e.name,form:e.form,format:e.format,locale:e.locale}}function Ms(e,t){let n=typeof t.format==`function`?t.format:aa(t.format,t.step);return oa(e,f(t),n)}function Ns(e){return e.join(`/`)}function Ps(e){return Array.isArray(e.value)?Ns(e.value):String(e.value)}function Fs(e){let{store:t,options:n,element:r}=e,i=E(e),a=I(e),o=Vi(e.onDestroy),s,c,l=()=>Os(t.get()),u=()=>ws(t.get().value),d=()=>{let e=r(`root`);return Xe(e)?e:r(`input`)};function f(e,n,r,a,o=!0){if(e===u())return!1;let s=i(`value`,Ds(e,t.get().value),{reason:n,event:r,thumb:a});return s&&(a!==null&&t.set({last:a}),o&&le(d(),[`input`])),s}function p(e,n,r,i=null,o=!0){let s=t.get().value;J(e,s)||(a(`value`,s,{reason:n,event:r,thumb:i}),o&&le(d(),[`change`]))}let m=e=>r(`thumb-input`,String(e));function h(e,r,a){let o=ws(As(e,n())),s=o.reduce((e,t,n)=>ps(e,n,t,l()),o);return!J(s,u())&&i(`value`,Ds(s.slice(),t.get().value),{reason:r,event:a,thumb:null})}let g={getValue:()=>t.get().value,setValue:(e,{reason:n=`imperative`,event:r}={})=>!Cs(t.get())&&h(e,n,r),focus:(e=0)=>m(e)?.focus(),internal:{press(e,n){if(!o.accepts(e)||Cs(t.get())||s)return;let i=(r(`track`)??n).getBoundingClientRect(),a=zi(n),c=t.get().orientation===`vertical`,u=(e,t)=>Ss(xs({x:e,y:t},i,{rtl:a,vertical:c}),l()),d=e.target.closest(`[data-slot="slider-thumb"]`),f=d&&n.contains(d)?Number(d.getAttribute(`data-index`)??0):null;e.preventDefault();let p=g.internal.begin(u(e.clientX,e.clientY),f,e);m(p)?.focus({preventScroll:!0}),o.start(n,e,{onMove:e=>g.internal.move(u(e.x,e.y),e.event),onEnd:e=>g.internal.end(e)})},begin(e,n,r){let i=t.get().value,a,o,c=0;n===null?({index:a,stack:o}=gs(u(),e),a!==null&&f(ps(u(),a,e,l()),`track-press`,r,a)):(o=_s(u(),n),a=o.length>1?null:n,c=e-u()[n]);let d=a??o[0];return s={index:a,stack:o,offset:c,start:i,reason:`track-press`,event:r},t.set({active:d}),d},move(e,n){if(!s)return;let r=e-s.offset;if(s.index===null){let e=Math.sign(r-u()[s.stack[0]]);if(e===0)return;s.index=vs(s.stack,e),m(s.index)?.focus({preventScroll:!0}),t.set({active:s.index})}f(ps(u(),s.index,r,l()),`drag`,n,s.index)&&(s.reason=`drag`,s.event=n)},end(e){let n=s;s=void 0,t.set({active:null}),n&&p(n.start,n.reason,e,n.index)},adjust(e,n,r){if(t.get().readOnly)return;let i=t.get().value;f(ps(u(),e,n,l()),`accessibility-adjust`,r,e,!1),p(i,`accessibility-adjust`,r,e,!1)},keydown(e,n,r){let i=t.get();if(rt(i))return;let a=u()[n]??i.min,o=hs(e.key,{shiftKey:e.shiftKey,rtl:zi(r),orientation:i.orientation},a,ds(u(),n,l()),l());o!==null&&(e.preventDefault(),i.readOnly||(c??={start:i.value,thumb:n},c.event=e,f(ps(u(),n,o,l()),`step-key`,e,n)))},commitKeys(e){if(!c)return;let{start:t,thumb:n,event:r}=c;c=void 0,p(t,`step-key`,e??r,n)},reset(){tt(n().value,n().defaultValue)||i(`value`,t.get().initial,{reason:`reset`,thumb:null})},restore(e){let n=sa(e);n&&h(Ds(n,t.get().value),`restore`)},setFormDisabled(e){t.set({formDisabled:e})},submitted:()=>t.get().name===void 0?null:Ps(t.get()),syncInput(e,n){let{lower:r,upper:i}=ds(u(),n,l()),a=String(r),o=String(i),s=String(u()[n]??t.get().min);e.min!==a&&(e.min=a),e.max!==o&&(e.max=o),e.value!==s&&(e.value=s)}}};Qe(e,[`value`],(e,t,n)=>{let{min:r,max:i}=ks(n);if(n.value!==void 0||!(r<=i))return;let a=As(t.value,n);if(!J(a,t.value))return{value:a}});let _={value:t.get().value,thumbValues:t.get().thumbValues};return B(e,[`thumbValues`],({value:e})=>{if(!Es(nt(t).thumbValues,e))return J(e,_.value)||(_={value:e,thumbValues:Ts(e)}),{thumbValues:_.thumbValues}}),t.subscribe(()=>{s&&Cs(t.get())&&(o.cancel(),g.internal.end())}),g}var Is=Fs;function Ls(e){let t=e===null?null:sa(e);if(t)return t.length===1?t[0]:t}function Rs(e){return{value:e.value,...zs(e)}}function zs(e){return{disabled:rt(e),readOnly:e.readOnly,required:e.required,dragging:e.active!==null,orientation:e.orientation}}var Bs=(e,t)=>e.thumbValues[t]??e.min;function Vs(e){return{"data-orientation":e.orientation,"data-disabled":rt(e)?``:void 0,"data-readonly":e.readOnly?``:void 0,"data-required":e.required?``:void 0,"data-dragging":e.active===null?void 0:``}}function Hs(e,t,n){n||=0;let r=e.orientation===`vertical`;return ln({position:`absolute`,...r?{bottom:`${n}%`,left:`50%`,translate:`-50% 50%`}:{"inset-inline":`calc(${n}% - 50%) calc(50% - ${n}%)`,"margin-inline":`auto`,"justify-self":`center`,top:`50%`,translate:`0 -50%`},"z-index":e.active===t?2:e.last===t?1:void 0,"--slider-thumb-position":`${n}%`})}function Us(e){let t=Os(e),n=ws(e.value),r=n.length>1?ys(n[0],t):0,i=ys(n[n.length-1],t),a=Math.round((i-r)*1e4)/1e4,o=e.orientation===`vertical`;return ln({position:`absolute`,[o?`bottom`:`inset-inline-start`]:`${r}%`,[o?`height`:`width`]:`${a}%`,...o?{left:0,right:0}:{top:0,bottom:0},"--slider-indicator-start":`${r}%`,"--slider-indicator-size":`${a}%`})}var Ws=ln({position:`absolute`,inset:0,width:`100%`,height:`100%`,margin:0,padding:0,border:0,opacity:0,overflow:`hidden`,"clip-path":`inset(50%)`,"white-space":`nowrap`,"pointer-events":`none`}),Gs=(e,t,n)=>n===0&&e.thumbInputId||`${t}-thumb-${n}`,Ks=Se({name:`slider`,options:{value:Ls,defaultValue:Ls,onValueChange:`callback`,onValueCommit:`callback`,min:`number`,max:`number`,step:`number`,largeStep:`number`,minStepsBetweenThumbs:`number`,orientation:`string`,disabled:`boolean`,readOnly:`boolean`,required:`boolean`,name:`string`,form:`string`,format:`value`,locale:`string`,controller:`value`,thumbInputId:`string`},state:e=>{let t=As(e.value??e.defaultValue??e.min??0,e);return{...js(e),value:t,initial:As(e.defaultValue??t,e),formDisabled:!1,pageLocale:null,active:null,last:null,thumbValues:Ts(t),thumbInputId:e.thumbInputId??null}},sync:e=>({...js(e),...e.defaultValue===void 0?{}:{initial:As(e.defaultValue,e)},...e.value===void 0?{}:{value:As(e.value,e)},...e.thumbInputId===void 0?{}:{thumbInputId:e.thumbInputId}}),commits:[`value`],api:Is,slots:e=>({root:e({role:`group`,state:Rs,attrs:(e,{id:t})=>({id:e.thumbInputId&&ws(e.value).length>1?`${t}-group`:void 0,...Vs(e)}),bind:(e,{api:t,store:n})=>(ie(e,e=>n.set({pageLocale:e})),Ce(e,{value:t.internal.submitted,state:()=>Ps(n.get()),restore:t.internal.restore,valueMissing:()=>!1,message:()=>``,anchor:()=>e.querySelector(`[data-slot="slider-thumb-input"]`)??e,focus:()=>t.focus(),reset:t.internal.reset,disabled:t.internal.setFormDisabled,subscribe:n.subscribe}))}),control:e({state:Rs,attrs:e=>({...Vs(e),style:`touch-action:none`}),on:{pointerdown:(e,{api:t,el:n})=>n&&t.internal.press(e,n)}}),track:e({state:Rs,attrs:e=>({...Vs(e),style:`position:relative`})}),indicator:e({state:Rs,attrs:e=>({...Vs(e),style:Us(e)})}),thumb:e({props:{index:`number`},selects:Ye({value:[],thumbValues:({props:e})=>[String(e.index??0)],last:({props:e})=>[e.index??0]}),state:(e,{props:t})=>{let n=t.index??0,r=Bs(e,n);return{...zs(e),index:n,thumbValue:r,percent:ys(r,Os(e))}},attrs:(e,{props:t})=>{let n=t.index??0,r=ys(Bs(e,n),Os(e));return{...Vs(e),"data-index":String(n),"data-dragging":e.active===n?``:void 0,style:Hs(e,n,r)}}}),"thumb-input":e({role:`slider`,focus:`native`,keys:[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`,`shift+ArrowUp`,`shift+ArrowDown`,`shift+ArrowLeft`,`shift+ArrowRight`,`PageUp`,`PageDown`,`Home`,`End`],props:{index:{kind:`number`,from:`thumb`}},selects:Ye({value:[],thumbValues:({props:e})=>{let t=e.index??0;return[String(t-1),String(t),String(t+1)]},active:[],last:[]}),attrs:(e,{id:t,props:n})=>{let r=n.index??0,i=Bs(e,r),{lower:a,upper:o}=fs(e.thumbValues[r-1],e.thumbValues[r+1],Os(e));return{type:`range`,id:Gs(e,t,r),min:String(a),max:String(o),step:String(e.step),value:String(i),"aria-valuenow":void 0,"aria-valuetext":Ms(i,e),"aria-orientation":e.orientation,disabled:rt(e)?``:void 0,"aria-readonly":e.readOnly?`true`:void 0,"data-disabled":rt(e)?``:void 0,"data-readonly":e.readOnly?``:void 0,style:Ws}},on:{keydown:(e,{api:t,el:n,props:r})=>n&&t.internal.keydown(e,r.index??0,n),keyup:(e,{api:t})=>t.internal.commitKeys(e),focusout:(e,{api:t})=>t.internal.commitKeys(),input:(e,{api:t,el:n,props:r})=>{let i=n;t.internal.adjust(r.index??0,i.valueAsNumber,e),t.internal.syncInput(i,r.index??0)}},bind:(e,t)=>{let{api:n,props:r}=t,i=e,a=r.index??0,o=()=>n.internal.syncInput(i,a);o();let s=[ce(t,o)];return()=>s.forEach(e=>e())}}),value:e({role:`status`,state:e=>({...Rs(e),text:ws(e.value).map(t=>Ms(t,e)).join(` – `)}),attrs:(e,{id:t})=>({for:ws(e.value).map((n,r)=>Gs(e,t,r)).join(` `),"aria-live":`off`,...Vs(e)})}),input:e({attrs:e=>({type:`hidden`,name:e.name,value:Ps(e),form:e.form,disabled:e.disabled?``:void 0}),bind:(e,{api:t,store:n})=>be(e,{value:()=>Ps(n.get()),subscribe:n.subscribe,focus:()=>t.focus(),reset:t.internal.reset,disabled:t.internal.setFormDisabled})})}),agent:{actions:[`setValue`]}}),qs=l(Ks,{control:`div`,track:`div`,indicator:`div`,value:`output`}),Js=Y.createContext(null);function Ys(e){let t=Y.useContext(Js);if(!t)throw Error(`${e} must be used inside <Slider>.`);return t}function Xs(e,t){return n=>(0,X.jsxs)(X.Fragment,{children:[typeof e==`function`?e(n):e,t]})}function Zs({value:e,defaultValue:t,onValueChange:n,onValueCommit:i,min:a,max:o,step:s,largeStep:c,minStepsBetweenThumbs:l,orientation:u,disabled:d,readOnly:f,required:p,name:m,form:h,format:_,locale:y,controller:b,debug:x,render:S,children:C,...w}){let T=Ze(),E=z(),D=g(Ks,{value:e,defaultValue:t,onValueChange:n,onValueCommit:i,min:a,max:o,step:s,largeStep:c,minStepsBetweenThumbs:l,orientation:u,disabled:d||T?.disabled,readOnly:f,required:p,name:m??T?.name,form:h,format:_,locale:y,controller:b,debug:x,thumbInputId:E}),O=e??t,k=Array.isArray(O)&&O.length>1,A=Y.useMemo(()=>v(D,{field:k?null:T}),[D,k,T]),j={...w,children:Xs(C,(0,X.jsx)(Qs,{})),render:r(k?T:null,`div`,S)};return(0,X.jsx)(Js.Provider,{value:A,children:G(D,`root`,{},j)})}function Qs(){return G(Ks,`input`,{},{},`input`)}var $s=qs.Control,ec=qs.Track,tc=qs.Indicator;function nc({index:e=0,children:t,"aria-label":n,"aria-labelledby":r,"aria-describedby":i,...a}){let o={index:e,id:String(e)},s=(0,X.jsx)(rc,{...o,"aria-label":n,"aria-labelledby":r,"aria-describedby":i});return G(Ks,`thumb`,o,{...a,children:Xs(t,s)})}function rc({index:e,id:t,...n}){let{field:r}=Ys(`SliderThumb`),i=e=>{let{value:t,...n}=r?r.props(e):e;return(0,X.jsx)(`input`,{...n,defaultValue:t})};return G(Ks,`thumb-input`,{index:e,id:t},{...n,render:i},`input`)}function ic({className:e,thumbLabel:t,...n}){return(0,X.jsx)(Zs,{"data-slot":`slider`,className:j(`w-full touch-none select-none`,e),...n,children:(0,X.jsx)($s,{className:`flex h-5 w-full items-center`,children:(0,X.jsxs)(ec,{className:`relative h-1 w-full rounded-full bg-muted`,children:[(0,X.jsx)(tc,{className:`h-full rounded-full bg-border-strong`}),(0,X.jsx)(nc,{"aria-label":t,className:`size-3.5 rounded-full border border-border-strong bg-background shadow-sm has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring`})]})})})}function ac(e){let t=(0,Z.c)(16),{label:n,icon:r,disabled:i,onClick:a,shortcut:o}=e,s=i||void 0,c=i?void 0:a,l;t[0]!==n||t[1]!==o||t[2]!==s||t[3]!==c?(l=(0,X.jsx)(H,{size:`icon-sm`,variant:`ghost`,"aria-label":n,"aria-keyshortcuts":o,"aria-disabled":s,className:`aria-disabled:cursor-default aria-disabled:hover:bg-transparent`,onClick:c}),t[0]=n,t[1]=o,t[2]=s,t[3]=c,t[4]=l):l=t[4];let u;t[5]!==r||t[6]!==l?(u=(0,X.jsx)(x,{render:l,children:r}),t[5]=r,t[6]=l,t[7]=u):u=t[7];let d;t[8]===o?d=t[9]:(d=o&&(0,X.jsx)(sn,{children:o}),t[8]=o,t[9]=d);let f;t[10]!==n||t[11]!==d?(f=(0,X.jsxs)(He,{children:[n,d]}),t[10]=n,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==u||t[14]!==f?(p=(0,X.jsxs)(C,{children:[u,f]}),t[13]=u,t[14]=f,t[15]=p):p=t[15],p}function oc(e){let t=(0,Z.c)(6),{label:n,heading:r,children:i}=e,a;t[0]===r?a=t[1]:(a=(0,X.jsx)(`div`,{className:`flex min-h-8 items-center gap-2 border-b bg-muted/50 px-3 py-1 text-caption text-muted-foreground`,children:r}),t[0]=r,t[1]=a);let o;return t[2]!==i||t[3]!==n||t[4]!==a?(o=(0,X.jsxs)(`section`,{"aria-label":n,className:`min-w-0 overflow-hidden rounded-md border`,children:[a,i]}),t[2]=i,t[3]=n,t[4]=a,t[5]=o):o=t[5],o}function sc(e){let t=(0,Z.c)(17),{scope:n,context:r,run:i,item:a,className:o,style:s,opened:c,framed:l}=e,u=c!==void 0&&c,d=l===void 0||l,f;t[0]!==r||t[1]!==a.assetId||t[2]!==i.id||t[3]!==n?(f={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]=f):f=t[4];let{url:p,retry:m}=No(f);if(ze(p)){let e;return t[5]!==o||t[6]!==s||t[7]!==p.value?(e=(0,X.jsx)(`img`,{src:p.value,alt:``,loading:`lazy`,decoding:`async`,className:o,style:s}),t[5]=o,t[6]=s,t[7]=p.value,t[8]=e):e=t[8],e}let h;t[9]===p?h=t[10]:(h=me(p)&&!p.waiting,t[9]=p,t[10]=h);let g=h;if(!u){let e;return t[11]!==g||t[12]!==d?(e=d?(0,X.jsx)(`span`,{role:g?`alert`:void 0,className:`grid aspect-video w-full place-items-center rounded-sm border bg-muted px-3 text-center text-caption text-muted-foreground`,children:g?`This screenshot could not be loaded.`:(0,X.jsx)(y,{label:`Reading the screenshot`})}):null,t[11]=g,t[12]=d,t[13]=e):e=t[13],e}if(g){let e;return t[14]===m?e=t[15]:(e=(0,X.jsx)(L,{role:`alert`,message:`This screenshot could not be loaded.`,action:(0,X.jsx)(H,{variant:`outline`,size:`sm`,onClick:m,children:`Try again`})}),t[14]=m,t[15]=e),e}let _;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(`div`,{className:`grid min-h-48 place-items-center`,children:(0,X.jsx)(y,{label:`Reading the screenshot`})}),t[16]=_):_=t[16],_}function cc(e){let t=(0,Z.c)(11),{scope:n,context:r,run:i,items:a}=e,o;if(t[0]!==r||t[1]!==a||t[2]!==i||t[3]!==n){let e;t[5]!==r||t[6]!==i||t[7]!==n?(e=(e,t)=>(0,X.jsx)(sc,{scope:n,context:r,run:i,item:e,framed:!1,className:`h-12 w-auto max-w-20 rounded-sm border object-cover object-top`},t),t[5]=r,t[6]=i,t[7]=n,t[8]=e):e=t[8],o=a.map(e),t[0]=r,t[1]=a,t[2]=i,t[3]=n,t[4]=o}else o=t[4];let s;return t[9]===o?s=t[10]:(s=(0,X.jsx)(`span`,{"aria-hidden":!0,className:`flex shrink-0 gap-1.5`,children:o}),t[9]=o,t[10]=s),s}function lc(e){let t=(0,Z.c)(7),{item:n}=e,r;t[0]===n.label?r=t[1]:(r=(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:n.label}),t[0]=n.label,t[1]=r);let i;t[2]===n.shows?i=t[3]:(i=(0,X.jsx)($,{text:n.shows}),t[2]=n.shows,t[3]=i);let a;return t[4]!==r||t[5]!==i?(a=(0,X.jsxs)(`span`,{className:`text-caption text-muted-foreground`,children:[r,` `,i]}),t[4]=r,t[5]=i,t[6]=a):a=t[6],a}function uc(e){let t=(0,Z.c)(9),{source:n,items:r,onEnlarge:i}=e,a;if(t[0]!==r||t[1]!==i||t[2]!==n){let e;t[4]!==i||t[5]!==n?(e=(e,t)=>(0,X.jsxs)(`button`,{type:`button`,"aria-label":e.enlarge,onClick:()=>i(t),className:`group flex min-w-0 flex-col gap-1.5 text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,X.jsx)(sc,{...n,item:e,className:`max-h-80 w-auto max-w-full self-start rounded-sm border group-hover:opacity-90`}),(0,X.jsx)(lc,{item:e})]},t),t[4]=i,t[5]=n,t[6]=e):e=t[6],a=r.map(e),t[0]=r,t[1]=i,t[2]=n,t[3]=a}else a=t[3];let o;return t[7]===a?o=t[8]:(o=(0,X.jsx)(`div`,{className:`grid grid-cols-2 gap-3 p-3`,children:a}),t[7]=a,t[8]=o),o}function dc(e){let t=(0,Z.c)(33),{source:n,before:r,after:i}=e,[a,o]=(0,Y.useState)(50),s;t[0]!==r||t[1]!==n?(s=(0,X.jsx)(sc,{...n,item:r,className:`block w-full`}),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=`inset(0 0 0 ${a}%)`,l;t[3]===c?l=t[4]:(l={clipPath:c},t[3]=c,t[4]=l);let u;t[5]!==i||t[6]!==n||t[7]!==l?(u=(0,X.jsx)(sc,{...n,item:i,framed:!1,className:`absolute inset-0 size-full object-contain object-left-top`,style:l}),t[5]=i,t[6]=n,t[7]=l,t[8]=u):u=t[8];let d=`${a}%`,f;t[9]===d?f=t[10]:(f=(0,X.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-y-0 w-px bg-foreground/60`,style:{left:d}}),t[9]=d,t[10]=f);let p;t[11]!==s||t[12]!==u||t[13]!==f?(p=(0,X.jsxs)(`div`,{className:`relative mx-auto w-full max-w-56 overflow-hidden rounded-sm border bg-muted`,children:[s,u,f]}),t[11]=s,t[12]=u,t[13]=f,t[14]=p):p=t[14];let m;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(`span`,{children:`Before`}),t[15]=m):m=t[15];let h;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>o(typeof e==`number`?e:50),t[16]=h):h=t[16];let g;t[17]===a?g=t[18]:(g=(0,X.jsx)(ic,{value:a,onValueChange:h,thumbLabel:`Divide before and after`}),t[17]=a,t[18]=g);let _;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(`span`,{children:`After`}),t[19]=_):_=t[19];let v;t[20]===g?v=t[21]:(v=(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-sm items-center gap-3 text-caption text-muted-foreground`,children:[m,g,_]}),t[20]=g,t[21]=v);let y;t[22]===r?y=t[23]:(y=(0,X.jsx)(lc,{item:r}),t[22]=r,t[23]=y);let b;t[24]===i?b=t[25]:(b=(0,X.jsx)(lc,{item:i}),t[24]=i,t[25]=b);let x;t[26]!==y||t[27]!==b?(x=(0,X.jsxs)(`div`,{className:`mx-auto grid w-full max-w-sm grid-cols-2 gap-3`,children:[y,b]}),t[26]=y,t[27]=b,t[28]=x):x=t[28];let S;return t[29]!==v||t[30]!==x||t[31]!==p?(S=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 p-3`,children:[p,v,x]}),t[29]=v,t[30]=x,t[31]=p,t[32]=S):S=t[32],S}function fc(e){let t=(0,Z.c)(41),{scope:n,context:r,run:i,items:a}=e,[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(`side`),u=o===null?void 0:a[o],d;t[0]!==r||t[1]!==i||t[2]!==n?(d={scope:n,context:r,run:i},t[0]=r,t[1]=i,t[2]=n,t[3]=d):d=t[3];let f=d,[p,m]=a,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(`span`,{className:`flex-1`,children:`Before and after`}),t[4]=h):h=t[4];let g;t[5]!==m||t[6]!==p||t[7]!==c?(g=p&&m&&(0,X.jsx)(hi,{value:c,onValueChange:e=>l(e===`overlay`?`overlay`:`side`),children:(0,X.jsxs)(Mi,{"aria-label":`Compare`,className:`h-6!`,children:[(0,X.jsx)(Oi,{value:`side`,children:`Side by side`}),(0,X.jsx)(Oi,{value:`overlay`,children:`Slider`})]})}),t[5]=m,t[6]=p,t[7]=c,t[8]=g):g=t[8];let _;t[9]===g?_=t[10]:(_=(0,X.jsxs)(X.Fragment,{children:[h,g]}),t[9]=g,t[10]=_);let v;t[11]!==m||t[12]!==p||t[13]!==a||t[14]!==c||t[15]!==f?(v=c===`overlay`&&p&&m?(0,X.jsx)(dc,{source:f,before:p,after:m}):(0,X.jsx)(uc,{source:f,items:a,onEnlarge:s}),t[11]=m,t[12]=p,t[13]=a,t[14]=c,t[15]=f,t[16]=v):v=t[16];let y;t[17]!==_||t[18]!==v?(y=(0,X.jsx)(oc,{label:`Before and after`,heading:_,children:v}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let b=u!==void 0,x;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{e||s(null)},t[20]=x):x=t[20];let S;t[21]===u?S=t[22]:(S=u&&(0,X.jsxs)(X.Fragment,{children:[u.label,` · `,(0,X.jsx)($,{text:u.shows})]}),t[21]=u,t[22]=S);let C;t[23]===S?C=t[24]:(C=(0,X.jsx)(qr,{children:S}),t[23]=S,t[24]=C);let w;t[25]!==u||t[26]!==f?(w=u&&(0,X.jsx)(sc,{...f,item:u,className:`mx-auto max-h-[72vh] rounded-lg border`,opened:!0}),t[25]=u,t[26]=f,t[27]=w):w=t[27];let T;t[28]!==a.length||t[29]!==o?(T=a.length>1&&o!==null&&(0,X.jsxs)(`div`,{className:`flex items-center justify-center gap-3 text-caption text-muted-foreground`,children:[(0,X.jsx)(ac,{label:`Previous screenshot`,icon:(0,X.jsx)(la,{}),disabled:o===0,onClick:()=>s(o-1)}),o+1,` of `,a.length,(0,X.jsx)(ac,{label:`Next screenshot`,icon:(0,X.jsx)(ue,{}),disabled:o===a.length-1,onClick:()=>s(o+1)})]}),t[28]=a.length,t[29]=o,t[30]=T):T=t[30];let E;t[31]!==C||t[32]!==w||t[33]!==T?(E=(0,X.jsxs)(ir,{className:`max-h-[92vh] overflow-auto sm:max-w-[min(92vw,52rem)]`,children:[C,w,T]}),t[31]=C,t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]!==E||t[36]!==b?(D=(0,X.jsx)(yr,{open:b,onOpenChange:x,children:E}),t[35]=E,t[36]=b,t[37]=D):D=t[37];let O;return t[38]!==D||t[39]!==y?(O=(0,X.jsxs)(X.Fragment,{children:[y,D]}),t[38]=D,t[39]=y,t[40]=O):O=t[40],O}var pc=52;function mc(e,t=`smooth`){let n=document.getElementById(e),r=n?.closest(`[data-review-scroll]`);if(!n||!r)return;let i=e.startsWith(`walkthrough-`)?pc:16;r.scrollTo({top:r.scrollTop+n.getBoundingClientRect().top-r.getBoundingClientRect().top-i,behavior:t})}var hc=e=>`walkthrough-step-${e}`,gc=(e,t)=>`walkthrough-call-${e}-${t}`;function _c(e){let t=(0,Z.c)(10),{label:n,detail:r,children:i}=e,a;t[0]===r?a=t[1]:(a=r&&(0,X.jsx)(`span`,{className:`tabular-nums`,children:r}),t[0]=r,t[1]=a);let o;t[2]!==n||t[3]!==a?(o=(0,X.jsxs)(`dt`,{className:`flex flex-col pt-1 text-caption text-muted-foreground`,children:[n,a]}),t[2]=n,t[3]=a,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=(0,X.jsx)(`dd`,{className:`flex min-w-0 flex-col`,children:i}),t[5]=i,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,X.jsxs)(`div`,{className:`grid gap-x-4 gap-y-1 border-t py-2.5 first:border-t-0 @xl:grid-cols-[7rem_minmax(0,1fr)]`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function vc(e){let t=(0,Z.c)(11),{onClick:n,target:r,centered:i,children:a}=e,o=i!==void 0&&i?`items-center`:`items-baseline`,s;t[0]===o?s=t[1]:(s=j(`-mx-2 flex min-h-7 gap-2 rounded-md px-2 py-1 text-left text-ui hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring`,o),t[0]=o,t[1]=s);let c;t[2]===a?c=t[3]:(c=(0,X.jsx)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:a}),t[2]=a,t[3]=c);let l;t[4]===r?l=t[5]:(l=(0,X.jsx)(`span`,{className:`shrink-0 text-caption text-muted-foreground`,children:r}),t[4]=r,t[5]=l);let u;return t[6]!==n||t[7]!==s||t[8]!==c||t[9]!==l?(u=(0,X.jsxs)(`button`,{type:`button`,onClick:n,className:s,children:[c,l]}),t[6]=n,t[7]=s,t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function yc(e){let t=(0,Z.c)(8),{content:n,decisions:r,onJump:i}=e,a,o;if(t[0]!==n||t[1]!==r||t[2]!==i){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=wt(n,r);if(e.length===0){let e;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`p`,{className:`py-1 text-ui text-muted-foreground`,children:`Nothing needs your decision.`}),t[5]=e):e=t[5],o=e;break bb0}let s;t[6]===i?s=t[7]:(s=e=>{let{attention:t,stop:n,step:r,callIndex:a,decided:o,state:s}=e;return(0,X.jsx)(vc,{target:`Step ${r}`,onClick:()=>i(gc(r,a)),children:(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5 @md:flex-row @md:items-baseline @md:gap-2`,children:[(0,X.jsxs)(`span`,{className:j(`flex shrink-0 items-baseline gap-1 text-caption @md:w-28`,s===`decided`?`text-muted-foreground`:`text-warn`),children:[s===`decided`&&(0,X.jsx)(R,{role:`img`,"aria-label":ft(s,``),className:`size-3 shrink-0 self-center text-add-fg`}),s===`needs-commit`&&(0,X.jsx)(En,{role:`img`,"aria-label":ft(s,``),className:`size-3 shrink-0 self-center`}),pn(t)]}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,X.jsxs)(`span`,{className:`font-medium text-pretty`,children:[(0,X.jsx)($,{text:t.question}),o?.option&&(0,X.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[` `,`· `,o.option]})]}),s===`needs-commit`&&(0,X.jsx)(`span`,{className:`text-caption text-warn`,children:`Needs a new commit: this change does not do this yet.`}),(0,X.jsx)(`span`,{className:`text-pretty text-foreground-2`,children:(0,X.jsx)($,{text:n.explanation})})]})]})},`${r}:${a}`)},t[6]=i,t[7]=s),a=e.map(s)}t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o}else a=t[3],o=t[4];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function bc(e){let t=(0,Z.c)(9),{name:n,pull:r}=e;if(!r){let e;return t[0]===n?e=t[1]:(e=(0,X.jsx)(`span`,{children:n}),t[0]=n,t[1]=e),e}let i=`Open on #${r.number}`,a;t[2]!==n||t[3]!==r?(a=()=>r.openCheck(n),t[2]=n,t[3]=r,t[4]=a):a=t[4];let o;return t[5]!==n||t[6]!==i||t[7]!==a?(o=(0,X.jsx)(`button`,{type:`button`,title:i,onClick:a,className:`rounded-sm underline decoration-border underline-offset-2 hover:decoration-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:n}),t[5]=n,t[6]=i,t[7]=a,t[8]=o):o=t[8],o}function xc({names:e,pull:t}){return e.map((n,r)=>(0,X.jsxs)(`span`,{children:[(0,X.jsxs)(`span`,{className:`whitespace-nowrap`,children:[(0,X.jsx)(bc,{name:n,pull:t}),r<e.length-1&&(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`,`})]}),r<e.length-1&&` `]},`${n}:${r}`))}function Sc(e){return e.stops.flatMap((e,t)=>e.blocks.flatMap(e=>e.kind===`checks`?[{block:e,step:t+1}]:[]))}function Cc(e){let t=(0,Z.c)(6),{step:n,onJump:r}=e,i;t[0]!==r||t[1]!==n?(i=()=>r(hc(n)),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a;return t[3]!==n||t[4]!==i?(a=(0,X.jsxs)(`button`,{type:`button`,onClick:i,className:`shrink-0 rounded-sm text-caption leading-5 text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[`Step `,n]}),t[3]=n,t[4]=i,t[5]=a):a=t[5],a}function wc(e){let t=(0,Z.c)(41),{block:n,step:r,pull:i,onJump:a}=e,o,s,c;t[0]===n.checks?(o=t[1],s=t[2],c=t[3]):(s=ci(n.checks),o=wa(s,si(n.checks.state).tone),c=Ta(o),t[0]=n.checks,t[1]=o,t[2]=s,t[3]=c);let l=c,u=i?.status,d;t[4]!==n.checks||t[5]!==u?(d=mi(n.checks,u),t[4]=n.checks,t[5]=u,t[6]=d):d=t[6];let f=d,p=i?.detail?.headSha,m;t[7]!==n.checks.headOid||t[8]!==p?(m=xa(p,n.checks.headOid),t[7]=n.checks.headOid,t[8]=p,t[9]=m):m=t[9];let h=m,g;t[10]!==o.names||t[11]!==i?(g=(0,X.jsx)(xc,{names:o.names,pull:i}),t[10]=o.names,t[11]=i,t[12]=g):g=t[12];let _;t[13]===l?_=t[14]:(_=l&&(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:l}),t[13]=l,t[14]=_);let v;t[15]!==g||t[16]!==_?(v=(0,X.jsxs)(X.Fragment,{children:[g,_]}),t[15]=g,t[16]=_,t[17]=v):v=t[17];let y=v,b;t[18]===f.tone?b=t[19]:(b=(0,X.jsx)(`span`,{className:`flex h-5 shrink-0 items-center`,children:(0,X.jsx)(zn,{tone:f.tone})}),t[18]=f.tone,t[19]=b);let x;t[20]!==o.names.length||t[21]!==f.label||t[22]!==f.names||t[23]!==f.note||t[24]!==y||t[25]!==i||t[26]!==s?(x=f.note?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{children:[f.label,f.names.length>0&&(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`: `}),(0,X.jsx)(xc,{names:f.names,pull:i})]}),(0,X.jsxs)(`span`,{className:`text-caption text-muted-foreground`,children:[(0,X.jsx)(ls,{label:f.note}),o.names.length>0&&`: `,y]})]}):(0,X.jsxs)(`span`,{children:[(0,X.jsx)(ls,{label:s.label}),o.names.length>0&&(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`: `}),y]}),t[20]=o.names.length,t[21]=f.label,t[22]=f.names,t[23]=f.note,t[24]=y,t[25]=i,t[26]=s,t[27]=x):x=t[27];let S;t[28]!==h||t[29]!==i?(S=h&&i&&(0,X.jsxs)(`span`,{className:`text-caption text-warn`,children:[`#`,i.number,` is now at `,(0,X.jsx)(`span`,{className:`font-mono`,children:h})]}),t[28]=h,t[29]=i,t[30]=S):S=t[30];let C;t[31]!==x||t[32]!==S?(C=(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5 text-pretty`,children:[x,S]}),t[31]=x,t[32]=S,t[33]=C):C=t[33];let w;t[34]!==a||t[35]!==r?(w=(0,X.jsx)(Cc,{step:r,onJump:a}),t[34]=a,t[35]=r,t[36]=w):w=t[36];let T;return t[37]!==C||t[38]!==w||t[39]!==b?(T=(0,X.jsxs)(`div`,{className:`flex min-h-7 items-start gap-2 py-1 text-ui`,children:[b,C,w]}),t[37]=C,t[38]=w,t[39]=b,t[40]=T):T=t[40],T}function Tc(e){let t=(0,Z.c)(35),{run:n,content:r,owner:i,pull:a,checks:o,onJump:s}=e,c,l,u,d;if(t[0]!==o||t[1]!==r.stops||t[2]!==s||t[3]!==i||t[4]!==a||t[5]!==n){l=r.stops.flatMap(Ec);let e;if(t[10]===n?e=t[11]:(e=ri(n),t[10]=n,t[11]=e),c=e,t[12]!==o||t[13]!==s||t[14]!==a){let e;t[16]!==s||t[17]!==a?(e=e=>{let{block:t,step:n}=e;return(0,X.jsx)(wc,{block:t,step:n,pull:a,onJump:s},`checks:${n}`)},t[16]=s,t[17]=a,t[18]=e):e=t[18],u=o.map(e),t[12]=o,t[13]=s,t[14]=a,t[15]=u}else u=t[15];let f;t[19]!==s||t[20]!==i||t[21]!==n?(f=(e,t)=>{let{step:r,block:a}=e;return(0,X.jsx)(vc,{target:`Step ${r}`,centered:!0,onClick:()=>s(hc(r)),children:(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,X.jsx)(cc,{scope:i.scope,context:i.context,run:n,items:a.screenshots}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,X.jsx)(`span`,{className:`text-pretty`,children:(0,X.jsx)($,{text:Wt(a.screenshots)})}),(0,X.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:`Shown in the before and after screenshots`})]})]})},`images:${r}:${t}`)},t[19]=s,t[20]=i,t[21]=n,t[22]=f):f=t[22],d=l.map(f),t[0]=o,t[1]=r.stops,t[2]=s,t[3]=i,t[4]=a,t[5]=n,t[6]=c,t[7]=l,t[8]=u,t[9]=d}else c=t[6],l=t[7],u=t[8],d=t[9];let f;t[23]===c?f=t[24]:(f=c&&(0,X.jsx)(`p`,{className:`py-1 text-ui text-muted-foreground`,children:c}),t[23]=c,t[24]=f);let p;t[25]!==o.length||t[26]!==c||t[27]!==l||t[28]!==n?(p=!c&&o.length===0&&l.length===0&&(0,X.jsxs)(`p`,{className:`py-1 text-ui text-muted-foreground`,children:[`No checks or screenshots were captured for`,` `,(0,X.jsx)(`span`,{className:`font-mono`,children:n.headOid.slice(0,7)}),`.`]}),t[25]=o.length,t[26]=c,t[27]=l,t[28]=n,t[29]=p):p=t[29];let m;return t[30]!==u||t[31]!==d||t[32]!==f||t[33]!==p?(m=(0,X.jsxs)(X.Fragment,{children:[u,d,f,p]}),t[30]=u,t[31]=d,t[32]=f,t[33]=p,t[34]=m):m=t[34],m}function Ec(e,t){return e.blocks.flatMap(e=>e.kind===`images`?[{step:t+1,block:e}]:[])}var Dc=e=>e.stops.some(e=>e.blocks.some(e=>e.kind===`images`));function Oc(e){let t=(0,Z.c)(3),{label:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,X.jsx)(`dl`,{"aria-label":n,className:`flex flex-col rounded-lg border px-4 py-1`,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function kc(e){let t=(0,Z.c)(49),{run:n,content:r,owner:i,pull:a,onJump:o,notSaid:s,comments:c,scope:l}=e,{view:u}=Ko(i),d=u?.decisions,f;t[0]!==r||t[1]!==d?(f=At(r,d),t[0]=r,t[1]=d,t[2]=f):f=t[2];let p=f,m,h,g,_,v,y,b;if(t[3]!==r||t[4]!==o||t[5]!==p.decided||t[6]!==p.total||t[7]!==a||t[8]!==l||t[9]!==u?.decisions){let e=Sc(r);({changed:h,unchanged:b}=Ri(e.map(Ac),a?.status)),g=l?yn({...l,pullRequest:a?.number,checkedCommit:e[0]?.block.checks.headOid}):void 0,m=Oc,_=`Before you merge`;let n=p.total===1?`Your call`:`Your calls`,i=p.total===0?void 0:`${p.decided} of ${p.total} decided`,s=u?.decisions,c;t[17]!==r||t[18]!==o||t[19]!==s?(c=(0,X.jsx)(yc,{content:r,decisions:s,onJump:o}),t[17]=r,t[18]=o,t[19]=s,t[20]=c):c=t[20],t[21]!==n||t[22]!==i||t[23]!==c?(v=(0,X.jsx)(_c,{label:n,detail:i,children:c}),t[21]=n,t[22]=i,t[23]=c,t[24]=v):v=t[24],y=h.length>0&&(0,X.jsx)(_c,{label:`Checks`,children:h.map(e=>{let{block:t,step:n}=e;return(0,X.jsx)(wc,{block:t,step:n,pull:a,onJump:o},`checks:${n}`)})}),t[3]=r,t[4]=o,t[5]=p.decided,t[6]=p.total,t[7]=a,t[8]=l,t[9]=u?.decisions,t[10]=m,t[11]=h,t[12]=g,t[13]=_,t[14]=v,t[15]=y,t[16]=b}else m=t[10],h=t[11],g=t[12],_=t[13],v=t[14],y=t[15],b=t[16];let x;t[25]!==h||t[26]!==r||t[27]!==o||t[28]!==i||t[29]!==a||t[30]!==n||t[31]!==b?(x=(b.length>0||h.length===0||Dc(r))&&(0,X.jsx)(_c,{label:`Verified`,children:(0,X.jsx)(Tc,{run:n,content:r,owner:i,pull:a,checks:b,onJump:o})}),t[25]=h,t[26]=r,t[27]=o,t[28]=i,t[29]=a,t[30]=n,t[31]=b,t[32]=x):x=t[32];let S;t[33]!==g||t[34]!==o?(S=(g?.uncommitted||g?.uncovered)&&(0,X.jsxs)(_c,{label:`Scope`,children:[g.uncommitted&&(0,X.jsx)(`p`,{className:`py-1 text-ui text-pretty`,children:g.uncommitted}),g.uncovered&&(0,X.jsx)(vc,{target:`Below the steps`,onClick:()=>o(`review-not-covered`),children:(0,X.jsx)(`span`,{className:`min-w-0 text-pretty`,children:g.uncovered})})]}),t[33]=g,t[34]=o,t[35]=S):S=t[35];let C;t[36]===s?C=t[37]:(C=s&&(0,X.jsx)(_c,{label:`Not verified`,children:s}),t[36]=s,t[37]=C);let w;t[38]===c?w=t[39]:(w=c&&(0,X.jsx)(_c,{label:`Comments`,children:c}),t[38]=c,t[39]=w);let T;return t[40]!==m||t[41]!==_||t[42]!==v||t[43]!==y||t[44]!==x||t[45]!==S||t[46]!==C||t[47]!==w?(T=(0,X.jsxs)(m,{label:_,children:[v,y,x,S,C,w]}),t[40]=m,t[41]=_,t[42]=v,t[43]=y,t[44]=x,t[45]=S,t[46]=C,t[47]=w,t[48]=T):T=t[48],T}function Ac(e){return{...e,checks:e.block.checks}}function jc(e,t){let n=Cn(e,[t.span],3,t.side);if(n)try{return St(n,{throwOnError:!0})}catch{return}}function Mc(e){let t=0,n=0,r=!1;for(let i of e.split(`
2
2
  `))if(i.startsWith(`@@`))r=!0;else if(r)i.startsWith(`+`)?t+=1:i.startsWith(`-`)&&(n+=1);else continue;return t+n===0?void 0:{additions:t,deletions:n}}function Nc(e,t,n){n.kind===`file`?e.onOpen({kind:`file`,path:t}):n.kind===`branch`?e.onOpen({kind:`branch-file`,path:t}):e.onOpen({kind:`change`,path:t},n.change?{path:t,entry:_n(n.change)}:void 0)}function Pc(e,t,n,r){let i=(0,Z.c)(15),a=Wr(e,t,n).result,o,s,l,u,d,f;if(i[0]!==a||i[1]!==t||i[2]!==r||i[3]!==e){let n=c(q(a)),p;i[10]===r?p=i[11]:(p=e=>r.includes(e.path),i[10]=r,i[11]=p),o=(n?.files??[]).filter(p),s=qn,l=e,u=t,d=n?Pt(n):null,f=o.map(Lt),i[0]=a,i[1]=t,i[2]=r,i[3]=e,i[4]=o,i[5]=s,i[6]=l,i[7]=u,i[8]=d,i[9]=f}else o=i[4],s=i[5],l=i[6],u=i[7],d=i[8],f=i[9];let p=s(l,u,d,f),m;return i[12]!==o||i[13]!==p?(m=e=>{let t=o.find(t=>t.path===e);if(!t)return;let n=p.patches.get(Lt(t).join(`\0`));return n?.kind===`text`?Mc(n.patch):void 0},i[12]=o,i[13]=p,i[14]=m):m=i[14],m}function Fc(e,t){let n=(0,Z.c)(23),r=Wr(e.scope,e.context.connection,e.base).result,i=Qn(e.scope,e.context.connection),a;n[0]===r?a=n[1]:(a=c(q(r)),n[0]=r,n[1]=a);let o=a?.files,s;n[2]===r?s=n[3]:(s=me(r),n[2]=r,n[3]=s);let l;n[4]!==o||n[5]!==s||n[6]!==i.changes?(l={branch:o,branchFailed:s,worktree:i.changes},n[4]=o,n[5]=s,n[6]=i.changes,n[7]=l):l=n[7];let u=l,d;n[8]!==e.interaction.hidden||n[9]!==t?(d=e.interaction.hidden===!0?[]:t,n[8]=e.interaction.hidden,n[9]=t,n[10]=d):d=n[10];let f=Pc(e.scope,e.context.connection,e.base,d),p;n[11]===u?p=n[12]:(p=e=>Ha(u,e),n[11]=u,n[12]=p);let m;n[13]===i.changes?m=n[14]:(m=e=>i.changes.some(t=>t.path===e),n[13]=i.changes,n[14]=m);let h;n[15]!==e||n[16]!==u?(h=t=>{let n=Ha(u,t);n&&Nc(e,t,n)},n[15]=e,n[16]=u,n[17]=h):h=n[17];let g;return n[18]!==f||n[19]!==p||n[20]!==m||n[21]!==h?(g={opening:p,size:f,uncommitted:m,open:h},n[18]=f,n[19]=p,n[20]=m,n[21]=h,n[22]=g):g=n[22],g}function Ic(e){let t=(0,Z.c)(44),{document:n,runId:r,step:i,excerpt:a}=e,{result:o,retry:s}=Po(n.scope,n.context,r,i,a.position,a.node),{dark:c}=Pi(),{preferences:l}=gi(),u;t[0]!==n.context||t[1]!==n.scope?(u={scope:n.scope,context:n.context},t[0]=n.context,t[1]=n.scope,t[2]=u):u=t[2];let d=u,{view:f}=In(d),[p,m]=(0,Y.useState)();if(ve(o)){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`px-3 py-2`,children:(0,X.jsx)(y,{label:`Loading captured lines`})}),t[3]=e):e=t[3],e}if(me(o)){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`p`,{children:`The captured diff could not be read.`}),t[4]=e):e=t[4];let n;return t[5]===s?n=t[6]:(n=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-2 text-ui`,role:`alert`,children:[e,(0,X.jsx)(H,{size:`sm`,variant:`outline`,onClick:s,children:`Try again`})]}),t[5]=s,t[6]=n),n}let h=o.value,g;t[7]!==h.capturedPatch||t[8]!==h.capturedRunId||t[9]!==h.walkthrough?.id||t[10]!==a||t[11]!==r?(g=(h.capturedRunId??h.walkthrough?.id)===r&&h.capturedPatch?jc(h.capturedPatch,a):void 0,t[7]=h.capturedPatch,t[8]=h.capturedRunId,t[9]=h.walkthrough?.id,t[10]=a,t[11]=r,t[12]=g):g=t[12];let _=g;if(!_){let e;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`p`,{children:`These lines are unavailable in the saved walkthrough.`}),t[13]=e):e=t[13];let r;return t[14]!==n||t[15]!==i?(r=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-2 text-ui`,children:[e,(0,X.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>n.onOpen({kind:`walkthrough-step`,step:i}),children:`Open step code`})]}),t[14]=n,t[15]=i,t[16]=r):r=t[16],r}let v=a.side===`old`?`deletions`:`additions`,b,x,S;if(t[17]!==p||t[18]!==a.path||t[19]!==_||t[20]!==f?.comments){let e=new Map,n=(t,n)=>{let r=`${t}:${n}`,i=e.get(r)??{side:t,line:n,drafts:[]};return e.set(r,i),i};for(let e of f?.comments??[]){let t=e.anchor;e.publication.status===`draft`&&t.kind===`lines`&&t.path===a.path&&n(t.side,t.end).drafts.push(e)}p&&n(p.side,p.end),b=ya,x=_,S=[...e.values()].map(Lc),t[17]=p,t[18]=a.path,t[19]=_,t[20]=f?.comments,t[21]=b,t[22]=x,t[23]=S}else b=t[21],x=t[22],S=t[23];let C;t[24]!==p||t[25]!==a.path||t[26]!==_||t[27]!==d?(C=e=>{let t=e.metadata,n=p?.side===t.side&&p.end===t.line;return(0,X.jsx)(Ar,{owner:d,drafts:t.drafts,anchor:n?{kind:`lines`,path:a.path,...p,text:$n(_,p)}:void 0,composing:n,onClose:()=>m(void 0),className:`mx-3 my-2`})},t[24]=p,t[25]=a.path,t[26]=_,t[27]=d,t[28]=C):C=t[28];let w=c?`dark`:`light`,T;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(T=e=>m(Jn(e)),t[29]=T):T=t[29];let E;t[30]!==l.lineOverflow||t[31]!==w?(E={preferredHighlighter:vi,theme:Ti,themeType:w,overflow:l.lineOverflow,disableFileHeader:!0,unsafeCSS:`${Ai}${Di}${Si}`,diffStyle:`unified`,enableGutterUtility:!0,onGutterUtilityClick:T},t[30]=l.lineOverflow,t[31]=w,t[32]=E):E=t[32];let D;t[33]!==a.end||t[34]!==a.start||t[35]!==v?(D={start:a.start,end:a.end,side:v,endSide:v},t[33]=a.end,t[34]=a.start,t[35]=v,t[36]=D):D=t[36];let O;return t[37]!==b||t[38]!==x||t[39]!==S||t[40]!==C||t[41]!==E||t[42]!==D?(O=(0,X.jsx)(b,{fileDiff:x,lineAnnotations:S,renderAnnotation:C,options:E,selectedLines:D}),t[37]=b,t[38]=x,t[39]=S,t[40]=C,t[41]=E,t[42]=D,t[43]=O):O=t[43],O}function Lc(e){return{side:e.side,lineNumber:e.line,metadata:e}}function Rc(e){let t=(0,Z.c)(48),{inFullDiff:n,...r}=e,i=n!==void 0&&n,[a,o]=(0,Y.useState)(!0),s=a&&!i,{excerpt:c,document:l}=r,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],t[0]=u):u=t[0];let d=Fc(l,u),f=d.opening(c.path),p;t[1]===c.caption?p=t[2]:(p=c.caption&&(0,X.jsx)(`figcaption`,{className:`text-ui text-foreground-2`,children:(0,X.jsx)($,{text:c.caption})}),t[1]=c.caption,t[2]=p);let m=s&&`border-b`,h;t[3]===m?h=t[4]:(h=j(`flex min-h-8 items-center gap-1 bg-muted/50 pr-1`,m),t[3]=m,t[4]=h);let g=`${s?`Hide`:`Show`} the lines: ${c.path} · ${c.lines}`,_;t[5]!==a||t[6]!==o?(_=()=>o(!a),t[5]=a,t[6]=o,t[7]=_):_=t[7];let v=s&&`rotate-90`,y;t[8]===v?y=t[9]:(y=j(`size-3.5 shrink-0`,v),t[8]=v,t[9]=y);let b;t[10]===y?b=t[11]:(b=(0,X.jsx)(ue,{"aria-hidden":!0,className:y}),t[10]=y,t[11]=b);let x;t[12]===c.path?x=t[13]:(x=(0,X.jsx)(`span`,{className:`text-foreground wrap-anywhere`,children:c.path}),t[12]=c.path,t[13]=x);let S;t[14]===c.lines?S=t[15]:(S=(0,X.jsx)(`span`,{children:c.lines}),t[14]=c.lines,t[15]=S);let C;t[16]===i?C=t[17]:(C=i&&(0,X.jsx)(`span`,{className:`font-sans`,children:`· in the full diff below`}),t[16]=i,t[17]=C);let w;t[18]!==x||t[19]!==S||t[20]!==C?(w=(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-1.5`,children:[x,S,C]}),t[18]=x,t[19]=S,t[20]=C,t[21]=w):w=t[21];let T;t[22]!==i||t[23]!==s||t[24]!==b||t[25]!==w||t[26]!==g||t[27]!==_?(T=(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":s,disabled:i,"aria-label":g,onClick:_,className:`flex min-w-0 flex-1 items-center gap-1.5 self-stretch px-2 py-1 text-left font-mono text-caption text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring`,children:[b,w]}),t[22]=i,t[23]=s,t[24]=b,t[25]=w,t[26]=g,t[27]=_,t[28]=T):T=t[28];let E=f===void 0,D;t[29]!==d||t[30]!==c.path?(D=()=>d.open(c.path),t[29]=d,t[30]=c.path,t[31]=D):D=t[31];let O;t[32]!==E||t[33]!==D?(O=(0,X.jsx)(H,{size:`sm`,variant:`ghost`,disabled:E,onClick:D,children:`Open file`}),t[32]=E,t[33]=D,t[34]=O):O=t[34];let k;t[35]!==T||t[36]!==O||t[37]!==h?(k=(0,X.jsxs)(`div`,{className:h,children:[T,O]}),t[35]=T,t[36]=O,t[37]=h,t[38]=k):k=t[38];let A;t[39]!==s||t[40]!==r?(A=s&&(0,X.jsx)(Ic,{...r}),t[39]=s,t[40]=r,t[41]=A):A=t[41];let M;t[42]!==k||t[43]!==A?(M=(0,X.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-md border`,children:[k,A]}),t[42]=k,t[43]=A,t[44]=M):M=t[44];let N;return t[45]!==M||t[46]!==p?(N=(0,X.jsxs)(`figure`,{className:`flex min-w-0 flex-col gap-1.5`,children:[p,M]}),t[45]=M,t[46]=p,t[47]=N):N=t[47],N}var zc=go({label:8.1,note:5.6,edge:5.4,padding:24,sign:12,chevron:16,min:88,max:232}),Bc=4,Vc={ArrowLeft:`left`,ArrowRight:`right`,ArrowUp:`up`,ArrowDown:`down`,Home:`first`,End:`last`};function Hc(){let e=(0,Z.c)(4),[t,n]=(0,Y.useState)(0),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>e=>{if(!e)return;let t=new ResizeObserver(()=>n(e.clientWidth));return t.observe(e),n(e.clientWidth),()=>t.disconnect()},e[0]=r):r=e[0];let[i]=(0,Y.useState)(r),a;return e[1]!==i||e[2]!==t?(a={frame:i,width:t},e[1]=i,e[2]=t,e[3]=a):a=e[3],a}function Uc(e){let t=(0,Z.c)(21),{document:n,path:r,note:i}=e,a;t[0]===r?a=t[1]:(a=[r],t[0]=r,t[1]=a);let o=Fc(n,a),s;t[2]===i?s=t[3]:(s=i&&(0,X.jsx)(`p`,{className:`text-ui text-foreground-2`,children:i}),t[2]=i,t[3]=s);let c;t[4]===r?c=t[5]:(c=(0,X.jsx)(`span`,{className:`min-w-0 flex-1 font-mono text-caption text-foreground wrap-anywhere`,children:r}),t[4]=r,t[5]=c);let l;t[6]!==o||t[7]!==r?(l=o.opening(r),t[6]=o,t[7]=r,t[8]=l):l=t[8];let u=l===void 0,d;t[9]!==o||t[10]!==r?(d=()=>o.open(r),t[9]=o,t[10]=r,t[11]=d):d=t[11];let f;t[12]!==u||t[13]!==d?(f=(0,X.jsx)(H,{size:`sm`,variant:`ghost`,disabled:u,onClick:d,children:`Open file`}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;t[15]!==c||t[16]!==f?(p=(0,X.jsxs)(`div`,{className:`flex min-h-8 min-w-0 items-center gap-1 rounded-md border bg-muted/50 pr-1 pl-3`,children:[c,f]}),t[15]=c,t[16]=f,t[17]=p):p=t[17];let m;return t[18]!==s||t[19]!==p?(m=(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[s,p]}),t[18]=s,t[19]=p,t[20]=m):m=t[20],m}function Wc(e){let t=(0,Z.c)(24),{document:n,title:r,node:i}=e,a;t[0]!==n.context||t[1]!==n.scope?(a={scope:n.scope,context:n.context},t[0]=n.context,t[1]=n.scope,t[2]=a):a=t[2];let o=a,{view:s}=In(o),[c,l]=(0,Y.useState)(!1),u;t[3]!==i||t[4]!==r?(u=e=>e.kind===`node`&&e.title===r&&e.node===i,t[3]=i,t[4]=r,t[5]=u):u=t[5];let d;t[6]!==u||t[7]!==s?(d=Hn(s,u),t[6]=u,t[7]=s,t[8]=d):d=t[8];let f=d,p;t[9]!==i||t[10]!==r?(p={kind:`node`,title:r,node:i},t[9]=i,t[10]=r,t[11]=p):p=t[11];let m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>l(!1),t[12]=m):m=t[12];let h;t[13]!==c||t[14]!==f||t[15]!==o||t[16]!==p?(h=(0,X.jsx)(Ar,{owner:o,drafts:f,anchor:p,composing:c,onClose:m}),t[13]=c,t[14]=f,t[15]=o,t[16]=p,t[17]=h):h=t[17];let g;t[18]!==c||t[19]!==i?(g=!c&&(0,X.jsx)(`span`,{children:(0,X.jsxs)(H,{size:`sm`,variant:`ghost`,onClick:()=>l(!0),children:[(0,X.jsx)(Ht,{"data-icon":`inline-start`}),`Comment on `,i]})}),t[18]=c,t[19]=i,t[20]=g):g=t[20];let _;return t[21]!==h||t[22]!==g?(_=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[h,g]}),t[21]=h,t[22]=g,t[23]=_):_=t[23],_}function Gc(e,t){let n=(0,Z.c)(6),r;n[0]!==e.context||n[1]!==e.scope?(r={scope:e.scope,context:e.context},n[0]=e.context,n[1]=e.scope,n[2]=r):r=n[2];let{view:i}=In(r),a;return n[3]!==t||n[4]!==i?(a=$r(i,t),n[3]=t,n[4]=i,n[5]=a):a=n[5],a}function Kc(e){let t=(0,Z.c)(22),{diagram:n,document:r,runId:i,step:a,title:o}=e,s=Gc(r,o),{frame:c,width:l}=Hc(),u=co(n,zc,l===0?1/0:l),[d,f]=(0,Y.useState)(n.nodes[0]?.id??``),[p,m]=(0,Y.useState)(),[h,g]=(0,Y.useState)(),[_,v]=(0,Y.useState)(),y=(0,Y.useId)(),b=p??h,x=b===void 0?void 0:lo(n,b),S;if(t[0]!==_||t[1]!==n.nodes){let e;t[3]===_?e=t[4]:(e=e=>e.id===_,t[3]=_,t[4]=e),S=n.nodes.find(e),t[0]=_,t[1]=n.nodes,t[2]=S}else S=t[2];let C=S,w=l===0||u.width<=l,T=(e,t)=>{let n=zc.label(t)/2+Bc;return Math.min(Math.max(e,n),u.width-n)},E=e=>{if(e.key===`Escape`&&_!==void 0){e.preventDefault(),e.stopPropagation(),v(void 0);return}let t=Vc[e.key];if(t===void 0)return;e.preventDefault(),e.stopPropagation();let n=fo(u,d,t);f(n),e.currentTarget.querySelector(`[data-node="${CSS.escape(n)}"]`)?.focus()},D;t[5]!==n.title||t[6]!==w?(D=(n.title||!w)&&(0,X.jsxs)(`figcaption`,{className:`flex min-h-8 items-center gap-3 border-b bg-muted/50 px-3 py-1 text-caption text-muted-foreground`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1`,children:n.title}),!w&&(0,X.jsx)(`span`,{className:`shrink-0`,children:`Scrolls sideways`})]}),t[5]=n.title,t[6]=w,t[7]=D):D=t[7];let O=w&&`mx-auto`,k;t[8]===O?k=t[9]:(k=j(`relative`,O),t[8]=O,t[9]=k);let A;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(A=e=>{e.currentTarget.contains(e.relatedTarget)||g(void 0)},t[10]=A):A=t[10];let M=u.width,N=u.height,P=u.edges.map(e=>{let t=n.edges[e.index];if(!e.label||!t?.label)return null;let r=x?.edges.has(e.index)===!0,i=xo(t,r);return(0,X.jsx)(`text`,{x:T(e.label.x,t.label),y:e.label.y,textAnchor:`middle`,dominantBaseline:`middle`,paintOrder:`stroke`,strokeWidth:4,strokeLinejoin:`round`,className:j(`stroke-card text-2xs transition-opacity duration-100`,x!==void 0&&!r&&`opacity-25`,i===`add`&&`fill-add-fg`,i===`del`&&`fill-del-fg`,i===`lit`&&`fill-foreground`,i===`rest`&&`fill-muted-foreground`),children:t.label},e.index)}),F;t[11]!==u||t[12]!==P?(F=(0,X.jsx)(`svg`,{"aria-hidden":!0,width:M,height:N,className:`pointer-events-none absolute inset-0 overflow-visible`,children:P}),t[11]=u,t[12]=P,t[13]=F):F=t[13];let I;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,X.jsx)(Sr,{orientation:`horizontal`,className:`absolute inset-x-0 bottom-0`}),t[14]=I):I=t[14];let L;return t[15]!==C||t[16]!==y||t[17]!==r||t[18]!==i||t[19]!==a||t[20]!==o?(L=C?.anchor&&(0,X.jsxs)(`div`,{id:y,className:`flex min-w-0 flex-col gap-2`,children:[C.anchor.kind===`lines`?(0,X.jsx)(Rc,{document:r,runId:i,step:a,excerpt:C.anchor.excerpt},C.id):(0,X.jsx)(Uc,{document:r,path:C.anchor.path,note:C.note},C.id),(0,X.jsx)(Wc,{document:r,title:o,node:C.label},`comments:${C.id}`)]}),t[15]=C,t[16]=y,t[17]=r,t[18]=i,t[19]=a,t[20]=o,t[21]=L):L=t[21],(0,X.jsxs)(`figure`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-md border`,children:[D,(0,X.jsxs)(sr,{className:`relative min-w-0`,children:[(0,X.jsx)(Fr,{ref:c,"data-wide-fade":``,className:`min-w-0 overflow-y-hidden`,children:(0,X.jsxs)(`div`,{className:k,style:{width:u.width,height:u.height},children:[(0,X.jsxs)(`svg`,{"aria-hidden":!0,width:u.width,height:u.height,className:`absolute inset-0 overflow-visible`,children:[u.lifelines.map(qc),u.edges.map(e=>{let t=n.edges[e.index];if(t===void 0)return null;let r=x?.edges.has(e.index)===!0,i=x!==void 0&&!r,a=xo(t,r);return(0,X.jsxs)(`g`,{className:j(`transition-opacity duration-100`,i&&`opacity-25`),children:[(0,X.jsx)(`path`,{d:e.path,fill:`none`,strokeWidth:1,strokeDasharray:t.mark===`removed`?`4 3`:void 0,className:j(a===`add`&&`stroke-add-fg`,a===`del`&&`stroke-del-fg`,a===`lit`&&`stroke-foreground`,a===`rest`&&`stroke-muted-foreground/60`)}),(0,X.jsx)(`polygon`,{points:e.arrow,className:j(a===`add`&&`fill-add-fg`,a===`del`&&`fill-del-fg`,a===`lit`&&`fill-foreground`,a===`rest`&&`fill-muted-foreground/60`)})]},e.index)})]}),(0,X.jsx)(`ul`,{"aria-label":n.title??`Diagram`,className:`absolute inset-0`,onKeyDown:E,onBlur:A,children:u.nodes.map(e=>{let t=n.nodes.find(t=>t.id===e.id);if(t===void 0)return null;let r=vo(t),i=_===t.id,a=x!==void 0&&!x.nodes.has(t.id),o=t.kind!==`external`,c=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-1 text-caption`,children:[r&&(0,X.jsx)(`span`,{"aria-hidden":!0,className:j(`w-2 shrink-0 font-mono`,t.mark===`added`&&`text-add-fg`,t.mark===`removed`&&`text-del-fg`,t.mark===`changed`&&`text-muted-foreground`),children:r}),(0,X.jsx)(K,{text:t.label,className:j(`min-w-0 flex-1`,o&&`font-mono`,t.mark===`removed`&&`text-muted-foreground line-through`,t.mark===`unchanged`&&`text-foreground-2`)}),t.anchor&&(0,X.jsx)(ue,{"aria-hidden":!0,className:j(`size-3 shrink-0 self-center text-muted-foreground`,i&&`rotate-90 text-foreground`)})]}),t.note&&(0,X.jsx)(`span`,{className:`flex min-w-0 text-2xs`,children:(0,X.jsx)(K,{text:t.note,className:j(`min-w-0 flex-1 text-muted-foreground`,r&&`pl-3`)})}),(0,X.jsxs)(`span`,{className:`sr-only`,children:[` `,bo(n,t)]})]}),l={"data-node":t.id,tabIndex:t.id===d?0:-1,onFocus:()=>{f(t.id),g(t.id)},onPointerEnter:()=>m(t.id),onPointerLeave:()=>m(void 0),className:j(`flex size-full flex-col justify-center gap-0.5 rounded-md border px-2.5 text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,t.mark===`added`&&`border-add-fg/40 bg-add-bg`,t.mark===`removed`&&`border-dashed border-del-fg/50 bg-card`,t.mark!==`added`&&t.mark!==`removed`&&`bg-card`,t.anchor?`cursor-pointer shadow-row hover:border-foreground/40`:`cursor-default`,i&&`border-foreground/60 ring-1 ring-foreground/20`)};return(0,X.jsxs)(`li`,{className:j(`absolute transition-opacity duration-100`,a&&`opacity-35`),style:{left:e.x,top:e.y,width:e.width,height:e.height},children:[s.has(t.label)&&(0,X.jsx)(`span`,{role:`img`,"aria-label":`${s.get(t.label)} comments`,className:`pointer-events-none absolute -top-1.5 -right-1.5 flex size-4 items-center justify-center rounded-full border bg-card text-muted-foreground`,children:(0,X.jsx)(jt,{"aria-hidden":!0,className:`size-2.5`})}),t.anchor?(0,X.jsx)(`button`,{type:`button`,...l,"aria-expanded":i,"aria-controls":i?y:void 0,onClick:()=>{f(t.id),v(i?void 0:t.id)},children:c}):(0,X.jsx)(`div`,{...l,children:c})]},t.id)})}),F]})}),I]})]}),L]})}function qc(e,t){return(0,X.jsx)(`line`,{x1:e.x,x2:e.x,y1:e.top,y2:e.bottom,className:`stroke-border`},t)}function Jc(e){let t=(0,Z.c)(9),{size:n}=e,r=n.additions===0?`text-muted-foreground`:`text-add-fg`,i;t[0]!==n.additions||t[1]!==r?(i=(0,X.jsxs)(`span`,{className:r,children:[`+`,n.additions]}),t[0]=n.additions,t[1]=r,t[2]=i):i=t[2];let a=n.deletions===0?`text-muted-foreground`:`text-del-fg`,o;t[3]!==n.deletions||t[4]!==a?(o=(0,X.jsxs)(`span`,{className:a,children:[`−`,n.deletions]}),t[3]=n.deletions,t[4]=a,t[5]=o):o=t[5];let s;return t[6]!==i||t[7]!==o?(s=(0,X.jsxs)(`span`,{className:`shrink-0 font-mono text-caption tabular-nums`,children:[i,` `,o]}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function Yc(e){let t=(0,Z.c)(7),{size:n,uncommitted:r}=e,i;t[0]===n?i=t[1]:(i=n&&(0,X.jsx)(Jc,{size:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r&&(0,X.jsx)(`span`,{className:`text-caption text-muted-foreground`,children:`Uncommitted`}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,X.jsxs)(`span`,{className:`flex shrink-0 items-baseline gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Xc(e){let t=(0,Z.c)(9),{block:n,document:r}=e,i;t[0]===n.files?i=t[1]:(i=n.files.map(Zc),t[0]=n.files,t[1]=i);let a=Fc(r,i),o;if(t[2]!==n.files||t[3]!==a){let e;t[5]===a?e=t[6]:(e=e=>{let t=a.opening(e.path),n=a.size(e.path);return(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,disabled:t===void 0,"aria-busy":t===void 0,className:`grid w-full grid-cols-[minmax(0,1fr)_auto] items-baseline gap-x-3 gap-y-0.5 px-3 py-1.5 text-left hover:bg-muted focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:hover:bg-transparent`,onClick:()=>a.open(e.path),children:[(0,X.jsx)(`span`,{className:`font-mono text-caption wrap-anywhere`,children:e.path}),(0,X.jsx)(Yc,{size:n,uncommitted:a.uncommitted(e.path)}),e.note&&(0,X.jsx)(`span`,{className:`col-span-2 text-caption text-muted-foreground`,children:(0,X.jsx)($,{text:e.note})})]})},e.path)},t[5]=a,t[6]=e),o=n.files.map(e),t[2]=n.files,t[3]=a,t[4]=o}else o=t[4];let s;return t[7]===o?s=t[8]:(s=(0,X.jsx)(`ul`,{"aria-label":`Files`,className:`divide-y overflow-hidden rounded-md border`,children:o}),t[7]=o,t[8]=s),s}function Zc(e){return e.path}function Qc(e){let t=(0,Z.c)(19),{block:n,pull:r}=e,i,a,o,s,c,l;if(t[0]!==n.checks||t[1]!==r){let{checks:e,live:u,headline:d,lead:f,moved:p}=Ca(n.checks,r);a=e,i=oc,c=d.note?`${f}. ${d.note}`:f,l=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(zn,{tone:d.tone}),d.note?(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-wrap items-baseline gap-x-3 gap-y-0.5`,children:[(0,X.jsx)(`span`,{className:`min-w-0 text-foreground wrap-anywhere`,children:f}),(0,X.jsx)(`span`,{className:`ml-auto`,children:(0,X.jsx)(ls,{label:d.note})})]}):(0,X.jsx)(`span`,{children:(0,X.jsx)(ls,{label:f})}),p&&r&&(0,X.jsxs)(`span`,{className:`ml-auto text-warn`,children:[`#`,r.number,` is now at`,` `,(0,X.jsx)(`span`,{className:`font-mono`,children:p})]})]}),o=`flex flex-col py-1`,s=a.results.map((e,t)=>{let n=oi(e,u);return(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,disabled:!r,title:r?`Open on #${r.number}`:void 0,onClick:()=>r?.openCheck(e.name),className:`flex h-7 w-full min-w-0 items-center gap-2 px-3 text-left text-ui hover:bg-muted focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:hover:bg-transparent`,children:[(0,X.jsx)(zn,{tone:n.tone,label:n.label}),(0,X.jsx)(K,{text:e.name,className:`min-w-0 flex-1`}),(0,X.jsx)(`span`,{className:`shrink-0 text-caption text-muted-foreground`,children:n.detail})]})},`${e.name}:${t}`)}),t[0]=n.checks,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l}else i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7];let u;t[8]!==o||t[9]!==s?(u=(0,X.jsx)(`ul`,{className:o,children:s}),t[8]=o,t[9]=s,t[10]=u):u=t[10];let d;t[11]===a.more?d=t[12]:(d=a.more&&(0,X.jsx)(`p`,{className:`border-t px-3 py-1.5 text-caption text-muted-foreground`,children:`More checks on the pull request`}),t[11]=a.more,t[12]=d);let f;return t[13]!==i||t[14]!==c||t[15]!==l||t[16]!==u||t[17]!==d?(f=(0,X.jsxs)(i,{label:c,heading:l,children:[u,d]}),t[13]=i,t[14]=c,t[15]=l,t[16]=u,t[17]=d,t[18]=f):f=t[18],f}function $c({blocks:e,step:t,title:n,run:r,document:i,pull:a,linesInFullDiff:o=!1}){return e.map((e,s)=>{switch(e.kind){case`excerpt`:return(0,X.jsx)(Rc,{document:i,runId:r.id,step:t,excerpt:e.excerpt,inFullDiff:o},s);case`images`:return(0,X.jsx)(fc,{scope:i.scope,context:i.context,run:r,items:e.screenshots},s);case`files`:return(0,X.jsx)(Xc,{block:e,document:i},s);case`checks`:return(0,X.jsx)(Qc,{block:e,pull:a},s);case`diagram`:return(0,X.jsx)(Kc,{diagram:e.diagram,document:i,runId:r.id,step:t,title:n},s)}})}function el(e){let t=(0,Z.c)(15),{comparison:n,choose:r}=e,i;t[0]===n.columns?i=t[1]:(i=n.columns.map(rl),t[0]=n.columns,t[1]=i);let a;t[2]===i?a=t[3]:(a=(0,X.jsx)(`thead`,{children:(0,X.jsx)(`tr`,{className:`bg-muted/50`,children:i})}),t[2]=i,t[3]=a);let o;t[4]===n.rows?o=t[5]:(o=n.rows.map(tl),t[4]=n.rows,t[5]=o);let s;t[6]===o?s=t[7]:(s=(0,X.jsx)(`tbody`,{children:o}),t[6]=o,t[7]=s);let c;t[8]!==r||t[9]!==n.columns?(c=r&&(0,X.jsx)(`tfoot`,{children:(0,X.jsx)(`tr`,{className:`border-t bg-muted/30`,children:n.columns.map((e,t)=>(0,X.jsx)(`td`,{className:`px-3 py-2 align-top not-last:border-r`,children:r(e)},t))})}),t[8]=r,t[9]=n.columns,t[10]=c):c=t[10];let l;return t[11]!==a||t[12]!==s||t[13]!==c?(l=(0,X.jsx)(`div`,{className:`overflow-hidden rounded-md border bg-background`,children:(0,X.jsxs)(`table`,{className:`w-full table-fixed border-collapse text-ui`,children:[a,s,c]})}),t[11]=a,t[12]=s,t[13]=c,t[14]=l):l=t[14],l}function tl(e,t){return(0,X.jsx)(`tr`,{className:`border-b last:border-b-0`,children:e.map(nl)},t)}function nl(e,t){return(0,X.jsx)(`td`,{className:`px-3 py-1.5 align-top text-foreground-2 wrap-anywhere not-last:border-r`,children:(0,X.jsx)($,{text:e})},t)}function rl(e,t){return(0,X.jsx)(`th`,{scope:`col`,className:`border-b px-3 py-1.5 text-left align-bottom text-caption font-medium text-foreground not-last:border-r`,children:(0,X.jsx)($,{text:e})},t)}function il(e){let t=(0,Z.c)(42),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=Do(r.scope,r.context),a=Oo(r.scope,r.context,r.base),o=n.step,s=i?.content.stops[o-1];if(!i||!s){let e;return t[3]===r?e=t[4]:(e=(0,X.jsx)(L,{message:`The walkthrough changed since this tab was opened.`,action:(0,X.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>r.onOpen({kind:`review`}),children:`Open review`})}),t[3]=r,t[4]=e),e}let c=i.content.stops.length,l=`Step ${o} of ${c}`,u;t[5]===l?u=t[6]:(u=(0,X.jsx)(`span`,{className:`mr-2 font-normal text-muted-foreground`,children:l}),t[5]=l,t[6]=u);let d;t[7]===s.title?d=t[8]:(d=(0,X.jsx)($,{text:s.title}),t[7]=s.title,t[8]=d);let f;t[9]!==u||t[10]!==d?(f=(0,X.jsxs)(X.Fragment,{children:[u,d]}),t[9]=u,t[10]=d,t[11]=f):f=t[11];let p;t[12]===s.title?p=t[13]:(p=Rt(s.title),t[12]=s.title,t[13]=p);let m=`${l}: ${p}`,h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(la,{}),t[14]=h):h=t[14];let g=o===1,_;t[15]!==r||t[16]!==o?(_=()=>r.onOpen({kind:`walkthrough-step`,step:o-1}),t[15]=r,t[16]=o,t[17]=_):_=t[17];let v;t[18]!==g||t[19]!==_?(v=(0,X.jsx)(ac,{label:`Previous step`,icon:h,disabled:g,onClick:_}),t[18]=g,t[19]=_,t[20]=v):v=t[20];let y;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(ue,{}),t[21]=y):y=t[21];let b=o===c,x;t[22]!==r||t[23]!==o?(x=()=>r.onOpen({kind:`walkthrough-step`,step:o+1}),t[22]=r,t[23]=o,t[24]=x):x=t[24];let S;t[25]!==b||t[26]!==x?(S=(0,X.jsx)(ac,{label:`Next step`,icon:y,disabled:b,onClick:x}),t[25]=b,t[26]=x,t[27]=S):S=t[27];let C;t[28]!==S||t[29]!==v?(C=(0,X.jsxs)(`span`,{className:`flex items-center`,children:[v,S]}),t[28]=S,t[29]=v,t[30]=C):C=t[30];let w;t[31]!==C||t[32]!==f||t[33]!==m?(w={title:f,titleLabel:m,after:C},t[31]=C,t[32]=f,t[33]=m,t[34]=w):w=t[34];let T=w,E;t[35]!==a||t[36]!==s?(E=lt(s,a),t[35]=a,t[36]=s,t[37]=E):E=t[37];let D=E,O;return t[38]!==T||t[39]!==D||t[40]!==r?(O=(0,X.jsx)(ll,{...r,only:D,heading:T}),t[38]=T,t[39]=D,t[40]=r,t[41]=O):O=t[41],O}function al(e){let t=(0,Z.c)(40),{document:n,entry:r,code:i,label:a,branch:o,eager:s,bleed:c}=e,l=c===void 0?`-mx-5 @3xl:-mx-8`:c,[u,d]=(0,Y.useState)(25),[f,p]=(0,Y.useState)(s);s&&!f&&p(!0);let m;t[0]!==o||t[1]!==i?(m=o?i.branch:[],t[0]=o,t[1]=i,t[2]=m):m=t[2];let h=m;if(h.length===0&&i.worktree.length===0)return null;if(!f){let e=`Code: ${a}`,n;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(n=ol(()=>p(!0)),t[3]=n):n=t[3];let r;t[4]===l?r=t[5]:(r=j(`flex flex-col gap-2`,l),t[4]=l,t[5]=r);let o;t[6]===h?o=t[7]:(o=(0,X.jsx)(sl,{title:`Branch`,paths:h}),t[6]=h,t[7]=o);let s;t[8]!==i.worktree||t[9]!==u?(s=i.worktree.slice(0,u),t[8]=i.worktree,t[9]=u,t[10]=s):s=t[10];let c;t[11]===s?c=t[12]:(c=(0,X.jsx)(sl,{title:`Uncommitted`,paths:s}),t[11]=s,t[12]=c);let d;return t[13]!==e||t[14]!==r||t[15]!==o||t[16]!==c?(d=(0,X.jsxs)(`div`,{role:`group`,"aria-label":e,ref:n,className:r,children:[o,c]}),t[13]=e,t[14]=r,t[15]=o,t[16]=c,t[17]=d):d=t[17],d}let g;t[18]!==n.interaction||t[19]!==r?(g=e=>({...n.interaction,active:!1,quiet:!0,toolbarTarget:null,fileTarget:void 0,entry:`${r}:${e}`}),t[18]=n.interaction,t[19]=r,t[20]=g):g=t[20];let _=g,v=`Code: ${a}`,y;t[21]===l?y=t[22]:(y=j(`flex flex-col gap-2`,l),t[21]=l,t[22]=y);let b;t[23]!==o||t[24]!==h||t[25]!==n||t[26]!==_||t[27]!==a?(b=h.length>0&&(0,X.jsx)(`section`,{"aria-label":`${a}: branch`,className:`flex flex-col`,children:(0,X.jsx)(Br,{...n,compared:o,only:h,fullHeight:!0,interaction:_(`branch`),heading:{title:`Branch`,titleLabel:`${a}: branch`}})}),t[23]=o,t[24]=h,t[25]=n,t[26]=_,t[27]=a,t[28]=b):b=t[28];let x;t[29]!==i.worktree||t[30]!==n||t[31]!==_||t[32]!==a||t[33]!==u?(x=i.worktree.length>0&&(0,X.jsx)(`section`,{"aria-label":`${a}: uncommitted`,className:`flex flex-col`,children:(0,X.jsx)(Or,{...n,only:i.worktree,limit:u,onReadMore:()=>d(u+25),fullHeight:!0,interaction:_(`uncommitted`),heading:{title:`Uncommitted`,titleLabel:`${a}: uncommitted`}})}),t[29]=i.worktree,t[30]=n,t[31]=_,t[32]=a,t[33]=u,t[34]=x):x=t[34];let S;return t[35]!==v||t[36]!==y||t[37]!==b||t[38]!==x?(S=(0,X.jsxs)(`div`,{role:`group`,"aria-label":v,className:y,children:[b,x]}),t[35]=v,t[36]=y,t[37]=b,t[38]=x,t[39]=S):S=t[39],S}function ol(e){return t=>{if(!t)return;let n=new IntersectionObserver(t=>{t.some(e=>e.isIntersecting)&&e()},{root:t.closest(`[data-review-scroll]`),rootMargin:`600px 0px`});return n.observe(t),()=>n.disconnect()}}function sl(e){let t=(0,Z.c)(9),{title:n,paths:r}=e;if(r.length===0)return null;let i;t[0]===n?i=t[1]:(i=(0,X.jsx)(`h3`,{className:`border-b px-4 py-2.5 text-ui font-semibold`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.slice(0,25).map(cl),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,X.jsx)(`ul`,{children:a}),t[4]=a,t[5]=o);let s;return t[6]!==i||t[7]!==o?(s=(0,X.jsxs)(`section`,{className:`flex flex-col`,children:[i,o]}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function cl(e){return(0,X.jsx)(`li`,{className:`min-h-40 px-4 py-3 font-mono text-caption text-muted-foreground`,children:e},e)}function ll(e){let t=(0,Z.c)(9),n=Qn(e.scope,e.context.connection),[r,i]=(0,Y.useState)(`branch`),a;t[0]!==n||t[1]!==r||t[2]!==e?(a=t=>{let{branch:a,worktree:o}=Ur({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,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsx)(Gn,{scope:e.scope,context:e.context,interaction:e.interaction,branchFiles:t.files,changes:n,committed:a,dirty:o,range:gt(t)}),s&&(0,X.jsx)(_r,{inline:!0,title:e.heading.title,titleLabel:e.heading.titleLabel,children:e.heading.after}),(0,X.jsxs)(`div`,{className:s?`min-h-0 flex-1 overflow-auto`:`flex min-h-0 flex-1 flex-col`,children:[a.length>0&&(0,X.jsx)(`section`,{"aria-label":`Branch code`,className:`flex min-h-0 flex-1 flex-col`,onFocusCapture:()=>i(`branch`),onPointerDownCapture:()=>i(`branch`),children:(0,X.jsx)(Br,{...e,only:a,fullHeight:s,interaction:c(`branch`),heading:s?{title:`Branch`,titleLabel:`Branch`}:e.heading})}),o.length>0&&(0,X.jsx)(`section`,{"aria-label":`Uncommitted code`,className:`flex min-h-0 flex-1 flex-col`,onFocusCapture:()=>i(`uncommitted`),onPointerDownCapture:()=>i(`uncommitted`),children:(0,X.jsx)(Or,{...e,only:o,fullHeight:s,interaction:c(`uncommitted`),heading:s?{title:`Uncommitted`,titleLabel:`Uncommitted`}:e.heading})}),a.length===0&&o.length===0&&(0,X.jsx)(L,{message:`These files no longer have changes.`})]})]})},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,X.jsx)(bt,{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}var ul=60;function dl(e){return t=>{let n=t?.closest(`[data-review-scroll]`);if(!t||!n)return;let r=()=>{let r=n.getBoundingClientRect().top+ul,i=Array.from(t.children),a=0;i.forEach((e,t)=>{e.getBoundingClientRect().top<=r&&(a=t+1)});let o=n.scrollTop>0&&n.scrollTop+n.clientHeight>=n.scrollHeight-2,s=i.at(-1),c=s!==void 0&&s.getBoundingClientRect().top<n.getBoundingClientRect().bottom,l=o&&c?i.length:a,u=i[l-1]?.querySelector(`h2`),d=t.previousElementSibling?.getBoundingClientRect().bottom;e(l,u!=null&&d!==void 0&&u.getBoundingClientRect().bottom<=d)};return r(),n.addEventListener(`scroll`,r,{passive:!0}),()=>n.removeEventListener(`scroll`,r)}}function fl(e){let t=(0,Z.c)(31),{stops:n,current:r,titled:i,outside:a,onStep:o,onJump:s}=e,c=Math.max(r,1),l=n[c-1],u=r===0?`${n.length} ${n.length===1?`step`:`steps`}`:`Step ${c} of ${n.length}`,d;t[0]===u?d=t[1]:(d=(0,X.jsx)(`span`,{className:`shrink-0 text-caption text-muted-foreground tabular-nums`,children:u}),t[0]=u,t[1]=d);let f;t[2]!==r||t[3]!==l||t[4]!==i?(f=i&&r>0&&(0,X.jsx)(K,{text:Rt(l.title),className:`min-w-0 flex-1 font-medium`}),t[2]=r,t[3]=l,t[4]=i,t[5]=f):f=t[5];let p;t[6]!==d||t[7]!==f?(p=(0,X.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-baseline gap-2 text-ui`,children:[d,f]}),t[6]=d,t[7]=f,t[8]=p):p=t[8];let m;t[9]!==s||t[10]!==a?(m=a>0&&(0,X.jsxs)(`button`,{type:`button`,onClick:()=>s(`review-not-covered`),className:`hidden shrink-0 text-caption text-muted-foreground hover:text-foreground @2xl:block`,children:[a===1?`1 file`:`${a} files`,` not in a step`]}),t[9]=s,t[10]=a,t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(Mn,{}),t[12]=h):h=t[12];let g=r<=1,_;t[13]===o?_=t[14]:(_=()=>o(-1),t[13]=o,t[14]=_);let v;t[15]!==g||t[16]!==_?(v=(0,X.jsx)(ac,{label:`Previous step`,shortcut:`K`,icon:h,disabled:g,onClick:_}),t[15]=g,t[16]=_,t[17]=v):v=t[17];let y;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(et,{}),t[18]=y):y=t[18];let b=r>=n.length,x;t[19]===o?x=t[20]:(x=()=>o(1),t[19]=o,t[20]=x);let S;t[21]!==b||t[22]!==x?(S=(0,X.jsx)(ac,{label:`Next step`,shortcut:`J`,icon:y,disabled:b,onClick:x}),t[21]=b,t[22]=x,t[23]=S):S=t[23];let C;t[24]!==S||t[25]!==v?(C=(0,X.jsxs)(`span`,{className:`flex shrink-0 items-center`,children:[v,S]}),t[24]=S,t[25]=v,t[26]=C):C=t[26];let w;return t[27]!==C||t[28]!==p||t[29]!==m?(w=(0,X.jsx)(`nav`,{"aria-label":`Step navigation`,className:`sticky top-0 z-10 -mx-5 bg-card px-5 @3xl:-mx-8 @3xl:px-8`,children:(0,X.jsxs)(`div`,{className:`flex h-11 items-center gap-3 border-b`,children:[p,m,C]})}),t[27]=C,t[28]=p,t[29]=m,t[30]=w):w=t[30],w}function pl({stop:e,step:t,decision:n}){return e.callouts.map(({attention:e,comparison:r},i)=>(0,X.jsxs)(`section`,{id:gc(t,i),"aria-label":`Your call: ${pn(e)}`,className:`flex flex-col gap-2 border-l-2 border-warn pl-4`,children:[(0,X.jsxs)(`p`,{className:`text-caption font-medium text-warn`,children:[`Your call · `,pn(e)]}),(0,X.jsx)(`h3`,{className:`text-section font-semibold text-pretty`,children:(0,X.jsx)($,{text:e.question})}),(0,X.jsx)(`p`,{className:`text-ui text-foreground-2`,children:(0,X.jsx)($,{text:e.note})}),n?n({step:t,index:i,comparison:r}):r&&(0,X.jsx)(el,{comparison:r})]},i))}function ml(e){let t=(0,Z.c)(29),{props:n,code:r,branch:i,eager:a,step:o,open:s,onOpen:c}=e,l;t[0]!==i||t[1]!==r?(l=i?r:{...r,branch:[]},t[0]=i,t[1]=r,t[2]=l):l=t[2];let u;t[3]===l?u=t[4]:(u=On(l),t[3]=l,t[4]=u);let d=u;if(d===0)return null;let f;t[5]!==c||t[6]!==s?(f=()=>c(!s),t[5]=c,t[6]=s,t[7]=f):f=t[7];let p=s&&`rotate-90`,m;t[8]===p?m=t[9]:(m=j(`size-3.5`,p),t[8]=p,t[9]=m);let h;t[10]===m?h=t[11]:(h=(0,X.jsx)(ue,{"aria-hidden":!0,className:m}),t[10]=m,t[11]=h);let g=d===1?`1 file`:`${d} files`,_;t[12]===g?_=t[13]:(_=(0,X.jsxs)(`span`,{className:`tabular-nums`,children:[`· `,g]}),t[12]=g,t[13]=_);let v;t[14]!==s||t[15]!==f||t[16]!==h||t[17]!==_?(v=(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:f,className:`-mx-2 flex h-8 items-center gap-1.5 self-start rounded-md px-2 text-left text-caption text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[h,`Full diff of this step`,_]}),t[14]=s,t[15]=f,t[16]=h,t[17]=_,t[18]=v):v=t[18];let y;t[19]!==i||t[20]!==r||t[21]!==a||t[22]!==s||t[23]!==n||t[24]!==o?(y=s&&(0,X.jsx)(al,{document:n,entry:`review:step-${o}`,code:r,branch:i,eager:a,label:`Step ${o}`,bleed:``}),t[19]=i,t[20]=r,t[21]=a,t[22]=s,t[23]=n,t[24]=o,t[25]=y):y=t[25];let b;return t[26]!==y||t[27]!==v?(b=(0,X.jsxs)(`div`,{className:`flex flex-col`,children:[v,y]}),t[26]=y,t[27]=v,t[28]=b):b=t[28],b}function hl(e){let t=(0,Z.c)(55),{stop:n,step:r,run:i,props:a,code:o,branch:s,eager:c,conversation:l,decision:u,pull:d}=e,[f,p]=(0,Y.useState)(!1),m;t[0]===r?m=t[1]:(m=hc(r),t[0]=r,t[1]=m);let h;t[2]===r?h=t[3]:(h=hc(r),t[2]=r,t[3]=h);let g=`${h}-title`,_;t[4]===r?_=t[5]:(_=hc(r),t[4]=r,t[5]=_);let v=`${_}-title`,y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(`span`,{className:`sr-only`,children:`Step `}),t[6]=y):y=t[6];let b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(`span`,{className:`sr-only`,children:`: `}),t[7]=b):b=t[7];let x;t[8]===r?x=t[9]:(x=(0,X.jsxs)(`span`,{className:`shrink-0 font-normal text-muted-foreground tabular-nums`,children:[y,r,b]}),t[8]=r,t[9]=x);let S;t[10]===n.title?S=t[11]:(S=(0,X.jsx)(`span`,{className:`min-w-0`,children:(0,X.jsx)($,{text:n.title})}),t[10]=n.title,t[11]=S);let C;t[12]!==v||t[13]!==x||t[14]!==S?(C=(0,X.jsxs)(`h2`,{id:v,className:`flex gap-2.5 text-section font-semibold text-pretty`,children:[x,S]}),t[12]=v,t[13]=x,t[14]=S,t[15]=C):C=t[15];let w;t[16]===n.explanation?w=t[17]:(w=(0,X.jsx)(`p`,{className:`text-prose text-foreground-2`,children:(0,X.jsx)($,{text:n.explanation})}),t[16]=n.explanation,t[17]=w);let T;t[18]!==C||t[19]!==w?(T=(0,X.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[C,w]}),t[18]=C,t[19]=w,t[20]=T):T=t[20];let E;t[21]!==u||t[22]!==r||t[23]!==n?(E=(0,X.jsx)(pl,{stop:n,step:r,decision:u}),t[21]=u,t[22]=r,t[23]=n,t[24]=E):E=t[24];let D=n.blocks,O;t[25]===n.title?O=t[26]:(O=Rt(n.title),t[25]=n.title,t[26]=O);let k;t[27]!==f||t[28]!==a||t[29]!==d||t[30]!==i||t[31]!==r||t[32]!==n.blocks||t[33]!==O?(k=(0,X.jsx)($c,{blocks:D,step:r,title:O,run:i,document:a,pull:d,linesInFullDiff:f}),t[27]=f,t[28]=a,t[29]=d,t[30]=i,t[31]=r,t[32]=n.blocks,t[33]=O,t[34]=k):k=t[34];let A;t[35]!==s||t[36]!==o||t[37]!==f||t[38]!==c||t[39]!==a||t[40]!==r?(A=o&&(0,X.jsx)(ml,{props:a,code:o,branch:s,eager:c,step:r,open:f,onOpen:p}),t[35]=s,t[36]=o,t[37]=f,t[38]=c,t[39]=a,t[40]=r,t[41]=A):A=t[41];let j;t[42]!==l||t[43]!==r?(j=l?.({step:r}),t[42]=l,t[43]=r,t[44]=j):j=t[44];let M;t[45]!==T||t[46]!==E||t[47]!==k||t[48]!==A||t[49]!==j||t[50]!==g?(M=(0,X.jsxs)(`article`,{"aria-labelledby":g,className:`flex min-w-0 flex-col gap-4`,children:[T,E,k,A,j]}),t[45]=T,t[46]=E,t[47]=k,t[48]=A,t[49]=j,t[50]=g,t[51]=M):M=t[51];let N;return t[52]!==m||t[53]!==M?(N=(0,X.jsx)(`li`,{id:m,className:`border-t py-6 first:border-t-0 first:pt-5`,children:M}),t[52]=m,t[53]=M,t[54]=N):N=t[54],N}function gl(e){let t=(0,Z.c)(7),{onStep:n,onComment:r}=e,i;t[0]===n?i=t[1]:(i=()=>n(1),t[0]=n,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a={ignoreInputs:!0},t[2]=a):a=t[2],_i(`J`,i,a);let o;t[3]===n?o=t[4]:(o=()=>n(-1),t[3]=n,t[4]=o);let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s={ignoreInputs:!0},t[5]=s):s=t[5],_i(`K`,o,s);let c;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c={ignoreInputs:!0,preventDefault:!0},t[6]=c):c=t[6],_i(li.comment,r,c),null}function _l(e){let t=document.getElementById(hc(e))?.querySelector(`textarea`);t?.scrollIntoView({block:`center`}),t?.focus()}function vl(e){let t=(0,Z.c)(41),{content:n,run:r,props:i,code:a,branch:o,eager:s,outside:c,conversation:l,decision:u,pull:d,onJump:f}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p={current:0,titled:!1},t[0]=p):p=t[0];let[m,h]=(0,Y.useState)(p),{current:g,titled:_}=m,v=n.stops.length,y;t[1]!==g||t[2]!==v?(y=(e,t)=>{let n=t===void 0?`smooth`:t;mc(hc(Math.min(Math.max(g+e,1),v)),n)},t[1]=g,t[2]=v,t[3]=y):y=t[3];let b=y,x=ti()&&i.interaction.active&&i.interaction.hidden!==!0;if(v===0)return null;let S;t[4]!==g||t[5]!==x||t[6]!==b?(S=x&&(0,X.jsx)(gl,{onStep:e=>b(e,`auto`),onComment:()=>_l(Math.max(g,1))}),t[4]=g,t[5]=x,t[6]=b,t[7]=S):S=t[7];let C;t[8]!==n.stops||t[9]!==g||t[10]!==f||t[11]!==c||t[12]!==b||t[13]!==_?(C=(0,X.jsx)(fl,{stops:n.stops,current:g,titled:_,outside:c,onStep:b,onJump:f}),t[8]=n.stops,t[9]=g,t[10]=f,t[11]=c,t[12]=b,t[13]=_,t[14]=C):C=t[14];let w;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(w=dl((e,t)=>h(n=>n.current===e&&n.titled===t?n:{current:e,titled:t})),t[15]=w):w=t[15];let T;if(t[16]!==o||t[17]!==a||t[18]!==n.stops||t[19]!==l||t[20]!==u||t[21]!==s||t[22]!==i||t[23]!==d||t[24]!==r){let e;t[26]!==o||t[27]!==a||t[28]!==l||t[29]!==u||t[30]!==s||t[31]!==i||t[32]!==d||t[33]!==r?(e=(e,t)=>(0,X.jsx)(hl,{stop:e,step:t+1,run:r,props:i,code:a[t],branch:o,eager:s[t]??!0,conversation:l,decision:u,pull:d},t),t[26]=o,t[27]=a,t[28]=l,t[29]=u,t[30]=s,t[31]=i,t[32]=d,t[33]=r,t[34]=e):e=t[34],T=n.stops.map(e),t[16]=o,t[17]=a,t[18]=n.stops,t[19]=l,t[20]=u,t[21]=s,t[22]=i,t[23]=d,t[24]=r,t[25]=T}else T=t[25];let E;t[35]===T?E=t[36]:(E=(0,X.jsx)(`ol`,{ref:w,className:`flex flex-col`,children:T}),t[35]=T,t[36]=E);let D;return t[37]!==S||t[38]!==C||t[39]!==E?(D=(0,X.jsxs)(`section`,{"aria-label":`Steps`,"aria-keyshortcuts":`J K C`,className:`flex flex-col`,children:[S,C,E]}),t[37]=S,t[38]=C,t[39]=E,t[40]=D):D=t[40],D}function yl(e){let t=(0,Z.c)(37),{owner:n,step:r,index:i,comparison:a}=e,{view:o,failed:s}=Ko(n),{decide:c,waiting:l,failure:u}=Zo(n),d=ye(n.context),f=l||!!d||o===void 0,p,m,h,g;if(t[0]!==a||t[1]!==c||t[2]!==f||t[3]!==i||t[4]!==r||t[5]!==o?.decisions||t[6]!==d){let e=er(o?.decisions,r,i),n=xt(a);p=fr(a,e);let s=new Map(n.map(bl)),l;t[11]!==s||t[12]!==c||t[13]!==f||t[14]!==i||t[15]!==r||t[16]!==d?(l=e=>{let t=s.get(e);return t===void 0?null:(0,X.jsxs)(`div`,{className:`flex flex-col items-start gap-1.5`,children:[(0,X.jsx)(H,{size:`sm`,variant:`outline`,disabled:f,"aria-label":`Choose ${e}`,"aria-description":[t.implemented?`In this change.`:void 0,t.effect,d].filter(Boolean).join(` `)||void 0,onClick:()=>c({step:r,call:i,decided:!0,option:e}),children:`Choose`}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5`,children:[t.implemented&&(0,X.jsx)(Ie,{variant:`outline`,children:`In this change`}),t.effect&&(0,X.jsx)(`span`,{className:`text-caption text-pretty text-muted-foreground`,children:t.effect})]})]})},t[11]=s,t[12]=c,t[13]=f,t[14]=i,t[15]=r,t[16]=d,t[17]=l):l=t[17];let u=l,_;t[18]!==n||t[19]!==a||t[20]!==c||t[21]!==f||t[22]!==i||t[23]!==r||t[24]!==d?(_=n.length>0?(0,X.jsx)(`p`,{className:`text-caption text-muted-foreground`,children:Qt(a)}):(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,X.jsx)(H,{size:`sm`,variant:`outline`,className:`self-start`,disabled:f,"aria-description":d,onClick:()=>c({step:r,call:i,decided:!0}),children:`Mark decided`}),(0,X.jsx)(`p`,{className:`text-caption text-muted-foreground`,children:Qt(a)})]}),t[18]=n,t[19]=a,t[20]=c,t[21]=f,t[22]=i,t[23]=r,t[24]=d,t[25]=_):_=t[25];let v=_;m=`flex flex-col gap-2`,h=a&&(0,X.jsx)(el,{comparison:a,choose:e?void 0:u}),g=e?(0,X.jsxs)(`p`,{role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-ui`,children:[p===`needs-commit`?(0,X.jsx)(En,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-warn`}):(0,X.jsx)(R,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-add-fg`}),(0,X.jsx)(`span`,{className:`font-medium`,children:Kr(e)}),(0,X.jsx)(`time`,{dateTime:e.decidedAt,className:`text-caption text-muted-foreground`,children:ei(e.decidedAt)}),(0,X.jsx)(H,{variant:`link`,size:`sm`,disabled:f,"aria-description":d,onClick:()=>c({step:r,call:i,decided:!1}),children:`Undo`})]}):v,t[0]=a,t[1]=c,t[2]=f,t[3]=i,t[4]=r,t[5]=o?.decisions,t[6]=d,t[7]=p,t[8]=m,t[9]=h,t[10]=g}else p=t[7],m=t[8],h=t[9],g=t[10];let _;t[26]===p?_=t[27]:(_=p===`needs-commit`&&(0,X.jsx)(`p`,{className:`text-caption text-warn`,children:`Needs a new commit: this change does not do this yet.`}),t[26]=p,t[27]=_);let v;t[28]!==s||t[29]!==u?(v=(u??(s?`Decisions could not be read.`:void 0))&&(0,X.jsx)(`p`,{role:`alert`,className:`text-caption text-destructive`,children:u??`Decisions could not be read.`}),t[28]=s,t[29]=u,t[30]=v):v=t[30];let y;return t[31]!==m||t[32]!==h||t[33]!==g||t[34]!==_||t[35]!==v?(y=(0,X.jsxs)(`div`,{className:m,children:[h,g,_,v]}),t[31]=m,t[32]=h,t[33]=g,t[34]=_,t[35]=v,t[36]=y):y=t[36],y}function bl(e){return[e.option,e]}function xl(e,t){let n=(0,Z.c)(8),r;n[0]===e?r=n[1]:(r=he(e),n[0]=e,n[1]=r);let[i,a]=Ei(r),o;n[2]!==t||n[3]!==a?(o=async(e,n,r)=>{let i=e.walkthroughSettings?.mode??`manual`;try{await a({projectId:e.id,mode:i,writer:n})}catch{Je({title:`The project default was not saved`,type:`error`});return}t(),Je({title:`${r} is the default for ${e.name}`,type:`success`})},n[2]=t,n[3]=a,n[4]=o):o=n[4];let s;return n[5]!==i.waiting||n[6]!==o?(s={saving:i.waiting,save:o},n[5]=i.waiting,n[6]=o,n[7]=s):s=n[7],s}function Sl(e){let t=(0,Z.c)(65),{document:r,writer:i}=e,{connection:a}=r.context,o;t[0]===r.scope?o=t[1]:(o=e=>e.id===r.scope.projectId,t[0]=r.scope,t[1]=o);let s=Rn(a).projects.find(o),c;t[2]===i?c=t[3]:(c=()=>i.choose(void 0),t[2]=i,t[3]=c);let l=xl(a,c),{settings:d,writer:f}=i;if(!d||!f||d.models.length===0)return null;let{models:p}=d,h;t[4]===f?h=t[5]:(h=de(f),t[4]=f,t[5]=h);let g=h,v;t[6]!==p||t[7]!==f?(v=Le(f,p),t[6]=p,t[7]=f,t[8]=v):v=t[8];let y=v,b=je(p),x;if(t[9]!==p||t[10]!==f.model||t[11]!==f.provider){let e;t[13]!==f.model||t[14]!==f.provider?(e=e=>e.provider===f.provider&&e.model===f.model,t[13]=f.model,t[14]=f.provider,t[15]=e):e=t[15],x=p.find(e),t[9]=p,t[10]=f.model,t[11]=f.provider,t[12]=x}else x=t[12];let C=x,T=qe(f,p),E=C?.label??f.model,D=s?.walkthroughSettings?.writer,O=Ge(D,f,p),k;t[16]!==i||t[17]!==p||t[18]!==f?(k=e=>i.choose(Fe(e,f,p)),t[16]=i,t[17]=p,t[18]=f,t[19]=k):k=t[19];let A=k,j=`Writer: ${y}`,N;t[20]===j?N=t[21]:(N=(0,X.jsx)(H,{variant:`ghost`,size:`sm`,"aria-label":j,className:`max-w-full min-w-0`}),t[20]=j,t[21]=N);let P;t[22]===y?P=t[23]:(P=(0,X.jsx)(K,{text:y}),t[22]=y,t[23]=P);let I;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,X.jsx)(et,{"aria-hidden":`true`}),t[24]=I):I=t[24];let L;t[25]!==N||t[26]!==P?(L=(0,X.jsxs)(Be,{render:N,children:[P,I]}),t[25]=N,t[26]=P,t[27]=L):L=t[27];let R;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,X.jsx)(w,{children:(0,X.jsx)(it,{children:`Writer for the next run`})}),t[28]=R):R=t[28];let z;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,X.jsx)(m,{}),t[29]=z):z=t[29];let B;t[30]!==E||t[31]!==f.latest?(B=f.latest===void 0&&(0,X.jsx)(K,{text:E,className:`ml-auto text-muted-foreground`}),t[30]=E,t[31]=f.latest,t[32]=B):B=t[32];let V;t[33]===B?V=t[34]:(V=(0,X.jsxs)(S,{children:[`Exact model`,B]}),t[33]=B,t[34]=V);let U=b.map(wl),W;t[35]!==A||t[36]!==g||t[37]!==U?(W=(0,X.jsx)(u,{className:`w-52`,children:(0,X.jsx)(n,{value:g,onValueChange:A,children:U})}),t[35]=A,t[36]=g,t[37]=U,t[38]=W):W=t[38];let ee;t[39]!==V||t[40]!==W?(ee=(0,X.jsxs)(ne,{children:[V,W]}),t[39]=V,t[40]=W,t[41]=ee):ee=t[41];let te=ne,G;t[42]===f.effort?G=t[43]:(G=(0,X.jsxs)(S,{children:[`Effort`,(0,X.jsx)(`span`,{className:`ml-auto text-muted-foreground`,children:f.effort})]}),t[42]=f.effort,t[43]=G);let re=u,ie=n,ae=f.effort,oe;t[44]!==i||t[45]!==f?(oe=e=>i.choose(se(f,e)),t[44]=i,t[45]=f,t[46]=oe):oe=t[46];let ce=T.map(Cl),le;t[47]!==ie||t[48]!==oe||t[49]!==ce||t[50]!==f.effort?(le=(0,X.jsx)(ie,{value:ae,onValueChange:oe,children:ce}),t[47]=ie,t[48]=oe,t[49]=ce,t[50]=f.effort,t[51]=le):le=t[51];let q;t[52]!==re||t[53]!==le?(q=(0,X.jsx)(re,{className:`w-36`,children:le}),t[52]=re,t[53]=le,t[54]=q):q=t[54];let J;t[55]!==te||t[56]!==G||t[57]!==q?(J=(0,X.jsxs)(te,{children:[G,q]}),t[55]=te,t[56]=G,t[57]=q,t[58]=J):J=t[58];let ue;return t[59]!==O||t[60]!==y||t[61]!==s||t[62]!==l||t[63]!==f?(ue=s&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(m,{}),(0,X.jsx)(F,{disabled:O||l.saving,onSelect:()=>l.save(s,f,y),children:O?`Project default`:`Make project default`})]}),t[59]=O,t[60]=y,t[61]=s,t[62]=l,t[63]=f,t[64]=ue):ue=t[64],(0,X.jsxs)(M,{children:[L,(0,X.jsxs)(_,{align:`start`,className:`w-64`,children:[R,(0,X.jsx)(n,{value:g,onValueChange:A,children:b.map(El)}),z,ee,J,ue]})]})}function Cl(e){return(0,X.jsx)(te,{closeOnSelect:!0,value:e,children:e},e)}function wl(e){return(0,X.jsxs)(w,{children:[(0,X.jsx)(it,{children:e.label}),e.exact.map(Tl)]},e.provider)}function Tl(e){return(0,X.jsx)(te,{closeOnSelect:!0,value:e.key,children:e.label},e.key)}function El(e){return e.latest.length>0?(0,X.jsxs)(w,{children:[(0,X.jsx)(it,{children:e.label}),e.latest.map(Dl)]},e.provider):null}function Dl(e){return(0,X.jsxs)(te,{closeOnSelect:!0,value:e.key,children:[e.label,(0,X.jsx)(`span`,{className:`mr-5 ml-auto text-muted-foreground`,children:e.model})]},e.key)}function Ol(e){let t=(0,Z.c)(9),{document:n}=e,{connection:r}=n.context,i=_e(),a=Rn(r),s;if(t[0]!==n.scope||t[1]!==a.projects){let e;t[3]===n.scope?e=t[4]:(e=e=>e.id===n.scope.projectId,t[3]=n.scope,t[4]=e),s=a.projects.find(e),t[0]=n.scope,t[1]=a.projects,t[2]=s}else s=t[2];let c=s,l;return t[5]!==r||t[6]!==i?.environmentId||t[7]!==c?(l=c?.walkthroughSettings?.writer?(0,X.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>void Wn.open({payload:{project:c,remote:r.environmentId===i?.environmentId?null:r.environmentId}}),children:`Project walkthrough settings`}):(0,X.jsx)(ae,{to:`/settings/$section`,params:{section:`git`},className:o({variant:`ghost`,size:`sm`}),children:`Settings → Changes & Git`}),t[5]=r,t[6]=i?.environmentId,t[7]=c,t[8]=l):l=t[8],l}function kl(e){let t=(0,Z.c)(46),{document:n,writer:r,action:i,existingMessage:a,signedOut:o,actionFirst:s}=e,c=s!==void 0&&s,l=r.noWriters||!!r.status?.block,u;t[0]!==o||t[1]!==r?(u=Te(r,o),t[0]=o,t[1]=r,t[2]=u):u=t[2];let d=u,f;t[3]!==a||t[4]!==r?(f=xe(r,a),t[3]=a,t[4]=r,t[5]=f):f=t[5];let p=f,m=!r.noWriters&&!r.failed&&!!r.status?.block,h;t[6]!==i||t[7]!==c||t[8]!==l?(h=i&&!l&&(0,X.jsx)(H,{size:`sm`,variant:i.variant??`outline`,className:c?`order-first mr-1`:void 0,disabled:i.disabled,"aria-description":i.description,onClick:i.onClick,children:i.label}),t[6]=i,t[7]=c,t[8]=l,t[9]=h):h=t[9];let g=h;if(d&&!m){let e=r.failed?`alert`:`status`,n;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(En,{"aria-hidden":!0,className:`mt-0.75 size-3.5 shrink-0 text-muted-foreground`}),t[10]=n):n=t[10];let a=p??`Sign in on the connected computer, then check again.`,o;t[11]===a?o=t[12]:(o=(0,X.jsxs)(`p`,{className:`flex min-w-0 flex-1 basis-56 items-start gap-2 text-ui text-foreground-2`,children:[n,(0,X.jsx)(`span`,{className:`min-w-0 text-pretty`,children:a})]}),t[11]=a,t[12]=o);let s=i?.variant==="default"&&l?`default`:`outline`,u;t[13]!==s||t[14]!==r.checking||t[15]!==r.refresh?(u=(0,X.jsx)(pe,{pending:r.checking,variant:s,size:`sm`,onClick:r.refresh,children:`Check again`}),t[13]=s,t[14]=r.checking,t[15]=r.refresh,t[16]=u):u=t[16];let d;t[17]!==u||t[18]!==e||t[19]!==o?(d=(0,X.jsxs)(`div`,{role:e,className:`flex w-full min-w-0 flex-wrap items-center gap-x-3 gap-y-2 rounded-lg border bg-muted px-3 py-2`,children:[o,u]}),t[17]=u,t[18]=e,t[19]=o,t[20]=d):d=t[20];let f=d,m;t[21]!==i||t[22]!==l?(m=i&&!l&&(0,X.jsx)(H,{size:`sm`,variant:i.variant??`outline`,disabled:i.disabled,"aria-description":i.description,onClick:i.onClick,children:i.label}),t[21]=i,t[22]=l,t[23]=m):m=t[23];let h=m,g=c&&h,_=!c&&h,v;return t[24]!==f||t[25]!==g||t[26]!==_?(v=(0,X.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col items-start gap-2`,children:[g,f,_]}),t[24]=f,t[25]=g,t[26]=_,t[27]=v):v=t[27],v}let _;t[28]!==n||t[29]!==r?(_=!r.noWriters&&(0,X.jsx)(Sl,{document:n,writer:r}),t[28]=n,t[29]=r,t[30]=_):_=t[30];let v;t[31]===p?v=t[32]:(v=p&&(0,X.jsx)(`p`,{className:`min-w-0 text-caption text-muted-foreground`,children:p}),t[31]=p,t[32]=v);let y;t[33]!==d||t[34]!==r.checking||t[35]!==r.refresh?(y=d&&(0,X.jsx)(pe,{pending:r.checking,variant:`ghost`,size:`sm`,onClick:r.refresh,children:`Check again`}),t[33]=d,t[34]=r.checking,t[35]=r.refresh,t[36]=y):y=t[36];let b;t[37]!==n||t[38]!==m?(b=m&&(0,X.jsx)(Ol,{document:n}),t[37]=n,t[38]=m,t[39]=b):b=t[39];let x;return t[40]!==g||t[41]!==_||t[42]!==v||t[43]!==y||t[44]!==b?(x=(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-1 gap-y-1`,children:[_,v,y,b,g]}),t[40]=g,t[41]=_,t[42]=v,t[43]=y,t[44]=b,t[45]=x):x=t[45],x}function Al(e){let t=(0,Z.c)(17),{document:n,writer:r,waiting:i,onWrite:a}=e,{connection:o}=n.context,{failed:s,noWriters:l,status:u}=r,d=ye(n.context)??u?.block,f=gr(n.scope,o,n.base===void 0),p=c(q(f.result)),m=n.base??p?.defaultRef,h=c(q(Wr(n.scope,o,n.base).result)),g=Qn(n.scope,o).changes.length,_=Pl({base:m?Gt(m):`the default branch`,commits:h?.commits,files:h?.files.length,uncommitted:g}),v=u===void 0&&!s&&!l,y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(`h1`,{id:`walkthrough-start`,className:`text-subpage-title font-semibold tracking-tight`,children:`No walkthrough yet.`}),t[0]=y):y=t[0];let b;t[1]===_?b=t[2]:(b=_&&(0,X.jsx)(`p`,{className:`text-prose text-foreground-2`,children:_}),t[1]=_,t[2]=b);let x;t[3]===b?x=t[4]:(x=(0,X.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[y,b]}),t[3]=b,t[4]=x);let S=!!d||v||i,C;t[5]!==a||t[6]!==S||t[7]!==d?(C={label:`Write walkthrough`,variant:`default`,disabled:S,description:d,onClick:a},t[5]=a,t[6]=S,t[7]=d,t[8]=C):C=t[8];let w;t[9]!==n||t[10]!==C||t[11]!==r?(w=(0,X.jsx)(kl,{document:n,writer:r,actionFirst:!0,action:C}),t[9]=n,t[10]=C,t[11]=r,t[12]=w):w=t[12];let T;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,X.jsx)(`dl`,{"aria-label":`What the walkthrough adds`,className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 text-caption`,children:Ml.map(jl)}),t[13]=T):T=t[13];let E;return t[14]!==x||t[15]!==w?(E=(0,X.jsxs)(`section`,{"aria-labelledby":`walkthrough-start`,className:`flex flex-col gap-4`,children:[x,w,T]}),t[14]=x,t[15]=w,t[16]=E):E=t[16],E}function jl(e){let[t,n]=e;return(0,X.jsxs)(`div`,{className:`contents`,children:[(0,X.jsx)(`dt`,{className:`text-foreground-2`,children:t}),(0,X.jsx)(`dd`,{className:`text-muted-foreground`,children:n})]},t)}var Ml=[[`Your calls`,`Decisions only you can make, each linked to its step.`],[`Verified`,`Pull request checks and screenshots at the commit it reads.`],[`Steps`,`The change in reading order, every claim beside its lines.`]];function Nl(e,t,n){return e===1?`1 ${t}`:`${e} ${n}`}function Pl({base:e,commits:t,files:n,uncommitted:r}){if(t===void 0||n===void 0)return;let i=[...t>0?[Nl(t,`commit`,`commits`)]:[],...n>0?[Nl(n,`changed file`,`changed files`)]:[],...r>0?[Nl(r,`uncommitted file`,`uncommitted files`)]:[]];if(i.length===0)return;let a=i.pop();return`It reads ${i.length>0?`${i.join(`, `)} and ${a}`:a} since ${e}.`}function Fl(e){let t=(0,Z.c)(18),{connection:n}=e.context,r;t[0]!==n||t[1]!==e.scope.projectId?(r=Ke(n,e.scope.projectId),t[0]=n,t[1]=e.scope.projectId,t[2]=r):r=t[2];let a=O(r),o;t[3]===n?o=t[4]:(o=Ne(n),t[3]=n,t[4]=o);let[s,c]=i(o),l;t[5]!==n||t[6]!==e.scope?(l=Ae(n,e.scope),t[5]=n,t[6]=e.scope,t[7]=l):l=t[7];let[u,d]=i(l),f;t[8]!==u||t[9]!==a?(f=Ue(a,u),t[8]=u,t[9]=a,t[10]=f):f=t[10];let p=a.waiting||s.waiting,m;t[11]===c?m=t[12]:(m=()=>c(void 0),t[11]=c,t[12]=m);let h;return t[13]!==d||t[14]!==f||t[15]!==p||t[16]!==m?(h={...f,choose:d,checking:p,refresh:m},t[13]=d,t[14]=f,t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function Il(e){let t=(0,Z.c)(16),{document:n,run:r,content:i}=e,{projectId:a}=n.scope,o=Io(n,r),s;t[0]!==i||t[1]!==n.context.connection||t[2]!==n.scope||t[3]!==r.headOid||t[4]!==r.id?(s=vt({connection:n.context.connection,scope:n.scope,runId:r.id,headOid:r.headOid,content:i}),t[0]=i,t[1]=n.context.connection,t[2]=n.scope,t[3]=r.headOid,t[4]=r.id,t[5]=s):s=t[5];let c=O(s),l=o?.detail;if(!o||!l)return null;let u=o.number,d=`Pull request #${u}`,f;t[6]!==n.context||t[7]!==o||t[8]!==u||t[9]!==a||t[10]!==l||t[11]!==c?(f=l.state===`open`?(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-1 gap-y-1.5`,children:[(0,X.jsx)(kt,{context:n.context,projectId:a,pull:l,label:`Merge #${u}`,review:c,reason:Fi({status:o.status,baseBranch:l.baseBranch,mergeMethods:l.mergeMethods,review:c}).waitsFor}),(0,X.jsxs)(H,{variant:`link`,size:`sm`,onClick:()=>o.openCheck(void 0),children:[`Open #`,u]})]}):(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,X.jsxs)(`p`,{className:`text-ui text-muted-foreground`,children:[`#`,u,` is `,l.state,`.`]}),(0,X.jsx)(Kt,{context:n.context,projectId:a,number:u})]}),t[6]=n.context,t[7]=o,t[8]=u,t[9]=a,t[10]=l,t[11]=c,t[12]=f):f=t[12];let p;return t[13]!==d||t[14]!==f?(p=(0,X.jsx)(`section`,{"aria-label":d,className:`flex flex-col gap-2 border-t pt-5`,children:f}),t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function Ll(e){let t=(0,Z.c)(23),{document:n,run:r,content:i,pull:a}=e,o;t[0]!==i||t[1]!==n.context.connection||t[2]!==n.scope||t[3]!==r.headOid||t[4]!==r.id?(o=vt({connection:n.context.connection,scope:n.scope,runId:r.id,headOid:r.headOid,content:i}),t[0]=i,t[1]=n.context.connection,t[2]=n.scope,t[3]=r.headOid,t[4]=r.id,t[5]=o):o=t[5];let s=O(o),c,l,u,d,f,p;if(t[6]!==a||t[7]!==s){p=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Li({pull:a,review:s});if(!e){p=null;break bb0}let{label:t,icon:n,quiet:r,pullState:i}=e;c=i,l=`status`,u=`Merge status`,d=`flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5`,f=t&&(0,X.jsxs)(`p`,{className:j(`flex min-w-0 items-start gap-2 text-ui font-medium text-pretty`,r&&`font-normal text-muted-foreground`),children:[(0,X.jsx)(`span`,{className:`flex h-4.5 shrink-0 items-center`,children:(0,X.jsx)(zn,{tone:n})}),(0,X.jsx)(`span`,{className:`min-w-0`,children:t})]})}t[6]=a,t[7]=s,t[8]=c,t[9]=l,t[10]=u,t[11]=d,t[12]=f,t[13]=p}else c=t[8],l=t[9],u=t[10],d=t[11],f=t[12],p=t[13];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m;t[14]!==a||t[15]!==c?(m=a&&(0,X.jsxs)(`button`,{type:`button`,onClick:()=>a.openCheck(void 0),className:`flex h-6 shrink-0 items-center gap-1.5 rounded-md border px-2 text-caption text-foreground-2 hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,X.jsx)(zt,{"aria-hidden":!0,className:`size-3.5`}),(0,X.jsxs)(`span`,{className:`font-medium tabular-nums`,children:[`#`,a.number]}),c&&(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:c}),(0,X.jsx)(`span`,{className:`sr-only`,children:`, open the pull request`})]}),t[14]=a,t[15]=c,t[16]=m):m=t[16];let h;return t[17]!==l||t[18]!==u||t[19]!==d||t[20]!==f||t[21]!==m?(h=(0,X.jsxs)(`div`,{role:l,"aria-label":u,className:d,children:[f,m]}),t[17]=l,t[18]=u,t[19]=d,t[20]=f,t[21]=m,t[22]=h):h=t[22],h}function Rl(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`div`,{className:`mx-auto flex w-full max-w-192 flex-col gap-10 px-5 py-8 @3xl:px-8 @3xl:py-12`,children:n}),t[0]=n,t[1]=r),r}function zl(e){let t=(0,Z.c)(13),{run:n,content:r,writer:i,files:a}=e,o,s;if(t[0]!==r||t[1]!==a||t[2]!==n||t[3]!==i?.settings?.models){let e=i?.settings?.models.find(e=>e.provider===n.writer.provider&&e.model===n.writer.model)?.label??n.writer.model;o=`whitespace-pre-line font-mono text-caption text-muted-foreground`,s=ht(n,r,r?e:void 0,a).split(` · `).map(Bl),t[0]=r,t[1]=a,t[2]=n,t[3]=i?.settings?.models,t[4]=o,t[5]=s}else o=t[4],s=t[5];let c;t[6]!==r||t[7]!==n?(c=!r&&ri(n)?`\n${ri(n)}`:``,t[6]=r,t[7]=n,t[8]=c):c=t[8];let l;return t[9]!==o||t[10]!==s||t[11]!==c?(l=(0,X.jsxs)(`p`,{className:o,children:[s,c]}),t[9]=o,t[10]=s,t[11]=c,t[12]=l):l=t[12],l}function Bl(e,t){return(0,X.jsxs)(`span`,{children:[t>0&&` · `,(0,X.jsx)(`span`,{className:`whitespace-nowrap`,children:e})]},e)}function Vl(e){let t=(0,Z.c)(5),{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;return t[3]===r?i=t[4]:(i=(0,X.jsx)(`h1`,{className:`text-subpage-title font-semibold tracking-tight text-balance`,children:(0,X.jsx)($,{text:r})}),t[3]=r,t[4]=i),i}function Hl(e){let t=(0,Z.c)(8),[n,r]=(0,Y.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,X.jsx)(Ul,{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 Ul(e){let t=(0,Z.c)(3),{hidden:n,onClick:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,X.jsx)(`div`,{className:`-ml-2`,children:(0,X.jsxs)(H,{variant:`link`,size:`sm`,onClick:r,children:[n,` more`]})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function Wl(e){let t=(0,Z.c)(10),{content:n}=e,r;t[0]===n?r=t[1]:(r=e=>qt(n,e),t[0]=n,t[1]=r);let{shown:i,more:a}=Hl(r),o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.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(Gl),t[3]=i,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,X.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,X.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 Gl(e,t){return(0,X.jsxs)(`li`,{className:`grid grid-cols-[1rem_minmax(0,1fr)] text-prose`,children:[(0,X.jsx)(`span`,{"aria-label":e.change,className:j(`font-mono`,e.change===`added`&&`text-add-fg`,e.change===`removed`&&`text-del-fg`,e.change===`changed`&&`text-muted-foreground`),children:tn(e)}),(0,X.jsxs)(`span`,{className:`wrap-anywhere`,children:[(0,X.jsxs)(`span`,{className:`font-medium`,children:[(0,X.jsx)($,{text:e.what}),`.`]}),` `,(0,X.jsx)(`span`,{className:`text-foreground-2`,children:(0,X.jsx)($,{text:e.note})})]})]},`${t}:${e.what}`)}function Kl(e){let t=(0,Z.c)(12),{content:n}=e,r;t[0]===n?r=t[1]:(r=e=>Xt(n,e),t[0]=n,t[1]=r);let{explained:i,unclear:a,more:o}=Hl(r),s;t[2]===a?s=t[3]:(s=a.map(Jl),t[2]=a,t[3]=s);let c;t[4]===i?c=t[5]:(c=i.map(ql),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,X.jsxs)(`ul`,{className:`flex flex-col gap-1 py-1 text-ui`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==o||t[10]!==l?(u=(0,X.jsxs)(X.Fragment,{children:[l,o]}),t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function ql(e,t){return(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`font-medium`,children:(0,X.jsx)($,{text:e.point})}),` `,(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:(0,X.jsx)($,{text:e.answer})})]},`${t}:${e.point}`)}function Jl(e,t){return(0,X.jsx)(`li`,{children:(0,X.jsx)($,{text:e})},`${t}:${e}`)}function Yl(e){let t=(0,Z.c)(123),{run:n,content:r,freshness:i,props:a,onUpdate:o,writeBlock:s,writer:c,updateFailure:l,progressRun:u,requesting:d,reused:f,code:p}=e,m;t[0]!==a||t[1]!==n?(m={...a,run:n},t[0]=a,t[1]=n,t[2]=m):m=t[2];let h=m,g=Io(a,n),_;t[3]===r?_=t[4]:(_=Xt(r,!1).total>0?(0,X.jsx)(Kl,{content:r}):void 0,t[3]=r,t[4]=_);let v=_,y=p.branch!==void 0,b;t[5]!==p.sections.outside||t[6]!==y?(b=Xn(p.sections.outside,y),t[5]=p.sections.outside,t[6]=y,t[7]=b):b=t[7];let x=b,S=x.length,C;t[8]!==r.stops||t[9]!==h?(C=e=>{let{step:t}=e,n=r.stops[t-1].title;return(0,X.jsx)(is,{owner:h,title:n,stepTitle:Rt(n)},n)},t[8]=r.stops,t[9]=h,t[10]=C):C=t[10];let w=C,T;t[11]===h?T=t[12]:(T=e=>{let{step:t,index:n,comparison:r}=e;return(0,X.jsx)(yl,{owner:h,step:t,index:n,comparison:r})},t[11]=h,t[12]=T);let E=T,D;t[13]!==a||t[14]!==l?.failure.message||t[15]!==c?(D=e=>(0,X.jsx)(kl,{document:a,writer:c,action:e,existingMessage:l?.failure.message}),t[13]=a,t[14]=l?.failure.message,t[15]=c,t[16]=D):D=t[16];let O;t[17]!==i||t[18]!==o||t[19]!==u||t[20]!==d||t[21]!==f||t[22]!==D||t[23]!==l||t[24]!==s?(O=(0,X.jsx)(ss,{run:u,requesting:d,reused:f,freshness:i,failure:l,onUpdate:o,writeBlock:s,controls:D}),t[17]=i,t[18]=o,t[19]=u,t[20]=d,t[21]=f,t[22]=D,t[23]=l,t[24]=s,t[25]=O):O=t[25];let k=O,A;t[26]!==p.branch||t[27]!==p.uncommitted?(A=p.branch?{committed:p.branch.files.map(Zl),uncommitted:p.uncommitted}:null,t[26]=p.branch,t[27]=p.uncommitted,t[28]=A):A=t[28];let j;t[29]!==r||t[30]!==n||t[31]!==A||t[32]!==c?(j=(0,X.jsx)(zl,{run:n,content:r,writer:c,files:A}),t[29]=r,t[30]=n,t[31]=A,t[32]=c,t[33]=j):j=t[33];let M;t[34]===r?M=t[35]:(M=(0,X.jsx)(Vl,{content:r}),t[34]=r,t[35]=M);let N;t[36]!==r||t[37]!==a||t[38]!==g||t[39]!==n?(N=(0,X.jsx)(Ll,{document:a,run:n,content:r,pull:g}),t[36]=r,t[37]=a,t[38]=g,t[39]=n,t[40]=N):N=t[40];let P;t[41]===r.summary?P=t[42]:(P=(0,X.jsx)(`p`,{className:`text-prose text-foreground-2`,children:(0,X.jsx)($,{text:r.summary})}),t[41]=r.summary,t[42]=P);let F;t[43]!==k||t[44]!==j||t[45]!==M||t[46]!==N||t[47]!==P?(F=(0,X.jsxs)(`header`,{className:`flex flex-col gap-3`,children:[j,M,N,P,k]}),t[43]=k,t[44]=j,t[45]=M,t[46]=N,t[47]=P,t[48]=F):F=t[48];let I=F;if(r.outcome===`nothing`){let e;t[49]===a?e=t[50]:(e=(0,X.jsx)(Gr,{owner:a}),t[49]=a,t[50]=e);let i;t[51]!==r||t[52]!==v||t[53]!==h||t[54]!==g||t[55]!==n||t[56]!==e?(i=(0,X.jsx)(kc,{run:n,content:r,owner:h,pull:g,notSaid:v,onJump:mc,comments:e}),t[51]=r,t[52]=v,t[53]=h,t[54]=g,t[55]=n,t[56]=e,t[57]=i):i=t[57];let o;t[58]!==p.branch||t[59]!==p.sections.outside||t[60]!==a?(o=(0,X.jsx)(al,{document:a,entry:`review:all`,code:p.sections.outside,branch:p.branch,eager:!0,label:`Every changed file`}),t[58]=p.branch,t[59]=p.sections.outside,t[60]=a,t[61]=o):o=t[61];let s;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(s=[],t[62]=s):s=t[62];let c;t[63]===h?c=t[64]:(c=(0,X.jsx)(as,{owner:h,titles:s}),t[63]=h,t[64]=c);let l;t[65]!==r||t[66]!==a||t[67]!==n?(l=(0,X.jsx)(Il,{document:a,run:n,content:r}),t[65]=r,t[66]=a,t[67]=n,t[68]=l):l=t[68];let u;return t[69]!==I||t[70]!==i||t[71]!==o||t[72]!==c||t[73]!==l?(u=(0,X.jsxs)(Rl,{children:[I,i,o,c,l]}),t[69]=I,t[70]=i,t[71]=o,t[72]=c,t[73]=l,t[74]=u):u=t[74],u}let L;t[75]===a?L=t[76]:(L=(0,X.jsx)(Gr,{owner:a}),t[75]=a,t[76]=L);let R;t[77]!==p.uncommitted||t[78]!==x?(R={uncommitted:p.uncommitted,uncovered:x},t[77]=p.uncommitted,t[78]=x,t[79]=R):R=t[79];let z;t[80]!==r||t[81]!==v||t[82]!==h||t[83]!==g||t[84]!==n||t[85]!==L||t[86]!==R?(z=(0,X.jsx)(kc,{run:n,content:r,owner:h,pull:g,notSaid:v,onJump:mc,comments:L,scope:R}),t[80]=r,t[81]=v,t[82]=h,t[83]=g,t[84]=n,t[85]=L,t[86]=R,t[87]=z):z=t[87];let B;t[88]===r?B=t[89]:(B=r.growth.length>0&&(0,X.jsx)(Wl,{content:r}),t[88]=r,t[89]=B);let V;t[90]!==p.branch||t[91]!==p.eager.steps||t[92]!==p.sections.steps||t[93]!==r||t[94]!==w||t[95]!==E||t[96]!==S||t[97]!==a||t[98]!==g||t[99]!==n?(V=(0,X.jsx)(vl,{content:r,run:n,props:a,code:p.sections.steps,branch:p.branch,eager:p.eager.steps,outside:S,conversation:w,decision:E,pull:g,onJump:mc}),t[90]=p.branch,t[91]=p.eager.steps,t[92]=p.sections.steps,t[93]=r,t[94]=w,t[95]=E,t[96]=S,t[97]=a,t[98]=g,t[99]=n,t[100]=V):V=t[100];let H;t[101]===r.stops?H=t[102]:(H=r.stops.map(Xl),t[101]=r.stops,t[102]=H);let U;t[103]!==h||t[104]!==H?(U=(0,X.jsx)(as,{owner:h,titles:H}),t[103]=h,t[104]=H,t[105]=U):U=t[105];let W;t[106]!==p.branch||t[107]!==p.eager.outside||t[108]!==p.sections.outside||t[109]!==a?(W=eu(p.sections.outside,p.branch)&&(0,X.jsxs)(`section`,{"aria-labelledby":`review-not-covered`,className:`flex flex-col gap-2.5 border-t pt-5`,children:[(0,X.jsx)(`h2`,{id:`review-not-covered`,className:`text-section font-semibold text-pretty`,children:`Not covered by the steps`}),(0,X.jsx)(al,{document:a,entry:`review:not-covered`,code:p.sections.outside,branch:p.branch,eager:p.eager.outside,label:`Not covered by the steps`})]}),t[106]=p.branch,t[107]=p.eager.outside,t[108]=p.sections.outside,t[109]=a,t[110]=W):W=t[110];let ee;t[111]!==r||t[112]!==a||t[113]!==n?(ee=(0,X.jsx)(Il,{document:a,run:n,content:r}),t[111]=r,t[112]=a,t[113]=n,t[114]=ee):ee=t[114];let te;return t[115]!==I||t[116]!==z||t[117]!==B||t[118]!==V||t[119]!==U||t[120]!==W||t[121]!==ee?(te=(0,X.jsxs)(Rl,{children:[I,z,B,V,U,W,ee]}),t[115]=I,t[116]=z,t[117]=B,t[118]=V,t[119]=U,t[120]=W,t[121]=ee,t[122]=te):te=t[122],te}function Xl(e){return e.title}function Zl(e){return e.path}function Ql(e){let t=(0,Z.c)(5),{run:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,X.jsxs)(`header`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(zl,{run:n}),(0,X.jsx)(ss,{run:n,first:!0})]}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,X.jsxs)(Rl,{children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function $l(e){let t=(0,Z.c)(21),{run:n,failure:r,waiting:i,onRetry:a,writeBlock:o,document:s,writer:c,children:l}=e,u;t[0]!==s||t[1]!==r.message||t[2]!==c?(u=e=>(0,X.jsx)(kl,{document:s,writer:c,existingMessage:r.message,action:e}),t[0]=s,t[1]=r.message,t[2]=c,t[3]=u):u=t[3];let d=u,f=i||!!o,p,m,h;if(t[4]!==r||t[5]!==a||t[6]!==d||t[7]!==n||t[8]!==f||t[9]!==i||t[10]!==o){let e={label:`Try again`,disabled:f,description:o,onClick:a};p=Rl,m=`flex flex-col gap-3`,h=n?(0,X.jsx)(ss,{run:n,requesting:i,first:!0,failure:{failure:r,writer:n.writer},onUpdate:a,writeBlock:o,controls:d}):(0,X.jsxs)(`section`,{"aria-label":`Walkthrough status`,className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border p-4 text-ui`,children:[(0,X.jsx)(os,{copy:lr(r,n)}),d(e)]}),t[4]=r,t[5]=a,t[6]=d,t[7]=n,t[8]=f,t[9]=i,t[10]=o,t[11]=p,t[12]=m,t[13]=h}else p=t[11],m=t[12],h=t[13];let g;t[14]!==m||t[15]!==h?(g=(0,X.jsx)(`header`,{className:m,children:h}),t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;return t[17]!==p||t[18]!==l||t[19]!==g?(_=(0,X.jsxs)(p,{children:[g,l]}),t[17]=p,t[18]=l,t[19]=g,t[20]=_):_=t[20],_}var eu=(e,t)=>t!==void 0&&e.branch.length>0||e.worktree.length>0;function tu(e,t){let n=(0,Z.c)(14),r=e.interaction.hidden===!0,i=Dr(Qn(e.scope,e.context.connection),r),a=Dr(Wr(e.scope,e.context.connection,e.base).result,r),o,s,l;if(n[0]!==i.changes||n[1]!==t||n[2]!==a){o=c(q(a));let e=jn({content:t?.outcome===`nothing`?void 0:t,branch:o?.files??[],worktree:i.changes});s=e,l=Vt(e,o!==void 0,25),n[0]=i.changes,n[1]=t,n[2]=a,n[3]=o,n[4]=s,n[5]=l}else o=n[3],s=n[4],l=n[5];let u;n[6]===i.changes?u=n[7]:(u=i.changes.map(nu),n[6]=i.changes,n[7]=u);let d=o!==void 0,f;return n[8]!==o||n[9]!==s||n[10]!==l||n[11]!==u||n[12]!==d?(f={sections:s,eager:l,branch:o,uncommitted:u,settled:d},n[8]=o,n[9]=s,n[10]=l,n[11]=u,n[12]=d,n[13]=f):f=n[13],f}function nu(e){return e.path}function ru(e){let t=(0,Z.c)(24),n=Fl(e),r=ye(e.context)??n.status?.block,{result:i,phase:a,read:o,refresh:s}=Eo(e.scope,e.context),c=Fo(e.scope,e.context,e.base,a&&a.kind!==`unwritten`?a.run:void 0,n.next),l;t[0]!==a||t[1]!==o||t[2]!==c?(l=o?Lr(Ra(o,c.accepted)):a,t[0]=a,t[1]=o,t[2]=c,t[3]=l):l=t[3];let u=l,d=tu(e,u?.kind===`ready`?u.content:void 0),f;t[4]!==d.branch||t[5]!==d.sections.outside||t[6]!==e?(f=(0,X.jsx)(al,{document:e,entry:`review:all`,code:d.sections.outside,branch:d.branch,eager:!0,label:`Every changed file`}),t[4]=d.branch,t[5]=d.sections.outside,t[6]=e,t[7]=f):f=t[7];let p=f;if(u===void 0){let e;return t[8]!==p||t[9]!==s||t[10]!==i?(e=me(i)?(0,X.jsx)(`div`,{"data-review-scroll":``,className:`@container h-full overflow-auto`,children:(0,X.jsxs)(Rl,{children:[(0,X.jsx)(D,{className:`px-0`,description:`The walkthrough could not be read.`,onRetry:s}),p]})}):(0,X.jsx)(at,{label:`Loading walkthrough`}),t[8]=p,t[9]=s,t[10]=i,t[11]=e):e=t[11],e}let m;t[12]!==d||t[13]!==p||t[14]!==u||t[15]!==e||t[16]!==c||t[17]!==r||t[18]!==n?(m=()=>{let t=Dt(u,c.failure);if(t)return(0,X.jsx)($l,{run:t.run,failure:t.failure,waiting:c.waiting,onRetry:c.start,writeBlock:r,document:e,writer:n,children:p});switch(u.kind){case`unwritten`:return d.settled&&!eu(d.sections.outside,d.branch)?(0,X.jsx)(Zn,{...e}):(0,X.jsxs)(Rl,{children:[(0,X.jsx)(Al,{document:e,writer:n,waiting:c.waiting,onWrite:c.start}),p]});case`writing`:return(0,X.jsx)(Ql,{run:u.run,children:p});case`failed`:return(0,X.jsx)($l,{run:u.run,failure:u.failure,waiting:c.waiting,onRetry:c.start,writeBlock:r,document:e,writer:n,children:p});case`ready`:{let t=It(u,c);return(0,X.jsx)(Yl,{run:u.run,content:u.content,freshness:u.freshness,props:e,onUpdate:c.start,writeBlock:r,writer:n,progressRun:u.attempt??u.run,requesting:c.waiting,reused:c.accepted?.state.status===`ready`&&c.accepted.id===u.run.id,updateFailure:t.failure,code:d},u.run.id)}}},t[12]=d,t[13]=p,t[14]=u,t[15]=e,t[16]=c,t[17]=r,t[18]=n,t[19]=m):m=t[19];let h=m,g;t[20]===h?g=t[21]:(g=h(),t[20]=h,t[21]=g);let _;return t[22]===g?_=t[23]:(_=(0,X.jsx)(`div`,{"data-review-scroll":``,className:`@container h-full overflow-auto`,children:g}),t[22]=g,t[23]=_),_}var iu={open:{text:`Call`,label:`Your call`,className:`text-warn`},"needs-commit":{text:`Needs commit`,label:`Your call, needs a new commit`,className:`text-warn`},decided:{text:`Decided`,label:`Your call, decided`,className:`text-muted-foreground`}};function au(e){let t=(0,Z.c)(6),{owner:n,content:r,step:i}=e,{view:a}=Ko(n),o=cn(r,i,a?.decisions);if(!o)return null;let s=iu[o],c=s.label,l;t[0]===s.className?l=t[1]:(l=j(`shrink-0 text-2xs font-medium`,s.className),t[0]=s.className,t[1]=l);let u;return t[2]!==s.label||t[3]!==s.text||t[4]!==l?(u=(0,X.jsx)(`span`,{role:`img`,"aria-label":c,className:l,children:s.text}),t[2]=s.label,t[3]=s.text,t[4]=l,t[5]=u):u=t[5],u}function ou(e,t){let n=(0,Z.c)(8),r;n[0]!==t||n[1]!==e?(r={scope:e,context:t},n[0]=t,n[1]=e,n[2]=r):r=n[2];let{view:i}=In(r),a;n[3]===i?a=n[4]:(a=ni(i),n[3]=i,n[4]=a);let o=a,s;return n[5]!==o||n[6]!==i?(s=(e,t)=>{let n=Rt(e.title);return t.reduce((e,t)=>e+(o.get(t)??0),0)+Hn(i,e=>(e.kind===`step`||e.kind===`node`)&&e.title===n).length},n[5]=o,n[6]=i,n[7]=s):s=n[7],s}function su(e){let t=(0,Z.c)(23),{path:n,where:r,onOpen:i}=e,a=r===`worktree`?`Uncommitted`:`Committed`,o=r===`worktree`?`Uncommitted`:`Branch`,s=`${n}\n${a}: listed under ${o}, not in this list`,c;t[0]===n?c=t[1]:(c=bn(n),t[0]=n,t[1]=c);let l=`${c} · ${a}, listed under ${o}`,u;t[2]!==i||t[3]!==n||t[4]!==r?(u=()=>i(r===`worktree`?{kind:`change`,path:n}:{kind:`branch-file`,path:n}),t[2]=i,t[3]=n,t[4]=r,t[5]=u):u=t[5];let d,f;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=j(Un,`text-muted-foreground`),f=(0,X.jsx)(`span`,{className:`w-3.5 shrink-0`}),t[6]=d,t[7]=f):(d=t[6],f=t[7]);let p;t[8]===n?p=t[9]:(p=(0,X.jsx)(nn,{path:n,className:`size-3.5 shrink-0 opacity-60`}),t[8]=n,t[9]=p);let m;t[10]===n?m=t[11]:(m=bn(n),t[10]=n,t[11]=m);let h;t[12]===m?h=t[13]:(h=(0,X.jsx)(K,{className:`min-w-0 flex-1`,text:m}),t[12]=m,t[13]=h);let g;t[14]===a?g=t[15]:(g=(0,X.jsx)(`span`,{className:`shrink-0 text-2xs`,children:a}),t[14]=a,t[15]=g);let _;return t[16]!==s||t[17]!==g||t[18]!==l||t[19]!==u||t[20]!==p||t[21]!==h?(_=(0,X.jsxs)(`button`,{type:`button`,title:s,"aria-label":l,onClick:u,className:d,children:[f,p,h,g]}),t[16]=s,t[17]=g,t[18]=l,t[19]=u,t[20]=p,t[21]=h,t[22]=_):_=t[22],_}function cu(e){let t=(0,Z.c)(18),{steps:n,activeEntry:r,onOpen:i,row:a,comments:o,elsewhere:s,callMark:c}=e;if(n.length===0)return null;let l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsxs)(`p`,{className:`flex px-2 pt-2 pb-1 text-2xs text-muted-foreground`,children:[(0,X.jsx)(`span`,{children:`By step`}),(0,X.jsx)(`span`,{className:`ml-auto`,children:`Files`})]}),t[0]=l):l=t[0];let u;if(t[1]!==r||t[2]!==c||t[3]!==o||t[4]!==s||t[5]!==i||t[6]!==a||t[7]!==n){let e;t[9]!==r||t[10]!==c||t[11]!==o||t[12]!==s||t[13]!==i||t[14]!==a?(e=e=>{let{stop:t,step:n,files:l}=e,u=o(t,e.paths),d=l.length+e.elsewhere.length,f={kind:`walkthrough-step`,step:n},p=r===mr(f);return(0,X.jsxs)(`div`,{role:`group`,"aria-label":`Step ${n}`,className:`flex flex-col`,children:[(0,X.jsxs)(Rr,{plain:!0,label:`Step ${n}`,active:p,onOpen:()=>i(f),children:[(0,X.jsx)(`span`,{className:`w-3.5 shrink-0 text-center font-mono text-2xs text-muted-foreground`,children:n}),(0,X.jsx)(K,{className:`min-w-0 flex-1`,text:Rt(t.title)}),t.callouts.length>0&&c(n),u>0&&(0,X.jsxs)(`span`,{"aria-label":u===1?`1 comment`:`${u} comments`,className:`flex shrink-0 items-center gap-0.5 text-2xs text-muted-foreground tabular-nums`,children:[(0,X.jsx)(jt,{"aria-hidden":!0,className:`size-3`}),u]}),(0,X.jsx)(`span`,{"aria-label":d===1?`1 file`:`${d} files`,className:`ml-auto text-2xs text-muted-foreground tabular-nums`,children:d})]}),(0,X.jsxs)(`div`,{className:`pl-3`,children:[l.map(a),e.elsewhere.map(e=>(0,X.jsx)(su,{path:e,where:s,onOpen:i},e))]})]},n)},t[9]=r,t[10]=c,t[11]=o,t[12]=s,t[13]=i,t[14]=a,t[15]=e):e=t[15],u=n.map(e),t[1]=r,t[2]=c,t[3]=o,t[4]=s,t[5]=i,t[6]=a,t[7]=n,t[8]=u}else u=t[8];let d;return t[16]===u?d=t[17]:(d=(0,X.jsxs)(`div`,{className:`mt-1 flex flex-col`,children:[l,u]}),t[16]=u,t[17]=d),d}function lu(e,t,n,r,i){return e.stops.flatMap((e,a)=>{let o=t.steps[a];if(o===void 0)return[];let{here:s,elsewhere:c}=Tn(o,n),l=r.filter(e=>s.includes(i(e)));return l.length===0?[]:[{stop:e,step:a+1,files:l,elsewhere:c,paths:[...l.map(i),...c]}]})}function uu(e){let t=(0,Z.c)(14),{files:n,row:r,context:i}=e,a=yi(i.connection),o,s;if(t[0]!==n||t[1]!==r||t[2]!==a){let e=a?n.filter(fu):[],i;t[5]!==n||t[6]!==a?(i=a?n.filter(du):n,t[5]=n,t[6]=a,t[7]=i):i=t[7];let c=i;t[8]!==c||t[9]!==r?(o=c.length>0&&(0,X.jsxs)(`div`,{role:`group`,"aria-label":`Not in the walkthrough yet`,className:`mt-1 flex flex-col`,children:[(0,X.jsx)(`p`,{className:`px-2 pt-2 pb-1 text-2xs text-muted-foreground`,children:`Not in the walkthrough yet`}),c.map(r)]}),t[8]=c,t[9]=r,t[10]=o):o=t[10],s=e.length>0&&(0,X.jsxs)(`div`,{role:`group`,"aria-label":`Specs`,className:`mt-1 flex flex-col`,children:[(0,X.jsx)(`p`,{className:`px-2 pt-2 pb-1 text-2xs text-muted-foreground`,children:`Specs`}),e.map(r)]}),t[0]=n,t[1]=r,t[2]=a,t[3]=o,t[4]=s}else o=t[3],s=t[4];let c;return t[11]!==o||t[12]!==s?(c=(0,X.jsxs)(X.Fragment,{children:[o,s]}),t[11]=o,t[12]=s,t[13]=c):c=t[13],c}function du(e){return!ii(e.path)}function fu(e){return ii(e.path)}function pu(e){let t=(0,Z.c)(31),{scope:n,context:r,base:i,items:a,row:o,activeEntry:s,onOpen:c}=e,l=Do(n,r),u=ou(n,r),d=Qn(n,r.connection),f=jn({content:l?.content,branch:a,worktree:d.changes}),p=Pc(n,r.connection,i,f.steps.flatMap(hu));if(!l||l.content.stops.length===0){let e;if(t[0]!==a||t[1]!==o){let n;t[3]===o?n=t[4]:(n=e=>o(e),t[3]=o,t[4]=n),e=a.map(n),t[0]=a,t[1]=o,t[2]=e}else e=t[2];let n;return t[5]===e?n=t[6]:(n=(0,X.jsx)(X.Fragment,{children:e}),t[5]=e,t[6]=n),n}let m=lu(l.content,f,`branch`,a,mu),h=new Set(f.outside.branch),g;t[7]!==o||t[8]!==p?(g=e=>{let t=p(e.path);return o(e,{tick:!0,trailing:t&&(0,X.jsx)(Jc,{size:t})})},t[7]=o,t[8]=p,t[9]=g):g=t[9];let _;t[10]!==r||t[11]!==l.content||t[12]!==l.run||t[13]!==n?(_=e=>(0,X.jsx)(au,{owner:{scope:n,context:r,run:l.run},content:l.content,step:e}),t[10]=r,t[11]=l.content,t[12]=l.run,t[13]=n,t[14]=_):_=t[14];let v;t[15]!==s||t[16]!==u||t[17]!==c||t[18]!==m||t[19]!==g||t[20]!==_?(v=(0,X.jsx)(cu,{steps:m,activeEntry:s,onOpen:c,row:g,comments:u,elsewhere:`worktree`,callMark:_}),t[15]=s,t[16]=u,t[17]=c,t[18]=m,t[19]=g,t[20]=_,t[21]=v):v=t[21];let y=a.filter(e=>h.has(e.path)),b;t[22]===o?b=t[23]:(b=e=>o(e,{tick:!0}),t[22]=o,t[23]=b);let x;t[24]!==r||t[25]!==y||t[26]!==b?(x=(0,X.jsx)(uu,{files:y,row:b,context:r}),t[24]=r,t[25]=y,t[26]=b,t[27]=x):x=t[27];let S;return t[28]!==v||t[29]!==x?(S=(0,X.jsxs)(X.Fragment,{children:[v,x]}),t[28]=v,t[29]=x,t[30]=S):S=t[30],S}function mu(e){return e.path}function hu(e){return e.branch}function gu(e){let t=(0,Z.c)(47),{scope:n,context:r,base:i,paths:a,row:o,activeEntry:s,onOpen:l}=e,u=Do(n,r),d=Wr(n,r.connection,i).result,f=c(q(d)),p=Qn(n,r.connection),m=ou(n,r);if(a.length===0){let e=u?`Nothing uncommitted.`:`No changes`,n;return t[0]===e?n=t[1]:(n=(0,X.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:e}),t[0]=e,t[1]=n),n}let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=mr(en),t[2]=h):h=t[2];let g=s===h,_;t[3]===l?_=t[4]:(_=()=>l(en),t[3]=l,t[4]=_);let v,y;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(kn,{className:`size-3.5 shrink-0 text-muted-foreground`}),y=(0,X.jsx)(`span`,{className:`min-w-0 flex-1`,children:`All changes`}),t[5]=v,t[6]=y):(v=t[5],y=t[6]);let b;t[7]===a.length?b=t[8]:(b=(0,X.jsx)(`span`,{className:`ml-auto text-2xs text-muted-foreground tabular-nums`,children:a.length}),t[7]=a.length,t[8]=b);let x;t[9]!==g||t[10]!==_||t[11]!==b?(x=(0,X.jsxs)(Rr,{plain:!0,label:`All changes`,active:g,onOpen:_,children:[v,y,b]}),t[9]=g,t[10]=_,t[11]=b,t[12]=x):x=t[12];let S=x;if(!u||u.content.stops.length===0){let e;if(t[13]!==a||t[14]!==o){let n;t[16]===o?n=t[17]:(n=e=>o(e),t[16]=o,t[17]=n),e=a.map(n),t[13]=a,t[14]=o,t[15]=e}else e=t[15];let n;return t[18]!==S||t[19]!==e?(n=(0,X.jsxs)(`div`,{className:`flex flex-col`,children:[S,e]}),t[18]=S,t[19]=e,t[20]=n):n=t[20],n}let C;t[21]===a?C=t[22]:(C=e=>a.includes(e.path),t[21]=a,t[22]=C);let w=jn({content:u.content,branch:f?.files??[],worktree:p.changes.filter(C)}),T=lu(u.content,w,`worktree`,a,vu),E=new Set(w.outside.worktree),D;t[23]===o?D=t[24]:(D=e=>o(e,{tick:!0}),t[23]=o,t[24]=D);let O;t[25]!==r||t[26]!==u.content||t[27]!==u.run||t[28]!==n?(O=e=>(0,X.jsx)(au,{owner:{scope:n,context:r,run:u.run},content:u.content,step:e}),t[25]=r,t[26]=u.content,t[27]=u.run,t[28]=n,t[29]=O):O=t[29];let k;t[30]!==s||t[31]!==m||t[32]!==l||t[33]!==T||t[34]!==O||t[35]!==D?(k=(0,X.jsx)(cu,{steps:T,activeEntry:s,onOpen:l,row:D,comments:m,elsewhere:`branch`,callMark:O}),t[30]=s,t[31]=m,t[32]=l,t[33]=T,t[34]=O,t[35]=D,t[36]=k):k=t[36];let A=a.filter(e=>E.has(e)).map(_u),j;t[37]===o?j=t[38]:(j=e=>o(e.path,{tick:!0}),t[37]=o,t[38]=j);let M;t[39]!==r||t[40]!==A||t[41]!==j?(M=(0,X.jsx)(uu,{files:A,row:j,context:r}),t[39]=r,t[40]=A,t[41]=j,t[42]=M):M=t[42];let N;return t[43]!==S||t[44]!==k||t[45]!==M?(N=(0,X.jsxs)(`div`,{className:`flex flex-col`,children:[S,k,M]}),t[43]=S,t[44]=k,t[45]=M,t[46]=N):N=t[46],N}function _u(e){return{path:e}}function vu(e){return e}var yu={branch:pu,uncommitted:gu};function bu(e){let t=(0,Z.c)(2),n;return t[0]===e?n=t[1]:(n=(0,X.jsx)(Tr,{...e,grouping:yu}),t[0]=e,t[1]=n),n}function xu(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,X.jsx)(Su,{...e}),t[3]=e,t[4]=r);let i;return t[5]!==e.context.connection||t[6]!==n||t[7]!==r?(i=(0,X.jsx)(Kn,{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 Su(e){let t=(0,Z.c)(13),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=Ao(r,e.context),a=ko(r,e.context),o;t[3]!==e.worktree.id||t[4]!==a?(o=hn({worktreeId:e.worktree.id,title:a}),t[3]=e.worktree.id,t[4]=a,t[5]=o):o=t[5],A(o);let s;t[6]!==i.guided||t[7]!==i.pending?(s={pending:i.pending,guided:i.guided},t[6]=i.guided,t[7]=i.pending,t[8]=s):s=t[8];let c=s,l=i.guided?bu:Tr,u;return t[9]!==c||t[10]!==e||t[11]!==l?(u=(0,X.jsx)(hr,{...e,review:ru,changesNavigation:l,walkthroughCode:il,firstDocument:c}),t[9]=c,t[10]=e,t[11]=l,t[12]=u):u=t[12],u}function Cu(e){let t={projectId:e.projectId,worktreeId:e.worktreeId};return e.remote===null?oe({to:`/$projectId/$worktreeId`,params:t}):oe({to:`/remotes/$environmentId/$projectId/$worktreeId`,params:{environmentId:e.remote,...t}})}function wu(e,t){let n=(0,Z.c)(2),r=Er(e,t,Tu),i;return n[0]===r?i=n[1]:(i=()=>r?r():void zr.open({payload:{remote:null}}),n[0]=r,n[1]=i),i}function Tu(e){return Je({title:`Could not open the project`,description:s(e),type:`error`})}function Eu(e){let t=(0,Z.c)(12),{connection:n,empty:r,settingsOpen:i}=e,a=st(),o=Me(),{setOpenMobile:s}=Ut(),c;t[0]!==r||t[1]!==a||t[2]!==s?(c=e=>(s(!1),a({...Cu(e),replace:r})),t[0]=r,t[1]=a,t[2]=s,t[3]=c):c=t[3];let l=c,u=wu(n,l),d;t[4]!==a||t[5]!==u||t[6]!==i?(d=U(e=>{typeof e==`object`||i||(e===`open-settings`?a({to:`/settings/$section`,params:{section:xr}}):u())}),t[4]=a,t[5]=u,t[6]=i,t[7]=d):d=t[7],A(d);let f;return t[8]!==n||t[9]!==l||t[10]!==o?(f=(0,X.jsx)(Yn,{connection:n,remotes:o,onOpened:l}),t[8]=n,t[9]=l,t[10]=o,t[11]=f):f=t[11],f}function Du(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=j(`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,X.jsx)(n,{className:`size-5`}),t[2]=n,t[3]=o);let s;return t[4]!==a||t[5]!==o?(s=(0,X.jsx)(`span`,{"aria-hidden":`true`,className:a,children:o}),t[4]=a,t[5]=o,t[6]=s):s=t[6],s}function Ou(e){let t=(0,Z.c)(4),{keys:n}=e,r;t[0]===n?r=t[1]:(r=n.split(`+`).map(ku),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,X.jsx)(dt,{children:r}),t[2]=r,t[3]=i),i}function ku(e){return(0,X.jsx)(sn,{className:`min-w-6 justify-center`,children:Ni(e)},e)}function Au(e){let t=(0,Z.c)(6),{open:n,onOpenChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(Du,{icon:Mr}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsxs)(Fn,{className:`flex-row items-center text-left`,children:[i,(0,X.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,X.jsx)(qr,{children:`Keyboard shortcuts`}),(0,X.jsx)(tr,{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,X.jsxs)(ir,{initialFocus:`[data-dialog-close]`,className:`max-h-[85svh] grid-rows-[auto_minmax(0,1fr)] overflow-hidden sm:max-w-xl`,children:[a,(0,X.jsx)(Vr,{className:`-mr-3 min-h-0`,children:(0,X.jsx)(`div`,{className:`flex flex-col gap-5 pr-3`,children:ui.map(ju)})})]}),t[2]=o):o=t[2];let s;return t[3]!==r||t[4]!==n?(s=(0,X.jsx)(yr,{open:n,onOpenChange:r,children:o}),t[3]=r,t[4]=n,t[5]=s):s=t[5],s}function ju(e){return(0,X.jsxs)(`section`,{"aria-labelledby":`shortcuts-${e.title}`,children:[(0,X.jsx)(`h3`,{id:`shortcuts-${e.title}`,className:`mb-1 text-xs font-medium tracking-wide text-muted-foreground uppercase`,children:e.title}),(0,X.jsx)(`dl`,{className:`divide-y rounded-xl border`,children:e.items.map(Mu)})]},e.title)}function Mu(e){return(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-3 py-2`,children:[(0,X.jsx)(`dt`,{className:`text-sm`,children:e.label}),(0,X.jsx)(`dd`,{className:`shrink-0`,children:(0,X.jsx)(Ou,{keys:e.keys})})]},e.keys)}var Nu={"not-found":`Page not found`,"missing-worktree":`Worktree not found`,empty:`Select a worktree on the left`};function Pu(e){let t=(0,Z.c)(120),{review:n,remote:r,unavailable:i,connecting:a,remoteStatus:o,showRemoteNotice:s,notice:c,background:l}=e,u=a!==void 0&&a,d=l!==void 0&&l,f=Nn(),p=O(ee),m=De(ee),h;t[0]!==d||t[1]!==p||t[2]!==m?(h=e=>{e&&p&&!d&&(e.focus(),document.activeElement===e&&m(!1))},t[0]=d,t[1]=p,t[2]=m,t[3]=h):h=t[3];let g=h,_;t[4]!==g||t[5]!==f?(_=e=>{f.attach(e),g(e)},t[4]=g,t[5]=f,t[6]=_):_=t[6];let v;t[7]!==_||t[8]!==f.element?(v={element:f.element,attach:_},t[7]=_,t[8]=f.element,t[9]=v):v=t[9];let y=v,[b,x]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(!1),{setOpenMobile:w,isMobile:T,open:E,openMobile:D}=Ut(),A;t[10]===w?A=t[11]:(A=(e,t)=>{x(!e&&t.reason===`escape-key`),w(e)},t[10]=w,t[11]=A);let j;t[12]!==y||t[13]!==b||t[14]!==g?(j=e=>{!e&&b&&(x(!1),y.element?.focus()),e||g(y.element)},t[12]=y,t[13]=b,t[14]=g,t[15]=j):j=t[15];let M;t[16]!==A||t[17]!==j?(M={onOpenChange:A,onOpenChangeComplete:j},t[16]=A,t[17]=j,t[18]=M):M=t[18];let N=M,P=st(),F=ge(),I;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(I={select:Fu},t[19]=I):I=t[19];let R=ut(I),z=fe(),B=Rn(z.connection),V;t[20]===B?V=t[21]:(V=Ee(B,k(B)?.id),t[20]=B,t[21]=V);let H=V,U=!c&&B.projects.length===0,W=Nu[c??`empty`];Me();let te=fe(r?.connection),G;t[22]!==o||t[23]!==te?(G={...te,remoteStatus:o},t[22]=o,t[23]=te,t[24]=G):G=t[24];let ne=G,re=r?.remote.environmentId??null,ie;t[25]!==n||t[26]!==re?(ie=n&&{remote:re,projectId:n.selection.projectId,worktreeId:n.selection.worktree.id},t[25]=n,t[26]=re,t[27]=ie):ie=t[27];let K=ie,ae=n?.selection.worktree.id??``,oe;t[28]===ae?oe=t[29]:(oe=Xr(ae),t[28]=ae,t[29]=oe);let se=O(oe),ce;t[30]!==se||t[31]!==r||t[32]!==n?(ce=n?dr({firstDocument:se,entry:n.search.entry,surface:n.search.surface,project:n.inventory.projects.find(e=>e.id===n.selection.projectId)?.name,environment:r||n.inventory.environment.custom?n.inventory.environment.name:void 0}):`Porcelain`,t[30]=se,t[31]=r,t[32]=n,t[33]=ce):ce=t[33],or(d?void 0:ce);let le;t[34]!==P||t[35]!==n||t[36]!==w?(le=e=>(w(!1),P({...Cu(e),replace:n===void 0})),t[34]=P,t[35]=n,t[36]=w,t[37]=le):le=t[37];let q=le,J=wu(z.connection,q),ue;t[38]!==T||t[39]!==D||t[40]!==w?(ue=()=>{let e=T&&D;return w(!1),{settingsFromNavigator:e}},t[38]=T,t[39]=D,t[40]=w,t[41]=ue):ue=t[41];let de=ue,pe;t[42]!==de||t[43]!==P?(pe=e=>{P({to:`/settings/$section`,params:{section:e===void 0?xr:e},state:de()})},t[42]=de,t[43]=P,t[44]=pe):pe=t[44];let me=pe,he;t[45]!==z.connection||t[46]!==P||t[47]!==n?.search||t[48]!==w||t[49]!==K?(he=e=>{if(e.pullRequest.state!==`available`||!e.pullRequest.number)return;w(!1);let t=K??(e.worktreeId?{remote:e.environmentId===z.connection.environmentId?null:e.environmentId,projectId:e.projectId,worktreeId:e.worktreeId}:void 0);if(!t)return;let r=mr(mt({projectId:e.projectId,number:e.pullRequest.number,environmentId:e.environmentId,shownOn:t.remote??z.connection.environmentId}));P({...Cu(t),search:{...n?.search??{},entry:r}})},t[45]=z.connection,t[46]=P,t[47]=n?.search,t[48]=w,t[49]=K,t[50]=he):he=t[50];let _e;t[51]===J?_e=t[52]:(_e=e=>e?void zr.open({payload:{remote:e.remote.environmentId}}):J(),t[51]=J,t[52]=_e);let ve,ye;t[53]===me?(ve=t[54],ye=t[55]):(ve=()=>me(),ye=()=>me(`computers`),t[53]=me,t[54]=ve,t[55]=ye);let be;t[56]!==de||t[57]!==P?(be=e=>{P({to:`/settings/$section/$environmentId`,params:{section:`computers`,environmentId:e},state:de()})},t[56]=de,t[57]=P,t[58]=be):be=t[58];let xe;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(xe=()=>C(!0),t[59]=xe):xe=t[59];let Se;t[60]!==s||t[61]!==K||t[62]!==void 0||t[63]!==he||t[64]!==_e||t[65]!==ve||t[66]!==ye||t[67]!==be?(Se={remotes:void 0,selected:K,showRemoteNotice:s,onOpenPullRequest:he,onOpenProject:_e,onOpenSettings:ve,onManageComputers:ye,onOpenRemotes:be,onOpenShortcuts:xe},t[60]=s,t[61]=K,t[62]=void 0,t[63]=he,t[64]=_e,t[65]=ve,t[66]=ye,t[67]=be,t[68]=Se):Se=t[68];let Ce=Se,we;t[69]!==R||t[70]!==P||t[71]!==F||t[72]!==K?(we=(e,t)=>{if(!K)return;let n=Cu(K);if(F.buildLocation({}).pathname!==F.buildLocation(n).pathname)return;let r=t?.implicitReview===!0||R&&!(`entry`in e);P({...n,search:t=>({...t,...e}),replace:t?.replace??!1,state:r?{implicitReview:!0}:{}})},t[69]=R,t[70]=P,t[71]=F,t[72]=K,t[73]=we):we=t[73];let Te=we,Oe;t[74]===me?Oe=t[75]:(Oe=()=>me(),t[74]=me,t[75]=Oe);let ke;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(ke={ignoreInputs:!0},t[76]=ke):ke=t[76],_i(li.openSettings,Oe,ke);let Ae,je;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=()=>C(!0),je={ignoreInputs:!0},t[77]=Ae,t[78]=je):(Ae=t[77],je=t[78]),_i(li.openShortcuts,Ae,je);let Ne;t[79]!==T||t[80]!==N||t[81]!==Ce||t[82]!==q?(Ne=T&&(0,X.jsx)(wn,{variant:`floating`,...N,children:(0,X.jsx)(vn,{...Ce,onSelect:e=>void q(e)})}),t[79]=T,t[80]=N,t[81]=Ce,t[82]=q,t[83]=Ne):Ne=t[83];let Pe;t[84]===q?Pe=t[85]:(Pe=e=>void q(e),t[84]=q,t[85]=Pe);let Fe;t[86]!==Ce||t[87]!==Pe?(Fe={...Ce,onSelect:Pe},t[86]=Ce,t[87]=Pe,t[88]=Fe):Fe=t[88];let Ie;t[89]!==u||t[90]!==ne||t[91]!==U||t[92]!==R||t[93]!==T||t[94]!==W||t[95]!==y||t[96]!==Ce||t[97]!==c||t[98]!==Te||t[99]!==E||t[100]!==J||t[101]!==D||t[102]!==H||t[103]!==r||t[104]!==n||t[105]!==w||t[106]!==re||t[107]!==i?(Ie=n?(0,X.jsx)(xu,{navigationTrigger:y,worktree:n.selection.worktree,projectId:n.selection.projectId,search:R&&n.search.entry===void 0?{...n.search,entry:Ct}:n.search,onSearch:Te,context:ne},`${re??``}:${n.selection.worktree.id}`):(0,X.jsx)(Iu,{navigationTrigger:y,isMobile:T,open:E,openMobile:D,children:(0,X.jsx)(Lu,{remote:r,connecting:u,unavailable:i,firstRun:U,onOpenRemotes:Ce.onOpenRemotes,onOpenProject:()=>{w(!1),J()},notice:(0,X.jsx)(L,{message:W,action:(0,X.jsx)(Ru,{notice:c,recovery:H})})})}),t[89]=u,t[90]=ne,t[91]=U,t[92]=R,t[93]=T,t[94]=W,t[95]=y,t[96]=Ce,t[97]=c,t[98]=Te,t[99]=E,t[100]=J,t[101]=D,t[102]=H,t[103]=r,t[104]=n,t[105]=w,t[106]=re,t[107]=i,t[108]=Ie):Ie=t[108];let Le;t[109]!==T||t[110]!==E||t[111]!==Fe||t[112]!==Ie?(Le=(0,X.jsx)(ai,{navigator:Fe,isMobile:T,open:E,children:Ie}),t[109]=T,t[110]=E,t[111]=Fe,t[112]=Ie,t[113]=Le):Le=t[113];let Re;t[114]===S?Re=t[115]:(Re=(0,X.jsx)(Au,{open:S,onOpenChange:C}),t[114]=S,t[115]=Re);let ze;return t[116]!==Ne||t[117]!==Le||t[118]!==Re?(ze=(0,X.jsxs)(X.Fragment,{children:[Ne,Le,Re]}),t[116]=Ne,t[117]=Le,t[118]=Re,t[119]=ze):ze=t[119],ze}function Fu(e){return e.state.implicitReview===!0}function Iu(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=ki(Ci(li.toggleNavigator,re())),t[2]=l):l=t[2];let u;t[3]!==s||t[4]!==c?(u=(0,X.jsx)(x,{render:(0,X.jsx)(Mt,{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,X.jsxs)(He,{side:`right`,children:[`Toggle sidebar`,(0,X.jsx)(sn,{children:Ni(li.toggleNavigator)})]}),t[6]=d):d=t[6];let f;t[7]===u?f=t[8]:(f=(0,X.jsxs)(C,{children:[u,d]}),t[7]=u,t[8]=f);let p;return t[9]!==o||t[10]!==f?(p=(0,X.jsxs)(`div`,{className:`relative grid h-full min-h-0 place-items-center rounded-paper border bg-card p-8 max-md:rounded-none max-md:border-0 [&>[data-slot=state-notice]]:justify-center [&>[data-slot=state-notice]]:text-center`,children:[f,o]}),t[9]=o,t[10]=f,t[11]=p):p=t[11],p}function Lu(e){let t=(0,Z.c)(14),{remote:n,connecting:r,unavailable:i,firstRun:a,onOpenRemotes:o,onOpenProject:s,notice:c}=e;if(n&&r){let e=`Connecting to ${n.remote.name}`,r;return t[0]===e?r=t[1]:(r=(0,X.jsx)(at,{label:e}),t[0]=e,t[1]=r),r}if(n&&i){let e;t[2]===n.connection.liveUpdates?e=t[3]:(e=()=>n.connection.liveUpdates.retry(),t[2]=n.connection.liveUpdates,t[3]=e);let r;t[4]!==o||t[5]!==n.remote.environmentId?(r=()=>o(n.remote.environmentId),t[4]=o,t[5]=n.remote.environmentId,t[6]=r):r=t[6];let a;return t[7]!==n.remote.name||t[8]!==e||t[9]!==r||t[10]!==i?(a=(0,X.jsx)(ke,{name:n.remote.name,status:i,onRetry:e,onOpenRemotes:r}),t[7]=n.remote.name,t[8]=e,t[9]=r,t[10]=i,t[11]=a):a=t[11],a}if(a){let e;return t[12]===s?e=t[13]:(e=(0,X.jsx)(H,{size:`sm`,onClick:s,children:`Open project`}),t[12]=s,t[13]=e),e}return c}function Ru(e){let t=(0,Z.c)(11),{notice:n,recovery:r}=e;if(n===`missing-worktree`&&r){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=j(o({size:`sm`})),t[0]=e):e=t[0];let n;t[1]!==r.projectId||t[2]!==r.worktree.id?(n={projectId:r.projectId,worktreeId:r.worktree.id},t[1]=r.projectId,t[2]=r.worktree.id,t[3]=n):n=t[3];let i;return t[4]!==e||t[5]!==n?(i=(0,X.jsx)(ae,{className:e,to:`/$projectId/$worktreeId`,params:n,children:`Open available worktree`}),t[4]=e,t[5]=n,t[6]=i):i=t[6],i}if(n){let e;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=j(o({variant:`outline`,size:`sm`})),t[7]=e):e=t[7];let n;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(n={},t[8]=n):n=t[8];let r;return t[9]===e?r=t[10]:(r=(0,X.jsx)(ae,{className:e,to:`/`,search:n,children:`Back to workspace`}),t[9]=e,t[10]=r),r}return null}function zu(e){let t=(0,Z.c)(19),{projectId:n,worktreeId:r,search:i,remote:a,settled:o,remoteStatus:s,showRemoteNotice:c,background:l}=e,{connection:u}=fe(a?.connection),d=Rn(u),f;t[0]!==d||t[1]!==r?(f=Ee(d,r),t[0]=d,t[1]=r,t[2]=f):f=t[2];let p=f;if(p?.projectId!==n){if(!o){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Ln,{}),t[3]=e):e=t[3],e}let e;return t[4]!==i||t[5]!==r?(e=(0,X.jsx)(ct,{to:`/`,search:{...i,worktree:r},replace:!0}),t[4]=i,t[5]=r,t[6]=e):e=t[6],e}let m;t[7]!==d||t[8]!==i||t[9]!==p?(m={selection:p,search:i,inventory:d},t[7]=d,t[8]=i,t[9]=p,t[10]=m):m=t[10];let h;t[11]===a?h=t[12]:(h=a?{remote:a}:{},t[11]=a,t[12]=h);let g;return t[13]!==l||t[14]!==s||t[15]!==c||t[16]!==m||t[17]!==h?(g=(0,X.jsx)(Vu,{review:m,...h,remoteStatus:s,showRemoteNotice:c,background:l}),t[13]=l,t[14]=s,t[15]=c,t[16]=m,t[17]=h,t[18]=g):g=t[18],g}var Bu=h(void 0);function Vu(e){let t=(0,Z.c)(4),n;t[0]===e.remote?n=t[1]:(n=e.remote?Pe(e.remote.remote.environmentId):Bu,t[0]=e.remote,t[1]=n),A(n);let r;return t[2]===e?r=t[3]:(r=(0,X.jsx)(Pu,{...e}),t[2]=e,t[3]=r),r}var Hu={kind:`home`,pathname:`/`,search:{}};function Uu(e){if(!e)return Hu;let{pathname:t}=e;switch(e.routeId){case`/_paired/`:return{kind:`home`,pathname:t,search:e.search};case`/_paired/$projectId/$worktreeId`:return{kind:`worktree`,pathname:t,projectId:e.params.projectId,worktreeId:e.params.worktreeId,search:e.search};case`/_paired/remotes/$environmentId/$projectId/$worktreeId`:return{kind:`remote`,pathname:t,environmentId:e.params.environmentId,projectId:e.params.projectId,worktreeId:e.params.worktreeId,search:e.search};case`/_paired/settings/$section/`:case`/_paired/settings/$section/$environmentId`:return Pr(e.params.section,`environmentId`in e.params?e.params.environmentId:void 0)?{kind:`settings`}:{kind:`not-found`,pathname:t};default:return{kind:`not-found`,pathname:t}}}function Wu(e){let t=(0,Z.c)(9),n;t[0]===e?n=t[1]:(n=JSON.stringify(e),t[0]=e,t[1]=n);let r=n,i;t[2]!==e||t[3]!==r?(i=()=>({key:r,view:e.kind===`settings`?Hu:e}),t[2]=e,t[3]=r,t[4]=i):i=t[4];let[a,o]=(0,Y.useState)(i);e.kind!==`settings`&&a.key!==r&&o({key:r,view:e});let s;return t[5]!==a||t[6]!==e||t[7]!==r?(s=e.kind===`settings`?{workspace:a.view,workspaceKey:a.key,settingsOpen:!0}:{workspace:e,workspaceKey:r,settingsOpen:!1},t[5]=a,t[6]=e,t[7]=r,t[8]=s):s=t[8],s}function Gu(e){let t=(0,Z.c)(18),{view:n,settled:r,background:i,resetKey:a}=e,o=di(),s=!i,c;t[0]!==o.hotkey||t[1]!==s?(c={...o.hotkey,enabled:s},t[0]=o.hotkey,t[1]=s,t[2]=c):c=t[2];let l;t[3]!==o||t[4]!==c?(l={...o,hotkey:c},t[3]=o,t[4]=c,t[5]=l):l=t[5];let u;t[6]===a?u=t[7]:(u=()=>a,t[6]=a,t[7]=u);let d;t[8]!==i||t[9]!==r||t[10]!==n?(d=(0,X.jsx)(Ku,{view:n,settled:r,background:i}),t[8]=i,t[9]=r,t[10]=n,t[11]=d):d=t[11];let f;t[12]!==u||t[13]!==d?(f=(0,X.jsx)(Ir,{getResetKey:u,errorComponent:Hi,children:d}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,X.jsx)(bi,{defaultOptions:l,children:f}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function Ku(e){let t=(0,Z.c)(19),{view:n,settled:r,background:i}=e;switch(n.kind){case`home`:{let e;return t[0]!==i||t[1]!==r||t[2]!==n.search?(e=(0,X.jsx)(qu,{search:n.search,settled:r,background:i}),t[0]=i,t[1]=r,t[2]=n.search,t[3]=e):e=t[3],e}case`worktree`:{let e;return t[4]!==i||t[5]!==r||t[6]!==n.projectId||t[7]!==n.search||t[8]!==n.worktreeId?(e=(0,X.jsx)(zu,{projectId:n.projectId,worktreeId:n.worktreeId,search:n.search,settled:r,background:i}),t[4]=i,t[5]=r,t[6]=n.projectId,t[7]=n.search,t[8]=n.worktreeId,t[9]=e):e=t[9],e}case`remote`:{let e;return t[10]!==i||t[11]!==r||t[12]!==n.environmentId||t[13]!==n.projectId||t[14]!==n.search||t[15]!==n.worktreeId?(e=(0,X.jsx)(Ju,{environmentId:n.environmentId,projectId:n.projectId,worktreeId:n.worktreeId,search:n.search,settled:r,background:i},n.environmentId),t[10]=i,t[11]=r,t[12]=n.environmentId,t[13]=n.projectId,t[14]=n.search,t[15]=n.worktreeId,t[16]=e):e=t[16],e}case`not-found`:{let e;return t[17]===i?e=t[18]:(e=(0,X.jsx)(Pu,{notice:`not-found`,background:i}),t[17]=i,t[18]=e),e}}}function qu(e){let t=(0,Z.c)(18),{search:n,settled:r,background:i}=e,a,o;t[0]===n?(a=t[1],o=t[2]):({worktree:o,...a}=n,t[0]=n,t[1]=a,t[2]=o);let{connection:s}=fe(),c=Rn(s),l;t[3]!==c||t[4]!==o?(l=o===void 0?Ee(c,k(c)?.id):Ee(c,o),t[3]=c,t[4]=o,t[5]=l):l=t[5];let u=l;if(u&&r){let e;t[6]!==u.projectId||t[7]!==u.worktree.id?(e={projectId:u.projectId,worktreeId:u.worktree.id},t[6]=u.projectId,t[7]=u.worktree.id,t[8]=e):e=t[8];let n;t[9]!==a||t[10]!==o?(n=o===void 0?{}:a,t[9]=a,t[10]=o,t[11]=n):n=t[11];let r;return t[12]!==e||t[13]!==n?(r=(0,X.jsx)(ct,{to:`/$projectId/$worktreeId`,params:e,search:n,replace:!0}),t[12]=e,t[13]=n,t[14]=r):r=t[14],r}let d=o!==void 0&&r?`missing-worktree`:void 0,f;return t[15]!==i||t[16]!==d?(f=(0,X.jsx)(Pu,{notice:d,background:i}),t[15]=i,t[16]=d,t[17]=f):f=t[17],f}function Ju(e){let t=(0,Z.c)(7);Re(e.environmentId);{if(!e.settled){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(Ln,{}),t[0]=e):e=t[0],e}let n;return t[1]!==e.search||t[2]!==e.worktreeId?(n=(0,X.jsx)(ct,{to:`/`,search:{...e.search,worktree:e.worktreeId},replace:!0}),t[1]=e.search,t[2]=e.worktreeId,t[3]=n):n=t[3],n}}function Yu(){let e=(0,Z.c)(11),t=_e(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={select:Zu},e[0]=n):n=e[0];let{workspace:r,workspaceKey:i,settingsOpen:a}=Wu(Hr(n)),o;e[1]===r?o=e[2]:(o={select:e=>e.status===`idle`&&e.location.pathname===r.pathname},e[1]=r,e[2]=o);let s=Ui(o),c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c={select:Xu},e[3]=c):c=e[3];let l=Ui(c),u;return e[4]!==t||e[5]!==l||e[6]!==a||e[7]!==s||e[8]!==r||e[9]!==i?(u=t?(0,X.jsxs)(Co,{children:[(0,X.jsx)(Gu,{view:r,settled:s,background:a,resetKey:i}),(0,X.jsx)(Cr,{}),(0,X.jsx)(Eu,{connection:t,empty:l,settingsOpen:a})]}):(0,X.jsx)(ct,{to:`/pair`,replace:!0}),e[4]=t,e[5]=l,e[6]=a,e[7]=s,e[8]=r,e[9]=i,e[10]=u):u=e[10],u}function Xu(e){return e.location.pathname===`/`}function Zu(e){return Uu(e.at(-1))}export{Yu as component};