import{d as f,bk as C,a4 as _,c as m,o as b,X as F,w as p,j as y,p as v,A as S,l as r,ae as h,r as w,aw as x}from"./index-9PRMimni.js";import{_ as N}from"./template-rpthWlT9.js";const k=f({__name:"index",props:{value:{type:[String,Number],required:!0},dictItems:{type:Array,required:!0},labelField:{type:String,default:"label"},labelEnField:{type:String,default:"labelEn"},valueField:{type:String,default:"value"}},setup(o){const u=C();function s(a,c=1){if(!a)return;const i=/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;let e=a.toLowerCase();if(!i.test(e))return a;if(e.length===4||e.length===5){let n="#";for(let d=1;d<e.length;d++)n+=e[d].repeat(2);e=n}e.length===9&&(c=(parseInt(e.slice(7,9),16)/255).toFixed(2));const g=[];for(let n=1;n<7;n+=2)g.push(parseInt(e.slice(n,n+2),16));return`rgba(${g.join(", ")}, ${c})`}const t=o,l=_(()=>t.dictItems?.find(a=>a[t?.valueField]===t.value)||{});return(a,c)=>{const i=h,e=F;return b(),m(e,null,{default:p(()=>[y(i,{color:{color:s(r(l)?.tag,.12),textColor:s(r(l)?.tag,1),borderColor:s(r(l)?.tag,.5)}},{default:p(()=>[v(S(r(u).getLocale==="en"?r(l)[o.labelEnField]:r(l)[o.labelField]),1)]),_:1},8,["color"])]),_:1})}}}),I=f({__name:"index",props:{value:{default:"",required:!0,type:String||Number}},setup(o){const u=w([]),s=_(()=>u.value.map(t=>({value:String(t.id),label:t.name,labelEn:t.shortNameEn,tag:+t.deptType==1?"#2180F1":"#9463E2"})));return x(async()=>{u.value=await N()}),(t,l)=>{const a=k,c=F;return b(),m(c,null,{default:p(()=>[y(a,{value:o.value,"dict-items":r(s)},null,8,["value","dict-items"])]),_:1})}}});export{I as _,k as a};
