react-native-inapp-inspector 2.3.19 → 2.3.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -14
- package/android/src/main/java/com/inappinspector/NetworkInspectorModule.kt +67 -0
- package/dist/commonjs/analytics.js +1 -24
- package/dist/commonjs/bundle.js +1 -16
- package/dist/commonjs/capture.js +1 -35
- package/dist/commonjs/components/AnalyticsDetail.js +92 -623
- package/dist/commonjs/components/AnalyticsEventCard.js +54 -350
- package/dist/commonjs/components/AnalyticsGraph.js +70 -370
- package/dist/commonjs/components/AnimatedEntrance.js +1 -11
- package/dist/commonjs/components/AppHeaderLogo.js +7 -134
- package/dist/commonjs/components/BrandCircleIcon.js +73 -118
- package/dist/commonjs/components/BrandSquareIcon.js +63 -108
- package/dist/commonjs/components/CodeSnippet.js +48 -623
- package/dist/commonjs/components/ConsoleLogCard.js +63 -537
- package/dist/commonjs/components/CopyButton.js +3 -89
- package/dist/commonjs/components/DiffViewer.js +19 -83
- package/dist/commonjs/components/DomainHeader.js +27 -127
- package/dist/commonjs/components/EmptyState.js +10 -87
- package/dist/commonjs/components/EndOfListFooter.js +7 -81
- package/dist/commonjs/components/ErrorBoundary.js +72 -566
- package/dist/commonjs/components/HeadersSection.js +31 -110
- package/dist/commonjs/components/HighlightText.js +17 -58
- package/dist/commonjs/components/Inspector/AboutModal.d.ts +6 -0
- package/dist/commonjs/components/Inspector/AboutModal.js +243 -0
- package/dist/commonjs/components/Inspector/AnalyticsFilterModal.js +98 -797
- package/dist/commonjs/components/Inspector/AnalyticsTab.js +284 -930
- package/dist/commonjs/components/Inspector/BundleTab.js +551 -2918
- package/dist/commonjs/components/Inspector/ConsoleTab.js +79 -492
- package/dist/commonjs/components/Inspector/CrashDetail.js +123 -672
- package/dist/commonjs/components/Inspector/CrashFilterModal.js +66 -498
- package/dist/commonjs/components/Inspector/CrashTab.js +98 -670
- package/dist/commonjs/components/Inspector/DebuggingTab.js +74 -875
- package/dist/commonjs/components/Inspector/DeviceInfoTab.js +143 -907
- package/dist/commonjs/components/Inspector/FabLauncher.js +42 -466
- package/dist/commonjs/components/Inspector/FeatureUnderDevNotice.js +6 -99
- package/dist/commonjs/components/Inspector/InspectorContext.js +1 -21
- package/dist/commonjs/components/Inspector/InspectorHeader.js +191 -1110
- package/dist/commonjs/components/Inspector/LogDetail.js +168 -994
- package/dist/commonjs/components/Inspector/MainScreen.js +52 -335
- package/dist/commonjs/components/Inspector/MediaGalleryTab.js +97 -644
- package/dist/commonjs/components/Inspector/MediaPreviewModal.js +90 -605
- package/dist/commonjs/components/Inspector/NavigationTracker.js +1 -12
- package/dist/commonjs/components/Inspector/NetworkDetail.js +89 -411
- package/dist/commonjs/components/Inspector/NetworkFilterModal.js +60 -576
- package/dist/commonjs/components/Inspector/NetworkTab.js +84 -514
- package/dist/commonjs/components/Inspector/NpmStarPrompt.js +18 -434
- package/dist/commonjs/components/Inspector/NpmUpdateToast.js +25 -298
- package/dist/commonjs/components/Inspector/PerformanceTab.js +182 -1397
- package/dist/commonjs/components/Inspector/ReduxDetail.js +188 -1089
- package/dist/commonjs/components/Inspector/ReduxTab.js +85 -701
- package/dist/commonjs/components/Inspector/SettingsPanel.js +427 -3807
- package/dist/commonjs/components/Inspector/SkeletonPlaceholder.js +11 -180
- package/dist/commonjs/components/Inspector/StorageTab.js +93 -826
- package/dist/commonjs/components/Inspector/TabBar.js +36 -334
- package/dist/commonjs/components/Inspector/UpdateAvailableModal.js +37 -412
- package/dist/commonjs/components/JsonViewer.js +168 -381
- package/dist/commonjs/components/LogCard.js +57 -567
- package/dist/commonjs/components/LogSyntaxHighlighter.js +11 -130
- package/dist/commonjs/components/MetaAccordion.js +69 -238
- package/dist/commonjs/components/MiniBarChart.js +3 -56
- package/dist/commonjs/components/MiniLineChart.js +3 -58
- package/dist/commonjs/components/NetworkIcons.d.ts +13 -0
- package/dist/commonjs/components/NetworkIcons.js +521 -1022
- package/dist/commonjs/components/QRCodeView.js +5 -79
- package/dist/commonjs/components/SectionHeader.js +15 -37
- package/dist/commonjs/components/SegmentedTabs.js +7 -62
- package/dist/commonjs/components/SkeletonPlaceholder.js +11 -180
- package/dist/commonjs/components/Slider.js +15 -243
- package/dist/commonjs/components/SourcePageCard.js +30 -89
- package/dist/commonjs/components/Toast.js +5 -147
- package/dist/commonjs/components/TouchableScale.js +3 -24
- package/dist/commonjs/components/TreeNode.js +55 -130
- package/dist/commonjs/console.js +1 -16
- package/dist/commonjs/constants/index.js +1 -32
- package/dist/commonjs/constants/telemetryConfig.js +1 -6
- package/dist/commonjs/constants/version.d.ts +1 -1
- package/dist/commonjs/constants/version.js +1 -4
- package/dist/commonjs/crash.js +1 -23
- package/dist/commonjs/customHooks/analyticsLogger.js +1 -250
- package/dist/commonjs/customHooks/bundleAnalyzer.js +1 -957
- package/dist/commonjs/customHooks/consoleLogger.js +6 -445
- package/dist/commonjs/customHooks/crashHandler.js +7 -656
- package/dist/commonjs/customHooks/logFilters.js +1 -23
- package/dist/commonjs/customHooks/networkLogger.js +2 -536
- package/dist/commonjs/customHooks/performanceTracker.js +63 -750
- package/dist/commonjs/customHooks/reduxLogger.js +2 -313
- package/dist/commonjs/customHooks/storageInspector.js +1 -435
- package/dist/commonjs/customHooks/useAccordion.js +1 -18
- package/dist/commonjs/decorators/index.js +1 -100
- package/dist/commonjs/helpers/gaAnalyticsRegistry.js +1 -148
- package/dist/commonjs/helpers/index.d.ts +1 -0
- package/dist/commonjs/helpers/index.js +8 -921
- package/dist/commonjs/helpers/memoryManager.js +1 -99
- package/dist/commonjs/helpers/qrGenerator.js +1 -367
- package/dist/commonjs/helpers/remoteConfig.js +1 -165
- package/dist/commonjs/helpers/searchQueryParser.js +1 -62
- package/dist/commonjs/helpers/settingsStore.js +1 -144
- package/dist/commonjs/helpers/telemetry.js +1 -501
- package/dist/commonjs/helpers/toast.js +1 -20
- package/dist/commonjs/i18n/index.js +1 -90
- package/dist/commonjs/i18n/locales/en.json +1 -1140
- package/dist/commonjs/index.js +5 -2168
- package/dist/commonjs/metro.js +6 -468
- package/dist/commonjs/native/NativeInspector.d.ts +1 -0
- package/dist/commonjs/native/NativeInspector.js +1 -415
- package/dist/commonjs/native/NativeNetworkInspector.js +1 -4
- package/dist/commonjs/network.js +1 -13
- package/dist/commonjs/performance.js +1 -29
- package/dist/commonjs/redux.js +1 -20
- package/dist/commonjs/storage.js +1 -14
- package/dist/commonjs/styles/AppColors.js +1 -423
- package/dist/commonjs/styles/AppFonts.js +1 -17
- package/dist/commonjs/styles/common.js +1 -190
- package/dist/commonjs/styles/index.d.ts +6 -0
- package/dist/commonjs/styles/index.js +1 -1589
- package/dist/commonjs/types/enums.d.ts +0 -1
- package/dist/commonjs/types/enums.js +1 -152
- package/dist/commonjs/types/index.js +1 -18
- package/dist/commonjs/types/interfaces.d.ts +2 -2
- package/dist/commonjs/types/interfaces.js +1 -2
- package/dist/esm/analytics.js +1 -2
- package/dist/esm/bundle.js +1 -2
- package/dist/esm/capture.js +1 -32
- package/dist/esm/components/AnalyticsDetail.js +171 -664
- package/dist/esm/components/AnalyticsEventCard.js +77 -335
- package/dist/esm/components/AnalyticsGraph.js +95 -357
- package/dist/esm/components/AnimatedEntrance.js +1 -6
- package/dist/esm/components/AppHeaderLogo.js +7 -94
- package/dist/esm/components/BrandCircleIcon.js +114 -119
- package/dist/esm/components/BrandSquareIcon.js +73 -78
- package/dist/esm/components/CodeSnippet.js +58 -595
- package/dist/esm/components/ConsoleLogCard.js +91 -526
- package/dist/esm/components/CopyButton.js +3 -51
- package/dist/esm/components/DiffViewer.js +22 -48
- package/dist/esm/components/DomainHeader.js +43 -138
- package/dist/esm/components/EmptyState.js +17 -56
- package/dist/esm/components/EndOfListFooter.js +15 -83
- package/dist/esm/components/ErrorBoundary.js +125 -582
- package/dist/esm/components/HeadersSection.js +52 -93
- package/dist/esm/components/HighlightText.js +17 -53
- package/dist/esm/components/Inspector/AboutModal.d.ts +6 -0
- package/dist/esm/components/Inspector/AboutModal.js +243 -0
- package/dist/esm/components/Inspector/AnalyticsFilterModal.js +225 -886
- package/dist/esm/components/Inspector/AnalyticsTab.js +296 -904
- package/dist/esm/components/Inspector/BundleTab.js +1175 -3502
- package/dist/esm/components/Inspector/ConsoleTab.js +113 -488
- package/dist/esm/components/Inspector/CrashDetail.js +236 -747
- package/dist/esm/components/Inspector/CrashFilterModal.js +149 -541
- package/dist/esm/components/Inspector/CrashTab.js +177 -711
- package/dist/esm/components/Inspector/DebuggingTab.js +164 -925
- package/dist/esm/components/Inspector/DeviceInfoTab.js +199 -924
- package/dist/esm/components/Inspector/FabLauncher.js +68 -454
- package/dist/esm/components/Inspector/FeatureUnderDevNotice.js +14 -70
- package/dist/esm/components/Inspector/InspectorContext.js +1 -12
- package/dist/esm/components/Inspector/InspectorHeader.js +282 -1163
- package/dist/esm/components/Inspector/LogDetail.js +235 -1023
- package/dist/esm/components/Inspector/MainScreen.js +78 -323
- package/dist/esm/components/Inspector/MediaGalleryTab.js +143 -650
- package/dist/esm/components/Inspector/MediaPreviewModal.js +138 -613
- package/dist/esm/components/Inspector/NavigationTracker.js +1 -10
- package/dist/esm/components/Inspector/NetworkDetail.js +138 -455
- package/dist/esm/components/Inspector/NetworkFilterModal.js +122 -597
- package/dist/esm/components/Inspector/NetworkTab.js +125 -517
- package/dist/esm/components/Inspector/NpmStarPrompt.js +58 -434
- package/dist/esm/components/Inspector/NpmUpdateToast.js +45 -281
- package/dist/esm/components/Inspector/PerformanceTab.js +393 -1570
- package/dist/esm/components/Inspector/ReduxDetail.js +307 -1170
- package/dist/esm/components/Inspector/ReduxTab.js +144 -722
- package/dist/esm/components/Inspector/SettingsPanel.js +643 -3985
- package/dist/esm/components/Inspector/SkeletonPlaceholder.js +30 -163
- package/dist/esm/components/Inspector/StorageTab.js +172 -866
- package/dist/esm/components/Inspector/TabBar.js +45 -305
- package/dist/esm/components/Inspector/UpdateAvailableModal.js +80 -418
- package/dist/esm/components/JsonViewer.js +179 -354
- package/dist/esm/components/LogCard.js +93 -565
- package/dist/esm/components/LogSyntaxHighlighter.js +11 -123
- package/dist/esm/components/MetaAccordion.js +136 -267
- package/dist/esm/components/MiniBarChart.js +3 -18
- package/dist/esm/components/MiniLineChart.js +3 -20
- package/dist/esm/components/NetworkIcons.d.ts +13 -0
- package/dist/esm/components/NetworkIcons.js +523 -838
- package/dist/esm/components/QRCodeView.js +8 -45
- package/dist/esm/components/SectionHeader.js +22 -39
- package/dist/esm/components/SegmentedTabs.js +8 -58
- package/dist/esm/components/SkeletonPlaceholder.js +30 -163
- package/dist/esm/components/Slider.js +24 -213
- package/dist/esm/components/SourcePageCard.js +65 -86
- package/dist/esm/components/Toast.js +10 -117
- package/dist/esm/components/TouchableScale.js +3 -19
- package/dist/esm/components/TreeNode.js +58 -95
- package/dist/esm/console.js +1 -2
- package/dist/esm/constants/index.js +1 -28
- package/dist/esm/constants/telemetryConfig.js +1 -3
- package/dist/esm/constants/version.d.ts +1 -1
- package/dist/esm/constants/version.js +1 -1
- package/dist/esm/crash.js +1 -2
- package/dist/esm/customHooks/analyticsLogger.js +1 -230
- package/dist/esm/customHooks/bundleAnalyzer.js +1 -944
- package/dist/esm/customHooks/consoleLogger.js +6 -432
- package/dist/esm/customHooks/crashHandler.js +7 -630
- package/dist/esm/customHooks/logFilters.js +1 -20
- package/dist/esm/customHooks/networkLogger.js +2 -519
- package/dist/esm/customHooks/performanceTracker.js +63 -723
- package/dist/esm/customHooks/reduxLogger.js +2 -293
- package/dist/esm/customHooks/storageInspector.js +1 -418
- package/dist/esm/customHooks/useAccordion.js +1 -16
- package/dist/esm/decorators/index.js +1 -95
- package/dist/esm/helpers/gaAnalyticsRegistry.js +1 -143
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/index.js +8 -861
- package/dist/esm/helpers/memoryManager.js +1 -91
- package/dist/esm/helpers/qrGenerator.js +1 -364
- package/dist/esm/helpers/remoteConfig.js +1 -160
- package/dist/esm/helpers/searchQueryParser.js +1 -59
- package/dist/esm/helpers/settingsStore.js +1 -134
- package/dist/esm/helpers/telemetry.js +1 -489
- package/dist/esm/helpers/toast.js +1 -15
- package/dist/esm/i18n/index.js +1 -78
- package/dist/esm/i18n/locales/en.json +1 -1140
- package/dist/esm/index.js +7 -1982
- package/dist/esm/metro.js +6 -459
- package/dist/esm/native/NativeInspector.d.ts +1 -0
- package/dist/esm/native/NativeInspector.js +1 -382
- package/dist/esm/native/NativeNetworkInspector.js +1 -2
- package/dist/esm/network.js +1 -1
- package/dist/esm/performance.js +1 -2
- package/dist/esm/redux.js +1 -1
- package/dist/esm/storage.js +1 -1
- package/dist/esm/styles/AppColors.js +1 -417
- package/dist/esm/styles/AppFonts.js +1 -13
- package/dist/esm/styles/common.js +1 -186
- package/dist/esm/styles/index.d.ts +6 -0
- package/dist/esm/styles/index.js +1 -1551
- package/dist/esm/types/enums.d.ts +0 -1
- package/dist/esm/types/enums.js +1 -149
- package/dist/esm/types/index.js +1 -2
- package/dist/esm/types/interfaces.d.ts +2 -2
- package/dist/esm/types/interfaces.js +1 -1
- package/ios/NetworkInspectorModule.mm +60 -12
- package/package.json +5 -3
- package/src/native/NativeInspector.ts +18 -0
- package/dist/commonjs/components/Inspector/FeedbackModal.d.ts +0 -7
- package/dist/commonjs/components/Inspector/FeedbackModal.js +0 -552
- package/dist/esm/components/Inspector/FeedbackModal.d.ts +0 -7
- package/dist/esm/components/Inspector/FeedbackModal.js +0 -515
- package/src/analytics.ts +0 -35
- package/src/bundle.ts +0 -25
- package/src/capture.ts +0 -109
- package/src/components/AnalyticsDetail.tsx +0 -870
- package/src/components/AnalyticsEventCard.tsx +0 -444
- package/src/components/AnalyticsGraph.tsx +0 -583
- package/src/components/AnimatedEntrance.tsx +0 -20
- package/src/components/AppHeaderLogo.tsx +0 -143
- package/src/components/BrandCircleIcon.tsx +0 -144
- package/src/components/BrandSquareIcon.tsx +0 -184
- package/src/components/CodeSnippet.tsx +0 -725
- package/src/components/ConsoleLogCard.tsx +0 -679
- package/src/components/CopyButton.tsx +0 -87
- package/src/components/DiffViewer.tsx +0 -82
- package/src/components/DomainHeader.tsx +0 -224
- package/src/components/EmptyState.tsx +0 -97
- package/src/components/EndOfListFooter.tsx +0 -100
- package/src/components/ErrorBoundary.tsx +0 -688
- package/src/components/HeadersSection.tsx +0 -172
- package/src/components/HighlightText.tsx +0 -100
- package/src/components/Inspector/AnalyticsFilterModal.tsx +0 -1250
- package/src/components/Inspector/AnalyticsTab.tsx +0 -1362
- package/src/components/Inspector/BundleTab.tsx +0 -4768
- package/src/components/Inspector/ConsoleTab.tsx +0 -726
- package/src/components/Inspector/CrashDetail.tsx +0 -997
- package/src/components/Inspector/CrashFilterModal.tsx +0 -721
- package/src/components/Inspector/CrashTab.tsx +0 -933
- package/src/components/Inspector/DebuggingTab.tsx +0 -1103
- package/src/components/Inspector/DeviceInfoTab.tsx +0 -1397
- package/src/components/Inspector/FabLauncher.tsx +0 -590
- package/src/components/Inspector/FeatureUnderDevNotice.tsx +0 -94
- package/src/components/Inspector/FeedbackModal.tsx +0 -626
- package/src/components/Inspector/InspectorContext.tsx +0 -28
- package/src/components/Inspector/InspectorHeader.tsx +0 -1583
- package/src/components/Inspector/LogDetail.tsx +0 -1431
- package/src/components/Inspector/MainScreen.tsx +0 -460
- package/src/components/Inspector/MediaGalleryTab.tsx +0 -829
- package/src/components/Inspector/MediaPreviewModal.tsx +0 -783
- package/src/components/Inspector/NavigationTracker.tsx +0 -13
- package/src/components/Inspector/NetworkDetail.tsx +0 -778
- package/src/components/Inspector/NetworkFilterModal.tsx +0 -730
- package/src/components/Inspector/NetworkTab.tsx +0 -820
- package/src/components/Inspector/NpmStarPrompt.tsx +0 -532
- package/src/components/Inspector/NpmUpdateToast.tsx +0 -387
- package/src/components/Inspector/PerformanceTab.tsx +0 -1967
- package/src/components/Inspector/ReduxDetail.tsx +0 -1651
- package/src/components/Inspector/ReduxTab.tsx +0 -987
- package/src/components/Inspector/SettingsPanel.tsx +0 -5136
- package/src/components/Inspector/SkeletonPlaceholder.tsx +0 -206
- package/src/components/Inspector/StorageTab.tsx +0 -1159
- package/src/components/Inspector/TabBar.tsx +0 -431
- package/src/components/Inspector/UpdateAvailableModal.tsx +0 -555
- package/src/components/JsonViewer.tsx +0 -549
- package/src/components/LogCard.tsx +0 -694
- package/src/components/LogSyntaxHighlighter.tsx +0 -178
- package/src/components/MetaAccordion.tsx +0 -355
- package/src/components/MiniBarChart.tsx +0 -42
- package/src/components/MiniLineChart.tsx +0 -33
- package/src/components/NetworkIcons.tsx +0 -2655
- package/src/components/QRCodeView.tsx +0 -75
- package/src/components/SectionHeader.tsx +0 -101
- package/src/components/SegmentedTabs.tsx +0 -84
- package/src/components/SkeletonPlaceholder.tsx +0 -206
- package/src/components/Slider.tsx +0 -300
- package/src/components/SourcePageCard.tsx +0 -150
- package/src/components/Toast.tsx +0 -131
- package/src/components/TouchableScale.tsx +0 -61
- package/src/components/TreeNode.tsx +0 -171
- package/src/console.ts +0 -24
- package/src/constants/index.ts +0 -41
- package/src/constants/telemetryConfig.ts +0 -4
- package/src/constants/version.ts +0 -3
- package/src/crash.ts +0 -32
- package/src/customHooks/analyticsLogger.ts +0 -336
- package/src/customHooks/bundleAnalyzer.ts +0 -1256
- package/src/customHooks/consoleLogger.ts +0 -530
- package/src/customHooks/crashHandler.ts +0 -944
- package/src/customHooks/logFilters.ts +0 -32
- package/src/customHooks/networkLogger.ts +0 -624
- package/src/customHooks/performanceTracker.ts +0 -1014
- package/src/customHooks/reduxLogger.ts +0 -406
- package/src/customHooks/storageInspector.ts +0 -513
- package/src/customHooks/useAccordion.tsx +0 -27
- package/src/decorators/index.ts +0 -184
- package/src/helpers/gaAnalyticsRegistry.ts +0 -204
- package/src/helpers/index.ts +0 -1092
- package/src/helpers/memoryManager.ts +0 -138
- package/src/helpers/qrGenerator.ts +0 -430
- package/src/helpers/remoteConfig.ts +0 -212
- package/src/helpers/searchQueryParser.ts +0 -84
- package/src/helpers/settingsStore.ts +0 -171
- package/src/helpers/telemetry.ts +0 -568
- package/src/helpers/toast.ts +0 -17
- package/src/i18n/index.ts +0 -104
- package/src/i18n/locales/en.json +0 -1141
- package/src/index.tsx +0 -2650
- package/src/metro.ts +0 -598
- package/src/network.ts +0 -22
- package/src/performance.ts +0 -38
- package/src/redux.ts +0 -23
- package/src/storage.ts +0 -18
- package/src/styles/AppColors.ts +0 -455
- package/src/styles/AppFonts.ts +0 -26
- package/src/styles/common.ts +0 -209
- package/src/styles/index.ts +0 -1606
- package/src/types/enums.ts +0 -210
- package/src/types/index.ts +0 -34
- package/src/types/interfaces.ts +0 -535
|
@@ -1,99 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isMemoryHandlerActive = exports.getLastPruneTimestamp = exports.subscribeMemoryWarning = exports.setupMemoryWarningHandler = exports.pruneAllLogs = void 0;
|
|
4
|
-
const react_native_1 = require("react-native");
|
|
5
|
-
const networkLogger_1 = require("../customHooks/networkLogger");
|
|
6
|
-
const consoleLogger_1 = require("../customHooks/consoleLogger");
|
|
7
|
-
const reduxLogger_1 = require("../customHooks/reduxLogger");
|
|
8
|
-
const analyticsLogger_1 = require("../customHooks/analyticsLogger");
|
|
9
|
-
const crashHandler_1 = require("../customHooks/crashHandler");
|
|
10
|
-
const performanceTracker_1 = require("../customHooks/performanceTracker");
|
|
11
|
-
const toast_1 = require("./toast");
|
|
12
|
-
const memoryListeners = new Set();
|
|
13
|
-
let appStateSubscription = null;
|
|
14
|
-
let isMemoryWarningHandlerActive = false;
|
|
15
|
-
let lastPruneTimestamp = 0;
|
|
16
|
-
const pruneAllLogs = (triggeredBy = 'manual', targetRetentionPct = 0.5) => {
|
|
17
|
-
const targetPct = Math.max(0.1, Math.min(1.0, targetRetentionPct));
|
|
18
|
-
const prunedNetwork = (0, networkLogger_1.pruneNetworkLogs)(undefined);
|
|
19
|
-
const prunedConsole = (0, consoleLogger_1.pruneConsoleLogs)(undefined);
|
|
20
|
-
const prunedRedux = (0, reduxLogger_1.pruneReduxHistory)(undefined);
|
|
21
|
-
const prunedAnalytics = (0, analyticsLogger_1.pruneAnalyticsLogs)(undefined);
|
|
22
|
-
const prunedCrashes = (0, crashHandler_1.pruneCrashRecords)(undefined);
|
|
23
|
-
const prunedPerformance = (0, performanceTracker_1.prunePerformanceEvents)(undefined);
|
|
24
|
-
const totalPruned = prunedNetwork +
|
|
25
|
-
prunedConsole +
|
|
26
|
-
prunedRedux +
|
|
27
|
-
prunedAnalytics +
|
|
28
|
-
prunedCrashes +
|
|
29
|
-
prunedPerformance;
|
|
30
|
-
lastPruneTimestamp = Date.now();
|
|
31
|
-
if (typeof globalThis.gc === 'function') {
|
|
32
|
-
try {
|
|
33
|
-
globalThis.gc();
|
|
34
|
-
}
|
|
35
|
-
catch { }
|
|
36
|
-
}
|
|
37
|
-
const summary = {
|
|
38
|
-
timestamp: lastPruneTimestamp,
|
|
39
|
-
prunedNetwork,
|
|
40
|
-
prunedConsole,
|
|
41
|
-
prunedRedux,
|
|
42
|
-
prunedAnalytics,
|
|
43
|
-
prunedCrashes,
|
|
44
|
-
prunedPerformance,
|
|
45
|
-
totalPruned,
|
|
46
|
-
triggeredBy,
|
|
47
|
-
};
|
|
48
|
-
try {
|
|
49
|
-
(0, crashHandler_1.addCrashBreadcrumb)('system', `[MemoryManager] Low memory auto-prune executed (${triggeredBy}). Freed ${totalPruned} log records.`, summary);
|
|
50
|
-
}
|
|
51
|
-
catch { }
|
|
52
|
-
memoryListeners.forEach(listener => {
|
|
53
|
-
try {
|
|
54
|
-
listener(summary);
|
|
55
|
-
}
|
|
56
|
-
catch { }
|
|
57
|
-
});
|
|
58
|
-
return summary;
|
|
59
|
-
};
|
|
60
|
-
exports.pruneAllLogs = pruneAllLogs;
|
|
61
|
-
const setupMemoryWarningHandler = () => {
|
|
62
|
-
if (isMemoryWarningHandlerActive) {
|
|
63
|
-
return () => { };
|
|
64
|
-
}
|
|
65
|
-
isMemoryWarningHandlerActive = true;
|
|
66
|
-
try {
|
|
67
|
-
appStateSubscription = react_native_1.AppState.addEventListener('memoryWarning', (state) => {
|
|
68
|
-
const summary = (0, exports.pruneAllLogs)('memory-warning', 0.5);
|
|
69
|
-
try {
|
|
70
|
-
(0, toast_1.showToast)(`Memory Warning: Auto-pruned ${summary.totalPruned} inspector logs`);
|
|
71
|
-
}
|
|
72
|
-
catch { }
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
catch (e) {
|
|
76
|
-
}
|
|
77
|
-
return () => {
|
|
78
|
-
if (appStateSubscription) {
|
|
79
|
-
try {
|
|
80
|
-
appStateSubscription.remove();
|
|
81
|
-
}
|
|
82
|
-
catch { }
|
|
83
|
-
appStateSubscription = null;
|
|
84
|
-
}
|
|
85
|
-
isMemoryWarningHandlerActive = false;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
exports.setupMemoryWarningHandler = setupMemoryWarningHandler;
|
|
89
|
-
const subscribeMemoryWarning = (listener) => {
|
|
90
|
-
memoryListeners.add(listener);
|
|
91
|
-
return () => {
|
|
92
|
-
memoryListeners.delete(listener);
|
|
93
|
-
};
|
|
94
|
-
};
|
|
95
|
-
exports.subscribeMemoryWarning = subscribeMemoryWarning;
|
|
96
|
-
const getLastPruneTimestamp = () => lastPruneTimestamp;
|
|
97
|
-
exports.getLastPruneTimestamp = getLastPruneTimestamp;
|
|
98
|
-
const isMemoryHandlerActive = () => isMemoryWarningHandlerActive;
|
|
99
|
-
exports.isMemoryHandlerActive = isMemoryHandlerActive;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isMemoryHandlerActive=exports.getLastPruneTimestamp=exports.subscribeMemoryWarning=exports.setupMemoryWarningHandler=exports.pruneAllLogs=void 0;const react_native_1=require("react-native"),networkLogger_1=require("../customHooks/networkLogger"),consoleLogger_1=require("../customHooks/consoleLogger"),reduxLogger_1=require("../customHooks/reduxLogger"),analyticsLogger_1=require("../customHooks/analyticsLogger"),crashHandler_1=require("../customHooks/crashHandler"),performanceTracker_1=require("../customHooks/performanceTracker"),toast_1=require("./toast"),memoryListeners=new Set;let appStateSubscription=null,isMemoryWarningHandlerActive=!1,lastPruneTimestamp=0;const pruneAllLogs=(e="manual",r=.5)=>{const d=Math.max(.1,Math.min(1,r)),o=(0,networkLogger_1.pruneNetworkLogs)(void 0),n=(0,consoleLogger_1.pruneConsoleLogs)(void 0),s=(0,reduxLogger_1.pruneReduxHistory)(void 0),a=(0,analyticsLogger_1.pruneAnalyticsLogs)(void 0),c=(0,crashHandler_1.pruneCrashRecords)(void 0),u=(0,performanceTracker_1.prunePerformanceEvents)(void 0),i=o+n+s+a+c+u;if(lastPruneTimestamp=Date.now(),typeof globalThis.gc=="function")try{globalThis.gc()}catch{}const t={timestamp:lastPruneTimestamp,prunedNetwork:o,prunedConsole:n,prunedRedux:s,prunedAnalytics:a,prunedCrashes:c,prunedPerformance:u,totalPruned:i,triggeredBy:e};try{(0,crashHandler_1.addCrashBreadcrumb)("system",`[MemoryManager] Low memory auto-prune executed (${e}). Freed ${i} log records.`,t)}catch{}return memoryListeners.forEach(m=>{try{m(t)}catch{}}),t};exports.pruneAllLogs=pruneAllLogs;const setupMemoryWarningHandler=()=>{if(isMemoryWarningHandlerActive)return()=>{};isMemoryWarningHandlerActive=!0;try{appStateSubscription=react_native_1.AppState.addEventListener("memoryWarning",e=>{const r=(0,exports.pruneAllLogs)("memory-warning",.5);try{(0,toast_1.showToast)(`Memory Warning: Auto-pruned ${r.totalPruned} inspector logs`)}catch{}})}catch{}return()=>{if(appStateSubscription){try{appStateSubscription.remove()}catch{}appStateSubscription=null}isMemoryWarningHandlerActive=!1}};exports.setupMemoryWarningHandler=setupMemoryWarningHandler;const subscribeMemoryWarning=e=>(memoryListeners.add(e),()=>{memoryListeners.delete(e)});exports.subscribeMemoryWarning=subscribeMemoryWarning;const getLastPruneTimestamp=()=>lastPruneTimestamp;exports.getLastPruneTimestamp=getLastPruneTimestamp;const isMemoryHandlerActive=()=>isMemoryWarningHandlerActive;exports.isMemoryHandlerActive=isMemoryHandlerActive;
|
|
@@ -1,367 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateQRMatrix = generateQRMatrix;
|
|
4
|
-
const QR_ECC_LEVEL = {
|
|
5
|
-
L: 1,
|
|
6
|
-
M: 0,
|
|
7
|
-
Q: 3,
|
|
8
|
-
H: 2,
|
|
9
|
-
};
|
|
10
|
-
const EXP_TABLE = new Uint8Array(256);
|
|
11
|
-
const LOG_TABLE = new Uint8Array(256);
|
|
12
|
-
(function initGaloisField() {
|
|
13
|
-
let x = 1;
|
|
14
|
-
for (let i = 0; i < 255; i++) {
|
|
15
|
-
EXP_TABLE[i] = x;
|
|
16
|
-
LOG_TABLE[x] = i;
|
|
17
|
-
x <<= 1;
|
|
18
|
-
if (x & 0x100) {
|
|
19
|
-
x ^= 0x11d;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
EXP_TABLE[255] = EXP_TABLE[0];
|
|
23
|
-
})();
|
|
24
|
-
function glog(n) {
|
|
25
|
-
if (n < 1)
|
|
26
|
-
throw new Error(`glog(${n})`);
|
|
27
|
-
return LOG_TABLE[n];
|
|
28
|
-
}
|
|
29
|
-
function gexp(n) {
|
|
30
|
-
while (n < 0)
|
|
31
|
-
n += 255;
|
|
32
|
-
while (n >= 256)
|
|
33
|
-
n -= 255;
|
|
34
|
-
return EXP_TABLE[n];
|
|
35
|
-
}
|
|
36
|
-
class Polynomial {
|
|
37
|
-
constructor(num, shift = 0) {
|
|
38
|
-
let offset = 0;
|
|
39
|
-
while (offset < num.length && num[offset] === 0) {
|
|
40
|
-
offset++;
|
|
41
|
-
}
|
|
42
|
-
this.num = new Array(num.length - offset + shift);
|
|
43
|
-
for (let i = 0; i < num.length - offset; i++) {
|
|
44
|
-
this.num[i] = num[i + offset];
|
|
45
|
-
}
|
|
46
|
-
for (let i = num.length - offset; i < this.num.length; i++) {
|
|
47
|
-
this.num[i] = 0;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
get(index) {
|
|
51
|
-
return this.num[index] || 0;
|
|
52
|
-
}
|
|
53
|
-
getLength() {
|
|
54
|
-
return this.num.length;
|
|
55
|
-
}
|
|
56
|
-
multiply(e) {
|
|
57
|
-
const num = new Array(this.getLength() + e.getLength() - 1).fill(0);
|
|
58
|
-
for (let i = 0; i < this.getLength(); i++) {
|
|
59
|
-
for (let j = 0; j < e.getLength(); j++) {
|
|
60
|
-
num[i + j] ^= gexp(glog(this.get(i)) + glog(e.get(j)));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return new Polynomial(num);
|
|
64
|
-
}
|
|
65
|
-
mod(e) {
|
|
66
|
-
if (this.getLength() - e.getLength() < 0) {
|
|
67
|
-
return this;
|
|
68
|
-
}
|
|
69
|
-
const ratio = glog(this.get(0)) - glog(e.get(0));
|
|
70
|
-
const num = new Array(this.getLength());
|
|
71
|
-
for (let i = 0; i < this.getLength(); i++) {
|
|
72
|
-
num[i] = this.get(i);
|
|
73
|
-
}
|
|
74
|
-
for (let i = 0; i < e.getLength(); i++) {
|
|
75
|
-
num[i] ^= gexp(glog(e.get(i)) + ratio);
|
|
76
|
-
}
|
|
77
|
-
return new Polynomial(num).mod(e);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
const RS_BLOCK_TABLE = [
|
|
81
|
-
[[1, 26, 19], [1, 26, 16], [1, 26, 13], [1, 26, 9]],
|
|
82
|
-
[[1, 44, 34], [1, 44, 28], [1, 44, 22], [1, 44, 16]],
|
|
83
|
-
[[1, 70, 55], [1, 70, 44], [2, 35, 17], [2, 35, 13]],
|
|
84
|
-
[[1, 100, 80], [2, 50, 32], [2, 50, 24], [4, 25, 9]],
|
|
85
|
-
[[1, 134, 108], [2, 67, 43], [2, 33, 15, 2, 34, 16], [2, 33, 11, 2, 34, 12]],
|
|
86
|
-
[[2, 86, 68], [4, 43, 27], [4, 43, 19], [4, 43, 15]],
|
|
87
|
-
[[2, 98, 78], [4, 49, 31], [2, 32, 14, 4, 33, 15], [4, 39, 13, 1, 40, 14]],
|
|
88
|
-
[[2, 121, 97], [2, 60, 38, 2, 61, 39], [4, 40, 18, 2, 41, 19], [4, 40, 14, 2, 41, 15]],
|
|
89
|
-
[[2, 146, 116], [3, 58, 36, 2, 59, 37], [4, 36, 16, 4, 37, 17], [4, 36, 12, 4, 37, 13]],
|
|
90
|
-
[[2, 86, 68, 2, 87, 69], [4, 69, 43, 1, 70, 44], [6, 43, 19, 2, 44, 20], [6, 43, 15, 2, 44, 16]],
|
|
91
|
-
];
|
|
92
|
-
const PATTERN_POSITION_TABLE = [
|
|
93
|
-
[],
|
|
94
|
-
[6, 18],
|
|
95
|
-
[6, 22],
|
|
96
|
-
[6, 26],
|
|
97
|
-
[6, 30],
|
|
98
|
-
[6, 34],
|
|
99
|
-
[6, 22, 38],
|
|
100
|
-
[6, 24, 42],
|
|
101
|
-
[6, 26, 46],
|
|
102
|
-
[6, 28, 50],
|
|
103
|
-
];
|
|
104
|
-
const G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0);
|
|
105
|
-
const G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1);
|
|
106
|
-
function getBCHTypeInfo(data) {
|
|
107
|
-
let d = data << 10;
|
|
108
|
-
while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
|
|
109
|
-
d ^= G15 << (getBCHDigit(d) - getBCHDigit(G15));
|
|
110
|
-
}
|
|
111
|
-
return ((data << 10) | d) ^ G15_MASK;
|
|
112
|
-
}
|
|
113
|
-
function getBCHDigit(data) {
|
|
114
|
-
let digit = 0;
|
|
115
|
-
while (data !== 0) {
|
|
116
|
-
digit++;
|
|
117
|
-
data >>>= 1;
|
|
118
|
-
}
|
|
119
|
-
return digit;
|
|
120
|
-
}
|
|
121
|
-
function getMask(maskPattern, i, j) {
|
|
122
|
-
switch (maskPattern) {
|
|
123
|
-
case 0: return (i + j) % 2 === 0;
|
|
124
|
-
case 1: return i % 2 === 0;
|
|
125
|
-
case 2: return j % 3 === 0;
|
|
126
|
-
case 3: return (i + j) % 3 === 0;
|
|
127
|
-
case 4: return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0;
|
|
128
|
-
case 5: return ((i * j) % 2) + ((i * j) % 3) === 0;
|
|
129
|
-
case 6: return (((i * j) % 2) + ((i * j) % 3)) % 2 === 0;
|
|
130
|
-
case 7: return (((i * j) % 3) + ((i + j) % 2)) % 2 === 0;
|
|
131
|
-
default: return false;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
class BitBuffer {
|
|
135
|
-
constructor() {
|
|
136
|
-
this.buffer = [];
|
|
137
|
-
this.length = 0;
|
|
138
|
-
}
|
|
139
|
-
get(index) {
|
|
140
|
-
const bufIndex = Math.floor(index / 8);
|
|
141
|
-
return ((this.buffer[bufIndex] >>> (7 - (index % 8))) & 1) === 1;
|
|
142
|
-
}
|
|
143
|
-
put(num, length) {
|
|
144
|
-
for (let i = 0; i < length; i++) {
|
|
145
|
-
this.putBit(((num >>> (length - i - 1)) & 1) === 1);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
putBit(bit) {
|
|
149
|
-
const bufIndex = Math.floor(this.length / 8);
|
|
150
|
-
if (this.buffer.length <= bufIndex) {
|
|
151
|
-
this.buffer.push(0);
|
|
152
|
-
}
|
|
153
|
-
if (bit) {
|
|
154
|
-
this.buffer[bufIndex] |= 0x80 >>> (this.length % 8);
|
|
155
|
-
}
|
|
156
|
-
this.length++;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
function getErrorCorrectionPolynomial(errorCorrectionLength) {
|
|
160
|
-
let a = new Polynomial([1], 0);
|
|
161
|
-
for (let i = 0; i < errorCorrectionLength; i++) {
|
|
162
|
-
a = a.multiply(new Polynomial([1, gexp(i)], 0));
|
|
163
|
-
}
|
|
164
|
-
return a;
|
|
165
|
-
}
|
|
166
|
-
function generateQRMatrix(text, ecc = 'M') {
|
|
167
|
-
const eccLevel = QR_ECC_LEVEL[ecc] ?? 0;
|
|
168
|
-
const utf8Bytes = [];
|
|
169
|
-
for (let i = 0; i < text.length; i++) {
|
|
170
|
-
let c = text.charCodeAt(i);
|
|
171
|
-
if (c < 128) {
|
|
172
|
-
utf8Bytes.push(c);
|
|
173
|
-
}
|
|
174
|
-
else if (c < 2048) {
|
|
175
|
-
utf8Bytes.push((c >> 6) | 192);
|
|
176
|
-
utf8Bytes.push((c & 63) | 128);
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
utf8Bytes.push((c >> 12) | 224);
|
|
180
|
-
utf8Bytes.push(((c >> 6) & 63) | 128);
|
|
181
|
-
utf8Bytes.push((c & 63) | 128);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
let version = 1;
|
|
185
|
-
for (let v = 1; v <= 10; v++) {
|
|
186
|
-
const blockList = RS_BLOCK_TABLE[v - 1][eccLevel];
|
|
187
|
-
let totalDataCount = 0;
|
|
188
|
-
for (let i = 0; i < blockList.length; i += 3) {
|
|
189
|
-
totalDataCount += blockList[i] * blockList[i + 2];
|
|
190
|
-
}
|
|
191
|
-
if (utf8Bytes.length + 2 <= totalDataCount) {
|
|
192
|
-
version = v;
|
|
193
|
-
break;
|
|
194
|
-
}
|
|
195
|
-
version = v;
|
|
196
|
-
}
|
|
197
|
-
const moduleCount = version * 4 + 17;
|
|
198
|
-
const modules = Array.from({ length: moduleCount }, () => Array(moduleCount).fill(null));
|
|
199
|
-
function setupPositionProbePattern(row, col) {
|
|
200
|
-
for (let r = -1; r <= 7; r++) {
|
|
201
|
-
if (row + r <= -1 || moduleCount <= row + r)
|
|
202
|
-
continue;
|
|
203
|
-
for (let c = -1; c <= 7; c++) {
|
|
204
|
-
if (col + c <= -1 || moduleCount <= col + c)
|
|
205
|
-
continue;
|
|
206
|
-
if ((0 <= r && r <= 6 && (c === 0 || c === 6)) ||
|
|
207
|
-
(0 <= c && c <= 6 && (r === 0 || r === 6)) ||
|
|
208
|
-
(2 <= r && r <= 4 && 2 <= c && c <= 4)) {
|
|
209
|
-
modules[row + r][col + c] = true;
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
modules[row + r][col + c] = false;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
setupPositionProbePattern(0, 0);
|
|
218
|
-
setupPositionProbePattern(moduleCount - 7, 0);
|
|
219
|
-
setupPositionProbePattern(0, moduleCount - 7);
|
|
220
|
-
const pos = PATTERN_POSITION_TABLE[version - 1] || [];
|
|
221
|
-
for (let i = 0; i < pos.length; i++) {
|
|
222
|
-
for (let j = 0; j < pos.length; j++) {
|
|
223
|
-
const row = pos[i];
|
|
224
|
-
const col = pos[j];
|
|
225
|
-
if (modules[row][col] !== null)
|
|
226
|
-
continue;
|
|
227
|
-
for (let r = -2; r <= 2; r++) {
|
|
228
|
-
for (let c = -2; c <= 2; c++) {
|
|
229
|
-
if (r === -2 || r === 2 || c === -2 || c === 2 || (r === 0 && c === 0)) {
|
|
230
|
-
modules[row + r][col + c] = true;
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
modules[row + r][col + c] = false;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
for (let r = 8; r < moduleCount - 8; r++) {
|
|
240
|
-
if (modules[r][6] === null)
|
|
241
|
-
modules[r][6] = r % 2 === 0;
|
|
242
|
-
}
|
|
243
|
-
for (let c = 8; c < moduleCount - 8; c++) {
|
|
244
|
-
if (modules[6][c] === null)
|
|
245
|
-
modules[6][c] = c % 2 === 0;
|
|
246
|
-
}
|
|
247
|
-
const buffer = new BitBuffer();
|
|
248
|
-
buffer.put(4, 4);
|
|
249
|
-
buffer.put(utf8Bytes.length, 8);
|
|
250
|
-
for (let i = 0; i < utf8Bytes.length; i++) {
|
|
251
|
-
buffer.put(utf8Bytes[i], 8);
|
|
252
|
-
}
|
|
253
|
-
const rsBlocks = RS_BLOCK_TABLE[version - 1][eccLevel];
|
|
254
|
-
let totalDataCount = 0;
|
|
255
|
-
for (let i = 0; i < rsBlocks.length; i += 3) {
|
|
256
|
-
totalDataCount += rsBlocks[i] * rsBlocks[i + 2];
|
|
257
|
-
}
|
|
258
|
-
if (buffer.length + 4 <= totalDataCount * 8) {
|
|
259
|
-
buffer.put(0, 4);
|
|
260
|
-
}
|
|
261
|
-
while (buffer.length % 8 !== 0) {
|
|
262
|
-
buffer.putBit(false);
|
|
263
|
-
}
|
|
264
|
-
while (buffer.length < totalDataCount * 8) {
|
|
265
|
-
buffer.put(0xec, 8);
|
|
266
|
-
if (buffer.length < totalDataCount * 8) {
|
|
267
|
-
buffer.put(0x11, 8);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
const dataBytes = buffer.buffer;
|
|
271
|
-
let offset = 0;
|
|
272
|
-
const dcData = [];
|
|
273
|
-
const ecData = [];
|
|
274
|
-
for (let i = 0; i < rsBlocks.length; i += 3) {
|
|
275
|
-
const numBlocks = rsBlocks[i];
|
|
276
|
-
const totalCount = rsBlocks[i + 1];
|
|
277
|
-
const dataCount = rsBlocks[i + 2];
|
|
278
|
-
const ecCount = totalCount - dataCount;
|
|
279
|
-
const rsPoly = getErrorCorrectionPolynomial(ecCount);
|
|
280
|
-
for (let b = 0; b < numBlocks; b++) {
|
|
281
|
-
const rawDc = dataBytes.slice(offset, offset + dataCount);
|
|
282
|
-
offset += dataCount;
|
|
283
|
-
dcData.push(rawDc);
|
|
284
|
-
const rawPoly = new Polynomial(rawDc, rsPoly.getLength() - 1);
|
|
285
|
-
const modPoly = rawPoly.mod(rsPoly);
|
|
286
|
-
const ec = new Array(rsPoly.getLength() - 1).fill(0);
|
|
287
|
-
for (let k = 0; k < ec.length; k++) {
|
|
288
|
-
const modIndex = k + modPoly.getLength() - ec.length;
|
|
289
|
-
ec[k] = modIndex >= 0 ? modPoly.get(modIndex) : 0;
|
|
290
|
-
}
|
|
291
|
-
ecData.push(ec);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
const finalCodewords = [];
|
|
295
|
-
let maxDcCount = 0;
|
|
296
|
-
for (const block of dcData)
|
|
297
|
-
maxDcCount = Math.max(maxDcCount, block.length);
|
|
298
|
-
for (let i = 0; i < maxDcCount; i++) {
|
|
299
|
-
for (const block of dcData) {
|
|
300
|
-
if (i < block.length)
|
|
301
|
-
finalCodewords.push(block[i]);
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
let maxEcCount = 0;
|
|
305
|
-
for (const block of ecData)
|
|
306
|
-
maxEcCount = Math.max(maxEcCount, block.length);
|
|
307
|
-
for (let i = 0; i < maxEcCount; i++) {
|
|
308
|
-
for (const block of ecData) {
|
|
309
|
-
if (i < block.length)
|
|
310
|
-
finalCodewords.push(block[i]);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
let inc = -1;
|
|
314
|
-
let row = moduleCount - 1;
|
|
315
|
-
let bitIndex = 0;
|
|
316
|
-
const maskPattern = 0;
|
|
317
|
-
for (let col = moduleCount - 1; col > 0; col -= 2) {
|
|
318
|
-
if (col === 6)
|
|
319
|
-
col--;
|
|
320
|
-
while (true) {
|
|
321
|
-
for (let c = 0; c < 2; c++) {
|
|
322
|
-
if (modules[row][col - c] === null) {
|
|
323
|
-
let dark = false;
|
|
324
|
-
if (bitIndex < finalCodewords.length * 8) {
|
|
325
|
-
const byte = finalCodewords[Math.floor(bitIndex / 8)];
|
|
326
|
-
dark = ((byte >>> (7 - (bitIndex % 8))) & 1) === 1;
|
|
327
|
-
bitIndex++;
|
|
328
|
-
}
|
|
329
|
-
const mask = getMask(maskPattern, row, col - c);
|
|
330
|
-
modules[row][col - c] = mask ? !dark : dark;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
row += inc;
|
|
334
|
-
if (row < 0 || moduleCount <= row) {
|
|
335
|
-
row -= inc;
|
|
336
|
-
inc = -inc;
|
|
337
|
-
break;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
const typeData = (eccLevel << 3) | maskPattern;
|
|
342
|
-
const bits = getBCHTypeInfo(typeData);
|
|
343
|
-
for (let i = 0; i < 15; i++) {
|
|
344
|
-
const mod = ((bits >> i) & 1) === 1;
|
|
345
|
-
if (i < 6) {
|
|
346
|
-
modules[i][8] = mod;
|
|
347
|
-
}
|
|
348
|
-
else if (i < 8) {
|
|
349
|
-
modules[i + 1][8] = mod;
|
|
350
|
-
}
|
|
351
|
-
else {
|
|
352
|
-
modules[moduleCount - 15 + i][8] = mod;
|
|
353
|
-
}
|
|
354
|
-
if (i < 8) {
|
|
355
|
-
modules[8][moduleCount - i - 1] = mod;
|
|
356
|
-
}
|
|
357
|
-
else if (i < 9) {
|
|
358
|
-
modules[8][15 - i - 1 + 1] = mod;
|
|
359
|
-
}
|
|
360
|
-
else {
|
|
361
|
-
modules[8][15 - i - 1] = mod;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
modules[moduleCount - 8][8] = true;
|
|
365
|
-
return modules.map(r => r.map(cell => cell === true));
|
|
366
|
-
}
|
|
367
|
-
exports.default = generateQRMatrix;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.generateQRMatrix=generateQRMatrix;const QR_ECC_LEVEL={L:1,M:0,Q:3,H:2},EXP_TABLE=new Uint8Array(256),LOG_TABLE=new Uint8Array(256);(function(){let e=1;for(let o=0;o<255;o++)EXP_TABLE[o]=e,LOG_TABLE[e]=o,e<<=1,e&256&&(e^=285);EXP_TABLE[255]=EXP_TABLE[0]})();function glog(i){if(i<1)throw new Error(`glog(${i})`);return LOG_TABLE[i]}function gexp(i){for(;i<0;)i+=255;for(;i>=256;)i-=255;return EXP_TABLE[i]}class Polynomial{constructor(e,o=0){let r=0;for(;r<e.length&&e[r]===0;)r++;this.num=new Array(e.length-r+o);for(let l=0;l<e.length-r;l++)this.num[l]=e[l+r];for(let l=e.length-r;l<this.num.length;l++)this.num[l]=0}get(e){return this.num[e]||0}getLength(){return this.num.length}multiply(e){const o=new Array(this.getLength()+e.getLength()-1).fill(0);for(let r=0;r<this.getLength();r++)for(let l=0;l<e.getLength();l++)o[r+l]^=gexp(glog(this.get(r))+glog(e.get(l)));return new Polynomial(o)}mod(e){if(this.getLength()-e.getLength()<0)return this;const o=glog(this.get(0))-glog(e.get(0)),r=new Array(this.getLength());for(let l=0;l<this.getLength();l++)r[l]=this.get(l);for(let l=0;l<e.getLength();l++)r[l]^=gexp(glog(e.get(l))+o);return new Polynomial(r).mod(e)}}const RS_BLOCK_TABLE=[[[1,26,19],[1,26,16],[1,26,13],[1,26,9]],[[1,44,34],[1,44,28],[1,44,22],[1,44,16]],[[1,70,55],[1,70,44],[2,35,17],[2,35,13]],[[1,100,80],[2,50,32],[2,50,24],[4,25,9]],[[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12]],[[2,86,68],[4,43,27],[4,43,19],[4,43,15]],[[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14]],[[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15]],[[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13]],[[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16]]],PATTERN_POSITION_TABLE=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50]],G15=1335,G15_MASK=21522;function getBCHTypeInfo(i){let e=i<<10;for(;getBCHDigit(e)-getBCHDigit(G15)>=0;)e^=G15<<getBCHDigit(e)-getBCHDigit(G15);return(i<<10|e)^G15_MASK}function getBCHDigit(i){let e=0;for(;i!==0;)e++,i>>>=1;return e}function getMask(i,e,o){switch(i){case 0:return(e+o)%2===0;case 1:return e%2===0;case 2:return o%3===0;case 3:return(e+o)%3===0;case 4:return(Math.floor(e/2)+Math.floor(o/3))%2===0;case 5:return e*o%2+e*o%3===0;case 6:return(e*o%2+e*o%3)%2===0;case 7:return(e*o%3+(e+o)%2)%2===0;default:return!1}}class BitBuffer{constructor(){this.buffer=[],this.length=0}get(e){const o=Math.floor(e/8);return(this.buffer[o]>>>7-e%8&1)===1}put(e,o){for(let r=0;r<o;r++)this.putBit((e>>>o-r-1&1)===1)}putBit(e){const o=Math.floor(this.length/8);this.buffer.length<=o&&this.buffer.push(0),e&&(this.buffer[o]|=128>>>this.length%8),this.length++}}function getErrorCorrectionPolynomial(i){let e=new Polynomial([1],0);for(let o=0;o<i;o++)e=e.multiply(new Polynomial([1,gexp(o)],0));return e}function generateQRMatrix(i,e="M"){const o=QR_ECC_LEVEL[e]??0,r=[];for(let t=0;t<i.length;t++){let n=i.charCodeAt(t);n<128?r.push(n):n<2048?(r.push(n>>6|192),r.push(n&63|128)):(r.push(n>>12|224),r.push(n>>6&63|128),r.push(n&63|128))}let l=1;for(let t=1;t<=10;t++){const n=RS_BLOCK_TABLE[t-1][o];let f=0;for(let s=0;s<n.length;s+=3)f+=n[s]*n[s+2];if(r.length+2<=f){l=t;break}l=t}const u=l*4+17,c=Array.from({length:u},()=>Array(u).fill(null));function C(t,n){for(let f=-1;f<=7;f++)if(!(t+f<=-1||u<=t+f))for(let s=-1;s<=7;s++)n+s<=-1||u<=n+s||(0<=f&&f<=6&&(s===0||s===6)||0<=s&&s<=6&&(f===0||f===6)||2<=f&&f<=4&&2<=s&&s<=4?c[t+f][n+s]=!0:c[t+f][n+s]=!1)}C(0,0),C(u-7,0),C(0,u-7);const d=PATTERN_POSITION_TABLE[l-1]||[];for(let t=0;t<d.length;t++)for(let n=0;n<d.length;n++){const f=d[t],s=d[n];if(c[f][s]===null)for(let a=-2;a<=2;a++)for(let g=-2;g<=2;g++)a===-2||a===2||g===-2||g===2||a===0&&g===0?c[f+a][s+g]=!0:c[f+a][s+g]=!1}for(let t=8;t<u-8;t++)c[t][6]===null&&(c[t][6]=t%2===0);for(let t=8;t<u-8;t++)c[6][t]===null&&(c[6][t]=t%2===0);const h=new BitBuffer;h.put(4,4),h.put(r.length,8);for(let t=0;t<r.length;t++)h.put(r[t],8);const p=RS_BLOCK_TABLE[l-1][o];let L=0;for(let t=0;t<p.length;t+=3)L+=p[t]*p[t+2];for(h.length+4<=L*8&&h.put(0,4);h.length%8!==0;)h.putBit(!1);for(;h.length<L*8;)h.put(236,8),h.length<L*8&&h.put(17,8);const R=h.buffer;let A=0;const k=[],M=[];for(let t=0;t<p.length;t+=3){const n=p[t],f=p[t+1],s=p[t+2],a=f-s,g=getErrorCorrectionPolynomial(a);for(let D=0;D<n;D++){const T=R.slice(A,A+s);A+=s,k.push(T);const I=new Polynomial(T,g.getLength()-1).mod(g),x=new Array(g.getLength()-1).fill(0);for(let B=0;B<x.length;B++){const O=B+I.getLength()-x.length;x[B]=O>=0?I.get(O):0}M.push(x)}}const b=[];let E=0;for(const t of k)E=Math.max(E,t.length);for(let t=0;t<E;t++)for(const n of k)t<n.length&&b.push(n[t]);let P=0;for(const t of M)P=Math.max(P,t.length);for(let t=0;t<P;t++)for(const n of M)t<n.length&&b.push(n[t]);let m=-1,w=u-1,y=0;const _=0;for(let t=u-1;t>0;t-=2)for(t===6&&t--;;){for(let n=0;n<2;n++)if(c[w][t-n]===null){let f=!1;y<b.length*8&&(f=(b[Math.floor(y/8)]>>>7-y%8&1)===1,y++);const s=getMask(_,w,t-n);c[w][t-n]=s?!f:f}if(w+=m,w<0||u<=w){w-=m,m=-m;break}}const v=o<<3|_,G=getBCHTypeInfo(v);for(let t=0;t<15;t++){const n=(G>>t&1)===1;t<6?c[t][8]=n:t<8?c[t+1][8]=n:c[u-15+t][8]=n,t<8?c[8][u-t-1]=n:t<9?c[8][15-t-1+1]=n:c[8][15-t-1]=n}return c[u-8][8]=!0,c.map(t=>t.map(n=>n===!0))}exports.default=generateQRMatrix;
|
|
@@ -1,165 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFirebaseRemoteConfig = getFirebaseRemoteConfig;
|
|
4
|
-
exports.isFirebaseRemoteConfigAvailable = isFirebaseRemoteConfigAvailable;
|
|
5
|
-
exports.fetchRemoteConfigModuleStatus = fetchRemoteConfigModuleStatus;
|
|
6
|
-
const MODULE_KEYS = [
|
|
7
|
-
'apis',
|
|
8
|
-
'logs',
|
|
9
|
-
'analytics',
|
|
10
|
-
'redux',
|
|
11
|
-
'storage',
|
|
12
|
-
'device',
|
|
13
|
-
'crash',
|
|
14
|
-
'bundle',
|
|
15
|
-
'performance',
|
|
16
|
-
'debugging',
|
|
17
|
-
];
|
|
18
|
-
let cachedRemoteConfigInstance = null;
|
|
19
|
-
function getFirebaseRemoteConfig(customInstance) {
|
|
20
|
-
if (customInstance && typeof customInstance === 'object') {
|
|
21
|
-
cachedRemoteConfigInstance = customInstance;
|
|
22
|
-
return customInstance;
|
|
23
|
-
}
|
|
24
|
-
if (cachedRemoteConfigInstance) {
|
|
25
|
-
return cachedRemoteConfigInstance;
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
const rcModule = require('@react-native-firebase/remote-config');
|
|
29
|
-
const instance = typeof rcModule.default === 'function'
|
|
30
|
-
? rcModule.default()
|
|
31
|
-
: typeof rcModule === 'function'
|
|
32
|
-
? rcModule()
|
|
33
|
-
: rcModule;
|
|
34
|
-
cachedRemoteConfigInstance = instance;
|
|
35
|
-
return instance;
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function isFirebaseRemoteConfigAvailable(customInstance) {
|
|
42
|
-
return Boolean(getFirebaseRemoteConfig(customInstance));
|
|
43
|
-
}
|
|
44
|
-
function extractValue(val) {
|
|
45
|
-
if (val === null || val === undefined)
|
|
46
|
-
return undefined;
|
|
47
|
-
if (typeof val === 'boolean')
|
|
48
|
-
return val;
|
|
49
|
-
if (typeof val === 'number')
|
|
50
|
-
return val !== 0;
|
|
51
|
-
if (typeof val === 'string') {
|
|
52
|
-
const lower = val.trim().toLowerCase();
|
|
53
|
-
if (lower === 'true' || lower === '1' || lower === 'enabled' || lower === 'on')
|
|
54
|
-
return true;
|
|
55
|
-
if (lower === 'false' || lower === '0' || lower === 'disabled' || lower === 'off')
|
|
56
|
-
return false;
|
|
57
|
-
try {
|
|
58
|
-
return JSON.parse(val);
|
|
59
|
-
}
|
|
60
|
-
catch {
|
|
61
|
-
return undefined;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (typeof val.asBoolean === 'function') {
|
|
65
|
-
return val.asBoolean();
|
|
66
|
-
}
|
|
67
|
-
if (typeof val.asString === 'function') {
|
|
68
|
-
const str = val.asString();
|
|
69
|
-
const lower = str.trim().toLowerCase();
|
|
70
|
-
if (lower === 'true' || lower === '1' || lower === 'enabled' || lower === 'on')
|
|
71
|
-
return true;
|
|
72
|
-
if (lower === 'false' || lower === '0' || lower === 'disabled' || lower === 'off')
|
|
73
|
-
return false;
|
|
74
|
-
try {
|
|
75
|
-
return JSON.parse(str);
|
|
76
|
-
}
|
|
77
|
-
catch {
|
|
78
|
-
return undefined;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
async function fetchRemoteConfigModuleStatus(customInstance, fetchTimeoutMs = 8000) {
|
|
84
|
-
const rc = getFirebaseRemoteConfig(customInstance);
|
|
85
|
-
if (!rc) {
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
try {
|
|
89
|
-
const fetchPromise = (async () => {
|
|
90
|
-
if (typeof rc.fetchAndActivate === 'function') {
|
|
91
|
-
await rc.fetchAndActivate();
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
if (typeof rc.fetch === 'function') {
|
|
95
|
-
await rc.fetch();
|
|
96
|
-
}
|
|
97
|
-
if (typeof rc.activate === 'function') {
|
|
98
|
-
await rc.activate();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
})();
|
|
102
|
-
const timeoutPromise = new Promise((_, reject) => setTimeout(() => reject(new Error('Remote Config fetch timeout')), fetchTimeoutMs));
|
|
103
|
-
await Promise.race([fetchPromise, timeoutPromise]).catch(() => {
|
|
104
|
-
});
|
|
105
|
-
const result = {};
|
|
106
|
-
const jsonKeys = [
|
|
107
|
-
'inspector_modules',
|
|
108
|
-
'inapp_inspector_modules',
|
|
109
|
-
'react_native_inapp_inspector_modules',
|
|
110
|
-
];
|
|
111
|
-
for (const jKey of jsonKeys) {
|
|
112
|
-
let rawVal;
|
|
113
|
-
if (typeof rc.getValue === 'function') {
|
|
114
|
-
try {
|
|
115
|
-
rawVal = rc.getValue(jKey);
|
|
116
|
-
}
|
|
117
|
-
catch { }
|
|
118
|
-
}
|
|
119
|
-
else if (rc[jKey] !== undefined) {
|
|
120
|
-
rawVal = rc[jKey];
|
|
121
|
-
}
|
|
122
|
-
const parsed = extractValue(rawVal);
|
|
123
|
-
if (parsed && typeof parsed === 'object') {
|
|
124
|
-
for (const modKey of MODULE_KEYS) {
|
|
125
|
-
if (typeof parsed[modKey] === 'boolean') {
|
|
126
|
-
result[modKey] = parsed[modKey];
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
for (const modKey of MODULE_KEYS) {
|
|
132
|
-
const paramKeys = [
|
|
133
|
-
`inspector_module_${modKey}`,
|
|
134
|
-
`inapp_inspector_${modKey}`,
|
|
135
|
-
`inspector_${modKey}`,
|
|
136
|
-
`inapp_inspector_module_${modKey}`,
|
|
137
|
-
`rn_inspector_${modKey}`,
|
|
138
|
-
];
|
|
139
|
-
for (const pKey of paramKeys) {
|
|
140
|
-
let rawVal;
|
|
141
|
-
if (typeof rc.getValue === 'function') {
|
|
142
|
-
try {
|
|
143
|
-
rawVal = rc.getValue(pKey);
|
|
144
|
-
}
|
|
145
|
-
catch { }
|
|
146
|
-
}
|
|
147
|
-
else if (rc[pKey] !== undefined) {
|
|
148
|
-
rawVal = rc[pKey];
|
|
149
|
-
}
|
|
150
|
-
const boolVal = extractValue(rawVal);
|
|
151
|
-
if (typeof boolVal === 'boolean') {
|
|
152
|
-
result[modKey] = boolVal;
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (result.apis === undefined) {
|
|
158
|
-
result.apis = true;
|
|
159
|
-
}
|
|
160
|
-
return Object.keys(result).length > 0 ? result : null;
|
|
161
|
-
}
|
|
162
|
-
catch (error) {
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getFirebaseRemoteConfig=getFirebaseRemoteConfig,exports.isFirebaseRemoteConfigAvailable=isFirebaseRemoteConfigAvailable,exports.fetchRemoteConfigModuleStatus=fetchRemoteConfigModuleStatus;const MODULE_KEYS=["apis","logs","analytics","redux","storage","device","crash","bundle","performance","debugging"];let cachedRemoteConfigInstance=null;function getFirebaseRemoteConfig(t){if(t&&typeof t=="object")return cachedRemoteConfigInstance=t,t;if(cachedRemoteConfigInstance)return cachedRemoteConfigInstance;try{const n=require("@react-native-firebase/remote-config"),e=typeof n.default=="function"?n.default():typeof n=="function"?n():n;return cachedRemoteConfigInstance=e,e}catch{return null}}function isFirebaseRemoteConfigAvailable(t){return!!getFirebaseRemoteConfig(t)}function extractValue(t){if(t!=null){if(typeof t=="boolean")return t;if(typeof t=="number")return t!==0;if(typeof t=="string"){const n=t.trim().toLowerCase();if(n==="true"||n==="1"||n==="enabled"||n==="on")return!0;if(n==="false"||n==="0"||n==="disabled"||n==="off")return!1;try{return JSON.parse(t)}catch{return}}if(typeof t.asBoolean=="function")return t.asBoolean();if(typeof t.asString=="function"){const n=t.asString(),e=n.trim().toLowerCase();if(e==="true"||e==="1"||e==="enabled"||e==="on")return!0;if(e==="false"||e==="0"||e==="disabled"||e==="off")return!1;try{return JSON.parse(n)}catch{return}}}}async function fetchRemoteConfigModuleStatus(t,n=8e3){const e=getFirebaseRemoteConfig(t);if(!e)return null;try{const s=(async()=>{typeof e.fetchAndActivate=="function"?await e.fetchAndActivate():(typeof e.fetch=="function"&&await e.fetch(),typeof e.activate=="function"&&await e.activate())})(),a=new Promise((o,i)=>setTimeout(()=>i(new Error("Remote Config fetch timeout")),n));await Promise.race([s,a]).catch(()=>{});const c={},l=["inspector_modules","inapp_inspector_modules","react_native_inapp_inspector_modules"];for(const o of l){let i;if(typeof e.getValue=="function")try{i=e.getValue(o)}catch{}else e[o]!==void 0&&(i=e[o]);const r=extractValue(i);if(r&&typeof r=="object")for(const f of MODULE_KEYS)typeof r[f]=="boolean"&&(c[f]=r[f])}for(const o of MODULE_KEYS){const i=[`inspector_module_${o}`,`inapp_inspector_${o}`,`inspector_${o}`,`inapp_inspector_module_${o}`,`rn_inspector_${o}`];for(const r of i){let f;if(typeof e.getValue=="function")try{f=e.getValue(r)}catch{}else e[r]!==void 0&&(f=e[r]);const u=extractValue(f);if(typeof u=="boolean"){c[o]=u;break}}}return c.apis===void 0&&(c.apis=!0),Object.keys(c).length>0?c:null}catch{return null}}
|