import{d as m,O as v,i as d,o as r,Y as u,w as n,g as s}from"./index-3a163edb.js";const h="_sticky_4d2w6_1",S="_white_4d2w6_6",g={sticky:h,white:S},k=m({name:"m-sticky",props:{position:{type:String,default:"top"},mode:{type:String,default:"fixed"},offsetTop:{type:String,default:"0px"},offsetBottom:{default:"0px"},varName:{type:String,default:"--header-height"}},emits:["barHeight"],setup(t,{slots:f,emit:a}){const e=v({divStyle:{},heightV:0,sectionStyle:{width:"100%",height:"auto",left:"0"}}),c=i=>{e.sectionStyle.height=`${i}px`,e.heightV=i,document.documentElement.style.setProperty(t.varName,`${i}px`),a("barHeight",i)},o=d(),y=d();return r(()=>{t.position==="top"?e.divStyle.top=t.offsetTop||"0px":e.divStyle.bottom=t.offsetBottom||"0px",new ResizeObserver(()=>{const{height:l}=u(o.value);c(l)}).observe(o.value)}),n(()=>t.offsetTop,()=>{e.divStyle.top=t.offsetTop}),n(()=>t.offsetBottom,()=>{e.divStyle.bottom=t.offsetBottom}),()=>s("div",{style:[e.sectionStyle],class:t.mode==="sticky"&&g.sticky},[s("div",{ref:o,class:["van-sticky",t.mode==="fixed"?"van-sticky--fixed":""],style:[e.divStyle,e.sectionStyle]},[s("div",{ref:y},[f.default&&f.default()])])])}});export{k as M};