Files
uno-click/site/.next/server/app/uniqueizer/page.js
T
2026-05-13 14:20:41 +00:00

1 line
11 KiB
JavaScript

(()=>{var e={};e.id=167,e.ids=[167],e.modules={2934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},4580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},5869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},9912:(e,t,i)=>{"use strict";i.r(t),i.d(t,{GlobalError:()=>s.a,__next_app__:()=>u,originalPathname:()=>c,pages:()=>p,routeModule:()=>x,tree:()=>l}),i(8686),i(1506),i(5866);var r=i(3191),n=i(8716),o=i(7922),s=i.n(o),a=i(5231),d={};for(let e in a)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(d[e]=()=>a[e]);i.d(t,d);let l=["",{children:["uniqueizer",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(i.bind(i,8686)),"/opt/uno-click/site/app/uniqueizer/page.tsx"]}]},{}]},{layout:[()=>Promise.resolve().then(i.bind(i,1506)),"/opt/uno-click/site/app/layout.tsx"],"not-found":[()=>Promise.resolve().then(i.t.bind(i,5866,23)),"next/dist/client/components/not-found-error"]}],p=["/opt/uno-click/site/app/uniqueizer/page.tsx"],c="/uniqueizer/page",u={require:i,loadChunk:()=>Promise.resolve()},x=new r.AppPageRouteModule({definition:{kind:n.x.APP_PAGE,page:"/uniqueizer/page",pathname:"/uniqueizer",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:l}})},4199:()=>{},5305:(e,t,i)=>{Promise.resolve().then(i.bind(i,6880))},9682:(e,t,i)=>{Promise.resolve().then(i.t.bind(i,2994,23)),Promise.resolve().then(i.t.bind(i,6114,23)),Promise.resolve().then(i.t.bind(i,9727,23)),Promise.resolve().then(i.t.bind(i,9671,23)),Promise.resolve().then(i.t.bind(i,1868,23)),Promise.resolve().then(i.t.bind(i,4759,23))},6880:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>d});var r=i(326),n=i(7577),o=i(5047);function s(){let e=(0,o.useRouter)(),t=(0,o.useSearchParams)(),i=(0,n.useRef)(null),s=(0,n.useRef)(null),[d,l]=(0,n.useState)(null),[p,c]=(0,n.useState)(null),[u,x]=(0,n.useState)(!1),[f,h]=(0,n.useState)(0),[g,m]=(0,n.useState)(""),[b,v]=(0,n.useState)(""),[y,j]=(0,n.useState)(null),w=t.get("generationUuid"),[S,P]=(0,n.useState)(w),[k,R]=(0,n.useState)(!1);async function z(){try{let e=await B();j(e)}catch(e){}}async function B(){if(!d)throw Error("Файл не выбран");if(!S)throw Error("generationUuid не получен");x(!0),h(0),v(""),m("Загрузка видео...");try{let e=await q(),t=new FormData;return t.append("file",d),t.append("generationUuid",S),new Promise((i,r)=>{let n=new XMLHttpRequest;n.upload.addEventListener("progress",e=>{if(e.lengthComputable){let t=Math.round(e.loaded/e.total*100);h(t),m(`Загрузка видео... ${t}%`)}}),n.addEventListener("load",()=>{if(201===n.status){let e=JSON.parse(n.responseText);h(100),m("Видео загружено"),x(!1),i(e.data.s3Key)}else{let e="Ошибка загрузки видео";try{e=JSON.parse(n.responseText).message||e}catch(e){}r(Error(e))}}),n.addEventListener("error",()=>{r(Error("Ошибка сети при загрузке"))}),n.open("POST","/api/upload/video"),n.setRequestHeader("x-csrf-token",e),n.withCredentials=!0,n.send(t)})}catch(e){throw v(e instanceof Error?e.message:"Ошибка загрузки"),x(!1),e}}async function C(){v("");try{if(!S)throw Error("generationUuid не получен");let t=y;t||(x(!0),m("Загрузка видео..."),t=await B(),j(t),x(!1)),m("Видео отправлено на обработку");let i=await q(),r={input:{url:t}},n=await fetch("/api/scenario/uniqueizer/step/1",{method:"POST",headers:{"Content-Type":"application/json","x-csrf-token":i},credentials:"same-origin",body:JSON.stringify(r)});if(!n.ok){let e=await n.json();throw Error(e.message||"Ошибка выполнения шага")}setTimeout(()=>{e.push(`/result?generationUuid=${S}`)},1e3)}catch(e){v(e instanceof Error?e.message:"Ошибка обработки"),x(!1)}}async function q(){let e=await fetch("/api/auth/csrf",{credentials:"same-origin"});return(await e.json()).csrfToken||""}return r.jsx("div",{style:a.page,children:r.jsx("div",{style:a.container,children:(0,r.jsxs)("div",{style:a.card,children:[r.jsx("h1",{style:a.title,children:"Уникализация видео"}),b&&r.jsx("div",{style:a.error,children:b}),g&&r.jsx("div",{style:a.status,children:r.jsx("span",{children:g})}),!k&&(0,r.jsxs)("div",{style:a.infoBox,children:[r.jsx("span",{style:a.spinner}),"Запуск сценария..."]}),k&&!b&&(0,r.jsxs)("div",{style:a.infoBox,children:["✓ Сценарий запущен (ID: ",S?.slice(0,8),"...)"]}),(0,r.jsxs)("div",{style:a.section,children:[r.jsx("h2",{style:a.sectionTitle,children:"1. Загрузите видео"}),d?(0,r.jsxs)("div",{style:a.filePreview,children:[r.jsx("video",{src:p,controls:!0,style:a.previewVideo}),(0,r.jsxs)("div",{style:a.filePreviewInfo,children:[r.jsx("div",{style:a.filePreviewName,children:d.name}),r.jsx("div",{children:function(e){if(0===e)return"0 Bytes";let t=Math.floor(Math.log(e)/Math.log(1024));return Math.round(e/Math.pow(1024,t)*100)/100+" "+["Bytes","KB","MB","GB"][t]}(d.size)})]}),r.jsx("button",{type:"button",onClick:function(){l(null),c(null),j(null),i.current&&(i.current.value="")},style:a.fileRemove,disabled:u,children:"\xd7"})]}):(0,r.jsxs)("div",{ref:s,style:a.fileUpload,onClick:()=>i.current?.click(),children:[r.jsx("input",{ref:i,type:"file",accept:"video/mp4,video/quicktime,video/x-msvideo,video/webm",onChange:function(e){e.target.files?.length&&function(e){if(!["video/mp4","video/quicktime","video/x-msvideo","video/webm"].includes(e.type)){v("Недопустимый тип файла. Разрешены: MP4, MOV, AVI, WebM");return}if(e.size>524288e3){v("Файл слишком большой. Максимум: 500MB");return}l(e),c(URL.createObjectURL(e)),v(""),j(null)}(e.target.files[0])},style:{display:"none"}}),r.jsx("div",{style:a.fileUploadIcon,children:"\uD83C\uDFAC"}),r.jsx("div",{style:a.fileUploadText,children:"Нажмите для загрузки или перетащите файл"}),r.jsx("div",{style:a.fileUploadHint,children:"MP4, MOV, AVI, WebM до 500MB"})]}),d&&!y&&(0,r.jsxs)("div",{children:[u&&f>0&&(0,r.jsxs)("div",{style:a.progressContainer,children:[r.jsx("div",{style:{...a.progressBar,width:`${f}%`}}),(0,r.jsxs)("span",{style:a.progressText,children:[f,"%"]})]}),r.jsx("button",{onClick:z,disabled:u||!k,style:{...a.btn,...a.btnPrimary,...u||!k?a.btnDisabled:{}},children:u?"Загрузка...":"Загрузить видео"})]})]}),(y||d)&&(0,r.jsxs)("div",{style:a.section,children:[r.jsx("h2",{style:a.sectionTitle,children:"2. Уникализируйте"}),r.jsx("p",{style:a.sectionDesc,children:"После нажатия видео будет отправлено на обработку"}),r.jsx("button",{onClick:C,disabled:u||!k,style:{...a.btn,...a.btnPrimary,...u||!k?a.btnDisabled:{}},children:u?"Загрузка...":"Уникализировать"})]}),r.jsx("button",{onClick:function(){e.push("/dashboard")},style:a.btnSecondary,children:"Закрыть"})]})})})}let a={page:{minHeight:"100vh",background:"#f5f5f5",display:"flex",alignItems:"center",justifyContent:"center",padding:"40px 20px"},container:{maxWidth:"700px",width:"100%"},emptyState:{textAlign:"center",padding:"60px 20px",color:"#666",fontSize:"16px"},card:{background:"white",padding:"40px",borderRadius:"8px",boxShadow:"0 2px 10px rgba(0,0,0,0.1)"},title:{fontSize:"24px",fontWeight:600,marginBottom:"24px",color:"#333",textAlign:"center"},infoBox:{display:"flex",alignItems:"center",gap:"10px",padding:"12px",background:"#e8f5e9",color:"#2e7d32",borderRadius:"6px",marginBottom:"20px",fontSize:"14px"},section:{marginBottom:"32px",padding:"20px",background:"#f8f9fa",borderRadius:"8px"},sectionTitle:{fontSize:"16px",fontWeight:600,color:"#333",marginBottom:"8px"},sectionDesc:{fontSize:"14px",color:"#666",marginBottom:"16px"},fileUpload:{border:"2px dashed #ddd",borderRadius:"8px",padding:"40px 20px",textAlign:"center",cursor:"pointer",transition:"all 0.2s"},fileUploadIcon:{fontSize:"48px",marginBottom:"16px"},fileUploadText:{fontSize:"16px",color:"#666",marginBottom:"8px"},fileUploadHint:{fontSize:"13px",color:"#999"},filePreview:{position:"relative",marginBottom:"16px"},previewVideo:{width:"100%",maxHeight:"400px",borderRadius:"8px",background:"#000"},filePreviewInfo:{padding:"12px",background:"#fff",borderRadius:"6px",marginTop:"8px",fontSize:"14px",color:"#666"},filePreviewName:{fontWeight:500,color:"#333",marginBottom:"4px"},fileRemove:{position:"absolute",top:"8px",right:"8px",background:"rgba(220, 38, 38, 0.9)",color:"white",border:"none",borderRadius:"50%",width:"32px",height:"32px",fontSize:"20px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},btn:{width:"100%",padding:"14px 24px",borderRadius:"6px",fontSize:"15px",fontWeight:500,cursor:"pointer",border:"none",transition:"all 0.2s"},btnPrimary:{background:"#007bff",color:"white"},btnDisabled:{background:"#ccc",cursor:"not-allowed"},btnSecondary:{width:"100%",padding:"12px 24px",background:"#f5f5f5",color:"#333",border:"1px solid #ddd",borderRadius:"6px",fontSize:"14px",fontWeight:500,cursor:"pointer"},error:{background:"#fee",color:"#c00",padding:"12px",borderRadius:"6px",marginBottom:"20px",fontSize:"14px"},status:{display:"flex",alignItems:"center",gap:"10px",padding:"12px",background:"#e7f3ff",color:"#0066cc",borderRadius:"6px",marginBottom:"20px",fontSize:"14px"},spinner:{display:"inline-block",width:"16px",height:"16px",border:"2px solid rgba(0,123,255,0.3)",borderTopColor:"#007bff",borderRadius:"50%",animation:"spin 1s linear infinite"},progressContainer:{position:"relative",height:"24px",background:"#e0e0e0",borderRadius:"12px",marginBottom:"12px",overflow:"hidden"},progressBar:{height:"100%",background:"linear-gradient(90deg, #007bff, #0056b3)",borderRadius:"12px",transition:"width 0.3s ease"},progressText:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",fontSize:"13px",fontWeight:"600",color:"#333"}};function d(){return r.jsx(n.Suspense,{fallback:r.jsx("div",{style:a.page,children:r.jsx("div",{style:a.container,children:r.jsx("div",{style:a.emptyState,children:"Загрузка..."})})}),children:r.jsx(s,{})})}},5047:(e,t,i)=>{"use strict";var r=i(7389);i.o(r,"useRouter")&&i.d(t,{useRouter:function(){return r.useRouter}}),i.o(r,"useSearchParams")&&i.d(t,{useSearchParams:function(){return r.useSearchParams}})},1506:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>o,metadata:()=>n});var r=i(9510);i(7272);let n={title:"Uno Click",description:"Uno Click - платформа для генерации контента"};function o({children:e}){return r.jsx("html",{lang:"ru",children:r.jsx("body",{children:e})})}},8686:(e,t,i)=>{"use strict";i.r(t),i.d(t,{default:()=>r});let r=(0,i(8570).createProxy)(String.raw`/opt/uno-click/site/app/uniqueizer/page.tsx#default`)},7272:()=>{}};var t=require("../../webpack-runtime.js");t.C(e);var i=e=>t(t.s=e),r=t.X(0,[819],()=>i(9912));module.exports=r})();