"use strict";const l=require("../../../../common/vendor.js"),r=require("../mescroll-uni/mescroll-uni.js"),d=require("../mescroll-uni/mescroll-uni-option.js"),a=require("../mescroll-uni/mescroll-i18n.js"),x=require("../mescroll-uni/wxs/mixins.js"),h=e=>{e.wxsCallMethods||(e.wxsCallMethods=[]),e.wxsCallMethods.push("wxsCall")},T=()=>"../mescroll-uni/components/mescroll-top.js",f={name:"mescroll-body",mixins:[x.WxsMixin],components:{MescrollTop:T},props:{down:Object,up:Object,i18n:Object,top:[String,Number],topbar:[Boolean,String],bottom:[String,Number],safearea:Boolean,height:[String,Number],bottombar:{type:Boolean,default:!0},sticky:Boolean},data(){return{mescroll:{optDown:{},optUp:{}},downHight:0,downRate:0,downLoadType:0,upLoadType:0,isShowEmpty:!1,isShowToTop:!1,windowHeight:0,windowBottom:0,statusBarHeight:0}},computed:{minHeight(){return this.toPx(this.height||"100%")+"px"},numTop(){return this.toPx(this.top)},padTop(){return this.numTop+"px"},numBottom(){return this.toPx(this.bottom)},padBottom(){return this.numBottom+"px"},isDownReset(){return this.downLoadType===3||this.downLoadType===4},transition(){return this.isDownReset?"transform 300ms":""},translateY(){return this.downHight>0?"translateY("+this.downHight+"px)":""},isDownLoading(){return this.downLoadType===3},downRotate(){return"rotate("+360*this.downRate+"deg)"},downText(){if(!this.mescroll)return"";switch(this.downLoadType){case 1:return this.mescroll.optDown.textInOffset;case 2:return this.mescroll.optDown.textOutOffset;case 3:return this.mescroll.optDown.textLoading;case 4:return this.mescroll.isDownEndSuccess?this.mescroll.optDown.textSuccess:this.mescroll.isDownEndSuccess==!1?this.mescroll.optDown.textErr:this.mescroll.optDown.textInOffset;default:return this.mescroll.optDown.textInOffset}}},methods:{toPx(e){if(typeof e=="string"){if(e.indexOf("px")!==-1)if(e.indexOf("rpx")!==-1)e=e.replace("rpx","");else if(e.indexOf("upx")!==-1)e=e.replace("upx","");else return Number(e.replace("px",""));else if(e.indexOf("%")!==-1){let c=Number(e.replace("%",""))/100;return this.windowHeight*c}}return e?l.index.upx2px(Number(e)):0},emptyClick(){this.$emit("emptyclick",this.mescroll)},toTopClick(){this.mescroll.scrollTo(0,this.mescroll.optUp.toTop.duration),this.$emit("topclick",this.mescroll)}},created(){let e=this,c={down:{inOffset(){e.downLoadType=1},outOffset(){e.downLoadType=2},onMoving(o,s,i){e.downHight=i,e.downRate=s},showLoading(o,s){e.downLoadType=3,e.downHight=s},beforeEndDownScroll(o){return e.downLoadType=4,o.optDown.beforeEndDelay},endDownScroll(){e.downLoadType=4,e.downHight=0,e.downResetTimer&&(clearTimeout(e.downResetTimer),e.downResetTimer=null),e.downResetTimer=setTimeout(()=>{e.downLoadType===4&&(e.downLoadType=0)},300)},callback:function(o){e.$emit("down",o)}},up:{showLoading(){e.upLoadType=1},showNoMore(){e.upLoadType=2},hideUpScroll(o){e.upLoadType=o.optUp.hasNext?0:3},empty:{onShow(o){e.isShowEmpty=o}},toTop:{onShow(o){e.isShowToTop=o}},callback:function(o){e.$emit("up",o)}}},p=a.mescrollI18n.getType(),m={type:p};r.MeScroll.extend(m,e.i18n),r.MeScroll.extend(m,d.GlobalOption.i18n),r.MeScroll.extend(c,m[p]),r.MeScroll.extend(c,{down:d.GlobalOption.down,up:d.GlobalOption.up});let t=JSON.parse(JSON.stringify({down:e.down,up:e.up}));r.MeScroll.extend(t,c),e.mescroll=new r.MeScroll(t,!0),e.mescroll.i18n=m,e.$emit("init",e.mescroll);const n=l.index.getSystemInfoSync();n.windowHeight&&(e.windowHeight=n.windowHeight),n.windowBottom&&(e.windowBottom=n.windowBottom),n.statusBarHeight&&(e.statusBarHeight=n.statusBarHeight),e.mescroll.setBodyHeight(n.windowHeight),e.mescroll.resetScrollTo((o,s)=>{typeof o=="string"?setTimeout(()=>{let i;o.indexOf("#")==-1&&o.indexOf(".")==-1?i="#"+o:i=o,l.index.createSelectorQuery().select(i).boundingClientRect(function(w){if(w){let u=w.top;u+=e.mescroll.getScrollTop(),l.index.pageScrollTo({scrollTop:u,duration:s})}else l.index.__f__("error","at uni_modules/mescroll-uni/components/mescroll-body/mescroll-body.vue:352",i+" does not exist")}).exec()},30):l.index.pageScrollTo({scrollTop:o,duration:s})}),e.up&&e.up.toTop&&e.up.toTop.safearea!=null||(e.mescroll.optUp.toTop.safearea=e.safearea),l.index.$on("setMescrollGlobalOption",o=>{if(!o)return;let s=o.i18n?o.i18n.type:null;if(s&&e.mescroll.i18n.type!=s&&(e.mescroll.i18n.type=s,a.mescrollI18n.setType(s),r.MeScroll.extend(o,e.mescroll.i18n[s])),o.down){let i=r.MeScroll.extend({},o.down);e.mescroll.optDown=r.MeScroll.extend(i,e.mescroll.optDown)}if(o.up){let i=r.MeScroll.extend({},o.up);e.mescroll.optUp=r.MeScroll.extend(i,e.mescroll.optUp)}})},destroyed(){l.index.$off("setMescrollGlobalOption")}};if(!Array){const e=l.resolveComponent("mescroll-empty"),c=l.resolveComponent("mescroll-top");(e+c)()}const y=()=>"../mescroll-empty/mescroll-empty.js";Math||y();function g(e,c,p,m,t,n){return l.e({a:p.topbar&&t.statusBarHeight},p.topbar&&t.statusBarHeight?{b:t.statusBarHeight+"px",c:p.topbar}:{},{d:t.mescroll.optDown.use},t.mescroll.optDown.use?{e:n.isDownLoading?1:"",f:t.mescroll.optDown.textColor,g:n.downRotate,h:l.t(n.downText),i:t.mescroll.optDown.bgColor,j:t.mescroll.optDown.textColor}:{},{k:t.isShowEmpty},t.isShowEmpty?{l:l.o(n.emptyClick),m:l.p({option:t.mescroll.optUp.empty})}:{},{n:t.mescroll.optUp.use&&!n.isDownLoading&&t.upLoadType!==3},t.mescroll.optUp.use&&!n.isDownLoading&&t.upLoadType!==3?l.e({o:t.mescroll.optUp.textColor,p:l.t(t.mescroll.optUp.textLoading),q:t.upLoadType===1,r:t.upLoadType===2},t.upLoadType===2?{s:l.t(t.mescroll.optUp.textNoMore)}:{},{t:t.mescroll.optUp.bgColor,v:t.mescroll.optUp.textColor}):{},{w:n.translateY,x:n.transition,y:e.callProp,z:p.safearea},p.safearea?{}:{},{A:l.o(n.toTopClick),B:l.o(o=>t.isShowToTop=o),C:l.p({option:t.mescroll.optUp.toTop,modelValue:t.isShowToTop}),D:e.renderBiz.propObserver,E:e.wxsProp,F:p.sticky?1:"",G:n.minHeight,H:n.padTop,I:n.padBottom,J:e.wxsProp})}typeof h=="function"&&h(f);const S=l._export_sfc(f,[["render",g]]);wx.createComponent(S); //# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/mescroll-uni/components/mescroll-body/mescroll-body.js.map