@paprize/react 0.0.2

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.
@@ -0,0 +1,2022 @@
1
+ import { jsx as b, jsxs as ue, Fragment as z } from "react/jsx-runtime";
2
+ import Oe, { useInsertionEffect as pt, useRef as B, createElement as ft, createContext as ve, useReducer as gt, useEffect as Y, useDebugValue as ht, useCallback as mt, useContext as se, Children as vt, isValidElement as St, useMemo as T, useState as Be, useId as De } from "react";
3
+ import { createPortal as _t } from "react-dom";
4
+ function Se(e) {
5
+ pt(() => {
6
+ const t = document.createElement("style");
7
+ return t.textContent = e, document.head.appendChild(t), () => t.remove();
8
+ }, [e]);
9
+ }
10
+ const wt = `
11
+ :root {
12
+ --paprize-page-background-color: #ffffff;
13
+ --paprize-page-margin-bottom: 10px;
14
+ --paprize-page-box-shadow: rgb(142 138 138) -1px 3px 5px 2px;
15
+ --paprize-section-margin-bottom: 10px;
16
+ --paprize-preview-background-color: rgb(218 220 224);
17
+ --paprize-preview-padding: 30px 10px;
18
+ }
19
+
20
+ body {
21
+ margin: 0;
22
+ }
23
+
24
+ @media screen {
25
+ .paprize-preview {
26
+ min-height: 100vh;
27
+ display: flex;
28
+ flex-direction: column;
29
+ align-items: center;
30
+ background-color: var(--paprize-preview-background-color);
31
+ padding: var(--paprize-preview-padding);
32
+ }
33
+
34
+ .paprize-page {
35
+ box-shadow: var(--paprize-page-box-shadow);
36
+ margin-bottom: var(--paprize-page-margin-bottom);
37
+ background-color: var(--paprize-page-background-color);
38
+ }
39
+
40
+ .paprize-section {
41
+ margin-bottom: var(--paprize-section-margin-bottom);
42
+ }
43
+ }
44
+ `;
45
+ function Gn({ children: e }) {
46
+ return Se(wt), /* @__PURE__ */ b("div", { className: "paprize-preview", children: e });
47
+ }
48
+ const $ = {};
49
+ function He(e, t) {
50
+ return e.unstable_is ? e.unstable_is(t) : t === e;
51
+ }
52
+ function Me(e) {
53
+ return "init" in e;
54
+ }
55
+ function de(e) {
56
+ return !!e.write;
57
+ }
58
+ function Ne(e) {
59
+ return "v" in e || "e" in e;
60
+ }
61
+ function X(e) {
62
+ if ("e" in e)
63
+ throw e.e;
64
+ if (($ ? "production" : void 0) !== "production" && !("v" in e))
65
+ throw new Error("[Bug] atom state is not initialized");
66
+ return e.v;
67
+ }
68
+ const Q = /* @__PURE__ */ new WeakMap();
69
+ function $e(e) {
70
+ var t;
71
+ return ee(e) && !!((t = Q.get(e)) != null && t[0]);
72
+ }
73
+ function yt(e) {
74
+ const t = Q.get(e);
75
+ t?.[0] && (t[0] = !1, t[1].forEach((n) => n()));
76
+ }
77
+ function pe(e, t) {
78
+ let n = Q.get(e);
79
+ if (!n) {
80
+ n = [!0, /* @__PURE__ */ new Set()], Q.set(e, n);
81
+ const o = () => {
82
+ n[0] = !1;
83
+ };
84
+ e.then(o, o);
85
+ }
86
+ n[1].add(t);
87
+ }
88
+ function ee(e) {
89
+ return typeof e?.then == "function";
90
+ }
91
+ function We(e, t, n) {
92
+ if (!n.p.has(e)) {
93
+ n.p.add(e);
94
+ const o = () => n.p.delete(e);
95
+ t.then(o, o);
96
+ }
97
+ }
98
+ function Ve(e, t, n) {
99
+ var o;
100
+ const i = /* @__PURE__ */ new Set();
101
+ for (const r of ((o = n.get(e)) == null ? void 0 : o.t) || [])
102
+ n.has(r) && i.add(r);
103
+ for (const r of t.p)
104
+ i.add(r);
105
+ return i;
106
+ }
107
+ const bt = (e, t, ...n) => t.read(...n), kt = (e, t, ...n) => t.write(...n), Et = (e, t) => {
108
+ var n;
109
+ return (n = t.unstable_onInit) == null ? void 0 : n.call(t, e);
110
+ }, Ct = (e, t, n) => {
111
+ var o;
112
+ return (o = t.onMount) == null ? void 0 : o.call(t, n);
113
+ }, Nt = (e, t) => {
114
+ const n = A(e), o = n[0], i = n[9];
115
+ if (($ ? "production" : void 0) !== "production" && !t)
116
+ throw new Error("Atom is undefined or null");
117
+ let r = o.get(t);
118
+ return r || (r = { d: /* @__PURE__ */ new Map(), p: /* @__PURE__ */ new Set(), n: 0 }, o.set(t, r), i?.(e, t)), r;
119
+ }, At = (e) => {
120
+ const t = A(e), n = t[1], o = t[3], i = t[4], r = t[5], s = t[6], p = t[13], h = [], d = (l) => {
121
+ try {
122
+ l();
123
+ } catch (g) {
124
+ h.push(g);
125
+ }
126
+ };
127
+ do {
128
+ s.f && d(s.f);
129
+ const l = /* @__PURE__ */ new Set(), g = l.add.bind(l);
130
+ o.forEach((v) => {
131
+ var m;
132
+ return (m = n.get(v)) == null ? void 0 : m.l.forEach(g);
133
+ }), o.clear(), r.forEach(g), r.clear(), i.forEach(g), i.clear(), l.forEach(d), o.size && p(e);
134
+ } while (o.size || r.size || i.size);
135
+ if (h.length)
136
+ throw new AggregateError(h);
137
+ }, Pt = (e) => {
138
+ const t = A(e), n = t[1], o = t[2], i = t[3], r = t[11], s = t[14], p = t[17], h = [], d = /* @__PURE__ */ new WeakSet(), l = /* @__PURE__ */ new WeakSet(), g = Array.from(i);
139
+ for (; g.length; ) {
140
+ const v = g[g.length - 1], m = r(e, v);
141
+ if (l.has(v)) {
142
+ g.pop();
143
+ continue;
144
+ }
145
+ if (d.has(v)) {
146
+ if (o.get(v) === m.n)
147
+ h.push([v, m]);
148
+ else if (($ ? "production" : void 0) !== "production" && o.has(v))
149
+ throw new Error("[Bug] invalidated atom exists");
150
+ l.add(v), g.pop();
151
+ continue;
152
+ }
153
+ d.add(v);
154
+ for (const _ of Ve(v, m, n))
155
+ d.has(_) || g.push(_);
156
+ }
157
+ for (let v = h.length - 1; v >= 0; --v) {
158
+ const [m, _] = h[v];
159
+ let a = !1;
160
+ for (const u of _.d.keys())
161
+ if (u !== m && i.has(u)) {
162
+ a = !0;
163
+ break;
164
+ }
165
+ a && (s(e, m), p(e, m)), o.delete(m);
166
+ }
167
+ }, xt = (e, t) => {
168
+ var n;
169
+ const o = A(e), i = o[1], r = o[2], s = o[3], p = o[6], h = o[7], d = o[11], l = o[12], g = o[13], v = o[14], m = o[16], _ = o[17], a = d(e, t);
170
+ if (Ne(a) && (i.has(t) && r.get(t) !== a.n || Array.from(a.d).every(
171
+ ([y, L]) => (
172
+ // Recursively, read the atom state of the dependency, and
173
+ // check if the atom epoch number is unchanged
174
+ v(e, y).n === L
175
+ )
176
+ )))
177
+ return a;
178
+ a.d.clear();
179
+ let u = !0;
180
+ function c() {
181
+ i.has(t) && (_(e, t), g(e), l(e));
182
+ }
183
+ function k(y) {
184
+ var L;
185
+ if (He(t, y)) {
186
+ const R = d(e, y);
187
+ if (!Ne(R))
188
+ if (Me(y))
189
+ te(e, y, y.init);
190
+ else
191
+ throw new Error("no atom init");
192
+ return X(R);
193
+ }
194
+ const P = v(e, y);
195
+ try {
196
+ return X(P);
197
+ } finally {
198
+ a.d.set(y, P.n), $e(a.v) && We(t, a.v, P), (L = i.get(y)) == null || L.t.add(t), u || c();
199
+ }
200
+ }
201
+ let C, E;
202
+ const w = {
203
+ get signal() {
204
+ return C || (C = new AbortController()), C.signal;
205
+ },
206
+ get setSelf() {
207
+ return ($ ? "production" : void 0) !== "production" && !de(t) && console.warn("setSelf function cannot be used with read-only atom"), !E && de(t) && (E = (...y) => {
208
+ if (($ ? "production" : void 0) !== "production" && u && console.warn("setSelf function cannot be called in sync"), !u)
209
+ try {
210
+ return m(e, t, ...y);
211
+ } finally {
212
+ g(e), l(e);
213
+ }
214
+ }), E;
215
+ }
216
+ }, O = a.n;
217
+ try {
218
+ const y = h(e, t, k, w);
219
+ return te(e, t, y), ee(y) && (pe(y, () => C?.abort()), y.then(c, c)), a;
220
+ } catch (y) {
221
+ return delete a.v, a.e = y, ++a.n, a;
222
+ } finally {
223
+ u = !1, O !== a.n && r.get(t) === O && (r.set(t, a.n), s.add(t), (n = p.c) == null || n.call(p, t));
224
+ }
225
+ }, Tt = (e, t) => {
226
+ const n = A(e), o = n[1], i = n[2], r = n[11], s = [t];
227
+ for (; s.length; ) {
228
+ const p = s.pop(), h = r(e, p);
229
+ for (const d of Ve(p, h, o)) {
230
+ const l = r(e, d);
231
+ i.set(d, l.n), s.push(d);
232
+ }
233
+ }
234
+ }, Ue = (e, t, ...n) => {
235
+ const o = A(e), i = o[3], r = o[6], s = o[8], p = o[11], h = o[12], d = o[13], l = o[14], g = o[15], v = o[17];
236
+ let m = !0;
237
+ const _ = (u) => X(l(e, u)), a = (u, ...c) => {
238
+ var k;
239
+ const C = p(e, u);
240
+ try {
241
+ if (He(t, u)) {
242
+ if (!Me(u))
243
+ throw new Error("atom not writable");
244
+ const E = C.n, w = c[0];
245
+ te(e, u, w), v(e, u), E !== C.n && (i.add(u), (k = r.c) == null || k.call(r, u), g(e, u));
246
+ return;
247
+ } else
248
+ return Ue(e, u, ...c);
249
+ } finally {
250
+ m || (d(e), h(e));
251
+ }
252
+ };
253
+ try {
254
+ return s(e, t, _, a, ...n);
255
+ } finally {
256
+ m = !1;
257
+ }
258
+ }, Lt = (e, t) => {
259
+ var n;
260
+ const o = A(e), i = o[1], r = o[3], s = o[6], p = o[11], h = o[15], d = o[18], l = o[19], g = p(e, t), v = i.get(t);
261
+ if (v && !$e(g.v)) {
262
+ for (const [m, _] of g.d)
263
+ if (!v.d.has(m)) {
264
+ const a = p(e, m);
265
+ d(e, m).t.add(t), v.d.add(m), _ !== a.n && (r.add(m), (n = s.c) == null || n.call(s, m), h(e, m));
266
+ }
267
+ for (const m of v.d || [])
268
+ if (!g.d.has(m)) {
269
+ v.d.delete(m);
270
+ const _ = l(e, m);
271
+ _?.t.delete(t);
272
+ }
273
+ }
274
+ }, je = (e, t) => {
275
+ var n;
276
+ const o = A(e), i = o[1], r = o[4], s = o[6], p = o[10], h = o[11], d = o[12], l = o[13], g = o[14], v = o[16], m = h(e, t);
277
+ let _ = i.get(t);
278
+ if (!_) {
279
+ g(e, t);
280
+ for (const a of m.d.keys())
281
+ je(e, a).t.add(t);
282
+ if (_ = {
283
+ l: /* @__PURE__ */ new Set(),
284
+ d: new Set(m.d.keys()),
285
+ t: /* @__PURE__ */ new Set()
286
+ }, i.set(t, _), (n = s.m) == null || n.call(s, t), de(t)) {
287
+ const a = () => {
288
+ let u = !0;
289
+ const c = (...k) => {
290
+ try {
291
+ return v(e, t, ...k);
292
+ } finally {
293
+ u || (l(e), d(e));
294
+ }
295
+ };
296
+ try {
297
+ const k = p(e, t, c);
298
+ k && (_.u = () => {
299
+ u = !0;
300
+ try {
301
+ k();
302
+ } finally {
303
+ u = !1;
304
+ }
305
+ });
306
+ } finally {
307
+ u = !1;
308
+ }
309
+ };
310
+ r.add(a);
311
+ }
312
+ }
313
+ return _;
314
+ }, Rt = (e, t) => {
315
+ var n;
316
+ const o = A(e), i = o[1], r = o[5], s = o[6], p = o[11], h = o[19], d = p(e, t);
317
+ let l = i.get(t);
318
+ if (l && !l.l.size && !Array.from(l.t).some((g) => {
319
+ var v;
320
+ return (v = i.get(g)) == null ? void 0 : v.d.has(t);
321
+ })) {
322
+ l.u && r.add(l.u), l = void 0, i.delete(t), (n = s.u) == null || n.call(s, t);
323
+ for (const g of d.d.keys()) {
324
+ const v = h(e, g);
325
+ v?.t.delete(t);
326
+ }
327
+ return;
328
+ }
329
+ return l;
330
+ }, te = (e, t, n) => {
331
+ const o = A(e)[11], i = o(e, t), r = "v" in i, s = i.v;
332
+ if (ee(n))
333
+ for (const p of i.d.keys())
334
+ We(
335
+ t,
336
+ n,
337
+ o(e, p)
338
+ );
339
+ i.v = n, delete i.e, (!r || !Object.is(s, i.v)) && (++i.n, ee(s) && yt(s));
340
+ }, It = (e, t) => {
341
+ const n = A(e)[14];
342
+ return X(n(e, t));
343
+ }, Ft = (e, t, ...n) => {
344
+ const o = A(e), i = o[12], r = o[13], s = o[16];
345
+ try {
346
+ return s(e, t, ...n);
347
+ } finally {
348
+ r(e), i(e);
349
+ }
350
+ }, zt = (e, t, n) => {
351
+ const o = A(e), i = o[12], r = o[18], s = o[19], h = r(e, t).l;
352
+ return h.add(n), i(e), () => {
353
+ h.delete(n), s(e, t), i(e);
354
+ };
355
+ }, Je = /* @__PURE__ */ new WeakMap();
356
+ function A(e) {
357
+ const t = Je.get(e);
358
+ if (($ ? "production" : void 0) !== "production" && !t)
359
+ throw new Error(
360
+ "Store must be created by buildStore to read its building blocks"
361
+ );
362
+ return t;
363
+ }
364
+ function Ot(...e) {
365
+ const t = {
366
+ get(o) {
367
+ const i = A(t)[21];
368
+ return i(t, o);
369
+ },
370
+ set(o, ...i) {
371
+ const r = A(t)[22];
372
+ return r(t, o, ...i);
373
+ },
374
+ sub(o, i) {
375
+ const r = A(t)[23];
376
+ return r(t, o, i);
377
+ }
378
+ }, n = [
379
+ // store state
380
+ /* @__PURE__ */ new WeakMap(),
381
+ // atomStateMap
382
+ /* @__PURE__ */ new WeakMap(),
383
+ // mountedMap
384
+ /* @__PURE__ */ new WeakMap(),
385
+ // invalidatedAtoms
386
+ /* @__PURE__ */ new Set(),
387
+ // changedAtoms
388
+ /* @__PURE__ */ new Set(),
389
+ // mountCallbacks
390
+ /* @__PURE__ */ new Set(),
391
+ // unmountCallbacks
392
+ {},
393
+ // storeHooks
394
+ // atom interceptors
395
+ bt,
396
+ kt,
397
+ Et,
398
+ Ct,
399
+ // building-block functions
400
+ Nt,
401
+ At,
402
+ Pt,
403
+ xt,
404
+ Tt,
405
+ Ue,
406
+ Lt,
407
+ je,
408
+ Rt,
409
+ te,
410
+ It,
411
+ Ft,
412
+ zt
413
+ ].map((o, i) => e[i] || o);
414
+ return Je.set(t, Object.freeze(n)), t;
415
+ }
416
+ const Ge = {};
417
+ let Bt = 0;
418
+ function Z(e, t) {
419
+ const n = `atom${++Bt}`, o = {
420
+ toString() {
421
+ return (Ge ? "production" : void 0) !== "production" && this.debugLabel ? n + ":" + this.debugLabel : n;
422
+ }
423
+ };
424
+ return typeof e == "function" ? o.read = e : (o.init = e, o.read = Dt, o.write = Ht), t && (o.write = t), o;
425
+ }
426
+ function Dt(e) {
427
+ return e(this);
428
+ }
429
+ function Ht(e, t, n) {
430
+ return t(
431
+ this,
432
+ typeof n == "function" ? n(e(this)) : n
433
+ );
434
+ }
435
+ function _e() {
436
+ return Ot();
437
+ }
438
+ let j;
439
+ function Mt() {
440
+ return j || (j = _e(), (Ge ? "production" : void 0) !== "production" && (globalThis.__JOTAI_DEFAULT_STORE__ || (globalThis.__JOTAI_DEFAULT_STORE__ = j), globalThis.__JOTAI_DEFAULT_STORE__ !== j && console.warn(
441
+ "Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"
442
+ ))), j;
443
+ }
444
+ const $t = {}, Ye = ve(
445
+ void 0
446
+ );
447
+ function qe(e) {
448
+ return se(Ye) || Mt();
449
+ }
450
+ function Wt({
451
+ children: e,
452
+ store: t
453
+ }) {
454
+ const n = B(void 0);
455
+ return !t && !n.current && (n.current = _e()), ft(
456
+ Ye.Provider,
457
+ {
458
+ value: t || n.current
459
+ },
460
+ e
461
+ );
462
+ }
463
+ const fe = (e) => typeof e?.then == "function", ge = (e) => {
464
+ e.status || (e.status = "pending", e.then(
465
+ (t) => {
466
+ e.status = "fulfilled", e.value = t;
467
+ },
468
+ (t) => {
469
+ e.status = "rejected", e.reason = t;
470
+ }
471
+ ));
472
+ }, Vt = Oe.use || // A shim for older React versions
473
+ ((e) => {
474
+ if (e.status === "pending")
475
+ throw e;
476
+ if (e.status === "fulfilled")
477
+ return e.value;
478
+ throw e.status === "rejected" ? e.reason : (ge(e), e);
479
+ }), ae = /* @__PURE__ */ new WeakMap(), Ae = (e, t) => {
480
+ let n = ae.get(e);
481
+ return n || (n = new Promise((o, i) => {
482
+ let r = e;
483
+ const s = (d) => (l) => {
484
+ r === d && o(l);
485
+ }, p = (d) => (l) => {
486
+ r === d && i(l);
487
+ }, h = () => {
488
+ try {
489
+ const d = t();
490
+ fe(d) ? (ae.set(d, n), r = d, d.then(s(d), p(d)), pe(d, h)) : o(d);
491
+ } catch (d) {
492
+ i(d);
493
+ }
494
+ };
495
+ e.then(s(e), p(e)), pe(e, h);
496
+ }), ae.set(e, n)), n;
497
+ };
498
+ function ne(e, t) {
499
+ const { delay: n, unstable_promiseStatus: o = !Oe.use } = {}, i = qe(), [[r, s, p], h] = gt(
500
+ (l) => {
501
+ const g = i.get(e);
502
+ return Object.is(l[0], g) && l[1] === i && l[2] === e ? l : [g, i, e];
503
+ },
504
+ void 0,
505
+ () => [i.get(e), i, e]
506
+ );
507
+ let d = r;
508
+ if ((s !== i || p !== e) && (h(), d = i.get(e)), Y(() => {
509
+ const l = i.sub(e, () => {
510
+ if (o)
511
+ try {
512
+ const g = i.get(e);
513
+ fe(g) && ge(
514
+ Ae(g, () => i.get(e))
515
+ );
516
+ } catch {
517
+ }
518
+ if (typeof n == "number") {
519
+ setTimeout(h, n);
520
+ return;
521
+ }
522
+ h();
523
+ });
524
+ return h(), l;
525
+ }, [i, e, n, o]), ht(d), fe(d)) {
526
+ const l = Ae(d, () => i.get(e));
527
+ return o && ge(l), Vt(l);
528
+ }
529
+ return d;
530
+ }
531
+ function we(e, t) {
532
+ const n = qe();
533
+ return mt(
534
+ (...i) => {
535
+ if (($t ? "production" : void 0) !== "production" && !("write" in e))
536
+ throw new Error("not writable atom");
537
+ return n.set(e, ...i);
538
+ },
539
+ [n, e]
540
+ );
541
+ }
542
+ const Ut = "__PAPRIZE_IS_READY", jt = "__PAPRIZE_READ_JSON_DATA_FILE", Jt = _e(), Gt = {
543
+ totalPages: 0,
544
+ isPaginated: !1,
545
+ pendingSuspensions: /* @__PURE__ */ new Set()
546
+ }, V = Z(/* @__PURE__ */ new Map());
547
+ V.debugLabel = "sectionsAtom";
548
+ const ye = Z({
549
+ totalSections: 0,
550
+ isPaginated: !1
551
+ });
552
+ ye.debugLabel = "reportAtom";
553
+ function Yt() {
554
+ const e = we(ye), t = ne(V);
555
+ return Y(() => {
556
+ const n = t.size, o = Array.from(t.values()).every(
557
+ (i) => i.isPaginated
558
+ );
559
+ window[Ut] = o, e({
560
+ isPaginated: o && n > 0,
561
+ totalSections: n
562
+ });
563
+ }, [t, e]), null;
564
+ }
565
+ const qt = `
566
+ html {
567
+ box-sizing: border-box;
568
+ }
569
+
570
+ *,
571
+ *:before,
572
+ *:after {
573
+ box-sizing: inherit;
574
+ }
575
+
576
+ .paprize-page-component {
577
+ display: flex;
578
+ flex-direction: column;
579
+ }
580
+ `;
581
+ function Yn({ children: e }) {
582
+ return Se(qt), /* @__PURE__ */ ue(Wt, { store: Jt, children: [
583
+ e,
584
+ /* @__PURE__ */ b(Yt, {})
585
+ ] });
586
+ }
587
+ function Ze({ children: e }) {
588
+ return /* @__PURE__ */ b(z, { children: e });
589
+ }
590
+ function Ke({ children: e }) {
591
+ return /* @__PURE__ */ b(z, { children: e });
592
+ }
593
+ function Xe({ children: e }) {
594
+ return /* @__PURE__ */ b(z, { children: e });
595
+ }
596
+ function Qe({ children: e }) {
597
+ return /* @__PURE__ */ b(z, { children: e });
598
+ }
599
+ function et({ children: e }) {
600
+ return /* @__PURE__ */ b(z, { children: e });
601
+ }
602
+ function tt({ children: e }) {
603
+ return /* @__PURE__ */ b(z, { children: e });
604
+ }
605
+ function Zt(e) {
606
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
607
+ }
608
+ var K = { exports: {} }, Kt = K.exports, Pe;
609
+ function Xt() {
610
+ return Pe || (Pe = 1, (function(e) {
611
+ (function(t, n) {
612
+ e.exports ? e.exports = n() : t.log = n();
613
+ })(Kt, function() {
614
+ var t = function() {
615
+ }, n = "undefined", o = typeof window !== n && typeof window.navigator !== n && /Trident\/|MSIE /.test(window.navigator.userAgent), i = [
616
+ "trace",
617
+ "debug",
618
+ "info",
619
+ "warn",
620
+ "error"
621
+ ], r = {}, s = null;
622
+ function p(a, u) {
623
+ var c = a[u];
624
+ if (typeof c.bind == "function")
625
+ return c.bind(a);
626
+ try {
627
+ return Function.prototype.bind.call(c, a);
628
+ } catch {
629
+ return function() {
630
+ return Function.prototype.apply.apply(c, [a, arguments]);
631
+ };
632
+ }
633
+ }
634
+ function h() {
635
+ console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
636
+ }
637
+ function d(a) {
638
+ return a === "debug" && (a = "log"), typeof console === n ? !1 : a === "trace" && o ? h : console[a] !== void 0 ? p(console, a) : console.log !== void 0 ? p(console, "log") : t;
639
+ }
640
+ function l() {
641
+ for (var a = this.getLevel(), u = 0; u < i.length; u++) {
642
+ var c = i[u];
643
+ this[c] = u < a ? t : this.methodFactory(c, a, this.name);
644
+ }
645
+ if (this.log = this.debug, typeof console === n && a < this.levels.SILENT)
646
+ return "No console available for logging";
647
+ }
648
+ function g(a) {
649
+ return function() {
650
+ typeof console !== n && (l.call(this), this[a].apply(this, arguments));
651
+ };
652
+ }
653
+ function v(a, u, c) {
654
+ return d(a) || g.apply(this, arguments);
655
+ }
656
+ function m(a, u) {
657
+ var c = this, k, C, E, w = "loglevel";
658
+ typeof a == "string" ? w += ":" + a : typeof a == "symbol" && (w = void 0);
659
+ function O(f) {
660
+ var S = (i[f] || "silent").toUpperCase();
661
+ if (!(typeof window === n || !w)) {
662
+ try {
663
+ window.localStorage[w] = S;
664
+ return;
665
+ } catch {
666
+ }
667
+ try {
668
+ window.document.cookie = encodeURIComponent(w) + "=" + S + ";";
669
+ } catch {
670
+ }
671
+ }
672
+ }
673
+ function y() {
674
+ var f;
675
+ if (!(typeof window === n || !w)) {
676
+ try {
677
+ f = window.localStorage[w];
678
+ } catch {
679
+ }
680
+ if (typeof f === n)
681
+ try {
682
+ var S = window.document.cookie, I = encodeURIComponent(w), U = S.indexOf(I + "=");
683
+ U !== -1 && (f = /^([^;]+)/.exec(
684
+ S.slice(U + I.length + 1)
685
+ )[1]);
686
+ } catch {
687
+ }
688
+ return c.levels[f] === void 0 && (f = void 0), f;
689
+ }
690
+ }
691
+ function L() {
692
+ if (!(typeof window === n || !w)) {
693
+ try {
694
+ window.localStorage.removeItem(w);
695
+ } catch {
696
+ }
697
+ try {
698
+ window.document.cookie = encodeURIComponent(w) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
699
+ } catch {
700
+ }
701
+ }
702
+ }
703
+ function P(f) {
704
+ var S = f;
705
+ if (typeof S == "string" && c.levels[S.toUpperCase()] !== void 0 && (S = c.levels[S.toUpperCase()]), typeof S == "number" && S >= 0 && S <= c.levels.SILENT)
706
+ return S;
707
+ throw new TypeError("log.setLevel() called with invalid level: " + f);
708
+ }
709
+ c.name = a, c.levels = {
710
+ TRACE: 0,
711
+ DEBUG: 1,
712
+ INFO: 2,
713
+ WARN: 3,
714
+ ERROR: 4,
715
+ SILENT: 5
716
+ }, c.methodFactory = u || v, c.getLevel = function() {
717
+ return E ?? C ?? k;
718
+ }, c.setLevel = function(f, S) {
719
+ return E = P(f), S !== !1 && O(E), l.call(c);
720
+ }, c.setDefaultLevel = function(f) {
721
+ C = P(f), y() || c.setLevel(f, !1);
722
+ }, c.resetLevel = function() {
723
+ E = null, L(), l.call(c);
724
+ }, c.enableAll = function(f) {
725
+ c.setLevel(c.levels.TRACE, f);
726
+ }, c.disableAll = function(f) {
727
+ c.setLevel(c.levels.SILENT, f);
728
+ }, c.rebuild = function() {
729
+ if (s !== c && (k = P(s.getLevel())), l.call(c), s === c)
730
+ for (var f in r)
731
+ r[f].rebuild();
732
+ }, k = P(
733
+ s ? s.getLevel() : "WARN"
734
+ );
735
+ var R = y();
736
+ R != null && (E = P(R)), l.call(c);
737
+ }
738
+ s = new m(), s.getLogger = function(u) {
739
+ if (typeof u != "symbol" && typeof u != "string" || u === "")
740
+ throw new TypeError("You must supply a name when creating a logger.");
741
+ var c = r[u];
742
+ return c || (c = r[u] = new m(
743
+ u,
744
+ s.methodFactory
745
+ )), c;
746
+ };
747
+ var _ = typeof window !== n ? window.log : void 0;
748
+ return s.noConflict = function() {
749
+ return typeof window !== n && window.log === s && (window.log = _), s;
750
+ }, s.getLoggers = function() {
751
+ return r;
752
+ }, s.default = s, s;
753
+ });
754
+ })(K)), K.exports;
755
+ }
756
+ var Qt = Xt();
757
+ const F = /* @__PURE__ */ Zt(Qt), xe = [
758
+ Ze,
759
+ Xe,
760
+ Ke,
761
+ tt,
762
+ et,
763
+ Qe
764
+ ];
765
+ function en(e) {
766
+ let t = null;
767
+ const n = {};
768
+ if (vt.forEach(e, (o) => {
769
+ if (!St(o))
770
+ throw F.error("Invalid React element found in children", { child: o }), new Error("Invalid React element found in children");
771
+ const i = xe.find((r) => r === o.type);
772
+ if (!i)
773
+ throw Error(
774
+ `Component "${o.type}" is not valid as a child for Section, Expected one of: ${xe.map((r) => r.name).join(",")}`
775
+ );
776
+ switch (i) {
777
+ case et:
778
+ n.sectionHeader = o;
779
+ break;
780
+ case Qe:
781
+ n.sectionFooter = o;
782
+ break;
783
+ case Ze:
784
+ t = o;
785
+ break;
786
+ case Xe:
787
+ n.header = o;
788
+ break;
789
+ case Ke:
790
+ n.footer = o;
791
+ break;
792
+ case tt:
793
+ n.overlay = o;
794
+ break;
795
+ }
796
+ }), !t)
797
+ throw Error("PageContent component is a required child for Section");
798
+ return { ...n, content: t };
799
+ }
800
+ function tn(e, t) {
801
+ return t === "landscape" ? { height: e.width, width: e.height } : e;
802
+ }
803
+ function nn(e, t) {
804
+ return `@page section-${e} {
805
+ margin: none;
806
+ size:${t.width} ${t.height};
807
+ width:${t.width};
808
+ height:${t.height};
809
+ }`;
810
+ }
811
+ const on = "paprize", nt = "pz-temp-container", ot = "data-pz-";
812
+ function it(e) {
813
+ return e.nodeType === Node.ELEMENT_NODE;
814
+ }
815
+ function rn(e) {
816
+ return e.nodeType === Node.TEXT_NODE;
817
+ }
818
+ function oe(e) {
819
+ const t = e.getBoundingClientRect(), n = getComputedStyle(e), o = parseFloat(n.marginTop) || 0, i = parseFloat(n.marginBottom) || 0;
820
+ return t.height + o + i;
821
+ }
822
+ function sn(e) {
823
+ e.style.visibility = "hidden", e.style.position = "absolute", e.style.left = "-9999px", e.style.top = "-9999px";
824
+ }
825
+ class D {
826
+ name;
827
+ defaultValue;
828
+ _reader;
829
+ constructor(t, n, o) {
830
+ this.name = t, this._reader = n, this.defaultValue = o;
831
+ }
832
+ read(t) {
833
+ return this._reader(t);
834
+ }
835
+ static createStr(t, n) {
836
+ return new D(t, (o) => o, n);
837
+ }
838
+ static createBool(t, n) {
839
+ return new D(
840
+ t,
841
+ (o) => o === "true",
842
+ n
843
+ );
844
+ }
845
+ }
846
+ const ie = {
847
+ hyphen: D.createStr("hyphen", "-"),
848
+ keepOnSamePage: D.createBool("keep-on-same-page", !1),
849
+ hyphenationEnabled: D.createBool(
850
+ "hyphenation-enabled",
851
+ !0
852
+ )
853
+ };
854
+ function an(e) {
855
+ const t = {};
856
+ for (const n in e) {
857
+ const o = e[n];
858
+ if (o !== void 0) {
859
+ const i = ie[n];
860
+ t[`${ot}${i.name}`] = String(o);
861
+ }
862
+ }
863
+ return t;
864
+ }
865
+ const cn = Object.fromEntries(
866
+ Object.entries(ie).map(([e, t]) => [
867
+ e,
868
+ t.defaultValue
869
+ ])
870
+ ), Te = /* @__PURE__ */ new WeakMap();
871
+ function rt(e) {
872
+ if (!e)
873
+ return {};
874
+ if (!(e instanceof Element))
875
+ return rt(e?.parentNode);
876
+ const t = {};
877
+ for (const i in ie) {
878
+ const r = ie[i], s = `${ot}${r.name}`, p = e.getAttribute(s);
879
+ p !== null && (t[i] = r.read(p));
880
+ }
881
+ const o = { ...e.parentNode ? Te.get(e.parentNode) : void 0, ...t };
882
+ return Te.set(e, o), o;
883
+ }
884
+ const st = {
885
+ plugins: [],
886
+ ...cn
887
+ };
888
+ function ln(e, t) {
889
+ const n = rt(e);
890
+ return { ...st, ...t, ...n };
891
+ }
892
+ const N = F.getLogger(on);
893
+ N.setDefaultLevel("info");
894
+ const ce = "\x1B[46mPLUGIN\x1B[0m";
895
+ function H(e, t, ...n) {
896
+ e.forEach((o) => {
897
+ const i = o[t];
898
+ if (i) {
899
+ N.debug(
900
+ ce,
901
+ `executing plugin ${o.name}:${String(t)}`,
902
+ n
903
+ );
904
+ try {
905
+ i(...n), N.debug(
906
+ ce,
907
+ `plugin ${o.name}:${String(t)} executed`,
908
+ n
909
+ );
910
+ } catch (r) {
911
+ N.debug(
912
+ ce,
913
+ `plugin ${o.name}:${String(t)} failed`,
914
+ r
915
+ );
916
+ }
917
+ }
918
+ });
919
+ }
920
+ const W = {
921
+ Element: "element",
922
+ Text: "text"
923
+ };
924
+ class be {
925
+ _node;
926
+ _transaction;
927
+ type = W.Element;
928
+ config;
929
+ constructor(t, n, o) {
930
+ this._node = t, this._transaction = n, this.config = o;
931
+ }
932
+ appendChild(t) {
933
+ this._transaction.isActive && this._transaction.addRollbackCallback(() => {
934
+ this._node.removeChild(t.getNode());
935
+ }), this._node.appendChild(t.getNode());
936
+ }
937
+ clone(t) {
938
+ const n = this._node.cloneNode(t), o = new be(
939
+ n,
940
+ this._transaction,
941
+ this.config
942
+ );
943
+ return H(
944
+ this.config.plugins,
945
+ "onClone",
946
+ this._node,
947
+ o
948
+ ), o;
949
+ }
950
+ getHeight() {
951
+ return oe(this._node);
952
+ }
953
+ remove() {
954
+ this._transaction.addCommitCallback(() => {
955
+ this._node.remove();
956
+ });
957
+ }
958
+ isEmpty() {
959
+ return this._node.innerHTML === "";
960
+ }
961
+ getChildrenCount() {
962
+ return this._node.childNodes.length;
963
+ }
964
+ getNode() {
965
+ return this._node;
966
+ }
967
+ }
968
+ class un {
969
+ _node;
970
+ _transaction;
971
+ type = W.Text;
972
+ config;
973
+ constructor(t, n, o) {
974
+ this._node = t, this._transaction = n, this.config = o;
975
+ }
976
+ get textContent() {
977
+ return this._node.textContent ?? "";
978
+ }
979
+ set textContent(t) {
980
+ this._node.textContent = t;
981
+ }
982
+ remove() {
983
+ this._transaction.addCommitCallback(() => {
984
+ this._node.remove();
985
+ });
986
+ }
987
+ getNode() {
988
+ return this._node;
989
+ }
990
+ }
991
+ function he(e, t, n) {
992
+ if (rn(e))
993
+ return new un(e, t, n);
994
+ if (it(e))
995
+ return new be(e, t, n);
996
+ throw new Error("Unsupported node type");
997
+ }
998
+ const J = "\x1B[106mDOM\x1B[0m";
999
+ class dn {
1000
+ _transaction;
1001
+ _treeWalker;
1002
+ _config;
1003
+ _completed = !1;
1004
+ _currentNode = null;
1005
+ _previousNode = null;
1006
+ constructor(t, n, o) {
1007
+ this._transaction = n, this._config = o, this._treeWalker = document.createTreeWalker(
1008
+ t,
1009
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT
1010
+ );
1011
+ }
1012
+ get completed() {
1013
+ return this._completed;
1014
+ }
1015
+ get currentNode() {
1016
+ return this._currentNode;
1017
+ }
1018
+ get previousNode() {
1019
+ return this._previousNode;
1020
+ }
1021
+ nextNode() {
1022
+ this._treeWalker.nextNode() || (this._completed = !0), N.debug(J, "moving to next node"), this.setState();
1023
+ }
1024
+ nextSiblingOrParentSibling() {
1025
+ let t = 0;
1026
+ if (this._treeWalker.nextSibling())
1027
+ return N.debug(J, "moving to next sibling node"), this.setState(), { parentsTraversed: t };
1028
+ for (; this._treeWalker.parentNode(); )
1029
+ if (t++, this._treeWalker.nextSibling())
1030
+ return N.debug(
1031
+ J,
1032
+ "moving to parent sibling node, traversed:",
1033
+ t
1034
+ ), this.setState(), { parentsTraversed: t };
1035
+ return this._completed = !0, { parentsTraversed: t };
1036
+ }
1037
+ firstChildOrNextNode() {
1038
+ return this._treeWalker.firstChild() ? (N.debug(J, "moving to first child node"), this.setState(), { parentsTraversed: 1 }) : (this.nextNode(), { parentsTraversed: 0 });
1039
+ }
1040
+ setState() {
1041
+ this._previousNode = this._currentNode, this._currentNode = he(
1042
+ this._treeWalker.currentNode,
1043
+ this._transaction,
1044
+ ln(this._treeWalker.currentNode, this._config)
1045
+ ), this.currentNode, this.previousNode, N.debug(J, "moved to node", {
1046
+ currentNode: this.currentNode,
1047
+ previousNode: this.previousNode
1048
+ });
1049
+ }
1050
+ }
1051
+ class pn {
1052
+ _onRollback;
1053
+ _onCommit;
1054
+ isActive;
1055
+ constructor() {
1056
+ this._onRollback = [], this._onCommit = [], this.isActive = !1;
1057
+ }
1058
+ start = () => {
1059
+ if (this.isActive)
1060
+ throw new Error("Transaction already in progress");
1061
+ this.isActive = !0, this._onRollback = [], this._onCommit = [];
1062
+ };
1063
+ addRollbackCallback = (t) => {
1064
+ this._onRollback.push(t);
1065
+ };
1066
+ addCommitCallback = (t) => {
1067
+ if (!this.isActive) {
1068
+ t();
1069
+ return;
1070
+ }
1071
+ this._onCommit.push(t);
1072
+ };
1073
+ rollback = () => {
1074
+ this.isActive && (this.isActive = !1, this._onRollback.forEach((t) => t()));
1075
+ };
1076
+ commit = () => {
1077
+ this.isActive && (this.isActive = !1, this._onCommit.forEach((t) => t()));
1078
+ };
1079
+ }
1080
+ const Le = "\x1B[102mPAGE\x1B[0m";
1081
+ class q {
1082
+ currentPage;
1083
+ activeElement;
1084
+ currentElement;
1085
+ parentStack;
1086
+ pageIsFull;
1087
+ pageIndex;
1088
+ pageHeight;
1089
+ constructor(t, n, o, i, r, s, p) {
1090
+ this.currentPage = t, this.activeElement = n, this.currentElement = o, this.parentStack = i, this.pageIsFull = r, this.pageIndex = s, this.pageHeight = p;
1091
+ }
1092
+ static create(t, n, o, i) {
1093
+ return new q(
1094
+ t,
1095
+ null,
1096
+ t,
1097
+ n,
1098
+ !1,
1099
+ o,
1100
+ i
1101
+ );
1102
+ }
1103
+ clone = () => new q(
1104
+ this.currentPage,
1105
+ this.activeElement,
1106
+ this.currentElement,
1107
+ [...this.parentStack],
1108
+ this.pageIsFull,
1109
+ this.pageIndex,
1110
+ this.pageHeight
1111
+ );
1112
+ }
1113
+ class ke {
1114
+ _pageState;
1115
+ _transaction;
1116
+ _tempContainer;
1117
+ _config;
1118
+ constructor(t, n, o, i) {
1119
+ this._tempContainer = t, this._config = i, this._transaction = o;
1120
+ const r = ke.createPageHtmlElement(
1121
+ n.width
1122
+ ), s = this.createNewPage(r);
1123
+ this._pageState = q.create(s, [], 0, n.height), H(this._config.plugins, "onNewPage", this._pageState);
1124
+ }
1125
+ nextPage() {
1126
+ const t = this.createNewPage(
1127
+ this._pageState.currentPage.getNode().cloneNode(!1)
1128
+ ), n = q.create(
1129
+ t,
1130
+ [],
1131
+ this._pageState.pageIndex + 1,
1132
+ this._pageState.pageHeight
1133
+ );
1134
+ this.cloneParentStackToNewPage(n), this.cleanupEmptyParent(), this._pageState = n, H(this._config.plugins, "onNewPage", this._pageState);
1135
+ }
1136
+ cloneParentStackToNewPage(t) {
1137
+ for (const n of this._pageState.parentStack) {
1138
+ const o = n.clone(!1);
1139
+ t.currentElement.appendChild(o), t.currentElement = o, t.parentStack.push(o);
1140
+ }
1141
+ }
1142
+ cleanupEmptyParent() {
1143
+ const t = [...this._pageState.parentStack], n = () => {
1144
+ for (let o = t.length - 1; o >= 0; o--) {
1145
+ const i = t[o];
1146
+ i.isEmpty() && i.remove();
1147
+ }
1148
+ };
1149
+ this._transaction.addCommitCallback(n);
1150
+ }
1151
+ enterElement() {
1152
+ if (!this._pageState.activeElement || this._pageState.activeElement.type !== W.Element)
1153
+ throw new Error("Invalid state: activeElement is not an Element");
1154
+ N.debug(
1155
+ Le,
1156
+ "entering an element",
1157
+ this._pageState.activeElement
1158
+ ), this._pageState.currentElement = this._pageState.activeElement, this._pageState.parentStack.push(this._pageState.activeElement);
1159
+ }
1160
+ leaveElement() {
1161
+ this._pageState.activeElement = null;
1162
+ const t = this._pageState.parentStack.pop();
1163
+ N.debug(Le, "leaving a parent element", t);
1164
+ const n = this._pageState.parentStack.at(-1);
1165
+ this._pageState.currentElement = n ?? this._pageState.currentPage;
1166
+ }
1167
+ static createPageHtmlElement(t) {
1168
+ const n = document.createElement("div");
1169
+ return n.style.display = "flex", n.style.flexDirection = "column", n.style.width = `${t}px`, n.style.maxWidth = `${t}px`, n;
1170
+ }
1171
+ createNewPage(t) {
1172
+ return this._tempContainer.appendChild(t), this._transaction.isActive && this._transaction.addRollbackCallback(() => {
1173
+ this._tempContainer.removeChild(t);
1174
+ }), he(t, this._transaction, this._config);
1175
+ }
1176
+ startTransaction() {
1177
+ this._transaction.start();
1178
+ const t = this._pageState.clone();
1179
+ return this._transaction.addRollbackCallback(() => {
1180
+ this._pageState = t;
1181
+ }), this._transaction;
1182
+ }
1183
+ hasEmptySpace(t) {
1184
+ return !this._pageState.pageIsFull && this._pageState.currentPage.getHeight() + (t || 1) <= this._pageState.pageHeight;
1185
+ }
1186
+ isOverFlow() {
1187
+ return this._pageState.currentPage.getHeight() > this._pageState.pageHeight;
1188
+ }
1189
+ markPageAsFull() {
1190
+ this._pageState.pageIsFull = !0;
1191
+ }
1192
+ appendChild(t, n) {
1193
+ const o = t.clone(n);
1194
+ return this._pageState.currentElement.appendChild(o), this._pageState.activeElement = o, o;
1195
+ }
1196
+ addTextNode(t) {
1197
+ if (this._pageState.activeElement?.type === W.Text)
1198
+ return this._pageState.activeElement;
1199
+ const n = document.createTextNode(t), o = he(
1200
+ n,
1201
+ this._transaction,
1202
+ this._config
1203
+ );
1204
+ return this._pageState.currentElement.appendChild(o), this._pageState.activeElement = o, o;
1205
+ }
1206
+ }
1207
+ const x = {
1208
+ None: 0,
1209
+ // The node fits completely on the page, no further splitting required.
1210
+ FullNodePlaced: 1,
1211
+ // The entire node was placed on the page, continue with the next sibling or element.
1212
+ SplitChildren: 2
1213
+ // The node is too large for the page, and its children must be paginated individually.
1214
+ };
1215
+ function fn(e, t) {
1216
+ const n = Re(e, t);
1217
+ if (n !== x.None)
1218
+ return n;
1219
+ const { rollback: o, commit: i } = t.startTransaction();
1220
+ t.nextPage();
1221
+ const r = Re(e, t);
1222
+ return r !== x.None ? (i(), r) : (o(), N.debug("Element is too big to fit on a page", e), x.None);
1223
+ }
1224
+ function Re(e, t) {
1225
+ if (t.hasEmptySpace(e.getHeight())) {
1226
+ const o = t.appendChild(e, !0);
1227
+ if (t.isOverFlow())
1228
+ o.remove();
1229
+ else
1230
+ return x.FullNodePlaced;
1231
+ }
1232
+ if (e.config.keepOnSamePage || e.getChildrenCount() === 0)
1233
+ return x.None;
1234
+ const n = t.appendChild(e, !1);
1235
+ return t.isOverFlow() ? (n.remove(), x.None) : x.SplitChildren;
1236
+ }
1237
+ function gn(e, t) {
1238
+ let n = x.FullNodePlaced;
1239
+ const o = e.textContent.split(/(\s+)/).filter((s) => s !== "");
1240
+ let i, r = 0;
1241
+ for (; i || r < o.length; ) {
1242
+ const s = i ?? o[r], p = hn(s, t, e.config);
1243
+ p.completed || (n = x.None), p.pendingToken ? i = p.pendingToken : (i = void 0, r++);
1244
+ }
1245
+ return n;
1246
+ }
1247
+ function hn(e, t, n) {
1248
+ t.hasEmptySpace() || t.nextPage();
1249
+ let o = t.addTextNode("");
1250
+ const i = o.textContent;
1251
+ if (o.textContent += e, !t.isOverFlow())
1252
+ return {
1253
+ completed: !0
1254
+ };
1255
+ o.textContent = i;
1256
+ const r = mn(e, t, n);
1257
+ return {
1258
+ pendingToken: r.leftovers,
1259
+ completed: r.completed
1260
+ };
1261
+ }
1262
+ function mn(e, t, n) {
1263
+ const { rollback: o, commit: i } = t.startTransaction();
1264
+ if (t.nextPage(), t.addTextNode(e), !t.isOverFlow())
1265
+ return i(), {
1266
+ completed: !0
1267
+ };
1268
+ if (o(), !n.hyphenationEnabled)
1269
+ return N.warn("Hyphenation disabled, skipping oversized token:", e), {
1270
+ completed: !1
1271
+ };
1272
+ const r = vn(e, n.hyphen, t);
1273
+ return {
1274
+ completed: !0,
1275
+ leftovers: r && r.length > 0 ? r : void 0
1276
+ };
1277
+ }
1278
+ function vn(e, t, n) {
1279
+ const o = n.addTextNode("");
1280
+ let i = "";
1281
+ for (let r = 0; r < e.length; r++) {
1282
+ const s = e[r], p = i + s;
1283
+ if (o.textContent = p + t, !n.hasEmptySpace())
1284
+ return o.textContent = i ? i + t : "", n.markPageAsFull(), e.slice(r);
1285
+ i = p;
1286
+ }
1287
+ return null;
1288
+ }
1289
+ const G = "\x1B[103mPAGINATOR\x1B[0m";
1290
+ class re {
1291
+ _domState;
1292
+ _pageManager;
1293
+ _transaction;
1294
+ _tempContainer;
1295
+ _config;
1296
+ constructor(t, n, o) {
1297
+ this._config = { ...st, ...o }, this._tempContainer = re.createTempContainer(), this._transaction = new pn(), this._domState = new dn(t, this._transaction, this._config), this._pageManager = new ke(
1298
+ this._tempContainer,
1299
+ n,
1300
+ this._transaction,
1301
+ this._config
1302
+ );
1303
+ }
1304
+ static createTempContainer() {
1305
+ const t = document.createElement("div");
1306
+ return t.classList.add(nt), sn(t), document.body.appendChild(t), t;
1307
+ }
1308
+ static paginate(t, n, o) {
1309
+ const i = new re(t, n, o);
1310
+ i.processAllNodes();
1311
+ const r = Array.from(i._tempContainer.childNodes).filter((s) => it(s)).map((s) => s.innerHTML);
1312
+ return i._tempContainer.remove(), r;
1313
+ }
1314
+ processAllNodes() {
1315
+ this._domState.nextNode();
1316
+ do {
1317
+ switch (F.debug(
1318
+ G,
1319
+ "paginating node",
1320
+ this._domState.currentNode
1321
+ ), this.processCurrentNode()) {
1322
+ case x.None:
1323
+ this.handleNodeSkipped();
1324
+ break;
1325
+ case x.FullNodePlaced:
1326
+ this.handleFullNodePlaced();
1327
+ break;
1328
+ case x.SplitChildren:
1329
+ this.handleChildrenSplit();
1330
+ break;
1331
+ }
1332
+ H(
1333
+ this._config.plugins,
1334
+ "afterVisitNode",
1335
+ this._domState,
1336
+ this._pageManager
1337
+ );
1338
+ } while (this._domState.completed === !1);
1339
+ F.debug(G, "pagination completed");
1340
+ }
1341
+ handleNodeSkipped() {
1342
+ F.debug(G, "node skipped - couldn't paginate"), this._domState.currentNode, this._domState.nextNode();
1343
+ }
1344
+ handleFullNodePlaced() {
1345
+ F.debug(G, "node fully paginated");
1346
+ const { parentsTraversed: t } = this._domState.nextSiblingOrParentSibling();
1347
+ for (let n = 0; n < t; n++)
1348
+ this._pageManager.leaveElement();
1349
+ }
1350
+ handleChildrenSplit() {
1351
+ F.debug(
1352
+ G,
1353
+ "node partially paginated - splitting children"
1354
+ ), this._domState.firstChildOrNextNode().parentsTraversed === 1 && this._domState.previousNode?.type === W.Element && this._pageManager.enterElement();
1355
+ }
1356
+ processCurrentNode() {
1357
+ if (!this._domState.currentNode)
1358
+ return x.None;
1359
+ if (this._domState.currentNode.type === W.Element) {
1360
+ const t = {};
1361
+ return H(
1362
+ this._config.plugins,
1363
+ "onVisitElement",
1364
+ this._domState,
1365
+ this._pageManager,
1366
+ t
1367
+ ), t.result !== void 0 ? t.result : fn(
1368
+ this._domState.currentNode,
1369
+ this._pageManager
1370
+ );
1371
+ } else {
1372
+ const t = {};
1373
+ return H(
1374
+ this._config.plugins,
1375
+ "onVisitText",
1376
+ this._domState,
1377
+ this._pageManager,
1378
+ t
1379
+ ), t.result !== void 0 ? t.result : gn(
1380
+ this._domState.currentNode,
1381
+ this._pageManager
1382
+ );
1383
+ }
1384
+ }
1385
+ }
1386
+ const at = "data-pz-page-break", Sn = "pageBreak", _n = {
1387
+ name: Sn,
1388
+ onVisitElement: (e, t, n) => {
1389
+ e.currentNode.getNode().getAttribute(at) === "true" && (t.markPageAsFull(), n.result = x.FullNodePlaced);
1390
+ }
1391
+ }, wn = [_n], ct = ve({
1392
+ pageNumber: 0,
1393
+ totalPages: 0
1394
+ });
1395
+ function yn(e) {
1396
+ return e ? `${e.top} ${e.right} ${e.bottom} ${e.left}` : "0";
1397
+ }
1398
+ function bn(e) {
1399
+ const t = e.getBoundingClientRect(), n = getComputedStyle(e), o = parseFloat(n.marginLeft) || 0, i = parseFloat(n.marginRight) || 0;
1400
+ return {
1401
+ height: oe(e),
1402
+ width: t.width + o + i
1403
+ };
1404
+ }
1405
+ function Ie({
1406
+ elements: e,
1407
+ dimensions: t,
1408
+ margin: n,
1409
+ pageNumber: o,
1410
+ totalPages: i,
1411
+ ref: r,
1412
+ sectionHeaderRef: s,
1413
+ sectionFooterRef: p,
1414
+ contentRef: h
1415
+ }) {
1416
+ const d = T(
1417
+ () => ({ pageNumber: o, totalPages: i }),
1418
+ [o, i]
1419
+ );
1420
+ return /* @__PURE__ */ b(ct, { value: d, children: /* @__PURE__ */ ue(
1421
+ "div",
1422
+ {
1423
+ className: "paprize-page paprize-page-component",
1424
+ ref: r,
1425
+ style: {
1426
+ width: t.width,
1427
+ height: t.height,
1428
+ maxHeight: t.height,
1429
+ position: "relative",
1430
+ padding: yn(n),
1431
+ zIndex: 1
1432
+ },
1433
+ children: [
1434
+ e.sectionHeader && o == 1 && /* @__PURE__ */ b(
1435
+ "div",
1436
+ {
1437
+ className: "paprize-page-component",
1438
+ ref: s,
1439
+ children: e.sectionHeader
1440
+ }
1441
+ ),
1442
+ e.header && /* @__PURE__ */ b("div", { className: "paprize-page-component", children: e.header }),
1443
+ /* @__PURE__ */ b(
1444
+ "div",
1445
+ {
1446
+ style: {
1447
+ overflow: "hidden"
1448
+ },
1449
+ ref: h,
1450
+ children: e.content
1451
+ }
1452
+ ),
1453
+ e.overlay && /* @__PURE__ */ b(
1454
+ "div",
1455
+ {
1456
+ style: {
1457
+ position: "absolute",
1458
+ width: "100%",
1459
+ height: "100%",
1460
+ left: 0,
1461
+ top: 0
1462
+ },
1463
+ children: e.overlay
1464
+ }
1465
+ ),
1466
+ (e.footer || e.sectionFooter) && /* @__PURE__ */ ue(
1467
+ "div",
1468
+ {
1469
+ className: "paprize-page-component",
1470
+ style: { marginTop: "auto" },
1471
+ children: [
1472
+ e.footer && /* @__PURE__ */ b("div", { className: "paprize-page-component", children: e.footer }),
1473
+ e.sectionFooter && o == i && /* @__PURE__ */ b(
1474
+ "div",
1475
+ {
1476
+ className: "paprize-page-component",
1477
+ ref: p,
1478
+ children: e.sectionFooter
1479
+ }
1480
+ )
1481
+ ]
1482
+ }
1483
+ )
1484
+ ]
1485
+ }
1486
+ ) });
1487
+ }
1488
+ function kn(e, t, n) {
1489
+ const { height: o, width: i } = bn(e), r = t ? oe(t) : 0, s = n ? oe(n) : 0;
1490
+ return { height: o, width: i, sectionHeaderHeight: r, sectionFooterHeight: s };
1491
+ }
1492
+ function En(e, t, n) {
1493
+ return {
1494
+ name: "sectionPageHeight",
1495
+ afterVisitNode: (o, i) => {
1496
+ !o.completed || n <= 0 || i.hasEmptySpace(n) || i.nextPage();
1497
+ },
1498
+ onNewPage: (o) => {
1499
+ o.pageIndex === 0 ? o.pageHeight = e + n : o.pageHeight = e + t + n;
1500
+ }
1501
+ };
1502
+ }
1503
+ const Ee = ve("");
1504
+ function Cn(e, t) {
1505
+ const n = T(
1506
+ () => Z(null, (o, i, ...r) => e(o, i, ...r)),
1507
+ [e]
1508
+ );
1509
+ return we(n);
1510
+ }
1511
+ const Nn = {
1512
+ totalPages: 0,
1513
+ isPaginated: !1,
1514
+ pendingSuspensions: 0
1515
+ }, lt = () => {
1516
+ const e = se(Ee), t = T(
1517
+ () => Z((o) => {
1518
+ const i = o(V).get(e);
1519
+ return i ? {
1520
+ totalPages: i.totalPages,
1521
+ isPaginated: i.isPaginated,
1522
+ pendingSuspensions: i.pendingSuspensions.size
1523
+ } : Nn;
1524
+ }),
1525
+ [e]
1526
+ ), n = ne(t);
1527
+ return {
1528
+ sectionName: e,
1529
+ totalPages: n.totalPages
1530
+ };
1531
+ };
1532
+ function An(e) {
1533
+ return lt(), Cn((n) => (n(V).get(e)?.pendingSuspensions?.size ?? 0) > 0);
1534
+ }
1535
+ const Ce = (e) => {
1536
+ const t = T(
1537
+ () => Z(
1538
+ () => 0,
1539
+ (n, o, i) => {
1540
+ o(
1541
+ V,
1542
+ (r) => new Map(r).set(
1543
+ e,
1544
+ i(r.get(e) ?? Gt)
1545
+ )
1546
+ );
1547
+ }
1548
+ ),
1549
+ [e]
1550
+ );
1551
+ return we(t);
1552
+ }, le = "\x1B[41mREACT\x1B[0m", Fe = (e, t, n, o, i) => e?.dimensions === n && e?.margin === o && e?.elements === t && e?.config === i && e?.elements === t;
1553
+ function Pn(e, t, n, o) {
1554
+ const i = se(Ee), r = An(i), s = Ce(i), p = B(null), [h, d] = Be({
1555
+ results: null,
1556
+ isLoading: !0
1557
+ }), l = B(null), g = B(null), v = B(null), m = B(null);
1558
+ return Y(() => {
1559
+ Fe(
1560
+ p.current,
1561
+ e,
1562
+ t,
1563
+ n,
1564
+ o
1565
+ ) || d({
1566
+ results: null,
1567
+ isLoading: !0
1568
+ });
1569
+ }, [t, e, n, o]), Y(() => {
1570
+ if (!l.current || !m.current || Fe(p.current, e, t, n, o))
1571
+ return;
1572
+ if (r()) {
1573
+ N.info(le, `Section "${i}" is suspended`);
1574
+ return;
1575
+ }
1576
+ const { height: _, width: a, sectionFooterHeight: u, sectionHeaderHeight: c } = kn(
1577
+ m.current,
1578
+ g.current,
1579
+ v.current
1580
+ ), k = o?.plugins.length ? o.plugins : [
1581
+ ...wn,
1582
+ En(
1583
+ _,
1584
+ c,
1585
+ u
1586
+ )
1587
+ ];
1588
+ N.debug(le, "Calling Paginator", {
1589
+ sectionName: i,
1590
+ height: _,
1591
+ width: a,
1592
+ sectionFooterHeight: u,
1593
+ sectionHeaderHeight: c,
1594
+ plugins: k
1595
+ });
1596
+ const C = re.paginate(
1597
+ m.current,
1598
+ { height: _, width: a },
1599
+ { ...o, plugins: k }
1600
+ );
1601
+ N.debug(le, "Paginator Result", {
1602
+ sectionName: i,
1603
+ paginatorResult: C
1604
+ }), d({
1605
+ results: C,
1606
+ isLoading: !1
1607
+ }), s((E) => ({
1608
+ ...E,
1609
+ totalPages: C.length,
1610
+ isPaginated: !0
1611
+ })), p.current = { elements: e, dimensions: t, margin: n, config: o };
1612
+ }), {
1613
+ ...h,
1614
+ pageRef: l,
1615
+ sectionHeaderRef: g,
1616
+ sectionFooterRef: v,
1617
+ contentRef: m
1618
+ };
1619
+ }
1620
+ function xn({
1621
+ elements: e,
1622
+ dimensions: t,
1623
+ margin: n,
1624
+ config: o
1625
+ }) {
1626
+ const { results: i, pageRef: r, sectionHeaderRef: s, sectionFooterRef: p, contentRef: h } = Pn(e, t, n, o);
1627
+ return i !== null ? /* @__PURE__ */ b(z, { children: i.map((l, g) => /* @__PURE__ */ b(
1628
+ Ie,
1629
+ {
1630
+ elements: {
1631
+ ...e,
1632
+ content: /* @__PURE__ */ b(
1633
+ "div",
1634
+ {
1635
+ dangerouslySetInnerHTML: {
1636
+ __html: l
1637
+ }
1638
+ }
1639
+ )
1640
+ },
1641
+ dimensions: t,
1642
+ margin: n,
1643
+ pageNumber: g + 1,
1644
+ totalPages: i.length
1645
+ },
1646
+ g
1647
+ )) }) : _t(
1648
+ /* @__PURE__ */ b("div", { className: nt, style: {
1649
+ visibility: "hidden",
1650
+ position: "absolute",
1651
+ left: "-9999px",
1652
+ top: "-9999px"
1653
+ }, children: /* @__PURE__ */ b(
1654
+ Ie,
1655
+ {
1656
+ elements: e,
1657
+ dimensions: t,
1658
+ margin: n,
1659
+ pageNumber: 1,
1660
+ totalPages: 1,
1661
+ ref: r,
1662
+ sectionHeaderRef: s,
1663
+ sectionFooterRef: p,
1664
+ contentRef: h
1665
+ }
1666
+ ) }),
1667
+ document.body
1668
+ );
1669
+ }
1670
+ function qn({
1671
+ children: e,
1672
+ dimension: t,
1673
+ orientation: n = "portrait",
1674
+ margin: o,
1675
+ config: i,
1676
+ name: r
1677
+ }) {
1678
+ const s = De(), p = r ?? s, h = Ce(p);
1679
+ T(() => {
1680
+ h((l) => ({ ...l, isPaginated: !1 }));
1681
+ }, [h]);
1682
+ const d = T(
1683
+ () => ({
1684
+ dimensions: tn(t, n),
1685
+ elements: en(e),
1686
+ margin: o,
1687
+ config: i
1688
+ }),
1689
+ [e, t, o, i, n]
1690
+ );
1691
+ return Se(nn(s, d.dimensions)), /* @__PURE__ */ b(
1692
+ "section",
1693
+ {
1694
+ className: "paprize-section",
1695
+ id: `section-${p}`,
1696
+ style: { page: `section-${p}` },
1697
+ children: /* @__PURE__ */ b(Ee, { value: p, children: /* @__PURE__ */ b(
1698
+ xn,
1699
+ {
1700
+ elements: d.elements,
1701
+ dimensions: d.dimensions,
1702
+ margin: d.margin,
1703
+ config: d.config
1704
+ }
1705
+ ) })
1706
+ }
1707
+ );
1708
+ }
1709
+ function Zn() {
1710
+ return /* @__PURE__ */ b("span", { [at]: "true" });
1711
+ }
1712
+ function Kn({ children: e, ...t }) {
1713
+ return /* @__PURE__ */ b(
1714
+ "div",
1715
+ {
1716
+ style: { display: "contents" },
1717
+ ...an(t),
1718
+ children: e
1719
+ }
1720
+ );
1721
+ }
1722
+ const Xn = () => {
1723
+ const e = se(ct);
1724
+ return {
1725
+ pageNumber: e.pageNumber,
1726
+ totalPages: e.totalPages
1727
+ };
1728
+ };
1729
+ function Qn() {
1730
+ const e = ne(V), t = ne(ye);
1731
+ return T(
1732
+ () => ({
1733
+ totalSections: t.totalSections,
1734
+ isPaginated: t.isPaginated,
1735
+ isFirstPaginationCompleted: t.totalSections > 0,
1736
+ sections: Array.from(e.entries()).map(
1737
+ ([n, { totalPages: o, isPaginated: i }]) => ({
1738
+ sectionName: n,
1739
+ totalPages: o,
1740
+ isPaginated: i
1741
+ })
1742
+ )
1743
+ }),
1744
+ [t.isPaginated, t.totalSections, e]
1745
+ );
1746
+ }
1747
+ function Tn(e, t = !0) {
1748
+ const n = De(), o = Ce(e);
1749
+ return T(() => {
1750
+ t && o((i) => ({
1751
+ ...i,
1752
+ pendingSuspensions: new Set(i.pendingSuspensions).add(n)
1753
+ }));
1754
+ }, [n, o, t]), T(() => ({
1755
+ release: () => {
1756
+ o((i) => {
1757
+ const r = new Set(i.pendingSuspensions);
1758
+ return r.delete(n), {
1759
+ ...i,
1760
+ pendingSuspensions: r
1761
+ };
1762
+ });
1763
+ }
1764
+ }), [n, o]);
1765
+ }
1766
+ const Ln = "paprize";
1767
+ class M {
1768
+ name;
1769
+ defaultValue;
1770
+ _reader;
1771
+ constructor(t, n, o) {
1772
+ this.name = t, this._reader = n, this.defaultValue = o;
1773
+ }
1774
+ read(t) {
1775
+ return this._reader(t);
1776
+ }
1777
+ static createStr(t, n) {
1778
+ return new M(t, (o) => o, n);
1779
+ }
1780
+ static createBool(t, n) {
1781
+ return new M(
1782
+ t,
1783
+ (o) => o === "true",
1784
+ n
1785
+ );
1786
+ }
1787
+ }
1788
+ const Rn = {
1789
+ hyphen: M.createStr("hyphen", "-"),
1790
+ keepOnSamePage: M.createBool("keep-on-same-page", !1),
1791
+ hyphenationEnabled: M.createBool(
1792
+ "hyphenation-enabled",
1793
+ !0
1794
+ )
1795
+ }, In = Object.fromEntries(
1796
+ Object.entries(Rn).map(([e, t]) => [
1797
+ e,
1798
+ t.defaultValue
1799
+ ])
1800
+ );
1801
+ ({
1802
+ ...In
1803
+ });
1804
+ function Fn(e) {
1805
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
1806
+ }
1807
+ var me = { exports: {} }, zn = me.exports, ze;
1808
+ function On() {
1809
+ return ze || (ze = 1, (function(e) {
1810
+ (function(t, n) {
1811
+ e.exports ? e.exports = n() : t.log = n();
1812
+ })(zn, function() {
1813
+ var t = function() {
1814
+ }, n = "undefined", o = typeof window !== n && typeof window.navigator !== n && /Trident\/|MSIE /.test(window.navigator.userAgent), i = [
1815
+ "trace",
1816
+ "debug",
1817
+ "info",
1818
+ "warn",
1819
+ "error"
1820
+ ], r = {}, s = null;
1821
+ function p(a, u) {
1822
+ var c = a[u];
1823
+ if (typeof c.bind == "function")
1824
+ return c.bind(a);
1825
+ try {
1826
+ return Function.prototype.bind.call(c, a);
1827
+ } catch {
1828
+ return function() {
1829
+ return Function.prototype.apply.apply(c, [a, arguments]);
1830
+ };
1831
+ }
1832
+ }
1833
+ function h() {
1834
+ console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
1835
+ }
1836
+ function d(a) {
1837
+ return a === "debug" && (a = "log"), typeof console === n ? !1 : a === "trace" && o ? h : console[a] !== void 0 ? p(console, a) : console.log !== void 0 ? p(console, "log") : t;
1838
+ }
1839
+ function l() {
1840
+ for (var a = this.getLevel(), u = 0; u < i.length; u++) {
1841
+ var c = i[u];
1842
+ this[c] = u < a ? t : this.methodFactory(c, a, this.name);
1843
+ }
1844
+ if (this.log = this.debug, typeof console === n && a < this.levels.SILENT)
1845
+ return "No console available for logging";
1846
+ }
1847
+ function g(a) {
1848
+ return function() {
1849
+ typeof console !== n && (l.call(this), this[a].apply(this, arguments));
1850
+ };
1851
+ }
1852
+ function v(a, u, c) {
1853
+ return d(a) || g.apply(this, arguments);
1854
+ }
1855
+ function m(a, u) {
1856
+ var c = this, k, C, E, w = "loglevel";
1857
+ typeof a == "string" ? w += ":" + a : typeof a == "symbol" && (w = void 0);
1858
+ function O(f) {
1859
+ var S = (i[f] || "silent").toUpperCase();
1860
+ if (!(typeof window === n || !w)) {
1861
+ try {
1862
+ window.localStorage[w] = S;
1863
+ return;
1864
+ } catch {
1865
+ }
1866
+ try {
1867
+ window.document.cookie = encodeURIComponent(w) + "=" + S + ";";
1868
+ } catch {
1869
+ }
1870
+ }
1871
+ }
1872
+ function y() {
1873
+ var f;
1874
+ if (!(typeof window === n || !w)) {
1875
+ try {
1876
+ f = window.localStorage[w];
1877
+ } catch {
1878
+ }
1879
+ if (typeof f === n)
1880
+ try {
1881
+ var S = window.document.cookie, I = encodeURIComponent(w), U = S.indexOf(I + "=");
1882
+ U !== -1 && (f = /^([^;]+)/.exec(
1883
+ S.slice(U + I.length + 1)
1884
+ )[1]);
1885
+ } catch {
1886
+ }
1887
+ return c.levels[f] === void 0 && (f = void 0), f;
1888
+ }
1889
+ }
1890
+ function L() {
1891
+ if (!(typeof window === n || !w)) {
1892
+ try {
1893
+ window.localStorage.removeItem(w);
1894
+ } catch {
1895
+ }
1896
+ try {
1897
+ window.document.cookie = encodeURIComponent(w) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
1898
+ } catch {
1899
+ }
1900
+ }
1901
+ }
1902
+ function P(f) {
1903
+ var S = f;
1904
+ if (typeof S == "string" && c.levels[S.toUpperCase()] !== void 0 && (S = c.levels[S.toUpperCase()]), typeof S == "number" && S >= 0 && S <= c.levels.SILENT)
1905
+ return S;
1906
+ throw new TypeError("log.setLevel() called with invalid level: " + f);
1907
+ }
1908
+ c.name = a, c.levels = {
1909
+ TRACE: 0,
1910
+ DEBUG: 1,
1911
+ INFO: 2,
1912
+ WARN: 3,
1913
+ ERROR: 4,
1914
+ SILENT: 5
1915
+ }, c.methodFactory = u || v, c.getLevel = function() {
1916
+ return E ?? C ?? k;
1917
+ }, c.setLevel = function(f, S) {
1918
+ return E = P(f), S !== !1 && O(E), l.call(c);
1919
+ }, c.setDefaultLevel = function(f) {
1920
+ C = P(f), y() || c.setLevel(f, !1);
1921
+ }, c.resetLevel = function() {
1922
+ E = null, L(), l.call(c);
1923
+ }, c.enableAll = function(f) {
1924
+ c.setLevel(c.levels.TRACE, f);
1925
+ }, c.disableAll = function(f) {
1926
+ c.setLevel(c.levels.SILENT, f);
1927
+ }, c.rebuild = function() {
1928
+ if (s !== c && (k = P(s.getLevel())), l.call(c), s === c)
1929
+ for (var f in r)
1930
+ r[f].rebuild();
1931
+ }, k = P(
1932
+ s ? s.getLevel() : "WARN"
1933
+ );
1934
+ var R = y();
1935
+ R != null && (E = P(R)), l.call(c);
1936
+ }
1937
+ s = new m(), s.getLogger = function(a) {
1938
+ if (typeof a != "symbol" && typeof a != "string" || a === "")
1939
+ throw new TypeError("You must supply a name when creating a logger.");
1940
+ var u = r[a];
1941
+ return u || (u = r[a] = new m(
1942
+ a,
1943
+ s.methodFactory
1944
+ )), u;
1945
+ };
1946
+ var _ = typeof window !== n ? window.log : void 0;
1947
+ return s.noConflict = function() {
1948
+ return typeof window !== n && window.log === s && (window.log = _), s;
1949
+ }, s.getLoggers = function() {
1950
+ return r;
1951
+ }, s.default = s, s;
1952
+ });
1953
+ })(me)), me.exports;
1954
+ }
1955
+ var Bn = On();
1956
+ const Dn = /* @__PURE__ */ Fn(Bn), ut = Dn.getLogger(Ln);
1957
+ ut.setDefaultLevel("info");
1958
+ function Hn(e, t) {
1959
+ const { sectionName: n } = lt(), { release: o } = Tn(n), [i, r] = Be({
1960
+ state: "loading",
1961
+ value: t
1962
+ });
1963
+ return T(() => {
1964
+ e.then((s) => r({ state: "hasData", value: s })).catch((s) => {
1965
+ r({ state: "hasError", value: s }), ut.error("Error in useSuspenseForPromise", s);
1966
+ });
1967
+ }, [e]), Y(() => {
1968
+ i.state !== "loading" && o();
1969
+ }, [i, o]), i.value;
1970
+ }
1971
+ function Mn(e) {
1972
+ let t = null;
1973
+ return () => (t || (t = e()), t);
1974
+ }
1975
+ const $n = Mn(async () => {
1976
+ const e = await window[jt]?.();
1977
+ return e ? JSON.parse(e) : null;
1978
+ });
1979
+ function eo(e) {
1980
+ return Hn($n(), e);
1981
+ }
1982
+ const Wn = {
1983
+ A1: { height: "841mm", width: "594mm" },
1984
+ A2: { height: "594mm", width: "420mm" },
1985
+ A3: { height: "420mm", width: "297mm" },
1986
+ A4: { height: "297mm", width: "210mm" },
1987
+ A5: { height: "210mm", width: "148mm" },
1988
+ A6: { height: "148mm", width: "105mm" },
1989
+ B3: { height: "500mm", width: "353mm" },
1990
+ B4: { height: "353mm", width: "250mm" },
1991
+ B5: { height: "250mm", width: "176mm" },
1992
+ Letter: { height: "8.5in", width: "11in" },
1993
+ Legal: { height: "11in", width: "8.5in" },
1994
+ Tabloid: { height: "11in", width: "17in" }
1995
+ }, Vn = {
1996
+ Normal: { top: "1in", right: "1in", bottom: "1in", left: "1in" },
1997
+ Narrow: { top: "0.4in", right: "0.6in", bottom: "0.6in", left: "0.6in" },
1998
+ Wide: { top: "0.5in", right: "2in", bottom: "0.5in", left: "2in" },
1999
+ None: { top: "0in", right: "0in", bottom: "0in", left: "0in" }
2000
+ }, to = Wn, no = Vn;
2001
+ export {
2002
+ Kn as Layout,
2003
+ Zn as PageBreak,
2004
+ Ze as PageContent,
2005
+ Ke as PageFooter,
2006
+ Xe as PageHeader,
2007
+ Gn as ReportPreview,
2008
+ Yn as ReportRoot,
2009
+ qn as Section,
2010
+ Qe as SectionFooter,
2011
+ et as SectionHeader,
2012
+ wn as defaultPlugins,
2013
+ $n as jsonData,
2014
+ no as pageMargin,
2015
+ to as pageSize,
2016
+ eo as useJsonData,
2017
+ Xn as usePageInfo,
2018
+ Qn as useReportInfo,
2019
+ lt as useSectionInfo,
2020
+ Tn as useSectionSuspension,
2021
+ Hn as useSuspenseForPromise
2022
+ };