UNPKG

react-art

Version:

React ART is a JavaScript library for drawing vector graphics using React. It provides declarative and reactive bindings to the ART library. Using the same declarative API you can render the output to either Canvas, SVG or VML (IE8).

1,522 lines (1,512 loc) • 301 kB
/** * @license React * react-art.production.js * * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ "use strict"; var React = require("react"), Transform = require("art/core/transform"), Mode$1 = require("art/modes/current"), Scheduler = require("scheduler"), FastNoSideEffects = require("art/modes/fast-noSideEffects"); function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i], key; for (key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]); } return target; }; return _extends.apply(this, arguments); } function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } var assign = Object.assign; function formatProdErrorMessage(code) { var url = "https://react.dev/errors/" + code; if (1 < arguments.length) { url += "?args[]=" + encodeURIComponent(arguments[1]); for (var i = 2; i < arguments.length; i++) url += "&args[]=" + encodeURIComponent(arguments[i]); } return ( "Minified React error #" + code + "; visit " + url + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings." ); } var REACT_LEGACY_ELEMENT_TYPE = Symbol.for("react.element"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_PROVIDER_TYPE = Symbol.for("react.provider"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"); Symbol.for("react.scope"); var REACT_ACTIVITY_TYPE = Symbol.for("react.activity"); Symbol.for("react.legacy_hidden"); Symbol.for("react.tracing_marker"); var REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"); Symbol.for("react.view_transition"); var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; function getIteratorFn(maybeIterable) { if (null === maybeIterable || "object" !== typeof maybeIterable) return null; maybeIterable = (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) || maybeIterable["@@iterator"]; return "function" === typeof maybeIterable ? maybeIterable : null; } var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); function getComponentNameFromType(type) { if (null == type) return null; if ("function" === typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null; if ("string" === typeof type) return type; switch (type) { case REACT_FRAGMENT_TYPE: return "Fragment"; case REACT_PROFILER_TYPE: return "Profiler"; case REACT_STRICT_MODE_TYPE: return "StrictMode"; case REACT_SUSPENSE_TYPE: return "Suspense"; case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList"; case REACT_ACTIVITY_TYPE: return "Activity"; } if ("object" === typeof type) switch (type.$$typeof) { case REACT_PORTAL_TYPE: return "Portal"; case REACT_CONTEXT_TYPE: return (type.displayName || "Context") + ".Provider"; case REACT_CONSUMER_TYPE: return (type._context.displayName || "Context") + ".Consumer"; case REACT_FORWARD_REF_TYPE: var innerType = type.render; type = type.displayName; type || ((type = innerType.displayName || innerType.name || ""), (type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef")); return type; case REACT_MEMO_TYPE: return ( (innerType = type.displayName || null), null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo" ); case REACT_LAZY_TYPE: innerType = type._payload; type = type._init; try { return getComponentNameFromType(type(innerType)); } catch (x) {} } return null; } var isArrayImpl = Array.isArray, ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, TYPES = { CLIPPING_RECTANGLE: "ClippingRectangle", GROUP: "Group", SHAPE: "Shape", TEXT: "Text" }, EVENT_TYPES = { onClick: "click", onMouseMove: "mousemove", onMouseOver: "mouseover", onMouseOut: "mouseout", onMouseUp: "mouseup", onMouseDown: "mousedown" }; function childrenAsString(children) { return children ? "string" === typeof children ? children : children.length ? children.join("") : "" : ""; } var scheduleCallback$3 = Scheduler.unstable_scheduleCallback, cancelCallback$1 = Scheduler.unstable_cancelCallback, shouldYield = Scheduler.unstable_shouldYield, requestPaint = Scheduler.unstable_requestPaint, now = Scheduler.unstable_now, ImmediatePriority = Scheduler.unstable_ImmediatePriority, UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, NormalPriority$1 = Scheduler.unstable_NormalPriority, IdlePriority = Scheduler.unstable_IdlePriority, log$1 = Scheduler.log, unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue, rendererID = null, injectedHook = null; function setIsStrictModeForDevtools(newIsStrictMode) { "function" === typeof log$1 && unstable_setDisableYieldValue(newIsStrictMode); if (injectedHook && "function" === typeof injectedHook.setStrictMode) try { injectedHook.setStrictMode(rendererID, newIsStrictMode); } catch (err) {} } var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, log = Math.log, LN2 = Math.LN2; function clz32Fallback(x) { x >>>= 0; return 0 === x ? 32 : (31 - ((log(x) / LN2) | 0)) | 0; } var nextTransitionLane = 256, nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { var pendingSyncLanes = lanes & 42; if (0 !== pendingSyncLanes) return pendingSyncLanes; switch (lanes & -lanes) { case 1: return 1; case 2: return 2; case 4: return 4; case 8: return 8; case 16: return 16; case 32: return 32; case 64: return 64; case 128: return 128; case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 131072: case 262144: case 524288: case 1048576: case 2097152: return lanes & 4194048; case 4194304: case 8388608: case 16777216: case 33554432: return lanes & 62914560; case 67108864: return 67108864; case 134217728: return 134217728; case 268435456: return 268435456; case 536870912: return 536870912; case 1073741824: return 0; default: return lanes; } } function getNextLanes(root, wipLanes, rootHasPendingCommit) { var pendingLanes = root.pendingLanes; if (0 === pendingLanes) return 0; var nextLanes = 0, suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes; root = root.warmLanes; var nonIdlePendingLanes = pendingLanes & 134217727; 0 !== nonIdlePendingLanes ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes), 0 !== pendingLanes ? (nextLanes = getHighestPriorityLanes(pendingLanes)) : ((pingedLanes &= nonIdlePendingLanes), 0 !== pingedLanes ? (nextLanes = getHighestPriorityLanes(pingedLanes)) : rootHasPendingCommit || ((rootHasPendingCommit = nonIdlePendingLanes & ~root), 0 !== rootHasPendingCommit && (nextLanes = getHighestPriorityLanes(rootHasPendingCommit))))) : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes), 0 !== nonIdlePendingLanes ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes)) : 0 !== pingedLanes ? (nextLanes = getHighestPriorityLanes(pingedLanes)) : rootHasPendingCommit || ((rootHasPendingCommit = pendingLanes & ~root), 0 !== rootHasPendingCommit && (nextLanes = getHighestPriorityLanes(rootHasPendingCommit)))); return 0 === nextLanes ? 0 : 0 !== wipLanes && wipLanes !== nextLanes && 0 === (wipLanes & suspendedLanes) && ((suspendedLanes = nextLanes & -nextLanes), (rootHasPendingCommit = wipLanes & -wipLanes), suspendedLanes >= rootHasPendingCommit || (32 === suspendedLanes && 0 !== (rootHasPendingCommit & 4194048))) ? wipLanes : nextLanes; } function checkIfRootIsPrerendering(root, renderLanes) { return ( 0 === (root.pendingLanes & ~(root.suspendedLanes & ~root.pingedLanes) & renderLanes) ); } function computeExpirationTime(lane, currentTime) { switch (lane) { case 1: case 2: case 4: case 8: case 64: return currentTime + 250; case 16: case 32: case 128: case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: case 32768: case 65536: case 131072: case 262144: case 524288: case 1048576: case 2097152: return currentTime + 5e3; case 4194304: case 8388608: case 16777216: case 33554432: return -1; case 67108864: case 134217728: case 268435456: case 536870912: case 1073741824: return -1; default: return -1; } } function claimNextTransitionLane() { var lane = nextTransitionLane; nextTransitionLane <<= 1; 0 === (nextTransitionLane & 4194048) && (nextTransitionLane = 256); return lane; } function claimNextRetryLane() { var lane = nextRetryLane; nextRetryLane <<= 1; 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304); return lane; } function createLaneMap(initial) { for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial); return laneMap; } function markRootUpdated$1(root, updateLane) { root.pendingLanes |= updateLane; 268435456 !== updateLane && ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0)); } function markRootFinished( root, finishedLanes, remainingLanes, spawnedLane, updatedLanes, suspendedRetryLanes ) { var previouslyPendingLanes = root.pendingLanes; root.pendingLanes = remainingLanes; root.suspendedLanes = 0; root.pingedLanes = 0; root.warmLanes = 0; root.expiredLanes &= remainingLanes; root.entangledLanes &= remainingLanes; root.errorRecoveryDisabledLanes &= remainingLanes; root.shellSuspendCounter = 0; var entanglements = root.entanglements, expirationTimes = root.expirationTimes, hiddenUpdates = root.hiddenUpdates; for ( remainingLanes = previouslyPendingLanes & ~remainingLanes; 0 < remainingLanes; ) { var index$4 = 31 - clz32(remainingLanes), lane = 1 << index$4; entanglements[index$4] = 0; expirationTimes[index$4] = -1; var hiddenUpdatesForLane = hiddenUpdates[index$4]; if (null !== hiddenUpdatesForLane) for ( hiddenUpdates[index$4] = null, index$4 = 0; index$4 < hiddenUpdatesForLane.length; index$4++ ) { var update = hiddenUpdatesForLane[index$4]; null !== update && (update.lane &= -536870913); } remainingLanes &= ~lane; } 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0); 0 !== suspendedRetryLanes && 0 === updatedLanes && 0 !== root.tag && (root.suspendedLanes |= suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes)); } function markSpawnedDeferredLane(root, spawnedLane, entangledLanes) { root.pendingLanes |= spawnedLane; root.suspendedLanes &= ~spawnedLane; var spawnedLaneIndex = 31 - clz32(spawnedLane); root.entangledLanes |= spawnedLane; root.entanglements[spawnedLaneIndex] = root.entanglements[spawnedLaneIndex] | 1073741824 | (entangledLanes & 4194090); } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { var index$5 = 31 - clz32(rootEntangledLanes), lane = 1 << index$5; (lane & entangledLanes) | (root[index$5] & entangledLanes) && (root[index$5] |= entangledLanes); rootEntangledLanes &= ~lane; } } function lanesToEventPriority(lanes) { lanes &= -lanes; return 2 < lanes ? 8 < lanes ? 0 !== (lanes & 134217727) ? 32 : 268435456 : 8 : 2; } function shim$1() { throw Error(formatProdErrorMessage(305)); } var pooledTransform = new Transform(), NO_CONTEXT = {}; function createEventHandler(instance) { return function (event) { var listener = instance._listeners[event.type]; listener && ("function" === typeof listener ? listener.call(instance, event) : listener.handleEvent && listener.handleEvent(event)); }; } function destroyEventListeners(instance) { if (instance._subscriptions) for (var type in instance._subscriptions) instance._subscriptions[type](); instance._subscriptions = null; instance._listeners = null; } function applyClippingRectangleProps(instance, props) { applyNodeProps( instance, props, 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {} ); instance.width = props.width; instance.height = props.height; } function applyGroupProps(instance, props) { applyNodeProps( instance, props, 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {} ); instance.width = props.width; instance.height = props.height; } function applyNodeProps(instance, props) { var prevProps = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {}; var JSCompiler_inline_result = null != props.scaleX ? props.scaleX : null != props.scale ? props.scale : 1; var JSCompiler_inline_result$jscomp$0 = null != props.scaleY ? props.scaleY : null != props.scale ? props.scale : 1; pooledTransform .transformTo(1, 0, 0, 1, 0, 0) .move(props.x || 0, props.y || 0) .rotate(props.rotation || 0, props.originX, props.originY) .scale( JSCompiler_inline_result, JSCompiler_inline_result$jscomp$0, props.originX, props.originY ); null != props.transform && pooledTransform.transform(props.transform); (instance.xx === pooledTransform.xx && instance.yx === pooledTransform.yx && instance.xy === pooledTransform.xy && instance.yy === pooledTransform.yy && instance.x === pooledTransform.x && instance.y === pooledTransform.y) || instance.transformTo(pooledTransform); (props.cursor === prevProps.cursor && props.title === prevProps.title) || instance.indicate(props.cursor, props.title); instance.blend && props.opacity !== prevProps.opacity && instance.blend(null == props.opacity ? 1 : props.opacity); props.visible !== prevProps.visible && (null == props.visible || props.visible ? instance.show() : instance.hide()); for (var type in EVENT_TYPES) (prevProps = instance), (JSCompiler_inline_result = EVENT_TYPES[type]), (JSCompiler_inline_result$jscomp$0 = props[type]), prevProps._listeners || ((prevProps._listeners = {}), (prevProps._subscriptions = {})), (prevProps._listeners[JSCompiler_inline_result] = JSCompiler_inline_result$jscomp$0) ? prevProps._subscriptions[JSCompiler_inline_result] || (prevProps._subscriptions[JSCompiler_inline_result] = prevProps.subscribe( JSCompiler_inline_result, createEventHandler(prevProps), prevProps )) : prevProps._subscriptions[JSCompiler_inline_result] && (prevProps._subscriptions[JSCompiler_inline_result](), delete prevProps._subscriptions[JSCompiler_inline_result]); } function applyRenderableNodeProps(instance, props) { var prevProps = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {}; applyNodeProps(instance, props, prevProps); prevProps.fill !== props.fill && (props.fill && props.fill.applyFill ? props.fill.applyFill(instance) : instance.fill(props.fill)); (prevProps.stroke === props.stroke && prevProps.strokeWidth === props.strokeWidth && prevProps.strokeCap === props.strokeCap && prevProps.strokeJoin === props.strokeJoin && prevProps.strokeDash === props.strokeDash) || instance.stroke( props.stroke, props.strokeWidth, props.strokeCap, props.strokeJoin, props.strokeDash ); } function applyShapeProps(instance, props) { var prevProps = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {}; applyRenderableNodeProps(instance, props, prevProps); var path = props.d || childrenAsString(props.children), prevDelta = instance._prevDelta; if ( path !== instance._prevPath || path.delta !== prevDelta || prevProps.height !== props.height || prevProps.width !== props.width ) instance.draw(path, props.width, props.height), (instance._prevDelta = path.delta), (instance._prevPath = path); } function applyTextProps(instance, props) { var prevProps = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : {}; applyRenderableNodeProps(instance, props, prevProps); var string = props.children, JSCompiler_temp; if (!(JSCompiler_temp = instance._currentString !== string)) { JSCompiler_temp = props.font; var newFont = prevProps.font; JSCompiler_temp = JSCompiler_temp === newFont ? !0 : "string" === typeof newFont || "string" === typeof JSCompiler_temp ? !1 : newFont.fontSize === JSCompiler_temp.fontSize && newFont.fontStyle === JSCompiler_temp.fontStyle && newFont.fontVariant === JSCompiler_temp.fontVariant && newFont.fontWeight === JSCompiler_temp.fontWeight && newFont.fontFamily === JSCompiler_temp.fontFamily; JSCompiler_temp = !JSCompiler_temp; } if ( JSCompiler_temp || props.alignment !== prevProps.alignment || props.path !== prevProps.path ) instance.draw(string, props.font, props.alignment, props.path), (instance._currentString = string); } var scheduleTimeout = setTimeout, cancelTimeout = clearTimeout; function shouldSetTextContent(type, props) { return ( "string" === typeof props.children || "number" === typeof props.children ); } var currentUpdatePriority = 0, HostTransitionContext = { $$typeof: REACT_CONTEXT_TYPE, Provider: null, Consumer: null, _currentValue: null, _currentValue2: null, _threadCount: 0 }, valueStack = [], index = -1; function createCursor(defaultValue) { return { current: defaultValue }; } function pop(cursor) { 0 > index || ((cursor.current = valueStack[index]), (valueStack[index] = null), index--); } function push(cursor, value) { index++; valueStack[index] = cursor.current; cursor.current = value; } var emptyContextObject = {}, prefix, suffix; function describeBuiltInComponentFrame(name) { if (void 0 === prefix) try { throw Error(); } catch (x) { var match = x.stack.trim().match(/\n( *(at )?)/); prefix = (match && match[1]) || ""; suffix = -1 < x.stack.indexOf("\n at") ? " (<anonymous>)" : -1 < x.stack.indexOf("@") ? "@unknown:0:0" : ""; } return "\n" + prefix + name + suffix; } var reentry = !1; function describeNativeComponentFrame(fn, construct) { if (!fn || reentry) return ""; reentry = !0; var previousPrepareStackTrace = Error.prepareStackTrace; Error.prepareStackTrace = void 0; try { var RunInRootFrame = { DetermineComponentFrameRoot: function () { try { if (construct) { var Fake = function () { throw Error(); }; Object.defineProperty(Fake.prototype, "props", { set: function () { throw Error(); } }); if ("object" === typeof Reflect && Reflect.construct) { try { Reflect.construct(Fake, []); } catch (x) { var control = x; } Reflect.construct(fn, [], Fake); } else { try { Fake.call(); } catch (x$6) { control = x$6; } fn.call(Fake.prototype); } } else { try { throw Error(); } catch (x$7) { control = x$7; } (Fake = fn()) && "function" === typeof Fake.catch && Fake.catch(function () {}); } } catch (sample) { if (sample && control && "string" === typeof sample.stack) return [sample.stack, control.stack]; } return [null, null]; } }; RunInRootFrame.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot"; var namePropDescriptor = Object.getOwnPropertyDescriptor( RunInRootFrame.DetermineComponentFrameRoot, "name" ); namePropDescriptor && namePropDescriptor.configurable && Object.defineProperty( RunInRootFrame.DetermineComponentFrameRoot, "name", { value: "DetermineComponentFrameRoot" } ); var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), sampleStack = _RunInRootFrame$Deter[0], controlStack = _RunInRootFrame$Deter[1]; if (sampleStack && controlStack) { var sampleLines = sampleStack.split("\n"), controlLines = controlStack.split("\n"); for ( namePropDescriptor = RunInRootFrame = 0; RunInRootFrame < sampleLines.length && !sampleLines[RunInRootFrame].includes("DetermineComponentFrameRoot"); ) RunInRootFrame++; for ( ; namePropDescriptor < controlLines.length && !controlLines[namePropDescriptor].includes( "DetermineComponentFrameRoot" ); ) namePropDescriptor++; if ( RunInRootFrame === sampleLines.length || namePropDescriptor === controlLines.length ) for ( RunInRootFrame = sampleLines.length - 1, namePropDescriptor = controlLines.length - 1; 1 <= RunInRootFrame && 0 <= namePropDescriptor && sampleLines[RunInRootFrame] !== controlLines[namePropDescriptor]; ) namePropDescriptor--; for ( ; 1 <= RunInRootFrame && 0 <= namePropDescriptor; RunInRootFrame--, namePropDescriptor-- ) if (sampleLines[RunInRootFrame] !== controlLines[namePropDescriptor]) { if (1 !== RunInRootFrame || 1 !== namePropDescriptor) { do if ( (RunInRootFrame--, namePropDescriptor--, 0 > namePropDescriptor || sampleLines[RunInRootFrame] !== controlLines[namePropDescriptor]) ) { var frame = "\n" + sampleLines[RunInRootFrame].replace(" at new ", " at "); fn.displayName && frame.includes("<anonymous>") && (frame = frame.replace("<anonymous>", fn.displayName)); return frame; } while (1 <= RunInRootFrame && 0 <= namePropDescriptor); } break; } } } finally { (reentry = !1), (Error.prepareStackTrace = previousPrepareStackTrace); } return (previousPrepareStackTrace = fn ? fn.displayName || fn.name : "") ? describeBuiltInComponentFrame(previousPrepareStackTrace) : ""; } function describeFiber(fiber) { switch (fiber.tag) { case 26: case 27: case 5: return describeBuiltInComponentFrame(fiber.type); case 16: return describeBuiltInComponentFrame("Lazy"); case 13: return describeBuiltInComponentFrame("Suspense"); case 19: return describeBuiltInComponentFrame("SuspenseList"); case 0: case 15: return describeNativeComponentFrame(fiber.type, !1); case 11: return describeNativeComponentFrame(fiber.type.render, !1); case 1: return describeNativeComponentFrame(fiber.type, !0); case 31: return describeBuiltInComponentFrame("Activity"); default: return ""; } } function getStackByFiberInDevAndProd(workInProgress) { try { var info = ""; do (info += describeFiber(workInProgress)), (workInProgress = workInProgress.return); while (workInProgress); return info; } catch (x) { return "\nError generating stack: " + x.message + "\n" + x.stack; } } var CapturedStacks = new WeakMap(); function createCapturedValueAtFiber(value, source) { if ("object" === typeof value && null !== value) { var existing = CapturedStacks.get(value); if (void 0 !== existing) return existing; source = { value: value, source: source, stack: getStackByFiberInDevAndProd(source) }; CapturedStacks.set(value, source); return source; } return { value: value, source: source, stack: getStackByFiberInDevAndProd(source) }; } var contextStackCursor = createCursor(null), contextFiberStackCursor = createCursor(null), rootInstanceStackCursor = createCursor(null), hostTransitionProviderCursor = createCursor(null); function pushHostContainer(fiber, nextRootInstance) { push(rootInstanceStackCursor, nextRootInstance); push(contextFiberStackCursor, fiber); push(contextStackCursor, null); pop(contextStackCursor); push(contextStackCursor, NO_CONTEXT); } function popHostContainer() { pop(contextStackCursor); pop(contextFiberStackCursor); pop(rootInstanceStackCursor); } function pushHostContext(fiber) { null !== fiber.memoizedState && push(hostTransitionProviderCursor, fiber); contextStackCursor.current !== NO_CONTEXT && (push(contextFiberStackCursor, fiber), push(contextStackCursor, NO_CONTEXT)); } function popHostContext(fiber) { contextFiberStackCursor.current === fiber && (pop(contextStackCursor), pop(contextFiberStackCursor)); hostTransitionProviderCursor.current === fiber && (pop(hostTransitionProviderCursor), (HostTransitionContext._currentValue2 = null)); } var hydrationErrors = null; Error(formatProdErrorMessage(519)); function upgradeHydrationErrorsToRecoverable() { var queuedErrors = hydrationErrors; null !== queuedErrors && (null === workInProgressRootRecoverableErrors ? (workInProgressRootRecoverableErrors = queuedErrors) : workInProgressRootRecoverableErrors.push.apply( workInProgressRootRecoverableErrors, queuedErrors ), (hydrationErrors = null)); return queuedErrors; } function is(x, y) { return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y); } var objectIs = "function" === typeof Object.is ? Object.is : is, valueCursor = createCursor(null), currentlyRenderingFiber$1 = null, lastContextDependency = null; function pushProvider(providerFiber, context, nextValue) { push(valueCursor, context._currentValue2); context._currentValue2 = nextValue; } function popProvider(context) { context._currentValue2 = valueCursor.current; pop(valueCursor); } function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { for (; null !== parent; ) { var alternate = parent.alternate; (parent.childLanes & renderLanes) !== renderLanes ? ((parent.childLanes |= renderLanes), null !== alternate && (alternate.childLanes |= renderLanes)) : null !== alternate && (alternate.childLanes & renderLanes) !== renderLanes && (alternate.childLanes |= renderLanes); if (parent === propagationRoot) break; parent = parent.return; } } function propagateContextChanges( workInProgress, contexts, renderLanes, forcePropagateEntireTree ) { var fiber = workInProgress.child; null !== fiber && (fiber.return = workInProgress); for (; null !== fiber; ) { var list = fiber.dependencies; if (null !== list) { var nextFiber = fiber.child; list = list.firstContext; a: for (; null !== list; ) { var dependency = list; list = fiber; for (var i = 0; i < contexts.length; i++) if (dependency.context === contexts[i]) { list.lanes |= renderLanes; dependency = list.alternate; null !== dependency && (dependency.lanes |= renderLanes); scheduleContextWorkOnParentPath( list.return, renderLanes, workInProgress ); forcePropagateEntireTree || (nextFiber = null); break a; } list = dependency.next; } } else if (18 === fiber.tag) { nextFiber = fiber.return; if (null === nextFiber) throw Error(formatProdErrorMessage(341)); nextFiber.lanes |= renderLanes; list = nextFiber.alternate; null !== list && (list.lanes |= renderLanes); scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress); nextFiber = null; } else nextFiber = fiber.child; if (null !== nextFiber) nextFiber.return = fiber; else for (nextFiber = fiber; null !== nextFiber; ) { if (nextFiber === workInProgress) { nextFiber = null; break; } fiber = nextFiber.sibling; if (null !== fiber) { fiber.return = nextFiber.return; nextFiber = fiber; break; } nextFiber = nextFiber.return; } fiber = nextFiber; } } function propagateParentContextChanges( current, workInProgress, renderLanes, forcePropagateEntireTree ) { current = null; for ( var parent = workInProgress, isInsidePropagationBailout = !1; null !== parent; ) { if (!isInsidePropagationBailout) if (0 !== (parent.flags & 524288)) isInsidePropagationBailout = !0; else if (0 !== (parent.flags & 262144)) break; if (10 === parent.tag) { var currentParent = parent.alternate; if (null === currentParent) throw Error(formatProdErrorMessage(387)); currentParent = currentParent.memoizedProps; if (null !== currentParent) { var context = parent.type; objectIs(parent.pendingProps.value, currentParent.value) || (null !== current ? current.push(context) : (current = [context])); } } else if (parent === hostTransitionProviderCursor.current) { currentParent = parent.alternate; if (null === currentParent) throw Error(formatProdErrorMessage(387)); currentParent.memoizedState.memoizedState !== parent.memoizedState.memoizedState && (null !== current ? current.push(HostTransitionContext) : (current = [HostTransitionContext])); } parent = parent.return; } null !== current && propagateContextChanges( workInProgress, current, renderLanes, forcePropagateEntireTree ); workInProgress.flags |= 262144; } function checkIfContextChanged(currentDependencies) { for ( currentDependencies = currentDependencies.firstContext; null !== currentDependencies; ) { if ( !objectIs( currentDependencies.context._currentValue2, currentDependencies.memoizedValue ) ) return !0; currentDependencies = currentDependencies.next; } return !1; } function prepareToReadContext(workInProgress) { currentlyRenderingFiber$1 = workInProgress; lastContextDependency = null; workInProgress = workInProgress.dependencies; null !== workInProgress && (workInProgress.firstContext = null); } function readContext(context) { return readContextForConsumer(currentlyRenderingFiber$1, context); } function readContextDuringReconciliation(consumer, context) { null === currentlyRenderingFiber$1 && prepareToReadContext(consumer); return readContextForConsumer(consumer, context); } function readContextForConsumer(consumer, context) { var value = context._currentValue2; context = { context: context, memoizedValue: value, next: null }; if (null === lastContextDependency) { if (null === consumer) throw Error(formatProdErrorMessage(308)); lastContextDependency = context; consumer.dependencies = { lanes: 0, firstContext: context }; consumer.flags |= 524288; } else lastContextDependency = lastContextDependency.next = context; return value; } var AbortControllerLocal = "undefined" !== typeof AbortController ? AbortController : function () { var listeners = [], signal = (this.signal = { aborted: !1, addEventListener: function (type, listener) { listeners.push(listener); } }); this.abort = function () { signal.aborted = !0; listeners.forEach(function (listener) { return listener(); }); }; }, scheduleCallback$2 = Scheduler.unstable_scheduleCallback, NormalPriority = Scheduler.unstable_NormalPriority, CacheContext = { $$typeof: REACT_CONTEXT_TYPE, Consumer: null, Provider: null, _currentValue: null, _currentValue2: null, _threadCount: 0 }; function createCache() { return { controller: new AbortControllerLocal(), data: new Map(), refCount: 0 }; } function releaseCache(cache) { cache.refCount--; 0 === cache.refCount && scheduleCallback$2(NormalPriority, function () { cache.controller.abort(); }); } var firstScheduledRoot = null, lastScheduledRoot = null, didScheduleMicrotask = !1, mightHavePendingSyncWork = !1, isFlushingWork = !1, currentEventTransitionLane = 0; function ensureRootIsScheduled(root) { root !== lastScheduledRoot && null === root.next && (null === lastScheduledRoot ? (firstScheduledRoot = lastScheduledRoot = root) : (lastScheduledRoot = lastScheduledRoot.next = root)); mightHavePendingSyncWork = !0; didScheduleMicrotask || ((didScheduleMicrotask = !0), scheduleCallback$3(ImmediatePriority, processRootScheduleInImmediateTask)); } function flushSyncWorkAcrossRoots_impl(syncTransitionLanes, onlyLegacy) { if (!isFlushingWork && mightHavePendingSyncWork) { isFlushingWork = !0; do { var didPerformSomeWork = !1; for (var root = firstScheduledRoot; null !== root; ) { if (!onlyLegacy) if (0 !== syncTransitionLanes) { var pendingLanes = root.pendingLanes; if (0 === pendingLanes) var JSCompiler_inline_result = 0; else { var suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes; JSCompiler_inline_result = (1 << (31 - clz32(42 | syncTransitionLanes) + 1)) - 1; JSCompiler_inline_result &= pendingLanes & ~(suspendedLanes & ~pingedLanes); JSCompiler_inline_result = JSCompiler_inline_result & 201326741 ? (JSCompiler_inline_result & 201326741) | 1 : JSCompiler_inline_result ? JSCompiler_inline_result | 2 : 0; } 0 !== JSCompiler_inline_result && ((didPerformSomeWork = !0), performSyncWorkOnRoot(root, JSCompiler_inline_result)); } else (JSCompiler_inline_result = workInProgressRootRenderLanes), (JSCompiler_inline_result = getNextLanes( root, root === workInProgressRoot ? JSCompiler_inline_result : 0, null !== root.cancelPendingCommit || -1 !== root.timeoutHandle )), 0 === (JSCompiler_inline_result & 3) || checkIfRootIsPrerendering(root, JSCompiler_inline_result) || ((didPerformSomeWork = !0), performSyncWorkOnRoot(root, JSCompiler_inline_result)); root = root.next; } } while (didPerformSomeWork); isFlushingWork = !1; } } function processRootScheduleInImmediateTask() { mightHavePendingSyncWork = didScheduleMicrotask = !1; 0 !== currentEventTransitionLane && (currentEventTransitionLane = 0); for ( var currentTime = now(), prev = null, root = firstScheduledRoot; null !== root; ) { var next = root.next, nextLanes = scheduleTaskForRootDuringMicrotask(root, currentTime); 0 === nextLanes ? ((root.next = null), null === prev ? (firstScheduledRoot = next) : (prev.next = next), null === next && (lastScheduledRoot = prev)) : ((prev = root), 0 !== (nextLanes & 3) && (mightHavePendingSyncWork = !0)); root = next; } flushSyncWorkAcrossRoots_impl(0, !1); } function scheduleTaskForRootDuringMicrotask(root, currentTime) { for ( var suspendedLanes = root.suspendedLanes, pingedLanes = root.pingedLanes, expirationTimes = root.expirationTimes, lanes = root.pendingLanes & -62914561; 0 < lanes; ) { var index$2 = 31 - clz32(lanes), lane = 1 << index$2, expirationTime = expirationTimes[index$2]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) expirationTimes[index$2] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); lanes &= ~lane; } currentTime = workInProgressRoot; suspendedLanes = workInProgressRootRenderLanes; suspendedLanes = getNextLanes( root, root === currentTime ? suspendedLanes : 0, null !== root.cancelPendingCommit || -1 !== root.timeoutHandle ); pingedLanes = root.callbackNode; if ( 0 === suspendedLanes || (root === currentTime && (2 === workInProgressSuspendedReason || 9 === workInProgressSuspendedReason)) || null !== root.cancelPendingCommit ) return ( null !== pingedLanes && null !== pingedLanes && cancelCallback$1(pingedLanes), (root.callbackNode = null), (root.callbackPriority = 0) ); if ( 0 !== (suspendedLanes & 3) && !checkIfRootIsPrerendering(root, suspendedLanes) ) return ( null !== pingedLanes && null !== pingedLanes && cancelCallback$1(pingedLanes), (root.callbackPriority = 2), (root.callbackNode = null), 2 ); currentTime = suspendedLanes & -suspendedLanes; if (currentTime === root.callbackPriority) return currentTime; null !== pingedLanes && cancelCallback$1(pingedLanes); switch (lanesToEventPriority(suspendedLanes)) { case 2: case 8: suspendedLanes = UserBlockingPriority; break; case 32: suspendedLanes = NormalPriority$1; break; case 268435456: suspendedLanes = IdlePriority; break; default: suspendedLanes = NormalPriority$1; } pingedLanes = performWorkOnRootViaSchedulerTask.bind(null, root); suspendedLanes = scheduleCallback$3(suspendedLanes, pingedLanes); root.callbackPriority = currentTime; root.callbackNode = suspendedLanes; return currentTime; } function performWorkOnRootViaSchedulerTask(root, didTimeout) { if (0 !== pendingEffectsStatus && 5 !== pendingEffectsStatus) return (root.callbackNode = null), (root.callbackPriority = 0), null; var originalCallbackNode = root.callbackNode; if (flushPendingEffects(!0) && root.callbackNode !== originalCallbackNode) return null; var workInProgressRootRenderLanes$jscomp$0 = workInProgressRootRenderLanes; workInProgressRootRenderLanes$jscomp$0 = getNextLanes( root, root === workInProgressRoot ? workInProgressRootRenderLanes$jscomp$0 : 0, null !== root.cancelPendingCommit || -1 !== root.timeoutHandle ); if (0 === workInProgressRootRenderLanes$jscomp$0) return null; performWorkOnRoot(root, workInProgressRootRenderLanes$jscomp$0, didTimeout); scheduleTaskForRootDuringMicrotask(root, now()); return null != root.callbackNode && root.callbackNode === originalCallbackNode ? performWorkOnRootViaSchedulerTask.bind(null, root) : null; } function performSyncWorkOnRoot(root, lanes) { if (flushPendingEffects()) return null; performWorkOnRoot(root, lanes, !0); } function requestTransitionLane() { 0 === currentEventTransitionLane && (currentEventTransitionLane = claimNextTransitionLane()); return currentEventTransitionLane; } var currentEntangledListeners = null, currentEntangledPendingCount = 0, currentEntangledLane = 0, currentEntangledActionThenable = null; function entangleAsyncAction(transition, thenable) { if (null === currentEntangledListeners) { var entangledListeners = (currentEntangledListeners = []); currentEntangledPendingCount = 0; currentEntangledLane = requestTransitionLane(); currentEntangledActionThenable = { status: "pending", value: void 0, then: function (resolve) { entangledListeners.push(resolve); } }; } currentEntangledPendingCount++; thenable.then(pingEngtangledActionScope, pingEngtangledActionScope); return thenable; } function pingEngtangledActionScope() { if ( 0 === --currentEntangledPendingCount && null !== currentEntangledListeners ) { null !== currentEntangledActionThenable && (currentEntangledActionThenable.status = "fulfilled"); var listeners = currentEntangledListeners; currentEntangledListeners = null; currentEntangledLane = 0; currentEntangledActionThenable = null; for (var i = 0; i < listeners.length; i++) (0, listeners[i])(); } } function chainThenableValue(thenable, result) { var listeners = [], thenableWithOverride = { status: "pending", value: null, reason: null, then: function (resolve) { listeners.push(resolve); } }; thenable.then( function () { thenableWithOverride.status = "fulfilled"; thenableWithOverride.value = result; for (var i = 0; i < listeners.length; i++) (0, listeners[i])(result); }, function (error) { thenableWithOverride.status = "rejected"; thenableWithOverride.reason = error; for (error = 0; error < listeners.length; error++) (0, listeners[error])(void 0); } ); return thenableWithOverride; } var prevOnStartTransitionFinish = ReactSharedInternals.S; ReactSharedInternals.S = function (transition, returnValue) { "object" === typeof returnValue && null !== returnValue && "function" === typeof returnValue.then && entangleAsyncAction(transition, returnValue); null !== prevOnStartTransitionFinish && prevOnStartTransitionFinish(transition, returnValue); }; var resumedCache = createCursor(null); function peekCacheFromPool() { var cacheResumedFromPreviousRender = resumedCache.current; return null !== cacheResumedFromPreviousRender ? cacheResumedFromPreviousRender : workInProgressRoot.pooledCache; } function pushTransition(offscreenWorkInProgress, prevCachePool) { null === prevCachePool ? push(resumedCache, resumedCache.current) : push(resumedCache, prevCachePool.pool); } function getSuspendedCache() { var cacheFromPool = peekCacheFromPool(); return null === cacheFromPool ? null : { parent: CacheContext._currentValue2, pool: cacheFromPool }; } var hasOwnProperty = Object.prototype.hasOwnProperty; function shallowEqual(objA, objB) { if (objectIs(objA, objB)) return !0; if ( "object" !== typeof objA || null === objA || "object" !== typeof objB || null === objB ) return !1; var keysA = Object.keys(objA), keysB = Object.keys(objB); if (keysA.length !== keysB.length) return !1; for (keysB = 0; keysB < keysA.length; keysB++) { var currentKey = keysA[keysB]; if ( !hasOwnProperty.call(objB, currentKey) || !objectIs(objA[currentKey], objB[currentKey]) ) return !1; } return !0; } var SuspenseException = Error(formatProdErrorMessage(460)), SuspenseyCommitException = Error(formatProdErrorMessage(474)), SuspenseActionException = Error(formatProdErrorMessage(542)), noopSuspenseyCommitThenable = { then: function () {} }; function isThenableResolved(thenable) { thenable = thenable.status; return "fulfilled" === thenable || "rejected" === thenable; } function noop() {} function trackUsedThenable(thenableState, thenable, index) { index = thenableState[index]; void 0 === index ? thenableState.push(thenable) : index !== thenable && (thenable.then(noop, noop), (thenable = index)); switch (thenable.status) { case "fulfilled": return thenable.value; case "rejected": throw ( ((thenableState = thenable.reason), checkIfUseWrappedInAsyncCatch(thenableState), thenableState) ); default: if ("string" === typeof thenable.status) thenable.then(noop, noop); else { thenableState = workInProgressRoot; if (null !== thenableState && 100 < thenableState.shellSuspendCounter) throw Error(formatProdErrorMessage(482)); thenableState = thenable; thenableState.status = "pending"; thenableState.then( function (fulfilledValue) { if ("pending" === thenable.status) { var fulfilledThenable = thenable; fulfilledThenable.status = "fulfilled"; fulfilledThenable.value = fulfilledValue; } }, function (error) { if ("pending" === thenable.status) { var rejectedThenable = thenable; rejectedThenable.status = "rejected"; rejectedThenable.reason = error; } } ); } switch (thenable.status) { case "fulfilled": return thenable.value; case "rejected": throw ( ((thenableState = thenable.reason), checkIfUseWrappedInAsyncCatch(thenableState), thenableState) ); } suspendedThenable = thenable; throw SuspenseException; } } var suspendedThenable = null; function getSuspendedThenable() { if (null === suspendedThenable) throw Error(formatProdErrorMessage(459)); var thenable = suspendedThenable; suspendedThenable = null; return thenable; } function checkIfUseWrappedInAsyncCatch(rejectedReason) { if ( rejectedReason === SuspenseException || rejectedReason === SuspenseActionException ) throw Error(formatProdErrorMessage(483)); } var concurrentQueues = [], concurrentQueuesIndex = 0, concurrentlyUpdatedLanes = 0; function finishQueueingConcurrentUpdates() { for ( var endIndex = concurrentQueuesIndex, i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0); i < endIndex; ) { var fiber = concurrentQueues[i]; concurrentQueues[i++] = null; var queue = concurrentQueues[i]; concurrentQueues[i++] = null; var update = concurrentQueues[i]; concurrentQueues[i++] = null; var lane = concurrentQueues[i]; concurrentQueues[i++] = null; if (null !== queue && null !== update) { var pending = queue.pending; null === pending ? (update.next = update) : ((update.next = pending.next), (pending.next = update)); queue.pending = update; } 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane); } } function enqueueUpdate$1(fiber, queue, update, lane) { concurrentQueues[concurrentQueuesIndex++] = fiber; concurrentQueues[concurrentQueuesIndex++] = queue; concurrentQueues[concurrentQueuesIndex++] = update; concurrentQueues[concurrentQueuesIndex++] = lane; concurrentlyUpdatedLanes |= lane; fiber.lanes |= lane; fiber = fiber.alternate; null !== fiber && (fiber.lanes |= lane); } function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { enqueueUpdate$1(fiber, queue, update, lane); return getRootForUpdatedFiber(fiber); } function enqueueConcurrentRenderForLane(fiber, lane) { enqueueUpdate$1(fiber, null, null, lane); return getRootForUpdatedFiber(fiber); } function markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) { sourceFiber.lanes |= lane; var alternate = sourceFiber.alternate; null !== alternate && (alternate.lanes |= lane); for (var isHidden = !1, parent = sourceFiber.return; null !== parent; ) (parent.childLanes |= lane), (alternate = parent.alternate), null !== alternate && (alternate.childLanes |= lane), 22 === parent.tag && ((sourceFiber = parent.stateNode), null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)), (sourceFiber = parent), (parent = parent.return); return 3 === sourceFiber.tag ?