hanbiro-react16-sdk 1.0.6 → 1.0.7
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/README.md +130 -45
- package/dist/components/ChatAIDraft/SettingPopper.d.ts +2 -0
- package/dist/components/ChatAIDraft/index.d.ts +1 -0
- package/dist/components/LoadingCircular/index.d.ts +9 -0
- package/dist/components/LoadingContainer/index.d.ts +10 -0
- package/dist/components/TinyMceEditor/index.d.ts +41 -0
- package/dist/components/TinyMceEditor/scrollStyle.d.ts +1 -0
- package/dist/components/TinyMceEditor/useEditor.d.ts +24 -0
- package/dist/components/index.d.ts +2 -1
- package/dist/hanbiro-react16-sdk.es.js +1595 -835
- package/dist/hanbiro-react16-sdk.style.css +5 -0
- package/dist/hanbiro-react16-sdk.umd.js +84 -33
- package/dist/utils/index.d.ts +1 -1
- package/package.json +4 -2
- package/dist/style.css +0 -1
|
@@ -1,43 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* hanbiro-react16-sdk v1.0.6
|
|
3
|
+
* Build Date: 2026-03-26
|
|
4
|
+
*/
|
|
5
|
+
var rt = Object.defineProperty;
|
|
6
|
+
var it = (t, e, n) => e in t ? rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
7
|
+
var b = (t, e, n) => it(t, typeof e != "symbol" ? e + "" : e, n);
|
|
8
|
+
import * as d from "react";
|
|
9
|
+
import E, { forwardRef as he } from "react";
|
|
10
|
+
import * as ot from "react-dom";
|
|
11
|
+
let q;
|
|
12
|
+
const st = new Uint8Array(16);
|
|
13
|
+
function at() {
|
|
14
|
+
if (!q && (q = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !q))
|
|
10
15
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
11
|
-
return
|
|
16
|
+
return q(st);
|
|
12
17
|
}
|
|
13
|
-
const
|
|
18
|
+
const R = [];
|
|
14
19
|
for (let t = 0; t < 256; ++t)
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
return
|
|
20
|
+
R.push((t + 256).toString(16).slice(1));
|
|
21
|
+
function lt(t, e = 0) {
|
|
22
|
+
return R[t[e + 0]] + R[t[e + 1]] + R[t[e + 2]] + R[t[e + 3]] + "-" + R[t[e + 4]] + R[t[e + 5]] + "-" + R[t[e + 6]] + R[t[e + 7]] + "-" + R[t[e + 8]] + R[t[e + 9]] + "-" + R[t[e + 10]] + R[t[e + 11]] + R[t[e + 12]] + R[t[e + 13]] + R[t[e + 14]] + R[t[e + 15]];
|
|
18
23
|
}
|
|
19
|
-
const
|
|
20
|
-
randomUUID:
|
|
24
|
+
const ct = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Ce = {
|
|
25
|
+
randomUUID: ct
|
|
21
26
|
};
|
|
22
|
-
function
|
|
23
|
-
if (
|
|
24
|
-
return
|
|
27
|
+
function ut(t, e, n) {
|
|
28
|
+
if (Ce.randomUUID && !t)
|
|
29
|
+
return Ce.randomUUID();
|
|
25
30
|
t = t || {};
|
|
26
|
-
const r = t.random || (t.rng ||
|
|
27
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128,
|
|
31
|
+
const r = t.random || (t.rng || at)();
|
|
32
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, lt(r);
|
|
28
33
|
}
|
|
29
|
-
function
|
|
34
|
+
function pt(t) {
|
|
30
35
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
31
36
|
}
|
|
32
|
-
var
|
|
33
|
-
function
|
|
37
|
+
var je = { exports: {} }, ht = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED", ft = ht, dt = ft;
|
|
38
|
+
function Me() {
|
|
34
39
|
}
|
|
35
|
-
function
|
|
40
|
+
function Ne() {
|
|
36
41
|
}
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
function t(r, i,
|
|
40
|
-
if (
|
|
42
|
+
Ne.resetWarningCache = Me;
|
|
43
|
+
var gt = function() {
|
|
44
|
+
function t(r, i, o, s, a, c) {
|
|
45
|
+
if (c !== dt) {
|
|
41
46
|
var l = new Error(
|
|
42
47
|
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
|
|
43
48
|
);
|
|
@@ -68,178 +73,178 @@ var Je = function() {
|
|
|
68
73
|
oneOfType: e,
|
|
69
74
|
shape: e,
|
|
70
75
|
exact: e,
|
|
71
|
-
checkPropTypes:
|
|
72
|
-
resetWarningCache:
|
|
76
|
+
checkPropTypes: Ne,
|
|
77
|
+
resetWarningCache: Me
|
|
73
78
|
};
|
|
74
79
|
return n.PropTypes = n, n;
|
|
75
80
|
};
|
|
76
|
-
|
|
77
|
-
var
|
|
78
|
-
const
|
|
79
|
-
function
|
|
80
|
-
return
|
|
81
|
+
je.exports = gt();
|
|
82
|
+
var p = je.exports;
|
|
83
|
+
const I = /* @__PURE__ */ pt(p);
|
|
84
|
+
function ne() {
|
|
85
|
+
return ne = Object.assign || function(t) {
|
|
81
86
|
for (var e = 1; e < arguments.length; e++) {
|
|
82
87
|
var n = arguments[e];
|
|
83
88
|
for (var r in n)
|
|
84
89
|
Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
|
|
85
90
|
}
|
|
86
91
|
return t;
|
|
87
|
-
},
|
|
92
|
+
}, ne.apply(this, arguments);
|
|
88
93
|
}
|
|
89
|
-
function
|
|
94
|
+
function mt(t, e) {
|
|
90
95
|
if (t == null) return {};
|
|
91
|
-
var n =
|
|
96
|
+
var n = bt(t, e), r, i;
|
|
92
97
|
if (Object.getOwnPropertySymbols) {
|
|
93
|
-
var
|
|
94
|
-
for (i = 0; i <
|
|
95
|
-
r =
|
|
98
|
+
var o = Object.getOwnPropertySymbols(t);
|
|
99
|
+
for (i = 0; i < o.length; i++)
|
|
100
|
+
r = o[i], !(e.indexOf(r) >= 0) && Object.prototype.propertyIsEnumerable.call(t, r) && (n[r] = t[r]);
|
|
96
101
|
}
|
|
97
102
|
return n;
|
|
98
103
|
}
|
|
99
|
-
function
|
|
104
|
+
function bt(t, e) {
|
|
100
105
|
if (t == null) return {};
|
|
101
|
-
var n = {}, r = Object.keys(t), i,
|
|
102
|
-
for (
|
|
103
|
-
i = r[
|
|
106
|
+
var n = {}, r = Object.keys(t), i, o;
|
|
107
|
+
for (o = 0; o < r.length; o++)
|
|
108
|
+
i = r[o], !(e.indexOf(i) >= 0) && (n[i] = t[i]);
|
|
104
109
|
return n;
|
|
105
110
|
}
|
|
106
|
-
var
|
|
107
|
-
var n = t.color, r = n === void 0 ? "currentColor" : n, i = t.size,
|
|
108
|
-
return /* @__PURE__ */
|
|
111
|
+
var Q = he(function(t, e) {
|
|
112
|
+
var n = t.color, r = n === void 0 ? "currentColor" : n, i = t.size, o = i === void 0 ? 24 : i, s = mt(t, ["color", "size"]);
|
|
113
|
+
return /* @__PURE__ */ E.createElement("svg", ne({
|
|
109
114
|
ref: e,
|
|
110
115
|
xmlns: "http://www.w3.org/2000/svg",
|
|
111
|
-
width:
|
|
112
|
-
height:
|
|
116
|
+
width: o,
|
|
117
|
+
height: o,
|
|
113
118
|
viewBox: "0 0 24 24",
|
|
114
119
|
fill: "none",
|
|
115
120
|
stroke: r,
|
|
116
121
|
strokeWidth: "2",
|
|
117
122
|
strokeLinecap: "round",
|
|
118
123
|
strokeLinejoin: "round"
|
|
119
|
-
},
|
|
124
|
+
}, s), /* @__PURE__ */ E.createElement("rect", {
|
|
120
125
|
x: "9",
|
|
121
126
|
y: "9",
|
|
122
127
|
width: "13",
|
|
123
128
|
height: "13",
|
|
124
129
|
rx: "2",
|
|
125
130
|
ry: "2"
|
|
126
|
-
}), /* @__PURE__ */
|
|
131
|
+
}), /* @__PURE__ */ E.createElement("path", {
|
|
127
132
|
d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"
|
|
128
133
|
}));
|
|
129
134
|
});
|
|
130
|
-
|
|
131
|
-
color:
|
|
132
|
-
size:
|
|
135
|
+
Q.propTypes = {
|
|
136
|
+
color: I.string,
|
|
137
|
+
size: I.oneOfType([I.string, I.number])
|
|
133
138
|
};
|
|
134
|
-
|
|
135
|
-
function
|
|
136
|
-
return
|
|
139
|
+
Q.displayName = "Copy";
|
|
140
|
+
function re() {
|
|
141
|
+
return re = Object.assign || function(t) {
|
|
137
142
|
for (var e = 1; e < arguments.length; e++) {
|
|
138
143
|
var n = arguments[e];
|
|
139
144
|
for (var r in n)
|
|
140
145
|
Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
|
|
141
146
|
}
|
|
142
147
|
return t;
|
|
143
|
-
},
|
|
148
|
+
}, re.apply(this, arguments);
|
|
144
149
|
}
|
|
145
|
-
function
|
|
150
|
+
function kt(t, e) {
|
|
146
151
|
if (t == null) return {};
|
|
147
|
-
var n =
|
|
152
|
+
var n = vt(t, e), r, i;
|
|
148
153
|
if (Object.getOwnPropertySymbols) {
|
|
149
|
-
var
|
|
150
|
-
for (i = 0; i <
|
|
151
|
-
r =
|
|
154
|
+
var o = Object.getOwnPropertySymbols(t);
|
|
155
|
+
for (i = 0; i < o.length; i++)
|
|
156
|
+
r = o[i], !(e.indexOf(r) >= 0) && Object.prototype.propertyIsEnumerable.call(t, r) && (n[r] = t[r]);
|
|
152
157
|
}
|
|
153
158
|
return n;
|
|
154
159
|
}
|
|
155
|
-
function
|
|
160
|
+
function vt(t, e) {
|
|
156
161
|
if (t == null) return {};
|
|
157
|
-
var n = {}, r = Object.keys(t), i,
|
|
158
|
-
for (
|
|
159
|
-
i = r[
|
|
162
|
+
var n = {}, r = Object.keys(t), i, o;
|
|
163
|
+
for (o = 0; o < r.length; o++)
|
|
164
|
+
i = r[o], !(e.indexOf(i) >= 0) && (n[i] = t[i]);
|
|
160
165
|
return n;
|
|
161
166
|
}
|
|
162
|
-
var
|
|
163
|
-
var n = t.color, r = n === void 0 ? "currentColor" : n, i = t.size,
|
|
164
|
-
return /* @__PURE__ */
|
|
167
|
+
var fe = he(function(t, e) {
|
|
168
|
+
var n = t.color, r = n === void 0 ? "currentColor" : n, i = t.size, o = i === void 0 ? 24 : i, s = kt(t, ["color", "size"]);
|
|
169
|
+
return /* @__PURE__ */ E.createElement("svg", re({
|
|
165
170
|
ref: e,
|
|
166
171
|
xmlns: "http://www.w3.org/2000/svg",
|
|
167
|
-
width:
|
|
168
|
-
height:
|
|
172
|
+
width: o,
|
|
173
|
+
height: o,
|
|
169
174
|
viewBox: "0 0 24 24",
|
|
170
175
|
fill: "none",
|
|
171
176
|
stroke: r,
|
|
172
177
|
strokeWidth: "2",
|
|
173
178
|
strokeLinecap: "round",
|
|
174
179
|
strokeLinejoin: "round"
|
|
175
|
-
},
|
|
180
|
+
}, s), /* @__PURE__ */ E.createElement("line", {
|
|
176
181
|
x1: "22",
|
|
177
182
|
y1: "2",
|
|
178
183
|
x2: "11",
|
|
179
184
|
y2: "13"
|
|
180
|
-
}), /* @__PURE__ */
|
|
185
|
+
}), /* @__PURE__ */ E.createElement("polygon", {
|
|
181
186
|
points: "22 2 15 22 11 13 2 9 22 2"
|
|
182
187
|
}));
|
|
183
188
|
});
|
|
184
|
-
|
|
185
|
-
color:
|
|
186
|
-
size:
|
|
189
|
+
fe.propTypes = {
|
|
190
|
+
color: I.string,
|
|
191
|
+
size: I.oneOfType([I.string, I.number])
|
|
187
192
|
};
|
|
188
|
-
|
|
189
|
-
function
|
|
190
|
-
return
|
|
193
|
+
fe.displayName = "Send";
|
|
194
|
+
function ie() {
|
|
195
|
+
return ie = Object.assign || function(t) {
|
|
191
196
|
for (var e = 1; e < arguments.length; e++) {
|
|
192
197
|
var n = arguments[e];
|
|
193
198
|
for (var r in n)
|
|
194
199
|
Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
|
|
195
200
|
}
|
|
196
201
|
return t;
|
|
197
|
-
},
|
|
202
|
+
}, ie.apply(this, arguments);
|
|
198
203
|
}
|
|
199
|
-
function
|
|
204
|
+
function yt(t, e) {
|
|
200
205
|
if (t == null) return {};
|
|
201
|
-
var n =
|
|
206
|
+
var n = xt(t, e), r, i;
|
|
202
207
|
if (Object.getOwnPropertySymbols) {
|
|
203
|
-
var
|
|
204
|
-
for (i = 0; i <
|
|
205
|
-
r =
|
|
208
|
+
var o = Object.getOwnPropertySymbols(t);
|
|
209
|
+
for (i = 0; i < o.length; i++)
|
|
210
|
+
r = o[i], !(e.indexOf(r) >= 0) && Object.prototype.propertyIsEnumerable.call(t, r) && (n[r] = t[r]);
|
|
206
211
|
}
|
|
207
212
|
return n;
|
|
208
213
|
}
|
|
209
|
-
function
|
|
214
|
+
function xt(t, e) {
|
|
210
215
|
if (t == null) return {};
|
|
211
|
-
var n = {}, r = Object.keys(t), i,
|
|
212
|
-
for (
|
|
213
|
-
i = r[
|
|
216
|
+
var n = {}, r = Object.keys(t), i, o;
|
|
217
|
+
for (o = 0; o < r.length; o++)
|
|
218
|
+
i = r[o], !(e.indexOf(i) >= 0) && (n[i] = t[i]);
|
|
214
219
|
return n;
|
|
215
220
|
}
|
|
216
|
-
var
|
|
217
|
-
var n = t.color, r = n === void 0 ? "currentColor" : n, i = t.size,
|
|
218
|
-
return /* @__PURE__ */
|
|
221
|
+
var de = he(function(t, e) {
|
|
222
|
+
var n = t.color, r = n === void 0 ? "currentColor" : n, i = t.size, o = i === void 0 ? 24 : i, s = yt(t, ["color", "size"]);
|
|
223
|
+
return /* @__PURE__ */ E.createElement("svg", ie({
|
|
219
224
|
ref: e,
|
|
220
225
|
xmlns: "http://www.w3.org/2000/svg",
|
|
221
|
-
width:
|
|
222
|
-
height:
|
|
226
|
+
width: o,
|
|
227
|
+
height: o,
|
|
223
228
|
viewBox: "0 0 24 24",
|
|
224
229
|
fill: "none",
|
|
225
230
|
stroke: r,
|
|
226
231
|
strokeWidth: "2",
|
|
227
232
|
strokeLinecap: "round",
|
|
228
233
|
strokeLinejoin: "round"
|
|
229
|
-
},
|
|
234
|
+
}, s), /* @__PURE__ */ E.createElement("circle", {
|
|
230
235
|
cx: "12",
|
|
231
236
|
cy: "12",
|
|
232
237
|
r: "3"
|
|
233
|
-
}), /* @__PURE__ */
|
|
238
|
+
}), /* @__PURE__ */ E.createElement("path", {
|
|
234
239
|
d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"
|
|
235
240
|
}));
|
|
236
241
|
});
|
|
237
|
-
|
|
238
|
-
color:
|
|
239
|
-
size:
|
|
242
|
+
de.propTypes = {
|
|
243
|
+
color: I.string,
|
|
244
|
+
size: I.oneOfType([I.string, I.number])
|
|
240
245
|
};
|
|
241
|
-
|
|
242
|
-
const
|
|
246
|
+
de.displayName = "Settings";
|
|
247
|
+
const oe = [
|
|
243
248
|
{ label: "Korean", value: "KR", extra: "ko" },
|
|
244
249
|
{ label: "English", value: "US", extra: "en" },
|
|
245
250
|
{ label: "Japanese", value: "JP" },
|
|
@@ -248,9 +253,9 @@ const ee = [
|
|
|
248
253
|
{ label: "Traditional Chinese (Hong Kong)", value: "zh-HK", extra: "zh-cht" },
|
|
249
254
|
{ label: "Vietnamese", value: "VN", extra: "vi" },
|
|
250
255
|
{ label: "Indonesian", value: "ID", extra: "id" }
|
|
251
|
-
],
|
|
256
|
+
], wt = ({ isGradient: t = !1, stroke: e = 1.5, size: n = 40 }) => {
|
|
252
257
|
const r = "ai-gradient-" + Math.random().toString(36).substr(2, 9);
|
|
253
|
-
return /* @__PURE__ */
|
|
258
|
+
return /* @__PURE__ */ d.createElement(
|
|
254
259
|
"svg",
|
|
255
260
|
{
|
|
256
261
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -259,7 +264,7 @@ const ee = [
|
|
|
259
264
|
viewBox: "0 0 24 24",
|
|
260
265
|
style: { flexShrink: 0 }
|
|
261
266
|
},
|
|
262
|
-
t && /* @__PURE__ */
|
|
267
|
+
t && /* @__PURE__ */ d.createElement("defs", null, /* @__PURE__ */ d.createElement("linearGradient", { id: r, x1: "0%", y1: "0%", x2: "0%", y2: "100%" }, /* @__PURE__ */ d.createElement("stop", { offset: "0%", stopColor: "#9D50BB" }, /* @__PURE__ */ d.createElement(
|
|
263
268
|
"animate",
|
|
264
269
|
{
|
|
265
270
|
attributeName: "offset",
|
|
@@ -267,7 +272,7 @@ const ee = [
|
|
|
267
272
|
dur: "1s",
|
|
268
273
|
repeatCount: "indefinite"
|
|
269
274
|
}
|
|
270
|
-
)), /* @__PURE__ */
|
|
275
|
+
)), /* @__PURE__ */ d.createElement("stop", { offset: "30%", stopColor: "#6E48AA" }, /* @__PURE__ */ d.createElement(
|
|
271
276
|
"animate",
|
|
272
277
|
{
|
|
273
278
|
attributeName: "offset",
|
|
@@ -275,7 +280,7 @@ const ee = [
|
|
|
275
280
|
dur: "1s",
|
|
276
281
|
repeatCount: "indefinite"
|
|
277
282
|
}
|
|
278
|
-
)), /* @__PURE__ */
|
|
283
|
+
)), /* @__PURE__ */ d.createElement("stop", { offset: "50%", stopColor: "#4776E6" }, /* @__PURE__ */ d.createElement(
|
|
279
284
|
"animate",
|
|
280
285
|
{
|
|
281
286
|
attributeName: "offset",
|
|
@@ -283,7 +288,7 @@ const ee = [
|
|
|
283
288
|
dur: "1s",
|
|
284
289
|
repeatCount: "indefinite"
|
|
285
290
|
}
|
|
286
|
-
)), /* @__PURE__ */
|
|
291
|
+
)), /* @__PURE__ */ d.createElement(
|
|
287
292
|
"animateTransform",
|
|
288
293
|
{
|
|
289
294
|
attributeName: "gradientTransform",
|
|
@@ -294,7 +299,7 @@ const ee = [
|
|
|
294
299
|
repeatCount: "indefinite"
|
|
295
300
|
}
|
|
296
301
|
))),
|
|
297
|
-
/* @__PURE__ */
|
|
302
|
+
/* @__PURE__ */ d.createElement(
|
|
298
303
|
"path",
|
|
299
304
|
{
|
|
300
305
|
fill: "none",
|
|
@@ -307,58 +312,58 @@ const ee = [
|
|
|
307
312
|
)
|
|
308
313
|
);
|
|
309
314
|
};
|
|
310
|
-
async function
|
|
311
|
-
let
|
|
315
|
+
async function St(t, { setContent: e, setIsLoading: n, setConversationId: r, signer: i, baseUrl: o }) {
|
|
316
|
+
let s = "";
|
|
312
317
|
try {
|
|
313
318
|
n(!0);
|
|
314
319
|
const a = {
|
|
315
320
|
method: "POST",
|
|
316
|
-
baseURL:
|
|
321
|
+
baseURL: o,
|
|
317
322
|
url: "/nmail/chatdraft",
|
|
318
323
|
params: t
|
|
319
324
|
};
|
|
320
|
-
let
|
|
321
|
-
i && typeof i.generateHeaders == "function" && (
|
|
322
|
-
const l = await fetch(`${
|
|
325
|
+
let c = {};
|
|
326
|
+
i && typeof i.generateHeaders == "function" && (c = await i.generateHeaders(a));
|
|
327
|
+
const l = await fetch(`${o}/nmail/chatdraft`, {
|
|
323
328
|
method: "POST",
|
|
324
329
|
body: JSON.stringify(t),
|
|
325
330
|
headers: {
|
|
326
331
|
"Content-Type": "application/json",
|
|
327
332
|
"Access-Control-Allow-Origin": "*",
|
|
328
|
-
...
|
|
333
|
+
...c
|
|
329
334
|
}
|
|
330
335
|
});
|
|
331
336
|
if (n(!1), !l.body)
|
|
332
337
|
throw new Error("Response body is not available for streaming.");
|
|
333
|
-
const
|
|
334
|
-
let
|
|
338
|
+
const u = l.body.getReader();
|
|
339
|
+
let f = "", h = 0;
|
|
335
340
|
for (; ; ) {
|
|
336
|
-
const { done:
|
|
337
|
-
if (
|
|
341
|
+
const { done: v, value: g } = await u.read();
|
|
342
|
+
if (v)
|
|
338
343
|
break;
|
|
339
|
-
let
|
|
344
|
+
let m = "", k = "";
|
|
340
345
|
try {
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
const
|
|
344
|
-
for (
|
|
345
|
-
const
|
|
346
|
+
const w = new TextDecoder().decode(g);
|
|
347
|
+
f += w;
|
|
348
|
+
const C = /"answer":".*?"/g, S = /"conversation_id"\s*:\s*"([^"]+)"/, $ = [...f.matchAll(C)], P = f.match(S);
|
|
349
|
+
for (P && P[1] && r(P[1]); h < $.length; ) {
|
|
350
|
+
const z = $[h];
|
|
346
351
|
try {
|
|
347
|
-
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
} catch (
|
|
353
|
-
console.error("Parse error: ",
|
|
352
|
+
m = z[0];
|
|
353
|
+
const _ = m.slice(10, m.length - 1);
|
|
354
|
+
k = `"${_}"`, _.endsWith("\\") && (k = `"${_}\\"`);
|
|
355
|
+
const j = JSON.parse(k);
|
|
356
|
+
s += j, e(s);
|
|
357
|
+
} catch (_) {
|
|
358
|
+
console.error("Parse error: ", _, m, k);
|
|
354
359
|
}
|
|
355
360
|
h++;
|
|
356
361
|
}
|
|
357
|
-
} catch (
|
|
358
|
-
console.error("TextDecoder error: ",
|
|
362
|
+
} catch (w) {
|
|
363
|
+
console.error("TextDecoder error: ", w, m);
|
|
359
364
|
}
|
|
360
365
|
}
|
|
361
|
-
return
|
|
366
|
+
return s;
|
|
362
367
|
} catch (a) {
|
|
363
368
|
console.error("Summary error:", a), e("");
|
|
364
369
|
} finally {
|
|
@@ -366,7 +371,7 @@ async function at(t, { setContent: e, setIsLoading: n, setConversationId: r, sig
|
|
|
366
371
|
}
|
|
367
372
|
return "";
|
|
368
373
|
}
|
|
369
|
-
function
|
|
374
|
+
function ge() {
|
|
370
375
|
return {
|
|
371
376
|
async: !1,
|
|
372
377
|
breaks: !1,
|
|
@@ -380,23 +385,23 @@ function oe() {
|
|
|
380
385
|
walkTokens: null
|
|
381
386
|
};
|
|
382
387
|
}
|
|
383
|
-
var
|
|
384
|
-
function
|
|
385
|
-
|
|
388
|
+
var B = ge();
|
|
389
|
+
function He(t) {
|
|
390
|
+
B = t;
|
|
386
391
|
}
|
|
387
|
-
var
|
|
388
|
-
function
|
|
392
|
+
var H = { exec: () => null };
|
|
393
|
+
function x(t, e = "") {
|
|
389
394
|
let n = typeof t == "string" ? t : t.source;
|
|
390
395
|
const r = {
|
|
391
|
-
replace: (i,
|
|
392
|
-
let
|
|
393
|
-
return
|
|
396
|
+
replace: (i, o) => {
|
|
397
|
+
let s = typeof o == "string" ? o : o.source;
|
|
398
|
+
return s = s.replace(T.caret, "$1"), n = n.replace(i, s), r;
|
|
394
399
|
},
|
|
395
400
|
getRegex: () => new RegExp(n, e)
|
|
396
401
|
};
|
|
397
402
|
return r;
|
|
398
403
|
}
|
|
399
|
-
var
|
|
404
|
+
var T = {
|
|
400
405
|
codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
|
|
401
406
|
outputLinkReplace: /\\([\[\]])/g,
|
|
402
407
|
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
@@ -453,134 +458,134 @@ var y = {
|
|
|
453
458
|
fencesBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:\`\`\`|~~~)`),
|
|
454
459
|
headingBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}#`),
|
|
455
460
|
htmlBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}<(?:[a-z].*>|!--)`, "i")
|
|
456
|
-
},
|
|
461
|
+
}, Et = /^(?:[ \t]*(?:\n|$))+/, Ct = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Rt = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, U = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, _t = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, me = /(?:[*+-]|\d{1,9}[.)])/, Ue = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, qe = x(Ue).replace(/bull/g, me).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Tt = x(Ue).replace(/bull/g, me).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), be = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, It = /^[^\n]+/, ke = /(?!\s*\])(?:\\.|[^\[\]\\])+/, $t = x(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", ke).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), zt = x(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, me).getRegex(), J = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", ve = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Lt = x(
|
|
457
462
|
"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))",
|
|
458
463
|
"i"
|
|
459
|
-
).replace("comment",
|
|
460
|
-
blockquote:
|
|
461
|
-
code:
|
|
462
|
-
def:
|
|
463
|
-
fences:
|
|
464
|
-
heading:
|
|
465
|
-
hr:
|
|
466
|
-
html:
|
|
467
|
-
lheading:
|
|
468
|
-
list:
|
|
469
|
-
newline:
|
|
470
|
-
paragraph:
|
|
471
|
-
table:
|
|
472
|
-
text:
|
|
473
|
-
},
|
|
464
|
+
).replace("comment", ve).replace("tag", J).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), Ge = x(be).replace("hr", U).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", J).getRegex(), Pt = x(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Ge).getRegex(), ye = {
|
|
465
|
+
blockquote: Pt,
|
|
466
|
+
code: Ct,
|
|
467
|
+
def: $t,
|
|
468
|
+
fences: Rt,
|
|
469
|
+
heading: _t,
|
|
470
|
+
hr: U,
|
|
471
|
+
html: Lt,
|
|
472
|
+
lheading: qe,
|
|
473
|
+
list: zt,
|
|
474
|
+
newline: Et,
|
|
475
|
+
paragraph: Ge,
|
|
476
|
+
table: H,
|
|
477
|
+
text: It
|
|
478
|
+
}, Re = x(
|
|
474
479
|
"^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
|
|
475
|
-
).replace("hr",
|
|
476
|
-
...
|
|
477
|
-
lheading:
|
|
478
|
-
table:
|
|
479
|
-
paragraph:
|
|
480
|
-
},
|
|
481
|
-
...
|
|
482
|
-
html:
|
|
480
|
+
).replace("hr", U).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", J).getRegex(), Ot = {
|
|
481
|
+
...ye,
|
|
482
|
+
lheading: Tt,
|
|
483
|
+
table: Re,
|
|
484
|
+
paragraph: x(be).replace("hr", U).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Re).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", J).getRegex()
|
|
485
|
+
}, At = {
|
|
486
|
+
...ye,
|
|
487
|
+
html: x(
|
|
483
488
|
`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
|
|
484
|
-
).replace("comment",
|
|
489
|
+
).replace("comment", ve).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
|
|
485
490
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
486
491
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
487
|
-
fences:
|
|
492
|
+
fences: H,
|
|
488
493
|
// fences not supported
|
|
489
494
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
490
|
-
paragraph:
|
|
491
|
-
]`).replace("lheading",
|
|
492
|
-
},
|
|
495
|
+
paragraph: x(be).replace("hr", U).replace("heading", ` *#{1,6} *[^
|
|
496
|
+
]`).replace("lheading", qe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
497
|
+
}, Dt = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Bt = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, We = /^( {2,}|\\)\n(?!\s*$)/, jt = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, Y = /[\p{P}\p{S}]/u, xe = /[\s\p{P}\p{S}]/u, Fe = /[^\s\p{P}\p{S}]/u, Mt = x(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, xe).getRegex(), Ve = /(?!~)[\p{P}\p{S}]/u, Nt = /(?!~)[\s\p{P}\p{S}]/u, Ht = /(?:[^\s\p{P}\p{S}]|~)/u, Ut = /\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g, Ze = /^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/, qt = x(Ze, "u").replace(/punct/g, Y).getRegex(), Gt = x(Ze, "u").replace(/punct/g, Ve).getRegex(), Ke = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Wt = x(Ke, "gu").replace(/notPunctSpace/g, Fe).replace(/punctSpace/g, xe).replace(/punct/g, Y).getRegex(), Ft = x(Ke, "gu").replace(/notPunctSpace/g, Ht).replace(/punctSpace/g, Nt).replace(/punct/g, Ve).getRegex(), Vt = x(
|
|
493
498
|
"^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)",
|
|
494
499
|
"gu"
|
|
495
|
-
).replace(/notPunctSpace/g,
|
|
500
|
+
).replace(/notPunctSpace/g, Fe).replace(/punctSpace/g, xe).replace(/punct/g, Y).getRegex(), Zt = x(/\\(punct)/, "gu").replace(/punct/g, Y).getRegex(), Kt = x(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), Qt = x(ve).replace("(?:-->|$)", "-->").getRegex(), Jt = x(
|
|
496
501
|
"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>"
|
|
497
|
-
).replace("comment",
|
|
498
|
-
_backpedal:
|
|
502
|
+
).replace("comment", Qt).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), F = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, Yt = x(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label", F).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Qe = x(/^!?\[(label)\]\[(ref)\]/).replace("label", F).replace("ref", ke).getRegex(), Je = x(/^!?\[(ref)\](?:\[\])?/).replace("ref", ke).getRegex(), Xt = x("reflink|nolink(?!\\()", "g").replace("reflink", Qe).replace("nolink", Je).getRegex(), we = {
|
|
503
|
+
_backpedal: H,
|
|
499
504
|
// only used for GFM url
|
|
500
|
-
anyPunctuation:
|
|
501
|
-
autolink:
|
|
502
|
-
blockSkip:
|
|
503
|
-
br:
|
|
504
|
-
code:
|
|
505
|
-
del:
|
|
506
|
-
emStrongLDelim:
|
|
507
|
-
emStrongRDelimAst:
|
|
508
|
-
emStrongRDelimUnd:
|
|
509
|
-
escape:
|
|
510
|
-
link:
|
|
511
|
-
nolink:
|
|
512
|
-
punctuation:
|
|
513
|
-
reflink:
|
|
514
|
-
reflinkSearch:
|
|
515
|
-
tag:
|
|
516
|
-
text:
|
|
517
|
-
url:
|
|
518
|
-
},
|
|
519
|
-
...
|
|
520
|
-
link:
|
|
521
|
-
reflink:
|
|
522
|
-
},
|
|
523
|
-
...
|
|
524
|
-
emStrongRDelimAst:
|
|
525
|
-
emStrongLDelim:
|
|
526
|
-
url:
|
|
505
|
+
anyPunctuation: Zt,
|
|
506
|
+
autolink: Kt,
|
|
507
|
+
blockSkip: Ut,
|
|
508
|
+
br: We,
|
|
509
|
+
code: Bt,
|
|
510
|
+
del: H,
|
|
511
|
+
emStrongLDelim: qt,
|
|
512
|
+
emStrongRDelimAst: Wt,
|
|
513
|
+
emStrongRDelimUnd: Vt,
|
|
514
|
+
escape: Dt,
|
|
515
|
+
link: Yt,
|
|
516
|
+
nolink: Je,
|
|
517
|
+
punctuation: Mt,
|
|
518
|
+
reflink: Qe,
|
|
519
|
+
reflinkSearch: Xt,
|
|
520
|
+
tag: Jt,
|
|
521
|
+
text: jt,
|
|
522
|
+
url: H
|
|
523
|
+
}, en = {
|
|
524
|
+
...we,
|
|
525
|
+
link: x(/^!?\[(label)\]\((.*?)\)/).replace("label", F).getRegex(),
|
|
526
|
+
reflink: x(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", F).getRegex()
|
|
527
|
+
}, se = {
|
|
528
|
+
...we,
|
|
529
|
+
emStrongRDelimAst: Ft,
|
|
530
|
+
emStrongLDelim: Gt,
|
|
531
|
+
url: x(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
527
532
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
528
533
|
del: /^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,
|
|
529
534
|
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
530
|
-
},
|
|
531
|
-
...
|
|
532
|
-
br:
|
|
533
|
-
text:
|
|
534
|
-
},
|
|
535
|
-
normal:
|
|
536
|
-
gfm:
|
|
537
|
-
pedantic:
|
|
538
|
-
},
|
|
539
|
-
normal:
|
|
540
|
-
gfm:
|
|
541
|
-
breaks:
|
|
542
|
-
pedantic:
|
|
543
|
-
},
|
|
535
|
+
}, tn = {
|
|
536
|
+
...se,
|
|
537
|
+
br: x(We).replace("{2,}", "*").getRegex(),
|
|
538
|
+
text: x(se.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
539
|
+
}, G = {
|
|
540
|
+
normal: ye,
|
|
541
|
+
gfm: Ot,
|
|
542
|
+
pedantic: At
|
|
543
|
+
}, M = {
|
|
544
|
+
normal: we,
|
|
545
|
+
gfm: se,
|
|
546
|
+
breaks: tn,
|
|
547
|
+
pedantic: en
|
|
548
|
+
}, nn = {
|
|
544
549
|
"&": "&",
|
|
545
550
|
"<": "<",
|
|
546
551
|
">": ">",
|
|
547
552
|
'"': """,
|
|
548
553
|
"'": "'"
|
|
549
|
-
},
|
|
550
|
-
function
|
|
554
|
+
}, _e = (t) => nn[t];
|
|
555
|
+
function L(t, e) {
|
|
551
556
|
if (e) {
|
|
552
|
-
if (
|
|
553
|
-
return t.replace(
|
|
554
|
-
} else if (
|
|
555
|
-
return t.replace(
|
|
557
|
+
if (T.escapeTest.test(t))
|
|
558
|
+
return t.replace(T.escapeReplace, _e);
|
|
559
|
+
} else if (T.escapeTestNoEncode.test(t))
|
|
560
|
+
return t.replace(T.escapeReplaceNoEncode, _e);
|
|
556
561
|
return t;
|
|
557
562
|
}
|
|
558
|
-
function
|
|
563
|
+
function Te(t) {
|
|
559
564
|
try {
|
|
560
|
-
t = encodeURI(t).replace(
|
|
565
|
+
t = encodeURI(t).replace(T.percentDecode, "%");
|
|
561
566
|
} catch {
|
|
562
567
|
return null;
|
|
563
568
|
}
|
|
564
569
|
return t;
|
|
565
570
|
}
|
|
566
|
-
function
|
|
567
|
-
var
|
|
568
|
-
const n = t.replace(
|
|
569
|
-
let l = !1,
|
|
570
|
-
for (; --
|
|
571
|
+
function Ie(t, e) {
|
|
572
|
+
var o;
|
|
573
|
+
const n = t.replace(T.findPipe, (s, a, c) => {
|
|
574
|
+
let l = !1, u = a;
|
|
575
|
+
for (; --u >= 0 && c[u] === "\\"; ) l = !l;
|
|
571
576
|
return l ? "|" : " |";
|
|
572
|
-
}), r = n.split(
|
|
577
|
+
}), r = n.split(T.splitPipe);
|
|
573
578
|
let i = 0;
|
|
574
|
-
if (r[0].trim() || r.shift(), r.length > 0 && !((
|
|
579
|
+
if (r[0].trim() || r.shift(), r.length > 0 && !((o = r.at(-1)) != null && o.trim()) && r.pop(), e)
|
|
575
580
|
if (r.length > e)
|
|
576
581
|
r.splice(e);
|
|
577
582
|
else
|
|
578
583
|
for (; r.length < e; ) r.push("");
|
|
579
584
|
for (; i < r.length; i++)
|
|
580
|
-
r[i] = r[i].trim().replace(
|
|
585
|
+
r[i] = r[i].trim().replace(T.slashPipe, "|");
|
|
581
586
|
return r;
|
|
582
587
|
}
|
|
583
|
-
function
|
|
588
|
+
function N(t, e, n) {
|
|
584
589
|
const r = t.length;
|
|
585
590
|
if (r === 0)
|
|
586
591
|
return "";
|
|
@@ -589,7 +594,7 @@ function B(t, e, n) {
|
|
|
589
594
|
i++;
|
|
590
595
|
return t.slice(0, r - i);
|
|
591
596
|
}
|
|
592
|
-
function
|
|
597
|
+
function rn(t, e) {
|
|
593
598
|
if (t.indexOf(e[1]) === -1)
|
|
594
599
|
return -1;
|
|
595
600
|
let n = 0;
|
|
@@ -602,42 +607,42 @@ function Mt(t, e) {
|
|
|
602
607
|
return r;
|
|
603
608
|
return n > 0 ? -2 : -1;
|
|
604
609
|
}
|
|
605
|
-
function
|
|
606
|
-
const
|
|
610
|
+
function $e(t, e, n, r, i) {
|
|
611
|
+
const o = e.href, s = e.title || null, a = t[1].replace(i.other.outputLinkReplace, "$1");
|
|
607
612
|
r.state.inLink = !0;
|
|
608
|
-
const
|
|
613
|
+
const c = {
|
|
609
614
|
type: t[0].charAt(0) === "!" ? "image" : "link",
|
|
610
615
|
raw: n,
|
|
611
|
-
href:
|
|
612
|
-
title:
|
|
616
|
+
href: o,
|
|
617
|
+
title: s,
|
|
613
618
|
text: a,
|
|
614
619
|
tokens: r.inlineTokens(a)
|
|
615
620
|
};
|
|
616
|
-
return r.state.inLink = !1,
|
|
621
|
+
return r.state.inLink = !1, c;
|
|
617
622
|
}
|
|
618
|
-
function
|
|
623
|
+
function on(t, e, n) {
|
|
619
624
|
const r = t.match(n.other.indentCodeCompensation);
|
|
620
625
|
if (r === null)
|
|
621
626
|
return e;
|
|
622
627
|
const i = r[1];
|
|
623
628
|
return e.split(`
|
|
624
|
-
`).map((
|
|
625
|
-
const
|
|
626
|
-
if (
|
|
627
|
-
return
|
|
628
|
-
const [a] =
|
|
629
|
-
return a.length >= i.length ?
|
|
629
|
+
`).map((o) => {
|
|
630
|
+
const s = o.match(n.other.beginningSpace);
|
|
631
|
+
if (s === null)
|
|
632
|
+
return o;
|
|
633
|
+
const [a] = s;
|
|
634
|
+
return a.length >= i.length ? o.slice(i.length) : o;
|
|
630
635
|
}).join(`
|
|
631
636
|
`);
|
|
632
637
|
}
|
|
633
|
-
var
|
|
638
|
+
var V = class {
|
|
634
639
|
// set by the lexer
|
|
635
640
|
constructor(t) {
|
|
636
|
-
|
|
637
|
-
|
|
641
|
+
b(this, "options");
|
|
642
|
+
b(this, "rules");
|
|
638
643
|
// set by the lexer
|
|
639
|
-
|
|
640
|
-
this.options = t ||
|
|
644
|
+
b(this, "lexer");
|
|
645
|
+
this.options = t || B;
|
|
641
646
|
}
|
|
642
647
|
space(t) {
|
|
643
648
|
const e = this.rules.block.newline.exec(t);
|
|
@@ -655,7 +660,7 @@ var Z = class {
|
|
|
655
660
|
type: "code",
|
|
656
661
|
raw: e[0],
|
|
657
662
|
codeBlockStyle: "indented",
|
|
658
|
-
text: this.options.pedantic ? n :
|
|
663
|
+
text: this.options.pedantic ? n : N(n, `
|
|
659
664
|
`)
|
|
660
665
|
};
|
|
661
666
|
}
|
|
@@ -663,7 +668,7 @@ var Z = class {
|
|
|
663
668
|
fences(t) {
|
|
664
669
|
const e = this.rules.block.fences.exec(t);
|
|
665
670
|
if (e) {
|
|
666
|
-
const n = e[0], r =
|
|
671
|
+
const n = e[0], r = on(n, e[3] || "", this.rules);
|
|
667
672
|
return {
|
|
668
673
|
type: "code",
|
|
669
674
|
raw: n,
|
|
@@ -677,7 +682,7 @@ var Z = class {
|
|
|
677
682
|
if (e) {
|
|
678
683
|
let n = e[2].trim();
|
|
679
684
|
if (this.rules.other.endingHash.test(n)) {
|
|
680
|
-
const r =
|
|
685
|
+
const r = N(n, "#");
|
|
681
686
|
(this.options.pedantic || !r || this.rules.other.endingSpaceChar.test(r)) && (n = r.trim());
|
|
682
687
|
}
|
|
683
688
|
return {
|
|
@@ -694,52 +699,52 @@ var Z = class {
|
|
|
694
699
|
if (e)
|
|
695
700
|
return {
|
|
696
701
|
type: "hr",
|
|
697
|
-
raw:
|
|
702
|
+
raw: N(e[0], `
|
|
698
703
|
`)
|
|
699
704
|
};
|
|
700
705
|
}
|
|
701
706
|
blockquote(t) {
|
|
702
707
|
const e = this.rules.block.blockquote.exec(t);
|
|
703
708
|
if (e) {
|
|
704
|
-
let n =
|
|
709
|
+
let n = N(e[0], `
|
|
705
710
|
`).split(`
|
|
706
711
|
`), r = "", i = "";
|
|
707
|
-
const
|
|
712
|
+
const o = [];
|
|
708
713
|
for (; n.length > 0; ) {
|
|
709
|
-
let
|
|
714
|
+
let s = !1;
|
|
710
715
|
const a = [];
|
|
711
|
-
let
|
|
712
|
-
for (
|
|
713
|
-
if (this.rules.other.blockquoteStart.test(n[
|
|
714
|
-
a.push(n[
|
|
715
|
-
else if (!
|
|
716
|
-
a.push(n[
|
|
716
|
+
let c;
|
|
717
|
+
for (c = 0; c < n.length; c++)
|
|
718
|
+
if (this.rules.other.blockquoteStart.test(n[c]))
|
|
719
|
+
a.push(n[c]), s = !0;
|
|
720
|
+
else if (!s)
|
|
721
|
+
a.push(n[c]);
|
|
717
722
|
else
|
|
718
723
|
break;
|
|
719
|
-
n = n.slice(
|
|
724
|
+
n = n.slice(c);
|
|
720
725
|
const l = a.join(`
|
|
721
|
-
`),
|
|
726
|
+
`), u = l.replace(this.rules.other.blockquoteSetextReplace, `
|
|
722
727
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
723
728
|
r = r ? `${r}
|
|
724
729
|
${l}` : l, i = i ? `${i}
|
|
725
|
-
${
|
|
726
|
-
const
|
|
727
|
-
if (this.lexer.state.top = !0, this.lexer.blockTokens(
|
|
730
|
+
${u}` : u;
|
|
731
|
+
const f = this.lexer.state.top;
|
|
732
|
+
if (this.lexer.state.top = !0, this.lexer.blockTokens(u, o, !0), this.lexer.state.top = f, n.length === 0)
|
|
728
733
|
break;
|
|
729
|
-
const h =
|
|
734
|
+
const h = o.at(-1);
|
|
730
735
|
if ((h == null ? void 0 : h.type) === "code")
|
|
731
736
|
break;
|
|
732
737
|
if ((h == null ? void 0 : h.type) === "blockquote") {
|
|
733
|
-
const
|
|
738
|
+
const v = h, g = v.raw + `
|
|
734
739
|
` + n.join(`
|
|
735
|
-
`),
|
|
736
|
-
|
|
740
|
+
`), m = this.blockquote(g);
|
|
741
|
+
o[o.length - 1] = m, r = r.substring(0, r.length - v.raw.length) + m.raw, i = i.substring(0, i.length - v.text.length) + m.text;
|
|
737
742
|
break;
|
|
738
743
|
} else if ((h == null ? void 0 : h.type) === "list") {
|
|
739
|
-
const
|
|
744
|
+
const v = h, g = v.raw + `
|
|
740
745
|
` + n.join(`
|
|
741
|
-
`),
|
|
742
|
-
|
|
746
|
+
`), m = this.list(g);
|
|
747
|
+
o[o.length - 1] = m, r = r.substring(0, r.length - h.raw.length) + m.raw, i = i.substring(0, i.length - v.raw.length) + m.raw, n = g.substring(o.at(-1).raw.length).split(`
|
|
743
748
|
`);
|
|
744
749
|
continue;
|
|
745
750
|
}
|
|
@@ -747,7 +752,7 @@ ${c}` : c;
|
|
|
747
752
|
return {
|
|
748
753
|
type: "blockquote",
|
|
749
754
|
raw: r,
|
|
750
|
-
tokens:
|
|
755
|
+
tokens: o,
|
|
751
756
|
text: i
|
|
752
757
|
};
|
|
753
758
|
}
|
|
@@ -765,47 +770,47 @@ ${c}` : c;
|
|
|
765
770
|
items: []
|
|
766
771
|
};
|
|
767
772
|
n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
|
|
768
|
-
const
|
|
769
|
-
let
|
|
773
|
+
const o = this.rules.other.listItemRegex(n);
|
|
774
|
+
let s = !1;
|
|
770
775
|
for (; t; ) {
|
|
771
|
-
let
|
|
772
|
-
if (!(e =
|
|
776
|
+
let c = !1, l = "", u = "";
|
|
777
|
+
if (!(e = o.exec(t)) || this.rules.block.hr.test(t))
|
|
773
778
|
break;
|
|
774
779
|
l = e[0], t = t.substring(l.length);
|
|
775
|
-
let
|
|
776
|
-
`, 1)[0].replace(this.rules.other.listReplaceTabs, (
|
|
777
|
-
`, 1)[0],
|
|
778
|
-
if (this.options.pedantic ? (
|
|
779
|
-
`, t = t.substring(h.length + 1),
|
|
780
|
-
const
|
|
780
|
+
let f = e[2].split(`
|
|
781
|
+
`, 1)[0].replace(this.rules.other.listReplaceTabs, (w) => " ".repeat(3 * w.length)), h = t.split(`
|
|
782
|
+
`, 1)[0], v = !f.trim(), g = 0;
|
|
783
|
+
if (this.options.pedantic ? (g = 2, u = f.trimStart()) : v ? g = e[1].length + 1 : (g = e[2].search(this.rules.other.nonSpaceChar), g = g > 4 ? 1 : g, u = f.slice(g), g += e[1].length), v && this.rules.other.blankLine.test(h) && (l += h + `
|
|
784
|
+
`, t = t.substring(h.length + 1), c = !0), !c) {
|
|
785
|
+
const w = this.rules.other.nextBulletRegex(g), C = this.rules.other.hrRegex(g), S = this.rules.other.fencesBeginRegex(g), $ = this.rules.other.headingBeginRegex(g), P = this.rules.other.htmlBeginRegex(g);
|
|
781
786
|
for (; t; ) {
|
|
782
|
-
const
|
|
787
|
+
const z = t.split(`
|
|
783
788
|
`, 1)[0];
|
|
784
|
-
let
|
|
785
|
-
if (h =
|
|
789
|
+
let _;
|
|
790
|
+
if (h = z, this.options.pedantic ? (h = h.replace(this.rules.other.listReplaceNesting, " "), _ = h) : _ = h.replace(this.rules.other.tabCharGlobal, " "), S.test(h) || $.test(h) || P.test(h) || w.test(h) || C.test(h))
|
|
786
791
|
break;
|
|
787
|
-
if (
|
|
788
|
-
|
|
789
|
-
` +
|
|
792
|
+
if (_.search(this.rules.other.nonSpaceChar) >= g || !h.trim())
|
|
793
|
+
u += `
|
|
794
|
+
` + _.slice(g);
|
|
790
795
|
else {
|
|
791
|
-
if (
|
|
796
|
+
if (v || f.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || S.test(f) || $.test(f) || C.test(f))
|
|
792
797
|
break;
|
|
793
|
-
|
|
798
|
+
u += `
|
|
794
799
|
` + h;
|
|
795
800
|
}
|
|
796
|
-
!
|
|
797
|
-
`, t = t.substring(
|
|
801
|
+
!v && !h.trim() && (v = !0), l += z + `
|
|
802
|
+
`, t = t.substring(z.length + 1), f = _.slice(g);
|
|
798
803
|
}
|
|
799
804
|
}
|
|
800
|
-
i.loose || (
|
|
801
|
-
let
|
|
802
|
-
this.options.gfm && (
|
|
805
|
+
i.loose || (s ? i.loose = !0 : this.rules.other.doubleBlankLine.test(l) && (s = !0));
|
|
806
|
+
let m = null, k;
|
|
807
|
+
this.options.gfm && (m = this.rules.other.listIsTask.exec(u), m && (k = m[0] !== "[ ] ", u = u.replace(this.rules.other.listReplaceTask, ""))), i.items.push({
|
|
803
808
|
type: "list_item",
|
|
804
809
|
raw: l,
|
|
805
|
-
task: !!
|
|
806
|
-
checked:
|
|
810
|
+
task: !!m,
|
|
811
|
+
checked: k,
|
|
807
812
|
loose: !1,
|
|
808
|
-
text:
|
|
813
|
+
text: u,
|
|
809
814
|
tokens: []
|
|
810
815
|
}), i.raw += l;
|
|
811
816
|
}
|
|
@@ -815,14 +820,14 @@ ${c}` : c;
|
|
|
815
820
|
else
|
|
816
821
|
return;
|
|
817
822
|
i.raw = i.raw.trimEnd();
|
|
818
|
-
for (let
|
|
819
|
-
if (this.lexer.state.top = !1, i.items[
|
|
820
|
-
const l = i.items[
|
|
821
|
-
i.loose =
|
|
823
|
+
for (let c = 0; c < i.items.length; c++)
|
|
824
|
+
if (this.lexer.state.top = !1, i.items[c].tokens = this.lexer.blockTokens(i.items[c].text, []), !i.loose) {
|
|
825
|
+
const l = i.items[c].tokens.filter((f) => f.type === "space"), u = l.length > 0 && l.some((f) => this.rules.other.anyLine.test(f.raw));
|
|
826
|
+
i.loose = u;
|
|
822
827
|
}
|
|
823
828
|
if (i.loose)
|
|
824
|
-
for (let
|
|
825
|
-
i.items[
|
|
829
|
+
for (let c = 0; c < i.items.length; c++)
|
|
830
|
+
i.items[c].loose = !0;
|
|
826
831
|
return i;
|
|
827
832
|
}
|
|
828
833
|
}
|
|
@@ -851,12 +856,12 @@ ${c}` : c;
|
|
|
851
856
|
}
|
|
852
857
|
}
|
|
853
858
|
table(t) {
|
|
854
|
-
var
|
|
859
|
+
var s;
|
|
855
860
|
const e = this.rules.block.table.exec(t);
|
|
856
861
|
if (!e || !this.rules.other.tableDelimiter.test(e[2]))
|
|
857
862
|
return;
|
|
858
|
-
const n =
|
|
859
|
-
`) : [],
|
|
863
|
+
const n = Ie(e[1]), r = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = (s = e[3]) != null && s.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
864
|
+
`) : [], o = {
|
|
860
865
|
type: "table",
|
|
861
866
|
raw: e[0],
|
|
862
867
|
header: [],
|
|
@@ -865,22 +870,22 @@ ${c}` : c;
|
|
|
865
870
|
};
|
|
866
871
|
if (n.length === r.length) {
|
|
867
872
|
for (const a of r)
|
|
868
|
-
this.rules.other.tableAlignRight.test(a) ?
|
|
873
|
+
this.rules.other.tableAlignRight.test(a) ? o.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? o.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? o.align.push("left") : o.align.push(null);
|
|
869
874
|
for (let a = 0; a < n.length; a++)
|
|
870
|
-
|
|
875
|
+
o.header.push({
|
|
871
876
|
text: n[a],
|
|
872
877
|
tokens: this.lexer.inline(n[a]),
|
|
873
878
|
header: !0,
|
|
874
|
-
align:
|
|
879
|
+
align: o.align[a]
|
|
875
880
|
});
|
|
876
881
|
for (const a of i)
|
|
877
|
-
|
|
878
|
-
text:
|
|
879
|
-
tokens: this.lexer.inline(
|
|
882
|
+
o.rows.push(Ie(a, o.header.length).map((c, l) => ({
|
|
883
|
+
text: c,
|
|
884
|
+
tokens: this.lexer.inline(c),
|
|
880
885
|
header: !1,
|
|
881
|
-
align:
|
|
886
|
+
align: o.align[l]
|
|
882
887
|
})));
|
|
883
|
-
return
|
|
888
|
+
return o;
|
|
884
889
|
}
|
|
885
890
|
}
|
|
886
891
|
lheading(t) {
|
|
@@ -945,25 +950,25 @@ ${c}` : c;
|
|
|
945
950
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(n)) {
|
|
946
951
|
if (!this.rules.other.endAngleBracket.test(n))
|
|
947
952
|
return;
|
|
948
|
-
const
|
|
949
|
-
if ((n.length -
|
|
953
|
+
const o = N(n.slice(0, -1), "\\");
|
|
954
|
+
if ((n.length - o.length) % 2 === 0)
|
|
950
955
|
return;
|
|
951
956
|
} else {
|
|
952
|
-
const
|
|
953
|
-
if (
|
|
957
|
+
const o = rn(e[2], "()");
|
|
958
|
+
if (o === -2)
|
|
954
959
|
return;
|
|
955
|
-
if (
|
|
956
|
-
const a = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length +
|
|
957
|
-
e[2] = e[2].substring(0,
|
|
960
|
+
if (o > -1) {
|
|
961
|
+
const a = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + o;
|
|
962
|
+
e[2] = e[2].substring(0, o), e[0] = e[0].substring(0, a).trim(), e[3] = "";
|
|
958
963
|
}
|
|
959
964
|
}
|
|
960
965
|
let r = e[2], i = "";
|
|
961
966
|
if (this.options.pedantic) {
|
|
962
|
-
const
|
|
963
|
-
|
|
967
|
+
const o = this.rules.other.pedanticHrefTitle.exec(r);
|
|
968
|
+
o && (r = o[1], i = o[3]);
|
|
964
969
|
} else
|
|
965
970
|
i = e[3] ? e[3].slice(1, -1) : "";
|
|
966
|
-
return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)),
|
|
971
|
+
return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), $e(e, {
|
|
967
972
|
href: r && r.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
968
973
|
title: i && i.replace(this.rules.inline.anyPunctuation, "$1")
|
|
969
974
|
}, e[0], this.lexer, this.rules);
|
|
@@ -974,50 +979,50 @@ ${c}` : c;
|
|
|
974
979
|
if ((n = this.rules.inline.reflink.exec(t)) || (n = this.rules.inline.nolink.exec(t))) {
|
|
975
980
|
const r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), i = e[r.toLowerCase()];
|
|
976
981
|
if (!i) {
|
|
977
|
-
const
|
|
982
|
+
const o = n[0].charAt(0);
|
|
978
983
|
return {
|
|
979
984
|
type: "text",
|
|
980
|
-
raw:
|
|
981
|
-
text:
|
|
985
|
+
raw: o,
|
|
986
|
+
text: o
|
|
982
987
|
};
|
|
983
988
|
}
|
|
984
|
-
return
|
|
989
|
+
return $e(n, i, n[0], this.lexer, this.rules);
|
|
985
990
|
}
|
|
986
991
|
}
|
|
987
992
|
emStrong(t, e, n = "") {
|
|
988
993
|
let r = this.rules.inline.emStrongLDelim.exec(t);
|
|
989
994
|
if (!r || r[3] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
990
995
|
if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
991
|
-
const
|
|
992
|
-
let
|
|
993
|
-
const
|
|
994
|
-
for (
|
|
995
|
-
if (
|
|
996
|
-
if (a = [...
|
|
997
|
-
|
|
996
|
+
const o = [...r[0]].length - 1;
|
|
997
|
+
let s, a, c = o, l = 0;
|
|
998
|
+
const u = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
999
|
+
for (u.lastIndex = 0, e = e.slice(-1 * t.length + o); (r = u.exec(e)) != null; ) {
|
|
1000
|
+
if (s = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !s) continue;
|
|
1001
|
+
if (a = [...s].length, r[3] || r[4]) {
|
|
1002
|
+
c += a;
|
|
998
1003
|
continue;
|
|
999
|
-
} else if ((r[5] || r[6]) &&
|
|
1004
|
+
} else if ((r[5] || r[6]) && o % 3 && !((o + a) % 3)) {
|
|
1000
1005
|
l += a;
|
|
1001
1006
|
continue;
|
|
1002
1007
|
}
|
|
1003
|
-
if (
|
|
1004
|
-
a = Math.min(a, a +
|
|
1005
|
-
const
|
|
1006
|
-
if (Math.min(
|
|
1007
|
-
const
|
|
1008
|
+
if (c -= a, c > 0) continue;
|
|
1009
|
+
a = Math.min(a, a + c + l);
|
|
1010
|
+
const f = [...r[0]][0].length, h = t.slice(0, o + r.index + f + a);
|
|
1011
|
+
if (Math.min(o, a) % 2) {
|
|
1012
|
+
const g = h.slice(1, -1);
|
|
1008
1013
|
return {
|
|
1009
1014
|
type: "em",
|
|
1010
1015
|
raw: h,
|
|
1011
|
-
text:
|
|
1012
|
-
tokens: this.lexer.inlineTokens(
|
|
1016
|
+
text: g,
|
|
1017
|
+
tokens: this.lexer.inlineTokens(g)
|
|
1013
1018
|
};
|
|
1014
1019
|
}
|
|
1015
|
-
const
|
|
1020
|
+
const v = h.slice(2, -2);
|
|
1016
1021
|
return {
|
|
1017
1022
|
type: "strong",
|
|
1018
1023
|
raw: h,
|
|
1019
|
-
text:
|
|
1020
|
-
tokens: this.lexer.inlineTokens(
|
|
1024
|
+
text: v,
|
|
1025
|
+
tokens: this.lexer.inlineTokens(v)
|
|
1021
1026
|
};
|
|
1022
1027
|
}
|
|
1023
1028
|
}
|
|
@@ -1079,10 +1084,10 @@ ${c}` : c;
|
|
|
1079
1084
|
if (e[2] === "@")
|
|
1080
1085
|
r = e[0], i = "mailto:" + r;
|
|
1081
1086
|
else {
|
|
1082
|
-
let
|
|
1087
|
+
let o;
|
|
1083
1088
|
do
|
|
1084
|
-
|
|
1085
|
-
while (
|
|
1089
|
+
o = e[0], e[0] = ((n = this.rules.inline._backpedal.exec(e[0])) == null ? void 0 : n[0]) ?? "";
|
|
1090
|
+
while (o !== e[0]);
|
|
1086
1091
|
r = e[0], e[1] === "www." ? i = "http://" + e[0] : i = e[0];
|
|
1087
1092
|
}
|
|
1088
1093
|
return {
|
|
@@ -1112,51 +1117,51 @@ ${c}` : c;
|
|
|
1112
1117
|
};
|
|
1113
1118
|
}
|
|
1114
1119
|
}
|
|
1115
|
-
},
|
|
1120
|
+
}, O = class ae {
|
|
1116
1121
|
constructor(e) {
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e ||
|
|
1122
|
+
b(this, "tokens");
|
|
1123
|
+
b(this, "options");
|
|
1124
|
+
b(this, "state");
|
|
1125
|
+
b(this, "tokenizer");
|
|
1126
|
+
b(this, "inlineQueue");
|
|
1127
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || B, this.options.tokenizer = this.options.tokenizer || new V(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
1123
1128
|
inLink: !1,
|
|
1124
1129
|
inRawBlock: !1,
|
|
1125
1130
|
top: !0
|
|
1126
1131
|
};
|
|
1127
1132
|
const n = {
|
|
1128
|
-
other:
|
|
1129
|
-
block:
|
|
1130
|
-
inline:
|
|
1133
|
+
other: T,
|
|
1134
|
+
block: G.normal,
|
|
1135
|
+
inline: M.normal
|
|
1131
1136
|
};
|
|
1132
|
-
this.options.pedantic ? (n.block =
|
|
1137
|
+
this.options.pedantic ? (n.block = G.pedantic, n.inline = M.pedantic) : this.options.gfm && (n.block = G.gfm, this.options.breaks ? n.inline = M.breaks : n.inline = M.gfm), this.tokenizer.rules = n;
|
|
1133
1138
|
}
|
|
1134
1139
|
/**
|
|
1135
1140
|
* Expose Rules
|
|
1136
1141
|
*/
|
|
1137
1142
|
static get rules() {
|
|
1138
1143
|
return {
|
|
1139
|
-
block:
|
|
1140
|
-
inline:
|
|
1144
|
+
block: G,
|
|
1145
|
+
inline: M
|
|
1141
1146
|
};
|
|
1142
1147
|
}
|
|
1143
1148
|
/**
|
|
1144
1149
|
* Static Lex Method
|
|
1145
1150
|
*/
|
|
1146
1151
|
static lex(e, n) {
|
|
1147
|
-
return new
|
|
1152
|
+
return new ae(n).lex(e);
|
|
1148
1153
|
}
|
|
1149
1154
|
/**
|
|
1150
1155
|
* Static Lex Inline Method
|
|
1151
1156
|
*/
|
|
1152
1157
|
static lexInline(e, n) {
|
|
1153
|
-
return new
|
|
1158
|
+
return new ae(n).inlineTokens(e);
|
|
1154
1159
|
}
|
|
1155
1160
|
/**
|
|
1156
1161
|
* Preprocessing
|
|
1157
1162
|
*/
|
|
1158
1163
|
lex(e) {
|
|
1159
|
-
e = e.replace(
|
|
1164
|
+
e = e.replace(T.carriageReturn, `
|
|
1160
1165
|
`), this.blockTokens(e, this.tokens);
|
|
1161
1166
|
for (let n = 0; n < this.inlineQueue.length; n++) {
|
|
1162
1167
|
const r = this.inlineQueue[n];
|
|
@@ -1165,10 +1170,10 @@ ${c}` : c;
|
|
|
1165
1170
|
return this.inlineQueue = [], this.tokens;
|
|
1166
1171
|
}
|
|
1167
1172
|
blockTokens(e, n = [], r = !1) {
|
|
1168
|
-
var i,
|
|
1169
|
-
for (this.options.pedantic && (e = e.replace(
|
|
1173
|
+
var i, o, s;
|
|
1174
|
+
for (this.options.pedantic && (e = e.replace(T.tabCharGlobal, " ").replace(T.spaceLine, "")); e; ) {
|
|
1170
1175
|
let a;
|
|
1171
|
-
if ((
|
|
1176
|
+
if ((o = (i = this.options.extensions) == null ? void 0 : i.block) != null && o.some((l) => (a = l.call({ lexer: this }, e, n)) ? (e = e.substring(a.raw.length), n.push(a), !0) : !1))
|
|
1172
1177
|
continue;
|
|
1173
1178
|
if (a = this.tokenizer.space(e)) {
|
|
1174
1179
|
e = e.substring(a.raw.length);
|
|
@@ -1228,20 +1233,20 @@ ${c}` : c;
|
|
|
1228
1233
|
e = e.substring(a.raw.length), n.push(a);
|
|
1229
1234
|
continue;
|
|
1230
1235
|
}
|
|
1231
|
-
let
|
|
1232
|
-
if ((
|
|
1236
|
+
let c = e;
|
|
1237
|
+
if ((s = this.options.extensions) != null && s.startBlock) {
|
|
1233
1238
|
let l = 1 / 0;
|
|
1234
|
-
const
|
|
1235
|
-
let
|
|
1239
|
+
const u = e.slice(1);
|
|
1240
|
+
let f;
|
|
1236
1241
|
this.options.extensions.startBlock.forEach((h) => {
|
|
1237
|
-
|
|
1238
|
-
}), l < 1 / 0 && l >= 0 && (
|
|
1242
|
+
f = h.call({ lexer: this }, u), typeof f == "number" && f >= 0 && (l = Math.min(l, f));
|
|
1243
|
+
}), l < 1 / 0 && l >= 0 && (c = e.substring(0, l + 1));
|
|
1239
1244
|
}
|
|
1240
|
-
if (this.state.top && (a = this.tokenizer.paragraph(
|
|
1245
|
+
if (this.state.top && (a = this.tokenizer.paragraph(c))) {
|
|
1241
1246
|
const l = n.at(-1);
|
|
1242
1247
|
r && (l == null ? void 0 : l.type) === "paragraph" ? (l.raw += `
|
|
1243
1248
|
` + a.raw, l.text += `
|
|
1244
|
-
` + a.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = l.text) : n.push(a), r =
|
|
1249
|
+
` + a.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = l.text) : n.push(a), r = c.length !== e.length, e = e.substring(a.raw.length);
|
|
1245
1250
|
continue;
|
|
1246
1251
|
}
|
|
1247
1252
|
if (a = this.tokenizer.text(e)) {
|
|
@@ -1270,79 +1275,79 @@ ${c}` : c;
|
|
|
1270
1275
|
* Lexing/Compiling
|
|
1271
1276
|
*/
|
|
1272
1277
|
inlineTokens(e, n = []) {
|
|
1273
|
-
var a,
|
|
1278
|
+
var a, c, l;
|
|
1274
1279
|
let r = e, i = null;
|
|
1275
1280
|
if (this.tokens.links) {
|
|
1276
|
-
const
|
|
1277
|
-
if (
|
|
1281
|
+
const u = Object.keys(this.tokens.links);
|
|
1282
|
+
if (u.length > 0)
|
|
1278
1283
|
for (; (i = this.tokenizer.rules.inline.reflinkSearch.exec(r)) != null; )
|
|
1279
|
-
|
|
1284
|
+
u.includes(i[0].slice(i[0].lastIndexOf("[") + 1, -1)) && (r = r.slice(0, i.index) + "[" + "a".repeat(i[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
|
|
1280
1285
|
}
|
|
1281
1286
|
for (; (i = this.tokenizer.rules.inline.anyPunctuation.exec(r)) != null; )
|
|
1282
1287
|
r = r.slice(0, i.index) + "++" + r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
|
1283
1288
|
for (; (i = this.tokenizer.rules.inline.blockSkip.exec(r)) != null; )
|
|
1284
1289
|
r = r.slice(0, i.index) + "[" + "a".repeat(i[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
1285
|
-
let
|
|
1290
|
+
let o = !1, s = "";
|
|
1286
1291
|
for (; e; ) {
|
|
1287
|
-
|
|
1288
|
-
let
|
|
1289
|
-
if ((
|
|
1292
|
+
o || (s = ""), o = !1;
|
|
1293
|
+
let u;
|
|
1294
|
+
if ((c = (a = this.options.extensions) == null ? void 0 : a.inline) != null && c.some((h) => (u = h.call({ lexer: this }, e, n)) ? (e = e.substring(u.raw.length), n.push(u), !0) : !1))
|
|
1290
1295
|
continue;
|
|
1291
|
-
if (
|
|
1292
|
-
e = e.substring(
|
|
1296
|
+
if (u = this.tokenizer.escape(e)) {
|
|
1297
|
+
e = e.substring(u.raw.length), n.push(u);
|
|
1293
1298
|
continue;
|
|
1294
1299
|
}
|
|
1295
|
-
if (
|
|
1296
|
-
e = e.substring(
|
|
1300
|
+
if (u = this.tokenizer.tag(e)) {
|
|
1301
|
+
e = e.substring(u.raw.length), n.push(u);
|
|
1297
1302
|
continue;
|
|
1298
1303
|
}
|
|
1299
|
-
if (
|
|
1300
|
-
e = e.substring(
|
|
1304
|
+
if (u = this.tokenizer.link(e)) {
|
|
1305
|
+
e = e.substring(u.raw.length), n.push(u);
|
|
1301
1306
|
continue;
|
|
1302
1307
|
}
|
|
1303
|
-
if (
|
|
1304
|
-
e = e.substring(
|
|
1308
|
+
if (u = this.tokenizer.reflink(e, this.tokens.links)) {
|
|
1309
|
+
e = e.substring(u.raw.length);
|
|
1305
1310
|
const h = n.at(-1);
|
|
1306
|
-
|
|
1311
|
+
u.type === "text" && (h == null ? void 0 : h.type) === "text" ? (h.raw += u.raw, h.text += u.text) : n.push(u);
|
|
1307
1312
|
continue;
|
|
1308
1313
|
}
|
|
1309
|
-
if (
|
|
1310
|
-
e = e.substring(
|
|
1314
|
+
if (u = this.tokenizer.emStrong(e, r, s)) {
|
|
1315
|
+
e = e.substring(u.raw.length), n.push(u);
|
|
1311
1316
|
continue;
|
|
1312
1317
|
}
|
|
1313
|
-
if (
|
|
1314
|
-
e = e.substring(
|
|
1318
|
+
if (u = this.tokenizer.codespan(e)) {
|
|
1319
|
+
e = e.substring(u.raw.length), n.push(u);
|
|
1315
1320
|
continue;
|
|
1316
1321
|
}
|
|
1317
|
-
if (
|
|
1318
|
-
e = e.substring(
|
|
1322
|
+
if (u = this.tokenizer.br(e)) {
|
|
1323
|
+
e = e.substring(u.raw.length), n.push(u);
|
|
1319
1324
|
continue;
|
|
1320
1325
|
}
|
|
1321
|
-
if (
|
|
1322
|
-
e = e.substring(
|
|
1326
|
+
if (u = this.tokenizer.del(e)) {
|
|
1327
|
+
e = e.substring(u.raw.length), n.push(u);
|
|
1323
1328
|
continue;
|
|
1324
1329
|
}
|
|
1325
|
-
if (
|
|
1326
|
-
e = e.substring(
|
|
1330
|
+
if (u = this.tokenizer.autolink(e)) {
|
|
1331
|
+
e = e.substring(u.raw.length), n.push(u);
|
|
1327
1332
|
continue;
|
|
1328
1333
|
}
|
|
1329
|
-
if (!this.state.inLink && (
|
|
1330
|
-
e = e.substring(
|
|
1334
|
+
if (!this.state.inLink && (u = this.tokenizer.url(e))) {
|
|
1335
|
+
e = e.substring(u.raw.length), n.push(u);
|
|
1331
1336
|
continue;
|
|
1332
1337
|
}
|
|
1333
|
-
let
|
|
1338
|
+
let f = e;
|
|
1334
1339
|
if ((l = this.options.extensions) != null && l.startInline) {
|
|
1335
1340
|
let h = 1 / 0;
|
|
1336
|
-
const
|
|
1337
|
-
let
|
|
1338
|
-
this.options.extensions.startInline.forEach((
|
|
1339
|
-
|
|
1340
|
-
}), h < 1 / 0 && h >= 0 && (
|
|
1341
|
+
const v = e.slice(1);
|
|
1342
|
+
let g;
|
|
1343
|
+
this.options.extensions.startInline.forEach((m) => {
|
|
1344
|
+
g = m.call({ lexer: this }, v), typeof g == "number" && g >= 0 && (h = Math.min(h, g));
|
|
1345
|
+
}), h < 1 / 0 && h >= 0 && (f = e.substring(0, h + 1));
|
|
1341
1346
|
}
|
|
1342
|
-
if (
|
|
1343
|
-
e = e.substring(
|
|
1347
|
+
if (u = this.tokenizer.inlineText(f)) {
|
|
1348
|
+
e = e.substring(u.raw.length), u.raw.slice(-1) !== "_" && (s = u.raw.slice(-1)), o = !0;
|
|
1344
1349
|
const h = n.at(-1);
|
|
1345
|
-
(h == null ? void 0 : h.type) === "text" ? (h.raw +=
|
|
1350
|
+
(h == null ? void 0 : h.type) === "text" ? (h.raw += u.raw, h.text += u.text) : n.push(u);
|
|
1346
1351
|
continue;
|
|
1347
1352
|
}
|
|
1348
1353
|
if (e) {
|
|
@@ -1356,22 +1361,22 @@ ${c}` : c;
|
|
|
1356
1361
|
}
|
|
1357
1362
|
return n;
|
|
1358
1363
|
}
|
|
1359
|
-
},
|
|
1364
|
+
}, Z = class {
|
|
1360
1365
|
// set by the parser
|
|
1361
1366
|
constructor(t) {
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
this.options = t ||
|
|
1367
|
+
b(this, "options");
|
|
1368
|
+
b(this, "parser");
|
|
1369
|
+
this.options = t || B;
|
|
1365
1370
|
}
|
|
1366
1371
|
space(t) {
|
|
1367
1372
|
return "";
|
|
1368
1373
|
}
|
|
1369
1374
|
code({ text: t, lang: e, escaped: n }) {
|
|
1370
|
-
var
|
|
1371
|
-
const r = (
|
|
1375
|
+
var o;
|
|
1376
|
+
const r = (o = (e || "").match(T.notSpaceStart)) == null ? void 0 : o[0], i = t.replace(T.endingNewline, "") + `
|
|
1372
1377
|
`;
|
|
1373
|
-
return r ? '<pre><code class="language-' +
|
|
1374
|
-
` : "<pre><code>" + (n ? i :
|
|
1378
|
+
return r ? '<pre><code class="language-' + L(r) + '">' + (n ? i : L(i, !0)) + `</code></pre>
|
|
1379
|
+
` : "<pre><code>" + (n ? i : L(i, !0)) + `</code></pre>
|
|
1375
1380
|
`;
|
|
1376
1381
|
}
|
|
1377
1382
|
blockquote({ tokens: t }) {
|
|
@@ -1393,12 +1398,12 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
1393
1398
|
list(t) {
|
|
1394
1399
|
const e = t.ordered, n = t.start;
|
|
1395
1400
|
let r = "";
|
|
1396
|
-
for (let
|
|
1397
|
-
const a = t.items[
|
|
1401
|
+
for (let s = 0; s < t.items.length; s++) {
|
|
1402
|
+
const a = t.items[s];
|
|
1398
1403
|
r += this.listitem(a);
|
|
1399
1404
|
}
|
|
1400
|
-
const i = e ? "ol" : "ul",
|
|
1401
|
-
return "<" + i +
|
|
1405
|
+
const i = e ? "ol" : "ul", o = e && n !== 1 ? ' start="' + n + '"' : "";
|
|
1406
|
+
return "<" + i + o + `>
|
|
1402
1407
|
` + r + "</" + i + `>
|
|
1403
1408
|
`;
|
|
1404
1409
|
}
|
|
@@ -1407,7 +1412,7 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
1407
1412
|
let e = "";
|
|
1408
1413
|
if (t.task) {
|
|
1409
1414
|
const r = this.checkbox({ checked: !!t.checked });
|
|
1410
|
-
t.loose ? ((n = t.tokens[0]) == null ? void 0 : n.type) === "paragraph" ? (t.tokens[0].text = r + " " + t.tokens[0].text, t.tokens[0].tokens && t.tokens[0].tokens.length > 0 && t.tokens[0].tokens[0].type === "text" && (t.tokens[0].tokens[0].text = r + " " +
|
|
1415
|
+
t.loose ? ((n = t.tokens[0]) == null ? void 0 : n.type) === "paragraph" ? (t.tokens[0].text = r + " " + t.tokens[0].text, t.tokens[0].tokens && t.tokens[0].tokens.length > 0 && t.tokens[0].tokens[0].type === "text" && (t.tokens[0].tokens[0].text = r + " " + L(t.tokens[0].tokens[0].text), t.tokens[0].tokens[0].escaped = !0)) : t.tokens.unshift({
|
|
1411
1416
|
type: "text",
|
|
1412
1417
|
raw: r + " ",
|
|
1413
1418
|
text: r + " ",
|
|
@@ -1431,10 +1436,10 @@ ${this.parser.parse(t)}</blockquote>
|
|
|
1431
1436
|
e += this.tablerow({ text: n });
|
|
1432
1437
|
let r = "";
|
|
1433
1438
|
for (let i = 0; i < t.rows.length; i++) {
|
|
1434
|
-
const
|
|
1439
|
+
const o = t.rows[i];
|
|
1435
1440
|
n = "";
|
|
1436
|
-
for (let
|
|
1437
|
-
n += this.tablecell(s
|
|
1441
|
+
for (let s = 0; s < o.length; s++)
|
|
1442
|
+
n += this.tablecell(o[s]);
|
|
1438
1443
|
r += this.tablerow({ text: n });
|
|
1439
1444
|
}
|
|
1440
1445
|
return r && (r = `<tbody>${r}</tbody>`), `<table>
|
|
@@ -1463,7 +1468,7 @@ ${t}</tr>
|
|
|
1463
1468
|
return `<em>${this.parser.parseInline(t)}</em>`;
|
|
1464
1469
|
}
|
|
1465
1470
|
codespan({ text: t }) {
|
|
1466
|
-
return `<code>${
|
|
1471
|
+
return `<code>${L(t, !0)}</code>`;
|
|
1467
1472
|
}
|
|
1468
1473
|
br(t) {
|
|
1469
1474
|
return "<br>";
|
|
@@ -1472,26 +1477,26 @@ ${t}</tr>
|
|
|
1472
1477
|
return `<del>${this.parser.parseInline(t)}</del>`;
|
|
1473
1478
|
}
|
|
1474
1479
|
link({ href: t, title: e, tokens: n }) {
|
|
1475
|
-
const r = this.parser.parseInline(n), i =
|
|
1480
|
+
const r = this.parser.parseInline(n), i = Te(t);
|
|
1476
1481
|
if (i === null)
|
|
1477
1482
|
return r;
|
|
1478
1483
|
t = i;
|
|
1479
|
-
let
|
|
1480
|
-
return e && (
|
|
1484
|
+
let o = '<a href="' + t + '"';
|
|
1485
|
+
return e && (o += ' title="' + L(e) + '"'), o += ">" + r + "</a>", o;
|
|
1481
1486
|
}
|
|
1482
1487
|
image({ href: t, title: e, text: n, tokens: r }) {
|
|
1483
1488
|
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1484
|
-
const i =
|
|
1489
|
+
const i = Te(t);
|
|
1485
1490
|
if (i === null)
|
|
1486
|
-
return
|
|
1491
|
+
return L(n);
|
|
1487
1492
|
t = i;
|
|
1488
|
-
let
|
|
1489
|
-
return e && (
|
|
1493
|
+
let o = `<img src="${t}" alt="${n}"`;
|
|
1494
|
+
return e && (o += ` title="${L(e)}"`), o += ">", o;
|
|
1490
1495
|
}
|
|
1491
1496
|
text(t) {
|
|
1492
|
-
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text :
|
|
1497
|
+
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text : L(t.text);
|
|
1493
1498
|
}
|
|
1494
|
-
},
|
|
1499
|
+
}, Se = class {
|
|
1495
1500
|
// no need for block level renderers
|
|
1496
1501
|
strong({ text: t }) {
|
|
1497
1502
|
return t;
|
|
@@ -1520,93 +1525,93 @@ ${t}</tr>
|
|
|
1520
1525
|
br() {
|
|
1521
1526
|
return "";
|
|
1522
1527
|
}
|
|
1523
|
-
},
|
|
1528
|
+
}, A = class le {
|
|
1524
1529
|
constructor(e) {
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
this.options = e ||
|
|
1530
|
+
b(this, "options");
|
|
1531
|
+
b(this, "renderer");
|
|
1532
|
+
b(this, "textRenderer");
|
|
1533
|
+
this.options = e || B, this.options.renderer = this.options.renderer || new Z(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new Se();
|
|
1529
1534
|
}
|
|
1530
1535
|
/**
|
|
1531
1536
|
* Static Parse Method
|
|
1532
1537
|
*/
|
|
1533
1538
|
static parse(e, n) {
|
|
1534
|
-
return new
|
|
1539
|
+
return new le(n).parse(e);
|
|
1535
1540
|
}
|
|
1536
1541
|
/**
|
|
1537
1542
|
* Static Parse Inline Method
|
|
1538
1543
|
*/
|
|
1539
1544
|
static parseInline(e, n) {
|
|
1540
|
-
return new
|
|
1545
|
+
return new le(n).parseInline(e);
|
|
1541
1546
|
}
|
|
1542
1547
|
/**
|
|
1543
1548
|
* Parse Loop
|
|
1544
1549
|
*/
|
|
1545
1550
|
parse(e, n = !0) {
|
|
1546
|
-
var i,
|
|
1551
|
+
var i, o;
|
|
1547
1552
|
let r = "";
|
|
1548
|
-
for (let
|
|
1549
|
-
const a = e[
|
|
1550
|
-
if ((
|
|
1551
|
-
const l = a,
|
|
1552
|
-
if (
|
|
1553
|
-
r +=
|
|
1553
|
+
for (let s = 0; s < e.length; s++) {
|
|
1554
|
+
const a = e[s];
|
|
1555
|
+
if ((o = (i = this.options.extensions) == null ? void 0 : i.renderers) != null && o[a.type]) {
|
|
1556
|
+
const l = a, u = this.options.extensions.renderers[l.type].call({ parser: this }, l);
|
|
1557
|
+
if (u !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(l.type)) {
|
|
1558
|
+
r += u || "";
|
|
1554
1559
|
continue;
|
|
1555
1560
|
}
|
|
1556
1561
|
}
|
|
1557
|
-
const
|
|
1558
|
-
switch (
|
|
1562
|
+
const c = a;
|
|
1563
|
+
switch (c.type) {
|
|
1559
1564
|
case "space": {
|
|
1560
|
-
r += this.renderer.space(
|
|
1565
|
+
r += this.renderer.space(c);
|
|
1561
1566
|
continue;
|
|
1562
1567
|
}
|
|
1563
1568
|
case "hr": {
|
|
1564
|
-
r += this.renderer.hr(
|
|
1569
|
+
r += this.renderer.hr(c);
|
|
1565
1570
|
continue;
|
|
1566
1571
|
}
|
|
1567
1572
|
case "heading": {
|
|
1568
|
-
r += this.renderer.heading(
|
|
1573
|
+
r += this.renderer.heading(c);
|
|
1569
1574
|
continue;
|
|
1570
1575
|
}
|
|
1571
1576
|
case "code": {
|
|
1572
|
-
r += this.renderer.code(
|
|
1577
|
+
r += this.renderer.code(c);
|
|
1573
1578
|
continue;
|
|
1574
1579
|
}
|
|
1575
1580
|
case "table": {
|
|
1576
|
-
r += this.renderer.table(
|
|
1581
|
+
r += this.renderer.table(c);
|
|
1577
1582
|
continue;
|
|
1578
1583
|
}
|
|
1579
1584
|
case "blockquote": {
|
|
1580
|
-
r += this.renderer.blockquote(
|
|
1585
|
+
r += this.renderer.blockquote(c);
|
|
1581
1586
|
continue;
|
|
1582
1587
|
}
|
|
1583
1588
|
case "list": {
|
|
1584
|
-
r += this.renderer.list(
|
|
1589
|
+
r += this.renderer.list(c);
|
|
1585
1590
|
continue;
|
|
1586
1591
|
}
|
|
1587
1592
|
case "html": {
|
|
1588
|
-
r += this.renderer.html(
|
|
1593
|
+
r += this.renderer.html(c);
|
|
1589
1594
|
continue;
|
|
1590
1595
|
}
|
|
1591
1596
|
case "paragraph": {
|
|
1592
|
-
r += this.renderer.paragraph(
|
|
1597
|
+
r += this.renderer.paragraph(c);
|
|
1593
1598
|
continue;
|
|
1594
1599
|
}
|
|
1595
1600
|
case "text": {
|
|
1596
|
-
let l =
|
|
1597
|
-
for (;
|
|
1598
|
-
l = e[++
|
|
1601
|
+
let l = c, u = this.renderer.text(l);
|
|
1602
|
+
for (; s + 1 < e.length && e[s + 1].type === "text"; )
|
|
1603
|
+
l = e[++s], u += `
|
|
1599
1604
|
` + this.renderer.text(l);
|
|
1600
1605
|
n ? r += this.renderer.paragraph({
|
|
1601
1606
|
type: "paragraph",
|
|
1602
|
-
raw:
|
|
1603
|
-
text:
|
|
1604
|
-
tokens: [{ type: "text", raw:
|
|
1605
|
-
}) : r +=
|
|
1607
|
+
raw: u,
|
|
1608
|
+
text: u,
|
|
1609
|
+
tokens: [{ type: "text", raw: u, text: u, escaped: !0 }]
|
|
1610
|
+
}) : r += u;
|
|
1606
1611
|
continue;
|
|
1607
1612
|
}
|
|
1608
1613
|
default: {
|
|
1609
|
-
const l = 'Token with "' +
|
|
1614
|
+
const l = 'Token with "' + c.type + '" type was not found.';
|
|
1610
1615
|
if (this.options.silent)
|
|
1611
1616
|
return console.error(l), "";
|
|
1612
1617
|
throw new Error(l);
|
|
@@ -1619,61 +1624,61 @@ ${t}</tr>
|
|
|
1619
1624
|
* Parse Inline Tokens
|
|
1620
1625
|
*/
|
|
1621
1626
|
parseInline(e, n = this.renderer) {
|
|
1622
|
-
var i,
|
|
1627
|
+
var i, o;
|
|
1623
1628
|
let r = "";
|
|
1624
|
-
for (let
|
|
1625
|
-
const a = e[
|
|
1626
|
-
if ((
|
|
1629
|
+
for (let s = 0; s < e.length; s++) {
|
|
1630
|
+
const a = e[s];
|
|
1631
|
+
if ((o = (i = this.options.extensions) == null ? void 0 : i.renderers) != null && o[a.type]) {
|
|
1627
1632
|
const l = this.options.extensions.renderers[a.type].call({ parser: this }, a);
|
|
1628
1633
|
if (l !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(a.type)) {
|
|
1629
1634
|
r += l || "";
|
|
1630
1635
|
continue;
|
|
1631
1636
|
}
|
|
1632
1637
|
}
|
|
1633
|
-
const
|
|
1634
|
-
switch (
|
|
1638
|
+
const c = a;
|
|
1639
|
+
switch (c.type) {
|
|
1635
1640
|
case "escape": {
|
|
1636
|
-
r += n.text(
|
|
1641
|
+
r += n.text(c);
|
|
1637
1642
|
break;
|
|
1638
1643
|
}
|
|
1639
1644
|
case "html": {
|
|
1640
|
-
r += n.html(
|
|
1645
|
+
r += n.html(c);
|
|
1641
1646
|
break;
|
|
1642
1647
|
}
|
|
1643
1648
|
case "link": {
|
|
1644
|
-
r += n.link(
|
|
1649
|
+
r += n.link(c);
|
|
1645
1650
|
break;
|
|
1646
1651
|
}
|
|
1647
1652
|
case "image": {
|
|
1648
|
-
r += n.image(
|
|
1653
|
+
r += n.image(c);
|
|
1649
1654
|
break;
|
|
1650
1655
|
}
|
|
1651
1656
|
case "strong": {
|
|
1652
|
-
r += n.strong(
|
|
1657
|
+
r += n.strong(c);
|
|
1653
1658
|
break;
|
|
1654
1659
|
}
|
|
1655
1660
|
case "em": {
|
|
1656
|
-
r += n.em(
|
|
1661
|
+
r += n.em(c);
|
|
1657
1662
|
break;
|
|
1658
1663
|
}
|
|
1659
1664
|
case "codespan": {
|
|
1660
|
-
r += n.codespan(
|
|
1665
|
+
r += n.codespan(c);
|
|
1661
1666
|
break;
|
|
1662
1667
|
}
|
|
1663
1668
|
case "br": {
|
|
1664
|
-
r += n.br(
|
|
1669
|
+
r += n.br(c);
|
|
1665
1670
|
break;
|
|
1666
1671
|
}
|
|
1667
1672
|
case "del": {
|
|
1668
|
-
r += n.del(
|
|
1673
|
+
r += n.del(c);
|
|
1669
1674
|
break;
|
|
1670
1675
|
}
|
|
1671
1676
|
case "text": {
|
|
1672
|
-
r += n.text(
|
|
1677
|
+
r += n.text(c);
|
|
1673
1678
|
break;
|
|
1674
1679
|
}
|
|
1675
1680
|
default: {
|
|
1676
|
-
const l = 'Token with "' +
|
|
1681
|
+
const l = 'Token with "' + c.type + '" type was not found.';
|
|
1677
1682
|
if (this.options.silent)
|
|
1678
1683
|
return console.error(l), "";
|
|
1679
1684
|
throw new Error(l);
|
|
@@ -1682,11 +1687,11 @@ ${t}</tr>
|
|
|
1682
1687
|
}
|
|
1683
1688
|
return r;
|
|
1684
1689
|
}
|
|
1685
|
-
},
|
|
1690
|
+
}, te, W = (te = class {
|
|
1686
1691
|
constructor(t) {
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
this.options = t ||
|
|
1692
|
+
b(this, "options");
|
|
1693
|
+
b(this, "block");
|
|
1694
|
+
this.options = t || B;
|
|
1690
1695
|
}
|
|
1691
1696
|
/**
|
|
1692
1697
|
* Process markdown before marked
|
|
@@ -1710,30 +1715,30 @@ ${t}</tr>
|
|
|
1710
1715
|
* Provide function to tokenize markdown
|
|
1711
1716
|
*/
|
|
1712
1717
|
provideLexer() {
|
|
1713
|
-
return this.block ?
|
|
1718
|
+
return this.block ? O.lex : O.lexInline;
|
|
1714
1719
|
}
|
|
1715
1720
|
/**
|
|
1716
1721
|
* Provide function to parse tokens
|
|
1717
1722
|
*/
|
|
1718
1723
|
provideParser() {
|
|
1719
|
-
return this.block ?
|
|
1724
|
+
return this.block ? A.parse : A.parseInline;
|
|
1720
1725
|
}
|
|
1721
|
-
},
|
|
1726
|
+
}, b(te, "passThroughHooks", /* @__PURE__ */ new Set([
|
|
1722
1727
|
"preprocess",
|
|
1723
1728
|
"postprocess",
|
|
1724
1729
|
"processAllTokens"
|
|
1725
|
-
])),
|
|
1730
|
+
])), te), sn = class {
|
|
1726
1731
|
constructor(...t) {
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1732
|
+
b(this, "defaults", ge());
|
|
1733
|
+
b(this, "options", this.setOptions);
|
|
1734
|
+
b(this, "parse", this.parseMarkdown(!0));
|
|
1735
|
+
b(this, "parseInline", this.parseMarkdown(!1));
|
|
1736
|
+
b(this, "Parser", A);
|
|
1737
|
+
b(this, "Renderer", Z);
|
|
1738
|
+
b(this, "TextRenderer", Se);
|
|
1739
|
+
b(this, "Lexer", O);
|
|
1740
|
+
b(this, "Tokenizer", V);
|
|
1741
|
+
b(this, "Hooks", W);
|
|
1737
1742
|
this.use(...t);
|
|
1738
1743
|
}
|
|
1739
1744
|
/**
|
|
@@ -1742,28 +1747,28 @@ ${t}</tr>
|
|
|
1742
1747
|
walkTokens(t, e) {
|
|
1743
1748
|
var r, i;
|
|
1744
1749
|
let n = [];
|
|
1745
|
-
for (const
|
|
1746
|
-
switch (n = n.concat(e.call(this,
|
|
1750
|
+
for (const o of t)
|
|
1751
|
+
switch (n = n.concat(e.call(this, o)), o.type) {
|
|
1747
1752
|
case "table": {
|
|
1748
|
-
const
|
|
1749
|
-
for (const a of
|
|
1753
|
+
const s = o;
|
|
1754
|
+
for (const a of s.header)
|
|
1750
1755
|
n = n.concat(this.walkTokens(a.tokens, e));
|
|
1751
|
-
for (const a of
|
|
1752
|
-
for (const
|
|
1753
|
-
n = n.concat(this.walkTokens(
|
|
1756
|
+
for (const a of s.rows)
|
|
1757
|
+
for (const c of a)
|
|
1758
|
+
n = n.concat(this.walkTokens(c.tokens, e));
|
|
1754
1759
|
break;
|
|
1755
1760
|
}
|
|
1756
1761
|
case "list": {
|
|
1757
|
-
const
|
|
1758
|
-
n = n.concat(this.walkTokens(
|
|
1762
|
+
const s = o;
|
|
1763
|
+
n = n.concat(this.walkTokens(s.items, e));
|
|
1759
1764
|
break;
|
|
1760
1765
|
}
|
|
1761
1766
|
default: {
|
|
1762
|
-
const
|
|
1763
|
-
(i = (r = this.defaults.extensions) == null ? void 0 : r.childTokens) != null && i[
|
|
1764
|
-
const
|
|
1765
|
-
n = n.concat(this.walkTokens(
|
|
1766
|
-
}) :
|
|
1767
|
+
const s = o;
|
|
1768
|
+
(i = (r = this.defaults.extensions) == null ? void 0 : r.childTokens) != null && i[s.type] ? this.defaults.extensions.childTokens[s.type].forEach((a) => {
|
|
1769
|
+
const c = s[a].flat(1 / 0);
|
|
1770
|
+
n = n.concat(this.walkTokens(c, e));
|
|
1771
|
+
}) : s.tokens && (n = n.concat(this.walkTokens(s.tokens, e)));
|
|
1767
1772
|
}
|
|
1768
1773
|
}
|
|
1769
1774
|
return n;
|
|
@@ -1776,74 +1781,74 @@ ${t}</tr>
|
|
|
1776
1781
|
if (!i.name)
|
|
1777
1782
|
throw new Error("extension name required");
|
|
1778
1783
|
if ("renderer" in i) {
|
|
1779
|
-
const
|
|
1780
|
-
|
|
1781
|
-
let a = i.renderer.apply(this,
|
|
1782
|
-
return a === !1 && (a =
|
|
1784
|
+
const o = e.renderers[i.name];
|
|
1785
|
+
o ? e.renderers[i.name] = function(...s) {
|
|
1786
|
+
let a = i.renderer.apply(this, s);
|
|
1787
|
+
return a === !1 && (a = o.apply(this, s)), a;
|
|
1783
1788
|
} : e.renderers[i.name] = i.renderer;
|
|
1784
1789
|
}
|
|
1785
1790
|
if ("tokenizer" in i) {
|
|
1786
1791
|
if (!i.level || i.level !== "block" && i.level !== "inline")
|
|
1787
1792
|
throw new Error("extension level must be 'block' or 'inline'");
|
|
1788
|
-
const
|
|
1789
|
-
|
|
1793
|
+
const o = e[i.level];
|
|
1794
|
+
o ? o.unshift(i.tokenizer) : e[i.level] = [i.tokenizer], i.start && (i.level === "block" ? e.startBlock ? e.startBlock.push(i.start) : e.startBlock = [i.start] : i.level === "inline" && (e.startInline ? e.startInline.push(i.start) : e.startInline = [i.start]));
|
|
1790
1795
|
}
|
|
1791
1796
|
"childTokens" in i && i.childTokens && (e.childTokens[i.name] = i.childTokens);
|
|
1792
1797
|
}), r.extensions = e), n.renderer) {
|
|
1793
|
-
const i = this.defaults.renderer || new
|
|
1794
|
-
for (const
|
|
1795
|
-
if (!(
|
|
1796
|
-
throw new Error(`renderer '${
|
|
1797
|
-
if (["options", "parser"].includes(
|
|
1798
|
+
const i = this.defaults.renderer || new Z(this.defaults);
|
|
1799
|
+
for (const o in n.renderer) {
|
|
1800
|
+
if (!(o in i))
|
|
1801
|
+
throw new Error(`renderer '${o}' does not exist`);
|
|
1802
|
+
if (["options", "parser"].includes(o))
|
|
1798
1803
|
continue;
|
|
1799
|
-
const
|
|
1800
|
-
i[
|
|
1801
|
-
let
|
|
1802
|
-
return
|
|
1804
|
+
const s = o, a = n.renderer[s], c = i[s];
|
|
1805
|
+
i[s] = (...l) => {
|
|
1806
|
+
let u = a.apply(i, l);
|
|
1807
|
+
return u === !1 && (u = c.apply(i, l)), u || "";
|
|
1803
1808
|
};
|
|
1804
1809
|
}
|
|
1805
1810
|
r.renderer = i;
|
|
1806
1811
|
}
|
|
1807
1812
|
if (n.tokenizer) {
|
|
1808
|
-
const i = this.defaults.tokenizer || new
|
|
1809
|
-
for (const
|
|
1810
|
-
if (!(
|
|
1811
|
-
throw new Error(`tokenizer '${
|
|
1812
|
-
if (["options", "rules", "lexer"].includes(
|
|
1813
|
+
const i = this.defaults.tokenizer || new V(this.defaults);
|
|
1814
|
+
for (const o in n.tokenizer) {
|
|
1815
|
+
if (!(o in i))
|
|
1816
|
+
throw new Error(`tokenizer '${o}' does not exist`);
|
|
1817
|
+
if (["options", "rules", "lexer"].includes(o))
|
|
1813
1818
|
continue;
|
|
1814
|
-
const
|
|
1815
|
-
i[
|
|
1816
|
-
let
|
|
1817
|
-
return
|
|
1819
|
+
const s = o, a = n.tokenizer[s], c = i[s];
|
|
1820
|
+
i[s] = (...l) => {
|
|
1821
|
+
let u = a.apply(i, l);
|
|
1822
|
+
return u === !1 && (u = c.apply(i, l)), u;
|
|
1818
1823
|
};
|
|
1819
1824
|
}
|
|
1820
1825
|
r.tokenizer = i;
|
|
1821
1826
|
}
|
|
1822
1827
|
if (n.hooks) {
|
|
1823
1828
|
const i = this.defaults.hooks || new W();
|
|
1824
|
-
for (const
|
|
1825
|
-
if (!(
|
|
1826
|
-
throw new Error(`hook '${
|
|
1827
|
-
if (["options", "block"].includes(
|
|
1829
|
+
for (const o in n.hooks) {
|
|
1830
|
+
if (!(o in i))
|
|
1831
|
+
throw new Error(`hook '${o}' does not exist`);
|
|
1832
|
+
if (["options", "block"].includes(o))
|
|
1828
1833
|
continue;
|
|
1829
|
-
const
|
|
1830
|
-
W.passThroughHooks.has(
|
|
1834
|
+
const s = o, a = n.hooks[s], c = i[s];
|
|
1835
|
+
W.passThroughHooks.has(o) ? i[s] = (l) => {
|
|
1831
1836
|
if (this.defaults.async)
|
|
1832
|
-
return Promise.resolve(a.call(i, l)).then((
|
|
1833
|
-
const
|
|
1834
|
-
return
|
|
1835
|
-
} : i[
|
|
1836
|
-
let
|
|
1837
|
-
return
|
|
1837
|
+
return Promise.resolve(a.call(i, l)).then((f) => c.call(i, f));
|
|
1838
|
+
const u = a.call(i, l);
|
|
1839
|
+
return c.call(i, u);
|
|
1840
|
+
} : i[s] = (...l) => {
|
|
1841
|
+
let u = a.apply(i, l);
|
|
1842
|
+
return u === !1 && (u = c.apply(i, l)), u;
|
|
1838
1843
|
};
|
|
1839
1844
|
}
|
|
1840
1845
|
r.hooks = i;
|
|
1841
1846
|
}
|
|
1842
1847
|
if (n.walkTokens) {
|
|
1843
|
-
const i = this.defaults.walkTokens,
|
|
1844
|
-
r.walkTokens = function(
|
|
1848
|
+
const i = this.defaults.walkTokens, o = n.walkTokens;
|
|
1849
|
+
r.walkTokens = function(s) {
|
|
1845
1850
|
let a = [];
|
|
1846
|
-
return a.push(
|
|
1851
|
+
return a.push(o.call(this, s)), i && (a = a.concat(i.call(this, s))), a;
|
|
1847
1852
|
};
|
|
1848
1853
|
}
|
|
1849
1854
|
this.defaults = { ...this.defaults, ...r };
|
|
@@ -1853,32 +1858,32 @@ ${t}</tr>
|
|
|
1853
1858
|
return this.defaults = { ...this.defaults, ...t }, this;
|
|
1854
1859
|
}
|
|
1855
1860
|
lexer(t, e) {
|
|
1856
|
-
return
|
|
1861
|
+
return O.lex(t, e ?? this.defaults);
|
|
1857
1862
|
}
|
|
1858
1863
|
parser(t, e) {
|
|
1859
|
-
return
|
|
1864
|
+
return A.parse(t, e ?? this.defaults);
|
|
1860
1865
|
}
|
|
1861
1866
|
parseMarkdown(t) {
|
|
1862
1867
|
return (n, r) => {
|
|
1863
|
-
const i = { ...r },
|
|
1868
|
+
const i = { ...r }, o = { ...this.defaults, ...i }, s = this.onError(!!o.silent, !!o.async);
|
|
1864
1869
|
if (this.defaults.async === !0 && i.async === !1)
|
|
1865
|
-
return
|
|
1870
|
+
return s(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."));
|
|
1866
1871
|
if (typeof n > "u" || n === null)
|
|
1867
|
-
return
|
|
1872
|
+
return s(new Error("marked(): input parameter is undefined or null"));
|
|
1868
1873
|
if (typeof n != "string")
|
|
1869
|
-
return
|
|
1870
|
-
|
|
1871
|
-
const a =
|
|
1872
|
-
if (
|
|
1873
|
-
return Promise.resolve(
|
|
1874
|
+
return s(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
1875
|
+
o.hooks && (o.hooks.options = o, o.hooks.block = t);
|
|
1876
|
+
const a = o.hooks ? o.hooks.provideLexer() : t ? O.lex : O.lexInline, c = o.hooks ? o.hooks.provideParser() : t ? A.parse : A.parseInline;
|
|
1877
|
+
if (o.async)
|
|
1878
|
+
return Promise.resolve(o.hooks ? o.hooks.preprocess(n) : n).then((l) => a(l, o)).then((l) => o.hooks ? o.hooks.processAllTokens(l) : l).then((l) => o.walkTokens ? Promise.all(this.walkTokens(l, o.walkTokens)).then(() => l) : l).then((l) => c(l, o)).then((l) => o.hooks ? o.hooks.postprocess(l) : l).catch(s);
|
|
1874
1879
|
try {
|
|
1875
|
-
|
|
1876
|
-
let l = a(n,
|
|
1877
|
-
|
|
1878
|
-
let
|
|
1879
|
-
return
|
|
1880
|
+
o.hooks && (n = o.hooks.preprocess(n));
|
|
1881
|
+
let l = a(n, o);
|
|
1882
|
+
o.hooks && (l = o.hooks.processAllTokens(l)), o.walkTokens && this.walkTokens(l, o.walkTokens);
|
|
1883
|
+
let u = c(l, o);
|
|
1884
|
+
return o.hooks && (u = o.hooks.postprocess(u)), u;
|
|
1880
1885
|
} catch (l) {
|
|
1881
|
-
return
|
|
1886
|
+
return s(l);
|
|
1882
1887
|
}
|
|
1883
1888
|
};
|
|
1884
1889
|
}
|
|
@@ -1886,7 +1891,7 @@ ${t}</tr>
|
|
|
1886
1891
|
return (n) => {
|
|
1887
1892
|
if (n.message += `
|
|
1888
1893
|
Please report this to https://github.com/markedjs/marked.`, t) {
|
|
1889
|
-
const r = "<p>An error occurred:</p><pre>" +
|
|
1894
|
+
const r = "<p>An error occurred:</p><pre>" + L(n.message + "", !0) + "</pre>";
|
|
1890
1895
|
return e ? Promise.resolve(r) : r;
|
|
1891
1896
|
}
|
|
1892
1897
|
if (e)
|
|
@@ -1894,39 +1899,39 @@ Please report this to https://github.com/markedjs/marked.`, t) {
|
|
|
1894
1899
|
throw n;
|
|
1895
1900
|
};
|
|
1896
1901
|
}
|
|
1897
|
-
},
|
|
1898
|
-
function
|
|
1899
|
-
return
|
|
1902
|
+
}, D = new sn();
|
|
1903
|
+
function y(t, e) {
|
|
1904
|
+
return D.parse(t, e);
|
|
1900
1905
|
}
|
|
1901
|
-
|
|
1902
|
-
return
|
|
1906
|
+
y.options = y.setOptions = function(t) {
|
|
1907
|
+
return D.setOptions(t), y.defaults = D.defaults, He(y.defaults), y;
|
|
1903
1908
|
};
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
return
|
|
1909
|
+
y.getDefaults = ge;
|
|
1910
|
+
y.defaults = B;
|
|
1911
|
+
y.use = function(...t) {
|
|
1912
|
+
return D.use(...t), y.defaults = D.defaults, He(y.defaults), y;
|
|
1908
1913
|
};
|
|
1909
|
-
|
|
1910
|
-
return
|
|
1914
|
+
y.walkTokens = function(t, e) {
|
|
1915
|
+
return D.walkTokens(t, e);
|
|
1911
1916
|
};
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
const
|
|
1917
|
+
y.parseInline = D.parseInline;
|
|
1918
|
+
y.Parser = A;
|
|
1919
|
+
y.parser = A.parse;
|
|
1920
|
+
y.Renderer = Z;
|
|
1921
|
+
y.TextRenderer = Se;
|
|
1922
|
+
y.Lexer = O;
|
|
1923
|
+
y.lexer = O.lex;
|
|
1924
|
+
y.Tokenizer = V;
|
|
1925
|
+
y.Hooks = W;
|
|
1926
|
+
y.parse = y;
|
|
1927
|
+
y.options;
|
|
1928
|
+
y.setOptions;
|
|
1929
|
+
y.use;
|
|
1930
|
+
y.walkTokens;
|
|
1931
|
+
y.parseInline;
|
|
1932
|
+
A.parse;
|
|
1933
|
+
O.lex;
|
|
1934
|
+
const ze = ({ data: t, style: e }) => /* @__PURE__ */ d.createElement(
|
|
1930
1935
|
"div",
|
|
1931
1936
|
{
|
|
1932
1937
|
style: {
|
|
@@ -1934,29 +1939,60 @@ const Se = ({ data: t, style: e }) => /* @__PURE__ */ u.createElement(
|
|
|
1934
1939
|
...e
|
|
1935
1940
|
}
|
|
1936
1941
|
},
|
|
1937
|
-
t && t.subject ? /* @__PURE__ */
|
|
1942
|
+
t && t.subject ? /* @__PURE__ */ d.createElement(
|
|
1938
1943
|
"div",
|
|
1939
1944
|
{
|
|
1940
1945
|
dangerouslySetInnerHTML: {
|
|
1941
|
-
__html:
|
|
1946
|
+
__html: y.parse(t.body, { async: !1 })
|
|
1942
1947
|
}
|
|
1943
1948
|
}
|
|
1944
|
-
) : /* @__PURE__ */
|
|
1945
|
-
),
|
|
1949
|
+
) : /* @__PURE__ */ d.createElement("p", { style: { margin: 0, whiteSpace: "pre-wrap" } }, t ? t.question : "")
|
|
1950
|
+
), Ye = ({
|
|
1951
|
+
size: t = 40,
|
|
1952
|
+
color: e = "var(--primary-main)",
|
|
1953
|
+
thickness: n = 3.6
|
|
1954
|
+
}) => {
|
|
1955
|
+
const i = 2 * Math.PI * 20;
|
|
1956
|
+
return /* @__PURE__ */ E.createElement(
|
|
1957
|
+
"div",
|
|
1958
|
+
{
|
|
1959
|
+
className: "circular-container",
|
|
1960
|
+
style: { width: t, height: t },
|
|
1961
|
+
role: "progressbar"
|
|
1962
|
+
},
|
|
1963
|
+
/* @__PURE__ */ E.createElement("svg", { className: "circular-svg", viewBox: "22 22 44 44" }, /* @__PURE__ */ E.createElement(
|
|
1964
|
+
"circle",
|
|
1965
|
+
{
|
|
1966
|
+
className: "circular-circle",
|
|
1967
|
+
cx: "44",
|
|
1968
|
+
cy: "44",
|
|
1969
|
+
r: 20,
|
|
1970
|
+
fill: "none",
|
|
1971
|
+
stroke: e,
|
|
1972
|
+
strokeWidth: n,
|
|
1973
|
+
strokeDasharray: i,
|
|
1974
|
+
style: {
|
|
1975
|
+
strokeDashoffset: i * 0.7
|
|
1976
|
+
// Độ dài của thanh loading
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
))
|
|
1980
|
+
);
|
|
1981
|
+
}, an = ({
|
|
1946
1982
|
items: t,
|
|
1947
1983
|
onApply: e,
|
|
1948
1984
|
getEditorContent: n
|
|
1949
1985
|
}) => {
|
|
1950
1986
|
const r = async (i) => {
|
|
1951
|
-
const
|
|
1952
|
-
((
|
|
1987
|
+
const o = /제목:[^\n]*/g;
|
|
1988
|
+
((o.exec(i) || [])[0] || "").replace("제목: ", "").replace(`
|
|
1953
1989
|
`, "");
|
|
1954
|
-
const a = i.replace(
|
|
1955
|
-
let
|
|
1956
|
-
const l = /<!--HanbiroSignatureStart-->([\s\S]*?)<!--HanbiroSignatureEnd-->/g,
|
|
1957
|
-
|
|
1990
|
+
const a = i.replace(o, "").replace("본문: ", "");
|
|
1991
|
+
let c = await y.parse(a);
|
|
1992
|
+
const l = /<!--HanbiroSignatureStart-->([\s\S]*?)<!--HanbiroSignatureEnd-->/g, u = n ? n() : "", f = l.exec(u) || [];
|
|
1993
|
+
f[0] && (c = c + "<br>" + f[0]), e({ html: c });
|
|
1958
1994
|
};
|
|
1959
|
-
return /* @__PURE__ */
|
|
1995
|
+
return /* @__PURE__ */ d.createElement(
|
|
1960
1996
|
"div",
|
|
1961
1997
|
{
|
|
1962
1998
|
style: {
|
|
@@ -1971,7 +2007,7 @@ const Se = ({ data: t, style: e }) => /* @__PURE__ */ u.createElement(
|
|
|
1971
2007
|
flexDirection: "column"
|
|
1972
2008
|
}
|
|
1973
2009
|
},
|
|
1974
|
-
t && t.map((i) => /* @__PURE__ */
|
|
2010
|
+
t && t.map((i) => /* @__PURE__ */ d.createElement(
|
|
1975
2011
|
"div",
|
|
1976
2012
|
{
|
|
1977
2013
|
key: i.id,
|
|
@@ -1981,7 +2017,7 @@ const Se = ({ data: t, style: e }) => /* @__PURE__ */ u.createElement(
|
|
|
1981
2017
|
marginBottom: 16
|
|
1982
2018
|
}
|
|
1983
2019
|
},
|
|
1984
|
-
/* @__PURE__ */
|
|
2020
|
+
/* @__PURE__ */ d.createElement(
|
|
1985
2021
|
"div",
|
|
1986
2022
|
{
|
|
1987
2023
|
style: {
|
|
@@ -1993,8 +2029,8 @@ const Se = ({ data: t, style: e }) => /* @__PURE__ */ u.createElement(
|
|
|
1993
2029
|
marginTop: 8
|
|
1994
2030
|
}
|
|
1995
2031
|
},
|
|
1996
|
-
/* @__PURE__ */
|
|
1997
|
-
|
|
2032
|
+
/* @__PURE__ */ d.createElement(
|
|
2033
|
+
ze,
|
|
1998
2034
|
{
|
|
1999
2035
|
data: { question: i.question },
|
|
2000
2036
|
style: {
|
|
@@ -2006,7 +2042,7 @@ const Se = ({ data: t, style: e }) => /* @__PURE__ */ u.createElement(
|
|
|
2006
2042
|
}
|
|
2007
2043
|
)
|
|
2008
2044
|
),
|
|
2009
|
-
/* @__PURE__ */
|
|
2045
|
+
/* @__PURE__ */ d.createElement(
|
|
2010
2046
|
"div",
|
|
2011
2047
|
{
|
|
2012
2048
|
style: {
|
|
@@ -2018,17 +2054,7 @@ const Se = ({ data: t, style: e }) => /* @__PURE__ */ u.createElement(
|
|
|
2018
2054
|
marginTop: 8
|
|
2019
2055
|
}
|
|
2020
2056
|
},
|
|
2021
|
-
i.isLoading ? /* @__PURE__ */
|
|
2022
|
-
"div",
|
|
2023
|
-
{
|
|
2024
|
-
style: {
|
|
2025
|
-
marginTop: 8,
|
|
2026
|
-
fontStyle: "italic",
|
|
2027
|
-
color: "var(--text-secondary)"
|
|
2028
|
-
}
|
|
2029
|
-
},
|
|
2030
|
-
"Loading..."
|
|
2031
|
-
) : /* @__PURE__ */ u.createElement(
|
|
2057
|
+
i != null && i.isLoading ? /* @__PURE__ */ d.createElement(Ye, { size: 32 }) : /* @__PURE__ */ d.createElement(
|
|
2032
2058
|
"div",
|
|
2033
2059
|
{
|
|
2034
2060
|
style: {
|
|
@@ -2038,8 +2064,8 @@ const Se = ({ data: t, style: e }) => /* @__PURE__ */ u.createElement(
|
|
|
2038
2064
|
width: "100%"
|
|
2039
2065
|
}
|
|
2040
2066
|
},
|
|
2041
|
-
/* @__PURE__ */
|
|
2042
|
-
|
|
2067
|
+
/* @__PURE__ */ d.createElement(
|
|
2068
|
+
ze,
|
|
2043
2069
|
{
|
|
2044
2070
|
data: { subject: i.subject, body: i.body },
|
|
2045
2071
|
style: {
|
|
@@ -2051,46 +2077,775 @@ const Se = ({ data: t, style: e }) => /* @__PURE__ */ u.createElement(
|
|
|
2051
2077
|
}
|
|
2052
2078
|
}
|
|
2053
2079
|
),
|
|
2054
|
-
/* @__PURE__ */
|
|
2080
|
+
/* @__PURE__ */ d.createElement(
|
|
2055
2081
|
"button",
|
|
2056
2082
|
{
|
|
2057
2083
|
type: "button",
|
|
2058
2084
|
title: "Apply content",
|
|
2059
2085
|
onClick: () => r(i.body),
|
|
2086
|
+
className: "icon-button small",
|
|
2060
2087
|
style: {
|
|
2061
|
-
marginLeft: 4
|
|
2062
|
-
background: "none",
|
|
2063
|
-
border: "none",
|
|
2064
|
-
cursor: "pointer",
|
|
2065
|
-
display: "flex",
|
|
2066
|
-
alignItems: "center",
|
|
2067
|
-
justifyContent: "center",
|
|
2068
|
-
padding: 8,
|
|
2069
|
-
borderRadius: 4
|
|
2088
|
+
marginLeft: 4
|
|
2070
2089
|
}
|
|
2071
2090
|
},
|
|
2072
|
-
/* @__PURE__ */
|
|
2091
|
+
/* @__PURE__ */ d.createElement(Q, { size: 16, color: "#666" })
|
|
2073
2092
|
)
|
|
2074
2093
|
)
|
|
2075
2094
|
)
|
|
2076
2095
|
))
|
|
2077
2096
|
);
|
|
2097
|
+
}, ln = {
|
|
2098
|
+
small: 28,
|
|
2099
|
+
medium: 40
|
|
2100
|
+
}, cn = ({
|
|
2101
|
+
style: t,
|
|
2102
|
+
fullHeight: e = !1,
|
|
2103
|
+
size: n = "medium",
|
|
2104
|
+
label: r
|
|
2105
|
+
}) => /* @__PURE__ */ E.createElement(
|
|
2106
|
+
"div",
|
|
2107
|
+
{
|
|
2108
|
+
style: {
|
|
2109
|
+
display: "flex",
|
|
2110
|
+
alignItems: "center",
|
|
2111
|
+
justifyContent: "center",
|
|
2112
|
+
width: "100%",
|
|
2113
|
+
height: e ? "100%" : 350,
|
|
2114
|
+
...t
|
|
2115
|
+
}
|
|
2116
|
+
},
|
|
2117
|
+
/* @__PURE__ */ E.createElement(Ye, { size: ln[n] }),
|
|
2118
|
+
r && /* @__PURE__ */ E.createElement(
|
|
2119
|
+
"p",
|
|
2120
|
+
{
|
|
2121
|
+
color: "text.secondary",
|
|
2122
|
+
style: { marginTop: 16, fontSize: n === "small" ? 12 : 13 }
|
|
2123
|
+
},
|
|
2124
|
+
r
|
|
2125
|
+
)
|
|
2126
|
+
), un = `
|
|
2127
|
+
::-webkit-scrollbar,
|
|
2128
|
+
*::-webkit-scrollbar {
|
|
2129
|
+
width: 8px;
|
|
2130
|
+
height: 8px;
|
|
2131
|
+
}
|
|
2132
|
+
|
|
2133
|
+
*::-webkit-scrollbar-track {
|
|
2134
|
+
background: transparent;
|
|
2135
|
+
backdrop-filter: blur(6px);
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
::-webkit-scrollbar-thumb,
|
|
2139
|
+
*::-webkit-scrollbar-thumb {
|
|
2140
|
+
background: #e0e0e0;
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
::-webkit-scrollbar-thumb:focus,
|
|
2144
|
+
*::-webkit-scrollbar-thumb:focus {
|
|
2145
|
+
background: #bdbdbd;
|
|
2146
|
+
}
|
|
2147
|
+
|
|
2148
|
+
::-webkit-scrollbar-thumb:active,
|
|
2149
|
+
*::-webkit-scrollbar-thumb:active {
|
|
2150
|
+
background: #bdbdbd;
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
::-webkit-scrollbar-thumb:hover,
|
|
2154
|
+
*::-webkit-scrollbar-thumb:hover {
|
|
2155
|
+
background: #bdbdbd;
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
::-webkit-scrollbar-corner,
|
|
2159
|
+
*::-webkit-scrollbar-corner {
|
|
2160
|
+
background-color: transparent;
|
|
2161
|
+
}
|
|
2162
|
+
`;
|
|
2163
|
+
var ce = function() {
|
|
2164
|
+
return ce = Object.assign || function(t) {
|
|
2165
|
+
for (var e, n = 1, r = arguments.length; n < r; n++) {
|
|
2166
|
+
e = arguments[n];
|
|
2167
|
+
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
|
|
2168
|
+
}
|
|
2169
|
+
return t;
|
|
2170
|
+
}, ce.apply(this, arguments);
|
|
2171
|
+
}, Xe = {
|
|
2172
|
+
onActivate: p.func,
|
|
2173
|
+
onAddUndo: p.func,
|
|
2174
|
+
onBeforeAddUndo: p.func,
|
|
2175
|
+
onBeforeExecCommand: p.func,
|
|
2176
|
+
onBeforeGetContent: p.func,
|
|
2177
|
+
onBeforeRenderUI: p.func,
|
|
2178
|
+
onBeforeSetContent: p.func,
|
|
2179
|
+
onBeforePaste: p.func,
|
|
2180
|
+
onBlur: p.func,
|
|
2181
|
+
onChange: p.func,
|
|
2182
|
+
onClearUndos: p.func,
|
|
2183
|
+
onClick: p.func,
|
|
2184
|
+
onContextMenu: p.func,
|
|
2185
|
+
onCommentChange: p.func,
|
|
2186
|
+
onCopy: p.func,
|
|
2187
|
+
onCut: p.func,
|
|
2188
|
+
onDblclick: p.func,
|
|
2189
|
+
onDeactivate: p.func,
|
|
2190
|
+
onDirty: p.func,
|
|
2191
|
+
onDrag: p.func,
|
|
2192
|
+
onDragDrop: p.func,
|
|
2193
|
+
onDragEnd: p.func,
|
|
2194
|
+
onDragGesture: p.func,
|
|
2195
|
+
onDragOver: p.func,
|
|
2196
|
+
onDrop: p.func,
|
|
2197
|
+
onExecCommand: p.func,
|
|
2198
|
+
onFocus: p.func,
|
|
2199
|
+
onFocusIn: p.func,
|
|
2200
|
+
onFocusOut: p.func,
|
|
2201
|
+
onGetContent: p.func,
|
|
2202
|
+
onHide: p.func,
|
|
2203
|
+
onInit: p.func,
|
|
2204
|
+
onKeyDown: p.func,
|
|
2205
|
+
onKeyPress: p.func,
|
|
2206
|
+
onKeyUp: p.func,
|
|
2207
|
+
onLoadContent: p.func,
|
|
2208
|
+
onMouseDown: p.func,
|
|
2209
|
+
onMouseEnter: p.func,
|
|
2210
|
+
onMouseLeave: p.func,
|
|
2211
|
+
onMouseMove: p.func,
|
|
2212
|
+
onMouseOut: p.func,
|
|
2213
|
+
onMouseOver: p.func,
|
|
2214
|
+
onMouseUp: p.func,
|
|
2215
|
+
onNodeChange: p.func,
|
|
2216
|
+
onObjectResizeStart: p.func,
|
|
2217
|
+
onObjectResized: p.func,
|
|
2218
|
+
onObjectSelected: p.func,
|
|
2219
|
+
onPaste: p.func,
|
|
2220
|
+
onPostProcess: p.func,
|
|
2221
|
+
onPostRender: p.func,
|
|
2222
|
+
onPreProcess: p.func,
|
|
2223
|
+
onProgressState: p.func,
|
|
2224
|
+
onRedo: p.func,
|
|
2225
|
+
onRemove: p.func,
|
|
2226
|
+
onReset: p.func,
|
|
2227
|
+
onSaveContent: p.func,
|
|
2228
|
+
onSelectionChange: p.func,
|
|
2229
|
+
onSetAttrib: p.func,
|
|
2230
|
+
onSetContent: p.func,
|
|
2231
|
+
onShow: p.func,
|
|
2232
|
+
onSubmit: p.func,
|
|
2233
|
+
onUndo: p.func,
|
|
2234
|
+
onVisualAid: p.func,
|
|
2235
|
+
onSkinLoadError: p.func,
|
|
2236
|
+
onThemeLoadError: p.func,
|
|
2237
|
+
onModelLoadError: p.func,
|
|
2238
|
+
onPluginLoadError: p.func,
|
|
2239
|
+
onIconsLoadError: p.func,
|
|
2240
|
+
onLanguageLoadError: p.func,
|
|
2241
|
+
onScriptsLoad: p.func,
|
|
2242
|
+
onScriptsLoadError: p.func
|
|
2243
|
+
}, pn = ce({ apiKey: p.string, id: p.string, inline: p.bool, init: p.object, initialValue: p.string, onEditorChange: p.func, value: p.string, tagName: p.string, cloudChannel: p.string, plugins: p.oneOfType([p.string, p.array]), toolbar: p.oneOfType([p.string, p.array]), disabled: p.bool, textareaName: p.string, tinymceScriptSrc: p.oneOfType([
|
|
2244
|
+
p.string,
|
|
2245
|
+
p.arrayOf(p.string),
|
|
2246
|
+
p.arrayOf(p.shape({
|
|
2247
|
+
src: p.string,
|
|
2248
|
+
async: p.bool,
|
|
2249
|
+
defer: p.bool
|
|
2250
|
+
}))
|
|
2251
|
+
]), rollback: p.oneOfType([p.number, p.oneOf([!1])]), scriptLoading: p.shape({
|
|
2252
|
+
async: p.bool,
|
|
2253
|
+
defer: p.bool,
|
|
2254
|
+
delay: p.number
|
|
2255
|
+
}) }, Xe), X = function(t) {
|
|
2256
|
+
return typeof t == "function";
|
|
2257
|
+
}, Le = function(t) {
|
|
2258
|
+
return t in Xe;
|
|
2259
|
+
}, Pe = function(t) {
|
|
2260
|
+
return t.substr(2);
|
|
2261
|
+
}, hn = function(t, e, n, r, i, o, s) {
|
|
2262
|
+
var a = Object.keys(i).filter(Le), c = Object.keys(o).filter(Le), l = a.filter(function(f) {
|
|
2263
|
+
return o[f] === void 0;
|
|
2264
|
+
}), u = c.filter(function(f) {
|
|
2265
|
+
return i[f] === void 0;
|
|
2266
|
+
});
|
|
2267
|
+
l.forEach(function(f) {
|
|
2268
|
+
var h = Pe(f), v = s[h];
|
|
2269
|
+
n(h, v), delete s[h];
|
|
2270
|
+
}), u.forEach(function(f) {
|
|
2271
|
+
var h = r(t, f), v = Pe(f);
|
|
2272
|
+
s[v] = h, e(v, h);
|
|
2273
|
+
});
|
|
2274
|
+
}, fn = function(t, e, n, r, i) {
|
|
2275
|
+
return hn(
|
|
2276
|
+
i,
|
|
2277
|
+
t.on.bind(t),
|
|
2278
|
+
t.off.bind(t),
|
|
2279
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
2280
|
+
function(o, s) {
|
|
2281
|
+
return function(a) {
|
|
2282
|
+
var c;
|
|
2283
|
+
return (c = o(s)) === null || c === void 0 ? void 0 : c(a, t);
|
|
2284
|
+
};
|
|
2285
|
+
},
|
|
2286
|
+
e,
|
|
2287
|
+
n,
|
|
2288
|
+
r
|
|
2289
|
+
);
|
|
2290
|
+
}, Oe = 0, et = function(t) {
|
|
2291
|
+
var e = Date.now(), n = Math.floor(Math.random() * 1e9);
|
|
2292
|
+
return Oe++, t + "_" + n + Oe + String(e);
|
|
2293
|
+
}, Ae = function(t) {
|
|
2294
|
+
return t !== null && (t.tagName.toLowerCase() === "textarea" || t.tagName.toLowerCase() === "input");
|
|
2295
|
+
}, De = function(t) {
|
|
2296
|
+
return typeof t > "u" || t === "" ? [] : Array.isArray(t) ? t : t.split(" ");
|
|
2297
|
+
}, dn = function(t, e) {
|
|
2298
|
+
return De(t).concat(De(e));
|
|
2299
|
+
}, gn = function() {
|
|
2300
|
+
return window.InputEvent && typeof InputEvent.prototype.getTargetRanges == "function";
|
|
2301
|
+
}, mn = function(t) {
|
|
2302
|
+
if (!("isConnected" in Node.prototype)) {
|
|
2303
|
+
for (var e = t, n = t.parentNode; n != null; )
|
|
2304
|
+
e = n, n = e.parentNode;
|
|
2305
|
+
return e === t.ownerDocument;
|
|
2306
|
+
}
|
|
2307
|
+
return t.isConnected;
|
|
2308
|
+
}, Be = function(t, e) {
|
|
2309
|
+
t !== void 0 && (t.mode != null && typeof t.mode == "object" && typeof t.mode.set == "function" ? t.mode.set(e) : t.setMode(e));
|
|
2310
|
+
}, ue = function() {
|
|
2311
|
+
return ue = Object.assign || function(t) {
|
|
2312
|
+
for (var e, n = 1, r = arguments.length; n < r; n++) {
|
|
2313
|
+
e = arguments[n];
|
|
2314
|
+
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
|
|
2315
|
+
}
|
|
2316
|
+
return t;
|
|
2317
|
+
}, ue.apply(this, arguments);
|
|
2318
|
+
}, bn = function(t, e, n) {
|
|
2319
|
+
var r, i, o = t.createElement("script");
|
|
2320
|
+
o.referrerPolicy = "origin", o.type = "application/javascript", o.id = e.id, o.src = e.src, o.async = (r = e.async) !== null && r !== void 0 ? r : !1, o.defer = (i = e.defer) !== null && i !== void 0 ? i : !1;
|
|
2321
|
+
var s = function() {
|
|
2322
|
+
o.removeEventListener("load", s), o.removeEventListener("error", a), n(e.src);
|
|
2323
|
+
}, a = function(c) {
|
|
2324
|
+
o.removeEventListener("load", s), o.removeEventListener("error", a), n(e.src, c);
|
|
2325
|
+
};
|
|
2326
|
+
o.addEventListener("load", s), o.addEventListener("error", a), t.head && t.head.appendChild(o);
|
|
2327
|
+
}, kn = function(t) {
|
|
2328
|
+
var e = {}, n = function(s, a) {
|
|
2329
|
+
var c = e[s];
|
|
2330
|
+
c.done = !0, c.error = a;
|
|
2331
|
+
for (var l = 0, u = c.handlers; l < u.length; l++) {
|
|
2332
|
+
var f = u[l];
|
|
2333
|
+
f(s, a);
|
|
2334
|
+
}
|
|
2335
|
+
c.handlers = [];
|
|
2336
|
+
}, r = function(s, a, c) {
|
|
2337
|
+
var l = function(C) {
|
|
2338
|
+
return c !== void 0 ? c(C) : console.error(C);
|
|
2339
|
+
};
|
|
2340
|
+
if (s.length === 0) {
|
|
2341
|
+
l(new Error("At least one script must be provided"));
|
|
2342
|
+
return;
|
|
2343
|
+
}
|
|
2344
|
+
for (var u = 0, f = !1, h = function(C, S) {
|
|
2345
|
+
f || (S ? (f = !0, l(S)) : ++u === s.length && a());
|
|
2346
|
+
}, v = 0, g = s; v < g.length; v++) {
|
|
2347
|
+
var m = g[v], k = e[m.src];
|
|
2348
|
+
if (k)
|
|
2349
|
+
k.done ? h(m.src, k.error) : k.handlers.push(h);
|
|
2350
|
+
else {
|
|
2351
|
+
var w = et("tiny-");
|
|
2352
|
+
e[m.src] = {
|
|
2353
|
+
id: w,
|
|
2354
|
+
src: m.src,
|
|
2355
|
+
done: !1,
|
|
2356
|
+
error: null,
|
|
2357
|
+
handlers: [h]
|
|
2358
|
+
}, bn(t, ue({ id: w }, m), n);
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
}, i = function() {
|
|
2362
|
+
for (var s, a = 0, c = Object.values(e); a < c.length; a++) {
|
|
2363
|
+
var l = c[a], u = t.getElementById(l.id);
|
|
2364
|
+
u != null && u.tagName === "SCRIPT" && ((s = u.parentNode) === null || s === void 0 || s.removeChild(u));
|
|
2365
|
+
}
|
|
2366
|
+
e = {};
|
|
2367
|
+
}, o = function() {
|
|
2368
|
+
return t;
|
|
2369
|
+
};
|
|
2370
|
+
return {
|
|
2371
|
+
loadScripts: r,
|
|
2372
|
+
deleteScripts: i,
|
|
2373
|
+
getDocument: o
|
|
2374
|
+
};
|
|
2375
|
+
}, vn = function() {
|
|
2376
|
+
var t = [], e = function(i) {
|
|
2377
|
+
var o = t.find(function(s) {
|
|
2378
|
+
return s.getDocument() === i;
|
|
2379
|
+
});
|
|
2380
|
+
return o === void 0 && (o = kn(i), t.push(o)), o;
|
|
2381
|
+
}, n = function(i, o, s, a, c) {
|
|
2382
|
+
var l = function() {
|
|
2383
|
+
return e(i).loadScripts(o, a, c);
|
|
2384
|
+
};
|
|
2385
|
+
s > 0 ? setTimeout(l, s) : l();
|
|
2386
|
+
}, r = function() {
|
|
2387
|
+
for (var i = t.pop(); i != null; i = t.pop())
|
|
2388
|
+
i.deleteScripts();
|
|
2389
|
+
};
|
|
2390
|
+
return {
|
|
2391
|
+
loadList: n,
|
|
2392
|
+
reinitialize: r
|
|
2393
|
+
};
|
|
2394
|
+
}, yn = vn(), ee = function(t) {
|
|
2395
|
+
var e = t;
|
|
2396
|
+
return e && e.tinymce ? e.tinymce : null;
|
|
2397
|
+
}, xn = /* @__PURE__ */ function() {
|
|
2398
|
+
var t = function(e, n) {
|
|
2399
|
+
return t = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, i) {
|
|
2400
|
+
r.__proto__ = i;
|
|
2401
|
+
} || function(r, i) {
|
|
2402
|
+
for (var o in i) Object.prototype.hasOwnProperty.call(i, o) && (r[o] = i[o]);
|
|
2403
|
+
}, t(e, n);
|
|
2404
|
+
};
|
|
2405
|
+
return function(e, n) {
|
|
2406
|
+
if (typeof n != "function" && n !== null)
|
|
2407
|
+
throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
|
|
2408
|
+
t(e, n);
|
|
2409
|
+
function r() {
|
|
2410
|
+
this.constructor = e;
|
|
2411
|
+
}
|
|
2412
|
+
e.prototype = n === null ? Object.create(n) : (r.prototype = n.prototype, new r());
|
|
2413
|
+
};
|
|
2414
|
+
}(), K = function() {
|
|
2415
|
+
return K = Object.assign || function(t) {
|
|
2416
|
+
for (var e, n = 1, r = arguments.length; n < r; n++) {
|
|
2417
|
+
e = arguments[n];
|
|
2418
|
+
for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
|
|
2419
|
+
}
|
|
2420
|
+
return t;
|
|
2421
|
+
}, K.apply(this, arguments);
|
|
2422
|
+
}, wn = (
|
|
2423
|
+
/** @class */
|
|
2424
|
+
function(t) {
|
|
2425
|
+
xn(e, t);
|
|
2426
|
+
function e(n) {
|
|
2427
|
+
var r, i, o, s = t.call(this, n) || this;
|
|
2428
|
+
return s.rollbackTimer = void 0, s.valueCursor = void 0, s.rollbackChange = function() {
|
|
2429
|
+
var a = s.editor, c = s.props.value;
|
|
2430
|
+
a && c && c !== s.currentContent && a.undoManager.ignore(function() {
|
|
2431
|
+
if (a.setContent(c), s.valueCursor && (!s.inline || a.hasFocus()))
|
|
2432
|
+
try {
|
|
2433
|
+
a.selection.moveToBookmark(s.valueCursor);
|
|
2434
|
+
} catch {
|
|
2435
|
+
}
|
|
2436
|
+
}), s.rollbackTimer = void 0;
|
|
2437
|
+
}, s.handleBeforeInput = function(a) {
|
|
2438
|
+
if (s.props.value !== void 0 && s.props.value === s.currentContent && s.editor && (!s.inline || s.editor.hasFocus()))
|
|
2439
|
+
try {
|
|
2440
|
+
s.valueCursor = s.editor.selection.getBookmark(3);
|
|
2441
|
+
} catch {
|
|
2442
|
+
}
|
|
2443
|
+
}, s.handleBeforeInputSpecial = function(a) {
|
|
2444
|
+
(a.key === "Enter" || a.key === "Backspace" || a.key === "Delete") && s.handleBeforeInput(a);
|
|
2445
|
+
}, s.handleEditorChange = function(a) {
|
|
2446
|
+
var c = s.editor;
|
|
2447
|
+
if (c && c.initialized) {
|
|
2448
|
+
var l = c.getContent();
|
|
2449
|
+
s.props.value !== void 0 && s.props.value !== l && s.props.rollback !== !1 && (s.rollbackTimer || (s.rollbackTimer = window.setTimeout(s.rollbackChange, typeof s.props.rollback == "number" ? s.props.rollback : 200))), l !== s.currentContent && (s.currentContent = l, X(s.props.onEditorChange) && s.props.onEditorChange(l, c));
|
|
2450
|
+
}
|
|
2451
|
+
}, s.handleEditorChangeSpecial = function(a) {
|
|
2452
|
+
(a.key === "Backspace" || a.key === "Delete") && s.handleEditorChange(a);
|
|
2453
|
+
}, s.initialise = function(a) {
|
|
2454
|
+
var c, l, u;
|
|
2455
|
+
a === void 0 && (a = 0);
|
|
2456
|
+
var f = s.elementRef.current;
|
|
2457
|
+
if (f) {
|
|
2458
|
+
if (!mn(f)) {
|
|
2459
|
+
if (a === 0)
|
|
2460
|
+
setTimeout(function() {
|
|
2461
|
+
return s.initialise(1);
|
|
2462
|
+
}, 1);
|
|
2463
|
+
else if (a < 100)
|
|
2464
|
+
setTimeout(function() {
|
|
2465
|
+
return s.initialise(a + 1);
|
|
2466
|
+
}, 100);
|
|
2467
|
+
else
|
|
2468
|
+
throw new Error("tinymce can only be initialised when in a document");
|
|
2469
|
+
return;
|
|
2470
|
+
}
|
|
2471
|
+
var h = ee(s.view);
|
|
2472
|
+
if (!h)
|
|
2473
|
+
throw new Error("tinymce should have been loaded into global scope");
|
|
2474
|
+
var v = K(K({}, s.props.init), { selector: void 0, target: f, readonly: s.props.disabled, inline: s.inline, plugins: dn((c = s.props.init) === null || c === void 0 ? void 0 : c.plugins, s.props.plugins), toolbar: (l = s.props.toolbar) !== null && l !== void 0 ? l : (u = s.props.init) === null || u === void 0 ? void 0 : u.toolbar, setup: function(g) {
|
|
2475
|
+
s.editor = g, s.bindHandlers({}), s.inline && !Ae(f) && g.once("PostRender", function(m) {
|
|
2476
|
+
g.setContent(s.getInitialValue(), { no_events: !0 });
|
|
2477
|
+
}), s.props.init && X(s.props.init.setup) && s.props.init.setup(g);
|
|
2478
|
+
}, init_instance_callback: function(g) {
|
|
2479
|
+
var m, k, w = s.getInitialValue();
|
|
2480
|
+
s.currentContent = (m = s.currentContent) !== null && m !== void 0 ? m : g.getContent(), s.currentContent !== w && (s.currentContent = w, g.setContent(w), g.undoManager.clear(), g.undoManager.add(), g.setDirty(!1));
|
|
2481
|
+
var C = (k = s.props.disabled) !== null && k !== void 0 ? k : !1;
|
|
2482
|
+
Be(s.editor, C ? "readonly" : "design"), s.props.init && X(s.props.init.init_instance_callback) && s.props.init.init_instance_callback(g);
|
|
2483
|
+
} });
|
|
2484
|
+
s.inline || (f.style.visibility = ""), Ae(f) && (f.value = s.getInitialValue()), h.init(v);
|
|
2485
|
+
}
|
|
2486
|
+
}, s.id = s.props.id || et("tiny-react"), s.elementRef = d.createRef(), s.inline = (o = (r = s.props.inline) !== null && r !== void 0 ? r : (i = s.props.init) === null || i === void 0 ? void 0 : i.inline) !== null && o !== void 0 ? o : !1, s.boundHandlers = {}, s;
|
|
2487
|
+
}
|
|
2488
|
+
return Object.defineProperty(e.prototype, "view", {
|
|
2489
|
+
get: function() {
|
|
2490
|
+
var n, r;
|
|
2491
|
+
return (r = (n = this.elementRef.current) === null || n === void 0 ? void 0 : n.ownerDocument.defaultView) !== null && r !== void 0 ? r : window;
|
|
2492
|
+
},
|
|
2493
|
+
enumerable: !1,
|
|
2494
|
+
configurable: !0
|
|
2495
|
+
}), e.prototype.componentDidUpdate = function(n) {
|
|
2496
|
+
var r = this, i, o;
|
|
2497
|
+
if (this.rollbackTimer && (clearTimeout(this.rollbackTimer), this.rollbackTimer = void 0), this.editor && (this.bindHandlers(n), this.editor.initialized)) {
|
|
2498
|
+
if (this.currentContent = (i = this.currentContent) !== null && i !== void 0 ? i : this.editor.getContent(), typeof this.props.initialValue == "string" && this.props.initialValue !== n.initialValue)
|
|
2499
|
+
this.editor.setContent(this.props.initialValue), this.editor.undoManager.clear(), this.editor.undoManager.add(), this.editor.setDirty(!1);
|
|
2500
|
+
else if (typeof this.props.value == "string" && this.props.value !== this.currentContent) {
|
|
2501
|
+
var s = this.editor;
|
|
2502
|
+
s.undoManager.transact(function() {
|
|
2503
|
+
var c;
|
|
2504
|
+
if (!r.inline || s.hasFocus())
|
|
2505
|
+
try {
|
|
2506
|
+
c = s.selection.getBookmark(3);
|
|
2507
|
+
} catch {
|
|
2508
|
+
}
|
|
2509
|
+
var l = r.valueCursor;
|
|
2510
|
+
if (s.setContent(r.props.value), !r.inline || s.hasFocus())
|
|
2511
|
+
for (var u = 0, f = [c, l]; u < f.length; u++) {
|
|
2512
|
+
var h = f[u];
|
|
2513
|
+
if (h)
|
|
2514
|
+
try {
|
|
2515
|
+
s.selection.moveToBookmark(h), r.valueCursor = h;
|
|
2516
|
+
break;
|
|
2517
|
+
} catch {
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
});
|
|
2521
|
+
}
|
|
2522
|
+
if (this.props.disabled !== n.disabled) {
|
|
2523
|
+
var a = (o = this.props.disabled) !== null && o !== void 0 ? o : !1;
|
|
2524
|
+
Be(this.editor, a ? "readonly" : "design");
|
|
2525
|
+
}
|
|
2526
|
+
}
|
|
2527
|
+
}, e.prototype.componentDidMount = function() {
|
|
2528
|
+
var n = this, r, i, o, s, a;
|
|
2529
|
+
if (ee(this.view) !== null)
|
|
2530
|
+
this.initialise();
|
|
2531
|
+
else if (Array.isArray(this.props.tinymceScriptSrc) && this.props.tinymceScriptSrc.length === 0)
|
|
2532
|
+
(i = (r = this.props).onScriptsLoadError) === null || i === void 0 || i.call(r, new Error("No `tinymce` global is present but the `tinymceScriptSrc` prop was an empty array."));
|
|
2533
|
+
else if (!((o = this.elementRef.current) === null || o === void 0) && o.ownerDocument) {
|
|
2534
|
+
var c = function() {
|
|
2535
|
+
var u, f;
|
|
2536
|
+
(f = (u = n.props).onScriptsLoad) === null || f === void 0 || f.call(u), n.initialise();
|
|
2537
|
+
}, l = function(u) {
|
|
2538
|
+
var f, h;
|
|
2539
|
+
(h = (f = n.props).onScriptsLoadError) === null || h === void 0 || h.call(f, u);
|
|
2540
|
+
};
|
|
2541
|
+
yn.loadList(this.elementRef.current.ownerDocument, this.getScriptSources(), (a = (s = this.props.scriptLoading) === null || s === void 0 ? void 0 : s.delay) !== null && a !== void 0 ? a : 0, c, l);
|
|
2542
|
+
}
|
|
2543
|
+
}, e.prototype.componentWillUnmount = function() {
|
|
2544
|
+
var n = this, r = this.editor;
|
|
2545
|
+
r && (r.off(this.changeEvents(), this.handleEditorChange), r.off(this.beforeInputEvent(), this.handleBeforeInput), r.off("keypress", this.handleEditorChangeSpecial), r.off("keydown", this.handleBeforeInputSpecial), r.off("NewBlock", this.handleEditorChange), Object.keys(this.boundHandlers).forEach(function(i) {
|
|
2546
|
+
r.off(i, n.boundHandlers[i]);
|
|
2547
|
+
}), this.boundHandlers = {}, r.remove(), this.editor = void 0);
|
|
2548
|
+
}, e.prototype.render = function() {
|
|
2549
|
+
return this.inline ? this.renderInline() : this.renderIframe();
|
|
2550
|
+
}, e.prototype.changeEvents = function() {
|
|
2551
|
+
var n, r, i, o = (i = (r = (n = ee(this.view)) === null || n === void 0 ? void 0 : n.Env) === null || r === void 0 ? void 0 : r.browser) === null || i === void 0 ? void 0 : i.isIE();
|
|
2552
|
+
return o ? "change keyup compositionend setcontent CommentChange" : "change input compositionend setcontent CommentChange";
|
|
2553
|
+
}, e.prototype.beforeInputEvent = function() {
|
|
2554
|
+
return gn() ? "beforeinput SelectionChange" : "SelectionChange";
|
|
2555
|
+
}, e.prototype.renderInline = function() {
|
|
2556
|
+
var n = this.props.tagName, r = n === void 0 ? "div" : n;
|
|
2557
|
+
return d.createElement(r, {
|
|
2558
|
+
ref: this.elementRef,
|
|
2559
|
+
id: this.id
|
|
2560
|
+
});
|
|
2561
|
+
}, e.prototype.renderIframe = function() {
|
|
2562
|
+
return d.createElement("textarea", {
|
|
2563
|
+
ref: this.elementRef,
|
|
2564
|
+
style: { visibility: "hidden" },
|
|
2565
|
+
name: this.props.textareaName,
|
|
2566
|
+
id: this.id
|
|
2567
|
+
});
|
|
2568
|
+
}, e.prototype.getScriptSources = function() {
|
|
2569
|
+
var n, r, i = (n = this.props.scriptLoading) === null || n === void 0 ? void 0 : n.async, o = (r = this.props.scriptLoading) === null || r === void 0 ? void 0 : r.defer;
|
|
2570
|
+
if (this.props.tinymceScriptSrc !== void 0)
|
|
2571
|
+
return typeof this.props.tinymceScriptSrc == "string" ? [{ src: this.props.tinymceScriptSrc, async: i, defer: o }] : this.props.tinymceScriptSrc.map(function(l) {
|
|
2572
|
+
return typeof l == "string" ? { src: l, async: i, defer: o } : l;
|
|
2573
|
+
});
|
|
2574
|
+
var s = this.props.cloudChannel, a = this.props.apiKey ? this.props.apiKey : "no-api-key", c = "https://cdn.tiny.cloud/1/".concat(a, "/tinymce/").concat(s, "/tinymce.min.js");
|
|
2575
|
+
return [{ src: c, async: i, defer: o }];
|
|
2576
|
+
}, e.prototype.getInitialValue = function() {
|
|
2577
|
+
return typeof this.props.initialValue == "string" ? this.props.initialValue : typeof this.props.value == "string" ? this.props.value : "";
|
|
2578
|
+
}, e.prototype.bindHandlers = function(n) {
|
|
2579
|
+
var r = this;
|
|
2580
|
+
if (this.editor !== void 0) {
|
|
2581
|
+
fn(this.editor, n, this.props, this.boundHandlers, function(a) {
|
|
2582
|
+
return r.props[a];
|
|
2583
|
+
});
|
|
2584
|
+
var i = function(a) {
|
|
2585
|
+
return a.onEditorChange !== void 0 || a.value !== void 0;
|
|
2586
|
+
}, o = i(n), s = i(this.props);
|
|
2587
|
+
!o && s ? (this.editor.on(this.changeEvents(), this.handleEditorChange), this.editor.on(this.beforeInputEvent(), this.handleBeforeInput), this.editor.on("keydown", this.handleBeforeInputSpecial), this.editor.on("keyup", this.handleEditorChangeSpecial), this.editor.on("NewBlock", this.handleEditorChange)) : o && !s && (this.editor.off(this.changeEvents(), this.handleEditorChange), this.editor.off(this.beforeInputEvent(), this.handleBeforeInput), this.editor.off("keydown", this.handleBeforeInputSpecial), this.editor.off("keyup", this.handleEditorChangeSpecial), this.editor.off("NewBlock", this.handleEditorChange));
|
|
2588
|
+
}
|
|
2589
|
+
}, e.propTypes = pn, e.defaultProps = {
|
|
2590
|
+
cloudChannel: "6"
|
|
2591
|
+
}, e;
|
|
2592
|
+
}(d.Component)
|
|
2593
|
+
);
|
|
2594
|
+
const pe = {
|
|
2595
|
+
baseUrl: "V3",
|
|
2596
|
+
signer: null
|
|
2597
|
+
}, In = ({ baseUrl: t, signer: e }) => {
|
|
2598
|
+
pe.baseUrl = t, pe.signer = e;
|
|
2599
|
+
}, Sn = () => {
|
|
2600
|
+
const t = window.location, { hostname: e } = t;
|
|
2601
|
+
return e === "localhost" || e === "127.0.0.1";
|
|
2602
|
+
}, tt = Sn(), nt = () => {
|
|
2603
|
+
var n;
|
|
2604
|
+
let t = window.location;
|
|
2605
|
+
const { host: e } = t;
|
|
2606
|
+
if (tt) {
|
|
2607
|
+
const r = (n = pe.baseUrl) == null ? void 0 : n.split("/");
|
|
2608
|
+
return r ? "https://" + (r == null ? void 0 : r[2]) : "https://vndev.hanbiro.com";
|
|
2609
|
+
} else {
|
|
2610
|
+
const r = localStorage.getItem("host") || e, i = r == null ? void 0 : r.split("/");
|
|
2611
|
+
return "https://" + (i == null ? void 0 : i[0]);
|
|
2612
|
+
}
|
|
2613
|
+
}, $n = () => {
|
|
2614
|
+
let t = window.location;
|
|
2615
|
+
if (tt)
|
|
2616
|
+
return nt() || "https://vndev.hanbiro.com/ngw";
|
|
2617
|
+
{
|
|
2618
|
+
window.location !== window.parent.location && (t = window.parent.location);
|
|
2619
|
+
const { hostname: e, protocol: n } = t;
|
|
2620
|
+
return [n, "//", e, "/ngw"].join("");
|
|
2621
|
+
}
|
|
2622
|
+
}, En = (t) => {
|
|
2623
|
+
const { isSimple: e, noImage: n } = t, r = 13, i = void 0, o = 0, s = "en", a = nt(), c = "jpeg,JPEG,jpg,JPG,jpe,JPE,jfi,jif,jfif,png,PNG,gif,GIF,bmp,BMP,webp,WEBP", l = {
|
|
2624
|
+
ko: '맑은고딕=Malgun Gothic;돋움="돋움",Dotum;돋움체="돋움체",DotumChe;굴림="굴림",Gulim;굴림체="굴림체",GulimChe;바탕="바탕",Batang;바탕체="바탕체",BatangChe;궁서="궁서",Gungseo;',
|
|
2625
|
+
en: "MS PGothic=MS PGothic,Sans-serif;Meiryo UI=Meiryo UI,Sans-serif;HiraKakuProN-W3=HiraKakuProN-W3;MS PMincho=MS PMincho,Sans-serif;MS Gothic=MS Gothic,Sans-serif;MS Mincho=MS Mincho,Sans-serif;",
|
|
2626
|
+
ch: "Microsoft YaHei=Microsoft YaHei,Sans-serif;"
|
|
2627
|
+
}[s] + "Andale Mono=andale mono,times; Arial=arial,helvetica,sans-serif; Arial Black=arial black,avant garde; Book Antiqua=book antiqua,palatino; Comic Sans MS=comic sans ms,sans-serif; Courier New=courier new,courier; Georgia=georgia,palatino; Helvetica=helvetica; Impact=impact,chicago; Symbol=symbol; Tahoma=tahoma,arial,helvetica,sans-serif; Terminal=terminal,monaco; Times New Roman=times new roman,times; Trebuchet MS=trebuchet ms,geneva; Verdana=verdana,geneva; Webdings=webdings; Wingdings=wingdings,zapf dingbats;", u = (() => {
|
|
2628
|
+
let m = window.location;
|
|
2629
|
+
const { hostname: k } = m;
|
|
2630
|
+
return k === "localhost" || k === "127.0.0.1" ? `${a}/ngw/app/lib/tinymce/plugins/jbimages/ci/index.php?upload/dropupload` : `${a}/ngw/app/lib/tinymce/plugins/jbimages/ci/index.php?upload/dropupload`;
|
|
2631
|
+
})();
|
|
2632
|
+
let f, h = [];
|
|
2633
|
+
e ? (f = "hanbiroclip", h = [
|
|
2634
|
+
"fontfamily fontsize",
|
|
2635
|
+
"bold italic underline",
|
|
2636
|
+
"forecolor backcolor",
|
|
2637
|
+
"bullist numlist",
|
|
2638
|
+
"emoticons"
|
|
2639
|
+
]) : (f = "checklist lists link image table code codesample insertdatetime emoticons fullscreen wordcount hanbiroclip", h = [
|
|
2640
|
+
"fontfamily fontsize styles",
|
|
2641
|
+
"align lineheight checklist",
|
|
2642
|
+
"bold italic underline",
|
|
2643
|
+
"forecolor backcolor",
|
|
2644
|
+
"bullist numlist",
|
|
2645
|
+
"link image table",
|
|
2646
|
+
"code codesample",
|
|
2647
|
+
"insertdatetime emoticons",
|
|
2648
|
+
"fullscreen",
|
|
2649
|
+
"removeformat"
|
|
2650
|
+
]);
|
|
2651
|
+
const v = (m) => {
|
|
2652
|
+
m.on("init", () => {
|
|
2653
|
+
setTimeout(() => {
|
|
2654
|
+
const k = m == null ? void 0 : m.getBody(), w = [];
|
|
2655
|
+
m.execCommand("FontSize", !1, r), w.push(`font-size: ${r}pt;`), (w == null ? void 0 : w.length) > 0 && (k == null || k.setAttribute("style", w.join(" "))), Number(o) && m.execCommand("Bold");
|
|
2656
|
+
}, 0);
|
|
2657
|
+
}), n && m.on("BeforeSetContent", (k) => {
|
|
2658
|
+
/<img[\s\S]*?>/i.test(k == null ? void 0 : k.content) && m.windowManager.alert("Image is not allowed!");
|
|
2659
|
+
});
|
|
2660
|
+
}, g = function(m) {
|
|
2661
|
+
const k = document.createElement("input");
|
|
2662
|
+
k.setAttribute("type", "file"), k.setAttribute("accept", "image/*"), k.onchange = function(w) {
|
|
2663
|
+
const C = w.target, S = C.files && C.files[0];
|
|
2664
|
+
if (S) {
|
|
2665
|
+
const $ = new FileReader();
|
|
2666
|
+
$.onload = function() {
|
|
2667
|
+
const P = "blobid" + (/* @__PURE__ */ new Date()).getTime(), z = window.tinymce.activeEditor.editorUpload.blobCache, _ = $.result;
|
|
2668
|
+
if (_ && typeof _ == "string") {
|
|
2669
|
+
const j = _.split(",")[1], Ee = z.create(P, S, j);
|
|
2670
|
+
z.add(Ee), m(Ee.blobUri(), { title: S.name });
|
|
2671
|
+
}
|
|
2672
|
+
}, $.readAsDataURL(S);
|
|
2673
|
+
}
|
|
2674
|
+
}, k.click();
|
|
2675
|
+
};
|
|
2676
|
+
return {
|
|
2677
|
+
defaultPlugins: f,
|
|
2678
|
+
defaultToolbar: h == null ? void 0 : h.join(" | "),
|
|
2679
|
+
imageUploadBasePath: a,
|
|
2680
|
+
imageUploadUrl: u,
|
|
2681
|
+
supportImageTypes: c,
|
|
2682
|
+
fontfamily: l,
|
|
2683
|
+
setupFunction: v,
|
|
2684
|
+
filePickerHandle: g,
|
|
2685
|
+
defaultFontType: i,
|
|
2686
|
+
defaultFontSize: r,
|
|
2687
|
+
isFontWeightBold: Number(o) === 1
|
|
2688
|
+
};
|
|
2078
2689
|
};
|
|
2079
|
-
class
|
|
2690
|
+
class Cn extends E.Component {
|
|
2080
2691
|
constructor(n) {
|
|
2081
2692
|
super(n);
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2693
|
+
b(this, "editorRef", null);
|
|
2694
|
+
// Các hàm public được expose ra (tương tự như useImperativeHandle trước đó)
|
|
2695
|
+
b(this, "getContent", () => {
|
|
2696
|
+
var r;
|
|
2697
|
+
return {
|
|
2698
|
+
content: ((r = this.editorRef) == null ? void 0 : r.getContent()) || ""
|
|
2699
|
+
};
|
|
2700
|
+
});
|
|
2701
|
+
b(this, "getRawContent", () => {
|
|
2702
|
+
var r;
|
|
2703
|
+
return ((r = this.editorRef) == null ? void 0 : r.getContent()) || "";
|
|
2085
2704
|
});
|
|
2086
|
-
|
|
2705
|
+
b(this, "handleEditorChange", (n) => {
|
|
2706
|
+
this.props.onChange && this.props.onChange(n);
|
|
2707
|
+
});
|
|
2708
|
+
this.state = {
|
|
2709
|
+
showEditor: !1
|
|
2710
|
+
};
|
|
2711
|
+
}
|
|
2712
|
+
render() {
|
|
2713
|
+
const {
|
|
2714
|
+
value: n,
|
|
2715
|
+
isSimple: r = !1,
|
|
2716
|
+
disabled: i = !1,
|
|
2717
|
+
height: o = 550,
|
|
2718
|
+
skin: s = "tinymce-5",
|
|
2719
|
+
onClick: a,
|
|
2720
|
+
style: c,
|
|
2721
|
+
lang: l = "en",
|
|
2722
|
+
placeholder: u = "",
|
|
2723
|
+
options: f,
|
|
2724
|
+
noImage: h = !1
|
|
2725
|
+
} = this.props, { showEditor: v } = this.state, {
|
|
2726
|
+
defaultPlugins: g,
|
|
2727
|
+
defaultToolbar: m,
|
|
2728
|
+
imageUploadBasePath: k,
|
|
2729
|
+
imageUploadUrl: w,
|
|
2730
|
+
supportImageTypes: C,
|
|
2731
|
+
fontfamily: S,
|
|
2732
|
+
setupFunction: $,
|
|
2733
|
+
filePickerHandle: P,
|
|
2734
|
+
defaultFontSize: z
|
|
2735
|
+
} = En({
|
|
2736
|
+
isSimple: r,
|
|
2737
|
+
noImage: h
|
|
2738
|
+
});
|
|
2739
|
+
return /* @__PURE__ */ E.createElement(
|
|
2740
|
+
"div",
|
|
2741
|
+
{
|
|
2742
|
+
style: {
|
|
2743
|
+
position: "relative",
|
|
2744
|
+
borderRadius: 1,
|
|
2745
|
+
height: o,
|
|
2746
|
+
...c
|
|
2747
|
+
}
|
|
2748
|
+
},
|
|
2749
|
+
!v && /* @__PURE__ */ E.createElement(
|
|
2750
|
+
cn,
|
|
2751
|
+
{
|
|
2752
|
+
style: {
|
|
2753
|
+
position: "absolute",
|
|
2754
|
+
top: 0,
|
|
2755
|
+
left: 0,
|
|
2756
|
+
right: 0,
|
|
2757
|
+
zIndex: 12,
|
|
2758
|
+
background: "#ffffff",
|
|
2759
|
+
border: "1px solid var(--grey-main)",
|
|
2760
|
+
borderRadius: 1,
|
|
2761
|
+
height: (f == null ? void 0 : f.height) || o
|
|
2762
|
+
}
|
|
2763
|
+
}
|
|
2764
|
+
),
|
|
2765
|
+
/* @__PURE__ */ E.createElement(
|
|
2766
|
+
wn,
|
|
2767
|
+
{
|
|
2768
|
+
disabled: i,
|
|
2769
|
+
onEditorChange: this.handleEditorChange,
|
|
2770
|
+
value: n,
|
|
2771
|
+
onInit: (_, j) => {
|
|
2772
|
+
this.setState({ showEditor: !0 }), this.editorRef = j;
|
|
2773
|
+
},
|
|
2774
|
+
onClick: a,
|
|
2775
|
+
plugins: g,
|
|
2776
|
+
init: {
|
|
2777
|
+
text_patterns: !1,
|
|
2778
|
+
placeholder: u,
|
|
2779
|
+
indent: !1,
|
|
2780
|
+
// skin: skin,
|
|
2781
|
+
visual: !1,
|
|
2782
|
+
promotion: !1,
|
|
2783
|
+
language: l || "en",
|
|
2784
|
+
// language_url: language
|
|
2785
|
+
// ? `${process.env.PUBLIC_URL || ""}/js/tinymce/langs/${language}.js`
|
|
2786
|
+
// : undefined,
|
|
2787
|
+
branding: !1,
|
|
2788
|
+
elementpath: !1,
|
|
2789
|
+
height: o,
|
|
2790
|
+
menubar: !r,
|
|
2791
|
+
verify_html: !0,
|
|
2792
|
+
toolbar: m,
|
|
2793
|
+
toolbar_mode: "sliding",
|
|
2794
|
+
images_upload_base_path: k,
|
|
2795
|
+
images_upload_url: w,
|
|
2796
|
+
images_upload_credentials: !0,
|
|
2797
|
+
automatic_uploads: !0,
|
|
2798
|
+
images_file_types: C,
|
|
2799
|
+
font_family_formats: S,
|
|
2800
|
+
paste_data_images: !0,
|
|
2801
|
+
a11y_advanced_options: !0,
|
|
2802
|
+
image_advtab: !0,
|
|
2803
|
+
file_picker_types: "file image media",
|
|
2804
|
+
file_picker_callback: P,
|
|
2805
|
+
forced_root_block_attrs: { style: "margin: 0;" },
|
|
2806
|
+
font_size_formats: "6pt 8pt 9pt 10pt 11pt 12pt 14pt 16pt 18pt 20pt 22pt 24pt 26pt 28pt 36pt 48pt 72pt",
|
|
2807
|
+
...h && {
|
|
2808
|
+
invalid_elements: "img"
|
|
2809
|
+
},
|
|
2810
|
+
content_style: `
|
|
2811
|
+
${un}
|
|
2812
|
+
[data-mce-placeholder]::before {
|
|
2813
|
+
color: rgba(0, 23, 55, 0.42) !important;
|
|
2814
|
+
}
|
|
2815
|
+
body {
|
|
2816
|
+
font-family: Helvetica,Arial,sans-serif;
|
|
2817
|
+
font-size: ${z}pt;
|
|
2818
|
+
line-height: unset;
|
|
2819
|
+
background: var(--background-softGrey);
|
|
2820
|
+
color: var(--text-primary);
|
|
2821
|
+
}`,
|
|
2822
|
+
setup: $,
|
|
2823
|
+
relative_urls: !1,
|
|
2824
|
+
remove_script_host: !1,
|
|
2825
|
+
document_base_url: "/"
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
)
|
|
2829
|
+
);
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
class Rn extends d.Component {
|
|
2833
|
+
constructor(n) {
|
|
2834
|
+
super(n);
|
|
2835
|
+
b(this, "containerRef");
|
|
2836
|
+
b(this, "popperRef");
|
|
2837
|
+
b(this, "handleClickOutside", (n) => {
|
|
2838
|
+
const r = n.target;
|
|
2839
|
+
this.containerRef.current && !this.containerRef.current.contains(r) && (!this.popperRef.current || !this.popperRef.current.contains(r)) && this.setState({ open: !1 });
|
|
2840
|
+
});
|
|
2841
|
+
b(this, "togglePopper", () => {
|
|
2087
2842
|
this.setState((n) => ({ open: !n.open }));
|
|
2088
2843
|
});
|
|
2089
|
-
|
|
2090
|
-
const r =
|
|
2844
|
+
b(this, "handleLangChange", (n) => {
|
|
2845
|
+
const r = oe.find((i) => i.value === n.target.value);
|
|
2091
2846
|
this.props.setLang(r || null);
|
|
2092
2847
|
});
|
|
2093
|
-
this.state = { open: !1 }, this.containerRef =
|
|
2848
|
+
this.state = { open: !1 }, this.containerRef = d.createRef(), this.popperRef = d.createRef();
|
|
2094
2849
|
}
|
|
2095
2850
|
componentDidMount() {
|
|
2096
2851
|
document.addEventListener("mousedown", this.handleClickOutside);
|
|
@@ -2099,133 +2854,165 @@ class Ut extends u.Component {
|
|
|
2099
2854
|
document.removeEventListener("mousedown", this.handleClickOutside);
|
|
2100
2855
|
}
|
|
2101
2856
|
render() {
|
|
2102
|
-
const {
|
|
2103
|
-
|
|
2857
|
+
const {
|
|
2858
|
+
lang: n,
|
|
2859
|
+
originalEmail: r,
|
|
2860
|
+
setOriginalEmail: i,
|
|
2861
|
+
getEditorContent: o,
|
|
2862
|
+
parentRef: s
|
|
2863
|
+
} = this.props, { open: a } = this.state;
|
|
2864
|
+
let c = 0, l = 0, u = 320;
|
|
2865
|
+
if (a && this.containerRef.current) {
|
|
2866
|
+
const f = this.containerRef.current.getBoundingClientRect();
|
|
2867
|
+
if (c = f.top + (window.scrollY || document.documentElement.scrollTop) - 8, l = f.left + (window.scrollX || document.documentElement.scrollLeft), s && s.current) {
|
|
2868
|
+
const h = s.current.getBoundingClientRect();
|
|
2869
|
+
u = h.width - 16, l = h.left + 8;
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
return /* @__PURE__ */ d.createElement(
|
|
2104
2873
|
"div",
|
|
2105
2874
|
{
|
|
2106
2875
|
ref: this.containerRef,
|
|
2107
2876
|
style: { position: "relative", display: "inline-block" }
|
|
2108
2877
|
},
|
|
2109
|
-
/* @__PURE__ */
|
|
2878
|
+
/* @__PURE__ */ d.createElement(
|
|
2110
2879
|
"button",
|
|
2111
2880
|
{
|
|
2112
2881
|
type: "button",
|
|
2113
2882
|
onClick: this.togglePopper,
|
|
2114
2883
|
className: "icon-button small"
|
|
2115
2884
|
},
|
|
2116
|
-
/* @__PURE__ */
|
|
2885
|
+
/* @__PURE__ */ d.createElement(de, { size: 16 })
|
|
2117
2886
|
),
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
{
|
|
2121
|
-
style: {
|
|
2122
|
-
position: "absolute",
|
|
2123
|
-
bottom: "100%",
|
|
2124
|
-
left: 0,
|
|
2125
|
-
zIndex: 1051,
|
|
2126
|
-
background: "#fff",
|
|
2127
|
-
border: "1px solid #ddd",
|
|
2128
|
-
boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
|
|
2129
|
-
borderRadius: 8,
|
|
2130
|
-
padding: 16,
|
|
2131
|
-
width: 320,
|
|
2132
|
-
marginBottom: 8
|
|
2133
|
-
}
|
|
2134
|
-
},
|
|
2135
|
-
/* @__PURE__ */ u.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 12 } }, /* @__PURE__ */ u.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 4 } }, /* @__PURE__ */ u.createElement(
|
|
2136
|
-
"span",
|
|
2137
|
-
{
|
|
2138
|
-
style: {
|
|
2139
|
-
fontSize: 12,
|
|
2140
|
-
fontWeight: 500,
|
|
2141
|
-
color: "var(--text-secondary)"
|
|
2142
|
-
}
|
|
2143
|
-
},
|
|
2144
|
-
"Language"
|
|
2145
|
-
), /* @__PURE__ */ u.createElement(
|
|
2146
|
-
"select",
|
|
2147
|
-
{
|
|
2148
|
-
value: n ? n.value : "",
|
|
2149
|
-
onChange: this.handleLangChange,
|
|
2150
|
-
style: {
|
|
2151
|
-
padding: "6px 8px",
|
|
2152
|
-
borderRadius: 4,
|
|
2153
|
-
border: "1px solid #ccc",
|
|
2154
|
-
fontSize: 14
|
|
2155
|
-
}
|
|
2156
|
-
},
|
|
2157
|
-
/* @__PURE__ */ u.createElement("option", { value: "", disabled: !0 }, "Select Language"),
|
|
2158
|
-
ee.map((a) => /* @__PURE__ */ u.createElement("option", { key: a.value, value: a.value }, a.label))
|
|
2159
|
-
)), /* @__PURE__ */ u.createElement("div", { style: { display: "flex", flexDirection: "column", gap: 4 } }, /* @__PURE__ */ u.createElement(
|
|
2887
|
+
a && this.containerRef.current && ot.createPortal(
|
|
2888
|
+
/* @__PURE__ */ d.createElement(
|
|
2160
2889
|
"div",
|
|
2161
2890
|
{
|
|
2891
|
+
ref: this.popperRef,
|
|
2162
2892
|
style: {
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2893
|
+
position: "absolute",
|
|
2894
|
+
top: c,
|
|
2895
|
+
left: l,
|
|
2896
|
+
transform: "translateY(-100%)",
|
|
2897
|
+
zIndex: 1051,
|
|
2898
|
+
background: "#fff",
|
|
2899
|
+
border: "1px solid #ddd",
|
|
2900
|
+
boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
|
|
2901
|
+
borderRadius: 8,
|
|
2902
|
+
padding: 16,
|
|
2903
|
+
width: u,
|
|
2904
|
+
boxSizing: "border-box"
|
|
2166
2905
|
}
|
|
2167
2906
|
},
|
|
2168
|
-
/* @__PURE__ */
|
|
2169
|
-
"
|
|
2907
|
+
/* @__PURE__ */ d.createElement(
|
|
2908
|
+
"div",
|
|
2170
2909
|
{
|
|
2171
|
-
style: {
|
|
2172
|
-
fontSize: 12,
|
|
2173
|
-
fontWeight: 500,
|
|
2174
|
-
color: "var(--text-secondary)"
|
|
2175
|
-
}
|
|
2910
|
+
style: { display: "flex", flexDirection: "column", gap: 12 }
|
|
2176
2911
|
},
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
{
|
|
2182
|
-
type: "button",
|
|
2183
|
-
title: "Copy from origin email",
|
|
2184
|
-
onClick: () => {
|
|
2185
|
-
const a = s();
|
|
2186
|
-
i(a);
|
|
2912
|
+
/* @__PURE__ */ d.createElement(
|
|
2913
|
+
"div",
|
|
2914
|
+
{
|
|
2915
|
+
style: { display: "flex", flexDirection: "column", gap: 4 }
|
|
2187
2916
|
},
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2917
|
+
/* @__PURE__ */ d.createElement(
|
|
2918
|
+
"span",
|
|
2919
|
+
{
|
|
2920
|
+
style: {
|
|
2921
|
+
fontSize: 12,
|
|
2922
|
+
fontWeight: 500
|
|
2923
|
+
// color: "var(--text-secondary)",
|
|
2924
|
+
}
|
|
2925
|
+
},
|
|
2926
|
+
"Language"
|
|
2927
|
+
),
|
|
2928
|
+
/* @__PURE__ */ d.createElement(
|
|
2929
|
+
"select",
|
|
2930
|
+
{
|
|
2931
|
+
value: n ? n.value : "",
|
|
2932
|
+
onChange: this.handleLangChange,
|
|
2933
|
+
style: {
|
|
2934
|
+
padding: "6px 8px",
|
|
2935
|
+
borderRadius: 4,
|
|
2936
|
+
border: "1px solid #ccc",
|
|
2937
|
+
fontSize: 14
|
|
2938
|
+
}
|
|
2939
|
+
},
|
|
2940
|
+
/* @__PURE__ */ d.createElement("option", { value: "", disabled: !0 }, "Select Language"),
|
|
2941
|
+
oe.map((f) => /* @__PURE__ */ d.createElement("option", { key: f.value, value: f.value }, f.label))
|
|
2942
|
+
)
|
|
2943
|
+
),
|
|
2944
|
+
/* @__PURE__ */ d.createElement(
|
|
2945
|
+
"div",
|
|
2946
|
+
{
|
|
2947
|
+
style: { display: "flex", flexDirection: "column", gap: 4 }
|
|
2948
|
+
},
|
|
2949
|
+
/* @__PURE__ */ d.createElement(
|
|
2950
|
+
"div",
|
|
2951
|
+
{
|
|
2952
|
+
style: {
|
|
2953
|
+
display: "flex",
|
|
2954
|
+
alignItems: "center",
|
|
2955
|
+
justifyContent: "space-between"
|
|
2956
|
+
}
|
|
2957
|
+
},
|
|
2958
|
+
/* @__PURE__ */ d.createElement(
|
|
2959
|
+
"span",
|
|
2960
|
+
{
|
|
2961
|
+
style: {
|
|
2962
|
+
fontSize: 12,
|
|
2963
|
+
fontWeight: 500
|
|
2964
|
+
// color: "var(--text-secondary)",
|
|
2965
|
+
}
|
|
2966
|
+
},
|
|
2967
|
+
"AI Context"
|
|
2968
|
+
),
|
|
2969
|
+
o && /* @__PURE__ */ d.createElement(
|
|
2970
|
+
"button",
|
|
2971
|
+
{
|
|
2972
|
+
type: "button",
|
|
2973
|
+
title: "Copy from origin email",
|
|
2974
|
+
onClick: () => {
|
|
2975
|
+
const f = o();
|
|
2976
|
+
i(f);
|
|
2977
|
+
},
|
|
2978
|
+
className: "icon-button"
|
|
2979
|
+
},
|
|
2980
|
+
/* @__PURE__ */ d.createElement(Q, null)
|
|
2981
|
+
)
|
|
2982
|
+
),
|
|
2983
|
+
/* @__PURE__ */ d.createElement(
|
|
2984
|
+
Cn,
|
|
2985
|
+
{
|
|
2986
|
+
value: r,
|
|
2987
|
+
onChange: (f) => i(f),
|
|
2988
|
+
height: 350,
|
|
2989
|
+
isSimple: !0
|
|
2990
|
+
}
|
|
2991
|
+
)
|
|
2992
|
+
)
|
|
2191
2993
|
)
|
|
2192
|
-
),
|
|
2193
|
-
|
|
2194
|
-
{
|
|
2195
|
-
value: r,
|
|
2196
|
-
onChange: (a) => i(a.target.value),
|
|
2197
|
-
style: {
|
|
2198
|
-
width: "100%",
|
|
2199
|
-
height: 120,
|
|
2200
|
-
resize: "vertical",
|
|
2201
|
-
padding: 8,
|
|
2202
|
-
border: "1px solid #ccc",
|
|
2203
|
-
borderRadius: 4,
|
|
2204
|
-
fontSize: 13,
|
|
2205
|
-
fontFamily: "inherit",
|
|
2206
|
-
boxSizing: "border-box"
|
|
2207
|
-
}
|
|
2208
|
-
}
|
|
2209
|
-
)))
|
|
2994
|
+
),
|
|
2995
|
+
document.body
|
|
2210
2996
|
)
|
|
2211
2997
|
);
|
|
2212
2998
|
}
|
|
2213
2999
|
}
|
|
2214
|
-
class
|
|
3000
|
+
class zn extends d.Component {
|
|
2215
3001
|
constructor(n) {
|
|
2216
3002
|
super(n);
|
|
3003
|
+
b(this, "rootRef");
|
|
2217
3004
|
// Equivalent to useImperativeHandle
|
|
2218
|
-
|
|
3005
|
+
b(this, "setAiContext", (n) => {
|
|
2219
3006
|
this.setState({ originalEmail: n });
|
|
2220
3007
|
});
|
|
2221
|
-
|
|
3008
|
+
b(this, "handleMessageChange", (n) => {
|
|
2222
3009
|
this.setState({ message: n.target.value });
|
|
2223
3010
|
});
|
|
2224
|
-
|
|
2225
|
-
const { message: n, messages: r, lang: i, originalEmail:
|
|
3011
|
+
b(this, "handleSubmit", async () => {
|
|
3012
|
+
const { message: n, messages: r, lang: i, originalEmail: o, conversationId: s } = this.state, { signer: a, baseUrl: c = "" } = this.props;
|
|
2226
3013
|
if (!n.trim()) return;
|
|
2227
|
-
const l =
|
|
2228
|
-
let
|
|
3014
|
+
const l = ut();
|
|
3015
|
+
let u = {
|
|
2229
3016
|
id: l,
|
|
2230
3017
|
question: n,
|
|
2231
3018
|
subject: "",
|
|
@@ -2233,65 +3020,66 @@ class Qt extends u.Component {
|
|
|
2233
3020
|
created_at: (/* @__PURE__ */ new Date()).getTime(),
|
|
2234
3021
|
isLoading: !0
|
|
2235
3022
|
};
|
|
2236
|
-
const
|
|
3023
|
+
const f = [...r, u];
|
|
2237
3024
|
this.setState({
|
|
2238
|
-
messages:
|
|
3025
|
+
messages: f,
|
|
2239
3026
|
message: "",
|
|
2240
3027
|
isSending: !0
|
|
2241
3028
|
});
|
|
2242
3029
|
const h = {
|
|
2243
3030
|
query: n,
|
|
2244
3031
|
default_language: i ? i.value : "KR",
|
|
2245
|
-
original_email:
|
|
3032
|
+
original_email: o,
|
|
2246
3033
|
debug_grpc: !0
|
|
2247
3034
|
};
|
|
2248
|
-
|
|
2249
|
-
setContent: (
|
|
2250
|
-
this.setState((
|
|
3035
|
+
s && (h.conversation_id = s), await St(h, {
|
|
3036
|
+
setContent: (k) => {
|
|
3037
|
+
this.setState((w) => ({ messages: w.messages.map(
|
|
2251
3038
|
(S) => S.id === l ? {
|
|
2252
3039
|
...S,
|
|
2253
3040
|
subject: "Some thing not used",
|
|
2254
|
-
body:
|
|
3041
|
+
body: k,
|
|
2255
3042
|
isLoading: !1,
|
|
2256
3043
|
created_at: (/* @__PURE__ */ new Date()).getTime()
|
|
2257
3044
|
} : S
|
|
2258
3045
|
) }));
|
|
2259
3046
|
},
|
|
2260
|
-
setIsLoading: (
|
|
2261
|
-
this.setState((
|
|
2262
|
-
(S) => S.id === l ? { ...S, isLoading:
|
|
3047
|
+
setIsLoading: (k) => {
|
|
3048
|
+
this.setState((w) => ({ messages: w.messages.map(
|
|
3049
|
+
(S) => S.id === l ? { ...S, isLoading: k } : S
|
|
2263
3050
|
) }));
|
|
2264
3051
|
},
|
|
2265
|
-
setConversationId: (
|
|
2266
|
-
this.setState({ conversationId:
|
|
3052
|
+
setConversationId: (k) => {
|
|
3053
|
+
this.setState({ conversationId: k });
|
|
2267
3054
|
},
|
|
2268
3055
|
signer: a,
|
|
2269
|
-
baseUrl:
|
|
3056
|
+
baseUrl: c
|
|
2270
3057
|
}), this.setState({ isSending: !1 });
|
|
2271
3058
|
});
|
|
2272
|
-
|
|
3059
|
+
b(this, "handleKeyDown", (n) => {
|
|
2273
3060
|
!n.shiftKey && n.key === "Enter" && !this.state.isSending && (n.preventDefault(), this.handleSubmit());
|
|
2274
3061
|
});
|
|
2275
|
-
|
|
3062
|
+
b(this, "setLang", (n) => {
|
|
2276
3063
|
this.setState({ lang: n });
|
|
2277
3064
|
});
|
|
2278
|
-
|
|
3065
|
+
b(this, "setOriginalEmail", (n) => {
|
|
2279
3066
|
this.setState({ originalEmail: n });
|
|
2280
3067
|
});
|
|
2281
|
-
this.state = {
|
|
3068
|
+
this.rootRef = d.createRef(), this.state = {
|
|
2282
3069
|
message: "",
|
|
2283
3070
|
messages: [],
|
|
2284
3071
|
isSending: !1,
|
|
2285
|
-
lang:
|
|
3072
|
+
lang: oe[0],
|
|
2286
3073
|
conversationId: "",
|
|
2287
3074
|
originalEmail: ""
|
|
2288
3075
|
};
|
|
2289
3076
|
}
|
|
2290
3077
|
render() {
|
|
2291
|
-
const { onApply: n, getEditorContent: r } = this.props, { message: i, messages:
|
|
2292
|
-
return /* @__PURE__ */
|
|
3078
|
+
const { onApply: n, getEditorContent: r } = this.props, { message: i, messages: o, isSending: s, lang: a, originalEmail: c } = this.state;
|
|
3079
|
+
return /* @__PURE__ */ d.createElement(
|
|
2293
3080
|
"div",
|
|
2294
3081
|
{
|
|
3082
|
+
ref: this.rootRef,
|
|
2295
3083
|
style: {
|
|
2296
3084
|
display: "flex",
|
|
2297
3085
|
height: "100%",
|
|
@@ -2302,14 +3090,14 @@ class Qt extends u.Component {
|
|
|
2302
3090
|
boxSizing: "border-box"
|
|
2303
3091
|
}
|
|
2304
3092
|
},
|
|
2305
|
-
|
|
2306
|
-
|
|
3093
|
+
o.length > 0 ? /* @__PURE__ */ d.createElement(
|
|
3094
|
+
an,
|
|
2307
3095
|
{
|
|
2308
|
-
items:
|
|
3096
|
+
items: o,
|
|
2309
3097
|
onApply: n,
|
|
2310
3098
|
getEditorContent: r
|
|
2311
3099
|
}
|
|
2312
|
-
) : /* @__PURE__ */
|
|
3100
|
+
) : /* @__PURE__ */ d.createElement(
|
|
2313
3101
|
"div",
|
|
2314
3102
|
{
|
|
2315
3103
|
style: {
|
|
@@ -2322,8 +3110,8 @@ class Qt extends u.Component {
|
|
|
2322
3110
|
color: "var(--grey-light)"
|
|
2323
3111
|
}
|
|
2324
3112
|
},
|
|
2325
|
-
/* @__PURE__ */
|
|
2326
|
-
/* @__PURE__ */
|
|
3113
|
+
/* @__PURE__ */ d.createElement(wt, { size: 46 }),
|
|
3114
|
+
/* @__PURE__ */ d.createElement(
|
|
2327
3115
|
"h2",
|
|
2328
3116
|
{
|
|
2329
3117
|
style: {
|
|
@@ -2336,20 +3124,20 @@ class Qt extends u.Component {
|
|
|
2336
3124
|
"Build with Agent"
|
|
2337
3125
|
)
|
|
2338
3126
|
),
|
|
2339
|
-
/* @__PURE__ */
|
|
3127
|
+
/* @__PURE__ */ d.createElement(
|
|
2340
3128
|
"div",
|
|
2341
3129
|
{
|
|
2342
3130
|
style: {
|
|
2343
3131
|
width: "100%",
|
|
2344
3132
|
border: "1px solid #ddd",
|
|
2345
3133
|
borderRadius: 4,
|
|
2346
|
-
|
|
2347
|
-
background:
|
|
3134
|
+
overflow: "hidden",
|
|
3135
|
+
background: "#fff",
|
|
2348
3136
|
display: "flex",
|
|
2349
3137
|
flexDirection: "column"
|
|
2350
3138
|
}
|
|
2351
3139
|
},
|
|
2352
|
-
/* @__PURE__ */
|
|
3140
|
+
/* @__PURE__ */ d.createElement(
|
|
2353
3141
|
"textarea",
|
|
2354
3142
|
{
|
|
2355
3143
|
value: i,
|
|
@@ -2357,7 +3145,7 @@ class Qt extends u.Component {
|
|
|
2357
3145
|
placeholder: "Describe your email",
|
|
2358
3146
|
name: "ai-content",
|
|
2359
3147
|
onKeyDown: this.handleKeyDown,
|
|
2360
|
-
disabled:
|
|
3148
|
+
disabled: s,
|
|
2361
3149
|
style: {
|
|
2362
3150
|
flex: 1,
|
|
2363
3151
|
minWidth: 0,
|
|
@@ -2372,7 +3160,7 @@ class Qt extends u.Component {
|
|
|
2372
3160
|
}
|
|
2373
3161
|
}
|
|
2374
3162
|
),
|
|
2375
|
-
/* @__PURE__ */
|
|
3163
|
+
/* @__PURE__ */ d.createElement(
|
|
2376
3164
|
"div",
|
|
2377
3165
|
{
|
|
2378
3166
|
style: {
|
|
@@ -2385,65 +3173,37 @@ class Qt extends u.Component {
|
|
|
2385
3173
|
boxSizing: "border-box"
|
|
2386
3174
|
}
|
|
2387
3175
|
},
|
|
2388
|
-
/* @__PURE__ */
|
|
2389
|
-
|
|
3176
|
+
/* @__PURE__ */ d.createElement(
|
|
3177
|
+
Rn,
|
|
2390
3178
|
{
|
|
2391
3179
|
lang: a,
|
|
2392
3180
|
setLang: this.setLang,
|
|
2393
|
-
originalEmail:
|
|
3181
|
+
originalEmail: c,
|
|
2394
3182
|
setOriginalEmail: this.setOriginalEmail,
|
|
2395
|
-
getEditorContent: r
|
|
3183
|
+
getEditorContent: r,
|
|
3184
|
+
parentRef: this.rootRef
|
|
2396
3185
|
}
|
|
2397
3186
|
),
|
|
2398
|
-
/* @__PURE__ */
|
|
3187
|
+
/* @__PURE__ */ d.createElement(
|
|
2399
3188
|
"button",
|
|
2400
3189
|
{
|
|
2401
|
-
disabled: !i.trim() ||
|
|
3190
|
+
disabled: !i.trim() || s,
|
|
2402
3191
|
onClick: this.handleSubmit,
|
|
2403
3192
|
className: "icon-button",
|
|
2404
3193
|
color: "primary"
|
|
2405
3194
|
},
|
|
2406
|
-
/* @__PURE__ */
|
|
3195
|
+
/* @__PURE__ */ d.createElement(fe, null)
|
|
2407
3196
|
)
|
|
2408
3197
|
)
|
|
2409
3198
|
)
|
|
2410
3199
|
);
|
|
2411
3200
|
}
|
|
2412
3201
|
}
|
|
2413
|
-
const ie = {
|
|
2414
|
-
baseUrl: "V3",
|
|
2415
|
-
signer: null
|
|
2416
|
-
}, Kt = ({ baseUrl: t, signer: e }) => {
|
|
2417
|
-
ie.baseUrl = t, ie.signer = e;
|
|
2418
|
-
}, Zt = () => {
|
|
2419
|
-
const t = window.location, { hostname: e } = t;
|
|
2420
|
-
return e === "localhost" || e === "127.0.0.1";
|
|
2421
|
-
}, Be = Zt(), Gt = () => {
|
|
2422
|
-
var n;
|
|
2423
|
-
let t = window.location;
|
|
2424
|
-
const { host: e } = t;
|
|
2425
|
-
if (Be) {
|
|
2426
|
-
const r = (n = ie.baseUrl) == null ? void 0 : n.split("/");
|
|
2427
|
-
return r ? "https://" + (r == null ? void 0 : r[2]) : "https://vndev.hanbiro.com";
|
|
2428
|
-
} else {
|
|
2429
|
-
const r = localStorage.getItem("host") || e, i = r == null ? void 0 : r.split("/");
|
|
2430
|
-
return "https://" + (i == null ? void 0 : i[0]);
|
|
2431
|
-
}
|
|
2432
|
-
}, Jt = () => {
|
|
2433
|
-
let t = window.location;
|
|
2434
|
-
if (Be)
|
|
2435
|
-
return Gt() || "https://vndev.hanbiro.com/ngw";
|
|
2436
|
-
{
|
|
2437
|
-
window.location !== window.parent.location && (t = window.parent.location);
|
|
2438
|
-
const { hostname: e, protocol: n } = t;
|
|
2439
|
-
return [n, "//", e, "/ngw"].join("");
|
|
2440
|
-
}
|
|
2441
|
-
};
|
|
2442
3202
|
export {
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
3203
|
+
zn as ChatAIDraft,
|
|
3204
|
+
Ye as LoadingCircular,
|
|
3205
|
+
cn as LoadingContainer,
|
|
3206
|
+
nt as getBaseUrl,
|
|
3207
|
+
$n as getGroupwareUrl,
|
|
3208
|
+
In as initHanbiroReactSDK
|
|
2449
3209
|
};
|