import{d as F,aS as O,co as k,bk as w,r as f,a4 as l,l as h,aw as C,h as K,o as P,j as V,aA as D,c4 as E,cp as I,c6 as L,a9 as N,w as T,ab as $,p as j,A,v as R}from"./index-9PRMimni.js";import{b as W}from"./BasicSelect.vue_vue_type_style_index_0_scoped_772d51cc_lang-Brp6PjEU.js";import{d as z}from"./dictionary-BRse4lkf.js";const M={class:"BasicSelect"},q=F({__name:"BasicSelect",props:{...W},setup(v,{expose:m}){O(t=>({"3d3f0566":h(S)}));const i=k({storage:localStorage}),_=w(),e=v,c=f(!0),n=f([]),g=l(()=>({...e})),b=l(()=>{const t=e?.handleOptionItem?e.handleOptionItem(n.value):n.value,a=e.valueField,s=e.labelField,r=e.labelEnField,u=e.optionType;return t.map(o=>(Reflect.has(o,a)&&(o[a]=u==="number"?Number(o[a]):o[a],o[s]=_.getLocale==="en"?o[r]:o[s]),o))}),S=e.block?"100%":`${e.width}px`,y=l(()=>({...h(g),loading:c.value,options:b.value})),p=l(()=>null);function B(){const{cache:t,cacheKey:a}=e;if(t&&a&&p.value){n.value=p.value||[],c.value=!1;return}d()}async function d(){c.value=!0;const{cacheKey:t,cache:a}=e;if(e.options&&e.options.length){n.value=e.options,c.value=!1,a&&t&&i.set(t,e.options);return}try{const s=await z(t);n.value=s||[],c.value=!1,a&&t&&s&&s.length&&i.set(t,s)}catch(s){console.error(s)}}function x(){const{cache:t,cacheKey:a}=e;return t&&a?i.get(e.cacheKey):n.value}return C(()=>{B()}),m({fetch:d,getData:x}),(t,a)=>{const s=D;return P(),K("div",M,[V(s,E(I(y.value)),L({_:2},[N(Object.keys(t.$slots),r=>({name:r,fn:T(u=>[$(t.$slots,r,{},()=>[j(A(u),1)],!0)])}))]),1040)])}}}),Q=R(q,[["__scopeId","data-v-772d51cc"]]);export{Q as B};
