import{B as e,F as t,H as n,L as r,M as i,N as a,P as o,Q as s,St as c,Tt as l,at as u,c as d,et as f,ht as p,l as m,o as h,ot as g,p as _,q as v,s as y,st as b,t as x,v as S,w as C,xt as w,z as T}from"./_plugin-vue_export-helper-Df3QK1RS.js";import{f as E,i as D,l as O}from"./ui3n-utils-CqOydih4.js";import{t as k}from"./file-type-aOyXu6tE.js";var A=x(n({__name:`upload-files-dialog`,props:{currentFolder:{},dialogProps:{}},emits:[`action`],setup(n,{emit:x}){let A=h,j=n,M=x,{t:N}=C(),P=p({}),F=p(!1),I=p(0),L=p({}),R=a(()=>j.currentFolder?j.currentFolder.replaceAll(`/`,` / `):`Home`),z=a(()=>Object.keys(L.value).reduce((e,t)=>{let n=P.value[t].size*L.value[t]/100;return e+=n,e},0));function B(e,t){e.lengthComputable&&(L.value[t]=parseFloat((e.loaded/e.total*100).toFixed(1)))}function V(e){F.value=!0,I.value=[...e].reduce((e,t)=>(e+=t.size,e),0),[...e].forEach(e=>{let t=O(5);if(!P.value[t]){P.value[t]=e;let n=new FileReader,r=new AbortController;n.addEventListener(`loadstart`,e=>B(e,t)),n.addEventListener(`load`,e=>B(e,t)),n.addEventListener(`loadend`,()=>{L.value[t]=100,r.abort()}),n.addEventListener(`progress`,e=>B(e,t)),n.readAsDataURL(e)}})}return u(()=>z.value,()=>{F.value&&z.value===I.value&&M(`action`,{event:`confirm`,data:Object.values(P.value)})}),(a,u)=>(s(),t(w(_),v(n.dialogProps,{onAction:u[0]||=e=>M(`action`,e)}),{body:g(()=>[o(`div`,{class:c(a.$style.uploadFilesDialog)},[F.value?(s(),r(`div`,{key:0,class:c(a.$style.uploading)},[o(`div`,{class:c(a.$style.uploadingHeader)},[o(`div`,{class:c(a.$style.folderName)},l(R.value),3),o(`div`,{class:c(a.$style.totalProgress)},l(I.value===0?0:parseInt((z.value/I.value*100).toFixed(1)))+`% `,3)],2),o(`div`,{class:c(a.$style.uploadingContent)},[(s(!0),r(i,null,f(L.value,(t,n)=>(s(),r(`div`,{key:n,class:c(a.$style.uploadingItem)},[o(`div`,{class:c(a.$style.uploadingItemBody)},[o(`div`,{class:c(a.$style.uploadingItemLabel)},[e(w(m),{icon:`round-subject`,color:`var(--color-icon-table-secondary-default)`}),o(`div`,{class:c(a.$style.uploadingItemName)},l(P.value[n].name),3)],2),e(w(y),{value:t},null,8,[`value`])],2),o(`div`,{class:c(a.$style.uploadingItemType)},[e(k,{"file-type":w(D)(P.value[n].name).toLowerCase()},null,8,[`file-type`])],2),o(`div`,{class:c(a.$style.uploadingItemSize)},l(w(E)(P.value[n].size)),3)],2))),128))],2)],2)):(s(),t(w(S),{key:1,"permanent-display":``,onSelect:V},{"additional-text":g(()=>[o(`div`,{class:c(a.$style.additional)},[o(`span`,{class:c(a.$style.text)},[T(l(w(N)(`dialog.upload_files.text1`))+`: `,1),o(`b`,null,l(n.currentFolder?`/${n.currentFolder}`:`Home`),1)],2),o(`div`,{class:c(a.$style.additionalInfo)},[b(o(`span`,null,null,512),[[w(A),w(N)(`dialog.upload_files.text2`)]]),u[1]||=T(`\xA0 `,-1),e(w(d),{multiple:``,"button-text":w(N)(`app.upload_file`),"onUpdate:modelValue":V},null,8,[`button-text`])],2)],2)]),_:1}))],2)]),_:1},16))}}),[[`__cssModules`,{$style:{uploadFilesDialog:`_uploadFilesDialog_1f40d_1`,uploading:`_uploading_1f40d_10`,uploadingHeader:`_uploadingHeader_1f40d_20`,folderName:`_folderName_1f40d_30`,totalProgress:`_totalProgress_1f40d_40`,uploadingContent:`_uploadingContent_1f40d_47`,uploadingItem:`_uploadingItem_1f40d_54`,uploadingItemBody:`_uploadingItemBody_1f40d_66`,uploadingItemLabel:`_uploadingItemLabel_1f40d_71`,uploadingItemName:`_uploadingItemName_1f40d_80`,uploadingItemType:`_uploadingItemType_1f40d_86`,uploadingItemSize:`_uploadingItemSize_1f40d_94`,additional:`_additional_1f40d_104`,text:`_text_1f40d_108`,additionalInfo:`_additionalInfo_1f40d_116`}}]]);export{A as default};