1import{R as B,j as e,r}from"./react-vendor-BxoUhqX6.js";import{x as se,X as ae,a4 as ye,ah as Le,R as be,$ as Ee,ai as Me,b as Re,d as Ge,aj as Ue,ak as ze,al as Pe,j as Fe}from"./index-Bj3wZDOH.js";import{F as re}from"./film-CQRuT01c.js";import{I as le}from"./image-bMOztiYp.js";import{R as O}from"./refresh-cw-CpYBf6jm.js";import{C as je}from"./circle-alert-BpqNQ-pY.js";import{E as me}from"./external-link-TWtie5V_.js";import{M as de}from"./maximize-2-BagRUHhb.js";import{Z as te}from"./zap-CCC1ZboJ.js";import{p as qe,g as Be,d as De,e as He,f as Oe,i as We,h as _e}from"./galleryQuickApply-Dhyblwtu.js";import{P as Qe}from"./play-ERz1bixa.js";import{D as Ve}from"./download-Cmp9uDhs.js";import{F as Ke}from"./folder-open-DbfBPR5d.js";import{P as Ze}from"./plus-RhC_XDsU.js";import{getProjects as Je,createPage as Xe}from"./jsonSchemaService-Dfce1dPF.js";import"./clsx-B-dksMZM.js";import"./i18n-vendor-Coo-X0AG.js";import"./projectSiteUrl-C78QyB4X.js";const Ye={video:{icon:re,title:"è§é¢åæç»å»",subtitle:"æ¢ç´¢ç¤¾åºææ°ç AI è§é¢ä½åï¼ä¸é®åºç¨å款é
ç½®",gradient:"from-indigo-600/8 via-purple-500/5 to-transparent",iconColor:"text-indigo-500",accentBg:"bg-indigo-500/10"},image:{icon:le,title:"å¾çåæç»å»",subtitle:"åç°ç²¾å½©ç AI ç»å¾ä½åï¼è·åçµæä¸æç¤ºè¯",gradient:"from-emerald-600/8 via-teal-500/5 to-transparent",iconColor:"text-emerald-500",accentBg:"bg-emerald-500/10"},workflow:{icon:se,title:"工使µç²¾é",subtitle:"ç²¾é工使µäº§åºçåæä½åï¼è§é¢ä¸å¾çæ··åå±ç¤º",gradient:"from-amber-600/8 via-orange-500/5 to-transparent",iconColor:"text-amber-500",accentBg:"bg-amber-500/10"}},et=({tab:t,totalCount:a})=>{const s=Ye[t],l=s.icon;return e.jsxs("div",{className:`relative rounded-2xl bg-gradient-to-br ${s.gradient} border border-gray-100/60 px-6 py-7 mb-6 overflow-hidden`,children:[e.jsx("div",{className:`absolute -top-12 -right-12 w-40 h-40 rounded-full ${s.accentBg} opacity-40`}),e.jsx("div",{className:`absolute -bottom-8 -left-8 w-28 h-28 rounded-full ${s.accentBg} opacity-20`}),e.jsxs("div",{className:"relative z-10 flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("div",{className:`w-10 h-10 rounded-xl ${s.accentBg} flex items-center justify-center`,children:e.jsx(l,{className:`w-5 h-5 ${s.iconColor}`})}),e.jsx("h1",{className:"text-xl font-bold text-gray-900",children:s.title})]}),e.jsx("p",{className:"text-sm text-gray-500 ml-[52px]",children:s.subtitle})]}),typeof a=="number"&&a>0&&e.jsxs("div",{className:"text-right shrink-0 ml-4",children:[e.jsx("div",{className:"text-2xl font-bold text-gray-900 tabular-nums",children:a.toLocaleString()}),e.jsx("div",{className:"text-[11px] text-gray-400 mt-0.5",children:"ä»¶ä½å"})]})]})]})},tt=B.memo(et),st=[{id:"video",label:"è§é¢",icon:re},{id:"image",label:"å¾ç",icon:le},{id:"workflow",label:"工使µ",icon:se}],at=({tab:t,onTabChange:a,tags:s,selectedTags:l,onTagToggle:c,onClearTags:i,tagsLoading:m,onRefresh:x,refreshing:u,showTabs:d=!0,showRefresh:p=!0})=>e.jsxs("div",{className:"mb-6 space-y-3",children:[d?e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-1 rounded-xl bg-gray-100 p-1",children:st.map(({id:h,label:g,icon:v})=>e.jsxs("button",{onClick:()=>a(h),className:`flex items-center gap-1.5 px-4 py-2 text-sm font-medium rounded-lg transition-colors ${t===h?"bg-white text-gray-900 shadow-sm":"text-gray-500 hover:text-gray-700"}`,children:[e.jsx(v,{className:"w-4 h-4"}),g]},h))}),p?e.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 px-3.5 py-2 text-sm font-medium text-gray-600 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 shadow-sm transition-colors",children:[e.jsx(O,{className:`w-3.5 h-3.5 ${u?"animate-spin":""}`}),"å·æ°"]}):null]}):p?e.jsx("div",{className:"flex justify-end",children:e.jsxs("button",{onClick:x,className:"flex items-center gap-1.5 px-3.5 py-2 text-sm font-medium text-gray-600 bg-white border border-gray-200 rounded-lg hover:bg-gray-50 shadow-sm transition-colors",children:[e.jsx(O,{className:`w-3.5 h-3.5 ${u?"animate-spin":""}`}),"å·æ°"]})}
1):null,s.length>0&&e.jsxs("div",{className:"flex items-center gap-2 overflow-x-auto pb-1 scrollbar-thin",children:[l.length>0&&e.jsxs("button",{onClick:i,className:"shrink-0 inline-flex items-center gap-1 px-3 py-1.5 text-xs font-medium rounded-full bg-red-50 text-red-500 border border-red-100 hover:bg-red-100 transition-colors",children:[e.jsx(ae,{className:"w-3 h-3"}),"æ¸
é¤"]}),s.slice(0,30).map(({tag:h,count:g})=>{const v=l.includes(h);return e.jsxs("button",{onClick:()=>c(h),className:`shrink-0 px-3 py-1.5 text-xs font-medium rounded-full border transition-colors ${v?"bg-indigo-500 text-white border-indigo-500 shadow-sm":"bg-white text-gray-600 border-gray-200 hover:border-indigo-300 hover:text-indigo-600"}`,children:[h,e.jsx("span",{className:`ml-1 text-[10px] ${v?"text-indigo-200":"text-gray-400"}`,children:g})]},h)}),m&&e.jsx(O,{className:"w-3.5 h-3.5 animate-spin text-gray-400 shrink-0"})]})]}),rt=B.memo(at);function Y({mediaType:t,urls:a,loaded:s=!0,onLoad:l,className:c="",countLabel:i}){const x=a.length>1,u=a[0];return u?e.jsxs("div",{className:`relative w-full overflow-hidden bg-gray-900 ${c}`,children:[t==="video"&&!x?e.jsx("video",{className:"w-full object-contain pointer-events-none",preload:"metadata",src:`${u}#t=0.1`,muted:!0,playsInline:!0}):t==="video"&&x?e.jsxs("div",{className:"aspect-video relative w-full",children:[a.length>=3&&e.jsx("video",{className:"absolute inset-0 w-[92%] h-[92%] object-cover rounded-md opacity-40",style:{top:2,left:2},preload:"metadata",src:`${a[2]}#t=0.1`,muted:!0,playsInline:!0}),a.length>=2&&e.jsx("video",{className:"absolute inset-0 w-[96%] h-[96%] object-cover rounded-md opacity-60",style:{to
1p:1,left:1},preload:"metadata",src:`${a[1]}#t=0.1`,muted:!0,playsInline:!0}),e.jsx("video",{className:"relative w-full h-full object-cover",preload:"metadata",src:`${u}#t=0.1`,muted:!0,playsInline:!0})]}):x?e.jsxs("div",{className:"aspect-square relative w-full",children:[a.length>=3&&e.jsx("img",{src:a[2],alt:"",className:"absolute inset-0 w-[92%] h-[92%] object-cover rounded-md opacity-40",style:{top:2,left:2},loading:"lazy"}),a.length>=2&&e.jsx("img",{src:a[1],alt:"",className:"absolute inset-0 w-[96%] h-[96%] object-cover rounded-md opacity-60",style:{top:1,left:1},loading:"lazy"}),e.jsx("img",{src:u,alt:"",className:`relative w-full h-full object-cover ${s?"":"absolute inset-0"}`,loading:"lazy",onLoad:l})]}):e.jsxs(e.Fragment,{children:[!s&&e.jsx("div",{className:"aspect-square bg-gray-100 animate-pulse"}),e.jsx("img",{src:u,alt:"",className:`w-full object-cover ${s?"":"absolute inset-0"}`,loading:"lazy",onLoad:l})]}),x&&i?e.jsx("span",{className:"absolute top-2.5 right-2.5 text-[10px] px-1.5 py-0.5 rounded-md bg-black/60 text-white font-medium",children:i}):null,t==="video"&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/5 pointer-events-none",children:e.jsx("div",{className:"w-12 h-12 rounded-full bg-white/90 flex items-center justify-center shadow-lg",children:e.jsx(Qe,{className:"w-5 h-5 text-gray-800 ml-0.5",fill:"currentColor"})})})]}):e.jsx("div",{className:`aspect-video bg-gradient-to-br from-gray-100 to-gray-200 flex items-center justify-center ${c}`,children:t==="video"?e.jsx(re,{className:"w-7 h-7 text-gray-300"}):e.jsx(le,{className:"w-7 h-7 text-gray-300"})})}const lt=({item:t,applyingId:a,onPreview:s,onQuickApply:l,onInsertToProject:c,onNavigate:i})=>{const m=r.useRef(null),x=r.useRef(null),[u,d]=r.useState(!1),[p,h]=r.useState(!1),[g,v]=r.useState(!1),[b,k]=r.useState(!1);r.useEffect(()=>{const T=m.current;if(!T)return;const E=new IntersectionObserver(([U])=>{U.isIntersecting&&(d(!0),E.disconnect())},{rootMargin:"200px"});return E.observe(T),()=>E.disconnect()},[]),r.useCallback(()=>{h(!0),requestAnimationFrame(()=>{x.current?.play().catch(()=>{})})},[]);let n={};if(t.metadata)try{n=typeof t.metadata=="string"?JSON.parse(t.metadata):t.metadata}catch{}const f=[];n.imageUrl&&(Array.isArray(n.imageUrl)?f.push(...n.imageUrl):typeof n.imageUrl=="string"&&f.push(n.imageUrl));const w=!!(t.sourceTemplateId&&t.mediaType==="image"&&!t.action&&n.category==="workflow"),C=typeof n.templateName=="string"?n.templateName.trim():t.provider?.trim()||"",L=w?"":t.provider||t.model||"",G=w?"":t.mediaType==="video"?t.taskType||"":t.action==="process"?"å¾çç¼è¾":"æçå¾",y=a===t.id,N=qe(t),I=N.length,D=I>1?t.mediaType==="video"?`${I} 个è§é¢`:`${I} å¼ `:void 0;return e.jsxs("div",{className:"break-inside-avoid mb-5 w-full rounded-2xl overflow-hidden border border-gray-100 bg-white shadow-sm hover:shadow-md hover:-translate-y-0.5 group",style:{transition:"box-shadow .2s, transform .2s"},children:[e.jsx("div",{ref:m,className:"relative bg-gray-900 overflow-hidden",children:t.mediaType==="video"?p?e.jsxs("div",{className:"relative",children:[e.jsx("video",{ref:x,className:"w-full object-contain",controls:!0,autoPlay:!0,preload:"auto",src:N[0]||t.mediaUrl}),e.jsx("button",{onClick:()=>s(t),className:"absolute top-2.5 right-2.5 p-1.5 rounded-lg bg-black/50 text-white/80 hover:text-white opacity-0 group-hover:opacity-100",style:{transition:"opacity .15s"},title:"å
¨å±é¢è§",children:e.jsx(de,{className:"w-4 h-4"})})]}):u?e.jsxs("div",{className:"relative cursor-pointer",onClick:()=>s(t),children:[e.jsx(Y,{mediaType:"video",urls:N,countLabel:D}),e.jsx("button",{onClick:T=>{T.stopPropagation(),s(t)},className:"absolute top-2.5 right-2.5 p-1.5 rounded-lg bg-black/50 text-white/80 hover:text-white opacity-0 group-hover:opacity-100 z-10",style:{transition:"opacity .15s"},title:"å
¨å±é¢è§",children:e.jsx(de,{className:"w-4 h-4"})})]}):e.jsx(Y,{mediaType:"video",urls:[]}):e.jsx("div",{className:"relative cursor-pointer",onClick:()=>s(t),children:u?e.jsxs(e.Fragment,{children:[e.jsx(Y,{mediaType:"image",urls:N,loaded:b,onLoad:()=>k(!0),countLabel:D}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/30 via-trans
1parent to-transparent opacity-0 group-hover:opacity-100 pointer-events-none",style:{transition:"opacity .2s"}}),e.jsx("button",{onClick:T=>{T.stopPropagation(),s(t)},className:"absolute top-2.5 right-2.5 p-1.5 rounded-lg bg-black/50 text-white/80 hover:text-white opacity-0 group-hover:opacity-100 z-10",style:{transition:"opacity .15s"},title:"å
¨å±é¢è§",children:e.jsx(de,{className:"w-4 h-4"})})]}):e.jsx(Y,{mediaType:"image",urls:[]})})}),e.jsxs("div",{className:"p-4",children:[(L||G)&&e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[L&&e.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold bg-indigo-50 text-indigo-600 rounded-full border border-indigo-100/80",children:L}),G&&e.jsx("span",{className:"px-2 py-0.5 text-[10px] font-semibold bg-gray-50 text-gray-500 rounded-full border border-gray-100/80",children:G})]}),e.jsxs("div",{className:"relative",children:[w&&C&&e.jsx("h3",{className:"mb-1.5 line-clamp-2 text-base font-bold leading-snug text-gray-900",children:C}),e.jsx("p",{className:`text-[13px] text-gray-700 leading-relaxed ${g?"":"line-clamp-2"}`,children:t.prompt||"ææ æç¤ºè¯æè¿°"}),t.prompt&&t.prompt.length>50&&e.jsx("button",{onClick:()=>v(!g),className:"text-[11px] text-indigo-500 hover:text-indigo-700 mt-0.5 font-medium select-none",children:g?"æ¶èµ·":"å±å¼"})]}),f.length>0&&e.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[f.slice(0,4).map((T,E)=>e.jsx("div",{className:"w-10 h-10 rounded-lg overflow-hidden border border-gray-100 shadow-sm shrink-0",children:e.jsx("img",{src:T,alt:`åèå¾ ${E+1}`,className:"w-full h-full object-cover"})},E)),f.length>4&&e.jsxs("div",{className:"w-10 h-10 rounded-lg bg-gray-50 border border-gray-100 flex items-center justify-center text-[10px] text-gray-400 font-medium",children:["+",f.length-4]})]}),t.sourceTemplateId&&(l||c)&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-50 space-y-1.5",children:[l&&e.jsxs("button",{onClick:()=>l(t),disabled:y,className:"w-full flex items-center justify-center gap-1.5 px-3 py-2 text-xs font-semibold rounded-xl bg-gradient-to-r from-emerald-500 to-teal-500 text-white hover:from-emerald-600 hover:to-teal-600 disabled:opacity-50 shadow-sm",style:{transition:"opacity .15s"},children:[e.jsx(te,{className:`w-3.5 h-3.5 ${y?"animate-spin":""}`}),y?"æ£å¨æå¼â¦":"ä¸é®ä½¿ç¨"]}),c&&e.jsxs("button",{onClick:()=>c(t),className:"w-full flex items-center justify-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-xl border border-gray-200 text-gray-600 hover:border-indigo-300 hover:text-indigo-600 hover:bg-indigo-50/50",style:{transition:"border-color .15s, color .15s, background .15s"},children:[e.jsx(ye,{className:"w-3.5 h-3.5"}),"æå
¥å°æç项ç®"]})]}),e.jsxs("div",{className:`${t.sourceTemplateId&&l?"mt-2":"mt-3 pt-3 border-t border-gray-50"} flex items-center justify-between gap-2`,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0 text-[11px] text-gray-400",children:[t.author&&e.jsxs("a",{href:`/author/${t.author.id}`,className:"flex items-center gap-1 hover:text-indigo-500 shrink-0",style:{transition:"color .15s"},children:[t.author.avatar?e.jsx("img",{src:t.author.avatar,alt:"",className:"w-4.5 h-4.5 rounded-full object-cover"}):e.jsx("div",{className:"w-4.5 h-4.5 rounded-full bg-gradient-to-br from-indigo-400 to-purple-500 flex items-center justify-center",children:e.jsx("span",{className:"text-[7px] text-white font-bold",children:t.author.name?.[0]||"?"})}),e.jsx("span",{className:"truncate max-w-[64px]",children:t.author.name})]}),e.jsx("span",{className:"shrink-0 text-gray-300",children:new Date(t.createdAt).toLocaleDateString("zh-CN").replace(/\//g,"-")})]}),t.projectId&&i&&e.jsxs("button",{onClick:()=>i(t.projectId),className:"inline-flex items-center gap-0.5 text-[11px] text-indigo-400 hover:text-indigo-600 font-medium shrink-0",style:{transition:"color .15s"},children:["工使µ ",e.jsx(me,{className:"w-3 h-3"})]})]})]})]})},nt=B.memo(lt),ot=({item:t,onClose:a,onNavigate:s,onQuickApply:l,onInsertToProject:c,applyingId:i})=>{const m=r.useRef(null),[x,u]=r.useState(0),d=Be(t),p=d.length>1,h=d[x]??d[0],g=h?.mediaUrl||t.mediaUrl;let v={};
1if(t.metadata)try{v=typeof t.metadata=="string"?JSON.parse(t.metadata):t.metadata}catch{v={}}r.useEffect(()=>{u(0)},[t.id]),r.useEffect(()=>{const y=N=>{N.key==="Escape"&&a(),p&&(N.key==="ArrowLeft"&&u(I=>Math.max(0,I-1)),N.key==="ArrowRight"&&u(I=>Math.min(d.length-1,I+1)))};return document.addEventListener("keydown",y),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",y),document.body.style.overflow=""}},[a,p,d.length,t.id]);const b=!!(t.sourceTemplateId&&t.mediaType==="image"&&!t.action&&v.category==="workflow"),k=typeof v.templateName=="string"?v.templateName.trim():t.provider?.trim()||"",n=b?"":t.provider||t.model||"",f=b?"":t.mediaType==="video"?t.taskType||"":t.action==="process"?"å¾çç¼è¾":"æçå¾",w=i===t.id,C=h?.sceneIndex!=null?`åºæ¯ ${h.sceneIndex+1}`:p?`第 ${x+1} æ¡`:null,L=()=>u(y=>Math.max(0,y-1)),G=()=>u(y=>Math.min(d.length-1,y+1));return e.jsx("div",{ref:m,className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/80",onClick:y=>{y.target===m.current&&a()},children:e.jsxs("div",{className:"relative w-full max-w-4xl mx-4 max-h-[90vh] flex flex-col bg-gray-900 rounded-2xl overflow-hidden shadow-2xl",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-white/10 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap min-w-0",children:[b&&k&&e.jsx("span",{className:"max-w-[60vw] truncate text-sm font-semibold text-white sm:max-w-[28rem]",children:k}),n&&e.jsx("span",{className:"px-2.5 py-0.5 text-[11px] font-semibold bg-indigo-500/20 text-indigo-300 rounded-full",children:n}),f&&e.jsx("span",{className:"px-2.5 py-0.5 text-[11px] font-semibold bg-white/10 text-gray-300 rounded-full",children:f}),p&&e.jsxs("span",{className:"text-[11px] text-gray-400",children:[x+1," / ",d.length,C?` · ${C}`:""]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("a",{href:g,download:!0,target:"_blank",rel:"noopener noreferrer",className:"p-2 text-gray-400 hover:text-white rounded-lg hover:bg-white/10",style:{transition:"color .15s, background .15s"},title:t.mediaType==="video"?"ä¸è½½å½åè§é¢":"ä¸è½½å½åå¾ç",children:e.jsx(Ve,{className:"w-5 h-5"})}),e.jsx("button",{type:"button",onClick:a,className:"inline-flex items-center justify-center p-2 text-gray-400 hover:text-white rounded-lg hover:bg-white/10",style:{transition:"color .15s, background .15s"},title:"å
³é",children:e.jsx(ae,{className:"w-5 h-5"})})]})]}),e.jsxs("div",{className:"flex-1 flex items-center justify-center bg-black min-h-0 relative",children:[t.mediaType==="video"?e.jsx("video",{className:"w-full max-h-[60vh] object-contain",controls:!0,autoPlay:!0,preload:"auto",src:g},g):e.jsx("img",{src:g,alt:h?.prompt||t.prompt,className:"max-w-full max-h-[60vh] object-contain"},g),p&&x>0&&e.jsx("button",{type:"button",onClick:L,className:"absolute left-3 top-1/2 -translate-y-1/2 w-10 h-10 rounded-full bg-black/50 text-white flex items-center justify-center hover:bg-black/70",style:{transition:"background .15s"},"aria-label":"ä¸ä¸æ¡",children:e.jsx(Le,{className:"w-5 h-5"})}),p&&x<d.length-1&&e.jsx("button",{type:"button",onClick:G,className:"absolute right-3 top-1/2 -translate-y-1/2 w-10 h-10 rounded-full bg-black/50 text-white flex items-center justify-center hover:bg-black/70",style:{transition:"background .15s"},"aria-label":"ä¸ä¸æ¡",children:e.jsx(be,{className:"w-5 h-5"})})]}),p&&e.jsx("div",{className:"shrink-0 px-4 py-2 border-t border-white/10 bg-black/40 overflow-x-auto",children:e.jsx("div",{className:"flex gap-2 min-w-min",children:d.map((y,N)=>{const I=N===x;return e.jsxs("button",{type:"button",onClick:()=>u(N),className:`relative shrink-0 w-20 h-14 rounded-lg overflow-hidden border-2 ${I?"border-indigo-400 ring-1 ring-indigo-400/50":"border-white/15 opacity-70 hover:opacity-100"}`,style:{transition:"opacity .15s, border-color .15s"},title:y.sceneIndex!=null?`åºæ¯ ${y.sceneIndex+1}`:`第 ${N+1} æ¡`,children:[t.mediaType==="video"?e.jsx("video",{className:"w-full h-full object-cover pointer-events-none",src:`${y.mediaUrl}
1#t=0.1`,muted:!0,playsInline:!0,preload:"metadata"}):e.jsx("img",{src:y.mediaUrl,alt:"",className:"w-full h-full object-cover"}),e.jsx("span",{className:"absolute bottom-0 inset-x-0 text-[9px] text-center bg-black/60 text-white py-0.5",children:y.sceneIndex!=null?y.sceneIndex+1:N+1})]},y.id)})})}),e.jsxs("div",{className:"px-5 py-4 border-t border-white/10 space-y-3 shrink-0",children:[e.jsx("p",{className:"text-sm text-gray-200 leading-relaxed",children:h?.prompt||t.prompt||"ææ æç¤ºè¯æè¿°"}),t.sourceTemplateId&&(l||c)&&e.jsxs("div",{className:"flex gap-2",children:[l&&e.jsxs("button",{type:"button",onClick:()=>l(t),disabled:w,className:"flex-1 flex items-center justify-center gap-2 px-4 py-2.5 text-sm font-semibold rounded-xl bg-gradient-to-r from-emerald-500 to-teal-500 text-white hover:from-emerald-600 hover:to-teal-600 disabled:opacity-50 shadow-lg",style:{transition:"opacity .15s"},children:[e.jsx(te,{className:`w-4 h-4 ${w?"animate-spin":""}`}),w?"æ£å¨æå¼â¦":"ä¸é®ä½¿ç¨"]}),c&&e.jsxs("button",{type:"button",onClick:()=>c(t),className:"flex-1 flex items-center justify-center gap-2 px-4 py-2.5 text-sm font-medium rounded-xl border border-white/20 text-gray-200 hover:bg-white/10 hover:text-white",style:{transition:"background .15s, color .15s"},children:[e.jsx(ye,{className:"w-4 h-4"}),"æå
¥å°é¡¹ç®"]})]}),e.jsxs("div",{className:"text-[11px] text-gray-500 flex items-center justify-between gap-2",children:[e.jsx("span",{children:h?.createdAt?new Date(h.createdAt).toLocaleString("zh-CN",{hour12:!1}).replace(/\//g,"-"):new Date(t.createdAt).toLocaleString("zh-CN",{hour12:!1}).replace(/\//g,"-")}),(h?.projectId||t.projectId)&&s&&e.jsxs("button",{type:"button",onClick:()=>{a(),s(h?.projectId||t.projectId)},className:"inline-flex items-center gap-1 text-indigo-400 hover:text-indigo-300 font-medium shrink-0",style:{transition:"color .15s"},children:[C?`æå¼${C}`:"æ¥ç工使µ",e.jsx(me,{className:"w-3 h-3"})]})]})]})]})})},it=B.memo(ot),ct=({isVideo:t})=>e.jsxs("div",{className:"break-inside-avoid mb-5 w-full rounded-2xl overflow-hidden border border-gray-100 bg-white",children:[e.jsx("div",{className:`bg-gray-100 animate-pulse ${t?"aspect-video":"aspect-square"}`}),e.jsxs("div",{className:"p-4 space-y-2.5",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"w-14 h-5 rounded-full bg-gray-100 animate-pulse"}),e.jsx("div",{className:"w-10 h-5 rounded-full bg-gray-100 animate-pulse"})]}),e.jsx("div",{className:"h-4 w-full rounded bg-gray-100 animate-pulse"}),e.jsx("div",{className:"h-4 w-3/4 rounded bg-gray-100 animate-pulse"}),e.jsxs("div",{className:"flex justify-between pt-2 border-t border-gray-50",children:[e.jsx("div",{className:"h-3 w-20 rounded bg-gray-50 animate-pulse"}),e.jsx("div",{className:"h-6 w-14 rounded-lg bg-gray-50 animate-pulse"})]})]})]}),dt=({count:t=8,mediaType:a="image"})=>{const s=a==="video";return e.jsx(e.Fragment,{children:Array.from({length:t},(l,c)=>e.jsx(ct,{isVideo:s},c))})},mt=B.memo(dt),ut=({item:t,applying:a,createdProject:s,createdProjectUrl:l,seeded:c=!0,onClose:i,onConfirm:m})=>{const x=De(t),[u,d]=r.useState(x),p=r.useRef(null),h=r.useRef(null);r.useEffect(()=>{d(x)},[x,t.id]),r.useEffect(()=>{const k=f=>{f.key==="Escape"&&!a&&i()};document.addEventListener("keydown",k),document.body.style.overflow="hidden";const n=s?void 0:window.setTimeout(()=>{p.current?.focus(),p.current?.select()},50);return()=>{document.removeEventListener("keydown",k),document.body.style.overflow="",n&&window.clearTimeout(n)}},[i,a,t.id,s]);const g=r.useCallback(k=>{k?.preventDefault();const n=u.trim();!n||a||m(n)},[u,a,m]),v=t.mediaType==="video"?"è§é¢æç¤ºè¯ä¸æç":"å¾çæç¤ºè¯ä¸çæç»æ",b=s?`/json-builder/${s.id}`:"";return e.jsx("div",{ref:h,className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/60 px-4",onClick:k=>{k.target===h.current&&!a&&i()},children:e.jsxs("div",{className:"w-full max-w-md bg-white rounded-2xl shadow-2xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-start justify-between px-5 py-4 border-b border-gray-100",children:[e.jsxs("div",{className:"min-w-0 pr-3",children:[e.jsxs("h3",{className:"text-base font-bold text-gray-900 flex items-center gap-2",children:[s?e.jsx(Ee,{className:"w-4 h-4 text-emerald-500 shrink-0"}):e.jsx(te,{className:"w-4 h-4 text-emerald-500 shrink-0"}),s?"项ç®å·²å建":"ä¸é®ä½¿ç¨"]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 leading-relaxed",children:s?"å¦ææ°æ ç¾é¡µæ²¡æèªå¨æå¼ï¼å¯ä»¥ä»è¿éç»§ç»è®¿é®æç¼è¾ã":`å°å¤å¶æ¨¡æ¿åå»ºä½ çç«ç¹ï¼å¹¶èªå¨å¯¼å
¥${v}ï¼æå¼åå¯ç´æ¥ç»§ç»ç¼è¾ã`})]}),e.jsx("button",{type:"button",onClick:i,disabled:a,className:"p-1.5 text-gray-400 hover:text-gray-600 rounded-lg hover:bg-gray-100 disabled:opacity-40",style:{transition:"color .15s, background .15s"},children:e.jsx(ae,{className:"w-5 h-5"})})]}),s?e.jsxs("div",{className:"px-5 py-4 space-y-4",children:[e.jsxs("div",{className:"rounded-xl border border-emerald-100 bg-emerald-50 px-4 py-3",children:[e.jsx("p",{className:"text-sm font-semibold text-gray-900 truncate",children:s.name}),s.slug&&e.jsx("p",{className:"mt-1 text-xs text-emerald-700 truncate",children:s.slug}),!c&&e.jsx("p",{className:"mt-2 text-xs text-amber-700",children:"项ç®å·²å建ï¼ä½åæ¬¾æ°æ®æ²¡æå®å
¨åæ¥ï¼è¿å
¥ç¼è¾å¨å坿å¨è¡¥å
æç¤ºè¯ã"})]}),e.jsxs("div",{className:`grid gap-2 ${l?"grid-cols-2":"grid-cols-1"}`,children:[l&&e.jsxs("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center gap-1.5 rounded-xl bg-emerald-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-emerald-600",style:{transition:"background .15s"},children:[e.jsx(me,{className:"w-4 h-4"}),"æå¼ç«ç¹"]}),e.jsxs("a",{href:b,className:"inline-flex items-center justify-center gap-1.5 rounded-xl border border-gray-200 px-4 py-2.5 text-sm font-semibold text-gray-700 hover:bg-gray-50",style:{transition:"background .15s"},children:[e.jsx(Me,{className:"w-4 h-4"}),"ç»§ç»ç¼è¾"]})]}),e.jsx("button",{type:"button",onClick:i,className:"w-full rounded-xl px-4 py-2 text-sm font-medium text-gray-500 hover:bg-gray-50",style:{transition:"background .15s"},children:"å
³é"})]}):e.jsxs("form",{onSubmit:g,className:"px-5 py-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"gallery-quick-apply-name",className:"block text-sm font-medium text-gray-700 mb-1.5",children:"项ç®åç§°"}),e.jsx("input",{id:"gallery-quick-apply-name",ref:p,type:"text",value:u,onChange:k=>d(k.target.value),maxLength:60,disabled:a,placeholder:"ç»ä½ çç«ç¹èµ·ä¸ªåå",className:"w-full px-3 py-2.5 text-sm border border-gray-200 rounded-xl focus:outline-none focus:ring-2 focus:ring-emerald-500/30 focus:border-emerald-400 disabled:bg-gray-50"}),e.jsxs("p",{className:"mt-1.5 text-[11px] text-gray-400 flex items-start gap-1",children:[e.jsx(se,{className:"w-3 h-3 mt-0.5 shrink-0 text-emerald-500"}),e.jsx("span",{children:"å·²æ ¹æ®ä½åæºè½å¡«å
åç§°ï¼è¥ä¸å·²æé¡¹ç®éåï¼å°èªå¨è¿½å éæºåç¼ã"})]})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx("button",{type:"button",onClick:i,disabled:a,className:"flex-1 px-4 py-2.5 text-sm font-medium rounded-xl border border-gray-200 text-gray-600 hover:bg-gray-50 disabled:opacity-50",style:{transition:"background .15s"},children:"åæ¶"}),e.jsxs("button",{type:"submit",disabled:a||!u.trim(),className:"flex-1 flex items-center justify-center gap-1.5 px-4 py-2.5 text-sm font-semibold rounded-xl bg-gradient-to-r from-emerald-500 to-teal-500 text-white hover:from-emerald-600 hover:to-teal-600 disabled:opacity-50",style:{transition:"opacity .15s"},children:[e.jsx(te,{className:`w-4 h-4 ${a?"animate-spin":""}`}),a?"æ£å¨å建â¦":"å建并æå¼"]})]})]})]})})},xt=({sourceTemplateId:t,label:a,userId:s,onClose:l,onSuccess:c})=>{const[i,m]=r.useState([]),[x,u]=r.useState(!0),[d,p]=r.useState(null),[h,g]=r.useState(null),v=B.useRef(null),b=r.useCallback(async()=>{u(!0),p(null);try{const f=(await Je(s)).filter(w=>w.status!=="archived").sort((w,C)=>new Date(C.updatedAt).getTime()-new Date(w.updatedAt).getTime());m(f)}catch(n){p(n.message||"è·å项ç®å表失败")}finally{u(!1)}},[s]);r.useEffect(()=>{b()},[b]),r.useEffect(()=>{const n=f=>{f.key==="Escape"&&l()};return document.addEventListener("keydown",n),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",n),document.body.style.overflow=""}},[l]);const k=r.useCallback(async n=>{try{g(n.id);const f=`/${t.slice(0,8)}-${Date.now().toString(36)}`,w=a?`${a}`.slice(0,40):"ç»å»å¯¼å
¥é¡µ";await Xe(n.id,f,w,void 0,t),c(n,f)}catch(f){p(f.message||"æå
¥å¤±è´¥ï¼è¯·éè¯"),g(null)}},[t,a,c]);return e.jsx("div",{ref:v,className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/60",onClick:n=>{n.target===v.current&&l()},children:e.jsxs("div",{className:"w-full max-w-md mx-4 bg-white rounded-2xl shadow-2xl overflow-hidden flex flex-col max-h-[80vh]",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-base font-bold text-gray-900",children:"æå
¥å°æç项ç®"}),e.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:"éæ©ä¸ä¸ªé¡¹ç®ï¼æ¨¡æ¿å°ä½ä¸ºæ°é¡µé¢æ·»å "})]}),e.jsx("button",{onClick:l,className:"p-1.5 text-gray-400 hover:text-gray-600 rounded-lg hover:bg-gray-100",style:{transition:"color .15s, background .15s"},children:e.jsx(ae,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto px-2 py-2 min-h-0",children:x?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-400",children:[e.jsx(O,{className:"w-6 h-6 animate-spin mb
1-3"}),e.jsx("p",{className:"text-sm",children:"å 载项ç®å表â¦"})]}):d?e.jsxs("div",{className:"flex items-start gap-2 px-3 py-3 bg-red-50 rounded-xl mx-2 my-4",children:[e.jsx(je,{className:"w-4 h-4 text-red-500 mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-red-700",children:d}),e.jsx("button",{onClick:b,className:"text-xs text-red-500 hover:text-red-700 mt-1 font-medium",children:"éè¯"})]})]}):i.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-gray-400",children:[e.jsx(Ke,{className:"w-10 h-10 mb-3 text-gray-300"}),e.jsx("p",{className:"text-sm font-medium text-gray-500",children:"è¿æ²¡æé¡¹ç®"}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"建议å
ãä¸é®ä½¿ç¨ãå建并æå¼ç«ç¹"})]}):e.jsx("div",{className:"space-y-1",children:i.slice(0,20).map(n=>{const f=h===n.id,w=n.pages?.length||0;return e.jsxs("button",{onClick:()=>k(n),disabled:!!h,className:"w-full flex items-center gap-3 px-3 py-3 rounded-xl text-left hover:bg-indigo-50 disabled:opacity-50 group",style:{transition:"background .15s"},children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-indigo-50 group-hover:bg-indigo-100 flex items-center justify-center shrink-0",style:{transition:"background .15s"},children:f?e.jsx(O,{className:"w-4 h-4 text-indigo-500 animate-spin"}):e.jsx(Ze,{className:"w-4 h-4 text-indigo-500"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm font-medium text-gray-900 truncate",children:n.name}),e.jsxs("div",{className:"text-[11px] text-gray-400 mt-0.5 flex items-center gap-2",children:[e.jsxs("span",{children:[w," 页"]}),e.jsx("span",{children:"·"}),e.jsx("span",{children:new Date(n.updatedAt).toLocaleDateString("zh-CN").replace(/\//g,"-")})]})]}),e.jsx(be,{className:"w-4 h-4 text-gray-300 group-hover:text-indigo-400 shrink-0",style:{transition:"color .15s"}})]},n.id)})})})]})})},ht=B.memo(xt);function gt(t){return{id:t.id,mediaType:"video",mediaUrl:t.videoUrl,coverUrl:t.coverUrl,prompt:t.prompt,provider:t.provider,taskType:t.taskType,projectId:t.projectId,sourceTemplateId:t.sourceTemplateId,createdAt:t.createdAt,metadata:t.metadata,author:t.author}}function pt(t){return{id:t.id,mediaType:"image",mediaUrl:t.imageUrl,imageUrls:t.imageUrls,prompt:t.prompt,model:t.model,action:t.action,projectId:t.projectId,sourceTemplateId:t.sourceTemplateId,createdAt:t.createdAt,metadata:t.metadata,author:t.author}}const ee=20;function ft(){return{video:{items:[],rawItems:[],hasMore:!0,rawLen:0},image:{items:[],rawItems:[],hasMore:!0,rawLen:0},workflow:{items:[],rawItems:[],hasMore:!0,rawLen:0}}}function yt(t={}){const{tab:a,onTabChange:s,initialLoad:l=!0,quickApplySourceLabel:c="ç»å»"}=t,{i18n:i}=Re(),m=Ge(o=>o.user),[x,u]=r.useState("video"),d=a??x,p=a!==void 0,[h,g]=r.useState([]),[v,b]=r.useState(!0),[k,n]=r.useState(l),[f,w]=r.useState(null),[C,L]=r.useState(null),[G,y]=r.useState(null),[N,I]=r.useState(null),[D,T]=r.useState(null),[E,U]=r.useState(null),[K,W]=r.useState([]),[Z,_]=r.useState([]),[ne,J]=r.useState(!1),z=r.useRef(!1),P=r.useRef(d),H=r.useRef(null),F=r.useRef(ft()),ue=r.useCallback(async o=>{J(!0);try{if(o==="workflow"){const j=await fe(i.language);W(vt(j))}else{const j=await Ue(o);j.success&&j.data?.tags&&W(j.data.tags)}}catch{}J(!1)},[i.language]),M=r.useCallback(async(o,j=!1,$)=>{if(z.current&&!j)return;j&&H.current&&H.current.abort();const A=new AbortController;H.current=A,z.current=!0,n(!0),w(null);const q=$??Z,X=F.current[o],oe=j?0:X.rawLen;try{let R=[],Q=0;if(o==="video"){const S=await ze(oe,ee,q.length>0?q:void 0);if(A.signal.aborted)return;if(!S.success||!S.data?.gallery)throw new Error(S.error||"è·åè§é¢ç»å»å¤±è´¥");Q=S.data.gallery.length,R=S.data.gallery.map(gt)}else if(o==="image"){const S=await Pe(oe,ee,q.length>0?q:void 0);if(A.signal.aborted)return;if(!S.success||!S.data?.gallery)throw new Error(S.error||"è·åå¾çç»å»å¤±è´¥");Q=S.data.gallery.length,R=S.data.gallery.map(pt)}else{const S=await fe(i.language);if(A.signal.aborted)return;const{page:ge,hasMore:pe}=wt(S,oe,ee,q);if(Q=ge.length,R=ge.map(bt),A.signal.aborted)return;const ce=j?R:[...X.rawItems,...R];F.current[o]={items:ce,rawItems:ce,hasMore:pe,rawLen:(j?0:X.rawLen)+Q},o===P.current&&(g(ce),b(pe));return}if(A.signal.aborted)return;const ie=j?R:[...X.rawItems,...R],xe=He(ie),he=Q>=ee;F.current[o]={items:xe,rawItems:ie,hasMore:he,rawLen:ie.length},o===P.current&&(g(xe),b(he))}catch(R){if(A.signal.aborted)return;w(R instanceof Error?R.message:"æªç¥é误")}finally{z.current=!1,A.signal.aborted||n(!1)}},[Z,i.language]);r.useEffect(()=>{l&&(ue("video"),M("video",!0))},[]);const we=r.useCallback(o=>{o!==d&&(p?s?.(o):u(o))},[d,p,s]);r.useEffect(()=>{P.current=d,H.current&&(H.current.abort(),H.current=null),z.current=!1,w(null),_([]),ue(d);const o=F.current[d];o.items.length>0?(g(o.items),b(o.hasMore),n(!1)):(g([]),b(!0),M(d,!0,[]))},[d]);const Ne=r.useCallback(o=>{_(j=>{const $=j.includes(o)?j.filter(q=>q!==o):[...j,o],A=P.current;return F.current[A]={items:[],rawItems:[],hasMore:!0,rawLen:0},g([]),b(!0),M(A,!0,$),$})},[M]),ke=r.useCallback(()=>{_([]);const o=P.current;F.current[o]={items:[],rawItems:[],hasMore:!0,rawLen:0},g([]),b(!0),M(o,!0,[])},[M]),Ie=r.useCallback(()=>{const o=P.current;o==="workflow"&&jt(i.language),F.current[o]={items:[],rawItems:[],hasMore:!0,rawLen:0},g([]),b(!0),M(o,!0)},[M,i.language]),Te=r.useCallback(()=>{M(P.current)}
1,[M]),Ce=r.useCallback(o=>{if(!m){alert("请å
ç»å½å³å¯åºç¨å款é
ç½®");return}if(!o.sourceTemplateId){alert("该ä½åæä¸æ¯æä¸é®ä½¿ç¨");return}T(null),I(o)},[m]),$e=r.useCallback(async o=>{if(!N||!m)return;const j=N;try{y(j.id);const $=await Oe(m.id,j,c,o);T($),L(null),We(j)&&!$.seeded&&alert("项ç®å·²å建ï¼ä½åæ¬¾æ°æ®æªè½åæ¥ï¼è¯·æå¨ç²è´´æç¤ºè¯æç¨åéè¯")}catch($){alert($ instanceof Error?$.message:"å¿«éåºç¨å¤±è´¥ï¼è¯·éè¯")}finally{y(null)}},[N,m,c]),Se=r.useCallback(o=>{if(!m){alert("请å
ç»å½æè½æå
¥å°é¡¹ç®");return}if(!o.sourceTemplateId){alert("该ä½åæä¸æ¯ææå
¥");return}U(o)},[m]),Ae=r.useCallback((o,j)=>{U(null);const $=o.slug?.trim();if($){_e($,j);return}o.id&&window.open(`/json-builder/${o.id}`,"_blank","noopener,noreferrer")},[]);return{tab:d,isControlled:p,items:h,hasMore:v,loading:k,error:f,previewItem:C,setPreviewItem:L,applyingId:G,quickApplyTarget:N,setQuickApplyTarget:I,quickApplyResult:D,setQuickApplyResult:T,insertTarget:E,setInsertTarget:U,tags:K,selectedTags:Z,tagsLoading:ne,handleTabChange:we,handleTagToggle:Ne,handleClearTags:ke,handleRefresh:Ie,handleLoadMore:Te,handleQuickApply:Ce,handleQuickApplyConfirm:$e,handleInsertToProject:Se,handleInsertSuccess:Ae,user:m}}const V=new Map;function ve(t){return t?.startsWith("zh")?"zh-CN":"en-US"}function bt(t){return{id:t.id,mediaType:"image",mediaUrl:t.thumbnail,coverUrl:t.thumbnail,prompt:t.description||t.name,provider:t.name,sourceTemplateId:t.id,createdAt:t.createdAt||"2025-01-01",metadata:{templateName:t.name,stars:t.stars,downloads:t.downloads,featured:t.featured,category:t.category},author:t.author?{id:"",name:t.author}:null}}function jt(t){t?V.delete(ve(t)):V.clear()}async function fe(t,a=!1){const s=ve(t);if(!a&&V.has(s))return V.get(s);const l=await fetch(`/mainserver/api/json-schema/templates?language=${encodeURIComponent(s)}`);if(!l.ok)throw new Error(`HTTP ${l.status}`);const c=await l.json();if(!c.success||!Array.isArray(c.templates))throw new Error(c.error||"è·å工使µæ¨¡æ¿å¤±è´¥");const i=c.templates.filter(m=>m.category==="workflow");return V.set(s,i),i}function vt(t){const a=new Map;for(const s of t)for(const l of s.tags||[])l&&a.set(l,(a.get(l)||0)+1);return Array.from(a.entries()).map(([s,l])=>({tag:s,count:l})).sort((s,l)=>l.count-s.count)}function wt(t,a,s,l=[]){let c=t;l.length>0&&(c=t.filter(m=>l.some(x=>m.tags?.includes(x))));const i=c.slice(a,a+s);return{page:i,hasMore:a+i.length<c.length}}function Nt({onLoadMore:t,loading:a,hasMore:s}){const l=r.useRef(null);return r.useEffect(()=>{if(!s||a)return;const c=l.current;if(!c)return;const i=new IntersectionObserver(([m])=>{m.isIntersecting&&t()},{rootMargin:"400px"});return i.observe(c),()=>i.disconnect()},[s,a,t]),s?e.jsx("div",{className:"col-span-full flex items-center justify-center py-8",children:a&&e.jsx(O,{className:"w-5 h-5 animate-spin text-gray-400"})}):null}const Dt=()=>{const t=Fe(),a=yt({quickApplySourceLabel:"ä»åæç»å»ä¸é®ä½¿ç¨"}),{tab:s,items:l,hasMore:c,loading:i,error:m,previewItem:x,setPreviewItem:u,applyingId:d,quickApplyTarget:p,setQuickApplyTarget:h,quickApplyResult:g,setQuickApplyResult:v,insertTarget:b,setInsertTarget:k,tags:n,selectedTags:f,tagsLoading:w,handleTabChange:C,handleTagToggle:L,handleClearTags:G,handleRefresh:y,handleLoadMore:N,handleQuickApply:I,handleQuickApplyConfirm:D,handleInsertToProject:T,handleInsertSuccess:E,user:U}=a,K=r.useCallback(z=>{t(`/projects/${z}`)},[t]),W=s==="image"?"[column-count:1] sm:[column-count:2] md:[column-count:3] lg:[column-count:4] xl:[column-count:5]":"[column-count:1] sm:[column-count:2] lg:[column-count:3] xl:[column-count:4]",_=s==="video"?re:s==="image"?le:se,ne=s==="video"?"ææ åæè§é¢å±ç¤º":s==="image"?"ææ åæå¾çå±ç¤º":"ææ å·¥ä½æµæ¨¡æ¿",J=s==="video"?"社åºç馿¬¡è§é¢åä½å°å¨è¿éåç°":s==="image"?"社åºç馿¬¡ AI ç»å¾å°å¨è¿éåç°":"å徿¨¡æ¿åºæµè§æ´å¤å·¥ä½æµï¼æç¨ååè¯";return e.jsxs("div",{className:"block min-h-full bg-gray-50/50 p-4 md:p-6 lg:p-8",children:[e.jsxs("div",{className:"w-full max-w-[1600px] mx-auto",children:[e.jsx(tt,{tab:s}),e.jsx(rt,{tab:s,onTabChange:C,tags:n,selectedTags:f,onTagToggle:L,onClearTags:G,tagsLoading:w,onRefresh:y,refreshing:i}),m&&e.jsxs("div",{className:"mb-6 px-4 py-3 bg-red-50 border border-red-200 rounded-xl flex items-start gap-3",children:[e.jsx(je,{className:"w-5 h-5 text-red-500 mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-red-800",children:"å 载失败"}),e.jsx("p",{className:"text-sm text-red-600 mt-0.5",children:m})]})]}),i&&l.length===0?e.jsx("div",{style:{columnGap:"1.25rem"},className:W,children:e.jsx(mt,{count:8,mediaType:s==="video"?"video":"image"})}):l.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 bg-white rounded-2xl border border-gray-200 border-dashed",children:[e.jsx(_,{className:"w-12 h-12 text-gray-300 mb-4"}),e.jsx("p",{className:"text-gray-500 font-medium",children:ne}),e.jsx("p",{className:"text-sm text-gray-400 mt-1",children:J})]}):e.jsxs("div",{style:{columnGap:"1.25rem"},className:W,children:[l.map(z=>e.jsx(nt,{item:z,applyingId:d,onPreview:u,onQuickApply:I,onInsertToProject:T,onNavigate:K},z.id)),e.jsx(Nt,{onLoadMore:N,loading:i,hasMore:c})]})]}),x&&e.jsx(it,{item:x,onClose:()=>u(null),onNavigate:K,onQuickApply:I,onInsertToProject:T,applyingId:d}),p&&U&&e.jsx(ut,{item:p,applying:d===p.id,createdProject:g?.project??null,createdProjectUrl:g?.openUrl??null,seeded:g?.seeded??!0,onClose:()=>{d||(h(null),v(null))},onConfirm:D}),b&&U&&e.jsx(ht,{sourceTemplateId:b.sourceTemplateId,label:b.provider||b.model||void 0,userId:U.id,onClose:()=>k(null),onSuccess:E})]})};export{Dt as default};
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.