import{a as f}from"./chunk-ZV4EAG4P.js";import{a as d}from"./chunk-ZTKV4AIV.js";import{w as p}from"./chunk-MTR2L2TG.js";import{c as m}from"./chunk-5JDCLYZA.js";import{m as u}from"./chunk-KVTHJWZA.js";import{R as l,ca as s,na as o,u as c}from"./chunk-FWZCAEAJ.js";function k(e){return m(e.statusChanges.pipe(l(),c(()=>{let t=e.valid;return console.log(`formValidChange is valid = ${t}`,e.value),t})),{initialValue:e.valid})}function V(){return o(p).nonNullable}function x(e){let{entityService:t,continuousCreation:i}=e,b=o(f),v=o(u);return(a,n)=>{console.info(`submit - method: "${a}"; Continuous creation check enabled: "${d(!!i)}"`,n);let r;switch(a){case"CREATE":r=t.create$(n);break;case"UPDATE":r=t.update$(n);break;default:throw Error("Not implemented")}r.pipe(s(()=>i&&i.enabled()?i.patch(n):void 0)).subscribe(()=>b.tsuccess("SAVED")),(!i||!i.enabled())&&v.back()}}export{k as a,V as b,x as c};
