import{o as e}from"./rolldown-runtime.C0FnF6B9.js";import{r as t}from"./emotion-is-prop-valid.esm.CuYlOKOk.js";import{it as n}from"./utils.Vs712G4Z.js";import{n as r}from"./types.cZoyy9Y-.js";var i=e(t(),1),a=class{manageFormClearListener(e,t,i){r(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),n(t)&&(this.formClearListener=e.addFormClearedListener(t,i),this.lastWidgetMgr=e,this.lastFormId=t))}disconnect(){this.formClearListener?.disconnect(),this.formClearListener=void 0,this.lastWidgetMgr=void 0,this.lastFormId=void 0}};function o({element:e,widgetMgr:t,onFormCleared:r}){(0,i.useEffect)(()=>{if(!t||!n(e.formId))return;let i=t.addFormClearedListener(e.formId,r);return()=>{i.disconnect()}},[e,t,r])}export{o as n,a as t};