import{_ as e}from"./CAFZTnck.js";import{_ as a}from"./vtHCjVGu.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"./arA1miDk.js";import{I as V,j,A as x,F as k}from"./DHEi_Tis.js";const q={class:"input-wrapper"},h={key:0,for:"label"},S={class:"relative"},w={key:0,class:"text-desc"},A={key:1},B={class:"absolute top-[48%] -translate-y-1/2 end-5"},F={__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(F,{expose:I,emit:M}){const O=F,P=g(O.name),C=l(null);s((()=>C.value),((e,a)=>{e?(P.setValue(e),D("update:value",e)):e!=a&&(P.setValue(null),D("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});I({emptyInput:()=>{C.value=null}});const D=M;return(l,s)=>{const g=e,I=a,M=t("VeeErrorMessage"),O=t("VeeField");return u(),n(O,{name:F.name},{default:r((({field:e,meta:a})=>[d("div",q,[F.label?(u(),o("label",h,i(F.label),1)):p("",!0),d("div",S,[m(I,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(F.rounded?"!rounded-full !px-6":"")},{default:r((()=>{var e,a,l,t;return[F.placeholder&&!(null==(e=c(C))?void 0:e.name)?(u(),o("span",w,i(F.placeholder),1)):p("",!0),(null==(a=c(C))?void 0:a.name)?(u(),o("span",A,i(null==(l=c(C))?void 0:l.name),1)):p("",!0),d("span",B,[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,_(F.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:F.name},null,8,["name"])])),_:1},8,["name"])}}};export{F as _};
