import{u as j}from"./DqW9UKXb.js";import{z as B,b as z,N as r,i as a,f as y,D as s,W as l,E as i,A as t,F as n,j as o,a0 as d,h as u,r as V,l as w,u as C,U as q,a9 as I,e as p,a1 as v,R as N}from"./D7LY3N47.js";import{_ as A}from"./DlAUqK2U.js";const E={wrapper:"",inner:"",label:{wrapper:"flex content-center items-center justify-between",base:"block font-medium text-gray-700 dark:text-gray-200",required:"after:content-['*'] after:ms-0.5 after:text-red-500 dark:after:text-red-400"},size:{"2xs":"text-xs",xs:"text-xs",sm:"text-sm",md:"text-sm",lg:"text-sm",xl:"text-base"},container:"mt-1 relative",description:"text-gray-500 dark:text-gray-400",hint:"text-gray-500 dark:text-gray-400",help:"mt-2 text-gray-500 dark:text-gray-400",error:"mt-2 text-red-500 dark:text-red-400",default:{size:"sm"}},h=B(z.ui.strategy,z.ui.formGroup,E),G=w({inheritAttrs:!1,props:{name:{type:String,default:null},size:{type:String,default:null,validator(e){return Object.keys(h.size).includes(e)}},label:{type:String,default:null},description:{type:String,default:null},required:{type:Boolean,default:!1},help:{type:String,default:null},error:{type:[String,Boolean],default:null},hint:{type:String,default:null},class:{type:[String,Object,Array],default:()=>""},ui:{type:Object,default:()=>({})},eagerValidation:{type:Boolean,default:!1}},setup(e){const{ui:m,attrs:g}=j("formGroup",v(e,"ui"),h,v(e,"class")),b=C("form-errors",null),f=p(()=>e.error&&typeof e.error=="string"||typeof e.error=="boolean"?e.error:b?.value?.find(S=>S.path===e.name)?.message),k=p(()=>m.value.size[e.size??h.default.size]),$=q(I());return N("form-group",{error:f,inputId:$,name:p(()=>e.name),size:p(()=>e.size),eagerValidation:p(()=>e.eagerValidation)}),{ui:m,attrs:g,inputId:$,size:k,error:f}}}),O=["for"];function P(e,m,g,b,f,k){return r(),a("div",t({class:e.ui.wrapper},e.attrs),[y("div",{class:s(e.ui.inner)},[e.label||e.$slots.label?(r(),a("div",{key:0,class:s([e.ui.label.wrapper,e.size])},[y("label",{for:e.inputId,class:s([e.ui.label.base,e.required?e.ui.label.required:""])},[e.$slots.label?l(e.$slots,"label",i(t({key:0},{error:e.error,label:e.label,name:e.name,hint:e.hint,description:e.description,help:e.help}))):(r(),a(n,{key:1},[o(d(e.label),1)],64))],10,O),e.hint||e.$slots.hint?(r(),a("span",{key:0,class:s([e.ui.hint])},[e.$slots.hint?l(e.$slots,"hint",i(t({key:0},{error:e.error,label:e.label,name:e.name,hint:e.hint,description:e.description,help:e.help}))):(r(),a(n,{key:1},[o(d(e.hint),1)],64))],2)):u("",!0)],2)):u("",!0),e.description||e.$slots.description?(r(),a("p",{key:1,class:s([e.ui.description,e.size])},[e.$slots.description?l(e.$slots,"description",i(t({key:0},{error:e.error,label:e.label,name:e.name,hint:e.hint,description:e.description,help:e.help}))):(r(),a(n,{key:1},[o(d(e.description),1)],64))],2)):u("",!0)],2),y("div",{class:s([e.label?e.ui.container:""])},[l(e.$slots,"default",i(V({error:e.error}))),typeof e.error=="string"&&e.error?(r(),a("p",{key:0,class:s([e.ui.error,e.size])},[e.$slots.error?l(e.$slots,"error",i(t({key:0},{error:e.error,label:e.label,name:e.name,hint:e.hint,description:e.description,help:e.help}))):(r(),a(n,{key:1},[o(d(e.error),1)],64))],2)):e.help||e.$slots.help?(r(),a("p",{key:1,class:s([e.ui.help,e.size])},[e.$slots.help?l(e.$slots,"help",i(t({key:0},{error:e.error,label:e.label,name:e.name,hint:e.hint,description:e.description,help:e.help}))):(r(),a(n,{key:1},[o(d(e.help),1)],64))],2)):u("",!0)],2)],16)}const U=A(G,[["render",P]]);export{U as _};
