amos-tool 1.4.6 → 1.4.9

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.
Files changed (100) hide show
  1. package/.prettierignore +2 -2
  2. package/.prettierrc +50 -50
  3. package/README.md +5 -0
  4. package/apis/objectPath.md +129 -129
  5. package/index.d.ts +23 -4
  6. package/index.js +3 -3
  7. package/lib/_browser.js +10 -8
  8. package/lib/_clone.js +67 -62
  9. package/lib/_cookie.js +35 -32
  10. package/lib/_deepCopy.js +17 -29
  11. package/lib/_deepEqual.js +6 -13
  12. package/lib/_fastDeepEqual.js +28 -44
  13. package/lib/_flashSupport.js +13 -10
  14. package/lib/_forOwn.js +8 -7
  15. package/lib/_funcThrottle.js +16 -15
  16. package/lib/_isnode.js +2 -1
  17. package/lib/_list.js +55 -67
  18. package/lib/_object.assign.js +14 -24
  19. package/lib/_object.entries.js +6 -5
  20. package/lib/_object.values.js +5 -4
  21. package/lib/_omit.js +12 -12
  22. package/lib/_parseJson.js +7 -6
  23. package/lib/_pick.js +8 -7
  24. package/lib/_queue.js +24 -21
  25. package/lib/_shallowCopy.js +24 -23
  26. package/lib/_stringify.js +14 -17
  27. package/lib/_supportWs.js +5 -5
  28. package/lib/_trim.js +5 -4
  29. package/lib/_typeOfList.js +22 -21
  30. package/lib/_uuids.js +30 -35
  31. package/lib/amostool.js +14 -64
  32. package/lib/array2tree.js +9 -10
  33. package/lib/arrayFilter.js +17 -20
  34. package/lib/arrayUtils.js +13 -11
  35. package/lib/browser/Cookie.js +34 -35
  36. package/lib/browser/indexDB.js +71 -82
  37. package/lib/browserSupport.js +76 -71
  38. package/lib/completeUnit.js +7 -4
  39. package/lib/consts.js +2 -1
  40. package/lib/dom/canvas2img.js +61 -73
  41. package/lib/dom/canvasTools.js +9 -14
  42. package/lib/dom/downloadFile.js +15 -12
  43. package/lib/dom/eventHelper.js +8 -6
  44. package/lib/dom/fileBlob.js +14 -14
  45. package/lib/dom/fileSaveAs.js +54 -61
  46. package/lib/dom/getFontSize.js +7 -10
  47. package/lib/dom/minfyImg.js +30 -25
  48. package/lib/encrypt/_base64.js +32 -25
  49. package/lib/encrypt/_md5.js +68 -31
  50. package/lib/encrypt/des.js +426 -363
  51. package/lib/extra/_common.js +119 -166
  52. package/lib/extra/filterNull.js +3 -2
  53. package/lib/extra/find.js +10 -11
  54. package/lib/extra/index.js +4 -3
  55. package/lib/extra/memo.js +18 -0
  56. package/lib/extra/pathToTree.js +48 -42
  57. package/lib/extra/pwdStrength.js +4 -2
  58. package/lib/extra/sortBy.js +28 -30
  59. package/lib/flat.js +15 -0
  60. package/lib/locationParams.js +94 -99
  61. package/lib/log.js +22 -25
  62. package/lib/math/_keyColor.js +3 -1
  63. package/lib/math/addition.js +9 -7
  64. package/lib/math/amountCase.js +8 -12
  65. package/lib/math/coinFormat.js +7 -5
  66. package/lib/math/colorUtil.js +78 -86
  67. package/lib/math/dateTime.js +76 -94
  68. package/lib/math/operations.js +33 -37
  69. package/lib/math/pwdStrength.js +4 -2
  70. package/lib/math/randomColor.js +17 -5
  71. package/lib/math/subtraction.js +10 -9
  72. package/lib/merged.js +9 -9
  73. package/lib/objectPath.js +88 -95
  74. package/lib/parseText.js +8 -7
  75. package/lib/png/Identicon.js +36 -38
  76. package/lib/png/pnglib.js +58 -32
  77. package/lib/png/randomPic.js +9 -12
  78. package/lib/positionFactory.js +25 -80
  79. package/lib/pwdPolicy.js +27 -31
  80. package/lib/qs/_assign.js +7 -5
  81. package/lib/qs/_merge.js +19 -28
  82. package/lib/qs/_tools.js +3 -2
  83. package/lib/qs/formats.js +6 -5
  84. package/lib/qs/index.js +4 -4
  85. package/lib/qs/parse.js +55 -50
  86. package/lib/qs/stringify.js +55 -77
  87. package/lib/qs/utils.js +69 -88
  88. package/lib/random.js +5 -4
  89. package/lib/shallowEqual.js +24 -34
  90. package/lib/store.js +93 -98
  91. package/lib/strUtils.js +51 -42
  92. package/lib/tableFilter.js +178 -169
  93. package/lib/throttleDebounce.js +18 -22
  94. package/lib/url/encodeUrl.js +5 -4
  95. package/lib/url/restfulUrl.js +8 -7
  96. package/lib/utils.js +168 -223
  97. package/lib/xss/htmlEncode.js +3 -2
  98. package/lib/xss/implementEncode.js +36 -37
  99. package/lib/xss/index.js +4 -3
  100. package/package.json +9 -8
package/lib/parseText.js CHANGED
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
- var utils = require("./utils"),
3
- defaultRE = /\{((?:.|\n)+?)\}/g;
4
- module.exports = function(e, u, t) {
5
- return t = t || defaultRE, e && e.replace ? e.replace(t, function(e, t) {
6
- return utils.isUndefined(u[t]) ? e : u[t]
7
- }) : e
8
- };
2
+
3
+ var utils = require("./utils"), defaultRE = /\{((?:.|\n)+?)\}/g;
4
+
5
+ module.exports = function(e, t, u) {
6
+ return u || (u = defaultRE), e && e.replace ? e.replace(u, (function(e, u) {
7
+ return utils.isUndefined(t[u]) ? e : t[u];
8
+ })) : e;
9
+ };
@@ -1,49 +1,46 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(t) {
4
- return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(t) {
5
- return typeof t
6
- } : function(t) {
7
- return t && "function" == typeof Symbol && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t
8
- })(t)
9
- }
10
- var PNGlib = require("./pnglib"),
11
- Svg = function(t, i, s) {
12
- this.size = t, this.foreground = this.color.apply(this, i), this.background = this.color.apply(this, s), this.rectangles = []
13
- };
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"), _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")), PNGlib = require("./pnglib"), Svg = function(t, i, e) {
4
+ this.size = t, this.foreground = this.color.apply(this, i), this.background = this.color.apply(this, e),
5
+ this.rectangles = [];
6
+ };
14
7
 
15
8
  function Identicon(t, i) {
16
9
  if ("string" != typeof t || t.length < 15) throw "A hash of at least 15 characters is required.";
17
10
  this.defaults = {
18
- background: [240, 240, 240, 255],
11
+ background: [ 240, 240, 240, 255 ],
19
12
  margin: .08,
20
13
  size: 64,
21
14
  saturation: .7,
22
15
  brightness: .5,
23
16
  format: "png"
24
- }, this.options = "object" === _typeof(i) ? i : this.defaults, "number" == typeof i && (this.options.size = i), arguments[2] && (this.options.margin = arguments[2]), this.hash = t, this.background = this.options.background || this.defaults.background, this.size = this.options.size || this.defaults.size, this.format = this.options.format || this.defaults.format, this.margin = void 0 !== this.options.margin ? this.options.margin : this.defaults.margin;
25
- var s = parseInt(this.hash.substr(-7), 16) / 268435455,
26
- o = this.options.saturation || this.defaults.saturation,
27
- r = this.options.brightness || this.defaults.brightness;
28
- this.foreground = this.options.foreground || this.hsl2rgb(s, o, r)
17
+ }, this.options = "object" === (0, _typeof2.default)(i) ? i : this.defaults, "number" == typeof arguments[1] && (this.options.size = arguments[1]),
18
+ arguments[2] && (this.options.margin = arguments[2]), this.hash = t, this.background = this.options.background || this.defaults.background,
19
+ this.size = this.options.size || this.defaults.size, this.format = this.options.format || this.defaults.format,
20
+ this.margin = void 0 !== this.options.margin ? this.options.margin : this.defaults.margin;
21
+ var e = parseInt(this.hash.substr(-7), 16) / 268435455, s = this.options.saturation || this.defaults.saturation, r = this.options.brightness || this.defaults.brightness;
22
+ this.foreground = this.options.foreground || this.hsl2rgb(e, s, r);
29
23
  }
24
+
30
25
  Svg.prototype = {
31
26
  size: null,
32
27
  foreground: null,
33
28
  background: null,
34
29
  rectangles: null,
35
- color: function(t, i, s, o) {
36
- var r = [t, i, s].map(Math.round);
37
- return r.push(0 <= o && o <= 255 ? o / 255 : 1), "rgba(" + r.join(",") + ")"
30
+ color: function(t, i, e, s) {
31
+ var r = [ t, i, e ].map(Math.round);
32
+ return r.push(s >= 0 && s <= 255 ? s / 255 : 1), "rgba(" + r.join(",") + ")";
38
33
  },
39
34
  getDump: function() {
40
- for (var t, i = this.foreground, s = this.background, o = .005 * this.size, r = "<svg xmlns='http://www.w3.org/2000/svg' width='" + this.size + "' height='" + this.size + "' style='background-color:" + s + ";'><g style='fill:" + i + "; stroke:" + i + "; stroke-width:" + o + ";'>", n = 0; n < this.rectangles.length; n++)(t = this.rectangles[n]).color != s && (r += "<rect x='" + t.x + "' y='" + t.y + "' width='" + t.w + "' height='" + t.h + "'/>");
41
- return r += "</g></svg>"
35
+ var t, i, e, s = this.foreground, r = this.background, n = .005 * this.size;
36
+ for (i = "<svg xmlns='http://www.w3.org/2000/svg' width='" + this.size + "' height='" + this.size + "' style='background-color:" + r + ";'><g style='fill:" + s + "; stroke:" + s + "; stroke-width:" + n + ";'>",
37
+ t = 0; t < this.rectangles.length; t++) (e = this.rectangles[t]).color != r && (i += "<rect x='" + e.x + "' y='" + e.y + "' width='" + e.w + "' height='" + e.h + "'/>");
38
+ return i += "</g></svg>";
42
39
  },
43
40
  getBase64: function() {
44
41
  if ("function" == typeof btoa) return btoa(this.getDump());
45
42
  if (Buffer) return new Buffer(this.getDump(), "binary").toString("base64");
46
- throw "Cannot generate base64 output"
43
+ throw "Cannot generate base64 output";
47
44
  }
48
45
  }, Identicon.prototype = {
49
46
  background: null,
@@ -53,31 +50,32 @@ Svg.prototype = {
53
50
  size: null,
54
51
  format: null,
55
52
  image: function() {
56
- return this.isSvg() ? new Svg(this.size, this.foreground, this.background) : new PNGlib(this.size, this.size, 256)
53
+ return this.isSvg() ? new Svg(this.size, this.foreground, this.background) : new PNGlib(this.size, this.size, 256);
57
54
  },
58
55
  render: function() {
59
- for (var t, i = this.image(), s = this.size, o = Math.floor(s * this.margin), r = Math.floor((s - 2 * o) / 5), n = Math.floor((s - 5 * r) / 2), e = i.color.apply(i, this.background), h = i.color.apply(i, this.foreground), a = 0; a < 15; a++) t = parseInt(this.hash.charAt(a), 16) % 2 ? e : h, a < 5 ? this.rectangle(2 * r + n, a * r + n, r, r, t, i) : a < 10 ? (this.rectangle(+r + n, (a - 5) * r + n, r, r, t, i), this.rectangle(3 * r + n, (a - 5) * r + n, r, r, t, i)) : a < 15 && (this.rectangle(0 * r + n, (a - 10) * r + n, r, r, t, i), this.rectangle(4 * r + n, (a - 10) * r + n, r, r, t, i));
60
- return i
56
+ var t, i, e = this.image(), s = this.size, r = Math.floor(s * this.margin), n = Math.floor((s - 2 * r) / 5), o = Math.floor((s - 5 * n) / 2), h = e.color.apply(e, this.background), a = e.color.apply(e, this.foreground);
57
+ for (t = 0; t < 15; t++) i = parseInt(this.hash.charAt(t), 16) % 2 ? h : a, t < 5 ? this.rectangle(2 * n + o, t * n + o, n, n, i, e) : t < 10 ? (this.rectangle(1 * n + o, (t - 5) * n + o, n, n, i, e),
58
+ this.rectangle(3 * n + o, (t - 5) * n + o, n, n, i, e)) : t < 15 && (this.rectangle(0 * n + o, (t - 10) * n + o, n, n, i, e),
59
+ this.rectangle(4 * n + o, (t - 10) * n + o, n, n, i, e));
60
+ return e;
61
61
  },
62
- rectangle: function(t, i, s, o, r, n) {
62
+ rectangle: function(t, i, e, s, r, n) {
63
+ var o, h;
63
64
  if (this.isSvg()) n.rectangles.push({
64
65
  x: t,
65
66
  y: i,
66
- w: s,
67
- h: o,
67
+ w: e,
68
+ h: s,
68
69
  color: r
69
- });
70
- else
71
- for (var e, h = t; h < t + s; h++)
72
- for (e = i; e < i + o; e++) n.buffer[n.index(h, e)] = r
70
+ }); else for (o = t; o < t + e; o++) for (h = i; h < i + s; h++) n.buffer[n.index(o, h)] = r;
73
71
  },
74
- hsl2rgb: function(t, i, s) {
75
- return [255 * (i = [s += i *= s < .5 ? s : 1 - s, s - (t *= 6) % 1 * i * 2, s -= i *= 2, s, s + t % 1 * i, s + i])[~~t % 6], 255 * i[(16 | t) % 6], 255 * i[(8 | t) % 6]]
72
+ hsl2rgb: function(t, i, e) {
73
+ return [ 255 * (i = [ e += i *= e < .5 ? e : 1 - e, e - (t *= 6) % 1 * i * 2, e -= i *= 2, e, e + t % 1 * i, e + i ])[~~t % 6], 255 * i[(16 | t) % 6], 255 * i[(8 | t) % 6] ];
76
74
  },
77
75
  toString: function(t) {
78
- return t ? this.render().getDump() : this.render().getBase64()
76
+ return t ? this.render().getDump() : this.render().getBase64();
79
77
  },
80
78
  isSvg: function() {
81
- return this.format.match(/svg/i)
79
+ return this.format.match(/svg/i);
82
80
  }
83
- }, module.exports = Identicon;
81
+ }, module.exports = Identicon;
package/lib/png/pnglib.js CHANGED
@@ -1,57 +1,83 @@
1
1
  "use strict";
2
2
 
3
- function write(t, i) {
4
- for (var s = 2; s < arguments.length; s++)
5
- for (var e = 0; e < arguments[s].length; e++) t[i++] = arguments[s].charAt(e)
3
+ /**
4
+ * A handy class to calculate color values.
5
+ *
6
+ * @version 1.0
7
+ * @author Robert Eisele <robert@xarg.org>
8
+ * @copyright Copyright (c) 2010, Robert Eisele
9
+ * @link http://www.xarg.org/2010/03/generate-client-side-png-files-using-javascript/
10
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
11
+ *
12
+ */ function write(t, i) {
13
+ for (var s = 2; s < arguments.length; s++) for (var e = 0; e < arguments[s].length; e++) t[i++] = arguments[s].charAt(e);
6
14
  }
7
15
 
8
16
  function byte2(t) {
9
- return String.fromCharCode(t >> 8 & 255, 255 & t)
17
+ return String.fromCharCode(t >> 8 & 255, 255 & t);
10
18
  }
11
19
 
12
20
  function byte4(t) {
13
- return String.fromCharCode(t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, 255 & t)
21
+ return String.fromCharCode(t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, 255 & t);
14
22
  }
15
23
 
16
24
  function byte2lsb(t) {
17
- return String.fromCharCode(255 & t, t >> 8 & 255)
25
+ return String.fromCharCode(255 & t, t >> 8 & 255);
18
26
  }
27
+
19
28
  module.exports = function(t, i, s) {
20
- this.width = t, this.height = i, this.depth = s, this.pix_size = i * (t + 1), this.data_size = 2 + this.pix_size + 5 * Math.floor((65534 + this.pix_size) / 65535) + 4, this.ihdr_offs = 0, this.ihdr_size = 25, this.plte_offs = this.ihdr_offs + this.ihdr_size, this.plte_size = 8 + 3 * s + 4, this.trns_offs = this.plte_offs + this.plte_size, this.trns_size = 8 + s + 4, this.idat_offs = this.trns_offs + this.trns_size, this.idat_size = 8 + this.data_size + 4, this.iend_offs = this.idat_offs + this.idat_size, this.iend_size = 12, this.buffer_size = this.iend_offs + this.iend_size, this.buffer = new Array, this.palette = new Object, this.pindex = 0;
21
- for (var o = new Array, e = 0; e < this.buffer_size; e++) this.buffer[e] = "\0";
22
- write(this.buffer, this.ihdr_offs, byte4(this.ihdr_size - 12), "IHDR", byte4(t), byte4(i), "\b"), write(this.buffer, this.plte_offs, byte4(this.plte_size - 12), "PLTE"), write(this.buffer, this.trns_offs, byte4(this.trns_size - 12), "tRNS"), write(this.buffer, this.idat_offs, byte4(this.idat_size - 12), "IDAT"), write(this.buffer, this.iend_offs, byte4(this.iend_size - 12), "IEND");
23
- write(this.buffer, this.idat_offs + 8, byte2(30938));
24
- for (e = 0;
25
- (e << 16) - 1 < this.pix_size; e++) {
26
- var h, r = e + 65535 < this.pix_size ? (h = 65535, "\0") : (h = this.pix_size - (e << 16) - e, "");
27
- write(this.buffer, this.idat_offs + 8 + 2 + (e << 16) + (e << 2), r, byte2lsb(h), byte2lsb(~h))
29
+ this.width = t, this.height = i, this.depth = s, this.pix_size = i * (t + 1), this.data_size = 2 + this.pix_size + 5 * Math.floor((65534 + this.pix_size) / 65535) + 4,
30
+ this.ihdr_offs = 0, this.ihdr_size = 25, this.plte_offs = this.ihdr_offs + this.ihdr_size,
31
+ this.plte_size = 8 + 3 * s + 4, this.trns_offs = this.plte_offs + this.plte_size,
32
+ this.trns_size = 8 + s + 4, this.idat_offs = this.trns_offs + this.trns_size, this.idat_size = 8 + this.data_size + 4,
33
+ this.iend_offs = this.idat_offs + this.idat_size, this.iend_size = 12, this.buffer_size = this.iend_offs + this.iend_size,
34
+ this.buffer = new Array, this.palette = new Object, this.pindex = 0;
35
+ for (var e = new Array, h = 0; h < this.buffer_size; h++) this.buffer[h] = "\0";
36
+ write(this.buffer, this.ihdr_offs, byte4(this.ihdr_size - 12), "IHDR", byte4(t), byte4(i), "\b"),
37
+ write(this.buffer, this.plte_offs, byte4(this.plte_size - 12), "PLTE"), write(this.buffer, this.trns_offs, byte4(this.trns_size - 12), "tRNS"),
38
+ write(this.buffer, this.idat_offs, byte4(this.idat_size - 12), "IDAT"), write(this.buffer, this.iend_offs, byte4(this.iend_size - 12), "IEND");
39
+ var r = 30912;
40
+ r += 31 - r % 31, write(this.buffer, this.idat_offs + 8, byte2(r));
41
+ for (h = 0; (h << 16) - 1 < this.pix_size; h++) {
42
+ var f, o;
43
+ h + 65535 < this.pix_size ? (f = 65535, o = "\0") : (f = this.pix_size - (h << 16) - h,
44
+ o = ""), write(this.buffer, this.idat_offs + 8 + 2 + (h << 16) + (h << 2), o, byte2lsb(f), byte2lsb(~f));
28
45
  }
29
- for (e = 0; e < 256; e++) {
30
- for (var f = e, n = 0; n < 8; n++) f = 1 & f ? -306674912 ^ f >> 1 & 2147483647 : f >> 1 & 2147483647;
31
- o[e] = f
46
+ for (h = 0; h < 256; h++) {
47
+ for (var n = h, d = 0; d < 8; d++) n = 1 & n ? -306674912 ^ n >> 1 & 2147483647 : n >> 1 & 2147483647;
48
+ e[h] = n;
32
49
  }
33
50
  this.index = function(t, i) {
34
51
  var s = i * (this.width + 1) + t + 1;
35
- return this.idat_offs + 8 + 2 + 5 * Math.floor(s / 65535 + 1) + s
52
+ return this.idat_offs + 8 + 2 + 5 * Math.floor(s / 65535 + 1) + s;
36
53
  }, this.color = function(t, i, s, e) {
37
- var h = (((e = 0 <= e ? e : 255) << 8 | t) << 8 | i) << 8 | s;
54
+ var h = (((e = e >= 0 ? e : 255) << 8 | t) << 8 | i) << 8 | s;
38
55
  if (void 0 === this.palette[h]) {
39
56
  if (this.pindex == this.depth) return "\0";
40
57
  var r = this.plte_offs + 8 + 3 * this.pindex;
41
- this.buffer[r + 0] = String.fromCharCode(t), this.buffer[r + 1] = String.fromCharCode(i), this.buffer[r + 2] = String.fromCharCode(s), this.buffer[this.trns_offs + 8 + this.pindex] = String.fromCharCode(e), this.palette[h] = String.fromCharCode(this.pindex++)
58
+ this.buffer[r + 0] = String.fromCharCode(t), this.buffer[r + 1] = String.fromCharCode(i),
59
+ this.buffer[r + 2] = String.fromCharCode(s), this.buffer[this.trns_offs + 8 + this.pindex] = String.fromCharCode(e),
60
+ this.palette[h] = String.fromCharCode(this.pindex++);
42
61
  }
43
- return this.palette[h]
62
+ return this.palette[h];
44
63
  }, this.getBase64 = function() {
45
- for (var t, i, s, e, h, r, f, o = this.getDump(), n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", d = o.length, a = 0, _ = ""; e = (t = o.charCodeAt(a)) >> 2, h = (3 & t) << 4 | (i = o.charCodeAt(a + 1)) >> 4, s = o.charCodeAt(a + 2), r = d < a + 2 ? 64 : (15 & i) << 2 | s >> 6, f = d < a + 3 ? 64 : 63 & s, _ += n.charAt(e) + n.charAt(h) + n.charAt(r) + n.charAt(f), (a += 3) < d;);
46
- return _
64
+ var t, i, s, e, h, r, f, o = this.getDump(), n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", d = o.length, a = 0, _ = "";
65
+ do {
66
+ e = (t = o.charCodeAt(a)) >> 2, h = (3 & t) << 4 | (i = o.charCodeAt(a + 1)) >> 4,
67
+ s = o.charCodeAt(a + 2), r = d < a + 2 ? 64 : (15 & i) << 2 | s >> 6, f = d < a + 3 ? 64 : 63 & s,
68
+ _ += n.charAt(e) + n.charAt(h) + n.charAt(r) + n.charAt(f);
69
+ } while ((a += 3) < d);
70
+ return _;
47
71
  }, this.getDump = function() {
48
- for (var t = 65521, i = 1, s = 0, e = 5552, h = 0; h < this.height; h++)
49
- for (var r = -1; r < this.width; r++) s += i += this.buffer[this.index(r, h)].charCodeAt(0), 0 == --e && (i %= t, s %= t, e = 5552);
50
-
51
- function f(t, i, s) {
52
- for (var e = -1, h = 4; h < s - 4; h += 1) e = o[255 & (e ^ t[i + h].charCodeAt(0))] ^ e >> 8 & 16777215;
53
- write(t, i + s - 4, byte4(-1 ^ e))
72
+ for (var t = 65521, i = 1, s = 0, h = 5552, r = 0; r < this.height; r++) for (var f = -1; f < this.width; f++) s += i += this.buffer[this.index(f, r)].charCodeAt(0),
73
+ 0 == (h -= 1) && (i %= t, s %= t, h = 5552);
74
+ function o(t, i, s) {
75
+ for (var h = -1, r = 4; r < s - 4; r += 1) h = e[255 & (h ^ t[i + r].charCodeAt(0))] ^ h >> 8 & 16777215;
76
+ write(t, i + s - 4, byte4(-1 ^ h));
54
77
  }
55
- return i %= t, s %= t, write(this.buffer, this.idat_offs + this.idat_size - 8, byte4(s << 16 | i)), f(this.buffer, this.ihdr_offs, this.ihdr_size), f(this.buffer, this.plte_offs, this.plte_size), f(this.buffer, this.trns_offs, this.trns_size), f(this.buffer, this.idat_offs, this.idat_size), f(this.buffer, this.iend_offs, this.iend_size), "‰PNG\r\n\n" + this.buffer.join("")
56
- }
57
- };
78
+ return i %= t, s %= t, write(this.buffer, this.idat_offs + this.idat_size - 8, byte4(s << 16 | i)),
79
+ o(this.buffer, this.ihdr_offs, this.ihdr_size), o(this.buffer, this.plte_offs, this.plte_size),
80
+ o(this.buffer, this.trns_offs, this.trns_size), o(this.buffer, this.idat_offs, this.idat_size),
81
+ o(this.buffer, this.iend_offs, this.iend_size), "‰PNG\r\n\n" + this.buffer.join("");
82
+ };
83
+ };
@@ -1,18 +1,15 @@
1
1
  "use strict";
2
- var md5 = require("./../encrypt/_md5"),
3
- Identicon = require("./Identicon");
2
+
3
+ var md5 = require("./../encrypt/_md5"), Identicon = require("./Identicon");
4
4
 
5
5
  function randomWord(n, o, r) {
6
- var t = "",
7
- e = o,
8
- d = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
6
+ var t = "", e = o, d = [ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" ];
9
7
  n && (e = Math.round(Math.random() * (r - o)) + o);
10
8
  for (var a = 0; a < e; a++) pos = Math.round(Math.random() * (d.length - 1)), t += d[pos];
11
- return t
9
+ return t;
12
10
  }
13
- module.exports = function(n, o, r, t) {
14
- var e = 3 < arguments.length && void 0 !== t ? t : 420,
15
- d = randomWord(0 < arguments.length && void 0 !== n ? n : "amos-tool", 1 < arguments.length && void 0 !== o ? o : 16, 2 < arguments.length && void 0 !== r ? r : 16),
16
- a = md5(d);
17
- return "data:image/png;base64," + new Identicon(a, e).toString()
18
- };
11
+
12
+ module.exports = function() {
13
+ var n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "amos-tool", o = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 16, r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 16, t = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 420, e = randomWord(n, o, r), d = md5(e), a = new Identicon(d, t).toString(), i = "data:image/png;base64," + a;
14
+ return i;
15
+ };
@@ -1,114 +1,59 @@
1
1
  "use strict";
2
2
 
3
- function _extends() {
4
- return (_extends = Object.assign || function(t) {
5
- for (var e = 1; e < arguments.length; e++) {
6
- var r = arguments[e];
7
- for (var i in r) Object.prototype.hasOwnProperty.call(r, i) && (t[i] = r[i])
8
- }
9
- return t
10
- }).apply(this, arguments)
11
- }
12
-
13
- function _slicedToArray(t, e) {
14
- return _arrayWithHoles(t) || _iterableToArrayLimit(t, e) || _unsupportedIterableToArray(t, e) || _nonIterableRest()
15
- }
16
-
17
- function _nonIterableRest() {
18
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
19
- }
20
-
21
- function _unsupportedIterableToArray(t, e) {
22
- if (t) {
23
- if ("string" == typeof t) return _arrayLikeToArray(t, e);
24
- var r = Object.prototype.toString.call(t).slice(8, -1);
25
- return "Object" === r && t.constructor && (r = t.constructor.name), "Map" === r || "Set" === r ? Array.from(t) : "Arguments" === r || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r) ? _arrayLikeToArray(t, e) : void 0
26
- }
27
- }
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"), _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")), _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
28
4
 
29
- function _arrayLikeToArray(t, e) {
30
- (null == e || e > t.length) && (e = t.length);
31
- for (var r = 0, i = new Array(e); r < e; r++) i[r] = t[r];
32
- return i
5
+ function getDocumentScroll() {
6
+ var t = document, e = t.documentElement, i = t.body;
7
+ return [ e && e.scrollTop || i.scrollTop, e && e.scrollLeft || i.scrollLeft ];
33
8
  }
34
9
 
35
- function _iterableToArrayLimit(t, e) {
36
- if ("undefined" != typeof Symbol && Symbol.iterator in Object(t)) {
37
- var r = [],
38
- i = !0,
39
- n = !1,
40
- o = void 0;
41
- try {
42
- for (var c, l = t[Symbol.iterator](); !(i = (c = l.next()).done) && (r.push(c.value), !e || r.length !== e); i = !0);
43
- } catch (t) {
44
- n = !0, o = t
45
- } finally {
46
- try {
47
- i || null == l.return || l.return()
48
- } finally {
49
- if (n) throw o
50
- }
51
- }
52
- return r
10
+ function PositionFactory(t, e, i, r, n) {
11
+ var o = getDocumentScroll(), c = (0, _slicedToArray2.default)(o, 2), l = c[0], g = c[1], u = PositionFactory;
12
+ if (u.triggerRect = t.getBoundingClientRect(), u.popoverRect = e.getBoundingClientRect(),
13
+ u.direction = u.getComputedDirection(i), u.align = u.getComputedAlign(r), u.center = [ u.triggerRect.left + u.triggerRect.width / 2 + g, u.triggerRect.top + u.triggerRect.height / 2 + l ],
14
+ !n) {
15
+ var s = u.coordinateMap[u.direction].call(u), h = (0, _slicedToArray2.default)(s, 2), d = h[0], p = h[1];
16
+ e.style.left = "".concat(d, "px"), e.style.top = "".concat(p, "px");
53
17
  }
18
+ return [ u.direction, u.align ];
54
19
  }
55
20
 
56
- function _arrayWithHoles(t) {
57
- if (Array.isArray(t)) return t
58
- }
59
-
60
- function getDocumentScroll() {
61
- var t = document,
62
- e = t.documentElement,
63
- r = t.body;
64
- return [e && e.scrollTop || r.scrollTop, e && e.scrollLeft || r.scrollLeft]
65
- }
66
-
67
- function PositionFactory(t, e, r, i, n) {
68
- var o, c, l, a = _slicedToArray(getDocumentScroll(), 2),
69
- s = a[0],
70
- u = a[1],
71
- g = PositionFactory;
72
- return g.triggerRect = t.getBoundingClientRect(), g.popoverRect = e.getBoundingClientRect(), g.direction = g.getComputedDirection(r), g.align = g.getComputedAlign(i), g.center = [g.triggerRect.left + g.triggerRect.width / 2 + u, g.triggerRect.top + g.triggerRect.height / 2 + s], n || (c = (o = _slicedToArray(g.coordinateMap[g.direction].call(g), 2))[0], l = o[1], e.style.left = "".concat(c, "px"), e.style.top = "".concat(l, "px")), [g.direction, g.align]
73
- }
74
- _extends(PositionFactory, {
21
+ (0, _extends2.default)(PositionFactory, {
75
22
  triggerRect: null,
76
23
  popoverRect: null,
77
24
  align: null,
78
25
  center: null,
79
26
  getComputedDirection: function(t) {
80
- var e = this.triggerRect,
81
- r = this.popoverRect;
82
- return "up" !== t && "down" !== t || (e.top < r.height ? t = "down" : r.height + e.top + e.height > window.innerHeight && (t = "up")), t
27
+ var e = this.triggerRect, i = this.popoverRect;
28
+ return "up" !== t && "down" !== t || (e.top < i.height ? t = "down" : i.height + e.top + e.height > window.innerHeight && (t = "up")),
29
+ t;
83
30
  },
84
31
  getComputedAlign: function(t) {
85
32
  if ("middle" === t) return t;
86
33
  if ("up" === this.direction || "down" === this.direction) {
87
- if ("top" === t || "bottom" === t) return "middle"
34
+ if ("top" === t || "bottom" === t) return "middle";
88
35
  } else if ("left" === t || "right" === t) return "middle";
89
- return t
36
+ return t;
90
37
  },
91
38
  getAlignPosition: function(t) {
92
- var e = t ? ["left", "right"] : ["top", "bottom"],
93
- r = t ? 0 : 1,
94
- i = t ? "width" : "height";
95
- return this.align === e[0] ? this.center[r] - this.triggerRect[i] / 2 : this.align === e[1] ? this.center[r] - this.popoverRect[i] + this.triggerRect[i] / 2 : this.center[r] - this.popoverRect[i] / 2
39
+ var e = t ? [ "left", "right" ] : [ "top", "bottom" ], i = t ? 0 : 1, r = t ? "width" : "height";
40
+ return this.align === e[0] ? this.center[i] - this.triggerRect[r] / 2 : this.align === e[1] ? this.center[i] - this.popoverRect[r] + this.triggerRect[r] / 2 : this.center[i] - this.popoverRect[r] / 2;
96
41
  },
97
42
  coordinateMap: {
98
43
  up: function() {
99
44
  var t = this.center[1] - this.triggerRect.height / 2 - this.popoverRect.height;
100
- return [this.getAlignPosition(!0), t]
45
+ return [ this.getAlignPosition(!0), t ];
101
46
  },
102
47
  down: function() {
103
48
  var t = this.center[1] + this.triggerRect.height / 2;
104
- return [this.getAlignPosition(!0), t]
49
+ return [ this.getAlignPosition(!0), t ];
105
50
  },
106
51
  left: function() {
107
52
  var t = this.center[0] - this.triggerRect.width / 2 - this.popoverRect.width;
108
- return [t, this.getAlignPosition()]
53
+ return [ t, this.getAlignPosition() ];
109
54
  },
110
55
  right: function() {
111
- return [this.center[0] + this.triggerRect.width / 2, this.getAlignPosition()]
56
+ return [ this.center[0] + this.triggerRect.width / 2, this.getAlignPosition() ];
112
57
  }
113
58
  }
114
- }), module.exports = PositionFactory;
59
+ }), module.exports = PositionFactory;
package/lib/pwdPolicy.js CHANGED
@@ -1,38 +1,34 @@
1
1
  "use strict";
2
- var _uuid = require("./_uuids"),
3
- Store = require("./store"),
4
- md5 = require("./encrypt/_md5"),
5
- normalPolicy = function(e) {
6
- e = e || "";
7
- var r = _uuid.uuid(16);
8
- return e += r, {
9
- password: Store.encrypt(e),
10
- secretKey: r
11
- }
12
- },
13
- advancePolicy = function(e, r) {
14
- return e = e || "", e += r = r || _uuid.uuid(32), {
15
- password: Store.encrypt(e),
16
- secretKey: r
17
- }
18
- },
19
- useMd5Policy = function(e, r) {
20
- return e = e || "", r = r || _uuid.uuid(32), {
21
- password: md5(e, r),
22
- secretKey: r
23
- }
24
- },
25
- useMd5Policy2 = function(e, r) {
26
- e = e || "", r = r || _uuid.uuid(32);
27
- var u = md5(e);
28
- return u += r, {
29
- password: Store.encrypt(u),
30
- secretKey: r
31
- }
2
+
3
+ var _uuid = require("./_uuids"), Store = require("./store"), md5 = require("./encrypt/_md5"), normalPolicy = function(e) {
4
+ e || (e = "");
5
+ var r = _uuid.uuid(16);
6
+ return e += r, {
7
+ password: Store.encrypt(e),
8
+ secretKey: r
32
9
  };
10
+ }, advancePolicy = function(e, r) {
11
+ return e || (e = ""), r || (r = _uuid.uuid(32)), e += r, {
12
+ password: Store.encrypt(e),
13
+ secretKey: r
14
+ };
15
+ }, useMd5Policy = function(e, r) {
16
+ return e || (e = ""), r || (r = _uuid.uuid(32)), {
17
+ password: md5(e, r),
18
+ secretKey: r
19
+ };
20
+ }, useMd5Policy2 = function(e, r) {
21
+ e || (e = ""), r || (r = _uuid.uuid(32));
22
+ var u = md5(e);
23
+ return u += r, {
24
+ password: Store.encrypt(u),
25
+ secretKey: r
26
+ };
27
+ };
28
+
33
29
  module.exports = {
34
30
  normalPolicy: normalPolicy,
35
31
  advancePolicy: advancePolicy,
36
32
  useMd5Policy: useMd5Policy,
37
33
  useMd5Policy2: useMd5Policy2
38
- };
34
+ };
package/lib/qs/_assign.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
- var assign = function(e, r) {
3
- return Object.keys(r).reduce(function(e, n) {
4
- return e[n] = r[n], e
5
- }, e)
2
+
3
+ var assign = function(e, n) {
4
+ return Object.keys(n).reduce((function(e, r) {
5
+ return e[r] = n[r], e;
6
+ }), e);
6
7
  };
7
- module.exports = assign;
8
+
9
+ module.exports = assign;
package/lib/qs/_merge.js CHANGED
@@ -1,31 +1,22 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(r) {
4
- return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(r) {
5
- return typeof r
6
- } : function(r) {
7
- return r && "function" == typeof Symbol && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r
8
- })(r)
9
- }
10
- var arrayToObject = require("./_tools").arrayToObject,
11
- has = Object.prototype.hasOwnProperty,
12
- merge = function e(o, y, a) {
13
- if (!y) return o;
14
- if ("object" !== _typeof(y)) {
15
- if (Array.isArray(o)) o.push(y);
16
- else {
17
- if ("object" !== _typeof(o)) return [o, y];
18
- !a.plainObjects && !a.allowPrototypes && has.call(Object.prototype, y) || (o[y] = !0)
19
- }
20
- return o
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"), _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")), arrayToObject = require("./_tools").arrayToObject, has = Object.prototype.hasOwnProperty, merge = function e(r, t, a) {
4
+ if (!t) return r;
5
+ if ("object" !== (0, _typeof2.default)(t)) {
6
+ if (Array.isArray(r)) r.push(t); else {
7
+ if ("object" !== (0, _typeof2.default)(r)) return [ r, t ];
8
+ (a.plainObjects || a.allowPrototypes || !has.call(Object.prototype, t)) && (r[t] = !0);
21
9
  }
22
- if ("object" !== _typeof(o)) return [o].concat(y);
23
- var r = o;
24
- return Array.isArray(o) && !Array.isArray(y) && (r = arrayToObject(o, a)), Array.isArray(o) && Array.isArray(y) ? (y.forEach(function(r, t) {
25
- has.call(o, t) ? o[t] && "object" === _typeof(o[t]) ? o[t] = e(o[t], r, a) : o.push(r) : o[t] = r
26
- }), o) : Object.keys(y).reduce(function(r, t) {
27
- var o = y[t];
28
- return has.call(r, t) ? r[t] = e(r[t], o, a) : r[t] = o, r
29
- }, r)
30
- };
31
- module.exports = merge;
10
+ return r;
11
+ }
12
+ if ("object" !== (0, _typeof2.default)(r)) return [ r ].concat(t);
13
+ var o = r;
14
+ return Array.isArray(r) && !Array.isArray(t) && (o = arrayToObject(r, a)), Array.isArray(r) && Array.isArray(t) ? (t.forEach((function(t, o) {
15
+ has.call(r, o) ? r[o] && "object" === (0, _typeof2.default)(r[o]) ? r[o] = e(r[o], t, a) : r.push(t) : r[o] = t;
16
+ })), r) : Object.keys(t).reduce((function(r, o) {
17
+ var u = t[o];
18
+ return has.call(r, o) ? r[o] = e(r[o], u, a) : r[o] = u, r;
19
+ }), o);
20
+ };
21
+
22
+ module.exports = merge;
package/lib/qs/_tools.js CHANGED
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
+
2
3
  module.exports = {
3
4
  arrayToObject: function(e, t) {
4
5
  for (var r = t && t.plainObjects ? Object.create(null) : {}, c = 0; c < e.length; ++c) void 0 !== e[c] && (r[c] = e[c]);
5
- return r
6
+ return r;
6
7
  }
7
- };
8
+ };
package/lib/qs/formats.js CHANGED
@@ -1,16 +1,17 @@
1
1
  "use strict";
2
- var replace = String.prototype.replace,
3
- percentTwenties = /%20/g;
2
+
3
+ var replace = String.prototype.replace, percentTwenties = /%20/g;
4
+
4
5
  module.exports = {
5
6
  default: "RFC3986",
6
7
  formatters: {
7
8
  RFC1738: function(e) {
8
- return replace.call(e, percentTwenties, "+")
9
+ return replace.call(e, percentTwenties, "+");
9
10
  },
10
11
  RFC3986: function(e) {
11
- return e
12
+ return e;
12
13
  }
13
14
  },
14
15
  RFC1738: "RFC1738",
15
16
  RFC3986: "RFC3986"
16
- };
17
+ };
package/lib/qs/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
- var stringify = require("./stringify"),
3
- parse = require("./parse"),
4
- formats = require("./formats");
2
+
3
+ var stringify = require("./stringify"), parse = require("./parse"), formats = require("./formats");
4
+
5
5
  module.exports = {
6
6
  formats: formats,
7
7
  parse: parse,
8
8
  stringify: stringify
9
- };
9
+ };