jspdf-md-renderer 3.0.1 → 3.1.0
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 +36 -0
- package/dist/index.js +2 -3
- package/dist/index.mjs +676 -1740
- package/dist/index.umd.js +4 -0
- package/package.json +4 -2
package/dist/index.mjs
CHANGED
|
@@ -1,112 +1,113 @@
|
|
|
1
|
-
import { marked as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { marked as R } from "marked";
|
|
2
|
+
import A from "jspdf-autotable";
|
|
3
|
+
var u = /* @__PURE__ */ ((t) => (t.Heading = "heading", t.Paragraph = "paragraph", t.List = "list", t.ListItem = "list_item", t.Blockquote = "blockquote", t.Code = "code", t.CodeSpan = "codespan", t.Table = "table", t.Html = "html", t.Hr = "hr", t.Image = "image", t.Link = "link", t.Strong = "strong", t.Em = "em", t.TableHeader = "table_header", t.TableCell = "table_cell", t.Raw = "raw", t.Text = "text", t))(u || {});
|
|
4
|
+
const j = async (t) => {
|
|
5
|
+
const n = await R.lexer(t, { async: !0, gfm: !0 });
|
|
6
|
+
return W(n);
|
|
7
|
+
}, W = (t) => {
|
|
8
|
+
const n = [];
|
|
9
|
+
return t.forEach((s) => {
|
|
9
10
|
try {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
type:
|
|
13
|
-
content:
|
|
11
|
+
const g = O[s.type];
|
|
12
|
+
g ? n.push(g(s)) : n.push({
|
|
13
|
+
type: u.Raw,
|
|
14
|
+
content: s.raw
|
|
14
15
|
});
|
|
15
|
-
} catch (
|
|
16
|
-
console.error("Failed to handle token ==>",
|
|
16
|
+
} catch (g) {
|
|
17
|
+
console.error("Failed to handle token ==>", s, g);
|
|
17
18
|
}
|
|
18
|
-
}),
|
|
19
|
-
},
|
|
20
|
-
[
|
|
21
|
-
type:
|
|
22
|
-
depth:
|
|
23
|
-
content:
|
|
24
|
-
items:
|
|
19
|
+
}), n;
|
|
20
|
+
}, O = {
|
|
21
|
+
[u.Heading]: (t) => ({
|
|
22
|
+
type: u.Heading,
|
|
23
|
+
depth: t.depth,
|
|
24
|
+
content: t.text,
|
|
25
|
+
items: t.tokens ? W(t.tokens) : []
|
|
25
26
|
}),
|
|
26
|
-
[
|
|
27
|
-
type:
|
|
28
|
-
content:
|
|
29
|
-
items:
|
|
27
|
+
[u.Paragraph]: (t) => ({
|
|
28
|
+
type: u.Paragraph,
|
|
29
|
+
content: t.text,
|
|
30
|
+
items: t.tokens ? W(t.tokens) : []
|
|
30
31
|
}),
|
|
31
|
-
[
|
|
32
|
-
type:
|
|
33
|
-
ordered:
|
|
34
|
-
start:
|
|
35
|
-
items:
|
|
32
|
+
[u.List]: (t) => ({
|
|
33
|
+
type: u.List,
|
|
34
|
+
ordered: t.ordered,
|
|
35
|
+
start: t.start,
|
|
36
|
+
items: t.items ? W(t.items) : []
|
|
36
37
|
}),
|
|
37
|
-
[
|
|
38
|
-
type:
|
|
39
|
-
content:
|
|
40
|
-
items:
|
|
38
|
+
[u.ListItem]: (t) => ({
|
|
39
|
+
type: u.ListItem,
|
|
40
|
+
content: t.text,
|
|
41
|
+
items: t.tokens ? W(t.tokens) : []
|
|
41
42
|
}),
|
|
42
|
-
[
|
|
43
|
-
type:
|
|
44
|
-
lang:
|
|
45
|
-
code:
|
|
43
|
+
[u.Code]: (t) => ({
|
|
44
|
+
type: u.Code,
|
|
45
|
+
lang: t.lang,
|
|
46
|
+
code: t.text
|
|
46
47
|
}),
|
|
47
|
-
[
|
|
48
|
-
type:
|
|
49
|
-
header:
|
|
50
|
-
type:
|
|
51
|
-
content:
|
|
48
|
+
[u.Table]: (t) => ({
|
|
49
|
+
type: u.Table,
|
|
50
|
+
header: t.header.map((n) => ({
|
|
51
|
+
type: u.TableHeader,
|
|
52
|
+
content: n.text
|
|
52
53
|
})),
|
|
53
|
-
rows:
|
|
54
|
-
(
|
|
55
|
-
type:
|
|
56
|
-
content:
|
|
54
|
+
rows: t.rows.map(
|
|
55
|
+
(n) => n.map((s) => ({
|
|
56
|
+
type: u.TableCell,
|
|
57
|
+
content: s.text
|
|
57
58
|
}))
|
|
58
59
|
)
|
|
59
60
|
}),
|
|
60
|
-
[
|
|
61
|
-
type:
|
|
62
|
-
src:
|
|
63
|
-
alt:
|
|
61
|
+
[u.Image]: (t) => ({
|
|
62
|
+
type: u.Image,
|
|
63
|
+
src: t.href,
|
|
64
|
+
alt: t.text
|
|
64
65
|
}),
|
|
65
|
-
[
|
|
66
|
-
type:
|
|
67
|
-
href:
|
|
68
|
-
text:
|
|
69
|
-
items:
|
|
66
|
+
[u.Link]: (t) => ({
|
|
67
|
+
type: u.Link,
|
|
68
|
+
href: t.href,
|
|
69
|
+
text: t.text,
|
|
70
|
+
items: t.tokens ? W(t.tokens) : []
|
|
70
71
|
}),
|
|
71
|
-
[
|
|
72
|
-
type:
|
|
73
|
-
content:
|
|
74
|
-
items:
|
|
72
|
+
[u.Strong]: (t) => ({
|
|
73
|
+
type: u.Strong,
|
|
74
|
+
content: t.text,
|
|
75
|
+
items: t.tokens ? W(t.tokens) : []
|
|
75
76
|
}),
|
|
76
|
-
[
|
|
77
|
-
type:
|
|
78
|
-
content:
|
|
79
|
-
items:
|
|
77
|
+
[u.Em]: (t) => ({
|
|
78
|
+
type: u.Em,
|
|
79
|
+
content: t.text,
|
|
80
|
+
items: t.tokens ? W(t.tokens) : []
|
|
80
81
|
}),
|
|
81
|
-
[
|
|
82
|
-
type:
|
|
83
|
-
content:
|
|
84
|
-
items:
|
|
82
|
+
[u.Text]: (t) => ({
|
|
83
|
+
type: u.Text,
|
|
84
|
+
content: t.text,
|
|
85
|
+
items: t.tokens ? W(t.tokens) : []
|
|
85
86
|
}),
|
|
86
|
-
[
|
|
87
|
-
type:
|
|
88
|
-
content:
|
|
89
|
-
items:
|
|
87
|
+
[u.Hr]: (t) => ({
|
|
88
|
+
type: u.Hr,
|
|
89
|
+
content: t.raw,
|
|
90
|
+
items: t.tokens ? W(t.tokens) : []
|
|
90
91
|
}),
|
|
91
|
-
[
|
|
92
|
-
type:
|
|
93
|
-
content:
|
|
94
|
-
items:
|
|
92
|
+
[u.CodeSpan]: (t) => ({
|
|
93
|
+
type: u.CodeSpan,
|
|
94
|
+
content: t.text,
|
|
95
|
+
items: t.tokens ? W(t.tokens) : []
|
|
95
96
|
}),
|
|
96
|
-
[
|
|
97
|
-
type:
|
|
98
|
-
content:
|
|
99
|
-
items:
|
|
97
|
+
[u.Blockquote]: (t) => ({
|
|
98
|
+
type: u.Blockquote,
|
|
99
|
+
content: t.text,
|
|
100
|
+
items: t.tokens ? W(t.tokens) : []
|
|
100
101
|
})
|
|
101
|
-
},
|
|
102
|
-
static initialize(
|
|
103
|
-
this.options_ =
|
|
102
|
+
}, H = class H {
|
|
103
|
+
static initialize(n) {
|
|
104
|
+
this.options_ = n, this.cursor = { x: n.cursor.x, y: n.cursor.y }, this.lastContentY_ = n.cursor.y;
|
|
104
105
|
}
|
|
105
106
|
static getCursor() {
|
|
106
107
|
return this.cursor;
|
|
107
108
|
}
|
|
108
|
-
static setCursor(
|
|
109
|
-
this.cursor =
|
|
109
|
+
static setCursor(n) {
|
|
110
|
+
this.cursor = n;
|
|
110
111
|
}
|
|
111
112
|
static get options() {
|
|
112
113
|
return this.options_;
|
|
@@ -126,8 +127,8 @@ const Ct = async (e) => {
|
|
|
126
127
|
* @param operation 'set' to assign a new value, 'add' to increment the current value.
|
|
127
128
|
* @default operation = 'set'
|
|
128
129
|
*/
|
|
129
|
-
static updateX(
|
|
130
|
-
|
|
130
|
+
static updateX(n, s = "set") {
|
|
131
|
+
s === "set" ? this.cursor.x = n : s === "add" && (this.cursor.x += n);
|
|
131
132
|
}
|
|
132
133
|
/**
|
|
133
134
|
* Updates the y pointer of the cursor.
|
|
@@ -135,8 +136,8 @@ const Ct = async (e) => {
|
|
|
135
136
|
* @param operation 'set' to assign a new value, 'add' to increment the current value.
|
|
136
137
|
* @default operation = 'set'
|
|
137
138
|
*/
|
|
138
|
-
static updateY(
|
|
139
|
-
|
|
139
|
+
static updateY(n, s = "set") {
|
|
140
|
+
s === "set" ? this.cursor.y = n : s === "add" && (this.cursor.y += n);
|
|
140
141
|
}
|
|
141
142
|
/**
|
|
142
143
|
* Records a Y position as the bottom of rendered content.
|
|
@@ -144,8 +145,8 @@ const Ct = async (e) => {
|
|
|
144
145
|
* where their actual text content ends, ignoring any trailing margins.
|
|
145
146
|
* @param specificY Optional Y value to record. Defaults to current cursor Y.
|
|
146
147
|
*/
|
|
147
|
-
static recordContentY(
|
|
148
|
-
this.lastContentY_ =
|
|
148
|
+
static recordContentY(n) {
|
|
149
|
+
this.lastContentY_ = n !== void 0 ? n : this.cursor.y;
|
|
149
150
|
}
|
|
150
151
|
/**
|
|
151
152
|
* Gets the last Y position recorded as content bottom.
|
|
@@ -161,75 +162,75 @@ const Ct = async (e) => {
|
|
|
161
162
|
return this.cursor.y;
|
|
162
163
|
}
|
|
163
164
|
};
|
|
164
|
-
|
|
165
|
-
let
|
|
166
|
-
const
|
|
167
|
-
const
|
|
168
|
-
if (
|
|
169
|
-
for (const
|
|
170
|
-
|
|
165
|
+
H.cursor = { x: 0, y: 0 }, H.lastContentY_ = 0, H.inlineLock = !1;
|
|
166
|
+
let e = H;
|
|
167
|
+
const b = (t) => t.getTextDimensions("H").h * e.options.page.defaultLineHeightFactor, y = (t) => t.getTextDimensions("H").w * e.options.page.defaultLineHeightFactor, q = (t, n, s, g) => {
|
|
168
|
+
const c = 6 - (n?.depth ?? 0) > 0 ? 6 - (n?.depth ?? 0) : 1;
|
|
169
|
+
if (t.setFontSize(e.options.page.defaultFontSize + c), n?.items && n?.items.length > 0)
|
|
170
|
+
for (const l of n?.items ?? [])
|
|
171
|
+
g(l, s, !1);
|
|
171
172
|
else {
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
173
|
+
const l = b(t);
|
|
174
|
+
t.text(
|
|
175
|
+
n?.content ?? "",
|
|
176
|
+
e.X + s,
|
|
177
|
+
e.Y,
|
|
177
178
|
{
|
|
178
179
|
align: "left",
|
|
179
|
-
maxWidth:
|
|
180
|
+
maxWidth: e.options.page.maxContentWidth - s,
|
|
180
181
|
baseline: "top"
|
|
181
182
|
}
|
|
182
|
-
),
|
|
183
|
+
), e.recordContentY(e.Y + l), e.updateY(l, "add");
|
|
183
184
|
}
|
|
184
|
-
|
|
185
|
-
},
|
|
186
|
-
typeof
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
),
|
|
185
|
+
t.setFontSize(e.options.page.defaultFontSize), e.updateX(e.options.page.xpading, "set");
|
|
186
|
+
}, w = (t) => {
|
|
187
|
+
typeof e.options.pageBreakHandler == "function" ? e.options.pageBreakHandler(t) : t.addPage(
|
|
188
|
+
e.options.page?.format,
|
|
189
|
+
e.options.page?.orientation
|
|
190
|
+
), e.updateY(e.options.page.topmargin), e.updateX(e.options.page.xpading);
|
|
190
191
|
};
|
|
191
|
-
class
|
|
192
|
+
class E {
|
|
192
193
|
// Default codespan styling (can be overridden via RenderStore.options.codespan)
|
|
193
194
|
static getCodespanOptions() {
|
|
194
|
-
const
|
|
195
|
+
const n = e.options.codespan ?? {};
|
|
195
196
|
return {
|
|
196
|
-
backgroundColor:
|
|
197
|
-
padding:
|
|
198
|
-
showBackground:
|
|
199
|
-
fontSizeScale:
|
|
197
|
+
backgroundColor: n.backgroundColor ?? "#EEEEEE",
|
|
198
|
+
padding: n.padding ?? 0.5,
|
|
199
|
+
showBackground: n.showBackground !== !1,
|
|
200
|
+
fontSizeScale: n.fontSizeScale ?? 0.9
|
|
200
201
|
};
|
|
201
202
|
}
|
|
202
203
|
/**
|
|
203
204
|
* Apply font style to the jsPDF document.
|
|
204
205
|
*/
|
|
205
|
-
static applyStyle(
|
|
206
|
-
const
|
|
207
|
-
const
|
|
208
|
-
return
|
|
209
|
-
},
|
|
210
|
-
const
|
|
211
|
-
return
|
|
206
|
+
static applyStyle(n, s) {
|
|
207
|
+
const g = n.getFont().fontName, c = n.getFontSize(), l = () => {
|
|
208
|
+
const i = e.options.font.bold?.name;
|
|
209
|
+
return i && i !== "" ? i : g;
|
|
210
|
+
}, r = () => {
|
|
211
|
+
const i = e.options.font.regular?.name;
|
|
212
|
+
return i && i !== "" ? i : g;
|
|
212
213
|
};
|
|
213
|
-
switch (
|
|
214
|
+
switch (s) {
|
|
214
215
|
case "bold":
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
216
|
+
n.setFont(
|
|
217
|
+
l(),
|
|
218
|
+
e.options.font.bold?.style || "bold"
|
|
218
219
|
);
|
|
219
220
|
break;
|
|
220
221
|
case "italic":
|
|
221
|
-
|
|
222
|
+
n.setFont(r(), "italic");
|
|
222
223
|
break;
|
|
223
224
|
case "bolditalic":
|
|
224
|
-
|
|
225
|
+
n.setFont(l(), "bolditalic");
|
|
225
226
|
break;
|
|
226
227
|
case "codespan":
|
|
227
|
-
|
|
228
|
-
|
|
228
|
+
n.setFont("courier", "normal"), n.setFontSize(
|
|
229
|
+
c * this.getCodespanOptions().fontSizeScale
|
|
229
230
|
);
|
|
230
231
|
break;
|
|
231
232
|
default:
|
|
232
|
-
|
|
233
|
+
n.setFont(r(), n.getFont().fontStyle);
|
|
233
234
|
break;
|
|
234
235
|
}
|
|
235
236
|
}
|
|
@@ -238,60 +239,60 @@ class q {
|
|
|
238
239
|
* NOTE: jsPDF's getTextWidth() does NOT include charSpace in its calculation,
|
|
239
240
|
* so we must manually add it: effectiveWidth = getTextWidth(text) + (text.length * charSpace)
|
|
240
241
|
*/
|
|
241
|
-
static measureWordWidth(
|
|
242
|
-
const
|
|
243
|
-
this.applyStyle(
|
|
244
|
-
const
|
|
245
|
-
return
|
|
242
|
+
static measureWordWidth(n, s, g) {
|
|
243
|
+
const c = n.getFont(), l = n.getFontSize();
|
|
244
|
+
this.applyStyle(n, g);
|
|
245
|
+
const r = n.getTextWidth(s), i = n.getCharSpace?.() ?? 0, a = r + s.length * i;
|
|
246
|
+
return n.setFont(c.fontName, c.fontStyle), n.setFontSize(l), a;
|
|
246
247
|
}
|
|
247
248
|
/**
|
|
248
249
|
* Extract style from element type string.
|
|
249
250
|
*/
|
|
250
|
-
static getStyleFromType(
|
|
251
|
-
switch (
|
|
251
|
+
static getStyleFromType(n, s) {
|
|
252
|
+
switch (n) {
|
|
252
253
|
case "strong":
|
|
253
|
-
return
|
|
254
|
+
return s === "italic" ? "bolditalic" : "bold";
|
|
254
255
|
case "em":
|
|
255
|
-
return
|
|
256
|
+
return s === "bold" ? "bolditalic" : "italic";
|
|
256
257
|
case "codespan":
|
|
257
258
|
return "codespan";
|
|
258
259
|
default:
|
|
259
|
-
return
|
|
260
|
+
return s || "normal";
|
|
260
261
|
}
|
|
261
262
|
}
|
|
262
263
|
/**
|
|
263
264
|
* Flatten ParsedElement tree into an array of StyledWordInfo.
|
|
264
265
|
* Handles nested inline elements.
|
|
265
266
|
*/
|
|
266
|
-
static flattenToWords(
|
|
267
|
-
const
|
|
268
|
-
for (const
|
|
269
|
-
const
|
|
270
|
-
if (
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
267
|
+
static flattenToWords(n, s, g = "normal", c = !1, l) {
|
|
268
|
+
const r = [];
|
|
269
|
+
for (const i of s) {
|
|
270
|
+
const a = this.getStyleFromType(i.type, g), h = i.type === "link" || c, p = i.href || l;
|
|
271
|
+
if (i.items && i.items.length > 0) {
|
|
272
|
+
const f = this.flattenToWords(
|
|
273
|
+
n,
|
|
274
|
+
i.items,
|
|
275
|
+
a,
|
|
274
276
|
h,
|
|
275
|
-
|
|
276
|
-
f
|
|
277
|
+
p
|
|
277
278
|
);
|
|
278
|
-
|
|
279
|
+
r.push(...f);
|
|
279
280
|
} else {
|
|
280
|
-
const
|
|
281
|
-
if (!
|
|
282
|
-
if (
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
text:
|
|
281
|
+
const f = i.content || i.text || "";
|
|
282
|
+
if (!f) continue;
|
|
283
|
+
if (a === "codespan") {
|
|
284
|
+
const o = f.trim();
|
|
285
|
+
o && r.push({
|
|
286
|
+
text: o,
|
|
286
287
|
width: this.measureWordWidth(
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
n,
|
|
289
|
+
o,
|
|
290
|
+
a
|
|
290
291
|
),
|
|
291
|
-
style:
|
|
292
|
-
isLink:
|
|
293
|
-
href:
|
|
294
|
-
linkColor:
|
|
292
|
+
style: a,
|
|
293
|
+
isLink: h,
|
|
294
|
+
href: p,
|
|
295
|
+
linkColor: h ? e.options.link?.linkColor || [
|
|
295
296
|
0,
|
|
296
297
|
0,
|
|
297
298
|
255
|
|
@@ -299,93 +300,93 @@ class q {
|
|
|
299
300
|
});
|
|
300
301
|
continue;
|
|
301
302
|
}
|
|
302
|
-
const d =
|
|
303
|
+
const d = f.split(/\s+/).filter((o) => o.length > 0);
|
|
303
304
|
if (d.length === 0)
|
|
304
305
|
continue;
|
|
305
|
-
for (let
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
text:
|
|
309
|
-
width: this.measureWordWidth(
|
|
310
|
-
style:
|
|
311
|
-
isLink:
|
|
312
|
-
href:
|
|
313
|
-
linkColor:
|
|
306
|
+
for (let o = 0; o < d.length; o++) {
|
|
307
|
+
const m = d[o];
|
|
308
|
+
r.push({
|
|
309
|
+
text: m,
|
|
310
|
+
width: this.measureWordWidth(n, m, a),
|
|
311
|
+
style: a,
|
|
312
|
+
isLink: h,
|
|
313
|
+
href: p,
|
|
314
|
+
linkColor: h ? e.options.link?.linkColor || [0, 0, 255] : void 0
|
|
314
315
|
});
|
|
315
316
|
}
|
|
316
317
|
}
|
|
317
318
|
}
|
|
318
|
-
return
|
|
319
|
+
return r;
|
|
319
320
|
}
|
|
320
321
|
/**
|
|
321
322
|
* Break a flat list of words into lines that fit within maxWidth.
|
|
322
323
|
* Correctly tracks totalTextWidth (sum of word widths only) for justification.
|
|
323
324
|
*/
|
|
324
|
-
static breakIntoLines(
|
|
325
|
-
const
|
|
326
|
-
let
|
|
327
|
-
const
|
|
328
|
-
for (let
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
words:
|
|
332
|
-
totalTextWidth:
|
|
325
|
+
static breakIntoLines(n, s, g) {
|
|
326
|
+
const c = [];
|
|
327
|
+
let l = [], r = 0, i = 0;
|
|
328
|
+
const a = n.getTextWidth(" ");
|
|
329
|
+
for (let h = 0; h < s.length; h++) {
|
|
330
|
+
const p = s[h], f = l.length > 0 ? a + p.width : p.width;
|
|
331
|
+
i + f > g && l.length > 0 ? (c.push({
|
|
332
|
+
words: l,
|
|
333
|
+
totalTextWidth: r,
|
|
333
334
|
isLastLine: !1
|
|
334
|
-
}),
|
|
335
|
+
}), l = [p], r = p.width, i = p.width) : (l.push(p), r += p.width, i += f);
|
|
335
336
|
}
|
|
336
|
-
return
|
|
337
|
-
words:
|
|
338
|
-
totalTextWidth:
|
|
337
|
+
return l.length > 0 && c.push({
|
|
338
|
+
words: l,
|
|
339
|
+
totalTextWidth: r,
|
|
339
340
|
isLastLine: !0
|
|
340
|
-
}),
|
|
341
|
+
}), c;
|
|
341
342
|
}
|
|
342
343
|
/**
|
|
343
344
|
* Render a single word with its style applied.
|
|
344
345
|
*/
|
|
345
|
-
static renderWord(
|
|
346
|
-
const
|
|
347
|
-
if (this.applyStyle(
|
|
348
|
-
const
|
|
349
|
-
if (
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
346
|
+
static renderWord(n, s, g, c) {
|
|
347
|
+
const l = n.getFont(), r = n.getFontSize(), i = n.getTextColor();
|
|
348
|
+
if (this.applyStyle(n, s.style), s.isLink && s.linkColor && n.setTextColor(...s.linkColor), s.style === "codespan") {
|
|
349
|
+
const a = this.getCodespanOptions();
|
|
350
|
+
if (a.showBackground) {
|
|
351
|
+
const h = b(n), p = a.padding;
|
|
352
|
+
n.setFillColor(a.backgroundColor), n.rect(
|
|
353
|
+
g - p,
|
|
354
|
+
c - p,
|
|
355
|
+
s.width + p * 2,
|
|
356
|
+
h + p * 2,
|
|
356
357
|
"F"
|
|
357
|
-
),
|
|
358
|
+
), n.setFillColor("#000000");
|
|
358
359
|
}
|
|
359
360
|
}
|
|
360
|
-
if (
|
|
361
|
-
const
|
|
362
|
-
|
|
361
|
+
if (n.text(s.text, g, c, { baseline: "top" }), s.isLink && s.href) {
|
|
362
|
+
const a = b(n) / 2;
|
|
363
|
+
n.link(g, c, s.width, a, { url: s.href });
|
|
363
364
|
}
|
|
364
|
-
|
|
365
|
+
n.setFont(l.fontName, l.fontStyle), n.setFontSize(r), n.setTextColor(i);
|
|
365
366
|
}
|
|
366
367
|
/**
|
|
367
368
|
* Render a single line with specified alignment.
|
|
368
369
|
*/
|
|
369
|
-
static renderAlignedLine(
|
|
370
|
-
const { words:
|
|
371
|
-
if (
|
|
372
|
-
const
|
|
373
|
-
let
|
|
374
|
-
const
|
|
375
|
-
switch (
|
|
370
|
+
static renderAlignedLine(n, s, g, c, l, r = "left") {
|
|
371
|
+
const { words: i, totalTextWidth: a, isLastLine: h } = s;
|
|
372
|
+
if (i.length === 0) return;
|
|
373
|
+
const p = n.getTextWidth(" ");
|
|
374
|
+
let f = g, d = p;
|
|
375
|
+
const o = a + (i.length - 1) * p;
|
|
376
|
+
switch (r) {
|
|
376
377
|
case "right":
|
|
377
|
-
|
|
378
|
+
f = g + l - o;
|
|
378
379
|
break;
|
|
379
380
|
case "center":
|
|
380
|
-
|
|
381
|
+
f = g + (l - o) / 2;
|
|
381
382
|
break;
|
|
382
383
|
case "justify":
|
|
383
|
-
!
|
|
384
|
+
!h && i.length > 1 && (d = (l - a) / (i.length - 1));
|
|
384
385
|
break;
|
|
385
386
|
}
|
|
386
|
-
let
|
|
387
|
-
for (let
|
|
388
|
-
this.renderWord(
|
|
387
|
+
let m = f;
|
|
388
|
+
for (let x = 0; x < i.length; x++)
|
|
389
|
+
this.renderWord(n, i[x], m, c), m += i[x].width, x < i.length - 1 && (m += d);
|
|
389
390
|
}
|
|
390
391
|
/**
|
|
391
392
|
* Main entry point: Render a paragraph with mixed inline elements.
|
|
@@ -398,34 +399,34 @@ class q {
|
|
|
398
399
|
* @param maxWidth Maximum width for text wrapping
|
|
399
400
|
* @param alignment Optional alignment override (defaults to RenderStore option)
|
|
400
401
|
*/
|
|
401
|
-
static renderStyledParagraph(
|
|
402
|
-
const
|
|
403
|
-
if (
|
|
404
|
-
const
|
|
405
|
-
let
|
|
406
|
-
for (const
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
),
|
|
415
|
-
const d =
|
|
402
|
+
static renderStyledParagraph(n, s, g, c, l, r) {
|
|
403
|
+
const i = r ?? e.options.content?.textAlignment ?? "left", a = this.flattenToWords(n, s);
|
|
404
|
+
if (a.length === 0) return;
|
|
405
|
+
const h = this.breakIntoLines(n, a, l), p = b(n) * e.options.page.defaultLineHeightFactor;
|
|
406
|
+
let f = c;
|
|
407
|
+
for (const o of h)
|
|
408
|
+
f + p > e.options.page.maxContentHeight && (w(n), f = e.Y), this.renderAlignedLine(
|
|
409
|
+
n,
|
|
410
|
+
o,
|
|
411
|
+
g,
|
|
412
|
+
f,
|
|
413
|
+
l,
|
|
414
|
+
i
|
|
415
|
+
), e.recordContentY(f + b(n)), f += p, e.updateY(p, "add");
|
|
416
|
+
const d = h[h.length - 1];
|
|
416
417
|
if (d) {
|
|
417
|
-
const
|
|
418
|
-
|
|
418
|
+
const o = d.totalTextWidth + (d.words.length - 1) * n.getTextWidth(" ");
|
|
419
|
+
e.updateX(g + o, "set");
|
|
419
420
|
}
|
|
420
421
|
}
|
|
421
422
|
/**
|
|
422
423
|
* @deprecated Use renderStyledParagraph instead
|
|
423
424
|
*/
|
|
424
|
-
static renderJustifiedParagraph(
|
|
425
|
-
this.renderStyledParagraph(
|
|
425
|
+
static renderJustifiedParagraph(n, s, g, c, l) {
|
|
426
|
+
this.renderStyledParagraph(n, s, g, c, l);
|
|
426
427
|
}
|
|
427
428
|
}
|
|
428
|
-
class
|
|
429
|
+
class X {
|
|
429
430
|
/**
|
|
430
431
|
* Renders text with automatic line wrapping and page breaking.
|
|
431
432
|
* @param doc jsPDF instance
|
|
@@ -435,228 +436,228 @@ class Y {
|
|
|
435
436
|
* @param maxWidth Max width for text wrapping
|
|
436
437
|
* @param justify Whether to justify the text
|
|
437
438
|
*/
|
|
438
|
-
static renderText(
|
|
439
|
-
const
|
|
440
|
-
let
|
|
441
|
-
for (let
|
|
442
|
-
const d =
|
|
443
|
-
|
|
444
|
-
maxWidth:
|
|
439
|
+
static renderText(n, s, g = e.X, c = e.Y, l, r = !1) {
|
|
440
|
+
const i = n.splitTextToSize(s, l), a = b(n), h = a * e.options.page.defaultLineHeightFactor;
|
|
441
|
+
let p = c;
|
|
442
|
+
for (let f = 0; f < i.length; f++) {
|
|
443
|
+
const d = i[f];
|
|
444
|
+
p + h > e.options.page.maxContentHeight && (w(n), p = e.Y), r ? f === i.length - 1 ? n.text(d, g, p, { baseline: "top" }) : n.text(d, g, p, {
|
|
445
|
+
maxWidth: l,
|
|
445
446
|
align: "justify",
|
|
446
447
|
baseline: "top"
|
|
447
|
-
}) :
|
|
448
|
+
}) : n.text(d, g, p, { baseline: "top" }), e.recordContentY(p + a), p += h, e.updateY(h, "add");
|
|
448
449
|
}
|
|
449
|
-
return
|
|
450
|
+
return p;
|
|
450
451
|
}
|
|
451
452
|
}
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
const
|
|
455
|
-
if (
|
|
456
|
-
if (
|
|
457
|
-
(
|
|
458
|
-
|
|
453
|
+
const _ = (t, n, s, g) => {
|
|
454
|
+
e.activateInlineLock(), t.setFontSize(e.options.page.defaultFontSize);
|
|
455
|
+
const c = e.options.page.maxContentWidth - s;
|
|
456
|
+
if (n?.items && n?.items.length > 0)
|
|
457
|
+
if (n.items.some(
|
|
458
|
+
(r) => !["strong", "em", "text", "codespan", "link"].includes(
|
|
459
|
+
r.type
|
|
459
460
|
)
|
|
460
461
|
)) {
|
|
461
|
-
const
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
),
|
|
462
|
+
const r = [], i = () => {
|
|
463
|
+
r.length > 0 && (E.renderStyledParagraph(
|
|
464
|
+
t,
|
|
465
|
+
r,
|
|
466
|
+
e.X + s,
|
|
467
|
+
e.Y,
|
|
468
|
+
c
|
|
469
|
+
), r.length = 0);
|
|
469
470
|
};
|
|
470
|
-
for (const
|
|
471
|
+
for (const a of n.items)
|
|
471
472
|
["strong", "em", "text", "codespan", "link"].includes(
|
|
472
|
-
|
|
473
|
-
) ?
|
|
474
|
-
|
|
473
|
+
a.type
|
|
474
|
+
) ? r.push(a) : (i(), g(a, s, !1));
|
|
475
|
+
i();
|
|
475
476
|
} else
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
477
|
+
E.renderStyledParagraph(
|
|
478
|
+
t,
|
|
479
|
+
n.items,
|
|
480
|
+
e.X + s,
|
|
481
|
+
e.Y,
|
|
482
|
+
c
|
|
482
483
|
);
|
|
483
484
|
else {
|
|
484
|
-
const
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
485
|
+
const l = n.content ?? "", r = e.options.content?.textAlignment ?? "left";
|
|
486
|
+
l.trim() && X.renderText(
|
|
487
|
+
t,
|
|
488
|
+
l,
|
|
489
|
+
e.X + s,
|
|
490
|
+
e.Y,
|
|
491
|
+
c,
|
|
492
|
+
r === "justify"
|
|
492
493
|
);
|
|
493
494
|
}
|
|
494
|
-
|
|
495
|
-
},
|
|
496
|
-
|
|
497
|
-
for (const [
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
a,
|
|
501
|
-
n + 1,
|
|
502
|
-
!0,
|
|
495
|
+
e.updateX(e.options.page.xpading), e.deactivateInlineLock();
|
|
496
|
+
}, $ = (t, n, s, g) => {
|
|
497
|
+
t.setFontSize(e.options.page.defaultFontSize);
|
|
498
|
+
for (const [c, l] of n?.items?.entries() ?? []) {
|
|
499
|
+
const r = n.ordered ? (n.start ?? 0) + c : n.start;
|
|
500
|
+
g(
|
|
503
501
|
l,
|
|
504
|
-
|
|
502
|
+
s + 1,
|
|
503
|
+
!0,
|
|
504
|
+
r,
|
|
505
|
+
n.ordered
|
|
505
506
|
);
|
|
506
507
|
}
|
|
507
|
-
},
|
|
508
|
-
|
|
509
|
-
const
|
|
510
|
-
|
|
511
|
-
const
|
|
512
|
-
if (
|
|
513
|
-
const
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
508
|
+
}, J = (t, n, s, g, c, l) => {
|
|
509
|
+
e.Y + b(t) >= e.options.page.maxContentHeight && w(t);
|
|
510
|
+
const r = e.options, i = s * r.page.indent, a = l ? `${c}. ` : "• ", h = r.page.xpading;
|
|
511
|
+
e.updateX(h, "set"), t.setFont(r.font.regular.name, r.font.regular.style), t.text(a, h + i, e.Y, { baseline: "top" });
|
|
512
|
+
const p = t.getTextWidth(a), f = h + i + p, d = r.page.maxContentWidth - i - p;
|
|
513
|
+
if (n.items && n.items.length > 0) {
|
|
514
|
+
const o = [], m = () => {
|
|
515
|
+
o.length > 0 && (E.renderStyledParagraph(
|
|
516
|
+
t,
|
|
517
|
+
o,
|
|
518
|
+
f,
|
|
519
|
+
e.Y,
|
|
519
520
|
d
|
|
520
|
-
),
|
|
521
|
+
), o.length = 0, e.updateX(h, "set"));
|
|
521
522
|
};
|
|
522
|
-
for (const
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
523
|
+
for (const x of n.items)
|
|
524
|
+
x.type === u.List ? (m(), g(
|
|
525
|
+
x,
|
|
526
|
+
s,
|
|
526
527
|
!0,
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
)) :
|
|
530
|
-
|
|
531
|
-
|
|
528
|
+
c,
|
|
529
|
+
x.ordered ?? !1
|
|
530
|
+
)) : x.type === u.ListItem ? (m(), g(
|
|
531
|
+
x,
|
|
532
|
+
s,
|
|
532
533
|
!0,
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
)) :
|
|
536
|
-
|
|
537
|
-
} else if (
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
534
|
+
c,
|
|
535
|
+
l
|
|
536
|
+
)) : o.push(x);
|
|
537
|
+
m();
|
|
538
|
+
} else if (n.content) {
|
|
539
|
+
const o = r.content?.textAlignment ?? "left";
|
|
540
|
+
X.renderText(
|
|
541
|
+
t,
|
|
542
|
+
n.content,
|
|
543
|
+
f,
|
|
544
|
+
e.Y,
|
|
544
545
|
d,
|
|
545
|
-
|
|
546
|
+
o === "justify"
|
|
546
547
|
);
|
|
547
548
|
}
|
|
548
|
-
},
|
|
549
|
-
if (
|
|
550
|
-
for (const
|
|
551
|
-
|
|
552
|
-
h,
|
|
553
|
-
n,
|
|
554
|
-
i,
|
|
549
|
+
}, G = (t, n, s, g, c, l, r, i = !0) => {
|
|
550
|
+
if (n?.items && n?.items.length > 0)
|
|
551
|
+
for (const a of n?.items ?? [])
|
|
552
|
+
c(
|
|
555
553
|
a,
|
|
554
|
+
s,
|
|
555
|
+
g,
|
|
556
556
|
l,
|
|
557
|
-
|
|
557
|
+
r,
|
|
558
|
+
i
|
|
558
559
|
);
|
|
559
560
|
else {
|
|
560
|
-
const
|
|
561
|
-
if (!
|
|
562
|
-
if (!
|
|
563
|
-
const
|
|
564
|
-
if (
|
|
565
|
-
const
|
|
566
|
-
|
|
561
|
+
const a = e.options, h = s * a.page.indent, p = g ? r ? `${l}. ` : "• " : "", f = n.content || "", d = a.page.xpading;
|
|
562
|
+
if (!f && !p) return;
|
|
563
|
+
if (!f.trim() && !p) {
|
|
564
|
+
const o = (f.match(/\n/g) || []).length;
|
|
565
|
+
if (o > 1) {
|
|
566
|
+
const m = o - 1, x = t.getTextDimensions("A").h * a.page.defaultLineHeightFactor, C = m * x;
|
|
567
|
+
e.Y + C > a.page.maxContentHeight ? w(t) : (e.updateY(C, "add"), e.recordContentY(e.Y));
|
|
567
568
|
}
|
|
568
569
|
return;
|
|
569
570
|
}
|
|
570
|
-
if (
|
|
571
|
-
const
|
|
572
|
-
|
|
571
|
+
if (e.updateX(d, "set"), g && p) {
|
|
572
|
+
const o = t.getTextWidth(p), m = a.page.maxContentWidth - h - o;
|
|
573
|
+
t.setFont(a.font.regular.name, a.font.regular.style), t.text(p, d + h, e.Y, {
|
|
573
574
|
baseline: "top"
|
|
574
|
-
}),
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
d +
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
575
|
+
}), X.renderText(
|
|
576
|
+
t,
|
|
577
|
+
f,
|
|
578
|
+
d + h + o,
|
|
579
|
+
e.Y,
|
|
580
|
+
m,
|
|
581
|
+
i
|
|
581
582
|
);
|
|
582
583
|
} else {
|
|
583
|
-
const
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
d +
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
584
|
+
const o = a.page.maxContentWidth - h;
|
|
585
|
+
X.renderText(
|
|
586
|
+
t,
|
|
587
|
+
f,
|
|
588
|
+
d + h,
|
|
589
|
+
e.Y,
|
|
590
|
+
o,
|
|
591
|
+
i
|
|
591
592
|
);
|
|
592
593
|
}
|
|
593
|
-
|
|
594
|
+
e.updateX(d, "set");
|
|
594
595
|
}
|
|
595
|
-
},
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
),
|
|
603
|
-
},
|
|
604
|
-
const
|
|
605
|
-
|
|
606
|
-
const
|
|
607
|
-
|
|
608
|
-
const
|
|
596
|
+
}, U = (t) => {
|
|
597
|
+
const n = t.internal.pageSize.getWidth();
|
|
598
|
+
t.setLineDashPattern([1, 1], 0), t.setLineWidth(0.1), t.line(
|
|
599
|
+
e.options.page.xpading,
|
|
600
|
+
e.Y,
|
|
601
|
+
n - e.options.page.xpading,
|
|
602
|
+
e.Y
|
|
603
|
+
), t.setLineWidth(0.1), t.setLineDashPattern([], 0), e.updateY(b(t), "add");
|
|
604
|
+
}, K = (t, n, s, g) => {
|
|
605
|
+
const c = t.getFont(), l = t.getFontSize();
|
|
606
|
+
t.setFont("courier", "normal");
|
|
607
|
+
const r = e.options.page.defaultFontSize * 0.9;
|
|
608
|
+
t.setFontSize(r);
|
|
609
|
+
const i = s * e.options.page.indent, a = e.options.page.maxContentWidth - i - 8, h = t.getLineHeightFactor(), p = r / t.internal.scaleFactor * h, d = (n.code ?? "").replace(/[\r\n\s]+$/, "");
|
|
609
610
|
if (!d) {
|
|
610
|
-
|
|
611
|
+
t.setFont(c.fontName, c.fontStyle), t.setFontSize(l);
|
|
611
612
|
return;
|
|
612
613
|
}
|
|
613
|
-
const
|
|
614
|
-
for (;
|
|
615
|
-
|
|
616
|
-
if (
|
|
617
|
-
|
|
614
|
+
const o = t.splitTextToSize(d, a);
|
|
615
|
+
for (; o.length > 0 && o[o.length - 1].trim() === ""; )
|
|
616
|
+
o.pop();
|
|
617
|
+
if (o.length === 0) {
|
|
618
|
+
t.setFont(c.fontName, c.fontStyle), t.setFontSize(l);
|
|
618
619
|
return;
|
|
619
620
|
}
|
|
620
|
-
const
|
|
621
|
-
let
|
|
622
|
-
for (;
|
|
623
|
-
const
|
|
624
|
-
let
|
|
625
|
-
if (
|
|
626
|
-
|
|
621
|
+
const m = 4, x = "#EEEEEE", C = "#DDDDDD";
|
|
622
|
+
let F = 0;
|
|
623
|
+
for (; F < o.length; ) {
|
|
624
|
+
const k = e.options.page.maxContentHeight - e.Y, S = o.length - F, L = k - m * 2;
|
|
625
|
+
let Y = Math.floor(L / p);
|
|
626
|
+
if (Y <= 0) {
|
|
627
|
+
w(t);
|
|
627
628
|
continue;
|
|
628
629
|
}
|
|
629
|
-
|
|
630
|
-
const
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
),
|
|
634
|
-
if (
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
630
|
+
Y > S && (Y = S);
|
|
631
|
+
const N = o.slice(
|
|
632
|
+
F,
|
|
633
|
+
F + Y
|
|
634
|
+
), T = F === 0, z = F + Y >= o.length, P = Y * p;
|
|
635
|
+
if (T && e.updateY(m, "add"), t.setFillColor(x), t.setDrawColor(C), t.roundedRect(
|
|
636
|
+
e.X,
|
|
637
|
+
e.Y - m,
|
|
638
|
+
e.options.page.maxContentWidth,
|
|
639
|
+
P + (T ? m : 0) + (z ? m : 0),
|
|
639
640
|
2,
|
|
640
641
|
2,
|
|
641
642
|
"FD"
|
|
642
|
-
),
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
643
|
+
), T && n.lang) {
|
|
644
|
+
const I = t.getFontSize();
|
|
645
|
+
t.setFontSize(10), t.setTextColor("#666666"), t.text(
|
|
646
|
+
n.lang,
|
|
647
|
+
e.X + e.options.page.maxContentWidth - t.getTextWidth(n.lang) - 4,
|
|
648
|
+
e.Y,
|
|
648
649
|
{ baseline: "top" }
|
|
649
|
-
),
|
|
650
|
+
), t.setFontSize(I), t.setTextColor("#000000");
|
|
650
651
|
}
|
|
651
|
-
let
|
|
652
|
-
for (const
|
|
653
|
-
|
|
654
|
-
|
|
652
|
+
let D = e.Y;
|
|
653
|
+
for (const I of N)
|
|
654
|
+
t.text(I, e.X + 4, D, { baseline: "top" }), D += p;
|
|
655
|
+
e.updateY(P, "add"), e.recordContentY(e.Y + (z ? m : 0)), z && e.updateY(m, "add"), F += Y, F < o.length && w(t);
|
|
655
656
|
}
|
|
656
|
-
|
|
657
|
-
},
|
|
658
|
-
const
|
|
659
|
-
switch (
|
|
657
|
+
t.setFont(c.fontName, c.fontStyle), t.setFontSize(l);
|
|
658
|
+
}, Q = (t, n, s) => {
|
|
659
|
+
const g = t.getFont().fontName, c = t.getFont().fontStyle, l = t.getFontSize(), r = (a) => {
|
|
660
|
+
switch (a) {
|
|
660
661
|
case "normal":
|
|
661
662
|
return 0;
|
|
662
663
|
case "bold":
|
|
@@ -670,1363 +671,298 @@ const Wt = (e, t, n, i) => {
|
|
|
670
671
|
default:
|
|
671
672
|
return 0;
|
|
672
673
|
}
|
|
673
|
-
},
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
) :
|
|
678
|
-
|
|
674
|
+
}, i = (a, h) => {
|
|
675
|
+
h === "bold" ? t.setFont(
|
|
676
|
+
e.options.font.bold.name && e.options.font.bold.name !== "" ? e.options.font.bold.name : g,
|
|
677
|
+
e.options.font.bold.style || "bold"
|
|
678
|
+
) : h === "italic" ? t.setFont(e.options.font.regular.name, "italic") : h === "bolditalic" ? t.setFont(
|
|
679
|
+
e.options.font.bold.name && e.options.font.bold.name !== "" ? e.options.font.bold.name : g,
|
|
679
680
|
"bolditalic"
|
|
680
|
-
) :
|
|
681
|
-
|
|
682
|
-
|
|
681
|
+
) : h === "codespan" ? (t.setFont("courier", "normal"), t.setFontSize(l * 0.9)) : t.setFont(
|
|
682
|
+
e.options.font.regular.name,
|
|
683
|
+
c
|
|
683
684
|
);
|
|
684
|
-
const
|
|
685
|
-
if (
|
|
686
|
-
for (let
|
|
685
|
+
const p = e.options.page.maxContentWidth - s - e.X, f = t.splitTextToSize(a, p), d = h === "codespan", o = 1, m = "#EEEEEE";
|
|
686
|
+
if (e.isInlineLockActive)
|
|
687
|
+
for (let x = 0; x < f.length; x++) {
|
|
687
688
|
if (d) {
|
|
688
|
-
const
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
689
|
+
const C = t.getTextWidth(f[x]) + y(t), F = b(t);
|
|
690
|
+
t.setFillColor(m), t.roundedRect(
|
|
691
|
+
e.X + s - o,
|
|
692
|
+
e.Y - o,
|
|
693
|
+
C + o * 2,
|
|
694
|
+
F + o * 2,
|
|
694
695
|
2,
|
|
695
696
|
2,
|
|
696
697
|
"F"
|
|
697
|
-
),
|
|
698
|
+
), t.setFillColor("#000000");
|
|
698
699
|
}
|
|
699
|
-
|
|
700
|
+
t.text(f[x], e.X + s, e.Y, {
|
|
700
701
|
baseline: "top",
|
|
701
|
-
maxWidth:
|
|
702
|
-
}),
|
|
703
|
-
|
|
702
|
+
maxWidth: p
|
|
703
|
+
}), e.updateX(
|
|
704
|
+
t.getTextDimensions(f[x]).w + (d ? o * 2 : 1),
|
|
704
705
|
"add"
|
|
705
|
-
),
|
|
706
|
-
|
|
706
|
+
), x < f.length - 1 && (e.updateY(b(t), "add"), e.updateX(
|
|
707
|
+
e.options.page.xpading,
|
|
707
708
|
"set"
|
|
708
709
|
));
|
|
709
710
|
}
|
|
710
|
-
else if (
|
|
711
|
-
const
|
|
711
|
+
else if (f.length > 1) {
|
|
712
|
+
const x = f[0], C = f?.slice(1)?.join(" ");
|
|
712
713
|
if (d) {
|
|
713
|
-
const S =
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
S +
|
|
718
|
-
|
|
714
|
+
const S = t.getTextWidth(x) + y(t), L = b(t);
|
|
715
|
+
t.setFillColor(m), t.roundedRect(
|
|
716
|
+
e.X + (s >= 2 ? s + 2 : 0) - o,
|
|
717
|
+
e.Y - o,
|
|
718
|
+
S + o * 2,
|
|
719
|
+
L + o * 2,
|
|
719
720
|
2,
|
|
720
721
|
2,
|
|
721
722
|
"F"
|
|
722
|
-
),
|
|
723
|
+
), t.setFillColor("#000000");
|
|
723
724
|
}
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
725
|
+
t.text(
|
|
726
|
+
x,
|
|
727
|
+
e.X + (s >= 2 ? s + 2 * r(h) : 0),
|
|
728
|
+
e.Y,
|
|
728
729
|
{
|
|
729
730
|
baseline: "top",
|
|
730
|
-
maxWidth:
|
|
731
|
+
maxWidth: p
|
|
731
732
|
}
|
|
732
|
-
),
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
733
|
+
), e.updateX(e.options.page.xpading + s), e.updateY(b(t), "add");
|
|
734
|
+
const F = e.options.page.maxContentWidth - s - e.options.page.xpading;
|
|
735
|
+
t.splitTextToSize(
|
|
736
|
+
C,
|
|
737
|
+
F
|
|
737
738
|
).forEach((S) => {
|
|
738
739
|
if (d) {
|
|
739
|
-
const
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
740
|
+
const L = t.getTextWidth(S) + y(t), Y = b(t);
|
|
741
|
+
t.setFillColor(m), t.roundedRect(
|
|
742
|
+
e.X + y(t) - o,
|
|
743
|
+
e.Y - o,
|
|
744
|
+
L + o * 2,
|
|
745
|
+
Y + o * 2,
|
|
745
746
|
2,
|
|
746
747
|
2,
|
|
747
748
|
"F"
|
|
748
|
-
),
|
|
749
|
+
), t.setFillColor("#000000");
|
|
749
750
|
}
|
|
750
|
-
|
|
751
|
+
t.text(
|
|
751
752
|
S,
|
|
752
|
-
|
|
753
|
-
|
|
753
|
+
e.X + y(t),
|
|
754
|
+
e.Y,
|
|
754
755
|
{
|
|
755
756
|
baseline: "top",
|
|
756
|
-
maxWidth:
|
|
757
|
+
maxWidth: F
|
|
757
758
|
}
|
|
758
759
|
);
|
|
759
760
|
});
|
|
760
761
|
} else {
|
|
761
762
|
if (d) {
|
|
762
|
-
const
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
763
|
+
const x = t.getTextWidth(a) + y(t), C = b(t);
|
|
764
|
+
t.setFillColor(m), t.roundedRect(
|
|
765
|
+
e.X + s - o,
|
|
766
|
+
e.Y - o,
|
|
767
|
+
x + o * 2,
|
|
768
|
+
C + o * 2,
|
|
768
769
|
2,
|
|
769
770
|
2,
|
|
770
771
|
"F"
|
|
771
|
-
),
|
|
772
|
+
), t.setFillColor("#000000");
|
|
772
773
|
}
|
|
773
|
-
|
|
774
|
+
t.text(a, e.X + s, e.Y, {
|
|
774
775
|
baseline: "top",
|
|
775
|
-
maxWidth:
|
|
776
|
-
}),
|
|
777
|
-
|
|
776
|
+
maxWidth: p
|
|
777
|
+
}), e.updateX(
|
|
778
|
+
t.getTextDimensions(a).w + (s >= 2 ? a.split(" ").length + 2 : 2) * r(h) * 0.5 + (d ? o * 2 : 0),
|
|
778
779
|
"add"
|
|
779
780
|
);
|
|
780
781
|
}
|
|
781
782
|
};
|
|
782
|
-
if (
|
|
783
|
-
for (const
|
|
784
|
-
if (
|
|
785
|
-
|
|
786
|
-
else if (
|
|
787
|
-
const
|
|
788
|
-
if (
|
|
789
|
-
for (const
|
|
790
|
-
|
|
791
|
-
|
|
783
|
+
if (n.type === "text" && n.items && n.items.length > 0)
|
|
784
|
+
for (const a of n.items)
|
|
785
|
+
if (a.type === "codespan")
|
|
786
|
+
i(a.content || "", "codespan");
|
|
787
|
+
else if (a.type === "em" || a.type === "strong") {
|
|
788
|
+
const h = a.type === "em" ? "italic" : "bold";
|
|
789
|
+
if (a.items && a.items.length > 0)
|
|
790
|
+
for (const p of a.items)
|
|
791
|
+
p.type === "strong" && h === "italic" || p.type === "em" && h === "bold" ? i(
|
|
792
|
+
p.content || "",
|
|
792
793
|
"bolditalic"
|
|
793
|
-
) :
|
|
794
|
-
|
|
795
|
-
|
|
794
|
+
) : i(
|
|
795
|
+
p.content || "",
|
|
796
|
+
h
|
|
796
797
|
);
|
|
797
798
|
else
|
|
798
|
-
|
|
799
|
+
i(a.content || "", h);
|
|
799
800
|
} else
|
|
800
|
-
|
|
801
|
-
else
|
|
802
|
-
|
|
803
|
-
},
|
|
804
|
-
const
|
|
805
|
-
|
|
806
|
-
const
|
|
807
|
-
if (
|
|
808
|
-
for (let d = 0; d <
|
|
809
|
-
const
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
{ url:
|
|
816
|
-
),
|
|
801
|
+
i(a.content || "", "normal");
|
|
802
|
+
else n.type === "em" ? i(n.content || "", "italic") : n.type === "strong" ? i(n.content || "", "bold") : n.type === "codespan" ? i(n.content || "", "codespan") : i(n.content || "", "normal");
|
|
803
|
+
t.setFont(g, c), t.setFontSize(l);
|
|
804
|
+
}, V = (t, n, s) => {
|
|
805
|
+
const g = t.getFont().fontName, c = t.getFont().fontStyle, l = t.getFontSize(), r = t.getTextColor(), i = e.options.link?.linkColor || [0, 0, 255];
|
|
806
|
+
t.setTextColor(...i);
|
|
807
|
+
const a = e.options.page.maxContentWidth - s - e.X, h = n.text || n.content || "", p = n.href || "", f = t.splitTextToSize(h, a);
|
|
808
|
+
if (e.isInlineLockActive)
|
|
809
|
+
for (let d = 0; d < f.length; d++) {
|
|
810
|
+
const o = t.getTextDimensions(f[d]).w, m = b(t) / 2;
|
|
811
|
+
t.link(
|
|
812
|
+
e.X + s,
|
|
813
|
+
e.Y,
|
|
814
|
+
o,
|
|
815
|
+
m,
|
|
816
|
+
{ url: p }
|
|
817
|
+
), t.text(f[d], e.X + s, e.Y, {
|
|
817
818
|
baseline: "top",
|
|
818
|
-
maxWidth:
|
|
819
|
-
}),
|
|
820
|
-
|
|
819
|
+
maxWidth: a
|
|
820
|
+
}), e.updateX(o + 1, "add"), e.X + o > e.options.page.maxContentWidth - s && (e.updateY(m, "add"), e.updateX(
|
|
821
|
+
e.options.page.xpading + s,
|
|
821
822
|
"set"
|
|
822
|
-
)), d <
|
|
823
|
-
|
|
823
|
+
)), d < f.length - 1 && (e.updateY(m, "add"), e.updateX(
|
|
824
|
+
e.options.page.xpading + s,
|
|
824
825
|
"set"
|
|
825
826
|
));
|
|
826
827
|
}
|
|
827
|
-
else if (
|
|
828
|
-
const d =
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
{ url:
|
|
835
|
-
),
|
|
828
|
+
else if (f.length > 1) {
|
|
829
|
+
const d = f[0], o = f?.slice(1)?.join(" "), m = t.getTextDimensions(d).w, x = b(t) / 2;
|
|
830
|
+
t.link(
|
|
831
|
+
e.X + s,
|
|
832
|
+
e.Y,
|
|
833
|
+
m,
|
|
834
|
+
x,
|
|
835
|
+
{ url: p }
|
|
836
|
+
), t.text(d, e.X + s, e.Y, {
|
|
836
837
|
baseline: "top",
|
|
837
|
-
maxWidth:
|
|
838
|
-
}),
|
|
839
|
-
const
|
|
840
|
-
|
|
841
|
-
const S =
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
838
|
+
maxWidth: a
|
|
839
|
+
}), e.updateX(e.options.page.xpading + s), e.updateY(x, "add");
|
|
840
|
+
const C = e.options.page.maxContentWidth - s - e.options.page.xpading;
|
|
841
|
+
t.splitTextToSize(o, C).forEach((k) => {
|
|
842
|
+
const S = t.getTextDimensions(k).w;
|
|
843
|
+
t.link(
|
|
844
|
+
e.X + y(t),
|
|
845
|
+
e.Y,
|
|
845
846
|
S,
|
|
846
|
-
|
|
847
|
-
{ url:
|
|
848
|
-
),
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
847
|
+
x,
|
|
848
|
+
{ url: p }
|
|
849
|
+
), t.text(
|
|
850
|
+
k,
|
|
851
|
+
e.X + y(t),
|
|
852
|
+
e.Y,
|
|
852
853
|
{
|
|
853
854
|
baseline: "top",
|
|
854
|
-
maxWidth:
|
|
855
|
+
maxWidth: C
|
|
855
856
|
}
|
|
856
857
|
);
|
|
857
858
|
});
|
|
858
859
|
} else {
|
|
859
|
-
const d =
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
860
|
+
const d = t.getTextDimensions(h).w, o = b(t) / 2;
|
|
861
|
+
t.link(
|
|
862
|
+
e.X + s,
|
|
863
|
+
e.Y,
|
|
863
864
|
d,
|
|
864
|
-
|
|
865
|
-
{ url:
|
|
866
|
-
),
|
|
865
|
+
o,
|
|
866
|
+
{ url: p }
|
|
867
|
+
), t.text(h, e.X + s, e.Y, {
|
|
867
868
|
baseline: "top",
|
|
868
|
-
maxWidth:
|
|
869
|
-
}),
|
|
869
|
+
maxWidth: a
|
|
870
|
+
}), e.updateX(d + 2, "add");
|
|
870
871
|
}
|
|
871
|
-
|
|
872
|
-
},
|
|
873
|
-
const
|
|
874
|
-
|
|
875
|
-
|
|
872
|
+
t.setFont(g, c), t.setFontSize(l), t.setTextColor(r);
|
|
873
|
+
}, Z = (t, n, s, g) => {
|
|
874
|
+
const c = e.options, l = s + 1, r = e.X + s * c.page.indent, i = e.Y, a = r + c.page.indent / 2, h = i, p = t.internal.getCurrentPageInfo().pageNumber;
|
|
875
|
+
n.items && n.items.length > 0 && n.items.forEach((o) => {
|
|
876
|
+
g(o, l);
|
|
876
877
|
});
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
for (let
|
|
880
|
-
|
|
881
|
-
const
|
|
882
|
-
|
|
878
|
+
const f = e.Y, d = t.internal.getCurrentPageInfo().pageNumber;
|
|
879
|
+
t.setDrawColor(100), t.setLineWidth(1);
|
|
880
|
+
for (let o = p; o <= d; o++) {
|
|
881
|
+
t.setPage(o);
|
|
882
|
+
const m = o === p, x = o === d, C = m ? h : c.page.topmargin, F = x ? f : c.page.maxContentHeight;
|
|
883
|
+
t.line(a, C, a, F);
|
|
883
884
|
}
|
|
884
|
-
|
|
885
|
-
},
|
|
886
|
-
if (!
|
|
885
|
+
e.recordContentY(), t.setPage(d);
|
|
886
|
+
}, M = (t, n, s) => {
|
|
887
|
+
if (!n.data)
|
|
887
888
|
return;
|
|
888
|
-
const
|
|
889
|
-
let
|
|
890
|
-
const
|
|
889
|
+
const g = e.options, c = e.X + s * g.page.indent;
|
|
890
|
+
let l = e.Y;
|
|
891
|
+
const r = g.page.maxContentWidth - s * g.page.indent;
|
|
891
892
|
try {
|
|
892
|
-
const
|
|
893
|
-
let
|
|
894
|
-
const d =
|
|
895
|
-
|
|
896
|
-
let
|
|
897
|
-
|
|
898
|
-
|
|
893
|
+
const i = t.getImageProperties(n.data), a = i.width, h = i.height;
|
|
894
|
+
let p = a, f = h;
|
|
895
|
+
const d = a / h;
|
|
896
|
+
p > 0 && (p = r, f = p / d), l + f > g.page.maxContentHeight && (t.addPage(), l = g.page.topmargin, e.updateY(l));
|
|
897
|
+
let o = n.src?.split(".").pop()?.toUpperCase() || "JPEG";
|
|
898
|
+
n.data.startsWith("data:image/png") ? o = "PNG" : n.data.startsWith("data:image/jpeg") || n.data.startsWith("data:image/jpg") ? o = "JPEG" : n.data.startsWith("data:image/webp") && (o = "WEBP"), t.addImage(
|
|
899
|
+
n.data,
|
|
900
|
+
o,
|
|
901
|
+
c,
|
|
902
|
+
l,
|
|
899
903
|
p,
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
), g.updateY(u, "add"), g.recordContentY();
|
|
905
|
-
} catch (o) {
|
|
906
|
-
console.warn("Failed to render image", o);
|
|
907
|
-
}
|
|
908
|
-
};
|
|
909
|
-
function rt(e, t, n, i, r) {
|
|
910
|
-
i = i || {};
|
|
911
|
-
var a = 1.15, l = r.internal.scaleFactor, o = r.internal.getFontSize() / l, h = r.getLineHeightFactor ? r.getLineHeightFactor() : a, s = o * h, f = /\r\n|\r|\n/g, u = "", d = 1;
|
|
912
|
-
if ((i.valign === "middle" || i.valign === "bottom" || i.halign === "center" || i.halign === "right") && (u = typeof e == "string" ? e.split(f) : e, d = u.length || 1), n += o * (2 - a), i.valign === "middle" ? n -= d / 2 * s : i.valign === "bottom" && (n -= d * s), i.halign === "center" || i.halign === "right") {
|
|
913
|
-
var p = o;
|
|
914
|
-
if (i.halign === "center" && (p *= 0.5), u && d >= 1) {
|
|
915
|
-
for (var c = 0; c < u.length; c++)
|
|
916
|
-
r.text(u[c], t - r.getStringUnitWidth(u[c]) * p, n), n += s;
|
|
917
|
-
return r;
|
|
918
|
-
}
|
|
919
|
-
t -= r.getStringUnitWidth(e) * p;
|
|
920
|
-
}
|
|
921
|
-
return i.halign === "justify" ? r.text(e, t, n, { maxWidth: i.maxWidth || 100, align: "justify" }) : r.text(e, t, n), r;
|
|
922
|
-
}
|
|
923
|
-
var U = {}, D = (
|
|
924
|
-
/** @class */
|
|
925
|
-
(function() {
|
|
926
|
-
function e(t) {
|
|
927
|
-
this.jsPDFDocument = t, this.userStyles = {
|
|
928
|
-
// Black for versions of jspdf without getTextColor
|
|
929
|
-
textColor: t.getTextColor ? this.jsPDFDocument.getTextColor() : 0,
|
|
930
|
-
fontSize: t.internal.getFontSize(),
|
|
931
|
-
fontStyle: t.internal.getFont().fontStyle,
|
|
932
|
-
font: t.internal.getFont().fontName,
|
|
933
|
-
// 0 for versions of jspdf without getLineWidth
|
|
934
|
-
lineWidth: t.getLineWidth ? this.jsPDFDocument.getLineWidth() : 0,
|
|
935
|
-
// Black for versions of jspdf without getDrawColor
|
|
936
|
-
lineColor: t.getDrawColor ? this.jsPDFDocument.getDrawColor() : 0
|
|
937
|
-
};
|
|
938
|
-
}
|
|
939
|
-
return e.setDefaults = function(t, n) {
|
|
940
|
-
n === void 0 && (n = null), n ? n.__autoTableDocumentDefaults = t : U = t;
|
|
941
|
-
}, e.unifyColor = function(t) {
|
|
942
|
-
return Array.isArray(t) ? t : typeof t == "number" ? [t, t, t] : typeof t == "string" ? [t] : null;
|
|
943
|
-
}, e.prototype.applyStyles = function(t, n) {
|
|
944
|
-
var i, r, a;
|
|
945
|
-
n === void 0 && (n = !1), t.fontStyle && this.jsPDFDocument.setFontStyle && this.jsPDFDocument.setFontStyle(t.fontStyle);
|
|
946
|
-
var l = this.jsPDFDocument.internal.getFont(), o = l.fontStyle, h = l.fontName;
|
|
947
|
-
if (t.font && (h = t.font), t.fontStyle) {
|
|
948
|
-
o = t.fontStyle;
|
|
949
|
-
var s = this.getFontList()[h];
|
|
950
|
-
s && s.indexOf(o) === -1 && this.jsPDFDocument.setFontStyle && (this.jsPDFDocument.setFontStyle(s[0]), o = s[0]);
|
|
951
|
-
}
|
|
952
|
-
if (this.jsPDFDocument.setFont(h, o), t.fontSize && this.jsPDFDocument.setFontSize(t.fontSize), !n) {
|
|
953
|
-
var f = e.unifyColor(t.fillColor);
|
|
954
|
-
f && (i = this.jsPDFDocument).setFillColor.apply(i, f), f = e.unifyColor(t.textColor), f && (r = this.jsPDFDocument).setTextColor.apply(r, f), f = e.unifyColor(t.lineColor), f && (a = this.jsPDFDocument).setDrawColor.apply(a, f), typeof t.lineWidth == "number" && this.jsPDFDocument.setLineWidth(t.lineWidth);
|
|
955
|
-
}
|
|
956
|
-
}, e.prototype.splitTextToSize = function(t, n, i) {
|
|
957
|
-
return this.jsPDFDocument.splitTextToSize(t, n, i);
|
|
958
|
-
}, e.prototype.rect = function(t, n, i, r, a) {
|
|
959
|
-
return this.jsPDFDocument.rect(t, n, i, r, a);
|
|
960
|
-
}, e.prototype.getLastAutoTable = function() {
|
|
961
|
-
return this.jsPDFDocument.lastAutoTable || null;
|
|
962
|
-
}, e.prototype.getTextWidth = function(t) {
|
|
963
|
-
return this.jsPDFDocument.getTextWidth(t);
|
|
964
|
-
}, e.prototype.getDocument = function() {
|
|
965
|
-
return this.jsPDFDocument;
|
|
966
|
-
}, e.prototype.setPage = function(t) {
|
|
967
|
-
this.jsPDFDocument.setPage(t);
|
|
968
|
-
}, e.prototype.addPage = function() {
|
|
969
|
-
return this.jsPDFDocument.addPage();
|
|
970
|
-
}, e.prototype.getFontList = function() {
|
|
971
|
-
return this.jsPDFDocument.getFontList();
|
|
972
|
-
}, e.prototype.getGlobalOptions = function() {
|
|
973
|
-
return U || {};
|
|
974
|
-
}, e.prototype.getDocumentOptions = function() {
|
|
975
|
-
return this.jsPDFDocument.__autoTableDocumentDefaults || {};
|
|
976
|
-
}, e.prototype.pageSize = function() {
|
|
977
|
-
var t = this.jsPDFDocument.internal.pageSize;
|
|
978
|
-
return t.width == null && (t = { width: t.getWidth(), height: t.getHeight() }), t;
|
|
979
|
-
}, e.prototype.scaleFactor = function() {
|
|
980
|
-
return this.jsPDFDocument.internal.scaleFactor;
|
|
981
|
-
}, e.prototype.getLineHeightFactor = function() {
|
|
982
|
-
var t = this.jsPDFDocument;
|
|
983
|
-
return t.getLineHeightFactor ? t.getLineHeightFactor() : 1.15;
|
|
984
|
-
}, e.prototype.getLineHeight = function(t) {
|
|
985
|
-
return t / this.scaleFactor() * this.getLineHeightFactor();
|
|
986
|
-
}, e.prototype.pageNumber = function() {
|
|
987
|
-
var t = this.jsPDFDocument.internal.getCurrentPageInfo();
|
|
988
|
-
return t ? t.pageNumber : this.jsPDFDocument.internal.getNumberOfPages();
|
|
989
|
-
}, e;
|
|
990
|
-
})()
|
|
991
|
-
), _ = function(e, t) {
|
|
992
|
-
return _ = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, i) {
|
|
993
|
-
n.__proto__ = i;
|
|
994
|
-
} || function(n, i) {
|
|
995
|
-
for (var r in i) Object.prototype.hasOwnProperty.call(i, r) && (n[r] = i[r]);
|
|
996
|
-
}, _(e, t);
|
|
997
|
-
};
|
|
998
|
-
function at(e, t) {
|
|
999
|
-
if (typeof t != "function" && t !== null)
|
|
1000
|
-
throw new TypeError("Class extends value " + String(t) + " is not a constructor or null");
|
|
1001
|
-
_(e, t);
|
|
1002
|
-
function n() {
|
|
1003
|
-
this.constructor = e;
|
|
1004
|
-
}
|
|
1005
|
-
e.prototype = t === null ? Object.create(t) : (n.prototype = t.prototype, new n());
|
|
1006
|
-
}
|
|
1007
|
-
var ot = (
|
|
1008
|
-
/** @class */
|
|
1009
|
-
(function(e) {
|
|
1010
|
-
at(t, e);
|
|
1011
|
-
function t(n) {
|
|
1012
|
-
var i = e.call(this) || this;
|
|
1013
|
-
return i._element = n, i;
|
|
1014
|
-
}
|
|
1015
|
-
return t;
|
|
1016
|
-
})(Array)
|
|
1017
|
-
);
|
|
1018
|
-
function Et(e) {
|
|
1019
|
-
return {
|
|
1020
|
-
font: "helvetica",
|
|
1021
|
-
// helvetica, times, courier
|
|
1022
|
-
fontStyle: "normal",
|
|
1023
|
-
// normal, bold, italic, bolditalic
|
|
1024
|
-
overflow: "linebreak",
|
|
1025
|
-
// linebreak, ellipsize, visible or hidden
|
|
1026
|
-
fillColor: !1,
|
|
1027
|
-
// Either false for transparent, rbg array e.g. [255, 255, 255] or gray level e.g 200
|
|
1028
|
-
textColor: 20,
|
|
1029
|
-
halign: "left",
|
|
1030
|
-
// left, center, right, justify
|
|
1031
|
-
valign: "top",
|
|
1032
|
-
// top, middle, bottom
|
|
1033
|
-
fontSize: 10,
|
|
1034
|
-
cellPadding: 5 / e,
|
|
1035
|
-
// number or {top,left,right,left,vertical,horizontal}
|
|
1036
|
-
lineColor: 200,
|
|
1037
|
-
lineWidth: 0,
|
|
1038
|
-
cellWidth: "auto",
|
|
1039
|
-
// 'auto'|'wrap'|number
|
|
1040
|
-
minCellHeight: 0,
|
|
1041
|
-
minCellWidth: 0
|
|
1042
|
-
};
|
|
1043
|
-
}
|
|
1044
|
-
function At(e) {
|
|
1045
|
-
var t = {
|
|
1046
|
-
striped: {
|
|
1047
|
-
table: { fillColor: 255, textColor: 80, fontStyle: "normal" },
|
|
1048
|
-
head: { textColor: 255, fillColor: [41, 128, 185], fontStyle: "bold" },
|
|
1049
|
-
body: {},
|
|
1050
|
-
foot: { textColor: 255, fillColor: [41, 128, 185], fontStyle: "bold" },
|
|
1051
|
-
alternateRow: { fillColor: 245 }
|
|
1052
|
-
},
|
|
1053
|
-
grid: {
|
|
1054
|
-
table: {
|
|
1055
|
-
fillColor: 255,
|
|
1056
|
-
textColor: 80,
|
|
1057
|
-
fontStyle: "normal",
|
|
1058
|
-
lineWidth: 0.1
|
|
1059
|
-
},
|
|
1060
|
-
head: {
|
|
1061
|
-
textColor: 255,
|
|
1062
|
-
fillColor: [26, 188, 156],
|
|
1063
|
-
fontStyle: "bold",
|
|
1064
|
-
lineWidth: 0
|
|
1065
|
-
},
|
|
1066
|
-
body: {},
|
|
1067
|
-
foot: {
|
|
1068
|
-
textColor: 255,
|
|
1069
|
-
fillColor: [26, 188, 156],
|
|
1070
|
-
fontStyle: "bold",
|
|
1071
|
-
lineWidth: 0
|
|
1072
|
-
},
|
|
1073
|
-
alternateRow: {}
|
|
1074
|
-
},
|
|
1075
|
-
plain: { head: { fontStyle: "bold" }, foot: { fontStyle: "bold" } }
|
|
1076
|
-
};
|
|
1077
|
-
return t[e];
|
|
1078
|
-
}
|
|
1079
|
-
function R(e, t, n) {
|
|
1080
|
-
n.applyStyles(t, !0);
|
|
1081
|
-
var i = Array.isArray(e) ? e : [e], r = i.map(function(a) {
|
|
1082
|
-
return n.getTextWidth(a);
|
|
1083
|
-
}).reduce(function(a, l) {
|
|
1084
|
-
return Math.max(a, l);
|
|
1085
|
-
}, 0);
|
|
1086
|
-
return r;
|
|
1087
|
-
}
|
|
1088
|
-
function st(e, t, n, i) {
|
|
1089
|
-
var r = t.settings.tableLineWidth, a = t.settings.tableLineColor;
|
|
1090
|
-
e.applyStyles({ lineWidth: r, lineColor: a });
|
|
1091
|
-
var l = lt(r, !1);
|
|
1092
|
-
l && e.rect(n.x, n.y, t.getWidth(e.pageSize().width), i.y - n.y, l);
|
|
1093
|
-
}
|
|
1094
|
-
function lt(e, t) {
|
|
1095
|
-
var n = e > 0, i = t || t === 0;
|
|
1096
|
-
return n && i ? "DF" : n ? "S" : i ? "F" : null;
|
|
1097
|
-
}
|
|
1098
|
-
function A(e, t) {
|
|
1099
|
-
var n, i, r, a;
|
|
1100
|
-
if (e = e || t, Array.isArray(e)) {
|
|
1101
|
-
if (e.length >= 4)
|
|
1102
|
-
return {
|
|
1103
|
-
top: e[0],
|
|
1104
|
-
right: e[1],
|
|
1105
|
-
bottom: e[2],
|
|
1106
|
-
left: e[3]
|
|
1107
|
-
};
|
|
1108
|
-
if (e.length === 3)
|
|
1109
|
-
return {
|
|
1110
|
-
top: e[0],
|
|
1111
|
-
right: e[1],
|
|
1112
|
-
bottom: e[2],
|
|
1113
|
-
left: e[1]
|
|
1114
|
-
};
|
|
1115
|
-
if (e.length === 2)
|
|
1116
|
-
return {
|
|
1117
|
-
top: e[0],
|
|
1118
|
-
right: e[1],
|
|
1119
|
-
bottom: e[0],
|
|
1120
|
-
left: e[1]
|
|
1121
|
-
};
|
|
1122
|
-
e.length === 1 ? e = e[0] : e = t;
|
|
1123
|
-
}
|
|
1124
|
-
return typeof e == "object" ? (typeof e.vertical == "number" && (e.top = e.vertical, e.bottom = e.vertical), typeof e.horizontal == "number" && (e.right = e.horizontal, e.left = e.horizontal), {
|
|
1125
|
-
left: (n = e.left) !== null && n !== void 0 ? n : t,
|
|
1126
|
-
top: (i = e.top) !== null && i !== void 0 ? i : t,
|
|
1127
|
-
right: (r = e.right) !== null && r !== void 0 ? r : t,
|
|
1128
|
-
bottom: (a = e.bottom) !== null && a !== void 0 ? a : t
|
|
1129
|
-
}) : (typeof e != "number" && (e = t), { top: e, right: e, bottom: e, left: e });
|
|
1130
|
-
}
|
|
1131
|
-
function ht(e, t) {
|
|
1132
|
-
var n = A(t.settings.margin, 0);
|
|
1133
|
-
return e.pageSize().width - (n.left + n.right);
|
|
1134
|
-
}
|
|
1135
|
-
function Bt(e, t, n, i, r) {
|
|
1136
|
-
var a = {}, l = 1.3333333333333333, o = I(t, function(S) {
|
|
1137
|
-
return r.getComputedStyle(S).backgroundColor;
|
|
1138
|
-
});
|
|
1139
|
-
o != null && (a.fillColor = o);
|
|
1140
|
-
var h = I(t, function(S) {
|
|
1141
|
-
return r.getComputedStyle(S).color;
|
|
1142
|
-
});
|
|
1143
|
-
h != null && (a.textColor = h);
|
|
1144
|
-
var s = jt(i, n);
|
|
1145
|
-
s && (a.cellPadding = s);
|
|
1146
|
-
var f = "borderTopColor", u = l * n, d = i.borderTopWidth;
|
|
1147
|
-
if (i.borderBottomWidth === d && i.borderRightWidth === d && i.borderLeftWidth === d) {
|
|
1148
|
-
var p = (parseFloat(d) || 0) / u;
|
|
1149
|
-
p && (a.lineWidth = p);
|
|
1150
|
-
} else
|
|
1151
|
-
a.lineWidth = {
|
|
1152
|
-
top: (parseFloat(i.borderTopWidth) || 0) / u,
|
|
1153
|
-
right: (parseFloat(i.borderRightWidth) || 0) / u,
|
|
1154
|
-
bottom: (parseFloat(i.borderBottomWidth) || 0) / u,
|
|
1155
|
-
left: (parseFloat(i.borderLeftWidth) || 0) / u
|
|
1156
|
-
}, a.lineWidth.top || (a.lineWidth.right ? f = "borderRightColor" : a.lineWidth.bottom ? f = "borderBottomColor" : a.lineWidth.left && (f = "borderLeftColor"));
|
|
1157
|
-
var c = I(t, function(S) {
|
|
1158
|
-
return r.getComputedStyle(S)[f];
|
|
1159
|
-
});
|
|
1160
|
-
c != null && (a.lineColor = c);
|
|
1161
|
-
var v = ["left", "right", "center", "justify"];
|
|
1162
|
-
v.indexOf(i.textAlign) !== -1 && (a.halign = i.textAlign), v = ["middle", "bottom", "top"], v.indexOf(i.verticalAlign) !== -1 && (a.valign = i.verticalAlign);
|
|
1163
|
-
var m = parseInt(i.fontSize || "");
|
|
1164
|
-
isNaN(m) || (a.fontSize = m / l);
|
|
1165
|
-
var x = Xt(i);
|
|
1166
|
-
x && (a.fontStyle = x);
|
|
1167
|
-
var C = (i.fontFamily || "").toLowerCase();
|
|
1168
|
-
return e.indexOf(C) !== -1 && (a.font = C), a;
|
|
1169
|
-
}
|
|
1170
|
-
function Xt(e) {
|
|
1171
|
-
var t = "";
|
|
1172
|
-
return (e.fontWeight === "bold" || e.fontWeight === "bolder" || parseInt(e.fontWeight) >= 700) && (t = "bold"), (e.fontStyle === "italic" || e.fontStyle === "oblique") && (t += "italic"), t;
|
|
1173
|
-
}
|
|
1174
|
-
function I(e, t) {
|
|
1175
|
-
var n = ft(e, t);
|
|
1176
|
-
if (!n)
|
|
1177
|
-
return null;
|
|
1178
|
-
var i = n.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d*))?\)$/);
|
|
1179
|
-
if (!i || !Array.isArray(i))
|
|
1180
|
-
return null;
|
|
1181
|
-
var r = [
|
|
1182
|
-
parseInt(i[1]),
|
|
1183
|
-
parseInt(i[2]),
|
|
1184
|
-
parseInt(i[3])
|
|
1185
|
-
], a = parseInt(i[4]);
|
|
1186
|
-
return a === 0 || isNaN(r[0]) || isNaN(r[1]) || isNaN(r[2]) ? null : r;
|
|
1187
|
-
}
|
|
1188
|
-
function ft(e, t) {
|
|
1189
|
-
var n = t(e);
|
|
1190
|
-
return n === "rgba(0, 0, 0, 0)" || n === "transparent" || n === "initial" || n === "inherit" ? e.parentElement == null ? null : ft(e.parentElement, t) : n;
|
|
1191
|
-
}
|
|
1192
|
-
function jt(e, t) {
|
|
1193
|
-
var n = [
|
|
1194
|
-
e.paddingTop,
|
|
1195
|
-
e.paddingRight,
|
|
1196
|
-
e.paddingBottom,
|
|
1197
|
-
e.paddingLeft
|
|
1198
|
-
], i = 96 / (72 / t), r = (parseInt(e.lineHeight) - parseInt(e.fontSize)) / t / 2, a = n.map(function(o) {
|
|
1199
|
-
return parseInt(o || "0") / i;
|
|
1200
|
-
}), l = A(a, 0);
|
|
1201
|
-
return r > l.top && (l.top = r), r > l.bottom && (l.bottom = r), l;
|
|
1202
|
-
}
|
|
1203
|
-
function gt(e, t, n, i, r) {
|
|
1204
|
-
var a, l;
|
|
1205
|
-
i === void 0 && (i = !1), r === void 0 && (r = !1);
|
|
1206
|
-
var o;
|
|
1207
|
-
typeof t == "string" ? o = n.document.querySelector(t) : o = t;
|
|
1208
|
-
var h = Object.keys(e.getFontList()), s = e.scaleFactor(), f = [], u = [], d = [];
|
|
1209
|
-
if (!o)
|
|
1210
|
-
return console.error("Html table could not be found with input: ", t), { head: f, body: u, foot: d };
|
|
1211
|
-
for (var p = 0; p < o.rows.length; p++) {
|
|
1212
|
-
var c = o.rows[p], v = (l = (a = c?.parentElement) === null || a === void 0 ? void 0 : a.tagName) === null || l === void 0 ? void 0 : l.toLowerCase(), m = It(h, s, n, c, i, r);
|
|
1213
|
-
m && (v === "thead" ? f.push(m) : v === "tfoot" ? d.push(m) : u.push(m));
|
|
1214
|
-
}
|
|
1215
|
-
return { head: f, body: u, foot: d };
|
|
1216
|
-
}
|
|
1217
|
-
function It(e, t, n, i, r, a) {
|
|
1218
|
-
for (var l = new ot(i), o = 0; o < i.cells.length; o++) {
|
|
1219
|
-
var h = i.cells[o], s = n.getComputedStyle(h);
|
|
1220
|
-
if (r || s.display !== "none") {
|
|
1221
|
-
var f = void 0;
|
|
1222
|
-
a && (f = Bt(e, h, t, s, n)), l.push({
|
|
1223
|
-
rowSpan: h.rowSpan,
|
|
1224
|
-
colSpan: h.colSpan,
|
|
1225
|
-
styles: f,
|
|
1226
|
-
_element: h,
|
|
1227
|
-
content: Nt(h)
|
|
1228
|
-
});
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
var u = n.getComputedStyle(i);
|
|
1232
|
-
if (l.length > 0 && (r || u.display !== "none"))
|
|
1233
|
-
return l;
|
|
1234
|
-
}
|
|
1235
|
-
function Nt(e) {
|
|
1236
|
-
var t = e.cloneNode(!0);
|
|
1237
|
-
return t.innerHTML = t.innerHTML.replace(/\n/g, "").replace(/ +/g, " "), t.innerHTML = t.innerHTML.split(/<br.*?>/).map(function(n) {
|
|
1238
|
-
return n.trim();
|
|
1239
|
-
}).join(`
|
|
1240
|
-
`), t.innerText || t.textContent || "";
|
|
1241
|
-
}
|
|
1242
|
-
function Ot(e, t, n) {
|
|
1243
|
-
for (var i = 0, r = [e, t, n]; i < r.length; i++) {
|
|
1244
|
-
var a = r[i];
|
|
1245
|
-
a && typeof a != "object" && console.error("The options parameter should be of type object, is: " + typeof a), a.startY && typeof a.startY != "number" && (console.error("Invalid value for startY option", a.startY), delete a.startY);
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
function H(e, t, n, i, r) {
|
|
1249
|
-
if (e == null)
|
|
1250
|
-
throw new TypeError("Cannot convert undefined or null to object");
|
|
1251
|
-
for (var a = Object(e), l = 1; l < arguments.length; l++) {
|
|
1252
|
-
var o = arguments[l];
|
|
1253
|
-
if (o != null)
|
|
1254
|
-
for (var h in o)
|
|
1255
|
-
Object.prototype.hasOwnProperty.call(o, h) && (a[h] = o[h]);
|
|
1256
|
-
}
|
|
1257
|
-
return a;
|
|
1258
|
-
}
|
|
1259
|
-
function pt(e, t) {
|
|
1260
|
-
var n = new D(e), i = n.getDocumentOptions(), r = n.getGlobalOptions();
|
|
1261
|
-
Ot(r, i, t);
|
|
1262
|
-
var a = H({}, r, i, t), l;
|
|
1263
|
-
typeof window < "u" && (l = window);
|
|
1264
|
-
var o = Mt(r, i, t), h = qt(r, i, t), s = _t(n, a), f = Jt(n, a, l);
|
|
1265
|
-
return { id: t.tableId, content: f, hooks: h, styles: o, settings: s };
|
|
1266
|
-
}
|
|
1267
|
-
function Mt(e, t, n) {
|
|
1268
|
-
for (var i = {
|
|
1269
|
-
styles: {},
|
|
1270
|
-
headStyles: {},
|
|
1271
|
-
bodyStyles: {},
|
|
1272
|
-
footStyles: {},
|
|
1273
|
-
alternateRowStyles: {},
|
|
1274
|
-
columnStyles: {}
|
|
1275
|
-
}, r = function(h) {
|
|
1276
|
-
if (h === "columnStyles") {
|
|
1277
|
-
var s = e[h], f = t[h], u = n[h];
|
|
1278
|
-
i.columnStyles = H({}, s, f, u);
|
|
1279
|
-
} else {
|
|
1280
|
-
var d = [e, t, n], p = d.map(function(c) {
|
|
1281
|
-
return c[h] || {};
|
|
1282
|
-
});
|
|
1283
|
-
i[h] = H({}, p[0], p[1], p[2]);
|
|
1284
|
-
}
|
|
1285
|
-
}, a = 0, l = Object.keys(i); a < l.length; a++) {
|
|
1286
|
-
var o = l[a];
|
|
1287
|
-
r(o);
|
|
1288
|
-
}
|
|
1289
|
-
return i;
|
|
1290
|
-
}
|
|
1291
|
-
function qt(e, t, n) {
|
|
1292
|
-
for (var i = [e, t, n], r = {
|
|
1293
|
-
didParseCell: [],
|
|
1294
|
-
willDrawCell: [],
|
|
1295
|
-
didDrawCell: [],
|
|
1296
|
-
willDrawPage: [],
|
|
1297
|
-
didDrawPage: []
|
|
1298
|
-
}, a = 0, l = i; a < l.length; a++) {
|
|
1299
|
-
var o = l[a];
|
|
1300
|
-
o.didParseCell && r.didParseCell.push(o.didParseCell), o.willDrawCell && r.willDrawCell.push(o.willDrawCell), o.didDrawCell && r.didDrawCell.push(o.didDrawCell), o.willDrawPage && r.willDrawPage.push(o.willDrawPage), o.didDrawPage && r.didDrawPage.push(o.didDrawPage);
|
|
1301
|
-
}
|
|
1302
|
-
return r;
|
|
1303
|
-
}
|
|
1304
|
-
function _t(e, t) {
|
|
1305
|
-
var n, i, r, a, l, o, h, s, f, u, d, p, c = A(t.margin, 40 / e.scaleFactor()), v = (n = $t(e, t.startY)) !== null && n !== void 0 ? n : c.top, m;
|
|
1306
|
-
t.showFoot === !0 ? m = "everyPage" : t.showFoot === !1 ? m = "never" : m = (i = t.showFoot) !== null && i !== void 0 ? i : "everyPage";
|
|
1307
|
-
var x;
|
|
1308
|
-
t.showHead === !0 ? x = "everyPage" : t.showHead === !1 ? x = "never" : x = (r = t.showHead) !== null && r !== void 0 ? r : "everyPage";
|
|
1309
|
-
var C = (a = t.useCss) !== null && a !== void 0 ? a : !1, S = t.theme || (C ? "plain" : "striped"), F = !!t.horizontalPageBreak, W = (l = t.horizontalPageBreakRepeat) !== null && l !== void 0 ? l : null;
|
|
1310
|
-
return {
|
|
1311
|
-
includeHiddenHtml: (o = t.includeHiddenHtml) !== null && o !== void 0 ? o : !1,
|
|
1312
|
-
useCss: C,
|
|
1313
|
-
theme: S,
|
|
1314
|
-
startY: v,
|
|
1315
|
-
margin: c,
|
|
1316
|
-
pageBreak: (h = t.pageBreak) !== null && h !== void 0 ? h : "auto",
|
|
1317
|
-
rowPageBreak: (s = t.rowPageBreak) !== null && s !== void 0 ? s : "auto",
|
|
1318
|
-
tableWidth: (f = t.tableWidth) !== null && f !== void 0 ? f : "auto",
|
|
1319
|
-
showHead: x,
|
|
1320
|
-
showFoot: m,
|
|
1321
|
-
tableLineWidth: (u = t.tableLineWidth) !== null && u !== void 0 ? u : 0,
|
|
1322
|
-
tableLineColor: (d = t.tableLineColor) !== null && d !== void 0 ? d : 200,
|
|
1323
|
-
horizontalPageBreak: F,
|
|
1324
|
-
horizontalPageBreakRepeat: W,
|
|
1325
|
-
horizontalPageBreakBehaviour: (p = t.horizontalPageBreakBehaviour) !== null && p !== void 0 ? p : "afterAllRows"
|
|
1326
|
-
};
|
|
1327
|
-
}
|
|
1328
|
-
function $t(e, t) {
|
|
1329
|
-
var n = e.getLastAutoTable(), i = e.scaleFactor(), r = e.pageNumber(), a = !1;
|
|
1330
|
-
if (n && n.startPageNumber) {
|
|
1331
|
-
var l = n.startPageNumber + n.pageNumber - 1;
|
|
1332
|
-
a = l === r;
|
|
1333
|
-
}
|
|
1334
|
-
return typeof t == "number" ? t : (t == null || t === !1) && a && n?.finalY != null ? n.finalY + 20 / i : null;
|
|
1335
|
-
}
|
|
1336
|
-
function Jt(e, t, n) {
|
|
1337
|
-
var i = t.head || [], r = t.body || [], a = t.foot || [];
|
|
1338
|
-
if (t.html) {
|
|
1339
|
-
var l = t.includeHiddenHtml;
|
|
1340
|
-
if (n) {
|
|
1341
|
-
var o = gt(e, t.html, n, l, t.useCss) || {};
|
|
1342
|
-
i = o.head || i, r = o.body || i, a = o.foot || i;
|
|
1343
|
-
} else
|
|
1344
|
-
console.error("Cannot parse html in non browser environment");
|
|
1345
|
-
}
|
|
1346
|
-
var h = t.columns || Kt(i, r, a);
|
|
1347
|
-
return { columns: h, head: i, body: r, foot: a };
|
|
1348
|
-
}
|
|
1349
|
-
function Kt(e, t, n) {
|
|
1350
|
-
var i = e[0] || t[0] || n[0] || [], r = [];
|
|
1351
|
-
return Object.keys(i).filter(function(a) {
|
|
1352
|
-
return a !== "_element";
|
|
1353
|
-
}).forEach(function(a) {
|
|
1354
|
-
var l = 1, o;
|
|
1355
|
-
Array.isArray(i) ? o = i[parseInt(a)] : o = i[a], typeof o == "object" && !Array.isArray(o) && (l = o?.colSpan || 1);
|
|
1356
|
-
for (var h = 0; h < l; h++) {
|
|
1357
|
-
var s = void 0;
|
|
1358
|
-
Array.isArray(i) ? s = r.length : s = a + (h > 0 ? "_".concat(h) : "");
|
|
1359
|
-
var f = { dataKey: s };
|
|
1360
|
-
r.push(f);
|
|
1361
|
-
}
|
|
1362
|
-
}), r;
|
|
1363
|
-
}
|
|
1364
|
-
var $ = (
|
|
1365
|
-
/** @class */
|
|
1366
|
-
/* @__PURE__ */ (function() {
|
|
1367
|
-
function e(t, n, i) {
|
|
1368
|
-
this.table = n, this.pageNumber = n.pageNumber, this.settings = n.settings, this.cursor = i, this.doc = t.getDocument();
|
|
1369
|
-
}
|
|
1370
|
-
return e;
|
|
1371
|
-
})()
|
|
1372
|
-
), Gt = (
|
|
1373
|
-
/** @class */
|
|
1374
|
-
(function(e) {
|
|
1375
|
-
at(t, e);
|
|
1376
|
-
function t(n, i, r, a, l, o) {
|
|
1377
|
-
var h = e.call(this, n, i, o) || this;
|
|
1378
|
-
return h.cell = r, h.row = a, h.column = l, h.section = a.section, h;
|
|
1379
|
-
}
|
|
1380
|
-
return t;
|
|
1381
|
-
})($)
|
|
1382
|
-
), Ut = (
|
|
1383
|
-
/** @class */
|
|
1384
|
-
(function() {
|
|
1385
|
-
function e(t, n) {
|
|
1386
|
-
this.pageNumber = 1, this.id = t.id, this.settings = t.settings, this.styles = t.styles, this.hooks = t.hooks, this.columns = n.columns, this.head = n.head, this.body = n.body, this.foot = n.foot;
|
|
1387
|
-
}
|
|
1388
|
-
return e.prototype.getHeadHeight = function(t) {
|
|
1389
|
-
return this.head.reduce(function(n, i) {
|
|
1390
|
-
return n + i.getMaxCellHeight(t);
|
|
1391
|
-
}, 0);
|
|
1392
|
-
}, e.prototype.getFootHeight = function(t) {
|
|
1393
|
-
return this.foot.reduce(function(n, i) {
|
|
1394
|
-
return n + i.getMaxCellHeight(t);
|
|
1395
|
-
}, 0);
|
|
1396
|
-
}, e.prototype.allRows = function() {
|
|
1397
|
-
return this.head.concat(this.body).concat(this.foot);
|
|
1398
|
-
}, e.prototype.callCellHooks = function(t, n, i, r, a, l) {
|
|
1399
|
-
for (var o = 0, h = n; o < h.length; o++) {
|
|
1400
|
-
var s = h[o], f = new Gt(t, this, i, r, a, l), u = s(f) === !1;
|
|
1401
|
-
if (i.text = Array.isArray(i.text) ? i.text : [i.text], u)
|
|
1402
|
-
return !1;
|
|
1403
|
-
}
|
|
1404
|
-
return !0;
|
|
1405
|
-
}, e.prototype.callEndPageHooks = function(t, n) {
|
|
1406
|
-
t.applyStyles(t.userStyles);
|
|
1407
|
-
for (var i = 0, r = this.hooks.didDrawPage; i < r.length; i++) {
|
|
1408
|
-
var a = r[i];
|
|
1409
|
-
a(new $(t, this, n));
|
|
1410
|
-
}
|
|
1411
|
-
}, e.prototype.callWillDrawPageHooks = function(t, n) {
|
|
1412
|
-
for (var i = 0, r = this.hooks.willDrawPage; i < r.length; i++) {
|
|
1413
|
-
var a = r[i];
|
|
1414
|
-
a(new $(t, this, n));
|
|
1415
|
-
}
|
|
1416
|
-
}, e.prototype.getWidth = function(t) {
|
|
1417
|
-
if (typeof this.settings.tableWidth == "number")
|
|
1418
|
-
return this.settings.tableWidth;
|
|
1419
|
-
if (this.settings.tableWidth === "wrap") {
|
|
1420
|
-
var n = this.columns.reduce(function(r, a) {
|
|
1421
|
-
return r + a.wrappedWidth;
|
|
1422
|
-
}, 0);
|
|
1423
|
-
return n;
|
|
1424
|
-
} else {
|
|
1425
|
-
var i = this.settings.margin;
|
|
1426
|
-
return t - i.left - i.right;
|
|
1427
|
-
}
|
|
1428
|
-
}, e;
|
|
1429
|
-
})()
|
|
1430
|
-
), ut = (
|
|
1431
|
-
/** @class */
|
|
1432
|
-
(function() {
|
|
1433
|
-
function e(t, n, i, r, a) {
|
|
1434
|
-
a === void 0 && (a = !1), this.height = 0, this.raw = t, t instanceof ot && (this.raw = t._element, this.element = t._element), this.index = n, this.section = i, this.cells = r, this.spansMultiplePages = a;
|
|
1435
|
-
}
|
|
1436
|
-
return e.prototype.getMaxCellHeight = function(t) {
|
|
1437
|
-
var n = this;
|
|
1438
|
-
return t.reduce(function(i, r) {
|
|
1439
|
-
var a;
|
|
1440
|
-
return Math.max(i, ((a = n.cells[r.index]) === null || a === void 0 ? void 0 : a.height) || 0);
|
|
1441
|
-
}, 0);
|
|
1442
|
-
}, e.prototype.hasRowSpan = function(t) {
|
|
1443
|
-
var n = this;
|
|
1444
|
-
return t.filter(function(i) {
|
|
1445
|
-
var r = n.cells[i.index];
|
|
1446
|
-
return r ? r.rowSpan > 1 : !1;
|
|
1447
|
-
}).length > 0;
|
|
1448
|
-
}, e.prototype.canEntireRowFit = function(t, n) {
|
|
1449
|
-
return this.getMaxCellHeight(n) <= t;
|
|
1450
|
-
}, e.prototype.getMinimumRowHeight = function(t, n) {
|
|
1451
|
-
var i = this;
|
|
1452
|
-
return t.reduce(function(r, a) {
|
|
1453
|
-
var l = i.cells[a.index];
|
|
1454
|
-
if (!l)
|
|
1455
|
-
return 0;
|
|
1456
|
-
var o = n.getLineHeight(l.styles.fontSize), h = l.padding("vertical"), s = h + o;
|
|
1457
|
-
return s > r ? s : r;
|
|
1458
|
-
}, 0);
|
|
1459
|
-
}, e;
|
|
1460
|
-
})()
|
|
1461
|
-
), dt = (
|
|
1462
|
-
/** @class */
|
|
1463
|
-
(function() {
|
|
1464
|
-
function e(t, n, i) {
|
|
1465
|
-
var r;
|
|
1466
|
-
this.contentHeight = 0, this.contentWidth = 0, this.wrappedWidth = 0, this.minReadableWidth = 0, this.minWidth = 0, this.width = 0, this.height = 0, this.x = 0, this.y = 0, this.styles = n, this.section = i, this.raw = t;
|
|
1467
|
-
var a = t;
|
|
1468
|
-
t != null && typeof t == "object" && !Array.isArray(t) ? (this.rowSpan = t.rowSpan || 1, this.colSpan = t.colSpan || 1, a = (r = t.content) !== null && r !== void 0 ? r : t, t._element && (this.raw = t._element)) : (this.rowSpan = 1, this.colSpan = 1);
|
|
1469
|
-
var l = a != null ? "" + a : "", o = /\r\n|\r|\n/g;
|
|
1470
|
-
this.text = l.split(o);
|
|
1471
|
-
}
|
|
1472
|
-
return e.prototype.getTextPos = function() {
|
|
1473
|
-
var t;
|
|
1474
|
-
if (this.styles.valign === "top")
|
|
1475
|
-
t = this.y + this.padding("top");
|
|
1476
|
-
else if (this.styles.valign === "bottom")
|
|
1477
|
-
t = this.y + this.height - this.padding("bottom");
|
|
1478
|
-
else {
|
|
1479
|
-
var n = this.height - this.padding("vertical");
|
|
1480
|
-
t = this.y + n / 2 + this.padding("top");
|
|
1481
|
-
}
|
|
1482
|
-
var i;
|
|
1483
|
-
if (this.styles.halign === "right")
|
|
1484
|
-
i = this.x + this.width - this.padding("right");
|
|
1485
|
-
else if (this.styles.halign === "center") {
|
|
1486
|
-
var r = this.width - this.padding("horizontal");
|
|
1487
|
-
i = this.x + r / 2 + this.padding("left");
|
|
1488
|
-
} else
|
|
1489
|
-
i = this.x + this.padding("left");
|
|
1490
|
-
return { x: i, y: t };
|
|
1491
|
-
}, e.prototype.getContentHeight = function(t, n) {
|
|
1492
|
-
n === void 0 && (n = 1.15);
|
|
1493
|
-
var i = Array.isArray(this.text) ? this.text.length : 1, r = this.styles.fontSize / t * n, a = i * r + this.padding("vertical");
|
|
1494
|
-
return Math.max(a, this.styles.minCellHeight);
|
|
1495
|
-
}, e.prototype.padding = function(t) {
|
|
1496
|
-
var n = A(this.styles.cellPadding, 0);
|
|
1497
|
-
return t === "vertical" ? n.top + n.bottom : t === "horizontal" ? n.left + n.right : n[t];
|
|
1498
|
-
}, e;
|
|
1499
|
-
})()
|
|
1500
|
-
), Qt = (
|
|
1501
|
-
/** @class */
|
|
1502
|
-
(function() {
|
|
1503
|
-
function e(t, n, i) {
|
|
1504
|
-
this.wrappedWidth = 0, this.minReadableWidth = 0, this.minWidth = 0, this.width = 0, this.dataKey = t, this.raw = n, this.index = i;
|
|
1505
|
-
}
|
|
1506
|
-
return e.prototype.getMaxCustomCellWidth = function(t) {
|
|
1507
|
-
for (var n = 0, i = 0, r = t.allRows(); i < r.length; i++) {
|
|
1508
|
-
var a = r[i], l = a.cells[this.index];
|
|
1509
|
-
l && typeof l.styles.cellWidth == "number" && (n = Math.max(n, l.styles.cellWidth));
|
|
1510
|
-
}
|
|
1511
|
-
return n;
|
|
1512
|
-
}, e;
|
|
1513
|
-
})()
|
|
1514
|
-
);
|
|
1515
|
-
function Zt(e, t) {
|
|
1516
|
-
Vt(e, t);
|
|
1517
|
-
var n = [], i = 0;
|
|
1518
|
-
t.columns.forEach(function(a) {
|
|
1519
|
-
var l = a.getMaxCustomCellWidth(t);
|
|
1520
|
-
l ? a.width = l : (a.width = a.wrappedWidth, n.push(a)), i += a.width;
|
|
1521
|
-
});
|
|
1522
|
-
var r = t.getWidth(e.pageSize().width) - i;
|
|
1523
|
-
r && (r = J(n, r, function(a) {
|
|
1524
|
-
return Math.max(a.minReadableWidth, a.minWidth);
|
|
1525
|
-
})), r && (r = J(n, r, function(a) {
|
|
1526
|
-
return a.minWidth;
|
|
1527
|
-
})), r = Math.abs(r), !t.settings.horizontalPageBreak && r > 0.1 / e.scaleFactor() && (r = r < 1 ? r : Math.round(r), console.log("Of the table content, ".concat(r, " units width could not fit page"))), ee(t), ne(t, e), te(t);
|
|
1528
|
-
}
|
|
1529
|
-
function Vt(e, t) {
|
|
1530
|
-
var n = e.scaleFactor(), i = t.settings.horizontalPageBreak, r = ht(e, t);
|
|
1531
|
-
t.allRows().forEach(function(a) {
|
|
1532
|
-
for (var l = 0, o = t.columns; l < o.length; l++) {
|
|
1533
|
-
var h = o[l], s = a.cells[h.index];
|
|
1534
|
-
if (s) {
|
|
1535
|
-
var f = t.hooks.didParseCell;
|
|
1536
|
-
t.callCellHooks(e, f, s, a, h, null);
|
|
1537
|
-
var u = s.padding("horizontal");
|
|
1538
|
-
s.contentWidth = R(s.text, s.styles, e) + u;
|
|
1539
|
-
var d = R(s.text.join(" ").split(/[^\S\u00A0]+/), s.styles, e);
|
|
1540
|
-
if (s.minReadableWidth = d + s.padding("horizontal"), typeof s.styles.cellWidth == "number")
|
|
1541
|
-
s.minWidth = s.styles.cellWidth, s.wrappedWidth = s.styles.cellWidth;
|
|
1542
|
-
else if (s.styles.cellWidth === "wrap" || i === !0)
|
|
1543
|
-
s.contentWidth > r ? (s.minWidth = r, s.wrappedWidth = r) : (s.minWidth = s.contentWidth, s.wrappedWidth = s.contentWidth);
|
|
1544
|
-
else {
|
|
1545
|
-
var p = 10 / n;
|
|
1546
|
-
s.minWidth = s.styles.minCellWidth || p, s.wrappedWidth = s.contentWidth, s.minWidth > s.wrappedWidth && (s.wrappedWidth = s.minWidth);
|
|
1547
|
-
}
|
|
1548
|
-
}
|
|
1549
|
-
}
|
|
1550
|
-
}), t.allRows().forEach(function(a) {
|
|
1551
|
-
for (var l = 0, o = t.columns; l < o.length; l++) {
|
|
1552
|
-
var h = o[l], s = a.cells[h.index];
|
|
1553
|
-
if (s && s.colSpan === 1)
|
|
1554
|
-
h.wrappedWidth = Math.max(h.wrappedWidth, s.wrappedWidth), h.minWidth = Math.max(h.minWidth, s.minWidth), h.minReadableWidth = Math.max(h.minReadableWidth, s.minReadableWidth);
|
|
1555
|
-
else {
|
|
1556
|
-
var f = t.styles.columnStyles[h.dataKey] || t.styles.columnStyles[h.index] || {}, u = f.cellWidth || f.minCellWidth;
|
|
1557
|
-
u && typeof u == "number" && (h.minWidth = u, h.wrappedWidth = u);
|
|
1558
|
-
}
|
|
1559
|
-
s && (s.colSpan > 1 && !h.minWidth && (h.minWidth = s.minWidth), s.colSpan > 1 && !h.wrappedWidth && (h.wrappedWidth = s.minWidth));
|
|
1560
|
-
}
|
|
1561
|
-
});
|
|
1562
|
-
}
|
|
1563
|
-
function J(e, t, n) {
|
|
1564
|
-
for (var i = t, r = e.reduce(function(p, c) {
|
|
1565
|
-
return p + c.wrappedWidth;
|
|
1566
|
-
}, 0), a = 0; a < e.length; a++) {
|
|
1567
|
-
var l = e[a], o = l.wrappedWidth / r, h = i * o, s = l.width + h, f = n(l), u = s < f ? f : s;
|
|
1568
|
-
t -= u - l.width, l.width = u;
|
|
1569
|
-
}
|
|
1570
|
-
if (t = Math.round(t * 1e10) / 1e10, t) {
|
|
1571
|
-
var d = e.filter(function(p) {
|
|
1572
|
-
return t < 0 ? p.width > n(p) : !0;
|
|
1573
|
-
});
|
|
1574
|
-
d.length && (t = J(d, t, n));
|
|
1575
|
-
}
|
|
1576
|
-
return t;
|
|
1577
|
-
}
|
|
1578
|
-
function te(e) {
|
|
1579
|
-
for (var t = {}, n = 1, i = e.allRows(), r = 0; r < i.length; r++)
|
|
1580
|
-
for (var a = i[r], l = 0, o = e.columns; l < o.length; l++) {
|
|
1581
|
-
var h = o[l], s = t[h.index];
|
|
1582
|
-
if (n > 1)
|
|
1583
|
-
n--, delete a.cells[h.index];
|
|
1584
|
-
else if (s)
|
|
1585
|
-
s.cell.height += a.height, n = s.cell.colSpan, delete a.cells[h.index], s.left--, s.left <= 1 && delete t[h.index];
|
|
1586
|
-
else {
|
|
1587
|
-
var f = a.cells[h.index];
|
|
1588
|
-
if (!f)
|
|
1589
|
-
continue;
|
|
1590
|
-
if (f.height = a.height, f.rowSpan > 1) {
|
|
1591
|
-
var u = i.length - r, d = f.rowSpan > u ? u : f.rowSpan;
|
|
1592
|
-
t[h.index] = { cell: f, left: d, row: a };
|
|
1593
|
-
}
|
|
1594
|
-
}
|
|
1595
|
-
}
|
|
1596
|
-
}
|
|
1597
|
-
function ee(e) {
|
|
1598
|
-
for (var t = e.allRows(), n = 0; n < t.length; n++)
|
|
1599
|
-
for (var i = t[n], r = null, a = 0, l = 0, o = 0; o < e.columns.length; o++) {
|
|
1600
|
-
var h = e.columns[o];
|
|
1601
|
-
if (l -= 1, l > 1 && e.columns[o + 1])
|
|
1602
|
-
a += h.width, delete i.cells[h.index];
|
|
1603
|
-
else if (r) {
|
|
1604
|
-
var s = r;
|
|
1605
|
-
delete i.cells[h.index], r = null, s.width = h.width + a;
|
|
1606
|
-
} else {
|
|
1607
|
-
var s = i.cells[h.index];
|
|
1608
|
-
if (!s)
|
|
1609
|
-
continue;
|
|
1610
|
-
if (l = s.colSpan, a = 0, s.colSpan > 1) {
|
|
1611
|
-
r = s, a += h.width;
|
|
1612
|
-
continue;
|
|
1613
|
-
}
|
|
1614
|
-
s.width = h.width + a;
|
|
1615
|
-
}
|
|
1616
|
-
}
|
|
1617
|
-
}
|
|
1618
|
-
function ne(e, t) {
|
|
1619
|
-
for (var n = { count: 0, height: 0 }, i = 0, r = e.allRows(); i < r.length; i++) {
|
|
1620
|
-
for (var a = r[i], l = 0, o = e.columns; l < o.length; l++) {
|
|
1621
|
-
var h = o[l], s = a.cells[h.index];
|
|
1622
|
-
if (s) {
|
|
1623
|
-
t.applyStyles(s.styles, !0);
|
|
1624
|
-
var f = s.width - s.padding("horizontal");
|
|
1625
|
-
if (s.styles.overflow === "linebreak")
|
|
1626
|
-
s.text = t.splitTextToSize(s.text, f + 1 / t.scaleFactor(), { fontSize: s.styles.fontSize });
|
|
1627
|
-
else if (s.styles.overflow === "ellipsize")
|
|
1628
|
-
s.text = Q(s.text, f, s.styles, t, "...");
|
|
1629
|
-
else if (s.styles.overflow === "hidden")
|
|
1630
|
-
s.text = Q(s.text, f, s.styles, t, "");
|
|
1631
|
-
else if (typeof s.styles.overflow == "function") {
|
|
1632
|
-
var u = s.styles.overflow(s.text, f);
|
|
1633
|
-
typeof u == "string" ? s.text = [u] : s.text = u;
|
|
1634
|
-
}
|
|
1635
|
-
s.contentHeight = s.getContentHeight(t.scaleFactor(), t.getLineHeightFactor());
|
|
1636
|
-
var d = s.contentHeight / s.rowSpan;
|
|
1637
|
-
s.rowSpan > 1 && n.count * n.height < d * s.rowSpan ? n = { height: d, count: s.rowSpan } : n && n.count > 0 && n.height > d && (d = n.height), d > a.height && (a.height = d);
|
|
1638
|
-
}
|
|
1639
|
-
}
|
|
1640
|
-
n.count--;
|
|
1641
|
-
}
|
|
1642
|
-
}
|
|
1643
|
-
function Q(e, t, n, i, r) {
|
|
1644
|
-
return e.map(function(a) {
|
|
1645
|
-
return ie(a, t, n, i, r);
|
|
1646
|
-
});
|
|
1647
|
-
}
|
|
1648
|
-
function ie(e, t, n, i, r) {
|
|
1649
|
-
var a = 1e4 * i.scaleFactor();
|
|
1650
|
-
if (t = Math.ceil(t * a) / a, t >= R(e, n, i))
|
|
1651
|
-
return e;
|
|
1652
|
-
for (; t < R(e + r, n, i) && !(e.length <= 1); )
|
|
1653
|
-
e = e.substring(0, e.length - 1);
|
|
1654
|
-
return e.trim() + r;
|
|
1655
|
-
}
|
|
1656
|
-
function ct(e, t) {
|
|
1657
|
-
var n = new D(e), i = re(t, n.scaleFactor()), r = new Ut(t, i);
|
|
1658
|
-
return Zt(n, r), n.applyStyles(n.userStyles), r;
|
|
1659
|
-
}
|
|
1660
|
-
function re(e, t) {
|
|
1661
|
-
var n = e.content, i = oe(n.columns);
|
|
1662
|
-
if (n.head.length === 0) {
|
|
1663
|
-
var r = Z(i, "head");
|
|
1664
|
-
r && n.head.push(r);
|
|
1665
|
-
}
|
|
1666
|
-
if (n.foot.length === 0) {
|
|
1667
|
-
var r = Z(i, "foot");
|
|
1668
|
-
r && n.foot.push(r);
|
|
1669
|
-
}
|
|
1670
|
-
var a = e.settings.theme, l = e.styles;
|
|
1671
|
-
return {
|
|
1672
|
-
columns: i,
|
|
1673
|
-
head: N("head", n.head, i, l, a, t),
|
|
1674
|
-
body: N("body", n.body, i, l, a, t),
|
|
1675
|
-
foot: N("foot", n.foot, i, l, a, t)
|
|
1676
|
-
};
|
|
1677
|
-
}
|
|
1678
|
-
function N(e, t, n, i, r, a) {
|
|
1679
|
-
var l = {}, o = t.map(function(h, s) {
|
|
1680
|
-
for (var f = 0, u = {}, d = 0, p = 0, c = 0, v = n; c < v.length; c++) {
|
|
1681
|
-
var m = v[c];
|
|
1682
|
-
if (l[m.index] == null || l[m.index].left === 0)
|
|
1683
|
-
if (p === 0) {
|
|
1684
|
-
var x = void 0;
|
|
1685
|
-
Array.isArray(h) ? x = h[m.index - d - f] : x = h[m.dataKey];
|
|
1686
|
-
var C = {};
|
|
1687
|
-
typeof x == "object" && !Array.isArray(x) && (C = x?.styles || {});
|
|
1688
|
-
var S = se(e, m, s, r, i, a, C), F = new dt(x, S, e);
|
|
1689
|
-
u[m.dataKey] = F, u[m.index] = F, p = F.colSpan - 1, l[m.index] = {
|
|
1690
|
-
left: F.rowSpan - 1,
|
|
1691
|
-
times: p
|
|
1692
|
-
};
|
|
1693
|
-
} else
|
|
1694
|
-
p--, d++;
|
|
1695
|
-
else
|
|
1696
|
-
l[m.index].left--, p = l[m.index].times, f++;
|
|
1697
|
-
}
|
|
1698
|
-
return new ut(h, s, e, u);
|
|
1699
|
-
});
|
|
1700
|
-
return o;
|
|
1701
|
-
}
|
|
1702
|
-
function Z(e, t) {
|
|
1703
|
-
var n = {};
|
|
1704
|
-
return e.forEach(function(i) {
|
|
1705
|
-
if (i.raw != null) {
|
|
1706
|
-
var r = ae(t, i.raw);
|
|
1707
|
-
r != null && (n[i.dataKey] = r);
|
|
1708
|
-
}
|
|
1709
|
-
}), Object.keys(n).length > 0 ? n : null;
|
|
1710
|
-
}
|
|
1711
|
-
function ae(e, t) {
|
|
1712
|
-
if (e === "head") {
|
|
1713
|
-
if (typeof t == "object")
|
|
1714
|
-
return t.header || null;
|
|
1715
|
-
if (typeof t == "string" || typeof t == "number")
|
|
1716
|
-
return t;
|
|
1717
|
-
} else if (e === "foot" && typeof t == "object")
|
|
1718
|
-
return t.footer;
|
|
1719
|
-
return null;
|
|
1720
|
-
}
|
|
1721
|
-
function oe(e) {
|
|
1722
|
-
return e.map(function(t, n) {
|
|
1723
|
-
var i, r;
|
|
1724
|
-
return typeof t == "object" ? r = (i = t.dataKey) !== null && i !== void 0 ? i : n : r = n, new Qt(r, t, n);
|
|
1725
|
-
});
|
|
1726
|
-
}
|
|
1727
|
-
function se(e, t, n, i, r, a, l) {
|
|
1728
|
-
var o = At(i), h;
|
|
1729
|
-
e === "head" ? h = r.headStyles : e === "body" ? h = r.bodyStyles : e === "foot" && (h = r.footStyles);
|
|
1730
|
-
var s = H({}, o.table, o[e], r.styles, h), f = r.columnStyles[t.dataKey] || r.columnStyles[t.index] || {}, u = e === "body" ? f : {}, d = e === "body" && n % 2 === 0 ? H({}, o.alternateRow, r.alternateRowStyles) : {}, p = Et(a), c = H({}, p, s, d, u);
|
|
1731
|
-
return H(c, l);
|
|
1732
|
-
}
|
|
1733
|
-
function le(e, t, n) {
|
|
1734
|
-
var i;
|
|
1735
|
-
n === void 0 && (n = {});
|
|
1736
|
-
var r = ht(e, t), a = /* @__PURE__ */ new Map(), l = [], o = [], h = [];
|
|
1737
|
-
Array.isArray(t.settings.horizontalPageBreakRepeat) ? h = t.settings.horizontalPageBreakRepeat : (typeof t.settings.horizontalPageBreakRepeat == "string" || typeof t.settings.horizontalPageBreakRepeat == "number") && (h = [t.settings.horizontalPageBreakRepeat]), h.forEach(function(d) {
|
|
1738
|
-
var p = t.columns.find(function(c) {
|
|
1739
|
-
return c.dataKey === d || c.index === d;
|
|
1740
|
-
});
|
|
1741
|
-
p && !a.has(p.index) && (a.set(p.index, !0), l.push(p.index), o.push(t.columns[p.index]), r -= p.wrappedWidth);
|
|
1742
|
-
});
|
|
1743
|
-
for (var s = !0, f = (i = n?.start) !== null && i !== void 0 ? i : 0; f < t.columns.length; ) {
|
|
1744
|
-
if (a.has(f)) {
|
|
1745
|
-
f++;
|
|
1746
|
-
continue;
|
|
1747
|
-
}
|
|
1748
|
-
var u = t.columns[f].wrappedWidth;
|
|
1749
|
-
if (s || r >= u)
|
|
1750
|
-
s = !1, l.push(f), o.push(t.columns[f]), r -= u;
|
|
1751
|
-
else
|
|
1752
|
-
break;
|
|
1753
|
-
f++;
|
|
1754
|
-
}
|
|
1755
|
-
return { colIndexes: l, columns: o, lastIndex: f - 1 };
|
|
1756
|
-
}
|
|
1757
|
-
function he(e, t) {
|
|
1758
|
-
for (var n = [], i = 0; i < t.columns.length; i++) {
|
|
1759
|
-
var r = le(e, t, { start: i });
|
|
1760
|
-
r.columns.length && (n.push(r), i = r.lastIndex);
|
|
1761
|
-
}
|
|
1762
|
-
return n;
|
|
1763
|
-
}
|
|
1764
|
-
function vt(e, t) {
|
|
1765
|
-
var n = t.settings, i = n.startY, r = n.margin, a = { x: r.left, y: i }, l = t.getHeadHeight(t.columns) + t.getFootHeight(t.columns), o = i + r.bottom + l;
|
|
1766
|
-
if (n.pageBreak === "avoid") {
|
|
1767
|
-
var h = t.body, s = h.reduce(function(d, p) {
|
|
1768
|
-
return d + p.height;
|
|
1769
|
-
}, 0);
|
|
1770
|
-
o += s;
|
|
1771
|
-
}
|
|
1772
|
-
var f = new D(e);
|
|
1773
|
-
(n.pageBreak === "always" || n.startY != null && o > f.pageSize().height) && (mt(f), a.y = r.top), t.callWillDrawPageHooks(f, a);
|
|
1774
|
-
var u = H({}, a);
|
|
1775
|
-
t.startPageNumber = f.pageNumber(), n.horizontalPageBreak ? fe(f, t, u, a) : (f.applyStyles(f.userStyles), (n.showHead === "firstPage" || n.showHead === "everyPage") && t.head.forEach(function(d) {
|
|
1776
|
-
return P(f, t, d, a, t.columns);
|
|
1777
|
-
}), f.applyStyles(f.userStyles), t.body.forEach(function(d, p) {
|
|
1778
|
-
var c = p === t.body.length - 1;
|
|
1779
|
-
E(f, t, d, c, u, a, t.columns);
|
|
1780
|
-
}), f.applyStyles(f.userStyles), (n.showFoot === "lastPage" || n.showFoot === "everyPage") && t.foot.forEach(function(d) {
|
|
1781
|
-
return P(f, t, d, a, t.columns);
|
|
1782
|
-
})), st(f, t, u, a), t.callEndPageHooks(f, a), t.finalY = a.y, e.lastAutoTable = t, f.applyStyles(f.userStyles);
|
|
1783
|
-
}
|
|
1784
|
-
function fe(e, t, n, i) {
|
|
1785
|
-
var r = he(e, t), a = t.settings;
|
|
1786
|
-
if (a.horizontalPageBreakBehaviour === "afterAllRows")
|
|
1787
|
-
r.forEach(function(s, f) {
|
|
1788
|
-
e.applyStyles(e.userStyles), f > 0 ? z(e, t, n, i, s.columns, !0) : V(e, t, i, s.columns), ge(e, t, n, i, s.columns), O(e, t, i, s.columns);
|
|
1789
|
-
});
|
|
1790
|
-
else
|
|
1791
|
-
for (var l = -1, o = r[0], h = function() {
|
|
1792
|
-
var s = l;
|
|
1793
|
-
if (o) {
|
|
1794
|
-
e.applyStyles(e.userStyles);
|
|
1795
|
-
var f = o.columns;
|
|
1796
|
-
l >= 0 ? z(e, t, n, i, f, !0) : V(e, t, i, f), s = tt(e, t, l + 1, i, f), O(e, t, i, f);
|
|
1797
|
-
}
|
|
1798
|
-
var u = s - l;
|
|
1799
|
-
r.slice(1).forEach(function(d) {
|
|
1800
|
-
e.applyStyles(e.userStyles), z(e, t, n, i, d.columns, !0), tt(e, t, l + 1, i, d.columns, u), O(e, t, i, d.columns);
|
|
1801
|
-
}), l = s;
|
|
1802
|
-
}; l < t.body.length - 1; )
|
|
1803
|
-
h();
|
|
1804
|
-
}
|
|
1805
|
-
function V(e, t, n, i) {
|
|
1806
|
-
var r = t.settings;
|
|
1807
|
-
e.applyStyles(e.userStyles), (r.showHead === "firstPage" || r.showHead === "everyPage") && t.head.forEach(function(a) {
|
|
1808
|
-
return P(e, t, a, n, i);
|
|
1809
|
-
});
|
|
1810
|
-
}
|
|
1811
|
-
function ge(e, t, n, i, r) {
|
|
1812
|
-
e.applyStyles(e.userStyles), t.body.forEach(function(a, l) {
|
|
1813
|
-
var o = l === t.body.length - 1;
|
|
1814
|
-
E(e, t, a, o, n, i, r);
|
|
1815
|
-
});
|
|
1816
|
-
}
|
|
1817
|
-
function tt(e, t, n, i, r, a) {
|
|
1818
|
-
e.applyStyles(e.userStyles), a = a ?? t.body.length;
|
|
1819
|
-
var l = Math.min(n + a, t.body.length), o = -1;
|
|
1820
|
-
return t.body.slice(n, l).forEach(function(h, s) {
|
|
1821
|
-
var f = n + s === t.body.length - 1, u = yt(e, t, f, i);
|
|
1822
|
-
h.canEntireRowFit(u, r) && (P(e, t, h, i, r), o = n + s);
|
|
1823
|
-
}), o;
|
|
1824
|
-
}
|
|
1825
|
-
function O(e, t, n, i) {
|
|
1826
|
-
var r = t.settings;
|
|
1827
|
-
e.applyStyles(e.userStyles), (r.showFoot === "lastPage" || r.showFoot === "everyPage") && t.foot.forEach(function(a) {
|
|
1828
|
-
return P(e, t, a, n, i);
|
|
1829
|
-
});
|
|
1830
|
-
}
|
|
1831
|
-
function pe(e, t, n) {
|
|
1832
|
-
var i = n.getLineHeight(e.styles.fontSize), r = e.padding("vertical"), a = Math.floor((t - r) / i);
|
|
1833
|
-
return Math.max(0, a);
|
|
1834
|
-
}
|
|
1835
|
-
function ue(e, t, n, i) {
|
|
1836
|
-
var r = {};
|
|
1837
|
-
e.spansMultiplePages = !0, e.height = 0;
|
|
1838
|
-
for (var a = 0, l = 0, o = n.columns; l < o.length; l++) {
|
|
1839
|
-
var h = o[l], s = e.cells[h.index];
|
|
1840
|
-
if (s) {
|
|
1841
|
-
Array.isArray(s.text) || (s.text = [s.text]);
|
|
1842
|
-
var f = new dt(s.raw, s.styles, s.section);
|
|
1843
|
-
f = H(f, s), f.text = [];
|
|
1844
|
-
var u = pe(s, t, i);
|
|
1845
|
-
s.text.length > u && (f.text = s.text.splice(u, s.text.length));
|
|
1846
|
-
var d = i.scaleFactor(), p = i.getLineHeightFactor();
|
|
1847
|
-
s.contentHeight = s.getContentHeight(d, p), s.contentHeight >= t && (s.contentHeight = t, f.styles.minCellHeight -= t), s.contentHeight > e.height && (e.height = s.contentHeight), f.contentHeight = f.getContentHeight(d, p), f.contentHeight > a && (a = f.contentHeight), r[h.index] = f;
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
1850
|
-
var c = new ut(e.raw, -1, e.section, r, !0);
|
|
1851
|
-
c.height = a;
|
|
1852
|
-
for (var v = 0, m = n.columns; v < m.length; v++) {
|
|
1853
|
-
var h = m[v], f = c.cells[h.index];
|
|
1854
|
-
f && (f.height = c.height);
|
|
1855
|
-
var s = e.cells[h.index];
|
|
1856
|
-
s && (s.height = e.height);
|
|
1857
|
-
}
|
|
1858
|
-
return c;
|
|
1859
|
-
}
|
|
1860
|
-
function de(e, t, n, i) {
|
|
1861
|
-
var r = e.pageSize().height, a = i.settings.margin, l = a.top + a.bottom, o = r - l;
|
|
1862
|
-
t.section === "body" && (o -= i.getHeadHeight(i.columns) + i.getFootHeight(i.columns));
|
|
1863
|
-
var h = t.getMinimumRowHeight(i.columns, e), s = h < n;
|
|
1864
|
-
if (h > o)
|
|
1865
|
-
return console.log("Will not be able to print row ".concat(t.index, " correctly since it's minimum height is larger than page height")), !0;
|
|
1866
|
-
if (!s)
|
|
1867
|
-
return !1;
|
|
1868
|
-
var f = t.hasRowSpan(i.columns), u = t.getMaxCellHeight(i.columns) > o;
|
|
1869
|
-
return u ? (f && console.log("The content of row ".concat(t.index, " will not be drawn correctly since drawing rows with a height larger than the page height and has cells with rowspans is not supported.")), !0) : !(f || i.settings.rowPageBreak === "avoid");
|
|
1870
|
-
}
|
|
1871
|
-
function E(e, t, n, i, r, a, l) {
|
|
1872
|
-
var o = yt(e, t, i, a);
|
|
1873
|
-
if (n.canEntireRowFit(o, l))
|
|
1874
|
-
P(e, t, n, a, l);
|
|
1875
|
-
else if (de(e, n, o, t)) {
|
|
1876
|
-
var h = ue(n, o, t, e);
|
|
1877
|
-
P(e, t, n, a, l), z(e, t, r, a, l), E(e, t, h, i, r, a, l);
|
|
1878
|
-
} else
|
|
1879
|
-
z(e, t, r, a, l), E(e, t, n, i, r, a, l);
|
|
1880
|
-
}
|
|
1881
|
-
function P(e, t, n, i, r) {
|
|
1882
|
-
i.x = t.settings.margin.left;
|
|
1883
|
-
for (var a = 0, l = r; a < l.length; a++) {
|
|
1884
|
-
var o = l[a], h = n.cells[o.index];
|
|
1885
|
-
if (!h) {
|
|
1886
|
-
i.x += o.width;
|
|
1887
|
-
continue;
|
|
1888
|
-
}
|
|
1889
|
-
e.applyStyles(h.styles), h.x = i.x, h.y = i.y;
|
|
1890
|
-
var s = t.callCellHooks(e, t.hooks.willDrawCell, h, n, o, i);
|
|
1891
|
-
if (s === !1) {
|
|
1892
|
-
i.x += o.width;
|
|
1893
|
-
continue;
|
|
1894
|
-
}
|
|
1895
|
-
ce(e, h, i);
|
|
1896
|
-
var f = h.getTextPos();
|
|
1897
|
-
rt(h.text, f.x, f.y, {
|
|
1898
|
-
halign: h.styles.halign,
|
|
1899
|
-
valign: h.styles.valign,
|
|
1900
|
-
maxWidth: Math.ceil(h.width - h.padding("left") - h.padding("right"))
|
|
1901
|
-
}, e.getDocument()), t.callCellHooks(e, t.hooks.didDrawCell, h, n, o, i), i.x += o.width;
|
|
1902
|
-
}
|
|
1903
|
-
i.y += n.height;
|
|
1904
|
-
}
|
|
1905
|
-
function ce(e, t, n) {
|
|
1906
|
-
var i = t.styles;
|
|
1907
|
-
if (e.getDocument().setFillColor(e.getDocument().getFillColor()), typeof i.lineWidth == "number") {
|
|
1908
|
-
var r = lt(i.lineWidth, i.fillColor);
|
|
1909
|
-
r && e.rect(t.x, n.y, t.width, t.height, r);
|
|
1910
|
-
} else typeof i.lineWidth == "object" && (i.fillColor && e.rect(t.x, n.y, t.width, t.height, "F"), ve(e, t, n, i.lineWidth));
|
|
1911
|
-
}
|
|
1912
|
-
function ve(e, t, n, i) {
|
|
1913
|
-
var r, a, l, o;
|
|
1914
|
-
i.top && (r = n.x, a = n.y, l = n.x + t.width, o = n.y, i.right && (l += 0.5 * i.right), i.left && (r -= 0.5 * i.left), h(i.top, r, a, l, o)), i.bottom && (r = n.x, a = n.y + t.height, l = n.x + t.width, o = n.y + t.height, i.right && (l += 0.5 * i.right), i.left && (r -= 0.5 * i.left), h(i.bottom, r, a, l, o)), i.left && (r = n.x, a = n.y, l = n.x, o = n.y + t.height, i.top && (a -= 0.5 * i.top), i.bottom && (o += 0.5 * i.bottom), h(i.left, r, a, l, o)), i.right && (r = n.x + t.width, a = n.y, l = n.x + t.width, o = n.y + t.height, i.top && (a -= 0.5 * i.top), i.bottom && (o += 0.5 * i.bottom), h(i.right, r, a, l, o));
|
|
1915
|
-
function h(s, f, u, d, p) {
|
|
1916
|
-
e.getDocument().setLineWidth(s), e.getDocument().line(f, u, d, p, "S");
|
|
1917
|
-
}
|
|
1918
|
-
}
|
|
1919
|
-
function yt(e, t, n, i) {
|
|
1920
|
-
var r = t.settings.margin.bottom, a = t.settings.showFoot;
|
|
1921
|
-
return (a === "everyPage" || a === "lastPage" && n) && (r += t.getFootHeight(t.columns)), e.pageSize().height - i.y - r;
|
|
1922
|
-
}
|
|
1923
|
-
function z(e, t, n, i, r, a) {
|
|
1924
|
-
r === void 0 && (r = []), a === void 0 && (a = !1), e.applyStyles(e.userStyles), t.settings.showFoot === "everyPage" && !a && t.foot.forEach(function(o) {
|
|
1925
|
-
return P(e, t, o, i, r);
|
|
1926
|
-
}), t.callEndPageHooks(e, i);
|
|
1927
|
-
var l = t.settings.margin;
|
|
1928
|
-
st(e, t, n, i), mt(e), t.pageNumber++, i.x = l.left, i.y = l.top, n.y = l.top, t.callWillDrawPageHooks(e, i), t.settings.showHead === "everyPage" && (t.head.forEach(function(o) {
|
|
1929
|
-
return P(e, t, o, i, r);
|
|
1930
|
-
}), e.applyStyles(e.userStyles));
|
|
1931
|
-
}
|
|
1932
|
-
function mt(e) {
|
|
1933
|
-
var t = e.pageNumber();
|
|
1934
|
-
e.setPage(t + 1);
|
|
1935
|
-
var n = e.pageNumber();
|
|
1936
|
-
return n === t ? (e.addPage(), !0) : !1;
|
|
1937
|
-
}
|
|
1938
|
-
function ye(e) {
|
|
1939
|
-
e.API.autoTable = function() {
|
|
1940
|
-
for (var t = [], n = 0; n < arguments.length; n++)
|
|
1941
|
-
t[n] = arguments[n];
|
|
1942
|
-
var i = t[0], r = pt(this, i), a = ct(this, r);
|
|
1943
|
-
return vt(this, a), this;
|
|
1944
|
-
}, e.API.lastAutoTable = !1, e.API.autoTableText = function(t, n, i, r) {
|
|
1945
|
-
rt(t, n, i, r, this);
|
|
1946
|
-
}, e.API.autoTableSetDefaults = function(t) {
|
|
1947
|
-
return D.setDefaults(t, this), this;
|
|
1948
|
-
}, e.autoTableSetDefaults = function(t, n) {
|
|
1949
|
-
D.setDefaults(t, n);
|
|
1950
|
-
}, e.API.autoTableHtmlToJson = function(t, n) {
|
|
1951
|
-
var i;
|
|
1952
|
-
if (n === void 0 && (n = !1), typeof window > "u")
|
|
1953
|
-
return console.error("Cannot run autoTableHtmlToJson in non browser environment"), null;
|
|
1954
|
-
var r = new D(this), a = gt(r, t, window, n, !1), l = a.head, o = a.body, h = ((i = l[0]) === null || i === void 0 ? void 0 : i.map(function(s) {
|
|
1955
|
-
return s.content;
|
|
1956
|
-
})) || [];
|
|
1957
|
-
return { columns: h, rows: o, data: o };
|
|
1958
|
-
};
|
|
1959
|
-
}
|
|
1960
|
-
var M;
|
|
1961
|
-
function me(e, t) {
|
|
1962
|
-
var n = pt(e, t), i = ct(e, n);
|
|
1963
|
-
vt(e, i);
|
|
1964
|
-
}
|
|
1965
|
-
try {
|
|
1966
|
-
if (typeof window < "u" && window) {
|
|
1967
|
-
var et = window, nt = et.jsPDF || ((M = et.jspdf) === null || M === void 0 ? void 0 : M.jsPDF);
|
|
1968
|
-
nt && ye(nt);
|
|
904
|
+
f
|
|
905
|
+
), e.updateY(f, "add"), e.recordContentY();
|
|
906
|
+
} catch (i) {
|
|
907
|
+
console.warn("Failed to render image", i);
|
|
1969
908
|
}
|
|
1970
|
-
}
|
|
1971
|
-
|
|
1972
|
-
}
|
|
1973
|
-
const xe = (e, t, n) => {
|
|
1974
|
-
if (!t.header || !t.rows)
|
|
909
|
+
}, tt = (t, n, s) => {
|
|
910
|
+
if (!n.header || !n.rows)
|
|
1975
911
|
return;
|
|
1976
|
-
const
|
|
1977
|
-
(
|
|
1978
|
-
),
|
|
1979
|
-
|
|
1980
|
-
head:
|
|
1981
|
-
body:
|
|
1982
|
-
startY:
|
|
1983
|
-
margin: { left:
|
|
1984
|
-
...
|
|
1985
|
-
didDrawPage: (
|
|
1986
|
-
|
|
912
|
+
const g = e.options, c = g.page.xmargin + s * g.page.indent, l = [n.header.map((a) => a.content || "")], r = n.rows.map(
|
|
913
|
+
(a) => a.map((h) => h.content || "")
|
|
914
|
+
), i = g.table || {};
|
|
915
|
+
A(t, {
|
|
916
|
+
head: l,
|
|
917
|
+
body: r,
|
|
918
|
+
startY: e.Y,
|
|
919
|
+
margin: { left: c, right: g.page.xmargin },
|
|
920
|
+
...i,
|
|
921
|
+
didDrawPage: (a) => {
|
|
922
|
+
i.didDrawPage && i.didDrawPage(a);
|
|
1987
923
|
},
|
|
1988
|
-
didDrawCell: (
|
|
1989
|
-
|
|
1990
|
-
x:
|
|
1991
|
-
y:
|
|
924
|
+
didDrawCell: (a) => {
|
|
925
|
+
i.didDrawCell && i.didDrawCell(a), e.setCursor({
|
|
926
|
+
x: e.X,
|
|
927
|
+
y: a.cell.y + 2 * g.page.lineSpace
|
|
1992
928
|
});
|
|
1993
929
|
}
|
|
1994
930
|
});
|
|
1995
|
-
},
|
|
1996
|
-
for (const
|
|
1997
|
-
if (
|
|
931
|
+
}, B = async (t) => {
|
|
932
|
+
for (const n of t) {
|
|
933
|
+
if (n.type === u.Image && n.src)
|
|
1998
934
|
try {
|
|
1999
|
-
if (
|
|
2000
|
-
|
|
935
|
+
if (n.src.startsWith("data:"))
|
|
936
|
+
n.data = n.src;
|
|
2001
937
|
else {
|
|
2002
|
-
const
|
|
2003
|
-
if (!
|
|
938
|
+
const s = await fetch(n.src);
|
|
939
|
+
if (!s.ok)
|
|
2004
940
|
throw new Error(
|
|
2005
|
-
`Failed to fetch image: ${
|
|
941
|
+
`Failed to fetch image: ${s.statusText}`
|
|
2006
942
|
);
|
|
2007
|
-
const
|
|
2008
|
-
(
|
|
2009
|
-
const
|
|
2010
|
-
|
|
2011
|
-
typeof
|
|
943
|
+
const g = await s.blob(), c = await new Promise(
|
|
944
|
+
(l, r) => {
|
|
945
|
+
const i = new FileReader();
|
|
946
|
+
i.onloadend = () => {
|
|
947
|
+
typeof i.result == "string" ? l(i.result) : r(
|
|
2012
948
|
new Error(
|
|
2013
949
|
"Failed to convert image to base64 string"
|
|
2014
950
|
)
|
|
2015
951
|
);
|
|
2016
|
-
},
|
|
952
|
+
}, i.onerror = r, i.readAsDataURL(g);
|
|
2017
953
|
}
|
|
2018
954
|
);
|
|
2019
|
-
|
|
955
|
+
n.data = c;
|
|
2020
956
|
}
|
|
2021
|
-
} catch (
|
|
957
|
+
} catch (s) {
|
|
2022
958
|
console.warn(
|
|
2023
|
-
`[jspdf-md-renderer] Warning: Failed to load image at ${
|
|
2024
|
-
|
|
959
|
+
`[jspdf-md-renderer] Warning: Failed to load image at ${n.src}. It will be skipped.`,
|
|
960
|
+
s
|
|
2025
961
|
);
|
|
2026
962
|
}
|
|
2027
|
-
|
|
963
|
+
n.items && n.items.length > 0 && await B(n.items);
|
|
2028
964
|
}
|
|
2029
|
-
},
|
|
965
|
+
}, v = {
|
|
2030
966
|
page: {
|
|
2031
967
|
indent: 10,
|
|
2032
968
|
maxContentWidth: 190,
|
|
@@ -2046,82 +982,82 @@ const xe = (e, t, n) => {
|
|
|
2046
982
|
regular: { name: "helvetica", style: "normal" },
|
|
2047
983
|
light: { name: "helvetica", style: "light" }
|
|
2048
984
|
}
|
|
2049
|
-
},
|
|
2050
|
-
if (!
|
|
985
|
+
}, et = (t) => {
|
|
986
|
+
if (!t)
|
|
2051
987
|
throw new Error("RenderOption is required");
|
|
2052
|
-
const
|
|
2053
|
-
return
|
|
2054
|
-
...
|
|
2055
|
-
page:
|
|
2056
|
-
font:
|
|
988
|
+
const n = { ...v.page, ...t.page }, s = { ...v.font, ...t.font };
|
|
989
|
+
return n.maxContentWidth || (n.maxContentWidth = 190), n.maxContentHeight || (n.maxContentHeight = 277), {
|
|
990
|
+
...t,
|
|
991
|
+
page: n,
|
|
992
|
+
font: s
|
|
2057
993
|
};
|
|
2058
|
-
},
|
|
2059
|
-
const
|
|
2060
|
-
|
|
2061
|
-
const
|
|
2062
|
-
await
|
|
2063
|
-
const
|
|
2064
|
-
const d =
|
|
2065
|
-
switch (
|
|
2066
|
-
case
|
|
2067
|
-
|
|
994
|
+
}, it = async (t, n, s) => {
|
|
995
|
+
const g = et(s);
|
|
996
|
+
e.initialize(g);
|
|
997
|
+
const c = await j(n);
|
|
998
|
+
await B(c);
|
|
999
|
+
const l = (r, i = 0, a = !1, h = 0, p = !1, f = !0) => {
|
|
1000
|
+
const d = i * g.page.indent;
|
|
1001
|
+
switch (r.type) {
|
|
1002
|
+
case u.Heading:
|
|
1003
|
+
q(t, r, d, l);
|
|
2068
1004
|
break;
|
|
2069
|
-
case
|
|
2070
|
-
|
|
1005
|
+
case u.Paragraph:
|
|
1006
|
+
_(t, r, d, l);
|
|
2071
1007
|
break;
|
|
2072
|
-
case
|
|
2073
|
-
|
|
1008
|
+
case u.List:
|
|
1009
|
+
$(t, r, i, l);
|
|
2074
1010
|
break;
|
|
2075
|
-
case
|
|
2076
|
-
|
|
2077
|
-
|
|
1011
|
+
case u.ListItem:
|
|
1012
|
+
J(
|
|
1013
|
+
t,
|
|
1014
|
+
r,
|
|
1015
|
+
i,
|
|
2078
1016
|
l,
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
s,
|
|
2082
|
-
f
|
|
1017
|
+
h,
|
|
1018
|
+
p
|
|
2083
1019
|
);
|
|
2084
1020
|
break;
|
|
2085
|
-
case
|
|
2086
|
-
|
|
1021
|
+
case u.Hr:
|
|
1022
|
+
U(t);
|
|
2087
1023
|
break;
|
|
2088
|
-
case
|
|
2089
|
-
|
|
1024
|
+
case u.Code:
|
|
1025
|
+
K(t, r, i);
|
|
2090
1026
|
break;
|
|
2091
|
-
case
|
|
2092
|
-
case
|
|
2093
|
-
case
|
|
2094
|
-
|
|
1027
|
+
case u.Strong:
|
|
1028
|
+
case u.Em:
|
|
1029
|
+
case u.CodeSpan:
|
|
1030
|
+
Q(t, r, d);
|
|
2095
1031
|
break;
|
|
2096
|
-
case
|
|
2097
|
-
|
|
1032
|
+
case u.Link:
|
|
1033
|
+
V(t, r, d);
|
|
2098
1034
|
break;
|
|
2099
|
-
case
|
|
2100
|
-
|
|
1035
|
+
case u.Blockquote:
|
|
1036
|
+
Z(t, r, i, l);
|
|
2101
1037
|
break;
|
|
2102
|
-
case
|
|
2103
|
-
|
|
1038
|
+
case u.Image:
|
|
1039
|
+
M(t, r, i);
|
|
2104
1040
|
break;
|
|
2105
|
-
case
|
|
2106
|
-
|
|
1041
|
+
case u.Table:
|
|
1042
|
+
tt(t, r, i);
|
|
2107
1043
|
break;
|
|
2108
|
-
case
|
|
2109
|
-
case
|
|
2110
|
-
|
|
2111
|
-
|
|
1044
|
+
case u.Raw:
|
|
1045
|
+
case u.Text:
|
|
1046
|
+
G(
|
|
1047
|
+
t,
|
|
1048
|
+
r,
|
|
1049
|
+
i,
|
|
1050
|
+
a,
|
|
2112
1051
|
l,
|
|
2113
|
-
o,
|
|
2114
1052
|
h,
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
f,
|
|
2118
|
-
i.page.defaultFontSize > 0
|
|
1053
|
+
p,
|
|
1054
|
+
g.page.defaultFontSize > 0
|
|
2119
1055
|
// Using validOptions here if needed, or just true for justify
|
|
2120
1056
|
);
|
|
2121
1057
|
break;
|
|
2122
1058
|
default:
|
|
2123
1059
|
console.warn(
|
|
2124
|
-
`Warning: Unsupported element type encountered: ${
|
|
1060
|
+
`Warning: Unsupported element type encountered: ${r.type}.
|
|
2125
1061
|
If you believe this element type should be supported, please create an issue at:
|
|
2126
1062
|
https://github.com/JeelGajera/jspdf-md-renderer/issues
|
|
2127
1063
|
with details of the element and expected behavior. Thanks for helping to improve this library!`
|
|
@@ -2129,11 +1065,11 @@ const xe = (e, t, n) => {
|
|
|
2129
1065
|
break;
|
|
2130
1066
|
}
|
|
2131
1067
|
};
|
|
2132
|
-
for (const
|
|
2133
|
-
|
|
2134
|
-
|
|
1068
|
+
for (const r of c)
|
|
1069
|
+
l(r);
|
|
1070
|
+
g.endCursorYHandler(e.Y);
|
|
2135
1071
|
};
|
|
2136
1072
|
export {
|
|
2137
|
-
|
|
2138
|
-
|
|
1073
|
+
j as MdTextParser,
|
|
1074
|
+
it as MdTextRender
|
|
2139
1075
|
};
|