meshy-node 0.4.3 → 0.4.5

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 h,r as g,j as n,i as P,C as T,b as E,X as oe,y as ie,I as Q,b1 as ae,z as ce,B as le}from"./index-Cba_59ol.js";/**
1
+ import{c as h,r as g,j as n,i as P,C as T,b as E,X as oe,y as ie,I as Q,b1 as ae,z as ce,B as le}from"./index-BgSOSh2K.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{r as l,b8 as P,b3 as O,j as e,B as g,b as N,z as $,o as T}from"./index-Cba_59ol.js";import{G as R}from"./DashboardPage-mQpgVZSz.js";import{F as _}from"./file-BTuUAaOs.js";import{F as B}from"./folder-BbOC2arM.js";import"./DashboardShared-CJtOr7QZ.js";import"./input-DXbjJpeh.js";function D(r,t){if(!(r!=null&&r.trim()))return[];const s=r.split(`
1
+ import{r as l,b9 as P,b3 as O,j as e,B as g,b as N,z as $,o as T}from"./index-BgSOSh2K.js";import{G as R}from"./DashboardPage-ByMFp2Hx.js";import{F as _}from"./file-BBYxpzot.js";import{F as B}from"./folder-BCnKXNII.js";import"./DashboardShared-BdpxWcCV.js";import"./input-BcMrrsRJ.js";function D(r,t){if(!(r!=null&&r.trim()))return[];const s=r.split(`
2
2
  `),n=[];let a=[];const d=()=>{if(a.length===0)return;const c=a.join(`
3
3
  `).trim();if(!c){a=[];return}const i=A(a);if(!i){a=[];return}n.push({id:`${t}:${i}`,path:i,section:t,patch:c}),a=[]};for(const c of s)c.startsWith("diff --git ")&&a.length>0&&d(),a.push(c);return d(),n}function I(r){const t=[];for(const s of[...r].sort((n,a)=>n.path.localeCompare(a.path))){const n=s.path.split("/").filter(Boolean);let a=t,d="";n.forEach((c,i)=>{d=d?`${d}/${c}`:c;const h=i===n.length-1;let u=a.find(b=>b.name===c);u||(u=h?{type:"file",name:c,path:d,item:s}:{type:"folder",name:c,path:d,children:[]},a.push(u)),h||(u.children??(u.children=[]),a=u.children)})}return t}function G(r){const t=[];let s="";for(const n of r.split("/").filter(Boolean).slice(0,-1))s=s?`${s}/${n}`:n,t.push(s);return t}function z(r){return r.filter(t=>t&&!t.endsWith("/")).map(t=>({id:`untracked:${t}`,path:t,section:"untracked"}))}function A(r){var d,c;const t=(d=r.find(i=>i.startsWith("+++ ")))==null?void 0:d.slice(4).trim();if(t&&t!=="/dev/null")return w(t);const s=(c=r.find(i=>i.startsWith("--- ")))==null?void 0:c.slice(4).trim();if(s&&s!=="/dev/null")return w(s);const n=r.find(i=>i.startsWith("diff --git "));if(!n)return null;const a=n.match(/^diff --git a\/(.+?) b\/(.+)$/);return a?w(a[2]||a[1]||""):null}function w(r){return r.replace(/^[ab]\//,"")}const y={staged:"Staged",unstaged:"Unstaged",untracked:"Untracked"};function se({taskId:r}){const[t,s]=l.useState(null),[n,a]=l.useState(!0),[d,c]=l.useState(null),[i,h]=l.useState(null),[u,b]=l.useState(null),[L,v]=l.useState(!1),[M,k]=l.useState(null),S=l.useCallback(async()=>{a(!0),c(null),s(null);try{const o=await P(r);s(o)}catch(o){c(o instanceof Error?o.message:"Failed to load diff")}finally{a(!1)}},[r]);l.useEffect(()=>{S()},[S]);const F=l.useMemo(()=>D(t==null?void 0:t.staged,"staged"),[t==null?void 0:t.staged]),E=l.useMemo(()=>D(t==null?void 0:t.unstaged,"unstaged"),[t==null?void 0:t.unstaged]),C=l.useMemo(()=>z((t==null?void 0:t.untrackedFiles)??[]),[t==null?void 0:t.untrackedFiles]),j=l.useMemo(()=>[{section:"staged",items:F},{section:"unstaged",items:E},{section:"untracked",items:C}],[F,E,C]),p=l.useMemo(()=>j.flatMap(o=>o.items),[j]),f=l.useMemo(()=>p.find(o=>o.id===i)??p[0]??null,[p,i]);return l.useEffect(()=>{var o;(!i||!p.some(m=>m.id===i))&&h(((o=p[0])==null?void 0:o.id)??null)},[p,i]),l.useEffect(()=>{if(b(null),k(null),v(!1),!f||f.section!=="untracked")return;if(f.path.endsWith("/")){k("This untracked path is a directory. Open the Files tab to inspect its contents.");return}let o=!1;return v(!0),O(r,f.path).then(m=>{o||b(m)}).catch(m=>{o||k(m instanceof Error?m.message:"Failed to load file content")}).finally(()=>{o||v(!1)}),()=>{o=!0}},[f,r]),n?e.jsx(x,{tone:"muted",children:"Loading diff..."}):d?e.jsx(x,{tone:"destructive",children:d}):t!=null&&t.available?p.length>0?e.jsxs("div",{className:"grid h-full min-h-0 grid-cols-1 lg:grid-cols-[18rem_minmax(0,1fr)]",children:[e.jsxs("aside",{className:"flex min-h-0 flex-col border-b border-border/60 bg-background/30 lg:border-b-0 lg:border-r",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-3 py-2.5",children:[e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.24em] text-muted-foreground",children:"Repository diff"}),e.jsx("div",{className:"mt-1.5 flex items-start justify-between gap-2",children:e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-[12px] font-semibold text-foreground",children:[e.jsx(R,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"truncate",children:t.branch??"detached HEAD"})]}),t.repoRoot&&e.jsx("div",{className:"mt-0.5 truncate font-mono text-[10px] text-muted-foreground",children:t.repoRoot})]})}),e.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:j.map(o=>e.jsxs(g,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 text-[10px]",children:[y[o.section]," ",o.items.length]},o.section))})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-1.5",children:e.jsx("div",{className:"space-y-1.5",children:j.map(({section:o,items:m})=>e.jsx(J,{section:o,items:m,selectedId:(f==null?void 0:f.id)??null,onSelect:h},o))})})]}),e.jsx("section",{className:"min-h-0 flex flex-col bg-card/10",children:f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-3 py-2.5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx(g,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 text-[10px]",children:y[f.section]}),f.section==="untracked"?e.jsx(g,{variant:"secondary",className:"rounded-full text-[10px]",children:"File content"}):e.jsx(g,{variant:"secondary",className:"rounded-full text-[10px]",children:"Diff patch"})]}),e.jsx("div",{className:"mt-1.5 break-all font-mono text-[10px] text-muted-foreground",children:f.path})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-2.5",children:f.section==="untracked"?e.jsx(q,{loading:L,error:M,content:u}):e.jsx(H,{patch:f.patch??""})})]}):e.jsx(x,{tone:"muted",children:"Select a file to inspect."})})]}):e.jsx(x,{tone:"muted",children:"Working tree is clean."}):e.jsx(x,{tone:"muted",children:"Task working directory is not inside a Git repository."})}function J({section:r,items:t,selectedId:s,onSelect:n}){const a=l.useMemo(()=>I(t),[t]),d=l.useMemo(()=>t.find(u=>u.id===s)??null,[t,s]),c=l.useMemo(()=>new Set(d?G(d.path):[]),[d]),[i,h]=l.useState(!0);return e.jsxs("section",{className:"rounded-[16px] border border-border/60 bg-background/35",children:[e.jsxs("button",{type:"button",onClick:()=>h(u=>!u),"aria-expanded":i,className:N("flex w-full items-center justify-between gap-2 px-2.5 py-1.5 text-left transition-colors hover:bg-background/55",i?"border-b border-border/60":""),children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[i?e.jsx($,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):e.jsx(T,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"text-[12px] font-medium text-foreground",children:y[r]})]}),e.jsx(g,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 text-[10px]",children:t.length})]}),i&&e.jsx("div",{className:"p-1.5",children:a.length>0?e.jsx("div",{className:"space-y-0.5",children:a.map(u=>e.jsx(U,{node:u,depth:0,selectedId:s,expandedAncestorPaths:c,onSelect:n},`${r}:${u.path}`))}):e.jsx("div",{className:"rounded-[12px] border border-dashed border-border/70 bg-background/30 px-2.5 py-1.5 text-[11px] text-muted-foreground",children:"No files."})})]})}function U({node:r,depth:t,selectedId:s,expandedAncestorPaths:n,onSelect:a}){var d;return r.type==="folder"?e.jsx(V,{node:r,depth:t,selectedId:s,expandedAncestorPaths:n,onSelect:a}):e.jsxs("button",{type:"button",onClick:()=>{r.item&&a(r.item.id)},className:N("flex w-full cursor-pointer items-center gap-1.5 rounded-[10px] px-1.5 py-1 text-left transition-colors",((d=r.item)==null?void 0:d.id)===s?"bg-primary/10 text-foreground":"text-foreground/90 hover:bg-background/55"),style:{paddingLeft:`${t*12+6}px`},children:[e.jsx(_,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate text-[12px]",children:r.name})]})}function V({node:r,depth:t,selectedId:s,expandedAncestorPaths:n,onSelect:a}){const[d,c]=l.useState(!0);return l.useEffect(()=>{n.has(r.path)&&c(!0)},[n,r.path]),e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>c(i=>!i),"aria-expanded":d,className:"flex w-full cursor-pointer select-none items-center gap-1.5 rounded-[10px] px-1.5 py-1 text-left text-[12px] text-muted-foreground transition-colors hover:bg-background/55 hover:text-foreground",style:{paddingLeft:`${t*12+6}px`},children:[d?e.jsx($,{className:"h-3.5 w-3.5 shrink-0"}):e.jsx(T,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx(B,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"truncate",children:r.name})]}),d&&e.jsx("div",{className:"space-y-0.5",children:(r.children??[]).map(i=>e.jsx(U,{node:i,depth:t+1,selectedId:s,expandedAncestorPaths:n,onSelect:a},i.path))})]})}function H({patch:r}){const t=r.split(`
4
4
  `);return e.jsxs("div",{className:"rounded-[20px] border border-border/60 bg-background/55",children:[e.jsxs("div",{className:"border-b border-border/60 px-3 py-2",children:[e.jsx("div",{className:"text-[12px] font-medium text-foreground",children:"File diff"}),e.jsxs("div",{className:"mt-0.5 text-[10px] text-muted-foreground",children:[t.length," lines"]})]}),e.jsx("div",{className:"font-mono text-[11px] leading-5",children:t.map((s,n)=>e.jsxs("div",{className:N("grid grid-cols-[44px_minmax(0,1fr)] gap-3 px-3 py-0.5",K(s)),children:[e.jsx("span",{className:"select-none text-right text-muted-foreground/55",children:n+1}),e.jsx("span",{className:"whitespace-pre-wrap break-all text-foreground",children:s||" "})]},`${n}-${s}`))})]})}function q({loading:r,error:t,content:s}){if(r)return e.jsx(x,{tone:"muted",children:"Loading file content..."});if(t)return e.jsx(x,{tone:"destructive",children:t});if(!s)return e.jsx(x,{tone:"muted",children:"Select an untracked file to preview its content."});if(s.kind==="image"){const n=s.content?`data:${s.mimeType};base64,${s.content}`:s.downloadUrl;return n?e.jsx("div",{className:"flex min-h-[20rem] items-center justify-center rounded-[28px] border border-border/60 bg-background/55 p-4",children:e.jsx("img",{src:n,alt:s.path,className:"max-h-full max-w-full rounded-[20px] object-contain shadow-[0_24px_90px_-52px_rgba(0,0,0,0.65)]"})}):e.jsx(x,{tone:"muted",children:"Image preview is not available."})}if(s.kind==="pdf"&&s.downloadUrl)return e.jsx("div",{className:"h-full min-h-[24rem] overflow-hidden rounded-[28px] border border-border/60 bg-background/55",children:e.jsx("iframe",{src:s.downloadUrl,title:s.path,className:"h-full w-full border-0"})});if(s.kind==="json"){let n=s.content;try{n=JSON.stringify(JSON.parse(s.content),null,2)}catch{}return e.jsx(W,{content:n,truncated:s.truncated})}return s.kind==="markdown"||s.kind==="text"||s.kind==="html"?e.jsx(W,{content:s.content,truncated:s.truncated}):e.jsx(x,{tone:"muted",children:"This file cannot be previewed inline."})}function W({content:r,truncated:t}){return e.jsxs("div",{className:"rounded-[20px] border border-border/60 bg-background/55",children:[e.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap px-3 py-3 font-mono text-[11px] leading-5 text-foreground",children:r}),t&&e.jsx("div",{className:"border-t border-border/60 px-3 py-2 text-[11px] text-muted-foreground",children:"Content truncated. Open the Files tab to inspect the full artifact."})]})}function x({children:r,tone:t}){return e.jsx("div",{className:N("flex h-full min-h-[12rem] items-center justify-center rounded-[20px] text-[12px]",t==="muted"?"text-muted-foreground":"text-destructive"),children:r})}function K(r){return r.startsWith("@@")?"bg-sky-500/10":r.startsWith("+")&&!r.startsWith("+++")?"bg-emerald-500/10":r.startsWith("-")&&!r.startsWith("---")?"bg-destructive/10":r.startsWith("diff ")||r.startsWith("index ")||r.startsWith("---")||r.startsWith("+++")?"bg-muted/45":""}export{se as DiffTab};
@@ -1,4 +1,4 @@
1
- import{c as Ze,b2 as Dt,j as y,r as re,b3 as Ar,b4 as Pr,b5 as zr,B as rn,i as Me,o as jr,b as Te}from"./index-Cba_59ol.js";import{F as Lr}from"./folder-BbOC2arM.js";import{F as Fr}from"./file-BTuUAaOs.js";/**
1
+ import{c as Ze,b2 as Dt,j as y,r as re,b3 as Ar,b4 as Pr,b5 as zr,B as rn,i as Me,o as jr,b as Te}from"./index-BgSOSh2K.js";import{F as Lr}from"./folder-BCnKXNII.js";import{F as Fr}from"./file-BBYxpzot.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,21 +1,16 @@
1
- import{c as M,j as e,i as u,ad as B,r as a,b6 as W,b5 as X,H as Y,D as Z,g as ee,b7 as se,B as D}from"./index-Cba_59ol.js";import{I as re,P as te}from"./input-DXbjJpeh.js";/**
1
+ import{c as z,j as e,i as u,b6 as T,ad as B,r as a,b7 as W,b5 as X,H as Y,D as Z,g as ee,b8 as se,B as U}from"./index-BgSOSh2K.js";import{I as re,P as te}from"./input-BcMrrsRJ.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const ne=[["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"}]],ie=M("maximize-2",ne);/**
6
+ */const ne=[["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"}]],ie=z("maximize-2",ne);/**
7
7
  * @license lucide-react v1.7.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const ae=[["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"}]],le=M("minimize-2",ae);/**
11
+ */const ae=[["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"}]],le=z("minimize-2",ae);/**
12
12
  * @license lucide-react v1.7.0 - ISC
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const ce=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],O=M("refresh-cw",ce);/**
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 oe=[["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"}]],de=M("settings-2",oe),ue={getOutput:X,createPreviewSession:W};function fe({taskId:s,api:n=ue,allowPortPreview:l=!0}){const[i,c]=a.useState(null),[r,v]=a.useState(null),[d,p]=a.useState(null),[b,h]=a.useState(""),[P,k]=a.useState(!1),[V,C]=a.useState(!0),[j,m]=a.useState(null),[G,E]=a.useState(!1),$=a.useCallback(async()=>{C(!0),m(null),c(null),v(null),p(null);try{const t=await n.getOutput(s);c(t),C(!1)}catch(t){m(t instanceof Error?t.message:"Failed to load output"),C(!1)}},[n,s]);a.useEffect(()=>{$()},[$]);const w=a.useCallback(async t=>{m(null);try{const o=await n.createPreviewSession(s,t!=null&&t.path?{path:t.path}:void 0);v(o),k(!1),t&&p(t)}catch(o){m(o instanceof Error?o.message:"Failed to create preview session")}},[n,s]),y=a.useCallback(async t=>{const o=t??Number.parseInt(b,10);if(!Number.isInteger(o)||o<1||o>65535){m("Enter a port between 1 and 65535");return}m(null);try{const S=await n.createPreviewSession(s,{port:o});v(S),p(null),h(String(o)),k(!0)}catch(S){m(S instanceof Error?S.message:"Failed to create preview session")}},[n,b,s]),g=a.useMemo(()=>R(i),[i]);a.useEffect(()=>{if(P||!(i!=null&&i.available)||g.length===0||r&&r.kind!=="service")return;const t=d??g[0];t&&w(t)},[d,i,g,P,r,w]);const f=a.useCallback(()=>{if((r==null?void 0:r.kind)==="service"&&typeof r.port=="number"){y(r.port);return}v(null);const t=d??R(i)[0];t&&w(t)},[d,i,r,y,w]);if(a.useEffect(()=>{if(!r)return;const t=r.expiresAt-Date.now()-5e3;if(t<=0){f();return}const o=window.setTimeout(f,t);return()=>window.clearTimeout(o)},[f,r]),V)return e.jsx(N,{children:"Loading preview..."});const x=l&&P;if(j&&r&&!x)return e.jsx(N,{children:e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"text-sm text-destructive",children:j}),e.jsx("div",{className:"flex justify-center",children:e.jsxs(u,{variant:"outline",size:"sm",onClick:f,className:"rounded-full",children:[e.jsx(O,{className:"h-3.5 w-3.5"}),"Retry"]})})]})});const F=!!(i!=null&&i.available);if(!F&&!l)return e.jsx(N,{children:"Task output is not available yet."});if(!r)return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-2.5",children:[e.jsx(H,{session:null,serviceModeOpen:x,allowPortPreview:l,servicePort:b,onRefresh:f,onFullscreen:()=>E(!0),onServiceModeToggle:()=>k(t=>!t),onServicePortChange:h,onServiceStart:()=>void y()}),!x&&e.jsx(U,{entries:g,activeEntry:d,onEntrySelect:t=>void w(t)})]}),x?e.jsx(I,{serviceSession:null,error:j}):e.jsx(N,{children:j?e.jsx("span",{className:"text-sm text-destructive",children:j}):F?g.length>0?"Starting preview session...":"No HTML or Markdown files were found in this task output.":"Task output is not available yet."})]});const _=K(r),J=q(r),L=xe(r),T=r.kind==="service"?r:null,Q=x?T:r,A=e.jsx("iframe",{src:r.previewUrl,className:"h-full w-full border-0",sandbox:L,title:"Task Preview"});return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-2.5",children:[e.jsx(H,{session:Q,serviceModeOpen:x,allowPortPreview:l,servicePort:b,onRefresh:f,onFullscreen:()=>E(!0),onServiceModeToggle:()=>k(t=>!t),onServicePortChange:h,onServiceStart:()=>void y()}),!x&&e.jsx(U,{entries:g,activeEntry:d,previewKind:r.kind,onEntrySelect:t=>void w(t)})]}),x?e.jsx(I,{serviceSession:T,error:j,children:T?A:null}):e.jsx("div",{className:"min-h-0 flex-1 p-2",children:e.jsx("div",{className:"h-full overflow-hidden rounded-2xl border border-border/60 bg-white shadow-sm",children:A})}),e.jsx(Y,{open:G,onOpenChange:E,children:e.jsxs(Z,{className:"flex h-[95vh] max-w-[95vw] flex-col gap-0 overflow-hidden p-0",children:[e.jsxs(ee,{className:"sr-only",children:["Preview: ",_]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:_}),e.jsx("span",{className:"text-xs text-muted-foreground",children:z(r.expiresAt)})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:f,title:"Refresh",children:e.jsx(O,{className:"h-3.5 w-3.5"})}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:J,target:"_blank",rel:"noopener noreferrer",children:e.jsx(B,{className:"h-3.5 w-3.5"})})}),e.jsx(se,{asChild:!0,children:e.jsxs(u,{variant:"outline",size:"sm",className:"rounded-full",title:"Exit fullscreen",children:[e.jsx(le,{className:"h-3.5 w-3.5"}),"Exit fullscreen"]})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx("iframe",{src:r.previewUrl,className:"h-full w-full border-0",sandbox:L,title:"Task Preview Fullscreen"})})]})})]})}function R(s){var i,c;const n=((i=s==null?void 0:s.summary)==null?void 0:i.htmlEntries)??[],l=((c=s==null?void 0:s.summary)==null?void 0:c.markdownEntries)??[];return[...n.map(r=>({...r,kind:"html"})),...l.map(r=>({...r,kind:"markdown"}))]}function U({entries:s,activeEntry:n,previewKind:l,onEntrySelect:i}){return e.jsx("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-2",children:e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.map(c=>{const r=(n==null?void 0:n.path)===c.path;return e.jsx("button",{type:"button",onClick:()=>i(c),className:r?"rounded-full border border-primary/40 bg-primary/10 px-3 py-1 text-xs font-medium text-primary":"rounded-full border border-border/70 bg-background/55 px-3 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:c.label},`${c.kind}:${c.path}`)}),e.jsxs(D,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:[s.length," ",s.length===1?"file":"files"]}),e.jsx(D,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:l==="service"?"Service proxy":"Sandboxed iframe"})]})})}function H({session:s,serviceModeOpen:n,allowPortPreview:l,servicePort:i,onRefresh:c,onFullscreen:r,onServiceModeToggle:v,onServicePortChange:d,onServiceStart:p}){const b=s?q(s):null;return e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-3",children:n&&d&&p?e.jsxs("form",{className:"flex min-w-0 items-center gap-2",onSubmit:h=>{h.preventDefault(),p()},children:[e.jsx("span",{className:"shrink-0 text-sm font-semibold text-foreground",children:"Preview service"}),e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:["Port",e.jsx(re,{type:"number",min:1,max:65535,inputMode:"numeric",value:i??"",onChange:h=>d(h.target.value),placeholder:"12345","aria-label":"Service preview port",className:"h-7 w-24 rounded-full px-3 text-xs"})]}),e.jsxs(u,{type:"submit",variant:"outline",size:"sm",className:"h-7 rounded-full px-2.5 text-xs",children:[e.jsx(te,{className:"h-3.5 w-3.5"}),"Run"]}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:z(s.expiresAt)})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"truncate text-sm font-semibold text-foreground",children:s?K(s):"Preview"}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:z(s.expiresAt)})]})}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[s&&e.jsxs(e.Fragment,{children:[e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:c,title:"Refresh",children:e.jsx(O,{className:"h-3.5 w-3.5"})}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:b??s.previewUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(B,{className:"h-3.5 w-3.5"})})}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:r,title:"Fullscreen",children:e.jsx(ie,{className:"h-3.5 w-3.5"})})]}),l&&e.jsxs(u,{type:"button",variant:n?"secondary":"ghost",size:"sm","aria-pressed":n,onClick:v,className:"h-7 shrink-0 rounded-full px-2.5 text-xs",children:[e.jsx(de,{className:"h-3.5 w-3.5"}),"Advanced"]})]})]})}function I({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-2xl border border-border/60 bg-white shadow-sm",children:l}):e.jsx(N,{children:"No service preview running."})})]})}function q(s){return s.openUrl??s.previewUrl}function xe(s){return s.kind==="service"?void 0:"allow-scripts allow-same-origin"}function K(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 N({children:s}){return e.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:s})}function z(s){const n=Math.max(0,Math.round((s-Date.now())/1e3));if(n<60)return`${n}s`;const l=Math.floor(n/60),i=n%60;return`${l}m ${i}s`}export{H as PreviewHeader,I as PreviewServicePanel,fe as PreviewTab,U as PreviewToolbar,xe as getPreviewIframeSandbox,q as getPreviewOpenUrl};
16
+ */const ce=[["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"}]],oe=z("settings-2",ce),de={getOutput:X,createPreviewSession:W};function he({taskId:s,api:n=de,allowPortPreview:l=!0}){const[i,c]=a.useState(null),[r,v]=a.useState(null),[d,p]=a.useState(null),[b,m]=a.useState(""),[P,k]=a.useState(!1),[V,C]=a.useState(!0),[j,h]=a.useState(null),[G,E]=a.useState(!1),F=a.useCallback(async()=>{C(!0),h(null),c(null),v(null),p(null);try{const t=await n.getOutput(s);c(t),C(!1)}catch(t){h(t instanceof Error?t.message:"Failed to load output"),C(!1)}},[n,s]);a.useEffect(()=>{F()},[F]);const w=a.useCallback(async t=>{h(null);try{const o=await n.createPreviewSession(s,t!=null&&t.path?{path:t.path}:void 0);v(o),k(!1),t&&p(t)}catch(o){h(o instanceof Error?o.message:"Failed to create preview session")}},[n,s]),y=a.useCallback(async t=>{const o=t??Number.parseInt(b,10);if(!Number.isInteger(o)||o<1||o>65535){h("Enter a port between 1 and 65535");return}h(null);try{const S=await n.createPreviewSession(s,{port:o});v(S),p(null),m(String(o)),k(!0)}catch(S){h(S instanceof Error?S.message:"Failed to create preview session")}},[n,b,s]),g=a.useMemo(()=>_(i),[i]);a.useEffect(()=>{if(P||!(i!=null&&i.available)||g.length===0||r&&r.kind!=="service")return;const t=d??g[0];t&&w(t)},[d,i,g,P,r,w]);const f=a.useCallback(()=>{if((r==null?void 0:r.kind)==="service"&&typeof r.port=="number"){y(r.port);return}v(null);const t=d??_(i)[0];t&&w(t)},[d,i,r,y,w]);if(a.useEffect(()=>{if(!r)return;const t=r.expiresAt-Date.now()-5e3;if(t<=0){f();return}const o=window.setTimeout(f,t);return()=>window.clearTimeout(o)},[f,r]),V)return e.jsx(N,{children:"Loading preview..."});const x=l&&P;if(j&&r&&!x)return e.jsx(N,{children:e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"text-sm text-destructive",children:j}),e.jsx("div",{className:"flex justify-center",children:e.jsxs(u,{variant:"outline",size:"sm",onClick:f,className:"rounded-full",children:[e.jsx(T,{className:"h-3.5 w-3.5"}),"Retry"]})})]})});const $=!!(i!=null&&i.available);if(!$&&!l)return e.jsx(N,{children:"Task output is not available yet."});if(!r)return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-2.5",children:[e.jsx(H,{session:null,serviceModeOpen:x,allowPortPreview:l,servicePort:b,onRefresh:f,onFullscreen:()=>E(!0),onServiceModeToggle:()=>k(t=>!t),onServicePortChange:m,onServiceStart:()=>void y()}),!x&&e.jsx(L,{entries:g,activeEntry:d,onEntrySelect:t=>void w(t)})]}),x?e.jsx(I,{serviceSession:null,error:j}):e.jsx(N,{children:j?e.jsx("span",{className:"text-sm text-destructive",children:j}):$?g.length>0?"Starting preview session...":"No HTML or Markdown files were found in this task output.":"Task output is not available yet."})]});const A=K(r),J=q(r),D=ue(r),M=r.kind==="service"?r:null,Q=x?M:r,R=e.jsx("iframe",{src:r.previewUrl,className:"h-full w-full border-0",sandbox:D,title:"Task Preview"});return e.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-2.5",children:[e.jsx(H,{session:Q,serviceModeOpen:x,allowPortPreview:l,servicePort:b,onRefresh:f,onFullscreen:()=>E(!0),onServiceModeToggle:()=>k(t=>!t),onServicePortChange:m,onServiceStart:()=>void y()}),!x&&e.jsx(L,{entries:g,activeEntry:d,previewKind:r.kind,onEntrySelect:t=>void w(t)})]}),x?e.jsx(I,{serviceSession:M,error:j,children:M?R:null}):e.jsx("div",{className:"min-h-0 flex-1 p-2",children:e.jsx("div",{className:"h-full overflow-hidden rounded-2xl border border-border/60 bg-white shadow-sm",children:R})}),e.jsx(Y,{open:G,onOpenChange:E,children:e.jsxs(Z,{className:"flex h-[95vh] max-w-[95vw] flex-col gap-0 overflow-hidden p-0",children:[e.jsxs(ee,{className:"sr-only",children:["Preview: ",A]}),e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:A}),e.jsx("span",{className:"text-xs text-muted-foreground",children:O(r.expiresAt)})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:f,title:"Refresh",children:e.jsx(T,{className:"h-3.5 w-3.5"})}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:J,target:"_blank",rel:"noopener noreferrer",children:e.jsx(B,{className:"h-3.5 w-3.5"})})}),e.jsx(se,{asChild:!0,children:e.jsxs(u,{variant:"outline",size:"sm",className:"rounded-full",title:"Exit fullscreen",children:[e.jsx(le,{className:"h-3.5 w-3.5"}),"Exit fullscreen"]})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx("iframe",{src:r.previewUrl,className:"h-full w-full border-0",sandbox:D,title:"Task Preview Fullscreen"})})]})})]})}function _(s){var i,c;const n=((i=s==null?void 0:s.summary)==null?void 0:i.htmlEntries)??[],l=((c=s==null?void 0:s.summary)==null?void 0:c.markdownEntries)??[];return[...n.map(r=>({...r,kind:"html"})),...l.map(r=>({...r,kind:"markdown"}))]}function L({entries:s,activeEntry:n,previewKind:l,onEntrySelect:i}){return e.jsx("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-2",children:e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.map(c=>{const r=(n==null?void 0:n.path)===c.path;return e.jsx("button",{type:"button",onClick:()=>i(c),className:r?"rounded-full border border-primary/40 bg-primary/10 px-3 py-1 text-xs font-medium text-primary":"rounded-full border border-border/70 bg-background/55 px-3 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:c.label},`${c.kind}:${c.path}`)}),e.jsxs(U,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:[s.length," ",s.length===1?"file":"files"]}),e.jsx(U,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:l==="service"?"Service proxy":"Sandboxed iframe"})]})})}function H({session:s,serviceModeOpen:n,allowPortPreview:l,servicePort:i,onRefresh:c,onFullscreen:r,onServiceModeToggle:v,onServicePortChange:d,onServiceStart:p}){const b=s?q(s):null;return e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-3",children:n&&d&&p?e.jsxs("form",{className:"flex min-w-0 items-center gap-2",onSubmit:m=>{m.preventDefault(),p()},children:[e.jsx("span",{className:"shrink-0 text-sm font-semibold text-foreground",children:"Preview service"}),e.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:["Port",e.jsx(re,{type:"number",min:1,max:65535,inputMode:"numeric",value:i??"",onChange:m=>d(m.target.value),placeholder:"12345","aria-label":"Service preview port",className:"h-7 w-24 rounded-full px-3 text-xs"})]}),e.jsxs(u,{type:"submit",variant:"outline",size:"sm",className:"h-7 rounded-full px-2.5 text-xs",children:[e.jsx(te,{className:"h-3.5 w-3.5"}),"Run"]}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:O(s.expiresAt)})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"truncate text-sm font-semibold text-foreground",children:s?K(s):"Preview"}),s&&e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:O(s.expiresAt)})]})}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[s&&e.jsxs(e.Fragment,{children:[e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:c,title:"Refresh",children:e.jsx(T,{className:"h-3.5 w-3.5"})}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:b??s.previewUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(B,{className:"h-3.5 w-3.5"})})}),e.jsx(u,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:r,title:"Fullscreen",children:e.jsx(ie,{className:"h-3.5 w-3.5"})})]}),l&&e.jsxs(u,{type:"button",variant:n?"secondary":"ghost",size:"sm","aria-pressed":n,onClick:v,className:"h-7 shrink-0 rounded-full px-2.5 text-xs",children:[e.jsx(oe,{className:"h-3.5 w-3.5"}),"Advanced"]})]})]})}function I({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-2xl border border-border/60 bg-white shadow-sm",children:l}):e.jsx(N,{children:"No service preview running."})})]})}function q(s){return s.openUrl??s.previewUrl}function ue(s){return s.kind==="service"?void 0:"allow-scripts allow-same-origin"}function K(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 N({children:s}){return e.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:s})}function O(s){const n=Math.max(0,Math.round((s-Date.now())/1e3));if(n<60)return`${n}s`;const l=Math.floor(n/60),i=n%60;return`${l}m ${i}s`}export{H as PreviewHeader,I as PreviewServicePanel,he as PreviewTab,L as PreviewToolbar,ue as getPreviewIframeSandbox,q as getPreviewOpenUrl};
@@ -1,7 +1,7 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-CwM0TYJk.js","assets/index-Cba_59ol.js","assets/index-BzzXPy7Y.css","assets/folder-BbOC2arM.js","assets/file-BTuUAaOs.js","assets/PreviewTab-ti-mR-KD.js","assets/input-DXbjJpeh.js"])))=>i.map(i=>d[i]);
2
- import{c as N,aB as k,r as s,j as e,M as S,P as T,Q as C,a3 as P,aX as M,aY as _,aZ as j,a_ as E,a$ as L,a1 as w,b0 as A}from"./index-Cba_59ol.js";import{n as I,j as O,i as F,L as R,C as z,T as v,m as B}from"./DashboardShared-CJtOr7QZ.js";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-8EoW1a5F.js","assets/index-BgSOSh2K.js","assets/index-BzzXPy7Y.css","assets/folder-BCnKXNII.js","assets/file-BBYxpzot.js","assets/PreviewTab-DJEeyGWo.js","assets/input-BcMrrsRJ.js"])))=>i.map(i=>d[i]);
2
+ import{c as N,aB as k,r as s,j as e,M as S,P as T,Q as C,a3 as P,aX as M,aY as _,aZ as j,a_ as E,a$ as L,a1 as w,b0 as A}from"./index-BgSOSh2K.js";import{n as I,j as O,i as F,L as R,C as z,T as v,m as B}from"./DashboardShared-BdpxWcCV.js";/**
3
3
  * @license lucide-react v1.7.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
6
6
  * See the LICENSE file in the root directory of this source tree.
7
- */const D=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],V=N("message-square-text",D),q=s.lazy(async()=>({default:(await w(()=>import("./FilesTab-CwM0TYJk.js"),__vite__mapDeps([0,1,2,3,4]))).FilesTab})),G=s.lazy(async()=>({default:(await w(()=>import("./PreviewTab-ti-mR-KD.js"),__vite__mapDeps([5,1,2,6]))).PreviewTab})),H={getOutput:j,getOutputTree:_,getOutputContent:M},U={getOutput:j,createPreviewSession:(t,r)=>A(t,typeof r=="string"?r:r==null?void 0:r.path)};function X(){const{shareId:t}=k(),[r,n]=s.useState(null),[c,a]=s.useState([]),[x,u]=s.useState(!0),[p,d]=s.useState(null),l=s.useRef(null);return s.useEffect(()=>{if(!t){n(null),a([]),d("Shared conversation not found"),u(!1);return}let o=!1;l.current=t,u(!0),d(null);const m=async h=>{try{const[f,b]=await Promise.all([E(t),L(t)]);if(o||l.current!==t)return;n(f),a(y=>h?b.logs:B(y,b.logs)),d(null)}catch(f){if(o||l.current!==t)return;h&&(n(null),a([]),d(f instanceof Error?f.message:"Failed to load shared conversation"))}finally{!o&&l.current===t&&h&&u(!1)}};m(!0);const i=window.setInterval(()=>{m(!1)},2500);return()=>{o=!0,window.clearInterval(i)}},[t]),e.jsx(W,{conversation:r,logs:c,loading:x,error:p})}function W({conversation:t,logs:r,loading:n,error:c}){const[a,x]=s.useState("transcript"),[u,p]=s.useState(!1),d=s.useMemo(()=>{if(!t)return null;const i=I(t.payload.initialMessage);return i.length>0?O(i,new Date(t.createdAt).toISOString()):null},[t]),l=s.useMemo(()=>F([...d?[d]:[],...r]),[d,r]),o=(t==null?void 0:t.scope)==="filesPreview",m=e.jsx("section",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain scroll-pb-16 px-4 py-5 sm:px-6",children:e.jsxs("div",{className:"mx-auto flex max-w-[72rem] flex-col gap-5 pb-16",children:[n&&e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border/60 bg-background/60 px-4 py-3 text-sm text-muted-foreground",children:[e.jsx(R,{className:"h-4 w-4 animate-spin"}),"Loading shared conversation..."]}),!n&&c&&e.jsxs("div",{className:"rounded-lg border border-destructive/20 bg-destructive/10 px-5 py-8 text-center text-destructive",children:[e.jsx("div",{className:"text-base font-semibold",children:"Shared conversation unavailable"}),e.jsx("div",{className:"mt-2 text-sm",children:c})]}),!n&&!c&&l.length===0&&e.jsxs("div",{className:"rounded-lg border border-dashed border-border/70 bg-background/35 px-5 py-8 text-center",children:[e.jsx(V,{className:"mx-auto h-6 w-6 text-muted-foreground"}),e.jsx("div",{className:"mt-3 text-sm font-medium text-foreground",children:"No transcript output yet"})]}),!n&&!c&&l.map((i,h)=>e.jsx(z,{event:i,questionResponseDisabled:!0},`shared-${h}`))]})});return e.jsxs("div",{className:"relative flex h-full min-h-0 overflow-hidden bg-background text-foreground",children:[e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-r border-border/60 bg-muted/20 px-4 py-5 lg:flex xl:w-72",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background shadow-sm",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm 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-7 text-[11px] font-medium uppercase tracking-[0.28em] text-muted-foreground",children:"Shared conversation"}),t&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("h1",{className:"max-h-28 overflow-hidden break-words text-base 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(S,{status:t.status}),e.jsx(T,{priority:t.priority})]}),e.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[e.jsxs("div",{children:["updated ",C(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:[u&&e.jsx("div",{className:"rounded-xl border border-border/70 bg-background/80 p-3 font-mono text-[11px] text-foreground shadow-sm",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-9 w-9 items-center justify-center rounded-full 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:()=>p(i=>!i),"aria-expanded":u,className:"inline-flex h-9 items-center gap-2 rounded-full border border-border/70 bg-background/70 px-3 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(P,{className:"h-4 w-4"}),"Try it"]})]})]})]}),e.jsxs("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"shrink-0 border-b border-border/60 bg-background/85 px-4 py-3 sm:px-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border/70 bg-foreground text-xs 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-base font-semibold text-foreground",children:(t==null?void 0:t.title)??"Shared conversation"})]})]}),o&&e.jsxs("div",{className:"mt-3 inline-flex h-auto rounded-full bg-muted/70 p-1 text-muted-foreground",children:[e.jsx("button",{type:"button",onClick:()=>x("transcript"),className:g(a==="transcript"),children:"Transcript"}),e.jsx("button",{type:"button",onClick:()=>x("files"),className:g(a==="files"),children:"Files"}),e.jsx("button",{type:"button",onClick:()=>x("preview"),className:g(a==="preview"),children:"Preview"})]})]}),o&&t?e.jsxs(e.Fragment,{children:[a==="transcript"&&m,a==="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:H})})}),a==="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(G,{taskId:t.shareId,api:U,allowPortPreview:!1})})})]}):m]})]})}function g(t){return t?"inline-flex items-center justify-center whitespace-nowrap rounded-full bg-background px-3 py-1.5 text-sm font-medium text-foreground shadow-sm":"inline-flex items-center justify-center whitespace-nowrap rounded-full px-3 py-1.5 text-sm 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{X as SharedConversationPage,W as SharedConversationView};
7
+ */const D=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],V=N("message-square-text",D),q=s.lazy(async()=>({default:(await w(()=>import("./FilesTab-8EoW1a5F.js"),__vite__mapDeps([0,1,2,3,4]))).FilesTab})),G=s.lazy(async()=>({default:(await w(()=>import("./PreviewTab-DJEeyGWo.js"),__vite__mapDeps([5,1,2,6]))).PreviewTab})),H={getOutput:j,getOutputTree:_,getOutputContent:M},U={getOutput:j,createPreviewSession:(t,r)=>A(t,typeof r=="string"?r:r==null?void 0:r.path)};function X(){const{shareId:t}=k(),[r,n]=s.useState(null),[c,a]=s.useState([]),[x,u]=s.useState(!0),[p,d]=s.useState(null),l=s.useRef(null);return s.useEffect(()=>{if(!t){n(null),a([]),d("Shared conversation not found"),u(!1);return}let o=!1;l.current=t,u(!0),d(null);const m=async h=>{try{const[f,b]=await Promise.all([E(t),L(t)]);if(o||l.current!==t)return;n(f),a(y=>h?b.logs:B(y,b.logs)),d(null)}catch(f){if(o||l.current!==t)return;h&&(n(null),a([]),d(f instanceof Error?f.message:"Failed to load shared conversation"))}finally{!o&&l.current===t&&h&&u(!1)}};m(!0);const i=window.setInterval(()=>{m(!1)},2500);return()=>{o=!0,window.clearInterval(i)}},[t]),e.jsx(W,{conversation:r,logs:c,loading:x,error:p})}function W({conversation:t,logs:r,loading:n,error:c}){const[a,x]=s.useState("transcript"),[u,p]=s.useState(!1),d=s.useMemo(()=>{if(!t)return null;const i=I(t.payload.initialMessage);return i.length>0?O(i,new Date(t.createdAt).toISOString()):null},[t]),l=s.useMemo(()=>F([...d?[d]:[],...r]),[d,r]),o=(t==null?void 0:t.scope)==="filesPreview",m=e.jsx("section",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain scroll-pb-16 px-4 py-5 sm:px-6",children:e.jsxs("div",{className:"mx-auto flex max-w-[72rem] flex-col gap-5 pb-16",children:[n&&e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border/60 bg-background/60 px-4 py-3 text-sm text-muted-foreground",children:[e.jsx(R,{className:"h-4 w-4 animate-spin"}),"Loading shared conversation..."]}),!n&&c&&e.jsxs("div",{className:"rounded-lg border border-destructive/20 bg-destructive/10 px-5 py-8 text-center text-destructive",children:[e.jsx("div",{className:"text-base font-semibold",children:"Shared conversation unavailable"}),e.jsx("div",{className:"mt-2 text-sm",children:c})]}),!n&&!c&&l.length===0&&e.jsxs("div",{className:"rounded-lg border border-dashed border-border/70 bg-background/35 px-5 py-8 text-center",children:[e.jsx(V,{className:"mx-auto h-6 w-6 text-muted-foreground"}),e.jsx("div",{className:"mt-3 text-sm font-medium text-foreground",children:"No transcript output yet"})]}),!n&&!c&&l.map((i,h)=>e.jsx(z,{event:i,questionResponseDisabled:!0},`shared-${h}`))]})});return e.jsxs("div",{className:"relative flex h-full min-h-0 overflow-hidden bg-background text-foreground",children:[e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-r border-border/60 bg-muted/20 px-4 py-5 lg:flex xl:w-72",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background shadow-sm",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm 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-7 text-[11px] font-medium uppercase tracking-[0.28em] text-muted-foreground",children:"Shared conversation"}),t&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("h1",{className:"max-h-28 overflow-hidden break-words text-base 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(S,{status:t.status}),e.jsx(T,{priority:t.priority})]}),e.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[e.jsxs("div",{children:["updated ",C(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:[u&&e.jsx("div",{className:"rounded-xl border border-border/70 bg-background/80 p-3 font-mono text-[11px] text-foreground shadow-sm",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-9 w-9 items-center justify-center rounded-full 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:()=>p(i=>!i),"aria-expanded":u,className:"inline-flex h-9 items-center gap-2 rounded-full border border-border/70 bg-background/70 px-3 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(P,{className:"h-4 w-4"}),"Try it"]})]})]})]}),e.jsxs("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"shrink-0 border-b border-border/60 bg-background/85 px-4 py-3 sm:px-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border/70 bg-foreground text-xs 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-base font-semibold text-foreground",children:(t==null?void 0:t.title)??"Shared conversation"})]})]}),o&&e.jsxs("div",{className:"mt-3 inline-flex h-auto rounded-full bg-muted/70 p-1 text-muted-foreground",children:[e.jsx("button",{type:"button",onClick:()=>x("transcript"),className:g(a==="transcript"),children:"Transcript"}),e.jsx("button",{type:"button",onClick:()=>x("files"),className:g(a==="files"),children:"Files"}),e.jsx("button",{type:"button",onClick:()=>x("preview"),className:g(a==="preview"),children:"Preview"})]})]}),o&&t?e.jsxs(e.Fragment,{children:[a==="transcript"&&m,a==="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:H})})}),a==="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(G,{taskId:t.shareId,api:U,allowPortPreview:!1})})})]}):m]})]})}function g(t){return t?"inline-flex items-center justify-center whitespace-nowrap rounded-full bg-background px-3 py-1.5 text-sm font-medium text-foreground shadow-sm":"inline-flex items-center justify-center whitespace-nowrap rounded-full px-3 py-1.5 text-sm 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{X as SharedConversationPage,W as SharedConversationView};
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-Cba_59ol.js";/**
1
+ import{c as a}from"./index-BgSOSh2K.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}from"./index-Cba_59ol.js";/**
1
+ import{c as o}from"./index-BgSOSh2K.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.