import{shallowRef as n,watch as c,onMounted as d,onBeforeUnmount as p}from"vue";import o from"../../_util/raf.mjs";const r=["measure","align",null,"motion"],S=(f,m)=>{const e=n(null),u=n(),l=n(!1);function s(t){l.value||(e.value=t)}function i(){o.cancel(u.value)}function v(t){i(),u.value=o(()=>{let a=e.value;switch(e.value){case"align":a="motion";break;case"motion":a="stable";break}s(a),t?.()})}return c(f,()=>{s("measure")},{immediate:!0,flush:"post"}),d(()=>{c(e,()=>{e.value==="measure"&&m(),e.value&&(u.value=o(async()=>{const t=r.indexOf(e.value),a=r[t+1];a&&t!==-1&&s(a)}))},{immediate:!0,flush:"post"})}),p(()=>{l.value=!0,i()}),[e,v]};export{S as default};
