選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

849 行
27 KiB

  1. (window["webpackJsonp"] = window["webpackJsonp"] || []).push([["static/runtime/react-refresh.js"],{
  2. /***/ "./node_modules/@next/react-refresh-utils/internal/helpers.js":
  3. /*!********************************************************************!*\
  4. !*** ./node_modules/@next/react-refresh-utils/internal/helpers.js ***!
  5. \********************************************************************/
  6. /*! no static exports found */
  7. /***/ (function(module, exports, __webpack_require__) {
  8. "use strict";
  9. /**
  10. * MIT License
  11. *
  12. * Copyright (c) Facebook, Inc. and its affiliates.
  13. *
  14. * Permission is hereby granted, free of charge, to any person obtaining a copy
  15. * of this software and associated documentation files (the "Software"), to deal
  16. * in the Software without restriction, including without limitation the rights
  17. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  18. * copies of the Software, and to permit persons to whom the Software is
  19. * furnished to do so, subject to the following conditions:
  20. *
  21. * The above copyright notice and this permission notice shall be included in all
  22. * copies or substantial portions of the Software.
  23. *
  24. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  25. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  26. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  27. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  28. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  29. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30. * SOFTWARE.
  31. */
  32. var __importDefault = (this && this.__importDefault) || function (mod) {
  33. return (mod && mod.__esModule) ? mod : { "default": mod };
  34. };
  35. exports.__esModule = true;
  36. // This file is copied from the Metro JavaScript bundler, with minor tweaks for
  37. // webpack 4 compatibility.
  38. //
  39. // https://github.com/facebook/metro/blob/d6b9685c730d0d63577db40f41369157f28dfa3a/packages/metro/src/lib/polyfills/require.js
  40. var runtime_1 = __importDefault(__webpack_require__(/*! react-refresh/runtime */ "./node_modules/react-refresh/runtime.js"));
  41. function registerExportsForReactRefresh(moduleExports, moduleID) {
  42. runtime_1["default"].register(moduleExports, moduleID + ' %exports%');
  43. if (moduleExports == null || typeof moduleExports !== 'object') {
  44. // Exit if we can't iterate over exports.
  45. // (This is important for legacy environments.)
  46. return;
  47. }
  48. for (var key in moduleExports) {
  49. var exportValue = moduleExports[key];
  50. var typeID = moduleID + ' %exports% ' + key;
  51. runtime_1["default"].register(exportValue, typeID);
  52. }
  53. }
  54. function isReactRefreshBoundary(moduleExports) {
  55. if (runtime_1["default"].isLikelyComponentType(moduleExports)) {
  56. return true;
  57. }
  58. if (moduleExports == null || typeof moduleExports !== 'object') {
  59. // Exit if we can't iterate over exports.
  60. return false;
  61. }
  62. var hasExports = false;
  63. var areAllExportsComponents = true;
  64. for (var key in moduleExports) {
  65. hasExports = true;
  66. if (key === '__esModule') {
  67. continue;
  68. }
  69. var exportValue = moduleExports[key];
  70. if (!runtime_1["default"].isLikelyComponentType(exportValue)) {
  71. areAllExportsComponents = false;
  72. }
  73. }
  74. return hasExports && areAllExportsComponents;
  75. }
  76. function shouldInvalidateReactRefreshBoundary(prevExports, nextExports) {
  77. var prevSignature = getRefreshBoundarySignature(prevExports);
  78. var nextSignature = getRefreshBoundarySignature(nextExports);
  79. if (prevSignature.length !== nextSignature.length) {
  80. return true;
  81. }
  82. for (var i = 0; i < nextSignature.length; i++) {
  83. if (prevSignature[i] !== nextSignature[i]) {
  84. return true;
  85. }
  86. }
  87. return false;
  88. }
  89. function getRefreshBoundarySignature(moduleExports) {
  90. var signature = [];
  91. signature.push(runtime_1["default"].getFamilyByType(moduleExports));
  92. if (moduleExports == null || typeof moduleExports !== 'object') {
  93. // Exit if we can't iterate over exports.
  94. // (This is important for legacy environments.)
  95. return signature;
  96. }
  97. for (var key in moduleExports) {
  98. if (key === '__esModule') {
  99. continue;
  100. }
  101. var exportValue = moduleExports[key];
  102. signature.push(key);
  103. signature.push(runtime_1["default"].getFamilyByType(exportValue));
  104. }
  105. return signature;
  106. }
  107. var isUpdateScheduled = false;
  108. function scheduleUpdate() {
  109. if (isUpdateScheduled) {
  110. return;
  111. }
  112. function canApplyUpdate() {
  113. return module.hot.status() === 'idle';
  114. }
  115. isUpdateScheduled = true;
  116. setTimeout(function () {
  117. isUpdateScheduled = false;
  118. // Only trigger refresh if the webpack HMR state is idle
  119. if (canApplyUpdate()) {
  120. return runtime_1["default"].performReactRefresh();
  121. }
  122. return scheduleUpdate();
  123. }, 30);
  124. }
  125. exports["default"] = {
  126. registerExportsForReactRefresh: registerExportsForReactRefresh,
  127. isReactRefreshBoundary: isReactRefreshBoundary,
  128. shouldInvalidateReactRefreshBoundary: shouldInvalidateReactRefreshBoundary,
  129. getRefreshBoundarySignature: getRefreshBoundarySignature,
  130. scheduleUpdate: scheduleUpdate
  131. };
  132. /***/ }),
  133. /***/ "./node_modules/@next/react-refresh-utils/runtime.js":
  134. /*!***********************************************************!*\
  135. !*** ./node_modules/@next/react-refresh-utils/runtime.js ***!
  136. \***********************************************************/
  137. /*! no static exports found */
  138. /***/ (function(module, exports, __webpack_require__) {
  139. "use strict";
  140. var __importDefault = (this && this.__importDefault) || function (mod) {
  141. return (mod && mod.__esModule) ? mod : { "default": mod };
  142. };
  143. exports.__esModule = true;
  144. var runtime_1 = __importDefault(__webpack_require__(/*! react-refresh/runtime */ "./node_modules/react-refresh/runtime.js"));
  145. var helpers_1 = __importDefault(__webpack_require__(/*! ./internal/helpers */ "./node_modules/@next/react-refresh-utils/internal/helpers.js"));
  146. // Hook into ReactDOM initialization
  147. runtime_1["default"].injectIntoGlobalHook(self);
  148. // noop fns to prevent runtime errors during initialization
  149. self.$RefreshReg$ = function () { };
  150. self.$RefreshSig$ = function () { return function (type) { return type; }; };
  151. // Register global helpers
  152. self.$RefreshHelpers$ = helpers_1["default"];
  153. // Register a helper for module execution interception
  154. self.$RefreshInterceptModuleExecution$ = function (webpackModuleId) {
  155. var prevRefreshReg = self.$RefreshReg$;
  156. var prevRefreshSig = self.$RefreshSig$;
  157. self.$RefreshReg$ = function (type, id) {
  158. runtime_1["default"].register(type, webpackModuleId + ' ' + id);
  159. };
  160. self.$RefreshSig$ = runtime_1["default"].createSignatureFunctionForTransform;
  161. // Modeled after `useEffect` cleanup pattern:
  162. // https://reactjs.org/docs/hooks-effect.html#effects-with-cleanup
  163. return function () {
  164. self.$RefreshReg$ = prevRefreshReg;
  165. self.$RefreshSig$ = prevRefreshSig;
  166. };
  167. };
  168. /***/ }),
  169. /***/ "./node_modules/react-refresh/cjs/react-refresh-runtime.development.js":
  170. /*!*****************************************************************************!*\
  171. !*** ./node_modules/react-refresh/cjs/react-refresh-runtime.development.js ***!
  172. \*****************************************************************************/
  173. /*! no static exports found */
  174. /***/ (function(module, exports, __webpack_require__) {
  175. "use strict";
  176. /** @license React v0.8.1
  177. * react-refresh-runtime.development.js
  178. *
  179. * Copyright (c) Facebook, Inc. and its affiliates.
  180. *
  181. * This source code is licensed under the MIT license found in the
  182. * LICENSE file in the root directory of this source tree.
  183. */
  184. if (true) {
  185. (function() {
  186. 'use strict';
  187. // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
  188. // nor polyfill, then a plain number is used for performance.
  189. var hasSymbol = typeof Symbol === 'function' && Symbol.for;
  190. var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
  191. var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
  192. var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; // We never remove these associations.
  193. // It's OK to reference families, but use WeakMap/Set for types.
  194. var allFamiliesByID = new Map();
  195. var allFamiliesByType = new PossiblyWeakMap();
  196. var allSignaturesByType = new PossiblyWeakMap(); // This WeakMap is read by React, so we only put families
  197. // that have actually been edited here. This keeps checks fast.
  198. // $FlowIssue
  199. var updatedFamiliesByType = new PossiblyWeakMap(); // This is cleared on every performReactRefresh() call.
  200. // It is an array of [Family, NextType] tuples.
  201. var pendingUpdates = []; // This is injected by the renderer via DevTools global hook.
  202. var helpersByRendererID = new Map();
  203. var helpersByRoot = new Map(); // We keep track of mounted roots so we can schedule updates.
  204. var mountedRoots = new Set(); // If a root captures an error, we remember it so we can retry on edit.
  205. var failedRoots = new Set(); // In environments that support WeakMap, we also remember the last element for every root.
  206. // It needs to be weak because we do this even for roots that failed to mount.
  207. // If there is no WeakMap, we won't attempt to do retrying.
  208. // $FlowIssue
  209. var rootElements = // $FlowIssue
  210. typeof WeakMap === 'function' ? new WeakMap() : null;
  211. var isPerformingRefresh = false;
  212. function computeFullKey(signature) {
  213. if (signature.fullKey !== null) {
  214. return signature.fullKey;
  215. }
  216. var fullKey = signature.ownKey;
  217. var hooks;
  218. try {
  219. hooks = signature.getCustomHooks();
  220. } catch (err) {
  221. // This can happen in an edge case, e.g. if expression like Foo.useSomething
  222. // depends on Foo which is lazily initialized during rendering.
  223. // In that case just assume we'll have to remount.
  224. signature.forceReset = true;
  225. signature.fullKey = fullKey;
  226. return fullKey;
  227. }
  228. for (var i = 0; i < hooks.length; i++) {
  229. var hook = hooks[i];
  230. if (typeof hook !== 'function') {
  231. // Something's wrong. Assume we need to remount.
  232. signature.forceReset = true;
  233. signature.fullKey = fullKey;
  234. return fullKey;
  235. }
  236. var nestedHookSignature = allSignaturesByType.get(hook);
  237. if (nestedHookSignature === undefined) {
  238. // No signature means Hook wasn't in the source code, e.g. in a library.
  239. // We'll skip it because we can assume it won't change during this session.
  240. continue;
  241. }
  242. var nestedHookKey = computeFullKey(nestedHookSignature);
  243. if (nestedHookSignature.forceReset) {
  244. signature.forceReset = true;
  245. }
  246. fullKey += '\n---\n' + nestedHookKey;
  247. }
  248. signature.fullKey = fullKey;
  249. return fullKey;
  250. }
  251. function haveEqualSignatures(prevType, nextType) {
  252. var prevSignature = allSignaturesByType.get(prevType);
  253. var nextSignature = allSignaturesByType.get(nextType);
  254. if (prevSignature === undefined && nextSignature === undefined) {
  255. return true;
  256. }
  257. if (prevSignature === undefined || nextSignature === undefined) {
  258. return false;
  259. }
  260. if (computeFullKey(prevSignature) !== computeFullKey(nextSignature)) {
  261. return false;
  262. }
  263. if (nextSignature.forceReset) {
  264. return false;
  265. }
  266. return true;
  267. }
  268. function isReactClass(type) {
  269. return type.prototype && type.prototype.isReactComponent;
  270. }
  271. function canPreserveStateBetween(prevType, nextType) {
  272. if (isReactClass(prevType) || isReactClass(nextType)) {
  273. return false;
  274. }
  275. if (haveEqualSignatures(prevType, nextType)) {
  276. return true;
  277. }
  278. return false;
  279. }
  280. function resolveFamily(type) {
  281. // Only check updated types to keep lookups fast.
  282. return updatedFamiliesByType.get(type);
  283. } // If we didn't care about IE11, we could use new Map/Set(iterable).
  284. function cloneMap(map) {
  285. var clone = new Map();
  286. map.forEach(function (value, key) {
  287. clone.set(key, value);
  288. });
  289. return clone;
  290. }
  291. function cloneSet(set) {
  292. var clone = new Set();
  293. set.forEach(function (value) {
  294. clone.add(value);
  295. });
  296. return clone;
  297. }
  298. function performReactRefresh() {
  299. if (pendingUpdates.length === 0) {
  300. return null;
  301. }
  302. if (isPerformingRefresh) {
  303. return null;
  304. }
  305. isPerformingRefresh = true;
  306. try {
  307. var staleFamilies = new Set();
  308. var updatedFamilies = new Set();
  309. var updates = pendingUpdates;
  310. pendingUpdates = [];
  311. updates.forEach(function (_ref) {
  312. var family = _ref[0],
  313. nextType = _ref[1];
  314. // Now that we got a real edit, we can create associations
  315. // that will be read by the React reconciler.
  316. var prevType = family.current;
  317. updatedFamiliesByType.set(prevType, family);
  318. updatedFamiliesByType.set(nextType, family);
  319. family.current = nextType; // Determine whether this should be a re-render or a re-mount.
  320. if (canPreserveStateBetween(prevType, nextType)) {
  321. updatedFamilies.add(family);
  322. } else {
  323. staleFamilies.add(family);
  324. }
  325. }); // TODO: rename these fields to something more meaningful.
  326. var update = {
  327. updatedFamilies: updatedFamilies,
  328. // Families that will re-render preserving state
  329. staleFamilies: staleFamilies // Families that will be remounted
  330. };
  331. helpersByRendererID.forEach(function (helpers) {
  332. // Even if there are no roots, set the handler on first update.
  333. // This ensures that if *new* roots are mounted, they'll use the resolve handler.
  334. helpers.setRefreshHandler(resolveFamily);
  335. });
  336. var didError = false;
  337. var firstError = null; // We snapshot maps and sets that are mutated during commits.
  338. // If we don't do this, there is a risk they will be mutated while
  339. // we iterate over them. For example, trying to recover a failed root
  340. // may cause another root to be added to the failed list -- an infinite loop.
  341. var failedRootsSnapshot = cloneSet(failedRoots);
  342. var mountedRootsSnapshot = cloneSet(mountedRoots);
  343. var helpersByRootSnapshot = cloneMap(helpersByRoot);
  344. failedRootsSnapshot.forEach(function (root) {
  345. var helpers = helpersByRootSnapshot.get(root);
  346. if (helpers === undefined) {
  347. throw new Error('Could not find helpers for a root. This is a bug in React Refresh.');
  348. }
  349. if (!failedRoots.has(root)) {// No longer failed.
  350. }
  351. if (rootElements === null) {
  352. return;
  353. }
  354. if (!rootElements.has(root)) {
  355. return;
  356. }
  357. var element = rootElements.get(root);
  358. try {
  359. helpers.scheduleRoot(root, element);
  360. } catch (err) {
  361. if (!didError) {
  362. didError = true;
  363. firstError = err;
  364. } // Keep trying other roots.
  365. }
  366. });
  367. mountedRootsSnapshot.forEach(function (root) {
  368. var helpers = helpersByRootSnapshot.get(root);
  369. if (helpers === undefined) {
  370. throw new Error('Could not find helpers for a root. This is a bug in React Refresh.');
  371. }
  372. if (!mountedRoots.has(root)) {// No longer mounted.
  373. }
  374. try {
  375. helpers.scheduleRefresh(root, update);
  376. } catch (err) {
  377. if (!didError) {
  378. didError = true;
  379. firstError = err;
  380. } // Keep trying other roots.
  381. }
  382. });
  383. if (didError) {
  384. throw firstError;
  385. }
  386. return update;
  387. } finally {
  388. isPerformingRefresh = false;
  389. }
  390. }
  391. function register(type, id) {
  392. {
  393. if (type === null) {
  394. return;
  395. }
  396. if (typeof type !== 'function' && typeof type !== 'object') {
  397. return;
  398. } // This can happen in an edge case, e.g. if we register
  399. // return value of a HOC but it returns a cached component.
  400. // Ignore anything but the first registration for each type.
  401. if (allFamiliesByType.has(type)) {
  402. return;
  403. } // Create family or remember to update it.
  404. // None of this bookkeeping affects reconciliation
  405. // until the first performReactRefresh() call above.
  406. var family = allFamiliesByID.get(id);
  407. if (family === undefined) {
  408. family = {
  409. current: type
  410. };
  411. allFamiliesByID.set(id, family);
  412. } else {
  413. pendingUpdates.push([family, type]);
  414. }
  415. allFamiliesByType.set(type, family); // Visit inner types because we might not have registered them.
  416. if (typeof type === 'object' && type !== null) {
  417. switch (type.$$typeof) {
  418. case REACT_FORWARD_REF_TYPE:
  419. register(type.render, id + '$render');
  420. break;
  421. case REACT_MEMO_TYPE:
  422. register(type.type, id + '$type');
  423. break;
  424. }
  425. }
  426. }
  427. }
  428. function setSignature(type, key) {
  429. var forceReset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  430. var getCustomHooks = arguments.length > 3 ? arguments[3] : undefined;
  431. {
  432. allSignaturesByType.set(type, {
  433. forceReset: forceReset,
  434. ownKey: key,
  435. fullKey: null,
  436. getCustomHooks: getCustomHooks || function () {
  437. return [];
  438. }
  439. });
  440. }
  441. } // This is lazily called during first render for a type.
  442. // It captures Hook list at that time so inline requires don't break comparisons.
  443. function collectCustomHooksForSignature(type) {
  444. {
  445. var signature = allSignaturesByType.get(type);
  446. if (signature !== undefined) {
  447. computeFullKey(signature);
  448. }
  449. }
  450. }
  451. function getFamilyByID(id) {
  452. {
  453. return allFamiliesByID.get(id);
  454. }
  455. }
  456. function getFamilyByType(type) {
  457. {
  458. return allFamiliesByType.get(type);
  459. }
  460. }
  461. function findAffectedHostInstances(families) {
  462. {
  463. var affectedInstances = new Set();
  464. mountedRoots.forEach(function (root) {
  465. var helpers = helpersByRoot.get(root);
  466. if (helpers === undefined) {
  467. throw new Error('Could not find helpers for a root. This is a bug in React Refresh.');
  468. }
  469. var instancesForRoot = helpers.findHostInstancesForRefresh(root, families);
  470. instancesForRoot.forEach(function (inst) {
  471. affectedInstances.add(inst);
  472. });
  473. });
  474. return affectedInstances;
  475. }
  476. }
  477. function injectIntoGlobalHook(globalObject) {
  478. {
  479. // For React Native, the global hook will be set up by require('react-devtools-core').
  480. // That code will run before us. So we need to monkeypatch functions on existing hook.
  481. // For React Web, the global hook will be set up by the extension.
  482. // This will also run before us.
  483. var hook = globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__;
  484. if (hook === undefined) {
  485. // However, if there is no DevTools extension, we'll need to set up the global hook ourselves.
  486. // Note that in this case it's important that renderer code runs *after* this method call.
  487. // Otherwise, the renderer will think that there is no global hook, and won't do the injection.
  488. var nextID = 0;
  489. globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__ = hook = {
  490. renderers: new Map(),
  491. supportsFiber: true,
  492. inject: function (injected) {
  493. return nextID++;
  494. },
  495. onScheduleFiberRoot: function (id, root, children) {},
  496. onCommitFiberRoot: function (id, root, maybePriorityLevel, didError) {},
  497. onCommitFiberUnmount: function () {}
  498. };
  499. } // Here, we just want to get a reference to scheduleRefresh.
  500. var oldInject = hook.inject;
  501. hook.inject = function (injected) {
  502. var id = oldInject.apply(this, arguments);
  503. if (typeof injected.scheduleRefresh === 'function' && typeof injected.setRefreshHandler === 'function') {
  504. // This version supports React Refresh.
  505. helpersByRendererID.set(id, injected);
  506. }
  507. return id;
  508. }; // Do the same for any already injected roots.
  509. // This is useful if ReactDOM has already been initialized.
  510. // https://github.com/facebook/react/issues/17626
  511. hook.renderers.forEach(function (injected, id) {
  512. if (typeof injected.scheduleRefresh === 'function' && typeof injected.setRefreshHandler === 'function') {
  513. // This version supports React Refresh.
  514. helpersByRendererID.set(id, injected);
  515. }
  516. }); // We also want to track currently mounted roots.
  517. var oldOnCommitFiberRoot = hook.onCommitFiberRoot;
  518. var oldOnScheduleFiberRoot = hook.onScheduleFiberRoot || function () {};
  519. hook.onScheduleFiberRoot = function (id, root, children) {
  520. if (!isPerformingRefresh) {
  521. // If it was intentionally scheduled, don't attempt to restore.
  522. // This includes intentionally scheduled unmounts.
  523. failedRoots.delete(root);
  524. if (rootElements !== null) {
  525. rootElements.set(root, children);
  526. }
  527. }
  528. return oldOnScheduleFiberRoot.apply(this, arguments);
  529. };
  530. hook.onCommitFiberRoot = function (id, root, maybePriorityLevel, didError) {
  531. var helpers = helpersByRendererID.get(id);
  532. if (helpers === undefined) {
  533. return;
  534. }
  535. helpersByRoot.set(root, helpers);
  536. var current = root.current;
  537. var alternate = current.alternate; // We need to determine whether this root has just (un)mounted.
  538. // This logic is copy-pasted from similar logic in the DevTools backend.
  539. // If this breaks with some refactoring, you'll want to update DevTools too.
  540. if (alternate !== null) {
  541. var wasMounted = alternate.memoizedState != null && alternate.memoizedState.element != null;
  542. var isMounted = current.memoizedState != null && current.memoizedState.element != null;
  543. if (!wasMounted && isMounted) {
  544. // Mount a new root.
  545. mountedRoots.add(root);
  546. failedRoots.delete(root);
  547. } else if (wasMounted && isMounted) ; else if (wasMounted && !isMounted) {
  548. // Unmount an existing root.
  549. mountedRoots.delete(root);
  550. if (didError) {
  551. // We'll remount it on future edits.
  552. failedRoots.add(root);
  553. } else {
  554. helpersByRoot.delete(root);
  555. }
  556. } else if (!wasMounted && !isMounted) {
  557. if (didError) {
  558. // We'll remount it on future edits.
  559. failedRoots.add(root);
  560. }
  561. }
  562. } else {
  563. // Mount a new root.
  564. mountedRoots.add(root);
  565. }
  566. return oldOnCommitFiberRoot.apply(this, arguments);
  567. };
  568. }
  569. }
  570. function hasUnrecoverableErrors() {
  571. // TODO: delete this after removing dependency in RN.
  572. return false;
  573. } // Exposed for testing.
  574. function _getMountedRootCount() {
  575. {
  576. return mountedRoots.size;
  577. }
  578. } // This is a wrapper over more primitive functions for setting signature.
  579. // Signatures let us decide whether the Hook order has changed on refresh.
  580. //
  581. // This function is intended to be used as a transform target, e.g.:
  582. // var _s = createSignatureFunctionForTransform()
  583. //
  584. // function Hello() {
  585. // const [foo, setFoo] = useState(0);
  586. // const value = useCustomHook();
  587. // _s(); /* Second call triggers collecting the custom Hook list.
  588. // * This doesn't happen during the module evaluation because we
  589. // * don't want to change the module order with inline requires.
  590. // * Next calls are noops. */
  591. // return <h1>Hi</h1>;
  592. // }
  593. //
  594. // /* First call specifies the signature: */
  595. // _s(
  596. // Hello,
  597. // 'useState{[foo, setFoo]}(0)',
  598. // () => [useCustomHook], /* Lazy to avoid triggering inline requires */
  599. // );
  600. function createSignatureFunctionForTransform() {
  601. {
  602. // We'll fill in the signature in two steps.
  603. // First, we'll know the signature itself. This happens outside the component.
  604. // Then, we'll know the references to custom Hooks. This happens inside the component.
  605. // After that, the returned function will be a fast path no-op.
  606. var status = 'needsSignature';
  607. var savedType;
  608. var hasCustomHooks;
  609. return function (type, key, forceReset, getCustomHooks) {
  610. switch (status) {
  611. case 'needsSignature':
  612. if (type !== undefined) {
  613. // If we received an argument, this is the initial registration call.
  614. savedType = type;
  615. hasCustomHooks = typeof getCustomHooks === 'function';
  616. setSignature(type, key, forceReset, getCustomHooks); // The next call we expect is from inside a function, to fill in the custom Hooks.
  617. status = 'needsCustomHooks';
  618. }
  619. break;
  620. case 'needsCustomHooks':
  621. if (hasCustomHooks) {
  622. collectCustomHooksForSignature(savedType);
  623. }
  624. status = 'resolved';
  625. break;
  626. }
  627. return type;
  628. };
  629. }
  630. }
  631. function isLikelyComponentType(type) {
  632. {
  633. switch (typeof type) {
  634. case 'function':
  635. {
  636. // First, deal with classes.
  637. if (type.prototype != null) {
  638. if (type.prototype.isReactComponent) {
  639. // React class.
  640. return true;
  641. }
  642. var ownNames = Object.getOwnPropertyNames(type.prototype);
  643. if (ownNames.length > 1 || ownNames[0] !== 'constructor') {
  644. // This looks like a class.
  645. return false;
  646. } // eslint-disable-next-line no-proto
  647. if (type.prototype.__proto__ !== Object.prototype) {
  648. // It has a superclass.
  649. return false;
  650. } // Pass through.
  651. // This looks like a regular function with empty prototype.
  652. } // For plain functions and arrows, use name as a heuristic.
  653. var name = type.name || type.displayName;
  654. return typeof name === 'string' && /^[A-Z]/.test(name);
  655. }
  656. case 'object':
  657. {
  658. if (type != null) {
  659. switch (type.$$typeof) {
  660. case REACT_FORWARD_REF_TYPE:
  661. case REACT_MEMO_TYPE:
  662. // Definitely React components.
  663. return true;
  664. default:
  665. return false;
  666. }
  667. }
  668. return false;
  669. }
  670. default:
  671. {
  672. return false;
  673. }
  674. }
  675. }
  676. }
  677. var ReactFreshRuntime = /*#__PURE__*/Object.freeze({
  678. __proto__: null,
  679. performReactRefresh: performReactRefresh,
  680. register: register,
  681. setSignature: setSignature,
  682. collectCustomHooksForSignature: collectCustomHooksForSignature,
  683. getFamilyByID: getFamilyByID,
  684. getFamilyByType: getFamilyByType,
  685. findAffectedHostInstances: findAffectedHostInstances,
  686. injectIntoGlobalHook: injectIntoGlobalHook,
  687. hasUnrecoverableErrors: hasUnrecoverableErrors,
  688. _getMountedRootCount: _getMountedRootCount,
  689. createSignatureFunctionForTransform: createSignatureFunctionForTransform,
  690. isLikelyComponentType: isLikelyComponentType
  691. });
  692. // This is hacky but makes it work with both Rollup and Jest.
  693. var runtime = ReactFreshRuntime.default || ReactFreshRuntime;
  694. module.exports = runtime;
  695. })();
  696. }
  697. /***/ }),
  698. /***/ "./node_modules/react-refresh/runtime.js":
  699. /*!***********************************************!*\
  700. !*** ./node_modules/react-refresh/runtime.js ***!
  701. \***********************************************/
  702. /*! no static exports found */
  703. /***/ (function(module, exports, __webpack_require__) {
  704. "use strict";
  705. if (false) {} else {
  706. module.exports = __webpack_require__(/*! ./cjs/react-refresh-runtime.development.js */ "./node_modules/react-refresh/cjs/react-refresh-runtime.development.js");
  707. }
  708. /***/ })
  709. },[["./node_modules/@next/react-refresh-utils/runtime.js","static/runtime/webpack.js"]]]);
  710. //# sourceMappingURL=react-refresh.js.map