utils-uniapp 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/WebSocketClient/index.d.ts +95 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -1
- package/lib/magic/index.d.ts +17 -8
- package/lib/magic/index.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// WebSocketClient.d.ts
|
|
2
|
+
export declare class WebSocketClient {
|
|
3
|
+
/**
|
|
4
|
+
* @param url websocket地址
|
|
5
|
+
* @param options 配置项
|
|
6
|
+
*/
|
|
7
|
+
constructor(url: string, options?: WebSocketClientOptions);
|
|
8
|
+
|
|
9
|
+
url: string;
|
|
10
|
+
reconnectDelay: number;
|
|
11
|
+
heartbeatInterval: number;
|
|
12
|
+
heartbeatTimeout: number;
|
|
13
|
+
heartbeatMsg: string;
|
|
14
|
+
maxReconnect: number;
|
|
15
|
+
socketTask: UniApp.SocketTask | null;
|
|
16
|
+
isConnected: boolean;
|
|
17
|
+
heartbeatTimer: number | null;
|
|
18
|
+
heartbeatTimeoutTimer: number | null;
|
|
19
|
+
reconnectTimer: number | null;
|
|
20
|
+
reconnectCount: number;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 注册事件监听,替代 addEventListener
|
|
24
|
+
* @param event 事件名 open | message | close | error
|
|
25
|
+
* @param fn 回调函数
|
|
26
|
+
*/
|
|
27
|
+
on(event: 'open', fn: (res: UniApp.OnSocketOpenCallbackResult) => void): this;
|
|
28
|
+
on(event: 'message', fn: (res: UniApp.OnSocketMessageCallbackResult) => void): this;
|
|
29
|
+
on(event: 'close', fn: (res: UniApp.OnSocketCloseCallbackResult) => void): this;
|
|
30
|
+
on(event: 'error', fn: (err: UniApp.GeneralCallbackResult) => void): this;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 移除事件监听
|
|
34
|
+
* @param event 事件名
|
|
35
|
+
* @param fn 回调函数
|
|
36
|
+
*/
|
|
37
|
+
off(event: 'open' | 'message' | 'close' | 'error', fn: Function): this;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 内部触发事件(外部一般不用)
|
|
41
|
+
*/
|
|
42
|
+
emit(event: 'open' | 'message' | 'close' | 'error', ...args: any[]): void;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 建立连接
|
|
46
|
+
*/
|
|
47
|
+
connect(): this;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* 发送消息,支持字符串/ArrayBuffer
|
|
51
|
+
* @param message 发送的数据
|
|
52
|
+
*/
|
|
53
|
+
send(message: string | ArrayBuffer): this;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 开启心跳
|
|
57
|
+
*/
|
|
58
|
+
startHeartbeat(): void;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 停止心跳
|
|
62
|
+
*/
|
|
63
|
+
stopHeartbeat(): void;
|
|
64
|
+
|
|
65
|
+
startHeartbeatTimeout(): void;
|
|
66
|
+
resetHeartbeatTimeout(): void;
|
|
67
|
+
clearHeartbeatTimeout(): void;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 自动重连
|
|
71
|
+
*/
|
|
72
|
+
reconnect(): void;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 关闭连接
|
|
76
|
+
* @param code 关闭码
|
|
77
|
+
* @param reason 关闭原因
|
|
78
|
+
*/
|
|
79
|
+
close(code?: number, reason?: string): void;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export declare interface WebSocketClientOptions {
|
|
83
|
+
/** 重连间隔 ms 默认1000 */
|
|
84
|
+
reconnectDelay?: number;
|
|
85
|
+
/** 心跳发送间隔 ms 默认30000 */
|
|
86
|
+
heartbeatInterval?: number;
|
|
87
|
+
/** 心跳超时时间 ms 默认10000,收不到服务端消息则断开 */
|
|
88
|
+
heartbeatTimeout?: number;
|
|
89
|
+
/** 心跳消息 默认ping */
|
|
90
|
+
heartbeatMsg?: string;
|
|
91
|
+
/** 最大重连次数,-1无限重连 */
|
|
92
|
+
maxReconnect?: number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export default WebSocketClient;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./aliPay/index.js"),n=require("./array/index.js"),h=require("./cache/index.js"),T=require("./date/index.js"),i=require("./fs/index.js"),f=require("./getLocation/index.js"),s=require("./http/index.js"),a=require("./magic/index.js"),m=require("./object/index.js"),o=require("./pageStack/index.js"),c=require("./validate/index.js"),d=require("./_rollupPluginBabelHelpers-63255c86.js"),P=require("./index-2cb7f964.js");var k=function(){function g(r){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};d._classCallCheck(this,g),this.url=r,this.reconnectDelay=t.reconnectDelay||1e3,this.heartbeatInterval=t.heartbeatInterval||3e4,this.heartbeatTimeout=t.heartbeatTimeout||1e4,this.heartbeatMsg=t.heartbeatMsg||"ping",this.maxReconnect=(e=t.maxReconnect)!==null&&e!==void 0?e:-1,this.socketTask=null,this.isConnected=!1,this.heartbeatTimer=null,this.heartbeatTimeoutTimer=null,this.reconnectTimer=null,this.reconnectCount=0,this.events={open:[],message:[],close:[],error:[]}}return d._createClass(g,[{key:"on",value:function(e,t){return this.events[e]&&this.events[e].push(t),this}},{key:"off",value:function(e,t){if(!this.events[e])return this;var u=this.events[e].indexOf(t);return u>-1&&this.events[e].splice(u,1),this}},{key:"emit",value:function(e){for(var t=arguments.length,u=new Array(t>1?t-1:0),l=1;l<t;l++)u[l-1]=arguments[l];this.events[e]&&this.events[e].forEach(function(b){return b.apply(void 0,u)})}},{key:"connect",value:function(){var e=this;return this.socketTask&&(this.socketTask.close(),this.socketTask=null),this.socketTask=uni.connectSocket({url:this.url,complete:function(){}}),this.socketTask.onOpen(function(t){e.isConnected=!0,e.reconnectCount=0,console.log("Connection established"),e.emit("open",t),e.startHeartbeat()}),this.socketTask.onMessage(function(t){e.resetHeartbeatTimeout(),e.emit("message",t)}),this.socketTask.onClose(function(t){e.isConnected=!1,console.log("Connection closed",t),e.stopHeartbeat(),e.emit("close",t),e.reconnect()}),this.socketTask.onError(function(t){console.error("WebSocket error: ",t),e.emit("error",t),e.isConnected&&e.stopHeartbeat(),e.socketTask&&e.socketTask.close()}),this}},{key:"send",value:function(e){return this.isConnected&&this.socketTask?this.socketTask.send({data:e}):console.error("WebSocket is not connected"),this}},{key:"startHeartbeat",value:function(){var e=this;this.stopHeartbeat(),this.heartbeatTimer=setInterval(function(){e.isConnected&&(e.send(e.heartbeatMsg),e.startHeartbeatTimeout())},this.heartbeatInterval)}},{key:"stopHeartbeat",value:function(){this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null),this.clearHeartbeatTimeout()}},{key:"startHeartbeatTimeout",value:function(){var e=this;this.clearHeartbeatTimeout(),this.heartbeatTimeoutTimer=setTimeout(function(){console.warn("Heartbeat timeout, close socket"),e.socketTask&&e.socketTask.close()},this.heartbeatTimeout)}},{key:"resetHeartbeatTimeout",value:function(){this.clearHeartbeatTimeout()}},{key:"clearHeartbeatTimeout",value:function(){this.heartbeatTimeoutTimer&&(clearTimeout(this.heartbeatTimeoutTimer),this.heartbeatTimeoutTimer=null)}},{key:"reconnect",value:function(){var e=this;if(!this.isConnected){if(this.maxReconnect!==-1&&this.reconnectCount>=this.maxReconnect){console.log("Reach max reconnect count, stop reconnect");return}this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectCount+=1,console.log("Reconnecting in ".concat(this.reconnectDelay/1e3," seconds... count:").concat(this.reconnectCount)),this.reconnectTimer=setTimeout(function(){e.connect()},this.reconnectDelay)}}},{key:"close",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1e3,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";this.stopHeartbeat(),this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.reconnectCount=0,this.socketTask&&this.socketTask.close({code:e,reason:t})}}])}(),v=require("./lodash");Object.assign(exports,v);exports.alipaySubmit=p.alipaySubmit;exports.exchangeArrP=n.exchangeArrP;exports.filterTree=n.filterTree;exports.findTreeItem=n.findTreeItem;exports.flatWithKey=n.flatWithKey;exports.getTreePath=n.getTreePath;exports.groupBy=n.groupBy;exports.reverseForEach=n.reverseForEach;exports.treeItemSetParent=n.treeItemSetParent;exports.StorageCache=h.StorageCache;exports.localCache=h.localCache;exports.sessionCache=h.sessionCache;exports.dateFormat=T.dateFormat;exports.getDate=T.getDate;exports.$fs=i.$fs;exports.chooseImg=i.chooseImg;exports.getArraybufferTempPath=i.getArraybufferTempPath;exports.getImgBase64Prefix=i.getImgBase64Prefix;exports.readFile=i.readFile;exports.saveImageToPhotosAlbum=i.saveImageToPhotosAlbum;exports.writeFile=i.writeFile;exports.getLocation=f.getLocation;exports.openLocation=f.openLocation;exports.CONTENT_TYPES=s.CONTENT_TYPES;exports.CancelToken=s.CancelToken;exports.createDownloadFile=s.createDownloadFile;exports.createRequest=s.createRequest;exports.createUploadFile=s.createUploadFile;exports.promisifyRequest=s.promisifyRequest;exports.compareVersion=a.compareVersion;exports.compose=a.compose;exports.composeAsync=a.composeAsync;exports.debounce=a.debounce;exports.debouncePromise=a.debouncePromise;exports.decodeURIParams=a.decodeURIParams;exports.encodeURIParams=a.encodeURIParams;exports.getOnLoadParams=a.getOnLoadParams;exports.getPascalCase=a.getPascalCase;exports.getQueryParams=a.getQueryParams;exports.getQueryParamsFromHash=a.getQueryParamsFromHash;exports.getQueryParamsFromSearch=a.getQueryParamsFromSearch;exports.getRandom=a.getRandom;exports.getRandomStr=a.getRandomStr;exports.pipe=a.pipe;exports.pipeAsync=a.pipeAsync;exports.randomColor=a.randomColor;exports.throttle=a.throttle;exports.toQueryString=a.toQueryString;exports.cloneDeepWithDescriptors=m.cloneDeepWithDescriptors;exports.getRawType=m.getRawType;exports.hasOwnProperty=m.hasOwnProperty;exports.backToRoute=o.backToRoute;exports.findPageByFullPath=o.findPageByFullPath;exports.findPageByRoute=o.findPageByRoute;exports.getCurrentPage=o.getCurrentPage;exports.getCurrentPageOptions=o.getCurrentPageOptions;exports.getCurrentRoute=o.getCurrentRoute;exports.getPageStack=o.getPageStack;exports.getPageVm=o.getPageVm;exports.getPrevPage=o.getPrevPage;exports.getPrevRoute=o.getPrevRoute;exports.isExternal=c.isExternal;exports.validDate=c.validDate;exports.validIDCard=c.validIDCard;exports.validPhone=c.validPhone;exports.validPostalCode=c.validPostalCode;exports.validURL=c.validURL;exports.wx=P.index;exports.WebSocketClient=k;
|
package/lib/magic/index.d.ts
CHANGED
|
@@ -99,14 +99,13 @@ export interface GetQueryParamsOptions {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
/**
|
|
102
|
-
* 解析 URL query
|
|
102
|
+
* 解析 URL query 字符串,自动识别多种数组形式:a=1&a=2、a[]=1&a[]=2、a[0]=1&a[1]=2
|
|
103
103
|
* 支持传入完整 URL / query 字符串,自动剔除 hash
|
|
104
|
-
*
|
|
105
104
|
* @param str 完整 url / query 字符串,可以带开头 ?,可携带 #hash
|
|
106
105
|
* @param options 配置选项
|
|
107
|
-
* @returns
|
|
106
|
+
* @returns 解析结果对象
|
|
108
107
|
*/
|
|
109
|
-
export
|
|
108
|
+
export function getQueryParams(str?: string, options?: GetQueryParamsOptions): Record<string, string | string[]>;
|
|
110
109
|
|
|
111
110
|
/**
|
|
112
111
|
* 从当前页面 URL 的 search 部分解析参数(仅浏览器环境)
|
|
@@ -160,14 +159,24 @@ export function randomColor(): string;
|
|
|
160
159
|
*/
|
|
161
160
|
export function getRandomStr(len?: number, $chars?: string): string;
|
|
162
161
|
|
|
162
|
+
export type ArrayFormatType = 'indices' | 'brackets' | 'repeat' | 'comma';
|
|
163
|
+
|
|
164
|
+
export interface ToQueryStringOptions {
|
|
165
|
+
/** 是否前置 ? */
|
|
166
|
+
addQuestionMark?: boolean;
|
|
167
|
+
/** 数组格式化模式,默认 comma */
|
|
168
|
+
arrayFormat?: ArrayFormatType;
|
|
169
|
+
/** true:空数组输出key=;false:空数组直接丢弃,默认 false */
|
|
170
|
+
keepEmptyArray?: boolean;
|
|
171
|
+
}
|
|
172
|
+
|
|
163
173
|
/**
|
|
164
174
|
* 对象转url query字符串
|
|
165
|
-
* 数组自动展开为重复key,与 getQueryParams 解析行为双向对称
|
|
166
175
|
* @param params 参数对象
|
|
167
|
-
* @param
|
|
168
|
-
* @returns query
|
|
176
|
+
* @param options 配置项
|
|
177
|
+
* @returns query字符串
|
|
169
178
|
*/
|
|
170
|
-
export
|
|
179
|
+
export function toQueryString(params: Record<string, any> | null | undefined, options?: ToQueryStringOptions): string;
|
|
171
180
|
|
|
172
181
|
/**
|
|
173
182
|
* 获取页面onLoad参数(自动解析小程序扫码scene)
|
package/lib/magic/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../_rollupPluginBabelHelpers-63255c86.js");function M(){for(var e=arguments.length,a=new Array(e),o=0;o<e;o++)a[o]=arguments[o];if(a.some(function(r){return typeof r!="function"}))throw new TypeError("compose 参数必须是函数");return a.length===0?function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];return n.length===1?n[0]:n}:a.reduce(function(r,n){return function(){for(var t=this,u=arguments.length,i=new Array(u),c=0;c<u;c++)i[c]=arguments[c];return n.call.apply(n,[this,function(){for(var s=arguments.length,m=new Array(s),h=0;h<s;h++)m[h]=arguments[h];return r.apply(t,m.concat(i))}].concat(i))}},function(r){return r})}function Q(){for(var e=arguments.length,a=new Array(e),o=0;o<e;o++)a[o]=arguments[o];if(a.some(function(r){return typeof r!="function"}))throw new TypeError("composeAsync 参数必须是函数");return a.length===0?l._asyncToGenerator(l._regenerator().m(function r(){var n,t,u,i=arguments;return l._regenerator().w(function(c){for(;;)switch(c.n){case 0:for(n=i.length,t=new Array(n),u=0;u<n;u++)t[u]=i[u];return c.a(2,t.length===1?t[0]:t)}},r)})):a.reduce(function(r,n){return l._asyncToGenerator(l._regenerator().m(function t(){var u=this,i,c,s,m=arguments;return l._regenerator().w(function(h){for(;;)switch(h.n){case 0:for(i=m.length,c=new Array(i),s=0;s<i;s++)c[s]=m[s];return h.a(2,n.call.apply(n,[this,l._asyncToGenerator(l._regenerator().m(function w(){var v,g,f,p=arguments;return l._regenerator().w(function(d){for(;;)switch(d.n){case 0:for(v=p.length,g=new Array(v),f=0;f<v;f++)g[f]=p[f];return d.a(2,r.apply(u,g.concat(c)))}},w)}))].concat(c)))}},t,this)}))},function(){var r=l._asyncToGenerator(l._regenerator().m(function n(t){return l._regenerator().w(function(u){for(;;)switch(u.n){case 0:return u.a(2,t)}},n)}));return function(n){return r.apply(this,arguments)}}())}function j(){for(var e=arguments.length,a=new Array(e),o=0;o<e;o++)a[o]=arguments[o];if(a.some(function(r){return typeof r!="function"}))throw new TypeError("pipe 参数必须是函数");return a.length===0?function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];return n.length===1?n[0]:n}:a.reverse().reduce(function(r,n){return function(){for(var t=this,u=arguments.length,i=new Array(u),c=0;c<u;c++)i[c]=arguments[c];return n.call.apply(n,[this,function(){for(var s=arguments.length,m=new Array(s),h=0;h<s;h++)m[h]=arguments[h];return r.apply(t,m.concat(i))}].concat(i))}},function(r){return r})}function O(){for(var e=arguments.length,a=new Array(e),o=0;o<e;o++)a[o]=arguments[o];if(a.some(function(r){return typeof r!="function"}))throw new TypeError("pipeAsync 参数必须是函数");return a.length===0?l._asyncToGenerator(l._regenerator().m(function r(){var n,t,u,i=arguments;return l._regenerator().w(function(c){for(;;)switch(c.n){case 0:for(n=i.length,t=new Array(n),u=0;u<n;u++)t[u]=i[u];return c.a(2,t.length===1?t[0]:t)}},r)})):a.reverse().reduce(function(r,n){return l._asyncToGenerator(l._regenerator().m(function t(){var u=this,i,c,s,m=arguments;return l._regenerator().w(function(h){for(;;)switch(h.n){case 0:for(i=m.length,c=new Array(i),s=0;s<i;s++)c[s]=m[s];return h.a(2,n.call.apply(n,[this,l._asyncToGenerator(l._regenerator().m(function w(){var v,g,f,p=arguments;return l._regenerator().w(function(d){for(;;)switch(d.n){case 0:for(v=p.length,g=new Array(v),f=0;f<v;f++)g[f]=p[f];return d.a(2,r.apply(u,g.concat(c)))}},w)}))].concat(c)))}},t,this)}))},function(){var r=l._asyncToGenerator(l._regenerator().m(function n(t){return l._regenerator().w(function(u){for(;;)switch(u.n){case 0:return u.a(2,t)}},n)}));return function(n){return r.apply(this,arguments)}}())}function F(e,a){var o=null;r.stop=function(){return o&&clearTimeout(o)};function r(){for(var n=this,t=arguments.length,u=new Array(t),i=0;i<t;i++)u[i]=arguments[i];r.stop(),o=setTimeout(function(){e.apply(n,u)},a)}return r}function G(e,a){var o=null,r=[];n.stop=function(){if(o){var t;(t=r.shift())===null||t===void 0||t("cancel"),clearTimeout(o)}};function n(){for(var t=this,u=arguments.length,i=new Array(u),c=0;c<u;c++)i[c]=arguments[c];return new Promise(function(s,m){n.stop(),r.push(m),o=setTimeout(function(){s(e.apply(t,i))},a)})}return n}function _(e){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:500,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r;return o?function(){if(!r){r=!0;for(var n=arguments.length,t=new Array(n),u=0;u<n;u++)t[u]=arguments[u];typeof e=="function"&&e.apply(this,t),setTimeout(function(){r=!1},a)}}:function(){for(var n=this,t=arguments.length,u=new Array(t),i=0;i<t;i++)u[i]=arguments[i];r||(r=!0,setTimeout(function(){r=!1,typeof e=="function"&&e.apply(n,u)},a))}}function $(e){return encodeURIComponent(JSON.stringify(e||{}))}function H(e){return JSON.parse(decodeURIComponent(e||"{}"))}function R(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=a.silent,r=o===void 0?!1:o,n=a.decodePlus,t=n===void 0?!0:n,u=a.strict,i=u===void 0?!1:u,c={};if(typeof e!="string")return c;function s(U,I){var A=U;t&&(A=A.replace(/\+/g," "));try{return decodeURIComponent(A)}catch(E){return r||console.warn("Failed to decode ".concat(I?"key":"value",": ").concat(A),E),i?null:(I&&(A=A.replace(/%[0-9a-f]{2}/gi,"")),A)}}var m=e.split("#")[0],h=m.indexOf("?"),w=h>=0?m.slice(h+1):m;if(!w)return c;for(var v=w.split("&"),g=0;g<v.length;g++){var f=v[g];if(f){var p=f.indexOf("="),d=void 0,P=void 0;p===-1?(d=f,P=""):(d=f.slice(0,p),P=f.slice(p+1));var y=s(d,!0);if(!(y===null||!y)){var S=s(P,!1);if(S!==null){var T=y,b=!1;/\[\]$/.test(y)?(T=y.slice(0,-2),b=!0):/^(.+)\[\d+\]$/.test(y)&&(T=y.replace(/\[\d+\]$/,""),b=!0);var C=c[T];C===void 0?c[T]=b?[S]:S:Array.isArray(C)?C.push(S):c[T]=[C,S]}}}}return c}function L(e){return typeof window=="undefined"?{}:R(window.location.search,e)}function J(e){if(typeof window=="undefined")return{};var a=window.location.hash,o=a.indexOf("?");if(o===-1)return{};var r=a.substring(o);return R(r,e)}function q(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"-";return[Date.now().toString(),Math.random().toString(16).slice(2,10),Math.random().toString(16).slice(7),e.toString()].join(a)}function B(e){return e.replace(/([^-])([^-]*)/g,function(a,o,r){return o.toLocaleUpperCase()+r.toLocaleLowerCase()}).replace(/-/g,"")}function D(e,a){e=e.split("."),a=a.split(".");for(var o=Math.max(e.length,a.length);e.length<o;)e.push("0");for(;a.length<o;)a.push("0");for(var r=0;r<o;r++){var n=parseInt(e[r]),t=parseInt(a[r]);if(n>t)return 1;if(n<t)return-1}return 0}function N(){return"#"+Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}function z(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:8,a=arguments.length>1?arguments[1]:void 0;e=e||32,a||(a="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678");for(var o=a.length,r="",n=0;n<e;n++)r+=a.charAt(Math.floor(Math.random()*o));return r}function V(e){var a,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!e||l._typeof(e)!=="object")return"";var r=o.addQuestionMark,n=r===void 0?!1:r,t=o.arrayFormat,u=t===void 0?"comma":t,i=o.keepEmptyArray,c=i===void 0?!1:i,s=[],m={indices:function(g,f){f.forEach(function(p,d){s.push("".concat(g,"[").concat(d,"]=").concat(encodeURIComponent(p)))})},brackets:function(g,f){f.forEach(function(p){s.push("".concat(g,"[]=").concat(encodeURIComponent(p)))})},repeat:function(g,f){f.forEach(function(p){s.push("".concat(g,"=").concat(encodeURIComponent(p)))})},comma:function(g,f){var p=f.map(function(d){return encodeURIComponent(d)}).join(",");s.push("".concat(g,"=").concat(p))}},h=(a=m[u])!==null&&a!==void 0?a:m.comma;Object.keys(e).forEach(function(v){var g=e[v];if(g!=null){var f=encodeURIComponent(v);if(Array.isArray(g)){var p=g.filter(function(P){return P!=null});if(p.length===0){c&&s.push("".concat(f,"="));return}h(f,p);return}var d=g;l._typeof(d)==="object"&&d!==null&&(d=JSON.stringify(d)),s.push("".concat(f,"=").concat(encodeURIComponent(d)))}});var w=s.join("&");return n&&w?"?".concat(w):w}function W(e){var a=e.scene;return a&&(e=l._objectSpread2(l._objectSpread2({fromCode:!0},e),R(a))),e}exports.compareVersion=D;exports.compose=M;exports.composeAsync=Q;exports.debounce=F;exports.debouncePromise=G;exports.decodeURIParams=H;exports.encodeURIParams=$;exports.getOnLoadParams=W;exports.getPascalCase=B;exports.getQueryParams=R;exports.getQueryParamsFromHash=J;exports.getQueryParamsFromSearch=L;exports.getRandom=q;exports.getRandomStr=z;exports.pipe=j;exports.pipeAsync=O;exports.randomColor=N;exports.throttle=_;exports.toQueryString=V;
|