"use strict";const o=require("../z-paging-utils.js"),t={props:{autoShowBackToTop:{type:Boolean,default:o.u.gc("autoShowBackToTop",!1)},backToTopThreshold:{type:[Number,String],default:o.u.gc("backToTopThreshold","400rpx")},backToTopImg:{type:String,default:o.u.gc("backToTopImg","")},backToTopWithAnimate:{type:Boolean,default:o.u.gc("backToTopWithAnimate",!0)},backToTopBottom:{type:[Number,String],default:o.u.gc("backToTopBottom","160rpx")},backToTopStyle:{type:Object,default:o.u.gc("backToTopStyle",{})},enableBackToTop:{type:Boolean,default:o.u.gc("enableBackToTop",!0)}},data:()=>({backToTopClass:"zp-back-to-top zp-back-to-top-hide",lastBackToTopShowTime:0,showBackToTopClass:!1}),computed:{backToTopThresholdUnitConverted(){return o.u.addUnit(this.backToTopThreshold,this.unit)},backToTopBottomUnitConverted(){return o.u.addUnit(this.backToTopBottom,this.unit)},finalEnableBackToTop(){return!this.usePageScroll&&this.enableBackToTop},finalBackToTopThreshold(){return o.u.convertToPx(this.backToTopThresholdUnitConverted)},finalBackToTopStyle(){const t=this.backToTopStyle;return t.bottom||(t.bottom=this.windowBottom+o.u.convertToPx(this.backToTopBottomUnitConverted)+"px"),t.position||(t.position=this.usePageScroll?"fixed":"absolute"),t},finalBackToTopClass(){return`${this.backToTopClass} zp-back-to-top-${this.unit}`}},methods:{_backToTopClick(){let o=!1;this.$emit("backToTopClick",(t=>{(void 0===t||!0===t)&&this._handleToTop(),o=!0})),this.$nextTick((()=>{!o&&this._handleToTop()}))},_handleToTop(){!this.backToTopWithAnimate&&this._checkShouldShowBackToTop(0),this.useChatRecordMode?this.scrollToBottom(this.backToTopWithAnimate):this.scrollToTop(this.backToTopWithAnimate)},_checkShouldShowBackToTop(t){this.autoShowBackToTop?t>this.finalBackToTopThreshold?this.showBackToTopClass||(this.showBackToTopClass=!0,this.lastBackToTopShowTime=(new Date).getTime(),o.u.delay((()=>{this.backToTopClass="zp-back-to-top zp-back-to-top-show"}),300)):this.showBackToTopClass&&(this.backToTopClass="zp-back-to-top zp-back-to-top-hide",o.u.delay((()=>{this.showBackToTopClass=!1}),(new Date).getTime()-this.lastBackToTopShowTime<500?0:300)):this.showBackToTopClass=!1}}};exports.backToTopModule=t;
