import{a as t}from"./index-73a2908a.js";import{d as e,r as o,I as s,o as i,j as a,a as f}from"./index-4bd11d60.js";const d=e({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(e,{slots:d,emit:p}){const l=o({divStyle:{},heightV:0,sectionStyle:{width:"100%",height:"auto",left:"0"}}),n=s(),c=s();return i((()=>{"top"===e.position?l.divStyle.top=e.offsetTop||"0px":l.divStyle.bottom=e.offsetBottom||"0px";try{t(c.value,(t=>{const o=t[0],{height:s}=o.contentRect;Math.abs(s-l.heightV)>1&&setTimeout((()=>{var t;t=s,l.sectionStyle.height="".concat(t,"px"),l.heightV=t,document.documentElement.style.setProperty(e.varName,"".concat(t,"px")),p("barHeight",t)}),10)}))}catch(o){}})),a((()=>e.offsetTop),(()=>{l.divStyle.top=e.offsetTop})),a((()=>e.offsetBottom),(()=>{l.divStyle.bottom=e.offsetBottom})),()=>f("div",{style:[l.sectionStyle],"class":"sticky"===e.mode&&"_sticky_4d2w6_1"},[f("div",{ref:n,"class":["van-sticky","fixed"===e.mode?"van-sticky--fixed":""],style:[l.divStyle,l.sectionStyle]},[f("div",{ref:c},[d["default"]&&d["default"]()])])])}});export{d as O};
