flipper-plugin-react-native-mmkv-storage
Version:
Developer tools for React Native MMKV Storage
1 lines • 73.4 kB
Source Map (JSON)
{"version":3,"sources":["__prelude__","/Volumes/code/Projects/flipperplugins/flipper-plugin-react-native-mmkv-storage/node_modules/metro-runtime/src/polyfills/require.js","/Volumes/code/Projects/flipperplugins/flipper-plugin-react-native-mmkv-storage/src/index.tsx","/Volumes/code/Projects/flipperplugins/flipper-plugin-react-native-mmkv-storage/src/helpers.ts","/Volumes/code/Projects/flipperplugins/flipper-plugin-react-native-mmkv-storage/src/styles.ts"],"sourcesContent":["var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now(),__DEV__=true,process=this.process||{},__METRO_GLOBAL_PREFIX__='';process.env=process.env||{};process.env.NODE_ENV=process.env.NODE_ENV||\"development\";","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @polyfill\n *\n * @format\n */\n\"use strict\";\n/* eslint-disable no-bitwise */\n\nglobal.__r = metroRequire;\nglobal[`${__METRO_GLOBAL_PREFIX__}__d`] = define;\nglobal.__c = clear;\nglobal.__registerSegment = registerSegment;\nvar modules = clear(); // Don't use a Symbol here, it would pull in an extra polyfill with all sorts of\n// additional stuff (e.g. Array.from).\n\nconst EMPTY = {};\nconst { hasOwnProperty } = {};\n\nif (__DEV__) {\n global.$RefreshReg$ = () => {};\n\n global.$RefreshSig$ = () => (type) => type;\n}\n\nfunction clear() {\n modules = Object.create(null); // We return modules here so that we can assign an initial value to modules\n // when defining it. Otherwise, we would have to do \"let modules = null\",\n // which will force us to add \"nullthrows\" everywhere.\n\n return modules;\n}\n\nif (__DEV__) {\n var verboseNamesToModuleIds = Object.create(null);\n var initializingModuleIds = [];\n}\n\nfunction define(factory, moduleId, dependencyMap) {\n if (modules[moduleId] != null) {\n if (__DEV__) {\n // (We take `inverseDependencies` from `arguments` to avoid an unused\n // named parameter in `define` in production.\n const inverseDependencies = arguments[4]; // If the module has already been defined and the define method has been\n // called with inverseDependencies, we can hot reload it.\n\n if (inverseDependencies) {\n global.__accept(moduleId, factory, dependencyMap, inverseDependencies);\n }\n } // prevent repeated calls to `global.nativeRequire` to overwrite modules\n // that are already loaded\n\n return;\n }\n\n const mod = {\n dependencyMap,\n factory,\n hasError: false,\n importedAll: EMPTY,\n importedDefault: EMPTY,\n isInitialized: false,\n publicModule: {\n exports: {},\n },\n };\n modules[moduleId] = mod;\n\n if (__DEV__) {\n // HMR\n mod.hot = createHotReloadingObject(); // DEBUGGABLE MODULES NAMES\n // we take `verboseName` from `arguments` to avoid an unused named parameter\n // in `define` in production.\n\n const verboseName = arguments[3];\n\n if (verboseName) {\n mod.verboseName = verboseName;\n verboseNamesToModuleIds[verboseName] = moduleId;\n }\n }\n}\n\nfunction metroRequire(moduleId) {\n if (__DEV__ && typeof moduleId === \"string\") {\n const verboseName = moduleId;\n moduleId = verboseNamesToModuleIds[verboseName];\n\n if (moduleId == null) {\n throw new Error(`Unknown named module: \"${verboseName}\"`);\n } else {\n console.warn(\n `Requiring module \"${verboseName}\" by name is only supported for ` +\n \"debugging purposes and will BREAK IN PRODUCTION!\"\n );\n }\n } //$FlowFixMe: at this point we know that moduleId is a number\n\n const moduleIdReallyIsNumber = moduleId;\n\n if (__DEV__) {\n const initializingIndex = initializingModuleIds.indexOf(\n moduleIdReallyIsNumber\n );\n\n if (initializingIndex !== -1) {\n const cycle = initializingModuleIds\n .slice(initializingIndex)\n .map((id) => (modules[id] ? modules[id].verboseName : \"[unknown]\")); // We want to show A -> B -> A:\n\n cycle.push(cycle[0]);\n console.warn(\n `Require cycle: ${cycle.join(\" -> \")}\\n\\n` +\n \"Require cycles are allowed, but can result in uninitialized values. \" +\n \"Consider refactoring to remove the need for a cycle.\"\n );\n }\n }\n\n const module = modules[moduleIdReallyIsNumber];\n return module && module.isInitialized\n ? module.publicModule.exports\n : guardedLoadModule(moduleIdReallyIsNumber, module);\n}\n\nfunction metroImportDefault(moduleId) {\n if (__DEV__ && typeof moduleId === \"string\") {\n const verboseName = moduleId;\n moduleId = verboseNamesToModuleIds[verboseName];\n } //$FlowFixMe: at this point we know that moduleId is a number\n\n const moduleIdReallyIsNumber = moduleId;\n\n if (\n modules[moduleIdReallyIsNumber] &&\n modules[moduleIdReallyIsNumber].importedDefault !== EMPTY\n ) {\n return modules[moduleIdReallyIsNumber].importedDefault;\n }\n\n const exports = metroRequire(moduleIdReallyIsNumber);\n const importedDefault =\n exports && exports.__esModule ? exports.default : exports; // $FlowFixMe The metroRequire call above will throw if modules[id] is null\n\n return (modules[moduleIdReallyIsNumber].importedDefault = importedDefault);\n}\n\nmetroRequire.importDefault = metroImportDefault;\n\nfunction metroImportAll(moduleId) {\n if (__DEV__ && typeof moduleId === \"string\") {\n const verboseName = moduleId;\n moduleId = verboseNamesToModuleIds[verboseName];\n } //$FlowFixMe: at this point we know that moduleId is a number\n\n const moduleIdReallyIsNumber = moduleId;\n\n if (\n modules[moduleIdReallyIsNumber] &&\n modules[moduleIdReallyIsNumber].importedAll !== EMPTY\n ) {\n return modules[moduleIdReallyIsNumber].importedAll;\n }\n\n const exports = metroRequire(moduleIdReallyIsNumber);\n let importedAll;\n\n if (exports && exports.__esModule) {\n importedAll = exports;\n } else {\n importedAll = {}; // Refrain from using Object.assign, it has to work in ES3 environments.\n\n if (exports) {\n for (const key in exports) {\n if (hasOwnProperty.call(exports, key)) {\n importedAll[key] = exports[key];\n }\n }\n }\n\n importedAll.default = exports;\n } // $FlowFixMe The metroRequire call above will throw if modules[id] is null\n\n return (modules[moduleIdReallyIsNumber].importedAll = importedAll);\n}\n\nmetroRequire.importAll = metroImportAll;\nlet inGuard = false;\n\nfunction guardedLoadModule(moduleId, module) {\n if (!inGuard && global.ErrorUtils) {\n inGuard = true;\n let returnValue;\n\n try {\n returnValue = loadModuleImplementation(moduleId, module);\n } catch (e) {\n // TODO: (moti) T48204692 Type this use of ErrorUtils.\n global.ErrorUtils.reportFatalError(e);\n }\n\n inGuard = false;\n return returnValue;\n } else {\n return loadModuleImplementation(moduleId, module);\n }\n}\n\nconst ID_MASK_SHIFT = 16;\nconst LOCAL_ID_MASK = ~0 >>> ID_MASK_SHIFT;\n\nfunction unpackModuleId(moduleId) {\n const segmentId = moduleId >>> ID_MASK_SHIFT;\n const localId = moduleId & LOCAL_ID_MASK;\n return {\n segmentId,\n localId,\n };\n}\n\nmetroRequire.unpackModuleId = unpackModuleId;\n\nfunction packModuleId(value) {\n return (value.segmentId << ID_MASK_SHIFT) + value.localId;\n}\n\nmetroRequire.packModuleId = packModuleId;\nconst moduleDefinersBySegmentID = [];\nconst definingSegmentByModuleID = new Map();\n\nfunction registerSegment(segmentId, moduleDefiner, moduleIds) {\n moduleDefinersBySegmentID[segmentId] = moduleDefiner;\n\n if (__DEV__) {\n if (segmentId === 0 && moduleIds) {\n throw new Error(\n \"registerSegment: Expected moduleIds to be null for main segment\"\n );\n }\n\n if (segmentId !== 0 && !moduleIds) {\n throw new Error(\n \"registerSegment: Expected moduleIds to be passed for segment #\" +\n segmentId\n );\n }\n }\n\n if (moduleIds) {\n moduleIds.forEach((moduleId) => {\n if (!modules[moduleId] && !definingSegmentByModuleID.has(moduleId)) {\n definingSegmentByModuleID.set(moduleId, segmentId);\n }\n });\n }\n}\n\nfunction loadModuleImplementation(moduleId, module) {\n if (!module && moduleDefinersBySegmentID.length > 0) {\n var _definingSegmentByMod;\n\n const segmentId =\n (_definingSegmentByMod = definingSegmentByModuleID.get(moduleId)) !==\n null && _definingSegmentByMod !== void 0\n ? _definingSegmentByMod\n : 0;\n const definer = moduleDefinersBySegmentID[segmentId];\n\n if (definer != null) {\n definer(moduleId);\n module = modules[moduleId];\n definingSegmentByModuleID.delete(moduleId);\n }\n }\n\n const nativeRequire = global.nativeRequire;\n\n if (!module && nativeRequire) {\n const { segmentId, localId } = unpackModuleId(moduleId);\n nativeRequire(localId, segmentId);\n module = modules[moduleId];\n }\n\n if (!module) {\n throw unknownModuleError(moduleId);\n }\n\n if (module.hasError) {\n throw moduleThrewError(moduleId, module.error);\n }\n\n if (__DEV__) {\n var Systrace = requireSystrace();\n var Refresh = requireRefresh();\n } // We must optimistically mark module as initialized before running the\n // factory to keep any require cycles inside the factory from causing an\n // infinite require loop.\n\n module.isInitialized = true;\n const { factory, dependencyMap } = module;\n\n if (__DEV__) {\n initializingModuleIds.push(moduleId);\n }\n\n try {\n if (__DEV__) {\n // $FlowIgnore: we know that __DEV__ is const and `Systrace` exists\n Systrace.beginEvent(\"JS_require_\" + (module.verboseName || moduleId));\n }\n\n const moduleObject = module.publicModule;\n\n if (__DEV__) {\n moduleObject.hot = module.hot;\n var prevRefreshReg = global.$RefreshReg$;\n var prevRefreshSig = global.$RefreshSig$;\n\n if (Refresh != null) {\n const RefreshRuntime = Refresh;\n\n global.$RefreshReg$ = (type, id) => {\n RefreshRuntime.register(type, moduleId + \" \" + id);\n };\n\n global.$RefreshSig$ =\n RefreshRuntime.createSignatureFunctionForTransform;\n }\n }\n\n moduleObject.id = moduleId; // keep args in sync with with defineModuleCode in\n // metro/src/Resolver/index.js\n // and metro/src/ModuleGraph/worker.js\n\n factory(\n global,\n metroRequire,\n metroImportDefault,\n metroImportAll,\n moduleObject,\n moduleObject.exports,\n dependencyMap\n ); // avoid removing factory in DEV mode as it breaks HMR\n\n if (!__DEV__) {\n // $FlowFixMe: This is only sound because we never access `factory` again\n module.factory = undefined;\n module.dependencyMap = undefined;\n }\n\n if (__DEV__) {\n // $FlowIgnore: we know that __DEV__ is const and `Systrace` exists\n Systrace.endEvent();\n\n if (Refresh != null) {\n registerExportsForReactRefresh(Refresh, moduleObject.exports, moduleId);\n }\n }\n\n return moduleObject.exports;\n } catch (e) {\n module.hasError = true;\n module.error = e;\n module.isInitialized = false;\n module.publicModule.exports = undefined;\n throw e;\n } finally {\n if (__DEV__) {\n if (initializingModuleIds.pop() !== moduleId) {\n throw new Error(\n \"initializingModuleIds is corrupt; something is terribly wrong\"\n );\n }\n\n global.$RefreshReg$ = prevRefreshReg;\n global.$RefreshSig$ = prevRefreshSig;\n }\n }\n}\n\nfunction unknownModuleError(id) {\n let message = 'Requiring unknown module \"' + id + '\".';\n\n if (__DEV__) {\n message +=\n \" If you are sure the module exists, try restarting Metro. \" +\n \"You may also want to run `yarn` or `npm install`.\";\n }\n\n return Error(message);\n}\n\nfunction moduleThrewError(id, error) {\n const displayName = (__DEV__ && modules[id] && modules[id].verboseName) || id;\n return Error(\n 'Requiring module \"' + displayName + '\", which threw an exception: ' + error\n );\n}\n\nif (__DEV__) {\n metroRequire.Systrace = {\n beginEvent: () => {},\n endEvent: () => {},\n };\n\n metroRequire.getModules = () => {\n return modules;\n }; // HOT MODULE RELOADING\n\n var createHotReloadingObject = function () {\n const hot = {\n _acceptCallback: null,\n _disposeCallback: null,\n _didAccept: false,\n accept: (callback) => {\n hot._didAccept = true;\n hot._acceptCallback = callback;\n },\n dispose: (callback) => {\n hot._disposeCallback = callback;\n },\n };\n return hot;\n };\n\n let reactRefreshTimeout = null;\n\n const metroHotUpdateModule = function (\n id,\n factory,\n dependencyMap,\n inverseDependencies\n ) {\n const mod = modules[id];\n\n if (!mod) {\n if (factory) {\n // New modules are going to be handled by the define() method.\n return;\n }\n\n throw unknownModuleError(id);\n }\n\n if (!mod.hasError && !mod.isInitialized) {\n // The module hasn't actually been executed yet,\n // so we can always safely replace it.\n mod.factory = factory;\n mod.dependencyMap = dependencyMap;\n return;\n }\n\n const Refresh = requireRefresh();\n const refreshBoundaryIDs = new Set(); // In this loop, we will traverse the dependency tree upwards from the\n // changed module. Updates \"bubble\" up to the closest accepted parent.\n //\n // If we reach the module root and nothing along the way accepted the update,\n // we know hot reload is going to fail. In that case we return false.\n //\n // The main purpose of this loop is to figure out whether it's safe to apply\n // a hot update. It is only safe when the update was accepted somewhere\n // along the way upwards for each of its parent dependency module chains.\n //\n // We perform a topological sort because we may discover the same\n // module more than once in the list of things to re-execute, and\n // we want to execute modules before modules that depend on them.\n //\n // If we didn't have this check, we'd risk re-evaluating modules that\n // have side effects and lead to confusing and meaningless crashes.\n\n let didBailOut = false;\n const updatedModuleIDs = topologicalSort(\n [id], // Start with the changed module and go upwards\n (pendingID) => {\n const pendingModule = modules[pendingID];\n\n if (pendingModule == null) {\n // Nothing to do.\n return [];\n }\n\n const pendingHot = pendingModule.hot;\n\n if (pendingHot == null) {\n throw new Error(\n \"[Refresh] Expected module.hot to always exist in DEV.\"\n );\n } // A module can be accepted manually from within itself.\n\n let canAccept = pendingHot._didAccept;\n\n if (!canAccept && Refresh != null) {\n // Or React Refresh may mark it accepted based on exports.\n const isBoundary = isReactRefreshBoundary(\n Refresh,\n pendingModule.publicModule.exports\n );\n\n if (isBoundary) {\n canAccept = true;\n refreshBoundaryIDs.add(pendingID);\n }\n }\n\n if (canAccept) {\n // Don't look at parents.\n return [];\n } // If we bubble through the roof, there is no way to do a hot update.\n // Bail out altogether. This is the failure case.\n\n const parentIDs = inverseDependencies[pendingID];\n\n if (parentIDs.length === 0) {\n // Reload the app because the hot reload can't succeed.\n // This should work both on web and React Native.\n performFullRefresh(\"No root boundary\", {\n source: mod,\n failed: pendingModule,\n });\n didBailOut = true;\n return [];\n } // This module can't handle the update but maybe all its parents can?\n // Put them all in the queue to run the same set of checks.\n\n return parentIDs;\n },\n () => didBailOut // Should we stop?\n ).reverse();\n\n if (didBailOut) {\n return;\n } // If we reached here, it is likely that hot reload will be successful.\n // Run the actual factories.\n\n const seenModuleIDs = new Set();\n\n for (let i = 0; i < updatedModuleIDs.length; i++) {\n // Don't process twice if we have a cycle.\n const updatedID = updatedModuleIDs[i];\n\n if (seenModuleIDs.has(updatedID)) {\n continue;\n }\n\n seenModuleIDs.add(updatedID);\n const updatedMod = modules[updatedID];\n\n if (updatedMod == null) {\n throw new Error(\"[Refresh] Expected to find the updated module.\");\n }\n\n const prevExports = updatedMod.publicModule.exports;\n const didError = runUpdatedModule(\n updatedID,\n updatedID === id ? factory : undefined,\n updatedID === id ? dependencyMap : undefined\n );\n const nextExports = updatedMod.publicModule.exports;\n\n if (didError) {\n // The user was shown a redbox about module initialization.\n // There's nothing for us to do here until it's fixed.\n return;\n }\n\n if (refreshBoundaryIDs.has(updatedID)) {\n // Since we just executed the code for it, it's possible\n // that the new exports make it ineligible for being a boundary.\n const isNoLongerABoundary = !isReactRefreshBoundary(\n Refresh,\n nextExports\n ); // It can also become ineligible if its exports are incompatible\n // with the previous exports.\n // For example, if you add/remove/change exports, we'll want\n // to re-execute the importing modules, and force those components\n // to re-render. Similarly, if you convert a class component\n // to a function, we want to invalidate the boundary.\n\n const didInvalidate = shouldInvalidateReactRefreshBoundary(\n Refresh,\n prevExports,\n nextExports\n );\n\n if (isNoLongerABoundary || didInvalidate) {\n // We'll be conservative. The only case in which we won't do a full\n // reload is if all parent modules are also refresh boundaries.\n // In that case we'll add them to the current queue.\n const parentIDs = inverseDependencies[updatedID];\n\n if (parentIDs.length === 0) {\n // Looks like we bubbled to the root. Can't recover from that.\n performFullRefresh(\n isNoLongerABoundary\n ? \"No longer a boundary\"\n : \"Invalidated boundary\",\n {\n source: mod,\n failed: updatedMod,\n }\n );\n return;\n } // Schedule all parent refresh boundaries to re-run in this loop.\n\n for (let j = 0; j < parentIDs.length; j++) {\n const parentID = parentIDs[j];\n const parentMod = modules[parentID];\n\n if (parentMod == null) {\n throw new Error(\"[Refresh] Expected to find parent module.\");\n }\n\n const canAcceptParent = isReactRefreshBoundary(\n Refresh,\n parentMod.publicModule.exports\n );\n\n if (canAcceptParent) {\n // All parents will have to re-run too.\n refreshBoundaryIDs.add(parentID);\n updatedModuleIDs.push(parentID);\n } else {\n performFullRefresh(\"Invalidated boundary\", {\n source: mod,\n failed: parentMod,\n });\n return;\n }\n }\n }\n }\n }\n\n if (Refresh != null) {\n // Debounce a little in case there are multiple updates queued up.\n // This is also useful because __accept may be called multiple times.\n if (reactRefreshTimeout == null) {\n reactRefreshTimeout = setTimeout(() => {\n reactRefreshTimeout = null; // Update React components.\n\n Refresh.performReactRefresh();\n }, 30);\n }\n }\n };\n\n const topologicalSort = function (roots, getEdges, earlyStop) {\n const result = [];\n const visited = new Set();\n\n function traverseDependentNodes(node) {\n visited.add(node);\n const dependentNodes = getEdges(node);\n\n if (earlyStop(node)) {\n return;\n }\n\n dependentNodes.forEach((dependent) => {\n if (visited.has(dependent)) {\n return;\n }\n\n traverseDependentNodes(dependent);\n });\n result.push(node);\n }\n\n roots.forEach((root) => {\n if (!visited.has(root)) {\n traverseDependentNodes(root);\n }\n });\n return result;\n };\n\n const runUpdatedModule = function (id, factory, dependencyMap) {\n const mod = modules[id];\n\n if (mod == null) {\n throw new Error(\"[Refresh] Expected to find the module.\");\n }\n\n const { hot } = mod;\n\n if (!hot) {\n throw new Error(\"[Refresh] Expected module.hot to always exist in DEV.\");\n }\n\n if (hot._disposeCallback) {\n try {\n hot._disposeCallback();\n } catch (error) {\n console.error(\n `Error while calling dispose handler for module ${id}: `,\n error\n );\n }\n }\n\n if (factory) {\n mod.factory = factory;\n }\n\n if (dependencyMap) {\n mod.dependencyMap = dependencyMap;\n }\n\n mod.hasError = false;\n mod.error = undefined;\n mod.importedAll = EMPTY;\n mod.importedDefault = EMPTY;\n mod.isInitialized = false;\n const prevExports = mod.publicModule.exports;\n mod.publicModule.exports = {};\n hot._didAccept = false;\n hot._acceptCallback = null;\n hot._disposeCallback = null;\n metroRequire(id);\n\n if (mod.hasError) {\n // This error has already been reported via a redbox.\n // We know it's likely a typo or some mistake that was just introduced.\n // Our goal now is to keep the rest of the application working so that by\n // the time user fixes the error, the app isn't completely destroyed\n // underneath the redbox. So we'll revert the module object to the last\n // successful export and stop propagating this update.\n mod.hasError = false;\n mod.isInitialized = true;\n mod.error = null;\n mod.publicModule.exports = prevExports; // We errored. Stop the update.\n\n return true;\n }\n\n if (hot._acceptCallback) {\n try {\n hot._acceptCallback();\n } catch (error) {\n console.error(\n `Error while calling accept handler for module ${id}: `,\n error\n );\n }\n } // No error.\n\n return false;\n };\n\n const performFullRefresh = (reason, modules) => {\n /* global window */\n if (\n typeof window !== \"undefined\" &&\n window.location != null &&\n typeof window.location.reload === \"function\"\n ) {\n window.location.reload();\n } else {\n const Refresh = requireRefresh();\n\n if (Refresh != null) {\n var _modules$source$verbo,\n _modules$source,\n _modules$failed$verbo,\n _modules$failed;\n\n const sourceName =\n (_modules$source$verbo =\n (_modules$source = modules.source) === null ||\n _modules$source === void 0\n ? void 0\n : _modules$source.verboseName) !== null &&\n _modules$source$verbo !== void 0\n ? _modules$source$verbo\n : \"unknown\";\n const failedName =\n (_modules$failed$verbo =\n (_modules$failed = modules.failed) === null ||\n _modules$failed === void 0\n ? void 0\n : _modules$failed.verboseName) !== null &&\n _modules$failed$verbo !== void 0\n ? _modules$failed$verbo\n : \"unknown\";\n Refresh.performFullRefresh(\n `Fast Refresh - ${reason} <${sourceName}> <${failedName}>`\n );\n } else {\n console.warn(\"Could not reload the application after an edit.\");\n }\n }\n }; // Modules that only export components become React Refresh boundaries.\n\n var isReactRefreshBoundary = function (Refresh, moduleExports) {\n if (Refresh.isLikelyComponentType(moduleExports)) {\n return true;\n }\n\n if (moduleExports == null || typeof moduleExports !== \"object\") {\n // Exit if we can't iterate over exports.\n return false;\n }\n\n let hasExports = false;\n let areAllExportsComponents = true;\n\n for (const key in moduleExports) {\n hasExports = true;\n\n if (key === \"__esModule\") {\n continue;\n }\n\n const desc = Object.getOwnPropertyDescriptor(moduleExports, key);\n\n if (desc && desc.get) {\n // Don't invoke getters as they may have side effects.\n return false;\n }\n\n const exportValue = moduleExports[key];\n\n if (!Refresh.isLikelyComponentType(exportValue)) {\n areAllExportsComponents = false;\n }\n }\n\n return hasExports && areAllExportsComponents;\n };\n\n var shouldInvalidateReactRefreshBoundary = (\n Refresh,\n prevExports,\n nextExports\n ) => {\n const prevSignature = getRefreshBoundarySignature(Refresh, prevExports);\n const nextSignature = getRefreshBoundarySignature(Refresh, nextExports);\n\n if (prevSignature.length !== nextSignature.length) {\n return true;\n }\n\n for (let i = 0; i < nextSignature.length; i++) {\n if (prevSignature[i] !== nextSignature[i]) {\n return true;\n }\n }\n\n return false;\n }; // When this signature changes, it's unsafe to stop at this refresh boundary.\n\n var getRefreshBoundarySignature = (Refresh, moduleExports) => {\n const signature = [];\n signature.push(Refresh.getFamilyByType(moduleExports));\n\n if (moduleExports == null || typeof moduleExports !== \"object\") {\n // Exit if we can't iterate over exports.\n // (This is important for legacy environments.)\n return signature;\n }\n\n for (const key in moduleExports) {\n if (key === \"__esModule\") {\n continue;\n }\n\n const desc = Object.getOwnPropertyDescriptor(moduleExports, key);\n\n if (desc && desc.get) {\n continue;\n }\n\n const exportValue = moduleExports[key];\n signature.push(key);\n signature.push(Refresh.getFamilyByType(exportValue));\n }\n\n return signature;\n };\n\n var registerExportsForReactRefresh = (Refresh, moduleExports, moduleID) => {\n Refresh.register(moduleExports, moduleID + \" %exports%\");\n\n if (moduleExports == null || typeof moduleExports !== \"object\") {\n // Exit if we can't iterate over exports.\n // (This is important for legacy environments.)\n return;\n }\n\n for (const key in moduleExports) {\n const desc = Object.getOwnPropertyDescriptor(moduleExports, key);\n\n if (desc && desc.get) {\n // Don't invoke getters as they may have side effects.\n continue;\n }\n\n const exportValue = moduleExports[key];\n const typeID = moduleID + \" %exports% \" + key;\n Refresh.register(exportValue, typeID);\n }\n };\n\n global.__accept = metroHotUpdateModule;\n}\n\nif (__DEV__) {\n // The metro require polyfill can not have module dependencies.\n // The Systrace and ReactRefresh dependencies are, therefore, made publicly\n // available. Ideally, the dependency would be inversed in a way that\n // Systrace / ReactRefresh could integrate into Metro rather than\n // having to make them publicly available.\n var requireSystrace = function requireSystrace() {\n return (\n global[__METRO_GLOBAL_PREFIX__ + \"__SYSTRACE\"] || metroRequire.Systrace\n );\n };\n\n var requireRefresh = function requireRefresh() {\n return (\n global[__METRO_GLOBAL_PREFIX__ + \"__ReactRefresh\"] || metroRequire.Refresh\n );\n };\n}\n","import {EditOutlined} from '@ant-design/icons';\nimport {Button, Input, Modal, Select, Typography} from 'antd';\nimport {\n CodeBlock,\n DataTable,\n DetailSidebar,\n Layout,\n Panel,\n createDataSource,\n createState,\n theme,\n usePlugin,\n useValue,\n} from 'flipper-plugin';\nimport React, {useEffect, useState} from 'react';\nimport {\n BOOLEAN_OPTIONS,\n MAIN_COLUMNS,\n SIDEBAR_COLUMNS,\n getRowStyle,\n isNumeric,\n} from './helpers';\nimport styles from './styles';\nimport type {PluginClient} from 'flipper-plugin';\n\nexport function plugin(client: PluginClient<Events, Methods>) {\n const data = createDataSource<Data, 'dkey'>([], {key: 'dkey'});\n const supportStatus = createState<string | null>(null);\n const selectedDataID = createState<string | null>(null);\n const showEditDialog = createState(false);\n\n client.onConnect(() => {\n console.log('connected');\n });\n\n client.onMessage('newData', newData => {\n data.append({\n ...newData,\n dkey: newData.instanceID + newData.key + newData.time,\n });\n });\n\n client.onMessage('supportStatus', status => {\n if (status.reason) {\n supportStatus.set(status.reason);\n } else {\n supportStatus.set(null);\n }\n });\n\n client.addMenuEntry({\n action: 'clear',\n handler: () => {\n data.clear();\n },\n });\n\n function clearLogs() {\n data.clear();\n }\n\n function onSelect(d: string | null) {\n selectedDataID.set(d);\n }\n\n function openEditDialog() {\n showEditDialog.set(true);\n }\n\n function closeEditDialog() {\n showEditDialog.set(false);\n }\n\n function onEditValue(newValue: unknown) {\n const id = selectedDataID.get();\n if (id) {\n const d = data.getById(id);\n if (d) {\n void client.send('editValue', {data: d, newValue});\n showEditDialog.set(false);\n selectedDataID.set(null);\n }\n }\n }\n\n function onDelete() {\n const id = selectedDataID.get();\n if (id) {\n const d = data.getById(id);\n if (d) {\n void client.send('deleteItem', {data: d});\n showEditDialog.set(false);\n selectedDataID.set(null);\n }\n }\n }\n\n return {\n data,\n supportStatus,\n selectedDataID,\n showEditDialog,\n onEditValue,\n onDelete,\n onSelect,\n openEditDialog,\n closeEditDialog,\n clearLogs,\n };\n}\n\nexport function Component() {\n const instance = usePlugin(plugin);\n const supportStatus = useValue(instance.supportStatus);\n const extraActions = (\n <Layout.Horizontal gap>\n <Button title=\"Clear logs\" onClick={instance.clearLogs}>\n Clear logs\n </Button>\n </Layout.Horizontal>\n );\n\n return (\n <Layout.Container grow>\n {!!supportStatus && (\n <Layout.Container pad style={styles.errorBG}>\n <Typography.Text style={styles.whiteText}>\n {supportStatus}\n </Typography.Text>\n </Layout.Container>\n )}\n <DataTable\n enableAutoScroll\n columns={MAIN_COLUMNS}\n dataSource={instance.data}\n enableHorizontalScroll={false}\n extraActions={extraActions}\n onRowStyle={getRowStyle}\n onSelect={record => {\n if (record) {\n instance.onSelect(record.time);\n } else {\n instance.onSelect(null);\n }\n }}\n />\n <DetailSidebar>\n <Sidebar />\n </DetailSidebar>\n <EditModal />\n </Layout.Container>\n );\n}\n\nfunction EditModal() {\n const instance = usePlugin(plugin);\n const showEditDialog = useValue(instance.showEditDialog);\n const selectedDataID = useValue(instance.selectedDataID);\n const [selectedData, setSelectedData] = useState<Data | null>(null);\n const [newBoolValue, setNewBoolValue] = useState(true);\n const [newStringValue, setNewStringValue] = useState('');\n const [errorText, setErrorText] = useState('');\n\n useEffect(() => {\n if (selectedDataID) {\n const d = instance.data.getById(selectedDataID);\n if (d) {\n setNewValue(d);\n setSelectedData(d);\n } else {\n setSelectedData(null);\n }\n } else {\n setSelectedData(null);\n }\n }, [selectedDataID]);\n\n function setNewValue(d: Data) {\n switch (typeof d.value) {\n case 'boolean':\n setNewBoolValue(d.value);\n break;\n case 'string':\n case 'number':\n setNewStringValue(`${d.value}`);\n break;\n case 'object':\n setNewStringValue(JSON.stringify(d.value, null, 2));\n break;\n default:\n break;\n }\n }\n\n function onOK() {\n if (selectedData) {\n switch (selectedData.type) {\n case 'boolean':\n instance.onEditValue(newBoolValue);\n break;\n case 'string':\n instance.onEditValue(newStringValue);\n break;\n case 'number':\n if (isNumeric(newStringValue)) {\n instance.onEditValue(parseFloat(newStringValue));\n } else {\n setErrorText('Your input is not number!');\n }\n break;\n case 'array':\n {\n try {\n const arr = JSON.parse(newStringValue);\n if (Array.isArray(arr)) {\n instance.onEditValue(arr);\n } else {\n setErrorText(\"Syntax error: this isn't an array!\");\n }\n } catch (error) {\n if (error instanceof Error) {\n setErrorText('Syntax error: ' + error.message);\n } else {\n setErrorText('Syntax error');\n }\n }\n }\n break;\n case 'object':\n {\n try {\n const obj = JSON.parse(newStringValue);\n if (typeof obj === 'object' && !Array.isArray(obj)) {\n instance.onEditValue(obj);\n } else {\n setErrorText(\"Syntax error: this isn't an object!\");\n }\n } catch (error) {\n if (error instanceof Error) {\n setErrorText('Syntax error: ' + error.message);\n } else {\n setErrorText('Syntax error');\n }\n }\n }\n break;\n default:\n break;\n }\n }\n }\n\n function onCancel() {\n instance.closeEditDialog();\n setErrorText('');\n if (selectedData) {\n setNewValue(selectedData);\n }\n }\n\n const onChangeNumber = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (isNumeric(e.target.value)) {\n setErrorText('');\n setNewStringValue(e.target.value);\n }\n };\n\n const onChangeString = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setErrorText('');\n setNewStringValue(e.target.value);\n };\n\n return (\n <Modal\n title=\"Edit value\"\n visible={showEditDialog}\n onCancel={onCancel}\n onOk={onOK}>\n <Typography.Text>Instance ID: {selectedData?.instanceID}</Typography.Text>\n <br />\n <Typography.Text>Key: {selectedData?.key}</Typography.Text>\n <br />\n <Typography.Text>Type: {selectedData?.type}</Typography.Text>\n <br />\n <Typography.Text style={styles.yellowText}>\n Make sure you enter correct type of value!\n </Typography.Text>\n <br />\n <br />\n {selectedData?.type === 'boolean' && (\n <Select\n options={BOOLEAN_OPTIONS}\n value={newBoolValue}\n onChange={v => {\n setNewBoolValue(v);\n }}\n />\n )}\n {selectedData?.type === 'number' && (\n <Input value={newStringValue} onChange={onChangeNumber} />\n )}\n {(selectedData?.type === 'string' ||\n selectedData?.type === 'array' ||\n selectedData?.type === 'object') && (\n <Input.TextArea\n autoSize={{minRows: 2, maxRows: 6}}\n style={selectedData.type !== 'string' ? theme.monospace : undefined}\n value={newStringValue}\n onChange={onChangeString}\n />\n )}\n {!!errorText && (\n <Typography.Text style={styles.errorBold}>{errorText}</Typography.Text>\n )}\n <br />\n <br />\n <Button danger onClick={instance.onDelete}>\n Delete item\n </Button>\n </Modal>\n );\n}\n\nfunction Sidebar() {\n const instance = usePlugin(plugin);\n const selectedDataID = useValue(instance.selectedDataID);\n\n if (!selectedDataID) {\n return NoRecord;\n }\n\n const selectedData = instance.data.getById(selectedDataID);\n\n if (!selectedData) {\n return NoRecord;\n }\n\n const records =\n selectedData.mode === 'DELETE'\n ? [\n {key: 'Instance ID', value: selectedData.instanceID},\n {key: 'Mode', value: selectedData.mode},\n {key: 'Key', value: selectedData.key},\n ]\n : [\n {key: 'Instance ID', value: selectedData.instanceID},\n {key: 'Mode', value: selectedData.mode},\n {key: 'Key', value: selectedData.key},\n {key: 'Type', value: selectedData.type},\n ];\n\n function parsedValue() {\n const v = selectedData?.value;\n const t = selectedData?.type;\n if (v === null) {\n return 'null';\n }\n if (v === undefined) {\n return 'undefined';\n }\n switch (t) {\n case 'array':\n case 'object':\n return JSON.stringify(v, null, 2);\n case 'boolean':\n if (v) {\n return 'true';\n }\n return 'false';\n case 'number':\n return `${v as number}`;\n case 'string':\n return v as string;\n default:\n return '';\n }\n }\n\n return (\n <Layout.Container grow>\n <DataTable\n columns={SIDEBAR_COLUMNS}\n enableHorizontalScroll={false}\n enableSearchbar={false}\n records={records}\n scrollable={false}\n />\n {selectedData.mode !== 'DELETE' && (\n <Panel\n pad\n collapsible={false}\n extraActions={\n <EditOutlined\n title=\"Edit this value\"\n onClick={instance.openEditDialog}\n />\n }\n title=\"Value\">\n <CodeBlock>{parsedValue()}</CodeBlock>\n </Panel>\n )}\n </Layout.Container>\n );\n}\n\nconst NoRecord = (\n <Layout.Container center grow pad>\n <Typography.Text type=\"secondary\">No record selected</Typography.Text>\n </Layout.Container>\n);\n","import styles from './styles';\nimport type {DataTableColumn} from 'flipper-plugin';\n\nexport function isNumeric(str: string) {\n if (typeof str !== 'string') return false; // we only process strings!\n return (\n //@ts-ignore\n !isNaN(str) && // use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)...\n !isNaN(parseFloat(str))\n ); // ...and ensure strings of whitespace fail\n}\n\nexport function getRowStyle(row: Data) {\n return row.mode === 'DELETE' ? styles.error : undefined;\n}\n\nexport const BOOLEAN_OPTIONS = [\n {label: 'true', value: true},\n {label: 'false', value: false},\n];\n\nexport const SIDEBAR_COLUMNS: DataTableColumn[] = [\n {\n key: 'key',\n width: 100,\n title: 'Title',\n },\n {\n key: 'value',\n title: 'Value',\n wrap: true,\n },\n];\n\nexport const MAIN_COLUMNS: DataTableColumn<Data>[] = [\n {\n key: 'time',\n title: 'Time',\n formatters: (value: string) => {\n const d = new Date(value);\n return d.toLocaleString();\n },\n },\n {\n key: 'instanceID',\n title: 'Instance ID',\n width: 120,\n },\n {\n key: 'mode',\n title: 'Mode',\n width: 80,\n },\n {\n key: 'key',\n title: 'Key',\n width: 120,\n },\n {\n key: 'type',\n title: 'Type',\n width: 80,\n },\n {\n key: 'value',\n title: 'Value',\n },\n];\n","import {theme} from 'flipper-plugin';\n\nconst styles = {\n error: {\n color: theme.errorColor,\n },\n errorBold: {\n color: theme.errorColor,\n fontWeight: 'bold',\n },\n errorBG: {\n backgroundColor: theme.errorColor,\n },\n whiteText: {\n color: 'white',\n },\n yellowText: {\n color: 'yellow',\n },\n};\n\nexport default styles;\n"],"names":["global","__r","metroRequire","__METRO_GLOBAL_PREFIX__","define","__c","clear","__registerSegment","registerSegment","modules","EMPTY","hasOwnProperty","__DEV__","$RefreshReg$","$RefreshSig$","type","Object","create","verboseNamesToModuleIds","initializingModuleIds","factory","moduleId","dependencyMap","inverseDependencies","arguments","__accept","mod","hasError","importedAll","importedDefault","isInitialized","publicModule","exports","hot","createHotReloadingObject","verboseName","Error","console","warn","moduleIdReallyIsNumber","initializingIndex","indexOf","cycle","slice","map","id","push","join","module","guardedLoadModule","metroImportDefault","__esModule","default","importDefault","metroImportAll","key","call","importAll","inGuard","ErrorUtils","returnValue","loadModuleImplementation","e","reportFatalError","ID_MASK_SHIFT","LOCAL_ID_MASK","unpackModuleId","segmentId","localId","packModuleId","value","moduleDefinersBySegmentID","definingSegmentByModuleID","Map","moduleDefiner","moduleIds","forEach","has","set","length","_definingSegmentByMod","get","definer","delete","nativeRequire","unknownModuleError","moduleThrewError","error","Systrace","requireSystrace","Refresh","requireRefresh","beginEvent","moduleObject","prevRefreshReg","prevRefreshSig","RefreshRuntime","register","createSignatureFunctionForTransform","undefined","endEvent","registerExportsForReactRefresh","pop","message","displayName","getModules","_acceptCallback","_disposeCallback","_didAccept","accept","callback","dispose","reactRefreshTimeout","metroHotUpdateModule","refreshBoundaryIDs","Set","didBailOut","updatedModuleIDs","topologicalSort","pendingID","pendingModule","pendingHot","canAccept","isBoundary","isReactRefreshBoundary","add","parentIDs","performFullRefresh","source","failed","reverse","seenModuleIDs","i","updatedID","updatedMod","prevExports","didError","runUpdatedModule","nextExports","isNoLongerABoundary","didInvalidate","shouldInvalidateReactRefreshBoundary","j","parentID","parentMod","canAcceptParent","setTimeout","performReactRefresh","roots","getEdges","earlyStop","result","visited","traverseDependentNodes","node","dependentNodes","dependent","root","reason","window","location","reload","_modules$source$verbo","_modules$source","_modules$failed$verbo","_modules$failed","sourceName","failedName","moduleExports","isLikelyComponentType","hasExports","areAllExportsComponents","desc","getOwnPropertyDescriptor","exportValue","prevSignature","getRefreshBoundarySignature","nextSignature","signature","getFamilyByType","moduleID","typeID","plugin","client","data","createDataSource","supportStatus","createState","selectedDataID","showEditDialog","onConnect","log","onMessage","newData","append","dkey","instanceID","time","status","addMenuEntry","action","handler","clearLogs","onSelect","d","openEditDialog","closeEditDialog","onEditValue","newValue","getById","send","onDelete","Component","instance","usePlugin","useValue","extraActions","styles","errorBG","whiteText","MAIN_COLUMNS","getRowStyle","record","EditModal","selectedData","setSelectedData","useState","newBoolValue","setNewBoolValue","newStringValue","setNewStringValue","errorText","setErrorText","useEffect","setNewValue","JSON","stringify","onOK","isNumeric","parseFloat","arr","parse","Array","isArray","obj","onCancel","onChangeNumber","target","onChangeString","yellowText","BOOLEAN_OPTIONS","v","minRows","maxRows","theme","monospace","errorBold","Sidebar","NoRecord","records","mode","parsedValue","t","SIDEBAR_COLUMNS","str","isNaN","row","label","width","title","wrap","formatters","Date","toLocaleString","color","errorColor","fontWeight","backgroundColor"],"mappings":";;ECUA;;EAGAA,MAAM,CAACC,GAAP,GAAaC,YAAb;EACAF,MAAM,CAAE,GAAEG,uBAAwB,KAA5B,CAAN,GAA0CC,MAA1C;EACAJ,MAAM,CAACK,GAAP,GAAaC,KAAb;EACAN,MAAM,CAACO,iBAAP,GAA2BC,eAA3B;EACA,IAAIC,OAAO,GAAGH,KAAK,EAAnB;EAGA,MAAMI,KAAK,GAAG,EAAd;EACA,MAAM;IAAEC;EAAF,IAAqB,EAA3B;;EAEA,IAAIC,OAAJ,EAAa;IACXZ,MAAM,CAACa,YAAP,GAAsB,MAAM,CAAE,CAA9B;;IAEAb,MAAM,CAACc,YAAP,GAAsB,MAAOC,IAAD,IAAUA,IAAtC;EACD;;EAED,SAAST,KAAT,GAAiB;IACfG,OAAO,GAAGO,MAAM,CAACC,MAAP,CAAc,IAAd,CAAV;IAIA,OAAOR,OAAP;EACD;;EAED,IAAIG,OAAJ,EAAa;IACX,IAAIM,uBAAuB,GAAGF,MAAM,CAACC,MAAP,CAAc,IAAd,CAA9B;IACA,IAAIE,qBAAqB,GAAG,EAA5B;EACD;;EAED,SAASf,MAAT,CAAgBgB,OAAhB,EAAyBC,QAAzB,EAAmCC,aAAnC,EAAkD;IAChD,IAAIb,OAAO,CAACY,QAAD,CAAP,IAAqB,IAAzB,EAA+B;MAC7B,IAAIT,OAAJ,EAAa;QAGX,MAAMW,mBAAmB,GAAGC,SAAS,CAAC,CAAD,CAArC;;QAGA,IAAID,mBAAJ,EAAyB;UACvBvB,MAAM,CAACyB,QAAP,CAAgBJ,QAAhB,EAA0BD,OAA1B,EAAmCE,aAAnC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