import{s as w}from"./file-C2qrOrfI.js";import{i as N,g as _}from"./alioss-D7aFrPDM.js";import{V as I}from"./VFileInput-kaJey9cy.js";import{d as U,r as n,g as F,i as y,w as V,j as l,x as j,cu as k,m as x,F as C,f as c,h as z,_ as B}from"./index-N7CMQwFv.js";import"./VChip-iaVLrPY0.js";import"./VSlideGroup-BGEgBoXK.js";const O=U({__name:"fileInput",props:["id"],emits:["update:fileInputUpload"],setup(p,{emit:m}){const u=p,d=m,f=()=>{d("update:fileInputUpload",{id:u.id,img:i.value})},o=n(0),i=n(""),g=async s=>{const e=s;if(e)try{const t=await N(),a=await h(t,e);i.value=a.fileOssName.objectUrl,f()}catch(t){console.log(t)}},h=async(s,e)=>{const t=await _(e),a=await s.multipartUpload(t.objectName,e,{partSize:800*1024,progress:v=>{o.value=Math.floor(v*100)},headers:{"Cache-Control":"max-age=360000"}}),r=new Image;r.src=t.objectUrl;const b=e.name.replace(/\.[^/.]+$/,"");return r.onload=async()=>{await w({fileName:b,fileType:1,width:r.width,height:r.height,fileUrl:t.objectUrl,bucketName:a.bucket,objectName:a.name,fileSize:e.size})},setTimeout(()=>{o.value=0},1e3),{res:a,fileOssName:t}};return(s,e)=>(c(),F(C,null,[y(I,{label:"File input",variant:"outlined","prepend-icon":"",accept:"image/*","onUpdate:modelValue":g},{"prepend-inner":V(()=>e[0]||(e[0]=[z("div",{class:"fileInput-prepend-inner"}," Select File ",-1)])),_:1}),l(o)>0?(c(),j(k,{key:0,color:"rgb(var(--v-theme-primary))","model-value":l(o),striped:""},null,8,["model-value"])):x("",!0)],64))}}),L=B(O,[["__scopeId","data-v-fb704b47"]]);export{L as default};