react-book-reader 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +23 -0
- package/lib/comic-book-D2H5riQt.js +29 -0
- package/lib/epub-BZxdKHA1.js +730 -0
- package/lib/fb2-DHUjllK8.js +263 -0
- package/lib/fflate-9VGFqnqw.js +162 -0
- package/lib/fixed-layout-DpOZsuor.js +223 -0
- package/lib/index-DjYU7mCB.js +1720 -0
- package/lib/mobi-Di0D6QEl.js +1036 -0
- package/lib/paginator-zvlJVmJl.js +722 -0
- package/lib/pdf-7wZ7-Bhj.js +563 -0
- package/lib/react-book-reader.es.js +7 -0
- package/lib/react-book-reader.umd.js +715 -0
- package/lib/search-Dw1WQJVD.js +78 -0
- package/lib/tts-CuDZu6rz.js +242 -0
- package/lib/zip-BLPDOR3v.js +1614 -0
- package/package.json +43 -0
|
@@ -0,0 +1,563 @@
|
|
|
1
|
+
const b = `
|
|
2
|
+
/* Copyright 2014 Mozilla Foundation
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
:root {
|
|
18
|
+
--highlight-bg-color: rgb(180 0 170);
|
|
19
|
+
--highlight-selected-bg-color: rgb(0 100 0);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@media screen and (forced-colors: active) {
|
|
23
|
+
:root {
|
|
24
|
+
--highlight-bg-color: Highlight;
|
|
25
|
+
--highlight-selected-bg-color: ButtonText;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.textLayer {
|
|
30
|
+
position: absolute;
|
|
31
|
+
text-align: initial;
|
|
32
|
+
inset: 0;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
opacity: 0.25;
|
|
35
|
+
line-height: 1;
|
|
36
|
+
text-size-adjust: none;
|
|
37
|
+
forced-color-adjust: none;
|
|
38
|
+
transform-origin: 0 0;
|
|
39
|
+
z-index: 2;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.textLayer :is(span, br) {
|
|
43
|
+
color: transparent;
|
|
44
|
+
position: absolute;
|
|
45
|
+
white-space: pre;
|
|
46
|
+
cursor: text;
|
|
47
|
+
transform-origin: 0% 0%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* Only necessary in Google Chrome, see issue 14205, and most unfortunately
|
|
51
|
+
* the problem doesn't show up in "text" reference tests. */
|
|
52
|
+
/*#if !MOZCENTRAL*/
|
|
53
|
+
.textLayer span.markedContent {
|
|
54
|
+
top: 0;
|
|
55
|
+
height: 0;
|
|
56
|
+
}
|
|
57
|
+
/*#endif*/
|
|
58
|
+
|
|
59
|
+
.textLayer .highlight {
|
|
60
|
+
margin: -1px;
|
|
61
|
+
padding: 1px;
|
|
62
|
+
background-color: var(--highlight-bg-color);
|
|
63
|
+
border-radius: 4px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.textLayer .highlight.appended {
|
|
67
|
+
position: initial;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.textLayer .highlight.begin {
|
|
71
|
+
border-radius: 4px 0 0 4px;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.textLayer .highlight.end {
|
|
75
|
+
border-radius: 0 4px 4px 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.textLayer .highlight.middle {
|
|
79
|
+
border-radius: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.textLayer .highlight.selected {
|
|
83
|
+
background-color: var(--highlight-selected-bg-color);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.textLayer ::selection {
|
|
87
|
+
/*#if !MOZCENTRAL*/
|
|
88
|
+
background: blue;
|
|
89
|
+
/*#endif*/
|
|
90
|
+
background: AccentColor; /* stylelint-disable-line declaration-block-no-duplicate-properties */
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* Avoids https://github.com/mozilla/pdf.js/issues/13840 in Chrome */
|
|
94
|
+
/*#if !MOZCENTRAL*/
|
|
95
|
+
.textLayer br::selection {
|
|
96
|
+
background: transparent;
|
|
97
|
+
}
|
|
98
|
+
/*#endif*/
|
|
99
|
+
|
|
100
|
+
.textLayer .endOfContent {
|
|
101
|
+
display: block;
|
|
102
|
+
position: absolute;
|
|
103
|
+
inset: 100% 0 0;
|
|
104
|
+
z-index: -1;
|
|
105
|
+
cursor: default;
|
|
106
|
+
user-select: none;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.textLayer .endOfContent.active {
|
|
110
|
+
top: 0;
|
|
111
|
+
}
|
|
112
|
+
`, x = `
|
|
113
|
+
/* Copyright 2014 Mozilla Foundation
|
|
114
|
+
*
|
|
115
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
116
|
+
* you may not use this file except in compliance with the License.
|
|
117
|
+
* You may obtain a copy of the License at
|
|
118
|
+
*
|
|
119
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
120
|
+
*
|
|
121
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
122
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
123
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
124
|
+
* See the License for the specific language governing permissions and
|
|
125
|
+
* limitations under the License.
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
:root {
|
|
129
|
+
--annotation-unfocused-field-background: url("data:image/svg+xml;charset=UTF-8,<svg width='1px' height='1px' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' style='fill:rgba(0, 54, 255, 0.13);'/></svg>");
|
|
130
|
+
--input-focus-border-color: Highlight;
|
|
131
|
+
--input-focus-outline: 1px solid Canvas;
|
|
132
|
+
--input-unfocused-border-color: transparent;
|
|
133
|
+
--input-disabled-border-color: transparent;
|
|
134
|
+
--input-hover-border-color: black;
|
|
135
|
+
--link-outline: none;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@media screen and (forced-colors: active) {
|
|
139
|
+
:root {
|
|
140
|
+
--input-focus-border-color: CanvasText;
|
|
141
|
+
--input-unfocused-border-color: ActiveText;
|
|
142
|
+
--input-disabled-border-color: GrayText;
|
|
143
|
+
--input-hover-border-color: Highlight;
|
|
144
|
+
--link-outline: 1.5px solid LinkText;
|
|
145
|
+
--hcm-highligh-filter: invert(100%);
|
|
146
|
+
}
|
|
147
|
+
.annotationLayer .textWidgetAnnotation :is(input, textarea):required,
|
|
148
|
+
.annotationLayer .choiceWidgetAnnotation select:required,
|
|
149
|
+
.annotationLayer
|
|
150
|
+
.buttonWidgetAnnotation:is(.checkBox, .radioButton)
|
|
151
|
+
input:required {
|
|
152
|
+
outline: 1.5px solid selectedItem;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.annotationLayer .linkAnnotation:hover {
|
|
156
|
+
backdrop-filter: var(--hcm-highligh-filter);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.annotationLayer .linkAnnotation > a:hover {
|
|
160
|
+
opacity: 0 !important;
|
|
161
|
+
background: none !important;
|
|
162
|
+
box-shadow: none;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.annotationLayer .popupAnnotation .popup {
|
|
166
|
+
outline: calc(1.5px * var(--scale-factor)) solid CanvasText !important;
|
|
167
|
+
background-color: ButtonFace !important;
|
|
168
|
+
color: ButtonText !important;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.annotationLayer .highlightArea:hover::after {
|
|
172
|
+
position: absolute;
|
|
173
|
+
top: 0;
|
|
174
|
+
left: 0;
|
|
175
|
+
width: 100%;
|
|
176
|
+
height: 100%;
|
|
177
|
+
backdrop-filter: var(--hcm-highligh-filter);
|
|
178
|
+
content: "";
|
|
179
|
+
pointer-events: none;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.annotationLayer .popupAnnotation.focused .popup {
|
|
183
|
+
outline: calc(3px * var(--scale-factor)) solid Highlight !important;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.annotationLayer {
|
|
188
|
+
position: absolute;
|
|
189
|
+
top: 0;
|
|
190
|
+
left: 0;
|
|
191
|
+
pointer-events: none;
|
|
192
|
+
transform-origin: 0 0;
|
|
193
|
+
z-index: 3;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.annotationLayer[data-main-rotation="90"] .norotate {
|
|
197
|
+
transform: rotate(270deg) translateX(-100%);
|
|
198
|
+
}
|
|
199
|
+
.annotationLayer[data-main-rotation="180"] .norotate {
|
|
200
|
+
transform: rotate(180deg) translate(-100%, -100%);
|
|
201
|
+
}
|
|
202
|
+
.annotationLayer[data-main-rotation="270"] .norotate {
|
|
203
|
+
transform: rotate(90deg) translateY(-100%);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.annotationLayer canvas {
|
|
207
|
+
position: absolute;
|
|
208
|
+
width: 100%;
|
|
209
|
+
height: 100%;
|
|
210
|
+
pointer-events: none;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.annotationLayer section {
|
|
214
|
+
position: absolute;
|
|
215
|
+
text-align: initial;
|
|
216
|
+
pointer-events: auto;
|
|
217
|
+
box-sizing: border-box;
|
|
218
|
+
transform-origin: 0 0;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.annotationLayer .linkAnnotation {
|
|
222
|
+
outline: var(--link-outline);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.annotationLayer :is(.linkAnnotation, .buttonWidgetAnnotation.pushButton) > a {
|
|
226
|
+
position: absolute;
|
|
227
|
+
font-size: 1em;
|
|
228
|
+
top: 0;
|
|
229
|
+
left: 0;
|
|
230
|
+
width: 100%;
|
|
231
|
+
height: 100%;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.annotationLayer
|
|
235
|
+
:is(.linkAnnotation, .buttonWidgetAnnotation.pushButton):not(.hasBorder)
|
|
236
|
+
> a:hover {
|
|
237
|
+
opacity: 0.2;
|
|
238
|
+
background-color: rgb(255 255 0);
|
|
239
|
+
box-shadow: 0 2px 10px rgb(255 255 0);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.annotationLayer .linkAnnotation.hasBorder:hover {
|
|
243
|
+
background-color: rgb(255 255 0 / 0.2);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.annotationLayer .hasBorder {
|
|
247
|
+
background-size: 100% 100%;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.annotationLayer .textAnnotation img {
|
|
251
|
+
position: absolute;
|
|
252
|
+
cursor: pointer;
|
|
253
|
+
width: 100%;
|
|
254
|
+
height: 100%;
|
|
255
|
+
top: 0;
|
|
256
|
+
left: 0;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.annotationLayer .textWidgetAnnotation :is(input, textarea),
|
|
260
|
+
.annotationLayer .choiceWidgetAnnotation select,
|
|
261
|
+
.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input {
|
|
262
|
+
background-image: var(--annotation-unfocused-field-background);
|
|
263
|
+
border: 2px solid var(--input-unfocused-border-color);
|
|
264
|
+
box-sizing: border-box;
|
|
265
|
+
font: calc(9px * var(--scale-factor)) sans-serif;
|
|
266
|
+
height: 100%;
|
|
267
|
+
margin: 0;
|
|
268
|
+
vertical-align: top;
|
|
269
|
+
width: 100%;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.annotationLayer .textWidgetAnnotation :is(input, textarea):required,
|
|
273
|
+
.annotationLayer .choiceWidgetAnnotation select:required,
|
|
274
|
+
.annotationLayer
|
|
275
|
+
.buttonWidgetAnnotation:is(.checkBox, .radioButton)
|
|
276
|
+
input:required {
|
|
277
|
+
outline: 1.5px solid red;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.annotationLayer .choiceWidgetAnnotation select option {
|
|
281
|
+
padding: 0;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.annotationLayer .buttonWidgetAnnotation.radioButton input {
|
|
285
|
+
border-radius: 50%;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.annotationLayer .textWidgetAnnotation textarea {
|
|
289
|
+
resize: none;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.annotationLayer .textWidgetAnnotation :is(input, textarea)[disabled],
|
|
293
|
+
.annotationLayer .choiceWidgetAnnotation select[disabled],
|
|
294
|
+
.annotationLayer
|
|
295
|
+
.buttonWidgetAnnotation:is(.checkBox, .radioButton)
|
|
296
|
+
input[disabled] {
|
|
297
|
+
background: none;
|
|
298
|
+
border: 2px solid var(--input-disabled-border-color);
|
|
299
|
+
cursor: not-allowed;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.annotationLayer .textWidgetAnnotation :is(input, textarea):hover,
|
|
303
|
+
.annotationLayer .choiceWidgetAnnotation select:hover,
|
|
304
|
+
.annotationLayer
|
|
305
|
+
.buttonWidgetAnnotation:is(.checkBox, .radioButton)
|
|
306
|
+
input:hover {
|
|
307
|
+
border: 2px solid var(--input-hover-border-color);
|
|
308
|
+
}
|
|
309
|
+
.annotationLayer .textWidgetAnnotation :is(input, textarea):hover,
|
|
310
|
+
.annotationLayer .choiceWidgetAnnotation select:hover,
|
|
311
|
+
.annotationLayer .buttonWidgetAnnotation.checkBox input:hover {
|
|
312
|
+
border-radius: 2px;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.annotationLayer .textWidgetAnnotation :is(input, textarea):focus,
|
|
316
|
+
.annotationLayer .choiceWidgetAnnotation select:focus {
|
|
317
|
+
background: none;
|
|
318
|
+
border: 2px solid var(--input-focus-border-color);
|
|
319
|
+
border-radius: 2px;
|
|
320
|
+
outline: var(--input-focus-outline);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) :focus {
|
|
324
|
+
background-image: none;
|
|
325
|
+
background-color: transparent;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.annotationLayer .buttonWidgetAnnotation.checkBox :focus {
|
|
329
|
+
border: 2px solid var(--input-focus-border-color);
|
|
330
|
+
border-radius: 2px;
|
|
331
|
+
outline: var(--input-focus-outline);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.annotationLayer .buttonWidgetAnnotation.radioButton :focus {
|
|
335
|
+
border: 2px solid var(--input-focus-border-color);
|
|
336
|
+
outline: var(--input-focus-outline);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before,
|
|
340
|
+
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after,
|
|
341
|
+
.annotationLayer .buttonWidgetAnnotation.radioButton input:checked::before {
|
|
342
|
+
background-color: CanvasText;
|
|
343
|
+
content: "";
|
|
344
|
+
display: block;
|
|
345
|
+
position: absolute;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before,
|
|
349
|
+
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after {
|
|
350
|
+
height: 80%;
|
|
351
|
+
left: 45%;
|
|
352
|
+
width: 1px;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::before {
|
|
356
|
+
transform: rotate(45deg);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.annotationLayer .buttonWidgetAnnotation.checkBox input:checked::after {
|
|
360
|
+
transform: rotate(-45deg);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.annotationLayer .buttonWidgetAnnotation.radioButton input:checked::before {
|
|
364
|
+
border-radius: 50%;
|
|
365
|
+
height: 50%;
|
|
366
|
+
left: 30%;
|
|
367
|
+
top: 20%;
|
|
368
|
+
width: 50%;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.annotationLayer .textWidgetAnnotation input.comb {
|
|
372
|
+
font-family: monospace;
|
|
373
|
+
padding-left: 2px;
|
|
374
|
+
padding-right: 0;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.annotationLayer .textWidgetAnnotation input.comb:focus {
|
|
378
|
+
/*
|
|
379
|
+
* Letter spacing is placed on the right side of each character. Hence, the
|
|
380
|
+
* letter spacing of the last character may be placed outside the visible
|
|
381
|
+
* area, causing horizontal scrolling. We avoid this by extending the width
|
|
382
|
+
* when the element has focus and revert this when it loses focus.
|
|
383
|
+
*/
|
|
384
|
+
width: 103%;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.annotationLayer .buttonWidgetAnnotation:is(.checkBox, .radioButton) input {
|
|
388
|
+
appearance: none;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.annotationLayer .fileAttachmentAnnotation .popupTriggerArea {
|
|
392
|
+
height: 100%;
|
|
393
|
+
width: 100%;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.annotationLayer .popupAnnotation {
|
|
397
|
+
position: absolute;
|
|
398
|
+
font-size: calc(9px * var(--scale-factor));
|
|
399
|
+
pointer-events: none;
|
|
400
|
+
width: max-content;
|
|
401
|
+
max-width: 45%;
|
|
402
|
+
height: auto;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.annotationLayer .popup {
|
|
406
|
+
background-color: rgb(255 255 153);
|
|
407
|
+
box-shadow: 0 calc(2px * var(--scale-factor)) calc(5px * var(--scale-factor))
|
|
408
|
+
rgb(136 136 136);
|
|
409
|
+
border-radius: calc(2px * var(--scale-factor));
|
|
410
|
+
outline: 1.5px solid rgb(255 255 74);
|
|
411
|
+
padding: calc(6px * var(--scale-factor));
|
|
412
|
+
cursor: pointer;
|
|
413
|
+
font: message-box;
|
|
414
|
+
white-space: normal;
|
|
415
|
+
word-wrap: break-word;
|
|
416
|
+
pointer-events: auto;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.annotationLayer .popupAnnotation.focused .popup {
|
|
420
|
+
outline-width: 3px;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.annotationLayer .popup * {
|
|
424
|
+
font-size: calc(9px * var(--scale-factor));
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.annotationLayer .popup > .header {
|
|
428
|
+
display: inline-block;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.annotationLayer .popup > .header h1 {
|
|
432
|
+
display: inline;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.annotationLayer .popup > .header .popupDate {
|
|
436
|
+
display: inline-block;
|
|
437
|
+
margin-left: calc(5px * var(--scale-factor));
|
|
438
|
+
width: fit-content;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.annotationLayer .popupContent {
|
|
442
|
+
border-top: 1px solid rgb(51 51 51);
|
|
443
|
+
margin-top: calc(2px * var(--scale-factor));
|
|
444
|
+
padding-top: calc(2px * var(--scale-factor));
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.annotationLayer .richText > * {
|
|
448
|
+
white-space: pre-wrap;
|
|
449
|
+
font-size: calc(9px * var(--scale-factor));
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.annotationLayer .popupTriggerArea {
|
|
453
|
+
cursor: pointer;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.annotationLayer section svg {
|
|
457
|
+
position: absolute;
|
|
458
|
+
width: 100%;
|
|
459
|
+
height: 100%;
|
|
460
|
+
top: 0;
|
|
461
|
+
left: 0;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.annotationLayer .annotationTextContent {
|
|
465
|
+
position: absolute;
|
|
466
|
+
width: 100%;
|
|
467
|
+
height: 100%;
|
|
468
|
+
opacity: 0;
|
|
469
|
+
color: transparent;
|
|
470
|
+
user-select: none;
|
|
471
|
+
pointer-events: none;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.annotationLayer .annotationTextContent span {
|
|
475
|
+
width: 100%;
|
|
476
|
+
display: inline-block;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.annotationLayer svg.quadrilateralsContainer {
|
|
480
|
+
contain: strict;
|
|
481
|
+
width: 0;
|
|
482
|
+
height: 0;
|
|
483
|
+
position: absolute;
|
|
484
|
+
top: 0;
|
|
485
|
+
left: 0;
|
|
486
|
+
z-index: -1;
|
|
487
|
+
}
|
|
488
|
+
`, u = async (n, p) => {
|
|
489
|
+
const o = devicePixelRatio, t = n.getViewport({ scale: o }), i = document.createElement("canvas");
|
|
490
|
+
i.height = t.height, i.width = t.width;
|
|
491
|
+
const d = i.getContext("2d");
|
|
492
|
+
await n.render({ canvasContext: d, viewport: t }).promise;
|
|
493
|
+
const l = await new Promise((r) => i.toBlob(r));
|
|
494
|
+
if (p)
|
|
495
|
+
return l;
|
|
496
|
+
const c = document.createElement("div");
|
|
497
|
+
c.classList.add("textLayer"), await pdfjsLib.renderTextLayer({
|
|
498
|
+
textContentSource: await n.getTextContent(),
|
|
499
|
+
container: c,
|
|
500
|
+
viewport: t
|
|
501
|
+
}).promise;
|
|
502
|
+
const a = document.createElement("div");
|
|
503
|
+
a.classList.add("annotationLayer"), await new pdfjsLib.AnnotationLayer({ page: n, viewport: t, div: a }).render({
|
|
504
|
+
annotations: await n.getAnnotations(),
|
|
505
|
+
linkService: {
|
|
506
|
+
getDestinationHash: (r) => JSON.stringify(r),
|
|
507
|
+
addLinkAttributes: (r, g) => r.href = g
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
const e = URL.createObjectURL(l);
|
|
511
|
+
return URL.createObjectURL(new Blob([`
|
|
512
|
+
<!DOCTYPE html>
|
|
513
|
+
<meta charset="utf-8">
|
|
514
|
+
<style>
|
|
515
|
+
:root {
|
|
516
|
+
--scale-factor: ${o};
|
|
517
|
+
}
|
|
518
|
+
html, body {
|
|
519
|
+
margin: 0;
|
|
520
|
+
padding: 0;
|
|
521
|
+
}
|
|
522
|
+
${b}
|
|
523
|
+
${x}
|
|
524
|
+
</style>
|
|
525
|
+
<img src="${e}">
|
|
526
|
+
${c.outerHTML}
|
|
527
|
+
${a.outerHTML}
|
|
528
|
+
`], { type: "text/html" }));
|
|
529
|
+
}, h = (n) => ({
|
|
530
|
+
label: n.title,
|
|
531
|
+
href: JSON.stringify(n.dest),
|
|
532
|
+
subitems: n.items.length ? n.items.map(h) : null
|
|
533
|
+
}), y = async (n) => {
|
|
534
|
+
var c;
|
|
535
|
+
const p = new Uint8Array(await n.arrayBuffer()), o = await pdfjsLib.getDocument({ data: p }).promise, t = { rendition: { layout: "pre-paginated" } }, i = (c = await o.getMetadata()) == null ? void 0 : c.info;
|
|
536
|
+
t.metadata = {
|
|
537
|
+
title: i == null ? void 0 : i.Title,
|
|
538
|
+
author: i == null ? void 0 : i.Author
|
|
539
|
+
};
|
|
540
|
+
const d = await o.getOutline();
|
|
541
|
+
t.toc = d == null ? void 0 : d.map(h);
|
|
542
|
+
const l = /* @__PURE__ */ new Map();
|
|
543
|
+
return t.sections = Array.from({ length: o.numPages }).map((a, e) => ({
|
|
544
|
+
id: e,
|
|
545
|
+
load: async () => {
|
|
546
|
+
const s = l.get(e);
|
|
547
|
+
if (s)
|
|
548
|
+
return s;
|
|
549
|
+
const r = await u(await o.getPage(e + 1));
|
|
550
|
+
return l.set(e, r), r;
|
|
551
|
+
},
|
|
552
|
+
size: 1e3
|
|
553
|
+
})), t.isExternal = (a) => /^\w+:/i.test(a), t.resolveHref = async (a) => {
|
|
554
|
+
const e = JSON.parse(a), s = typeof e == "string" ? await o.getDestination(e) : e;
|
|
555
|
+
return { index: await o.getPageIndex(s[0]) };
|
|
556
|
+
}, t.splitTOCHref = async (a) => {
|
|
557
|
+
const e = JSON.parse(a), s = typeof e == "string" ? await o.getDestination(e) : e;
|
|
558
|
+
return [await o.getPageIndex(s[0]), null];
|
|
559
|
+
}, t.getTOCFragment = (a) => a.documentElement, t.getCover = async () => u(await o.getPage(1), !0), t;
|
|
560
|
+
};
|
|
561
|
+
export {
|
|
562
|
+
y as makePDF
|
|
563
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var o=document.createElement("style");o.appendChild(document.createTextNode('.reader{position:absolute;top:50px;right:50px;bottom:20px;left:50px}.viewHolder{height:100%;width:100%;position:relative}#viewer{height:100%}.container{overflow:hidden;position:relative;height:100%}.containerExpanded{transform:translate(256px)}.readerArea{position:relative;z-index:1;height:100%;width:100%;background-color:#fff;transition:all .3s ease}.container .titleArea{position:absolute;top:20px;left:50px;right:50px;text-align:center;color:#999;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tocBackground{position:absolute;left:256px;top:0;bottom:0;right:0;z-index:1}.tocArea{position:absolute;left:0;top:0;bottom:0;z-index:0;width:256px;overflow-y:auto;-webkit-overflow-scrolling:touch;background:#f2f2f2;padding:10px 0}.tocArea::-webkit-scrollbar{width:5px;height:5px}.tocArea::-webkit-scrollbar-thumb:vertical{height:5px;background-color:#0000001a;border-radius:.5rem}.tocArea .tocAreaButton{-webkit-user-select:none;user-select:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;border:none;display:block;font-family:sans-serif;width:100%;font-size:.9em;text-align:left;padding:.9em 1em;border-bottom:1px solid #ddd;color:#aaa;box-sizing:border-box;outline:none;cursor:pointer;position:relative}.tocArea .tocAreaButton:hover{background:#0000000d}.tocArea .tocAreaButton:active{background:#0000001a}.tocArea .active{color:#1565c0;border-bottom:2px solid #1565c0}.tocArea .tocAreaButton .expansion{cursor:pointer;transform:translateY(-50%);top:50%;right:12px;position:absolute;width:10px;background-color:#a2a5b4;transition:transform .3s ease-in-out,top .3s ease-in-out}.tocArea .tocAreaButton .expansion:after,.tocArea .tocAreaButton .expansion:before{content:"";position:absolute;width:6px;height:2px;background-color:currentcolor;border-radius:2px;transition:transform .3s ease-in-out,top .3s ease-in-out}.tocArea .tocAreaButton .expansion:before{transform:rotate(-45deg) translate(2.5px)}.tocArea .tocAreaButton .expansion:after{transform:rotate(45deg) translate(-2.5px)}.tocArea .tocAreaButton .open:before{transform:rotate(45deg) translate(2.5px)}.tocArea .tocAreaButton .open:after{transform:rotate(-45deg) translate(-2.5px)}.tocButton{background:none;border:none;width:32px;height:32px;position:absolute;top:10px;left:10px;border-radius:2px;outline:none;cursor:pointer}.tocButtonBar{position:absolute;width:60%;background:#ccc;height:2px;left:50%;margin:-1px -30%;top:50%;transition:all .5s ease}.tocButtonExpanded{background:#f2f2f2}.arrow{outline:none;border:none;background:none;position:absolute;top:50%;margin-top:-32px;font-size:64px;padding:0 10px;color:#e2e2e2;font-family:arial,sans-serif;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;font-weight:400}.arrow:hover{color:#777}.arrow:disabled{cursor:not-allowed;color:#e2e2e2}.prev{left:1px}.next{right:1px}.loadingView{position:absolute;top:50%;left:10%;right:10%;color:#ccc;text-align:center;margin-top:-.5em}')),document.head.appendChild(o)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
+
import { B as o, R, R as r } from "./index-DjYU7mCB.js";
|
|
3
|
+
export {
|
|
4
|
+
o as BookView,
|
|
5
|
+
R as ReactReader,
|
|
6
|
+
r as default
|
|
7
|
+
};
|