(function(l,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(l=typeof globalThis<"u"?globalThis:l||self,e(l.VueImageInput={},l.Vue))})(this,function(l,e){"use strict";const s=(t,r)=>{const d=t.__vccOpts||t;for(const[c,a]of r)d[c]=a;return d},u=["accept","required"],m=["src"],p=s({__name:"VueImageInput",props:{title:{type:String,default:"Drop here"},required:{type:Boolean,default:!1},fontSize:{type:String,default:""},size:{type:String,default:""},background:{type:String,default:""},textColor:{type:String,default:""},border:{type:String,default:""},borderColor:{type:String,default:""},mimes:{type:String,default:".jpg,.png"},imageRounded:{type:String,default:""},closeBtnColor:{type:String,default:""},closeBtn:{type:String,default:""},bgRounded:{type:String,default:""},padding:{type:String,default:""},paddingLeft:{type:String,default:""},paddingRight:{type:String,default:""},paddingTop:{type:String,default:""},paddingBottom:{type:String,default:""},paddingX:{type:String,default:""},paddingY:{type:String,default:""}},setup(t,{emit:r}){const d=r,c=t,a=e.ref(""),o=e.ref(null),g=e.ref(null),y=e.computed(()=>"w"+c.size.slice(4)),S=n=>{o.value=n.target.files[0],d("update:file",[o.value]),f()},b=()=>{g.value.click()},f=()=>{const n=new FileReader;n.onload=i=>{a.value=i.target.result},o.value&&n.readAsDataURL(o.value)},k=()=>{d("update:file",[]),a.value="",o.value=null},$=n=>{n.preventDefault(),o.value=n.dataTransfer.files[0],f(),d("update:file",[o.value])};return(n,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(`${y.value} container ${t.border}`),style:e.normalizeStyle(`border-color: ${t.borderColor}; padding: ${t.padding??(t.paddingY??"0")+" "+(t.paddingX??"0")}; padding-left: ${t.paddingLeft}; padding-right: ${t.paddingRight}; padding-top: ${t.paddingTop}; padding-bottom: ${t.paddingBottom}`),onDrop:$,onDragover:i[0]||(i[0]=e.withModifiers(()=>{},["prevent"]))},[a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("input",{class:"input",type:"file",onChange:S,accept:t.mimes,required:t.required,ref_key:"input",ref:g},null,40,u),e.createElementVNode("button",{onClick:e.withModifiers(b,["prevent"]),class:e.normalizeClass(`${t.size} btn`),style:e.normalizeStyle(`background: ${t.background}; color: ${t.textColor}; font-size: ${t.fontSize}; border-radius: ${t.bgRounded}`)},e.toDisplayString(t.title),7)],64)),a.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("img",{src:a.value,class:"w-full image",style:e.normalizeStyle(`border-radius: ${t.imageRounded}`)},null,12,m),e.createElementVNode("div",{onClick:k,class:"close",ref:"close"},[e.createElementVNode("div",{class:"close-before",style:e.normalizeStyle(`background: ${t.closeBtnColor}`),ref:"closeBefore"},null,4),e.createElementVNode("div",{class:"close-after",style:e.normalizeStyle(`background: ${t.closeBtnColor}`),ref:"closeAfter"},null,4)],512)],64)):e.createCommentVNode("",!0)],38))}},[["__scopeId","data-v-f88a0c92"]]);l.VueImageInput=p,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});