hanbiro-react16-sdk 1.0.32 → 1.0.34
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 +2664 -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 +17 -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.34
|
|
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,2179 @@ 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
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return locationInfo.pathname.includes("/ngw/app") ? "v2" : "v3";
|
|
158
|
-
};
|
|
159
|
-
var applyVersionAttribute = function applyVersionAttribute() {
|
|
160
|
-
if (typeof document === "undefined") return;
|
|
161
|
-
document.documentElement.setAttribute("data-hanbiro-sdk-version", getAppVersion());
|
|
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;
|
|
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;
|
|
170
2148
|
}
|
|
171
|
-
};
|
|
172
|
-
var
|
|
173
|
-
|
|
174
|
-
var
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
return "https://vndev.hanbiro.com";
|
|
2149
|
+
}, window.hanSessionStatus = L);
|
|
2150
|
+
var getSigner = function getSigner() {
|
|
2151
|
+
var _a2;
|
|
2152
|
+
var existed = (_a2 = window == null ? void 0 : window.parent) == null ? void 0 : _a2.HanSigCommon;
|
|
2153
|
+
if (existed) {
|
|
2154
|
+
return existed;
|
|
178
2155
|
} else {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
2156
|
+
return new W({
|
|
2157
|
+
baseUrl: getBaseUrl()
|
|
2158
|
+
});
|
|
182
2159
|
}
|
|
183
2160
|
};
|
|
184
|
-
var
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
2161
|
+
var apiGet = function apiGet(url, opts) {
|
|
2162
|
+
return __async(_this3, null, /*#__PURE__*/_regenerator().m(function _callee22() {
|
|
2163
|
+
var _a2, sigConfig, sigHeaders, response, data;
|
|
2164
|
+
return _regenerator().w(function (_context22) {
|
|
2165
|
+
while (1) switch (_context22.n) {
|
|
2166
|
+
case 0:
|
|
2167
|
+
sigConfig = {
|
|
2168
|
+
method: "POST",
|
|
2169
|
+
baseURL: getBaseUrl(),
|
|
2170
|
+
url: url
|
|
2171
|
+
};
|
|
2172
|
+
_context22.n = 1;
|
|
2173
|
+
return (_a2 = getSigner()) == null ? void 0 : _a2.generateHeaders(sigConfig);
|
|
2174
|
+
case 1:
|
|
2175
|
+
sigHeaders = _context22.v;
|
|
2176
|
+
_context22.n = 2;
|
|
2177
|
+
return fetch(getBaseUrl() + url, {
|
|
2178
|
+
headers: __spreadValues(__spreadValues({
|
|
2179
|
+
Accept: "application/json, text/plain, */*",
|
|
2180
|
+
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
|
|
2181
|
+
}, opts == null ? void 0 : opts.headers), sigHeaders)
|
|
2182
|
+
});
|
|
2183
|
+
case 2:
|
|
2184
|
+
response = _context22.v;
|
|
2185
|
+
data = null;
|
|
2186
|
+
if (!response.ok) {
|
|
2187
|
+
_context22.n = 4;
|
|
2188
|
+
break;
|
|
2189
|
+
}
|
|
2190
|
+
_context22.n = 3;
|
|
2191
|
+
return response.json();
|
|
2192
|
+
case 3:
|
|
2193
|
+
data = _context22.v;
|
|
2194
|
+
_context22.n = 5;
|
|
2195
|
+
break;
|
|
2196
|
+
case 4:
|
|
2197
|
+
console.error("HTTP error! status: ".concat(response.status));
|
|
2198
|
+
case 5:
|
|
2199
|
+
return _context22.a(2, {
|
|
2200
|
+
data: data,
|
|
2201
|
+
code: response.status,
|
|
2202
|
+
ok: response.ok
|
|
2203
|
+
});
|
|
2204
|
+
}
|
|
2205
|
+
}, _callee22);
|
|
2206
|
+
}));
|
|
206
2207
|
};
|
|
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
2208
|
function callAI(_0, _1) {
|
|
218
2209
|
return __async(this, arguments, function (params, _ref2) {
|
|
219
2210
|
var setContent = _ref2.setContent,
|
|
220
2211
|
setIsLoading = _ref2.setIsLoading,
|
|
221
2212
|
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 (
|
|
2213
|
+
return /*#__PURE__*/_regenerator().m(function _callee23() {
|
|
2214
|
+
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;
|
|
2215
|
+
return _regenerator().w(function (_context23) {
|
|
2216
|
+
while (1) switch (_context23.p = _context23.n) {
|
|
226
2217
|
case 0:
|
|
227
2218
|
currentContent = "";
|
|
228
2219
|
baseUrl = getBaseUrl();
|
|
229
|
-
|
|
2220
|
+
_context23.p = 1;
|
|
230
2221
|
setIsLoading(true);
|
|
231
|
-
|
|
2222
|
+
sigConfig = {
|
|
2223
|
+
method: "POST",
|
|
2224
|
+
baseURL: getBaseUrl(),
|
|
2225
|
+
url: "/nmail/chatdraft",
|
|
2226
|
+
params: params
|
|
2227
|
+
};
|
|
2228
|
+
_context23.n = 2;
|
|
2229
|
+
return (_a2 = getSigner()) == null ? void 0 : _a2.generateHeaders(sigConfig);
|
|
2230
|
+
case 2:
|
|
2231
|
+
sigHeaders = _context23.v;
|
|
2232
|
+
_context23.n = 3;
|
|
232
2233
|
return fetch("".concat(baseUrl, "/nmail/chatdraft"), {
|
|
233
2234
|
method: "POST",
|
|
234
2235
|
body: JSON.stringify(params),
|
|
235
|
-
headers: {
|
|
2236
|
+
headers: __spreadValues({
|
|
236
2237
|
"Content-Type": "application/json",
|
|
237
2238
|
"Access-Control-Allow-Origin": "*"
|
|
238
|
-
}
|
|
2239
|
+
}, sigHeaders)
|
|
239
2240
|
});
|
|
240
|
-
case
|
|
241
|
-
response =
|
|
2241
|
+
case 3:
|
|
2242
|
+
response = _context23.v;
|
|
242
2243
|
setIsLoading(false);
|
|
243
2244
|
if (response.body) {
|
|
244
|
-
|
|
2245
|
+
_context23.n = 4;
|
|
245
2246
|
break;
|
|
246
2247
|
}
|
|
247
2248
|
throw new Error("Response body is not available for streaming.");
|
|
248
|
-
case
|
|
2249
|
+
case 4:
|
|
249
2250
|
reader = response.body.getReader();
|
|
250
2251
|
fullContentDecode = "";
|
|
251
2252
|
readIndex = 0;
|
|
252
|
-
case
|
|
2253
|
+
case 5:
|
|
253
2254
|
if (!true) {
|
|
254
|
-
|
|
2255
|
+
_context23.n = 8;
|
|
255
2256
|
break;
|
|
256
2257
|
}
|
|
257
|
-
|
|
2258
|
+
_context23.n = 6;
|
|
258
2259
|
return reader.read();
|
|
259
|
-
case
|
|
260
|
-
_yield$reader$read =
|
|
2260
|
+
case 6:
|
|
2261
|
+
_yield$reader$read = _context23.v;
|
|
261
2262
|
done = _yield$reader$read.done;
|
|
262
2263
|
value = _yield$reader$read.value;
|
|
263
2264
|
if (!done) {
|
|
264
|
-
|
|
2265
|
+
_context23.n = 7;
|
|
265
2266
|
break;
|
|
266
2267
|
}
|
|
267
|
-
return
|
|
268
|
-
case
|
|
2268
|
+
return _context23.a(3, 8);
|
|
2269
|
+
case 7:
|
|
269
2270
|
originStr = "";
|
|
270
2271
|
jsonFormat = "";
|
|
271
2272
|
try {
|
|
@@ -298,23 +2299,23 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
298
2299
|
} catch (e) {
|
|
299
2300
|
console.error("TextDecoder error: ", e, originStr);
|
|
300
2301
|
}
|
|
301
|
-
|
|
2302
|
+
_context23.n = 5;
|
|
302
2303
|
break;
|
|
303
|
-
case 7:
|
|
304
|
-
return _context.a(2, currentContent);
|
|
305
2304
|
case 8:
|
|
306
|
-
|
|
307
|
-
_t = _context.v;
|
|
308
|
-
console.error("Summary error:", _t);
|
|
309
|
-
setContent("");
|
|
2305
|
+
return _context23.a(2, currentContent);
|
|
310
2306
|
case 9:
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
2307
|
+
_context23.p = 9;
|
|
2308
|
+
_t27 = _context23.v;
|
|
2309
|
+
console.error("Summary error:", _t27);
|
|
2310
|
+
setContent("");
|
|
314
2311
|
case 10:
|
|
315
|
-
|
|
2312
|
+
_context23.p = 10;
|
|
2313
|
+
setIsLoading(false);
|
|
2314
|
+
return _context23.f(10);
|
|
2315
|
+
case 11:
|
|
2316
|
+
return _context23.a(2, "");
|
|
316
2317
|
}
|
|
317
|
-
},
|
|
2318
|
+
}, _callee23, null, [[1, 9, 10, 11]]);
|
|
318
2319
|
})();
|
|
319
2320
|
});
|
|
320
2321
|
}
|
|
@@ -329,8 +2330,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
329
2330
|
var inner = first == null ? void 0 : first.match(/([^\s<>"]+@[^\s<>"]+)/);
|
|
330
2331
|
return inner ? inner[1] : first || "";
|
|
331
2332
|
};
|
|
332
|
-
function getDefaultExportFromCjs(
|
|
333
|
-
return
|
|
2333
|
+
function getDefaultExportFromCjs(x2) {
|
|
2334
|
+
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
334
2335
|
}
|
|
335
2336
|
var propTypes = {
|
|
336
2337
|
exports: {}
|
|
@@ -342,7 +2343,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
342
2343
|
function emptyFunctionWithReset() {}
|
|
343
2344
|
emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
|
344
2345
|
var factoryWithThrowingShims = function factoryWithThrowingShims() {
|
|
345
|
-
function shim(props, propName, componentName,
|
|
2346
|
+
function shim(props, propName, componentName, location2, propFullName, secret) {
|
|
346
2347
|
if (secret === ReactPropTypesSecret) {
|
|
347
2348
|
return;
|
|
348
2349
|
}
|
|
@@ -2347,52 +4348,52 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2347
4348
|
var GAP = 4;
|
|
2348
4349
|
var Tooltip = /*#__PURE__*/function (_React__namespace$Com) {
|
|
2349
4350
|
function Tooltip(props) {
|
|
2350
|
-
var
|
|
4351
|
+
var _this4;
|
|
2351
4352
|
_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
|
-
|
|
4353
|
+
_this4 = _callSuper(this, Tooltip, [props]);
|
|
4354
|
+
__publicField(_this4, "triggerRef");
|
|
4355
|
+
__publicField(_this4, "tooltipRef");
|
|
4356
|
+
__publicField(_this4, "enterTimer", null);
|
|
4357
|
+
__publicField(_this4, "leaveTimer", null);
|
|
4358
|
+
__publicField(_this4, "handleMouseEnter", function () {
|
|
4359
|
+
if (_this4.leaveTimer) {
|
|
4360
|
+
clearTimeout(_this4.leaveTimer);
|
|
4361
|
+
_this4.leaveTimer = null;
|
|
4362
|
+
}
|
|
4363
|
+
var enterDelay = _this4.props.enterDelay;
|
|
4364
|
+
_this4.enterTimer = setTimeout(function () {
|
|
4365
|
+
_this4.setState({
|
|
2365
4366
|
visible: true
|
|
2366
4367
|
}, function () {
|
|
2367
|
-
var coords =
|
|
2368
|
-
|
|
4368
|
+
var coords = _this4.computeCoords();
|
|
4369
|
+
_this4.setState({
|
|
2369
4370
|
coords: coords
|
|
2370
4371
|
});
|
|
2371
4372
|
});
|
|
2372
4373
|
}, enterDelay);
|
|
2373
4374
|
});
|
|
2374
|
-
__publicField(
|
|
2375
|
-
if (
|
|
2376
|
-
clearTimeout(
|
|
2377
|
-
|
|
2378
|
-
}
|
|
2379
|
-
var leaveDelay =
|
|
2380
|
-
|
|
2381
|
-
|
|
4375
|
+
__publicField(_this4, "handleMouseLeave", function () {
|
|
4376
|
+
if (_this4.enterTimer) {
|
|
4377
|
+
clearTimeout(_this4.enterTimer);
|
|
4378
|
+
_this4.enterTimer = null;
|
|
4379
|
+
}
|
|
4380
|
+
var leaveDelay = _this4.props.leaveDelay;
|
|
4381
|
+
_this4.leaveTimer = setTimeout(function () {
|
|
4382
|
+
_this4.setState({
|
|
2382
4383
|
visible: false
|
|
2383
4384
|
});
|
|
2384
4385
|
}, leaveDelay);
|
|
2385
4386
|
});
|
|
2386
|
-
|
|
4387
|
+
_this4.state = {
|
|
2387
4388
|
visible: false,
|
|
2388
4389
|
coords: {
|
|
2389
4390
|
top: 0,
|
|
2390
4391
|
left: 0
|
|
2391
4392
|
}
|
|
2392
4393
|
};
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
return
|
|
4394
|
+
_this4.triggerRef = React__namespace.createRef();
|
|
4395
|
+
_this4.tooltipRef = React__namespace.createRef();
|
|
4396
|
+
return _this4;
|
|
2396
4397
|
}
|
|
2397
4398
|
_inherits(Tooltip, _React__namespace$Com);
|
|
2398
4399
|
return _createClass(Tooltip, [{
|
|
@@ -2820,7 +4821,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2820
4821
|
}
|
|
2821
4822
|
return cells;
|
|
2822
4823
|
}
|
|
2823
|
-
function rtrim(str,
|
|
4824
|
+
function rtrim(str, c2, invert) {
|
|
2824
4825
|
var l = str.length;
|
|
2825
4826
|
if (l === 0) {
|
|
2826
4827
|
return "";
|
|
@@ -2828,7 +4829,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2828
4829
|
var suffLen = 0;
|
|
2829
4830
|
while (suffLen < l) {
|
|
2830
4831
|
var currChar = str.charAt(l - suffLen - 1);
|
|
2831
|
-
if (currChar ===
|
|
4832
|
+
if (currChar === c2 && true) {
|
|
2832
4833
|
suffLen++;
|
|
2833
4834
|
} else {
|
|
2834
4835
|
break;
|
|
@@ -2836,20 +4837,20 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2836
4837
|
}
|
|
2837
4838
|
return str.slice(0, l - suffLen);
|
|
2838
4839
|
}
|
|
2839
|
-
function findClosingBracket(str,
|
|
2840
|
-
if (str.indexOf(
|
|
4840
|
+
function findClosingBracket(str, b2) {
|
|
4841
|
+
if (str.indexOf(b2[1]) === -1) {
|
|
2841
4842
|
return -1;
|
|
2842
4843
|
}
|
|
2843
4844
|
var level = 0;
|
|
2844
|
-
for (var
|
|
2845
|
-
if (str[
|
|
2846
|
-
|
|
2847
|
-
} else if (str[
|
|
4845
|
+
for (var i = 0; i < str.length; i++) {
|
|
4846
|
+
if (str[i] === "\\") {
|
|
4847
|
+
i++;
|
|
4848
|
+
} else if (str[i] === b2[0]) {
|
|
2848
4849
|
level++;
|
|
2849
|
-
} else if (str[
|
|
4850
|
+
} else if (str[i] === b2[1]) {
|
|
2850
4851
|
level--;
|
|
2851
4852
|
if (level < 0) {
|
|
2852
|
-
return
|
|
4853
|
+
return i;
|
|
2853
4854
|
}
|
|
2854
4855
|
}
|
|
2855
4856
|
}
|
|
@@ -2989,18 +4990,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2989
4990
|
while (lines.length > 0) {
|
|
2990
4991
|
var inBlockquote = false;
|
|
2991
4992
|
var currentLines = [];
|
|
2992
|
-
var
|
|
2993
|
-
for (
|
|
2994
|
-
if (this.rules.other.blockquoteStart.test(lines[
|
|
2995
|
-
currentLines.push(lines[
|
|
4993
|
+
var i = void 0;
|
|
4994
|
+
for (i = 0; i < lines.length; i++) {
|
|
4995
|
+
if (this.rules.other.blockquoteStart.test(lines[i])) {
|
|
4996
|
+
currentLines.push(lines[i]);
|
|
2996
4997
|
inBlockquote = true;
|
|
2997
4998
|
} else if (!inBlockquote) {
|
|
2998
|
-
currentLines.push(lines[
|
|
4999
|
+
currentLines.push(lines[i]);
|
|
2999
5000
|
} else {
|
|
3000
5001
|
break;
|
|
3001
5002
|
}
|
|
3002
5003
|
}
|
|
3003
|
-
lines = lines.slice(
|
|
5004
|
+
lines = lines.slice(i);
|
|
3004
5005
|
var currentRaw = currentLines.join("\n");
|
|
3005
5006
|
var currentText = currentRaw.replace(this.rules.other.blockquoteSetextReplace, "\n $1").replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
3006
5007
|
raw = raw ? "".concat(raw, "\n").concat(currentRaw) : currentRaw;
|
|
@@ -3045,7 +5046,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3045
5046
|
}, {
|
|
3046
5047
|
key: "list",
|
|
3047
5048
|
value: function list(src) {
|
|
3048
|
-
var
|
|
5049
|
+
var _this5 = this;
|
|
3049
5050
|
var cap = this.rules.block.list.exec(src);
|
|
3050
5051
|
if (cap) {
|
|
3051
5052
|
var bull = cap[1].trim();
|
|
@@ -3192,22 +5193,22 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3192
5193
|
return;
|
|
3193
5194
|
}
|
|
3194
5195
|
list2.raw = list2.raw.trimEnd();
|
|
3195
|
-
for (var
|
|
5196
|
+
for (var i = 0; i < list2.items.length; i++) {
|
|
3196
5197
|
this.lexer.state.top = false;
|
|
3197
|
-
list2.items[
|
|
5198
|
+
list2.items[i].tokens = this.lexer.blockTokens(list2.items[i].text, []);
|
|
3198
5199
|
if (!list2.loose) {
|
|
3199
|
-
var spacers = list2.items[
|
|
5200
|
+
var spacers = list2.items[i].tokens.filter(function (t2) {
|
|
3200
5201
|
return t2.type === "space";
|
|
3201
5202
|
});
|
|
3202
5203
|
var hasMultipleLineBreaks = spacers.length > 0 && spacers.some(function (t2) {
|
|
3203
|
-
return
|
|
5204
|
+
return _this5.rules.other.anyLine.test(t2.raw);
|
|
3204
5205
|
});
|
|
3205
5206
|
list2.loose = hasMultipleLineBreaks;
|
|
3206
5207
|
}
|
|
3207
5208
|
}
|
|
3208
5209
|
if (list2.loose) {
|
|
3209
|
-
for (var
|
|
3210
|
-
list2.items[
|
|
5210
|
+
for (var _i6 = 0; _i6 < list2.items.length; _i6++) {
|
|
5211
|
+
list2.items[_i6].loose = true;
|
|
3211
5212
|
}
|
|
3212
5213
|
}
|
|
3213
5214
|
return list2;
|
|
@@ -3248,7 +5249,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3248
5249
|
}, {
|
|
3249
5250
|
key: "table",
|
|
3250
5251
|
value: function table(src) {
|
|
3251
|
-
var
|
|
5252
|
+
var _this6 = this;
|
|
3252
5253
|
var _a2;
|
|
3253
5254
|
var cap = this.rules.block.table.exec(src);
|
|
3254
5255
|
if (!cap) {
|
|
@@ -3270,11 +5271,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3270
5271
|
if (headers.length !== aligns.length) {
|
|
3271
5272
|
return;
|
|
3272
5273
|
}
|
|
3273
|
-
var
|
|
3274
|
-
|
|
5274
|
+
var _iterator6 = _createForOfIteratorHelper(aligns),
|
|
5275
|
+
_step6;
|
|
3275
5276
|
try {
|
|
3276
|
-
for (
|
|
3277
|
-
var align =
|
|
5277
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
5278
|
+
var align = _step6.value;
|
|
3278
5279
|
if (this.rules.other.tableAlignRight.test(align)) {
|
|
3279
5280
|
item.align.push("right");
|
|
3280
5281
|
} else if (this.rules.other.tableAlignCenter.test(align)) {
|
|
@@ -3286,36 +5287,36 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3286
5287
|
}
|
|
3287
5288
|
}
|
|
3288
5289
|
} catch (err) {
|
|
3289
|
-
|
|
5290
|
+
_iterator6.e(err);
|
|
3290
5291
|
} finally {
|
|
3291
|
-
|
|
5292
|
+
_iterator6.f();
|
|
3292
5293
|
}
|
|
3293
|
-
for (var
|
|
5294
|
+
for (var i = 0; i < headers.length; i++) {
|
|
3294
5295
|
item.header.push({
|
|
3295
|
-
text: headers[
|
|
3296
|
-
tokens: this.lexer.inline(headers[
|
|
5296
|
+
text: headers[i],
|
|
5297
|
+
tokens: this.lexer.inline(headers[i]),
|
|
3297
5298
|
header: true,
|
|
3298
|
-
align: item.align[
|
|
5299
|
+
align: item.align[i]
|
|
3299
5300
|
});
|
|
3300
5301
|
}
|
|
3301
|
-
var
|
|
3302
|
-
|
|
5302
|
+
var _iterator7 = _createForOfIteratorHelper(rows),
|
|
5303
|
+
_step7;
|
|
3303
5304
|
try {
|
|
3304
|
-
for (
|
|
3305
|
-
var row =
|
|
5305
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
5306
|
+
var row = _step7.value;
|
|
3306
5307
|
item.rows.push(splitCells(row, item.header.length).map(function (cell, i) {
|
|
3307
5308
|
return {
|
|
3308
5309
|
text: cell,
|
|
3309
|
-
tokens:
|
|
5310
|
+
tokens: _this6.lexer.inline(cell),
|
|
3310
5311
|
header: false,
|
|
3311
5312
|
align: item.align[i]
|
|
3312
5313
|
};
|
|
3313
5314
|
}));
|
|
3314
5315
|
}
|
|
3315
5316
|
} catch (err) {
|
|
3316
|
-
|
|
5317
|
+
_iterator7.e(err);
|
|
3317
5318
|
} finally {
|
|
3318
|
-
|
|
5319
|
+
_iterator7.f();
|
|
3319
5320
|
}
|
|
3320
5321
|
return item;
|
|
3321
5322
|
}
|
|
@@ -3692,8 +5693,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3692
5693
|
function lex(src) {
|
|
3693
5694
|
src = src.replace(other.carriageReturn, "\n");
|
|
3694
5695
|
this.blockTokens(src, this.tokens);
|
|
3695
|
-
for (var
|
|
3696
|
-
var next = this.inlineQueue[
|
|
5696
|
+
for (var i = 0; i < this.inlineQueue.length; i++) {
|
|
5697
|
+
var next = this.inlineQueue[i];
|
|
3697
5698
|
this.inlineTokens(next.src, next.tokens);
|
|
3698
5699
|
}
|
|
3699
5700
|
this.inlineQueue = [];
|
|
@@ -3702,7 +5703,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3702
5703
|
}, {
|
|
3703
5704
|
key: "blockTokens",
|
|
3704
5705
|
value: function blockTokens(src) {
|
|
3705
|
-
var
|
|
5706
|
+
var _this7 = this;
|
|
3706
5707
|
var tokens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
3707
5708
|
var lastParagraphClipped = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
3708
5709
|
var _a2, _b, _c;
|
|
@@ -3711,9 +5712,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3711
5712
|
}
|
|
3712
5713
|
var _loop2 = function _loop2() {
|
|
3713
5714
|
var token;
|
|
3714
|
-
if ((_b = (_a2 =
|
|
5715
|
+
if ((_b = (_a2 = _this7.options.extensions) == null ? void 0 : _a2.block) == null ? void 0 : _b.some(function (extTokenizer) {
|
|
3715
5716
|
if (token = extTokenizer.call({
|
|
3716
|
-
lexer:
|
|
5717
|
+
lexer: _this7
|
|
3717
5718
|
}, src, tokens)) {
|
|
3718
5719
|
src = src.substring(token.raw.length);
|
|
3719
5720
|
tokens.push(token);
|
|
@@ -3723,7 +5724,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3723
5724
|
})) {
|
|
3724
5725
|
return 0; // continue
|
|
3725
5726
|
}
|
|
3726
|
-
if (token =
|
|
5727
|
+
if (token = _this7.tokenizer.space(src)) {
|
|
3727
5728
|
src = src.substring(token.raw.length);
|
|
3728
5729
|
var lastToken = tokens.at(-1);
|
|
3729
5730
|
if (token.raw.length === 1 && lastToken !== void 0) {
|
|
@@ -3733,81 +5734,81 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3733
5734
|
}
|
|
3734
5735
|
return 0; // continue
|
|
3735
5736
|
}
|
|
3736
|
-
if (token =
|
|
5737
|
+
if (token = _this7.tokenizer.code(src)) {
|
|
3737
5738
|
src = src.substring(token.raw.length);
|
|
3738
5739
|
var _lastToken = tokens.at(-1);
|
|
3739
5740
|
if ((_lastToken == null ? void 0 : _lastToken.type) === "paragraph" || (_lastToken == null ? void 0 : _lastToken.type) === "text") {
|
|
3740
5741
|
_lastToken.raw += "\n" + token.raw;
|
|
3741
5742
|
_lastToken.text += "\n" + token.text;
|
|
3742
|
-
|
|
5743
|
+
_this7.inlineQueue.at(-1).src = _lastToken.text;
|
|
3743
5744
|
} else {
|
|
3744
5745
|
tokens.push(token);
|
|
3745
5746
|
}
|
|
3746
5747
|
return 0; // continue
|
|
3747
5748
|
}
|
|
3748
|
-
if (token =
|
|
5749
|
+
if (token = _this7.tokenizer.fences(src)) {
|
|
3749
5750
|
src = src.substring(token.raw.length);
|
|
3750
5751
|
tokens.push(token);
|
|
3751
5752
|
return 0; // continue
|
|
3752
5753
|
}
|
|
3753
|
-
if (token =
|
|
5754
|
+
if (token = _this7.tokenizer.heading(src)) {
|
|
3754
5755
|
src = src.substring(token.raw.length);
|
|
3755
5756
|
tokens.push(token);
|
|
3756
5757
|
return 0; // continue
|
|
3757
5758
|
}
|
|
3758
|
-
if (token =
|
|
5759
|
+
if (token = _this7.tokenizer.hr(src)) {
|
|
3759
5760
|
src = src.substring(token.raw.length);
|
|
3760
5761
|
tokens.push(token);
|
|
3761
5762
|
return 0; // continue
|
|
3762
5763
|
}
|
|
3763
|
-
if (token =
|
|
5764
|
+
if (token = _this7.tokenizer.blockquote(src)) {
|
|
3764
5765
|
src = src.substring(token.raw.length);
|
|
3765
5766
|
tokens.push(token);
|
|
3766
5767
|
return 0; // continue
|
|
3767
5768
|
}
|
|
3768
|
-
if (token =
|
|
5769
|
+
if (token = _this7.tokenizer.list(src)) {
|
|
3769
5770
|
src = src.substring(token.raw.length);
|
|
3770
5771
|
tokens.push(token);
|
|
3771
5772
|
return 0; // continue
|
|
3772
5773
|
}
|
|
3773
|
-
if (token =
|
|
5774
|
+
if (token = _this7.tokenizer.html(src)) {
|
|
3774
5775
|
src = src.substring(token.raw.length);
|
|
3775
5776
|
tokens.push(token);
|
|
3776
5777
|
return 0; // continue
|
|
3777
5778
|
}
|
|
3778
|
-
if (token =
|
|
5779
|
+
if (token = _this7.tokenizer.def(src)) {
|
|
3779
5780
|
src = src.substring(token.raw.length);
|
|
3780
5781
|
var _lastToken2 = tokens.at(-1);
|
|
3781
5782
|
if ((_lastToken2 == null ? void 0 : _lastToken2.type) === "paragraph" || (_lastToken2 == null ? void 0 : _lastToken2.type) === "text") {
|
|
3782
5783
|
_lastToken2.raw += "\n" + token.raw;
|
|
3783
5784
|
_lastToken2.text += "\n" + token.raw;
|
|
3784
|
-
|
|
3785
|
-
} else if (!
|
|
3786
|
-
|
|
5785
|
+
_this7.inlineQueue.at(-1).src = _lastToken2.text;
|
|
5786
|
+
} else if (!_this7.tokens.links[token.tag]) {
|
|
5787
|
+
_this7.tokens.links[token.tag] = {
|
|
3787
5788
|
href: token.href,
|
|
3788
5789
|
title: token.title
|
|
3789
5790
|
};
|
|
3790
5791
|
}
|
|
3791
5792
|
return 0; // continue
|
|
3792
5793
|
}
|
|
3793
|
-
if (token =
|
|
5794
|
+
if (token = _this7.tokenizer.table(src)) {
|
|
3794
5795
|
src = src.substring(token.raw.length);
|
|
3795
5796
|
tokens.push(token);
|
|
3796
5797
|
return 0; // continue
|
|
3797
5798
|
}
|
|
3798
|
-
if (token =
|
|
5799
|
+
if (token = _this7.tokenizer.lheading(src)) {
|
|
3799
5800
|
src = src.substring(token.raw.length);
|
|
3800
5801
|
tokens.push(token);
|
|
3801
5802
|
return 0; // continue
|
|
3802
5803
|
}
|
|
3803
5804
|
var cutSrc = src;
|
|
3804
|
-
if ((_c =
|
|
5805
|
+
if ((_c = _this7.options.extensions) == null ? void 0 : _c.startBlock) {
|
|
3805
5806
|
var startIndex = Infinity;
|
|
3806
5807
|
var tempSrc = src.slice(1);
|
|
3807
5808
|
var tempStart;
|
|
3808
|
-
|
|
5809
|
+
_this7.options.extensions.startBlock.forEach(function (getStartIndex) {
|
|
3809
5810
|
tempStart = getStartIndex.call({
|
|
3810
|
-
lexer:
|
|
5811
|
+
lexer: _this7
|
|
3811
5812
|
}, tempSrc);
|
|
3812
5813
|
if (typeof tempStart === "number" && tempStart >= 0) {
|
|
3813
5814
|
startIndex = Math.min(startIndex, tempStart);
|
|
@@ -3817,13 +5818,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3817
5818
|
cutSrc = src.substring(0, startIndex + 1);
|
|
3818
5819
|
}
|
|
3819
5820
|
}
|
|
3820
|
-
if (
|
|
5821
|
+
if (_this7.state.top && (token = _this7.tokenizer.paragraph(cutSrc))) {
|
|
3821
5822
|
var _lastToken3 = tokens.at(-1);
|
|
3822
5823
|
if (lastParagraphClipped && (_lastToken3 == null ? void 0 : _lastToken3.type) === "paragraph") {
|
|
3823
5824
|
_lastToken3.raw += "\n" + token.raw;
|
|
3824
5825
|
_lastToken3.text += "\n" + token.text;
|
|
3825
|
-
|
|
3826
|
-
|
|
5826
|
+
_this7.inlineQueue.pop();
|
|
5827
|
+
_this7.inlineQueue.at(-1).src = _lastToken3.text;
|
|
3827
5828
|
} else {
|
|
3828
5829
|
tokens.push(token);
|
|
3829
5830
|
}
|
|
@@ -3831,14 +5832,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3831
5832
|
src = src.substring(token.raw.length);
|
|
3832
5833
|
return 0; // continue
|
|
3833
5834
|
}
|
|
3834
|
-
if (token =
|
|
5835
|
+
if (token = _this7.tokenizer.text(src)) {
|
|
3835
5836
|
src = src.substring(token.raw.length);
|
|
3836
5837
|
var _lastToken4 = tokens.at(-1);
|
|
3837
5838
|
if ((_lastToken4 == null ? void 0 : _lastToken4.type) === "text") {
|
|
3838
5839
|
_lastToken4.raw += "\n" + token.raw;
|
|
3839
5840
|
_lastToken4.text += "\n" + token.text;
|
|
3840
|
-
|
|
3841
|
-
|
|
5841
|
+
_this7.inlineQueue.pop();
|
|
5842
|
+
_this7.inlineQueue.at(-1).src = _lastToken4.text;
|
|
3842
5843
|
} else {
|
|
3843
5844
|
tokens.push(token);
|
|
3844
5845
|
}
|
|
@@ -3846,7 +5847,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3846
5847
|
}
|
|
3847
5848
|
if (src) {
|
|
3848
5849
|
var errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
|
|
3849
|
-
if (
|
|
5850
|
+
if (_this7.options.silent) {
|
|
3850
5851
|
console.error(errMsg);
|
|
3851
5852
|
return 1; // break
|
|
3852
5853
|
} else {
|
|
@@ -3879,7 +5880,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3879
5880
|
}, {
|
|
3880
5881
|
key: "inlineTokens",
|
|
3881
5882
|
value: function inlineTokens(src) {
|
|
3882
|
-
var
|
|
5883
|
+
var _this8 = this;
|
|
3883
5884
|
var tokens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
3884
5885
|
var _a2, _b, _c;
|
|
3885
5886
|
var maskedSrc = src;
|
|
@@ -3908,9 +5909,9 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3908
5909
|
}
|
|
3909
5910
|
keepPrevChar = false;
|
|
3910
5911
|
var token;
|
|
3911
|
-
if ((_b = (_a2 =
|
|
5912
|
+
if ((_b = (_a2 = _this8.options.extensions) == null ? void 0 : _a2.inline) == null ? void 0 : _b.some(function (extTokenizer) {
|
|
3912
5913
|
if (token = extTokenizer.call({
|
|
3913
|
-
lexer:
|
|
5914
|
+
lexer: _this8
|
|
3914
5915
|
}, src, tokens)) {
|
|
3915
5916
|
src = src.substring(token.raw.length);
|
|
3916
5917
|
tokens.push(token);
|
|
@@ -3920,22 +5921,22 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3920
5921
|
})) {
|
|
3921
5922
|
return 0; // continue
|
|
3922
5923
|
}
|
|
3923
|
-
if (token =
|
|
5924
|
+
if (token = _this8.tokenizer.escape(src)) {
|
|
3924
5925
|
src = src.substring(token.raw.length);
|
|
3925
5926
|
tokens.push(token);
|
|
3926
5927
|
return 0; // continue
|
|
3927
5928
|
}
|
|
3928
|
-
if (token =
|
|
5929
|
+
if (token = _this8.tokenizer.tag(src)) {
|
|
3929
5930
|
src = src.substring(token.raw.length);
|
|
3930
5931
|
tokens.push(token);
|
|
3931
5932
|
return 0; // continue
|
|
3932
5933
|
}
|
|
3933
|
-
if (token =
|
|
5934
|
+
if (token = _this8.tokenizer.link(src)) {
|
|
3934
5935
|
src = src.substring(token.raw.length);
|
|
3935
5936
|
tokens.push(token);
|
|
3936
5937
|
return 0; // continue
|
|
3937
5938
|
}
|
|
3938
|
-
if (token =
|
|
5939
|
+
if (token = _this8.tokenizer.reflink(src, _this8.tokens.links)) {
|
|
3939
5940
|
src = src.substring(token.raw.length);
|
|
3940
5941
|
var lastToken = tokens.at(-1);
|
|
3941
5942
|
if (token.type === "text" && (lastToken == null ? void 0 : lastToken.type) === "text") {
|
|
@@ -3946,44 +5947,44 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3946
5947
|
}
|
|
3947
5948
|
return 0; // continue
|
|
3948
5949
|
}
|
|
3949
|
-
if (token =
|
|
5950
|
+
if (token = _this8.tokenizer.emStrong(src, maskedSrc, prevChar)) {
|
|
3950
5951
|
src = src.substring(token.raw.length);
|
|
3951
5952
|
tokens.push(token);
|
|
3952
5953
|
return 0; // continue
|
|
3953
5954
|
}
|
|
3954
|
-
if (token =
|
|
5955
|
+
if (token = _this8.tokenizer.codespan(src)) {
|
|
3955
5956
|
src = src.substring(token.raw.length);
|
|
3956
5957
|
tokens.push(token);
|
|
3957
5958
|
return 0; // continue
|
|
3958
5959
|
}
|
|
3959
|
-
if (token =
|
|
5960
|
+
if (token = _this8.tokenizer.br(src)) {
|
|
3960
5961
|
src = src.substring(token.raw.length);
|
|
3961
5962
|
tokens.push(token);
|
|
3962
5963
|
return 0; // continue
|
|
3963
5964
|
}
|
|
3964
|
-
if (token =
|
|
5965
|
+
if (token = _this8.tokenizer.del(src)) {
|
|
3965
5966
|
src = src.substring(token.raw.length);
|
|
3966
5967
|
tokens.push(token);
|
|
3967
5968
|
return 0; // continue
|
|
3968
5969
|
}
|
|
3969
|
-
if (token =
|
|
5970
|
+
if (token = _this8.tokenizer.autolink(src)) {
|
|
3970
5971
|
src = src.substring(token.raw.length);
|
|
3971
5972
|
tokens.push(token);
|
|
3972
5973
|
return 0; // continue
|
|
3973
5974
|
}
|
|
3974
|
-
if (!
|
|
5975
|
+
if (!_this8.state.inLink && (token = _this8.tokenizer.url(src))) {
|
|
3975
5976
|
src = src.substring(token.raw.length);
|
|
3976
5977
|
tokens.push(token);
|
|
3977
5978
|
return 0; // continue
|
|
3978
5979
|
}
|
|
3979
5980
|
var cutSrc = src;
|
|
3980
|
-
if ((_c =
|
|
5981
|
+
if ((_c = _this8.options.extensions) == null ? void 0 : _c.startInline) {
|
|
3981
5982
|
var startIndex = Infinity;
|
|
3982
5983
|
var tempSrc = src.slice(1);
|
|
3983
5984
|
var tempStart;
|
|
3984
|
-
|
|
5985
|
+
_this8.options.extensions.startInline.forEach(function (getStartIndex) {
|
|
3985
5986
|
tempStart = getStartIndex.call({
|
|
3986
|
-
lexer:
|
|
5987
|
+
lexer: _this8
|
|
3987
5988
|
}, tempSrc);
|
|
3988
5989
|
if (typeof tempStart === "number" && tempStart >= 0) {
|
|
3989
5990
|
startIndex = Math.min(startIndex, tempStart);
|
|
@@ -3993,7 +5994,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
3993
5994
|
cutSrc = src.substring(0, startIndex + 1);
|
|
3994
5995
|
}
|
|
3995
5996
|
}
|
|
3996
|
-
if (token =
|
|
5997
|
+
if (token = _this8.tokenizer.inlineText(cutSrc)) {
|
|
3997
5998
|
src = src.substring(token.raw.length);
|
|
3998
5999
|
if (token.raw.slice(-1) !== "_") {
|
|
3999
6000
|
prevChar = token.raw.slice(-1);
|
|
@@ -4010,7 +6011,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4010
6011
|
}
|
|
4011
6012
|
if (src) {
|
|
4012
6013
|
var errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
|
|
4013
|
-
if (
|
|
6014
|
+
if (_this8.options.silent) {
|
|
4014
6015
|
console.error(errMsg);
|
|
4015
6016
|
return 1; // break
|
|
4016
6017
|
} else {
|
|
@@ -4112,8 +6113,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4112
6113
|
var ordered = token.ordered;
|
|
4113
6114
|
var start = token.start;
|
|
4114
6115
|
var body = "";
|
|
4115
|
-
for (var
|
|
4116
|
-
var item = token.items[
|
|
6116
|
+
for (var j2 = 0; j2 < token.items.length; j2++) {
|
|
6117
|
+
var item = token.items[j2];
|
|
4117
6118
|
body += this.listitem(item);
|
|
4118
6119
|
}
|
|
4119
6120
|
var type = ordered ? "ol" : "ul";
|
|
@@ -4168,8 +6169,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4168
6169
|
value: function table(token) {
|
|
4169
6170
|
var header = "";
|
|
4170
6171
|
var cell = "";
|
|
4171
|
-
for (var
|
|
4172
|
-
cell += this.tablecell(token.header[
|
|
6172
|
+
for (var j2 = 0; j2 < token.header.length; j2++) {
|
|
6173
|
+
cell += this.tablecell(token.header[j2]);
|
|
4173
6174
|
}
|
|
4174
6175
|
header += this.tablerow({
|
|
4175
6176
|
text: cell
|
|
@@ -4178,8 +6179,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4178
6179
|
for (var _j = 0; _j < token.rows.length; _j++) {
|
|
4179
6180
|
var row = token.rows[_j];
|
|
4180
6181
|
cell = "";
|
|
4181
|
-
for (var
|
|
4182
|
-
cell += this.tablecell(row[
|
|
6182
|
+
for (var k2 = 0; k2 < row.length; k2++) {
|
|
6183
|
+
cell += this.tablecell(row[k2]);
|
|
4183
6184
|
}
|
|
4184
6185
|
body += this.tablerow({
|
|
4185
6186
|
text: cell
|
|
@@ -4369,8 +6370,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4369
6370
|
var top = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
4370
6371
|
var _a2, _b;
|
|
4371
6372
|
var out = "";
|
|
4372
|
-
for (var
|
|
4373
|
-
var anyToken = tokens[
|
|
6373
|
+
for (var i = 0; i < tokens.length; i++) {
|
|
6374
|
+
var anyToken = tokens[i];
|
|
4374
6375
|
if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[anyToken.type]) {
|
|
4375
6376
|
var genericToken = anyToken;
|
|
4376
6377
|
var ret = this.options.extensions.renderers[genericToken.type].call({
|
|
@@ -4432,8 +6433,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4432
6433
|
{
|
|
4433
6434
|
var textToken = token;
|
|
4434
6435
|
var body = this.renderer.text(textToken);
|
|
4435
|
-
while (
|
|
4436
|
-
textToken = tokens[++
|
|
6436
|
+
while (i + 1 < tokens.length && tokens[i + 1].type === "text") {
|
|
6437
|
+
textToken = tokens[++i];
|
|
4437
6438
|
body += "\n" + this.renderer.text(textToken);
|
|
4438
6439
|
}
|
|
4439
6440
|
if (top) {
|
|
@@ -4476,8 +6477,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4476
6477
|
var renderer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.renderer;
|
|
4477
6478
|
var _a2, _b;
|
|
4478
6479
|
var out = "";
|
|
4479
|
-
for (var
|
|
4480
|
-
var anyToken = tokens[
|
|
6480
|
+
for (var i = 0; i < tokens.length; i++) {
|
|
6481
|
+
var anyToken = tokens[i];
|
|
4481
6482
|
if ((_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.renderers) == null ? void 0 : _b[anyToken.type]) {
|
|
4482
6483
|
var ret = this.options.extensions.renderers[anyToken.type].call({
|
|
4483
6484
|
parser: this
|
|
@@ -4640,100 +6641,100 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4640
6641
|
return _createClass(Marked, [{
|
|
4641
6642
|
key: "walkTokens",
|
|
4642
6643
|
value: function walkTokens(tokens, callback) {
|
|
4643
|
-
var
|
|
6644
|
+
var _this9 = this;
|
|
4644
6645
|
var _a2, _b;
|
|
4645
6646
|
var values = [];
|
|
4646
|
-
var
|
|
4647
|
-
|
|
6647
|
+
var _iterator8 = _createForOfIteratorHelper(tokens),
|
|
6648
|
+
_step8;
|
|
4648
6649
|
try {
|
|
4649
6650
|
var _loop4 = function _loop4() {
|
|
4650
|
-
var token =
|
|
4651
|
-
values = values.concat(callback.call(
|
|
6651
|
+
var token = _step8.value;
|
|
6652
|
+
values = values.concat(callback.call(_this9, token));
|
|
4652
6653
|
switch (token.type) {
|
|
4653
6654
|
case "table":
|
|
4654
6655
|
{
|
|
4655
6656
|
var tableToken = token;
|
|
4656
|
-
var
|
|
4657
|
-
|
|
6657
|
+
var _iterator9 = _createForOfIteratorHelper(tableToken.header),
|
|
6658
|
+
_step9;
|
|
4658
6659
|
try {
|
|
4659
|
-
for (
|
|
4660
|
-
var cell =
|
|
4661
|
-
values = values.concat(
|
|
6660
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
6661
|
+
var cell = _step9.value;
|
|
6662
|
+
values = values.concat(_this9.walkTokens(cell.tokens, callback));
|
|
4662
6663
|
}
|
|
4663
6664
|
} catch (err) {
|
|
4664
|
-
|
|
6665
|
+
_iterator9.e(err);
|
|
4665
6666
|
} finally {
|
|
4666
|
-
|
|
6667
|
+
_iterator9.f();
|
|
4667
6668
|
}
|
|
4668
|
-
var
|
|
4669
|
-
|
|
6669
|
+
var _iterator0 = _createForOfIteratorHelper(tableToken.rows),
|
|
6670
|
+
_step0;
|
|
4670
6671
|
try {
|
|
4671
|
-
for (
|
|
4672
|
-
var row =
|
|
4673
|
-
var
|
|
4674
|
-
|
|
6672
|
+
for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
|
|
6673
|
+
var row = _step0.value;
|
|
6674
|
+
var _iterator1 = _createForOfIteratorHelper(row),
|
|
6675
|
+
_step1;
|
|
4675
6676
|
try {
|
|
4676
|
-
for (
|
|
4677
|
-
var _cell =
|
|
4678
|
-
values = values.concat(
|
|
6677
|
+
for (_iterator1.s(); !(_step1 = _iterator1.n()).done;) {
|
|
6678
|
+
var _cell = _step1.value;
|
|
6679
|
+
values = values.concat(_this9.walkTokens(_cell.tokens, callback));
|
|
4679
6680
|
}
|
|
4680
6681
|
} catch (err) {
|
|
4681
|
-
|
|
6682
|
+
_iterator1.e(err);
|
|
4682
6683
|
} finally {
|
|
4683
|
-
|
|
6684
|
+
_iterator1.f();
|
|
4684
6685
|
}
|
|
4685
6686
|
}
|
|
4686
6687
|
} catch (err) {
|
|
4687
|
-
|
|
6688
|
+
_iterator0.e(err);
|
|
4688
6689
|
} finally {
|
|
4689
|
-
|
|
6690
|
+
_iterator0.f();
|
|
4690
6691
|
}
|
|
4691
6692
|
break;
|
|
4692
6693
|
}
|
|
4693
6694
|
case "list":
|
|
4694
6695
|
{
|
|
4695
6696
|
var listToken = token;
|
|
4696
|
-
values = values.concat(
|
|
6697
|
+
values = values.concat(_this9.walkTokens(listToken.items, callback));
|
|
4697
6698
|
break;
|
|
4698
6699
|
}
|
|
4699
6700
|
default:
|
|
4700
6701
|
{
|
|
4701
6702
|
var genericToken = token;
|
|
4702
|
-
if ((_b = (_a2 =
|
|
4703
|
-
|
|
6703
|
+
if ((_b = (_a2 = _this9.defaults.extensions) == null ? void 0 : _a2.childTokens) == null ? void 0 : _b[genericToken.type]) {
|
|
6704
|
+
_this9.defaults.extensions.childTokens[genericToken.type].forEach(function (childTokens) {
|
|
4704
6705
|
var tokens2 = genericToken[childTokens].flat(Infinity);
|
|
4705
|
-
values = values.concat(
|
|
6706
|
+
values = values.concat(_this9.walkTokens(tokens2, callback));
|
|
4706
6707
|
});
|
|
4707
6708
|
} else if (genericToken.tokens) {
|
|
4708
|
-
values = values.concat(
|
|
6709
|
+
values = values.concat(_this9.walkTokens(genericToken.tokens, callback));
|
|
4709
6710
|
}
|
|
4710
6711
|
}
|
|
4711
6712
|
}
|
|
4712
6713
|
};
|
|
4713
|
-
for (
|
|
6714
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
4714
6715
|
_loop4();
|
|
4715
6716
|
}
|
|
4716
6717
|
} catch (err) {
|
|
4717
|
-
|
|
6718
|
+
_iterator8.e(err);
|
|
4718
6719
|
} finally {
|
|
4719
|
-
|
|
6720
|
+
_iterator8.f();
|
|
4720
6721
|
}
|
|
4721
6722
|
return values;
|
|
4722
6723
|
}
|
|
4723
6724
|
}, {
|
|
4724
6725
|
key: "use",
|
|
4725
6726
|
value: function use() {
|
|
4726
|
-
var
|
|
6727
|
+
var _this0 = this;
|
|
4727
6728
|
var extensions = this.defaults.extensions || {
|
|
4728
6729
|
renderers: {},
|
|
4729
6730
|
childTokens: {}
|
|
4730
6731
|
};
|
|
4731
|
-
for (var
|
|
4732
|
-
args[
|
|
6732
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key7 = 0; _key7 < _len6; _key7++) {
|
|
6733
|
+
args[_key7] = arguments[_key7];
|
|
4733
6734
|
}
|
|
4734
6735
|
args.forEach(function (pack) {
|
|
4735
6736
|
var opts = __spreadValues({}, pack);
|
|
4736
|
-
opts.async =
|
|
6737
|
+
opts.async = _this0.defaults.async || opts.async || false;
|
|
4737
6738
|
if (pack.extensions) {
|
|
4738
6739
|
pack.extensions.forEach(function (ext) {
|
|
4739
6740
|
if (!ext.name) {
|
|
@@ -4743,8 +6744,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4743
6744
|
var prevRenderer = extensions.renderers[ext.name];
|
|
4744
6745
|
if (prevRenderer) {
|
|
4745
6746
|
extensions.renderers[ext.name] = function () {
|
|
4746
|
-
for (var
|
|
4747
|
-
args2[
|
|
6747
|
+
for (var _len7 = arguments.length, args2 = new Array(_len7), _key8 = 0; _key8 < _len7; _key8++) {
|
|
6748
|
+
args2[_key8] = arguments[_key8];
|
|
4748
6749
|
}
|
|
4749
6750
|
var ret = ext.renderer.apply(this, args2);
|
|
4750
6751
|
if (ret === false) {
|
|
@@ -4789,7 +6790,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4789
6790
|
opts.extensions = extensions;
|
|
4790
6791
|
}
|
|
4791
6792
|
if (pack.renderer) {
|
|
4792
|
-
var renderer =
|
|
6793
|
+
var renderer = _this0.defaults.renderer || new _Renderer(_this0.defaults);
|
|
4793
6794
|
var _loop5 = function _loop5() {
|
|
4794
6795
|
if (!(prop in renderer)) {
|
|
4795
6796
|
throw new Error("renderer '".concat(prop, "' does not exist"));
|
|
@@ -4801,8 +6802,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4801
6802
|
var rendererFunc = pack.renderer[rendererProp];
|
|
4802
6803
|
var prevRenderer = renderer[rendererProp];
|
|
4803
6804
|
renderer[rendererProp] = function () {
|
|
4804
|
-
for (var
|
|
4805
|
-
args2[
|
|
6805
|
+
for (var _len8 = arguments.length, args2 = new Array(_len8), _key9 = 0; _key9 < _len8; _key9++) {
|
|
6806
|
+
args2[_key9] = arguments[_key9];
|
|
4806
6807
|
}
|
|
4807
6808
|
var ret = rendererFunc.apply(renderer, args2);
|
|
4808
6809
|
if (ret === false) {
|
|
@@ -4817,7 +6818,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4817
6818
|
opts.renderer = renderer;
|
|
4818
6819
|
}
|
|
4819
6820
|
if (pack.tokenizer) {
|
|
4820
|
-
var tokenizer =
|
|
6821
|
+
var tokenizer = _this0.defaults.tokenizer || new _Tokenizer(_this0.defaults);
|
|
4821
6822
|
var _loop6 = function _loop6() {
|
|
4822
6823
|
if (!(_prop in tokenizer)) {
|
|
4823
6824
|
throw new Error("tokenizer '".concat(_prop, "' does not exist"));
|
|
@@ -4829,8 +6830,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4829
6830
|
var tokenizerFunc = pack.tokenizer[tokenizerProp];
|
|
4830
6831
|
var prevTokenizer = tokenizer[tokenizerProp];
|
|
4831
6832
|
tokenizer[tokenizerProp] = function () {
|
|
4832
|
-
for (var
|
|
4833
|
-
args2[
|
|
6833
|
+
for (var _len9 = arguments.length, args2 = new Array(_len9), _key0 = 0; _key0 < _len9; _key0++) {
|
|
6834
|
+
args2[_key0] = arguments[_key0];
|
|
4834
6835
|
}
|
|
4835
6836
|
var ret = tokenizerFunc.apply(tokenizer, args2);
|
|
4836
6837
|
if (ret === false) {
|
|
@@ -4845,7 +6846,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4845
6846
|
opts.tokenizer = tokenizer;
|
|
4846
6847
|
}
|
|
4847
6848
|
if (pack.hooks) {
|
|
4848
|
-
var hooks =
|
|
6849
|
+
var hooks = _this0.defaults.hooks || new _Hooks();
|
|
4849
6850
|
var _loop7 = function _loop7() {
|
|
4850
6851
|
if (!(_prop2 in hooks)) {
|
|
4851
6852
|
throw new Error("hook '".concat(_prop2, "' does not exist"));
|
|
@@ -4858,7 +6859,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4858
6859
|
var prevHook = hooks[hooksProp];
|
|
4859
6860
|
if (_Hooks.passThroughHooks.has(_prop2)) {
|
|
4860
6861
|
hooks[hooksProp] = function (arg) {
|
|
4861
|
-
if (
|
|
6862
|
+
if (_this0.defaults.async) {
|
|
4862
6863
|
return Promise.resolve(hooksFunc.call(hooks, arg)).then(function (ret2) {
|
|
4863
6864
|
return prevHook.call(hooks, ret2);
|
|
4864
6865
|
});
|
|
@@ -4868,8 +6869,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4868
6869
|
};
|
|
4869
6870
|
} else {
|
|
4870
6871
|
hooks[hooksProp] = function () {
|
|
4871
|
-
for (var
|
|
4872
|
-
args2[
|
|
6872
|
+
for (var _len0 = arguments.length, args2 = new Array(_len0), _key1 = 0; _key1 < _len0; _key1++) {
|
|
6873
|
+
args2[_key1] = arguments[_key1];
|
|
4873
6874
|
}
|
|
4874
6875
|
var ret = hooksFunc.apply(hooks, args2);
|
|
4875
6876
|
if (ret === false) {
|
|
@@ -4885,7 +6886,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4885
6886
|
opts.hooks = hooks;
|
|
4886
6887
|
}
|
|
4887
6888
|
if (pack.walkTokens) {
|
|
4888
|
-
var walkTokens2 =
|
|
6889
|
+
var walkTokens2 = _this0.defaults.walkTokens;
|
|
4889
6890
|
var packWalktokens = pack.walkTokens;
|
|
4890
6891
|
opts.walkTokens = function (token) {
|
|
4891
6892
|
var values = [];
|
|
@@ -4896,7 +6897,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4896
6897
|
return values;
|
|
4897
6898
|
};
|
|
4898
6899
|
}
|
|
4899
|
-
|
|
6900
|
+
_this0.defaults = __spreadValues(__spreadValues({}, _this0.defaults), opts);
|
|
4900
6901
|
});
|
|
4901
6902
|
return this;
|
|
4902
6903
|
}
|
|
@@ -4919,12 +6920,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4919
6920
|
}, {
|
|
4920
6921
|
key: "parseMarkdown",
|
|
4921
6922
|
value: function parseMarkdown(blockType) {
|
|
4922
|
-
var
|
|
6923
|
+
var _this1 = this;
|
|
4923
6924
|
var parse2 = function parse2(src, options2) {
|
|
4924
6925
|
var origOpt = __spreadValues({}, options2);
|
|
4925
|
-
var opt = __spreadValues(__spreadValues({},
|
|
4926
|
-
var throwError =
|
|
4927
|
-
if (
|
|
6926
|
+
var opt = __spreadValues(__spreadValues({}, _this1.defaults), origOpt);
|
|
6927
|
+
var throwError = _this1.onError(!!opt.silent, !!opt.async);
|
|
6928
|
+
if (_this1.defaults.async === true && origOpt.async === false) {
|
|
4928
6929
|
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
6930
|
}
|
|
4930
6931
|
if (typeof src === "undefined" || src === null) {
|
|
@@ -4945,7 +6946,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4945
6946
|
}).then(function (tokens) {
|
|
4946
6947
|
return opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens;
|
|
4947
6948
|
}).then(function (tokens) {
|
|
4948
|
-
return opt.walkTokens ? Promise.all(
|
|
6949
|
+
return opt.walkTokens ? Promise.all(_this1.walkTokens(tokens, opt.walkTokens)).then(function () {
|
|
4949
6950
|
return tokens;
|
|
4950
6951
|
}) : tokens;
|
|
4951
6952
|
}).then(function (tokens) {
|
|
@@ -4963,7 +6964,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4963
6964
|
tokens = opt.hooks.processAllTokens(tokens);
|
|
4964
6965
|
}
|
|
4965
6966
|
if (opt.walkTokens) {
|
|
4966
|
-
|
|
6967
|
+
_this1.walkTokens(tokens, opt.walkTokens);
|
|
4967
6968
|
}
|
|
4968
6969
|
var html2 = parser2(tokens, opt);
|
|
4969
6970
|
if (opt.hooks) {
|
|
@@ -5096,23 +7097,23 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5096
7097
|
var SIGNATURE_REGEX = /<!--HanbiroSignatureStart-->([\s\S]*?)<!--HanbiroSignatureEnd-->/g;
|
|
5097
7098
|
var TITLE_REGEX = /제목:[^\n]*/g;
|
|
5098
7099
|
var buildApplyHtml = function buildApplyHtml(body, editorValue) {
|
|
5099
|
-
return __async(
|
|
7100
|
+
return __async(_this3, null, /*#__PURE__*/_regenerator().m(function _callee24() {
|
|
5100
7101
|
var content, html2, signatureMatch;
|
|
5101
|
-
return _regenerator().w(function (
|
|
5102
|
-
while (1) switch (
|
|
7102
|
+
return _regenerator().w(function (_context24) {
|
|
7103
|
+
while (1) switch (_context24.n) {
|
|
5103
7104
|
case 0:
|
|
5104
7105
|
content = body.replace(TITLE_REGEX, "").replace("본문: ", "");
|
|
5105
|
-
|
|
7106
|
+
_context24.n = 1;
|
|
5106
7107
|
return marked.parse(content);
|
|
5107
7108
|
case 1:
|
|
5108
|
-
html2 =
|
|
7109
|
+
html2 = _context24.v;
|
|
5109
7110
|
signatureMatch = SIGNATURE_REGEX.exec(editorValue) || [];
|
|
5110
7111
|
if (signatureMatch[0]) {
|
|
5111
7112
|
html2 = html2 + "<br>" + signatureMatch[0];
|
|
5112
7113
|
}
|
|
5113
|
-
return
|
|
7114
|
+
return _context24.a(2, html2);
|
|
5114
7115
|
}
|
|
5115
|
-
},
|
|
7116
|
+
}, _callee24);
|
|
5116
7117
|
}));
|
|
5117
7118
|
};
|
|
5118
7119
|
var LangKey = /* @__PURE__ */function (LangKey2) {
|
|
@@ -5231,23 +7232,23 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
5231
7232
|
onApply = _ref24.onApply,
|
|
5232
7233
|
getEditorContent = _ref24.getEditorContent;
|
|
5233
7234
|
var handleApply = function handleApply() {
|
|
5234
|
-
return __async(
|
|
7235
|
+
return __async(_this3, null, /*#__PURE__*/_regenerator().m(function _callee25() {
|
|
5235
7236
|
var editorValue, html2;
|
|
5236
|
-
return _regenerator().w(function (
|
|
5237
|
-
while (1) switch (
|
|
7237
|
+
return _regenerator().w(function (_context25) {
|
|
7238
|
+
while (1) switch (_context25.n) {
|
|
5238
7239
|
case 0:
|
|
5239
7240
|
editorValue = getEditorContent ? getEditorContent() : "";
|
|
5240
|
-
|
|
7241
|
+
_context25.n = 1;
|
|
5241
7242
|
return buildApplyHtml(item.body, editorValue);
|
|
5242
7243
|
case 1:
|
|
5243
|
-
html2 =
|
|
7244
|
+
html2 = _context25.v;
|
|
5244
7245
|
onApply({
|
|
5245
7246
|
html: html2
|
|
5246
7247
|
});
|
|
5247
7248
|
case 2:
|
|
5248
|
-
return
|
|
7249
|
+
return _context25.a(2);
|
|
5249
7250
|
}
|
|
5250
|
-
},
|
|
7251
|
+
}, _callee25);
|
|
5251
7252
|
}));
|
|
5252
7253
|
};
|
|
5253
7254
|
return /* @__PURE__ */React__namespace.createElement("div", {
|
|
@@ -6974,44 +8975,6 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
6974
8975
|
style: style
|
|
6975
8976
|
}, rest));
|
|
6976
8977
|
};
|
|
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
8978
|
var getToneOptions = function getToneOptions() {
|
|
7016
8979
|
return [{
|
|
7017
8980
|
label: t(LangKey.TONE_FORMAL),
|
|
@@ -7056,35 +9019,35 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7056
9019
|
};
|
|
7057
9020
|
var LanguageSelect = /*#__PURE__*/function (_React__namespace$Com2) {
|
|
7058
9021
|
function LanguageSelect(props) {
|
|
7059
|
-
var
|
|
9022
|
+
var _this10;
|
|
7060
9023
|
_classCallCheck(this, LanguageSelect);
|
|
7061
|
-
|
|
7062
|
-
__publicField(
|
|
7063
|
-
__publicField(
|
|
7064
|
-
if (
|
|
7065
|
-
|
|
9024
|
+
_this10 = _callSuper(this, LanguageSelect, [props]);
|
|
9025
|
+
__publicField(_this10, "ref");
|
|
9026
|
+
__publicField(_this10, "handleClickOutside", function (e) {
|
|
9027
|
+
if (_this10.ref.current && !_this10.ref.current.contains(e.target)) {
|
|
9028
|
+
_this10.setState({
|
|
7066
9029
|
open: false
|
|
7067
9030
|
});
|
|
7068
9031
|
}
|
|
7069
9032
|
});
|
|
7070
|
-
__publicField(
|
|
7071
|
-
|
|
9033
|
+
__publicField(_this10, "toggle", function () {
|
|
9034
|
+
_this10.setState(function (s) {
|
|
7072
9035
|
return {
|
|
7073
9036
|
open: !s.open
|
|
7074
9037
|
};
|
|
7075
9038
|
});
|
|
7076
9039
|
});
|
|
7077
|
-
__publicField(
|
|
7078
|
-
|
|
7079
|
-
|
|
9040
|
+
__publicField(_this10, "pick", function (opt) {
|
|
9041
|
+
_this10.props.onChange(opt);
|
|
9042
|
+
_this10.setState({
|
|
7080
9043
|
open: false
|
|
7081
9044
|
});
|
|
7082
9045
|
});
|
|
7083
|
-
|
|
9046
|
+
_this10.state = {
|
|
7084
9047
|
open: false
|
|
7085
9048
|
};
|
|
7086
|
-
|
|
7087
|
-
return
|
|
9049
|
+
_this10.ref = React__namespace.createRef();
|
|
9050
|
+
return _this10;
|
|
7088
9051
|
}
|
|
7089
9052
|
_inherits(LanguageSelect, _React__namespace$Com2);
|
|
7090
9053
|
return _createClass(LanguageSelect, [{
|
|
@@ -7100,7 +9063,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7100
9063
|
}, {
|
|
7101
9064
|
key: "render",
|
|
7102
9065
|
value: function render() {
|
|
7103
|
-
var
|
|
9066
|
+
var _this11 = this;
|
|
7104
9067
|
var _this$props3 = this.props,
|
|
7105
9068
|
value = _this$props3.value,
|
|
7106
9069
|
options = _this$props3.options;
|
|
@@ -7168,7 +9131,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7168
9131
|
key: opt.value,
|
|
7169
9132
|
type: "button",
|
|
7170
9133
|
onClick: function onClick() {
|
|
7171
|
-
return
|
|
9134
|
+
return _this11.pick(opt);
|
|
7172
9135
|
},
|
|
7173
9136
|
className: "chat-ai-lang-option" + (isActive ? " is-active" : ""),
|
|
7174
9137
|
style: {
|
|
@@ -7286,21 +9249,21 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7286
9249
|
};
|
|
7287
9250
|
var SettingPopper = /*#__PURE__*/function (_React__namespace$Com3) {
|
|
7288
9251
|
function SettingPopper(props) {
|
|
7289
|
-
var
|
|
9252
|
+
var _this12;
|
|
7290
9253
|
_classCallCheck(this, SettingPopper);
|
|
7291
|
-
|
|
7292
|
-
__publicField(
|
|
7293
|
-
__publicField(
|
|
7294
|
-
__publicField(
|
|
7295
|
-
return __async(
|
|
9254
|
+
_this12 = _callSuper(this, SettingPopper, [props]);
|
|
9255
|
+
__publicField(_this12, "containerRef");
|
|
9256
|
+
__publicField(_this12, "popperRef");
|
|
9257
|
+
__publicField(_this12, "getLanguageOptions", function () {
|
|
9258
|
+
return __async(_this12, null, /*#__PURE__*/_regenerator().m(function _callee26() {
|
|
7296
9259
|
var _a2, _yield$apiGet, data, langs;
|
|
7297
|
-
return _regenerator().w(function (
|
|
7298
|
-
while (1) switch (
|
|
9260
|
+
return _regenerator().w(function (_context26) {
|
|
9261
|
+
while (1) switch (_context26.n) {
|
|
7299
9262
|
case 0:
|
|
7300
|
-
|
|
9263
|
+
_context26.n = 1;
|
|
7301
9264
|
return apiGet("/email/ai/langlist");
|
|
7302
9265
|
case 1:
|
|
7303
|
-
_yield$apiGet =
|
|
9266
|
+
_yield$apiGet = _context26.v;
|
|
7304
9267
|
data = _yield$apiGet.data;
|
|
7305
9268
|
if (data == null ? void 0 : data.list) {
|
|
7306
9269
|
langs = (_a2 = Object.keys(data == null ? void 0 : data.list)) == null ? void 0 : _a2.map(function (_key) {
|
|
@@ -7316,33 +9279,33 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7316
9279
|
});
|
|
7317
9280
|
}
|
|
7318
9281
|
case 2:
|
|
7319
|
-
return
|
|
9282
|
+
return _context26.a(2);
|
|
7320
9283
|
}
|
|
7321
|
-
},
|
|
9284
|
+
}, _callee26, this);
|
|
7322
9285
|
}));
|
|
7323
9286
|
});
|
|
7324
|
-
__publicField(
|
|
9287
|
+
__publicField(_this12, "handleClickOutside", function (event) {
|
|
7325
9288
|
var target = event.target;
|
|
7326
|
-
if (
|
|
7327
|
-
|
|
9289
|
+
if (_this12.containerRef.current && !_this12.containerRef.current.contains(target) && (!_this12.popperRef.current || !_this12.popperRef.current.contains(target))) {
|
|
9290
|
+
_this12.setState({
|
|
7328
9291
|
open: false
|
|
7329
9292
|
});
|
|
7330
9293
|
}
|
|
7331
9294
|
});
|
|
7332
|
-
__publicField(
|
|
7333
|
-
|
|
9295
|
+
__publicField(_this12, "togglePopper", function () {
|
|
9296
|
+
_this12.setState(function (prevState) {
|
|
7334
9297
|
return {
|
|
7335
9298
|
open: !prevState.open
|
|
7336
9299
|
};
|
|
7337
9300
|
});
|
|
7338
9301
|
});
|
|
7339
|
-
|
|
9302
|
+
_this12.state = {
|
|
7340
9303
|
open: false,
|
|
7341
9304
|
languageOptions: []
|
|
7342
9305
|
};
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
return
|
|
9306
|
+
_this12.containerRef = React__namespace.createRef();
|
|
9307
|
+
_this12.popperRef = React__namespace.createRef();
|
|
9308
|
+
return _this12;
|
|
7346
9309
|
}
|
|
7347
9310
|
_inherits(SettingPopper, _React__namespace$Com3);
|
|
7348
9311
|
return _createClass(SettingPopper, [{
|
|
@@ -7477,27 +9440,27 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7477
9440
|
}(React__namespace.Component);
|
|
7478
9441
|
var ChatInput = /*#__PURE__*/function (_React__namespace$Com4) {
|
|
7479
9442
|
function ChatInput(props) {
|
|
7480
|
-
var
|
|
9443
|
+
var _this13;
|
|
7481
9444
|
_classCallCheck(this, ChatInput);
|
|
7482
|
-
|
|
7483
|
-
__publicField(
|
|
7484
|
-
__publicField(
|
|
7485
|
-
var el =
|
|
9445
|
+
_this13 = _callSuper(this, ChatInput, [props]);
|
|
9446
|
+
__publicField(_this13, "textareaRef");
|
|
9447
|
+
__publicField(_this13, "adjustHeight", function () {
|
|
9448
|
+
var el = _this13.textareaRef.current;
|
|
7486
9449
|
if (!el) return;
|
|
7487
9450
|
el.style.height = "auto";
|
|
7488
9451
|
el.style.height = "".concat(Math.min(el.scrollHeight, 160), "px");
|
|
7489
9452
|
});
|
|
7490
|
-
__publicField(
|
|
7491
|
-
|
|
9453
|
+
__publicField(_this13, "handleChange", function (e) {
|
|
9454
|
+
_this13.props.onMessageChange(e.target.value);
|
|
7492
9455
|
});
|
|
7493
|
-
__publicField(
|
|
7494
|
-
if (!event.shiftKey && event.key === "Enter" && !
|
|
9456
|
+
__publicField(_this13, "handleKeyDown", function (event) {
|
|
9457
|
+
if (!event.shiftKey && event.key === "Enter" && !_this13.props.isSending) {
|
|
7495
9458
|
event.preventDefault();
|
|
7496
|
-
|
|
9459
|
+
_this13.props.onSubmit();
|
|
7497
9460
|
}
|
|
7498
9461
|
});
|
|
7499
|
-
|
|
7500
|
-
return
|
|
9462
|
+
_this13.textareaRef = React__namespace.createRef();
|
|
9463
|
+
return _this13;
|
|
7501
9464
|
}
|
|
7502
9465
|
_inherits(ChatInput, _React__namespace$Com4);
|
|
7503
9466
|
return _createClass(ChatInput, [{
|
|
@@ -7789,7 +9752,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7789
9752
|
flexDirection: "column",
|
|
7790
9753
|
gap: 14
|
|
7791
9754
|
}
|
|
7792
|
-
}, FEATURES$1.map(function (
|
|
9755
|
+
}, FEATURES$1.map(function (f2, i) {
|
|
7793
9756
|
return /* @__PURE__ */React__namespace.createElement("div", {
|
|
7794
9757
|
key: i,
|
|
7795
9758
|
style: {
|
|
@@ -7810,7 +9773,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7810
9773
|
justifyContent: "center",
|
|
7811
9774
|
flexShrink: 0
|
|
7812
9775
|
}
|
|
7813
|
-
},
|
|
9776
|
+
}, f2.icon), /* @__PURE__ */React__namespace.createElement("div", {
|
|
7814
9777
|
style: {
|
|
7815
9778
|
flex: 1,
|
|
7816
9779
|
minWidth: 0
|
|
@@ -7821,14 +9784,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7821
9784
|
fontWeight: 600,
|
|
7822
9785
|
color: "var(--text-primary)"
|
|
7823
9786
|
}
|
|
7824
|
-
},
|
|
9787
|
+
}, f2.title), /* @__PURE__ */React__namespace.createElement("div", {
|
|
7825
9788
|
style: {
|
|
7826
9789
|
fontSize: 12,
|
|
7827
9790
|
color: "var(--text-secondary)",
|
|
7828
9791
|
marginTop: 2,
|
|
7829
9792
|
lineHeight: 1.5
|
|
7830
9793
|
}
|
|
7831
|
-
},
|
|
9794
|
+
}, f2.desc)));
|
|
7832
9795
|
})), /* @__PURE__ */React__namespace.createElement("div", {
|
|
7833
9796
|
style: {
|
|
7834
9797
|
borderTop: "1px solid var(--border-light)",
|
|
@@ -7880,28 +9843,28 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7880
9843
|
};
|
|
7881
9844
|
var CreatePanel = /*#__PURE__*/function (_React__namespace$Com5) {
|
|
7882
9845
|
function CreatePanel(props) {
|
|
7883
|
-
var
|
|
9846
|
+
var _this14;
|
|
7884
9847
|
_classCallCheck(this, CreatePanel);
|
|
7885
|
-
|
|
7886
|
-
__publicField(
|
|
7887
|
-
__publicField(
|
|
7888
|
-
|
|
9848
|
+
_this14 = _callSuper(this, CreatePanel, [props]);
|
|
9849
|
+
__publicField(_this14, "rootRef");
|
|
9850
|
+
__publicField(_this14, "handleMessageChange", function (value) {
|
|
9851
|
+
_this14.setState({
|
|
7889
9852
|
message: value
|
|
7890
9853
|
});
|
|
7891
9854
|
});
|
|
7892
|
-
__publicField(
|
|
7893
|
-
return __async(
|
|
7894
|
-
var
|
|
9855
|
+
__publicField(_this14, "handleSubmit", function () {
|
|
9856
|
+
return __async(_this14, null, /*#__PURE__*/_regenerator().m(function _callee27() {
|
|
9857
|
+
var _this15 = this;
|
|
7895
9858
|
var _this$state3, message, messages, lang, tone, length, conversationId, newId, newMessage, params, setContent, setIsLoading, setConversationId;
|
|
7896
|
-
return _regenerator().w(function (
|
|
7897
|
-
while (1) switch (
|
|
9859
|
+
return _regenerator().w(function (_context27) {
|
|
9860
|
+
while (1) switch (_context27.n) {
|
|
7898
9861
|
case 0:
|
|
7899
9862
|
_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
9863
|
if (message.trim()) {
|
|
7901
|
-
|
|
9864
|
+
_context27.n = 1;
|
|
7902
9865
|
break;
|
|
7903
9866
|
}
|
|
7904
|
-
return
|
|
9867
|
+
return _context27.a(2);
|
|
7905
9868
|
case 1:
|
|
7906
9869
|
newId = v4();
|
|
7907
9870
|
newMessage = {
|
|
@@ -7926,36 +9889,36 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7926
9889
|
if (length) params.length = length.value;
|
|
7927
9890
|
if (conversationId) params.conversation_id = conversationId;
|
|
7928
9891
|
setContent = function setContent(nContent) {
|
|
7929
|
-
|
|
9892
|
+
_this15.setState(function (prevState) {
|
|
7930
9893
|
return {
|
|
7931
|
-
messages: prevState.messages.map(function (
|
|
7932
|
-
return
|
|
9894
|
+
messages: prevState.messages.map(function (m2) {
|
|
9895
|
+
return m2.id === newId ? __spreadProps(__spreadValues({}, m2), {
|
|
7933
9896
|
subject: "Some thing not used",
|
|
7934
9897
|
body: nContent,
|
|
7935
9898
|
isLoading: false,
|
|
7936
9899
|
created_at: (/* @__PURE__ */new Date()).getTime()
|
|
7937
|
-
}) :
|
|
9900
|
+
}) : m2;
|
|
7938
9901
|
})
|
|
7939
9902
|
};
|
|
7940
9903
|
});
|
|
7941
9904
|
};
|
|
7942
9905
|
setIsLoading = function setIsLoading(loading) {
|
|
7943
|
-
|
|
9906
|
+
_this15.setState(function (prevState) {
|
|
7944
9907
|
return {
|
|
7945
|
-
messages: prevState.messages.map(function (
|
|
7946
|
-
return
|
|
9908
|
+
messages: prevState.messages.map(function (m2) {
|
|
9909
|
+
return m2.id === newId ? __spreadProps(__spreadValues({}, m2), {
|
|
7947
9910
|
isLoading: loading
|
|
7948
|
-
}) :
|
|
9911
|
+
}) : m2;
|
|
7949
9912
|
})
|
|
7950
9913
|
};
|
|
7951
9914
|
});
|
|
7952
9915
|
};
|
|
7953
9916
|
setConversationId = function setConversationId(id) {
|
|
7954
|
-
|
|
9917
|
+
_this15.setState({
|
|
7955
9918
|
conversationId: id
|
|
7956
9919
|
});
|
|
7957
9920
|
};
|
|
7958
|
-
|
|
9921
|
+
_context27.n = 2;
|
|
7959
9922
|
return callAI(params, {
|
|
7960
9923
|
setContent: setContent,
|
|
7961
9924
|
setIsLoading: setIsLoading,
|
|
@@ -7966,31 +9929,31 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7966
9929
|
isSending: false
|
|
7967
9930
|
});
|
|
7968
9931
|
case 3:
|
|
7969
|
-
return
|
|
9932
|
+
return _context27.a(2);
|
|
7970
9933
|
}
|
|
7971
|
-
},
|
|
9934
|
+
}, _callee27, this);
|
|
7972
9935
|
}));
|
|
7973
9936
|
});
|
|
7974
|
-
__publicField(
|
|
7975
|
-
return
|
|
9937
|
+
__publicField(_this14, "setLang", function (lang) {
|
|
9938
|
+
return _this14.setState({
|
|
7976
9939
|
lang: lang
|
|
7977
9940
|
});
|
|
7978
9941
|
});
|
|
7979
|
-
__publicField(
|
|
7980
|
-
return
|
|
9942
|
+
__publicField(_this14, "setTone", function (tone) {
|
|
9943
|
+
return _this14.setState({
|
|
7981
9944
|
tone: tone
|
|
7982
9945
|
});
|
|
7983
9946
|
});
|
|
7984
|
-
__publicField(
|
|
7985
|
-
return
|
|
9947
|
+
__publicField(_this14, "setLength", function (length) {
|
|
9948
|
+
return _this14.setState({
|
|
7986
9949
|
length: length
|
|
7987
9950
|
});
|
|
7988
9951
|
});
|
|
7989
|
-
|
|
9952
|
+
_this14.rootRef = React__namespace.createRef();
|
|
7990
9953
|
var lang = (AI_LANG_FLAGS == null ? void 0 : AI_LANG_FLAGS.find(function (_item) {
|
|
7991
9954
|
return (_item == null ? void 0 : _item.value) === CURRENT_LANG;
|
|
7992
9955
|
})) || AI_LANG_FLAGS[0];
|
|
7993
|
-
|
|
9956
|
+
_this14.state = {
|
|
7994
9957
|
message: "",
|
|
7995
9958
|
messages: [],
|
|
7996
9959
|
isSending: false,
|
|
@@ -7999,13 +9962,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
7999
9962
|
length: getLengthOptions()[2],
|
|
8000
9963
|
conversationId: ""
|
|
8001
9964
|
};
|
|
8002
|
-
return
|
|
9965
|
+
return _this14;
|
|
8003
9966
|
}
|
|
8004
9967
|
_inherits(CreatePanel, _React__namespace$Com5);
|
|
8005
9968
|
return _createClass(CreatePanel, [{
|
|
8006
9969
|
key: "render",
|
|
8007
9970
|
value: function render() {
|
|
8008
|
-
var
|
|
9971
|
+
var _this16 = this;
|
|
8009
9972
|
var _this$props6 = this.props,
|
|
8010
9973
|
onApply = _this$props6.onApply,
|
|
8011
9974
|
getEditorContent = _this$props6.getEditorContent;
|
|
@@ -8033,7 +9996,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8033
9996
|
getEditorContent: getEditorContent
|
|
8034
9997
|
}) : /* @__PURE__ */React__namespace.createElement(EmptyState$1, {
|
|
8035
9998
|
onSelectPrompt: function onSelectPrompt(text) {
|
|
8036
|
-
return
|
|
9999
|
+
return _this16.setState({
|
|
8037
10000
|
message: text
|
|
8038
10001
|
});
|
|
8039
10002
|
}
|
|
@@ -8137,7 +10100,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8137
10100
|
flexDirection: "column",
|
|
8138
10101
|
gap: 14
|
|
8139
10102
|
}
|
|
8140
|
-
}, FEATURES.map(function (
|
|
10103
|
+
}, FEATURES.map(function (f2, i) {
|
|
8141
10104
|
return /* @__PURE__ */React__namespace.createElement("div", {
|
|
8142
10105
|
key: i,
|
|
8143
10106
|
style: {
|
|
@@ -8158,7 +10121,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8158
10121
|
justifyContent: "center",
|
|
8159
10122
|
flexShrink: 0
|
|
8160
10123
|
}
|
|
8161
|
-
},
|
|
10124
|
+
}, f2.icon), /* @__PURE__ */React__namespace.createElement("div", {
|
|
8162
10125
|
style: {
|
|
8163
10126
|
flex: 1,
|
|
8164
10127
|
minWidth: 0
|
|
@@ -8169,14 +10132,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8169
10132
|
fontWeight: 600,
|
|
8170
10133
|
color: "var(--text-primary)"
|
|
8171
10134
|
}
|
|
8172
|
-
},
|
|
10135
|
+
}, f2.title), /* @__PURE__ */React__namespace.createElement("div", {
|
|
8173
10136
|
style: {
|
|
8174
10137
|
fontSize: 12,
|
|
8175
10138
|
color: "var(--text-secondary)",
|
|
8176
10139
|
marginTop: 2,
|
|
8177
10140
|
lineHeight: 1.5
|
|
8178
10141
|
}
|
|
8179
|
-
},
|
|
10142
|
+
}, f2.desc)));
|
|
8180
10143
|
})));
|
|
8181
10144
|
};
|
|
8182
10145
|
var SourceCard = function SourceCard(_ref29) {
|
|
@@ -8376,11 +10339,11 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8376
10339
|
flexWrap: "wrap",
|
|
8377
10340
|
gap: 6
|
|
8378
10341
|
}
|
|
8379
|
-
}, selectedMails.map(function (
|
|
10342
|
+
}, selectedMails.map(function (m2, i) {
|
|
8380
10343
|
return /* @__PURE__ */React__namespace.createElement(SelectedChip, {
|
|
8381
|
-
key:
|
|
10344
|
+
key: m2.mid,
|
|
8382
10345
|
index: i,
|
|
8383
|
-
mail:
|
|
10346
|
+
mail: m2,
|
|
8384
10347
|
onClick: onChipClick,
|
|
8385
10348
|
onRemove: onRemoveChip
|
|
8386
10349
|
});
|
|
@@ -8451,38 +10414,38 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8451
10414
|
};
|
|
8452
10415
|
var Pagination = /*#__PURE__*/function (_React__namespace$Com6) {
|
|
8453
10416
|
function Pagination(props) {
|
|
8454
|
-
var
|
|
10417
|
+
var _this17;
|
|
8455
10418
|
_classCallCheck(this, Pagination);
|
|
8456
|
-
|
|
8457
|
-
__publicField(
|
|
8458
|
-
var totalPages =
|
|
8459
|
-
if (Number.isNaN(value)) return
|
|
10419
|
+
_this17 = _callSuper(this, Pagination, [props]);
|
|
10420
|
+
__publicField(_this17, "clamp", function (value) {
|
|
10421
|
+
var totalPages = _this17.props.totalPages;
|
|
10422
|
+
if (Number.isNaN(value)) return _this17.props.page;
|
|
8460
10423
|
return Math.min(Math.max(1, Math.floor(value)), Math.max(1, totalPages));
|
|
8461
10424
|
});
|
|
8462
|
-
__publicField(
|
|
8463
|
-
|
|
10425
|
+
__publicField(_this17, "handleInputChange", function (e) {
|
|
10426
|
+
_this17.setState({
|
|
8464
10427
|
inputValue: e.target.value
|
|
8465
10428
|
});
|
|
8466
10429
|
});
|
|
8467
|
-
__publicField(
|
|
8468
|
-
var next =
|
|
8469
|
-
|
|
10430
|
+
__publicField(_this17, "commit", function () {
|
|
10431
|
+
var next = _this17.clamp(parseInt(_this17.state.inputValue, 10));
|
|
10432
|
+
_this17.setState({
|
|
8470
10433
|
inputValue: String(next)
|
|
8471
10434
|
});
|
|
8472
|
-
if (next !==
|
|
8473
|
-
|
|
10435
|
+
if (next !== _this17.props.page) {
|
|
10436
|
+
_this17.props.onChangePage(next);
|
|
8474
10437
|
}
|
|
8475
10438
|
});
|
|
8476
|
-
__publicField(
|
|
10439
|
+
__publicField(_this17, "handleKeyDown", function (e) {
|
|
8477
10440
|
if (e.key === "Enter") {
|
|
8478
10441
|
e.preventDefault();
|
|
8479
|
-
|
|
10442
|
+
_this17.commit();
|
|
8480
10443
|
}
|
|
8481
10444
|
});
|
|
8482
|
-
|
|
10445
|
+
_this17.state = {
|
|
8483
10446
|
inputValue: String(props.page)
|
|
8484
10447
|
};
|
|
8485
|
-
return
|
|
10448
|
+
return _this17;
|
|
8486
10449
|
}
|
|
8487
10450
|
_inherits(Pagination, _React__namespace$Com6);
|
|
8488
10451
|
return _createClass(Pagination, [{
|
|
@@ -8585,32 +10548,32 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8585
10548
|
};
|
|
8586
10549
|
};
|
|
8587
10550
|
var fetchMailView = function fetchMailView(mid) {
|
|
8588
|
-
return __async(
|
|
10551
|
+
return __async(_this3, null, /*#__PURE__*/_regenerator().m(function _callee28() {
|
|
8589
10552
|
var _a2, _yield$apiGet2, data, ok, view, _parseFromField, name, email;
|
|
8590
|
-
return _regenerator().w(function (
|
|
8591
|
-
while (1) switch (
|
|
10553
|
+
return _regenerator().w(function (_context28) {
|
|
10554
|
+
while (1) switch (_context28.n) {
|
|
8592
10555
|
case 0:
|
|
8593
|
-
|
|
10556
|
+
_context28.n = 1;
|
|
8594
10557
|
return apiGet("/email/all/".concat(mid));
|
|
8595
10558
|
case 1:
|
|
8596
|
-
_yield$apiGet2 =
|
|
10559
|
+
_yield$apiGet2 = _context28.v;
|
|
8597
10560
|
data = _yield$apiGet2.data;
|
|
8598
10561
|
ok = _yield$apiGet2.ok;
|
|
8599
10562
|
if (!(!ok || !data)) {
|
|
8600
|
-
|
|
10563
|
+
_context28.n = 2;
|
|
8601
10564
|
break;
|
|
8602
10565
|
}
|
|
8603
|
-
return
|
|
10566
|
+
return _context28.a(2, null);
|
|
8604
10567
|
case 2:
|
|
8605
10568
|
view = ((_a2 = data == null ? void 0 : data.mailview) == null ? void 0 : _a2[0]) || (data == null ? void 0 : data.mailview) || data;
|
|
8606
10569
|
if (view) {
|
|
8607
|
-
|
|
10570
|
+
_context28.n = 3;
|
|
8608
10571
|
break;
|
|
8609
10572
|
}
|
|
8610
|
-
return
|
|
10573
|
+
return _context28.a(2, null);
|
|
8611
10574
|
case 3:
|
|
8612
10575
|
_parseFromField = parseFromField((view == null ? void 0 : view.from) || ""), name = _parseFromField.name, email = _parseFromField.email;
|
|
8613
|
-
return
|
|
10576
|
+
return _context28.a(2, {
|
|
8614
10577
|
mid: (view == null ? void 0 : view.mid) || mid,
|
|
8615
10578
|
subject: (view == null ? void 0 : view.subject) || (view == null ? void 0 : view.subj) || "",
|
|
8616
10579
|
from_name: name || (view == null ? void 0 : view.from_name) || "",
|
|
@@ -8620,35 +10583,35 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8620
10583
|
contents: (view == null ? void 0 : view.contents) || ""
|
|
8621
10584
|
});
|
|
8622
10585
|
}
|
|
8623
|
-
},
|
|
10586
|
+
}, _callee28);
|
|
8624
10587
|
}));
|
|
8625
10588
|
};
|
|
8626
10589
|
var fetchMailAiContext = function fetchMailAiContext(mids) {
|
|
8627
|
-
return __async(
|
|
10590
|
+
return __async(_this3, null, /*#__PURE__*/_regenerator().m(function _callee29() {
|
|
8628
10591
|
var ids, _yield$apiGet3, data, ok;
|
|
8629
|
-
return _regenerator().w(function (
|
|
8630
|
-
while (1) switch (
|
|
10592
|
+
return _regenerator().w(function (_context29) {
|
|
10593
|
+
while (1) switch (_context29.n) {
|
|
8631
10594
|
case 0:
|
|
8632
10595
|
if (mids.length) {
|
|
8633
|
-
|
|
10596
|
+
_context29.n = 1;
|
|
8634
10597
|
break;
|
|
8635
10598
|
}
|
|
8636
|
-
return
|
|
10599
|
+
return _context29.a(2, []);
|
|
8637
10600
|
case 1:
|
|
8638
10601
|
ids = mids.join(",");
|
|
8639
|
-
|
|
10602
|
+
_context29.n = 2;
|
|
8640
10603
|
return apiGet("/email/ai/aicontext/".concat(ids, "?limit=").concat(mids.length));
|
|
8641
10604
|
case 2:
|
|
8642
|
-
_yield$apiGet3 =
|
|
10605
|
+
_yield$apiGet3 = _context29.v;
|
|
8643
10606
|
data = _yield$apiGet3.data;
|
|
8644
10607
|
ok = _yield$apiGet3.ok;
|
|
8645
10608
|
if (!(!ok || !(data == null ? void 0 : data.items))) {
|
|
8646
|
-
|
|
10609
|
+
_context29.n = 3;
|
|
8647
10610
|
break;
|
|
8648
10611
|
}
|
|
8649
|
-
return
|
|
10612
|
+
return _context29.a(2, []);
|
|
8650
10613
|
case 3:
|
|
8651
|
-
return
|
|
10614
|
+
return _context29.a(2, data.items.filter(function (it) {
|
|
8652
10615
|
return (it == null ? void 0 : it.ok) !== false;
|
|
8653
10616
|
}).map(function (it) {
|
|
8654
10617
|
var _parseFromField2 = parseFromField((it == null ? void 0 : it.fromaddr) || ""),
|
|
@@ -8664,14 +10627,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8664
10627
|
};
|
|
8665
10628
|
}));
|
|
8666
10629
|
}
|
|
8667
|
-
},
|
|
10630
|
+
}, _callee29);
|
|
8668
10631
|
}));
|
|
8669
10632
|
};
|
|
8670
10633
|
var fetchMailList = function fetchMailList(params) {
|
|
8671
|
-
return __async(
|
|
10634
|
+
return __async(_this3, null, /*#__PURE__*/_regenerator().m(function _callee30() {
|
|
8672
10635
|
var _a2, page, pageSize, accountEmail, offset, query, _yield$apiGet4, data, ok, list2, items, total;
|
|
8673
|
-
return _regenerator().w(function (
|
|
8674
|
-
while (1) switch (
|
|
10636
|
+
return _regenerator().w(function (_context30) {
|
|
10637
|
+
while (1) switch (_context30.n) {
|
|
8675
10638
|
case 0:
|
|
8676
10639
|
page = params.page, pageSize = params.pageSize, accountEmail = params.accountEmail;
|
|
8677
10640
|
offset = (page - 1) * pageSize;
|
|
@@ -8685,17 +10648,17 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8685
10648
|
searchbox: "all"
|
|
8686
10649
|
});
|
|
8687
10650
|
if (accountEmail) query.set("f", accountEmail);
|
|
8688
|
-
|
|
10651
|
+
_context30.n = 1;
|
|
8689
10652
|
return apiGet("/email/list?".concat(query.toString()));
|
|
8690
10653
|
case 1:
|
|
8691
|
-
_yield$apiGet4 =
|
|
10654
|
+
_yield$apiGet4 = _context30.v;
|
|
8692
10655
|
data = _yield$apiGet4.data;
|
|
8693
10656
|
ok = _yield$apiGet4.ok;
|
|
8694
10657
|
if (!(!ok || !data)) {
|
|
8695
|
-
|
|
10658
|
+
_context30.n = 2;
|
|
8696
10659
|
break;
|
|
8697
10660
|
}
|
|
8698
|
-
return
|
|
10661
|
+
return _context30.a(2, {
|
|
8699
10662
|
items: [],
|
|
8700
10663
|
total: 0
|
|
8701
10664
|
});
|
|
@@ -8713,38 +10676,38 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8713
10676
|
};
|
|
8714
10677
|
});
|
|
8715
10678
|
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
|
|
10679
|
+
return _context30.a(2, {
|
|
8717
10680
|
items: items,
|
|
8718
10681
|
total: total
|
|
8719
10682
|
});
|
|
8720
10683
|
}
|
|
8721
|
-
},
|
|
10684
|
+
}, _callee30);
|
|
8722
10685
|
}));
|
|
8723
10686
|
};
|
|
8724
10687
|
var PAGE_SIZE$1 = 6;
|
|
8725
10688
|
var MAX_SELECTED = 5;
|
|
8726
10689
|
var MailListSelect = /*#__PURE__*/function (_React__namespace$Com7) {
|
|
8727
10690
|
function MailListSelect(props) {
|
|
8728
|
-
var
|
|
10691
|
+
var _this18;
|
|
8729
10692
|
_classCallCheck(this, MailListSelect);
|
|
8730
|
-
|
|
8731
|
-
__publicField(
|
|
8732
|
-
return __async(
|
|
10693
|
+
_this18 = _callSuper(this, MailListSelect, [props]);
|
|
10694
|
+
__publicField(_this18, "loadPage", function (page) {
|
|
10695
|
+
return __async(_this18, null, /*#__PURE__*/_regenerator().m(function _callee31() {
|
|
8733
10696
|
var _yield$fetchMailList, items, total;
|
|
8734
|
-
return _regenerator().w(function (
|
|
8735
|
-
while (1) switch (
|
|
10697
|
+
return _regenerator().w(function (_context31) {
|
|
10698
|
+
while (1) switch (_context31.n) {
|
|
8736
10699
|
case 0:
|
|
8737
10700
|
this.setState({
|
|
8738
10701
|
isLoading: true
|
|
8739
10702
|
});
|
|
8740
|
-
|
|
10703
|
+
_context31.n = 1;
|
|
8741
10704
|
return fetchMailList({
|
|
8742
10705
|
page: page,
|
|
8743
10706
|
pageSize: PAGE_SIZE$1,
|
|
8744
10707
|
accountEmail: this.props.accountEmail
|
|
8745
10708
|
});
|
|
8746
10709
|
case 1:
|
|
8747
|
-
_yield$fetchMailList =
|
|
10710
|
+
_yield$fetchMailList = _context31.v;
|
|
8748
10711
|
items = _yield$fetchMailList.items;
|
|
8749
10712
|
total = _yield$fetchMailList.total;
|
|
8750
10713
|
this.setState({
|
|
@@ -8754,18 +10717,18 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8754
10717
|
isLoading: false
|
|
8755
10718
|
});
|
|
8756
10719
|
case 2:
|
|
8757
|
-
return
|
|
10720
|
+
return _context31.a(2);
|
|
8758
10721
|
}
|
|
8759
|
-
},
|
|
10722
|
+
}, _callee31, this);
|
|
8760
10723
|
}));
|
|
8761
10724
|
});
|
|
8762
|
-
__publicField(
|
|
8763
|
-
|
|
10725
|
+
__publicField(_this18, "toggleMid", function (mid) {
|
|
10726
|
+
_this18.setState(function (prev) {
|
|
8764
10727
|
var isSelected = prev.selectedMids.includes(mid);
|
|
8765
10728
|
if (isSelected) {
|
|
8766
10729
|
return {
|
|
8767
|
-
selectedMids: prev.selectedMids.filter(function (
|
|
8768
|
-
return
|
|
10730
|
+
selectedMids: prev.selectedMids.filter(function (m2) {
|
|
10731
|
+
return m2 !== mid;
|
|
8769
10732
|
})
|
|
8770
10733
|
};
|
|
8771
10734
|
}
|
|
@@ -8777,12 +10740,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8777
10740
|
};
|
|
8778
10741
|
});
|
|
8779
10742
|
});
|
|
8780
|
-
__publicField(
|
|
8781
|
-
var
|
|
8782
|
-
items =
|
|
8783
|
-
selectedMids =
|
|
10743
|
+
__publicField(_this18, "toggleAll", function () {
|
|
10744
|
+
var _this18$state = _this18.state,
|
|
10745
|
+
items = _this18$state.items,
|
|
10746
|
+
selectedMids = _this18$state.selectedMids;
|
|
8784
10747
|
if (selectedMids.length >= MAX_SELECTED) {
|
|
8785
|
-
|
|
10748
|
+
_this18.setState({
|
|
8786
10749
|
selectedMids: []
|
|
8787
10750
|
});
|
|
8788
10751
|
return;
|
|
@@ -8791,23 +10754,23 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8791
10754
|
return it.mid;
|
|
8792
10755
|
});
|
|
8793
10756
|
var merged = Array.from(/* @__PURE__ */new Set([].concat(_toConsumableArray(selectedMids), _toConsumableArray(pageMids)))).slice(0, MAX_SELECTED);
|
|
8794
|
-
|
|
10757
|
+
_this18.setState({
|
|
8795
10758
|
selectedMids: merged
|
|
8796
10759
|
});
|
|
8797
10760
|
});
|
|
8798
|
-
__publicField(
|
|
8799
|
-
|
|
10761
|
+
__publicField(_this18, "clearAll", function () {
|
|
10762
|
+
_this18.setState({
|
|
8800
10763
|
selectedMids: []
|
|
8801
10764
|
});
|
|
8802
10765
|
});
|
|
8803
|
-
|
|
10766
|
+
_this18.state = {
|
|
8804
10767
|
page: 1,
|
|
8805
10768
|
total: 0,
|
|
8806
10769
|
items: [],
|
|
8807
10770
|
selectedMids: _toConsumableArray(props.initialSelected),
|
|
8808
10771
|
isLoading: false
|
|
8809
10772
|
};
|
|
8810
|
-
return
|
|
10773
|
+
return _this18;
|
|
8811
10774
|
}
|
|
8812
10775
|
_inherits(MailListSelect, _React__namespace$Com7);
|
|
8813
10776
|
return _createClass(MailListSelect, [{
|
|
@@ -8832,7 +10795,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8832
10795
|
}, {
|
|
8833
10796
|
key: "render",
|
|
8834
10797
|
value: function render() {
|
|
8835
|
-
var
|
|
10798
|
+
var _this19 = this;
|
|
8836
10799
|
var _this$props8 = this.props,
|
|
8837
10800
|
onCancel = _this$props8.onCancel,
|
|
8838
10801
|
onConfirm = _this$props8.onConfirm,
|
|
@@ -8912,7 +10875,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8912
10875
|
type: "button",
|
|
8913
10876
|
onClick: function onClick(e) {
|
|
8914
10877
|
e.preventDefault();
|
|
8915
|
-
|
|
10878
|
+
_this19.clearAll();
|
|
8916
10879
|
},
|
|
8917
10880
|
className: "text-button primary"
|
|
8918
10881
|
}, t(LangKey.CLEAR_ALL))), /* @__PURE__ */React__namespace.createElement("span", {
|
|
@@ -8960,7 +10923,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
8960
10923
|
checked: isChecked,
|
|
8961
10924
|
disabled: disabled,
|
|
8962
10925
|
onChange: function onChange() {
|
|
8963
|
-
return
|
|
10926
|
+
return _this19.toggleMid(it.mid);
|
|
8964
10927
|
},
|
|
8965
10928
|
style: {
|
|
8966
10929
|
marginTop: 2,
|
|
@@ -9067,13 +11030,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9067
11030
|
}(React__namespace.Component);
|
|
9068
11031
|
var BaseModal = /*#__PURE__*/function (_React__namespace$Com8) {
|
|
9069
11032
|
function BaseModal() {
|
|
9070
|
-
var
|
|
11033
|
+
var _this20;
|
|
9071
11034
|
_classCallCheck(this, BaseModal);
|
|
9072
|
-
|
|
9073
|
-
__publicField(
|
|
9074
|
-
if (e.key === "Escape" &&
|
|
11035
|
+
_this20 = _callSuper(this, BaseModal, arguments);
|
|
11036
|
+
__publicField(_this20, "handleKeyDown", function (e) {
|
|
11037
|
+
if (e.key === "Escape" && _this20.props.isOpen) _this20.props.onClose();
|
|
9075
11038
|
});
|
|
9076
|
-
return
|
|
11039
|
+
return _this20;
|
|
9077
11040
|
}
|
|
9078
11041
|
_inherits(BaseModal, _React__namespace$Com8);
|
|
9079
11042
|
return _createClass(BaseModal, [{
|
|
@@ -9209,30 +11172,30 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9209
11172
|
};
|
|
9210
11173
|
var ReplyPanel = /*#__PURE__*/function (_React__namespace$Com9) {
|
|
9211
11174
|
function ReplyPanel(props) {
|
|
9212
|
-
var
|
|
11175
|
+
var _this21;
|
|
9213
11176
|
_classCallCheck(this, ReplyPanel);
|
|
9214
|
-
|
|
9215
|
-
__publicField(
|
|
9216
|
-
__publicField(
|
|
9217
|
-
return __async(
|
|
11177
|
+
_this21 = _callSuper(this, ReplyPanel, [props]);
|
|
11178
|
+
__publicField(_this21, "rootRef");
|
|
11179
|
+
__publicField(_this21, "loadSourceMail", function () {
|
|
11180
|
+
return __async(_this21, null, /*#__PURE__*/_regenerator().m(function _callee32() {
|
|
9218
11181
|
var sourceMid, view;
|
|
9219
|
-
return _regenerator().w(function (
|
|
9220
|
-
while (1) switch (
|
|
11182
|
+
return _regenerator().w(function (_context32) {
|
|
11183
|
+
while (1) switch (_context32.n) {
|
|
9221
11184
|
case 0:
|
|
9222
11185
|
sourceMid = this.props.sourceMid;
|
|
9223
11186
|
if (sourceMid) {
|
|
9224
|
-
|
|
11187
|
+
_context32.n = 1;
|
|
9225
11188
|
break;
|
|
9226
11189
|
}
|
|
9227
|
-
return
|
|
11190
|
+
return _context32.a(2);
|
|
9228
11191
|
case 1:
|
|
9229
11192
|
this.setState({
|
|
9230
11193
|
isLoadingSource: true
|
|
9231
11194
|
});
|
|
9232
|
-
|
|
11195
|
+
_context32.n = 2;
|
|
9233
11196
|
return fetchMailView(sourceMid);
|
|
9234
11197
|
case 2:
|
|
9235
|
-
view =
|
|
11198
|
+
view = _context32.v;
|
|
9236
11199
|
if (view) {
|
|
9237
11200
|
this.setState({
|
|
9238
11201
|
sourceMail: {
|
|
@@ -9253,92 +11216,92 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9253
11216
|
});
|
|
9254
11217
|
}
|
|
9255
11218
|
case 3:
|
|
9256
|
-
return
|
|
11219
|
+
return _context32.a(2);
|
|
9257
11220
|
}
|
|
9258
|
-
},
|
|
11221
|
+
}, _callee32, this);
|
|
9259
11222
|
}));
|
|
9260
11223
|
});
|
|
9261
|
-
__publicField(
|
|
9262
|
-
|
|
11224
|
+
__publicField(_this21, "handleAddClick", function () {
|
|
11225
|
+
_this21.setState({
|
|
9263
11226
|
view: "list"
|
|
9264
11227
|
});
|
|
9265
11228
|
});
|
|
9266
|
-
__publicField(
|
|
9267
|
-
|
|
9268
|
-
view:
|
|
11229
|
+
__publicField(_this21, "handleListCancel", function () {
|
|
11230
|
+
_this21.setState({
|
|
11231
|
+
view: _this21.state.messages.length > 0 ? "chat" : "empty"
|
|
9269
11232
|
});
|
|
9270
11233
|
});
|
|
9271
|
-
__publicField(
|
|
9272
|
-
return __async(
|
|
11234
|
+
__publicField(_this21, "handleListConfirm", function (mids) {
|
|
11235
|
+
return __async(_this21, null, /*#__PURE__*/_regenerator().m(function _callee33() {
|
|
9273
11236
|
var selectedMails;
|
|
9274
|
-
return _regenerator().w(function (
|
|
9275
|
-
while (1) switch (
|
|
11237
|
+
return _regenerator().w(function (_context33) {
|
|
11238
|
+
while (1) switch (_context33.n) {
|
|
9276
11239
|
case 0:
|
|
9277
11240
|
this.setState({
|
|
9278
11241
|
isLoadingSelected: true
|
|
9279
11242
|
});
|
|
9280
|
-
|
|
11243
|
+
_context33.n = 1;
|
|
9281
11244
|
return fetchMailAiContext(mids);
|
|
9282
11245
|
case 1:
|
|
9283
|
-
selectedMails =
|
|
11246
|
+
selectedMails = _context33.v;
|
|
9284
11247
|
this.setState({
|
|
9285
11248
|
selectedMails: selectedMails,
|
|
9286
11249
|
isLoadingSelected: false,
|
|
9287
11250
|
view: this.state.messages.length > 0 ? "chat" : "empty"
|
|
9288
11251
|
});
|
|
9289
11252
|
case 2:
|
|
9290
|
-
return
|
|
11253
|
+
return _context33.a(2);
|
|
9291
11254
|
}
|
|
9292
|
-
},
|
|
11255
|
+
}, _callee33, this);
|
|
9293
11256
|
}));
|
|
9294
11257
|
});
|
|
9295
|
-
__publicField(
|
|
9296
|
-
|
|
9297
|
-
selectedMails:
|
|
9298
|
-
return
|
|
11258
|
+
__publicField(_this21, "handleRemoveSelected", function (mid) {
|
|
11259
|
+
_this21.setState({
|
|
11260
|
+
selectedMails: _this21.state.selectedMails.filter(function (m2) {
|
|
11261
|
+
return m2.mid !== mid;
|
|
9299
11262
|
})
|
|
9300
11263
|
});
|
|
9301
11264
|
});
|
|
9302
|
-
__publicField(
|
|
9303
|
-
|
|
11265
|
+
__publicField(_this21, "handlePreviewSelected", function (mail) {
|
|
11266
|
+
_this21.setState({
|
|
9304
11267
|
preview: {
|
|
9305
11268
|
mail: mail,
|
|
9306
11269
|
mode: "ai"
|
|
9307
11270
|
}
|
|
9308
11271
|
});
|
|
9309
11272
|
});
|
|
9310
|
-
__publicField(
|
|
9311
|
-
|
|
11273
|
+
__publicField(_this21, "handlePreviewSource", function (mail) {
|
|
11274
|
+
_this21.setState({
|
|
9312
11275
|
preview: {
|
|
9313
11276
|
mail: mail,
|
|
9314
11277
|
mode: "html"
|
|
9315
11278
|
}
|
|
9316
11279
|
});
|
|
9317
11280
|
});
|
|
9318
|
-
__publicField(
|
|
9319
|
-
|
|
11281
|
+
__publicField(_this21, "handlePreviewClose", function () {
|
|
11282
|
+
_this21.setState({
|
|
9320
11283
|
preview: null
|
|
9321
11284
|
});
|
|
9322
11285
|
});
|
|
9323
|
-
__publicField(
|
|
9324
|
-
|
|
11286
|
+
__publicField(_this21, "handleMessageChange", function (value) {
|
|
11287
|
+
_this21.setState({
|
|
9325
11288
|
message: value
|
|
9326
11289
|
});
|
|
9327
11290
|
});
|
|
9328
|
-
__publicField(
|
|
9329
|
-
return __async(
|
|
9330
|
-
var
|
|
11291
|
+
__publicField(_this21, "handleSubmit", function () {
|
|
11292
|
+
return __async(_this21, null, /*#__PURE__*/_regenerator().m(function _callee34() {
|
|
11293
|
+
var _this22 = this;
|
|
9331
11294
|
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 (
|
|
11295
|
+
return _regenerator().w(function (_context34) {
|
|
11296
|
+
while (1) switch (_context34.n) {
|
|
9334
11297
|
case 0:
|
|
9335
11298
|
type = this.props.type;
|
|
9336
11299
|
_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
11300
|
if (message.trim()) {
|
|
9338
|
-
|
|
11301
|
+
_context34.n = 1;
|
|
9339
11302
|
break;
|
|
9340
11303
|
}
|
|
9341
|
-
return
|
|
11304
|
+
return _context34.a(2);
|
|
9342
11305
|
case 1:
|
|
9343
11306
|
newId = v4();
|
|
9344
11307
|
newMessage = {
|
|
@@ -9361,12 +11324,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9361
11324
|
debug_grpc: true,
|
|
9362
11325
|
action: type,
|
|
9363
11326
|
original_email: (sourceMail == null ? void 0 : sourceMail.contents) || "",
|
|
9364
|
-
emailhistorys: selectedMails.filter(function (
|
|
9365
|
-
return
|
|
9366
|
-
}).map(function (
|
|
11327
|
+
emailhistorys: selectedMails.filter(function (m2) {
|
|
11328
|
+
return m2.ai_contents;
|
|
11329
|
+
}).map(function (m2) {
|
|
9367
11330
|
return {
|
|
9368
|
-
date:
|
|
9369
|
-
contents:
|
|
11331
|
+
date: m2.date,
|
|
11332
|
+
contents: m2.ai_contents
|
|
9370
11333
|
};
|
|
9371
11334
|
})
|
|
9372
11335
|
};
|
|
@@ -9374,36 +11337,36 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9374
11337
|
if (length) params.length = length.value;
|
|
9375
11338
|
if (conversationId) params.conversation_id = conversationId;
|
|
9376
11339
|
setContent = function setContent(nContent) {
|
|
9377
|
-
|
|
11340
|
+
_this22.setState(function (prevState) {
|
|
9378
11341
|
return {
|
|
9379
|
-
messages: prevState.messages.map(function (
|
|
9380
|
-
return
|
|
11342
|
+
messages: prevState.messages.map(function (m2) {
|
|
11343
|
+
return m2.id === newId ? __spreadProps(__spreadValues({}, m2), {
|
|
9381
11344
|
subject: "Some thing not used",
|
|
9382
11345
|
body: nContent,
|
|
9383
11346
|
isLoading: false,
|
|
9384
11347
|
created_at: (/* @__PURE__ */new Date()).getTime()
|
|
9385
|
-
}) :
|
|
11348
|
+
}) : m2;
|
|
9386
11349
|
})
|
|
9387
11350
|
};
|
|
9388
11351
|
});
|
|
9389
11352
|
};
|
|
9390
11353
|
setIsLoading = function setIsLoading(loading) {
|
|
9391
|
-
|
|
11354
|
+
_this22.setState(function (prevState) {
|
|
9392
11355
|
return {
|
|
9393
|
-
messages: prevState.messages.map(function (
|
|
9394
|
-
return
|
|
11356
|
+
messages: prevState.messages.map(function (m2) {
|
|
11357
|
+
return m2.id === newId ? __spreadProps(__spreadValues({}, m2), {
|
|
9395
11358
|
isLoading: loading
|
|
9396
|
-
}) :
|
|
11359
|
+
}) : m2;
|
|
9397
11360
|
})
|
|
9398
11361
|
};
|
|
9399
11362
|
});
|
|
9400
11363
|
};
|
|
9401
11364
|
setConversationId = function setConversationId(id) {
|
|
9402
|
-
|
|
11365
|
+
_this22.setState({
|
|
9403
11366
|
conversationId: id
|
|
9404
11367
|
});
|
|
9405
11368
|
};
|
|
9406
|
-
|
|
11369
|
+
_context34.n = 2;
|
|
9407
11370
|
return callAI(params, {
|
|
9408
11371
|
setContent: setContent,
|
|
9409
11372
|
setIsLoading: setIsLoading,
|
|
@@ -9414,31 +11377,31 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9414
11377
|
isSending: false
|
|
9415
11378
|
});
|
|
9416
11379
|
case 3:
|
|
9417
|
-
return
|
|
11380
|
+
return _context34.a(2);
|
|
9418
11381
|
}
|
|
9419
|
-
},
|
|
11382
|
+
}, _callee34, this);
|
|
9420
11383
|
}));
|
|
9421
11384
|
});
|
|
9422
|
-
__publicField(
|
|
9423
|
-
return
|
|
11385
|
+
__publicField(_this21, "setLang", function (lang) {
|
|
11386
|
+
return _this21.setState({
|
|
9424
11387
|
lang: lang
|
|
9425
11388
|
});
|
|
9426
11389
|
});
|
|
9427
|
-
__publicField(
|
|
9428
|
-
return
|
|
11390
|
+
__publicField(_this21, "setTone", function (tone) {
|
|
11391
|
+
return _this21.setState({
|
|
9429
11392
|
tone: tone
|
|
9430
11393
|
});
|
|
9431
11394
|
});
|
|
9432
|
-
__publicField(
|
|
9433
|
-
return
|
|
11395
|
+
__publicField(_this21, "setLength", function (length) {
|
|
11396
|
+
return _this21.setState({
|
|
9434
11397
|
length: length
|
|
9435
11398
|
});
|
|
9436
11399
|
});
|
|
9437
|
-
|
|
11400
|
+
_this21.rootRef = React__namespace.createRef();
|
|
9438
11401
|
var lang = (AI_LANG_FLAGS == null ? void 0 : AI_LANG_FLAGS.find(function (_item) {
|
|
9439
11402
|
return (_item == null ? void 0 : _item.value) === CURRENT_LANG;
|
|
9440
11403
|
})) || AI_LANG_FLAGS[0];
|
|
9441
|
-
|
|
11404
|
+
_this21.state = {
|
|
9442
11405
|
view: "empty",
|
|
9443
11406
|
sourceMail: null,
|
|
9444
11407
|
accountEmail: "",
|
|
@@ -9454,7 +11417,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9454
11417
|
length: getLengthOptions()[2],
|
|
9455
11418
|
conversationId: ""
|
|
9456
11419
|
};
|
|
9457
|
-
return
|
|
11420
|
+
return _this21;
|
|
9458
11421
|
}
|
|
9459
11422
|
_inherits(ReplyPanel, _React__namespace$Com9);
|
|
9460
11423
|
return _createClass(ReplyPanel, [{
|
|
@@ -9484,8 +11447,8 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9484
11447
|
if (view === "list") {
|
|
9485
11448
|
return /* @__PURE__ */React__namespace.createElement(MailListSelect, {
|
|
9486
11449
|
accountEmail: accountEmail,
|
|
9487
|
-
initialSelected: selectedMails.map(function (
|
|
9488
|
-
return
|
|
11450
|
+
initialSelected: selectedMails.map(function (m2) {
|
|
11451
|
+
return m2.mid;
|
|
9489
11452
|
}),
|
|
9490
11453
|
isConfirming: isLoadingSelected,
|
|
9491
11454
|
onCancel: this.handleListCancel,
|
|
@@ -9693,13 +11656,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9693
11656
|
padding: 2,
|
|
9694
11657
|
flexShrink: 0
|
|
9695
11658
|
}
|
|
9696
|
-
}, FILTERS.map(function (
|
|
9697
|
-
var isActive = mailtype ===
|
|
11659
|
+
}, FILTERS.map(function (f2) {
|
|
11660
|
+
var isActive = mailtype === f2.value;
|
|
9698
11661
|
return /* @__PURE__ */React__namespace.createElement("button", {
|
|
9699
|
-
key:
|
|
11662
|
+
key: f2.value,
|
|
9700
11663
|
type: "button",
|
|
9701
11664
|
onClick: function onClick() {
|
|
9702
|
-
return onChangeFilter(
|
|
11665
|
+
return onChangeFilter(f2.value);
|
|
9703
11666
|
},
|
|
9704
11667
|
style: {
|
|
9705
11668
|
border: "none",
|
|
@@ -9713,7 +11676,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9713
11676
|
fontFamily: "inherit",
|
|
9714
11677
|
transition: "background 0.15s ease-in-out"
|
|
9715
11678
|
}
|
|
9716
|
-
}, t(
|
|
11679
|
+
}, t(f2.label));
|
|
9717
11680
|
})));
|
|
9718
11681
|
};
|
|
9719
11682
|
var SummaryItem = function SummaryItem(_ref38) {
|
|
@@ -9777,33 +11740,33 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9777
11740
|
};
|
|
9778
11741
|
var LanguagePopover = /*#__PURE__*/function (_React__namespace$Com0) {
|
|
9779
11742
|
function LanguagePopover(props) {
|
|
9780
|
-
var
|
|
11743
|
+
var _this23;
|
|
9781
11744
|
_classCallCheck(this, LanguagePopover);
|
|
9782
|
-
|
|
9783
|
-
__publicField(
|
|
9784
|
-
__publicField(
|
|
9785
|
-
var anchorEl =
|
|
11745
|
+
_this23 = _callSuper(this, LanguagePopover, [props]);
|
|
11746
|
+
__publicField(_this23, "panelRef");
|
|
11747
|
+
__publicField(_this23, "updatePosition", function () {
|
|
11748
|
+
var anchorEl = _this23.props.anchorEl;
|
|
9786
11749
|
if (!anchorEl) return;
|
|
9787
11750
|
var rect = anchorEl.getBoundingClientRect();
|
|
9788
11751
|
var top = rect.bottom + (window.scrollY || document.documentElement.scrollTop) + 4;
|
|
9789
11752
|
var right = window.innerWidth - rect.right - (window.scrollX || document.documentElement.scrollLeft);
|
|
9790
|
-
|
|
11753
|
+
_this23.setState({
|
|
9791
11754
|
top: top,
|
|
9792
11755
|
left: window.innerWidth - right - 180
|
|
9793
11756
|
});
|
|
9794
11757
|
});
|
|
9795
|
-
__publicField(
|
|
11758
|
+
__publicField(_this23, "handleClickOutside", function (e) {
|
|
9796
11759
|
var target = e.target;
|
|
9797
|
-
if (
|
|
9798
|
-
|
|
11760
|
+
if (_this23.panelRef.current && !_this23.panelRef.current.contains(target) && _this23.props.anchorEl && !_this23.props.anchorEl.contains(target)) {
|
|
11761
|
+
_this23.props.onClose();
|
|
9799
11762
|
}
|
|
9800
11763
|
});
|
|
9801
|
-
|
|
9802
|
-
|
|
11764
|
+
_this23.panelRef = React__namespace.createRef();
|
|
11765
|
+
_this23.state = {
|
|
9803
11766
|
top: 0,
|
|
9804
11767
|
left: 0
|
|
9805
11768
|
};
|
|
9806
|
-
return
|
|
11769
|
+
return _this23;
|
|
9807
11770
|
}
|
|
9808
11771
|
_inherits(LanguagePopover, _React__namespace$Com0);
|
|
9809
11772
|
return _createClass(LanguagePopover, [{
|
|
@@ -9896,36 +11859,36 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9896
11859
|
};
|
|
9897
11860
|
var SummaryAIEmails = /*#__PURE__*/function (_React__namespace$Com1) {
|
|
9898
11861
|
function SummaryAIEmails(props) {
|
|
9899
|
-
var
|
|
11862
|
+
var _this24;
|
|
9900
11863
|
_classCallCheck(this, SummaryAIEmails);
|
|
9901
|
-
|
|
9902
|
-
__publicField(
|
|
9903
|
-
__publicField(
|
|
9904
|
-
if (
|
|
9905
|
-
|
|
9906
|
-
|
|
11864
|
+
_this24 = _callSuper(this, SummaryAIEmails, [props]);
|
|
11865
|
+
__publicField(_this24, "eventSource", null);
|
|
11866
|
+
__publicField(_this24, "closeStream", function () {
|
|
11867
|
+
if (_this24.eventSource) {
|
|
11868
|
+
_this24.eventSource.close();
|
|
11869
|
+
_this24.eventSource = null;
|
|
9907
11870
|
}
|
|
9908
11871
|
});
|
|
9909
|
-
__publicField(
|
|
9910
|
-
var targetEmail =
|
|
9911
|
-
var
|
|
9912
|
-
lang =
|
|
9913
|
-
mailtype =
|
|
9914
|
-
page =
|
|
11872
|
+
__publicField(_this24, "startStream", function () {
|
|
11873
|
+
var targetEmail = _this24.props.targetEmail;
|
|
11874
|
+
var _this24$state = _this24.state,
|
|
11875
|
+
lang = _this24$state.lang,
|
|
11876
|
+
mailtype = _this24$state.mailtype,
|
|
11877
|
+
page = _this24$state.page;
|
|
9915
11878
|
if (!targetEmail) return;
|
|
9916
|
-
|
|
9917
|
-
|
|
11879
|
+
_this24.closeStream();
|
|
11880
|
+
_this24.setState({
|
|
9918
11881
|
items: [],
|
|
9919
11882
|
isLoading: true
|
|
9920
11883
|
});
|
|
9921
11884
|
var url = "".concat(getBaseUrl(), "/email/ai/fromsumstreaming/").concat(encodeURIComponent(targetEmail), "/").concat(lang, "/").concat(PAGE_SIZE, "/").concat(page, "?mailtype=").concat(mailtype);
|
|
9922
11885
|
var es = new EventSource(url);
|
|
9923
|
-
|
|
11886
|
+
_this24.eventSource = es;
|
|
9924
11887
|
es.addEventListener("meta", function (ev) {
|
|
9925
11888
|
var _a2, _b, _c;
|
|
9926
11889
|
try {
|
|
9927
11890
|
var parsed = JSON.parse(ev.data || "{}");
|
|
9928
|
-
|
|
11891
|
+
_this24.setState({
|
|
9929
11892
|
meta: {
|
|
9930
11893
|
total: ((_a2 = parsed == null ? void 0 : parsed.counts) == null ? void 0 : _a2.total) || 0,
|
|
9931
11894
|
receive: ((_b = parsed == null ? void 0 : parsed.counts) == null ? void 0 : _b.receive) || 0,
|
|
@@ -9939,15 +11902,15 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9939
11902
|
es.onmessage = function (ev) {
|
|
9940
11903
|
if (!(ev == null ? void 0 : ev.data)) return;
|
|
9941
11904
|
if (ev.data === "[DONE]") {
|
|
9942
|
-
|
|
9943
|
-
|
|
11905
|
+
_this24.closeStream();
|
|
11906
|
+
_this24.setState({
|
|
9944
11907
|
isLoading: false
|
|
9945
11908
|
});
|
|
9946
11909
|
return;
|
|
9947
11910
|
}
|
|
9948
11911
|
var parsed = parseDataLine(ev.data);
|
|
9949
11912
|
if (parsed) {
|
|
9950
|
-
|
|
11913
|
+
_this24.setState(function (prev) {
|
|
9951
11914
|
return {
|
|
9952
11915
|
items: [].concat(_toConsumableArray(prev.items), [parsed]),
|
|
9953
11916
|
isLoading: false
|
|
@@ -9956,45 +11919,45 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
9956
11919
|
}
|
|
9957
11920
|
};
|
|
9958
11921
|
es.onerror = function () {
|
|
9959
|
-
|
|
9960
|
-
|
|
11922
|
+
_this24.closeStream();
|
|
11923
|
+
_this24.setState({
|
|
9961
11924
|
isLoading: false
|
|
9962
11925
|
});
|
|
9963
11926
|
};
|
|
9964
11927
|
});
|
|
9965
|
-
__publicField(
|
|
9966
|
-
if (val ===
|
|
9967
|
-
|
|
11928
|
+
__publicField(_this24, "handleChangeFilter", function (val) {
|
|
11929
|
+
if (val === _this24.state.mailtype) return;
|
|
11930
|
+
_this24.setState({
|
|
9968
11931
|
mailtype: val,
|
|
9969
11932
|
page: 1
|
|
9970
11933
|
});
|
|
9971
11934
|
});
|
|
9972
|
-
__publicField(
|
|
9973
|
-
|
|
11935
|
+
__publicField(_this24, "handleChangeLang", function (val) {
|
|
11936
|
+
_this24.setState({
|
|
9974
11937
|
langAnchor: null
|
|
9975
11938
|
});
|
|
9976
|
-
if (val ===
|
|
9977
|
-
|
|
11939
|
+
if (val === _this24.state.lang) return;
|
|
11940
|
+
_this24.setState({
|
|
9978
11941
|
lang: val,
|
|
9979
11942
|
page: 1
|
|
9980
11943
|
});
|
|
9981
11944
|
});
|
|
9982
|
-
__publicField(
|
|
9983
|
-
|
|
11945
|
+
__publicField(_this24, "handleChangePage", function (page) {
|
|
11946
|
+
_this24.setState({
|
|
9984
11947
|
page: page
|
|
9985
11948
|
});
|
|
9986
11949
|
});
|
|
9987
|
-
__publicField(
|
|
9988
|
-
|
|
11950
|
+
__publicField(_this24, "handleOpenLang", function (anchor) {
|
|
11951
|
+
_this24.setState({
|
|
9989
11952
|
langAnchor: anchor
|
|
9990
11953
|
});
|
|
9991
11954
|
});
|
|
9992
|
-
__publicField(
|
|
9993
|
-
|
|
11955
|
+
__publicField(_this24, "handleCloseLang", function () {
|
|
11956
|
+
_this24.setState({
|
|
9994
11957
|
langAnchor: null
|
|
9995
11958
|
});
|
|
9996
11959
|
});
|
|
9997
|
-
|
|
11960
|
+
_this24.state = {
|
|
9998
11961
|
lang: CURRENT_LANG || "ko",
|
|
9999
11962
|
mailtype: "all",
|
|
10000
11963
|
page: 1,
|
|
@@ -10003,7 +11966,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
10003
11966
|
isLoading: false,
|
|
10004
11967
|
langAnchor: null
|
|
10005
11968
|
};
|
|
10006
|
-
return
|
|
11969
|
+
return _this24;
|
|
10007
11970
|
}
|
|
10008
11971
|
_inherits(SummaryAIEmails, _React__namespace$Com1);
|
|
10009
11972
|
return _createClass(SummaryAIEmails, [{
|