scheduler
Advanced tools
Comparing version 0.0.0-experimental-0935a1db3 to 0.0.0-experimental-09fbee89d-20231013
@@ -1,5 +0,6 @@ | ||
/** @license React vundefined | ||
/** | ||
* @license React | ||
* scheduler-unstable_mock.development.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -17,3 +18,3 @@ * This source code is licensed under the MIT license found in the | ||
var enableSchedulerDebugging = false; | ||
var enableProfiling = true; | ||
var enableProfiling = false; | ||
@@ -26,20 +27,18 @@ function push(heap, node) { | ||
function peek(heap) { | ||
var first = heap[0]; | ||
return first === undefined ? null : first; | ||
return heap.length === 0 ? null : heap[0]; | ||
} | ||
function pop(heap) { | ||
if (heap.length === 0) { | ||
return null; | ||
} | ||
var first = heap[0]; | ||
var last = heap.pop(); | ||
if (first !== undefined) { | ||
var last = heap.pop(); | ||
if (last !== first) { | ||
heap[0] = last; | ||
siftDown(heap, last, 0); | ||
} | ||
if (last !== first) { | ||
heap[0] = last; | ||
siftDown(heap, last, 0); | ||
} | ||
return first; | ||
} else { | ||
return null; | ||
} | ||
return first; | ||
} | ||
@@ -50,7 +49,7 @@ | ||
while (true) { | ||
while (index > 0) { | ||
var parentIndex = index - 1 >>> 1; | ||
var parent = heap[parentIndex]; | ||
if (parent !== undefined && compare(parent, node) > 0) { | ||
if (compare(parent, node) > 0) { | ||
// The parent is larger. Swap positions. | ||
@@ -70,4 +69,5 @@ heap[parentIndex] = node; | ||
var length = heap.length; | ||
var halfLength = length >>> 1; | ||
while (index < length) { | ||
while (index < halfLength) { | ||
var leftIndex = (index + 1) * 2 - 1; | ||
@@ -78,4 +78,4 @@ var left = heap[leftIndex]; | ||
if (left !== undefined && compare(left, node) < 0) { | ||
if (right !== undefined && compare(right, left) < 0) { | ||
if (compare(left, node) < 0) { | ||
if (rightIndex < length && compare(right, left) < 0) { | ||
heap[index] = right; | ||
@@ -89,3 +89,3 @@ heap[rightIndex] = node; | ||
} | ||
} else if (right !== undefined && compare(right, node) < 0) { | ||
} else if (rightIndex < length && compare(right, node) < 0) { | ||
heap[index] = right; | ||
@@ -108,3 +108,2 @@ heap[rightIndex] = node; | ||
// TODO: Use symbols? | ||
var NoPriority = 0; | ||
var ImmediatePriority = 1; | ||
@@ -116,163 +115,5 @@ var UserBlockingPriority = 2; | ||
var runIdCounter = 0; | ||
var mainThreadIdCounter = 0; | ||
var profilingStateSize = 4; | ||
var sharedProfilingBuffer = // $FlowFixMe Flow doesn't know about SharedArrayBuffer | ||
typeof SharedArrayBuffer === 'function' ? new SharedArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : // $FlowFixMe Flow doesn't know about ArrayBuffer | ||
typeof ArrayBuffer === 'function' ? new ArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : null // Don't crash the init path on IE9 | ||
; | ||
var profilingState = sharedProfilingBuffer !== null ? new Int32Array(sharedProfilingBuffer) : []; // We can't read this but it helps save bytes for null checks | ||
var PRIORITY = 0; | ||
var CURRENT_TASK_ID = 1; | ||
var CURRENT_RUN_ID = 2; | ||
var QUEUE_SIZE = 3; | ||
{ | ||
profilingState[PRIORITY] = NoPriority; // This is maintained with a counter, because the size of the priority queue | ||
// array might include canceled tasks. | ||
profilingState[QUEUE_SIZE] = 0; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
} // Bytes per element is 4 | ||
var INITIAL_EVENT_LOG_SIZE = 131072; | ||
var MAX_EVENT_LOG_SIZE = 524288; // Equivalent to 2 megabytes | ||
var eventLogSize = 0; | ||
var eventLogBuffer = null; | ||
var eventLog = null; | ||
var eventLogIndex = 0; | ||
var TaskStartEvent = 1; | ||
var TaskCompleteEvent = 2; | ||
var TaskErrorEvent = 3; | ||
var TaskCancelEvent = 4; | ||
var TaskRunEvent = 5; | ||
var TaskYieldEvent = 6; | ||
var SchedulerSuspendEvent = 7; | ||
var SchedulerResumeEvent = 8; | ||
function logEvent(entries) { | ||
if (eventLog !== null) { | ||
var offset = eventLogIndex; | ||
eventLogIndex += entries.length; | ||
if (eventLogIndex + 1 > eventLogSize) { | ||
eventLogSize *= 2; | ||
if (eventLogSize > MAX_EVENT_LOG_SIZE) { | ||
// Using console['error'] to evade Babel and ESLint | ||
console['error']("Scheduler Profiling: Event log exceeded maximum size. Don't " + 'forget to call `stopLoggingProfilingEvents()`.'); | ||
stopLoggingProfilingEvents(); | ||
return; | ||
} | ||
var newEventLog = new Int32Array(eventLogSize * 4); | ||
newEventLog.set(eventLog); | ||
eventLogBuffer = newEventLog.buffer; | ||
eventLog = newEventLog; | ||
} | ||
eventLog.set(entries, offset); | ||
} | ||
} | ||
function startLoggingProfilingEvents() { | ||
eventLogSize = INITIAL_EVENT_LOG_SIZE; | ||
eventLogBuffer = new ArrayBuffer(eventLogSize * 4); | ||
eventLog = new Int32Array(eventLogBuffer); | ||
eventLogIndex = 0; | ||
} | ||
function stopLoggingProfilingEvents() { | ||
var buffer = eventLogBuffer; | ||
eventLogSize = 0; | ||
eventLogBuffer = null; | ||
eventLog = null; | ||
eventLogIndex = 0; | ||
return buffer; | ||
} | ||
function markTaskStart(task, ms) { | ||
{ | ||
profilingState[QUEUE_SIZE]++; | ||
if (eventLog !== null) { | ||
// performance.now returns a float, representing milliseconds. When the | ||
// event is logged, it's coerced to an int. Convert to microseconds to | ||
// maintain extra degrees of precision. | ||
logEvent([TaskStartEvent, ms * 1000, task.id, task.priorityLevel]); | ||
} | ||
} | ||
} | ||
function markTaskCompleted(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskCompleteEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskCanceled(task, ms) { | ||
{ | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskCancelEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskErrored(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskErrorEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskRun(task, ms) { | ||
{ | ||
runIdCounter++; | ||
profilingState[PRIORITY] = task.priorityLevel; | ||
profilingState[CURRENT_TASK_ID] = task.id; | ||
profilingState[CURRENT_RUN_ID] = runIdCounter; | ||
if (eventLog !== null) { | ||
logEvent([TaskRunEvent, ms * 1000, task.id, runIdCounter]); | ||
} | ||
} | ||
} | ||
function markTaskYield(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[CURRENT_RUN_ID] = 0; | ||
if (eventLog !== null) { | ||
logEvent([TaskYieldEvent, ms * 1000, task.id, runIdCounter]); | ||
} | ||
} | ||
} | ||
function markSchedulerSuspended(ms) { | ||
{ | ||
mainThreadIdCounter++; | ||
if (eventLog !== null) { | ||
logEvent([SchedulerSuspendEvent, ms * 1000, mainThreadIdCounter]); | ||
} | ||
} | ||
} | ||
function markSchedulerUnsuspended(ms) { | ||
{ | ||
if (eventLog !== null) { | ||
logEvent([SchedulerResumeEvent, ms * 1000, mainThreadIdCounter]); | ||
} | ||
} | ||
} | ||
/* eslint-disable no-var */ | ||
@@ -297,3 +138,3 @@ // Math.pow(2, 30) - 1 | ||
var currentTask = null; | ||
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy. | ||
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance. | ||
@@ -313,3 +154,8 @@ var isPerformingWork = false; | ||
var shouldYieldForPaint = false; | ||
var disableYieldValue = false; | ||
function setDisableYieldValue(newValue) { | ||
disableYieldValue = newValue; | ||
} | ||
function advanceTimers(currentTime) { | ||
@@ -328,7 +174,2 @@ // Check for tasks that are no longer delayed and add them to the queue. | ||
push(taskQueue, timer); | ||
{ | ||
markTaskStart(timer, currentTime); | ||
timer.isQueued = true; | ||
} | ||
} else { | ||
@@ -362,5 +203,2 @@ // Remaining timers are pending. | ||
function flushWork(hasTimeRemaining, initialTime) { | ||
{ | ||
markSchedulerUnsuspended(initialTime); | ||
} // We'll need a host callback the next time work is scheduled. | ||
@@ -380,15 +218,3 @@ | ||
try { | ||
if (enableProfiling) { | ||
try { | ||
return workLoop(hasTimeRemaining, initialTime); | ||
} catch (error) { | ||
if (currentTask !== null) { | ||
var currentTime = getCurrentTime(); | ||
markTaskErrored(currentTask, currentTime); | ||
currentTask.isQueued = false; | ||
} | ||
throw error; | ||
} | ||
} else { | ||
var currentTime; if (enableProfiling) ; else { | ||
// No catch in prod code path. | ||
@@ -401,8 +227,2 @@ return workLoop(hasTimeRemaining, initialTime); | ||
isPerformingWork = false; | ||
{ | ||
var _currentTime = getCurrentTime(); | ||
markSchedulerSuspended(_currentTime); | ||
} | ||
} | ||
@@ -420,11 +240,15 @@ } | ||
break; | ||
} | ||
} // $FlowFixMe[incompatible-use] found when upgrading Flow | ||
var callback = currentTask.callback; | ||
if (typeof callback === 'function') { | ||
currentTask.callback = null; | ||
currentPriorityLevel = currentTask.priorityLevel; | ||
// $FlowFixMe[incompatible-use] found when upgrading Flow | ||
currentTask.callback = null; // $FlowFixMe[incompatible-use] found when upgrading Flow | ||
currentPriorityLevel = currentTask.priorityLevel; // $FlowFixMe[incompatible-use] found when upgrading Flow | ||
var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; | ||
markTaskRun(currentTask, currentTime); | ||
var continuationCallback = callback(didUserCallbackTimeout); | ||
@@ -434,9 +258,14 @@ currentTime = getCurrentTime(); | ||
if (typeof continuationCallback === 'function') { | ||
// If a continuation is returned, immediately yield to the main thread | ||
// regardless of how much time is left in the current time slice. | ||
// $FlowFixMe[incompatible-use] found when upgrading Flow | ||
currentTask.callback = continuationCallback; | ||
markTaskYield(currentTask, currentTime); | ||
advanceTimers(currentTime); | ||
if (shouldYieldForPaint) { | ||
needsPaint = true; | ||
return true; | ||
} | ||
} else { | ||
{ | ||
markTaskCompleted(currentTask, currentTime); | ||
currentTask.isQueued = false; | ||
} | ||
@@ -446,5 +275,5 @@ if (currentTask === peek(taskQueue)) { | ||
} | ||
advanceTimers(currentTime); | ||
} | ||
advanceTimers(currentTime); | ||
} else { | ||
@@ -522,3 +351,5 @@ pop(taskQueue); | ||
function unstable_wrapCallback(callback) { | ||
var parentPriorityLevel = currentPriorityLevel; | ||
var parentPriorityLevel = currentPriorityLevel; // $FlowFixMe[incompatible-return] | ||
// $FlowFixMe[missing-this-annot] | ||
return function () { | ||
@@ -588,6 +419,2 @@ // This is a fork of runWithPriority, inlined for performance. | ||
{ | ||
newTask.isQueued = false; | ||
} | ||
if (startTime > currentTime) { | ||
@@ -613,7 +440,2 @@ // This is a delayed task. | ||
push(taskQueue, newTask); | ||
{ | ||
markTaskStart(newTask, currentTime); | ||
newTask.isQueued = true; | ||
} // Schedule a host callback, if needed. If we're already performing work, | ||
// wait until the next time we yield. | ||
@@ -647,9 +469,2 @@ | ||
function unstable_cancelCallback(task) { | ||
{ | ||
if (task.isQueued) { | ||
var currentTime = getCurrentTime(); | ||
markTaskCanceled(task, currentTime); | ||
task.isQueued = false; | ||
} | ||
} // Null out the callback to indicate the task has been canceled. (Can't | ||
// remove from the queue because you can't remove arbitrary nodes from an | ||
@@ -681,3 +496,3 @@ // array based heap, only the first one.) | ||
function shouldYieldToHost() { | ||
if (expectedNumberOfYields !== -1 && yieldedValues !== null && yieldedValues.length >= expectedNumberOfYields || shouldYieldForPaint && needsPaint) { | ||
if (expectedNumberOfYields === 0 && yieldedValues === null || expectedNumberOfYields !== -1 && yieldedValues !== null && yieldedValues.length >= expectedNumberOfYields || shouldYieldForPaint && needsPaint) { | ||
// We yielded at least as many values as expected. Stop flushing. | ||
@@ -770,4 +585,10 @@ didStop = true; | ||
} | ||
return false; | ||
} | ||
function unstable_hasPendingWork() { | ||
return scheduledCallback !== null; | ||
} | ||
function unstable_flushExpired() { | ||
@@ -823,3 +644,3 @@ if (isFlushing) { | ||
function unstable_clearYields() { | ||
function unstable_clearLog() { | ||
if (yieldedValues === null) { | ||
@@ -846,5 +667,5 @@ return []; | ||
function unstable_yieldValue(value) { | ||
function log(value) { | ||
// eslint-disable-next-line react-internal/no-production-logging | ||
if (console.log.name === 'disabledLog') { | ||
if (console.log.name === 'disabledLog' || disableYieldValue) { | ||
// If console.log has been patched, we assume we're in render | ||
@@ -864,3 +685,3 @@ // replaying and we ignore any values yielding in the second pass. | ||
// eslint-disable-next-line react-internal/no-production-logging | ||
if (console.log.name === 'disabledLog') { | ||
if (console.log.name === 'disabledLog' || disableYieldValue) { | ||
// If console.log has been patched, we assume we're in render | ||
@@ -883,8 +704,5 @@ // replaying and we ignore any time advancing in the second pass. | ||
} | ||
var unstable_Profiling = { | ||
startLoggingProfilingEvents: startLoggingProfilingEvents, | ||
stopLoggingProfilingEvents: stopLoggingProfilingEvents, | ||
sharedProfilingBuffer: sharedProfilingBuffer | ||
} ; | ||
var unstable_Profiling = null; | ||
exports.log = log; | ||
exports.reset = reset; | ||
@@ -899,3 +717,3 @@ exports.unstable_IdlePriority = IdlePriority; | ||
exports.unstable_cancelCallback = unstable_cancelCallback; | ||
exports.unstable_clearYields = unstable_clearYields; | ||
exports.unstable_clearLog = unstable_clearLog; | ||
exports.unstable_continueExecution = unstable_continueExecution; | ||
@@ -910,2 +728,3 @@ exports.unstable_flushAll = unstable_flushAll; | ||
exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode; | ||
exports.unstable_hasPendingWork = unstable_hasPendingWork; | ||
exports.unstable_next = unstable_next; | ||
@@ -917,6 +736,6 @@ exports.unstable_now = getCurrentTime; | ||
exports.unstable_scheduleCallback = unstable_scheduleCallback; | ||
exports.unstable_setDisableYieldValue = setDisableYieldValue; | ||
exports.unstable_shouldYield = shouldYieldToHost; | ||
exports.unstable_wrapCallback = unstable_wrapCallback; | ||
exports.unstable_yieldValue = unstable_yieldValue; | ||
})(); | ||
} |
@@ -1,5 +0,6 @@ | ||
/** @license React vundefined | ||
/** | ||
* @license React | ||
* scheduler-unstable_mock.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -9,12 +10,12 @@ * This source code is licensed under the MIT license found in the | ||
*/ | ||
'use strict';function f(a,b){var c=a.length;a.push(b);a:for(;;){var d=c-1>>>1,e=a[d];if(void 0!==e&&0<g(e,b))a[d]=b,a[c]=e,c=d;else break a}}function h(a){a=a[0];return void 0===a?null:a}function k(a){var b=a[0];if(void 0!==b){var c=a.pop();if(c!==b){a[0]=c;a:for(var d=0,e=a.length;d<e;){var u=2*(d+1)-1,v=a[u],w=u+1,y=a[w];if(void 0!==v&&0>g(v,c))void 0!==y&&0>g(y,v)?(a[d]=y,a[w]=c,d=w):(a[d]=v,a[u]=c,d=u);else if(void 0!==y&&0>g(y,c))a[d]=y,a[w]=c,d=w;else break a}}return b}return null} | ||
function g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var l=[],m=[],n=1,p=null,q=3,r=!1,t=!1,x=!1,z=0,A=null,B=null,C=-1,D=null,E=-1,F=!1,G=!1,H=!1,I=!1;function J(a){for(var b=h(m);null!==b;){if(null===b.callback)k(m);else if(b.startTime<=a)k(m),b.sortIndex=b.expirationTime,f(l,b);else break;b=h(m)}}function K(a){x=!1;J(a);if(!t)if(null!==h(l))t=!0,A=L;else{var b=h(m);null!==b&&(a=b.startTime-a,B=K,C=z+a)}} | ||
function L(a,b){t=!1;x&&(x=!1,B=null,C=-1);r=!0;var c=q;try{J(b);for(p=h(l);null!==p&&(!(p.expirationTime>b)||a&&!M());){var d=p.callback;if("function"===typeof d){p.callback=null;q=p.priorityLevel;var e=d(p.expirationTime<=b);b=z;"function"===typeof e?p.callback=e:p===h(l)&&k(l);J(b)}else k(l);p=h(l)}if(null!==p)var u=!0;else{var v=h(m);if(null!==v){var w=v.startTime-b;B=K;C=z+w}u=!1}return u}finally{p=null,q=c,r=!1}}function M(){return-1!==E&&null!==D&&D.length>=E||I&&H?F=!0:!1} | ||
function N(){if(G)throw Error("Already flushing work.");if(null!==A){var a=A;G=!0;try{var b=!0;do b=a(!0,z);while(b);b||(A=null);return!0}finally{G=!1}}else return!1}exports.reset=function(){if(G)throw Error("Cannot reset while already flushing work.");z=0;B=A=null;C=-1;D=null;E=-1;H=G=F=!1};exports.unstable_IdlePriority=5;exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2; | ||
exports.unstable_advanceTime=function(a){"disabledLog"!==console.log.name&&(z+=a,null!==B&&C<=z&&(B(z),C=-1,B=null))};exports.unstable_cancelCallback=function(a){a.callback=null};exports.unstable_clearYields=function(){if(null===D)return[];var a=D;D=null;return a};exports.unstable_continueExecution=function(){t||r||(t=!0,A=L)}; | ||
exports.unstable_flushAll=function(){if(null!==D)throw Error("Log is not empty. Assert on the log of yielded values before flushing additional work.");N();if(null!==D)throw Error("While flushing work, something yielded a value. Use an assertion helper to assert on the log of yielded values, e.g. expect(Scheduler).toFlushAndYield([...])");};exports.unstable_flushAllWithoutAsserting=N; | ||
exports.unstable_flushExpired=function(){if(G)throw Error("Already flushing work.");if(null!==A){G=!0;try{A(!1,z)||(A=null)}finally{G=!1}}};exports.unstable_flushNumberOfYields=function(a){if(G)throw Error("Already flushing work.");if(null!==A){var b=A;E=a;G=!0;try{a=!0;do a=b(!0,z);while(a&&!F);a||(A=null)}finally{E=-1,G=F=!1}}}; | ||
exports.unstable_flushUntilNextPaint=function(){if(G)throw Error("Already flushing work.");if(null!==A){var a=A;I=!0;H=!1;G=!0;try{var b=!0;do b=a(!0,z);while(b&&!F);b||(A=null)}finally{G=F=I=!1}}};exports.unstable_forceFrameRate=function(){};exports.unstable_getCurrentPriorityLevel=function(){return q};exports.unstable_getFirstCallbackNode=function(){return h(l)};exports.unstable_next=function(a){switch(q){case 1:case 2:case 3:var b=3;break;default:b=q}var c=q;q=b;try{return a()}finally{q=c}}; | ||
exports.unstable_now=function(){return z};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=function(){H=!0};exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=q;q=a;try{return b()}finally{q=c}}; | ||
exports.unstable_scheduleCallback=function(a,b,c){var d=z;"object"===typeof c&&null!==c?(c=c.delay,c="number"===typeof c&&0<c?d+c:d):c=d;switch(a){case 1:var e=-1;break;case 2:e=250;break;case 5:e=1073741823;break;case 4:e=1E4;break;default:e=5E3}e=c+e;a={id:n++,callback:b,priorityLevel:a,startTime:c,expirationTime:e,sortIndex:-1};c>d?(a.sortIndex=c,f(m,a),null===h(l)&&a===h(m)&&(x?(B=null,C=-1):x=!0,B=K,C=z+(c-d))):(a.sortIndex=e,f(l,a),t||r||(t=!0,A=L));return a};exports.unstable_shouldYield=M; | ||
exports.unstable_wrapCallback=function(a){var b=q;return function(){var c=q;q=b;try{return a.apply(this,arguments)}finally{q=c}}};exports.unstable_yieldValue=function(a){"disabledLog"!==console.log.name&&(null===D?D=[a]:D.push(a))}; | ||
'use strict';function f(a,b){var c=a.length;a.push(b);a:for(;0<c;){var d=c-1>>>1,e=a[d];if(0<g(e,b))a[d]=b,a[c]=e,c=d;else break a}}function h(a){return 0===a.length?null:a[0]}function k(a){if(0===a.length)return null;var b=a[0],c=a.pop();if(c!==b){a[0]=c;a:for(var d=0,e=a.length,z=e>>>1;d<z;){var u=2*(d+1)-1,A=a[u],v=u+1,F=a[v];if(0>g(A,c))v<e&&0>g(F,A)?(a[d]=F,a[v]=c,d=v):(a[d]=A,a[u]=c,d=u);else if(v<e&&0>g(F,c))a[d]=F,a[v]=c,d=v;else break a}}return b} | ||
function g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var l=[],m=[],n=1,p=null,q=3,r=!1,t=!1,w=!1,x=0,y=null,B=null,C=-1,D=null,E=-1,G=!1,H=!1,I=!1,J=!1,K=!1;function L(a){for(var b=h(m);null!==b;){if(null===b.callback)k(m);else if(b.startTime<=a)k(m),b.sortIndex=b.expirationTime,f(l,b);else break;b=h(m)}}function M(a){w=!1;L(a);if(!t)if(null!==h(l))t=!0,y=N;else{var b=h(m);null!==b&&(a=b.startTime-a,B=M,C=x+a)}} | ||
function N(a,b){t=!1;w&&(w=!1,B=null,C=-1);r=!0;var c=q;try{a:{L(b);for(p=h(l);null!==p&&(!(p.expirationTime>b)||a&&!O());){var d=p.callback;if("function"===typeof d){p.callback=null;q=p.priorityLevel;var e=d(p.expirationTime<=b);b=x;if("function"===typeof e){if(p.callback=e,L(b),J){var z=I=!0;break a}}else p===h(l)&&k(l),L(b)}else k(l);p=h(l)}if(null!==p)z=!0;else{var u=h(m);if(null!==u){var A=u.startTime-b;B=M;C=x+A}z=!1}}return z}finally{p=null,q=c,r=!1}} | ||
function O(){return 0===E&&null===D||-1!==E&&null!==D&&D.length>=E||J&&I?G=!0:!1}function P(){if(H)throw Error("Already flushing work.");if(null!==y){var a=y;H=!0;try{var b=!0;do b=a(!0,x);while(b);b||(y=null);return!0}finally{H=!1}}else return!1}exports.log=function(a){"disabledLog"===console.log.name||K||(null===D?D=[a]:D.push(a))};exports.reset=function(){if(H)throw Error("Cannot reset while already flushing work.");x=0;B=y=null;C=-1;D=null;E=-1;I=H=G=!1};exports.unstable_IdlePriority=5; | ||
exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_advanceTime=function(a){"disabledLog"===console.log.name||K||(x+=a,null!==B&&C<=x&&(B(x),C=-1,B=null))};exports.unstable_cancelCallback=function(a){a.callback=null};exports.unstable_clearLog=function(){if(null===D)return[];var a=D;D=null;return a};exports.unstable_continueExecution=function(){t||r||(t=!0,y=N)}; | ||
exports.unstable_flushAll=function(){if(null!==D)throw Error("Log is not empty. Assert on the log of yielded values before flushing additional work.");P();if(null!==D)throw Error("While flushing work, something yielded a value. Use an assertion helper to assert on the log of yielded values, e.g. expect(Scheduler).toFlushAndYield([...])");};exports.unstable_flushAllWithoutAsserting=P; | ||
exports.unstable_flushExpired=function(){if(H)throw Error("Already flushing work.");if(null!==y){H=!0;try{y(!1,x)||(y=null)}finally{H=!1}}};exports.unstable_flushNumberOfYields=function(a){if(H)throw Error("Already flushing work.");if(null!==y){var b=y;E=a;H=!0;try{a=!0;do a=b(!0,x);while(a&&!G);a||(y=null)}finally{E=-1,H=G=!1}}}; | ||
exports.unstable_flushUntilNextPaint=function(){if(H)throw Error("Already flushing work.");if(null!==y){var a=y;J=!0;I=!1;H=!0;try{var b=!0;do b=a(!0,x);while(b&&!G);b||(y=null)}finally{H=G=J=!1}}return!1};exports.unstable_forceFrameRate=function(){};exports.unstable_getCurrentPriorityLevel=function(){return q};exports.unstable_getFirstCallbackNode=function(){return h(l)};exports.unstable_hasPendingWork=function(){return null!==y}; | ||
exports.unstable_next=function(a){switch(q){case 1:case 2:case 3:var b=3;break;default:b=q}var c=q;q=b;try{return a()}finally{q=c}};exports.unstable_now=function(){return x};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=function(){I=!0};exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=q;q=a;try{return b()}finally{q=c}}; | ||
exports.unstable_scheduleCallback=function(a,b,c){var d=x;"object"===typeof c&&null!==c?(c=c.delay,c="number"===typeof c&&0<c?d+c:d):c=d;switch(a){case 1:var e=-1;break;case 2:e=250;break;case 5:e=1073741823;break;case 4:e=1E4;break;default:e=5E3}e=c+e;a={id:n++,callback:b,priorityLevel:a,startTime:c,expirationTime:e,sortIndex:-1};c>d?(a.sortIndex=c,f(m,a),null===h(l)&&a===h(m)&&(w?(B=null,C=-1):w=!0,B=M,C=x+(c-d))):(a.sortIndex=e,f(l,a),t||r||(t=!0,y=N));return a}; | ||
exports.unstable_setDisableYieldValue=function(a){K=a};exports.unstable_shouldYield=O;exports.unstable_wrapCallback=function(a){var b=q;return function(){var c=q;q=b;try{return a.apply(this,arguments)}finally{q=c}}}; |
@@ -1,5 +0,6 @@ | ||
/** @license React vundefined | ||
/** | ||
* @license React | ||
* scheduler-unstable_post_task.development.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -66,5 +67,6 @@ * This source code is licensed under the MIT license found in the | ||
var controller = new TaskController(); | ||
var controller = new TaskController({ | ||
priority: postTaskPriority | ||
}); | ||
var postTaskOptions = { | ||
priority: postTaskPriority, | ||
delay: typeof options === 'object' && options !== null ? options.delay : 0, | ||
@@ -85,4 +87,4 @@ signal: controller.signal | ||
currentPriorityLevel_DEPRECATED = priorityLevel; | ||
var _didTimeout_DEPRECATED = false; | ||
var result = callback(_didTimeout_DEPRECATED); | ||
var didTimeout_DEPRECATED = false; | ||
var result = callback(didTimeout_DEPRECATED); | ||
@@ -92,5 +94,6 @@ if (typeof result === 'function') { | ||
var continuation = result; | ||
var continuationController = new TaskController(); | ||
var continuationController = new TaskController({ | ||
priority: postTaskPriority | ||
}); | ||
var continuationOptions = { | ||
priority: postTaskPriority, | ||
signal: continuationController.signal | ||
@@ -101,3 +104,9 @@ }; // Update the original callback node's controller, since even though we're | ||
node._controller = continuationController; | ||
scheduler.postTask(runTask.bind(null, priorityLevel, postTaskPriority, node, continuation), continuationOptions).catch(handleAbortError); | ||
var nextTask = runTask.bind(null, priorityLevel, postTaskPriority, node, continuation); | ||
if (scheduler.yield !== undefined) { | ||
scheduler.yield(continuationOptions).then(nextTask).catch(handleAbortError); | ||
} else { | ||
scheduler.postTask(nextTask, continuationOptions).catch(handleAbortError); | ||
} | ||
} | ||
@@ -104,0 +113,0 @@ } catch (error) { |
@@ -1,5 +0,6 @@ | ||
/** @license React vundefined | ||
/** | ||
* @license React | ||
* scheduler-unstable_post_task.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -9,6 +10,6 @@ * This source code is licensed under the MIT license found in the | ||
*/ | ||
'use strict';var a=window.performance,g=window.setTimeout,h=global.scheduler,k=a.now.bind(a),l=0,m=3;function p(c,d,b,f){l=k()+5;try{m=c;var e=f(!1);if("function"===typeof e){var n=new TaskController,r={priority:d,signal:n.signal};b._controller=n;h.postTask(p.bind(null,c,d,b,e),r).catch(q)}}catch(t){g(function(){throw t;})}finally{m=3}}function q(){}exports.unstable_IdlePriority=5;exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3; | ||
exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(c){c._controller.abort()};exports.unstable_continueExecution=function(){};exports.unstable_forceFrameRate=function(){};exports.unstable_getCurrentPriorityLevel=function(){return m};exports.unstable_getFirstCallbackNode=function(){return null};exports.unstable_next=function(c){switch(m){case 1:case 2:case 3:var d=3;break;default:d=m}var b=m;m=d;try{return c()}finally{m=b}}; | ||
exports.unstable_now=k;exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=function(){};exports.unstable_runWithPriority=function(c,d){var b=m;m=c;try{return d()}finally{m=b}}; | ||
exports.unstable_scheduleCallback=function(c,d,b){switch(c){case 1:case 2:var f="user-blocking";break;case 4:case 3:f="user-visible";break;case 5:f="background";break;default:f="user-visible"}var e=new TaskController;b={priority:f,delay:"object"===typeof b&&null!==b?b.delay:0,signal:e.signal};e={_controller:e};h.postTask(p.bind(null,c,f,e,d),b).catch(q);return e};exports.unstable_shouldYield=function(){return k()>=l}; | ||
'use strict';var a=window.performance,g=window.setTimeout,h=global.scheduler,k=a.now.bind(a),l=0,m=3;function n(c,d,b,f){l=k()+5;try{m=c;var e=f(!1);if("function"===typeof e){var p=new TaskController({priority:d}),q={signal:p.signal};b._controller=p;var r=n.bind(null,c,d,b,e);void 0!==h.yield?h.yield(q).then(r).catch(t):h.postTask(r,q).catch(t)}}catch(u){g(function(){throw u;})}finally{m=3}}function t(){}exports.unstable_IdlePriority=5;exports.unstable_ImmediatePriority=1; | ||
exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(c){c._controller.abort()};exports.unstable_continueExecution=function(){};exports.unstable_forceFrameRate=function(){};exports.unstable_getCurrentPriorityLevel=function(){return m};exports.unstable_getFirstCallbackNode=function(){return null}; | ||
exports.unstable_next=function(c){switch(m){case 1:case 2:case 3:var d=3;break;default:d=m}var b=m;m=d;try{return c()}finally{m=b}};exports.unstable_now=k;exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=function(){};exports.unstable_runWithPriority=function(c,d){var b=m;m=c;try{return d()}finally{m=b}}; | ||
exports.unstable_scheduleCallback=function(c,d,b){switch(c){case 1:case 2:var f="user-blocking";break;case 4:case 3:f="user-visible";break;case 5:f="background";break;default:f="user-visible"}var e=new TaskController({priority:f});b={delay:"object"===typeof b&&null!==b?b.delay:0,signal:e.signal};e={_controller:e};h.postTask(n.bind(null,c,f,e,d),b).catch(t);return e};exports.unstable_shouldYield=function(){return k()>=l}; | ||
exports.unstable_wrapCallback=function(c){var d=m;return function(){var b=m;m=d;try{return c()}finally{m=b}}}; |
@@ -1,5 +0,6 @@ | ||
/** @license React vundefined | ||
/** | ||
* @license React | ||
* scheduler.development.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -14,7 +15,17 @@ * This source code is licensed under the MIT license found in the | ||
(function() { | ||
'use strict'; | ||
var enableSchedulerDebugging = false; | ||
var enableProfiling = true; | ||
'use strict'; | ||
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ | ||
if ( | ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && | ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === | ||
'function' | ||
) { | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); | ||
} | ||
var enableSchedulerDebugging = false; | ||
var enableProfiling = false; | ||
var frameYieldMs = 5; | ||
function push(heap, node) { | ||
@@ -26,20 +37,18 @@ var index = heap.length; | ||
function peek(heap) { | ||
var first = heap[0]; | ||
return first === undefined ? null : first; | ||
return heap.length === 0 ? null : heap[0]; | ||
} | ||
function pop(heap) { | ||
if (heap.length === 0) { | ||
return null; | ||
} | ||
var first = heap[0]; | ||
var last = heap.pop(); | ||
if (first !== undefined) { | ||
var last = heap.pop(); | ||
if (last !== first) { | ||
heap[0] = last; | ||
siftDown(heap, last, 0); | ||
} | ||
if (last !== first) { | ||
heap[0] = last; | ||
siftDown(heap, last, 0); | ||
} | ||
return first; | ||
} else { | ||
return null; | ||
} | ||
return first; | ||
} | ||
@@ -50,7 +59,7 @@ | ||
while (true) { | ||
while (index > 0) { | ||
var parentIndex = index - 1 >>> 1; | ||
var parent = heap[parentIndex]; | ||
if (parent !== undefined && compare(parent, node) > 0) { | ||
if (compare(parent, node) > 0) { | ||
// The parent is larger. Swap positions. | ||
@@ -70,4 +79,5 @@ heap[parentIndex] = node; | ||
var length = heap.length; | ||
var halfLength = length >>> 1; | ||
while (index < length) { | ||
while (index < halfLength) { | ||
var leftIndex = (index + 1) * 2 - 1; | ||
@@ -78,4 +88,4 @@ var left = heap[leftIndex]; | ||
if (left !== undefined && compare(left, node) < 0) { | ||
if (right !== undefined && compare(right, left) < 0) { | ||
if (compare(left, node) < 0) { | ||
if (rightIndex < length && compare(right, left) < 0) { | ||
heap[index] = right; | ||
@@ -89,3 +99,3 @@ heap[rightIndex] = node; | ||
} | ||
} else if (right !== undefined && compare(right, node) < 0) { | ||
} else if (rightIndex < length && compare(right, node) < 0) { | ||
heap[index] = right; | ||
@@ -108,3 +118,2 @@ heap[rightIndex] = node; | ||
// TODO: Use symbols? | ||
var NoPriority = 0; | ||
var ImmediatePriority = 1; | ||
@@ -116,167 +125,10 @@ var UserBlockingPriority = 2; | ||
var runIdCounter = 0; | ||
var mainThreadIdCounter = 0; | ||
var profilingStateSize = 4; | ||
var sharedProfilingBuffer = // $FlowFixMe Flow doesn't know about SharedArrayBuffer | ||
typeof SharedArrayBuffer === 'function' ? new SharedArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : // $FlowFixMe Flow doesn't know about ArrayBuffer | ||
typeof ArrayBuffer === 'function' ? new ArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : null // Don't crash the init path on IE9 | ||
; | ||
var profilingState = sharedProfilingBuffer !== null ? new Int32Array(sharedProfilingBuffer) : []; // We can't read this but it helps save bytes for null checks | ||
var PRIORITY = 0; | ||
var CURRENT_TASK_ID = 1; | ||
var CURRENT_RUN_ID = 2; | ||
var QUEUE_SIZE = 3; | ||
{ | ||
profilingState[PRIORITY] = NoPriority; // This is maintained with a counter, because the size of the priority queue | ||
// array might include canceled tasks. | ||
profilingState[QUEUE_SIZE] = 0; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
} // Bytes per element is 4 | ||
var INITIAL_EVENT_LOG_SIZE = 131072; | ||
var MAX_EVENT_LOG_SIZE = 524288; // Equivalent to 2 megabytes | ||
var eventLogSize = 0; | ||
var eventLogBuffer = null; | ||
var eventLog = null; | ||
var eventLogIndex = 0; | ||
var TaskStartEvent = 1; | ||
var TaskCompleteEvent = 2; | ||
var TaskErrorEvent = 3; | ||
var TaskCancelEvent = 4; | ||
var TaskRunEvent = 5; | ||
var TaskYieldEvent = 6; | ||
var SchedulerSuspendEvent = 7; | ||
var SchedulerResumeEvent = 8; | ||
function logEvent(entries) { | ||
if (eventLog !== null) { | ||
var offset = eventLogIndex; | ||
eventLogIndex += entries.length; | ||
if (eventLogIndex + 1 > eventLogSize) { | ||
eventLogSize *= 2; | ||
if (eventLogSize > MAX_EVENT_LOG_SIZE) { | ||
// Using console['error'] to evade Babel and ESLint | ||
console['error']("Scheduler Profiling: Event log exceeded maximum size. Don't " + 'forget to call `stopLoggingProfilingEvents()`.'); | ||
stopLoggingProfilingEvents(); | ||
return; | ||
} | ||
var newEventLog = new Int32Array(eventLogSize * 4); | ||
newEventLog.set(eventLog); | ||
eventLogBuffer = newEventLog.buffer; | ||
eventLog = newEventLog; | ||
} | ||
eventLog.set(entries, offset); | ||
} | ||
} | ||
function startLoggingProfilingEvents() { | ||
eventLogSize = INITIAL_EVENT_LOG_SIZE; | ||
eventLogBuffer = new ArrayBuffer(eventLogSize * 4); | ||
eventLog = new Int32Array(eventLogBuffer); | ||
eventLogIndex = 0; | ||
} | ||
function stopLoggingProfilingEvents() { | ||
var buffer = eventLogBuffer; | ||
eventLogSize = 0; | ||
eventLogBuffer = null; | ||
eventLog = null; | ||
eventLogIndex = 0; | ||
return buffer; | ||
} | ||
function markTaskStart(task, ms) { | ||
{ | ||
profilingState[QUEUE_SIZE]++; | ||
if (eventLog !== null) { | ||
// performance.now returns a float, representing milliseconds. When the | ||
// event is logged, it's coerced to an int. Convert to microseconds to | ||
// maintain extra degrees of precision. | ||
logEvent([TaskStartEvent, ms * 1000, task.id, task.priorityLevel]); | ||
} | ||
} | ||
} | ||
function markTaskCompleted(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskCompleteEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskCanceled(task, ms) { | ||
{ | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskCancelEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskErrored(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskErrorEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskRun(task, ms) { | ||
{ | ||
runIdCounter++; | ||
profilingState[PRIORITY] = task.priorityLevel; | ||
profilingState[CURRENT_TASK_ID] = task.id; | ||
profilingState[CURRENT_RUN_ID] = runIdCounter; | ||
if (eventLog !== null) { | ||
logEvent([TaskRunEvent, ms * 1000, task.id, runIdCounter]); | ||
} | ||
} | ||
} | ||
function markTaskYield(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[CURRENT_RUN_ID] = 0; | ||
if (eventLog !== null) { | ||
logEvent([TaskYieldEvent, ms * 1000, task.id, runIdCounter]); | ||
} | ||
} | ||
} | ||
function markSchedulerSuspended(ms) { | ||
{ | ||
mainThreadIdCounter++; | ||
if (eventLog !== null) { | ||
logEvent([SchedulerSuspendEvent, ms * 1000, mainThreadIdCounter]); | ||
} | ||
} | ||
} | ||
function markSchedulerUnsuspended(ms) { | ||
{ | ||
if (eventLog !== null) { | ||
logEvent([SchedulerResumeEvent, ms * 1000, mainThreadIdCounter]); | ||
} | ||
} | ||
} | ||
/* eslint-disable no-var */ | ||
exports.unstable_now = void 0; | ||
var hasPerformanceNow = // $FlowFixMe[method-unbinding] | ||
typeof performance === 'object' && typeof performance.now === 'function'; | ||
var hasPerformanceNow = typeof performance === 'object' && typeof performance.now === 'function'; | ||
if (hasPerformanceNow) { | ||
@@ -315,3 +167,3 @@ var localPerformance = performance; | ||
var currentTask = null; | ||
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy. | ||
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance. | ||
@@ -322,23 +174,10 @@ var isPerformingWork = false; | ||
var setTimeout = window.setTimeout; | ||
var clearTimeout = window.clearTimeout; | ||
var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : null; | ||
var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : null; | ||
var localSetImmediate = typeof setImmediate !== 'undefined' ? setImmediate : null; // IE and Node.js + jsdom | ||
if (typeof console !== 'undefined') { | ||
// TODO: Scheduler no longer requires these methods to be polyfilled. But | ||
// maybe we want to continue warning if they don't exist, to preserve the | ||
// option to rely on it in the future? | ||
var requestAnimationFrame = window.requestAnimationFrame; | ||
var cancelAnimationFrame = window.cancelAnimationFrame; | ||
typeof navigator !== 'undefined' && // $FlowFixMe[prop-missing] | ||
navigator.scheduling !== undefined && // $FlowFixMe[incompatible-type] | ||
navigator.scheduling.isInputPending !== undefined ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null; | ||
if (typeof requestAnimationFrame !== 'function') { | ||
// Using console['error'] to evade Babel and ESLint | ||
console['error']("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://reactjs.org/link/react-polyfills'); | ||
} | ||
if (typeof cancelAnimationFrame !== 'function') { | ||
// Using console['error'] to evade Babel and ESLint | ||
console['error']("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://reactjs.org/link/react-polyfills'); | ||
} | ||
} | ||
function advanceTimers(currentTime) { | ||
@@ -357,7 +196,2 @@ // Check for tasks that are no longer delayed and add them to the queue. | ||
push(taskQueue, timer); | ||
{ | ||
markTaskStart(timer, currentTime); | ||
timer.isQueued = true; | ||
} | ||
} else { | ||
@@ -379,3 +213,3 @@ // Remaining timers are pending. | ||
isHostCallbackScheduled = true; | ||
requestHostCallback(flushWork); | ||
requestHostCallback(); | ||
} else { | ||
@@ -391,6 +225,3 @@ var firstTimer = peek(timerQueue); | ||
function flushWork(hasTimeRemaining, initialTime) { | ||
{ | ||
markSchedulerUnsuspended(initialTime); | ||
} // We'll need a host callback the next time work is scheduled. | ||
function flushWork(initialTime) { | ||
@@ -410,17 +241,5 @@ | ||
try { | ||
if (enableProfiling) { | ||
try { | ||
return workLoop(hasTimeRemaining, initialTime); | ||
} catch (error) { | ||
if (currentTask !== null) { | ||
var currentTime = exports.unstable_now(); | ||
markTaskErrored(currentTask, currentTime); | ||
currentTask.isQueued = false; | ||
} | ||
throw error; | ||
} | ||
} else { | ||
var currentTime; if (enableProfiling) ; else { | ||
// No catch in prod code path. | ||
return workLoop(hasTimeRemaining, initialTime); | ||
return workLoop(initialTime); | ||
} | ||
@@ -431,12 +250,6 @@ } finally { | ||
isPerformingWork = false; | ||
{ | ||
var _currentTime = exports.unstable_now(); | ||
markSchedulerSuspended(_currentTime); | ||
} | ||
} | ||
} | ||
function workLoop(hasTimeRemaining, initialTime) { | ||
function workLoop(initialTime) { | ||
var currentTime = initialTime; | ||
@@ -447,14 +260,18 @@ advanceTimers(currentTime); | ||
while (currentTask !== null && !(enableSchedulerDebugging )) { | ||
if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) { | ||
if (currentTask.expirationTime > currentTime && shouldYieldToHost()) { | ||
// This currentTask hasn't expired, and we've reached the deadline. | ||
break; | ||
} | ||
} // $FlowFixMe[incompatible-use] found when upgrading Flow | ||
var callback = currentTask.callback; | ||
if (typeof callback === 'function') { | ||
currentTask.callback = null; | ||
currentPriorityLevel = currentTask.priorityLevel; | ||
// $FlowFixMe[incompatible-use] found when upgrading Flow | ||
currentTask.callback = null; // $FlowFixMe[incompatible-use] found when upgrading Flow | ||
currentPriorityLevel = currentTask.priorityLevel; // $FlowFixMe[incompatible-use] found when upgrading Flow | ||
var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; | ||
markTaskRun(currentTask, currentTime); | ||
var continuationCallback = callback(didUserCallbackTimeout); | ||
@@ -464,9 +281,10 @@ currentTime = exports.unstable_now(); | ||
if (typeof continuationCallback === 'function') { | ||
// If a continuation is returned, immediately yield to the main thread | ||
// regardless of how much time is left in the current time slice. | ||
// $FlowFixMe[incompatible-use] found when upgrading Flow | ||
currentTask.callback = continuationCallback; | ||
markTaskYield(currentTask, currentTime); | ||
advanceTimers(currentTime); | ||
return true; | ||
} else { | ||
{ | ||
markTaskCompleted(currentTask, currentTime); | ||
currentTask.isQueued = false; | ||
} | ||
@@ -476,5 +294,5 @@ if (currentTask === peek(taskQueue)) { | ||
} | ||
advanceTimers(currentTime); | ||
} | ||
advanceTimers(currentTime); | ||
} else { | ||
@@ -552,3 +370,5 @@ pop(taskQueue); | ||
function unstable_wrapCallback(callback) { | ||
var parentPriorityLevel = currentPriorityLevel; | ||
var parentPriorityLevel = currentPriorityLevel; // $FlowFixMe[incompatible-return] | ||
// $FlowFixMe[missing-this-annot] | ||
return function () { | ||
@@ -618,6 +438,2 @@ // This is a fork of runWithPriority, inlined for performance. | ||
{ | ||
newTask.isQueued = false; | ||
} | ||
if (startTime > currentTime) { | ||
@@ -643,7 +459,2 @@ // This is a delayed task. | ||
push(taskQueue, newTask); | ||
{ | ||
markTaskStart(newTask, currentTime); | ||
newTask.isQueued = true; | ||
} // Schedule a host callback, if needed. If we're already performing work, | ||
// wait until the next time we yield. | ||
@@ -654,3 +465,3 @@ | ||
isHostCallbackScheduled = true; | ||
requestHostCallback(flushWork); | ||
requestHostCallback(); | ||
} | ||
@@ -669,3 +480,3 @@ } | ||
isHostCallbackScheduled = true; | ||
requestHostCallback(flushWork); | ||
requestHostCallback(); | ||
} | ||
@@ -679,9 +490,2 @@ } | ||
function unstable_cancelCallback(task) { | ||
{ | ||
if (task.isQueued) { | ||
var currentTime = exports.unstable_now(); | ||
markTaskCanceled(task, currentTime); | ||
task.isQueued = false; | ||
} | ||
} // Null out the callback to indicate the task has been canceled. (Can't | ||
// remove from the queue because you can't remove arbitrary nodes from an | ||
@@ -699,3 +503,2 @@ // array based heap, only the first one.) | ||
var isMessageLoopRunning = false; | ||
var scheduledHostCallback = null; | ||
var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main | ||
@@ -706,11 +509,16 @@ // thread, like user events. By default, it yields multiple times per frame. | ||
var yieldInterval = 5; | ||
var deadline = 0; // TODO: Make this configurable | ||
var frameInterval = frameYieldMs; | ||
var startTime = -1; | ||
function shouldYieldToHost() { | ||
{ | ||
// `isInputPending` is not available. Since we have no way of knowing if | ||
// there's pending input, always yield at the end of the frame. | ||
return exports.unstable_now() >= deadline; | ||
} | ||
var timeElapsed = exports.unstable_now() - startTime; | ||
if (timeElapsed < frameInterval) { | ||
// The main thread has only been blocked for a really short amount of time; | ||
// smaller than a single frame. Don't yield yet. | ||
return false; | ||
} // The main thread has been blocked for a non-negligible amount of time. We | ||
return true; | ||
} | ||
@@ -730,6 +538,6 @@ | ||
if (fps > 0) { | ||
yieldInterval = Math.floor(1000 / fps); | ||
frameInterval = Math.floor(1000 / fps); | ||
} else { | ||
// reset the framerate | ||
yieldInterval = 5; | ||
frameInterval = frameYieldMs; | ||
} | ||
@@ -739,14 +547,12 @@ } | ||
var performWorkUntilDeadline = function () { | ||
if (scheduledHostCallback !== null) { | ||
var currentTime = exports.unstable_now(); // Yield after `yieldInterval` ms, regardless of where we are in the vsync | ||
// cycle. This means there's always time remaining at the beginning of | ||
// the message event. | ||
if (isMessageLoopRunning) { | ||
var currentTime = exports.unstable_now(); // Keep track of the start time so we can measure how long the main thread | ||
// has been blocked. | ||
deadline = currentTime + yieldInterval; | ||
var hasTimeRemaining = true; // If a scheduler task throws, exit the current browser task so the | ||
startTime = currentTime; // If a scheduler task throws, exit the current browser task so the | ||
// error can be observed. | ||
// | ||
// Intentionally not using a try-catch, since that makes some debugging | ||
// techniques harder. Instead, if `scheduledHostCallback` errors, then | ||
// `hasMoreWork` will remain true, and we'll continue the work loop. | ||
// techniques harder. Instead, if `flushWork` errors, then `hasMoreWork` will | ||
// remain true, and we'll continue the work loop. | ||
@@ -756,3 +562,3 @@ var hasMoreWork = true; | ||
try { | ||
hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime); | ||
hasMoreWork = flushWork(currentTime); | ||
} finally { | ||
@@ -762,23 +568,49 @@ if (hasMoreWork) { | ||
// of the preceding one. | ||
port.postMessage(null); | ||
schedulePerformWorkUntilDeadline(); | ||
} else { | ||
isMessageLoopRunning = false; | ||
scheduledHostCallback = null; | ||
} | ||
} | ||
} else { | ||
isMessageLoopRunning = false; | ||
} // Yielding to the browser will give it a chance to paint, so we can | ||
}; | ||
var channel = new MessageChannel(); | ||
var port = channel.port2; | ||
channel.port1.onmessage = performWorkUntilDeadline; | ||
var schedulePerformWorkUntilDeadline; | ||
function requestHostCallback(callback) { | ||
scheduledHostCallback = callback; | ||
if (typeof localSetImmediate === 'function') { | ||
// Node.js and old IE. | ||
// There's a few reasons for why we prefer setImmediate. | ||
// | ||
// Unlike MessageChannel, it doesn't prevent a Node.js process from exiting. | ||
// (Even though this is a DOM fork of the Scheduler, you could get here | ||
// with a mix of Node.js 15+, which has a MessageChannel, and jsdom.) | ||
// https://github.com/facebook/react/issues/20756 | ||
// | ||
// But also, it runs earlier which is the semantic we want. | ||
// If other browsers ever implement it, it's better to use it. | ||
// Although both of these would be inferior to native scheduling. | ||
schedulePerformWorkUntilDeadline = function () { | ||
localSetImmediate(performWorkUntilDeadline); | ||
}; | ||
} else if (typeof MessageChannel !== 'undefined') { | ||
// DOM and Worker environments. | ||
// We prefer MessageChannel because of the 4ms setTimeout clamping. | ||
var channel = new MessageChannel(); | ||
var port = channel.port2; | ||
channel.port1.onmessage = performWorkUntilDeadline; | ||
schedulePerformWorkUntilDeadline = function () { | ||
port.postMessage(null); | ||
}; | ||
} else { | ||
// We should only fallback here in non-browser environments. | ||
schedulePerformWorkUntilDeadline = function () { | ||
// $FlowFixMe[not-a-function] nullable value | ||
localSetTimeout(performWorkUntilDeadline, 0); | ||
}; | ||
} | ||
function requestHostCallback() { | ||
if (!isMessageLoopRunning) { | ||
isMessageLoopRunning = true; | ||
port.postMessage(null); | ||
schedulePerformWorkUntilDeadline(); | ||
} | ||
@@ -788,3 +620,4 @@ } | ||
function requestHostTimeout(callback, ms) { | ||
taskTimeoutID = setTimeout(function () { | ||
// $FlowFixMe[not-a-function] nullable value | ||
taskTimeoutID = localSetTimeout(function () { | ||
callback(exports.unstable_now()); | ||
@@ -795,13 +628,8 @@ }, ms); | ||
function cancelHostTimeout() { | ||
clearTimeout(taskTimeoutID); | ||
// $FlowFixMe[not-a-function] nullable value | ||
localClearTimeout(taskTimeoutID); | ||
taskTimeoutID = -1; | ||
} | ||
var unstable_Profiling = null; | ||
var unstable_requestPaint = requestPaint; | ||
var unstable_Profiling = { | ||
startLoggingProfilingEvents: startLoggingProfilingEvents, | ||
stopLoggingProfilingEvents: stopLoggingProfilingEvents, | ||
sharedProfilingBuffer: sharedProfilingBuffer | ||
} ; | ||
exports.unstable_IdlePriority = IdlePriority; | ||
@@ -820,3 +648,3 @@ exports.unstable_ImmediatePriority = ImmediatePriority; | ||
exports.unstable_pauseExecution = unstable_pauseExecution; | ||
exports.unstable_requestPaint = unstable_requestPaint; | ||
exports.unstable_requestPaint = requestPaint; | ||
exports.unstable_runWithPriority = unstable_runWithPriority; | ||
@@ -826,3 +654,12 @@ exports.unstable_scheduleCallback = unstable_scheduleCallback; | ||
exports.unstable_wrapCallback = unstable_wrapCallback; | ||
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ | ||
if ( | ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && | ||
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === | ||
'function' | ||
) { | ||
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); | ||
} | ||
})(); | ||
} |
@@ -1,5 +0,6 @@ | ||
/** @license React vundefined | ||
/** | ||
* @license React | ||
* scheduler.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -9,11 +10,11 @@ * This source code is licensed under the MIT license found in the | ||
*/ | ||
'use strict';function f(a,b){var c=a.length;a.push(b);a:for(;;){var d=c-1>>>1,e=a[d];if(void 0!==e&&0<g(e,b))a[d]=b,a[c]=e,c=d;else break a}}function h(a){a=a[0];return void 0===a?null:a}function k(a){var b=a[0];if(void 0!==b){var c=a.pop();if(c!==b){a[0]=c;a:for(var d=0,e=a.length;d<e;){var m=2*(d+1)-1,n=a[m],r=m+1,q=a[r];if(void 0!==n&&0>g(n,c))void 0!==q&&0>g(q,n)?(a[d]=q,a[r]=c,d=r):(a[d]=n,a[m]=c,d=m);else if(void 0!==q&&0>g(q,c))a[d]=q,a[r]=c,d=r;else break a}}return b}return null} | ||
function g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if("object"===typeof performance&&"function"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,t=p.now();exports.unstable_now=function(){return p.now()-t}}var u=[],v=[],w=1,x=null,y=3,z=!1,A=!1,B=!1,C=window.setTimeout,D=window.clearTimeout; | ||
if("undefined"!==typeof console){var E=window.cancelAnimationFrame;"function"!==typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills");"function"!==typeof E&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")} | ||
function F(a){for(var b=h(v);null!==b;){if(null===b.callback)k(v);else if(b.startTime<=a)k(v),b.sortIndex=b.expirationTime,f(u,b);else break;b=h(v)}}function G(a){B=!1;F(a);if(!A)if(null!==h(u))A=!0,H(I);else{var b=h(v);null!==b&&J(G,b.startTime-a)}} | ||
function I(a,b){A=!1;B&&(B=!1,D(K),K=-1);z=!0;var c=y;try{F(b);for(x=h(u);null!==x&&(!(x.expirationTime>b)||a&&!L());){var d=x.callback;if("function"===typeof d){x.callback=null;y=x.priorityLevel;var e=d(x.expirationTime<=b);b=exports.unstable_now();"function"===typeof e?x.callback=e:x===h(u)&&k(u);F(b)}else k(u);x=h(u)}if(null!==x)var m=!0;else{var n=h(v);null!==n&&J(G,n.startTime-b);m=!1}return m}finally{x=null,y=c,z=!1}}var M=!1,N=null,K=-1,O=5,P=0; | ||
function L(){return exports.unstable_now()>=P}var Q=new MessageChannel,R=Q.port2;Q.port1.onmessage=function(){if(null!==N){var a=exports.unstable_now();P=a+O;var b=!0;try{b=N(!0,a)}finally{b?R.postMessage(null):(M=!1,N=null)}}else M=!1};function H(a){N=a;M||(M=!0,R.postMessage(null))}function J(a,b){K=C(function(){a(exports.unstable_now())},b)}exports.unstable_IdlePriority=5;exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3; | ||
exports.unstable_Profiling=null;exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(a){a.callback=null};exports.unstable_continueExecution=function(){A||z||(A=!0,H(I))};exports.unstable_forceFrameRate=function(a){0>a||125<a?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<a?Math.floor(1E3/a):5};exports.unstable_getCurrentPriorityLevel=function(){return y}; | ||
exports.unstable_getFirstCallbackNode=function(){return h(u)};exports.unstable_next=function(a){switch(y){case 1:case 2:case 3:var b=3;break;default:b=y}var c=y;y=b;try{return a()}finally{y=c}};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=function(){};exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=y;y=a;try{return b()}finally{y=c}}; | ||
exports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();"object"===typeof c&&null!==c?(c=c.delay,c="number"===typeof c&&0<c?d+c:d):c=d;switch(a){case 1:var e=-1;break;case 2:e=250;break;case 5:e=1073741823;break;case 4:e=1E4;break;default:e=5E3}e=c+e;a={id:w++,callback:b,priorityLevel:a,startTime:c,expirationTime:e,sortIndex:-1};c>d?(a.sortIndex=c,f(v,a),null===h(u)&&a===h(v)&&(B?(D(K),K=-1):B=!0,J(G,c-d))):(a.sortIndex=e,f(u,a),A||z||(A=!0,H(I)));return a}; | ||
exports.unstable_shouldYield=L;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}}; | ||
'use strict';function f(a,c){var b=a.length;a.push(c);a:for(;0<b;){var d=b-1>>>1,e=a[d];if(0<g(e,c))a[d]=c,a[b]=e,b=d;else break a}}function h(a){return 0===a.length?null:a[0]}function k(a){if(0===a.length)return null;var c=a[0],b=a.pop();if(b!==c){a[0]=b;a:for(var d=0,e=a.length,v=e>>>1;d<v;){var w=2*(d+1)-1,C=a[w],m=w+1,x=a[m];if(0>g(C,b))m<e&&0>g(x,C)?(a[d]=x,a[m]=b,d=m):(a[d]=C,a[w]=b,d=w);else if(m<e&&0>g(x,b))a[d]=x,a[m]=b,d=m;else break a}}return c} | ||
function g(a,c){var b=a.sortIndex-c.sortIndex;return 0!==b?b:a.id-c.id}exports.unstable_now=void 0;if("object"===typeof performance&&"function"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var n=Date,p=n.now();exports.unstable_now=function(){return n.now()-p}} | ||
var q=[],r=[],t=1,u=null,y=3,z=!1,A=!1,B=!1,D="function"===typeof setTimeout?setTimeout:null,E="function"===typeof clearTimeout?clearTimeout:null,F="undefined"!==typeof setImmediate?setImmediate:null;"undefined"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending?navigator.scheduling.isInputPending.bind(navigator.scheduling):null; | ||
function G(a){for(var c=h(r);null!==c;){if(null===c.callback)k(r);else if(c.startTime<=a)k(r),c.sortIndex=c.expirationTime,f(q,c);else break;c=h(r)}}function H(a){B=!1;G(a);if(!A)if(null!==h(q))A=!0,I();else{var c=h(r);null!==c&&J(H,c.startTime-a)}}var K=!1,L=-1,M=5,N=-1;function O(){return exports.unstable_now()-N<M?!1:!0} | ||
function P(){if(K){var a=exports.unstable_now();N=a;var c=!0;try{a:{A=!1;B&&(B=!1,E(L),L=-1);z=!0;var b=y;try{b:{G(a);for(u=h(q);null!==u&&!(u.expirationTime>a&&O());){var d=u.callback;if("function"===typeof d){u.callback=null;y=u.priorityLevel;var e=d(u.expirationTime<=a);a=exports.unstable_now();if("function"===typeof e){u.callback=e;G(a);c=!0;break b}u===h(q)&&k(q);G(a)}else k(q);u=h(q)}if(null!==u)c=!0;else{var v=h(r);null!==v&&J(H,v.startTime-a);c=!1}}break a}finally{u=null,y=b,z=!1}c=void 0}}finally{c? | ||
Q():K=!1}}}var Q;if("function"===typeof F)Q=function(){F(P)};else if("undefined"!==typeof MessageChannel){var R=new MessageChannel,S=R.port2;R.port1.onmessage=P;Q=function(){S.postMessage(null)}}else Q=function(){D(P,0)};function I(){K||(K=!0,Q())}function J(a,c){L=D(function(){a(exports.unstable_now())},c)}exports.unstable_IdlePriority=5;exports.unstable_ImmediatePriority=1;exports.unstable_LowPriority=4;exports.unstable_NormalPriority=3;exports.unstable_Profiling=null; | ||
exports.unstable_UserBlockingPriority=2;exports.unstable_cancelCallback=function(a){a.callback=null};exports.unstable_continueExecution=function(){A||z||(A=!0,I())};exports.unstable_forceFrameRate=function(a){0>a||125<a?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<a?Math.floor(1E3/a):5};exports.unstable_getCurrentPriorityLevel=function(){return y};exports.unstable_getFirstCallbackNode=function(){return h(q)}; | ||
exports.unstable_next=function(a){switch(y){case 1:case 2:case 3:var c=3;break;default:c=y}var b=y;y=c;try{return a()}finally{y=b}};exports.unstable_pauseExecution=function(){};exports.unstable_requestPaint=function(){};exports.unstable_runWithPriority=function(a,c){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var b=y;y=a;try{return c()}finally{y=b}}; | ||
exports.unstable_scheduleCallback=function(a,c,b){var d=exports.unstable_now();"object"===typeof b&&null!==b?(b=b.delay,b="number"===typeof b&&0<b?d+b:d):b=d;switch(a){case 1:var e=-1;break;case 2:e=250;break;case 5:e=1073741823;break;case 4:e=1E4;break;default:e=5E3}e=b+e;a={id:t++,callback:c,priorityLevel:a,startTime:b,expirationTime:e,sortIndex:-1};b>d?(a.sortIndex=b,f(r,a),null===h(q)&&a===h(r)&&(B?(E(L),L=-1):B=!0,J(H,b-d))):(a.sortIndex=e,f(q,a),A||z||(A=!0,I()));return a}; | ||
exports.unstable_shouldYield=O;exports.unstable_wrapCallback=function(a){var c=y;return function(){var b=y;y=c;try{return a.apply(this,arguments)}finally{y=b}}}; |
'use strict'; | ||
if (typeof window === 'undefined' || typeof MessageChannel !== 'function') { | ||
module.exports = require('./unstable_no_dom'); | ||
} else if (process.env.NODE_ENV === 'production') { | ||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./cjs/scheduler.production.min.js'); | ||
@@ -7,0 +5,0 @@ } else { |
{ | ||
"name": "scheduler", | ||
"version": "0.0.0-experimental-0935a1db3", | ||
"version": "0.0.0-experimental-09fbee89d-20231013", | ||
"description": "Cooperative scheduler for the browser environment.", | ||
"main": "index.js", | ||
"repository": { | ||
@@ -20,4 +19,3 @@ "type": "git", | ||
"dependencies": { | ||
"loose-envify": "^1.1.0", | ||
"object-assign": "^4.1.1" | ||
"loose-envify": "^1.1.0" | ||
}, | ||
@@ -27,8 +25,5 @@ "files": [ | ||
"README.md", | ||
"build-info.json", | ||
"index.js", | ||
"tracing.js", | ||
"tracing-profiling.js", | ||
"index.native.js", | ||
"unstable_mock.js", | ||
"unstable_no_dom.js", | ||
"unstable_post_task.js", | ||
@@ -35,0 +30,0 @@ "cjs/", |
@@ -1,5 +0,6 @@ | ||
/** @license React vundefined | ||
/** | ||
* @license React | ||
* scheduler-unstable_mock.development.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -12,7 +13,7 @@ * This source code is licensed under the MIT license found in the | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = global || self, factory(global.SchedulerMock = {})); | ||
}(this, (function (exports) { 'use strict'; | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.SchedulerMock = {})); | ||
})(this, (function (exports) { 'use strict'; | ||
var enableSchedulerDebugging = false; | ||
var enableProfiling = true; | ||
var enableProfiling = false; | ||
@@ -25,20 +26,18 @@ function push(heap, node) { | ||
function peek(heap) { | ||
var first = heap[0]; | ||
return first === undefined ? null : first; | ||
return heap.length === 0 ? null : heap[0]; | ||
} | ||
function pop(heap) { | ||
if (heap.length === 0) { | ||
return null; | ||
} | ||
var first = heap[0]; | ||
var last = heap.pop(); | ||
if (first !== undefined) { | ||
var last = heap.pop(); | ||
if (last !== first) { | ||
heap[0] = last; | ||
siftDown(heap, last, 0); | ||
} | ||
if (last !== first) { | ||
heap[0] = last; | ||
siftDown(heap, last, 0); | ||
} | ||
return first; | ||
} else { | ||
return null; | ||
} | ||
return first; | ||
} | ||
@@ -49,7 +48,7 @@ | ||
while (true) { | ||
while (index > 0) { | ||
var parentIndex = index - 1 >>> 1; | ||
var parent = heap[parentIndex]; | ||
if (parent !== undefined && compare(parent, node) > 0) { | ||
if (compare(parent, node) > 0) { | ||
// The parent is larger. Swap positions. | ||
@@ -69,4 +68,5 @@ heap[parentIndex] = node; | ||
var length = heap.length; | ||
var halfLength = length >>> 1; | ||
while (index < length) { | ||
while (index < halfLength) { | ||
var leftIndex = (index + 1) * 2 - 1; | ||
@@ -77,4 +77,4 @@ var left = heap[leftIndex]; | ||
if (left !== undefined && compare(left, node) < 0) { | ||
if (right !== undefined && compare(right, left) < 0) { | ||
if (compare(left, node) < 0) { | ||
if (rightIndex < length && compare(right, left) < 0) { | ||
heap[index] = right; | ||
@@ -88,3 +88,3 @@ heap[rightIndex] = node; | ||
} | ||
} else if (right !== undefined && compare(right, node) < 0) { | ||
} else if (rightIndex < length && compare(right, node) < 0) { | ||
heap[index] = right; | ||
@@ -107,3 +107,2 @@ heap[rightIndex] = node; | ||
// TODO: Use symbols? | ||
var NoPriority = 0; | ||
var ImmediatePriority = 1; | ||
@@ -115,163 +114,5 @@ var UserBlockingPriority = 2; | ||
var runIdCounter = 0; | ||
var mainThreadIdCounter = 0; | ||
var profilingStateSize = 4; | ||
var sharedProfilingBuffer = // $FlowFixMe Flow doesn't know about SharedArrayBuffer | ||
typeof SharedArrayBuffer === 'function' ? new SharedArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : // $FlowFixMe Flow doesn't know about ArrayBuffer | ||
typeof ArrayBuffer === 'function' ? new ArrayBuffer(profilingStateSize * Int32Array.BYTES_PER_ELEMENT) : null // Don't crash the init path on IE9 | ||
; | ||
var profilingState = sharedProfilingBuffer !== null ? new Int32Array(sharedProfilingBuffer) : []; // We can't read this but it helps save bytes for null checks | ||
var PRIORITY = 0; | ||
var CURRENT_TASK_ID = 1; | ||
var CURRENT_RUN_ID = 2; | ||
var QUEUE_SIZE = 3; | ||
{ | ||
profilingState[PRIORITY] = NoPriority; // This is maintained with a counter, because the size of the priority queue | ||
// array might include canceled tasks. | ||
profilingState[QUEUE_SIZE] = 0; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
} // Bytes per element is 4 | ||
var INITIAL_EVENT_LOG_SIZE = 131072; | ||
var MAX_EVENT_LOG_SIZE = 524288; // Equivalent to 2 megabytes | ||
var eventLogSize = 0; | ||
var eventLogBuffer = null; | ||
var eventLog = null; | ||
var eventLogIndex = 0; | ||
var TaskStartEvent = 1; | ||
var TaskCompleteEvent = 2; | ||
var TaskErrorEvent = 3; | ||
var TaskCancelEvent = 4; | ||
var TaskRunEvent = 5; | ||
var TaskYieldEvent = 6; | ||
var SchedulerSuspendEvent = 7; | ||
var SchedulerResumeEvent = 8; | ||
function logEvent(entries) { | ||
if (eventLog !== null) { | ||
var offset = eventLogIndex; | ||
eventLogIndex += entries.length; | ||
if (eventLogIndex + 1 > eventLogSize) { | ||
eventLogSize *= 2; | ||
if (eventLogSize > MAX_EVENT_LOG_SIZE) { | ||
// Using console['error'] to evade Babel and ESLint | ||
console['error']("Scheduler Profiling: Event log exceeded maximum size. Don't " + 'forget to call `stopLoggingProfilingEvents()`.'); | ||
stopLoggingProfilingEvents(); | ||
return; | ||
} | ||
var newEventLog = new Int32Array(eventLogSize * 4); | ||
newEventLog.set(eventLog); | ||
eventLogBuffer = newEventLog.buffer; | ||
eventLog = newEventLog; | ||
} | ||
eventLog.set(entries, offset); | ||
} | ||
} | ||
function startLoggingProfilingEvents() { | ||
eventLogSize = INITIAL_EVENT_LOG_SIZE; | ||
eventLogBuffer = new ArrayBuffer(eventLogSize * 4); | ||
eventLog = new Int32Array(eventLogBuffer); | ||
eventLogIndex = 0; | ||
} | ||
function stopLoggingProfilingEvents() { | ||
var buffer = eventLogBuffer; | ||
eventLogSize = 0; | ||
eventLogBuffer = null; | ||
eventLog = null; | ||
eventLogIndex = 0; | ||
return buffer; | ||
} | ||
function markTaskStart(task, ms) { | ||
{ | ||
profilingState[QUEUE_SIZE]++; | ||
if (eventLog !== null) { | ||
// performance.now returns a float, representing milliseconds. When the | ||
// event is logged, it's coerced to an int. Convert to microseconds to | ||
// maintain extra degrees of precision. | ||
logEvent([TaskStartEvent, ms * 1000, task.id, task.priorityLevel]); | ||
} | ||
} | ||
} | ||
function markTaskCompleted(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskCompleteEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskCanceled(task, ms) { | ||
{ | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskCancelEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskErrored(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[QUEUE_SIZE]--; | ||
if (eventLog !== null) { | ||
logEvent([TaskErrorEvent, ms * 1000, task.id]); | ||
} | ||
} | ||
} | ||
function markTaskRun(task, ms) { | ||
{ | ||
runIdCounter++; | ||
profilingState[PRIORITY] = task.priorityLevel; | ||
profilingState[CURRENT_TASK_ID] = task.id; | ||
profilingState[CURRENT_RUN_ID] = runIdCounter; | ||
if (eventLog !== null) { | ||
logEvent([TaskRunEvent, ms * 1000, task.id, runIdCounter]); | ||
} | ||
} | ||
} | ||
function markTaskYield(task, ms) { | ||
{ | ||
profilingState[PRIORITY] = NoPriority; | ||
profilingState[CURRENT_TASK_ID] = 0; | ||
profilingState[CURRENT_RUN_ID] = 0; | ||
if (eventLog !== null) { | ||
logEvent([TaskYieldEvent, ms * 1000, task.id, runIdCounter]); | ||
} | ||
} | ||
} | ||
function markSchedulerSuspended(ms) { | ||
{ | ||
mainThreadIdCounter++; | ||
if (eventLog !== null) { | ||
logEvent([SchedulerSuspendEvent, ms * 1000, mainThreadIdCounter]); | ||
} | ||
} | ||
} | ||
function markSchedulerUnsuspended(ms) { | ||
{ | ||
if (eventLog !== null) { | ||
logEvent([SchedulerResumeEvent, ms * 1000, mainThreadIdCounter]); | ||
} | ||
} | ||
} | ||
/* eslint-disable no-var */ | ||
@@ -296,3 +137,3 @@ // Math.pow(2, 30) - 1 | ||
var currentTask = null; | ||
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy. | ||
var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance. | ||
@@ -312,3 +153,8 @@ var isPerformingWork = false; | ||
var shouldYieldForPaint = false; | ||
var disableYieldValue = false; | ||
function setDisableYieldValue(newValue) { | ||
disableYieldValue = newValue; | ||
} | ||
function advanceTimers(currentTime) { | ||
@@ -327,7 +173,2 @@ // Check for tasks that are no longer delayed and add them to the queue. | ||
push(taskQueue, timer); | ||
{ | ||
markTaskStart(timer, currentTime); | ||
timer.isQueued = true; | ||
} | ||
} else { | ||
@@ -361,5 +202,2 @@ // Remaining timers are pending. | ||
function flushWork(hasTimeRemaining, initialTime) { | ||
{ | ||
markSchedulerUnsuspended(initialTime); | ||
} // We'll need a host callback the next time work is scheduled. | ||
@@ -379,15 +217,3 @@ | ||
try { | ||
if (enableProfiling) { | ||
try { | ||
return workLoop(hasTimeRemaining, initialTime); | ||
} catch (error) { | ||
if (currentTask !== null) { | ||
var currentTime = getCurrentTime(); | ||
markTaskErrored(currentTask, currentTime); | ||
currentTask.isQueued = false; | ||
} | ||
throw error; | ||
} | ||
} else { | ||
var currentTime; if (enableProfiling) ; else { | ||
// No catch in prod code path. | ||
@@ -400,8 +226,2 @@ return workLoop(hasTimeRemaining, initialTime); | ||
isPerformingWork = false; | ||
{ | ||
var _currentTime = getCurrentTime(); | ||
markSchedulerSuspended(_currentTime); | ||
} | ||
} | ||
@@ -419,11 +239,15 @@ } | ||
break; | ||
} | ||
} // $FlowFixMe[incompatible-use] found when upgrading Flow | ||
var callback = currentTask.callback; | ||
if (typeof callback === 'function') { | ||
currentTask.callback = null; | ||
currentPriorityLevel = currentTask.priorityLevel; | ||
// $FlowFixMe[incompatible-use] found when upgrading Flow | ||
currentTask.callback = null; // $FlowFixMe[incompatible-use] found when upgrading Flow | ||
currentPriorityLevel = currentTask.priorityLevel; // $FlowFixMe[incompatible-use] found when upgrading Flow | ||
var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; | ||
markTaskRun(currentTask, currentTime); | ||
var continuationCallback = callback(didUserCallbackTimeout); | ||
@@ -433,9 +257,14 @@ currentTime = getCurrentTime(); | ||
if (typeof continuationCallback === 'function') { | ||
// If a continuation is returned, immediately yield to the main thread | ||
// regardless of how much time is left in the current time slice. | ||
// $FlowFixMe[incompatible-use] found when upgrading Flow | ||
currentTask.callback = continuationCallback; | ||
markTaskYield(currentTask, currentTime); | ||
advanceTimers(currentTime); | ||
if (shouldYieldForPaint) { | ||
needsPaint = true; | ||
return true; | ||
} | ||
} else { | ||
{ | ||
markTaskCompleted(currentTask, currentTime); | ||
currentTask.isQueued = false; | ||
} | ||
@@ -445,5 +274,5 @@ if (currentTask === peek(taskQueue)) { | ||
} | ||
advanceTimers(currentTime); | ||
} | ||
advanceTimers(currentTime); | ||
} else { | ||
@@ -521,3 +350,5 @@ pop(taskQueue); | ||
function unstable_wrapCallback(callback) { | ||
var parentPriorityLevel = currentPriorityLevel; | ||
var parentPriorityLevel = currentPriorityLevel; // $FlowFixMe[incompatible-return] | ||
// $FlowFixMe[missing-this-annot] | ||
return function () { | ||
@@ -587,6 +418,2 @@ // This is a fork of runWithPriority, inlined for performance. | ||
{ | ||
newTask.isQueued = false; | ||
} | ||
if (startTime > currentTime) { | ||
@@ -612,7 +439,2 @@ // This is a delayed task. | ||
push(taskQueue, newTask); | ||
{ | ||
markTaskStart(newTask, currentTime); | ||
newTask.isQueued = true; | ||
} // Schedule a host callback, if needed. If we're already performing work, | ||
// wait until the next time we yield. | ||
@@ -646,9 +468,2 @@ | ||
function unstable_cancelCallback(task) { | ||
{ | ||
if (task.isQueued) { | ||
var currentTime = getCurrentTime(); | ||
markTaskCanceled(task, currentTime); | ||
task.isQueued = false; | ||
} | ||
} // Null out the callback to indicate the task has been canceled. (Can't | ||
// remove from the queue because you can't remove arbitrary nodes from an | ||
@@ -680,3 +495,3 @@ // array based heap, only the first one.) | ||
function shouldYieldToHost() { | ||
if (expectedNumberOfYields !== -1 && yieldedValues !== null && yieldedValues.length >= expectedNumberOfYields || shouldYieldForPaint && needsPaint) { | ||
if (expectedNumberOfYields === 0 && yieldedValues === null || expectedNumberOfYields !== -1 && yieldedValues !== null && yieldedValues.length >= expectedNumberOfYields || shouldYieldForPaint && needsPaint) { | ||
// We yielded at least as many values as expected. Stop flushing. | ||
@@ -769,4 +584,10 @@ didStop = true; | ||
} | ||
return false; | ||
} | ||
function unstable_hasPendingWork() { | ||
return scheduledCallback !== null; | ||
} | ||
function unstable_flushExpired() { | ||
@@ -822,3 +643,3 @@ if (isFlushing) { | ||
function unstable_clearYields() { | ||
function unstable_clearLog() { | ||
if (yieldedValues === null) { | ||
@@ -845,5 +666,5 @@ return []; | ||
function unstable_yieldValue(value) { | ||
function log(value) { | ||
// eslint-disable-next-line react-internal/no-production-logging | ||
if (console.log.name === 'disabledLog') { | ||
if (console.log.name === 'disabledLog' || disableYieldValue) { | ||
// If console.log has been patched, we assume we're in render | ||
@@ -863,3 +684,3 @@ // replaying and we ignore any values yielding in the second pass. | ||
// eslint-disable-next-line react-internal/no-production-logging | ||
if (console.log.name === 'disabledLog') { | ||
if (console.log.name === 'disabledLog' || disableYieldValue) { | ||
// If console.log has been patched, we assume we're in render | ||
@@ -882,8 +703,5 @@ // replaying and we ignore any time advancing in the second pass. | ||
} | ||
var unstable_Profiling = { | ||
startLoggingProfilingEvents: startLoggingProfilingEvents, | ||
stopLoggingProfilingEvents: stopLoggingProfilingEvents, | ||
sharedProfilingBuffer: sharedProfilingBuffer | ||
} ; | ||
var unstable_Profiling = null; | ||
exports.log = log; | ||
exports.reset = reset; | ||
@@ -898,3 +716,3 @@ exports.unstable_IdlePriority = IdlePriority; | ||
exports.unstable_cancelCallback = unstable_cancelCallback; | ||
exports.unstable_clearYields = unstable_clearYields; | ||
exports.unstable_clearLog = unstable_clearLog; | ||
exports.unstable_continueExecution = unstable_continueExecution; | ||
@@ -909,2 +727,3 @@ exports.unstable_flushAll = unstable_flushAll; | ||
exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode; | ||
exports.unstable_hasPendingWork = unstable_hasPendingWork; | ||
exports.unstable_next = unstable_next; | ||
@@ -916,6 +735,6 @@ exports.unstable_now = getCurrentTime; | ||
exports.unstable_scheduleCallback = unstable_scheduleCallback; | ||
exports.unstable_setDisableYieldValue = setDisableYieldValue; | ||
exports.unstable_shouldYield = shouldYieldToHost; | ||
exports.unstable_wrapCallback = unstable_wrapCallback; | ||
exports.unstable_yieldValue = unstable_yieldValue; | ||
}))); | ||
})); |
@@ -1,5 +0,6 @@ | ||
/** @license React vundefined | ||
/** | ||
* @license React | ||
* scheduler-unstable_mock.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -9,11 +10,12 @@ * This source code is licensed under the MIT license found in the | ||
*/ | ||
(function(){'use strict';(function(a,p){"object"===typeof exports&&"undefined"!==typeof module?p(exports):"function"===typeof define&&define.amd?define(["exports"],p):(a=a||self,p(a.SchedulerMock={}))})(this,function(a){function p(b,h){var c=b.length;b.push(h);a:for(;;){var a=c-1>>>1,w=b[a];if(void 0!==w&&0<z(w,h))b[a]=h,b[c]=w,c=a;else break a}}function m(b){b=b[0];return void 0===b?null:b}function A(b){var h=b[0];if(void 0!==h){var c=b.pop();if(c!==h){b[0]=c;a:for(var a=0,w=b.length;a<w;){var e=2*(a+1)-1,d= | ||
b[e],g=e+1,f=b[g];if(void 0!==d&&0>z(d,c))void 0!==f&&0>z(f,d)?(b[a]=f,b[g]=c,a=g):(b[a]=d,b[e]=c,a=e);else if(void 0!==f&&0>z(f,c))b[a]=f,b[g]=c,a=g;else break a}}return h}return null}function z(b,h){var a=b.sortIndex-h.sortIndex;return 0!==a?a:b.id-h.id}function D(b){for(var a=m(r);null!==a;){if(null===a.callback)A(r);else if(a.startTime<=b)A(r),a.sortIndex=a.expirationTime,p(n,a);else break;a=m(r)}}function E(b){x=!1;D(b);if(!u)if(null!==m(n))u=!0,e=F;else{var a=m(r);null!==a&&(b=a.startTime-b, | ||
q=E,t=g+b)}}function F(b,a){u=!1;x&&(x=!1,q=null,t=-1);B=!0;var c=d;try{D(a);for(l=m(n);null!==l&&(!(l.expirationTime>a)||b&&!H());){var h=l.callback;if("function"===typeof h){l.callback=null;d=l.priorityLevel;var e=h(l.expirationTime<=a);a=g;"function"===typeof e?l.callback=e:l===m(n)&&A(n);D(a)}else A(n);l=m(n)}if(null!==l)var f=!0;else{var k=m(r);if(null!==k){var p=k.startTime-a;q=E;t=g+p}f=!1}return f}finally{l=null,d=c,B=!1}}function H(){return-1!==y&&null!==k&&k.length>=y||G&&C?v=!0:!1}function I(){if(f)throw Error("Already flushing work."); | ||
if(null!==e){var b=e;f=!0;try{var a=!0;do a=b(!0,g);while(a);a||(e=null);return!0}finally{f=!1}}else return!1}var n=[],r=[],J=1,l=null,d=3,B=!1,u=!1,x=!1,g=0,e=null,q=null,t=-1,k=null,y=-1,v=!1,f=!1,C=!1,G=!1;a.reset=function(){if(f)throw Error("Cannot reset while already flushing work.");g=0;q=e=null;t=-1;k=null;y=-1;C=f=v=!1};a.unstable_IdlePriority=5;a.unstable_ImmediatePriority=1;a.unstable_LowPriority=4;a.unstable_NormalPriority=3;a.unstable_Profiling=null;a.unstable_UserBlockingPriority=2;a.unstable_advanceTime= | ||
function(b){"disabledLog"!==console.log.name&&(g+=b,null!==q&&t<=g&&(q(g),t=-1,q=null))};a.unstable_cancelCallback=function(b){b.callback=null};a.unstable_clearYields=function(){if(null===k)return[];var b=k;k=null;return b};a.unstable_continueExecution=function(){u||B||(u=!0,e=F)};a.unstable_flushAll=function(){if(null!==k)throw Error("Log is not empty. Assert on the log of yielded values before flushing additional work.");I();if(null!==k)throw Error("While flushing work, something yielded a value. Use an assertion helper to assert on the log of yielded values, e.g. expect(Scheduler).toFlushAndYield([...])"); | ||
};a.unstable_flushAllWithoutAsserting=I;a.unstable_flushExpired=function(){if(f)throw Error("Already flushing work.");if(null!==e){f=!0;try{e(!1,g)||(e=null)}finally{f=!1}}};a.unstable_flushNumberOfYields=function(b){if(f)throw Error("Already flushing work.");if(null!==e){var a=e;y=b;f=!0;try{b=!0;do b=a(!0,g);while(b&&!v);b||(e=null)}finally{y=-1,f=v=!1}}};a.unstable_flushUntilNextPaint=function(){if(f)throw Error("Already flushing work.");if(null!==e){var a=e;G=!0;C=!1;f=!0;try{var h=!0;do h=a(!0, | ||
g);while(h&&!v);h||(e=null)}finally{f=v=G=!1}}};a.unstable_forceFrameRate=function(){};a.unstable_getCurrentPriorityLevel=function(){return d};a.unstable_getFirstCallbackNode=function(){return m(n)};a.unstable_next=function(a){switch(d){case 1:case 2:case 3:var b=3;break;default:b=d}var c=d;d=b;try{return a()}finally{d=c}};a.unstable_now=function(){return g};a.unstable_pauseExecution=function(){};a.unstable_requestPaint=function(){C=!0};a.unstable_runWithPriority=function(a,e){switch(a){case 1:case 2:case 3:case 4:case 5:break; | ||
default:a=3}var b=d;d=a;try{return e()}finally{d=b}};a.unstable_scheduleCallback=function(a,f,c){var b=g;"object"===typeof c&&null!==c?(c=c.delay,c="number"===typeof c&&0<c?b+c:b):c=b;switch(a){case 1:var d=-1;break;case 2:d=250;break;case 5:d=1073741823;break;case 4:d=1E4;break;default:d=5E3}d=c+d;a={id:J++,callback:f,priorityLevel:a,startTime:c,expirationTime:d,sortIndex:-1};c>b?(a.sortIndex=c,p(r,a),null===m(n)&&a===m(r)&&(x?(q=null,t=-1):x=!0,q=E,t=g+(c-b))):(a.sortIndex=d,p(n,a),u||B||(u=!0, | ||
e=F));return a};a.unstable_shouldYield=H;a.unstable_wrapCallback=function(a){var b=d;return function(){var c=d;d=b;try{return a.apply(this,arguments)}finally{d=c}}};a.unstable_yieldValue=function(a){"disabledLog"!==console.log.name&&(null===k?k=[a]:k.push(a))}}); | ||
(function(){'use strict';(function(d,v){"object"===typeof exports&&"undefined"!==typeof module?v(exports):"function"===typeof define&&define.amd?define(["exports"],v):(d="undefined"!==typeof globalThis?globalThis:d||self,v(d.SchedulerMock={}))})(this,function(d){function v(a,b){var c=a.length;a.push(b);a:for(;0<c;){var e=c-1>>>1,f=a[e];if(0<F(f,b))a[e]=b,a[c]=f,c=e;else break a}}function p(a){return 0===a.length?null:a[0]}function G(a){if(0===a.length)return null;var b=a[0],c=a.pop();if(c!==b){a[0]=c;a:for(var e= | ||
0,f=a.length,B=f>>>1;e<B;){var w=2*(e+1)-1,C=a[w],x=w+1,H=a[x];if(0>F(C,c))x<f&&0>F(H,C)?(a[e]=H,a[x]=c,e=x):(a[e]=C,a[w]=c,e=w);else if(x<f&&0>F(H,c))a[e]=H,a[x]=c,e=x;else break a}}return b}function F(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}function I(a){for(var b=p(t);null!==b;){if(null===b.callback)G(t);else if(b.startTime<=a)G(t),b.sortIndex=b.expirationTime,v(q,b);else break;b=p(t)}}function L(a){D=!1;I(a);if(!y)if(null!==p(q))y=!0,g=M;else{var b=p(t);null!==b&&(a=b.startTime- | ||
a,r=L,u=k+a)}}function M(a,b){y=!1;D&&(D=!1,r=null,u=-1);J=!0;var c=h;try{a:{I(b);for(m=p(q);null!==m&&(!(m.expirationTime>b)||a&&!O());){var e=m.callback;if("function"===typeof e){m.callback=null;h=m.priorityLevel;var f=e(m.expirationTime<=b);b=k;if("function"===typeof f){if(m.callback=f,I(b),K){var B=E=!0;break a}}else m===p(q)&&G(q),I(b)}else G(q);m=p(q)}if(null!==m)B=!0;else{var w=p(t);if(null!==w){var C=w.startTime-b;r=L;u=k+C}B=!1}}return B}finally{m=null,h=c,J=!1}}function O(){return 0===z&& | ||
null===n||-1!==z&&null!==n&&n.length>=z||K&&E?A=!0:!1}function P(){if(l)throw Error("Already flushing work.");if(null!==g){var a=g;l=!0;try{var b=!0;do b=a(!0,k);while(b);b||(g=null);return!0}finally{l=!1}}else return!1}var q=[],t=[],Q=1,m=null,h=3,J=!1,y=!1,D=!1,k=0,g=null,r=null,u=-1,n=null,z=-1,A=!1,l=!1,E=!1,K=!1,N=!1;d.log=function(a){"disabledLog"===console.log.name||N||(null===n?n=[a]:n.push(a))};d.reset=function(){if(l)throw Error("Cannot reset while already flushing work.");k=0;r=g=null; | ||
u=-1;n=null;z=-1;E=l=A=!1};d.unstable_IdlePriority=5;d.unstable_ImmediatePriority=1;d.unstable_LowPriority=4;d.unstable_NormalPriority=3;d.unstable_Profiling=null;d.unstable_UserBlockingPriority=2;d.unstable_advanceTime=function(a){"disabledLog"===console.log.name||N||(k+=a,null!==r&&u<=k&&(r(k),u=-1,r=null))};d.unstable_cancelCallback=function(a){a.callback=null};d.unstable_clearLog=function(){if(null===n)return[];var a=n;n=null;return a};d.unstable_continueExecution=function(){y||J||(y=!0,g=M)}; | ||
d.unstable_flushAll=function(){if(null!==n)throw Error("Log is not empty. Assert on the log of yielded values before flushing additional work.");P();if(null!==n)throw Error("While flushing work, something yielded a value. Use an assertion helper to assert on the log of yielded values, e.g. expect(Scheduler).toFlushAndYield([...])");};d.unstable_flushAllWithoutAsserting=P;d.unstable_flushExpired=function(){if(l)throw Error("Already flushing work.");if(null!==g){l=!0;try{g(!1,k)||(g=null)}finally{l= | ||
!1}}};d.unstable_flushNumberOfYields=function(a){if(l)throw Error("Already flushing work.");if(null!==g){var b=g;z=a;l=!0;try{a=!0;do a=b(!0,k);while(a&&!A);a||(g=null)}finally{z=-1,l=A=!1}}};d.unstable_flushUntilNextPaint=function(){if(l)throw Error("Already flushing work.");if(null!==g){var a=g;K=!0;E=!1;l=!0;try{var b=!0;do b=a(!0,k);while(b&&!A);b||(g=null)}finally{l=A=K=!1}}return!1};d.unstable_forceFrameRate=function(){};d.unstable_getCurrentPriorityLevel=function(){return h};d.unstable_getFirstCallbackNode= | ||
function(){return p(q)};d.unstable_hasPendingWork=function(){return null!==g};d.unstable_next=function(a){switch(h){case 1:case 2:case 3:var b=3;break;default:b=h}var c=h;h=b;try{return a()}finally{h=c}};d.unstable_now=function(){return k};d.unstable_pauseExecution=function(){};d.unstable_requestPaint=function(){E=!0};d.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=h;h=a;try{return b()}finally{h=c}};d.unstable_scheduleCallback=function(a, | ||
b,c){var e=k;"object"===typeof c&&null!==c?(c=c.delay,c="number"===typeof c&&0<c?e+c:e):c=e;switch(a){case 1:var f=-1;break;case 2:f=250;break;case 5:f=1073741823;break;case 4:f=1E4;break;default:f=5E3}f=c+f;a={id:Q++,callback:b,priorityLevel:a,startTime:c,expirationTime:f,sortIndex:-1};c>e?(a.sortIndex=c,v(t,a),null===p(q)&&a===p(t)&&(D?(r=null,u=-1):D=!0,r=L,u=k+(c-e))):(a.sortIndex=f,v(q,a),y||J||(y=!0,g=M));return a};d.unstable_setDisableYieldValue=function(a){N=a};d.unstable_shouldYield=O;d.unstable_wrapCallback= | ||
function(a){var b=h;return function(){var c=h;h=b;try{return a.apply(this,arguments)}finally{h=c}}}}); | ||
})(); |
/** | ||
* @license React | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -14,4 +14,4 @@ * This source code is licensed under the MIT license found in the | ||
(function(global, factory) { | ||
// eslint-disable-next-line no-unused-expressions | ||
(function (global, factory) { | ||
// eslint-disable-next-line ft-flow/no-unused-expressions | ||
typeof exports === 'object' && typeof module !== 'undefined' | ||
@@ -22,3 +22,3 @@ ? (module.exports = factory(require('react'))) | ||
: (global.Scheduler = factory(global)); | ||
})(this, function(global) { | ||
})(this, function (global) { | ||
function unstable_now() { | ||
@@ -25,0 +25,0 @@ return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_now.apply( |
/** | ||
* @license React | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -14,4 +14,4 @@ * This source code is licensed under the MIT license found in the | ||
(function(global, factory) { | ||
// eslint-disable-next-line no-unused-expressions | ||
(function (global, factory) { | ||
// eslint-disable-next-line ft-flow/no-unused-expressions | ||
typeof exports === 'object' && typeof module !== 'undefined' | ||
@@ -22,3 +22,3 @@ ? (module.exports = factory(require('react'))) | ||
: (global.Scheduler = factory(global)); | ||
})(this, function(global) { | ||
})(this, function (global) { | ||
function unstable_now() { | ||
@@ -25,0 +25,0 @@ return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_now.apply( |
/** | ||
* @license React | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
@@ -14,4 +14,4 @@ * This source code is licensed under the MIT license found in the | ||
(function(global, factory) { | ||
// eslint-disable-next-line no-unused-expressions | ||
(function (global, factory) { | ||
// eslint-disable-next-line ft-flow/no-unused-expressions | ||
typeof exports === 'object' && typeof module !== 'undefined' | ||
@@ -22,3 +22,3 @@ ? (module.exports = factory(require('react'))) | ||
: (global.Scheduler = factory(global)); | ||
})(this, function(global) { | ||
})(this, function (global) { | ||
function unstable_now() { | ||
@@ -25,0 +25,0 @@ return global.React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Scheduler.unstable_now.apply( |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1
4
0
117151
20
2846
- Removedobject-assign@^4.1.1
- Removedobject-assign@4.1.1(transitive)