import{K as k,ad as O,ae as y,af as P,c as s,aE as q,O as m,J as Q,r as b,ac as $,ah as w,cc as R,aT as V,aS as B}from"./index-CS0Lg7FU.js";const S={position:{type:String,default:"bottom-right",validator:t=>["top-right","top-left","bottom-right","bottom-left","top","right","bottom","left"].includes(t)},offset:{type:Array,validator:t=>t.length===2},expand:Boolean};function T(){const{props:t,proxy:{$q:c}}=k(),n=O(P,y);if(n===y)return console.error("QPageSticky needs to be child of QLayout"),y;const x=s(()=>{const e=t.position;return{top:e.indexOf("top")!==-1,right:e.indexOf("right")!==-1,bottom:e.indexOf("bottom")!==-1,left:e.indexOf("left")!==-1,vertical:e==="top"||e==="bottom",horizontal:e==="left"||e==="right"}}),o=s(()=>n.header.offset),f=s(()=>n.right.offset),u=s(()=>n.footer.offset),r=s(()=>n.left.offset),p=s(()=>{let e=0,a=0;const l=x.value,d=c.lang.rtl===!0?-1:1;l.top===!0&&o.value!==0?a=`${o.value}px`:l.bottom===!0&&u.value!==0&&(a=`${-u.value}px`),l.left===!0&&r.value!==0?e=`${d*r.value}px`:l.right===!0&&f.value!==0&&(e=`${-d*f.value}px`);const i={transform:`translate(${e}, ${a})`};return t.offset&&(i.margin=`${t.offset[1]}px ${t.offset[0]}px`),l.vertical===!0?(r.value!==0&&(i[c.lang.rtl===!0?"right":"left"]=`${r.value}px`),f.value!==0&&(i[c.lang.rtl===!0?"left":"right"]=`${f.value}px`)):l.horizontal===!0&&(o.value!==0&&(i.top=`${o.value}px`),u.value!==0&&(i.bottom=`${u.value}px`)),i}),g=s(()=>`q-page-sticky row flex-center fixed-${t.position} q-page-sticky--${t.expand===!0?"expand":"shrink"}`);function v(e){const a=q(e.default);return m("div",{class:g.value,style:p.value},t.expand===!0?a:[m("div",a)])}return{$layout:n,getStickyContent:v}}const H=Q({name:"QPageScroller",props:{...S,scrollOffset:{type:Number,default:1e3},reverse:Boolean,duration:{type:Number,default:300},offset:{...S.offset,default:()=>[18,18]}},emits:["click"],setup(t,{slots:c,emit:n}){const{proxy:{$q:x}}=k(),{$layout:o,getStickyContent:f}=T(),u=b(null);let r;const p=s(()=>o.height.value-(o.isContainer.value===!0?o.containerHeight.value:x.screen.height));function g(){return t.reverse===!0?p.value-o.scroll.value.position>t.scrollOffset:o.scroll.value.position>t.scrollOffset}const v=b(g());function e(){const h=g();v.value!==h&&(v.value=h)}function a(){t.reverse===!0?r===void 0&&(r=$(p,e)):l()}$(o.scroll,e),$(()=>t.reverse,a);function l(){r!==void 0&&(r(),r=void 0)}function d(h){const C=V(o.isContainer.value===!0?u.value:o.rootRef.value);B(C,t.reverse===!0?o.height.value:0,t.duration),n("click",h)}function i(){return v.value===!0?m("div",{ref:u,class:"q-page-scroller",onClick:d},f(c)):null}return a(),w(l),()=>m(R,{name:"q-transition--fade"},i)}});export{H as Q};
