"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),v=require("../../_util/hooks/useState.js"),m=require("../util.js");function w(o,l,r,d){const[u,c]=v.default(void 0);n.watchEffect(()=>{const e=typeof o.value=="function"?o.value():o.value;c(e||null)},{flush:"post"});const[t,s]=v.default(null),i=()=>{if(!l.value){s(null);return}if(u.value){!m.isInViewPort(u.value)&&l.value&&u.value.scrollIntoView(d.value);const{left:e,top:a,width:g,height:h}=u.value.getBoundingClientRect(),f={left:e,top:a,width:g,height:h,radius:0};JSON.stringify(t.value)!==JSON.stringify(f)&&s(f)}else s(null)};return n.onMounted(()=>{n.watch([l,u],()=>{i()},{flush:"post",immediate:!0}),window.addEventListener("resize",i)}),n.onBeforeUnmount(()=>{window.removeEventListener("resize",i)}),[n.computed(()=>{if(!t.value)return t.value;const e=r.value?.offset||6,a=r.value?.radius||2;return{left:t.value.left-e,top:t.value.top-e,width:t.value.width+e*2,height:t.value.height+e*2,radius:a}}),u]}exports.default=w;
