@wjarka/cezarion 0.18.0-dev.5931 → 0.18.0-dev.5935

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 (54) hide show
  1. package/package.json +2 -2
  2. package/web/dist/assets/{activity-motion-C7SredQ0.js → activity-motion-XsGcc9eM.js} +2 -2
  3. package/web/dist/assets/{activity-route-WKqFXmCG.js → activity-route-DIDXHV7J.js} +1 -1
  4. package/web/dist/assets/agent-accounts-CuRvwNoA.js +18 -0
  5. package/web/dist/assets/commit-diff-panel-DtHg36xc.js +1 -0
  6. package/web/dist/assets/{control-locations-5bi8dzFR.js → control-locations-CljaLD_b.js} +1 -1
  7. package/web/dist/assets/dialog-Dw7fMdDQ.js +1 -0
  8. package/web/dist/assets/diff-ImdJ4tPA.js +3 -0
  9. package/web/dist/assets/{diff-view-dVGWG20n.js → diff-view-BMqNpcSH.js} +5 -5
  10. package/web/dist/assets/dist-DvNdR7gM.js +1 -0
  11. package/web/dist/assets/dropdown-menu-D7f0O7xR.js +1 -0
  12. package/web/dist/assets/{file-preview-oBW4ASBA.js → file-preview-C58stPPw.js} +2 -2
  13. package/web/dist/assets/git-toolbar-Dzp24LO7.js +1 -0
  14. package/web/dist/assets/github-Cn0hlJsH.js +1 -0
  15. package/web/dist/assets/github-sidebar-model-BSNdxNKJ.js +1 -0
  16. package/web/dist/assets/global-activity-route-D5ke1ZQa.js +1 -0
  17. package/web/dist/assets/index-lMBPAedr.js +17 -0
  18. package/web/dist/assets/input-DIwJvCgi.js +1 -0
  19. package/web/dist/assets/{popover-s-Wchzjn.js → popover-N-u5z2xh.js} +1 -1
  20. package/web/dist/assets/preview-pane-connected-Cl-W1pDv.js +3 -0
  21. package/web/dist/assets/repo-git-YYivBJ2x.js +1 -0
  22. package/web/dist/assets/report-reader-gGAlVnKU.js +1 -0
  23. package/web/dist/assets/reports-B_xpuTvK.js +1 -0
  24. package/web/dist/assets/run-header-CxRJxVsR.js +2 -0
  25. package/web/dist/assets/skills-CEFXcZA5.js +1 -0
  26. package/web/dist/assets/skills-DFBiAuJG.js +1 -0
  27. package/web/dist/assets/task-changes-Bm4gjXBb.js +1 -0
  28. package/web/dist/assets/task-commits-DYHV533w.js +1 -0
  29. package/web/dist/assets/task-files-Bqvj0rbX.js +1 -0
  30. package/web/dist/assets/{task-github-item-CDIQvV4G.js → task-github-item-YkTV2--_.js} +1 -1
  31. package/web/dist/assets/{task-thread-DavPe-c1.js → task-thread-CempX7k0.js} +7 -7
  32. package/web/dist/assets/thread-state-BpcneWuV.js +4 -0
  33. package/web/dist/assets/use-hand-to-agent-state-B9qtivFb.js +1 -0
  34. package/web/dist/assets/workflows-z-CqJ0JW.js +7 -0
  35. package/web/dist/index.html +11 -5
  36. package/web/dist/assets/commit-diff-panel-_eayzzg3.js +0 -1
  37. package/web/dist/assets/diff-BZbKoEDq.js +0 -3
  38. package/web/dist/assets/dropdown-menu-CjLqyqwB.js +0 -1
  39. package/web/dist/assets/git-toolbar-C9eP5-IR.js +0 -1
  40. package/web/dist/assets/github-C7eAFy8Z.js +0 -1
  41. package/web/dist/assets/global-activity-route-CudWwf5u.js +0 -1
  42. package/web/dist/assets/index-C2zVqh-_.js +0 -34
  43. package/web/dist/assets/preview-pane-connected-Grs87tzs.js +0 -3
  44. package/web/dist/assets/repo-git-BTHhCxbX.js +0 -1
  45. package/web/dist/assets/report-reader-Cd7xo3WG.js +0 -1
  46. package/web/dist/assets/reports-C9Pv9alE.js +0 -1
  47. package/web/dist/assets/run-header-BdNi5U9a.js +0 -2
  48. package/web/dist/assets/skills-BNyPCfRC.js +0 -1
  49. package/web/dist/assets/task-changes-B8l73QaA.js +0 -1
  50. package/web/dist/assets/task-commits-CYlua3YQ.js +0 -1
  51. package/web/dist/assets/task-files-BRKU94QM.js +0 -1
  52. package/web/dist/assets/thread-state-QXZqjukm.js +0 -4
  53. package/web/dist/assets/use-hand-to-agent-state-B0KY1uOs.js +0 -1
  54. package/web/dist/assets/workflows-B2KHSiUl.js +0 -7
@@ -1,11 +1,11 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{u as t}from"./button-CS5tOblf.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./eye-B8okNWXU.js";import{Xt as a,_r as o,at as s,cn as c,ln as l,lt as u,sn as d}from"./index-C2zVqh-_.js";import{n as f,t as p}from"./image-preview-Dy3o8upo.js";import{n as m,t as h}from"./markdown-BBDDg-4t.js";var g=e(n(),1),_=44;function v(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{u as t}from"./button-CS5tOblf.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./eye-B8okNWXU.js";import{At as a,P as o,R as s,jt as c,kt as l,mn as u,vt as d}from"./index-lMBPAedr.js";import{n as f,t as p}from"./image-preview-Dy3o8upo.js";import{n as m,t as h}from"./markdown-BBDDg-4t.js";var g=e(n(),1),_=44;function v(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
2
2
  `),n=t.findIndex(e=>e.startsWith(`@@`));return n===-1?t.length:t.length-n}function y(e){return v(e)*20+_}function b(e){return e.reduce((e,t)=>e+v(t),0)}function x(e,t){let n=new URLSearchParams(e).get(`diff`);return n===`flat`||n===`virtual`?n:t>1500?`virtual`:`flat`}function S(e){return`${e.oldPath??``}→${e.path}`}function C(e){let t=0;for(let n of e.split(`
3
3
  `))n.length>t&&(t=n.length);return t}var w=/[A-Za-z0-9_]+|\s+|[^\sA-Za-z0-9_]+/g,T=300,E=.3;function D(e,t){if(e===t)return null;let n=e.match(w)??[],r=t.match(w)??[];if(n.length===0||r.length===0||n.length>T||r.length>T)return null;let i=O(n,r),a=r.length+1;return(i[n.length*a+r.length]??0)/Math.max(n.length,r.length)<E?null:k(n,r,i)}function O(e,t){let n=t.length+1,r=new Uint16Array((e.length+1)*n);for(let i=1;i<=e.length;i++)for(let a=1;a<=t.length;a++)r[i*n+a]=e[i-1]===t[a-1]?(r[(i-1)*n+(a-1)]??0)+1:Math.max(r[(i-1)*n+a]??0,r[i*n+(a-1)]??0);return r}function k(e,t,n){let r=t.length+1,i=Array.from({length:e.length},()=>!1),a=Array.from({length:t.length},()=>!1),o=e.length,s=t.length;for(;o>0&&s>0;)e[o-1]===t[s-1]?(i[o-1]=!0,a[s-1]=!0,o--,s--):(n[(o-1)*r+s]??0)>=(n[o*r+(s-1)]??0)?o--:s--;return{del:A(e,i),add:A(t,a)}}function A(e,t){let n=[];return e.forEach((e,r)=>{let i=!(t[r]??!1),a=n[n.length-1];a&&a.changed===i?a.text+=e:n.push({text:e,changed:i})}),n}function j(e,t,n){if(!t||t.length===0)return e?e.map(e=>({text:e.content,color:e.color,changed:!1})):n===``?[]:[{text:n,changed:!1}];if(!e||e.length===0)return t.map(e=>({text:e.text,changed:e.changed}));let r=[],i=0,a=0,o=0,s=0;for(;i<e.length&&o<t.length;){let n=e[i],c=t[o],l=n.content.length-a,u=c.text.length-s,d=Math.min(l,u);d>0&&(r.push({text:n.content.slice(a,a+d),color:n.color,changed:c.changed}),a+=d,s+=d),n.content.length-a<=0&&(i++,a=0),c.text.length-s<=0&&(o++,s=0)}for(;i<e.length;){let t=e[i],n=t.content.slice(a);n!==``&&r.push({text:n,color:t.color,changed:!1}),i++,a=0}return r}var M=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,N=`… (patch truncated)`;function P(e){let t=[],n=!1,r=null,i=0,a=0,o=e.split(`
4
- `);o.at(-1)===``&&o.pop();for(let e of o){let o=M.exec(e);if(o){r={header:e,oldStart:Number(o[1]),oldCount:o[2]===void 0?1:Number(o[2]),newStart:Number(o[3]),newCount:o[4]===void 0?1:Number(o[4]),lines:[]},i=r.oldStart,a=r.newStart,t.push(r);continue}if(e.includes(N)){n=!0,r=null;continue}r&&(e.startsWith(`+`)?r.lines.push({kind:`add`,text:e.slice(1),newLine:a++}):e.startsWith(`-`)?r.lines.push({kind:`del`,text:e.slice(1),oldLine:i++}):e.startsWith(`\\`)||r.lines.push({kind:`context`,text:e.slice(1),oldLine:i++,newLine:a++}))}return{hunks:t,truncated:n}}function F(e,t=!1){let n=[],r=e[0];if(!r)return n;r.newStart>1&&n.push({beforeHunk:0,count:r.newStart-1,oldStart:1,newStart:1});for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t],a=r.oldStart+r.oldCount,o=r.newStart+r.newCount,s=i.newStart-o;s>0&&n.push({beforeHunk:t,count:s,oldStart:a,newStart:o})}if(t){let t=e[e.length-1];n.push({beforeHunk:e.length,oldStart:t.oldStart+t.oldCount,newStart:t.newStart+t.newCount})}return n}function I(e,t){let n=e.count===void 0?t.length:e.newStart+e.count-1,r=e.oldStart-e.newStart,i=[];for(let a=e.newStart;a<=Math.min(n,t.length);a++)i.push({kind:`context`,text:t[a-1]??``,oldLine:a+r,newLine:a});return i}function L(e,t){let n=Array.from({length:e.length}),r=Array.from({length:t.length}),i=Math.min(e.length,t.length);for(let a=0;a<i;a++){let i=D(e[a].text,t[a].text);i&&(n[a]=i.del,r[a]=i.add)}return{dels:e,adds:t,delSpans:n,addSpans:r}}function R(e,t,n){let r=0;for(;r<e.lines.length;){let i=e.lines[r];if(i.kind===`del`||i.kind===`add`){let t=[],i=[];for(;r<e.lines.length&&e.lines[r].kind===`del`;)t.push(e.lines[r++]);for(;r<e.lines.length&&e.lines[r].kind===`add`;)i.push(e.lines[r++]);n(L(t,i))}else t(i),r++}}function z(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`line`,cell:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),R(e,e=>i.push({type:`line`,cell:{line:e}}),e=>{e.dels.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.delSpans[n]}})),e.adds.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.addSpans[n]}}))})}),a(e.length),i}function B(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`pair`,left:{line:e},right:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),R(e,e=>i.push({type:`pair`,left:{line:e},right:{line:e}}),e=>{let t=Math.max(e.dels.length,e.adds.length);for(let n=0;n<t;n++){let t=e.dels[n],r=e.adds[n];i.push({type:`pair`,...t?{left:{line:t,spans:e.delSpans[n]}}:{},...r?{right:{line:r,spans:e.addSpans[n]}}:{}})}})}),a(e.length),i}var V=r();function H({file:e,loadFileText:t,imageSrc:n}){let r=(0,g.useMemo)(()=>U(e),[e]),i=(0,g.useRef)(t);i.current=t;let o=(0,g.useRef)(n);o.current=n;let s=t!==void 0,[c,l]=(0,g.useState)(null);(0,g.useEffect)(()=>{let t=i.current;if(!t)return;let n=!1;return t(e.path).then(t=>!n&&l({path:e.path,text:t}),()=>!n&&l({path:e.path,text:null})),()=>{n=!0}},[e.path,e.patch,s]);let u=(0,g.useCallback)(t=>{let n=o.current,r=n?m(e.path,t):null;return r===null||!n?null:n(r)},[e.path]),d=c?.path===e.path?c:null;if(s&&d===null)return(0,V.jsx)(`p`,{role:`status`,className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Loading preview…`});let f=d?.text??null;if(f===null&&r.text===``)return(0,V.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes to preview.`});let p=f!==null||r.complete?null:s?`The full file could not be loaded. Showing the changed sections only.`:`Showing the changed sections only.`;return(0,V.jsx)(`div`,{"data-slot":`diff-markdown-preview`,className:`px-4 py-5 md:px-6`,children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-[72ch]`,children:[p?(0,V.jsx)(`p`,{className:`mb-4 text-xs text-soft-foreground`,children:p}):null,(0,V.jsx)(a,{document:!0,imageSrc:u,children:f??r.text})]})})}function U(e){let t=P(e.patch);return{text:t.hunks.map(e=>e.lines.filter(e=>e.kind!==`del`).map(e=>e.text).join(`
4
+ `);o.at(-1)===``&&o.pop();for(let e of o){let o=M.exec(e);if(o){r={header:e,oldStart:Number(o[1]),oldCount:o[2]===void 0?1:Number(o[2]),newStart:Number(o[3]),newCount:o[4]===void 0?1:Number(o[4]),lines:[]},i=r.oldStart,a=r.newStart,t.push(r);continue}if(e.includes(N)){n=!0,r=null;continue}r&&(e.startsWith(`+`)?r.lines.push({kind:`add`,text:e.slice(1),newLine:a++}):e.startsWith(`-`)?r.lines.push({kind:`del`,text:e.slice(1),oldLine:i++}):e.startsWith(`\\`)||r.lines.push({kind:`context`,text:e.slice(1),oldLine:i++,newLine:a++}))}return{hunks:t,truncated:n}}function F(e,t=!1){let n=[],r=e[0];if(!r)return n;r.newStart>1&&n.push({beforeHunk:0,count:r.newStart-1,oldStart:1,newStart:1});for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t],a=r.oldStart+r.oldCount,o=r.newStart+r.newCount,s=i.newStart-o;s>0&&n.push({beforeHunk:t,count:s,oldStart:a,newStart:o})}if(t){let t=e[e.length-1];n.push({beforeHunk:e.length,oldStart:t.oldStart+t.oldCount,newStart:t.newStart+t.newCount})}return n}function I(e,t){let n=e.count===void 0?t.length:e.newStart+e.count-1,r=e.oldStart-e.newStart,i=[];for(let a=e.newStart;a<=Math.min(n,t.length);a++)i.push({kind:`context`,text:t[a-1]??``,oldLine:a+r,newLine:a});return i}function L(e,t){let n=Array.from({length:e.length}),r=Array.from({length:t.length}),i=Math.min(e.length,t.length);for(let a=0;a<i;a++){let i=D(e[a].text,t[a].text);i&&(n[a]=i.del,r[a]=i.add)}return{dels:e,adds:t,delSpans:n,addSpans:r}}function R(e,t,n){let r=0;for(;r<e.lines.length;){let i=e.lines[r];if(i.kind===`del`||i.kind===`add`){let t=[],i=[];for(;r<e.lines.length&&e.lines[r].kind===`del`;)t.push(e.lines[r++]);for(;r<e.lines.length&&e.lines[r].kind===`add`;)i.push(e.lines[r++]);n(L(t,i))}else t(i),r++}}function z(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`line`,cell:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),R(e,e=>i.push({type:`line`,cell:{line:e}}),e=>{e.dels.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.delSpans[n]}})),e.adds.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.addSpans[n]}}))})}),a(e.length),i}function B(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`pair`,left:{line:e},right:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),R(e,e=>i.push({type:`pair`,left:{line:e},right:{line:e}}),e=>{let t=Math.max(e.dels.length,e.adds.length);for(let n=0;n<t;n++){let t=e.dels[n],r=e.adds[n];i.push({type:`pair`,...t?{left:{line:t,spans:e.delSpans[n]}}:{},...r?{right:{line:r,spans:e.addSpans[n]}}:{}})}})}),a(e.length),i}var V=r();function H({file:e,loadFileText:t,imageSrc:n}){let r=(0,g.useMemo)(()=>U(e),[e]),i=(0,g.useRef)(t);i.current=t;let a=(0,g.useRef)(n);a.current=n;let o=t!==void 0,[s,c]=(0,g.useState)(null);(0,g.useEffect)(()=>{let t=i.current;if(!t)return;let n=!1;return t(e.path).then(t=>!n&&c({path:e.path,text:t}),()=>!n&&c({path:e.path,text:null})),()=>{n=!0}},[e.path,e.patch,o]);let l=(0,g.useCallback)(t=>{let n=a.current,r=n?m(e.path,t):null;return r===null||!n?null:n(r)},[e.path]),u=s?.path===e.path?s:null;if(o&&u===null)return(0,V.jsx)(`p`,{role:`status`,className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Loading preview…`});let f=u?.text??null;if(f===null&&r.text===``)return(0,V.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes to preview.`});let p=f!==null||r.complete?null:o?`The full file could not be loaded. Showing the changed sections only.`:`Showing the changed sections only.`;return(0,V.jsx)(`div`,{"data-slot":`diff-markdown-preview`,className:`px-4 py-5 md:px-6`,children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-[72ch]`,children:[p?(0,V.jsx)(`p`,{className:`mb-4 text-xs text-soft-foreground`,children:p}):null,(0,V.jsx)(d,{document:!0,imageSrc:l,children:f??r.text})]})})}function U(e){let t=P(e.patch);return{text:t.hunks.map(e=>e.lines.filter(e=>e.kind!==`del`).map(e=>e.text).join(`
5
5
  `)).join(`
6
6
 
7
7
  ---
8
8
 
9
- `),complete:e.status===`added`&&!t.truncated}}var W=1500,G=new Map;function ee(e,t){if(e){for(let n of e.querySelectorAll(`[data-slot="diff-file"]`))if(n.dataset.path===t)return n}}function te({files:e,mode:n=`unified`,wrap:r=!1,preview:i,loadFileText:a,imageSrc:o,onOpenInApp:c,viewRef:l,className:u}){let d=(0,g.useMemo)(()=>({adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length}),[e]),[f,p]=(0,g.useState)(()=>new Set),[m,_]=(0,g.useState)(()=>new Map),[v,C]=(0,g.useState)(()=>new Map),[w,T]=(0,g.useState)(i);w!==i&&(T(i),C(new Map));let E=(0,g.useCallback)((e,t)=>{C(n=>new Map(n).set(e,t))},[]),D=(0,g.useCallback)(e=>{p(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},[]),O=(0,g.useCallback)(async(e,t)=>{if(!a)return;let n=await a(e.path);if(n===null)return;let r=I(t,n.split(`
10
- `));_(n=>{let i=S(e);return new Map(n).set(i,new Map(n.get(i)??G).set(t.beforeHunk,r))})},[a]),k=(0,g.useMemo)(()=>b(e),[e]),[A]=(0,g.useState)(()=>typeof window>`u`?``:window.location.search),j=x(A,k),M=(0,g.useRef)(null),N=(0,g.useRef)(null),P=(0,g.useRef)(null);(0,g.useImperativeHandle)(l,()=>({scrollToPath:t=>{let n=e.findIndex(e=>e.path===t);if(n===-1)return;let r=N.current;r?r.scrollToIndex(n,{align:`start`}):ee(P.current,t)?.scrollIntoView({block:`start`,behavior:`smooth`})}}),[e]);let F=e=>{let t=S(e),s=i!==void 0&&h(e),l=s&&(v.get(t)??i);return(0,V.jsx)(ie,{file:e,open:!f.has(t),onToggle:()=>D(t),preview:l,onPreviewChange:s?e=>E(t,e):void 0,loadFileText:a,expanded:m.get(t)??G,onExpand:t=>void O(e,t),mode:n,wrap:r,canExpand:a!==void 0,imageSrc:o,onOpenInApp:c})};return(0,V.jsxs)(`div`,{ref:e=>{P.current=e,e&&(M.current=e.closest(`[data-slot="main"]`))},"data-slot":`diff`,"data-mode":n,className:t(`flex min-w-0 flex-col`,u),children:[(0,V.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 pb-3 text-xs text-muted-foreground`,children:[(0,V.jsxs)(`span`,{children:[d.files,` `,d.files===1?`file`:`files`,` changed`]}),(0,V.jsx)(s,{stat:d})]}),j===`virtual`?(0,V.jsx)(ne,{files:e,handleRef:N,scrollElRef:M,card:F}):(0,V.jsx)(`div`,{"data-slot":`diff-files`,"data-virtualized":`false`,children:e.map(e=>(0,V.jsx)(`div`,{"data-slot":`diff-file-slot`,style:{containIntrinsicBlockSize:`auto ${y(e)}px`},className:`pb-3 [content-visibility:auto]`,children:F(e)},S(e)))})]})}function ne({files:e,handleRef:t,scrollElRef:n,card:r}){let i=(0,g.useRef)(null),[a,o]=(0,g.useState)(0);return(0,g.useLayoutEffect)(()=>{let e=()=>{let e=i.current,t=n.current;!e||!t||o(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n]),(0,V.jsx)(`div`,{ref:e=>{i.current=e,e&&(n.current=e.closest(`[data-slot="main"]`))},"data-slot":`diff-files`,"data-virtualized":`true`,children:(0,V.jsx)(u,{ref:t,scrollRef:n,startMargin:a,children:e.map(e=>(0,V.jsx)(`div`,{"data-slot":`diff-file-slot`,className:`pb-3`,children:r(e)},S(e)))})})}var re={added:`added`,deleted:`deleted`,renamed:`renamed`,copied:`copied`};function ie({file:e,open:n,onToggle:r,expanded:a,onExpand:c,mode:l,wrap:u,preview:d,onPreviewChange:f,loadFileText:p,canExpand:m,imageSrc:h,onOpenInApp:g}){let _=re[e.status];return(0,V.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,V.jsxs)(`header`,{className:`sticky top-[var(--diff-sticky-top,0px)] z-10 flex items-center rounded-t-md border-b border-border/50 bg-card`,children:[(0,V.jsxs)(`button`,{type:`button`,"data-slot":`diff-file-header`,"aria-expanded":n,onClick:r,className:`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,V.jsx)(o,{className:t(`size-3.5 shrink-0 text-soft-foreground transition-transform`,n&&`rotate-90`),"aria-hidden":`true`}),(0,V.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),_?(0,V.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:_}):null,e.image?(0,V.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:`image`}):e.binary?(0,V.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:`binary`}):null,(0,V.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,V.jsx)(s,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),f?(0,V.jsxs)(`button`,{type:`button`,"data-slot":`diff-file-preview-toggle`,"aria-pressed":d,"aria-label":`Preview ${e.path} as a document`,title:d?`Show this file as a diff`:`Preview this file as a document`,onClick:()=>f(!d),className:t(`mr-1.5 inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-[12px] font-medium max-md:h-11 max-md:px-3 pointer-coarse:h-11 pointer-coarse:px-3`,`focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring`,d?`bg-muted text-foreground`:`text-soft-foreground hover:bg-muted/50 hover:text-foreground`),children:[(0,V.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),`Preview`]}):null]}),n&&d?(0,V.jsx)(H,{file:e,loadFileText:p,imageSrc:h}):n?(0,V.jsx)(ae,{file:e,expanded:a,onExpand:c,mode:l,wrap:u,canExpand:m,imageSrc:h,onOpenInApp:g}):null]})}function ae({file:e,expanded:n,onExpand:r,mode:i,wrap:a,canExpand:o,imageSrc:s,onOpenInApp:c}){let l=(0,g.useMemo)(()=>P(e.patch),[e.patch]),u=o&&e.status!==`added`&&e.status!==`deleted`,d=(0,g.useMemo)(()=>F(l.hunks,u),[l.hunks,u]),m=(0,g.useMemo)(()=>{let e=[];l.hunks.forEach((t,r)=>{let i=n.get(r);i&&e.push(...i),e.push(...t.lines)});let t=n.get(l.hunks.length);return t&&e.push(...t),e},[l.hunks,n]),h=(0,g.useMemo)(()=>new Map(m.map((e,t)=>[e,t])),[m]),_=oe(e.path,m),v=(0,g.useMemo)(()=>i===`unified`?z(l.hunks,d,n):null,[i,l.hunks,d,n]),y=(0,g.useMemo)(()=>i===`split`?B(l.hunks,d,n):null,[i,l.hunks,d,n]),b=(0,g.useMemo)(()=>i===`unified`&&!a?{minInlineSize:`calc(${C(e.patch)}ch + 7rem)`}:void 0,[i,a,e.patch]);if(f(e))return(0,V.jsx)(p,{file:e,imageSrc:s,onOpenInApp:c});if(e.binary)return(0,V.jsx)(K,{children:`Binary file — no text diff.`});if(l.hunks.length===0)return(0,V.jsx)(K,{children:l.truncated?`Patch truncated by the server.`:`No content changes (metadata only).`});let x=e=>{if(!_)return null;let t=h.get(e);return t===void 0?null:_[t]??null};return(0,V.jsxs)(`div`,{"data-slot":`diff-file-body`,"data-wrap":a||void 0,className:t(`py-1 font-mono text-xs leading-[1.7]`,!a&&`overflow-x-auto`),children:[(0,V.jsxs)(`div`,{"data-slot":`diff-rows`,style:b,className:`[&>*]:[contain-intrinsic-block-size:auto_20px] [&>*]:[content-visibility:auto]`,children:[v?v.map((e,t)=>(0,V.jsx)(se,{row:e,wrap:a,tokensFor:x,onExpand:u?r:void 0},t)):null,y?y.map((e,t)=>(0,V.jsx)(ce,{row:e,wrap:a,tokensFor:x,onExpand:u?r:void 0},t)):null]}),l.truncated?(0,V.jsx)(K,{children:`Patch truncated by the server — counts above remain exact.`}):null]})}function oe(e,t){let n=(0,g.useMemo)(()=>t.length>W?null:t.map(e=>e.text).join(`
11
- `),[t]),r=(0,g.useMemo)(()=>l(e),[e]),[i,a]=(0,g.useState)(null);return(0,g.useEffect)(()=>{if(n===null||r===null)return;let e=!1;return d(n,r).then(t=>{e||a({text:n,tokens:t.tokens})}),()=>{e=!0}},[n,r]),n===null||r===null?null:i?.text===n?i.tokens:c(n,r)?.tokens??null}function K({children:e}){return(0,V.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:e})}var q={add:`bg-diff-add`,del:`bg-diff-del`,context:void 0},J={add:`+`,del:`−`,context:` `};function Y({hunk:e}){return(0,V.jsx)(`div`,{"data-slot":`diff-hunk`,className:`bg-muted/40 px-4 py-0.5 whitespace-pre text-soft-foreground`,children:e.header})}function X({gap:e,onExpand:t}){let n=e.count===void 0?`⋯ unchanged lines to end of file`:`⋯ ${e.count} unchanged ${e.count===1?`line`:`lines`}`;return t?(0,V.jsxs)(`button`,{type:`button`,"data-slot":`diff-gap`,onClick:()=>t(e),className:`block w-full border-y border-border/40 bg-muted/20 px-4 py-0.5 text-left text-[11px] text-soft-foreground hover:bg-muted/50 hover:text-foreground`,children:[n,` — expand`]}):(0,V.jsx)(`div`,{"data-slot":`diff-gap`,className:`border-y border-border/40 bg-muted/20 px-4 py-0.5 text-[11px] text-soft-foreground`,children:n})}function Z({cell:e,tokens:n,wrap:r}){let i=j(n,e.spans,e.line.text),a=e.line.kind===`add`?`bg-diff-add-strong`:`bg-diff-del-strong`;return(0,V.jsxs)(`span`,{className:t(`min-w-0 flex-1 pr-4`,r?`break-words whitespace-pre-wrap`:`whitespace-pre`),children:[i.map((n,r)=>(0,V.jsx)(`span`,{"data-word":n.changed?e.line.kind:void 0,style:n.color===void 0?void 0:{color:n.color},className:n.changed?t(`rounded-[2px]`,a):void 0,children:n.text},r)),e.line.text===``?` `:``]})}function Q({value:e}){return(0,V.jsx)(`span`,{className:`w-10 shrink-0 pr-2 text-right text-soft-foreground/70 tabular-nums select-none`,children:e??``})}function se({row:e,wrap:n,tokensFor:r,onExpand:i}){if(e.type===`hunk`)return(0,V.jsx)(Y,{hunk:e.hunk});if(e.type===`gap`)return(0,V.jsx)(X,{gap:e.gap,onExpand:i});let{line:a}=e.cell;return(0,V.jsxs)(`div`,{"data-slot":`diff-line`,"data-line":a.kind,className:t(`flex`,q[a.kind]),children:[(0,V.jsx)(Q,{value:a.oldLine}),(0,V.jsx)(Q,{value:a.newLine}),(0,V.jsx)(`span`,{className:`w-4 shrink-0 text-soft-foreground select-none`,children:J[a.kind]}),(0,V.jsx)(Z,{cell:e.cell,tokens:r(a),wrap:n})]})}function ce({row:e,wrap:t,tokensFor:n,onExpand:r}){return e.type===`hunk`?(0,V.jsx)(Y,{hunk:e.hunk}):e.type===`gap`?(0,V.jsx)(X,{gap:e.gap,onExpand:r}):(0,V.jsxs)(`div`,{"data-slot":`diff-pair`,className:`grid grid-cols-2`,children:[(0,V.jsx)($,{cell:e.left,side:`old`,tokensFor:n,wrap:t}),(0,V.jsx)($,{cell:e.right,side:`new`,tokensFor:n,wrap:t})]})}function $({cell:e,side:n,tokensFor:r,wrap:i}){if(!e)return(0,V.jsx)(`div`,{"data-slot":`diff-cell-empty`,className:t(`bg-muted/20`,n===`new`&&`border-l border-border/40`)});let{line:a}=e;return(0,V.jsxs)(`div`,{"data-slot":`diff-cell`,"data-line":a.kind,className:t(`flex min-w-0 overflow-x-auto`,q[a.kind],n===`new`&&`border-l border-border/40`),children:[(0,V.jsx)(Q,{value:n===`old`?a.oldLine:a.newLine}),(0,V.jsx)(`span`,{className:`w-4 shrink-0 text-soft-foreground select-none`,children:J[a.kind]}),(0,V.jsx)(Z,{cell:e,tokens:r(a),wrap:i})]})}export{te as DiffView};
9
+ `),complete:e.status===`added`&&!t.truncated}}var W=1500,G=new Map;function ee(e,t){if(e){for(let n of e.querySelectorAll(`[data-slot="diff-file"]`))if(n.dataset.path===t)return n}}function te({files:e,mode:n=`unified`,wrap:r=!1,preview:i,loadFileText:a,imageSrc:s,onOpenInApp:c,viewRef:l,className:u}){let d=(0,g.useMemo)(()=>({adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length}),[e]),[f,p]=(0,g.useState)(()=>new Set),[m,_]=(0,g.useState)(()=>new Map),[v,C]=(0,g.useState)(()=>new Map),[w,T]=(0,g.useState)(i);w!==i&&(T(i),C(new Map));let E=(0,g.useCallback)((e,t)=>{C(n=>new Map(n).set(e,t))},[]),D=(0,g.useCallback)(e=>{p(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},[]),O=(0,g.useCallback)(async(e,t)=>{if(!a)return;let n=await a(e.path);if(n===null)return;let r=I(t,n.split(`
10
+ `));_(n=>{let i=S(e);return new Map(n).set(i,new Map(n.get(i)??G).set(t.beforeHunk,r))})},[a]),k=(0,g.useMemo)(()=>b(e),[e]),[A]=(0,g.useState)(()=>typeof window>`u`?``:window.location.search),j=x(A,k),M=(0,g.useRef)(null),N=(0,g.useRef)(null),P=(0,g.useRef)(null);(0,g.useImperativeHandle)(l,()=>({scrollToPath:t=>{let n=e.findIndex(e=>e.path===t);if(n===-1)return;let r=N.current;r?r.scrollToIndex(n,{align:`start`}):ee(P.current,t)?.scrollIntoView({block:`start`,behavior:`smooth`})}}),[e]);let F=e=>{let t=S(e),o=i!==void 0&&h(e),l=o&&(v.get(t)??i);return(0,V.jsx)(ie,{file:e,open:!f.has(t),onToggle:()=>D(t),preview:l,onPreviewChange:o?e=>E(t,e):void 0,loadFileText:a,expanded:m.get(t)??G,onExpand:t=>void O(e,t),mode:n,wrap:r,canExpand:a!==void 0,imageSrc:s,onOpenInApp:c})};return(0,V.jsxs)(`div`,{ref:e=>{P.current=e,e&&(M.current=e.closest(`[data-slot="main"]`))},"data-slot":`diff`,"data-mode":n,className:t(`flex min-w-0 flex-col`,u),children:[(0,V.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 pb-3 text-xs text-muted-foreground`,children:[(0,V.jsxs)(`span`,{children:[d.files,` `,d.files===1?`file`:`files`,` changed`]}),(0,V.jsx)(o,{stat:d})]}),j===`virtual`?(0,V.jsx)(ne,{files:e,handleRef:N,scrollElRef:M,card:F}):(0,V.jsx)(`div`,{"data-slot":`diff-files`,"data-virtualized":`false`,children:e.map(e=>(0,V.jsx)(`div`,{"data-slot":`diff-file-slot`,style:{containIntrinsicBlockSize:`auto ${y(e)}px`},className:`pb-3 [content-visibility:auto]`,children:F(e)},S(e)))})]})}function ne({files:e,handleRef:t,scrollElRef:n,card:r}){let i=(0,g.useRef)(null),[a,o]=(0,g.useState)(0);return(0,g.useLayoutEffect)(()=>{let e=()=>{let e=i.current,t=n.current;!e||!t||o(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n]),(0,V.jsx)(`div`,{ref:e=>{i.current=e,e&&(n.current=e.closest(`[data-slot="main"]`))},"data-slot":`diff-files`,"data-virtualized":`true`,children:(0,V.jsx)(s,{ref:t,scrollRef:n,startMargin:a,children:e.map(e=>(0,V.jsx)(`div`,{"data-slot":`diff-file-slot`,className:`pb-3`,children:r(e)},S(e)))})})}var re={added:`added`,deleted:`deleted`,renamed:`renamed`,copied:`copied`};function ie({file:e,open:n,onToggle:r,expanded:a,onExpand:s,mode:c,wrap:l,preview:d,onPreviewChange:f,loadFileText:p,canExpand:m,imageSrc:h,onOpenInApp:g}){let _=re[e.status];return(0,V.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,V.jsxs)(`header`,{className:`sticky top-[var(--diff-sticky-top,0px)] z-10 flex items-center rounded-t-md border-b border-border/50 bg-card`,children:[(0,V.jsxs)(`button`,{type:`button`,"data-slot":`diff-file-header`,"aria-expanded":n,onClick:r,className:`flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,V.jsx)(u,{className:t(`size-3.5 shrink-0 text-soft-foreground transition-transform`,n&&`rotate-90`),"aria-hidden":`true`}),(0,V.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),_?(0,V.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:_}):null,e.image?(0,V.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:`image`}):e.binary?(0,V.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[12px] font-medium text-muted-foreground`,children:`binary`}):null,(0,V.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,V.jsx)(o,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),f?(0,V.jsxs)(`button`,{type:`button`,"data-slot":`diff-file-preview-toggle`,"aria-pressed":d,"aria-label":`Preview ${e.path} as a document`,title:d?`Show this file as a diff`:`Preview this file as a document`,onClick:()=>f(!d),className:t(`mr-1.5 inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-[12px] font-medium max-md:h-11 max-md:px-3 pointer-coarse:h-11 pointer-coarse:px-3`,`focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-ring`,d?`bg-muted text-foreground`:`text-soft-foreground hover:bg-muted/50 hover:text-foreground`),children:[(0,V.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),`Preview`]}):null]}),n&&d?(0,V.jsx)(H,{file:e,loadFileText:p,imageSrc:h}):n?(0,V.jsx)(ae,{file:e,expanded:a,onExpand:s,mode:c,wrap:l,canExpand:m,imageSrc:h,onOpenInApp:g}):null]})}function ae({file:e,expanded:n,onExpand:r,mode:i,wrap:a,canExpand:o,imageSrc:s,onOpenInApp:c}){let l=(0,g.useMemo)(()=>P(e.patch),[e.patch]),u=o&&e.status!==`added`&&e.status!==`deleted`,d=(0,g.useMemo)(()=>F(l.hunks,u),[l.hunks,u]),m=(0,g.useMemo)(()=>{let e=[];l.hunks.forEach((t,r)=>{let i=n.get(r);i&&e.push(...i),e.push(...t.lines)});let t=n.get(l.hunks.length);return t&&e.push(...t),e},[l.hunks,n]),h=(0,g.useMemo)(()=>new Map(m.map((e,t)=>[e,t])),[m]),_=oe(e.path,m),v=(0,g.useMemo)(()=>i===`unified`?z(l.hunks,d,n):null,[i,l.hunks,d,n]),y=(0,g.useMemo)(()=>i===`split`?B(l.hunks,d,n):null,[i,l.hunks,d,n]),b=(0,g.useMemo)(()=>i===`unified`&&!a?{minInlineSize:`calc(${C(e.patch)}ch + 7rem)`}:void 0,[i,a,e.patch]);if(f(e))return(0,V.jsx)(p,{file:e,imageSrc:s,onOpenInApp:c});if(e.binary)return(0,V.jsx)(K,{children:`Binary file — no text diff.`});if(l.hunks.length===0)return(0,V.jsx)(K,{children:l.truncated?`Patch truncated by the server.`:`No content changes (metadata only).`});let x=e=>{if(!_)return null;let t=h.get(e);return t===void 0?null:_[t]??null};return(0,V.jsxs)(`div`,{"data-slot":`diff-file-body`,"data-wrap":a||void 0,className:t(`py-1 font-mono text-xs leading-[1.7]`,!a&&`overflow-x-auto`),children:[(0,V.jsxs)(`div`,{"data-slot":`diff-rows`,style:b,className:`[&>*]:[contain-intrinsic-block-size:auto_20px] [&>*]:[content-visibility:auto]`,children:[v?v.map((e,t)=>(0,V.jsx)(se,{row:e,wrap:a,tokensFor:x,onExpand:u?r:void 0},t)):null,y?y.map((e,t)=>(0,V.jsx)(ce,{row:e,wrap:a,tokensFor:x,onExpand:u?r:void 0},t)):null]}),l.truncated?(0,V.jsx)(K,{children:`Patch truncated by the server — counts above remain exact.`}):null]})}function oe(e,t){let n=(0,g.useMemo)(()=>t.length>W?null:t.map(e=>e.text).join(`
11
+ `),[t]),r=(0,g.useMemo)(()=>c(e),[e]),[i,o]=(0,g.useState)(null);return(0,g.useEffect)(()=>{if(n===null||r===null)return;let e=!1;return l(n,r).then(t=>{e||o({text:n,tokens:t.tokens})}),()=>{e=!0}},[n,r]),n===null||r===null?null:i?.text===n?i.tokens:a(n,r)?.tokens??null}function K({children:e}){return(0,V.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:e})}var q={add:`bg-diff-add`,del:`bg-diff-del`,context:void 0},J={add:`+`,del:`−`,context:` `};function Y({hunk:e}){return(0,V.jsx)(`div`,{"data-slot":`diff-hunk`,className:`bg-muted/40 px-4 py-0.5 whitespace-pre text-soft-foreground`,children:e.header})}function X({gap:e,onExpand:t}){let n=e.count===void 0?`⋯ unchanged lines to end of file`:`⋯ ${e.count} unchanged ${e.count===1?`line`:`lines`}`;return t?(0,V.jsxs)(`button`,{type:`button`,"data-slot":`diff-gap`,onClick:()=>t(e),className:`block w-full border-y border-border/40 bg-muted/20 px-4 py-0.5 text-left text-[11px] text-soft-foreground hover:bg-muted/50 hover:text-foreground`,children:[n,` — expand`]}):(0,V.jsx)(`div`,{"data-slot":`diff-gap`,className:`border-y border-border/40 bg-muted/20 px-4 py-0.5 text-[11px] text-soft-foreground`,children:n})}function Z({cell:e,tokens:n,wrap:r}){let i=j(n,e.spans,e.line.text),a=e.line.kind===`add`?`bg-diff-add-strong`:`bg-diff-del-strong`;return(0,V.jsxs)(`span`,{className:t(`min-w-0 flex-1 pr-4`,r?`break-words whitespace-pre-wrap`:`whitespace-pre`),children:[i.map((n,r)=>(0,V.jsx)(`span`,{"data-word":n.changed?e.line.kind:void 0,style:n.color===void 0?void 0:{color:n.color},className:n.changed?t(`rounded-[2px]`,a):void 0,children:n.text},r)),e.line.text===``?` `:``]})}function Q({value:e}){return(0,V.jsx)(`span`,{className:`w-10 shrink-0 pr-2 text-right text-soft-foreground/70 tabular-nums select-none`,children:e??``})}function se({row:e,wrap:n,tokensFor:r,onExpand:i}){if(e.type===`hunk`)return(0,V.jsx)(Y,{hunk:e.hunk});if(e.type===`gap`)return(0,V.jsx)(X,{gap:e.gap,onExpand:i});let{line:a}=e.cell;return(0,V.jsxs)(`div`,{"data-slot":`diff-line`,"data-line":a.kind,className:t(`flex`,q[a.kind]),children:[(0,V.jsx)(Q,{value:a.oldLine}),(0,V.jsx)(Q,{value:a.newLine}),(0,V.jsx)(`span`,{className:`w-4 shrink-0 text-soft-foreground select-none`,children:J[a.kind]}),(0,V.jsx)(Z,{cell:e.cell,tokens:r(a),wrap:n})]})}function ce({row:e,wrap:t,tokensFor:n,onExpand:r}){return e.type===`hunk`?(0,V.jsx)(Y,{hunk:e.hunk}):e.type===`gap`?(0,V.jsx)(X,{gap:e.gap,onExpand:r}):(0,V.jsxs)(`div`,{"data-slot":`diff-pair`,className:`grid grid-cols-2`,children:[(0,V.jsx)($,{cell:e.left,side:`old`,tokensFor:n,wrap:t}),(0,V.jsx)($,{cell:e.right,side:`new`,tokensFor:n,wrap:t})]})}function $({cell:e,side:n,tokensFor:r,wrap:i}){if(!e)return(0,V.jsx)(`div`,{"data-slot":`diff-cell-empty`,className:t(`bg-muted/20`,n===`new`&&`border-l border-border/40`)});let{line:a}=e;return(0,V.jsxs)(`div`,{"data-slot":`diff-cell`,"data-line":a.kind,className:t(`flex min-w-0 overflow-x-auto`,q[a.kind],n===`new`&&`border-l border-border/40`),children:[(0,V.jsx)(Q,{value:n===`old`?a.oldLine:a.newLine}),(0,V.jsx)(`span`,{className:`w-4 shrink-0 text-soft-foreground select-none`,children:J[a.kind]}),(0,V.jsx)(Z,{cell:e,tokens:r(a),wrap:i})]})}export{te as DiffView};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{f as n}from"./es2015-CX0rgbM5.js";var r=e(t(),1);function i(e){let[t,i]=r.useState(void 0);return n(()=>{if(e){i({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let n=t[0],r,a;if(`borderBoxSize`in n){let e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,a=t.blockSize}else r=e.offsetWidth,a=e.offsetHeight;i({width:r,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else i(void 0)},[e]),t}export{i as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,l as n,s as r,u as i}from"./button-CS5tOblf.js";import{i as a,r as o,t as s}from"./react-runtime-CCIEwYL0.js";import{d as c,h as l,l as u}from"./design-icons-DmYTv2r1.js";import{a as d,c as f,d as p,f as m,g as h,h as g,i as _,l as v,m as y,n as b,o as x,p as S,r as C,t as w,u as T}from"./es2015-CX0rgbM5.js";import{t as E}from"./dist-DvNdR7gM.js";var D=e(a(),1),O=s();function k(e){let n=e+`CollectionProvider`,[i,a]=y(n),[o,s]=i(n,{collectionRef:{current:null},itemMap:new Map}),c=e=>{let{scope:t,children:n}=e,r=D.useRef(null),i=D.useRef(new Map).current;return(0,O.jsx)(o,{scope:t,itemMap:i,collectionRef:r,children:n})};c.displayName=n;let l=e+`CollectionSlot`,u=t(l),d=D.forwardRef((e,t)=>{let{scope:n,children:i}=e,a=r(t,s(l,n).collectionRef);return(0,O.jsx)(u,{ref:a,children:i})});d.displayName=l;let f=e+`CollectionItemSlot`,p=`data-radix-collection-item`,m=t(f),h=D.forwardRef((e,t)=>{let{scope:n,children:i,...a}=e,o=D.useRef(null),c=r(t,o),l=s(f,n);return D.useEffect(()=>(l.itemMap.set(o,{ref:o,...a}),()=>void l.itemMap.delete(o))),(0,O.jsx)(m,{[p]:``,ref:c,children:i})});h.displayName=f;function g(t){let n=s(e+`CollectionConsumer`,t);return D.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${p}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:c,Slot:d,ItemSlot:h},g,a]}var A=D.createContext(void 0);function j(e){let t=D.useContext(A);return e||t||`ltr`}var M=[`top`,`right`,`bottom`,`left`],N=Math.min,P=Math.max,F=Math.round,I=Math.floor,L=e=>({x:e,y:e}),ee={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function te(e,t,n){return P(e,N(t,n))}function R(e,t){return typeof e==`function`?e(t):e}function z(e){return e.split(`-`)[0]}function B(e){return e.split(`-`)[1]}function ne(e){return e===`x`?`y`:`x`}function re(e){return e===`y`?`height`:`width`}function V(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ie(e){return ne(V(e))}function ae(e,t,n){n===void 0&&(n=!1);let r=B(e),i=ie(e),a=re(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=me(o)),[o,me(o)]}function oe(e){let t=me(e);return[se(e),t,se(t)]}function se(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var ce=[`left`,`right`],le=[`right`,`left`],ue=[`top`,`bottom`],de=[`bottom`,`top`];function fe(e,t,n){switch(e){case`top`:case`bottom`:return n?t?le:ce:t?ce:le;case`left`:case`right`:return t?ue:de;default:return[]}}function pe(e,t,n,r){let i=B(e),a=fe(z(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(se)))),a}function me(e){let t=z(e);return ee[t]+e.slice(t.length)}function he(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ge(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:he(e)}function _e(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ve(e,t,n){let{reference:r,floating:i}=e,a=V(t),o=ie(t),s=re(o),c=z(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=B(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function ye(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=R(t,e),p=ge(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=_e(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=_e(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var be=50,xe=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:ye},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ve(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<be&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ve(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Se=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=R(e,t)||{};if(l==null)return{};let d=ge(u),f={x:n,y:r},p=ie(i),m=re(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=N(d[_],T),D=N(d[v],T),O=C-h[m]-D,k=C/2-h[m]/2+w,A=te(E,k,O),j=!c.arrow&&B(i)!=null&&k!==A&&a.reference[m]/2-(k<E?E:D)-h[m]/2<0,M=j?k<E?k-E:k-O:0;return{[p]:f[p]+M,data:{[p]:A,centerOffset:k-A-M,...j&&{alignmentOffset:M}},reset:j}}}),Ce=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=R(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=z(r),_=V(o),v=z(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[me(o)]:oe(o)),x=p!==`none`;!d&&x&&b.push(...pe(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ae(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==V(t))||T.every(e=>V(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=V(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function we(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Te(e){return M.some(t=>e[t]>=0)}var Ee=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=R(e,t);switch(i){case`referenceHidden`:{let e=we(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Te(e)}}}case`escaped`:{let e=we(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Te(e)}}}default:return{}}}}},De=new Set([`left`,`top`]);async function Oe(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=z(n),s=B(n),c=V(n)===`y`,l=De.has(o)?-1:1,u=a&&c?-1:1,d=R(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ke=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Oe(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ae=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=R(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=V(i),p=ne(f),m=u[p],h=u[f],g=(e,t)=>te(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},je=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=R(e,t),u={x:n,y:r},d=V(i),f=ne(d),p=u[f],m=u[d],h=R(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=De.has(z(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Me=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=R(e,t),c=await i.detectOverflow(t,s),l=z(n),u=B(n),d=V(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=N(p-c[m],g),y=N(f-c[h],_),b=t.middlewareData.shift,x=!b,S=v,C=y;b!=null&&b.enabled.x&&(C=_),b!=null&&b.enabled.y&&(S=g),x&&!u&&(d?C=f-2*P(c.left,c.right):S=p-2*P(c.top,c.bottom)),await o({...t,availableWidth:C,availableHeight:S});let w=await i.getDimensions(a.floating);return f!==w.width||p!==w.height?{reset:{rects:!0}}:{}}}};function Ne(){return typeof window<`u`}function Pe(e){return Fe(e)?(e.nodeName||``).toLowerCase():`#document`}function H(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function U(e){return((Fe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Fe(e){return Ne()?e instanceof Node||e instanceof H(e).Node:!1}function W(e){return Ne()?e instanceof Element||e instanceof H(e).Element:!1}function G(e){return Ne()?e instanceof HTMLElement||e instanceof H(e).HTMLElement:!1}function Ie(e){return!Ne()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof H(e).ShadowRoot}function Le(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=q(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Re(e){return/^(table|td|th)$/.test(Pe(e))}function ze(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Be=/transform|translate|scale|rotate|perspective|filter/,Ve=/paint|layout|strict|content/,K=e=>!!e&&e!==`none`,He;function Ue(e){let t=W(e)?q(e):e;return K(t.transform)||K(t.translate)||K(t.scale)||K(t.rotate)||K(t.perspective)||!Ge()&&(K(t.backdropFilter)||K(t.filter))||Be.test(t.willChange||``)||Ve.test(t.contain||``)}function We(e){let t=J(e);for(;G(t)&&!Ke(t);){if(Ue(t))return t;if(ze(t))return null;t=J(t)}return null}function Ge(){return He??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),He}function Ke(e){return/^(html|body|#document)$/.test(Pe(e))}function q(e){return H(e).getComputedStyle(e)}function qe(e){return W(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function J(e){if(Pe(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ie(e)&&e.host||U(e);return Ie(t)?t.host:t}function Je(e){let t=J(e);return Ke(t)?(e.ownerDocument||e).body:G(t)&&Le(t)?t:Je(t)}function Ye(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Je(e),i=r===e.ownerDocument?.body,a=H(r);if(i){let e=Xe(a);return t.concat(a,a.visualViewport||[],Le(r)?r:[],e&&n?Ye(e):[])}else return t.concat(r,Ye(r,[],n))}function Xe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ze(e){let t=q(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=G(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=F(n)!==a||F(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Qe(e){return W(e)?e:e.contextElement}function $e(e){let t=Qe(e);if(!G(t))return L(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ze(t),o=(a?F(n.width):n.width)/r,s=(a?F(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var et=L(0);function tt(e){let t=H(e);return!Ge()||!t.visualViewport?et:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function nt(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===H(e)}function Y(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Qe(e),o=L(1);t&&(r?W(r)&&(o=$e(r)):o=$e(e));let s=nt(a,n,r)?tt(a):L(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=H(a),t=W(r)?H(r):r,n=e,i=Xe(n);for(;i&&t!==n;){let e=$e(i),t=i.getBoundingClientRect(),r=q(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=H(i),i=Xe(n)}}return _e({width:u,height:d,x:c,y:l})}function rt(e,t){let n=qe(e).scrollLeft;return t?t.left+n:Y(U(e)).left+n}function it(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-rt(e,n),y:n.top+t.scrollTop}}function at(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=U(r),s=t?ze(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=L(1),u=L(0),d=G(r);if((d||!a)&&((Pe(r)!==`body`||Le(o))&&(c=qe(r)),d)){let e=Y(r);l=$e(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?it(o,c):L(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function ot(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function st(e){let t=qe(e),n=e.ownerDocument.body,r=P(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=P(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+rt(e),o=-t.scrollTop;return q(n).direction===`rtl`&&(a+=P(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var ct=25;function lt(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=H(e),a=U(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Ge()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(rt(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=ct&&(s-=o)}return{width:s,height:c,x:l,y:u}}function ut(e,t){let n=Y(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=$e(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function dt(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=lt(e,n,t);else if(t===`document`)r=st(U(e));else if(W(t))r=ut(t,n);else{let n=tt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return _e(r)}function ft(e,t){let n=t.get(e);if(n)return n;let r=Ye(e,[],!1).filter(e=>W(e)&&Pe(e)!==`body`),i=null,a=q(e).position===`fixed`,o=a?J(e):e;for(;W(o)&&!Ke(o);){let e=q(o),t=Ue(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=J(o)}return t.set(e,r),r}function pt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ze(t)?[]:ft(t,this._c):[].concat(n),r],o=dt(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=dt(t,a[e],i);s=P(n.top,s),c=N(n.right,c),l=N(n.bottom,l),u=P(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function mt(e){let{width:t,height:n}=Ze(e);return{width:t,height:n}}function ht(e,t,n){let r=G(t),i=U(t),a=n===`fixed`,o=Y(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=L(0);if((r||!a)&&((Pe(t)!==`body`||Le(i))&&(s=qe(t)),r)){let e=Y(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=rt(i));let l=i&&!r&&!a?it(i,s):L(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function gt(e){return q(e).position===`static`}function _t(e,t){if(!G(e)||q(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return U(e)===n&&(n=n.ownerDocument.body),n}function vt(e,t){let n=H(e);if(ze(e))return n;if(!G(e)){let t=J(e);for(;t&&!Ke(t);){if(W(t)&&!gt(t))return t;t=J(t)}return n}let r=_t(e,t);for(;r&&Re(r)&&gt(r);)r=_t(r,t);return r&&Ke(r)&&gt(r)&&!Ue(r)?n:r||We(e)||n}var yt=async function(e){let t=this.getOffsetParent||vt,n=this.getDimensions,r=await n(e.floating);return{reference:ht(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function bt(e){return q(e).direction===`rtl`}var xt={convertOffsetParentRelativeRectToViewportRelativeRect:at,getDocumentElement:U,getClippingRect:pt,getOffsetParent:vt,getElementRects:yt,getClientRects:ot,getDimensions:mt,getScale:$e,isElement:W,isRTL:bt};function St(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ct(e,t,n){let r=null,i,a=U(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=I(d),h=I(a.clientWidth-(u+f)),g=I(a.clientHeight-(d+p)),_=I(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:P(0,N(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(!St(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(b,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(b,v)}r.observe(e)}let c=H(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function wt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Qe(e),u=i||a?[...l?Ye(l):[],...t?Ye(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?Ct(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Y(e):null;c&&g();function g(){let t=Y(e);h&&!St(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Tt=ke,Et=Ae,Dt=Ce,Ot=Me,kt=Ee,At=Se,jt=je,Mt=(e,t,n)=>{let r=new Map,i=n??{},a={...xt,...i.platform,_c:r};return xe(e,t,{...i,platform:a})},Nt=e(o(),1),Pt=typeof document<`u`?D.useLayoutEffect:function(){};function Ft(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ft(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ft(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function It(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Lt(e,t){let n=It(e);return Math.round(t*n)/n}function Rt(e){let t=D.useRef(e);return Pt(()=>{t.current=e}),t}function zt(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=D.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=D.useState(r);Ft(f,r)||p(r);let[m,h]=D.useState(null),[g,_]=D.useState(null),v=D.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=D.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=D.useRef(null),C=D.useRef(null),w=D.useRef(u),T=c!=null,E=Rt(c),O=Rt(i),k=Rt(l),A=D.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),Mt(S.current,C.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!Ft(w.current,t)&&(w.current=t,Nt.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);Pt(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=D.useRef(!1);Pt(()=>(j.current=!0,()=>{j.current=!1}),[]),Pt(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,A);A()}},[b,x,A,E,T]);let M=D.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),N=D.useMemo(()=>({reference:b,floating:x}),[b,x]),P=D.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=Lt(N.floating,u.x),r=Lt(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...It(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return D.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var Bt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:At({element:r.current,padding:i}).fn(n):r?At({element:r,padding:i}).fn(n):{}}}},Vt=(e,t)=>{let n=Tt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ht=(e,t)=>{let n=Et(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ut=(e,t)=>({fn:jt(e).fn,options:[e,t]}),Wt=(e,t)=>{let n=Dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Gt=(e,t)=>{let n=Ot(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kt=(e,t)=>{let n=kt(e);return{name:n.name,fn:n.fn,options:[e,t]}},qt=(e,t)=>{let n=Bt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jt=`Arrow`,Yt=D.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,O.jsx)(g.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,O.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Yt.displayName=Jt;var Xt=Yt,Zt=`Popper`,[Qt,$t]=y(Zt),[en,tn]=Qt(Zt),nn=e=>{let{__scopePopper:t,children:n}=e,[r,i]=D.useState(null),[a,o]=D.useState(void 0);return(0,O.jsx)(en,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};nn.displayName=Zt;var rn=`PopperAnchor`,an=D.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:i,...a}=e,o=tn(rn,n),s=D.useRef(null),c=o.onAnchorChange,l=r(t,D.useCallback(e=>{s.current=e,e&&c(e)},[c])),u=D.useRef(null);D.useEffect(()=>{if(!i)return;let e=u.current;u.current=i.current,e!==u.current&&c(u.current)});let d=o.placementState&&hn(o.placementState),f=d?.[0],p=d?.[1];return i?null:(0,O.jsx)(g.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...a,ref:l})});an.displayName=rn;var on=`PopperContent`,[sn,cn]=Qt(on),ln=D.forwardRef((e,t)=>{let{__scopePopper:n,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:p=`partial`,hideWhenDetached:h=!1,updatePositionStrategy:_=`optimized`,onPlaced:v,...y}=e,b=tn(on,n),[x,S]=D.useState(null),C=r(t,S),[w,T]=D.useState(null),k=E(w),A=k?.width??0,j=k?.height??0,M=i+(o===`center`?``:`-`+o),N=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},P=Array.isArray(u)?u:[u],F=P.length>0,I={padding:N,boundary:P.filter(pn),altBoundary:F},{refs:L,floatingStyles:ee,placement:te,isPositioned:R,middlewareData:z}=zt({strategy:`fixed`,placement:M,whileElementsMounted:(...e)=>wt(...e,{animationFrame:_===`always`}),elements:{reference:b.anchor},middleware:[Vt({mainAxis:a+j,alignmentAxis:s}),l&&Ht({mainAxis:!0,crossAxis:!1,limiter:p===`partial`?Ut():void 0,...I}),l&&Wt({...I}),Gt({...I,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),w&&qt({element:w,padding:c}),mn({arrowWidth:A,arrowHeight:j}),h&&Kt({strategy:`referenceHidden`,...I,boundary:F?I.boundary:void 0})]}),B=b.setPlacementState;m(()=>(B(te),()=>{B(void 0)}),[te,B]);let[ne,re]=hn(te),V=f(v);m(()=>{R&&V?.()},[R,V]);let ie=z.arrow?.x,ae=z.arrow?.y,oe=z.arrow?.centerOffset!==0,[se,ce]=D.useState();return m(()=>{x&&ce(window.getComputedStyle(x).zIndex)},[x]),(0,O.jsx)(`div`,{ref:L.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:R?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:se,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,O.jsx)(sn,{scope:n,placedSide:ne,placedAlign:re,onArrowChange:T,arrowX:ie,arrowY:ae,shouldHideArrow:oe,children:(0,O.jsx)(g.div,{"data-side":ne,"data-align":re,...y,ref:C,style:{...y.style,animation:R?void 0:`none`}})})})});ln.displayName=on;var un=`PopperArrow`,dn={top:`bottom`,right:`left`,bottom:`top`,left:`right`},fn=D.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=cn(un,n),a=dn[i.placedSide];return(0,O.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,O.jsx)(Xt,{...r,ref:t,style:{...r.style,display:`block`}})})});fn.displayName=un;function pn(e){return e!==null}var mn=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=hn(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function hn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var gn=nn,_n=an,vn=ln,yn=fn,bn=!1;function xn(){let[e,t]=D.useState(bn);return D.useEffect(()=>{bn||(bn=!0,t(!0))},[]),e}var Sn=D.useSyncExternalStore;function Cn(){return()=>{}}function wn(){return Sn(Cn,()=>!0,()=>!1)}var Tn=typeof Sn==`function`?wn:xn,En=`rovingFocusGroup.onEntryFocus`,Dn={bubbles:!1,cancelable:!0},On=`RovingFocusGroup`,[kn,An,jn]=k(On),[Mn,Nn]=y(On,[jn]),[Pn,Fn]=Mn(On),In=D.forwardRef((e,t)=>(0,O.jsx)(kn.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,O.jsx)(kn.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,O.jsx)(Ln,{...e,ref:t})})}));In.displayName=On;var Ln=D.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:i,loop:a=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...m}=e,h=D.useRef(null),_=r(t,h),v=j(o),[y,b]=p({prop:s,defaultProp:c??null,onChange:l,caller:On}),[x,C]=D.useState(!1),w=f(u),T=An(n),E=D.useRef(!1),[k,A]=D.useState(0);return D.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(En,w),()=>e.removeEventListener(En,w)},[w]),(0,O.jsx)(Pn,{scope:n,orientation:i,dir:v,loop:a,currentTabStopId:y,onItemFocus:D.useCallback(e=>b(e),[b]),onItemShiftTab:D.useCallback(()=>C(!0),[]),onFocusableItemAdd:D.useCallback(()=>A(e=>e+1),[]),onFocusableItemRemove:D.useCallback(()=>A(e=>e-1),[]),children:(0,O.jsx)(g.div,{tabIndex:x||k===0?-1:0,"data-orientation":i,...m,ref:_,style:{outline:`none`,...e.style},onMouseDown:S(e.onMouseDown,()=>{E.current=!0}),onFocus:S(e.onFocus,e=>{let t=!E.current;if(e.target===e.currentTarget&&t&&!x){let t=new CustomEvent(En,Dn);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=T().filter(e=>e.focusable);Un([e.find(e=>e.active),e.find(e=>e.id===y),...e].filter(Boolean).map(e=>e.ref.current),d)}}E.current=!1}),onBlur:S(e.onBlur,()=>C(!1))})})}),Rn=`RovingFocusGroupItem`,zn=D.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=v(),l=a||c,u=Fn(Rn,n),d=u.currentTabStopId===l,f=An(n),{onFocusableItemAdd:p,onFocusableItemRemove:h,currentTabStopId:_}=u,y=Tn();return m(()=>{if(!(!y||!r))return p(),()=>h()},[y,r,p,h]),D.useEffect(()=>{if(!(y||!r))return p(),()=>h()},[y,r,p,h]),(0,O.jsx)(kn.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,O.jsx)(g.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:S(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:S(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:S(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=Hn(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Wn(n,r+1):n.slice(r+1)}setTimeout(()=>Un(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:_!=null}):o})})});zn.displayName=Rn;var Bn={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Vn(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function Hn(e,t,n){let r=Vn(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Bn[r]}function Un(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Wn(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Gn=In,Kn=zn,qn=[`Enter`,` `],Jn=[`ArrowDown`,`PageUp`,`Home`],Yn=[`ArrowUp`,`PageDown`,`End`],Xn=[...Jn,...Yn],Zn={ltr:[...qn,`ArrowRight`],rtl:[...qn,`ArrowLeft`]},Qn={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},$n=`Menu`,[er,tr,nr]=k($n),[X,rr]=y($n,[nr,$t,Nn]),ir=$t(),ar=Nn(),[or,Z]=X($n),[sr,cr]=X($n),lr=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=ir(t),[c,l]=D.useState(null),u=D.useRef(!1),d=f(a),p=j(i);return D.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),D.useEffect(()=>{if(!n)return;let e=()=>d(!1);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,d]),(0,O.jsx)(gn,{...s,children:(0,O.jsx)(or,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,O.jsx)(sr,{scope:t,onClose:D.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:p,modal:o,children:r})})})};lr.displayName=$n;var ur=`MenuAnchor`,dr=D.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=ir(n);return(0,O.jsx)(_n,{...i,...r,ref:t})});dr.displayName=ur;var fr=`MenuPortal`,[pr,mr]=X(fr,{forceMount:void 0}),hr=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=Z(fr,t);return(0,O.jsx)(pr,{scope:t,forceMount:n,children:(0,O.jsx)(T,{present:n||a.open,children:(0,O.jsx)(_,{asChild:!0,container:i,children:r})})})};hr.displayName=fr;var Q=`MenuContent`,[gr,_r]=X(Q),vr=D.forwardRef((e,t)=>{let n=mr(Q,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=Z(Q,e.__scopeMenu),o=cr(Q,e.__scopeMenu);return(0,O.jsx)(er.Provider,{scope:e.__scopeMenu,children:(0,O.jsx)(T,{present:r||a.open,children:(0,O.jsx)(er.Slot,{scope:e.__scopeMenu,children:o.modal?(0,O.jsx)(yr,{...i,ref:t}):(0,O.jsx)(br,{...i,ref:t})})})})}),yr=D.forwardRef((e,t)=>{let n=Z(Q,e.__scopeMenu),i=D.useRef(null),a=r(t,i);return D.useEffect(()=>{let e=i.current;if(e)return w(e)},[]),(0,O.jsx)(Sr,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:S(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),br=D.forwardRef((e,t)=>{let n=Z(Q,e.__scopeMenu);return(0,O.jsx)(Sr,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),xr=t(`MenuContent.ScrollLock`),Sr=D.forwardRef((e,t)=>{let{__scopeMenu:n,loop:i=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:h,disableOutsideScroll:g,..._}=e,v=Z(Q,n),y=cr(Q,n),w=ir(n),T=ar(n),E=tr(n),[k,A]=D.useState(null),j=D.useRef(null),M=r(t,j,v.onContentChange),N=D.useRef(0),P=D.useRef(``),F=D.useRef(0),I=D.useRef(null),L=D.useRef(`right`),ee=D.useRef(0),te=g?b:D.Fragment,R=g?{as:xr,allowPinchZoom:!0}:void 0,z=e=>{let t=P.current+e,n=E().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=oi(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){P.current=t,window.clearTimeout(N.current),t!==``&&(N.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};D.useEffect(()=>()=>window.clearTimeout(N.current),[]),C();let B=D.useCallback(e=>L.current===I.current?.side&&ci(e,I.current?.area),[]);return(0,O.jsx)(gr,{scope:n,searchRef:P,onItemEnter:D.useCallback(e=>{B(e)&&e.preventDefault()},[B]),onItemLeave:D.useCallback(e=>{B(e)||(j.current?.focus(),A(null))},[B]),onTriggerLeave:D.useCallback(e=>{B(e)&&e.preventDefault()},[B]),pointerGraceTimerRef:F,onPointerGraceIntentChange:D.useCallback(e=>{I.current=e},[]),children:(0,O.jsx)(te,{...R,children:(0,O.jsx)(d,{asChild:!0,trapped:a,onMountAutoFocus:S(o,e=>{e.preventDefault(),j.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,O.jsx)(x,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:p,onInteractOutside:m,onDismiss:h,children:(0,O.jsx)(Gn,{asChild:!0,...T,dir:y.dir,orientation:`vertical`,loop:i,currentTabStopId:k,onCurrentTabStopIdChange:A,onEntryFocus:S(l,e=>{y.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,O.jsx)(vn,{role:`menu`,"aria-orientation":`vertical`,"data-state":ti(v.open),"data-radix-menu-content":``,dir:y.dir,...w,..._,ref:M,style:{outline:`none`,..._.style},onKeyDown:S(_.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&z(e.key));let i=j.current;if(e.target!==i||!Xn.includes(e.key))return;e.preventDefault();let a=E().filter(e=>!e.disabled).map(e=>e.ref.current);Yn.includes(e.key)&&a.reverse(),ii(a)}),onBlur:S(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(N.current),P.current=``)}),onPointerMove:S(e.onPointerMove,li(e=>{let t=e.target,n=ee.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>ee.current?`right`:`left`;L.current=t,ee.current=e.clientX}}))})})})})})})});vr.displayName=Q;var Cr=`MenuGroup`,wr=D.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,O.jsx)(g.div,{role:`group`,...r,ref:t})});wr.displayName=Cr;var Tr=`MenuLabel`,Er=D.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,O.jsx)(g.div,{...r,ref:t})});Er.displayName=Tr;var Dr=`MenuItem`,Or=`menu.itemSelect`,kr=D.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:i,...a}=e,o=D.useRef(null),s=cr(Dr,e.__scopeMenu),c=_r(Dr,e.__scopeMenu),l=r(t,o),u=D.useRef(!1),d=()=>{let e=o.current;if(!n&&e){let t=new CustomEvent(Or,{bubbles:!0,cancelable:!0});e.addEventListener(Or,e=>i?.(e),{once:!0}),h(e,t),t.defaultPrevented?u.current=!1:s.onClose()}};return(0,O.jsx)(Ar,{...a,ref:l,disabled:n,onClick:S(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:S(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:S(e.onKeyDown,e=>{n||e.target!==e.currentTarget||c.searchRef.current!==``&&e.key===` `||qn.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});kr.displayName=Dr;var Ar=D.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:i=!1,textValue:a,...o}=e,s=_r(Dr,n),c=ar(n),l=D.useRef(null),u=r(t,l),[d,f]=D.useState(!1),[p,m]=D.useState(``);return D.useEffect(()=>{let e=l.current;e&&m((e.textContent??``).trim())},[o.children]),(0,O.jsx)(er.ItemSlot,{scope:n,disabled:i,textValue:a??p,children:(0,O.jsx)(Kn,{asChild:!0,...c,focusable:!i,children:(0,O.jsx)(g.div,{role:`menuitem`,"data-highlighted":d?``:void 0,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,...o,ref:u,onPointerMove:S(e.onPointerMove,li(e=>{i?s.onItemLeave(e):(s.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:S(e.onPointerLeave,li(e=>s.onItemLeave(e))),onFocus:S(e.onFocus,()=>f(!0)),onBlur:S(e.onBlur,()=>f(!1))})})})}),jr=`MenuCheckboxItem`,Mr=D.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,O.jsx)(Br,{scope:e.__scopeMenu,checked:n,children:(0,O.jsx)(kr,{role:`menuitemcheckbox`,"aria-checked":ni(n)?`mixed`:n,...i,ref:t,"data-state":ri(n),onSelect:S(i.onSelect,()=>r?.(ni(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Mr.displayName=jr;var Nr=`MenuRadioGroup`,[Pr,Fr]=X(Nr,{value:void 0,onValueChange:()=>{}}),Ir=D.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=f(r);return(0,O.jsx)(Pr,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,O.jsx)(wr,{...i,ref:t})})});Ir.displayName=Nr;var Lr=`MenuRadioItem`,Rr=D.forwardRef((e,t)=>{let{value:n,...r}=e,i=Fr(Lr,e.__scopeMenu),a=n===i.value;return(0,O.jsx)(Br,{scope:e.__scopeMenu,checked:a,children:(0,O.jsx)(kr,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":ri(a),onSelect:S(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Rr.displayName=Lr;var zr=`MenuItemIndicator`,[Br,Vr]=X(zr,{checked:!1}),Hr=D.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Vr(zr,n);return(0,O.jsx)(T,{present:r||ni(a.checked)||a.checked===!0,children:(0,O.jsx)(g.span,{...i,ref:t,"data-state":ri(a.checked)})})});Hr.displayName=zr;var Ur=`MenuSeparator`,Wr=D.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,O.jsx)(g.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Wr.displayName=Ur;var Gr=`MenuArrow`,Kr=D.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=ir(n);return(0,O.jsx)(yn,{...i,...r,ref:t})});Kr.displayName=Gr;var qr=`MenuSub`,[Jr,Yr]=X(qr),Xr=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=Z(qr,t),o=ir(t),[s,c]=D.useState(null),[l,u]=D.useState(null),d=f(i);return D.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,O.jsx)(gn,{...o,children:(0,O.jsx)(or,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,O.jsx)(Jr,{scope:t,contentId:v(),triggerId:v(),trigger:s,onTriggerChange:c,children:n})})})};Xr.displayName=qr;var Zr=`MenuSubTrigger`,Qr=D.forwardRef((e,t)=>{let n=Z(Zr,e.__scopeMenu),i=cr(Zr,e.__scopeMenu),a=Yr(Zr,e.__scopeMenu),o=_r(Zr,e.__scopeMenu),s=D.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,u={__scopeMenu:e.__scopeMenu},d=D.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);D.useEffect(()=>d,[d]),D.useEffect(()=>{let e=c.current;return()=>{window.clearTimeout(e),l(null)}},[c,l]);let f=r(t,a.onTriggerChange);return(0,O.jsx)(dr,{asChild:!0,...u,children:(0,O.jsx)(Ar,{id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":n.open?a.contentId:void 0,"data-state":ti(n.open),...e,ref:f,onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:S(e.onPointerMove,li(t=>{o.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:S(e.onPointerLeave,li(e=>{d();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,a=i?-5:5,s=t[i?`left`:`right`],l=t[i?`right`:`left`];o.onPointerGraceIntentChange({area:[{x:e.clientX+a,y:e.clientY},{x:s,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:s,y:t.bottom}],side:r}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(e),e.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:S(e.onKeyDown,t=>{e.disabled||t.target!==t.currentTarget||o.searchRef.current!==``&&t.key===` `||Zn[i.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Qr.displayName=Zr;var $r=`MenuSubContent`,ei=D.forwardRef((e,t)=>{let n=mr(Q,e.__scopeMenu),{forceMount:i=n.forceMount,align:a=`start`,...o}=e,s=Z(Q,e.__scopeMenu),c=cr(Q,e.__scopeMenu),l=Yr($r,e.__scopeMenu),u=D.useRef(null),d=r(t,u);return(0,O.jsx)(er.Provider,{scope:e.__scopeMenu,children:(0,O.jsx)(T,{present:i||s.open,children:(0,O.jsx)(er.Slot,{scope:e.__scopeMenu,children:(0,O.jsx)(Sr,{id:l.contentId,"aria-labelledby":l.triggerId,...o,ref:d,align:a,side:c.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{c.isUsingKeyboardRef.current&&u.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:S(e.onFocusOutside,e=>{e.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:S(e.onEscapeKeyDown,e=>{c.onClose(),e.preventDefault()}),onKeyDown:S(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Qn[c.dir].includes(e.key);t&&n&&(s.onOpenChange(!1),l.trigger?.focus(),e.preventDefault())})})})})})});ei.displayName=$r;function ti(e){return e?`open`:`closed`}function ni(e){return e===`indeterminate`}function ri(e){return ni(e)?`indeterminate`:e?`checked`:`unchecked`}function ii(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ai(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function oi(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ai(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function si(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function ci(e,t){return t?si({x:e.clientX,y:e.clientY},t):!1}function li(e){return t=>t.pointerType===`mouse`?e(t):void 0}var ui=lr,di=dr,fi=hr,pi=vr,mi=wr,hi=Er,gi=kr,_i=Mr,vi=Ir,yi=Rr,bi=Hr,xi=Wr,Si=Kr,Ci=Xr,wi=Qr,Ti=ei,Ei=`DropdownMenu`,[Di,Oi]=y(Ei,[rr]),$=rr(),[ki,Ai]=Di(Ei),ji=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=$(t),l=D.useRef(null),[u,d]=p({prop:i,defaultProp:a??!1,onChange:o,caller:Ei});return(0,O.jsx)(ki,{scope:t,triggerId:v(),triggerRef:l,contentId:v(),open:u,onOpenChange:d,onOpenToggle:D.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,O.jsx)(ui,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};ji.displayName=Ei;var Mi=`DropdownMenuTrigger`,Ni=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:i=!1,...a}=e,o=Ai(Mi,n),s=$(n),c=r(t,o.triggerRef);return(0,O.jsx)(di,{asChild:!0,...s,children:(0,O.jsx)(g.button,{type:`button`,id:o.triggerId,"aria-haspopup":`menu`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?`open`:`closed`,"data-disabled":i?``:void 0,disabled:i,...a,ref:c,onPointerDown:S(e.onPointerDown,e=>{!i&&e.button===0&&e.ctrlKey===!1&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:S(e.onKeyDown,e=>{i||([`Enter`,` `].includes(e.key)&&o.onOpenToggle(),e.key===`ArrowDown`&&o.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Ni.displayName=Mi;var Pi=`DropdownMenuPortal`,Fi=e=>{let{__scopeDropdownMenu:t,...n}=e,r=$(t);return(0,O.jsx)(fi,{...r,...n})};Fi.displayName=Pi;var Ii=`DropdownMenuContent`,Li=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=Ai(Ii,n),a=$(n),o=D.useRef(!1);return(0,O.jsx)(pi,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:S(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:S(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Li.displayName=Ii;var Ri=`DropdownMenuGroup`,zi=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,O.jsx)(mi,{...i,...r,ref:t})});zi.displayName=Ri;var Bi=`DropdownMenuLabel`,Vi=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,O.jsx)(hi,{...i,...r,ref:t})});Vi.displayName=Bi;var Hi=`DropdownMenuItem`,Ui=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,O.jsx)(gi,{...i,...r,ref:t})});Ui.displayName=Hi;var Wi=`DropdownMenuCheckboxItem`,Gi=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,O.jsx)(_i,{...i,...r,ref:t})});Gi.displayName=Wi;var Ki=`DropdownMenuRadioGroup`,qi=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,O.jsx)(vi,{...i,...r,ref:t})});qi.displayName=Ki;var Ji=`DropdownMenuRadioItem`,Yi=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,O.jsx)(yi,{...i,...r,ref:t})});Yi.displayName=Ji;var Xi=`DropdownMenuItemIndicator`,Zi=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,O.jsx)(bi,{...i,...r,ref:t})});Zi.displayName=Xi;var Qi=`DropdownMenuSeparator`,$i=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,O.jsx)(xi,{...i,...r,ref:t})});$i.displayName=Qi;var ea=`DropdownMenuArrow`,ta=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,O.jsx)(Si,{...i,...r,ref:t})});ta.displayName=ea;var na=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=$(t),[s,c]=p({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,O.jsx)(Ci,{...o,open:s,onOpenChange:c,children:n})},ra=`DropdownMenuSubTrigger`,ia=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,O.jsx)(wi,{...i,...r,ref:t})});ia.displayName=ra;var aa=`DropdownMenuSubContent`,oa=D.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=$(n);return(0,O.jsx)(Ti,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});oa.displayName=aa;var sa=ji,ca=Ni,la=Fi,ua=Li,da=Vi,fa=Ui,pa=Gi,ma=qi,ha=Yi,ga=Zi,_a=$i,va=na,ya=ia,ba=oa;function xa({...e}){return(0,O.jsx)(sa,{"data-slot":`dropdown-menu`,...e})}function Sa({...e}){return(0,O.jsx)(la,{"data-slot":`dropdown-menu-portal`,...e})}function Ca({...e}){return(0,O.jsx)(ca,{"data-slot":`dropdown-menu-trigger`,...e})}function wa({className:e,sideOffset:t=4,...n}){return(0,O.jsx)(la,{children:(0,O.jsx)(ua,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:i(`z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] max-w-(--radix-dropdown-menu-content-available-width) [overflow-wrap:anywhere] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,e),...n})})}function Ta({className:e,inset:t,variant:n=`default`,...r}){return(0,O.jsx)(fa,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:i(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:ps-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function Ea({className:e,children:t,checked:r,...a}){return(0,O.jsxs)(pa,{"data-slot":`dropdown-menu-checkbox-item`,className:i(`relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pe-2 ps-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n({checked:r}),...a,children:[(0,O.jsx)(`span`,{className:`pointer-events-none absolute start-2 flex size-3.5 items-center justify-center`,children:(0,O.jsx)(ga,{children:(0,O.jsx)(u,{className:`size-4`})})}),t]})}function Da({...e}){return(0,O.jsx)(ma,{"data-slot":`dropdown-menu-radio-group`,...e})}function Oa({className:e,children:t,...n}){return(0,O.jsxs)(ha,{"data-slot":`dropdown-menu-radio-item`,className:i(`relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pe-2 ps-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[(0,O.jsx)(`span`,{className:`pointer-events-none absolute start-2 flex size-3.5 items-center justify-center`,children:(0,O.jsx)(ga,{children:(0,O.jsx)(l,{className:`size-2 fill-current`})})}),t]})}function ka({className:e,inset:t,...n}){return(0,O.jsx)(da,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:i(`px-2 py-1.5 text-sm font-medium data-[inset]:ps-8`,e),...n})}function Aa({className:e,...t}){return(0,O.jsx)(_a,{"data-slot":`dropdown-menu-separator`,className:i(`-mx-1 my-1 h-px bg-border`,e),...t})}function ja({...e}){return(0,O.jsx)(va,{"data-slot":`dropdown-menu-sub`,...e})}function Ma({className:e,inset:t,children:n,...r}){return(0,O.jsxs)(ya,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:i(`flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:ps-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,O.jsx)(c,{className:`ms-auto size-4`})]})}function Na({className:e,...t}){return(0,O.jsx)(ba,{"data-slot":`dropdown-menu-sub-content`,className:i(`z-50 min-w-[8rem] max-w-(--radix-dropdown-menu-content-available-width) [overflow-wrap:anywhere] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md motion-safe:data-[side=bottom]:slide-in-from-top-2 motion-safe:data-[side=left]:slide-in-from-right-2 motion-safe:data-[side=right]:slide-in-from-left-2 motion-safe:data-[side=top]:slide-in-from-bottom-2 motion-safe:data-[state=closed]:animate-out data-[state=closed]:fade-out-0 motion-safe:data-[state=closed]:zoom-out-95 motion-safe:data-[state=open]:animate-in data-[state=open]:fade-in-0 motion-safe:data-[state=open]:zoom-in-95`,e),...t})}export{k as C,j as S,_n as _,ka as a,gn as b,Oa as c,Na as d,Ma as f,Nn as g,Gn as h,Ta as i,Aa as l,Kn as m,Ea as n,Sa as o,Ca as p,wa as r,Da as s,xa as t,ja as u,yn as v,$t as x,vn as y};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,u as n,w as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{gn as o,i as s}from"./project-scope-context-wlB-Y0ii.js";import{xt as c}from"./queries-BPdWfTBN.js";import{T as l,ct as u}from"./design-icons-DmYTv2r1.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{t as f}from"./centered-state-BmsqxbI8.js";import{Xt as p,Zt as m,an as h,cn as g,en as _,in as v,ln as y,nn as b,on as x,rn as S,sn as C,tn as w}from"./index-C2zVqh-_.js";var T=d(`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`}]]),E=d(`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`}]]),D=d(`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`}]]),O=e(i(),1),k=a(),A=[[`scripts`,`remote script`,`remote scripts`],[`remote`,`remote resource`,`remote resources`],[`relative`,`linked file next to the report`,`linked files next to the report`],[`forms`,`form`,`forms`],[`embeds`,`embedded frame or object`,`embedded frames or objects`]];function j(e){let t=A.filter(([t])=>e[t]>0).map(([t,n,r])=>`${e[t]} ${e[t]===1?n:r}`);return t.length?t.join(`, `):null}var M={};function N(e){let t=(0,O.useMemo)(()=>h(e),[e]).join(` `),[n,r]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(!t)return;let e=!0;return x(t.split(` `)).then(n=>{e&&r({key:t,libraries:n})}),()=>{e=!1}},[t]),t?n?.key===t?n.libraries:null:M}function P({html:e,title:t,fragment:r,className:i}){let a=N(e);return a?(0,k.jsx)(F,{html:e,title:t,fragment:r,className:i,libraries:a}):(0,k.jsx)(`div`,{"data-slot":`html-report`,"aria-busy":`true`,className:n(`flex min-h-0 flex-col`,i)})}function F({html:e,title:t,fragment:r,className:i,libraries:a}){let{srcdoc:o,blocked:s}=(0,O.useMemo)(()=>{let n=S(e,a);return{srcdoc:v(n.srcdoc,t),blocked:n.blocked}},[e,a,t]),c=e=>{r&&/^#\S+$/.test(r)&&e.currentTarget.contentWindow?.frames[0]?.location.replace(`about:srcdoc${r}`)},l=j(s);return(0,k.jsxs)(`div`,{"data-slot":`html-report`,className:n(`flex min-h-0 flex-col`,i),children:[l?(0,k.jsxs)(`p`,{"data-slot":`html-report-blocked`,role:`note`,className:`border-b border-border bg-muted/40 px-4 py-2 text-xs text-foreground`,children:[`Blocked for your safety: `,l,`. Reports show only what they carry inside the file.`]}):null,(0,k.jsx)(`iframe`,{"data-slot":`html-report-frame`,title:t,sandbox:w,allow:_,srcDoc:o,referrerPolicy:`no-referrer`,onLoad:c,className:`block min-h-0 w-full flex-1 border-0 bg-report-canvas`})]})}var I=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`avif`]);function L(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:I.has(t.slice(n+1).toLowerCase())}function R(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return L(e)||n>0&&t.slice(n+1).toLowerCase()===`svg`}function z(e){return e.tooLarge?`too-large`:R(e.path)?`image`:e.binary?`binary`:`text`}function B(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}function V({runId:e,path:t,className:n}){let r=c(e,t??void 0);if(t===null)return(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:(0,k.jsx)(l,{size:16}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from this task’s worktree to inspect its contents.`,className:`[&_[data-slot=centered-state-tile]]:size-10 [&_[data-slot=centered-state-tile]]:border-0 [&_[data-slot=centered-state-tile]]:bg-transparent [&_[data-slot=centered-state-tile]]:text-accent-text [&_[data-slot=centered-state-tile]]:shadow-none [&_h2]:text-xl`})});if(r.isPending)return(0,k.jsx)(K,{className:n,children:(0,k.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 s&&r.error.status===409;return(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:e?(0,k.jsx)(D,{}):(0,k.jsx)(u,{size:16}),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,k.jsx)(H,{runId:e,entry:r.data,className:n}):(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:(0,k.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Choose a file inside this directory`,subtitle:`Expand the folder in the tree, or enter the full path to a file.`})})}function H({runId:e,entry:t,className:n,imageUrl:r,downloadUrl:i,snapshot:a,readerHref:o,documentPreview:s=!1}){let[c,l]=(0,O.useState)(!1),u=s&&/\.(?:md|markdown)$/i.test(t.path),d=s&&b(t.path),f=/\.(?:png|jpe?g|gif|webp|bmp|ico|avif)$/i.test(t.path),p=s&&f&&t.size<=10*1024*1024?`image`:z(t),m=(u||d)&&p===`text`;return(0,k.jsxs)(K,{className:n,children:[(0,k.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,k.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,k.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:B(t.size)})]}),a||i||m?(0,k.jsx)(W,{snapshot:a,downloadUrl:i,source:m?c:null,onSource:()=>l(e=>!e),readerHref:d&&p===`text`?o:void 0}):null,(0,k.jsx)(U,{runId:e,entry:t,kind:p,showImage:p===`image`&&(!s||f),rendered:c?null:u?`markdown`:d?`html`:null,imageUrl:r})]})}function U({runId:e,entry:t,kind:n,showImage:r,rendered:i,imageUrl:a}){return r?(0,k.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,k.jsx)(`img`,{"data-slot":`file-preview-image`,src:a??o(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):n===`too-large`?(0,k.jsx)(f,{icon:(0,k.jsx)(T,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${B(t.size)} — past the preview cap. Open it in your editor instead.`}):n===`binary`?(0,k.jsx)(f,{icon:(0,k.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${B(t.size)} of binary data — no text preview.`}):i===`markdown`?(0,k.jsx)(`div`,{className:`p-4`,children:(0,k.jsx)(p,{document:!0,children:t.content??``})}):i===`html`?(0,k.jsx)(P,{html:t.content??``,title:`Report: ${t.path}`,className:`h-[70vh]`}):(0,k.jsx)(Y,{path:t.path,text:t.content??``})}function W({snapshot:e,downloadUrl:t,source:n,onSource:r,readerHref:i}){return(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border px-4 py-2 text-xs`,children:[e?(0,k.jsxs)(`span`,{children:[`Published snapshot · `,e]}):null,t?(0,k.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-accent-text underline`,href:t,children:`Download`}):null,n===null?null:(0,k.jsx)(`button`,{className:`min-h-11 rounded px-2 text-accent-text underline focus-visible:ring-2`,onClick:r,children:n?`Preview`:`View source`}),i?(0,k.jsx)(G,{href:i}):null]})}function G({href:e}){let n=r(),i=t();return(0,k.jsx)(`a`,{className:`inline-flex min-h-11 items-center px-2 text-accent-text underline focus-visible:ring-2`,href:e,onClick:t=>m(t,n,e,i),children:`Open reader`})}function K({className:e,children:t}){return(0,k.jsx)(`section`,{"data-slot":`file-preview`,className:n(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var q=1500;function J(e,t){let n=(0,O.useMemo)(()=>t.split(`
2
- `).map(e=>[{content:e}]),[t]),r=(0,O.useMemo)(()=>y(e),[e]),i=n.length>q,[a,o]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(r===null||i)return;let n=!1;return C(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:g(t,r)?.tokens??n}function Y({path:e,text:t}){let n=J(e,t);return(0,k.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":y(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,k.jsxs)(`div`,{className:`flex px-4`,children:[(0,k.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,k.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,k.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}export{R as a,E as c,B as i,T as l,H as n,P as o,V as r,D as s,Y as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,u as n,w as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{gn as o,i as s}from"./project-scope-context-wlB-Y0ii.js";import{xt as c}from"./queries-BPdWfTBN.js";import{T as l,ct as u}from"./design-icons-DmYTv2r1.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{t as f}from"./centered-state-BmsqxbI8.js";import{At as p,Ct as m,Dt as h,Et as g,Ot as _,St as v,Tt as y,jt as b,kt as x,vt as S,wt as C,yt as w}from"./index-lMBPAedr.js";var T=d(`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`}]]),E=d(`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`}]]),D=d(`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`}]]),O=e(i(),1),k=a(),A=[[`scripts`,`remote script`,`remote scripts`],[`remote`,`remote resource`,`remote resources`],[`relative`,`linked file next to the report`,`linked files next to the report`],[`forms`,`form`,`forms`],[`embeds`,`embedded frame or object`,`embedded frames or objects`]];function j(e){let t=A.filter(([t])=>e[t]>0).map(([t,n,r])=>`${e[t]} ${e[t]===1?n:r}`);return t.length?t.join(`, `):null}var M={};function N(e){let t=(0,O.useMemo)(()=>h(e),[e]).join(` `),[n,r]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(!t)return;let e=!0;return _(t.split(` `)).then(n=>{e&&r({key:t,libraries:n})}),()=>{e=!1}},[t]),t?n?.key===t?n.libraries:null:M}function P({html:e,title:t,fragment:r,className:i}){let a=N(e);return a?(0,k.jsx)(F,{html:e,title:t,fragment:r,className:i,libraries:a}):(0,k.jsx)(`div`,{"data-slot":`html-report`,"aria-busy":`true`,className:n(`flex min-h-0 flex-col`,i)})}function F({html:e,title:t,fragment:r,className:i,libraries:a}){let{srcdoc:o,blocked:s}=(0,O.useMemo)(()=>{let n=y(e,a);return{srcdoc:g(n.srcdoc,t),blocked:n.blocked}},[e,a,t]),c=e=>{r&&/^#\S+$/.test(r)&&e.currentTarget.contentWindow?.frames[0]?.location.replace(`about:srcdoc${r}`)},l=j(s);return(0,k.jsxs)(`div`,{"data-slot":`html-report`,className:n(`flex min-h-0 flex-col`,i),children:[l?(0,k.jsxs)(`p`,{"data-slot":`html-report-blocked`,role:`note`,className:`border-b border-border bg-muted/40 px-4 py-2 text-xs text-foreground`,children:[`Blocked for your safety: `,l,`. Reports show only what they carry inside the file.`]}):null,(0,k.jsx)(`iframe`,{"data-slot":`html-report-frame`,title:t,sandbox:m,allow:v,srcDoc:o,referrerPolicy:`no-referrer`,onLoad:c,className:`block min-h-0 w-full flex-1 border-0 bg-report-canvas`})]})}var I=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`avif`]);function L(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:I.has(t.slice(n+1).toLowerCase())}function R(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return L(e)||n>0&&t.slice(n+1).toLowerCase()===`svg`}function z(e){return e.tooLarge?`too-large`:R(e.path)?`image`:e.binary?`binary`:`text`}function B(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}function V({runId:e,path:t,className:n}){let r=c(e,t??void 0);if(t===null)return(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:(0,k.jsx)(l,{size:16}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from this task’s worktree to inspect its contents.`,className:`[&_[data-slot=centered-state-tile]]:size-10 [&_[data-slot=centered-state-tile]]:border-0 [&_[data-slot=centered-state-tile]]:bg-transparent [&_[data-slot=centered-state-tile]]:text-accent-text [&_[data-slot=centered-state-tile]]:shadow-none [&_h2]:text-xl`})});if(r.isPending)return(0,k.jsx)(K,{className:n,children:(0,k.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 s&&r.error.status===409;return(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:e?(0,k.jsx)(D,{}):(0,k.jsx)(u,{size:16}),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,k.jsx)(H,{runId:e,entry:r.data,className:n}):(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:(0,k.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Choose a file inside this directory`,subtitle:`Expand the folder in the tree, or enter the full path to a file.`})})}function H({runId:e,entry:t,className:n,imageUrl:r,downloadUrl:i,snapshot:a,readerHref:o,documentPreview:s=!1}){let[c,l]=(0,O.useState)(!1),u=s&&/\.(?:md|markdown)$/i.test(t.path),d=s&&C(t.path),f=/\.(?:png|jpe?g|gif|webp|bmp|ico|avif)$/i.test(t.path),p=s&&f&&t.size<=10*1024*1024?`image`:z(t),m=(u||d)&&p===`text`;return(0,k.jsxs)(K,{className:n,children:[(0,k.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,k.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,k.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:B(t.size)})]}),a||i||m?(0,k.jsx)(W,{snapshot:a,downloadUrl:i,source:m?c:null,onSource:()=>l(e=>!e),readerHref:d&&p===`text`?o:void 0}):null,(0,k.jsx)(U,{runId:e,entry:t,kind:p,showImage:p===`image`&&(!s||f),rendered:c?null:u?`markdown`:d?`html`:null,imageUrl:r})]})}function U({runId:e,entry:t,kind:n,showImage:r,rendered:i,imageUrl:a}){return r?(0,k.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,k.jsx)(`img`,{"data-slot":`file-preview-image`,src:a??o(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):n===`too-large`?(0,k.jsx)(f,{icon:(0,k.jsx)(T,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${B(t.size)} — past the preview cap. Open it in your editor instead.`}):n===`binary`?(0,k.jsx)(f,{icon:(0,k.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${B(t.size)} of binary data — no text preview.`}):i===`markdown`?(0,k.jsx)(`div`,{className:`p-4`,children:(0,k.jsx)(S,{document:!0,children:t.content??``})}):i===`html`?(0,k.jsx)(P,{html:t.content??``,title:`Report: ${t.path}`,className:`h-[70vh]`}):(0,k.jsx)(Y,{path:t.path,text:t.content??``})}function W({snapshot:e,downloadUrl:t,source:n,onSource:r,readerHref:i}){return(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border px-4 py-2 text-xs`,children:[e?(0,k.jsxs)(`span`,{children:[`Published snapshot · `,e]}):null,t?(0,k.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-accent-text underline`,href:t,children:`Download`}):null,n===null?null:(0,k.jsx)(`button`,{className:`min-h-11 rounded px-2 text-accent-text underline focus-visible:ring-2`,onClick:r,children:n?`Preview`:`View source`}),i?(0,k.jsx)(G,{href:i}):null]})}function G({href:e}){let n=r(),i=t();return(0,k.jsx)(`a`,{className:`inline-flex min-h-11 items-center px-2 text-accent-text underline focus-visible:ring-2`,href:e,onClick:t=>w(t,n,e,i),children:`Open reader`})}function K({className:e,children:t}){return(0,k.jsx)(`section`,{"data-slot":`file-preview`,className:n(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var q=1500;function J(e,t){let n=(0,O.useMemo)(()=>t.split(`
2
+ `).map(e=>[{content:e}]),[t]),r=(0,O.useMemo)(()=>b(e),[e]),i=n.length>q,[a,o]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(r===null||i)return;let n=!1;return x(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:p(t,r)?.tokens??n}function Y({path:e,text:t}){let n=J(e,t);return(0,k.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":b(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,k.jsxs)(`div`,{className:`flex px-4`,children:[(0,k.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,k.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,k.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}export{R as a,E as c,B as i,T as l,H as n,P as o,V as r,D as s,Y as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-CS5tOblf.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{E as o,I as s,M as c,d as l,lt as u}from"./design-icons-DmYTv2r1.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{n as f,r as p,t as m}from"./diff-controls-BHF0Pvdc.js";import{s as h}from"./popover-N-u5z2xh.js";import{i as g,p as _,r as v,t as y}from"./dropdown-menu-D7f0O7xR.js";import{P as b,nn as x}from"./index-lMBPAedr.js";var S=d(`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`}]]),C=d(`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`}]]),w=e(i(),1),T=a();function E({root:e,selected:t,onSelect:n}){return(0,T.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function D({adds:e,dels:t}){return(0,T.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] font-medium tabular-nums`,children:[e>0?(0,T.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,T.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function O({dir:e,depth:t,selected:n,onSelect:i}){let[a,s]=(0,w.useState)(!0);return(0,T.jsxs)(`li`,{children:[(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":a?`open`:`closed`,"aria-expanded":a,onClick:()=>s(e=>!e),className:`flex min-h-11 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,T.jsx)(l,{size:16,"aria-hidden":`true`,className:r(`size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,a&&`rotate-90`)}),(0,T.jsx)(o,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,T.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]}),a?(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:t+1,selected:n,onSelect:i},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:t+1,selected:n,onSelect:i},e.path))]}):null]})}var k={added:`text-success`,deleted:`text-danger`};function A({file:e,depth:t,selected:n,onSelect:i}){let a=n===e.path;return(0,T.jsx)(`li`,{children:(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":a?`true`:void 0,onClick:()=>i(e.path),className:r(`flex min-h-11 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,a?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,T.jsx)(C,{"aria-hidden":`true`,className:r(`size-3.5 shrink-0`,k[e.status])}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]})})}function j(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function M(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(M)}}var N=(e,t)=>e.name.localeCompare(t.name);function P(e){let t=j(``,``),n=new Map([[``,t]]),r=e=>{let t=n.get(e);if(t)return t;let i=e.lastIndexOf(`/`),a=r(i===-1?``:e.slice(0,i)),o=j(i===-1?e:e.slice(i+1),e);return a.dirs.push(o),n.set(e,o),o};for(let t of e){let e=t.path.lastIndexOf(`/`);r(e===-1?``:t.path.slice(0,e)).files.push({kind:`file`,name:e===-1?t.path:t.path.slice(e+1),path:t.path,status:t.status,adds:t.adds,dels:t.dels,binary:t.binary})}let i=e=>{e.dirs.forEach(i),e.adds=e.files.reduce((e,t)=>e+t.adds,0)+e.dirs.reduce((e,t)=>e+t.adds,0),e.dels=e.files.reduce((e,t)=>e+t.dels,0)+e.dirs.reduce((e,t)=>e+t.dels,0),e.fileCount=e.files.length+e.dirs.reduce((e,t)=>e+t.fileCount,0),e.dirs.sort(N),e.files.sort(N)};return i(t),{...t,dirs:t.dirs.map(M)}}function F({bar:e,healthReady:t,branch:i,stat:a,mode:o,wrap:s,preview:c=!1,onModeChange:l,onWrapChange:u,onPreviewChange:d,onAction:h}){return(0,T.jsxs)(`div`,{"data-slot":`git-toolbar`,"data-health-ready":t,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 px-[18px] py-[22px] md:px-9 [&_button]:min-h-11`,children:[i?(0,T.jsx)(m,{branch:i}):null,a?(0,T.jsx)(R,{stat:a}):null,d?(0,T.jsx)(`span`,{className:`ml-auto flex items-center`,children:(0,T.jsx)(p,{preview:c,onPreviewChange:d})}):null,(0,T.jsxs)(`span`,{className:r(`flex items-center gap-1`,d?`max-md:ml-auto`:`ml-auto`),children:[(0,T.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,T.jsx)(f,{mode:o,wrap:s,onModeChange:l,onWrapChange:u})}),e.secondary.map(e=>(0,T.jsx)(L,{action:e,variant:`outline`,onAction:h},e.id)),(0,T.jsx)(L,{action:e.primary,variant:`primary`,onAction:h}),e.menu.length>0?(0,T.jsxs)(y,{children:[(0,T.jsx)(_,{asChild:!0,children:(0,T.jsx)(n,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,children:(0,T.jsx)(S,{"aria-hidden":`true`})})}),(0,T.jsx)(v,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,T.jsxs)(g,{disabled:!e.enabled,title:e.reason,onSelect:()=>h(e.id),children:[I[e.id],e.label]},e.id))})]}):null]})]})}var I={commit:(0,T.jsx)(c,{size:16,"aria-hidden":`true`}),push:(0,T.jsx)(u,{size:16,"aria-hidden":`true`}),"create-pr":(0,T.jsx)(s,{size:16,"aria-hidden":`true`}),"view-pr":(0,T.jsx)(h,{"aria-hidden":`true`}),"open-terminal":(0,T.jsx)(x,{"aria-hidden":`true`})};function L({action:e,variant:r,onAction:i}){return e.id===`view-pr`?t(e.href)?(0,T.jsx)(n,{asChild:!0,variant:r,size:`sm`,"data-action":e.id,children:(0,T.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[I[e.id],e.label]})}):(0,T.jsxs)(n,{variant:r,size:`sm`,"data-action":e.id,disabled:!0,title:`View PR unavailable — the recorded PR link is not an http(s) URL`,children:[I[e.id],e.label]}):(0,T.jsxs)(n,{variant:r,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>i(e.id),children:[I[e.id],e.label]})}function R({stat:e}){return(0,T.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,T.jsx)(b,{stat:{adds:z(e.adds),dels:z(e.dels),files:e.files}})})}function z(e){let[t,n]=(0,w.useState)(e),r=(0,w.useRef)(e);return(0,w.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{E as i,F as n,P as r,R as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,L as n,M as r,t as i,u as a}from"./button-CS5tOblf.js";import{i as o,t as s}from"./react-runtime-CCIEwYL0.js";import"./live-refetch-CstQIN6c.js";import{$ as c,Bn as l,Kr as u,Q as d,X as f,et as p,ti as m,tn as h}from"./project-scope-context-wlB-Y0ii.js";import{An as g,Cn as _,D as v,E as y,N as b,P as ee,Pt as te,Un as x,X as S,j as ne,k as C,l as w,n as T}from"./queries-BPdWfTBN.js";import{n as E}from"./toaster-CRVRHlMR.js";import{I as D,L as O,Q as k,Z as A,ct as j,l as M,m as N,r as P,u as F}from"./design-icons-DmYTv2r1.js";import{l as re,n as ie}from"./nav-row-styles-CEA9c88Q.js";import{i as I,r as L,t as R}from"./popover-N-u5z2xh.js";import{a as z,i as B}from"./format-BNCkW110.js";import{_ as ae,a as oe,d as se,f as ce,g as le,i as ue,m as de,n as fe,p as pe,r as me,t as he,u as V}from"./github-sidebar-model-BSNdxNKJ.js";import{r as ge,t as H}from"./project-router-Dd63wBeA.js";import{t as U}from"./centered-state-BmsqxbI8.js";import{A as _e,E as ve,M as ye,O as be,j as W}from"./agent-accounts-CuRvwNoA.js";import{F as xe,It as Se,R as Ce,Xt as we,hn as Te,it as Ee,mn as De,n as Oe,t as ke}from"./index-lMBPAedr.js";import{a as Ae,d as je,f as Me,i as Ne,l as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze,u as G}from"./use-hand-to-agent-state-B9qtivFb.js";import{t as K}from"./tab-link-CDrve3Rf.js";var q=e(o(),1),J=`cez-github-list-width`;function Y(e){if(e==null||e===``||typeof e==`string`&&e.trim()===``)return 360;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(520,Math.max(280,Math.round(t))):360}function Be(){try{let e=localStorage.getItem(J);return e===null?360:Y(e)}catch{return 360}}function Ve(e){try{localStorage.setItem(J,String(Y(e)))}catch{}}var X=s();function He({number:e,repo:t}){let n=r();return(0,X.jsx)(Ue,{number:e,repo:t,scope:n},JSON.stringify([n,t,e]))}function Ue({number:e,repo:t,scope:n}){let r=(0,q.useId)(),a=(0,q.useId)(),[o,s]=(0,q.useState)(!1),c=o?Te:De,u=S(n,!0,n==="default"),d=w(`#${e}`,!0),f=(0,q.useMemo)(()=>pe(g(u.data??[],d.data?.pages.flatMap(e=>e.runs)??[]),e,t,n),[u.data,d.data,e,t,n]);return(0,X.jsxs)(`section`,{"aria-labelledby":r,className:`mt-4 min-w-0 rounded-lg border border-border p-3`,children:[(0,X.jsx)(`h3`,{id:r,className:`text-xs font-semibold text-muted-foreground`,children:(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":o,"aria-controls":a,onClick:()=>s(e=>!e),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-left hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,X.jsx)(c,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,X.jsxs)(`span`,{children:[`Linked tasks`,u.data?` (${f.length}${d.hasNextPage||d.isError?`+`:``})`:``]})]})}),(0,X.jsx)(`div`,{id:a,children:o?(0,X.jsxs)(X.Fragment,{children:[u.isPending?(0,X.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:`Loading linked tasks…`}):null,u.isError?(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Couldn’t load linked tasks. Check your connection and try again.`}),(0,X.jsx)(i,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void u.refetch(),disabled:u.isFetching,children:`Retry linked tasks`})]}):null,u.data&&f.length===0&&!u.isError?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No linked tasks yet.`}):null,f.length>0?(0,X.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:f.map(e=>{let t=l(e);return(0,X.jsx)(`li`,{children:(0,X.jsxs)(H,{to:`/tasks/${encodeURIComponent(e.id)}`,className:`flex min-h-11 min-w-0 flex-col justify-center gap-1 rounded-md px-2 py-2 hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium break-words [overflow-wrap:anywhere]`,children:_(e)}),(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,X.jsx)(we,{tone:t.tone,shape:t.shape,pulse:t.pulse,role:`img`,"aria-label":t.label,title:t.label}),e.archived?(0,X.jsx)(`span`,{className:`rounded border border-border px-1`,children:`Archived`}):null,(0,X.jsx)(`time`,{dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleDateString()})]})]})},e.id)})}):null,d.isError?(0,X.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,X.jsx)(`p`,{role:`status`,children:`Couldn’t load older archived linked tasks.`}),(0,X.jsx)(i,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.refetch(),disabled:d.isFetching,children:`Retry older linked tasks`})]}):d.hasNextPage?(0,X.jsx)(i,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.fetchNextPage(),disabled:d.isFetchingNextPage,children:d.isFetchingNextPage?`Loading older linked tasks…`:`Show older linked tasks`}):null]}):null})]})}var Z=`w-44 max-w-full`,Q=`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm text-foreground focus-visible:outline-ring disabled:opacity-50`;function We(e,t){let n=new Map;for(let t of e)for(let e of t.assignees??[])n.set(e.toLowerCase(),e);for(let e of t)n.set(e.toLowerCase(),e);return[...n.values()].sort((e,t)=>e.localeCompare(t))}function Ge(e,t){return!!e&&t.length===1&&t[0]?.toLowerCase()===e.toLowerCase()}function Ke(e){let t=` Previous memberships are shown; issues with unknown membership remain visible.`;return e.projectsState===`refreshing`&&e.projects?`Refreshing project boards.${t}`:e.projectsState===`unavailable`&&e.projects?`${e.projectsReason}${t}`:e.projects?``:e.projectsReason??(e.projectsState===`refreshing`?`Project memberships pending.`:`Project boards unavailable.`)}function qe(e){return[e.viewerLogin?``:`GitHub login unavailable.`,Ke(e)].filter(Boolean).join(` `)}function Je({options:e,assignees:t,onAssigneesChange:n}){return(0,X.jsxs)(R,{children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,className:Q,disabled:e.length===0,children:[`Assignee`,t.length?` · ${t.length}`:``,(0,X.jsx)(F,{size:12,"aria-hidden":`true`,className:`ml-1 inline size-3 shrink-0 align-[-1px] text-soft-foreground`})]})}),(0,X.jsx)(L,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,X.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,X.jsx)(`legend`,{className:`px-2 text-xs text-muted-foreground`,children:`Match any selected assignee`}),e.map(e=>{let r=t.some(t=>t.toLowerCase()===e.toLowerCase());return(0,X.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>n(r?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,X.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]})}function Ye({data:e,projectId:t,onProjectChange:n,pickerRef:r}){return e.projects?.length?(0,X.jsxs)(`select`,{ref:r,"aria-label":`Project board`,className:`${Q} ${Z}`,value:t,onChange:e=>n(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:`All boards`}),e.projects.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.title},e.id))]}):e.projects||e.projectsState?(0,X.jsx)(`select`,{ref:r,"aria-label":`Project board`,className:`${Q} ${Z}`,disabled:!0,value:``,children:(0,X.jsx)(`option`,{value:``,children:e.projects?`No boards`:e.projectsState===`refreshing`?`Loading boards…`:`Boards unavailable`})}):null}function Xe({data:e,message:t,lastMessage:n,hasMessage:r,statusOpen:i,setStatusOpen:a,triggerRef:o,contentRef:s}){return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`p`,{role:`status`,className:`sr-only`,children:t}),(0,X.jsxs)(R,{open:i,onOpenChange:a,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsx)(`button`,{ref:o,type:`button`,className:`${Q} inline-flex items-center justify-center ${t?``:`invisible`}`,"aria-label":`Project board status`,tabIndex:t?void 0:-1,children:e.projectsState===`refreshing`?(0,X.jsx)(A,{size:14,"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):(0,X.jsx)(j,{size:14,"aria-hidden":`true`,className:`size-3.5`})})}),(0,X.jsx)(L,{ref:s,align:`start`,"data-slot":`gh-issue-status`,onCloseAutoFocus:e=>{r||e.preventDefault()},className:`w-72 max-w-[calc(100vw-2rem)] p-3 text-xs text-muted-foreground`,children:t||n.current})]})]})}function Ze({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let[a,o]=(0,q.useState)(!1),s=(0,q.useRef)(null),c=(0,q.useRef)(null),l=(0,q.useRef)(null),u=(0,q.useRef)(null),d=We(e.issues,t),f=Ge(e.viewerLogin,t),p=qe(e),m=p!==``,h=(0,q.useRef)(p);m&&(h.current=p);let g=(0,q.useRef)(!m);g.current=!m;let _=()=>(l.current&&!l.current.disabled?l.current:u.current)?.focus();return(0,q.useEffect)(()=>{let e=s.current;if(!e)return;let t=e=>{g.current&&!e.relatedTarget&&requestAnimationFrame(()=>{(!document.activeElement||document.activeElement===document.body)&&_()})};return e.addEventListener(`blur`,t),()=>e.removeEventListener(`blur`,t)},[]),(0,q.useEffect)(()=>{if(m)return;let e=document.activeElement,t=!!e&&(e===s.current||!!c.current?.contains(e));o(!1),t&&_()},[m]),(0,X.jsxs)(`div`,{className:`contents`,"data-slot":`gh-issue-filters`,children:[(0,X.jsx)(Je,{options:d,assignees:t,onAssigneesChange:r}),(0,X.jsx)(`button`,{ref:u,type:`button`,className:`${Q} aria-pressed:border-foreground aria-pressed:bg-foreground aria-pressed:text-background`,disabled:!e.viewerLogin,"aria-pressed":f,onClick:()=>r(f?[]:[e.viewerLogin]),children:`Assigned to me`}),(0,X.jsx)(Ye,{data:e,projectId:n,onProjectChange:i,pickerRef:l}),(0,X.jsx)(Xe,{data:e,message:p,lastMessage:h,hasMessage:m,statusOpen:a,setStatusOpen:o,triggerRef:s,contentRef:c})]})}function Qe({onRefresh:e,refreshing:t}){let n=ke(r());return(0,X.jsxs)(`div`,{"data-route":`github`,"data-slot":`github-filter-screen`,className:ie,children:[(0,X.jsxs)(`div`,{className:`mb-[16px] flex items-center gap-[8px]`,children:[(0,X.jsx)(`h1`,{className:a(re,`min-w-0 flex-1`),children:`GitHub`}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`gh-screen-refresh`,"aria-label":`Refresh from GitHub`,title:`Refresh from GitHub`,disabled:t,onClick:e,className:`-my-2 -mr-[10px] flex size-11 shrink-0 items-center justify-center rounded-md text-soft-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,children:(0,X.jsx)(A,{size:17,"aria-hidden":`true`,className:a(`size-[17px]`,t&&`motion-safe:animate-spin`)})})]}),(0,X.jsx)(Oe,{model:n,variant:`screen`})]})}function $e(e){let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`?e:e.closest(`[data-slot="main"]`)??e}function et(e){let[t,n]=(0,q.useState)(null);return(0,q.useLayoutEffect)(()=>{if(!e){n(null);return}let t=()=>n($e(e));t();let r=typeof window.matchMedia==`function`?window.matchMedia(`(min-width: 768px)`):null;r?.addEventListener(`change`,t);let i=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return i?.observe(e),()=>{r?.removeEventListener(`change`,t),i?.disconnect()}},[e]),t}function tt(e,t){let[n,r]=(0,q.useState)(0);return(0,q.useLayoutEffect)(()=>{let n=()=>{!e||!t||r(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return n(),window.addEventListener(`resize`,n),()=>window.removeEventListener(`resize`,n)},[e,t]),n}function nt(e,t,n){let[r,i]=(0,q.useState)(null),a=(0,q.useRef)(n);return(0,q.useEffect)(()=>{a.current=n}),(0,q.useEffect)(()=>{if(!e||!r||!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&a.current()},{root:t.getAttribute(`data-slot`)===`main`?null:t,rootMargin:`0px 0px 600px 0px`});return n.observe(r),()=>n.disconnect()},[e,r,t]),i}function rt(e,t,n,r,i){let[a,o]=(0,q.useState)(null),[s,c]=(0,q.useState)(null),l=et(a),u=(0,q.useRef)(null);u.current=l;let d=tt(s,l),f=e===`issues`?n?.issues.length??0:n?.prs.length??0,p=t.hasNextPage&&r===null&&f>0;return{listEl:a,setListEl:o,setRowsEl:c,scrollOwner:l,scrollOwnerRef:u,startMargin:d,pagingAvailable:p,manualPaging:p&&i,loadMoreRef:nt(p&&!i&&!t.isFetchingNextPage&&!t.isFetchNextPageError,l,()=>void t.fetchNextPage())}}var it=100;function at(e,t,n,r,i){if(!e?.available||t!==`prs`)return[];let a=new Set;n!==null&&Number.isInteger(n)&&a.add(n);for(let t of[...r,...i,...e.prs]){if(a.size>=it)break;a.add(t.number)}return[...a]}function ot(e,t,n,r,i,a){let o=at(n,e,r,i,a),s=y(o,e===`prs`),c=s.data?.available?s.data.checks:void 0,l=v(e===`issues`?`issue`:`pr`,(0,q.useMemo)(()=>(t.data?.pages??[]).map(t=>(e===`issues`?t.issues:t.prs).map(e=>e.number)),[t.data,e]),n?.available===!0&&n.commentsDeferred===!0),u=(0,q.useMemo)(()=>new Set(n?.commentsDeferred?(e===`issues`?n.issues:n.prs).map(e=>e.number):[]),[n,e]);return{checkPrNumbers:o,checksMap:c,commentsOf:e=>l[e.number]??(u.has(e.number)?void 0:e.comments)}}function st(e){let[t,n]=Ee(),r=t.get(`filter`),i=de(e,r);return{rawFilterParam:r,filter:i,activeFilter:i??`all`,setFilterParam:e=>n(t=>{let n=new URLSearchParams(t);return e===null?n.delete(`filter`):n.set(`filter`,e),n})}}function ct(e,t,{filter:n,activeFilter:r,setFilterParam:i}){let[a,o]=(0,q.useState)(``),[s,c]=(0,q.useState)([]),[l,u]=(0,q.useState)([]),{setProjectFilter:d,activeProject:f}=lt(t),p=e===`issues`&&r===`assigned`,m=p?t?.viewerLogin?[t.viewerLogin]:[]:l;return{query:a,setQuery:o,labelFilter:s,setLabelFilter:c,setProjectFilter:d,activeProject:f,isAssignedFilter:p,effectiveAssignees:m,changeAssignees:e=>{u(e),p&&i(`all`)},clearFilters:()=>{o(``),c([]),u([]),d(``),n!==null&&n!==`all`&&i(`all`)},filtering:a.trim()!==``||s.length>0||e===`issues`&&(m.length>0||f!==``)||n!==null&&n!==`all`,narrowing:a.trim()!==``||s.length>0||e===`issues`&&(!p&&l.length>0||f!==``)}}function lt(e){let[t,n]=(0,q.useState)(``),r=e?.projectsState===`refreshing`||e?.projectsState===`unavailable`,i=r||e?.projects?.some(e=>e.id===t)?t:``;return(0,q.useEffect)(()=>{e&&!r&&t&&!i&&n(``)},[e,t,i,r]),{setProjectFilter:n,activeProject:i}}function ut(e,t,{filter:n,activeFilter:i},a){let o=r(),s=e===`issues`&&(i===`no-task`||i===`has-task`),c=S(o,s,o==="default"),l=(0,q.useMemo)(()=>c.data?ce(c.data,t?.repo,o):null,[c.data,t?.repo,o]),u=se(e,n)?ae(n):null,d=b(`pr`,u??``,u!==null&&t?.available===!0),f=u!==null&&d.data?.available?d.data.items:null,p=(0,q.useMemo)(()=>t?.available?e===`issues`?t.issues:t.prs:[],[t,e]),m=(0,q.useMemo)(()=>f?le(f,p):null,[f,p]),h=dt({view:e,gh:t,activeFilter:i,isAssignedFilter:a,taskFilter:s,taskNumbers:l,runsQuery:c,backedQuery:u,filterHits:f,filterSearch:d});return{backedQuery:u,filterSearch:d,fullList:p,filterRows:m,filterGate:h,openItems:(0,q.useMemo)(()=>h?[]:m??p,[h,m,p]),narrow:(0,q.useMemo)(()=>e===`issues`?i===`no-task`&&l?{excludeNumbers:l}:i===`has-task`&&l?{includeNumbers:l}:{}:i===`mine`&&t?.viewerLogin?{author:t.viewerLogin}:f?{includeNumbers:new Set(f.map(e=>e.number))}:{},[e,i,l,t?.viewerLogin,f])}}function dt({view:e,gh:t,activeFilter:n,isAssignedFilter:r,taskFilter:i,taskNumbers:a,runsQuery:o,backedQuery:s,filterHits:c,filterSearch:l}){return t?.available?(r||e===`prs`&&n===`mine`)&&!t.viewerLogin?{kind:`blocked`,message:`GitHub login unavailable, so this filter cannot be applied.`}:i&&!a?o.isError?{kind:`blocked`,message:`The task list is unavailable, so this filter cannot be applied.`}:{kind:`loading`,message:`Loading tasks…`}:s!==null&&!c?l.data?.available===!1?{kind:`blocked`,message:`GitHub could not be searched: ${l.data.reason??`unknown reason`}.`}:l.isError?{kind:`blocked`,message:`GitHub could not be searched: ${l.error instanceof Error?l.error.message:`the search request failed`}.`}:{kind:`loading`,message:`Searching GitHub…`}:null:null}function $(e,t){return t?p(t.kind,t.number,{refresh:!0}).then(n=>(e.setQueryData(t.key,n),!0)).catch(()=>!1):Promise.resolve(!0)}function ft(e,t,n,{filterGate:r,filterRows:i,fullList:a}){let o=T.github()[0],s=t===void 0?null:Number.parseInt(t,10),c=!r&&n.data?.available?n.data.items.find(e=>e.number===s):void 0,l=i&&s!==null&&!a.some(e=>e.number===s)?i.find(e=>e.number===s):void 0,u=c??l,[d,f]=(0,q.useState)(null);return(0,q.useEffect)(()=>{u&&f({scope:o,view:e,item:u})},[o,e,u]),{selectedNumber:s,remoteDetail:u??(d?.scope===o&&d.view===e&&d.item.number===s?d.item:null)}}function pt(e,t,n,{fullList:r,filterRows:i},a){let o=u(),s=(0,q.useRef)(null),c=e===`issues`?`issue`:`pr`,l=t?.available===!0&&n!==null&&Number.isSafeInteger(n)&&n>0&&!r.some(e=>e.number===n)&&!i?.some(e=>e.number===n)&&a===null,d=C(c,n??0,l),f=l&&d.data?.available&&d.data.item?.kind===c?d.data.item:null;s.current=l&&n!==null?{kind:c,number:n,key:T.githubItem(c,n)}:null;let[p,m]=(0,q.useState)(!1);return{exactWanted:l,exactItem:d,exactDetail:f,exactTargetRef:s,retryingExact:p,retryExact:()=>{m(!0),$(o,s.current).then(e=>{m(!1),e||E(`Could not reach GitHub for #${n}`,{tone:`danger`})})}}}function mt(e,t,n){let r=u(),i=(0,q.useRef)(null);return{refresh:x({mutationFn:e=>($(r,e),f({refresh:!0,limit:50})),onSuccess:async a=>{await r.cancelQueries({queryKey:T.githubPages(50),exact:!0}),r.setQueryData(T.githubPages(50),{pages:[a],pageParams:[{}]}),r.invalidateQueries({queryKey:T.githubChecks(t)});let o=e===`issues`?`issue`:`pr`,s=(e===`issues`?a.issues:a.prs).map(e=>e.number),l=T.githubCommentCounts(o,s);r.removeQueries({queryKey:T.githubCommentCounts(o,[]).slice(0,4),predicate:e=>e.queryHash!==m(l)}),a.available&&a.commentsDeferred&&s.length>0&&d(o,s,{refresh:!0}).then(e=>r.setQueryData(l,e)).catch(()=>{}),r.invalidateQueries({queryKey:T.githubSearch(e===`issues`?`issue`:`pr`,n)}),r.invalidateQueries({queryKey:T.githubSearch(`pr`,oe)}),r.invalidateQueries({queryKey:T.githubSearch(`pr`,fe)});let u=i.current;if(!u){r.removeQueries({queryKey:[`github`,`comments`]});return}let f=T.githubComments(u.kind,u.number);c(u.kind,u.number,{refresh:!0}).then(e=>r.setQueryData(f,e)).catch(()=>{}),r.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==m(f)})},onError:e=>E(e.message,{tone:`danger`})}),openThreadRef:i}}var ht=350;function gt(e,t){let[n,r]=(0,q.useState)(e);return(0,q.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function _t(e,t,{query:n,labelFilter:r,effectiveAssignees:i,activeProject:a},{openItems:o,narrow:s,filterGate:c}){let l=gt(n,ht),u=(0,q.useMemo)(()=>G(o,{query:l,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),[o,l,r,e,i,a,s]),d=n.trim()===l.trim(),f=t?.available===!0&&!c&&d&&Me(l,u),p=b(e===`issues`?`issue`:`pr`,l,f),m=G(o,{query:n,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),h=f&&p.data?.available?p.data:null,g=new Set(m.map(e=>e.number)),_=vt(e,h,a,i);return{debouncedQuery:l,searchWanted:f,forgeSearch:p,items:m,searchPayload:h,metadataFailure:_,searchHits:h&&!_?G(h.items,{labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}).filter(e=>!g.has(e.number)):[],...yt(n,d,f,p)}}function vt(e,t,n,r){return e===`issues`&&t?n&&t.items.some(e=>e.projectIds===void 0)?t.projectsReason??`Project board data is incomplete. Refresh to try again.`:r.length&&t.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null}function yt(e,t,n,r){return{searching:e.trim()!==``&&!t||n&&r.isPending,searchFailed:n&&(r.data?.available===!1||r.isError),searchFailureReason:r.data?.available===!1?r.data.reason??`unknown reason`:r.error instanceof Error?r.error.message:`the search request failed`}}function bt({width:e,onWidthChange:t}){let n=(0,q.useRef)(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(Y(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,X.jsx)(`div`,{"data-slot":`gh-list-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the GitHub list`,"aria-valuenow":e,"aria-valuemin":280,"aria-valuemax":520,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?280:n.key===`End`?520:null;r!==null&&(n.preventDefault(),t(Y(r)))},onDoubleClick:()=>t(360),title:`Drag to resize the GitHub list — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 hidden w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-accent-strong/40 focus-visible:bg-accent-strong/60 focus-visible:outline-none md:block`})}function xt({view:e,changes:n=!1,index:r=!1}){let{n:i}=t(),a=st(e),{rawFilterParam:o,activeFilter:s}=a,c=xe(),{pages:l,data:u}=ne(50),d=ee().data?.capabilities?.automations===!0,f=Ct(),p=ze(),m=St({index:r,isDesktop:c,rawFilterParam:o,n:i,rememberedView:te().data?.githubView}),h=wt(u?.available===!0&&!m.filterScreen),[g,_]=(0,q.useState)(!1),v=ct(e,u,a),y=ut(e,u,a,v.isAssignedFilter),b=_t(e,u,v,y),x=ft(e,i,b.forgeSearch,y),S=pt(e,u,x.selectedNumber,y,x.remoteDetail),C=ot(e,l,u,x.selectedNumber,b.searchHits,y.openItems),{refresh:w,openThreadRef:T}=mt(e,C.checkPrNumbers,b.debouncedQuery),E=rt(e,l,u,y.backedQuery,v.narrowing);if(m.restorePrs)return(0,X.jsx)(ge,{to:`/github/prs`,replace:!0});if(!u)return l.isError?(0,X.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(U,{icon:(0,X.jsx)(j,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:l.error.message})}):(0,X.jsx)(Se,{});T.current=null;let D=()=>w.mutate(S.exactTargetRef.current);if(m.filterScreen&&u.available)return(0,X.jsx)(Qe,{onRefresh:D,refreshing:w.isPending});if(!u.available)return(0,X.jsx)(kt,{reason:u.reason,refreshing:w.isPending,onRetry:D});let{labelColors:O,labelOptions:k}=Tt(u,b.searchPayload,y.openItems,y.fullList),A=Et({number:x.selectedNumber,items:b.items,searchHits:b.searchHits,fullList:y.fullList,filterRows:y.filterRows,remoteDetail:x.remoteDetail,exactDetail:S.exactDetail});T.current=A?{kind:A.kind,number:A.number}:null;let{linkFilter:M,listPath:N}=Dt(e,o,s,c),P={view:e,filter:M,colors:O,selected:A,queued:p.queued,checksMap:C.checksMap,commentsOf:C.commentsOf},F=Ot(e,v,y.filterGate,b);return(0,X.jsxs)(`div`,{ref:h.routeRef,"data-route":`github`,className:`flex min-h-full flex-col gap-3 px-[18px] pt-[18px] pb-[calc(90px+env(safe-area-inset-bottom))] md:gap-[22px] md:px-7 md:pt-4 md:pb-4`,children:[(0,X.jsx)(At,{view:e,activeFilter:s,isDesktop:c,rawFilterParam:o,n:i,gh:u}),(0,X.jsxs)(`div`,{ref:h.workspaceRef,"data-slot":`gh-workspace`,"data-stacked":h.panesStacked,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 md:h-[calc(var(--gh-workspace-height,calc(100dvh-4rem))-1rem)] md:flex-none md:gap-[22px]`,children:[(0,X.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 bg-background md:gap-[22px]`,children:[(0,X.jsx)(jt,{view:e,isDesktop:c,gh:u,automationsAvailable:d,onSaveView:f,refreshing:w.isPending,onRefresh:D}),(0,X.jsx)(Mt,{view:e,gh:u,filters:v,labelOptions:k,labelColors:O,searchPayload:b.searchPayload})]}),(0,X.jsxs)(`div`,{"data-slot":`gh-panes`,className:`flex min-h-0 min-w-0 flex-1 flex-col items-start gap-[22px] md:flex-row md:items-stretch md:overflow-hidden`,children:[(0,X.jsx)(Ft,{view:e,n:i,rows:P,verdict:F,search:b,sidebar:y,list:l,paging:E,width:h.githubListWidth,onWidthChange:h.changeGithubListWidth,expanded:g,onExpandedChange:_}),(0,X.jsx)(Vt,{view:e,n:i,selected:A,selectedNumber:x.selectedNumber,exact:S,repo:u.repo,rows:P,listPath:N,changes:n,handToAgent:p})]})]})]})}function St({index:e,isDesktop:t,rawFilterParam:n,n:r,rememberedView:i}){return{filterScreen:e&&!t&&n===null&&r===void 0,restorePrs:e&&t&&n===null&&i===`prs`}}function Ct(){let e=u();return t=>{e.setQueryData(T.uiState,e=>({...e,githubView:t})),h({githubView:t}).then(t=>e.setQueryData(T.uiState,t)).catch(t=>{E(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:T.uiState})})}}function wt(e){let[t,n]=(0,q.useState)(Be),[r,i]=(0,q.useState)(!0),a=(0,q.useRef)(null),o=(0,q.useRef)(null);return(0,q.useEffect)(()=>{if(!e)return;let n=a.current,r=o.current,s=n?.closest(`[data-slot="main"]`);if(!n||!r||!s)return;let c=window.matchMedia(`(min-width: 768px)`),l=!1,u=()=>{if(l=c.matches&&r.clientWidth>=t+22+360,i(!l),!l||s.clientHeight<1){n.style.removeProperty(`--gh-workspace-height`);return}n.style.setProperty(`--gh-workspace-height`,`${Math.round(s.clientHeight)}px`)};u();let d=new ResizeObserver(u);d.observe(s),d.observe(r);let f=e=>{if(!l||e.ctrlKey||!e.deltaY||Math.abs(e.deltaX)>Math.abs(e.deltaY)||r.getBoundingClientRect().top<=s.getBoundingClientRect().top+1||!(e.target instanceof Element)||!e.target.closest(`[data-slot="gh-panes"]`))return;e.preventDefault();let t=e.deltaMode===1?16:e.deltaMode===2?s.clientHeight:1;s.scrollTop+=e.deltaY*t};return r.addEventListener(`wheel`,f,{passive:!1}),c.addEventListener(`change`,u),()=>{r.removeEventListener(`wheel`,f),d.disconnect(),c.removeEventListener(`change`,u)}},[e,t]),{githubListWidth:t,changeGithubListWidth:e=>{let t=Y(e);n(t),Ve(t)},panesStacked:r,routeRef:a,workspaceRef:o}}function Tt(e,t,n,r){return{labelColors:{...t?.labelColors,...e.labelColors},labelOptions:Pe([...n,...r,...t?.items??[]])}}function Et({number:e,items:t,searchHits:n,fullList:r,filterRows:i,remoteDetail:a,exactDetail:o}){return e===null?t[0]??n[0]??null:r.find(t=>t.number===e)??i?.find(t=>t.number===e)??a??o??null}function Dt(e,t,n,r){let i=t===null?null:n;return{linkFilter:i,listPath:V(e,i??(e===`issues`&&!r?`all`:null))}}function Ot(e,{query:t,filtering:n},r,{searching:i,searchFailed:a,searchFailureReason:o,metadataFailure:s,searchHits:c,searchPayload:l,items:u}){let d=e===`issues`?`issues`:`pull requests`;return r?(0,X.jsxs)(`p`,{role:`status`,className:`flex items-center gap-1.5`,"data-slot":`gh-filter-gate`,"data-kind":r.kind,children:[r.kind===`loading`?(0,X.jsx)(z,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):null,r.message]}):n?i?(0,X.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,X.jsx)(z,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,t.trim(),`”…`]}):a?c.length>0?(0,X.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,o,`. Use Refresh to try again.`]}):u.length>0?(0,X.jsxs)(`p`,{children:[`GitHub could not be searched: `,o,`.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,` match your filter, and GitHub could not be searched: `,o,`.`]}):s?(0,X.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,s]}):c.length>0?null:l?.truncated?(0,X.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):l&&u.length>0?(0,X.jsxs)(`p`,{children:[`No additional `,d,` match your filter on GitHub.`]}):l?(0,X.jsxs)(`p`,{children:[`No `,d,` match your filter — open, closed or merged.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,` match your filter.`]}):(0,X.jsxs)(`p`,{children:[`No open `,d,`.`]})}function kt({reason:e,refreshing:t,onRetry:r}){return(0,X.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(U,{icon:(0,X.jsx)(O,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:e??`unknown reason`,actions:(0,X.jsx)(i,{variant:`outline`,"data-action":`gh-retry`,disabled:t,onClick:r,children:`Try again`}),children:(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in `,n(`cezar`),` works without it.`]})})})}function At({view:e,activeFilter:t,isDesktop:n,rawFilterParam:r,n:i,gh:a}){return(0,X.jsxs)(`div`,{"data-slot":`gh-masthead`,className:`flex min-w-0 shrink-0 flex-col gap-1 md:flex-row md:items-baseline md:gap-3`,children:[(0,X.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[15px] md:tracking-normal`,children:n?`${e===`issues`?`Issues`:`Pull requests`} · ${he[t]}`:`GitHub`}),r!==null&&i===void 0?(0,X.jsxs)(`div`,{"data-slot":`gh-filter-context`,className:`flex min-w-0 items-center gap-3 md:hidden`,children:[(0,X.jsxs)(H,{to:`/github`,"data-slot":`gh-back-filters`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,X.jsx)(P,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to filters`]}),t===`all`?null:(0,X.jsx)(`span`,{"data-slot":`gh-active-filter`,className:`truncate text-xs text-soft-foreground`,children:[...me,...ue].find(e=>e.id===t)?.label})]}):null,a.repo?(0,X.jsxs)(`span`,{className:`min-w-0 truncate text-[13px] text-muted-foreground md:text-[11px] md:text-soft-foreground`,children:[(0,X.jsx)(`span`,{"data-slot":`gh-repo`,children:a.repo}),(0,X.jsxs)(`span`,{"data-slot":`gh-synced`,children:[` · `,a.syncedAt?`Synced ${B(a.syncedAt)} ago`:`Not synced yet`]})]}):null]})}function jt({view:e,isDesktop:t,gh:n,automationsAvailable:r,onSaveView:i,refreshing:o,onRefresh:s}){return(0,X.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,X.jsxs)(K,{to:t?`/github`:`/github?filter=all`,active:e===`issues`,onClick:()=>i(`issues`),children:[`Issues · `,n.issuesTotal??n.issues.length]}),(0,X.jsxs)(K,{to:`/github/prs`,active:e===`prs`,onClick:()=>i(`prs`),children:[`Pull requests · `,n.prsTotal??n.prs.length]}),r?(0,X.jsx)(H,{to:`/automations/new`,className:`gh-utility`,children:`Set up automations`}):null,(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:o,onClick:s,className:`gh-utility`,children:[(0,X.jsx)(A,{size:16,"aria-hidden":`true`,className:a(`size-3.5`,o&&`motion-safe:animate-spin`)}),`Refresh`]})]})}function Mt({view:e,gh:t,filters:n,labelOptions:r,labelColors:i,searchPayload:a}){return(0,X.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,X.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,X.jsx)(k,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,X.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:e===`issues`?`Filter issues…`:`Filter pull requests…`,value:n.query,onChange:e=>n.setQuery(e.target.value),className:`min-h-11 w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,X.jsx)(qt,{options:r,colors:i,selected:n.labelFilter,onChange:n.setLabelFilter}),e===`issues`?(0,X.jsx)(Ze,{data:{...t,issues:[...t.issues,...a?.items??[]]},assignees:n.effectiveAssignees,projectId:n.activeProject,onAssigneesChange:n.changeAssignees,onProjectChange:n.setProjectFilter}):null,(0,X.jsx)(`button`,{type:`button`,disabled:!n.filtering,className:`min-h-11 min-w-11 rounded-md border border-border bg-card px-4 text-xs disabled:opacity-50`,onClick:n.clearFilters,children:`Clear filters`})]})}function Nt(e,t){return e.kind===`pr`?t?.[e.number]??e.checks:e.checks}function Pt(e,t){return(0,X.jsx)(Kt,{item:e,view:t.view,filter:t.filter,colors:t.colors,active:t.selected?.url===e.url,queued:t.queued.has(e.url),checks:Nt(e,t.checksMap),comments:t.commentsOf(e)})}function Ft({view:e,n:t,rows:n,verdict:r,search:i,sidebar:a,list:o,paging:s,width:c,onWidthChange:l,expanded:u,onExpandedChange:d}){let{items:f,searchHits:p}=i,m=e===`issues`&&t!==void 0&&!u;return(0,X.jsxs)(`section`,{ref:s.setListEl,"data-slot":`gh-list`,"data-mobile-preview":m||void 0,style:{"--github-list-width":`${c}px`},className:`relative flex w-full min-h-0 min-w-0 flex-col rounded-lg border border-border bg-card p-3 md:w-[var(--github-list-width)] md:shrink-0 md:overflow-x-hidden md:overflow-y-auto`,children:[f.length===0?r&&(0,X.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:r}):(0,X.jsx)(It,{items:f,rows:n,compactPreview:m,paging:s}),s.pagingAvailable?(0,X.jsx)(Lt,{view:e,list:o,paging:s}):null,(0,X.jsx)(Rt,{backedQuery:a.backedQuery,filterSearch:a.filterSearch}),(0,X.jsx)(zt,{view:e,n:t,count:f.length,expanded:u,onExpandedChange:d}),f.length>0&&i.searchWanted&&r?(0,X.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-soft-foreground`,children:r}):null,p.length>0?(0,X.jsx)(Bt,{hits:p,searchPayload:i.searchPayload,rows:n}):null,(0,X.jsx)(bt,{width:c,onWidthChange:l})]})}function It({items:e,rows:t,compactPreview:n,paging:r}){let{setRowsEl:i,scrollOwner:a,listEl:o,scrollOwnerRef:s,startMargin:c}=r,l=e.map((e,r)=>(0,X.jsx)(`div`,{role:`listitem`,"data-slot":`gh-row-item`,"data-divided":r>0||void 0,"data-compact-hidden":n&&r>=2&&t.selected?.url!==e.url||void 0,children:Pt(e,t)},e.url));return(0,X.jsx)(`div`,{ref:i,"data-slot":`gh-rows`,"data-virtualized":a?`true`:void 0,role:`list`,children:a?(0,X.jsx)(Ce,{scrollRef:s,startMargin:c,children:l},a===o?`list`:`main`):l})}function Lt({view:e,list:t,paging:n}){return(0,X.jsx)(`div`,{ref:n.loadMoreRef,"data-slot":`gh-load-more`,className:`flex min-h-6 items-center justify-center gap-1.5 px-4 pb-3 text-xs text-soft-foreground`,children:t.isFetchingNextPage?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(z,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):t.isFetchNextPageError?(0,X.jsxs)(X.Fragment,{children:[`Could not load more.`,(0,X.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-retry`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Retry`})]}):n.manualPaging?(0,X.jsxs)(X.Fragment,{children:[`Filters cover the loaded `,e===`issues`?`issues`:`pull requests`,`.`,(0,X.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-manual`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Load more`})]}):null})}function Rt({backedQuery:e,filterSearch:t}){return e!==null&&t.data?.available&&t.data.truncated?(0,X.jsxs)(`div`,{"data-slot":`gh-filter-note`,role:`status`,className:`px-4 py-3 text-xs text-soft-foreground`,children:[`Showing the first `,t.data.items.length,` matches from GitHub search; more may exist.`]}):null}function zt({view:e,n:t,count:n,expanded:r,onExpandedChange:a}){return e===`issues`&&t!==void 0&&n>2?(0,X.jsx)(i,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":r,onClick:()=>a(e=>!e),children:r?`Show fewer issues`:`View all ${n} issues`}):null}function Bt({hits:e,searchPayload:t,rows:n}){return(0,X.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,X.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,t?.truncated?` (first matches)`:``]}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:e.map(e=>(0,X.jsx)(`li`,{children:Pt(e,n)},e.url))})]})}function Vt({view:e,n:t,selected:n,selectedNumber:r,exact:i,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}){let{exactWanted:d,exactItem:f}=i;return(0,X.jsx)(`section`,{"data-slot":`gh-detail`,className:a(`w-full min-w-0 min-h-0 flex-1 flex-col rounded-lg border border-border bg-card md:overflow-y-auto`,t===void 0?`hidden md:flex`:`flex`),children:n?(0,X.jsx)(Ht,{item:n,n:t,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}):d&&f.isPending?(0,X.jsx)(`div`,{"data-slot":`gh-detail-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,X.jsx)(U,{icon:(0,X.jsx)(z,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:`Loading #${r}…`,subtitle:`It is not among the open items, so the tab is asking GitHub for it.`})}):d&&(f.isError||f.data?.available===!1)?(0,X.jsx)(Ut,{number:r,exact:i}):(0,X.jsx)(Wt,{view:e,number:r})})}function Ht({item:e,n:t,repo:n,rows:r,listPath:i,changes:a,handToAgent:o}){let{workflows:s,skillList:c,workflow:l,setWorkflow:u,selectedSkills:d,setSelectedSkills:f,engine:p,setEngine:m,queued:h,onQueued:g}=o;return(0,X.jsx)(Ie,{item:e,comments:r.commentsOf(e),afterHeading:e.kind===`issue`?(0,X.jsx)(He,{number:e.number,repo:n},t??`list`):void 0,backLink:{to:i},subNav:{filter:r.filter,changes:a},onRunAgent:Gt,colors:r.colors,checks:Nt(e,r.checksMap),children:(0,X.jsx)(Fe,{item:e,workflows:s.data?.workflows??[],skills:c,workflow:l,onWorkflowChange:u,selectedSkills:d,onSkillsChange:f,engine:p,onEngineChange:m,queuedRunId:h.get(e.url)??null,onQueued:g},e.url)})}function Ut({number:e,exact:t}){let{exactItem:n,retryingExact:r,retryExact:a}=t;return(0,X.jsx)(U,{icon:(0,X.jsx)(j,{size:16}),tone:n.isError?`danger`:`neutral`,heading:`h2`,title:`Could not load #${e}`,subtitle:n.data?.available===!1?n.data.reason:n.error instanceof Error?n.error.message:`The request failed.`,actions:(0,X.jsx)(i,{variant:`outline`,disabled:r,onClick:a,children:`Retry`})})}function Wt({view:e,number:t}){return(0,X.jsx)(U,{icon:e===`issues`?(0,X.jsx)(N,{size:16}):(0,X.jsx)(D,{size:16}),tone:`neutral`,heading:`h2`,title:t===null?`Nothing selected`:`Not found`,subtitle:t===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${t} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${t} above to look it up on GitHub, closed and merged included.`})}function Gt(){let e=document.querySelector(`[data-slot="gh-detail-inner"] [data-slot="gh-custom-prompt"]`);e?.scrollIntoView({block:`center`}),e?.focus({preventScroll:!0})}function Kt({item:e,view:t,filter:n,colors:r,active:i,queued:o,checks:s,comments:l}){let d=e.kind===`issue`?N:D,f=u(),p=()=>{f.prefetchQuery({queryKey:T.githubComments(e.kind,e.number),queryFn:({signal:t})=>c(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,X.jsxs)(H,{to:V(t,n,e.number),draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Le(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:p,onFocus:p,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":i?`page`:void 0,title:`Drag into the composer to prefill a task`,className:a(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,i&&`bg-accent-strong/10 text-accent-text`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,X.jsx)(d,{"aria-hidden":`true`,className:a(`mt-0.5 size-3.5 shrink-0 md:mt-0`,e.kind===`issue`?`text-success`:`text-accent-icon`)}),(0,X.jsx)(`span`,{className:a(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,i&&`font-semibold`),children:e.title})]}),(0,X.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 pl-[22px] font-mono text-[11px] text-muted-foreground md:flex-nowrap md:gap-y-0`,children:[(0,X.jsxs)(`span`,{children:[`#`,e.number]}),(0,X.jsx)(`span`,{className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,X.jsx)(`span`,{children:B(e.createdAt)}),(0,X.jsx)(Ae,{count:l}),s?(0,X.jsx)(Ne,{checks:s}):null,o?(0,X.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-accent-text`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,X.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,X.jsx)(Re,{label:e,color:r[e],plain:!0},e))}):null]})}function qt({options:e,colors:t,selected:n,onChange:r}){let[i,o]=(0,q.useState)(!1),s=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,X.jsxs)(R,{open:i,onOpenChange:o,children:[(0,X.jsx)(I,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:a(`flex min-h-11 min-w-11 shrink-0 items-center gap-1 rounded-md border border-input bg-card px-2 py-1 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-accent-strong/60 text-foreground`),children:[n.length>0?`Labels · ${n.length}`:`Labels`,(0,X.jsx)(F,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`})]})}),(0,X.jsx)(L,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,X.jsxs)(ve,{children:[(0,X.jsx)(_e,{placeholder:`Filter labels…`}),(0,X.jsxs)(ye,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,X.jsx)(be,{children:`No labels.`}),n.length>0?(0,X.jsxs)(W,{value:`__clear__`,onSelect:()=>r([]),className:`min-h-11 text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,X.jsxs)(W,{value:e,onSelect:()=>s(e),className:`min-h-11`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:je(t[e])}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,X.jsx)(M,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}export{xt as GithubRoute};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{u as t}from"./button-CS5tOblf.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{Ut as i,_n as a,cn as o}from"./queries-BPdWfTBN.js";import{K as s,rt as c,u as l}from"./design-icons-DmYTv2r1.js";import{i as u,r as d,t as f}from"./popover-N-u5z2xh.js";import{c as p}from"./project-router-Dd63wBeA.js";import{A as m,E as h,M as g,N as _,O as v,j as y,k as b}from"./agent-accounts-CuRvwNoA.js";import{a as x}from"./skills-DFBiAuJG.js";var S=r();function C({className:e,...n}){return(0,S.jsx)(`div`,{"data-slot":`skeleton`,className:t(`animate-pulse rounded-md bg-accent`,e),...n})}var w=e(n(),1);function T({templates:e,onInsert:n,triggerClassName:r,disabled:i,iconOnly:a=!1,label:o=`Template`}){let[C,T]=(0,w.useState)(!1),E=(0,w.useRef)(null),D=p();return e.length===0?null:(0,S.jsxs)(f,{open:C,onOpenChange:T,children:[(0,S.jsx)(u,{asChild:!0,children:(0,S.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:i,className:t(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,a?`w-[26px] justify-center px-0`:`h-11 gap-2 rounded-lg px-3 text-foreground`,r),children:[(0,S.jsx)(s,{"aria-hidden":`true`,className:a?`size-3 shrink-0 text-accent-icon`:`size-[18px] shrink-0 text-muted-foreground`}),a?null:(0,S.jsxs)(S.Fragment,{children:[o,(0,S.jsx)(l,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-soft-foreground`})]})]})}),(0,S.jsx)(d,{align:`start`,sideOffset:8,"data-slot":`prompt-template-menu`,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,onCloseAutoFocus:e=>e.preventDefault(),children:(0,S.jsxs)(h,{filter:x,children:[(0,S.jsx)(m,{placeholder:`search templates…`,onInput:()=>E.current?.scrollTo(0,0)}),(0,S.jsxs)(g,{ref:E,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,S.jsx)(v,{children:`Nothing matches.`}),(0,S.jsx)(b,{heading:`Insert a template`,children:e.map(e=>(0,S.jsxs)(y,{value:`template ${e.label} ${e.id}`,keywords:[e.text,...e.skills??[]],"data-slot":`prompt-template-option`,"data-template":e.id,title:e.text,className:`flex-col items-start gap-0.5`,onSelect:()=>{n(e.text),T(!1)},children:[(0,S.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium text-foreground`,children:e.label}),e.skills&&e.skills.length>0?(0,S.jsxs)(`span`,{"data-slot":`prompt-template-assigned`,title:`Applied automatically with: ${e.skills.join(`, `)}`,className:`inline-flex shrink-0 items-center gap-0.5 text-[12px] font-medium text-accent-text`,children:[(0,S.jsx)(c,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,S.jsx)(`span`,{className:`line-clamp-1 text-[11px] text-soft-foreground`,children:e.text})]},e.id))}),(0,S.jsx)(_,{}),(0,S.jsx)(b,{children:(0,S.jsx)(y,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-[12px] text-muted-foreground`,onSelect:()=>{T(!1),D(`/settings/prompt-templates`)},children:`Edit templates…`})})]})]})})]})}var E=[`assigned`,`no-task`,`has-task`,`all`],D=[`review`,`mine`,`failing`,`all`],O=50,k=`is:open review-requested:@me`,A=`is:open status:failure`;function j(e,t){return e===`prs`&&(t===`review`||t===`failing`)}function M(e){return e===`review`?k:e===`failing`?A:null}function N(e,t){return t===null?null:(e===`issues`?E:D).includes(t)?t:`all`}function P(e,t,n,r=``){let i=`${n===void 0?e===`issues`?`/github`:`/github/prs`:`${e===`issues`?`/github/issues`:`/github/prs`}/${n}`}${r}`;return t===null?i:`${i}?filter=${encodeURIComponent(t)}`}function F(e,t){let n=t??`all`;return n===`all`?e===`issues`?`all`:`all-prs`:n}function I(e){return e===`all`?{view:`issues`,filter:`all`}:e===`all-prs`?{view:`prs`,filter:`all`}:{view:e===`review`||e===`mine`||e===`failing`?`prs`:`issues`,filter:e}}var L=[{id:`assigned`,label:`Assigned to me`},{id:`no-task`,label:`No task yet`},{id:`has-task`,label:`Has a task`},{id:`all`,label:`All open`}],R=[{id:`review`,label:`Review requested`},{id:`mine`,label:`Mine`},{id:`failing`,label:`Checks failing`},{id:`all-prs`,label:`All open`}],z=Object.fromEntries([...L,...R].map(e=>[e.id,e.label]));function B(e){return e===null?``:`${e.value}${e.bound===`atLeast`?`+`:``}`}function V(e,t){if(t?.bound===`atLeast`)return e===`review`||e===`failing`?`At least ${t.value}: GitHub search returns at most ${O} results.`:`At least ${t.value}: only the loaded pages are counted. Scroll to load more.`}var H=(e,t)=>e!==void 0&&t!==void 0&&e.toLowerCase()===t.toLowerCase();function U(e){try{let t=new URL(e).pathname.split(`/`).filter(Boolean);return t.length>=2?`${t[0]}/${t[1]}`.toLowerCase():null}catch{return null}}function W(e,t,n){return new Set(e.filter(e=>!e.archived).flatMap(e=>G(e,t,n)))}function G(e,t,n){let r=t?.toLowerCase();return o(e,void 0,n).filter(e=>e.kind===`Issue`&&(!e.url||r!==void 0&&U(e.url)===r)).map(e=>e.number)}function K(e,t,n,r){let i=new Map;for(let o of e)!a(o)&&G(o,n,r).includes(t)&&i.set(o.id,o);return[...i.values()].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt)||e.id.localeCompare(t.id))}function q(e,t){let n=new Map(t.map(e=>[e.number,e]));return e.map(e=>n.get(e.number)??e)}function J(e){return e?.available?{value:e.items.length,bound:e.truncated?`atLeast`:`exact`}:null}function Y({gh:e,tasks:t,review:n,failing:r}){let a={assigned:null,"no-task":null,"has-task":null,all:null,review:J(n),mine:null,failing:J(r),"all-prs":null};if(!e?.available)return a;let o=!i(e,`issues`),s=!i(e,`prs`),c=(e,t)=>({value:e,bound:t?`atLeast`:`exact`}),l=t?e.issues.filter(e=>t.has(e.number)).length:null;return{...a,all:c(e.issuesTotal??e.issues.length,!1),"all-prs":c(e.prsTotal??e.prs.length,!1),assigned:e.viewerLogin?c(e.issues.filter(t=>t.assignees?.some(t=>H(t,e.viewerLogin))).length,o):null,mine:e.viewerLogin?c(e.prs.filter(t=>H(t.author,e.viewerLogin)).length,s):null,"has-task":l===null?null:c(l,o),"no-task":l===null?null:c(e.issues.length-l,o)}}export{M as _,k as a,I as c,j as d,W as f,q as g,F as h,R as i,B as l,N as m,A as n,V as o,K as p,L as r,Y as s,z as t,P as u,T as v,C as y};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,p as n,t as r,u as i}from"./button-CS5tOblf.js";import{i as a,t as o}from"./react-runtime-CCIEwYL0.js";import{$ as s,P as c}from"./queries-BPdWfTBN.js";import{A as l,B as u,D as d,F as f,I as p,J as m,K as h,M as g,O as _,P as v,Q as ee,R as te,S as ne,V as y,W as b,X as x,Z as S,_ as re,a as ie,b as ae,d as C,f as oe,h as se,i as w,j as T,k as E,l as D,n as O,o as k,p as A,q as j,r as M,t as N,u as P,v as F,x as I,y as L,z as R}from"./activity-motion-XsGcc9eM.js";import{U as z,W as B}from"./index-lMBPAedr.js";var V=e(a(),1);function H(e,t){if(!t||t.length===0)return[...e];let n=new Map(t.map((e,t)=>[e,t])),r=e.filter(e=>n.has(e.projectId)),i=e.filter(e=>!n.has(e.projectId));return r.sort((e,t)=>(n.get(e.projectId)??0)-(n.get(t.projectId)??0)),[...r,...i]}function U(e){let t=[],n=[];for(let r of e)y(r)===void 0&&r.tasks.length===0?n.push(r):t.push(r);return{panels:t,idle:n}}function W(e){let t=new Set(e.tasks.map(e=>e.runId));return e.requests.filter(e=>e.relationship===`peer`&&t.has(e.senderRunId)&&t.has(e.recipientRunId))}function G(e,t){let n=new Set(e.map(e=>e.runId));return t.filter(e=>n.has(e.waiterRunId)&&n.has(e.peerRunId))}function K(e){let t=e.tasks.length,n=e.tasks.reduce((e,t)=>e+t.workers.filter(e=>j(e.status)).length,0),r=[`${t} active task${t===1?``:`s`}`];return n>0&&r.push(`${n} worker${n===1?``:`s`}`),r.join(` · `)}function ce(e,t){let n=t?`more `:``;return e===1?`1 ${n}project has no active work:`:`${e} ${n}projects have no active work:`}var q=o(),le={w:104,h:20};function ue(e){let t=e.getBoundingClientRect(),n=new Map;for(let r of e.querySelectorAll(`[data-activity-pill]`)){let e=r.getAttribute(`data-activity-pill`);e&&n.set(e,ae(r.getBoundingClientRect(),t))}return n}function de(e,t,n=[]){let r=ue(e),i=[...r.values()],a=[...t.map(e=>({requestId:e.requestId,senderRunId:e.senderRunId,recipientRunId:e.recipientRunId,kind:`peer`})),...n.map(e=>({...F(e),kind:`wait`}))],o=I(a),s=[];for(let e of a){let t=r.get(e.senderRunId),n=r.get(e.recipientRunId);t&&n&&s.push({id:e.requestId,kind:e.kind,...L(t,n,i,o.get(e.requestId))})}let c=ne(s.map(e=>({id:e.id,at:e.label})),le,`x`);return s.map(e=>({...e,label:c.get(e.id)??e.label}))}function fe(e,t){return e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.d===t[n]?.d&&e.label.x===t[n]?.label.x&&e.label.y===t[n]?.label.y)}var J=`pointer-events-none absolute z-[4] -translate-x-1/2 -translate-y-1/2 rounded-md border bg-background px-1.5 py-px text-[10.5px] whitespace-nowrap text-foreground tabular-nums max-md:hidden`;function pe({arc:e,wait:t,now:n,motion:r}){return(0,q.jsxs)(`span`,{"data-slot":`activity-arc-label`,"data-wait":t.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y},className:i(J,`border-dashed border-message-peer-accent`,t.id in r.waitsClosing&&`activity-line-out`),children:[(0,q.jsx)(`span`,{className:`font-semibold text-message-peer-accent`,children:`Waiting`}),` · `,x(S(t.since,n))]})}function me({arc:e,request:t,now:n,motion:r}){let a=oe(r,e.id);return(0,q.jsxs)(`span`,{"data-slot":`activity-arc-label`,"data-request":e.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y},className:i(J,a?`border-success`:`border-message-peer-accent`,C(r,e.id)===`fade`&&`activity-line-out`),children:[a?(0,q.jsx)(`span`,{className:`font-semibold text-success`,children:`Replied`}):(0,q.jsx)(`span`,{className:`font-semibold text-message-peer-accent`,children:`Request`}),` · `,x(S(t.createdAt,n))]})}var he=[],ge=new Set;function _e({arcs:e,waits:t=he,active:n=ge,layoutKey:r,now:a,motion:o=f,paused:s=!1}){let c=V.useRef(null),l=se(c,V.useCallback(n=>de(n,e,t),[e,t]),fe,`[data-activity-pill]`,r),u=V.useMemo(()=>new Set(l.map(e=>e.id)),[l]),d=re(o.comets,u,s),p=new Map(e.map(e=>[e.requestId,e])),m=new Map(t.map(e=>[e.id,e])),h=V.useId().replace(/[^a-zA-Z0-9_-]/g,``),g=`activity-arrow-arc-${h}`,_=`activity-ring-arc-${h}`;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`svg`,{ref:c,"data-slot":`activity-arcs`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-[3] size-full overflow-visible max-md:hidden`,children:[(0,q.jsxs)(`defs`,{children:[(0,q.jsx)(`marker`,{id:g,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,q.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-peer-accent`})}),(0,q.jsx)(D,{id:_})]}),l.map(e=>{if(e.kind===`wait`){let t=n.has(e.id);return(0,q.jsx)(`path`,{"data-wait":e.id,"data-kind":`wait`,"data-active":t?`true`:void 0,d:e.d,fill:`none`,strokeDasharray:`0 8`,strokeLinecap:`round`,strokeWidth:t?3:2.2,markerEnd:`url(#${_})`,className:i(`stroke-message-peer-accent`,t?`opacity-100`:`opacity-80`,A(o,e.id))},e.id)}let t=C(o,e.id);return(0,q.jsx)(`path`,{"data-request":e.id,"data-kind":`peer`,"data-phase":t,d:e.d,fill:`none`,strokeDasharray:t===`replied`?void 0:`6 5`,strokeWidth:2,markerEnd:`url(#${g})`,className:i(`stroke-message-peer-accent`,P(t,e.id in o.opening))},e.id)}),(0,q.jsx)(`g`,{ref:d,"data-slot":`activity-comets`})]}),l.map(e=>{let t=e.kind===`wait`?m.get(e.id):void 0;if(t)return(0,q.jsx)(pe,{arc:e,wait:t,now:a,motion:o},e.id);let n=p.get(e.id);return n?(0,q.jsx)(me,{arc:e,request:n,now:a,motion:o},e.id):null})]})}var Y=(e,t)=>`/p/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}`,ve=[],ye=`relative z-[1] inline-flex min-h-11 items-center text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring`;function be({task:e}){let t=e.workers.filter(e=>j(e.status));return t.length===0?null:(0,q.jsxs)(`div`,{"data-slot":`activity-pill-workers`,className:`mt-1.5 ml-[19px] flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[t.map(e=>(0,q.jsx)(g,{run:e,role:`worker`},e.runId)),(0,q.jsxs)(`span`,{className:`ml-0.5`,children:[t.length,` worker`,t.length===1?``:`s`]})]})}function xe({projectId:e,task:t,requests:r,waits:a=ve,index:o,ctx:s,motion:c=f,linked:u=!1,onHover:p}){let h=m(t,s);return(0,q.jsxs)(`li`,{"data-activity-pill":t.runId,"data-rung":t.rung,"data-linked":u?`true`:void 0,...E(t.runId,p),className:i(`relative min-w-0 rounded-[10px] border bg-card-2 px-2.5 py-2`,h.action?`border-pending`:`border-border`,u&&`outline-2 outline-offset-2 outline-message-peer-accent`,t.runId in c.entering&&`activity-card-enter`),children:[(0,q.jsx)(d,{task:t,motion:c,glow:h.action!==void 0}),(0,q.jsxs)(`div`,{className:`flex items-center gap-[7px]`,children:[(0,q.jsx)(g,{run:t,role:`root`}),(0,q.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[12.5px] font-medium`,children:(0,q.jsx)(n,{to:Y(e,t.runId),className:`after:absolute after:inset-0 after:rounded-[10px] after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:t.title})}),(0,q.jsx)(l,{rate:t.rate,className:`h-3 w-10`})]}),(0,q.jsxs)(`p`,{"data-slot":`activity-pill-line`,className:`mt-[3px] ml-[19px] truncate text-[11.5px] text-muted-foreground tabular-nums`,children:[(0,q.jsx)(v,{"data-slot":`activity-verb`,tone:h.tone,className:`font-semibold`,children:h.verb}),` · `,(0,q.jsx)(`span`,{"data-slot":`activity-main`,className:i(h.mono&&`font-mono text-[11px]`),children:h.main})]}),(0,q.jsx)(_,{texts:te(t.runId,r,o,a)}),(0,q.jsx)(be,{task:t}),(0,q.jsx)(T,{runId:t.runId,requests:r,waits:a,index:o,link:n,pathOf:t=>Y(e,t),className:`mt-1 ml-[19px] flex flex-col md:hidden`,linkClassName:ye})]})}var X=e=>`/p/${encodeURIComponent(e)}/activity`,Se=e=>`/p/${encodeURIComponent(e)}/`,Z=`rounded-xl border border-border bg-card px-4 pt-3.5 pb-4`,Ce=`ml-auto inline-flex items-center text-[12px] text-accent-text hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`;function Q({project:e,headingId:t,detail:r,to:i,label:a}){return(0,q.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,q.jsx)(`h2`,{id:t,className:`min-w-0 truncate text-[14px] font-semibold`,children:e.name}),(0,q.jsx)(`span`,{"data-slot":`activity-panel-detail`,className:`text-[12px] text-muted-foreground`,children:r}),(0,q.jsx)(n,{to:i,className:Ce,children:a})]})}function $({project:e,notice:t}){let n=V.useId();return(0,q.jsx)(`section`,{"aria-labelledby":n,"data-slot":`activity-panel`,"data-project":e.projectId,"data-notice":`true`,className:Z,children:(0,q.jsx)(Q,{project:e,headingId:n,detail:t,to:Se(e.projectId),label:`Open project →`})})}function we(e,t){return V.useMemo(()=>{let n=new Set(e.requests.map(e=>e.requestId)),r=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!n.has(t.request.requestId)).map(e=>e.request);return W({tasks:e.tasks,requests:[...e.requests,...r]})},[e,t.closing])}function Te({project:e,now:t,motion:n=f,paused:r=!1}){let a=V.useId(),o=V.useMemo(()=>b(e),[e]),s=we(e,n),c=V.useMemo(()=>u(e.tasks),[e.tasks]),l=V.useMemo(()=>G(e.tasks,[...c,...p(e.projectId,c,n)]),[e.tasks,e.projectId,c,n]),d=k(c),m={now:t,titleOf:e=>R(o,e)},h=`${e.tasks.map(e=>e.runId).join(`,`)}:${s.map(e=>e.requestId).join(`,`)}:${l.map(e=>e.id).join(`,`)}`,g=s.length>0||l.length>0;return(0,q.jsxs)(`section`,{"aria-labelledby":a,"data-slot":`activity-panel`,"data-project":e.projectId,className:Z,children:[(0,q.jsx)(Q,{project:e,headingId:a,detail:K(e),to:X(e.projectId),label:`Open project activity →`}),(0,q.jsxs)(`div`,{className:i(`relative mt-3`,g&&`md:mt-1 md:pt-10`),children:[(0,q.jsx)(`ul`,{"data-slot":`activity-pills`,"aria-label":`${e.name} tasks`,className:i(`grid grid-cols-[repeat(auto-fill,minmax(min(100%,220px),1fr))] items-start gap-3.5`,g&&`md:gap-y-11`),children:e.tasks.map(t=>(0,q.jsx)(xe,{projectId:e.projectId,task:t,requests:e.requests,waits:c,index:o,ctx:m,motion:n,linked:d.linked.has(t.runId),onHover:d.onHover},t.runId))}),g?(0,q.jsx)(_e,{arcs:s,waits:l,active:d.active,layoutKey:h,now:t,motion:n,paused:r}):null]})]})}function Ee(e){let t=y(e.project);return t===void 0?(0,q.jsx)(Te,{...e}):(0,q.jsx)($,{project:e.project,notice:t})}function De({projects:e,belowPanels:t}){return e.length===0?null:(0,q.jsxs)(`p`,{"data-slot":`activity-idle`,className:`text-[12.5px] text-muted-foreground`,children:[ce(e.length,t),` `,e.map((e,t)=>(0,q.jsxs)(V.Fragment,{children:[t>0?`, `:null,(0,q.jsx)(n,{to:X(e.projectId),"data-project":e.projectId,className:`text-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:e.name})]},e.projectId))]})}var Oe={kind:`workspace`};function ke(){let e=s().data?.projects,{order:t}=z();return V.useMemo(()=>e?B(e,t).map(e=>e.id):void 0,[e,t])}function Ae(){let e=ee(Oe),n=s(),i=c(),a=t().state?.activityProjectId,o=ke(),l=N(e.data?.generatedAt,e.dataUpdatedAt),u=n.data?.bootProject??i.data?.bootProject??null,d=typeof a==`string`&&n.data?.projects.some(e=>e.id===a&&e.status!==`missing`)?a:u,f=e.data?.projects,p=V.useMemo(()=>U(H(f??[],o)),[f,o]),{motion:m,paused:g,reduced:_}=O(e.data,`workspace`);return(0,q.jsxs)(`div`,{"data-route":`activity-global`,"data-activity-paused":g?`true`:void 0,className:`flex min-h-full w-full flex-col gap-4 px-[18px] py-6 md:px-7`,children:[(0,q.jsx)(M,{name:`All projects`,now:e.data?l:void 0,stale:e.isError,children:(0,q.jsx)(w,{scope:`all`,projectId:d})}),f?(0,q.jsx)(ie,{summary:h(f),tasksTo:`/tasks`,bumps:m.bumps}):null,e.isPending?(0,q.jsx)(`p`,{"data-slot":`activity-loading`,role:`status`,className:`text-xs text-muted-foreground`,children:`Loading activity…`}):null,e.isError&&!f?(0,q.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-3 text-[13px] text-muted-foreground`,children:[`Could not load activity: `,e.error.message,(0,q.jsx)(r,{size:`sm`,variant:`outline`,onClick:()=>void e.refetch(),className:`max-md:min-h-11`,children:`Retry`})]}):null,f&&p.panels.length===0&&p.idle.length===0?(0,q.jsx)(`p`,{"data-slot":`activity-empty`,className:`py-6 text-[13px] text-muted-foreground`,children:`No projects to show.`}):null,(0,q.jsx)(`div`,{"data-slot":`activity-panels`,className:`flex flex-col gap-3.5`,children:p.panels.map(e=>(0,q.jsx)(Ee,{project:e,now:l,motion:m,paused:g||_},e.projectId))}),(0,q.jsx)(De,{projects:p.idle,belowPanels:p.panels.length>0})]})}export{Ae as GlobalActivityRoute};