import{d as C,L as w,r as g,j as $,l as H,G as O,Q as q,o as A,e as P,D as W,E as X,_ as b}from"./index-CUGDV1IA.js";const L=200,N=36,j=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),c=g(null),i=g(0),d=$("rootEl"),k=e=>{const n=document.querySelector(".ComponentRenderer"),{top:T,left:R}=e.getBoundingClientRect(),{clientHeight:E}=document.body,{clientWidth:I}=n,{left:f}=n.getBoundingClientRect(),s=document.querySelector(".BuilderSettings"),{left:p}=(s==null?void 0:s.getBoundingClientRect())||{left:1/0};let{clientHeight:m,clientWidth:a}=l!=null&&l.value?e:d.value,M=r!=null&&r.value?r.value:0,t=R,o=T+M;if(_.value||(t=Math.max(f,t),t=Math.min(f+I-a,t),o=Math.max(N,o),o=Math.min(E-m,o)),S.value){let h=0;t+a>p&&(h=Math.max(t-(p-a),0)),t-=h}c.value={top:`${o}px`,left:`${t}px`,width:`${a}px`,height:`${m}px`}},u=()=>{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=()=>{i.value=setTimeout(u,L)};return H(async()=>{await O(),u()}),q(()=>{clearTimeout(i.value)}),(e,n)=>(A(),P("div",{ref_key:"rootEl",ref:d,class:"BuilderInstanceTracker",style:X(c.value)},[W(e.$slots,"default",{},void 0,!0)],4))}}),z=b(j,[["__scopeId","data-v-ebe1f179"]]);export{z as default};
