import{ac as S,b3 as P,ad as $,aJ as k,v as I,H as R,C as T,D as p,d as z,U as B,aq as C,r as O,G as u,aS as H,Q as N,az as D,$ as E,a2 as U,c as x,aC as V,av as v,as as _,z as j}from"./ResizeObserver.es.7b3c8c20.js";function q(o,l){if(!S||!window.IntersectionObserver)return;const r=new IntersectionObserver(e=>{l(e[0].intersectionRatio>0)},{root:document.body}),s=()=>{o.value&&r.observe(o.value)},f=()=>{o.value&&r.unobserve(o.value)};P(f),$(f),k(s)}const[A,F]=I("sticky"),G={zIndex:R,position:T("top"),container:Object,offsetTop:p(0),offsetBottom:p(0)};var J=z({name:A,props:G,emits:["scroll","change"],setup(o,{emit:l,slots:r}){const s=B(),f=C(s),e=O({fixed:!1,width:0,height:0,transform:0}),i=u(()=>H(o.position==="top"?o.offsetTop:o.offsetBottom)),b=u(()=>{const{fixed:t,height:d,width:n}=e;if(t)return{width:`${n}px`,height:`${d}px`}}),w=u(()=>{if(!e.fixed)return;const t=N(D(o.zIndex),{width:`${e.width}px`,height:`${e.height}px`,[o.position]:`${i.value}px`});return e.transform&&(t.transform=`translate3d(0, ${e.transform}px, 0)`),t}),g=t=>l("scroll",{scrollTop:t,isFixed:e.fixed}),h=()=>{if(!s.value||V(s))return;const{container:t,position:d}=o,n=v(s),y=_(window);if(e.width=n.width,e.height=n.height,d==="top")if(t){const a=v(t),c=a.bottom-i.value-e.height;e.fixed=i.value>n.top&&a.bottom>0,e.transform=c<0?c:0}else e.fixed=i.value>n.top;else{const{clientHeight:a}=document.documentElement;if(t){const c=v(t),m=a-c.top-i.value-e.height;e.fixed=a-i.valuec.top,e.transform=m<0?-m:0}else e.fixed=a-i.valuee.fixed,t=>l("change",t)),U("scroll",h,{target:f,passive:!0}),q(s,h),()=>{var t;return x("div",{ref:s,style:b.value},[x("div",{class:F({fixed:e.fixed}),style:w.value},[(t=r.default)==null?void 0:t.call(r)])])}}});const M=j(J);export{M as S};