meshy-node 0.10.4 → 0.10.6

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,4 +1,4 @@
1
- import{c as _,j as n,d as j,r as l,bX as K,bS as Q,y as B,n as V,a0 as Y,l as Z}from"./index-DtTy7Ax9.js";import{A as ee,G as ne}from"./DashboardPage-0WRjBujS.js";import{F as te}from"./file-Bp3lcXJZ.js";import"./DashboardShared-BGkSTKYP.js";import"./MarkdownPreviewFrame-DwALMk1j.js";import"./PreviewTab-CLE4ZFIp.js";/**
1
+ import{c as _,j as n,d as j,r as l,bX as K,bS as Q,y as B,n as V,a0 as Y,l as Z}from"./index-BfhJ5QGx.js";import{A as ee,G as ne}from"./DashboardPage-G8tVKIEN.js";import{F as te}from"./file-Du0lhUCi.js";import"./DashboardShared-CnAnYJXR.js";import"./MarkdownPreviewFrame-BueJ6Pjk.js";import"./PreviewTab-K7c436fs.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1,11 @@
1
+ import{c as fe,r as i,bS as je,bT as ke,bU as Ne,j as t,l as oe,B as P,x as le,X as Se,n as Ce,d as x,t as Ee}from"./index-BfhJ5QGx.js";import{E as Fe,M as Pe,L as De}from"./MarkdownPreviewFrame-BueJ6Pjk.js";import{G as L,H as Te,J as _e,K as Oe,N as ze,O as Re,P as $e}from"./DashboardShared-CnAnYJXR.js";import{F as Ae}from"./file-Du0lhUCi.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 Be=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],de=fe("arrow-left",Be);/**
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 Le=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Me=fe("download",Le),Ue="save_dashboard_download";function me(e=xe()){const n=e?.__TAURI__?.core?.invoke;return typeof n=="function"?n:null}function He(e){const d=(e.trim().replace(/\\/g,"/").split("/").filter(Boolean).pop()??"").replace(/[<>:"/\\|?*\x00-\x1f]/g,"_").replace(/^[ .]+|[ .]+$/g,"");return d.length>0?d:"download"}async function Ke({href:e,filePath:n,currentWindow:o=xe(),fetchImpl:d=fetch}){const c=me(o);if(!c)return!1;const l=await d(e,{cache:"no-store"});if(!l.ok)throw new Error(`Failed to download file (${l.status})`);const M=await l.blob(),k=await Je(M),N=await c(Ue,{fileName:He(n),contentBase64:k});return!Qe(N)||N.saved!==!1}async function Je(e){const n=new Uint8Array(await e.arrayBuffer()),o=[],d=32768;for(let c=0;c<n.length;c+=d){const l=n.subarray(c,c+d);o.push(String.fromCharCode(...l))}return btoa(o.join(""))}function xe(){return typeof window>"u"?null:window}function Qe(e){return!!(e&&typeof e=="object"&&"saved"in e)}const Xe={getOutput:Ne,getOutputTree:ke,getOutputContent:je},ce=120,Ve=1200;function at({taskId:e,api:n=Xe,requestedFilePath:o=null,requestedFileRequestId:d=0,onPreviewFile:c}){const[l,M]=i.useState(null),[k,N]=i.useState([]),[S,Z]=i.useState({}),[C,D]=i.useState(new Set),[U,H]=i.useState(new Set),[g,T]=i.useState("."),[h,E]=i.useState(null),[ge,v]=i.useState(!1),[y,b]=i.useState(""),[q,_]=i.useState([]),[ee,O]=i.useState(!1),[te,z]=i.useState(null),[K,R]=i.useState(!0),[re,f]=i.useState(null),ae=i.useRef(null),J=i.useRef(null),m=l?.summary?.rootPath??l?.effectiveProjectPath??null,Q=y.trim(),w=Q.length>0,p=ge||y.length>0,se=i.useCallback(async()=>{f(null),R(!0),T("."),N([]),Z({}),D(new Set),H(new Set),E(null),v(!1),b(""),_([]),z(null),J.current=null;try{const a=await n.getOutput(e);if(M(a),!a.available){R(!1);return}const r=await n.getOutputTree(e,".");N(r.entries),R(!1)}catch(a){f(a instanceof Error?a.message:"Failed to load output"),R(!1)}},[n,e]);i.useEffect(()=>{se()},[se]);const $=i.useCallback(async a=>{const r=L(a,m);if(!r)return f("Invalid directory path"),[];if(S[r])return S[r];f(null),H(s=>new Set(s).add(r));try{const s=await n.getOutputTree(e,r);return Z(u=>({...u,[r]:s.entries})),s.entries}catch(s){return f(s instanceof Error?s.message:"Failed to load directory"),[]}finally{H(s=>{const u=new Set(s);return u.delete(r),u})}},[n,S,m,e]),A=i.useCallback(async a=>{const r=a.filter(s=>s!==".");if(r.length!==0){D(s=>{const u=new Set(s);for(const F of r)u.add(F);return u});for(const s of r)await $(s)}},[$]),X=i.useCallback(async a=>{const r=L(a,m);if(!r){f("Invalid directory path");return}v(!1),b(""),T(r),E(null),r!=="."&&await A(Ye(r))},[A,m]),ve=i.useCallback(async a=>{const r=L(a,m);if(!r){f("Invalid directory path");return}if(T(r),E(null),C.has(r)){D(s=>{const u=new Set(s);return u.delete(r),u});return}D(s=>new Set(s).add(r)),await $(r)},[C,$,m]),B=i.useCallback(async a=>{const r=L(a,m);if(!r){f("Invalid file path");return}f(null);try{const s=Te(r);v(!1),b(""),await A(_e(r));const u=await n.getOutputContent(e,r);T(s),E(u)}catch(s){f(s instanceof Error?s.message:"Failed to load file")}},[n,A,m,e]),be=i.useCallback(()=>{if(g===".")return;const a=g.split("/");a.pop();const r=a.length===0?".":a.join("/");X(r)},[g,X]);i.useEffect(()=>{if(!o||!l?.available||K)return;const a=`${d}:${o}`;J.current!==a&&(J.current=a,b(""),B(o))},[K,B,l?.available,o,d]),i.useEffect(()=>{p&&ae.current?.focus()},[p]),i.useEffect(()=>{if(!w||!l?.available){O(!1),_([]),z(null);return}let a=!1;async function r(){O(!0),z(null);const s=["."],u=new Set,F=[];let ie=0;try{for(;s.length>0&&ie<Ve&&F.length<ce;){const j=s.shift()??".";if(u.has(j))continue;u.add(j);const W=await n.getOutputTree(e,j);if(a)return;ie+=W.entries.length,F.push(...Re(W.entries,Q));for(const G of W.entries)G.type==="directory"&&!u.has(G.path)&&s.push(G.path)}a||(_(F.slice(0,ce)),O(!1))}catch(j){a||(_([]),z(j instanceof Error?j.message:"Failed to search files"),O(!1))}}return r(),()=>{a=!0}},[n,Q,l?.available,w,e]);const we=i.useMemo(()=>Oe(k,S,C,U),[S,k,C,U]),V=w?q.map(a=>({entry:a,depth:ze(a.path),expanded:a.type==="directory"&&C.has(a.path),loading:a.type==="directory"&&U.has(a.path)})):we;if(K)return t.jsx(I,{tone:"muted",children:"Loading files..."});if(re)return t.jsx(I,{tone:"destructive",children:re});if(!l?.available)return t.jsx(I,{tone:"muted",children:"Task output is not available yet. The task may not have started."});const ne=(l.summary?.htmlEntries.length??0)+(l.summary?.markdownEntries?.length??0),ye=w?`${q.length}${ee?"+":""} matches`:`${l.summary?.fileCount??k.length} files`;return 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:x("flex min-h-0 flex-col bg-card/25 lg:border-r lg:border-border/50",h&&"hidden lg:flex"),children:[t.jsxs("div",{className:"shrink-0 bg-card/20 px-2 py-1.5",children:[t.jsxs("div",{className:"flex items-start gap-1.5",children:[t.jsx("div",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-sm bg-primary/10 text-primary",children:t.jsx(oe,{className:"h-3.5 w-3.5"})}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"truncate text-[12px] font-semibold leading-4 text-foreground",children:l.summary?.rootName??"Artifacts"}),t.jsxs("div",{className:"text-[10px] leading-4 text-muted-foreground",children:[ye,ne>0&&` · ${ne} previews`]})]}),t.jsx(P,{type:"button",variant:p?"secondary":"ghost",size:"icon","aria-expanded":p,"aria-label":p&&y.length===0?"Hide file search":"Search files",title:p&&y.length===0?"Hide file search":"Search files",className:"h-6 w-6 shrink-0 rounded-sm",onClick:()=>{p&&y.length===0?v(!1):v(!0)},children:t.jsx(le,{className:"h-3.5 w-3.5"})})]}),t.jsxs("div",{className:"mt-1 flex min-h-5 items-center gap-1 rounded-sm bg-muted/35 px-1.5 py-0",children:[g!=="."&&t.jsx(P,{variant:"ghost",size:"icon",className:"h-5 w-5 rounded-sm",onClick:be,children:t.jsx(de,{className:"h-3 w-3"})}),t.jsx("span",{className:"truncate font-mono text-[10px] leading-4 text-muted-foreground",children:g==="."?l.summary?.rootPath??l.summary?.rootName??"/":g})]}),p&&t.jsxs("div",{className:"mt-1 flex items-center gap-1 rounded-sm bg-muted/35 px-1.5 py-0",children:[t.jsx(le,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("input",{ref:ae,value:y,onChange:a=>b(a.target.value),onKeyDown:a=>{a.key==="Escape"&&(b(""),v(!1))},placeholder:"Search files and folders",className:"h-5 min-w-0 flex-1 bg-transparent text-[10px] leading-4 text-foreground outline-none placeholder:text-muted-foreground/70"}),t.jsx("button",{type:"button",onClick:()=>{b(""),v(!1)},className:"flex h-4 w-4 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted/70 hover:text-foreground","aria-label":"Close file search",children:t.jsx(Se,{className:"h-3 w-3"})})]})]}),t.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-1",children:ee&&V.length===0?t.jsx("div",{className:"flex h-full items-center justify-center rounded-sm border border-dashed border-border/70 bg-background/35 px-3 text-center text-[11px] text-muted-foreground",children:"Searching files..."}):te?t.jsx("div",{className:"flex h-full items-center justify-center rounded-sm border border-dashed border-destructive/35 bg-destructive/10 px-3 text-center text-[11px] text-destructive",children:te}):V.length>0?t.jsx("div",{className:"space-y-0",children:V.map(a=>{const r=a.entry,s=h?.path===r.path||!h&&r.type==="directory"&&g===r.path;return t.jsxs("button",{type:"button","aria-current":s?"page":void 0,style:{"--tree-depth":a.depth,paddingLeft:`${4+a.depth*11}px`},onClick:()=>{r.type==="directory"?w?X(r.path):ve(r.path):B(r.path)},className:x("animate-task-row-reveal group relative flex min-h-5 w-full items-center gap-1 rounded-sm py-0 text-left transition-all duration-150",s?'bg-primary/10 text-foreground before:absolute before:left-0 before:top-1/2 before:h-1/2 before:w-[2px] before:-translate-y-1/2 before:rounded-full before:bg-primary before:content-[""]':"text-foreground hover:bg-muted/40"),children:[r.type==="directory"?t.jsx(Ce,{className:x("h-3 w-3 shrink-0 text-muted-foreground transition-transform",s&&"text-primary",a.expanded&&"rotate-90")}):t.jsx("span",{className:"h-3 w-3 shrink-0"}),r.type==="directory"?t.jsx(oe,{className:x("h-3 w-3 shrink-0 text-muted-foreground group-hover:text-foreground",s&&"text-primary")}):t.jsx(Ae,{className:x("h-3 w-3 shrink-0 text-muted-foreground group-hover:text-foreground",s&&"text-primary")}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-[10px] font-medium leading-4",children:w?r.path:r.name}),t.jsx("span",{className:x("max-w-[5.75rem] shrink-0 truncate text-right text-[9px] leading-4",s?"text-primary/75":"text-muted-foreground"),children:a.loading?"loading":Ie(r)})]},r.path)})}):t.jsx("div",{className:"flex h-full items-center justify-center rounded-sm border border-dashed border-border/70 bg-background/35 px-3 text-center text-[11px] text-muted-foreground",children:w?"No matching files or folders":"Empty directory"})})]}),t.jsx("section",{className:x("min-h-0 flex flex-col bg-card/15",!h&&"hidden lg:flex"),children:h?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"shrink-0 px-3 py-1.5",children:t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[t.jsx(P,{variant:"ghost",size:"icon","aria-label":"Back to file list",title:"Back to file list",className:"h-6 w-6 shrink-0 rounded-sm text-muted-foreground hover:bg-muted/55 hover:text-foreground",onClick:()=>E(null),children:t.jsx(de,{className:"h-3 w-3"})}),t.jsx("div",{className:"min-w-0 truncate font-mono text-[10px] leading-5 text-muted-foreground",children:h.path})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[c&&Ge(h)&&t.jsx(P,{type:"button",variant:"ghost",size:"icon","aria-label":"Preview file",title:"Preview file",className:"h-6 w-6 shrink-0 rounded-sm text-primary hover:bg-primary/10 hover:text-primary",onClick:()=>c(h.path),children:t.jsx(Fe,{className:"h-3.5 w-3.5"})}),h.downloadUrl&&t.jsx(Y,{href:h.downloadUrl,filePath:h.path,iconOnly:!0})]})]})}),t.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-2.5 pb-2.5 pt-1",children:t.jsx(We,{content:h,rootPath:m,onOpenFile:B})})]}):t.jsx("div",{className:"flex h-full items-center justify-center p-4",children:t.jsxs("div",{className:"max-w-md rounded-lg border border-border/60 bg-background/55 px-4 py-4 text-center",children:[t.jsx("div",{className:"text-[12px] font-medium text-foreground",children:"Select a file to inspect"}),t.jsx("p",{className:"mt-1 text-[11px] leading-5 text-muted-foreground",children:"Preview source files, generated assets, or exported documents from this task."})]})})})]})}function We({content:e,rootPath:n,onOpenFile:o}){const d=e.downloadUrl;if(e.truncated&&!e.content)return t.jsx(pe,{title:"File is too large to preview inline",description:e.path,action:d?t.jsx(Y,{href:d,filePath:e.path}):void 0});if(e.kind==="image"){const c=e.content?`data:${e.mimeType};base64,${e.content}`:d;return c?t.jsx("div",{className:"flex h-full min-h-[16rem] items-center justify-center rounded-sm bg-background/55 p-3",children:t.jsx("img",{src:c,alt:e.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(he,{content:e})}if(e.kind==="pdf"&&d)return t.jsx("div",{className:"h-full min-h-[20rem] overflow-hidden rounded-sm bg-background/55",children:t.jsx("iframe",{src:d,title:e.path,className:"h-full w-full border-0"})});if(e.kind==="json"){let c=e.content;try{c=JSON.stringify(JSON.parse(e.content),null,2)}catch{}return t.jsx(ue,{content:c,truncated:e.truncated})}return e.kind==="markdown"?t.jsx(Pe,{content:e.content,truncated:e.truncated,resolveFileLink:c=>$e(c,n,{allowRootRelative:!0,baseFilePath:e.path}),onOpenFileLink:o}):e.kind==="text"||e.kind==="html"?t.jsx(ue,{content:e.content,truncated:e.truncated}):t.jsx(he,{content:e})}function ue({content:e,truncated:n}){return t.jsxs("div",{className:"rounded-sm bg-background/55",children:[t.jsx(De,{content:e}),n&&t.jsx("div",{className:"bg-muted/30 px-3 py-1.5 text-[10px] text-muted-foreground",children:"Content truncated. Download the file to inspect the full artifact."})]})}function he({content:e}){return t.jsx(pe,{title:`${e.kind} file`,description:e.path,action:e.downloadUrl?t.jsx(Y,{href:e.downloadUrl,filePath:e.path}):void 0})}function Ge(e){return e.kind==="html"||e.kind==="markdown"}function Y({href:e,filePath:n,iconOnly:o=!1}){const d=i.useCallback(c=>{me()&&(c.preventDefault(),Ke({href:e,filePath:n}).catch(l=>{Ee.error(l instanceof Error?l.message:"Failed to save file")}))},[n,e]);return t.jsx(P,{asChild:!0,variant:"ghost",size:o?"icon":"sm",className:x("rounded-sm text-primary shadow-none hover:bg-primary/10 hover:text-primary",o?"h-6 w-6 shrink-0 bg-transparent":"h-7 bg-primary/10 px-2.5 text-[11px] hover:bg-primary/15"),children:t.jsxs("a",{href:e,download:!0,"aria-label":o?"Download file":void 0,title:o?"Download file":void 0,onClick:d,children:[t.jsx(Me,{className:"h-3.5 w-3.5"}),!o&&"Download"]})})}function pe({title:e,description:n,action:o}){return t.jsx("div",{className:"flex h-full min-h-[14rem] items-center justify-center rounded-sm bg-background/35 p-4 text-center",children:t.jsxs("div",{className:"max-w-sm",children:[t.jsx("div",{className:"text-[12px] font-medium text-foreground",children:e}),t.jsx("div",{className:"mt-1 break-all font-mono text-[10px] text-muted-foreground",children:n}),o&&t.jsx("div",{className:"mt-2.5 flex justify-center",children:o})]})})}function I({children:e,tone:n}){return t.jsx("div",{className:x("flex h-48 items-center justify-center text-[12px]",n==="muted"?"text-muted-foreground":"text-destructive"),children:e})}function Ie(e){return e.type==="directory"?"dir":e.size===void 0?e.kind??"file":`${e.kind??"file"} · ${Ze(e.size)}`}function Ye(e){if(e===".")return[];const n=e.split("/").filter(Boolean);return n.map((o,d)=>n.slice(0,d+1).join("/"))}function Ze(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}export{at as FilesTab};
@@ -1,4 +1,4 @@
1
- import{c as st,r as Xt,j as C,d as z}from"./index-DtTy7Ax9.js";import{Q as Re,R as ye,S as He,U as Fe,V as he,W as ae,X as Ne,Y as Kt,Z as Vt,_ as w,$ as zt,a0 as rt,a1 as pe,a2 as jt,a3 as Jt,a4 as $t}from"./DashboardShared-BGkSTKYP.js";/**
1
+ import{c as st,r as Xt,j as C,d as z}from"./index-BfhJ5QGx.js";import{Q as Re,R as ye,S as He,U as Fe,V as he,W as ae,X as Ne,Y as Kt,Z as Vt,_ as w,$ as zt,a0 as rt,a1 as pe,a2 as jt,a3 as Jt,a4 as $t}from"./DashboardShared-CnAnYJXR.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1,21 @@
1
+ import{c as z,j as e,I as le,B as f,aE as I,ay as q,r as i,bV as oe,bU as ce,aD as O,G as de,H as ue,J as me,bW as xe,y as fe,C as he}from"./index-BfhJ5QGx.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 pe=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],ve=z("maximize-2",pe);/**
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 we=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],be=z("minimize-2",we);/**
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 ge=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],je=z("play",ge);/**
17
+ * @license lucide-react v1.7.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const Ne=[["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"}]],ke=z("settings-2",Ne),F="8314",ye={getOutput:ce,createPreviewSession:oe};function Se({taskId:s,api:t=ye,allowPortPreview:a=!1,requestedEntryPath:l=null,requestedEntryRequestId:b=0}){const[o,g]=i.useState(null),[n,c]=i.useState(null),[u,m]=i.useState(null),[j,y]=i.useState(F),[h,S]=i.useState(!1),[C,N]=i.useState(!0),[E,p]=i.useState(null),[ne,R]=i.useState(!1),[B,x]=i.useState(!1),D=i.useRef(null),K=i.useCallback(async()=>{N(!0),p(null),g(null),c(null),m(null),x(!1),D.current=null;try{const r=await t.getOutput(s);g(r),N(!1)}catch(r){p(r instanceof Error?r.message:"Failed to load output"),N(!1)}},[t,s]);i.useEffect(()=>{K()},[K]);const v=i.useCallback(async r=>{p(null);try{const d=await t.createPreviewSession(s,r?.path?{path:r.path}:void 0);c(d),S(!1),x(!1),r&&m(r),O("preview.created",{result:"success",previewType:r?.kind??"file"})}catch(d){p(d instanceof Error?d.message:"Failed to create preview session"),O("preview.failed",{result:"failed",previewType:r?.kind??"file"})}},[t,s]),P=i.useCallback(async r=>{const d=r??Number.parseInt(j.trim()||F,10);if(!Number.isInteger(d)||d<1||d>65535){p("Enter a port between 1 and 65535");return}p(null);try{const _=await t.createPreviewSession(s,{port:d});c(_),m(null),y(String(d)),S(!0),x(!1),O("preview.created",{result:"success",previewType:"service-port"})}catch(_){p(_ instanceof Error?_.message:"Failed to create preview session"),O("preview.failed",{result:"failed",previewType:"service-port"})}},[t,j,s]),w=i.useMemo(()=>Y(o),[o]),A=i.useMemo(()=>ee(w,l),[w,l]);i.useEffect(()=>{if(!l||!o?.available||C||h)return;const r=`${b}:${l}`;if(D.current!==r){if(D.current=r,!A){c(null),m(null),p("File is not available for preview");return}c(null),v(A)}},[C,o?.available,A,l,b,h,v]),i.useEffect(()=>{if(h||l||!o?.available||w.length===0||n&&n.kind!=="service")return;const r=u??w[0];r&&v(r)},[u,o,w,l,h,n,v]);const k=i.useCallback(()=>{if(n?.kind==="service"&&typeof n.port=="number"){P(n.port);return}c(null);const r=u??Y(o)[0];r&&v(r)},[u,o,n,P,v]);if(i.useEffect(()=>{if(!n)return;const r=n.expiresAt-Date.now()-5e3;if(r<=0){k();return}const d=window.setTimeout(k,r);return()=>window.clearTimeout(d)},[k,n]),C)return e.jsx(T,{children:"Loading preview..."});const M=a&&h;if(E&&n&&!M)return e.jsx(T,{children:e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"text-[11px] text-destructive",children:E}),e.jsx("div",{className:"flex justify-center",children:e.jsxs(f,{variant:"outline",size:"sm",onClick:k,className:"rounded-sm",children:[e.jsx(I,{className:"h-3.5 w-3.5"}),"Retry"]})})]})});const W=!!o?.available;if(!W&&!a)return e.jsx(T,{children:"Task output is not available yet."});if(!n)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(L,{session:null,serviceModeOpen:M,allowPortPreview:a,servicePort:j,previewEntries:w,activeEntry:u,filesMenuOpen:B,onRefresh:k,onFullscreen:()=>R(!0),onServiceModeToggle:()=>{x(!1),S(r=>!r)},onServicePortChange:y,onServiceStart:()=>{P()},onFileMenuToggle:()=>x(r=>!r),onEntrySelect:r=>{x(!1),v(r)}})}),M?e.jsx(H,{serviceSession:null,error:E}):e.jsx(T,{children:E?e.jsx("span",{className:"text-[11px] text-destructive",children:E}):W?w.length>0?"Starting preview session...":"No HTML or Markdown files were found in this task output.":"Task output is not available yet."})]});const G=te(n),ie=$(n),J=se(n),Q=re(n),U=n.kind==="service"?n:null,ae=M?U:n,X=e.jsx("iframe",{src:J,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(L,{session:ae,serviceModeOpen:M,allowPortPreview:a,servicePort:j,previewEntries:w,activeEntry:u,filesMenuOpen:B,onRefresh:k,onFullscreen:()=>R(!0),onServiceModeToggle:()=>{x(!1),S(r=>!r)},onServicePortChange:y,onServiceStart:()=>{P()},onFileMenuToggle:()=>x(r=>!r),onEntrySelect:r=>{x(!1),v(r)}})}),M?e.jsx(H,{serviceSession:U,error:E,children:U?X: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:X})}),e.jsx(de,{open:ne,onOpenChange:R,children:e.jsxs(ue,{className:"flex h-[95vh] max-w-[95vw] flex-col gap-0 overflow-hidden p-0",children:[e.jsxs(me,{className:"sr-only",children:["Preview: ",G]}),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:G}),e.jsx("span",{className:"text-xs text-muted-foreground",children:V(n.expiresAt)})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(f,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:k,title:"Refresh",children:e.jsx(I,{className:"h-3.5 w-3.5"})}),e.jsx(f,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:ie,target:"_blank",rel:"noopener noreferrer",children:e.jsx(q,{className:"h-3.5 w-3.5"})})}),e.jsx(xe,{asChild:!0,children:e.jsxs(f,{variant:"outline",size:"sm",className:"h-6 rounded-sm px-2 text-[11px]",title:"Exit fullscreen",children:[e.jsx(be,{className:"h-3.5 w-3.5"}),"Exit fullscreen"]})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx("iframe",{src:J,className:"h-full w-full border-0",sandbox:Q,title:"Task Preview Fullscreen"})})]})})]})}function Y(s){const t=s?.summary?.htmlEntries??[],a=s?.summary?.markdownEntries??[];return[...t.map(l=>({...l,kind:"html"})),...a.map(l=>({...l,kind:"markdown"}))]}function ee(s,t){if(!t)return null;const a=s.find(l=>l.path===t);return a||(/\.html?$/i.test(t)?{kind:"html",path:t,label:t}:/\.mdx?$/i.test(t)?{kind:"markdown",path:t,label:t}:null)}function Ee({entries:s,activeEntry:t,open:a,onToggle:l,onEntrySelect:b}){const o=s[0];if(!o)return null;const g=t??o,n=Z(g);return e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("button",{type:"button","aria-expanded":a,"aria-haspopup":"menu","aria-label":"Preview files",onClick:l,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:g.label}),e.jsx(fe,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"})]}),a&&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(c=>{const u=Z(c),m=u===n;return e.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":m,onClick:()=>b(c),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:m?e.jsx(he,{className:"h-3.5 w-3.5"}):null}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:c.label})]},u)})})]})}function Z(s){return`${s.kind}:${s.path}`}function L({session:s,serviceModeOpen:t,allowPortPreview:a,servicePort:l,previewEntries:b=[],activeEntry:o=null,filesMenuOpen:g=!1,onRefresh:n,onFullscreen:c,onServiceModeToggle:u,onServicePortChange:m,onServiceStart:j,onFileMenuToggle:y,onEntrySelect:h}){const S=s?$(s):null,C=!t&&b.length>0&&y&&h;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:t&&m&&j?e.jsxs("form",{className:"flex min-w-0 items-center gap-1.5",onSubmit:N=>{N.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(le,{type:"text",min:1,max:65535,inputMode:"numeric",value:l??"",onChange:N=>m(N.target.value),placeholder:F,"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(f,{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(je,{className:"h-3.5 w-3.5"}),"Preview"]}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:V(s.expiresAt)})]}):e.jsxs(e.Fragment,{children:[C?e.jsx(Ee,{entries:b,activeEntry:o,open:g,onToggle:y,onEntrySelect:h}):e.jsx("span",{className:"truncate text-[12px] font-semibold text-foreground",children:s?te(s):"Preview"}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:V(s.expiresAt)})]})}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s&&e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:n,title:"Refresh",children:e.jsx(I,{className:"h-3.5 w-3.5"})}),e.jsx(f,{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(q,{className:"h-3.5 w-3.5"})})}),e.jsx(f,{variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:c,title:"Fullscreen",children:e.jsx(ve,{className:"h-3.5 w-3.5"})})]}),a&&e.jsxs(f,{type:"button",variant:t?"secondary":"ghost",size:"sm","aria-pressed":t,onClick:u,className:"h-6 shrink-0 rounded-sm px-2 text-[11px]",children:[e.jsx(ke,{className:"h-3.5 w-3.5"}),"Advanced"]})]})]})}function H({serviceSession:s,error:t,children:a}){return e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[t&&e.jsx("div",{className:"shrink-0 border-b border-destructive/20 bg-destructive/5 px-4 py-2 text-xs text-destructive",children:t}),e.jsx("div",{className:"min-h-0 flex-1 p-2",children:s&&a?e.jsx("div",{className:"h-full overflow-hidden rounded-sm border border-border/60 bg-white shadow-none",children:a}):e.jsx(T,{children:"No service preview running."})})]})}function $(s){return s.openUrl??s.previewUrl}function se(s){return s.kind==="service"?$(s):s.previewUrl}function re(s){return s.kind==="service"?void 0:"allow-scripts allow-same-origin"}function te(s){if(s.kind==="service"&&typeof s.port=="number"){const t=s.entryPath?`/${s.entryPath.replace(/^\/+/,"")}`:"";return`127.0.0.1:${s.port}${t}`}return s.entryPath}function T({children:s}){return e.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:s})}function V(s){const t=Math.max(0,Math.round((s-Date.now())/1e3));if(t<60)return`${t}s`;const a=Math.floor(t/60),l=t%60;return`${a}m ${l}s`}const Ce=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SERVICE_PREVIEW_PORT:F,PreviewHeader:L,PreviewServicePanel:H,PreviewTab:Se,getPreviewIframeSandbox:re,getPreviewIframeSrc:se,getPreviewOpenUrl:$,resolveRequestedPreviewEntry:ee},Symbol.toStringTag,{value:"Module"}));export{F as D,je as P,re as a,se as b,Ce as c,$ as g};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-DdNDe4Vy.js","assets/index-DtTy7Ax9.js","assets/index-DVIvShRC.css","assets/MarkdownPreviewFrame-DwALMk1j.js","assets/DashboardShared-BGkSTKYP.js","assets/file-Bp3lcXJZ.js","assets/PreviewTab-CLE4ZFIp.js"])))=>i.map(i=>d[i]);
2
- import{bh as S,r,j as e,L as T,R as C,bG as P,$ as M,a1 as E,ag as I,bH as O,bI as F,bJ as y,bK as _,bL as L,ab as N,bM as q}from"./index-DtTy7Ax9.js";import{E as A,F as R,z,y as D,m as G,C as B,o as w,u as U}from"./DashboardShared-BGkSTKYP.js";const V=r.lazy(async()=>({default:(await N(()=>import("./FilesTab-DdNDe4Vy.js"),__vite__mapDeps([0,1,2,3,4,5]))).FilesTab})),H=r.lazy(async()=>({default:(await N(()=>import("./PreviewTab-CLE4ZFIp.js").then(a=>a.c),__vite__mapDeps([6,1,2]))).PreviewTab})),W={getOutput:y,getOutputTree:F,getOutputContent:O},$={getOutput:y,createPreviewSession:(t,a)=>q(t,typeof a=="string"?a:a?.path)};function X(){const{shareId:t}=S(),[a,d]=r.useState(null),[c,s]=r.useState([]),[u,m]=r.useState(!0),[b,l]=r.useState(null),x=r.useRef(null);return r.useEffect(()=>{if(!t){d(null),s([]),l("Shared conversation not found"),m(!1);return}let i=!1;x.current=t,m(!0),l(null);const h=async o=>{try{const[p,f]=await Promise.all([_(t),L(t)]);if(i||x.current!==t)return;d(p),s(n=>o?f.logs:U(n,f.logs)),l(null)}catch(p){if(i||x.current!==t)return;o&&(d(null),s([]),l(p instanceof Error?p.message:"Failed to load shared conversation"))}finally{!i&&x.current===t&&o&&m(!1)}};h(!0);const g=window.setInterval(()=>{h(!1)},2500);return()=>{i=!0,window.clearInterval(g)}},[t]),e.jsx(J,{conversation:a,logs:c,loading:u,error:b})}function J({conversation:t,logs:a,loading:d,error:c}){const[s,u]=r.useState("transcript"),[m,b]=r.useState(null),[l,x]=r.useState(!1),i=r.useMemo(()=>{if(!t)return null;const n=A(t.payload.initialMessage);return n.length>0&&R(a,n)?null:n.length>0?z(n,new Date(t.createdAt).toISOString()):null},[t,a]),h=r.useMemo(()=>D([...i?[i]:[],...a]),[i,a]),g=r.useMemo(()=>G(h),[h]),o=t?.scope==="filesPreview",p=r.useCallback(n=>{o&&(b(v=>({path:n,requestId:(v?.requestId??0)+1})),u("files"))},[o]);r.useEffect(()=>{b(null)},[t?.shareId]);const f=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(T,{className:"h-4 w-4 animate-spin"}),"Loading shared conversation..."]}),!d&&c&&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:c})]}),!d&&!c&&h.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(C,{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&&!c&&g.map(({event:n,subItems:v},k)=>e.jsx(B,{event:n,agent:t?.agent,subItems:v,onOpenFilePath:p,questionResponseDisabled:!0},`shared-${k}`))]})});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(P,{status:t.status}),e.jsx(M,{priority:t.priority})]}),e.jsxs("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[e.jsxs("div",{children:["updated ",E(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:[l&&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/gim-home/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(K,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",onClick:()=>x(n=>!n),"aria-expanded":l,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(I,{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?.title??"Shared conversation"})]})]}),o&&e.jsxs("div",{className:"mt-3 inline-flex h-7 rounded-sm border border-border/55 bg-background/35 p-0.5 text-muted-foreground",children:[e.jsx("button",{type:"button",onClick:()=>u("transcript"),"aria-current":s==="transcript"?"page":void 0,className:j(s==="transcript"),children:"Transcript"}),e.jsx("button",{type:"button",onClick:()=>u("files"),"aria-current":s==="files"?"page":void 0,className:j(s==="files"),children:"Files"}),e.jsx("button",{type:"button",onClick:()=>u("preview"),"aria-current":s==="preview"?"page":void 0,className:j(s==="preview"),children:"Preview"})]})]}),o&&t?e.jsxs(e.Fragment,{children:[s==="transcript"&&f,s==="files"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(r.Suspense,{fallback:e.jsx(w,{label:"Loading files..."}),children:e.jsx(V,{taskId:t.shareId,api:W,requestedFilePath:m?.path??null,requestedFileRequestId:m?.requestId??0})})}),s==="preview"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(r.Suspense,{fallback:e.jsx(w,{label:"Loading preview..."}),children:e.jsx(H,{taskId:t.shareId,api:$,allowPortPreview:!1})})})]}):f]})]})]})}function j(t){return t?"inline-flex h-full items-center justify-center whitespace-nowrap rounded-sm border border-primary/30 bg-primary/10 px-2.5 text-[11px] font-medium text-primary shadow-none":"inline-flex h-full items-center justify-center whitespace-nowrap rounded-sm border border-transparent px-2.5 text-[11px] font-medium transition-colors hover:bg-muted/35 hover:text-foreground"}function K({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{X as SharedConversationPage,J as SharedConversationView};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-uM8qGxbi.js","assets/index-BfhJ5QGx.js","assets/index-Bol9w8Lt.css","assets/MarkdownPreviewFrame-BueJ6Pjk.js","assets/DashboardShared-CnAnYJXR.js","assets/file-Du0lhUCi.js","assets/PreviewTab-K7c436fs.js"])))=>i.map(i=>d[i]);
2
+ import{bh as S,r,j as e,L as T,R as C,bG as P,$ as M,a1 as E,ag as I,bH as O,bI as F,bJ as y,bK as _,bL as L,ab as N,bM as q}from"./index-BfhJ5QGx.js";import{E as A,F as R,z,y as D,m as G,C as B,o as w,u as U}from"./DashboardShared-CnAnYJXR.js";const V=r.lazy(async()=>({default:(await N(()=>import("./FilesTab-uM8qGxbi.js"),__vite__mapDeps([0,1,2,3,4,5]))).FilesTab})),H=r.lazy(async()=>({default:(await N(()=>import("./PreviewTab-K7c436fs.js").then(a=>a.c),__vite__mapDeps([6,1,2]))).PreviewTab})),W={getOutput:y,getOutputTree:F,getOutputContent:O},$={getOutput:y,createPreviewSession:(t,a)=>q(t,typeof a=="string"?a:a?.path)};function X(){const{shareId:t}=S(),[a,d]=r.useState(null),[c,s]=r.useState([]),[u,m]=r.useState(!0),[b,l]=r.useState(null),x=r.useRef(null);return r.useEffect(()=>{if(!t){d(null),s([]),l("Shared conversation not found"),m(!1);return}let i=!1;x.current=t,m(!0),l(null);const h=async o=>{try{const[p,f]=await Promise.all([_(t),L(t)]);if(i||x.current!==t)return;d(p),s(n=>o?f.logs:U(n,f.logs)),l(null)}catch(p){if(i||x.current!==t)return;o&&(d(null),s([]),l(p instanceof Error?p.message:"Failed to load shared conversation"))}finally{!i&&x.current===t&&o&&m(!1)}};h(!0);const g=window.setInterval(()=>{h(!1)},2500);return()=>{i=!0,window.clearInterval(g)}},[t]),e.jsx(J,{conversation:a,logs:c,loading:u,error:b})}function J({conversation:t,logs:a,loading:d,error:c}){const[s,u]=r.useState("transcript"),[m,b]=r.useState(null),[l,x]=r.useState(!1),i=r.useMemo(()=>{if(!t)return null;const n=A(t.payload.initialMessage);return n.length>0&&R(a,n)?null:n.length>0?z(n,new Date(t.createdAt).toISOString()):null},[t,a]),h=r.useMemo(()=>D([...i?[i]:[],...a]),[i,a]),g=r.useMemo(()=>G(h),[h]),o=t?.scope==="filesPreview",p=r.useCallback(n=>{o&&(b(v=>({path:n,requestId:(v?.requestId??0)+1})),u("files"))},[o]);r.useEffect(()=>{b(null)},[t?.shareId]);const f=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(T,{className:"h-4 w-4 animate-spin"}),"Loading shared conversation..."]}),!d&&c&&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:c})]}),!d&&!c&&h.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(C,{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&&!c&&g.map(({event:n,subItems:v},k)=>e.jsx(B,{event:n,agent:t?.agent,subItems:v,onOpenFilePath:p,questionResponseDisabled:!0},`shared-${k}`))]})});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(P,{status:t.status}),e.jsx(M,{priority:t.priority})]}),e.jsxs("div",{className:"space-y-1 text-[11px] text-muted-foreground",children:[e.jsxs("div",{children:["updated ",E(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:[l&&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/gim-home/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(K,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",onClick:()=>x(n=>!n),"aria-expanded":l,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(I,{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?.title??"Shared conversation"})]})]}),o&&e.jsxs("div",{className:"mt-3 inline-flex h-7 rounded-sm border border-border/55 bg-background/35 p-0.5 text-muted-foreground",children:[e.jsx("button",{type:"button",onClick:()=>u("transcript"),"aria-current":s==="transcript"?"page":void 0,className:j(s==="transcript"),children:"Transcript"}),e.jsx("button",{type:"button",onClick:()=>u("files"),"aria-current":s==="files"?"page":void 0,className:j(s==="files"),children:"Files"}),e.jsx("button",{type:"button",onClick:()=>u("preview"),"aria-current":s==="preview"?"page":void 0,className:j(s==="preview"),children:"Preview"})]})]}),o&&t?e.jsxs(e.Fragment,{children:[s==="transcript"&&f,s==="files"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(r.Suspense,{fallback:e.jsx(w,{label:"Loading files..."}),children:e.jsx(V,{taskId:t.shareId,api:W,requestedFilePath:m?.path??null,requestedFileRequestId:m?.requestId??0})})}),s==="preview"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(r.Suspense,{fallback:e.jsx(w,{label:"Loading preview..."}),children:e.jsx(H,{taskId:t.shareId,api:$,allowPortPreview:!1})})})]}):f]})]})]})}function j(t){return t?"inline-flex h-full items-center justify-center whitespace-nowrap rounded-sm border border-primary/30 bg-primary/10 px-2.5 text-[11px] font-medium text-primary shadow-none":"inline-flex h-full items-center justify-center whitespace-nowrap rounded-sm border border-transparent px-2.5 text-[11px] font-medium transition-colors hover:bg-muted/35 hover:text-foreground"}function K({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{X as SharedConversationPage,J as SharedConversationView};
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-DtTy7Ax9.js";/**
1
+ import{c as a}from"./index-BfhJ5QGx.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.