import e from"../../_util/raf.mjs";import{onBeforeUnmount as t,ref as n,shallowRef as r}from"vue";function i(n){let i=r(n),a,o=r([]);function s(t){o.value.push(t),e.cancel(a),a=e(()=>{let e=o.value;o.value=[],e.forEach(e=>{i.value=e(i.value)})})}return t(()=>{e.cancel(a)}),[i,s]}function a(e){let r=n(e||null),i=n();function a(){clearTimeout(i.value)}function o(e){r.value=e,a(),i.value=setTimeout(()=>{r.value=null,i.value=void 0},100)}function s(){return r.value}return t(()=>{a()}),[o,s]}export{i as useLayoutState,a as useTimeoutLock};