import{ag as C,co as y,cp as O,U as s,aa as k,c0 as P,ad as m,bY as q,l as b,aZ as $,ap as Q,b7 as w,dC as B,dB as R}from"./index.69621fe4.js";const V={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 z(){const{props:t,proxy:{$q:c}}=k(),n=C(O,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=P(e.default);return m("div",{class:g.value,style:p.value},t.expand===!0?a:[m("div",a)])}return{$layout:n,getStickyContent:v}}var N=q({name:"QPageScroller",props:{...V,scrollOffset:{type:Number,default:1e3},reverse:Boolean,duration:{type:Number,default:300},offset:{default:()=>[18,18]}},emits:["click"],setup(t,{slots:c,emit:n}){const{proxy:{$q:x}}=k(),{$layout:o,getStickyContent:f}=z(),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 S=B(o.isContainer.value===!0?u.value:o.rootRef.value);R(S,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(),Q(l),()=>m(w,{name:"q-transition--fade"},i)}});export{N as Q};
