import{r as o,cN as i,H as a}from"./index-DCNLpqIv.js";class d{manageFormClearListener(e,t,s){a(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),i(t)&&(this.formClearListener=e.addFormClearedListener(t,s),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){this.formClearListener?.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}}function n({element:r,widgetMgr:e,onFormCleared:t}){o.useEffect(()=>{if(!i(r.formId))return;const s=e.addFormClearedListener(r.formId,t);return()=>{s.disconnect()}},[r,e,t])}export{d as F,n as u};
