import{cv as M,cP as p,bO as c,bZ as O,c3 as d,bI as R,aO as w,O as m,bJ as B,bf as k}from"#entry";const b=Symbol.for("vuetify:form"),E=R({disabled:Boolean,fastFail:Boolean,readonly:Boolean,modelValue:{type:Boolean,default:null},validateOn:{type:String,default:"input"}},"form");function P(i){const r=M(i,"modelValue"),f=d(()=>i.disabled),v=d(()=>i.readonly),n=O(!1),a=c([]),o=c([]);async function y(){const e=[];let s=!0;o.value=[],n.value=!0;for(const t of a.value){const l=await t.validate();if(l.length>0&&(s=!1,e.push({id:t.id,errorMessages:l})),!s&&i.fastFail)break}return o.value=e,n.value=!1,{valid:s,errors:o.value}}function g(){a.value.forEach(e=>e.reset())}function V(){a.value.forEach(e=>e.resetValidation())}return p(a,()=>{let e=0,s=0;const t=[];for(const l of a.value)l.isValid===!1?(s++,t.push({id:l.id,errorMessages:l.errorMessages})):l.isValid===!0&&e++;o.value=t,r.value=s>0?!1:e===a.value.length?!0:null},{deep:!0,flush:"post"}),B(b,{register:e=>{let{id:s,vm:t,validate:l,reset:u,resetValidation:h}=e;a.value.some(F=>F.id===s),a.value.push({id:s,validate:l,reset:u,resetValidation:h,vm:k(t),isValid:null,errorMessages:[]})},unregister:e=>{a.value=a.value.filter(s=>s.id!==e)},update:(e,s,t)=>{const l=a.value.find(u=>u.id===e);l&&(l.isValid=s,l.errorMessages=t)},isDisabled:f,isReadonly:v,isValidating:n,isValid:r,items:a,validateOn:d(()=>i.validateOn)}),{errors:o,isDisabled:f,isReadonly:v,isValidating:n,isValid:r,items:a,validate:y,reset:g,resetValidation:V}}function x(i){const r=w(b,null);return{...r,isReadonly:m(()=>!!(i?.readonly??r?.isReadonly.value)),isDisabled:m(()=>!!(i?.disabled??r?.isDisabled.value))}}export{P as c,E as m,x as u};
