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.
@@ -1,18 +0,0 @@
1
- import{c as W,j as n,b as k,r as c,bI as A,bD as B,v as U,k as I,R as V,i as G}from"./index-9hU42hur.js";import{G as H}from"./DashboardPage-D21dWlmw.js";import{F as J}from"./file-B8vnmnf2.js";import"./DashboardShared-CtD601bB.js";import"./MarkdownPreviewFrame-hB6tBCB8.js";import"./PreviewTab-BBaAgEyn.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 z=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],q=W("columns-2",z);/**
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 K=[["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"}]],Q=W("rows-3",K);function X(e,t){if(!(e!=null&&e.trim()))return[];const r=e.split(`
12
- `),i=[];let s=[];const d=()=>{if(s.length===0)return;const a=s.join(`
13
- `).trim();if(!a){s=[];return}const o=oe(s);if(!o){s=[];return}i.push({id:`${t}:${o}`,path:o,section:t,patch:a}),s=[]};for(const a of r)a.startsWith("diff --git ")&&s.length>0&&d(),s.push(a);return d(),i}function F(e,t,r){const i=(e==null?void 0:e.filter(s=>s.section===r))??[];return i.length===0?X(t,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 Y(e){const t=[];for(const r of[...e].sort((i,s)=>i.path.localeCompare(s.path))){const i=r.path.split("/").filter(Boolean);let s=t,d="";i.forEach((a,o)=>{d=d?`${d}/${a}`:a;const l=o===i.length-1;let m=s.find(u=>u.name===a);m||(m=l?{type:"file",name:a,path:d,item:r}:{type:"folder",name:a,path:d,children:[]},s.push(m)),l||(m.children??(m.children=[]),s=m.children)})}return t}function Z(e){const t=[];let r="";for(const i of e.split("/").filter(Boolean).slice(0,-1))r=r?`${r}/${i}`:i,t.push(r);return t}function ee(e){return e.filter(t=>t&&!t.endsWith("/")).map(t=>({id:`untracked:${t}`,path:t,section:"untracked"}))}function te({oldContent:e,newContent:t,patch:r}){const i=D(e),s=D(t),d=se(r);if(d.length===0)return ie(i,s);const a=[];let o=1,l=1;const m=(u,h)=>{const f=Math.min(u,i.length+1),v=Math.min(h,s.length+1);for(;o<f||l<v;){const p=o<f&&o<=i.length,y=l<v&&l<=s.length;a.push({oldLineNumber:p?o:null,newLineNumber:y?l:null,oldContent:p?i[o-1]??"":"",newContent:y?s[l-1]??"":"",kind:p&&y?"context":p?"removed":"added"}),o<f&&(o+=1),l<v&&(l+=1)}o<u&&(o=u),l<h&&(l=h)};for(const u of d){m(u.oldStart>0?u.oldStart:o,u.newStart>0?u.newStart:l);let h=0;for(;h<u.lines.length;){const f=u.lines[h];if(!f)break;if(f.kind==="context"){a.push({oldLineNumber:o,newLineNumber:l,oldContent:i[o-1]??f.content,newContent:s[l-1]??f.content,kind:"context"}),o+=1,l+=1,h+=1;continue}const v=[],p=[];for(;h<u.lines.length;){const g=u.lines[h];if(!g||g.kind==="context")break;g.kind==="removed"?(v.push({lineNumber:o,content:i[o-1]??g.content}),o+=1):(p.push({lineNumber:l,content:s[l-1]??g.content}),l+=1),h+=1}const y=Math.max(v.length,p.length);for(let g=0;g<y;g+=1){const N=v[g],w=p[g];a.push({oldLineNumber:(N==null?void 0:N.lineNumber)??null,newLineNumber:(w==null?void 0:w.lineNumber)??null,oldContent:(N==null?void 0:N.content)??"",newContent:(w==null?void 0:w.content)??"",kind:N&&w?"changed":N?"removed":"added"})}}}for(;o<=i.length||l<=s.length;){const u=o<=i.length,h=l<=s.length;a.push({oldLineNumber:u?o:null,newLineNumber:h?l:null,oldContent:u?i[o-1]??"":"",newContent:h?s[l-1]??"":"",kind:u&&h?"context":u?"removed":"added"}),u&&(o+=1),h&&(l+=1)}return a}function ne(e){return D(e).map((t,r)=>({oldLineNumber:null,newLineNumber:r+1,oldContent:"",newContent:t,kind:"added"}))}function re(e){const t=[];for(const r of e){if(r.kind==="context"){t.push({oldLineNumber:r.oldLineNumber,newLineNumber:r.newLineNumber,content:r.newContent||r.oldContent,kind:"context",prefix:" "});continue}if(r.kind==="changed"){t.push({oldLineNumber:r.oldLineNumber,newLineNumber:null,content:r.oldContent,kind:"removed",prefix:"-"}),t.push({oldLineNumber:null,newLineNumber:r.newLineNumber,content:r.newContent,kind:"added",prefix:"+"});continue}if(r.kind==="removed"){t.push({oldLineNumber:r.oldLineNumber,newLineNumber:null,content:r.oldContent,kind:"removed",prefix:"-"});continue}t.push({oldLineNumber:null,newLineNumber:r.newLineNumber,content:r.newContent,kind:"added",prefix:"+"})}return t}function D(e){if(!e)return[];const t=e.replace(/\r\n/g,`
14
- `).replace(/\r/g,`
15
- `).split(`
16
- `);return t.length>0&&t[t.length-1]===""&&t.pop(),t}function se(e){if(!e)return[];const t=[];let r=null;for(const i of e.split(`
17
- `)){const s=i.match(/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);if(s){r={oldStart:Number(s[1]??0),newStart:Number(s[2]??0),lines:[]},t.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 t}function ie(e,t){const r=Math.max(e.length,t.length),i=[];for(let s=0;s<r;s+=1){const d=s<e.length,a=s<t.length,o=e[s]??"",l=t[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 oe(e){var d,a;const t=(d=e.find(o=>o.startsWith("+++ ")))==null?void 0:d.slice(4).trim();if(t&&t!=="/dev/null")return T(t);const r=(a=e.find(o=>o.startsWith("--- ")))==null?void 0:a.slice(4).trim();if(r&&r!=="/dev/null")return T(r);const i=e.find(o=>o.startsWith("diff --git "));if(!i)return null;const s=i.match(/^diff --git a\/(.+?) b\/(.+)$/);return s?T(s[2]||s[1]||""):null}function T(e){return e.replace(/^[ab]\//,"")}function de({item:e,viewMode:t}){return e.binary?n.jsx(j,{tone:"muted",children:"Binary file changed."}):typeof e.oldContent=="string"||typeof e.newContent=="string"?n.jsx(M,{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:t}):n.jsx(xe,{patch:e.patch??""})}function le({loading:e,error:t,content:r,viewMode:i}){if(e)return n.jsx(j,{tone:"muted",children:"Loading file content..."});if(t)return n.jsx(j,{tone:"destructive",children:t});if(!r)return n.jsx(j,{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?n.jsx("div",{className:"flex min-h-[18rem] items-center justify-center rounded-sm bg-background/55 p-3",children:n.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)]"})}):n.jsx(j,{tone:"muted",children:"Image preview is not available."})}if(r.kind==="pdf"&&r.downloadUrl)return n.jsx("div",{className:"h-full min-h-[22rem] overflow-hidden rounded-sm bg-background/55",children:n.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 n.jsx(M,{oldContent:"",newContent:s,addedOnly:!0,newTitle:"Untracked",newTruncated:r.truncated,viewMode:i})}return r.kind==="markdown"||r.kind==="text"||r.kind==="html"?n.jsx(M,{oldContent:"",newContent:r.content,addedOnly:!0,newTitle:"Untracked",newTruncated:r.truncated,viewMode:i}):n.jsx(j,{tone:"muted",children:"This file cannot be previewed inline."})}function M({oldContent:e,newContent:t,patch:r,oldTitle:i="Base",newTitle:s="Current",oldTruncated:d=!1,newTruncated:a=!1,addedOnly:o=!1,viewMode:l}){const m=c.useMemo(()=>o?ne(t):te({oldContent:e,newContent:t,patch:r}),[o,t,e,r]);return n.jsxs("div",{className:"overflow-hidden rounded-sm bg-background/55",children:[n.jsx("div",{className:"overflow-x-auto",children:l==="inline"?n.jsx(ce,{rows:m,oldTitle:i,newTitle:s}):n.jsx(ae,{rows:m,oldTitle:i,newTitle:s})}),(d||a)&&n.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 ae({rows:e,oldTitle:t,newTitle:r}){return n.jsxs(n.Fragment,{children:[n.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:[n.jsx("span",{className:"border-r border-border/50 px-2 py-1.5 text-right text-muted-foreground/60",children:"#"}),n.jsx("span",{className:"border-r border-border/60 px-2 py-1.5 font-medium text-foreground",children:t}),n.jsx("span",{className:"border-r border-border/50 px-2 py-1.5 text-right text-muted-foreground/60",children:"#"}),n.jsx("span",{className:"px-2 py-1.5 font-medium text-foreground",children:r})]}),n.jsx("div",{className:"font-mono text-[10px] leading-4",children:e.length>0?e.map((i,s)=>n.jsx(ue,{row:i},`${s}:${i.oldLineNumber??"x"}:${i.newLineNumber??"x"}`)):n.jsx("div",{className:"min-w-[52rem] px-2.5 py-2 text-[10px] text-muted-foreground",children:"No text content."})})]})}function ce({rows:e,oldTitle:t,newTitle:r}){const i=c.useMemo(()=>re(e),[e]);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid min-w-[42rem] grid-cols-[3rem_3rem_minmax(0,1fr)] bg-muted/30 font-mono text-[10px] leading-4",children:[n.jsx("span",{className:"border-r border-border/50 px-2 py-1.5 text-right text-muted-foreground/60",children:"old"}),n.jsx("span",{className:"border-r border-border/50 px-2 py-1.5 text-right text-muted-foreground/60",children:"new"}),n.jsxs("span",{className:"px-2 py-1.5 font-medium text-foreground",children:[t," / ",r]})]}),n.jsx("div",{className:"font-mono text-[10px] leading-4",children:i.length>0?i.map((s,d)=>n.jsx(me,{row:s},`${d}:${s.oldLineNumber??"x"}:${s.newLineNumber??"x"}:${s.prefix}`)):n.jsx("div",{className:"min-w-[42rem] px-2.5 py-2 text-[10px] text-muted-foreground",children:"No text content."})})]})}function ue({row:e}){return n.jsxs("div",{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:[n.jsx("span",{className:k("select-none border-r border-border/40 px-2 py-px text-right text-muted-foreground/55",_(e)),children:e.oldLineNumber??""}),n.jsx("span",{className:k("whitespace-pre-wrap break-all border-r border-border/60 px-2 py-px text-foreground",_(e)),children:e.oldContent||" "}),n.jsx("span",{className:k("select-none border-r border-border/40 px-2 py-px text-right text-muted-foreground/55",R(e)),children:e.newLineNumber??""}),n.jsx("span",{className:k("whitespace-pre-wrap break-all px-2 py-px text-foreground",R(e)),children:e.newContent||" "})]})}function me({row:e}){return n.jsxs("div",{className:k("grid min-w-[42rem] grid-cols-[3rem_3rem_minmax(0,1fr)] border-b border-border/25 last:border-b-0",he(e)),children:[n.jsx("span",{className:"select-none border-r border-border/40 px-2 py-px text-right text-muted-foreground/55",children:e.oldLineNumber??""}),n.jsx("span",{className:"select-none border-r border-border/40 px-2 py-px text-right text-muted-foreground/55",children:e.newLineNumber??""}),n.jsxs("span",{className:"whitespace-pre-wrap break-all px-2 py-px text-foreground",children:[n.jsx("span",{className:"mr-2 inline-block w-2 select-none text-muted-foreground/60",children:e.prefix}),e.content||" "]})]})}function xe({patch:e}){const t=e.split(`
18
- `);return n.jsxs("div",{className:"rounded-sm bg-background/55",children:[n.jsxs("div",{className:"px-2.5 py-1.5",children:[n.jsx("div",{className:"text-[10px] font-medium text-foreground",children:"Patch"}),n.jsxs("div",{className:"mt-0.5 text-[9px] text-muted-foreground",children:[t.length," lines"]})]}),n.jsx("div",{className:"font-mono text-[10px] leading-4",children:t.map((r,i)=>n.jsxs("div",{className:k("grid grid-cols-[36px_minmax(0,1fr)] gap-2 px-2.5 py-px",fe(r)),children:[n.jsx("span",{className:"select-none text-right text-muted-foreground/55",children:i+1}),n.jsx("span",{className:"whitespace-pre-wrap break-all text-foreground",children:r||" "})]},`${i}-${r}`))})]})}function j({children:e,tone:t}){return n.jsx("div",{className:k("flex h-full min-h-[10rem] items-center justify-center rounded-sm text-[10px]",t==="muted"?"text-muted-foreground":"text-destructive"),children:e})}function _(e){return e.kind==="removed"||e.kind==="changed"?"bg-destructive/10":e.kind==="added"?"bg-muted/25 text-muted-foreground":""}function R(e){return e.kind==="added"||e.kind==="changed"?"bg-emerald-500/10":e.kind==="removed"?"bg-muted/25 text-muted-foreground":""}function he(e){return e.kind==="added"?"bg-emerald-500/10":e.kind==="removed"?"bg-destructive/10":""}function fe(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":""}const pe={staged:"Staged",unstaged:"Unstaged",untracked:"Untracked"};function Se({taskId:e}){const[t,r]=c.useState(null),[i,s]=c.useState(!0),[d,a]=c.useState(null),[o,l]=c.useState(null),[m,u]=c.useState(null),[h,f]=c.useState(!1),[v,p]=c.useState(null),[y,g]=c.useState("split"),N=c.useCallback(async()=>{s(!0),a(null),r(null);try{const x=await A(e);r(x)}catch(x){a(x instanceof Error?x.message:"Failed to load diff")}finally{s(!1)}},[e]);c.useEffect(()=>{N()},[N]);const w=c.useMemo(()=>F(t==null?void 0:t.files,t==null?void 0:t.staged,"staged"),[t==null?void 0:t.files,t==null?void 0:t.staged]),$=c.useMemo(()=>F(t==null?void 0:t.files,t==null?void 0:t.unstaged,"unstaged"),[t==null?void 0:t.files,t==null?void 0:t.unstaged]),E=c.useMemo(()=>ee((t==null?void 0:t.untrackedFiles)??[]),[t==null?void 0:t.untrackedFiles]),S=c.useMemo(()=>[{section:"staged",items:w},{section:"unstaged",items:$},{section:"untracked",items:E}],[w,$,E]),L=c.useMemo(()=>S.flatMap(x=>x.items),[S]),P=c.useMemo(()=>S.filter(x=>x.items.length>0),[S]),b=c.useMemo(()=>L.find(x=>x.id===o)??L[0]??null,[L,o]);return c.useEffect(()=>{var x;(!o||!L.some(C=>C.id===o))&&l(((x=L[0])==null?void 0:x.id)??null)},[L,o]),c.useEffect(()=>{if(u(null),p(null),f(!1),!b||b.section!=="untracked")return;if(b.path.endsWith("/")){p("This untracked path is a directory. Open the Files tab to inspect its contents.");return}let x=!1;return f(!0),B(e,b.path).then(C=>{x||u(C)}).catch(C=>{x||p(C instanceof Error?C.message:"Failed to load file content")}).finally(()=>{x||f(!1)}),()=>{x=!0}},[b,e]),i?n.jsx(j,{tone:"muted",children:"Loading diff..."}):d?n.jsx(j,{tone:"destructive",children:d}):t!=null&&t.available?L.length>0?n.jsxs("div",{className:"grid h-full min-h-0 grid-cols-1 lg:grid-cols-[16rem_minmax(0,1fr)] lg:pl-5",children:[n.jsxs("aside",{className:"flex min-h-0 flex-col bg-card/25 lg:border-r lg:border-border/50",children:[n.jsx("div",{className:"shrink-0 bg-card/20 px-2.5 py-1.5",children:n.jsx("div",{className:"flex items-start justify-between gap-1.5",children:n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"flex items-center gap-1 text-[10px] font-semibold text-foreground",children:[n.jsx(H,{className:"h-3 w-3 text-muted-foreground"}),n.jsx("span",{className:"truncate",children:t.branch??"detached HEAD"})]}),t.repoRoot&&n.jsx("div",{className:"mt-1 truncate font-mono text-[10px] leading-4 text-muted-foreground",children:t.repoRoot})]})})}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-1",children:n.jsx("div",{className:"space-y-1",children:P.map(({section:x,items:C})=>n.jsx(ge,{section:x,items:C,selectedId:(b==null?void 0:b.id)??null,onSelect:l},x))})})]}),n.jsx("section",{className:"min-h-0 flex flex-col bg-card/15",children:b?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"shrink-0 px-2.5 py-1.5",children:n.jsxs("div",{className:"flex items-start justify-between gap-2",children:[n.jsx("div",{className:"min-w-0 break-all font-mono text-[9px] text-muted-foreground",children:b.path}),n.jsx(be,{mode:y,onModeChange:g})]})}),n.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-1.5 pb-1.5 pt-1",children:b.section==="untracked"?n.jsx(le,{loading:h,error:v,content:m,viewMode:y}):n.jsx(de,{item:b,viewMode:y})})]}):n.jsx(j,{tone:"muted",children:"Select a file to inspect."})})]}):n.jsx(j,{tone:"muted",children:"Working tree is clean."}):n.jsx(j,{tone:"muted",children:"Task working directory is not inside a Git repository."})}function ge({section:e,items:t,selectedId:r,onSelect:i}){const s=c.useMemo(()=>Y(t),[t]),d=c.useMemo(()=>t.find(m=>m.id===r)??null,[t,r]),a=c.useMemo(()=>new Set(d?Z(d.path):[]),[d]),[o,l]=c.useState(!0);return t.length===0?null:n.jsxs("section",{className:"rounded-sm bg-background/35",children:[n.jsxs("button",{type:"button",onClick:()=>l(m=>!m),"aria-expanded":o,className:k("flex w-full items-center justify-between gap-1.5 px-2 py-1 text-left transition-colors hover:bg-background/55"),children:[n.jsxs("div",{className:"flex items-center gap-1",children:[o?n.jsx(U,{className:"h-3 w-3 shrink-0 text-muted-foreground"}):n.jsx(I,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"text-[10px] font-medium text-foreground",children:pe[e]})]}),n.jsx(V,{variant:"outline",className:"rounded-sm border-transparent bg-muted/45 px-1.5 py-0 text-[9px]",children:t.length})]}),o&&n.jsx("div",{className:"p-1",children:s.length>0?n.jsx("div",{className:"space-y-0.5",children:s.map(m=>n.jsx(O,{node:m,depth:0,selectedId:r,expandedAncestorPaths:a,onSelect:i},`${e}:${m.path}`))}):null})]})}function be({mode:e,onModeChange:t}){const r=i=>k("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 n.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:[n.jsxs("button",{type:"button","aria-pressed":e==="split",title:"Split diff",onClick:()=>t("split"),className:r(e==="split"),children:[n.jsx(q,{className:"h-3 w-3"}),n.jsx("span",{children:"Split"})]}),n.jsxs("button",{type:"button","aria-pressed":e==="inline",title:"Inline diff",onClick:()=>t("inline"),className:r(e==="inline"),children:[n.jsx(Q,{className:"h-3 w-3"}),n.jsx("span",{children:"Inline"})]})]})}function O({node:e,depth:t,selectedId:r,expandedAncestorPaths:i,onSelect:s}){var d;return e.type==="folder"?n.jsx(Ne,{node:e,depth:t,selectedId:r,expandedAncestorPaths:i,onSelect:s}):n.jsxs("button",{type:"button",onClick:()=>{e.item&&s(e.item.id)},className:k("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:`${t*10+5}px`},children:[n.jsx(J,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"truncate text-[10px] leading-4",children:e.name})]})}function Ne({node:e,depth:t,selectedId:r,expandedAncestorPaths:i,onSelect:s}){const[d,a]=c.useState(!0);return c.useEffect(()=>{i.has(e.path)&&a(!0)},[i,e.path]),n.jsxs("div",{children:[n.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:`${t*10+5}px`},children:[d?n.jsx(U,{className:"h-3 w-3 shrink-0"}):n.jsx(I,{className:"h-3 w-3 shrink-0"}),n.jsx(G,{className:"h-3 w-3 shrink-0"}),n.jsx("span",{className:"truncate",children:e.name})]}),d&&n.jsx("div",{className:"space-y-0.5",children:(e.children??[]).map(o=>n.jsx(O,{node:o,depth:t+1,selectedId:r,expandedAncestorPaths:i,onSelect:s},o.path))})]})}export{Se as DiffTab};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-B_30Lp2l.js","assets/index-9hU42hur.js","assets/index-DQIXvvgG.css","assets/MarkdownPreviewFrame-hB6tBCB8.js","assets/DashboardShared-CtD601bB.js","assets/file-B8vnmnf2.js","assets/PreviewTab-BBaAgEyn.js"])))=>i.map(i=>d[i]);
2
- import{b5 as N,r as s,j as e,bs as k,Q as S,U as T,a8 as C,bt as P,bu as M,bv as j,bw as E,bx as _,a3 as w,by as L}from"./index-9hU42hur.js";import{w as O,x as A,u as I,s as F,h as R,L as z,M as D,C as U,T as v,m as B}from"./DashboardShared-CtD601bB.js";const G=s.lazy(async()=>({default:(await w(()=>import("./FilesTab-B_30Lp2l.js"),__vite__mapDeps([0,1,2,3,4,5]))).FilesTab})),V=s.lazy(async()=>({default:(await w(()=>import("./PreviewTab-BBaAgEyn.js").then(r=>r.c),__vite__mapDeps([6,1,2]))).PreviewTab})),q={getOutput:j,getOutputTree:M,getOutputContent:P},W={getOutput:j,createPreviewSession:(t,r)=>L(t,typeof r=="string"?r:r==null?void 0:r.path)};function J(){const{shareId:t}=N(),[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([E(t),_(t)]);if(u||l.current!==t)return;d(m),n(y=>a?f.logs:B(y,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(H,{conversation:r,logs:o,loading:x,error:b})}function H({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=O(t.payload.initialMessage);return a.length>0&&A(r,a)?null:a.length>0?I(a,new Date(t.createdAt).toISOString()):null},[t,r]),l=s.useMemo(()=>F([...i?[i]:[],...r]),[i,r]),u=s.useMemo(()=>R(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(z,{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(D,{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(U,{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(k,{status:t.status}),e.jsx(S,{priority:t.priority})]}),e.jsxs("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[e.jsxs("div",{children:["updated ",T(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(Q,{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(C,{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(G,{taskId:t.shareId,api:q})})}),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(V,{taskId:t.shareId,api:W,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 Q({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{J as SharedConversationPage,H as SharedConversationView};