import{b9 as G,_ as I,r,P as $,o as N,c as O,b as d,w as o,af as _,h as U,ai as K,ae as q,a as H,ac as M,g as F,E as R,__tla as T}from"./index.b5692aad.js";import{c as Y,__tla as J}from"./el-table-column.e89ea9cf.js";import{E as Q,__tla as W}from"./el-progress.2a9b0f11.js";import{g as L,a as S}from"./helper.2ba6f024.js";let b,X=Promise.all([(()=>{try{return T}catch{}})(),(()=>{try{return J}catch{}})(),(()=>{try{return W}catch{}})()]).then(async()=>{let g;g=["src"],b={__name:"index",props:{part:String,full:String,list:Array,sizeLimit:Number,size:String,time:String},emits:["update:part","update:full","update:size","update:time","compile","update:list"],setup(A,{emit:n}){const l=A,j=G.token,D=window.GLOBAL_CONFIG.api+"/upload/main/file",B={token:j,client:"web",api:"json",issubmit:"1",site:"tyyx"},w=I(),i=r(l.part),s=r(l.full),c=r(0),h=r(l.time??new Date().toLocaleString()),u=r([]);function y(){i.value!==void 0&&i.value!==""&&i.value!==null&&(u.value=i.value.split(";").map((e,a)=>({part_url:L(e),url:S(e),name:e.split("/").pop()}))),s.value!==void 0&&s.value!==""&&s.value!==null&&(u.value=s.value.split(";").map((e,a)=>{const[t,p]=e.split("|");return{part_url:L(t),url:S(t),name:p}}))}y(),$(()=>[l.part,l.full],(e,a)=>{i.value=l.part,s.value=l.full,y()});function x(e){if(l.sizeLimit){const a=e.size/1024<l.sizeLimit;return a||F.warning(`\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ${l.sizeLimit}KB!`),a}}function z(){if(console.log("handleSuccess :>> ",u.value.map(e=>e.status),u.value),u.value.every(e=>e.status==="success")){let e=[],a=[];u.value.forEach(t=>{if(t.percentage===100){const{url:p,file_name:v}=t.response.data;e.push(p),a.push(`${p}|${v}`),c.value+=t.size??0}else e.push(t.part_url),a.push(`${t.part_url}|${t.name}`),c.value+=t.size??0}),n("update:list",e),s.value=a.join(";"),i.value=e.join(";"),h.value=new Date().toLocaleString()}}function C(e,a){u.value=a,z()}function P(){F.warning(`\u6700\u591A\u5141\u8BB8\u4E0A\u4F20${w.limit}\u4E2A\u6587\u4EF6`)}const E=r(""),m=r(!1),V=e=>{var a;["png","jpg","jpeg"].includes((a=e.url)==null?void 0:a.split(".").at(-1))&&(E.value=e.url,m.value=!0)};function k(e){return(e/1024).toString()}return $(()=>i.value,()=>{n("update:part",i.value),n("update:full",s.value),n("update:size",k(c.value)),n("update:time",h.value),n("compile",u.value),console.log("compile")}),(e,a)=>{const t=R,p=Q,v=Y;return N(),O(M,null,[d(p,K({action:D,data:B,name:"filedata","on-success":z,"on-remove":C,"on-exceed":P,"before-upload":x,"file-list":u.value,"onUpdate:file-list":a[0]||(a[0]=f=>u.value=f),"on-preview":V},q(w),{class:"w-full"}),{default:o(()=>[_(e.$slots,"default",{},()=>[d(t,{type:"primary"},{default:o(()=>[U("\u70B9\u51FB\u4E0A\u4F20")]),_:1})])]),tip:o(()=>[_(e.$slots,"tip")]),file:o(()=>[_(e.$slots,"file")]),_:3},16,["file-list"]),d(v,{modelValue:m.value,"onUpdate:modelValue":a[1]||(a[1]=f=>m.value=f)},{default:o(()=>[H("img",{"w-full":"",src:E.value,alt:"Preview Image"},null,8,g)]),_:1},8,["modelValue"])],64)}}}});export{b as _,X as __tla};
