"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),b={class:"file-upload__container"},j=["accept","multiple"],w=t.defineComponent({__name:"v-file-drop",props:{accept:{default:()=>[]},multiple:{type:Boolean,default:!1}},emits:["change"],setup(i,{emit:u}){const c=i,s=t.inject("VFileDropOptions",{accept:void 0,multiple:void 0}),{accept:p,multiple:d}=s,n=t.computed(()=>p||c.accept),f=t.computed(()=>d||c.multiple),r=t.ref(),D=t.computed(()=>f.value?r.value:r.value[0]);function m(){u("change",D.value)}const T=t.computed(()=>n.value.length?typeof n.value=="string"?n.value:n.value.join(","):"");function _(e){const l=e.type;return n.value.length?typeof n.value=="string"?l===n.value:n.value.includes(l):!0}function F(e){const l=e.target;l.files&&(r.value=l.files,m())}function V(e){var l,v,h,g;if(e.preventDefault(),!!e.dataTransfer){if(r.value=[],!f.value&&(((v=(l=e.dataTransfer)==null?void 0:l.items)==null?void 0:v.length)>1||((g=(h=e==null?void 0:e.dataTransfer)==null?void 0:h.files)==null?void 0:g.length)>1)&&console.warn("Only one file is allowed. Please add the 'multiple' prop on the component to allow multiple files."),e.dataTransfer.items){for(const o of[...e.dataTransfer.items])if(o.kind==="file"){const a=o.getAsFile();if(a&&!_(a)){console.error(`The file ${a.name} is not allowed. Please add the '${a.type}' mime type to the 'accept' prop on the component.`);return}a&&r.value.push(a)}}else for(const o of[...e.dataTransfer.files]){if(o&&!_(o)){console.error(`The file ${o.name} is not allowed. Please add the '${o.type}' mime type to the 'accept' prop on the component.`);return}o&&r.value.push(o)}m()}}function O(e){e.preventDefault()}return(e,l)=>(t.openBlock(),t.createElementBlock("div",b,[t.createElementVNode("input",{class:"file-upload__input",onChange:F,type:"file",id:"upload-file",accept:T.value,multiple:f.value},null,40,j),t.createElementVNode("div",null,[t.renderSlot(e.$slots,"default",{},void 0,!0)]),t.createElementVNode("label",{onDrop:V,onDragover:O,class:"file-upload__label",for:"upload-file"},null,32)]))}});const k=(i,u)=>{const c=i.__vccOpts||i;for(const[s,p]of u)c[s]=p;return c},y=k(w,[["__scopeId","data-v-7c98bff5"]]),M={install:(i,u)=>{i.component("VFileDrop",y),i.provide("VFileDropOptions",u)}};exports.VFileDrop=y;exports.default=M;