Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ray-js/wechat-helper

Package Overview
Dependencies
Maintainers
1
Versions
155
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.0.17-beta-6 to 0.0.18

2

index.esm.js

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

function e(e,t){return wx[e]?t?t=>new Promise(((n,r)=>{const{success:o,fail:a}=t||{};wx[e](Object.assign(Object.assign({},t),{success:e=>{o&&o(e),n(e)},fail:e=>{a&&a(e),r(e)}}))})):wx[e]:()=>{console.warn(`The Api ${e} is not found`)}}const t=e("getFileSystemManager"),n=e("downloadFile",!0),r=e("getFileInfo",!0),o=e("getSystemInfoSync"),a=e("getAccountInfoSync"),i=e("getAppAuthorizeSetting"),c=e("authorizeForMiniProgram",!0),s=e("authorize",!0),u=e("onBLEConnectionStateChange"),l=e("offBLEConnectionStateChange"),f=e("onBluetoothAdapterStateChange"),h=e("notifyBLECharacteristicValueChange",!0),g=e("readBLECharacteristicValue",!0),p=e("getBLEMTU",!0),d=e("setBLEMTU",!0),C=e("getBluetoothAdapterState",!0),w=e("onBluetoothDeviceFound"),A=e("offBluetoothDeviceFound"),S=e("getBluetoothDevices",!0),y=e("onBLECharacteristicValueChange"),B=e("offBLECharacteristicValueChange"),m=e("writeBLECharacteristicValue",!0),I=e("createBLEPeripheralServer",!0),U=e("openBluetoothAdapter",!0),E=e("closeBluetoothAdapter",!0),b=e("connectSocket"),L=e("login",!0),v=e("getUserInfo",!0),M=e("createUDPSocket"),T=e("scanCode",!0),F=e("getSetting",!0),V=e("getLocalIPAddress",!0),j=e("startWifi",!0),D=e("stopWifi",!0),P=e("getConnectedWifi",!0),k=e("request",!0),x=e("onAppHide"),z=e("offAppHide"),W=e("onAppShow"),_=e("offAppShow"),O=e("navigateToMiniProgram",!0),H=e("navigateTo",!0),$=e("redirectTo",!0),q=e("navigateBack",!0),R=e("reLaunch",!0);var K=Object.freeze({__proto__:null,hasBaseApi:e=>!!wx[e],getFileSystemManager:t,downloadFile:n,getFileInfo:r,getSystemInfoSync:o,getAccountInfoSync:a,getAppAuthorizeSetting:i,authorizeForMiniProgram:c,authorize:s,onBLEConnectionStateChange:u,offBLEConnectionStateChange:l,onBluetoothAdapterStateChange:f,notifyBLECharacteristicValueChange:h,readBLECharacteristicValue:g,getBLEMTU:p,setBLEMTU:d,getBluetoothAdapterState:C,onBluetoothDeviceFound:w,offBluetoothDeviceFound:A,getBluetoothDevices:S,onBLECharacteristicValueChange:y,offBLECharacteristicValueChange:B,writeBLECharacteristicValue:m,createBLEPeripheralServer:I,openBluetoothAdapter:U,closeBluetoothAdapter:E,connectSocket:b,login:L,getUserInfo:v,createUDPSocket:M,scanCode:T,getSetting:F,getLocalIPAddress:V,startWifi:j,stopWifi:D,getConnectedWifi:P,request:k,onAppHide:x,offAppHide:z,onAppShow:W,offAppShow:_,navigateToMiniProgram:O,navigateTo:H,redirectTo:$,navigateBack:q,reLaunch:R});function N(e,t=2){let n=e;return"string"==typeof e&&(n=parseInt(e)),n.toString(16).padStart(t,"0")}function G(e){const t=[];return Array.prototype.map.call(new Uint8Array(e),(function(e){t.push(N(e))})),t}function J(e){return parseInt(e,16)}function Q(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 X(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)}function Y(e){const t=255&e;let n=0;return t>=128?(n=t%128,n=-1*(128-n)):n=t,n}function Z(e){const t=Y(255&e);return[Y(e>>8&255),t]}function ee(e,t=!1){const n=e.length,r=new Uint8Array(t?4*n:n);let o=0;for(let a=0;a<n;a++){let i=e.charCodeAt(a);if(t&&55296<=i&&i<=56319){if(++a>=n)throw new Error("Malformed string, low surrogate expected at position "+a);i=(55296^i)<<10|65536|56320^e.charCodeAt(a)}else if(!t&&i>>>8)throw new Error("Wide characters are not allowed.");!t||i<=127?r[o++]=i:i<=2047?(r[o++]=192|i>>6,r[o++]=128|63&i):i<=65535?(r[o++]=224|i>>12,r[o++]=128|i>>6&63,r[o++]=128|63&i):(r[o++]=240|i>>18,r[o++]=128|i>>12&63,r[o++]=128|i>>6&63,r[o++]=128|63&i)}return r.subarray(0,o)}function te(e){return ee(e,!0)}function ne(e,t=!1){const n=e.length,r=new Array(n);let o=0;for(let a=0;a<n;a++){const i=e[a];if(!t||i<128)r[o++]=i;else if(i>=192&&i<224&&a+1<n)r[o++]=(31&i)<<6|63&e[++a];else if(i>=224&&i<240&&a+2<n)r[o++]=(15&i)<<12|(63&e[++a])<<6|63&e[++a];else{if(!(i>=240&&i<248&&a+3<n))throw new Error("Malformed UTF8 character at byte offset "+a);{let t=(7&i)<<18|(63&e[++a])<<12|(63&e[++a])<<6|63&e[++a];t<=65535?r[o++]=t:(t^=65536,r[o++]=55296|t>>10,r[o++]=56320|1023&t)}}}let a="";const i=16384;for(let e=0;e<o;e+=i)a+=String.fromCharCode(...r.slice(e,e+i<=o?e+i:o));return a}const re=(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("&")},oe=e=>{const t=o().SDKVersion;return ae(e,t)},ae=(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},ie=e=>e.replace(/^\S/,(function(e){return e.toUpperCase()}));function ce(e){return"object"!=typeof e?e:Array.isArray(e)?e.map((e=>ce(e))):Object.keys(e).reduce(((t,n)=>{const r=n.split("_").map(((e,t)=>t>0?ie(e):e)).join("");let o=e[n];return Array.isArray(o)?o=o.map((e=>ce(e))):"object"==typeof o&&(o=ce(o)),t[r]=o,t}),{})}const se=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;se[e]=t}function ue(e){let t=-1;for(let n=0,r=e.length;n<r;n++)t=t>>>8^se[255&(t^e[n])];return-1^t}function le(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 fe={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)?(r<<1^e)%256:(r<<1)%256;t[n]=r}return t}(7)},he=e=>{let t=fe.initial_value;for(let n=0;n<e.length;n++)t=fe.table[(t^e[n])%256];return t};function ge(e,t){return!!((e&Math.pow(2,t))>>t)}function pe(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=de(e);const n=Math.pow(2,8*e.length)/2;return t>=n&&(t%=n,t=-1*(n-t)),t}}}function de(e){const t=new DataView(e.buffer);switch(e.length){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(we(e),16)}}function Ce(e){return e.reduceRight(((e,t)=>{const n=t.toString(2).padStart(8,"0").split("").map((e=>Number(e))).reverse();return e.concat(n)}),[])}function we(e){return e.length<=4?de(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 Ae(e){return e.length%2!=0?(console.error("Illegal Format UTF16 Code!"),""):e.reduce(((e,t)=>(e.push(String.fromCharCode(t)),e)),[]).join("")}function Se(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 ye(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)}function Be(e){const t=[],n=e.length;for(let r=0;r<n;r++){const n=e[r].toString(2),o=n.match(/^1+?(?=0)/);if(o&&8==n.length){const a=o[0].length;let i=n.slice(7-a);for(let t=1;t<a;t++)i+=e[t+r].toString(2).slice(2);t.push(String.fromCharCode(parseInt(i,2))),r+=a-1}else t.push(String.fromCharCode(e[r]))}return t.join("")}const me=e=>{const t=new Uint8Array(e);for(let n=0;n<e;n++)t[n]=Math.floor(256*Math.random());return t},Ie=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)},Ue=(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}},Ee=(e,t)=>{const n=new Uint32Array([e]),r=new Uint8Array(n.buffer);return r.reverse(),t?r.slice(4-t):r},be=(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)},Le=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},ve=e=>{const t=new DataView(e.buffer),n=[];for(let r=0;r<e.length;r+=4)n.push(t.getInt32(r));return n},Me=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=ve(e),r=ve(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 Me(n)},decrypt:function(e,t){const n=ve(e),r=ve(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 Me(n)}},Fe={},Ve=()=>"undefined"!=typeof globalThis?globalThis:Fe;function je(e,t){const n=Ve();return n[e]?n[e][t]:null}function De(e){const t=Ve();return t[e]?t[e]:null}function Pe(e,t,n){const r=Ve();r[e]||(r[e]={}),r[e][t]=n}function ke(e){const t=Ve();t[e]&&(t[e]={})}export{K as BaseApi,le as CRC16,ue as CRC32,he as CRC8,G as ab2hex,ge as bitToBoolean,ne as bytes2string,Ce as bytesToBits,Ae as bytesToCharts,we as bytesToHex,pe as bytesToInt,Ue as bytesToIntBy128,Be as bytesToString,de as bytesToUint,Se as bytesToUtf8,ae as checkVersion,oe as checkWxVersion,ke as clearCache,N as dec2hex,ie as firstUpperCase,re as formatQuery,je as getCache,De as getCacheSpace,X as hex2ab,J as hex2dec,Q as hex2string,Le as hexToBytes,Z as int2TwoBytes,Y as intToByte,be as intToBytes,ce as keyToHump,me as randomBytes,Pe as setCache,ee as string2bytes,ye as stringToBytes,Ee as uintToBytes,Ie as uintToBytesBy128,te as utf8ToBytes,Te as xxtea};
function e(e,t){return wx[e]?t?t=>new Promise(((n,r)=>{const{success:o,fail:a}=t||{};wx[e](Object.assign(Object.assign({},t),{success:e=>{o&&o(e),n(e)},fail:e=>{a&&a(e),r(e)}}))})):wx[e]:()=>{console.warn(`The Api ${e} is not found`)}}const t=e("getFileSystemManager"),n=e("downloadFile",!0),r=e("getFileInfo",!0),o=e("getSystemInfoSync"),a=e("getAccountInfoSync"),i=e("getAppAuthorizeSetting"),c=e("authorizeForMiniProgram",!0),s=e("authorize",!0),u=e("onBLEConnectionStateChange"),l=e("offBLEConnectionStateChange"),f=e("onBluetoothAdapterStateChange"),h=e("notifyBLECharacteristicValueChange",!0),g=e("readBLECharacteristicValue",!0),p=e("getBLEMTU",!0),d=e("setBLEMTU",!0),S=e("getBluetoothAdapterState",!0),C=e("onBluetoothDeviceFound"),w=e("offBluetoothDeviceFound"),y=e("getBluetoothDevices",!0),A=e("onBLECharacteristicValueChange"),B=e("offBLECharacteristicValueChange"),m=e("writeBLECharacteristicValue",!0),I=e("createBLEPeripheralServer",!0),U=e("openBluetoothAdapter",!0),E=e("closeBluetoothAdapter",!0),b=e("connectSocket"),L=e("login",!0),v=e("getUserInfo",!0),M=e("createUDPSocket"),T=e("scanCode",!0),F=e("getSetting",!0),V=e("getLocalIPAddress",!0),j=e("startWifi",!0),D=e("stopWifi",!0),P=e("getConnectedWifi",!0),k=e("request",!0),x=e("setStorageSync"),z=e("getStorageSync"),W=e("removeStorageSync"),_=e("onAppHide"),O=e("offAppHide"),H=e("onAppShow"),$=e("offAppShow"),q=e("navigateToMiniProgram",!0),R=e("navigateTo",!0),K=e("redirectTo",!0),N=e("navigateBack",!0),G=e("reLaunch",!0);var J=Object.freeze({__proto__:null,hasBaseApi:e=>!!wx[e],getFileSystemManager:t,downloadFile:n,getFileInfo:r,getSystemInfoSync:o,getAccountInfoSync:a,getAppAuthorizeSetting:i,authorizeForMiniProgram:c,authorize:s,onBLEConnectionStateChange:u,offBLEConnectionStateChange:l,onBluetoothAdapterStateChange:f,notifyBLECharacteristicValueChange:h,readBLECharacteristicValue:g,getBLEMTU:p,setBLEMTU:d,getBluetoothAdapterState:S,onBluetoothDeviceFound:C,offBluetoothDeviceFound:w,getBluetoothDevices:y,onBLECharacteristicValueChange:A,offBLECharacteristicValueChange:B,writeBLECharacteristicValue:m,createBLEPeripheralServer:I,openBluetoothAdapter:U,closeBluetoothAdapter:E,connectSocket:b,login:L,getUserInfo:v,createUDPSocket:M,scanCode:T,getSetting:F,getLocalIPAddress:V,startWifi:j,stopWifi:D,getConnectedWifi:P,request:k,setStorageSync:x,getStorageSync:z,removeStorageSync:W,onAppHide:_,offAppHide:O,onAppShow:H,offAppShow:$,navigateToMiniProgram:q,navigateTo:R,redirectTo:K,navigateBack:N,reLaunch:G});function Q(e,t=2){let n=e;return"string"==typeof e&&(n=parseInt(e)),n.toString(16).padStart(t,"0")}function X(e){const t=[];return Array.prototype.map.call(new Uint8Array(e),(function(e){t.push(Q(e))})),t}function Y(e){return parseInt(e,16)}function Z(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 ee(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)}function te(e){const t=255&e;let n=0;return t>=128?(n=t%128,n=-1*(128-n)):n=t,n}function ne(e){const t=te(255&e);return[te(e>>8&255),t]}function re(e,t=!1){const n=e.length,r=new Uint8Array(t?4*n:n);let o=0;for(let a=0;a<n;a++){let i=e.charCodeAt(a);if(t&&55296<=i&&i<=56319){if(++a>=n)throw new Error("Malformed string, low surrogate expected at position "+a);i=(55296^i)<<10|65536|56320^e.charCodeAt(a)}else if(!t&&i>>>8)throw new Error("Wide characters are not allowed.");!t||i<=127?r[o++]=i:i<=2047?(r[o++]=192|i>>6,r[o++]=128|63&i):i<=65535?(r[o++]=224|i>>12,r[o++]=128|i>>6&63,r[o++]=128|63&i):(r[o++]=240|i>>18,r[o++]=128|i>>12&63,r[o++]=128|i>>6&63,r[o++]=128|63&i)}return r.subarray(0,o)}function oe(e){return re(e,!0)}function ae(e,t=!1){const n=e.length,r=new Array(n);let o=0;for(let a=0;a<n;a++){const i=e[a];if(!t||i<128)r[o++]=i;else if(i>=192&&i<224&&a+1<n)r[o++]=(31&i)<<6|63&e[++a];else if(i>=224&&i<240&&a+2<n)r[o++]=(15&i)<<12|(63&e[++a])<<6|63&e[++a];else{if(!(i>=240&&i<248&&a+3<n))throw new Error("Malformed UTF8 character at byte offset "+a);{let t=(7&i)<<18|(63&e[++a])<<12|(63&e[++a])<<6|63&e[++a];t<=65535?r[o++]=t:(t^=65536,r[o++]=55296|t>>10,r[o++]=56320|1023&t)}}}let a="";const i=16384;for(let e=0;e<o;e+=i)a+=String.fromCharCode(...r.slice(e,e+i<=o?e+i:o));return a}const ie=(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("&")},ce=e=>{const t=o().SDKVersion;return se(e,t)},se=(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},ue=e=>e.replace(/^\S/,(function(e){return e.toUpperCase()}));function le(e){return"object"!=typeof e?e:Array.isArray(e)?e.map((e=>le(e))):Object.keys(e).reduce(((t,n)=>{const r=n.split("_").map(((e,t)=>t>0?ue(e):e)).join("");let o=e[n];return Array.isArray(o)?o=o.map((e=>le(e))):"object"==typeof o&&(o=le(o)),t[r]=o,t}),{})}const fe=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;fe[e]=t}function he(e){let t=-1;for(let n=0,r=e.length;n<r;n++)t=t>>>8^fe[255&(t^e[n])];return-1^t}function ge(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 pe={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)?(r<<1^e)%256:(r<<1)%256;t[n]=r}return t}(7)},de=e=>{let t=pe.initial_value;for(let n=0;n<e.length;n++)t=pe.table[(t^e[n])%256];return t};function Se(e,t){return!!((e&Math.pow(2,t))>>t)}function Ce(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=we(e);const n=Math.pow(2,8*e.length)/2;return t>=n&&(t%=n,t=-1*(n-t)),t}}}function we(e){const t=new DataView(e.buffer);switch(e.length){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(Ae(e),16)}}function ye(e){return e.reduceRight(((e,t)=>{const n=t.toString(2).padStart(8,"0").split("").map((e=>Number(e))).reverse();return e.concat(n)}),[])}function Ae(e){return e.length<=4?we(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 Be(e){return e.length%2!=0?(console.error("Illegal Format UTF16 Code!"),""):e.reduce(((e,t)=>(e.push(String.fromCharCode(t)),e)),[]).join("")}function me(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 Ie(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)}function Ue(e){const t=[],n=e.length;for(let r=0;r<n;r++){const n=e[r].toString(2),o=n.match(/^1+?(?=0)/);if(o&&8==n.length){const a=o[0].length;let i=n.slice(7-a);for(let t=1;t<a;t++)i+=e[t+r].toString(2).slice(2);t.push(String.fromCharCode(parseInt(i,2))),r+=a-1}else t.push(String.fromCharCode(e[r]))}return t.join("")}const Ee=e=>{const t=new Uint8Array(e);for(let n=0;n<e;n++)t[n]=Math.floor(256*Math.random());return t},be=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)},Le=(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}},ve=(e,t)=>{const n=new Uint32Array([e]),r=new Uint8Array(n.buffer);return r.reverse(),t?r.slice(4-t):r},Me=(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)},Te=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},Fe=e=>{const t=new DataView(e.buffer),n=[];for(let r=0;r<e.length;r+=4)n.push(t.getInt32(r));return n},Ve=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 je={encrypt:function(e,t){const n=Fe(e),r=Fe(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 Ve(n)},decrypt:function(e,t){const n=Fe(e),r=Fe(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 Ve(n)}},De={},Pe=()=>"undefined"!=typeof globalThis?globalThis:De;function ke(e,t){const n=Pe();return n[e]?n[e][t]:null}function xe(e){const t=Pe();return t[e]?t[e]:null}function ze(e,t,n){const r=Pe();r[e]||(r[e]={}),r[e][t]=n}function We(e){const t=Pe();t[e]&&(t[e]={})}export{J as BaseApi,ge as CRC16,he as CRC32,de as CRC8,X as ab2hex,Se as bitToBoolean,ae as bytes2string,ye as bytesToBits,Be as bytesToCharts,Ae as bytesToHex,Ce as bytesToInt,Le as bytesToIntBy128,Ue as bytesToString,we as bytesToUint,me as bytesToUtf8,se as checkVersion,ce as checkWxVersion,We as clearCache,Q as dec2hex,ue as firstUpperCase,ie as formatQuery,ke as getCache,xe as getCacheSpace,ee as hex2ab,Y as hex2dec,Z as hex2string,Te as hexToBytes,ne as int2TwoBytes,te as intToByte,Me as intToBytes,le as keyToHump,Ee as randomBytes,ze as setCache,re as string2bytes,Ie as stringToBytes,ve as uintToBytes,be as uintToBytesBy128,oe as utf8ToBytes,je as xxtea};

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

"use strict";function e(e,t){return wx[e]?t?t=>new Promise(((r,n)=>{const{success:o,fail:s}=t||{};wx[e](Object.assign(Object.assign({},t),{success:e=>{o&&o(e),r(e)},fail:e=>{s&&s(e),n(e)}}))})):wx[e]:()=>{console.warn(`The Api ${e} is not found`)}}Object.defineProperty(exports,"__esModule",{value:!0});const t=e("getFileSystemManager"),r=e("downloadFile",!0),n=e("getFileInfo",!0),o=e("getSystemInfoSync"),s=e("getAccountInfoSync"),i=e("getAppAuthorizeSetting"),a=e("authorizeForMiniProgram",!0),c=e("authorize",!0),u=e("onBLEConnectionStateChange"),l=e("offBLEConnectionStateChange"),f=e("onBluetoothAdapterStateChange"),h=e("notifyBLECharacteristicValueChange",!0),p=e("readBLECharacteristicValue",!0),g=e("getBLEMTU",!0),d=e("setBLEMTU",!0),y=e("getBluetoothAdapterState",!0),C=e("onBluetoothDeviceFound"),x=e("offBluetoothDeviceFound"),w=e("getBluetoothDevices",!0),S=e("onBLECharacteristicValueChange"),A=e("offBLECharacteristicValueChange"),B=e("writeBLECharacteristicValue",!0),b=e("createBLEPeripheralServer",!0),m=e("openBluetoothAdapter",!0),T=e("closeBluetoothAdapter",!0),I=e("connectSocket"),U=e("login",!0),E=e("getUserInfo",!0),L=e("createUDPSocket"),v=e("scanCode",!0),M=e("getSetting",!0),V=e("getLocalIPAddress",!0),j=e("startWifi",!0),F=e("stopWifi",!0),k=e("getConnectedWifi",!0),D=e("request",!0),P=e("onAppHide"),_=e("offAppHide"),W=e("onAppShow"),z=e("offAppShow"),H=e("navigateToMiniProgram",!0),O=e("navigateTo",!0),R=e("redirectTo",!0),$=e("navigateBack",!0),q=e("reLaunch",!0);var K=Object.freeze({__proto__:null,hasBaseApi:e=>!!wx[e],getFileSystemManager:t,downloadFile:r,getFileInfo:n,getSystemInfoSync:o,getAccountInfoSync:s,getAppAuthorizeSetting:i,authorizeForMiniProgram:a,authorize:c,onBLEConnectionStateChange:u,offBLEConnectionStateChange:l,onBluetoothAdapterStateChange:f,notifyBLECharacteristicValueChange:h,readBLECharacteristicValue:p,getBLEMTU:g,setBLEMTU:d,getBluetoothAdapterState:y,onBluetoothDeviceFound:C,offBluetoothDeviceFound:x,getBluetoothDevices:w,onBLECharacteristicValueChange:S,offBLECharacteristicValueChange:A,writeBLECharacteristicValue:B,createBLEPeripheralServer:b,openBluetoothAdapter:m,closeBluetoothAdapter:T,connectSocket:I,login:U,getUserInfo:E,createUDPSocket:L,scanCode:v,getSetting:M,getLocalIPAddress:V,startWifi:j,stopWifi:F,getConnectedWifi:k,request:D,onAppHide:P,offAppHide:_,onAppShow:W,offAppShow:z,navigateToMiniProgram:H,navigateTo:O,redirectTo:R,navigateBack:$,reLaunch:q});function N(e,t=2){let r=e;return"string"==typeof e&&(r=parseInt(e)),r.toString(16).padStart(t,"0")}function Q(e){const t=255&e;let r=0;return t>=128?(r=t%128,r=-1*(128-r)):r=t,r}function G(e,t=!1){const r=e.length,n=new Uint8Array(t?4*r:r);let o=0;for(let s=0;s<r;s++){let i=e.charCodeAt(s);if(t&&55296<=i&&i<=56319){if(++s>=r)throw new Error("Malformed string, low surrogate expected at position "+s);i=(55296^i)<<10|65536|56320^e.charCodeAt(s)}else if(!t&&i>>>8)throw new Error("Wide characters are not allowed.");!t||i<=127?n[o++]=i:i<=2047?(n[o++]=192|i>>6,n[o++]=128|63&i):i<=65535?(n[o++]=224|i>>12,n[o++]=128|i>>6&63,n[o++]=128|63&i):(n[o++]=240|i>>18,n[o++]=128|i>>12&63,n[o++]=128|i>>6&63,n[o++]=128|63&i)}return n.subarray(0,o)}const J=(e,t,r=!0)=>{const n=e.split("."),o=t.split("."),s=Math.max(o.length,n.length);for(;o.length<s;)o.splice(0,0,"0");for(;n.length<s;)n.splice(0,0,"0");for(let e=0;e<s;e++){const t=parseInt(n[e]),r=parseInt(o[e]);if(t>r)return!0;if(t===r)break;return!1}return r},X=e=>e.replace(/^\S/,(function(e){return e.toUpperCase()}));const Y=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;Y[e]=t}const Z={initial_value:0,table:function(e){const t=[];for(let r=0;r<256;++r){let n=r;for(let t=0;t<8;++t)n=0!=(128&n)?(n<<1^e)%256:(n<<1)%256;t[r]=n}return t}(7)};function ee(e){const t=new DataView(e.buffer);switch(e.length){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(te(e),16)}}function te(e){return e.length<=4?ee(e).toString(16).padStart(2*e.length,"0").toUpperCase():e.reduce(((e,t)=>(e.push(t.toString(16).padStart(2,"0")),e)),[]).join("").toUpperCase()}const re=e=>{const t=new DataView(e.buffer),r=[];for(let n=0;n<e.length;n+=4)r.push(t.getInt32(n));return r},ne=e=>{const t=new Uint8Array(4*e.length),r=new DataView(t.buffer);for(let t=0;t<e.length;t++)r.setInt32(4*t,e[t]);return t};const oe={encrypt:function(e,t){const r=re(e),n=re(t),o=r.length-1;let s,i,a=r[o],c=r[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++)c=r[e+1],s=(a>>>5^c<<2)+(c>>>3^a<<4)^(l^c)+(n[3&e^i]^a),a=r[e]=r[e]+s&4294967295;c=r[0],s=(a>>>5^c<<2)+(c>>>3^a<<4)^(l^c)+(n[3&e^i]^a),a=r[o]=r[o]+s&4294967295}return ne(r)},decrypt:function(e,t){const r=re(e),n=re(t),o=r.length-1;let s=r[o-1],i=r[0];const a=2654435769;let c,u,l=Math.floor(6+52/(o+1))*a&4294967295;for(;0!==l;){u=l>>>2&3;let e=o;for(;e>0;e--)s=r[e-1],c=(s>>>5^i<<2)+(i>>>3^s<<4)^(l^i)+(n[3&e^u]^s),i=r[e]=r[e]-c&4294967295;s=r[o],c=(s>>>5^i<<2)+(i>>>3^s<<4)^(l^i)+(n[3&e^u]^s),i=r[0]=r[0]-c&4294967295,l=l-a&4294967295}return ne(r)}},se={},ie=()=>"undefined"!=typeof globalThis?globalThis:se;exports.BaseApi=K,exports.CRC16=function(e){let t,r,n=65535;for(t=0;t<e.length;t++)for(n^=255&e[t],r=0;r<8;r++)0!=(1&n)?(n>>=1,n^=40961):n>>=1;return n},exports.CRC32=function(e){let t=-1;for(let r=0,n=e.length;r<n;r++)t=t>>>8^Y[255&(t^e[r])];return-1^t},exports.CRC8=e=>{let t=Z.initial_value;for(let r=0;r<e.length;r++)t=Z.table[(t^e[r])%256];return t},exports.ab2hex=function(e){const t=[];return Array.prototype.map.call(new Uint8Array(e),(function(e){t.push(N(e))})),t},exports.bitToBoolean=function(e,t){return!!((e&Math.pow(2,t))>>t)},exports.bytes2string=function(e,t=!1){const r=e.length,n=new Array(r);let o=0;for(let s=0;s<r;s++){const i=e[s];if(!t||i<128)n[o++]=i;else if(i>=192&&i<224&&s+1<r)n[o++]=(31&i)<<6|63&e[++s];else if(i>=224&&i<240&&s+2<r)n[o++]=(15&i)<<12|(63&e[++s])<<6|63&e[++s];else{if(!(i>=240&&i<248&&s+3<r))throw new Error("Malformed UTF8 character at byte offset "+s);{let t=(7&i)<<18|(63&e[++s])<<12|(63&e[++s])<<6|63&e[++s];t<=65535?n[o++]=t:(t^=65536,n[o++]=55296|t>>10,n[o++]=56320|1023&t)}}}let s="";const i=16384;for(let e=0;e<o;e+=i)s+=String.fromCharCode(...n.slice(e,e+i<=o?e+i:o));return s},exports.bytesToBits=function(e){return e.reduceRight(((e,t)=>{const r=t.toString(2).padStart(8,"0").split("").map((e=>Number(e))).reverse();return e.concat(r)}),[])},exports.bytesToCharts=function(e){return e.length%2!=0?(console.error("Illegal Format UTF16 Code!"),""):e.reduce(((e,t)=>(e.push(String.fromCharCode(t)),e)),[]).join("")},exports.bytesToHex=te,exports.bytesToInt=function(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=ee(e);const r=Math.pow(2,8*e.length)/2;return t>=r&&(t%=r,t=-1*(r-t)),t}}},exports.bytesToIntBy128=(e,t=0)=>{let r=0,n=t;for(;n<4&&n<e.length;n++){const o=e[n];if(r|=(127&o)<<7*(n-t),0==(o>>7&1))break}return{num:r,end:n-t<4?n+1:n}},exports.bytesToString=function(e){const t=[],r=e.length;for(let n=0;n<r;n++){const r=e[n].toString(2),o=r.match(/^1+?(?=0)/);if(o&&8==r.length){const s=o[0].length;let i=r.slice(7-s);for(let t=1;t<s;t++)i+=e[t+n].toString(2).slice(2);t.push(String.fromCharCode(parseInt(i,2))),n+=s-1}else t.push(String.fromCharCode(e[n]))}return t.join("")},exports.bytesToUint=ee,exports.bytesToUtf8=function(e){const t=[];let r=0;for(;r<e.length;){const n=e[r];n<128?(t.push(String.fromCharCode(n)),r++):n>191&&n<224?(t.push(String.fromCharCode((31&n)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&n)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")},exports.checkVersion=J,exports.checkWxVersion=e=>{const t=o().SDKVersion;return J(e,t)},exports.clearCache=function(e){const t=ie();t[e]&&(t[e]={})},exports.dec2hex=N,exports.firstUpperCase=X,exports.formatQuery=(e,t=!1)=>{if(!e)return"";return Object.keys(e).reduce(((r,n)=>{const o=e[n];return void 0!==o&&r.push(`${n}=${t?encodeURIComponent(o):o}`),r}),[]).join("&")},exports.getCache=function(e,t){const r=ie();return r[e]?r[e][t]:null},exports.getCacheSpace=function(e){const t=ie();return t[e]?t[e]:null},exports.hex2ab=function(e){const t=[];if("string"==typeof e)for(let r=0;r<e.length;r+=2)t.push(parseInt(e.slice(r,r+2),16));else if("string"==typeof e[0])for(let r=0;r<e.length;r++)t.push(parseInt(e[r],16));return new Uint8Array(t)},exports.hex2dec=function(e){return parseInt(e,16)},exports.hex2string=function(e){const t=[];if("string"==typeof e)for(let r=0;r<e.length;r+=2){const n=parseInt(e.slice(r,r+2),16);t.push(String.fromCharCode(n))}else for(let r=0;r<e.length;r++){const n=parseInt(e[r],16);t.push(String.fromCharCode(n))}return t.join("")},exports.hexToBytes=e=>{if(e.length%2!=0)throw new Error("hex length error");const t=e.length/2,r=new Uint8Array(t);for(let n=0;n<t;n++)r[n]=parseInt(e.slice(2*n,2*n+2),16);return r},exports.int2TwoBytes=function(e){const t=Q(255&e);return[Q(e>>8&255),t]},exports.intToByte=Q,exports.intToBytes=(e,t)=>{const r=new Int32Array([e]),n=new Int8Array(r.buffer);return n.reverse(),t?new Uint8Array(n.slice(4-t)):new Uint8Array(n)},exports.keyToHump=function e(t){return"object"!=typeof t?t:Array.isArray(t)?t.map((t=>e(t))):Object.keys(t).reduce(((r,n)=>{const o=n.split("_").map(((e,t)=>t>0?X(e):e)).join("");let s=t[n];return Array.isArray(s)?s=s.map((t=>e(t))):"object"==typeof s&&(s=e(s)),r[o]=s,r}),{})},exports.randomBytes=e=>{const t=new Uint8Array(e);for(let r=0;r<e;r++)t[r]=Math.floor(256*Math.random());return t},exports.setCache=function(e,t,r){const n=ie();n[e]||(n[e]={}),n[e][t]=r},exports.string2bytes=G,exports.stringToBytes=function(e){const t=[],r=e.length;for(let n=0;n<r;n++){const r=e.charCodeAt(n);r>=65536&&r<=1114111?(t.push(r>>18&7|240),t.push(r>>12&63|128),t.push(r>>6&63|128),t.push(63&r|128)):r>=2048&&r<=65535?(t.push(r>>12&15|224),t.push(r>>6&63|128),t.push(63&r|128)):r>=128&&r<=2047?(t.push(r>>6&31|192),t.push(63&r|128)):t.push(255&r)}return new Uint8Array(t)},exports.uintToBytes=(e,t)=>{const r=new Uint32Array([e]),n=new Uint8Array(r.buffer);return n.reverse(),t?n.slice(4-t):n},exports.uintToBytesBy128=e=>{const t=[];do{let r=e%128;(e=parseInt(""+e/128))>0&&(r|=128),t.push(r)}while(e>0);return new Uint8Array(t)},exports.utf8ToBytes=function(e){return G(e,!0)},exports.xxtea=oe;
"use strict";function e(e,t){return wx[e]?t?t=>new Promise(((r,n)=>{const{success:o,fail:s}=t||{};wx[e](Object.assign(Object.assign({},t),{success:e=>{o&&o(e),r(e)},fail:e=>{s&&s(e),n(e)}}))})):wx[e]:()=>{console.warn(`The Api ${e} is not found`)}}Object.defineProperty(exports,"__esModule",{value:!0});const t=e("getFileSystemManager"),r=e("downloadFile",!0),n=e("getFileInfo",!0),o=e("getSystemInfoSync"),s=e("getAccountInfoSync"),a=e("getAppAuthorizeSetting"),i=e("authorizeForMiniProgram",!0),c=e("authorize",!0),u=e("onBLEConnectionStateChange"),l=e("offBLEConnectionStateChange"),f=e("onBluetoothAdapterStateChange"),h=e("notifyBLECharacteristicValueChange",!0),p=e("readBLECharacteristicValue",!0),g=e("getBLEMTU",!0),d=e("setBLEMTU",!0),y=e("getBluetoothAdapterState",!0),C=e("onBluetoothDeviceFound"),S=e("offBluetoothDeviceFound"),x=e("getBluetoothDevices",!0),w=e("onBLECharacteristicValueChange"),A=e("offBLECharacteristicValueChange"),B=e("writeBLECharacteristicValue",!0),b=e("createBLEPeripheralServer",!0),m=e("openBluetoothAdapter",!0),T=e("closeBluetoothAdapter",!0),I=e("connectSocket"),U=e("login",!0),E=e("getUserInfo",!0),v=e("createUDPSocket"),L=e("scanCode",!0),M=e("getSetting",!0),V=e("getLocalIPAddress",!0),j=e("startWifi",!0),F=e("stopWifi",!0),k=e("getConnectedWifi",!0),D=e("request",!0),P=e("setStorageSync"),_=e("getStorageSync"),W=e("removeStorageSync"),z=e("onAppHide"),H=e("offAppHide"),O=e("onAppShow"),R=e("offAppShow"),$=e("navigateToMiniProgram",!0),q=e("navigateTo",!0),K=e("redirectTo",!0),N=e("navigateBack",!0),Q=e("reLaunch",!0);var G=Object.freeze({__proto__:null,hasBaseApi:e=>!!wx[e],getFileSystemManager:t,downloadFile:r,getFileInfo:n,getSystemInfoSync:o,getAccountInfoSync:s,getAppAuthorizeSetting:a,authorizeForMiniProgram:i,authorize:c,onBLEConnectionStateChange:u,offBLEConnectionStateChange:l,onBluetoothAdapterStateChange:f,notifyBLECharacteristicValueChange:h,readBLECharacteristicValue:p,getBLEMTU:g,setBLEMTU:d,getBluetoothAdapterState:y,onBluetoothDeviceFound:C,offBluetoothDeviceFound:S,getBluetoothDevices:x,onBLECharacteristicValueChange:w,offBLECharacteristicValueChange:A,writeBLECharacteristicValue:B,createBLEPeripheralServer:b,openBluetoothAdapter:m,closeBluetoothAdapter:T,connectSocket:I,login:U,getUserInfo:E,createUDPSocket:v,scanCode:L,getSetting:M,getLocalIPAddress:V,startWifi:j,stopWifi:F,getConnectedWifi:k,request:D,setStorageSync:P,getStorageSync:_,removeStorageSync:W,onAppHide:z,offAppHide:H,onAppShow:O,offAppShow:R,navigateToMiniProgram:$,navigateTo:q,redirectTo:K,navigateBack:N,reLaunch:Q});function J(e,t=2){let r=e;return"string"==typeof e&&(r=parseInt(e)),r.toString(16).padStart(t,"0")}function X(e){const t=255&e;let r=0;return t>=128?(r=t%128,r=-1*(128-r)):r=t,r}function Y(e,t=!1){const r=e.length,n=new Uint8Array(t?4*r:r);let o=0;for(let s=0;s<r;s++){let a=e.charCodeAt(s);if(t&&55296<=a&&a<=56319){if(++s>=r)throw new Error("Malformed string, low surrogate expected at position "+s);a=(55296^a)<<10|65536|56320^e.charCodeAt(s)}else if(!t&&a>>>8)throw new Error("Wide characters are not allowed.");!t||a<=127?n[o++]=a:a<=2047?(n[o++]=192|a>>6,n[o++]=128|63&a):a<=65535?(n[o++]=224|a>>12,n[o++]=128|a>>6&63,n[o++]=128|63&a):(n[o++]=240|a>>18,n[o++]=128|a>>12&63,n[o++]=128|a>>6&63,n[o++]=128|63&a)}return n.subarray(0,o)}const Z=(e,t,r=!0)=>{const n=e.split("."),o=t.split("."),s=Math.max(o.length,n.length);for(;o.length<s;)o.splice(0,0,"0");for(;n.length<s;)n.splice(0,0,"0");for(let e=0;e<s;e++){const t=parseInt(n[e]),r=parseInt(o[e]);if(t>r)return!0;if(t===r)break;return!1}return r},ee=e=>e.replace(/^\S/,(function(e){return e.toUpperCase()}));const te=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;te[e]=t}const re={initial_value:0,table:function(e){const t=[];for(let r=0;r<256;++r){let n=r;for(let t=0;t<8;++t)n=0!=(128&n)?(n<<1^e)%256:(n<<1)%256;t[r]=n}return t}(7)};function ne(e){const t=new DataView(e.buffer);switch(e.length){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(oe(e),16)}}function oe(e){return e.length<=4?ne(e).toString(16).padStart(2*e.length,"0").toUpperCase():e.reduce(((e,t)=>(e.push(t.toString(16).padStart(2,"0")),e)),[]).join("").toUpperCase()}const se=e=>{const t=new DataView(e.buffer),r=[];for(let n=0;n<e.length;n+=4)r.push(t.getInt32(n));return r},ae=e=>{const t=new Uint8Array(4*e.length),r=new DataView(t.buffer);for(let t=0;t<e.length;t++)r.setInt32(4*t,e[t]);return t};const ie={encrypt:function(e,t){const r=se(e),n=se(t),o=r.length-1;let s,a,i=r[o],c=r[0],u=Math.floor(6+52/(o+1)),l=0;for(;u-- >0;){l=l+2654435769&4294967295,a=l>>>2&3;let e=0;for(;e<o;e++)c=r[e+1],s=(i>>>5^c<<2)+(c>>>3^i<<4)^(l^c)+(n[3&e^a]^i),i=r[e]=r[e]+s&4294967295;c=r[0],s=(i>>>5^c<<2)+(c>>>3^i<<4)^(l^c)+(n[3&e^a]^i),i=r[o]=r[o]+s&4294967295}return ae(r)},decrypt:function(e,t){const r=se(e),n=se(t),o=r.length-1;let s=r[o-1],a=r[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--)s=r[e-1],c=(s>>>5^a<<2)+(a>>>3^s<<4)^(l^a)+(n[3&e^u]^s),a=r[e]=r[e]-c&4294967295;s=r[o],c=(s>>>5^a<<2)+(a>>>3^s<<4)^(l^a)+(n[3&e^u]^s),a=r[0]=r[0]-c&4294967295,l=l-i&4294967295}return ae(r)}},ce={},ue=()=>"undefined"!=typeof globalThis?globalThis:ce;exports.BaseApi=G,exports.CRC16=function(e){let t,r,n=65535;for(t=0;t<e.length;t++)for(n^=255&e[t],r=0;r<8;r++)0!=(1&n)?(n>>=1,n^=40961):n>>=1;return n},exports.CRC32=function(e){let t=-1;for(let r=0,n=e.length;r<n;r++)t=t>>>8^te[255&(t^e[r])];return-1^t},exports.CRC8=e=>{let t=re.initial_value;for(let r=0;r<e.length;r++)t=re.table[(t^e[r])%256];return t},exports.ab2hex=function(e){const t=[];return Array.prototype.map.call(new Uint8Array(e),(function(e){t.push(J(e))})),t},exports.bitToBoolean=function(e,t){return!!((e&Math.pow(2,t))>>t)},exports.bytes2string=function(e,t=!1){const r=e.length,n=new Array(r);let o=0;for(let s=0;s<r;s++){const a=e[s];if(!t||a<128)n[o++]=a;else if(a>=192&&a<224&&s+1<r)n[o++]=(31&a)<<6|63&e[++s];else if(a>=224&&a<240&&s+2<r)n[o++]=(15&a)<<12|(63&e[++s])<<6|63&e[++s];else{if(!(a>=240&&a<248&&s+3<r))throw new Error("Malformed UTF8 character at byte offset "+s);{let t=(7&a)<<18|(63&e[++s])<<12|(63&e[++s])<<6|63&e[++s];t<=65535?n[o++]=t:(t^=65536,n[o++]=55296|t>>10,n[o++]=56320|1023&t)}}}let s="";const a=16384;for(let e=0;e<o;e+=a)s+=String.fromCharCode(...n.slice(e,e+a<=o?e+a:o));return s},exports.bytesToBits=function(e){return e.reduceRight(((e,t)=>{const r=t.toString(2).padStart(8,"0").split("").map((e=>Number(e))).reverse();return e.concat(r)}),[])},exports.bytesToCharts=function(e){return e.length%2!=0?(console.error("Illegal Format UTF16 Code!"),""):e.reduce(((e,t)=>(e.push(String.fromCharCode(t)),e)),[]).join("")},exports.bytesToHex=oe,exports.bytesToInt=function(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=ne(e);const r=Math.pow(2,8*e.length)/2;return t>=r&&(t%=r,t=-1*(r-t)),t}}},exports.bytesToIntBy128=(e,t=0)=>{let r=0,n=t;for(;n<4&&n<e.length;n++){const o=e[n];if(r|=(127&o)<<7*(n-t),0==(o>>7&1))break}return{num:r,end:n-t<4?n+1:n}},exports.bytesToString=function(e){const t=[],r=e.length;for(let n=0;n<r;n++){const r=e[n].toString(2),o=r.match(/^1+?(?=0)/);if(o&&8==r.length){const s=o[0].length;let a=r.slice(7-s);for(let t=1;t<s;t++)a+=e[t+n].toString(2).slice(2);t.push(String.fromCharCode(parseInt(a,2))),n+=s-1}else t.push(String.fromCharCode(e[n]))}return t.join("")},exports.bytesToUint=ne,exports.bytesToUtf8=function(e){const t=[];let r=0;for(;r<e.length;){const n=e[r];n<128?(t.push(String.fromCharCode(n)),r++):n>191&&n<224?(t.push(String.fromCharCode((31&n)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&n)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")},exports.checkVersion=Z,exports.checkWxVersion=e=>{const t=o().SDKVersion;return Z(e,t)},exports.clearCache=function(e){const t=ue();t[e]&&(t[e]={})},exports.dec2hex=J,exports.firstUpperCase=ee,exports.formatQuery=(e,t=!1)=>{if(!e)return"";return Object.keys(e).reduce(((r,n)=>{const o=e[n];return void 0!==o&&r.push(`${n}=${t?encodeURIComponent(o):o}`),r}),[]).join("&")},exports.getCache=function(e,t){const r=ue();return r[e]?r[e][t]:null},exports.getCacheSpace=function(e){const t=ue();return t[e]?t[e]:null},exports.hex2ab=function(e){const t=[];if("string"==typeof e)for(let r=0;r<e.length;r+=2)t.push(parseInt(e.slice(r,r+2),16));else if("string"==typeof e[0])for(let r=0;r<e.length;r++)t.push(parseInt(e[r],16));return new Uint8Array(t)},exports.hex2dec=function(e){return parseInt(e,16)},exports.hex2string=function(e){const t=[];if("string"==typeof e)for(let r=0;r<e.length;r+=2){const n=parseInt(e.slice(r,r+2),16);t.push(String.fromCharCode(n))}else for(let r=0;r<e.length;r++){const n=parseInt(e[r],16);t.push(String.fromCharCode(n))}return t.join("")},exports.hexToBytes=e=>{if(e.length%2!=0)throw new Error("hex length error");const t=e.length/2,r=new Uint8Array(t);for(let n=0;n<t;n++)r[n]=parseInt(e.slice(2*n,2*n+2),16);return r},exports.int2TwoBytes=function(e){const t=X(255&e);return[X(e>>8&255),t]},exports.intToByte=X,exports.intToBytes=(e,t)=>{const r=new Int32Array([e]),n=new Int8Array(r.buffer);return n.reverse(),t?new Uint8Array(n.slice(4-t)):new Uint8Array(n)},exports.keyToHump=function e(t){return"object"!=typeof t?t:Array.isArray(t)?t.map((t=>e(t))):Object.keys(t).reduce(((r,n)=>{const o=n.split("_").map(((e,t)=>t>0?ee(e):e)).join("");let s=t[n];return Array.isArray(s)?s=s.map((t=>e(t))):"object"==typeof s&&(s=e(s)),r[o]=s,r}),{})},exports.randomBytes=e=>{const t=new Uint8Array(e);for(let r=0;r<e;r++)t[r]=Math.floor(256*Math.random());return t},exports.setCache=function(e,t,r){const n=ue();n[e]||(n[e]={}),n[e][t]=r},exports.string2bytes=Y,exports.stringToBytes=function(e){const t=[],r=e.length;for(let n=0;n<r;n++){const r=e.charCodeAt(n);r>=65536&&r<=1114111?(t.push(r>>18&7|240),t.push(r>>12&63|128),t.push(r>>6&63|128),t.push(63&r|128)):r>=2048&&r<=65535?(t.push(r>>12&15|224),t.push(r>>6&63|128),t.push(63&r|128)):r>=128&&r<=2047?(t.push(r>>6&31|192),t.push(63&r|128)):t.push(255&r)}return new Uint8Array(t)},exports.uintToBytes=(e,t)=>{const r=new Uint32Array([e]),n=new Uint8Array(r.buffer);return n.reverse(),t?n.slice(4-t):n},exports.uintToBytesBy128=e=>{const t=[];do{let r=e%128;(e=parseInt(""+e/128))>0&&(r|=128),t.push(r)}while(e>0);return new Uint8Array(t)},exports.utf8ToBytes=function(e){return Y(e,!0)},exports.xxtea=ie;
{
"name": "@ray-js/wechat-helper",
"version": "0.0.17-beta-6",
"version": "0.0.18",
"publishConfig": {

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

@@ -38,2 +38,5 @@ export declare const hasBaseApi: (apiName: string) => boolean;

export declare const request: (option?: any) => Promise<any>;
export declare const setStorageSync: (option?: any) => any;
export declare const getStorageSync: (option?: any) => any;
export declare const removeStorageSync: (option?: any) => any;
export declare const onAppHide: (option?: any) => any;

@@ -40,0 +43,0 @@ export declare const offAppHide: (option?: any) => any;

@@ -6,3 +6,3 @@ /**

*
* @param data 无符号整形数据
* @param data 8位无符号整形数据
* @param offset

@@ -9,0 +9,0 @@ * @returns

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc