hanbiro-react16-sdk 1.0.32 → 1.0.33
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/dist/components/ChatAIDraft/helper.js +27 -2
- package/dist/hanbiro-react16-sdk.style.css +2 -2
- package/dist/hanbiro-react16-sdk.umd.js +2663 -701
- package/dist/index.js +2 -2
- package/dist/node_modules/@hanbiro/signer-core/dist/index.js +932 -0
- package/dist/utils/api.d.ts +1 -0
- package/dist/utils/api.js +16 -3
- package/package.json +3 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* hanbiro-react16-sdk v1.0.
|
|
3
|
-
* Build Date: 2026-
|
|
2
|
+
* hanbiro-react16-sdk v1.0.33
|
|
3
|
+
* Build Date: 2026-06-23
|
|
4
4
|
*/
|
|
5
5
|
function _toArray(r) { return _arrayWithHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableRest(); }
|
|
6
6
|
function _readOnlyError(r) { throw new TypeError('"' + r + '" is read-only'); }
|
|
@@ -8,26 +8,29 @@ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLim
|
|
|
8
8
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
9
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
10
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
11
|
-
function
|
|
12
|
-
function
|
|
13
|
-
function
|
|
11
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
12
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
14
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
14
15
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
15
16
|
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
16
17
|
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
17
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
18
|
-
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
19
18
|
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
19
|
+
function _wrapNativeSuper(t) { var r = "function" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); }
|
|
20
|
+
function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
|
|
21
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
22
|
+
function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf("[native code]"); } catch (n) { return "function" == typeof t; } }
|
|
20
23
|
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
24
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
25
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
26
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
27
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
21
28
|
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
22
29
|
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
23
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
24
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
25
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
26
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
27
30
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
28
31
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
29
32
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
30
|
-
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var
|
|
33
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n3 = 0, F = function F() {}; return { s: F, n: function n() { return _n3 >= r.length ? { done: !0 } : { done: !1, value: r[_n3++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
31
34
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
32
35
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
33
36
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
@@ -36,7 +39,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
36
39
|
})(this, function (exports2, React, ReactDOM) {
|
|
37
40
|
"use strict";
|
|
38
41
|
|
|
39
|
-
var
|
|
42
|
+
var _this3 = this,
|
|
40
43
|
_en,
|
|
41
44
|
_vi,
|
|
42
45
|
_ko;
|
|
@@ -91,181 +94,2178 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
91
94
|
} finally {
|
|
92
95
|
_iterator2.f();
|
|
93
96
|
}
|
|
94
|
-
}
|
|
95
|
-
return target;
|
|
96
|
-
};
|
|
97
|
-
var __publicField = function __publicField(obj, key, value) {
|
|
98
|
-
return __defNormalProp(obj, _typeof(key) !== "symbol" ? key + "" : key, value);
|
|
99
|
-
};
|
|
100
|
-
var __async = function __async(__this, __arguments, generator) {
|
|
101
|
-
return new Promise(function (resolve, reject) {
|
|
102
|
-
var fulfilled = function fulfilled(value) {
|
|
103
|
-
try {
|
|
104
|
-
step(generator.next(value));
|
|
105
|
-
} catch (e) {
|
|
106
|
-
reject(e);
|
|
97
|
+
}
|
|
98
|
+
return target;
|
|
99
|
+
};
|
|
100
|
+
var __publicField = function __publicField(obj, key, value) {
|
|
101
|
+
return __defNormalProp(obj, _typeof(key) !== "symbol" ? key + "" : key, value);
|
|
102
|
+
};
|
|
103
|
+
var __async = function __async(__this, __arguments, generator) {
|
|
104
|
+
return new Promise(function (resolve, reject) {
|
|
105
|
+
var fulfilled = function fulfilled(value) {
|
|
106
|
+
try {
|
|
107
|
+
step(generator.next(value));
|
|
108
|
+
} catch (e) {
|
|
109
|
+
reject(e);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
var rejected = function rejected(value) {
|
|
113
|
+
try {
|
|
114
|
+
step(generator.throw(value));
|
|
115
|
+
} catch (e) {
|
|
116
|
+
reject(e);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
var step = function step(x) {
|
|
120
|
+
return x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
121
|
+
};
|
|
122
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
var _a;
|
|
126
|
+
function _interopNamespaceDefault(e) {
|
|
127
|
+
var n = Object.create(null, _defineProperty({}, Symbol.toStringTag, {
|
|
128
|
+
value: "Module"
|
|
129
|
+
}));
|
|
130
|
+
if (e) {
|
|
131
|
+
var _loop = function _loop(k2) {
|
|
132
|
+
if (k2 !== "default") {
|
|
133
|
+
var d = Object.getOwnPropertyDescriptor(e, k2);
|
|
134
|
+
Object.defineProperty(n, k2, d.get ? d : {
|
|
135
|
+
enumerable: true,
|
|
136
|
+
get: function get() {
|
|
137
|
+
return e[k2];
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
for (var k2 in e) {
|
|
143
|
+
_loop(k2);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
n.default = e;
|
|
147
|
+
return Object.freeze(n);
|
|
148
|
+
}
|
|
149
|
+
var React__namespace = /* @__PURE__ */_interopNamespaceDefault(React);
|
|
150
|
+
var ReactDOM__namespace = /* @__PURE__ */_interopNamespaceDefault(ReactDOM);
|
|
151
|
+
var getAppVersion = function getAppVersion() {
|
|
152
|
+
var locationInfo = window.location;
|
|
153
|
+
if (window.location !== window.parent.location) {
|
|
154
|
+
try {
|
|
155
|
+
locationInfo = window.parent.location;
|
|
156
|
+
} catch (e) {
|
|
157
|
+
locationInfo = window.location;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return locationInfo.pathname.includes("/ngw/app") ? "v2" : "v3";
|
|
161
|
+
};
|
|
162
|
+
var applyVersionAttribute = function applyVersionAttribute() {
|
|
163
|
+
if (typeof document === "undefined") return;
|
|
164
|
+
document.documentElement.setAttribute("data-hanbiro-sdk-version", getAppVersion());
|
|
165
|
+
};
|
|
166
|
+
var checkDevelopment = function checkDevelopment() {
|
|
167
|
+
var locationInfo = window.location;
|
|
168
|
+
var hostname = locationInfo.hostname;
|
|
169
|
+
if (hostname === "localhost" || hostname === "127.0.0.1") {
|
|
170
|
+
return true;
|
|
171
|
+
} else {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
var isDevelopment = checkDevelopment();
|
|
176
|
+
var getBaseUrl = function getBaseUrl() {
|
|
177
|
+
var locationInfo = window.location;
|
|
178
|
+
var host = locationInfo.host;
|
|
179
|
+
if (isDevelopment) {
|
|
180
|
+
return "https://vndev.hanbiro.com";
|
|
181
|
+
} else {
|
|
182
|
+
var data = localStorage.getItem("host") || host;
|
|
183
|
+
var dataArr = data == null ? void 0 : data.split("/");
|
|
184
|
+
return "https://" + (dataArr == null ? void 0 : dataArr[0]);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
var getRandomValues;
|
|
188
|
+
var rnds8 = new Uint8Array(16);
|
|
189
|
+
function rng() {
|
|
190
|
+
if (!getRandomValues) {
|
|
191
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
192
|
+
if (!getRandomValues) {
|
|
193
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return getRandomValues(rnds8);
|
|
197
|
+
}
|
|
198
|
+
var byteToHex = [];
|
|
199
|
+
for (var i = 0; i < 256; ++i) {
|
|
200
|
+
byteToHex.push((i + 256).toString(16).slice(1));
|
|
201
|
+
}
|
|
202
|
+
function unsafeStringify(arr) {
|
|
203
|
+
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
204
|
+
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
205
|
+
}
|
|
206
|
+
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
207
|
+
var native = {
|
|
208
|
+
randomUUID: randomUUID
|
|
209
|
+
};
|
|
210
|
+
function v4(options, buf, offset) {
|
|
211
|
+
if (native.randomUUID && true && !options) {
|
|
212
|
+
return native.randomUUID();
|
|
213
|
+
}
|
|
214
|
+
options = options || {};
|
|
215
|
+
var rnds = options.random || (options.rng || rng)();
|
|
216
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
217
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
218
|
+
return unsafeStringify(rnds);
|
|
219
|
+
}
|
|
220
|
+
var we = Object.defineProperty;
|
|
221
|
+
var X$1 = Object.getOwnPropertySymbols;
|
|
222
|
+
var me = Object.prototype.hasOwnProperty,
|
|
223
|
+
be = Object.prototype.propertyIsEnumerable;
|
|
224
|
+
var z = function z(t2, e, n) {
|
|
225
|
+
return e in t2 ? we(t2, e, {
|
|
226
|
+
enumerable: true,
|
|
227
|
+
configurable: true,
|
|
228
|
+
writable: true,
|
|
229
|
+
value: n
|
|
230
|
+
}) : t2[e] = n;
|
|
231
|
+
},
|
|
232
|
+
f = function f(t2, e) {
|
|
233
|
+
for (var n in e || (e = {})) me.call(e, n) && z(t2, n, e[n]);
|
|
234
|
+
if (X$1) {
|
|
235
|
+
var _iterator3 = _createForOfIteratorHelper(X$1(e)),
|
|
236
|
+
_step3;
|
|
237
|
+
try {
|
|
238
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
239
|
+
var n = _step3.value;
|
|
240
|
+
be.call(e, n) && z(t2, n, e[n]);
|
|
241
|
+
}
|
|
242
|
+
} catch (err) {
|
|
243
|
+
_iterator3.e(err);
|
|
244
|
+
} finally {
|
|
245
|
+
_iterator3.f();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return t2;
|
|
249
|
+
};
|
|
250
|
+
var c = function c(t2, e, n) {
|
|
251
|
+
return new Promise(function (r, i) {
|
|
252
|
+
var o = function o(l) {
|
|
253
|
+
try {
|
|
254
|
+
a(n.next(l));
|
|
255
|
+
} catch (d) {
|
|
256
|
+
i(d);
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
s = function s(l) {
|
|
260
|
+
try {
|
|
261
|
+
a(n.throw(l));
|
|
262
|
+
} catch (d) {
|
|
263
|
+
i(d);
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
a = function a(l) {
|
|
267
|
+
return l.done ? r(l.value) : Promise.resolve(l.value).then(o, s);
|
|
268
|
+
};
|
|
269
|
+
a((n = n.apply(t2, e)).next());
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
var Q = {
|
|
273
|
+
lsIdKey: "sig_client_uuid",
|
|
274
|
+
lsPubJwkKey: "sig_pub_jwk",
|
|
275
|
+
idbName: "mod_sig_keystore_v1",
|
|
276
|
+
idbStore: "keys",
|
|
277
|
+
idbPrivKey: "p256_priv",
|
|
278
|
+
registerUrlTpl: "/sig/register/{id}",
|
|
279
|
+
gwCookieName: "HANBIRO_GW"
|
|
280
|
+
};
|
|
281
|
+
function v() {
|
|
282
|
+
var t2 = [];
|
|
283
|
+
try {
|
|
284
|
+
var n = "__sig_test__";
|
|
285
|
+
localStorage.setItem(n, "1"), localStorage.removeItem(n);
|
|
286
|
+
} catch (n) {
|
|
287
|
+
t2.push("localStorage");
|
|
288
|
+
}
|
|
289
|
+
return typeof indexedDB == "undefined" && t2.push("IndexedDB"), b() || t2.push("WebCrypto (crypto.subtle)"), {
|
|
290
|
+
supported: t2.length === 0,
|
|
291
|
+
missing: t2
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
var Se = {
|
|
295
|
+
ko: {
|
|
296
|
+
title: "지원되지 않는 브라우저입니다",
|
|
297
|
+
description: "이 서비스를 이용하려면 최신 브라우저가 필요합니다.",
|
|
298
|
+
missingFeatures: "다음 기능이 지원되지 않습니다:",
|
|
299
|
+
httpsNote: "또한, 보안 연결(HTTPS)을 통해 접속해야 합니다.",
|
|
300
|
+
browserSuggestion: "Chrome, Firefox, Safari, Edge 등 최신 브라우저를 사용해 주세요."
|
|
301
|
+
},
|
|
302
|
+
en: {
|
|
303
|
+
title: "Unsupported Browser",
|
|
304
|
+
description: "A modern browser is required to use this service.",
|
|
305
|
+
missingFeatures: "The following features are not supported:",
|
|
306
|
+
httpsNote: "Also, you must access via a secure connection (HTTPS).",
|
|
307
|
+
browserSuggestion: "Please use a modern browser such as Chrome, Firefox, Safari, or Edge."
|
|
308
|
+
},
|
|
309
|
+
vi: {
|
|
310
|
+
title: "Trình duyệt không được hỗ trợ",
|
|
311
|
+
description: "Cần có trình duyệt hiện đại để sử dụng dịch vụ này.",
|
|
312
|
+
missingFeatures: "Các tính năng sau không được hỗ trợ:",
|
|
313
|
+
httpsNote: "Ngoài ra, bạn phải truy cập qua kết nối bảo mật (HTTPS).",
|
|
314
|
+
browserSuggestion: "Vui lòng sử dụng trình duyệt hiện đại như Chrome, Firefox, Safari hoặc Edge."
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
function P() {
|
|
318
|
+
if (typeof navigator == "undefined") return "en";
|
|
319
|
+
var t2 = (navigator.language || navigator.userLanguage || "en").toLowerCase();
|
|
320
|
+
return t2.startsWith("ko") ? "ko" : t2.startsWith("vi") ? "vi" : "en";
|
|
321
|
+
}
|
|
322
|
+
function w(t2, e, n) {
|
|
323
|
+
var r = n || P(),
|
|
324
|
+
i = Se[r],
|
|
325
|
+
o = "\n\t\t<div style=\"\n\t\t\tposition: fixed;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\tright: 0;\n\t\t\tbottom: 0;\n\t\t\tbackground: #fff;\n\t\t\tz-index: 999999;\n\t\t\tdisplay: flex;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tfont-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n\t\t\">\n\t\t\t<div style=\"\n\t\t\t\ttext-align: center;\n\t\t\t\tpadding: 40px;\n\t\t\t\tmax-width: 500px;\n\t\t\t\">\n\t\t\t\t<div style=\"font-size: 48px; margin-bottom: 20px;\">\u26A0\uFE0F</div>\n\t\t\t\t<h1 style=\"color: #333; margin-bottom: 16px; font-size: 24px;\">\n\t\t\t\t\t".concat(i.title, "\n\t\t\t\t</h1>\n\t\t\t\t<p style=\"color: #666; margin-bottom: 16px; line-height: 1.6;\">\n\t\t\t\t\t").concat(i.description, "<br>\n\t\t\t\t\t").concat(i.missingFeatures, "\n\t\t\t\t</p>\n\t\t\t\t<ul style=\"\n\t\t\t\t\ttext-align: left;\n\t\t\t\t\tdisplay: inline-block;\n\t\t\t\t\tcolor: #e53935;\n\t\t\t\t\tmargin-bottom: 16px;\n\t\t\t\t\">\n\t\t\t\t\t").concat(t2.map(function (s) {
|
|
326
|
+
return "<li>".concat(s, "</li>");
|
|
327
|
+
}).join(""), "\n\t\t\t\t</ul>\n\t\t\t\t<p style=\"color: #ff6f00; margin-bottom: 16px; font-size: 14px; font-weight: 500;\">\n\t\t\t\t\t\uD83D\uDD12 ").concat(i.httpsNote, "\n\t\t\t\t</p>\n\t\t\t\t<p style=\"color: #666; font-size: 14px;\">\n\t\t\t\t\t").concat(i.browserSuggestion, "\n\t\t\t\t</p>\n\t\t\t</div>\n\t\t</div>\n\t");
|
|
328
|
+
if (e) {
|
|
329
|
+
var s = document.getElementById(e);
|
|
330
|
+
if (s) {
|
|
331
|
+
s.innerHTML = o;
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
document.body ? document.body.innerHTML = o : document.addEventListener("DOMContentLoaded", function () {
|
|
336
|
+
document.body.innerHTML = o;
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
function ie(t2) {
|
|
340
|
+
var e = f({}, Q);
|
|
341
|
+
if (t2) for (var n in t2) Object.prototype.hasOwnProperty.call(t2, n) && (e[n] = t2[n]);
|
|
342
|
+
return e;
|
|
343
|
+
}
|
|
344
|
+
function m() {
|
|
345
|
+
if (typeof window != "undefined") {
|
|
346
|
+
if (window.crypto) return window.crypto;
|
|
347
|
+
if (window.msCrypto) return window.msCrypto;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
function b() {
|
|
351
|
+
var t2 = m();
|
|
352
|
+
if (t2) return t2.subtle || t2.webkitSubtle;
|
|
353
|
+
}
|
|
354
|
+
function _(t2) {
|
|
355
|
+
try {
|
|
356
|
+
return localStorage.getItem(t2);
|
|
357
|
+
} catch (e) {
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
function oe(t2, e) {
|
|
362
|
+
try {
|
|
363
|
+
localStorage.setItem(t2, e);
|
|
364
|
+
} catch (n) {}
|
|
365
|
+
}
|
|
366
|
+
function Ce(t2) {
|
|
367
|
+
try {
|
|
368
|
+
localStorage.removeItem(t2);
|
|
369
|
+
} catch (e) {}
|
|
370
|
+
}
|
|
371
|
+
function S(t2) {
|
|
372
|
+
return _(t2.lsIdKey) || "";
|
|
373
|
+
}
|
|
374
|
+
function E(t2, e) {
|
|
375
|
+
oe(t2.lsIdKey, e);
|
|
376
|
+
}
|
|
377
|
+
function se(t2) {
|
|
378
|
+
Ce(t2.lsIdKey);
|
|
379
|
+
}
|
|
380
|
+
function j(t2) {
|
|
381
|
+
try {
|
|
382
|
+
var e = _(t2.lsPubJwkKey);
|
|
383
|
+
return e ? JSON.parse(e) : null;
|
|
384
|
+
} catch (e) {
|
|
385
|
+
return null;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
function ae(t2, e) {
|
|
389
|
+
try {
|
|
390
|
+
oe(t2.lsPubJwkKey, JSON.stringify(e));
|
|
391
|
+
} catch (n) {}
|
|
392
|
+
}
|
|
393
|
+
function k(t2) {
|
|
394
|
+
var e = t2 instanceof Uint8Array ? t2 : new Uint8Array(t2),
|
|
395
|
+
n = "";
|
|
396
|
+
for (var r = 0; r < e.length; r++) n += String.fromCharCode(e[r]);
|
|
397
|
+
return btoa(n).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
398
|
+
}
|
|
399
|
+
function C(t2) {
|
|
400
|
+
if (typeof TextEncoder != "undefined") return new TextEncoder().encode(String(t2));
|
|
401
|
+
var e = unescape(encodeURIComponent(String(t2))),
|
|
402
|
+
n = new Uint8Array(e.length);
|
|
403
|
+
for (var r = 0; r < e.length; r++) n[r] = e.charCodeAt(r);
|
|
404
|
+
return n;
|
|
405
|
+
}
|
|
406
|
+
function x() {
|
|
407
|
+
var t2 = m();
|
|
408
|
+
if (!t2 || !t2.getRandomValues) throw new Error("crypto.getRandomValues not supported");
|
|
409
|
+
var e = new Uint8Array(16);
|
|
410
|
+
t2.getRandomValues(e), e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128;
|
|
411
|
+
var n = Array.from(e).map(function (r) {
|
|
412
|
+
return ("00" + r.toString(16)).slice(-2);
|
|
413
|
+
}).join("");
|
|
414
|
+
return n.slice(0, 8) + "-" + n.slice(8, 12) + "-" + n.slice(12, 16) + "-" + n.slice(16, 20) + "-" + n.slice(20);
|
|
415
|
+
}
|
|
416
|
+
function Y(t2) {
|
|
417
|
+
var e = t2.slice(0, 16);
|
|
418
|
+
e[6] = e[6] & 15 | 80, e[8] = e[8] & 63 | 128;
|
|
419
|
+
var n = Array.from(e).map(function (r) {
|
|
420
|
+
return ("00" + r.toString(16)).slice(-2);
|
|
421
|
+
}).join("");
|
|
422
|
+
return n.slice(0, 8) + "-" + n.slice(8, 12) + "-" + n.slice(12, 16) + "-" + n.slice(16, 20) + "-" + n.slice(20);
|
|
423
|
+
}
|
|
424
|
+
function xe(t2) {
|
|
425
|
+
var e = 3735928559 ^ t2.length,
|
|
426
|
+
n = 1103547991 ^ t2.length,
|
|
427
|
+
r = 3235826430 ^ t2.length,
|
|
428
|
+
i = 2654435769 ^ t2.length;
|
|
429
|
+
for (var s = 0; s < t2.length; s++) {
|
|
430
|
+
var a = t2.charCodeAt(s);
|
|
431
|
+
e = Math.imul(e ^ a, 2654435761), n = Math.imul(n ^ a, 1597334677), r = Math.imul(r ^ a, 2246822507), i = Math.imul(i ^ a, 3266489909);
|
|
432
|
+
}
|
|
433
|
+
e = Math.imul(e ^ e >>> 16, 2246822507) ^ Math.imul(n ^ n >>> 13, 3266489909), n = Math.imul(n ^ n >>> 16, 2246822507) ^ Math.imul(r ^ r >>> 13, 3266489909), r = Math.imul(r ^ r >>> 16, 2246822507) ^ Math.imul(i ^ i >>> 13, 3266489909), i = Math.imul(i ^ i >>> 16, 2246822507) ^ Math.imul(e ^ e >>> 13, 3266489909);
|
|
434
|
+
var o = new Uint8Array(16);
|
|
435
|
+
return new DataView(o.buffer).setUint32(0, e >>> 0, false), new DataView(o.buffer).setUint32(4, n >>> 0, false), new DataView(o.buffer).setUint32(8, r >>> 0, false), new DataView(o.buffer).setUint32(12, i >>> 0, false), o;
|
|
436
|
+
}
|
|
437
|
+
function Ae(t2) {
|
|
438
|
+
return c(this, null, /*#__PURE__*/_regenerator().m(function _callee() {
|
|
439
|
+
var e, n;
|
|
440
|
+
return _regenerator().w(function (_context) {
|
|
441
|
+
while (1) switch (_context.n) {
|
|
442
|
+
case 0:
|
|
443
|
+
e = b();
|
|
444
|
+
if (!(e && typeof e.digest == "function")) {
|
|
445
|
+
_context.n = 2;
|
|
446
|
+
break;
|
|
447
|
+
}
|
|
448
|
+
_context.n = 1;
|
|
449
|
+
return e.digest("SHA-256", C(t2));
|
|
450
|
+
case 1:
|
|
451
|
+
n = _context.v;
|
|
452
|
+
return _context.a(2, Y(new Uint8Array(n)));
|
|
453
|
+
case 2:
|
|
454
|
+
return _context.a(2, Y(xe(t2)));
|
|
455
|
+
}
|
|
456
|
+
}, _callee);
|
|
457
|
+
}));
|
|
458
|
+
}
|
|
459
|
+
function V(t2, e) {
|
|
460
|
+
if (e == null) return;
|
|
461
|
+
if (Array.isArray(e)) {
|
|
462
|
+
var _iterator4 = _createForOfIteratorHelper(e),
|
|
463
|
+
_step4;
|
|
464
|
+
try {
|
|
465
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
466
|
+
var _i = _step4.value;
|
|
467
|
+
V(t2, _i);
|
|
468
|
+
}
|
|
469
|
+
} catch (err) {
|
|
470
|
+
_iterator4.e(err);
|
|
471
|
+
} finally {
|
|
472
|
+
_iterator4.f();
|
|
473
|
+
}
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
if (_typeof(e) == "object") {
|
|
477
|
+
for (var _i2 in e) Object.prototype.hasOwnProperty.call(e, _i2) && V(t2, e[_i2]);
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
var r = String(e).match(/[0-9a-fA-F]{2}(?:(?:[:-][0-9a-fA-F]{2}){5}|(?:[0-9a-fA-F]{2}){5})/g);
|
|
481
|
+
if (r) {
|
|
482
|
+
var _iterator5 = _createForOfIteratorHelper(r),
|
|
483
|
+
_step5;
|
|
484
|
+
try {
|
|
485
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
486
|
+
var _i3 = _step5.value;
|
|
487
|
+
var o = _i3.replace(/[^0-9a-fA-F]/g, "").toLowerCase();
|
|
488
|
+
o.length === 12 && o !== "000000000000" && t2.push(o);
|
|
489
|
+
}
|
|
490
|
+
} catch (err) {
|
|
491
|
+
_iterator5.e(err);
|
|
492
|
+
} finally {
|
|
493
|
+
_iterator5.f();
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
function y(t2) {
|
|
498
|
+
var e = [];
|
|
499
|
+
return V(e, t2), Array.from(new Set(e)).sort();
|
|
500
|
+
}
|
|
501
|
+
function le(t2, e) {
|
|
502
|
+
return c(this, null, /*#__PURE__*/_regenerator().m(function _callee2() {
|
|
503
|
+
var n, _t;
|
|
504
|
+
return _regenerator().w(function (_context2) {
|
|
505
|
+
while (1) switch (_context2.n) {
|
|
506
|
+
case 0:
|
|
507
|
+
n = t2.call(e);
|
|
508
|
+
if (!(n && typeof n.then == "function")) {
|
|
509
|
+
_context2.n = 2;
|
|
510
|
+
break;
|
|
511
|
+
}
|
|
512
|
+
_context2.n = 1;
|
|
513
|
+
return n;
|
|
514
|
+
case 1:
|
|
515
|
+
_t = _context2.v;
|
|
516
|
+
_context2.n = 3;
|
|
517
|
+
break;
|
|
518
|
+
case 2:
|
|
519
|
+
_t = n;
|
|
520
|
+
case 3:
|
|
521
|
+
return _context2.a(2, _t);
|
|
522
|
+
}
|
|
523
|
+
}, _callee2);
|
|
524
|
+
}));
|
|
525
|
+
}
|
|
526
|
+
function U(t2) {
|
|
527
|
+
return typeof t2.HanSigGetMacAddresses == "function" || typeof t2.HanSigMacAddresses != "undefined";
|
|
528
|
+
}
|
|
529
|
+
function de(t2) {
|
|
530
|
+
return c(this, null, /*#__PURE__*/_regenerator().m(function _callee3() {
|
|
531
|
+
return _regenerator().w(function (_context3) {
|
|
532
|
+
while (1) switch (_context3.n) {
|
|
533
|
+
case 0:
|
|
534
|
+
_context3.n = 1;
|
|
535
|
+
return new Promise(function (e) {
|
|
536
|
+
return setTimeout(e, t2);
|
|
537
|
+
});
|
|
538
|
+
case 1:
|
|
539
|
+
return _context3.a(2, _context3.v);
|
|
540
|
+
}
|
|
541
|
+
}, _callee3);
|
|
542
|
+
}));
|
|
543
|
+
}
|
|
544
|
+
function Ie(t2) {
|
|
545
|
+
return c(this, null, /*#__PURE__*/_regenerator().m(function _callee4() {
|
|
546
|
+
var n, r, i;
|
|
547
|
+
return _regenerator().w(function (_context4) {
|
|
548
|
+
while (1) switch (_context4.n) {
|
|
549
|
+
case 0:
|
|
550
|
+
if (!U(t2)) {
|
|
551
|
+
_context4.n = 1;
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
554
|
+
return _context4.a(2, true);
|
|
555
|
+
case 1:
|
|
556
|
+
if (typeof t2.hanChromeExt == "function") {
|
|
557
|
+
_context4.n = 2;
|
|
558
|
+
break;
|
|
559
|
+
}
|
|
560
|
+
return _context4.a(2, false);
|
|
561
|
+
case 2:
|
|
562
|
+
n = 2500, r = 100, i = Date.now() + n;
|
|
563
|
+
case 3:
|
|
564
|
+
if (!(Date.now() <= i)) {
|
|
565
|
+
_context4.n = 7;
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
568
|
+
if (!U(t2)) {
|
|
569
|
+
_context4.n = 4;
|
|
570
|
+
break;
|
|
571
|
+
}
|
|
572
|
+
return _context4.a(2, true);
|
|
573
|
+
case 4:
|
|
574
|
+
if (!(Date.now() + r > i)) {
|
|
575
|
+
_context4.n = 5;
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
578
|
+
return _context4.a(3, 7);
|
|
579
|
+
case 5:
|
|
580
|
+
_context4.n = 6;
|
|
581
|
+
return de(r);
|
|
582
|
+
case 6:
|
|
583
|
+
_context4.n = 3;
|
|
584
|
+
break;
|
|
585
|
+
case 7:
|
|
586
|
+
return _context4.a(2, U(t2));
|
|
587
|
+
}
|
|
588
|
+
}, _callee4);
|
|
589
|
+
}));
|
|
590
|
+
}
|
|
591
|
+
function Ue(t2) {
|
|
592
|
+
return c(this, null, /*#__PURE__*/_regenerator().m(function _callee5() {
|
|
593
|
+
var e, n, r, i, o, _t2, _t3;
|
|
594
|
+
return _regenerator().w(function (_context5) {
|
|
595
|
+
while (1) switch (_context5.p = _context5.n) {
|
|
596
|
+
case 0:
|
|
597
|
+
if (U(t2)) {
|
|
598
|
+
_context5.n = 1;
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
601
|
+
return _context5.a(2, "");
|
|
602
|
+
case 1:
|
|
603
|
+
e = 8e3, n = 150, r = Date.now() + e, i = "";
|
|
604
|
+
case 2:
|
|
605
|
+
if (!(Date.now() <= r)) {
|
|
606
|
+
_context5.n = 10;
|
|
607
|
+
break;
|
|
608
|
+
}
|
|
609
|
+
o = [];
|
|
610
|
+
if (!(typeof t2.HanSigMacAddresses != "undefined" && o.push(t2.HanSigMacAddresses), typeof t2.HanSigGetMacAddresses == "function")) {
|
|
611
|
+
_context5.n = 6;
|
|
612
|
+
break;
|
|
613
|
+
}
|
|
614
|
+
_context5.p = 3;
|
|
615
|
+
_t2 = o;
|
|
616
|
+
_context5.n = 4;
|
|
617
|
+
return le(t2.HanSigGetMacAddresses, t2);
|
|
618
|
+
case 4:
|
|
619
|
+
_t2.push.call(_t2, _context5.v);
|
|
620
|
+
_context5.n = 6;
|
|
621
|
+
break;
|
|
622
|
+
case 5:
|
|
623
|
+
_context5.p = 5;
|
|
624
|
+
_t3 = _context5.v;
|
|
625
|
+
case 6:
|
|
626
|
+
if (!(i = o, y(o).length > 0)) {
|
|
627
|
+
_context5.n = 7;
|
|
628
|
+
break;
|
|
629
|
+
}
|
|
630
|
+
return _context5.a(2, o);
|
|
631
|
+
case 7:
|
|
632
|
+
if (!(Date.now() + n > r)) {
|
|
633
|
+
_context5.n = 8;
|
|
634
|
+
break;
|
|
635
|
+
}
|
|
636
|
+
return _context5.a(3, 10);
|
|
637
|
+
case 8:
|
|
638
|
+
_context5.n = 9;
|
|
639
|
+
return de(n);
|
|
640
|
+
case 9:
|
|
641
|
+
_context5.n = 2;
|
|
642
|
+
break;
|
|
643
|
+
case 10:
|
|
644
|
+
return _context5.a(2, i);
|
|
645
|
+
}
|
|
646
|
+
}, _callee5, null, [[3, 5]]);
|
|
647
|
+
}));
|
|
648
|
+
}
|
|
649
|
+
function ve() {
|
|
650
|
+
return c(this, null, /*#__PURE__*/_regenerator().m(function _callee6() {
|
|
651
|
+
var t2, e, n, r, _t4, _t5, _t6;
|
|
652
|
+
return _regenerator().w(function (_context6) {
|
|
653
|
+
while (1) switch (_context6.p = _context6.n) {
|
|
654
|
+
case 0:
|
|
655
|
+
if (!(typeof window == "undefined" || typeof window.hanChromeExt != "function")) {
|
|
656
|
+
_context6.n = 1;
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
return _context6.a(2, "");
|
|
660
|
+
case 1:
|
|
661
|
+
_context6.p = 1;
|
|
662
|
+
t2 = window.hanChromeExt();
|
|
663
|
+
if (t2) {
|
|
664
|
+
_context6.n = 2;
|
|
665
|
+
break;
|
|
666
|
+
}
|
|
667
|
+
return _context6.a(2, "");
|
|
668
|
+
case 2:
|
|
669
|
+
e = function e() {
|
|
670
|
+
return [t2.allMAC || "", t2.MAC || "", t2.macAddress || "", t2.mac || ""];
|
|
671
|
+
}, n = function n(i) {
|
|
672
|
+
return i.some(function (o) {
|
|
673
|
+
return typeof o == "string" && o.trim().length > 0;
|
|
674
|
+
});
|
|
675
|
+
}, r = e();
|
|
676
|
+
if (!n(r)) {
|
|
677
|
+
_context6.n = 3;
|
|
678
|
+
break;
|
|
679
|
+
}
|
|
680
|
+
_t4 = r;
|
|
681
|
+
_context6.n = 7;
|
|
682
|
+
break;
|
|
683
|
+
case 3:
|
|
684
|
+
if (!(typeof t2.getData != "function")) {
|
|
685
|
+
_context6.n = 4;
|
|
686
|
+
break;
|
|
687
|
+
}
|
|
688
|
+
_t5 = "";
|
|
689
|
+
_context6.n = 6;
|
|
690
|
+
break;
|
|
691
|
+
case 4:
|
|
692
|
+
_context6.n = 5;
|
|
693
|
+
return new Promise(function (i) {
|
|
694
|
+
var o = false,
|
|
695
|
+
s = function s() {
|
|
696
|
+
if (o) return;
|
|
697
|
+
o = true;
|
|
698
|
+
var l = e();
|
|
699
|
+
for (var _len = arguments.length, a = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
|
700
|
+
a[_key2] = arguments[_key2];
|
|
701
|
+
}
|
|
702
|
+
i([l, a]);
|
|
703
|
+
};
|
|
704
|
+
setTimeout(s, 3e3);
|
|
705
|
+
try {
|
|
706
|
+
t2.getData(function () {
|
|
707
|
+
return s.apply(void 0, arguments);
|
|
708
|
+
});
|
|
709
|
+
} catch (a) {
|
|
710
|
+
s();
|
|
711
|
+
}
|
|
712
|
+
});
|
|
713
|
+
case 5:
|
|
714
|
+
_t5 = _context6.v;
|
|
715
|
+
case 6:
|
|
716
|
+
_t4 = _t5;
|
|
717
|
+
case 7:
|
|
718
|
+
return _context6.a(2, _t4);
|
|
719
|
+
case 8:
|
|
720
|
+
_context6.p = 8;
|
|
721
|
+
_t6 = _context6.v;
|
|
722
|
+
return _context6.a(2, "");
|
|
723
|
+
}
|
|
724
|
+
}, _callee6, null, [[1, 8]]);
|
|
725
|
+
}));
|
|
726
|
+
}
|
|
727
|
+
function M(t2) {
|
|
728
|
+
return c(this, null, /*#__PURE__*/_regenerator().m(function _callee7() {
|
|
729
|
+
var e, n, r, o, i, _t7, _t8, _t9, _t0, _t1, _t10, _t11;
|
|
730
|
+
return _regenerator().w(function (_context7) {
|
|
731
|
+
while (1) switch (_context7.p = _context7.n) {
|
|
732
|
+
case 0:
|
|
733
|
+
e = [];
|
|
734
|
+
_context7.p = 1;
|
|
735
|
+
t2 != null && t2.macAddresses && e.push(t2.macAddresses);
|
|
736
|
+
_t7 = typeof (t2 == null ? void 0 : t2.getMacAddresses) == "function";
|
|
737
|
+
if (!_t7) {
|
|
738
|
+
_context7.n = 3;
|
|
739
|
+
break;
|
|
740
|
+
}
|
|
741
|
+
_t8 = e;
|
|
742
|
+
_context7.n = 2;
|
|
743
|
+
return le(t2.getMacAddresses, t2);
|
|
744
|
+
case 2:
|
|
745
|
+
_t8.push.call(_t8, _context7.v);
|
|
746
|
+
case 3:
|
|
747
|
+
_context7.n = 5;
|
|
748
|
+
break;
|
|
749
|
+
case 4:
|
|
750
|
+
_context7.p = 4;
|
|
751
|
+
_t9 = _context7.v;
|
|
752
|
+
case 5:
|
|
753
|
+
if (!(typeof window != "undefined")) {
|
|
754
|
+
_context7.n = 10;
|
|
755
|
+
break;
|
|
756
|
+
}
|
|
757
|
+
n = window;
|
|
758
|
+
_context7.n = 6;
|
|
759
|
+
return Ie(n);
|
|
760
|
+
case 6:
|
|
761
|
+
r = _context7.v;
|
|
762
|
+
_t0 = r;
|
|
763
|
+
if (!_t0) {
|
|
764
|
+
_context7.n = 8;
|
|
765
|
+
break;
|
|
766
|
+
}
|
|
767
|
+
_t1 = e;
|
|
768
|
+
_context7.n = 7;
|
|
769
|
+
return Ue(n);
|
|
770
|
+
case 7:
|
|
771
|
+
_t1.push.call(_t1, _context7.v);
|
|
772
|
+
case 8:
|
|
773
|
+
try {
|
|
774
|
+
n.Hanbiro_UsbAuth && typeof n.Hanbiro_UsbAuth.GetAllMacAddress == "function" && e.push(n.Hanbiro_UsbAuth.GetAllMacAddress());
|
|
775
|
+
} catch (o) {}
|
|
776
|
+
try {
|
|
777
|
+
o = n.plugin0 || typeof document != "undefined" && document.getElementById("plugin0");
|
|
778
|
+
o && typeof o.getAllMacAddress == "function" && e.push(o.getAllMacAddress());
|
|
779
|
+
} catch (o) {}
|
|
780
|
+
i = y(e);
|
|
781
|
+
_t10 = !r || i.length === 0;
|
|
782
|
+
if (!_t10) {
|
|
783
|
+
_context7.n = 10;
|
|
784
|
+
break;
|
|
785
|
+
}
|
|
786
|
+
_t11 = e;
|
|
787
|
+
_context7.n = 9;
|
|
788
|
+
return ve();
|
|
789
|
+
case 9:
|
|
790
|
+
_t11.push.call(_t11, _context7.v);
|
|
791
|
+
case 10:
|
|
792
|
+
return _context7.a(2, y(e));
|
|
793
|
+
}
|
|
794
|
+
}, _callee7, null, [[1, 4]]);
|
|
795
|
+
}));
|
|
796
|
+
}
|
|
797
|
+
function D(t2) {
|
|
798
|
+
return c(this, null, /*#__PURE__*/_regenerator().m(function _callee8() {
|
|
799
|
+
var e, n;
|
|
800
|
+
return _regenerator().w(function (_context8) {
|
|
801
|
+
while (1) switch (_context8.n) {
|
|
802
|
+
case 0:
|
|
803
|
+
e = y(t2);
|
|
804
|
+
if (!(e.length === 0)) {
|
|
805
|
+
_context8.n = 1;
|
|
806
|
+
break;
|
|
807
|
+
}
|
|
808
|
+
return _context8.a(2, "");
|
|
809
|
+
case 1:
|
|
810
|
+
n = "hanbiro:client-id:mac:v1:" + e.join(",");
|
|
811
|
+
_context8.n = 2;
|
|
812
|
+
return Ae(n);
|
|
813
|
+
case 2:
|
|
814
|
+
return _context8.a(2, _context8.v);
|
|
815
|
+
}
|
|
816
|
+
}, _callee8);
|
|
817
|
+
}));
|
|
818
|
+
}
|
|
819
|
+
function H() {
|
|
820
|
+
var t2 = m();
|
|
821
|
+
if (!t2 || !t2.getRandomValues) throw new Error("crypto.getRandomValues not supported");
|
|
822
|
+
return k(t2.getRandomValues(new Uint8Array(16)));
|
|
823
|
+
}
|
|
824
|
+
function B(t2) {
|
|
825
|
+
if (typeof document == "undefined") return "";
|
|
826
|
+
var e = document.cookie ? document.cookie.split(";") : [];
|
|
827
|
+
for (var n = 0; n < e.length; n++) {
|
|
828
|
+
var r = e[n].trim();
|
|
829
|
+
if (r.indexOf(t2 + "=") === 0) return r.substring(t2.length + 1);
|
|
830
|
+
}
|
|
831
|
+
return "";
|
|
832
|
+
}
|
|
833
|
+
function Pe(t2) {
|
|
834
|
+
if (t2 < 128) return [t2];
|
|
835
|
+
var e = [];
|
|
836
|
+
for (; t2 > 0;) e.unshift(t2 & 255), t2 >>= 8;
|
|
837
|
+
return e.unshift(128 | e.length), e;
|
|
838
|
+
}
|
|
839
|
+
function Z(t2) {
|
|
840
|
+
var e = 0;
|
|
841
|
+
for (; e < t2.length - 1 && t2[e] === 0;) e++;
|
|
842
|
+
var n = t2.slice(e);
|
|
843
|
+
if ((n[0] & 128) !== 0) {
|
|
844
|
+
var r = new Uint8Array(n.length + 1);
|
|
845
|
+
return r[0] = 0, r.set(n, 1), r;
|
|
846
|
+
}
|
|
847
|
+
return n;
|
|
848
|
+
}
|
|
849
|
+
function J(t2) {
|
|
850
|
+
if (!t2) throw new Error("Invalid signature");
|
|
851
|
+
var e = t2 instanceof Uint8Array ? t2 : new Uint8Array(t2);
|
|
852
|
+
if (e.length !== 64) return e;
|
|
853
|
+
var n = Z(e.slice(0, 32)),
|
|
854
|
+
r = Z(e.slice(32, 64)),
|
|
855
|
+
i = new Uint8Array(2 + n.length);
|
|
856
|
+
i[0] = 2, i[1] = n.length, i.set(n, 2);
|
|
857
|
+
var o = new Uint8Array(2 + r.length);
|
|
858
|
+
o[0] = 2, o[1] = r.length, o.set(r, 2);
|
|
859
|
+
var s = i.length + o.length,
|
|
860
|
+
a = Pe(s),
|
|
861
|
+
l = new Uint8Array(1 + a.length + s);
|
|
862
|
+
return l[0] = 48, l.set(a, 1), l.set(i, 1 + a.length), l.set(o, 1 + a.length + i.length), l;
|
|
863
|
+
}
|
|
864
|
+
var ee = "0123456789ABCDEF";
|
|
865
|
+
function te(t2) {
|
|
866
|
+
return t2 >= 48 && t2 <= 57 ? t2 - 48 : t2 >= 65 && t2 <= 70 ? t2 - 65 + 10 : t2 >= 97 && t2 <= 102 ? t2 - 97 + 10 : -1;
|
|
867
|
+
}
|
|
868
|
+
function _e(t2) {
|
|
869
|
+
return t2 >= 65 && t2 <= 90 || t2 >= 97 && t2 <= 122 || t2 >= 48 && t2 <= 57 || t2 === 45 || t2 === 46 || t2 === 95 || t2 === 126 || t2 === 33 || t2 === 36 || t2 === 39 || t2 === 40 || t2 === 41 || t2 === 42 || t2 === 44 || t2 === 59 || t2 === 58 || t2 === 64 || t2 === 47 || t2 === 63 || t2 === 91 || t2 === 93;
|
|
870
|
+
}
|
|
871
|
+
function ne(t2) {
|
|
872
|
+
var e = String(t2 || ""),
|
|
873
|
+
n = [],
|
|
874
|
+
r = 0;
|
|
875
|
+
for (; r < e.length;) {
|
|
876
|
+
if (e[r] === "%" && r + 2 < e.length) {
|
|
877
|
+
var o = te(e.charCodeAt(r + 1)),
|
|
878
|
+
s = te(e.charCodeAt(r + 2));
|
|
879
|
+
if (o >= 0 && s >= 0) {
|
|
880
|
+
n.push(o << 4 | s), r += 3;
|
|
881
|
+
continue;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
var i = e.codePointAt(r) || 0;
|
|
885
|
+
if (i == 43 && (i = 32), i <= 127) n.push(i);else {
|
|
886
|
+
var _o = C(String.fromCodePoint(i));
|
|
887
|
+
for (var _s = 0; _s < _o.length; _s++) n.push(_o[_s]);
|
|
888
|
+
}
|
|
889
|
+
r += i > 65535 ? 2 : 1;
|
|
890
|
+
}
|
|
891
|
+
return new Uint8Array(n);
|
|
892
|
+
}
|
|
893
|
+
function re(t2) {
|
|
894
|
+
var e = [];
|
|
895
|
+
for (var n = 0; n < t2.length; n++) {
|
|
896
|
+
var r = t2[n];
|
|
897
|
+
_e(r) ? e.push(String.fromCharCode(r)) : e.push("%" + ee[r >> 4 & 15] + ee[r & 15]);
|
|
898
|
+
}
|
|
899
|
+
return e.join("");
|
|
900
|
+
}
|
|
901
|
+
function Ee(t2) {
|
|
902
|
+
var e = String(t2 || "").replace(/^\?/, "");
|
|
903
|
+
if (!e) return "";
|
|
904
|
+
var n = [],
|
|
905
|
+
r = e.split("&");
|
|
906
|
+
for (var i = 0; i < r.length; i++) {
|
|
907
|
+
var o = r[i];
|
|
908
|
+
if (!o) continue;
|
|
909
|
+
var s = o.indexOf("="),
|
|
910
|
+
a = s === -1 ? o : o.slice(0, s),
|
|
911
|
+
l = s === -1 ? "" : o.slice(s + 1),
|
|
912
|
+
d = ne(a),
|
|
913
|
+
u = ne(l),
|
|
914
|
+
p = re(d);
|
|
915
|
+
if (!p) continue;
|
|
916
|
+
var h = re(u),
|
|
917
|
+
ye = u.length > 0;
|
|
918
|
+
n.push({
|
|
919
|
+
k: p,
|
|
920
|
+
v: h,
|
|
921
|
+
hasValue: ye,
|
|
922
|
+
i: i
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
return n.length === 0 ? "" : (n.sort(function (i, o) {
|
|
926
|
+
return i.k < o.k ? -1 : i.k > o.k ? 1 : i.v < o.v ? -1 : i.v > o.v ? 1 : i.i - o.i;
|
|
927
|
+
}), n.map(function (i) {
|
|
928
|
+
return i.hasValue ? "".concat(i.k, "=").concat(i.v) : i.k;
|
|
929
|
+
}).join("&"));
|
|
930
|
+
}
|
|
931
|
+
function T(t2) {
|
|
932
|
+
var e = [String(t2.method || "").toUpperCase(), String(t2.host || "").toLowerCase(), t2.path || "", Ee(t2.query || ""), t2.id || "", String(t2.ts || ""), t2.nonce || ""];
|
|
933
|
+
return typeof t2.gw == "string" && e.push(t2.gw), e.join(".");
|
|
934
|
+
}
|
|
935
|
+
var q = function q(t2) {
|
|
936
|
+
return new Promise(function (e, n) {
|
|
937
|
+
if (typeof indexedDB == "undefined") return n(new Error("IndexedDB not supported"));
|
|
938
|
+
var r = indexedDB.open(t2.idbName, 1);
|
|
939
|
+
r.onupgradeneeded = function () {
|
|
940
|
+
var i = r.result;
|
|
941
|
+
i.objectStoreNames.contains(t2.idbStore) || i.createObjectStore(t2.idbStore);
|
|
942
|
+
}, r.onsuccess = function () {
|
|
943
|
+
return e(r.result);
|
|
944
|
+
}, r.onerror = function () {
|
|
945
|
+
return n(r.error || new Error("idb open failed"));
|
|
946
|
+
};
|
|
947
|
+
});
|
|
948
|
+
},
|
|
949
|
+
ce = function ce(t2, e, n) {
|
|
950
|
+
return new Promise(function (r) {
|
|
951
|
+
try {
|
|
952
|
+
var s = t2.transaction(e.idbStore, "readonly").objectStore(e.idbStore).get(n);
|
|
953
|
+
s.onsuccess = function () {
|
|
954
|
+
return r(s.result || null);
|
|
955
|
+
}, s.onerror = function () {
|
|
956
|
+
return r(null);
|
|
957
|
+
};
|
|
958
|
+
} catch (i) {
|
|
959
|
+
r(null);
|
|
960
|
+
}
|
|
961
|
+
});
|
|
962
|
+
},
|
|
963
|
+
ue = function ue(t2, e, n, r) {
|
|
964
|
+
return new Promise(function (i, o) {
|
|
965
|
+
try {
|
|
966
|
+
var l = t2.transaction(e.idbStore, "readwrite").objectStore(e.idbStore).put(r, n);
|
|
967
|
+
l.onsuccess = function () {
|
|
968
|
+
return i(true);
|
|
969
|
+
}, l.onerror = function () {
|
|
970
|
+
return o(l.error || new Error("idb put failed"));
|
|
971
|
+
};
|
|
972
|
+
} catch (s) {
|
|
973
|
+
o(s);
|
|
974
|
+
}
|
|
975
|
+
});
|
|
976
|
+
},
|
|
977
|
+
ge = function ge(t2, e, n) {
|
|
978
|
+
return new Promise(function (r) {
|
|
979
|
+
try {
|
|
980
|
+
var s = t2.transaction(e.idbStore, "readwrite").objectStore(e.idbStore).delete(n);
|
|
981
|
+
s.onsuccess = function () {
|
|
982
|
+
return r(true);
|
|
983
|
+
}, s.onerror = function () {
|
|
984
|
+
return r(false);
|
|
985
|
+
};
|
|
986
|
+
} catch (i) {
|
|
987
|
+
r(false);
|
|
988
|
+
}
|
|
989
|
+
});
|
|
990
|
+
};
|
|
991
|
+
var R = /*#__PURE__*/function () {
|
|
992
|
+
function R() {
|
|
993
|
+
var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
994
|
+
_classCallCheck(this, R);
|
|
995
|
+
this.prefix = "[HanbiroSigner]";
|
|
996
|
+
this.enabled = e || _("sig_debug") === "true";
|
|
997
|
+
}
|
|
998
|
+
return _createClass(R, [{
|
|
999
|
+
key: "setEnabled",
|
|
1000
|
+
value: function setEnabled(e) {
|
|
1001
|
+
this.enabled = e;
|
|
1002
|
+
}
|
|
1003
|
+
}, {
|
|
1004
|
+
key: "info",
|
|
1005
|
+
value: function info(e) {
|
|
1006
|
+
var _console;
|
|
1007
|
+
for (var _len2 = arguments.length, n = new Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) {
|
|
1008
|
+
n[_key3 - 1] = arguments[_key3];
|
|
1009
|
+
}
|
|
1010
|
+
this.enabled && (_console = console).info.apply(_console, ["%c".concat(this.prefix, " \u2139\uFE0F ").concat(e), "color: #3b82f6; font-weight: bold;"].concat(n));
|
|
1011
|
+
}
|
|
1012
|
+
}, {
|
|
1013
|
+
key: "debug",
|
|
1014
|
+
value: function debug(e) {
|
|
1015
|
+
var _console2;
|
|
1016
|
+
for (var _len3 = arguments.length, n = new Array(_len3 > 1 ? _len3 - 1 : 0), _key4 = 1; _key4 < _len3; _key4++) {
|
|
1017
|
+
n[_key4 - 1] = arguments[_key4];
|
|
1018
|
+
}
|
|
1019
|
+
this.enabled && (_console2 = console).debug.apply(_console2, ["%c".concat(this.prefix, " \uD83D\uDD27 ").concat(e), "color: #8b5cf6;"].concat(n));
|
|
1020
|
+
}
|
|
1021
|
+
}, {
|
|
1022
|
+
key: "warn",
|
|
1023
|
+
value: function warn(e) {
|
|
1024
|
+
var _console3;
|
|
1025
|
+
for (var _len4 = arguments.length, n = new Array(_len4 > 1 ? _len4 - 1 : 0), _key5 = 1; _key5 < _len4; _key5++) {
|
|
1026
|
+
n[_key5 - 1] = arguments[_key5];
|
|
1027
|
+
}
|
|
1028
|
+
this.enabled && (_console3 = console).warn.apply(_console3, ["%c".concat(this.prefix, " \u26A0\uFE0F ").concat(e), "color: #f59e0b; font-weight: bold;"].concat(n));
|
|
1029
|
+
}
|
|
1030
|
+
}, {
|
|
1031
|
+
key: "error",
|
|
1032
|
+
value: function error(e) {
|
|
1033
|
+
var _console4;
|
|
1034
|
+
for (var _len5 = arguments.length, n = new Array(_len5 > 1 ? _len5 - 1 : 0), _key6 = 1; _key6 < _len5; _key6++) {
|
|
1035
|
+
n[_key6 - 1] = arguments[_key6];
|
|
1036
|
+
}
|
|
1037
|
+
this.enabled && (_console4 = console).error.apply(_console4, ["%c".concat(this.prefix, " \u274C ").concat(e), "color: #ef4444; font-weight: bold;"].concat(n));
|
|
1038
|
+
}
|
|
1039
|
+
}, {
|
|
1040
|
+
key: "group",
|
|
1041
|
+
value: function group(e) {
|
|
1042
|
+
this.enabled && console.groupCollapsed("".concat(this.prefix, " ").concat(e));
|
|
1043
|
+
}
|
|
1044
|
+
}, {
|
|
1045
|
+
key: "groupEnd",
|
|
1046
|
+
value: function groupEnd() {
|
|
1047
|
+
this.enabled && console.groupEnd();
|
|
1048
|
+
}
|
|
1049
|
+
}]);
|
|
1050
|
+
}();
|
|
1051
|
+
var F = /*#__PURE__*/function () {
|
|
1052
|
+
function F() {
|
|
1053
|
+
_classCallCheck(this, F);
|
|
1054
|
+
this.name = "iOS";
|
|
1055
|
+
}
|
|
1056
|
+
return _createClass(F, [{
|
|
1057
|
+
key: "callNative",
|
|
1058
|
+
value: function callNative(e, n) {
|
|
1059
|
+
return new Promise(function (r, i) {
|
|
1060
|
+
var l, d;
|
|
1061
|
+
if (!((d = (l = window.webkit) == null ? void 0 : l.messageHandlers) != null && d.observe)) return i(new Error("iOS Bridge (observe) not found"));
|
|
1062
|
+
var o = Math.random().toString(36).substring(2, 9),
|
|
1063
|
+
s = e === "getHybridClientId" ? "GetIOSClientIdCallback".concat(o) : "HanbiroIOSSignCallback".concat(o),
|
|
1064
|
+
a = setTimeout(function () {
|
|
1065
|
+
window[s] && (delete window[s], i(new Error("[HanbiroSigner] Calling iOS Timeout Action: ".concat(e, " | callBack: ").concat(s, " | Time: ").concat(Date.now()))));
|
|
1066
|
+
}, 5e3);
|
|
1067
|
+
window[s] = function (u) {
|
|
1068
|
+
clearTimeout(a), delete window[s], u ? r(u) : i(new Error("iOS returned empty result"));
|
|
1069
|
+
};
|
|
1070
|
+
try {
|
|
1071
|
+
var u = e === "getHybridClientId" ? [e, s].join("_____") : [e, s, n || ""].join("_____");
|
|
1072
|
+
window.webkit.messageHandlers.observe.postMessage(u);
|
|
1073
|
+
} catch (u) {
|
|
1074
|
+
clearTimeout(a), delete window[s], i(u);
|
|
1075
|
+
}
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
}, {
|
|
1079
|
+
key: "getClientId",
|
|
1080
|
+
value: function getClientId() {
|
|
1081
|
+
return this.callNative("getHybridClientId").then(function (e) {
|
|
1082
|
+
return e || null;
|
|
1083
|
+
}).catch(function (e) {
|
|
1084
|
+
return null;
|
|
1085
|
+
});
|
|
1086
|
+
}
|
|
1087
|
+
}, {
|
|
1088
|
+
key: "signECDSA",
|
|
1089
|
+
value: function signECDSA(e) {
|
|
1090
|
+
return this.callNative("hanbiroSignECDSA", e);
|
|
1091
|
+
}
|
|
1092
|
+
}]);
|
|
1093
|
+
}();
|
|
1094
|
+
var N = /*#__PURE__*/function () {
|
|
1095
|
+
function N() {
|
|
1096
|
+
_classCallCheck(this, N);
|
|
1097
|
+
this.name = "Flutter";
|
|
1098
|
+
}
|
|
1099
|
+
return _createClass(N, [{
|
|
1100
|
+
key: "callNative",
|
|
1101
|
+
value: function callNative(e, n) {
|
|
1102
|
+
return new Promise(function (r, i) {
|
|
1103
|
+
if (!window.FlutterSignatureChannel) return i(new Error("Flutter Bridge not found"));
|
|
1104
|
+
var o = Math.random().toString(36).substring(2, 9),
|
|
1105
|
+
s = e === "getHybridClientId" ? "GetFlutterClientIdCallback".concat(o) : "HanbiroFlutterSignCallback".concat(o),
|
|
1106
|
+
a = setTimeout(function () {
|
|
1107
|
+
window[s] && (delete window[s], i(new Error("[HanbiroSigner] Calling Flutter Timeout Action: ".concat(e, " | callBack: ").concat(s, " | Time: ").concat(Date.now()))));
|
|
1108
|
+
}, 5e3);
|
|
1109
|
+
window[s] = function (l) {
|
|
1110
|
+
clearTimeout(a), delete window[s], l ? r(l) : i(new Error("Flutter returned empty result"));
|
|
1111
|
+
};
|
|
1112
|
+
try {
|
|
1113
|
+
var d = JSON.stringify({
|
|
1114
|
+
action: e,
|
|
1115
|
+
callback_method: s,
|
|
1116
|
+
payload: n || ""
|
|
1117
|
+
});
|
|
1118
|
+
window.FlutterSignatureChannel.postMessage(d);
|
|
1119
|
+
} catch (l) {
|
|
1120
|
+
clearTimeout(a), delete window[s], i(l);
|
|
1121
|
+
}
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
}, {
|
|
1125
|
+
key: "getClientId",
|
|
1126
|
+
value: function getClientId() {
|
|
1127
|
+
return this.callNative("getHybridClientId").then(function (e) {
|
|
1128
|
+
return e || null;
|
|
1129
|
+
}).catch(function (e) {
|
|
1130
|
+
return null;
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
}, {
|
|
1134
|
+
key: "signECDSA",
|
|
1135
|
+
value: function signECDSA(e) {
|
|
1136
|
+
return this.callNative("hanbiroSignECDSA", e);
|
|
1137
|
+
}
|
|
1138
|
+
}]);
|
|
1139
|
+
}();
|
|
1140
|
+
var G = /*#__PURE__*/function () {
|
|
1141
|
+
function G() {
|
|
1142
|
+
_classCallCheck(this, G);
|
|
1143
|
+
this.name = "Android";
|
|
1144
|
+
}
|
|
1145
|
+
return _createClass(G, [{
|
|
1146
|
+
key: "getClientId",
|
|
1147
|
+
value: function getClientId() {
|
|
1148
|
+
if (window.JSInterface && typeof window.JSInterface.getHybridClientId == "function") {
|
|
1149
|
+
var e = window.JSInterface.getHybridClientId();
|
|
1150
|
+
return Promise.resolve(e || null);
|
|
1151
|
+
}
|
|
1152
|
+
return Promise.resolve(null);
|
|
1153
|
+
}
|
|
1154
|
+
}, {
|
|
1155
|
+
key: "signECDSA",
|
|
1156
|
+
value: function signECDSA(e) {
|
|
1157
|
+
if (window.JSInterface && typeof window.JSInterface.hanbiroSignECDSA == "function") try {
|
|
1158
|
+
var n = window.JSInterface.hanbiroSignECDSA(e);
|
|
1159
|
+
return Promise.resolve(n);
|
|
1160
|
+
} catch (n) {
|
|
1161
|
+
return Promise.reject(n);
|
|
1162
|
+
}
|
|
1163
|
+
return Promise.reject(new Error("Android JSInterface.hanbiroSignECDSA is missing"));
|
|
1164
|
+
}
|
|
1165
|
+
}]);
|
|
1166
|
+
}();
|
|
1167
|
+
var A = "__hanbiroSessionStatusCache",
|
|
1168
|
+
He = "sig_client_uuid",
|
|
1169
|
+
I = null;
|
|
1170
|
+
function K(t2) {
|
|
1171
|
+
if (typeof document == "undefined") return null;
|
|
1172
|
+
var e = document.cookie.match(new RegExp("(?:^|; )".concat(t2, "=([^;]*)")));
|
|
1173
|
+
return e ? decodeURIComponent(e[1]) : null;
|
|
1174
|
+
}
|
|
1175
|
+
function pe(t2) {
|
|
1176
|
+
var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "POST";
|
|
1177
|
+
return c(this, null, /*#__PURE__*/_regenerator().m(function _callee9() {
|
|
1178
|
+
var n, r, _t12;
|
|
1179
|
+
return _regenerator().w(function (_context9) {
|
|
1180
|
+
while (1) switch (_context9.p = _context9.n) {
|
|
1181
|
+
case 0:
|
|
1182
|
+
if (!(typeof window == "undefined")) {
|
|
1183
|
+
_context9.n = 1;
|
|
1184
|
+
break;
|
|
1185
|
+
}
|
|
1186
|
+
return _context9.a(2, {});
|
|
1187
|
+
case 1:
|
|
1188
|
+
n = window.HanSigCommon;
|
|
1189
|
+
if (!(!n || typeof n.generateHeaders != "function")) {
|
|
1190
|
+
_context9.n = 2;
|
|
1191
|
+
break;
|
|
1192
|
+
}
|
|
1193
|
+
return _context9.a(2, {});
|
|
1194
|
+
case 2:
|
|
1195
|
+
_context9.p = 2;
|
|
1196
|
+
_context9.n = 3;
|
|
1197
|
+
return n.generateHeaders({
|
|
1198
|
+
method: e,
|
|
1199
|
+
url: t2
|
|
1200
|
+
});
|
|
1201
|
+
case 3:
|
|
1202
|
+
r = _context9.v;
|
|
1203
|
+
return _context9.a(2, r && _typeof(r) == "object" ? r : {});
|
|
1204
|
+
case 4:
|
|
1205
|
+
_context9.p = 4;
|
|
1206
|
+
_t12 = _context9.v;
|
|
1207
|
+
return _context9.a(2, {});
|
|
1208
|
+
}
|
|
1209
|
+
}, _callee9, null, [[2, 4]]);
|
|
1210
|
+
}));
|
|
1211
|
+
}
|
|
1212
|
+
function Be() {
|
|
1213
|
+
if (typeof window == "undefined" || typeof localStorage == "undefined") return {};
|
|
1214
|
+
try {
|
|
1215
|
+
var _t13 = localStorage.getItem(He);
|
|
1216
|
+
return _t13 ? {
|
|
1217
|
+
"X-Sig-Id": _t13
|
|
1218
|
+
} : {};
|
|
1219
|
+
} catch (t2) {
|
|
1220
|
+
return {};
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
function g() {
|
|
1224
|
+
if (typeof window == "undefined") return {
|
|
1225
|
+
checked: false,
|
|
1226
|
+
logged: false,
|
|
1227
|
+
sessionVersion: null
|
|
1228
|
+
};
|
|
1229
|
+
if (window !== window.parent) try {
|
|
1230
|
+
if (window.parent && window.parent[A]) return window.parent[A];
|
|
1231
|
+
} catch (e) {}
|
|
1232
|
+
var t2 = window;
|
|
1233
|
+
return t2[A] || (t2[A] = {
|
|
1234
|
+
checked: false,
|
|
1235
|
+
logged: false,
|
|
1236
|
+
sessionVersion: K("GWV")
|
|
1237
|
+
}), t2[A];
|
|
1238
|
+
}
|
|
1239
|
+
function O() {
|
|
1240
|
+
var t2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
1241
|
+
var e = arguments.length > 1 ? arguments[1] : undefined;
|
|
1242
|
+
var o, s;
|
|
1243
|
+
if (e) {
|
|
1244
|
+
var a = e.replace(/\/+$/, "");
|
|
1245
|
+
return t2 ? "".concat(a, "/").concat(t2) : a;
|
|
1246
|
+
}
|
|
1247
|
+
if (typeof window == "undefined") return t2;
|
|
1248
|
+
var n = window.location,
|
|
1249
|
+
_n = n,
|
|
1250
|
+
r = _n.hostname,
|
|
1251
|
+
i = "";
|
|
1252
|
+
if (r === "localhost" || r === "127.0.0.1") {
|
|
1253
|
+
var _a4 = window;
|
|
1254
|
+
i = ((o = _a4.baseConfig) == null ? void 0 : o.apiFrontUrl) || ((s = _a4.baseConfig) == null ? void 0 : s.apiUrl), i || (i = window.location.protocol + "//vndev.hanbiro.com/ngw");
|
|
1255
|
+
} else {
|
|
1256
|
+
if (window.location !== window.parent.location) try {
|
|
1257
|
+
n = window.parent.location;
|
|
1258
|
+
} catch (u) {
|
|
1259
|
+
n = window.location;
|
|
1260
|
+
}
|
|
1261
|
+
var _n2 = n,
|
|
1262
|
+
_a5 = _n2.hostname,
|
|
1263
|
+
l = _n2.protocol;
|
|
1264
|
+
i = [l, "//", _a5, "/ngw"].join("");
|
|
1265
|
+
}
|
|
1266
|
+
if (t2 !== "") {
|
|
1267
|
+
var _a6 = i.replace(/\/+$/, ""),
|
|
1268
|
+
_l = t2.replace(/^\/+/, "");
|
|
1269
|
+
return "".concat(_a6, "/").concat(_l);
|
|
1270
|
+
}
|
|
1271
|
+
return i;
|
|
1272
|
+
}
|
|
1273
|
+
function he(t2) {
|
|
1274
|
+
var e = g();
|
|
1275
|
+
if (typeof window == "undefined" || typeof XMLHttpRequest == "undefined") return false;
|
|
1276
|
+
var n = O("sign/session_status", t2);
|
|
1277
|
+
try {
|
|
1278
|
+
var r = new XMLHttpRequest();
|
|
1279
|
+
r.open("POST", n, false), r.setRequestHeader("Content-Type", "application/json");
|
|
1280
|
+
var i = Be();
|
|
1281
|
+
if (Object.keys(i).forEach(function (o) {
|
|
1282
|
+
r.setRequestHeader(o, i[o]);
|
|
1283
|
+
}), r.withCredentials = true, r.send(), r.status === 200) try {
|
|
1284
|
+
var o = JSON.parse(r.responseText);
|
|
1285
|
+
e.logged = !!(o && o.success);
|
|
1286
|
+
} catch (o) {
|
|
1287
|
+
e.logged = false;
|
|
1288
|
+
} else r.status === 404 ? e.logged = true : e.logged = false;
|
|
1289
|
+
} catch (r) {
|
|
1290
|
+
e.logged = false;
|
|
1291
|
+
}
|
|
1292
|
+
return e.checked = true, e.logged;
|
|
1293
|
+
}
|
|
1294
|
+
function Te(t2) {
|
|
1295
|
+
return c(this, null, /*#__PURE__*/_regenerator().m(function _callee0() {
|
|
1296
|
+
var e, n, r, i, o, _t14;
|
|
1297
|
+
return _regenerator().w(function (_context0) {
|
|
1298
|
+
while (1) switch (_context0.p = _context0.n) {
|
|
1299
|
+
case 0:
|
|
1300
|
+
e = g();
|
|
1301
|
+
if (!(typeof window == "undefined" || typeof fetch != "function")) {
|
|
1302
|
+
_context0.n = 1;
|
|
1303
|
+
break;
|
|
1304
|
+
}
|
|
1305
|
+
return _context0.a(2, he(t2));
|
|
1306
|
+
case 1:
|
|
1307
|
+
n = O("sign/session_status", t2);
|
|
1308
|
+
_context0.p = 2;
|
|
1309
|
+
_context0.n = 3;
|
|
1310
|
+
return pe(n, "POST");
|
|
1311
|
+
case 3:
|
|
1312
|
+
r = _context0.v;
|
|
1313
|
+
_context0.n = 4;
|
|
1314
|
+
return fetch(n, {
|
|
1315
|
+
method: "POST",
|
|
1316
|
+
headers: f({
|
|
1317
|
+
"Content-Type": "application/json"
|
|
1318
|
+
}, r),
|
|
1319
|
+
credentials: "include"
|
|
1320
|
+
});
|
|
1321
|
+
case 4:
|
|
1322
|
+
i = _context0.v;
|
|
1323
|
+
if (!i.ok) {
|
|
1324
|
+
_context0.n = 6;
|
|
1325
|
+
break;
|
|
1326
|
+
}
|
|
1327
|
+
_context0.n = 5;
|
|
1328
|
+
return i.json();
|
|
1329
|
+
case 5:
|
|
1330
|
+
o = _context0.v;
|
|
1331
|
+
e.logged = !!(o && o.success);
|
|
1332
|
+
_context0.n = 7;
|
|
1333
|
+
break;
|
|
1334
|
+
case 6:
|
|
1335
|
+
i.status === 404 ? e.logged = true : e.logged = false;
|
|
1336
|
+
case 7:
|
|
1337
|
+
_context0.n = 9;
|
|
1338
|
+
break;
|
|
1339
|
+
case 8:
|
|
1340
|
+
_context0.p = 8;
|
|
1341
|
+
_t14 = _context0.v;
|
|
1342
|
+
e.logged = false;
|
|
1343
|
+
case 9:
|
|
1344
|
+
return _context0.a(2, (e.checked = true, e.logged));
|
|
1345
|
+
}
|
|
1346
|
+
}, _callee0, null, [[2, 8]]);
|
|
1347
|
+
}));
|
|
1348
|
+
}
|
|
1349
|
+
var L = {
|
|
1350
|
+
get: function get(t2, e) {
|
|
1351
|
+
return c(null, null, /*#__PURE__*/_regenerator().m(function _callee1() {
|
|
1352
|
+
var n;
|
|
1353
|
+
return _regenerator().w(function (_context1) {
|
|
1354
|
+
while (1) switch (_context1.n) {
|
|
1355
|
+
case 0:
|
|
1356
|
+
n = g();
|
|
1357
|
+
return _context1.a(2, !t2 && n.checked && n.logged !== null ? n.logged : (!t2 && I || (I = Te(e).finally(function () {
|
|
1358
|
+
I = null;
|
|
1359
|
+
})), I));
|
|
1360
|
+
}
|
|
1361
|
+
}, _callee1);
|
|
1362
|
+
}));
|
|
1363
|
+
},
|
|
1364
|
+
getSync: function getSync(t2, e) {
|
|
1365
|
+
var n = g();
|
|
1366
|
+
return t2 || !n.checked ? he(e) : n.logged;
|
|
1367
|
+
},
|
|
1368
|
+
verifySessionVersion: function verifySessionVersion(t2) {
|
|
1369
|
+
return c(null, null, /*#__PURE__*/_regenerator().m(function _callee10() {
|
|
1370
|
+
var e, n, r, i, o, s, a, _t15;
|
|
1371
|
+
return _regenerator().w(function (_context10) {
|
|
1372
|
+
while (1) switch (_context10.p = _context10.n) {
|
|
1373
|
+
case 0:
|
|
1374
|
+
e = K("GWV"), n = g(), r = n.sessionVersion;
|
|
1375
|
+
if (!(e === r)) {
|
|
1376
|
+
_context10.n = 1;
|
|
1377
|
+
break;
|
|
1378
|
+
}
|
|
1379
|
+
return _context10.a(2, true);
|
|
1380
|
+
case 1:
|
|
1381
|
+
if (r) {
|
|
1382
|
+
_context10.n = 2;
|
|
1383
|
+
break;
|
|
1384
|
+
}
|
|
1385
|
+
return _context10.a(2, (n.sessionVersion = e, true));
|
|
1386
|
+
case 2:
|
|
1387
|
+
_context10.p = 2;
|
|
1388
|
+
i = O("sign/check_cookie", t2);
|
|
1389
|
+
_context10.n = 3;
|
|
1390
|
+
return pe(i, "POST");
|
|
1391
|
+
case 3:
|
|
1392
|
+
o = _context10.v;
|
|
1393
|
+
_context10.n = 4;
|
|
1394
|
+
return fetch(i, {
|
|
1395
|
+
method: "POST",
|
|
1396
|
+
headers: f({
|
|
1397
|
+
"Content-Type": "application/json"
|
|
1398
|
+
}, o),
|
|
1399
|
+
body: JSON.stringify({
|
|
1400
|
+
v: r
|
|
1401
|
+
}),
|
|
1402
|
+
credentials: "include"
|
|
1403
|
+
});
|
|
1404
|
+
case 4:
|
|
1405
|
+
s = _context10.v;
|
|
1406
|
+
if (!s.ok) {
|
|
1407
|
+
_context10.n = 6;
|
|
1408
|
+
break;
|
|
1409
|
+
}
|
|
1410
|
+
_context10.n = 5;
|
|
1411
|
+
return s.json();
|
|
1412
|
+
case 5:
|
|
1413
|
+
a = _context10.v;
|
|
1414
|
+
return _context10.a(2, !!(a && a.success));
|
|
1415
|
+
case 6:
|
|
1416
|
+
return _context10.a(2, s.status === 404);
|
|
1417
|
+
case 7:
|
|
1418
|
+
_context10.p = 7;
|
|
1419
|
+
_t15 = _context10.v;
|
|
1420
|
+
return _context10.a(2, false);
|
|
1421
|
+
case 8:
|
|
1422
|
+
_context10.p = 8;
|
|
1423
|
+
n.sessionVersion = K("GWV");
|
|
1424
|
+
return _context10.f(8);
|
|
1425
|
+
case 9:
|
|
1426
|
+
return _context10.a(2);
|
|
1427
|
+
}
|
|
1428
|
+
}, _callee10, null, [[2, 7, 8, 9]]);
|
|
1429
|
+
}));
|
|
1430
|
+
},
|
|
1431
|
+
syncSessionVersion: function syncSessionVersion() {
|
|
1432
|
+
var t2 = g();
|
|
1433
|
+
return t2.sessionVersion = K("GWV"), t2.sessionVersion;
|
|
1434
|
+
},
|
|
1435
|
+
clearSessionVersion: function clearSessionVersion() {
|
|
1436
|
+
var t2 = g();
|
|
1437
|
+
t2.sessionVersion = null;
|
|
1438
|
+
},
|
|
1439
|
+
setCache: function setCache(t2) {
|
|
1440
|
+
var e = g();
|
|
1441
|
+
return e.checked = true, e.logged = !!t2, e.logged;
|
|
1442
|
+
},
|
|
1443
|
+
clearCache: function clearCache() {
|
|
1444
|
+
var t2 = g();
|
|
1445
|
+
return t2.checked = false, t2.logged = false, t2.logged;
|
|
1446
|
+
},
|
|
1447
|
+
recheckUnauthorized: function recheckUnauthorized(t2) {
|
|
1448
|
+
return L.getSync(true, t2);
|
|
1449
|
+
}
|
|
1450
|
+
};
|
|
1451
|
+
var $ = /*#__PURE__*/function (_Error) {
|
|
1452
|
+
function $(n, r) {
|
|
1453
|
+
var _this;
|
|
1454
|
+
_classCallCheck(this, $);
|
|
1455
|
+
_this = _callSuper(this, $, [r || "Registration conflict: key already registered"]);
|
|
1456
|
+
_this.status = 409;
|
|
1457
|
+
_this.name = "RegistrationConflictError", _this.clientId = n;
|
|
1458
|
+
return _this;
|
|
1459
|
+
}
|
|
1460
|
+
_inherits($, _Error);
|
|
1461
|
+
return _createClass($);
|
|
1462
|
+
}(/*#__PURE__*/_wrapNativeSuper(Error)),
|
|
1463
|
+
Re = function Re(t2, e, n, r, i) {
|
|
1464
|
+
return c(null, null, /*#__PURE__*/_regenerator().m(function _callee11() {
|
|
1465
|
+
var o, s, a;
|
|
1466
|
+
return _regenerator().w(function (_context11) {
|
|
1467
|
+
while (1) switch (_context11.n) {
|
|
1468
|
+
case 0:
|
|
1469
|
+
o = t2.registerUrlTpl.replace("{id}", encodeURIComponent(e));
|
|
1470
|
+
if (!((location.hostname === "localhost" || location.hostname === "127.0.0.1") && (o = "".concat(new URL(t2.baseUrl).origin).concat(o)), r.debug("Registering Public Key...", {
|
|
1471
|
+
url: o,
|
|
1472
|
+
id: e,
|
|
1473
|
+
hasRefreshToken: false
|
|
1474
|
+
}), typeof fetch != "function")) {
|
|
1475
|
+
_context11.n = 1;
|
|
1476
|
+
break;
|
|
1477
|
+
}
|
|
1478
|
+
throw new Error("fetch not supported; provide registerPublicKey override");
|
|
1479
|
+
case 1:
|
|
1480
|
+
_context11.n = 2;
|
|
1481
|
+
return fetch(o, {
|
|
1482
|
+
method: "POST",
|
|
1483
|
+
headers: {
|
|
1484
|
+
"Content-Type": "application/json"
|
|
1485
|
+
},
|
|
1486
|
+
body: JSON.stringify(n),
|
|
1487
|
+
credentials: "include"
|
|
1488
|
+
});
|
|
1489
|
+
case 2:
|
|
1490
|
+
s = _context11.v;
|
|
1491
|
+
if (s.ok) {
|
|
1492
|
+
_context11.n = 4;
|
|
1493
|
+
break;
|
|
1494
|
+
}
|
|
1495
|
+
_context11.n = 3;
|
|
1496
|
+
return s.text().catch(function () {
|
|
1497
|
+
return "";
|
|
1498
|
+
});
|
|
1499
|
+
case 3:
|
|
1500
|
+
a = _context11.v;
|
|
1501
|
+
throw r.error("Registration failed response", {
|
|
1502
|
+
status: s.status,
|
|
1503
|
+
body: a
|
|
1504
|
+
}), s.status === 409 ? new $(e, a) : new Error("sig register failed: " + s.status + " " + a);
|
|
1505
|
+
case 4:
|
|
1506
|
+
return _context11.a(2, true);
|
|
1507
|
+
}
|
|
1508
|
+
}, _callee11);
|
|
1509
|
+
}));
|
|
1510
|
+
},
|
|
1511
|
+
W = /*#__PURE__*/function () {
|
|
1512
|
+
function W(e) {
|
|
1513
|
+
var _this2 = this;
|
|
1514
|
+
_classCallCheck(this, W);
|
|
1515
|
+
this._identityPromise = null;
|
|
1516
|
+
this._registerOncePromise = null;
|
|
1517
|
+
this._browserSupported = true;
|
|
1518
|
+
this._enabled = true;
|
|
1519
|
+
this._useGwCookie = true;
|
|
1520
|
+
this.nativeAdapter = null;
|
|
1521
|
+
this._createClientId = function (e2) {
|
|
1522
|
+
return c(_this2, null, /*#__PURE__*/_regenerator().m(function _callee12() {
|
|
1523
|
+
var r, i, n, _t16;
|
|
1524
|
+
return _regenerator().w(function (_context12) {
|
|
1525
|
+
while (1) switch (_context12.p = _context12.n) {
|
|
1526
|
+
case 0:
|
|
1527
|
+
_context12.p = 0;
|
|
1528
|
+
this.logger.info("[MAC] Creating Client ID. Trying MAC-based UUID first.");
|
|
1529
|
+
_context12.n = 1;
|
|
1530
|
+
return M(e2);
|
|
1531
|
+
case 1:
|
|
1532
|
+
r = _context12.v;
|
|
1533
|
+
_context12.n = 2;
|
|
1534
|
+
return D(r);
|
|
1535
|
+
case 2:
|
|
1536
|
+
i = _context12.v;
|
|
1537
|
+
if (!i) {
|
|
1538
|
+
_context12.n = 3;
|
|
1539
|
+
break;
|
|
1540
|
+
}
|
|
1541
|
+
return _context12.a(2, (this.logger.info("[MAC] Using MAC-based Client ID.", {
|
|
1542
|
+
macAddresses: r,
|
|
1543
|
+
clientId: i
|
|
1544
|
+
}), this.logger.info("Generated MAC-based Client ID."), this.logger.debug("MAC addresses used for Client ID:", r), i));
|
|
1545
|
+
case 3:
|
|
1546
|
+
_context12.n = 5;
|
|
1547
|
+
break;
|
|
1548
|
+
case 4:
|
|
1549
|
+
_context12.p = 4;
|
|
1550
|
+
_t16 = _context12.v;
|
|
1551
|
+
this.logger.warn("[MAC] MAC-based Client ID generation failed.", _t16), this.logger.warn("Failed to generate MAC-based Client ID", _t16);
|
|
1552
|
+
case 5:
|
|
1553
|
+
n = x();
|
|
1554
|
+
return _context12.a(2, (this.logger.warn("[MAC] Using random Client ID fallback.", n), n));
|
|
1555
|
+
}
|
|
1556
|
+
}, _callee12, this, [[0, 4]]);
|
|
1557
|
+
}));
|
|
1558
|
+
};
|
|
1559
|
+
this._ensureStoredClientIdAsync = function (e2) {
|
|
1560
|
+
return c(_this2, null, /*#__PURE__*/_regenerator().m(function _callee13() {
|
|
1561
|
+
var n, r;
|
|
1562
|
+
return _regenerator().w(function (_context13) {
|
|
1563
|
+
while (1) switch (_context13.n) {
|
|
1564
|
+
case 0:
|
|
1565
|
+
n = this._merge(e2), r = S(n);
|
|
1566
|
+
if (!r) {
|
|
1567
|
+
_context13.n = 1;
|
|
1568
|
+
break;
|
|
1569
|
+
}
|
|
1570
|
+
this.logger.info("[MAC] Using stored Client ID.", {
|
|
1571
|
+
key: n.lsIdKey,
|
|
1572
|
+
clientId: r
|
|
1573
|
+
});
|
|
1574
|
+
_context13.n = 3;
|
|
1575
|
+
break;
|
|
1576
|
+
case 1:
|
|
1577
|
+
_context13.n = 2;
|
|
1578
|
+
return this._createClientId(n);
|
|
1579
|
+
case 2:
|
|
1580
|
+
r = _context13.v;
|
|
1581
|
+
E(n, r);
|
|
1582
|
+
this.logger.info("[MAC] Stored new Client ID.", {
|
|
1583
|
+
key: n.lsIdKey,
|
|
1584
|
+
clientId: r
|
|
1585
|
+
});
|
|
1586
|
+
case 3:
|
|
1587
|
+
return _context13.a(2, r);
|
|
1588
|
+
}
|
|
1589
|
+
}, _callee13, this);
|
|
1590
|
+
}));
|
|
1591
|
+
};
|
|
1592
|
+
this._resolveClientIdForHeader = function (e2) {
|
|
1593
|
+
return c(_this2, null, /*#__PURE__*/_regenerator().m(function _callee14() {
|
|
1594
|
+
var n, r, _t17;
|
|
1595
|
+
return _regenerator().w(function (_context14) {
|
|
1596
|
+
while (1) switch (_context14.p = _context14.n) {
|
|
1597
|
+
case 0:
|
|
1598
|
+
n = this._merge(e2);
|
|
1599
|
+
if (!(this.nativeAdapter || this.detectHybridEnvironment(), this.nativeAdapter)) {
|
|
1600
|
+
_context14.n = 5;
|
|
1601
|
+
break;
|
|
1602
|
+
}
|
|
1603
|
+
_context14.p = 1;
|
|
1604
|
+
_context14.n = 2;
|
|
1605
|
+
return this.nativeAdapter.getClientId();
|
|
1606
|
+
case 2:
|
|
1607
|
+
r = _context14.v;
|
|
1608
|
+
if (!r) {
|
|
1609
|
+
_context14.n = 3;
|
|
1610
|
+
break;
|
|
1611
|
+
}
|
|
1612
|
+
return _context14.a(2, r);
|
|
1613
|
+
case 3:
|
|
1614
|
+
_context14.n = 5;
|
|
1615
|
+
break;
|
|
1616
|
+
case 4:
|
|
1617
|
+
_context14.p = 4;
|
|
1618
|
+
_t17 = _context14.v;
|
|
1619
|
+
this.logger.warn("Failed to get Hybrid Client ID for id-only header", _t17);
|
|
1620
|
+
case 5:
|
|
1621
|
+
return _context14.a(2, this._ensureStoredClientIdAsync(n));
|
|
1622
|
+
}
|
|
1623
|
+
}, _callee14, this, [[1, 4]]);
|
|
1624
|
+
}));
|
|
1625
|
+
};
|
|
1626
|
+
this.isEnabled = function () {
|
|
1627
|
+
return _this2._enabled;
|
|
1628
|
+
};
|
|
1629
|
+
this.isBrowserSupported = function () {
|
|
1630
|
+
return _this2._browserSupported;
|
|
1631
|
+
};
|
|
1632
|
+
this._merge = function (e2) {
|
|
1633
|
+
return typeof (e2 == null ? void 0 : e2.debug) != "undefined" && _this2.logger.setEnabled(e2.debug), ie(f(f({}, _this2.defaults), e2));
|
|
1634
|
+
};
|
|
1635
|
+
this.getCookieRaw = function (e2) {
|
|
1636
|
+
return B(e2);
|
|
1637
|
+
};
|
|
1638
|
+
this.hasIdentitySync = function (e2) {
|
|
1639
|
+
var n = _this2._merge(e2);
|
|
1640
|
+
return !!S(n);
|
|
1641
|
+
};
|
|
1642
|
+
this.clearPrivateKey = function (e2) {
|
|
1643
|
+
return c(_this2, null, /*#__PURE__*/_regenerator().m(function _callee15() {
|
|
1644
|
+
var n, r, _t18;
|
|
1645
|
+
return _regenerator().w(function (_context15) {
|
|
1646
|
+
while (1) switch (_context15.p = _context15.n) {
|
|
1647
|
+
case 0:
|
|
1648
|
+
n = this._merge(e2);
|
|
1649
|
+
this.logger.info("Clearing Private Key..."), this._identityPromise = null;
|
|
1650
|
+
_context15.p = 1;
|
|
1651
|
+
_context15.n = 2;
|
|
1652
|
+
return q(n);
|
|
1653
|
+
case 2:
|
|
1654
|
+
r = _context15.v;
|
|
1655
|
+
_context15.p = 3;
|
|
1656
|
+
_context15.n = 4;
|
|
1657
|
+
return ge(r, n, n.idbPrivKey);
|
|
1658
|
+
case 4:
|
|
1659
|
+
return _context15.a(2, true);
|
|
1660
|
+
case 5:
|
|
1661
|
+
_context15.p = 5;
|
|
1662
|
+
r.close();
|
|
1663
|
+
return _context15.f(5);
|
|
1664
|
+
case 6:
|
|
1665
|
+
_context15.n = 8;
|
|
1666
|
+
break;
|
|
1667
|
+
case 7:
|
|
1668
|
+
_context15.p = 7;
|
|
1669
|
+
_t18 = _context15.v;
|
|
1670
|
+
return _context15.a(2, false);
|
|
1671
|
+
case 8:
|
|
1672
|
+
return _context15.a(2);
|
|
1673
|
+
}
|
|
1674
|
+
}, _callee15, this, [[3,, 5, 6], [1, 7]]);
|
|
1675
|
+
}));
|
|
1676
|
+
};
|
|
1677
|
+
this.clearStoredClientId = function (e2) {
|
|
1678
|
+
se(_this2._merge(e2));
|
|
1679
|
+
};
|
|
1680
|
+
this.getOrCreateIdentity = function (e2) {
|
|
1681
|
+
if (!_this2._enabled) return Promise.resolve({
|
|
1682
|
+
id: "",
|
|
1683
|
+
privateKey: null
|
|
1684
|
+
});
|
|
1685
|
+
var n = _this2._merge(e2);
|
|
1686
|
+
return _this2._identityPromise ? _this2._identityPromise : (_this2._identityPromise = c(_this2, null, /*#__PURE__*/_regenerator().m(function _callee16() {
|
|
1687
|
+
var r, i, o, s, a, l, d, u, p, h, _t19, _t20;
|
|
1688
|
+
return _regenerator().w(function (_context16) {
|
|
1689
|
+
while (1) switch (_context16.p = _context16.n) {
|
|
1690
|
+
case 0:
|
|
1691
|
+
this.logger.group("getOrCreateIdentity");
|
|
1692
|
+
_context16.p = 1;
|
|
1693
|
+
if (this._browserSupported) {
|
|
1694
|
+
_context16.n = 2;
|
|
1695
|
+
break;
|
|
1696
|
+
}
|
|
1697
|
+
throw new Error("Browser not supported: missing required features");
|
|
1698
|
+
case 2:
|
|
1699
|
+
r = m(), i = b();
|
|
1700
|
+
if (!(!r || !i)) {
|
|
1701
|
+
_context16.n = 3;
|
|
1702
|
+
break;
|
|
1703
|
+
}
|
|
1704
|
+
throw new Error("WebCrypto(crypto.subtle) not supported");
|
|
1705
|
+
case 3:
|
|
1706
|
+
if (!(typeof indexedDB == "undefined")) {
|
|
1707
|
+
_context16.n = 4;
|
|
1708
|
+
break;
|
|
1709
|
+
}
|
|
1710
|
+
throw new Error("IndexedDB not supported");
|
|
1711
|
+
case 4:
|
|
1712
|
+
o = S(n);
|
|
1713
|
+
this.logger.debug("Stored Client ID:", o);
|
|
1714
|
+
_context16.n = 5;
|
|
1715
|
+
return q(n);
|
|
1716
|
+
case 5:
|
|
1717
|
+
s = _context16.v;
|
|
1718
|
+
_context16.p = 6;
|
|
1719
|
+
_context16.n = 7;
|
|
1720
|
+
return ce(s, n, n.idbPrivKey);
|
|
1721
|
+
case 7:
|
|
1722
|
+
a = _context16.v;
|
|
1723
|
+
if (!(o && a)) {
|
|
1724
|
+
_context16.n = 8;
|
|
1725
|
+
break;
|
|
1726
|
+
}
|
|
1727
|
+
return _context16.a(2, (this.logger.info("Identity found in storage."), {
|
|
1728
|
+
id: o,
|
|
1729
|
+
privateKey: a
|
|
1730
|
+
}));
|
|
1731
|
+
case 8:
|
|
1732
|
+
this.logger.info("Identity missing. Generating new...");
|
|
1733
|
+
l = o;
|
|
1734
|
+
_t19 = l;
|
|
1735
|
+
if (_t19) {
|
|
1736
|
+
_context16.n = 10;
|
|
1737
|
+
break;
|
|
1738
|
+
}
|
|
1739
|
+
_context16.n = 9;
|
|
1740
|
+
return this._createClientId(n);
|
|
1741
|
+
case 9:
|
|
1742
|
+
l = _context16.v;
|
|
1743
|
+
E(n, l);
|
|
1744
|
+
this.logger.debug("Generated new Client ID:", l);
|
|
1745
|
+
case 10:
|
|
1746
|
+
_context16.n = 11;
|
|
1747
|
+
return i.generateKey({
|
|
1748
|
+
name: "ECDSA",
|
|
1749
|
+
namedCurve: "P-256"
|
|
1750
|
+
}, true, ["sign", "verify"]);
|
|
1751
|
+
case 11:
|
|
1752
|
+
d = _context16.v;
|
|
1753
|
+
_context16.n = 12;
|
|
1754
|
+
return i.exportKey("jwk", d.publicKey);
|
|
1755
|
+
case 12:
|
|
1756
|
+
u = _context16.v;
|
|
1757
|
+
_context16.n = 13;
|
|
1758
|
+
return i.exportKey("jwk", d.privateKey);
|
|
1759
|
+
case 13:
|
|
1760
|
+
p = _context16.v;
|
|
1761
|
+
if (!(!u || !p)) {
|
|
1762
|
+
_context16.n = 14;
|
|
1763
|
+
break;
|
|
1764
|
+
}
|
|
1765
|
+
throw new Error("Failed to export keys");
|
|
1766
|
+
case 14:
|
|
1767
|
+
ae(n, u);
|
|
1768
|
+
_context16.n = 15;
|
|
1769
|
+
return i.importKey("jwk", p, {
|
|
1770
|
+
name: "ECDSA",
|
|
1771
|
+
namedCurve: "P-256"
|
|
1772
|
+
}, false, ["sign"]);
|
|
1773
|
+
case 15:
|
|
1774
|
+
h = _context16.v;
|
|
1775
|
+
_context16.n = 16;
|
|
1776
|
+
return ue(s, n, n.idbPrivKey, h);
|
|
1777
|
+
case 16:
|
|
1778
|
+
this.logger.info("New identity created and saved.");
|
|
1779
|
+
return _context16.a(2, {
|
|
1780
|
+
id: l,
|
|
1781
|
+
privateKey: h
|
|
1782
|
+
});
|
|
1783
|
+
case 17:
|
|
1784
|
+
_context16.p = 17;
|
|
1785
|
+
s.close(), this.logger.groupEnd();
|
|
1786
|
+
return _context16.f(17);
|
|
1787
|
+
case 18:
|
|
1788
|
+
_context16.n = 20;
|
|
1789
|
+
break;
|
|
1790
|
+
case 19:
|
|
1791
|
+
_context16.p = 19;
|
|
1792
|
+
_t20 = _context16.v;
|
|
1793
|
+
throw this.logger.error("Error in getOrCreateIdentity", _t20), this.logger.groupEnd(), _t20;
|
|
1794
|
+
case 20:
|
|
1795
|
+
return _context16.a(2);
|
|
1796
|
+
}
|
|
1797
|
+
}, _callee16, this, [[6,, 17, 18], [1, 19]]);
|
|
1798
|
+
})), _this2._identityPromise);
|
|
1799
|
+
};
|
|
1800
|
+
this.ensureRegisterOnce = function (e2) {
|
|
1801
|
+
if (!_this2._enabled) return Promise.resolve(true);
|
|
1802
|
+
if (_this2._registerOncePromise) return _this2._registerOncePromise;
|
|
1803
|
+
var n = _this2._merge(e2);
|
|
1804
|
+
return _this2._registerOncePromise = c(_this2, null, /*#__PURE__*/_regenerator().m(function _callee17() {
|
|
1805
|
+
var i, o, d, _t21, _t22, _t23;
|
|
1806
|
+
return _regenerator().w(function (_context17) {
|
|
1807
|
+
while (1) switch (_context17.p = _context17.n) {
|
|
1808
|
+
case 0:
|
|
1809
|
+
_context17.p = 0;
|
|
1810
|
+
if (this._browserSupported) {
|
|
1811
|
+
_context17.n = 1;
|
|
1812
|
+
break;
|
|
1813
|
+
}
|
|
1814
|
+
return _context17.a(2, (this.logger.error("Browser not supported, skipping registration"), false));
|
|
1815
|
+
case 1:
|
|
1816
|
+
_context17.n = 2;
|
|
1817
|
+
return this.getOrCreateIdentity(e2);
|
|
1818
|
+
case 2:
|
|
1819
|
+
i = _context17.v.id;
|
|
1820
|
+
o = j(n);
|
|
1821
|
+
_t21 = o;
|
|
1822
|
+
if (_t21) {
|
|
1823
|
+
_context17.n = 5;
|
|
1824
|
+
break;
|
|
1825
|
+
}
|
|
1826
|
+
this.logger.warn("Repair needed: ID exists but PubKey missing in LS");
|
|
1827
|
+
_context17.n = 3;
|
|
1828
|
+
return this.clearPrivateKey(e2);
|
|
1829
|
+
case 3:
|
|
1830
|
+
this._identityPromise = null;
|
|
1831
|
+
_context17.n = 4;
|
|
1832
|
+
return this.getOrCreateIdentity(e2);
|
|
1833
|
+
case 4:
|
|
1834
|
+
i = _context17.v.id;
|
|
1835
|
+
o = j(n);
|
|
1836
|
+
case 5:
|
|
1837
|
+
if (!(i && o)) {
|
|
1838
|
+
_context17.n = 14;
|
|
1839
|
+
break;
|
|
1840
|
+
}
|
|
1841
|
+
_context17.p = 6;
|
|
1842
|
+
if (!(e2 && typeof e2.registerPublicKey == "function")) {
|
|
1843
|
+
_context17.n = 8;
|
|
1844
|
+
break;
|
|
1845
|
+
}
|
|
1846
|
+
_context17.n = 7;
|
|
1847
|
+
return e2.registerPublicKey(i, o);
|
|
1848
|
+
case 7:
|
|
1849
|
+
_context17.n = 9;
|
|
1850
|
+
break;
|
|
1851
|
+
case 8:
|
|
1852
|
+
_context17.n = 9;
|
|
1853
|
+
return Re(n, i, o, this.logger);
|
|
1854
|
+
case 9:
|
|
1855
|
+
_context17.n = 14;
|
|
1856
|
+
break;
|
|
1857
|
+
case 10:
|
|
1858
|
+
_context17.p = 10;
|
|
1859
|
+
_t22 = _context17.v;
|
|
1860
|
+
if (!(_t22 && (_t22 instanceof $ || _t22.name === "RegistrationConflictError" || _t22.status === 409))) {
|
|
1861
|
+
_context17.n = 12;
|
|
1862
|
+
break;
|
|
1863
|
+
}
|
|
1864
|
+
if (!(this.logger.warn("Registration conflict (409), redirecting to refresh_key page...", {
|
|
1865
|
+
clientId: i
|
|
1866
|
+
}), typeof window != "undefined")) {
|
|
1867
|
+
_context17.n = 11;
|
|
1868
|
+
break;
|
|
1869
|
+
}
|
|
1870
|
+
d = "/ngw/sign/refresh_key?return_url=".concat(encodeURIComponent(window.location.href));
|
|
1871
|
+
return _context17.a(2, (this.logger.info("Redirecting to: " + d), window.location.href = d, new Promise(function () {})));
|
|
1872
|
+
case 11:
|
|
1873
|
+
_context17.n = 13;
|
|
1874
|
+
break;
|
|
1875
|
+
case 12:
|
|
1876
|
+
this.logger.warn("Re-registration failed (ignoring)", _t22);
|
|
1877
|
+
case 13:
|
|
1878
|
+
return _context17.a(2, true);
|
|
1879
|
+
case 14:
|
|
1880
|
+
return _context17.a(2, true);
|
|
1881
|
+
case 15:
|
|
1882
|
+
_context17.p = 15;
|
|
1883
|
+
_t23 = _context17.v;
|
|
1884
|
+
return _context17.a(2, (this.logger.error("ensureRegisterOnce fatal error", _t23), true));
|
|
1885
|
+
}
|
|
1886
|
+
}, _callee17, this, [[6, 10], [0, 15]]);
|
|
1887
|
+
})), _this2._registerOncePromise;
|
|
1888
|
+
};
|
|
1889
|
+
this.signCanonical = function (e2, n) {
|
|
1890
|
+
return c(null, null, /*#__PURE__*/_regenerator().m(function _callee18() {
|
|
1891
|
+
var r, i, o;
|
|
1892
|
+
return _regenerator().w(function (_context18) {
|
|
1893
|
+
while (1) switch (_context18.n) {
|
|
1894
|
+
case 0:
|
|
1895
|
+
r = b();
|
|
1896
|
+
if (r) {
|
|
1897
|
+
_context18.n = 1;
|
|
1898
|
+
break;
|
|
1899
|
+
}
|
|
1900
|
+
throw new Error("WebCrypto subtle not supported");
|
|
1901
|
+
case 1:
|
|
1902
|
+
_context18.n = 2;
|
|
1903
|
+
return r.sign({
|
|
1904
|
+
name: "ECDSA",
|
|
1905
|
+
hash: "SHA-256"
|
|
1906
|
+
}, e2, C(n));
|
|
1907
|
+
case 2:
|
|
1908
|
+
i = _context18.v;
|
|
1909
|
+
o = J(new Uint8Array(i));
|
|
1910
|
+
return _context18.a(2, k(o));
|
|
1911
|
+
}
|
|
1912
|
+
}, _callee18);
|
|
1913
|
+
}));
|
|
1914
|
+
};
|
|
1915
|
+
this.buildSigHeadersFromParts = function (e2, n) {
|
|
1916
|
+
return c(_this2, null, /*#__PURE__*/_regenerator().m(function _callee19() {
|
|
1917
|
+
var i, r, _i4, o, s, a, l, d, _i5, _o2, _s2, _a7, _l2, _d, _t24;
|
|
1918
|
+
return _regenerator().w(function (_context19) {
|
|
1919
|
+
while (1) switch (_context19.p = _context19.n) {
|
|
1920
|
+
case 0:
|
|
1921
|
+
if (this._enabled) {
|
|
1922
|
+
_context19.n = 2;
|
|
1923
|
+
break;
|
|
1924
|
+
}
|
|
1925
|
+
_context19.n = 1;
|
|
1926
|
+
return this._resolveClientIdForHeader(n);
|
|
1927
|
+
case 1:
|
|
1928
|
+
i = _context19.v;
|
|
1929
|
+
return _context19.a(2, i ? {
|
|
1930
|
+
"X-Sig-Id": i
|
|
1931
|
+
} : {});
|
|
1932
|
+
case 2:
|
|
1933
|
+
r = this._merge(n);
|
|
1934
|
+
if (!(this.logger.debug("Building signature headers...", e2), this.nativeAdapter || this.detectHybridEnvironment(), this.nativeAdapter)) {
|
|
1935
|
+
_context19.n = 8;
|
|
1936
|
+
break;
|
|
1937
|
+
}
|
|
1938
|
+
_context19.p = 3;
|
|
1939
|
+
this.logger.info("Running in Hybrid Mode (".concat(this.nativeAdapter.name, ")."));
|
|
1940
|
+
_context19.n = 4;
|
|
1941
|
+
return this.nativeAdapter.getClientId();
|
|
1942
|
+
case 4:
|
|
1943
|
+
_i4 = _context19.v;
|
|
1944
|
+
if (_i4) {
|
|
1945
|
+
_context19.n = 5;
|
|
1946
|
+
break;
|
|
1947
|
+
}
|
|
1948
|
+
throw new Error("Hybrid adapter ".concat(this.nativeAdapter.name, " returned null ClientID"));
|
|
1949
|
+
case 5:
|
|
1950
|
+
this.logger.info("Hybrid Client ID:", _i4);
|
|
1951
|
+
o = e2.ts || Math.floor(Date.now() / 1e3), s = e2.nonce || H(), a = {
|
|
1952
|
+
method: e2.method,
|
|
1953
|
+
host: e2.host,
|
|
1954
|
+
path: e2.path,
|
|
1955
|
+
query: e2.query,
|
|
1956
|
+
id: _i4,
|
|
1957
|
+
ts: o,
|
|
1958
|
+
nonce: s
|
|
1959
|
+
};
|
|
1960
|
+
this._useGwCookie && (a.gw = typeof e2.gw == "string" ? e2.gw : B(r.gwCookieName));
|
|
1961
|
+
l = T(a);
|
|
1962
|
+
this.logger.debug("Canonical String (Hybrid):", l);
|
|
1963
|
+
_context19.n = 6;
|
|
1964
|
+
return this.nativeAdapter.signECDSA(l);
|
|
1965
|
+
case 6:
|
|
1966
|
+
d = _context19.v;
|
|
1967
|
+
return _context19.a(2, (this.logger.info("Signature generated by Native App: ", d), {
|
|
1968
|
+
"X-Sig-Id": _i4,
|
|
1969
|
+
"X-Sig-Ts": String(o),
|
|
1970
|
+
"X-Sig-Nonce": s,
|
|
1971
|
+
"X-Sig-Value": d
|
|
1972
|
+
}));
|
|
1973
|
+
case 7:
|
|
1974
|
+
_context19.p = 7;
|
|
1975
|
+
_t24 = _context19.v;
|
|
1976
|
+
return _context19.a(2, (this.logger.error("Hybrid signing failed: ", _t24), {}));
|
|
1977
|
+
case 8:
|
|
1978
|
+
this.logger.info("Running in Web Mode.");
|
|
1979
|
+
_context19.n = 9;
|
|
1980
|
+
return this.ensureRegisterOnce(n);
|
|
1981
|
+
case 9:
|
|
1982
|
+
_context19.n = 10;
|
|
1983
|
+
return this.getOrCreateIdentity(n);
|
|
1984
|
+
case 10:
|
|
1985
|
+
_i5 = _context19.v;
|
|
1986
|
+
_o2 = e2.ts || Math.floor(Date.now() / 1e3);
|
|
1987
|
+
_s2 = e2.nonce || H();
|
|
1988
|
+
_a7 = {
|
|
1989
|
+
method: e2.method,
|
|
1990
|
+
host: e2.host,
|
|
1991
|
+
path: e2.path,
|
|
1992
|
+
query: e2.query,
|
|
1993
|
+
id: _i5.id,
|
|
1994
|
+
ts: _o2,
|
|
1995
|
+
nonce: _s2
|
|
1996
|
+
};
|
|
1997
|
+
this._useGwCookie && (_a7.gw = typeof e2.gw == "string" ? e2.gw : B(r.gwCookieName)), this.logger.debug("Canonical parts input: ", _a7);
|
|
1998
|
+
_l2 = T(_a7);
|
|
1999
|
+
this.logger.debug("Canonical String:", _l2);
|
|
2000
|
+
_context19.n = 11;
|
|
2001
|
+
return this.signCanonical(_i5.privateKey, _l2);
|
|
2002
|
+
case 11:
|
|
2003
|
+
_d = _context19.v;
|
|
2004
|
+
return _context19.a(2, (this.logger.info("Signature generated successfully"), {
|
|
2005
|
+
"X-Sig-Id": _i5.id,
|
|
2006
|
+
"X-Sig-Ts": String(_o2),
|
|
2007
|
+
"X-Sig-Nonce": _s2,
|
|
2008
|
+
"X-Sig-Value": _d
|
|
2009
|
+
}));
|
|
2010
|
+
case 12:
|
|
2011
|
+
return _context19.a(2);
|
|
2012
|
+
}
|
|
2013
|
+
}, _callee19, this, [[3, 7]]);
|
|
2014
|
+
}));
|
|
2015
|
+
};
|
|
2016
|
+
this.createClientIdFromMacAddresses = function (e2) {
|
|
2017
|
+
return c(_this2, null, /*#__PURE__*/_regenerator().m(function _callee20() {
|
|
2018
|
+
var n, _t25, _t26;
|
|
2019
|
+
return _regenerator().w(function (_context20) {
|
|
2020
|
+
while (1) switch (_context20.n) {
|
|
2021
|
+
case 0:
|
|
2022
|
+
if (!(typeof e2 == "undefined")) {
|
|
2023
|
+
_context20.n = 2;
|
|
2024
|
+
break;
|
|
2025
|
+
}
|
|
2026
|
+
_context20.n = 1;
|
|
2027
|
+
return M(this._merge());
|
|
2028
|
+
case 1:
|
|
2029
|
+
_t25 = _context20.v;
|
|
2030
|
+
_context20.n = 3;
|
|
2031
|
+
break;
|
|
2032
|
+
case 2:
|
|
2033
|
+
_t25 = e2;
|
|
2034
|
+
case 3:
|
|
2035
|
+
n = _t25;
|
|
2036
|
+
_context20.n = 4;
|
|
2037
|
+
return D(n);
|
|
2038
|
+
case 4:
|
|
2039
|
+
_t26 = _context20.v;
|
|
2040
|
+
if (_t26) {
|
|
2041
|
+
_context20.n = 5;
|
|
2042
|
+
break;
|
|
2043
|
+
}
|
|
2044
|
+
_t26 = x();
|
|
2045
|
+
case 5:
|
|
2046
|
+
return _context20.a(2, _t26);
|
|
2047
|
+
}
|
|
2048
|
+
}, _callee20, this);
|
|
2049
|
+
}));
|
|
2050
|
+
};
|
|
2051
|
+
this.generateHeaders = function (e2, n) {
|
|
2052
|
+
return c(_this2, null, /*#__PURE__*/_regenerator().m(function _callee21() {
|
|
2053
|
+
var r, i, o, s, a, l;
|
|
2054
|
+
return _regenerator().w(function (_context21) {
|
|
2055
|
+
while (1) switch (_context21.n) {
|
|
2056
|
+
case 0:
|
|
2057
|
+
this.logger.debug("generateHeaders called with config:", e2);
|
|
2058
|
+
r = n && _typeof(n) == "object" && !Array.isArray(n) && typeof n.resolvedUrl == "string" ? n.resolvedUrl : "", i = String(e2.method || "GET").toUpperCase(), o = e2.baseURL || window.location.origin, s = r ? new URL(r, window.location.origin) : new URL(String(e2.url || ""), o), a = new URLSearchParams(s.search ? s.search.slice(1) : "");
|
|
2059
|
+
!r && e2.params && _typeof(e2.params) == "object" && Object.keys(e2.params).forEach(function (d) {
|
|
2060
|
+
var u = e2.params[d];
|
|
2061
|
+
u != null && (Array.isArray(u) ? u.forEach(function (p) {
|
|
2062
|
+
var h = d.endsWith("[]") ? d : d + "[]";
|
|
2063
|
+
a.append(h, String(p));
|
|
2064
|
+
}) : a.set(d, String(u)));
|
|
2065
|
+
});
|
|
2066
|
+
l = a.toString();
|
|
2067
|
+
return _context21.a(2, this.buildSigHeadersFromParts({
|
|
2068
|
+
method: i,
|
|
2069
|
+
host: s.host,
|
|
2070
|
+
path: s.pathname,
|
|
2071
|
+
query: l
|
|
2072
|
+
}, n));
|
|
2073
|
+
}
|
|
2074
|
+
}, _callee21, this);
|
|
2075
|
+
}));
|
|
2076
|
+
};
|
|
2077
|
+
if (this.logger = new R(!!(e != null && e.debug)), this._enabled = this._checkEnabled(), this._useGwCookie = this._checkUseGwCookie(), typeof window != "undefined") if (this._isLocalStorageSupported()) {
|
|
2078
|
+
if (!this._enabled) this.logger.info("Signature verification disabled via GWCONF"), this._browserSupported = true;else {
|
|
2079
|
+
var r = v();
|
|
2080
|
+
this._browserSupported = r.supported, r.supported || (this.logger.error("Browser not supported", r.missing), (e == null ? void 0 : e.showUnsupportedMessage) !== false && w(r.missing, e == null ? void 0 : e.unsupportedContainerId));
|
|
2081
|
+
}
|
|
2082
|
+
} else {
|
|
2083
|
+
var _r = ["localStorage"];
|
|
2084
|
+
this._browserSupported = false, this.logger.error("Browser not supported", _r), (e == null ? void 0 : e.showUnsupportedMessage) !== false && w(_r, e == null ? void 0 : e.unsupportedContainerId);
|
|
2085
|
+
}
|
|
2086
|
+
this.detectHybridEnvironment(), e != null && e.debug && this.logger.info("Initialized with options", this.defaults);
|
|
2087
|
+
}
|
|
2088
|
+
return _createClass(W, [{
|
|
2089
|
+
key: "_isLocalStorageSupported",
|
|
2090
|
+
value: function _isLocalStorageSupported() {
|
|
2091
|
+
try {
|
|
2092
|
+
var e = "__sig_test__";
|
|
2093
|
+
return localStorage.setItem(e, "1"), localStorage.removeItem(e), true;
|
|
2094
|
+
} catch (e) {
|
|
2095
|
+
return false;
|
|
2096
|
+
}
|
|
107
2097
|
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
2098
|
+
}, {
|
|
2099
|
+
key: "_ensureStoredClientId",
|
|
2100
|
+
value: function _ensureStoredClientId(e) {
|
|
2101
|
+
var n = this._merge(e),
|
|
2102
|
+
r = S(n);
|
|
2103
|
+
return r || (r = x(), E(n, r)), r;
|
|
114
2104
|
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
2105
|
+
}, {
|
|
2106
|
+
key: "_checkEnabled",
|
|
2107
|
+
value: function _checkEnabled() {
|
|
2108
|
+
if (typeof window == "undefined") return false;
|
|
2109
|
+
var e = window.GWCONF;
|
|
2110
|
+
return !e || typeof e.enableSignatureVerification == "undefined" ? false : !!e.enableSignatureVerification;
|
|
2111
|
+
}
|
|
2112
|
+
}, {
|
|
2113
|
+
key: "_checkUseGwCookie",
|
|
2114
|
+
value: function _checkUseGwCookie() {
|
|
2115
|
+
if (typeof window == "undefined") return false;
|
|
2116
|
+
var e = window.GWCONF;
|
|
2117
|
+
return !e || typeof e.useGwCookieInSignature == "undefined" ? false : !!e.useGwCookieInSignature;
|
|
2118
|
+
}
|
|
2119
|
+
}, {
|
|
2120
|
+
key: "detectHybridEnvironment",
|
|
2121
|
+
value: function detectHybridEnvironment() {
|
|
2122
|
+
if (!this.nativeAdapter) {
|
|
2123
|
+
if (window.isSupportSignECDSAiOS && typeof window.webkit != "undefined" && typeof window.webkit.messageHandlers != "undefined" && typeof window.webkit.messageHandlers.observe != "undefined" && typeof window.webkit.messageHandlers.observe.postMessage != "undefined") {
|
|
2124
|
+
this.logger.info("Detected iOS hybrid environment"), this.nativeAdapter = new F();
|
|
2125
|
+
return;
|
|
135
2126
|
}
|
|
136
|
-
|
|
2127
|
+
if (window.supportECDSAPostMessage) {
|
|
2128
|
+
this.logger.info("Detected Flutter hybrid environment"), this.nativeAdapter = new N();
|
|
2129
|
+
return;
|
|
2130
|
+
}
|
|
2131
|
+
if (window.JSInterface && typeof window.JSInterface.getHybridClientId == "function" && typeof window.JSInterface.hanbiroSignECDSA == "function") {
|
|
2132
|
+
this.logger.info("Detected Android hybrid environment"), this.nativeAdapter = new G();
|
|
2133
|
+
return;
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
137
2136
|
}
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
var locationInfo = window.location;
|
|
150
|
-
if (window.location !== window.parent.location) {
|
|
151
|
-
try {
|
|
152
|
-
locationInfo = window.parent.location;
|
|
153
|
-
} catch (e) {
|
|
154
|
-
locationInfo = window.location;
|
|
155
|
-
}
|
|
2137
|
+
}]);
|
|
2138
|
+
}();
|
|
2139
|
+
typeof window != "undefined" && (window.HanSigCommon = new W({
|
|
2140
|
+
baseUrl: location.origin
|
|
2141
|
+
}), window.HanSigCommon.randomNonce16B64u = H, window.HanSigCommon.b64urlEncodeBytes = k, window.HanSigCommon.utf8Bytes = C, window.HanSigCommon.uuidv4 = x, window.HanSigCommon.collectMacAddresses = M, window.HanSigCommon.normalizeMacAddresses = y, window.HanSigCommon.uuidFromMacAddresses = D, window.HanSigCommon.canonicalString = T, window.HanSigCommon.rawEcdsaP256ToDer = J, window.HanSigUtils = {
|
|
2142
|
+
checkBrowserSupport: v,
|
|
2143
|
+
showUnsupportedBrowserMessage: w,
|
|
2144
|
+
detectLanguage: P,
|
|
2145
|
+
isBrowserSupported: function isBrowserSupported() {
|
|
2146
|
+
var t2, e;
|
|
2147
|
+
return (e = (t2 = window.HanSigCommon) == null ? void 0 : t2.isBrowserSupported()) != null ? e : false;
|
|
156
2148
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (
|
|
161
|
-
|
|
162
|
-
};
|
|
163
|
-
var checkDevelopment = function checkDevelopment() {
|
|
164
|
-
var locationInfo = window.location;
|
|
165
|
-
var hostname = locationInfo.hostname;
|
|
166
|
-
if (hostname === "localhost" || hostname === "127.0.0.1") {
|
|
167
|
-
return true;
|
|
168
|
-
} else {
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
var isDevelopment = checkDevelopment();
|
|
173
|
-
var getBaseUrl = function getBaseUrl() {
|
|
174
|
-
var locationInfo = window.location;
|
|
175
|
-
var host = locationInfo.host;
|
|
176
|
-
if (isDevelopment) {
|
|
177
|
-
return "https://vndev.hanbiro.com";
|
|
2149
|
+
}, window.hanSessionStatus = L);
|
|
2150
|
+
var getSigner = function getSigner() {
|
|
2151
|
+
var existed = window == null ? void 0 : window.HanSigCommon;
|
|
2152
|
+
if (existed) {
|
|
2153
|
+
return existed;
|
|
178
2154
|
} else {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
2155
|
+
return new W({
|
|
2156
|
+
baseUrl: getBaseUrl()
|
|
2157
|
+
});
|
|
182
2158
|
}
|
|
183
2159
|
};
|
|
184
|
-
var
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
2160
|
+
var apiGet = function apiGet(url, opts) {
|
|
2161
|
+
return __async(_this3, null, /*#__PURE__*/_regenerator().m(function _callee22() {
|
|
2162
|
+
var _a2, sigConfig, sigHeaders, response, data;
|
|
2163
|
+
return _regenerator().w(function (_context22) {
|
|
2164
|
+
while (1) switch (_context22.n) {
|
|
2165
|
+
case 0:
|
|
2166
|
+
sigConfig = {
|
|
2167
|
+
method: "POST",
|
|
2168
|
+
baseURL: getBaseUrl(),
|
|
2169
|
+
url: url
|
|
2170
|
+
};
|
|
2171
|
+
_context22.n = 1;
|
|
2172
|
+
return (_a2 = getSigner()) == null ? void 0 : _a2.generateHeaders(sigConfig);
|
|
2173
|
+
case 1:
|
|
2174
|
+
sigHeaders = _context22.v;
|
|
2175
|
+
_context22.n = 2;
|
|
2176
|
+
return fetch(getBaseUrl() + url, {
|
|
2177
|
+
headers: __spreadValues(__spreadValues({
|
|
2178
|
+
Accept: "application/json, text/plain, */*",
|
|
2179
|
+
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
|
|
2180
|
+
}, opts == null ? void 0 : opts.headers), sigHeaders)
|
|
2181
|
+
});
|
|
2182
|
+
case 2:
|
|
2183
|
+
response = _context22.v;
|
|
2184
|
+
data = null;
|
|
2185
|
+
if (!response.ok) {
|
|
2186
|
+
_context22.n = 4;
|
|
2187
|
+
break;
|
|
2188
|
+
}
|
|
2189
|
+
_context22.n = 3;
|
|
2190
|
+
return response.json();
|
|
2191
|
+
case 3:
|
|
2192
|
+
data = _context22.v;
|
|
2193
|
+
_context22.n = 5;
|
|
2194
|
+
break;
|
|
2195
|
+
case 4:
|
|
2196
|
+
console.error("HTTP error! status: ".concat(response.status));
|
|
2197
|
+
case 5:
|
|
2198
|
+
return _context22.a(2, {
|
|
2199
|
+
data: data,
|
|
2200
|
+
code: response.status,
|
|
2201
|
+
ok: response.ok
|
|
2202
|
+
});
|
|
2203
|
+
}
|
|
2204
|
+
}, _callee22);
|
|
2205
|
+
}));
|
|
206
2206
|
};
|
|
207
|
-
function v4(options, buf, offset) {
|
|
208
|
-
if (native.randomUUID && true && !options) {
|
|
209
|
-
return native.randomUUID();
|
|
210
|
-
}
|
|
211
|
-
options = options || {};
|
|
212
|
-
var rnds = options.random || (options.rng || rng)();
|
|
213
|
-
rnds[6] = rnds[6] & 15 | 64;
|
|
214
|
-
rnds[8] = rnds[8] & 63 | 128;
|
|
215
|
-
return unsafeStringify(rnds);
|
|
216
|
-
}
|
|
217
2207
|
function callAI(_0, _1) {
|
|
218
2208
|
return __async(this, arguments, function (params, _ref2) {
|
|
219
2209
|
var setContent = _ref2.setContent,
|
|
220
2210
|
setIsLoading = _ref2.setIsLoading,
|
|
221
2211
|
setConversationId = _ref2.setConversationId;
|
|
222
|
-
return /*#__PURE__*/_regenerator().m(function
|
|
223
|
-
var currentContent, baseUrl, response, reader, fullContentDecode, readIndex, _yield$reader$read, done, value, originStr, jsonFormat, contentDecode, contentRegex, conversationIdRegex, matchArray, conversationIdmatch, _regMatchItem, nVal, decoded,
|
|
224
|
-
return _regenerator().w(function (
|
|
225
|
-
while (1) switch (
|
|
2212
|
+
return /*#__PURE__*/_regenerator().m(function _callee23() {
|
|
2213
|
+
var _a2, currentContent, baseUrl, sigConfig, sigHeaders, response, reader, fullContentDecode, readIndex, _yield$reader$read, done, value, originStr, jsonFormat, contentDecode, contentRegex, conversationIdRegex, matchArray, conversationIdmatch, _regMatchItem, nVal, decoded, _t27;
|
|
2214
|
+
return _regenerator().w(function (_context23) {
|
|
2215
|
+
while (1) switch (_context23.p = _context23.n) {
|
|
226
2216
|
case 0:
|
|
227
2217
|
currentContent = "";
|
|
228
2218
|
baseUrl = getBaseUrl();
|
|
229
|
-
|
|
2219
|
+
_context23.p = 1;
|
|
230
2220
|
setIsLoading(true);
|
|
231
|
-
|
|
2221
|
+
sigConfig = {
|
|
2222
|
+
method: "POST",
|
|
2223
|
+
baseURL: getBaseUrl(),
|
|
2224
|
+
url: "/nmail/chatdraft",
|
|
2225
|
+
params: params
|
|
2226
|
+
};
|
|
2227
|
+
_context23.n = 2;
|
|
2228
|
+
return (_a2 = getSigner()) == null ? void 0 : _a2.generateHeaders(sigConfig);
|
|
2229
|
+
case 2:
|
|
2230
|
+
sigHeaders = _context23.v;
|
|
2231
|
+
_context23.n = 3;
|
|
232
2232
|
return fetch("".concat(baseUrl, "/nmail/chatdraft"), {
|
|
233
2233
|
method: "POST",
|
|
234
2234
|
body: JSON.stringify(params),
|
|
235
|
-
headers: {
|
|
2235
|
+
headers: __spreadValues({
|
|
236
2236
|
"Content-Type": "application/json",
|
|
237
2237
|
"Access-Control-Allow-Origin": "*"
|
|
238
|
-
}
|
|
2238
|
+
}, sigHeaders)
|
|
239
2239
|
});
|
|
240
|
-
case
|
|
241
|
-
response =
|
|
2240
|
+
case 3:
|
|
2241
|
+
response = _context23.v;
|
|
242
2242
|
setIsLoading(false);
|
|
243
2243
|
if (response.body) {
|
|
244
|
-
|
|
2244
|
+
_context23.n = 4;
|
|
245
2245
|
break;
|
|
246
2246
|
}
|
|
247
2247
|
throw new Error("Response body is not available for streaming.");
|
|
248
|
-
case
|
|
2248
|
+
case 4:
|
|
249
2249
|
reader = response.body.getReader();
|
|
250
2250
|
fullContentDecode = "";
|
|
251
2251
|
readIndex = 0;
|
|
252
|
-
case
|
|
2252
|
+
case 5:
|
|
253
2253
|
if (!true) {
|
|
254
|
-
|
|
2254
|
+
_context23.n = 8;
|
|
255
2255
|
break;
|
|
256
2256
|
}
|
|
257
|
-
|
|
2257
|
+
_context23.n = 6;
|
|
258
2258
|
return reader.read();
|
|
259
|
-
case
|
|
260
|
-
_yield$reader$read =
|
|
2259
|
+
case 6:
|
|
2260
|
+
_yield$reader$read = _context23.v;
|
|
261
2261
|
done = _yield$reader$read.done;
|
|
262
2262
|
value = _yield$reader$read.value;
|
|
263
2263
|
if (!done) {
|
|
264
|
-
|
|
2264
|
+
_context23.n = 7;
|
|
265
2265
|
break;
|
|
266
2266
|
}
|
|
267
|
-
return
|
|
268
|
-
case
|
|
2267
|
+
return _context23.a(3, 8);
|
|
2268
|
+
case 7:
|
|
269
2269
|
originStr = "";
|
|
270
2270
|
jsonFormat = "";
|
|
271
2271
|
try {
|
|
@@ -298,23 +2298,23 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
298
2298
|
} catch (e) {
|
|
299
2299
|
console.error("TextDecoder error: ", e, originStr);
|
|
300
2300
|
}
|
|
301
|
-
|
|
2301
|
+
_context23.n = 5;
|
|
302
2302
|
break;
|
|
303
|
-
case 7:
|
|
304
|
-
return _context.a(2, currentContent);
|
|
305
2303
|
case 8:
|
|
306
|
-
|
|
307
|
-
_t = _context.v;
|
|
308
|
-
console.error("Summary error:", _t);
|
|
309
|
-
setContent("");
|
|
2304
|
+
return _context23.a(2, currentContent);
|
|
310
2305
|
case 9:
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
2306
|
+
_context23.p = 9;
|
|
2307
|
+
_t27 = _context23.v;
|
|
2308
|
+
console.error("Summary error:", _t27);
|
|
2309
|
+
setContent("");
|
|
314
2310
|
case 10:
|
|
315
|
-
|
|
2311
|
+
_context23.p = 10;
|
|
2312
|
+
setIsLoading(false);
|
|
2313
|
+
return _context23.f(10);
|
|
2314
|
+
case 11:
|
|
2315
|
+
return _context23.a(2, "");
|
|
316
2316
|
}
|
|
317
|
-
},
|
|
2317
|
+
}, _callee23, null, [[1, 9, 10, 11]]);
|
|
318
2318
|
})();
|
|
319
2319
|
});
|
|
320
2320
|
}
|
|
@@ -329,8 +2329,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
329
2329
|
var inner = first == null ? void 0 : first.match(/([^\s<>"]+@[^\s<>"]+)/);
|
|
330
2330
|
return inner ? inner[1] : first || "";
|
|
331
2331
|
};
|
|
332
|
-
function getDefaultExportFromCjs(
|
|
333
|
-
return
|
|
2332
|
+
function getDefaultExportFromCjs(x2) {
|
|
2333
|
+
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
334
2334
|
}
|
|
335
2335
|
var propTypes = {
|
|
336
2336
|
exports: {}
|
|
@@ -342,7 +2342,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
342
2342
|
function emptyFunctionWithReset() {}
|
|
343
2343
|
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
344
2344
|
var factoryWithThrowingShims = function factoryWithThrowingShims() {
|
|
345
|
-
function shim(props, propName, componentName,
|
|
2345
|
+
function shim(props, propName, componentName, location2, propFullName, secret) {
|
|
346
2346
|
if (secret === ReactPropTypesSecret) {
|
|
347
2347
|
return;
|
|
348
2348
|
}
|
|
@@ -2347,52 +4347,52 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2347
4347
|
var GAP = 4;
|
|
2348
4348
|
var Tooltip = /*#__PURE__*/function (_React__namespace$Com) {
|
|
2349
4349
|
function Tooltip(props) {
|
|
2350
|
-
var
|
|
4350
|
+
var _this4;
|
|
2351
4351
|
_classCallCheck(this, Tooltip);
|
|
2352
|
-
|
|
2353
|
-
__publicField(
|
|
2354
|
-
__publicField(
|
|
2355
|
-
__publicField(
|
|
2356
|
-
__publicField(
|
|
2357
|
-
__publicField(
|
|
2358
|
-
if (
|
|
2359
|
-
clearTimeout(
|
|
2360
|
-
|
|
2361
|
-
}
|
|
2362
|
-
var enterDelay =
|
|
2363
|
-
|
|
2364
|
-
|
|
4352
|
+
_this4 = _callSuper(this, Tooltip, [props]);
|
|
4353
|
+
__publicField(_this4, "triggerRef");
|
|
4354
|
+
__publicField(_this4, "tooltipRef");
|
|
4355
|
+
__publicField(_this4, "enterTimer", null);
|
|
4356
|
+
__publicField(_this4, "leaveTimer", null);
|
|
4357
|
+
__publicField(_this4, "handleMouseEnter", function () {
|
|
4358
|
+
if (_this4.leaveTimer) {
|
|
4359
|
+
clearTimeout(_this4.leaveTimer);
|
|
4360
|
+
_this4.leaveTimer = null;
|
|
4361
|
+
}
|
|
4362
|
+
var enterDelay = _this4.props.enterDelay;
|
|
4363
|
+
_this4.enterTimer = setTimeout(function () {
|
|
4364
|
+
_this4.setState({
|
|
2365
4365
|
visible: true
|
|
2366
4366
|
}, function () {
|
|
2367
|
-
var coords =
|
|
2368
|
-
|
|
4367
|
+
var coords = _this4.computeCoords();
|
|
4368
|
+
_this4.setState({
|
|
2369
4369
|
coords: coords
|
|
2370
4370
|
});
|
|
2371
4371
|
});
|
|
2372
4372
|
}, enterDelay);
|
|
2373
4373
|
});
|
|
2374
|
-
__publicField(
|
|
2375
|
-
if (
|
|
2376
|
-
clearTimeout(
|
|
2377
|
-
|
|
2378
|
-
}
|
|
2379
|
-
var leaveDelay =
|
|
2380
|
-
|
|
2381
|
-
|
|
4374
|
+
__publicField(_this4, "handleMouseLeave", function () {
|
|
4375
|
+
if (_this4.enterTimer) {
|
|
4376
|
+
clearTimeout(_this4.enterTimer);
|
|
4377
|
+
_this4.enterTimer = null;
|
|
4378
|
+
}
|
|
4379
|
+
var leaveDelay = _this4.props.leaveDelay;
|
|
4380
|
+
_this4.leaveTimer = setTimeout(function () {
|
|
4381
|
+
_this4.setState({
|
|
2382
4382
|
visible: false
|
|
2383
4383
|
});
|
|
2384
4384
|
}, leaveDelay);
|
|
2385
4385
|
});
|
|
2386
|
-
|
|
4386
|
+
_this4.state = {
|
|
2387
4387
|
visible: false,
|
|
2388
4388
|
coords: {
|
|
2389
4389
|
top: 0,
|
|
2390
4390
|
left: 0
|
|
2391
4391
|
}
|
|
2392
4392
|
};
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
return
|
|
4393
|
+
_this4.triggerRef = React__namespace.createRef();
|
|
4394
|
+
_this4.tooltipRef = React__namespace.createRef();
|
|
4395
|
+
return _this4;
|
|
2396
4396
|
}
|
|
2397
4397
|
_inherits(Tooltip, _React__namespace$Com);
|
|
2398
4398
|
return _createClass(Tooltip, [{
|
|
@@ -2820,7 +4820,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2820
4820
|
}
|
|
2821
4821
|
return cells;
|
|
2822
4822
|
}
|
|
2823
|
-
function rtrim(str,
|
|
4823
|
+
function rtrim(str, c2, invert) {
|
|
2824
4824
|
var l = str.length;
|
|
2825
4825
|
if (l === 0) {
|
|
2826
4826
|
return "";
|
|
@@ -2828,7 +4828,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2828
4828
|
var suffLen = 0;
|
|
2829
4829
|
while (suffLen < l) {
|
|
2830
4830
|
var currChar = str.charAt(l - suffLen - 1);
|
|
2831
|
-
if (currChar ===
|
|
4831
|
+
if (currChar === c2 && true) {
|
|
2832
4832
|
suffLen++;
|
|
2833
4833
|
} else {
|
|
2834
4834
|
break;
|
|
@@ -2836,20 +4836,20 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2836
4836
|
}
|
|
2837
4837
|
return str.slice(0, l - suffLen);
|
|
2838
4838
|
}
|
|
2839
|
-
function findClosingBracket(str,
|
|
2840
|
-
if (str.indexOf(
|
|
4839
|
+
function findClosingBracket(str, b2) {
|
|
4840
|
+
if (str.indexOf(b2[1]) === -1) {
|
|
2841
4841
|
return -1;
|
|
2842
4842
|
}
|
|
2843
4843
|
var level = 0;
|
|
2844
|
-
for (var
|
|
2845
|
-
if (str[
|
|
2846
|
-
|
|
2847
|
-
} else if (str[
|
|
4844
|
+
for (var i = 0; i < str.length; i++) {
|
|
4845
|
+
if (str[i] === "\\") {
|
|
4846
|
+
i++;
|
|
4847
|
+
} else if (str[i] === b2[0]) {
|
|
2848
4848
|
level++;
|
|
2849
|
-
} else if (str[
|
|
4849
|
+
} else if (str[i] === b2[1]) {
|
|
2850
4850
|
level--;
|
|
2851
4851
|
if (level < 0) {
|
|
2852
|
-
return
|
|
4852
|
+
return i;
|
|
2853
4853
|
}
|
|
2854
4854
|
}
|
|
2855
4855
|
}
|
|
@@ -2989,18 +4989,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2989
4989
|
while (lines.length > 0) {
|
|
2990
4990
|
var inBlockquote = false;
|
|
2991
4991
|
var currentLines = [];
|
|
2992
|
-
var
|
|
2993
|
-
for (
|
|
2994
|
-
if (this.rules.other.blockquoteStart.test(lines[
|
|
2995
|
-
currentLines.push(lines[
|
|
4992
|
+
var i = void 0;
|
|
4993
|
+
for (i = 0; i < lines.length; i++) {
|
|
4994
|
+
if (this.rules.other.blockquoteStart.test(lines[i])) {
|
|
4995
|
+
currentLines.push(lines[i]);
|
|
2996
4996
|
inBlockquote = true;
|
|
2997
4997
|
} else if (!inBlockquote) {
|
|
2998
|
-
currentLines.push(lines[
|
|
4998
|
+
currentLines.push(lines[i]);
|
|
2999
4999
|
} else {
|
|
3000
5000
|
break;
|
|
3001
5001
|
}
|
|
3002
5002
|
}
|
|
3003
|
-
lines = lines.slice(
|
|
5003
|
+
lines = lines.slice(i);
|
|
3004
5004
|
var currentRaw = currentLines.join("\n");
|
|
3005
5005
|
var currentText = currentRaw.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
3006
5006
|
raw = raw ? "".concat(raw, "\n").concat(currentRaw) : currentRaw;
|
|
@@ -3045,7 +5045,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3045
5045
|
}, {
|
|
3046
5046
|
key: "list",
|
|
3047
5047
|
value: function list(src) {
|
|
3048
|
-
var
|
|
5048
|
+
var _this5 = this;
|
|
3049
5049
|
var cap = this.rules.block.list.exec(src);
|
|
3050
5050
|
if (cap) {
|
|
3051
5051
|
var bull = cap[1].trim();
|
|
@@ -3192,22 +5192,22 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3192
5192
|
return;
|
|
3193
5193
|
}
|
|
3194
5194
|
list2.raw = list2.raw.trimEnd();
|
|
3195
|
-
for (var
|
|
5195
|
+
for (var i = 0; i < list2.items.length; i++) {
|
|
3196
5196
|
this.lexer.state.top = false;
|
|
3197
|
-
list2.items[
|
|
5197
|
+
list2.items[i].tokens = this.lexer.blockTokens(list2.items[i].text, []);
|
|
3198
5198
|
if (!list2.loose) {
|
|
3199
|
-
var spacers = list2.items[
|
|
5199
|
+
var spacers = list2.items[i].tokens.filter(function (t2) {
|
|
3200
5200
|
return t2.type === "space";
|
|
3201
5201
|
});
|
|
3202
5202
|
var hasMultipleLineBreaks = spacers.length > 0 && spacers.some(function (t2) {
|
|
3203
|
-
return
|
|
5203
|
+
return _this5.rules.other.anyLine.test(t2.raw);
|
|
3204
5204
|
});
|
|
3205
5205
|
list2.loose = hasMultipleLineBreaks;
|
|
3206
5206
|
}
|
|
3207
5207
|
}
|
|
3208
5208
|
if (list2.loose) {
|
|
3209
|
-
for (var
|
|
3210
|
-
list2.items[
|
|
5209
|
+
for (var _i6 = 0; _i6 < list2.items.length; _i6++) {
|
|
5210
|
+
list2.items[_i6].loose = true;
|
|
3211
5211
|
}
|
|
3212
5212
|
}
|
|
3213
5213
|
return list2;
|
|
@@ -3248,7 +5248,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3248
5248
|
}, {
|
|
3249
5249
|
key: "table",
|
|
3250
5250
|
value: function table(src) {
|
|
3251
|
-
var
|
|
5251
|
+
var _this6 = this;
|
|
3252
5252
|
var _a2;
|
|
3253
5253
|
var cap = this.rules.block.table.exec(src);
|
|
3254
5254
|
if (!cap) {
|
|
@@ -3270,11 +5270,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3270
5270
|
if (headers.length !== aligns.length) {
|
|
3271
5271
|
return;
|
|
3272
5272
|
}
|
|
3273
|
-
var
|
|
3274
|
-
|
|
5273
|
+
var _iterator6 = _createForOfIteratorHelper(aligns),
|
|
5274
|
+
_step6;
|
|
3275
5275
|
try {
|
|
3276
|
-
for (
|
|
3277
|
-
var align =
|
|
5276
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
5277
|
+
var align = _step6.value;
|
|
3278
5278
|
if (this.rules.other.tableAlignRight.test(align)) {
|
|
3279
5279
|
item.align.push("right");
|
|
3280
5280
|
} else if (this.rules.other.tableAlignCenter.test(align)) {
|
|
@@ -3286,36 +5286,36 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3286
5286
|
}
|
|
3287
5287
|
}
|
|
3288
5288
|
} catch (err) {
|
|
3289
|
-
|
|
5289
|
+
_iterator6.e(err);
|
|
3290
5290
|
} finally {
|
|
3291
|
-
|
|
5291
|
+
_iterator6.f();
|
|
3292
5292
|
}
|
|
3293
|
-
for (var
|
|
5293
|
+
for (var i = 0; i < headers.length; i++) {
|
|
3294
5294
|
item.header.push({
|
|
3295
|
-
text: headers[
|
|
3296
|
-
tokens: this.lexer.inline(headers[
|
|
5295
|
+
text: headers[i],
|
|
5296
|
+
tokens: this.lexer.inline(headers[i]),
|
|
3297
5297
|
header: true,
|
|
3298
|
-
align: item.align[
|
|
5298
|
+
align: item.align[i]
|
|
3299
5299
|
});
|
|
3300
5300
|
}
|
|
3301
|
-
var
|
|
3302
|
-
|
|
5301
|
+
var _iterator7 = _createForOfIteratorHelper(rows),
|
|
5302
|
+
_step7;
|
|
3303
5303
|
try {
|
|
3304
|
-
for (
|
|
3305
|
-
var row =
|
|
5304
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
5305
|
+
var row = _step7.value;
|
|
3306
5306
|
item.rows.push(splitCells(row, item.header.length).map(function (cell, i) {
|
|
3307
5307
|
return {
|
|
3308
5308
|
text: cell,
|
|
3309
|
-
tokens:
|
|
5309
|
+
tokens: _this6.lexer.inline(cell),
|
|
3310
5310
|
header: false,
|
|
3311
5311
|
align: item.align[i]
|
|
3312
5312
|
};
|
|
3313
5313
|
}));
|
|
3314
5314
|
}
|
|
3315
5315
|
} catch (err) {
|
|
3316
|
-
|
|
5316
|
+
_iterator7.e(err);
|
|
3317
5317
|
} finally {
|
|
3318
|
-
|
|
5318
|
+
_iterator7.f();
|
|
3319
5319
|
}
|
|
3320
5320
|
return item;
|
|
3321
5321
|
}
|
|
@@ -3692,8 +5692,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3692
5692
|
function lex(src) {
|
|
3693
5693
|
src = src.replace(other.carriageReturn, "\n");
|
|
3694
5694
|
this.blockTokens(src, this.tokens);
|
|
3695
|
-
for (var
|
|
3696
|
-
var next = this.inlineQueue[
|
|
5695
|
+
for (var i = 0; i < this.inlineQueue.length; i++) {
|
|
5696
|
+
var next = this.inlineQueue[i];
|
|
3697
5697
|
this.inlineTokens(next.src, next.tokens);
|
|
3698
5698
|
}
|
|
3699
5699
|
this.inlineQueue = [];
|
|
@@ -3702,7 +5702,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3702
5702
|
}, {
|
|
3703
5703
|
key: "blockTokens",
|
|
3704
5704
|
value: function blockTokens(src) {
|
|
3705
|
-
var
|
|
5705
|
+
var _this7 = this;
|
|
3706
5706
|
var tokens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
3707
5707
|
var lastParagraphClipped = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
3708
5708
|
var _a2, _b, _c;
|
|
@@ -3711,9 +5711,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3711
5711
|
}
|
|
3712
5712
|
var _loop2 = function _loop2() {
|
|
3713
5713
|
var token;
|
|
3714
|
-
if ((_b = (_a2 =
|
|
5714
|
+
if ((_b = (_a2 = _this7.options.extensions) == null ? void 0 : _a2.block) == null ? void 0 : _b.some(function (extTokenizer) {
|
|
3715
5715
|
if (token = extTokenizer.call({
|
|
3716
|
-
lexer:
|
|
5716
|
+
lexer: _this7
|
|
3717
5717
|
}, src, tokens)) {
|
|
3718
5718
|
src = src.substring(token.raw.length);
|
|
3719
5719
|
tokens.push(token);
|
|
@@ -3723,7 +5723,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3723
5723
|
})) {
|
|
3724
5724
|
return 0; // continue
|
|
3725
5725
|
}
|
|
3726
|
-
if (token =
|
|
5726
|
+
if (token = _this7.tokenizer.space(src)) {
|
|
3727
5727
|
src = src.substring(token.raw.length);
|
|
3728
5728
|
var lastToken = tokens.at(-1);
|
|
3729
5729
|
if (token.raw.length === 1 && lastToken !== void 0) {
|
|
@@ -3733,81 +5733,81 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3733
5733
|
}
|
|
3734
5734
|
return 0; // continue
|
|
3735
5735
|
}
|
|
3736
|
-
if (token =
|
|
5736
|
+
if (token = _this7.tokenizer.code(src)) {
|
|
3737
5737
|
src = src.substring(token.raw.length);
|
|
3738
5738
|
var _lastToken = tokens.at(-1);
|
|
3739
5739
|
if ((_lastToken == null ? void 0 : _lastToken.type) === "paragraph" || (_lastToken == null ? void 0 : _lastToken.type) === "text") {
|
|
3740
5740
|
_lastToken.raw += "\n" + token.raw;
|
|
3741
5741
|
_lastToken.text += "\n" + token.text;
|
|
3742
|
-
|
|
5742
|
+
_this7.inlineQueue.at(-1).src = _lastToken.text;
|
|
3743
5743
|
} else {
|
|
3744
5744
|
tokens.push(token);
|
|
3745
5745
|
}
|
|
3746
5746
|
return 0; // continue
|
|
3747
5747
|
}
|
|
3748
|
-
if (token =
|
|
5748
|
+
if (token = _this7.tokenizer.fences(src)) {
|
|
3749
5749
|
src = src.substring(token.raw.length);
|
|
3750
5750
|
tokens.push(token);
|
|
3751
5751
|
return 0; // continue
|
|
3752
5752
|
}
|
|
3753
|
-
if (token =
|
|
5753
|
+
if (token = _this7.tokenizer.heading(src)) {
|
|
3754
5754
|
src = src.substring(token.raw.length);
|
|
3755
5755
|
tokens.push(token);
|
|
3756
5756
|
return 0; // continue
|
|
3757
5757
|
}
|
|
3758
|
-
if (token =
|
|
5758
|
+
if (token = _this7.tokenizer.hr(src)) {
|
|
3759
5759
|
src = src.substring(token.raw.length);
|
|
3760
5760
|
tokens.push(token);
|
|
3761
5761
|
return 0; // continue
|
|
3762
5762
|
}
|
|
3763
|
-
if (token =
|
|
5763
|
+
if (token = _this7.tokenizer.blockquote(src)) {
|
|
3764
5764
|
src = src.substring(token.raw.length);
|
|
3765
5765
|
tokens.push(token);
|
|
3766
5766
|
return 0; // continue
|
|
3767
5767
|
}
|
|
3768
|
-
if (token =
|
|
5768
|
+
if (token = _this7.tokenizer.list(src)) {
|
|
3769
5769
|
src = src.substring(token.raw.length);
|
|
3770
5770
|
tokens.push(token);
|
|
3771
5771
|
return 0; // continue
|
|
3772
5772
|
}
|
|
3773
|
-
if (token =
|
|
5773
|
+
if (token = _this7.tokenizer.html(src)) {
|
|
3774
5774
|
src = src.substring(token.raw.length);
|
|
3775
5775
|
tokens.push(token);
|
|
3776
5776
|
return 0; // continue
|
|
3777
5777
|
}
|
|
3778
|
-
if (token =
|
|
5778
|
+
if (token = _this7.tokenizer.def(src)) {
|
|
3779
5779
|
src = src.substring(token.raw.length);
|
|
3780
5780
|
var _lastToken2 = tokens.at(-1);
|
|
3781
5781
|
if ((_lastToken2 == null ? void 0 : _lastToken2.type) === "paragraph" || (_lastToken2 == null ? void 0 : _lastToken2.type) === "text") {
|
|
3782
5782
|
_lastToken2.raw += "\n" + token.raw;
|
|
3783
5783
|
_lastToken2.text += "\n" + token.raw;
|
|
3784
|
-
|
|
3785
|
-
} else if (!
|
|
3786
|
-
|
|
5784
|
+
_this7.inlineQueue.at(-1).src = _lastToken2.text;
|
|
5785
|
+
} else if (!_this7.tokens.links[token.tag]) {
|
|
5786
|
+
_this7.tokens.links[token.tag] = {
|
|
3787
5787
|
href: token.href,
|
|
3788
5788
|
title: token.title
|
|
3789
5789
|
};
|
|
3790
5790
|
}
|
|
3791
5791
|
return 0; // continue
|
|
3792
5792
|
}
|
|
3793
|
-
if (token =
|
|
5793
|
+
if (token = _this7.tokenizer.table(src)) {
|
|
3794
5794
|
src = src.substring(token.raw.length);
|
|
3795
5795
|
tokens.push(token);
|
|
3796
5796
|
return 0; // continue
|
|
3797
5797
|
}
|
|
3798
|
-
if (token =
|
|
5798
|
+
if (token = _this7.tokenizer.lheading(src)) {
|
|
3799
5799
|
src = src.substring(token.raw.length);
|
|
3800
5800
|
tokens.push(token);
|
|
3801
5801
|
return 0; // continue
|
|
3802
5802
|
}
|
|
3803
5803
|
var cutSrc = src;
|
|
3804
|
-
if ((_c =
|
|
5804
|
+
if ((_c = _this7.options.extensions) == null ? void 0 : _c.startBlock) {
|
|
3805
5805
|
var startIndex = Infinity;
|
|
3806
5806
|
var tempSrc = src.slice(1);
|
|
3807
5807
|
var tempStart;
|
|
3808
|
-
|
|
5808
|
+
_this7.options.extensions.startBlock.forEach(function (getStartIndex) {
|
|
3809
5809
|
tempStart = getStartIndex.call({
|
|
3810
|
-
lexer:
|
|
5810
|
+
lexer: _this7
|
|
3811
5811
|
}, tempSrc);
|
|
3812
5812
|
if (typeof tempStart === "number" && tempStart >= 0) {
|
|
3813
5813
|
startIndex = Math.min(startIndex, tempStart);
|
|
@@ -3817,13 +5817,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3817
5817
|
cutSrc = src.substring(0, startIndex + 1);
|
|
3818
5818
|
}
|
|
3819
5819
|
}
|
|
3820
|
-
if (
|
|
5820
|
+
if (_this7.state.top && (token = _this7.tokenizer.paragraph(cutSrc))) {
|
|
3821
5821
|
var _lastToken3 = tokens.at(-1);
|
|
3822
5822
|
if (lastParagraphClipped && (_lastToken3 == null ? void 0 : _lastToken3.type) === "paragraph") {
|
|
3823
5823
|
_lastToken3.raw += "\n" + token.raw;
|
|
3824
5824
|
_lastToken3.text += "\n" + token.text;
|
|
3825
|
-
|
|
3826
|
-
|
|
5825
|
+
_this7.inlineQueue.pop();
|
|
5826
|
+
_this7.inlineQueue.at(-1).src = _lastToken3.text;
|
|
3827
5827
|
} else {
|
|
3828
5828
|
tokens.push(token);
|
|
3829
5829
|
}
|
|
@@ -3831,14 +5831,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3831
5831
|
src = src.substring(token.raw.length);
|
|
3832
5832
|
return 0; // continue
|
|
3833
5833
|
}
|
|
3834
|
-
if (token =
|
|
5834
|
+
if (token = _this7.tokenizer.text(src)) {
|
|
3835
5835
|
src = src.substring(token.raw.length);
|
|
3836
5836
|
var _lastToken4 = tokens.at(-1);
|
|
3837
5837
|
if ((_lastToken4 == null ? void 0 : _lastToken4.type) === "text") {
|
|
3838
5838
|
_lastToken4.raw += "\n" + token.raw;
|
|
3839
5839
|
_lastToken4.text += "\n" + token.text;
|
|
3840
|
-
|
|
3841
|
-
|
|
5840
|
+
_this7.inlineQueue.pop();
|
|
5841
|
+
_this7.inlineQueue.at(-1).src = _lastToken4.text;
|
|
3842
5842
|
} else {
|
|
3843
5843
|
tokens.push(token);
|
|
3844
5844
|
}
|
|
@@ -3846,7 +5846,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3846
5846
|
}
|
|
3847
5847
|
if (src) {
|
|
3848
5848
|
var errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
|
|
3849
|
-
if (
|
|
5849
|
+
if (_this7.options.silent) {
|
|
3850
5850
|
console.error(errMsg);
|
|
3851
5851
|
return 1; // break
|
|
3852
5852
|
} else {
|
|
@@ -3879,7 +5879,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3879
5879
|
}, {
|
|
3880
5880
|
key: "inlineTokens",
|
|
3881
5881
|
value: function inlineTokens(src) {
|
|
3882
|
-
var
|
|
5882
|
+
var _this8 = this;
|
|
3883
5883
|
var tokens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
3884
5884
|
var _a2, _b, _c;
|
|
3885
5885
|
var maskedSrc = src;
|
|
@@ -3908,9 +5908,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3908
5908
|
}
|
|
3909
5909
|
keepPrevChar = false;
|
|
3910
5910
|
var token;
|
|
3911
|
-
if ((_b = (_a2 =
|
|
5911
|
+
if ((_b = (_a2 = _this8.options.extensions) == null ? void 0 : _a2.inline) == null ? void 0 : _b.some(function (extTokenizer) {
|
|
3912
5912
|
if (token = extTokenizer.call({
|
|
3913
|
-
lexer:
|
|
5913
|
+
lexer: _this8
|
|
3914
5914
|
}, src, tokens)) {
|
|
3915
5915
|
src = src.substring(token.raw.length);
|
|
3916
5916
|
tokens.push(token);
|
|
@@ -3920,22 +5920,22 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3920
5920
|
})) {
|
|
3921
5921
|
return 0; // continue
|
|
3922
5922
|
}
|
|
3923
|
-
if (token =
|
|
5923
|
+
if (token = _this8.tokenizer.escape(src)) {
|
|
3924
5924
|
src = src.substring(token.raw.length);
|
|
3925
5925
|
tokens.push(token);
|
|
3926
5926
|
return 0; // continue
|
|
3927
5927
|
}
|
|
3928
|
-
if (token =
|
|
5928
|
+
if (token = _this8.tokenizer.tag(src)) {
|
|
3929
5929
|
src = src.substring(token.raw.length);
|
|
3930
5930
|
tokens.push(token);
|
|
3931
5931
|
return 0; // continue
|
|
3932
5932
|
}
|
|
3933
|
-
if (token =
|
|
5933
|
+
if (token = _this8.tokenizer.link(src)) {
|
|
3934
5934
|
src = src.substring(token.raw.length);
|
|
3935
5935
|
tokens.push(token);
|
|
3936
5936
|
return 0; // continue
|
|
3937
5937
|
}
|
|
3938
|
-
if (token =
|
|
5938
|
+
if (token = _this8.tokenizer.reflink(src, _this8.tokens.links)) {
|
|
3939
5939
|
src = src.substring(token.raw.length);
|
|
3940
5940
|
var lastToken = tokens.at(-1);
|
|
3941
5941
|
if (token.type === "text" && (lastToken == null ? void 0 : lastToken.type) === "text") {
|
|
@@ -3946,44 +5946,44 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3946
5946
|
}
|
|
3947
5947
|
return 0; // continue
|
|
3948
5948
|
}
|
|
3949
|
-
if (token =
|
|
5949
|
+
if (token = _this8.tokenizer.emStrong(src, maskedSrc, prevChar)) {
|
|
3950
5950
|
src = src.substring(token.raw.length);
|
|
3951
5951
|
tokens.push(token);
|
|
3952
5952
|
return 0; // continue
|
|
3953
5953
|
}
|
|
3954
|
-
if (token =
|
|
5954
|
+
if (token = _this8.tokenizer.codespan(src)) {
|
|
3955
5955
|
src = src.substring(token.raw.length);
|
|
3956
5956
|
tokens.push(token);
|
|
3957
5957
|
return 0; // continue
|
|
3958
5958
|
}
|
|
3959
|
-
if (token =
|
|
5959
|
+
if (token = _this8.tokenizer.br(src)) {
|
|
3960
5960
|
src = src.substring(token.raw.length);
|
|
3961
5961
|
tokens.push(token);
|
|
3962
5962
|
return 0; // continue
|
|
3963
5963
|
}
|
|
3964
|
-
if (token =
|
|
5964
|
+
if (token = _this8.tokenizer.del(src)) {
|
|
3965
5965
|
src = src.substring(token.raw.length);
|
|
3966
5966
|
tokens.push(token);
|
|
3967
5967
|
return 0; // continue
|
|
3968
5968
|
}
|
|
3969
|
-
if (token =
|
|
5969
|
+
if (token = _this8.tokenizer.autolink(src)) {
|
|
3970
5970
|
src = src.substring(token.raw.length);
|
|
3971
5971
|
tokens.push(token);
|
|
3972
5972
|
return 0; // continue
|
|
3973
5973
|
}
|
|
3974
|
-
if (!
|
|
5974
|
+
if (!_this8.state.inLink && (token = _this8.tokenizer.url(src))) {
|
|
3975
5975
|
src = src.substring(token.raw.length);
|
|
3976
5976
|
tokens.push(token);
|
|
3977
5977
|
return 0; // continue
|
|
3978
5978
|
}
|
|
3979
5979
|
var cutSrc = src;
|
|
3980
|
-
if ((_c =
|
|
5980
|
+
if ((_c = _this8.options.extensions) == null ? void 0 : _c.startInline) {
|
|
3981
5981
|
var startIndex = Infinity;
|
|
3982
5982
|
var tempSrc = src.slice(1);
|
|
3983
5983
|
var tempStart;
|
|
3984
|
-
|
|
5984
|
+
_this8.options.extensions.startInline.forEach(function (getStartIndex) {
|
|
3985
5985
|
tempStart = getStartIndex.call({
|
|
3986
|
-
lexer:
|
|
5986
|
+
lexer: _this8
|
|
3987
5987
|
}, tempSrc);
|
|
3988
5988
|
if (typeof tempStart === "number" && tempStart >= 0) {
|
|
3989
5989
|
startIndex = Math.min(startIndex, tempStart);
|
|
@@ -3993,7 +5993,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3993
5993
|
cutSrc = src.substring(0, startIndex + 1);
|
|
3994
5994
|
}
|
|
3995
5995
|
}
|
|
3996
|
-
if (token =
|
|
5996
|
+
if (token = _this8.tokenizer.inlineText(cutSrc)) {
|
|
3997
5997
|
src = src.substring(token.raw.length);
|
|
3998
5998
|
if (token.raw.slice(-1) !== "_") {
|
|
3999
5999
|
prevChar = token.raw.slice(-1);
|
|
@@ -4010,7 +6010,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4010
6010
|
}
|
|
4011
6011
|
if (src) {
|
|
4012
6012
|
var errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
|
|
4013
|
-
if (
|
|
6013
|
+
if (_this8.options.silent) {
|
|
4014
6014
|
console.error(errMsg);
|
|
4015
6015
|
return 1; // break
|
|
4016
6016
|
} else {
|
|
@@ -4112,8 +6112,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4112
6112
|
var ordered = token.ordered;
|
|
4113
6113
|
var start = token.start;
|
|
4114
6114
|
var body = "";
|
|
4115
|
-
for (var
|
|
4116
|
-
var item = token.items[
|
|
6115
|
+
for (var j2 = 0; j2 < token.items.length; j2++) {
|
|
6116
|
+
var item = token.items[j2];
|
|
4117
6117
|
body += this.listitem(item);
|
|
4118
6118
|
}
|
|
4119
6119
|
var type = ordered ? "ol" : "ul";
|
|
@@ -4168,8 +6168,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4168
6168
|
value: function table(token) {
|
|
4169
6169
|
var header = "";
|
|
4170
6170
|
var cell = "";
|
|
4171
|
-
for (var
|
|
4172
|
-
cell += this.tablecell(token.header[
|
|
6171
|
+
for (var j2 = 0; j2 < token.header.length; j2++) {
|
|
6172
|
+
cell += this.tablecell(token.header[j2]);
|
|
4173
6173
|
}
|
|
4174
6174
|
header += this.tablerow({
|
|
4175
6175
|
text: cell
|
|
@@ -4178,8 +6178,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4178
6178
|
for (var _j = 0; _j < token.rows.length; _j++) {
|
|
4179
6179
|
var row = token.rows[_j];
|
|
4180
6180
|
cell = "";
|
|
4181
|
-
for (var
|
|
4182
|
-
cell += this.tablecell(row[
|
|
6181
|
+
for (var k2 = 0; k2 < row.length; k2++) {
|
|
6182
|
+
cell += this.tablecell(row[k2]);
|
|
4183
6183
|
}
|
|
4184
6184
|
body += this.tablerow({
|
|
4185
6185
|
text: cell
|
|
@@ -4369,8 +6369,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4369
6369
|
var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
4370
6370
|
var _a2, _b;
|
|
4371
6371
|
var out = "";
|
|
4372
|
-
for (var
|
|
4373
|
-
var anyToken = tokens[
|
|
6372
|
+
for (var i = 0; i < tokens.length; i++) {
|
|
6373
|
+
var anyToken = tokens[i];
|
|
4374
6374
|
if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[anyToken.type]) {
|
|
4375
6375
|
var genericToken = anyToken;
|
|
4376
6376
|
var ret = this.options.extensions.renderers[genericToken.type].call({
|
|
@@ -4432,8 +6432,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4432
6432
|
{
|
|
4433
6433
|
var textToken = token;
|
|
4434
6434
|
var body = this.renderer.text(textToken);
|
|
4435
|
-
while (
|
|
4436
|
-
textToken = tokens[++
|
|
6435
|
+
while (i + 1 < tokens.length && tokens[i + 1].type === "text") {
|
|
6436
|
+
textToken = tokens[++i];
|
|
4437
6437
|
body += "\n" + this.renderer.text(textToken);
|
|
4438
6438
|
}
|
|
4439
6439
|
if (top) {
|
|
@@ -4476,8 +6476,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4476
6476
|
var renderer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.renderer;
|
|
4477
6477
|
var _a2, _b;
|
|
4478
6478
|
var out = "";
|
|
4479
|
-
for (var
|
|
4480
|
-
var anyToken = tokens[
|
|
6479
|
+
for (var i = 0; i < tokens.length; i++) {
|
|
6480
|
+
var anyToken = tokens[i];
|
|
4481
6481
|
if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[anyToken.type]) {
|
|
4482
6482
|
var ret = this.options.extensions.renderers[anyToken.type].call({
|
|
4483
6483
|
parser: this
|
|
@@ -4640,100 +6640,100 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4640
6640
|
return _createClass(Marked, [{
|
|
4641
6641
|
key: "walkTokens",
|
|
4642
6642
|
value: function walkTokens(tokens, callback) {
|
|
4643
|
-
var
|
|
6643
|
+
var _this9 = this;
|
|
4644
6644
|
var _a2, _b;
|
|
4645
6645
|
var values = [];
|
|
4646
|
-
var
|
|
4647
|
-
|
|
6646
|
+
var _iterator8 = _createForOfIteratorHelper(tokens),
|
|
6647
|
+
_step8;
|
|
4648
6648
|
try {
|
|
4649
6649
|
var _loop4 = function _loop4() {
|
|
4650
|
-
var token =
|
|
4651
|
-
values = values.concat(callback.call(
|
|
6650
|
+
var token = _step8.value;
|
|
6651
|
+
values = values.concat(callback.call(_this9, token));
|
|
4652
6652
|
switch (token.type) {
|
|
4653
6653
|
case "table":
|
|
4654
6654
|
{
|
|
4655
6655
|
var tableToken = token;
|
|
4656
|
-
var
|
|
4657
|
-
|
|
6656
|
+
var _iterator9 = _createForOfIteratorHelper(tableToken.header),
|
|
6657
|
+
_step9;
|
|
4658
6658
|
try {
|
|
4659
|
-
for (
|
|
4660
|
-
var cell =
|
|
4661
|
-
values = values.concat(
|
|
6659
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
6660
|
+
var cell = _step9.value;
|
|
6661
|
+
values = values.concat(_this9.walkTokens(cell.tokens, callback));
|
|
4662
6662
|
}
|
|
4663
6663
|
} catch (err) {
|
|
4664
|
-
|
|
6664
|
+
_iterator9.e(err);
|
|
4665
6665
|
} finally {
|
|
4666
|
-
|
|
6666
|
+
_iterator9.f();
|
|
4667
6667
|
}
|
|
4668
|
-
var
|
|
4669
|
-
|
|
6668
|
+
var _iterator0 = _createForOfIteratorHelper(tableToken.rows),
|
|
6669
|
+
_step0;
|
|
4670
6670
|
try {
|
|
4671
|
-
for (
|
|
4672
|
-
var row =
|
|
4673
|
-
var
|
|
4674
|
-
|
|
6671
|
+
for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
|
|
6672
|
+
var row = _step0.value;
|
|
6673
|
+
var _iterator1 = _createForOfIteratorHelper(row),
|
|
6674
|
+
_step1;
|
|
4675
6675
|
try {
|
|
4676
|
-
for (
|
|
4677
|
-
var _cell =
|
|
4678
|
-
values = values.concat(
|
|
6676
|
+
for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
|
|
6677
|
+
var _cell = _step1.value;
|
|
6678
|
+
values = values.concat(_this9.walkTokens(_cell.tokens, callback));
|
|
4679
6679
|
}
|
|
4680
6680
|
} catch (err) {
|
|
4681
|
-
|
|
6681
|
+
_iterator1.e(err);
|
|
4682
6682
|
} finally {
|
|
4683
|
-
|
|
6683
|
+
_iterator1.f();
|
|
4684
6684
|
}
|
|
4685
6685
|
}
|
|
4686
6686
|
} catch (err) {
|
|
4687
|
-
|
|
6687
|
+
_iterator0.e(err);
|
|
4688
6688
|
} finally {
|
|
4689
|
-
|
|
6689
|
+
_iterator0.f();
|
|
4690
6690
|
}
|
|
4691
6691
|
break;
|
|
4692
6692
|
}
|
|
4693
6693
|
case "list":
|
|
4694
6694
|
{
|
|
4695
6695
|
var listToken = token;
|
|
4696
|
-
values = values.concat(
|
|
6696
|
+
values = values.concat(_this9.walkTokens(listToken.items, callback));
|
|
4697
6697
|
break;
|
|
4698
6698
|
}
|
|
4699
6699
|
default:
|
|
4700
6700
|
{
|
|
4701
6701
|
var genericToken = token;
|
|
4702
|
-
if ((_b = (_a2 =
|
|
4703
|
-
|
|
6702
|
+
if ((_b = (_a2 = _this9.defaults.extensions) == null ? void 0 : _a2.childTokens) == null ? void 0 : _b[genericToken.type]) {
|
|
6703
|
+
_this9.defaults.extensions.childTokens[genericToken.type].forEach(function (childTokens) {
|
|
4704
6704
|
var tokens2 = genericToken[childTokens].flat(Infinity);
|
|
4705
|
-
values = values.concat(
|
|
6705
|
+
values = values.concat(_this9.walkTokens(tokens2, callback));
|
|
4706
6706
|
});
|
|
4707
6707
|
} else if (genericToken.tokens) {
|
|
4708
|
-
values = values.concat(
|
|
6708
|
+
values = values.concat(_this9.walkTokens(genericToken.tokens, callback));
|
|
4709
6709
|
}
|
|
4710
6710
|
}
|
|
4711
6711
|
}
|
|
4712
6712
|
};
|
|
4713
|
-
for (
|
|
6713
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
4714
6714
|
_loop4();
|
|
4715
6715
|
}
|
|
4716
6716
|
} catch (err) {
|
|
4717
|
-
|
|
6717
|
+
_iterator8.e(err);
|
|
4718
6718
|
} finally {
|
|
4719
|
-
|
|
6719
|
+
_iterator8.f();
|
|
4720
6720
|
}
|
|
4721
6721
|
return values;
|
|
4722
6722
|
}
|
|
4723
6723
|
}, {
|
|
4724
6724
|
key: "use",
|
|
4725
6725
|
value: function use() {
|
|
4726
|
-
var
|
|
6726
|
+
var _this0 = this;
|
|
4727
6727
|
var extensions = this.defaults.extensions || {
|
|
4728
6728
|
renderers: {},
|
|
4729
6729
|
childTokens: {}
|
|
4730
6730
|
};
|
|
4731
|
-
for (var
|
|
4732
|
-
args[
|
|
6731
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key7 = 0; _key7 < _len6; _key7++) {
|
|
6732
|
+
args[_key7] = arguments[_key7];
|
|
4733
6733
|
}
|
|
4734
6734
|
args.forEach(function (pack) {
|
|
4735
6735
|
var opts = __spreadValues({}, pack);
|
|
4736
|
-
opts.async =
|
|
6736
|
+
opts.async = _this0.defaults.async || opts.async || false;
|
|
4737
6737
|
if (pack.extensions) {
|
|
4738
6738
|
pack.extensions.forEach(function (ext) {
|
|
4739
6739
|
if (!ext.name) {
|
|
@@ -4743,8 +6743,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4743
6743
|
var prevRenderer = extensions.renderers[ext.name];
|
|
4744
6744
|
if (prevRenderer) {
|
|
4745
6745
|
extensions.renderers[ext.name] = function () {
|
|
4746
|
-
for (var
|
|
4747
|
-
args2[
|
|
6746
|
+
for (var _len7 = arguments.length, args2 = new Array(_len7), _key8 = 0; _key8 < _len7; _key8++) {
|
|
6747
|
+
args2[_key8] = arguments[_key8];
|
|
4748
6748
|
}
|
|
4749
6749
|
var ret = ext.renderer.apply(this, args2);
|
|
4750
6750
|
if (ret === false) {
|
|
@@ -4789,7 +6789,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4789
6789
|
opts.extensions = extensions;
|
|
4790
6790
|
}
|
|
4791
6791
|
if (pack.renderer) {
|
|
4792
|
-
var renderer =
|
|
6792
|
+
var renderer = _this0.defaults.renderer || new _Renderer(_this0.defaults);
|
|
4793
6793
|
var _loop5 = function _loop5() {
|
|
4794
6794
|
if (!(prop in renderer)) {
|
|
4795
6795
|
throw new Error("renderer '".concat(prop, "' does not exist"));
|
|
@@ -4801,8 +6801,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4801
6801
|
var rendererFunc = pack.renderer[rendererProp];
|
|
4802
6802
|
var prevRenderer = renderer[rendererProp];
|
|
4803
6803
|
renderer[rendererProp] = function () {
|
|
4804
|
-
for (var
|
|
4805
|
-
args2[
|
|
6804
|
+
for (var _len8 = arguments.length, args2 = new Array(_len8), _key9 = 0; _key9 < _len8; _key9++) {
|
|
6805
|
+
args2[_key9] = arguments[_key9];
|
|
4806
6806
|
}
|
|
4807
6807
|
var ret = rendererFunc.apply(renderer, args2);
|
|
4808
6808
|
if (ret === false) {
|
|
@@ -4817,7 +6817,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4817
6817
|
opts.renderer = renderer;
|
|
4818
6818
|
}
|
|
4819
6819
|
if (pack.tokenizer) {
|
|
4820
|
-
var tokenizer =
|
|
6820
|
+
var tokenizer = _this0.defaults.tokenizer || new _Tokenizer(_this0.defaults);
|
|
4821
6821
|
var _loop6 = function _loop6() {
|
|
4822
6822
|
if (!(_prop in tokenizer)) {
|
|
4823
6823
|
throw new Error("tokenizer '".concat(_prop, "' does not exist"));
|
|
@@ -4829,8 +6829,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4829
6829
|
var tokenizerFunc = pack.tokenizer[tokenizerProp];
|
|
4830
6830
|
var prevTokenizer = tokenizer[tokenizerProp];
|
|
4831
6831
|
tokenizer[tokenizerProp] = function () {
|
|
4832
|
-
for (var
|
|
4833
|
-
args2[
|
|
6832
|
+
for (var _len9 = arguments.length, args2 = new Array(_len9), _key0 = 0; _key0 < _len9; _key0++) {
|
|
6833
|
+
args2[_key0] = arguments[_key0];
|
|
4834
6834
|
}
|
|
4835
6835
|
var ret = tokenizerFunc.apply(tokenizer, args2);
|
|
4836
6836
|
if (ret === false) {
|
|
@@ -4845,7 +6845,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4845
6845
|
opts.tokenizer = tokenizer;
|
|
4846
6846
|
}
|
|
4847
6847
|
if (pack.hooks) {
|
|
4848
|
-
var hooks =
|
|
6848
|
+
var hooks = _this0.defaults.hooks || new _Hooks();
|
|
4849
6849
|
var _loop7 = function _loop7() {
|
|
4850
6850
|
if (!(_prop2 in hooks)) {
|
|
4851
6851
|
throw new Error("hook '".concat(_prop2, "' does not exist"));
|
|
@@ -4858,7 +6858,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4858
6858
|
var prevHook = hooks[hooksProp];
|
|
4859
6859
|
if (_Hooks.passThroughHooks.has(_prop2)) {
|
|
4860
6860
|
hooks[hooksProp] = function (arg) {
|
|
4861
|
-
if (
|
|
6861
|
+
if (_this0.defaults.async) {
|
|
4862
6862
|
return Promise.resolve(hooksFunc.call(hooks, arg)).then(function (ret2) {
|
|
4863
6863
|
return prevHook.call(hooks, ret2);
|
|
4864
6864
|
});
|
|
@@ -4868,8 +6868,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4868
6868
|
};
|
|
4869
6869
|
} else {
|
|
4870
6870
|
hooks[hooksProp] = function () {
|
|
4871
|
-
for (var
|
|
4872
|
-
args2[
|
|
6871
|
+
for (var _len0 = arguments.length, args2 = new Array(_len0), _key1 = 0; _key1 < _len0; _key1++) {
|
|
6872
|
+
args2[_key1] = arguments[_key1];
|
|
4873
6873
|
}
|
|
4874
6874
|
var ret = hooksFunc.apply(hooks, args2);
|
|
4875
6875
|
if (ret === false) {
|
|
@@ -4885,7 +6885,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4885
6885
|
opts.hooks = hooks;
|
|
4886
6886
|
}
|
|
4887
6887
|
if (pack.walkTokens) {
|
|
4888
|
-
var walkTokens2 =
|
|
6888
|
+
var walkTokens2 = _this0.defaults.walkTokens;
|
|
4889
6889
|
var packWalktokens = pack.walkTokens;
|
|
4890
6890
|
opts.walkTokens = function (token) {
|
|
4891
6891
|
var values = [];
|
|
@@ -4896,7 +6896,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4896
6896
|
return values;
|
|
4897
6897
|
};
|
|
4898
6898
|
}
|
|
4899
|
-
|
|
6899
|
+
_this0.defaults = __spreadValues(__spreadValues({}, _this0.defaults), opts);
|
|
4900
6900
|
});
|
|
4901
6901
|
return this;
|
|
4902
6902
|
}
|
|
@@ -4919,12 +6919,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4919
6919
|
}, {
|
|
4920
6920
|
key: "parseMarkdown",
|
|
4921
6921
|
value: function parseMarkdown(blockType) {
|
|
4922
|
-
var
|
|
6922
|
+
var _this1 = this;
|
|
4923
6923
|
var parse2 = function parse2(src, options2) {
|
|
4924
6924
|
var origOpt = __spreadValues({}, options2);
|
|
4925
|
-
var opt = __spreadValues(__spreadValues({},
|
|
4926
|
-
var throwError =
|
|
4927
|
-
if (
|
|
6925
|
+
var opt = __spreadValues(__spreadValues({}, _this1.defaults), origOpt);
|
|
6926
|
+
var throwError = _this1.onError(!!opt.silent, !!opt.async);
|
|
6927
|
+
if (_this1.defaults.async === true && origOpt.async === false) {
|
|
4928
6928
|
return throwError(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
|
|
4929
6929
|
}
|
|
4930
6930
|
if (typeof src === "undefined" || src === null) {
|
|
@@ -4945,7 +6945,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4945
6945
|
}).then(function (tokens) {
|
|
4946
6946
|
return opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens;
|
|
4947
6947
|
}).then(function (tokens) {
|
|
4948
|
-
return opt.walkTokens ? Promise.all(
|
|
6948
|
+
return opt.walkTokens ? Promise.all(_this1.walkTokens(tokens, opt.walkTokens)).then(function () {
|
|
4949
6949
|
return tokens;
|
|
4950
6950
|
}) : tokens;
|
|
4951
6951
|
}).then(function (tokens) {
|
|
@@ -4963,7 +6963,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4963
6963
|
tokens = opt.hooks.processAllTokens(tokens);
|
|
4964
6964
|
}
|
|
4965
6965
|
if (opt.walkTokens) {
|
|
4966
|
-
|
|
6966
|
+
_this1.walkTokens(tokens, opt.walkTokens);
|
|
4967
6967
|
}
|
|
4968
6968
|
var html2 = parser2(tokens, opt);
|
|
4969
6969
|
if (opt.hooks) {
|
|
@@ -5096,23 +7096,23 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5096
7096
|
var SIGNATURE_REGEX = /<!--HanbiroSignatureStart-->([\s\S]*?)<!--HanbiroSignatureEnd-->/g;
|
|
5097
7097
|
var TITLE_REGEX = /제목:[^\n]*/g;
|
|
5098
7098
|
var buildApplyHtml = function buildApplyHtml(body, editorValue) {
|
|
5099
|
-
return __async(
|
|
7099
|
+
return __async(_this3, null, /*#__PURE__*/_regenerator().m(function _callee24() {
|
|
5100
7100
|
var content, html2, signatureMatch;
|
|
5101
|
-
return _regenerator().w(function (
|
|
5102
|
-
while (1) switch (
|
|
7101
|
+
return _regenerator().w(function (_context24) {
|
|
7102
|
+
while (1) switch (_context24.n) {
|
|
5103
7103
|
case 0:
|
|
5104
7104
|
content = body.replace(TITLE_REGEX, "").replace("본문: ", "");
|
|
5105
|
-
|
|
7105
|
+
_context24.n = 1;
|
|
5106
7106
|
return marked.parse(content);
|
|
5107
7107
|
case 1:
|
|
5108
|
-
html2 =
|
|
7108
|
+
html2 = _context24.v;
|
|
5109
7109
|
signatureMatch = SIGNATURE_REGEX.exec(editorValue) || [];
|
|
5110
7110
|
if (signatureMatch[0]) {
|
|
5111
7111
|
html2 = html2 + "<br>" + signatureMatch[0];
|
|
5112
7112
|
}
|
|
5113
|
-
return
|
|
7113
|
+
return _context24.a(2, html2);
|
|
5114
7114
|
}
|
|
5115
|
-
},
|
|
7115
|
+
}, _callee24);
|
|
5116
7116
|
}));
|
|
5117
7117
|
};
|
|
5118
7118
|
var LangKey = /* @__PURE__ */function (LangKey2) {
|
|
@@ -5231,23 +7231,23 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5231
7231
|
onApply = _ref24.onApply,
|
|
5232
7232
|
getEditorContent = _ref24.getEditorContent;
|
|
5233
7233
|
var handleApply = function handleApply() {
|
|
5234
|
-
return __async(
|
|
7234
|
+
return __async(_this3, null, /*#__PURE__*/_regenerator().m(function _callee25() {
|
|
5235
7235
|
var editorValue, html2;
|
|
5236
|
-
return _regenerator().w(function (
|
|
5237
|
-
while (1) switch (
|
|
7236
|
+
return _regenerator().w(function (_context25) {
|
|
7237
|
+
while (1) switch (_context25.n) {
|
|
5238
7238
|
case 0:
|
|
5239
7239
|
editorValue = getEditorContent ? getEditorContent() : "";
|
|
5240
|
-
|
|
7240
|
+
_context25.n = 1;
|
|
5241
7241
|
return buildApplyHtml(item.body, editorValue);
|
|
5242
7242
|
case 1:
|
|
5243
|
-
html2 =
|
|
7243
|
+
html2 = _context25.v;
|
|
5244
7244
|
onApply({
|
|
5245
7245
|
html: html2
|
|
5246
7246
|
});
|
|
5247
7247
|
case 2:
|
|
5248
|
-
return
|
|
7248
|
+
return _context25.a(2);
|
|
5249
7249
|
}
|
|
5250
|
-
},
|
|
7250
|
+
}, _callee25);
|
|
5251
7251
|
}));
|
|
5252
7252
|
};
|
|
5253
7253
|
return /* @__PURE__ */React__namespace.createElement("div", {
|
|
@@ -6974,44 +8974,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
6974
8974
|
style: style
|
|
6975
8975
|
}, rest));
|
|
6976
8976
|
};
|
|
6977
|
-
var apiGet = function apiGet(url, opts) {
|
|
6978
|
-
return __async(_this9, null, /*#__PURE__*/_regenerator().m(function _callee4() {
|
|
6979
|
-
var response, data;
|
|
6980
|
-
return _regenerator().w(function (_context4) {
|
|
6981
|
-
while (1) switch (_context4.n) {
|
|
6982
|
-
case 0:
|
|
6983
|
-
_context4.n = 1;
|
|
6984
|
-
return fetch(getBaseUrl() + url, {
|
|
6985
|
-
headers: __spreadValues({
|
|
6986
|
-
Accept: "application/json, text/plain, */*",
|
|
6987
|
-
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
|
|
6988
|
-
}, opts == null ? void 0 : opts.headers)
|
|
6989
|
-
});
|
|
6990
|
-
case 1:
|
|
6991
|
-
response = _context4.v;
|
|
6992
|
-
data = null;
|
|
6993
|
-
if (!response.ok) {
|
|
6994
|
-
_context4.n = 3;
|
|
6995
|
-
break;
|
|
6996
|
-
}
|
|
6997
|
-
_context4.n = 2;
|
|
6998
|
-
return response.json();
|
|
6999
|
-
case 2:
|
|
7000
|
-
data = _context4.v;
|
|
7001
|
-
_context4.n = 4;
|
|
7002
|
-
break;
|
|
7003
|
-
case 3:
|
|
7004
|
-
console.error("HTTP error! status: ".concat(response.status));
|
|
7005
|
-
case 4:
|
|
7006
|
-
return _context4.a(2, {
|
|
7007
|
-
data: data,
|
|
7008
|
-
code: response.status,
|
|
7009
|
-
ok: response.ok
|
|
7010
|
-
});
|
|
7011
|
-
}
|
|
7012
|
-
}, _callee4);
|
|
7013
|
-
}));
|
|
7014
|
-
};
|
|
7015
8977
|
var getToneOptions = function getToneOptions() {
|
|
7016
8978
|
return [{
|
|
7017
8979
|
label: t(LangKey.TONE_FORMAL),
|
|
@@ -7056,35 +9018,35 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7056
9018
|
};
|
|
7057
9019
|
var LanguageSelect = /*#__PURE__*/function (_React__namespace$Com2) {
|
|
7058
9020
|
function LanguageSelect(props) {
|
|
7059
|
-
var
|
|
9021
|
+
var _this10;
|
|
7060
9022
|
_classCallCheck(this, LanguageSelect);
|
|
7061
|
-
|
|
7062
|
-
__publicField(
|
|
7063
|
-
__publicField(
|
|
7064
|
-
if (
|
|
7065
|
-
|
|
9023
|
+
_this10 = _callSuper(this, LanguageSelect, [props]);
|
|
9024
|
+
__publicField(_this10, "ref");
|
|
9025
|
+
__publicField(_this10, "handleClickOutside", function (e) {
|
|
9026
|
+
if (_this10.ref.current && !_this10.ref.current.contains(e.target)) {
|
|
9027
|
+
_this10.setState({
|
|
7066
9028
|
open: false
|
|
7067
9029
|
});
|
|
7068
9030
|
}
|
|
7069
9031
|
});
|
|
7070
|
-
__publicField(
|
|
7071
|
-
|
|
9032
|
+
__publicField(_this10, "toggle", function () {
|
|
9033
|
+
_this10.setState(function (s) {
|
|
7072
9034
|
return {
|
|
7073
9035
|
open: !s.open
|
|
7074
9036
|
};
|
|
7075
9037
|
});
|
|
7076
9038
|
});
|
|
7077
|
-
__publicField(
|
|
7078
|
-
|
|
7079
|
-
|
|
9039
|
+
__publicField(_this10, "pick", function (opt) {
|
|
9040
|
+
_this10.props.onChange(opt);
|
|
9041
|
+
_this10.setState({
|
|
7080
9042
|
open: false
|
|
7081
9043
|
});
|
|
7082
9044
|
});
|
|
7083
|
-
|
|
9045
|
+
_this10.state = {
|
|
7084
9046
|
open: false
|
|
7085
9047
|
};
|
|
7086
|
-
|
|
7087
|
-
return
|
|
9048
|
+
_this10.ref = React__namespace.createRef();
|
|
9049
|
+
return _this10;
|
|
7088
9050
|
}
|
|
7089
9051
|
_inherits(LanguageSelect, _React__namespace$Com2);
|
|
7090
9052
|
return _createClass(LanguageSelect, [{
|
|
@@ -7100,7 +9062,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7100
9062
|
}, {
|
|
7101
9063
|
key: "render",
|
|
7102
9064
|
value: function render() {
|
|
7103
|
-
var
|
|
9065
|
+
var _this11 = this;
|
|
7104
9066
|
var _this$props3 = this.props,
|
|
7105
9067
|
value = _this$props3.value,
|
|
7106
9068
|
options = _this$props3.options;
|
|
@@ -7168,7 +9130,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7168
9130
|
key: opt.value,
|
|
7169
9131
|
type: "button",
|
|
7170
9132
|
onClick: function onClick() {
|
|
7171
|
-
return
|
|
9133
|
+
return _this11.pick(opt);
|
|
7172
9134
|
},
|
|
7173
9135
|
className: "chat-ai-lang-option" + (isActive ? " is-active" : ""),
|
|
7174
9136
|
style: {
|
|
@@ -7286,21 +9248,21 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7286
9248
|
};
|
|
7287
9249
|
var SettingPopper = /*#__PURE__*/function (_React__namespace$Com3) {
|
|
7288
9250
|
function SettingPopper(props) {
|
|
7289
|
-
var
|
|
9251
|
+
var _this12;
|
|
7290
9252
|
_classCallCheck(this, SettingPopper);
|
|
7291
|
-
|
|
7292
|
-
__publicField(
|
|
7293
|
-
__publicField(
|
|
7294
|
-
__publicField(
|
|
7295
|
-
return __async(
|
|
9253
|
+
_this12 = _callSuper(this, SettingPopper, [props]);
|
|
9254
|
+
__publicField(_this12, "containerRef");
|
|
9255
|
+
__publicField(_this12, "popperRef");
|
|
9256
|
+
__publicField(_this12, "getLanguageOptions", function () {
|
|
9257
|
+
return __async(_this12, null, /*#__PURE__*/_regenerator().m(function _callee26() {
|
|
7296
9258
|
var _a2, _yield$apiGet, data, langs;
|
|
7297
|
-
return _regenerator().w(function (
|
|
7298
|
-
while (1) switch (
|
|
9259
|
+
return _regenerator().w(function (_context26) {
|
|
9260
|
+
while (1) switch (_context26.n) {
|
|
7299
9261
|
case 0:
|
|
7300
|
-
|
|
9262
|
+
_context26.n = 1;
|
|
7301
9263
|
return apiGet("/email/ai/langlist");
|
|
7302
9264
|
case 1:
|
|
7303
|
-
_yield$apiGet =
|
|
9265
|
+
_yield$apiGet = _context26.v;
|
|
7304
9266
|
data = _yield$apiGet.data;
|
|
7305
9267
|
if (data == null ? void 0 : data.list) {
|
|
7306
9268
|
langs = (_a2 = Object.keys(data == null ? void 0 : data.list)) == null ? void 0 : _a2.map(function (_key) {
|
|
@@ -7316,33 +9278,33 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7316
9278
|
});
|
|
7317
9279
|
}
|
|
7318
9280
|
case 2:
|
|
7319
|
-
return
|
|
9281
|
+
return _context26.a(2);
|
|
7320
9282
|
}
|
|
7321
|
-
},
|
|
9283
|
+
}, _callee26, this);
|
|
7322
9284
|
}));
|
|
7323
9285
|
});
|
|
7324
|
-
__publicField(
|
|
9286
|
+
__publicField(_this12, "handleClickOutside", function (event) {
|
|
7325
9287
|
var target = event.target;
|
|
7326
|
-
if (
|
|
7327
|
-
|
|
9288
|
+
if (_this12.containerRef.current && !_this12.containerRef.current.contains(target) && (!_this12.popperRef.current || !_this12.popperRef.current.contains(target))) {
|
|
9289
|
+
_this12.setState({
|
|
7328
9290
|
open: false
|
|
7329
9291
|
});
|
|
7330
9292
|
}
|
|
7331
9293
|
});
|
|
7332
|
-
__publicField(
|
|
7333
|
-
|
|
9294
|
+
__publicField(_this12, "togglePopper", function () {
|
|
9295
|
+
_this12.setState(function (prevState) {
|
|
7334
9296
|
return {
|
|
7335
9297
|
open: !prevState.open
|
|
7336
9298
|
};
|
|
7337
9299
|
});
|
|
7338
9300
|
});
|
|
7339
|
-
|
|
9301
|
+
_this12.state = {
|
|
7340
9302
|
open: false,
|
|
7341
9303
|
languageOptions: []
|
|
7342
9304
|
};
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
return
|
|
9305
|
+
_this12.containerRef = React__namespace.createRef();
|
|
9306
|
+
_this12.popperRef = React__namespace.createRef();
|
|
9307
|
+
return _this12;
|
|
7346
9308
|
}
|
|
7347
9309
|
_inherits(SettingPopper, _React__namespace$Com3);
|
|
7348
9310
|
return _createClass(SettingPopper, [{
|
|
@@ -7477,27 +9439,27 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7477
9439
|
}(React__namespace.Component);
|
|
7478
9440
|
var ChatInput = /*#__PURE__*/function (_React__namespace$Com4) {
|
|
7479
9441
|
function ChatInput(props) {
|
|
7480
|
-
var
|
|
9442
|
+
var _this13;
|
|
7481
9443
|
_classCallCheck(this, ChatInput);
|
|
7482
|
-
|
|
7483
|
-
__publicField(
|
|
7484
|
-
__publicField(
|
|
7485
|
-
var el =
|
|
9444
|
+
_this13 = _callSuper(this, ChatInput, [props]);
|
|
9445
|
+
__publicField(_this13, "textareaRef");
|
|
9446
|
+
__publicField(_this13, "adjustHeight", function () {
|
|
9447
|
+
var el = _this13.textareaRef.current;
|
|
7486
9448
|
if (!el) return;
|
|
7487
9449
|
el.style.height = "auto";
|
|
7488
9450
|
el.style.height = "".concat(Math.min(el.scrollHeight, 160), "px");
|
|
7489
9451
|
});
|
|
7490
|
-
__publicField(
|
|
7491
|
-
|
|
9452
|
+
__publicField(_this13, "handleChange", function (e) {
|
|
9453
|
+
_this13.props.onMessageChange(e.target.value);
|
|
7492
9454
|
});
|
|
7493
|
-
__publicField(
|
|
7494
|
-
if (!event.shiftKey && event.key === "Enter" && !
|
|
9455
|
+
__publicField(_this13, "handleKeyDown", function (event) {
|
|
9456
|
+
if (!event.shiftKey && event.key === "Enter" && !_this13.props.isSending) {
|
|
7495
9457
|
event.preventDefault();
|
|
7496
|
-
|
|
9458
|
+
_this13.props.onSubmit();
|
|
7497
9459
|
}
|
|
7498
9460
|
});
|
|
7499
|
-
|
|
7500
|
-
return
|
|
9461
|
+
_this13.textareaRef = React__namespace.createRef();
|
|
9462
|
+
return _this13;
|
|
7501
9463
|
}
|
|
7502
9464
|
_inherits(ChatInput, _React__namespace$Com4);
|
|
7503
9465
|
return _createClass(ChatInput, [{
|
|
@@ -7789,7 +9751,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7789
9751
|
flexDirection: "column",
|
|
7790
9752
|
gap: 14
|
|
7791
9753
|
}
|
|
7792
|
-
}, FEATURES$1.map(function (
|
|
9754
|
+
}, FEATURES$1.map(function (f2, i) {
|
|
7793
9755
|
return /* @__PURE__ */React__namespace.createElement("div", {
|
|
7794
9756
|
key: i,
|
|
7795
9757
|
style: {
|
|
@@ -7810,7 +9772,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7810
9772
|
justifyContent: "center",
|
|
7811
9773
|
flexShrink: 0
|
|
7812
9774
|
}
|
|
7813
|
-
},
|
|
9775
|
+
}, f2.icon), /* @__PURE__ */React__namespace.createElement("div", {
|
|
7814
9776
|
style: {
|
|
7815
9777
|
flex: 1,
|
|
7816
9778
|
minWidth: 0
|
|
@@ -7821,14 +9783,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7821
9783
|
fontWeight: 600,
|
|
7822
9784
|
color: "var(--text-primary)"
|
|
7823
9785
|
}
|
|
7824
|
-
},
|
|
9786
|
+
}, f2.title), /* @__PURE__ */React__namespace.createElement("div", {
|
|
7825
9787
|
style: {
|
|
7826
9788
|
fontSize: 12,
|
|
7827
9789
|
color: "var(--text-secondary)",
|
|
7828
9790
|
marginTop: 2,
|
|
7829
9791
|
lineHeight: 1.5
|
|
7830
9792
|
}
|
|
7831
|
-
},
|
|
9793
|
+
}, f2.desc)));
|
|
7832
9794
|
})), /* @__PURE__ */React__namespace.createElement("div", {
|
|
7833
9795
|
style: {
|
|
7834
9796
|
borderTop: "1px solid var(--border-light)",
|
|
@@ -7880,28 +9842,28 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7880
9842
|
};
|
|
7881
9843
|
var CreatePanel = /*#__PURE__*/function (_React__namespace$Com5) {
|
|
7882
9844
|
function CreatePanel(props) {
|
|
7883
|
-
var
|
|
9845
|
+
var _this14;
|
|
7884
9846
|
_classCallCheck(this, CreatePanel);
|
|
7885
|
-
|
|
7886
|
-
__publicField(
|
|
7887
|
-
__publicField(
|
|
7888
|
-
|
|
9847
|
+
_this14 = _callSuper(this, CreatePanel, [props]);
|
|
9848
|
+
__publicField(_this14, "rootRef");
|
|
9849
|
+
__publicField(_this14, "handleMessageChange", function (value) {
|
|
9850
|
+
_this14.setState({
|
|
7889
9851
|
message: value
|
|
7890
9852
|
});
|
|
7891
9853
|
});
|
|
7892
|
-
__publicField(
|
|
7893
|
-
return __async(
|
|
7894
|
-
var
|
|
9854
|
+
__publicField(_this14, "handleSubmit", function () {
|
|
9855
|
+
return __async(_this14, null, /*#__PURE__*/_regenerator().m(function _callee27() {
|
|
9856
|
+
var _this15 = this;
|
|
7895
9857
|
var _this$state3, message, messages, lang, tone, length, conversationId, newId, newMessage, params, setContent, setIsLoading, setConversationId;
|
|
7896
|
-
return _regenerator().w(function (
|
|
7897
|
-
while (1) switch (
|
|
9858
|
+
return _regenerator().w(function (_context27) {
|
|
9859
|
+
while (1) switch (_context27.n) {
|
|
7898
9860
|
case 0:
|
|
7899
9861
|
_this$state3 = this.state, message = _this$state3.message, messages = _this$state3.messages, lang = _this$state3.lang, tone = _this$state3.tone, length = _this$state3.length, conversationId = _this$state3.conversationId;
|
|
7900
9862
|
if (message.trim()) {
|
|
7901
|
-
|
|
9863
|
+
_context27.n = 1;
|
|
7902
9864
|
break;
|
|
7903
9865
|
}
|
|
7904
|
-
return
|
|
9866
|
+
return _context27.a(2);
|
|
7905
9867
|
case 1:
|
|
7906
9868
|
newId = v4();
|
|
7907
9869
|
newMessage = {
|
|
@@ -7926,36 +9888,36 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7926
9888
|
if (length) params.length = length.value;
|
|
7927
9889
|
if (conversationId) params.conversation_id = conversationId;
|
|
7928
9890
|
setContent = function setContent(nContent) {
|
|
7929
|
-
|
|
9891
|
+
_this15.setState(function (prevState) {
|
|
7930
9892
|
return {
|
|
7931
|
-
messages: prevState.messages.map(function (
|
|
7932
|
-
return
|
|
9893
|
+
messages: prevState.messages.map(function (m2) {
|
|
9894
|
+
return m2.id === newId ? __spreadProps(__spreadValues({}, m2), {
|
|
7933
9895
|
subject: "Some thing not used",
|
|
7934
9896
|
body: nContent,
|
|
7935
9897
|
isLoading: false,
|
|
7936
9898
|
created_at: (/* @__PURE__ */new Date()).getTime()
|
|
7937
|
-
}) :
|
|
9899
|
+
}) : m2;
|
|
7938
9900
|
})
|
|
7939
9901
|
};
|
|
7940
9902
|
});
|
|
7941
9903
|
};
|
|
7942
9904
|
setIsLoading = function setIsLoading(loading) {
|
|
7943
|
-
|
|
9905
|
+
_this15.setState(function (prevState) {
|
|
7944
9906
|
return {
|
|
7945
|
-
messages: prevState.messages.map(function (
|
|
7946
|
-
return
|
|
9907
|
+
messages: prevState.messages.map(function (m2) {
|
|
9908
|
+
return m2.id === newId ? __spreadProps(__spreadValues({}, m2), {
|
|
7947
9909
|
isLoading: loading
|
|
7948
|
-
}) :
|
|
9910
|
+
}) : m2;
|
|
7949
9911
|
})
|
|
7950
9912
|
};
|
|
7951
9913
|
});
|
|
7952
9914
|
};
|
|
7953
9915
|
setConversationId = function setConversationId(id) {
|
|
7954
|
-
|
|
9916
|
+
_this15.setState({
|
|
7955
9917
|
conversationId: id
|
|
7956
9918
|
});
|
|
7957
9919
|
};
|
|
7958
|
-
|
|
9920
|
+
_context27.n = 2;
|
|
7959
9921
|
return callAI(params, {
|
|
7960
9922
|
setContent: setContent,
|
|
7961
9923
|
setIsLoading: setIsLoading,
|
|
@@ -7966,31 +9928,31 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7966
9928
|
isSending: false
|
|
7967
9929
|
});
|
|
7968
9930
|
case 3:
|
|
7969
|
-
return
|
|
9931
|
+
return _context27.a(2);
|
|
7970
9932
|
}
|
|
7971
|
-
},
|
|
9933
|
+
}, _callee27, this);
|
|
7972
9934
|
}));
|
|
7973
9935
|
});
|
|
7974
|
-
__publicField(
|
|
7975
|
-
return
|
|
9936
|
+
__publicField(_this14, "setLang", function (lang) {
|
|
9937
|
+
return _this14.setState({
|
|
7976
9938
|
lang: lang
|
|
7977
9939
|
});
|
|
7978
9940
|
});
|
|
7979
|
-
__publicField(
|
|
7980
|
-
return
|
|
9941
|
+
__publicField(_this14, "setTone", function (tone) {
|
|
9942
|
+
return _this14.setState({
|
|
7981
9943
|
tone: tone
|
|
7982
9944
|
});
|
|
7983
9945
|
});
|
|
7984
|
-
__publicField(
|
|
7985
|
-
return
|
|
9946
|
+
__publicField(_this14, "setLength", function (length) {
|
|
9947
|
+
return _this14.setState({
|
|
7986
9948
|
length: length
|
|
7987
9949
|
});
|
|
7988
9950
|
});
|
|
7989
|
-
|
|
9951
|
+
_this14.rootRef = React__namespace.createRef();
|
|
7990
9952
|
var lang = (AI_LANG_FLAGS == null ? void 0 : AI_LANG_FLAGS.find(function (_item) {
|
|
7991
9953
|
return (_item == null ? void 0 : _item.value) === CURRENT_LANG;
|
|
7992
9954
|
})) || AI_LANG_FLAGS[0];
|
|
7993
|
-
|
|
9955
|
+
_this14.state = {
|
|
7994
9956
|
message: "",
|
|
7995
9957
|
messages: [],
|
|
7996
9958
|
isSending: false,
|
|
@@ -7999,13 +9961,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7999
9961
|
length: getLengthOptions()[2],
|
|
8000
9962
|
conversationId: ""
|
|
8001
9963
|
};
|
|
8002
|
-
return
|
|
9964
|
+
return _this14;
|
|
8003
9965
|
}
|
|
8004
9966
|
_inherits(CreatePanel, _React__namespace$Com5);
|
|
8005
9967
|
return _createClass(CreatePanel, [{
|
|
8006
9968
|
key: "render",
|
|
8007
9969
|
value: function render() {
|
|
8008
|
-
var
|
|
9970
|
+
var _this16 = this;
|
|
8009
9971
|
var _this$props6 = this.props,
|
|
8010
9972
|
onApply = _this$props6.onApply,
|
|
8011
9973
|
getEditorContent = _this$props6.getEditorContent;
|
|
@@ -8033,7 +9995,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8033
9995
|
getEditorContent: getEditorContent
|
|
8034
9996
|
}) : /* @__PURE__ */React__namespace.createElement(EmptyState$1, {
|
|
8035
9997
|
onSelectPrompt: function onSelectPrompt(text) {
|
|
8036
|
-
return
|
|
9998
|
+
return _this16.setState({
|
|
8037
9999
|
message: text
|
|
8038
10000
|
});
|
|
8039
10001
|
}
|
|
@@ -8137,7 +10099,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8137
10099
|
flexDirection: "column",
|
|
8138
10100
|
gap: 14
|
|
8139
10101
|
}
|
|
8140
|
-
}, FEATURES.map(function (
|
|
10102
|
+
}, FEATURES.map(function (f2, i) {
|
|
8141
10103
|
return /* @__PURE__ */React__namespace.createElement("div", {
|
|
8142
10104
|
key: i,
|
|
8143
10105
|
style: {
|
|
@@ -8158,7 +10120,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8158
10120
|
justifyContent: "center",
|
|
8159
10121
|
flexShrink: 0
|
|
8160
10122
|
}
|
|
8161
|
-
},
|
|
10123
|
+
}, f2.icon), /* @__PURE__ */React__namespace.createElement("div", {
|
|
8162
10124
|
style: {
|
|
8163
10125
|
flex: 1,
|
|
8164
10126
|
minWidth: 0
|
|
@@ -8169,14 +10131,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8169
10131
|
fontWeight: 600,
|
|
8170
10132
|
color: "var(--text-primary)"
|
|
8171
10133
|
}
|
|
8172
|
-
},
|
|
10134
|
+
}, f2.title), /* @__PURE__ */React__namespace.createElement("div", {
|
|
8173
10135
|
style: {
|
|
8174
10136
|
fontSize: 12,
|
|
8175
10137
|
color: "var(--text-secondary)",
|
|
8176
10138
|
marginTop: 2,
|
|
8177
10139
|
lineHeight: 1.5
|
|
8178
10140
|
}
|
|
8179
|
-
},
|
|
10141
|
+
}, f2.desc)));
|
|
8180
10142
|
})));
|
|
8181
10143
|
};
|
|
8182
10144
|
var SourceCard = function SourceCard(_ref29) {
|
|
@@ -8376,11 +10338,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8376
10338
|
flexWrap: "wrap",
|
|
8377
10339
|
gap: 6
|
|
8378
10340
|
}
|
|
8379
|
-
}, selectedMails.map(function (
|
|
10341
|
+
}, selectedMails.map(function (m2, i) {
|
|
8380
10342
|
return /* @__PURE__ */React__namespace.createElement(SelectedChip, {
|
|
8381
|
-
key:
|
|
10343
|
+
key: m2.mid,
|
|
8382
10344
|
index: i,
|
|
8383
|
-
mail:
|
|
10345
|
+
mail: m2,
|
|
8384
10346
|
onClick: onChipClick,
|
|
8385
10347
|
onRemove: onRemoveChip
|
|
8386
10348
|
});
|
|
@@ -8451,38 +10413,38 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8451
10413
|
};
|
|
8452
10414
|
var Pagination = /*#__PURE__*/function (_React__namespace$Com6) {
|
|
8453
10415
|
function Pagination(props) {
|
|
8454
|
-
var
|
|
10416
|
+
var _this17;
|
|
8455
10417
|
_classCallCheck(this, Pagination);
|
|
8456
|
-
|
|
8457
|
-
__publicField(
|
|
8458
|
-
var totalPages =
|
|
8459
|
-
if (Number.isNaN(value)) return
|
|
10418
|
+
_this17 = _callSuper(this, Pagination, [props]);
|
|
10419
|
+
__publicField(_this17, "clamp", function (value) {
|
|
10420
|
+
var totalPages = _this17.props.totalPages;
|
|
10421
|
+
if (Number.isNaN(value)) return _this17.props.page;
|
|
8460
10422
|
return Math.min(Math.max(1, Math.floor(value)), Math.max(1, totalPages));
|
|
8461
10423
|
});
|
|
8462
|
-
__publicField(
|
|
8463
|
-
|
|
10424
|
+
__publicField(_this17, "handleInputChange", function (e) {
|
|
10425
|
+
_this17.setState({
|
|
8464
10426
|
inputValue: e.target.value
|
|
8465
10427
|
});
|
|
8466
10428
|
});
|
|
8467
|
-
__publicField(
|
|
8468
|
-
var next =
|
|
8469
|
-
|
|
10429
|
+
__publicField(_this17, "commit", function () {
|
|
10430
|
+
var next = _this17.clamp(parseInt(_this17.state.inputValue, 10));
|
|
10431
|
+
_this17.setState({
|
|
8470
10432
|
inputValue: String(next)
|
|
8471
10433
|
});
|
|
8472
|
-
if (next !==
|
|
8473
|
-
|
|
10434
|
+
if (next !== _this17.props.page) {
|
|
10435
|
+
_this17.props.onChangePage(next);
|
|
8474
10436
|
}
|
|
8475
10437
|
});
|
|
8476
|
-
__publicField(
|
|
10438
|
+
__publicField(_this17, "handleKeyDown", function (e) {
|
|
8477
10439
|
if (e.key === "Enter") {
|
|
8478
10440
|
e.preventDefault();
|
|
8479
|
-
|
|
10441
|
+
_this17.commit();
|
|
8480
10442
|
}
|
|
8481
10443
|
});
|
|
8482
|
-
|
|
10444
|
+
_this17.state = {
|
|
8483
10445
|
inputValue: String(props.page)
|
|
8484
10446
|
};
|
|
8485
|
-
return
|
|
10447
|
+
return _this17;
|
|
8486
10448
|
}
|
|
8487
10449
|
_inherits(Pagination, _React__namespace$Com6);
|
|
8488
10450
|
return _createClass(Pagination, [{
|
|
@@ -8585,32 +10547,32 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8585
10547
|
};
|
|
8586
10548
|
};
|
|
8587
10549
|
var fetchMailView = function fetchMailView(mid) {
|
|
8588
|
-
return __async(
|
|
10550
|
+
return __async(_this3, null, /*#__PURE__*/_regenerator().m(function _callee28() {
|
|
8589
10551
|
var _a2, _yield$apiGet2, data, ok, view, _parseFromField, name, email;
|
|
8590
|
-
return _regenerator().w(function (
|
|
8591
|
-
while (1) switch (
|
|
10552
|
+
return _regenerator().w(function (_context28) {
|
|
10553
|
+
while (1) switch (_context28.n) {
|
|
8592
10554
|
case 0:
|
|
8593
|
-
|
|
10555
|
+
_context28.n = 1;
|
|
8594
10556
|
return apiGet("/email/all/".concat(mid));
|
|
8595
10557
|
case 1:
|
|
8596
|
-
_yield$apiGet2 =
|
|
10558
|
+
_yield$apiGet2 = _context28.v;
|
|
8597
10559
|
data = _yield$apiGet2.data;
|
|
8598
10560
|
ok = _yield$apiGet2.ok;
|
|
8599
10561
|
if (!(!ok || !data)) {
|
|
8600
|
-
|
|
10562
|
+
_context28.n = 2;
|
|
8601
10563
|
break;
|
|
8602
10564
|
}
|
|
8603
|
-
return
|
|
10565
|
+
return _context28.a(2, null);
|
|
8604
10566
|
case 2:
|
|
8605
10567
|
view = ((_a2 = data == null ? void 0 : data.mailview) == null ? void 0 : _a2[0]) || (data == null ? void 0 : data.mailview) || data;
|
|
8606
10568
|
if (view) {
|
|
8607
|
-
|
|
10569
|
+
_context28.n = 3;
|
|
8608
10570
|
break;
|
|
8609
10571
|
}
|
|
8610
|
-
return
|
|
10572
|
+
return _context28.a(2, null);
|
|
8611
10573
|
case 3:
|
|
8612
10574
|
_parseFromField = parseFromField((view == null ? void 0 : view.from) || ""), name = _parseFromField.name, email = _parseFromField.email;
|
|
8613
|
-
return
|
|
10575
|
+
return _context28.a(2, {
|
|
8614
10576
|
mid: (view == null ? void 0 : view.mid) || mid,
|
|
8615
10577
|
subject: (view == null ? void 0 : view.subject) || (view == null ? void 0 : view.subj) || "",
|
|
8616
10578
|
from_name: name || (view == null ? void 0 : view.from_name) || "",
|
|
@@ -8620,35 +10582,35 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8620
10582
|
contents: (view == null ? void 0 : view.contents) || ""
|
|
8621
10583
|
});
|
|
8622
10584
|
}
|
|
8623
|
-
},
|
|
10585
|
+
}, _callee28);
|
|
8624
10586
|
}));
|
|
8625
10587
|
};
|
|
8626
10588
|
var fetchMailAiContext = function fetchMailAiContext(mids) {
|
|
8627
|
-
return __async(
|
|
10589
|
+
return __async(_this3, null, /*#__PURE__*/_regenerator().m(function _callee29() {
|
|
8628
10590
|
var ids, _yield$apiGet3, data, ok;
|
|
8629
|
-
return _regenerator().w(function (
|
|
8630
|
-
while (1) switch (
|
|
10591
|
+
return _regenerator().w(function (_context29) {
|
|
10592
|
+
while (1) switch (_context29.n) {
|
|
8631
10593
|
case 0:
|
|
8632
10594
|
if (mids.length) {
|
|
8633
|
-
|
|
10595
|
+
_context29.n = 1;
|
|
8634
10596
|
break;
|
|
8635
10597
|
}
|
|
8636
|
-
return
|
|
10598
|
+
return _context29.a(2, []);
|
|
8637
10599
|
case 1:
|
|
8638
10600
|
ids = mids.join(",");
|
|
8639
|
-
|
|
10601
|
+
_context29.n = 2;
|
|
8640
10602
|
return apiGet("/email/ai/aicontext/".concat(ids, "?limit=").concat(mids.length));
|
|
8641
10603
|
case 2:
|
|
8642
|
-
_yield$apiGet3 =
|
|
10604
|
+
_yield$apiGet3 = _context29.v;
|
|
8643
10605
|
data = _yield$apiGet3.data;
|
|
8644
10606
|
ok = _yield$apiGet3.ok;
|
|
8645
10607
|
if (!(!ok || !(data == null ? void 0 : data.items))) {
|
|
8646
|
-
|
|
10608
|
+
_context29.n = 3;
|
|
8647
10609
|
break;
|
|
8648
10610
|
}
|
|
8649
|
-
return
|
|
10611
|
+
return _context29.a(2, []);
|
|
8650
10612
|
case 3:
|
|
8651
|
-
return
|
|
10613
|
+
return _context29.a(2, data.items.filter(function (it) {
|
|
8652
10614
|
return (it == null ? void 0 : it.ok) !== false;
|
|
8653
10615
|
}).map(function (it) {
|
|
8654
10616
|
var _parseFromField2 = parseFromField((it == null ? void 0 : it.fromaddr) || ""),
|
|
@@ -8664,14 +10626,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8664
10626
|
};
|
|
8665
10627
|
}));
|
|
8666
10628
|
}
|
|
8667
|
-
},
|
|
10629
|
+
}, _callee29);
|
|
8668
10630
|
}));
|
|
8669
10631
|
};
|
|
8670
10632
|
var fetchMailList = function fetchMailList(params) {
|
|
8671
|
-
return __async(
|
|
10633
|
+
return __async(_this3, null, /*#__PURE__*/_regenerator().m(function _callee30() {
|
|
8672
10634
|
var _a2, page, pageSize, accountEmail, offset, query, _yield$apiGet4, data, ok, list2, items, total;
|
|
8673
|
-
return _regenerator().w(function (
|
|
8674
|
-
while (1) switch (
|
|
10635
|
+
return _regenerator().w(function (_context30) {
|
|
10636
|
+
while (1) switch (_context30.n) {
|
|
8675
10637
|
case 0:
|
|
8676
10638
|
page = params.page, pageSize = params.pageSize, accountEmail = params.accountEmail;
|
|
8677
10639
|
offset = (page - 1) * pageSize;
|
|
@@ -8685,17 +10647,17 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8685
10647
|
searchbox: "all"
|
|
8686
10648
|
});
|
|
8687
10649
|
if (accountEmail) query.set("f", accountEmail);
|
|
8688
|
-
|
|
10650
|
+
_context30.n = 1;
|
|
8689
10651
|
return apiGet("/email/list?".concat(query.toString()));
|
|
8690
10652
|
case 1:
|
|
8691
|
-
_yield$apiGet4 =
|
|
10653
|
+
_yield$apiGet4 = _context30.v;
|
|
8692
10654
|
data = _yield$apiGet4.data;
|
|
8693
10655
|
ok = _yield$apiGet4.ok;
|
|
8694
10656
|
if (!(!ok || !data)) {
|
|
8695
|
-
|
|
10657
|
+
_context30.n = 2;
|
|
8696
10658
|
break;
|
|
8697
10659
|
}
|
|
8698
|
-
return
|
|
10660
|
+
return _context30.a(2, {
|
|
8699
10661
|
items: [],
|
|
8700
10662
|
total: 0
|
|
8701
10663
|
});
|
|
@@ -8713,38 +10675,38 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8713
10675
|
};
|
|
8714
10676
|
});
|
|
8715
10677
|
total = Number((_a2 = data == null ? void 0 : data.boxinfo) == null ? void 0 : _a2.total) || Number(data == null ? void 0 : data.total) || Number(data == null ? void 0 : data.newcount) || items.length;
|
|
8716
|
-
return
|
|
10678
|
+
return _context30.a(2, {
|
|
8717
10679
|
items: items,
|
|
8718
10680
|
total: total
|
|
8719
10681
|
});
|
|
8720
10682
|
}
|
|
8721
|
-
},
|
|
10683
|
+
}, _callee30);
|
|
8722
10684
|
}));
|
|
8723
10685
|
};
|
|
8724
10686
|
var PAGE_SIZE$1 = 6;
|
|
8725
10687
|
var MAX_SELECTED = 5;
|
|
8726
10688
|
var MailListSelect = /*#__PURE__*/function (_React__namespace$Com7) {
|
|
8727
10689
|
function MailListSelect(props) {
|
|
8728
|
-
var
|
|
10690
|
+
var _this18;
|
|
8729
10691
|
_classCallCheck(this, MailListSelect);
|
|
8730
|
-
|
|
8731
|
-
__publicField(
|
|
8732
|
-
return __async(
|
|
10692
|
+
_this18 = _callSuper(this, MailListSelect, [props]);
|
|
10693
|
+
__publicField(_this18, "loadPage", function (page) {
|
|
10694
|
+
return __async(_this18, null, /*#__PURE__*/_regenerator().m(function _callee31() {
|
|
8733
10695
|
var _yield$fetchMailList, items, total;
|
|
8734
|
-
return _regenerator().w(function (
|
|
8735
|
-
while (1) switch (
|
|
10696
|
+
return _regenerator().w(function (_context31) {
|
|
10697
|
+
while (1) switch (_context31.n) {
|
|
8736
10698
|
case 0:
|
|
8737
10699
|
this.setState({
|
|
8738
10700
|
isLoading: true
|
|
8739
10701
|
});
|
|
8740
|
-
|
|
10702
|
+
_context31.n = 1;
|
|
8741
10703
|
return fetchMailList({
|
|
8742
10704
|
page: page,
|
|
8743
10705
|
pageSize: PAGE_SIZE$1,
|
|
8744
10706
|
accountEmail: this.props.accountEmail
|
|
8745
10707
|
});
|
|
8746
10708
|
case 1:
|
|
8747
|
-
_yield$fetchMailList =
|
|
10709
|
+
_yield$fetchMailList = _context31.v;
|
|
8748
10710
|
items = _yield$fetchMailList.items;
|
|
8749
10711
|
total = _yield$fetchMailList.total;
|
|
8750
10712
|
this.setState({
|
|
@@ -8754,18 +10716,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8754
10716
|
isLoading: false
|
|
8755
10717
|
});
|
|
8756
10718
|
case 2:
|
|
8757
|
-
return
|
|
10719
|
+
return _context31.a(2);
|
|
8758
10720
|
}
|
|
8759
|
-
},
|
|
10721
|
+
}, _callee31, this);
|
|
8760
10722
|
}));
|
|
8761
10723
|
});
|
|
8762
|
-
__publicField(
|
|
8763
|
-
|
|
10724
|
+
__publicField(_this18, "toggleMid", function (mid) {
|
|
10725
|
+
_this18.setState(function (prev) {
|
|
8764
10726
|
var isSelected = prev.selectedMids.includes(mid);
|
|
8765
10727
|
if (isSelected) {
|
|
8766
10728
|
return {
|
|
8767
|
-
selectedMids: prev.selectedMids.filter(function (
|
|
8768
|
-
return
|
|
10729
|
+
selectedMids: prev.selectedMids.filter(function (m2) {
|
|
10730
|
+
return m2 !== mid;
|
|
8769
10731
|
})
|
|
8770
10732
|
};
|
|
8771
10733
|
}
|
|
@@ -8777,12 +10739,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8777
10739
|
};
|
|
8778
10740
|
});
|
|
8779
10741
|
});
|
|
8780
|
-
__publicField(
|
|
8781
|
-
var
|
|
8782
|
-
items =
|
|
8783
|
-
selectedMids =
|
|
10742
|
+
__publicField(_this18, "toggleAll", function () {
|
|
10743
|
+
var _this18$state = _this18.state,
|
|
10744
|
+
items = _this18$state.items,
|
|
10745
|
+
selectedMids = _this18$state.selectedMids;
|
|
8784
10746
|
if (selectedMids.length >= MAX_SELECTED) {
|
|
8785
|
-
|
|
10747
|
+
_this18.setState({
|
|
8786
10748
|
selectedMids: []
|
|
8787
10749
|
});
|
|
8788
10750
|
return;
|
|
@@ -8791,23 +10753,23 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8791
10753
|
return it.mid;
|
|
8792
10754
|
});
|
|
8793
10755
|
var merged = Array.from(/* @__PURE__ */new Set([].concat(_toConsumableArray(selectedMids), _toConsumableArray(pageMids)))).slice(0, MAX_SELECTED);
|
|
8794
|
-
|
|
10756
|
+
_this18.setState({
|
|
8795
10757
|
selectedMids: merged
|
|
8796
10758
|
});
|
|
8797
10759
|
});
|
|
8798
|
-
__publicField(
|
|
8799
|
-
|
|
10760
|
+
__publicField(_this18, "clearAll", function () {
|
|
10761
|
+
_this18.setState({
|
|
8800
10762
|
selectedMids: []
|
|
8801
10763
|
});
|
|
8802
10764
|
});
|
|
8803
|
-
|
|
10765
|
+
_this18.state = {
|
|
8804
10766
|
page: 1,
|
|
8805
10767
|
total: 0,
|
|
8806
10768
|
items: [],
|
|
8807
10769
|
selectedMids: _toConsumableArray(props.initialSelected),
|
|
8808
10770
|
isLoading: false
|
|
8809
10771
|
};
|
|
8810
|
-
return
|
|
10772
|
+
return _this18;
|
|
8811
10773
|
}
|
|
8812
10774
|
_inherits(MailListSelect, _React__namespace$Com7);
|
|
8813
10775
|
return _createClass(MailListSelect, [{
|
|
@@ -8832,7 +10794,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8832
10794
|
}, {
|
|
8833
10795
|
key: "render",
|
|
8834
10796
|
value: function render() {
|
|
8835
|
-
var
|
|
10797
|
+
var _this19 = this;
|
|
8836
10798
|
var _this$props8 = this.props,
|
|
8837
10799
|
onCancel = _this$props8.onCancel,
|
|
8838
10800
|
onConfirm = _this$props8.onConfirm,
|
|
@@ -8912,7 +10874,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8912
10874
|
type: "button",
|
|
8913
10875
|
onClick: function onClick(e) {
|
|
8914
10876
|
e.preventDefault();
|
|
8915
|
-
|
|
10877
|
+
_this19.clearAll();
|
|
8916
10878
|
},
|
|
8917
10879
|
className: "text-button primary"
|
|
8918
10880
|
}, t(LangKey.CLEAR_ALL))), /* @__PURE__ */React__namespace.createElement("span", {
|
|
@@ -8960,7 +10922,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8960
10922
|
checked: isChecked,
|
|
8961
10923
|
disabled: disabled,
|
|
8962
10924
|
onChange: function onChange() {
|
|
8963
|
-
return
|
|
10925
|
+
return _this19.toggleMid(it.mid);
|
|
8964
10926
|
},
|
|
8965
10927
|
style: {
|
|
8966
10928
|
marginTop: 2,
|
|
@@ -9067,13 +11029,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9067
11029
|
}(React__namespace.Component);
|
|
9068
11030
|
var BaseModal = /*#__PURE__*/function (_React__namespace$Com8) {
|
|
9069
11031
|
function BaseModal() {
|
|
9070
|
-
var
|
|
11032
|
+
var _this20;
|
|
9071
11033
|
_classCallCheck(this, BaseModal);
|
|
9072
|
-
|
|
9073
|
-
__publicField(
|
|
9074
|
-
if (e.key === "Escape" &&
|
|
11034
|
+
_this20 = _callSuper(this, BaseModal, arguments);
|
|
11035
|
+
__publicField(_this20, "handleKeyDown", function (e) {
|
|
11036
|
+
if (e.key === "Escape" && _this20.props.isOpen) _this20.props.onClose();
|
|
9075
11037
|
});
|
|
9076
|
-
return
|
|
11038
|
+
return _this20;
|
|
9077
11039
|
}
|
|
9078
11040
|
_inherits(BaseModal, _React__namespace$Com8);
|
|
9079
11041
|
return _createClass(BaseModal, [{
|
|
@@ -9209,30 +11171,30 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9209
11171
|
};
|
|
9210
11172
|
var ReplyPanel = /*#__PURE__*/function (_React__namespace$Com9) {
|
|
9211
11173
|
function ReplyPanel(props) {
|
|
9212
|
-
var
|
|
11174
|
+
var _this21;
|
|
9213
11175
|
_classCallCheck(this, ReplyPanel);
|
|
9214
|
-
|
|
9215
|
-
__publicField(
|
|
9216
|
-
__publicField(
|
|
9217
|
-
return __async(
|
|
11176
|
+
_this21 = _callSuper(this, ReplyPanel, [props]);
|
|
11177
|
+
__publicField(_this21, "rootRef");
|
|
11178
|
+
__publicField(_this21, "loadSourceMail", function () {
|
|
11179
|
+
return __async(_this21, null, /*#__PURE__*/_regenerator().m(function _callee32() {
|
|
9218
11180
|
var sourceMid, view;
|
|
9219
|
-
return _regenerator().w(function (
|
|
9220
|
-
while (1) switch (
|
|
11181
|
+
return _regenerator().w(function (_context32) {
|
|
11182
|
+
while (1) switch (_context32.n) {
|
|
9221
11183
|
case 0:
|
|
9222
11184
|
sourceMid = this.props.sourceMid;
|
|
9223
11185
|
if (sourceMid) {
|
|
9224
|
-
|
|
11186
|
+
_context32.n = 1;
|
|
9225
11187
|
break;
|
|
9226
11188
|
}
|
|
9227
|
-
return
|
|
11189
|
+
return _context32.a(2);
|
|
9228
11190
|
case 1:
|
|
9229
11191
|
this.setState({
|
|
9230
11192
|
isLoadingSource: true
|
|
9231
11193
|
});
|
|
9232
|
-
|
|
11194
|
+
_context32.n = 2;
|
|
9233
11195
|
return fetchMailView(sourceMid);
|
|
9234
11196
|
case 2:
|
|
9235
|
-
view =
|
|
11197
|
+
view = _context32.v;
|
|
9236
11198
|
if (view) {
|
|
9237
11199
|
this.setState({
|
|
9238
11200
|
sourceMail: {
|
|
@@ -9253,92 +11215,92 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9253
11215
|
});
|
|
9254
11216
|
}
|
|
9255
11217
|
case 3:
|
|
9256
|
-
return
|
|
11218
|
+
return _context32.a(2);
|
|
9257
11219
|
}
|
|
9258
|
-
},
|
|
11220
|
+
}, _callee32, this);
|
|
9259
11221
|
}));
|
|
9260
11222
|
});
|
|
9261
|
-
__publicField(
|
|
9262
|
-
|
|
11223
|
+
__publicField(_this21, "handleAddClick", function () {
|
|
11224
|
+
_this21.setState({
|
|
9263
11225
|
view: "list"
|
|
9264
11226
|
});
|
|
9265
11227
|
});
|
|
9266
|
-
__publicField(
|
|
9267
|
-
|
|
9268
|
-
view:
|
|
11228
|
+
__publicField(_this21, "handleListCancel", function () {
|
|
11229
|
+
_this21.setState({
|
|
11230
|
+
view: _this21.state.messages.length > 0 ? "chat" : "empty"
|
|
9269
11231
|
});
|
|
9270
11232
|
});
|
|
9271
|
-
__publicField(
|
|
9272
|
-
return __async(
|
|
11233
|
+
__publicField(_this21, "handleListConfirm", function (mids) {
|
|
11234
|
+
return __async(_this21, null, /*#__PURE__*/_regenerator().m(function _callee33() {
|
|
9273
11235
|
var selectedMails;
|
|
9274
|
-
return _regenerator().w(function (
|
|
9275
|
-
while (1) switch (
|
|
11236
|
+
return _regenerator().w(function (_context33) {
|
|
11237
|
+
while (1) switch (_context33.n) {
|
|
9276
11238
|
case 0:
|
|
9277
11239
|
this.setState({
|
|
9278
11240
|
isLoadingSelected: true
|
|
9279
11241
|
});
|
|
9280
|
-
|
|
11242
|
+
_context33.n = 1;
|
|
9281
11243
|
return fetchMailAiContext(mids);
|
|
9282
11244
|
case 1:
|
|
9283
|
-
selectedMails =
|
|
11245
|
+
selectedMails = _context33.v;
|
|
9284
11246
|
this.setState({
|
|
9285
11247
|
selectedMails: selectedMails,
|
|
9286
11248
|
isLoadingSelected: false,
|
|
9287
11249
|
view: this.state.messages.length > 0 ? "chat" : "empty"
|
|
9288
11250
|
});
|
|
9289
11251
|
case 2:
|
|
9290
|
-
return
|
|
11252
|
+
return _context33.a(2);
|
|
9291
11253
|
}
|
|
9292
|
-
},
|
|
11254
|
+
}, _callee33, this);
|
|
9293
11255
|
}));
|
|
9294
11256
|
});
|
|
9295
|
-
__publicField(
|
|
9296
|
-
|
|
9297
|
-
selectedMails:
|
|
9298
|
-
return
|
|
11257
|
+
__publicField(_this21, "handleRemoveSelected", function (mid) {
|
|
11258
|
+
_this21.setState({
|
|
11259
|
+
selectedMails: _this21.state.selectedMails.filter(function (m2) {
|
|
11260
|
+
return m2.mid !== mid;
|
|
9299
11261
|
})
|
|
9300
11262
|
});
|
|
9301
11263
|
});
|
|
9302
|
-
__publicField(
|
|
9303
|
-
|
|
11264
|
+
__publicField(_this21, "handlePreviewSelected", function (mail) {
|
|
11265
|
+
_this21.setState({
|
|
9304
11266
|
preview: {
|
|
9305
11267
|
mail: mail,
|
|
9306
11268
|
mode: "ai"
|
|
9307
11269
|
}
|
|
9308
11270
|
});
|
|
9309
11271
|
});
|
|
9310
|
-
__publicField(
|
|
9311
|
-
|
|
11272
|
+
__publicField(_this21, "handlePreviewSource", function (mail) {
|
|
11273
|
+
_this21.setState({
|
|
9312
11274
|
preview: {
|
|
9313
11275
|
mail: mail,
|
|
9314
11276
|
mode: "html"
|
|
9315
11277
|
}
|
|
9316
11278
|
});
|
|
9317
11279
|
});
|
|
9318
|
-
__publicField(
|
|
9319
|
-
|
|
11280
|
+
__publicField(_this21, "handlePreviewClose", function () {
|
|
11281
|
+
_this21.setState({
|
|
9320
11282
|
preview: null
|
|
9321
11283
|
});
|
|
9322
11284
|
});
|
|
9323
|
-
__publicField(
|
|
9324
|
-
|
|
11285
|
+
__publicField(_this21, "handleMessageChange", function (value) {
|
|
11286
|
+
_this21.setState({
|
|
9325
11287
|
message: value
|
|
9326
11288
|
});
|
|
9327
11289
|
});
|
|
9328
|
-
__publicField(
|
|
9329
|
-
return __async(
|
|
9330
|
-
var
|
|
11290
|
+
__publicField(_this21, "handleSubmit", function () {
|
|
11291
|
+
return __async(_this21, null, /*#__PURE__*/_regenerator().m(function _callee34() {
|
|
11292
|
+
var _this22 = this;
|
|
9331
11293
|
var type, _this$state7, message, messages, lang, tone, length, conversationId, sourceMail, selectedMails, newId, newMessage, params, setContent, setIsLoading, setConversationId;
|
|
9332
|
-
return _regenerator().w(function (
|
|
9333
|
-
while (1) switch (
|
|
11294
|
+
return _regenerator().w(function (_context34) {
|
|
11295
|
+
while (1) switch (_context34.n) {
|
|
9334
11296
|
case 0:
|
|
9335
11297
|
type = this.props.type;
|
|
9336
11298
|
_this$state7 = this.state, message = _this$state7.message, messages = _this$state7.messages, lang = _this$state7.lang, tone = _this$state7.tone, length = _this$state7.length, conversationId = _this$state7.conversationId, sourceMail = _this$state7.sourceMail, selectedMails = _this$state7.selectedMails;
|
|
9337
11299
|
if (message.trim()) {
|
|
9338
|
-
|
|
11300
|
+
_context34.n = 1;
|
|
9339
11301
|
break;
|
|
9340
11302
|
}
|
|
9341
|
-
return
|
|
11303
|
+
return _context34.a(2);
|
|
9342
11304
|
case 1:
|
|
9343
11305
|
newId = v4();
|
|
9344
11306
|
newMessage = {
|
|
@@ -9361,12 +11323,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9361
11323
|
debug_grpc: true,
|
|
9362
11324
|
action: type,
|
|
9363
11325
|
original_email: (sourceMail == null ? void 0 : sourceMail.contents) || "",
|
|
9364
|
-
emailhistorys: selectedMails.filter(function (
|
|
9365
|
-
return
|
|
9366
|
-
}).map(function (
|
|
11326
|
+
emailhistorys: selectedMails.filter(function (m2) {
|
|
11327
|
+
return m2.ai_contents;
|
|
11328
|
+
}).map(function (m2) {
|
|
9367
11329
|
return {
|
|
9368
|
-
date:
|
|
9369
|
-
contents:
|
|
11330
|
+
date: m2.date,
|
|
11331
|
+
contents: m2.ai_contents
|
|
9370
11332
|
};
|
|
9371
11333
|
})
|
|
9372
11334
|
};
|
|
@@ -9374,36 +11336,36 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9374
11336
|
if (length) params.length = length.value;
|
|
9375
11337
|
if (conversationId) params.conversation_id = conversationId;
|
|
9376
11338
|
setContent = function setContent(nContent) {
|
|
9377
|
-
|
|
11339
|
+
_this22.setState(function (prevState) {
|
|
9378
11340
|
return {
|
|
9379
|
-
messages: prevState.messages.map(function (
|
|
9380
|
-
return
|
|
11341
|
+
messages: prevState.messages.map(function (m2) {
|
|
11342
|
+
return m2.id === newId ? __spreadProps(__spreadValues({}, m2), {
|
|
9381
11343
|
subject: "Some thing not used",
|
|
9382
11344
|
body: nContent,
|
|
9383
11345
|
isLoading: false,
|
|
9384
11346
|
created_at: (/* @__PURE__ */new Date()).getTime()
|
|
9385
|
-
}) :
|
|
11347
|
+
}) : m2;
|
|
9386
11348
|
})
|
|
9387
11349
|
};
|
|
9388
11350
|
});
|
|
9389
11351
|
};
|
|
9390
11352
|
setIsLoading = function setIsLoading(loading) {
|
|
9391
|
-
|
|
11353
|
+
_this22.setState(function (prevState) {
|
|
9392
11354
|
return {
|
|
9393
|
-
messages: prevState.messages.map(function (
|
|
9394
|
-
return
|
|
11355
|
+
messages: prevState.messages.map(function (m2) {
|
|
11356
|
+
return m2.id === newId ? __spreadProps(__spreadValues({}, m2), {
|
|
9395
11357
|
isLoading: loading
|
|
9396
|
-
}) :
|
|
11358
|
+
}) : m2;
|
|
9397
11359
|
})
|
|
9398
11360
|
};
|
|
9399
11361
|
});
|
|
9400
11362
|
};
|
|
9401
11363
|
setConversationId = function setConversationId(id) {
|
|
9402
|
-
|
|
11364
|
+
_this22.setState({
|
|
9403
11365
|
conversationId: id
|
|
9404
11366
|
});
|
|
9405
11367
|
};
|
|
9406
|
-
|
|
11368
|
+
_context34.n = 2;
|
|
9407
11369
|
return callAI(params, {
|
|
9408
11370
|
setContent: setContent,
|
|
9409
11371
|
setIsLoading: setIsLoading,
|
|
@@ -9414,31 +11376,31 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9414
11376
|
isSending: false
|
|
9415
11377
|
});
|
|
9416
11378
|
case 3:
|
|
9417
|
-
return
|
|
11379
|
+
return _context34.a(2);
|
|
9418
11380
|
}
|
|
9419
|
-
},
|
|
11381
|
+
}, _callee34, this);
|
|
9420
11382
|
}));
|
|
9421
11383
|
});
|
|
9422
|
-
__publicField(
|
|
9423
|
-
return
|
|
11384
|
+
__publicField(_this21, "setLang", function (lang) {
|
|
11385
|
+
return _this21.setState({
|
|
9424
11386
|
lang: lang
|
|
9425
11387
|
});
|
|
9426
11388
|
});
|
|
9427
|
-
__publicField(
|
|
9428
|
-
return
|
|
11389
|
+
__publicField(_this21, "setTone", function (tone) {
|
|
11390
|
+
return _this21.setState({
|
|
9429
11391
|
tone: tone
|
|
9430
11392
|
});
|
|
9431
11393
|
});
|
|
9432
|
-
__publicField(
|
|
9433
|
-
return
|
|
11394
|
+
__publicField(_this21, "setLength", function (length) {
|
|
11395
|
+
return _this21.setState({
|
|
9434
11396
|
length: length
|
|
9435
11397
|
});
|
|
9436
11398
|
});
|
|
9437
|
-
|
|
11399
|
+
_this21.rootRef = React__namespace.createRef();
|
|
9438
11400
|
var lang = (AI_LANG_FLAGS == null ? void 0 : AI_LANG_FLAGS.find(function (_item) {
|
|
9439
11401
|
return (_item == null ? void 0 : _item.value) === CURRENT_LANG;
|
|
9440
11402
|
})) || AI_LANG_FLAGS[0];
|
|
9441
|
-
|
|
11403
|
+
_this21.state = {
|
|
9442
11404
|
view: "empty",
|
|
9443
11405
|
sourceMail: null,
|
|
9444
11406
|
accountEmail: "",
|
|
@@ -9454,7 +11416,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9454
11416
|
length: getLengthOptions()[2],
|
|
9455
11417
|
conversationId: ""
|
|
9456
11418
|
};
|
|
9457
|
-
return
|
|
11419
|
+
return _this21;
|
|
9458
11420
|
}
|
|
9459
11421
|
_inherits(ReplyPanel, _React__namespace$Com9);
|
|
9460
11422
|
return _createClass(ReplyPanel, [{
|
|
@@ -9484,8 +11446,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9484
11446
|
if (view === "list") {
|
|
9485
11447
|
return /* @__PURE__ */React__namespace.createElement(MailListSelect, {
|
|
9486
11448
|
accountEmail: accountEmail,
|
|
9487
|
-
initialSelected: selectedMails.map(function (
|
|
9488
|
-
return
|
|
11449
|
+
initialSelected: selectedMails.map(function (m2) {
|
|
11450
|
+
return m2.mid;
|
|
9489
11451
|
}),
|
|
9490
11452
|
isConfirming: isLoadingSelected,
|
|
9491
11453
|
onCancel: this.handleListCancel,
|
|
@@ -9693,13 +11655,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9693
11655
|
padding: 2,
|
|
9694
11656
|
flexShrink: 0
|
|
9695
11657
|
}
|
|
9696
|
-
}, FILTERS.map(function (
|
|
9697
|
-
var isActive = mailtype ===
|
|
11658
|
+
}, FILTERS.map(function (f2) {
|
|
11659
|
+
var isActive = mailtype === f2.value;
|
|
9698
11660
|
return /* @__PURE__ */React__namespace.createElement("button", {
|
|
9699
|
-
key:
|
|
11661
|
+
key: f2.value,
|
|
9700
11662
|
type: "button",
|
|
9701
11663
|
onClick: function onClick() {
|
|
9702
|
-
return onChangeFilter(
|
|
11664
|
+
return onChangeFilter(f2.value);
|
|
9703
11665
|
},
|
|
9704
11666
|
style: {
|
|
9705
11667
|
border: "none",
|
|
@@ -9713,7 +11675,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9713
11675
|
fontFamily: "inherit",
|
|
9714
11676
|
transition: "background 0.15s ease-in-out"
|
|
9715
11677
|
}
|
|
9716
|
-
}, t(
|
|
11678
|
+
}, t(f2.label));
|
|
9717
11679
|
})));
|
|
9718
11680
|
};
|
|
9719
11681
|
var SummaryItem = function SummaryItem(_ref38) {
|
|
@@ -9777,33 +11739,33 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9777
11739
|
};
|
|
9778
11740
|
var LanguagePopover = /*#__PURE__*/function (_React__namespace$Com0) {
|
|
9779
11741
|
function LanguagePopover(props) {
|
|
9780
|
-
var
|
|
11742
|
+
var _this23;
|
|
9781
11743
|
_classCallCheck(this, LanguagePopover);
|
|
9782
|
-
|
|
9783
|
-
__publicField(
|
|
9784
|
-
__publicField(
|
|
9785
|
-
var anchorEl =
|
|
11744
|
+
_this23 = _callSuper(this, LanguagePopover, [props]);
|
|
11745
|
+
__publicField(_this23, "panelRef");
|
|
11746
|
+
__publicField(_this23, "updatePosition", function () {
|
|
11747
|
+
var anchorEl = _this23.props.anchorEl;
|
|
9786
11748
|
if (!anchorEl) return;
|
|
9787
11749
|
var rect = anchorEl.getBoundingClientRect();
|
|
9788
11750
|
var top = rect.bottom + (window.scrollY || document.documentElement.scrollTop) + 4;
|
|
9789
11751
|
var right = window.innerWidth - rect.right - (window.scrollX || document.documentElement.scrollLeft);
|
|
9790
|
-
|
|
11752
|
+
_this23.setState({
|
|
9791
11753
|
top: top,
|
|
9792
11754
|
left: window.innerWidth - right - 180
|
|
9793
11755
|
});
|
|
9794
11756
|
});
|
|
9795
|
-
__publicField(
|
|
11757
|
+
__publicField(_this23, "handleClickOutside", function (e) {
|
|
9796
11758
|
var target = e.target;
|
|
9797
|
-
if (
|
|
9798
|
-
|
|
11759
|
+
if (_this23.panelRef.current && !_this23.panelRef.current.contains(target) && _this23.props.anchorEl && !_this23.props.anchorEl.contains(target)) {
|
|
11760
|
+
_this23.props.onClose();
|
|
9799
11761
|
}
|
|
9800
11762
|
});
|
|
9801
|
-
|
|
9802
|
-
|
|
11763
|
+
_this23.panelRef = React__namespace.createRef();
|
|
11764
|
+
_this23.state = {
|
|
9803
11765
|
top: 0,
|
|
9804
11766
|
left: 0
|
|
9805
11767
|
};
|
|
9806
|
-
return
|
|
11768
|
+
return _this23;
|
|
9807
11769
|
}
|
|
9808
11770
|
_inherits(LanguagePopover, _React__namespace$Com0);
|
|
9809
11771
|
return _createClass(LanguagePopover, [{
|
|
@@ -9896,36 +11858,36 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9896
11858
|
};
|
|
9897
11859
|
var SummaryAIEmails = /*#__PURE__*/function (_React__namespace$Com1) {
|
|
9898
11860
|
function SummaryAIEmails(props) {
|
|
9899
|
-
var
|
|
11861
|
+
var _this24;
|
|
9900
11862
|
_classCallCheck(this, SummaryAIEmails);
|
|
9901
|
-
|
|
9902
|
-
__publicField(
|
|
9903
|
-
__publicField(
|
|
9904
|
-
if (
|
|
9905
|
-
|
|
9906
|
-
|
|
11863
|
+
_this24 = _callSuper(this, SummaryAIEmails, [props]);
|
|
11864
|
+
__publicField(_this24, "eventSource", null);
|
|
11865
|
+
__publicField(_this24, "closeStream", function () {
|
|
11866
|
+
if (_this24.eventSource) {
|
|
11867
|
+
_this24.eventSource.close();
|
|
11868
|
+
_this24.eventSource = null;
|
|
9907
11869
|
}
|
|
9908
11870
|
});
|
|
9909
|
-
__publicField(
|
|
9910
|
-
var targetEmail =
|
|
9911
|
-
var
|
|
9912
|
-
lang =
|
|
9913
|
-
mailtype =
|
|
9914
|
-
page =
|
|
11871
|
+
__publicField(_this24, "startStream", function () {
|
|
11872
|
+
var targetEmail = _this24.props.targetEmail;
|
|
11873
|
+
var _this24$state = _this24.state,
|
|
11874
|
+
lang = _this24$state.lang,
|
|
11875
|
+
mailtype = _this24$state.mailtype,
|
|
11876
|
+
page = _this24$state.page;
|
|
9915
11877
|
if (!targetEmail) return;
|
|
9916
|
-
|
|
9917
|
-
|
|
11878
|
+
_this24.closeStream();
|
|
11879
|
+
_this24.setState({
|
|
9918
11880
|
items: [],
|
|
9919
11881
|
isLoading: true
|
|
9920
11882
|
});
|
|
9921
11883
|
var url = "".concat(getBaseUrl(), "/email/ai/fromsumstreaming/").concat(encodeURIComponent(targetEmail), "/").concat(lang, "/").concat(PAGE_SIZE, "/").concat(page, "?mailtype=").concat(mailtype);
|
|
9922
11884
|
var es = new EventSource(url);
|
|
9923
|
-
|
|
11885
|
+
_this24.eventSource = es;
|
|
9924
11886
|
es.addEventListener("meta", function (ev) {
|
|
9925
11887
|
var _a2, _b, _c;
|
|
9926
11888
|
try {
|
|
9927
11889
|
var parsed = JSON.parse(ev.data || "{}");
|
|
9928
|
-
|
|
11890
|
+
_this24.setState({
|
|
9929
11891
|
meta: {
|
|
9930
11892
|
total: ((_a2 = parsed == null ? void 0 : parsed.counts) == null ? void 0 : _a2.total) || 0,
|
|
9931
11893
|
receive: ((_b = parsed == null ? void 0 : parsed.counts) == null ? void 0 : _b.receive) || 0,
|
|
@@ -9939,15 +11901,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9939
11901
|
es.onmessage = function (ev) {
|
|
9940
11902
|
if (!(ev == null ? void 0 : ev.data)) return;
|
|
9941
11903
|
if (ev.data === "[DONE]") {
|
|
9942
|
-
|
|
9943
|
-
|
|
11904
|
+
_this24.closeStream();
|
|
11905
|
+
_this24.setState({
|
|
9944
11906
|
isLoading: false
|
|
9945
11907
|
});
|
|
9946
11908
|
return;
|
|
9947
11909
|
}
|
|
9948
11910
|
var parsed = parseDataLine(ev.data);
|
|
9949
11911
|
if (parsed) {
|
|
9950
|
-
|
|
11912
|
+
_this24.setState(function (prev) {
|
|
9951
11913
|
return {
|
|
9952
11914
|
items: [].concat(_toConsumableArray(prev.items), [parsed]),
|
|
9953
11915
|
isLoading: false
|
|
@@ -9956,45 +11918,45 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9956
11918
|
}
|
|
9957
11919
|
};
|
|
9958
11920
|
es.onerror = function () {
|
|
9959
|
-
|
|
9960
|
-
|
|
11921
|
+
_this24.closeStream();
|
|
11922
|
+
_this24.setState({
|
|
9961
11923
|
isLoading: false
|
|
9962
11924
|
});
|
|
9963
11925
|
};
|
|
9964
11926
|
});
|
|
9965
|
-
__publicField(
|
|
9966
|
-
if (val ===
|
|
9967
|
-
|
|
11927
|
+
__publicField(_this24, "handleChangeFilter", function (val) {
|
|
11928
|
+
if (val === _this24.state.mailtype) return;
|
|
11929
|
+
_this24.setState({
|
|
9968
11930
|
mailtype: val,
|
|
9969
11931
|
page: 1
|
|
9970
11932
|
});
|
|
9971
11933
|
});
|
|
9972
|
-
__publicField(
|
|
9973
|
-
|
|
11934
|
+
__publicField(_this24, "handleChangeLang", function (val) {
|
|
11935
|
+
_this24.setState({
|
|
9974
11936
|
langAnchor: null
|
|
9975
11937
|
});
|
|
9976
|
-
if (val ===
|
|
9977
|
-
|
|
11938
|
+
if (val === _this24.state.lang) return;
|
|
11939
|
+
_this24.setState({
|
|
9978
11940
|
lang: val,
|
|
9979
11941
|
page: 1
|
|
9980
11942
|
});
|
|
9981
11943
|
});
|
|
9982
|
-
__publicField(
|
|
9983
|
-
|
|
11944
|
+
__publicField(_this24, "handleChangePage", function (page) {
|
|
11945
|
+
_this24.setState({
|
|
9984
11946
|
page: page
|
|
9985
11947
|
});
|
|
9986
11948
|
});
|
|
9987
|
-
__publicField(
|
|
9988
|
-
|
|
11949
|
+
__publicField(_this24, "handleOpenLang", function (anchor) {
|
|
11950
|
+
_this24.setState({
|
|
9989
11951
|
langAnchor: anchor
|
|
9990
11952
|
});
|
|
9991
11953
|
});
|
|
9992
|
-
__publicField(
|
|
9993
|
-
|
|
11954
|
+
__publicField(_this24, "handleCloseLang", function () {
|
|
11955
|
+
_this24.setState({
|
|
9994
11956
|
langAnchor: null
|
|
9995
11957
|
});
|
|
9996
11958
|
});
|
|
9997
|
-
|
|
11959
|
+
_this24.state = {
|
|
9998
11960
|
lang: CURRENT_LANG || "ko",
|
|
9999
11961
|
mailtype: "all",
|
|
10000
11962
|
page: 1,
|
|
@@ -10003,7 +11965,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
10003
11965
|
isLoading: false,
|
|
10004
11966
|
langAnchor: null
|
|
10005
11967
|
};
|
|
10006
|
-
return
|
|
11968
|
+
return _this24;
|
|
10007
11969
|
}
|
|
10008
11970
|
_inherits(SummaryAIEmails, _React__namespace$Com1);
|
|
10009
11971
|
return _createClass(SummaryAIEmails, [{
|