@papyrus-sdk/engine-native 0.2.22-beta.8 → 0.2.22-beta.9.epub.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +0 -1
- package/android/src/main/cpp/CMakeLists.txt +0 -137
- package/android/src/main/java/com/papyrus/engine/PapyrusNativeEngineModule.java +35 -305
- package/android/src/main/java/com/papyrus/engine/PapyrusPackage.java +1 -3
- package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerView.java +5 -195
- package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerViewManager.java +1 -20
- package/dist/index.d.mts +4 -608
- package/dist/index.d.ts +4 -608
- package/dist/index.js +8 -463
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -456
- package/dist/index.mjs.map +1 -1
- package/ios/PapyrusEngineStore.h +0 -3
- package/ios/PapyrusEngineStore.m +6 -32
- package/ios/PapyrusNativeEngine.m +5 -684
- package/ios/PapyrusNativeEngine.podspec +15 -0
- package/ios/PapyrusPageView.m +11 -38
- package/package.json +4 -6
- package/react-native.config.js +1 -1
- package/PapyrusNativeEngine.podspec +0 -45
- package/android/src/main/cpp/PapyrusComicArchiveJni.cpp +0 -68
- package/android/src/main/cpp/PapyrusComicArchiveTest.cpp +0 -55
- package/android/src/main/java/com/papyrus/engine/PapyrusComicArchiveNative.java +0 -14
- package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentView.java +0 -491
- package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentViewManager.java +0 -32
- package/android/src/main/java/com/papyrus/engine/PapyrusComicPageLayout.java +0 -38
- package/android/src/main/java/com/papyrus/engine/PapyrusNativeTextModel.java +0 -195
- package/android/src/main/java/com/papyrus/engine/PapyrusSelectionMenuIcon.java +0 -48
- package/android/src/main/java/com/papyrus/engine/PapyrusTextAnnotationModel.java +0 -22
- package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentView.java +0 -661
- package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentViewManager.java +0 -49
- package/android/src/main/java/com/papyrus/engine/PapyrusTextStore.java +0 -43
- package/ios/PapyrusComicDocumentView.h +0 -21
- package/ios/PapyrusComicDocumentView.m +0 -547
- package/ios/PapyrusComicDocumentViewManager.m +0 -23
- package/ios/PapyrusPageRotationRegistry.h +0 -29
- package/ios/PapyrusPageRotationRegistry.m +0 -179
- package/ios/PapyrusPdfDocumentView.h +0 -55
- package/ios/PapyrusPdfDocumentView.m +0 -2338
- package/ios/PapyrusPdfDocumentViewManager.m +0 -61
- package/ios/PapyrusPdfPageTheme.h +0 -15
- package/ios/PapyrusPdfPageTheme.m +0 -218
- package/ios/PapyrusSelectionMenu.h +0 -27
- package/ios/PapyrusTextAnnotationRange.h +0 -2
- package/ios/PapyrusTextAnnotationRange.m +0 -29
- package/ios/PapyrusTextDocumentView.h +0 -32
- package/ios/PapyrusTextDocumentView.m +0 -518
- package/ios/PapyrusTextDocumentViewManager.m +0 -34
- package/ios/PapyrusTextStore.h +0 -13
- package/ios/PapyrusTextStore.m +0 -73
- package/third_party_licenses/BLAKE2-NOTICE.txt +0 -11
- package/third_party_licenses/libarchive-COPYING +0 -65
- package/vendor/libarchive/PapyrusComicArchive.cpp +0 -376
- package/vendor/libarchive/PapyrusComicArchive.h +0 -30
- package/vendor/libarchive/README.papyrus.md +0 -15
- package/vendor/libarchive/android.h +0 -192
- package/vendor/libarchive/config/PapyrusArchiveConfig.h +0 -71
- package/vendor/libarchive/libarchive/CMakeLists.txt +0 -293
- package/vendor/libarchive/libarchive/android_lf.h +0 -36
- package/vendor/libarchive/libarchive/archive.h +0 -1266
- package/vendor/libarchive/libarchive/archive_acl.c +0 -2025
- package/vendor/libarchive/libarchive/archive_acl_private.h +0 -85
- package/vendor/libarchive/libarchive/archive_blake2.h +0 -197
- package/vendor/libarchive/libarchive/archive_blake2_impl.h +0 -161
- package/vendor/libarchive/libarchive/archive_blake2s_ref.c +0 -369
- package/vendor/libarchive/libarchive/archive_blake2sp_ref.c +0 -361
- package/vendor/libarchive/libarchive/archive_check_magic.c +0 -183
- package/vendor/libarchive/libarchive/archive_cmdline.c +0 -211
- package/vendor/libarchive/libarchive/archive_cmdline_private.h +0 -45
- package/vendor/libarchive/libarchive/archive_crc32.h +0 -123
- package/vendor/libarchive/libarchive/archive_cryptor.c +0 -534
- package/vendor/libarchive/libarchive/archive_cryptor_private.h +0 -199
- package/vendor/libarchive/libarchive/archive_digest.c +0 -1584
- package/vendor/libarchive/libarchive/archive_digest_private.h +0 -431
- package/vendor/libarchive/libarchive/archive_disk_acl_darwin.c +0 -558
- package/vendor/libarchive/libarchive/archive_disk_acl_freebsd.c +0 -712
- package/vendor/libarchive/libarchive/archive_disk_acl_linux.c +0 -760
- package/vendor/libarchive/libarchive/archive_disk_acl_sunos.c +0 -824
- package/vendor/libarchive/libarchive/archive_endian.h +0 -234
- package/vendor/libarchive/libarchive/archive_entry.3 +0 -147
- package/vendor/libarchive/libarchive/archive_entry.c +0 -2297
- package/vendor/libarchive/libarchive/archive_entry.h +0 -763
- package/vendor/libarchive/libarchive/archive_entry_acl.3 +0 -458
- package/vendor/libarchive/libarchive/archive_entry_copy_bhfi.c +0 -55
- package/vendor/libarchive/libarchive/archive_entry_copy_stat.c +0 -82
- package/vendor/libarchive/libarchive/archive_entry_link_resolver.c +0 -472
- package/vendor/libarchive/libarchive/archive_entry_linkify.3 +0 -224
- package/vendor/libarchive/libarchive/archive_entry_locale.h +0 -90
- package/vendor/libarchive/libarchive/archive_entry_misc.3 +0 -63
- package/vendor/libarchive/libarchive/archive_entry_paths.3 +0 -153
- package/vendor/libarchive/libarchive/archive_entry_perms.3 +0 -210
- package/vendor/libarchive/libarchive/archive_entry_private.h +0 -205
- package/vendor/libarchive/libarchive/archive_entry_sparse.c +0 -156
- package/vendor/libarchive/libarchive/archive_entry_stat.3 +0 -274
- package/vendor/libarchive/libarchive/archive_entry_stat.c +0 -121
- package/vendor/libarchive/libarchive/archive_entry_strmode.c +0 -69
- package/vendor/libarchive/libarchive/archive_entry_time.3 +0 -127
- package/vendor/libarchive/libarchive/archive_entry_xattr.c +0 -155
- package/vendor/libarchive/libarchive/archive_hmac.c +0 -345
- package/vendor/libarchive/libarchive/archive_hmac_private.h +0 -119
- package/vendor/libarchive/libarchive/archive_integer.h +0 -267
- package/vendor/libarchive/libarchive/archive_match.c +0 -1869
- package/vendor/libarchive/libarchive/archive_openssl_evp_private.h +0 -54
- package/vendor/libarchive/libarchive/archive_openssl_hmac_private.h +0 -54
- package/vendor/libarchive/libarchive/archive_options.c +0 -219
- package/vendor/libarchive/libarchive/archive_options_private.h +0 -49
- package/vendor/libarchive/libarchive/archive_pack_dev.c +0 -330
- package/vendor/libarchive/libarchive/archive_pack_dev.h +0 -49
- package/vendor/libarchive/libarchive/archive_parse_date.c +0 -1173
- package/vendor/libarchive/libarchive/archive_pathmatch.c +0 -480
- package/vendor/libarchive/libarchive/archive_pathmatch.h +0 -50
- package/vendor/libarchive/libarchive/archive_platform.h +0 -213
- package/vendor/libarchive/libarchive/archive_platform_acl.h +0 -53
- package/vendor/libarchive/libarchive/archive_platform_stat.h +0 -45
- package/vendor/libarchive/libarchive/archive_platform_xattr.h +0 -45
- package/vendor/libarchive/libarchive/archive_ppmd7.c +0 -1173
- package/vendor/libarchive/libarchive/archive_ppmd7_private.h +0 -119
- package/vendor/libarchive/libarchive/archive_ppmd8.c +0 -1293
- package/vendor/libarchive/libarchive/archive_ppmd8_private.h +0 -123
- package/vendor/libarchive/libarchive/archive_ppmd_private.h +0 -159
- package/vendor/libarchive/libarchive/archive_private.h +0 -209
- package/vendor/libarchive/libarchive/archive_random.c +0 -274
- package/vendor/libarchive/libarchive/archive_random_private.h +0 -36
- package/vendor/libarchive/libarchive/archive_rb.c +0 -709
- package/vendor/libarchive/libarchive/archive_rb.h +0 -113
- package/vendor/libarchive/libarchive/archive_read.3 +0 -250
- package/vendor/libarchive/libarchive/archive_read.c +0 -1814
- package/vendor/libarchive/libarchive/archive_read_add_passphrase.3 +0 -72
- package/vendor/libarchive/libarchive/archive_read_add_passphrase.c +0 -189
- package/vendor/libarchive/libarchive/archive_read_append_filter.c +0 -209
- package/vendor/libarchive/libarchive/archive_read_data.3 +0 -128
- package/vendor/libarchive/libarchive/archive_read_data_into_fd.c +0 -207
- package/vendor/libarchive/libarchive/archive_read_disk.3 +0 -422
- package/vendor/libarchive/libarchive/archive_read_disk_entry_from_file.c +0 -1086
- package/vendor/libarchive/libarchive/archive_read_disk_posix.c +0 -2639
- package/vendor/libarchive/libarchive/archive_read_disk_private.h +0 -97
- package/vendor/libarchive/libarchive/archive_read_disk_set_standard_lookup.c +0 -315
- package/vendor/libarchive/libarchive/archive_read_disk_windows.c +0 -2603
- package/vendor/libarchive/libarchive/archive_read_extract.3 +0 -135
- package/vendor/libarchive/libarchive/archive_read_extract.c +0 -59
- package/vendor/libarchive/libarchive/archive_read_extract2.c +0 -154
- package/vendor/libarchive/libarchive/archive_read_filter.3 +0 -163
- package/vendor/libarchive/libarchive/archive_read_format.3 +0 -190
- package/vendor/libarchive/libarchive/archive_read_free.3 +0 -91
- package/vendor/libarchive/libarchive/archive_read_header.3 +0 -89
- package/vendor/libarchive/libarchive/archive_read_new.3 +0 -57
- package/vendor/libarchive/libarchive/archive_read_open.3 +0 -247
- package/vendor/libarchive/libarchive/archive_read_open_fd.c +0 -236
- package/vendor/libarchive/libarchive/archive_read_open_file.c +0 -257
- package/vendor/libarchive/libarchive/archive_read_open_filename.c +0 -652
- package/vendor/libarchive/libarchive/archive_read_open_memory.c +0 -188
- package/vendor/libarchive/libarchive/archive_read_private.h +0 -274
- package/vendor/libarchive/libarchive/archive_read_set_format.c +0 -116
- package/vendor/libarchive/libarchive/archive_read_set_options.3 +0 -290
- package/vendor/libarchive/libarchive/archive_read_set_options.c +0 -132
- package/vendor/libarchive/libarchive/archive_read_support_filter_all.c +0 -84
- package/vendor/libarchive/libarchive/archive_read_support_filter_by_code.c +0 -68
- package/vendor/libarchive/libarchive/archive_read_support_filter_bzip2.c +0 -360
- package/vendor/libarchive/libarchive/archive_read_support_filter_compress.c +0 -457
- package/vendor/libarchive/libarchive/archive_read_support_filter_grzip.c +0 -108
- package/vendor/libarchive/libarchive/archive_read_support_filter_gzip.c +0 -538
- package/vendor/libarchive/libarchive/archive_read_support_filter_lrzip.c +0 -119
- package/vendor/libarchive/libarchive/archive_read_support_filter_lz4.c +0 -829
- package/vendor/libarchive/libarchive/archive_read_support_filter_lzop.c +0 -493
- package/vendor/libarchive/libarchive/archive_read_support_filter_none.c +0 -51
- package/vendor/libarchive/libarchive/archive_read_support_filter_program.c +0 -497
- package/vendor/libarchive/libarchive/archive_read_support_filter_rpm.c +0 -249
- package/vendor/libarchive/libarchive/archive_read_support_filter_uu.c +0 -739
- package/vendor/libarchive/libarchive/archive_read_support_filter_xz.c +0 -792
- package/vendor/libarchive/libarchive/archive_read_support_filter_zstd.c +0 -356
- package/vendor/libarchive/libarchive/archive_read_support_format_7zip.c +0 -4650
- package/vendor/libarchive/libarchive/archive_read_support_format_all.c +0 -88
- package/vendor/libarchive/libarchive/archive_read_support_format_ar.c +0 -597
- package/vendor/libarchive/libarchive/archive_read_support_format_by_code.c +0 -76
- package/vendor/libarchive/libarchive/archive_read_support_format_cab.c +0 -3410
- package/vendor/libarchive/libarchive/archive_read_support_format_cpio.c +0 -1152
- package/vendor/libarchive/libarchive/archive_read_support_format_empty.c +0 -95
- package/vendor/libarchive/libarchive/archive_read_support_format_iso9660.c +0 -3516
- package/vendor/libarchive/libarchive/archive_read_support_format_lha.c +0 -2931
- package/vendor/libarchive/libarchive/archive_read_support_format_mtree.c +0 -2113
- package/vendor/libarchive/libarchive/archive_read_support_format_rar.c +0 -3932
- package/vendor/libarchive/libarchive/archive_read_support_format_rar5.c +0 -4501
- package/vendor/libarchive/libarchive/archive_read_support_format_raw.c +0 -194
- package/vendor/libarchive/libarchive/archive_read_support_format_tar.c +0 -3785
- package/vendor/libarchive/libarchive/archive_read_support_format_warc.c +0 -875
- package/vendor/libarchive/libarchive/archive_read_support_format_xar.c +0 -3770
- package/vendor/libarchive/libarchive/archive_read_support_format_zip.c +0 -4710
- package/vendor/libarchive/libarchive/archive_string.c +0 -4391
- package/vendor/libarchive/libarchive/archive_string.h +0 -244
- package/vendor/libarchive/libarchive/archive_string_composition.h +0 -2289
- package/vendor/libarchive/libarchive/archive_string_sprintf.c +0 -200
- package/vendor/libarchive/libarchive/archive_time.c +0 -168
- package/vendor/libarchive/libarchive/archive_time_private.h +0 -47
- package/vendor/libarchive/libarchive/archive_util.3 +0 -239
- package/vendor/libarchive/libarchive/archive_util.c +0 -668
- package/vendor/libarchive/libarchive/archive_version_details.c +0 -516
- package/vendor/libarchive/libarchive/archive_virtual.c +0 -162
- package/vendor/libarchive/libarchive/archive_windows.c +0 -1035
- package/vendor/libarchive/libarchive/archive_windows.h +0 -332
- package/vendor/libarchive/libarchive/archive_write.3 +0 -266
- package/vendor/libarchive/libarchive/archive_write.c +0 -896
- package/vendor/libarchive/libarchive/archive_write_add_filter.c +0 -71
- package/vendor/libarchive/libarchive/archive_write_add_filter_b64encode.c +0 -329
- package/vendor/libarchive/libarchive/archive_write_add_filter_by_name.c +0 -76
- package/vendor/libarchive/libarchive/archive_write_add_filter_bzip2.c +0 -411
- package/vendor/libarchive/libarchive/archive_write_add_filter_compress.c +0 -459
- package/vendor/libarchive/libarchive/archive_write_add_filter_grzip.c +0 -143
- package/vendor/libarchive/libarchive/archive_write_add_filter_gzip.c +0 -493
- package/vendor/libarchive/libarchive/archive_write_add_filter_lrzip.c +0 -214
- package/vendor/libarchive/libarchive/archive_write_add_filter_lz4.c +0 -710
- package/vendor/libarchive/libarchive/archive_write_add_filter_lzop.c +0 -500
- package/vendor/libarchive/libarchive/archive_write_add_filter_none.c +0 -42
- package/vendor/libarchive/libarchive/archive_write_add_filter_program.c +0 -398
- package/vendor/libarchive/libarchive/archive_write_add_filter_uuencode.c +0 -320
- package/vendor/libarchive/libarchive/archive_write_add_filter_xz.c +0 -547
- package/vendor/libarchive/libarchive/archive_write_add_filter_zstd.c +0 -608
- package/vendor/libarchive/libarchive/archive_write_blocksize.3 +0 -112
- package/vendor/libarchive/libarchive/archive_write_data.3 +0 -88
- package/vendor/libarchive/libarchive/archive_write_disk.3 +0 -360
- package/vendor/libarchive/libarchive/archive_write_disk_posix.c +0 -4789
- package/vendor/libarchive/libarchive/archive_write_disk_private.h +0 -43
- package/vendor/libarchive/libarchive/archive_write_disk_set_standard_lookup.c +0 -265
- package/vendor/libarchive/libarchive/archive_write_disk_windows.c +0 -2952
- package/vendor/libarchive/libarchive/archive_write_filter.3 +0 -140
- package/vendor/libarchive/libarchive/archive_write_finish_entry.3 +0 -77
- package/vendor/libarchive/libarchive/archive_write_format.3 +0 -187
- package/vendor/libarchive/libarchive/archive_write_free.3 +0 -94
- package/vendor/libarchive/libarchive/archive_write_header.3 +0 -71
- package/vendor/libarchive/libarchive/archive_write_new.3 +0 -56
- package/vendor/libarchive/libarchive/archive_write_open.3 +0 -270
- package/vendor/libarchive/libarchive/archive_write_open_fd.c +0 -141
- package/vendor/libarchive/libarchive/archive_write_open_file.c +0 -102
- package/vendor/libarchive/libarchive/archive_write_open_filename.c +0 -272
- package/vendor/libarchive/libarchive/archive_write_open_memory.c +0 -110
- package/vendor/libarchive/libarchive/archive_write_private.h +0 -166
- package/vendor/libarchive/libarchive/archive_write_set_format.c +0 -124
- package/vendor/libarchive/libarchive/archive_write_set_format_7zip.c +0 -2571
- package/vendor/libarchive/libarchive/archive_write_set_format_ar.c +0 -540
- package/vendor/libarchive/libarchive/archive_write_set_format_by_name.c +0 -93
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio.c +0 -11
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_binary.c +0 -618
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_newc.c +0 -457
- package/vendor/libarchive/libarchive/archive_write_set_format_cpio_odc.c +0 -508
- package/vendor/libarchive/libarchive/archive_write_set_format_filter_by_ext.c +0 -141
- package/vendor/libarchive/libarchive/archive_write_set_format_gnutar.c +0 -790
- package/vendor/libarchive/libarchive/archive_write_set_format_iso9660.c +0 -8216
- package/vendor/libarchive/libarchive/archive_write_set_format_mtree.c +0 -2307
- package/vendor/libarchive/libarchive/archive_write_set_format_pax.c +0 -2249
- package/vendor/libarchive/libarchive/archive_write_set_format_private.h +0 -40
- package/vendor/libarchive/libarchive/archive_write_set_format_raw.c +0 -123
- package/vendor/libarchive/libarchive/archive_write_set_format_shar.c +0 -650
- package/vendor/libarchive/libarchive/archive_write_set_format_ustar.c +0 -768
- package/vendor/libarchive/libarchive/archive_write_set_format_v7tar.c +0 -648
- package/vendor/libarchive/libarchive/archive_write_set_format_warc.c +0 -491
- package/vendor/libarchive/libarchive/archive_write_set_format_xar.c +0 -3799
- package/vendor/libarchive/libarchive/archive_write_set_format_zip.c +0 -2548
- package/vendor/libarchive/libarchive/archive_write_set_options.3 +0 -779
- package/vendor/libarchive/libarchive/archive_write_set_options.c +0 -129
- package/vendor/libarchive/libarchive/archive_write_set_passphrase.3 +0 -72
- package/vendor/libarchive/libarchive/archive_write_set_passphrase.c +0 -95
- package/vendor/libarchive/libarchive/archive_xxhash.h +0 -48
- package/vendor/libarchive/libarchive/config_freebsd.h +0 -275
- package/vendor/libarchive/libarchive/cpio.5 +0 -389
- package/vendor/libarchive/libarchive/filter_fork.h +0 -44
- package/vendor/libarchive/libarchive/filter_fork_posix.c +0 -269
- package/vendor/libarchive/libarchive/filter_fork_windows.c +0 -270
- package/vendor/libarchive/libarchive/libarchive-formats.5 +0 -478
- package/vendor/libarchive/libarchive/libarchive.3 +0 -297
- package/vendor/libarchive/libarchive/libarchive_changes.3 +0 -339
- package/vendor/libarchive/libarchive/libarchive_internals.3 +0 -363
- package/vendor/libarchive/libarchive/module.modulemap +0 -34
- package/vendor/libarchive/libarchive/mtree.5 +0 -323
- package/vendor/libarchive/libarchive/tar.5 +0 -947
- package/vendor/libarchive/libarchive/xxhash.c +0 -531
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import {
|
|
3
3
|
NativeModules,
|
|
4
4
|
Platform,
|
|
5
|
-
UIManager,
|
|
6
5
|
TurboModuleRegistry,
|
|
7
6
|
requireNativeComponent,
|
|
8
7
|
View
|
|
@@ -70,38 +69,6 @@ var resolvePapyrusNativeModule = (registries) => {
|
|
|
70
69
|
return registries.nativeModules.PapyrusNativeEngine ?? null;
|
|
71
70
|
};
|
|
72
71
|
|
|
73
|
-
// nativeViewAvailability.ts
|
|
74
|
-
var isNativeViewManagerRegistered = (registry, managerName) => {
|
|
75
|
-
if (typeof registry.hasViewManagerConfig !== "function") return false;
|
|
76
|
-
try {
|
|
77
|
-
return registry.hasViewManagerConfig(managerName);
|
|
78
|
-
} catch {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// nativeTextModel.ts
|
|
84
|
-
var clampTextOffset = (offset, textLength) => {
|
|
85
|
-
const max = Math.max(0, Math.floor(Number.isFinite(textLength) ? textLength : 0));
|
|
86
|
-
return Math.max(0, Math.min(max, Math.floor(Number.isFinite(offset) ? offset : 0)));
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
// nativeDocumentRoute.ts
|
|
90
|
-
var resolveNativeMobileDocumentRoute = ({
|
|
91
|
-
type,
|
|
92
|
-
platform,
|
|
93
|
-
nativeModuleAvailable = false,
|
|
94
|
-
nativeViewAvailable = false
|
|
95
|
-
}) => {
|
|
96
|
-
if (type === "pdf") return "native-pdf";
|
|
97
|
-
if (type === "epub") return "webview";
|
|
98
|
-
const supportedMobilePlatform = platform === "ios" || platform === "android";
|
|
99
|
-
if (!supportedMobilePlatform || !nativeModuleAvailable || !nativeViewAvailable) {
|
|
100
|
-
return "webview";
|
|
101
|
-
}
|
|
102
|
-
return type === "text" ? "native-text" : "native-comic";
|
|
103
|
-
};
|
|
104
|
-
|
|
105
72
|
// index.ts
|
|
106
73
|
var MODULE_NAME = "PapyrusNativeEngine";
|
|
107
74
|
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
@@ -183,31 +150,6 @@ var encodeBase64 = (bytes) => {
|
|
|
183
150
|
};
|
|
184
151
|
var isLoadRequest = (input) => typeof input === "object" && input !== null && "source" in input && "type" in input;
|
|
185
152
|
var normalizeLoadInput = (input) => isLoadRequest(input) ? { source: input.source, type: input.type, format: input.format } : { source: input };
|
|
186
|
-
var normalizeNativeSource = async (source, allowPlainText) => {
|
|
187
|
-
if (typeof source === "string") {
|
|
188
|
-
const dataUri = parseDataUri2(source);
|
|
189
|
-
if (dataUri?.isBase64) return { data: decodeBase64(dataUri.data) };
|
|
190
|
-
if (dataUri && allowPlainText) {
|
|
191
|
-
return { text: decodeURIComponent(dataUri.data) };
|
|
192
|
-
}
|
|
193
|
-
if (looksLikeUri(source)) return { uri: source };
|
|
194
|
-
if (!allowPlainText && isLikelyBase64(source)) return { data: decodeBase64(source) };
|
|
195
|
-
return allowPlainText ? { text: source } : { uri: source };
|
|
196
|
-
}
|
|
197
|
-
if (typeof source === "object" && source !== null && "uri" in source) {
|
|
198
|
-
return { uri: source.uri };
|
|
199
|
-
}
|
|
200
|
-
if (typeof source === "object" && source !== null && "data" in source) {
|
|
201
|
-
const data = source.data instanceof Uint8Array ? source.data : new Uint8Array(source.data);
|
|
202
|
-
return { data };
|
|
203
|
-
}
|
|
204
|
-
if (typeof source === "object" && source !== null && typeof source.arrayBuffer === "function") {
|
|
205
|
-
return { data: new Uint8Array(await source.arrayBuffer()) };
|
|
206
|
-
}
|
|
207
|
-
if (source instanceof ArrayBuffer) return { data: new Uint8Array(source) };
|
|
208
|
-
if (source instanceof Uint8Array) return { data: source };
|
|
209
|
-
throw new Error("[Papyrus] Unsupported native document source");
|
|
210
|
-
};
|
|
211
153
|
var normalizeNativeDestination = (dest) => {
|
|
212
154
|
if (!dest) return null;
|
|
213
155
|
if (typeof dest === "string") {
|
|
@@ -247,53 +189,19 @@ var resolvePapyrusPageView = () => {
|
|
|
247
189
|
return View;
|
|
248
190
|
}
|
|
249
191
|
};
|
|
250
|
-
var
|
|
251
|
-
|
|
252
|
-
var unavailablePapyrusPdfDocumentView = () => null;
|
|
253
|
-
var resolvePapyrusPdfDocumentView = () => {
|
|
254
|
-
if (!hasPapyrusPdfDocumentViewManager()) return null;
|
|
192
|
+
var resolvePapyrusPdfViewerView = () => {
|
|
193
|
+
const componentName = Platform.OS === "ios" ? "PapyrusPdfDocumentView" : "PapyrusPdfViewerView";
|
|
255
194
|
try {
|
|
256
195
|
return requireNativeComponent(
|
|
257
|
-
|
|
258
|
-
);
|
|
259
|
-
} catch {
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
var resolvePapyrusAndroidPdfViewerView = () => {
|
|
264
|
-
try {
|
|
265
|
-
return requireNativeComponent(
|
|
266
|
-
"PapyrusPdfViewerView"
|
|
196
|
+
componentName
|
|
267
197
|
);
|
|
268
198
|
} catch {
|
|
269
199
|
return View;
|
|
270
200
|
}
|
|
271
201
|
};
|
|
272
|
-
var papyrusPdfDocumentView = resolvePapyrusPdfDocumentView();
|
|
273
|
-
var isPapyrusPdfDocumentViewAvailable = () => papyrusPdfDocumentView !== null && hasPapyrusPdfDocumentViewManager();
|
|
274
202
|
var PapyrusPageView = resolvePapyrusPageView();
|
|
275
|
-
var PapyrusPdfViewerView =
|
|
203
|
+
var PapyrusPdfViewerView = resolvePapyrusPdfViewerView();
|
|
276
204
|
var PapyrusPdfDocumentView = PapyrusPdfViewerView;
|
|
277
|
-
var PAPYRUS_TEXT_DOCUMENT_VIEW_NAME = "PapyrusTextDocumentView";
|
|
278
|
-
var PAPYRUS_COMIC_DOCUMENT_VIEW_NAME = "PapyrusComicDocumentView";
|
|
279
|
-
var resolveNativeView = (name) => {
|
|
280
|
-
if (!isNativeViewManagerRegistered(UIManager, name)) return null;
|
|
281
|
-
try {
|
|
282
|
-
return requireNativeComponent(name);
|
|
283
|
-
} catch {
|
|
284
|
-
return null;
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
var papyrusTextDocumentView = resolveNativeView(
|
|
288
|
-
PAPYRUS_TEXT_DOCUMENT_VIEW_NAME
|
|
289
|
-
);
|
|
290
|
-
var papyrusComicDocumentView = resolveNativeView(
|
|
291
|
-
PAPYRUS_COMIC_DOCUMENT_VIEW_NAME
|
|
292
|
-
);
|
|
293
|
-
var isPapyrusTextDocumentViewAvailable = () => papyrusTextDocumentView !== null;
|
|
294
|
-
var isPapyrusComicDocumentViewAvailable = () => papyrusComicDocumentView !== null;
|
|
295
|
-
var PapyrusTextDocumentView = papyrusTextDocumentView ?? unavailablePapyrusPdfDocumentView;
|
|
296
|
-
var PapyrusComicDocumentView = papyrusComicDocumentView ?? unavailablePapyrusPdfDocumentView;
|
|
297
205
|
var NativeDocumentEngine = class extends BaseDocumentEngine {
|
|
298
206
|
constructor() {
|
|
299
207
|
super();
|
|
@@ -335,8 +243,6 @@ var NativeDocumentEngine = class extends BaseDocumentEngine {
|
|
|
335
243
|
this.pageCount = 0;
|
|
336
244
|
}
|
|
337
245
|
this.currentPage = 1;
|
|
338
|
-
this.zoom = 1;
|
|
339
|
-
this.rotation = 0;
|
|
340
246
|
}
|
|
341
247
|
getPageCount() {
|
|
342
248
|
return this.pageCount;
|
|
@@ -504,281 +410,9 @@ var NativeDocumentEngine = class extends BaseDocumentEngine {
|
|
|
504
410
|
return null;
|
|
505
411
|
}
|
|
506
412
|
};
|
|
507
|
-
var NativeTextDocumentEngine = class extends BaseDocumentEngine {
|
|
508
|
-
constructor() {
|
|
509
|
-
super(...arguments);
|
|
510
|
-
this.nativeModule = resolveNativeModule();
|
|
511
|
-
this.engineId = this.nativeModule?.createEngine?.() ?? "default";
|
|
512
|
-
this.loadGeneration = 0;
|
|
513
|
-
this.documentGeneration = 0;
|
|
514
|
-
this.textLength = 0;
|
|
515
|
-
this.currentOffset = 0;
|
|
516
|
-
}
|
|
517
|
-
async load(input) {
|
|
518
|
-
const { source, type } = normalizeLoadInput(input);
|
|
519
|
-
if (type && type !== "text") {
|
|
520
|
-
throw new Error("[NativeTextDocumentEngine] Unsupported type: " + type);
|
|
521
|
-
}
|
|
522
|
-
const generation = ++this.loadGeneration;
|
|
523
|
-
if (this.documentGeneration > 0) {
|
|
524
|
-
this.nativeModule?.closeText?.(this.engineId, this.documentGeneration);
|
|
525
|
-
}
|
|
526
|
-
this.documentGeneration = 0;
|
|
527
|
-
this.textLength = 0;
|
|
528
|
-
this.currentOffset = 0;
|
|
529
|
-
const nativeSource = await normalizeNativeSource(source, true);
|
|
530
|
-
if (generation !== this.loadGeneration) return;
|
|
531
|
-
const native = this.assertNativeModule();
|
|
532
|
-
if (!native.loadText) {
|
|
533
|
-
throw new Error("[Papyrus] Native TXT loading is not available");
|
|
534
|
-
}
|
|
535
|
-
const result = await native.loadText(
|
|
536
|
-
this.engineId,
|
|
537
|
-
generation,
|
|
538
|
-
nativeSource
|
|
539
|
-
);
|
|
540
|
-
if (generation !== this.loadGeneration) {
|
|
541
|
-
native.closeText?.(this.engineId, generation);
|
|
542
|
-
return;
|
|
543
|
-
}
|
|
544
|
-
this.documentGeneration = generation;
|
|
545
|
-
this.textLength = Math.max(0, Math.floor(result.textLength));
|
|
546
|
-
this.currentOffset = 0;
|
|
547
|
-
}
|
|
548
|
-
getNativeTextEngineId() {
|
|
549
|
-
return this.engineId;
|
|
550
|
-
}
|
|
551
|
-
getDocumentGeneration() {
|
|
552
|
-
return this.documentGeneration;
|
|
553
|
-
}
|
|
554
|
-
getTextLength() {
|
|
555
|
-
return this.textLength;
|
|
556
|
-
}
|
|
557
|
-
getCurrentTextOffset() {
|
|
558
|
-
return this.currentOffset;
|
|
559
|
-
}
|
|
560
|
-
goToTextOffset(offset) {
|
|
561
|
-
this.currentOffset = clampTextOffset(offset, this.textLength);
|
|
562
|
-
}
|
|
563
|
-
async resolveAnnotationTextRange(annotation) {
|
|
564
|
-
if (annotation.anchor?.kind !== "text-range") return annotation.textRange ?? null;
|
|
565
|
-
const generation = this.documentGeneration;
|
|
566
|
-
const range = await this.assertNativeModule().resolveTextAnnotationRange?.(this.engineId, generation, annotation.anchor);
|
|
567
|
-
return generation === this.documentGeneration ? range ?? null : null;
|
|
568
|
-
}
|
|
569
|
-
async getTextRange(start, end) {
|
|
570
|
-
const native = this.assertNativeModule();
|
|
571
|
-
if (!native.getTextRange) return "";
|
|
572
|
-
return native.getTextRange(
|
|
573
|
-
this.engineId,
|
|
574
|
-
this.documentGeneration,
|
|
575
|
-
clampTextOffset(start, this.textLength),
|
|
576
|
-
clampTextOffset(end, this.textLength)
|
|
577
|
-
);
|
|
578
|
-
}
|
|
579
|
-
async searchTextRanges(query) {
|
|
580
|
-
const native = this.assertNativeModule();
|
|
581
|
-
if (!native.searchTextRanges) return [];
|
|
582
|
-
return native.searchTextRanges(this.engineId, this.documentGeneration, query);
|
|
583
|
-
}
|
|
584
|
-
getRenderTargetType() {
|
|
585
|
-
return "native-text";
|
|
586
|
-
}
|
|
587
|
-
getPageCount() {
|
|
588
|
-
return 0;
|
|
589
|
-
}
|
|
590
|
-
getCurrentPage() {
|
|
591
|
-
return 1;
|
|
592
|
-
}
|
|
593
|
-
goToPage(page) {
|
|
594
|
-
}
|
|
595
|
-
setZoom(zoom) {
|
|
596
|
-
}
|
|
597
|
-
getZoom() {
|
|
598
|
-
return 1;
|
|
599
|
-
}
|
|
600
|
-
rotate(direction) {
|
|
601
|
-
}
|
|
602
|
-
getRotation() {
|
|
603
|
-
return 0;
|
|
604
|
-
}
|
|
605
|
-
async renderPage() {
|
|
606
|
-
}
|
|
607
|
-
async renderTextLayer() {
|
|
608
|
-
}
|
|
609
|
-
async getTextContent() {
|
|
610
|
-
return [];
|
|
611
|
-
}
|
|
612
|
-
async getPageDimensions() {
|
|
613
|
-
return { width: 0, height: 0 };
|
|
614
|
-
}
|
|
615
|
-
async selectText() {
|
|
616
|
-
return null;
|
|
617
|
-
}
|
|
618
|
-
async getOutline() {
|
|
619
|
-
return [];
|
|
620
|
-
}
|
|
621
|
-
async getPageIndex() {
|
|
622
|
-
return null;
|
|
623
|
-
}
|
|
624
|
-
destroy() {
|
|
625
|
-
this.loadGeneration += 1;
|
|
626
|
-
const engineId = this.engineId;
|
|
627
|
-
if (this.documentGeneration > 0) {
|
|
628
|
-
this.nativeModule?.closeText?.(engineId, this.documentGeneration);
|
|
629
|
-
}
|
|
630
|
-
this.nativeModule?.destroyEngine?.(engineId);
|
|
631
|
-
this.engineId = "default";
|
|
632
|
-
this.textLength = 0;
|
|
633
|
-
this.currentOffset = 0;
|
|
634
|
-
this.documentGeneration = 0;
|
|
635
|
-
}
|
|
636
|
-
assertNativeModule() {
|
|
637
|
-
if (!this.nativeModule) this.nativeModule = resolveNativeModule();
|
|
638
|
-
if (!this.nativeModule) {
|
|
639
|
-
throw new Error('[Papyrus] Native module "PapyrusNativeEngine" not found. Use a dev client or native build.');
|
|
640
|
-
}
|
|
641
|
-
if (this.engineId === "default" && this.nativeModule.createEngine) {
|
|
642
|
-
this.engineId = this.nativeModule.createEngine();
|
|
643
|
-
}
|
|
644
|
-
return this.nativeModule;
|
|
645
|
-
}
|
|
646
|
-
};
|
|
647
|
-
var NativeComicDocumentEngine = class extends BaseDocumentEngine {
|
|
648
|
-
constructor() {
|
|
649
|
-
super(...arguments);
|
|
650
|
-
this.nativeModule = resolveNativeModule();
|
|
651
|
-
this.engineId = this.nativeModule?.createEngine?.() ?? "default";
|
|
652
|
-
this.loadGeneration = 0;
|
|
653
|
-
this.documentGeneration = 0;
|
|
654
|
-
this.pageCount = 0;
|
|
655
|
-
this.currentPage = 1;
|
|
656
|
-
this.zoom = 1;
|
|
657
|
-
this.format = "cbz";
|
|
658
|
-
}
|
|
659
|
-
async load(input) {
|
|
660
|
-
const { source, type, format } = normalizeLoadInput(input);
|
|
661
|
-
if (type && type !== "comic") {
|
|
662
|
-
throw new Error("[NativeComicDocumentEngine] Unsupported type: " + type);
|
|
663
|
-
}
|
|
664
|
-
const generation = ++this.loadGeneration;
|
|
665
|
-
if (this.documentGeneration > 0) {
|
|
666
|
-
this.nativeModule?.closeComic?.(this.engineId, this.documentGeneration);
|
|
667
|
-
}
|
|
668
|
-
this.documentGeneration = 0;
|
|
669
|
-
this.pageCount = 0;
|
|
670
|
-
this.currentPage = 1;
|
|
671
|
-
this.zoom = 1;
|
|
672
|
-
const nativeSource = await normalizeNativeSource(source, false);
|
|
673
|
-
if (generation !== this.loadGeneration) return;
|
|
674
|
-
const native = this.assertNativeModule();
|
|
675
|
-
if (!native.loadComic) {
|
|
676
|
-
throw new Error("[Papyrus] Native comic archive loading is not available");
|
|
677
|
-
}
|
|
678
|
-
const engineId = this.engineId;
|
|
679
|
-
this.format = resolveComicFormat(source, format);
|
|
680
|
-
const result = await native.loadComic(
|
|
681
|
-
engineId,
|
|
682
|
-
generation,
|
|
683
|
-
nativeSource,
|
|
684
|
-
this.format
|
|
685
|
-
);
|
|
686
|
-
if (generation !== this.loadGeneration) {
|
|
687
|
-
native.closeComic?.(engineId, generation);
|
|
688
|
-
return;
|
|
689
|
-
}
|
|
690
|
-
this.documentGeneration = generation;
|
|
691
|
-
this.pageCount = Math.max(0, Math.floor(result.pageCount));
|
|
692
|
-
this.currentPage = 1;
|
|
693
|
-
}
|
|
694
|
-
getNativeComicEngineId() {
|
|
695
|
-
return this.engineId;
|
|
696
|
-
}
|
|
697
|
-
getDocumentGeneration() {
|
|
698
|
-
return this.documentGeneration;
|
|
699
|
-
}
|
|
700
|
-
getComicFormat() {
|
|
701
|
-
return this.format;
|
|
702
|
-
}
|
|
703
|
-
getPageCount() {
|
|
704
|
-
return this.pageCount;
|
|
705
|
-
}
|
|
706
|
-
getCurrentPage() {
|
|
707
|
-
return this.currentPage;
|
|
708
|
-
}
|
|
709
|
-
goToPage(page) {
|
|
710
|
-
if (page >= 1 && page <= this.pageCount) this.currentPage = page;
|
|
711
|
-
}
|
|
712
|
-
getRenderTargetType() {
|
|
713
|
-
return "native-comic";
|
|
714
|
-
}
|
|
715
|
-
async getPagePreview(pageIndex) {
|
|
716
|
-
const native = this.assertNativeModule();
|
|
717
|
-
return await native.getComicPagePreview?.(
|
|
718
|
-
this.engineId,
|
|
719
|
-
this.documentGeneration,
|
|
720
|
-
pageIndex,
|
|
721
|
-
1024
|
|
722
|
-
) ?? null;
|
|
723
|
-
}
|
|
724
|
-
setZoom(zoom) {
|
|
725
|
-
this.zoom = Math.max(1, Math.min(5, zoom));
|
|
726
|
-
}
|
|
727
|
-
getZoom() {
|
|
728
|
-
return this.zoom;
|
|
729
|
-
}
|
|
730
|
-
rotate(direction) {
|
|
731
|
-
}
|
|
732
|
-
getRotation() {
|
|
733
|
-
return 0;
|
|
734
|
-
}
|
|
735
|
-
async renderPage() {
|
|
736
|
-
}
|
|
737
|
-
async renderTextLayer() {
|
|
738
|
-
}
|
|
739
|
-
async getTextContent() {
|
|
740
|
-
return [];
|
|
741
|
-
}
|
|
742
|
-
async getPageDimensions() {
|
|
743
|
-
return { width: 0, height: 0 };
|
|
744
|
-
}
|
|
745
|
-
async selectText() {
|
|
746
|
-
return null;
|
|
747
|
-
}
|
|
748
|
-
async getOutline() {
|
|
749
|
-
return [];
|
|
750
|
-
}
|
|
751
|
-
async getPageIndex() {
|
|
752
|
-
return null;
|
|
753
|
-
}
|
|
754
|
-
destroy() {
|
|
755
|
-
this.loadGeneration += 1;
|
|
756
|
-
const engineId = this.engineId;
|
|
757
|
-
if (this.documentGeneration > 0) {
|
|
758
|
-
this.nativeModule?.closeComic?.(engineId, this.documentGeneration);
|
|
759
|
-
}
|
|
760
|
-
this.nativeModule?.destroyEngine?.(engineId);
|
|
761
|
-
this.engineId = "default";
|
|
762
|
-
this.documentGeneration = 0;
|
|
763
|
-
this.pageCount = 0;
|
|
764
|
-
this.currentPage = 1;
|
|
765
|
-
this.zoom = 1;
|
|
766
|
-
}
|
|
767
|
-
assertNativeModule() {
|
|
768
|
-
if (!this.nativeModule) this.nativeModule = resolveNativeModule();
|
|
769
|
-
if (!this.nativeModule) {
|
|
770
|
-
throw new Error('[Papyrus] Native module "PapyrusNativeEngine" not found. Use a dev client or native build.');
|
|
771
|
-
}
|
|
772
|
-
if (this.engineId === "default" && this.nativeModule.createEngine) {
|
|
773
|
-
this.engineId = this.nativeModule.createEngine();
|
|
774
|
-
}
|
|
775
|
-
return this.nativeModule;
|
|
776
|
-
}
|
|
777
|
-
};
|
|
778
413
|
var WebViewDocumentEngine = class extends BaseDocumentEngine {
|
|
779
414
|
constructor(options = {}) {
|
|
780
415
|
super();
|
|
781
|
-
this.documentSessionId = "";
|
|
782
416
|
this.bridge = null;
|
|
783
417
|
this.ready = false;
|
|
784
418
|
this.requestId = 0;
|
|
@@ -793,17 +427,6 @@ var WebViewDocumentEngine = class extends BaseDocumentEngine {
|
|
|
793
427
|
this.webViewRuntimeSource = options.webViewRuntimeSource;
|
|
794
428
|
this.webViewRuntimeConfig = options.webViewRuntimeConfig;
|
|
795
429
|
}
|
|
796
|
-
getWebViewDocumentSessionId() {
|
|
797
|
-
return this.documentSessionId;
|
|
798
|
-
}
|
|
799
|
-
async syncEpubAnnotations(annotations, documentId, labels) {
|
|
800
|
-
if (!this.documentSessionId) return;
|
|
801
|
-
await this.request("epub-annotations", { documentSessionId: this.documentSessionId, annotations, documentId, labels });
|
|
802
|
-
}
|
|
803
|
-
async goToAnnotation(annotation) {
|
|
804
|
-
if (annotation.anchor?.kind !== "epub-cfi") return;
|
|
805
|
-
await this.request("epub-annotation-navigate", { documentSessionId: this.documentSessionId, annotationId: annotation.id });
|
|
806
|
-
}
|
|
807
430
|
getWebViewRuntimeSource() {
|
|
808
431
|
return this.webViewRuntimeSource;
|
|
809
432
|
}
|
|
@@ -990,20 +613,15 @@ var WebViewDocumentEngine = class extends BaseDocumentEngine {
|
|
|
990
613
|
"[WebViewDocumentEngine] Use o NativeDocumentEngine para PDFs no mobile."
|
|
991
614
|
);
|
|
992
615
|
}
|
|
993
|
-
const session = `epub-${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
994
|
-
this.documentSessionId = session;
|
|
995
616
|
const payloadSource = await this.normalizeRuntimeSource(
|
|
996
617
|
resolvedType,
|
|
997
618
|
source
|
|
998
619
|
);
|
|
999
|
-
if (session !== this.documentSessionId) throw new Error("Stale document load");
|
|
1000
620
|
const response = await this.request("load", {
|
|
1001
621
|
type: resolvedType,
|
|
1002
|
-
documentSessionId: session,
|
|
1003
622
|
source: payloadSource,
|
|
1004
623
|
...resolvedType === "comic" ? { format: resolveComicFormat(source, format) } : {}
|
|
1005
624
|
});
|
|
1006
|
-
if (session !== this.documentSessionId) throw new Error("Stale document load");
|
|
1007
625
|
if (typeof response?.pageCount === "number")
|
|
1008
626
|
this.pageCount = response.pageCount;
|
|
1009
627
|
if (Array.isArray(response?.outline)) this.outline = response.outline;
|
|
@@ -1267,10 +885,7 @@ var WebViewDocumentEngine = class extends BaseDocumentEngine {
|
|
|
1267
885
|
var MobileDocumentEngine = class extends BaseDocumentEngine {
|
|
1268
886
|
constructor(options = {}) {
|
|
1269
887
|
super();
|
|
1270
|
-
this.loadGeneration = 0;
|
|
1271
888
|
this.pdfEngine = new NativeDocumentEngine();
|
|
1272
|
-
this.textEngine = new NativeTextDocumentEngine();
|
|
1273
|
-
this.comicEngine = new NativeComicDocumentEngine();
|
|
1274
889
|
this.webEngine = new WebViewDocumentEngine(options);
|
|
1275
890
|
this.activeEngine = this.pdfEngine;
|
|
1276
891
|
}
|
|
@@ -1286,47 +901,12 @@ var MobileDocumentEngine = class extends BaseDocumentEngine {
|
|
|
1286
901
|
getNativeEngineId() {
|
|
1287
902
|
return this.activeEngine === this.pdfEngine ? this.pdfEngine.getNativeEngineId() : null;
|
|
1288
903
|
}
|
|
1289
|
-
getNativeTextEngineId() {
|
|
1290
|
-
return this.activeEngine === this.textEngine ? this.textEngine.getNativeTextEngineId() : null;
|
|
1291
|
-
}
|
|
1292
|
-
getNativeTextDocumentGeneration() {
|
|
1293
|
-
return this.activeEngine === this.textEngine ? this.textEngine.getDocumentGeneration() : 0;
|
|
1294
|
-
}
|
|
1295
|
-
getNativeComicEngineId() {
|
|
1296
|
-
return this.activeEngine === this.comicEngine ? this.comicEngine.getNativeComicEngineId() : null;
|
|
1297
|
-
}
|
|
1298
|
-
getNativeComicDocumentGeneration() {
|
|
1299
|
-
return this.activeEngine === this.comicEngine ? this.comicEngine.getDocumentGeneration() : 0;
|
|
1300
|
-
}
|
|
1301
|
-
getTextLength() {
|
|
1302
|
-
return this.activeEngine.getTextLength?.() ?? 0;
|
|
1303
|
-
}
|
|
1304
|
-
getCurrentTextOffset() {
|
|
1305
|
-
return this.activeEngine.getCurrentTextOffset?.() ?? 0;
|
|
1306
|
-
}
|
|
1307
|
-
goToTextOffset(offset) {
|
|
1308
|
-
this.activeEngine.goToTextOffset?.(offset);
|
|
1309
|
-
}
|
|
1310
904
|
getLifecycleStats() {
|
|
1311
905
|
return {
|
|
1312
906
|
...this.pdfEngine.getLifecycleStats(),
|
|
1313
907
|
...this.webEngine.getLifecycleStats()
|
|
1314
908
|
};
|
|
1315
909
|
}
|
|
1316
|
-
resolveAnnotationTextRange(annotation) {
|
|
1317
|
-
return this.textEngine.resolveAnnotationTextRange(annotation);
|
|
1318
|
-
}
|
|
1319
|
-
getWebViewDocumentSessionId() {
|
|
1320
|
-
return this.webEngine.getWebViewDocumentSessionId();
|
|
1321
|
-
}
|
|
1322
|
-
syncEpubAnnotations(annotations, documentId, labels) {
|
|
1323
|
-
return this.webEngine.syncEpubAnnotations(annotations, documentId, labels);
|
|
1324
|
-
}
|
|
1325
|
-
goToAnnotation(annotation) {
|
|
1326
|
-
if (annotation.anchor?.kind === "epub-cfi") return this.webEngine.goToAnnotation(annotation);
|
|
1327
|
-
if (annotation.anchor?.kind === "text-range") return this.textEngine.goToTextOffset(annotation.anchor.start);
|
|
1328
|
-
this.activeEngine.goToPage((annotation.anchor?.kind === "pdf-geometry" ? annotation.anchor.pageIndex : annotation.pageIndex) + 1);
|
|
1329
|
-
}
|
|
1330
910
|
attachWebView(bridge) {
|
|
1331
911
|
this.webEngine.attachBridge(bridge);
|
|
1332
912
|
}
|
|
@@ -1339,25 +919,12 @@ var MobileDocumentEngine = class extends BaseDocumentEngine {
|
|
|
1339
919
|
async load(input) {
|
|
1340
920
|
const { source, type, format } = normalizeLoadInput(input);
|
|
1341
921
|
const resolvedType = type ?? inferDocumentType(source);
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
type: resolvedType,
|
|
1345
|
-
format: resolvedType === "comic" ? resolveComicFormat(source, format) : void 0,
|
|
1346
|
-
platform: Platform.OS,
|
|
1347
|
-
nativeModuleAvailable: resolveNativeModule() !== null,
|
|
1348
|
-
nativeViewAvailable: resolvedType === "text" ? isPapyrusTextDocumentViewAvailable() : resolvedType === "comic" ? isPapyrusComicDocumentViewAvailable() : true
|
|
1349
|
-
});
|
|
1350
|
-
const nextEngine = route === "native-pdf" ? this.pdfEngine : route === "native-text" ? this.textEngine : route === "native-comic" ? this.comicEngine : this.webEngine;
|
|
1351
|
-
if (this.activeEngine !== nextEngine) this.activeEngine.destroy();
|
|
1352
|
-
this.activeEngine = nextEngine;
|
|
1353
|
-
await nextEngine.load({
|
|
922
|
+
this.activeEngine = resolvedType === "pdf" ? this.pdfEngine : this.webEngine;
|
|
923
|
+
await this.activeEngine.load({
|
|
1354
924
|
type: resolvedType,
|
|
1355
925
|
source,
|
|
1356
926
|
...resolvedType === "comic" && format ? { format } : {}
|
|
1357
927
|
});
|
|
1358
|
-
if (generation !== this.loadGeneration && this.activeEngine !== nextEngine) {
|
|
1359
|
-
return;
|
|
1360
|
-
}
|
|
1361
928
|
}
|
|
1362
929
|
getPageCount() {
|
|
1363
930
|
return this.activeEngine.getPageCount();
|
|
@@ -1402,12 +969,6 @@ var MobileDocumentEngine = class extends BaseDocumentEngine {
|
|
|
1402
969
|
}
|
|
1403
970
|
return [];
|
|
1404
971
|
}
|
|
1405
|
-
async searchTextRanges(query) {
|
|
1406
|
-
if (typeof this.activeEngine.searchTextRanges === "function") {
|
|
1407
|
-
return await this.activeEngine.searchTextRanges(query);
|
|
1408
|
-
}
|
|
1409
|
-
return [];
|
|
1410
|
-
}
|
|
1411
972
|
async selectText(pageIndex, rect, endpoints) {
|
|
1412
973
|
if (typeof this.activeEngine.selectText === "function") {
|
|
1413
974
|
return await this.activeEngine.selectText(pageIndex, rect, endpoints);
|
|
@@ -1421,27 +982,17 @@ var MobileDocumentEngine = class extends BaseDocumentEngine {
|
|
|
1421
982
|
return await this.activeEngine.getPageIndex(dest);
|
|
1422
983
|
}
|
|
1423
984
|
destroy() {
|
|
1424
|
-
this.loadGeneration += 1;
|
|
1425
985
|
this.pdfEngine.destroy();
|
|
1426
|
-
this.textEngine.destroy();
|
|
1427
|
-
this.comicEngine.destroy();
|
|
1428
986
|
this.webEngine.destroy();
|
|
1429
987
|
}
|
|
1430
988
|
};
|
|
1431
989
|
export {
|
|
1432
990
|
MobileDocumentEngine,
|
|
1433
|
-
NativeComicDocumentEngine,
|
|
1434
991
|
NativeDocumentEngine,
|
|
1435
|
-
NativeTextDocumentEngine,
|
|
1436
|
-
PapyrusComicDocumentView,
|
|
1437
992
|
PapyrusPageView,
|
|
1438
993
|
PapyrusPdfDocumentView,
|
|
1439
994
|
PapyrusPdfViewerView,
|
|
1440
|
-
PapyrusTextDocumentView,
|
|
1441
995
|
WebViewDocumentEngine,
|
|
1442
|
-
|
|
1443
|
-
isPapyrusPdfDocumentViewAvailable,
|
|
1444
|
-
isPapyrusTablet,
|
|
1445
|
-
isPapyrusTextDocumentViewAvailable
|
|
996
|
+
isPapyrusTablet
|
|
1446
997
|
};
|
|
1447
998
|
//# sourceMappingURL=index.mjs.map
|