"use strict";const common_vendor=require("../../../../../../common/vendor.js");const commonLayoutModule={data(){return{systemInfo:null,cssSafeAreaInsetBottom:-1,isReadyDestroy:false}},computed:{windowTop(){if(!this.systemInfo)return 0;return this.systemInfo.windowTop||0},safeAreaBottom(){if(!this.systemInfo)return 0;let safeAreaBottom=0;safeAreaBottom=Math.max(this.cssSafeAreaInsetBottom,0);return safeAreaBottom},isOldWebView(){try{const systemInfos=common_vendor.index.getSystemInfoSync().system.split(" ");const deviceType=systemInfos[0];const version=parseInt(systemInfos[1]);if(deviceType==="iOS"&&version<=10||deviceType==="Android"&&version<=6){return true}}catch(e){return false}return false},zSlots(){return this.$slots}},beforeDestroy(){this.isReadyDestroy=true},unmounted(){this.isReadyDestroy=true},methods:{updateFixedLayout(){this.fixed&&this.$nextTick((()=>{this.systemInfo=common_vendor.index.getSystemInfoSync()}))},_getNodeClientRect(select,inDom=true,scrollOffset=false){if(this.isReadyDestroy){return Promise.resolve(false)}inDom=false;let res=!!inDom?common_vendor.index.createSelectorQuery().in(inDom===true?this:inDom):common_vendor.index.createSelectorQuery();scrollOffset?res.select(select).scrollOffset():res.select(select).boundingClientRect();return new Promise(((resolve,reject)=>{res.exec((data=>{resolve(data&&data!=""&&data!=void 0&&data.length?data:false)}))}))},_updateLeftAndRightWidth(targetStyle,parentNodePrefix){this.$nextTick((()=>{let delayTime=0;setTimeout((()=>{["left","right"].map((position=>{this._getNodeClientRect(`.${parentNodePrefix}-${position}`).then((res=>{this.$set(targetStyle,position,res?res[0].width+"px":"0px")}))}))}),delayTime)}))},_getCssSafeAreaInsetBottom(success){this._getNodeClientRect(".zp-safe-area-inset-bottom").then((res=>{this.cssSafeAreaInsetBottom=res?res[0].height:-1;res&&success&&success()}))}}};exports.commonLayoutModule=commonLayoutModule;
