PageSourceSearch

https://autowork.com.vn/static/js/4143.65238a4c.chunk.js

js autowork.com.vn collected 2026-10-02 00:05:22 UTC 54,989 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkfbcreatorapp=self.webpackChunkfbcreatorapp||[]).push([[4143],{4143:(e,t,n)=>{n.r(t),n.d(t,{default:()=>z});var i=n(9379),s=n(9950),a=n(6339),l=n(9314),o=n(3718),r=n(8045),c=n(8989),d=n(4414);const h=e=>{let{settings:t,script:n}=e;if(!t)return null;const i=[{label:"Gi\u1ecdng \u0111\u1ecdc",value:t.suggestedVoice,icon:"\ud83c\udfa4"},{label:"T\u1ed1c \u0111\u1ed9",value:"".concat(t.suggestedSpeed||1.1,"x"),icon:"\u23f1\ufe0f"},{label:"T\u1ef7 l\u1ec7",value:t.suggestedAspectRatio,icon:"\ud83d\udcd0"},{label:"Hi\u1ec7u \u1ee9ng",value:t.suggestedEffect,icon:"\u2728"},{label:"Ph\u1ee5 \u0111\u1ec1",value:t.subtitleEnabled?t.subtitleEffect:"T\u1eaft",icon:"\ud83d\udcac"},{label:"\u0110\u1ed9 d\xe0i",value:t.suggestedDuration,icon:"\u23f0"}];return(0,d.jsxs)("div",{className:"ai-settings-preview",children:[(0,d.jsxs)("div",{className:"ai-settings-title",children:[(0,d.jsx)("span",{children:"\ud83e\udd16"}),(0,d.jsx)("span",{children:"AI \u0111\xe3 quy\u1ebft \u0111\u1ecbnh c\xe0i \u0111\u1eb7t t\u1ed1i \u01b0u"})]}),(0,d.jsx)("div",{className:"ai-settings-grid",children:i.map(((e,t)=>(0,d.jsxs)("div",{className:"ai-setting-item",children:[(0,d.jsxs)("div",{className:"ai-setting-label",children:[e.icon," ",e.label]}),(0,d.jsx)("div",{className:"ai-setting-value",children:e.value})]},t)))}),n&&(0,d.jsxs)("div",{style:{marginTop:"1rem"},children:[(0,d.jsx)("div",{className:"ai-setting-label",style:{marginBottom:"0.5rem"},children:"\ud83d\udcdd K\u1ecbch b\u1ea3n AI"}),(0,d.jsx)("div",{style:{background:"#f3f4f6",padding:"1rem",borderRadius:"0.5rem",color:"#374151",lineHeight:"1.6",fontSize:"0.9rem",border:"1px solid #e5e7eb"},children:n})]}),t.reasoning&&(0,d.jsxs)("div",{style:{marginTop:"1rem",padding:"0.75rem",background:"#eff6ff",borderRadius:"0.5rem",borderLeft:"3px solid #2563eb"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",color:"#2563eb",fontSize:"0.875rem",marginBottom:"0.5rem"},children:[(0,d.jsx)(a.S8s,{}),(0,d.jsx)("span",{children:"L\xfd do AI ch\u1ecdn c\xe0i \u0111\u1eb7t n\xe0y"})]}),(0,d.jsxs)("div",{style:{color:"#6b7280",fontSize:"0.8rem",lineHeight:"1.5"},children:[t.reasoning.voice&&(0,d.jsxs)("div",{children:["\u2022 Gi\u1ecdng: ",t.reasoning.voice]}),t.reasoning.aspectRatio&&(0,d.jsxs)("div",{children:["\u2022 T\u1ef7 l\u1ec7: ",t.reasoning.aspectRatio]}),t.reasoning.effect&&(0,d.jsxs)("div",{children:["\u2022 Hi\u1ec7u \u1ee9ng: ",t.reasoning.effect]})]})]})]})},g=()=>(0,d.jsx)("div",{className:"video-creator-intro-section",children:(0,d.jsxs)("div",{className:"intro-steps-container",children:[(0,d.jsxs)("h3",{className:"intro-section-title",children:[(0,d.jsx)(a.lrG,{className:"title-icon"}),"Quy tr\xecnh ho\u1ea1t \u0111\u1ed9ng 3 b\u01b0\u1edbc \u0111\u01a1n gi\u1ea3n"]}),(0,d.jsxs)("div",{className:"intro-steps-grid",children:[(0,d.jsxs)("div",{className:"intro-step-card",children:[(0,d.jsx)("div",{className:"step-badge",children:"1"}),(0,d.jsxs)("div",{className:"step-card-content",children:[(0,d.jsx)("h4",{children:"Ch\u1ecdn h\xecnh \u1ea3nh s\u1ea3n ph\u1ea9m"}),(0,d.jsx)("p",{children:"T\u1ea3i l\xean t\u1eeb 1 \u0111\u1ebfn 10 \u1ea3nh ch\u1ee5p s\u1ea3n ph\u1ea9m t\u1eeb nhi\u1ec1u g\xf3c \u0111\u1ed9 kh\xe1c nhau."})]})]}),(0,d.jsx)("div",{className:"step-arrow",children:(0,d.jsx)(a.dyV,{})}),(0,d.jsxs)("div",{className:"intro-step-card",children:[(0,d.jsx)("div",{className:"step-badge",children:"2"}),(0,d.jsxs)("div",{className:"step-card-content",children:[(0,d.jsx)("h4",{children:"Ch\u1ecdn m\u1ee5c ti\xeau & th\xf4ng tin"}),(0,d.jsx)("p",{children:"Ch\u1ecdn phong c\xe1ch video (B\xe1n h\xe0ng, \u0110\u1ed3 \u0103n, Review...) v\xe0 \u0111i\u1ec1n m\xf4 t\u1ea3 ng\u1eafn."})]})]}),(0,d.jsx)("div",{className:"step-arrow",children:(0,d.jsx)(a.dyV,{})}),(0,d.jsxs)("div",{className:"intro-step-card",children:[(0,d.jsx)("div",{className:"step-badge",children:"3"}),(0,d.jsxs)("div",{className:"step-card-content",children:[(0,d.jsx)("h4",{children:"AI t\u1ef1 \u0111\u1ed9ng t\u1ea1o video"}),(0,d.jsx)("p",{children:"AI s\u1ebd vi\u1ebft k\u1ecbch b\u1ea3n thuy\u1ebft minh, l\u1ed3ng ti\u1ebfng n\xf3i v\xe0 gh\xe9p th\xe0nh video ho\xe0n ch\u1ec9nh."})]})]})]})]})});var m=n(4716);async function u(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{profile:"oa",purpose:"video-input"};if(!t)throw new Error("Vui l\xf2ng \u0111\u0103ng nh\u1eadp \u0111\u1ec3 s\u1eed d\u1ee5ng t\xednh n\u0103ng n\xe0y.");return Promise.all(e.map((async(e,i)=>{if(e.uploadedUrl)return{idx:i,url:e.uploadedUrl};if("string"===typeof e.src&&(e.src.startsWith("http://")||e.src.startsWith("https://")))return{idx:i,url:e.src};let s=e.file;if(s||"string"!==typeof e.src||(s=function(e){var t;const n=e.split(","),i=(null===(t=n[0].match(/:(.*?);/))||void 0===t?void 0:t[1])||"image/jpeg",s=atob(n[1]),a=new Uint8Array(s.length);for(let l=0;l<s.length;l++)a[l]=s.charCodeAt(l);return new Blob([a],{type:i})}(e.src)),!s)throw new Error("D\u1eef li\u1ec7u h\xecnh \u1ea3nh kh\xf4ng h\u1ee3p l\u1ec7.");const a=await(0,m._p)(s,t,null,n);if(a&&a.url)return{idx:i,url:a.url};throw new Error("Kh\xf4ng th\u1ec3 t\u1ea3i \u1ea3nh l\xean h\u1ec7 th\u1ed1ng storage. Vui l\xf2ng th\u1eed l\u1ea1i.")})))}var p=n(1002),x=n(4474);const v=[{id:"uploading",icon:"\ud83d\udce4",title:"T\u1ea3i \u1ea3nh l\xean",message:"\u0110ang t\u1ea3i h\xecnh \u1ea3nh l\xean h\u1ec7 th\u1ed1ng...",completedMessage:"\u0110\xe3 t\u1ea3i h\xecnh \u1ea3nh l\xean h\u1ec7 th\u1ed1ng"},{id:"analyzing",icon:"\u2728",title:"Ph\xe2n t\xedch s\u1ea3n ph\u1ea9m",message:"\u0110ang ph\xe2n t\xedch h\xecnh \u1ea3nh v\xe0 t\u1ea1o k\u1ecbch b\u1ea3n...",completedMessage:"\u0110\xe3 ph\xe2n t\xedch h\xecnh \u1ea3nh v\xe0 t\u1ea1o k\u1ecbch b\u1ea3n"},{id:"generating_audio",icon:"\ud83c\udfa4",title:"T\u1ea1o gi\u1ecdng \u0111\u1ecdc",message:"\u0110ang t\u1ea1o gi\u1ecdng \u0111\u1ecdc AI...",completedMessage:"\u0110\xe3 t\u1ea1o gi\u1ecdng \u0111\u1ecdc AI th\xe0nh c\xf4ng"},{id:"complete",icon:"\ud83c\udfac",title:"Ho\xe0n th\xe0nh",message:"Video \u0111\xe3 s\u1eb5n s\xe0ng!",completedMessage:"Video \u0111\xe3 s\u1eb5n s\xe0ng!"}],f=[{id:"auto",label:"AI t\u1ef1 quy\u1ebft \u0111\u1ecbnh",desc:"AI s\u1ebd ph\xe2n t\xedch \u1ea3nh & th\xf4ng tin \u0111\u1ec3 ch\u1ecdn m\u1ee5c ti\xeau ph\xf9 h\u1ee3p nh\u1ea5t."},{id:"flash_sale",label:"B\xe1n nhanh/Khuy\u1ebfn m\xe3i",desc:"T\u1eadp trung v\xe0o gi\xe1, \u01b0u \u0111\xe3i, k\xeau g\u1ecdi h\xe0nh \u0111\u1ed9ng m\u1ea1nh m\u1ebd."},{id:"food",label:"K\xedch th\xedch v\u1ecb gi\xe1c",desc:"T\u1eadp trung v\xe0o c\u1ea3m gi\xe1c ngon mi\u1ec7ng, \u0111\u1ed9 t\u01b0\u01a1i, m\u1eddi g\u1ecdi \u0111\u1eb7t m\xf3n."},{id:"review",label:"Review & Uy t\xedn",desc:"N\xeau \u0111i\u1ec3m m\u1ea1nh, t\xednh n\u0103ng n\u1ed5i tr\u1ed9i, gi\u1ea3i quy\u1ebft n\u1ed7i \u0111au."},{id:"b2b",label:"Cung c\u1ea5p s\u1ec9/B2B",desc:"Th\u1ec3 hi\u1ec7n chuy\xean nghi\u1ec7p, n\u0103ng l\u1ef1c \u0111\xe1p \u1ee9ng, ch\xednh s\xe1ch gi\xe1 s\u1ec9."},{id:"inbox",label:"T\u01b0\u01a1ng t\xe1c/H\u1ecfi \u0111\xe1p",desc:"G\u1ee3i t\xf2 m\xf2, khuy\u1ebfn kh\xedch b\xecnh lu\u1eadn, nh\u1eafn tin."},{id:"new_arrival",label:"Ra m\u1eaft s\u1ea3n ph\u1ea9m m\u1edbi",desc:"Nh\u1ea5n m\u1ea1nh \u0111i\u1ec3m m\u1edbi, thi\u1ebft k\u1ebf, t\xednh n\u0103ng \u0111\u1ed9c \u0111\xe1o."},{id:"branding",label:"Branding/Lifestyle",desc:"X\xe2y d\u1ef1ng h\xecnh \u1ea3nh th\u01b0\u01a1ng hi\u1ec7u, truy\u1ec1n t\u1ea3i c\u1ea3m x\xfac."}],b={auto:(0,d.jsx)(a.Ojn,{}),flash_sale:(0,d.jsx)(a.cnX,{}),food:(0,d.jsx)(a.YBA,{}),review:(0,d.jsx)(a.TPq,{}),b2b:(0,d.jsx)(a.cfS,{}),inbox:(0,d.jsx)(a.mEP,{}),new_arrival:(0,d.jsx)(a.usP,{}),branding:(0,d.jsx)(a.Utz,{})};let j=0;const y=()=>"qm_".concat(Date.now(),"_").concat(++j),N=e=>{let{id:t,src:n,index:s,onRemove:l}=e;const{attributes:o,listeners:h,setNodeRef:g,transform:m,transition:u,isDragging:p}=(0,r.gl)({id:t,transition:{duration:200,easing:"cubic-bezier(0.25, 1, 0.5, 1)"}}),x={transform:c.Ks.Transform.toString(m),transition:u,opacity:p?.4:1,touchAction:"none"};return(0,d.jsxs)("div",{ref:g,style:x,className:"image-preview-item ".concat(p?"dragging":""),children:[(0,d.jsx)("div",(0,i.A)((0,i.A)((0,i.A)({},o),h),{},{className:"image-drag-handle"})),(0,d.jsx)("img",{src:n,alt:"Preview ".concat(s+1)}),(0,d.jsx)("div",{className:"image-order-badge",children:s+1}),(0,d.jsx)("button",{className:"image-preview-remove",onClick:e=>{e.stopPropagation(),l(t)},children:(0,d.jsx)(a.yGN,{})})]})},w=e=>{let{onComplete:t,existingImages:c=[],defaultSpeed:m=1.1}=e;
1const[j,w]=(0,s.useState)((()=>c.map((e=>({id:y(),src:e,file:null,uploadedUrl:"string"===typeof e&&(e.startsWith("http://")||e.startsWith("https://"))?e:null}))))),S=j.map((e=>e.src)),[k,A]=(0,s.useState)(!1),[T,C]=(0,s.useState)(!1),[I,R]=(0,s.useState)(null),[B,M]=(0,s.useState)(null),[P,E]=(0,s.useState)(null),[F,z]=(0,s.useState)(""),[D,L]=(0,s.useState)("auto"),[_,U]=(0,s.useState)(!0),V=(0,s.useRef)(null),G=(0,s.useRef)(null),K=localStorage.getItem("userId");(0,s.useEffect)((()=>()=>{var e;null!==(e=G.current)&&void 0!==e&&e.off&&(G.current.off(),G.current=null)}),[]);const W=(0,o.FR)((0,o.MS)(o.IG,{activationConstraint:{delay:100,tolerance:8}}),(0,o.MS)(o.AN,{activationConstraint:{distance:5}})),q=(0,s.useCallback)((e=>{const{active:t,over:n}=e;n&&t.id!==n.id&&w((e=>{const i=e.findIndex((e=>e.id===t.id)),s=e.findIndex((e=>e.id===n.id));return(0,r.be)(e,i,s)}))}),[]),O=(0,s.useCallback)((e=>{const t=Array.from(e).filter((e=>e.type.startsWith("image/")));t.length+j.length>10?M("T\u1ed1i \u0111a 10 h\xecnh \u1ea3nh"):(t.forEach((e=>{const t=new FileReader;t.onload=t=>{w((n=>[...n,{id:y(),file:e,src:t.target.result,uploadedUrl:null}]))},t.readAsDataURL(e)})),M(null))}),[j.length]),Z=e=>{w((t=>t.filter((t=>t.id!==e))))};return(0,d.jsxs)("div",{className:"quick-mode-panel",children:[(0,d.jsxs)("div",{className:"quick-mode-description",children:[(0,d.jsx)("span",{children:"\u2705 AI t\u1ea1o k\u1ecbch b\u1ea3n"}),(0,d.jsx)("span",{children:"\u2705 AI ch\u1ecdn gi\u1ecdng \u0111\u1ecdc"}),(0,d.jsx)("span",{children:"\u2705 AI ch\u1ecdn hi\u1ec7u \u1ee9ng"}),(0,d.jsx)("span",{children:"\u2705 T\u1ef1 \u0111\u1ed9ng ph\u1ee5 \u0111\u1ec1"})]}),B&&(0,d.jsxs)("div",{className:"error-message",children:[(0,d.jsx)(a.y3G,{}),(0,d.jsx)("span",{children:B})]}),P?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h,{settings:P.settings,script:P.script}),(0,d.jsxs)("div",{className:"export-buttons",style:{marginTop:"1.5rem"},children:[(0,d.jsxs)("button",{className:"export-button secondary",onClick:()=>{var e;null!==(e=G.current)&&void 0!==e&&e.off&&(G.current.off(),G.current=null),w([]),E(null),R(null),M(null),C(!1)},children:[(0,d.jsx)(a.FrA,{}),"T\u1ea1o video m\u1edbi"]}),(0,d.jsxs)("button",{className:"export-button primary",onClick:()=>t&&t(P,S),children:[(0,d.jsx)(a.ou6,{}),"Ch\u1ec9nh s\u1eeda & Xu\u1ea5t video"]})]})]}):(0,d.jsxs)(d.Fragment,{children:[0===S.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"image-uploader ".concat(k?"drag-over":""),onDragOver:e=>{e.preventDefault(),A(!0)},onDragLeave:()=>{A(!1)},onDrop:e=>{e.preventDefault(),A(!1),O(e.dataTransfer.files)},onClick:()=>{var e;return null===(e=V.current)||void 0===e?void 0:e.click()},children:[(0,d.jsx)("div",{className:"image-uploader-icon",children:"\ud83d\udcf8"}),(0,d.jsx)("div",{className:"image-uploader-text",children:"K\xe9o th\u1ea3 ho\u1eb7c click \u0111\u1ec3 t\u1ea3i \u1ea3nh l\xean"}),(0,d.jsx)("div",{className:"image-uploader-hint",children:"T\u1ed1i \u0111a 10 \u1ea3nh \u2022 JPG, PNG, WebP"}),(0,d.jsx)("input",{ref:V,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:e=>O(e.target.files)})]}),(0,d.jsx)(g,{})]}):(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(o.Mp,{sensors:W,collisionDetection:o.fp,onDragEnd:q,children:(0,d.jsx)(r.gB,{items:j.map((e=>e.id)),strategy:r.kL,children:(0,d.jsxs)("div",{className:"image-preview-grid",children:[j.map(((e,t)=>(0,d.jsx)(N,{id:e.id,src:e.src,index:t,onRemove:Z},e.id))),j.length<10&&(0,d.jsxs)("div",{className:"image-uploader",style:{aspectRatio:"1",padding:"1rem"},onClick:()=>{var e;return null===(e=V.current)||void 0===e?void 0:e.click()},children:[(0,d.jsx)(a.B88,{style:{fontSize:"2.25rem",color:"#9ca3af"}}),(0,d.jsx)("input",{ref:V,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:e=>O(e.target.files)})]})]})})})}),(0,d.jsx)("div",{style:{marginTop:"1.5rem",marginBottom:"1rem"},children:(0,d.jsxs)("div",{style:{marginTop:"1.5rem",marginBottom:"1.5rem"},children:[(0,d.jsx)("label",{style:{color:"#374151",marginBottom:"0.75rem",display:"block",fontWeight:"600",fontSize:"0.95rem"},children:"M\u1ee5c ti\xeau Video"}),(0,d.jsx)("div",{className:"goal-selector-grid",children:f.map((e=>{const t="auto"===e.id;return(0,d.jsxs)("div",{className:"goal-card ".concat(D===e.id?"selected":""," ").concat(t?"goal-auto":""),onClick:()=>L(e.id),children:[t&&(0,d.jsx)("div",{className:"goal-badge",children:"Khuy\xean d\xf9ng"}),(0,d.jsxs)("div",{className:"goal-card-header",children:[(0,d.jsx)("div",{className:"goal-icon-wrapper",children:b[e.id]||(0,d.jsx)(a.Utz,{})}),(0,d.jsx)("div",{className:"goal-title",children:e.label})]}),(0,d.jsx)("div",{className:"goal-description",children:e.desc})]},e.id)}))})]})}),(0,d.jsxs)("div",{className:"additional-info-section quick-mode",children:[(0,d.jsxs)("button",{className:"additional-info-toggle",onClick:()=>U(!_),type:"button",children:[(0,d.jsx)(a.S8s,{}),"Th\xf4ng tin b\u1ed5 sung (t\xf9y ch\u1ecdn)",(0,d.jsx)(a.fK4,{style:{transform:_?"rotate(180deg)":"rotate(0)",transition:"transform 0.2s",marginLeft:"auto"}})]}),_&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("textarea",{className:"additional-info-textarea",value:F,onChange:e=>z(e.target.value),placeholder:"V\xed d\u1ee5:\n\u2022 T\xean s\u1ea3n ph\u1ea9m: Kem ch\u1ed1ng n\u1eafng ABC SPF50\n\u2022 Gi\xe1: 299.000\u0111 (gi\u1ea3m 30%)\n\u2022 \u0110\u1eb7c \u0111i\u1ec3m n\u1ed5i b\u1eadt, \u0111\u1ed1i t\u01b0\u1ee3ng kh\xe1ch h\xe0ng...",maxLength:1e3}),(0,d.jsxs)("div",{className:"additional-info-hint",children:["Gi\xfap AI t\u1ea1o video ch\xednh x\xe1c h\u01a1n",F.length>0&&(0,d.jsxs)("span",{children:[" \u2022 ",F.length,"/1000"]})]})]})]}),(0,d.jsx)(x.A,{className:"video-points-cost",value:"".concat(35," \u0111i\u1ec3m/video")}),(0,d.jsx)("button",{className:"generate-button ".concat(T?"loading":""),onClick:async()=>
1{if(0!==S.length)if(K){C(!0),M(null),R("analyzing");try{R("uploading");const e=await u(j,K),s=e.map((e=>e.url));w((t=>t.map(((t,n)=>{const s=e.find((e=>e.idx===n));return s?(0,i.A)((0,i.A)({},t),{},{uploadedUrl:s.url}):t})))),R("analyzing");const{data:a}=await p.default.post("/api/video/quick-generate",{images:s,userId:K,goal:D,additionalInfo:F.trim()||void 0});if(!a.success)throw new Error(a.error||"C\xf3 l\u1ed7i x\u1ea3y ra");const{jobId:o}=a;if(!o)throw new Error("Kh\xf4ng nh\u1eadn \u0111\u01b0\u1ee3c m\xe3 c\xf4ng vi\u1ec7c t\u1eeb server");const{ref:r,onValue:c,off:d}=await Promise.resolve().then(n.bind(n,2578)),{db:h}=await Promise.resolve().then(n.bind(n,5299)),g=r(h,"jobs/".concat(o));c(g,(e=>{const n=e.val();if(n){if(n.progress<50?R("analyzing"):n.progress<90&&R("generating_audio"),"completed"===n.status&&n.result){var s,a;const e=(0,i.A)((0,i.A)({},n.result),{},{settings:(0,i.A)((0,i.A)({},n.result.settings),{},{suggestedSpeed:null!==(s=null===(a=n.result.settings)||void 0===a?void 0:a.suggestedSpeed)&&void 0!==s?s:m})});R("complete"),E(e),C(!1),d(g),setTimeout((()=>{t&&t(e,S)}),1500)}"failed"===n.status&&(M((0,l._0)(n.error||"C\xf3 l\u1ed7i x\u1ea3y ra khi t\u1ea1o video. Vui l\xf2ng th\u1eed l\u1ea1i.")),R(null),C(!1),d(g))}}));G.current={jobRef:g,off:()=>d(g)}}catch(a){var e,s;console.error("Quick generate error:",a);const t=null===(e=a.response)||void 0===e||null===(s=e.data)||void 0===s?void 0:s.error;M((0,l._0)(t||a)),R(null),C(!1)}}else M("Vui l\xf2ng \u0111\u0103ng nh\u1eadp \u0111\u1ec3 s\u1eed d\u1ee5ng t\xednh n\u0103ng n\xe0y");else M("Vui l\xf2ng th\xeam \xedt nh\u1ea5t 1 h\xecnh \u1ea3nh")},disabled:0===S.length||T,children:T?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"spinner"}),(0,d.jsx)("span",{children:"\u0110ang x\u1eed l\xfd..."})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a.FrA,{}),(0,d.jsx)("span",{children:"T\u1ea1o video t\u1ef1 \u0111\u1ed9ng"})]})}),T&&I&&(0,d.jsx)("div",{className:"processing-progress",children:v.map((e=>{const t=v.findIndex((t=>t.id===e.id))<v.findIndex((e=>e.id===I)),n=e.id===I;return(0,d.jsxs)("div",{className:"progress-step ".concat(n?"active":t?"completed":"pending"),children:[(0,d.jsx)("div",{className:"progress-step-icon",children:t?(0,d.jsx)(a.YrT,{}):e.icon}),(0,d.jsxs)("div",{className:"progress-step-text",children:[(0,d.jsx)("div",{className:"progress-step-title",children:e.title}),(0,d.jsx)("div",{className:"progress-step-message",children:t&&e.completedMessage||e.message})]})]},e.id)}))})]})]})},S=[{id:"15s",label:"15s",desc:"Flash sale"},{id:"20s",label:"20s",desc:"Gi\u1edbi thi\u1ec7u nhanh"},{id:"30s",label:"30s",desc:"Ph\u1ed5 bi\u1ebfn",recommended:!0}
1,{id:"45s",label:"45s",desc:"Chi ti\u1ebft"},{id:"60s",label:"60s",desc:"\u0110\u1ea7y \u0111\u1ee7"}],k=[{id:"auto",label:"AI t\u1ef1 quy\u1ebft \u0111\u1ecbnh",desc:"AI s\u1ebd ph\xe2n t\xedch \u1ea3nh & th\xf4ng tin \u0111\u1ec3 ch\u1ecdn m\u1ee5c ti\xeau ph\xf9 h\u1ee3p nh\u1ea5t."},{id:"flash_sale",label:"B\xe1n nhanh/Khuy\u1ebfn m\xe3i",desc:"T\u1eadp trung v\xe0o gi\xe1, \u01b0u \u0111\xe3i, k\xeau g\u1ecdi h\xe0nh \u0111\u1ed9ng m\u1ea1nh m\u1ebd."},{id:"food",label:"K\xedch th\xedch v\u1ecb gi\xe1c",desc:"T\u1eadp trung v\xe0o c\u1ea3m gi\xe1c ngon mi\u1ec7ng, \u0111\u1ed9 t\u01b0\u01a1i, m\u1eddi g\u1ecdi \u0111\u1eb7t m\xf3n."},{id:"review",label:"Review & Uy t\xedn",desc:"N\xeau \u0111i\u1ec3m m\u1ea1nh, t\xednh n\u0103ng n\u1ed5i tr\u1ed9i, gi\u1ea3i quy\u1ebft n\u1ed7i \u0111au."},{id:"b2b",label:"Cung c\u1ea5p s\u1ec9/B2B",desc:"Th\u1ec3 hi\u1ec7n chuy\xean nghi\u1ec7p, n\u0103ng l\u1ef1c \u0111\xe1p \u1ee9ng, ch\xednh s\xe1ch gi\xe1 s\u1ec9."},{id:"inbox",label:"T\u01b0\u01a1ng t\xe1c/H\u1ecfi \u0111\xe1p",desc:"G\u1ee3i t\xf2 m\xf2, khuy\u1ebfn kh\xedch b\xecnh lu\u1eadn, nh\u1eafn tin."},{id:"new_arrival",label:"Ra m\u1eaft s\u1ea3n ph\u1ea9m m\u1edbi",desc:"Nh\u1ea5n m\u1ea1nh \u0111i\u1ec3m m\u1edbi, thi\u1ebft k\u1ebf, t\xednh n\u0103ng \u0111\u1ed9c \u0111\xe1o."},{id:"branding",label:"Branding/Lifestyle",desc:"X\xe2y d\u1ef1ng h\xecnh \u1ea3nh th\u01b0\u01a1ng hi\u1ec7u, truy\u1ec1n t\u1ea3i c\u1ea3m x\xfac."}],A={auto:(0,d.jsx)(a.Ojn,{}),flash_sale:(0,d.jsx)(a.cnX,{}),food:(0,d.jsx)(a.YBA,{}),review:(0,d.jsx)(a.TPq,{}),b2b:(0,d.jsx)(a.cfS,{}),inbox:(0,d.jsx)(a.mEP,{}),new_arrival:(0,d.jsx)(a.usP,{}),branding:(0,d.jsx)(a.Utz,{})},T=[{label:"\ud83d\udc69 Gi\u1ecdng n\u1eef",voices:[{id:"Zephyr",name:"Zephyr",category:"T\u01b0\u01a1i s\xe1ng"},{id:"Kore",name:"Kore",category:"Ch\u1eafc ch\u1eafn"},{id:"Aoede",name:"Aoede",category:"Nh\u1eb9 nh\xe0ng"},{id:"Leda",name:"Leda",category:"Tr\u1ebb trung"},{id:"Callirrhoe",name:"Callirrhoe",category:"Tho\u1ea3i m\xe1i"},{id:"Autonoe",name:"Autonoe",category:"R\u1ea1ng r\u1ee1"},{id:"Despina",name:"Despina",category:"M\u01b0\u1ee3t m\xe0"},{id:"Erinome",name:"Erinome",category:"R\xf5 r\xe0ng"},{id:"Laomedeia",name:"Laomedeia",category:"Vui t\u01b0\u01a1i"},{id:"Achernar",name:"Achernar",category:"D\u1ecbu d\xe0ng"},{id:"Pulcherrima",name:"Pulcherrima",category:"T\u1ef1 tin"},{id:"Vindemiatrix",name:"Vindemiatrix",category:"\xcam d\u1ecbu"},{id:"Sulafat",name:"Sulafat",category:"\u1ea4m \xe1p"}]},{label:"\ud83d\udc68 Gi\u1ecdng nam",voices:[{id:"Puck",name:"Puck",category:"L\u1ea1c quan"},{id:"Charon",name:"Charon",category:"\u0110i\u1ec1m \u0111\u1ea1m"},{id:"Fenrir",name:"Fenrir",category:"S\xf4i n\u1ed5i"},{id:"Orus",name:"Orus",category:"V\u1eefng v\xe0ng"},{id:"Enceladus",name:"Enceladus",category:"Th\xec th\u1ea7m"},{id:"Iapetus",name:"Iapetus",category:"Trong tr\u1ebbo"},{id:"Umbriel",name:"Umbriel",category:"Th\u01b0 th\xe1i"},{id:"Algieba",name:"Algieba",category:"M\u01b0\u1ee3t m\xe0"},{id:"Algenib",name:"Algenib",category:"Tr\u1ea7m kh\xe0n"},{id:"Rasalgethi",name:"Rasalgethi",category:"Chuy\xean nghi\u1ec7p"},{id:"Alnilam",name:"Alnilam",category:"Quy\u1ebft \u0111o\xe1n"},{id:"Schedar",name:"Schedar",category:"\u0110i\u1ec1m t\u0129nh"},{id:"Gacrux",name:"Gacrux",category:"Ch\xedn ch\u1eafn"},{id:"Achird",name:"Achird",category:"Th\xe2n thi\u1ec7n"},{id:"Zubenelgenubi",name:"Zubenelgenubi",category:"T\u1ef1 nhi\xean"},{id:"Sadachbia",name:"Sadachbia",category:"N\u0103ng \u0111\u1ed9ng"},{id:"Sadaltager",name:"Sadaltager",category:"Uy\xean b\xe1c"}]}],C=[{value:.8,label:"0.8x"},{value:.9,label:"0.9x"},{value:1,label:"1.0x"},{value:1.1,label:"1.1x"},{value:1.2,label:"1.2x"},{value:1.3,label:"1.3x"}],I=[{id:"16:9",label:"Ngang",icon:"\ud83d\udda5\ufe0f",desc:"YouTube, Website"},{id:"9:16",label:"D\u1ecdc",icon:"\ud83d\udcf1",desc:"TikTok, Reels",recommended:!0},{id:"1:1",label:"Vu\xf4ng",icon:"\u2b1b",desc:"Facebook Feed"}],R=[{id:"zoom-in",label:"Ph\xf3ng to",icon:"\ud83d\udd0d"},{id:"zoom-out",label:"Thu nh\u1ecf",icon:"\ud83d\udd0e"},{id:"pan-left",label:"Tr\u01b0\u1ee3t tr\xe1i",icon:"\u2b05\ufe0f"},{id:"pan-right",label:"Tr\u01b0\u1ee3t ph\u1ea3i",icon:"\u27a1\ufe0f"},{id:"static",label:"T\u0129nh",icon:"\u23f8\ufe0f"}],B=[{id:"highlight",label:"Highlight"},{id:"bounce",label:"Nh\u1ea3y"},{id:"typewriter",label:"M\xe1y \u0111\xe1nh ch\u1eef"},{id:"karaoke",label:"Karaoke"}];let M=0;const P=()=>"img_".concat(Date.now(),"_").concat(++M),E=e=>{let{id:t,src:n,index:s,onRemove:l}=e;const{attributes:o,listeners:h,setNodeRef:g,transform:m,transition:u,isDragging:p}=(0,r.gl)({id:t,transition:{duration:200,easing:"cubic-bezier(0.25, 1, 0.5, 1)"}}),x={transform:c.Ks.Transform.toString(m),transition:u,opacity:p?.4:1,touchAction:"none"};return(0,d.jsxs)("div",{ref:g,style:x,className:"image-preview-item ".concat(p?"dragging":""),children:[(0,d.jsx)("div",(0,i.A)((0,i.A)((0,i.A)({},o),h),{},{className:"image-drag-handle"})),(0,d.jsx)("img",{src:n,alt:"Preview ".concat(s+1)}),(0,d.jsx)("div",{className:"image-order-badge",children:s+1}),(0,d.jsx)("button",{className:"image-preview-remove",onClick:e=>{e.stopPropagation(),l(t)},children:(0,d.jsx)(a.yGN,{})})]})},F=e=>{var t,n,c,h,g,m,v;let{initialImages:f=[],initialResult:b=null,onReset:j}=e;
1const[y,N]=(0,s.useState)(1),[w,M]=(0,s.useState)([]),[F,z]=(0,s.useState)((()=>f.map((e=>({id:P(),src:e,file:null,uploadedUrl:"string"===typeof e&&(e.startsWith("http://")||e.startsWith("https://"))?e:null}))))),D=F.map((e=>e.src)),[L,_]=(0,s.useState)("fashion"),[U,V]=(0,s.useState)("auto"),[G,K]=(0,s.useState)("30s"),[W,q]=(0,s.useState)(""),[O,Z]=(0,s.useState)((null===b||void 0===b?void 0:b.script)||""),[H,X]=(0,s.useState)((null===b||void 0===b?void 0:b.hooks)||[]),[Y,Q]=(0,s.useState)((null===b||void 0===b?void 0:b.voiceScript)||""),[$,J]=(0,s.useState)((null===b||void 0===b?void 0:b.displayScript)||""),[ee,te]=(0,s.useState)((null===b||void 0===b?void 0:b.keywords)||[]),[ne,ie]=(0,s.useState)((null===b||void 0===b||null===(t=b.settings)||void 0===t?void 0:t.suggestedVoice)||"Zephyr"),[se,ae]=(0,s.useState)(!1),[le,oe]=(0,s.useState)(ne),[re,ce]=(0,s.useState)((null===b||void 0===b||null===(n=b.settings)||void 0===n?void 0:n.suggestedSpeed)||1),[de,he]=(0,s.useState)((null===b||void 0===b?void 0:b.audioBase64)||null),[ge,me]=(0,s.useState)((null===b||void 0===b?void 0:b.audioMimeType)||"audio/wav"),[ue,pe]=(0,s.useState)(!1),[xe,ve]=(0,s.useState)((null===b||void 0===b||null===(c=b.settings)||void 0===c?void 0:c.suggestedAspectRatio)||"9:16"),[fe,be]=(0,s.useState)((null===b||void 0===b||null===(h=b.settings)||void 0===h?void 0:h.suggestedEffect)||"zoom-in"),[je,ye]=(0,s.useState)((null===b||void 0===b||null===(g=b.settings)||void 0===g?void 0:g.subtitleEffect)||"highlight"),[Ne,we]=(0,s.useState)(null===(m=null===b||void 0===b||null===(v=b.settings)||void 0===v?void 0:v.subtitleEnabled)||void 0===m||m),[Se,ke]=(0,s.useState)(!1),[Ae,Te]=(0,s.useState)(""),[Ce,Ie]=(0,s.useState)(""),[Re,Be]=(0,s.useState)(!1),[Me,Pe]=(0,s.useState)(!1),[Ee,Fe]=(0,s.useState)(0),[ze,De]=(0,s.useState)(0),[Le,_e]=(0,s.useState)(0),[Ue,Ve]=(0,s.useState)(0),[Ge,Ke]=(0,s.useState)(-1),[We,qe]=(0,s.useState)(!1),[Oe,Ze]=(0,s.useState)(4),[He,Xe]=(0,s.useState)(null),Ye=(0,s.useRef)(null),Qe=(0,s.useRef)(null),$e=localStorage.getItem("userId"),Je=(0,o.FR)((0,o.MS)(o.IG,{activationConstraint:{delay:100,tolerance:8}}),(0,o.MS)(o.AN,{activationConstraint:{distance:5}})),et=(0,s.useCallback)((e=>{const{active:t,over:n}=e;n&&t.id!==n.id&&z((e=>{const i=e.findIndex((e=>e.id===t.id)),s=e.findIndex((e=>e.id===n.id));return(0,r.be)(e,i,s)}))}),[]);(0,s.useEffect)((()=>{var e,t,n,i,s,a,l,o;b&&(Z(b.script||""),X(b.hooks||[]),Q(b.voiceScript||""),J(b.displayScript||""),te(b.keywords||[]),ie((null===(e=b.settings)||void 0===e?void 0:e.suggestedVoice)||"Zephyr"),oe((null===(t=b.settings)||void 0===t?void 0:t.suggestedVoice)||"Zephyr"),ce((null===(n=b.settings)||void 0===n?void 0:n.suggestedSpeed)||1),ve((null===(i=b.settings)||void 0===i?void 0:i.suggestedAspectRatio)||"9:16"),be((null===(s=b.settings)||void 0===s?void 0:s.suggestedEffect)||"zoom-in"),we(null===(a=null===(l=b.settings)||void 0===l?void 0:l.subt
1itleEnabled)||void 0===a||a),ye((null===(o=b.settings)||void 0===o?void 0:o.subtitleEffect)||"highlight"),he(b.audioBase64||null),me(b.audioMimeType||"audio/wav"),M([1,2,3]),N(4))}),[b]);const tt=(0,s.useCallback)((e=>{const t=Array.from(e).filter((e=>e.type.startsWith("image/")));t.length+F.length>10?Xe("T\u1ed1i \u0111a 10 h\xecnh \u1ea3nh"):(t.forEach((e=>{const t=new FileReader;t.onload=t=>{z((n=>[...n,{id:P(),file:e,src:t.target.result,uploadedUrl:null}]))},t.readAsDataURL(e)})),Xe(null))}),[F.length]),nt=e=>{z((t=>t.filter((t=>t.id!==e))))},it=async()=>{if(0!==D.length){ae(!0),Xe(null);try{const e=await u(F,$e),t=e.map((e=>e.url));z((t=>t.map(((t,n)=>{const s=e.find((e=>e.idx===n));return s?(0,i.A)((0,i.A)({},t),{},{uploadedUrl:s.url}):t}))));const{data:n}=await p.default.post("/api/video/generate-script",{images:t,targetDuration:G,additionalInfo:W.trim()||void 0,goal:U});if(!n.success)throw new Error(n.error||"Kh\xf4ng th\u1ec3 t\u1ea1o k\u1ecbch b\u1ea3n");X(n.hooks||[]),Q(n.voiceScript||""),J(n.displayScript||""),te(n.keywords||[]),Z(n.voiceScript||n.script||""),ie(n.suggestedVoice||"Zephyr"),oe(n.suggestedVoice||"Zephyr"),M((e=>[...e.filter((e=>1!==e)),1])),N(2)}catch(n){var e,t;const i=null===(e=n.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.error;Xe((0,l._0)(i||n))}finally{ae(!1)}}else Xe("Vui l\xf2ng th\xeam \xedt nh\u1ea5t 1 h\xecnh \u1ea3nh")},st=O.trim().split(/\s+/).filter(Boolean).length,at=(e,t,n)=>{const i=y===e,s=w.includes(e),l=e>1&&!w.includes(e-1)&&!i;return(0,d.jsxs)("div",{className:"step-header",onClick:()=>!l&&N(e),children:[(0,d.jsx)("div",{className:"step-number",children:s?(0,d.jsx)(a.YrT,{}):e}),(0,d.jsx)("div",{className:"step-title",children:t}),(0,d.jsx)("div",{className:"step-status",children:n}),(0,d.jsx)(a.fK4,{style:{transform:i?"rotate(180deg)":"rotate(0)",transition:"transform 0.2s",color:"#6b7280"}})]})};return(0,d.jsxs)("div",{className:"advanced-mode-panel",children:[He&&(0,d.jsxs)("div",{className:"error-message",children:[(0,d.jsx)(a.y3G,{}),(0,d.jsx)("span",{children:He}),(0,d.jsx)("button",{onClick:()=>Xe(null),style:{marginLeft:"auto",background:"none",border:"none",color:"#ef4444",cursor:"pointer"},children:(0,d.jsx)(a.yGN,{})})]}),(0,d.jsxs)("div",{className:"step-accordion ".concat(1===y?"active":""," ").concat(w.includes(1)?"completed":""),children:[at(1,"H\xecnh \u1ea3nh c\u1ee7a b\u1ea1n",D.length>0?"".concat(D.length," \u1ea3nh"):""),(0,d.jsxs)("div",{className:"step-content",children:[0===D.length?(0,d.jsxs)("div",{className:"image-uploader",onClick:()=>{var e;return null===(e=Ye.current)||void 0===e?void 0:e.click()},children:[(0,d.jsx)("div",{className:"image-uploader-icon",children:"\ud83d\udcf8"}),(0,d.jsx)("div",{className:"image-uploader-text",children:"K\xe9o th\u1ea3 ho\u1eb7c click \u0111\u1ec3 t\u1ea3i \u1ea3nh"}),(0,d.jsx)("div",{className:"image-uploader-hint",children:"T\u1ed1i \u0111a 10 \u1ea3nh"}),(0,d.jsx)("input",{ref:Ye,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:e=>tt(e.target.files)})]}):(0,d.jsx)(o.Mp,{sensors:Je,collisionDetection:o.fp,onDragEnd:et,children:(0,d.jsx)(r.gB,{items:F.map((e=>e.id)),strategy:r.kL,children:(0,d.jsxs)("div",{className:"image-preview-grid",children:[F.map(((e,t)=>(0,d.jsx)(E,{id:e.id,src:e.src,index:t,onRemove:nt},e.id))),F.length<10&&(0,d.jsxs)("div",{className:"image-uploader",style:{aspectRatio:"1",padding:"1rem"},onClick:()=>{var e;return null===(e=Ye.current)||void 0===e?void 0:e.click()},children:[(0,d.jsx)(a.B88,{style:{fontSize:"2.25rem",color:"#9ca3af"}}),(0,d.jsx)("input",{ref:Ye,type:"file",accept:"image/*",multiple:!0,style:{display:"none"},onChange:e=>tt(e.target.files)})]})]})})}),(0,d.jsxs)("div",{style:{marginTop:"1.5rem"},children:[(0,d.jsx)("label",{style:{color:"#374151",marginBottom:"0.75rem",display:"block",fontWeight:"600",fontSize:"0.95rem"},children:"M\u1ee5c ti\xeau Video"}),(0,d.jsx)("div",{className:"goal-selector-grid",children:k.map((e=>{const t="auto"===e.id;return(0,d.jsxs)("div",{className:"goal-card ".concat(U===e.id?"selected":""," ").concat(t?"goal-auto":""),onClick:()=>V(e.id),children:[t&&(0,d.jsx)("div",{className:"goal-badge",children:"Khuy\xean d\xf9ng"}),(0,d.jsxs)("div",{className:"goal-card-header",children:[(0,d.jsx)("div",{className:"goal-icon-wrapper",children:A[e.id]||(0,d.jsx)(a.Utz,{})}),(0,d.jsx)("div",{className:"goal-title",children:e.label})]}),(0,d.jsx)("div",{className:"goal-description",children:e.desc})]},e.id)}))})]}),(0,d.jsxs)("div",{style:{marginTop:"1.5rem"},children:[(0,d.jsx)("label",{style:{color:"#374151",marginBottom:"0.75rem",display:"block",fontWeight:"500"},children:"\u0110\u1ed9 d\xe0i video mong mu\u1ed1n"}),(0,d.jsx)("div",{className:"duration-selector",children:S.map((e=>(0,d.jsxs)("div",{className:"duration-option ".concat(G===e.id?"selected":""," ").concat(e.recommended?"recommended":""),onClick:()=>K(e.id),children:[(0,d.jsx)("div",{className:"duration-time",children:e.label}),(0,d.jsx)("div",{className:"duration-desc",children:e.desc})]},e.id)))})]}),(0,d.jsxs)("div",{className:"additional-info-section",children:[(0,d.jsxs)("label",{className:"additional-info-label",children:[(0,d.jsx)(a.S8s,{}),"Th\xf4ng tin b\u1ed5 sung (t\xf9y ch\u1ecdn)"]}),(0,d.jsx)("textarea",{className:"additional-info-textarea",value:W,onChange:e=>q(e.target.value),placeholder:"V\xed d\u1ee5:\n\u2022 T\xean s\u1ea3n ph\u1ea9m: Kem ch\u1ed1ng n\u1eafng ABC SPF50\n\u2022 Gi\xe1: 299.000\u0111 (gi\u1ea3m 30%)\n\u2022 \u0110\u1eb7c \u0111i\u1ec3m n\u1ed5i b\u1eadt: Kh\xf4ng nh\u1eddn, th\u1ea5m nhanh\n\u2022 \u0110\u1ed1i t\u01b0\u1ee3ng: Ph\u1ee5 n\u1eef 25-35 tu\u1ed5i\n\u2022 Gi\u1ecdng \u0111i\u1ec7u: Tr\u1ebb trung, n\u0103ng \u0111\u1ed9ng",maxLength:1e3}),(0,d.jsxs)("div",{className:"additional-info-hint",children:["Cung c\u1ea5p th\xf4ng tin \u0111\u1ec3 AI t\u1ea1o k\u1ecbch b\u1ea3n ch\xednh x\xe1c v\xe0 c\xe1 nh\xe2n h\xf3a h\u01a1n",W.length>0&&(0,d.jsxs)("span",{children:[" \u2022 ",W.length,"/1000"]})]})]}),(0,d.jsx)(x.A,{className:"video-points-cost",value:"".concat(0," \u0111i\u1ec3m/l\u1ea7n t\u1ea1o k\u1ecbch b\u1ea3n")}),(0,d.jsx)("button",{className:"generate-button ".concat(se?"loading":""),onClick:it,disabled:0===D.length||se,style:{marginTop:"1rem"},children:se?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"spinner"}),(0,d.jsx)("span",{children:"\u0110ang t\u1ea1o k\u1ecbch b\u1ea3n..."})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a.jTZ,{}),(0,d.jsx)("span",{children:"T\u1ea1o k\u1ecbch b\u1ea3n AI"})]})})]})]}),(0,d.jsxs)("div",{className:"step-accordion ".concat(2===y?"active":""," ").concat(w.includes(2)?"completed":""),children:[at(2,"K\u1ecbch b\u1ea3n AI",O?"~".concat(st," t\u1eeb"):""),(0,d.jsxs)("div",{className:"step-content",children:[H&&H.length>0&&(0,d.jsxs)("div",{className:"hooks-section",style:{marginBottom:"1.5rem",padding:"1rem",backgroundColor:"#f9fafb",borderRadius:"8px",border:"1px solid #e5e7eb"},children:[(0,d.jsx)("label",{style:{display:"block",fontWeight:"bold",marginBottom:"0.5rem",color:"#374151"},children:"Tu\u1ef3 ch\u1ecdn Hook (0-3s \u0111\u1ea7u)"}),(0,d.jsx)("ul",{style:{paddingLeft:"1.2rem",margin:0,color:"#4b5563",fontSize:"0.9rem"},children:H.map(((e,t)=>(0,d.jsx)("li",{style:{marginBottom:"0.5rem"},children:e},t)))}),(0,d.jsx)("div",{style:{fontSize:"0.8rem",color:"#6b7280",marginTop:"0.5rem"},children:(0,d.jsx)("i",{children:"* B\u1ea1n c\xf3 th\u1ec3 ch\u1ecdn 1 hook \u1edf tr\xean v\xe0 sao ch\xe9p v\xe0o \u0111\u1ea7u k\u1ecbch b\u1ea3n \u0111\u1ec3 thu h\xfat ng\u01b0\u1eddi xem."})})]}),(0,d.jsxs)("div",{className:"script-editor",children:[(0,d.jsx)("textarea",{className:"script-textarea",value:O,onChange:e=>Z(e.target.value),placeholder:"K\u1ecbch b\u1ea3n ph\u1ea7n Body v\xe0 CTA s\u1ebd xu\u1ea5t hi\u1ec7n \u1edf \u0111\xe2y...",style:{minHeight:"200px"}}),(0,d.jsxs)("div",{className:"script-stats",children:[(0,d.jsxs)("span",{children:[st," t\u1eeb"]}),(0,d.jsx)("span",{children:"\u2022"}),(0,d.jsxs)("span",{children:["~",Math.round(st/2.5)," gi\xe2y"]})]})]}),(0,d.jsxs)("button",{className:"generate-button secondary",onClick:it,disabled:se,style:{marginBottom:"1rem"},children:[(0,d.jsx)(a.jTZ,{}),(0,d.jsx)("span",{children:"T\u1ea1o l\u1ea1i k\u1ecbch b\u1ea3n"})]}),(0,d.jsx)("button",{className:"generate-button",onClick:()=>{M((e=>[...e.filter((e=>2!==e)),2])),N(3)},disabled:!O.trim(),children:(0,d.jsx)("span",{children:"Ti\u1ebfp t\u1ee5c ch\u1ecdn gi\u1ecdng \u0111\u1ecdc"})})]})]}),(0,d.jsxs)("div",{className:"step-accordion ".concat(3===y?"active":""," ").concat(w.includes(3)?"completed":""),children:[at(3,"Gi\u1ecdng \u0111\u1ecdc",le),(0,d.jsxs)("div",{className:"step-content",children:[(0,d.jsx)("label",{style:{color:"#374151",marginBottom:"0.75rem",display:"block",fontWeight:"500"},children:"Ch\u1ecdn gi\u1ecdng \u0111\u1ecdc"}),(0,d.jsx)("div",{className:"voice-groups-container",children:T.map((e=>(0,d.jsxs)("div",{className:"voice-group",children:[(0,d.jsx)("div",{className:"voice-group-label",children:e.label}),(0,d.jsx)("div",{className:"voice-selector-grid",children:e.voices.map((e=>(0,d.jsxs)("div",{className:"voice-option ".concat(le===e.id?"selected":""),onClick:()=>oe(e.id),children:[(0,d.jsx)("div",{className:"voice-name",children:e.name}),(0,d.jsx)("div",{className:"voice-category",children:e.category})]},e.id)))})]},e.label)))}),(0,d.jsxs)("div",{style:{marginTop:"1.5rem"},children:[(0,d.jsxs)("label",{style:{color:"#374151",marginBottom:"0.75rem",display:"block",fontWeight:"500"},children:["T\u1ed1c \u0111\u1ed9 \u0111\u1ecdc: ",(0,d.jsxs)("span",{style:{color:"#2563eb",fontWeight:"bold"},children:[re,"x"]})]}),(0,d.jsx)("div",{className:"speed-button-group",children:C.map((e=>(0,d.jsx)("button",{className:"speed-button ".concat(re===e.value?"selected":""),onClick:()=>ce(e.value),children:e.label},e.value)))})]}),(0,d.jsx)(x.A,{className:"video-points-cost",value:"".concat(35," \u0111i\u1ec3m/l\u1ea7n t\u1ea1o gi\u1ecdng \u0111\u1ecdc")}),(0,d.jsx)("button",{className:"generate-button ".concat(ue?"loading":""),onClick:async()=>
1{if(O.trim()){pe(!0),Xe(null);try{const{data:e}=await p.default.post("/api/video/generate-speech",{text:O,voiceName:le,speed:re,userId:$e});if(!e.success)throw new Error(e.error||"Kh\xf4ng th\u1ec3 t\u1ea1o gi\u1ecdng \u0111\u1ecdc");he(e.audioBase64),me(e.mimeType||"audio/wav"),M((e=>[...e.filter((e=>2!==e&&3!==e)),2,3])),N(4)}catch(n){var e,t;const i=null===(e=n.response)||void 0===e||null===(t=e.data)||void 0===t?void 0:t.error;Xe((0,l._0)(i||n))}finally{pe(!1)}}else Xe("Vui l\xf2ng nh\u1eadp k\u1ecbch b\u1ea3n")},disabled:ue,style:{marginTop:"1.5rem"},children:ue?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"spinner"}),(0,d.jsx)("span",{children:"\u0110ang t\u1ea1o gi\u1ecdng \u0111\u1ecdc..."})]}):(0,d.jsxs)(d.Fragment,{children:["\ud83c\udfa4 ",(0,d.jsx)("span",{children:"T\u1ea1o gi\u1ecdng \u0111\u1ecdc"})]})})]})]}),(0,d.jsxs)("div",{className:"step-accordion ".concat(4===y?"active":""," ").concat(w.includes(4)?"completed":""),children:[at(4,"Hi\u1ec7u \u1ee9ng & Xu\u1ea5t video",de?"S\u1eb5n s\xe0ng":""),(0,d.jsxs)("div",{className:"step-content",children:[(0,d.jsx)("label",{style:{color:"#374151",marginBottom:"0.75rem",display:"block",fontWeight:"500"},children:"T\u1ef7 l\u1ec7 khung h\xecnh"}),(0,d.jsx)("div",{className:"aspect-ratio-selector",children:I.map((e=>(0,d.jsxs)("div",{className:"aspect-ratio-option ".concat(xe===e.id?"selected":""),onClick:()=>ve(e.id),children:[(0,d.jsx)("div",{className:"aspect-ratio-icon",children:e.icon}),(0,d.jsx)("div",{className:"aspect-ratio-label",children:e.label}),(0,d.jsx)("div",{className:"aspect-ratio-desc",children:e.desc})]},e.id)))}),(0,d.jsx)("label",{style:{color:"#374151",marginBottom:"0.75rem",display:"block",marginTop:"1.5rem",fontWeight:"500"},children:"Hi\u1ec7u \u1ee9ng h\xecnh \u1ea3nh"}),(0,d.jsx)("div",{className:"effect-selector",children:R.map((e=>(0,d.jsxs)("div",{className:"effect-option ".concat(fe===e.id?"selected":""),onClick:()=>be(e.id),children:[(0,d.jsx)("span",{children:e.icon}),(0,d.jsx)("span",{children:e.label})]},e.id)))}),(0,d.jsxs)("div",{className:"subtitle-settings",style:{marginTop:"1.5rem"},children:[(0,d.jsxs)("div",{className:"subtitle-toggle",children:[(0,d.jsx)("label",{children:"Ph\u1ee5 \u0111\u1ec1 t\u1ef1 \u0111\u1ed9ng"}),(0,d.jsx)("div",{className:"toggle-switch ".concat(Ne?"active":""),onClick:()=>we(!Ne)})]}),Ne&&(0,d.jsx)("div",{className:"effect-selector",children:B.map((e=>(0,d.jsx)("div",{className:"effect-option ".concat(je===e.id?"selected":""),onClick:()=>ye(e.id),children:(0,d.jsx)("span",{children:e.label})},e.id)))})]}),(0,d.jsxs)("div",{className:"endcard-settings",style:{marginTop:"1.5rem"},children:[(0,d.jsxs)("div",{className:"subtitle-toggle",children:[(0,d.jsx)("label",{children:"End-card (M\xe0n h\xecnh k\u1ebft)"}),(0,d.jsx)("div",{className:"toggle-switch ".concat(Se?"active":""),onClick:()=>ke(!Se)})]}),Se&&(0,d.jsxs)("div",{style:{marginTop:"1rem",padding:"1rem",backgroundColor:"#f9fafb",borderRadius:"8px"},children:[(0,d.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,d.jsx)("label",{style:{display:"block",fontSize:"0.875rem",marginBottom:"0.5rem"},children:"T\xean K\xeanh"}),(0,d.jsx)("input",{type:"text",value:Ae,onChange:e=>Te(e.target.value),style:{width:"100%",padding:"0.5rem",borderRadius:"4px",border:"1px solid #d1d5db"},placeholder:"VD: AutoWork"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{style:{display:"block",fontSize:"0.875rem",marginBottom:"0.5rem"},children:"K\xeau g\u1ecdi h\xe0nh \u0111\u1ed9ng (CTA)"}),(0,d.jsx)("input",{type:"text",value:Ce,onChange:e=>Ie(e.target.value),style:{width:"100%",padding:"0.5rem",borderRadius:"4px",border:"1px solid #d1d5db"},placeholder:"VD: \u0110\u0103ng k\xfd ngay!"})]})]})]}),de&&(0,d.jsxs)("div",{className:"video-preview-container",style:{marginTop:"1.5rem"},children:[(0,d.jsxs)("div",{className:"video-preview-canvas",style:(0,i.A)((0,i.A)({},"9:16"===xe?{width:"315px",height:"560px",maxWidth:"100%"}:"1:1"===xe?{width:"400px",height:"400px",maxWidth:"100%"}:{width:"100%",aspectRatio:"16/9"}),{},{margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",position:"relative"}),children:[D[Ue]&&(0,d.jsx)("img",{src:D[Ue],alt:"Preview ".concat(Ue+1),className:"preview-image ".concat(Re?"effect-".concat(fe):""),style:{width:"100%",height:"100%",objectFit:"cover","--effect-duration":"".concat(Oe,"s"),zIndex:1}},"current-".concat(Ue)),"food"===L&&Re&&(0,d.jsx)("div",{style:{position:"absolute",bottom:"20%",left:"5%",background:"rgba(220, 38, 38, 0.9)",color:"white",padding:"0.5rem 1rem",borderRadius:"8px",fontWeight:"bold",fontSize:"0.9rem",zIndex:2,boxShadow:"0 4px 6px rgba(0,0,0,0.1)"},children:"GI\xc1 C\u1ef0C S\u1ed0C"}),"real_estate"===L&&Re&&(0,d.jsx)("div",{style:{position:"absolute",top:"10%",left:"0",width:"100%",background:"rgba(0,0,0,0.6)",color:"#facc15",padding:"0.5rem 1rem",fontWeight:"bold",fontSize:"0.9rem",zIndex:2},children:"\ud83c\udf1f V\u1eca TR\xcd \u0110\u1eaeC \u0110\u1ecaA"}),Ne&&Re&&O.trim()&&Le>0&&(()=>{const e=O.replace(/\[.*?\]/g,"").replace(/<.*?>
1/g,"").trim().split(/\s+/).filter(Boolean);if(0===e.length)return null;const t=e.length/Le,n=Math.floor(Ee*t),i=4*Math.floor(n/4),s=Math.min(i+4,e.length),a=e.slice(i,s),l=n-i;return 0===a.length?null:(0,d.jsx)("div",{style:{position:"absolute",bottom:"32px",left:"50%",transform:"translateX(-50%)",zIndex:10,background:"rgba(0, 0, 0, 0.7)",padding:"8px 16px",borderRadius:"8px",maxWidth:"85%",textAlign:"center",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a.map(((e,t)=>{let n="#ffffff",i="normal",s="none";switch(je){case"highlight":const a=ee.some((t=>e.toLowerCase().includes(t.toLowerCase())));t===l?(n="#facc15",i="bold"):n=t<l?a?"#facc15":"#ffffff":a?"rgba(250, 204, 21, 0.5)":"rgba(255, 255, 255, 0.5)";break;case"bounce":if(t===l){n="#facc15",i="bold";const e=8*Ee%1,t=4*Math.sin(e*Math.PI);s="translateY(".concat(-t,"px)")}break;case"typewriter":t>l&&(n="transparent");break;case"karaoke":t<l?n="#facc15":t===l?(n="#facc15",i="bold"):n="rgba(255, 255, 255, 0.3)"}return(0,d.jsx)("span",{style:{color:n,fontWeight:i,display:"inline-block",transform:s,transition:"color 0.15s, transform 0.1s",fontSize:"14px",marginRight:t<a.length-1?"5px":"0",fontFamily:'"SF Pro Display", "Segoe UI", Arial, sans-serif'},children:e},t)}))})})(),D.length>1&&(0,d.jsxs)("div",{style:{position:"absolute",bottom:"8px",right:"8px",background:"rgba(0,0,0,0.6)",color:"#fff",padding:"4px 8px",borderRadius:"4px",fontSize:"12px",zIndex:11},children:[Ue+1," / ",D.length]})]}),(0,d.jsxs)("div",{className:"video-preview-controls",children:[(0,d.jsx)("button",{className:"play-button",onClick:()=>{if(!de)return;if(Re&&Qe.current)return Qe.current.pause(),void Be(!1);const e=new Audio("data:".concat(ge,";base64,").concat(de));Qe.current=e,e.onloadedmetadata=()=>{_e(e.duration)},e.ontimeupdate=()=>{const t=e.currentTime,n=e.duration||1;if(De(t/n*100),Fe(t),D.length>0){const e=((e,t)=>t<=0?e:e/t)(n,D.length);Ze(e);const i=Math.min(Math.floor(t/e),D.length-1);Ve(i)}},e.onended=()=>{Be(!1),De(0),Fe(0),Ve(0),Ke(-1),qe(!1)},e.play(),Be(!0)},children:Re?"\u23f8":"\u25b6"}),(0,d.jsx)("div",{className:"progress-bar",children:(0,d.jsx)("div",{className:"progress-bar-fill",style:{width:"".concat(ze,"%"),transition:"width 0.1s linear"}})}),Le>0&&(0,d.jsxs)("div",{style:{color:"#6b7280",fontSize:"12px",marginLeft:"8px",minWidth:"80px"},children:[Math.floor(ze/100*Le),"s / ",Math.floor(Le),"s"]})]})]}),(0,d.jsx)("div",{className:"export-buttons",style:{marginTop:"1.5rem"},children:(0,d.jsx)("button",{className:"export-button primary ".concat(Me?"loading":""),onClick:async()=>{if(de&&0!==D.length){Pe(!0),Xe(null);try{const e=()=>{switch(xe){case"9:16":return{width:720,height:1280};case"1:1":return{width:720,height:720};default:return{width:1280,height:720}}},{width:t,height:n}=e(),i=document.createElement("canvas");i.width=t,i.height=n;const s=i.getContext("2d"),a=await Promise.all(D.map((e=>new Promise(((t,n)=>{const i=new Image;i.crossOrigin="anonymous",i.onload=()=>t(i),i.onerror=n,i.src=e}))))),l=new Audio("data:".concat(ge,";base64,").concat(de));await new Promise((e=>{l.onloadedmetadata=e,l.onerror=()=>e()}));const o=(l.duration||10)+1,r=o+(Se?3:0),c=o/D.length,d=30,h=Math.ceil(r*d),g=i.captureStream(d),m=new(window.AudioContext||window.webkitAudioContext),u=await fetch("data:".concat(ge,";base64,").concat(de)),p=await u.arrayBuffer(),x=await m.decodeAudioData(p),v=m.createMediaStreamDestination(),f=m.createBufferSource();f.buffer=x,f.connect(v),g.addTrack(v.stream.getAudioTracks()[0]);const b=new MediaRecorder(g,{mimeType:"video/webm;codecs=vp9,opus",videoBitsPerSecond:5e6}),j=[];b.ondataavailable=e=>{e.data.size>0&&j.push(e.data)};const y=($||O.replace(/\[.*?\]/g,"").replace(/<.*?>/g,"")).trim().split(/\s+/).filter(Boolean),N=y.length/r,w=(e,i,a,l)=>{s.save(),s.fillStyle="#000",s.fillRect(0,0,t,n);const o=e.width/e.height;let r,c;o>t/n?(c=n,r=c*o):(r=t,c=r/o);let d=(t-r)/2,h=d,g=(n-c)/2;switch(fe){case"zoom-in":const e=1+.15*a;r*=e,c*=e,h=(t-r)/2,g=(n-c)/2;break;case"zoom-out":const i=1.15-.15*a;r*=i,c*=i,h=(t-r)/2,g=(n-c)/2;break;case"pan-left":h=d+.05*t*(1-2*a);break;case"pan-right":h=d-.05*t*(1-2*a)}if(s.drawImage(e,h,g,r,c),"food"===L&&a>.2){const e=Math.min(5*(a-.2),1),i=.08*n,l=.5*t,o=.05*t,r=.08*n,c=Math.round(.045*t),d=n-r-(1.4*c+c)-i-20+50*(1-e);s.globalAlpha=e,s.fillStyle="rgba(220, 38, 38, 0.9)",s.beginPath(),s.roundRect(o,d,l,i,10),s.fill(),s.fillStyle="white",s.font="bold ".concat(.5*i,'px "SF Pro Display"'),s.textAlign="center",s.textBaseline="middle",s.fillText("GI\xc1 C\u1ef0C S\u1ed0C",o+l/2,d+i/2),s.globalAlpha=1}else if("real_estate"===L){const e=Math.min(3*a,1),i=.08*n,l=.1*n-30*(1-e);
1s.globalAlpha=e,s.fillStyle="rgba(0,0,0,0.6)",s.fillRect(0,l,t,i),s.fillStyle="#facc15",s.font="bold ".concat(.5*i,'px "SF Pro Display"'),s.textAlign="left",s.textBaseline="middle",s.fillText("\ud83c\udf1f V\u1eca TR\xcd \u0110\u1eaeC \u0110\u1ecaA",.05*t,l+i/2),s.globalAlpha=1}if(Ne&&y.length>0){const e=Math.round(.045*t),i=1.4*e,a=.85*t,o=.08*n,r=Math.floor(l*N),c=4,d=Math.floor(r/c),h=d*c,g=Math.min(h+c,y.length),m=y.slice(h,g),u=r-h;if(m.length>0){s.font="bold ".concat(e,'px "SF Pro Display", "Segoe UI", Arial, sans-serif'),s.textAlign="center",s.textBaseline="bottom";const r=m.join(" "),h=s.measureText(r),g=Math.min(h.width,a),p=.5*e,x=i+2*p,v=n-o-x;s.fillStyle="rgba(0, 0, 0, 0.7)";const f=.3*e,b=(t-g)/2-p;s.beginPath(),s.roundRect(b,v,g+2*p,x,f),s.fill();const j=n-o-p;switch(je){case"highlight":let n=(t-g)/2;m.forEach(((e,t)=>{const i=s.measureText(e+" ").width,a=ee.some((t=>e.toLowerCase().includes(t.toLowerCase())));s.fillStyle=t===u?"#facc15":t<u?a?"#facc15":"#ffffff":a?"rgba(250, 204, 21, 0.5)":"rgba(255, 255, 255, 0.5)",s.textAlign="left",s.fillText(e,n,j),n+=i}));break;case"bounce":let i=(t-g)/2;m.forEach(((t,n)=>{const a=s.measureText(t+" ").width;let o=0;if(n===u){const t=8*l%1;o=Math.sin(t*Math.PI)*e*.2,s.fillStyle="#facc15"}else s.fillStyle="#ffffff";s.textAlign="left",s.fillText(t,i,j-o),i+=a}));break;case"typewriter":const a=l-d*(c/N),o=15,h=Math.floor(a*o);let p=m.join(" ").substring(0,h);s.fillStyle="#ffffff",s.textAlign="center",s.fillText(p,t/2,j);break;case"karaoke":s.textAlign="center",s.fillStyle="rgba(255, 255, 255, 0.3)",s.fillText(r,t/2,j);const x=(u+.5)/m.length,v=1.2*g,f=(t-v)/2,b=s.createLinearGradient(f,0,f+v,0);b.addColorStop(0,"#facc15"),b.addColorStop(Math.max(0,x-.1),"#facc15"),b.addColorStop(Math.min(1,x+.1),"rgba(255, 255, 255, 0.3)"),b.addColorStop(1,"rgba(255, 255, 255, 0.3)"),s.fillStyle=b,s.fillText(r,t/2,j);break;default:s.fillStyle="#ffffff",s.textAlign="center",s.fillText(r,t/2,j)}}}s.restore()},S=e=>{s.save();const i=a[a.length-1];if(i){const e=i.width/i.height;let a,l;e>t/n?(l=n,a=l*e):(a=t,l=a/e);const o=(t-a)/2,r=(n-l)/2;s.filter="blur(30px) brightness(0.4)",s.drawImage(i,o,r,a,l)}else s.fillStyle="#111827",s.fillRect(0,0,t,n);s.filter="none",s.globalAlpha=Math.min(6*e,1);const l=n/2-50,o=.15*Math.min(t,n);s.beginPath(),s.arc(t/2,l,o,0,2*Math.PI),s.fillStyle="#4F46E5",s.fill(),s.fillStyle="#ffffff",s.font="bold ".concat(o,'px "SF Pro Display", sans-serif'),s.textAlign="center",s.textBaseline="middle";const r=Ae?Ae.charAt(0).toUpperCase():"A";s.fillText(r,t/2,l),s.font="bold ".concat(.6*o,'px "SF Pro Display", sans-serif'),s.fillText(Ae||"AutoWork",t/2,l+o+40);const c=.6*t,d=.6*o,h=l+o+100;s.beginPath(),s.roundRect((t-c)/2,h,c,d,d/2),s.fillStyle="#ef4444",s.fill(),s.fillStyle="#ffffff",s.font="bold ".concat(.4*d,'px "SF Pro Display", sans-serif'),s.fillText(Ce||"\u0110\u0103ng k\xfd ngay!",t/2,h+d/2),s.restore()};let k=0;const A=new Promise((e=>{b.onstop=()=>{const t=new Blob(j,{type:"video/webm"}),n=URL.createObjectURL(t),i=document.createElement("a");i.href=n,i.download="video_".concat(Date.now(),".webm"),document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(n),e()}}));b.start(),f.start();const T=()=>{if(k>=h)return b.stop(),void m.close();const e=k/d;if(Se&&e>=o){S((e-o)/3)}else{const t=Math.min(Math.floor(e/c),a.length-1),n=t*c,i=Math.min((e-n)/c,1);w(a[t],e/o,i,e)}k++,k<h?setTimeout(T,1e3/d):setTimeout((()=>{b.stop(),m.close()}),100)};T(),await A}catch(e){console.error("Export error:",e),Xe((0,l._0)(e,"L\u1ed7i xu\u1ea5t video"))}finally{Pe(!1)}}else Xe("C\u1ea7n c\xf3 audio v\xe0 h\xecnh \u1ea3nh \u0111\u1ec3 xu\u1ea5t video")},disabled:!de||Me,style:{width:"100%",minHeight:"48px"},children:Me?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"spinner"}),(0,d.jsx)("span",{children:"\u0110ang xu\u1ea5t video..."})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a.a4x,{}),(0,d.jsx)("span",{children:"T\u1ea3i video"})]})})})]})]})]})},z=e=>{let{initialMode:t="quick"}=e;const[n,l]=(0,s.useState)(t),[o,r]=(0,s.useState)([]),[c,h]=(0,s.use
1State)(null),g=(0,s.useCallback)(((e,t)=>{var n,s;const a=e?(0,i.A)((0,i.A)({},e),{},{settings:(0,i.A)((0,i.A)({suggestedSpeed:1.1},e.settings),{},{suggestedSpeed:null!==(n=null===(s=e.settings)||void 0===s?void 0:s.suggestedSpeed)&&void 0!==n?n:1.1})}):e;h(a),r(t),l("advanced")}),[]),m=e=>{l(e)};return(0,d.jsxs)("div",{className:"video-creator-container",children:[(0,d.jsxs)("div",{className:"video-creator-header",children:[(0,d.jsxs)("h1",{className:"video-creator-title",children:[(0,d.jsx)(a.pVQ,{style:{marginRight:"0.5rem"}}),"T\u1ea1o Video AI"]}),(0,d.jsx)("p",{className:"video-creator-subtitle",children:"T\u1ea1o video qu\u1ea3ng c\xe1o chuy\xean nghi\u1ec7p t\u1eeb h\xecnh \u1ea3nh c\u1ee7a b\u1ea1n"})]}),(0,d.jsxs)("div",{className:"mode-switcher-container",children:[(0,d.jsxs)("div",{className:"mode-switcher",children:[(0,d.jsxs)("button",{className:"mode-button ".concat("quick"===n?"active":""),onClick:()=>m("quick"),children:[(0,d.jsx)(a.FrA,{}),(0,d.jsx)("span",{children:"Nhanh"})]}),(0,d.jsxs)("button",{className:"mode-button ".concat("advanced"===n?"active":""),onClick:()=>m("advanced"),children:[(0,d.jsx)(a.ou6,{}),(0,d.jsx)("span",{children:"N\xe2ng cao"})]})]}),(0,d.jsx)("div",{className:"mode-description-text",children:"quick"===n?(0,d.jsxs)("span",{children:["\u26a1 ",(0,d.jsx)("strong",{children:"Ch\u1ebf \u0111\u1ed9 Nhanh:"})," AI t\u1ef1 vi\u1ebft k\u1ecbch b\u1ea3n thuy\u1ebft minh, l\u1ed3ng ti\u1ebfng v\xe0 t\u1ef1 \u0111\u1ed9ng t\u1ea1o video trong 10 gi\xe2y."]}):(0,d.jsxs)("span",{children:["\ud83c\udf9b\ufe0f ",(0,d.jsx)("strong",{children:"Ch\u1ebf \u0111\u1ed9 N\xe2ng cao:"})," T\xf9y ch\u1ec9nh chi ti\u1ebft k\u1ecbch b\u1ea3n, l\u1ef1a ch\u1ecdn ch\xednh x\xe1c gi\u1ecdng \u0111\u1ecdc v\xe0 hi\u1ec7u \u1ee9ng chuy\u1ec3n c\u1ea3nh."]})})]}),"quick"===n?(0,d.jsx)(w,{onComplete:g,existingImages:o,defaultSpeed:1.1}):(0,d.jsx)(F,{initialImages:o,initialResult:c,onReset:()=>{r([]),h(null)}})]})}},4474:(e,t,n)=>{n.d(t,{A:()=>a});n(9950);var i=n(6339),s=n(4414);const a=e=>{let{label:t="Chi ph\xed d\u1ef1 ki\u1ebfn",value:n,details:a=[],className:l=""}=e;
1const o=Array.isArray(a)?a.filter(Boolean):[a].filter(Boolean);return n?(0,s.jsxs)("div",{className:"w-full rounded-lg border border-green-300 bg-green-50 px-4 py-2.5 ".concat(l),children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center justify-center gap-2 text-center",children:[(0,s.jsx)(i.lZI,{className:"h-4 w-4 flex-shrink-0 text-green-600"}),(0,s.jsxs)("p",{className:"min-w-0 text-sm text-gray-600 sm:text-base",children:[t,":"," ",(0,s.jsx)("strong",{className:"font-semibold text-green-700",children:n})]})]}),o.length>0&&(0,s.jsx)("p",{className:"mt-1 text-center text-xs text-gray-500",children:o.join(" \u2022 ")})]}):null}},4716:(e,t,n)=>{n.d(t,{_p:()=>r});var i=n(1002),s=n(7884);function a(e){var t,n,i,s;const a=(null===e||void 0===e||null===(t=e.response)||void 0===t||null===(n=t.data)||void 0===n?void 0:n.error)||(null===e||void 0===e||null===(i=e.response)||void 0===i||null===(s=i.data)||void 0===s?void 0:s.code)||(null===e||void 0===e?void 0:e.code)||(null===e||void 0===e?void 0:e.message)||"",l=String(a);if(l.includes("FILE_TOO_LARGE")){const e=new Error("File qu\xe1 l\u1edbn. \u1ea2nh: \u22642MB (FB/Zalo CN), \u22641MB khi Zalo OA; video theo g\xf3i (150MB/250MB).");return e.code="FILE_TOO_LARGE",e}return e instanceof Error?e:new Error(l||"UPLOAD_FAILED")}function l(e){const t=String((null===e||void 0===e?void 0:e.type)||"").toLowerCase();if(t.startsWith("image/"))return!0;if(t.startsWith("video/"))return!1;const n=String((null===e||void 0===e?void 0:e.name)||"").toLowerCase();return!!/\.(jpe?g|png|webp|gif|bmp)$/i.test(n)||(/\.(mp4|webm|mov|avi|m4v|qt)$/i.test(n),!1)}async function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)throw new Error("UPLOAD_FILE_MISSING");if(!l(e))return e;return function(e){if(null!==e&&void 0!==e&&e.type)return e;const t=(null===e||void 0===e?void 0:e.name)||"image-".concat(Date.now(),".jpg");return new File([e],t,{type:"image/jpeg",lastModified:Date.now()})}(await(0,s.ZN)(e,t))}async function r(e,t,n){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=l(e);let c=e;try{c=await o(e,s)}catch(g){const e=a(g);throw console.error("[S3] Image prepare failed:",e.message),e}try{const e=c.type||(r?"image/jpeg":"application/octet-stream"),{data:n}=await i.default.post("/api/upload/s3-presigned-url",{userId:t,filename:c.name||"file-".concat(Date.now()),contentType:e,fileSize:c.size,purpose:(null===s||void 0===s?void 0:s.purpose)||(null===s||void 0===s?void 0:s.category)},{timeout:2e4});if(null!==n&&void 0!==n&&n.success&&n.uploadUrl){var d;const s=await fetch(n.uploadUrl,{method:"PUT",headers:{"Content-Type":e},body:c});if(!s.ok)throw new Error("S3 PUT failed: ".concat(s.status));const l=await i.default.post("/api/upload/s3-finalize",{userId:t,key:n.key||n.storageKey,contentType:e,fileSize:c.size},{timeout:2e4});var h;if(null===(d=l.data)||void 0===d||!d.success)throw a({message:(null===(h=l.data)||void 0===h?void 0:h.error)||"S3_FINALIZE_FAILED",response:{data:l.data}});return{success:!0,url:l.data.fileUrl,storageProvider:l.data.storageProvider,storageKey:l.data.storageKey}}throw a({message:(null===n||void 0===n?void 0:n.error)||"BE_PROXY_RETURNED_ERROR",response:{data:n}})}catch(m){const e=a(m);if(!r&&"function"===typeof n)return console.warn("[S3] Presigned upload failed (non-image), falling back to legacy:",e.message),n();throw console.error("[S3] Presigned upload failed with no fallback:",e.message),e}}}}]);

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.