import{D as e,U as a,X as t,I as d}from"./index.57b723e8.js";import{bG as l,e as o,a5 as p,X as s,a3 as i}from"./index.9313841a.js";import{_ as n}from"./plugin-vue_export-helper.21dcd24c.js";var r=n({components:{Dashboard:e},props:{endpoint:{type:String,default:()=>({}.API_URL+"/file")},headers:{type:Object,default:()=>({auth:l.get("token")})},types:{type:Array,default:null},path:{type:String,default:"files"},maxNumberOfFiles:{type:Number,default:1},height:{type:Number,default:300}},emits:["uploaded","fileAdded","fileRemoved"],setup(e,l){const p=new a({autoProceed:!1,restrictions:{allowedFileTypes:e.types,maxNumberOfFiles:e.maxNumberOfFiles}});return p.use(t,{endpoint:e.endpoint+`?path=${e.path}`,fieldName:"file",method:"post",headers:e.headers}),p.use(d,{quality:1}),p.on("complete",(e=>{var a,t;(null==(a=e.successful)?void 0:a.length)>0&&l.emit("uploaded",null==(t=e.successful[0])?void 0:t.response)})),p.on("file-added",(e=>{l.emit("fileAdded",e)})),p.on("file-removed",((e,a)=>{l.emit("fileRemoved",e)})),o((()=>{p.close()})),{uppy:p,upload:function(){p.upload()},cancel:function(){p.cancelAll()}}}},[["render",function(e,a,t,d,l,o){const n=p("dashboard");return s(),i(n,{ref:"dash",uppy:d.uppy,props:{proudlyDisplayPoweredByUppy:!1,hideUploadButton:!0,height:t.height,metaFields:[{id:"name",name:"Name",placeholder:"file name"},{id:"caption",name:"Caption",placeholder:"describe what the image is about"}]},plugins:["ImageEditor"]},null,8,["uppy","props"])}],["__scopeId","data-v-bdca4e8a"]]);export{r as F};
