@forevka/wordcanvas 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3840 @@
1
+ import { c as fe, m as et, f as Ie } from "./worker-DL4Rxrg-.js";
2
+ const mn = [
3
+ "BN",
4
+ "BN",
5
+ "BN",
6
+ "BN",
7
+ "BN",
8
+ "BN",
9
+ "BN",
10
+ "BN",
11
+ "BN",
12
+ "S",
13
+ "B",
14
+ "S",
15
+ "WS",
16
+ "B",
17
+ "BN",
18
+ "BN",
19
+ "BN",
20
+ "BN",
21
+ "BN",
22
+ "BN",
23
+ "BN",
24
+ "BN",
25
+ "BN",
26
+ "BN",
27
+ "BN",
28
+ "BN",
29
+ "BN",
30
+ "BN",
31
+ "B",
32
+ "B",
33
+ "B",
34
+ "S",
35
+ "WS",
36
+ "ON",
37
+ "ON",
38
+ "ET",
39
+ "ET",
40
+ "ET",
41
+ "ON",
42
+ "ON",
43
+ "ON",
44
+ "ON",
45
+ "ON",
46
+ "ES",
47
+ "CS",
48
+ "ES",
49
+ "CS",
50
+ "CS",
51
+ "EN",
52
+ "EN",
53
+ "EN",
54
+ "EN",
55
+ "EN",
56
+ "EN",
57
+ "EN",
58
+ "EN",
59
+ "EN",
60
+ "EN",
61
+ "CS",
62
+ "ON",
63
+ "ON",
64
+ "ON",
65
+ "ON",
66
+ "ON",
67
+ "ON",
68
+ "L",
69
+ "L",
70
+ "L",
71
+ "L",
72
+ "L",
73
+ "L",
74
+ "L",
75
+ "L",
76
+ "L",
77
+ "L",
78
+ "L",
79
+ "L",
80
+ "L",
81
+ "L",
82
+ "L",
83
+ "L",
84
+ "L",
85
+ "L",
86
+ "L",
87
+ "L",
88
+ "L",
89
+ "L",
90
+ "L",
91
+ "L",
92
+ "L",
93
+ "L",
94
+ "ON",
95
+ "ON",
96
+ "ON",
97
+ "ON",
98
+ "ON",
99
+ "ON",
100
+ "L",
101
+ "L",
102
+ "L",
103
+ "L",
104
+ "L",
105
+ "L",
106
+ "L",
107
+ "L",
108
+ "L",
109
+ "L",
110
+ "L",
111
+ "L",
112
+ "L",
113
+ "L",
114
+ "L",
115
+ "L",
116
+ "L",
117
+ "L",
118
+ "L",
119
+ "L",
120
+ "L",
121
+ "L",
122
+ "L",
123
+ "L",
124
+ "L",
125
+ "L",
126
+ "ON",
127
+ "ON",
128
+ "ON",
129
+ "ON",
130
+ "BN",
131
+ "BN",
132
+ "BN",
133
+ "BN",
134
+ "BN",
135
+ "BN",
136
+ "B",
137
+ "BN",
138
+ "BN",
139
+ "BN",
140
+ "BN",
141
+ "BN",
142
+ "BN",
143
+ "BN",
144
+ "BN",
145
+ "BN",
146
+ "BN",
147
+ "BN",
148
+ "BN",
149
+ "BN",
150
+ "BN",
151
+ "BN",
152
+ "BN",
153
+ "BN",
154
+ "BN",
155
+ "BN",
156
+ "BN",
157
+ "BN",
158
+ "BN",
159
+ "BN",
160
+ "BN",
161
+ "BN",
162
+ "BN",
163
+ "CS",
164
+ "ON",
165
+ "ET",
166
+ "ET",
167
+ "ET",
168
+ "ET",
169
+ "ON",
170
+ "ON",
171
+ "ON",
172
+ "ON",
173
+ "L",
174
+ "ON",
175
+ "ON",
176
+ "BN",
177
+ "ON",
178
+ "ON",
179
+ "ET",
180
+ "ET",
181
+ "EN",
182
+ "EN",
183
+ "ON",
184
+ "L",
185
+ "ON",
186
+ "ON",
187
+ "ON",
188
+ "EN",
189
+ "L",
190
+ "ON",
191
+ "ON",
192
+ "ON",
193
+ "ON",
194
+ "ON",
195
+ "L",
196
+ "L",
197
+ "L",
198
+ "L",
199
+ "L",
200
+ "L",
201
+ "L",
202
+ "L",
203
+ "L",
204
+ "L",
205
+ "L",
206
+ "L",
207
+ "L",
208
+ "L",
209
+ "L",
210
+ "L",
211
+ "L",
212
+ "L",
213
+ "L",
214
+ "L",
215
+ "L",
216
+ "L",
217
+ "L",
218
+ "ON",
219
+ "L",
220
+ "L",
221
+ "L",
222
+ "L",
223
+ "L",
224
+ "L",
225
+ "L",
226
+ "L",
227
+ "L",
228
+ "L",
229
+ "L",
230
+ "L",
231
+ "L",
232
+ "L",
233
+ "L",
234
+ "L",
235
+ "L",
236
+ "L",
237
+ "L",
238
+ "L",
239
+ "L",
240
+ "L",
241
+ "L",
242
+ "L",
243
+ "L",
244
+ "L",
245
+ "L",
246
+ "L",
247
+ "L",
248
+ "L",
249
+ "L",
250
+ "ON",
251
+ "L",
252
+ "L",
253
+ "L",
254
+ "L",
255
+ "L",
256
+ "L",
257
+ "L",
258
+ "L"
259
+ ], pt = [
260
+ [697, 698, "ON"],
261
+ [706, 719, "ON"],
262
+ [722, 735, "ON"],
263
+ [741, 749, "ON"],
264
+ [751, 767, "ON"],
265
+ [768, 879, "NSM"],
266
+ [884, 885, "ON"],
267
+ [894, 894, "ON"],
268
+ [900, 901, "ON"],
269
+ [903, 903, "ON"],
270
+ [1014, 1014, "ON"],
271
+ [1155, 1161, "NSM"],
272
+ [1418, 1418, "ON"],
273
+ [1421, 1422, "ON"],
274
+ [1423, 1423, "ET"],
275
+ [1424, 1424, "R"],
276
+ [1425, 1469, "NSM"],
277
+ [1470, 1470, "R"],
278
+ [1471, 1471, "NSM"],
279
+ [1472, 1472, "R"],
280
+ [1473, 1474, "NSM"],
281
+ [1475, 1475, "R"],
282
+ [1476, 1477, "NSM"],
283
+ [1478, 1478, "R"],
284
+ [1479, 1479, "NSM"],
285
+ [1480, 1535, "R"],
286
+ [1536, 1541, "AN"],
287
+ [1542, 1543, "ON"],
288
+ [1544, 1544, "AL"],
289
+ [1545, 1546, "ET"],
290
+ [1547, 1547, "AL"],
291
+ [1548, 1548, "CS"],
292
+ [1549, 1549, "AL"],
293
+ [1550, 1551, "ON"],
294
+ [1552, 1562, "NSM"],
295
+ [1563, 1610, "AL"],
296
+ [1611, 1631, "NSM"],
297
+ [1632, 1641, "AN"],
298
+ [1642, 1642, "ET"],
299
+ [1643, 1644, "AN"],
300
+ [1645, 1647, "AL"],
301
+ [1648, 1648, "NSM"],
302
+ [1649, 1749, "AL"],
303
+ [1750, 1756, "NSM"],
304
+ [1757, 1757, "AN"],
305
+ [1758, 1758, "ON"],
306
+ [1759, 1764, "NSM"],
307
+ [1765, 1766, "AL"],
308
+ [1767, 1768, "NSM"],
309
+ [1769, 1769, "ON"],
310
+ [1770, 1773, "NSM"],
311
+ [1774, 1775, "AL"],
312
+ [1776, 1785, "EN"],
313
+ [1786, 1808, "AL"],
314
+ [1809, 1809, "NSM"],
315
+ [1810, 1839, "AL"],
316
+ [1840, 1866, "NSM"],
317
+ [1867, 1957, "AL"],
318
+ [1958, 1968, "NSM"],
319
+ [1969, 1983, "AL"],
320
+ [1984, 2026, "R"],
321
+ [2027, 2035, "NSM"],
322
+ [2036, 2037, "R"],
323
+ [2038, 2041, "ON"],
324
+ [2042, 2044, "R"],
325
+ [2045, 2045, "NSM"],
326
+ [2046, 2069, "R"],
327
+ [2070, 2073, "NSM"],
328
+ [2074, 2074, "R"],
329
+ [2075, 2083, "NSM"],
330
+ [2084, 2084, "R"],
331
+ [2085, 2087, "NSM"],
332
+ [2088, 2088, "R"],
333
+ [2089, 2093, "NSM"],
334
+ [2094, 2136, "R"],
335
+ [2137, 2139, "NSM"],
336
+ [2140, 2143, "R"],
337
+ [2144, 2191, "AL"],
338
+ [2192, 2193, "AN"],
339
+ [2194, 2198, "AL"],
340
+ [2199, 2207, "NSM"],
341
+ [2208, 2249, "AL"],
342
+ [2250, 2273, "NSM"],
343
+ [2274, 2274, "AN"],
344
+ [2275, 2306, "NSM"],
345
+ [2362, 2362, "NSM"],
346
+ [2364, 2364, "NSM"],
347
+ [2369, 2376, "NSM"],
348
+ [2381, 2381, "NSM"],
349
+ [2385, 2391, "NSM"],
350
+ [2402, 2403, "NSM"],
351
+ [2433, 2433, "NSM"],
352
+ [2492, 2492, "NSM"],
353
+ [2497, 2500, "NSM"],
354
+ [2509, 2509, "NSM"],
355
+ [2530, 2531, "NSM"],
356
+ [2546, 2547, "ET"],
357
+ [2555, 2555, "ET"],
358
+ [2558, 2558, "NSM"],
359
+ [2561, 2562, "NSM"],
360
+ [2620, 2620, "NSM"],
361
+ [2625, 2626, "NSM"],
362
+ [2631, 2632, "NSM"],
363
+ [2635, 2637, "NSM"],
364
+ [2641, 2641, "NSM"],
365
+ [2672, 2673, "NSM"],
366
+ [2677, 2677, "NSM"],
367
+ [2689, 2690, "NSM"],
368
+ [2748, 2748, "NSM"],
369
+ [2753, 2757, "NSM"],
370
+ [2759, 2760, "NSM"],
371
+ [2765, 2765, "NSM"],
372
+ [2786, 2787, "NSM"],
373
+ [2801, 2801, "ET"],
374
+ [2810, 2815, "NSM"],
375
+ [2817, 2817, "NSM"],
376
+ [2876, 2876, "NSM"],
377
+ [2879, 2879, "NSM"],
378
+ [2881, 2884, "NSM"],
379
+ [2893, 2893, "NSM"],
380
+ [2901, 2902, "NSM"],
381
+ [2914, 2915, "NSM"],
382
+ [2946, 2946, "NSM"],
383
+ [3008, 3008, "NSM"],
384
+ [3021, 3021, "NSM"],
385
+ [3059, 3064, "ON"],
386
+ [3065, 3065, "ET"],
387
+ [3066, 3066, "ON"],
388
+ [3072, 3072, "NSM"],
389
+ [3076, 3076, "NSM"],
390
+ [3132, 3132, "NSM"],
391
+ [3134, 3136, "NSM"],
392
+ [3142, 3144, "NSM"],
393
+ [3146, 3149, "NSM"],
394
+ [3157, 3158, "NSM"],
395
+ [3170, 3171, "NSM"],
396
+ [3192, 3198, "ON"],
397
+ [3201, 3201, "NSM"],
398
+ [3260, 3260, "NSM"],
399
+ [3276, 3277, "NSM"],
400
+ [3298, 3299, "NSM"],
401
+ [3328, 3329, "NSM"],
402
+ [3387, 3388, "NSM"],
403
+ [3393, 3396, "NSM"],
404
+ [3405, 3405, "NSM"],
405
+ [3426, 3427, "NSM"],
406
+ [3457, 3457, "NSM"],
407
+ [3530, 3530, "NSM"],
408
+ [3538, 3540, "NSM"],
409
+ [3542, 3542, "NSM"],
410
+ [3633, 3633, "NSM"],
411
+ [3636, 3642, "NSM"],
412
+ [3647, 3647, "ET"],
413
+ [3655, 3662, "NSM"],
414
+ [3761, 3761, "NSM"],
415
+ [3764, 3772, "NSM"],
416
+ [3784, 3790, "NSM"],
417
+ [3864, 3865, "NSM"],
418
+ [3893, 3893, "NSM"],
419
+ [3895, 3895, "NSM"],
420
+ [3897, 3897, "NSM"],
421
+ [3898, 3901, "ON"],
422
+ [3953, 3966, "NSM"],
423
+ [3968, 3972, "NSM"],
424
+ [3974, 3975, "NSM"],
425
+ [3981, 3991, "NSM"],
426
+ [3993, 4028, "NSM"],
427
+ [4038, 4038, "NSM"],
428
+ [4141, 4144, "NSM"],
429
+ [4146, 4151, "NSM"],
430
+ [4153, 4154, "NSM"],
431
+ [4157, 4158, "NSM"],
432
+ [4184, 4185, "NSM"],
433
+ [4190, 4192, "NSM"],
434
+ [4209, 4212, "NSM"],
435
+ [4226, 4226, "NSM"],
436
+ [4229, 4230, "NSM"],
437
+ [4237, 4237, "NSM"],
438
+ [4253, 4253, "NSM"],
439
+ [4957, 4959, "NSM"],
440
+ [5008, 5017, "ON"],
441
+ [5120, 5120, "ON"],
442
+ [5760, 5760, "WS"],
443
+ [5787, 5788, "ON"],
444
+ [5906, 5908, "NSM"],
445
+ [5938, 5939, "NSM"],
446
+ [5970, 5971, "NSM"],
447
+ [6002, 6003, "NSM"],
448
+ [6068, 6069, "NSM"],
449
+ [6071, 6077, "NSM"],
450
+ [6086, 6086, "NSM"],
451
+ [6089, 6099, "NSM"],
452
+ [6107, 6107, "ET"],
453
+ [6109, 6109, "NSM"],
454
+ [6128, 6137, "ON"],
455
+ [6144, 6154, "ON"],
456
+ [6155, 6157, "NSM"],
457
+ [6158, 6158, "BN"],
458
+ [6159, 6159, "NSM"],
459
+ [6277, 6278, "NSM"],
460
+ [6313, 6313, "NSM"],
461
+ [6432, 6434, "NSM"],
462
+ [6439, 6440, "NSM"],
463
+ [6450, 6450, "NSM"],
464
+ [6457, 6459, "NSM"],
465
+ [6464, 6464, "ON"],
466
+ [6468, 6469, "ON"],
467
+ [6622, 6655, "ON"],
468
+ [6679, 6680, "NSM"],
469
+ [6683, 6683, "NSM"],
470
+ [6742, 6742, "NSM"],
471
+ [6744, 6750, "NSM"],
472
+ [6752, 6752, "NSM"],
473
+ [6754, 6754, "NSM"],
474
+ [6757, 6764, "NSM"],
475
+ [6771, 6780, "NSM"],
476
+ [6783, 6783, "NSM"],
477
+ [6832, 6877, "NSM"],
478
+ [6880, 6891, "NSM"],
479
+ [6912, 6915, "NSM"],
480
+ [6964, 6964, "NSM"],
481
+ [6966, 6970, "NSM"],
482
+ [6972, 6972, "NSM"],
483
+ [6978, 6978, "NSM"],
484
+ [7019, 7027, "NSM"],
485
+ [7040, 7041, "NSM"],
486
+ [7074, 7077, "NSM"],
487
+ [7080, 7081, "NSM"],
488
+ [7083, 7085, "NSM"],
489
+ [7142, 7142, "NSM"],
490
+ [7144, 7145, "NSM"],
491
+ [7149, 7149, "NSM"],
492
+ [7151, 7153, "NSM"],
493
+ [7212, 7219, "NSM"],
494
+ [7222, 7223, "NSM"],
495
+ [7376, 7378, "NSM"],
496
+ [7380, 7392, "NSM"],
497
+ [7394, 7400, "NSM"],
498
+ [7405, 7405, "NSM"],
499
+ [7412, 7412, "NSM"],
500
+ [7416, 7417, "NSM"],
501
+ [7616, 7679, "NSM"],
502
+ [8125, 8125, "ON"],
503
+ [8127, 8129, "ON"],
504
+ [8141, 8143, "ON"],
505
+ [8157, 8159, "ON"],
506
+ [8173, 8175, "ON"],
507
+ [8189, 8190, "ON"],
508
+ [8192, 8202, "WS"],
509
+ [8203, 8205, "BN"],
510
+ [8207, 8207, "R"],
511
+ [8208, 8231, "ON"],
512
+ [8232, 8232, "WS"],
513
+ [8233, 8233, "B"],
514
+ [8234, 8238, "BN"],
515
+ [8239, 8239, "CS"],
516
+ [8240, 8244, "ET"],
517
+ [8245, 8259, "ON"],
518
+ [8260, 8260, "CS"],
519
+ [8261, 8286, "ON"],
520
+ [8287, 8287, "WS"],
521
+ [8288, 8303, "BN"],
522
+ [8304, 8304, "EN"],
523
+ [8308, 8313, "EN"],
524
+ [8314, 8315, "ES"],
525
+ [8316, 8318, "ON"],
526
+ [8320, 8329, "EN"],
527
+ [8330, 8331, "ES"],
528
+ [8332, 8334, "ON"],
529
+ [8352, 8399, "ET"],
530
+ [8400, 8432, "NSM"],
531
+ [8448, 8449, "ON"],
532
+ [8451, 8454, "ON"],
533
+ [8456, 8457, "ON"],
534
+ [8468, 8468, "ON"],
535
+ [8470, 8472, "ON"],
536
+ [8478, 8483, "ON"],
537
+ [8485, 8485, "ON"],
538
+ [8487, 8487, "ON"],
539
+ [8489, 8489, "ON"],
540
+ [8494, 8494, "ET"],
541
+ [8506, 8507, "ON"],
542
+ [8512, 8516, "ON"],
543
+ [8522, 8525, "ON"],
544
+ [8528, 8543, "ON"],
545
+ [8585, 8587, "ON"],
546
+ [8592, 8721, "ON"],
547
+ [8722, 8722, "ES"],
548
+ [8723, 8723, "ET"],
549
+ [8724, 9013, "ON"],
550
+ [9083, 9108, "ON"],
551
+ [9110, 9257, "ON"],
552
+ [9280, 9290, "ON"],
553
+ [9312, 9351, "ON"],
554
+ [9352, 9371, "EN"],
555
+ [9450, 9899, "ON"],
556
+ [9901, 10239, "ON"],
557
+ [10496, 11123, "ON"],
558
+ [11126, 11263, "ON"],
559
+ [11493, 11498, "ON"],
560
+ [11503, 11505, "NSM"],
561
+ [11513, 11519, "ON"],
562
+ [11647, 11647, "NSM"],
563
+ [11744, 11775, "NSM"],
564
+ [11776, 11869, "ON"],
565
+ [11904, 11929, "ON"],
566
+ [11931, 12019, "ON"],
567
+ [12032, 12245, "ON"],
568
+ [12272, 12287, "ON"],
569
+ [12288, 12288, "WS"],
570
+ [12289, 12292, "ON"],
571
+ [12296, 12320, "ON"],
572
+ [12330, 12333, "NSM"],
573
+ [12336, 12336, "ON"],
574
+ [12342, 12343, "ON"],
575
+ [12349, 12351, "ON"],
576
+ [12441, 12442, "NSM"],
577
+ [12443, 12444, "ON"],
578
+ [12448, 12448, "ON"],
579
+ [12539, 12539, "ON"],
580
+ [12736, 12773, "ON"],
581
+ [12783, 12783, "ON"],
582
+ [12829, 12830, "ON"],
583
+ [12880, 12895, "ON"],
584
+ [12924, 12926, "ON"],
585
+ [12977, 12991, "ON"],
586
+ [13004, 13007, "ON"],
587
+ [13175, 13178, "ON"],
588
+ [13278, 13279, "ON"],
589
+ [13311, 13311, "ON"],
590
+ [19904, 19967, "ON"],
591
+ [42128, 42182, "ON"],
592
+ [42509, 42511, "ON"],
593
+ [42607, 42610, "NSM"],
594
+ [42611, 42611, "ON"],
595
+ [42612, 42621, "NSM"],
596
+ [42622, 42623, "ON"],
597
+ [42654, 42655, "NSM"],
598
+ [42736, 42737, "NSM"],
599
+ [42752, 42785, "ON"],
600
+ [42888, 42888, "ON"],
601
+ [43010, 43010, "NSM"],
602
+ [43014, 43014, "NSM"],
603
+ [43019, 43019, "NSM"],
604
+ [43045, 43046, "NSM"],
605
+ [43048, 43051, "ON"],
606
+ [43052, 43052, "NSM"],
607
+ [43064, 43065, "ET"],
608
+ [43124, 43127, "ON"],
609
+ [43204, 43205, "NSM"],
610
+ [43232, 43249, "NSM"],
611
+ [43263, 43263, "NSM"],
612
+ [43302, 43309, "NSM"],
613
+ [43335, 43345, "NSM"],
614
+ [43392, 43394, "NSM"],
615
+ [43443, 43443, "NSM"],
616
+ [43446, 43449, "NSM"],
617
+ [43452, 43453, "NSM"],
618
+ [43493, 43493, "NSM"],
619
+ [43561, 43566, "NSM"],
620
+ [43569, 43570, "NSM"],
621
+ [43573, 43574, "NSM"],
622
+ [43587, 43587, "NSM"],
623
+ [43596, 43596, "NSM"],
624
+ [43644, 43644, "NSM"],
625
+ [43696, 43696, "NSM"],
626
+ [43698, 43700, "NSM"],
627
+ [43703, 43704, "NSM"],
628
+ [43710, 43711, "NSM"],
629
+ [43713, 43713, "NSM"],
630
+ [43756, 43757, "NSM"],
631
+ [43766, 43766, "NSM"],
632
+ [43882, 43883, "ON"],
633
+ [44005, 44005, "NSM"],
634
+ [44008, 44008, "NSM"],
635
+ [44013, 44013, "NSM"],
636
+ [64285, 64285, "R"],
637
+ [64286, 64286, "NSM"],
638
+ [64287, 64296, "R"],
639
+ [64297, 64297, "ES"],
640
+ [64298, 64335, "R"],
641
+ [64336, 64450, "AL"],
642
+ [64451, 64466, "ON"],
643
+ [64467, 64829, "AL"],
644
+ [64830, 64847, "ON"],
645
+ [64848, 64911, "AL"],
646
+ [64912, 64913, "ON"],
647
+ [64914, 64967, "AL"],
648
+ [64968, 64975, "ON"],
649
+ [64976, 65007, "BN"],
650
+ [65008, 65020, "AL"],
651
+ [65021, 65023, "ON"],
652
+ [65024, 65039, "NSM"],
653
+ [65040, 65049, "ON"],
654
+ [65056, 65071, "NSM"],
655
+ [65072, 65103, "ON"],
656
+ [65104, 65104, "CS"],
657
+ [65105, 65105, "ON"],
658
+ [65106, 65106, "CS"],
659
+ [65108, 65108, "ON"],
660
+ [65109, 65109, "CS"],
661
+ [65110, 65118, "ON"],
662
+ [65119, 65119, "ET"],
663
+ [65120, 65121, "ON"],
664
+ [65122, 65123, "ES"],
665
+ [65124, 65126, "ON"],
666
+ [65128, 65128, "ON"],
667
+ [65129, 65130, "ET"],
668
+ [65131, 65131, "ON"],
669
+ [65136, 65278, "AL"],
670
+ [65279, 65279, "BN"],
671
+ [65281, 65282, "ON"],
672
+ [65283, 65285, "ET"],
673
+ [65286, 65290, "ON"],
674
+ [65291, 65291, "ES"],
675
+ [65292, 65292, "CS"],
676
+ [65293, 65293, "ES"],
677
+ [65294, 65295, "CS"],
678
+ [65296, 65305, "EN"],
679
+ [65306, 65306, "CS"],
680
+ [65307, 65312, "ON"],
681
+ [65339, 65344, "ON"],
682
+ [65371, 65381, "ON"],
683
+ [65504, 65505, "ET"],
684
+ [65506, 65508, "ON"],
685
+ [65509, 65510, "ET"],
686
+ [65512, 65518, "ON"],
687
+ [65520, 65528, "BN"],
688
+ [65529, 65533, "ON"],
689
+ [65534, 65535, "BN"],
690
+ [65793, 65793, "ON"],
691
+ [65856, 65932, "ON"],
692
+ [65936, 65948, "ON"],
693
+ [65952, 65952, "ON"],
694
+ [66045, 66045, "NSM"],
695
+ [66272, 66272, "NSM"],
696
+ [66273, 66299, "EN"],
697
+ [66422, 66426, "NSM"],
698
+ [67584, 67870, "R"],
699
+ [67871, 67871, "ON"],
700
+ [67872, 68096, "R"],
701
+ [68097, 68099, "NSM"],
702
+ [68100, 68100, "R"],
703
+ [68101, 68102, "NSM"],
704
+ [68103, 68107, "R"],
705
+ [68108, 68111, "NSM"],
706
+ [68112, 68151, "R"],
707
+ [68152, 68154, "NSM"],
708
+ [68155, 68158, "R"],
709
+ [68159, 68159, "NSM"],
710
+ [68160, 68324, "R"],
711
+ [68325, 68326, "NSM"],
712
+ [68327, 68408, "R"],
713
+ [68409, 68415, "ON"],
714
+ [68416, 68863, "R"],
715
+ [68864, 68899, "AL"],
716
+ [68900, 68903, "NSM"],
717
+ [68904, 68911, "AL"],
718
+ [68912, 68921, "AN"],
719
+ [68922, 68927, "AL"],
720
+ [68928, 68937, "AN"],
721
+ [68938, 68968, "R"],
722
+ [68969, 68973, "NSM"],
723
+ [68974, 68974, "ON"],
724
+ [68975, 69215, "R"],
725
+ [69216, 69246, "AN"],
726
+ [69247, 69290, "R"],
727
+ [69291, 69292, "NSM"],
728
+ [69293, 69311, "R"],
729
+ [69312, 69327, "AL"],
730
+ [69328, 69336, "ON"],
731
+ [69337, 69369, "AL"],
732
+ [69370, 69375, "NSM"],
733
+ [69376, 69423, "R"],
734
+ [69424, 69445, "AL"],
735
+ [69446, 69456, "NSM"],
736
+ [69457, 69487, "AL"],
737
+ [69488, 69505, "R"],
738
+ [69506, 69509, "NSM"],
739
+ [69510, 69631, "R"],
740
+ [69633, 69633, "NSM"],
741
+ [69688, 69702, "NSM"],
742
+ [69714, 69733, "ON"],
743
+ [69744, 69744, "NSM"],
744
+ [69747, 69748, "NSM"],
745
+ [69759, 69761, "NSM"],
746
+ [69811, 69814, "NSM"],
747
+ [69817, 69818, "NSM"],
748
+ [69826, 69826, "NSM"],
749
+ [69888, 69890, "NSM"],
750
+ [69927, 69931, "NSM"],
751
+ [69933, 69940, "NSM"],
752
+ [70003, 70003, "NSM"],
753
+ [70016, 70017, "NSM"],
754
+ [70070, 70078, "NSM"],
755
+ [70089, 70092, "NSM"],
756
+ [70095, 70095, "NSM"],
757
+ [70191, 70193, "NSM"],
758
+ [70196, 70196, "NSM"],
759
+ [70198, 70199, "NSM"],
760
+ [70206, 70206, "NSM"],
761
+ [70209, 70209, "NSM"],
762
+ [70367, 70367, "NSM"],
763
+ [70371, 70378, "NSM"],
764
+ [70400, 70401, "NSM"],
765
+ [70459, 70460, "NSM"],
766
+ [70464, 70464, "NSM"],
767
+ [70502, 70508, "NSM"],
768
+ [70512, 70516, "NSM"],
769
+ [70587, 70592, "NSM"],
770
+ [70606, 70606, "NSM"],
771
+ [70608, 70608, "NSM"],
772
+ [70610, 70610, "NSM"],
773
+ [70625, 70626, "NSM"],
774
+ [70712, 70719, "NSM"],
775
+ [70722, 70724, "NSM"],
776
+ [70726, 70726, "NSM"],
777
+ [70750, 70750, "NSM"],
778
+ [70835, 70840, "NSM"],
779
+ [70842, 70842, "NSM"],
780
+ [70847, 70848, "NSM"],
781
+ [70850, 70851, "NSM"],
782
+ [71090, 71093, "NSM"],
783
+ [71100, 71101, "NSM"],
784
+ [71103, 71104, "NSM"],
785
+ [71132, 71133, "NSM"],
786
+ [71219, 71226, "NSM"],
787
+ [71229, 71229, "NSM"],
788
+ [71231, 71232, "NSM"],
789
+ [71264, 71276, "ON"],
790
+ [71339, 71339, "NSM"],
791
+ [71341, 71341, "NSM"],
792
+ [71344, 71349, "NSM"],
793
+ [71351, 71351, "NSM"],
794
+ [71453, 71453, "NSM"],
795
+ [71455, 71455, "NSM"],
796
+ [71458, 71461, "NSM"],
797
+ [71463, 71467, "NSM"],
798
+ [71727, 71735, "NSM"],
799
+ [71737, 71738, "NSM"],
800
+ [71995, 71996, "NSM"],
801
+ [71998, 71998, "NSM"],
802
+ [72003, 72003, "NSM"],
803
+ [72148, 72151, "NSM"],
804
+ [72154, 72155, "NSM"],
805
+ [72160, 72160, "NSM"],
806
+ [72193, 72198, "NSM"],
807
+ [72201, 72202, "NSM"],
808
+ [72243, 72248, "NSM"],
809
+ [72251, 72254, "NSM"],
810
+ [72263, 72263, "NSM"],
811
+ [72273, 72278, "NSM"],
812
+ [72281, 72283, "NSM"],
813
+ [72330, 72342, "NSM"],
814
+ [72344, 72345, "NSM"],
815
+ [72544, 72544, "NSM"],
816
+ [72546, 72548, "NSM"],
817
+ [72550, 72550, "NSM"],
818
+ [72752, 72758, "NSM"],
819
+ [72760, 72765, "NSM"],
820
+ [72850, 72871, "NSM"],
821
+ [72874, 72880, "NSM"],
822
+ [72882, 72883, "NSM"],
823
+ [72885, 72886, "NSM"],
824
+ [73009, 73014, "NSM"],
825
+ [73018, 73018, "NSM"],
826
+ [73020, 73021, "NSM"],
827
+ [73023, 73029, "NSM"],
828
+ [73031, 73031, "NSM"],
829
+ [73104, 73105, "NSM"],
830
+ [73109, 73109, "NSM"],
831
+ [73111, 73111, "NSM"],
832
+ [73459, 73460, "NSM"],
833
+ [73472, 73473, "NSM"],
834
+ [73526, 73530, "NSM"],
835
+ [73536, 73536, "NSM"],
836
+ [73538, 73538, "NSM"],
837
+ [73562, 73562, "NSM"],
838
+ [73685, 73692, "ON"],
839
+ [73693, 73696, "ET"],
840
+ [73697, 73713, "ON"],
841
+ [78912, 78912, "NSM"],
842
+ [78919, 78933, "NSM"],
843
+ [90398, 90409, "NSM"],
844
+ [90413, 90415, "NSM"],
845
+ [92912, 92916, "NSM"],
846
+ [92976, 92982, "NSM"],
847
+ [94031, 94031, "NSM"],
848
+ [94095, 94098, "NSM"],
849
+ [94178, 94178, "ON"],
850
+ [94180, 94180, "NSM"],
851
+ [113821, 113822, "NSM"],
852
+ [113824, 113827, "BN"],
853
+ [117760, 117973, "ON"],
854
+ [118e3, 118009, "EN"],
855
+ [118010, 118012, "ON"],
856
+ [118016, 118451, "ON"],
857
+ [118458, 118480, "ON"],
858
+ [118496, 118512, "ON"],
859
+ [118528, 118573, "NSM"],
860
+ [118576, 118598, "NSM"],
861
+ [119143, 119145, "NSM"],
862
+ [119155, 119162, "BN"],
863
+ [119163, 119170, "NSM"],
864
+ [119173, 119179, "NSM"],
865
+ [119210, 119213, "NSM"],
866
+ [119273, 119274, "ON"],
867
+ [119296, 119361, "ON"],
868
+ [119362, 119364, "NSM"],
869
+ [119365, 119365, "ON"],
870
+ [119552, 119638, "ON"],
871
+ [120513, 120513, "ON"],
872
+ [120539, 120539, "ON"],
873
+ [120571, 120571, "ON"],
874
+ [120597, 120597, "ON"],
875
+ [120629, 120629, "ON"],
876
+ [120655, 120655, "ON"],
877
+ [120687, 120687, "ON"],
878
+ [120713, 120713, "ON"],
879
+ [120745, 120745, "ON"],
880
+ [120771, 120771, "ON"],
881
+ [120782, 120831, "EN"],
882
+ [121344, 121398, "NSM"],
883
+ [121403, 121452, "NSM"],
884
+ [121461, 121461, "NSM"],
885
+ [121476, 121476, "NSM"],
886
+ [121499, 121503, "NSM"],
887
+ [121505, 121519, "NSM"],
888
+ [122880, 122886, "NSM"],
889
+ [122888, 122904, "NSM"],
890
+ [122907, 122913, "NSM"],
891
+ [122915, 122916, "NSM"],
892
+ [122918, 122922, "NSM"],
893
+ [123023, 123023, "NSM"],
894
+ [123184, 123190, "NSM"],
895
+ [123566, 123566, "NSM"],
896
+ [123628, 123631, "NSM"],
897
+ [123647, 123647, "ET"],
898
+ [124140, 124143, "NSM"],
899
+ [124398, 124399, "NSM"],
900
+ [124643, 124643, "NSM"],
901
+ [124646, 124646, "NSM"],
902
+ [124654, 124655, "NSM"],
903
+ [124661, 124661, "NSM"],
904
+ [124928, 125135, "R"],
905
+ [125136, 125142, "NSM"],
906
+ [125143, 125251, "R"],
907
+ [125252, 125258, "NSM"],
908
+ [125259, 126063, "R"],
909
+ [126064, 126143, "AL"],
910
+ [126144, 126207, "R"],
911
+ [126208, 126287, "AL"],
912
+ [126288, 126463, "R"],
913
+ [126464, 126703, "AL"],
914
+ [126704, 126705, "ON"],
915
+ [126706, 126719, "AL"],
916
+ [126720, 126975, "R"],
917
+ [126976, 127019, "ON"],
918
+ [127024, 127123, "ON"],
919
+ [127136, 127150, "ON"],
920
+ [127153, 127167, "ON"],
921
+ [127169, 127183, "ON"],
922
+ [127185, 127221, "ON"],
923
+ [127232, 127242, "EN"],
924
+ [127243, 127247, "ON"],
925
+ [127279, 127279, "ON"],
926
+ [127338, 127343, "ON"],
927
+ [127405, 127405, "ON"],
928
+ [127584, 127589, "ON"],
929
+ [127744, 128728, "ON"],
930
+ [128732, 128748, "ON"],
931
+ [128752, 128764, "ON"],
932
+ [128768, 128985, "ON"],
933
+ [128992, 129003, "ON"],
934
+ [129008, 129008, "ON"],
935
+ [129024, 129035, "ON"],
936
+ [129040, 129095, "ON"],
937
+ [129104, 129113, "ON"],
938
+ [129120, 129159, "ON"],
939
+ [129168, 129197, "ON"],
940
+ [129200, 129211, "ON"],
941
+ [129216, 129217, "ON"],
942
+ [129232, 129240, "ON"],
943
+ [129280, 129623, "ON"],
944
+ [129632, 129645, "ON"],
945
+ [129648, 129660, "ON"],
946
+ [129664, 129674, "ON"],
947
+ [129678, 129734, "ON"],
948
+ [129736, 129736, "ON"],
949
+ [129741, 129756, "ON"],
950
+ [129759, 129770, "ON"],
951
+ [129775, 129784, "ON"],
952
+ [129792, 129938, "ON"],
953
+ [129940, 130031, "ON"],
954
+ [130032, 130041, "EN"],
955
+ [130042, 130042, "ON"],
956
+ [131070, 131071, "BN"],
957
+ [196606, 196607, "BN"],
958
+ [262142, 262143, "BN"],
959
+ [327678, 327679, "BN"],
960
+ [393214, 393215, "BN"],
961
+ [458750, 458751, "BN"],
962
+ [524286, 524287, "BN"],
963
+ [589822, 589823, "BN"],
964
+ [655358, 655359, "BN"],
965
+ [720894, 720895, "BN"],
966
+ [786430, 786431, "BN"],
967
+ [851966, 851967, "BN"],
968
+ [917502, 917759, "BN"],
969
+ [917760, 917999, "NSM"],
970
+ [918e3, 921599, "BN"],
971
+ [983038, 983039, "BN"],
972
+ [1048574, 1048575, "BN"],
973
+ [1114110, 1114111, "BN"]
974
+ ];
975
+ function An(e) {
976
+ if (e <= 255)
977
+ return mn[e];
978
+ let t = 0, n = pt.length - 1;
979
+ for (; t <= n; ) {
980
+ const i = t + n >> 1, x = pt[i];
981
+ if (e < x[0]) {
982
+ n = i - 1;
983
+ continue;
984
+ }
985
+ if (e > x[1]) {
986
+ t = i + 1;
987
+ continue;
988
+ }
989
+ return x[2];
990
+ }
991
+ return "L";
992
+ }
993
+ function En(e) {
994
+ const t = e.length;
995
+ if (t === 0)
996
+ return null;
997
+ const n = new Array(t);
998
+ let i = !1;
999
+ for (let r = 0; r < t; ) {
1000
+ const c = e.charCodeAt(r);
1001
+ let a = c, u = 1;
1002
+ if (c >= 55296 && c <= 56319 && r + 1 < t) {
1003
+ const S = e.charCodeAt(r + 1);
1004
+ S >= 56320 && S <= 57343 && (a = (c - 55296 << 10) + (S - 56320) + 65536, u = 2);
1005
+ }
1006
+ const d = An(a);
1007
+ (d === "R" || d === "AL" || d === "AN") && (i = !0);
1008
+ for (let S = 0; S < u; S++)
1009
+ n[r + S] = d;
1010
+ r += u;
1011
+ }
1012
+ if (!i)
1013
+ return null;
1014
+ let x = 0;
1015
+ for (let r = 0; r < t; r++) {
1016
+ const c = n[r];
1017
+ if (c === "L") {
1018
+ x = 0;
1019
+ break;
1020
+ }
1021
+ if (c === "R" || c === "AL") {
1022
+ x = 1;
1023
+ break;
1024
+ }
1025
+ }
1026
+ const s = new Int8Array(t);
1027
+ for (let r = 0; r < t; r++)
1028
+ s[r] = x;
1029
+ const l = x & 1 ? "R" : "L", f = l;
1030
+ let o = f;
1031
+ for (let r = 0; r < t; r++)
1032
+ n[r] === "NSM" ? n[r] = o : o = n[r];
1033
+ o = f;
1034
+ for (let r = 0; r < t; r++) {
1035
+ const c = n[r];
1036
+ c === "EN" ? n[r] = o === "AL" ? "AN" : "EN" : (c === "R" || c === "L" || c === "AL") && (o = c);
1037
+ }
1038
+ for (let r = 0; r < t; r++)
1039
+ n[r] === "AL" && (n[r] = "R");
1040
+ for (let r = 1; r < t - 1; r++)
1041
+ n[r] === "ES" && n[r - 1] === "EN" && n[r + 1] === "EN" && (n[r] = "EN"), n[r] === "CS" && (n[r - 1] === "EN" || n[r - 1] === "AN") && n[r + 1] === n[r - 1] && (n[r] = n[r - 1]);
1042
+ for (let r = 0; r < t; r++) {
1043
+ if (n[r] !== "EN")
1044
+ continue;
1045
+ let c;
1046
+ for (c = r - 1; c >= 0 && n[c] === "ET"; c--)
1047
+ n[c] = "EN";
1048
+ for (c = r + 1; c < t && n[c] === "ET"; c++)
1049
+ n[c] = "EN";
1050
+ }
1051
+ for (let r = 0; r < t; r++) {
1052
+ const c = n[r];
1053
+ (c === "WS" || c === "ES" || c === "ET" || c === "CS") && (n[r] = "ON");
1054
+ }
1055
+ o = f;
1056
+ for (let r = 0; r < t; r++) {
1057
+ const c = n[r];
1058
+ c === "EN" ? n[r] = o === "L" ? "L" : "EN" : (c === "R" || c === "L") && (o = c);
1059
+ }
1060
+ for (let r = 0; r < t; r++) {
1061
+ if (n[r] !== "ON")
1062
+ continue;
1063
+ let c = r + 1;
1064
+ for (; c < t && n[c] === "ON"; )
1065
+ c++;
1066
+ const a = r > 0 ? n[r - 1] : f, u = c < t ? n[c] : f, d = a !== "L" ? "R" : "L";
1067
+ if (d === (u !== "L" ? "R" : "L"))
1068
+ for (let p = r; p < c; p++)
1069
+ n[p] = d;
1070
+ r = c - 1;
1071
+ }
1072
+ for (let r = 0; r < t; r++)
1073
+ n[r] === "ON" && (n[r] = l);
1074
+ for (let r = 0; r < t; r++) {
1075
+ const c = n[r];
1076
+ (s[r] & 1) === 0 ? c === "R" ? s[r]++ : (c === "AN" || c === "EN") && (s[r] += 2) : (c === "L" || c === "AN" || c === "EN") && s[r]++;
1077
+ }
1078
+ return s;
1079
+ }
1080
+ function Bn(e, t) {
1081
+ const n = En(e);
1082
+ if (n === null)
1083
+ return null;
1084
+ const i = new Int8Array(t.length);
1085
+ for (let x = 0; x < t.length; x++)
1086
+ i[x] = n[t[x]];
1087
+ return i;
1088
+ }
1089
+ const Mn = /[ \t\n\r\f]+/g, Cn = /[\t\n\r\f]| {2,}|^ | $/;
1090
+ function kn(e) {
1091
+ const t = e ?? "normal";
1092
+ return t === "pre-wrap" ? { mode: t, preserveOrdinarySpaces: !0, preserveHardBreaks: !0 } : { mode: t, preserveOrdinarySpaces: !1, preserveHardBreaks: !1 };
1093
+ }
1094
+ function Dn(e) {
1095
+ if (!Cn.test(e))
1096
+ return e;
1097
+ let t = e.replace(Mn, " ");
1098
+ return t.charCodeAt(0) === 32 && (t = t.slice(1)), t.length > 0 && t.charCodeAt(t.length - 1) === 32 && (t = t.slice(0, -1)), t;
1099
+ }
1100
+ function Ln(e) {
1101
+ return /[\r\f]/.test(e) ? e.replace(/\r\n/g, `
1102
+ `).replace(/[\r\f]/g, `
1103
+ `) : e;
1104
+ }
1105
+ let ze = null, On;
1106
+ function bn() {
1107
+ return ze === null && (ze = new Intl.Segmenter(On, { granularity: "word" })), ze;
1108
+ }
1109
+ const In = /\p{Script=Arabic}/u, ge = /\p{M}/u, tt = /\p{Nd}/u;
1110
+ function mt(e) {
1111
+ return In.test(e);
1112
+ }
1113
+ function At(e) {
1114
+ return e >= 19968 && e <= 40959 || e >= 13312 && e <= 19903 || e >= 131072 && e <= 173791 || e >= 173824 && e <= 177983 || e >= 177984 && e <= 178207 || e >= 178208 && e <= 183983 || e >= 183984 && e <= 191471 || e >= 191472 && e <= 192093 || e >= 194560 && e <= 195103 || e >= 196608 && e <= 201551 || e >= 201552 && e <= 205743 || e >= 205744 && e <= 210041 || e >= 63744 && e <= 64255 || e >= 12288 && e <= 12351 || e >= 12352 && e <= 12447 || e >= 12448 && e <= 12543 || e >= 12592 && e <= 12687 || e >= 44032 && e <= 55215 || e >= 65280 && e <= 65519;
1115
+ }
1116
+ function oe(e) {
1117
+ for (let t = 0; t < e.length; t++) {
1118
+ const n = e.charCodeAt(t);
1119
+ if (!(n < 12288)) {
1120
+ if (n >= 55296 && n <= 56319 && t + 1 < e.length) {
1121
+ const i = e.charCodeAt(t + 1);
1122
+ if (i >= 56320 && i <= 57343) {
1123
+ const x = (n - 55296 << 10) + (i - 56320) + 65536;
1124
+ if (At(x))
1125
+ return !0;
1126
+ t++;
1127
+ continue;
1128
+ }
1129
+ }
1130
+ if (At(n))
1131
+ return !0;
1132
+ }
1133
+ }
1134
+ return !1;
1135
+ }
1136
+ function yn(e) {
1137
+ const t = De(e);
1138
+ return t !== null && (nt.has(t) || Fe.has(t));
1139
+ }
1140
+ const wn = /* @__PURE__ */ new Set([
1141
+ " ",
1142
+ " ",
1143
+ "⁠",
1144
+ "\uFEFF"
1145
+ ]), Pn = /* @__PURE__ */ new Set([
1146
+ "-",
1147
+ "‐",
1148
+ "–",
1149
+ "—"
1150
+ ]);
1151
+ function Wn(e) {
1152
+ const t = De(e);
1153
+ return t !== null && wn.has(t);
1154
+ }
1155
+ function vn(e) {
1156
+ const t = De(e);
1157
+ return t !== null && Pn.has(t);
1158
+ }
1159
+ function Kt(e, t) {
1160
+ return Wn(e) ? !1 : t ? !(yn(e) || vn(e)) : !0;
1161
+ }
1162
+ const nt = /* @__PURE__ */ new Set([
1163
+ ",",
1164
+ ".",
1165
+ "!",
1166
+ ":",
1167
+ ";",
1168
+ "?",
1169
+ "、",
1170
+ "。",
1171
+ "・",
1172
+ ")",
1173
+ "〕",
1174
+ "〉",
1175
+ "》",
1176
+ "」",
1177
+ "』",
1178
+ "】",
1179
+ "〗",
1180
+ "〙",
1181
+ "〛",
1182
+ "ー",
1183
+ "々",
1184
+ "〻",
1185
+ "ゝ",
1186
+ "ゞ",
1187
+ "ヽ",
1188
+ "ヾ"
1189
+ ]), We = /* @__PURE__ */ new Set([
1190
+ '"',
1191
+ "(",
1192
+ "[",
1193
+ "{",
1194
+ "¡",
1195
+ "¿",
1196
+ "“",
1197
+ "‘",
1198
+ "‚",
1199
+ "„",
1200
+ "«",
1201
+ "‹",
1202
+ "⸘",
1203
+ "(",
1204
+ "〔",
1205
+ "〈",
1206
+ "《",
1207
+ "「",
1208
+ "『",
1209
+ "【",
1210
+ "〖",
1211
+ "〘",
1212
+ "〚"
1213
+ ]), st = /* @__PURE__ */ new Set([
1214
+ "'",
1215
+ "’"
1216
+ ]), Fe = /* @__PURE__ */ new Set([
1217
+ ".",
1218
+ ",",
1219
+ "!",
1220
+ "?",
1221
+ ":",
1222
+ ";",
1223
+ "،",
1224
+ "؛",
1225
+ "؟",
1226
+ "।",
1227
+ "॥",
1228
+ "၊",
1229
+ "။",
1230
+ "၌",
1231
+ "၍",
1232
+ "၏",
1233
+ ")",
1234
+ "]",
1235
+ "}",
1236
+ "%",
1237
+ '"',
1238
+ "”",
1239
+ "’",
1240
+ "»",
1241
+ "›",
1242
+ "…"
1243
+ ]), Rn = /* @__PURE__ */ new Set([
1244
+ ":",
1245
+ ".",
1246
+ "،",
1247
+ "؛"
1248
+ ]), Tn = /* @__PURE__ */ new Set([
1249
+ "၏"
1250
+ ]), Gn = /* @__PURE__ */ new Set([
1251
+ "”",
1252
+ "’",
1253
+ "»",
1254
+ "›",
1255
+ "」",
1256
+ "』",
1257
+ "】",
1258
+ "》",
1259
+ "〉",
1260
+ "〕",
1261
+ ")"
1262
+ ]);
1263
+ function Hn(e) {
1264
+ if (it(e))
1265
+ return !0;
1266
+ let t = !1;
1267
+ for (const n of e) {
1268
+ if (Fe.has(n) || Re(n)) {
1269
+ t = !0;
1270
+ continue;
1271
+ }
1272
+ if (!(t && ge.test(n)))
1273
+ return !1;
1274
+ }
1275
+ return t;
1276
+ }
1277
+ function _n(e) {
1278
+ for (const t of e)
1279
+ if (!nt.has(t) && !Fe.has(t))
1280
+ return !1;
1281
+ return e.length > 0;
1282
+ }
1283
+ function zn(e) {
1284
+ if (it(e))
1285
+ return !0;
1286
+ for (const t of e)
1287
+ if (!We.has(t) && !st.has(t) && !ge.test(t) && !Re(t))
1288
+ return !1;
1289
+ return e.length > 0;
1290
+ }
1291
+ function it(e) {
1292
+ let t = !1;
1293
+ for (const n of e)
1294
+ if (!(n === "\\" || ge.test(n))) {
1295
+ if (We.has(n) || Fe.has(n) || st.has(n)) {
1296
+ t = !0;
1297
+ continue;
1298
+ }
1299
+ return !1;
1300
+ }
1301
+ return t;
1302
+ }
1303
+ function ve(e, t) {
1304
+ const n = t - 1;
1305
+ if (n <= 0)
1306
+ return Math.max(n, 0);
1307
+ const i = e.charCodeAt(n);
1308
+ if (i < 56320 || i > 57343)
1309
+ return n;
1310
+ const x = n - 1;
1311
+ if (x < 0)
1312
+ return n;
1313
+ const s = e.charCodeAt(x);
1314
+ return s >= 55296 && s <= 56319 ? x : n;
1315
+ }
1316
+ function De(e) {
1317
+ if (e.length === 0)
1318
+ return null;
1319
+ const t = ve(e, e.length);
1320
+ return e.slice(t);
1321
+ }
1322
+ function Kn(e) {
1323
+ for (const t of e)
1324
+ if (!ge.test(t))
1325
+ return t;
1326
+ return null;
1327
+ }
1328
+ function jn(e) {
1329
+ for (let t = e.length; t > 0; ) {
1330
+ const n = ve(e, t), i = e.slice(n, t);
1331
+ if (!ge.test(i))
1332
+ return i;
1333
+ t = n;
1334
+ }
1335
+ return null;
1336
+ }
1337
+ const Un = [
1338
+ 36,
1339
+ 37,
1340
+ 43,
1341
+ 43,
1342
+ 92,
1343
+ 92,
1344
+ 162,
1345
+ 165,
1346
+ 176,
1347
+ 177,
1348
+ 1423,
1349
+ 1423,
1350
+ 1545,
1351
+ 1547,
1352
+ 1642,
1353
+ 1642,
1354
+ 2046,
1355
+ 2047,
1356
+ 2546,
1357
+ 2547,
1358
+ 2553,
1359
+ 2555,
1360
+ 2801,
1361
+ 2801,
1362
+ 3065,
1363
+ 3065,
1364
+ 3449,
1365
+ 3449,
1366
+ 3647,
1367
+ 3647,
1368
+ 6107,
1369
+ 6107,
1370
+ 8240,
1371
+ 8247,
1372
+ 8279,
1373
+ 8279,
1374
+ 8352,
1375
+ 8399,
1376
+ 8451,
1377
+ 8451,
1378
+ 8457,
1379
+ 8457,
1380
+ 8470,
1381
+ 8470,
1382
+ 8722,
1383
+ 8723,
1384
+ 43064,
1385
+ 43064,
1386
+ 65020,
1387
+ 65020,
1388
+ 65129,
1389
+ 65130,
1390
+ 65284,
1391
+ 65285,
1392
+ 65504,
1393
+ 65505,
1394
+ 65509,
1395
+ 65510,
1396
+ 73693,
1397
+ 73696,
1398
+ 123647,
1399
+ 123647,
1400
+ 126124,
1401
+ 126124,
1402
+ 126128,
1403
+ 126128
1404
+ ];
1405
+ function Jn(e, t) {
1406
+ for (let n = 0; n < t.length; n += 2)
1407
+ if (e >= t[n] && e <= t[n + 1])
1408
+ return !0;
1409
+ return !1;
1410
+ }
1411
+ function Re(e) {
1412
+ const t = e.codePointAt(0);
1413
+ return t !== void 0 && Jn(t, Un);
1414
+ }
1415
+ function Qn(e) {
1416
+ const t = jn(e);
1417
+ return t !== null && Re(t);
1418
+ }
1419
+ function $n(e) {
1420
+ const t = Kn(e);
1421
+ return t !== null && tt.test(t);
1422
+ }
1423
+ function Yn(e) {
1424
+ const t = Array.from(e);
1425
+ let n = t.length;
1426
+ for (; n > 0; ) {
1427
+ const i = t[n - 1];
1428
+ if (ge.test(i)) {
1429
+ n--;
1430
+ continue;
1431
+ }
1432
+ if (We.has(i) || st.has(i)) {
1433
+ n--;
1434
+ continue;
1435
+ }
1436
+ break;
1437
+ }
1438
+ return n <= 0 || n === t.length ? null : {
1439
+ head: t.slice(0, n).join(""),
1440
+ tail: t.slice(n).join("")
1441
+ };
1442
+ }
1443
+ function Xn(e, t, n) {
1444
+ return n === "text" && !t && e.length === 1 && e !== "-" && e !== "—" ? e : null;
1445
+ }
1446
+ function Et(e, t, n, i) {
1447
+ const x = t[i], s = e[i];
1448
+ if (x == null)
1449
+ return s;
1450
+ const l = n[i];
1451
+ if (s.length === l)
1452
+ return s;
1453
+ const f = x.repeat(l);
1454
+ return e[i] = f, f;
1455
+ }
1456
+ function Bt(e, t) {
1457
+ return e && t !== null && Rn.has(t);
1458
+ }
1459
+ function qn(e) {
1460
+ const t = De(e);
1461
+ return t !== null && Tn.has(t);
1462
+ }
1463
+ function Vn(e) {
1464
+ if (e.length < 2 || e[0] !== " ")
1465
+ return null;
1466
+ const t = e.slice(1);
1467
+ return /^\p{M}+$/u.test(t) ? { space: " ", marks: t } : null;
1468
+ }
1469
+ function $e(e) {
1470
+ let t = e.length;
1471
+ for (; t > 0; ) {
1472
+ const n = ve(e, t), i = e.slice(n, t);
1473
+ if (Gn.has(i))
1474
+ return !0;
1475
+ if (!Fe.has(i))
1476
+ return !1;
1477
+ t = n;
1478
+ }
1479
+ return !1;
1480
+ }
1481
+ function Zn(e, t) {
1482
+ if (t.preserveOrdinarySpaces || t.preserveHardBreaks) {
1483
+ if (e === " ")
1484
+ return "preserved-space";
1485
+ if (e === " ")
1486
+ return "tab";
1487
+ if (t.preserveHardBreaks && e === `
1488
+ `)
1489
+ return "hard-break";
1490
+ }
1491
+ return e === " " ? "space" : e === " " || e === " " || e === "⁠" || e === "\uFEFF" ? "glue" : e === "​" ? "zero-width-break" : e === "­" ? "soft-hyphen" : "text";
1492
+ }
1493
+ const e0 = /[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;
1494
+ function xe(e) {
1495
+ return e.length === 1 ? e[0] : e.join("");
1496
+ }
1497
+ function t0(e, t) {
1498
+ const n = [];
1499
+ for (let i = e.length - 1; i >= 0; i--)
1500
+ n.push(e[i]);
1501
+ return n.push(t), xe(n);
1502
+ }
1503
+ function n0(e, t, n, i) {
1504
+ if (!e0.test(e))
1505
+ return [{ text: e, isWordLike: t, kind: "text", start: n }];
1506
+ const x = [];
1507
+ let s = null, l = [], f = n, o = !1, r = 0;
1508
+ for (const c of e) {
1509
+ const a = Zn(c, i), u = a === "text" && t;
1510
+ if (s !== null && a === s && u === o) {
1511
+ l.push(c), r += c.length;
1512
+ continue;
1513
+ }
1514
+ s !== null && x.push({
1515
+ text: xe(l),
1516
+ isWordLike: o,
1517
+ kind: s,
1518
+ start: f
1519
+ }), s = a, l = [c], f = n + r, o = u, r += c.length;
1520
+ }
1521
+ return s !== null && x.push({
1522
+ text: xe(l),
1523
+ isWordLike: o,
1524
+ kind: s,
1525
+ start: f
1526
+ }), x;
1527
+ }
1528
+ function Ye(e) {
1529
+ return e === "space" || e === "preserved-space" || e === "zero-width-break" || e === "hard-break";
1530
+ }
1531
+ const s0 = /^[A-Za-z][A-Za-z0-9+.-]*:$/;
1532
+ function i0(e, t) {
1533
+ const n = e.texts[t];
1534
+ return n.startsWith("www.") ? !0 : s0.test(n) && t + 1 < e.len && e.kinds[t + 1] === "text" && e.texts[t + 1] === "//";
1535
+ }
1536
+ function x0(e) {
1537
+ return e.includes("?") && (e.includes("://") || e.startsWith("www."));
1538
+ }
1539
+ function r0(e) {
1540
+ const t = e.texts.slice(), n = e.isWordLike.slice(), i = e.kinds.slice(), x = e.starts.slice();
1541
+ for (let l = 0; l < e.len; l++) {
1542
+ if (i[l] !== "text" || !i0(e, l))
1543
+ continue;
1544
+ const f = [t[l]];
1545
+ let o = l + 1;
1546
+ for (; o < e.len && !Ye(i[o]); ) {
1547
+ f.push(t[o]), n[l] = !0;
1548
+ const r = t[o].includes("?");
1549
+ if (i[o] = "text", t[o] = "", o++, r)
1550
+ break;
1551
+ }
1552
+ t[l] = xe(f);
1553
+ }
1554
+ let s = 0;
1555
+ for (let l = 0; l < t.length; l++) {
1556
+ const f = t[l];
1557
+ f.length !== 0 && (s !== l && (t[s] = f, n[s] = n[l], i[s] = i[l], x[s] = x[l]), s++);
1558
+ }
1559
+ return t.length = s, n.length = s, i.length = s, x.length = s, {
1560
+ len: s,
1561
+ texts: t,
1562
+ isWordLike: n,
1563
+ kinds: i,
1564
+ starts: x
1565
+ };
1566
+ }
1567
+ function o0(e) {
1568
+ const t = [], n = [], i = [], x = [];
1569
+ for (let s = 0; s < e.len; s++) {
1570
+ const l = e.texts[s];
1571
+ if (t.push(l), n.push(e.isWordLike[s]), i.push(e.kinds[s]), x.push(e.starts[s]), !x0(l))
1572
+ continue;
1573
+ const f = s + 1;
1574
+ if (f >= e.len || Ye(e.kinds[f]))
1575
+ continue;
1576
+ const o = [], r = e.starts[f];
1577
+ let c = f;
1578
+ for (; c < e.len && !Ye(e.kinds[c]); )
1579
+ o.push(e.texts[c]), c++;
1580
+ o.length > 0 && (t.push(xe(o)), n.push(!0), i.push("text"), x.push(r), s = c - 1);
1581
+ }
1582
+ return {
1583
+ len: t.length,
1584
+ texts: t,
1585
+ isWordLike: n,
1586
+ kinds: i,
1587
+ starts: x
1588
+ };
1589
+ }
1590
+ const l0 = /* @__PURE__ */ new Set([
1591
+ ":",
1592
+ "-",
1593
+ "/",
1594
+ "×",
1595
+ ",",
1596
+ ".",
1597
+ "+",
1598
+ "–",
1599
+ "—"
1600
+ ]), c0 = /* @__PURE__ */ new Set([".", ",", ":", ";"]);
1601
+ function Mt(e) {
1602
+ for (let t = e.length; t > 0; ) {
1603
+ const n = ve(e, t), i = e.slice(n, t);
1604
+ if (ge.test(i)) {
1605
+ t = n;
1606
+ continue;
1607
+ }
1608
+ return c0.has(i) || Re(i);
1609
+ }
1610
+ return !1;
1611
+ }
1612
+ function a0(e, t) {
1613
+ return t && !oe(e);
1614
+ }
1615
+ function jt(e) {
1616
+ for (const t of e)
1617
+ if (tt.test(t))
1618
+ return !0;
1619
+ return !1;
1620
+ }
1621
+ function ye(e) {
1622
+ if (e.length === 0)
1623
+ return !1;
1624
+ for (const t of e)
1625
+ if (!(tt.test(t) || l0.has(t)))
1626
+ return !1;
1627
+ return !0;
1628
+ }
1629
+ function u0(e) {
1630
+ const t = [], n = [], i = [], x = [];
1631
+ for (let s = 0; s < e.len; s++) {
1632
+ const l = e.texts[s], f = e.kinds[s];
1633
+ if (f === "text" && ye(l) && jt(l)) {
1634
+ const o = [l];
1635
+ let r = s + 1;
1636
+ for (; r < e.len && e.kinds[r] === "text" && ye(e.texts[r]); )
1637
+ o.push(e.texts[r]), r++;
1638
+ t.push(xe(o)), n.push(!0), i.push("text"), x.push(e.starts[s]), s = r - 1;
1639
+ continue;
1640
+ }
1641
+ t.push(l), n.push(e.isWordLike[s]), i.push(f), x.push(e.starts[s]);
1642
+ }
1643
+ return {
1644
+ len: t.length,
1645
+ texts: t,
1646
+ isWordLike: n,
1647
+ kinds: i,
1648
+ starts: x
1649
+ };
1650
+ }
1651
+ function f0(e) {
1652
+ const t = [], n = [], i = [], x = [];
1653
+ for (let s = 0; s < e.len; s++) {
1654
+ const l = e.texts[s], f = e.kinds[s], o = e.isWordLike[s];
1655
+ if (f === "text" && Mt(l) && (o || Qn(l)) && !oe(l)) {
1656
+ const r = [l];
1657
+ let c = !0, a = s + 1;
1658
+ for (; c && a < e.len && e.kinds[a] === "text" && a0(e.texts[a], e.isWordLike[a]); ) {
1659
+ const u = e.texts[a];
1660
+ r.push(u), c = Mt(u), a++;
1661
+ }
1662
+ t.push(xe(r)), n.push(!0), i.push("text"), x.push(e.starts[s]), s = a - 1;
1663
+ continue;
1664
+ }
1665
+ t.push(l), n.push(o), i.push(f), x.push(e.starts[s]);
1666
+ }
1667
+ return {
1668
+ len: t.length,
1669
+ texts: t,
1670
+ isWordLike: n,
1671
+ kinds: i,
1672
+ starts: x
1673
+ };
1674
+ }
1675
+ function h0(e) {
1676
+ const t = [], n = [], i = [], x = [];
1677
+ for (let s = 0; s < e.len; s++) {
1678
+ const l = e.texts[s];
1679
+ if (e.kinds[s] === "text" && l.includes("-")) {
1680
+ const f = l.split("-");
1681
+ let o = f.length > 1;
1682
+ for (let r = 0; r < f.length; r++) {
1683
+ const c = f[r];
1684
+ if (!o)
1685
+ break;
1686
+ (c.length === 0 || !jt(c) || !ye(c)) && (o = !1);
1687
+ }
1688
+ if (o) {
1689
+ let r = 0;
1690
+ for (let c = 0; c < f.length; c++) {
1691
+ const a = f[c], u = c < f.length - 1 ? `${a}-` : a;
1692
+ t.push(u), n.push(!0), i.push("text"), x.push(e.starts[s] + r), r += u.length;
1693
+ }
1694
+ continue;
1695
+ }
1696
+ }
1697
+ t.push(l), n.push(e.isWordLike[s]), i.push(e.kinds[s]), x.push(e.starts[s]);
1698
+ }
1699
+ return {
1700
+ len: t.length,
1701
+ texts: t,
1702
+ isWordLike: n,
1703
+ kinds: i,
1704
+ starts: x
1705
+ };
1706
+ }
1707
+ function d0(e) {
1708
+ const t = [], n = [], i = [], x = [];
1709
+ let s = 0;
1710
+ for (; s < e.len; ) {
1711
+ const l = [e.texts[s]];
1712
+ let f = e.isWordLike[s], o = e.kinds[s], r = e.starts[s];
1713
+ if (o === "glue") {
1714
+ const c = [l[0]], a = r;
1715
+ for (s++; s < e.len && e.kinds[s] === "glue"; )
1716
+ c.push(e.texts[s]), s++;
1717
+ const u = xe(c);
1718
+ if (s < e.len && e.kinds[s] === "text")
1719
+ l[0] = u, l.push(e.texts[s]), f = e.isWordLike[s], o = "text", r = a, s++;
1720
+ else {
1721
+ t.push(u), n.push(!1), i.push("glue"), x.push(a);
1722
+ continue;
1723
+ }
1724
+ } else
1725
+ s++;
1726
+ if (o === "text")
1727
+ for (; s < e.len && e.kinds[s] === "glue"; ) {
1728
+ const c = [];
1729
+ for (; s < e.len && e.kinds[s] === "glue"; )
1730
+ c.push(e.texts[s]), s++;
1731
+ const a = xe(c);
1732
+ if (s < e.len && e.kinds[s] === "text") {
1733
+ l.push(a, e.texts[s]), f = f || e.isWordLike[s], s++;
1734
+ continue;
1735
+ }
1736
+ l.push(a);
1737
+ }
1738
+ t.push(xe(l)), n.push(f), i.push(o), x.push(r);
1739
+ }
1740
+ return {
1741
+ len: t.length,
1742
+ texts: t,
1743
+ isWordLike: n,
1744
+ kinds: i,
1745
+ starts: x
1746
+ };
1747
+ }
1748
+ function F0(e) {
1749
+ const t = e.texts.slice(), n = e.isWordLike.slice(), i = e.kinds.slice(), x = e.starts.slice();
1750
+ for (let s = 0; s < t.length - 1; s++) {
1751
+ if (i[s] !== "text" || i[s + 1] !== "text" || !oe(t[s]) || !oe(t[s + 1]))
1752
+ continue;
1753
+ const l = Yn(t[s]);
1754
+ l !== null && (t[s] = l.head, t[s + 1] = l.tail + t[s + 1], x[s + 1] = x[s] + l.head.length);
1755
+ }
1756
+ return {
1757
+ len: t.length,
1758
+ texts: t,
1759
+ isWordLike: n,
1760
+ kinds: i,
1761
+ starts: x
1762
+ };
1763
+ }
1764
+ function g0(e, t, n) {
1765
+ const i = bn();
1766
+ let x = 0;
1767
+ const s = [], l = [], f = [], o = [], r = [], c = [], a = [], u = [], d = [], S = [], p = [], A = [];
1768
+ for (const N of i.segment(e))
1769
+ for (const D of n0(N.segment, N.isWordLike ?? !1, N.index, n)) {
1770
+ let y = function() {
1771
+ c[m] !== null && (l[m] = [
1772
+ Et(s, c, a, m)
1773
+ ], c[m] = null), l[m].push(D.text), f[m] = f[m] || D.isWordLike, u[m] = u[m] || P, d[m] = d[m] || W, S[m] = z, p[m] = C, A[m] = Bt(d[m], H);
1774
+ };
1775
+ const E = D.kind === "text", T = Xn(D.text, D.isWordLike, D.kind), P = oe(D.text), W = mt(D.text), H = De(D.text), z = $e(D.text), C = qn(D.text), m = x - 1;
1776
+ t.carryCJKAfterClosingQuote && E && x > 0 && o[m] === "text" && P && u[m] && S[m] || E && x > 0 && o[m] === "text" && _n(D.text) && u[m] || E && x > 0 && o[m] === "text" && p[m] ? y() : E && x > 0 && o[m] === "text" && D.isWordLike && W && A[m] ? (y(), f[m] = !0) : T !== null && x > 0 && o[m] === "text" && c[m] === T ? a[m] = (a[m] ?? 1) + 1 : E && !D.isWordLike && x > 0 && o[m] === "text" && !u[m] && (Hn(D.text) || D.text === "-" && f[m]) ? y() : (s[x] = D.text, l[x] = [D.text], f[x] = D.isWordLike, o[x] = D.kind, r[x] = D.start, c[x] = T, a[x] = T === null ? 0 : 1, u[x] = P, d[x] = W, S[x] = z, p[x] = C, A[x] = Bt(W, H), x++);
1777
+ }
1778
+ for (let N = 0; N < x; N++) {
1779
+ if (c[N] !== null) {
1780
+ s[N] = Et(s, c, a, N);
1781
+ continue;
1782
+ }
1783
+ s[N] = xe(l[N]);
1784
+ }
1785
+ for (let N = 1; N < x; N++)
1786
+ o[N] === "text" && !f[N] && it(s[N]) && o[N - 1] === "text" && !u[N - 1] && (s[N - 1] += s[N], f[N - 1] = f[N - 1] || f[N], s[N] = "");
1787
+ const M = Array.from({ length: x }, () => null);
1788
+ let v = -1;
1789
+ for (let N = x - 1; N >= 0; N--) {
1790
+ const D = s[N];
1791
+ if (D.length !== 0) {
1792
+ if (o[N] === "text" && !f[N] && v >= 0 && o[v] === "text" && (zn(D) || D === "-" && $n(s[v]))) {
1793
+ const E = M[v] ?? [];
1794
+ E.push(D), M[v] = E, r[v] = r[N], s[N] = "";
1795
+ continue;
1796
+ }
1797
+ v = N;
1798
+ }
1799
+ }
1800
+ for (let N = 0; N < x; N++) {
1801
+ const D = M[N];
1802
+ D != null && (s[N] = t0(D, s[N]));
1803
+ }
1804
+ let L = 0;
1805
+ for (let N = 0; N < x; N++) {
1806
+ const D = s[N];
1807
+ D.length !== 0 && (L !== N && (s[L] = D, f[L] = f[N], o[L] = o[N], r[L] = r[N]), L++);
1808
+ }
1809
+ s.length = L, f.length = L, o.length = L, r.length = L;
1810
+ const w = d0({
1811
+ len: L,
1812
+ texts: s,
1813
+ isWordLike: f,
1814
+ kinds: o,
1815
+ starts: r
1816
+ }), R = F0(f0(h0(u0(o0(r0(w))))));
1817
+ for (let N = 0; N < R.len - 1; N++) {
1818
+ const D = Vn(R.texts[N]);
1819
+ D !== null && (R.kinds[N] !== "space" && R.kinds[N] !== "preserved-space" || R.kinds[N + 1] !== "text" || !mt(R.texts[N + 1]) || (R.texts[N] = D.space, R.isWordLike[N] = !1, R.kinds[N] = R.kinds[N] === "preserved-space" ? "preserved-space" : "space", R.texts[N + 1] = D.marks + R.texts[N + 1], R.starts[N + 1] = R.starts[N] + D.space.length));
1820
+ }
1821
+ return R;
1822
+ }
1823
+ function N0(e, t) {
1824
+ if (e.len === 0)
1825
+ return [];
1826
+ if (!t.preserveHardBreaks)
1827
+ return [{
1828
+ startSegmentIndex: 0,
1829
+ endSegmentIndex: e.len,
1830
+ consumedEndSegmentIndex: e.len
1831
+ }];
1832
+ const n = [];
1833
+ let i = 0;
1834
+ for (let x = 0; x < e.len; x++)
1835
+ e.kinds[x] === "hard-break" && (n.push({
1836
+ startSegmentIndex: i,
1837
+ endSegmentIndex: x,
1838
+ consumedEndSegmentIndex: x + 1
1839
+ }), i = x + 1);
1840
+ return i < e.len && n.push({
1841
+ startSegmentIndex: i,
1842
+ endSegmentIndex: e.len,
1843
+ consumedEndSegmentIndex: e.len
1844
+ }), n;
1845
+ }
1846
+ function S0(e, t, n) {
1847
+ if (t.len <= 1)
1848
+ return t;
1849
+ const i = [], x = [], s = [], l = [];
1850
+ let f = -1, o = !1;
1851
+ function r(u) {
1852
+ i.push(t.texts[u]), x.push(t.isWordLike[u]), s.push("text"), l.push(t.starts[u]);
1853
+ }
1854
+ function c(u, d) {
1855
+ let S = !1;
1856
+ for (let M = u; M < d; M++)
1857
+ S = S || t.isWordLike[M];
1858
+ const p = t.starts[u], A = d < t.len ? t.starts[d] : e.length;
1859
+ i.push(e.slice(p, A)), x.push(S), s.push("text"), l.push(p);
1860
+ }
1861
+ function a(u) {
1862
+ if (!(f < 0)) {
1863
+ if (o)
1864
+ f + 1 === u ? r(f) : c(f, u);
1865
+ else
1866
+ for (let d = f; d < u; d++)
1867
+ r(d);
1868
+ f = -1, o = !1;
1869
+ }
1870
+ }
1871
+ for (let u = 0; u < t.len; u++) {
1872
+ const d = t.texts[u], S = t.kinds[u];
1873
+ if (S === "text") {
1874
+ f >= 0 && !Kt(t.texts[u - 1], n) && a(u), f < 0 && (f = u), o = o || oe(d);
1875
+ continue;
1876
+ }
1877
+ a(u), i.push(d), x.push(t.isWordLike[u]), s.push(S), l.push(t.starts[u]);
1878
+ }
1879
+ return a(t.len), {
1880
+ len: i.length,
1881
+ texts: i,
1882
+ isWordLike: x,
1883
+ kinds: s,
1884
+ starts: l
1885
+ };
1886
+ }
1887
+ function p0(e, t, n = "normal", i = "normal") {
1888
+ const x = kn(n), s = x.mode === "pre-wrap" ? Ln(e) : Dn(e);
1889
+ if (s.length === 0)
1890
+ return {
1891
+ normalized: s,
1892
+ chunks: [],
1893
+ len: 0,
1894
+ texts: [],
1895
+ isWordLike: [],
1896
+ kinds: [],
1897
+ starts: []
1898
+ };
1899
+ const l = g0(s, t, x), f = i === "keep-all" ? S0(s, l, t.breakKeepAllAfterPunctuation) : l;
1900
+ return {
1901
+ normalized: s,
1902
+ chunks: N0(f, x),
1903
+ ...f
1904
+ };
1905
+ }
1906
+ let Ae = null;
1907
+ const Ct = /* @__PURE__ */ new Map();
1908
+ let Ee = null;
1909
+ const m0 = 96, A0 = /\p{Emoji_Presentation}/u, E0 = /[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;
1910
+ let Ke = null;
1911
+ const kt = /* @__PURE__ */ new Map();
1912
+ function xt() {
1913
+ if (Ae !== null)
1914
+ return Ae;
1915
+ if (typeof OffscreenCanvas < "u")
1916
+ return Ae = new OffscreenCanvas(1, 1).getContext("2d"), Ae;
1917
+ if (typeof document < "u")
1918
+ return Ae = document.createElement("canvas").getContext("2d"), Ae;
1919
+ throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.");
1920
+ }
1921
+ function B0(e) {
1922
+ let t = Ct.get(e);
1923
+ return t || (t = /* @__PURE__ */ new Map(), Ct.set(e, t)), t;
1924
+ }
1925
+ function ue(e, t) {
1926
+ let n = t.get(e);
1927
+ return n === void 0 && (n = {
1928
+ width: xt().measureText(e).width,
1929
+ containsCJK: oe(e)
1930
+ }, t.set(e, n)), n;
1931
+ }
1932
+ function Be() {
1933
+ if (Ee !== null)
1934
+ return Ee;
1935
+ if (typeof navigator > "u")
1936
+ return Ee = {
1937
+ lineFitEpsilon: 5e-3,
1938
+ carryCJKAfterClosingQuote: !1,
1939
+ breakKeepAllAfterPunctuation: !0,
1940
+ preferPrefixWidthsForBreakableRuns: !1,
1941
+ preferEarlySoftHyphenBreak: !1
1942
+ }, Ee;
1943
+ const e = navigator.userAgent, n = navigator.vendor === "Apple Computer, Inc." && e.includes("Safari/") && !e.includes("Chrome/") && !e.includes("Chromium/") && !e.includes("CriOS/") && !e.includes("FxiOS/") && !e.includes("EdgiOS/"), i = e.includes("Chrome/") || e.includes("Chromium/") || e.includes("CriOS/") || e.includes("Edg/");
1944
+ return Ee = {
1945
+ lineFitEpsilon: n ? 1 / 64 : 5e-3,
1946
+ carryCJKAfterClosingQuote: i,
1947
+ breakKeepAllAfterPunctuation: !n,
1948
+ preferPrefixWidthsForBreakableRuns: n,
1949
+ preferEarlySoftHyphenBreak: n
1950
+ }, Ee;
1951
+ }
1952
+ function M0(e) {
1953
+ const t = e.match(/(\d+(?:\.\d+)?)\s*px/);
1954
+ return t ? parseFloat(t[1]) : 16;
1955
+ }
1956
+ function Ut() {
1957
+ return Ke === null && (Ke = new Intl.Segmenter(void 0, { granularity: "grapheme" })), Ke;
1958
+ }
1959
+ function C0(e) {
1960
+ return A0.test(e) || e.includes("️");
1961
+ }
1962
+ function k0(e) {
1963
+ return E0.test(e);
1964
+ }
1965
+ function D0(e, t) {
1966
+ let n = kt.get(e);
1967
+ if (n !== void 0)
1968
+ return n;
1969
+ const i = xt();
1970
+ i.font = e;
1971
+ const x = i.measureText("😀").width;
1972
+ if (n = 0, x > t + 0.5 && typeof document < "u" && document.body !== null) {
1973
+ const s = document.createElement("span");
1974
+ s.style.font = e, s.style.display = "inline-block", s.style.visibility = "hidden", s.style.position = "absolute", s.textContent = "😀", document.body.appendChild(s);
1975
+ const l = s.getBoundingClientRect().width;
1976
+ document.body.removeChild(s), x - l > 0.5 && (n = x - l);
1977
+ }
1978
+ return kt.set(e, n), n;
1979
+ }
1980
+ function L0(e) {
1981
+ let t = 0;
1982
+ const n = Ut();
1983
+ for (const i of n.segment(e))
1984
+ C0(i.segment) && t++;
1985
+ return t;
1986
+ }
1987
+ function O0(e, t) {
1988
+ return t.emojiCount === void 0 && (t.emojiCount = L0(e)), t.emojiCount;
1989
+ }
1990
+ function de(e, t, n) {
1991
+ return n === 0 ? t.width : t.width - O0(e, t) * n;
1992
+ }
1993
+ function b0(e, t, n, i, x) {
1994
+ if (t.breakableFitAdvances !== void 0 && t.breakableFitMode === x)
1995
+ return t.breakableFitAdvances;
1996
+ t.breakableFitMode = x;
1997
+ const s = Ut(), l = [];
1998
+ for (const c of s.segment(e))
1999
+ l.push(c.segment);
2000
+ if (l.length <= 1)
2001
+ return t.breakableFitAdvances = null, t.breakableFitAdvances;
2002
+ if (x === "sum-graphemes") {
2003
+ const c = [];
2004
+ for (const a of l) {
2005
+ const u = ue(a, n);
2006
+ c.push(de(a, u, i));
2007
+ }
2008
+ return t.breakableFitAdvances = c, t.breakableFitAdvances;
2009
+ }
2010
+ if (x === "pair-context" || l.length > m0) {
2011
+ const c = [];
2012
+ let a = null, u = 0;
2013
+ for (const d of l) {
2014
+ const S = ue(d, n), p = de(d, S, i);
2015
+ if (a === null)
2016
+ c.push(p);
2017
+ else {
2018
+ const A = a + d, M = ue(A, n);
2019
+ c.push(de(A, M, i) - u);
2020
+ }
2021
+ a = d, u = p;
2022
+ }
2023
+ return t.breakableFitAdvances = c, t.breakableFitAdvances;
2024
+ }
2025
+ const f = [];
2026
+ let o = "", r = 0;
2027
+ for (const c of l) {
2028
+ o += c;
2029
+ const a = ue(o, n), u = de(o, a, i);
2030
+ f.push(u - r), r = u;
2031
+ }
2032
+ return t.breakableFitAdvances = f, t.breakableFitAdvances;
2033
+ }
2034
+ function I0(e, t) {
2035
+ const n = xt();
2036
+ n.font = e;
2037
+ const i = B0(e), x = M0(e), s = t ? D0(e, x) : 0;
2038
+ return { cache: i, fontSize: x, emojiCorrection: s };
2039
+ }
2040
+ function y0(e) {
2041
+ return e === "space" || e === "zero-width-break" || e === "soft-hyphen";
2042
+ }
2043
+ function Te(e) {
2044
+ return e === "space" || e === "preserved-space" || e === "tab" || e === "zero-width-break" || e === "soft-hyphen";
2045
+ }
2046
+ function rt(e, t, n = e.widths.length) {
2047
+ for (; t < n; ) {
2048
+ const i = e.kinds[t];
2049
+ if (!y0(i))
2050
+ break;
2051
+ t++;
2052
+ }
2053
+ return t;
2054
+ }
2055
+ function Jt(e, t) {
2056
+ if (t <= 0)
2057
+ return 0;
2058
+ const n = e % t;
2059
+ return Math.abs(n) <= 1e-6 ? t : t - n;
2060
+ }
2061
+ function Qt(e, t, n) {
2062
+ return e.letterSpacing !== 0 && t && e.spacingGraphemeCounts[n] > 0 ? e.letterSpacing : 0;
2063
+ }
2064
+ function ot(e, t) {
2065
+ return t === 0 ? 0 : e + t;
2066
+ }
2067
+ function w0(e, t) {
2068
+ return e.letterSpacing !== 0 && e.spacingGraphemeCounts[t] > 0 ? e.letterSpacing : 0;
2069
+ }
2070
+ function $t(e, t, n, i, x) {
2071
+ const s = t === "tab" ? x + w0(e, n) : e.lineEndFitAdvances[n];
2072
+ return ot(i, s);
2073
+ }
2074
+ function we(e, t, n, i) {
2075
+ const x = t === "tab" ? 0 : e.lineEndFitAdvances[n];
2076
+ return ot(i, x);
2077
+ }
2078
+ function Pe(e, t, n, i, x) {
2079
+ const s = t === "tab" ? x : e.lineEndPaintAdvances[n];
2080
+ return ot(i, s);
2081
+ }
2082
+ function Yt(e, t, n) {
2083
+ return e.letterSpacing !== 0 && t ? n + e.letterSpacing : n;
2084
+ }
2085
+ function Xt(e, t) {
2086
+ return e.letterSpacing === 0 ? t : t + e.letterSpacing;
2087
+ }
2088
+ function P0(e, t, n, i, x) {
2089
+ if (e.letterSpacing === 0)
2090
+ return 0;
2091
+ if (x > 0)
2092
+ return e.spacingGraphemeCounts[i] > 0 ? e.letterSpacing : 0;
2093
+ for (let s = i - 1; s >= t; s--) {
2094
+ const l = e.kinds[s];
2095
+ if (!(l === "space" || l === "zero-width-break" || l === "hard-break")) {
2096
+ if (l === "soft-hyphen") {
2097
+ if (s === i - 1)
2098
+ return 0;
2099
+ continue;
2100
+ }
2101
+ return s === t && n > 0 || e.spacingGraphemeCounts[s] > 0 ? e.letterSpacing : 0;
2102
+ }
2103
+ }
2104
+ return 0;
2105
+ }
2106
+ function qt(e, t, n, i, x, s) {
2107
+ return t + P0(e, n, i, x, s);
2108
+ }
2109
+ function W0(e, t) {
2110
+ let n = 0, i = e.chunks.length;
2111
+ for (; n < i; ) {
2112
+ const x = Math.floor((n + i) / 2);
2113
+ t < e.chunks[x].consumedEndSegmentIndex ? i = x : n = x + 1;
2114
+ }
2115
+ return n < e.chunks.length ? n : -1;
2116
+ }
2117
+ function v0(e, t, n) {
2118
+ let i = n.segmentIndex;
2119
+ if (n.graphemeIndex > 0)
2120
+ return t;
2121
+ const x = e.chunks[t];
2122
+ return x.startSegmentIndex === x.endSegmentIndex && i === x.startSegmentIndex || (i < x.startSegmentIndex && (i = x.startSegmentIndex), i = rt(e, i, x.endSegmentIndex), i < x.endSegmentIndex) ? (n.segmentIndex = i, n.graphemeIndex = 0, t) : x.consumedEndSegmentIndex >= e.widths.length ? -1 : (n.segmentIndex = x.consumedEndSegmentIndex, n.graphemeIndex = 0, t + 1);
2123
+ }
2124
+ function R0(e, t) {
2125
+ if (t.segmentIndex >= e.widths.length)
2126
+ return -1;
2127
+ const n = W0(e, t.segmentIndex);
2128
+ return n < 0 ? -1 : v0(e, n, t);
2129
+ }
2130
+ function T0(e, t, n) {
2131
+ const { widths: i, kinds: x, breakableFitAdvances: s } = e;
2132
+ if (i.length === 0)
2133
+ return 0;
2134
+ const f = Be().lineFitEpsilon, o = t + f;
2135
+ let r = 0, c = 0, a = !1, u = 0, d = 0, S = 0, p = 0, A = -1, M = 0;
2136
+ function v() {
2137
+ A = -1, M = 0;
2138
+ }
2139
+ function L(T = S, P = p, W = c) {
2140
+ r++, n?.(W, u, d, T, P), c = 0, a = !1, v();
2141
+ }
2142
+ function w(T, P) {
2143
+ a = !0, u = T, d = 0, S = T + 1, p = 0, c = P;
2144
+ }
2145
+ function R(T, P, W) {
2146
+ a = !0, u = T, d = P, S = T, p = P + 1, c = W;
2147
+ }
2148
+ function N(T, P) {
2149
+ if (!a) {
2150
+ w(T, P);
2151
+ return;
2152
+ }
2153
+ c += P, S = T + 1, p = 0;
2154
+ }
2155
+ function D(T, P) {
2156
+ const W = s[T];
2157
+ for (let H = P; H < W.length; H++) {
2158
+ const z = W[H];
2159
+ a ? c + z > o ? (L(), R(T, H, z)) : (c += z, S = T, p = H + 1) : R(T, H, z);
2160
+ }
2161
+ a && S === T && p === W.length && (S = T + 1, p = 0);
2162
+ }
2163
+ let E = 0;
2164
+ for (; E < i.length && !(!a && (E = rt(e, E), E >= i.length)); ) {
2165
+ const T = i[E], P = x[E], W = Te(P);
2166
+ if (!a) {
2167
+ T > o && s[E] !== null ? D(E, 0) : w(E, T), W && (A = E + 1, M = c - T), E++;
2168
+ continue;
2169
+ }
2170
+ if (c + T > o) {
2171
+ if (W) {
2172
+ N(E, T), L(E + 1, 0, c - T), E++;
2173
+ continue;
2174
+ }
2175
+ if (A >= 0) {
2176
+ if (S > A || S === A && p > 0) {
2177
+ L();
2178
+ continue;
2179
+ }
2180
+ L(A, 0, M);
2181
+ continue;
2182
+ }
2183
+ if (T > o && s[E] !== null) {
2184
+ L(), D(E, 0), E++;
2185
+ continue;
2186
+ }
2187
+ L();
2188
+ continue;
2189
+ }
2190
+ N(E, T), W && (A = E + 1, M = c - T), E++;
2191
+ }
2192
+ return a && L(), r;
2193
+ }
2194
+ function G0(e, t, n) {
2195
+ if (e.simpleLineWalkFastPath)
2196
+ return T0(e, t, n);
2197
+ const { widths: i, kinds: x, breakableFitAdvances: s, discretionaryHyphenWidth: l, chunks: f } = e;
2198
+ if (i.length === 0 || f.length === 0)
2199
+ return 0;
2200
+ const o = Be(), r = o.lineFitEpsilon, c = t + r;
2201
+ let a = 0, u = 0, d = !1, S = 0, p = 0, A = 0, M = 0, v = -1, L = 0, w = 0, R = null;
2202
+ function N() {
2203
+ v = -1, L = 0, w = 0, R = null;
2204
+ }
2205
+ function D() {
2206
+ return R === "soft-hyphen" && v === A && M === 0 ? w : u;
2207
+ }
2208
+ function E(m = A, y = M, k) {
2209
+ a++, n !== void 0 && n(qt(e, k ?? D(), S, p, m, y), S, p, m, y), u = 0, d = !1, N();
2210
+ }
2211
+ function T(m, y) {
2212
+ d = !0, S = m, p = 0, A = m + 1, M = 0, u = y;
2213
+ }
2214
+ function P(m, y, k) {
2215
+ d = !0, S = m, p = y, A = m, M = y + 1, u = k;
2216
+ }
2217
+ function W(m, y) {
2218
+ if (!d) {
2219
+ T(m, y);
2220
+ return;
2221
+ }
2222
+ u += y, A = m + 1, M = 0;
2223
+ }
2224
+ function H(m, y, k, b, U, J) {
2225
+ if (!y)
2226
+ return;
2227
+ const $ = we(e, m, k, U), te = Pe(e, m, k, U, b);
2228
+ v = k + 1, L = u - J + $, w = u - J + te, R = m;
2229
+ }
2230
+ function z(m, y) {
2231
+ const k = s[m];
2232
+ for (let b = y; b < k.length; b++) {
2233
+ const U = k[b];
2234
+ if (!d)
2235
+ P(m, b, U);
2236
+ else {
2237
+ const J = Yt(e, !0, U), $ = u + J;
2238
+ Xt(e, $) > c ? (E(), P(m, b, U)) : (u = $, A = m, M = b + 1);
2239
+ }
2240
+ }
2241
+ d && A === m && M === k.length && (A = m + 1, M = 0);
2242
+ }
2243
+ function C(m) {
2244
+ a++, n?.(0, m.startSegmentIndex, 0, m.consumedEndSegmentIndex, 0), N();
2245
+ }
2246
+ for (let m = 0; m < f.length; m++) {
2247
+ const y = f[m];
2248
+ if (y.startSegmentIndex === y.endSegmentIndex) {
2249
+ C(y);
2250
+ continue;
2251
+ }
2252
+ d = !1, u = 0, S = y.startSegmentIndex, p = 0, A = y.startSegmentIndex, M = 0, N();
2253
+ let k = y.startSegmentIndex;
2254
+ for (; k < y.endSegmentIndex && !(!d && (k = rt(e, k, y.endSegmentIndex), k >= y.endSegmentIndex)); ) {
2255
+ const b = x[k], U = Te(b), J = Qt(e, d, k), $ = b === "tab" ? Jt(u + J, e.tabStopAdvance) : i[k], te = J + $, ne = $t(e, b, k, J, $);
2256
+ if (b === "soft-hyphen") {
2257
+ d && (A = k + 1, M = 0, v = k + 1, L = u + l, w = u + l, R = b), k++;
2258
+ continue;
2259
+ }
2260
+ if (!d) {
2261
+ ne > c && s[k] !== null ? z(k, 0) : T(k, $), H(b, U, k, $, J, te), k++;
2262
+ continue;
2263
+ }
2264
+ if (u + ne > c) {
2265
+ const Z = u + we(e, b, k, J), le = u + Pe(e, b, k, J, $);
2266
+ if (R === "soft-hyphen" && o.preferEarlySoftHyphenBreak && L <= c) {
2267
+ E(v, 0, w);
2268
+ continue;
2269
+ }
2270
+ if (U && Z <= c) {
2271
+ W(k, te), E(k + 1, 0, le), k++;
2272
+ continue;
2273
+ }
2274
+ if (v >= 0 && L <= c) {
2275
+ if (A > v || A === v && M > 0) {
2276
+ E();
2277
+ continue;
2278
+ }
2279
+ const re = v;
2280
+ E(re, 0, w), k = re;
2281
+ continue;
2282
+ }
2283
+ if (ne > c && s[k] !== null) {
2284
+ E(), z(k, 0), k++;
2285
+ continue;
2286
+ }
2287
+ E();
2288
+ continue;
2289
+ }
2290
+ W(k, te), H(b, U, k, $, J, te), k++;
2291
+ }
2292
+ if (d) {
2293
+ const b = v === y.consumedEndSegmentIndex ? w : u;
2294
+ E(y.consumedEndSegmentIndex, 0, b);
2295
+ }
2296
+ }
2297
+ return a;
2298
+ }
2299
+ function H0(e, t, n, i) {
2300
+ const x = e.chunks[n];
2301
+ if (x.startSegmentIndex === x.endSegmentIndex)
2302
+ return t.segmentIndex = x.consumedEndSegmentIndex, t.graphemeIndex = 0, 0;
2303
+ const { widths: s, kinds: l, breakableFitAdvances: f, discretionaryHyphenWidth: o } = e, r = Be(), c = r.lineFitEpsilon, a = i + c, u = t.segmentIndex, d = t.graphemeIndex;
2304
+ let S = 0, p = !1, A = t.segmentIndex, M = t.graphemeIndex, v = -1, L = 0, w = 0, R = null;
2305
+ function N() {
2306
+ return R === "soft-hyphen" && v === A && M === 0 ? w : S;
2307
+ }
2308
+ function D(C = A, m = M, y = N()) {
2309
+ return p ? (t.segmentIndex = C, t.graphemeIndex = m, qt(e, y, u, d, C, m)) : null;
2310
+ }
2311
+ function E(C, m) {
2312
+ p = !0, A = C + 1, M = 0, S = m;
2313
+ }
2314
+ function T(C, m, y) {
2315
+ p = !0, A = C, M = m + 1, S = y;
2316
+ }
2317
+ function P(C, m) {
2318
+ if (!p) {
2319
+ E(C, m);
2320
+ return;
2321
+ }
2322
+ S += m, A = C + 1, M = 0;
2323
+ }
2324
+ function W(C, m, y, k, b, U) {
2325
+ if (!m)
2326
+ return;
2327
+ const J = we(e, C, y, b), $ = Pe(e, C, y, b, k);
2328
+ v = y + 1, L = S - U + J, w = S - U + $, R = C;
2329
+ }
2330
+ function H(C, m) {
2331
+ const y = f[C];
2332
+ for (let k = m; k < y.length; k++) {
2333
+ const b = y[k];
2334
+ if (!p)
2335
+ T(C, k, b);
2336
+ else {
2337
+ const U = Yt(e, !0, b), J = S + U;
2338
+ if (Xt(e, J) > a)
2339
+ return D();
2340
+ S = J, A = C, M = k + 1;
2341
+ }
2342
+ }
2343
+ return p && A === C && M === y.length && (A = C + 1, M = 0), null;
2344
+ }
2345
+ function z() {
2346
+ return R !== "soft-hyphen" || v < 0 ? null : L <= a ? D(v, 0, w) : null;
2347
+ }
2348
+ for (let C = t.segmentIndex; C < x.endSegmentIndex; C++) {
2349
+ const m = l[C], y = Te(m), k = C === t.segmentIndex ? t.graphemeIndex : 0, b = Qt(e, p, C), U = m === "tab" ? Jt(S + b, e.tabStopAdvance) : s[C], J = b + U, $ = $t(e, m, C, b, U);
2350
+ if (m === "soft-hyphen" && k === 0) {
2351
+ p && (A = C + 1, M = 0, v = C + 1, L = S + o, w = S + o, R = m);
2352
+ continue;
2353
+ }
2354
+ if (!p) {
2355
+ if (k > 0) {
2356
+ const ne = H(C, k);
2357
+ if (ne !== null)
2358
+ return ne;
2359
+ } else if ($ > a && f[C] !== null) {
2360
+ const ne = H(C, 0);
2361
+ if (ne !== null)
2362
+ return ne;
2363
+ } else
2364
+ E(C, U);
2365
+ W(m, y, C, U, b, J);
2366
+ continue;
2367
+ }
2368
+ if (S + $ > a) {
2369
+ const ne = S + we(e, m, C, b), he = S + Pe(e, m, C, b, U);
2370
+ if (R === "soft-hyphen" && r.preferEarlySoftHyphenBreak && L <= a)
2371
+ return D(v, 0, w);
2372
+ const Z = z();
2373
+ if (Z !== null)
2374
+ return Z;
2375
+ if (y && ne <= a)
2376
+ return P(C, J), D(C + 1, 0, he);
2377
+ if (v >= 0 && L <= a)
2378
+ return A > v || A === v && M > 0 ? D() : D(v, 0, w);
2379
+ if ($ > a && f[C] !== null) {
2380
+ const le = D();
2381
+ if (le !== null)
2382
+ return le;
2383
+ const re = H(C, 0);
2384
+ if (re !== null)
2385
+ return re;
2386
+ }
2387
+ return D();
2388
+ }
2389
+ P(C, J), W(m, y, C, U, b, J);
2390
+ }
2391
+ return v === x.consumedEndSegmentIndex && M === 0 ? D(x.consumedEndSegmentIndex, 0, w) : D(x.consumedEndSegmentIndex, 0, S);
2392
+ }
2393
+ function _0(e, t, n) {
2394
+ const { widths: i, kinds: x, breakableFitAdvances: s } = e, f = Be().lineFitEpsilon, o = n + f;
2395
+ let r = 0, c = !1, a = t.segmentIndex, u = t.graphemeIndex, d = -1, S = 0;
2396
+ for (let p = t.segmentIndex; p < i.length; p++) {
2397
+ const A = x[p], M = Te(A), v = p === t.segmentIndex ? t.graphemeIndex : 0, L = s[p], w = i[p];
2398
+ if (!c) {
2399
+ if (v > 0 || w > o && L !== null) {
2400
+ const R = L, N = R[v];
2401
+ c = !0, r = N, a = p, u = v + 1;
2402
+ for (let D = v + 1; D < R.length; D++) {
2403
+ const E = R[D];
2404
+ if (r + E > o)
2405
+ return t.segmentIndex = a, t.graphemeIndex = u, r;
2406
+ r += E, a = p, u = D + 1;
2407
+ }
2408
+ a === p && u === R.length && (a = p + 1, u = 0);
2409
+ } else
2410
+ c = !0, r = w, a = p + 1, u = 0;
2411
+ M && (d = p + 1, S = r - w);
2412
+ continue;
2413
+ }
2414
+ if (r + w > o)
2415
+ return M ? (t.segmentIndex = p + 1, t.graphemeIndex = 0, r) : d >= 0 ? a > d || a === d && u > 0 ? (t.segmentIndex = a, t.graphemeIndex = u, r) : (t.segmentIndex = d, t.graphemeIndex = 0, S) : (t.segmentIndex = a, t.graphemeIndex = u, r);
2416
+ r += w, a = p + 1, u = 0, M && (d = p + 1, S = r - w);
2417
+ }
2418
+ return c ? (t.segmentIndex = a, t.graphemeIndex = u, r) : null;
2419
+ }
2420
+ function z0(e, t, n, i) {
2421
+ return e.simpleLineWalkFastPath ? _0(e, t, i) : H0(e, t, n, i);
2422
+ }
2423
+ function Xe(e, t, n) {
2424
+ const i = R0(e, t);
2425
+ return i < 0 ? null : z0(e, t, i, n);
2426
+ }
2427
+ let je = null, Dt = /* @__PURE__ */ new WeakMap();
2428
+ function K0() {
2429
+ return je === null && (je = new Intl.Segmenter(void 0, { granularity: "grapheme" })), je;
2430
+ }
2431
+ function Lt(e, t, n) {
2432
+ let i = n.get(e);
2433
+ if (i !== void 0)
2434
+ return i;
2435
+ i = [];
2436
+ const x = K0();
2437
+ for (const s of x.segment(t[e]))
2438
+ i.push(s.segment);
2439
+ return n.set(e, i), i;
2440
+ }
2441
+ function j0(e, t, n) {
2442
+ return n > t && e[n - 1] === "soft-hyphen";
2443
+ }
2444
+ function Ot(e, t, n, i) {
2445
+ for (let x = n; x < i; x++)
2446
+ e += t[x];
2447
+ return e;
2448
+ }
2449
+ function U0(e) {
2450
+ let t = Dt.get(e);
2451
+ return t !== void 0 || (t = /* @__PURE__ */ new Map(), Dt.set(e, t)), t;
2452
+ }
2453
+ function J0(e, t, n, i, x, s) {
2454
+ let l = "";
2455
+ const f = j0(e.kinds, n, x);
2456
+ for (let o = n; o < x; o++)
2457
+ if (!(e.kinds[o] === "soft-hyphen" || e.kinds[o] === "hard-break"))
2458
+ if (o === n && i > 0) {
2459
+ const r = Lt(o, e.segments, t);
2460
+ l = Ot(l, r, i, r.length);
2461
+ } else
2462
+ l += e.segments[o];
2463
+ if (s > 0) {
2464
+ f && (l += "-");
2465
+ const o = Lt(x, e.segments, t);
2466
+ l = Ot(l, o, n === x ? i : 0, s);
2467
+ } else f && (l += "-");
2468
+ return l;
2469
+ }
2470
+ let Ue = null;
2471
+ function Vt() {
2472
+ return Ue === null && (Ue = new Intl.Segmenter(void 0, { granularity: "grapheme" })), Ue;
2473
+ }
2474
+ function Q0(e) {
2475
+ return {
2476
+ widths: [],
2477
+ lineEndFitAdvances: [],
2478
+ lineEndPaintAdvances: [],
2479
+ kinds: [],
2480
+ simpleLineWalkFastPath: !0,
2481
+ segLevels: null,
2482
+ breakableFitAdvances: [],
2483
+ letterSpacing: 0,
2484
+ spacingGraphemeCounts: [],
2485
+ discretionaryHyphenWidth: 0,
2486
+ tabStopAdvance: 0,
2487
+ chunks: [],
2488
+ segments: []
2489
+ };
2490
+ }
2491
+ function $0(e, t) {
2492
+ const n = [];
2493
+ let i = [], x = 0, s = !1, l = !1, f = !1;
2494
+ function o() {
2495
+ i.length !== 0 && (n.push({
2496
+ text: i.length === 1 ? i[0] : i.join(""),
2497
+ start: x
2498
+ }), i = [], s = !1, l = !1, f = !1);
2499
+ }
2500
+ function r(a, u, d) {
2501
+ i = [a], x = u, s = d, l = $e(a), f = We.has(a);
2502
+ }
2503
+ function c(a, u) {
2504
+ i.push(a), s = s || u;
2505
+ const d = $e(a);
2506
+ a.length === 1 && Fe.has(a) ? l = l || d : l = d, f = !1;
2507
+ }
2508
+ for (const a of Vt().segment(e)) {
2509
+ const u = a.segment, d = oe(u);
2510
+ if (i.length === 0) {
2511
+ r(u, a.index, d);
2512
+ continue;
2513
+ }
2514
+ if (f || nt.has(u) || Fe.has(u) || t.carryCJKAfterClosingQuote && d && l) {
2515
+ c(u, d);
2516
+ continue;
2517
+ }
2518
+ if (!s && !d) {
2519
+ c(u, d);
2520
+ continue;
2521
+ }
2522
+ o(), r(u, a.index, d);
2523
+ }
2524
+ return o(), n;
2525
+ }
2526
+ function Y0(e, t, n) {
2527
+ if (t.length <= 1)
2528
+ return t;
2529
+ const i = [];
2530
+ let x = -1, s = !1;
2531
+ function l(o, r) {
2532
+ const c = t[o].start, a = r < t.length ? t[r].start : e.length;
2533
+ i.push({
2534
+ text: e.slice(c, a),
2535
+ start: c
2536
+ });
2537
+ }
2538
+ function f(o) {
2539
+ if (!(x < 0)) {
2540
+ if (s)
2541
+ x + 1 === o ? i.push(t[x]) : l(x, o);
2542
+ else
2543
+ for (let r = x; r < o; r++)
2544
+ i.push(t[r]);
2545
+ x = -1, s = !1;
2546
+ }
2547
+ }
2548
+ for (let o = 0; o < t.length; o++) {
2549
+ const r = t[o];
2550
+ x >= 0 && !Kt(t[o - 1].text, n) && f(o), x < 0 && (x = o), s = s || oe(r.text);
2551
+ }
2552
+ return f(t.length), i;
2553
+ }
2554
+ function bt(e, t) {
2555
+ if (t === "zero-width-break" || t === "soft-hyphen" || t === "hard-break")
2556
+ return 0;
2557
+ if (t === "tab")
2558
+ return 1;
2559
+ let n = 0;
2560
+ const i = Vt();
2561
+ for (const x of i.segment(e))
2562
+ n++;
2563
+ return n;
2564
+ }
2565
+ function X0(e, t, n) {
2566
+ return t > 1 ? e + (t - 1) * n : e;
2567
+ }
2568
+ function q0(e, t, n, i, x) {
2569
+ const s = Be(), { cache: l, emojiCorrection: f } = I0(t, k0(e.normalized)), o = de("-", ue("-", l), f) + (x === 0 ? 0 : x * 2), c = de(" ", ue(" ", l), f) * 8, a = x !== 0;
2570
+ if (e.len === 0)
2571
+ return Q0();
2572
+ const u = [], d = [], S = [], p = [];
2573
+ let A = e.chunks.length <= 1 && !a;
2574
+ const M = n ? [] : null, v = [], L = [], w = n ? [] : null, R = Array.from({ length: e.len });
2575
+ function N(P, W, H, z, C, m, y, k) {
2576
+ C !== "text" && C !== "space" && C !== "zero-width-break" && (A = !1), u.push(W), d.push(H), S.push(z), p.push(C), M?.push(m), v.push(y), a && L.push(k), w !== null && w.push(P);
2577
+ }
2578
+ function D(P, W, H, z, C) {
2579
+ const m = ue(P, l), y = a ? bt(P, W) : 0, k = X0(de(P, m, f), y, x), b = W === "space" || W === "preserved-space" || W === "zero-width-break" ? 0 : k, U = b === 0 ? 0 : b + (y > 0 ? x : 0), J = W === "space" || W === "zero-width-break" ? 0 : k;
2580
+ if (C && z && P.length > 1) {
2581
+ let $ = "sum-graphemes";
2582
+ x !== 0 ? $ = "segment-prefixes" : ye(P) ? $ = "pair-context" : s.preferPrefixWidthsForBreakableRuns && ($ = "segment-prefixes");
2583
+ const te = b0(P, m, l, f, $);
2584
+ N(P, k, U, J, W, H, te, y);
2585
+ return;
2586
+ }
2587
+ N(P, k, U, J, W, H, null, y);
2588
+ }
2589
+ for (let P = 0; P < e.len; P++) {
2590
+ R[P] = u.length;
2591
+ const W = e.texts[P], H = e.isWordLike[P], z = e.kinds[P], C = e.starts[P];
2592
+ if (z === "soft-hyphen") {
2593
+ N(W, 0, o, o, z, C, null, 0);
2594
+ continue;
2595
+ }
2596
+ if (z === "hard-break") {
2597
+ N(W, 0, 0, 0, z, C, null, 0);
2598
+ continue;
2599
+ }
2600
+ if (z === "tab") {
2601
+ N(W, 0, 0, 0, z, C, null, a ? bt(W, z) : 0);
2602
+ continue;
2603
+ }
2604
+ const m = ue(W, l);
2605
+ if (z === "text" && m.containsCJK) {
2606
+ const y = $0(W, s), k = i === "keep-all" ? Y0(W, y, s.breakKeepAllAfterPunctuation) : y;
2607
+ for (let b = 0; b < k.length; b++) {
2608
+ const U = k[b];
2609
+ D(U.text, "text", C + U.start, H, i === "keep-all" || !oe(U.text));
2610
+ }
2611
+ continue;
2612
+ }
2613
+ D(W, z, C, H, !0);
2614
+ }
2615
+ const E = V0(e.chunks, R, u.length), T = M === null ? null : Bn(e.normalized, M);
2616
+ return w !== null ? {
2617
+ widths: u,
2618
+ lineEndFitAdvances: d,
2619
+ lineEndPaintAdvances: S,
2620
+ kinds: p,
2621
+ simpleLineWalkFastPath: A,
2622
+ segLevels: T,
2623
+ breakableFitAdvances: v,
2624
+ letterSpacing: x,
2625
+ spacingGraphemeCounts: L,
2626
+ discretionaryHyphenWidth: o,
2627
+ tabStopAdvance: c,
2628
+ chunks: E,
2629
+ segments: w
2630
+ } : {
2631
+ widths: u,
2632
+ lineEndFitAdvances: d,
2633
+ lineEndPaintAdvances: S,
2634
+ kinds: p,
2635
+ simpleLineWalkFastPath: A,
2636
+ segLevels: T,
2637
+ breakableFitAdvances: v,
2638
+ letterSpacing: x,
2639
+ spacingGraphemeCounts: L,
2640
+ discretionaryHyphenWidth: o,
2641
+ tabStopAdvance: c,
2642
+ chunks: E
2643
+ };
2644
+ }
2645
+ function V0(e, t, n) {
2646
+ const i = [];
2647
+ for (let x = 0; x < e.length; x++) {
2648
+ const s = e[x], l = s.startSegmentIndex < t.length ? t[s.startSegmentIndex] : n, f = s.endSegmentIndex < t.length ? t[s.endSegmentIndex] : n, o = s.consumedEndSegmentIndex < t.length ? t[s.consumedEndSegmentIndex] : n;
2649
+ i.push({
2650
+ startSegmentIndex: l,
2651
+ endSegmentIndex: f,
2652
+ consumedEndSegmentIndex: o
2653
+ });
2654
+ }
2655
+ return i;
2656
+ }
2657
+ function Z0(e, t, n, i) {
2658
+ const x = i?.wordBreak ?? "normal", s = i?.letterSpacing ?? 0, l = p0(e, Be(), i?.whiteSpace, x);
2659
+ return q0(l, t, n, x, s);
2660
+ }
2661
+ function qe(e, t, n) {
2662
+ return Z0(e, t, !0, n);
2663
+ }
2664
+ function It(e) {
2665
+ let t = 0;
2666
+ return G0(e, Number.POSITIVE_INFINITY, (n) => {
2667
+ n > t && (t = n);
2668
+ }), t;
2669
+ }
2670
+ const es = /[ \t\n\f\r]+/, yt = /^[ \t\n\f\r]+/, wt = /[ \t\n\f\r]+$/, Pt = { segmentIndex: 0, graphemeIndex: 0 }, ts = {
2671
+ itemIndex: 0,
2672
+ segmentIndex: 0,
2673
+ graphemeIndex: 0
2674
+ };
2675
+ function Je(e) {
2676
+ return {
2677
+ segmentIndex: e.segmentIndex,
2678
+ graphemeIndex: e.graphemeIndex
2679
+ };
2680
+ }
2681
+ function Wt(e) {
2682
+ return e.segmentIndex === 0 && e.graphemeIndex === 0;
2683
+ }
2684
+ function Oe(e, t, n) {
2685
+ const i = `${e}\0${t}`, x = n.get(i);
2686
+ if (x !== void 0)
2687
+ return x;
2688
+ const s = t === 0 ? void 0 : { letterSpacing: t }, l = It(qe("A A", e, s)), f = It(qe("AA", e, s)), o = Math.max(0, l - f);
2689
+ return n.set(i, o), o;
2690
+ }
2691
+ function ns(e) {
2692
+ const t = { segmentIndex: 0, graphemeIndex: 0 }, n = Xe(e, t, Number.POSITIVE_INFINITY);
2693
+ return n === null ? null : {
2694
+ endGraphemeIndex: t.graphemeIndex,
2695
+ endSegmentIndex: t.segmentIndex,
2696
+ width: n
2697
+ };
2698
+ }
2699
+ function ss(e, t) {
2700
+ return e === 0 && t > 0;
2701
+ }
2702
+ function Zt(e) {
2703
+ const t = [], n = Array.from({ length: e.length }), i = /* @__PURE__ */ new Map();
2704
+ let x = 0;
2705
+ for (let s = 0; s < e.length; s++) {
2706
+ const l = e[s], f = l.letterSpacing ?? 0, o = yt.test(l.text), r = wt.test(l.text), c = l.text.replace(yt, "").replace(wt, "");
2707
+ if (c.length === 0) {
2708
+ es.test(l.text) && x === 0 && (x = Oe(l.font, f, i));
2709
+ continue;
2710
+ }
2711
+ const a = x > 0 ? x : o ? Oe(l.font, f, i) : 0, u = qe(c, l.font, f === 0 ? void 0 : { letterSpacing: f }), d = ns(u);
2712
+ if (d === null) {
2713
+ x = r ? Oe(l.font, f, i) : 0;
2714
+ continue;
2715
+ }
2716
+ const S = {
2717
+ break: l.break ?? "normal",
2718
+ endGraphemeIndex: d.endGraphemeIndex,
2719
+ endSegmentIndex: d.endSegmentIndex,
2720
+ extraWidth: l.extraWidth ?? 0,
2721
+ gapBefore: a,
2722
+ naturalWidth: d.width,
2723
+ prepared: u,
2724
+ sourceItemIndex: s
2725
+ };
2726
+ t.push(S), n[s] = S, x = r ? Oe(l.font, f, i) : 0;
2727
+ }
2728
+ return {
2729
+ items: t,
2730
+ itemsBySourceItemIndex: n
2731
+ };
2732
+ }
2733
+ function is(e, t, n, i) {
2734
+ if (e.items.length === 0 || n.itemIndex >= e.items.length)
2735
+ return null;
2736
+ const x = Math.max(1, t);
2737
+ let s = 0, l = x, f = n.itemIndex;
2738
+ e: for (; f < e.items.length; ) {
2739
+ const o = e.items[f];
2740
+ if (!Wt(n) && n.segmentIndex === o.endSegmentIndex && n.graphemeIndex === o.endGraphemeIndex) {
2741
+ f++, n.segmentIndex = 0, n.graphemeIndex = 0;
2742
+ continue;
2743
+ }
2744
+ const r = s === 0 ? 0 : o.gapBefore, c = Wt(n);
2745
+ if (o.break === "never") {
2746
+ if (!c) {
2747
+ f++, n.segmentIndex = 0, n.graphemeIndex = 0;
2748
+ continue;
2749
+ }
2750
+ const M = o.naturalWidth + o.extraWidth, v = r + M;
2751
+ if (s > 0 && v > l)
2752
+ break e;
2753
+ i?.(o, r, M, Je(Pt), {
2754
+ segmentIndex: o.endSegmentIndex,
2755
+ graphemeIndex: o.endGraphemeIndex
2756
+ }), s += v, l = Math.max(0, x - s), f++, n.segmentIndex = 0, n.graphemeIndex = 0;
2757
+ continue;
2758
+ }
2759
+ const a = r + o.extraWidth;
2760
+ if (s > 0 && a >= l)
2761
+ break e;
2762
+ if (c) {
2763
+ const M = a + o.naturalWidth;
2764
+ if (M <= l) {
2765
+ i?.(o, r, o.naturalWidth + o.extraWidth, Je(Pt), {
2766
+ segmentIndex: o.endSegmentIndex,
2767
+ graphemeIndex: o.endGraphemeIndex
2768
+ }), s += M, l = Math.max(0, x - s), f++, n.segmentIndex = 0, n.graphemeIndex = 0;
2769
+ continue;
2770
+ }
2771
+ }
2772
+ const u = Math.max(1, l - a), d = {
2773
+ segmentIndex: n.segmentIndex,
2774
+ graphemeIndex: n.graphemeIndex
2775
+ }, S = Xe(o.prepared, d, u);
2776
+ if (S === null) {
2777
+ f++, n.segmentIndex = 0, n.graphemeIndex = 0;
2778
+ continue;
2779
+ }
2780
+ if (n.segmentIndex === d.segmentIndex && n.graphemeIndex === d.graphemeIndex) {
2781
+ f++, n.segmentIndex = 0, n.graphemeIndex = 0;
2782
+ continue;
2783
+ }
2784
+ const p = S + o.extraWidth, A = r + p;
2785
+ if (s > 0 && c && A > l)
2786
+ break e;
2787
+ if (s > 0 && c && r > 0 && ss(d.segmentIndex, d.graphemeIndex)) {
2788
+ const M = { segmentIndex: 0, graphemeIndex: 0 };
2789
+ if (Xe(o.prepared, M, Math.max(1, x - o.extraWidth)) !== null && (M.segmentIndex > d.segmentIndex || M.segmentIndex === d.segmentIndex && M.graphemeIndex > d.graphemeIndex))
2790
+ break e;
2791
+ }
2792
+ if (i?.(o, r, p, Je(n), {
2793
+ segmentIndex: d.segmentIndex,
2794
+ graphemeIndex: d.graphemeIndex
2795
+ }), s += A, l = Math.max(0, x - s), d.segmentIndex === o.endSegmentIndex && d.graphemeIndex === o.endGraphemeIndex) {
2796
+ f++, n.segmentIndex = 0, n.graphemeIndex = 0;
2797
+ continue;
2798
+ }
2799
+ n.segmentIndex = d.segmentIndex, n.graphemeIndex = d.graphemeIndex;
2800
+ break;
2801
+ }
2802
+ return s === 0 ? null : (n.itemIndex = f, s);
2803
+ }
2804
+ function xs(e, t, n = ts) {
2805
+ const i = e, x = {
2806
+ itemIndex: n.itemIndex,
2807
+ segmentIndex: n.segmentIndex,
2808
+ graphemeIndex: n.graphemeIndex
2809
+ }, s = [], l = is(i, t, x, (f, o, r, c, a) => {
2810
+ s.push({
2811
+ itemIndex: f.sourceItemIndex,
2812
+ gapBefore: o,
2813
+ occupiedWidth: r,
2814
+ start: c,
2815
+ end: a
2816
+ });
2817
+ });
2818
+ return l === null ? null : {
2819
+ fragments: s,
2820
+ width: l,
2821
+ end: x
2822
+ };
2823
+ }
2824
+ function rs(e, t) {
2825
+ return J0(e.prepared, U0(e.prepared), t.start.segmentIndex, t.start.graphemeIndex, t.end.segmentIndex, t.end.graphemeIndex);
2826
+ }
2827
+ function os(e, t) {
2828
+ const n = e, i = [];
2829
+ for (let x = 0; x < t.fragments.length; x++) {
2830
+ const s = t.fragments[x], l = n.itemsBySourceItemIndex[s.itemIndex];
2831
+ if (l === void 0)
2832
+ throw new Error("Missing rich-text inline item for fragment");
2833
+ i.push({
2834
+ itemIndex: s.itemIndex,
2835
+ text: rs(l, s),
2836
+ gapBefore: s.gapBefore,
2837
+ occupiedWidth: s.occupiedWidth,
2838
+ start: s.start,
2839
+ end: s.end
2840
+ });
2841
+ }
2842
+ return {
2843
+ fragments: i,
2844
+ width: t.width,
2845
+ end: t.end
2846
+ };
2847
+ }
2848
+ const ls = (e) => e.runs.some((t) => t.text.length > 0) && e.runs.every((t) => t.text.length === 0 || t.style.hidden === !0), cs = [
2849
+ [1e3, "m"],
2850
+ [900, "cm"],
2851
+ [500, "d"],
2852
+ [400, "cd"],
2853
+ [100, "c"],
2854
+ [90, "xc"],
2855
+ [50, "l"],
2856
+ [40, "xl"],
2857
+ [10, "x"],
2858
+ [9, "ix"],
2859
+ [5, "v"],
2860
+ [4, "iv"],
2861
+ [1, "i"]
2862
+ ];
2863
+ function vt(e) {
2864
+ let t = "", n = Math.max(1, e);
2865
+ for (const [i, x] of cs)
2866
+ for (; n >= i; )
2867
+ t += x, n -= i;
2868
+ return t;
2869
+ }
2870
+ function Rt(e) {
2871
+ let t = "", n = Math.max(1, e);
2872
+ for (; n > 0; )
2873
+ n -= 1, t = String.fromCharCode(97 + n % 26) + t, n = Math.floor(n / 26);
2874
+ return t;
2875
+ }
2876
+ function Ce(e, t) {
2877
+ switch (t) {
2878
+ case "decimal":
2879
+ return String(e);
2880
+ case "lowerLetter":
2881
+ return Rt(e);
2882
+ case "upperLetter":
2883
+ return Rt(e).toUpperCase();
2884
+ case "lowerRoman":
2885
+ return vt(e);
2886
+ case "upperRoman":
2887
+ return vt(e).toUpperCase();
2888
+ case "bullet":
2889
+ return "";
2890
+ }
2891
+ }
2892
+ function as(e, t, n) {
2893
+ const i = e.levels[Math.min(t, e.levels.length - 1)];
2894
+ return i ? i.format === "bullet" ? i.bulletChar ?? "•" : i.text.replace(/%(\d)/g, (x, s) => {
2895
+ const l = Number(s) - 1, f = e.levels[Math.min(l, e.levels.length - 1)], o = n[l] ?? f?.start ?? 1;
2896
+ return Ce(o, f?.format ?? "decimal");
2897
+ }) : "";
2898
+ }
2899
+ function us(e) {
2900
+ let t = 1;
2901
+ const n = [];
2902
+ for (const i of e.rows) {
2903
+ let x = 0;
2904
+ for (const s of i.cells) {
2905
+ for (; (n[x] ?? 0) > 0; ) x++;
2906
+ const l = Math.max(1, s.colSpan ?? 1), f = Math.max(1, s.rowSpan ?? 1);
2907
+ if (f > 1) for (let o = 0; o < l; o++) n[x + o] = f;
2908
+ x += l;
2909
+ }
2910
+ t = Math.max(t, x);
2911
+ for (let s = 0; s < n.length; s++) n[s] > 0 && n[s]--;
2912
+ }
2913
+ return t;
2914
+ }
2915
+ function fs(e) {
2916
+ const t = us(e);
2917
+ return e.colFractions && e.colFractions.length === t ? e.colFractions : Array.from({ length: t }, () => 1 / t);
2918
+ }
2919
+ function hs(e) {
2920
+ const t = [];
2921
+ let n = [], i = 0, x = 0;
2922
+ for (const s of e) {
2923
+ let l = 0;
2924
+ for (; ; ) {
2925
+ const o = s.text.indexOf("\v", l);
2926
+ if (o < 0) break;
2927
+ const r = s.text.slice(l, o);
2928
+ r.length > 0 && n.push({ text: r, style: s.style }), x += o - l, t.push({ runs: n, startOffset: i }), x += 1, i = x, n = [], l = o + 1;
2929
+ }
2930
+ const f = s.text.slice(l);
2931
+ f.length > 0 && n.push({ text: f, style: s.style }), x += f.length;
2932
+ }
2933
+ return t.push({ runs: n, startOffset: i }), t;
2934
+ }
2935
+ function en(e) {
2936
+ return e.map((t) => {
2937
+ const n = { text: t.style.hidden ? "" : t.text, font: fe(t.style) };
2938
+ return !t.style.hidden && t.style.letterSpacingPx !== void 0 && (n.letterSpacing = t.style.letterSpacingPx), n;
2939
+ });
2940
+ }
2941
+ function ds(e) {
2942
+ return Zt(en(e));
2943
+ }
2944
+ class Ve {
2945
+ map = /* @__PURE__ */ new Map();
2946
+ get(t) {
2947
+ const n = this.map.get(t.id);
2948
+ if (n && n.revision === t.revision) return n.segments;
2949
+ const i = hs(t.runs).map((x) => ({
2950
+ prepared: Zt(en(x.runs)),
2951
+ runs: x.runs,
2952
+ startOffset: x.startOffset
2953
+ }));
2954
+ return this.map.set(t.id, { revision: t.revision, segments: i }), i;
2955
+ }
2956
+ evict(t) {
2957
+ this.map.delete(t);
2958
+ }
2959
+ }
2960
+ const Qe = 48;
2961
+ function Is() {
2962
+ const e = new Ve(), t = /* @__PURE__ */ new Map(), n = (i, x) => {
2963
+ const s = t.get(i.id);
2964
+ if (s && s.revision === i.revision && s.width === x) return s.lines;
2965
+ const l = sn(i, x, e);
2966
+ return t.set(i.id, { revision: i.revision, width: x, lines: l }), l;
2967
+ };
2968
+ return {
2969
+ layout(i, x, s) {
2970
+ return Cs(i, n, (l) => e.get(l), s?.rawBand ?? null);
2971
+ },
2972
+ evict(i) {
2973
+ e.evict(i), t.delete(i);
2974
+ }
2975
+ };
2976
+ }
2977
+ function Fs(e) {
2978
+ let t = 0;
2979
+ for (let n = 0; n < e.length; n++) e.charCodeAt(n) === 32 && t++;
2980
+ return t;
2981
+ }
2982
+ const gs = (e) => e === " " || e === " " || e === `
2983
+ ` || e === "\r";
2984
+ function Ns(e, t, n) {
2985
+ const i = e.indexOf(n, t);
2986
+ if (i >= 0) return { start: i, end: i + n.length };
2987
+ const x = [];
2988
+ let s = t, l = 0, f = -1;
2989
+ for (; l < n.length && s < e.length; ) {
2990
+ if (e[s] === n[l]) {
2991
+ f < 0 && (f = s), x.push(s - f), s++, l++;
2992
+ continue;
2993
+ }
2994
+ if (gs(e[s])) {
2995
+ s++;
2996
+ continue;
2997
+ }
2998
+ f = -1;
2999
+ break;
3000
+ }
3001
+ return f >= 0 && l === n.length ? (x.push(s - f), s - f === n.length ? { start: f, end: s } : { start: f, end: s, map: x }) : { start: t, end: t + n.length };
3002
+ }
3003
+ function lt(e, t) {
3004
+ const n = [];
3005
+ let i = t;
3006
+ for (const x of e)
3007
+ n.push(i), i += x.text.length;
3008
+ return n;
3009
+ }
3010
+ function Ss(e) {
3011
+ return ls(e) && !e.style.sectionBreak && !e.style.pageBreakBefore;
3012
+ }
3013
+ function tn(e) {
3014
+ const t = e.runs[0]?.style, n = t?.fontSizePx ?? 16, i = t ? Ie(fe(t)) : { ascent: n * 0.8, descent: n * 0.2 }, x = i.ascent + i.descent, s = Math.max(x, e.style.lineHeight * n);
3015
+ return { height: s, ascent: (s - x) / 2 + i.ascent };
3016
+ }
3017
+ function ct(e, t, n, i, x, s) {
3018
+ const l = xs(t.prepared, n, i);
3019
+ if (l === null) return null;
3020
+ const f = os(t.prepared, l), o = [];
3021
+ let r = 0, c = 0, a = 0, u = 0;
3022
+ for (const A of f.fragments) {
3023
+ r += A.gapBefore;
3024
+ const M = t.runs[A.itemIndex], v = Ie(fe(M.style));
3025
+ if (c = Math.max(c, v.ascent), a = Math.max(a, v.descent), u = Math.max(u, M.style.fontSizePx), A.text.length > 0) {
3026
+ const L = Ns(M.text, s[A.itemIndex], A.text);
3027
+ s[A.itemIndex] = L.end;
3028
+ const w = {
3029
+ blockId: e.id,
3030
+ startOffset: x[A.itemIndex] + L.start,
3031
+ endOffset: x[A.itemIndex] + L.end,
3032
+ text: A.text,
3033
+ style: M.style,
3034
+ x: r,
3035
+ width: A.occupiedWidth
3036
+ };
3037
+ L.map && (w.offsetMap = L.map), o.push({ frag: w, hadGap: A.gapBefore > 0, spaces: Fs(A.text) });
3038
+ }
3039
+ r += A.occupiedWidth;
3040
+ }
3041
+ if (u === 0) {
3042
+ const A = e.runs[0]?.style;
3043
+ if (A) {
3044
+ const M = Ie(fe(A));
3045
+ c = M.ascent, a = M.descent, u = A.fontSizePx;
3046
+ }
3047
+ }
3048
+ const d = c + a, S = Math.max(d, e.style.lineHeight * u), p = (S - d) / 2;
3049
+ return { frags: o, width: f.width, height: S, ascent: p + c, end: f.end };
3050
+ }
3051
+ function ps(e, t, n) {
3052
+ for (const x of t) if (x.posPx > e + 0.5) return x;
3053
+ let i = (Math.floor(e / Qe) + 1) * Qe;
3054
+ return i <= e && (i = e + Qe), { posPx: Math.min(i, Math.max(e + 1, n)), align: "left", leader: "none" };
3055
+ }
3056
+ function ms(e) {
3057
+ const t = e.map((x) => x.text).join(""), n = fe(e[0]?.style ?? nn);
3058
+ let i = t.indexOf(".");
3059
+ return i < 0 && (i = t.indexOf(",")), et(i < 0 ? t : t.slice(0, i + 1), n);
3060
+ }
3061
+ const nn = { fontFamily: "Georgia, serif", fontSizePx: 16 };
3062
+ function As(e, t, n, i, x) {
3063
+ const s = [];
3064
+ let l = [], f = n, o = n;
3065
+ for (const L of t) {
3066
+ let w = 0;
3067
+ for (; ; ) {
3068
+ const N = L.text.indexOf(" ", w);
3069
+ if (N < 0) break;
3070
+ const D = L.text.slice(w, N);
3071
+ D.length > 0 && l.push({ text: D, style: L.style }), o += N - w, s.push({ runs: l, start: f }), o += 1, f = o, l = [], w = N + 1;
3072
+ }
3073
+ const R = L.text.slice(w);
3074
+ R.length > 0 && l.push({ text: R, style: L.style }), o += R.length;
3075
+ }
3076
+ s.push({ runs: l, start: f });
3077
+ const r = (e.style.tabStops ?? []).slice().sort((L, w) => L.posPx - w.posPx), c = t.find((L) => L.text.length > 0)?.style ?? e.runs[0]?.style, a = [];
3078
+ let u = [], d = [], S = x, p = 0, A = 0, M = !1;
3079
+ const v = (L) => {
3080
+ if (p === 0 && c) {
3081
+ const w = Ie(fe(c));
3082
+ p = Math.max(w.ascent + w.descent, e.style.lineHeight * c.fontSizePx), A = (p - (w.ascent + w.descent)) / 2 + w.ascent;
3083
+ }
3084
+ a.push({
3085
+ frags: u,
3086
+ width: S,
3087
+ indent: 0,
3088
+ // fragment x is already absolute (tab/indent baked in)
3089
+ lineMaxWidth: i,
3090
+ height: p,
3091
+ ascent: A,
3092
+ // A tab-positioned line stays ragged (its manual x must not be re-justified);
3093
+ // pure wrapped continuation lines justify normally when the paragraph does.
3094
+ lastOfSegment: L || M,
3095
+ ...d.length > 0 ? { leaders: d } : {}
3096
+ }), u = [], d = [], S = 0, p = 0, A = 0, M = !1;
3097
+ };
3098
+ return s.forEach((L, w) => {
3099
+ if (w > 0) {
3100
+ const P = ps(S, r, i), W = P.align ?? "left", H = et(L.runs.map((m) => m.text).join(""), fe(L.runs[0]?.style ?? c ?? nn)), z = S + H <= i;
3101
+ let C = P.posPx;
3102
+ z && W === "right" ? C = P.posPx - H : z && W === "center" ? C = P.posPx - H / 2 : z && W === "decimal" && (C = P.posPx - ms(L.runs)), C < S && (C = S), (P.leader ?? "none") !== "none" && C > S + 1 && c && d.push({ x1: S, x2: C, kind: P.leader ?? "none", color: c.color, fontSizePx: c.fontSizePx }), S = C, M = !0;
3103
+ }
3104
+ if (L.runs.length === 0) return;
3105
+ const R = { prepared: ds(L.runs), runs: L.runs, startOffset: L.start }, N = lt(L.runs, L.start), D = L.runs.map(() => 0);
3106
+ let E, T = !0;
3107
+ for (; ; ) {
3108
+ const P = Math.max(24, i - (T ? S : 0)), W = ct(e, R, P, E, N, D);
3109
+ if (W === null) break;
3110
+ T || v(!1);
3111
+ const H = T ? S : 0;
3112
+ for (const z of W.frags)
3113
+ z.frag.x += H, u.push(z);
3114
+ S = H + W.width, p = Math.max(p, W.height), A = Math.max(A, W.ascent), E = W.end, T = !1;
3115
+ }
3116
+ }), v(!0), a;
3117
+ }
3118
+ function sn(e, t, n) {
3119
+ const i = n.get(e), x = [], s = [];
3120
+ let l = !0;
3121
+ for (const o of i) {
3122
+ if (o.runs.some((d) => d.text.includes(" "))) {
3123
+ s.push(...As(e, o.runs, o.startOffset, t, l ? e.style.indentFirstLinePx : 0)), l = !1;
3124
+ continue;
3125
+ }
3126
+ const r = lt(o.runs, o.startOffset), c = o.runs.map(() => 0);
3127
+ let a, u = !1;
3128
+ for (; ; ) {
3129
+ const d = l ? e.style.indentFirstLinePx : 0, S = t - d, p = ct(e, o, S, a, r, c);
3130
+ if (p === null) break;
3131
+ s.push({
3132
+ frags: p.frags,
3133
+ width: p.width,
3134
+ indent: d,
3135
+ lineMaxWidth: S,
3136
+ height: p.height,
3137
+ ascent: p.ascent,
3138
+ lastOfSegment: !1
3139
+ }), a = p.end, l = !1, u = !0;
3140
+ }
3141
+ if (u)
3142
+ s[s.length - 1].lastOfSegment = !0;
3143
+ else {
3144
+ const d = tn(e);
3145
+ s.push({
3146
+ frags: [],
3147
+ width: 0,
3148
+ indent: 0,
3149
+ lineMaxWidth: t,
3150
+ height: d.height,
3151
+ ascent: d.ascent,
3152
+ lastOfSegment: !0,
3153
+ emptyOffset: o.startOffset
3154
+ }), l = !1;
3155
+ }
3156
+ }
3157
+ let f = 0;
3158
+ for (const o of s) {
3159
+ const r = o.lineMaxWidth - o.width;
3160
+ let c = o.indent;
3161
+ if (e.style.align === "center") c += r / 2;
3162
+ else if (e.style.align === "right") c += r;
3163
+ else if (e.style.align === "justify" && !o.lastOfSegment && r > 0) {
3164
+ const u = o.frags.reduce((d, S) => d + S.spaces + (S.hadGap ? 1 : 0), 0);
3165
+ if (u > 0) {
3166
+ const d = r / u;
3167
+ let S = 0;
3168
+ for (const p of o.frags)
3169
+ p.hadGap && (S += d), p.frag.x += S, p.spaces > 0 && (p.frag.wordSpacingPx = d, p.frag.width += p.spaces * d, S += p.spaces * d);
3170
+ }
3171
+ }
3172
+ for (const u of o.frags) u.frag.x += c;
3173
+ const a = { y: f, height: o.height, ascent: o.ascent, fragments: o.frags.map((u) => u.frag) };
3174
+ o.emptyOffset !== void 0 && (a.emptyOffset = o.emptyOffset), o.leaders && o.leaders.length > 0 && (a.leaders = o.leaders.map((u) => ({ ...u, x1: u.x1 + c, x2: u.x2 + c }))), x.push(a), f += o.height;
3175
+ }
3176
+ return x;
3177
+ }
3178
+ const Tt = 2, Gt = 2, Es = 48, xn = ["header", "footer", "headerFirst", "headerEven", "footerFirst", "footerEven"];
3179
+ function Bs(e, t) {
3180
+ const n = {
3181
+ pageWidthPx: t.pageWidthPx ?? e.pageWidthPx,
3182
+ pageHeightPx: t.pageHeightPx ?? e.pageHeightPx,
3183
+ marginPx: t.marginPx ?? e.marginPx
3184
+ }, i = t.columns === void 0 ? e.columns : t.columns ?? void 0;
3185
+ i && (n.columns = i), t.pageNumberStart !== void 0 && (n.pageNumberStart = t.pageNumberStart);
3186
+ const x = t.headerDistancePx ?? e.headerDistancePx;
3187
+ x !== void 0 && (n.headerDistancePx = x);
3188
+ const s = t.footerDistancePx ?? e.footerDistancePx;
3189
+ s !== void 0 && (n.footerDistancePx = s);
3190
+ for (const l of xn) {
3191
+ const f = t[l] ?? e[l];
3192
+ f && (n[l] = f);
3193
+ }
3194
+ return n;
3195
+ }
3196
+ function Ht(e, t) {
3197
+ return e.headerDistancePx !== void 0 ? e.headerDistancePx : Math.max(8, (e.marginPx.top - t) / 2);
3198
+ }
3199
+ function _t(e, t) {
3200
+ return e.footerDistancePx !== void 0 ? e.pageHeightPx - e.footerDistancePx - t : e.pageHeightPx - Math.max(8, (e.marginPx.bottom - t) / 2) - t;
3201
+ }
3202
+ function Ms(e) {
3203
+ const t = [];
3204
+ for (let n = 0; n < e.blocks.length; n++) {
3205
+ const i = e.blocks[n];
3206
+ i.kind === "paragraph" && i.style.sectionBreak && t.push({ props: Bs(e.section, i.style.sectionBreak.props), endBlock: n });
3207
+ }
3208
+ return t.push({ props: e.section, endBlock: e.blocks.length - 1 }), t;
3209
+ }
3210
+ function Cs(e, t, n, i) {
3211
+ const s = /* @__PURE__ */ new Map();
3212
+ let l = null;
3213
+ const f = (h) => {
3214
+ const F = s.get(h);
3215
+ if (F) return F;
3216
+ let g = h.marginPx.top, B = h.pageHeightPx - h.marginPx.bottom;
3217
+ const I = [h.header, h.headerFirst, h.headerEven].filter((_) => !!_), O = [h.footer, h.footerFirst, h.footerEven].filter((_) => !!_);
3218
+ if (I.length > 0 || O.length > 0) {
3219
+ l ??= new Ve();
3220
+ const _ = h.pageWidthPx - h.marginPx.left - h.marginPx.right, K = h.marginPx.left, Y = (q) => be(q, _, K, 999, 999, l, !1).height, j = (q) => {
3221
+ const X = be(q, _, K, 999, 999, l, !1);
3222
+ for (const ee of X.placed)
3223
+ if (!!ee.table || !!ee.image || ee.lines.some((ae) => ae.fragments.some((pn) => pn.text.trim().length > 0))) return X.height - ee.y;
3224
+ return 0;
3225
+ }, Q = I.reduce((q, X) => Math.max(q, Y(X)), 0);
3226
+ if (Q > 0) {
3227
+ const q = Ht(h, Q);
3228
+ g = Math.max(g, q + Q + 6);
3229
+ }
3230
+ const V = O.reduce((q, X) => Math.max(q, Y(X)), 0);
3231
+ if (V > 0)
3232
+ if (h.footerDistancePx !== void 0) {
3233
+ const q = h.pageHeightPx - h.footerDistancePx, X = O.reduce((ee, me) => Math.max(ee, j(me)), 0);
3234
+ B = Math.min(B, q - X);
3235
+ } else
3236
+ B = Math.min(B, _t(h, V) - 6);
3237
+ B = Math.max(B, g + 24);
3238
+ }
3239
+ const G = { top: g, bottom: B };
3240
+ return s.set(h, G), G;
3241
+ }, o = Ms(e);
3242
+ let r = o[0].props, c = 0, a = 0, u = 0, d = 0, S = 1, p = 0, A = 0;
3243
+ const M = (h) => {
3244
+ r = h;
3245
+ const F = f(r);
3246
+ c = r.marginPx.left, a = F.top, u = F.bottom, d = r.pageWidthPx - r.marginPx.left - r.marginPx.right, S = Math.max(1, r.columns?.count ?? 1), p = r.columns?.gapPx ?? 24, A = S > 1 ? (d - (S - 1) * p) / S : d;
3247
+ };
3248
+ M(r);
3249
+ const v = e.lists ?? {}, L = (h) => {
3250
+ const F = h.style.list;
3251
+ if (!F) return null;
3252
+ const g = v[F.listId];
3253
+ return g ? g.levels[Math.min(F.level, g.levels.length - 1)] ?? null : null;
3254
+ }, w = (h) => h.style.indentLeftPx + (L(h)?.indentLeftPx ?? 0), R = (h) => h.style.indentRightPx ?? 0, N = (h) => L(h)?.indentLeftPx ?? 0, D = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), T = (h) => {
3255
+ const F = h.style.list, g = L(h);
3256
+ if (!F || !g) return;
3257
+ const B = v[F.listId], I = D.get(F.listId) ?? [];
3258
+ I[F.level] = (I[F.level] ?? g.start - 1) + 1, I.length = F.level + 1, D.set(F.listId, I);
3259
+ const O = as(B, F.level, I);
3260
+ if (O.length === 0) return;
3261
+ const G = h.runs[0]?.style;
3262
+ G && E.set(h.id, {
3263
+ text: O,
3264
+ style: { ...G, ...g.markerStyle ?? {} },
3265
+ hangingPx: g.hangingPx
3266
+ });
3267
+ }, P = (h) => {
3268
+ for (const F of h)
3269
+ if (F.kind === "paragraph") T(F);
3270
+ else if (F.kind === "table") for (const g of F.rows) for (const B of g.cells) P(B.blocks);
3271
+ };
3272
+ P(e.blocks);
3273
+ const W = { indentOf: N, markers: E }, H = [];
3274
+ let z = 0;
3275
+ for (let h = 0; h < e.blocks.length; h++) {
3276
+ for (; h > o[z].endBlock; ) M(o[++z].props);
3277
+ const F = e.blocks[h];
3278
+ if (F.kind === "paragraph") {
3279
+ if (Ss(F)) continue;
3280
+ const g = F.style.tocEntry ? Es : 0;
3281
+ H.push({
3282
+ kind: "para",
3283
+ block: F,
3284
+ lines: t(F, A - w(F) - R(F) - g)
3285
+ });
3286
+ } else if (F.kind === "image")
3287
+ H.push({ kind: "image", block: F, height: F.heightPx });
3288
+ else {
3289
+ const g = at(F, A, t, W);
3290
+ H.push({ kind: "table", block: F, ...g });
3291
+ }
3292
+ }
3293
+ z = 0, M(o[0].props);
3294
+ const C = [], m = () => (C.push(r), {
3295
+ index: C.length - 1,
3296
+ number: C.length,
3297
+ // provisional; the post-pass sets the real value
3298
+ blocks: [],
3299
+ widthPx: r.pageWidthPx,
3300
+ heightPx: r.pageHeightPx,
3301
+ marginPx: r.marginPx,
3302
+ contentTopPx: a,
3303
+ contentBottomPx: u
3304
+ }), y = [m()];
3305
+ let k = y[0], b = a;
3306
+ const U = /* @__PURE__ */ new Map(), J = 14, $ = 18, te = e.footnotes ?? {}, ne = Object.keys(te).length > 0;
3307
+ let he = 0;
3308
+ const Z = () => u - he, le = /* @__PURE__ */ new Set(), re = [[]], Ge = [0], ht = /* @__PURE__ */ new Map(), dt = (h) => {
3309
+ const F = te[h];
3310
+ if (!F || F.length === 0) return null;
3311
+ const g = Math.max(40, d - $);
3312
+ let B = 0;
3313
+ return { paras: F.map((O) => {
3314
+ const G = t(O, g);
3315
+ return B += O.style.spaceBeforePx + Se(G) + O.style.spaceAfterPx, { p: O, lines: G };
3316
+ }), height: B };
3317
+ }, on = (h, F, g) => {
3318
+ const B = [];
3319
+ for (let I = F; I < F + g; I++)
3320
+ for (const O of h[I].fragments) {
3321
+ const G = O.style.footnoteRef;
3322
+ G && te[G] && !le.has(G) && !B.some(([_]) => _ === G) && B.push([G, O.text]);
3323
+ }
3324
+ return B;
3325
+ };
3326
+ let Ne = 0, Le = 0;
3327
+ const ce = () => c + Ne * (A + p), se = () => k.blocks.length > Le, He = () => {
3328
+ Ne = 0, Le = 0, k = m(), y.push(k), re.push([]), Ge.push(0), he = 0, b = a, pe = [];
3329
+ }, ie = () => {
3330
+ Ne + 1 < S ? (Ne++, Le = k.blocks.length, b = a, pe = []) : He();
3331
+ }, ln = () => {
3332
+ k.blocks.length === 0 ? (k.widthPx = r.pageWidthPx, k.heightPx = r.pageHeightPx, k.marginPx = r.marginPx, k.contentTopPx = a, k.contentBottomPx = u, C[k.index] = r, Ne = 0, Le = 0, b = a, pe = []) : He();
3333
+ }, cn = (h, F, g, B) => {
3334
+ const I = {
3335
+ blockId: h.id,
3336
+ x: ce() + w(h),
3337
+ y: b,
3338
+ firstLineIndex: g,
3339
+ lines: []
3340
+ }, O = g === 0 ? E.get(h.id) : void 0;
3341
+ O && (I.marker = { text: O.text, style: O.style, x: I.x - O.hangingPx }), h.style.tocEntry && U.set(h.id, { chunk: I, rightEdge: ce() + A, para: h }), k.blocks.push(I);
3342
+ for (let G = g; G < g + B; G++) {
3343
+ const _ = F[G];
3344
+ I.lines.push({ ..._, y: b - I.y }), b += _.height;
3345
+ }
3346
+ }, an = (h, F) => {
3347
+ let g = 0, B = b;
3348
+ for (; F + g < h.length && B + h[F + g].height <= Z(); )
3349
+ B += h[F + g].height, g++;
3350
+ return g;
3351
+ }, Ft = (h) => {
3352
+ let F = re[k.index].length === 0 ? J : 0;
3353
+ const g = [];
3354
+ for (const [B, I] of h) {
3355
+ const O = dt(B);
3356
+ O && (F += O.height, g.push([B, I, O]));
3357
+ }
3358
+ return { H: F, measures: g };
3359
+ }, gt = (h, F) => {
3360
+ for (const [g, B] of h)
3361
+ le.add(g), re[k.index].push(g), ht.set(g, B);
3362
+ he += F, Ge[k.index] = he;
3363
+ }, un = (h) => {
3364
+ const F = [], g = (B) => {
3365
+ for (const I of B)
3366
+ if (I.kind === "paragraph") {
3367
+ let O = 0;
3368
+ for (const G of I.runs) {
3369
+ const _ = G.style.footnoteRef;
3370
+ _ && te[_] && !le.has(_) && !F.some(([K]) => K === _) && F.push([_, G.text]), O += G.text.length;
3371
+ }
3372
+ } else if (I.kind === "table")
3373
+ for (const O of I.rows) for (const G of O.cells) g(G.blocks);
3374
+ };
3375
+ for (const B of h) for (const I of B.cells) g(I.blocks);
3376
+ return F;
3377
+ }, fn = (h, F, g) => {
3378
+ for (; ; ) {
3379
+ if (g <= 0) return g;
3380
+ const B = on(h, F, g);
3381
+ if (B.length === 0) return g;
3382
+ const { H: I, measures: O } = Ft(B);
3383
+ if (O.length === 0) return g;
3384
+ let G = 0;
3385
+ for (let K = F; K < F + g; K++) G += h[K].height;
3386
+ if (b + G + I <= Z() || g === 1 && !se())
3387
+ return gt(O, I), g;
3388
+ g--;
3389
+ }
3390
+ }, hn = (h, F) => {
3391
+ if (h.style.keepLinesTogether === !0 && se()) {
3392
+ const B = Se(F);
3393
+ b + B > Z() && B <= u - a && ie();
3394
+ }
3395
+ let g = 0;
3396
+ for (; g < F.length; ) {
3397
+ const B = F.length - g, I = an(F, g);
3398
+ let O;
3399
+ if (I >= B ? O = B : (O = I, B - O === 1 && (O -= Gt - 1), g === 0 && O > 0 && O < Tt && (O = 0), O <= 0 && (O = se() ? 0 : Math.max(1, I))), O > 0 && ne && (O = fn(F, g, O)), O > 0 && (cn(h, F, g, O), g += O), g >= F.length) return;
3400
+ ie();
3401
+ }
3402
+ }, Se = (h) => {
3403
+ let F = 0;
3404
+ for (const g of h) F += g.height;
3405
+ return F;
3406
+ };
3407
+ let pe = [];
3408
+ const Nt = 10, dn = (h) => {
3409
+ let F = ce(), g = ce() + A;
3410
+ for (const B of pe)
3411
+ h >= B.bottom || (B.side === "left" ? F = Math.max(F, B.right + Nt) : g = Math.min(g, B.left - Nt));
3412
+ return { x0: F, width: Math.max(40, g - F) };
3413
+ }, Fn = (h) => pe.some((F) => F.bottom > h), gn = (h) => {
3414
+ b + h.heightPx > Z() && se() && ie();
3415
+ const F = h.wrap === "square" && h.align !== "center", g = A - h.widthPx, B = ce() + (h.align === "center" ? g / 2 : h.align === "right" ? g : 0);
3416
+ k.blocks.push({
3417
+ blockId: h.id,
3418
+ x: B,
3419
+ y: b,
3420
+ firstLineIndex: 0,
3421
+ lines: [],
3422
+ image: { src: h.src, width: h.widthPx, height: h.heightPx }
3423
+ }), F ? pe.push({ left: B, right: B + h.widthPx, bottom: b + h.heightPx, side: h.align === "right" ? "right" : "left" }) : b += h.heightPx;
3424
+ }, Nn = (h) => {
3425
+ const F = n(h);
3426
+ let g = !0, B = 0, I = null;
3427
+ const O = (G, _, K, Y) => {
3428
+ if (I === null) {
3429
+ I = { blockId: h.id, x: ce() + w(h), y: b, firstLineIndex: B, lines: [] };
3430
+ const Q = B === 0 ? E.get(h.id) : void 0;
3431
+ Q && (I.marker = { text: Q.text, style: Q.style, x: I.x - Q.hangingPx }), k.blocks.push(I);
3432
+ }
3433
+ const j = { y: b - I.y, height: _, ascent: K, fragments: G.map((Q) => Q.frag) };
3434
+ Y !== void 0 && (j.emptyOffset = Y), I.lines.push(j), b += _, B++;
3435
+ };
3436
+ for (const G of F) {
3437
+ const _ = lt(G.runs, G.startOffset), K = G.runs.map(() => 0);
3438
+ let Y, j = !1;
3439
+ for (; ; ) {
3440
+ const Q = K.slice(), V = dn(b), q = g ? h.style.indentFirstLinePx : 0, X = ct(
3441
+ h,
3442
+ G,
3443
+ Math.max(24, V.width - w(h) - q - R(h)),
3444
+ Y,
3445
+ _,
3446
+ K
3447
+ );
3448
+ if (X === null) break;
3449
+ if (b + X.height > Z() && se()) {
3450
+ for (let ae = 0; ae < K.length; ae++) K[ae] = Q[ae];
3451
+ ie(), I = null;
3452
+ continue;
3453
+ }
3454
+ const ee = V.width - q - R(h) - X.width;
3455
+ let me = V.x0 - ce() + q;
3456
+ h.style.align === "center" ? me += ee / 2 : h.style.align === "right" && (me += ee);
3457
+ for (const ae of X.frags) ae.frag.x += me;
3458
+ O(X.frags, X.height, X.ascent), Y = X.end, g = !1, j = !0;
3459
+ }
3460
+ if (!j) {
3461
+ const Q = tn(h);
3462
+ b + Q.height > Z() && se() && (ie(), I = null), O([], Q.height, Q.ascent, G.startOffset), g = !1;
3463
+ }
3464
+ }
3465
+ }, Sn = (h) => {
3466
+ h.block.rows.some((B) => B.cells.some((I) => (I.rowSpan ?? 1) > 1)) && se() && b + h.height > Z() && h.height <= u - a && ie();
3467
+ let g = 0;
3468
+ for (; g < h.rows.length; ) {
3469
+ let B = 0, I = b;
3470
+ for (; g + B < h.rows.length && I + h.rows[g + B].height <= Z(); )
3471
+ I += h.rows[g + B].height, B++;
3472
+ if (B === 0) {
3473
+ if (se()) {
3474
+ ie();
3475
+ continue;
3476
+ }
3477
+ B = 1;
3478
+ }
3479
+ let O = [], G = 0;
3480
+ for (; ; ) {
3481
+ const K = un(h.block.rows.slice(g, g + B));
3482
+ if (K.length === 0) break;
3483
+ const { H: Y, measures: j } = Ft(K);
3484
+ if (j.length === 0) break;
3485
+ let Q = 0;
3486
+ for (let V = g; V < g + B; V++) Q += h.rows[V].height;
3487
+ if (b + Q + Y <= Z() || B === 1 && !se()) {
3488
+ O = j, G = Y;
3489
+ break;
3490
+ }
3491
+ if (B--, B === 0) break;
3492
+ }
3493
+ if (B === 0) {
3494
+ ie();
3495
+ continue;
3496
+ }
3497
+ O.length > 0 && gt(O, G);
3498
+ const _ = h.rows.slice(g, g + B);
3499
+ k.blocks.push(ft(h.block, _, h.colWidths, ce(), b, A, g, W)), b += _.reduce((K, Y) => K + Y.height, 0), g += B, g < h.rows.length && ie();
3500
+ }
3501
+ };
3502
+ for (let h = 0; h < H.length; h++) {
3503
+ if (h > o[z].endBlock) {
3504
+ for (; h > o[z].endBlock; ) M(o[++z].props);
3505
+ ln();
3506
+ }
3507
+ const F = H[h], g = (_) => _?.kind === "table" || _?.kind === "image", B = g(H[h - 1]), I = g(H[h + 1]);
3508
+ if (F.kind === "image") {
3509
+ B || (b += Me), gn(F.block), !I && (F.block.wrap !== "square" || F.block.align === "center") && (b += Me);
3510
+ continue;
3511
+ }
3512
+ if (F.kind === "table") {
3513
+ B || (b += Me), Sn(F), I || (b += Me);
3514
+ continue;
3515
+ }
3516
+ const { block: O, lines: G } = F;
3517
+ if (O.style.pageBreakBefore === !0 && (k.blocks.length > 0 || Ne > 0) ? He() : O.style.columnBreakBefore === !0 && se() && ie(), b += O.style.spaceBeforePx, b >= Z() && se() && ie(), Fn(b)) {
3518
+ Nn(O), b += O.style.spaceAfterPx;
3519
+ continue;
3520
+ }
3521
+ if (O.style.keepWithNext === !0 && H[h + 1] !== void 0 && se()) {
3522
+ let _ = b + Se(G) + O.style.spaceAfterPx, K = _ <= Z();
3523
+ for (let Y = h + 1; K; Y++) {
3524
+ const j = H[Y];
3525
+ if (j === void 0) break;
3526
+ if (j.kind !== "para") {
3527
+ const ee = j.kind === "table" ? j.rows[0]?.height ?? j.height : j.height;
3528
+ _ + Me + ee > Z() && (K = !1);
3529
+ break;
3530
+ }
3531
+ _ += j.block.style.spaceBeforePx;
3532
+ const Q = j.block.style.keepWithNext === !0 && H[Y + 1] !== void 0;
3533
+ if (Q || j.block.style.keepLinesTogether === !0) {
3534
+ const ee = Se(j.lines);
3535
+ if (_ + ee > Z()) {
3536
+ K = !1;
3537
+ break;
3538
+ }
3539
+ if (_ += ee + j.block.style.spaceAfterPx, !Q) break;
3540
+ continue;
3541
+ }
3542
+ if (H[Y + 1] !== void 0 && j.block.runs.every((ee) => ee.text.trim().length === 0)) {
3543
+ const ee = Se(j.lines);
3544
+ if (_ + ee > Z()) {
3545
+ K = !1;
3546
+ break;
3547
+ }
3548
+ _ += ee + j.block.style.spaceAfterPx;
3549
+ continue;
3550
+ }
3551
+ let V = 0, q = _;
3552
+ for (; V < j.lines.length && q + j.lines[V].height <= Z(); )
3553
+ q += j.lines[V].height, V++;
3554
+ let X = V;
3555
+ V < j.lines.length && (j.lines.length - X === 1 && (X -= Gt - 1), X < Tt && (X = 0)), X <= 0 && (K = !1);
3556
+ break;
3557
+ }
3558
+ K || ie();
3559
+ }
3560
+ hn(O, G), b += O.style.spaceAfterPx;
3561
+ }
3562
+ for (const h of y) {
3563
+ const F = re[h.index];
3564
+ if (!F || F.length === 0) continue;
3565
+ const g = C[h.index];
3566
+ M(g);
3567
+ let B = u - Ge[h.index];
3568
+ h.footnoteRuleY = B + 4, B += J;
3569
+ const I = g.marginPx.left;
3570
+ for (const O of F) {
3571
+ const G = dt(O);
3572
+ if (!G) continue;
3573
+ let _ = !0;
3574
+ for (const K of G.paras) {
3575
+ B += K.p.style.spaceBeforePx;
3576
+ const Y = {
3577
+ blockId: K.p.id,
3578
+ x: I + $,
3579
+ y: B,
3580
+ firstLineIndex: 0,
3581
+ lines: K.lines
3582
+ };
3583
+ _ && K.p.runs[0] && (Y.marker = { text: `${ht.get(O) ?? "•"}.`, style: K.p.runs[0].style, x: I }, _ = !1), h.blocks.push(Y), B += Se(K.lines) + K.p.style.spaceAfterPx;
3584
+ }
3585
+ }
3586
+ }
3587
+ const _e = [];
3588
+ {
3589
+ let h = 0;
3590
+ for (let F = 0; F < y.length; F++) {
3591
+ const g = C[F];
3592
+ (F === 0 || C[F - 1] !== g) && g.pageNumberStart !== void 0 ? h = g.pageNumberStart : h++, _e.push(h), y[F].number = h;
3593
+ }
3594
+ }
3595
+ if (U.size > 0) {
3596
+ const h = /* @__PURE__ */ new Map(), F = (g, B) => {
3597
+ for (const I of g)
3598
+ if (h.has(I.blockId) || h.set(I.blockId, B), I.table) for (const O of I.table.rows) for (const G of O.cells) F(G.blocks, B);
3599
+ };
3600
+ for (const g of y) F(g.blocks, _e[g.index]);
3601
+ for (const g of U.values()) {
3602
+ const B = g.para.style.tocEntry.targetId, I = h.get(B);
3603
+ if (I === void 0) continue;
3604
+ const O = g.para.runs[0]?.style;
3605
+ if (!O || g.chunk.lines.length === 0) continue;
3606
+ const G = String(I);
3607
+ g.chunk.toc = {
3608
+ numText: G,
3609
+ numX: g.rightEdge - et(G, fe(O)),
3610
+ lineIndex: g.chunk.lines.length - 1,
3611
+ style: O
3612
+ };
3613
+ }
3614
+ }
3615
+ const St = (h, F, g, B) => {
3616
+ const I = F === "header" ? h.headerFirst : h.footerFirst, O = F === "header" ? h.headerEven : h.footerEven;
3617
+ if (g && I) return { blocks: I, source: F === "header" ? "headerFirst" : "footerFirst" };
3618
+ if (B && O) return { blocks: O, source: F === "header" ? "headerEven" : "footerEven" };
3619
+ const G = h[F];
3620
+ return G ? { blocks: G, source: F } : null;
3621
+ };
3622
+ if (C.some((h) => xn.some((F) => h[F]))) {
3623
+ const h = new Ve();
3624
+ for (const F of y) {
3625
+ const g = C[F.index], B = g.pageWidthPx - g.marginPx.left - g.marginPx.right, I = g.marginPx.left, O = F.index === 0 || C[F.index - 1] !== g, G = _e[F.index], _ = G % 2 === 0, K = St(g, "header", O, _);
3626
+ if (K) {
3627
+ const j = i === "header", Q = be(K.blocks, B, I, G, y.length, h, j), V = Ht(g, Q.height);
3628
+ F.header = Q.placed.map((q) => Ze(q, V)), F.headerSource = K.source;
3629
+ }
3630
+ const Y = St(g, "footer", O, _);
3631
+ if (Y) {
3632
+ const j = i === "footer", Q = be(Y.blocks, B, I, G, y.length, h, j), V = _t(g, Q.height);
3633
+ F.footer = Q.placed.map((q) => Ze(q, V)), F.footerSource = Y.source;
3634
+ }
3635
+ }
3636
+ }
3637
+ return {
3638
+ pages: y,
3639
+ pageWidthPx: e.section.pageWidthPx,
3640
+ pageHeightPx: e.section.pageHeightPx,
3641
+ marginPx: e.section.marginPx
3642
+ };
3643
+ }
3644
+ function ks(e, t) {
3645
+ switch (t) {
3646
+ case "roman":
3647
+ return Ce(e, "lowerRoman");
3648
+ case "Roman":
3649
+ return Ce(e, "upperRoman");
3650
+ case "alpha":
3651
+ return Ce(e, "lowerLetter");
3652
+ case "Alpha":
3653
+ return Ce(e, "upperLetter");
3654
+ default:
3655
+ return String(e);
3656
+ }
3657
+ }
3658
+ function Ds(e, t, n) {
3659
+ return e.replace(/\{page(?::(roman|Roman|alpha|Alpha))?\}/g, (i, x) => ks(t, x)).replace(/\{pages\}/g, String(n)).replace(/\{date\}/g, () => (/* @__PURE__ */ new Date()).toLocaleDateString()).replace(/\{time\}/g, () => (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }));
3660
+ }
3661
+ function Ls(e, t, n) {
3662
+ const i = (x) => x.runs.some((s) => s.text.includes("{")) ? {
3663
+ ...x,
3664
+ id: `${x.id}@p${t}`,
3665
+ // per-page identity keeps the band prepare-cache honest
3666
+ runs: x.runs.map((s) => ({ ...s, text: Ds(s.text, t, n) }))
3667
+ } : x;
3668
+ return e.kind === "paragraph" ? i(e) : e.kind === "table" ? {
3669
+ ...e,
3670
+ rows: e.rows.map((x) => ({
3671
+ cells: x.cells.map((s) => ({
3672
+ ...s,
3673
+ blocks: s.blocks.map((l) => l.kind === "paragraph" ? i(l) : l)
3674
+ }))
3675
+ }))
3676
+ } : e;
3677
+ }
3678
+ function be(e, t, n, i, x, s, l) {
3679
+ const f = (c, a) => sn(c, a, s), o = [];
3680
+ let r = 0;
3681
+ for (const c of e) {
3682
+ const a = l ? c : Ls(c, i, x);
3683
+ if (a.kind === "paragraph") {
3684
+ r += a.style.spaceBeforePx;
3685
+ const u = f(a, t);
3686
+ o.push({ blockId: a.id, x: n + a.style.indentLeftPx, y: r, firstLineIndex: 0, lines: u }), r += ut(u) + a.style.spaceAfterPx;
3687
+ } else if (a.kind === "image") {
3688
+ const u = t - a.widthPx, d = n + (a.align === "center" ? u / 2 : a.align === "right" ? u : 0);
3689
+ o.push({
3690
+ blockId: a.id,
3691
+ x: d,
3692
+ y: r,
3693
+ firstLineIndex: 0,
3694
+ lines: [],
3695
+ image: { src: a.src, width: a.widthPx, height: a.heightPx }
3696
+ }), r += a.heightPx;
3697
+ } else {
3698
+ const u = at(a, t, f, zt);
3699
+ o.push(ft(a, u.rows, u.colWidths, n, r, t, 0, zt)), r += u.height;
3700
+ }
3701
+ }
3702
+ return { placed: o, height: r };
3703
+ }
3704
+ function Ze(e, t) {
3705
+ const n = { ...e, y: e.y + t };
3706
+ return e.table && (n.table = {
3707
+ ...e.table,
3708
+ y: e.table.y + t,
3709
+ rows: e.table.rows.map((i) => ({
3710
+ ...i,
3711
+ y: i.y + t,
3712
+ cells: i.cells.map((x) => ({
3713
+ ...x,
3714
+ y: x.y + t,
3715
+ blocks: x.blocks.map((s) => Ze(s, t))
3716
+ }))
3717
+ }))
3718
+ }), n;
3719
+ }
3720
+ const Me = 12, Os = { top: 0, right: 7.2, bottom: 0, left: 7.2 }, rn = (e) => e.margin ?? Os, ke = 4, zt = { indentOf: () => 0, markers: /* @__PURE__ */ new Map() };
3721
+ function at(e, t, n, i) {
3722
+ const s = fs(e).map((c) => c * t), l = s.length, f = new Array(l).fill(0), o = e.rows.map((c) => {
3723
+ let a = 0;
3724
+ const u = c.cells.map((d) => {
3725
+ for (; a < l && f[a] > 0; ) a++;
3726
+ const S = Math.max(1, d.colSpan ?? 1), p = Math.max(1, d.rowSpan ?? 1), A = a;
3727
+ let M = 0;
3728
+ for (let N = 0; N < S; N++) M += s[a + N] ?? s[l - 1] ?? 40;
3729
+ if (p > 1) for (let N = 0; N < S && a + N < l; N++) f[a + N] = p;
3730
+ a += S;
3731
+ const v = rn(d), L = Math.max(8, M - v.left - v.right);
3732
+ let w = 0;
3733
+ const R = d.blocks.map((N) => {
3734
+ if (N.kind === "paragraph") {
3735
+ const E = n(N, Math.max(8, L - i.indentOf(N)));
3736
+ return w += N.style.spaceBeforePx + ut(E) + N.style.spaceAfterPx, { kind: "para", block: N, lines: E };
3737
+ }
3738
+ if (N.kind === "image") {
3739
+ const E = Math.min(1, L / Math.max(1, N.widthPx)), T = N.widthPx * E, P = N.heightPx * E;
3740
+ return w += P + ke, { kind: "image", block: N, width: T, height: P };
3741
+ }
3742
+ const D = at(N, L, n, i);
3743
+ return w += D.height + ke, { kind: "table", block: N, ...D };
3744
+ });
3745
+ return { cell: d, items: R, height: w + v.top + v.bottom, width: M, colStart: A, rowSpan: p };
3746
+ });
3747
+ for (let d = 0; d < l; d++) f[d] > 0 && f[d]--;
3748
+ return { cells: u, height: 0 };
3749
+ }), r = o.map((c) => Math.max(0, ...c.cells.filter((a) => a.rowSpan === 1).map((a) => a.height)));
3750
+ return o.forEach((c, a) => {
3751
+ for (const u of c.cells) {
3752
+ if (u.rowSpan <= 1) continue;
3753
+ const d = Math.min(o.length - 1, a + u.rowSpan - 1);
3754
+ let S = 0;
3755
+ for (let p = a; p <= d; p++) S += r[p];
3756
+ u.height > S && (r[d] += u.height - S);
3757
+ }
3758
+ }), o.forEach((c, a) => c.height = r[a]), { rows: o, colWidths: s, height: r.reduce((c, a) => c + a, 0) };
3759
+ }
3760
+ function ut(e) {
3761
+ let t = 0;
3762
+ for (const n of e) t += n.height;
3763
+ return t;
3764
+ }
3765
+ function ft(e, t, n, i, x, s, l, f) {
3766
+ const o = [0];
3767
+ for (const u of n) o.push(o[o.length - 1] + u);
3768
+ const r = [x];
3769
+ for (const u of t) r.push(r[r.length - 1] + u.height);
3770
+ const c = [];
3771
+ for (let u = 0; u < t.length; u++) {
3772
+ const d = t[u], S = r[u], p = [];
3773
+ for (const A of d.cells) {
3774
+ const M = i + (o[A.colStart] ?? o[o.length - 1]), v = Math.min(t.length - 1, u + A.rowSpan - 1), L = r[v + 1] - S, w = [], R = rn(A.cell), N = A.width - R.left - R.right;
3775
+ let D = S + R.top;
3776
+ for (const E of A.items)
3777
+ if (E.kind === "para") {
3778
+ D += E.block.style.spaceBeforePx;
3779
+ const T = M + R.left + E.block.style.indentLeftPx + f.indentOf(E.block), P = {
3780
+ blockId: E.block.id,
3781
+ x: T,
3782
+ y: D,
3783
+ firstLineIndex: 0,
3784
+ lines: E.lines
3785
+ // line.y is already block-relative; coords stay consistent
3786
+ }, W = f.markers.get(E.block.id);
3787
+ W && (P.marker = { text: W.text, style: W.style, x: Math.max(M + 1, T - W.hangingPx) }), w.push(P), D += ut(E.lines) + E.block.style.spaceAfterPx;
3788
+ } else if (E.kind === "image") {
3789
+ const T = L - R.top - R.bottom;
3790
+ if (A.items.length === 1 && T > E.height + 8) {
3791
+ const P = Math.max(N / E.block.widthPx, T / E.block.heightPx), W = E.block.widthPx * P, H = E.block.heightPx * P, z = M + R.left, C = S + R.top;
3792
+ w.push({
3793
+ blockId: E.block.id,
3794
+ x: z + (N - W) / 2,
3795
+ y: C + (T - H) / 2,
3796
+ firstLineIndex: 0,
3797
+ lines: [],
3798
+ image: { src: E.block.src, width: W, height: H, clip: { x: z, y: C, width: N, height: T } }
3799
+ }), D += E.height + ke;
3800
+ } else {
3801
+ const P = N - E.width, W = M + R.left + (E.block.align === "center" ? P / 2 : E.block.align === "right" ? P : 0);
3802
+ w.push({
3803
+ blockId: E.block.id,
3804
+ x: W,
3805
+ y: D,
3806
+ firstLineIndex: 0,
3807
+ lines: [],
3808
+ image: { src: E.block.src, width: E.width, height: E.height }
3809
+ }), D += E.height + ke;
3810
+ }
3811
+ } else
3812
+ w.push(ft(E.block, E.rows, E.colWidths, M + R.left, D, N, 0, f)), D += E.height + ke;
3813
+ p.push({
3814
+ x: M,
3815
+ y: S,
3816
+ width: A.width,
3817
+ height: L,
3818
+ blocks: w,
3819
+ ...A.cell.shading !== void 0 ? { shading: A.cell.shading } : {},
3820
+ ...A.cell.borders !== void 0 ? { borders: A.cell.borders } : {}
3821
+ });
3822
+ }
3823
+ c.push({ y: S, height: d.height, cells: p });
3824
+ }
3825
+ const a = t.reduce((u, d) => u + d.height, 0);
3826
+ return {
3827
+ blockId: e.id,
3828
+ x: i,
3829
+ y: x,
3830
+ firstLineIndex: l,
3831
+ // for tables this is the chunk's first ROW index
3832
+ lines: [],
3833
+ table: { x: i, y: x, width: s, height: a, rows: c, colWidths: n }
3834
+ };
3835
+ }
3836
+ export {
3837
+ Is as createLayoutEngine,
3838
+ Bs as effectiveSection,
3839
+ Ms as resolveSections
3840
+ };