meshy-node 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
- import{c as b,r as n,M as T,S as L,j as e,i,B as E}from"./index-Dc0APxmT.js";import{E as M,D as O,a as _,b as D,c as F}from"./DashboardPage-Bu_7sWoy.js";/**
1
+ import{c as g,r as n,ao as T,ar as L,j as e,i,Y as E,B as M,am as O,D as _,g as D,as as F}from"./index-C49tlczJ.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 H=[["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"}]],R=b("maximize-2",H);/**
6
+ */const H=[["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"}]],R=g("maximize-2",H);/**
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 $=[["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"}]],U=b("minimize-2",$);/**
11
+ */const $=[["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"}]],U=g("minimize-2",$);/**
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 A=[["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"}]],w=b("refresh-cw",A);function I({taskId:l}){var k;const[t,u]=n.useState(null),[s,p]=n.useState(null),[x,v]=n.useState(null),[P,j]=n.useState(!0),[g,f]=n.useState(null),[S,N]=n.useState(!1),y=n.useCallback(async()=>{j(!0),f(null),u(null),p(null),v(null);try{const r=await T(l);u(r),j(!1)}catch(r){f(r instanceof Error?r.message:"Failed to load output"),j(!1)}},[l]);n.useEffect(()=>{y()},[y]);const c=n.useCallback(async r=>{f(null);try{const a=await L(l,r);p(a),v(a.entryPath)}catch(a){f(a instanceof Error?a.message:"Failed to create preview session")}},[l]);n.useEffect(()=>{var a,h;if(!(t!=null&&t.available)||!((a=t.summary)!=null&&a.htmlEntries.length)||s)return;const r=x??((h=t.summary.htmlEntries[0])==null?void 0:h.path);r&&c(r)},[t,x,s,c]);const o=n.useCallback(()=>{var a,h;p(null);const r=(s==null?void 0:s.entryPath)??x??((h=(a=t==null?void 0:t.summary)==null?void 0:a.htmlEntries[0])==null?void 0:h.path);r&&c(r)},[t,x,s,c]);if(n.useEffect(()=>{if(!s)return;const r=s.expiresAt-Date.now()-5e3;if(r<=0){o();return}const a=window.setTimeout(o,r);return()=>window.clearTimeout(a)},[o,s]),P)return e.jsx(m,{children:"Loading preview..."});if(!(t!=null&&t.available))return e.jsx(m,{children:"Task output is not available yet."});const d=((k=t.summary)==null?void 0:k.htmlEntries)??[];if(d.length===0)return e.jsx(m,{children:"No HTML files were found in this task output."});if(g)return e.jsx(m,{children:e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"text-sm text-destructive",children:g}),e.jsx("div",{className:"flex justify-center",children:e.jsxs(i,{variant:"outline",size:"sm",onClick:o,className:"rounded-full",children:[e.jsx(w,{className:"h-3.5 w-3.5"}),"Retry"]})})]})});if(!s)return e.jsx(m,{children:"Starting preview session..."});const z=e.jsx("iframe",{src:s.previewUrl,className:"h-full w-full border-0",sandbox:"allow-scripts allow-same-origin",title:"HTML 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.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-foreground",children:s.entryPath}),e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:C(s.expiresAt)})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[e.jsx(i,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:o,title:"Refresh",children:e.jsx(w,{className:"h-3.5 w-3.5"})}),e.jsx(i,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:s.previewUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(M,{className:"h-3.5 w-3.5"})})}),e.jsx(i,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:()=>N(!0),title:"Fullscreen",children:e.jsx(R,{className:"h-3.5 w-3.5"})})]})]}),d.length>1&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:d.map(r=>e.jsx("button",{type:"button",onClick:()=>{v(r.path),c(r.path)},className:s.entryPath===r.path?"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:r.label},r.path))}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsxs(E,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:[d.length," ",d.length===1?"entry":"entries"]}),e.jsx(E,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:"Sandboxed iframe"})]})]}),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:z})}),e.jsx(O,{open:S,onOpenChange:N,children:e.jsxs(_,{className:"flex h-[95vh] max-w-[95vw] flex-col gap-0 overflow-hidden p-0",children:[e.jsxs(D,{className:"sr-only",children:["Preview: ",s.entryPath]}),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:s.entryPath}),e.jsx("span",{className:"text-xs text-muted-foreground",children:C(s.expiresAt)})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(i,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:o,title:"Refresh",children:e.jsx(w,{className:"h-3.5 w-3.5"})}),e.jsx(i,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:s.previewUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(M,{className:"h-3.5 w-3.5"})})}),e.jsx(F,{asChild:!0,children:e.jsxs(i,{variant:"outline",size:"sm",className:"rounded-full",title:"Exit fullscreen",children:[e.jsx(U,{className:"h-3.5 w-3.5"}),"Exit fullscreen"]})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx("iframe",{src:s.previewUrl,className:"h-full w-full border-0",sandbox:"allow-scripts allow-same-origin",title:"HTML Preview Fullscreen"})})]})})]})}function m({children:l}){return e.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:l})}function C(l){const t=Math.max(0,Math.round((l-Date.now())/1e3));if(t<60)return`${t}s`;const u=Math.floor(t/60),s=t%60;return`${u}m ${s}s`}export{I as PreviewTab};
16
+ */const A=[["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"}]],w=g("refresh-cw",A);function q({taskId:l}){var k;const[t,m]=n.useState(null),[s,p]=n.useState(null),[x,v]=n.useState(null),[P,j]=n.useState(!0),[b,f]=n.useState(null),[S,N]=n.useState(!1),y=n.useCallback(async()=>{j(!0),f(null),m(null),p(null),v(null);try{const r=await T(l);m(r),j(!1)}catch(r){f(r instanceof Error?r.message:"Failed to load output"),j(!1)}},[l]);n.useEffect(()=>{y()},[y]);const c=n.useCallback(async r=>{f(null);try{const a=await L(l,r);p(a),v(a.entryPath)}catch(a){f(a instanceof Error?a.message:"Failed to create preview session")}},[l]);n.useEffect(()=>{var a,h;if(!(t!=null&&t.available)||!((a=t.summary)!=null&&a.htmlEntries.length)||s)return;const r=x??((h=t.summary.htmlEntries[0])==null?void 0:h.path);r&&c(r)},[t,x,s,c]);const o=n.useCallback(()=>{var a,h;p(null);const r=(s==null?void 0:s.entryPath)??x??((h=(a=t==null?void 0:t.summary)==null?void 0:a.htmlEntries[0])==null?void 0:h.path);r&&c(r)},[t,x,s,c]);if(n.useEffect(()=>{if(!s)return;const r=s.expiresAt-Date.now()-5e3;if(r<=0){o();return}const a=window.setTimeout(o,r);return()=>window.clearTimeout(a)},[o,s]),P)return e.jsx(u,{children:"Loading preview..."});if(!(t!=null&&t.available))return e.jsx(u,{children:"Task output is not available yet."});const d=((k=t.summary)==null?void 0:k.htmlEntries)??[];if(d.length===0)return e.jsx(u,{children:"No HTML files were found in this task output."});if(b)return e.jsx(u,{children:e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"text-sm text-destructive",children:b}),e.jsx("div",{className:"flex justify-center",children:e.jsxs(i,{variant:"outline",size:"sm",onClick:o,className:"rounded-full",children:[e.jsx(w,{className:"h-3.5 w-3.5"}),"Retry"]})})]})});if(!s)return e.jsx(u,{children:"Starting preview session..."});const z=e.jsx("iframe",{src:s.previewUrl,className:"h-full w-full border-0",sandbox:"allow-scripts allow-same-origin",title:"HTML 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.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-foreground",children:s.entryPath}),e.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:C(s.expiresAt)})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[e.jsx(i,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:o,title:"Refresh",children:e.jsx(w,{className:"h-3.5 w-3.5"})}),e.jsx(i,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:s.previewUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(E,{className:"h-3.5 w-3.5"})})}),e.jsx(i,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:()=>N(!0),title:"Fullscreen",children:e.jsx(R,{className:"h-3.5 w-3.5"})})]})]}),d.length>1&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:d.map(r=>e.jsx("button",{type:"button",onClick:()=>{v(r.path),c(r.path)},className:s.entryPath===r.path?"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:r.label},r.path))}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsxs(M,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:[d.length," ",d.length===1?"entry":"entries"]}),e.jsx(M,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:"Sandboxed iframe"})]})]}),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:z})}),e.jsx(O,{open:S,onOpenChange:N,children:e.jsxs(_,{className:"flex h-[95vh] max-w-[95vw] flex-col gap-0 overflow-hidden p-0",children:[e.jsxs(D,{className:"sr-only",children:["Preview: ",s.entryPath]}),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:s.entryPath}),e.jsx("span",{className:"text-xs text-muted-foreground",children:C(s.expiresAt)})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(i,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",onClick:o,title:"Refresh",children:e.jsx(w,{className:"h-3.5 w-3.5"})}),e.jsx(i,{variant:"ghost",size:"icon",className:"h-7 w-7 rounded-full",asChild:!0,title:"Open in new tab",children:e.jsx("a",{href:s.previewUrl,target:"_blank",rel:"noopener noreferrer",children:e.jsx(E,{className:"h-3.5 w-3.5"})})}),e.jsx(F,{asChild:!0,children:e.jsxs(i,{variant:"outline",size:"sm",className:"rounded-full",title:"Exit fullscreen",children:[e.jsx(U,{className:"h-3.5 w-3.5"}),"Exit fullscreen"]})})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx("iframe",{src:s.previewUrl,className:"h-full w-full border-0",sandbox:"allow-scripts allow-same-origin",title:"HTML Preview Fullscreen"})})]})})]})}function u({children:l}){return e.jsx("div",{className:"flex h-64 items-center justify-center text-muted-foreground",children:l})}function C(l){const t=Math.max(0,Math.round((l-Date.now())/1e3));if(t<60)return`${t}s`;const m=Math.floor(t/60),s=t%60;return`${m}m ${s}s`}export{q as PreviewTab};
@@ -1,4 +1,4 @@
1
- import{c as a}from"./index-Dc0APxmT.js";/**
1
+ import{c as a}from"./index-C49tlczJ.js";/**
2
2
  * @license lucide-react v1.7.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.