import{_ as m}from"./plugin-vue_export-helper.21dcd24c.js";import{o as i,f as o,t as n,j as u,i as a,F as g,B as x,J as h}from"./vendor.7e4e5e39.js";const b={props:{modelValue:FileList,label:String,accept:String,error:String},emits:["update:modelValue"],watch:{modelValue(t){t||(this.$refs.file.value="")}},methods:{filesize(t){var e=Math.floor(Math.log(t)/Math.log(1024));return(t/Math.pow(1024,e)).toFixed(2)*1+" "+["B","kB","MB","GB","TB"][e]},browse(){this.$refs.file.click()},change(t){this.$emit("update:modelValue",t.target.files)},remove(t){const e=new DataTransfer;Array.from(this.$refs.file.files).map(function(d,f){f!==t&&e.items.add(d)}),e.files.length?(this.$refs.file.files=e.files,this.$emit("update:modelValue",e.files)):(this.$refs.file.files=null,this.$emit("update:modelValue",null))}}},p=["accept"],_={key:0,class:"py-2"},y={key:1,class:"flex flex-col justify-center max-w-2xl mt-3 p-2 border rounded-md"},v={class:"md:w-5/6 text-sm md:text-base flex-1 pr-2 text-gray flex flex-col"},w={class:"truncate"},k={class:"text-xs text-gray-light"},V=["onClick"],B={key:1,class:"text-red text-sm"};function C(t,e,s,d,f,l){return i(),o("div",null,[s.label?(i(),o("label",{key:0,class:"cursor-pointer text-gray-light text-lg mb-2",onClick:e[0]||(e[0]=(...r)=>l.browse&&l.browse(...r))},n(s.label)+":",1)):u("",!0),a("div",{class:h({error:s.error})},[a("input",{ref:"file",type:"file",accept:s.accept,multiple:"",class:"hidden",onChange:e[1]||(e[1]=(...r)=>l.change&&l.change(...r))},null,40,p),s.modelValue?(i(),o("div",y,[(i(!0),o(g,null,x(s.modelValue,(r,c)=>(i(),o("div",{key:c,class:"flex flex-col md:flex-row md:items-start md:justify-between p-1"},[a("div",v,[a("span",w,n(r.name),1),a("span",k,"("+n(l.filesize(r.size))+")",1)]),a("button",{type:"button",class:"md:w-1/6 px-1 py-1 bg-indigo-300 hover:bg-indigo-100 rounded-sm text-xs font-medium text-white",onClick:F=>l.remove(c)}," \u0423\u0434\u0430\u043B\u0438\u0442\u044C ",8,V)]))),128))])):(i(),o("div",_,[a("button",{type:"button",class:"px-6 py-2 bg-indigo-300 focus:ring-4 focus:ring-offset-1 focus:ring-orange focus:ring-opacity-20 focus:ring-offset-orange focus:outline-none focus:border-transparent rounded-sm text-sm text-white",onClick:e[2]||(e[2]=(...r)=>l.browse&&l.browse(...r))}," \u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0444\u0430\u0439\u043B\u044B ")]))],2),s.error?(i(),o("div",B,n(s.error),1)):u("",!0)])}var S=m(b,[["render",C]]);export{S as F};