import{_ as e}from"./BWjbACMF.js";import{_ as a}from"./CVyxofTK.js";import{c as l,w as s,B as t,L as u,V as n,P as r,$ as d,M as o,a2 as i,W as p,x as m,u as c,l as v,_ as y,X as f,F as b,O as _}from"./CFGNYEIb.js";import{j as g}from"./BiMU17mg.js";import{I as V,j,A as x,F as k}from"./CV-mSM--.js";const q={class:"input-wrapper"},h={key:0,for:"label"},S={class:"relative"},w={key:0,class:"text-desc"},B={key:1},F={class:"absolute top-[48%] -translate-y-1/2 end-5"},I={__name:"BaseSelectInput",props:{items:{type:Array,required:!1,default:()=>[]},name:{type:String,required:!0},label:{type:String,required:!1},placeholder:{type:String,required:!1},value:{type:Object,required:!1},rounded:{type:Boolean,required:!1}},emits:["update:value"],setup(I,{expose:A,emit:M}){const O=I,P=g(O.name),C=l(null);s((()=>C.value),((e,a)=>{e?(P.setValue(e),E("update:value",e)):e!=a&&(P.setValue(null),E("update:value",void 0))}),{deep:!0,immediate:!0}),s((()=>O.value),((e,a)=>{e?(C.value=e,P.setValue(e)):e!=a&&(C.value=null,P.setValue(null))}),{deep:!0,immediate:!0});A({emptyInput:()=>{C.value=null}});const E=M;return(l,s)=>{const g=e,A=a,M=t("VeeErrorMessage"),O=t("VeeField");return u(),n(O,{name:I.name},{default:r((({field:e,meta:a})=>[d("div",q,[I.label?(u(),o("label",h,i(I.label),1)):p("",!0),d("div",S,[m(A,null,{default:r((()=>[m(c(V),{modelValue:c(C),"onUpdate:modelValue":s[1]||(s[1]=e=>v(C)?C.value=e:null)},{default:r((()=>[m(c(j),{class:y(I.rounded?"!rounded-full !px-6":"")},{default:r((()=>{var e,a,l,t;return[I.placeholder&&!(null==(e=c(C))?void 0:e.name)?(u(),o("span",w,i(I.placeholder),1)):p("",!0),(null==(a=c(C))?void 0:a.name)?(u(),o("span",B,i(null==(l=c(C))?void 0:l.name),1)):p("",!0),d("span",F,[m(g,{name:"chevron-down"})]),c(C)&&(null==(t=c(C))?void 0:t.id)?(u(),o("button",{key:2,onClick:s[0]||(s[0]=e=>{e.stopPropagation(),C.value=null}),class:"absolute top-1/2 -translate-y-1/2 end-10"},[m(g,{name:"close-2",class:"text-desc scale-[0.6]"})])):p("",!0)]})),_:1},8,["class"]),m(f,{name:"fade"},{default:r((()=>[m(c(x),null,{default:r((()=>[(u(!0),o(b,null,_(I.items,(e=>(u(),n(c(k),{as:"template",key:e.id,value:e},{default:r((({active:a,selected:l})=>[d("li",{class:y([a&&"bg-primary bg-opacity-20 rounded-lg",l&&"bg-primary bg-opacity-20 rounded-lg"])},i(null==e?void 0:e.name),3)])),_:2},1032,["value"])))),128))])),_:1})])),_:1})])),_:1},8,["modelValue"])])),_:1})])]),m(M,{class:"text-sm text-red-500",name:I.name},null,8,["name"])])),_:1},8,["name"])}}};export{I as _};
