import{d as C,L as w,r as s,k as $,Q as H,P as O,o as P,e as q,D as A,E as W,_ as X}from"./index-Bu3rAGYU.js";const b=200,L=36,N=C({__name:"BuilderInstanceTracker",props:{instancePath:{},matchSize:{type:Boolean},verticalOffsetPixels:{},isOffBoundsAllowed:{type:Boolean},preventSettingsBarOverlap:{type:Boolean}},setup(y){const v=y,{instancePath:B,matchSize:l,verticalOffsetPixels:r,isOffBoundsAllowed:_,preventSettingsBarOverlap:S}=w(v),i=s(null),d=s(0),u=s(null),k=e=>{const n=document.querySelector(".ComponentRenderer"),{top:T,left:R}=e.getBoundingClientRect(),{clientHeight:E}=document.body,{clientWidth:I}=n,{left:p}=n.getBoundingClientRect(),c=document.querySelector(".BuilderSettings"),{left:m}=(c==null?void 0:c.getBoundingClientRect())||{left:1/0};let{clientHeight:h,clientWidth:a}=l!=null&&l.value?e:u.value,M=r!=null&&r.value?r.value:0,t=R,o=T+M;if(_.value||(t=Math.max(p,t),t=Math.min(p+I-a,t),o=Math.max(L,o),o=Math.min(E-h,o)),S.value){let g=0;t+a>m&&(g=Math.max(t-(m-a),0)),t-=g}i.value={top:`${o}px`,left:`${t}px`,width:`${a}px`,height:`${h}px`}},f=()=>{let e=document.querySelector(`.ComponentRenderer [data-writer-instance-path="${B.value}"]`);if(x(),!e)return;const n=getComputedStyle(e);n&&(n.display=="contents"&&(e=e.querySelector("[data-writer-id]")),e&&k(e))},x=()=>{d.value=setTimeout(f,b)};return $(async()=>{await H(),f()}),O(()=>{clearTimeout(d.value)}),(e,n)=>(P(),q("div",{ref_key:"rootEl",ref:u,class:"BuilderInstanceTracker",style:W(i.value)},[A(e.$slots,"default",{},void 0,!0)],4))}}),j=X(N,[["__scopeId","data-v-f5bff36a"]]);export{j as default};
