import{c as v,i as C,C as $,n as B,h as F}from"./index-BTglIPU2.js?v=1773287522785";import{u as R}from"./useLoop-BadgF3pN.js?v=1773287522785";import{a1 as j,w as P,a2 as N}from"./FileIcon-eIHDRaxH.js?v=1773287522785";import{k as y,al as S,w as V,$ as l,Z as i,n as H,R as I,r as A,c as D,_ as e,a0 as m,a9 as f,aa as a,S as s,j as M,a8 as O,F as q,P as E,ak as G}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{n as U,B as Z,ab as z}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";import"./soft-Cjyfamvm.js?v=1773287522785";import"./copy-D-wIKr0q.js?v=1773287522785";const J=["innerHTML"],K=y({__name:"FileTaskLogs",props:{value:{type:String,default:""}},setup(c){const _=c,p=S("logsRef"),d=()=>{H(()=>{const o=p.value;if(o){const{scrollHeight:t}=o;o.scrollTop=t}})};return V(()=>_.value,()=>{d()},{immediate:!0}),(o,t)=>(l(),i("div",{ref_key:"logsRef",ref:p,class:"task-logs",innerHTML:c.value||o.$t("file.task.noLogs")},null,8,J))}}),Q=v(K,[["__scopeId","data-v-ee8b8ada"]]),W={class:"p-16px"},X={class:"flex items-center justify-between h-36px px-10px rounded-tl-10px rounded-tr-10px bg-#f5f5f5"},Y={class:"max-w-360px"},ee={class:"text-desc text-14px"},se={key:0,class:"p-10px"},te={class:"flex items-center justify-between mt-4px"},ne={class:"flex"},oe={class:"mr-24px"},ae={key:2,class:"mt-10px"},le={class:"flex items-center justify-between h-36px px-10px rounded-tl-10px rounded-tr-10px bg-#f5f5f5"},ie={class:"text-desc text-14px"},ce={class:"flex-1 w-0"},re={class:"min-w-0"},pe={class:"text-weak text-14px"},de=["onClick"],ue=y({__name:"FileTask",props:{taskList:{type:Array,default:()=>[]},store:{type:Object,required:!0}},emits:["close"],setup(c,{emit:_}){const p=_,{t:d}=I(),o=A(c.taskList),t=D(()=>o.value[0]||{log:"",name:"",shell:""}),x=async()=>{const{message:n}=await j();B(n)&&n.length>0?o.value=n:(P(c.store),p("close"))},{loop:g,clearTimer:T}=R(x,2);g();const w=async()=>{T(),await x(),g()},k=n=>{F({title:d("file.task.deleteTask"),content:d("file.task.confirmDeleteTask",{name:n.name,shell:n.shell}),onConfirm:async()=>{await N(n.id),w()}})};return(n,u)=>{const h=U,b=Z,L=z;return l(),i("div",W,[e("div",X,[e("div",Y,[m(h,null,{default:f(()=>[e("span",ee,a(s(t).name+n.$t("Public.Punctuation.Colon")+s(t).shell),1)]),_:1})]),m(b,{type:"primary",text:"",onClick:u[0]||(u[0]=r=>k(s(t)))},{default:f(()=>[M(a(n.$t("Public.Btn.Cancel")),1)]),_:1})]),s(C)(s(t).log)?(l(),i("div",se,[m(L,{type:"line",height:3,"show-indicator":!1,percentage:s(t).log.pre||0},null,8,["percentage"]),e("div",te,[e("span",ne,[e("span",oe,a(s(t).log.used)+" / "+a(s($)(s(t).log.total)),1),e("span",null,a(n.$t("file.task.estimatedRemaining"))+": "+a(s(t).log.total),1)]),e("span",null,a(s(t).log.speed)+"/s",1)])])):(l(),O(Q,{key:1,value:s(t).log},null,8,["value"])),s(o).length>1?(l(),i("div",ae,[e("div",le,[e("span",ie,a(n.$t("file.task.waitingTasks")),1)]),(l(!0),i(q,null,E(s(o).slice(1),r=>(l(),i("div",{key:r.id,class:"flex items-center h-36px px-10px"},[e("div",ce,[e("div",re,[m(h,null,{default:f(()=>[e("span",pe,a(r.name+n.$t("Public.Punctuation.Colon")+r.shell),1)]),_:2},1024)])]),e("div",{class:"flex items-center ml-12px cursor-pointer",onClick:me=>k(r)},u[1]||(u[1]=[e("i",{class:"i-streamline:delete-1-solid text-10px text-error"},null,-1)]),8,de)]))),128))])):G("",!0)])}}}),Te=v(ue,[["__scopeId","data-v-93cb7b82"]]);export{Te as default};
