react-vector-pdf 0.5.0 → 0.6.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 +249 -27
- package/dist/index.d.ts +27 -1
- package/dist/react-vector-pdf.js +747 -585
- package/package.json +2 -2
package/dist/react-vector-pdf.js
CHANGED
|
@@ -1,263 +1,263 @@
|
|
|
1
|
-
import
|
|
1
|
+
import $, { createContext as ct, useContext as ft, useState as lt } from "react";
|
|
2
2
|
import { jsPDF as et } from "jspdf";
|
|
3
|
-
var K = { exports: {} },
|
|
3
|
+
var K = { exports: {} }, Q = {};
|
|
4
4
|
var rt;
|
|
5
|
-
function
|
|
6
|
-
if (rt) return
|
|
5
|
+
function ht() {
|
|
6
|
+
if (rt) return Q;
|
|
7
7
|
rt = 1;
|
|
8
8
|
var n = /* @__PURE__ */ Symbol.for("react.transitional.element"), t = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
9
|
-
function r(
|
|
10
|
-
var
|
|
11
|
-
if (
|
|
12
|
-
|
|
13
|
-
for (var
|
|
14
|
-
|
|
15
|
-
} else
|
|
16
|
-
return
|
|
9
|
+
function r(a, i, s) {
|
|
10
|
+
var e = null;
|
|
11
|
+
if (s !== void 0 && (e = "" + s), i.key !== void 0 && (e = "" + i.key), "key" in i) {
|
|
12
|
+
s = {};
|
|
13
|
+
for (var f in i)
|
|
14
|
+
f !== "key" && (s[f] = i[f]);
|
|
15
|
+
} else s = i;
|
|
16
|
+
return i = s.ref, {
|
|
17
17
|
$$typeof: n,
|
|
18
|
-
type:
|
|
19
|
-
key:
|
|
20
|
-
ref:
|
|
21
|
-
props:
|
|
18
|
+
type: a,
|
|
19
|
+
key: e,
|
|
20
|
+
ref: i !== void 0 ? i : null,
|
|
21
|
+
props: s
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
return
|
|
24
|
+
return Q.Fragment = t, Q.jsx = r, Q.jsxs = r, Q;
|
|
25
25
|
}
|
|
26
|
-
var
|
|
26
|
+
var Z = {};
|
|
27
27
|
var ot;
|
|
28
|
-
function
|
|
28
|
+
function ut() {
|
|
29
29
|
return ot || (ot = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
30
|
-
function n(
|
|
31
|
-
if (
|
|
32
|
-
if (typeof
|
|
33
|
-
return
|
|
34
|
-
if (typeof
|
|
35
|
-
switch (
|
|
30
|
+
function n(o) {
|
|
31
|
+
if (o == null) return null;
|
|
32
|
+
if (typeof o == "function")
|
|
33
|
+
return o.$$typeof === E ? null : o.displayName || o.name || null;
|
|
34
|
+
if (typeof o == "string") return o;
|
|
35
|
+
switch (o) {
|
|
36
36
|
case d:
|
|
37
37
|
return "Fragment";
|
|
38
|
-
case
|
|
38
|
+
case L:
|
|
39
39
|
return "Profiler";
|
|
40
|
-
case
|
|
40
|
+
case P:
|
|
41
41
|
return "StrictMode";
|
|
42
|
-
case
|
|
42
|
+
case X:
|
|
43
43
|
return "Suspense";
|
|
44
|
-
case
|
|
44
|
+
case M:
|
|
45
45
|
return "SuspenseList";
|
|
46
|
-
case
|
|
46
|
+
case A:
|
|
47
47
|
return "Activity";
|
|
48
48
|
}
|
|
49
|
-
if (typeof
|
|
50
|
-
switch (typeof
|
|
49
|
+
if (typeof o == "object")
|
|
50
|
+
switch (typeof o.tag == "number" && console.error(
|
|
51
51
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
52
|
-
),
|
|
53
|
-
case
|
|
52
|
+
), o.$$typeof) {
|
|
53
|
+
case w:
|
|
54
54
|
return "Portal";
|
|
55
|
-
case N:
|
|
56
|
-
return e.displayName || "Context";
|
|
57
55
|
case j:
|
|
58
|
-
return
|
|
59
|
-
case
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return
|
|
64
|
-
case
|
|
65
|
-
|
|
56
|
+
return o.displayName || "Context";
|
|
57
|
+
case y:
|
|
58
|
+
return (o._context.displayName || "Context") + ".Consumer";
|
|
59
|
+
case I:
|
|
60
|
+
var c = o.render;
|
|
61
|
+
return o = o.displayName, o || (o = c.displayName || c.name || "", o = o !== "" ? "ForwardRef(" + o + ")" : "ForwardRef"), o;
|
|
62
|
+
case J:
|
|
63
|
+
return c = o.displayName || null, c !== null ? c : n(o.type) || "Memo";
|
|
64
|
+
case S:
|
|
65
|
+
c = o._payload, o = o._init;
|
|
66
66
|
try {
|
|
67
|
-
return n(
|
|
67
|
+
return n(o(c));
|
|
68
68
|
} catch {
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
return null;
|
|
72
72
|
}
|
|
73
|
-
function t(
|
|
74
|
-
return "" +
|
|
73
|
+
function t(o) {
|
|
74
|
+
return "" + o;
|
|
75
75
|
}
|
|
76
|
-
function r(
|
|
76
|
+
function r(o) {
|
|
77
77
|
try {
|
|
78
|
-
t(
|
|
79
|
-
var
|
|
78
|
+
t(o);
|
|
79
|
+
var c = !1;
|
|
80
80
|
} catch {
|
|
81
|
-
|
|
81
|
+
c = !0;
|
|
82
82
|
}
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
var
|
|
86
|
-
return
|
|
87
|
-
|
|
83
|
+
if (c) {
|
|
84
|
+
c = console;
|
|
85
|
+
var b = c.error, C = typeof Symbol == "function" && Symbol.toStringTag && o[Symbol.toStringTag] || o.constructor.name || "Object";
|
|
86
|
+
return b.call(
|
|
87
|
+
c,
|
|
88
88
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
89
|
-
|
|
90
|
-
), t(
|
|
89
|
+
C
|
|
90
|
+
), t(o);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
if (
|
|
95
|
-
if (typeof
|
|
93
|
+
function a(o) {
|
|
94
|
+
if (o === d) return "<>";
|
|
95
|
+
if (typeof o == "object" && o !== null && o.$$typeof === S)
|
|
96
96
|
return "<...>";
|
|
97
97
|
try {
|
|
98
|
-
var
|
|
99
|
-
return
|
|
98
|
+
var c = n(o);
|
|
99
|
+
return c ? "<" + c + ">" : "<...>";
|
|
100
100
|
} catch {
|
|
101
101
|
return "<...>";
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
var
|
|
106
|
-
return
|
|
104
|
+
function i() {
|
|
105
|
+
var o = Y.A;
|
|
106
|
+
return o === null ? null : o.getOwner();
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function s() {
|
|
109
109
|
return Error("react-stack-top-frame");
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
if (
|
|
113
|
-
var
|
|
114
|
-
if (
|
|
111
|
+
function e(o) {
|
|
112
|
+
if (z.call(o, "key")) {
|
|
113
|
+
var c = Object.getOwnPropertyDescriptor(o, "key").get;
|
|
114
|
+
if (c && c.isReactWarning) return !1;
|
|
115
115
|
}
|
|
116
|
-
return
|
|
116
|
+
return o.key !== void 0;
|
|
117
117
|
}
|
|
118
|
-
function
|
|
119
|
-
function
|
|
120
|
-
|
|
118
|
+
function f(o, c) {
|
|
119
|
+
function b() {
|
|
120
|
+
D || (D = !0, console.error(
|
|
121
121
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
122
|
-
|
|
122
|
+
c
|
|
123
123
|
));
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
get:
|
|
125
|
+
b.isReactWarning = !0, Object.defineProperty(o, "key", {
|
|
126
|
+
get: b,
|
|
127
127
|
configurable: !0
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
var
|
|
132
|
-
return
|
|
130
|
+
function u() {
|
|
131
|
+
var o = n(this.type);
|
|
132
|
+
return k[o] || (k[o] = !0, console.error(
|
|
133
133
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
134
|
-
)),
|
|
134
|
+
)), o = this.props.ref, o !== void 0 ? o : null;
|
|
135
135
|
}
|
|
136
|
-
function p(
|
|
137
|
-
var
|
|
138
|
-
return
|
|
139
|
-
$$typeof:
|
|
140
|
-
type:
|
|
141
|
-
key:
|
|
142
|
-
props:
|
|
143
|
-
_owner:
|
|
144
|
-
}, (
|
|
136
|
+
function p(o, c, b, C, F, N) {
|
|
137
|
+
var T = b.ref;
|
|
138
|
+
return o = {
|
|
139
|
+
$$typeof: m,
|
|
140
|
+
type: o,
|
|
141
|
+
key: c,
|
|
142
|
+
props: b,
|
|
143
|
+
_owner: C
|
|
144
|
+
}, (T !== void 0 ? T : null) !== null ? Object.defineProperty(o, "ref", {
|
|
145
145
|
enumerable: !1,
|
|
146
|
-
get:
|
|
147
|
-
}) : Object.defineProperty(
|
|
146
|
+
get: u
|
|
147
|
+
}) : Object.defineProperty(o, "ref", { enumerable: !1, value: null }), o._store = {}, Object.defineProperty(o._store, "validated", {
|
|
148
148
|
configurable: !1,
|
|
149
149
|
enumerable: !1,
|
|
150
150
|
writable: !0,
|
|
151
151
|
value: 0
|
|
152
|
-
}), Object.defineProperty(
|
|
152
|
+
}), Object.defineProperty(o, "_debugInfo", {
|
|
153
153
|
configurable: !1,
|
|
154
154
|
enumerable: !1,
|
|
155
155
|
writable: !0,
|
|
156
156
|
value: null
|
|
157
|
-
}), Object.defineProperty(
|
|
157
|
+
}), Object.defineProperty(o, "_debugStack", {
|
|
158
158
|
configurable: !1,
|
|
159
159
|
enumerable: !1,
|
|
160
160
|
writable: !0,
|
|
161
|
-
value:
|
|
162
|
-
}), Object.defineProperty(
|
|
161
|
+
value: F
|
|
162
|
+
}), Object.defineProperty(o, "_debugTask", {
|
|
163
163
|
configurable: !1,
|
|
164
164
|
enumerable: !1,
|
|
165
165
|
writable: !0,
|
|
166
|
-
value:
|
|
167
|
-
}), Object.freeze && (Object.freeze(
|
|
166
|
+
value: N
|
|
167
|
+
}), Object.freeze && (Object.freeze(o.props), Object.freeze(o)), o;
|
|
168
168
|
}
|
|
169
|
-
function l(
|
|
170
|
-
var
|
|
171
|
-
if (
|
|
172
|
-
if (
|
|
173
|
-
if (
|
|
174
|
-
for (
|
|
175
|
-
|
|
176
|
-
Object.freeze && Object.freeze(
|
|
169
|
+
function l(o, c, b, C, F, N) {
|
|
170
|
+
var T = c.children;
|
|
171
|
+
if (T !== void 0)
|
|
172
|
+
if (C)
|
|
173
|
+
if (v(T)) {
|
|
174
|
+
for (C = 0; C < T.length; C++)
|
|
175
|
+
x(T[C]);
|
|
176
|
+
Object.freeze && Object.freeze(T);
|
|
177
177
|
} else
|
|
178
178
|
console.error(
|
|
179
179
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
180
180
|
);
|
|
181
|
-
else
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
var
|
|
185
|
-
return
|
|
181
|
+
else x(T);
|
|
182
|
+
if (z.call(c, "key")) {
|
|
183
|
+
T = n(o);
|
|
184
|
+
var B = Object.keys(c).filter(function(O) {
|
|
185
|
+
return O !== "key";
|
|
186
186
|
});
|
|
187
|
-
|
|
187
|
+
C = 0 < B.length ? "{key: someKey, " + B.join(": ..., ") + ": ...}" : "{key: someKey}", R[T + C] || (B = 0 < B.length ? "{" + B.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
188
188
|
`A props object containing a "key" prop is being spread into JSX:
|
|
189
189
|
let props = %s;
|
|
190
190
|
<%s {...props} />
|
|
191
191
|
React keys must be passed directly to JSX without using spread:
|
|
192
192
|
let props = %s;
|
|
193
193
|
<%s key={someKey} {...props} />`,
|
|
194
|
-
g,
|
|
195
194
|
C,
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
T,
|
|
196
|
+
B,
|
|
197
|
+
T
|
|
198
|
+
), R[T + C] = !0);
|
|
199
199
|
}
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
for (var
|
|
203
|
-
|
|
204
|
-
} else
|
|
205
|
-
return
|
|
206
|
-
|
|
207
|
-
typeof
|
|
200
|
+
if (T = null, b !== void 0 && (r(b), T = "" + b), e(c) && (r(c.key), T = "" + c.key), "key" in c) {
|
|
201
|
+
b = {};
|
|
202
|
+
for (var G in c)
|
|
203
|
+
G !== "key" && (b[G] = c[G]);
|
|
204
|
+
} else b = c;
|
|
205
|
+
return T && f(
|
|
206
|
+
b,
|
|
207
|
+
typeof o == "function" ? o.displayName || o.name || "Unknown" : o
|
|
208
208
|
), p(
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
209
|
+
o,
|
|
210
|
+
T,
|
|
211
|
+
b,
|
|
212
|
+
i(),
|
|
213
|
+
F,
|
|
214
|
+
N
|
|
215
215
|
);
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
|
|
217
|
+
function x(o) {
|
|
218
|
+
h(o) ? o._store && (o._store.validated = 1) : typeof o == "object" && o !== null && o.$$typeof === S && (o._payload.status === "fulfilled" ? h(o._payload.value) && o._payload.value._store && (o._payload.value._store.validated = 1) : o._store && (o._store.validated = 1));
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
return typeof
|
|
220
|
+
function h(o) {
|
|
221
|
+
return typeof o == "object" && o !== null && o.$$typeof === m;
|
|
222
222
|
}
|
|
223
|
-
var
|
|
223
|
+
var g = $, m = /* @__PURE__ */ Symbol.for("react.transitional.element"), w = /* @__PURE__ */ Symbol.for("react.portal"), d = /* @__PURE__ */ Symbol.for("react.fragment"), P = /* @__PURE__ */ Symbol.for("react.strict_mode"), L = /* @__PURE__ */ Symbol.for("react.profiler"), y = /* @__PURE__ */ Symbol.for("react.consumer"), j = /* @__PURE__ */ Symbol.for("react.context"), I = /* @__PURE__ */ Symbol.for("react.forward_ref"), X = /* @__PURE__ */ Symbol.for("react.suspense"), M = /* @__PURE__ */ Symbol.for("react.suspense_list"), J = /* @__PURE__ */ Symbol.for("react.memo"), S = /* @__PURE__ */ Symbol.for("react.lazy"), A = /* @__PURE__ */ Symbol.for("react.activity"), E = /* @__PURE__ */ Symbol.for("react.client.reference"), Y = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, z = Object.prototype.hasOwnProperty, v = Array.isArray, W = console.createTask ? console.createTask : function() {
|
|
224
224
|
return null;
|
|
225
225
|
};
|
|
226
|
-
|
|
227
|
-
react_stack_bottom_frame: function(
|
|
228
|
-
return
|
|
226
|
+
g = {
|
|
227
|
+
react_stack_bottom_frame: function(o) {
|
|
228
|
+
return o();
|
|
229
229
|
}
|
|
230
230
|
};
|
|
231
|
-
var
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
)(),
|
|
235
|
-
|
|
236
|
-
var
|
|
231
|
+
var D, k = {}, H = g.react_stack_bottom_frame.bind(
|
|
232
|
+
g,
|
|
233
|
+
s
|
|
234
|
+
)(), _ = W(a(s)), R = {};
|
|
235
|
+
Z.Fragment = d, Z.jsx = function(o, c, b) {
|
|
236
|
+
var C = 1e4 > Y.recentlyCreatedOwnerStacks++;
|
|
237
237
|
return l(
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
o,
|
|
239
|
+
c,
|
|
240
|
+
b,
|
|
241
241
|
!1,
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
C ? Error("react-stack-top-frame") : H,
|
|
243
|
+
C ? W(a(o)) : _
|
|
244
244
|
);
|
|
245
|
-
},
|
|
246
|
-
var
|
|
245
|
+
}, Z.jsxs = function(o, c, b) {
|
|
246
|
+
var C = 1e4 > Y.recentlyCreatedOwnerStacks++;
|
|
247
247
|
return l(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
o,
|
|
249
|
+
c,
|
|
250
|
+
b,
|
|
251
251
|
!0,
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
C ? Error("react-stack-top-frame") : H,
|
|
253
|
+
C ? W(a(o)) : _
|
|
254
254
|
);
|
|
255
255
|
};
|
|
256
|
-
})()),
|
|
256
|
+
})()), Z;
|
|
257
257
|
}
|
|
258
258
|
var nt;
|
|
259
259
|
function dt() {
|
|
260
|
-
return nt || (nt = 1, process.env.NODE_ENV === "production" ? K.exports =
|
|
260
|
+
return nt || (nt = 1, process.env.NODE_ENV === "production" ? K.exports = ht() : K.exports = ut()), K.exports;
|
|
261
261
|
}
|
|
262
262
|
var U = dt();
|
|
263
263
|
function tt(n) {
|
|
@@ -268,19 +268,29 @@ function tt(n) {
|
|
|
268
268
|
left: n.left ?? 0
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
|
-
function
|
|
272
|
-
|
|
273
|
-
if (
|
|
274
|
-
const r =
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
271
|
+
function q(n) {
|
|
272
|
+
if (!n) return null;
|
|
273
|
+
if (n.startsWith("#")) {
|
|
274
|
+
const r = n.replace("#", "");
|
|
275
|
+
if (r.length === 3) {
|
|
276
|
+
const a = parseInt(r[0] + r[0], 16), i = parseInt(r[1] + r[1], 16), s = parseInt(r[2] + r[2], 16);
|
|
277
|
+
return [a, i, s, 1];
|
|
278
|
+
}
|
|
279
|
+
if (r.length === 6) {
|
|
280
|
+
const a = parseInt(r.slice(0, 2), 16), i = parseInt(r.slice(2, 4), 16), s = parseInt(r.slice(4, 6), 16);
|
|
281
|
+
return [a, i, s, 1];
|
|
282
|
+
}
|
|
283
|
+
if (r.length === 8) {
|
|
284
|
+
const a = parseInt(r.slice(0, 2), 16), i = parseInt(r.slice(2, 4), 16), s = parseInt(r.slice(4, 6), 16), e = parseInt(r.slice(6, 8), 16) / 255;
|
|
285
|
+
return [a, i, s, e];
|
|
286
|
+
}
|
|
280
287
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
288
|
+
const t = n.match(
|
|
289
|
+
/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/
|
|
290
|
+
);
|
|
291
|
+
if (t) {
|
|
292
|
+
const r = parseInt(t[1], 10), a = parseInt(t[2], 10), i = parseInt(t[3], 10), s = t[4] !== void 0 ? parseFloat(t[4]) : 1;
|
|
293
|
+
return [r, a, i, s];
|
|
284
294
|
}
|
|
285
295
|
return null;
|
|
286
296
|
}
|
|
@@ -301,22 +311,22 @@ function it(n, t = !0) {
|
|
|
301
311
|
[4, "IV"],
|
|
302
312
|
[1, "I"]
|
|
303
313
|
];
|
|
304
|
-
let
|
|
305
|
-
for (const [
|
|
306
|
-
for (;
|
|
307
|
-
|
|
308
|
-
return t ?
|
|
314
|
+
let a = n, i = "";
|
|
315
|
+
for (const [s, e] of r)
|
|
316
|
+
for (; a >= s; )
|
|
317
|
+
i += e, a -= s;
|
|
318
|
+
return t ? i : i.toLowerCase();
|
|
309
319
|
}
|
|
310
320
|
function st(n, t) {
|
|
311
321
|
return !t || t === "all" ? !0 : t === "first-only" ? n === 1 : t === "except-first" ? n > 1 : Array.isArray(t) ? t.includes(n) : !0;
|
|
312
322
|
}
|
|
313
323
|
class gt {
|
|
314
324
|
constructor(t = {}) {
|
|
315
|
-
this.cursorX = 0, this.cursorY = 0, this.contentWidth = 0, this.margin = { top: 15, right: 15, bottom: 15, left: 15 }, this.defaultFont = {
|
|
325
|
+
this.cursorX = 0, this.cursorY = 0, this.contentWidth = 0, this.reservedBottomHeight = 0, this.margin = { top: 15, right: 15, bottom: 15, left: 15 }, this.defaultFont = {
|
|
316
326
|
name: void 0,
|
|
317
327
|
style: "normal",
|
|
318
328
|
size: 12
|
|
319
|
-
}, this.defaultColor = "#111827", this.defaultLineHeight = 1.25, this.pendingTasks = /* @__PURE__ */ new Set(), this.opQueue = Promise.resolve(), this.generation = 0, this.recurringItems = [], this.options = t, this.margin = t.margin ?? this.margin, this.defaultFont = {
|
|
329
|
+
}, this.defaultColor = "#111827", this.defaultLineHeight = 1.25, this.pendingTasks = /* @__PURE__ */ new Set(), this.opQueue = Promise.resolve(), this.generation = 0, this.recordingStack = [], this.recurringItems = [], this.indentStack = [], this.currentIndent = { left: 0, right: 0 }, this.options = t, this.margin = t.margin ?? this.margin, this.defaultFont = {
|
|
320
330
|
name: t.font?.name,
|
|
321
331
|
style: t.font?.style ?? "normal",
|
|
322
332
|
size: t.font?.size ?? 12
|
|
@@ -326,6 +336,22 @@ class gt {
|
|
|
326
336
|
orientation: t.orientation ?? "p"
|
|
327
337
|
}), this.pageWidth = this.pdf.internal.pageSize.getWidth(), this.pageHeight = this.pdf.internal.pageSize.getHeight(), this.resetFlowCursor(), this.applyBaseFont();
|
|
328
338
|
}
|
|
339
|
+
// ... getters ...
|
|
340
|
+
// (Keeping getters omitted for brevity in replace block if possible, but replace_file_content needs context)
|
|
341
|
+
// I will target the variable declaration area specifically.
|
|
342
|
+
// Implementation of Stack Methods
|
|
343
|
+
startRecording() {
|
|
344
|
+
this.recordingStack.push([]);
|
|
345
|
+
}
|
|
346
|
+
stopRecording() {
|
|
347
|
+
return this.recordingStack.pop() || [];
|
|
348
|
+
}
|
|
349
|
+
playback(t) {
|
|
350
|
+
t.forEach((r) => r());
|
|
351
|
+
}
|
|
352
|
+
drawOp(t) {
|
|
353
|
+
this.recordingStack.length > 0 ? this.recordingStack[this.recordingStack.length - 1].push(t) : t();
|
|
354
|
+
}
|
|
329
355
|
get instance() {
|
|
330
356
|
return this.pdf;
|
|
331
357
|
}
|
|
@@ -345,7 +371,7 @@ class gt {
|
|
|
345
371
|
return this.margin.top;
|
|
346
372
|
}
|
|
347
373
|
get contentBottom() {
|
|
348
|
-
return this.pageHeight - this.margin.bottom;
|
|
374
|
+
return this.pageHeight - this.margin.bottom - this.reservedBottomHeight;
|
|
349
375
|
}
|
|
350
376
|
get contentHeight() {
|
|
351
377
|
return this.contentBottom - this.contentTop;
|
|
@@ -359,8 +385,18 @@ class gt {
|
|
|
359
385
|
get baseLineHeight() {
|
|
360
386
|
return this.defaultLineHeight;
|
|
361
387
|
}
|
|
388
|
+
setReservedHeight(t) {
|
|
389
|
+
this.reservedBottomHeight = t;
|
|
390
|
+
}
|
|
391
|
+
pushIndent(t, r) {
|
|
392
|
+
this.indentStack.push({ ...this.currentIndent }), this.currentIndent.left += t, this.currentIndent.right += r, this.cursorX += t, this.contentWidth = this.pageWidth - this.margin.left - this.margin.right - this.currentIndent.left - this.currentIndent.right;
|
|
393
|
+
}
|
|
394
|
+
popIndent() {
|
|
395
|
+
const t = this.indentStack.pop();
|
|
396
|
+
t && (this.currentIndent.left - t.left, this.currentIndent = t, this.contentWidth = this.pageWidth - this.margin.left - this.margin.right - this.currentIndent.left - this.currentIndent.right);
|
|
397
|
+
}
|
|
362
398
|
resetFlowCursor() {
|
|
363
|
-
this.cursorX = this.margin.left, this.cursorY = this.margin.top, this.contentWidth = this.pageWidth - this.margin.left - this.margin.right;
|
|
399
|
+
this.cursorX = this.margin.left + this.currentIndent.left, this.cursorY = this.margin.top, this.contentWidth = this.pageWidth - this.margin.left - this.margin.right - this.currentIndent.left - this.currentIndent.right;
|
|
364
400
|
}
|
|
365
401
|
reset() {
|
|
366
402
|
if (this.pdf = new et({
|
|
@@ -368,7 +404,7 @@ class gt {
|
|
|
368
404
|
format: this.options.format ?? "a4",
|
|
369
405
|
orientation: this.options.orientation ?? "p"
|
|
370
406
|
}), this.generation++, this.cursorX = 0, this.cursorY = 0, this.pendingTasks = /* @__PURE__ */ new Set(), this.opQueue = Promise.resolve(), this.resetFlowCursor(), this.applyBaseFont(), this.options.color) {
|
|
371
|
-
const t =
|
|
407
|
+
const t = q(this.options.color);
|
|
372
408
|
t && this.pdf.setTextColor(...t);
|
|
373
409
|
}
|
|
374
410
|
this.recurringItems = [];
|
|
@@ -377,13 +413,17 @@ class gt {
|
|
|
377
413
|
this.headerDrawer = t, this.footerDrawer = r;
|
|
378
414
|
}
|
|
379
415
|
applyBaseFont() {
|
|
380
|
-
const t = this.defaultFont.name ?? this.pdf.getFont().fontName;
|
|
381
|
-
this.
|
|
382
|
-
|
|
383
|
-
|
|
416
|
+
const t = this.defaultFont.name ?? this.pdf.getFont().fontName, r = this.defaultFont.style, a = this.defaultFont.size, i = this.defaultColor;
|
|
417
|
+
this.drawOp(() => {
|
|
418
|
+
this.pdf.setFont(t, r), this.pdf.setFontSize(a);
|
|
419
|
+
const s = q(i);
|
|
420
|
+
s && this.pdf.setTextColor(...s);
|
|
421
|
+
});
|
|
384
422
|
}
|
|
385
423
|
addPage() {
|
|
386
|
-
this.
|
|
424
|
+
this.drawOp(() => {
|
|
425
|
+
this.pdf.addPage();
|
|
426
|
+
}), this.resetFlowCursor();
|
|
387
427
|
const t = this.getPageCount();
|
|
388
428
|
for (const r of this.recurringItems)
|
|
389
429
|
st(t, r.scope) && (r.draw(), r.y + r.height > this.cursorY && (this.cursorY = r.y + r.height));
|
|
@@ -394,92 +434,101 @@ class gt {
|
|
|
394
434
|
return;
|
|
395
435
|
}
|
|
396
436
|
const r = this.getPageCount();
|
|
397
|
-
let
|
|
398
|
-
for (;
|
|
399
|
-
|
|
400
|
-
for (const
|
|
401
|
-
if (st(r,
|
|
437
|
+
let a = !0;
|
|
438
|
+
for (; a; ) {
|
|
439
|
+
a = !1;
|
|
440
|
+
for (const i of this.recurringItems)
|
|
441
|
+
if (st(r, i.scope) && this.cursorY < i.y + i.height && this.cursorY + t > i.y && (this.cursorY = i.y + i.height, a = !0, this.cursorY + t > this.contentBottom)) {
|
|
402
442
|
this.addPage();
|
|
403
443
|
return;
|
|
404
444
|
}
|
|
405
445
|
}
|
|
406
446
|
}
|
|
407
447
|
setTextStyle(t) {
|
|
408
|
-
if (t)
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
448
|
+
if (!t) return;
|
|
449
|
+
const r = t.fontSize, a = t.fontStyle, i = t.color;
|
|
450
|
+
this.drawOp(() => {
|
|
451
|
+
if (r && this.pdf.setFontSize(r), a) {
|
|
452
|
+
const s = this.pdf.getFont().fontName;
|
|
453
|
+
this.pdf.setFont(s, a);
|
|
412
454
|
}
|
|
413
|
-
if (
|
|
414
|
-
const
|
|
415
|
-
|
|
416
|
-
new this.pdf.GState({ opacity:
|
|
455
|
+
if (i) {
|
|
456
|
+
const s = q(i);
|
|
457
|
+
s && (this.pdf.setTextColor(s[0], s[1], s[2]), s[3] !== void 0 ? this.pdf.setGState(
|
|
458
|
+
new this.pdf.GState({ opacity: s[3] })
|
|
417
459
|
) : this.pdf.setGState(new this.pdf.GState({ opacity: 1 })));
|
|
418
460
|
}
|
|
419
|
-
}
|
|
461
|
+
});
|
|
420
462
|
}
|
|
421
|
-
textRaw(t, r,
|
|
422
|
-
this.setTextStyle(
|
|
423
|
-
const
|
|
424
|
-
typeof
|
|
463
|
+
textRaw(t, r, a, i, s, e = "left") {
|
|
464
|
+
this.setTextStyle(i);
|
|
465
|
+
const f = { align: e };
|
|
466
|
+
typeof s == "number" && (f.maxWidth = s), this.drawOp(() => {
|
|
467
|
+
this.pdf.text(t, r, a, f);
|
|
468
|
+
}), this.applyBaseFont();
|
|
425
469
|
}
|
|
426
|
-
box(t, r,
|
|
427
|
-
const
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
470
|
+
box(t, r, a, i, s) {
|
|
471
|
+
const e = s ?? {};
|
|
472
|
+
this.drawOp(() => {
|
|
473
|
+
if (e.borderWidth || e.borderColor || e.fillColor) {
|
|
474
|
+
if (e.fillColor) {
|
|
475
|
+
const u = q(e.fillColor);
|
|
476
|
+
u && (u[3] !== void 0 && this.pdf.setGState(
|
|
477
|
+
new this.pdf.GState({ opacity: u[3] })
|
|
478
|
+
), this.pdf.setFillColor(u[0], u[1], u[2]));
|
|
479
|
+
}
|
|
480
|
+
if ((e.borderWidth || e.borderColor) && (e.borderWidth && this.pdf.setLineWidth(e.borderWidth), e.borderColor)) {
|
|
481
|
+
const u = q(e.borderColor);
|
|
482
|
+
u && (u[3] !== void 0 && this.pdf.setGState(
|
|
483
|
+
new this.pdf.GState({ opacity: u[3] })
|
|
484
|
+
), this.pdf.setDrawColor(u[0], u[1], u[2]));
|
|
485
|
+
}
|
|
486
|
+
let f = "";
|
|
487
|
+
e.fillColor && (f += "F"), (e.borderWidth || e.borderColor) && (f += "D"), f && (e.radius ? this.pdf.roundedRect(t, r, a, i, e.radius, e.radius, f) : this.pdf.rect(t, r, a, i, f)), this.pdf.setLineWidth(0.2), this.pdf.setDrawColor(0, 0, 0), this.pdf.setGState(new this.pdf.GState({ opacity: 1 }));
|
|
440
488
|
}
|
|
441
|
-
|
|
442
|
-
}
|
|
489
|
+
});
|
|
443
490
|
}
|
|
444
|
-
line(t, r,
|
|
445
|
-
this.
|
|
491
|
+
line(t, r, a, i) {
|
|
492
|
+
this.drawOp(() => {
|
|
493
|
+
this.pdf.line(t, r, a, i);
|
|
494
|
+
});
|
|
446
495
|
}
|
|
447
496
|
async imageFromUrl(t, r = {}) {
|
|
448
|
-
const
|
|
497
|
+
const a = (async () => {
|
|
449
498
|
try {
|
|
450
|
-
const { dataUrl:
|
|
451
|
-
let l = r.w,
|
|
452
|
-
l === void 0 &&
|
|
453
|
-
const
|
|
454
|
-
let
|
|
455
|
-
if (r.y === void 0 &&
|
|
499
|
+
const { dataUrl: i, width: s, height: e } = await this.loadImageAsDataURL(t), f = 0.264583, u = s * f, p = e * f;
|
|
500
|
+
let l = r.w, x = r.h;
|
|
501
|
+
l === void 0 && x === void 0 ? (l = u, x = p) : l === void 0 && x !== void 0 ? l = x * (u / p) : x === void 0 && l !== void 0 && (x = l * (p / u));
|
|
502
|
+
const h = l ?? u, g = x ?? p;
|
|
503
|
+
let m = r.x, w = r.y ?? this.cursorY;
|
|
504
|
+
if (r.y === void 0 && w + g > this.contentBottom && (this.addPage(), w = this.cursorY), m === void 0) {
|
|
456
505
|
const d = r.align ?? "left";
|
|
457
|
-
d === "left" ?
|
|
506
|
+
d === "left" ? m = this.contentLeft : d === "center" ? m = (this.contentLeft + this.contentRight) / 2 - h / 2 : d === "right" && (m = this.contentRight - h);
|
|
458
507
|
}
|
|
459
508
|
return this.pdf.addImage(
|
|
460
|
-
|
|
509
|
+
i,
|
|
461
510
|
r.mime ?? "PNG",
|
|
511
|
+
m,
|
|
462
512
|
w,
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
return console.error("Failed to load image", t, o), { width: 0, height: 0, x: 0, y: 0 };
|
|
513
|
+
h,
|
|
514
|
+
g
|
|
515
|
+
), { width: h, height: g, x: m, y: w };
|
|
516
|
+
} catch (i) {
|
|
517
|
+
return console.error("Failed to load image", t, i), { width: 0, height: 0, x: 0, y: 0 };
|
|
469
518
|
}
|
|
470
519
|
})();
|
|
471
|
-
return this.registerTask(
|
|
520
|
+
return this.registerTask(a), a;
|
|
472
521
|
}
|
|
473
522
|
queueOperation(t) {
|
|
474
|
-
const r = this.generation,
|
|
523
|
+
const r = this.generation, a = this.opQueue.then(async () => {
|
|
475
524
|
if (this.generation === r)
|
|
476
525
|
try {
|
|
477
526
|
await t();
|
|
478
|
-
} catch (
|
|
479
|
-
console.error("Operation failed",
|
|
527
|
+
} catch (i) {
|
|
528
|
+
console.error("Operation failed", i);
|
|
480
529
|
}
|
|
481
530
|
});
|
|
482
|
-
this.opQueue =
|
|
531
|
+
this.opQueue = a, this.registerTask(a);
|
|
483
532
|
}
|
|
484
533
|
registerTask(t) {
|
|
485
534
|
this.pendingTasks.add(t), t.finally(() => {
|
|
@@ -490,30 +539,33 @@ class gt {
|
|
|
490
539
|
await Promise.all(this.pendingTasks), await this.opQueue;
|
|
491
540
|
}
|
|
492
541
|
loadImageAsDataURL(t) {
|
|
493
|
-
return new Promise((r,
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
const
|
|
497
|
-
|
|
498
|
-
const
|
|
499
|
-
if (!
|
|
500
|
-
|
|
501
|
-
dataUrl:
|
|
502
|
-
width:
|
|
503
|
-
height:
|
|
542
|
+
return new Promise((r, a) => {
|
|
543
|
+
const i = new Image();
|
|
544
|
+
i.crossOrigin = "anonymous", i.onload = () => {
|
|
545
|
+
const s = document.createElement("canvas");
|
|
546
|
+
s.width = i.width, s.height = i.height;
|
|
547
|
+
const e = s.getContext("2d");
|
|
548
|
+
if (!e) return a(new Error("Canvas 2D context not available"));
|
|
549
|
+
e.drawImage(i, 0, 0), r({
|
|
550
|
+
dataUrl: s.toDataURL("image/png"),
|
|
551
|
+
width: i.width,
|
|
552
|
+
height: i.height
|
|
504
553
|
});
|
|
505
|
-
},
|
|
554
|
+
}, i.onerror = (s) => a(s), i.src = t;
|
|
506
555
|
});
|
|
507
556
|
}
|
|
508
|
-
paragraph(t, r,
|
|
509
|
-
const
|
|
557
|
+
paragraph(t, r, a) {
|
|
558
|
+
const i = a ?? this.contentWidth;
|
|
510
559
|
this.setTextStyle(r);
|
|
511
|
-
const
|
|
560
|
+
const s = r?.lineHeight ?? this.defaultLineHeight, e = r?.fontSize ?? this.defaultFont.size, f = e * s * 0.3528, u = this.pdf.splitTextToSize(t, i), p = r?.align ?? "left";
|
|
512
561
|
let l = 0;
|
|
513
|
-
return
|
|
514
|
-
this.cursorY +
|
|
515
|
-
const
|
|
516
|
-
|
|
562
|
+
return u.forEach((x) => {
|
|
563
|
+
this.cursorY + f > this.contentBottom && this.addPage();
|
|
564
|
+
const h = this.cursorY + e * 0.3528;
|
|
565
|
+
let g = this.cursorX;
|
|
566
|
+
p === "center" ? g = this.cursorX + i / 2 : p === "right" && (g = this.cursorX + i), this.drawOp(() => {
|
|
567
|
+
this.pdf.text(x, g, h, { align: p, maxWidth: i });
|
|
568
|
+
}), this.cursorY += f, l += f;
|
|
517
569
|
}), this.cursorY += 1, this.applyBaseFont(), l;
|
|
518
570
|
}
|
|
519
571
|
moveCursor(t, r) {
|
|
@@ -539,18 +591,18 @@ class gt {
|
|
|
539
591
|
this.pdf.setPage(t);
|
|
540
592
|
}
|
|
541
593
|
}
|
|
542
|
-
measureText(t, r,
|
|
594
|
+
measureText(t, r, a) {
|
|
543
595
|
this.setTextStyle(r);
|
|
544
|
-
const
|
|
545
|
-
if (
|
|
546
|
-
const
|
|
596
|
+
const i = r?.fontSize ?? this.defaultFont.size, s = r?.lineHeight ?? this.defaultLineHeight, e = i * s * 0.3528;
|
|
597
|
+
if (a) {
|
|
598
|
+
const f = this.pdf.splitTextToSize(t, a);
|
|
547
599
|
return {
|
|
548
|
-
width:
|
|
549
|
-
height:
|
|
600
|
+
width: a,
|
|
601
|
+
height: f.length * e
|
|
550
602
|
};
|
|
551
603
|
} else {
|
|
552
|
-
const
|
|
553
|
-
return { width:
|
|
604
|
+
const f = this.pdf.getTextDimensions(t);
|
|
605
|
+
return { width: f.w, height: f.h };
|
|
554
606
|
}
|
|
555
607
|
}
|
|
556
608
|
setMetadata(t) {
|
|
@@ -564,174 +616,192 @@ class gt {
|
|
|
564
616
|
getBlobUrl() {
|
|
565
617
|
return this.applyHeaderFooter(), this.pdf.output("bloburl");
|
|
566
618
|
}
|
|
619
|
+
/**
|
|
620
|
+
* Injects a filled rectangle at the beginning of the page stream.
|
|
621
|
+
* This ensures the background is drawn BEHIND all other content on the page.
|
|
622
|
+
*/
|
|
623
|
+
injectFill(t, r, a) {
|
|
624
|
+
const s = this.pdf.internal.pages[t];
|
|
625
|
+
if (!s) return;
|
|
626
|
+
const e = this.pdf.internal.scaleFactor, f = this.pdf.internal.pageSize.getHeight(), u = r.x * e, p = r.h * e, l = r.w * e, x = (f - (r.y + r.h)) * e, h = q(a);
|
|
627
|
+
if (!h) return;
|
|
628
|
+
const g = ["q"];
|
|
629
|
+
g.push(
|
|
630
|
+
`${(h[0] / 255).toFixed(3)} ${(h[1] / 255).toFixed(3)} ${(h[2] / 255).toFixed(3)} rg`
|
|
631
|
+
), g.push(
|
|
632
|
+
`${u.toFixed(2)} ${x.toFixed(2)} ${l.toFixed(2)} ${p.toFixed(2)} re f`
|
|
633
|
+
), g.push("Q"), s && Array.isArray(s) && s.unshift(g.join(" "));
|
|
634
|
+
}
|
|
567
635
|
}
|
|
568
|
-
const at =
|
|
569
|
-
const n =
|
|
636
|
+
const at = ct(null), V = () => {
|
|
637
|
+
const n = ft(at);
|
|
570
638
|
if (!n) throw new Error("usePdf must be used within <PdfDocument>");
|
|
571
639
|
return n;
|
|
572
640
|
}, pt = ({
|
|
573
641
|
options: n,
|
|
574
642
|
header: t,
|
|
575
643
|
footer: r,
|
|
576
|
-
pageNumbers:
|
|
577
|
-
centerLabel:
|
|
578
|
-
metadata:
|
|
579
|
-
children:
|
|
580
|
-
onReady:
|
|
581
|
-
filename:
|
|
644
|
+
pageNumbers: a,
|
|
645
|
+
centerLabel: i,
|
|
646
|
+
metadata: s,
|
|
647
|
+
children: e,
|
|
648
|
+
onReady: f,
|
|
649
|
+
filename: u,
|
|
582
650
|
autoSave: p = !1
|
|
583
651
|
}) => {
|
|
584
|
-
const l =
|
|
585
|
-
return
|
|
586
|
-
|
|
587
|
-
}, [l,
|
|
588
|
-
const
|
|
589
|
-
if (!
|
|
590
|
-
const
|
|
591
|
-
l.textRaw(
|
|
592
|
-
},
|
|
593
|
-
if (!
|
|
594
|
-
const
|
|
652
|
+
const l = $.useMemo(() => new gt(n), [n]);
|
|
653
|
+
return $.useEffect(() => {
|
|
654
|
+
s && l.setMetadata(s);
|
|
655
|
+
}, [l, s]), $.useEffect(() => {
|
|
656
|
+
const x = (w, d) => !d || d === "all" ? !0 : d === "first-only" ? w === 1 : d === "except-first" ? w > 1 : Array.isArray(d) ? d.includes(w) : !0, h = (w, d) => d === "roman-upper" ? it(w, !0) : d === "roman-lower" ? it(w, !1) : String(w), g = (w, d, P) => {
|
|
657
|
+
if (!a?.enabled || !x(d, a.scope)) return;
|
|
658
|
+
const L = a.preset ?? "page-slash-total", j = (a.template ?? (L === "page-slash-total" ? "Page {page}/{total}" : L === "page-of-total" ? "Page {page} of {total}" : "{page}/{total}")).replace("{page}", h(d, a.format)).replace("{total}", h(P, a.format)), I = a.align ?? "right", X = I === "left" ? l.contentLeft + (a.offsetX ?? 0) : I === "right" ? l.contentRight - (a.offsetX ?? 0) : (l.contentLeft + l.contentRight) / 2 + (a.offsetX ?? 0), M = w === "header" ? 10 : l.height - 7, J = typeof a.y == "number" ? a.y : M;
|
|
659
|
+
l.textRaw(j, X, J, a.style, void 0, I);
|
|
660
|
+
}, m = (w, d, P) => {
|
|
661
|
+
if (!i?.enabled || !x(d, i.scope)) return;
|
|
662
|
+
const L = "center", y = (l.contentLeft + l.contentRight) / 2 + (i.offsetX ?? 0), j = w === "header" ? 10 : l.height - 7, I = typeof i.y == "number" ? i.y : j;
|
|
595
663
|
l.textRaw(
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
664
|
+
i.text,
|
|
665
|
+
y,
|
|
666
|
+
I,
|
|
667
|
+
i.style,
|
|
600
668
|
void 0,
|
|
601
|
-
|
|
669
|
+
L
|
|
602
670
|
);
|
|
603
671
|
};
|
|
604
672
|
return l.setHeaderFooter(
|
|
605
|
-
(
|
|
606
|
-
t && t(l, d,
|
|
673
|
+
(w, d, P) => {
|
|
674
|
+
t && t(l, d, P), a?.position === "header" && g("header", d, P), i?.position === "header" && m("header", d);
|
|
607
675
|
},
|
|
608
|
-
(
|
|
609
|
-
|
|
676
|
+
(w, d, P) => {
|
|
677
|
+
a?.position === "footer" && g("footer", d, P), r && r(l, d, P), i?.position === "footer" && m("footer", d);
|
|
610
678
|
}
|
|
611
679
|
), l.waitForTasks().then(() => {
|
|
612
|
-
|
|
680
|
+
f?.(l);
|
|
613
681
|
}), () => {
|
|
614
682
|
l.reset();
|
|
615
683
|
};
|
|
616
|
-
}, [l]),
|
|
617
|
-
p &&
|
|
618
|
-
}, [p,
|
|
619
|
-
},
|
|
684
|
+
}, [l]), $.useEffect(() => {
|
|
685
|
+
p && u && l.save(u);
|
|
686
|
+
}, [p, u]), /* @__PURE__ */ U.jsx(at.Provider, { value: l, children: e });
|
|
687
|
+
}, Rt = ({
|
|
620
688
|
src: n,
|
|
621
689
|
x: t,
|
|
622
690
|
y: r,
|
|
623
|
-
w:
|
|
624
|
-
h:
|
|
625
|
-
mime:
|
|
626
|
-
flow:
|
|
627
|
-
layout:
|
|
628
|
-
sizing:
|
|
691
|
+
w: a,
|
|
692
|
+
h: i,
|
|
693
|
+
mime: s = "PNG",
|
|
694
|
+
flow: e,
|
|
695
|
+
layout: f,
|
|
696
|
+
sizing: u,
|
|
629
697
|
align: p = "left",
|
|
630
698
|
showInAllPages: l,
|
|
631
|
-
scope:
|
|
699
|
+
scope: x
|
|
632
700
|
}) => {
|
|
633
|
-
const
|
|
634
|
-
return
|
|
635
|
-
const
|
|
636
|
-
let
|
|
637
|
-
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
const
|
|
641
|
-
const
|
|
642
|
-
return await
|
|
643
|
-
x:
|
|
644
|
-
y:
|
|
645
|
-
w,
|
|
646
|
-
h:
|
|
647
|
-
mime:
|
|
701
|
+
const h = V();
|
|
702
|
+
return $.useLayoutEffect(() => {
|
|
703
|
+
const g = f === "flow" || e === !0 || t === void 0 && r === void 0 && f !== "fixed";
|
|
704
|
+
let m = a;
|
|
705
|
+
u === "fill" && (m = h.contentAreaWidth);
|
|
706
|
+
const w = t, d = r;
|
|
707
|
+
h.queueOperation(async () => {
|
|
708
|
+
const P = h.getCursor(), y = await (async (j, I) => {
|
|
709
|
+
const X = w, M = d;
|
|
710
|
+
return await h.imageFromUrl(n, {
|
|
711
|
+
x: X,
|
|
712
|
+
y: M,
|
|
713
|
+
w: m,
|
|
714
|
+
h: i,
|
|
715
|
+
mime: s,
|
|
648
716
|
align: p
|
|
649
717
|
});
|
|
650
718
|
})();
|
|
651
|
-
|
|
719
|
+
g && y && h.moveCursor(0, y.height + 2), l && y && h.registerRecurringItem({
|
|
652
720
|
draw: () => {
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
x,
|
|
656
|
-
y:
|
|
657
|
-
w,
|
|
658
|
-
h:
|
|
659
|
-
mime:
|
|
721
|
+
h.queueOperation(async () => {
|
|
722
|
+
g && h.setCursor(P.x, P.y), await h.imageFromUrl(n, {
|
|
723
|
+
x: w,
|
|
724
|
+
y: g ? P.y : d,
|
|
725
|
+
w: m,
|
|
726
|
+
h: i,
|
|
727
|
+
mime: s,
|
|
660
728
|
align: p
|
|
661
729
|
});
|
|
662
730
|
});
|
|
663
731
|
},
|
|
664
|
-
scope:
|
|
665
|
-
y:
|
|
666
|
-
height:
|
|
732
|
+
scope: x ?? "all",
|
|
733
|
+
y: g ? P.y : d ?? 0,
|
|
734
|
+
height: y.height + 2
|
|
667
735
|
});
|
|
668
736
|
});
|
|
669
737
|
}, [
|
|
670
|
-
|
|
738
|
+
h,
|
|
671
739
|
n,
|
|
672
740
|
t,
|
|
673
741
|
r,
|
|
742
|
+
a,
|
|
674
743
|
i,
|
|
675
|
-
o,
|
|
676
|
-
f,
|
|
677
744
|
s,
|
|
678
|
-
|
|
679
|
-
|
|
745
|
+
e,
|
|
746
|
+
f,
|
|
747
|
+
u,
|
|
680
748
|
p,
|
|
681
749
|
l,
|
|
682
|
-
|
|
750
|
+
x
|
|
683
751
|
]), null;
|
|
684
|
-
},
|
|
752
|
+
}, St = ({
|
|
685
753
|
items: n,
|
|
686
754
|
ordered: t = !1,
|
|
687
755
|
style: r,
|
|
688
|
-
indent:
|
|
689
|
-
markerWidth:
|
|
690
|
-
spacing:
|
|
756
|
+
indent: a = 5,
|
|
757
|
+
markerWidth: i = 5,
|
|
758
|
+
spacing: s = 2
|
|
691
759
|
}) => {
|
|
692
|
-
const
|
|
693
|
-
return
|
|
694
|
-
|
|
695
|
-
n.forEach((
|
|
696
|
-
const p = t ? `${
|
|
697
|
-
|
|
760
|
+
const e = V();
|
|
761
|
+
return $.useLayoutEffect(() => {
|
|
762
|
+
e.queueOperation(() => {
|
|
763
|
+
n.forEach((f, u) => {
|
|
764
|
+
const p = t ? `${u + 1}.` : "•", l = r?.fontSize ?? e.baseFont.size, x = l * 1.2 * 0.3528;
|
|
765
|
+
e.getCursor().y + x > e.contentBottom && e.addPage();
|
|
766
|
+
const g = e.getCursor().y, m = e.getCursor().x, w = m + a + i, d = g + l * 0.3528;
|
|
767
|
+
e.textRaw(
|
|
698
768
|
p,
|
|
699
|
-
m +
|
|
700
|
-
|
|
769
|
+
m + a,
|
|
770
|
+
d,
|
|
701
771
|
r,
|
|
702
|
-
|
|
772
|
+
i,
|
|
703
773
|
"right"
|
|
704
|
-
),
|
|
705
|
-
const
|
|
706
|
-
|
|
707
|
-
const
|
|
708
|
-
|
|
774
|
+
), e.setCursor(w, g);
|
|
775
|
+
const P = e.contentRight - w;
|
|
776
|
+
e.paragraph(f, r, P);
|
|
777
|
+
const L = e.getCursor().y;
|
|
778
|
+
e.setCursor(m, L + s);
|
|
709
779
|
});
|
|
710
780
|
});
|
|
711
|
-
}, [
|
|
712
|
-
},
|
|
781
|
+
}, [e, n, t, r, a, i, s]), null;
|
|
782
|
+
}, Tt = ({
|
|
713
783
|
width: n = "inherit",
|
|
714
784
|
height: t = "inherit",
|
|
715
785
|
className: r,
|
|
716
|
-
style:
|
|
717
|
-
iframeClassName:
|
|
718
|
-
iframeStyle:
|
|
719
|
-
...
|
|
786
|
+
style: a,
|
|
787
|
+
iframeClassName: i,
|
|
788
|
+
iframeStyle: s,
|
|
789
|
+
...e
|
|
720
790
|
}) => {
|
|
721
|
-
const [
|
|
722
|
-
const
|
|
723
|
-
|
|
791
|
+
const [f, u] = lt(null), p = (l) => {
|
|
792
|
+
const x = l.getBlobUrl();
|
|
793
|
+
u(x.toString());
|
|
724
794
|
};
|
|
725
|
-
return /* @__PURE__ */ U.jsxs("div", { className: r, style: { width: n, height: t, ...
|
|
726
|
-
/* @__PURE__ */ U.jsx("div", { style: { display: "none" }, children: /* @__PURE__ */ U.jsx(pt, { ...
|
|
727
|
-
|
|
795
|
+
return /* @__PURE__ */ U.jsxs("div", { className: r, style: { width: n, height: t, ...a }, children: [
|
|
796
|
+
/* @__PURE__ */ U.jsx("div", { style: { display: "none" }, children: /* @__PURE__ */ U.jsx(pt, { ...e, onReady: p, autoSave: !1, children: e.children }) }),
|
|
797
|
+
f ? /* @__PURE__ */ U.jsx(
|
|
728
798
|
"iframe",
|
|
729
799
|
{
|
|
730
|
-
src:
|
|
800
|
+
src: f,
|
|
731
801
|
width: "100%",
|
|
732
802
|
height: "100%",
|
|
733
|
-
className:
|
|
734
|
-
style: { border: "none", ...
|
|
803
|
+
className: i,
|
|
804
|
+
style: { border: "none", ...s },
|
|
735
805
|
title: "PDF Preview"
|
|
736
806
|
}
|
|
737
807
|
) : /* @__PURE__ */ U.jsx(
|
|
@@ -750,237 +820,286 @@ const at = ft(null), $ = () => {
|
|
|
750
820
|
}
|
|
751
821
|
)
|
|
752
822
|
] });
|
|
753
|
-
},
|
|
823
|
+
}, Pt = ({
|
|
754
824
|
data: n,
|
|
755
825
|
columns: t,
|
|
756
826
|
width: r = "100%",
|
|
757
|
-
borderWidth:
|
|
758
|
-
borderColor:
|
|
759
|
-
cellPadding:
|
|
760
|
-
headerStyle:
|
|
761
|
-
rowStyle:
|
|
762
|
-
alternateRowStyle:
|
|
827
|
+
borderWidth: a = 0.1,
|
|
828
|
+
borderColor: i = "#000000",
|
|
829
|
+
cellPadding: s = 2,
|
|
830
|
+
headerStyle: e,
|
|
831
|
+
rowStyle: f,
|
|
832
|
+
alternateRowStyle: u,
|
|
763
833
|
headerHeight: p,
|
|
764
834
|
repeatHeader: l = !0,
|
|
765
|
-
striped:
|
|
835
|
+
striped: x = !1
|
|
766
836
|
}) => {
|
|
767
|
-
const
|
|
768
|
-
return
|
|
769
|
-
|
|
770
|
-
const
|
|
771
|
-
if (
|
|
772
|
-
const
|
|
773
|
-
for (let
|
|
774
|
-
|
|
837
|
+
const h = V();
|
|
838
|
+
return $.useLayoutEffect(() => {
|
|
839
|
+
h.queueOperation(() => {
|
|
840
|
+
const g = typeof r == "number" ? r : parseFloat(r) / 100 * h.contentAreaWidth, m = t.map((S) => typeof S.width == "number" ? S.width : typeof S.width == "string" && S.width.endsWith("%") ? parseFloat(S.width) / 100 * g : 0), w = m.reduce((S, A) => S + A, 0), d = Math.max(0, g - w), P = m.filter((S) => S === 0).length;
|
|
841
|
+
if (P > 0) {
|
|
842
|
+
const S = d / P;
|
|
843
|
+
for (let A = 0; A < m.length; A++)
|
|
844
|
+
m[A] === 0 && (m[A] = S);
|
|
775
845
|
}
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
borderColor:
|
|
779
|
-
borderWidth:
|
|
780
|
-
fillColor:
|
|
846
|
+
const L = (S, A, E, Y, z, v, W = "left", D = !0) => {
|
|
847
|
+
D && h.box(A, E, Y, z, {
|
|
848
|
+
borderColor: v.borderColor ?? i,
|
|
849
|
+
borderWidth: v.borderWidth ?? a,
|
|
850
|
+
fillColor: v.fillColor
|
|
781
851
|
});
|
|
782
|
-
const
|
|
783
|
-
top:
|
|
784
|
-
right:
|
|
785
|
-
bottom:
|
|
786
|
-
left:
|
|
787
|
-
},
|
|
788
|
-
let
|
|
789
|
-
|
|
790
|
-
let
|
|
791
|
-
const
|
|
792
|
-
|
|
793
|
-
let
|
|
794
|
-
|
|
795
|
-
}),
|
|
852
|
+
const k = tt(v.padding ?? s), H = {
|
|
853
|
+
top: v.paddingTop ?? k.top,
|
|
854
|
+
right: v.paddingRight ?? k.right,
|
|
855
|
+
bottom: v.paddingBottom ?? k.bottom,
|
|
856
|
+
left: v.paddingLeft ?? k.left
|
|
857
|
+
}, _ = Y - H.left - H.right, R = h.instance.splitTextToSize(S, _, v), o = (v.fontSize ?? h.baseFont.size) * (v.lineHeight ?? h.baseLineHeight) * 0.3528, c = (v.fontSize ?? h.baseFont.size) * 0.3528, b = R.length * o, C = z - H.top - H.bottom;
|
|
858
|
+
let F = 0;
|
|
859
|
+
v.verticalAlign === "middle" ? F = Math.max(0, (C - b) / 2) : v.verticalAlign === "bottom" && (F = Math.max(0, C - b));
|
|
860
|
+
let N = E + H.top + F + c;
|
|
861
|
+
const T = v.align ?? W, B = h.getCursor();
|
|
862
|
+
R.forEach((G) => {
|
|
863
|
+
let O = A + H.left;
|
|
864
|
+
T === "center" ? O = A + Y / 2 : T === "right" && (O = A + Y - H.right), h.textRaw(G, O, N, v, void 0, T), N += o;
|
|
865
|
+
}), h.setCursor(B.x, B.y);
|
|
796
866
|
};
|
|
797
|
-
let
|
|
798
|
-
const
|
|
799
|
-
|
|
800
|
-
let
|
|
801
|
-
t.forEach((
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
),
|
|
812
|
-
}),
|
|
813
|
-
const
|
|
814
|
-
const
|
|
815
|
-
top:
|
|
816
|
-
right:
|
|
817
|
-
bottom:
|
|
818
|
-
left:
|
|
819
|
-
},
|
|
820
|
-
return
|
|
867
|
+
let y = h.getCursor().y;
|
|
868
|
+
const j = h.getCursor().x, I = p ?? 10;
|
|
869
|
+
y + I > h.contentBottom && (h.addPage(), y = h.getCursor().y);
|
|
870
|
+
let X = j;
|
|
871
|
+
t.forEach((S, A) => {
|
|
872
|
+
const E = m[A];
|
|
873
|
+
L(
|
|
874
|
+
S.header ?? "",
|
|
875
|
+
X,
|
|
876
|
+
y,
|
|
877
|
+
E,
|
|
878
|
+
I,
|
|
879
|
+
e ?? { fontStyle: "bold" },
|
|
880
|
+
S.align ?? "left"
|
|
881
|
+
), X += E;
|
|
882
|
+
}), y += I, h.setCursor(j, y);
|
|
883
|
+
const M = (S, A, E) => {
|
|
884
|
+
const Y = tt(s), z = {
|
|
885
|
+
top: E.paddingTop ?? Y.top,
|
|
886
|
+
right: E.paddingRight ?? Y.right,
|
|
887
|
+
bottom: E.paddingBottom ?? Y.bottom,
|
|
888
|
+
left: E.paddingLeft ?? Y.left
|
|
889
|
+
}, v = A - z.left - z.right;
|
|
890
|
+
return h.measureText(S, E, v).height + z.top + z.bottom;
|
|
821
891
|
};
|
|
822
892
|
new Array(t.length).fill(0), (() => {
|
|
823
|
-
const
|
|
824
|
-
for (let
|
|
825
|
-
const
|
|
826
|
-
let
|
|
827
|
-
for (let
|
|
828
|
-
const
|
|
829
|
-
let
|
|
830
|
-
|
|
831
|
-
|
|
893
|
+
const S = new Array(n.length).fill(0), A = [];
|
|
894
|
+
for (let v = 0; v < n.length; v++) {
|
|
895
|
+
const W = n[v];
|
|
896
|
+
let D = 0;
|
|
897
|
+
for (let k = 0; k < t.length; k++) {
|
|
898
|
+
const H = t[k], _ = typeof H.accessor == "function" ? H.accessor(W) : W[H.accessor];
|
|
899
|
+
let R = "", o = f, c = 1, b = 1;
|
|
900
|
+
_ && typeof _ == "object" && _.content !== void 0 ? (R = String(_.content), _.style && (o = _.style), _.colSpan && (c = _.colSpan), _.rowSpan && (b = _.rowSpan)) : R = String(_ ?? "");
|
|
901
|
+
let C = m[k];
|
|
902
|
+
for (let N = 1; N < c; N++)
|
|
903
|
+
k + N < m.length && (C += m[k + N]);
|
|
904
|
+
if (b > 1) {
|
|
905
|
+
A.push({
|
|
906
|
+
ri: v,
|
|
907
|
+
rSpan: b,
|
|
908
|
+
content: R,
|
|
909
|
+
width: C,
|
|
910
|
+
style: o ?? {}
|
|
911
|
+
}), k += c - 1;
|
|
832
912
|
continue;
|
|
833
913
|
}
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
Y + W < w.length && (h += w[Y + W]);
|
|
837
|
-
const g = G(S, h, _ ?? {});
|
|
838
|
-
g > I && (I = g), Y += e - 1;
|
|
914
|
+
const F = M(R, C, o ?? {});
|
|
915
|
+
F > D && (D = F), k += c - 1;
|
|
839
916
|
}
|
|
840
|
-
|
|
917
|
+
D < 8 && (D = 8), S[v] = D;
|
|
841
918
|
}
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
const
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
919
|
+
A.forEach((v) => {
|
|
920
|
+
const { ri: W, rSpan: D, content: k, width: H, style: _ } = v, R = M(k, H, _);
|
|
921
|
+
let o = 0;
|
|
922
|
+
for (let c = 0; c < D; c++)
|
|
923
|
+
W + c < S.length && (o += S[W + c]);
|
|
924
|
+
if (R > o) {
|
|
925
|
+
const c = R - o, b = Math.min(W + D - 1, S.length - 1);
|
|
926
|
+
S[b] += c;
|
|
927
|
+
}
|
|
928
|
+
});
|
|
929
|
+
let E = y;
|
|
930
|
+
const Y = new Array(t.length).fill(0), z = h.getCursor().x;
|
|
931
|
+
for (let v = 0; v < n.length; v++) {
|
|
932
|
+
const W = n[v], D = S[v];
|
|
933
|
+
let k = D;
|
|
934
|
+
for (let R = 0; R < t.length; R++) {
|
|
935
|
+
const o = t[R], c = typeof o.accessor == "function" ? o.accessor(W) : W[o.accessor];
|
|
936
|
+
let b = 1;
|
|
937
|
+
if (c && typeof c == "object" && c.rowSpan && (b = c.rowSpan), b > 1) {
|
|
938
|
+
let C = 0;
|
|
939
|
+
for (let F = 0; F < b; F++)
|
|
940
|
+
v + F < S.length && (C += S[v + F]);
|
|
941
|
+
C > k && (k = C);
|
|
855
942
|
}
|
|
856
943
|
}
|
|
857
|
-
const
|
|
858
|
-
if (
|
|
859
|
-
let
|
|
860
|
-
t.forEach((
|
|
861
|
-
const
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
944
|
+
const H = Math.abs(E - (h.contentTop + (p ?? 10))) < 1;
|
|
945
|
+
if (E + k > h.contentBottom && !H && (h.addPage(), E = h.getCursor().y, l && (p ?? 10) !== 0)) {
|
|
946
|
+
let R = z;
|
|
947
|
+
t.forEach((o, c) => {
|
|
948
|
+
const b = m[c];
|
|
949
|
+
L(
|
|
950
|
+
o.header ?? "",
|
|
951
|
+
R,
|
|
952
|
+
E,
|
|
953
|
+
b,
|
|
867
954
|
p ?? 10,
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
),
|
|
871
|
-
}),
|
|
955
|
+
e ?? { fontStyle: "bold" },
|
|
956
|
+
o.align ?? "left"
|
|
957
|
+
), R += b;
|
|
958
|
+
}), E += p ?? 10;
|
|
872
959
|
}
|
|
873
|
-
let
|
|
874
|
-
for (let
|
|
875
|
-
if (
|
|
876
|
-
|
|
960
|
+
let _ = z;
|
|
961
|
+
for (let R = 0; R < t.length; R++) {
|
|
962
|
+
if (Y[R] > 0) {
|
|
963
|
+
Y[R]--, _ += m[R];
|
|
877
964
|
continue;
|
|
878
965
|
}
|
|
879
|
-
const
|
|
880
|
-
let
|
|
881
|
-
|
|
882
|
-
let
|
|
883
|
-
|
|
884
|
-
let
|
|
885
|
-
for (let
|
|
886
|
-
|
|
887
|
-
let
|
|
888
|
-
if (
|
|
889
|
-
for (let
|
|
890
|
-
|
|
891
|
-
if (
|
|
892
|
-
M,
|
|
893
|
-
P,
|
|
966
|
+
const o = t[R], c = typeof o.accessor == "function" ? o.accessor(W) : W[o.accessor];
|
|
967
|
+
let b = 1, C = 1, F = f;
|
|
968
|
+
v % 2 === 1 && (u ? F = u : x && (F = { ...f, fillColor: "#E5E7EB" }));
|
|
969
|
+
let T = "";
|
|
970
|
+
c && typeof c == "object" && c.content !== void 0 ? (T = String(c.content), c.colSpan && (b = c.colSpan), c.rowSpan && (C = c.rowSpan), c.style && (F = { ...F, ...c.style })) : T = String(c ?? "");
|
|
971
|
+
let B = m[R];
|
|
972
|
+
for (let O = 1; O < b; O++)
|
|
973
|
+
R + O < m.length && (B += m[R + O]);
|
|
974
|
+
let G = D;
|
|
975
|
+
if (C > 1)
|
|
976
|
+
for (let O = 1; O < C; O++)
|
|
977
|
+
v + O < S.length && (G += S[v + O]);
|
|
978
|
+
if (L(
|
|
894
979
|
T,
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
980
|
+
_,
|
|
981
|
+
E,
|
|
982
|
+
B,
|
|
983
|
+
G,
|
|
984
|
+
F ?? {},
|
|
985
|
+
o.align ?? "left",
|
|
899
986
|
!0
|
|
900
|
-
),
|
|
901
|
-
|
|
902
|
-
for (let
|
|
903
|
-
|
|
987
|
+
), C > 1) {
|
|
988
|
+
Y[R] = C - 1;
|
|
989
|
+
for (let O = 1; O < b; O++)
|
|
990
|
+
R + O < Y.length && (Y[R + O] = C - 1);
|
|
904
991
|
}
|
|
905
|
-
|
|
992
|
+
_ += B, R += b - 1;
|
|
906
993
|
}
|
|
907
|
-
|
|
994
|
+
E += D;
|
|
908
995
|
}
|
|
909
|
-
|
|
996
|
+
h.setCursor(z, E);
|
|
910
997
|
})();
|
|
911
998
|
});
|
|
912
|
-
}, [
|
|
913
|
-
},
|
|
999
|
+
}, [h, n, t, r]), null;
|
|
1000
|
+
}, yt = ({
|
|
914
1001
|
children: n,
|
|
915
1002
|
x: t,
|
|
916
1003
|
y: r,
|
|
917
|
-
maxWidth:
|
|
918
|
-
spacingBelow:
|
|
919
|
-
...
|
|
1004
|
+
maxWidth: a,
|
|
1005
|
+
spacingBelow: i = 2,
|
|
1006
|
+
...s
|
|
920
1007
|
}) => {
|
|
921
|
-
const
|
|
922
|
-
return
|
|
923
|
-
|
|
924
|
-
const
|
|
925
|
-
let
|
|
1008
|
+
const e = V();
|
|
1009
|
+
return $.useLayoutEffect(() => {
|
|
1010
|
+
e.queueOperation(() => {
|
|
1011
|
+
const f = e.getCursor();
|
|
1012
|
+
let u = 0;
|
|
926
1013
|
const p = () => {
|
|
927
1014
|
if (typeof t == "number" && typeof r == "number")
|
|
928
|
-
|
|
1015
|
+
e.textRaw(n, t, r, s, a, s.align);
|
|
929
1016
|
else {
|
|
930
|
-
|
|
931
|
-
const l =
|
|
932
|
-
|
|
1017
|
+
e.setCursor(f.x, f.y), u = e.paragraph(n, s, a);
|
|
1018
|
+
const l = e.getCursor();
|
|
1019
|
+
e.setCursor(l.x, l.y + i);
|
|
933
1020
|
}
|
|
934
1021
|
};
|
|
935
|
-
p(),
|
|
1022
|
+
p(), s.showInAllPages && e.registerRecurringItem({
|
|
936
1023
|
draw: p,
|
|
937
|
-
scope:
|
|
938
|
-
y:
|
|
939
|
-
height:
|
|
1024
|
+
scope: s.scope ?? "all",
|
|
1025
|
+
y: f.y,
|
|
1026
|
+
height: u + i
|
|
940
1027
|
});
|
|
941
1028
|
});
|
|
942
1029
|
}, [
|
|
943
|
-
|
|
1030
|
+
e,
|
|
944
1031
|
n,
|
|
945
1032
|
t,
|
|
946
1033
|
r,
|
|
1034
|
+
a,
|
|
947
1035
|
i,
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
f.align
|
|
1036
|
+
s.fontSize,
|
|
1037
|
+
s.align
|
|
951
1038
|
]), null;
|
|
952
1039
|
}, mt = ({
|
|
953
1040
|
viewState: n,
|
|
954
1041
|
style: t,
|
|
955
1042
|
pad: r,
|
|
956
|
-
margin:
|
|
957
|
-
w:
|
|
958
|
-
h:
|
|
1043
|
+
margin: a,
|
|
1044
|
+
w: i,
|
|
1045
|
+
h: s
|
|
959
1046
|
}) => {
|
|
960
|
-
const
|
|
961
|
-
return
|
|
962
|
-
|
|
963
|
-
const
|
|
964
|
-
if (!
|
|
965
|
-
const
|
|
966
|
-
let
|
|
967
|
-
t.
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
1047
|
+
const e = V();
|
|
1048
|
+
return $.useLayoutEffect(() => {
|
|
1049
|
+
e.queueOperation(() => {
|
|
1050
|
+
const f = n.start;
|
|
1051
|
+
if (!f) return;
|
|
1052
|
+
const u = e.stopRecording();
|
|
1053
|
+
let p = i ?? e.contentAreaWidth;
|
|
1054
|
+
typeof t.width == "number" && (p = t.width), e.playback(u);
|
|
1055
|
+
const l = e.getPageCount(), x = e.getCursor(), h = n.start.page ?? l;
|
|
1056
|
+
for (let g = h; g <= l; g++) {
|
|
1057
|
+
e.instance.setPage(g);
|
|
1058
|
+
let m = e.contentTop, w;
|
|
1059
|
+
if (g === h)
|
|
1060
|
+
m = f.y, g === l ? t.height ? w = t.height : w = x.y - f.y + r.bottom : w = e.height - e.margin.bottom - f.y;
|
|
1061
|
+
else if (g === l) {
|
|
1062
|
+
m = e.contentTop, t.height, w = x.y - e.contentTop + r.bottom;
|
|
1063
|
+
const d = e.height - e.margin.bottom;
|
|
1064
|
+
w = Math.min(w, d - e.contentTop);
|
|
1065
|
+
} else
|
|
1066
|
+
m = e.contentTop, w = e.height - e.margin.bottom - e.contentTop;
|
|
1067
|
+
if (t.fillColor) {
|
|
1068
|
+
const d = g === h ? f.x : e.contentLeft, P = m, L = p, y = w;
|
|
1069
|
+
e.injectFill && e.injectFill(
|
|
1070
|
+
g,
|
|
1071
|
+
{ x: d, y: P, w: L, h: y },
|
|
1072
|
+
t.fillColor
|
|
1073
|
+
);
|
|
1074
|
+
}
|
|
1075
|
+
if (t.borderColor || t.borderWidth) {
|
|
1076
|
+
const d = e.instance, P = t.borderWidth ?? 0.1, L = t.borderColor ?? "#000000";
|
|
1077
|
+
d.setLineWidth(P);
|
|
1078
|
+
const y = q(L);
|
|
1079
|
+
y && d.setDrawColor(y[0], y[1], y[2]);
|
|
1080
|
+
const j = g === h ? f.x : e.contentLeft, I = m, X = p, M = w;
|
|
1081
|
+
d.line(j, I, j, I + M), d.line(j + X, I, j + X, I + M), g === h && d.line(j, I, j + X, I), g === l && d.line(j, I + M, j + X, I + M);
|
|
1082
|
+
}
|
|
981
1083
|
}
|
|
1084
|
+
if (e.instance.setPage(l), t.showInAllPages) {
|
|
1085
|
+
const g = () => {
|
|
1086
|
+
const m = t.height ?? 20;
|
|
1087
|
+
e.box(f.x, f.y, p, m, t);
|
|
1088
|
+
};
|
|
1089
|
+
e.registerRecurringItem({
|
|
1090
|
+
draw: g,
|
|
1091
|
+
scope: t.scope ?? "all",
|
|
1092
|
+
y: f.y,
|
|
1093
|
+
height: t.height ?? 0
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
if (!n.isAbsolute) {
|
|
1097
|
+
const g = x.y + r.bottom + a.bottom;
|
|
1098
|
+
e.setCursor(f.x, g);
|
|
1099
|
+
}
|
|
1100
|
+
e.setReservedHeight(0), e.popIndent && e.popIndent();
|
|
982
1101
|
});
|
|
983
|
-
}, [
|
|
1102
|
+
}, [e, t.showInAllPages, t.scope, i, s]), null;
|
|
984
1103
|
};
|
|
985
1104
|
function bt(n) {
|
|
986
1105
|
return typeof n == "number" ? { top: n, right: n, bottom: n, left: n } : {
|
|
@@ -990,57 +1109,100 @@ function bt(n) {
|
|
|
990
1109
|
left: n?.left ?? 0
|
|
991
1110
|
};
|
|
992
1111
|
}
|
|
993
|
-
const
|
|
994
|
-
style: n
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1112
|
+
const wt = ({
|
|
1113
|
+
style: n,
|
|
1114
|
+
x: t,
|
|
1115
|
+
y: r,
|
|
1116
|
+
w: a,
|
|
1117
|
+
h: i,
|
|
1118
|
+
viewState: s
|
|
1000
1119
|
}) => {
|
|
1001
|
-
const
|
|
1002
|
-
top: n.paddingTop ??
|
|
1003
|
-
right: n.paddingRight ??
|
|
1004
|
-
bottom: n.paddingBottom ??
|
|
1005
|
-
left: n.paddingLeft ??
|
|
1120
|
+
const e = V(), f = tt(n.padding), u = {
|
|
1121
|
+
top: n.paddingTop ?? f.top,
|
|
1122
|
+
right: n.paddingRight ?? f.right,
|
|
1123
|
+
bottom: n.paddingBottom ?? f.bottom,
|
|
1124
|
+
left: n.paddingLeft ?? f.left
|
|
1006
1125
|
}, p = bt(n.margin), l = {
|
|
1007
1126
|
top: n.marginTop ?? p.top,
|
|
1008
1127
|
right: n.marginRight ?? p.right,
|
|
1009
1128
|
bottom: n.marginBottom ?? p.bottom,
|
|
1010
1129
|
left: n.marginLeft ?? p.left
|
|
1011
|
-
}
|
|
1012
|
-
return
|
|
1013
|
-
|
|
1014
|
-
if (typeof
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1130
|
+
};
|
|
1131
|
+
return $.useLayoutEffect(() => {
|
|
1132
|
+
e.queueOperation(() => {
|
|
1133
|
+
if (typeof t == "number" && typeof r == "number" && typeof a == "number" && typeof i == "number") {
|
|
1134
|
+
s.isAbsolute = !0;
|
|
1135
|
+
const x = e.getPageCount();
|
|
1136
|
+
s.start = { x: t, y: r, page: x }, e.setCursor(t + u.left, r + u.top);
|
|
1137
|
+
} else {
|
|
1138
|
+
s.isAbsolute = !1, l.top > 0 && e.moveCursor(0, l.top), e.startRecording();
|
|
1139
|
+
const x = e.getCursor(), h = e.getPageCount();
|
|
1140
|
+
s.start = { ...x, page: h }, e.pushIndent ? (e.pushIndent(u.left, u.right), u.top > 0 && e.moveCursor(0, u.top)) : e.setCursor(x.x + u.left, x.y + u.top), e.setReservedHeight(u.bottom);
|
|
1020
1141
|
}
|
|
1021
1142
|
});
|
|
1022
|
-
}, [
|
|
1143
|
+
}, [e, t, r, a, i]), null;
|
|
1144
|
+
};
|
|
1145
|
+
function vt(n) {
|
|
1146
|
+
return typeof n == "number" ? { top: n, right: n, bottom: n, left: n } : {
|
|
1147
|
+
top: n?.top ?? 0,
|
|
1148
|
+
right: n?.right ?? 0,
|
|
1149
|
+
bottom: n?.bottom ?? 0,
|
|
1150
|
+
left: n?.left ?? 0
|
|
1151
|
+
};
|
|
1152
|
+
}
|
|
1153
|
+
const Et = ({
|
|
1154
|
+
style: n = {},
|
|
1155
|
+
children: t,
|
|
1156
|
+
x: r,
|
|
1157
|
+
y: a,
|
|
1158
|
+
w: i,
|
|
1159
|
+
h: s
|
|
1160
|
+
}) => {
|
|
1161
|
+
V();
|
|
1162
|
+
const e = tt(n.padding), f = {
|
|
1163
|
+
top: n.paddingTop ?? e.top,
|
|
1164
|
+
right: n.paddingRight ?? e.right,
|
|
1165
|
+
bottom: n.paddingBottom ?? e.bottom,
|
|
1166
|
+
left: n.paddingLeft ?? e.left
|
|
1167
|
+
}, u = vt(n.margin), p = {
|
|
1168
|
+
top: n.marginTop ?? u.top,
|
|
1169
|
+
right: n.marginRight ?? u.right,
|
|
1170
|
+
bottom: n.marginBottom ?? u.bottom,
|
|
1171
|
+
left: n.marginLeft ?? u.left
|
|
1172
|
+
}, l = $.useRef({}).current;
|
|
1173
|
+
return l.radius = n.radius, /* @__PURE__ */ U.jsxs($.Fragment, { children: [
|
|
1174
|
+
/* @__PURE__ */ U.jsx(
|
|
1175
|
+
wt,
|
|
1176
|
+
{
|
|
1177
|
+
style: n,
|
|
1178
|
+
x: r,
|
|
1179
|
+
y: a,
|
|
1180
|
+
w: i,
|
|
1181
|
+
h: s,
|
|
1182
|
+
viewState: l
|
|
1183
|
+
}
|
|
1184
|
+
),
|
|
1023
1185
|
t,
|
|
1024
1186
|
/* @__PURE__ */ U.jsx(
|
|
1025
1187
|
mt,
|
|
1026
1188
|
{
|
|
1027
|
-
viewState:
|
|
1189
|
+
viewState: l,
|
|
1028
1190
|
style: n,
|
|
1029
|
-
pad:
|
|
1030
|
-
margin:
|
|
1031
|
-
w:
|
|
1032
|
-
h:
|
|
1191
|
+
pad: f,
|
|
1192
|
+
margin: p,
|
|
1193
|
+
w: i,
|
|
1194
|
+
h: s
|
|
1033
1195
|
}
|
|
1034
1196
|
)
|
|
1035
1197
|
] });
|
|
1036
1198
|
};
|
|
1037
1199
|
export {
|
|
1038
1200
|
pt as PdfDocument,
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1201
|
+
Rt as PdfImage,
|
|
1202
|
+
St as PdfList,
|
|
1203
|
+
Tt as PdfPreview,
|
|
1042
1204
|
gt as PdfRenderer,
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1205
|
+
Pt as PdfTable,
|
|
1206
|
+
yt as PdfText,
|
|
1207
|
+
Et as PdfView
|
|
1046
1208
|
};
|