amos-tool 1.4.7 → 1.4.10
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/.prettierignore +2 -2
- package/.prettierrc +50 -50
- package/README.md +3 -0
- package/apis/objectPath.md +129 -129
- package/docs/Logger.html +160 -2
- package/docs/global.html +529 -65
- package/docs/index.html +5 -2
- package/index.d.ts +11 -2
- package/index.js +3 -3
- package/lib/_browser.js +10 -8
- package/lib/_clone.js +68 -57
- package/lib/_cookie.js +50 -47
- package/lib/_deepCopy.js +14 -19
- package/lib/_deepEqual.js +7 -8
- package/lib/_fastDeepEqual.js +26 -34
- package/lib/_flashSupport.js +13 -10
- package/lib/_forOwn.js +8 -7
- package/lib/_funcThrottle.js +16 -15
- package/lib/_isnode.js +2 -1
- package/lib/_list.js +74 -79
- package/lib/_object.assign.js +19 -19
- package/lib/_object.entries.js +8 -7
- package/lib/_object.values.js +8 -7
- package/lib/_omit.js +12 -11
- package/lib/_parseJson.js +7 -6
- package/lib/_pick.js +8 -7
- package/lib/_queue.js +24 -21
- package/lib/_shallowCopy.js +24 -23
- package/lib/_stringify.js +13 -10
- package/lib/_supportWs.js +5 -5
- package/lib/_trim.js +5 -4
- package/lib/_typeOfList.js +22 -21
- package/lib/_uuids.js +30 -35
- package/lib/amostool.js +4 -66
- package/lib/array2tree.js +9 -9
- package/lib/arrayFilter.js +18 -19
- package/lib/arrayUtils.js +10 -8
- package/lib/browser/Cookie.js +35 -36
- package/lib/browser/indexDB.js +72 -71
- package/lib/browserSupport.js +76 -71
- package/lib/completeUnit.js +7 -4
- package/lib/consts.js +2 -1
- package/lib/dom/canvas2img.js +61 -72
- package/lib/dom/canvasTools.js +11 -16
- package/lib/dom/downloadFile.js +17 -12
- package/lib/dom/eventHelper.js +8 -6
- package/lib/dom/fileBlob.js +14 -14
- package/lib/dom/fileSaveAs.js +54 -61
- package/lib/dom/getFontSize.js +7 -10
- package/lib/dom/minfyImg.js +27 -24
- package/lib/encrypt/_base64.js +32 -25
- package/lib/encrypt/_md5.js +68 -31
- package/lib/encrypt/des.js +430 -366
- package/lib/extra/_common.js +120 -161
- package/lib/extra/filterNull.js +5 -4
- package/lib/extra/find.js +10 -11
- package/lib/extra/index.js +4 -3
- package/lib/extra/memo.js +18 -0
- package/lib/extra/pathToTree.js +49 -36
- package/lib/extra/pwdStrength.js +4 -2
- package/lib/extra/sortBy.js +28 -30
- package/lib/flat.js +9 -13
- package/lib/locationParams.js +93 -95
- package/lib/log.js +23 -26
- package/lib/math/_keyColor.js +3 -1
- package/lib/math/addition.js +9 -7
- package/lib/math/amountCase.js +8 -12
- package/lib/math/coinFormat.js +6 -4
- package/lib/math/colorUtil.js +91 -94
- package/lib/math/dateTime.js +79 -97
- package/lib/math/operations.js +33 -37
- package/lib/math/pwdStrength.js +4 -2
- package/lib/math/randomColor.js +17 -5
- package/lib/math/subtraction.js +10 -9
- package/lib/merged.js +9 -9
- package/lib/objectPath.js +81 -82
- package/lib/parseText.js +8 -7
- package/lib/png/Identicon.js +32 -28
- package/lib/png/pnglib.js +59 -34
- package/lib/png/randomPic.js +8 -14
- package/lib/positionFactory.js +28 -28
- package/lib/pwdPolicy.js +27 -31
- package/lib/qs/_assign.js +7 -5
- package/lib/qs/_merge.js +20 -23
- package/lib/qs/_tools.js +3 -2
- package/lib/qs/formats.js +6 -5
- package/lib/qs/index.js +4 -4
- package/lib/qs/parse.js +56 -51
- package/lib/qs/stringify.js +54 -69
- package/lib/qs/utils.js +70 -83
- package/lib/random.js +5 -4
- package/lib/shallowEqual.js +25 -29
- package/lib/store.js +93 -95
- package/lib/strUtils.js +52 -43
- package/lib/tableFilter.js +178 -169
- package/lib/throttleDebounce.js +18 -22
- package/lib/url/encodeUrl.js +5 -4
- package/lib/url/restfulUrl.js +8 -7
- package/lib/utils.js +170 -222
- package/lib/xss/htmlEncode.js +3 -2
- package/lib/xss/implementEncode.js +36 -37
- package/lib/xss/index.js +4 -3
- package/package.json +4 -4
package/lib/parseText.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
+
};
|
package/lib/png/Identicon.js
CHANGED
|
@@ -1,43 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
2
|
+
|
|
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
|
+
};
|
|
8
7
|
|
|
9
8
|
function Identicon(t, i) {
|
|
10
9
|
if ("string" != typeof t || t.length < 15) throw "A hash of at least 15 characters is required.";
|
|
11
10
|
this.defaults = {
|
|
12
|
-
background: [240, 240, 240, 255],
|
|
11
|
+
background: [ 240, 240, 240, 255 ],
|
|
13
12
|
margin: .08,
|
|
14
13
|
size: 64,
|
|
15
14
|
saturation: .7,
|
|
16
15
|
brightness: .5,
|
|
17
16
|
format: "png"
|
|
18
|
-
}, this.options = "object" === (0, _typeof2.default)(i) ? i : this.defaults, "number" == typeof
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.
|
|
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);
|
|
23
23
|
}
|
|
24
|
+
|
|
24
25
|
Svg.prototype = {
|
|
25
26
|
size: null,
|
|
26
27
|
foreground: null,
|
|
27
28
|
background: null,
|
|
28
29
|
rectangles: null,
|
|
29
30
|
color: function(t, i, e, s) {
|
|
30
|
-
|
|
31
|
-
return
|
|
31
|
+
var r = [ t, i, e ].map(Math.round);
|
|
32
|
+
return r.push(s >= 0 && s <= 255 ? s / 255 : 1), "rgba(" + r.join(",") + ")";
|
|
32
33
|
},
|
|
33
34
|
getDump: function() {
|
|
34
|
-
|
|
35
|
-
|
|
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>";
|
|
36
39
|
},
|
|
37
40
|
getBase64: function() {
|
|
38
41
|
if ("function" == typeof btoa) return btoa(this.getDump());
|
|
39
42
|
if (Buffer) return new Buffer(this.getDump(), "binary").toString("base64");
|
|
40
|
-
throw "Cannot generate base64 output"
|
|
43
|
+
throw "Cannot generate base64 output";
|
|
41
44
|
}
|
|
42
45
|
}, Identicon.prototype = {
|
|
43
46
|
background: null,
|
|
@@ -47,31 +50,32 @@ Svg.prototype = {
|
|
|
47
50
|
size: null,
|
|
48
51
|
format: null,
|
|
49
52
|
image: function() {
|
|
50
|
-
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);
|
|
51
54
|
},
|
|
52
55
|
render: function() {
|
|
53
|
-
|
|
54
|
-
|
|
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;
|
|
55
61
|
},
|
|
56
62
|
rectangle: function(t, i, e, s, r, n) {
|
|
63
|
+
var o, h;
|
|
57
64
|
if (this.isSvg()) n.rectangles.push({
|
|
58
65
|
x: t,
|
|
59
66
|
y: i,
|
|
60
67
|
w: e,
|
|
61
68
|
h: s,
|
|
62
69
|
color: r
|
|
63
|
-
});
|
|
64
|
-
else
|
|
65
|
-
for (var o, h = t; h < t + e; h++)
|
|
66
|
-
for (o = i; o < i + s; o++) n.buffer[n.index(h, o)] = r
|
|
70
|
+
}); else for (o = t; o < t + e; o++) for (h = i; h < i + s; h++) n.buffer[n.index(o, h)] = r;
|
|
67
71
|
},
|
|
68
72
|
hsl2rgb: function(t, i, e) {
|
|
69
|
-
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]]
|
|
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] ];
|
|
70
74
|
},
|
|
71
75
|
toString: function(t) {
|
|
72
|
-
return t ? this.render().getDump() : this.render().getBase64()
|
|
76
|
+
return t ? this.render().getDump() : this.render().getBase64();
|
|
73
77
|
},
|
|
74
78
|
isSvg: function() {
|
|
75
|
-
return this.format.match(/svg/i)
|
|
79
|
+
return this.format.match(/svg/i);
|
|
76
80
|
}
|
|
77
|
-
}, module.exports = Identicon;
|
|
81
|
+
}, module.exports = Identicon;
|
package/lib/png/pnglib.js
CHANGED
|
@@ -1,58 +1,83 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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));
|
|
29
45
|
}
|
|
30
|
-
for (
|
|
31
|
-
for (var
|
|
32
|
-
|
|
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;
|
|
33
49
|
}
|
|
34
50
|
this.index = function(t, i) {
|
|
35
|
-
|
|
36
|
-
return this.idat_offs + 8 + 2 + 5 * Math.floor(
|
|
51
|
+
var s = i * (this.width + 1) + t + 1;
|
|
52
|
+
return this.idat_offs + 8 + 2 + 5 * Math.floor(s / 65535 + 1) + s;
|
|
37
53
|
}, this.color = function(t, i, s, e) {
|
|
38
|
-
var h = (((e =
|
|
54
|
+
var h = (((e = e >= 0 ? e : 255) << 8 | t) << 8 | i) << 8 | s;
|
|
39
55
|
if (void 0 === this.palette[h]) {
|
|
40
56
|
if (this.pindex == this.depth) return "\0";
|
|
41
57
|
var r = this.plte_offs + 8 + 3 * this.pindex;
|
|
42
|
-
this.buffer[r + 0] = String.fromCharCode(t), this.buffer[r + 1] = String.fromCharCode(i),
|
|
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++);
|
|
43
61
|
}
|
|
44
|
-
return this.palette[h]
|
|
62
|
+
return this.palette[h];
|
|
45
63
|
}, this.getBase64 = function() {
|
|
46
|
-
|
|
47
|
-
|
|
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 _;
|
|
48
71
|
}, this.getDump = function() {
|
|
49
|
-
for (var t = 65521, i = 1, s = 0,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
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));
|
|
55
77
|
}
|
|
56
|
-
return i %= t, s %= t, write(this.buffer, this.idat_offs + this.idat_size - 8, byte4(s << 16 | i)),
|
|
57
|
-
|
|
58
|
-
|
|
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
|
+
};
|
package/lib/png/randomPic.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
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
|
}
|
|
11
|
+
|
|
13
12
|
module.exports = function() {
|
|
14
|
-
var n =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
t = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : 420,
|
|
18
|
-
r = randomWord(n, o, r),
|
|
19
|
-
r = md5(r);
|
|
20
|
-
return "data:image/png;base64," + new Identicon(r, t).toString()
|
|
21
|
-
};
|
|
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
|
+
};
|
package/lib/positionFactory.js
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
_slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"), _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")), _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
5
4
|
|
|
6
5
|
function getDocumentScroll() {
|
|
7
|
-
var t = document,
|
|
8
|
-
|
|
9
|
-
t = t.body;
|
|
10
|
-
return [e && e.scrollTop || t.scrollTop, e && e.scrollLeft || t.scrollLeft]
|
|
6
|
+
var t = document, e = t.documentElement, i = t.body;
|
|
7
|
+
return [ e && e.scrollTop || i.scrollTop, e && e.scrollLeft || i.scrollLeft ];
|
|
11
8
|
}
|
|
12
9
|
|
|
13
10
|
function PositionFactory(t, e, i, r, n) {
|
|
14
|
-
var o = getDocumentScroll(),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
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");
|
|
17
|
+
}
|
|
18
|
+
return [ u.direction, u.align ];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
(0, _extends2.default)(PositionFactory, {
|
|
21
22
|
triggerRect: null,
|
|
22
23
|
popoverRect: null,
|
|
23
24
|
align: null,
|
|
24
25
|
center: null,
|
|
25
26
|
getComputedDirection: function(t) {
|
|
26
|
-
var e = this.triggerRect,
|
|
27
|
-
|
|
28
|
-
|
|
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;
|
|
29
30
|
},
|
|
30
31
|
getComputedAlign: function(t) {
|
|
31
32
|
if ("middle" === t) return t;
|
|
32
33
|
if ("up" === this.direction || "down" === this.direction) {
|
|
33
|
-
if ("top" === t || "bottom" === t) return "middle"
|
|
34
|
+
if ("top" === t || "bottom" === t) return "middle";
|
|
34
35
|
} else if ("left" === t || "right" === t) return "middle";
|
|
35
|
-
return t
|
|
36
|
+
return t;
|
|
36
37
|
},
|
|
37
38
|
getAlignPosition: function(t) {
|
|
38
|
-
var e = t ? ["left", "right"] : ["top", "bottom"],
|
|
39
|
-
|
|
40
|
-
t = t ? "width" : "height";
|
|
41
|
-
return this.align === e[0] ? this.center[i] - this.triggerRect[t] / 2 : this.align === e[1] ? this.center[i] - this.popoverRect[t] + this.triggerRect[t] / 2 : this.center[i] - this.popoverRect[t] / 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;
|
|
42
41
|
},
|
|
43
42
|
coordinateMap: {
|
|
44
43
|
up: function() {
|
|
45
44
|
var t = this.center[1] - this.triggerRect.height / 2 - this.popoverRect.height;
|
|
46
|
-
return [this.getAlignPosition(!0), t]
|
|
45
|
+
return [ this.getAlignPosition(!0), t ];
|
|
47
46
|
},
|
|
48
47
|
down: function() {
|
|
49
48
|
var t = this.center[1] + this.triggerRect.height / 2;
|
|
50
|
-
return [this.getAlignPosition(!0), t]
|
|
49
|
+
return [ this.getAlignPosition(!0), t ];
|
|
51
50
|
},
|
|
52
51
|
left: function() {
|
|
53
|
-
|
|
52
|
+
var t = this.center[0] - this.triggerRect.width / 2 - this.popoverRect.width;
|
|
53
|
+
return [ t, this.getAlignPosition() ];
|
|
54
54
|
},
|
|
55
55
|
right: function() {
|
|
56
|
-
return [this.center[0] + this.triggerRect.width / 2, this.getAlignPosition()]
|
|
56
|
+
return [ this.center[0] + this.triggerRect.width / 2, this.getAlignPosition() ];
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
}), module.exports = PositionFactory;
|
|
59
|
+
}), module.exports = PositionFactory;
|
package/lib/pwdPolicy.js
CHANGED
|
@@ -1,38 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
password: Store.encrypt(e),
|
|
10
|
-
secretKey: u
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
advancePolicy = function(e, u) {
|
|
14
|
-
return e = e || "", e += u = u || _uuid.uuid(32), {
|
|
15
|
-
password: Store.encrypt(e),
|
|
16
|
-
secretKey: u
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
useMd5Policy = function(e, u) {
|
|
20
|
-
return e = e || "", u = u || _uuid.uuid(32), {
|
|
21
|
-
password: md5(e, u),
|
|
22
|
-
secretKey: u
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
useMd5Policy2 = function(e, u) {
|
|
26
|
-
e = e || "", u = u || _uuid.uuid(32);
|
|
27
|
-
e = md5(e);
|
|
28
|
-
return e += u, {
|
|
29
|
-
password: Store.encrypt(e),
|
|
30
|
-
secretKey: u
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
8
|
+
|
|
9
|
+
module.exports = assign;
|
package/lib/qs/_merge.js
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (Array.isArray(t)) t.push(o);
|
|
10
|
-
else {
|
|
11
|
-
if ("object" !== (0, _typeof2.default)(t)) return [t, o];
|
|
12
|
-
!u.plainObjects && !u.allowPrototypes && has.call(Object.prototype, o) || (t[o] = !0)
|
|
13
|
-
}
|
|
14
|
-
return t
|
|
2
|
+
|
|
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);
|
|
15
9
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
package/lib/qs/formats.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
};
|