"use strict";const e=require("../../../../common/vendor.js"),t=require("./config.js"),r=require("./validator.js"),n=require("./wechat.js"),o=n.getWindowInfo(),s=n.getAppBaseInfo(),c=n.getDeviceInfo();function a(...e){for(let t=0;t<e.length;t+=1)if(null!==e[t]&&void 0!==e[t])return e[t];return e[e.length-1]}const i=function(...e){const t={}.hasOwnProperty,r=[];return e.forEach((e=>{if(!e)return;const n=typeof e;if("string"===n||"number"===n)r.push(e);else if(Array.isArray(e)&&e.length){const t=i(...e);t&&r.push(t)}else if("object"===n)for(const o in e)t.call(e,o)&&e[o]&&r.push(o)})),r.join(" ")};null==c||c.environment,["mac","windows"].includes(null==c?void 0:c.platform);exports.addUnit=function(e){if(r.isDef(e))return e=String(e),r.isNumeric(e)?`${e}px`:e},exports.appBaseInfo=s,exports.calcIcon=(e,t)=>e&&(r.isBoolean(e)&&t||r.isString(e))?{name:r.isBoolean(e)?t:e}:r.isObject(e)?e:null,exports.classNames=i,exports.coalesce=a,exports.getCharacterLength=(e,t,r)=>{const n=String(a(t,""));if(0===n.length)return{length:0,characters:""};if("maxcharacter"===e){let e=0;for(let t=0;t<n.length;t+=1){let o=0;if(o=n.charCodeAt(t)>127||94===n.charCodeAt(t)?2:1,e+o>r)return{length:e,characters:n.slice(0,t)};e+=o}return{length:e,characters:n}}if("maxlength"===e){const e=n.length>r?r:n.length;return{length:e,characters:n.slice(0,e)}}return{length:n.length,characters:n}},exports.getCurrentPage=function(){const e=getCurrentPages();return e[e.length-1]},exports.getRect=function(t,r,n=!1,o=!1){return new Promise(((o,s)=>{e.index.createSelectorQuery().in(t)[n?"selectAll":"select"](r).boundingClientRect((e=>{e?o(e):s(e)})).exec()}))},exports.hyphenate=function(e){return e.replace(/\B([A-Z])/g,"-$1").toLowerCase()},exports.nextTick=()=>new Promise((e=>{setTimeout((()=>{e()}),33)})),exports.setIcon=(e,t,r)=>t?"string"==typeof t?{[`${e}Name`]:t,[`${e}Data`]:{}}:"object"==typeof t?{[`${e}Name`]:"",[`${e}Data`]:t}:{[`${e}Name`]:r,[`${e}Data`]:{}}:{[`${e}Name`]:"",[`${e}Data`]:{}},exports.styles=function(e){return Object.keys(e).map((t=>`${t}: ${e[t]}`)).join("; ")},exports.systemInfo=o,exports.toCamel=e=>e.replace(/-(\w)/g,((e,t)=>t.toUpperCase())),exports.toPascal=e=>e.split("-").map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(""),exports.uniqueFactory=e=>{let r=0;return()=>{const n=`${t.prefix}_${e}_${r}`;return r+=1,n}},exports.unitConvert=e=>"string"==typeof e?e.includes("rpx")?parseInt(e,10)*a(null==o?void 0:o.screenWidth,750)/750:parseInt(e,10):a(e,0);
