PageSourceSearch

https://www.nereo.io/_next/static/chunks/29482-7119db6c165e99d7.js

js nereo.io collected 2026-10-04 19:11:50 UTC 27,093 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[29482],{34340:function(e,t,a){var s=a(50313);a(68248);var l=a(17788),i=a(19538);t.Z=e=>{var t;let{open:a,isOpen:r,onOpenChange:n,onClose:o,onConfirm:c,isDeleting:d=!1,description:m,title:x}=e,p=(0,l.useTranslations)("imageHistory"),u=x||p("deleteConfirmTitle"),g=m||p("deleteConfirmDescription"),h=null!==(t=null!=a?a:r)&&void 0!==t&&t,f=e=>{n?n(e):o&&!e&&o()};return(0,s.jsx)(i.aR,{open:h,onOpenChange:f,children:(0,s.jsxs)(i._T,{className:"sm:max-w-[400px]",children:[(0,s.jsxs)(i.fY,{children:[(0,s.jsx)(i.f$,{children:u}),(0,s.jsx)(i.yT,{className:"text-center py-4 text-base",children:g})]}),(0,s.jsxs)(i.xo,{className:"flex justify-center gap-3 sm:justify-center",children:[(0,s.jsx)(i.le,{onClick:()=>f(!1),disabled:d,children:p("deleteConfirmCancel")}),(0,s.jsx)(i.OL,{onClick:c,disabled:d,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:p("deleteConfirmConfirm")})]})]})})}},35757:function(e,t,a){a.d(t,{Z:function(){return F}});var s=a(50313),l=a(68248),i=a(52926),r=a(78777),n=a(36942),o=a(69174),c=a(80313),d=a(31298),m=a(87420),x=a(86944),p=a(17788),u=a(97578),g=a(52594);let h=l.memo(e=>{let{originalPrompt:t,optimizedPrompt:a,isExpanded:l,onToggle:i}=e,n=(0,p.useTranslations)("imageHistory");return a&&a!==t?(0,s.jsxs)("div",{className:"bg-gray-900/50 rounded-lg p-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center cursor-pointer",onClick:i,children:[(0,s.jsxs)("div",{className:"text-sm font-semibold text-purple-400 flex items-center",children:[(0,s.jsx)(r.Z,{className:"text-base mr-2 h-4 w-4"}),n("optimizingPrompt"),":"]}),l?(0,s.jsx)(u.Z,{className:"text-gray-400 h-5 w-5"}):(0,s.jsx)(g.Z,{className:"text-gray-400 h-5 w-5"})]}),(0,s.jsx)("p",{className:"mt-2 text-sm text-gray-300",style:l?{}:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:a})]}):null});h.displayName="EnhancedPrompt";var f=a(88047),j=a(75066),v=a(97683),y=a(40976),N=a(13477),b=a(14694),w=a(53045);let C=l.memo(e=>{let{progress:t,className:a,showPercentage:l=!0}=e,i=Math.min(Math.max(t,0),100);return(0,s.jsxs)("div",{className:(0,w.cn)("w-full",a),children:[(0,s.jsx)("div",{className:"relative w-full h-2 bg-gray-700/50 rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:"absolute top-0 left-0 h-full bg-primary rounded-full transition-all duration-500 ease-out",style:{width:"".concat(i,"%")},children:(0,s.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent animate-shimmer"})})}),l&&(0,s.jsx)("div",{className:"mt-2 text-center",children:(0,s.jsxs)("span",{className:"text-sm font-medium text-gray-300",children:[Math.round(i),"%"]})})]})});C.displayName="ImageProgressBar";var k=a(34340),_=a(93821);let Z=e=>{let{imageUrl:t,prompt:a,index:l,total:i,isLoading:r=!1,progress:o=0,remainingTime:c=0,onImageClick:d,onDownload:m,isDownloading:x=!1}=e,u=(0,b.d)(),g=(0,p.useTranslations)("imageHistory");return(0,s.jsx)("div",{className:"relative group cursor-pointer aspect-square",children:t&&!r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("img",{src:t,alt:"".concat(a," (").concat(l+1,"/").concat(i,")"),className:"w-full h-full object-cover rounded-lg",onClick:()=>null==d?void 0:d(t,"".concat(a," (").concat(l+1,"/").concat(i,")")),loading:"lazy"}),m&&(0,s.jsx)("div",{className:"absolute top-2 right-2 ".concat(u?"opacity-100":"opacity-0 group-hover:opacity-100"," transition-opacity duration-200 z-10"),children:(0,s.jsx)(f.z,{variant:"secondary",size:"sm",className:"bg-black/60 hover:bg-black/80 text-white border-none h-8 w-8 p-0 rounded-md",onClick:e=>{e.stopPropagation(),m(t,a,l)},disabled:x,title:g("downloadImage"),children:x?(0,s.jsx)(n.Z,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(v.Z,{className:"h-4 w-4"})})}),(0,s.jsxs)("div",{className:"absolute bottom-2 left-2 bg-black/60 text-white text-xs px-2 py-1 rounded",children:[l+1,"/",i]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"w-full h-full flex items-center justify-center relative overflow-hidden rounded-lg bg-gray-800",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/20 to-purple-900/20 rounded-lg"}),(0,s.jsxs)("div",{className:"relative z-10 text-center w-full px-3 py-2",children:[(0,s.jsx)("div",{className:"w-full mb-2",children:(0,s.jsx)(C,{progress:o,showPercentage:!1})}),(0,s.jsx)("div",{className:"text-center",children:(0,s.jsxs)("div",{className:"text-sm font-bold text-white",children:[Math.round(o),"%"]})})]})]}),(0,s.jsxs)("div",{className:"absolute bottom-2 left-2 bg-black/60 text-white text-xs px-2 py-1 rounded",children:[l+1,"/",i]})]})})};var z=a(68159);let D=l.memo(e=>{let{status:t,statusInfo:a,imageUrl:i,imageUrls:o,imageUrlsR2:c,errorMessage:d,createdAt:u,image:g,onEdit:h,onRegenerate:w,onDelete:D,onImageClick:T,onDownload:A,isDownloading:E=!1,canEdit:I,pollingImages:F}=e,P=g.is_agent_mode||!1,R=g.agent_image_count||0,U=(null==c?void 0:c.length)?c:o||[],L=U.length,O="completed"===t||"saved_to_r2"===t,S="prompt_optimizing"===t,M=["pending","in_queue","in_progress","prompt_optimizing"].includes(t),q="failed"===t;F.has(g.id);let H=(0,b.d)(),W=(0,_.qj)(g.model||"nano-banana"),B=(null==W?void 0:W.estimatedGenerationTime)||30,V=!!(null==W?void 0:W.supportsLayerDecomposition),$=function(e){let{createdAt:t,estimatedTime:a=30,status:s}=e,[i,r]=(0,l.useState)({elapsedTime:0,progress:0,remainingTime:a,isComplete:!1}),n=(0,l.useCallback)(()=>
1{if(!t)return{elapsedTime:0,progress:0,remainingTime:a,isComplete:!1};let e=new Date(t).getTime(),l=Math.floor((Date.now()-e)/1e3);if("completed"===s||"saved_to_r2"===s)return{elapsedTime:l,progress:100,remainingTime:0,isComplete:!0};if("failed"===s)return{elapsedTime:l,progress:0,remainingTime:0,isComplete:!1};if(["in_progress","in_queue","pending","prompt_optimizing"].includes(s)){let e=l/a*100,t=Math.max(0,a-l);return{elapsedTime:l,progress:Math.min(e=Math.min(e,95),100),remainingTime:t,isComplete:!1}}return{elapsedTime:l,progress:5,remainingTime:Math.max(0,a-l),isComplete:!1}},[t,a,s]);return(0,l.useEffect)(()=>{if(r(n()),"completed"===s||"saved_to_r2"===s||"failed"===s)return;let e=setInterval(()=>{let t=n();r(t),(t.isComplete||"failed"===s)&&clearInterval(e)},1e3);return()=>clearInterval(e)},[n,s]),i}({createdAt:g.created_at,estimatedTime:B,status:t}),[Y,K]=(0,l.useState)(!1),[G,J]=(0,l.useState)(!1),[Q,X]=(0,l.useState)(null),ee=(0,p.useTranslations)("imageHistory"),et=(0,p.useTranslations)(),[ea,es]=(0,l.useState)(null),[el,ei]=(0,l.useState)(!1),[er,en]=(0,l.useState)(!1),eo=async()=>{if(ea){en(!0);return}ei(!0);try{var e;let t=await fetch("/api/image-generations/".concat(g.id)),a=await t.json(),s=null==a?void 0:null===(e=a.data)||void 0===e?void 0:e.layers_data;if(!Array.isArray(s)||0===s.length){x.Am.error(ee("layers.unavailable"));return}es(s),en(!0)}catch(e){console.error("Failed to load layer data:",e),x.Am.error(ee("layers.unavailable"))}finally{ei(!1)}},ec=async e=>{null==e||e.preventDefault(),null==e||e.stopPropagation(),D&&!Y&&J(!0)},ed=async()=>{if(D){K(!0),J(!1);try{await D(g.id,g.prompt||""),x.Am.success(ee("imageDeleted"))}catch(e){console.error("Delete operation failed:",e),x.Am.error(ee("deleteFailed"))}finally{K(!1)}}},em=async(e,t,a)=>{if(!e){x.Am.error(ee("downloadFailed"));return}X(a);try{var s,l;let i=t.substring(0,15).replace(/[^a-zA-Z0-9\s]/g,"").replace(/\s+/g,"_"),r=e.split("."),n=(null===(l=r[r.length-1])||void 0===l?void 0:null===(s=l.split("?")[0])||void 0===s?void 0:s.toLowerCase())||"png",o="".concat(i,"_").concat(g.id,"_").concat(a+1,".").concat(n),c="/api/proxy-image?url=".concat(encodeURIComponent(e),"&filename=").concat(encodeURIComponent(o)),d=await fetch(c);if(!d.ok)throw Error("Download failed");let m=await d.blob();if(!m||0===m.size)throw Error("Empty image blob");let p=window.URL.createObjectURL(m),u=document.createElement("a");u.href=p,u.download=o,u.style.cssText="display: none; position: absolute; top: -9999px;",document.body.appendChild(u),u.click(),document.body.removeChild(u),window.URL.revokeObjectURL(p),x.Am.success(ee("imageDownloaded"))}catch(t){console.error("Download failed:",t);try{let t=document.createElement("a");t.href=e,t.download="image_".concat(a+1,".png"),t.target="_blank",t.click()}catch(e){x.Am.error(ee("downloadFailed"))}}finally{X(null)}},ex=()=>{w&&w(g)};if(S)return(0,s.jsx)("div",{className:"space-y-3",children:(0,s.jsx)("div",{className:"flex justify-start",children:(0,s.jsx)("div",{className:"".concat("h-64"," w-full max-w-[518px] bg-gray-700 rounded-lg flex items-center justify-center"),children:(0,s.jsxs)("div",{className:"text-center py-8",children:[(0,s.jsxs)("div",{className:"relative mb-4",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-purple-500/20 blur-xl rounded-full animate-pulse"}),(0,s.jsx)(r.Z,{className:"h-12 w-12 text-purple-400 relative animate-pulse mx-auto"})]}),(0,s.jsx)("h3",{className:"text-lg font-medium text-white mb-2",children:ee("optimizingPromptTitle")}),(0,s.jsx)("p",{className:"text-sm text-gray-400",children:ee("optimizingPromptDescription")})]})})})});if(O&&(i||(P||V)&&U.length>0))return(P||V)&&U.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"space-y-3",children:[L<R&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm text-amber-400",children:[(0,s.jsx)(r.Z,{className:"h-4 w-4"}),(0,s.jsxs)("span",{children:[ee("processing"),": ",L,"/",R]})]}),(0,s.jsx)("div",{className:"grid ".concat((U.length,"grid-cols-4")," gap-2"),children:U.map((e,t)=>(0,s.jsx)(Z,{imageUrl:e,prompt:g.prompt,index:t,total:U.length,onImageClick:T,onDownload:em,isDownloading:Q===t},t))}),(V||D)&&(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[V?(0,s.jsxs)(f.z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-white",onClick:eo,disabled:el,children:[el?(0,s.jsx)(n.Z,{className:"mr-1.5 h-4 w-4 animate-spin"}):(0,s.jsx)(j.Z,{className:"mr-1.5 h-4 w-4"}),ee("layers.view")]}):(0,s.jsx)("span",{}),D&&(0,s.jsx)(f.z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-red-400",onClick:ec,disabled:Y,children:Y?(0,s.jsx)(n.Z,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(m.Z,{className:"h-4 w-4"})})]})]}),ea&&(0,s.jsx)(z.X,{isOpen:er,onClose:()=>en(!1),layers:ea,displayUrls:U,promptLabel:g.prompt||void 0}),(0,s.jsx)(k.Z,{isOpen:G,onClose:()=>J(!1),onConfirm:ed,prompt:g.prompt||"",isDeleting:Y})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("div",{className:"flex justify-start",children:(0,s.jsx)("div",{className:"".concat("h-64"," w-full max-w-[518px]"),children:(0,s.jsxs)("div",{className:"relative group inline-block cursor-pointer",onClick:()=>
1{if(!i){x.Am.error(ee("downloadFailed"));return}T?T(i,g.prompt):window.open(i,"_blank")},children:[(0,s.jsx)("img",{src:i,alt:g.prompt,className:"max-h-64 object-contain rounded-lg",loading:"lazy"}),(0,s.jsxs)("div",{className:"absolute top-3 right-3 ".concat(H?"opacity-100":"opacity-0 group-hover:opacity-100"," transition-opacity duration-200 flex gap-2 z-10"),children:[(0,s.jsx)(f.z,{variant:"secondary",size:"sm",className:"bg-black/60 hover:bg-black/80 text-white border-none h-8 w-8 p-0 rounded-md",onClick:e=>{e.stopPropagation(),A&&A(g)},disabled:E,title:ee("downloadImage"),children:E?(0,s.jsx)(n.Z,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(v.Z,{className:"h-4 w-4"})}),D&&(0,s.jsx)(f.z,{variant:"secondary",size:"sm",className:"bg-black/60 hover:bg-red-600/80 text-white border-none h-8 w-8 p-0 rounded-md",onClick:e=>{e.stopPropagation(),ec(e)},disabled:Y,title:ee("deleteImage"),children:Y?(0,s.jsx)(n.Z,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(m.Z,{className:"h-4 w-4"})})]})]})})}),I&&(h||w)&&(0,s.jsxs)("div",{className:"flex gap-2",children:[I&&h&&(0,s.jsx)(f.z,{variant:"ghost",size:"sm",onClick:()=>{h&&h(g)},className:"text-gray-400 hover:text-white",children:(0,s.jsx)(y.Z,{className:"h-4 w-4"})}),I&&w&&(0,s.jsx)(f.z,{variant:"ghost",size:"sm",onClick:ex,className:"text-gray-400 hover:text-white",children:(0,s.jsx)(N.Z,{className:"h-4 w-4"})})]})]}),(0,s.jsx)(k.Z,{isOpen:G,onClose:()=>J(!1),onConfirm:ed,prompt:g.prompt||"",isDeleting:Y})]});if(M){if(P&&R>0){var ep;let e=(null===(ep=g.metadata)||void 0===ep?void 0:ep.agent_tasks)||[],t=(null==c?void 0:c.length)?c:o||[],a=Array.from({length:R}).map((a,s)=>{let l=e[s],i=(null==l?void 0:l.r2Url)||(null==l?void 0:l.imageUrl),r=(null==l?void 0:l.status)==="completed"||!!i,n=t[s];return{isCompleted:r||!!n,imageUrl:i||n}});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm text-amber-400",children:[(0,s.jsx)(r.Z,{className:"h-4 w-4"}),(0,s.jsxs)("span",{children:[ee("processing"),": ",a.filter(e=>e.isCompleted).length,"/",R]})]}),(0,s.jsx)("div",{className:"grid ".concat("grid-cols-4"," gap-2"),children:a.map((e,t)=>(0,s.jsx)(Z,{imageUrl:e.isCompleted?e.imageUrl:void 0,prompt:g.prompt,index:t,total:R,isLoading:!e.isCompleted,progress:$.progress,remainingTime:$.remainingTime,onImageClick:T,onDownload:e.isCompleted?em:void 0,isDownloading:Q===t},t))}),D&&(0,s.jsx)("div",{className:"flex justify-end",children:(0,s.jsx)(f.z,{variant:"ghost",size:"sm",className:"text-gray-400 hover:text-red-400",onClick:ec,disabled:Y,children:Y?(0,s.jsx)(n.Z,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(m.Z,{className:"h-4 w-4"})})})]}),(0,s.jsx)(k.Z,{isOpen:G,onClose:()=>J(!1),onConfirm:ed,prompt:g.prompt||"",isDeleting:Y})]})}return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"space-y-3",children:(0,s.jsx)("div",{className:"flex justify-start",children:(0,s.jsxs)("div",{className:"".concat("h-64"," w-full max-w-[518px] flex items-center justify-center relative overflow-hidden rounded-lg bg-gray-800"),children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/20 to-purple-900/20 rounded-lg"}),(0,s.jsxs)("div",{className:"relative z-10 text-center w-full px-6 py-4",children:[(0,s.jsx)("div",{className:"w-full mb-2",children:(0,s.jsx)(C,{progress:$.progress,showPercentage:!1})}),(0,s.jsx)("div",{className:"text-center",children:(0,s.jsxs)("div",{className:"text-lg font-bold text-white",children:[Math.round($.progress),"%"]})})]})]})})}),(0,s.jsx)(k.Z,{isOpen:G,onClose:()=>J(!1),onConfirm:ed,prompt:g.prompt||"",isDeleting:Y})]})}return q?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("div",{className:"flex justify-start",children:(0,s.jsxs)("div",{className:"".concat("h-64"," w-full max-w-[518px] bg-gray-700 rounded-lg flex items-center justify-center relative group"),children:[(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("div",{className:"text-red-400 mb-2",children:"❌"}),(0,s.jsx)("p",{className:"text-sm text-red-400",children:ee("generationFailed")}),d&&(0,s.jsx)("p",{className:"text-xs text-gray-400 mt-1 max-w-xs line-clamp-3 break-all overflow-hidden px-2",children:d})]}),D&&(0,s.jsx)("div",{className:"absolute top-3 right-3 ".concat(H?"opacity-100":"opacity-0 group-hover:opacity-100"," transition-opacity duration-200"),children:(0,s.jsx)(f.z,{variant:"secondary",size:"sm",className:"bg-black/60 hover:bg-red-600/80 text-white border-none h-8 w-8 p-0 rounded-md",onClick:ec,disabled:Y,title:ee("deleteImage"),children:Y?(0,s.jsx)(n.Z,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(m.Z,{className:"h-4 w-4"})})})]})}),I&&w&&(0,s.jsx)("div",{className:"flex gap-2",children:(0,s.jsxs)(f.z,{variant:"outline",size:"sm",onClick:ex,className:"border-red-500 text-red-500 hover:bg-red-500 hover:text-white",children:[(0,s.jsx)(N.Z,{className:"mr-2 h-4 w-4"}),et("video-result.retry")]})})]}),(0,s.jsx)(k.Z,{isOpen:G,onClose:()=>J(!1),onConfirm:ed,prompt:g.prompt||"",isDeleting:Y})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"space-y-3",children:(0,s.jsx)("div",{className:"flex justify-start",children:(0,s.jsx)("div",{className:"".concat("h-64"," w-full max-w-[518px] bg-gray-700 rounded-lg flex items-center justify-center"),children:(0,s.jsx)("div",{className:"text-center",children:(0,s.jsx)("p",{className:"text-sm text-gray-400",children:a.label})})})})}),(0,s.jsx)(k.Z,{isOpen:G,onClose:()=>J(!1),onConfirm:ed,prompt:g.prompt||"",isDeleting:Y})]})});D.displayName="ImageStatusDisplay";var T=a(90061);let A=l.memo(e=>{let{aspectRatio:t,resolution:a,modelName:l,isAgentMode:i,agentImageCount:n,rightSlot:o}=e;return(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap flex-1",children:[i&&(0,s.jsxs)(T.C,{variant:"secondary",className:"bg-amber-500/20 text-amber-400 text-xs px-2 py-1 rounded border-0 flex items-center gap-1",children:[(0,s.jsx)(r.Z,{className:"h-3 w-3"}),"Agent ",n&&"(".concat(n,")")]}),t&&(0,s.jsx)(T.C,{variant:"secondary",className:"bg-gray-700 text-gray-300 text-xs px-2 py-1 rounded border-0",children:t}),a&&(0,s.jsx)(T.C,{variant:"secondary",className:"bg-gray-700 text-gray-300 text-xs px-2 py-1 rounded border-0",children:a}),l?(0,s.jsx)("div",{className:"text-gray-300 text-sm leading-relaxed",children:l}):null]}),o&&(0,s.jsx)("div",{className:"flex-shrink-0",children:o})]})});A.displayName="ImageMetadata";var E=a(13729);let I=l.memo(e=>{var t;let{image:a,pollingImages:u,isExpanded:g,onToggleExpanded:f,onEdit:j,onRegenerate:v,onDelete:y,onImageClick:N,onDownload:b,isDownloading:w=!1,canEdit:C=!1}=e,Z=(0,p.useTranslations)("imageHistory"),z=!!(a.effect_type&&a.effect_id&&a.effect_name),T=z?a.effect_name:a.prompt,I=z&&a.effect_name||a.prompt,[F,P]=(0,l.useState)(!1),[R,U]=(0,l.useState)(!1),L={completed:{label:Z("completed"),color:"bg-green-600",icon:i.Z},saved_to_r2:{label:Z("completed"),color:"bg-green-600",icon:i.Z},prompt_optimizing:{label:Z("optimizingPrompt"),color:"bg-purple-500",icon:r.Z},in_progress:{label:Z("processing"),color:"bg-orange-500",icon:n.Z},in_queue:{label:Z("inQueue"),color:"bg-yellow-500",icon:o.Z},pending:{label:Z("pending"),color:"bg-gray-500",icon:o.Z},failed:{label:Z("failed"),color:"bg-red-500",icon:c.Z}},O=L[a.status]||L.pending,S=()=>
1{if(!a.created_at)return null;let e=new Date(a.created_at);return(new Date().getTime()-e.getTime())/36e5<24?e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString([],{month:"short",day:"numeric"})},M=async()=>{try{await navigator.clipboard.writeText(a.prompt),x.Am.success(Z("promptCopied"))}catch(e){console.error("Failed to copy prompt:",e),x.Am.error(Z("copyFailed"))}},q=async e=>{null==e||e.preventDefault(),null==e||e.stopPropagation(),y&&!F&&U(!0)},H=async()=>{if(y){P(!0),U(!1);try{await y(a.id,T||""),x.Am.success(Z("imageDeleted"))}catch(e){console.error("Delete operation failed:",e),x.Am.error(Z("deleteFailed"))}finally{P(!1)}}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"px-4 py-5 space-y-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start gap-2",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3 flex-1",children:[a.input_image_urls&&a.input_image_urls.length>0&&(0,s.jsx)("div",{className:"flex-shrink-0 flex gap-1",children:a.input_image_urls.map((e,t)=>(0,s.jsx)("div",{className:"h-12 w-12 rounded overflow-hidden cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>null==N?void 0:N(e,"".concat(a.prompt," (").concat(t+1,")")),title:a.prompt,children:(0,s.jsx)(E.s,{src:e,alt:"".concat(a.prompt," (").concat(t+1,")"),className:"w-full h-full object-cover"})},t))}),(0,s.jsx)("div",{className:"flex-1",children:(0,s.jsx)("p",{className:"text-base font-bold text-white leading-relaxed",style:{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:I})})]}),(0,s.jsxs)("div",{className:"flex flex-col items-end gap-1 flex-shrink-0",children:[S()&&(0,s.jsx)("span",{className:"text-sm text-gray-400",children:S()}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[!z&&(0,s.jsx)("button",{onClick:M,className:"p-0.5 text-gray-400 hover:text-white transition-colors rounded",title:Z("copyPrompt"),children:(0,s.jsx)(d.Z,{className:"h-4 w-4"})}),y&&(0,s.jsx)("button",{onClick:q,className:"p-0.5 text-gray-400 hover:text-red-400 transition-colors rounded",title:Z("deleteImage"),disabled:F,children:F?(0,s.jsx)(n.Z,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(m.Z,{className:"h-4 w-4"})})]})]})]}),!z&&(0,s.jsx)(A,{aspectRatio:a.image_size,resolution:a.resolution,modelName:(null===(t=(0,_.qj)(a.model))||void 0===t?void 0:t.displayName)||a.model,isAgentMode:a.is_agent_mode,agentImageCount:a.agent_image_count}),!z&&(0,s.jsx)(h,{originalPrompt:a.prompt,optimizedPrompt:a.optimized_prompt,isExpanded:g,onToggle:f}),(0,s.jsx)(D,{status:a.status,statusInfo:O,imageUrl:a.image_url_r2||a.image_url,imageUrls:a.image_urls,imageUrlsR2:a.image_urls_r2,errorMessage:a.error_message,createdAt:a.created_at,image:a,onEdit:j,onRegenerate:v,onDelete:void 0,onImageClick:N,onDownload:b,isDownloading:w,canEdit:C,pollingImages:u})]}),y&&(0,s.jsx)(k.Z,{isOpen:R,onClose:()=>U(!1),onConfirm:H,prompt:T||"",isDeleting:F})]})});I.displayName="ImageHistoryItem";var F=I},62413:function(e,t,a){var s=a(50313),l=a(68248),i=a(4227),r=a(63967),n=a(48907);t.Z=e=>{let{isOpen:t,onClose:a,imageUrl:o,prompt:c,onPrevious:d,onNext:m,hasPrevious:x=!1,hasNext:p=!1,currentIndex:u,totalImages:g}=e;if((0,l.useEffect)(()=>{if(!t)return;let e=e=>{switch(e.key){case"ArrowLeft":e.preventDefault(),x&&d&&d();break;case"ArrowRight":e.preventDefault(),p&&m&&m();break;case"Escape":e.preventDefault(),a()}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,x,p,d,m,a]),(0,l.useEffect)(()=>{if(!t)return;let e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[t]),!t)return null;let h=(0,s.jsxs)("div",{className:"fixed inset-0 z-[9999] bg-black/90 flex items-center justify-center p-8",onClick:a,children:[void 0!==u&&void 0!==g&&(0,s.jsxs)("div",{className:"absolute top-4 left-1/2 -translate-x-1/2 text-white/80 text-sm bg-black/50 px-3 py-1 rounded",children:[u+1," / ",g]}),x&&d&&(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),d()},className:"absolute left-4 top-1/2 -translate-y-1/2 text-white/60 hover:text-white transition-colors rounded-full p-3 z-10",children:(0,s.jsx)(r.Z,{className:"h-8 w-8"})}),(0,s.jsx)("img",{src:o,alt:c,className:"max-w-full max-h-full object-contain",onClick:e=>e.stopPropagation()}),p&&m&&(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),m()},className:"absolute right-4 top-1/2 -translate-y-1/2 text-white/60 hover:text-white transition-colors rounded-full p-3 z-10",children:(0,s.jsx)(n.Z,{className:"h-8 w-8"})}),(0,s.jsx)("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 max-w-2xl text-center text-white/80 text-sm bg-black/50 px-4 py-2 rounded overflow-hidden max-h-[4.5rem]",children:c})]});return"undefined"!=typeof document?(0,i.createPortal)(h,document.body):null}},19538:function(e,t,a){a.d(t,{OL:function(){return f},_T:function(){return x},aR:function(){return o},f$:function(){return g},fY:function(){return p},le:function(){return j},vW:function(){return c},xo:function(){return u},yT:function(){return h}});var s=a(50313),l=a(68248),i=a(19035),r=a(53045),n=a(88047);let o=i.fC,c=i.xz,d=i.h_,m=l.forwardRef((e,t)=>
1{let{className:a,...l}=e;return(0,s.jsx)(i.aV,{className:(0,r.cn)("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...l,ref:t})});m.displayName=i.aV.displayName;let x=l.forwardRef((e,t)=>{let{className:a,...l}=e;return(0,s.jsxs)(d,{children:[(0,s.jsx)(m,{}),(0,s.jsx)(i.VY,{ref:t,className:(0,r.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...l})]})});x.displayName=i.VY.displayName;let p=e=>{let{className:t,...a}=e;return(0,s.jsx)("div",{className:(0,r.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...a})};p.displayName="AlertDialogHeader";let u=e=>{let{className:t,...a}=e;return(0,s.jsx)("div",{className:(0,r.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a})};u.displayName="AlertDialogFooter";let g=l.forwardRef((e,t)=>{let{className:a,...l}=e;return(0,s.jsx)(i.Dx,{ref:t,className:(0,r.cn)("text-lg font-semibold",a),...l})});g.displayName=i.Dx.displayName;let h=l.forwardRef((e,t)=>{let{className:a,...l}=e;return(0,s.jsx)(i.dk,{ref:t,className:(0,r.cn)("text-sm text-muted-foreground",a),...l})});h.displayName=i.dk.displayName;let f=l.forwardRef((e,t)=>{let{className:a,...l}=e;return(0,s.jsx)(i.aU,{ref:t,className:(0,r.cn)((0,n.d)(),a),...l})});f.displayName=i.aU.displayName;let j=l.forwardRef((e,t)=>{let{className:a,...l}=e;return(0,s.jsx)(i.$j,{ref:t,className:(0,r.cn)((0,n.d)({variant:"outline"}),"mt-2 sm:mt-0",a),...l})});j.displayName=i.$j.displayName},71806:function(e,t,a){a.d(t,{M:function(){return d}});var s=a(50313),l=a(68248),i=a(7486),r=a(70415),n=a(78957),o=a(36942),c=a(17788);function d(e){let{isOpen:t,onClose:a,onCaptchaComplete:d,isSubmitting:m=!1,mode:x="video"}=e,p=(0,c.useTranslations)("captcha"),[u,g]=(0,l.useState)(""),[h,f]=(0,l.useState)(""),[j,v]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{t&&(g(""),f(""),v(!1))},[t]),(0,s.jsx)(r.Vq,{open:t,onOpenChange:()=>{g(""),f(""),v(!1),a()},children:(0,s.jsxs)(r.cZ,{className:"sm:max-w-md",children:[(0,s.jsxs)(r.fK,{children:[(0,s.jsxs)(r.$N,{className:"flex items-center gap-2",children:[(0,s.jsx)(n.Z,{className:"h-5 w-5 text-blue-600"}),p("title")]}),(0,s.jsx)(r.Be,{children:p("description")})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)(i.Nc,{siteKey:"0x4AAAAAABwzqT6AqNwHJZWq",onSuccess:e=>{g(e),f(""),v(!0),d(e)},onError:()=>{f(p("verificationFailed")),g(""),v(!1)},onExpire:()=>{g(""),f(p("verificationExpired")),v(!1)},options:{size:"normal",action:"image"===x?"image-generation":"video-generation",cData:"captcha-modal"}})}),j&&!m&&(0,s.jsxs)("div",{className:"text-sm text-blue-600 text-center flex items-center justify-center gap-2",children:[(0,s.jsx)(o.Z,{className:"h-4 w-4 animate-spin"}),p("verifying")]}),m&&(0,s.jsxs)("div",{className:"text-sm text-green-600 text-center flex items-center justify-center gap-2",children:[(0,s.jsx)(o.Z,{className:"h-4 w-4 animate-spin"}),"image"===x?"正在生成图片...":"正在生成视频..."]}),h&&(0,s.jsx)("div",{className:"text-sm text-red-600 text-center",children:h})]})]})})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.