var m=(a,r,e)=>new Promise((n,o)=>{var t=s=>{try{i(e.next(s))}catch(l){o(l)}},c=s=>{try{i(e.throw(s))}catch(l){o(l)}},i=s=>s.done?n(s.value):Promise.resolve(s.value).then(t,c);i((e=e.apply(a,r)).next())});import{T as f,E as d}from"./index-90c78f99.js";const u=(a,r,e,n)=>{if(a.code!==200){d.error("上传失败!");const o=r.findIndex(t=>t.response.code!==200);r.splice(o,1)}e&&r.length>1&&r.shift(),n&&n(a.data)},N=a=>{d.error(a.message||"上传失败！")},F=(a,{types:r,size:e},n)=>{const o=a.name.substring(a.name.lastIndexOf(".")+1).toLocaleLowerCase();if(n&&n.map(i=>i.name).includes(a.name))return d.warning("已上传过相同名字的附件，请核查并修改"),!1;const t=r.indexOf(o)!==-1,c=e?a.size/1024<=e:!0;return t||d.error("上传文件格式错误!"),e&&!c&&d.error(`上传文件大小不能超过 ${e>=1024?e/1024:e}${e>=1024?"m":"kb"}!`),t&&c},O=(a,r=!0)=>m(void 0,null,function*(){const e=yield f({fileId:a});return r?URL.createObjectURL(e):e}),h=a=>{let r=[];return a&&(r=JSON.parse(a).map(e=>({name:e.fileName,response:{data:{id:e.fileId,originalFileName:e.fileName}}}))),JSON.parse(JSON.stringify(r))},w=a=>a&&a.length?JSON.stringify(a.map(r=>({fileId:r.response.data.id,fileName:r.response.data.originalFileName}))):void 0;export{N as a,w as b,O as d,F as f,u as h,h as r};
