@open-mercato/cezar 0.18.0 → 0.19.0-pr1815.4229

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/dist/automations/automation-cli.js +12 -6
  2. package/dist/automations/automation-cli.js.map +1 -1
  3. package/dist/automations/prompts.js +3 -1
  4. package/dist/automations/prompts.js.map +1 -1
  5. package/dist/automations/schedule-runner.js +18 -4
  6. package/dist/automations/schedule-runner.js.map +1 -1
  7. package/dist/automations/store.js +9 -2
  8. package/dist/automations/store.js.map +1 -1
  9. package/dist/automations/templates.js +1 -0
  10. package/dist/automations/templates.js.map +1 -1
  11. package/dist/automations/types.d.ts +28 -0
  12. package/dist/automations/types.js +6 -2
  13. package/dist/automations/types.js.map +1 -1
  14. package/dist/contract/automation-schedule.d.ts +28 -0
  15. package/dist/contract/automations.d.ts +126 -0
  16. package/dist/contract/github.d.ts +56 -0
  17. package/dist/contract/index.js +63 -0
  18. package/dist/contract/workspace.d.ts +18 -0
  19. package/dist/server/forge/github-issue-metadata.d.ts +6 -0
  20. package/dist/server/forge/github-issue-metadata.js +66 -0
  21. package/dist/server/forge/github-issue-metadata.js.map +1 -0
  22. package/dist/server/forge/github.d.ts +1 -1
  23. package/dist/server/forge/github.js +38 -4
  24. package/dist/server/forge/github.js.map +1 -1
  25. package/dist/server/forge/types.d.ts +2 -17
  26. package/dist/server/server.d.ts +320 -36
  27. package/dist/server/server.js +21 -20
  28. package/dist/server/server.js.map +1 -1
  29. package/dist/workflows/run.js +7 -0
  30. package/dist/workflows/run.js.map +1 -1
  31. package/package.json +3 -3
  32. package/web/dist/assets/{agent-task-pickers-DbNIzx20.js → agent-task-pickers-_i7QNEVz.js} +1 -1
  33. package/web/dist/assets/{alert-dialog-4Kna6Hd7.js → alert-dialog-BZU09BVw.js} +1 -1
  34. package/web/dist/assets/arrow-down-BQxdXW9w.js +1 -0
  35. package/web/dist/assets/arrow-left-CvmEanh8.js +1 -0
  36. package/web/dist/assets/automation-format-CEBKDGz8.js +1 -0
  37. package/web/dist/assets/automations-route-Cg1sWvtN.js +1 -0
  38. package/web/dist/assets/button-BvYDiOkd.js +100 -0
  39. package/web/dist/assets/{centered-state-D-wDs7Y1.js → centered-state-Bpq40Y_t.js} +1 -1
  40. package/web/dist/assets/check-DC3eAaS2.js +1 -0
  41. package/web/dist/assets/chevron-left-BW4WDtiS.js +1 -0
  42. package/web/dist/assets/chevron-right-DuM1UAhq.js +1 -0
  43. package/web/dist/assets/circle-check-DiPv45P_.js +1 -0
  44. package/web/dist/assets/{clipboard-DQGL_gUp.js → clipboard-7kWKIj7k.js} +1 -1
  45. package/web/dist/assets/{collapsible-D7qsttC5.js → collapsible-OE3rGS50.js} +1 -1
  46. package/web/dist/assets/{commit-list-DTMGEn0-.js → commit-list-DalU6p3i.js} +1 -1
  47. package/web/dist/assets/{compare-variants-DqlkpLFs.js → compare-variants-CuCfgtyG.js} +1 -1
  48. package/web/dist/assets/dashboard-BYBop-ZJ.js +44 -0
  49. package/web/dist/assets/{diff-DY-_mmb0.js → diff-DfTKq2z2.js} +2 -2
  50. package/web/dist/assets/{diff-view-oTEcZZ_O.js → diff-view-Du2463vL.js} +1 -1
  51. package/web/dist/assets/{download-BBtWFvsh.js → download-_KH0gJo8.js} +1 -1
  52. package/web/dist/assets/facet-filter-BSS2vFA8.js +5 -0
  53. package/web/dist/assets/{file-CbWEaOku.js → file-d2ABwdSR.js} +1 -1
  54. package/web/dist/assets/file-preview-BURiO97x.js +2 -0
  55. package/web/dist/assets/{git-pull-request-draft-Dwhm6Vhn.js → git-pull-request-draft-DIdbQZ0O.js} +1 -1
  56. package/web/dist/assets/git-tab-loading-8Y0ID8J2.js +1 -0
  57. package/web/dist/assets/{git-toolbar-C3vpZJaZ.js → git-toolbar-CSrf6Ux9.js} +1 -1
  58. package/web/dist/assets/github-DQ8J0EYw.js +1 -0
  59. package/web/dist/assets/{host-usage-CI_ZlJQu.js → host-usage-EK6T4fAW.js} +1 -1
  60. package/web/dist/assets/{icon-tooltip-CgAWLDxo.js → icon-tooltip-nRvCJxOH.js} +1 -1
  61. package/web/dist/assets/index-BVPhzJ3k.js +31 -0
  62. package/web/dist/assets/index-HmrjUHlJ.css +2 -0
  63. package/web/dist/assets/{input-Br4NQpZK.js → input-90eli0Uk.js} +1 -1
  64. package/web/dist/assets/{layout-cards-fdJa2H62.js → layout-cards-n-2Pwe6c.js} +1 -1
  65. package/web/dist/assets/{lib-w_5wfsBF.js → lib-C4vuyY62.js} +1 -1
  66. package/web/dist/assets/loader-circle-DAforPX2.js +1 -0
  67. package/web/dist/assets/{markdown-G3dvGJao.js → markdown-BBnagS_c.js} +1 -1
  68. package/web/dist/assets/{markdown-BfZORc0a.js → markdown-DLB6o6YD.js} +1 -1
  69. package/web/dist/assets/{message-square-Dl-ol3uz.js → message-square-WCEmfkiD.js} +1 -1
  70. package/web/dist/assets/plus-BJEPAJjW.js +1 -0
  71. package/web/dist/assets/{project-router-DgQSavhI.js → project-router-7DKoABD3.js} +1 -1
  72. package/web/dist/assets/queries-DsfjHsrp.js +1 -0
  73. package/web/dist/assets/{reference-chip-BxUGeHDa.js → reference-chip-frnxjI-K.js} +1 -1
  74. package/web/dist/assets/repo-git-DVREyQYa.js +1 -0
  75. package/web/dist/assets/{run-diff-CqXLVaDj.js → run-diff-CmqQmGTJ.js} +1 -1
  76. package/web/dist/assets/{save-ByUa-aAl.js → save-CCb1fwTJ.js} +1 -1
  77. package/web/dist/assets/{scroll-within-Dexi68h1.js → scroll-within-CNcaqKGp.js} +1 -1
  78. package/web/dist/assets/{search-x-CLuL49ms.js → search-x-Cm22V3TC.js} +1 -1
  79. package/web/dist/assets/{settings-2-BvalJGW-.js → settings-2-CWK1otJs.js} +1 -1
  80. package/web/dist/assets/skills-B0OolFqS.js +1 -0
  81. package/web/dist/assets/{square-FwRsgrg-.js → square-B-gfdc5r.js} +1 -1
  82. package/web/dist/assets/{tabs-nC1VLjcX.js → tabs-D3hCl7A6.js} +1 -1
  83. package/web/dist/assets/{tag-CteJEZQp.js → tag-C5TeSwBA.js} +1 -1
  84. package/web/dist/assets/{task-commits-CYcqwz-f.js → task-commits-DIrIWA6g.js} +1 -1
  85. package/web/dist/assets/{task-graph-CJfTnzUp.js → task-graph-Diq4xAP_.js} +1 -1
  86. package/web/dist/assets/{task-notes-DxH2q3Hr.js → task-notes-DnIcoZgS.js} +1 -1
  87. package/web/dist/assets/task-workspace-DhUBQLGl.js +29 -0
  88. package/web/dist/assets/{terminal-aoRx5eKS.js → terminal-BIKtPgmL.js} +1 -1
  89. package/web/dist/assets/{terminal-drawer-CuGVJS-l.js → terminal-drawer-f0Tw3yHw.js} +2 -2
  90. package/web/dist/assets/{textarea-X_NVmVlZ.js → textarea-D6BGJB7j.js} +1 -1
  91. package/web/dist/assets/{token-metrics-CdH7TbLP.js → token-metrics-CMdTXREP.js} +1 -1
  92. package/web/dist/assets/{tooltip-C2bzSwbQ.js → tooltip-Bb7ddw0_.js} +1 -1
  93. package/web/dist/assets/{tracker-BYs-vq6-.js → tracker-BDiIqG2R.js} +2 -2
  94. package/web/dist/assets/{triangle-alert-BdMPm9Jb.js → triangle-alert-BhQYv6Is.js} +1 -1
  95. package/web/dist/assets/{upload-DrvICo_K.js → upload-Crivm77f.js} +1 -1
  96. package/web/dist/assets/{use-now-Byfm730u.js → use-now-BW1HO2p_.js} +1 -1
  97. package/web/dist/assets/{use-submit-shortcut-B41NLqM4.js → use-submit-shortcut-oBvmLiAo.js} +1 -1
  98. package/web/dist/assets/{workflow-graph-ppdi5xyK.js → workflow-graph-DJLPSGD3.js} +3 -3
  99. package/web/dist/assets/{worktree-lifecycle-operation-CvU6xu3u.js → worktree-lifecycle-operation-DL-RTic4.js} +2 -2
  100. package/web/dist/index.html +39 -39
  101. package/dist/telemetry-service.json +0 -1
  102. package/web/dist/assets/arrow-left-B1Ed0tpu.js +0 -1
  103. package/web/dist/assets/automation-format-CXffJGqm.js +0 -1
  104. package/web/dist/assets/automations-route-ruFF7d59.js +0 -1
  105. package/web/dist/assets/button-wdWSPx_B.js +0 -100
  106. package/web/dist/assets/check-DvAMBXJe.js +0 -1
  107. package/web/dist/assets/chevron-left-Dqb1lvgZ.js +0 -1
  108. package/web/dist/assets/chevron-right-DDQuVTY1.js +0 -1
  109. package/web/dist/assets/circle-check-BiVc-j8x.js +0 -1
  110. package/web/dist/assets/dashboard-BX4228zB.js +0 -44
  111. package/web/dist/assets/facet-filter-B_AsFqFx.js +0 -5
  112. package/web/dist/assets/file-preview-DEKEA-Hk.js +0 -2
  113. package/web/dist/assets/git-tab-loading-w5Ne43J6.js +0 -1
  114. package/web/dist/assets/github-Hshin4wG.js +0 -1
  115. package/web/dist/assets/index-CQ1cB3qE.css +0 -2
  116. package/web/dist/assets/index-D-pGbO9R.js +0 -31
  117. package/web/dist/assets/loader-circle-CwT0JWiv.js +0 -1
  118. package/web/dist/assets/plus-BwQyZgNP.js +0 -1
  119. package/web/dist/assets/queries-BTgOLNTK.js +0 -1
  120. package/web/dist/assets/repo-git-B47L82oV.js +0 -1
  121. package/web/dist/assets/skills-Bu12y3Zp.js +0 -1
  122. package/web/dist/assets/task-workspace-7NHIdOyT.js +0 -29
@@ -0,0 +1,5 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{$n as i,Ea as a,Gr as o,Ia as s,Jn as c,M as l,N as u,Na as d,Pa as f,Pr as p,Qn as m,Ta as h,Vn as g,Wn as _,Xn as v,Yi as y,Yn as b,Zn as x,_r as S,dr as C,er as w,na as T,nn as E,qn as D,r as O,wr as k}from"./queries-DsfjHsrp.js";import{B as ee,Bt as te,F as A,R as j,V as M,Yt as ne,dt as N,ft as re,ht as P,ot as ie,r as F}from"./button-BvYDiOkd.js";import{f as I,s as L}from"./project-router-7DKoABD3.js";import{C as ae,a as R,o as oe,r as z}from"./reference-chip-frnxjI-K.js";import{d as se,f as ce,h as le,l as B,m as ue,p as de,v as fe}from"./use-now-BW1HO2p_.js";import{t as pe}from"./check-DC3eAaS2.js";import{f as me}from"./tooltip-Bb7ddw0_.js";import{t as he}from"./clipboard-7kWKIj7k.js";var ge=e(n()),V=e(t(),1),H=new Map,_e=e=>({status:e.status,archived:e.archived,awaitingAnswerSince:e.awaitingAnswerSince}),U=new Map,ve=new Set,W=0;function ye(e,t){t?U.set(e,W+1):U.delete(e),W++,ve.forEach(e=>e())}function be(e,t){let n=`${e}:${typeof t==`string`?t:t.id}`;H.delete(n),H.set(n,{value:typeof t==`string`?null:_e(t),revision:W+1}),H.size>2e3&&H.delete(H.keys().next().value),W++,ve.forEach(e=>e())}function xe(e){return(0,V.useSyncExternalStore)(e=>(ve.add(e),()=>{ve.delete(e)}),()=>W),Ce(e.projectId,e.id)}var Se=()=>W,Ce=(e,t)=>U.has(e)?null:H.get(`${e}:${t}`)?.value;function we(e,t=[]){let n=new Map(t.map(e=>[`${e.projectId}:${e.id}`,e])),r=!1;for(let n of t){let t=U.get(n.projectId);t!==void 0&&t<=e&&(U.delete(n.projectId),r=!0)}for(let[t,i]of H){let a=n.get(t);i.revision>e||!a||(a.status!==void 0&&a.archived!==void 0?(H.set(t,{value:_e({status:a.status,archived:a.archived,awaitingAnswerSince:a.awaitingAnswerSince}),revision:W+1}),r=!0):i.value===null&&(H.delete(t),r=!0))}r&&(W++,ve.forEach(e=>e()))}function Te(e=()=>performance.now()){let t=new Map,n=new Set,r,i={connected:!1,samples:[]},a=()=>{i={...i,samples:[...t.values()].map(e=>e.sample)},n.forEach(e=>e())},o=()=>{let n=!1;for(let[r,i]of t)i.deadline<=e()&&(t.delete(r),n=!0);n&&a()};return{getSnapshot:()=>i,subscribe(e){return n.add(e),r||=setInterval(o,1e3),o(),()=>{n.delete(e),n.size||(clearInterval(r),r=void 0)}},expire:o,connected(e){i.connected!==e&&(i={...i,connected:e},a())},replace(n,r,i){for(let[e,r]of t)r.sample.projectId===n&&t.delete(e);let o=i?Date.parse(i):NaN;for(let i of r){let r=Math.max(0,o-Date.parse(i.sampledAt));Number.isFinite(r)&&r<1e4&&i.projectId===n&&t.set(`${n}:${i.runId}`,{sample:i,deadline:e()+1e4-r})}a()},seed(n,r){for(let[e,n]of t)Date.parse(n.sample.sampledAt)<=Date.parse(r)&&t.delete(e);for(let i of n){let n=Math.max(0,Date.parse(r)-Date.parse(i.sampledAt));Number.isFinite(n)&&n<1e4&&!t.has(`${i.projectId}:${i.runId}`)&&t.set(`${i.projectId}:${i.runId}`,{sample:i,deadline:e()+1e4-n})}a()},remove(e,n){for(let[r,i]of t)i.sample.projectId===e&&(!n||i.sample.runId===n)&&t.delete(r);a()}}}var G=Te(),Ee=()=>(0,V.useSyncExternalStore)(G.subscribe,G.getSnapshot);function De(e){return{enabled:(e&&typeof e==`object`?e:{}).enabled===!0}}function Oe(){let e=globalThis.Notification;if(typeof e!=`function`)return`unsupported`;let t=e.permission;return t===`granted`||t===`denied`?t:`default`}function ke(e,t){let n=new Map,r=[];for(let i of t??[]){n.set(i.id,i.status);let t=e.get(i.id);t===void 0||t===i.status||_(i)&&r.push(i)}return{entering:r,statuses:n}}function Ae(e){return e.enabled&&e.hidden&&e.permission===`granted`}function je(e){let t=g(e).label;return{title:e.titleSummary??e.title,body:`Task ${t}`,tag:`cezar-run-${e.id}`}}function Me(e){return Oe()===`granted`&&Ne(e)?!0:De(e.getQueryData(E.uiState)?.notifications).enabled&&Oe()===`granted`}function Ne(e){return Oe()===`granted`&&e.getQueryData(E.uiState)===void 0}var K=r(),Pe=`${j(`/workspace/events`)}?slim=1`,Fe=2,Ie=3e3,Le=[`run`,`run-deleted`,`todos`,`usage`,`ping`],Re=[`project-added`,`project-removed`,`checkout-progress`,`automation-change`,`tracker-changed`],ze=new Set;function Be(e){return ze.add(e),()=>{ze.delete(e)}}var Ve=400,He=15e3;function Ue(e){let t;return{onEvent(n){n.type!==`run`&&n.type!==`run-deleted`||t===void 0&&(t=setTimeout(()=>{t=void 0,e.invalidateQueries({queryKey:E.runsIndex})},Ve))},cancel(){clearTimeout(t),t=void 0}}}var We=[500,1500];function Ge(e){let t=new Set,n=new Map,r=new Set,i=!1,a=e=>{t.delete(e),n.delete(e)},s=(t,r,i)=>{let o=n.get(t);if(a(t),o?.kind===`deleted`){e.setQueryData(r,e=>c(e,i.id));return}e.setQueryData(r,e=>{let t=e!==void 0&&e.some(e=>e.id===i.id)?e:b(e,i);return o?.kind===`run`?b(t,o.frame):t})},l=(t,n,c,u,d)=>{o(c,u).then(e=>{i||s(t,n,e)}).catch(o=>{if(i)return;let s=We[d],f=o instanceof w&&o.status>=400&&o.status<500;if(s===void 0||f){a(t),s===void 0&&e.invalidateQueries({queryKey:n,refetchType:`active`});return}let p=setTimeout(()=>{r.delete(p),i||l(t,n,c,u,d+1)},s);r.add(p)})};return{run(e,r){if(i)return;let a=M(),o=`${a}\0${e}`;if(t.has(o)){n.set(o,{kind:`run`,frame:r});return}t.add(o),l(o,[a,`runs`,`list`],a,e,0)},deleted(e){if(i)return;let r=`${M()}\0${e}`;t.has(r)&&n.set(r,{kind:`deleted`})},cancel(){i=!0;for(let e of r)clearTimeout(e);r.clear(),t.clear(),n.clear()}}}function Ke(e,t){let n;for(let t of e.getQueryCache().getAll()){if(t.queryKey[1]!==`health`)continue;let e=t.state.data?.bootProject;if(typeof e==`string`){n=e;break}}let r=new Set([t]);return n===t&&r.add(`default`),[...r]}function qe(e){return[[`run-history`,e],[`run-history-context`,e],[`run-history-tail`,e]]}function Je(e){return[[e,`runs`],[e,`todos`],[e,`worktrees`],...qe(e)]}function Ye(e){if(e[0]!==`workspace`)return e[0]===`run-history`||e[0]===`run-history-context`||e[0]===`run-history-tail`?typeof e[1]==`string`?e[1]:void 0:typeof e[0]==`string`?e[0]:void 0}function Xe(e){return[...new Set(e.getQueryCache().getAll().map(({queryKey:e})=>Ye(e)).filter(e=>e!==void 0))]}function Ze(e){let t,n=new Set;return{onEvent(r){if(!(t!==void 0&&n.has(r))){for(let t of Ke(e,r))n.add(t);t===void 0&&(t=setTimeout(()=>{t=void 0;let r=n;n=new Set;let i=M();for(let t of r)for(let n of Je(t))e.invalidateQueries({queryKey:n,refetchType:t===i?`active`:`none`})},Ve))}},cancel(){clearTimeout(t),t=void 0,n.clear()}}}function Qe(e,t,n,r){let i=new Map,a,o=0,s=()=>{if(clearTimeout(a),a=void 0,o>0)return;let s=et(e),c=i;i=new Map;for(let i of c.values())i.project===s?tt(e,t,i.event,r):n(i.project)},c=()=>{a===void 0&&(a=setTimeout(s,50))};return{onEvent(e,t){let n=e.type===`run`?e.run.id:e.id;i.set(`${t}:${n}`,{event:e,project:t}),c()},beginReconcile(){s(),o+=1},endReconcile(){o!==0&&(--o,o===0&&s())},cancel(){clearTimeout(a),a=void 0,i.clear(),o=0}}}async function $e(e){let t=M(),n=[O.runs.all,E.runsIndex,E.dashboard,O.todos,O.health,O.worktrees,ae.all(),E.providerStatus,E.hostUsage,E.skillsUpdateAll,[`run-history`,t],[`run-history-context`,t]],r=Promise.allSettled([Promise.all([e.cancelQueries({queryKey:[`tracker`],predicate:e=>e.queryKey[2]!==`items`||e.getObserversCount()===0}),e.cancelQueries({queryKey:E.projects})]).then(()=>Promise.all([e.invalidateQueries({queryKey:[`tracker`],predicate:e=>e.queryKey[2]!==`items`||e.getObserversCount()===0}),e.invalidateQueries({queryKey:E.projects})])),e.invalidateQueries({queryKey:[`worktree-lifecycle`],refetchType:`none`}),...Xe(e).filter(e=>e!==t).flatMap(t=>Je(t).map(t=>e.invalidateQueries({queryKey:t,refetchType:`none`}))),...n.map(t=>e.invalidateQueries({queryKey:t}))]),i=!1,a;try{await Promise.race([r.then(()=>{i=!0}),new Promise(e=>{a=setTimeout(e,He)})])}finally{clearTimeout(a)}i||await Promise.allSettled(n.map(t=>e.cancelQueries({queryKey:t})))}function et(e){return ee()??e.getQueryData(O.health)?.bootProject}function tt(e,t,n,r){switch(n.type){case`run`:{let t=O.runs.list(),i=e.getQueryData(t);i&&!x(n.run)&&!i.some(e=>e.id===n.run.id)?r.run(n.run.id,n.run):e.setQueryData(t,e=>b(e,n.run));let a=O.runs.detail(n.run.id);e.getQueryData(a)!==void 0&&e.setQueryData(a,e=>e===void 0?e:m(e,n.run));let o=O.runs.changes(n.run.id);e.getQueryData(o)!==void 0&&e.invalidateQueries({queryKey:o}),e.invalidateQueries({queryKey:O.worktrees});return}case`run-deleted`:r.deleted(n.id),e.setQueryData(O.runs.list(),e=>c(e,n.id)),e.removeQueries({queryKey:O.runs.detail(n.id)}),e.removeQueries({queryKey:O.runs.diff(n.id)}),e.invalidateQueries({queryKey:O.worktrees});return;case`todos`:e.setQueryData(O.todos,n.items);return;case`usage`:t.set(n.usage);return;case`ping`:return}}function nt(e,t=Pe){let n=s();(0,V.useEffect)(()=>{let r=globalThis.EventSource;if(typeof r!=`function`)return;let o=null,s,c,l=new Set,u=()=>{clearTimeout(s),clearTimeout(c),s=void 0,c=void 0;let e=et(n);for(let t of l){let r=t===e?M():t;n.invalidateQueries({queryKey:ae.all(r),refetchType:t===e?`active`:`none`}),t===e&&n.invalidateQueries({queryKey:O.worktrees})}l.clear()},d,f,p=()=>{clearTimeout(d),clearTimeout(f),d=void 0,f=void 0,n.invalidateQueries({queryKey:E.dashboard,refetchType:document.visibilityState===`hidden`?`none`:`active`,predicate:e=>e.queryKey[2]!==`telemetry`&&e.queryKey[2]!==`automations`&&!(e.queryKey[2]===`feed`&&e.queryKey[3]===`github`)})},m=()=>{clearTimeout(d),d=setTimeout(p,250),f??=setTimeout(p,1e3)},g=Ue(n),_=Ge(n),v=Ze(n),y=Qe(n,e,v.onEvent,_),b,x=!1,S=!1,C,w=!1,T=Date.now(),D,k=!1,ee=!1,A=0,j=new Set,N=[],re=()=>{k=!0,ee=!1;let e=E.providerStatus;n.cancelQueries({queryKey:e,exact:!0}).then(()=>n.invalidateQueries({queryKey:e,exact:!0,refetchType:`active`})).finally(()=>{if(w||!ee){k=!1;return}re()})},P=e=>{let t=E.providerStatus,r=h(n.getQueryData(t),e);if(r!==void 0){n.setQueryData(t,r);return}if(k){ee=!0;return}re()},F=()=>{A+=1,y.beginReconcile(),$e(n).finally(()=>{--A,A===0&&(w?(j.clear(),N=[]):I()),y.endReconcile()})},I=()=>{let e=j,t=N;j=new Set,N=[];let r=et(n);for(let t of e)t===r?n.invalidateQueries({queryKey:O.todos}):v.onEvent(t);for(let e of t)P(e)},L=()=>{w||b!==void 0||(b=setTimeout(()=>{b=void 0,w||R()},Ie))},R=()=>{G.connected(!1),o?.close(),T=Date.now();let d=new r(t,{withCredentials:!0});o=d,d.addEventListener(`open`,()=>{w||o!==d||(T=Date.now(),clearTimeout(C),C=void 0,(x||S)&&F(),G.connected(!0),x=!0,S=!1)});for(let t of Le)d.addEventListener(t,r=>{if(w||o!==d)return;T=Date.now();let a=i(t,r.data);if(a){if(g.onEvent(a.event),(a.event.type===`run`||a.event.type===`run-deleted`)&&(m(),a.project&&be(a.project,a.event.type===`run-deleted`?a.event.id:a.event.run),a.project&&(a.event.type===`run-deleted`||a.event.run.status!==`running`)&&G.remove(a.project,a.event.type===`run-deleted`?a.event.id:a.event.run.id)),t===`usage`)try{let e=ie.safeParse(JSON.parse(r.data));e.success&&G.replace(e.data.project,e.data.samples??[],e.data.sentAt)}catch{}if(a.project!==null&&a.project!==et(n)){v.onEvent(a.project);return}a.event.type===`run`||a.event.type===`run-deleted`?a.project!==null&&y.onEvent(a.event,a.project):a.event.type===`todos`&&A>0?a.project!==null&&j.add(a.project):tt(n,e,a.event,_)}});d.addEventListener(`worktree-lifecycle`,e=>{if(w||o!==d)return;T=Date.now();let t;try{t=JSON.parse(e.data)}catch{return}let n=ne.safeParse(t);n.success&&(l.add(n.data.projectId),clearTimeout(s),s=setTimeout(u,100),c??=setTimeout(u,1e3))});for(let e of Re)d.addEventListener(e,t=>{if(w||o!==d)return;T=Date.now();let r;try{r=JSON.parse(t.data)}catch{return}if(e===`tracker-changed`){if(!te.safeParse(r).success)return;Promise.all([n.cancelQueries({queryKey:[`tracker`]}),n.cancelQueries({queryKey:E.projects})]).then(()=>Promise.all([n.invalidateQueries({queryKey:[`tracker`]}),n.invalidateQueries({queryKey:E.projects})]))}e!==`checkout-progress`&&e!==`automation-change`&&e!==`tracker-changed`&&(r&&typeof r==`object`&&(e===`project-removed`&&`id`in r&&typeof r.id==`string`?(ye(r.id,!0),G.remove(r.id)):e===`project-added`&&`project`in r&&r.project&&typeof r.project==`object`&&`id`in r.project&&typeof r.project.id==`string`&&ye(r.project.id,!1)),n.invalidateQueries({queryKey:E.projects}),n.invalidateQueries({queryKey:E.dashboard,refetchType:document.visibilityState===`hidden`?`none`:`active`}));for(let t of[...ze])t(e,r)});d.addEventListener(`provider-status`,e=>{if(w||o!==d)return;T=Date.now();let t;try{t=JSON.parse(e.data)}catch{return}let n=a(t);if(n){if(A>0){N.push(n);return}P(n)}}),d.addEventListener(`error`,()=>{w||o!==d||(G.connected(!1),d.readyState===Fe&&L())})},oe=()=>{S=!0,clearTimeout(C),C=setTimeout(()=>{C=void 0,!(w||!S)&&(S=!1,F())},He)},z,se=()=>{if(z=void 0,w||document.visibilityState!==`hidden`)return;if(Me(n)){Ne(n)&&(z=setTimeout(se,fe));return}clearTimeout(b),b=void 0;let e=o;o=null,G.connected(!1),e?.close()},ce=()=>{document.visibilityState===`hidden`&&(z??=setTimeout(se,fe))},le=()=>{if(document.visibilityState===`hidden`){ce();return}if(clearTimeout(z),z=void 0,!o||o.readyState===Fe){clearTimeout(b),b=void 0,oe(),R();return}F()},B=()=>{clearTimeout(b),b=void 0;let e=o;o=null,G.connected(!1),e?.close()},ue=e=>{e.persisted&&(oe(),R(),ce())};return D=setInterval(()=>{w||document.visibilityState!==`visible`||Date.now()-T<=4e4||(clearTimeout(b),b=void 0,R())},1e4),document.addEventListener(`visibilitychange`,le),window.addEventListener(`pagehide`,B),window.addEventListener(`pageshow`,ue),R(),ce(),()=>{w=!0,clearTimeout(b),clearTimeout(C),clearInterval(D),clearTimeout(z),G.connected(!1),clearTimeout(d),clearTimeout(f),clearTimeout(s),clearTimeout(c),l.clear(),g.cancel(),_.cancel(),v.cancel(),y.cancel(),j.clear(),N=[],document.removeEventListener(`visibilitychange`,le),window.removeEventListener(`pagehide`,B),window.removeEventListener(`pageshow`,ue);let e=o;o=null,G.connected(!1),e?.close()}},[n,e,t])}var rt=(0,V.createContext)(null);function it({children:e}){let[t]=(0,V.useState)(v);return nt(t),u(),(0,K.jsx)(rt.Provider,{value:t,children:e})}function at(e){let t=(0,V.useContext)(rt),n=t?t.get:st;return(0,V.useSyncExternalStore)(t?t.subscribe:ot,()=>e?n()[e]:void 0,()=>void 0)}var ot=()=>()=>void 0,st=()=>D,ct=A(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),lt=A(`dollar-sign`,[[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`22`,key:`7eqyqh`}],[`path`,{d:`M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6`,key:`1b0p4s`}]]),ut=A(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),dt=A(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]);function ft(){var e=[...arguments];return(0,V.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var pt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function mt(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function ht(e){return`nodeType`in e}function q(e){return e?mt(e)?e:ht(e)?e.ownerDocument?.defaultView??window:window:window}function gt(e){let{Document:t}=q(e);return e instanceof t}function _t(e){return!mt(e)&&e instanceof q(e).HTMLElement}function vt(e){return e instanceof q(e).SVGElement}function yt(e){return e?mt(e)?e.document:ht(e)?gt(e)?e:_t(e)||vt(e)?e.ownerDocument:document:document:document}var J=pt?V.useLayoutEffect:V.useEffect;function bt(e){let t=(0,V.useRef)(e);return J(()=>{t.current=e}),(0,V.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function xt(){let e=(0,V.useRef)(null);return[(0,V.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,V.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function St(e,t){t===void 0&&(t=[e]);let n=(0,V.useRef)(e);return J(()=>{n.current!==e&&(n.current=e)},t),n}function Ct(e,t){let n=(0,V.useRef)();return(0,V.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function wt(e){let t=bt(e),n=(0,V.useRef)(null);return[n,(0,V.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Tt(e){let t=(0,V.useRef)();return(0,V.useEffect)(()=>{t.current=e},[e]),t.current}var Et={};function Dt(e,t){return(0,V.useMemo)(()=>{if(t)return t;let n=Et[e]==null?0:Et[e]+1;return Et[e]=n,e+`-`+n},[e,t])}function Ot(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var kt=Ot(1),At=Ot(-1);function jt(e){return`clientX`in e&&`clientY`in e}function Mt(e){if(!e)return!1;let{KeyboardEvent:t}=q(e.target);return t&&e instanceof t}function Nt(e){if(!e)return!1;let{TouchEvent:t}=q(e.target);return t&&e instanceof t}function Pt(e){if(Nt(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return jt(e)?{x:e.clientX,y:e.clientY}:null}var Ft=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[Ft.Translate.toString(e),Ft.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),It=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Lt(e){return e.matches(It)?e:e.querySelector(It)}var Rt={display:`none`};function zt(e){let{id:t,value:n}=e;return V.createElement(`div`,{id:t,style:Rt},n)}function Bt(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return V.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Vt(){let[e,t]=(0,V.useState)(``);return{announce:(0,V.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var Ht=(0,V.createContext)(null);function Ut(e){let t=(0,V.useContext)(Ht);(0,V.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Wt(){let[e]=(0,V.useState)(()=>new Set),t=(0,V.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,V.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Gt={draggable:`
2
+ To pick up a draggable item, press the space bar.
3
+ While dragging, use the arrow keys to move the item.
4
+ Press space again to drop the item in its new position, or press escape to cancel.
5
+ `},Kt={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function qt(e){let{announcements:t=Kt,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Gt}=e,{announce:a,announcement:o}=Vt(),s=Dt(`DndLiveRegion`),[c,l]=(0,V.useState)(!1);if((0,V.useEffect)(()=>{l(!0)},[]),Ut((0,V.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=V.createElement(V.Fragment,null,V.createElement(zt,{id:r,value:i.draggable}),V.createElement(Bt,{id:s,announcement:o}));return n?(0,ge.createPortal)(u,n):u}var Y;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(Y||={});function Jt(){}function Yt(e,t){return(0,V.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function Xt(){var e=[...arguments];return(0,V.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var X=Object.freeze({x:0,y:0});function Zt(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Qt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function $t(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function en(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function tn(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function nn(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var rn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=nn(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Zt(nn(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(Qt)},an=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=en(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=en(r),o=i.reduce((e,t,r)=>e+Zt(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(Qt)};function on(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var sn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=on(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort($t)};function cn(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function ln(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:X}function un(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var dn=un(1);function fn(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function pn(e,t,n){let r=fn(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var mn={ignoreTransform:!1};function hn(e,t){t===void 0&&(t=mn);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=q(e).getComputedStyle(e);t&&(n=pn(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function gn(e){return hn(e,{ignoreTransform:!0})}function _n(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function vn(e,t){return t===void 0&&(t=q(e).getComputedStyle(e)),t.position===`fixed`}function yn(e,t){t===void 0&&(t=q(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function bn(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(gt(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!_t(i)||vt(i)||n.includes(i))return n;let a=q(e).getComputedStyle(i);return i!==e&&yn(i,a)&&n.push(i),vn(i,a)?n:r(i.parentNode)}return e?r(e):n}function xn(e){let[t]=bn(e,1);return t??null}function Sn(e){return!pt||!e?null:mt(e)?e:ht(e)?gt(e)||e===yt(e).scrollingElement?window:_t(e)?e:null:null}function Cn(e){return mt(e)?e.scrollX:e.scrollLeft}function wn(e){return mt(e)?e.scrollY:e.scrollTop}function Tn(e){return{x:Cn(e),y:wn(e)}}var Z;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Z||={});function En(e){return!pt||!e?!1:e===document.scrollingElement}function Dn(e){let t={x:0,y:0},n=En(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var On={x:.2,y:.2};function kn(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=On);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Dn(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Z.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Z.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Z.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Z.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function An(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function jn(e){return e.reduce((e,t)=>kt(e,Tn(t)),X)}function Mn(e){return e.reduce((e,t)=>e+Cn(t),0)}function Nn(e){return e.reduce((e,t)=>e+wn(t),0)}function Pn(e,t){if(t===void 0&&(t=hn),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);xn(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Fn=[[`x`,[`left`,`right`],Mn],[`y`,[`top`,`bottom`],Nn]],In=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=bn(t),r=jn(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Fn)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},Ln=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Rn(e){let{EventTarget:t}=q(e);return e instanceof t?e:yt(e)}function zn(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var Q;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Q||={});function Bn(e){e.preventDefault()}function Vn(e){e.stopPropagation()}var $;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})($||={});var Hn={start:[$.Space,$.Enter],cancel:[$.Esc],end:[$.Space,$.Enter,$.Tab]},Un=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $.Right:return{...n,x:n.x+25};case $.Left:return{...n,x:n.x-25};case $.Down:return{...n,y:n.y+25};case $.Up:return{...n,y:n.y-25}}},Wn=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Ln(yt(t)),this.windowListeners=new Ln(q(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Q.Resize,this.handleCancel),this.windowListeners.add(Q.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Q.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Pn(n),t(X)}handleKeyDown(e){if(Mt(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Hn,coordinateGetter:a=Un,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:X;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=At(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Dn(n),p=An(n),m={x:Math.min(i===$.Right?p.right-p.width/2:p.right,Math.max(i===$.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===$.Down?p.bottom-p.height/2:p.bottom,Math.max(i===$.Down?p.top:p.top+p.height/2,u.y))},h=i===$.Right&&!s||i===$.Left&&!c,g=i===$.Down&&!l||i===$.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===$.Right&&e<=d.x||i===$.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===$.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===$.Down&&e<=d.y||i===$.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===$.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,kt(At(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Wn.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Hn,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Gn(e){return!!(e&&`distance`in e)}function Kn(e){return!!(e&&`delay`in e)}var qn=class{constructor(e,t,n){n===void 0&&(n=Rn(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=yt(i),this.documentListeners=new Ln(this.document),this.listeners=new Ln(n),this.windowListeners=new Ln(q(i)),this.initialCoordinates=Pt(r)??X,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Q.Resize,this.handleCancel),this.windowListeners.add(Q.DragStart,Bn),this.windowListeners.add(Q.VisibilityChange,this.handleCancel),this.windowListeners.add(Q.ContextMenu,Bn),this.documentListeners.add(Q.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Kn(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Gn(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Q.Click,Vn,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Q.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Pt(e)??X,s=At(n,o);if(!t&&a){if(Gn(a)){if(a.tolerance!=null&&zn(s,a.tolerance))return this.handleCancel();if(zn(s,a.distance))return this.handleStart()}if(Kn(a)&&zn(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===$.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Jn={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Yn=class extends qn{constructor(e){let{event:t}=e,n=yt(t.target);super(e,Jn,n)}};Yn.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Xn={move:{name:`mousemove`},end:{name:`mouseup`}},Zn;(function(e){e[e.RightClick=2]=`RightClick`})(Zn||={});var Qn=class extends qn{constructor(e){super(e,Xn,yt(e.event.target))}};Qn.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Zn.RightClick?!1:(r?.({event:n}),!0)}}];var $n={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},er=class extends qn{constructor(e){super(e,$n)}static setup(){return window.addEventListener($n.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener($n.move.name,e)};function e(){}}};er.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var tr;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(tr||={});var nr;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(nr||={});function rr(e){let{acceleration:t,activator:n=tr.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=nr.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=ar({delta:d,disabled:!a}),[m,h]=xt(),g=(0,V.useRef)({x:0,y:0}),_=(0,V.useRef)({x:0,y:0}),v=(0,V.useMemo)(()=>{switch(n){case tr.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case tr.DraggableRect:return i}},[n,i,c]),y=(0,V.useRef)(null),b=(0,V.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,V.useMemo)(()=>s===nr.TreeOrder?[...l].reverse():l,[s,l]);(0,V.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=kn(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var ir={x:{[Z.Backward]:!1,[Z.Forward]:!1},y:{[Z.Backward]:!1,[Z.Forward]:!1}};function ar(e){let{delta:t,disabled:n}=e,r=Tt(t);return Ct(e=>{if(n||!r||!e)return ir;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Z.Backward]:e.x[Z.Backward]||i.x===-1,[Z.Forward]:e.x[Z.Forward]||i.x===1},y:{[Z.Backward]:e.y[Z.Backward]||i.y===-1,[Z.Forward]:e.y[Z.Forward]||i.y===1}}},[n,t,r])}function or(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Ct(e=>t==null?null:r??e??null,[r,t])}function sr(e,t){return(0,V.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var cr;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(cr||={});var lr;(function(e){e.Optimized=`optimized`})(lr||={});var ur=new Map;function dr(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,V.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,V.useRef)(e),d=g(),f=St(d),p=(0,V.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,V.useRef)(null),h=Ct(t=>{if(d&&!n)return ur;if(!t||t===ur||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new In(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,V.useEffect)(()=>{u.current=e},[e]),(0,V.useEffect)(()=>{d||p()},[n,d]),(0,V.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,V.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case cr.Always:return!1;case cr.BeforeDragging:return n;default:return!n}}}function fr(e,t){return Ct(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function pr(e,t){return fr(e,t)}function mr(e){let{callback:t,disabled:n}=e,r=bt(t),i=(0,V.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,V.useEffect)(()=>()=>i?.disconnect(),[i]),i}function hr(e){let{callback:t,disabled:n}=e,r=bt(t),i=(0,V.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,V.useEffect)(()=>()=>i?.disconnect(),[i]),i}function gr(e){return new In(hn(e),e)}function _r(e,t,n){t===void 0&&(t=gr);let[r,i]=(0,V.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=mr({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=hr({callback:a});return J(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function vr(e){return ln(e,fr(e))}var yr=[];function br(e){let t=(0,V.useRef)(e),n=Ct(n=>e?n&&n!==yr&&e&&t.current&&e.parentNode===t.current.parentNode?n:bn(e):yr,[e]);return(0,V.useEffect)(()=>{t.current=e},[e]),n}function xr(e){let[t,n]=(0,V.useState)(null),r=(0,V.useRef)(e),i=(0,V.useCallback)(e=>{let t=Sn(e.target);t&&n(e=>e?(e.set(t,Tn(t)),new Map(e)):null)},[]);return(0,V.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=Sn(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Tn(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{Sn(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,V.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>kt(e,t),X):jn(e):X,[e,t])}function Sr(e,t){t===void 0&&(t=[]);let n=(0,V.useRef)(null);return(0,V.useEffect)(()=>{n.current=null},t),(0,V.useEffect)(()=>{let t=e!==X;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?At(e,n.current):X}function Cr(e){(0,V.useEffect)(()=>{if(!pt)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function wr(e,t){return(0,V.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Tr(e){return(0,V.useMemo)(()=>e?_n(e):null,[e])}var Er=[];function Dr(e,t){t===void 0&&(t=hn);let[n]=e,r=Tr(n?q(n):null),[i,a]=(0,V.useState)(Er);function o(){a(()=>e.length?e.map(e=>En(e)?r:new In(t(e),e)):Er)}let s=hr({callback:o});return J(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Or(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return _t(t)?t:e}function kr(e){let{measure:t}=e,[n,r]=(0,V.useState)(null),i=hr({callback:(0,V.useCallback)(e=>{for(let{target:n}of e)if(_t(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=wt((0,V.useCallback)(e=>{let n=Or(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,V.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Ar=[{sensor:Yn,options:{}},{sensor:Wn,options:{}}],jr={current:{}},Mr={draggable:{measure:gn},droppable:{measure:gn,strategy:cr.WhileDragging,frequency:lr.Optimized},dragOverlay:{measure:hn}},Nr=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Pr={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Nr,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Jt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Mr,measureDroppableContainers:Jt,windowRect:null,measuringScheduled:!1},Fr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:Jt,draggableNodes:new Map,over:null,measureDroppableContainers:Jt},Ir=(0,V.createContext)(Fr),Lr=(0,V.createContext)(Pr);function Rr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Nr}}}function zr(e,t){switch(t.type){case Y.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Y.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Y.DragEnd:case Y.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Y.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Nr(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Y.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Nr(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case Y.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Nr(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Br(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,V.useContext)(Ir),a=Tt(r),o=Tt(n?.id);return(0,V.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Mt(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Lt(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Vr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Hr(e){return(0,V.useMemo)(()=>({draggable:{...Mr.draggable,...e?.draggable},droppable:{...Mr.droppable,...e?.droppable},dragOverlay:{...Mr.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ur(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,V.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;J(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=ln(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=xn(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Wr=(0,V.createContext)({...X,scaleX:1,scaleY:1}),Gr;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Gr||={});var Kr=(0,V.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Ar,collisionDetection:o=sn,measuring:s,modifiers:c,...l}=e,[u,d]=(0,V.useReducer)(zr,void 0,Rr),[f,p]=Wt(),[m,h]=(0,V.useState)(Gr.Uninitialized),g=m===Gr.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,V.useRef)({initial:null,translated:null}),C=(0,V.useMemo)(()=>_==null?null:{id:_,data:x?.data??jr,rect:S},[_,x]),w=(0,V.useRef)(null),[T,E]=(0,V.useState)(null),[D,O]=(0,V.useState)(null),k=St(l,Object.values(l)),ee=Dt(`DndDescribedBy`,t),te=(0,V.useMemo)(()=>b.getEnabled(),[b]),A=Hr(s),{droppableRects:j,measureDroppableContainers:M,measuringScheduled:ne}=dr(te,{dragging:g,dependencies:[y.x,y.y],config:A.droppable}),N=or(v,_),re=(0,V.useMemo)(()=>D?Pt(D):null,[D]),P=G(),ie=pr(N,A.draggable.measure);Ur({activeNode:_==null?null:v.get(_),config:P.layoutShiftCompensation,initialRect:ie,measure:A.draggable.measure});let F=_r(N,A.draggable.measure,ie),I=_r(N?N.parentElement:null),L=(0,V.useRef)({activatorEvent:null,active:null,activeNode:N,collisionRect:null,collisions:null,droppableRects:j,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),ae=b.getNodeFor(L.current.over?.id),R=kr({measure:A.dragOverlay.measure}),oe=R.nodeRef.current??N,z=g?R.rect??F:null,se=!!(R.nodeRef.current&&R.rect),ce=vr(se?null:F),le=Tr(oe?q(oe):null),B=br(g?ae??N:null),ue=Dr(B),de=Vr(c,{transform:{x:y.x-ce.x,y:y.y-ce.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:F,containerNodeRect:I,draggingNodeRect:z,over:L.current.over,overlayNodeRect:R.rect,scrollableAncestors:B,scrollableAncestorRects:ue,windowRect:le}),fe=re?kt(re,y):null,pe=xr(B),me=Sr(pe),he=Sr(pe,[F]),H=kt(de,me),_e=z?dn(z,de):null,U=C&&_e?o({active:C,collisionRect:_e,droppableRects:j,droppableContainers:te,pointerCoordinates:fe}):null,ve=tn(U,`id`),[W,ye]=(0,V.useState)(null),be=cn(se?de:kt(de,he),W?.rect??null,F),xe=(0,V.useRef)(null),Se=(0,V.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent,o=new n({active:w.current,activeNode:i,event:a,options:r,context:L,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=k.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=k.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=k.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,ge.unstable_batchedUpdates)(()=>{r?.(i),h(Gr.Initializing),d({type:Y.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(xe.current),O(a)})},onMove(e){d({type:Y.DragMove,coordinates:e})},onEnd:s(Y.DragEnd),onCancel:s(Y.DragCancel)});xe.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=L.current,o=null;if(t&&i){let{cancelDrop:s}=k.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===Y.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=Y.DragCancel)}w.current=null,(0,ge.unstable_batchedUpdates)(()=>{d({type:e}),h(Gr.Uninitialized),ye(null),E(null),O(null),xe.current=null;let t=e===Y.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=k.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Ce=sr(a,(0,V.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,Se(n,t))},[v,Se]));Cr(a),J(()=>{F&&m===Gr.Initializing&&h(Gr.Initialized)},[F,m]),(0,V.useEffect)(()=>{let{onDragMove:e}=k.current,{active:t,activatorEvent:n,collisions:r,over:i}=L.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:H.x,y:H.y},over:i};(0,ge.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[H.x,H.y]),(0,V.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=L.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=k.current,o=r.get(ve),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,ge.unstable_batchedUpdates)(()=>{ye(s),a?.(c),f({type:`onDragOver`,event:c})})},[ve]),J(()=>{L.current={activatorEvent:D,active:C,activeNode:N,collisionRect:_e,collisions:U,droppableRects:j,draggableNodes:v,draggingNode:oe,draggingNodeRect:z,droppableContainers:b,over:W,scrollableAncestors:B,scrollAdjustedTranslate:H},S.current={initial:z,translated:_e}},[C,N,U,_e,v,oe,z,j,b,W,B,H]),rr({...P,delta:y,draggingRect:_e,pointerCoordinates:fe,scrollableAncestors:B,scrollableAncestorRects:ue});let we=(0,V.useMemo)(()=>({active:C,activeNode:N,activeNodeRect:F,activatorEvent:D,collisions:U,containerNodeRect:I,dragOverlay:R,draggableNodes:v,droppableContainers:b,droppableRects:j,over:W,measureDroppableContainers:M,scrollableAncestors:B,scrollableAncestorRects:ue,measuringConfiguration:A,measuringScheduled:ne,windowRect:le}),[C,N,F,D,U,I,R,v,b,j,W,M,B,ue,A,ne,le]),Te=(0,V.useMemo)(()=>({activatorEvent:D,activators:Ce,active:C,activeNodeRect:F,ariaDescribedById:{draggable:ee},dispatch:d,draggableNodes:v,over:W,measureDroppableContainers:M}),[D,Ce,C,F,d,ee,v,W,M]);return V.createElement(Ht.Provider,{value:p},V.createElement(Ir.Provider,{value:Te},V.createElement(Lr.Provider,{value:we},V.createElement(Wr.Provider,{value:be},i)),V.createElement(Br,{disabled:n?.restoreFocus===!1})),V.createElement(qt,{...n,hiddenTextDescribedById:ee}));function G(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),qr=(0,V.createContext)(null),Jr=`button`,Yr=`Draggable`;function Xr(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Dt(Yr),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,V.useContext)(Ir),{role:p=Jr,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,V.useContext)(g?Wr:qr),[v,y]=wt(),[b,x]=wt(),S=wr(o,t),C=St(n);return J(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,V.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Jr?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function Zr(){return(0,V.useContext)(Lr)}var Qr=`Droppable`,$r={timeout:25};function ei(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Dt(Qr),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,V.useContext)(Ir),u=(0,V.useRef)({disabled:n}),d=(0,V.useRef)(!1),f=(0,V.useRef)(null),p=(0,V.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...$r,...i},_=St(h??r),v=hr({callback:(0,V.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=wt((0,V.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=St(t);return(0,V.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,V.useEffect)(()=>(s({type:Y.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:Y.UnregisterDroppable,key:a,id:r})),[r]),(0,V.useEffect)(()=>{n!==u.current.disabled&&(s({type:Y.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function ti(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function ni(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function ri(e){return e!==null&&e>=0}function ii(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function ai(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var oi=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=ti(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},si={scaleX:1,scaleY:1},ci=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...si}:null}let s=li(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...si}:r<t&&r>=a?{x:0,y:o.height+s,...si}:{x:0,y:0,...si}};function li(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var ui=`Sortable`,di=V.createContext({activeIndex:-1,containerId:ui,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:oi,disabled:{draggable:!1,droppable:!1}});function fi(e){let{children:t,id:n,items:r,strategy:i=oi,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Zr(),d=Dt(ui,n),f=s.rect!==null,p=(0,V.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,V.useRef)(p),v=!ii(p,_.current),y=g!==-1&&h===-1||v,b=ai(a);J(()=>{v&&m&&u(p)},[v,p,m,u]),(0,V.useEffect)(()=>{_.current=p},[p]);let x=(0,V.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:ni(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return V.createElement(di.Provider,{value:x},t)}var pi=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return ti(n,r,i).indexOf(t)},mi=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},hi={duration:200,easing:`ease`},gi=`transform`,_i=Ft.Transition.toString({property:gi,duration:0,easing:`linear`}),vi={roleDescription:`sortable`};function yi(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,V.useState)(null),s=(0,V.useRef)(n);return J(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=hn(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,V.useEffect)(()=>{a&&o(null)},[a]),a}function bi(e){let{animateLayoutChanges:t=mi,attributes:n,disabled:r,data:i,getNewIndex:a=pi,id:o,strategy:s,resizeObserverConfig:c,transition:l=hi}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,V.useContext)(di),y=xi(r,p),b=u.indexOf(o),x=(0,V.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),S=(0,V.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:C,node:w,isOver:T,setNodeRef:E}=ei({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:S,...c}}),{active:D,activatorEvent:O,activeNodeRect:k,attributes:ee,setNodeRef:te,listeners:A,isDragging:j,over:M,setActivatorNodeRef:ne,transform:N}=Xr({id:o,data:x,attributes:{...vi,...n},disabled:y.draggable}),re=ft(E,te),P=!!D,ie=P&&!m&&ri(f)&&ri(g),F=!_&&j,I=ie?(F&&ie?N:null)??(s??v)({rects:h,activeNodeRect:k,activeIndex:f,overIndex:g,index:b}):null,L=ri(f)&&ri(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,ae=D?.id,R=(0,V.useRef)({activeId:ae,items:u,newIndex:L,containerId:d}),oe=u!==R.current.items,z=t({active:D,containerId:d,isDragging:j,isSorting:P,id:o,index:b,items:u,newIndex:R.current.newIndex,previousItems:R.current.items,previousContainerId:R.current.containerId,transition:l,wasDragging:R.current.activeId!=null}),se=yi({disabled:!z,index:b,node:w,rect:C});return(0,V.useEffect)(()=>{P&&R.current.newIndex!==L&&(R.current.newIndex=L),d!==R.current.containerId&&(R.current.containerId=d),u!==R.current.items&&(R.current.items=u)},[P,L,d,u]),(0,V.useEffect)(()=>{if(ae===R.current.activeId)return;if(ae!=null&&R.current.activeId==null){R.current.activeId=ae;return}let e=setTimeout(()=>{R.current.activeId=ae},50);return()=>clearTimeout(e)},[ae]),{active:D,activeIndex:f,attributes:ee,data:x,rect:C,index:b,newIndex:L,items:u,isOver:T,isSorting:P,isDragging:j,listeners:A,node:w,overIndex:g,over:M,setNodeRef:re,setActivatorNodeRef:ne,setDroppableNodeRef:E,setDraggableNodeRef:te,transform:se??I,transition:ce()};function ce(){if(se||oe&&R.current.newIndex===b)return _i;if(!(F&&!Mt(O)||!l)&&(P||z))return Ft.Transition.toString({...l,property:gi})}}function xi(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function Si(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var Ci=[$.Down,$.Right,$.Up,$.Left],wi=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(Ci.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case $.Down:r.top<a.top&&t.push(n);break;case $.Up:r.top>a.top&&t.push(n);break;case $.Left:r.left>a.left&&t.push(n);break;case $.Right:r.left<a.left&&t.push(n);break}});let c=an({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=tn(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=bn(c).some((e,t)=>s[t]!==e),i=Ti(e,t),a=Ei(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:At(u,l)}}}};function Ti(e,t){return!Si(e)||!Si(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Ei(e,t){return!Si(e)||!Si(t)||!Ti(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}var Di=e=>`"${e.replace(/(["\\$`!])/g,`\\$1`)}"`;function Oi(e){return e%3600==0?`${e/3600}h`:e%60==0?`${e/60}m`:`${e}s`}function ki(e){if(e.schedules&&e.schedules.length>1||e.kind===`tracker`)return!1;if(e.kind===`schedule`)return!!e.schedule&&(e.schedule.type!==`once`||!!e.schedule.date);if(!e.events?.length)return!1;let t=e.filters??{};return!([`assignees`,`allLabels`,`excludeLabels`,`changedLabels`].some(e=>(t[e]?.length??0)>0)||t.lookbackDays!==void 0&&t.lookbackDays!==7||t.maxRecords!==void 0&&t.maxRecords!==25)}function Ai(e){let t=[`cez automation add`,`--name ${Di(e.name||`untitled`)}`];if(e.kind===`schedule`&&e.schedule?.type===`once`){let n=P(e.schedule);t.push(`--at ${Di(`${n.date} ${re(n.hour,n.minute)}`)}`)}else if(e.kind===`schedule`&&e.schedule)t.push(`--cron ${Di(N(e.schedule))}`);else{t.push(`--on ${(e.events??[]).join(`,`)}`),t.push(`--every ${Oi(e.intervalSeconds??300)}`);for(let n of e.filters?.anyLabels??[])t.push(`--label ${Di(n)}`);for(let n of e.filters?.authors??[])t.push(`--author ${Di(n)}`)}let{task:n}=e;return n.workflow&&t.push(`--workflow ${Di(n.workflow)}`),n.runner&&t.push(`--runner ${Di(n.runner)}`),n.model&&t.push(`--model ${Di(n.model)}`),n.autonomous===!1?t.push(`--no-autonomous`):n.autonomous&&t.push(`--autonomous`),n.dispatch&&(t.push(`--dispatch`),n.dispatch.maxSubtasks!==void 0&&t.push(`--max-subtasks ${n.dispatch.maxSubtasks}`),n.dispatch.reviewChild&&t.push(`--review-child`)),e.enable&&t.push(`--enable`),t.push(`--prompt ${Di(n.prompt||`…`)}`),t.join(` `)}function ji(e){let t={name:e.name||`untitled`,kind:e.kind,...e.kind===`schedule`?{schedule:e.schedule,...e.schedules?{schedules:e.schedules}:{}}:e.kind===`tracker`?{trackerTrigger:e.trackerTrigger,intervalSeconds:e.intervalSeconds??1800,filters:{lookbackDays:7,maxRecords:25,...e.filters}}:{events:e.events,intervalSeconds:e.intervalSeconds??300,filters:{lookbackDays:7,maxRecords:25,...e.filters}},task:e.task,...e.enable?{enable:!0}:{}};return`cez automation create --json '${JSON.stringify(t).replace(/'/g,`'\\''`)}'`}function Mi(e){return ki(e)?Ai(e):ji(e)}var Ni=()=>[M(),`automations`];function Pi(){let e=l(),t=e.data!==void 0;return{known:t,off:t&&e.data?.capabilities?.automations!==!0}}function Fi(e){let t=s(),n=L(),r=f({queryKey:Ni(),queryFn:({signal:e})=>p({signal:e}),enabled:e});return(0,V.useEffect)(()=>Be((e,r)=>{if(e!==`automation-change`)return;let i=r;typeof i.project==`string`&&(n===null||i.project===n)&&t.invalidateQueries({queryKey:Ni()})}),[n,t]),r}function Ii(e){let t=s(),n=()=>t.invalidateQueries({queryKey:Ni()}),r=e=>I(e instanceof Error?e.message:String(e),{tone:`danger`}),i=d({mutationFn:async e=>{e.kind===`schedule`?(await y(e.id),I(`Started "${e.name}" — the task is queued.`)):(await C(e.id,`execute`),I(`Checking events for "${e.name}" now.`))},onSuccess:()=>void n(),onError:r}),a=d({mutationFn:async e=>{await C(e.id,`preview`),I(`Preview queued for "${e.name}" — no tasks will launch. See the execution log for results.`)},onSuccess:()=>void n(),onError:r}),o=d({mutationFn:e=>T(e.id,!e.enabled),onSuccess:()=>void n(),onError:r}),c=d({mutationFn:e=>S({name:`${e.name} (copy)`,...e.description?{description:e.description}:{},kind:e.kind,...e.kind===`schedule`?{schedule:e.schedule,...e.schedules?{schedules:e.schedules}:{}}:e.kind===`tracker`?{trackerTrigger:e.trackerTrigger,intervalSeconds:e.intervalSeconds,filters:e.filters}:{events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters},task:e.task}),onSuccess:e=>{I(`Duplicated as "${e.automation.name}", paused.`),n()},onError:r}),l=d({mutationFn:e=>k(e.id),onSuccess:()=>void n(),onError:r});return{preview:e=>a.mutateAsync(e).then(()=>void 0,()=>void 0),runNow:e=>i.mutateAsync(e).then(()=>void 0,()=>void 0),toggleEnabled:e=>o.mutateAsync(e).then(()=>void 0,()=>void 0),duplicate:e=>c.mutateAsync(e).then(()=>void 0,()=>void 0),remove:e=>l.mutateAsync(e).then(()=>void 0,()=>void 0),copyCli:async e=>{await Li(Mi({name:e.name,kind:e.kind,trackerTrigger:e.trackerTrigger,schedule:e.schedule,schedules:e.schedules,events:e.events,intervalSeconds:e.intervalSeconds,filters:e.filters,task:e.task}))},busy:a.isPending||i.isPending||o.isPending||c.isPending||l.isPending}}async function Li(e){try{await he(e),I(`Copied to the clipboard.`)}catch{I(`Copy failed — select the text to copy it.`,{tone:`danger`})}}function Ri({slot:e,label:t,value:n,options:r,onChange:i,full:a=!1,allowRelease:o=!1,className:s}){return(0,K.jsx)(`div`,{"data-slot":e,"data-full":a?`true`:void 0,role:`group`,"aria-label":t,className:F(`inline-flex gap-0.5 rounded-md bg-muted p-[3px]`,a&&`flex w-full`,s),children:r.map(e=>{let t=e.value===n;return(0,K.jsxs)(`button`,{type:`button`,"data-value":e.value,"aria-pressed":t,onClick:()=>{t&&!o||i(e.value)},className:F(`flex h-7 items-center justify-center gap-1.5 rounded-[7px] px-3 text-label font-medium whitespace-nowrap text-muted-foreground transition-colors hover:text-foreground`,a&&`flex-1`,t&&`bg-card font-semibold text-foreground shadow-xs`),children:[e.label,e.count===void 0?null:(0,K.jsx)(`small`,{className:`font-mono text-meta font-normal tabular-nums`,children:e.count})]},e.value)})})}function zi({slot:e,label:t,options:n,selected:r,onToggle:i,onClear:a,searchPlaceholder:o,emptyLabel:s=`Nothing to filter by`}){let[c,l]=V.useState(!1),u=r.length>0,d=r.length===1?n.find(e=>e.value===r[0])?.label??r[0]:`${r.length} selected`;return(0,K.jsxs)(z,{open:c,onOpenChange:l,children:[(0,K.jsx)(oe,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,"data-slot":`facet-${e}`,"data-active":u?`true`:void 0,"aria-label":`Filter by ${t.toLowerCase()}`,className:F(`inline-flex h-7 items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground`,u&&`border-violet/40 bg-violet/10 text-foreground`),children:[(0,K.jsx)(`span`,{className:F(u&&`text-soft-foreground`),children:t}),u?(0,K.jsx)(`span`,{className:`max-w-[140px] truncate font-semibold`,children:d}):null,(0,K.jsx)(me,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,K.jsxs)(R,{align:`start`,className:`w-64 p-0`,"data-testid":`facet-${e}-menu`,children:[(0,K.jsxs)(B,{children:[(0,K.jsx)(de,{placeholder:o??`Search ${t.toLowerCase()}…`}),(0,K.jsxs)(le,{children:[(0,K.jsx)(se,{children:s}),(0,K.jsx)(ce,{children:n.map(e=>{let t=r.includes(e.value);return(0,K.jsxs)(ue,{value:e.label,onSelect:()=>i(e.value),"data-slot":`facet-option`,"data-value":e.value,"aria-checked":t,role:`option`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:F(`flex size-4 shrink-0 items-center justify-center rounded-[4px] border`,t?`border-violet bg-violet text-violet-foreground`:`border-input`),children:t?(0,K.jsx)(pe,{className:`size-3`}):null}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.count===void 0?null:(0,K.jsx)(`span`,{className:`shrink-0 font-mono text-meta text-soft-foreground tabular-nums`,children:e.count})]},e.value)})})]})]}),u?(0,K.jsx)(`div`,{className:`border-t border-border p-1`,children:(0,K.jsxs)(`button`,{type:`button`,"data-action":`facet-${e}-clear`,onClick:()=>a(),className:`w-full rounded-sm px-2 py-1.5 text-left text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[`Clear `,t.toLowerCase()]})}):null]})]})}function Bi({label:e,count:t,selected:n,onToggle:r,slot:i,tone:a=`neutral`}){return(0,K.jsxs)(`button`,{type:`button`,"data-slot":i,"data-selected":n?`true`:void 0,"aria-pressed":n,onClick:r,className:F(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-xs font-medium transition-colors`,a===`tag`?`border-violet/25 bg-violet/10 text-violet hover:bg-violet/20`:`border-border bg-card text-muted-foreground hover:bg-muted hover:text-foreground`,n&&`border-violet bg-violet text-violet-foreground hover:bg-violet`),children:[e,t===void 0?null:(0,K.jsx)(`span`,{className:F(`font-mono text-meta tabular-nums`,!n&&`text-soft-foreground`),children:t})]})}function Vi({slot:e,label:t,value:n,options:r,onChange:i}){return(0,K.jsx)(Ri,{slot:e,label:t,value:n,options:r,onChange:i,allowRelease:!0})}export{at as A,xe as B,Ft as C,ct as D,lt as E,Ae as F,G as I,Ee as L,ke as M,De as N,it as O,Oe as P,Se as R,Xt as S,ut as T,Kr as _,Ni as a,rn as b,Pi as c,fi as d,ti as f,ci as g,bi as h,Ri as i,je as j,Be as k,Fi as l,wi as m,Vi as n,Li as o,oi as p,Bi as r,Ii as s,zi as t,Mi as u,Wn as v,dt as w,Yt as x,Yn as y,we as z};
@@ -1 +1 @@
1
- import{F as e}from"./button-wdWSPx_B.js";var t=e(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),n=e(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]);export{t as n,n as t};
1
+ import{F as e}from"./button-BvYDiOkd.js";var t=e(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),n=e(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]);export{t as n,n as t};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ki as r,St as i,Xi as a,er as o,ut as s}from"./queries-DsfjHsrp.js";import{F as c,r as l}from"./button-BvYDiOkd.js";import{t as u}from"./file-d2ABwdSR.js";import{t as d}from"./chevron-right-DuM1UAhq.js";import{p as ee}from"./git-toolbar-CSrf6Ux9.js";import{t as f}from"./triangle-alert-BhQYv6Is.js";import{t as p}from"./centered-state-Bpq40Y_t.js";import{a as te,i as m,o as h,t as g}from"./markdown-BBnagS_c.js";import{n as _}from"./markdown-DLB6o6YD.js";var v=c(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),y=c(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),b=c(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),x=c(`folder-tree`,[[`path`,{d:`M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`hod4my`}],[`path`,{d:`M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z`,key:`w4yl2u`}],[`path`,{d:`M3 5a2 2 0 0 0 2 2h3`,key:`f2jnh7`}],[`path`,{d:`M3 3v13a2 2 0 0 0 2 2h3`,key:`k8epm1`}]]),ne=c(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),S=c(`mouse-pointer-click`,[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]),C=e(t(),1),w=n();function T({root:e,selected:t,onSelect:n,commentCounts:r=E}){return(0,w.jsx)(D.Provider,{value:r,children:(0,w.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-ui`,children:(0,w.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,w.jsx)(A,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,w.jsx)(j,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})})}var E=new Map,D=(0,C.createContext)(E);function O(e,t){let n=0;for(let r of e.files)n+=t.get(r.path)??0;for(let r of e.dirs)n+=O(r,t);return n}function k({adds:e,dels:t}){return(0,w.jsxs)(`span`,{className:`shrink-0 font-mono text-meta font-medium tabular-nums`,children:[e>0?(0,w.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,w.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function A({dir:e,depth:t,selected:n,onSelect:r}){let[i,a]=(0,C.useState)(!0),o=(0,C.useContext)(D),s=i?0:O(e,o);return(0,w.jsxs)(`li`,{children:[(0,w.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":i?`open`:`closed`,"aria-expanded":i,onClick:()=>a(e=>!e),className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,w.jsx)(d,{"aria-hidden":`true`,className:l(`size-3.5 shrink-0 transition-transform`,i&&`rotate-90`)}),(0,w.jsx)(ee,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,w.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,w.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[(0,w.jsx)(_,{count:s}),(0,w.jsx)(k,{adds:e.adds,dels:e.dels})]})]}),i?(0,w.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,w.jsx)(A,{dir:e,depth:t+1,selected:n,onSelect:r},e.path)),e.files.map(e=>(0,w.jsx)(j,{file:e,depth:t+1,selected:n,onSelect:r},e.path))]}):null]})}var re={added:`text-success`,deleted:`text-danger`};function j({file:e,depth:t,selected:n,onSelect:r}){let i=n===e.path,a=(0,C.useContext)(D).get(e.path)??0;return(0,w.jsx)(`li`,{children:(0,w.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":i?`true`:void 0,onClick:()=>r(e.path),className:l(`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,i?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,w.jsx)(u,{"aria-hidden":`true`,className:l(`size-3.5 shrink-0`,re[e.status])}),(0,w.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,w.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[(0,w.jsx)(_,{count:a}),(0,w.jsx)(k,{adds:e.adds,dels:e.dels})]})]})})}var M=`cez-tree-pane-width`,N=.6;function P(e,t=1/0){if(e==null||e===``)return null;let n=typeof e==`number`?e:Number(e);if(!Number.isFinite(n))return null;let r=Math.max(160,Math.min(720,t*N));return Math.min(r,Math.max(160,Math.round(n)))}function F(){try{return P(localStorage.getItem(M))}catch{return null}}function I(e){try{let t=P(e);t===null?localStorage.removeItem(M):localStorage.setItem(M,String(t))}catch{}}var L=new Set,R;function z(e){L.add(e);let t=t=>{t.key!==null&&t.key!==`cez-tree-pane-width`||(R=void 0,e())};return window.addEventListener(`storage`,t),()=>{L.delete(e),window.removeEventListener(`storage`,t)}}function B(){return R===void 0?F():R}function V(e){I(e),R=F()===e?void 0:e;for(let e of L)e()}function H(){return[C.useSyncExternalStore(z,B,B),V]}function U(e){return e===null?{}:{style:{"--tree-pane-width":`${e}px`},className:`md:w-(--tree-pane-width)!`}}function W({paneRef:e,width:t,onWidthChange:n,className:r}){let i=C.useRef(null),a=()=>t??Math.round(e.current?.getBoundingClientRect().width??0),o=t=>P(t,e.current?.parentElement?.clientWidth||1/0),s=e=>{e.button===0&&(i.current={x:e.clientX,width:a()},e.currentTarget.setPointerCapture(e.pointerId),e.preventDefault(),e.currentTarget.focus())},c=e=>{let t=i.current;t&&n(o(t.width+(e.clientX-t.x)))},u=e=>{i.current&&(i.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,w.jsx)(`div`,{"data-slot":`tree-pane-resize`,className:l(`relative -mr-5 w-0 shrink-0`,r),children:(0,w.jsx)(`div`,{"data-slot":`tree-pane-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the file tree`,"aria-valuenow":t??void 0,"aria-valuemin":160,"aria-valuemax":720,tabIndex:0,onPointerDown:s,onPointerMove:c,onPointerUp:u,onPointerCancel:u,onKeyDown:e=>{let t=e.key===`ArrowLeft`?a()-16:e.key===`ArrowRight`?a()+16:e.key===`Home`?160:e.key===`End`?720:null;t!==null&&(e.preventDefault(),n(o(t)))},onDoubleClick:()=>n(null),title:`Drag to resize the file tree — double-click to reset`,className:`absolute inset-y-0 -left-[14px] z-10 w-2 cursor-col-resize touch-none rounded-full bg-transparent transition-colors hover:bg-violet/40 focus-visible:bg-violet/60 focus-visible:outline-none`})})}var G=(e,t)=>e.name.localeCompare(t.name);function K(e){let t=e;for(;t.files.length===0&&t.dirs.length===1;){let e=t.dirs[0];t={...e,name:`${t.name}/${e.name}`}}return{...t,dirs:t.dirs.map(K)}}function q(e,t){let n=(e,t)=>({kind:`dir`,name:e,path:t,dirs:[],files:[]}),r=n(``,``),i=new Map([[``,r]]),a=e=>{let t=i.get(e);if(t)return t;let r=e.lastIndexOf(`/`),o=a(r===-1?``:e.slice(0,r)),s=n(r===-1?e:e.slice(r+1),e);return o.dirs.push(s),i.set(e,s),s};for(let n of e){let e=n.lastIndexOf(`/`);a(e===-1?``:n.slice(0,e)).files.push(t(n,e===-1?n:n.slice(e+1)))}let o=e=>{e.dirs.forEach(o),e.dirs.sort(G),e.files.sort(G)};return o(r),{...r,dirs:r.dirs.map(K)}}function J(e){let t=new Map(e.map(e=>[e.path,e])),n=q(e.map(e=>e.path),(e,n)=>{let r=t.get(e);return{kind:`file`,name:n,path:e,status:r.status,adds:r.adds,dels:r.dels,binary:r.binary}}),r=e=>{let t=e.dirs.map(r);return{...e,dirs:t,adds:e.files.reduce((e,t)=>e+t.adds,0)+t.reduce((e,t)=>e+t.adds,0),dels:e.files.reduce((e,t)=>e+t.dels,0)+t.reduce((e,t)=>e+t.dels,0),fileCount:e.files.length+t.reduce((e,t)=>e+t.fileCount,0)}};return r(n)}var Y=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`bmp`,`ico`,`avif`]);function X(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:Y.has(t.slice(n+1).toLowerCase())}function ie(e){return e.tooLarge?`too-large`:X(e.path)?`image`:e.binary?`binary`:`text`}function Z(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}function ae(e,t){let n=i(e.kind===`run`?e.runId:void 0,e.kind===`run`?t:void 0),r=s(e.kind===`repo`?t:void 0);return e.kind===`run`?n:r}function oe(e,t){return e.kind===`run`?a(e.runId,t):r(t)}function se({source:e,path:t,className:n}){let r=ae(e,t??void 0);if(t===null)return(0,w.jsx)($,{className:n,children:(0,w.jsx)(p,{icon:(0,w.jsx)(S,{}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from the tree to preview it here.`})});if(r.isPending)return(0,w.jsx)($,{className:n,children:(0,w.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(r.isError){let e=r.error instanceof o&&r.error.status===409;return(0,w.jsx)($,{className:n,children:(0,w.jsx)(p,{icon:e?(0,w.jsx)(b,{}):(0,w.jsx)(f,{}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:r.error.message})})}return r.data.type===`file`?(0,w.jsx)(le,{source:e,entry:r.data,className:n}):null}function ce(e){return/\.(md|markdown|mdx)$/i.test(e)}var Q=`rendered`;function le({source:e,entry:t,className:n}){let r=ie(t),i=r===`text`&&ce(t.path),[a,o]=(0,C.useState)(Q),s=e=>{Q=e,o(e)};return(0,w.jsxs)($,{className:n,children:[(0,w.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`sticky top-0 z-10 flex items-center gap-2 border-b border-border bg-[color-mix(in_oklab,var(--muted)_40%,var(--card))] px-4 py-2 text-xs shadow-[0_-1px_0_color-mix(in_oklab,var(--muted)_40%,var(--card))]`,children:[(0,w.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),i?(0,w.jsx)(`div`,{"data-slot":`markdown-view-toggle`,className:`ml-auto flex shrink-0 overflow-hidden rounded-sm border border-border`,children:[`rendered`,`source`].map(e=>(0,w.jsx)(`button`,{type:`button`,"data-mode":e,"aria-pressed":a===e,onClick:()=>s(e),className:l(`px-2 py-0.5 capitalize`,a===e?`bg-muted font-medium text-foreground`:`text-soft-foreground hover:bg-muted`),children:e},e))}):null,(0,w.jsx)(`span`,{className:l(`shrink-0 tabular-nums text-soft-foreground`,i?`pl-2`:`ml-auto`),children:Z(t.size)})]}),r===`image`?(0,w.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,w.jsx)(`img`,{"data-slot":`file-preview-image`,src:oe(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):r===`too-large`?(0,w.jsx)(p,{icon:(0,w.jsx)(v,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${Z(t.size)} — past the preview cap. Open it in your editor instead.`}):r===`binary`?(0,w.jsx)(p,{icon:(0,w.jsx)(y,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${Z(t.size)} of binary data — no text preview.`}):i&&a===`rendered`?(0,w.jsx)(`div`,{"data-slot":`file-preview-markdown`,className:`px-4 py-3`,children:(0,w.jsx)(g,{children:t.content??``})}):(0,w.jsx)(fe,{path:t.path,text:t.content??``})]})}function $({className:e,children:t}){return(0,w.jsx)(`section`,{"data-slot":`file-preview`,className:l(`overflow-clip rounded-lg border border-border bg-card`,e),children:t})}var ue=1500;function de(e,t){let n=(0,C.useMemo)(()=>t.split(`
2
+ `).map(e=>[{content:e}]),[t]),r=(0,C.useMemo)(()=>h(e),[e]),i=n.length>ue,[a,o]=(0,C.useState)(null);return(0,C.useEffect)(()=>{if(r===null||i)return;let n=!1;return m(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:te(t,r)?.tokens??n}function fe({path:e,text:t}){let n=de(e,t);return(0,w.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":h(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,w.jsxs)(`div`,{className:`flex px-4`,children:[(0,w.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,w.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,w.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}export{q as a,H as c,ne as d,x as f,J as i,T as l,Z as n,W as o,X as r,U as s,se as t,S as u};
@@ -1 +1 @@
1
- import{F as e}from"./button-wdWSPx_B.js";var t=e(`git-pull-request-draft`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M18 6V5`,key:`1oao2s`}],[`path`,{d:`M18 11v-1`,key:`11c8tz`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]);export{t};
1
+ import{F as e}from"./button-BvYDiOkd.js";var t=e(`git-pull-request-draft`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M18 6V5`,key:`1oao2s`}],[`path`,{d:`M18 11v-1`,key:`11c8tz`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]);export{t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Ai as r,An as i,Ar as a,B as o,Bn as s,Ct as c,Dt as l,Er as u,Fi as d,Fr as f,Ft as p,H as m,Ia as h,J as g,Kr as _,L as v,M as y,Mn as b,Na as x,Oa as S,Oi as C,Ot as w,Q as T,R as E,Sa as D,Sn as O,Ti as ee,Tr as k,U as A,V as j,Vn as M,W as N,Yr as te,_ as ne,_n as re,ba as ie,bn as ae,ca as oe,dn as se,en as ce,er as P,fi as le,h as ue,hn as de,ka as fe,lr as pe,mn as me,mr as he,nn as ge,pn as _e,q as ve,r as F,rr as ye,sr as be,st as xe,u as Se,vi as Ce,vn as we,xr as Te,xt as Ee,ya as De,yi as Oe,zn as ke}from"./queries-DsfjHsrp.js";import{Et as Ae,F as I,It as je,Lt as Me,Ot as Ne,Pt as Pe,Qt as Fe,V as Ie,X as Le,Y as Re,Z as ze,i as Be,r as L,t as R,zt as Ve}from"./button-BvYDiOkd.js";import{c as He,d as Ue,f as z,t as We,x as Ge}from"./project-router-7DKoABD3.js";import{C as Ke,_ as qe,a as Je,c as Ye,d as Xe,f as Ze,g as Qe,h as $e,m as et,n as tt,o as nt,p as rt,r as it,t as at,u as ot,v as st,y as ct}from"./reference-chip-frnxjI-K.js";import{a as lt,i as ut,n as dt,r as ft,t as pt}from"./textarea-D6BGJB7j.js";import{t as mt}from"./check-DC3eAaS2.js";import{f as ht,i as gt,n as _t,r as vt,t as yt}from"./tooltip-Bb7ddw0_.js";import{t as bt}from"./circle-check-DiPv45P_.js";import{a as xt,c as St,g as Ct,i as B,n as wt,o as Tt,r as Et,s as Dt,t as Ot,u as kt}from"./icon-tooltip-nRvCJxOH.js";import{n as At,t as jt}from"./terminal-BIKtPgmL.js";import{c as V,i as Mt,l as Nt,m as Pt,n as Ft,p as It,r as Lt}from"./git-toolbar-CSrf6Ux9.js";import{n as Rt}from"./upload-Crivm77f.js";import{t as zt}from"./triangle-alert-BhQYv6Is.js";import{t as Bt}from"./loader-circle-DAforPX2.js";import{r as Vt,t as Ht}from"./use-submit-shortcut-oBvmLiAo.js";import{t as Ut}from"./search-x-Cm22V3TC.js";import{t as Wt}from"./clipboard-7kWKIj7k.js";import{i as Gt,n as Kt,o as qt,r as Jt,t as Yt}from"./collapsible-OE3rGS50.js";import{a as Xt,c as Zt,i as Qt,n as $t,o as en,r as tn,s as nn,t as rn}from"./alert-dialog-BZU09BVw.js";import{i as an,t as on}from"./token-metrics-CMdTXREP.js";import{n as sn,t as cn}from"./lib-C4vuyY62.js";import{t as ln}from"./centered-state-Bpq40Y_t.js";var un=I(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),dn=I(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),fn=I(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),pn=I(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),mn=I(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),hn=I(`circle-stop`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]]),gn=I(`code-xml`,[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]]),_n=I(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),vn=I(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),yn=I(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),bn=I(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),xn=I(`diamond`,[[`path`,{d:`M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z`,key:`1f1r0c`}]]),Sn=I(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),Cn=I(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),wn=I(`feather`,[[`path`,{d:`M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z`,key:`18jl4k`}],[`path`,{d:`M16 8 2 22`,key:`vp34q`}],[`path`,{d:`M17.5 15H9`,key:`1oz8nu`}]]),Tn=I(`folder-minus`,[[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),En=I(`gem`,[[`path`,{d:`M10.5 3 8 9l4 13 4-13-2.5-6`,key:`b3dvk1`}],[`path`,{d:`M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z`,key:`7w4byz`}],[`path`,{d:`M2 9h20`,key:`16fsjt`}]]),Dn=I(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),On=I(`hammer`,[[`path`,{d:`m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9`,key:`1hayfq`}],[`path`,{d:`m18 15 4-4`,key:`16gjal`}],[`path`,{d:`m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5`,key:`15ts47`}]]),kn=I(`hexagon`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}]]),An=I(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),jn=I(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),Mn=I(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Nn=I(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Pn=I(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),Fn=I(`notebook-text`,[[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`path`,{d:`M9.5 8h5`,key:`11mslq`}],[`path`,{d:`M9.5 12H16`,key:`ktog6x`}],[`path`,{d:`M9.5 16H14`,key:`p1seyn`}]]),In=I(`panel-bottom`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]),Ln=I(`pin`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]),Rn=I(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),zn=I(`shapes`,[[`path`,{d:`M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z`,key:`1bo67w`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}],[`circle`,{cx:`17.5`,cy:`17.5`,r:`3.5`,key:`w3z12y`}]]),Bn=I(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Vn=I(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),Hn=I(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Un=I(`text-cursor-input`,[[`path`,{d:`M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6`,key:`1528k5`}],[`path`,{d:`M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7`,key:`13ksps`}],[`path`,{d:`M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1`,key:`1n9rhb`}],[`path`,{d:`M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1`,key:`1mj8rg`}],[`path`,{d:`M9 6v12`,key:`velyjx`}]]),Wn=I(`waves-horizontal`,[[`path`,{d:`M2 12q2.5 2 5 0t5 0 5 0 5 0`,key:`8ddzzs`}],[`path`,{d:`M2 19q2.5 2 5 0t5 0 5 0 5 0`,key:`1wj4st`}],[`path`,{d:`M2 5q2.5 2 5 0t5 0 5 0 5 0`,key:`69x50u`}]]),Gn=I(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),H=e(t(),1),U=n(),Kn=`cez:stale-build-reload-at`,qn=6e4,Jn=!1;function Yn(e=Xn(),t=()=>window.location.reload(),n=Date.now()){if(Jn)return!0;if(!e)return!1;try{let t=Number(e.getItem(Kn));if(Number.isFinite(t)&&t>0&&n-t<qn)return!1;e.setItem(Kn,String(n))}catch{return!1}return Jn=!0,t(),!0}function Xn(){try{return window.sessionStorage}catch{return null}}function W(e,t){try{fetch(e,{method:`POST`,headers:{"content-type":`application/json`,[ie]:D()},body:JSON.stringify(t),keepalive:!0}).catch(()=>{})}catch{}}function Zn(e){W(`/api/v1/telemetry/event`,{event:`message_sent`,label:e})}function Qn(e){W(`/api/v1/telemetry/event`,{event:`design_mode_enabled`,label:e})}function $n(){W(`/api/v1/telemetry/event`,{event:`schedule_menu_opened`,label:`new_task`})}function er(e){W(`/api/v1/telemetry/event`,{event:`start_option_picked`,label:e})}function tr(e){W(`/api/v1/telemetry/event`,{event:`task_scheduled`,label:e})}function nr(e){W(`/api/v1/telemetry/event`,{event:`diff_comment_added`,label:e})}function rr(e){e<1||W(`/api/v1/telemetry/event`,{event:`attachments_sent`,label:Le(e)})}function ir(e){W(`/api/v1/telemetry/event`,{event:`attachments_restaged`,label:e})}function ar(e){W(`/api/v1/telemetry/event`,{event:`add_project_opened`,label:e})}function or(e){W(`/api/v1/telemetry/event`,{event:`skills_update_apply_dropped`,label:e})}function sr(e){W(`/api/v1/telemetry/event`,{event:`palette_opened`,label:e})}function cr(e){W(`/api/v1/telemetry/event`,{event:`task_switched`,label:e})}function lr(e){for(let t of e)W(`/api/v1/telemetry/event`,{event:`palette_mode_used`,label:t})}function ur(e){W(`/api/v1/telemetry/event`,{event:`palette_dismissed`,label:e})}function dr(e){let t=ze(e);t&&W(`/api/v1/telemetry/event`,{event:`shortcut_rebound`,label:t})}function fr(e,t){let n=e.trim().toLowerCase();if(n===``)return[];let r=t?[t]:[];return t===`files`?r:(/^(?:(?:pr|issue)\s*)?#?\d{1,7}$/.test(n)&&r.push(`pr_number`),/\bauto/.test(n)&&r.push(`automation`),r)}function pr(e,t=6e4){let n=new Map,r,i=()=>{clearTimeout(r),r=void 0;for(let[t,r]of n){let[n,i]=t.split(`\0`);for(let t=r;t>0;t-=1e3)e(n,i,Math.min(t,1e3))}n.clear()};return{add:(e,a)=>{let o=`${e}\u0000${a}`;n.set(o,(n.get(o)??0)+1),r??=setTimeout(i,t)},flush:i}}var mr=pr((e,t,n)=>W(`/api/v1/telemetry/event`,{event:e,label:t,value:n}));typeof window<`u`&&(window.addEventListener(`pagehide`,mr.flush),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`hidden`&&mr.flush()}));function hr(e,t){let n=ze(e);n&&mr.add(t===`palette`?`task_command_run`:`task_shortcut_used`,n)}function gr(e){return e.startsWith(`/p/`)||e===`/tasks`||e===`/dashboard`||e.startsWith(`/settings/global/`)}function _r(e){W(`/api/v1/telemetry/page`,{route:e})}var vr=new Set(Re);function yr(e){return`/${e.split(`/`).filter(Boolean).map(e=>vr.has(e)?e:`:param`).join(`/`)}`}function br(e){return/Firefox\//.test(e)?`gecko`:/Chrom(e|ium)\/|Edg\//.test(e)?`chromium`:/AppleWebKit\//.test(e)?`webkit`:`other`}function xr(e){return/iPhone|iPad|iPod/.test(e)?`ios`:/Android/.test(e)?`android`:/Mac OS X|Macintosh/.test(e)?`macos`:/Windows/.test(e)?`windows`:/Linux/.test(e)?`linux`:`other`}function Sr(){try{let e=new URL(import.meta.url).pathname.split(`/`).pop()??``;return/^[\w.-]+\.js$/.test(e)?e:null}catch{return null}}var G={route:yr(typeof window>`u`?`/`:window.location.pathname),previousRoute:null,routeEnteredAt:0,navigations:0,errors:0,serverVersion:null,latestVersion:null};function Cr(){return`__CEZ_DESKTOP__`in window||document.documentElement.dataset.cezDesktop||`__TAURI_INTERNALS__`in window?`desktop`:`browser`}function wr(e={}){let t=navigator.userAgent,n=performance.now();return{...e,"page.route":G.route,"page.previous_route":G.previousRoute,"page.time_on_route_s":Math.round((n-G.routeEnteredAt)/1e3),"session.age_s":Math.round(n/1e3),"session.navigations":G.navigations,"session.errors":G.errors,"client.surface":Cr(),"client.engine":br(t),"client.os":xr(t),"client.online":navigator.onLine,"client.visibility":document.visibilityState,"client.viewport_w":window.innerWidth,"build.entry":Sr(),"build.server_version_at_load":G.serverVersion,"build.update_available":G.latestVersion!==null&&G.latestVersion!==G.serverVersion}}var Tr=[/^ResizeObserver loop (limit exceeded|completed with undelivered notifications)/];function Er(e){return Tr.some(t=>t.test(e))}function Dr(e,t=document.documentElement){let n=e.message??``;if(n===`Script error.`&&!e.filename&&!e.error)return!0;let r=e.error instanceof Error?`${e.error.name}: ${e.error.message}`:n;return/\bwindow\.ethereum\b/.test(r)?!0:/\btranslated-(ltr|rtl)\b/.test(t.className)&&/NotFoundError: (Failed to execute '(removeChild|insertBefore)' on 'Node'|Node\.(removeChild|insertBefore):)/.test(r)}function Or(e){return e&&(e.split(/[?#]/)[0]?.split(`/`).pop()??``)||null}var kr=new WeakSet,Ar={error:0,toast:0,staging:0};function jr(e){return e.name===`ApiError`&&e.status===0?Fr(e.cause):{}}function K(e,t,n={}){if(typeof e==`object`&&e){if(kr.has(e))return;kr.add(e)}G.errors+=1;let r=Date.now(),i=t===`toast`?`toast`:t===`attachment-staging`?`staging`:`error`;if(r-Ar[i]<1e4)return;Ar[i]=r;let a=e instanceof Error,o=a?e:Error(String(e));W(`/api/v1/telemetry/error`,{type:(n.type??(o.name||`Error`)).slice(0,128),message:(o.message||`unknown error`).slice(0,2048),stack:a?o.stack?.split(window.location.origin).join(``).slice(0,16384):void 0,handler:t,code:n.code,fingerprint:n.fingerprint,context:wr({...jr(o),...n.context})})}var Mr=new Set(`api.v1.agent-profiles.apply.archive.archive-finished.association.auto-resume.automation-checks.automation-log.automation-options.automation-templates.branch.branding-logo.cancel.candidates.channel.check.checkout.checks.comments.commit.config.connect.connection.consent.continue.details.diff.dispatch.drafts.enable.events.feed.finish.groups.handoff.health.host-usage.images.importable.launch-key.merge-state.messages.models.nodes.open.open-in.open-in-cli.open-targets.parse.pause.pick.pin.plan.pr.providers.push.queued-messages.read.read-all.reclaim.refresh.remove-worktree.repo.report.retry.run.runs.runs-index.search.self-update.setup.skills-update.star-count.status.telemetry.todos.tree.ui-state.unread.validate.watch.workspace.ws`.split(`.`));function Nr(e){let t=e.split(`/`).filter(Boolean);return`/${t.map((e,n)=>t[n-1]===`p`||!(Mr.has(e)||vr.has(e))?`:param`:e).join(`/`)}`.slice(0,256)}function Pr(e,t=Date.now()){return e?{type:`ApiError`,context:{"request.method":e.method,"request.route":Nr(e.path),"request.status":e.status,"request.age_ms":t-e.at,...e.provider?{"request.provider":e.provider}:{},...Fr(e.cause)}}:{type:`ErrorToast`,context:{}}}function Fr(e){if(typeof e!=`object`||!e)return{};let{name:t,message:n}=e;return{"request.cause_name":typeof t==`string`&&/^[A-Za-z]\w{0,63}$/.test(t)?t:`other`,"request.cause_message":typeof n==`string`?zr(n).slice(0,256):``}}var Ir=[],Lr=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),Rr=/(?<![\w./-])[\w-][\w.-]*\.(?:png|jpe?g|gif|webp|bmp|heic|avif|tiff?|ico|svg|pdf|txt|md|markdown|log|html?|csv|tsv|json|ya?ml|xml|rtf|docx?|xlsx?|pptx?|od[tsp]|zip|tar|t?gz|bz2|xz|7z|rar|mp[34]|mov|wav|webm|bin)(?![\w.-])/gi;function zr(e,t=Ir){let n=e.replace(/“[^”]*”|‘[^’]*’|"[^"]*"|`[^`]*`|(?<!\w)'[^'\n]+'(?!\w)/g,`<value>`).replace(/[^\s()[\]{}<>,;]+@[^\s()[\]{}<>,;]+\.\w+/g,`<email>`).replace(Rr,`<file>`).replace(/[^\s()[\]{}<>,;]*\/[^\s()[\]{}<>,;]*/g,e=>{if(!/^(https?:\/\/[^/\s]+)?\/api\//.test(e))return`<path>`;try{return Nr(new URL(e,`http://localhost`).pathname)}catch{return`<path>`}});for(let e of[...new Set(t)].filter(e=>e.length>=3).sort((e,t)=>t.length-e.length))n=n.replace(RegExp(`(?<![\\w-])${Lr(e)}(?![\\w-])`,`gi`),`<project>`);return n.replace(/:\s+\S.*$/s,`: <detail>`)}function Br(e){let{type:t,context:n}=Pr(De());K(zr(e),`toast`,{type:t,context:n})}function Vr(e){let t=e?.status;K(e,`attachment-staging`,{code:`attachment_stage_failed`,context:{"request.route":`/api/v1/workspace/uploads`,...typeof t==`number`?{"request.status":t}:{}}})}function Hr(e){K(Error(`Dictation failed`),`toast`,{type:`DictationError`,code:`dictation_failed`,fingerprint:`cockpit:dictation_failed`,context:{"dictation.error":/^[a-z][a-z-]{0,63}$/.test(e)?e:`other`,"dictation.secure_context":window.isSecureContext!==!1}})}function Ur(e,t){return(0,H.lazy)(()=>t().catch(t=>{if(Yn())return new Promise(()=>{});throw K(t,`lazy-route`,{code:`chunk_load_failed`,fingerprint:`cockpit:chunk_load_failed`,context:{"chunk.route":e}}),t}))}var Wr=!1;function Gr(){let{pathname:e}=Ge(),t=y(),n=ve();return(0,H.useEffect)(()=>{Ir=(n.data?.projects??[]).flatMap(e=>[e.name,e.id])},[n.data]),(0,H.useEffect)(()=>{t.data&&G.serverVersion===null&&(G.serverVersion=t.data.version),G.latestVersion=t.data?.latestVersion??G.latestVersion},[t.data]),(0,H.useEffect)(()=>{Wr||(Wr=!0,window.addEventListener(`error`,e=>{Er(e.message??``)||Dr(e)||K(e.error??e.message,`window.error`,{context:{"error.source_file":Or(e.filename),"error.line":e.lineno||null,"error.col":e.colno||null}})}),window.addEventListener(`unhandledrejection`,e=>K(e.reason,`unhandledrejection`)),window.addEventListener(`vite:preloadError`,e=>{Yn()||K(e.payload,`vite:preloadError`,{code:`chunk_load_failed`,fingerprint:`cockpit:chunk_load_failed`})}),Ue(Br))},[]),(0,H.useEffect)(()=>{if(!gr(e))return;let t=yr(e);(t!==G.route||G.navigations===0)&&(G.navigations>0&&(G.previousRoute=G.route),G.route=t,G.routeEnteredAt=performance.now(),G.navigations+=1,_r(t))},[e]),null}var Kr={claude:`Claude Code`,codex:`Codex`,junie:`Junie`,opencode:`OpenCode`,cursor:`Cursor`,pi:`pi`,copilot:`GitHub Copilot CLI`};function qr(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function Jr(e){return e.runner??`claude`}function Yr(e,t){let n=S(t,e);return n?.enabled===!1?{provider:e,usable:!1,reason:`${Kr[e]} is disabled. Enable it in Settings → Agents → Providers.`}:n?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${Kr[e]} credentials are unavailable. Authorize it in Settings → Agents → Providers.`}}function Xr(e,t){return Yr(qr(e),t)}function Zr(e,t){return Yr(Jr(e),t)}function Qr(e){let t=g(),n=qr(e);return t.isSuccess&&t.data?Xr(e,t.data):{provider:n,usable:!0}}function $r(e){let t=g(),n=Jr(e);return t.isSuccess&&t.data?Zr(e,t.data):t.isError?{provider:n,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:n,usable:!1,reason:`Checking agent providers…`}}var ei={folder:It,terminal:Hn,vscode:_n,cursor:Pn,zed:Gn,windsurf:Wn,sublime:wn,idea:xn,pycharm:kn,webstorm:Dn,goland:zn,rubymine:En,phpstorm:fn,clion:bn,rider:dn,"android-studio":Bn,xcode:On,warp:Rn,claude:lt,codex:Vn,junie:lt,opencode:lt,pi:lt,copilot:lt};function ti(e){return e.icon&&ei[e.icon]||At}var ni=RegExp(`^cli:(${Fe.options.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})$`);function ri(e){let t=ni.exec(e);return t?t[1]:void 0}function ii({choices:e,onPick:t,label:n=`Open in…`,title:r,triggerVariant:i=`ghost`,disabled:a=!1,leading:o,trailing:s,slot:c}){return(0,U.jsxs)(wt,{children:[(0,U.jsx)(kt,{asChild:!0,children:(0,U.jsxs)(R,{variant:i,size:`sm`,title:r,disabled:a,"data-slot":c,children:[(0,U.jsx)(At,{"aria-hidden":`true`}),n]})}),(0,U.jsxs)(Et,{align:`end`,children:[o,o&&e.length>0?(0,U.jsx)(St,{}):null,e.map(({target:e,suffix:n,title:r})=>{let i=ti(e);return(0,U.jsxs)(B,{"data-target":e.id,title:r,onSelect:()=>t(e.id),children:[(0,U.jsx)(i,{"aria-hidden":`true`}),e.label,n??``]},e.id)}),s]})]})}var ai=[`done`,`failed`,`cancelled`],oi=[`done`,`failed`];function si(e){return e.status===`failed`&&e.autoResumeAt!==void 0}function ci(e){return e.status===`failed`&&e.awaitingAnswerSince!==void 0}function li(e){return ai.includes(e)}function ui(e){return e.archived||si(e)||ci(e)||!oi.includes(e.status)?!1:e.finishedAt!==void 0}function di(e){let t=e.finishedAt;return t===void 0||!ui(e)?!1:e.seenAt===void 0||e.seenAt<t}function fi(e){return si(e)||ci(e)?!1:li(e.status)&&!di(e)}function pi(e){return e.reduce((e,t)=>di(t)?e+1:e,0)}function q(e){return e===`running`||e===`queued`||e===`waiting`}function mi(e){return!q(e.status)&&e.worktree!==!1&&!!e.worktreePath&&!e.worktreeReclaimedAt&&!e.worktreeLifecycle?.activeOperationId}function hi(e){return[...e.steps].reverse().find(e=>e.sessionId)?.sessionId}var gi=/^[A-Za-z0-9._][A-Za-z0-9._-]{0,199}$/,_i={claude:`claude --resume`,codex:`codex resume`,opencode:`opencode --session`,cursor:`agent --resume`,junie:`junie --resume`,pi:`pi --session`,copilot:`copilot --resume`};function vi(e,t){if(gi.test(t))return e===`junie`?`${_i.junie} --session-id=${t}`:`${_i[e??`claude`]} ${t}`}function yi(e){if(q(e.status)||e.worktreeLifecycle?.activeOperationId)return;let t=hi(e);if(t===void 0)return;let n=vi(e.runner,t);if(n!==void 0)return e.worktreePath?`cd ${e.worktreePath} && ${n}`:n}function bi(e,t){let n=ri(t);return!n||q(e.status)||e.worktreeLifecycle?.activeOperationId?!1:n===(e.runner??`claude`)&&hi(e)!==void 0}function xi(e){let t=q(e.status),n=hi(e)!==void 0,r=!!e.worktreeLifecycle?.activeOperationId;return{finish:!r&&(e.status===`waiting`||e.status===`review`),continueRun:!r&&!t&&n,terminal:!r&&!t&&n,notes:!0,archive:!t,pin:!e.archived,markUnread:ui(e)&&!di(e),markRead:ui(e)&&di(e),cancel:!r&&t,deleteRun:!r&&!t}}function Si(e){return e?`Resolve conflicts in PR ${e}`:`Resolve conflicts`}function Ci(e){return e?`Fix failing checks in PR ${e}`:`Fix failing checks`}function wi(e){return e?`Commit and push`:`Commit`}function Ti(){return`Push`}function Ei(e){let t=e?.replace(/^origin\//,``);return t&&!/^[0-9a-f]{7,40}$/i.test(t)?t:void 0}function Di(e,t){let n=Ei(t);return`${e?`Create draft PR`:`Create PR`}${n?` against ${n}`:``}`}function Oi(e){let t=Ei(e);return t?`Update branch from ${t}`:`Update branch`}function ki(e,t){return`${e?`Create draft PR`:`Create PR`} against ${t} instead of landing: move these changes to a new branch, commit and push it, open the PR, then switch the checkout back to ${t}`}function Ai(e){return`Update branch: pull the latest ${e} into the checkout (rebase, keeping these uncommitted changes)`}function ji(e){return e===`review`?`Accept the changes without a PR`:`Close the session`}function Mi(e,t){let n=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt)).findIndex(e=>e.id===t);return n>=0?n+1:void 0}var Ni=[50,100,200,400,800,1e3,1e3,1e3,1e3],Pi=e=>new Promise(t=>setTimeout(t,e));function Fi(e){return e instanceof P&&e.status===409&&e.message===`run is still active`}async function Ii(e,t=Pi){for(let n=0;;n+=1)try{return await e()}catch(e){let r=Ni[n];if(!Fi(e)||r===void 0)throw e;await t(r)}}function Li(e){return q(e.status)?`live`:xi(e).continueRun?`resume`:`unavailable`}function Ri(e,t,n=`ask_answer`){let r=p(e.id,t),i=ne(e.id,t),a=Qr(e),o=$r(e),[s,c]=(0,H.useState)(void 0),[l,u]=(0,H.useState)(!1),d=(0,H.useRef)(!1),f=Li(e),m=f===`resume`?!o.usable:f===`live`&&!a.usable,h=f===`unavailable`?`no-session`:m?`provider`:void 0,g=h===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:h===`provider`?f===`resume`?o.reason:a.reason:void 0,_=e=>o.usable?i.mutateAsync({text:e}).then(e=>(Zn(n),e)):Promise.reject(Error(o.reason??`The run provider is unavailable.`));return{mode:f,blockedBy:h,reason:g,isPending:l||r.isPending||i.isPending,error:s,send:async t=>{if(h||d.current)return g;d.current=!0,u(!0),c(void 0);try{if(f===`resume`){await Ii(()=>_(t));return}try{await r.mutateAsync({text:t}),Zn(n)}catch(n){if(n instanceof P&&n.status===409&&hi(e)!==void 0){await Ii(()=>_(t));return}throw n}return}catch(e){let t=e instanceof Error?e.message:String(e);return c(t),t}finally{d.current=!1,u(!1)}}}}function zi({run:e,projectId:t,prNumber:n}){let r=Ri(e,t),i=tt(),[a,o]=(0,H.useState)(!1),s=a||r.isPending,c=!!r.blockedBy,l=async()=>{if(s||c)return;let e=r.mode===`resume`;o(!0);try{let t=await r.send(Si(n));t?z(t,{tone:`danger`}):(z(`${e?`Task reopened`:`Sent to the task`} — resolving conflicts${n?` in PR #${n}`:``}`),i())}finally{o(!1)}};return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(R,{type:`button`,size:`sm`,"data-slot":`reference-conflict-action`,disabled:c||s,onClick:()=>void l(),className:`h-7 w-full text-xs`,children:s?`Sending…`:`Resolve conflicts`}),c&&r.reason?(0,U.jsx)(`span`,{className:`block opacity-70`,children:r.reason}):null]})}function Bi({projectId:e,runId:t,prNumber:n}){let r=N(e,t);return r.data?(0,U.jsx)(zi,{run:r.data,projectId:e,prNumber:n}):(0,U.jsx)(R,{type:`button`,size:`sm`,disabled:!0,className:`h-7 w-full text-xs`,children:r.isError?`Unavailable`:`Loading…`})}function Vi({run:e,reference:t,className:n,compact:r=!1,projectId:i}){let a=Xe(),{lookup:o}=a,s=i??a.projectId,c=t.kind===`PR`?ae(e).filter(e=>e.kind===`PR`&&(e.number!==t.number||!!e.url&&!!t.url&&e.url!==t.url)):[];return(0,U.jsx)(U.Fragment,{children:(t.number===void 0?[t,...c]:de([{...t,number:t.number},...c],e=>s?o({projectId:s,kind:e.kind,number:e.number}).status:void 0)).map((t,a)=>(0,U.jsx)(H.Fragment,{children:(0,U.jsx)(at,{reference:t,taskTitle:b(e),projectId:i,conflictAction:i===void 0?(0,U.jsx)(zi,{run:e,prNumber:t.number}):(0,U.jsx)(Bi,{projectId:i,runId:e.id,prNumber:t.number}),className:n,compact:r})},`${t.kind}-${t.number??`unknown`}-${t.url??a}`))})}function J(e=typeof navigator>`u`?``:navigator.platform){return/mac|iphone|ipad|ipod/i.test(e)}var Hi={Slash:`/`,Backslash:`\\`,Period:`.`,Comma:`,`,Semicolon:`;`,Quote:`'`,BracketLeft:`[`,BracketRight:`]`,Minus:`-`,Equal:`=`,Backquote:"`",Enter:`Enter`,Space:`Space`,Backspace:`Backspace`,Delete:`Delete`,Tab:`Tab`,Escape:`Escape`,ArrowUp:`Up`,ArrowDown:`Down`,ArrowLeft:`Left`,ArrowRight:`Right`};function Ui(e){let t=e.code??``;if(/^Key[A-Z]$/.test(t))return t.slice(3);if(/^Digit[0-9]$/.test(t))return t.slice(5);if(/^Numpad[0-9]$/.test(t))return t.slice(6);if(/^F([1-9]|1[0-2])$/.test(t))return t;if(t in Hi)return Hi[t];let n=e.key??``;return n.length===1&&n!==` `?n.toUpperCase():null}function Wi(e,t=J()){if([`Meta`,`Control`,`Alt`,`Shift`,`OS`,`AltGraph`].includes(e.key)||!t&&e.getModifierState?.(`AltGraph`))return null;let n=Ui(e);if(!n)return null;let r=[];return(t?e.metaKey:e.ctrlKey)&&r.push(`Mod`),t&&e.ctrlKey&&r.push(`Ctrl`),e.altKey&&r.push(`Alt`),e.shiftKey&&r.push(`Shift`),r.push(n),r.join(`+`)}function Gi(e,t=J()){let n=e.split(`+`),r=n.at(-1)||`+`,i=n.slice(0,-1);if(t){let e={Ctrl:`⌃`,Alt:`⌥`,Shift:`⇧`,Mod:`⌘`};return[`Ctrl`,`Alt`,`Shift`,`Mod`].filter(e=>i.includes(e)).map(t=>e[t]).join(``)+r}let a={Mod:`Ctrl`,Alt:`Alt`,Shift:`Shift`};return[...i.map(e=>a[e]??e),r].join(`+`)}function Ki(e=document){return e.querySelector(`[role="dialog"], [role="alertdialog"], [role="menu"]`)!==null}function qi(e,t=J()){if(!e)return;let n=/^Mod\+([1-9])$/.exec(e);return n?n[1]:Gi(e,t)}var Ji=new Set([`Mod+K`,`Mod+P`,`Mod+N`,`Mod+Enter`,`Alt+D`,"Mod+Shift+`",`Mod+A`,`Mod+C`,`Mod+V`,`Mod+X`,`Mod+Z`,`Mod+Shift+Z`,`Mod+F`,`Mod+L`,`Mod+R`,`Mod+T`,`Mod+W`,`Mod+Q`,`Mod+Shift+T`,`Mod+Shift+N`,`Mod+Shift+W`]);function Yi(e,t=J()){if(!(t||[`Control`,`Alt`,`AltGraph`].includes(e.key))&&(e.getModifierState?.(`AltGraph`)||e.ctrlKey&&e.altKey))return`Ctrl+Alt — types characters on many layouts`}function Xi(e,t=J()){let n=e.split(`+`).slice(0,-1);if(!n.some(e=>e===`Mod`||e===`Ctrl`||e===`Alt`))return`Use ⌘/Ctrl, ⌃ or ⌥ with the key`;if(!t&&n.includes(`Mod`)&&n.includes(`Alt`))return`Ctrl+Alt types characters on many layouts`;if(Ji.has(e))return`That shortcut is taken by the browser or cezar`}var Zi={...Object.fromEntries(Array.from({length:9},(e,t)=>[`tab:${t+1}`,`Mod+${t+1}`])),"terminal-column":`Mod+/`},Qi=200;function $i(e){if(typeof e!=`object`||!e||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e)){if(Object.keys(t).length>=Qi)break;n.length<1||n.length>120||(r===null||typeof r==`string`&&r.length>=1&&r.length<=40)&&(t[n]=r)}return t}function ea(e={}){let t=new Map;for(let[n,r]of Object.entries(Zi))n in e||t.set(n,r);for(let[n,r]of Object.entries(e))r&&t.set(n,r);let n=new Map;for(let[r,i]of t){let t=n.get(i);(t===void 0||r in e&&!(t in e))&&n.set(i,r)}return new Map([...t].filter(([e,t])=>n.get(t)===e))}function ta(e,t,n){let r={...e};if(n)for(let[i,a]of ea(e))i!==t&&a===n&&(Zi[i]?r[i]=null:delete r[i]);return n===(Zi[t]??null)?delete r[t]:r[t]=n,r}function na(e,t){return ta(e,t,Zi[t]??null)}var ra=[{id:`reply`,label:`Write to the agent`,group:`Actions`},{id:`toggle-read`,label:`Mark read / unread`,group:`Actions`},{id:`pin`,label:`Pin / Unpin`,group:`Actions`},{id:`archive`,label:`Archive / Unarchive`,group:`Actions`},{id:`rename`,label:`Rename`,group:`Actions`},{id:`end-session`,label:`End session`,group:`Actions`},{id:`accept`,label:`Accept changes without a PR`,group:`Actions`},{id:`stop`,label:`Stop`,group:`Actions`},{id:`delete`,label:`Delete`,group:`Actions`},{id:`git:commit`,label:`Commit`,group:`Git`},{id:`git:commit-push`,label:`Commit and push`,group:`Git`},{id:`git:push`,label:`Push`,group:`Git`},{id:`git:create-pr`,label:`Create PR`,group:`Git`},{id:`git:create-draft-pr`,label:`Create draft PR`,group:`Git`},{id:`git:update-branch`,label:`Update branch`,group:`Git`},{id:`git:resolve-conflicts`,label:`Resolve conflicts`,group:`Git`},{id:`git:fix-checks`,label:`Fix errors`,group:`Git`},{id:`open-pr`,label:`Open pull request`,group:`Git`},...Array.from({length:9},(e,t)=>({id:`tab:${t+1}`,label:`Tab ${t+1}`,group:`Go to view`})),{id:`view:session`,label:`Chat`,group:`Go to view`},{id:`view:changes`,label:`Changes`,group:`Go to view`},{id:`view:commits`,label:`Commits`,group:`Go to view`},{id:`view:files`,label:`Files`,group:`Go to view`},{id:`view:graph`,label:`Graph`,group:`Go to view`},{id:`view:notes`,label:`Notes`,group:`Go to view`},{id:`view:browser`,label:`Preview`,group:`Go to view`},{id:`view:terminal`,label:`Terminal`,group:`Go to view`},{id:`full-view`,label:`Full view`,group:`Layout`},{id:`split`,label:`Split view`,group:`Layout`},{id:`terminal`,label:`Show / hide terminal`,group:`Layout`},{id:`terminal-column`,label:`Terminal in a column`,group:`Layout`},{id:`open:terminal-resume`,label:`Terminal (resume session)`,group:`Open in`},{id:`copy:link`,label:`Copy task link`,group:`Copy`},{id:`copy:branch`,label:`Copy branch name`,group:`Copy`},{id:`copy:path`,label:`Copy worktree path`,group:`Copy`},{id:`copy:resume`,label:`Copy resume command`,group:`Copy`},{id:`copy:pr`,label:`Copy pull request link`,group:`Copy`},{id:`copy:id`,label:`Copy task id`,group:`Copy`}];function ia(){let e=h(),t=ce(),n=H.useRef(0),r=H.useRef(Promise.resolve()),i=t.data?.keybindings,a=H.useMemo(()=>$i(i),[i]),o=H.useMemo(()=>ea(a),[a]),s=H.useCallback(t=>{let i=e.getQueryData(ge.uiState);if(i===void 0)return;let a=t($i(i.keybindings));e.setQueryData(ge.uiState,{...i,keybindings:a});let o=++n.current,s=r.current.then(async()=>{let t=await d({keybindings:a},{keepalive:!0});o===n.current&&e.setQueryData(ge.uiState,t)});r.current=s.catch(t=>{z(t instanceof Error?t.message:String(t),{tone:`danger`}),o===n.current&&e.invalidateQueries({queryKey:ge.uiState})})},[e]);return{overrides:a,bindings:o,ready:t.data!==void 0,assign:H.useCallback((e,t)=>{s(n=>ta(n,e,t)),dr(e)},[s]),reset:H.useCallback(e=>s(t=>na(t,e)),[s]),resetAll:H.useCallback(()=>s(()=>({})),[s])}}var aa=e=>e===`running`||e===`queued`||e===`waiting`,oa=`no worktree — this task ran directly in the repo working tree`,sa=e=>e.agentBlocked!==void 0;function ca(e){let t=e=>({id:`commit`,label:`Commit`,enabled:!1,reason:e});return e.hasWorktree?sa(e)&&e.status===`running`?t(`Commit unavailable — the agent is still working in this worktree`):e.uncommitted===void 0?t(`Commit unavailable — changes are still loading`):e.uncommitted===0?t(`Commit unavailable — no changes to commit`):{id:`commit`,label:`Commit`,enabled:!0}:t(`Commit unavailable — ${oa}`)}function la(e){let t=ca(e);return ua({...e,unpushed:void 0,status:`done`}).enabled?{...t,id:`commit-push`,label:`Commit and push`,...t.reason?{reason:t.reason.replace(/^Commit unavailable/,`Commit and push unavailable`)}:{}}:t}function ua(e){let t=e=>({id:`push`,label:`Push`,enabled:!1,reason:e});return e.hasWorktree?e.remote===void 0?t(`Push unavailable — no remote configured`):e.branch===void 0?t(`Push unavailable — the run has no branch to push`):sa(e)&&e.status===`running`?t(`Push unavailable — the agent is still working in this worktree`):e.unpushed===0?t(`Push unavailable — the remote already has every commit`):{id:`push`,label:`Push`,enabled:!0}:t(`Push unavailable — ${oa}`)}function da(e){let t=e=>({id:`create-pr`,label:`Create PR`,enabled:!1,reason:e});return!e.hasWorktree||e.branch===void 0?t(`Create PR unavailable — ${oa}`):e.forge===null?t(`Create PR unavailable — no supported forge remote (GitHub) detected`):e.forge.available?sa(e)&&e.status===`waiting`?t(`Create PR unavailable — the session is still open; end the session to open a PR`):sa(e)&&aa(e.status)?t(`Create PR unavailable — the agent is still working; wait for it to finish`):{id:`create-pr`,label:`Create PR`,enabled:!0,alternatives:[{id:`create-draft-pr`,label:`Create draft PR`,enabled:!0}]}:t(`Create PR unavailable — ${e.forge.reason??`the forge is unreachable`}`)}function fa(e){if(!e.hasWorktree||e.prStatus===`merged`||e.prStatus===`closed`)return null;let t=e.behind!==void 0&&e.behind!==null&&e.behind>0&&!e.agentBlocked?ma(e,`update-branch`,`Update branch`):null;if(!e.prUrl&&e.forge!==null){if(e.uncommitted===0&&e.ahead===0)return null;let n=da(e);return n.enabled?t?{...n,alternatives:[...n.alternatives??[],t]}:n:t??n}if(e.uncommitted===void 0)return null;let n=e.uncommitted>0;return e.prUrl?n?la(e):e.unpushed!==void 0&&e.unpushed!==null&&e.unpushed>0?ua(e):e.prConflicting===!0?ma(e,`resolve-conflicts`,`Resolve conflicts`):t||(e.prStatus===`checks-failing`?ma(e,`fix-checks`,`Fix errors`):null):n?la(e):e.unpushed===0?t:ua(e)}function pa(e){if(e.uncommitted===void 0)return null;let t=e.behind!==void 0&&e.behind!==null&&e.behind>0?ma(e,`update-branch`,`Update branch`):null;if(!(e.uncommitted>0||(e.unpushed??0)>0))return t;let n=e.forge===null?`no supported forge remote (GitHub) detected`:e.forge.available===!1?e.forge.reason??`the forge is unreachable`:e.agentBlocked,r=(e,t)=>n?{id:e,label:t,enabled:!1,reason:`${t} unavailable — ${n}`}:{id:e,label:t,enabled:!0},i=[r(`create-pr`,`Create PR`),r(`create-draft-pr`,`Create draft PR`),...t?[t]:[]],a=`Commit to ${e.base}`;return e.status===`running`||e.status===`queued`?{id:`land`,label:a,enabled:!1,reason:`${a} unavailable — the agent is still working`,alternatives:i}:{id:`land`,label:a,enabled:!0,alternatives:i}}function ma(e,t,n){return e.agentBlocked?{id:t,label:n,enabled:!1,reason:`${n} unavailable — ${e.agentBlocked}`}:{id:t,label:n,enabled:!0}}function ha({run:e,open:t,onOpenChange:n,andPush:r=!1,onCommitted:i}){let a=h(),[o,s]=(0,H.useState)(``),c=b(e),l=(0,H.useRef)(c);l.current=c,(0,H.useEffect)(()=>{t&&s(l.current)},[t]);let u=x({mutationFn:t=>he(e.id,t),onSuccess:t=>{z(`Committed ${t.sha.slice(0,7)}${r?` — pushing…`:``}`),i?.(),n(!1),a.invalidateQueries({queryKey:F.runs.changes(e.id)}),a.invalidateQueries({queryKey:F.runs.gitStatus(e.id)}),a.invalidateQueries({queryKey:F.runs.all})},onError:e=>z(e.message,{tone:`danger`})}),d=()=>{let e=o.trim();e.length===0||u.isPending||u.mutate(e)};return(0,U.jsx)(Ze,{open:t,onOpenChange:n,children:(0,U.jsxs)(rt,{"data-slot":`commit-dialog`,children:[(0,U.jsxs)(Qe,{children:[(0,U.jsx)(qe,{children:r?`Commit and push`:`Commit changes`}),(0,U.jsxs)(et,{children:[`Stages everything in the task's worktree (git add -A) and commits to`,` `,e.branch?(0,U.jsx)(`span`,{className:`font-mono`,children:e.branch}):`its branch`,r?`, then pushes it`:``,`.`]})]}),(0,U.jsx)(pt,{"data-slot":`commit-message`,"aria-label":`Commit message`,rows:3,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{Ht({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),d())}}),(0,U.jsxs)($e,{children:[(0,U.jsx)(R,{variant:`outline`,onClick:()=>n(!1),children:`Cancel`}),(0,U.jsx)(R,{"data-slot":`commit-confirm`,disabled:o.trim().length===0||u.isPending,onClick:d,children:u.isPending?`Committing…`:r?`Commit and push`:`Commit`})]})]})})}var ga=3e4,_a=3e3,va=e=>e===`create-pr`||e===`create-draft-pr`,ya=new Map,ba=new Set,xa=e=>(ba.add(e),()=>ba.delete(e));function Sa(e,t){t?ya.set(e,t):ya.delete(e);for(let e of ba)e()}function Ca(e,t){return ya.get(e)===t?(Sa(e,null),!0):!1}function wa(e){let t=_e(e),n=t?.url??(t?.number===void 0?void 0:`#${t.number}`),r=t?.number,i=ot(`PR`,r),a=i.status,o=a===`merged`||a===`closed`,s=Nt(),l=xe(),u=ue(),d=!e.worktreePath&&e.worktree===!1&&!e.readOnly&&u.data?.landing===`auto`&&u.data.landingBlocked===null,f=u.data?.baseBranch??l.data?.info?.branch??`main`,p=c(e.id,(!!e.worktreePath||d)&&!o,q(e.status)||d),m=h();(0,H.useEffect)(()=>{m.invalidateQueries({queryKey:F.runs.gitStatus(e.id)})},[e.status,e.id,m]);let[g,_]=(0,H.useState)(!1),[v,y]=(0,H.useState)(!1),b=Ri(e,void 0,`git_step`),S=h(),w=()=>S.invalidateQueries({queryKey:F.runs.all}),T=(0,H.useSyncExternalStore)(xa,()=>ya.get(e.id)??null),E=e.status===`running`||e.status===`queued`,D=(0,H.useRef)(n);D.current=n;let O=e=>{va(e.id)&&!D.current&&ee()};(0,H.useEffect)(()=>{if(!T||T.phase!==`handedOff`)return;if(T.afterCurrentTurn){E||Sa(e.id,{...T,afterCurrentTurn:!1,sentAt:Date.now(),graceMs:_a});return}if(E){T.sawTurn||Sa(e.id,{...T,sawTurn:!0});return}if(T.sawTurn){Ca(e.id,T)&&O(T);return}let t=()=>{Ca(e.id,T)&&O(T)},n=T.graceMs-(Date.now()-T.sentAt);if(n<=0){t();return}let r=setTimeout(t,n);return()=>clearTimeout(r)},[E,T]);let ee=async()=>{try{(await ye(e.id)).found&&w()}catch{}},k=async(t,n)=>{if(ya.has(e.id)||b.blockedBy)return;if(b.isPending){z(`Another message to the task is still being delivered — try again in a moment`);return}let r={id:t,phase:`sending`,sawTurn:!1,sentAt:Date.now(),afterCurrentTurn:E,graceMs:ga};Sa(e.id,r);let i=await b.send(n());ya.get(e.id)===r&&(i?(Sa(e.id,null),z(i,{tone:`danger`})):Sa(e.id,{...r,phase:`handedOff`,sentAt:Date.now()}))},A=e=>z(e.message,{tone:`danger`}),j=x({mutationFn:()=>C(e.id),onSuccess:t=>{z(t.upstreamSet?`Pushed ${t.branch} to ${t.remote} (upstream set)`:`Pushed ${t.branch} to ${t.remote}`),S.invalidateQueries({queryKey:F.runs.gitStatus(e.id)})},onError:A}),M=x({mutationFn:()=>le(e.id),onSuccess:t=>{z(t.message.charAt(0).toUpperCase()+t.message.slice(1),t.outcome===`busy`||t.outcome===`unavailable`?{tone:`danger`}:void 0),w(),S.invalidateQueries({queryKey:F.runs.gitStatus(e.id)})},onError:A}),N=x({mutationFn:t=>Te(e.id,{draft:t}),onSuccess:(e,t)=>{z(`${t?`Draft PR`:`PR`} created — ${e.url}`),w()},onError:A}),te=p.isError&&p.error instanceof P&&p.error.status===409,ne=b.blockedBy?b.reason??`the agent cannot be reached`:void 0,re=d?pa({status:e.status,base:f,uncommitted:p.data?.uncommitted,unpushed:p.data?.unpushed,behind:p.data?.behind,forge:s??null,agentBlocked:ne}):null,ie=fa({status:e.status,hasWorktree:!te,branch:e.branch,uncommitted:p.data?.uncommitted,unpushed:p.data?.unpushed,behind:p.data?.behind,ahead:p.data?.ahead,remote:l.data?.info?.remote,forge:s??null,prUrl:n,prStatus:a,prConflicting:i.conflicting,agentBlocked:b.blockedBy?b.reason??`the agent cannot be reached`:void 0}),ae=T?.id??(M.isPending?`land`:j.isPending?`push`:N.isPending?N.variables?`create-draft-pr`:`create-pr`:null);return{action:d?re:e.worktreePath?ie:null,pending:ae,byAgent:!b.blockedBy,onAction:t=>{let n=!!b.blockedBy;if(d){if(t===`land`){M.isPending||M.mutate();return}if(t===`create-pr`||t===`create-draft-pr`){k(t,()=>ki(t===`create-draft-pr`,f));return}if(t===`update-branch`){k(t,()=>Ai(f));return}}switch(t){case`land`:break;case`commit`:case`commit-push`:if(!n){let e=t===`commit-push`;k(t,()=>wi(e));break}y(t===`commit-push`),_(!0);break;case`push`:n?j.isPending||j.mutate():k(t,Ti);break;case`create-pr`:case`create-draft-pr`:{let r=t===`create-draft-pr`;n?N.isPending||N.mutate(r):k(t,()=>Di(r,e.baseBranch));break}case`update-branch`:k(t,()=>Oi(e.baseBranch));break;case`resolve-conflicts`:k(t,()=>Si(r));break;case`fix-checks`:k(t,()=>Ci(r));break}},commitOpen:g,dialogs:(0,U.jsx)(ha,{run:e,open:g,onOpenChange:_,andPush:v,onCommitted:v?()=>j.mutate():void 0})}}function Ta(e,t){let[n,r]=(0,H.useState)(!1),[i,a]=(0,H.useState)(``),o=(0,H.useRef)(!1),[s,c]=(0,H.useState)(!0),l=e=>{a(e),c(!0)},u=e=>{a(e),c(!1),o.current=!1,r(!0)};return{editing:n,draft:i,setDraft:l,begin:()=>{u(e),c(!0)},beginWith:u,commitOnBlur:s,commit:()=>{if(o.current)return;o.current=!0,r(!1);let n=i.trim();n.length===0||n===e||t(n)},cancel:()=>{o.current=!0,r(!1)}}}function Ea({editor:e,className:t}){return(0,U.jsx)(`input`,{"data-slot":`title-input`,"aria-label":`Task title`,autoFocus:!0,value:e.draft,onChange:t=>e.setDraft(t.target.value),onBlur:()=>{e.commitOnBlur&&e.commit()},onKeyDown:t=>{t.key===`Enter`?(t.preventDefault(),e.commit()):t.key===`Escape`&&(t.preventDefault(),e.cancel())},className:L(`w-full min-w-0 rounded-sm border border-border bg-card px-1.5 py-0.5 outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,t)})}var Da=`text-violet fill-violet/25`;function Oa({pinned:e,onToggle:t,className:n}){return(0,U.jsx)(Ot,{label:e?`Unpin from the top of the list`:`Pin to the top of the list`,children:(0,U.jsx)(`button`,{type:`button`,"data-slot":`pin-toggle`,"data-pinned":e?`true`:void 0,"aria-pressed":e,"aria-label":e?`Unpin task`:`Pin task`,onClick:n=>{n.stopPropagation(),t(!e)},className:L(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-soft-foreground transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,e&&`text-violet hover:text-violet [&_svg]:fill-violet/25`,n),children:(0,U.jsx)(Ln,{className:`size-3`,"aria-hidden":`true`})})})}var ka=220;function Aa({references:e,taskTitle:t,hidden:n,projectId:r}){let[i,a]=H.useState(!1),o=H.useRef(!1),s=H.useRef(void 0);H.useEffect(()=>()=>clearTimeout(s.current),[]);let c=e=>e.pointerType!==`touch`,l=()=>clearTimeout(s.current),u=e=>{c(e)&&(l(),o.current=!0,a(!0))},d=e=>{c(e)&&(l(),s.current=setTimeout(()=>a(!1),ka))};return(0,U.jsxs)(it,{open:i,onOpenChange:a,children:[(0,U.jsx)(nt,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"data-slot":`reference-overflow`,"aria-label":`Show all ${e.length} references for ${t}`,onPointerEnter:u,onPointerLeave:d,onPointerDown:()=>{o.current=!1},onClick:()=>{o.current=!1},className:`shrink-0 rounded-full px-1 text-meta font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:[`+`,n]})}),(0,U.jsxs)(Je,{align:`start`,className:`w-auto min-w-40 p-1.5`,"data-slot":`reference-overflow-list`,onPointerEnter:u,onPointerLeave:d,onOpenAutoFocus:e=>{o.current&&e.preventDefault()},onCloseAutoFocus:e=>{o.current&&e.preventDefault()},children:[(0,U.jsx)(`p`,{className:`px-1 pb-1.5 text-micro text-soft-foreground`,children:`References`}),(0,U.jsx)(`span`,{className:`flex flex-col items-start gap-1`,children:e.map(e=>(0,U.jsx)(at,{reference:e,taskTitle:t,projectId:r},`${e.kind}#${e.number??``}#${e.url??``}`))})]})]})}var ja=[`session`,`changes`,`commits`,`files`,`browser`,`graph`,`terminal`],Ma=[`session`,`changes`,`commits`,`files`,`graph`,`browser`,`terminal`],Na={session:`chat`,changes:`changes`,commits:`commits`,files:`files`,browser:`preview`,graph:`graph`,terminal:`terminal`},Pa={session:`Chat`,changes:`Changes`,commits:`Commits`,files:`Files`,browser:`Preview`,graph:`Graph`,terminal:`Terminal`},Fa={Czat:`Chat`,Zmiany:`Changes`,Commity:`Commits`,Pliki:`Files`,Code:`Files`,Przeglądarka:`Preview`,Browser:`Preview`,Graf:`Graph`};function Ia(e){let t=/^(.+?)( \d+)?$/.exec(e);if(!t)return e;let[,n=e,r=``]=t;if(n===`Układ`)return`Layout${r}`;let i=Fa[n];return i?`${i}${r}`:e}var La={files:[`Code`],browser:[`Browser`]};function Ra(e,t){return e===Pa[t]||(La[t]?.includes(e)??!1)}function za(e){let t={browser:[`Design Mode`],terminal:[`Shell`]};return[...La[e]??[],...t[e]??[]]}function Ba(e){return Pa[e]}function Va(e){return typeof e==`string`&&ja.includes(e)}function Ha(){return{tabs:[``],active:0}}function Ua(e){if(typeof e!=`object`||!e)return Ha();let t=e;if(!Array.isArray(t.tabs))return Ha();let n=t.tabs.filter(e=>typeof e==`string`).slice(0,Wa).map(e=>e.length>Ga?``:e);return n.length===0?Ha():{tabs:n,active:typeof t.active==`number`&&Number.isFinite(t.active)?Math.min(n.length-1,Math.max(0,Math.trunc(t.active))):0}}var Wa=12,Ga=Ne,Ka=50,qa=80,Ja=3;function Ya(e){return Math.min(12,e/2)}var Xa=Pa.session;function Za(){return{layouts:ja.filter(e=>e!==`terminal`).map(e=>({name:Pa[e],columns:[{view:e,width:100}]})),active:Xa}}function Qa(e){let t=e.length;if(t===0)return[];let n=Math.min(12,100/t),r=e.map(e=>{let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)&&t>0?t:n}),i=r.reduce((e,t)=>e+t,0);if(!Number.isFinite(i)||i<=0)return $a(t);let a=r.map(e=>e/i*100);for(let e=0;e<t;e+=1){let e=a.reduce((e,t)=>e+Math.max(0,n-t),0);if(e<=0)break;let r=a.reduce((e,t)=>e+Math.max(0,t-n),0);if(r<=0){a=a.map(()=>100/t);break}let i=Math.min(e,r)/r;a=a.map(e=>e<n?n:e-(e-n)*i)}let o=a.map(e=>Y(e)),s=Y(100-o.reduce((e,t)=>e+t,0));if(s!==0){let e=0;for(let t=1;t<o.length;t+=1)(o[t]??0)>(o[e]??0)&&(e=t);o[e]=Y((o[e]??0)+s)}return o}function $a(e){if(e===0)return[];let t=Y(100/e),n=Array.from({length:e},()=>t);return n[e-1]=Y(100-t*(e-1)),n}function Y(e){return Math.round(e*100)/100}function eo(e){let t=$a(e.length);return e.map((e,n)=>({...e,width:t[n]??0}))}function to(e){if(typeof e!=`object`||!e)return Za();let t=e;if(!Array.isArray(t.layouts))return Za();let n=[];for(let e of t.layouts){if(n.length>=Ka)break;let t=no(e,n);t&&n.push(t)}return n.length===0?Za():{layouts:n,active:typeof t.active==`string`&&n.some(e=>e.name===t.active)?t.active:ro(n)}}function no(e,t){if(typeof e!=`object`||!e)return null;let n=e;if(typeof n.name!=`string`||n.name.trim()===``||!Array.isArray(n.columns))return null;let r=[],i=[],a=[];for(let e of n.columns){if(r.length>=Ja)break;if(typeof e!=`object`||!e)continue;let t=e;Va(t.view)&&(r.push(t.view),i.push(typeof t.width==`number`?t.width:NaN),a.push(t.view===`browser`?Ua(t.browser):void 0))}if(n.columns.length>0&&r.length===0)return null;let o=io(n.name.trim(),t),s=Qa(i);return{name:o,columns:r.map((e,t)=>({view:e,width:s[t]??0,...a[t]?{browser:a[t]}:{}}))}}function ro(e){return(e.find(e=>e.name===Xa)??e[0])?.name??Xa}function io(e,t,n){let r=e=>t.some(t=>t.name===e&&t.name!==n),i=t=>`${e.slice(0,qa-t.length).trimEnd()}${t}`,a=i(``);if(!r(a))return a;for(let e=2;e<1e3;e+=1){let t=i(` ${e}`);if(!r(t))return t}return i(` ${t.length+1}`)}function X(e,t=e.active){return e.layouts.find(e=>e.name===t)}function Z(e){return X(e,e.active)}function Q(e,t,n){return{...e,layouts:e.layouts.map(e=>e.name===t?n:e),active:e.active===t?n.name:e.active}}function ao(e){return io(`Layout ${e.length+1}`,e)}function oo(e,t,n){if(e.layouts.length>=Ka)return e;let r=n===void 0?ao(e.layouts):io(n,e.layouts),i=t===void 0?[]:[{...fo(t),width:100}];return{layouts:[...e.layouts,{name:r,columns:i}],active:r}}function so(e,t){let n=e.layouts.findIndex(e=>e.name===t);if(n===-1)return e;let r=e.layouts.filter(e=>e.name!==t);if(r.length===0)return{layouts:[],active:``};let i=r[Math.min(n,r.length-1)];return{layouts:r,active:e.active===t?i.name:e.active}}function co(e,t){return e.layouts.some(e=>e.name===t)?{...e,active:t}:e}function lo(e,t,n){let r=X(e,t);if(!r)return e;let i=n.trim();return i===``||i===t?e:Q(e,t,{...r,name:io(i,e.layouts,t)})}function uo(e,t,n){let r=X(e,t);return!r||r.columns.length>=Ja?e:Q(e,t,{...r,columns:eo([...r.columns,fo(n)])})}function fo(e){return e===`browser`?{view:e,width:0,browser:Ha()}:{view:e,width:0}}function po(e,t,n,r){let i=X(e,t),a=i?.columns[n];if(!i||!a||a.view!==`browser`)return e;let o=Ua(r);return Q(e,t,{...i,columns:i.columns.map((e,t)=>t===n?{...e,browser:o}:e)})}function mo(e,t){let n=Z(e);if(!n||t.length>Ga)return null;let r=e,i=n.name,a=n.columns.findIndex(e=>e.view===`browser`);if(a<0&&yo(n)!==null){let t=xo(e,`browser`);if(!t)return null;({state:r,name:i,index:a}=t)}else if(a<0){if(r=uo(e,i,`browser`),r===e)return null;a=n.columns.length}let o=(X(r,i)?.columns[a]?.browser??Ha()).tabs.filter(e=>e!==``);return o.length>=Wa?null:po(r,i,a,{tabs:[...o,t],active:o.length})}function ho(e,t,n){let r=X(e,t);if(!r||n<0||n>=r.columns.length)return e;let i=r.columns.filter((e,t)=>t!==n);return Q(e,t,{...r,columns:eo(i)})}function go(e,t,n,r){let i=X(e,t);return!i||n<0||n>=i.columns.length||i.columns[n]?.view===r?e:Q(e,t,{...i,columns:i.columns.map((e,t)=>t===n?{...fo(r),width:e.width}:e)})}function _o(e,t,n,r){let i=X(e,t);if(!i||n<0||n+1>=i.columns.length||!Number.isFinite(r)||r===0)return e;let a=i.columns[n],o=i.columns[n+1];if(!a||!o)return e;let s=a.width+o.width,c=Ya(s),l=Y(Math.min(s-c,Math.max(c,a.width+r)));return l===a.width?e:Q(e,t,{...i,columns:i.columns.map((e,t)=>t===n?{...e,width:l}:t===n+1?{...e,width:Y(s-l)}:e)})}function vo(e,t,n,r){let i=X(e,t);if(!i)return e;let a=i.columns.length;if(n<0||n>=a||r<0||r>=a||n===r)return e;let o=[...i.columns],[s]=o.splice(n,1);return s?(o.splice(r,0,s),Q(e,t,{...i,columns:eo(o)})):e}function yo(e){let t=e.columns.length===1?e.columns[0]?.view:void 0;return t!==void 0&&Ra(e.name,t)?t:null}function bo(e,t){let n=e.layouts.find(e=>Ra(e.name,t)&&e.columns.length===1&&e.columns[0]?.view===t);if(n)return co(e,n.name);let r=Z(e);return r&&r.columns.length===1&&r.columns[0]?.view===t?e:oo(e,t,Ba(t))}function xo(e,t){let n=Z(e);if(n){let r=n.columns.findIndex(e=>e.view===t);if(r>=0)return{state:e,name:n.name,index:r};if(yo(n)===null&&n.columns.length>0&&n.columns.length<Ja)return{state:uo(e,n.name,t),name:n.name,index:n.columns.length}}let r=To(e,[fo(n?.columns[0]?.view??`session`),fo(t)]);return r?{state:r,name:Co,index:1}:null}function So(e,t,n,r){let i=Z(e),a=i?.columns.map(e=>({...e}))??[],o=a.findIndex(e=>e.view===t),s=o>=0?a[o]:fo(t),c;if(r===`replace`){if(n<0||n>=a.length)return e;c=[...a],o>=0&&(c[o]=a[n]),c[n]=s}else c=o>=0?a.filter((e,t)=>t!==o):[...a],c.splice(Math.max(0,Math.min(o>=0&&o<n?n-1:n,c.length)),0,s);return c.length>Ja?e:i&&yo(i)===null?Q(e,i.name,{...i,columns:eo(c)}):c.length===1?bo(e,c[0].view):To(e,c)??e}var Co=`Custom`;function wo(e){let t=e.trim();return t===`Custom`||ja.some(e=>Ra(t,e))}function To(e,t){let n={name:Co,columns:eo(t)};return X(e,`Custom`)?{...Q(e,Co,n),active:Co}:e.layouts.length>=Ka?null:{layouts:[...e.layouts,n],active:Co}}function Eo(e,t){let n=Z(e),r=t.trim().slice(0,qa);return!n||n.columns.length===0||r===``||wo(r)?null:{name:r,columns:n.columns.map(({view:e,width:t})=>({view:e,width:t}))}}function Do(e,t){if(wo(t.name))return e;let n=X(e,t.name),r=t.columns.map(e=>e.view).join(`|`);if(n&&n.columns.map(e=>e.view).join(`|`)===r)return co(e,t.name);let i=Qa(t.columns.map(e=>e.width)),a={name:t.name,columns:t.columns.slice(0,Ja).map((e,t)=>({...fo(e.view),width:i[t]??0}))};return n?{...Q(e,t.name,a),active:t.name}:e.layouts.length>=Ka?e:{layouts:[...e.layouts,a],active:t.name}}function Oo(e,t){let n=Z(e),r=t.trim().slice(0,qa);if(!n||r===``||wo(r)||n.name===r)return e;let i=e.layouts.filter(e=>e.name!==r);if(yo(n)!==null){let e={name:r,columns:n.columns.map(e=>({...e}))};return{layouts:[...i,e],active:r}}return{layouts:i.map(e=>e===n?{...e,name:r}:e),active:r}}function ko(e=!0,t=()=>!0){let[n,r]=H.useState(!1),i=H.useRef(t);return i.current=t,H.useEffect(()=>{if(!e)return;let t=J(),n=t?`Meta`:`Control`,a=new Set([`Shift`,`Alt`,`AltGraph`,t?`Control`:`Meta`]),o=e=>t?e.metaKey:e.ctrlKey,s=e=>!e.shiftKey&&!e.altKey&&!(t?e.ctrlKey:e.metaKey),c,l=!1,u,d=()=>{clearTimeout(u),clearTimeout(c),c=void 0,l&&r(!1),l=!1},f=()=>{c=void 0,i.current()&&(l=!0,r(!0))},p=e=>{if(e.key===n){!e.repeat&&c===void 0&&!l&&s(e)&&(c=setTimeout(f,350));return}if(!(c===void 0&&!l)){if(!o(e)||a.has(e.key)||!s(e))return d();if(!l){clearTimeout(c),c=void 0;return}clearTimeout(u),u=setTimeout(()=>{i.current()||d()},0)}},m=e=>{(e.key===n||(c!==void 0||l)&&!o(e))&&d()},h=e=>{(c!==void 0||l)&&!o(e)&&d()},g=()=>{document.visibilityState!==`visible`&&d()};return window.addEventListener(`keydown`,p),window.addEventListener(`keyup`,m),window.addEventListener(`pointermove`,h),window.addEventListener(`pointerdown`,h),window.addEventListener(`blur`,d),document.addEventListener(`visibilitychange`,g),()=>{d(),window.removeEventListener(`keydown`,p),window.removeEventListener(`keyup`,m),window.removeEventListener(`pointermove`,h),window.removeEventListener(`pointerdown`,h),window.removeEventListener(`blur`,d),document.removeEventListener(`visibilitychange`,g)}},[e]),n}function Ao(e){let t=e.findIndex(e=>e===`browser`||e===`terminal`);return t<0?[...e,`notes`]:[...e.slice(0,t),`notes`,...e.slice(t)]}function jo(e){return Ao(e).map(e=>e===`notes`?{id:`view:notes`,label:`Notes`}:{id:`view:${e}`,label:Ba(e)})}function Mo(e){let{bindings:t}=ia(),n=ko(!0,No),r=e.map(e=>e.id).join(`|`);return{hints:H.useMemo(()=>{let n=new Map;return e.forEach((e,r)=>{let i=qi(t.get(`tab:${r+1}`)??t.get(e.id));i&&n.set(e.id,i)}),n},[t,r]),show:n}}var No=()=>!Ki()&&(J()||!(document.activeElement instanceof HTMLElement&&document.activeElement.closest(`.xterm`))),Po=(0,H.createContext)(ja);function Fo(e){let t=(0,H.useContext)(Po);return e.filter(e=>t.includes(e))}var Io={session:Nn,changes:Pt,commits:Rt,files:gn,browser:Dn,graph:dt,terminal:jt};function Lo({onPick:e,disabled:t,purpose:n=`set`}){return(0,U.jsx)(U.Fragment,{children:Fo(ja).map(r=>{let i=Io[r];return(0,U.jsxs)(B,{"data-view":r,"data-view-action":n,disabled:r===t,onSelect:()=>e(r),children:[(0,U.jsx)(i,{"aria-hidden":`true`}),Ba(r)]},r)})})}var Ro=[`session`,`graph`,`changes`,`commits`,`files`,`browser`,`terminal`],zo={session:`The conversation with the agent`,graph:`The workflow, live, step by step`,changes:`What this task changed, as a diff`,commits:`The commits on the task branch`,files:`The worktree, file by file`,browser:`The task's app, with Design Mode`,terminal:`A shell in the task worktree`};function Bo({onPick:e,scope:t=`layout`}){let n=Fo(Ro);return(0,U.jsx)(`div`,{"data-slot":`view-tiles-stage`,className:`@container flex min-h-0 flex-1 justify-center overflow-y-auto p-4 @md:p-6`,children:(0,U.jsxs)(`div`,{className:`my-auto flex w-full max-w-2xl flex-col gap-5`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1 text-center`,children:[(0,U.jsx)(`h2`,{className:`text-base font-medium text-foreground`,children:t===`layout`?`What should this layout show?`:`What should this window show?`}),(0,U.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t===`layout`?`Pick a view to start. You can split it into more windows afterwards.`:`Pick a view for the new window.`})]}),(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-2.5 @[15rem]:grid-cols-2 @lg:grid-cols-3 @lg:gap-3`,children:n.map(t=>{let n=Io[t];return(0,U.jsxs)(R,{type:`button`,variant:`outline`,"data-view":t,"data-view-action":`create`,onClick:()=>e(t),className:`group/tile h-auto flex-col items-start justify-start gap-2.5 rounded-xl p-3 text-left whitespace-normal @lg:gap-3 @lg:p-4`,children:[(0,U.jsx)(`span`,{className:`flex size-9 items-center justify-center rounded-lg bg-muted text-muted-foreground transition-colors group-hover/tile:bg-primary group-hover/tile:text-primary-foreground`,children:(0,U.jsx)(n,{"aria-hidden":`true`,className:`size-[18px]`})}),(0,U.jsxs)(`span`,{className:`flex flex-col gap-0.5`,children:[(0,U.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:Ba(t)}),(0,U.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:zo[t]})]})]},t)})})]})})}var Vo=[{id:`actions`,heading:`Actions`},{id:`git`,heading:`Git`},{id:`views`,heading:`Go to view`},{id:`layout`,heading:`Layout`},{id:`open`,heading:`Open in`},{id:`copy`,heading:`Copy`}],$=e=>(0,U.jsx)(e,{"aria-hidden":`true`});function Ho(e,t){let n=[...Uo(e,t),...Wo(e,t),...Go(e,t),...Jo(e),...Yo(e,t),...Xo(e,t)],r=jo(Ko(e.run,e.workspace,e.terminalAvailable));return[...n,...qo(r,n)]}function Uo({run:e,workspace:t},n){let r=xi(e),i=q(e.status)?`Stop the task first`:void 0,a=e.worktreeLifecycle?.activeOperationId?`Resolve the worktree operation first`:void 0,o=[];return t?.focusComposer&&o.push({id:`reply`,group:`actions`,label:`Write to the agent`,icon:$(Un),keywords:[`composer`,`reply`,`message`,`focus`],shortcut:`/`,perform:t.focusComposer}),(r.markRead||r.markUnread)&&o.push({id:`toggle-read`,group:`actions`,label:r.markRead?`Mark read`:`Mark unread`,icon:$(jn),keywords:[`unread`,`read`,`seen`],pressed:r.markRead,perform:r.markRead?n.markRead:n.markUnread}),o.push({id:`pin`,group:`actions`,label:e.pinned?`Unpin`:`Pin`,icon:$(Ln),pressed:!!e.pinned,...r.pin?{}:{unavailable:`Archived tasks can’t be pinned`},perform:n.pin},{id:`archive`,group:`actions`,label:e.archived?`Unarchive`:`Archive`,icon:$(un),pressed:!!e.archived,...i?{unavailable:i}:{},perform:n.archive},{id:`rename`,group:`actions`,label:`Rename…`,icon:$(Vt),keywords:[`title`],perform:n.rename}),r.finish&&e.status===`waiting`&&o.push({id:`end-session`,group:`actions`,label:`End session`,icon:$(mt),keywords:[`finish`,`close`,`done`],perform:n.finish}),r.finish&&e.status===`review`&&o.push({id:`accept`,group:`actions`,label:`Accept changes without a PR`,icon:$(mt),keywords:[`finish`,`review`,`done`],perform:n.finish}),r.cancel&&o.push({id:`stop`,group:`actions`,label:`Stop…`,icon:$(hn),keywords:[`cancel`,`kill`],danger:!0,perform:n.confirmStop}),o.push({id:`delete`,group:`actions`,label:`Delete…`,icon:$(ft),keywords:[`remove`,`worktree`,`branch`],danger:!0,...i||a?{unavailable:i??a}:{},perform:n.confirmDelete}),o}function Wo({git:e,gitPending:t,prUrl:n},r){let i=e?[e,...e.alternatives??[]].map(n=>{let i=t?n.id===e.id:!1;return{id:`git:${n.id}`,group:`git`,label:i&&t?Lt[t]:n.label,icon:i?(0,U.jsx)(Bt,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):Ft[n.id],keywords:[`git`],...t?{unavailable:`Already in progress`}:n.enabled?{}:{unavailable:n.reason??`Not available right now`},perform:()=>r.gitAction(n.id)}}):[];return n&&/^https?:\/\//.test(n)&&i.push({id:`open-pr`,group:`git`,label:`Open pull request`,icon:$(At),keywords:[`pr`,`github`],perform:()=>r.openUrl(n)}),i}function Go({run:e,workspace:t,terminalAvailable:n},r){let i=`/tasks/${e.id}`,a=Ko(e,t,n),o=Ao(a),s=e=>{let n=o.indexOf(e);return t&&n<9?{shortcut:String(n+1)}:{}},c=a.map(e=>{let n=Io[e];return{id:`view:${e}`,group:`views`,label:Ba(e),icon:(0,U.jsx)(n,{"aria-hidden":`true`}),keywords:[`view`,`go`,`tab`,e,...za(e).map(e=>e.toLowerCase())],...s(e),pressed:t?.activeView===e,perform:t?()=>t.openView(e):()=>r.navigate(`${i}/${Na[e]}`),...t?{performBeside:()=>t.openViewBeside(e)}:{}}});return c.push({id:`view:notes`,group:`views`,label:`Notes`,icon:$(Fn),keywords:[`view`,`handoff`],...s(`notes`),perform:()=>r.navigate(`${i}/notes`)}),c}function Ko(e,t,n){return t?.views??Ma.filter(t=>(t!==`graph`||!!e.workflowDef)&&(t!==`terminal`||n))}function qo(e,t){return e.slice(0,9).flatMap((e,n)=>{let r=t.find(t=>t.id===e.id);return r?[{id:`tab:${n+1}`,group:`views`,label:`Tab ${n+1}: ${e.label}`,icon:$(ut),hidden:!0,perform:r.perform}]:[]})}function Jo({workspace:e}){if(!e)return[];let t=e.layouts.map(t=>({id:`layout:${t.name}`,group:`layout`,label:t.label,icon:$(ut),keywords:[`layout`,`switch`],pressed:t.active,perform:()=>e.selectLayout(t.name)}));t.push({id:`full-view`,group:`layout`,label:e.maximized?`Exit full view`:`Full view`,icon:$(Mn),keywords:[`maximize`,`zen`,`focus`],shortcut:`F`,pressed:e.maximized,perform:e.toggleMaximized}),e.splitView&&t.push({id:`split`,group:`layout`,label:`Split view`,icon:$(vn),keywords:[`column`,`side`],shortcut:`\\`,perform:e.splitView});let n=e.terminal;return n.allowed&&(t.push({id:`terminal`,group:`layout`,label:n.open?`Hide terminal`:`Show terminal`,icon:$(In),keywords:[`shell`,`drawer`],shortcut:"`",pressed:n.open||n.inColumn,...n.inColumn?{unavailable:`The terminal is open in a column of this layout`}:{},perform:n.toggle}),n.inColumn||t.push({id:`terminal-column`,group:`layout`,label:`Terminal in a column`,icon:$(jt),keywords:[`shell`,`split`],perform:n.openInColumn})),t}function Yo({canResume:e,openChoices:t},n){let r=[];e&&r.push({id:`open:terminal-resume`,group:`open`,label:`Terminal (resume session)`,icon:$(Hn),keywords:[`open`,`cli`,`resume`],perform:n.resumeInTerminal});for(let e of t){let t=ti(e.target);r.push({id:`open:${e.target.id}`,group:`open`,label:`${e.target.label}${e.suffix??``}`,icon:(0,U.jsx)(t,{"aria-hidden":`true`}),keywords:[`open`,`in`],perform:()=>n.openIn(e.target.id)})}return r}function Xo({run:e,prUrl:t,taskUrl:n},r){let i=(e,t,n,i,a=yn)=>n?[{id:`copy:${e}`,group:`copy`,label:t,icon:$(a),keywords:[`copy`],perform:()=>r.copy(n,i)}]:[];return[...i(`link`,`Copy task link`,n,`Task link`,An),...i(`branch`,`Copy branch name`,e.branch,`Branch name`),...i(`path`,`Copy worktree path`,e.worktreePath,`Worktree path`),...i(`resume`,`Copy resume command`,yi(e),`Resume command`),...i(`pr`,`Copy pull request link`,t,`Pull request link`,An),...i(`id`,`Copy task id`,e.id,`Task id`)]}function Zo({run:e,confirming:t,lifecycleDelete:n=!1,onOpenChange:r,onConfirm:i}){return(0,U.jsx)(rn,{open:t!==null,onOpenChange:r,children:(0,U.jsxs)(Qt,{children:[(0,U.jsxs)(nn,{children:[(0,U.jsx)(Zt,{children:t===`delete`?`Delete this task?`:`Stop this task?`}),(0,U.jsx)(Xt,{children:t===`delete`?(0,U.jsxs)(U.Fragment,{children:[n?`Cleanup runs before the task, transcript, worktree, and branch are removed. If cleanup needs attention, the task and worktree are retained for your decision.`:`This removes the run, its transcript, its worktree and its branch. There is no undo.`,(0,U.jsx)(`span`,{className:`mt-1 block truncate font-medium text-foreground`,title:b(e),children:b(e)})]}):e.status===`queued`?`The task leaves the queue before it starts and completes as cancelled.`:`The agent is stopped and the run completes as cancelled. The worktree stays.`})]}),(0,U.jsxs)(en,{children:[(0,U.jsx)(tn,{children:`Keep it`}),(0,U.jsx)($t,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t&&i(t),r(!1)},children:t===`delete`?`Delete`:`Stop the run`})]})]})})}function Qo(e){let t=h(),[n,r]=(0,H.useState)(null),i=()=>t.invalidateQueries({queryKey:F.runs.all}),a=x({mutationFn:()=>pe(e.id),onSuccess:i,onError:e=>{e instanceof P&&e.status===409&&i(),z(e.message,{tone:`danger`})}});return{request:()=>r(`cancel`),pending:a.isPending,dialog:(0,U.jsx)(Zo,{run:e,confirming:n,onOpenChange:e=>!e&&r(null),onConfirm:()=>a.mutate()})}}function $o({run:e,pending:t,onClose:n,onConfirm:r}){let i=c(e.id,!0),a=i.data?.uncommitted===0,o=mi(e)&&!i.isFetching&&!i.isError&&a&&!t;return(0,U.jsx)(rn,{open:!0,onOpenChange:e=>{!e&&!t&&n()},children:(0,U.jsxs)(Qt,{className:`flex max-h-[calc(100dvh-2rem)] flex-col`,children:[(0,U.jsxs)(nn,{className:`min-h-0 overflow-y-auto`,children:[(0,U.jsx)(Zt,{children:`Remove this task’s worktree?`}),(0,U.jsx)(Xt,{asChild:!0,children:(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(`p`,{children:`The task, transcript and local branch stay, including unpushed commits. Continue can recreate the checkout from that branch.`}),(0,U.jsx)(`p`,{children:`Ignored local files, including build artifacts and dependencies, are deleted and must be rebuilt. Commit or stash any other uncommitted changes first.`}),(0,U.jsx)(`p`,{className:`break-words font-medium text-foreground`,children:b(e)}),(0,U.jsx)(`p`,{className:`break-all font-mono text-xs`,children:e.worktreePath}),(0,U.jsx)(`p`,{role:`status`,children:t?`Requesting worktree removal…`:mi(e)?i.isFetching?`Checking for uncommitted changes…`:i.isError||i.data?.uncommitted===void 0?`Could not check the worktree. It may be missing or unavailable. Close this dialog and try again.`:a?`The worktree has no uncommitted changes. Cleanup runs before the directory is removed; if it needs attention, resolve it on this task.`:`This worktree has uncommitted changes. Commit or stash them before removing it.`:`This task no longer has a removable worktree.`})]})})]}),(0,U.jsxs)(en,{className:`shrink-0`,children:[(0,U.jsx)(tn,{disabled:t,children:`Keep worktree`}),(0,U.jsx)($t,{disabled:!o,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:e=>{e.preventDefault(),o&&r()},children:t?`Requesting…`:`Remove worktree`})]})]})})}var es=`quick-task`;function ts(e,t,n=24){return[t,...(e??[]).filter(e=>!(e.source===t.source&&e.ref===t.ref))].slice(0,n)}var ns=[{id:`claude`,label:`claude`,desc:`Claude Code CLI`},{id:`codex`,label:`codex`,desc:`OpenAI Codex (app-server)`},{id:`junie`,label:`junie`,desc:`JetBrains Junie CLI`},{id:`opencode`,label:`opencode`,desc:`OpenCode (serve)`},{id:`cursor`,label:`cursor`,desc:`Cursor Agent CLI`},{id:`pi`,label:`pi`,desc:`pi CLI (provider/model)`},{id:`copilot`,label:`copilot`,desc:`GitHub Copilot CLI (ACP)`}],rs={claude:[{id:``,label:`auto`,desc:`Pick the best model per step`},{id:`fable`,label:`fable`,desc:`Most capable, for the hardest tasks`},{id:`opus`,label:`opus`,desc:`Deep reasoning for hard tasks`},{id:`sonnet`,label:`sonnet`,desc:`Fast and cheap`},{id:`haiku`,label:`haiku`,desc:`Fastest — simple, scoped tasks`}],codex:[{id:``,label:`auto`,desc:`Use your Codex default model`}],opencode:[{id:``,label:`auto`,desc:`Use your OpenCode default model`}],junie:[{id:``,label:`auto`,desc:`Use your Junie default model`}],cursor:[{id:``,label:`auto`,desc:`Use your Cursor default model`}],pi:[{id:``,label:`auto`,desc:`Use your pi default model`},{id:`anthropic/claude-opus-4-8`,label:`claude-opus-4.8`,desc:`via Anthropic`},{id:`anthropic/claude-sonnet-5`,label:`claude-sonnet-5`,desc:`via Anthropic`},{id:`openai/gpt-5.1`,label:`gpt-5.1`,desc:`via OpenAI`}],copilot:[{id:``,label:`auto`,desc:`Let Copilot pick the model`}]},is={claude:/^claude[-.]/,codex:/^gpt[-.]/},as=[`opencode`,`pi`],os=[`copilot`,`cursor`];function ss(e,t){return!e||rs[t].some(t=>t.id===e)||is[t]?.test(e)||os.includes(t)&&Object.values(is).some(t=>t.test(e))?!1:Object.entries(rs).some(([n,r])=>n!==t&&!as.includes(n)&&r.some(t=>t.id!==``&&t.id===e))||Object.entries(is).some(([n,r])=>n!==t&&r.test(e))}function cs(e,t,n=[]){let r=rs[e]??rs.claude,i=Ae(e)?t?.models??[]:[],a=i.length>0?[ls(r)]:[...r],o=new Set(a.map(e=>e.id));for(let e of i)!e.id||o.has(e.id)||(o.add(e.id),a.push({id:e.id,label:e.label||e.id,desc:e.description}));for(let t of n)!t||o.has(t)||ss(t,e)||(o.add(t),a.push({id:t,label:t,desc:`Custom or legacy model`}));return a}function ls(e){return e.find(e=>e.id===``)??{id:``,label:`auto`,desc:``}}var us={claude:`Claude`,codex:`Codex`,opencode:`OpenCode`,junie:`Junie`,cursor:`Cursor`};function ds(e,t,n=!1){if(!Ae(e))return;let r=us[e];if(t?.stale)return`Using cached ${r} model list`;if(n||t?.source===`unavailable`)return`Latest ${r} models unavailable`}function fs(e){let t=ns.map(e=>e.id).filter(t=>e.some(e=>e.name===t&&e.available));return t.length>0?t:[`claude`]}function ps(e,t,n){return e!==null&&t.includes(e)?e:t.includes(n)?n:t[0]??`claude`}function ms(e,t,n=!1){return!n&&e===t?void 0:e}function hs(e,t,n,r){let i=cs(t,r,[e,n?.[t]]);if(e!==null&&i.some(t=>t.id===e))return e;let a=n?.[t];return a!==void 0&&i.some(e=>e.id===a)?a:``}function gs(e,t,n){return e.source===`skill`?t.some(t=>t.name===e.ref):n.some(t=>t.name===e.ref)}function _s(e,t,n){return e&&gs(e,t,n)?e:null}function vs(e){let{task:t,source:n,model:r,modelsLocked:i,runner:a,runnerExplicit:o,defaultRunner:s,agentProfile:c,variants:l,images:u,worktree:d,newBranch:f,branch:p,autonomous:m,generateFollowups:h,todoId:g,dispatch:_,readOnly:v,inPlaceByDefault:y}=e,b=v===!0&&l<=1&&!_,x=d===!1&&l<=1&&!_&&!b;return{task:t,...n?.source===`skill`?{steps:[{id:`task`,name:n.ref,skill:n.ref,prompt:`{{task}}`}]}:{workflow:n?.ref??`quick-task`},model:i?void 0:r||void 0,runner:ms(a,s,o),agentProfile:c||void 0,variants:l>1?l:void 0,images:u.length>0?[...u]:void 0,worktree:b?void 0:d===!1&&l<=1?!1:y&&d!==!1&&l<=1?!0:void 0,...b?{readOnly:!0}:{},...x&&f?{newBranch:!0,...p?.trim()?{branch:p.trim()}:{}}:{},autonomous:m===!0||void 0,generateFollowups:h!==!1&&void 0,todoId:g||void 0,dispatch:_??void 0}}function ys(e,t,n){let r=(t?e?.askSkill:e?.defaultSkill)??null;return r&&(n===null||n.some(e=>e.name===r))?{source:`skill`,ref:r}:null}function bs(e){return/\?\s*$/.test(e.trim())}function xs(e){let t=`runs`in e?e.runs[0]:e;return t?`/tasks/${t.id}`:`/`}var Ss=`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-55`,Cs=(0,U.jsx)(ht,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`});function ws({active:e=!1,skill:t=!1,dashed:n=!1,chevron:r=!1,icon:i,className:a,children:o,type:s=`button`,...c}){return(0,U.jsxs)(`button`,{type:s,"data-slot":`chip`,"data-active":e?`true`:void 0,"data-skill":t?`true`:void 0,className:L(Ss,e&&`border-foreground font-semibold text-foreground`,t&&`border-violet text-foreground`,n&&`border-dashed`,a),...c,children:[i,o,r?Cs:null]})}function Ts({slot:e,ariaLabel:t,label:n,value:r,options:i,onPick:a,disabled:o=!1,readOnly:s=!1,hint:c,disabledHint:l,status:u,searchPlaceholder:d}){let[f,p]=(0,H.useState)(!1),[m,h]=(0,H.useState)(``),g=(0,H.useRef)(null),_=(0,H.useRef)(null),v=(0,H.useRef)(null),y=(0,H.useMemo)(()=>{let e=m.trim().toLowerCase();return d&&e?i.filter(t=>t.label.toLowerCase().includes(e)):i},[i,m,d]);if((0,H.useEffect)(()=>{if(!f||!d)return;let e=window.setTimeout(()=>g.current?.focus());return()=>window.clearTimeout(e)},[f,d]),s)return(0,U.jsx)(`span`,{"data-slot":e,"aria-label":t,title:l??c,className:`${Ss} cursor-default hover:bg-card hover:text-muted-foreground`,children:n});let b=e=>(0,U.jsx)(Dt,{value:e.value,className:`gap-2.5`,children:(0,U.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,U.jsx)(`span`,{className:`text-label font-medium`,children:e.label}),e.desc?(0,U.jsx)(`span`,{className:`max-w-[calc(100vw-3rem)] whitespace-normal break-words text-meta text-muted-foreground md:max-w-96`,children:e.desc}):null]})},e.value),x=(0,U.jsxs)(`button`,{type:`button`,"data-slot":e,"aria-label":t,disabled:o,title:o?l:c,className:Ss,children:[n,Cs]});return o?(0,U.jsx)(`span`,{title:l,className:`inline-flex`,children:x}):(0,U.jsxs)(wt,{open:f,onOpenChange:e=>{p(e),e||h(``)},children:[(0,U.jsx)(kt,{asChild:!0,children:x}),(0,U.jsxs)(Et,{ref:_,align:`start`,"data-testid":`${e}-menu`,children:[d?(0,U.jsxs)(`div`,{className:`mb-1 flex h-9 items-center gap-2 border-b border-border px-2`,children:[(0,U.jsx)(st,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,U.jsx)(`input`,{ref:g,type:`search`,"aria-label":d,placeholder:d,value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),e.stopPropagation();let t=_.current?.querySelectorAll(`[role="menuitemradio"]:not([data-disabled])`);(e.key===`ArrowDown`?t?.[0]:t?.[t.length-1])?.focus()}else e.key!==`Escape`&&e.stopPropagation()},className:`h-full min-w-48 bg-transparent text-sm outline-none placeholder:text-muted-foreground`})]}):null,(0,U.jsx)(Tt,{value:r,onValueChange:a,children:d?(0,U.jsx)(`div`,{ref:v,className:`max-h-[min(20rem,calc(var(--radix-dropdown-menu-content-available-height)-3.5rem))] overflow-y-auto overscroll-contain`,children:y.length>100?(0,U.jsx)(cn,{scrollRef:v,itemSize:30,data:y,children:b}):y.map(b)}):y.map(b)}),d&&y.length===0?(0,U.jsx)(`p`,{className:`px-2 py-5 text-center text-xs text-muted-foreground`,children:`No branches found.`}):null,u?(0,U.jsx)(B,{disabled:!0,className:`border-t border-border text-meta text-muted-foreground`,children:u}):null]})]})}var Es=(e,t)=>t===null?e:`${e}:${t}`;function Ds({runners:e,value:t,onPick:n,disabled:r=!1,accounts:i=[],account:a=null,repoAccount:o}){let s=ns.filter(t=>e.includes(t.id)).flatMap(e=>{let t=i.filter(t=>t.provider===e.id);return t.length<2?[{value:Es(e.id,null),label:e.id,desc:e.desc}]:t.map(t=>({value:Es(e.id,t.id),label:`${e.id} · ${t.label}`,desc:t.configDir}))}),c=a??o?.[t]??`default`,l=s.some(e=>e.value===Es(t,c))?Es(t,c):Es(t,null);return(0,U.jsx)(Ts,{slot:`runner-pill`,ariaLabel:`Runner`,label:s.find(e=>e.value===l)?.label??t,value:l,disabled:r,onPick:e=>{let[t,r]=e.split(`:`);n(t,r??null)},options:s})}function Os(e){let t=ue(),n=Se(),r=e.runner??t.data?.defaultRunner??`claude`,i=e.model??`auto`,a=[...e.steps].reverse().find(e=>e.profileId)?.profileId,o=a===void 0?void 0:a==="default"?`default`:n.data?.profiles.find(e=>e.id===a)?.label??`${a} (removed)`;return{runner:r,account:o,model:i,identity:e.modelIdentity&&e.modelIdentity!==i?e.modelIdentity:void 0,summary:[r,o,i].filter(Boolean).join(` · `)}}function ks({run:e}){let t=Os(e),n=l(t.runner),r=cs(t.runner,n.data,[e.model]).find(e=>e.id===t.model)?.label??t.model,i=`The session’s engine — pick another when you continue it`;return(0,U.jsxs)(`div`,{"data-slot":`run-engine`,className:`flex flex-wrap items-center gap-1.5`,children:[(0,U.jsx)(Ts,{slot:`run-engine-runner`,ariaLabel:`Agent`,label:t.account&&t.account!=="default"?`${t.runner} · ${t.account}`:t.runner,value:t.runner,options:[],onPick:()=>{},readOnly:!0,hint:i}),(0,U.jsx)(Ts,{slot:`run-engine-model`,ariaLabel:`Model`,label:r,value:t.model,options:[],onPick:()=>{},readOnly:!0,hint:t.identity?`${i} (served as ${t.identity})`:i})]})}function As(e){switch(e){case`done`:return`done`;case`running`:case`waiting`:case`review`:return`active`;case`failed`:case`cancelled`:return`failed`;case`pending`:case`skipped`:return`pending`}}function js(e){if(e.length===0)return 0;let t=new Set([`done`,`failed`,`cancelled`,`skipped`]),n=new Set([`running`,`waiting`,`review`]),r=0;for(let i of e)t.has(i.status)?r+=1:n.has(i.status)&&(r+=.5);return r/e.length}function Ms({steps:e}){if(e.length===0)return null;let t=js(e)*100;return(0,U.jsxs)(`div`,{"data-slot":`step-rail`,className:`flex min-w-0 flex-col gap-1`,children:[e.map((t,n)=>(0,U.jsxs)(`div`,{"data-slot":`step-row`,"data-visual":As(t.status),className:`flex min-h-[22px] min-w-0 items-center gap-2 text-ui text-muted-foreground`,children:[(0,U.jsx)(Ns,{visual:As(t.status)}),(0,U.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:t.name}),t.iterations>1?(0,U.jsxs)(`span`,{"data-slot":`step-iterations`,className:`shrink-0 text-xs text-soft-foreground tabular-nums`,children:[`×`,t.iterations]}):null,(0,U.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 text-meta text-soft-foreground tabular-nums`,children:[t.kind,` · step `,n+1,` of `,e.length]})]},t.id)),(0,U.jsx)(`div`,{"data-slot":`step-progress`,className:`mt-1 h-0.5 overflow-hidden rounded-full bg-muted`,children:(0,U.jsx)(`div`,{className:`h-full rounded-full bg-pending`,style:{width:`${t}%`}})})]})}function Ns({visual:e}){let t=`size-[13px] shrink-0`;switch(e){case`done`:return(0,U.jsx)(bt,{"aria-hidden":!0,className:L(t,`text-success`)});case`active`:return(0,U.jsx)(Bt,{role:`status`,"aria-label":`Step running`,className:L(t,`animate-spin stroke-pending motion-reduce:animate-none`)});case`failed`:return(0,U.jsx)(ct,{"aria-hidden":!0,className:L(t,`text-danger`)});case`pending`:return(0,U.jsx)(Ct,{"aria-hidden":!0,className:L(t,`text-soft-foreground`)})}}function Ps(e){let t=e.findIndex(e=>As(e.status)===`active`);if(t>=0)return t;let n=e.findIndex(e=>As(e.status)===`pending`);return n>=0?n:Math.max(0,e.length-1)}function Fs({visual:e}){return(0,U.jsx)(`span`,{"aria-hidden":!0,"data-slot":`step-dot`,"data-visual":e,className:L(`size-1.5 rounded-full`,e===`done`?`bg-success`:e===`failed`?`bg-danger`:e===`active`?`bg-pending`:`bg-soft-foreground`,e===`active`&&`animate-pulse motion-reduce:animate-none`)})}var Is=new Map;function Ls({runId:e,steps:t}){let[n,r]=(0,H.useState)(()=>Is.get(e)??!1);if(t.length===0)return null;let i=t=>{Is.set(e,t),r(t)},a=Ps(t),o=t[a],s=js(t)*100;return(0,U.jsxs)(Yt,{"data-slot":`workflow-steps`,open:n,onOpenChange:i,className:`min-w-0`,children:[(0,U.jsxs)(Jt,{"aria-label":`Workflow: ${o.name}, step ${a+1} of ${t.length}`,className:`group -my-2 flex min-h-11 w-full items-center gap-2 text-left text-xs text-muted-foreground hover:text-foreground md:my-0 md:min-h-[30px] md:gap-2.5`,children:[(0,U.jsx)(`span`,{"data-slot":`step-dots`,className:`flex shrink-0 items-center gap-1`,children:t.map(e=>(0,U.jsx)(Fs,{visual:As(e.status)},e.id))}),(0,U.jsx)(`span`,{className:`min-w-0 max-w-[45%] shrink truncate font-semibold text-foreground`,children:o.name}),(0,U.jsxs)(`span`,{className:`shrink-0 text-soft-foreground tabular-nums`,children:[`step `,a+1,` of `,t.length]}),(0,U.jsx)(`span`,{"data-slot":`step-summary-progress`,className:`h-0.5 min-w-[36px] flex-1 overflow-hidden rounded-full bg-muted`,children:(0,U.jsx)(`span`,{className:`block h-full rounded-full bg-pending`,style:{width:`${s}%`}})}),(0,U.jsx)(ht,{"aria-hidden":!0,className:`size-4 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-180`})]}),(0,U.jsx)(Kt,{children:(0,U.jsx)(`div`,{className:`pt-2`,children:(0,U.jsx)(Ms,{steps:t})})})]})}var Rs=20;function zs(e){return e.reduce((e,t)=>Ve(t.mediaType)?e+Math.floor(t.data.length*3/4):e,0)}function Bs(e,t){return e.length>=Rs||zs(e)+zs([t])>20971520?null:[...e,t]}var Vs={md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`},Hs=new Set(`html.htm.xml.css.scss.less.csv.tsv.json.jsonl.ndjson.yaml.yml.toml.ini.env.conf.cfg.sql.graphql.gql.diff.patch.js.mjs.cjs.jsx.ts.mts.cts.tsx.vue.svelte.astro.php.py.rb.go.rs.java.kt.swift.c.h.cc.cpp.hpp.cs.sh.bash.zsh.ps1.bat.lua.pl.r.dart.scala.ex.exs.erl.hs.twig.rst.adoc.tex.srt.vtt`.split(`.`)),Us=new Set([`application/json`,`application/xml`,`application/javascript`,`application/x-yaml`,`application/yaml`,`application/sql`,`application/x-sh`]);function Ws(e){if(Me(e.type)&&e.type!==`application/octet-stream`)return e.type;let t=e.name.includes(`.`)?e.name.split(`.`).pop()?.toLowerCase()??``:``;return Vs[t]||(Hs.has(t)||e.type.startsWith(`text/`)||Us.has(e.type)?`text/plain`:Pe)}function Gs(e,t){return t?`pasted image`:`pasted.${je(e)}`}async function Ks(e,t=`file`){let n=new Uint8Array(await e.arrayBuffer()),r=``;for(let e=0;e<n.length;e+=32768)r+=String.fromCharCode(...n.subarray(e,e+32768));let i=btoa(r),a=Ws(e),o=Ve(a),s=t===`clipboard`&&o?void 0:e.name;return{mediaType:a,data:i,...o?{preview:`data:${a};base64,${i}`}:{},name:s||Gs(a,o),...s?{originalName:s}:{},isImage:o}}function qs({mediaType:e,data:t,originalName:n}){return{mediaType:e,data:t,...n?{name:n}:{}}}function Js(e,t,n=0){let r=[],i=[],a=t,o=n;for(let t of e){let e=t.name?`“${t.name}”`:`attachment`;if(t.size>5242880){i.push(`${e} is too large (max 5 MB)`);continue}if(a>=Rs){i.push(`${e} skipped — max ${Rs} attachments per message`);continue}let n=Ve(Ws(t));if(n&&o+t.size>20971520){i.push(`${e} skipped — max 20 MB of images per message`);continue}r.push(t),a+=1,n&&(o+=t.size)}return{accepted:r,rejected:i}}function Ys(e){let t=[];for(let n of e)n.id!==void 0&&t.push({id:n.id,mediaType:n.mediaType,name:n.name,bytes:0});return t}function Xs(e,t,{enabled:n=!0}={}){let i=h(),a=n&&e!==``&&t!==``,o=Ee(a?e:void 0),s=o.data?.surfaces?.[t],[c,l]=(0,H.useState)(``),[d,f]=(0,H.useState)([]),p=`${e} ${t}`,[m,g]=(0,H.useState)(p),v=(0,H.useRef)(!1),y=(0,H.useRef)(void 0),b=(0,H.useRef)(!1),x=(0,H.useRef)(null),S=(0,H.useRef)(Promise.resolve()),C=(0,H.useRef)({runId:e,surface:t,text:c,images:d});C.current.text=c,C.current.images=d;let w=(0,H.useRef)([]);if(m!==p){if(g(p),x.current!==null){clearTimeout(x.current),x.current=null;let e=C.current;w.current=[...w.current.filter(t=>t.runId!==e.runId||t.surface!==e.surface),{runId:e.runId,surface:e.surface,text:e.text,images:e.images.map(e=>e.id).filter(e=>e!==void 0)}]}l(``),f([]),v.current=!1,b.current=!1,C.current={runId:e,surface:t,text:``,images:[]}}let T=(0,H.useCallback)((e,t,n)=>{i.setQueryData(F.runs.drafts(e),e=>{let r={...e?.surfaces??{}};return n===null||n.text===``&&n.images.length===0?delete r[t]:r[t]={...n,updatedAt:new Date().toISOString()},{surfaces:r}})},[i]),E=(0,H.useRef)(T);E.current=T;let D=(0,H.useRef)(a);D.current=a;let O=(0,H.useCallback)((e,t,n,i)=>{D.current&&(S.current=S.current.catch(()=>{}).then(()=>r(e,t,n,i?{keepalive:!0}:void 0)).then(n=>E.current(e,t,n)).catch(()=>{}))},[]),k=(0,H.useCallback)(()=>{x.current!==null&&(clearTimeout(x.current),x.current=null)},[]),A=(0,H.useCallback)(e=>{k();let t=C.current;O(t.runId,t.surface,{text:t.text,images:t.images.map(e=>e.id).filter(e=>e!==void 0)},e)},[k,O]),j=(0,H.useCallback)(()=>{k(),x.current=setTimeout(()=>{x.current=null,!b.current&&A()},500)},[k,A]),M=(0,H.useCallback)((n,r)=>{v.current=!0,D.current&&(T(e,t,{text:n,images:Ys(r)}),j())},[T,e,j,t]),N=(0,H.useCallback)(e=>{l(e),C.current={...C.current,text:e},M(e,C.current.images)},[M]),te=(0,H.useCallback)((n,r=`edit`)=>{let i=C.current.images.map(e=>e.id).filter(e=>e!==void 0&&!n.some(t=>t.id===e));if(f(n),C.current={...C.current,images:n},M(C.current.text,n),r!==`submit`&&D.current)for(let n of i)u(e,t,n).catch(()=>{});let a=e,o=t;for(let e of n)e.id!==void 0||!D.current||ee(a,o,{mediaType:e.mediaType,data:e.data,name:e.name}).then(t=>{C.current.runId!==a||C.current.surface!==o||(f(n=>{let r=n.map(n=>n===e?{...n,id:t.id}:n);return C.current={...C.current,images:r},r}),M(C.current.text,C.current.images))}).catch(()=>{})},[M,e,t]),ne=(0,H.useCallback)(()=>{k(),b.current=!1,l(``),f([]),C.current={...C.current,text:``,images:[]},v.current=!1,y.current=p,T(e,t,null),O(e,t,{text:``,images:[]})},[T,k,p,e,t,O]),re=(0,H.useCallback)(async e=>{b.current=!0,k();try{let t=await e();return b.current=!1,ne(),t}catch(e){throw b.current=!1,j(),e}},[k,ne,j]);return(0,H.useEffect)(()=>{if(w.current.length===0)return;let e=w.current;w.current=[];for(let t of e)O(t.runId,t.surface,{text:t.text,images:t.images})}),(0,H.useEffect)(()=>{if(y.current===p||s===void 0||(y.current=p,v.current))return;let n=typeof s.text==`string`?s.text:``,r=Array.isArray(s.images)?s.images:[];if(l(n),C.current={...C.current,text:n},r.length===0)return;let i=!0;return Promise.all(r.slice(0,Rs).map(async n=>{try{let r=await _(e,t,n.id),i=Ve(r.mediaType),a=r.name!==``&&r.name!==Gs(r.mediaType,i);return{id:r.id,mediaType:r.mediaType,data:r.data,name:r.name||Gs(r.mediaType,i),...a?{originalName:r.name}:{},...i?{preview:`data:${r.mediaType};base64,${r.data}`}:{},isImage:i}}catch{return null}})).then(e=>{let t=e.filter(e=>e!==null);!i||t.length===0||v.current||(f(t),C.current={...C.current,images:t})}),()=>{i=!1}},[s,p,e,t]),(0,H.useEffect)(()=>{let e=()=>{x.current===null||b.current||A(!0)},t=()=>{document.visibilityState===`hidden`&&e()};return document.addEventListener(`visibilitychange`,t),window.addEventListener(`pagehide`,e),()=>{document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`pagehide`,e)}},[A]),(0,H.useEffect)(()=>()=>{x.current!==null&&A()},[A]),{ready:!a||o.isSuccess||o.isError,hasDraft:c!==``||d.length>0,text:c,setText:N,images:d,setImages:te,submit:re,clear:ne}}function Zs(e){let t=h();return x({mutationFn:()=>a(e),onSuccess:()=>t.invalidateQueries({queryKey:F.runs.all}),onError:e=>z(e.message,{tone:`danger`})})}function Qs(e){let t=y().data?.capabilities?.localHandoff;return xi(e).terminal&&t!==!1}function $s(e,{onMarkedUnread:t,surface:n=`task_view`,onScreen:r=!0}={}){let i=h(),a=He(),[o,s]=(0,H.useState)(null),c=Ie(),[l,u]=(0,H.useState)(null),d=l?.scope===c&&l.runId===e.id,p=t=>u(t?{scope:c,runId:e.id}:null),g={run:e,scope:c,detailKey:F.runs.detail(e.id),listKey:F.runs.all,lifecycleKey:Ke.all(),worktreesKey:F.worktrees},_=ue().data?.worktreeLifecycle,y=!!e.worktreeLifecycle||!!e.worktreePath&&!!((_?.afterCreate.length??0)+(_?.beforeRemove.length??0)),b=()=>i.invalidateQueries({queryKey:F.runs.all}),S=e=>{e instanceof P&&e.status===409&&b(),z(e.message,{tone:`danger`})},C=Zs(e.id),w=x({mutationFn:t=>be(e.id,!e.archived,t??n),onSuccess:b,onError:S}),T=m(n),D={isPending:T.isPending,mutate:t=>T.mutate({id:e.id,pinned:!e.pinned,surface:t},{onError:S})},O=E(),ee={isPending:O.isPending,mutate:()=>{t?.(),O.mutate(e.id,{onError:S})}},A=v(),j={isPending:A.isPending,mutate:()=>A.mutate(e.id,{onError:S})},M=x({mutationFn:()=>pe(e.id),onSuccess:b,onError:S}),N=x({mutationFn:async e=>{if(!mi(e.run))throw Error(`This task has no removable worktree.`);if((await te(e.run.id,void 0,e.scope)).uncommitted!==0)throw Error(`Commit or stash uncommitted changes before removing the worktree.`);return oe({requestId:crypto.randomUUID(),runId:e.run.id,intent:`reclaim`},e.scope)},onSuccess:({operation:e},t)=>{u(e=>e?.scope===t.scope&&e.runId===t.run.id?null:e),Ie()===t.scope&&i.setQueryData(Ke.operation(e.id),{operation:e}),i.setQueryData(t.detailKey,t=>t&&{...t,worktreeLifecycle:{worktreeId:e.worktreeId,generation:e.generation,activeOperationId:e.id,phase:e.phase,state:e.state,needsAttention:e.state===`needs_attention`||e.state===`interrupted`}}),i.invalidateQueries({queryKey:t.listKey}),i.invalidateQueries({queryKey:t.lifecycleKey}),i.invalidateQueries({queryKey:t.worktreesKey}),z(`Worktree removal requested. Follow cleanup progress on this task.`)},onError:(e,t)=>{e instanceof P&&e.status===409&&i.invalidateQueries({queryKey:t.listKey}),z(e.message,{tone:`danger`})}});return{finish:C,archive:w,pin:D,markUnread:ee,markRead:j,cancel:M,removeWorktree:{...N,mutate:()=>N.mutate(g),mutateAsync:()=>N.mutateAsync(g)},worktreeRemovalOpen:d,setWorktreeRemovalOpen:p,delete:x({mutationFn:async()=>{let t=(e.worktreePath&&!e.worktreeLifecycle?await f():void 0)?.worktreeLifecycle;return e.worktreeLifecycle||e.worktreePath&&(t?.afterCreate.length??0)+(t?.beforeRemove.length??0)>0?{kind:`lifecycle`,operation:(await oe({requestId:crypto.randomUUID(),runId:e.id,intent:`delete-task`})).operation}:(await k(e.id),{kind:`deleted`})},onSuccess:t=>{if(b(),t.kind===`lifecycle`){let n=t.operation;i.setQueryData(Ke.operation(n.id),{operation:n}),i.setQueryData(F.runs.detail(e.id),e=>e&&{...e,worktreeLifecycle:{worktreeId:n.worktreeId,generation:n.generation,activeOperationId:n.id,phase:n.phase,state:n.state,needsAttention:n.state===`needs_attention`||n.state===`interrupted`}}),i.invalidateQueries({queryKey:Ke.all()}),z(`Cleanup requested. The task is kept until cleanup completes.`),r&&a(`/tasks/${e.id}`);return}r&&a(`/`)},onError:S}),lifecycleDelete:y,terminal:x({mutationFn:()=>Oe(e.id),onError:e=>{if(e instanceof P&&e.command){ec(e.command,`No terminal found — command copied to clipboard.`);return}S(e)}}),confirming:o,setConfirming:s}}async function ec(e,t){try{await Wt(e),z(t)}catch{z(`Run manually: ${e}`)}}function tc(e,t){let n=o(),r=g(),i=x({mutationFn:t=>Ce(e.id,t),onError:e=>z(e.message,{tone:`danger`})}),a=fe(r.data),s=e=>!r.isSuccess||a.includes(e??`claude`),c=t&&s(e.runner);return{choices:e.worktreePath?(n.data?.targets??[]).filter(t=>{let n=ri(t.id);return n===void 0||!e.worktreeLifecycle?.activeOperationId&&s(n)}).map(t=>({target:t,...bi(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],canResumeHere:c,open:e=>i.mutate(e)}}var nc=new Map,rc=Object.values({run:(e,t)=>e.run===t.run,tab:(e,t)=>e.tab===t.tab,onMarkedUnread:(e,t)=>e.onMarkedUnread===t.onMarkedUnread,continuationEngine:(e,t)=>e.continuationEngine===t.continuationEngine,tabs:(e,t)=>e.tabs===t.tabs,headerActions:(e,t)=>e.headerActions===t.headerActions,wide:(e,t)=>e.wide===t.wide,planTally:(e,t)=>e.planTally?.done===t.planTally?.done&&e.planTally?.total===t.planTally?.total}),ic=(0,H.memo)(ac,(e,t)=>rc.every(n=>n(e,t)));function ac({run:e,planTally:t,tab:n=`session`,onMarkedUnread:r,continuationEngine:a,tabs:o,headerActions:c,wide:l=!1}){let u=M(e),d=s(e),f=Qs(e),p=yi(e),m=$s(e,{onMarkedUnread:r}),h=n===`session`,[,g]=(0,H.useReducer)(e=>e+1,0),_=(0,H.useId)(),v=nc.get(e.id)??!1,b=()=>{nc.set(e.id,!v),g()},x=w((0,H.useMemo)(()=>t=>e.status===`queued`?i(t).get(e.id):void 0,[e.id,e.status])).data,S=y(),C=on(S.data),T=hc(e),[E,D]=Mc();return(0,U.jsx)(Ye,{projectId:T.projectId,requests:T.requests,children:(0,U.jsxs)(`header`,{"data-slot":`run-header`,className:`relative z-20 border-b border-border bg-background/95 px-3 pt-2 backdrop-blur md:sticky md:top-0 md:px-6 md:pt-3`,children:[(0,U.jsxs)(`div`,{className:L(`mx-auto w-full`,!l&&`max-w-[var(--measure)]`),children:[(0,U.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-h-[30px] min-w-0 items-center gap-2`,children:[(0,U.jsxs)(`span`,{"data-slot":`run-identity`,className:`flex min-w-0 flex-1 items-center gap-2.5`,children:[(0,U.jsx)(fc,{run:e}),(0,U.jsx)(sc,{planTally:t,budget:d})]}),(0,U.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2.5`,children:[(0,U.jsx)(oc,{attention:u,queuePosition:x}),c,(0,U.jsx)(R,{variant:`ghost`,size:`icon-sm`,"data-action":`collapse-header`,className:`hidden text-muted-foreground md:inline-flex`,"aria-label":E?`Expand header`:`Collapse header`,"aria-expanded":!E,title:E?`Expand header`:`Collapse header`,onClick:()=>D(!E),children:E?(0,U.jsx)(mn,{"aria-hidden":`true`}):(0,U.jsx)(pn,{"aria-hidden":`true`})}),(0,U.jsx)(R,{variant:`ghost`,size:`icon-sm`,className:`md:hidden`,"aria-label":v?`Hide run details`:`Show run details`,"aria-controls":_,"aria-expanded":v,onClick:b,children:(0,U.jsx)(ht,{"aria-hidden":`true`,className:L(`transition-transform`,v&&`rotate-180`)})}),(0,U.jsx)(Tc,{run:e,actions:m,showRunControls:!h})]})]}),(0,U.jsx)(`div`,{id:_,"data-slot":`run-details`,className:L(v?`block`:`hidden`,E?`md:hidden`:`md:block`),children:(0,U.jsx)(mc,{run:e,references:T.references,actions:(0,U.jsxs)(`div`,{"data-slot":`run-actions`,className:`hidden items-center gap-1 md:flex`,children:[(0,U.jsx)(lc,{run:e,actions:m,showRunControls:!h}),(0,U.jsx)(dc,{run:e,canResume:f,onResume:()=>m.terminal.mutate()})]}),continuationEngine:a,showTokens:C.tokens,showCost:C.cost,automationsAvailable:S.data?.capabilities?.automations===!0})}),(0,U.jsx)(Cc,{run:e}),(0,U.jsx)(vc,{run:e}),(0,U.jsx)(xc,{run:e}),(0,U.jsx)(`div`,{"data-slot":`run-tabs`,className:`mt-1.5 flex items-end gap-1 overflow-x-auto md:mt-2.5 md:overflow-x-visible`,children:o??(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(V,{to:`/tasks/${e.id}`,active:n===`session`,children:`Session`}),(0,U.jsx)(V,{to:`/tasks/${e.id}/changes`,active:n===`changes`,children:`Changes`}),(0,U.jsx)(V,{to:`/tasks/${e.id}/commits`,active:n===`commits`,children:`Commits`}),(0,U.jsx)(V,{to:`/tasks/${e.id}/files`,active:n===`files`,children:`Files`}),e.workflowDef?(0,U.jsx)(V,{to:`/tasks/${e.id}/graph`,active:n===`graph`,children:`Graph`}):null,(0,U.jsx)(V,{to:`/tasks/${e.id}/notes`,active:n===`notes`,children:`Notes`}),(0,U.jsx)(V,{to:`/tasks/${e.id}/preview`,active:n===`preview`,children:`Preview`}),S.data?.capabilities?.terminal?(0,U.jsx)(V,{to:`/tasks/${e.id}/terminal`,active:n===`terminal`,children:`Terminal`}):null]})}),e.steps.length>0?(0,U.jsx)(`div`,{className:L(`border-t border-border pt-1 pb-0 md:pt-2 md:pb-1`,E&&`md:hidden`),children:(0,U.jsx)(Ls,{runId:e.id,steps:e.steps})}):null,p?(0,U.jsx)(`div`,{className:E?`md:hidden`:void 0,children:(0,U.jsx)(Ac,{hint:p})}):null]}),(0,U.jsx)(Zo,{run:e,confirming:m.confirming,lifecycleDelete:m.lifecycleDelete,onOpenChange:e=>!e&&m.setConfirming(null),onConfirm:e=>e===`delete`?m.delete.mutate():m.cancel.mutate()}),m.worktreeRemovalOpen?(0,U.jsx)($o,{run:e,pending:m.removeWorktree.isPending,onClose:()=>m.setWorktreeRemovalOpen(!1),onConfirm:()=>m.removeWorktree.mutate()},e.id):null]})})}function oc({attention:e,queuePosition:t}){return(0,U.jsxs)(qt,{className:`shrink-0`,dot:e.tone,pulse:e.pulse,children:[e.label,t===void 0?``:` #${t}`]})}function sc({planTally:e,budget:t}){return(0,U.jsxs)(U.Fragment,{children:[e?(0,U.jsxs)(`span`,{"data-slot":`plan-mirror`,className:`hidden shrink-0 text-meta text-soft-foreground tabular-nums md:inline`,children:[`Plan `,e.done,`/`,e.total]}):null,t?(0,U.jsxs)(`span`,{"data-slot":`budget-stop`,className:`shrink-0 text-xs text-muted-foreground tabular-nums`,children:[`Spent `,se(t.spent)||`$0.00`,` of `,se(t.ceiling)||`$0.00`]}):null]})}function cc(e){return q(e.status)?`Stop the task first`:void 0}function lc({run:e,actions:t,showRunControls:n}){let r=xi(e),i=cc(e),a=n&&r.cancel,o=n&&e.status===`waiting`&&r.finish,s=e.worktreeLifecycle?.activeOperationId?`Resolve the worktree operation first`:void 0;return(0,U.jsxs)(`span`,{"data-slot":`task-item-actions`,className:`mx-1 flex items-center gap-0.5`,children:[r.markRead||r.markUnread?(0,U.jsx)(uc,{slot:`unread-toggle`,label:r.markRead?`Mark read`:`Mark unread`,title:r.markRead?`Unread — mark it read`:`Mark unread — put it back in your unread list`,pressed:r.markRead,pending:t.markRead.isPending||t.markUnread.isPending,onClick:()=>r.markRead?t.markRead.mutate():t.markUnread.mutate(),className:L(r.markRead&&`text-violet hover:text-violet [&_svg]:fill-violet/25`),children:(0,U.jsx)(jn,{"aria-hidden":`true`})}):null,(0,U.jsx)(uc,{slot:`pin-run`,label:e.pinned?`Unpin`:`Pin`,title:e.pinned?`Pinned — unpin from the top of this project’s task list`:`Pin to the top of this project’s task list`,pressed:!!e.pinned,unavailable:r.pin?void 0:`Archived tasks can’t be pinned`,pending:t.pin.isPending,onClick:()=>t.pin.mutate(),className:L(e.pinned&&`text-violet hover:text-violet [&_svg]:fill-violet/25`),children:(0,U.jsx)(Ln,{"aria-hidden":`true`})}),(0,U.jsx)(uc,{slot:`archive-run`,label:e.archived?`Unarchive`:`Archive`,title:e.archived?`Archived — move it back to the active list`:`Move to the archived list`,pressed:!!e.archived,unavailable:i,pending:t.archive.isPending,onClick:()=>t.archive.mutate(void 0),className:L(e.archived&&`text-violet hover:text-violet [&_svg]:fill-violet/25`),children:(0,U.jsx)(un,{"aria-hidden":`true`})}),(0,U.jsx)(uc,{slot:`delete-run`,label:`Delete`,title:`Delete the task, its worktree and its branch`,unavailable:i??s,danger:!0,onClick:()=>t.setConfirming(`delete`),className:`ml-1`,children:(0,U.jsx)(ft,{"aria-hidden":`true`})}),a||o||mi(e)?(0,U.jsxs)(wt,{children:[(0,U.jsx)(Ot,{label:`More actions`,children:(0,U.jsx)(kt,{asChild:!0,children:(0,U.jsx)(R,{variant:`ghost`,size:`icon-sm`,"aria-label":`More actions`,children:(0,U.jsx)(Cn,{"aria-hidden":`true`})})})}),(0,U.jsxs)(Et,{align:`end`,"data-slot":`run-more-menu`,children:[mi(e)?(0,U.jsxs)(B,{disabled:t.removeWorktree.isPending,onSelect:()=>t.setWorktreeRemovalOpen(!0),children:[(0,U.jsx)(Tn,{"aria-hidden":`true`}),` Remove worktree…`]}):null,o?(0,U.jsxs)(B,{onSelect:()=>t.finish.mutate(),children:[(0,U.jsx)(mt,{"aria-hidden":`true`}),` End session`]}):null,a?(0,U.jsxs)(B,{variant:`destructive`,onSelect:()=>t.setConfirming(`cancel`),children:[(0,U.jsx)(hn,{"aria-hidden":`true`}),` Stop`]}):null]})]}):null]})}function uc({slot:e,label:t,title:n,unavailable:r,pending:i=!1,pressed:a,danger:o=!1,onClick:s,className:c,children:l}){let u=r!==void 0;return(0,U.jsx)(Ot,{label:r??n,children:(0,U.jsx)(R,{variant:`ghost`,size:`icon-sm`,"data-slot":e,"aria-label":t,"aria-pressed":a,"aria-disabled":u||void 0,disabled:i,onClick:u?void 0:s,className:L(c,o&&`hover:bg-danger/10 hover:text-danger`,u&&`cursor-not-allowed opacity-50 hover:bg-transparent hover:text-muted-foreground`),children:l})})}function dc({run:e,canResume:t,onResume:n}){let{choices:r,canResumeHere:i,open:a}=tc(e,t);return!i&&r.length===0?null:(0,U.jsx)(ii,{choices:r,onPick:a,title:`Resume in a terminal, or open the worktree locally`,leading:i?(0,U.jsxs)(B,{"data-target":`terminal-resume`,onSelect:n,children:[(0,U.jsx)(Hn,{"aria-hidden":`true`}),`Terminal (resume session)`]}):null,trailing:e.worktreePath?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(St,{}),(0,U.jsxs)(B,{onSelect:()=>{let t=e.worktreePath;t&&Wt(t).then(()=>z(`Worktree path copied`)).catch(()=>z(`Path: ${t}`))},children:[(0,U.jsx)(yn,{"aria-hidden":`true`}),`Copy worktree path`]})]}):null})}function fc({run:e}){let t=j(e.id),n=b(e),r=Xs(e.id,`title`),i=Ta(n,e=>t.mutate({title:e},{onError:e=>z(e.message,{tone:`danger`})})),a={...i,setDraft:e=>{i.setDraft(e),r.setText(e)},commit:()=>{i.commit(),r.clear()},cancel:()=>{i.cancel(),r.clear()}},o=(0,H.useRef)(i.beginWith);o.current=i.beginWith;let s=i.editing;return(0,H.useEffect)(()=>{s||!r.ready||!r.hasDraft||o.current(r.text)},[r.hasDraft,r.ready,r.text,s]),i.editing?(0,U.jsx)(Ea,{editor:a,className:`flex-1 text-lead font-semibold`}):(0,U.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,U.jsx)(`h1`,{className:`min-w-0 truncate text-lead font-semibold`,title:e.task,children:n}),(0,U.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:i.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,U.jsx)(Vt,{className:`size-3.5`,"aria-hidden":`true`})})]})}function pc({branch:e}){let[t,n]=(0,H.useState)(!1),[r,i]=(0,H.useState)(!1),a=(0,H.useRef)(null);return(0,H.useEffect)(()=>()=>{a.current!==null&&clearTimeout(a.current)},[]),(0,U.jsx)(vt,{children:(0,U.jsxs)(yt,{open:r,onOpenChange:e=>{e&&a.current===null&&n(!1),i(e)},children:[(0,U.jsx)(gt,{asChild:!0,children:(0,U.jsxs)(`button`,{type:`button`,"data-slot":`branch-chip`,className:`cursor-copy rounded-sm border border-border bg-card px-1.5 py-px font-mono text-meta font-medium hover:bg-muted focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,"aria-label":`Copy branch name ${e}`,onClick:()=>{Wt(e).then(()=>{n(!0),i(!0),a.current!==null&&clearTimeout(a.current),a.current=setTimeout(()=>{a.current=null,i(!1)},1500)}).catch(()=>z(`Branch: ${e}`))},children:[e,(0,U.jsx)(`span`,{className:`sr-only`,role:`status`,children:t?`Branch name copied`:``})]})}),(0,U.jsx)(_t,{children:t?`Copied`:`Copy branch name`})]})})}function mc({run:e,references:t,actions:n,showTokens:r,showCost:i,automationsAvailable:a,continuationEngine:o}){let s=A(),c=[(0,U.jsx)(`span`,{children:O(e)},`workflow`)],l=e.branch;l&&c.push((0,U.jsx)(pc,{branch:l},`branch`)),e.diffStat&&c.push((0,U.jsx)(sn,{stat:e.diffStat},`diff`)),c.push(...gc(e,t));let u=re(e,s);if(u&&Be(u)){let t=me(u);c.push((0,U.jsx)(at,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:u},taskTitle:b(e),className:`h-5`},`issue`))}return e.automation&&c.push(a?(0,U.jsx)(We,{to:`/automations/${encodeURIComponent(e.automation.automationId)}/log`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-meta font-medium hover:text-foreground`,children:`Automation`},`automation`):(0,U.jsx)(`span`,{"data-slot":`automation-origin`,title:`Automations are off on this server (CEZ_AUTOMATIONS)`,className:`rounded-sm border border-border bg-card px-1.5 py-px text-meta font-medium`,children:`Automation`},`automation`)),(0,U.jsxs)(`div`,{"data-slot":`run-meta`,className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground md:mt-1.5 md:gap-y-1`,children:[c.map((e,t)=>(0,U.jsxs)(H.Fragment,{children:[t>0?(0,U.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,U.jsx)(_c,{run:e,showTokens:r,showCost:i,continuationEngine:o,className:`ml-auto`}),n]})}function hc(e){let t=A(),n=T(),r=(0,H.useMemo)(()=>ae(e,t),[e,t]);return{projectId:n,references:r,requests:(0,H.useMemo)(()=>n===void 0?[]:r.map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n])}}function gc(e,t){let n=[],r=t.filter(e=>e.kind===`PR`),i=we(e);i&&Be(i)&&!r.some(e=>e.url===i)&&r.push({kind:`PR`,url:i});let[a]=r;return a&&n.push((0,U.jsxs)(`span`,{"data-slot":`run-pr-refs`,className:`flex flex-nowrap items-center gap-1`,children:[(0,U.jsx)(at,{reference:a,taskTitle:b(e),className:`h-5 shrink-0`,conflictAction:(0,U.jsx)(zi,{run:e,prNumber:a.number})}),r.length>1?(0,U.jsx)(Aa,{references:r,taskTitle:b(e),hidden:r.length-1}):null]},`pr`)),n}function _c({run:e,showTokens:t,showCost:n,continuationEngine:r,className:i}){let a=[];return t&&(e.inputTokens!==void 0||e.outputTokens!==void 0)&&a.push((0,U.jsx)(Gt,{inputTokens:e.inputTokens,outputTokens:e.outputTokens},`tokens`)),n&&e.costUsd&&a.push((0,U.jsx)(`span`,{className:`tabular-nums`,children:se(e.costUsd)},`cost`)),(0,U.jsxs)(`span`,{"data-slot":`run-usage`,className:L(`flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground`,i),children:[a.map((e,t)=>(0,U.jsxs)(H.Fragment,{children:[t>0?(0,U.jsx)(`span`,{className:`text-soft-foreground`,"aria-hidden":`true`,children:`·`}):null,e]},t)),(0,U.jsx)(wc,{run:e,continuationEngine:r})]})}function vc({run:e}){let t=w(),n=e.dispatch?.parentRunId;if(n===void 0)return null;let r=(t.data??[]).find(e=>e.id===n),i=r?M(r):null;return(0,U.jsxs)(`div`,{"data-slot":`dispatch-parent-line`,className:`mt-1 flex min-w-0 items-center gap-2 overflow-hidden text-xs text-muted-foreground`,children:[(0,U.jsx)(`span`,{className:`shrink-0`,children:`Dispatched by`}),(0,U.jsxs)(We,{to:`/tasks/${n}`,"data-slot":`dispatch-parent`,"data-run-id":n,className:`inline-flex min-w-0 items-center gap-1.5 truncate hover:text-foreground`,children:[i?(0,U.jsx)(an,{tone:i.tone,pulse:i.pulse}):null,(0,U.jsx)(`span`,{className:`truncate`,children:r?b(r):n})]})]})}var yc=4,bc=new Map;function xc({run:e}){let t=w(),[,n]=(0,H.useReducer)(e=>e+1,0),r=(0,H.useId)(),i=(t.data??[]).filter(t=>t.dispatch?.parentRunId===e.id);if(i.length===0)return null;let a=bc.get(e.id)??i.length<=yc;return(0,U.jsxs)(`div`,{"data-slot":`dispatch-children`,className:`mt-1 min-w-0 text-xs text-muted-foreground`,children:[(0,U.jsxs)(`button`,{type:`button`,"data-slot":`dispatch-children-toggle`,"aria-controls":r,"aria-expanded":a,onClick:()=>{bc.set(e.id,!a),n()},className:`flex min-w-0 max-w-full items-center gap-1.5 overflow-hidden hover:text-foreground`,children:[(0,U.jsx)(ht,{"aria-hidden":`true`,className:L(`size-3 shrink-0 transition-transform`,!a&&`-rotate-90`)}),(0,U.jsx)(`span`,{className:`shrink-0`,children:`Subtasks`}),(0,U.jsx)(`span`,{"data-slot":`dispatch-children-count`,className:`shrink-0 tabular-nums`,children:i.length}),(0,U.jsx)(Sc,{subtasks:i})]}),a?(0,U.jsx)(`div`,{id:r,"data-slot":`dispatch-children-list`,className:`mt-0.5 flex max-h-28 min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 overflow-y-auto overscroll-contain pl-[1.125rem]`,children:i.map(e=>{let t=M(e);return(0,U.jsxs)(We,{to:`/tasks/${e.id}`,"data-slot":`dispatch-child`,"data-run-id":e.id,title:`${b(e)} — ${t.label}`,className:`inline-flex max-w-52 items-center gap-1.5 truncate hover:text-foreground`,children:[(0,U.jsx)(an,{tone:t.tone,pulse:t.pulse}),(0,U.jsx)(`span`,{className:`truncate`,children:b(e)})]},e.id)})}):null]})}function Sc({subtasks:e}){let t=new Map;for(let n of e){let e=M(n),r=t.get(e.label);if(r){r.count+=1;continue}t.set(e.label,{tone:e.tone,pulse:e.pulse,rank:ke[e.bucket],count:1})}return(0,U.jsx)(`span`,{"data-slot":`dispatch-children-tally`,className:`flex min-w-0 items-center gap-2 overflow-hidden`,children:[...t.entries()].sort(([,e],[,t])=>e.rank-t.rank||t.count-e.count).map(([e,t])=>(0,U.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1`,children:[(0,U.jsx)(an,{tone:t.tone,pulse:t.pulse}),(0,U.jsx)(`span`,{className:`tabular-nums`,children:t.count}),(0,U.jsx)(`span`,{children:e})]},e))})}function Cc({run:e}){if(e.status!==`running`||e.activity!==`monitoring`)return null;if(e.monitoringWakeCapReached)return(0,U.jsx)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:`Automatic checks paused — 40/40 reached`});let t=e.monitoringWakeAt?new Date(e.monitoringWakeAt):null,n=t&&Number.isFinite(t.getTime())?t:null;if(!n)return(0,U.jsx)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:`Parked — no automatic check scheduled`});let r=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n);return(0,U.jsxs)(`p`,{"data-slot":`monitoring-schedule`,role:`status`,className:`mt-1 text-xs text-muted-foreground`,children:[`Next automatic check`,` `,(0,U.jsx)(`time`,{dateTime:e.monitoringWakeAt,className:`font-medium text-foreground`,children:r})]})}function wc({run:e,continuationEngine:t}){let{runner:n,account:r,model:i,identity:a,summary:o}=Os(e);return(0,U.jsxs)(wt,{children:[(0,U.jsx)(Ot,{label:o,children:(0,U.jsx)(kt,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,"data-slot":`agent-badge`,"aria-label":`Agent: ${n}, ${r?`account ${r}, `:``}model ${i}`,className:`flex shrink-0 items-center rounded-sm p-1 text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,U.jsx)(lt,{className:`size-3.5 shrink-0`,"aria-hidden":`true`})})})}),(0,U.jsxs)(Et,{align:`end`,className:`min-w-[9rem]`,children:[(0,U.jsxs)(xt,{className:`font-mono text-meta font-normal text-muted-foreground`,children:[`runner: `,n]}),r?(0,U.jsxs)(xt,{"data-slot":`agent-badge-account`,className:`font-mono text-meta font-normal text-muted-foreground`,children:[`account: `,r]}):null,(0,U.jsxs)(xt,{className:`font-mono text-meta font-normal text-muted-foreground`,children:[`model: `,i]}),a?(0,U.jsxs)(xt,{"data-slot":`agent-badge-identity`,className:`font-mono text-meta font-normal text-muted-foreground`,children:[`identity: `,a]}):null,t?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(St,{}),(0,U.jsx)(xt,{className:`pb-1 text-meta font-normal text-muted-foreground`,children:`Next continuation`}),(0,U.jsx)(`div`,{"data-slot":`agent-badge-engine-picker`,className:`px-2 pb-1`,onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:t})]}):null]})]})}function Tc({run:e,actions:t,showRunControls:n}){let r=wa(e);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{className:`hidden md:contents`,children:(0,U.jsx)(Mt,{action:r.action,pending:r.pending,onAction:r.onAction})}),(0,U.jsx)(Ec,{run:e,actions:t,git:r,showRunControls:n}),r.dialogs]})}function Ec({run:e,actions:t,git:n,showRunControls:r}){let i=Ho({run:e,canResume:Qs(e),git:n.action,gitPending:n.pending,workspace:null,terminalAvailable:!1,openChoices:[],taskUrl:``},{markRead:()=>t.markRead.mutate(),markUnread:()=>t.markUnread.mutate(),pin:()=>t.pin.mutate(),archive:()=>t.archive.mutate(void 0),rename:()=>{},finish:()=>t.finish.mutate(),confirmStop:()=>t.setConfirming(`cancel`),confirmDelete:()=>t.setConfirming(`delete`),resumeInTerminal:()=>t.terminal.mutate(),gitAction:n.onAction,openIn:()=>{},navigate:()=>{},openUrl:()=>{},copy:()=>{}}),a=new Map(i.map(e=>[e.id,e])),o=e=>{let t=a.get(e);return t&&t.unavailable===void 0?t:void 0},s=i.filter(e=>e.group===`git`&&e.id.startsWith(`git:`)),c=[r?o(`end-session`):void 0,o(`open:terminal-resume`),o(`toggle-read`),o(`pin`),o(`archive`)].filter(e=>e!==void 0),l=r?o(`stop`):void 0,u=o(`delete`),d={"toggle-read":t.markRead.isPending||t.markUnread.isPending,pin:t.pin.isPending};return(0,U.jsxs)(wt,{children:[(0,U.jsx)(kt,{asChild:!0,children:(0,U.jsx)(R,{variant:`ghost`,size:`icon-sm`,"aria-label":`Run actions`,className:`md:hidden`,children:(0,U.jsx)(Sn,{"aria-hidden":`true`})})}),(0,U.jsxs)(Et,{align:`end`,"data-slot":`run-actions-menu`,children:[s.length>0?(0,U.jsxs)(U.Fragment,{children:[s.map(e=>(0,U.jsxs)(B,{"data-action":e.id.slice(4),disabled:e.unavailable!==void 0,title:e.unavailable,onSelect:()=>e.perform(),children:[e.icon,e.label]},e.id)),(0,U.jsx)(St,{})]}):null,c.map(e=>(0,U.jsxs)(B,{"data-slot":Dc[e.id],"aria-pressed":e.id in Dc||e.id===`archive`?!!e.pressed:void 0,disabled:d[e.id],onSelect:()=>e.perform(),children:[e.pressed?kc(e.icon):e.icon,Oc[e.id]??e.label]},e.id)),mi(e)?(0,U.jsxs)(B,{disabled:t.removeWorktree.isPending,onSelect:()=>t.setWorktreeRemovalOpen(!0),children:[(0,U.jsx)(Tn,{"aria-hidden":`true`}),` Remove worktree…`]}):null,l||u?(0,U.jsx)(St,{}):null,[l,u].map(e=>e?(0,U.jsxs)(B,{variant:`destructive`,onSelect:()=>e.perform(),children:[e.icon,` `,Oc[e.id]??e.label]},e.id):null)]})]})}var Dc={"toggle-read":`unread-toggle`,pin:`pin-run`},Oc={"open:terminal-resume":`Terminal`,stop:`Stop`,delete:`Delete`};function kc(e){return(0,H.isValidElement)(e)?(0,H.cloneElement)(e,{className:L(e.props.className,Da)}):e}function Ac({hint:e}){return(0,U.jsxs)(`button`,{type:`button`,"data-slot":`resume-hint`,title:`Copy the command`,onClick:()=>void ec(e,`Command copied to clipboard.`),className:`mb-2 flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-meta text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,U.jsx)(yn,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,U.jsxs)(`span`,{className:`truncate`,children:[`take over interactively: `,e]})]})}var jc=`cez:run-header-collapsed`;function Mc(){let[e,t]=(0,H.useState)(()=>{try{return window.localStorage.getItem(jc)===`1`}catch{return!1}});return[e,e=>{t(e);try{e?window.localStorage.setItem(jc,`1`):window.localStorage.removeItem(jc)}catch{}}]}var Nc={changes:`Loading changes…`,commits:`Loading changes…`,files:`Loading files…`,graph:`Loading the graph…`,notes:`Loading notes…`,terminal:`Loading the terminal…`,preview:`Loading the preview…`};function Pc({tab:e}){return(0,U.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,U.jsx)(ln,{icon:(0,U.jsx)(Bt,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:Nc[e],subtitle:`Fetching the run record.`})})}function Fc({tab:e,error:t}){let n=t instanceof P&&t.status===404;return(0,U.jsx)(`div`,{"data-route":`task-${e}`,className:`flex min-h-full flex-col`,children:(0,U.jsx)(ln,{icon:n?(0,U.jsx)(Ut,{}):(0,U.jsx)(zt,{}),tone:n?`neutral`:`danger`,title:n?`Task not found`:`Could not load this task`,subtitle:n?`No run has this id. It may have been deleted, or the link is from another machine.`:t.message,actions:(0,U.jsx)(R,{asChild:!0,variant:`outline`,children:(0,U.jsx)(We,{to:`/`,children:`Back to tasks`})})})})}export{ja as $,fi as $t,ts as A,Nn as An,Oa as At,Ho as B,Gi as Bt,fs as C,tr as Cn,to as Ct,ss as D,Vn as Dn,Eo as Dt,ds as E,Hn as En,go as Et,xs as F,Sn as Fn,ra as Ft,jo as G,Ri as Gt,Io as H,Ki as Ht,es as I,bn as In,Zi as It,Ma as J,Mi as Jt,Ao as K,ji as Kt,Zo as L,yn as Ln,Yi as Lt,ps as M,An as Mn,Ta as Mt,_s as N,Dn as Nn,wa as Nt,cs as O,In as On,Ba as Ot,ms as P,Cn as Pn,ia as Pt,Ga as Q,li as Qt,Qo as R,vn as Rn,Wi as Rt,ns as S,er as Sn,_o as St,bs as T,Gn as Tn,po as Tt,Lo as U,Bi as Ut,Po as V,J as Vt,Bo as W,Vi as Wt,Ja as X,q as Xt,Wa as Y,xi as Yt,qa as Z,ui as Zt,Ts as _,ur as _n,vo as _t,ec as a,Gr as an,Do as at,Cs as b,$n as bn,mo as bt,tc as c,Vr as cn,Za as ct,Bs as d,ar as dn,Ha as dt,di as en,Na as et,zs as f,ir as fn,yo as ft,ks as g,Zn as gn,Ia as gt,qs as h,nr as hn,Oo as ht,hc as i,Qr as in,oo as it,hs as j,Mn as jn,Ea as jt,ys as k,Fn as kn,Aa as kt,Zs as l,Hr as ln,Ya as lt,Js as m,Qn as mn,Va as mt,Pc as n,ii as nn,Z as nt,Qs as o,hr as on,ho as ot,Ks as p,rr as pn,wo as pt,Mo as q,hi as qt,ic as r,ri as rn,uo as rt,$s as s,Ur as sn,so as st,Fc as t,pi as tn,Co as tt,Xs as u,fr as un,So as ut,Ds as v,lr as vn,xo as vt,vs as w,cr as wn,co as wt,Ss as x,or as xn,lo as xt,ws as y,sr as yn,bo as yt,Vo as z,un as zn,Xi as zt};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{M as r,q as i}from"./queries-BTgOLNTK.js";import{F as a,r as o,t as s}from"./button-wdWSPx_B.js";import{s as c,t as l}from"./project-router-DgQSavhI.js";import{f as u,i as d,n as f,r as p,t as m}from"./tooltip-C2bzSwbQ.js";import{i as h,n as g,r as _,t as v,u as y}from"./icon-tooltip-CgAWLDxo.js";import{n as b,t as x}from"./upload-DrvICo_K.js";import{n as S,r as C}from"./triangle-alert-BdMPm9Jb.js";import{t as w}from"./git-pull-request-draft-Dwhm6Vhn.js";import{t as T}from"./loader-circle-CwT0JWiv.js";import{n as E}from"./lib-w_5wfsBF.js";var D=a(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),O=a(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),k=a(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),A=a(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),j=a(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),M=a(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),N=a(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),P=e(t(),1),F={github:`gh`};function I(e){return F[e]}function L(e){return`the ${e} CLI is not installed or not logged in — run \`${e} auth login\``}function R(e,t,n){let r=t?.bootProject??e?.bootProject??null;if(n===null||n==="default"||n===r)return e?.forge;let i=t?.projects?.find(e=>e.id===n);if(!i||!e)return;if(!i.forge)return null;let a=I(i.forge),o=a?e.checks?.find(e=>e.name===a):void 0;return!a||!o?{kind:i.forge}:o.available?{kind:i.forge,available:!0}:{kind:i.forge,available:!1,reason:L(a)}}function z(){let e=r().data,t=i().data,n=c();return(0,P.useMemo)(()=>R(e,t,n),[e,t,n])}var B=n();function V({to:e,active:t=!1,onClick:n,children:r}){return(0,B.jsx)(l,{to:e,"aria-current":t?`page`:void 0,onClick:n,className:o(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-2 text-ui font-medium md:px-3`,t?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`),children:r})}function H({mode:e,wrap:t,preview:n=!1,onModeChange:r,onWrapChange:i,onPreviewChange:a}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,B.jsx)(U,{current:e,value:`unified`,onModeChange:r}),(0,B.jsx)(U,{current:e,value:`split`,onModeChange:r})]}),a?(0,B.jsx)(p,{delayDuration:300,children:(0,B.jsxs)(m,{children:[(0,B.jsx)(d,{asChild:!0,children:(0,B.jsx)(s,{variant:`ghost`,size:`icon-sm`,"data-slot":`markdown-preview-toggle`,"aria-pressed":n,"aria-label":`Preview Markdown`,className:o(n&&`bg-muted text-foreground`),onClick:()=>a(!n),children:(0,B.jsx)(D,{"aria-hidden":`true`})})}),(0,B.jsx)(f,{side:`bottom`,sideOffset:6,"data-slot":`markdown-preview-tooltip`,children:n?`Show Markdown as a diff`:`Preview Markdown`})]})}):null,(0,B.jsx)(s,{variant:`ghost`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":t,"aria-label":`Wrap long lines`,title:`Wrap long lines`,className:o(t&&`bg-muted text-foreground`),onClick:()=>i(!t),children:(0,B.jsx)(M,{"aria-hidden":`true`})})]})}function U({current:e,value:t,onModeChange:n}){let r=e===t;return(0,B.jsx)(`button`,{type:`button`,"data-mode":t,"aria-pressed":r,onClick:()=>n(t),className:o(`rounded-[5px] px-2 py-0.5 text-meta font-medium capitalize`,r?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t})}function W({branch:e}){return(0,B.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-meta font-medium`,children:[(0,B.jsx)(A,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,B.jsx)(`span`,{className:`truncate`,children:e})]})}function G({branch:e,stat:t,mode:n,wrap:r,preview:i,onModeChange:a,onWrapChange:o,onPreviewChange:s}){return(0,B.jsxs)(`div`,{"data-slot":`git-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[e?(0,B.jsx)(W,{branch:e}):null,t?(0,B.jsx)(X,{stat:t}):null,(0,B.jsx)(`span`,{className:`ml-auto flex items-center gap-1`,children:(0,B.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,B.jsx)(H,{mode:n,wrap:r,preview:i,onModeChange:a,onWrapChange:o,onPreviewChange:s})})})]})}function K({action:e,pending:t=null,onAction:n}){if(!e)return null;let r=e.alternatives??[],i=t!==null;return(0,B.jsxs)(`span`,{"data-slot":`git-button`,className:`inline-flex items-center`,children:[(0,B.jsx)(Y,{action:e,busyAs:i?t:null,variant:`outline`,onAction:n,className:r.length>0?`rounded-r-none`:void 0}),r.length>0?(0,B.jsxs)(g,{children:[(0,B.jsx)(y,{asChild:!0,children:(0,B.jsx)(s,{variant:`outline`,size:`sm`,disabled:i,"aria-label":`More ways to ${e.label.toLowerCase()}`,className:`-ml-px rounded-l-none px-1.5`,children:(0,B.jsx)(u,{"aria-hidden":`true`})})}),(0,B.jsx)(_,{align:`end`,"data-slot":`git-button-menu`,children:r.map(e=>(0,B.jsxs)(h,{"data-action":e.id,disabled:!e.enabled,title:e.reason,onSelect:()=>n(e.id),children:[q[e.id],e.label]},e.id))})]}):null]})}var q={land:(0,B.jsx)(b,{"aria-hidden":`true`}),commit:(0,B.jsx)(b,{"aria-hidden":`true`}),"commit-push":(0,B.jsx)(x,{"aria-hidden":`true`}),push:(0,B.jsx)(x,{"aria-hidden":`true`}),"create-pr":(0,B.jsx)(S,{"aria-hidden":`true`}),"create-draft-pr":(0,B.jsx)(w,{"aria-hidden":`true`}),"update-branch":(0,B.jsx)(j,{"aria-hidden":`true`}),"resolve-conflicts":(0,B.jsx)(C,{"aria-hidden":`true`}),"fix-checks":(0,B.jsx)(N,{"aria-hidden":`true`})},J={land:`Committing and pushing…`,commit:`Committing…`,"commit-push":`Committing and pushing…`,push:`Pushing…`,"create-pr":`Creating PR…`,"create-draft-pr":`Creating draft PR…`,"update-branch":`Updating branch…`,"resolve-conflicts":`Resolving conflicts…`,"fix-checks":`Fixing errors…`};function Y({action:e,busyAs:t,variant:n,onAction:r,className:i}){let a=!e.enabled&&t===null,c=(0,B.jsx)(s,{variant:n,size:`sm`,"data-action":e.id,className:o(i,a&&`cursor-not-allowed opacity-50 hover:bg-card`),disabled:t!==null,"aria-disabled":a||void 0,"aria-busy":t!==null||void 0,onClick:a?void 0:()=>r(e.id),children:t?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(T,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}),J[t]]}):(0,B.jsxs)(B.Fragment,{children:[q[e.id],e.label]})});return a&&e.reason?(0,B.jsx)(v,{label:e.reason,children:c}):c}function X({stat:e}){return(0,B.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,B.jsx)(E,{stat:{adds:Z(e.adds),dels:Z(e.dels),files:e.files}})})}function Z(e){let[t,n]=(0,P.useState)(e),r=(0,P.useRef)(e);return(0,P.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}export{G as a,V as c,j as d,A as f,D as h,K as i,z as l,O as m,q as n,W as o,k as p,J as r,H as s,X as t,N as u};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{M as r,q as i}from"./queries-DsfjHsrp.js";import{F as a,r as o,t as s}from"./button-BvYDiOkd.js";import{s as c,t as l}from"./project-router-7DKoABD3.js";import{f as u,i as d,n as f,r as p,t as m}from"./tooltip-Bb7ddw0_.js";import{i as h,n as g,r as _,t as v,u as y}from"./icon-tooltip-nRvCJxOH.js";import{n as b,t as x}from"./upload-Crivm77f.js";import{n as S,r as C}from"./triangle-alert-BhQYv6Is.js";import{t as w}from"./git-pull-request-draft-DIdbQZ0O.js";import{t as T}from"./loader-circle-DAforPX2.js";import{n as E}from"./lib-C4vuyY62.js";var D=a(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),O=a(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),k=a(`folder`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),A=a(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),j=a(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),M=a(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),N=a(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),P=e(t(),1),F={github:`gh`};function I(e){return F[e]}function L(e){return`the ${e} CLI is not installed or not logged in — run \`${e} auth login\``}function R(e,t,n){let r=t?.bootProject??e?.bootProject??null;if(n===null||n==="default"||n===r)return e?.forge;let i=t?.projects?.find(e=>e.id===n);if(!i||!e)return;if(!i.forge)return null;let a=I(i.forge),o=a?e.checks?.find(e=>e.name===a):void 0;return!a||!o?{kind:i.forge}:o.available?{kind:i.forge,available:!0}:{kind:i.forge,available:!1,reason:L(a)}}function z(){let e=r().data,t=i().data,n=c();return(0,P.useMemo)(()=>R(e,t,n),[e,t,n])}var B=n();function V({to:e,active:t=!1,onClick:n,children:r}){return(0,B.jsx)(l,{to:e,"aria-current":t?`page`:void 0,onClick:n,className:o(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-2 text-ui font-medium md:px-3`,t?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`),children:r})}function H({mode:e,wrap:t,preview:n=!1,onModeChange:r,onWrapChange:i,onPreviewChange:a}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,B.jsx)(U,{current:e,value:`unified`,onModeChange:r}),(0,B.jsx)(U,{current:e,value:`split`,onModeChange:r})]}),a?(0,B.jsx)(p,{delayDuration:300,children:(0,B.jsxs)(m,{children:[(0,B.jsx)(d,{asChild:!0,children:(0,B.jsx)(s,{variant:`ghost`,size:`icon-sm`,"data-slot":`markdown-preview-toggle`,"aria-pressed":n,"aria-label":`Preview Markdown`,className:o(n&&`bg-muted text-foreground`),onClick:()=>a(!n),children:(0,B.jsx)(D,{"aria-hidden":`true`})})}),(0,B.jsx)(f,{side:`bottom`,sideOffset:6,"data-slot":`markdown-preview-tooltip`,children:n?`Show Markdown as a diff`:`Preview Markdown`})]})}):null,(0,B.jsx)(s,{variant:`ghost`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":t,"aria-label":`Wrap long lines`,title:`Wrap long lines`,className:o(t&&`bg-muted text-foreground`),onClick:()=>i(!t),children:(0,B.jsx)(M,{"aria-hidden":`true`})})]})}function U({current:e,value:t,onModeChange:n}){let r=e===t;return(0,B.jsx)(`button`,{type:`button`,"data-mode":t,"aria-pressed":r,onClick:()=>n(t),className:o(`rounded-[5px] px-2 py-0.5 text-meta font-medium capitalize`,r?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t})}function W({branch:e}){return(0,B.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-meta font-medium`,children:[(0,B.jsx)(A,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,B.jsx)(`span`,{className:`truncate`,children:e})]})}function G({branch:e,stat:t,mode:n,wrap:r,preview:i,onModeChange:a,onWrapChange:o,onPreviewChange:s}){return(0,B.jsxs)(`div`,{"data-slot":`git-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[e?(0,B.jsx)(W,{branch:e}):null,t?(0,B.jsx)(X,{stat:t}):null,(0,B.jsx)(`span`,{className:`ml-auto flex items-center gap-1`,children:(0,B.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,B.jsx)(H,{mode:n,wrap:r,preview:i,onModeChange:a,onWrapChange:o,onPreviewChange:s})})})]})}function K({action:e,pending:t=null,onAction:n}){if(!e)return null;let r=e.alternatives??[],i=t!==null;return(0,B.jsxs)(`span`,{"data-slot":`git-button`,className:`inline-flex items-center`,children:[(0,B.jsx)(Y,{action:e,busyAs:i?t:null,variant:`outline`,onAction:n,className:r.length>0?`rounded-r-none`:void 0}),r.length>0?(0,B.jsxs)(g,{children:[(0,B.jsx)(y,{asChild:!0,children:(0,B.jsx)(s,{variant:`outline`,size:`sm`,disabled:i,"aria-label":`More ways to ${e.label.toLowerCase()}`,className:`-ml-px rounded-l-none px-1.5`,children:(0,B.jsx)(u,{"aria-hidden":`true`})})}),(0,B.jsx)(_,{align:`end`,"data-slot":`git-button-menu`,children:r.map(e=>(0,B.jsxs)(h,{"data-action":e.id,disabled:!e.enabled,title:e.reason,onSelect:()=>n(e.id),children:[q[e.id],e.label]},e.id))})]}):null]})}var q={land:(0,B.jsx)(b,{"aria-hidden":`true`}),commit:(0,B.jsx)(b,{"aria-hidden":`true`}),"commit-push":(0,B.jsx)(x,{"aria-hidden":`true`}),push:(0,B.jsx)(x,{"aria-hidden":`true`}),"create-pr":(0,B.jsx)(S,{"aria-hidden":`true`}),"create-draft-pr":(0,B.jsx)(w,{"aria-hidden":`true`}),"update-branch":(0,B.jsx)(j,{"aria-hidden":`true`}),"resolve-conflicts":(0,B.jsx)(C,{"aria-hidden":`true`}),"fix-checks":(0,B.jsx)(N,{"aria-hidden":`true`})},J={land:`Committing and pushing…`,commit:`Committing…`,"commit-push":`Committing and pushing…`,push:`Pushing…`,"create-pr":`Creating PR…`,"create-draft-pr":`Creating draft PR…`,"update-branch":`Updating branch…`,"resolve-conflicts":`Resolving conflicts…`,"fix-checks":`Fixing errors…`};function Y({action:e,busyAs:t,variant:n,onAction:r,className:i}){let a=!e.enabled&&t===null,c=(0,B.jsx)(s,{variant:n,size:`sm`,"data-action":e.id,className:o(i,a&&`cursor-not-allowed opacity-50 hover:bg-card`),disabled:t!==null,"aria-disabled":a||void 0,"aria-busy":t!==null||void 0,onClick:a?void 0:()=>r(e.id),children:t?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(T,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}),J[t]]}):(0,B.jsxs)(B.Fragment,{children:[q[e.id],e.label]})});return a&&e.reason?(0,B.jsx)(v,{label:e.reason,children:c}):c}function X({stat:e}){return(0,B.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,B.jsx)(E,{stat:{adds:Z(e.adds),dels:Z(e.dels),files:e.files}})})}function Z(e){let[t,n]=(0,P.useState)(e),r=(0,P.useRef)(e);return(0,P.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}export{G as a,V as c,j as d,A as f,D as h,K as i,z as l,O as m,q as n,W as o,k as p,J as r,H as s,X as t,N as u};