import{o as e}from"./chunk.DuxOD-Sk.js";import{r as t}from"./emotion-is-prop-valid.esm.DV_OErv-.js";import{$ as n}from"./protobuf.DyZGXwGk.js";import{j as r}from"./utils.B9mvrYZE.js";var i=e(t()),a=class{manageFormClearListener(e,t,i){n(this.formClearListener)&&this.lastWidgetMgr===e&&this.lastFormId===t||(this.disconnect(),r(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:n}){(0,i.useEffect)(()=>{if(!t||!r(e.formId))return;let i=t.addFormClearedListener(e.formId,n);return()=>{i.disconnect()}},[e,t,n])}export{o as n,a as t};