import{l as k,w as v}from"./index.ad3efb29.js";import"./elementPlus.4833989a.js";import{d as b,k as w,r as V,w as x,o,c as s,F as d,a8 as p,a as g,T as y,K as i,M as U,O as B,Q as C}from"./vue.adf17aba.js";import"./echarts.72dc8373.js";const N=b({name:"FsFilesFormat",props:{modelValue:{},color:{default:""},type:{default:"tag"},a:{},tag:{},buildUrl:{type:Function,default:function(a){return a}},buildUrls:{},getFileName:{}},setup(a,F){const{ui:u}=v(),f=w(()=>a.getFileName||function(e){return typeof e!="string"?(console.warn("获取文件名失败，请配置getFileName"),e):(e==null?void 0:e.lastIndexOf("/"))>=0?e.substring(e.lastIndexOf("/")+1):e});function n(e){return{url:void 0,value:e,name:f.value(e),color:a.color}}async function m(e){if(a.buildUrls){const l=e.map(r=>r.value),h=await a.buildUrls(l);for(let r=0;r<e.length;r++)e[r].url=h[r]}else if(a.buildUrl)for(let l of e)l.url=await a.buildUrl(l.value);else for(let l=0;l<e.length;l++)e[l].url=e[l].value}async function t(){if(a.modelValue==null||a.modelValue==="")return[];let e=[];if(typeof a.modelValue=="string")e=[n(a.modelValue)];else if(a.modelValue instanceof Array){e=[];for(const l of a.modelValue)e.push(n(l))}return await m(e),e}const c=V([]);return x(()=>a.modelValue,async()=>{c.value=await t()},{immediate:!0}),{ui:u,itemsRef:c}}}),O={class:"fs-files-format"},R=["href"],_=["href"];function D(a,F,u,f,n,m){return o(),s("div",O,[a.type==="text"?(o(!0),s(d,{key:0},p(a.itemsRef,t=>(o(),s("span",{key:t.url,class:"fs-files-item"},[g("a",i({href:t.url,target:"_blank"},a.a),y(t.name),17,R)]))),128)):(o(!0),s(d,{key:1},p(a.itemsRef,t=>(o(),U(C(a.ui.tag.name),i({key:t.url,class:"fs-tag-item",type:t.color},a.tag),{default:B(()=>[g("a",i({href:t.url,target:"_blank"},a.a),y(t.name),17,_)]),_:2},1040,["type"]))),128))])}const L=k(N,[["render",D]]);export{L as default};
