meshy-node 0.9.7 → 0.9.9

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.
@@ -0,0 +1,23 @@
1
+ import{c as I,j as t,d as v,r as c,bR as Y,bM as Z,y as G,n as q,$ as ee,l as ne}from"./index-C7-ljTCx.js";import{A as te,G as re}from"./DashboardPage-DbD4Z2U0.js";import{F as se}from"./file-Ef280xPz.js";import"./DashboardShared-1UhBYL1-.js";import"./MarkdownPreviewFrame-CH3rgET1.js";import"./PreviewTab-C5m4cFxf.js";/**
2
+ * @license lucide-react v1.7.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const ie=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],oe=I("arrow-down",ie);/**
7
+ * @license lucide-react v1.7.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const de=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],ae=I("columns-2",de);/**
12
+ * @license lucide-react v1.7.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const le=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]],ce=I("rows-3",le);function ue(e,n){if(!(e!=null&&e.trim()))return[];const r=e.split(`
17
+ `),i=[];let s=[];const d=()=>{if(s.length===0)return;const a=s.join(`
18
+ `).trim();if(!a){s=[];return}const o=ke(s);if(!o){s=[];return}i.push({id:`${n}:${o}`,path:o,section:n,patch:a}),s=[]};for(const a of r)a.startsWith("diff --git ")&&s.length>0&&d(),s.push(a);return d(),i}function O(e,n,r){const i=(e==null?void 0:e.filter(s=>s.section===r))??[];return i.length===0?ue(n,r):i.map(s=>({id:`${r}:${s.path}`,path:s.path,section:r,status:s.status,patch:s.patch,oldExists:s.oldExists,newExists:s.newExists,oldContent:s.oldContent,newContent:s.newContent,oldTruncated:s.oldTruncated,newTruncated:s.newTruncated,binary:s.binary}))}function me(e){const n=[];for(const r of[...e].sort((i,s)=>i.path.localeCompare(s.path))){const i=r.path.split("/").filter(Boolean);let s=n,d="";i.forEach((a,o)=>{d=d?`${d}/${a}`:a;const l=o===i.length-1;let x=s.find(m=>m.name===a);x||(x=l?{type:"file",name:a,path:d,item:r}:{type:"folder",name:a,path:d,children:[]},s.push(x)),l||(x.children??(x.children=[]),s=x.children)})}return n}function xe(e){const n=[];let r="";for(const i of e.split("/").filter(Boolean).slice(0,-1))r=r?`${r}/${i}`:i,n.push(r);return n}function fe(e){return e.filter(n=>n&&!n.endsWith("/")).map(n=>({id:`untracked:${n}`,path:n,section:"untracked"}))}function he(e){return J(e).map(({index:n,header:r,oldStart:i,newStart:s})=>({index:n,header:r,oldStart:i,newStart:s}))}function pe({oldContent:e,newContent:n,patch:r}){const i=_(e),s=_(n),d=J(r);if(d.length===0)return Ne(i,s);const a=[];let o=1,l=1;const x=(m,g)=>{const y=Math.min(m,i.length+1),b=Math.min(g,s.length+1);for(;o<y||l<b;){const h=o<y&&o<=i.length,N=l<b&&l<=s.length;a.push({oldLineNumber:h?o:null,newLineNumber:N?l:null,oldContent:h?i[o-1]??"":"",newContent:N?s[l-1]??"":"",kind:h&&N?"context":h?"removed":"added"}),o<y&&(o+=1),l<b&&(l+=1)}o<m&&(o=m),l<g&&(l=g)};for(const m of d){let g=m.index;const y=h=>g===void 0?h:(g=void 0,{...h,hunkIndex:m.index});x(m.oldStart>0?m.oldStart:o,m.newStart>0?m.newStart:l);let b=0;for(;b<m.lines.length;){const h=m.lines[b];if(!h)break;if(h.kind==="context"){a.push(y({oldLineNumber:o,newLineNumber:l,oldContent:i[o-1]??h.content,newContent:s[l-1]??h.content,kind:"context"})),o+=1,l+=1,b+=1;continue}const N=[],M=[];for(;b<m.lines.length;){const p=m.lines[b];if(!p||p.kind==="context")break;p.kind==="removed"?(N.push({lineNumber:o,content:i[o-1]??p.content}),o+=1):(M.push({lineNumber:l,content:s[l-1]??p.content}),l+=1),b+=1}const D=Math.max(N.length,M.length);for(let p=0;p<D;p+=1){const k=N[p],C=M[p];a.push(y({oldLineNumber:(k==null?void 0:k.lineNumber)??null,newLineNumber:(C==null?void 0:C.lineNumber)??null,oldContent:(k==null?void 0:k.content)??"",newContent:(C==null?void 0:C.content)??"",kind:k&&C?"changed":k?"removed":"added"}))}}}for(;o<=i.length||l<=s.length;){const m=o<=i.length,g=l<=s.length;a.push({oldLineNumber:m?o:null,newLineNumber:g?l:null,oldContent:m?i[o-1]??"":"",newContent:g?s[l-1]??"":"",kind:m&&g?"context":m?"removed":"added"}),m&&(o+=1),g&&(l+=1)}return a}function ge(e){return _(e).map((n,r)=>({oldLineNumber:null,newLineNumber:r+1,oldContent:"",newContent:n,kind:"added"}))}function be(e){const n=[];for(const r of e){if(r.kind==="context"){n.push({oldLineNumber:r.oldLineNumber,newLineNumber:r.newLineNumber,content:r.newContent||r.oldContent,kind:"context",prefix:" ",...T(r)});continue}if(r.kind==="changed"){n.push({oldLineNumber:r.oldLineNumber,newLineNumber:null,content:r.oldContent,kind:"removed",prefix:"-",...T(r)}),n.push({oldLineNumber:null,newLineNumber:r.newLineNumber,content:r.newContent,kind:"added",prefix:"+"});continue}if(r.kind==="removed"){n.push({oldLineNumber:r.oldLineNumber,newLineNumber:null,content:r.oldContent,kind:"removed",prefix:"-",...T(r)});continue}n.push({oldLineNumber:null,newLineNumber:r.newLineNumber,content:r.newContent,kind:"added",prefix:"+",...T(r)})}return n}function T(e){return e.hunkIndex===void 0?{}:{hunkIndex:e.hunkIndex}}function _(e){if(!e)return[];const n=e.replace(/\r\n/g,`
19
+ `).replace(/\r/g,`
20
+ `).split(`
21
+ `);return n.length>0&&n[n.length-1]===""&&n.pop(),n}function J(e){if(!e)return[];const n=[];let r=null;for(const i of e.split(`
22
+ `)){const s=i.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(s){r={index:n.length,header:i,oldStart:Number(s[1]??0),newStart:Number(s[2]??0),lines:[]},n.push(r);continue}if(!r||i.startsWith("\\ No newline"))continue;const d=i.charAt(0);d===" "?r.lines.push({kind:"context",content:i.slice(1)}):d==="+"?r.lines.push({kind:"added",content:i.slice(1)}):d==="-"&&r.lines.push({kind:"removed",content:i.slice(1)})}return n}function Ne(e,n){const r=Math.max(e.length,n.length),i=[];for(let s=0;s<r;s+=1){const d=s<e.length,a=s<n.length,o=e[s]??"",l=n[s]??"";i.push({oldLineNumber:d?s+1:null,newLineNumber:a?s+1:null,oldContent:o,newContent:l,kind:d&&a?o===l?"context":"changed":d?"removed":"added"})}return i}function ke(e){var d,a;const n=(d=e.find(o=>o.startsWith("+++ ")))==null?void 0:d.slice(4).trim();if(n&&n!=="/dev/null")return F(n);const r=(a=e.find(o=>o.startsWith("--- ")))==null?void 0:a.slice(4).trim();if(r&&r!=="/dev/null")return F(r);const i=e.find(o=>o.startsWith("diff --git "));if(!i)return null;const s=i.match(/^diff --git a\/(.+?) b\/(.+)$/);return s?F(s[2]||s[1]||""):null}function F(e){return e.replace(/^[ab]\//,"")}function je({item:e,viewMode:n}){return e.binary?t.jsx(w,{tone:"muted",children:"Binary file changed."}):typeof e.oldContent=="string"||typeof e.newContent=="string"?t.jsx(R,{oldContent:e.oldContent??"",newContent:e.newContent??"",patch:e.patch,oldTitle:e.oldExists===!1?"Missing base":"Base",newTitle:e.newExists===!1?"Deleted":"Current",oldTruncated:e.oldTruncated,newTruncated:e.newTruncated,viewMode:n}):t.jsx(Se,{patch:e.patch??""})}function we({loading:e,error:n,content:r,viewMode:i}){if(e)return t.jsx(w,{tone:"muted",children:"Loading file content..."});if(n)return t.jsx(w,{tone:"destructive",children:n});if(!r)return t.jsx(w,{tone:"muted",children:"Select an untracked file to preview its content."});if(r.kind==="image"){const s=r.content?`data:${r.mimeType};base64,${r.content}`:r.downloadUrl;return s?t.jsx("div",{className:"flex min-h-[18rem] items-center justify-center rounded-sm bg-background/55 p-3",children:t.jsx("img",{src:s,alt:r.path,className:"max-h-full max-w-full rounded-sm object-contain shadow-[0_24px_90px_-52px_rgba(0,0,0,0.65)]"})}):t.jsx(w,{tone:"muted",children:"Image preview is not available."})}if(r.kind==="pdf"&&r.downloadUrl)return t.jsx("div",{className:"h-full min-h-[22rem] overflow-hidden rounded-sm bg-background/55",children:t.jsx("iframe",{src:r.downloadUrl,title:r.path,className:"h-full w-full border-0"})});if(r.kind==="json"){let s=r.content;try{s=JSON.stringify(JSON.parse(r.content),null,2)}catch{}return t.jsx(R,{oldContent:"",newContent:s,addedOnly:!0,newTitle:"Untracked",newTruncated:r.truncated,viewMode:i})}return r.kind==="markdown"||r.kind==="text"||r.kind==="html"?t.jsx(R,{oldContent:"",newContent:r.content,addedOnly:!0,newTitle:"Untracked",newTruncated:r.truncated,viewMode:i}):t.jsx(w,{tone:"muted",children:"This file cannot be previewed inline."})}function R({oldContent:e,newContent:n,patch:r,oldTitle:i="Base",newTitle:s="Current",oldTruncated:d=!1,newTruncated:a=!1,addedOnly:o=!1,viewMode:l}){const x=c.useMemo(()=>o?ge(n):pe({oldContent:e,newContent:n,patch:r}),[o,n,e,r]);return t.jsxs("div",{className:"overflow-hidden rounded-sm bg-background/55",children:[t.jsx("div",{className:"overflow-x-auto",children:l==="inline"?t.jsx(ye,{rows:x,oldTitle:i,newTitle:s}):t.jsx(ve,{rows:x,oldTitle:i,newTitle:s})}),(d||a)&&t.jsx("div",{className:"bg-muted/30 px-2.5 py-1.5 text-[10px] text-muted-foreground",children:"Content truncated. Open the Files tab to inspect the full artifact."})]})}function ve({rows:e,oldTitle:n,newTitle:r}){return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid min-w-[52rem] grid-cols-[3rem_minmax(16rem,1fr)_3rem_minmax(16rem,1fr)] bg-muted/30 font-mono text-[10px] leading-4",children:[t.jsx("span",{className:"border-r border-border/50 px-2 py-1.5 text-right text-muted-foreground/60",children:"#"}),t.jsx("span",{className:"border-r border-border/60 px-2 py-1.5 font-medium text-foreground",children:n}),t.jsx("span",{className:"border-r border-border/50 px-2 py-1.5 text-right text-muted-foreground/60",children:"#"}),t.jsx("span",{className:"px-2 py-1.5 font-medium text-foreground",children:r})]}),t.jsx("div",{className:"font-mono text-[10px] leading-4",children:e.length>0?e.map((i,s)=>t.jsx(Ce,{row:i},`${s}:${i.oldLineNumber??"x"}:${i.newLineNumber??"x"}`)):t.jsx("div",{className:"min-w-[52rem] px-2.5 py-2 text-[10px] text-muted-foreground",children:"No text content."})})]})}function ye({rows:e,oldTitle:n,newTitle:r}){const i=c.useMemo(()=>be(e),[e]);return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"grid min-w-[42rem] grid-cols-[3rem_3rem_minmax(0,1fr)] bg-muted/30 font-mono text-[10px] leading-4",children:[t.jsx("span",{className:"border-r border-border/50 px-2 py-1.5 text-right text-muted-foreground/60",children:"old"}),t.jsx("span",{className:"border-r border-border/50 px-2 py-1.5 text-right text-muted-foreground/60",children:"new"}),t.jsxs("span",{className:"px-2 py-1.5 font-medium text-foreground",children:[n," / ",r]})]}),t.jsx("div",{className:"font-mono text-[10px] leading-4",children:i.length>0?i.map((s,d)=>t.jsx(Le,{row:s},`${d}:${s.oldLineNumber??"x"}:${s.newLineNumber??"x"}:${s.prefix}`)):t.jsx("div",{className:"min-w-[42rem] px-2.5 py-2 text-[10px] text-muted-foreground",children:"No text content."})})]})}function Ce({row:e}){return t.jsxs("div",{"data-diff-hunk-index":e.hunkIndex,className:"grid min-w-[52rem] grid-cols-[3rem_minmax(16rem,1fr)_3rem_minmax(16rem,1fr)] border-b border-border/25 last:border-b-0",children:[t.jsx("span",{className:v("select-none border-r border-border/40 px-2 py-px text-right text-muted-foreground/55",B(e)),children:e.oldLineNumber??""}),t.jsx("span",{className:v("whitespace-pre-wrap break-all border-r border-border/60 px-2 py-px text-foreground",B(e)),children:e.oldContent||" "}),t.jsx("span",{className:v("select-none border-r border-border/40 px-2 py-px text-right text-muted-foreground/55",V(e)),children:e.newLineNumber??""}),t.jsx("span",{className:v("whitespace-pre-wrap break-all px-2 py-px text-foreground",V(e)),children:e.newContent||" "})]})}function Le({row:e}){return t.jsxs("div",{"data-diff-hunk-index":e.hunkIndex,className:v("grid min-w-[42rem] grid-cols-[3rem_3rem_minmax(0,1fr)] border-b border-border/25 last:border-b-0",Me(e)),children:[t.jsx("span",{className:"select-none border-r border-border/40 px-2 py-px text-right text-muted-foreground/55",children:e.oldLineNumber??""}),t.jsx("span",{className:"select-none border-r border-border/40 px-2 py-px text-right text-muted-foreground/55",children:e.newLineNumber??""}),t.jsxs("span",{className:"whitespace-pre-wrap break-all px-2 py-px text-foreground",children:[t.jsx("span",{className:"mr-2 inline-block w-2 select-none text-muted-foreground/60",children:e.prefix}),e.content||" "]})]})}function Se({patch:e}){const n=e.split(`
23
+ `);let r=-1;return t.jsxs("div",{className:"rounded-sm bg-background/55",children:[t.jsxs("div",{className:"px-2.5 py-1.5",children:[t.jsx("div",{className:"text-[10px] font-medium text-foreground",children:"Patch"}),t.jsxs("div",{className:"mt-0.5 text-[9px] text-muted-foreground",children:[n.length," lines"]})]}),t.jsx("div",{className:"font-mono text-[10px] leading-4",children:n.map((i,s)=>{const d=i.startsWith("@@");return d&&(r+=1),t.jsxs("div",{"data-diff-hunk-index":d?r:void 0,className:v("grid grid-cols-[36px_minmax(0,1fr)] gap-2 px-2.5 py-px",De(i)),children:[t.jsx("span",{className:"select-none text-right text-muted-foreground/55",children:s+1}),t.jsx("span",{className:"whitespace-pre-wrap break-all text-foreground",children:i||" "})]},`${s}-${i}`)})})]})}function w({children:e,tone:n}){return t.jsx("div",{className:v("flex h-full min-h-[10rem] items-center justify-center rounded-sm text-[10px]",n==="muted"?"text-muted-foreground":"text-destructive"),children:e})}function B(e){return e.kind==="removed"||e.kind==="changed"?"bg-destructive/10":e.kind==="added"?"bg-muted/25 text-muted-foreground":""}function V(e){return e.kind==="added"||e.kind==="changed"?"bg-emerald-500/10":e.kind==="removed"?"bg-muted/25 text-muted-foreground":""}function Me(e){return e.kind==="added"?"bg-emerald-500/10":e.kind==="removed"?"bg-destructive/10":""}function De(e){return e.startsWith("@@")?"bg-sky-500/10":e.startsWith("+")&&!e.startsWith("+++")?"bg-emerald-500/10":e.startsWith("-")&&!e.startsWith("---")?"bg-destructive/10":e.startsWith("diff ")||e.startsWith("index ")||e.startsWith("---")||e.startsWith("+++")?"bg-muted/45":""}function $e({activeHunkIndex:e,hunkCount:n,onPrevious:r,onNext:i}){const s=n>0,d=s?Math.min(Math.max(e,0),n-1):0,a=!s||d<=0,o=!s||d>=n-1,l=s?`${d+1}/${n}`:"0/0",x=m=>v("flex h-6 w-6 items-center justify-center rounded-sm text-muted-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",m?"cursor-not-allowed opacity-40":"hover:bg-background/55 hover:text-foreground");return t.jsxs("div",{className:"flex shrink-0 items-center gap-1 rounded-sm bg-muted/40 p-0.5",role:"group","aria-label":"Diff hunk navigation",children:[t.jsx("button",{type:"button","aria-label":"Previous diff hunk",title:"Previous diff hunk",disabled:a,onClick:r,className:x(a),children:t.jsx(te,{className:"h-3 w-3"})}),t.jsx("span",{className:"min-w-[2.25rem] text-center font-mono text-[10px] leading-5 text-muted-foreground",children:l}),t.jsx("button",{type:"button","aria-label":"Next diff hunk",title:"Next diff hunk",disabled:o,onClick:i,className:x(o),children:t.jsx(oe,{className:"h-3 w-3"})})]})}const Te={staged:"Staged",unstaged:"Unstaged",untracked:"Untracked"};function Oe({taskId:e}){const[n,r]=c.useState(null),[i,s]=c.useState(!0),[d,a]=c.useState(null),[o,l]=c.useState(null),[x,m]=c.useState(null),[g,y]=c.useState(!1),[b,h]=c.useState(null),[N,M]=c.useState("split"),[D,p]=c.useState(0),k=c.useRef(null),C=c.useCallback(async()=>{s(!0),a(null),r(null);try{const u=await Y(e);r(u)}catch(u){a(u instanceof Error?u.message:"Failed to load diff")}finally{s(!1)}},[e]);c.useEffect(()=>{C()},[C]);const H=c.useMemo(()=>O(n==null?void 0:n.files,n==null?void 0:n.staged,"staged"),[n==null?void 0:n.files,n==null?void 0:n.staged]),W=c.useMemo(()=>O(n==null?void 0:n.files,n==null?void 0:n.unstaged,"unstaged"),[n==null?void 0:n.files,n==null?void 0:n.unstaged]),U=c.useMemo(()=>fe((n==null?void 0:n.untrackedFiles)??[]),[n==null?void 0:n.untrackedFiles]),$=c.useMemo(()=>[{section:"staged",items:H},{section:"unstaged",items:W},{section:"untracked",items:U}],[H,W,U]),S=c.useMemo(()=>$.flatMap(u=>u.items),[$]),K=c.useMemo(()=>$.filter(u=>u.items.length>0),[$]),f=c.useMemo(()=>S.find(u=>u.id===o)??S[0]??null,[S,o]),L=c.useMemo(()=>he(f==null?void 0:f.patch),[f==null?void 0:f.patch]),A=c.useCallback(u=>{const j=()=>{var P;const E=(P=k.current)==null?void 0:P.querySelector(`[data-diff-hunk-index="${u}"]`);E==null||E.scrollIntoView({block:"start",inline:"nearest",behavior:"smooth"})};if(typeof window>"u"){j();return}window.requestAnimationFrame(j)},[]);c.useEffect(()=>{var u;(!o||!S.some(j=>j.id===o))&&l(((u=S[0])==null?void 0:u.id)??null)},[S,o]),c.useEffect(()=>{p(0)},[f==null?void 0:f.id]),c.useEffect(()=>{if(L.length===0){p(0);return}p(u=>Math.min(u,L.length-1))},[L.length]),c.useEffect(()=>{L.length!==0&&A(D)},[D,N,A,L.length,f==null?void 0:f.id]);const Q=c.useCallback(()=>{p(u=>Math.max(0,u-1))},[]),X=c.useCallback(()=>{p(u=>Math.min(L.length-1,u+1))},[L.length]);return c.useEffect(()=>{if(m(null),h(null),y(!1),!f||f.section!=="untracked")return;if(f.path.endsWith("/")){h("This untracked path is a directory. Open the Files tab to inspect its contents.");return}let u=!1;return y(!0),Z(e,f.path).then(j=>{u||m(j)}).catch(j=>{u||h(j instanceof Error?j.message:"Failed to load file content")}).finally(()=>{u||y(!1)}),()=>{u=!0}},[f,e]),i?t.jsx(w,{tone:"muted",children:"Loading diff..."}):d?t.jsx(w,{tone:"destructive",children:d}):n!=null&&n.available?S.length>0?t.jsxs("div",{className:"grid h-full min-h-0 grid-cols-1 lg:grid-cols-[16rem_minmax(0,1fr)] lg:pl-5",children:[t.jsxs("aside",{className:"flex min-h-0 flex-col bg-card/25 lg:border-r lg:border-border/50",children:[t.jsx("div",{className:"shrink-0 bg-card/20 px-2.5 py-1.5",children:t.jsx("div",{className:"flex items-start justify-between gap-1.5",children:t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1 text-[10px] font-semibold text-foreground",children:[t.jsx(re,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{className:"truncate",children:n.branch??"detached HEAD"})]}),n.repoRoot&&t.jsx("div",{className:"mt-1 truncate font-mono text-[10px] leading-4 text-muted-foreground",children:n.repoRoot})]})})}),t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-1",children:t.jsx("div",{className:"space-y-1",children:K.map(({section:u,items:j})=>t.jsx(Ee,{section:u,items:j,selectedId:(f==null?void 0:f.id)??null,onSelect:l},u))})})]}),t.jsx("section",{className:"min-h-0 flex flex-col bg-card/15",children:f?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"shrink-0 px-2.5 py-1.5",children:t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsx("div",{className:"min-w-0 break-all font-mono text-[9px] text-muted-foreground",children:f.path}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[t.jsx($e,{activeHunkIndex:D,hunkCount:L.length,onPrevious:Q,onNext:X}),t.jsx(Fe,{mode:N,onModeChange:M})]})]})}),t.jsx("div",{ref:k,className:"min-h-0 flex-1 overflow-auto px-1.5 pb-1.5 pt-1",children:f.section==="untracked"?t.jsx(we,{loading:g,error:b,content:x,viewMode:N}):t.jsx(je,{item:f,viewMode:N})})]}):t.jsx(w,{tone:"muted",children:"Select a file to inspect."})})]}):t.jsx(w,{tone:"muted",children:"Working tree is clean."}):t.jsx(w,{tone:"muted",children:"Task working directory is not inside a Git repository."})}function Ee({section:e,items:n,selectedId:r,onSelect:i}){const s=c.useMemo(()=>me(n),[n]),d=c.useMemo(()=>n.find(x=>x.id===r)??null,[n,r]),a=c.useMemo(()=>new Set(d?xe(d.path):[]),[d]),[o,l]=c.useState(!0);return n.length===0?null:t.jsxs("section",{className:"rounded-sm bg-background/35",children:[t.jsxs("button",{type:"button",onClick:()=>l(x=>!x),"aria-expanded":o,className:v("flex w-full items-center justify-between gap-1.5 px-2 py-1 text-left transition-colors hover:bg-background/55"),children:[t.jsxs("div",{className:"flex items-center gap-1",children:[o?t.jsx(G,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):t.jsx(q,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:"text-[10px] font-medium text-foreground",children:Te[e]})]}),t.jsx(ee,{variant:"outline",className:"rounded-sm border-transparent bg-muted/45 px-1.5 py-0 text-[9px]",children:n.length})]}),o&&t.jsx("div",{className:"p-1",children:s.length>0?t.jsx("div",{className:"space-y-0.5",children:s.map(x=>t.jsx(z,{node:x,depth:0,selectedId:r,expandedAncestorPaths:a,onSelect:i},`${e}:${x.path}`))}):null})]})}function Fe({mode:e,onModeChange:n}){const r=i=>v("flex items-center gap-1 rounded-sm px-2 py-0.5 text-[10px] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/60",i?"bg-primary/10 font-medium text-primary":"text-muted-foreground hover:bg-background/45 hover:text-foreground");return t.jsxs("div",{className:"flex shrink-0 items-center gap-1 rounded-sm bg-muted/40 p-0.5",role:"group","aria-label":"Diff view mode",children:[t.jsxs("button",{type:"button","aria-pressed":e==="split",title:"Split diff",onClick:()=>n("split"),className:r(e==="split"),children:[t.jsx(ae,{className:"h-3 w-3"}),t.jsx("span",{children:"Split"})]}),t.jsxs("button",{type:"button","aria-pressed":e==="inline",title:"Inline diff",onClick:()=>n("inline"),className:r(e==="inline"),children:[t.jsx(ce,{className:"h-3 w-3"}),t.jsx("span",{children:"Inline"})]})]})}function z({node:e,depth:n,selectedId:r,expandedAncestorPaths:i,onSelect:s}){var d;return e.type==="folder"?t.jsx(_e,{node:e,depth:n,selectedId:r,expandedAncestorPaths:i,onSelect:s}):t.jsxs("button",{type:"button",onClick:()=>{e.item&&s(e.item.id)},className:v("flex w-full cursor-pointer items-center gap-1 rounded-sm px-1 py-0.5 text-left transition-colors",((d=e.item)==null?void 0:d.id)===r?"bg-primary/10 text-foreground":"text-foreground/90 hover:bg-background/55"),style:{paddingLeft:`${n*10+5}px`},children:[t.jsx(se,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:"truncate text-[10px] leading-4",children:e.name})]})}function _e({node:e,depth:n,selectedId:r,expandedAncestorPaths:i,onSelect:s}){const[d,a]=c.useState(!0);return c.useEffect(()=>{i.has(e.path)&&a(!0)},[i,e.path]),t.jsxs("div",{children:[t.jsxs("button",{type:"button",onClick:()=>a(o=>!o),"aria-expanded":d,className:"flex w-full cursor-pointer select-none items-center gap-1 rounded-sm px-1 py-0.5 text-left text-[10px] leading-4 text-muted-foreground transition-colors hover:bg-background/55 hover:text-foreground",style:{paddingLeft:`${n*10+5}px`},children:[d?t.jsx(G,{className:"h-3 w-3 shrink-0"}):t.jsx(q,{className:"h-3 w-3 shrink-0"}),t.jsx(ne,{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate",children:e.name})]}),d&&t.jsx("div",{className:"space-y-0.5",children:(e.children??[]).map(o=>t.jsx(z,{node:o,depth:n+1,selectedId:r,expandedAncestorPaths:i,onSelect:s},o.path))})]})}export{Oe as DiffTab};
@@ -1,4 +1,4 @@
1
- import{c as ye,r as o,bD as De,bE as Pe,bF as Te,j as t,i as me,B as L,u as xe,X as _e,k as Oe,b as x,t as ze}from"./index-9hU42hur.js";import{M as Re,L as $e}from"./MarkdownPreviewFrame-hB6tBCB8.js";import{y as A,z as Be,B as Ae,E as Le,F as Me,G as Ue,H as He}from"./DashboardShared-CtD601bB.js";import{F as Ke}from"./file-B8vnmnf2.js";/**
1
+ import{c as ye,r as o,bM as De,bN as Pe,bO as Te,j as t,l as me,B as L,x as xe,X as _e,n as Oe,d as x,t as ze}from"./index-C7-ljTCx.js";import{M as Re,L as $e}from"./MarkdownPreviewFrame-CH3rgET1.js";import{w as A,x as Be,y as Ae,z as Le,B as Me,E as Ue,F as He}from"./DashboardShared-1UhBYL1-.js";import{F as Ke}from"./file-Ef280xPz.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as p,r as h,j as e,b as s}from"./index-9hU42hur.js";import{J as f}from"./DashboardShared-CtD601bB.js";/**
1
+ import{c as p,r as h,j as e,d as s}from"./index-C7-ljTCx.js";import{G as f}from"./DashboardShared-1UhBYL1-.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as O,j as e,I as re,B as v,au as A,an as K,r as i,bG as te,bF as ne,as as T,z as ae,A as ie,E as le,bH as oe,v as ce,C as de}from"./index-9hU42hur.js";/**
1
+ import{c as O,j as e,I as re,B as v,aB as A,au as W,r as i,bP as te,bO as ne,az as T,G as ae,H as ie,J as le,bQ as oe,y as ce,C as de}from"./index-C7-ljTCx.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -18,4 +18,4 @@ import{c as O,j as e,I as re,B as v,au as A,an as K,r as i,bG as te,bF as ne,as
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const ve=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],we=O("settings-2",ve),_="8314",be={getOutput:ne,createPreviewSession:te};function ge({taskId:s,api:n=be,allowPortPreview:l=!1}){const[a,d]=i.useState(null),[t,x]=i.useState(null),[u,m]=i.useState(null),[h,f]=i.useState(_),[j,b]=i.useState(!1),[P,S]=i.useState(!0),[w,c]=i.useState(null),[Z,F]=i.useState(!1),[L,p]=i.useState(!1),U=i.useCallback(async()=>{S(!0),c(null),d(null),x(null),m(null),p(!1);try{const r=await n.getOutput(s);d(r),S(!1)}catch(r){c(r instanceof Error?r.message:"Failed to load output"),S(!1)}},[n,s]);i.useEffect(()=>{U()},[U]);const N=i.useCallback(async r=>{c(null);try{const o=await n.createPreviewSession(s,r!=null&&r.path?{path:r.path}:void 0);x(o),b(!1),p(!1),r&&m(r),T("preview.created",{result:"success",previewType:(r==null?void 0:r.kind)??"file"})}catch(o){c(o instanceof Error?o.message:"Failed to create preview session"),T("preview.failed",{result:"failed",previewType:(r==null?void 0:r.kind)??"file"})}},[n,s]),M=i.useCallback(async r=>{const o=r??Number.parseInt(h.trim()||_,10);if(!Number.isInteger(o)||o<1||o>65535){c("Enter a port between 1 and 65535");return}c(null);try{const C=await n.createPreviewSession(s,{port:o});x(C),m(null),f(String(o)),b(!0),p(!1),T("preview.created",{result:"success",previewType:"service-port"})}catch(C){c(C instanceof Error?C.message:"Failed to create preview session"),T("preview.failed",{result:"failed",previewType:"service-port"})}},[n,h,s]),k=i.useMemo(()=>W(a),[a]);i.useEffect(()=>{if(j||!(a!=null&&a.available)||k.length===0||t&&t.kind!=="service")return;const r=u??k[0];r&&N(r)},[u,a,k,j,t,N]);const g=i.useCallback(()=>{if((t==null?void 0:t.kind)==="service"&&typeof t.port=="number"){M(t.port);return}x(null);const r=u??W(a)[0];r&&N(r)},[u,a,t,M,N]);if(i.useEffect(()=>{if(!t)return;const r=t.expiresAt-Date.now()-5e3;if(r<=0){g();return}const o=window.setTimeout(g,r);return()=>window.clearTimeout(o)},[g,t]),P)return e.jsx(E,{children:"Loading preview..."});const y=l&&j;if(w&&t&&!y)return e.jsx(E,{children:e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"text-[11px] text-destructive",children:w}),e.jsx("div",{className:"flex justify-center",children:e.jsxs(v,{variant:"outline",size:"sm",onClick:g,className:"rounded-sm",children:[e.jsx(A,{className:"h-3.5 w-3.5"}),"Retry"]})})]})});const H=!!(a!=null&&a.available);if(!H&&!l)return e.jsx(E,{children:"Task output is not available yet."});if(!t)return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsx("div",{className:"shrink-0 border-b border-border/60 px-3 py-1.5",children:e.jsx(D,{session:null,serviceModeOpen:y,allowPortPreview:l,servicePort:h,previewEntries:k,activeEntry:u,filesMenuOpen:L,onRefresh:g,onFullscreen:()=>F(!0),onServiceModeToggle:()=>{p(!1),b(r=>!r)},onServicePortChange:f,onServiceStart:()=>void M(),onFileMenuToggle:()=>p(r=>!r),onEntrySelect:r=>{p(!1),N(r)}})}),y?e.jsx(R,{serviceSession:null,error:w}):e.jsx(E,{children:w?e.jsx("span",{className:"text-[11px] text-destructive",children:w}):H?k.length>0?"Starting preview session...":"No HTML or Markdown files were found in this task output.":"Task output is not available yet."})]});const V=Y(t),ee=z(t),B=Q(t),q=X(t),$=t.kind==="service"?t:null,se=y?$:t,G=e.jsx("iframe",{src:B,className:"h-full w-full border-0",sandbox:q,title:"Task Preview"});return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsx("div",{className:"shrink-0 border-b border-border/60 px-3 py-1.5",children:e.jsx(D,{session:se,serviceModeOpen:y,allowPortPreview:l,servicePort:h,previewEntries:k,activeEntry:u,filesMenuOpen:L,onRefresh:g,onFullscreen:()=>F(!0),onServiceModeToggle:()=>{p(!1),b(r=>!r)},onServicePortChange:f,onServiceStart:()=>void M(),onFileMenuToggle:()=>p(r=>!r),onEntrySelect:r=>{p(!1),N(r)}})}),y?e.jsx(R,{serviceSession:$,error:w,children:$?G:null}):e.jsx("div",{className:"min-h-0 flex-1 p-2",children:e.jsx("div",{className:"h-full overflow-hidden rounded-sm border border-border/60 bg-white shadow-none",children:G})}),e.jsx(ae,{open:Z,onOpenChange:F,children:e.jsxs(ie,{className:"flex h-[95vh] max-w-[95vw] flex-col gap-0 overflow-hidden p-0",children:[e.jsxs(le,{className:"sr-only",children:["Preview: ",V]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-3 py-1.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-[12px] font-semibold text-foreground",children:V}),e.jsx("span",{className:"text-xs text-muted-foreground",children:I(t.expiresAt)})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(v,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:g,title:"Refresh",children:e.jsx(A,{className:"h-3.5 w-3.5"})}),e.jsx(v,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:ee,target:"_blank",rel:"noopener noreferrer",children:e.jsx(K,{className:"h-3.5 w-3.5"})})}),e.jsx(oe,{asChild:!0,children:e.jsxs(v,{variant:"outline",size:"sm",className:"h-6 rounded-sm px-2 text-[11px]",title:"Exit fullscreen",children:[e.jsx(he,{className:"h-3.5 w-3.5"}),"Exit fullscreen"]})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx("iframe",{src:B,className:"h-full w-full border-0",sandbox:q,title:"Task Preview Fullscreen"})})]})})]})}function W(s){var a,d;const n=((a=s==null?void 0:s.summary)==null?void 0:a.htmlEntries)??[],l=((d=s==null?void 0:s.summary)==null?void 0:d.markdownEntries)??[];return[...n.map(t=>({...t,kind:"html"})),...l.map(t=>({...t,kind:"markdown"}))]}function je({entries:s,activeEntry:n,open:l,onToggle:a,onEntrySelect:d}){const t=s[0];if(!t)return null;const x=n??t,u=J(x);return e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("button",{type:"button","aria-expanded":l,"aria-haspopup":"menu","aria-label":"Preview files",onClick:a,className:"flex h-6 max-w-[min(24rem,calc(100vw-7rem))] items-center gap-1.5 rounded-sm px-1.5 text-left text-[12px] font-semibold text-foreground transition-colors hover:bg-background/70",children:[e.jsx("span",{className:"truncate",children:x.label}),e.jsx(ce,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"})]}),l&&e.jsx("div",{role:"menu","aria-label":"Preview files",className:"absolute left-0 top-full z-30 mt-1 max-h-64 min-w-[14rem] max-w-[min(28rem,calc(100vw-4rem))] overflow-y-auto rounded-sm border border-border/70 bg-popover/95 p-1 text-popover-foreground shadow-[0_16px_48px_-34px_rgba(0,0,0,0.45)] backdrop-blur-xl",children:s.map(m=>{const h=J(m),f=h===u;return e.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":f,onClick:()=>d(m),className:"flex w-full items-center gap-2 rounded-sm px-2 py-1 text-left text-[11px] leading-4 text-foreground transition-colors hover:bg-accent/75 hover:text-accent-foreground",children:[e.jsx("span",{className:"w-3.5 shrink-0 text-primary",children:f?e.jsx(de,{className:"h-3.5 w-3.5"}):null}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:m.label})]},h)})})]})}function J(s){return`${s.kind}:${s.path}`}function D({session:s,serviceModeOpen:n,allowPortPreview:l,servicePort:a,previewEntries:d=[],activeEntry:t=null,filesMenuOpen:x=!1,onRefresh:u,onFullscreen:m,onServiceModeToggle:h,onServicePortChange:f,onServiceStart:j,onFileMenuToggle:b,onEntrySelect:P}){const S=s?z(s):null,w=!n&&d.length>0&&b&&P;return e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-2",children:n&&f&&j?e.jsxs("form",{className:"flex min-w-0 items-center gap-1.5",onSubmit:c=>{c.preventDefault(),j()},children:[e.jsx("span",{className:"shrink-0 text-[12px] font-semibold text-foreground",children:"Preview service"}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:["Port",e.jsx(re,{type:"text",min:1,max:65535,inputMode:"numeric",value:a??"",onChange:c=>f(c.target.value),placeholder:_,"aria-label":"Service preview port",className:"h-6 w-20 rounded-sm border-0 bg-muted/55 px-2 text-[11px] shadow-none focus:bg-muted/55 focus:outline-none focus-visible:border-0 focus-visible:bg-muted/55 focus-visible:ring-0 focus-visible:ring-offset-0"})]}),e.jsxs(v,{type:"submit",variant:"ghost",size:"sm",className:"h-6 rounded-sm border-0 bg-primary/10 px-2 text-[11px] text-primary shadow-none hover:bg-primary/15 hover:text-primary",children:[e.jsx(pe,{className:"h-3.5 w-3.5"}),"Preview"]}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:I(s.expiresAt)})]}):e.jsxs(e.Fragment,{children:[w?e.jsx(je,{entries:d,activeEntry:t,open:x,onToggle:b,onEntrySelect:P}):e.jsx("span",{className:"truncate text-[12px] font-semibold text-foreground",children:s?Y(s):"Preview"}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:I(s.expiresAt)})]})}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s&&e.jsxs(e.Fragment,{children:[e.jsx(v,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:u,title:"Refresh",children:e.jsx(A,{className:"h-3.5 w-3.5"})}),e.jsx(v,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:S??s.previewUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(K,{className:"h-3.5 w-3.5"})})}),e.jsx(v,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:m,title:"Fullscreen",children:e.jsx(xe,{className:"h-3.5 w-3.5"})})]}),l&&e.jsxs(v,{type:"button",variant:n?"secondary":"ghost",size:"sm","aria-pressed":n,onClick:h,className:"h-6 shrink-0 rounded-sm px-2 text-[11px]",children:[e.jsx(we,{className:"h-3.5 w-3.5"}),"Advanced"]})]})]})}function R({serviceSession:s,error:n,children:l}){return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n&&e.jsx("div",{className:"shrink-0 border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-xs text-destructive",children:n}),e.jsx("div",{className:"min-h-0 flex-1 p-2",children:s&&l?e.jsx("div",{className:"h-full overflow-hidden rounded-sm border border-border/60 bg-white shadow-none",children:l}):e.jsx(E,{children:"No service preview running."})})]})}function z(s){return s.openUrl??s.previewUrl}function Q(s){return s.kind==="service"?z(s):s.previewUrl}function X(s){return s.kind==="service"?void 0:"allow-scripts allow-same-origin"}function Y(s){if(s.kind==="service"&&typeof s.port=="number"){const n=s.entryPath?`/${s.entryPath.replace(/^\/+/,"")}`:"";return`127.0.0.1:${s.port}${n}`}return s.entryPath}function E({children:s}){return e.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:s})}function I(s){const n=Math.max(0,Math.round((s-Date.now())/1e3));if(n<60)return`${n}s`;const l=Math.floor(n/60),a=n%60;return`${l}m ${a}s`}const ke=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SERVICE_PREVIEW_PORT:_,PreviewHeader:D,PreviewServicePanel:R,PreviewTab:ge,getPreviewIframeSandbox:X,getPreviewIframeSrc:Q,getPreviewOpenUrl:z},Symbol.toStringTag,{value:"Module"}));export{_ as D,pe as P,X as a,Q as b,ke as c,z as g};
21
+ */const ve=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],we=O("settings-2",ve),_="8314",be={getOutput:ne,createPreviewSession:te};function ge({taskId:s,api:n=be,allowPortPreview:l=!1}){const[a,d]=i.useState(null),[t,x]=i.useState(null),[u,m]=i.useState(null),[h,f]=i.useState(_),[j,b]=i.useState(!1),[E,S]=i.useState(!0),[w,c]=i.useState(null),[Z,F]=i.useState(!1),[L,p]=i.useState(!1),U=i.useCallback(async()=>{S(!0),c(null),d(null),x(null),m(null),p(!1);try{const r=await n.getOutput(s);d(r),S(!1)}catch(r){c(r instanceof Error?r.message:"Failed to load output"),S(!1)}},[n,s]);i.useEffect(()=>{U()},[U]);const N=i.useCallback(async r=>{c(null);try{const o=await n.createPreviewSession(s,r!=null&&r.path?{path:r.path}:void 0);x(o),b(!1),p(!1),r&&m(r),T("preview.created",{result:"success",previewType:(r==null?void 0:r.kind)??"file"})}catch(o){c(o instanceof Error?o.message:"Failed to create preview session"),T("preview.failed",{result:"failed",previewType:(r==null?void 0:r.kind)??"file"})}},[n,s]),M=i.useCallback(async r=>{const o=r??Number.parseInt(h.trim()||_,10);if(!Number.isInteger(o)||o<1||o>65535){c("Enter a port between 1 and 65535");return}c(null);try{const C=await n.createPreviewSession(s,{port:o});x(C),m(null),f(String(o)),b(!0),p(!1),T("preview.created",{result:"success",previewType:"service-port"})}catch(C){c(C instanceof Error?C.message:"Failed to create preview session"),T("preview.failed",{result:"failed",previewType:"service-port"})}},[n,h,s]),k=i.useMemo(()=>J(a),[a]);i.useEffect(()=>{if(j||!(a!=null&&a.available)||k.length===0||t&&t.kind!=="service")return;const r=u??k[0];r&&N(r)},[u,a,k,j,t,N]);const g=i.useCallback(()=>{if((t==null?void 0:t.kind)==="service"&&typeof t.port=="number"){M(t.port);return}x(null);const r=u??J(a)[0];r&&N(r)},[u,a,t,M,N]);if(i.useEffect(()=>{if(!t)return;const r=t.expiresAt-Date.now()-5e3;if(r<=0){g();return}const o=window.setTimeout(g,r);return()=>window.clearTimeout(o)},[g,t]),E)return e.jsx(P,{children:"Loading preview..."});const y=l&&j;if(w&&t&&!y)return e.jsx(P,{children:e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"text-[11px] text-destructive",children:w}),e.jsx("div",{className:"flex justify-center",children:e.jsxs(v,{variant:"outline",size:"sm",onClick:g,className:"rounded-sm",children:[e.jsx(A,{className:"h-3.5 w-3.5"}),"Retry"]})})]})});const H=!!(a!=null&&a.available);if(!H&&!l)return e.jsx(P,{children:"Task output is not available yet."});if(!t)return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsx("div",{className:"shrink-0 border-b border-border/60 px-3 py-1.5",children:e.jsx(D,{session:null,serviceModeOpen:y,allowPortPreview:l,servicePort:h,previewEntries:k,activeEntry:u,filesMenuOpen:L,onRefresh:g,onFullscreen:()=>F(!0),onServiceModeToggle:()=>{p(!1),b(r=>!r)},onServicePortChange:f,onServiceStart:()=>void M(),onFileMenuToggle:()=>p(r=>!r),onEntrySelect:r=>{p(!1),N(r)}})}),y?e.jsx(R,{serviceSession:null,error:w}):e.jsx(P,{children:w?e.jsx("span",{className:"text-[11px] text-destructive",children:w}):H?k.length>0?"Starting preview session...":"No HTML or Markdown files were found in this task output.":"Task output is not available yet."})]});const B=Y(t),ee=z(t),V=K(t),q=X(t),$=t.kind==="service"?t:null,se=y?$:t,G=e.jsx("iframe",{src:V,className:"h-full w-full border-0",sandbox:q,title:"Task Preview"});return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsx("div",{className:"shrink-0 border-b border-border/60 px-3 py-1.5",children:e.jsx(D,{session:se,serviceModeOpen:y,allowPortPreview:l,servicePort:h,previewEntries:k,activeEntry:u,filesMenuOpen:L,onRefresh:g,onFullscreen:()=>F(!0),onServiceModeToggle:()=>{p(!1),b(r=>!r)},onServicePortChange:f,onServiceStart:()=>void M(),onFileMenuToggle:()=>p(r=>!r),onEntrySelect:r=>{p(!1),N(r)}})}),y?e.jsx(R,{serviceSession:$,error:w,children:$?G:null}):e.jsx("div",{className:"min-h-0 flex-1 p-2",children:e.jsx("div",{className:"h-full overflow-hidden rounded-sm border border-border/60 bg-white shadow-none",children:G})}),e.jsx(ae,{open:Z,onOpenChange:F,children:e.jsxs(ie,{className:"flex h-[95vh] max-w-[95vw] flex-col gap-0 overflow-hidden p-0",children:[e.jsxs(le,{className:"sr-only",children:["Preview: ",B]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-3 py-1.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-[12px] font-semibold text-foreground",children:B}),e.jsx("span",{className:"text-xs text-muted-foreground",children:I(t.expiresAt)})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(v,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:g,title:"Refresh",children:e.jsx(A,{className:"h-3.5 w-3.5"})}),e.jsx(v,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:ee,target:"_blank",rel:"noopener noreferrer",children:e.jsx(W,{className:"h-3.5 w-3.5"})})}),e.jsx(oe,{asChild:!0,children:e.jsxs(v,{variant:"outline",size:"sm",className:"h-6 rounded-sm px-2 text-[11px]",title:"Exit fullscreen",children:[e.jsx(he,{className:"h-3.5 w-3.5"}),"Exit fullscreen"]})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx("iframe",{src:V,className:"h-full w-full border-0",sandbox:q,title:"Task Preview Fullscreen"})})]})})]})}function J(s){var a,d;const n=((a=s==null?void 0:s.summary)==null?void 0:a.htmlEntries)??[],l=((d=s==null?void 0:s.summary)==null?void 0:d.markdownEntries)??[];return[...n.map(t=>({...t,kind:"html"})),...l.map(t=>({...t,kind:"markdown"}))]}function je({entries:s,activeEntry:n,open:l,onToggle:a,onEntrySelect:d}){const t=s[0];if(!t)return null;const x=n??t,u=Q(x);return e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("button",{type:"button","aria-expanded":l,"aria-haspopup":"menu","aria-label":"Preview files",onClick:a,className:"flex h-6 max-w-[min(24rem,calc(100vw-7rem))] items-center gap-1.5 rounded-sm px-1.5 text-left text-[12px] font-semibold text-foreground transition-colors hover:bg-background/70",children:[e.jsx("span",{className:"truncate",children:x.label}),e.jsx(ce,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"})]}),l&&e.jsx("div",{role:"menu","aria-label":"Preview files",className:"absolute left-0 top-full z-30 mt-1 max-h-64 min-w-[14rem] max-w-[min(28rem,calc(100vw-4rem))] overflow-y-auto rounded-sm border border-border/70 bg-popover/95 p-1 text-popover-foreground shadow-[0_16px_48px_-34px_rgba(0,0,0,0.45)] backdrop-blur-xl",children:s.map(m=>{const h=Q(m),f=h===u;return e.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":f,onClick:()=>d(m),className:"flex w-full items-center gap-2 rounded-sm px-2 py-1 text-left text-[11px] leading-4 text-foreground transition-colors hover:bg-accent/75 hover:text-accent-foreground",children:[e.jsx("span",{className:"w-3.5 shrink-0 text-primary",children:f?e.jsx(de,{className:"h-3.5 w-3.5"}):null}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:m.label})]},h)})})]})}function Q(s){return`${s.kind}:${s.path}`}function D({session:s,serviceModeOpen:n,allowPortPreview:l,servicePort:a,previewEntries:d=[],activeEntry:t=null,filesMenuOpen:x=!1,onRefresh:u,onFullscreen:m,onServiceModeToggle:h,onServicePortChange:f,onServiceStart:j,onFileMenuToggle:b,onEntrySelect:E}){const S=s?z(s):null,w=!n&&d.length>0&&b&&E;return e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-2",children:n&&f&&j?e.jsxs("form",{className:"flex min-w-0 items-center gap-1.5",onSubmit:c=>{c.preventDefault(),j()},children:[e.jsx("span",{className:"shrink-0 text-[12px] font-semibold text-foreground",children:"Preview service"}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:["Port",e.jsx(re,{type:"text",min:1,max:65535,inputMode:"numeric",value:a??"",onChange:c=>f(c.target.value),placeholder:_,"aria-label":"Service preview port",className:"h-6 w-20 rounded-sm border-0 bg-muted/55 px-2 text-[11px] shadow-none focus:bg-muted/55 focus:outline-none focus-visible:border-0 focus-visible:bg-muted/55 focus-visible:ring-0 focus-visible:ring-offset-0"})]}),e.jsxs(v,{type:"submit",variant:"ghost",size:"sm",className:"h-6 rounded-sm border-0 bg-primary/10 px-2 text-[11px] text-primary shadow-none hover:bg-primary/15 hover:text-primary",children:[e.jsx(pe,{className:"h-3.5 w-3.5"}),"Preview"]}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:I(s.expiresAt)})]}):e.jsxs(e.Fragment,{children:[w?e.jsx(je,{entries:d,activeEntry:t,open:x,onToggle:b,onEntrySelect:E}):e.jsx("span",{className:"truncate text-[12px] font-semibold text-foreground",children:s?Y(s):"Preview"}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:I(s.expiresAt)})]})}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s&&e.jsxs(e.Fragment,{children:[e.jsx(v,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:u,title:"Refresh",children:e.jsx(A,{className:"h-3.5 w-3.5"})}),e.jsx(v,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:S??s.previewUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(W,{className:"h-3.5 w-3.5"})})}),e.jsx(v,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:m,title:"Fullscreen",children:e.jsx(xe,{className:"h-3.5 w-3.5"})})]}),l&&e.jsxs(v,{type:"button",variant:n?"secondary":"ghost",size:"sm","aria-pressed":n,onClick:h,className:"h-6 shrink-0 rounded-sm px-2 text-[11px]",children:[e.jsx(we,{className:"h-3.5 w-3.5"}),"Advanced"]})]})]})}function R({serviceSession:s,error:n,children:l}){return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n&&e.jsx("div",{className:"shrink-0 border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-xs text-destructive",children:n}),e.jsx("div",{className:"min-h-0 flex-1 p-2",children:s&&l?e.jsx("div",{className:"h-full overflow-hidden rounded-sm border border-border/60 bg-white shadow-none",children:l}):e.jsx(P,{children:"No service preview running."})})]})}function z(s){return s.openUrl??s.previewUrl}function K(s){return s.kind==="service"?z(s):s.previewUrl}function X(s){return s.kind==="service"?void 0:"allow-scripts allow-same-origin"}function Y(s){if(s.kind==="service"&&typeof s.port=="number"){const n=s.entryPath?`/${s.entryPath.replace(/^\/+/,"")}`:"";return`127.0.0.1:${s.port}${n}`}return s.entryPath}function P({children:s}){return e.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:s})}function I(s){const n=Math.max(0,Math.round((s-Date.now())/1e3));if(n<60)return`${n}s`;const l=Math.floor(n/60),a=n%60;return`${l}m ${a}s`}const ke=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SERVICE_PREVIEW_PORT:_,PreviewHeader:D,PreviewServicePanel:R,PreviewTab:ge,getPreviewIframeSandbox:X,getPreviewIframeSrc:K,getPreviewOpenUrl:z},Symbol.toStringTag,{value:"Module"}));export{_ as D,pe as P,X as a,K as b,ke as c,z as g};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-C67Dnkts.js","assets/index-C7-ljTCx.js","assets/index-CcOCgrkm.css","assets/MarkdownPreviewFrame-CH3rgET1.js","assets/DashboardShared-1UhBYL1-.js","assets/file-Ef280xPz.js","assets/PreviewTab-C5m4cFxf.js"])))=>i.map(i=>d[i]);
2
+ import{bd as y,r as s,j as e,L as k,R as S,bB as T,_ as C,a0 as P,af as M,bC as E,bD as _,bE as j,bF as L,bG as O,aa as w,bH as A}from"./index-C7-ljTCx.js";import{u as I,v as F,q as R,p as D,h as z,C as B,T as v,m as G}from"./DashboardShared-1UhBYL1-.js";const q=s.lazy(async()=>({default:(await w(()=>import("./FilesTab-C67Dnkts.js"),__vite__mapDeps([0,1,2,3,4,5]))).FilesTab})),U=s.lazy(async()=>({default:(await w(()=>import("./PreviewTab-C5m4cFxf.js").then(r=>r.c),__vite__mapDeps([6,1,2]))).PreviewTab})),V={getOutput:j,getOutputTree:_,getOutputContent:E},H={getOutput:j,createPreviewSession:(t,r)=>A(t,typeof r=="string"?r:r==null?void 0:r.path)};function K(){const{shareId:t}=y(),[r,d]=s.useState(null),[o,n]=s.useState([]),[x,c]=s.useState(!0),[b,i]=s.useState(null),l=s.useRef(null);return s.useEffect(()=>{if(!t){d(null),n([]),i("Shared conversation not found"),c(!1);return}let u=!1;l.current=t,c(!0),i(null);const h=async a=>{try{const[m,f]=await Promise.all([L(t),O(t)]);if(u||l.current!==t)return;d(m),n(N=>a?f.logs:G(N,f.logs)),i(null)}catch(m){if(u||l.current!==t)return;a&&(d(null),n([]),i(m instanceof Error?m.message:"Failed to load shared conversation"))}finally{!u&&l.current===t&&a&&c(!1)}};h(!0);const p=window.setInterval(()=>{h(!1)},2500);return()=>{u=!0,window.clearInterval(p)}},[t]),e.jsx(W,{conversation:r,logs:o,loading:x,error:b})}function W({conversation:t,logs:r,loading:d,error:o}){const[n,x]=s.useState("transcript"),[c,b]=s.useState(!1),i=s.useMemo(()=>{if(!t)return null;const a=I(t.payload.initialMessage);return a.length>0&&F(r,a)?null:a.length>0?R(a,new Date(t.createdAt).toISOString()):null},[t,r]),l=s.useMemo(()=>D([...i?[i]:[],...r]),[i,r]),u=s.useMemo(()=>z(l),[l]),h=(t==null?void 0:t.scope)==="filesPreview",p=e.jsx("section",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain scroll-pb-16 bg-gradient-to-b from-background/15 via-transparent to-background/35 px-4 py-4 sm:px-6",children:e.jsxs("div",{className:"mx-auto flex max-w-[72rem] flex-col gap-4 pb-16",children:[d&&e.jsxs("div",{className:"flex items-center gap-2 rounded-sm border border-border/60 bg-background/60 px-3 py-2 text-[11px] text-muted-foreground",children:[e.jsx(k,{className:"h-4 w-4 animate-spin"}),"Loading shared conversation..."]}),!d&&o&&e.jsxs("div",{className:"rounded-sm border border-destructive/20 bg-destructive/10 px-3 py-4 text-center text-destructive",children:[e.jsx("div",{className:"text-[12px] font-semibold",children:"Shared conversation unavailable"}),e.jsx("div",{className:"mt-1 text-[11px]",children:o})]}),!d&&!o&&l.length===0&&e.jsxs("div",{className:"rounded-sm border border-dashed border-border/70 bg-background/35 px-3 py-4 text-center",children:[e.jsx(S,{className:"mx-auto h-5 w-5 text-muted-foreground"}),e.jsx("div",{className:"mt-2 text-[12px] font-medium text-foreground",children:"No transcript output yet"})]}),!d&&!o&&u.map(({event:a,subItems:m},f)=>e.jsx(B,{event:a,agent:t==null?void 0:t.agent,subItems:m,questionResponseDisabled:!0},`shared-${f}`))]})});return e.jsxs("div",{className:"relative h-full overflow-hidden bg-background text-foreground",children:[e.jsx("div",{className:"mesh-grid pointer-events-none absolute inset-0"}),e.jsxs("div",{className:"relative z-10 flex h-full min-h-0 gap-2 px-2 py-2 sm:px-3",children:[e.jsxs("aside",{className:"dashboard-panel dashboard-panel-muted animate-panel-settle hidden w-64 shrink-0 flex-col overflow-hidden rounded-sm px-3 py-3 lg:flex xl:w-72",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-sm border border-border/70 bg-foreground text-[11px] font-semibold tracking-[0.24em] text-background shadow-none",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-[12px] font-semibold text-foreground",children:"Meshy Workspace"}),e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.24em] text-muted-foreground",children:"Shared view"})]})]}),e.jsx("div",{className:"mt-4 text-[10px] font-medium uppercase tracking-[0.24em] text-muted-foreground",children:"Shared conversation"}),t&&e.jsxs("div",{className:"mt-2 space-y-2.5",children:[e.jsx("h1",{className:"max-h-24 overflow-hidden break-words text-[13px] font-semibold leading-5 text-foreground [overflow-wrap:anywhere]",title:t.title,children:t.title}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(T,{status:t.status}),e.jsx(C,{priority:t.priority})]}),e.jsxs("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[e.jsxs("div",{children:["updated ",P(t.updatedAt)]}),e.jsx("div",{className:"font-mono",children:t.id.slice(0,8)})]})]}),e.jsxs("div",{className:"mt-auto space-y-2 pt-6",children:[c&&e.jsx("div",{className:"rounded-sm border border-border/70 bg-background/80 p-2.5 font-mono text-[11px] text-foreground shadow-none",children:"npx -y meshy-node@latest start"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("a",{href:"https://github.com/ai-microsoft/meshy",target:"_blank",rel:"noreferrer","aria-label":"Open Meshy on GitHub",className:"inline-flex h-8 w-8 items-center justify-center rounded-sm border border-border/70 bg-background/70 text-muted-foreground transition-colors hover:text-foreground",children:e.jsx(Z,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",onClick:()=>b(a=>!a),"aria-expanded":c,className:"inline-flex h-8 items-center gap-1.5 rounded-sm border border-border/70 bg-background/70 px-2.5 text-[11px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(M,{className:"h-4 w-4"}),"Try it"]})]})]})]}),e.jsxs("main",{className:"dashboard-panel animate-panel-settle flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden rounded-sm",children:[e.jsxs("header",{className:"shrink-0 border-b border-border/55 bg-card/28 px-3 py-2 sm:px-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-sm border border-border/70 bg-foreground text-[11px] font-semibold tracking-[0.24em] text-background lg:hidden",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.28em] text-muted-foreground",children:"Meshy Workspace"}),e.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:(t==null?void 0:t.title)??"Shared conversation"})]})]}),h&&e.jsxs("div",{className:"mt-3 inline-flex h-auto rounded-sm bg-muted/70 p-0.5 text-muted-foreground",children:[e.jsx("button",{type:"button",onClick:()=>x("transcript"),className:g(n==="transcript"),children:"Transcript"}),e.jsx("button",{type:"button",onClick:()=>x("files"),className:g(n==="files"),children:"Files"}),e.jsx("button",{type:"button",onClick:()=>x("preview"),className:g(n==="preview"),children:"Preview"})]})]}),h&&t?e.jsxs(e.Fragment,{children:[n==="transcript"&&p,n==="files"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(v,{label:"Loading files..."}),children:e.jsx(q,{taskId:t.shareId,api:V})})}),n==="preview"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(v,{label:"Loading preview..."}),children:e.jsx(U,{taskId:t.shareId,api:H,allowPortPreview:!1})})})]}):p]})]})]})}function g(t){return t?"inline-flex items-center justify-center whitespace-nowrap rounded-sm bg-background px-2.5 py-0.5 text-[11px] font-medium text-foreground shadow-sm":"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-2.5 py-0.5 text-[11px] font-medium transition-colors hover:text-foreground"}function Z({className:t}){return e.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.58 2 12.23c0 4.51 2.87 8.34 6.84 9.7.5.1.68-.22.68-.49 0-.24-.01-.88-.01-1.73-2.78.62-3.37-1.37-3.37-1.37-.45-1.18-1.11-1.49-1.11-1.49-.91-.64.07-.63.07-.63 1 .07 1.53 1.06 1.53 1.06.89 1.56 2.34 1.11 2.91.85.09-.66.35-1.11.63-1.37-2.22-.26-4.55-1.14-4.55-5.05 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.31.1-2.71 0 0 .84-.27 2.75 1.05A9.3 9.3 0 0 1 12 6.96c.85 0 1.71.12 2.51.34 1.91-1.32 2.75-1.05 2.75-1.05.55 1.4.2 2.45.1 2.71.64.72 1.03 1.63 1.03 2.75 0 3.92-2.34 4.79-4.57 5.05.36.32.68.94.68 1.9 0 1.37-.01 2.47-.01 2.81 0 .27.18.59.69.49A10.05 10.05 0 0 0 22 12.23C22 6.58 17.52 2 12 2Z"})})}export{K as SharedConversationPage,W as SharedConversationView};
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-9hU42hur.js";/**
1
+ import{c as a}from"./index-C7-ljTCx.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.