"use strict";const c=require("../../../../../common/vendor.js"),a=require("../config/index.js"),O=require("./z-paging-constant.js"),p="Z-PAGING-REFRESHER-TIME-STORAGE-KEY";let o=null,g=!1;const f={};function $(e,n){return()=>{if(j(),!o)return n;const t=o[e];return t===void 0?n:t}}function D(e){let n=null;if(e.touches&&e.touches.length)n=e.touches[0];else if(e.changedTouches&&e.changedTouches.length)n=e.changedTouches[0];else if(e.datail&&e.datail!={})n=e.datail;else return{touchX:0,touchY:0};return{touchX:n.clientX,touchY:n.clientY}}function d(e){if(e&&e.tagName&&e.tagName!=="BODY"&&e.tagName!=="UNI-PAGE-BODY"){const n=e.classList;return n&&n.contains("z-paging-content")?{isFromZp:!0,isPageScroll:n.contains("z-paging-content-page"),isReachedTop:n.contains("z-paging-reached-top"),isUseChatRecordMode:n.contains("z-paging-use-chat-record-mode")}:d(e.parentNode)}else return{isFromZp:!1}}function m(e){return e?e.$refs.paging?e:m(e.$parent):null}function P(e){console.error(`[z-paging]${e}`)}function S(e,n=O.c.delayTime,t){const r=setTimeout(e,n);return t&&(f[t]&&clearTimeout(f[t]),f[t]=r),r}function F(e,n){const t=h()||{};t[n]=e,c.index.setStorageSync(p,t)}function h(){return c.index.getStorageSync(p)}function N(e){const n=h();return n&&n[e]?n[e]:null}function R(e,n){const t=N(e),r=t?L(t,n):n.none;return`${n.title}${r}`}function w(e){if(Object.prototype.toString.call(e)==="[object Number]")return e;let t=!1;return e.indexOf("rpx")!==-1||e.indexOf("upx")!==-1?(e=e.replace("rpx","").replace("upx",""),t=!0):e.indexOf("px")!==-1&&(e=e.replace("px","")),isNaN(e)?0:Number(t?y(e):e)}function y(e){return c.index.upx2px(e)}function T(){return new Date().getTime()}function C(){const e=[],n="0123456789abcdef";for(let t=0;t<10;t++)e[t]=n.substr(Math.floor(Math.random()*16),1);return e.join("")+T()}function b(e){return new Promise(n=>{setTimeout(n,e)})}function Y(e){return Object.prototype.toString.call(e)==="[object Promise]"}function E(e,n){if(Object.prototype.toString.call(e)==="[object String]"){let t=e;t=t.replace("rpx","").replace("upx","").replace("px",""),e.indexOf("rpx")===-1&&e.indexOf("upx")===-1&&e.indexOf("px")!==-1&&(t=parseFloat(t)*2),e=t}return n==="rpx"?e+"rpx":e/2+"px"}function x(e){if(typeof e!="object"||e===null)return e;let n=Array.isArray(e)?[]:{};for(let t in e)e.hasOwnProperty(t)&&(n[t]=x(e[t]));return n}function j(){g||(a.zLocalConfig&&Object.keys(a.zLocalConfig).length&&(o=a.zLocalConfig),!o&&c.index.$zp&&(o=c.index.$zp.config),o=o?Object.keys(o).reduce((e,n)=>(e[Z(n)]=o[n],e),{}):null,g=!0)}function L(e,n){const t=new Date(e),r=new Date,u=new Date(e).setHours(0,0,0,0),_=new Date().setHours(0,0,0,0),l=u-_;let s="";const z=I(t);return l===0?s=n.today:l===-864e5?s=n.yesterday:s=A(t,t.getFullYear()!==r.getFullYear()),`${s} ${z}`}function A(e,n=!0){const t=e.getFullYear(),r=e.getMonth()+1,u=e.getDate();return n?`${t}-${i(r)}-${i(u)}`:`${i(r)}-${i(u)}`}function I(e){const n=e.getHours(),t=e.getMinutes();return`${i(n)}:${i(t)}`}function i(e){return e=e.toString(),e.length===1?"0"+e:e}function Z(e){return e.replace(/-([a-z])/g,(n,t)=>t.toUpperCase())}const B={gc:$,setRefesrherTime:F,getRefesrherFormatTimeByKey:R,getTouch:D,getTouchFromZPaging:d,getParent:m,convertToPx:w,getTime:T,getInstanceId:C,consoleErr:P,delay:S,wait:b,isPromise:Y,addUnit:E,deepCopy:x,rpx2px:y};exports.u=B;
