{"ast":null,"code":"/** @license React v0.13.6\n * scheduler-tracing.development.js\n *\n * Copyright (c) Facebook, Inc. and its 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'use strict';\n\nif (process.env.NODE_ENV !== \"production\") {\n  (function () {\n    'use strict';\n\n    Object.defineProperty(exports, '__esModule', {\n      value: true\n    }); // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:\n    // In some cases, StrictMode should also double-render lifecycles.\n    // This can be confusing for tests though,\n    // And it can be bad for performance in production.\n    // This feature flag can be used to control the behavior:\n    // To preserve the \"Pause on caught exceptions\" behavior of the debugger, we\n    // replay the begin phase of a failed component inside invokeGuardedCallback.\n    // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:\n    // Gather advanced timing metrics for Profiler subtrees.\n    // Trace which interactions trigger each commit.\n\n    var enableSchedulerTracing = true; // Only used in www builds.\n    // TODO: true? Here it might just be false.\n    // Only used in www builds.\n    // Only used in www builds.\n    // React Fire: prevent the value and checked attributes from syncing\n    // with their related DOM properties\n    // These APIs will no longer be \"unstable\" in the upcoming 16.7 release,\n    // Control this behavior with a flag to support 16.6 minor releases in the meanwhile.\n\n    var DEFAULT_THREAD_ID = 0; // Counters used to generate unique IDs.\n\n    var interactionIDCounter = 0;\n    var threadIDCounter = 0; // Set of currently traced interactions.\n    // Interactions \"stack\"–\n    // Meaning that newly traced interactions are appended to the previously active set.\n    // When an interaction goes out of scope, the previous set (if any) is restored.\n\n    exports.__interactionsRef = null; // Listener(s) to notify when interactions begin and end.\n\n    exports.__subscriberRef = null;\n\n    if (enableSchedulerTracing) {\n      exports.__interactionsRef = {\n        current: new Set()\n      };\n      exports.__subscriberRef = {\n        current: null\n      };\n    }\n\n    function unstable_clear(callback) {\n      if (!enableSchedulerTracing) {\n        return callback();\n      }\n\n      var prevInteractions = exports.__interactionsRef.current;\n      exports.__interactionsRef.current = new Set();\n\n      try {\n        return callback();\n      } finally {\n        exports.__interactionsRef.current = prevInteractions;\n      }\n    }\n\n    function unstable_getCurrent() {\n      if (!enableSchedulerTracing) {\n        return null;\n      } else {\n        return exports.__interactionsRef.current;\n      }\n    }\n\n    function unstable_getThreadID() {\n      return ++threadIDCounter;\n    }\n\n    function unstable_trace(name, timestamp, callback) {\n      var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID;\n\n      if (!enableSchedulerTracing) {\n        return callback();\n      }\n\n      var interaction = {\n        __count: 1,\n        id: interactionIDCounter++,\n        name: name,\n        timestamp: timestamp\n      };\n      var prevInteractions = exports.__interactionsRef.current; // Traced interactions should stack/accumulate.\n      // To do that, clone the current interactions.\n      // The previous set will be restored upon completion.\n\n      var interactions = new Set(prevInteractions);\n      interactions.add(interaction);\n      exports.__interactionsRef.current = interactions;\n      var subscriber = exports.__subscriberRef.current;\n      var returnValue = void 0;\n\n      try {\n        if (subscriber !== null) {\n          subscriber.onInteractionTraced(interaction);\n        }\n      } finally {\n        try {\n          if (subscriber !== null) {\n            subscriber.onWorkStarted(interactions, threadID);\n          }\n        } finally {\n          try {\n            returnValue = callback();\n          } finally {\n            exports.__interactionsRef.current = prevInteractions;\n\n            try {\n              if (subscriber !== null) {\n                subscriber.onWorkStopped(interactions, threadID);\n              }\n            } finally {\n              interaction.__count--; // If no async work was scheduled for this interaction,\n              // Notify subscribers that it's completed.\n\n              if (subscriber !== null && interaction.__count === 0) {\n                subscriber.onInteractionScheduledWorkCompleted(interaction);\n              }\n            }\n          }\n        }\n      }\n\n      return returnValue;\n    }\n\n    function unstable_wrap(callback) {\n      var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID;\n\n      if (!enableSchedulerTracing) {\n        return callback;\n      }\n\n      var wrappedInteractions = exports.__interactionsRef.current;\n      var subscriber = exports.__subscriberRef.current;\n\n      if (subscriber !== null) {\n        subscriber.onWorkScheduled(wrappedInteractions, threadID);\n      } // Update the pending async work count for the current interactions.\n      // Update after calling subscribers in case of error.\n\n\n      wrappedInteractions.forEach(function (interaction) {\n        interaction.__count++;\n      });\n      var hasRun = false;\n\n      function wrapped() {\n        var prevInteractions = exports.__interactionsRef.current;\n        exports.__interactionsRef.current = wrappedInteractions;\n        subscriber = exports.__subscriberRef.current;\n\n        try {\n          var returnValue = void 0;\n\n          try {\n            if (subscriber !== null) {\n              subscriber.onWorkStarted(wrappedInteractions, threadID);\n            }\n          } finally {\n            try {\n              returnValue = callback.apply(undefined, arguments);\n            } finally {\n              exports.__interactionsRef.current = prevInteractions;\n\n              if (subscriber !== null) {\n                subscriber.onWorkStopped(wrappedInteractions, threadID);\n              }\n            }\n          }\n\n          return returnValue;\n        } finally {\n          if (!hasRun) {\n            // We only expect a wrapped function to be executed once,\n            // But in the event that it's executed more than once–\n            // Only decrement the outstanding interaction counts once.\n            hasRun = true; // Update pending async counts for all wrapped interactions.\n            // If this was the last scheduled async work for any of them,\n            // Mark them as completed.\n\n            wrappedInteractions.forEach(function (interaction) {\n              interaction.__count--;\n\n              if (subscriber !== null && interaction.__count === 0) {\n                subscriber.onInteractionScheduledWorkCompleted(interaction);\n              }\n            });\n          }\n        }\n      }\n\n      wrapped.cancel = function cancel() {\n        subscriber = exports.__subscriberRef.current;\n\n        try {\n          if (subscriber !== null) {\n            subscriber.onWorkCanceled(wrappedInteractions, threadID);\n          }\n        } finally {\n          // Update pending async counts for all wrapped interactions.\n          // If this was the last scheduled async work for any of them,\n          // Mark them as completed.\n          wrappedInteractions.forEach(function (interaction) {\n            interaction.__count--;\n\n            if (subscriber && interaction.__count === 0) {\n              subscriber.onInteractionScheduledWorkCompleted(interaction);\n            }\n          });\n        }\n      };\n\n      return wrapped;\n    }\n\n    var subscribers = null;\n\n    if (enableSchedulerTracing) {\n      subscribers = new Set();\n    }\n\n    function unstable_subscribe(subscriber) {\n      if (enableSchedulerTracing) {\n        subscribers.add(subscriber);\n\n        if (subscribers.size === 1) {\n          exports.__subscriberRef.current = {\n            onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted,\n            onInteractionTraced: onInteractionTraced,\n            onWorkCanceled: onWorkCanceled,\n            onWorkScheduled: onWorkScheduled,\n            onWorkStarted: onWorkStarted,\n            onWorkStopped: onWorkStopped\n          };\n        }\n      }\n    }\n\n    function unstable_unsubscribe(subscriber) {\n      if (enableSchedulerTracing) {\n        subscribers.delete(subscriber);\n\n        if (subscribers.size === 0) {\n          exports.__subscriberRef.current = null;\n        }\n      }\n    }\n\n    function onInteractionTraced(interaction) {\n      var didCatchError = false;\n      var caughtError = null;\n      subscribers.forEach(function (subscriber) {\n        try {\n          subscriber.onInteractionTraced(interaction);\n        } catch (error) {\n          if (!didCatchError) {\n            didCatchError = true;\n            caughtError = error;\n          }\n        }\n      });\n\n      if (didCatchError) {\n        throw caughtError;\n      }\n    }\n\n    function onInteractionScheduledWorkCompleted(interaction) {\n      var didCatchError = false;\n      var caughtError = null;\n      subscribers.forEach(function (subscriber) {\n        try {\n          subscriber.onInteractionScheduledWorkCompleted(interaction);\n        } catch (error) {\n          if (!didCatchError) {\n            didCatchError = true;\n            caughtError = error;\n          }\n        }\n      });\n\n      if (didCatchError) {\n        throw caughtError;\n      }\n    }\n\n    function onWorkScheduled(interactions, threadID) {\n      var didCatchError = false;\n      var caughtError = null;\n      subscribers.forEach(function (subscriber) {\n        try {\n          subscriber.onWorkScheduled(interactions, threadID);\n        } catch (error) {\n          if (!didCatchError) {\n            didCatchError = true;\n            caughtError = error;\n          }\n        }\n      });\n\n      if (didCatchError) {\n        throw caughtError;\n      }\n    }\n\n    function onWorkStarted(interactions, threadID) {\n      var didCatchError = false;\n      var caughtError = null;\n      subscribers.forEach(function (subscriber) {\n        try {\n          subscriber.onWorkStarted(interactions, threadID);\n        } catch (error) {\n          if (!didCatchError) {\n            didCatchError = true;\n            caughtError = error;\n          }\n        }\n      });\n\n      if (didCatchError) {\n        throw caughtError;\n      }\n    }\n\n    function onWorkStopped(interactions, threadID) {\n      var didCatchError = false;\n      var caughtError = null;\n      subscribers.forEach(function (subscriber) {\n        try {\n          subscriber.onWorkStopped(interactions, threadID);\n        } catch (error) {\n          if (!didCatchError) {\n            didCatchError = true;\n            caughtError = error;\n          }\n        }\n      });\n\n      if (didCatchError) {\n        throw caughtError;\n      }\n    }\n\n    function onWorkCanceled(interactions, threadID) {\n      var didCatchError = false;\n      var caughtError = null;\n      subscribers.forEach(function (subscriber) {\n        try {\n          subscriber.onWorkCanceled(interactions, threadID);\n        } catch (error) {\n          if (!didCatchError) {\n            didCatchError = true;\n            caughtError = error;\n          }\n        }\n      });\n\n      if (didCatchError) {\n        throw caughtError;\n      }\n    }\n\n    exports.unstable_clear = unstable_clear;\n    exports.unstable_getCurrent = unstable_getCurrent;\n    exports.unstable_getThreadID = unstable_getThreadID;\n    exports.unstable_trace = unstable_trace;\n    exports.unstable_wrap = unstable_wrap;\n    exports.unstable_subscribe = unstable_subscribe;\n    exports.unstable_unsubscribe = unstable_unsubscribe;\n  })();\n}","map":null,"metadata":{},"sourceType":"script"}