Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ray-js/wechat-helper

Package Overview
Dependencies
Maintainers
1
Versions
231
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ray-js/wechat-helper - npm Package Compare versions

Comparing version
0.3.31-beta.2
to
0.3.31-beta.3
+1
-1
index.esm.js

@@ -1,1 +0,1 @@

function e(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function c(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}s((r=r.apply(e,t||[])).next())}))}function t(e,t){return(e&Math.pow(2,t))>>t==1}function n(e){return e.reduce(((e,t,n)=>t<<n|e),0)}function r(e){if(e.length>6)throw new Error("The number of bytes exceeds 6");const t=new DataView(e.buffer);switch(e.length){case 1:return t.getInt8(0);case 2:return t.getInt16(0);case 4:return t.getInt32(0);default:{let t=o(e);const n=Math.pow(2,8*e.length)/2;return t>=n&&(t%=n,t=-1*(n-t)),t}}}function o(e){const t=new DataView(e.buffer);switch(e.length){case 0:throw new Error("data of Uint8Array is empty");case 1:return t.getUint8(0);case 2:return t.getUint16(0);case 3:return e.reduce(((e,t)=>e<<8|t),0);case 4:return t.getUint32(0);default:return parseInt(c(e),16)}}function a(e){return e.reduceRight(((e,t)=>{const n=i(t);return e.concat(n)}),[])}function i(e){return e.toString(2).split("").map((e=>Number(e))).reverse()}function c(e){return e.length?e.length<=4?o(e).toString(16).padStart(2*e.length,"0").toUpperCase():e.reduce(((e,t)=>(e.push(t.toString(16).padStart(2,"0")),e)),[]).join("").toUpperCase():""}function s(e){return e.length%2!=0?"":e.reduce(((e,t)=>(e.push(String.fromCharCode(t)),e)),[]).join("")}function u(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];r<128?(t.push(String.fromCharCode(r)),n++):r>191&&r<224?(t.push(String.fromCharCode((31&r)<<6|63&e[n+1])),n+=2):(t.push(String.fromCharCode((15&r)<<12|(63&e[n+1])<<6|63&e[n+2])),n+=3)}return t.join("")}function l(e){const t=[],n=e.length;for(let r=0;r<n;r++){const n=e.charCodeAt(r);n>=65536&&n<=1114111?(t.push(n>>18&7|240),t.push(n>>12&63|128),t.push(n>>6&63|128),t.push(63&n|128)):n>=2048&&n<=65535?(t.push(n>>12&15|224),t.push(n>>6&63|128),t.push(63&n|128)):n>=128&&n<=2047?(t.push(n>>6&31|192),t.push(63&n|128)):t.push(255&n)}return new Uint8Array(t)}const f=e=>{const t=new Uint8Array(e);for(let n=0;n<e;n++)t[n]=Math.floor(256*Math.random());return t},h=e=>{const t=[];do{let n=e%128;(e=parseInt(""+e/128))>0&&(n|=128),t.push(n)}while(e>0);return new Uint8Array(t)},g=(e,t=0)=>{let n=0,r=t;for(;r<4&&r<e.length;r++){const o=e[r];if(n|=(127&o)<<7*(r-t),0==(o>>7&1))break}return{num:n,end:r-t<4?r+1:r}},p=(e,t)=>{const n=new Uint32Array([e]),r=new Uint8Array(n.buffer);return r.reverse(),t?r.slice(4-t):r},d=(e,t)=>{const n=new Int32Array([e]),r=new Int8Array(n.buffer);return r.reverse(),t?new Uint8Array(r.slice(4-t)):new Uint8Array(r)},y=e=>{if(e.length%2!=0)throw new Error("hex length error");const t=e.length/2,n=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=parseInt(e.slice(2*r,2*r+2),16);return n},v="undefined"!=typeof wx,S="undefined"!=typeof my,C="undefined"!=typeof window&&"undefined"!=typeof document,B="undefined"!=typeof wx?wx:"undefined"!=typeof my?my:"undefined"!=typeof ty?ty:{canIUse:e=>!1,getSystemInfoSync:()=>({})};function w(e,t){return B[e]||t&&B[t]||(()=>{console.warn(`The Api ${e} is not found`)})}function A(e,t,n){"function"==typeof t&&(n=t,t="");const r=B[e]||t&&B[t];return r?e=>new Promise(((t,o)=>{const{success:a,fail:i}=e||{};r(Object.assign(Object.assign({},e),{success:e=>{n&&(e=n(e)),a&&a(e),t(e)},fail:e=>{i&&i(e),"undefined"!=typeof my&&e.error&&(e.errCode=e.error,e.errMsg=e.errorMessage),o(e)}}))})):()=>(console.warn(`The Api ${e} is not found`),Promise.resolve())}const b=w("getFileSystemManager"),m=A("downloadFile"),D=A("getFileInfo"),I=w("getSystemInfoSync"),E=w("getAccountInfoSync"),L=w("getAppAuthorizeSetting"),U=A("authorizeForMiniProgram"),j=A("authorize"),T=A("getBLEDeviceServices",(e=>S?{services:e.services.map((e=>({uuid:e.serviceId.toUpperCase(),isPrimary:e.isPrimary})))}:e)),M=A("getBLEDeviceCharacteristics",(e=>S?{characteristics:e.characteristics.map((e=>Object.assign(Object.assign({},e),{uuid:e.characteristicId.toUpperCase()})))}:e)),O=A("createBLEConnection","connectBLEDevice"),P=A("closeBLEConnection","disconnectBLEDevice"),_=A("startBluetoothDevicesDiscovery"),V=A("stopBluetoothDevicesDiscovery"),k=A("getBLEDeviceRSSI"),F=A("getConnectedBluetoothDevices"),x=w("onBLEConnectionStateChange","onBLEConnectionStateChanged"),W=w("offBLEConnectionStateChange","offBLEConnectionStateChanged"),z=w("onBluetoothAdapterStateChange"),$=w("offBluetoothAdapterStateChange"),H=A("notifyBLECharacteristicValueChange"),R=A("readBLECharacteristicValue"),G=A("getBLEMTU"),q=A("setBLEMTU"),K=A("getBluetoothAdapterState"),N=new Map,J=A("getBluetoothDevices",(e=>S?{devices:e.devices.map((e=>Object.assign(Object.assign({},e),{connectable:void 0===e.connectable||e.connectable,advertisData:y(e.advertisData),serviceData:Object.keys(e.serviceData||{}).reduce(((t,n)=>(t[n]=y(e.serviceData[n]),t)),{})})))}:e)),Q=A("writeBLECharacteristicValue"),X=A("createBLEPeripheralServer"),Y=A("openBluetoothAdapter"),Z=A("closeBluetoothAdapter"),ee=w("connectSocket"),te=A("login"),ne=A("getUserInfo"),re=w("createUDPSocket"),oe=w("createTCPSocket"),ae=A("scanCode"),ie=A("getSetting"),ce=A("getLocalIPAddress"),se=A("startWifi"),ue=A("stopWifi"),le=A("getConnectedWifi"),fe=A("request"),he=w("onAppHide"),ge=w("offAppHide"),pe=w("onAppShow"),de=w("offAppShow"),ye=A("navigateToMiniProgram"),ve=A("navigateTo"),Se=A("redirectTo"),Ce=A("navigateBack"),Be=A("reLaunch"),we=w("setStorageSync"),Ae=w("getStorageSync"),be=w("removeStorageSync"),me=w("showToast"),De=w("getAppBaseInfo"),Ie=w("getDeviceInfo"),Ee=B.env||{},Le=w("onError");var Ue=Object.freeze({__proto__:null,isWechat:v,isAlipay:S,isWeb:C,hasBaseApi:e=>B.canIUse?B.canIUse(e):!!B[e],getFileSystemManager:b,downloadFile:m,getFileInfo:D,getSystemInfoSync:I,getAccountInfoSync:E,getAppAuthorizeSetting:L,authorizeForMiniProgram:U,authorize:j,getBLEDeviceServices:T,getBLEDeviceCharacteristics:M,createBLEConnection:O,closeBLEConnection:P,startBluetoothDevicesDiscovery:_,stopBluetoothDevicesDiscovery:V,getBLEDeviceRSSI:k,getConnectedBluetoothDevices:F,onBLEConnectionStateChange:x,offBLEConnectionStateChange:W,onBluetoothAdapterStateChange:z,offBluetoothAdapterStateChange:$,notifyBLECharacteristicValueChange:H,readBLECharacteristicValue:R,getBLEMTU:G,setBLEMTU:q,getBluetoothAdapterState:K,onBluetoothDeviceFound:e=>{if(S){const t=({devices:t})=>{const n=t.map((e=>Object.assign(Object.assign({},e),{connectable:void 0===e.connectable||e.connectable,advertisData:y(e.advertisData),serviceData:Object.keys(e.serviceData||{}).reduce(((t,n)=>(t[n]=y(e.serviceData[n]),t)),{})})));e({devices:n})};return N.set(e,t),void B.onBluetoothDeviceFound(t)}B.onBluetoothDeviceFound(e)},offBluetoothDeviceFound:e=>{S&&N.has(e)?B.offBluetoothDeviceFound(N.get(e)):B.offBluetoothDeviceFound(e)},getBluetoothDevices:J,onBLECharacteristicValueChange:e=>{if(S){const t=t=>{e(Object.assign(Object.assign({},t),{value:y(t.value)}))};return N.set(e,t),void B.onBLECharacteristicValueChange(t)}B.onBLECharacteristicValueChange(e)},offBLECharacteristicValueChange:e=>{S&&N.has(e)?B.offBLECharacteristicValueChange(N.get(e)):B.offBLECharacteristicValueChange(e)},writeBLECharacteristicValue:Q,createBLEPeripheralServer:X,openBluetoothAdapter:Y,closeBluetoothAdapter:Z,connectSocket:ee,login:te,getUserInfo:ne,createUDPSocket:re,createTCPSocket:oe,scanCode:ae,getSetting:ie,getLocalIPAddress:ce,startWifi:se,stopWifi:ue,getConnectedWifi:le,request:fe,onAppHide:he,offAppHide:ge,onAppShow:pe,offAppShow:de,navigateToMiniProgram:ye,navigateTo:ve,redirectTo:Se,navigateBack:Ce,reLaunch:Be,setStorageSync:we,getStorageSync:Ae,removeStorageSync:be,showToast:me,getAppBaseInfo:De,getDeviceInfo:Ie,env:Ee,onError:Le});const je=Ie()||{},Te=De()||{};function Me(e,t=2){let n=e;return"string"==typeof e&&(n=parseInt(e)),n.toString(16).padStart(t,"0")}function Oe(e){const t=[];return Array.prototype.map.call(new Uint8Array(e),(function(e){t.push(Me(e))})),t}function Pe(e){const t=[];if("string"==typeof e)for(let n=0;n<e.length;n+=2){const r=parseInt(e.slice(n,n+2),16);t.push(String.fromCharCode(r))}else for(let n=0;n<e.length;n++){const r=parseInt(e[n],16);t.push(String.fromCharCode(r))}return t.join("")}function _e(e){const t=[];if("string"==typeof e)for(let n=0;n<e.length;n+=2)t.push(parseInt(e.slice(n,n+2),16));else if("string"==typeof e[0])for(let n=0;n<e.length;n++)t.push(parseInt(e[n],16));return new Uint8Array(t)}const Ve=(e,t=!1)=>{if(!e)return"";return Object.keys(e).reduce(((n,r)=>{const o=e[r];return void 0!==o&&n.push(`${r}=${t?encodeURIComponent(o):o}`),n}),[]).join("&")},ke=e=>xe(Te.SDKVersion,e),Fe=()=>Te.SDKVersion,xe=(e,t,n=!0)=>{const r=e.split("."),o=t.split("."),a=Math.max(o.length,r.length);for(;o.length<a;)o.splice(0,0,"0");for(;r.length<a;)r.splice(0,0,"0");for(let e=0;e<a;e++){const t=parseInt(r[e]),n=parseInt(o[e]);if(t>n)return!0;if(t===n)break;return!1}return n},We=e=>e.replace(/^\S/,(function(e){return e.toUpperCase()})),ze=e=>{if(0!==e.indexOf("http")){return`https://images.tuyacn.com${/^\/[\w\W]+/.test(e)?"":"/"}${e}`}return e};function $e(e){return"object"!=typeof e?e:Array.isArray(e)?e.map((e=>$e(e))):Object.keys(e).reduce(((t,n)=>{const r=n.split("_").map(((e,t)=>t>0?We(e):e)).join("");let o=e[n];return Array.isArray(o)?o=o.map((e=>$e(e))):"object"==typeof o&&(o=$e(o)),t[r]=o,t}),{})}const He="ios"===je.platform,Re="android"===je.platform,Ge="ohos"===je.platform,qe=(t,n)=>e(void 0,void 0,void 0,(function*(){return new Promise((e=>{if(n){const r=t/10;let o=0;const a=setInterval((()=>{o+=r,o>=t&&(clearInterval(a),e(!0)),n()&&(clearInterval(a),e(!0))}),r)}setTimeout((()=>{e(!0)}),t)}))})),Ke=()=>Te.language||"zh",Ne=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=1&t?t>>>1^3988292384:t>>>1;Ne[e]=t}function Je(e){let t=-1;for(let n=0,r=e.length;n<r;n++)t=t>>>8^Ne[255&(t^e[n])];return-1^t}function Qe(e){let t=65535;let n,r;for(n=0;n<e.length;n++)for(t^=255&e[n],r=0;r<8;r++)0!=(1&t)?(t>>=1,t^=40961):t>>=1;return t}const Xe={initial_value:0,table:function(e){const t=[];for(let n=0;n<256;++n){let r=n;for(let t=0;t<8;++t)r=0!=(128&r)?255&(r<<1^e):r<<1&255;t[n]=r}return t}(7)},Ye=e=>{let t=Xe.initial_value;for(let n=0;n<e.length;n++)t=Xe.table[255&(t^e[n])];return t},Ze=e=>{const t=new DataView(e.buffer),n=[];for(let r=0;r<e.length;r+=4)n.push(t.getInt32(r));return n},et=e=>{const t=new Uint8Array(4*e.length),n=new DataView(t.buffer);for(let t=0;t<e.length;t++)n.setInt32(4*t,e[t]);return t};const tt={encrypt:function(e,t){const n=Ze(e),r=Ze(t),o=n.length-1;let a,i,c=n[o],s=n[0],u=Math.floor(6+52/(o+1)),l=0;for(;u-- >0;){l=l+2654435769&4294967295,i=l>>>2&3;let e=0;for(;e<o;e++)s=n[e+1],a=(c>>>5^s<<2)+(s>>>3^c<<4)^(l^s)+(r[3&e^i]^c),c=n[e]=n[e]+a&4294967295;s=n[0],a=(c>>>5^s<<2)+(s>>>3^c<<4)^(l^s)+(r[3&e^i]^c),c=n[o]=n[o]+a&4294967295}return et(n)},decrypt:function(e,t){const n=Ze(e),r=Ze(t),o=n.length-1;let a=n[o-1],i=n[0];const c=2654435769;let s,u,l=Math.floor(6+52/(o+1))*c&4294967295;for(;0!==l;){u=l>>>2&3;let e=o;for(;e>0;e--)a=n[e-1],s=(a>>>5^i<<2)+(i>>>3^a<<4)^(l^i)+(r[3&e^u]^a),i=n[e]=n[e]-s&4294967295;a=n[o],s=(a>>>5^i<<2)+(i>>>3^a<<4)^(l^i)+(r[3&e^u]^a),i=n[0]=n[0]-s&4294967295,l=l-c&4294967295}return et(n)}},nt=()=>{if("undefined"!=typeof globalThis)try{return globalThis.__tyGlobal||(globalThis.__tyGlobal={}),globalThis.__tyGlobal}catch(e){}return void 0===Object.prototype.__globalData&&Object.defineProperty(Object.prototype,"__globalData",{value:{},configurable:!1,enumerable:!1}),Object.prototype.__globalData};function rt(e,t){const n=nt();return n[e]?n[e][t]:null}function ot(e){const t=nt();return t[e]?t[e]:null}function at(e,t,n){const r=nt();r[e]||(r[e]={}),r[e][t]=n}function it(e){const t=nt();t[e]&&(t[e]={})}export{Ue as BaseApi,Qe as CRC16,Je as CRC32,Ye as CRC8,Oe as ab2hex,t as bitToBoolean,n as bitsToUint,a as bytesToBits,s as bytesToCharts,c as bytesToHex,r as bytesToInt,g as bytesToIntBy128,u as bytesToString,o as bytesToUint,xe as checkVersion,ke as checkWxVersion,it as clearCache,Me as dec2hex,We as firstUpperCase,Ve as formatQuery,rt as getCache,ot as getCacheSpace,nt as getGlobal,ze as getImageUrl,Ke as getLanguage,Fe as getWxSDKVersion,_e as hex2ab,Pe as hex2string,y as hexToBytes,d as intToBytes,Re as isAndroid,Ge as isHarmonyOS,He as isIOS,$e as keyToHump,i as numToBits,f as randomBytes,at as setCache,qe as sleep,l as stringToBytes,p as uintToBytes,h as uintToBytesBy128,tt as xxtea};
function e(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{s(r.next(e))}catch(e){a(e)}}function c(e){try{s(r.throw(e))}catch(e){a(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,c)}s((r=r.apply(e,t||[])).next())}))}function t(e,t){return(e&Math.pow(2,t))>>t==1}function n(e){return e.reduce(((e,t,n)=>t<<n|e),0)}function r(e){if(e.length>6)throw new Error("The number of bytes exceeds 6");const t=new DataView(e.buffer);switch(e.length){case 1:return t.getInt8(0);case 2:return t.getInt16(0);case 4:return t.getInt32(0);default:{let t=o(e);const n=Math.pow(2,8*e.length)/2;return t>=n&&(t%=n,t=-1*(n-t)),t}}}function o(e){const t=new DataView(e.buffer);switch(e.length){case 0:throw new Error("data of Uint8Array is empty");case 1:return t.getUint8(0);case 2:return t.getUint16(0);case 3:return e.reduce(((e,t)=>e<<8|t),0);case 4:return t.getUint32(0);default:return parseInt(c(e),16)}}function a(e){return e.reduceRight(((e,t)=>{const n=i(t);return e.concat(n)}),[])}function i(e){return e.toString(2).split("").map((e=>Number(e))).reverse()}function c(e){return e.length?e.length<=4?o(e).toString(16).padStart(2*e.length,"0").toUpperCase():e.reduce(((e,t)=>(e.push(t.toString(16).padStart(2,"0")),e)),[]).join("").toUpperCase():""}function s(e){return e.length%2!=0?"":e.reduce(((e,t)=>(e.push(String.fromCharCode(t)),e)),[]).join("")}function u(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];r<128?(t.push(String.fromCharCode(r)),n++):r>191&&r<224?(t.push(String.fromCharCode((31&r)<<6|63&e[n+1])),n+=2):(t.push(String.fromCharCode((15&r)<<12|(63&e[n+1])<<6|63&e[n+2])),n+=3)}return t.join("")}function l(e){const t=[],n=e.length;for(let r=0;r<n;r++){const n=e.charCodeAt(r);n>=65536&&n<=1114111?(t.push(n>>18&7|240),t.push(n>>12&63|128),t.push(n>>6&63|128),t.push(63&n|128)):n>=2048&&n<=65535?(t.push(n>>12&15|224),t.push(n>>6&63|128),t.push(63&n|128)):n>=128&&n<=2047?(t.push(n>>6&31|192),t.push(63&n|128)):t.push(255&n)}return new Uint8Array(t)}const f=e=>{const t=new Uint8Array(e);for(let n=0;n<e;n++)t[n]=Math.floor(256*Math.random());return t},h=e=>{const t=[];do{let n=e%128;(e=parseInt(""+e/128))>0&&(n|=128),t.push(n)}while(e>0);return new Uint8Array(t)},g=(e,t=0)=>{let n=0,r=t;for(;r<4&&r<e.length;r++){const o=e[r];if(n|=(127&o)<<7*(r-t),0==(o>>7&1))break}return{num:n,end:r-t<4?r+1:r}},p=(e,t)=>{const n=new Uint32Array([e]),r=new Uint8Array(n.buffer);return r.reverse(),t?r.slice(4-t):r},d=(e,t)=>{const n=new Int32Array([e]),r=new Int8Array(n.buffer);return r.reverse(),t?new Uint8Array(r.slice(4-t)):new Uint8Array(r)},y=e=>{if(e.length%2!=0)throw new Error("hex length error");const t=e.length/2,n=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=parseInt(e.slice(2*r,2*r+2),16);return n},v="undefined"!=typeof wx,S="undefined"!=typeof my,C="undefined"!=typeof window&&"undefined"!=typeof document,B="undefined"!=typeof wx?wx:"undefined"!=typeof my?my:"undefined"!=typeof ty?ty:{canIUse:e=>!1,getSystemInfoSync:()=>({})};function w(e,t){return B[e]||t&&B[t]||(()=>{console.warn(`The Api ${e} is not found`)})}function A(e,t,n){"function"==typeof t&&(n=t,t="");const r=B[e]||t&&B[t];return r?e=>new Promise(((t,o)=>{const{success:a,fail:i}=e||{};r(Object.assign(Object.assign({},e),{success:e=>{n&&(e=n(e)),a&&a(e),t(e)},fail:e=>{i&&i(e),"undefined"!=typeof my&&e.error&&(e.errCode=e.error,e.errMsg=e.errorMessage),o(e)}}))})):()=>(console.warn(`The Api ${e} is not found`),Promise.resolve())}const b=w("getFileSystemManager"),m=A("downloadFile"),D=A("getFileInfo"),I=w("getSystemInfoSync"),E=w("getAccountInfoSync"),L=w("getAppAuthorizeSetting"),U=A("authorizeForMiniProgram"),j=A("authorize"),M=A("getBLEDeviceServices",(e=>S?{services:e.services.map((e=>({uuid:e.serviceId.toUpperCase(),isPrimary:e.isPrimary})))}:e)),T=A("getBLEDeviceCharacteristics",(e=>S?{characteristics:e.characteristics.map((e=>Object.assign(Object.assign({},e),{uuid:e.characteristicId.toUpperCase()})))}:e)),O=A("createBLEConnection","connectBLEDevice"),P=A("closeBLEConnection","disconnectBLEDevice"),V=A("startBluetoothDevicesDiscovery"),_=A("stopBluetoothDevicesDiscovery"),k=A("getBLEDeviceRSSI"),F=A("getConnectedBluetoothDevices"),x=w("onBLEConnectionStateChange","onBLEConnectionStateChanged"),W=w("offBLEConnectionStateChange","offBLEConnectionStateChanged"),z=w("onBluetoothAdapterStateChange"),$=w("offBluetoothAdapterStateChange"),H=A("notifyBLECharacteristicValueChange"),R=A("readBLECharacteristicValue"),G=A("getBLEMTU"),q=A("setBLEMTU"),K=A("getBluetoothAdapterState"),N=new Map,J=A("getBluetoothDevices",(e=>S?{devices:e.devices.map((e=>Object.assign(Object.assign({},e),{connectable:void 0===e.connectable||e.connectable,advertisData:y(e.advertisData),serviceData:Object.keys(e.serviceData||{}).reduce(((t,n)=>(t[n]=y(e.serviceData[n]),t)),{})})))}:e)),Q=A("writeBLECharacteristicValue"),X=A("createBLEPeripheralServer"),Y=A("openBluetoothAdapter"),Z=A("closeBluetoothAdapter"),ee=w("connectSocket"),te=A("login"),ne=A("getUserInfo"),re=w("createUDPSocket"),oe=w("createTCPSocket"),ae=A("scanCode"),ie=A("getSetting"),ce=A("getLocalIPAddress"),se=A("startWifi"),ue=A("stopWifi"),le=A("getConnectedWifi"),fe=A("request"),he=w("onAppHide"),ge=w("offAppHide"),pe=w("onAppShow"),de=w("offAppShow"),ye=A("navigateToMiniProgram"),ve=A("navigateTo"),Se=A("redirectTo"),Ce=A("navigateBack"),Be=A("reLaunch"),we=w("setStorageSync"),Ae=w("getStorageSync"),be=w("removeStorageSync"),me=w("showToast"),De=w("getAppBaseInfo"),Ie=w("getDeviceInfo"),Ee=B.env||{},Le=w("onError");var Ue=Object.freeze({__proto__:null,isWechat:v,isAlipay:S,isWeb:C,hasBaseApi:e=>B.canIUse?B.canIUse(e):!!B[e],getFileSystemManager:b,downloadFile:m,getFileInfo:D,getSystemInfoSync:I,getAccountInfoSync:E,getAppAuthorizeSetting:L,authorizeForMiniProgram:U,authorize:j,getBLEDeviceServices:M,getBLEDeviceCharacteristics:T,createBLEConnection:O,closeBLEConnection:P,startBluetoothDevicesDiscovery:V,stopBluetoothDevicesDiscovery:_,getBLEDeviceRSSI:k,getConnectedBluetoothDevices:F,onBLEConnectionStateChange:x,offBLEConnectionStateChange:W,onBluetoothAdapterStateChange:z,offBluetoothAdapterStateChange:$,notifyBLECharacteristicValueChange:H,readBLECharacteristicValue:R,getBLEMTU:G,setBLEMTU:q,getBluetoothAdapterState:K,onBluetoothDeviceFound:e=>{if(S){const t=({devices:t})=>{const n=t.map((e=>Object.assign(Object.assign({},e),{connectable:void 0===e.connectable||e.connectable,advertisData:y(e.advertisData),serviceData:Object.keys(e.serviceData||{}).reduce(((t,n)=>(t[n]=y(e.serviceData[n]),t)),{})})));e({devices:n})};return N.set(e,t),void B.onBluetoothDeviceFound(t)}B.onBluetoothDeviceFound(e)},offBluetoothDeviceFound:e=>{S&&N.has(e)?B.offBluetoothDeviceFound(N.get(e)):B.offBluetoothDeviceFound(e)},getBluetoothDevices:J,onBLECharacteristicValueChange:e=>{if(S){const t=t=>{e(Object.assign(Object.assign({},t),{value:y(t.value)}))};return N.set(e,t),void B.onBLECharacteristicValueChange(t)}B.onBLECharacteristicValueChange(e)},offBLECharacteristicValueChange:e=>{S&&N.has(e)?B.offBLECharacteristicValueChange(N.get(e)):B.offBLECharacteristicValueChange(e)},writeBLECharacteristicValue:Q,createBLEPeripheralServer:X,openBluetoothAdapter:Y,closeBluetoothAdapter:Z,connectSocket:ee,login:te,getUserInfo:ne,createUDPSocket:re,createTCPSocket:oe,scanCode:ae,getSetting:ie,getLocalIPAddress:ce,startWifi:se,stopWifi:ue,getConnectedWifi:le,request:fe,onAppHide:he,offAppHide:ge,onAppShow:pe,offAppShow:de,navigateToMiniProgram:ye,navigateTo:ve,redirectTo:Se,navigateBack:Ce,reLaunch:Be,setStorageSync:we,getStorageSync:Ae,removeStorageSync:be,showToast:me,getAppBaseInfo:De,getDeviceInfo:Ie,env:Ee,onError:Le});const je=Ie()||{},Me=De()||{};function Te(e,t=2){let n=e;return"string"==typeof e&&(n=parseInt(e)),n.toString(16).padStart(t,"0")}function Oe(e){const t=[];return Array.prototype.map.call(new Uint8Array(e),(function(e){t.push(Te(e))})),t}function Pe(e){const t=[];if("string"==typeof e)for(let n=0;n<e.length;n+=2){const r=parseInt(e.slice(n,n+2),16);t.push(String.fromCharCode(r))}else for(let n=0;n<e.length;n++){const r=parseInt(e[n],16);t.push(String.fromCharCode(r))}return t.join("")}function Ve(e){const t=[];if("string"==typeof e)for(let n=0;n<e.length;n+=2)t.push(parseInt(e.slice(n,n+2),16));else if("string"==typeof e[0])for(let n=0;n<e.length;n++)t.push(parseInt(e[n],16));return new Uint8Array(t)}const _e=(e,t=!1)=>{if(!e)return"";return Object.keys(e).reduce(((n,r)=>{const o=e[r];return void 0!==o&&n.push(`${r}=${t?encodeURIComponent(o):o}`),n}),[]).join("&")},ke=e=>xe(Me.SDKVersion,e),Fe=()=>Me.SDKVersion,xe=(e,t,n=!0)=>{const r=e.split("."),o=t.split("."),a=Math.max(o.length,r.length);for(;o.length<a;)o.splice(0,0,"0");for(;r.length<a;)r.splice(0,0,"0");for(let e=0;e<a;e++){const t=parseInt(r[e]),n=parseInt(o[e]);if(t>n)return!0;if(t===n)break;return!1}return n},We=e=>e.replace(/^\S/,(function(e){return e.toUpperCase()})),ze=e=>{if(0!==e.indexOf("http")){return`https://images.tuyacn.com${/^\/[\w\W]+/.test(e)?"":"/"}${e}`}return e};function $e(e){return"object"!=typeof e?e:Array.isArray(e)?e.map((e=>$e(e))):Object.keys(e).reduce(((t,n)=>{const r=n.split("_").map(((e,t)=>t>0?We(e):e)).join("");let o=e[n];return Array.isArray(o)?o=o.map((e=>$e(e))):"object"==typeof o&&(o=$e(o)),t[r]=o,t}),{})}const He="ios"===je.platform,Re="android"===je.platform,Ge="ohos"===je.platform,qe=(t,n)=>e(void 0,void 0,void 0,(function*(){return new Promise((e=>{if(n){const r=t/10;let o=0;const a=setInterval((()=>{o+=r,o>=t&&(clearInterval(a),e(!0)),n()&&(clearInterval(a),e(!0))}),r)}setTimeout((()=>{e(!0)}),t)}))})),Ke=()=>Me.language||"zh",Ne=e=>{const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";let n="";for(let r=0;r<e;r++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},Je=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=1&t?t>>>1^3988292384:t>>>1;Je[e]=t}function Qe(e){let t=-1;for(let n=0,r=e.length;n<r;n++)t=t>>>8^Je[255&(t^e[n])];return-1^t}function Xe(e){let t=65535;let n,r;for(n=0;n<e.length;n++)for(t^=255&e[n],r=0;r<8;r++)0!=(1&t)?(t>>=1,t^=40961):t>>=1;return t}const Ye={initial_value:0,table:function(e){const t=[];for(let n=0;n<256;++n){let r=n;for(let t=0;t<8;++t)r=0!=(128&r)?255&(r<<1^e):r<<1&255;t[n]=r}return t}(7)},Ze=e=>{let t=Ye.initial_value;for(let n=0;n<e.length;n++)t=Ye.table[255&(t^e[n])];return t},et=e=>{const t=new DataView(e.buffer),n=[];for(let r=0;r<e.length;r+=4)n.push(t.getInt32(r));return n},tt=e=>{const t=new Uint8Array(4*e.length),n=new DataView(t.buffer);for(let t=0;t<e.length;t++)n.setInt32(4*t,e[t]);return t};const nt={encrypt:function(e,t){const n=et(e),r=et(t),o=n.length-1;let a,i,c=n[o],s=n[0],u=Math.floor(6+52/(o+1)),l=0;for(;u-- >0;){l=l+2654435769&4294967295,i=l>>>2&3;let e=0;for(;e<o;e++)s=n[e+1],a=(c>>>5^s<<2)+(s>>>3^c<<4)^(l^s)+(r[3&e^i]^c),c=n[e]=n[e]+a&4294967295;s=n[0],a=(c>>>5^s<<2)+(s>>>3^c<<4)^(l^s)+(r[3&e^i]^c),c=n[o]=n[o]+a&4294967295}return tt(n)},decrypt:function(e,t){const n=et(e),r=et(t),o=n.length-1;let a=n[o-1],i=n[0];const c=2654435769;let s,u,l=Math.floor(6+52/(o+1))*c&4294967295;for(;0!==l;){u=l>>>2&3;let e=o;for(;e>0;e--)a=n[e-1],s=(a>>>5^i<<2)+(i>>>3^a<<4)^(l^i)+(r[3&e^u]^a),i=n[e]=n[e]-s&4294967295;a=n[o],s=(a>>>5^i<<2)+(i>>>3^a<<4)^(l^i)+(r[3&e^u]^a),i=n[0]=n[0]-s&4294967295,l=l-c&4294967295}return tt(n)}},rt=()=>{if("undefined"!=typeof globalThis)try{return globalThis.__tyGlobal||(globalThis.__tyGlobal={}),globalThis.__tyGlobal}catch(e){}return void 0===Object.prototype.__globalData&&Object.defineProperty(Object.prototype,"__globalData",{value:{},configurable:!1,enumerable:!1}),Object.prototype.__globalData};function ot(e,t){const n=rt();return n[e]?n[e][t]:null}function at(e){const t=rt();return t[e]?t[e]:null}function it(e,t,n){const r=rt();r[e]||(r[e]={}),r[e][t]=n}function ct(e){const t=rt();t[e]&&(t[e]={})}export{Ue as BaseApi,Xe as CRC16,Qe as CRC32,Ze as CRC8,Oe as ab2hex,t as bitToBoolean,n as bitsToUint,a as bytesToBits,s as bytesToCharts,c as bytesToHex,r as bytesToInt,g as bytesToIntBy128,u as bytesToString,o as bytesToUint,xe as checkVersion,ke as checkWxVersion,ct as clearCache,Te as dec2hex,We as firstUpperCase,_e as formatQuery,Ne as generateRandomStrs,ot as getCache,at as getCacheSpace,rt as getGlobal,ze as getImageUrl,Ke as getLanguage,Fe as getWxSDKVersion,Ve as hex2ab,Pe as hex2string,y as hexToBytes,d as intToBytes,Re as isAndroid,Ge as isHarmonyOS,He as isIOS,$e as keyToHump,i as numToBits,f as randomBytes,it as setCache,qe as sleep,l as stringToBytes,p as uintToBytes,h as uintToBytesBy128,nt as xxtea};

@@ -1,1 +0,1 @@

"use strict";function e(e,t,n,o){return new(n||(n=Promise))((function(r,a){function s(e){try{c(o.next(e))}catch(e){a(e)}}function i(e){try{c(o.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,i)}c((o=o.apply(e,t||[])).next())}))}function t(e){const t=new DataView(e.buffer);switch(e.length){case 0:throw new Error("data of Uint8Array is empty");case 1:return t.getUint8(0);case 2:return t.getUint16(0);case 3:return e.reduce(((e,t)=>e<<8|t),0);case 4:return t.getUint32(0);default:return parseInt(o(e),16)}}function n(e){return e.toString(2).split("").map((e=>Number(e))).reverse()}function o(e){return e.length?e.length<=4?t(e).toString(16).padStart(2*e.length,"0").toUpperCase():e.reduce(((e,t)=>(e.push(t.toString(16).padStart(2,"0")),e)),[]).join("").toUpperCase():""}Object.defineProperty(exports,"__esModule",{value:!0});const r=e=>{if(e.length%2!=0)throw new Error("hex length error");const t=e.length/2,n=new Uint8Array(t);for(let o=0;o<t;o++)n[o]=parseInt(e.slice(2*o,2*o+2),16);return n},a="undefined"!=typeof wx,s="undefined"!=typeof my,i="undefined"!=typeof window&&"undefined"!=typeof document,c="undefined"!=typeof wx?wx:"undefined"!=typeof my?my:"undefined"!=typeof ty?ty:{canIUse:e=>!1,getSystemInfoSync:()=>({})};function u(e,t){return c[e]||t&&c[t]||(()=>{console.warn(`The Api ${e} is not found`)})}function l(e,t,n){"function"==typeof t&&(n=t,t="");const o=c[e]||t&&c[t];return o?e=>new Promise(((t,r)=>{const{success:a,fail:s}=e||{};o(Object.assign(Object.assign({},e),{success:e=>{n&&(e=n(e)),a&&a(e),t(e)},fail:e=>{s&&s(e),"undefined"!=typeof my&&e.error&&(e.errCode=e.error,e.errMsg=e.errorMessage),r(e)}}))})):()=>(console.warn(`The Api ${e} is not found`),Promise.resolve())}const p=u("getFileSystemManager"),f=l("downloadFile"),h=l("getFileInfo"),g=u("getSystemInfoSync"),d=u("getAccountInfoSync"),y=u("getAppAuthorizeSetting"),v=l("authorizeForMiniProgram"),C=l("authorize"),B=l("getBLEDeviceServices",(e=>s?{services:e.services.map((e=>({uuid:e.serviceId.toUpperCase(),isPrimary:e.isPrimary})))}:e)),S=l("getBLEDeviceCharacteristics",(e=>s?{characteristics:e.characteristics.map((e=>Object.assign(Object.assign({},e),{uuid:e.characteristicId.toUpperCase()})))}:e)),b=l("createBLEConnection","connectBLEDevice"),x=l("closeBLEConnection","disconnectBLEDevice"),m=l("startBluetoothDevicesDiscovery"),w=l("stopBluetoothDevicesDiscovery"),A=l("getBLEDeviceRSSI"),D=l("getConnectedBluetoothDevices"),I=u("onBLEConnectionStateChange","onBLEConnectionStateChanged"),E=u("offBLEConnectionStateChange","offBLEConnectionStateChanged"),L=u("onBluetoothAdapterStateChange"),T=u("offBluetoothAdapterStateChange"),U=l("notifyBLECharacteristicValueChange"),j=l("readBLECharacteristicValue"),O=l("getBLEMTU"),M=l("setBLEMTU"),V=l("getBluetoothAdapterState"),_=new Map,P=l("getBluetoothDevices",(e=>s?{devices:e.devices.map((e=>Object.assign(Object.assign({},e),{connectable:void 0===e.connectable||e.connectable,advertisData:r(e.advertisData),serviceData:Object.keys(e.serviceData||{}).reduce(((t,n)=>(t[n]=r(e.serviceData[n]),t)),{})})))}:e)),k=l("writeBLECharacteristicValue"),F=l("createBLEPeripheralServer"),W=l("openBluetoothAdapter"),z=l("closeBluetoothAdapter"),H=u("connectSocket"),R=l("login"),$=l("getUserInfo"),G=u("createUDPSocket"),K=u("createTCPSocket"),q=l("scanCode"),N=l("getSetting"),Q=l("getLocalIPAddress"),J=l("startWifi"),X=l("stopWifi"),Y=l("getConnectedWifi"),Z=l("request"),ee=u("onAppHide"),te=u("offAppHide"),ne=u("onAppShow"),oe=u("offAppShow"),re=l("navigateToMiniProgram"),ae=l("navigateTo"),se=l("redirectTo"),ie=l("navigateBack"),ce=l("reLaunch"),ue=u("setStorageSync"),le=u("getStorageSync"),pe=u("removeStorageSync"),fe=u("showToast"),he=u("getAppBaseInfo"),ge=u("getDeviceInfo"),de=c.env||{},ye=u("onError");var ve=Object.freeze({__proto__:null,isWechat:a,isAlipay:s,isWeb:i,hasBaseApi:e=>c.canIUse?c.canIUse(e):!!c[e],getFileSystemManager:p,downloadFile:f,getFileInfo:h,getSystemInfoSync:g,getAccountInfoSync:d,getAppAuthorizeSetting:y,authorizeForMiniProgram:v,authorize:C,getBLEDeviceServices:B,getBLEDeviceCharacteristics:S,createBLEConnection:b,closeBLEConnection:x,startBluetoothDevicesDiscovery:m,stopBluetoothDevicesDiscovery:w,getBLEDeviceRSSI:A,getConnectedBluetoothDevices:D,onBLEConnectionStateChange:I,offBLEConnectionStateChange:E,onBluetoothAdapterStateChange:L,offBluetoothAdapterStateChange:T,notifyBLECharacteristicValueChange:U,readBLECharacteristicValue:j,getBLEMTU:O,setBLEMTU:M,getBluetoothAdapterState:V,onBluetoothDeviceFound:e=>{if(s){const t=({devices:t})=>{const n=t.map((e=>Object.assign(Object.assign({},e),{connectable:void 0===e.connectable||e.connectable,advertisData:r(e.advertisData),serviceData:Object.keys(e.serviceData||{}).reduce(((t,n)=>(t[n]=r(e.serviceData[n]),t)),{})})));e({devices:n})};return _.set(e,t),void c.onBluetoothDeviceFound(t)}c.onBluetoothDeviceFound(e)},offBluetoothDeviceFound:e=>{s&&_.has(e)?c.offBluetoothDeviceFound(_.get(e)):c.offBluetoothDeviceFound(e)},getBluetoothDevices:P,onBLECharacteristicValueChange:e=>{if(s){const t=t=>{e(Object.assign(Object.assign({},t),{value:r(t.value)}))};return _.set(e,t),void c.onBLECharacteristicValueChange(t)}c.onBLECharacteristicValueChange(e)},offBLECharacteristicValueChange:e=>{s&&_.has(e)?c.offBLECharacteristicValueChange(_.get(e)):c.offBLECharacteristicValueChange(e)},writeBLECharacteristicValue:k,createBLEPeripheralServer:F,openBluetoothAdapter:W,closeBluetoothAdapter:z,connectSocket:H,login:R,getUserInfo:$,createUDPSocket:G,createTCPSocket:K,scanCode:q,getSetting:N,getLocalIPAddress:Q,startWifi:J,stopWifi:X,getConnectedWifi:Y,request:Z,onAppHide:ee,offAppHide:te,onAppShow:ne,offAppShow:oe,navigateToMiniProgram:re,navigateTo:ae,redirectTo:se,navigateBack:ie,reLaunch:ce,setStorageSync:ue,getStorageSync:le,removeStorageSync:pe,showToast:fe,getAppBaseInfo:he,getDeviceInfo:ge,env:de,onError:ye});const Ce=ge()||{},Be=he()||{};function Se(e,t=2){let n=e;return"string"==typeof e&&(n=parseInt(e)),n.toString(16).padStart(t,"0")}const be=(e,t,n=!0)=>{const o=e.split("."),r=t.split("."),a=Math.max(r.length,o.length);for(;r.length<a;)r.splice(0,0,"0");for(;o.length<a;)o.splice(0,0,"0");for(let e=0;e<a;e++){const t=parseInt(o[e]),n=parseInt(r[e]);if(t>n)return!0;if(t===n)break;return!1}return n},xe=e=>e.replace(/^\S/,(function(e){return e.toUpperCase()}));const me="ios"===Ce.platform,we="android"===Ce.platform,Ae="ohos"===Ce.platform,De=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=1&t?t>>>1^3988292384:t>>>1;De[e]=t}const Ie={initial_value:0,table:function(e){const t=[];for(let n=0;n<256;++n){let o=n;for(let t=0;t<8;++t)o=0!=(128&o)?255&(o<<1^e):o<<1&255;t[n]=o}return t}(7)},Ee=e=>{const t=new DataView(e.buffer),n=[];for(let o=0;o<e.length;o+=4)n.push(t.getInt32(o));return n},Le=e=>{const t=new Uint8Array(4*e.length),n=new DataView(t.buffer);for(let t=0;t<e.length;t++)n.setInt32(4*t,e[t]);return t};const Te={encrypt:function(e,t){const n=Ee(e),o=Ee(t),r=n.length-1;let a,s,i=n[r],c=n[0],u=Math.floor(6+52/(r+1)),l=0;for(;u-- >0;){l=l+2654435769&4294967295,s=l>>>2&3;let e=0;for(;e<r;e++)c=n[e+1],a=(i>>>5^c<<2)+(c>>>3^i<<4)^(l^c)+(o[3&e^s]^i),i=n[e]=n[e]+a&4294967295;c=n[0],a=(i>>>5^c<<2)+(c>>>3^i<<4)^(l^c)+(o[3&e^s]^i),i=n[r]=n[r]+a&4294967295}return Le(n)},decrypt:function(e,t){const n=Ee(e),o=Ee(t),r=n.length-1;let a=n[r-1],s=n[0];const i=2654435769;let c,u,l=Math.floor(6+52/(r+1))*i&4294967295;for(;0!==l;){u=l>>>2&3;let e=r;for(;e>0;e--)a=n[e-1],c=(a>>>5^s<<2)+(s>>>3^a<<4)^(l^s)+(o[3&e^u]^a),s=n[e]=n[e]-c&4294967295;a=n[r],c=(a>>>5^s<<2)+(s>>>3^a<<4)^(l^s)+(o[3&e^u]^a),s=n[0]=n[0]-c&4294967295,l=l-i&4294967295}return Le(n)}},Ue=()=>{if("undefined"!=typeof globalThis)try{return globalThis.__tyGlobal||(globalThis.__tyGlobal={}),globalThis.__tyGlobal}catch(e){}return void 0===Object.prototype.__globalData&&Object.defineProperty(Object.prototype,"__globalData",{value:{},configurable:!1,enumerable:!1}),Object.prototype.__globalData};exports.BaseApi=ve,exports.CRC16=function(e){let t,n,o=65535;for(t=0;t<e.length;t++)for(o^=255&e[t],n=0;n<8;n++)0!=(1&o)?(o>>=1,o^=40961):o>>=1;return o},exports.CRC32=function(e){let t=-1;for(let n=0,o=e.length;n<o;n++)t=t>>>8^De[255&(t^e[n])];return-1^t},exports.CRC8=e=>{let t=Ie.initial_value;for(let n=0;n<e.length;n++)t=Ie.table[255&(t^e[n])];return t},exports.ab2hex=function(e){const t=[];return Array.prototype.map.call(new Uint8Array(e),(function(e){t.push(Se(e))})),t},exports.bitToBoolean=function(e,t){return(e&Math.pow(2,t))>>t==1},exports.bitsToUint=function(e){return e.reduce(((e,t,n)=>t<<n|e),0)},exports.bytesToBits=function(e){return e.reduceRight(((e,t)=>{const o=n(t);return e.concat(o)}),[])},exports.bytesToCharts=function(e){return e.length%2!=0?"":e.reduce(((e,t)=>(e.push(String.fromCharCode(t)),e)),[]).join("")},exports.bytesToHex=o,exports.bytesToInt=function(e){if(e.length>6)throw new Error("The number of bytes exceeds 6");const n=new DataView(e.buffer);switch(e.length){case 1:return n.getInt8(0);case 2:return n.getInt16(0);case 4:return n.getInt32(0);default:{let n=t(e);const o=Math.pow(2,8*e.length)/2;return n>=o&&(n%=o,n=-1*(o-n)),n}}},exports.bytesToIntBy128=(e,t=0)=>{let n=0,o=t;for(;o<4&&o<e.length;o++){const r=e[o];if(n|=(127&r)<<7*(o-t),0==(r>>7&1))break}return{num:n,end:o-t<4?o+1:o}},exports.bytesToString=function(e){const t=[];let n=0;for(;n<e.length;){const o=e[n];o<128?(t.push(String.fromCharCode(o)),n++):o>191&&o<224?(t.push(String.fromCharCode((31&o)<<6|63&e[n+1])),n+=2):(t.push(String.fromCharCode((15&o)<<12|(63&e[n+1])<<6|63&e[n+2])),n+=3)}return t.join("")},exports.bytesToUint=t,exports.checkVersion=be,exports.checkWxVersion=e=>be(Be.SDKVersion,e),exports.clearCache=function(e){const t=Ue();t[e]&&(t[e]={})},exports.dec2hex=Se,exports.firstUpperCase=xe,exports.formatQuery=(e,t=!1)=>{if(!e)return"";return Object.keys(e).reduce(((n,o)=>{const r=e[o];return void 0!==r&&n.push(`${o}=${t?encodeURIComponent(r):r}`),n}),[]).join("&")},exports.getCache=function(e,t){const n=Ue();return n[e]?n[e][t]:null},exports.getCacheSpace=function(e){const t=Ue();return t[e]?t[e]:null},exports.getGlobal=Ue,exports.getImageUrl=e=>{if(0!==e.indexOf("http")){return`https://images.tuyacn.com${/^\/[\w\W]+/.test(e)?"":"/"}${e}`}return e},exports.getLanguage=()=>Be.language||"zh",exports.getWxSDKVersion=()=>Be.SDKVersion,exports.hex2ab=function(e){const t=[];if("string"==typeof e)for(let n=0;n<e.length;n+=2)t.push(parseInt(e.slice(n,n+2),16));else if("string"==typeof e[0])for(let n=0;n<e.length;n++)t.push(parseInt(e[n],16));return new Uint8Array(t)},exports.hex2string=function(e){const t=[];if("string"==typeof e)for(let n=0;n<e.length;n+=2){const o=parseInt(e.slice(n,n+2),16);t.push(String.fromCharCode(o))}else for(let n=0;n<e.length;n++){const o=parseInt(e[n],16);t.push(String.fromCharCode(o))}return t.join("")},exports.hexToBytes=r,exports.intToBytes=(e,t)=>{const n=new Int32Array([e]),o=new Int8Array(n.buffer);return o.reverse(),t?new Uint8Array(o.slice(4-t)):new Uint8Array(o)},exports.isAndroid=we,exports.isHarmonyOS=Ae,exports.isIOS=me,exports.keyToHump=function e(t){return"object"!=typeof t?t:Array.isArray(t)?t.map((t=>e(t))):Object.keys(t).reduce(((n,o)=>{const r=o.split("_").map(((e,t)=>t>0?xe(e):e)).join("");let a=t[o];return Array.isArray(a)?a=a.map((t=>e(t))):"object"==typeof a&&(a=e(a)),n[r]=a,n}),{})},exports.numToBits=n,exports.randomBytes=e=>{const t=new Uint8Array(e);for(let n=0;n<e;n++)t[n]=Math.floor(256*Math.random());return t},exports.setCache=function(e,t,n){const o=Ue();o[e]||(o[e]={}),o[e][t]=n},exports.sleep=(t,n)=>e(void 0,void 0,void 0,(function*(){return new Promise((e=>{if(n){const o=t/10;let r=0;const a=setInterval((()=>{r+=o,r>=t&&(clearInterval(a),e(!0)),n()&&(clearInterval(a),e(!0))}),o)}setTimeout((()=>{e(!0)}),t)}))})),exports.stringToBytes=function(e){const t=[],n=e.length;for(let o=0;o<n;o++){const n=e.charCodeAt(o);n>=65536&&n<=1114111?(t.push(n>>18&7|240),t.push(n>>12&63|128),t.push(n>>6&63|128),t.push(63&n|128)):n>=2048&&n<=65535?(t.push(n>>12&15|224),t.push(n>>6&63|128),t.push(63&n|128)):n>=128&&n<=2047?(t.push(n>>6&31|192),t.push(63&n|128)):t.push(255&n)}return new Uint8Array(t)},exports.uintToBytes=(e,t)=>{const n=new Uint32Array([e]),o=new Uint8Array(n.buffer);return o.reverse(),t?o.slice(4-t):o},exports.uintToBytesBy128=e=>{const t=[];do{let n=e%128;(e=parseInt(""+e/128))>0&&(n|=128),t.push(n)}while(e>0);return new Uint8Array(t)},exports.xxtea=Te;
"use strict";function e(e,t,n,r){return new(n||(n=Promise))((function(o,a){function s(e){try{c(r.next(e))}catch(e){a(e)}}function i(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,i)}c((r=r.apply(e,t||[])).next())}))}function t(e){const t=new DataView(e.buffer);switch(e.length){case 0:throw new Error("data of Uint8Array is empty");case 1:return t.getUint8(0);case 2:return t.getUint16(0);case 3:return e.reduce(((e,t)=>e<<8|t),0);case 4:return t.getUint32(0);default:return parseInt(r(e),16)}}function n(e){return e.toString(2).split("").map((e=>Number(e))).reverse()}function r(e){return e.length?e.length<=4?t(e).toString(16).padStart(2*e.length,"0").toUpperCase():e.reduce(((e,t)=>(e.push(t.toString(16).padStart(2,"0")),e)),[]).join("").toUpperCase():""}Object.defineProperty(exports,"__esModule",{value:!0});const o=e=>{if(e.length%2!=0)throw new Error("hex length error");const t=e.length/2,n=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=parseInt(e.slice(2*r,2*r+2),16);return n},a="undefined"!=typeof wx,s="undefined"!=typeof my,i="undefined"!=typeof window&&"undefined"!=typeof document,c="undefined"!=typeof wx?wx:"undefined"!=typeof my?my:"undefined"!=typeof ty?ty:{canIUse:e=>!1,getSystemInfoSync:()=>({})};function u(e,t){return c[e]||t&&c[t]||(()=>{console.warn(`The Api ${e} is not found`)})}function l(e,t,n){"function"==typeof t&&(n=t,t="");const r=c[e]||t&&c[t];return r?e=>new Promise(((t,o)=>{const{success:a,fail:s}=e||{};r(Object.assign(Object.assign({},e),{success:e=>{n&&(e=n(e)),a&&a(e),t(e)},fail:e=>{s&&s(e),"undefined"!=typeof my&&e.error&&(e.errCode=e.error,e.errMsg=e.errorMessage),o(e)}}))})):()=>(console.warn(`The Api ${e} is not found`),Promise.resolve())}const p=u("getFileSystemManager"),f=l("downloadFile"),h=l("getFileInfo"),g=u("getSystemInfoSync"),d=u("getAccountInfoSync"),y=u("getAppAuthorizeSetting"),v=l("authorizeForMiniProgram"),C=l("authorize"),S=l("getBLEDeviceServices",(e=>s?{services:e.services.map((e=>({uuid:e.serviceId.toUpperCase(),isPrimary:e.isPrimary})))}:e)),B=l("getBLEDeviceCharacteristics",(e=>s?{characteristics:e.characteristics.map((e=>Object.assign(Object.assign({},e),{uuid:e.characteristicId.toUpperCase()})))}:e)),b=l("createBLEConnection","connectBLEDevice"),x=l("closeBLEConnection","disconnectBLEDevice"),m=l("startBluetoothDevicesDiscovery"),w=l("stopBluetoothDevicesDiscovery"),A=l("getBLEDeviceRSSI"),D=l("getConnectedBluetoothDevices"),I=u("onBLEConnectionStateChange","onBLEConnectionStateChanged"),E=u("offBLEConnectionStateChange","offBLEConnectionStateChanged"),L=u("onBluetoothAdapterStateChange"),T=u("offBluetoothAdapterStateChange"),U=l("notifyBLECharacteristicValueChange"),j=l("readBLECharacteristicValue"),M=l("getBLEMTU"),O=l("setBLEMTU"),V=l("getBluetoothAdapterState"),P=new Map,_=l("getBluetoothDevices",(e=>s?{devices:e.devices.map((e=>Object.assign(Object.assign({},e),{connectable:void 0===e.connectable||e.connectable,advertisData:o(e.advertisData),serviceData:Object.keys(e.serviceData||{}).reduce(((t,n)=>(t[n]=o(e.serviceData[n]),t)),{})})))}:e)),k=l("writeBLECharacteristicValue"),F=l("createBLEPeripheralServer"),W=l("openBluetoothAdapter"),z=l("closeBluetoothAdapter"),R=u("connectSocket"),H=l("login"),$=l("getUserInfo"),G=u("createUDPSocket"),K=u("createTCPSocket"),q=l("scanCode"),N=l("getSetting"),Q=l("getLocalIPAddress"),J=l("startWifi"),X=l("stopWifi"),Y=l("getConnectedWifi"),Z=l("request"),ee=u("onAppHide"),te=u("offAppHide"),ne=u("onAppShow"),re=u("offAppShow"),oe=l("navigateToMiniProgram"),ae=l("navigateTo"),se=l("redirectTo"),ie=l("navigateBack"),ce=l("reLaunch"),ue=u("setStorageSync"),le=u("getStorageSync"),pe=u("removeStorageSync"),fe=u("showToast"),he=u("getAppBaseInfo"),ge=u("getDeviceInfo"),de=c.env||{},ye=u("onError");var ve=Object.freeze({__proto__:null,isWechat:a,isAlipay:s,isWeb:i,hasBaseApi:e=>c.canIUse?c.canIUse(e):!!c[e],getFileSystemManager:p,downloadFile:f,getFileInfo:h,getSystemInfoSync:g,getAccountInfoSync:d,getAppAuthorizeSetting:y,authorizeForMiniProgram:v,authorize:C,getBLEDeviceServices:S,getBLEDeviceCharacteristics:B,createBLEConnection:b,closeBLEConnection:x,startBluetoothDevicesDiscovery:m,stopBluetoothDevicesDiscovery:w,getBLEDeviceRSSI:A,getConnectedBluetoothDevices:D,onBLEConnectionStateChange:I,offBLEConnectionStateChange:E,onBluetoothAdapterStateChange:L,offBluetoothAdapterStateChange:T,notifyBLECharacteristicValueChange:U,readBLECharacteristicValue:j,getBLEMTU:M,setBLEMTU:O,getBluetoothAdapterState:V,onBluetoothDeviceFound:e=>{if(s){const t=({devices:t})=>{const n=t.map((e=>Object.assign(Object.assign({},e),{connectable:void 0===e.connectable||e.connectable,advertisData:o(e.advertisData),serviceData:Object.keys(e.serviceData||{}).reduce(((t,n)=>(t[n]=o(e.serviceData[n]),t)),{})})));e({devices:n})};return P.set(e,t),void c.onBluetoothDeviceFound(t)}c.onBluetoothDeviceFound(e)},offBluetoothDeviceFound:e=>{s&&P.has(e)?c.offBluetoothDeviceFound(P.get(e)):c.offBluetoothDeviceFound(e)},getBluetoothDevices:_,onBLECharacteristicValueChange:e=>{if(s){const t=t=>{e(Object.assign(Object.assign({},t),{value:o(t.value)}))};return P.set(e,t),void c.onBLECharacteristicValueChange(t)}c.onBLECharacteristicValueChange(e)},offBLECharacteristicValueChange:e=>{s&&P.has(e)?c.offBLECharacteristicValueChange(P.get(e)):c.offBLECharacteristicValueChange(e)},writeBLECharacteristicValue:k,createBLEPeripheralServer:F,openBluetoothAdapter:W,closeBluetoothAdapter:z,connectSocket:R,login:H,getUserInfo:$,createUDPSocket:G,createTCPSocket:K,scanCode:q,getSetting:N,getLocalIPAddress:Q,startWifi:J,stopWifi:X,getConnectedWifi:Y,request:Z,onAppHide:ee,offAppHide:te,onAppShow:ne,offAppShow:re,navigateToMiniProgram:oe,navigateTo:ae,redirectTo:se,navigateBack:ie,reLaunch:ce,setStorageSync:ue,getStorageSync:le,removeStorageSync:pe,showToast:fe,getAppBaseInfo:he,getDeviceInfo:ge,env:de,onError:ye});const Ce=ge()||{},Se=he()||{};function Be(e,t=2){let n=e;return"string"==typeof e&&(n=parseInt(e)),n.toString(16).padStart(t,"0")}const be=(e,t,n=!0)=>{const r=e.split("."),o=t.split("."),a=Math.max(o.length,r.length);for(;o.length<a;)o.splice(0,0,"0");for(;r.length<a;)r.splice(0,0,"0");for(let e=0;e<a;e++){const t=parseInt(r[e]),n=parseInt(o[e]);if(t>n)return!0;if(t===n)break;return!1}return n},xe=e=>e.replace(/^\S/,(function(e){return e.toUpperCase()}));const me="ios"===Ce.platform,we="android"===Ce.platform,Ae="ohos"===Ce.platform,De=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=1&t?t>>>1^3988292384:t>>>1;De[e]=t}const Ie={initial_value:0,table:function(e){const t=[];for(let n=0;n<256;++n){let r=n;for(let t=0;t<8;++t)r=0!=(128&r)?255&(r<<1^e):r<<1&255;t[n]=r}return t}(7)},Ee=e=>{const t=new DataView(e.buffer),n=[];for(let r=0;r<e.length;r+=4)n.push(t.getInt32(r));return n},Le=e=>{const t=new Uint8Array(4*e.length),n=new DataView(t.buffer);for(let t=0;t<e.length;t++)n.setInt32(4*t,e[t]);return t};const Te={encrypt:function(e,t){const n=Ee(e),r=Ee(t),o=n.length-1;let a,s,i=n[o],c=n[0],u=Math.floor(6+52/(o+1)),l=0;for(;u-- >0;){l=l+2654435769&4294967295,s=l>>>2&3;let e=0;for(;e<o;e++)c=n[e+1],a=(i>>>5^c<<2)+(c>>>3^i<<4)^(l^c)+(r[3&e^s]^i),i=n[e]=n[e]+a&4294967295;c=n[0],a=(i>>>5^c<<2)+(c>>>3^i<<4)^(l^c)+(r[3&e^s]^i),i=n[o]=n[o]+a&4294967295}return Le(n)},decrypt:function(e,t){const n=Ee(e),r=Ee(t),o=n.length-1;let a=n[o-1],s=n[0];const i=2654435769;let c,u,l=Math.floor(6+52/(o+1))*i&4294967295;for(;0!==l;){u=l>>>2&3;let e=o;for(;e>0;e--)a=n[e-1],c=(a>>>5^s<<2)+(s>>>3^a<<4)^(l^s)+(r[3&e^u]^a),s=n[e]=n[e]-c&4294967295;a=n[o],c=(a>>>5^s<<2)+(s>>>3^a<<4)^(l^s)+(r[3&e^u]^a),s=n[0]=n[0]-c&4294967295,l=l-i&4294967295}return Le(n)}},Ue=()=>{if("undefined"!=typeof globalThis)try{return globalThis.__tyGlobal||(globalThis.__tyGlobal={}),globalThis.__tyGlobal}catch(e){}return void 0===Object.prototype.__globalData&&Object.defineProperty(Object.prototype,"__globalData",{value:{},configurable:!1,enumerable:!1}),Object.prototype.__globalData};exports.BaseApi=ve,exports.CRC16=function(e){let t,n,r=65535;for(t=0;t<e.length;t++)for(r^=255&e[t],n=0;n<8;n++)0!=(1&r)?(r>>=1,r^=40961):r>>=1;return r},exports.CRC32=function(e){let t=-1;for(let n=0,r=e.length;n<r;n++)t=t>>>8^De[255&(t^e[n])];return-1^t},exports.CRC8=e=>{let t=Ie.initial_value;for(let n=0;n<e.length;n++)t=Ie.table[255&(t^e[n])];return t},exports.ab2hex=function(e){const t=[];return Array.prototype.map.call(new Uint8Array(e),(function(e){t.push(Be(e))})),t},exports.bitToBoolean=function(e,t){return(e&Math.pow(2,t))>>t==1},exports.bitsToUint=function(e){return e.reduce(((e,t,n)=>t<<n|e),0)},exports.bytesToBits=function(e){return e.reduceRight(((e,t)=>{const r=n(t);return e.concat(r)}),[])},exports.bytesToCharts=function(e){return e.length%2!=0?"":e.reduce(((e,t)=>(e.push(String.fromCharCode(t)),e)),[]).join("")},exports.bytesToHex=r,exports.bytesToInt=function(e){if(e.length>6)throw new Error("The number of bytes exceeds 6");const n=new DataView(e.buffer);switch(e.length){case 1:return n.getInt8(0);case 2:return n.getInt16(0);case 4:return n.getInt32(0);default:{let n=t(e);const r=Math.pow(2,8*e.length)/2;return n>=r&&(n%=r,n=-1*(r-n)),n}}},exports.bytesToIntBy128=(e,t=0)=>{let n=0,r=t;for(;r<4&&r<e.length;r++){const o=e[r];if(n|=(127&o)<<7*(r-t),0==(o>>7&1))break}return{num:n,end:r-t<4?r+1:r}},exports.bytesToString=function(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];r<128?(t.push(String.fromCharCode(r)),n++):r>191&&r<224?(t.push(String.fromCharCode((31&r)<<6|63&e[n+1])),n+=2):(t.push(String.fromCharCode((15&r)<<12|(63&e[n+1])<<6|63&e[n+2])),n+=3)}return t.join("")},exports.bytesToUint=t,exports.checkVersion=be,exports.checkWxVersion=e=>be(Se.SDKVersion,e),exports.clearCache=function(e){const t=Ue();t[e]&&(t[e]={})},exports.dec2hex=Be,exports.firstUpperCase=xe,exports.formatQuery=(e,t=!1)=>{if(!e)return"";return Object.keys(e).reduce(((n,r)=>{const o=e[r];return void 0!==o&&n.push(`${r}=${t?encodeURIComponent(o):o}`),n}),[]).join("&")},exports.generateRandomStrs=e=>{const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";let n="";for(let r=0;r<e;r++)n+=t.charAt(Math.floor(Math.random()*t.length));return n},exports.getCache=function(e,t){const n=Ue();return n[e]?n[e][t]:null},exports.getCacheSpace=function(e){const t=Ue();return t[e]?t[e]:null},exports.getGlobal=Ue,exports.getImageUrl=e=>{if(0!==e.indexOf("http")){return`https://images.tuyacn.com${/^\/[\w\W]+/.test(e)?"":"/"}${e}`}return e},exports.getLanguage=()=>Se.language||"zh",exports.getWxSDKVersion=()=>Se.SDKVersion,exports.hex2ab=function(e){const t=[];if("string"==typeof e)for(let n=0;n<e.length;n+=2)t.push(parseInt(e.slice(n,n+2),16));else if("string"==typeof e[0])for(let n=0;n<e.length;n++)t.push(parseInt(e[n],16));return new Uint8Array(t)},exports.hex2string=function(e){const t=[];if("string"==typeof e)for(let n=0;n<e.length;n+=2){const r=parseInt(e.slice(n,n+2),16);t.push(String.fromCharCode(r))}else for(let n=0;n<e.length;n++){const r=parseInt(e[n],16);t.push(String.fromCharCode(r))}return t.join("")},exports.hexToBytes=o,exports.intToBytes=(e,t)=>{const n=new Int32Array([e]),r=new Int8Array(n.buffer);return r.reverse(),t?new Uint8Array(r.slice(4-t)):new Uint8Array(r)},exports.isAndroid=we,exports.isHarmonyOS=Ae,exports.isIOS=me,exports.keyToHump=function e(t){return"object"!=typeof t?t:Array.isArray(t)?t.map((t=>e(t))):Object.keys(t).reduce(((n,r)=>{const o=r.split("_").map(((e,t)=>t>0?xe(e):e)).join("");let a=t[r];return Array.isArray(a)?a=a.map((t=>e(t))):"object"==typeof a&&(a=e(a)),n[o]=a,n}),{})},exports.numToBits=n,exports.randomBytes=e=>{const t=new Uint8Array(e);for(let n=0;n<e;n++)t[n]=Math.floor(256*Math.random());return t},exports.setCache=function(e,t,n){const r=Ue();r[e]||(r[e]={}),r[e][t]=n},exports.sleep=(t,n)=>e(void 0,void 0,void 0,(function*(){return new Promise((e=>{if(n){const r=t/10;let o=0;const a=setInterval((()=>{o+=r,o>=t&&(clearInterval(a),e(!0)),n()&&(clearInterval(a),e(!0))}),r)}setTimeout((()=>{e(!0)}),t)}))})),exports.stringToBytes=function(e){const t=[],n=e.length;for(let r=0;r<n;r++){const n=e.charCodeAt(r);n>=65536&&n<=1114111?(t.push(n>>18&7|240),t.push(n>>12&63|128),t.push(n>>6&63|128),t.push(63&n|128)):n>=2048&&n<=65535?(t.push(n>>12&15|224),t.push(n>>6&63|128),t.push(63&n|128)):n>=128&&n<=2047?(t.push(n>>6&31|192),t.push(63&n|128)):t.push(255&n)}return new Uint8Array(t)},exports.uintToBytes=(e,t)=>{const n=new Uint32Array([e]),r=new Uint8Array(n.buffer);return r.reverse(),t?r.slice(4-t):r},exports.uintToBytesBy128=e=>{const t=[];do{let n=e%128;(e=parseInt(""+e/128))>0&&(n|=128),t.push(n)}while(e>0);return new Uint8Array(t)},exports.xxtea=Te;

@@ -17,1 +17,2 @@ export declare function dec2hex(dec: number | string, length?: number): string;

export declare const getLanguage: () => string;
export declare const generateRandomStrs: (size: number) => string;
{
"name": "@ray-js/wechat-helper",
"version": "0.3.31-beta.2",
"version": "0.3.31-beta.3",
"publishConfig": {

@@ -5,0 +5,0 @@ "access": "public",