@open-mercato/cezar 0.9.1-pr470.729 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -13
- package/dist/config.d.ts +3 -7
- package/dist/config.js +1 -3
- package/dist/config.js.map +1 -1
- package/dist/core/agent-env.js +15 -21
- package/dist/core/agent-env.js.map +1 -1
- package/dist/core/agent-runner.d.ts +6 -16
- package/dist/core/agent-runner.js +3 -15
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/backend-detect.d.ts +5 -5
- package/dist/core/backend-detect.js +5 -37
- package/dist/core/backend-detect.js.map +1 -1
- package/dist/core/model-identity.js +0 -4
- package/dist/core/model-identity.js.map +1 -1
- package/dist/core/model-presets.js +0 -5
- package/dist/core/model-presets.js.map +1 -1
- package/dist/core/runner-factory.js +0 -3
- package/dist/core/runner-factory.js.map +1 -1
- package/dist/core/ui-events.d.ts +1 -1
- package/dist/runs/store.d.ts +12 -13
- package/dist/runs/store.js +2 -3
- package/dist/runs/store.js.map +1 -1
- package/dist/server/open-in-app.d.ts +1 -2
- package/dist/server/open-in-app.js +0 -1
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/server.d.ts +0 -7
- package/dist/server/server.js +7 -102
- package/dist/server/server.js.map +1 -1
- package/dist/server-install/steps.js +2 -6
- package/dist/server-install/steps.js.map +1 -1
- package/dist/workflows/types.d.ts +14 -14
- package/dist/workflows/types.js +1 -2
- package/dist/workflows/types.js.map +1 -1
- package/dist/workspace/config.d.ts +0 -11
- package/dist/workspace/config.js +0 -13
- package/dist/workspace/config.js.map +1 -1
- package/package.json +1 -1
- package/web/dist/assets/{centered-state-Dk2G08OJ.js → centered-state-DOsTcJZF.js} +11 -11
- package/web/dist/assets/{commit-list-BKRBe1ff.js → commit-list-BrxBEzRK.js} +1 -1
- package/web/dist/assets/{compare-variants-BcWTGJrd.js → compare-variants-Bv2c9ORF.js} +1 -1
- package/web/dist/assets/{diff-view-CFQ0zXBT.js → diff-view-DCeSegKk.js} +3 -3
- package/web/dist/assets/{dist-DC3TJo3T.js → dist-B6XQOhgM.js} +1 -1
- package/web/dist/assets/{git-toolbar-CaBCbiSp.js → git-toolbar-pIC1ubPM.js} +1 -1
- package/web/dist/assets/github-DTTSG0ht.js +1 -0
- package/web/dist/assets/index-Cijmlz7q.js +30 -0
- package/web/dist/assets/index-DzroxqBG.css +2 -0
- package/web/dist/assets/{project-router-CXmL3t6s.js → project-router-BMx4e8m-.js} +1 -1
- package/web/dist/assets/{repo-git-D5N2okPE.js → repo-git-BusYfa3t.js} +1 -1
- package/web/dist/assets/{run-diff-3xRPsGI4.js → run-diff-wOJ3odA-.js} +2 -2
- package/web/dist/assets/run-header-Cg5incil.js +1 -0
- package/web/dist/assets/skills-PpP2owbM.js +1 -0
- package/web/dist/assets/{tab-link-Q8NhDqnE.js → tab-link-F3uQrdm2.js} +1 -1
- package/web/dist/assets/{task-changes-DHpP7WS3.js → task-changes-iD9kS79I.js} +1 -1
- package/web/dist/assets/{task-commits-D0IcDbGX.js → task-commits-COkLaUri.js} +1 -1
- package/web/dist/assets/{task-files-DvKQHU1f.js → task-files-Ckttz7XH.js} +2 -2
- package/web/dist/assets/task-thread-CQD91VPt.js +9 -0
- package/web/dist/assets/{use-desktop-M42tdz-1.js → use-desktop-DUh0STzq.js} +2 -2
- package/web/dist/assets/workflows-BFk8C0co.js +11 -0
- package/web/dist/index.html +5 -5
- package/dist/core/pi-runner.d.ts +0 -24
- package/dist/core/pi-runner.js +0 -342
- package/dist/core/pi-runner.js.map +0 -1
- package/dist/core/pi-ui-mapper.d.ts +0 -24
- package/dist/core/pi-ui-mapper.js +0 -255
- package/dist/core/pi-ui-mapper.js.map +0 -1
- package/dist/skills-update.d.ts +0 -88
- package/dist/skills-update.js +0 -392
- package/dist/skills-update.js.map +0 -1
- package/scripts/mock-pi-rpc.mjs +0 -83
- package/web/dist/assets/circle-check-ClxqLJCI.js +0 -1
- package/web/dist/assets/github-Dn-ZvcbO.js +0 -1
- package/web/dist/assets/index-CDk4tcLt.js +0 -30
- package/web/dist/assets/index-CwNZ1v7S.css +0 -2
- package/web/dist/assets/run-header-Bd1vyMz_.js +0 -1
- package/web/dist/assets/skills-C5b1tbwv.js +0 -1
- package/web/dist/assets/task-thread-JlVT8p1a.js +0 -9
- package/web/dist/assets/workflows-D_gHO2WW.js +0 -11
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{t as r}from"./utils-B8s5qIcK.js";import{C as i,S as a,
|
|
1
|
+
import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{t as r}from"./utils-B8s5qIcK.js";import{C as i,S as a,an as o,rt as s,w as c}from"./index-Cijmlz7q.js";import{t as l}from"./lib-DPEZDBUN.js";import{n as u,t as d}from"./image-preview-DEhW0TFz.js";var f=n(t(),1),p=44;function m(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 h(e){return m(e)*20+p}function g(e){return e.reduce((e,t)=>e+m(t),0)}function _(e,t){let n=new URLSearchParams(e).get(`diff`);return n===`flat`||n===`virtual`?n:t>1500?`virtual`:`flat`}function v(e){return`${e.oldPath??``}→${e.path}`}function y(e){let t=0;for(let n of e.split(`
|
|
3
3
|
`))n.length>t&&(t=n.length);return t}var b=/[A-Za-z0-9_]+|\s+|[^\sA-Za-z0-9_]+/g,x=300,S=.3;function C(e,t){if(e===t)return null;let n=e.match(b)??[],r=t.match(b)??[];if(n.length===0||r.length===0||n.length>x||r.length>x)return null;let i=r.length+1,a=new Uint16Array((n.length+1)*i);for(let e=1;e<=n.length;e++)for(let t=1;t<=r.length;t++)a[e*i+t]=n[e-1]===r[t-1]?(a[(e-1)*i+(t-1)]??0)+1:Math.max(a[(e-1)*i+t]??0,a[e*i+(t-1)]??0);if((a[n.length*i+r.length]??0)/Math.max(n.length,r.length)<S)return null;let o=Array(n.length).fill(!1),s=Array(r.length).fill(!1),c=n.length,l=r.length;for(;c>0&&l>0;)n[c-1]===r[l-1]?(o[c-1]=!0,s[l-1]=!0,c--,l--):(a[(c-1)*i+l]??0)>=(a[c*i+(l-1)]??0)?c--:l--;return{del:w(n,o),add:w(r,s)}}function w(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 T(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 E=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,D=`… (patch truncated)`;function O(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=E.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(D)){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 k(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 A(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 j(e,t){let n=Array(e.length),r=Array(t.length),i=Math.min(e.length,t.length);for(let a=0;a<i;a++){let i=C(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 M(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(j(t,i))}else t(i),r++}}function N(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}),M(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 P(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}),M(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 F=e(),I=1500,L=new Map;function R(e,t){if(e){for(let n of e.querySelectorAll(`[data-slot="diff-file"]`))if(n.dataset.path===t)return n}}function z({files:e,mode:t=`unified`,wrap:n=!1,loadFileText:i,imageSrc:a,onOpenInApp:
|
|
5
|
-
`));y(n=>{let i=v(e);return new Map(n).set(i,new Map(n.get(i)??L).set(t.beforeHunk,r))})},[i]),S=(0,f.useMemo)(()=>g(e),[e]),[C]=(0,f.useState)(()=>typeof window>`u`?``:window.location.search),w=_(C,S),T=(0,f.useRef)(null),E=(0,f.useRef)(null),D=(0,f.useRef)(null);(0,f.useImperativeHandle)(c,()=>({scrollToPath:t=>{let n=e.findIndex(e=>e.path===t);if(n===-1)return;let r=E.current;r?r.scrollToIndex(n,{align:`start`}):R(D.current,t)?.scrollIntoView({block:`start`,behavior:`smooth`})}}),[e]);let O=e=>{let r=v(e);return(0,F.jsx)(H,{file:e,open:!d.has(r),onToggle:()=>b(r),expanded:m.get(r)??L,onExpand:t=>void x(e,t),mode:t,wrap:n,canExpand:i!==void 0,imageSrc:a,onOpenInApp:
|
|
4
|
+
`);o.at(-1)===``&&o.pop();for(let e of o){let o=E.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(D)){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 k(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 A(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 j(e,t){let n=Array(e.length),r=Array(t.length),i=Math.min(e.length,t.length);for(let a=0;a<i;a++){let i=C(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 M(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(j(t,i))}else t(i),r++}}function N(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}),M(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 P(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}),M(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 F=e(),I=1500,L=new Map;function R(e,t){if(e){for(let n of e.querySelectorAll(`[data-slot="diff-file"]`))if(n.dataset.path===t)return n}}function z({files:e,mode:t=`unified`,wrap:n=!1,loadFileText:i,imageSrc:a,onOpenInApp:o,viewRef:c,className:l}){let u=(0,f.useMemo)(()=>({adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length}),[e]),[d,p]=(0,f.useState)(()=>new Set),[m,y]=(0,f.useState)(()=>new Map),b=(0,f.useCallback)(e=>{p(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},[]),x=(0,f.useCallback)(async(e,t)=>{if(!i)return;let n=await i(e.path);if(n===null)return;let r=A(t,n.split(`
|
|
5
|
+
`));y(n=>{let i=v(e);return new Map(n).set(i,new Map(n.get(i)??L).set(t.beforeHunk,r))})},[i]),S=(0,f.useMemo)(()=>g(e),[e]),[C]=(0,f.useState)(()=>typeof window>`u`?``:window.location.search),w=_(C,S),T=(0,f.useRef)(null),E=(0,f.useRef)(null),D=(0,f.useRef)(null);(0,f.useImperativeHandle)(c,()=>({scrollToPath:t=>{let n=e.findIndex(e=>e.path===t);if(n===-1)return;let r=E.current;r?r.scrollToIndex(n,{align:`start`}):R(D.current,t)?.scrollIntoView({block:`start`,behavior:`smooth`})}}),[e]);let O=e=>{let r=v(e);return(0,F.jsx)(H,{file:e,open:!d.has(r),onToggle:()=>b(r),expanded:m.get(r)??L,onExpand:t=>void x(e,t),mode:t,wrap:n,canExpand:i!==void 0,imageSrc:a,onOpenInApp:o})};return(0,F.jsxs)(`div`,{ref:e=>{D.current=e,e&&(T.current=e.closest(`[data-slot="main"]`))},"data-slot":`diff`,"data-mode":t,className:r(`flex min-w-0 flex-col`,l),children:[(0,F.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 pb-3 text-xs text-muted-foreground`,children:[(0,F.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,F.jsx)(s,{stat:u})]}),w===`virtual`?(0,F.jsx)(B,{files:e,handleRef:E,scrollElRef:T,card:O}):(0,F.jsx)(`div`,{"data-slot":`diff-files`,"data-virtualized":`false`,children:e.map(e=>(0,F.jsx)(`div`,{"data-slot":`diff-file-slot`,style:{containIntrinsicBlockSize:`auto ${h(e)}px`},className:`pb-3 [content-visibility:auto]`,children:O(e)},v(e)))})]})}function B({files:e,handleRef:t,scrollElRef:n,card:r}){let i=(0,f.useRef)(null),[a,o]=(0,f.useState)(0);return(0,f.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,F.jsx)(`div`,{ref:e=>{i.current=e,e&&(n.current=e.closest(`[data-slot="main"]`))},"data-slot":`diff-files`,"data-virtualized":`true`,children:(0,F.jsx)(l,{ref:t,scrollRef:n,startMargin:a,children:e.map(e=>(0,F.jsx)(`div`,{"data-slot":`diff-file-slot`,className:`pb-3`,children:r(e)},v(e)))})})}var V={added:`added`,deleted:`deleted`,renamed:`renamed`,copied:`copied`};function H({file:e,open:t,onToggle:n,expanded:i,onExpand:a,mode:c,wrap:l,canExpand:u,imageSrc:d,onOpenInApp:f}){let p=V[e.status];return(0,F.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,F.jsx)(`header`,{className:`sticky top-[var(--diff-sticky-top,0px)] z-10 rounded-t-md border-b border-border/50 bg-card`,children:(0,F.jsxs)(`button`,{type:`button`,"data-slot":`diff-file-header`,"aria-expanded":t,onClick:n,className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted/50`,children:[(0,F.jsx)(o,{className:r(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),(0,F.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`span`,{className:`text-soft-foreground`,children:[e.oldPath,` → `]}),e.path]}):e.path}),p?(0,F.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:p}):null,e.image?(0,F.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:`image`}):e.binary?(0,F.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:`binary`}):null,(0,F.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,F.jsx)(s,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]})}),t?(0,F.jsx)(U,{file:e,expanded:i,onExpand:a,mode:c,wrap:l,canExpand:u,imageSrc:d,onOpenInApp:f}):null]})}function U({file:e,expanded:t,onExpand:n,mode:i,wrap:a,canExpand:o,imageSrc:s,onOpenInApp:c}){let l=(0,f.useMemo)(()=>O(e.patch),[e.patch]),p=o&&e.status!==`added`&&e.status!==`deleted`,m=(0,f.useMemo)(()=>k(l.hunks,p),[l.hunks,p]),h=(0,f.useMemo)(()=>{let e=[];l.hunks.forEach((n,r)=>{let i=t.get(r);i&&e.push(...i),e.push(...n.lines)});let n=t.get(l.hunks.length);return n&&e.push(...n),e},[l.hunks,t]),g=(0,f.useMemo)(()=>new Map(h.map((e,t)=>[e,t])),[h]),_=W(e.path,h),v=(0,f.useMemo)(()=>i===`unified`?N(l.hunks,m,t):null,[i,l.hunks,m,t]),b=(0,f.useMemo)(()=>i===`split`?P(l.hunks,m,t):null,[i,l.hunks,m,t]),x=(0,f.useMemo)(()=>i===`unified`&&!a?{minInlineSize:`calc(${y(e.patch)}ch + 7rem)`}:void 0,[i,a,e.patch]);if(u(e))return(0,F.jsx)(d,{file:e,imageSrc:s,onOpenInApp:c});if(e.binary)return(0,F.jsx)(G,{children:`Binary file — no text diff.`});if(l.hunks.length===0)return(0,F.jsx)(G,{children:l.truncated?`Patch truncated by the server.`:`No content changes (metadata only).`});let S=e=>{if(!_)return null;let t=g.get(e);return t===void 0?null:_[t]??null};return(0,F.jsxs)(`div`,{"data-slot":`diff-file-body`,"data-wrap":a||void 0,className:r(`py-1 font-mono text-xs leading-[1.7]`,!a&&`overflow-x-auto`),children:[(0,F.jsxs)(`div`,{"data-slot":`diff-rows`,style:x,className:`[&>*]:[contain-intrinsic-block-size:auto_20px] [&>*]:[content-visibility:auto]`,children:[v?v.map((e,t)=>(0,F.jsx)(Q,{row:e,wrap:a,tokensFor:S,onExpand:p?n:void 0},t)):null,b?b.map((e,t)=>(0,F.jsx)(ee,{row:e,wrap:a,tokensFor:S,onExpand:p?n:void 0},t)):null]}),l.truncated?(0,F.jsx)(G,{children:`Patch truncated by the server — counts above remain exact.`}):null]})}function W(e,t){let n=(0,f.useMemo)(()=>t.length>I?null:t.map(e=>e.text).join(`
|
|
6
6
|
`),[t]),r=(0,f.useMemo)(()=>c(e),[e]),[o,s]=(0,f.useState)(null);return(0,f.useEffect)(()=>{if(n===null||r===null)return;let e=!1;return a(n,r).then(t=>{e||s({text:n,tokens:t.tokens})}),()=>{e=!0}},[n,r]),n===null||r===null?null:o?.text===n?o.tokens:i(n,r)?.tokens??null}function G({children:e}){return(0,F.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:e})}var K={add:`bg-diff-add`,del:`bg-diff-del`,context:void 0},q={add:`+`,del:`−`,context:` `};function J({hunk:e}){return(0,F.jsx)(`div`,{"data-slot":`diff-hunk`,className:`bg-muted/40 px-4 py-0.5 whitespace-pre text-soft-foreground`,children:e.header})}function Y({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,F.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,F.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 X({cell:e,tokens:t,wrap:n}){let i=T(t,e.spans,e.line.text),a=e.line.kind===`add`?`bg-diff-add-strong`:`bg-diff-del-strong`;return(0,F.jsxs)(`span`,{className:r(`min-w-0 flex-1 pr-4`,n?`break-words whitespace-pre-wrap`:`whitespace-pre`),children:[i.map((t,n)=>(0,F.jsx)(`span`,{"data-word":t.changed?e.line.kind:void 0,style:t.color===void 0?void 0:{color:t.color},className:t.changed?r(`rounded-[2px]`,a):void 0,children:t.text},n)),e.line.text===``?` `:``]})}function Z({value:e}){return(0,F.jsx)(`span`,{className:`w-10 shrink-0 pr-2 text-right text-soft-foreground/70 tabular-nums select-none`,children:e??``})}function Q({row:e,wrap:t,tokensFor:n,onExpand:i}){if(e.type===`hunk`)return(0,F.jsx)(J,{hunk:e.hunk});if(e.type===`gap`)return(0,F.jsx)(Y,{gap:e.gap,onExpand:i});let{line:a}=e.cell;return(0,F.jsxs)(`div`,{"data-slot":`diff-line`,"data-line":a.kind,className:r(`flex`,K[a.kind]),children:[(0,F.jsx)(Z,{value:a.oldLine}),(0,F.jsx)(Z,{value:a.newLine}),(0,F.jsx)(`span`,{className:`w-4 shrink-0 text-soft-foreground select-none`,children:q[a.kind]}),(0,F.jsx)(X,{cell:e.cell,tokens:n(a),wrap:t})]})}function ee({row:e,wrap:t,tokensFor:n,onExpand:r}){return e.type===`hunk`?(0,F.jsx)(J,{hunk:e.hunk}):e.type===`gap`?(0,F.jsx)(Y,{gap:e.gap,onExpand:r}):(0,F.jsxs)(`div`,{"data-slot":`diff-pair`,className:`grid grid-cols-2`,children:[(0,F.jsx)($,{cell:e.left,side:`old`,tokensFor:n,wrap:t}),(0,F.jsx)($,{cell:e.right,side:`new`,tokensFor:n,wrap:t})]})}function $({cell:e,side:t,tokensFor:n,wrap:i}){if(!e)return(0,F.jsx)(`div`,{"data-slot":`diff-cell-empty`,className:r(`bg-muted/20`,t===`new`&&`border-l border-border/40`)});let{line:a}=e;return(0,F.jsxs)(`div`,{"data-slot":`diff-cell`,"data-line":a.kind,className:r(`flex min-w-0`,K[a.kind],t===`new`&&`border-l border-border/40`),children:[(0,F.jsx)(Z,{value:t===`old`?a.oldLine:a.newLine}),(0,F.jsx)(`span`,{className:`w-4 shrink-0 text-soft-foreground select-none`,children:q[a.kind]}),(0,F.jsx)(X,{cell:e,tokens:n(a),wrap:i})]})}export{z as DiffView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{E as r,_ as i,b as a,c as o,d as s,f as c,g as l,h as u,l as d,p as f,s as p,u as m,w as h,x as g,y as _}from"./centered-state-
|
|
1
|
+
import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{E as r,_ as i,b as a,c as o,d as s,f as c,g as l,h as u,l as d,p as f,s as p,u as m,w as h,x as g,y as _}from"./centered-state-DOsTcJZF.js";var v=n(t(),1),y=e(),b=`Dialog`,[x,S]=a(b),[C,w]=x(b),T=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=v.useRef(null),l=v.useRef(null),[d,f]=i({prop:r,defaultProp:a??!1,onChange:o,caller:b});return(0,y.jsx)(C,{scope:t,triggerRef:c,contentRef:l,contentId:u(),titleId:u(),descriptionId:u(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(e=>!e),[f]),modal:s,children:n})};T.displayName=b;var E=`DialogTrigger`,D=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=w(E,n),o=r(t,a.triggerRef);return(0,y.jsx)(g.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":q(a.open),...i,ref:o,onClick:_(e.onClick,a.onOpenToggle)})});D.displayName=E;var O=`DialogPortal`,[k,A]=x(O,{forceMount:void 0}),j=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=w(O,t);return(0,y.jsx)(k,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,y.jsx)(l,{present:n||a.open,children:(0,y.jsx)(m,{asChild:!0,container:i,children:e})}))})};j.displayName=O;var M=`DialogOverlay`,N=v.forwardRef((e,t)=>{let n=A(M,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(M,e.__scopeDialog);return a.modal?(0,y.jsx)(l,{present:r||a.open,children:(0,y.jsx)(F,{...i,ref:t})}):null});N.displayName=M;var P=h(`DialogOverlay.RemoveScroll`),F=v.forwardRef((e,t)=>{let{__scopeDialog:n,...i}=e,a=w(M,n),s=r(t,f());return(0,y.jsx)(o,{as:P,allowPinchZoom:!0,shards:[a.contentRef],children:(0,y.jsx)(g.div,{"data-state":q(a.open),...i,ref:s,style:{pointerEvents:`auto`,...i.style}})})}),I=`DialogContent`,L=v.forwardRef((e,t)=>{let n=A(I,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=w(I,e.__scopeDialog);return(0,y.jsx)(l,{present:r||a.open,children:a.modal?(0,y.jsx)(R,{...i,ref:t}):(0,y.jsx)(z,{...i,ref:t})})});L.displayName=I;var R=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),i=v.useRef(null),a=r(t,n.contentRef,i);return v.useEffect(()=>{let e=i.current;if(e)return p(e)},[]),(0,y.jsx)(B,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:_(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:_(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:_(e.onFocusOutside,e=>e.preventDefault())})}),z=v.forwardRef((e,t)=>{let n=w(I,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,y.jsx)(B,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),B=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,l=w(I,n);return d(),(0,y.jsx)(y.Fragment,{children:(0,y.jsx)(s,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,y.jsx)(c,{role:`dialog`,id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":q(l.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})}),V=`DialogTitle`,H=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(V,n);return(0,y.jsx)(g.h2,{id:i.titleId,...r,ref:t})});H.displayName=V;var U=`DialogDescription`,W=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(U,n);return(0,y.jsx)(g.p,{id:i.descriptionId,...r,ref:t})});W.displayName=U;var G=`DialogClose`,K=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=w(G,n);return(0,y.jsx)(g.button,{type:`button`,...r,ref:t,onClick:_(e.onClick,()=>i.onOpenChange(!1))})});K.displayName=G;function q(e){return e?`open`:`closed`}export{N as a,D as c,W as i,S as l,K as n,j as o,L as r,H as s,T as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{a as r}from"./centered-state-
|
|
1
|
+
import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{a as r}from"./centered-state-DOsTcJZF.js";import{n as i,r as a,t as o}from"./utils-B8s5qIcK.js";import{t as s}from"./ellipsis-vertical-CNnSLn5a.js";import{n as c}from"./tab-link-F3uQrdm2.js";import{t as l}from"./file-D4GBh1ao.js";import{a as u,i as d,r as f}from"./use-desktop-DUh0STzq.js";import{t as p}from"./git-pull-request-DnR8Xh4_.js";import{t as m}from"./square-terminal-Ckjjn0vb.js";import{t as h}from"./upload-CDdyPPo_.js";import{an as g,dt as _,lt as v,mt as y,nn as b,rt as x,ut as S}from"./index-Cijmlz7q.js";var C=a(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),w=n(t(),1),T=e();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:r}){let[i,a]=(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":i?`open`:`closed`,"aria-expanded":i,onClick:()=>a(e=>!e),className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,T.jsx)(g,{"aria-hidden":`true`,className:o(`size-3.5 shrink-0 transition-transform`,i&&`rotate-90`)}),(0,T.jsx)(b,{"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})]}),i?(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:r},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:t+1,selected:n,onSelect:r},e.path))]}):null]})}var k={added:`text-success`,deleted:`text-danger`};function A({file:e,depth:t,selected:n,onSelect:r}){let i=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":i?`true`:void 0,onClick:()=>r(e.path),className:o(`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,i?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,T.jsx)(l,{"aria-hidden":`true`,className:o(`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,branch:t,stat:n,mode:i,wrap:a,onModeChange:o,onWrapChange:c,onAction:l}){return(0,T.jsxs)(`div`,{"data-slot":`git-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[t?(0,T.jsx)(f,{branch:t}):null,n?(0,T.jsx)(R,{stat:n}):null,(0,T.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,T.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,T.jsx)(d,{mode:i,wrap:a,onModeChange:o,onWrapChange:c})}),e.secondary.map(e=>(0,T.jsx)(L,{action:e,variant:`outline`,onAction:l},e.id)),(0,T.jsx)(L,{action:e.primary,variant:`primary`,onAction:l}),e.menu.length>0?(0,T.jsxs)(v,{children:[(0,T.jsx)(y,{asChild:!0,children:(0,T.jsx)(r,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,children:(0,T.jsx)(s,{"aria-hidden":`true`})})}),(0,T.jsx)(S,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,T.jsxs)(_,{disabled:!e.enabled,title:e.reason,onSelect:()=>l(e.id),children:[I[e.id],e.label]},e.id))})]}):null]})]})}var I={commit:(0,T.jsx)(u,{"aria-hidden":`true`}),push:(0,T.jsx)(h,{"aria-hidden":`true`}),"create-pr":(0,T.jsx)(p,{"aria-hidden":`true`}),"view-pr":(0,T.jsx)(c,{"aria-hidden":`true`}),"open-terminal":(0,T.jsx)(m,{"aria-hidden":`true`})};function L({action:e,variant:t,onAction:n}){return e.id===`view-pr`?i(e.href)?(0,T.jsx)(r,{asChild:!0,variant:t,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)(r,{variant:t,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)(r,{variant:t,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>n(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)(x,{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{C as a,E as i,F as n,P as r,R as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,s as t,u as n}from"./bundle-mjs-BegPhL5c.js";import{A as r,Dt as i,Kt as a,L as o,Nt as s,Pt as c,R as l,a as u,dn as d,dt as f,hn as p,ht as m,i as h,k as g,pn as ee,pt as _,t as v,xn as y}from"./centered-state-DOsTcJZF.js";import{n as b,r as x,t as S}from"./utils-B8s5qIcK.js";import{t as C}from"./arrow-left-CnSdp92h.js";import{n as w,t as T}from"./tab-link-F3uQrdm2.js";import{t as E}from"./git-pull-request-DnR8Xh4_.js";import{t as D}from"./refresh-cw-BT8E96Tm.js";import{t as O}from"./triangle-alert-Uy8rokUh.js";import{n as k,t as te}from"./textarea-Bj_LCreg.js";import{r as A,t as j}from"./project-router-BMx4e8m-.js";import{A as M,Ct as N,D as ne,E as re,Et as P,F,Ft as I,H as L,It as R,J as ie,Jt as z,Kt as ae,L as B,M as oe,Mt as V,N as H,Nt as U,O as W,P as G,Pt as K,Qt as se,R as q,Rt as ce,St as le,Tt as J,Yt as ue,bt as de,j as fe,jt as Y,k as pe,kt as X,on as me,qt as he,rn as ge,vt as _e,wt as ve,x as ye,y as be,z as xe}from"./index-Cijmlz7q.js";var Se=x(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),Ce=x(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),we=x(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),Z=n(t(),1),Q=e();function $({className:e,...t}){return(0,Q.jsx)(`div`,{"data-slot":`skeleton`,className:S(`animate-pulse rounded-md bg-accent`,e),...t})}function Te(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Ee(e,t=[]){let n=Te(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=De(t)),n}function De(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Oe(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function ke(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function Ae(e,t,n){let r=(n??``).trim();if(!r)return Ee(e,t);let i=Te(e),a=r.startsWith(i)?i+Oe(r.slice(i.length),e):Oe(r,e),o=ke(a,e)?a:`${i}\n\n${a}`;return t.length?o+De(t):o}function je(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function Me(e,t,n,r,i={}){return t?{...i,workflow:t,task:Ae(e,n,r)}:n.length?{...i,steps:je(n),task:Ae(e,[],r)}:{...i,workflow:`quick-task`,task:Ae(e,[],r)}}function Ne(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function Pe(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function Fe(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}var Ie={workflow:null,skills:[]},Le=`cez-followup-selection`;function Re(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function ze(){try{let e=localStorage.getItem(Le);return e?Re(JSON.parse(e)):{...Ie}}catch{return{...Ie}}}function Be(e){try{localStorage.setItem(Le,JSON.stringify(e))}catch{}}var Ve=`cez-followup-prompt:`;function He(e){try{return localStorage.getItem(Ve+e)??``}catch{return``}}function Ue(e,t){try{t===``?localStorage.removeItem(Ve+e):localStorage.setItem(Ve+e,t)}catch{}}function We({item:e,workflows:t,skills:n,workflow:o,onWorkflowChange:s,selectedSkills:c,onSkillsChange:l,engine:d,onEngineChange:f,queuedRunId:m,onQueued:v}){let y=p(),b=_(),x=e.kind===`pr`?`PR`:`issue`,S=c.filter(e=>n.some(t=>t.name===e)),[C]=(0,Z.useState)(()=>Te(e)),[w,T]=(0,Z.useState)(()=>He(e.url)||C),E=xe(d),D=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{Ue(e.url,w===C?``:w)},[e.url,w,C]);let O=(0,Z.useMemo)(()=>M(b.data?.promptTemplates),[b.data?.promptTemplates]),A=e=>{let t=D.current,n=w===C?w.length:t?.selectionStart??w.length,r=pe(w,n,e);T(r.text),requestAnimationFrame(()=>{D.current?.focus(),D.current?.setSelectionRange(r.caret,r.caret)})},N=W(O,S),P=(0,Z.useRef)(w);P.current=w;let F=(0,Z.useRef)(``);(0,Z.useEffect)(()=>{let e=fe(P.current,F.current,N,C);F.current=e.applied,e.text!==P.current&&T(e.text)},[N,C]);let I=ee({mutationFn:()=>i(Me(e,o,S,w,q(E))),onSuccess:t=>{let n=`runs`in t?t.runs[0]:t;n&&v(e.url,n.id),h(`Added to the queue — ${x} #${e.number}`),S.length>0&&b.data!==void 0&&a({skillUsage:S.reduce((e,t)=>_e(e,t),b.data.skillUsage)}).then(()=>y.invalidateQueries({queryKey:r.uiState})).catch(()=>{}),Ue(e.url,``),T(C),F.current=``,y.invalidateQueries({queryKey:r.runs.all})},onError:e=>h(e.message,{tone:`danger`})}),L=e=>{re({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),I.isPending||I.mutate())},R=e=>l(c.includes(e)?c.filter(t=>t!==e):[...c,e]);return(0,Q.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Q.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:[(0,Q.jsx)(ae,{"aria-hidden":`true`,className:`size-3.5 text-violet`}),`Hand this to the agent`]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(Ge,{workflows:t,value:o,onChange:s}),(0,Q.jsx)(Ke,{skills:n,skillUsage:b.data?.skillUsage,selected:S,onToggle:R}),(0,Q.jsx)(B,{pick:d,onChange:f,disabled:I.isPending}),(0,Q.jsx)(oe,{templates:O,onInsert:A})]}),S.length>0?(0,Q.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:S.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>R(e),title:`Remove this skill`,className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,Q.jsx)(k,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,Q.jsx)(te,{ref:D,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:w,onChange:e=>T(e.target.value),onKeyDown:L,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`}),(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,Q.jsxs)(u,{variant:`contrast`,"data-action":`gh-run`,disabled:I.isPending,onClick:()=>I.mutate(),children:[(0,Q.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,x]}),(0,Q.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:ne()}),m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Q.jsx)(j,{to:`/tasks/${m}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-violet hover:underline`,children:`View task →`})]}):null]})]})}function Ge({workflows:e,value:t,onChange:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(``),s=(0,Z.useRef)(null),c=J(e,a);return(0,Q.jsxs)(H,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Q.jsx)(F,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:S(L,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,Q.jsx)(he,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,Q.jsx)(`span`,{className:`max-w-44 truncate`,children:t??`workflow`}),(0,Q.jsx)(me,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Q.jsx)(G,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(Y,{shouldFilter:!1,children:[(0,Q.jsx)(K,{placeholder:`search workflows…`,value:a,onValueChange:o,onInput:()=>s.current?.scrollTo(0,0)}),(0,Q.jsxs)(R,{ref:s,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,Q.jsx)(V,{children:`Nothing matches.`}):null,(0,Q.jsx)(U,{children:c.map(e=>{let r=t===e.name;return(0,Q.jsxs)(I,{value:`workflow ${e.name}`,keywords:P(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),i(!1)},children:[(0,Q.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Q.jsx)(g,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.name)})})]})]})})]})}function Ke({skills:e,skillUsage:t,selected:n,onToggle:r}){let[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(null),u=(0,Z.useRef)(null),{mostUsed:d,project:f,global:p}=N(ve(e,o,t),t),m=(e,t)=>{let i=n.includes(e.name);return(0,Q.jsxs)(I,{value:`skill ${e.name} ${e.path}`,keywords:P(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":i?`true`:void 0,onSelect:()=>r(e.name),children:[(0,Q.jsx)(`span`,{className:S(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Q.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),l(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Q.jsx)(ge,{"aria-hidden":`true`,className:`size-3.5`})}),i?(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.path)};return e.length===0?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(be,{skill:c,onClose:()=>l(null)}),(0,Q.jsxs)(H,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Q.jsx)(F,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:S(L,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Q.jsx)(z,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Q.jsx)(me,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Q.jsx)(G,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Q.jsxs)(Y,{shouldFilter:!1,children:[(0,Q.jsx)(K,{placeholder:`search skills…`,value:o,onValueChange:s,onInput:()=>u.current?.scrollTo(0,0)}),(0,Q.jsxs)(R,{ref:u,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[d.length===0&&f.length===0&&p.length===0?(0,Q.jsx)(V,{children:`Nothing matches.`}):null,d.length>0?(0,Q.jsx)(U,{heading:`Most used`,children:d.map(e=>m(e,de(e)))}):null,f.length>0?(0,Q.jsx)(U,{heading:`Project skills`,children:f.map(e=>m(e,!0))}):null,p.length>0?(0,Q.jsx)(U,{heading:`Global`,children:p.map(e=>m(e,!1))}):null]})]})})]})]})}var qe=30,Je=1e3;function Ye(){return _().data?.githubView===`prs`?(0,Q.jsx)(A,{to:`/github/prs`,replace:!0}):(0,Q.jsx)(Xe,{view:`issues`})}function Xe({view:e}){let{n:t}=d(),n=o(),i=o({limit:Je},n.data?.available===!0),l=i.data?.available?i.data:n.data,g=i.data?.available===!0,b=p(),x=e=>{b.setQueryData(r.uiState,t=>({...t,githubView:e})),a({githubView:e}).then(e=>b.setQueryData(r.uiState,e)).catch(e=>{h(e instanceof Error?e.message:String(e),{tone:`danger`}),b.invalidateQueries({queryKey:r.uiState})})},C=(0,Z.useRef)(null),w=ee({mutationFn:()=>s({refresh:!0}),onSuccess:e=>{b.setQueryData(r.github({}),e),b.invalidateQueries({queryKey:r.github({limit:Je})});let t=C.current;if(!t){b.removeQueries({queryKey:[`github`,`comments`]});return}let n=r.githubComments(t.kind,t.number);c(t.kind,t.number,{refresh:!0}).then(e=>b.setQueryData(n,e)).catch(()=>{}),b.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==y(n)})},onError:e=>h(e.message,{tone:`danger`})}),k=m(),te=f(),A=_(),[j,M]=(0,Z.useState)(()=>ze().workflow),[N,ne]=(0,Z.useState)(()=>ze().skills),[re,P]=(0,Z.useState)({runner:null,model:null});(0,Z.useEffect)(()=>{Be({workflow:j,skills:[...N]})},[j,N]);let F=k.data?.workflows;(0,Z.useEffect)(()=>{F&&j!==null&&!F.some(e=>e.name===j)&&M(null)},[F,j]);let I=te.data,L=A.data?.skillUsage,R=(0,Z.useMemo)(()=>le(I??[],L),[I,L]),[z,ae]=(0,Z.useState)(new Map),[B,oe]=(0,Z.useState)(``),[V,H]=(0,Z.useState)([]);if(!l)return n.isError?(0,Q.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(v,{icon:(0,Q.jsx)(O,{}),tone:`danger`,title:`Could not load GitHub`,subtitle:n.error.message})}):(0,Q.jsx)(ie,{});if(C.current=null,!l.available)return(0,Q.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(v,{icon:(0,Q.jsx)(ce,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:l.reason??`unknown reason`,actions:(0,Q.jsx)(u,{variant:`outline`,"data-action":`gh-retry`,disabled:w.isPending,onClick:()=>w.mutate(),children:`Try again`}),children:(0,Q.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Q.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in cezar works without it.`]})})});let U=e===`issues`?l.issues:l.prs,W=l.labelColors??{},G=Ne(U),K=Pe(U,{query:B,labels:V}),se=B.trim()!==``||V.length>0,q=t===void 0?null:Number.parseInt(t,10),J=q===null?K[0]??null:U.find(e=>e.number===q)??null;C.current=J?{kind:J.kind,number:J.number}:null;let de=e===`issues`?`/github`:`/github/prs`;return(0,Q.jsxs)(`div`,{"data-route":`github`,className:`flex h-full min-h-0 items-stretch`,children:[(0,Q.jsxs)(`section`,{"data-slot":`gh-list`,className:S(`w-full min-h-0 flex-col overflow-y-auto overscroll-contain border-border md:flex md:w-[360px] md:shrink-0 md:border-r`,t===void 0?`flex`:`hidden`),children:[(0,Q.jsxs)(`header`,{"data-slot":`gh-header`,className:`sticky top-0 z-10 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,Q.jsx)(`h1`,{className:`text-lg font-semibold`,children:`GitHub`}),l.repo?(0,Q.jsx)(`span`,{"data-slot":`gh-repo`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,children:l.repo}):null,(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:w.isPending,onClick:()=>w.mutate(),className:`ml-auto flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-[10px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,Q.jsx)(D,{"aria-hidden":`true`,className:S(`size-[9px]`,w.isPending&&`motion-safe:animate-spin`)}),l.syncedAt?`synced ${X(l.syncedAt)} ago`:`refresh`]})]}),(0,Q.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,Q.jsxs)(T,{to:`/github`,active:e===`issues`,onClick:()=>x(`issues`),children:[`Issues · `,Ze(l.issues.length,g)]}),(0,Q.jsxs)(T,{to:`/github/prs`,active:e===`prs`,onClick:()=>x(`prs`),children:[`Pull requests · `,Ze(l.prs.length,g)]})]}),(0,Q.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 pb-3`,children:[(0,Q.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,Q.jsx)(ue,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,Q.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:B,onChange:e=>oe(e.target.value),className:`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,Q.jsx)($e,{options:G,colors:W,selected:V,onChange:H})]})]}),K.length===0?(0,Q.jsx)(`p`,{className:`px-4 py-4 text-sm text-soft-foreground`,children:se?`No ${e===`issues`?`issues`:`pull requests`} match your filter.`:`No open ${e===`issues`?`issues`:`pull requests`}.`}):(0,Q.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-0.5 px-2 py-2`,children:K.map(t=>(0,Q.jsx)(Qe,{item:t,view:e,colors:W,active:J?.url===t.url,queued:z.has(t.url)},t.url))})]}),(0,Q.jsx)(`section`,{"data-slot":`gh-detail`,className:S(`min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,t===void 0?`hidden md:flex`:`flex`),children:J?(0,Q.jsx)(tt,{item:J,listPath:de,colors:W,children:(0,Q.jsx)(We,{item:J,workflows:k.data?.workflows??[],skills:R,workflow:j,onWorkflowChange:M,selectedSkills:N,onSkillsChange:ne,engine:re,onEngineChange:P,queuedRunId:z.get(J.url)??null,onQueued:(e,t)=>ae(n=>new Map(n).set(e,t))},J.url)}):(0,Q.jsx)(v,{icon:e===`issues`?(0,Q.jsx)(Se,{}):(0,Q.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:q===null?`Nothing selected`:`Not in the open list`,subtitle:q===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${q} is not among the open ${e===`issues`?`issues`:`pull requests`} — it may be closed, or still outside the fetched batch.`})})]})}function Ze(e,t){return`${e}${!t&&e>=qe?`+`:``}`}function Qe({item:e,view:t,colors:n,active:r,queued:i}){let a=e.kind===`issue`?Se:E;return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(j,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Ee(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},"data-slot":`gh-row`,"data-number":e.number,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:S(`flex flex-col gap-1 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,r&&`bg-muted`),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(a,{"aria-hidden":`true`,className:S(`size-3.5 shrink-0`,e.kind===`issue`?`text-success`:`text-violet`)}),(0,Q.jsx)(`span`,{className:S(`min-w-0 truncate text-[13px] font-medium`,r&&`font-semibold`),children:e.title})]}),(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 pl-[22px] font-mono text-[10.5px] text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{children:[`#`,e.number]}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.author}),(0,Q.jsx)(`span`,{children:X(e.createdAt)}),(0,Q.jsx)(ht,{count:e.comments}),e.checks?(0,Q.jsx)(_t,{checks:e.checks}):null,i?(0,Q.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-violet`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Q.jsx)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Q.jsx)(et,{label:e,color:n[e]},e))}):null]})})}function $e({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,Z.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Q.jsxs)(H,{open:i,onOpenChange:a,children:[(0,Q.jsx)(F,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:S(`flex 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-primary/60 text-foreground`),children:[(0,Q.jsx)(we,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,Q.jsx)(G,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(K,{placeholder:`Filter labels…`}),(0,Q.jsxs)(R,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Q.jsx)(V,{children:`No labels.`}),n.length>0?(0,Q.jsxs)(I,{value:`__clear__`,onSelect:()=>r([]),className:`text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,Q.jsxs)(I,{value:e,onSelect:()=>o(e),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:Fe(t[e])}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Q.jsx)(g,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e)})]})]})})]})}function et({label:e,color:t}){return(0,Q.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:Fe(t),className:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function tt({item:e,listPath:t,colors:n,children:r}){let i=e.kind===`pr`?`pull request`:`issue`,a=e.kind===`pr`&&!!(e.additions||e.deletions);return(0,Q.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Q.jsxs)(j,{to:t,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Q.jsx)(C,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,Q.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[10.5px] text-soft-foreground`,children:[(0,Q.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Q.jsx)(`span`,{children:i}),`·`,(0,Q.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Q.jsxs)(`span`,{children:[X(e.createdAt),` ago`]}),e.comments?(0,Q.jsxs)(Q.Fragment,{children:[`·`,(0,Q.jsx)(ht,{count:e.comments})]}):null,a?(0,Q.jsxs)(Q.Fragment,{children:[`·`,(0,Q.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Q.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,Q.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,b(e.url)?(0,Q.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Q.jsx)(w,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Q.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),(0,Q.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:e.title}),e.labels.length>0||e.checks?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Q.jsx)(et,{label:e,color:n[e]},e)),e.checks?(0,Q.jsx)(gt,{checks:e.checks,url:e.url}):null]}):null,(0,Q.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,Q.jsx)(ye,{children:e.body}):(0,Q.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Q.jsx)(nt,{item:e,colors:n}),r]})}function nt({item:e,colors:t}){let n=l(e.kind,e.number),r=n.data,i=(0,Z.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(rt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,Q.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Q.jsx)($,{className:`mb-3 h-3 w-24`}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)($,{className:`h-14 w-full`}),(0,Q.jsx)($,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Q.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Q.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Q.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Q.jsx)(w,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Q.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Q.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-5`,children:it(i).map(e=>e.group===`commits`?(0,Q.jsx)(at,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Q.jsx)(dt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Q.jsx)(st,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Q.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Q.jsx)(w,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var rt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function it(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function at({commits:e,colors:t}){let[n,r]=(0,Z.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:ot.committed}),(0,Q.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Q.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Q.jsx)(st,{event:e,colors:t},e.id))]}):(0,Q.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:ot.committed}),(0,Q.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Q.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Q.jsx)(`span`,{className:`shrink-0`,children:X(e[e.length-1].createdAt)})]})})}var ot={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function st({event:e,colors:t}){return(0,Q.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:S(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:ot[e.kind]}),(0,Q.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Q.jsx)(ct,{event:e,colors:t}),(0,Q.jsx)(`span`,{className:`shrink-0`,children:X(e.createdAt)}),e.url?(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Q.jsx)(w,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function ct({event:e,colors:t}){switch(e.kind){case`committed`:return(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Q.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Q.jsx)(lt,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Q.jsx)(`span`,{"data-slot":`gh-event-label`,style:Fe(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[10px]`,children:e.label.name}):null,(0,Q.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,Q.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,Q.jsx)(`span`,{children:`merged this`});case`closed`:return(0,Q.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,Q.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,Q.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,Q.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,Q.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function lt({checks:e}){return e?(0,Q.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:S(`shrink-0`,mt[e]),children:pt[e]}):null}var ut={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function dt({comment:e}){let t=e.reviewState?ut[e.reviewState]:null;return(0,Q.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Q.jsx)(ft,{url:e.avatarUrl,login:e.author}),(0,Q.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Q.jsx)(`span`,{children:X(e.createdAt)}),t?(0,Q.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:S(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Q.jsx)(w,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Q.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Q.jsx)(ye,{children:e.body}):(0,Q.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function ft({url:e,login:t}){let[n,r]=(0,Z.useState)(!1);return e&&!n?(0,Q.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,Q.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var pt={passing:`✓`,failing:`✗`,pending:`○`},mt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function ht({count:e}){return e?(0,Q.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Q.jsx)(Ce,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function gt({checks:e,url:t}){let n=S(`text-[11px] font-medium`,mt[e],t&&`hover:underline`),r=`${pt[e]} checks ${e}`;return t?(0,Q.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Q.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function _t({checks:e}){return(0,Q.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:S(`shrink-0 font-sans text-[11px] font-semibold`,mt[e]),children:pt[e]})}export{Ye as GithubIndexRoute,Xe as GithubRoute};
|