import{o as e}from"./rolldown-runtime.DAXXjFlN.js";import{r as t}from"./emotion-is-prop-valid.esm.CygBv61C.js";import{n,t as r}from"./types.cZoyy9Y-.js";import{n as i}from"./FormClearHelper.Cep69sFL.js";var a=e(t(),1),o=({widgetMgr:e,id:t,formId:o,key:s,defaultValue:c})=>{(0,a.useEffect)(()=>{r(e.getElementState(t,s))&&n(c)&&e.setElementState(t,s,c)},[e,t,s,c]);let[l,u]=(0,a.useState)(e.getElementState(t,s)??c),d=(0,a.useCallback)(n=>{e.setElementState(t,s,n),u(n)},[e,t,s]);return i({element:(0,a.useMemo)(()=>({formId:o||``}),[o]),widgetMgr:e,onFormCleared:(0,a.useCallback)(()=>d(c),[c,d])}),[l,d]};export{o as t};