43208 lines
1.8 MiB
43208 lines
1.8 MiB
'use strict';
|
|
/* global BaseInstrument */
|
|
/* global registerInstrument */
|
|
class InstrumentLogic extends BaseInstrument {
|
|
constructor() {
|
|
super();
|
|
let lastTime = this._lastTime;
|
|
this.getDeltaTime = () => {
|
|
const nowTime = Date.now();
|
|
const deltaTime = nowTime - lastTime;
|
|
lastTime = nowTime;
|
|
return deltaTime;
|
|
};
|
|
}
|
|
|
|
get templateID() {
|
|
return 'TFDi_MD11_efb';
|
|
}
|
|
|
|
get isInteractive() {
|
|
return true;
|
|
}
|
|
|
|
get IsGlassCockpit() {
|
|
return true;
|
|
}
|
|
|
|
connectedCallback() {
|
|
super.connectedCallback();
|
|
(() => {
|
|
var __create = Object.create;
|
|
var __defProp = Object.defineProperty;
|
|
var __defProps = Object.defineProperties;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
var __getProtoOf = Object.getPrototypeOf;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
if (__propIsEnum.call(b, prop))
|
|
__defNormalProp(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
var __objRest = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && __getOwnPropSymbols)
|
|
for (var prop of __getOwnPropSymbols(source)) {
|
|
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var __esm = (fn, res) => function __init() {
|
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
};
|
|
var __commonJS = (cb, mod) => function __require() {
|
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
};
|
|
var __export = (target, all3) => {
|
|
for (var name in all3)
|
|
__defProp(target, name, { get: all3[name], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
mod
|
|
));
|
|
var __publicField = (obj, key, value) => {
|
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
return value;
|
|
};
|
|
|
|
// node_modules/react/cjs/react.development.js
|
|
var require_react_development = __commonJS({
|
|
"node_modules/react/cjs/react.development.js"(exports, module) {
|
|
"use strict";
|
|
if (true) {
|
|
(function() {
|
|
"use strict";
|
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
}
|
|
var ReactVersion = "18.3.1";
|
|
var REACT_ELEMENT_TYPE2 = Symbol.for("react.element");
|
|
var REACT_PORTAL_TYPE2 = Symbol.for("react.portal");
|
|
var REACT_FRAGMENT_TYPE2 = Symbol.for("react.fragment");
|
|
var REACT_STRICT_MODE_TYPE2 = Symbol.for("react.strict_mode");
|
|
var REACT_PROFILER_TYPE2 = Symbol.for("react.profiler");
|
|
var REACT_PROVIDER_TYPE2 = Symbol.for("react.provider");
|
|
var REACT_CONTEXT_TYPE2 = Symbol.for("react.context");
|
|
var REACT_FORWARD_REF_TYPE2 = Symbol.for("react.forward_ref");
|
|
var REACT_SUSPENSE_TYPE2 = Symbol.for("react.suspense");
|
|
var REACT_SUSPENSE_LIST_TYPE2 = Symbol.for("react.suspense_list");
|
|
var REACT_MEMO_TYPE2 = Symbol.for("react.memo");
|
|
var REACT_LAZY_TYPE2 = Symbol.for("react.lazy");
|
|
var REACT_OFFSCREEN_TYPE2 = Symbol.for("react.offscreen");
|
|
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
function getIteratorFn(maybeIterable) {
|
|
if (maybeIterable === null || typeof maybeIterable !== "object") {
|
|
return null;
|
|
}
|
|
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
if (typeof maybeIterator === "function") {
|
|
return maybeIterator;
|
|
}
|
|
return null;
|
|
}
|
|
var ReactCurrentDispatcher = {
|
|
current: null
|
|
};
|
|
var ReactCurrentBatchConfig = {
|
|
transition: null
|
|
};
|
|
var ReactCurrentActQueue = {
|
|
current: null,
|
|
isBatchingLegacy: false,
|
|
didScheduleLegacyUpdate: false
|
|
};
|
|
var ReactCurrentOwner = {
|
|
current: null
|
|
};
|
|
var ReactDebugCurrentFrame = {};
|
|
var currentExtraStackFrame = null;
|
|
function setExtraStackFrame(stack) {
|
|
{
|
|
currentExtraStackFrame = stack;
|
|
}
|
|
}
|
|
{
|
|
ReactDebugCurrentFrame.setExtraStackFrame = function(stack) {
|
|
{
|
|
currentExtraStackFrame = stack;
|
|
}
|
|
};
|
|
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
ReactDebugCurrentFrame.getStackAddendum = function() {
|
|
var stack = "";
|
|
if (currentExtraStackFrame) {
|
|
stack += currentExtraStackFrame;
|
|
}
|
|
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
|
if (impl) {
|
|
stack += impl() || "";
|
|
}
|
|
return stack;
|
|
};
|
|
}
|
|
var enableScopeAPI = false;
|
|
var enableCacheElement = false;
|
|
var enableTransitionTracing = false;
|
|
var enableLegacyHidden = false;
|
|
var enableDebugTracing = false;
|
|
var ReactSharedInternals = {
|
|
ReactCurrentDispatcher,
|
|
ReactCurrentBatchConfig,
|
|
ReactCurrentOwner
|
|
};
|
|
{
|
|
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
|
|
ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue;
|
|
}
|
|
function warn(format) {
|
|
{
|
|
{
|
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
args[_key - 1] = arguments[_key];
|
|
}
|
|
printWarning("warn", format, args);
|
|
}
|
|
}
|
|
}
|
|
function error(format) {
|
|
{
|
|
{
|
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
args[_key2 - 1] = arguments[_key2];
|
|
}
|
|
printWarning("error", format, args);
|
|
}
|
|
}
|
|
}
|
|
function printWarning(level, format, args) {
|
|
{
|
|
var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
var stack = ReactDebugCurrentFrame2.getStackAddendum();
|
|
if (stack !== "") {
|
|
format += "%s";
|
|
args = args.concat([stack]);
|
|
}
|
|
var argsWithFormat = args.map(function(item) {
|
|
return String(item);
|
|
});
|
|
argsWithFormat.unshift("Warning: " + format);
|
|
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
}
|
|
}
|
|
var didWarnStateUpdateForUnmountedComponent = {};
|
|
function warnNoop(publicInstance, callerName) {
|
|
{
|
|
var _constructor = publicInstance.constructor;
|
|
var componentName = _constructor && (_constructor.displayName || _constructor.name) || "ReactClass";
|
|
var warningKey = componentName + "." + callerName;
|
|
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
|
return;
|
|
}
|
|
error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.", callerName, componentName);
|
|
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
|
}
|
|
}
|
|
var ReactNoopUpdateQueue = {
|
|
isMounted: function(publicInstance) {
|
|
return false;
|
|
},
|
|
enqueueForceUpdate: function(publicInstance, callback, callerName) {
|
|
warnNoop(publicInstance, "forceUpdate");
|
|
},
|
|
enqueueReplaceState: function(publicInstance, completeState, callback, callerName) {
|
|
warnNoop(publicInstance, "replaceState");
|
|
},
|
|
enqueueSetState: function(publicInstance, partialState, callback, callerName) {
|
|
warnNoop(publicInstance, "setState");
|
|
}
|
|
};
|
|
var assign2 = Object.assign;
|
|
var emptyObject = {};
|
|
{
|
|
Object.freeze(emptyObject);
|
|
}
|
|
function Component(props, context, updater) {
|
|
this.props = props;
|
|
this.context = context;
|
|
this.refs = emptyObject;
|
|
this.updater = updater || ReactNoopUpdateQueue;
|
|
}
|
|
Component.prototype.isReactComponent = {};
|
|
Component.prototype.setState = function(partialState, callback) {
|
|
if (typeof partialState !== "object" && typeof partialState !== "function" && partialState != null) {
|
|
throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
|
|
}
|
|
this.updater.enqueueSetState(this, partialState, callback, "setState");
|
|
};
|
|
Component.prototype.forceUpdate = function(callback) {
|
|
this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
|
|
};
|
|
{
|
|
var deprecatedAPIs = {
|
|
isMounted: ["isMounted", "Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],
|
|
replaceState: ["replaceState", "Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]
|
|
};
|
|
var defineDeprecationWarning = function(methodName, info) {
|
|
Object.defineProperty(Component.prototype, methodName, {
|
|
get: function() {
|
|
warn("%s(...) is deprecated in plain JavaScript React classes. %s", info[0], info[1]);
|
|
return void 0;
|
|
}
|
|
});
|
|
};
|
|
for (var fnName in deprecatedAPIs) {
|
|
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
}
|
|
}
|
|
}
|
|
function ComponentDummy() {
|
|
}
|
|
ComponentDummy.prototype = Component.prototype;
|
|
function PureComponent(props, context, updater) {
|
|
this.props = props;
|
|
this.context = context;
|
|
this.refs = emptyObject;
|
|
this.updater = updater || ReactNoopUpdateQueue;
|
|
}
|
|
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
|
pureComponentPrototype.constructor = PureComponent;
|
|
assign2(pureComponentPrototype, Component.prototype);
|
|
pureComponentPrototype.isPureReactComponent = true;
|
|
function createRef() {
|
|
var refObject = {
|
|
current: null
|
|
};
|
|
{
|
|
Object.seal(refObject);
|
|
}
|
|
return refObject;
|
|
}
|
|
var isArrayImpl = Array.isArray;
|
|
function isArray2(a) {
|
|
return isArrayImpl(a);
|
|
}
|
|
function typeName(value) {
|
|
{
|
|
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
|
|
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
return type;
|
|
}
|
|
}
|
|
function willCoercionThrow(value) {
|
|
{
|
|
try {
|
|
testStringCoercion(value);
|
|
return false;
|
|
} catch (e) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
function testStringCoercion(value) {
|
|
return "" + value;
|
|
}
|
|
function checkKeyStringCoercion(value) {
|
|
{
|
|
if (willCoercionThrow(value)) {
|
|
error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
|
|
return testStringCoercion(value);
|
|
}
|
|
}
|
|
}
|
|
function getWrappedName(outerType, innerType, wrapperName) {
|
|
var displayName = outerType.displayName;
|
|
if (displayName) {
|
|
return displayName;
|
|
}
|
|
var functionName = innerType.displayName || innerType.name || "";
|
|
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
}
|
|
function getContextName(type) {
|
|
return type.displayName || "Context";
|
|
}
|
|
function getComponentNameFromType(type) {
|
|
if (type == null) {
|
|
return null;
|
|
}
|
|
{
|
|
if (typeof type.tag === "number") {
|
|
error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
if (typeof type === "function") {
|
|
return type.displayName || type.name || null;
|
|
}
|
|
if (typeof type === "string") {
|
|
return type;
|
|
}
|
|
switch (type) {
|
|
case REACT_FRAGMENT_TYPE2:
|
|
return "Fragment";
|
|
case REACT_PORTAL_TYPE2:
|
|
return "Portal";
|
|
case REACT_PROFILER_TYPE2:
|
|
return "Profiler";
|
|
case REACT_STRICT_MODE_TYPE2:
|
|
return "StrictMode";
|
|
case REACT_SUSPENSE_TYPE2:
|
|
return "Suspense";
|
|
case REACT_SUSPENSE_LIST_TYPE2:
|
|
return "SuspenseList";
|
|
}
|
|
if (typeof type === "object") {
|
|
switch (type.$$typeof) {
|
|
case REACT_CONTEXT_TYPE2:
|
|
var context = type;
|
|
return getContextName(context) + ".Consumer";
|
|
case REACT_PROVIDER_TYPE2:
|
|
var provider = type;
|
|
return getContextName(provider._context) + ".Provider";
|
|
case REACT_FORWARD_REF_TYPE2:
|
|
return getWrappedName(type, type.render, "ForwardRef");
|
|
case REACT_MEMO_TYPE2:
|
|
var outerName = type.displayName || null;
|
|
if (outerName !== null) {
|
|
return outerName;
|
|
}
|
|
return getComponentNameFromType(type.type) || "Memo";
|
|
case REACT_LAZY_TYPE2: {
|
|
var lazyComponent = type;
|
|
var payload = lazyComponent._payload;
|
|
var init = lazyComponent._init;
|
|
try {
|
|
return getComponentNameFromType(init(payload));
|
|
} catch (x) {
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
var hasOwnProperty2 = Object.prototype.hasOwnProperty;
|
|
var RESERVED_PROPS = {
|
|
key: true,
|
|
ref: true,
|
|
__self: true,
|
|
__source: true
|
|
};
|
|
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
|
|
{
|
|
didWarnAboutStringRefs = {};
|
|
}
|
|
function hasValidRef(config3) {
|
|
{
|
|
if (hasOwnProperty2.call(config3, "ref")) {
|
|
var getter = Object.getOwnPropertyDescriptor(config3, "ref").get;
|
|
if (getter && getter.isReactWarning) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return config3.ref !== void 0;
|
|
}
|
|
function hasValidKey(config3) {
|
|
{
|
|
if (hasOwnProperty2.call(config3, "key")) {
|
|
var getter = Object.getOwnPropertyDescriptor(config3, "key").get;
|
|
if (getter && getter.isReactWarning) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return config3.key !== void 0;
|
|
}
|
|
function defineKeyPropWarningGetter(props, displayName) {
|
|
var warnAboutAccessingKey = function() {
|
|
{
|
|
if (!specialPropKeyWarningShown) {
|
|
specialPropKeyWarningShown = true;
|
|
error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
|
|
}
|
|
}
|
|
};
|
|
warnAboutAccessingKey.isReactWarning = true;
|
|
Object.defineProperty(props, "key", {
|
|
get: warnAboutAccessingKey,
|
|
configurable: true
|
|
});
|
|
}
|
|
function defineRefPropWarningGetter(props, displayName) {
|
|
var warnAboutAccessingRef = function() {
|
|
{
|
|
if (!specialPropRefWarningShown) {
|
|
specialPropRefWarningShown = true;
|
|
error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
|
|
}
|
|
}
|
|
};
|
|
warnAboutAccessingRef.isReactWarning = true;
|
|
Object.defineProperty(props, "ref", {
|
|
get: warnAboutAccessingRef,
|
|
configurable: true
|
|
});
|
|
}
|
|
function warnIfStringRefCannotBeAutoConverted(config3) {
|
|
{
|
|
if (typeof config3.ref === "string" && ReactCurrentOwner.current && config3.__self && ReactCurrentOwner.current.stateNode !== config3.__self) {
|
|
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
if (!didWarnAboutStringRefs[componentName]) {
|
|
error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', componentName, config3.ref);
|
|
didWarnAboutStringRefs[componentName] = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var ReactElement = function(type, key, ref, self2, source, owner, props) {
|
|
var element = {
|
|
$$typeof: REACT_ELEMENT_TYPE2,
|
|
type,
|
|
key,
|
|
ref,
|
|
props,
|
|
_owner: owner
|
|
};
|
|
{
|
|
element._store = {};
|
|
Object.defineProperty(element._store, "validated", {
|
|
configurable: false,
|
|
enumerable: false,
|
|
writable: true,
|
|
value: false
|
|
});
|
|
Object.defineProperty(element, "_self", {
|
|
configurable: false,
|
|
enumerable: false,
|
|
writable: false,
|
|
value: self2
|
|
});
|
|
Object.defineProperty(element, "_source", {
|
|
configurable: false,
|
|
enumerable: false,
|
|
writable: false,
|
|
value: source
|
|
});
|
|
if (Object.freeze) {
|
|
Object.freeze(element.props);
|
|
Object.freeze(element);
|
|
}
|
|
}
|
|
return element;
|
|
};
|
|
function createElement2(type, config3, children) {
|
|
var propName;
|
|
var props = {};
|
|
var key = null;
|
|
var ref = null;
|
|
var self2 = null;
|
|
var source = null;
|
|
if (config3 != null) {
|
|
if (hasValidRef(config3)) {
|
|
ref = config3.ref;
|
|
{
|
|
warnIfStringRefCannotBeAutoConverted(config3);
|
|
}
|
|
}
|
|
if (hasValidKey(config3)) {
|
|
{
|
|
checkKeyStringCoercion(config3.key);
|
|
}
|
|
key = "" + config3.key;
|
|
}
|
|
self2 = config3.__self === void 0 ? null : config3.__self;
|
|
source = config3.__source === void 0 ? null : config3.__source;
|
|
for (propName in config3) {
|
|
if (hasOwnProperty2.call(config3, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
props[propName] = config3[propName];
|
|
}
|
|
}
|
|
}
|
|
var childrenLength = arguments.length - 2;
|
|
if (childrenLength === 1) {
|
|
props.children = children;
|
|
} else if (childrenLength > 1) {
|
|
var childArray = Array(childrenLength);
|
|
for (var i = 0; i < childrenLength; i++) {
|
|
childArray[i] = arguments[i + 2];
|
|
}
|
|
{
|
|
if (Object.freeze) {
|
|
Object.freeze(childArray);
|
|
}
|
|
}
|
|
props.children = childArray;
|
|
}
|
|
if (type && type.defaultProps) {
|
|
var defaultProps = type.defaultProps;
|
|
for (propName in defaultProps) {
|
|
if (props[propName] === void 0) {
|
|
props[propName] = defaultProps[propName];
|
|
}
|
|
}
|
|
}
|
|
{
|
|
if (key || ref) {
|
|
var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
|
|
if (key) {
|
|
defineKeyPropWarningGetter(props, displayName);
|
|
}
|
|
if (ref) {
|
|
defineRefPropWarningGetter(props, displayName);
|
|
}
|
|
}
|
|
}
|
|
return ReactElement(type, key, ref, self2, source, ReactCurrentOwner.current, props);
|
|
}
|
|
function cloneAndReplaceKey(oldElement, newKey) {
|
|
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
return newElement;
|
|
}
|
|
function cloneElement(element, config3, children) {
|
|
if (element === null || element === void 0) {
|
|
throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
|
|
}
|
|
var propName;
|
|
var props = assign2({}, element.props);
|
|
var key = element.key;
|
|
var ref = element.ref;
|
|
var self2 = element._self;
|
|
var source = element._source;
|
|
var owner = element._owner;
|
|
if (config3 != null) {
|
|
if (hasValidRef(config3)) {
|
|
ref = config3.ref;
|
|
owner = ReactCurrentOwner.current;
|
|
}
|
|
if (hasValidKey(config3)) {
|
|
{
|
|
checkKeyStringCoercion(config3.key);
|
|
}
|
|
key = "" + config3.key;
|
|
}
|
|
var defaultProps;
|
|
if (element.type && element.type.defaultProps) {
|
|
defaultProps = element.type.defaultProps;
|
|
}
|
|
for (propName in config3) {
|
|
if (hasOwnProperty2.call(config3, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
if (config3[propName] === void 0 && defaultProps !== void 0) {
|
|
props[propName] = defaultProps[propName];
|
|
} else {
|
|
props[propName] = config3[propName];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var childrenLength = arguments.length - 2;
|
|
if (childrenLength === 1) {
|
|
props.children = children;
|
|
} else if (childrenLength > 1) {
|
|
var childArray = Array(childrenLength);
|
|
for (var i = 0; i < childrenLength; i++) {
|
|
childArray[i] = arguments[i + 2];
|
|
}
|
|
props.children = childArray;
|
|
}
|
|
return ReactElement(element.type, key, ref, self2, source, owner, props);
|
|
}
|
|
function isValidElement(object) {
|
|
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE2;
|
|
}
|
|
var SEPARATOR = ".";
|
|
var SUBSEPARATOR = ":";
|
|
function escape(key) {
|
|
var escapeRegex = /[=:]/g;
|
|
var escaperLookup = {
|
|
"=": "=0",
|
|
":": "=2"
|
|
};
|
|
var escapedString = key.replace(escapeRegex, function(match) {
|
|
return escaperLookup[match];
|
|
});
|
|
return "$" + escapedString;
|
|
}
|
|
var didWarnAboutMaps = false;
|
|
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
function escapeUserProvidedKey(text2) {
|
|
return text2.replace(userProvidedKeyEscapeRegex, "$&/");
|
|
}
|
|
function getElementKey(element, index) {
|
|
if (typeof element === "object" && element !== null && element.key != null) {
|
|
{
|
|
checkKeyStringCoercion(element.key);
|
|
}
|
|
return escape("" + element.key);
|
|
}
|
|
return index.toString(36);
|
|
}
|
|
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
|
var type = typeof children;
|
|
if (type === "undefined" || type === "boolean") {
|
|
children = null;
|
|
}
|
|
var invokeCallback = false;
|
|
if (children === null) {
|
|
invokeCallback = true;
|
|
} else {
|
|
switch (type) {
|
|
case "string":
|
|
case "number":
|
|
invokeCallback = true;
|
|
break;
|
|
case "object":
|
|
switch (children.$$typeof) {
|
|
case REACT_ELEMENT_TYPE2:
|
|
case REACT_PORTAL_TYPE2:
|
|
invokeCallback = true;
|
|
}
|
|
}
|
|
}
|
|
if (invokeCallback) {
|
|
var _child = children;
|
|
var mappedChild = callback(_child);
|
|
var childKey = nameSoFar === "" ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
|
|
if (isArray2(mappedChild)) {
|
|
var escapedChildKey = "";
|
|
if (childKey != null) {
|
|
escapedChildKey = escapeUserProvidedKey(childKey) + "/";
|
|
}
|
|
mapIntoArray(mappedChild, array, escapedChildKey, "", function(c) {
|
|
return c;
|
|
});
|
|
} else if (mappedChild != null) {
|
|
if (isValidElement(mappedChild)) {
|
|
{
|
|
if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) {
|
|
checkKeyStringCoercion(mappedChild.key);
|
|
}
|
|
}
|
|
mappedChild = cloneAndReplaceKey(
|
|
mappedChild,
|
|
escapedPrefix + (mappedChild.key && (!_child || _child.key !== mappedChild.key) ? escapeUserProvidedKey("" + mappedChild.key) + "/" : "") + childKey
|
|
);
|
|
}
|
|
array.push(mappedChild);
|
|
}
|
|
return 1;
|
|
}
|
|
var child;
|
|
var nextName;
|
|
var subtreeCount = 0;
|
|
var nextNamePrefix = nameSoFar === "" ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
if (isArray2(children)) {
|
|
for (var i = 0; i < children.length; i++) {
|
|
child = children[i];
|
|
nextName = nextNamePrefix + getElementKey(child, i);
|
|
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
}
|
|
} else {
|
|
var iteratorFn = getIteratorFn(children);
|
|
if (typeof iteratorFn === "function") {
|
|
var iterableChildren = children;
|
|
{
|
|
if (iteratorFn === iterableChildren.entries) {
|
|
if (!didWarnAboutMaps) {
|
|
warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead.");
|
|
}
|
|
didWarnAboutMaps = true;
|
|
}
|
|
}
|
|
var iterator = iteratorFn.call(iterableChildren);
|
|
var step;
|
|
var ii = 0;
|
|
while (!(step = iterator.next()).done) {
|
|
child = step.value;
|
|
nextName = nextNamePrefix + getElementKey(child, ii++);
|
|
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
|
|
}
|
|
} else if (type === "object") {
|
|
var childrenString = String(children);
|
|
throw new Error("Objects are not valid as a React child (found: " + (childrenString === "[object Object]" ? "object with keys {" + Object.keys(children).join(", ") + "}" : childrenString) + "). If you meant to render a collection of children, use an array instead.");
|
|
}
|
|
}
|
|
return subtreeCount;
|
|
}
|
|
function mapChildren(children, func, context) {
|
|
if (children == null) {
|
|
return children;
|
|
}
|
|
var result = [];
|
|
var count = 0;
|
|
mapIntoArray(children, result, "", "", function(child) {
|
|
return func.call(context, child, count++);
|
|
});
|
|
return result;
|
|
}
|
|
function countChildren(children) {
|
|
var n = 0;
|
|
mapChildren(children, function() {
|
|
n++;
|
|
});
|
|
return n;
|
|
}
|
|
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
mapChildren(children, function() {
|
|
forEachFunc.apply(this, arguments);
|
|
}, forEachContext);
|
|
}
|
|
function toArray3(children) {
|
|
return mapChildren(children, function(child) {
|
|
return child;
|
|
}) || [];
|
|
}
|
|
function onlyChild(children) {
|
|
if (!isValidElement(children)) {
|
|
throw new Error("React.Children.only expected to receive a single React element child.");
|
|
}
|
|
return children;
|
|
}
|
|
function createContext(defaultValue) {
|
|
var context = {
|
|
$$typeof: REACT_CONTEXT_TYPE2,
|
|
_currentValue: defaultValue,
|
|
_currentValue2: defaultValue,
|
|
_threadCount: 0,
|
|
Provider: null,
|
|
Consumer: null,
|
|
_defaultValue: null,
|
|
_globalName: null
|
|
};
|
|
context.Provider = {
|
|
$$typeof: REACT_PROVIDER_TYPE2,
|
|
_context: context
|
|
};
|
|
var hasWarnedAboutUsingNestedContextConsumers = false;
|
|
var hasWarnedAboutUsingConsumerProvider = false;
|
|
var hasWarnedAboutDisplayNameOnConsumer = false;
|
|
{
|
|
var Consumer = {
|
|
$$typeof: REACT_CONTEXT_TYPE2,
|
|
_context: context
|
|
};
|
|
Object.defineProperties(Consumer, {
|
|
Provider: {
|
|
get: function() {
|
|
if (!hasWarnedAboutUsingConsumerProvider) {
|
|
hasWarnedAboutUsingConsumerProvider = true;
|
|
error("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?");
|
|
}
|
|
return context.Provider;
|
|
},
|
|
set: function(_Provider) {
|
|
context.Provider = _Provider;
|
|
}
|
|
},
|
|
_currentValue: {
|
|
get: function() {
|
|
return context._currentValue;
|
|
},
|
|
set: function(_currentValue) {
|
|
context._currentValue = _currentValue;
|
|
}
|
|
},
|
|
_currentValue2: {
|
|
get: function() {
|
|
return context._currentValue2;
|
|
},
|
|
set: function(_currentValue2) {
|
|
context._currentValue2 = _currentValue2;
|
|
}
|
|
},
|
|
_threadCount: {
|
|
get: function() {
|
|
return context._threadCount;
|
|
},
|
|
set: function(_threadCount) {
|
|
context._threadCount = _threadCount;
|
|
}
|
|
},
|
|
Consumer: {
|
|
get: function() {
|
|
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
hasWarnedAboutUsingNestedContextConsumers = true;
|
|
error("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?");
|
|
}
|
|
return context.Consumer;
|
|
}
|
|
},
|
|
displayName: {
|
|
get: function() {
|
|
return context.displayName;
|
|
},
|
|
set: function(displayName) {
|
|
if (!hasWarnedAboutDisplayNameOnConsumer) {
|
|
warn("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.", displayName);
|
|
hasWarnedAboutDisplayNameOnConsumer = true;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
context.Consumer = Consumer;
|
|
}
|
|
{
|
|
context._currentRenderer = null;
|
|
context._currentRenderer2 = null;
|
|
}
|
|
return context;
|
|
}
|
|
var Uninitialized = -1;
|
|
var Pending = 0;
|
|
var Resolved = 1;
|
|
var Rejected = 2;
|
|
function lazyInitializer(payload) {
|
|
if (payload._status === Uninitialized) {
|
|
var ctor = payload._result;
|
|
var thenable = ctor();
|
|
thenable.then(function(moduleObject2) {
|
|
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
var resolved = payload;
|
|
resolved._status = Resolved;
|
|
resolved._result = moduleObject2;
|
|
}
|
|
}, function(error2) {
|
|
if (payload._status === Pending || payload._status === Uninitialized) {
|
|
var rejected = payload;
|
|
rejected._status = Rejected;
|
|
rejected._result = error2;
|
|
}
|
|
});
|
|
if (payload._status === Uninitialized) {
|
|
var pending = payload;
|
|
pending._status = Pending;
|
|
pending._result = thenable;
|
|
}
|
|
}
|
|
if (payload._status === Resolved) {
|
|
var moduleObject = payload._result;
|
|
{
|
|
if (moduleObject === void 0) {
|
|
error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))\n\nDid you accidentally put curly braces around the import?", moduleObject);
|
|
}
|
|
}
|
|
{
|
|
if (!("default" in moduleObject)) {
|
|
error("lazy: Expected the result of a dynamic import() call. Instead received: %s\n\nYour code should look like: \n const MyComponent = lazy(() => import('./MyComponent'))", moduleObject);
|
|
}
|
|
}
|
|
return moduleObject.default;
|
|
} else {
|
|
throw payload._result;
|
|
}
|
|
}
|
|
function lazy(ctor) {
|
|
var payload = {
|
|
_status: Uninitialized,
|
|
_result: ctor
|
|
};
|
|
var lazyType = {
|
|
$$typeof: REACT_LAZY_TYPE2,
|
|
_payload: payload,
|
|
_init: lazyInitializer
|
|
};
|
|
{
|
|
var defaultProps;
|
|
var propTypes;
|
|
Object.defineProperties(lazyType, {
|
|
defaultProps: {
|
|
configurable: true,
|
|
get: function() {
|
|
return defaultProps;
|
|
},
|
|
set: function(newDefaultProps) {
|
|
error("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it.");
|
|
defaultProps = newDefaultProps;
|
|
Object.defineProperty(lazyType, "defaultProps", {
|
|
enumerable: true
|
|
});
|
|
}
|
|
},
|
|
propTypes: {
|
|
configurable: true,
|
|
get: function() {
|
|
return propTypes;
|
|
},
|
|
set: function(newPropTypes) {
|
|
error("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it.");
|
|
propTypes = newPropTypes;
|
|
Object.defineProperty(lazyType, "propTypes", {
|
|
enumerable: true
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
return lazyType;
|
|
}
|
|
function forwardRef(render3) {
|
|
{
|
|
if (render3 != null && render3.$$typeof === REACT_MEMO_TYPE2) {
|
|
error("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...)).");
|
|
} else if (typeof render3 !== "function") {
|
|
error("forwardRef requires a render function but was given %s.", render3 === null ? "null" : typeof render3);
|
|
} else {
|
|
if (render3.length !== 0 && render3.length !== 2) {
|
|
error("forwardRef render functions accept exactly two parameters: props and ref. %s", render3.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined.");
|
|
}
|
|
}
|
|
if (render3 != null) {
|
|
if (render3.defaultProps != null || render3.propTypes != null) {
|
|
error("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");
|
|
}
|
|
}
|
|
}
|
|
var elementType = {
|
|
$$typeof: REACT_FORWARD_REF_TYPE2,
|
|
render: render3
|
|
};
|
|
{
|
|
var ownName;
|
|
Object.defineProperty(elementType, "displayName", {
|
|
enumerable: false,
|
|
configurable: true,
|
|
get: function() {
|
|
return ownName;
|
|
},
|
|
set: function(name) {
|
|
ownName = name;
|
|
if (!render3.name && !render3.displayName) {
|
|
render3.displayName = name;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
return elementType;
|
|
}
|
|
var REACT_MODULE_REFERENCE;
|
|
{
|
|
REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
|
|
}
|
|
function isValidElementType(type) {
|
|
if (typeof type === "string" || typeof type === "function") {
|
|
return true;
|
|
}
|
|
if (type === REACT_FRAGMENT_TYPE2 || type === REACT_PROFILER_TYPE2 || enableDebugTracing || type === REACT_STRICT_MODE_TYPE2 || type === REACT_SUSPENSE_TYPE2 || type === REACT_SUSPENSE_LIST_TYPE2 || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE2 || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
|
|
return true;
|
|
}
|
|
if (typeof type === "object" && type !== null) {
|
|
if (type.$$typeof === REACT_LAZY_TYPE2 || type.$$typeof === REACT_MEMO_TYPE2 || type.$$typeof === REACT_PROVIDER_TYPE2 || type.$$typeof === REACT_CONTEXT_TYPE2 || type.$$typeof === REACT_FORWARD_REF_TYPE2 || type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
function memo(type, compare) {
|
|
{
|
|
if (!isValidElementType(type)) {
|
|
error("memo: The first argument must be a component. Instead received: %s", type === null ? "null" : typeof type);
|
|
}
|
|
}
|
|
var elementType = {
|
|
$$typeof: REACT_MEMO_TYPE2,
|
|
type,
|
|
compare: compare === void 0 ? null : compare
|
|
};
|
|
{
|
|
var ownName;
|
|
Object.defineProperty(elementType, "displayName", {
|
|
enumerable: false,
|
|
configurable: true,
|
|
get: function() {
|
|
return ownName;
|
|
},
|
|
set: function(name) {
|
|
ownName = name;
|
|
if (!type.name && !type.displayName) {
|
|
type.displayName = name;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
return elementType;
|
|
}
|
|
function resolveDispatcher() {
|
|
var dispatcher = ReactCurrentDispatcher.current;
|
|
{
|
|
if (dispatcher === null) {
|
|
error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");
|
|
}
|
|
}
|
|
return dispatcher;
|
|
}
|
|
function useContext(Context) {
|
|
var dispatcher = resolveDispatcher();
|
|
{
|
|
if (Context._context !== void 0) {
|
|
var realContext = Context._context;
|
|
if (realContext.Consumer === Context) {
|
|
error("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?");
|
|
} else if (realContext.Provider === Context) {
|
|
error("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?");
|
|
}
|
|
}
|
|
}
|
|
return dispatcher.useContext(Context);
|
|
}
|
|
function useState15(initialState9) {
|
|
var dispatcher = resolveDispatcher();
|
|
return dispatcher.useState(initialState9);
|
|
}
|
|
function useReducer(reducer, initialArg, init) {
|
|
var dispatcher = resolveDispatcher();
|
|
return dispatcher.useReducer(reducer, initialArg, init);
|
|
}
|
|
function useRef3(initialValue) {
|
|
var dispatcher = resolveDispatcher();
|
|
return dispatcher.useRef(initialValue);
|
|
}
|
|
function useEffect15(create, deps) {
|
|
var dispatcher = resolveDispatcher();
|
|
return dispatcher.useEffect(create, deps);
|
|
}
|
|
function useInsertionEffect(create, deps) {
|
|
var dispatcher = resolveDispatcher();
|
|
return dispatcher.useInsertionEffect(create, deps);
|
|
}
|
|
function useLayoutEffect(create, deps) {
|
|
var dispatcher = resolveDispatcher();
|
|
return dispatcher.useLayoutEffect(create, deps);
|
|
}
|
|
function useCallback(callback, deps) {
|
|
var dispatcher = resolveDispatcher();
|
|
return dispatcher.useCallback(callback, deps);
|
|
}
|
|
function useMemo(create, deps) {
|
|
var dispatcher = resolveDispatcher();
|
|
return dispatcher.useMemo(create, deps);
|
|
}
|
|
function useImperativeHandle(ref, create, deps) {
|
|
var dispatcher = resolveDispatcher();
|
|
return dispatcher.useImperativeHandle(ref, create, deps);
|
|
}
|
|
function useDebugValue(value, formatterFn) {
|
|
{
|
|
var dispatcher = resolveDispatcher();
|
|
return dispatcher.useDebugValue(value, formatterFn);
|
|
}
|
|
}
|
|
function useTransition() {
|
|
var dispatcher = resolveDispatcher();
|
|
return dispatcher.useTransition();
|
|
}
|
|
function useDeferredValue(value) {
|
|
var dispatcher = resolveDispatcher();
|
|
return dispatcher.useDeferredValue(value);
|
|
}
|
|
function useId() {
|
|
var dispatcher = resolveDispatcher();
|
|
return dispatcher.useId();
|
|
}
|
|
function useSyncExternalStore3(subscribe, getSnapshot, getServerSnapshot) {
|
|
var dispatcher = resolveDispatcher();
|
|
return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
}
|
|
var disabledDepth = 0;
|
|
var prevLog;
|
|
var prevInfo;
|
|
var prevWarn;
|
|
var prevError;
|
|
var prevGroup;
|
|
var prevGroupCollapsed;
|
|
var prevGroupEnd;
|
|
function disabledLog() {
|
|
}
|
|
disabledLog.__reactDisabledLog = true;
|
|
function disableLogs() {
|
|
{
|
|
if (disabledDepth === 0) {
|
|
prevLog = console.log;
|
|
prevInfo = console.info;
|
|
prevWarn = console.warn;
|
|
prevError = console.error;
|
|
prevGroup = console.group;
|
|
prevGroupCollapsed = console.groupCollapsed;
|
|
prevGroupEnd = console.groupEnd;
|
|
var props = {
|
|
configurable: true,
|
|
enumerable: true,
|
|
value: disabledLog,
|
|
writable: true
|
|
};
|
|
Object.defineProperties(console, {
|
|
info: props,
|
|
log: props,
|
|
warn: props,
|
|
error: props,
|
|
group: props,
|
|
groupCollapsed: props,
|
|
groupEnd: props
|
|
});
|
|
}
|
|
disabledDepth++;
|
|
}
|
|
}
|
|
function reenableLogs() {
|
|
{
|
|
disabledDepth--;
|
|
if (disabledDepth === 0) {
|
|
var props = {
|
|
configurable: true,
|
|
enumerable: true,
|
|
writable: true
|
|
};
|
|
Object.defineProperties(console, {
|
|
log: assign2({}, props, {
|
|
value: prevLog
|
|
}),
|
|
info: assign2({}, props, {
|
|
value: prevInfo
|
|
}),
|
|
warn: assign2({}, props, {
|
|
value: prevWarn
|
|
}),
|
|
error: assign2({}, props, {
|
|
value: prevError
|
|
}),
|
|
group: assign2({}, props, {
|
|
value: prevGroup
|
|
}),
|
|
groupCollapsed: assign2({}, props, {
|
|
value: prevGroupCollapsed
|
|
}),
|
|
groupEnd: assign2({}, props, {
|
|
value: prevGroupEnd
|
|
})
|
|
});
|
|
}
|
|
if (disabledDepth < 0) {
|
|
error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
}
|
|
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
var prefix;
|
|
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
{
|
|
if (prefix === void 0) {
|
|
try {
|
|
throw Error();
|
|
} catch (x) {
|
|
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
prefix = match && match[1] || "";
|
|
}
|
|
}
|
|
return "\n" + prefix + name;
|
|
}
|
|
}
|
|
var reentry = false;
|
|
var componentFrameCache;
|
|
{
|
|
var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
|
|
componentFrameCache = new PossiblyWeakMap();
|
|
}
|
|
function describeNativeComponentFrame(fn, construct) {
|
|
if (!fn || reentry) {
|
|
return "";
|
|
}
|
|
{
|
|
var frame = componentFrameCache.get(fn);
|
|
if (frame !== void 0) {
|
|
return frame;
|
|
}
|
|
}
|
|
var control;
|
|
reentry = true;
|
|
var previousPrepareStackTrace = Error.prepareStackTrace;
|
|
Error.prepareStackTrace = void 0;
|
|
var previousDispatcher;
|
|
{
|
|
previousDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = null;
|
|
disableLogs();
|
|
}
|
|
try {
|
|
if (construct) {
|
|
var Fake = function() {
|
|
throw Error();
|
|
};
|
|
Object.defineProperty(Fake.prototype, "props", {
|
|
set: function() {
|
|
throw Error();
|
|
}
|
|
});
|
|
if (typeof Reflect === "object" && Reflect.construct) {
|
|
try {
|
|
Reflect.construct(Fake, []);
|
|
} catch (x) {
|
|
control = x;
|
|
}
|
|
Reflect.construct(fn, [], Fake);
|
|
} else {
|
|
try {
|
|
Fake.call();
|
|
} catch (x) {
|
|
control = x;
|
|
}
|
|
fn.call(Fake.prototype);
|
|
}
|
|
} else {
|
|
try {
|
|
throw Error();
|
|
} catch (x) {
|
|
control = x;
|
|
}
|
|
fn();
|
|
}
|
|
} catch (sample) {
|
|
if (sample && control && typeof sample.stack === "string") {
|
|
var sampleLines = sample.stack.split("\n");
|
|
var controlLines = control.stack.split("\n");
|
|
var s = sampleLines.length - 1;
|
|
var c = controlLines.length - 1;
|
|
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
c--;
|
|
}
|
|
for (; s >= 1 && c >= 0; s--, c--) {
|
|
if (sampleLines[s] !== controlLines[c]) {
|
|
if (s !== 1 || c !== 1) {
|
|
do {
|
|
s--;
|
|
c--;
|
|
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
|
|
if (fn.displayName && _frame.includes("<anonymous>")) {
|
|
_frame = _frame.replace("<anonymous>", fn.displayName);
|
|
}
|
|
{
|
|
if (typeof fn === "function") {
|
|
componentFrameCache.set(fn, _frame);
|
|
}
|
|
}
|
|
return _frame;
|
|
}
|
|
} while (s >= 1 && c >= 0);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} finally {
|
|
reentry = false;
|
|
{
|
|
ReactCurrentDispatcher$1.current = previousDispatcher;
|
|
reenableLogs();
|
|
}
|
|
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
}
|
|
var name = fn ? fn.displayName || fn.name : "";
|
|
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
|
|
{
|
|
if (typeof fn === "function") {
|
|
componentFrameCache.set(fn, syntheticFrame);
|
|
}
|
|
}
|
|
return syntheticFrame;
|
|
}
|
|
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
{
|
|
return describeNativeComponentFrame(fn, false);
|
|
}
|
|
}
|
|
function shouldConstruct(Component2) {
|
|
var prototype3 = Component2.prototype;
|
|
return !!(prototype3 && prototype3.isReactComponent);
|
|
}
|
|
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
if (type == null) {
|
|
return "";
|
|
}
|
|
if (typeof type === "function") {
|
|
{
|
|
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
}
|
|
}
|
|
if (typeof type === "string") {
|
|
return describeBuiltInComponentFrame(type);
|
|
}
|
|
switch (type) {
|
|
case REACT_SUSPENSE_TYPE2:
|
|
return describeBuiltInComponentFrame("Suspense");
|
|
case REACT_SUSPENSE_LIST_TYPE2:
|
|
return describeBuiltInComponentFrame("SuspenseList");
|
|
}
|
|
if (typeof type === "object") {
|
|
switch (type.$$typeof) {
|
|
case REACT_FORWARD_REF_TYPE2:
|
|
return describeFunctionComponentFrame(type.render);
|
|
case REACT_MEMO_TYPE2:
|
|
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
case REACT_LAZY_TYPE2: {
|
|
var lazyComponent = type;
|
|
var payload = lazyComponent._payload;
|
|
var init = lazyComponent._init;
|
|
try {
|
|
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
} catch (x) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
var loggedTypeFailures = {};
|
|
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
function setCurrentlyValidatingElement(element) {
|
|
{
|
|
if (element) {
|
|
var owner = element._owner;
|
|
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
} else {
|
|
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
}
|
|
}
|
|
}
|
|
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
{
|
|
var has2 = Function.call.bind(hasOwnProperty2);
|
|
for (var typeSpecName in typeSpecs) {
|
|
if (has2(typeSpecs, typeSpecName)) {
|
|
var error$1 = void 0;
|
|
try {
|
|
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
err.name = "Invariant Violation";
|
|
throw err;
|
|
}
|
|
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
} catch (ex) {
|
|
error$1 = ex;
|
|
}
|
|
if (error$1 && !(error$1 instanceof Error)) {
|
|
setCurrentlyValidatingElement(element);
|
|
error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
|
|
setCurrentlyValidatingElement(null);
|
|
}
|
|
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
loggedTypeFailures[error$1.message] = true;
|
|
setCurrentlyValidatingElement(element);
|
|
error("Failed %s type: %s", location, error$1.message);
|
|
setCurrentlyValidatingElement(null);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function setCurrentlyValidatingElement$1(element) {
|
|
{
|
|
if (element) {
|
|
var owner = element._owner;
|
|
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
setExtraStackFrame(stack);
|
|
} else {
|
|
setExtraStackFrame(null);
|
|
}
|
|
}
|
|
}
|
|
var propTypesMisspellWarningShown;
|
|
{
|
|
propTypesMisspellWarningShown = false;
|
|
}
|
|
function getDeclarationErrorAddendum() {
|
|
if (ReactCurrentOwner.current) {
|
|
var name = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
if (name) {
|
|
return "\n\nCheck the render method of `" + name + "`.";
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
function getSourceInfoErrorAddendum(source) {
|
|
if (source !== void 0) {
|
|
var fileName = source.fileName.replace(/^.*[\\\/]/, "");
|
|
var lineNumber = source.lineNumber;
|
|
return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
|
|
}
|
|
return "";
|
|
}
|
|
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
if (elementProps !== null && elementProps !== void 0) {
|
|
return getSourceInfoErrorAddendum(elementProps.__source);
|
|
}
|
|
return "";
|
|
}
|
|
var ownerHasKeyUseWarning = {};
|
|
function getCurrentComponentErrorInfo(parentType) {
|
|
var info = getDeclarationErrorAddendum();
|
|
if (!info) {
|
|
var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
|
|
if (parentName) {
|
|
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
}
|
|
}
|
|
return info;
|
|
}
|
|
function validateExplicitKey(element, parentType) {
|
|
if (!element._store || element._store.validated || element.key != null) {
|
|
return;
|
|
}
|
|
element._store.validated = true;
|
|
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
return;
|
|
}
|
|
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
var childOwner = "";
|
|
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
}
|
|
{
|
|
setCurrentlyValidatingElement$1(element);
|
|
error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
setCurrentlyValidatingElement$1(null);
|
|
}
|
|
}
|
|
function validateChildKeys(node, parentType) {
|
|
if (typeof node !== "object") {
|
|
return;
|
|
}
|
|
if (isArray2(node)) {
|
|
for (var i = 0; i < node.length; i++) {
|
|
var child = node[i];
|
|
if (isValidElement(child)) {
|
|
validateExplicitKey(child, parentType);
|
|
}
|
|
}
|
|
} else if (isValidElement(node)) {
|
|
if (node._store) {
|
|
node._store.validated = true;
|
|
}
|
|
} else if (node) {
|
|
var iteratorFn = getIteratorFn(node);
|
|
if (typeof iteratorFn === "function") {
|
|
if (iteratorFn !== node.entries) {
|
|
var iterator = iteratorFn.call(node);
|
|
var step;
|
|
while (!(step = iterator.next()).done) {
|
|
if (isValidElement(step.value)) {
|
|
validateExplicitKey(step.value, parentType);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function validatePropTypes(element) {
|
|
{
|
|
var type = element.type;
|
|
if (type === null || type === void 0 || typeof type === "string") {
|
|
return;
|
|
}
|
|
var propTypes;
|
|
if (typeof type === "function") {
|
|
propTypes = type.propTypes;
|
|
} else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE2 || type.$$typeof === REACT_MEMO_TYPE2)) {
|
|
propTypes = type.propTypes;
|
|
} else {
|
|
return;
|
|
}
|
|
if (propTypes) {
|
|
var name = getComponentNameFromType(type);
|
|
checkPropTypes(propTypes, element.props, "prop", name, element);
|
|
} else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
|
|
propTypesMisspellWarningShown = true;
|
|
var _name = getComponentNameFromType(type);
|
|
error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
|
|
}
|
|
if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
|
|
error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
}
|
|
}
|
|
}
|
|
function validateFragmentProps(fragment) {
|
|
{
|
|
var keys2 = Object.keys(fragment.props);
|
|
for (var i = 0; i < keys2.length; i++) {
|
|
var key = keys2[i];
|
|
if (key !== "children" && key !== "key") {
|
|
setCurrentlyValidatingElement$1(fragment);
|
|
error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
|
|
setCurrentlyValidatingElement$1(null);
|
|
break;
|
|
}
|
|
}
|
|
if (fragment.ref !== null) {
|
|
setCurrentlyValidatingElement$1(fragment);
|
|
error("Invalid attribute `ref` supplied to `React.Fragment`.");
|
|
setCurrentlyValidatingElement$1(null);
|
|
}
|
|
}
|
|
}
|
|
function createElementWithValidation(type, props, children) {
|
|
var validType = isValidElementType(type);
|
|
if (!validType) {
|
|
var info = "";
|
|
if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
|
|
info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
|
|
}
|
|
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
if (sourceInfo) {
|
|
info += sourceInfo;
|
|
} else {
|
|
info += getDeclarationErrorAddendum();
|
|
}
|
|
var typeString;
|
|
if (type === null) {
|
|
typeString = "null";
|
|
} else if (isArray2(type)) {
|
|
typeString = "array";
|
|
} else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE2) {
|
|
typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
|
|
info = " Did you accidentally export a JSX literal instead of a component?";
|
|
} else {
|
|
typeString = typeof type;
|
|
}
|
|
{
|
|
error("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
|
|
}
|
|
}
|
|
var element = createElement2.apply(this, arguments);
|
|
if (element == null) {
|
|
return element;
|
|
}
|
|
if (validType) {
|
|
for (var i = 2; i < arguments.length; i++) {
|
|
validateChildKeys(arguments[i], type);
|
|
}
|
|
}
|
|
if (type === REACT_FRAGMENT_TYPE2) {
|
|
validateFragmentProps(element);
|
|
} else {
|
|
validatePropTypes(element);
|
|
}
|
|
return element;
|
|
}
|
|
var didWarnAboutDeprecatedCreateFactory = false;
|
|
function createFactoryWithValidation(type) {
|
|
var validatedFactory = createElementWithValidation.bind(null, type);
|
|
validatedFactory.type = type;
|
|
{
|
|
if (!didWarnAboutDeprecatedCreateFactory) {
|
|
didWarnAboutDeprecatedCreateFactory = true;
|
|
warn("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.");
|
|
}
|
|
Object.defineProperty(validatedFactory, "type", {
|
|
enumerable: false,
|
|
get: function() {
|
|
warn("Factory.type is deprecated. Access the class directly before passing it to createFactory.");
|
|
Object.defineProperty(this, "type", {
|
|
value: type
|
|
});
|
|
return type;
|
|
}
|
|
});
|
|
}
|
|
return validatedFactory;
|
|
}
|
|
function cloneElementWithValidation(element, props, children) {
|
|
var newElement = cloneElement.apply(this, arguments);
|
|
for (var i = 2; i < arguments.length; i++) {
|
|
validateChildKeys(arguments[i], newElement.type);
|
|
}
|
|
validatePropTypes(newElement);
|
|
return newElement;
|
|
}
|
|
function startTransition(scope, options) {
|
|
var prevTransition = ReactCurrentBatchConfig.transition;
|
|
ReactCurrentBatchConfig.transition = {};
|
|
var currentTransition = ReactCurrentBatchConfig.transition;
|
|
{
|
|
ReactCurrentBatchConfig.transition._updatedFibers = /* @__PURE__ */ new Set();
|
|
}
|
|
try {
|
|
scope();
|
|
} finally {
|
|
ReactCurrentBatchConfig.transition = prevTransition;
|
|
{
|
|
if (prevTransition === null && currentTransition._updatedFibers) {
|
|
var updatedFibersCount = currentTransition._updatedFibers.size;
|
|
if (updatedFibersCount > 10) {
|
|
warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.");
|
|
}
|
|
currentTransition._updatedFibers.clear();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var didWarnAboutMessageChannel = false;
|
|
var enqueueTaskImpl = null;
|
|
function enqueueTask(task) {
|
|
if (enqueueTaskImpl === null) {
|
|
try {
|
|
var requireString = ("require" + Math.random()).slice(0, 7);
|
|
var nodeRequire = module && module[requireString];
|
|
enqueueTaskImpl = nodeRequire.call(module, "timers").setImmediate;
|
|
} catch (_err) {
|
|
enqueueTaskImpl = function(callback) {
|
|
{
|
|
if (didWarnAboutMessageChannel === false) {
|
|
didWarnAboutMessageChannel = true;
|
|
if (typeof MessageChannel === "undefined") {
|
|
error("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning.");
|
|
}
|
|
}
|
|
}
|
|
var channel = new MessageChannel();
|
|
channel.port1.onmessage = callback;
|
|
channel.port2.postMessage(void 0);
|
|
};
|
|
}
|
|
}
|
|
return enqueueTaskImpl(task);
|
|
}
|
|
var actScopeDepth = 0;
|
|
var didWarnNoAwaitAct = false;
|
|
function act(callback) {
|
|
{
|
|
var prevActScopeDepth = actScopeDepth;
|
|
actScopeDepth++;
|
|
if (ReactCurrentActQueue.current === null) {
|
|
ReactCurrentActQueue.current = [];
|
|
}
|
|
var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy;
|
|
var result;
|
|
try {
|
|
ReactCurrentActQueue.isBatchingLegacy = true;
|
|
result = callback();
|
|
if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) {
|
|
var queue = ReactCurrentActQueue.current;
|
|
if (queue !== null) {
|
|
ReactCurrentActQueue.didScheduleLegacyUpdate = false;
|
|
flushActQueue(queue);
|
|
}
|
|
}
|
|
} catch (error2) {
|
|
popActScope(prevActScopeDepth);
|
|
throw error2;
|
|
} finally {
|
|
ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy;
|
|
}
|
|
if (result !== null && typeof result === "object" && typeof result.then === "function") {
|
|
var thenableResult = result;
|
|
var wasAwaited = false;
|
|
var thenable = {
|
|
then: function(resolve, reject) {
|
|
wasAwaited = true;
|
|
thenableResult.then(function(returnValue2) {
|
|
popActScope(prevActScopeDepth);
|
|
if (actScopeDepth === 0) {
|
|
recursivelyFlushAsyncActWork(returnValue2, resolve, reject);
|
|
} else {
|
|
resolve(returnValue2);
|
|
}
|
|
}, function(error2) {
|
|
popActScope(prevActScopeDepth);
|
|
reject(error2);
|
|
});
|
|
}
|
|
};
|
|
{
|
|
if (!didWarnNoAwaitAct && typeof Promise !== "undefined") {
|
|
Promise.resolve().then(function() {
|
|
}).then(function() {
|
|
if (!wasAwaited) {
|
|
didWarnNoAwaitAct = true;
|
|
error("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);");
|
|
}
|
|
});
|
|
}
|
|
}
|
|
return thenable;
|
|
} else {
|
|
var returnValue = result;
|
|
popActScope(prevActScopeDepth);
|
|
if (actScopeDepth === 0) {
|
|
var _queue = ReactCurrentActQueue.current;
|
|
if (_queue !== null) {
|
|
flushActQueue(_queue);
|
|
ReactCurrentActQueue.current = null;
|
|
}
|
|
var _thenable = {
|
|
then: function(resolve, reject) {
|
|
if (ReactCurrentActQueue.current === null) {
|
|
ReactCurrentActQueue.current = [];
|
|
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
} else {
|
|
resolve(returnValue);
|
|
}
|
|
}
|
|
};
|
|
return _thenable;
|
|
} else {
|
|
var _thenable2 = {
|
|
then: function(resolve, reject) {
|
|
resolve(returnValue);
|
|
}
|
|
};
|
|
return _thenable2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function popActScope(prevActScopeDepth) {
|
|
{
|
|
if (prevActScopeDepth !== actScopeDepth - 1) {
|
|
error("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. ");
|
|
}
|
|
actScopeDepth = prevActScopeDepth;
|
|
}
|
|
}
|
|
function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
|
|
{
|
|
var queue = ReactCurrentActQueue.current;
|
|
if (queue !== null) {
|
|
try {
|
|
flushActQueue(queue);
|
|
enqueueTask(function() {
|
|
if (queue.length === 0) {
|
|
ReactCurrentActQueue.current = null;
|
|
resolve(returnValue);
|
|
} else {
|
|
recursivelyFlushAsyncActWork(returnValue, resolve, reject);
|
|
}
|
|
});
|
|
} catch (error2) {
|
|
reject(error2);
|
|
}
|
|
} else {
|
|
resolve(returnValue);
|
|
}
|
|
}
|
|
}
|
|
var isFlushing = false;
|
|
function flushActQueue(queue) {
|
|
{
|
|
if (!isFlushing) {
|
|
isFlushing = true;
|
|
var i = 0;
|
|
try {
|
|
for (; i < queue.length; i++) {
|
|
var callback = queue[i];
|
|
do {
|
|
callback = callback(true);
|
|
} while (callback !== null);
|
|
}
|
|
queue.length = 0;
|
|
} catch (error2) {
|
|
queue = queue.slice(i + 1);
|
|
throw error2;
|
|
} finally {
|
|
isFlushing = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var createElement$1 = createElementWithValidation;
|
|
var cloneElement$1 = cloneElementWithValidation;
|
|
var createFactory = createFactoryWithValidation;
|
|
var Children = {
|
|
map: mapChildren,
|
|
forEach: forEachChildren,
|
|
count: countChildren,
|
|
toArray: toArray3,
|
|
only: onlyChild
|
|
};
|
|
exports.Children = Children;
|
|
exports.Component = Component;
|
|
exports.Fragment = REACT_FRAGMENT_TYPE2;
|
|
exports.Profiler = REACT_PROFILER_TYPE2;
|
|
exports.PureComponent = PureComponent;
|
|
exports.StrictMode = REACT_STRICT_MODE_TYPE2;
|
|
exports.Suspense = REACT_SUSPENSE_TYPE2;
|
|
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
|
|
exports.act = act;
|
|
exports.cloneElement = cloneElement$1;
|
|
exports.createContext = createContext;
|
|
exports.createElement = createElement$1;
|
|
exports.createFactory = createFactory;
|
|
exports.createRef = createRef;
|
|
exports.forwardRef = forwardRef;
|
|
exports.isValidElement = isValidElement;
|
|
exports.lazy = lazy;
|
|
exports.memo = memo;
|
|
exports.startTransition = startTransition;
|
|
exports.unstable_act = act;
|
|
exports.useCallback = useCallback;
|
|
exports.useContext = useContext;
|
|
exports.useDebugValue = useDebugValue;
|
|
exports.useDeferredValue = useDeferredValue;
|
|
exports.useEffect = useEffect15;
|
|
exports.useId = useId;
|
|
exports.useImperativeHandle = useImperativeHandle;
|
|
exports.useInsertionEffect = useInsertionEffect;
|
|
exports.useLayoutEffect = useLayoutEffect;
|
|
exports.useMemo = useMemo;
|
|
exports.useReducer = useReducer;
|
|
exports.useRef = useRef3;
|
|
exports.useState = useState15;
|
|
exports.useSyncExternalStore = useSyncExternalStore3;
|
|
exports.useTransition = useTransition;
|
|
exports.version = ReactVersion;
|
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
|
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
}
|
|
})();
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/react/index.js
|
|
var require_react = __commonJS({
|
|
"node_modules/react/index.js"(exports, module) {
|
|
"use strict";
|
|
if (false) {
|
|
module.exports = null;
|
|
} else {
|
|
module.exports = require_react_development();
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/scheduler/cjs/scheduler.development.js
|
|
var require_scheduler_development = __commonJS({
|
|
"node_modules/scheduler/cjs/scheduler.development.js"(exports) {
|
|
"use strict";
|
|
if (true) {
|
|
(function() {
|
|
"use strict";
|
|
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) {
|
|
var index = heap.length;
|
|
heap.push(node);
|
|
siftUp(heap, node, index);
|
|
}
|
|
function peek2(heap) {
|
|
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 (last !== first) {
|
|
heap[0] = last;
|
|
siftDown(heap, last, 0);
|
|
}
|
|
return first;
|
|
}
|
|
function siftUp(heap, node, i) {
|
|
var index = i;
|
|
while (index > 0) {
|
|
var parentIndex = index - 1 >>> 1;
|
|
var parent = heap[parentIndex];
|
|
if (compare(parent, node) > 0) {
|
|
heap[parentIndex] = node;
|
|
heap[index] = parent;
|
|
index = parentIndex;
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
function siftDown(heap, node, i) {
|
|
var index = i;
|
|
var length = heap.length;
|
|
var halfLength = length >>> 1;
|
|
while (index < halfLength) {
|
|
var leftIndex = (index + 1) * 2 - 1;
|
|
var left = heap[leftIndex];
|
|
var rightIndex = leftIndex + 1;
|
|
var right = heap[rightIndex];
|
|
if (compare(left, node) < 0) {
|
|
if (rightIndex < length && compare(right, left) < 0) {
|
|
heap[index] = right;
|
|
heap[rightIndex] = node;
|
|
index = rightIndex;
|
|
} else {
|
|
heap[index] = left;
|
|
heap[leftIndex] = node;
|
|
index = leftIndex;
|
|
}
|
|
} else if (rightIndex < length && compare(right, node) < 0) {
|
|
heap[index] = right;
|
|
heap[rightIndex] = node;
|
|
index = rightIndex;
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
function compare(a, b) {
|
|
var diff = a.sortIndex - b.sortIndex;
|
|
return diff !== 0 ? diff : a.id - b.id;
|
|
}
|
|
var ImmediatePriority = 1;
|
|
var UserBlockingPriority = 2;
|
|
var NormalPriority = 3;
|
|
var LowPriority = 4;
|
|
var IdlePriority = 5;
|
|
function markTaskErrored(task, ms) {
|
|
}
|
|
var hasPerformanceNow = typeof performance === "object" && typeof performance.now === "function";
|
|
if (hasPerformanceNow) {
|
|
var localPerformance = performance;
|
|
exports.unstable_now = function() {
|
|
return localPerformance.now();
|
|
};
|
|
} else {
|
|
var localDate = Date;
|
|
var initialTime = localDate.now();
|
|
exports.unstable_now = function() {
|
|
return localDate.now() - initialTime;
|
|
};
|
|
}
|
|
var maxSigned31BitInt = 1073741823;
|
|
var IMMEDIATE_PRIORITY_TIMEOUT = -1;
|
|
var USER_BLOCKING_PRIORITY_TIMEOUT = 250;
|
|
var NORMAL_PRIORITY_TIMEOUT = 5e3;
|
|
var LOW_PRIORITY_TIMEOUT = 1e4;
|
|
var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt;
|
|
var taskQueue = [];
|
|
var timerQueue = [];
|
|
var taskIdCounter = 1;
|
|
var currentTask = null;
|
|
var currentPriorityLevel = NormalPriority;
|
|
var isPerformingWork = false;
|
|
var isHostCallbackScheduled = false;
|
|
var isHostTimeoutScheduled = false;
|
|
var localSetTimeout = typeof setTimeout === "function" ? setTimeout : null;
|
|
var localClearTimeout = typeof clearTimeout === "function" ? clearTimeout : null;
|
|
var localSetImmediate = typeof setImmediate !== "undefined" ? setImmediate : null;
|
|
var isInputPending = typeof navigator !== "undefined" && navigator.scheduling !== void 0 && navigator.scheduling.isInputPending !== void 0 ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null;
|
|
function advanceTimers(currentTime) {
|
|
var timer = peek2(timerQueue);
|
|
while (timer !== null) {
|
|
if (timer.callback === null) {
|
|
pop(timerQueue);
|
|
} else if (timer.startTime <= currentTime) {
|
|
pop(timerQueue);
|
|
timer.sortIndex = timer.expirationTime;
|
|
push(taskQueue, timer);
|
|
} else {
|
|
return;
|
|
}
|
|
timer = peek2(timerQueue);
|
|
}
|
|
}
|
|
function handleTimeout(currentTime) {
|
|
isHostTimeoutScheduled = false;
|
|
advanceTimers(currentTime);
|
|
if (!isHostCallbackScheduled) {
|
|
if (peek2(taskQueue) !== null) {
|
|
isHostCallbackScheduled = true;
|
|
requestHostCallback(flushWork);
|
|
} else {
|
|
var firstTimer = peek2(timerQueue);
|
|
if (firstTimer !== null) {
|
|
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function flushWork(hasTimeRemaining, initialTime2) {
|
|
isHostCallbackScheduled = false;
|
|
if (isHostTimeoutScheduled) {
|
|
isHostTimeoutScheduled = false;
|
|
cancelHostTimeout();
|
|
}
|
|
isPerformingWork = true;
|
|
var previousPriorityLevel = currentPriorityLevel;
|
|
try {
|
|
if (enableProfiling) {
|
|
try {
|
|
return workLoop(hasTimeRemaining, initialTime2);
|
|
} catch (error) {
|
|
if (currentTask !== null) {
|
|
var currentTime = exports.unstable_now();
|
|
markTaskErrored(currentTask, currentTime);
|
|
currentTask.isQueued = false;
|
|
}
|
|
throw error;
|
|
}
|
|
} else {
|
|
return workLoop(hasTimeRemaining, initialTime2);
|
|
}
|
|
} finally {
|
|
currentTask = null;
|
|
currentPriorityLevel = previousPriorityLevel;
|
|
isPerformingWork = false;
|
|
}
|
|
}
|
|
function workLoop(hasTimeRemaining, initialTime2) {
|
|
var currentTime = initialTime2;
|
|
advanceTimers(currentTime);
|
|
currentTask = peek2(taskQueue);
|
|
while (currentTask !== null && !enableSchedulerDebugging) {
|
|
if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {
|
|
break;
|
|
}
|
|
var callback = currentTask.callback;
|
|
if (typeof callback === "function") {
|
|
currentTask.callback = null;
|
|
currentPriorityLevel = currentTask.priorityLevel;
|
|
var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
|
|
var continuationCallback = callback(didUserCallbackTimeout);
|
|
currentTime = exports.unstable_now();
|
|
if (typeof continuationCallback === "function") {
|
|
currentTask.callback = continuationCallback;
|
|
} else {
|
|
if (currentTask === peek2(taskQueue)) {
|
|
pop(taskQueue);
|
|
}
|
|
}
|
|
advanceTimers(currentTime);
|
|
} else {
|
|
pop(taskQueue);
|
|
}
|
|
currentTask = peek2(taskQueue);
|
|
}
|
|
if (currentTask !== null) {
|
|
return true;
|
|
} else {
|
|
var firstTimer = peek2(timerQueue);
|
|
if (firstTimer !== null) {
|
|
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
function unstable_runWithPriority(priorityLevel, eventHandler) {
|
|
switch (priorityLevel) {
|
|
case ImmediatePriority:
|
|
case UserBlockingPriority:
|
|
case NormalPriority:
|
|
case LowPriority:
|
|
case IdlePriority:
|
|
break;
|
|
default:
|
|
priorityLevel = NormalPriority;
|
|
}
|
|
var previousPriorityLevel = currentPriorityLevel;
|
|
currentPriorityLevel = priorityLevel;
|
|
try {
|
|
return eventHandler();
|
|
} finally {
|
|
currentPriorityLevel = previousPriorityLevel;
|
|
}
|
|
}
|
|
function unstable_next(eventHandler) {
|
|
var priorityLevel;
|
|
switch (currentPriorityLevel) {
|
|
case ImmediatePriority:
|
|
case UserBlockingPriority:
|
|
case NormalPriority:
|
|
priorityLevel = NormalPriority;
|
|
break;
|
|
default:
|
|
priorityLevel = currentPriorityLevel;
|
|
break;
|
|
}
|
|
var previousPriorityLevel = currentPriorityLevel;
|
|
currentPriorityLevel = priorityLevel;
|
|
try {
|
|
return eventHandler();
|
|
} finally {
|
|
currentPriorityLevel = previousPriorityLevel;
|
|
}
|
|
}
|
|
function unstable_wrapCallback(callback) {
|
|
var parentPriorityLevel = currentPriorityLevel;
|
|
return function() {
|
|
var previousPriorityLevel = currentPriorityLevel;
|
|
currentPriorityLevel = parentPriorityLevel;
|
|
try {
|
|
return callback.apply(this, arguments);
|
|
} finally {
|
|
currentPriorityLevel = previousPriorityLevel;
|
|
}
|
|
};
|
|
}
|
|
function unstable_scheduleCallback(priorityLevel, callback, options) {
|
|
var currentTime = exports.unstable_now();
|
|
var startTime2;
|
|
if (typeof options === "object" && options !== null) {
|
|
var delay = options.delay;
|
|
if (typeof delay === "number" && delay > 0) {
|
|
startTime2 = currentTime + delay;
|
|
} else {
|
|
startTime2 = currentTime;
|
|
}
|
|
} else {
|
|
startTime2 = currentTime;
|
|
}
|
|
var timeout;
|
|
switch (priorityLevel) {
|
|
case ImmediatePriority:
|
|
timeout = IMMEDIATE_PRIORITY_TIMEOUT;
|
|
break;
|
|
case UserBlockingPriority:
|
|
timeout = USER_BLOCKING_PRIORITY_TIMEOUT;
|
|
break;
|
|
case IdlePriority:
|
|
timeout = IDLE_PRIORITY_TIMEOUT;
|
|
break;
|
|
case LowPriority:
|
|
timeout = LOW_PRIORITY_TIMEOUT;
|
|
break;
|
|
case NormalPriority:
|
|
default:
|
|
timeout = NORMAL_PRIORITY_TIMEOUT;
|
|
break;
|
|
}
|
|
var expirationTime = startTime2 + timeout;
|
|
var newTask = {
|
|
id: taskIdCounter++,
|
|
callback,
|
|
priorityLevel,
|
|
startTime: startTime2,
|
|
expirationTime,
|
|
sortIndex: -1
|
|
};
|
|
if (startTime2 > currentTime) {
|
|
newTask.sortIndex = startTime2;
|
|
push(timerQueue, newTask);
|
|
if (peek2(taskQueue) === null && newTask === peek2(timerQueue)) {
|
|
if (isHostTimeoutScheduled) {
|
|
cancelHostTimeout();
|
|
} else {
|
|
isHostTimeoutScheduled = true;
|
|
}
|
|
requestHostTimeout(handleTimeout, startTime2 - currentTime);
|
|
}
|
|
} else {
|
|
newTask.sortIndex = expirationTime;
|
|
push(taskQueue, newTask);
|
|
if (!isHostCallbackScheduled && !isPerformingWork) {
|
|
isHostCallbackScheduled = true;
|
|
requestHostCallback(flushWork);
|
|
}
|
|
}
|
|
return newTask;
|
|
}
|
|
function unstable_pauseExecution() {
|
|
}
|
|
function unstable_continueExecution() {
|
|
if (!isHostCallbackScheduled && !isPerformingWork) {
|
|
isHostCallbackScheduled = true;
|
|
requestHostCallback(flushWork);
|
|
}
|
|
}
|
|
function unstable_getFirstCallbackNode() {
|
|
return peek2(taskQueue);
|
|
}
|
|
function unstable_cancelCallback(task) {
|
|
task.callback = null;
|
|
}
|
|
function unstable_getCurrentPriorityLevel() {
|
|
return currentPriorityLevel;
|
|
}
|
|
var isMessageLoopRunning = false;
|
|
var scheduledHostCallback = null;
|
|
var taskTimeoutID = -1;
|
|
var frameInterval = frameYieldMs;
|
|
var startTime = -1;
|
|
function shouldYieldToHost() {
|
|
var timeElapsed = exports.unstable_now() - startTime;
|
|
if (timeElapsed < frameInterval) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
function requestPaint() {
|
|
}
|
|
function forceFrameRate(fps) {
|
|
if (fps < 0 || fps > 125) {
|
|
console["error"]("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported");
|
|
return;
|
|
}
|
|
if (fps > 0) {
|
|
frameInterval = Math.floor(1e3 / fps);
|
|
} else {
|
|
frameInterval = frameYieldMs;
|
|
}
|
|
}
|
|
var performWorkUntilDeadline = function() {
|
|
if (scheduledHostCallback !== null) {
|
|
var currentTime = exports.unstable_now();
|
|
startTime = currentTime;
|
|
var hasTimeRemaining = true;
|
|
var hasMoreWork = true;
|
|
try {
|
|
hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime);
|
|
} finally {
|
|
if (hasMoreWork) {
|
|
schedulePerformWorkUntilDeadline();
|
|
} else {
|
|
isMessageLoopRunning = false;
|
|
scheduledHostCallback = null;
|
|
}
|
|
}
|
|
} else {
|
|
isMessageLoopRunning = false;
|
|
}
|
|
};
|
|
var schedulePerformWorkUntilDeadline;
|
|
if (typeof localSetImmediate === "function") {
|
|
schedulePerformWorkUntilDeadline = function() {
|
|
localSetImmediate(performWorkUntilDeadline);
|
|
};
|
|
} else if (typeof MessageChannel !== "undefined") {
|
|
var channel = new MessageChannel();
|
|
var port = channel.port2;
|
|
channel.port1.onmessage = performWorkUntilDeadline;
|
|
schedulePerformWorkUntilDeadline = function() {
|
|
port.postMessage(null);
|
|
};
|
|
} else {
|
|
schedulePerformWorkUntilDeadline = function() {
|
|
localSetTimeout(performWorkUntilDeadline, 0);
|
|
};
|
|
}
|
|
function requestHostCallback(callback) {
|
|
scheduledHostCallback = callback;
|
|
if (!isMessageLoopRunning) {
|
|
isMessageLoopRunning = true;
|
|
schedulePerformWorkUntilDeadline();
|
|
}
|
|
}
|
|
function requestHostTimeout(callback, ms) {
|
|
taskTimeoutID = localSetTimeout(function() {
|
|
callback(exports.unstable_now());
|
|
}, ms);
|
|
}
|
|
function cancelHostTimeout() {
|
|
localClearTimeout(taskTimeoutID);
|
|
taskTimeoutID = -1;
|
|
}
|
|
var unstable_requestPaint = requestPaint;
|
|
var unstable_Profiling = null;
|
|
exports.unstable_IdlePriority = IdlePriority;
|
|
exports.unstable_ImmediatePriority = ImmediatePriority;
|
|
exports.unstable_LowPriority = LowPriority;
|
|
exports.unstable_NormalPriority = NormalPriority;
|
|
exports.unstable_Profiling = unstable_Profiling;
|
|
exports.unstable_UserBlockingPriority = UserBlockingPriority;
|
|
exports.unstable_cancelCallback = unstable_cancelCallback;
|
|
exports.unstable_continueExecution = unstable_continueExecution;
|
|
exports.unstable_forceFrameRate = forceFrameRate;
|
|
exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel;
|
|
exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode;
|
|
exports.unstable_next = unstable_next;
|
|
exports.unstable_pauseExecution = unstable_pauseExecution;
|
|
exports.unstable_requestPaint = unstable_requestPaint;
|
|
exports.unstable_runWithPriority = unstable_runWithPriority;
|
|
exports.unstable_scheduleCallback = unstable_scheduleCallback;
|
|
exports.unstable_shouldYield = shouldYieldToHost;
|
|
exports.unstable_wrapCallback = unstable_wrapCallback;
|
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
|
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
}
|
|
})();
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/scheduler/index.js
|
|
var require_scheduler = __commonJS({
|
|
"node_modules/scheduler/index.js"(exports, module) {
|
|
"use strict";
|
|
if (false) {
|
|
module.exports = null;
|
|
} else {
|
|
module.exports = require_scheduler_development();
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/react-dom/cjs/react-dom.development.js
|
|
var require_react_dom_development = __commonJS({
|
|
"node_modules/react-dom/cjs/react-dom.development.js"(exports) {
|
|
"use strict";
|
|
if (true) {
|
|
(function() {
|
|
"use strict";
|
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
}
|
|
var React6 = require_react();
|
|
var Scheduler = require_scheduler();
|
|
var ReactSharedInternals = React6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
var suppressWarning = false;
|
|
function setSuppressWarning(newSuppressWarning) {
|
|
{
|
|
suppressWarning = newSuppressWarning;
|
|
}
|
|
}
|
|
function warn(format) {
|
|
{
|
|
if (!suppressWarning) {
|
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
args[_key - 1] = arguments[_key];
|
|
}
|
|
printWarning("warn", format, args);
|
|
}
|
|
}
|
|
}
|
|
function error(format) {
|
|
{
|
|
if (!suppressWarning) {
|
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
args[_key2 - 1] = arguments[_key2];
|
|
}
|
|
printWarning("error", format, args);
|
|
}
|
|
}
|
|
}
|
|
function printWarning(level, format, args) {
|
|
{
|
|
var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
var stack = ReactDebugCurrentFrame2.getStackAddendum();
|
|
if (stack !== "") {
|
|
format += "%s";
|
|
args = args.concat([stack]);
|
|
}
|
|
var argsWithFormat = args.map(function(item) {
|
|
return String(item);
|
|
});
|
|
argsWithFormat.unshift("Warning: " + format);
|
|
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
}
|
|
}
|
|
var FunctionComponent = 0;
|
|
var ClassComponent = 1;
|
|
var IndeterminateComponent = 2;
|
|
var HostRoot = 3;
|
|
var HostPortal = 4;
|
|
var HostComponent = 5;
|
|
var HostText = 6;
|
|
var Fragment7 = 7;
|
|
var Mode = 8;
|
|
var ContextConsumer = 9;
|
|
var ContextProvider = 10;
|
|
var ForwardRef2 = 11;
|
|
var Profiler = 12;
|
|
var SuspenseComponent = 13;
|
|
var MemoComponent = 14;
|
|
var SimpleMemoComponent = 15;
|
|
var LazyComponent = 16;
|
|
var IncompleteClassComponent = 17;
|
|
var DehydratedFragment = 18;
|
|
var SuspenseListComponent = 19;
|
|
var ScopeComponent = 21;
|
|
var OffscreenComponent = 22;
|
|
var LegacyHiddenComponent = 23;
|
|
var CacheComponent = 24;
|
|
var TracingMarkerComponent = 25;
|
|
var enableClientRenderFallbackOnTextMismatch = true;
|
|
var enableNewReconciler = false;
|
|
var enableLazyContextPropagation = false;
|
|
var enableLegacyHidden = false;
|
|
var enableSuspenseAvoidThisFallback = false;
|
|
var disableCommentsAsDOMContainers = true;
|
|
var enableCustomElementPropertySupport = false;
|
|
var warnAboutStringRefs = true;
|
|
var enableSchedulingProfiler = true;
|
|
var enableProfilerTimer = true;
|
|
var enableProfilerCommitHooks = true;
|
|
var allNativeEvents = /* @__PURE__ */ new Set();
|
|
var registrationNameDependencies = {};
|
|
var possibleRegistrationNames = {};
|
|
function registerTwoPhaseEvent(registrationName, dependencies) {
|
|
registerDirectEvent(registrationName, dependencies);
|
|
registerDirectEvent(registrationName + "Capture", dependencies);
|
|
}
|
|
function registerDirectEvent(registrationName, dependencies) {
|
|
{
|
|
if (registrationNameDependencies[registrationName]) {
|
|
error("EventRegistry: More than one plugin attempted to publish the same registration name, `%s`.", registrationName);
|
|
}
|
|
}
|
|
registrationNameDependencies[registrationName] = dependencies;
|
|
{
|
|
var lowerCasedName = registrationName.toLowerCase();
|
|
possibleRegistrationNames[lowerCasedName] = registrationName;
|
|
if (registrationName === "onDoubleClick") {
|
|
possibleRegistrationNames.ondblclick = registrationName;
|
|
}
|
|
}
|
|
for (var i = 0; i < dependencies.length; i++) {
|
|
allNativeEvents.add(dependencies[i]);
|
|
}
|
|
}
|
|
var canUseDOM2 = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
|
|
var hasOwnProperty2 = Object.prototype.hasOwnProperty;
|
|
function typeName(value) {
|
|
{
|
|
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
|
|
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
return type;
|
|
}
|
|
}
|
|
function willCoercionThrow(value) {
|
|
{
|
|
try {
|
|
testStringCoercion(value);
|
|
return false;
|
|
} catch (e) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
function testStringCoercion(value) {
|
|
return "" + value;
|
|
}
|
|
function checkAttributeStringCoercion(value, attributeName) {
|
|
{
|
|
if (willCoercionThrow(value)) {
|
|
error("The provided `%s` attribute is an unsupported type %s. This value must be coerced to a string before before using it here.", attributeName, typeName(value));
|
|
return testStringCoercion(value);
|
|
}
|
|
}
|
|
}
|
|
function checkKeyStringCoercion(value) {
|
|
{
|
|
if (willCoercionThrow(value)) {
|
|
error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
|
|
return testStringCoercion(value);
|
|
}
|
|
}
|
|
}
|
|
function checkPropStringCoercion(value, propName) {
|
|
{
|
|
if (willCoercionThrow(value)) {
|
|
error("The provided `%s` prop is an unsupported type %s. This value must be coerced to a string before before using it here.", propName, typeName(value));
|
|
return testStringCoercion(value);
|
|
}
|
|
}
|
|
}
|
|
function checkCSSPropertyStringCoercion(value, propName) {
|
|
{
|
|
if (willCoercionThrow(value)) {
|
|
error("The provided `%s` CSS property is an unsupported type %s. This value must be coerced to a string before before using it here.", propName, typeName(value));
|
|
return testStringCoercion(value);
|
|
}
|
|
}
|
|
}
|
|
function checkHtmlStringCoercion(value) {
|
|
{
|
|
if (willCoercionThrow(value)) {
|
|
error("The provided HTML markup uses a value of unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
|
|
return testStringCoercion(value);
|
|
}
|
|
}
|
|
}
|
|
function checkFormFieldValueStringCoercion(value) {
|
|
{
|
|
if (willCoercionThrow(value)) {
|
|
error("Form field values (value, checked, defaultValue, or defaultChecked props) must be strings, not %s. This value must be coerced to a string before before using it here.", typeName(value));
|
|
return testStringCoercion(value);
|
|
}
|
|
}
|
|
}
|
|
var RESERVED = 0;
|
|
var STRING = 1;
|
|
var BOOLEANISH_STRING = 2;
|
|
var BOOLEAN = 3;
|
|
var OVERLOADED_BOOLEAN = 4;
|
|
var NUMERIC = 5;
|
|
var POSITIVE_NUMERIC = 6;
|
|
var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
|
var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
|
var VALID_ATTRIBUTE_NAME_REGEX = new RegExp("^[" + ATTRIBUTE_NAME_START_CHAR + "][" + ATTRIBUTE_NAME_CHAR + "]*$");
|
|
var illegalAttributeNameCache = {};
|
|
var validatedAttributeNameCache = {};
|
|
function isAttributeNameSafe(attributeName) {
|
|
if (hasOwnProperty2.call(validatedAttributeNameCache, attributeName)) {
|
|
return true;
|
|
}
|
|
if (hasOwnProperty2.call(illegalAttributeNameCache, attributeName)) {
|
|
return false;
|
|
}
|
|
if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
|
|
validatedAttributeNameCache[attributeName] = true;
|
|
return true;
|
|
}
|
|
illegalAttributeNameCache[attributeName] = true;
|
|
{
|
|
error("Invalid attribute name: `%s`", attributeName);
|
|
}
|
|
return false;
|
|
}
|
|
function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) {
|
|
if (propertyInfo !== null) {
|
|
return propertyInfo.type === RESERVED;
|
|
}
|
|
if (isCustomComponentTag) {
|
|
return false;
|
|
}
|
|
if (name.length > 2 && (name[0] === "o" || name[0] === "O") && (name[1] === "n" || name[1] === "N")) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) {
|
|
if (propertyInfo !== null && propertyInfo.type === RESERVED) {
|
|
return false;
|
|
}
|
|
switch (typeof value) {
|
|
case "function":
|
|
case "symbol":
|
|
return true;
|
|
case "boolean": {
|
|
if (isCustomComponentTag) {
|
|
return false;
|
|
}
|
|
if (propertyInfo !== null) {
|
|
return !propertyInfo.acceptsBooleans;
|
|
} else {
|
|
var prefix2 = name.toLowerCase().slice(0, 5);
|
|
return prefix2 !== "data-" && prefix2 !== "aria-";
|
|
}
|
|
}
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) {
|
|
if (value === null || typeof value === "undefined") {
|
|
return true;
|
|
}
|
|
if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) {
|
|
return true;
|
|
}
|
|
if (isCustomComponentTag) {
|
|
return false;
|
|
}
|
|
if (propertyInfo !== null) {
|
|
switch (propertyInfo.type) {
|
|
case BOOLEAN:
|
|
return !value;
|
|
case OVERLOADED_BOOLEAN:
|
|
return value === false;
|
|
case NUMERIC:
|
|
return isNaN(value);
|
|
case POSITIVE_NUMERIC:
|
|
return isNaN(value) || value < 1;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
function getPropertyInfo(name) {
|
|
return properties.hasOwnProperty(name) ? properties[name] : null;
|
|
}
|
|
function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL2, removeEmptyString) {
|
|
this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN;
|
|
this.attributeName = attributeName;
|
|
this.attributeNamespace = attributeNamespace;
|
|
this.mustUseProperty = mustUseProperty;
|
|
this.propertyName = name;
|
|
this.type = type;
|
|
this.sanitizeURL = sanitizeURL2;
|
|
this.removeEmptyString = removeEmptyString;
|
|
}
|
|
var properties = {};
|
|
var reservedProps = [
|
|
"children",
|
|
"dangerouslySetInnerHTML",
|
|
"defaultValue",
|
|
"defaultChecked",
|
|
"innerHTML",
|
|
"suppressContentEditableWarning",
|
|
"suppressHydrationWarning",
|
|
"style"
|
|
];
|
|
reservedProps.forEach(function(name) {
|
|
properties[name] = new PropertyInfoRecord(
|
|
name,
|
|
RESERVED,
|
|
false,
|
|
name,
|
|
null,
|
|
false,
|
|
false
|
|
);
|
|
});
|
|
[["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function(_ref2) {
|
|
var name = _ref2[0], attributeName = _ref2[1];
|
|
properties[name] = new PropertyInfoRecord(
|
|
name,
|
|
STRING,
|
|
false,
|
|
attributeName,
|
|
null,
|
|
false,
|
|
false
|
|
);
|
|
});
|
|
["contentEditable", "draggable", "spellCheck", "value"].forEach(function(name) {
|
|
properties[name] = new PropertyInfoRecord(
|
|
name,
|
|
BOOLEANISH_STRING,
|
|
false,
|
|
name.toLowerCase(),
|
|
null,
|
|
false,
|
|
false
|
|
);
|
|
});
|
|
["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function(name) {
|
|
properties[name] = new PropertyInfoRecord(
|
|
name,
|
|
BOOLEANISH_STRING,
|
|
false,
|
|
name,
|
|
null,
|
|
false,
|
|
false
|
|
);
|
|
});
|
|
[
|
|
"allowFullScreen",
|
|
"async",
|
|
"autoFocus",
|
|
"autoPlay",
|
|
"controls",
|
|
"default",
|
|
"defer",
|
|
"disabled",
|
|
"disablePictureInPicture",
|
|
"disableRemotePlayback",
|
|
"formNoValidate",
|
|
"hidden",
|
|
"loop",
|
|
"noModule",
|
|
"noValidate",
|
|
"open",
|
|
"playsInline",
|
|
"readOnly",
|
|
"required",
|
|
"reversed",
|
|
"scoped",
|
|
"seamless",
|
|
"itemScope"
|
|
].forEach(function(name) {
|
|
properties[name] = new PropertyInfoRecord(
|
|
name,
|
|
BOOLEAN,
|
|
false,
|
|
name.toLowerCase(),
|
|
null,
|
|
false,
|
|
false
|
|
);
|
|
});
|
|
[
|
|
"checked",
|
|
"multiple",
|
|
"muted",
|
|
"selected"
|
|
].forEach(function(name) {
|
|
properties[name] = new PropertyInfoRecord(
|
|
name,
|
|
BOOLEAN,
|
|
true,
|
|
name,
|
|
null,
|
|
false,
|
|
false
|
|
);
|
|
});
|
|
[
|
|
"capture",
|
|
"download"
|
|
].forEach(function(name) {
|
|
properties[name] = new PropertyInfoRecord(
|
|
name,
|
|
OVERLOADED_BOOLEAN,
|
|
false,
|
|
name,
|
|
null,
|
|
false,
|
|
false
|
|
);
|
|
});
|
|
[
|
|
"cols",
|
|
"rows",
|
|
"size",
|
|
"span"
|
|
].forEach(function(name) {
|
|
properties[name] = new PropertyInfoRecord(
|
|
name,
|
|
POSITIVE_NUMERIC,
|
|
false,
|
|
name,
|
|
null,
|
|
false,
|
|
false
|
|
);
|
|
});
|
|
["rowSpan", "start"].forEach(function(name) {
|
|
properties[name] = new PropertyInfoRecord(
|
|
name,
|
|
NUMERIC,
|
|
false,
|
|
name.toLowerCase(),
|
|
null,
|
|
false,
|
|
false
|
|
);
|
|
});
|
|
var CAMELIZE = /[\-\:]([a-z])/g;
|
|
var capitalize2 = function(token) {
|
|
return token[1].toUpperCase();
|
|
};
|
|
[
|
|
"accent-height",
|
|
"alignment-baseline",
|
|
"arabic-form",
|
|
"baseline-shift",
|
|
"cap-height",
|
|
"clip-path",
|
|
"clip-rule",
|
|
"color-interpolation",
|
|
"color-interpolation-filters",
|
|
"color-profile",
|
|
"color-rendering",
|
|
"dominant-baseline",
|
|
"enable-background",
|
|
"fill-opacity",
|
|
"fill-rule",
|
|
"flood-color",
|
|
"flood-opacity",
|
|
"font-family",
|
|
"font-size",
|
|
"font-size-adjust",
|
|
"font-stretch",
|
|
"font-style",
|
|
"font-variant",
|
|
"font-weight",
|
|
"glyph-name",
|
|
"glyph-orientation-horizontal",
|
|
"glyph-orientation-vertical",
|
|
"horiz-adv-x",
|
|
"horiz-origin-x",
|
|
"image-rendering",
|
|
"letter-spacing",
|
|
"lighting-color",
|
|
"marker-end",
|
|
"marker-mid",
|
|
"marker-start",
|
|
"overline-position",
|
|
"overline-thickness",
|
|
"paint-order",
|
|
"panose-1",
|
|
"pointer-events",
|
|
"rendering-intent",
|
|
"shape-rendering",
|
|
"stop-color",
|
|
"stop-opacity",
|
|
"strikethrough-position",
|
|
"strikethrough-thickness",
|
|
"stroke-dasharray",
|
|
"stroke-dashoffset",
|
|
"stroke-linecap",
|
|
"stroke-linejoin",
|
|
"stroke-miterlimit",
|
|
"stroke-opacity",
|
|
"stroke-width",
|
|
"text-anchor",
|
|
"text-decoration",
|
|
"text-rendering",
|
|
"underline-position",
|
|
"underline-thickness",
|
|
"unicode-bidi",
|
|
"unicode-range",
|
|
"units-per-em",
|
|
"v-alphabetic",
|
|
"v-hanging",
|
|
"v-ideographic",
|
|
"v-mathematical",
|
|
"vector-effect",
|
|
"vert-adv-y",
|
|
"vert-origin-x",
|
|
"vert-origin-y",
|
|
"word-spacing",
|
|
"writing-mode",
|
|
"xmlns:xlink",
|
|
"x-height"
|
|
].forEach(function(attributeName) {
|
|
var name = attributeName.replace(CAMELIZE, capitalize2);
|
|
properties[name] = new PropertyInfoRecord(
|
|
name,
|
|
STRING,
|
|
false,
|
|
attributeName,
|
|
null,
|
|
false,
|
|
false
|
|
);
|
|
});
|
|
[
|
|
"xlink:actuate",
|
|
"xlink:arcrole",
|
|
"xlink:role",
|
|
"xlink:show",
|
|
"xlink:title",
|
|
"xlink:type"
|
|
].forEach(function(attributeName) {
|
|
var name = attributeName.replace(CAMELIZE, capitalize2);
|
|
properties[name] = new PropertyInfoRecord(
|
|
name,
|
|
STRING,
|
|
false,
|
|
attributeName,
|
|
"http://www.w3.org/1999/xlink",
|
|
false,
|
|
false
|
|
);
|
|
});
|
|
[
|
|
"xml:base",
|
|
"xml:lang",
|
|
"xml:space"
|
|
].forEach(function(attributeName) {
|
|
var name = attributeName.replace(CAMELIZE, capitalize2);
|
|
properties[name] = new PropertyInfoRecord(
|
|
name,
|
|
STRING,
|
|
false,
|
|
attributeName,
|
|
"http://www.w3.org/XML/1998/namespace",
|
|
false,
|
|
false
|
|
);
|
|
});
|
|
["tabIndex", "crossOrigin"].forEach(function(attributeName) {
|
|
properties[attributeName] = new PropertyInfoRecord(
|
|
attributeName,
|
|
STRING,
|
|
false,
|
|
attributeName.toLowerCase(),
|
|
null,
|
|
false,
|
|
false
|
|
);
|
|
});
|
|
var xlinkHref = "xlinkHref";
|
|
properties[xlinkHref] = new PropertyInfoRecord(
|
|
"xlinkHref",
|
|
STRING,
|
|
false,
|
|
"xlink:href",
|
|
"http://www.w3.org/1999/xlink",
|
|
true,
|
|
false
|
|
);
|
|
["src", "href", "action", "formAction"].forEach(function(attributeName) {
|
|
properties[attributeName] = new PropertyInfoRecord(
|
|
attributeName,
|
|
STRING,
|
|
false,
|
|
attributeName.toLowerCase(),
|
|
null,
|
|
true,
|
|
true
|
|
);
|
|
});
|
|
var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i;
|
|
var didWarn = false;
|
|
function sanitizeURL(url) {
|
|
{
|
|
if (!didWarn && isJavaScriptProtocol.test(url)) {
|
|
didWarn = true;
|
|
error("A future version of React will block javascript: URLs as a security precaution. Use event handlers instead if you can. If you need to generate unsafe HTML try using dangerouslySetInnerHTML instead. React was passed %s.", JSON.stringify(url));
|
|
}
|
|
}
|
|
}
|
|
function getValueForProperty(node, name, expected, propertyInfo) {
|
|
{
|
|
if (propertyInfo.mustUseProperty) {
|
|
var propertyName = propertyInfo.propertyName;
|
|
return node[propertyName];
|
|
} else {
|
|
{
|
|
checkAttributeStringCoercion(expected, name);
|
|
}
|
|
if (propertyInfo.sanitizeURL) {
|
|
sanitizeURL("" + expected);
|
|
}
|
|
var attributeName = propertyInfo.attributeName;
|
|
var stringValue = null;
|
|
if (propertyInfo.type === OVERLOADED_BOOLEAN) {
|
|
if (node.hasAttribute(attributeName)) {
|
|
var value = node.getAttribute(attributeName);
|
|
if (value === "") {
|
|
return true;
|
|
}
|
|
if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
|
|
return value;
|
|
}
|
|
if (value === "" + expected) {
|
|
return expected;
|
|
}
|
|
return value;
|
|
}
|
|
} else if (node.hasAttribute(attributeName)) {
|
|
if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
|
|
return node.getAttribute(attributeName);
|
|
}
|
|
if (propertyInfo.type === BOOLEAN) {
|
|
return expected;
|
|
}
|
|
stringValue = node.getAttribute(attributeName);
|
|
}
|
|
if (shouldRemoveAttribute(name, expected, propertyInfo, false)) {
|
|
return stringValue === null ? expected : stringValue;
|
|
} else if (stringValue === "" + expected) {
|
|
return expected;
|
|
} else {
|
|
return stringValue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function getValueForAttribute(node, name, expected, isCustomComponentTag) {
|
|
{
|
|
if (!isAttributeNameSafe(name)) {
|
|
return;
|
|
}
|
|
if (!node.hasAttribute(name)) {
|
|
return expected === void 0 ? void 0 : null;
|
|
}
|
|
var value = node.getAttribute(name);
|
|
{
|
|
checkAttributeStringCoercion(expected, name);
|
|
}
|
|
if (value === "" + expected) {
|
|
return expected;
|
|
}
|
|
return value;
|
|
}
|
|
}
|
|
function setValueForProperty(node, name, value, isCustomComponentTag) {
|
|
var propertyInfo = getPropertyInfo(name);
|
|
if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) {
|
|
return;
|
|
}
|
|
if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) {
|
|
value = null;
|
|
}
|
|
if (isCustomComponentTag || propertyInfo === null) {
|
|
if (isAttributeNameSafe(name)) {
|
|
var _attributeName = name;
|
|
if (value === null) {
|
|
node.removeAttribute(_attributeName);
|
|
} else {
|
|
{
|
|
checkAttributeStringCoercion(value, name);
|
|
}
|
|
node.setAttribute(_attributeName, "" + value);
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
var mustUseProperty = propertyInfo.mustUseProperty;
|
|
if (mustUseProperty) {
|
|
var propertyName = propertyInfo.propertyName;
|
|
if (value === null) {
|
|
var type = propertyInfo.type;
|
|
node[propertyName] = type === BOOLEAN ? false : "";
|
|
} else {
|
|
node[propertyName] = value;
|
|
}
|
|
return;
|
|
}
|
|
var attributeName = propertyInfo.attributeName, attributeNamespace = propertyInfo.attributeNamespace;
|
|
if (value === null) {
|
|
node.removeAttribute(attributeName);
|
|
} else {
|
|
var _type = propertyInfo.type;
|
|
var attributeValue;
|
|
if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) {
|
|
attributeValue = "";
|
|
} else {
|
|
{
|
|
{
|
|
checkAttributeStringCoercion(value, attributeName);
|
|
}
|
|
attributeValue = "" + value;
|
|
}
|
|
if (propertyInfo.sanitizeURL) {
|
|
sanitizeURL(attributeValue.toString());
|
|
}
|
|
}
|
|
if (attributeNamespace) {
|
|
node.setAttributeNS(attributeNamespace, attributeName, attributeValue);
|
|
} else {
|
|
node.setAttribute(attributeName, attributeValue);
|
|
}
|
|
}
|
|
}
|
|
var REACT_ELEMENT_TYPE2 = Symbol.for("react.element");
|
|
var REACT_PORTAL_TYPE2 = Symbol.for("react.portal");
|
|
var REACT_FRAGMENT_TYPE2 = Symbol.for("react.fragment");
|
|
var REACT_STRICT_MODE_TYPE2 = Symbol.for("react.strict_mode");
|
|
var REACT_PROFILER_TYPE2 = Symbol.for("react.profiler");
|
|
var REACT_PROVIDER_TYPE2 = Symbol.for("react.provider");
|
|
var REACT_CONTEXT_TYPE2 = Symbol.for("react.context");
|
|
var REACT_FORWARD_REF_TYPE2 = Symbol.for("react.forward_ref");
|
|
var REACT_SUSPENSE_TYPE2 = Symbol.for("react.suspense");
|
|
var REACT_SUSPENSE_LIST_TYPE2 = Symbol.for("react.suspense_list");
|
|
var REACT_MEMO_TYPE2 = Symbol.for("react.memo");
|
|
var REACT_LAZY_TYPE2 = Symbol.for("react.lazy");
|
|
var REACT_SCOPE_TYPE = Symbol.for("react.scope");
|
|
var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for("react.debug_trace_mode");
|
|
var REACT_OFFSCREEN_TYPE2 = Symbol.for("react.offscreen");
|
|
var REACT_LEGACY_HIDDEN_TYPE = Symbol.for("react.legacy_hidden");
|
|
var REACT_CACHE_TYPE = Symbol.for("react.cache");
|
|
var REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker");
|
|
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
function getIteratorFn(maybeIterable) {
|
|
if (maybeIterable === null || typeof maybeIterable !== "object") {
|
|
return null;
|
|
}
|
|
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
if (typeof maybeIterator === "function") {
|
|
return maybeIterator;
|
|
}
|
|
return null;
|
|
}
|
|
var assign2 = Object.assign;
|
|
var disabledDepth = 0;
|
|
var prevLog;
|
|
var prevInfo;
|
|
var prevWarn;
|
|
var prevError;
|
|
var prevGroup;
|
|
var prevGroupCollapsed;
|
|
var prevGroupEnd;
|
|
function disabledLog() {
|
|
}
|
|
disabledLog.__reactDisabledLog = true;
|
|
function disableLogs() {
|
|
{
|
|
if (disabledDepth === 0) {
|
|
prevLog = console.log;
|
|
prevInfo = console.info;
|
|
prevWarn = console.warn;
|
|
prevError = console.error;
|
|
prevGroup = console.group;
|
|
prevGroupCollapsed = console.groupCollapsed;
|
|
prevGroupEnd = console.groupEnd;
|
|
var props = {
|
|
configurable: true,
|
|
enumerable: true,
|
|
value: disabledLog,
|
|
writable: true
|
|
};
|
|
Object.defineProperties(console, {
|
|
info: props,
|
|
log: props,
|
|
warn: props,
|
|
error: props,
|
|
group: props,
|
|
groupCollapsed: props,
|
|
groupEnd: props
|
|
});
|
|
}
|
|
disabledDepth++;
|
|
}
|
|
}
|
|
function reenableLogs() {
|
|
{
|
|
disabledDepth--;
|
|
if (disabledDepth === 0) {
|
|
var props = {
|
|
configurable: true,
|
|
enumerable: true,
|
|
writable: true
|
|
};
|
|
Object.defineProperties(console, {
|
|
log: assign2({}, props, {
|
|
value: prevLog
|
|
}),
|
|
info: assign2({}, props, {
|
|
value: prevInfo
|
|
}),
|
|
warn: assign2({}, props, {
|
|
value: prevWarn
|
|
}),
|
|
error: assign2({}, props, {
|
|
value: prevError
|
|
}),
|
|
group: assign2({}, props, {
|
|
value: prevGroup
|
|
}),
|
|
groupCollapsed: assign2({}, props, {
|
|
value: prevGroupCollapsed
|
|
}),
|
|
groupEnd: assign2({}, props, {
|
|
value: prevGroupEnd
|
|
})
|
|
});
|
|
}
|
|
if (disabledDepth < 0) {
|
|
error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
}
|
|
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
var prefix;
|
|
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
{
|
|
if (prefix === void 0) {
|
|
try {
|
|
throw Error();
|
|
} catch (x) {
|
|
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
prefix = match && match[1] || "";
|
|
}
|
|
}
|
|
return "\n" + prefix + name;
|
|
}
|
|
}
|
|
var reentry = false;
|
|
var componentFrameCache;
|
|
{
|
|
var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
|
|
componentFrameCache = new PossiblyWeakMap();
|
|
}
|
|
function describeNativeComponentFrame(fn, construct) {
|
|
if (!fn || reentry) {
|
|
return "";
|
|
}
|
|
{
|
|
var frame = componentFrameCache.get(fn);
|
|
if (frame !== void 0) {
|
|
return frame;
|
|
}
|
|
}
|
|
var control;
|
|
reentry = true;
|
|
var previousPrepareStackTrace = Error.prepareStackTrace;
|
|
Error.prepareStackTrace = void 0;
|
|
var previousDispatcher;
|
|
{
|
|
previousDispatcher = ReactCurrentDispatcher.current;
|
|
ReactCurrentDispatcher.current = null;
|
|
disableLogs();
|
|
}
|
|
try {
|
|
if (construct) {
|
|
var Fake = function() {
|
|
throw Error();
|
|
};
|
|
Object.defineProperty(Fake.prototype, "props", {
|
|
set: function() {
|
|
throw Error();
|
|
}
|
|
});
|
|
if (typeof Reflect === "object" && Reflect.construct) {
|
|
try {
|
|
Reflect.construct(Fake, []);
|
|
} catch (x) {
|
|
control = x;
|
|
}
|
|
Reflect.construct(fn, [], Fake);
|
|
} else {
|
|
try {
|
|
Fake.call();
|
|
} catch (x) {
|
|
control = x;
|
|
}
|
|
fn.call(Fake.prototype);
|
|
}
|
|
} else {
|
|
try {
|
|
throw Error();
|
|
} catch (x) {
|
|
control = x;
|
|
}
|
|
fn();
|
|
}
|
|
} catch (sample) {
|
|
if (sample && control && typeof sample.stack === "string") {
|
|
var sampleLines = sample.stack.split("\n");
|
|
var controlLines = control.stack.split("\n");
|
|
var s = sampleLines.length - 1;
|
|
var c = controlLines.length - 1;
|
|
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
c--;
|
|
}
|
|
for (; s >= 1 && c >= 0; s--, c--) {
|
|
if (sampleLines[s] !== controlLines[c]) {
|
|
if (s !== 1 || c !== 1) {
|
|
do {
|
|
s--;
|
|
c--;
|
|
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
|
|
if (fn.displayName && _frame.includes("<anonymous>")) {
|
|
_frame = _frame.replace("<anonymous>", fn.displayName);
|
|
}
|
|
{
|
|
if (typeof fn === "function") {
|
|
componentFrameCache.set(fn, _frame);
|
|
}
|
|
}
|
|
return _frame;
|
|
}
|
|
} while (s >= 1 && c >= 0);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} finally {
|
|
reentry = false;
|
|
{
|
|
ReactCurrentDispatcher.current = previousDispatcher;
|
|
reenableLogs();
|
|
}
|
|
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
}
|
|
var name = fn ? fn.displayName || fn.name : "";
|
|
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
|
|
{
|
|
if (typeof fn === "function") {
|
|
componentFrameCache.set(fn, syntheticFrame);
|
|
}
|
|
}
|
|
return syntheticFrame;
|
|
}
|
|
function describeClassComponentFrame(ctor, source, ownerFn) {
|
|
{
|
|
return describeNativeComponentFrame(ctor, true);
|
|
}
|
|
}
|
|
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
{
|
|
return describeNativeComponentFrame(fn, false);
|
|
}
|
|
}
|
|
function shouldConstruct(Component) {
|
|
var prototype3 = Component.prototype;
|
|
return !!(prototype3 && prototype3.isReactComponent);
|
|
}
|
|
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
if (type == null) {
|
|
return "";
|
|
}
|
|
if (typeof type === "function") {
|
|
{
|
|
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
}
|
|
}
|
|
if (typeof type === "string") {
|
|
return describeBuiltInComponentFrame(type);
|
|
}
|
|
switch (type) {
|
|
case REACT_SUSPENSE_TYPE2:
|
|
return describeBuiltInComponentFrame("Suspense");
|
|
case REACT_SUSPENSE_LIST_TYPE2:
|
|
return describeBuiltInComponentFrame("SuspenseList");
|
|
}
|
|
if (typeof type === "object") {
|
|
switch (type.$$typeof) {
|
|
case REACT_FORWARD_REF_TYPE2:
|
|
return describeFunctionComponentFrame(type.render);
|
|
case REACT_MEMO_TYPE2:
|
|
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
case REACT_LAZY_TYPE2: {
|
|
var lazyComponent = type;
|
|
var payload = lazyComponent._payload;
|
|
var init = lazyComponent._init;
|
|
try {
|
|
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
} catch (x) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
function describeFiber(fiber) {
|
|
var owner = fiber._debugOwner ? fiber._debugOwner.type : null;
|
|
var source = fiber._debugSource;
|
|
switch (fiber.tag) {
|
|
case HostComponent:
|
|
return describeBuiltInComponentFrame(fiber.type);
|
|
case LazyComponent:
|
|
return describeBuiltInComponentFrame("Lazy");
|
|
case SuspenseComponent:
|
|
return describeBuiltInComponentFrame("Suspense");
|
|
case SuspenseListComponent:
|
|
return describeBuiltInComponentFrame("SuspenseList");
|
|
case FunctionComponent:
|
|
case IndeterminateComponent:
|
|
case SimpleMemoComponent:
|
|
return describeFunctionComponentFrame(fiber.type);
|
|
case ForwardRef2:
|
|
return describeFunctionComponentFrame(fiber.type.render);
|
|
case ClassComponent:
|
|
return describeClassComponentFrame(fiber.type);
|
|
default:
|
|
return "";
|
|
}
|
|
}
|
|
function getStackByFiberInDevAndProd(workInProgress2) {
|
|
try {
|
|
var info = "";
|
|
var node = workInProgress2;
|
|
do {
|
|
info += describeFiber(node);
|
|
node = node.return;
|
|
} while (node);
|
|
return info;
|
|
} catch (x) {
|
|
return "\nError generating stack: " + x.message + "\n" + x.stack;
|
|
}
|
|
}
|
|
function getWrappedName(outerType, innerType, wrapperName) {
|
|
var displayName = outerType.displayName;
|
|
if (displayName) {
|
|
return displayName;
|
|
}
|
|
var functionName = innerType.displayName || innerType.name || "";
|
|
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
}
|
|
function getContextName(type) {
|
|
return type.displayName || "Context";
|
|
}
|
|
function getComponentNameFromType(type) {
|
|
if (type == null) {
|
|
return null;
|
|
}
|
|
{
|
|
if (typeof type.tag === "number") {
|
|
error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
if (typeof type === "function") {
|
|
return type.displayName || type.name || null;
|
|
}
|
|
if (typeof type === "string") {
|
|
return type;
|
|
}
|
|
switch (type) {
|
|
case REACT_FRAGMENT_TYPE2:
|
|
return "Fragment";
|
|
case REACT_PORTAL_TYPE2:
|
|
return "Portal";
|
|
case REACT_PROFILER_TYPE2:
|
|
return "Profiler";
|
|
case REACT_STRICT_MODE_TYPE2:
|
|
return "StrictMode";
|
|
case REACT_SUSPENSE_TYPE2:
|
|
return "Suspense";
|
|
case REACT_SUSPENSE_LIST_TYPE2:
|
|
return "SuspenseList";
|
|
}
|
|
if (typeof type === "object") {
|
|
switch (type.$$typeof) {
|
|
case REACT_CONTEXT_TYPE2:
|
|
var context = type;
|
|
return getContextName(context) + ".Consumer";
|
|
case REACT_PROVIDER_TYPE2:
|
|
var provider = type;
|
|
return getContextName(provider._context) + ".Provider";
|
|
case REACT_FORWARD_REF_TYPE2:
|
|
return getWrappedName(type, type.render, "ForwardRef");
|
|
case REACT_MEMO_TYPE2:
|
|
var outerName = type.displayName || null;
|
|
if (outerName !== null) {
|
|
return outerName;
|
|
}
|
|
return getComponentNameFromType(type.type) || "Memo";
|
|
case REACT_LAZY_TYPE2: {
|
|
var lazyComponent = type;
|
|
var payload = lazyComponent._payload;
|
|
var init = lazyComponent._init;
|
|
try {
|
|
return getComponentNameFromType(init(payload));
|
|
} catch (x) {
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
function getWrappedName$1(outerType, innerType, wrapperName) {
|
|
var functionName = innerType.displayName || innerType.name || "";
|
|
return outerType.displayName || (functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName);
|
|
}
|
|
function getContextName$1(type) {
|
|
return type.displayName || "Context";
|
|
}
|
|
function getComponentNameFromFiber(fiber) {
|
|
var tag = fiber.tag, type = fiber.type;
|
|
switch (tag) {
|
|
case CacheComponent:
|
|
return "Cache";
|
|
case ContextConsumer:
|
|
var context = type;
|
|
return getContextName$1(context) + ".Consumer";
|
|
case ContextProvider:
|
|
var provider = type;
|
|
return getContextName$1(provider._context) + ".Provider";
|
|
case DehydratedFragment:
|
|
return "DehydratedFragment";
|
|
case ForwardRef2:
|
|
return getWrappedName$1(type, type.render, "ForwardRef");
|
|
case Fragment7:
|
|
return "Fragment";
|
|
case HostComponent:
|
|
return type;
|
|
case HostPortal:
|
|
return "Portal";
|
|
case HostRoot:
|
|
return "Root";
|
|
case HostText:
|
|
return "Text";
|
|
case LazyComponent:
|
|
return getComponentNameFromType(type);
|
|
case Mode:
|
|
if (type === REACT_STRICT_MODE_TYPE2) {
|
|
return "StrictMode";
|
|
}
|
|
return "Mode";
|
|
case OffscreenComponent:
|
|
return "Offscreen";
|
|
case Profiler:
|
|
return "Profiler";
|
|
case ScopeComponent:
|
|
return "Scope";
|
|
case SuspenseComponent:
|
|
return "Suspense";
|
|
case SuspenseListComponent:
|
|
return "SuspenseList";
|
|
case TracingMarkerComponent:
|
|
return "TracingMarker";
|
|
case ClassComponent:
|
|
case FunctionComponent:
|
|
case IncompleteClassComponent:
|
|
case IndeterminateComponent:
|
|
case MemoComponent:
|
|
case SimpleMemoComponent:
|
|
if (typeof type === "function") {
|
|
return type.displayName || type.name || null;
|
|
}
|
|
if (typeof type === "string") {
|
|
return type;
|
|
}
|
|
break;
|
|
}
|
|
return null;
|
|
}
|
|
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
var current2 = null;
|
|
var isRendering = false;
|
|
function getCurrentFiberOwnerNameInDevOrNull() {
|
|
{
|
|
if (current2 === null) {
|
|
return null;
|
|
}
|
|
var owner = current2._debugOwner;
|
|
if (owner !== null && typeof owner !== "undefined") {
|
|
return getComponentNameFromFiber(owner);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
function getCurrentFiberStackInDev() {
|
|
{
|
|
if (current2 === null) {
|
|
return "";
|
|
}
|
|
return getStackByFiberInDevAndProd(current2);
|
|
}
|
|
}
|
|
function resetCurrentFiber() {
|
|
{
|
|
ReactDebugCurrentFrame.getCurrentStack = null;
|
|
current2 = null;
|
|
isRendering = false;
|
|
}
|
|
}
|
|
function setCurrentFiber(fiber) {
|
|
{
|
|
ReactDebugCurrentFrame.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev;
|
|
current2 = fiber;
|
|
isRendering = false;
|
|
}
|
|
}
|
|
function getCurrentFiber() {
|
|
{
|
|
return current2;
|
|
}
|
|
}
|
|
function setIsRendering(rendering) {
|
|
{
|
|
isRendering = rendering;
|
|
}
|
|
}
|
|
function toString3(value) {
|
|
return "" + value;
|
|
}
|
|
function getToStringValue(value) {
|
|
switch (typeof value) {
|
|
case "boolean":
|
|
case "number":
|
|
case "string":
|
|
case "undefined":
|
|
return value;
|
|
case "object":
|
|
{
|
|
checkFormFieldValueStringCoercion(value);
|
|
}
|
|
return value;
|
|
default:
|
|
return "";
|
|
}
|
|
}
|
|
var hasReadOnlyValue = {
|
|
button: true,
|
|
checkbox: true,
|
|
image: true,
|
|
hidden: true,
|
|
radio: true,
|
|
reset: true,
|
|
submit: true
|
|
};
|
|
function checkControlledValueProps(tagName, props) {
|
|
{
|
|
if (!(hasReadOnlyValue[props.type] || props.onChange || props.onInput || props.readOnly || props.disabled || props.value == null)) {
|
|
error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.");
|
|
}
|
|
if (!(props.onChange || props.readOnly || props.disabled || props.checked == null)) {
|
|
error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.");
|
|
}
|
|
}
|
|
}
|
|
function isCheckable(elem) {
|
|
var type = elem.type;
|
|
var nodeName = elem.nodeName;
|
|
return nodeName && nodeName.toLowerCase() === "input" && (type === "checkbox" || type === "radio");
|
|
}
|
|
function getTracker(node) {
|
|
return node._valueTracker;
|
|
}
|
|
function detachTracker(node) {
|
|
node._valueTracker = null;
|
|
}
|
|
function getValueFromNode(node) {
|
|
var value = "";
|
|
if (!node) {
|
|
return value;
|
|
}
|
|
if (isCheckable(node)) {
|
|
value = node.checked ? "true" : "false";
|
|
} else {
|
|
value = node.value;
|
|
}
|
|
return value;
|
|
}
|
|
function trackValueOnNode(node) {
|
|
var valueField = isCheckable(node) ? "checked" : "value";
|
|
var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField);
|
|
{
|
|
checkFormFieldValueStringCoercion(node[valueField]);
|
|
}
|
|
var currentValue = "" + node[valueField];
|
|
if (node.hasOwnProperty(valueField) || typeof descriptor === "undefined" || typeof descriptor.get !== "function" || typeof descriptor.set !== "function") {
|
|
return;
|
|
}
|
|
var get3 = descriptor.get, set4 = descriptor.set;
|
|
Object.defineProperty(node, valueField, {
|
|
configurable: true,
|
|
get: function() {
|
|
return get3.call(this);
|
|
},
|
|
set: function(value) {
|
|
{
|
|
checkFormFieldValueStringCoercion(value);
|
|
}
|
|
currentValue = "" + value;
|
|
set4.call(this, value);
|
|
}
|
|
});
|
|
Object.defineProperty(node, valueField, {
|
|
enumerable: descriptor.enumerable
|
|
});
|
|
var tracker = {
|
|
getValue: function() {
|
|
return currentValue;
|
|
},
|
|
setValue: function(value) {
|
|
{
|
|
checkFormFieldValueStringCoercion(value);
|
|
}
|
|
currentValue = "" + value;
|
|
},
|
|
stopTracking: function() {
|
|
detachTracker(node);
|
|
delete node[valueField];
|
|
}
|
|
};
|
|
return tracker;
|
|
}
|
|
function track(node) {
|
|
if (getTracker(node)) {
|
|
return;
|
|
}
|
|
node._valueTracker = trackValueOnNode(node);
|
|
}
|
|
function updateValueIfChanged(node) {
|
|
if (!node) {
|
|
return false;
|
|
}
|
|
var tracker = getTracker(node);
|
|
if (!tracker) {
|
|
return true;
|
|
}
|
|
var lastValue = tracker.getValue();
|
|
var nextValue = getValueFromNode(node);
|
|
if (nextValue !== lastValue) {
|
|
tracker.setValue(nextValue);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
function getActiveElement(doc) {
|
|
doc = doc || (typeof document !== "undefined" ? document : void 0);
|
|
if (typeof doc === "undefined") {
|
|
return null;
|
|
}
|
|
try {
|
|
return doc.activeElement || doc.body;
|
|
} catch (e) {
|
|
return doc.body;
|
|
}
|
|
}
|
|
var didWarnValueDefaultValue = false;
|
|
var didWarnCheckedDefaultChecked = false;
|
|
var didWarnControlledToUncontrolled = false;
|
|
var didWarnUncontrolledToControlled = false;
|
|
function isControlled(props) {
|
|
var usesChecked = props.type === "checkbox" || props.type === "radio";
|
|
return usesChecked ? props.checked != null : props.value != null;
|
|
}
|
|
function getHostProps(element, props) {
|
|
var node = element;
|
|
var checked = props.checked;
|
|
var hostProps = assign2({}, props, {
|
|
defaultChecked: void 0,
|
|
defaultValue: void 0,
|
|
value: void 0,
|
|
checked: checked != null ? checked : node._wrapperState.initialChecked
|
|
});
|
|
return hostProps;
|
|
}
|
|
function initWrapperState(element, props) {
|
|
{
|
|
checkControlledValueProps("input", props);
|
|
if (props.checked !== void 0 && props.defaultChecked !== void 0 && !didWarnCheckedDefaultChecked) {
|
|
error("%s contains an input of type %s with both checked and defaultChecked props. Input elements must be either controlled or uncontrolled (specify either the checked prop, or the defaultChecked prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://reactjs.org/link/controlled-components", getCurrentFiberOwnerNameInDevOrNull() || "A component", props.type);
|
|
didWarnCheckedDefaultChecked = true;
|
|
}
|
|
if (props.value !== void 0 && props.defaultValue !== void 0 && !didWarnValueDefaultValue) {
|
|
error("%s contains an input of type %s with both value and defaultValue props. Input elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled input element and remove one of these props. More info: https://reactjs.org/link/controlled-components", getCurrentFiberOwnerNameInDevOrNull() || "A component", props.type);
|
|
didWarnValueDefaultValue = true;
|
|
}
|
|
}
|
|
var node = element;
|
|
var defaultValue = props.defaultValue == null ? "" : props.defaultValue;
|
|
node._wrapperState = {
|
|
initialChecked: props.checked != null ? props.checked : props.defaultChecked,
|
|
initialValue: getToStringValue(props.value != null ? props.value : defaultValue),
|
|
controlled: isControlled(props)
|
|
};
|
|
}
|
|
function updateChecked(element, props) {
|
|
var node = element;
|
|
var checked = props.checked;
|
|
if (checked != null) {
|
|
setValueForProperty(node, "checked", checked, false);
|
|
}
|
|
}
|
|
function updateWrapper(element, props) {
|
|
var node = element;
|
|
{
|
|
var controlled = isControlled(props);
|
|
if (!node._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) {
|
|
error("A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components");
|
|
didWarnUncontrolledToControlled = true;
|
|
}
|
|
if (node._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) {
|
|
error("A component is changing a controlled input to be uncontrolled. This is likely caused by the value changing from a defined to undefined, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components");
|
|
didWarnControlledToUncontrolled = true;
|
|
}
|
|
}
|
|
updateChecked(element, props);
|
|
var value = getToStringValue(props.value);
|
|
var type = props.type;
|
|
if (value != null) {
|
|
if (type === "number") {
|
|
if (value === 0 && node.value === "" || node.value != value) {
|
|
node.value = toString3(value);
|
|
}
|
|
} else if (node.value !== toString3(value)) {
|
|
node.value = toString3(value);
|
|
}
|
|
} else if (type === "submit" || type === "reset") {
|
|
node.removeAttribute("value");
|
|
return;
|
|
}
|
|
{
|
|
if (props.hasOwnProperty("value")) {
|
|
setDefaultValue(node, props.type, value);
|
|
} else if (props.hasOwnProperty("defaultValue")) {
|
|
setDefaultValue(node, props.type, getToStringValue(props.defaultValue));
|
|
}
|
|
}
|
|
{
|
|
if (props.checked == null && props.defaultChecked != null) {
|
|
node.defaultChecked = !!props.defaultChecked;
|
|
}
|
|
}
|
|
}
|
|
function postMountWrapper(element, props, isHydrating2) {
|
|
var node = element;
|
|
if (props.hasOwnProperty("value") || props.hasOwnProperty("defaultValue")) {
|
|
var type = props.type;
|
|
var isButton = type === "submit" || type === "reset";
|
|
if (isButton && (props.value === void 0 || props.value === null)) {
|
|
return;
|
|
}
|
|
var initialValue = toString3(node._wrapperState.initialValue);
|
|
if (!isHydrating2) {
|
|
{
|
|
if (initialValue !== node.value) {
|
|
node.value = initialValue;
|
|
}
|
|
}
|
|
}
|
|
{
|
|
node.defaultValue = initialValue;
|
|
}
|
|
}
|
|
var name = node.name;
|
|
if (name !== "") {
|
|
node.name = "";
|
|
}
|
|
{
|
|
node.defaultChecked = !node.defaultChecked;
|
|
node.defaultChecked = !!node._wrapperState.initialChecked;
|
|
}
|
|
if (name !== "") {
|
|
node.name = name;
|
|
}
|
|
}
|
|
function restoreControlledState(element, props) {
|
|
var node = element;
|
|
updateWrapper(node, props);
|
|
updateNamedCousins(node, props);
|
|
}
|
|
function updateNamedCousins(rootNode, props) {
|
|
var name = props.name;
|
|
if (props.type === "radio" && name != null) {
|
|
var queryRoot = rootNode;
|
|
while (queryRoot.parentNode) {
|
|
queryRoot = queryRoot.parentNode;
|
|
}
|
|
{
|
|
checkAttributeStringCoercion(name, "name");
|
|
}
|
|
var group = queryRoot.querySelectorAll("input[name=" + JSON.stringify("" + name) + '][type="radio"]');
|
|
for (var i = 0; i < group.length; i++) {
|
|
var otherNode = group[i];
|
|
if (otherNode === rootNode || otherNode.form !== rootNode.form) {
|
|
continue;
|
|
}
|
|
var otherProps = getFiberCurrentPropsFromNode(otherNode);
|
|
if (!otherProps) {
|
|
throw new Error("ReactDOMInput: Mixing React and non-React radio inputs with the same `name` is not supported.");
|
|
}
|
|
updateValueIfChanged(otherNode);
|
|
updateWrapper(otherNode, otherProps);
|
|
}
|
|
}
|
|
}
|
|
function setDefaultValue(node, type, value) {
|
|
if (type !== "number" || getActiveElement(node.ownerDocument) !== node) {
|
|
if (value == null) {
|
|
node.defaultValue = toString3(node._wrapperState.initialValue);
|
|
} else if (node.defaultValue !== toString3(value)) {
|
|
node.defaultValue = toString3(value);
|
|
}
|
|
}
|
|
}
|
|
var didWarnSelectedSetOnOption = false;
|
|
var didWarnInvalidChild = false;
|
|
var didWarnInvalidInnerHTML = false;
|
|
function validateProps(element, props) {
|
|
{
|
|
if (props.value == null) {
|
|
if (typeof props.children === "object" && props.children !== null) {
|
|
React6.Children.forEach(props.children, function(child) {
|
|
if (child == null) {
|
|
return;
|
|
}
|
|
if (typeof child === "string" || typeof child === "number") {
|
|
return;
|
|
}
|
|
if (!didWarnInvalidChild) {
|
|
didWarnInvalidChild = true;
|
|
error("Cannot infer the option value of complex children. Pass a `value` prop or use a plain string as children to <option>.");
|
|
}
|
|
});
|
|
} else if (props.dangerouslySetInnerHTML != null) {
|
|
if (!didWarnInvalidInnerHTML) {
|
|
didWarnInvalidInnerHTML = true;
|
|
error("Pass a `value` prop if you set dangerouslyInnerHTML so React knows which value should be selected.");
|
|
}
|
|
}
|
|
}
|
|
if (props.selected != null && !didWarnSelectedSetOnOption) {
|
|
error("Use the `defaultValue` or `value` props on <select> instead of setting `selected` on <option>.");
|
|
didWarnSelectedSetOnOption = true;
|
|
}
|
|
}
|
|
}
|
|
function postMountWrapper$1(element, props) {
|
|
if (props.value != null) {
|
|
element.setAttribute("value", toString3(getToStringValue(props.value)));
|
|
}
|
|
}
|
|
var isArrayImpl = Array.isArray;
|
|
function isArray2(a) {
|
|
return isArrayImpl(a);
|
|
}
|
|
var didWarnValueDefaultValue$1;
|
|
{
|
|
didWarnValueDefaultValue$1 = false;
|
|
}
|
|
function getDeclarationErrorAddendum() {
|
|
var ownerName = getCurrentFiberOwnerNameInDevOrNull();
|
|
if (ownerName) {
|
|
return "\n\nCheck the render method of `" + ownerName + "`.";
|
|
}
|
|
return "";
|
|
}
|
|
var valuePropNames = ["value", "defaultValue"];
|
|
function checkSelectPropTypes(props) {
|
|
{
|
|
checkControlledValueProps("select", props);
|
|
for (var i = 0; i < valuePropNames.length; i++) {
|
|
var propName = valuePropNames[i];
|
|
if (props[propName] == null) {
|
|
continue;
|
|
}
|
|
var propNameIsArray = isArray2(props[propName]);
|
|
if (props.multiple && !propNameIsArray) {
|
|
error("The `%s` prop supplied to <select> must be an array if `multiple` is true.%s", propName, getDeclarationErrorAddendum());
|
|
} else if (!props.multiple && propNameIsArray) {
|
|
error("The `%s` prop supplied to <select> must be a scalar value if `multiple` is false.%s", propName, getDeclarationErrorAddendum());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function updateOptions(node, multiple, propValue, setDefaultSelected) {
|
|
var options2 = node.options;
|
|
if (multiple) {
|
|
var selectedValues = propValue;
|
|
var selectedValue = {};
|
|
for (var i = 0; i < selectedValues.length; i++) {
|
|
selectedValue["$" + selectedValues[i]] = true;
|
|
}
|
|
for (var _i = 0; _i < options2.length; _i++) {
|
|
var selected = selectedValue.hasOwnProperty("$" + options2[_i].value);
|
|
if (options2[_i].selected !== selected) {
|
|
options2[_i].selected = selected;
|
|
}
|
|
if (selected && setDefaultSelected) {
|
|
options2[_i].defaultSelected = true;
|
|
}
|
|
}
|
|
} else {
|
|
var _selectedValue = toString3(getToStringValue(propValue));
|
|
var defaultSelected = null;
|
|
for (var _i2 = 0; _i2 < options2.length; _i2++) {
|
|
if (options2[_i2].value === _selectedValue) {
|
|
options2[_i2].selected = true;
|
|
if (setDefaultSelected) {
|
|
options2[_i2].defaultSelected = true;
|
|
}
|
|
return;
|
|
}
|
|
if (defaultSelected === null && !options2[_i2].disabled) {
|
|
defaultSelected = options2[_i2];
|
|
}
|
|
}
|
|
if (defaultSelected !== null) {
|
|
defaultSelected.selected = true;
|
|
}
|
|
}
|
|
}
|
|
function getHostProps$1(element, props) {
|
|
return assign2({}, props, {
|
|
value: void 0
|
|
});
|
|
}
|
|
function initWrapperState$1(element, props) {
|
|
var node = element;
|
|
{
|
|
checkSelectPropTypes(props);
|
|
}
|
|
node._wrapperState = {
|
|
wasMultiple: !!props.multiple
|
|
};
|
|
{
|
|
if (props.value !== void 0 && props.defaultValue !== void 0 && !didWarnValueDefaultValue$1) {
|
|
error("Select elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled select element and remove one of these props. More info: https://reactjs.org/link/controlled-components");
|
|
didWarnValueDefaultValue$1 = true;
|
|
}
|
|
}
|
|
}
|
|
function postMountWrapper$2(element, props) {
|
|
var node = element;
|
|
node.multiple = !!props.multiple;
|
|
var value = props.value;
|
|
if (value != null) {
|
|
updateOptions(node, !!props.multiple, value, false);
|
|
} else if (props.defaultValue != null) {
|
|
updateOptions(node, !!props.multiple, props.defaultValue, true);
|
|
}
|
|
}
|
|
function postUpdateWrapper(element, props) {
|
|
var node = element;
|
|
var wasMultiple = node._wrapperState.wasMultiple;
|
|
node._wrapperState.wasMultiple = !!props.multiple;
|
|
var value = props.value;
|
|
if (value != null) {
|
|
updateOptions(node, !!props.multiple, value, false);
|
|
} else if (wasMultiple !== !!props.multiple) {
|
|
if (props.defaultValue != null) {
|
|
updateOptions(node, !!props.multiple, props.defaultValue, true);
|
|
} else {
|
|
updateOptions(node, !!props.multiple, props.multiple ? [] : "", false);
|
|
}
|
|
}
|
|
}
|
|
function restoreControlledState$1(element, props) {
|
|
var node = element;
|
|
var value = props.value;
|
|
if (value != null) {
|
|
updateOptions(node, !!props.multiple, value, false);
|
|
}
|
|
}
|
|
var didWarnValDefaultVal = false;
|
|
function getHostProps$2(element, props) {
|
|
var node = element;
|
|
if (props.dangerouslySetInnerHTML != null) {
|
|
throw new Error("`dangerouslySetInnerHTML` does not make sense on <textarea>.");
|
|
}
|
|
var hostProps = assign2({}, props, {
|
|
value: void 0,
|
|
defaultValue: void 0,
|
|
children: toString3(node._wrapperState.initialValue)
|
|
});
|
|
return hostProps;
|
|
}
|
|
function initWrapperState$2(element, props) {
|
|
var node = element;
|
|
{
|
|
checkControlledValueProps("textarea", props);
|
|
if (props.value !== void 0 && props.defaultValue !== void 0 && !didWarnValDefaultVal) {
|
|
error("%s contains a textarea with both value and defaultValue props. Textarea elements must be either controlled or uncontrolled (specify either the value prop, or the defaultValue prop, but not both). Decide between using a controlled or uncontrolled textarea and remove one of these props. More info: https://reactjs.org/link/controlled-components", getCurrentFiberOwnerNameInDevOrNull() || "A component");
|
|
didWarnValDefaultVal = true;
|
|
}
|
|
}
|
|
var initialValue = props.value;
|
|
if (initialValue == null) {
|
|
var children = props.children, defaultValue = props.defaultValue;
|
|
if (children != null) {
|
|
{
|
|
error("Use the `defaultValue` or `value` props instead of setting children on <textarea>.");
|
|
}
|
|
{
|
|
if (defaultValue != null) {
|
|
throw new Error("If you supply `defaultValue` on a <textarea>, do not pass children.");
|
|
}
|
|
if (isArray2(children)) {
|
|
if (children.length > 1) {
|
|
throw new Error("<textarea> can only have at most one child.");
|
|
}
|
|
children = children[0];
|
|
}
|
|
defaultValue = children;
|
|
}
|
|
}
|
|
if (defaultValue == null) {
|
|
defaultValue = "";
|
|
}
|
|
initialValue = defaultValue;
|
|
}
|
|
node._wrapperState = {
|
|
initialValue: getToStringValue(initialValue)
|
|
};
|
|
}
|
|
function updateWrapper$1(element, props) {
|
|
var node = element;
|
|
var value = getToStringValue(props.value);
|
|
var defaultValue = getToStringValue(props.defaultValue);
|
|
if (value != null) {
|
|
var newValue = toString3(value);
|
|
if (newValue !== node.value) {
|
|
node.value = newValue;
|
|
}
|
|
if (props.defaultValue == null && node.defaultValue !== newValue) {
|
|
node.defaultValue = newValue;
|
|
}
|
|
}
|
|
if (defaultValue != null) {
|
|
node.defaultValue = toString3(defaultValue);
|
|
}
|
|
}
|
|
function postMountWrapper$3(element, props) {
|
|
var node = element;
|
|
var textContent = node.textContent;
|
|
if (textContent === node._wrapperState.initialValue) {
|
|
if (textContent !== "" && textContent !== null) {
|
|
node.value = textContent;
|
|
}
|
|
}
|
|
}
|
|
function restoreControlledState$2(element, props) {
|
|
updateWrapper$1(element, props);
|
|
}
|
|
var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
var MATH_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
|
|
var SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
function getIntrinsicNamespace(type) {
|
|
switch (type) {
|
|
case "svg":
|
|
return SVG_NAMESPACE;
|
|
case "math":
|
|
return MATH_NAMESPACE;
|
|
default:
|
|
return HTML_NAMESPACE;
|
|
}
|
|
}
|
|
function getChildNamespace(parentNamespace, type) {
|
|
if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) {
|
|
return getIntrinsicNamespace(type);
|
|
}
|
|
if (parentNamespace === SVG_NAMESPACE && type === "foreignObject") {
|
|
return HTML_NAMESPACE;
|
|
}
|
|
return parentNamespace;
|
|
}
|
|
var createMicrosoftUnsafeLocalFunction = function(func) {
|
|
if (typeof MSApp !== "undefined" && MSApp.execUnsafeLocalFunction) {
|
|
return function(arg0, arg1, arg2, arg3) {
|
|
MSApp.execUnsafeLocalFunction(function() {
|
|
return func(arg0, arg1, arg2, arg3);
|
|
});
|
|
};
|
|
} else {
|
|
return func;
|
|
}
|
|
};
|
|
var reusableSVGContainer;
|
|
var setInnerHTML = createMicrosoftUnsafeLocalFunction(function(node, html) {
|
|
if (node.namespaceURI === SVG_NAMESPACE) {
|
|
if (!("innerHTML" in node)) {
|
|
reusableSVGContainer = reusableSVGContainer || document.createElement("div");
|
|
reusableSVGContainer.innerHTML = "<svg>" + html.valueOf().toString() + "</svg>";
|
|
var svgNode = reusableSVGContainer.firstChild;
|
|
while (node.firstChild) {
|
|
node.removeChild(node.firstChild);
|
|
}
|
|
while (svgNode.firstChild) {
|
|
node.appendChild(svgNode.firstChild);
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
node.innerHTML = html;
|
|
});
|
|
var ELEMENT_NODE = 1;
|
|
var TEXT_NODE = 3;
|
|
var COMMENT_NODE = 8;
|
|
var DOCUMENT_NODE = 9;
|
|
var DOCUMENT_FRAGMENT_NODE = 11;
|
|
var setTextContent = function(node, text2) {
|
|
if (text2) {
|
|
var firstChild = node.firstChild;
|
|
if (firstChild && firstChild === node.lastChild && firstChild.nodeType === TEXT_NODE) {
|
|
firstChild.nodeValue = text2;
|
|
return;
|
|
}
|
|
}
|
|
node.textContent = text2;
|
|
};
|
|
var shorthandToLonghand = {
|
|
animation: ["animationDelay", "animationDirection", "animationDuration", "animationFillMode", "animationIterationCount", "animationName", "animationPlayState", "animationTimingFunction"],
|
|
background: ["backgroundAttachment", "backgroundClip", "backgroundColor", "backgroundImage", "backgroundOrigin", "backgroundPositionX", "backgroundPositionY", "backgroundRepeat", "backgroundSize"],
|
|
backgroundPosition: ["backgroundPositionX", "backgroundPositionY"],
|
|
border: ["borderBottomColor", "borderBottomStyle", "borderBottomWidth", "borderImageOutset", "borderImageRepeat", "borderImageSlice", "borderImageSource", "borderImageWidth", "borderLeftColor", "borderLeftStyle", "borderLeftWidth", "borderRightColor", "borderRightStyle", "borderRightWidth", "borderTopColor", "borderTopStyle", "borderTopWidth"],
|
|
borderBlockEnd: ["borderBlockEndColor", "borderBlockEndStyle", "borderBlockEndWidth"],
|
|
borderBlockStart: ["borderBlockStartColor", "borderBlockStartStyle", "borderBlockStartWidth"],
|
|
borderBottom: ["borderBottomColor", "borderBottomStyle", "borderBottomWidth"],
|
|
borderColor: ["borderBottomColor", "borderLeftColor", "borderRightColor", "borderTopColor"],
|
|
borderImage: ["borderImageOutset", "borderImageRepeat", "borderImageSlice", "borderImageSource", "borderImageWidth"],
|
|
borderInlineEnd: ["borderInlineEndColor", "borderInlineEndStyle", "borderInlineEndWidth"],
|
|
borderInlineStart: ["borderInlineStartColor", "borderInlineStartStyle", "borderInlineStartWidth"],
|
|
borderLeft: ["borderLeftColor", "borderLeftStyle", "borderLeftWidth"],
|
|
borderRadius: ["borderBottomLeftRadius", "borderBottomRightRadius", "borderTopLeftRadius", "borderTopRightRadius"],
|
|
borderRight: ["borderRightColor", "borderRightStyle", "borderRightWidth"],
|
|
borderStyle: ["borderBottomStyle", "borderLeftStyle", "borderRightStyle", "borderTopStyle"],
|
|
borderTop: ["borderTopColor", "borderTopStyle", "borderTopWidth"],
|
|
borderWidth: ["borderBottomWidth", "borderLeftWidth", "borderRightWidth", "borderTopWidth"],
|
|
columnRule: ["columnRuleColor", "columnRuleStyle", "columnRuleWidth"],
|
|
columns: ["columnCount", "columnWidth"],
|
|
flex: ["flexBasis", "flexGrow", "flexShrink"],
|
|
flexFlow: ["flexDirection", "flexWrap"],
|
|
font: ["fontFamily", "fontFeatureSettings", "fontKerning", "fontLanguageOverride", "fontSize", "fontSizeAdjust", "fontStretch", "fontStyle", "fontVariant", "fontVariantAlternates", "fontVariantCaps", "fontVariantEastAsian", "fontVariantLigatures", "fontVariantNumeric", "fontVariantPosition", "fontWeight", "lineHeight"],
|
|
fontVariant: ["fontVariantAlternates", "fontVariantCaps", "fontVariantEastAsian", "fontVariantLigatures", "fontVariantNumeric", "fontVariantPosition"],
|
|
gap: ["columnGap", "rowGap"],
|
|
grid: ["gridAutoColumns", "gridAutoFlow", "gridAutoRows", "gridTemplateAreas", "gridTemplateColumns", "gridTemplateRows"],
|
|
gridArea: ["gridColumnEnd", "gridColumnStart", "gridRowEnd", "gridRowStart"],
|
|
gridColumn: ["gridColumnEnd", "gridColumnStart"],
|
|
gridColumnGap: ["columnGap"],
|
|
gridGap: ["columnGap", "rowGap"],
|
|
gridRow: ["gridRowEnd", "gridRowStart"],
|
|
gridRowGap: ["rowGap"],
|
|
gridTemplate: ["gridTemplateAreas", "gridTemplateColumns", "gridTemplateRows"],
|
|
listStyle: ["listStyleImage", "listStylePosition", "listStyleType"],
|
|
margin: ["marginBottom", "marginLeft", "marginRight", "marginTop"],
|
|
marker: ["markerEnd", "markerMid", "markerStart"],
|
|
mask: ["maskClip", "maskComposite", "maskImage", "maskMode", "maskOrigin", "maskPositionX", "maskPositionY", "maskRepeat", "maskSize"],
|
|
maskPosition: ["maskPositionX", "maskPositionY"],
|
|
outline: ["outlineColor", "outlineStyle", "outlineWidth"],
|
|
overflow: ["overflowX", "overflowY"],
|
|
padding: ["paddingBottom", "paddingLeft", "paddingRight", "paddingTop"],
|
|
placeContent: ["alignContent", "justifyContent"],
|
|
placeItems: ["alignItems", "justifyItems"],
|
|
placeSelf: ["alignSelf", "justifySelf"],
|
|
textDecoration: ["textDecorationColor", "textDecorationLine", "textDecorationStyle"],
|
|
textEmphasis: ["textEmphasisColor", "textEmphasisStyle"],
|
|
transition: ["transitionDelay", "transitionDuration", "transitionProperty", "transitionTimingFunction"],
|
|
wordWrap: ["overflowWrap"]
|
|
};
|
|
var isUnitlessNumber = {
|
|
animationIterationCount: true,
|
|
aspectRatio: true,
|
|
borderImageOutset: true,
|
|
borderImageSlice: true,
|
|
borderImageWidth: true,
|
|
boxFlex: true,
|
|
boxFlexGroup: true,
|
|
boxOrdinalGroup: true,
|
|
columnCount: true,
|
|
columns: true,
|
|
flex: true,
|
|
flexGrow: true,
|
|
flexPositive: true,
|
|
flexShrink: true,
|
|
flexNegative: true,
|
|
flexOrder: true,
|
|
gridArea: true,
|
|
gridRow: true,
|
|
gridRowEnd: true,
|
|
gridRowSpan: true,
|
|
gridRowStart: true,
|
|
gridColumn: true,
|
|
gridColumnEnd: true,
|
|
gridColumnSpan: true,
|
|
gridColumnStart: true,
|
|
fontWeight: true,
|
|
lineClamp: true,
|
|
lineHeight: true,
|
|
opacity: true,
|
|
order: true,
|
|
orphans: true,
|
|
tabSize: true,
|
|
widows: true,
|
|
zIndex: true,
|
|
zoom: true,
|
|
fillOpacity: true,
|
|
floodOpacity: true,
|
|
stopOpacity: true,
|
|
strokeDasharray: true,
|
|
strokeDashoffset: true,
|
|
strokeMiterlimit: true,
|
|
strokeOpacity: true,
|
|
strokeWidth: true
|
|
};
|
|
function prefixKey(prefix2, key) {
|
|
return prefix2 + key.charAt(0).toUpperCase() + key.substring(1);
|
|
}
|
|
var prefixes2 = ["Webkit", "ms", "Moz", "O"];
|
|
Object.keys(isUnitlessNumber).forEach(function(prop) {
|
|
prefixes2.forEach(function(prefix2) {
|
|
isUnitlessNumber[prefixKey(prefix2, prop)] = isUnitlessNumber[prop];
|
|
});
|
|
});
|
|
function dangerousStyleValue(name, value, isCustomProperty) {
|
|
var isEmpty = value == null || typeof value === "boolean" || value === "";
|
|
if (isEmpty) {
|
|
return "";
|
|
}
|
|
if (!isCustomProperty && typeof value === "number" && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) {
|
|
return value + "px";
|
|
}
|
|
{
|
|
checkCSSPropertyStringCoercion(value, name);
|
|
}
|
|
return ("" + value).trim();
|
|
}
|
|
var uppercasePattern = /([A-Z])/g;
|
|
var msPattern = /^ms-/;
|
|
function hyphenateStyleName(name) {
|
|
return name.replace(uppercasePattern, "-$1").toLowerCase().replace(msPattern, "-ms-");
|
|
}
|
|
var warnValidStyle = function() {
|
|
};
|
|
{
|
|
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
|
|
var msPattern$1 = /^-ms-/;
|
|
var hyphenPattern = /-(.)/g;
|
|
var badStyleValueWithSemicolonPattern = /;\s*$/;
|
|
var warnedStyleNames = {};
|
|
var warnedStyleValues = {};
|
|
var warnedForNaNValue = false;
|
|
var warnedForInfinityValue = false;
|
|
var camelize2 = function(string) {
|
|
return string.replace(hyphenPattern, function(_, character) {
|
|
return character.toUpperCase();
|
|
});
|
|
};
|
|
var warnHyphenatedStyleName = function(name) {
|
|
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
|
return;
|
|
}
|
|
warnedStyleNames[name] = true;
|
|
error(
|
|
"Unsupported style property %s. Did you mean %s?",
|
|
name,
|
|
camelize2(name.replace(msPattern$1, "ms-"))
|
|
);
|
|
};
|
|
var warnBadVendoredStyleName = function(name) {
|
|
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
|
return;
|
|
}
|
|
warnedStyleNames[name] = true;
|
|
error("Unsupported vendor-prefixed style property %s. Did you mean %s?", name, name.charAt(0).toUpperCase() + name.slice(1));
|
|
};
|
|
var warnStyleValueWithSemicolon = function(name, value) {
|
|
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
|
|
return;
|
|
}
|
|
warnedStyleValues[value] = true;
|
|
error(`Style property values shouldn't contain a semicolon. Try "%s: %s" instead.`, name, value.replace(badStyleValueWithSemicolonPattern, ""));
|
|
};
|
|
var warnStyleValueIsNaN = function(name, value) {
|
|
if (warnedForNaNValue) {
|
|
return;
|
|
}
|
|
warnedForNaNValue = true;
|
|
error("`NaN` is an invalid value for the `%s` css style property.", name);
|
|
};
|
|
var warnStyleValueIsInfinity = function(name, value) {
|
|
if (warnedForInfinityValue) {
|
|
return;
|
|
}
|
|
warnedForInfinityValue = true;
|
|
error("`Infinity` is an invalid value for the `%s` css style property.", name);
|
|
};
|
|
warnValidStyle = function(name, value) {
|
|
if (name.indexOf("-") > -1) {
|
|
warnHyphenatedStyleName(name);
|
|
} else if (badVendoredStyleNamePattern.test(name)) {
|
|
warnBadVendoredStyleName(name);
|
|
} else if (badStyleValueWithSemicolonPattern.test(value)) {
|
|
warnStyleValueWithSemicolon(name, value);
|
|
}
|
|
if (typeof value === "number") {
|
|
if (isNaN(value)) {
|
|
warnStyleValueIsNaN(name, value);
|
|
} else if (!isFinite(value)) {
|
|
warnStyleValueIsInfinity(name, value);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
var warnValidStyle$1 = warnValidStyle;
|
|
function createDangerousStringForStyles(styles2) {
|
|
{
|
|
var serialized = "";
|
|
var delimiter = "";
|
|
for (var styleName in styles2) {
|
|
if (!styles2.hasOwnProperty(styleName)) {
|
|
continue;
|
|
}
|
|
var styleValue = styles2[styleName];
|
|
if (styleValue != null) {
|
|
var isCustomProperty = styleName.indexOf("--") === 0;
|
|
serialized += delimiter + (isCustomProperty ? styleName : hyphenateStyleName(styleName)) + ":";
|
|
serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty);
|
|
delimiter = ";";
|
|
}
|
|
}
|
|
return serialized || null;
|
|
}
|
|
}
|
|
function setValueForStyles(node, styles2) {
|
|
var style2 = node.style;
|
|
for (var styleName in styles2) {
|
|
if (!styles2.hasOwnProperty(styleName)) {
|
|
continue;
|
|
}
|
|
var isCustomProperty = styleName.indexOf("--") === 0;
|
|
{
|
|
if (!isCustomProperty) {
|
|
warnValidStyle$1(styleName, styles2[styleName]);
|
|
}
|
|
}
|
|
var styleValue = dangerousStyleValue(styleName, styles2[styleName], isCustomProperty);
|
|
if (styleName === "float") {
|
|
styleName = "cssFloat";
|
|
}
|
|
if (isCustomProperty) {
|
|
style2.setProperty(styleName, styleValue);
|
|
} else {
|
|
style2[styleName] = styleValue;
|
|
}
|
|
}
|
|
}
|
|
function isValueEmpty(value) {
|
|
return value == null || typeof value === "boolean" || value === "";
|
|
}
|
|
function expandShorthandMap(styles2) {
|
|
var expanded = {};
|
|
for (var key in styles2) {
|
|
var longhands = shorthandToLonghand[key] || [key];
|
|
for (var i = 0; i < longhands.length; i++) {
|
|
expanded[longhands[i]] = key;
|
|
}
|
|
}
|
|
return expanded;
|
|
}
|
|
function validateShorthandPropertyCollisionInDev(styleUpdates, nextStyles) {
|
|
{
|
|
if (!nextStyles) {
|
|
return;
|
|
}
|
|
var expandedUpdates = expandShorthandMap(styleUpdates);
|
|
var expandedStyles = expandShorthandMap(nextStyles);
|
|
var warnedAbout = {};
|
|
for (var key in expandedUpdates) {
|
|
var originalKey = expandedUpdates[key];
|
|
var correctOriginalKey = expandedStyles[key];
|
|
if (correctOriginalKey && originalKey !== correctOriginalKey) {
|
|
var warningKey = originalKey + "," + correctOriginalKey;
|
|
if (warnedAbout[warningKey]) {
|
|
continue;
|
|
}
|
|
warnedAbout[warningKey] = true;
|
|
error("%s a style property during rerender (%s) when a conflicting property is set (%s) can lead to styling bugs. To avoid this, don't mix shorthand and non-shorthand properties for the same value; instead, replace the shorthand with separate values.", isValueEmpty(styleUpdates[originalKey]) ? "Removing" : "Updating", originalKey, correctOriginalKey);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var omittedCloseTags = {
|
|
area: true,
|
|
base: true,
|
|
br: true,
|
|
col: true,
|
|
embed: true,
|
|
hr: true,
|
|
img: true,
|
|
input: true,
|
|
keygen: true,
|
|
link: true,
|
|
meta: true,
|
|
param: true,
|
|
source: true,
|
|
track: true,
|
|
wbr: true
|
|
};
|
|
var voidElementTags = assign2({
|
|
menuitem: true
|
|
}, omittedCloseTags);
|
|
var HTML = "__html";
|
|
function assertValidProps(tag, props) {
|
|
if (!props) {
|
|
return;
|
|
}
|
|
if (voidElementTags[tag]) {
|
|
if (props.children != null || props.dangerouslySetInnerHTML != null) {
|
|
throw new Error(tag + " is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.");
|
|
}
|
|
}
|
|
if (props.dangerouslySetInnerHTML != null) {
|
|
if (props.children != null) {
|
|
throw new Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");
|
|
}
|
|
if (typeof props.dangerouslySetInnerHTML !== "object" || !(HTML in props.dangerouslySetInnerHTML)) {
|
|
throw new Error("`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. Please visit https://reactjs.org/link/dangerously-set-inner-html for more information.");
|
|
}
|
|
}
|
|
{
|
|
if (!props.suppressContentEditableWarning && props.contentEditable && props.children != null) {
|
|
error("A component is `contentEditable` and contains `children` managed by React. It is now your responsibility to guarantee that none of those nodes are unexpectedly modified or duplicated. This is probably not intentional.");
|
|
}
|
|
}
|
|
if (props.style != null && typeof props.style !== "object") {
|
|
throw new Error("The `style` prop expects a mapping from style properties to values, not a string. For example, style={{marginRight: spacing + 'em'}} when using JSX.");
|
|
}
|
|
}
|
|
function isCustomComponent(tagName, props) {
|
|
if (tagName.indexOf("-") === -1) {
|
|
return typeof props.is === "string";
|
|
}
|
|
switch (tagName) {
|
|
case "annotation-xml":
|
|
case "color-profile":
|
|
case "font-face":
|
|
case "font-face-src":
|
|
case "font-face-uri":
|
|
case "font-face-format":
|
|
case "font-face-name":
|
|
case "missing-glyph":
|
|
return false;
|
|
default:
|
|
return true;
|
|
}
|
|
}
|
|
var possibleStandardNames = {
|
|
accept: "accept",
|
|
acceptcharset: "acceptCharset",
|
|
"accept-charset": "acceptCharset",
|
|
accesskey: "accessKey",
|
|
action: "action",
|
|
allowfullscreen: "allowFullScreen",
|
|
alt: "alt",
|
|
as: "as",
|
|
async: "async",
|
|
autocapitalize: "autoCapitalize",
|
|
autocomplete: "autoComplete",
|
|
autocorrect: "autoCorrect",
|
|
autofocus: "autoFocus",
|
|
autoplay: "autoPlay",
|
|
autosave: "autoSave",
|
|
capture: "capture",
|
|
cellpadding: "cellPadding",
|
|
cellspacing: "cellSpacing",
|
|
challenge: "challenge",
|
|
charset: "charSet",
|
|
checked: "checked",
|
|
children: "children",
|
|
cite: "cite",
|
|
class: "className",
|
|
classid: "classID",
|
|
classname: "className",
|
|
cols: "cols",
|
|
colspan: "colSpan",
|
|
content: "content",
|
|
contenteditable: "contentEditable",
|
|
contextmenu: "contextMenu",
|
|
controls: "controls",
|
|
controlslist: "controlsList",
|
|
coords: "coords",
|
|
crossorigin: "crossOrigin",
|
|
dangerouslysetinnerhtml: "dangerouslySetInnerHTML",
|
|
data: "data",
|
|
datetime: "dateTime",
|
|
default: "default",
|
|
defaultchecked: "defaultChecked",
|
|
defaultvalue: "defaultValue",
|
|
defer: "defer",
|
|
dir: "dir",
|
|
disabled: "disabled",
|
|
disablepictureinpicture: "disablePictureInPicture",
|
|
disableremoteplayback: "disableRemotePlayback",
|
|
download: "download",
|
|
draggable: "draggable",
|
|
enctype: "encType",
|
|
enterkeyhint: "enterKeyHint",
|
|
for: "htmlFor",
|
|
form: "form",
|
|
formmethod: "formMethod",
|
|
formaction: "formAction",
|
|
formenctype: "formEncType",
|
|
formnovalidate: "formNoValidate",
|
|
formtarget: "formTarget",
|
|
frameborder: "frameBorder",
|
|
headers: "headers",
|
|
height: "height",
|
|
hidden: "hidden",
|
|
high: "high",
|
|
href: "href",
|
|
hreflang: "hrefLang",
|
|
htmlfor: "htmlFor",
|
|
httpequiv: "httpEquiv",
|
|
"http-equiv": "httpEquiv",
|
|
icon: "icon",
|
|
id: "id",
|
|
imagesizes: "imageSizes",
|
|
imagesrcset: "imageSrcSet",
|
|
innerhtml: "innerHTML",
|
|
inputmode: "inputMode",
|
|
integrity: "integrity",
|
|
is: "is",
|
|
itemid: "itemID",
|
|
itemprop: "itemProp",
|
|
itemref: "itemRef",
|
|
itemscope: "itemScope",
|
|
itemtype: "itemType",
|
|
keyparams: "keyParams",
|
|
keytype: "keyType",
|
|
kind: "kind",
|
|
label: "label",
|
|
lang: "lang",
|
|
list: "list",
|
|
loop: "loop",
|
|
low: "low",
|
|
manifest: "manifest",
|
|
marginwidth: "marginWidth",
|
|
marginheight: "marginHeight",
|
|
max: "max",
|
|
maxlength: "maxLength",
|
|
media: "media",
|
|
mediagroup: "mediaGroup",
|
|
method: "method",
|
|
min: "min",
|
|
minlength: "minLength",
|
|
multiple: "multiple",
|
|
muted: "muted",
|
|
name: "name",
|
|
nomodule: "noModule",
|
|
nonce: "nonce",
|
|
novalidate: "noValidate",
|
|
open: "open",
|
|
optimum: "optimum",
|
|
pattern: "pattern",
|
|
placeholder: "placeholder",
|
|
playsinline: "playsInline",
|
|
poster: "poster",
|
|
preload: "preload",
|
|
profile: "profile",
|
|
radiogroup: "radioGroup",
|
|
readonly: "readOnly",
|
|
referrerpolicy: "referrerPolicy",
|
|
rel: "rel",
|
|
required: "required",
|
|
reversed: "reversed",
|
|
role: "role",
|
|
rows: "rows",
|
|
rowspan: "rowSpan",
|
|
sandbox: "sandbox",
|
|
scope: "scope",
|
|
scoped: "scoped",
|
|
scrolling: "scrolling",
|
|
seamless: "seamless",
|
|
selected: "selected",
|
|
shape: "shape",
|
|
size: "size",
|
|
sizes: "sizes",
|
|
span: "span",
|
|
spellcheck: "spellCheck",
|
|
src: "src",
|
|
srcdoc: "srcDoc",
|
|
srclang: "srcLang",
|
|
srcset: "srcSet",
|
|
start: "start",
|
|
step: "step",
|
|
style: "style",
|
|
summary: "summary",
|
|
tabindex: "tabIndex",
|
|
target: "target",
|
|
title: "title",
|
|
type: "type",
|
|
usemap: "useMap",
|
|
value: "value",
|
|
width: "width",
|
|
wmode: "wmode",
|
|
wrap: "wrap",
|
|
about: "about",
|
|
accentheight: "accentHeight",
|
|
"accent-height": "accentHeight",
|
|
accumulate: "accumulate",
|
|
additive: "additive",
|
|
alignmentbaseline: "alignmentBaseline",
|
|
"alignment-baseline": "alignmentBaseline",
|
|
allowreorder: "allowReorder",
|
|
alphabetic: "alphabetic",
|
|
amplitude: "amplitude",
|
|
arabicform: "arabicForm",
|
|
"arabic-form": "arabicForm",
|
|
ascent: "ascent",
|
|
attributename: "attributeName",
|
|
attributetype: "attributeType",
|
|
autoreverse: "autoReverse",
|
|
azimuth: "azimuth",
|
|
basefrequency: "baseFrequency",
|
|
baselineshift: "baselineShift",
|
|
"baseline-shift": "baselineShift",
|
|
baseprofile: "baseProfile",
|
|
bbox: "bbox",
|
|
begin: "begin",
|
|
bias: "bias",
|
|
by: "by",
|
|
calcmode: "calcMode",
|
|
capheight: "capHeight",
|
|
"cap-height": "capHeight",
|
|
clip: "clip",
|
|
clippath: "clipPath",
|
|
"clip-path": "clipPath",
|
|
clippathunits: "clipPathUnits",
|
|
cliprule: "clipRule",
|
|
"clip-rule": "clipRule",
|
|
color: "color",
|
|
colorinterpolation: "colorInterpolation",
|
|
"color-interpolation": "colorInterpolation",
|
|
colorinterpolationfilters: "colorInterpolationFilters",
|
|
"color-interpolation-filters": "colorInterpolationFilters",
|
|
colorprofile: "colorProfile",
|
|
"color-profile": "colorProfile",
|
|
colorrendering: "colorRendering",
|
|
"color-rendering": "colorRendering",
|
|
contentscripttype: "contentScriptType",
|
|
contentstyletype: "contentStyleType",
|
|
cursor: "cursor",
|
|
cx: "cx",
|
|
cy: "cy",
|
|
d: "d",
|
|
datatype: "datatype",
|
|
decelerate: "decelerate",
|
|
descent: "descent",
|
|
diffuseconstant: "diffuseConstant",
|
|
direction: "direction",
|
|
display: "display",
|
|
divisor: "divisor",
|
|
dominantbaseline: "dominantBaseline",
|
|
"dominant-baseline": "dominantBaseline",
|
|
dur: "dur",
|
|
dx: "dx",
|
|
dy: "dy",
|
|
edgemode: "edgeMode",
|
|
elevation: "elevation",
|
|
enablebackground: "enableBackground",
|
|
"enable-background": "enableBackground",
|
|
end: "end",
|
|
exponent: "exponent",
|
|
externalresourcesrequired: "externalResourcesRequired",
|
|
fill: "fill",
|
|
fillopacity: "fillOpacity",
|
|
"fill-opacity": "fillOpacity",
|
|
fillrule: "fillRule",
|
|
"fill-rule": "fillRule",
|
|
filter: "filter",
|
|
filterres: "filterRes",
|
|
filterunits: "filterUnits",
|
|
floodopacity: "floodOpacity",
|
|
"flood-opacity": "floodOpacity",
|
|
floodcolor: "floodColor",
|
|
"flood-color": "floodColor",
|
|
focusable: "focusable",
|
|
fontfamily: "fontFamily",
|
|
"font-family": "fontFamily",
|
|
fontsize: "fontSize",
|
|
"font-size": "fontSize",
|
|
fontsizeadjust: "fontSizeAdjust",
|
|
"font-size-adjust": "fontSizeAdjust",
|
|
fontstretch: "fontStretch",
|
|
"font-stretch": "fontStretch",
|
|
fontstyle: "fontStyle",
|
|
"font-style": "fontStyle",
|
|
fontvariant: "fontVariant",
|
|
"font-variant": "fontVariant",
|
|
fontweight: "fontWeight",
|
|
"font-weight": "fontWeight",
|
|
format: "format",
|
|
from: "from",
|
|
fx: "fx",
|
|
fy: "fy",
|
|
g1: "g1",
|
|
g2: "g2",
|
|
glyphname: "glyphName",
|
|
"glyph-name": "glyphName",
|
|
glyphorientationhorizontal: "glyphOrientationHorizontal",
|
|
"glyph-orientation-horizontal": "glyphOrientationHorizontal",
|
|
glyphorientationvertical: "glyphOrientationVertical",
|
|
"glyph-orientation-vertical": "glyphOrientationVertical",
|
|
glyphref: "glyphRef",
|
|
gradienttransform: "gradientTransform",
|
|
gradientunits: "gradientUnits",
|
|
hanging: "hanging",
|
|
horizadvx: "horizAdvX",
|
|
"horiz-adv-x": "horizAdvX",
|
|
horizoriginx: "horizOriginX",
|
|
"horiz-origin-x": "horizOriginX",
|
|
ideographic: "ideographic",
|
|
imagerendering: "imageRendering",
|
|
"image-rendering": "imageRendering",
|
|
in2: "in2",
|
|
in: "in",
|
|
inlist: "inlist",
|
|
intercept: "intercept",
|
|
k1: "k1",
|
|
k2: "k2",
|
|
k3: "k3",
|
|
k4: "k4",
|
|
k: "k",
|
|
kernelmatrix: "kernelMatrix",
|
|
kernelunitlength: "kernelUnitLength",
|
|
kerning: "kerning",
|
|
keypoints: "keyPoints",
|
|
keysplines: "keySplines",
|
|
keytimes: "keyTimes",
|
|
lengthadjust: "lengthAdjust",
|
|
letterspacing: "letterSpacing",
|
|
"letter-spacing": "letterSpacing",
|
|
lightingcolor: "lightingColor",
|
|
"lighting-color": "lightingColor",
|
|
limitingconeangle: "limitingConeAngle",
|
|
local: "local",
|
|
markerend: "markerEnd",
|
|
"marker-end": "markerEnd",
|
|
markerheight: "markerHeight",
|
|
markermid: "markerMid",
|
|
"marker-mid": "markerMid",
|
|
markerstart: "markerStart",
|
|
"marker-start": "markerStart",
|
|
markerunits: "markerUnits",
|
|
markerwidth: "markerWidth",
|
|
mask: "mask",
|
|
maskcontentunits: "maskContentUnits",
|
|
maskunits: "maskUnits",
|
|
mathematical: "mathematical",
|
|
mode: "mode",
|
|
numoctaves: "numOctaves",
|
|
offset: "offset",
|
|
opacity: "opacity",
|
|
operator: "operator",
|
|
order: "order",
|
|
orient: "orient",
|
|
orientation: "orientation",
|
|
origin: "origin",
|
|
overflow: "overflow",
|
|
overlineposition: "overlinePosition",
|
|
"overline-position": "overlinePosition",
|
|
overlinethickness: "overlineThickness",
|
|
"overline-thickness": "overlineThickness",
|
|
paintorder: "paintOrder",
|
|
"paint-order": "paintOrder",
|
|
panose1: "panose1",
|
|
"panose-1": "panose1",
|
|
pathlength: "pathLength",
|
|
patterncontentunits: "patternContentUnits",
|
|
patterntransform: "patternTransform",
|
|
patternunits: "patternUnits",
|
|
pointerevents: "pointerEvents",
|
|
"pointer-events": "pointerEvents",
|
|
points: "points",
|
|
pointsatx: "pointsAtX",
|
|
pointsaty: "pointsAtY",
|
|
pointsatz: "pointsAtZ",
|
|
prefix: "prefix",
|
|
preservealpha: "preserveAlpha",
|
|
preserveaspectratio: "preserveAspectRatio",
|
|
primitiveunits: "primitiveUnits",
|
|
property: "property",
|
|
r: "r",
|
|
radius: "radius",
|
|
refx: "refX",
|
|
refy: "refY",
|
|
renderingintent: "renderingIntent",
|
|
"rendering-intent": "renderingIntent",
|
|
repeatcount: "repeatCount",
|
|
repeatdur: "repeatDur",
|
|
requiredextensions: "requiredExtensions",
|
|
requiredfeatures: "requiredFeatures",
|
|
resource: "resource",
|
|
restart: "restart",
|
|
result: "result",
|
|
results: "results",
|
|
rotate: "rotate",
|
|
rx: "rx",
|
|
ry: "ry",
|
|
scale: "scale",
|
|
security: "security",
|
|
seed: "seed",
|
|
shaperendering: "shapeRendering",
|
|
"shape-rendering": "shapeRendering",
|
|
slope: "slope",
|
|
spacing: "spacing",
|
|
specularconstant: "specularConstant",
|
|
specularexponent: "specularExponent",
|
|
speed: "speed",
|
|
spreadmethod: "spreadMethod",
|
|
startoffset: "startOffset",
|
|
stddeviation: "stdDeviation",
|
|
stemh: "stemh",
|
|
stemv: "stemv",
|
|
stitchtiles: "stitchTiles",
|
|
stopcolor: "stopColor",
|
|
"stop-color": "stopColor",
|
|
stopopacity: "stopOpacity",
|
|
"stop-opacity": "stopOpacity",
|
|
strikethroughposition: "strikethroughPosition",
|
|
"strikethrough-position": "strikethroughPosition",
|
|
strikethroughthickness: "strikethroughThickness",
|
|
"strikethrough-thickness": "strikethroughThickness",
|
|
string: "string",
|
|
stroke: "stroke",
|
|
strokedasharray: "strokeDasharray",
|
|
"stroke-dasharray": "strokeDasharray",
|
|
strokedashoffset: "strokeDashoffset",
|
|
"stroke-dashoffset": "strokeDashoffset",
|
|
strokelinecap: "strokeLinecap",
|
|
"stroke-linecap": "strokeLinecap",
|
|
strokelinejoin: "strokeLinejoin",
|
|
"stroke-linejoin": "strokeLinejoin",
|
|
strokemiterlimit: "strokeMiterlimit",
|
|
"stroke-miterlimit": "strokeMiterlimit",
|
|
strokewidth: "strokeWidth",
|
|
"stroke-width": "strokeWidth",
|
|
strokeopacity: "strokeOpacity",
|
|
"stroke-opacity": "strokeOpacity",
|
|
suppresscontenteditablewarning: "suppressContentEditableWarning",
|
|
suppresshydrationwarning: "suppressHydrationWarning",
|
|
surfacescale: "surfaceScale",
|
|
systemlanguage: "systemLanguage",
|
|
tablevalues: "tableValues",
|
|
targetx: "targetX",
|
|
targety: "targetY",
|
|
textanchor: "textAnchor",
|
|
"text-anchor": "textAnchor",
|
|
textdecoration: "textDecoration",
|
|
"text-decoration": "textDecoration",
|
|
textlength: "textLength",
|
|
textrendering: "textRendering",
|
|
"text-rendering": "textRendering",
|
|
to: "to",
|
|
transform: "transform",
|
|
typeof: "typeof",
|
|
u1: "u1",
|
|
u2: "u2",
|
|
underlineposition: "underlinePosition",
|
|
"underline-position": "underlinePosition",
|
|
underlinethickness: "underlineThickness",
|
|
"underline-thickness": "underlineThickness",
|
|
unicode: "unicode",
|
|
unicodebidi: "unicodeBidi",
|
|
"unicode-bidi": "unicodeBidi",
|
|
unicoderange: "unicodeRange",
|
|
"unicode-range": "unicodeRange",
|
|
unitsperem: "unitsPerEm",
|
|
"units-per-em": "unitsPerEm",
|
|
unselectable: "unselectable",
|
|
valphabetic: "vAlphabetic",
|
|
"v-alphabetic": "vAlphabetic",
|
|
values: "values",
|
|
vectoreffect: "vectorEffect",
|
|
"vector-effect": "vectorEffect",
|
|
version: "version",
|
|
vertadvy: "vertAdvY",
|
|
"vert-adv-y": "vertAdvY",
|
|
vertoriginx: "vertOriginX",
|
|
"vert-origin-x": "vertOriginX",
|
|
vertoriginy: "vertOriginY",
|
|
"vert-origin-y": "vertOriginY",
|
|
vhanging: "vHanging",
|
|
"v-hanging": "vHanging",
|
|
videographic: "vIdeographic",
|
|
"v-ideographic": "vIdeographic",
|
|
viewbox: "viewBox",
|
|
viewtarget: "viewTarget",
|
|
visibility: "visibility",
|
|
vmathematical: "vMathematical",
|
|
"v-mathematical": "vMathematical",
|
|
vocab: "vocab",
|
|
widths: "widths",
|
|
wordspacing: "wordSpacing",
|
|
"word-spacing": "wordSpacing",
|
|
writingmode: "writingMode",
|
|
"writing-mode": "writingMode",
|
|
x1: "x1",
|
|
x2: "x2",
|
|
x: "x",
|
|
xchannelselector: "xChannelSelector",
|
|
xheight: "xHeight",
|
|
"x-height": "xHeight",
|
|
xlinkactuate: "xlinkActuate",
|
|
"xlink:actuate": "xlinkActuate",
|
|
xlinkarcrole: "xlinkArcrole",
|
|
"xlink:arcrole": "xlinkArcrole",
|
|
xlinkhref: "xlinkHref",
|
|
"xlink:href": "xlinkHref",
|
|
xlinkrole: "xlinkRole",
|
|
"xlink:role": "xlinkRole",
|
|
xlinkshow: "xlinkShow",
|
|
"xlink:show": "xlinkShow",
|
|
xlinktitle: "xlinkTitle",
|
|
"xlink:title": "xlinkTitle",
|
|
xlinktype: "xlinkType",
|
|
"xlink:type": "xlinkType",
|
|
xmlbase: "xmlBase",
|
|
"xml:base": "xmlBase",
|
|
xmllang: "xmlLang",
|
|
"xml:lang": "xmlLang",
|
|
xmlns: "xmlns",
|
|
"xml:space": "xmlSpace",
|
|
xmlnsxlink: "xmlnsXlink",
|
|
"xmlns:xlink": "xmlnsXlink",
|
|
xmlspace: "xmlSpace",
|
|
y1: "y1",
|
|
y2: "y2",
|
|
y: "y",
|
|
ychannelselector: "yChannelSelector",
|
|
z: "z",
|
|
zoomandpan: "zoomAndPan"
|
|
};
|
|
var ariaProperties = {
|
|
"aria-current": 0,
|
|
"aria-description": 0,
|
|
"aria-details": 0,
|
|
"aria-disabled": 0,
|
|
"aria-hidden": 0,
|
|
"aria-invalid": 0,
|
|
"aria-keyshortcuts": 0,
|
|
"aria-label": 0,
|
|
"aria-roledescription": 0,
|
|
"aria-autocomplete": 0,
|
|
"aria-checked": 0,
|
|
"aria-expanded": 0,
|
|
"aria-haspopup": 0,
|
|
"aria-level": 0,
|
|
"aria-modal": 0,
|
|
"aria-multiline": 0,
|
|
"aria-multiselectable": 0,
|
|
"aria-orientation": 0,
|
|
"aria-placeholder": 0,
|
|
"aria-pressed": 0,
|
|
"aria-readonly": 0,
|
|
"aria-required": 0,
|
|
"aria-selected": 0,
|
|
"aria-sort": 0,
|
|
"aria-valuemax": 0,
|
|
"aria-valuemin": 0,
|
|
"aria-valuenow": 0,
|
|
"aria-valuetext": 0,
|
|
"aria-atomic": 0,
|
|
"aria-busy": 0,
|
|
"aria-live": 0,
|
|
"aria-relevant": 0,
|
|
"aria-dropeffect": 0,
|
|
"aria-grabbed": 0,
|
|
"aria-activedescendant": 0,
|
|
"aria-colcount": 0,
|
|
"aria-colindex": 0,
|
|
"aria-colspan": 0,
|
|
"aria-controls": 0,
|
|
"aria-describedby": 0,
|
|
"aria-errormessage": 0,
|
|
"aria-flowto": 0,
|
|
"aria-labelledby": 0,
|
|
"aria-owns": 0,
|
|
"aria-posinset": 0,
|
|
"aria-rowcount": 0,
|
|
"aria-rowindex": 0,
|
|
"aria-rowspan": 0,
|
|
"aria-setsize": 0
|
|
};
|
|
var warnedProperties = {};
|
|
var rARIA = new RegExp("^(aria)-[" + ATTRIBUTE_NAME_CHAR + "]*$");
|
|
var rARIACamel = new RegExp("^(aria)[A-Z][" + ATTRIBUTE_NAME_CHAR + "]*$");
|
|
function validateProperty(tagName, name) {
|
|
{
|
|
if (hasOwnProperty2.call(warnedProperties, name) && warnedProperties[name]) {
|
|
return true;
|
|
}
|
|
if (rARIACamel.test(name)) {
|
|
var ariaName = "aria-" + name.slice(4).toLowerCase();
|
|
var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null;
|
|
if (correctName == null) {
|
|
error("Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.", name);
|
|
warnedProperties[name] = true;
|
|
return true;
|
|
}
|
|
if (name !== correctName) {
|
|
error("Invalid ARIA attribute `%s`. Did you mean `%s`?", name, correctName);
|
|
warnedProperties[name] = true;
|
|
return true;
|
|
}
|
|
}
|
|
if (rARIA.test(name)) {
|
|
var lowerCasedName = name.toLowerCase();
|
|
var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null;
|
|
if (standardName == null) {
|
|
warnedProperties[name] = true;
|
|
return false;
|
|
}
|
|
if (name !== standardName) {
|
|
error("Unknown ARIA attribute `%s`. Did you mean `%s`?", name, standardName);
|
|
warnedProperties[name] = true;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
function warnInvalidARIAProps(type, props) {
|
|
{
|
|
var invalidProps = [];
|
|
for (var key in props) {
|
|
var isValid = validateProperty(type, key);
|
|
if (!isValid) {
|
|
invalidProps.push(key);
|
|
}
|
|
}
|
|
var unknownPropString = invalidProps.map(function(prop) {
|
|
return "`" + prop + "`";
|
|
}).join(", ");
|
|
if (invalidProps.length === 1) {
|
|
error("Invalid aria prop %s on <%s> tag. For details, see https://reactjs.org/link/invalid-aria-props", unknownPropString, type);
|
|
} else if (invalidProps.length > 1) {
|
|
error("Invalid aria props %s on <%s> tag. For details, see https://reactjs.org/link/invalid-aria-props", unknownPropString, type);
|
|
}
|
|
}
|
|
}
|
|
function validateProperties(type, props) {
|
|
if (isCustomComponent(type, props)) {
|
|
return;
|
|
}
|
|
warnInvalidARIAProps(type, props);
|
|
}
|
|
var didWarnValueNull = false;
|
|
function validateProperties$1(type, props) {
|
|
{
|
|
if (type !== "input" && type !== "textarea" && type !== "select") {
|
|
return;
|
|
}
|
|
if (props != null && props.value === null && !didWarnValueNull) {
|
|
didWarnValueNull = true;
|
|
if (type === "select" && props.multiple) {
|
|
error("`value` prop on `%s` should not be null. Consider using an empty array when `multiple` is set to `true` to clear the component or `undefined` for uncontrolled components.", type);
|
|
} else {
|
|
error("`value` prop on `%s` should not be null. Consider using an empty string to clear the component or `undefined` for uncontrolled components.", type);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var validateProperty$1 = function() {
|
|
};
|
|
{
|
|
var warnedProperties$1 = {};
|
|
var EVENT_NAME_REGEX = /^on./;
|
|
var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/;
|
|
var rARIA$1 = new RegExp("^(aria)-[" + ATTRIBUTE_NAME_CHAR + "]*$");
|
|
var rARIACamel$1 = new RegExp("^(aria)[A-Z][" + ATTRIBUTE_NAME_CHAR + "]*$");
|
|
validateProperty$1 = function(tagName, name, value, eventRegistry) {
|
|
if (hasOwnProperty2.call(warnedProperties$1, name) && warnedProperties$1[name]) {
|
|
return true;
|
|
}
|
|
var lowerCasedName = name.toLowerCase();
|
|
if (lowerCasedName === "onfocusin" || lowerCasedName === "onfocusout") {
|
|
error("React uses onFocus and onBlur instead of onFocusIn and onFocusOut. All React events are normalized to bubble, so onFocusIn and onFocusOut are not needed/supported by React.");
|
|
warnedProperties$1[name] = true;
|
|
return true;
|
|
}
|
|
if (eventRegistry != null) {
|
|
var registrationNameDependencies2 = eventRegistry.registrationNameDependencies, possibleRegistrationNames2 = eventRegistry.possibleRegistrationNames;
|
|
if (registrationNameDependencies2.hasOwnProperty(name)) {
|
|
return true;
|
|
}
|
|
var registrationName = possibleRegistrationNames2.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames2[lowerCasedName] : null;
|
|
if (registrationName != null) {
|
|
error("Invalid event handler property `%s`. Did you mean `%s`?", name, registrationName);
|
|
warnedProperties$1[name] = true;
|
|
return true;
|
|
}
|
|
if (EVENT_NAME_REGEX.test(name)) {
|
|
error("Unknown event handler property `%s`. It will be ignored.", name);
|
|
warnedProperties$1[name] = true;
|
|
return true;
|
|
}
|
|
} else if (EVENT_NAME_REGEX.test(name)) {
|
|
if (INVALID_EVENT_NAME_REGEX.test(name)) {
|
|
error("Invalid event handler property `%s`. React events use the camelCase naming convention, for example `onClick`.", name);
|
|
}
|
|
warnedProperties$1[name] = true;
|
|
return true;
|
|
}
|
|
if (rARIA$1.test(name) || rARIACamel$1.test(name)) {
|
|
return true;
|
|
}
|
|
if (lowerCasedName === "innerhtml") {
|
|
error("Directly setting property `innerHTML` is not permitted. For more information, lookup documentation on `dangerouslySetInnerHTML`.");
|
|
warnedProperties$1[name] = true;
|
|
return true;
|
|
}
|
|
if (lowerCasedName === "aria") {
|
|
error("The `aria` attribute is reserved for future use in React. Pass individual `aria-` attributes instead.");
|
|
warnedProperties$1[name] = true;
|
|
return true;
|
|
}
|
|
if (lowerCasedName === "is" && value !== null && value !== void 0 && typeof value !== "string") {
|
|
error("Received a `%s` for a string attribute `is`. If this is expected, cast the value to a string.", typeof value);
|
|
warnedProperties$1[name] = true;
|
|
return true;
|
|
}
|
|
if (typeof value === "number" && isNaN(value)) {
|
|
error("Received NaN for the `%s` attribute. If this is expected, cast the value to a string.", name);
|
|
warnedProperties$1[name] = true;
|
|
return true;
|
|
}
|
|
var propertyInfo = getPropertyInfo(name);
|
|
var isReserved2 = propertyInfo !== null && propertyInfo.type === RESERVED;
|
|
if (possibleStandardNames.hasOwnProperty(lowerCasedName)) {
|
|
var standardName = possibleStandardNames[lowerCasedName];
|
|
if (standardName !== name) {
|
|
error("Invalid DOM property `%s`. Did you mean `%s`?", name, standardName);
|
|
warnedProperties$1[name] = true;
|
|
return true;
|
|
}
|
|
} else if (!isReserved2 && name !== lowerCasedName) {
|
|
error("React does not recognize the `%s` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `%s` instead. If you accidentally passed it from a parent component, remove it from the DOM element.", name, lowerCasedName);
|
|
warnedProperties$1[name] = true;
|
|
return true;
|
|
}
|
|
if (typeof value === "boolean" && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
|
|
if (value) {
|
|
error('Received `%s` for a non-boolean attribute `%s`.\n\nIf you want to write it to the DOM, pass a string instead: %s="%s" or %s={value.toString()}.', value, name, name, value, name);
|
|
} else {
|
|
error('Received `%s` for a non-boolean attribute `%s`.\n\nIf you want to write it to the DOM, pass a string instead: %s="%s" or %s={value.toString()}.\n\nIf you used to conditionally omit it with %s={condition && value}, pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name);
|
|
}
|
|
warnedProperties$1[name] = true;
|
|
return true;
|
|
}
|
|
if (isReserved2) {
|
|
return true;
|
|
}
|
|
if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) {
|
|
warnedProperties$1[name] = true;
|
|
return false;
|
|
}
|
|
if ((value === "false" || value === "true") && propertyInfo !== null && propertyInfo.type === BOOLEAN) {
|
|
error("Received the string `%s` for the boolean attribute `%s`. %s Did you mean %s={%s}?", value, name, value === "false" ? "The browser will interpret it as a truthy value." : 'Although this works, it will not work as expected if you pass the string "false".', name, value);
|
|
warnedProperties$1[name] = true;
|
|
return true;
|
|
}
|
|
return true;
|
|
};
|
|
}
|
|
var warnUnknownProperties = function(type, props, eventRegistry) {
|
|
{
|
|
var unknownProps = [];
|
|
for (var key in props) {
|
|
var isValid = validateProperty$1(type, key, props[key], eventRegistry);
|
|
if (!isValid) {
|
|
unknownProps.push(key);
|
|
}
|
|
}
|
|
var unknownPropString = unknownProps.map(function(prop) {
|
|
return "`" + prop + "`";
|
|
}).join(", ");
|
|
if (unknownProps.length === 1) {
|
|
error("Invalid value for prop %s on <%s> tag. Either remove it from the element, or pass a string or number value to keep it in the DOM. For details, see https://reactjs.org/link/attribute-behavior ", unknownPropString, type);
|
|
} else if (unknownProps.length > 1) {
|
|
error("Invalid values for props %s on <%s> tag. Either remove them from the element, or pass a string or number value to keep them in the DOM. For details, see https://reactjs.org/link/attribute-behavior ", unknownPropString, type);
|
|
}
|
|
}
|
|
};
|
|
function validateProperties$2(type, props, eventRegistry) {
|
|
if (isCustomComponent(type, props)) {
|
|
return;
|
|
}
|
|
warnUnknownProperties(type, props, eventRegistry);
|
|
}
|
|
var IS_EVENT_HANDLE_NON_MANAGED_NODE = 1;
|
|
var IS_NON_DELEGATED = 1 << 1;
|
|
var IS_CAPTURE_PHASE = 1 << 2;
|
|
var SHOULD_NOT_PROCESS_POLYFILL_EVENT_PLUGINS = IS_EVENT_HANDLE_NON_MANAGED_NODE | IS_NON_DELEGATED | IS_CAPTURE_PHASE;
|
|
var currentReplayingEvent = null;
|
|
function setReplayingEvent(event) {
|
|
{
|
|
if (currentReplayingEvent !== null) {
|
|
error("Expected currently replaying event to be null. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
currentReplayingEvent = event;
|
|
}
|
|
function resetReplayingEvent() {
|
|
{
|
|
if (currentReplayingEvent === null) {
|
|
error("Expected currently replaying event to not be null. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
currentReplayingEvent = null;
|
|
}
|
|
function isReplayingEvent(event) {
|
|
return event === currentReplayingEvent;
|
|
}
|
|
function getEventTarget(nativeEvent) {
|
|
var target = nativeEvent.target || nativeEvent.srcElement || window;
|
|
if (target.correspondingUseElement) {
|
|
target = target.correspondingUseElement;
|
|
}
|
|
return target.nodeType === TEXT_NODE ? target.parentNode : target;
|
|
}
|
|
var restoreImpl = null;
|
|
var restoreTarget = null;
|
|
var restoreQueue = null;
|
|
function restoreStateOfTarget(target) {
|
|
var internalInstance = getInstanceFromNode(target);
|
|
if (!internalInstance) {
|
|
return;
|
|
}
|
|
if (typeof restoreImpl !== "function") {
|
|
throw new Error("setRestoreImplementation() needs to be called to handle a target for controlled events. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
var stateNode = internalInstance.stateNode;
|
|
if (stateNode) {
|
|
var _props = getFiberCurrentPropsFromNode(stateNode);
|
|
restoreImpl(internalInstance.stateNode, internalInstance.type, _props);
|
|
}
|
|
}
|
|
function setRestoreImplementation(impl) {
|
|
restoreImpl = impl;
|
|
}
|
|
function enqueueStateRestore(target) {
|
|
if (restoreTarget) {
|
|
if (restoreQueue) {
|
|
restoreQueue.push(target);
|
|
} else {
|
|
restoreQueue = [target];
|
|
}
|
|
} else {
|
|
restoreTarget = target;
|
|
}
|
|
}
|
|
function needsStateRestore() {
|
|
return restoreTarget !== null || restoreQueue !== null;
|
|
}
|
|
function restoreStateIfNeeded() {
|
|
if (!restoreTarget) {
|
|
return;
|
|
}
|
|
var target = restoreTarget;
|
|
var queuedTargets = restoreQueue;
|
|
restoreTarget = null;
|
|
restoreQueue = null;
|
|
restoreStateOfTarget(target);
|
|
if (queuedTargets) {
|
|
for (var i = 0; i < queuedTargets.length; i++) {
|
|
restoreStateOfTarget(queuedTargets[i]);
|
|
}
|
|
}
|
|
}
|
|
var batchedUpdatesImpl = function(fn, bookkeeping) {
|
|
return fn(bookkeeping);
|
|
};
|
|
var flushSyncImpl = function() {
|
|
};
|
|
var isInsideEventHandler = false;
|
|
function finishEventHandler() {
|
|
var controlledComponentsHavePendingUpdates = needsStateRestore();
|
|
if (controlledComponentsHavePendingUpdates) {
|
|
flushSyncImpl();
|
|
restoreStateIfNeeded();
|
|
}
|
|
}
|
|
function batchedUpdates(fn, a, b) {
|
|
if (isInsideEventHandler) {
|
|
return fn(a, b);
|
|
}
|
|
isInsideEventHandler = true;
|
|
try {
|
|
return batchedUpdatesImpl(fn, a, b);
|
|
} finally {
|
|
isInsideEventHandler = false;
|
|
finishEventHandler();
|
|
}
|
|
}
|
|
function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushSyncImpl) {
|
|
batchedUpdatesImpl = _batchedUpdatesImpl;
|
|
flushSyncImpl = _flushSyncImpl;
|
|
}
|
|
function isInteractive(tag) {
|
|
return tag === "button" || tag === "input" || tag === "select" || tag === "textarea";
|
|
}
|
|
function shouldPreventMouseEvent(name, type, props) {
|
|
switch (name) {
|
|
case "onClick":
|
|
case "onClickCapture":
|
|
case "onDoubleClick":
|
|
case "onDoubleClickCapture":
|
|
case "onMouseDown":
|
|
case "onMouseDownCapture":
|
|
case "onMouseMove":
|
|
case "onMouseMoveCapture":
|
|
case "onMouseUp":
|
|
case "onMouseUpCapture":
|
|
case "onMouseEnter":
|
|
return !!(props.disabled && isInteractive(type));
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
function getListener(inst, registrationName) {
|
|
var stateNode = inst.stateNode;
|
|
if (stateNode === null) {
|
|
return null;
|
|
}
|
|
var props = getFiberCurrentPropsFromNode(stateNode);
|
|
if (props === null) {
|
|
return null;
|
|
}
|
|
var listener4 = props[registrationName];
|
|
if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
|
|
return null;
|
|
}
|
|
if (listener4 && typeof listener4 !== "function") {
|
|
throw new Error("Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener4 + "` type.");
|
|
}
|
|
return listener4;
|
|
}
|
|
var passiveBrowserEventsSupported = false;
|
|
if (canUseDOM2) {
|
|
try {
|
|
var options = {};
|
|
Object.defineProperty(options, "passive", {
|
|
get: function() {
|
|
passiveBrowserEventsSupported = true;
|
|
}
|
|
});
|
|
window.addEventListener("test", options, options);
|
|
window.removeEventListener("test", options, options);
|
|
} catch (e) {
|
|
passiveBrowserEventsSupported = false;
|
|
}
|
|
}
|
|
function invokeGuardedCallbackProd(name, func, context, a, b, c, d2, e, f) {
|
|
var funcArgs = Array.prototype.slice.call(arguments, 3);
|
|
try {
|
|
func.apply(context, funcArgs);
|
|
} catch (error2) {
|
|
this.onError(error2);
|
|
}
|
|
}
|
|
var invokeGuardedCallbackImpl = invokeGuardedCallbackProd;
|
|
{
|
|
if (typeof window !== "undefined" && typeof window.dispatchEvent === "function" && typeof document !== "undefined" && typeof document.createEvent === "function") {
|
|
var fakeNode = document.createElement("react");
|
|
invokeGuardedCallbackImpl = function invokeGuardedCallbackDev(name, func, context, a, b, c, d2, e, f) {
|
|
if (typeof document === "undefined" || document === null) {
|
|
throw new Error("The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.");
|
|
}
|
|
var evt = document.createEvent("Event");
|
|
var didCall = false;
|
|
var didError = true;
|
|
var windowEvent = window.event;
|
|
var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, "event");
|
|
function restoreAfterDispatch() {
|
|
fakeNode.removeEventListener(evtType, callCallback2, false);
|
|
if (typeof window.event !== "undefined" && window.hasOwnProperty("event")) {
|
|
window.event = windowEvent;
|
|
}
|
|
}
|
|
var funcArgs = Array.prototype.slice.call(arguments, 3);
|
|
function callCallback2() {
|
|
didCall = true;
|
|
restoreAfterDispatch();
|
|
func.apply(context, funcArgs);
|
|
didError = false;
|
|
}
|
|
var error2;
|
|
var didSetError = false;
|
|
var isCrossOriginError = false;
|
|
function handleWindowError(event) {
|
|
error2 = event.error;
|
|
didSetError = true;
|
|
if (error2 === null && event.colno === 0 && event.lineno === 0) {
|
|
isCrossOriginError = true;
|
|
}
|
|
if (event.defaultPrevented) {
|
|
if (error2 != null && typeof error2 === "object") {
|
|
try {
|
|
error2._suppressLogging = true;
|
|
} catch (inner) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var evtType = "react-" + (name ? name : "invokeguardedcallback");
|
|
window.addEventListener("error", handleWindowError);
|
|
fakeNode.addEventListener(evtType, callCallback2, false);
|
|
evt.initEvent(evtType, false, false);
|
|
fakeNode.dispatchEvent(evt);
|
|
if (windowEventDescriptor) {
|
|
Object.defineProperty(window, "event", windowEventDescriptor);
|
|
}
|
|
if (didCall && didError) {
|
|
if (!didSetError) {
|
|
error2 = new Error(`An error was thrown inside one of your components, but React doesn't know what it was. This is likely due to browser flakiness. React does its best to preserve the "Pause on exceptions" behavior of the DevTools, which requires some DEV-mode only tricks. It's possible that these don't work in your browser. Try triggering the error in production mode, or switching to a modern browser. If you suspect that this is actually an issue with React, please file an issue.`);
|
|
} else if (isCrossOriginError) {
|
|
error2 = new Error("A cross-origin error was thrown. React doesn't have access to the actual error object in development. See https://reactjs.org/link/crossorigin-error for more information.");
|
|
}
|
|
this.onError(error2);
|
|
}
|
|
window.removeEventListener("error", handleWindowError);
|
|
if (!didCall) {
|
|
restoreAfterDispatch();
|
|
return invokeGuardedCallbackProd.apply(this, arguments);
|
|
}
|
|
};
|
|
}
|
|
}
|
|
var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl;
|
|
var hasError = false;
|
|
var caughtError = null;
|
|
var hasRethrowError = false;
|
|
var rethrowError = null;
|
|
var reporter = {
|
|
onError: function(error2) {
|
|
hasError = true;
|
|
caughtError = error2;
|
|
}
|
|
};
|
|
function invokeGuardedCallback(name, func, context, a, b, c, d2, e, f) {
|
|
hasError = false;
|
|
caughtError = null;
|
|
invokeGuardedCallbackImpl$1.apply(reporter, arguments);
|
|
}
|
|
function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d2, e, f) {
|
|
invokeGuardedCallback.apply(this, arguments);
|
|
if (hasError) {
|
|
var error2 = clearCaughtError();
|
|
if (!hasRethrowError) {
|
|
hasRethrowError = true;
|
|
rethrowError = error2;
|
|
}
|
|
}
|
|
}
|
|
function rethrowCaughtError() {
|
|
if (hasRethrowError) {
|
|
var error2 = rethrowError;
|
|
hasRethrowError = false;
|
|
rethrowError = null;
|
|
throw error2;
|
|
}
|
|
}
|
|
function hasCaughtError() {
|
|
return hasError;
|
|
}
|
|
function clearCaughtError() {
|
|
if (hasError) {
|
|
var error2 = caughtError;
|
|
hasError = false;
|
|
caughtError = null;
|
|
return error2;
|
|
} else {
|
|
throw new Error("clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
function get2(key) {
|
|
return key._reactInternals;
|
|
}
|
|
function has2(key) {
|
|
return key._reactInternals !== void 0;
|
|
}
|
|
function set3(key, value) {
|
|
key._reactInternals = value;
|
|
}
|
|
var NoFlags = 0;
|
|
var PerformedWork = 1;
|
|
var Placement = 2;
|
|
var Update = 4;
|
|
var ChildDeletion = 16;
|
|
var ContentReset = 32;
|
|
var Callback = 64;
|
|
var DidCapture = 128;
|
|
var ForceClientRender = 256;
|
|
var Ref2 = 512;
|
|
var Snapshot = 1024;
|
|
var Passive = 2048;
|
|
var Hydrating = 4096;
|
|
var Visibility = 8192;
|
|
var StoreConsistency = 16384;
|
|
var LifecycleEffectMask = Passive | Update | Callback | Ref2 | Snapshot | StoreConsistency;
|
|
var HostEffectMask = 32767;
|
|
var Incomplete = 32768;
|
|
var ShouldCapture = 65536;
|
|
var ForceUpdateForLegacySuspense = 131072;
|
|
var Forked = 1048576;
|
|
var RefStatic = 2097152;
|
|
var LayoutStatic = 4194304;
|
|
var PassiveStatic = 8388608;
|
|
var MountLayoutDev = 16777216;
|
|
var MountPassiveDev = 33554432;
|
|
var BeforeMutationMask = Update | Snapshot | 0;
|
|
var MutationMask = Placement | Update | ChildDeletion | ContentReset | Ref2 | Hydrating | Visibility;
|
|
var LayoutMask = Update | Callback | Ref2 | Visibility;
|
|
var PassiveMask = Passive | ChildDeletion;
|
|
var StaticMask = LayoutStatic | PassiveStatic | RefStatic;
|
|
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
function getNearestMountedFiber(fiber) {
|
|
var node = fiber;
|
|
var nearestMounted = fiber;
|
|
if (!fiber.alternate) {
|
|
var nextNode = node;
|
|
do {
|
|
node = nextNode;
|
|
if ((node.flags & (Placement | Hydrating)) !== NoFlags) {
|
|
nearestMounted = node.return;
|
|
}
|
|
nextNode = node.return;
|
|
} while (nextNode);
|
|
} else {
|
|
while (node.return) {
|
|
node = node.return;
|
|
}
|
|
}
|
|
if (node.tag === HostRoot) {
|
|
return nearestMounted;
|
|
}
|
|
return null;
|
|
}
|
|
function getSuspenseInstanceFromFiber(fiber) {
|
|
if (fiber.tag === SuspenseComponent) {
|
|
var suspenseState = fiber.memoizedState;
|
|
if (suspenseState === null) {
|
|
var current3 = fiber.alternate;
|
|
if (current3 !== null) {
|
|
suspenseState = current3.memoizedState;
|
|
}
|
|
}
|
|
if (suspenseState !== null) {
|
|
return suspenseState.dehydrated;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
function getContainerFromFiber(fiber) {
|
|
return fiber.tag === HostRoot ? fiber.stateNode.containerInfo : null;
|
|
}
|
|
function isFiberMounted(fiber) {
|
|
return getNearestMountedFiber(fiber) === fiber;
|
|
}
|
|
function isMounted(component) {
|
|
{
|
|
var owner = ReactCurrentOwner.current;
|
|
if (owner !== null && owner.tag === ClassComponent) {
|
|
var ownerFiber = owner;
|
|
var instance = ownerFiber.stateNode;
|
|
if (!instance._warnedAboutRefsInRender) {
|
|
error("%s is accessing isMounted inside its render() function. render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.", getComponentNameFromFiber(ownerFiber) || "A component");
|
|
}
|
|
instance._warnedAboutRefsInRender = true;
|
|
}
|
|
}
|
|
var fiber = get2(component);
|
|
if (!fiber) {
|
|
return false;
|
|
}
|
|
return getNearestMountedFiber(fiber) === fiber;
|
|
}
|
|
function assertIsMounted(fiber) {
|
|
if (getNearestMountedFiber(fiber) !== fiber) {
|
|
throw new Error("Unable to find node on an unmounted component.");
|
|
}
|
|
}
|
|
function findCurrentFiberUsingSlowPath(fiber) {
|
|
var alternate = fiber.alternate;
|
|
if (!alternate) {
|
|
var nearestMounted = getNearestMountedFiber(fiber);
|
|
if (nearestMounted === null) {
|
|
throw new Error("Unable to find node on an unmounted component.");
|
|
}
|
|
if (nearestMounted !== fiber) {
|
|
return null;
|
|
}
|
|
return fiber;
|
|
}
|
|
var a = fiber;
|
|
var b = alternate;
|
|
while (true) {
|
|
var parentA = a.return;
|
|
if (parentA === null) {
|
|
break;
|
|
}
|
|
var parentB = parentA.alternate;
|
|
if (parentB === null) {
|
|
var nextParent = parentA.return;
|
|
if (nextParent !== null) {
|
|
a = b = nextParent;
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
if (parentA.child === parentB.child) {
|
|
var child = parentA.child;
|
|
while (child) {
|
|
if (child === a) {
|
|
assertIsMounted(parentA);
|
|
return fiber;
|
|
}
|
|
if (child === b) {
|
|
assertIsMounted(parentA);
|
|
return alternate;
|
|
}
|
|
child = child.sibling;
|
|
}
|
|
throw new Error("Unable to find node on an unmounted component.");
|
|
}
|
|
if (a.return !== b.return) {
|
|
a = parentA;
|
|
b = parentB;
|
|
} else {
|
|
var didFindChild = false;
|
|
var _child = parentA.child;
|
|
while (_child) {
|
|
if (_child === a) {
|
|
didFindChild = true;
|
|
a = parentA;
|
|
b = parentB;
|
|
break;
|
|
}
|
|
if (_child === b) {
|
|
didFindChild = true;
|
|
b = parentA;
|
|
a = parentB;
|
|
break;
|
|
}
|
|
_child = _child.sibling;
|
|
}
|
|
if (!didFindChild) {
|
|
_child = parentB.child;
|
|
while (_child) {
|
|
if (_child === a) {
|
|
didFindChild = true;
|
|
a = parentB;
|
|
b = parentA;
|
|
break;
|
|
}
|
|
if (_child === b) {
|
|
didFindChild = true;
|
|
b = parentB;
|
|
a = parentA;
|
|
break;
|
|
}
|
|
_child = _child.sibling;
|
|
}
|
|
if (!didFindChild) {
|
|
throw new Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.");
|
|
}
|
|
}
|
|
}
|
|
if (a.alternate !== b) {
|
|
throw new Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
if (a.tag !== HostRoot) {
|
|
throw new Error("Unable to find node on an unmounted component.");
|
|
}
|
|
if (a.stateNode.current === a) {
|
|
return fiber;
|
|
}
|
|
return alternate;
|
|
}
|
|
function findCurrentHostFiber(parent) {
|
|
var currentParent = findCurrentFiberUsingSlowPath(parent);
|
|
return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null;
|
|
}
|
|
function findCurrentHostFiberImpl(node) {
|
|
if (node.tag === HostComponent || node.tag === HostText) {
|
|
return node;
|
|
}
|
|
var child = node.child;
|
|
while (child !== null) {
|
|
var match = findCurrentHostFiberImpl(child);
|
|
if (match !== null) {
|
|
return match;
|
|
}
|
|
child = child.sibling;
|
|
}
|
|
return null;
|
|
}
|
|
function findCurrentHostFiberWithNoPortals(parent) {
|
|
var currentParent = findCurrentFiberUsingSlowPath(parent);
|
|
return currentParent !== null ? findCurrentHostFiberWithNoPortalsImpl(currentParent) : null;
|
|
}
|
|
function findCurrentHostFiberWithNoPortalsImpl(node) {
|
|
if (node.tag === HostComponent || node.tag === HostText) {
|
|
return node;
|
|
}
|
|
var child = node.child;
|
|
while (child !== null) {
|
|
if (child.tag !== HostPortal) {
|
|
var match = findCurrentHostFiberWithNoPortalsImpl(child);
|
|
if (match !== null) {
|
|
return match;
|
|
}
|
|
}
|
|
child = child.sibling;
|
|
}
|
|
return null;
|
|
}
|
|
var scheduleCallback = Scheduler.unstable_scheduleCallback;
|
|
var cancelCallback = Scheduler.unstable_cancelCallback;
|
|
var shouldYield = Scheduler.unstable_shouldYield;
|
|
var requestPaint = Scheduler.unstable_requestPaint;
|
|
var now = Scheduler.unstable_now;
|
|
var getCurrentPriorityLevel = Scheduler.unstable_getCurrentPriorityLevel;
|
|
var ImmediatePriority = Scheduler.unstable_ImmediatePriority;
|
|
var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority;
|
|
var NormalPriority = Scheduler.unstable_NormalPriority;
|
|
var LowPriority = Scheduler.unstable_LowPriority;
|
|
var IdlePriority = Scheduler.unstable_IdlePriority;
|
|
var unstable_yieldValue = Scheduler.unstable_yieldValue;
|
|
var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue;
|
|
var rendererID = null;
|
|
var injectedHook = null;
|
|
var injectedProfilingHooks = null;
|
|
var hasLoggedError = false;
|
|
var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined";
|
|
function injectInternals(internals) {
|
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined") {
|
|
return false;
|
|
}
|
|
var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
if (hook.isDisabled) {
|
|
return true;
|
|
}
|
|
if (!hook.supportsFiber) {
|
|
{
|
|
error("The installed version of React DevTools is too old and will not work with the current version of React. Please update React DevTools. https://reactjs.org/link/react-devtools");
|
|
}
|
|
return true;
|
|
}
|
|
try {
|
|
if (enableSchedulingProfiler) {
|
|
internals = assign2({}, internals, {
|
|
getLaneLabelMap,
|
|
injectProfilingHooks
|
|
});
|
|
}
|
|
rendererID = hook.inject(internals);
|
|
injectedHook = hook;
|
|
} catch (err) {
|
|
{
|
|
error("React instrumentation encountered an error: %s.", err);
|
|
}
|
|
}
|
|
if (hook.checkDCE) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
function onScheduleRoot(root2, children) {
|
|
{
|
|
if (injectedHook && typeof injectedHook.onScheduleFiberRoot === "function") {
|
|
try {
|
|
injectedHook.onScheduleFiberRoot(rendererID, root2, children);
|
|
} catch (err) {
|
|
if (!hasLoggedError) {
|
|
hasLoggedError = true;
|
|
error("React instrumentation encountered an error: %s", err);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function onCommitRoot(root2, eventPriority) {
|
|
if (injectedHook && typeof injectedHook.onCommitFiberRoot === "function") {
|
|
try {
|
|
var didError = (root2.current.flags & DidCapture) === DidCapture;
|
|
if (enableProfilerTimer) {
|
|
var schedulerPriority;
|
|
switch (eventPriority) {
|
|
case DiscreteEventPriority:
|
|
schedulerPriority = ImmediatePriority;
|
|
break;
|
|
case ContinuousEventPriority:
|
|
schedulerPriority = UserBlockingPriority;
|
|
break;
|
|
case DefaultEventPriority:
|
|
schedulerPriority = NormalPriority;
|
|
break;
|
|
case IdleEventPriority:
|
|
schedulerPriority = IdlePriority;
|
|
break;
|
|
default:
|
|
schedulerPriority = NormalPriority;
|
|
break;
|
|
}
|
|
injectedHook.onCommitFiberRoot(rendererID, root2, schedulerPriority, didError);
|
|
} else {
|
|
injectedHook.onCommitFiberRoot(rendererID, root2, void 0, didError);
|
|
}
|
|
} catch (err) {
|
|
{
|
|
if (!hasLoggedError) {
|
|
hasLoggedError = true;
|
|
error("React instrumentation encountered an error: %s", err);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function onPostCommitRoot(root2) {
|
|
if (injectedHook && typeof injectedHook.onPostCommitFiberRoot === "function") {
|
|
try {
|
|
injectedHook.onPostCommitFiberRoot(rendererID, root2);
|
|
} catch (err) {
|
|
{
|
|
if (!hasLoggedError) {
|
|
hasLoggedError = true;
|
|
error("React instrumentation encountered an error: %s", err);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function onCommitUnmount(fiber) {
|
|
if (injectedHook && typeof injectedHook.onCommitFiberUnmount === "function") {
|
|
try {
|
|
injectedHook.onCommitFiberUnmount(rendererID, fiber);
|
|
} catch (err) {
|
|
{
|
|
if (!hasLoggedError) {
|
|
hasLoggedError = true;
|
|
error("React instrumentation encountered an error: %s", err);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function setIsStrictModeForDevtools(newIsStrictMode) {
|
|
{
|
|
if (typeof unstable_yieldValue === "function") {
|
|
unstable_setDisableYieldValue(newIsStrictMode);
|
|
setSuppressWarning(newIsStrictMode);
|
|
}
|
|
if (injectedHook && typeof injectedHook.setStrictMode === "function") {
|
|
try {
|
|
injectedHook.setStrictMode(rendererID, newIsStrictMode);
|
|
} catch (err) {
|
|
{
|
|
if (!hasLoggedError) {
|
|
hasLoggedError = true;
|
|
error("React instrumentation encountered an error: %s", err);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function injectProfilingHooks(profilingHooks) {
|
|
injectedProfilingHooks = profilingHooks;
|
|
}
|
|
function getLaneLabelMap() {
|
|
{
|
|
var map = /* @__PURE__ */ new Map();
|
|
var lane = 1;
|
|
for (var index2 = 0; index2 < TotalLanes; index2++) {
|
|
var label = getLabelForLane(lane);
|
|
map.set(lane, label);
|
|
lane *= 2;
|
|
}
|
|
return map;
|
|
}
|
|
}
|
|
function markCommitStarted(lanes) {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStarted === "function") {
|
|
injectedProfilingHooks.markCommitStarted(lanes);
|
|
}
|
|
}
|
|
}
|
|
function markCommitStopped() {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStopped === "function") {
|
|
injectedProfilingHooks.markCommitStopped();
|
|
}
|
|
}
|
|
}
|
|
function markComponentRenderStarted(fiber) {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStarted === "function") {
|
|
injectedProfilingHooks.markComponentRenderStarted(fiber);
|
|
}
|
|
}
|
|
}
|
|
function markComponentRenderStopped() {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStopped === "function") {
|
|
injectedProfilingHooks.markComponentRenderStopped();
|
|
}
|
|
}
|
|
}
|
|
function markComponentPassiveEffectMountStarted(fiber) {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStarted === "function") {
|
|
injectedProfilingHooks.markComponentPassiveEffectMountStarted(fiber);
|
|
}
|
|
}
|
|
}
|
|
function markComponentPassiveEffectMountStopped() {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStopped === "function") {
|
|
injectedProfilingHooks.markComponentPassiveEffectMountStopped();
|
|
}
|
|
}
|
|
}
|
|
function markComponentPassiveEffectUnmountStarted(fiber) {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStarted === "function") {
|
|
injectedProfilingHooks.markComponentPassiveEffectUnmountStarted(fiber);
|
|
}
|
|
}
|
|
}
|
|
function markComponentPassiveEffectUnmountStopped() {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStopped === "function") {
|
|
injectedProfilingHooks.markComponentPassiveEffectUnmountStopped();
|
|
}
|
|
}
|
|
}
|
|
function markComponentLayoutEffectMountStarted(fiber) {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStarted === "function") {
|
|
injectedProfilingHooks.markComponentLayoutEffectMountStarted(fiber);
|
|
}
|
|
}
|
|
}
|
|
function markComponentLayoutEffectMountStopped() {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStopped === "function") {
|
|
injectedProfilingHooks.markComponentLayoutEffectMountStopped();
|
|
}
|
|
}
|
|
}
|
|
function markComponentLayoutEffectUnmountStarted(fiber) {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStarted === "function") {
|
|
injectedProfilingHooks.markComponentLayoutEffectUnmountStarted(fiber);
|
|
}
|
|
}
|
|
}
|
|
function markComponentLayoutEffectUnmountStopped() {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStopped === "function") {
|
|
injectedProfilingHooks.markComponentLayoutEffectUnmountStopped();
|
|
}
|
|
}
|
|
}
|
|
function markComponentErrored(fiber, thrownValue, lanes) {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentErrored === "function") {
|
|
injectedProfilingHooks.markComponentErrored(fiber, thrownValue, lanes);
|
|
}
|
|
}
|
|
}
|
|
function markComponentSuspended(fiber, wakeable, lanes) {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentSuspended === "function") {
|
|
injectedProfilingHooks.markComponentSuspended(fiber, wakeable, lanes);
|
|
}
|
|
}
|
|
}
|
|
function markLayoutEffectsStarted(lanes) {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStarted === "function") {
|
|
injectedProfilingHooks.markLayoutEffectsStarted(lanes);
|
|
}
|
|
}
|
|
}
|
|
function markLayoutEffectsStopped() {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStopped === "function") {
|
|
injectedProfilingHooks.markLayoutEffectsStopped();
|
|
}
|
|
}
|
|
}
|
|
function markPassiveEffectsStarted(lanes) {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStarted === "function") {
|
|
injectedProfilingHooks.markPassiveEffectsStarted(lanes);
|
|
}
|
|
}
|
|
}
|
|
function markPassiveEffectsStopped() {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStopped === "function") {
|
|
injectedProfilingHooks.markPassiveEffectsStopped();
|
|
}
|
|
}
|
|
}
|
|
function markRenderStarted(lanes) {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStarted === "function") {
|
|
injectedProfilingHooks.markRenderStarted(lanes);
|
|
}
|
|
}
|
|
}
|
|
function markRenderYielded() {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderYielded === "function") {
|
|
injectedProfilingHooks.markRenderYielded();
|
|
}
|
|
}
|
|
}
|
|
function markRenderStopped() {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStopped === "function") {
|
|
injectedProfilingHooks.markRenderStopped();
|
|
}
|
|
}
|
|
}
|
|
function markRenderScheduled(lane) {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderScheduled === "function") {
|
|
injectedProfilingHooks.markRenderScheduled(lane);
|
|
}
|
|
}
|
|
}
|
|
function markForceUpdateScheduled(fiber, lane) {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markForceUpdateScheduled === "function") {
|
|
injectedProfilingHooks.markForceUpdateScheduled(fiber, lane);
|
|
}
|
|
}
|
|
}
|
|
function markStateUpdateScheduled(fiber, lane) {
|
|
{
|
|
if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markStateUpdateScheduled === "function") {
|
|
injectedProfilingHooks.markStateUpdateScheduled(fiber, lane);
|
|
}
|
|
}
|
|
}
|
|
var NoMode = 0;
|
|
var ConcurrentMode = 1;
|
|
var ProfileMode = 2;
|
|
var StrictLegacyMode = 8;
|
|
var StrictEffectsMode = 16;
|
|
var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback;
|
|
var log2 = Math.log;
|
|
var LN2 = Math.LN2;
|
|
function clz32Fallback(x) {
|
|
var asUint = x >>> 0;
|
|
if (asUint === 0) {
|
|
return 32;
|
|
}
|
|
return 31 - (log2(asUint) / LN2 | 0) | 0;
|
|
}
|
|
var TotalLanes = 31;
|
|
var NoLanes = 0;
|
|
var NoLane = 0;
|
|
var SyncLane = 1;
|
|
var InputContinuousHydrationLane = 2;
|
|
var InputContinuousLane = 4;
|
|
var DefaultHydrationLane = 8;
|
|
var DefaultLane = 16;
|
|
var TransitionHydrationLane = 32;
|
|
var TransitionLanes = 4194240;
|
|
var TransitionLane1 = 64;
|
|
var TransitionLane2 = 128;
|
|
var TransitionLane3 = 256;
|
|
var TransitionLane4 = 512;
|
|
var TransitionLane5 = 1024;
|
|
var TransitionLane6 = 2048;
|
|
var TransitionLane7 = 4096;
|
|
var TransitionLane8 = 8192;
|
|
var TransitionLane9 = 16384;
|
|
var TransitionLane10 = 32768;
|
|
var TransitionLane11 = 65536;
|
|
var TransitionLane12 = 131072;
|
|
var TransitionLane13 = 262144;
|
|
var TransitionLane14 = 524288;
|
|
var TransitionLane15 = 1048576;
|
|
var TransitionLane16 = 2097152;
|
|
var RetryLanes = 130023424;
|
|
var RetryLane1 = 4194304;
|
|
var RetryLane2 = 8388608;
|
|
var RetryLane3 = 16777216;
|
|
var RetryLane4 = 33554432;
|
|
var RetryLane5 = 67108864;
|
|
var SomeRetryLane = RetryLane1;
|
|
var SelectiveHydrationLane = 134217728;
|
|
var NonIdleLanes = 268435455;
|
|
var IdleHydrationLane = 268435456;
|
|
var IdleLane = 536870912;
|
|
var OffscreenLane = 1073741824;
|
|
function getLabelForLane(lane) {
|
|
{
|
|
if (lane & SyncLane) {
|
|
return "Sync";
|
|
}
|
|
if (lane & InputContinuousHydrationLane) {
|
|
return "InputContinuousHydration";
|
|
}
|
|
if (lane & InputContinuousLane) {
|
|
return "InputContinuous";
|
|
}
|
|
if (lane & DefaultHydrationLane) {
|
|
return "DefaultHydration";
|
|
}
|
|
if (lane & DefaultLane) {
|
|
return "Default";
|
|
}
|
|
if (lane & TransitionHydrationLane) {
|
|
return "TransitionHydration";
|
|
}
|
|
if (lane & TransitionLanes) {
|
|
return "Transition";
|
|
}
|
|
if (lane & RetryLanes) {
|
|
return "Retry";
|
|
}
|
|
if (lane & SelectiveHydrationLane) {
|
|
return "SelectiveHydration";
|
|
}
|
|
if (lane & IdleHydrationLane) {
|
|
return "IdleHydration";
|
|
}
|
|
if (lane & IdleLane) {
|
|
return "Idle";
|
|
}
|
|
if (lane & OffscreenLane) {
|
|
return "Offscreen";
|
|
}
|
|
}
|
|
}
|
|
var NoTimestamp = -1;
|
|
var nextTransitionLane = TransitionLane1;
|
|
var nextRetryLane = RetryLane1;
|
|
function getHighestPriorityLanes(lanes) {
|
|
switch (getHighestPriorityLane(lanes)) {
|
|
case SyncLane:
|
|
return SyncLane;
|
|
case InputContinuousHydrationLane:
|
|
return InputContinuousHydrationLane;
|
|
case InputContinuousLane:
|
|
return InputContinuousLane;
|
|
case DefaultHydrationLane:
|
|
return DefaultHydrationLane;
|
|
case DefaultLane:
|
|
return DefaultLane;
|
|
case TransitionHydrationLane:
|
|
return TransitionHydrationLane;
|
|
case TransitionLane1:
|
|
case TransitionLane2:
|
|
case TransitionLane3:
|
|
case TransitionLane4:
|
|
case TransitionLane5:
|
|
case TransitionLane6:
|
|
case TransitionLane7:
|
|
case TransitionLane8:
|
|
case TransitionLane9:
|
|
case TransitionLane10:
|
|
case TransitionLane11:
|
|
case TransitionLane12:
|
|
case TransitionLane13:
|
|
case TransitionLane14:
|
|
case TransitionLane15:
|
|
case TransitionLane16:
|
|
return lanes & TransitionLanes;
|
|
case RetryLane1:
|
|
case RetryLane2:
|
|
case RetryLane3:
|
|
case RetryLane4:
|
|
case RetryLane5:
|
|
return lanes & RetryLanes;
|
|
case SelectiveHydrationLane:
|
|
return SelectiveHydrationLane;
|
|
case IdleHydrationLane:
|
|
return IdleHydrationLane;
|
|
case IdleLane:
|
|
return IdleLane;
|
|
case OffscreenLane:
|
|
return OffscreenLane;
|
|
default:
|
|
{
|
|
error("Should have found matching lanes. This is a bug in React.");
|
|
}
|
|
return lanes;
|
|
}
|
|
}
|
|
function getNextLanes(root2, wipLanes) {
|
|
var pendingLanes = root2.pendingLanes;
|
|
if (pendingLanes === NoLanes) {
|
|
return NoLanes;
|
|
}
|
|
var nextLanes = NoLanes;
|
|
var suspendedLanes = root2.suspendedLanes;
|
|
var pingedLanes = root2.pingedLanes;
|
|
var nonIdlePendingLanes = pendingLanes & NonIdleLanes;
|
|
if (nonIdlePendingLanes !== NoLanes) {
|
|
var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes;
|
|
if (nonIdleUnblockedLanes !== NoLanes) {
|
|
nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes);
|
|
} else {
|
|
var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes;
|
|
if (nonIdlePingedLanes !== NoLanes) {
|
|
nextLanes = getHighestPriorityLanes(nonIdlePingedLanes);
|
|
}
|
|
}
|
|
} else {
|
|
var unblockedLanes = pendingLanes & ~suspendedLanes;
|
|
if (unblockedLanes !== NoLanes) {
|
|
nextLanes = getHighestPriorityLanes(unblockedLanes);
|
|
} else {
|
|
if (pingedLanes !== NoLanes) {
|
|
nextLanes = getHighestPriorityLanes(pingedLanes);
|
|
}
|
|
}
|
|
}
|
|
if (nextLanes === NoLanes) {
|
|
return NoLanes;
|
|
}
|
|
if (wipLanes !== NoLanes && wipLanes !== nextLanes && (wipLanes & suspendedLanes) === NoLanes) {
|
|
var nextLane = getHighestPriorityLane(nextLanes);
|
|
var wipLane = getHighestPriorityLane(wipLanes);
|
|
if (nextLane >= wipLane || nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) {
|
|
return wipLanes;
|
|
}
|
|
}
|
|
if ((nextLanes & InputContinuousLane) !== NoLanes) {
|
|
nextLanes |= pendingLanes & DefaultLane;
|
|
}
|
|
var entangledLanes = root2.entangledLanes;
|
|
if (entangledLanes !== NoLanes) {
|
|
var entanglements = root2.entanglements;
|
|
var lanes = nextLanes & entangledLanes;
|
|
while (lanes > 0) {
|
|
var index2 = pickArbitraryLaneIndex(lanes);
|
|
var lane = 1 << index2;
|
|
nextLanes |= entanglements[index2];
|
|
lanes &= ~lane;
|
|
}
|
|
}
|
|
return nextLanes;
|
|
}
|
|
function getMostRecentEventTime(root2, lanes) {
|
|
var eventTimes = root2.eventTimes;
|
|
var mostRecentEventTime = NoTimestamp;
|
|
while (lanes > 0) {
|
|
var index2 = pickArbitraryLaneIndex(lanes);
|
|
var lane = 1 << index2;
|
|
var eventTime = eventTimes[index2];
|
|
if (eventTime > mostRecentEventTime) {
|
|
mostRecentEventTime = eventTime;
|
|
}
|
|
lanes &= ~lane;
|
|
}
|
|
return mostRecentEventTime;
|
|
}
|
|
function computeExpirationTime(lane, currentTime) {
|
|
switch (lane) {
|
|
case SyncLane:
|
|
case InputContinuousHydrationLane:
|
|
case InputContinuousLane:
|
|
return currentTime + 250;
|
|
case DefaultHydrationLane:
|
|
case DefaultLane:
|
|
case TransitionHydrationLane:
|
|
case TransitionLane1:
|
|
case TransitionLane2:
|
|
case TransitionLane3:
|
|
case TransitionLane4:
|
|
case TransitionLane5:
|
|
case TransitionLane6:
|
|
case TransitionLane7:
|
|
case TransitionLane8:
|
|
case TransitionLane9:
|
|
case TransitionLane10:
|
|
case TransitionLane11:
|
|
case TransitionLane12:
|
|
case TransitionLane13:
|
|
case TransitionLane14:
|
|
case TransitionLane15:
|
|
case TransitionLane16:
|
|
return currentTime + 5e3;
|
|
case RetryLane1:
|
|
case RetryLane2:
|
|
case RetryLane3:
|
|
case RetryLane4:
|
|
case RetryLane5:
|
|
return NoTimestamp;
|
|
case SelectiveHydrationLane:
|
|
case IdleHydrationLane:
|
|
case IdleLane:
|
|
case OffscreenLane:
|
|
return NoTimestamp;
|
|
default:
|
|
{
|
|
error("Should have found matching lanes. This is a bug in React.");
|
|
}
|
|
return NoTimestamp;
|
|
}
|
|
}
|
|
function markStarvedLanesAsExpired(root2, currentTime) {
|
|
var pendingLanes = root2.pendingLanes;
|
|
var suspendedLanes = root2.suspendedLanes;
|
|
var pingedLanes = root2.pingedLanes;
|
|
var expirationTimes = root2.expirationTimes;
|
|
var lanes = pendingLanes;
|
|
while (lanes > 0) {
|
|
var index2 = pickArbitraryLaneIndex(lanes);
|
|
var lane = 1 << index2;
|
|
var expirationTime = expirationTimes[index2];
|
|
if (expirationTime === NoTimestamp) {
|
|
if ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) {
|
|
expirationTimes[index2] = computeExpirationTime(lane, currentTime);
|
|
}
|
|
} else if (expirationTime <= currentTime) {
|
|
root2.expiredLanes |= lane;
|
|
}
|
|
lanes &= ~lane;
|
|
}
|
|
}
|
|
function getHighestPriorityPendingLanes(root2) {
|
|
return getHighestPriorityLanes(root2.pendingLanes);
|
|
}
|
|
function getLanesToRetrySynchronouslyOnError(root2) {
|
|
var everythingButOffscreen = root2.pendingLanes & ~OffscreenLane;
|
|
if (everythingButOffscreen !== NoLanes) {
|
|
return everythingButOffscreen;
|
|
}
|
|
if (everythingButOffscreen & OffscreenLane) {
|
|
return OffscreenLane;
|
|
}
|
|
return NoLanes;
|
|
}
|
|
function includesSyncLane(lanes) {
|
|
return (lanes & SyncLane) !== NoLanes;
|
|
}
|
|
function includesNonIdleWork(lanes) {
|
|
return (lanes & NonIdleLanes) !== NoLanes;
|
|
}
|
|
function includesOnlyRetries(lanes) {
|
|
return (lanes & RetryLanes) === lanes;
|
|
}
|
|
function includesOnlyNonUrgentLanes(lanes) {
|
|
var UrgentLanes = SyncLane | InputContinuousLane | DefaultLane;
|
|
return (lanes & UrgentLanes) === NoLanes;
|
|
}
|
|
function includesOnlyTransitions(lanes) {
|
|
return (lanes & TransitionLanes) === lanes;
|
|
}
|
|
function includesBlockingLane(root2, lanes) {
|
|
var SyncDefaultLanes = InputContinuousHydrationLane | InputContinuousLane | DefaultHydrationLane | DefaultLane;
|
|
return (lanes & SyncDefaultLanes) !== NoLanes;
|
|
}
|
|
function includesExpiredLane(root2, lanes) {
|
|
return (lanes & root2.expiredLanes) !== NoLanes;
|
|
}
|
|
function isTransitionLane(lane) {
|
|
return (lane & TransitionLanes) !== NoLanes;
|
|
}
|
|
function claimNextTransitionLane() {
|
|
var lane = nextTransitionLane;
|
|
nextTransitionLane <<= 1;
|
|
if ((nextTransitionLane & TransitionLanes) === NoLanes) {
|
|
nextTransitionLane = TransitionLane1;
|
|
}
|
|
return lane;
|
|
}
|
|
function claimNextRetryLane() {
|
|
var lane = nextRetryLane;
|
|
nextRetryLane <<= 1;
|
|
if ((nextRetryLane & RetryLanes) === NoLanes) {
|
|
nextRetryLane = RetryLane1;
|
|
}
|
|
return lane;
|
|
}
|
|
function getHighestPriorityLane(lanes) {
|
|
return lanes & -lanes;
|
|
}
|
|
function pickArbitraryLane(lanes) {
|
|
return getHighestPriorityLane(lanes);
|
|
}
|
|
function pickArbitraryLaneIndex(lanes) {
|
|
return 31 - clz32(lanes);
|
|
}
|
|
function laneToIndex(lane) {
|
|
return pickArbitraryLaneIndex(lane);
|
|
}
|
|
function includesSomeLane(a, b) {
|
|
return (a & b) !== NoLanes;
|
|
}
|
|
function isSubsetOfLanes(set4, subset) {
|
|
return (set4 & subset) === subset;
|
|
}
|
|
function mergeLanes(a, b) {
|
|
return a | b;
|
|
}
|
|
function removeLanes(set4, subset) {
|
|
return set4 & ~subset;
|
|
}
|
|
function intersectLanes(a, b) {
|
|
return a & b;
|
|
}
|
|
function laneToLanes(lane) {
|
|
return lane;
|
|
}
|
|
function higherPriorityLane(a, b) {
|
|
return a !== NoLane && a < b ? a : b;
|
|
}
|
|
function createLaneMap(initial2) {
|
|
var laneMap = [];
|
|
for (var i = 0; i < TotalLanes; i++) {
|
|
laneMap.push(initial2);
|
|
}
|
|
return laneMap;
|
|
}
|
|
function markRootUpdated(root2, updateLane, eventTime) {
|
|
root2.pendingLanes |= updateLane;
|
|
if (updateLane !== IdleLane) {
|
|
root2.suspendedLanes = NoLanes;
|
|
root2.pingedLanes = NoLanes;
|
|
}
|
|
var eventTimes = root2.eventTimes;
|
|
var index2 = laneToIndex(updateLane);
|
|
eventTimes[index2] = eventTime;
|
|
}
|
|
function markRootSuspended(root2, suspendedLanes) {
|
|
root2.suspendedLanes |= suspendedLanes;
|
|
root2.pingedLanes &= ~suspendedLanes;
|
|
var expirationTimes = root2.expirationTimes;
|
|
var lanes = suspendedLanes;
|
|
while (lanes > 0) {
|
|
var index2 = pickArbitraryLaneIndex(lanes);
|
|
var lane = 1 << index2;
|
|
expirationTimes[index2] = NoTimestamp;
|
|
lanes &= ~lane;
|
|
}
|
|
}
|
|
function markRootPinged(root2, pingedLanes, eventTime) {
|
|
root2.pingedLanes |= root2.suspendedLanes & pingedLanes;
|
|
}
|
|
function markRootFinished(root2, remainingLanes) {
|
|
var noLongerPendingLanes = root2.pendingLanes & ~remainingLanes;
|
|
root2.pendingLanes = remainingLanes;
|
|
root2.suspendedLanes = NoLanes;
|
|
root2.pingedLanes = NoLanes;
|
|
root2.expiredLanes &= remainingLanes;
|
|
root2.mutableReadLanes &= remainingLanes;
|
|
root2.entangledLanes &= remainingLanes;
|
|
var entanglements = root2.entanglements;
|
|
var eventTimes = root2.eventTimes;
|
|
var expirationTimes = root2.expirationTimes;
|
|
var lanes = noLongerPendingLanes;
|
|
while (lanes > 0) {
|
|
var index2 = pickArbitraryLaneIndex(lanes);
|
|
var lane = 1 << index2;
|
|
entanglements[index2] = NoLanes;
|
|
eventTimes[index2] = NoTimestamp;
|
|
expirationTimes[index2] = NoTimestamp;
|
|
lanes &= ~lane;
|
|
}
|
|
}
|
|
function markRootEntangled(root2, entangledLanes) {
|
|
var rootEntangledLanes = root2.entangledLanes |= entangledLanes;
|
|
var entanglements = root2.entanglements;
|
|
var lanes = rootEntangledLanes;
|
|
while (lanes) {
|
|
var index2 = pickArbitraryLaneIndex(lanes);
|
|
var lane = 1 << index2;
|
|
if (lane & entangledLanes | entanglements[index2] & entangledLanes) {
|
|
entanglements[index2] |= entangledLanes;
|
|
}
|
|
lanes &= ~lane;
|
|
}
|
|
}
|
|
function getBumpedLaneForHydration(root2, renderLanes2) {
|
|
var renderLane = getHighestPriorityLane(renderLanes2);
|
|
var lane;
|
|
switch (renderLane) {
|
|
case InputContinuousLane:
|
|
lane = InputContinuousHydrationLane;
|
|
break;
|
|
case DefaultLane:
|
|
lane = DefaultHydrationLane;
|
|
break;
|
|
case TransitionLane1:
|
|
case TransitionLane2:
|
|
case TransitionLane3:
|
|
case TransitionLane4:
|
|
case TransitionLane5:
|
|
case TransitionLane6:
|
|
case TransitionLane7:
|
|
case TransitionLane8:
|
|
case TransitionLane9:
|
|
case TransitionLane10:
|
|
case TransitionLane11:
|
|
case TransitionLane12:
|
|
case TransitionLane13:
|
|
case TransitionLane14:
|
|
case TransitionLane15:
|
|
case TransitionLane16:
|
|
case RetryLane1:
|
|
case RetryLane2:
|
|
case RetryLane3:
|
|
case RetryLane4:
|
|
case RetryLane5:
|
|
lane = TransitionHydrationLane;
|
|
break;
|
|
case IdleLane:
|
|
lane = IdleHydrationLane;
|
|
break;
|
|
default:
|
|
lane = NoLane;
|
|
break;
|
|
}
|
|
if ((lane & (root2.suspendedLanes | renderLanes2)) !== NoLane) {
|
|
return NoLane;
|
|
}
|
|
return lane;
|
|
}
|
|
function addFiberToLanesMap(root2, fiber, lanes) {
|
|
if (!isDevToolsPresent) {
|
|
return;
|
|
}
|
|
var pendingUpdatersLaneMap = root2.pendingUpdatersLaneMap;
|
|
while (lanes > 0) {
|
|
var index2 = laneToIndex(lanes);
|
|
var lane = 1 << index2;
|
|
var updaters = pendingUpdatersLaneMap[index2];
|
|
updaters.add(fiber);
|
|
lanes &= ~lane;
|
|
}
|
|
}
|
|
function movePendingFibersToMemoized(root2, lanes) {
|
|
if (!isDevToolsPresent) {
|
|
return;
|
|
}
|
|
var pendingUpdatersLaneMap = root2.pendingUpdatersLaneMap;
|
|
var memoizedUpdaters = root2.memoizedUpdaters;
|
|
while (lanes > 0) {
|
|
var index2 = laneToIndex(lanes);
|
|
var lane = 1 << index2;
|
|
var updaters = pendingUpdatersLaneMap[index2];
|
|
if (updaters.size > 0) {
|
|
updaters.forEach(function(fiber) {
|
|
var alternate = fiber.alternate;
|
|
if (alternate === null || !memoizedUpdaters.has(alternate)) {
|
|
memoizedUpdaters.add(fiber);
|
|
}
|
|
});
|
|
updaters.clear();
|
|
}
|
|
lanes &= ~lane;
|
|
}
|
|
}
|
|
function getTransitionsForLanes(root2, lanes) {
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
var DiscreteEventPriority = SyncLane;
|
|
var ContinuousEventPriority = InputContinuousLane;
|
|
var DefaultEventPriority = DefaultLane;
|
|
var IdleEventPriority = IdleLane;
|
|
var currentUpdatePriority = NoLane;
|
|
function getCurrentUpdatePriority() {
|
|
return currentUpdatePriority;
|
|
}
|
|
function setCurrentUpdatePriority(newPriority) {
|
|
currentUpdatePriority = newPriority;
|
|
}
|
|
function runWithPriority(priority, fn) {
|
|
var previousPriority = currentUpdatePriority;
|
|
try {
|
|
currentUpdatePriority = priority;
|
|
return fn();
|
|
} finally {
|
|
currentUpdatePriority = previousPriority;
|
|
}
|
|
}
|
|
function higherEventPriority(a, b) {
|
|
return a !== 0 && a < b ? a : b;
|
|
}
|
|
function lowerEventPriority(a, b) {
|
|
return a === 0 || a > b ? a : b;
|
|
}
|
|
function isHigherEventPriority(a, b) {
|
|
return a !== 0 && a < b;
|
|
}
|
|
function lanesToEventPriority(lanes) {
|
|
var lane = getHighestPriorityLane(lanes);
|
|
if (!isHigherEventPriority(DiscreteEventPriority, lane)) {
|
|
return DiscreteEventPriority;
|
|
}
|
|
if (!isHigherEventPriority(ContinuousEventPriority, lane)) {
|
|
return ContinuousEventPriority;
|
|
}
|
|
if (includesNonIdleWork(lane)) {
|
|
return DefaultEventPriority;
|
|
}
|
|
return IdleEventPriority;
|
|
}
|
|
function isRootDehydrated(root2) {
|
|
var currentState = root2.current.memoizedState;
|
|
return currentState.isDehydrated;
|
|
}
|
|
var _attemptSynchronousHydration;
|
|
function setAttemptSynchronousHydration(fn) {
|
|
_attemptSynchronousHydration = fn;
|
|
}
|
|
function attemptSynchronousHydration(fiber) {
|
|
_attemptSynchronousHydration(fiber);
|
|
}
|
|
var attemptContinuousHydration;
|
|
function setAttemptContinuousHydration(fn) {
|
|
attemptContinuousHydration = fn;
|
|
}
|
|
var attemptHydrationAtCurrentPriority;
|
|
function setAttemptHydrationAtCurrentPriority(fn) {
|
|
attemptHydrationAtCurrentPriority = fn;
|
|
}
|
|
var getCurrentUpdatePriority$1;
|
|
function setGetCurrentUpdatePriority(fn) {
|
|
getCurrentUpdatePriority$1 = fn;
|
|
}
|
|
var attemptHydrationAtPriority;
|
|
function setAttemptHydrationAtPriority(fn) {
|
|
attemptHydrationAtPriority = fn;
|
|
}
|
|
var hasScheduledReplayAttempt = false;
|
|
var queuedDiscreteEvents = [];
|
|
var queuedFocus = null;
|
|
var queuedDrag = null;
|
|
var queuedMouse = null;
|
|
var queuedPointers = /* @__PURE__ */ new Map();
|
|
var queuedPointerCaptures = /* @__PURE__ */ new Map();
|
|
var queuedExplicitHydrationTargets = [];
|
|
var discreteReplayableEvents = [
|
|
"mousedown",
|
|
"mouseup",
|
|
"touchcancel",
|
|
"touchend",
|
|
"touchstart",
|
|
"auxclick",
|
|
"dblclick",
|
|
"pointercancel",
|
|
"pointerdown",
|
|
"pointerup",
|
|
"dragend",
|
|
"dragstart",
|
|
"drop",
|
|
"compositionend",
|
|
"compositionstart",
|
|
"keydown",
|
|
"keypress",
|
|
"keyup",
|
|
"input",
|
|
"textInput",
|
|
"copy",
|
|
"cut",
|
|
"paste",
|
|
"click",
|
|
"change",
|
|
"contextmenu",
|
|
"reset",
|
|
"submit"
|
|
];
|
|
function isDiscreteEventThatRequiresHydration(eventType) {
|
|
return discreteReplayableEvents.indexOf(eventType) > -1;
|
|
}
|
|
function createQueuedReplayableEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) {
|
|
return {
|
|
blockedOn,
|
|
domEventName,
|
|
eventSystemFlags,
|
|
nativeEvent,
|
|
targetContainers: [targetContainer]
|
|
};
|
|
}
|
|
function clearIfContinuousEvent(domEventName, nativeEvent) {
|
|
switch (domEventName) {
|
|
case "focusin":
|
|
case "focusout":
|
|
queuedFocus = null;
|
|
break;
|
|
case "dragenter":
|
|
case "dragleave":
|
|
queuedDrag = null;
|
|
break;
|
|
case "mouseover":
|
|
case "mouseout":
|
|
queuedMouse = null;
|
|
break;
|
|
case "pointerover":
|
|
case "pointerout": {
|
|
var pointerId = nativeEvent.pointerId;
|
|
queuedPointers.delete(pointerId);
|
|
break;
|
|
}
|
|
case "gotpointercapture":
|
|
case "lostpointercapture": {
|
|
var _pointerId = nativeEvent.pointerId;
|
|
queuedPointerCaptures.delete(_pointerId);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
function accumulateOrCreateContinuousQueuedReplayableEvent(existingQueuedEvent, blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) {
|
|
if (existingQueuedEvent === null || existingQueuedEvent.nativeEvent !== nativeEvent) {
|
|
var queuedEvent = createQueuedReplayableEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent);
|
|
if (blockedOn !== null) {
|
|
var _fiber2 = getInstanceFromNode(blockedOn);
|
|
if (_fiber2 !== null) {
|
|
attemptContinuousHydration(_fiber2);
|
|
}
|
|
}
|
|
return queuedEvent;
|
|
}
|
|
existingQueuedEvent.eventSystemFlags |= eventSystemFlags;
|
|
var targetContainers = existingQueuedEvent.targetContainers;
|
|
if (targetContainer !== null && targetContainers.indexOf(targetContainer) === -1) {
|
|
targetContainers.push(targetContainer);
|
|
}
|
|
return existingQueuedEvent;
|
|
}
|
|
function queueIfContinuousEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) {
|
|
switch (domEventName) {
|
|
case "focusin": {
|
|
var focusEvent = nativeEvent;
|
|
queuedFocus = accumulateOrCreateContinuousQueuedReplayableEvent(queuedFocus, blockedOn, domEventName, eventSystemFlags, targetContainer, focusEvent);
|
|
return true;
|
|
}
|
|
case "dragenter": {
|
|
var dragEvent = nativeEvent;
|
|
queuedDrag = accumulateOrCreateContinuousQueuedReplayableEvent(queuedDrag, blockedOn, domEventName, eventSystemFlags, targetContainer, dragEvent);
|
|
return true;
|
|
}
|
|
case "mouseover": {
|
|
var mouseEvent = nativeEvent;
|
|
queuedMouse = accumulateOrCreateContinuousQueuedReplayableEvent(queuedMouse, blockedOn, domEventName, eventSystemFlags, targetContainer, mouseEvent);
|
|
return true;
|
|
}
|
|
case "pointerover": {
|
|
var pointerEvent = nativeEvent;
|
|
var pointerId = pointerEvent.pointerId;
|
|
queuedPointers.set(pointerId, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointers.get(pointerId) || null, blockedOn, domEventName, eventSystemFlags, targetContainer, pointerEvent));
|
|
return true;
|
|
}
|
|
case "gotpointercapture": {
|
|
var _pointerEvent = nativeEvent;
|
|
var _pointerId2 = _pointerEvent.pointerId;
|
|
queuedPointerCaptures.set(_pointerId2, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointerCaptures.get(_pointerId2) || null, blockedOn, domEventName, eventSystemFlags, targetContainer, _pointerEvent));
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
function attemptExplicitHydrationTarget(queuedTarget) {
|
|
var targetInst = getClosestInstanceFromNode(queuedTarget.target);
|
|
if (targetInst !== null) {
|
|
var nearestMounted = getNearestMountedFiber(targetInst);
|
|
if (nearestMounted !== null) {
|
|
var tag = nearestMounted.tag;
|
|
if (tag === SuspenseComponent) {
|
|
var instance = getSuspenseInstanceFromFiber(nearestMounted);
|
|
if (instance !== null) {
|
|
queuedTarget.blockedOn = instance;
|
|
attemptHydrationAtPriority(queuedTarget.priority, function() {
|
|
attemptHydrationAtCurrentPriority(nearestMounted);
|
|
});
|
|
return;
|
|
}
|
|
} else if (tag === HostRoot) {
|
|
var root2 = nearestMounted.stateNode;
|
|
if (isRootDehydrated(root2)) {
|
|
queuedTarget.blockedOn = getContainerFromFiber(nearestMounted);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
queuedTarget.blockedOn = null;
|
|
}
|
|
function queueExplicitHydrationTarget(target) {
|
|
var updatePriority = getCurrentUpdatePriority$1();
|
|
var queuedTarget = {
|
|
blockedOn: null,
|
|
target,
|
|
priority: updatePriority
|
|
};
|
|
var i = 0;
|
|
for (; i < queuedExplicitHydrationTargets.length; i++) {
|
|
if (!isHigherEventPriority(updatePriority, queuedExplicitHydrationTargets[i].priority)) {
|
|
break;
|
|
}
|
|
}
|
|
queuedExplicitHydrationTargets.splice(i, 0, queuedTarget);
|
|
if (i === 0) {
|
|
attemptExplicitHydrationTarget(queuedTarget);
|
|
}
|
|
}
|
|
function attemptReplayContinuousQueuedEvent(queuedEvent) {
|
|
if (queuedEvent.blockedOn !== null) {
|
|
return false;
|
|
}
|
|
var targetContainers = queuedEvent.targetContainers;
|
|
while (targetContainers.length > 0) {
|
|
var targetContainer = targetContainers[0];
|
|
var nextBlockedOn = findInstanceBlockingEvent(queuedEvent.domEventName, queuedEvent.eventSystemFlags, targetContainer, queuedEvent.nativeEvent);
|
|
if (nextBlockedOn === null) {
|
|
{
|
|
var nativeEvent = queuedEvent.nativeEvent;
|
|
var nativeEventClone = new nativeEvent.constructor(nativeEvent.type, nativeEvent);
|
|
setReplayingEvent(nativeEventClone);
|
|
nativeEvent.target.dispatchEvent(nativeEventClone);
|
|
resetReplayingEvent();
|
|
}
|
|
} else {
|
|
var _fiber3 = getInstanceFromNode(nextBlockedOn);
|
|
if (_fiber3 !== null) {
|
|
attemptContinuousHydration(_fiber3);
|
|
}
|
|
queuedEvent.blockedOn = nextBlockedOn;
|
|
return false;
|
|
}
|
|
targetContainers.shift();
|
|
}
|
|
return true;
|
|
}
|
|
function attemptReplayContinuousQueuedEventInMap(queuedEvent, key, map) {
|
|
if (attemptReplayContinuousQueuedEvent(queuedEvent)) {
|
|
map.delete(key);
|
|
}
|
|
}
|
|
function replayUnblockedEvents() {
|
|
hasScheduledReplayAttempt = false;
|
|
if (queuedFocus !== null && attemptReplayContinuousQueuedEvent(queuedFocus)) {
|
|
queuedFocus = null;
|
|
}
|
|
if (queuedDrag !== null && attemptReplayContinuousQueuedEvent(queuedDrag)) {
|
|
queuedDrag = null;
|
|
}
|
|
if (queuedMouse !== null && attemptReplayContinuousQueuedEvent(queuedMouse)) {
|
|
queuedMouse = null;
|
|
}
|
|
queuedPointers.forEach(attemptReplayContinuousQueuedEventInMap);
|
|
queuedPointerCaptures.forEach(attemptReplayContinuousQueuedEventInMap);
|
|
}
|
|
function scheduleCallbackIfUnblocked(queuedEvent, unblocked) {
|
|
if (queuedEvent.blockedOn === unblocked) {
|
|
queuedEvent.blockedOn = null;
|
|
if (!hasScheduledReplayAttempt) {
|
|
hasScheduledReplayAttempt = true;
|
|
Scheduler.unstable_scheduleCallback(Scheduler.unstable_NormalPriority, replayUnblockedEvents);
|
|
}
|
|
}
|
|
}
|
|
function retryIfBlockedOn(unblocked) {
|
|
if (queuedDiscreteEvents.length > 0) {
|
|
scheduleCallbackIfUnblocked(queuedDiscreteEvents[0], unblocked);
|
|
for (var i = 1; i < queuedDiscreteEvents.length; i++) {
|
|
var queuedEvent = queuedDiscreteEvents[i];
|
|
if (queuedEvent.blockedOn === unblocked) {
|
|
queuedEvent.blockedOn = null;
|
|
}
|
|
}
|
|
}
|
|
if (queuedFocus !== null) {
|
|
scheduleCallbackIfUnblocked(queuedFocus, unblocked);
|
|
}
|
|
if (queuedDrag !== null) {
|
|
scheduleCallbackIfUnblocked(queuedDrag, unblocked);
|
|
}
|
|
if (queuedMouse !== null) {
|
|
scheduleCallbackIfUnblocked(queuedMouse, unblocked);
|
|
}
|
|
var unblock = function(queuedEvent2) {
|
|
return scheduleCallbackIfUnblocked(queuedEvent2, unblocked);
|
|
};
|
|
queuedPointers.forEach(unblock);
|
|
queuedPointerCaptures.forEach(unblock);
|
|
for (var _i = 0; _i < queuedExplicitHydrationTargets.length; _i++) {
|
|
var queuedTarget = queuedExplicitHydrationTargets[_i];
|
|
if (queuedTarget.blockedOn === unblocked) {
|
|
queuedTarget.blockedOn = null;
|
|
}
|
|
}
|
|
while (queuedExplicitHydrationTargets.length > 0) {
|
|
var nextExplicitTarget = queuedExplicitHydrationTargets[0];
|
|
if (nextExplicitTarget.blockedOn !== null) {
|
|
break;
|
|
} else {
|
|
attemptExplicitHydrationTarget(nextExplicitTarget);
|
|
if (nextExplicitTarget.blockedOn === null) {
|
|
queuedExplicitHydrationTargets.shift();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig;
|
|
var _enabled = true;
|
|
function setEnabled(enabled) {
|
|
_enabled = !!enabled;
|
|
}
|
|
function isEnabled() {
|
|
return _enabled;
|
|
}
|
|
function createEventListenerWrapperWithPriority(targetContainer, domEventName, eventSystemFlags) {
|
|
var eventPriority = getEventPriority(domEventName);
|
|
var listenerWrapper;
|
|
switch (eventPriority) {
|
|
case DiscreteEventPriority:
|
|
listenerWrapper = dispatchDiscreteEvent;
|
|
break;
|
|
case ContinuousEventPriority:
|
|
listenerWrapper = dispatchContinuousEvent;
|
|
break;
|
|
case DefaultEventPriority:
|
|
default:
|
|
listenerWrapper = dispatchEvent;
|
|
break;
|
|
}
|
|
return listenerWrapper.bind(null, domEventName, eventSystemFlags, targetContainer);
|
|
}
|
|
function dispatchDiscreteEvent(domEventName, eventSystemFlags, container, nativeEvent) {
|
|
var previousPriority = getCurrentUpdatePriority();
|
|
var prevTransition = ReactCurrentBatchConfig.transition;
|
|
ReactCurrentBatchConfig.transition = null;
|
|
try {
|
|
setCurrentUpdatePriority(DiscreteEventPriority);
|
|
dispatchEvent(domEventName, eventSystemFlags, container, nativeEvent);
|
|
} finally {
|
|
setCurrentUpdatePriority(previousPriority);
|
|
ReactCurrentBatchConfig.transition = prevTransition;
|
|
}
|
|
}
|
|
function dispatchContinuousEvent(domEventName, eventSystemFlags, container, nativeEvent) {
|
|
var previousPriority = getCurrentUpdatePriority();
|
|
var prevTransition = ReactCurrentBatchConfig.transition;
|
|
ReactCurrentBatchConfig.transition = null;
|
|
try {
|
|
setCurrentUpdatePriority(ContinuousEventPriority);
|
|
dispatchEvent(domEventName, eventSystemFlags, container, nativeEvent);
|
|
} finally {
|
|
setCurrentUpdatePriority(previousPriority);
|
|
ReactCurrentBatchConfig.transition = prevTransition;
|
|
}
|
|
}
|
|
function dispatchEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent) {
|
|
if (!_enabled) {
|
|
return;
|
|
}
|
|
{
|
|
dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay(domEventName, eventSystemFlags, targetContainer, nativeEvent);
|
|
}
|
|
}
|
|
function dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay(domEventName, eventSystemFlags, targetContainer, nativeEvent) {
|
|
var blockedOn = findInstanceBlockingEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent);
|
|
if (blockedOn === null) {
|
|
dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, return_targetInst, targetContainer);
|
|
clearIfContinuousEvent(domEventName, nativeEvent);
|
|
return;
|
|
}
|
|
if (queueIfContinuousEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent)) {
|
|
nativeEvent.stopPropagation();
|
|
return;
|
|
}
|
|
clearIfContinuousEvent(domEventName, nativeEvent);
|
|
if (eventSystemFlags & IS_CAPTURE_PHASE && isDiscreteEventThatRequiresHydration(domEventName)) {
|
|
while (blockedOn !== null) {
|
|
var fiber = getInstanceFromNode(blockedOn);
|
|
if (fiber !== null) {
|
|
attemptSynchronousHydration(fiber);
|
|
}
|
|
var nextBlockedOn = findInstanceBlockingEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent);
|
|
if (nextBlockedOn === null) {
|
|
dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, return_targetInst, targetContainer);
|
|
}
|
|
if (nextBlockedOn === blockedOn) {
|
|
break;
|
|
}
|
|
blockedOn = nextBlockedOn;
|
|
}
|
|
if (blockedOn !== null) {
|
|
nativeEvent.stopPropagation();
|
|
}
|
|
return;
|
|
}
|
|
dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, null, targetContainer);
|
|
}
|
|
var return_targetInst = null;
|
|
function findInstanceBlockingEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent) {
|
|
return_targetInst = null;
|
|
var nativeEventTarget = getEventTarget(nativeEvent);
|
|
var targetInst = getClosestInstanceFromNode(nativeEventTarget);
|
|
if (targetInst !== null) {
|
|
var nearestMounted = getNearestMountedFiber(targetInst);
|
|
if (nearestMounted === null) {
|
|
targetInst = null;
|
|
} else {
|
|
var tag = nearestMounted.tag;
|
|
if (tag === SuspenseComponent) {
|
|
var instance = getSuspenseInstanceFromFiber(nearestMounted);
|
|
if (instance !== null) {
|
|
return instance;
|
|
}
|
|
targetInst = null;
|
|
} else if (tag === HostRoot) {
|
|
var root2 = nearestMounted.stateNode;
|
|
if (isRootDehydrated(root2)) {
|
|
return getContainerFromFiber(nearestMounted);
|
|
}
|
|
targetInst = null;
|
|
} else if (nearestMounted !== targetInst) {
|
|
targetInst = null;
|
|
}
|
|
}
|
|
}
|
|
return_targetInst = targetInst;
|
|
return null;
|
|
}
|
|
function getEventPriority(domEventName) {
|
|
switch (domEventName) {
|
|
case "cancel":
|
|
case "click":
|
|
case "close":
|
|
case "contextmenu":
|
|
case "copy":
|
|
case "cut":
|
|
case "auxclick":
|
|
case "dblclick":
|
|
case "dragend":
|
|
case "dragstart":
|
|
case "drop":
|
|
case "focusin":
|
|
case "focusout":
|
|
case "input":
|
|
case "invalid":
|
|
case "keydown":
|
|
case "keypress":
|
|
case "keyup":
|
|
case "mousedown":
|
|
case "mouseup":
|
|
case "paste":
|
|
case "pause":
|
|
case "play":
|
|
case "pointercancel":
|
|
case "pointerdown":
|
|
case "pointerup":
|
|
case "ratechange":
|
|
case "reset":
|
|
case "resize":
|
|
case "seeked":
|
|
case "submit":
|
|
case "touchcancel":
|
|
case "touchend":
|
|
case "touchstart":
|
|
case "volumechange":
|
|
case "change":
|
|
case "selectionchange":
|
|
case "textInput":
|
|
case "compositionstart":
|
|
case "compositionend":
|
|
case "compositionupdate":
|
|
case "beforeblur":
|
|
case "afterblur":
|
|
case "beforeinput":
|
|
case "blur":
|
|
case "fullscreenchange":
|
|
case "focus":
|
|
case "hashchange":
|
|
case "popstate":
|
|
case "select":
|
|
case "selectstart":
|
|
return DiscreteEventPriority;
|
|
case "drag":
|
|
case "dragenter":
|
|
case "dragexit":
|
|
case "dragleave":
|
|
case "dragover":
|
|
case "mousemove":
|
|
case "mouseout":
|
|
case "mouseover":
|
|
case "pointermove":
|
|
case "pointerout":
|
|
case "pointerover":
|
|
case "scroll":
|
|
case "toggle":
|
|
case "touchmove":
|
|
case "wheel":
|
|
case "mouseenter":
|
|
case "mouseleave":
|
|
case "pointerenter":
|
|
case "pointerleave":
|
|
return ContinuousEventPriority;
|
|
case "message": {
|
|
var schedulerPriority = getCurrentPriorityLevel();
|
|
switch (schedulerPriority) {
|
|
case ImmediatePriority:
|
|
return DiscreteEventPriority;
|
|
case UserBlockingPriority:
|
|
return ContinuousEventPriority;
|
|
case NormalPriority:
|
|
case LowPriority:
|
|
return DefaultEventPriority;
|
|
case IdlePriority:
|
|
return IdleEventPriority;
|
|
default:
|
|
return DefaultEventPriority;
|
|
}
|
|
}
|
|
default:
|
|
return DefaultEventPriority;
|
|
}
|
|
}
|
|
function addEventBubbleListener(target, eventType, listener4) {
|
|
target.addEventListener(eventType, listener4, false);
|
|
return listener4;
|
|
}
|
|
function addEventCaptureListener(target, eventType, listener4) {
|
|
target.addEventListener(eventType, listener4, true);
|
|
return listener4;
|
|
}
|
|
function addEventCaptureListenerWithPassiveFlag(target, eventType, listener4, passive) {
|
|
target.addEventListener(eventType, listener4, {
|
|
capture: true,
|
|
passive
|
|
});
|
|
return listener4;
|
|
}
|
|
function addEventBubbleListenerWithPassiveFlag(target, eventType, listener4, passive) {
|
|
target.addEventListener(eventType, listener4, {
|
|
passive
|
|
});
|
|
return listener4;
|
|
}
|
|
var root = null;
|
|
var startText = null;
|
|
var fallbackText = null;
|
|
function initialize(nativeEventTarget) {
|
|
root = nativeEventTarget;
|
|
startText = getText();
|
|
return true;
|
|
}
|
|
function reset() {
|
|
root = null;
|
|
startText = null;
|
|
fallbackText = null;
|
|
}
|
|
function getData() {
|
|
if (fallbackText) {
|
|
return fallbackText;
|
|
}
|
|
var start;
|
|
var startValue = startText;
|
|
var startLength = startValue.length;
|
|
var end3;
|
|
var endValue = getText();
|
|
var endLength = endValue.length;
|
|
for (start = 0; start < startLength; start++) {
|
|
if (startValue[start] !== endValue[start]) {
|
|
break;
|
|
}
|
|
}
|
|
var minEnd = startLength - start;
|
|
for (end3 = 1; end3 <= minEnd; end3++) {
|
|
if (startValue[startLength - end3] !== endValue[endLength - end3]) {
|
|
break;
|
|
}
|
|
}
|
|
var sliceTail = end3 > 1 ? 1 - end3 : void 0;
|
|
fallbackText = endValue.slice(start, sliceTail);
|
|
return fallbackText;
|
|
}
|
|
function getText() {
|
|
if ("value" in root) {
|
|
return root.value;
|
|
}
|
|
return root.textContent;
|
|
}
|
|
function getEventCharCode(nativeEvent) {
|
|
var charCode;
|
|
var keyCode = nativeEvent.keyCode;
|
|
if ("charCode" in nativeEvent) {
|
|
charCode = nativeEvent.charCode;
|
|
if (charCode === 0 && keyCode === 13) {
|
|
charCode = 13;
|
|
}
|
|
} else {
|
|
charCode = keyCode;
|
|
}
|
|
if (charCode === 10) {
|
|
charCode = 13;
|
|
}
|
|
if (charCode >= 32 || charCode === 13) {
|
|
return charCode;
|
|
}
|
|
return 0;
|
|
}
|
|
function functionThatReturnsTrue() {
|
|
return true;
|
|
}
|
|
function functionThatReturnsFalse() {
|
|
return false;
|
|
}
|
|
function createSyntheticEvent(Interface) {
|
|
function SyntheticBaseEvent(reactName, reactEventType, targetInst, nativeEvent, nativeEventTarget) {
|
|
this._reactName = reactName;
|
|
this._targetInst = targetInst;
|
|
this.type = reactEventType;
|
|
this.nativeEvent = nativeEvent;
|
|
this.target = nativeEventTarget;
|
|
this.currentTarget = null;
|
|
for (var _propName in Interface) {
|
|
if (!Interface.hasOwnProperty(_propName)) {
|
|
continue;
|
|
}
|
|
var normalize = Interface[_propName];
|
|
if (normalize) {
|
|
this[_propName] = normalize(nativeEvent);
|
|
} else {
|
|
this[_propName] = nativeEvent[_propName];
|
|
}
|
|
}
|
|
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
|
|
if (defaultPrevented) {
|
|
this.isDefaultPrevented = functionThatReturnsTrue;
|
|
} else {
|
|
this.isDefaultPrevented = functionThatReturnsFalse;
|
|
}
|
|
this.isPropagationStopped = functionThatReturnsFalse;
|
|
return this;
|
|
}
|
|
assign2(SyntheticBaseEvent.prototype, {
|
|
preventDefault: function() {
|
|
this.defaultPrevented = true;
|
|
var event = this.nativeEvent;
|
|
if (!event) {
|
|
return;
|
|
}
|
|
if (event.preventDefault) {
|
|
event.preventDefault();
|
|
} else if (typeof event.returnValue !== "unknown") {
|
|
event.returnValue = false;
|
|
}
|
|
this.isDefaultPrevented = functionThatReturnsTrue;
|
|
},
|
|
stopPropagation: function() {
|
|
var event = this.nativeEvent;
|
|
if (!event) {
|
|
return;
|
|
}
|
|
if (event.stopPropagation) {
|
|
event.stopPropagation();
|
|
} else if (typeof event.cancelBubble !== "unknown") {
|
|
event.cancelBubble = true;
|
|
}
|
|
this.isPropagationStopped = functionThatReturnsTrue;
|
|
},
|
|
persist: function() {
|
|
},
|
|
isPersistent: functionThatReturnsTrue
|
|
});
|
|
return SyntheticBaseEvent;
|
|
}
|
|
var EventInterface = {
|
|
eventPhase: 0,
|
|
bubbles: 0,
|
|
cancelable: 0,
|
|
timeStamp: function(event) {
|
|
return event.timeStamp || Date.now();
|
|
},
|
|
defaultPrevented: 0,
|
|
isTrusted: 0
|
|
};
|
|
var SyntheticEvent = createSyntheticEvent(EventInterface);
|
|
var UIEventInterface = assign2({}, EventInterface, {
|
|
view: 0,
|
|
detail: 0
|
|
});
|
|
var SyntheticUIEvent = createSyntheticEvent(UIEventInterface);
|
|
var lastMovementX;
|
|
var lastMovementY;
|
|
var lastMouseEvent;
|
|
function updateMouseMovementPolyfillState(event) {
|
|
if (event !== lastMouseEvent) {
|
|
if (lastMouseEvent && event.type === "mousemove") {
|
|
lastMovementX = event.screenX - lastMouseEvent.screenX;
|
|
lastMovementY = event.screenY - lastMouseEvent.screenY;
|
|
} else {
|
|
lastMovementX = 0;
|
|
lastMovementY = 0;
|
|
}
|
|
lastMouseEvent = event;
|
|
}
|
|
}
|
|
var MouseEventInterface = assign2({}, UIEventInterface, {
|
|
screenX: 0,
|
|
screenY: 0,
|
|
clientX: 0,
|
|
clientY: 0,
|
|
pageX: 0,
|
|
pageY: 0,
|
|
ctrlKey: 0,
|
|
shiftKey: 0,
|
|
altKey: 0,
|
|
metaKey: 0,
|
|
getModifierState: getEventModifierState,
|
|
button: 0,
|
|
buttons: 0,
|
|
relatedTarget: function(event) {
|
|
if (event.relatedTarget === void 0)
|
|
return event.fromElement === event.srcElement ? event.toElement : event.fromElement;
|
|
return event.relatedTarget;
|
|
},
|
|
movementX: function(event) {
|
|
if ("movementX" in event) {
|
|
return event.movementX;
|
|
}
|
|
updateMouseMovementPolyfillState(event);
|
|
return lastMovementX;
|
|
},
|
|
movementY: function(event) {
|
|
if ("movementY" in event) {
|
|
return event.movementY;
|
|
}
|
|
return lastMovementY;
|
|
}
|
|
});
|
|
var SyntheticMouseEvent = createSyntheticEvent(MouseEventInterface);
|
|
var DragEventInterface = assign2({}, MouseEventInterface, {
|
|
dataTransfer: 0
|
|
});
|
|
var SyntheticDragEvent = createSyntheticEvent(DragEventInterface);
|
|
var FocusEventInterface = assign2({}, UIEventInterface, {
|
|
relatedTarget: 0
|
|
});
|
|
var SyntheticFocusEvent = createSyntheticEvent(FocusEventInterface);
|
|
var AnimationEventInterface = assign2({}, EventInterface, {
|
|
animationName: 0,
|
|
elapsedTime: 0,
|
|
pseudoElement: 0
|
|
});
|
|
var SyntheticAnimationEvent = createSyntheticEvent(AnimationEventInterface);
|
|
var ClipboardEventInterface = assign2({}, EventInterface, {
|
|
clipboardData: function(event) {
|
|
return "clipboardData" in event ? event.clipboardData : window.clipboardData;
|
|
}
|
|
});
|
|
var SyntheticClipboardEvent = createSyntheticEvent(ClipboardEventInterface);
|
|
var CompositionEventInterface = assign2({}, EventInterface, {
|
|
data: 0
|
|
});
|
|
var SyntheticCompositionEvent = createSyntheticEvent(CompositionEventInterface);
|
|
var SyntheticInputEvent = SyntheticCompositionEvent;
|
|
var normalizeKey = {
|
|
Esc: "Escape",
|
|
Spacebar: " ",
|
|
Left: "ArrowLeft",
|
|
Up: "ArrowUp",
|
|
Right: "ArrowRight",
|
|
Down: "ArrowDown",
|
|
Del: "Delete",
|
|
Win: "OS",
|
|
Menu: "ContextMenu",
|
|
Apps: "ContextMenu",
|
|
Scroll: "ScrollLock",
|
|
MozPrintableKey: "Unidentified"
|
|
};
|
|
var translateToKey = {
|
|
"8": "Backspace",
|
|
"9": "Tab",
|
|
"12": "Clear",
|
|
"13": "Enter",
|
|
"16": "Shift",
|
|
"17": "Control",
|
|
"18": "Alt",
|
|
"19": "Pause",
|
|
"20": "CapsLock",
|
|
"27": "Escape",
|
|
"32": " ",
|
|
"33": "PageUp",
|
|
"34": "PageDown",
|
|
"35": "End",
|
|
"36": "Home",
|
|
"37": "ArrowLeft",
|
|
"38": "ArrowUp",
|
|
"39": "ArrowRight",
|
|
"40": "ArrowDown",
|
|
"45": "Insert",
|
|
"46": "Delete",
|
|
"112": "F1",
|
|
"113": "F2",
|
|
"114": "F3",
|
|
"115": "F4",
|
|
"116": "F5",
|
|
"117": "F6",
|
|
"118": "F7",
|
|
"119": "F8",
|
|
"120": "F9",
|
|
"121": "F10",
|
|
"122": "F11",
|
|
"123": "F12",
|
|
"144": "NumLock",
|
|
"145": "ScrollLock",
|
|
"224": "Meta"
|
|
};
|
|
function getEventKey(nativeEvent) {
|
|
if (nativeEvent.key) {
|
|
var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
|
|
if (key !== "Unidentified") {
|
|
return key;
|
|
}
|
|
}
|
|
if (nativeEvent.type === "keypress") {
|
|
var charCode = getEventCharCode(nativeEvent);
|
|
return charCode === 13 ? "Enter" : String.fromCharCode(charCode);
|
|
}
|
|
if (nativeEvent.type === "keydown" || nativeEvent.type === "keyup") {
|
|
return translateToKey[nativeEvent.keyCode] || "Unidentified";
|
|
}
|
|
return "";
|
|
}
|
|
var modifierKeyToProp = {
|
|
Alt: "altKey",
|
|
Control: "ctrlKey",
|
|
Meta: "metaKey",
|
|
Shift: "shiftKey"
|
|
};
|
|
function modifierStateGetter(keyArg) {
|
|
var syntheticEvent = this;
|
|
var nativeEvent = syntheticEvent.nativeEvent;
|
|
if (nativeEvent.getModifierState) {
|
|
return nativeEvent.getModifierState(keyArg);
|
|
}
|
|
var keyProp = modifierKeyToProp[keyArg];
|
|
return keyProp ? !!nativeEvent[keyProp] : false;
|
|
}
|
|
function getEventModifierState(nativeEvent) {
|
|
return modifierStateGetter;
|
|
}
|
|
var KeyboardEventInterface = assign2({}, UIEventInterface, {
|
|
key: getEventKey,
|
|
code: 0,
|
|
location: 0,
|
|
ctrlKey: 0,
|
|
shiftKey: 0,
|
|
altKey: 0,
|
|
metaKey: 0,
|
|
repeat: 0,
|
|
locale: 0,
|
|
getModifierState: getEventModifierState,
|
|
charCode: function(event) {
|
|
if (event.type === "keypress") {
|
|
return getEventCharCode(event);
|
|
}
|
|
return 0;
|
|
},
|
|
keyCode: function(event) {
|
|
if (event.type === "keydown" || event.type === "keyup") {
|
|
return event.keyCode;
|
|
}
|
|
return 0;
|
|
},
|
|
which: function(event) {
|
|
if (event.type === "keypress") {
|
|
return getEventCharCode(event);
|
|
}
|
|
if (event.type === "keydown" || event.type === "keyup") {
|
|
return event.keyCode;
|
|
}
|
|
return 0;
|
|
}
|
|
});
|
|
var SyntheticKeyboardEvent = createSyntheticEvent(KeyboardEventInterface);
|
|
var PointerEventInterface = assign2({}, MouseEventInterface, {
|
|
pointerId: 0,
|
|
width: 0,
|
|
height: 0,
|
|
pressure: 0,
|
|
tangentialPressure: 0,
|
|
tiltX: 0,
|
|
tiltY: 0,
|
|
twist: 0,
|
|
pointerType: 0,
|
|
isPrimary: 0
|
|
});
|
|
var SyntheticPointerEvent = createSyntheticEvent(PointerEventInterface);
|
|
var TouchEventInterface = assign2({}, UIEventInterface, {
|
|
touches: 0,
|
|
targetTouches: 0,
|
|
changedTouches: 0,
|
|
altKey: 0,
|
|
metaKey: 0,
|
|
ctrlKey: 0,
|
|
shiftKey: 0,
|
|
getModifierState: getEventModifierState
|
|
});
|
|
var SyntheticTouchEvent = createSyntheticEvent(TouchEventInterface);
|
|
var TransitionEventInterface = assign2({}, EventInterface, {
|
|
propertyName: 0,
|
|
elapsedTime: 0,
|
|
pseudoElement: 0
|
|
});
|
|
var SyntheticTransitionEvent = createSyntheticEvent(TransitionEventInterface);
|
|
var WheelEventInterface = assign2({}, MouseEventInterface, {
|
|
deltaX: function(event) {
|
|
return "deltaX" in event ? event.deltaX : "wheelDeltaX" in event ? -event.wheelDeltaX : 0;
|
|
},
|
|
deltaY: function(event) {
|
|
return "deltaY" in event ? event.deltaY : "wheelDeltaY" in event ? -event.wheelDeltaY : "wheelDelta" in event ? -event.wheelDelta : 0;
|
|
},
|
|
deltaZ: 0,
|
|
deltaMode: 0
|
|
});
|
|
var SyntheticWheelEvent = createSyntheticEvent(WheelEventInterface);
|
|
var END_KEYCODES = [9, 13, 27, 32];
|
|
var START_KEYCODE = 229;
|
|
var canUseCompositionEvent = canUseDOM2 && "CompositionEvent" in window;
|
|
var documentMode = null;
|
|
if (canUseDOM2 && "documentMode" in document) {
|
|
documentMode = document.documentMode;
|
|
}
|
|
var canUseTextInputEvent = canUseDOM2 && "TextEvent" in window && !documentMode;
|
|
var useFallbackCompositionData = canUseDOM2 && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
|
|
var SPACEBAR_CODE = 32;
|
|
var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
|
|
function registerEvents() {
|
|
registerTwoPhaseEvent("onBeforeInput", ["compositionend", "keypress", "textInput", "paste"]);
|
|
registerTwoPhaseEvent("onCompositionEnd", ["compositionend", "focusout", "keydown", "keypress", "keyup", "mousedown"]);
|
|
registerTwoPhaseEvent("onCompositionStart", ["compositionstart", "focusout", "keydown", "keypress", "keyup", "mousedown"]);
|
|
registerTwoPhaseEvent("onCompositionUpdate", ["compositionupdate", "focusout", "keydown", "keypress", "keyup", "mousedown"]);
|
|
}
|
|
var hasSpaceKeypress = false;
|
|
function isKeypressCommand(nativeEvent) {
|
|
return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && !(nativeEvent.ctrlKey && nativeEvent.altKey);
|
|
}
|
|
function getCompositionEventType(domEventName) {
|
|
switch (domEventName) {
|
|
case "compositionstart":
|
|
return "onCompositionStart";
|
|
case "compositionend":
|
|
return "onCompositionEnd";
|
|
case "compositionupdate":
|
|
return "onCompositionUpdate";
|
|
}
|
|
}
|
|
function isFallbackCompositionStart(domEventName, nativeEvent) {
|
|
return domEventName === "keydown" && nativeEvent.keyCode === START_KEYCODE;
|
|
}
|
|
function isFallbackCompositionEnd(domEventName, nativeEvent) {
|
|
switch (domEventName) {
|
|
case "keyup":
|
|
return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
|
|
case "keydown":
|
|
return nativeEvent.keyCode !== START_KEYCODE;
|
|
case "keypress":
|
|
case "mousedown":
|
|
case "focusout":
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
function getDataFromCustomEvent(nativeEvent) {
|
|
var detail = nativeEvent.detail;
|
|
if (typeof detail === "object" && "data" in detail) {
|
|
return detail.data;
|
|
}
|
|
return null;
|
|
}
|
|
function isUsingKoreanIME(nativeEvent) {
|
|
return nativeEvent.locale === "ko";
|
|
}
|
|
var isComposing = false;
|
|
function extractCompositionEvent(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget) {
|
|
var eventType;
|
|
var fallbackData;
|
|
if (canUseCompositionEvent) {
|
|
eventType = getCompositionEventType(domEventName);
|
|
} else if (!isComposing) {
|
|
if (isFallbackCompositionStart(domEventName, nativeEvent)) {
|
|
eventType = "onCompositionStart";
|
|
}
|
|
} else if (isFallbackCompositionEnd(domEventName, nativeEvent)) {
|
|
eventType = "onCompositionEnd";
|
|
}
|
|
if (!eventType) {
|
|
return null;
|
|
}
|
|
if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) {
|
|
if (!isComposing && eventType === "onCompositionStart") {
|
|
isComposing = initialize(nativeEventTarget);
|
|
} else if (eventType === "onCompositionEnd") {
|
|
if (isComposing) {
|
|
fallbackData = getData();
|
|
}
|
|
}
|
|
}
|
|
var listeners = accumulateTwoPhaseListeners(targetInst, eventType);
|
|
if (listeners.length > 0) {
|
|
var event = new SyntheticCompositionEvent(eventType, domEventName, null, nativeEvent, nativeEventTarget);
|
|
dispatchQueue.push({
|
|
event,
|
|
listeners
|
|
});
|
|
if (fallbackData) {
|
|
event.data = fallbackData;
|
|
} else {
|
|
var customData = getDataFromCustomEvent(nativeEvent);
|
|
if (customData !== null) {
|
|
event.data = customData;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function getNativeBeforeInputChars(domEventName, nativeEvent) {
|
|
switch (domEventName) {
|
|
case "compositionend":
|
|
return getDataFromCustomEvent(nativeEvent);
|
|
case "keypress":
|
|
var which = nativeEvent.which;
|
|
if (which !== SPACEBAR_CODE) {
|
|
return null;
|
|
}
|
|
hasSpaceKeypress = true;
|
|
return SPACEBAR_CHAR;
|
|
case "textInput":
|
|
var chars = nativeEvent.data;
|
|
if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
|
|
return null;
|
|
}
|
|
return chars;
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
function getFallbackBeforeInputChars(domEventName, nativeEvent) {
|
|
if (isComposing) {
|
|
if (domEventName === "compositionend" || !canUseCompositionEvent && isFallbackCompositionEnd(domEventName, nativeEvent)) {
|
|
var chars = getData();
|
|
reset();
|
|
isComposing = false;
|
|
return chars;
|
|
}
|
|
return null;
|
|
}
|
|
switch (domEventName) {
|
|
case "paste":
|
|
return null;
|
|
case "keypress":
|
|
if (!isKeypressCommand(nativeEvent)) {
|
|
if (nativeEvent.char && nativeEvent.char.length > 1) {
|
|
return nativeEvent.char;
|
|
} else if (nativeEvent.which) {
|
|
return String.fromCharCode(nativeEvent.which);
|
|
}
|
|
}
|
|
return null;
|
|
case "compositionend":
|
|
return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data;
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
function extractBeforeInputEvent(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget) {
|
|
var chars;
|
|
if (canUseTextInputEvent) {
|
|
chars = getNativeBeforeInputChars(domEventName, nativeEvent);
|
|
} else {
|
|
chars = getFallbackBeforeInputChars(domEventName, nativeEvent);
|
|
}
|
|
if (!chars) {
|
|
return null;
|
|
}
|
|
var listeners = accumulateTwoPhaseListeners(targetInst, "onBeforeInput");
|
|
if (listeners.length > 0) {
|
|
var event = new SyntheticInputEvent("onBeforeInput", "beforeinput", null, nativeEvent, nativeEventTarget);
|
|
dispatchQueue.push({
|
|
event,
|
|
listeners
|
|
});
|
|
event.data = chars;
|
|
}
|
|
}
|
|
function extractEvents(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) {
|
|
extractCompositionEvent(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
|
|
extractBeforeInputEvent(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
|
|
}
|
|
var supportedInputTypes = {
|
|
color: true,
|
|
date: true,
|
|
datetime: true,
|
|
"datetime-local": true,
|
|
email: true,
|
|
month: true,
|
|
number: true,
|
|
password: true,
|
|
range: true,
|
|
search: true,
|
|
tel: true,
|
|
text: true,
|
|
time: true,
|
|
url: true,
|
|
week: true
|
|
};
|
|
function isTextInputElement(elem) {
|
|
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
|
|
if (nodeName === "input") {
|
|
return !!supportedInputTypes[elem.type];
|
|
}
|
|
if (nodeName === "textarea") {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
function isEventSupported(eventNameSuffix) {
|
|
if (!canUseDOM2) {
|
|
return false;
|
|
}
|
|
var eventName = "on" + eventNameSuffix;
|
|
var isSupported = eventName in document;
|
|
if (!isSupported) {
|
|
var element = document.createElement("div");
|
|
element.setAttribute(eventName, "return;");
|
|
isSupported = typeof element[eventName] === "function";
|
|
}
|
|
return isSupported;
|
|
}
|
|
function registerEvents$1() {
|
|
registerTwoPhaseEvent("onChange", ["change", "click", "focusin", "focusout", "input", "keydown", "keyup", "selectionchange"]);
|
|
}
|
|
function createAndAccumulateChangeEvent(dispatchQueue, inst, nativeEvent, target) {
|
|
enqueueStateRestore(target);
|
|
var listeners = accumulateTwoPhaseListeners(inst, "onChange");
|
|
if (listeners.length > 0) {
|
|
var event = new SyntheticEvent("onChange", "change", null, nativeEvent, target);
|
|
dispatchQueue.push({
|
|
event,
|
|
listeners
|
|
});
|
|
}
|
|
}
|
|
var activeElement = null;
|
|
var activeElementInst = null;
|
|
function shouldUseChangeEvent(elem) {
|
|
var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
|
|
return nodeName === "select" || nodeName === "input" && elem.type === "file";
|
|
}
|
|
function manualDispatchChangeEvent(nativeEvent) {
|
|
var dispatchQueue = [];
|
|
createAndAccumulateChangeEvent(dispatchQueue, activeElementInst, nativeEvent, getEventTarget(nativeEvent));
|
|
batchedUpdates(runEventInBatch, dispatchQueue);
|
|
}
|
|
function runEventInBatch(dispatchQueue) {
|
|
processDispatchQueue(dispatchQueue, 0);
|
|
}
|
|
function getInstIfValueChanged(targetInst) {
|
|
var targetNode = getNodeFromInstance(targetInst);
|
|
if (updateValueIfChanged(targetNode)) {
|
|
return targetInst;
|
|
}
|
|
}
|
|
function getTargetInstForChangeEvent(domEventName, targetInst) {
|
|
if (domEventName === "change") {
|
|
return targetInst;
|
|
}
|
|
}
|
|
var isInputEventSupported = false;
|
|
if (canUseDOM2) {
|
|
isInputEventSupported = isEventSupported("input") && (!document.documentMode || document.documentMode > 9);
|
|
}
|
|
function startWatchingForValueChange(target, targetInst) {
|
|
activeElement = target;
|
|
activeElementInst = targetInst;
|
|
activeElement.attachEvent("onpropertychange", handlePropertyChange);
|
|
}
|
|
function stopWatchingForValueChange() {
|
|
if (!activeElement) {
|
|
return;
|
|
}
|
|
activeElement.detachEvent("onpropertychange", handlePropertyChange);
|
|
activeElement = null;
|
|
activeElementInst = null;
|
|
}
|
|
function handlePropertyChange(nativeEvent) {
|
|
if (nativeEvent.propertyName !== "value") {
|
|
return;
|
|
}
|
|
if (getInstIfValueChanged(activeElementInst)) {
|
|
manualDispatchChangeEvent(nativeEvent);
|
|
}
|
|
}
|
|
function handleEventsForInputEventPolyfill(domEventName, target, targetInst) {
|
|
if (domEventName === "focusin") {
|
|
stopWatchingForValueChange();
|
|
startWatchingForValueChange(target, targetInst);
|
|
} else if (domEventName === "focusout") {
|
|
stopWatchingForValueChange();
|
|
}
|
|
}
|
|
function getTargetInstForInputEventPolyfill(domEventName, targetInst) {
|
|
if (domEventName === "selectionchange" || domEventName === "keyup" || domEventName === "keydown") {
|
|
return getInstIfValueChanged(activeElementInst);
|
|
}
|
|
}
|
|
function shouldUseClickEvent(elem) {
|
|
var nodeName = elem.nodeName;
|
|
return nodeName && nodeName.toLowerCase() === "input" && (elem.type === "checkbox" || elem.type === "radio");
|
|
}
|
|
function getTargetInstForClickEvent(domEventName, targetInst) {
|
|
if (domEventName === "click") {
|
|
return getInstIfValueChanged(targetInst);
|
|
}
|
|
}
|
|
function getTargetInstForInputOrChangeEvent(domEventName, targetInst) {
|
|
if (domEventName === "input" || domEventName === "change") {
|
|
return getInstIfValueChanged(targetInst);
|
|
}
|
|
}
|
|
function handleControlledInputBlur(node) {
|
|
var state = node._wrapperState;
|
|
if (!state || !state.controlled || node.type !== "number") {
|
|
return;
|
|
}
|
|
{
|
|
setDefaultValue(node, "number", node.value);
|
|
}
|
|
}
|
|
function extractEvents$1(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) {
|
|
var targetNode = targetInst ? getNodeFromInstance(targetInst) : window;
|
|
var getTargetInstFunc, handleEventFunc;
|
|
if (shouldUseChangeEvent(targetNode)) {
|
|
getTargetInstFunc = getTargetInstForChangeEvent;
|
|
} else if (isTextInputElement(targetNode)) {
|
|
if (isInputEventSupported) {
|
|
getTargetInstFunc = getTargetInstForInputOrChangeEvent;
|
|
} else {
|
|
getTargetInstFunc = getTargetInstForInputEventPolyfill;
|
|
handleEventFunc = handleEventsForInputEventPolyfill;
|
|
}
|
|
} else if (shouldUseClickEvent(targetNode)) {
|
|
getTargetInstFunc = getTargetInstForClickEvent;
|
|
}
|
|
if (getTargetInstFunc) {
|
|
var inst = getTargetInstFunc(domEventName, targetInst);
|
|
if (inst) {
|
|
createAndAccumulateChangeEvent(dispatchQueue, inst, nativeEvent, nativeEventTarget);
|
|
return;
|
|
}
|
|
}
|
|
if (handleEventFunc) {
|
|
handleEventFunc(domEventName, targetNode, targetInst);
|
|
}
|
|
if (domEventName === "focusout") {
|
|
handleControlledInputBlur(targetNode);
|
|
}
|
|
}
|
|
function registerEvents$2() {
|
|
registerDirectEvent("onMouseEnter", ["mouseout", "mouseover"]);
|
|
registerDirectEvent("onMouseLeave", ["mouseout", "mouseover"]);
|
|
registerDirectEvent("onPointerEnter", ["pointerout", "pointerover"]);
|
|
registerDirectEvent("onPointerLeave", ["pointerout", "pointerover"]);
|
|
}
|
|
function extractEvents$2(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) {
|
|
var isOverEvent = domEventName === "mouseover" || domEventName === "pointerover";
|
|
var isOutEvent = domEventName === "mouseout" || domEventName === "pointerout";
|
|
if (isOverEvent && !isReplayingEvent(nativeEvent)) {
|
|
var related = nativeEvent.relatedTarget || nativeEvent.fromElement;
|
|
if (related) {
|
|
if (getClosestInstanceFromNode(related) || isContainerMarkedAsRoot(related)) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
if (!isOutEvent && !isOverEvent) {
|
|
return;
|
|
}
|
|
var win;
|
|
if (nativeEventTarget.window === nativeEventTarget) {
|
|
win = nativeEventTarget;
|
|
} else {
|
|
var doc = nativeEventTarget.ownerDocument;
|
|
if (doc) {
|
|
win = doc.defaultView || doc.parentWindow;
|
|
} else {
|
|
win = window;
|
|
}
|
|
}
|
|
var from;
|
|
var to;
|
|
if (isOutEvent) {
|
|
var _related = nativeEvent.relatedTarget || nativeEvent.toElement;
|
|
from = targetInst;
|
|
to = _related ? getClosestInstanceFromNode(_related) : null;
|
|
if (to !== null) {
|
|
var nearestMounted = getNearestMountedFiber(to);
|
|
if (to !== nearestMounted || to.tag !== HostComponent && to.tag !== HostText) {
|
|
to = null;
|
|
}
|
|
}
|
|
} else {
|
|
from = null;
|
|
to = targetInst;
|
|
}
|
|
if (from === to) {
|
|
return;
|
|
}
|
|
var SyntheticEventCtor = SyntheticMouseEvent;
|
|
var leaveEventType = "onMouseLeave";
|
|
var enterEventType = "onMouseEnter";
|
|
var eventTypePrefix = "mouse";
|
|
if (domEventName === "pointerout" || domEventName === "pointerover") {
|
|
SyntheticEventCtor = SyntheticPointerEvent;
|
|
leaveEventType = "onPointerLeave";
|
|
enterEventType = "onPointerEnter";
|
|
eventTypePrefix = "pointer";
|
|
}
|
|
var fromNode = from == null ? win : getNodeFromInstance(from);
|
|
var toNode = to == null ? win : getNodeFromInstance(to);
|
|
var leave = new SyntheticEventCtor(leaveEventType, eventTypePrefix + "leave", from, nativeEvent, nativeEventTarget);
|
|
leave.target = fromNode;
|
|
leave.relatedTarget = toNode;
|
|
var enter = null;
|
|
var nativeTargetInst = getClosestInstanceFromNode(nativeEventTarget);
|
|
if (nativeTargetInst === targetInst) {
|
|
var enterEvent = new SyntheticEventCtor(enterEventType, eventTypePrefix + "enter", to, nativeEvent, nativeEventTarget);
|
|
enterEvent.target = toNode;
|
|
enterEvent.relatedTarget = fromNode;
|
|
enter = enterEvent;
|
|
}
|
|
accumulateEnterLeaveTwoPhaseListeners(dispatchQueue, leave, enter, from, to);
|
|
}
|
|
function is2(x, y) {
|
|
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
|
|
}
|
|
var objectIs = typeof Object.is === "function" ? Object.is : is2;
|
|
function shallowEqual(objA, objB) {
|
|
if (objectIs(objA, objB)) {
|
|
return true;
|
|
}
|
|
if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
|
|
return false;
|
|
}
|
|
var keysA = Object.keys(objA);
|
|
var keysB = Object.keys(objB);
|
|
if (keysA.length !== keysB.length) {
|
|
return false;
|
|
}
|
|
for (var i = 0; i < keysA.length; i++) {
|
|
var currentKey = keysA[i];
|
|
if (!hasOwnProperty2.call(objB, currentKey) || !objectIs(objA[currentKey], objB[currentKey])) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
function getLeafNode(node) {
|
|
while (node && node.firstChild) {
|
|
node = node.firstChild;
|
|
}
|
|
return node;
|
|
}
|
|
function getSiblingNode(node) {
|
|
while (node) {
|
|
if (node.nextSibling) {
|
|
return node.nextSibling;
|
|
}
|
|
node = node.parentNode;
|
|
}
|
|
}
|
|
function getNodeForCharacterOffset(root2, offset) {
|
|
var node = getLeafNode(root2);
|
|
var nodeStart = 0;
|
|
var nodeEnd = 0;
|
|
while (node) {
|
|
if (node.nodeType === TEXT_NODE) {
|
|
nodeEnd = nodeStart + node.textContent.length;
|
|
if (nodeStart <= offset && nodeEnd >= offset) {
|
|
return {
|
|
node,
|
|
offset: offset - nodeStart
|
|
};
|
|
}
|
|
nodeStart = nodeEnd;
|
|
}
|
|
node = getLeafNode(getSiblingNode(node));
|
|
}
|
|
}
|
|
function getOffsets(outerNode) {
|
|
var ownerDocument = outerNode.ownerDocument;
|
|
var win = ownerDocument && ownerDocument.defaultView || window;
|
|
var selection = win.getSelection && win.getSelection();
|
|
if (!selection || selection.rangeCount === 0) {
|
|
return null;
|
|
}
|
|
var anchorNode = selection.anchorNode, anchorOffset = selection.anchorOffset, focusNode = selection.focusNode, focusOffset = selection.focusOffset;
|
|
try {
|
|
anchorNode.nodeType;
|
|
focusNode.nodeType;
|
|
} catch (e) {
|
|
return null;
|
|
}
|
|
return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset);
|
|
}
|
|
function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) {
|
|
var length = 0;
|
|
var start = -1;
|
|
var end3 = -1;
|
|
var indexWithinAnchor = 0;
|
|
var indexWithinFocus = 0;
|
|
var node = outerNode;
|
|
var parentNode = null;
|
|
outer:
|
|
while (true) {
|
|
var next = null;
|
|
while (true) {
|
|
if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) {
|
|
start = length + anchorOffset;
|
|
}
|
|
if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) {
|
|
end3 = length + focusOffset;
|
|
}
|
|
if (node.nodeType === TEXT_NODE) {
|
|
length += node.nodeValue.length;
|
|
}
|
|
if ((next = node.firstChild) === null) {
|
|
break;
|
|
}
|
|
parentNode = node;
|
|
node = next;
|
|
}
|
|
while (true) {
|
|
if (node === outerNode) {
|
|
break outer;
|
|
}
|
|
if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) {
|
|
start = length;
|
|
}
|
|
if (parentNode === focusNode && ++indexWithinFocus === focusOffset) {
|
|
end3 = length;
|
|
}
|
|
if ((next = node.nextSibling) !== null) {
|
|
break;
|
|
}
|
|
node = parentNode;
|
|
parentNode = node.parentNode;
|
|
}
|
|
node = next;
|
|
}
|
|
if (start === -1 || end3 === -1) {
|
|
return null;
|
|
}
|
|
return {
|
|
start,
|
|
end: end3
|
|
};
|
|
}
|
|
function setOffsets(node, offsets) {
|
|
var doc = node.ownerDocument || document;
|
|
var win = doc && doc.defaultView || window;
|
|
if (!win.getSelection) {
|
|
return;
|
|
}
|
|
var selection = win.getSelection();
|
|
var length = node.textContent.length;
|
|
var start = Math.min(offsets.start, length);
|
|
var end3 = offsets.end === void 0 ? start : Math.min(offsets.end, length);
|
|
if (!selection.extend && start > end3) {
|
|
var temp = end3;
|
|
end3 = start;
|
|
start = temp;
|
|
}
|
|
var startMarker = getNodeForCharacterOffset(node, start);
|
|
var endMarker = getNodeForCharacterOffset(node, end3);
|
|
if (startMarker && endMarker) {
|
|
if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) {
|
|
return;
|
|
}
|
|
var range = doc.createRange();
|
|
range.setStart(startMarker.node, startMarker.offset);
|
|
selection.removeAllRanges();
|
|
if (start > end3) {
|
|
selection.addRange(range);
|
|
selection.extend(endMarker.node, endMarker.offset);
|
|
} else {
|
|
range.setEnd(endMarker.node, endMarker.offset);
|
|
selection.addRange(range);
|
|
}
|
|
}
|
|
}
|
|
function isTextNode(node) {
|
|
return node && node.nodeType === TEXT_NODE;
|
|
}
|
|
function containsNode(outerNode, innerNode) {
|
|
if (!outerNode || !innerNode) {
|
|
return false;
|
|
} else if (outerNode === innerNode) {
|
|
return true;
|
|
} else if (isTextNode(outerNode)) {
|
|
return false;
|
|
} else if (isTextNode(innerNode)) {
|
|
return containsNode(outerNode, innerNode.parentNode);
|
|
} else if ("contains" in outerNode) {
|
|
return outerNode.contains(innerNode);
|
|
} else if (outerNode.compareDocumentPosition) {
|
|
return !!(outerNode.compareDocumentPosition(innerNode) & 16);
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
function isInDocument(node) {
|
|
return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node);
|
|
}
|
|
function isSameOriginFrame(iframe) {
|
|
try {
|
|
return typeof iframe.contentWindow.location.href === "string";
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
}
|
|
function getActiveElementDeep() {
|
|
var win = window;
|
|
var element = getActiveElement();
|
|
while (element instanceof win.HTMLIFrameElement) {
|
|
if (isSameOriginFrame(element)) {
|
|
win = element.contentWindow;
|
|
} else {
|
|
return element;
|
|
}
|
|
element = getActiveElement(win.document);
|
|
}
|
|
return element;
|
|
}
|
|
function hasSelectionCapabilities(elem) {
|
|
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
|
|
return nodeName && (nodeName === "input" && (elem.type === "text" || elem.type === "search" || elem.type === "tel" || elem.type === "url" || elem.type === "password") || nodeName === "textarea" || elem.contentEditable === "true");
|
|
}
|
|
function getSelectionInformation() {
|
|
var focusedElem = getActiveElementDeep();
|
|
return {
|
|
focusedElem,
|
|
selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection(focusedElem) : null
|
|
};
|
|
}
|
|
function restoreSelection(priorSelectionInformation) {
|
|
var curFocusedElem = getActiveElementDeep();
|
|
var priorFocusedElem = priorSelectionInformation.focusedElem;
|
|
var priorSelectionRange = priorSelectionInformation.selectionRange;
|
|
if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
|
|
if (priorSelectionRange !== null && hasSelectionCapabilities(priorFocusedElem)) {
|
|
setSelection(priorFocusedElem, priorSelectionRange);
|
|
}
|
|
var ancestors = [];
|
|
var ancestor = priorFocusedElem;
|
|
while (ancestor = ancestor.parentNode) {
|
|
if (ancestor.nodeType === ELEMENT_NODE) {
|
|
ancestors.push({
|
|
element: ancestor,
|
|
left: ancestor.scrollLeft,
|
|
top: ancestor.scrollTop
|
|
});
|
|
}
|
|
}
|
|
if (typeof priorFocusedElem.focus === "function") {
|
|
priorFocusedElem.focus();
|
|
}
|
|
for (var i = 0; i < ancestors.length; i++) {
|
|
var info = ancestors[i];
|
|
info.element.scrollLeft = info.left;
|
|
info.element.scrollTop = info.top;
|
|
}
|
|
}
|
|
}
|
|
function getSelection(input) {
|
|
var selection;
|
|
if ("selectionStart" in input) {
|
|
selection = {
|
|
start: input.selectionStart,
|
|
end: input.selectionEnd
|
|
};
|
|
} else {
|
|
selection = getOffsets(input);
|
|
}
|
|
return selection || {
|
|
start: 0,
|
|
end: 0
|
|
};
|
|
}
|
|
function setSelection(input, offsets) {
|
|
var start = offsets.start;
|
|
var end3 = offsets.end;
|
|
if (end3 === void 0) {
|
|
end3 = start;
|
|
}
|
|
if ("selectionStart" in input) {
|
|
input.selectionStart = start;
|
|
input.selectionEnd = Math.min(end3, input.value.length);
|
|
} else {
|
|
setOffsets(input, offsets);
|
|
}
|
|
}
|
|
var skipSelectionChangeEvent = canUseDOM2 && "documentMode" in document && document.documentMode <= 11;
|
|
function registerEvents$3() {
|
|
registerTwoPhaseEvent("onSelect", ["focusout", "contextmenu", "dragend", "focusin", "keydown", "keyup", "mousedown", "mouseup", "selectionchange"]);
|
|
}
|
|
var activeElement$1 = null;
|
|
var activeElementInst$1 = null;
|
|
var lastSelection = null;
|
|
var mouseDown = false;
|
|
function getSelection$1(node) {
|
|
if ("selectionStart" in node && hasSelectionCapabilities(node)) {
|
|
return {
|
|
start: node.selectionStart,
|
|
end: node.selectionEnd
|
|
};
|
|
} else {
|
|
var win = node.ownerDocument && node.ownerDocument.defaultView || window;
|
|
var selection = win.getSelection();
|
|
return {
|
|
anchorNode: selection.anchorNode,
|
|
anchorOffset: selection.anchorOffset,
|
|
focusNode: selection.focusNode,
|
|
focusOffset: selection.focusOffset
|
|
};
|
|
}
|
|
}
|
|
function getEventTargetDocument(eventTarget) {
|
|
return eventTarget.window === eventTarget ? eventTarget.document : eventTarget.nodeType === DOCUMENT_NODE ? eventTarget : eventTarget.ownerDocument;
|
|
}
|
|
function constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget) {
|
|
var doc = getEventTargetDocument(nativeEventTarget);
|
|
if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement(doc)) {
|
|
return;
|
|
}
|
|
var currentSelection = getSelection$1(activeElement$1);
|
|
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
|
|
lastSelection = currentSelection;
|
|
var listeners = accumulateTwoPhaseListeners(activeElementInst$1, "onSelect");
|
|
if (listeners.length > 0) {
|
|
var event = new SyntheticEvent("onSelect", "select", null, nativeEvent, nativeEventTarget);
|
|
dispatchQueue.push({
|
|
event,
|
|
listeners
|
|
});
|
|
event.target = activeElement$1;
|
|
}
|
|
}
|
|
}
|
|
function extractEvents$3(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) {
|
|
var targetNode = targetInst ? getNodeFromInstance(targetInst) : window;
|
|
switch (domEventName) {
|
|
case "focusin":
|
|
if (isTextInputElement(targetNode) || targetNode.contentEditable === "true") {
|
|
activeElement$1 = targetNode;
|
|
activeElementInst$1 = targetInst;
|
|
lastSelection = null;
|
|
}
|
|
break;
|
|
case "focusout":
|
|
activeElement$1 = null;
|
|
activeElementInst$1 = null;
|
|
lastSelection = null;
|
|
break;
|
|
case "mousedown":
|
|
mouseDown = true;
|
|
break;
|
|
case "contextmenu":
|
|
case "mouseup":
|
|
case "dragend":
|
|
mouseDown = false;
|
|
constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget);
|
|
break;
|
|
case "selectionchange":
|
|
if (skipSelectionChangeEvent) {
|
|
break;
|
|
}
|
|
case "keydown":
|
|
case "keyup":
|
|
constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget);
|
|
}
|
|
}
|
|
function makePrefixMap(styleProp, eventName) {
|
|
var prefixes3 = {};
|
|
prefixes3[styleProp.toLowerCase()] = eventName.toLowerCase();
|
|
prefixes3["Webkit" + styleProp] = "webkit" + eventName;
|
|
prefixes3["Moz" + styleProp] = "moz" + eventName;
|
|
return prefixes3;
|
|
}
|
|
var vendorPrefixes = {
|
|
animationend: makePrefixMap("Animation", "AnimationEnd"),
|
|
animationiteration: makePrefixMap("Animation", "AnimationIteration"),
|
|
animationstart: makePrefixMap("Animation", "AnimationStart"),
|
|
transitionend: makePrefixMap("Transition", "TransitionEnd")
|
|
};
|
|
var prefixedEventNames = {};
|
|
var style = {};
|
|
if (canUseDOM2) {
|
|
style = document.createElement("div").style;
|
|
if (!("AnimationEvent" in window)) {
|
|
delete vendorPrefixes.animationend.animation;
|
|
delete vendorPrefixes.animationiteration.animation;
|
|
delete vendorPrefixes.animationstart.animation;
|
|
}
|
|
if (!("TransitionEvent" in window)) {
|
|
delete vendorPrefixes.transitionend.transition;
|
|
}
|
|
}
|
|
function getVendorPrefixedEventName(eventName) {
|
|
if (prefixedEventNames[eventName]) {
|
|
return prefixedEventNames[eventName];
|
|
} else if (!vendorPrefixes[eventName]) {
|
|
return eventName;
|
|
}
|
|
var prefixMap = vendorPrefixes[eventName];
|
|
for (var styleProp in prefixMap) {
|
|
if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) {
|
|
return prefixedEventNames[eventName] = prefixMap[styleProp];
|
|
}
|
|
}
|
|
return eventName;
|
|
}
|
|
var ANIMATION_END = getVendorPrefixedEventName("animationend");
|
|
var ANIMATION_ITERATION = getVendorPrefixedEventName("animationiteration");
|
|
var ANIMATION_START = getVendorPrefixedEventName("animationstart");
|
|
var TRANSITION_END = getVendorPrefixedEventName("transitionend");
|
|
var topLevelEventsToReactNames = /* @__PURE__ */ new Map();
|
|
var simpleEventPluginEvents = ["abort", "auxClick", "cancel", "canPlay", "canPlayThrough", "click", "close", "contextMenu", "copy", "cut", "drag", "dragEnd", "dragEnter", "dragExit", "dragLeave", "dragOver", "dragStart", "drop", "durationChange", "emptied", "encrypted", "ended", "error", "gotPointerCapture", "input", "invalid", "keyDown", "keyPress", "keyUp", "load", "loadedData", "loadedMetadata", "loadStart", "lostPointerCapture", "mouseDown", "mouseMove", "mouseOut", "mouseOver", "mouseUp", "paste", "pause", "play", "playing", "pointerCancel", "pointerDown", "pointerMove", "pointerOut", "pointerOver", "pointerUp", "progress", "rateChange", "reset", "resize", "seeked", "seeking", "stalled", "submit", "suspend", "timeUpdate", "touchCancel", "touchEnd", "touchStart", "volumeChange", "scroll", "toggle", "touchMove", "waiting", "wheel"];
|
|
function registerSimpleEvent(domEventName, reactName) {
|
|
topLevelEventsToReactNames.set(domEventName, reactName);
|
|
registerTwoPhaseEvent(reactName, [domEventName]);
|
|
}
|
|
function registerSimpleEvents() {
|
|
for (var i = 0; i < simpleEventPluginEvents.length; i++) {
|
|
var eventName = simpleEventPluginEvents[i];
|
|
var domEventName = eventName.toLowerCase();
|
|
var capitalizedEvent = eventName[0].toUpperCase() + eventName.slice(1);
|
|
registerSimpleEvent(domEventName, "on" + capitalizedEvent);
|
|
}
|
|
registerSimpleEvent(ANIMATION_END, "onAnimationEnd");
|
|
registerSimpleEvent(ANIMATION_ITERATION, "onAnimationIteration");
|
|
registerSimpleEvent(ANIMATION_START, "onAnimationStart");
|
|
registerSimpleEvent("dblclick", "onDoubleClick");
|
|
registerSimpleEvent("focusin", "onFocus");
|
|
registerSimpleEvent("focusout", "onBlur");
|
|
registerSimpleEvent(TRANSITION_END, "onTransitionEnd");
|
|
}
|
|
function extractEvents$4(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) {
|
|
var reactName = topLevelEventsToReactNames.get(domEventName);
|
|
if (reactName === void 0) {
|
|
return;
|
|
}
|
|
var SyntheticEventCtor = SyntheticEvent;
|
|
var reactEventType = domEventName;
|
|
switch (domEventName) {
|
|
case "keypress":
|
|
if (getEventCharCode(nativeEvent) === 0) {
|
|
return;
|
|
}
|
|
case "keydown":
|
|
case "keyup":
|
|
SyntheticEventCtor = SyntheticKeyboardEvent;
|
|
break;
|
|
case "focusin":
|
|
reactEventType = "focus";
|
|
SyntheticEventCtor = SyntheticFocusEvent;
|
|
break;
|
|
case "focusout":
|
|
reactEventType = "blur";
|
|
SyntheticEventCtor = SyntheticFocusEvent;
|
|
break;
|
|
case "beforeblur":
|
|
case "afterblur":
|
|
SyntheticEventCtor = SyntheticFocusEvent;
|
|
break;
|
|
case "click":
|
|
if (nativeEvent.button === 2) {
|
|
return;
|
|
}
|
|
case "auxclick":
|
|
case "dblclick":
|
|
case "mousedown":
|
|
case "mousemove":
|
|
case "mouseup":
|
|
case "mouseout":
|
|
case "mouseover":
|
|
case "contextmenu":
|
|
SyntheticEventCtor = SyntheticMouseEvent;
|
|
break;
|
|
case "drag":
|
|
case "dragend":
|
|
case "dragenter":
|
|
case "dragexit":
|
|
case "dragleave":
|
|
case "dragover":
|
|
case "dragstart":
|
|
case "drop":
|
|
SyntheticEventCtor = SyntheticDragEvent;
|
|
break;
|
|
case "touchcancel":
|
|
case "touchend":
|
|
case "touchmove":
|
|
case "touchstart":
|
|
SyntheticEventCtor = SyntheticTouchEvent;
|
|
break;
|
|
case ANIMATION_END:
|
|
case ANIMATION_ITERATION:
|
|
case ANIMATION_START:
|
|
SyntheticEventCtor = SyntheticAnimationEvent;
|
|
break;
|
|
case TRANSITION_END:
|
|
SyntheticEventCtor = SyntheticTransitionEvent;
|
|
break;
|
|
case "scroll":
|
|
SyntheticEventCtor = SyntheticUIEvent;
|
|
break;
|
|
case "wheel":
|
|
SyntheticEventCtor = SyntheticWheelEvent;
|
|
break;
|
|
case "copy":
|
|
case "cut":
|
|
case "paste":
|
|
SyntheticEventCtor = SyntheticClipboardEvent;
|
|
break;
|
|
case "gotpointercapture":
|
|
case "lostpointercapture":
|
|
case "pointercancel":
|
|
case "pointerdown":
|
|
case "pointermove":
|
|
case "pointerout":
|
|
case "pointerover":
|
|
case "pointerup":
|
|
SyntheticEventCtor = SyntheticPointerEvent;
|
|
break;
|
|
}
|
|
var inCapturePhase = (eventSystemFlags & IS_CAPTURE_PHASE) !== 0;
|
|
{
|
|
var accumulateTargetOnly = !inCapturePhase && domEventName === "scroll";
|
|
var _listeners = accumulateSinglePhaseListeners(targetInst, reactName, nativeEvent.type, inCapturePhase, accumulateTargetOnly);
|
|
if (_listeners.length > 0) {
|
|
var _event = new SyntheticEventCtor(reactName, reactEventType, null, nativeEvent, nativeEventTarget);
|
|
dispatchQueue.push({
|
|
event: _event,
|
|
listeners: _listeners
|
|
});
|
|
}
|
|
}
|
|
}
|
|
registerSimpleEvents();
|
|
registerEvents$2();
|
|
registerEvents$1();
|
|
registerEvents$3();
|
|
registerEvents();
|
|
function extractEvents$5(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) {
|
|
extractEvents$4(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags);
|
|
var shouldProcessPolyfillPlugins = (eventSystemFlags & SHOULD_NOT_PROCESS_POLYFILL_EVENT_PLUGINS) === 0;
|
|
if (shouldProcessPolyfillPlugins) {
|
|
extractEvents$2(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
|
|
extractEvents$1(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
|
|
extractEvents$3(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
|
|
extractEvents(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget);
|
|
}
|
|
}
|
|
var mediaEventTypes = ["abort", "canplay", "canplaythrough", "durationchange", "emptied", "encrypted", "ended", "error", "loadeddata", "loadedmetadata", "loadstart", "pause", "play", "playing", "progress", "ratechange", "resize", "seeked", "seeking", "stalled", "suspend", "timeupdate", "volumechange", "waiting"];
|
|
var nonDelegatedEvents = new Set(["cancel", "close", "invalid", "load", "scroll", "toggle"].concat(mediaEventTypes));
|
|
function executeDispatch(event, listener4, currentTarget) {
|
|
var type = event.type || "unknown-event";
|
|
event.currentTarget = currentTarget;
|
|
invokeGuardedCallbackAndCatchFirstError(type, listener4, void 0, event);
|
|
event.currentTarget = null;
|
|
}
|
|
function processDispatchQueueItemsInOrder(event, dispatchListeners, inCapturePhase) {
|
|
var previousInstance;
|
|
if (inCapturePhase) {
|
|
for (var i = dispatchListeners.length - 1; i >= 0; i--) {
|
|
var _dispatchListeners$i = dispatchListeners[i], instance = _dispatchListeners$i.instance, currentTarget = _dispatchListeners$i.currentTarget, listener4 = _dispatchListeners$i.listener;
|
|
if (instance !== previousInstance && event.isPropagationStopped()) {
|
|
return;
|
|
}
|
|
executeDispatch(event, listener4, currentTarget);
|
|
previousInstance = instance;
|
|
}
|
|
} else {
|
|
for (var _i = 0; _i < dispatchListeners.length; _i++) {
|
|
var _dispatchListeners$_i = dispatchListeners[_i], _instance = _dispatchListeners$_i.instance, _currentTarget = _dispatchListeners$_i.currentTarget, _listener = _dispatchListeners$_i.listener;
|
|
if (_instance !== previousInstance && event.isPropagationStopped()) {
|
|
return;
|
|
}
|
|
executeDispatch(event, _listener, _currentTarget);
|
|
previousInstance = _instance;
|
|
}
|
|
}
|
|
}
|
|
function processDispatchQueue(dispatchQueue, eventSystemFlags) {
|
|
var inCapturePhase = (eventSystemFlags & IS_CAPTURE_PHASE) !== 0;
|
|
for (var i = 0; i < dispatchQueue.length; i++) {
|
|
var _dispatchQueue$i = dispatchQueue[i], event = _dispatchQueue$i.event, listeners = _dispatchQueue$i.listeners;
|
|
processDispatchQueueItemsInOrder(event, listeners, inCapturePhase);
|
|
}
|
|
rethrowCaughtError();
|
|
}
|
|
function dispatchEventsForPlugins(domEventName, eventSystemFlags, nativeEvent, targetInst, targetContainer) {
|
|
var nativeEventTarget = getEventTarget(nativeEvent);
|
|
var dispatchQueue = [];
|
|
extractEvents$5(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags);
|
|
processDispatchQueue(dispatchQueue, eventSystemFlags);
|
|
}
|
|
function listenToNonDelegatedEvent(domEventName, targetElement) {
|
|
{
|
|
if (!nonDelegatedEvents.has(domEventName)) {
|
|
error('Did not expect a listenToNonDelegatedEvent() call for "%s". This is a bug in React. Please file an issue.', domEventName);
|
|
}
|
|
}
|
|
var isCapturePhaseListener = false;
|
|
var listenerSet = getEventListenerSet(targetElement);
|
|
var listenerSetKey = getListenerSetKey(domEventName, isCapturePhaseListener);
|
|
if (!listenerSet.has(listenerSetKey)) {
|
|
addTrappedEventListener(targetElement, domEventName, IS_NON_DELEGATED, isCapturePhaseListener);
|
|
listenerSet.add(listenerSetKey);
|
|
}
|
|
}
|
|
function listenToNativeEvent(domEventName, isCapturePhaseListener, target) {
|
|
{
|
|
if (nonDelegatedEvents.has(domEventName) && !isCapturePhaseListener) {
|
|
error('Did not expect a listenToNativeEvent() call for "%s" in the bubble phase. This is a bug in React. Please file an issue.', domEventName);
|
|
}
|
|
}
|
|
var eventSystemFlags = 0;
|
|
if (isCapturePhaseListener) {
|
|
eventSystemFlags |= IS_CAPTURE_PHASE;
|
|
}
|
|
addTrappedEventListener(target, domEventName, eventSystemFlags, isCapturePhaseListener);
|
|
}
|
|
var listeningMarker = "_reactListening" + Math.random().toString(36).slice(2);
|
|
function listenToAllSupportedEvents(rootContainerElement) {
|
|
if (!rootContainerElement[listeningMarker]) {
|
|
rootContainerElement[listeningMarker] = true;
|
|
allNativeEvents.forEach(function(domEventName) {
|
|
if (domEventName !== "selectionchange") {
|
|
if (!nonDelegatedEvents.has(domEventName)) {
|
|
listenToNativeEvent(domEventName, false, rootContainerElement);
|
|
}
|
|
listenToNativeEvent(domEventName, true, rootContainerElement);
|
|
}
|
|
});
|
|
var ownerDocument = rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument;
|
|
if (ownerDocument !== null) {
|
|
if (!ownerDocument[listeningMarker]) {
|
|
ownerDocument[listeningMarker] = true;
|
|
listenToNativeEvent("selectionchange", false, ownerDocument);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function addTrappedEventListener(targetContainer, domEventName, eventSystemFlags, isCapturePhaseListener, isDeferredListenerForLegacyFBSupport) {
|
|
var listener4 = createEventListenerWrapperWithPriority(targetContainer, domEventName, eventSystemFlags);
|
|
var isPassiveListener = void 0;
|
|
if (passiveBrowserEventsSupported) {
|
|
if (domEventName === "touchstart" || domEventName === "touchmove" || domEventName === "wheel") {
|
|
isPassiveListener = true;
|
|
}
|
|
}
|
|
targetContainer = targetContainer;
|
|
var unsubscribeListener;
|
|
if (isCapturePhaseListener) {
|
|
if (isPassiveListener !== void 0) {
|
|
unsubscribeListener = addEventCaptureListenerWithPassiveFlag(targetContainer, domEventName, listener4, isPassiveListener);
|
|
} else {
|
|
unsubscribeListener = addEventCaptureListener(targetContainer, domEventName, listener4);
|
|
}
|
|
} else {
|
|
if (isPassiveListener !== void 0) {
|
|
unsubscribeListener = addEventBubbleListenerWithPassiveFlag(targetContainer, domEventName, listener4, isPassiveListener);
|
|
} else {
|
|
unsubscribeListener = addEventBubbleListener(targetContainer, domEventName, listener4);
|
|
}
|
|
}
|
|
}
|
|
function isMatchingRootContainer(grandContainer, targetContainer) {
|
|
return grandContainer === targetContainer || grandContainer.nodeType === COMMENT_NODE && grandContainer.parentNode === targetContainer;
|
|
}
|
|
function dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, targetInst, targetContainer) {
|
|
var ancestorInst = targetInst;
|
|
if ((eventSystemFlags & IS_EVENT_HANDLE_NON_MANAGED_NODE) === 0 && (eventSystemFlags & IS_NON_DELEGATED) === 0) {
|
|
var targetContainerNode = targetContainer;
|
|
if (targetInst !== null) {
|
|
var node = targetInst;
|
|
mainLoop:
|
|
while (true) {
|
|
if (node === null) {
|
|
return;
|
|
}
|
|
var nodeTag = node.tag;
|
|
if (nodeTag === HostRoot || nodeTag === HostPortal) {
|
|
var container = node.stateNode.containerInfo;
|
|
if (isMatchingRootContainer(container, targetContainerNode)) {
|
|
break;
|
|
}
|
|
if (nodeTag === HostPortal) {
|
|
var grandNode = node.return;
|
|
while (grandNode !== null) {
|
|
var grandTag = grandNode.tag;
|
|
if (grandTag === HostRoot || grandTag === HostPortal) {
|
|
var grandContainer = grandNode.stateNode.containerInfo;
|
|
if (isMatchingRootContainer(grandContainer, targetContainerNode)) {
|
|
return;
|
|
}
|
|
}
|
|
grandNode = grandNode.return;
|
|
}
|
|
}
|
|
while (container !== null) {
|
|
var parentNode = getClosestInstanceFromNode(container);
|
|
if (parentNode === null) {
|
|
return;
|
|
}
|
|
var parentTag = parentNode.tag;
|
|
if (parentTag === HostComponent || parentTag === HostText) {
|
|
node = ancestorInst = parentNode;
|
|
continue mainLoop;
|
|
}
|
|
container = container.parentNode;
|
|
}
|
|
}
|
|
node = node.return;
|
|
}
|
|
}
|
|
}
|
|
batchedUpdates(function() {
|
|
return dispatchEventsForPlugins(domEventName, eventSystemFlags, nativeEvent, ancestorInst);
|
|
});
|
|
}
|
|
function createDispatchListener(instance, listener4, currentTarget) {
|
|
return {
|
|
instance,
|
|
listener: listener4,
|
|
currentTarget
|
|
};
|
|
}
|
|
function accumulateSinglePhaseListeners(targetFiber, reactName, nativeEventType, inCapturePhase, accumulateTargetOnly, nativeEvent) {
|
|
var captureName = reactName !== null ? reactName + "Capture" : null;
|
|
var reactEventName = inCapturePhase ? captureName : reactName;
|
|
var listeners = [];
|
|
var instance = targetFiber;
|
|
var lastHostComponent = null;
|
|
while (instance !== null) {
|
|
var _instance2 = instance, stateNode = _instance2.stateNode, tag = _instance2.tag;
|
|
if (tag === HostComponent && stateNode !== null) {
|
|
lastHostComponent = stateNode;
|
|
if (reactEventName !== null) {
|
|
var listener4 = getListener(instance, reactEventName);
|
|
if (listener4 != null) {
|
|
listeners.push(createDispatchListener(instance, listener4, lastHostComponent));
|
|
}
|
|
}
|
|
}
|
|
if (accumulateTargetOnly) {
|
|
break;
|
|
}
|
|
instance = instance.return;
|
|
}
|
|
return listeners;
|
|
}
|
|
function accumulateTwoPhaseListeners(targetFiber, reactName) {
|
|
var captureName = reactName + "Capture";
|
|
var listeners = [];
|
|
var instance = targetFiber;
|
|
while (instance !== null) {
|
|
var _instance3 = instance, stateNode = _instance3.stateNode, tag = _instance3.tag;
|
|
if (tag === HostComponent && stateNode !== null) {
|
|
var currentTarget = stateNode;
|
|
var captureListener = getListener(instance, captureName);
|
|
if (captureListener != null) {
|
|
listeners.unshift(createDispatchListener(instance, captureListener, currentTarget));
|
|
}
|
|
var bubbleListener = getListener(instance, reactName);
|
|
if (bubbleListener != null) {
|
|
listeners.push(createDispatchListener(instance, bubbleListener, currentTarget));
|
|
}
|
|
}
|
|
instance = instance.return;
|
|
}
|
|
return listeners;
|
|
}
|
|
function getParent(inst) {
|
|
if (inst === null) {
|
|
return null;
|
|
}
|
|
do {
|
|
inst = inst.return;
|
|
} while (inst && inst.tag !== HostComponent);
|
|
if (inst) {
|
|
return inst;
|
|
}
|
|
return null;
|
|
}
|
|
function getLowestCommonAncestor(instA, instB) {
|
|
var nodeA = instA;
|
|
var nodeB = instB;
|
|
var depthA = 0;
|
|
for (var tempA = nodeA; tempA; tempA = getParent(tempA)) {
|
|
depthA++;
|
|
}
|
|
var depthB = 0;
|
|
for (var tempB = nodeB; tempB; tempB = getParent(tempB)) {
|
|
depthB++;
|
|
}
|
|
while (depthA - depthB > 0) {
|
|
nodeA = getParent(nodeA);
|
|
depthA--;
|
|
}
|
|
while (depthB - depthA > 0) {
|
|
nodeB = getParent(nodeB);
|
|
depthB--;
|
|
}
|
|
var depth = depthA;
|
|
while (depth--) {
|
|
if (nodeA === nodeB || nodeB !== null && nodeA === nodeB.alternate) {
|
|
return nodeA;
|
|
}
|
|
nodeA = getParent(nodeA);
|
|
nodeB = getParent(nodeB);
|
|
}
|
|
return null;
|
|
}
|
|
function accumulateEnterLeaveListenersForEvent(dispatchQueue, event, target, common, inCapturePhase) {
|
|
var registrationName = event._reactName;
|
|
var listeners = [];
|
|
var instance = target;
|
|
while (instance !== null) {
|
|
if (instance === common) {
|
|
break;
|
|
}
|
|
var _instance4 = instance, alternate = _instance4.alternate, stateNode = _instance4.stateNode, tag = _instance4.tag;
|
|
if (alternate !== null && alternate === common) {
|
|
break;
|
|
}
|
|
if (tag === HostComponent && stateNode !== null) {
|
|
var currentTarget = stateNode;
|
|
if (inCapturePhase) {
|
|
var captureListener = getListener(instance, registrationName);
|
|
if (captureListener != null) {
|
|
listeners.unshift(createDispatchListener(instance, captureListener, currentTarget));
|
|
}
|
|
} else if (!inCapturePhase) {
|
|
var bubbleListener = getListener(instance, registrationName);
|
|
if (bubbleListener != null) {
|
|
listeners.push(createDispatchListener(instance, bubbleListener, currentTarget));
|
|
}
|
|
}
|
|
}
|
|
instance = instance.return;
|
|
}
|
|
if (listeners.length !== 0) {
|
|
dispatchQueue.push({
|
|
event,
|
|
listeners
|
|
});
|
|
}
|
|
}
|
|
function accumulateEnterLeaveTwoPhaseListeners(dispatchQueue, leaveEvent, enterEvent, from, to) {
|
|
var common = from && to ? getLowestCommonAncestor(from, to) : null;
|
|
if (from !== null) {
|
|
accumulateEnterLeaveListenersForEvent(dispatchQueue, leaveEvent, from, common, false);
|
|
}
|
|
if (to !== null && enterEvent !== null) {
|
|
accumulateEnterLeaveListenersForEvent(dispatchQueue, enterEvent, to, common, true);
|
|
}
|
|
}
|
|
function getListenerSetKey(domEventName, capture) {
|
|
return domEventName + "__" + (capture ? "capture" : "bubble");
|
|
}
|
|
var didWarnInvalidHydration = false;
|
|
var DANGEROUSLY_SET_INNER_HTML = "dangerouslySetInnerHTML";
|
|
var SUPPRESS_CONTENT_EDITABLE_WARNING = "suppressContentEditableWarning";
|
|
var SUPPRESS_HYDRATION_WARNING = "suppressHydrationWarning";
|
|
var AUTOFOCUS = "autoFocus";
|
|
var CHILDREN = "children";
|
|
var STYLE = "style";
|
|
var HTML$1 = "__html";
|
|
var warnedUnknownTags;
|
|
var validatePropertiesInDevelopment;
|
|
var warnForPropDifference;
|
|
var warnForExtraAttributes;
|
|
var warnForInvalidEventListener;
|
|
var canDiffStyleForHydrationWarning;
|
|
var normalizeHTML;
|
|
{
|
|
warnedUnknownTags = {
|
|
dialog: true,
|
|
webview: true
|
|
};
|
|
validatePropertiesInDevelopment = function(type, props) {
|
|
validateProperties(type, props);
|
|
validateProperties$1(type, props);
|
|
validateProperties$2(type, props, {
|
|
registrationNameDependencies,
|
|
possibleRegistrationNames
|
|
});
|
|
};
|
|
canDiffStyleForHydrationWarning = canUseDOM2 && !document.documentMode;
|
|
warnForPropDifference = function(propName, serverValue, clientValue) {
|
|
if (didWarnInvalidHydration) {
|
|
return;
|
|
}
|
|
var normalizedClientValue = normalizeMarkupForTextOrAttribute(clientValue);
|
|
var normalizedServerValue = normalizeMarkupForTextOrAttribute(serverValue);
|
|
if (normalizedServerValue === normalizedClientValue) {
|
|
return;
|
|
}
|
|
didWarnInvalidHydration = true;
|
|
error("Prop `%s` did not match. Server: %s Client: %s", propName, JSON.stringify(normalizedServerValue), JSON.stringify(normalizedClientValue));
|
|
};
|
|
warnForExtraAttributes = function(attributeNames) {
|
|
if (didWarnInvalidHydration) {
|
|
return;
|
|
}
|
|
didWarnInvalidHydration = true;
|
|
var names = [];
|
|
attributeNames.forEach(function(name) {
|
|
names.push(name);
|
|
});
|
|
error("Extra attributes from the server: %s", names);
|
|
};
|
|
warnForInvalidEventListener = function(registrationName, listener4) {
|
|
if (listener4 === false) {
|
|
error("Expected `%s` listener to be a function, instead got `false`.\n\nIf you used to conditionally omit it with %s={condition && value}, pass %s={condition ? value : undefined} instead.", registrationName, registrationName, registrationName);
|
|
} else {
|
|
error("Expected `%s` listener to be a function, instead got a value of `%s` type.", registrationName, typeof listener4);
|
|
}
|
|
};
|
|
normalizeHTML = function(parent, html) {
|
|
var testElement = parent.namespaceURI === HTML_NAMESPACE ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName);
|
|
testElement.innerHTML = html;
|
|
return testElement.innerHTML;
|
|
};
|
|
}
|
|
var NORMALIZE_NEWLINES_REGEX = /\r\n?/g;
|
|
var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g;
|
|
function normalizeMarkupForTextOrAttribute(markup) {
|
|
{
|
|
checkHtmlStringCoercion(markup);
|
|
}
|
|
var markupString = typeof markup === "string" ? markup : "" + markup;
|
|
return markupString.replace(NORMALIZE_NEWLINES_REGEX, "\n").replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, "");
|
|
}
|
|
function checkForUnmatchedText(serverText, clientText, isConcurrentMode, shouldWarnDev) {
|
|
var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText);
|
|
var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText);
|
|
if (normalizedServerText === normalizedClientText) {
|
|
return;
|
|
}
|
|
if (shouldWarnDev) {
|
|
{
|
|
if (!didWarnInvalidHydration) {
|
|
didWarnInvalidHydration = true;
|
|
error('Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText);
|
|
}
|
|
}
|
|
}
|
|
if (isConcurrentMode && enableClientRenderFallbackOnTextMismatch) {
|
|
throw new Error("Text content does not match server-rendered HTML.");
|
|
}
|
|
}
|
|
function getOwnerDocumentFromRootContainer(rootContainerElement) {
|
|
return rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument;
|
|
}
|
|
function noop7() {
|
|
}
|
|
function trapClickOnNonInteractiveElement(node) {
|
|
node.onclick = noop7;
|
|
}
|
|
function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProps, isCustomComponentTag) {
|
|
for (var propKey in nextProps) {
|
|
if (!nextProps.hasOwnProperty(propKey)) {
|
|
continue;
|
|
}
|
|
var nextProp = nextProps[propKey];
|
|
if (propKey === STYLE) {
|
|
{
|
|
if (nextProp) {
|
|
Object.freeze(nextProp);
|
|
}
|
|
}
|
|
setValueForStyles(domElement, nextProp);
|
|
} else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
|
|
var nextHtml = nextProp ? nextProp[HTML$1] : void 0;
|
|
if (nextHtml != null) {
|
|
setInnerHTML(domElement, nextHtml);
|
|
}
|
|
} else if (propKey === CHILDREN) {
|
|
if (typeof nextProp === "string") {
|
|
var canSetTextContent = tag !== "textarea" || nextProp !== "";
|
|
if (canSetTextContent) {
|
|
setTextContent(domElement, nextProp);
|
|
}
|
|
} else if (typeof nextProp === "number") {
|
|
setTextContent(domElement, "" + nextProp);
|
|
}
|
|
} else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING)
|
|
;
|
|
else if (propKey === AUTOFOCUS)
|
|
;
|
|
else if (registrationNameDependencies.hasOwnProperty(propKey)) {
|
|
if (nextProp != null) {
|
|
if (typeof nextProp !== "function") {
|
|
warnForInvalidEventListener(propKey, nextProp);
|
|
}
|
|
if (propKey === "onScroll") {
|
|
listenToNonDelegatedEvent("scroll", domElement);
|
|
}
|
|
}
|
|
} else if (nextProp != null) {
|
|
setValueForProperty(domElement, propKey, nextProp, isCustomComponentTag);
|
|
}
|
|
}
|
|
}
|
|
function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag) {
|
|
for (var i = 0; i < updatePayload.length; i += 2) {
|
|
var propKey = updatePayload[i];
|
|
var propValue = updatePayload[i + 1];
|
|
if (propKey === STYLE) {
|
|
setValueForStyles(domElement, propValue);
|
|
} else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
|
|
setInnerHTML(domElement, propValue);
|
|
} else if (propKey === CHILDREN) {
|
|
setTextContent(domElement, propValue);
|
|
} else {
|
|
setValueForProperty(domElement, propKey, propValue, isCustomComponentTag);
|
|
}
|
|
}
|
|
}
|
|
function createElement2(type, props, rootContainerElement, parentNamespace) {
|
|
var isCustomComponentTag;
|
|
var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement);
|
|
var domElement;
|
|
var namespaceURI = parentNamespace;
|
|
if (namespaceURI === HTML_NAMESPACE) {
|
|
namespaceURI = getIntrinsicNamespace(type);
|
|
}
|
|
if (namespaceURI === HTML_NAMESPACE) {
|
|
{
|
|
isCustomComponentTag = isCustomComponent(type, props);
|
|
if (!isCustomComponentTag && type !== type.toLowerCase()) {
|
|
error("<%s /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.", type);
|
|
}
|
|
}
|
|
if (type === "script") {
|
|
var div = ownerDocument.createElement("div");
|
|
div.innerHTML = "<script><\/script>";
|
|
var firstChild = div.firstChild;
|
|
domElement = div.removeChild(firstChild);
|
|
} else if (typeof props.is === "string") {
|
|
domElement = ownerDocument.createElement(type, {
|
|
is: props.is
|
|
});
|
|
} else {
|
|
domElement = ownerDocument.createElement(type);
|
|
if (type === "select") {
|
|
var node = domElement;
|
|
if (props.multiple) {
|
|
node.multiple = true;
|
|
} else if (props.size) {
|
|
node.size = props.size;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
domElement = ownerDocument.createElementNS(namespaceURI, type);
|
|
}
|
|
{
|
|
if (namespaceURI === HTML_NAMESPACE) {
|
|
if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === "[object HTMLUnknownElement]" && !hasOwnProperty2.call(warnedUnknownTags, type)) {
|
|
warnedUnknownTags[type] = true;
|
|
error("The tag <%s> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.", type);
|
|
}
|
|
}
|
|
}
|
|
return domElement;
|
|
}
|
|
function createTextNode(text2, rootContainerElement) {
|
|
return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text2);
|
|
}
|
|
function setInitialProperties(domElement, tag, rawProps, rootContainerElement) {
|
|
var isCustomComponentTag = isCustomComponent(tag, rawProps);
|
|
{
|
|
validatePropertiesInDevelopment(tag, rawProps);
|
|
}
|
|
var props;
|
|
switch (tag) {
|
|
case "dialog":
|
|
listenToNonDelegatedEvent("cancel", domElement);
|
|
listenToNonDelegatedEvent("close", domElement);
|
|
props = rawProps;
|
|
break;
|
|
case "iframe":
|
|
case "object":
|
|
case "embed":
|
|
listenToNonDelegatedEvent("load", domElement);
|
|
props = rawProps;
|
|
break;
|
|
case "video":
|
|
case "audio":
|
|
for (var i = 0; i < mediaEventTypes.length; i++) {
|
|
listenToNonDelegatedEvent(mediaEventTypes[i], domElement);
|
|
}
|
|
props = rawProps;
|
|
break;
|
|
case "source":
|
|
listenToNonDelegatedEvent("error", domElement);
|
|
props = rawProps;
|
|
break;
|
|
case "img":
|
|
case "image":
|
|
case "link":
|
|
listenToNonDelegatedEvent("error", domElement);
|
|
listenToNonDelegatedEvent("load", domElement);
|
|
props = rawProps;
|
|
break;
|
|
case "details":
|
|
listenToNonDelegatedEvent("toggle", domElement);
|
|
props = rawProps;
|
|
break;
|
|
case "input":
|
|
initWrapperState(domElement, rawProps);
|
|
props = getHostProps(domElement, rawProps);
|
|
listenToNonDelegatedEvent("invalid", domElement);
|
|
break;
|
|
case "option":
|
|
validateProps(domElement, rawProps);
|
|
props = rawProps;
|
|
break;
|
|
case "select":
|
|
initWrapperState$1(domElement, rawProps);
|
|
props = getHostProps$1(domElement, rawProps);
|
|
listenToNonDelegatedEvent("invalid", domElement);
|
|
break;
|
|
case "textarea":
|
|
initWrapperState$2(domElement, rawProps);
|
|
props = getHostProps$2(domElement, rawProps);
|
|
listenToNonDelegatedEvent("invalid", domElement);
|
|
break;
|
|
default:
|
|
props = rawProps;
|
|
}
|
|
assertValidProps(tag, props);
|
|
setInitialDOMProperties(tag, domElement, rootContainerElement, props, isCustomComponentTag);
|
|
switch (tag) {
|
|
case "input":
|
|
track(domElement);
|
|
postMountWrapper(domElement, rawProps, false);
|
|
break;
|
|
case "textarea":
|
|
track(domElement);
|
|
postMountWrapper$3(domElement);
|
|
break;
|
|
case "option":
|
|
postMountWrapper$1(domElement, rawProps);
|
|
break;
|
|
case "select":
|
|
postMountWrapper$2(domElement, rawProps);
|
|
break;
|
|
default:
|
|
if (typeof props.onClick === "function") {
|
|
trapClickOnNonInteractiveElement(domElement);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) {
|
|
{
|
|
validatePropertiesInDevelopment(tag, nextRawProps);
|
|
}
|
|
var updatePayload = null;
|
|
var lastProps;
|
|
var nextProps;
|
|
switch (tag) {
|
|
case "input":
|
|
lastProps = getHostProps(domElement, lastRawProps);
|
|
nextProps = getHostProps(domElement, nextRawProps);
|
|
updatePayload = [];
|
|
break;
|
|
case "select":
|
|
lastProps = getHostProps$1(domElement, lastRawProps);
|
|
nextProps = getHostProps$1(domElement, nextRawProps);
|
|
updatePayload = [];
|
|
break;
|
|
case "textarea":
|
|
lastProps = getHostProps$2(domElement, lastRawProps);
|
|
nextProps = getHostProps$2(domElement, nextRawProps);
|
|
updatePayload = [];
|
|
break;
|
|
default:
|
|
lastProps = lastRawProps;
|
|
nextProps = nextRawProps;
|
|
if (typeof lastProps.onClick !== "function" && typeof nextProps.onClick === "function") {
|
|
trapClickOnNonInteractiveElement(domElement);
|
|
}
|
|
break;
|
|
}
|
|
assertValidProps(tag, nextProps);
|
|
var propKey;
|
|
var styleName;
|
|
var styleUpdates = null;
|
|
for (propKey in lastProps) {
|
|
if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) {
|
|
continue;
|
|
}
|
|
if (propKey === STYLE) {
|
|
var lastStyle = lastProps[propKey];
|
|
for (styleName in lastStyle) {
|
|
if (lastStyle.hasOwnProperty(styleName)) {
|
|
if (!styleUpdates) {
|
|
styleUpdates = {};
|
|
}
|
|
styleUpdates[styleName] = "";
|
|
}
|
|
}
|
|
} else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN)
|
|
;
|
|
else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING)
|
|
;
|
|
else if (propKey === AUTOFOCUS)
|
|
;
|
|
else if (registrationNameDependencies.hasOwnProperty(propKey)) {
|
|
if (!updatePayload) {
|
|
updatePayload = [];
|
|
}
|
|
} else {
|
|
(updatePayload = updatePayload || []).push(propKey, null);
|
|
}
|
|
}
|
|
for (propKey in nextProps) {
|
|
var nextProp = nextProps[propKey];
|
|
var lastProp = lastProps != null ? lastProps[propKey] : void 0;
|
|
if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) {
|
|
continue;
|
|
}
|
|
if (propKey === STYLE) {
|
|
{
|
|
if (nextProp) {
|
|
Object.freeze(nextProp);
|
|
}
|
|
}
|
|
if (lastProp) {
|
|
for (styleName in lastProp) {
|
|
if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
|
|
if (!styleUpdates) {
|
|
styleUpdates = {};
|
|
}
|
|
styleUpdates[styleName] = "";
|
|
}
|
|
}
|
|
for (styleName in nextProp) {
|
|
if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
|
|
if (!styleUpdates) {
|
|
styleUpdates = {};
|
|
}
|
|
styleUpdates[styleName] = nextProp[styleName];
|
|
}
|
|
}
|
|
} else {
|
|
if (!styleUpdates) {
|
|
if (!updatePayload) {
|
|
updatePayload = [];
|
|
}
|
|
updatePayload.push(propKey, styleUpdates);
|
|
}
|
|
styleUpdates = nextProp;
|
|
}
|
|
} else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
|
|
var nextHtml = nextProp ? nextProp[HTML$1] : void 0;
|
|
var lastHtml = lastProp ? lastProp[HTML$1] : void 0;
|
|
if (nextHtml != null) {
|
|
if (lastHtml !== nextHtml) {
|
|
(updatePayload = updatePayload || []).push(propKey, nextHtml);
|
|
}
|
|
}
|
|
} else if (propKey === CHILDREN) {
|
|
if (typeof nextProp === "string" || typeof nextProp === "number") {
|
|
(updatePayload = updatePayload || []).push(propKey, "" + nextProp);
|
|
}
|
|
} else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING)
|
|
;
|
|
else if (registrationNameDependencies.hasOwnProperty(propKey)) {
|
|
if (nextProp != null) {
|
|
if (typeof nextProp !== "function") {
|
|
warnForInvalidEventListener(propKey, nextProp);
|
|
}
|
|
if (propKey === "onScroll") {
|
|
listenToNonDelegatedEvent("scroll", domElement);
|
|
}
|
|
}
|
|
if (!updatePayload && lastProp !== nextProp) {
|
|
updatePayload = [];
|
|
}
|
|
} else {
|
|
(updatePayload = updatePayload || []).push(propKey, nextProp);
|
|
}
|
|
}
|
|
if (styleUpdates) {
|
|
{
|
|
validateShorthandPropertyCollisionInDev(styleUpdates, nextProps[STYLE]);
|
|
}
|
|
(updatePayload = updatePayload || []).push(STYLE, styleUpdates);
|
|
}
|
|
return updatePayload;
|
|
}
|
|
function updateProperties(domElement, updatePayload, tag, lastRawProps, nextRawProps) {
|
|
if (tag === "input" && nextRawProps.type === "radio" && nextRawProps.name != null) {
|
|
updateChecked(domElement, nextRawProps);
|
|
}
|
|
var wasCustomComponentTag = isCustomComponent(tag, lastRawProps);
|
|
var isCustomComponentTag = isCustomComponent(tag, nextRawProps);
|
|
updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag);
|
|
switch (tag) {
|
|
case "input":
|
|
updateWrapper(domElement, nextRawProps);
|
|
break;
|
|
case "textarea":
|
|
updateWrapper$1(domElement, nextRawProps);
|
|
break;
|
|
case "select":
|
|
postUpdateWrapper(domElement, nextRawProps);
|
|
break;
|
|
}
|
|
}
|
|
function getPossibleStandardName(propName) {
|
|
{
|
|
var lowerCasedName = propName.toLowerCase();
|
|
if (!possibleStandardNames.hasOwnProperty(lowerCasedName)) {
|
|
return null;
|
|
}
|
|
return possibleStandardNames[lowerCasedName] || null;
|
|
}
|
|
}
|
|
function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, rootContainerElement, isConcurrentMode, shouldWarnDev) {
|
|
var isCustomComponentTag;
|
|
var extraAttributeNames;
|
|
{
|
|
isCustomComponentTag = isCustomComponent(tag, rawProps);
|
|
validatePropertiesInDevelopment(tag, rawProps);
|
|
}
|
|
switch (tag) {
|
|
case "dialog":
|
|
listenToNonDelegatedEvent("cancel", domElement);
|
|
listenToNonDelegatedEvent("close", domElement);
|
|
break;
|
|
case "iframe":
|
|
case "object":
|
|
case "embed":
|
|
listenToNonDelegatedEvent("load", domElement);
|
|
break;
|
|
case "video":
|
|
case "audio":
|
|
for (var i = 0; i < mediaEventTypes.length; i++) {
|
|
listenToNonDelegatedEvent(mediaEventTypes[i], domElement);
|
|
}
|
|
break;
|
|
case "source":
|
|
listenToNonDelegatedEvent("error", domElement);
|
|
break;
|
|
case "img":
|
|
case "image":
|
|
case "link":
|
|
listenToNonDelegatedEvent("error", domElement);
|
|
listenToNonDelegatedEvent("load", domElement);
|
|
break;
|
|
case "details":
|
|
listenToNonDelegatedEvent("toggle", domElement);
|
|
break;
|
|
case "input":
|
|
initWrapperState(domElement, rawProps);
|
|
listenToNonDelegatedEvent("invalid", domElement);
|
|
break;
|
|
case "option":
|
|
validateProps(domElement, rawProps);
|
|
break;
|
|
case "select":
|
|
initWrapperState$1(domElement, rawProps);
|
|
listenToNonDelegatedEvent("invalid", domElement);
|
|
break;
|
|
case "textarea":
|
|
initWrapperState$2(domElement, rawProps);
|
|
listenToNonDelegatedEvent("invalid", domElement);
|
|
break;
|
|
}
|
|
assertValidProps(tag, rawProps);
|
|
{
|
|
extraAttributeNames = /* @__PURE__ */ new Set();
|
|
var attributes = domElement.attributes;
|
|
for (var _i = 0; _i < attributes.length; _i++) {
|
|
var name = attributes[_i].name.toLowerCase();
|
|
switch (name) {
|
|
case "value":
|
|
break;
|
|
case "checked":
|
|
break;
|
|
case "selected":
|
|
break;
|
|
default:
|
|
extraAttributeNames.add(attributes[_i].name);
|
|
}
|
|
}
|
|
}
|
|
var updatePayload = null;
|
|
for (var propKey in rawProps) {
|
|
if (!rawProps.hasOwnProperty(propKey)) {
|
|
continue;
|
|
}
|
|
var nextProp = rawProps[propKey];
|
|
if (propKey === CHILDREN) {
|
|
if (typeof nextProp === "string") {
|
|
if (domElement.textContent !== nextProp) {
|
|
if (rawProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
|
checkForUnmatchedText(domElement.textContent, nextProp, isConcurrentMode, shouldWarnDev);
|
|
}
|
|
updatePayload = [CHILDREN, nextProp];
|
|
}
|
|
} else if (typeof nextProp === "number") {
|
|
if (domElement.textContent !== "" + nextProp) {
|
|
if (rawProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
|
checkForUnmatchedText(domElement.textContent, nextProp, isConcurrentMode, shouldWarnDev);
|
|
}
|
|
updatePayload = [CHILDREN, "" + nextProp];
|
|
}
|
|
}
|
|
} else if (registrationNameDependencies.hasOwnProperty(propKey)) {
|
|
if (nextProp != null) {
|
|
if (typeof nextProp !== "function") {
|
|
warnForInvalidEventListener(propKey, nextProp);
|
|
}
|
|
if (propKey === "onScroll") {
|
|
listenToNonDelegatedEvent("scroll", domElement);
|
|
}
|
|
}
|
|
} else if (shouldWarnDev && true && typeof isCustomComponentTag === "boolean") {
|
|
var serverValue = void 0;
|
|
var propertyInfo = isCustomComponentTag && enableCustomElementPropertySupport ? null : getPropertyInfo(propKey);
|
|
if (rawProps[SUPPRESS_HYDRATION_WARNING] === true)
|
|
;
|
|
else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING || propKey === "value" || propKey === "checked" || propKey === "selected")
|
|
;
|
|
else if (propKey === DANGEROUSLY_SET_INNER_HTML) {
|
|
var serverHTML = domElement.innerHTML;
|
|
var nextHtml = nextProp ? nextProp[HTML$1] : void 0;
|
|
if (nextHtml != null) {
|
|
var expectedHTML = normalizeHTML(domElement, nextHtml);
|
|
if (expectedHTML !== serverHTML) {
|
|
warnForPropDifference(propKey, serverHTML, expectedHTML);
|
|
}
|
|
}
|
|
} else if (propKey === STYLE) {
|
|
extraAttributeNames.delete(propKey);
|
|
if (canDiffStyleForHydrationWarning) {
|
|
var expectedStyle = createDangerousStringForStyles(nextProp);
|
|
serverValue = domElement.getAttribute("style");
|
|
if (expectedStyle !== serverValue) {
|
|
warnForPropDifference(propKey, serverValue, expectedStyle);
|
|
}
|
|
}
|
|
} else if (isCustomComponentTag && !enableCustomElementPropertySupport) {
|
|
extraAttributeNames.delete(propKey.toLowerCase());
|
|
serverValue = getValueForAttribute(domElement, propKey, nextProp);
|
|
if (nextProp !== serverValue) {
|
|
warnForPropDifference(propKey, serverValue, nextProp);
|
|
}
|
|
} else if (!shouldIgnoreAttribute(propKey, propertyInfo, isCustomComponentTag) && !shouldRemoveAttribute(propKey, nextProp, propertyInfo, isCustomComponentTag)) {
|
|
var isMismatchDueToBadCasing = false;
|
|
if (propertyInfo !== null) {
|
|
extraAttributeNames.delete(propertyInfo.attributeName);
|
|
serverValue = getValueForProperty(domElement, propKey, nextProp, propertyInfo);
|
|
} else {
|
|
var ownNamespace = parentNamespace;
|
|
if (ownNamespace === HTML_NAMESPACE) {
|
|
ownNamespace = getIntrinsicNamespace(tag);
|
|
}
|
|
if (ownNamespace === HTML_NAMESPACE) {
|
|
extraAttributeNames.delete(propKey.toLowerCase());
|
|
} else {
|
|
var standardName = getPossibleStandardName(propKey);
|
|
if (standardName !== null && standardName !== propKey) {
|
|
isMismatchDueToBadCasing = true;
|
|
extraAttributeNames.delete(standardName);
|
|
}
|
|
extraAttributeNames.delete(propKey);
|
|
}
|
|
serverValue = getValueForAttribute(domElement, propKey, nextProp);
|
|
}
|
|
var dontWarnCustomElement = enableCustomElementPropertySupport;
|
|
if (!dontWarnCustomElement && nextProp !== serverValue && !isMismatchDueToBadCasing) {
|
|
warnForPropDifference(propKey, serverValue, nextProp);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
{
|
|
if (shouldWarnDev) {
|
|
if (extraAttributeNames.size > 0 && rawProps[SUPPRESS_HYDRATION_WARNING] !== true) {
|
|
warnForExtraAttributes(extraAttributeNames);
|
|
}
|
|
}
|
|
}
|
|
switch (tag) {
|
|
case "input":
|
|
track(domElement);
|
|
postMountWrapper(domElement, rawProps, true);
|
|
break;
|
|
case "textarea":
|
|
track(domElement);
|
|
postMountWrapper$3(domElement);
|
|
break;
|
|
case "select":
|
|
case "option":
|
|
break;
|
|
default:
|
|
if (typeof rawProps.onClick === "function") {
|
|
trapClickOnNonInteractiveElement(domElement);
|
|
}
|
|
break;
|
|
}
|
|
return updatePayload;
|
|
}
|
|
function diffHydratedText(textNode, text2, isConcurrentMode) {
|
|
var isDifferent = textNode.nodeValue !== text2;
|
|
return isDifferent;
|
|
}
|
|
function warnForDeletedHydratableElement(parentNode, child) {
|
|
{
|
|
if (didWarnInvalidHydration) {
|
|
return;
|
|
}
|
|
didWarnInvalidHydration = true;
|
|
error("Did not expect server HTML to contain a <%s> in <%s>.", child.nodeName.toLowerCase(), parentNode.nodeName.toLowerCase());
|
|
}
|
|
}
|
|
function warnForDeletedHydratableText(parentNode, child) {
|
|
{
|
|
if (didWarnInvalidHydration) {
|
|
return;
|
|
}
|
|
didWarnInvalidHydration = true;
|
|
error('Did not expect server HTML to contain the text node "%s" in <%s>.', child.nodeValue, parentNode.nodeName.toLowerCase());
|
|
}
|
|
}
|
|
function warnForInsertedHydratedElement(parentNode, tag, props) {
|
|
{
|
|
if (didWarnInvalidHydration) {
|
|
return;
|
|
}
|
|
didWarnInvalidHydration = true;
|
|
error("Expected server HTML to contain a matching <%s> in <%s>.", tag, parentNode.nodeName.toLowerCase());
|
|
}
|
|
}
|
|
function warnForInsertedHydratedText(parentNode, text2) {
|
|
{
|
|
if (text2 === "") {
|
|
return;
|
|
}
|
|
if (didWarnInvalidHydration) {
|
|
return;
|
|
}
|
|
didWarnInvalidHydration = true;
|
|
error('Expected server HTML to contain a matching text node for "%s" in <%s>.', text2, parentNode.nodeName.toLowerCase());
|
|
}
|
|
}
|
|
function restoreControlledState$3(domElement, tag, props) {
|
|
switch (tag) {
|
|
case "input":
|
|
restoreControlledState(domElement, props);
|
|
return;
|
|
case "textarea":
|
|
restoreControlledState$2(domElement, props);
|
|
return;
|
|
case "select":
|
|
restoreControlledState$1(domElement, props);
|
|
return;
|
|
}
|
|
}
|
|
var validateDOMNesting = function() {
|
|
};
|
|
var updatedAncestorInfo = function() {
|
|
};
|
|
{
|
|
var specialTags = ["address", "applet", "area", "article", "aside", "base", "basefont", "bgsound", "blockquote", "body", "br", "button", "caption", "center", "col", "colgroup", "dd", "details", "dir", "div", "dl", "dt", "embed", "fieldset", "figcaption", "figure", "footer", "form", "frame", "frameset", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "iframe", "img", "input", "isindex", "li", "link", "listing", "main", "marquee", "menu", "menuitem", "meta", "nav", "noembed", "noframes", "noscript", "object", "ol", "p", "param", "plaintext", "pre", "script", "section", "select", "source", "style", "summary", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "title", "tr", "track", "ul", "wbr", "xmp"];
|
|
var inScopeTags = [
|
|
"applet",
|
|
"caption",
|
|
"html",
|
|
"table",
|
|
"td",
|
|
"th",
|
|
"marquee",
|
|
"object",
|
|
"template",
|
|
"foreignObject",
|
|
"desc",
|
|
"title"
|
|
];
|
|
var buttonScopeTags = inScopeTags.concat(["button"]);
|
|
var impliedEndTags = ["dd", "dt", "li", "option", "optgroup", "p", "rp", "rt"];
|
|
var emptyAncestorInfo = {
|
|
current: null,
|
|
formTag: null,
|
|
aTagInScope: null,
|
|
buttonTagInScope: null,
|
|
nobrTagInScope: null,
|
|
pTagInButtonScope: null,
|
|
listItemTagAutoclosing: null,
|
|
dlItemTagAutoclosing: null
|
|
};
|
|
updatedAncestorInfo = function(oldInfo, tag) {
|
|
var ancestorInfo = assign2({}, oldInfo || emptyAncestorInfo);
|
|
var info = {
|
|
tag
|
|
};
|
|
if (inScopeTags.indexOf(tag) !== -1) {
|
|
ancestorInfo.aTagInScope = null;
|
|
ancestorInfo.buttonTagInScope = null;
|
|
ancestorInfo.nobrTagInScope = null;
|
|
}
|
|
if (buttonScopeTags.indexOf(tag) !== -1) {
|
|
ancestorInfo.pTagInButtonScope = null;
|
|
}
|
|
if (specialTags.indexOf(tag) !== -1 && tag !== "address" && tag !== "div" && tag !== "p") {
|
|
ancestorInfo.listItemTagAutoclosing = null;
|
|
ancestorInfo.dlItemTagAutoclosing = null;
|
|
}
|
|
ancestorInfo.current = info;
|
|
if (tag === "form") {
|
|
ancestorInfo.formTag = info;
|
|
}
|
|
if (tag === "a") {
|
|
ancestorInfo.aTagInScope = info;
|
|
}
|
|
if (tag === "button") {
|
|
ancestorInfo.buttonTagInScope = info;
|
|
}
|
|
if (tag === "nobr") {
|
|
ancestorInfo.nobrTagInScope = info;
|
|
}
|
|
if (tag === "p") {
|
|
ancestorInfo.pTagInButtonScope = info;
|
|
}
|
|
if (tag === "li") {
|
|
ancestorInfo.listItemTagAutoclosing = info;
|
|
}
|
|
if (tag === "dd" || tag === "dt") {
|
|
ancestorInfo.dlItemTagAutoclosing = info;
|
|
}
|
|
return ancestorInfo;
|
|
};
|
|
var isTagValidWithParent = function(tag, parentTag) {
|
|
switch (parentTag) {
|
|
case "select":
|
|
return tag === "option" || tag === "optgroup" || tag === "#text";
|
|
case "optgroup":
|
|
return tag === "option" || tag === "#text";
|
|
case "option":
|
|
return tag === "#text";
|
|
case "tr":
|
|
return tag === "th" || tag === "td" || tag === "style" || tag === "script" || tag === "template";
|
|
case "tbody":
|
|
case "thead":
|
|
case "tfoot":
|
|
return tag === "tr" || tag === "style" || tag === "script" || tag === "template";
|
|
case "colgroup":
|
|
return tag === "col" || tag === "template";
|
|
case "table":
|
|
return tag === "caption" || tag === "colgroup" || tag === "tbody" || tag === "tfoot" || tag === "thead" || tag === "style" || tag === "script" || tag === "template";
|
|
case "head":
|
|
return tag === "base" || tag === "basefont" || tag === "bgsound" || tag === "link" || tag === "meta" || tag === "title" || tag === "noscript" || tag === "noframes" || tag === "style" || tag === "script" || tag === "template";
|
|
case "html":
|
|
return tag === "head" || tag === "body" || tag === "frameset";
|
|
case "frameset":
|
|
return tag === "frame";
|
|
case "#document":
|
|
return tag === "html";
|
|
}
|
|
switch (tag) {
|
|
case "h1":
|
|
case "h2":
|
|
case "h3":
|
|
case "h4":
|
|
case "h5":
|
|
case "h6":
|
|
return parentTag !== "h1" && parentTag !== "h2" && parentTag !== "h3" && parentTag !== "h4" && parentTag !== "h5" && parentTag !== "h6";
|
|
case "rp":
|
|
case "rt":
|
|
return impliedEndTags.indexOf(parentTag) === -1;
|
|
case "body":
|
|
case "caption":
|
|
case "col":
|
|
case "colgroup":
|
|
case "frameset":
|
|
case "frame":
|
|
case "head":
|
|
case "html":
|
|
case "tbody":
|
|
case "td":
|
|
case "tfoot":
|
|
case "th":
|
|
case "thead":
|
|
case "tr":
|
|
return parentTag == null;
|
|
}
|
|
return true;
|
|
};
|
|
var findInvalidAncestorForTag = function(tag, ancestorInfo) {
|
|
switch (tag) {
|
|
case "address":
|
|
case "article":
|
|
case "aside":
|
|
case "blockquote":
|
|
case "center":
|
|
case "details":
|
|
case "dialog":
|
|
case "dir":
|
|
case "div":
|
|
case "dl":
|
|
case "fieldset":
|
|
case "figcaption":
|
|
case "figure":
|
|
case "footer":
|
|
case "header":
|
|
case "hgroup":
|
|
case "main":
|
|
case "menu":
|
|
case "nav":
|
|
case "ol":
|
|
case "p":
|
|
case "section":
|
|
case "summary":
|
|
case "ul":
|
|
case "pre":
|
|
case "listing":
|
|
case "table":
|
|
case "hr":
|
|
case "xmp":
|
|
case "h1":
|
|
case "h2":
|
|
case "h3":
|
|
case "h4":
|
|
case "h5":
|
|
case "h6":
|
|
return ancestorInfo.pTagInButtonScope;
|
|
case "form":
|
|
return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
|
|
case "li":
|
|
return ancestorInfo.listItemTagAutoclosing;
|
|
case "dd":
|
|
case "dt":
|
|
return ancestorInfo.dlItemTagAutoclosing;
|
|
case "button":
|
|
return ancestorInfo.buttonTagInScope;
|
|
case "a":
|
|
return ancestorInfo.aTagInScope;
|
|
case "nobr":
|
|
return ancestorInfo.nobrTagInScope;
|
|
}
|
|
return null;
|
|
};
|
|
var didWarn$1 = {};
|
|
validateDOMNesting = function(childTag, childText, ancestorInfo) {
|
|
ancestorInfo = ancestorInfo || emptyAncestorInfo;
|
|
var parentInfo = ancestorInfo.current;
|
|
var parentTag = parentInfo && parentInfo.tag;
|
|
if (childText != null) {
|
|
if (childTag != null) {
|
|
error("validateDOMNesting: when childText is passed, childTag should be null");
|
|
}
|
|
childTag = "#text";
|
|
}
|
|
var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
|
|
var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
|
|
var invalidParentOrAncestor = invalidParent || invalidAncestor;
|
|
if (!invalidParentOrAncestor) {
|
|
return;
|
|
}
|
|
var ancestorTag = invalidParentOrAncestor.tag;
|
|
var warnKey = !!invalidParent + "|" + childTag + "|" + ancestorTag;
|
|
if (didWarn$1[warnKey]) {
|
|
return;
|
|
}
|
|
didWarn$1[warnKey] = true;
|
|
var tagDisplayName = childTag;
|
|
var whitespaceInfo = "";
|
|
if (childTag === "#text") {
|
|
if (/\S/.test(childText)) {
|
|
tagDisplayName = "Text nodes";
|
|
} else {
|
|
tagDisplayName = "Whitespace text nodes";
|
|
whitespaceInfo = " Make sure you don't have any extra whitespace between tags on each line of your source code.";
|
|
}
|
|
} else {
|
|
tagDisplayName = "<" + childTag + ">";
|
|
}
|
|
if (invalidParent) {
|
|
var info = "";
|
|
if (ancestorTag === "table" && childTag === "tr") {
|
|
info += " Add a <tbody>, <thead> or <tfoot> to your code to match the DOM tree generated by the browser.";
|
|
}
|
|
error("validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s", tagDisplayName, ancestorTag, whitespaceInfo, info);
|
|
} else {
|
|
error("validateDOMNesting(...): %s cannot appear as a descendant of <%s>.", tagDisplayName, ancestorTag);
|
|
}
|
|
};
|
|
}
|
|
var SUPPRESS_HYDRATION_WARNING$1 = "suppressHydrationWarning";
|
|
var SUSPENSE_START_DATA = "$";
|
|
var SUSPENSE_END_DATA = "/$";
|
|
var SUSPENSE_PENDING_START_DATA = "$?";
|
|
var SUSPENSE_FALLBACK_START_DATA = "$!";
|
|
var STYLE$1 = "style";
|
|
var eventsEnabled = null;
|
|
var selectionInformation = null;
|
|
function getRootHostContext(rootContainerInstance) {
|
|
var type;
|
|
var namespace2;
|
|
var nodeType = rootContainerInstance.nodeType;
|
|
switch (nodeType) {
|
|
case DOCUMENT_NODE:
|
|
case DOCUMENT_FRAGMENT_NODE: {
|
|
type = nodeType === DOCUMENT_NODE ? "#document" : "#fragment";
|
|
var root2 = rootContainerInstance.documentElement;
|
|
namespace2 = root2 ? root2.namespaceURI : getChildNamespace(null, "");
|
|
break;
|
|
}
|
|
default: {
|
|
var container = nodeType === COMMENT_NODE ? rootContainerInstance.parentNode : rootContainerInstance;
|
|
var ownNamespace = container.namespaceURI || null;
|
|
type = container.tagName;
|
|
namespace2 = getChildNamespace(ownNamespace, type);
|
|
break;
|
|
}
|
|
}
|
|
{
|
|
var validatedTag = type.toLowerCase();
|
|
var ancestorInfo = updatedAncestorInfo(null, validatedTag);
|
|
return {
|
|
namespace: namespace2,
|
|
ancestorInfo
|
|
};
|
|
}
|
|
}
|
|
function getChildHostContext(parentHostContext, type, rootContainerInstance) {
|
|
{
|
|
var parentHostContextDev = parentHostContext;
|
|
var namespace2 = getChildNamespace(parentHostContextDev.namespace, type);
|
|
var ancestorInfo = updatedAncestorInfo(parentHostContextDev.ancestorInfo, type);
|
|
return {
|
|
namespace: namespace2,
|
|
ancestorInfo
|
|
};
|
|
}
|
|
}
|
|
function getPublicInstance(instance) {
|
|
return instance;
|
|
}
|
|
function prepareForCommit(containerInfo) {
|
|
eventsEnabled = isEnabled();
|
|
selectionInformation = getSelectionInformation();
|
|
var activeInstance = null;
|
|
setEnabled(false);
|
|
return activeInstance;
|
|
}
|
|
function resetAfterCommit(containerInfo) {
|
|
restoreSelection(selectionInformation);
|
|
setEnabled(eventsEnabled);
|
|
eventsEnabled = null;
|
|
selectionInformation = null;
|
|
}
|
|
function createInstance2(type, props, rootContainerInstance, hostContext, internalInstanceHandle) {
|
|
var parentNamespace;
|
|
{
|
|
var hostContextDev = hostContext;
|
|
validateDOMNesting(type, null, hostContextDev.ancestorInfo);
|
|
if (typeof props.children === "string" || typeof props.children === "number") {
|
|
var string = "" + props.children;
|
|
var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
|
|
validateDOMNesting(null, string, ownAncestorInfo);
|
|
}
|
|
parentNamespace = hostContextDev.namespace;
|
|
}
|
|
var domElement = createElement2(type, props, rootContainerInstance, parentNamespace);
|
|
precacheFiberNode(internalInstanceHandle, domElement);
|
|
updateFiberProps(domElement, props);
|
|
return domElement;
|
|
}
|
|
function appendInitialChild(parentInstance, child) {
|
|
parentInstance.appendChild(child);
|
|
}
|
|
function finalizeInitialChildren(domElement, type, props, rootContainerInstance, hostContext) {
|
|
setInitialProperties(domElement, type, props, rootContainerInstance);
|
|
switch (type) {
|
|
case "button":
|
|
case "input":
|
|
case "select":
|
|
case "textarea":
|
|
return !!props.autoFocus;
|
|
case "img":
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
function prepareUpdate(domElement, type, oldProps, newProps, rootContainerInstance, hostContext) {
|
|
{
|
|
var hostContextDev = hostContext;
|
|
if (typeof newProps.children !== typeof oldProps.children && (typeof newProps.children === "string" || typeof newProps.children === "number")) {
|
|
var string = "" + newProps.children;
|
|
var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type);
|
|
validateDOMNesting(null, string, ownAncestorInfo);
|
|
}
|
|
}
|
|
return diffProperties(domElement, type, oldProps, newProps);
|
|
}
|
|
function shouldSetTextContent(type, props) {
|
|
return type === "textarea" || type === "noscript" || typeof props.children === "string" || typeof props.children === "number" || typeof props.dangerouslySetInnerHTML === "object" && props.dangerouslySetInnerHTML !== null && props.dangerouslySetInnerHTML.__html != null;
|
|
}
|
|
function createTextInstance(text2, rootContainerInstance, hostContext, internalInstanceHandle) {
|
|
{
|
|
var hostContextDev = hostContext;
|
|
validateDOMNesting(null, text2, hostContextDev.ancestorInfo);
|
|
}
|
|
var textNode = createTextNode(text2, rootContainerInstance);
|
|
precacheFiberNode(internalInstanceHandle, textNode);
|
|
return textNode;
|
|
}
|
|
function getCurrentEventPriority() {
|
|
var currentEvent = window.event;
|
|
if (currentEvent === void 0) {
|
|
return DefaultEventPriority;
|
|
}
|
|
return getEventPriority(currentEvent.type);
|
|
}
|
|
var scheduleTimeout = typeof setTimeout === "function" ? setTimeout : void 0;
|
|
var cancelTimeout = typeof clearTimeout === "function" ? clearTimeout : void 0;
|
|
var noTimeout = -1;
|
|
var localPromise = typeof Promise === "function" ? Promise : void 0;
|
|
var scheduleMicrotask = typeof queueMicrotask === "function" ? queueMicrotask : typeof localPromise !== "undefined" ? function(callback) {
|
|
return localPromise.resolve(null).then(callback).catch(handleErrorInNextTick);
|
|
} : scheduleTimeout;
|
|
function handleErrorInNextTick(error2) {
|
|
setTimeout(function() {
|
|
throw error2;
|
|
});
|
|
}
|
|
function commitMount(domElement, type, newProps, internalInstanceHandle) {
|
|
switch (type) {
|
|
case "button":
|
|
case "input":
|
|
case "select":
|
|
case "textarea":
|
|
if (newProps.autoFocus) {
|
|
domElement.focus();
|
|
}
|
|
return;
|
|
case "img": {
|
|
if (newProps.src) {
|
|
domElement.src = newProps.src;
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
function commitUpdate(domElement, updatePayload, type, oldProps, newProps, internalInstanceHandle) {
|
|
updateProperties(domElement, updatePayload, type, oldProps, newProps);
|
|
updateFiberProps(domElement, newProps);
|
|
}
|
|
function resetTextContent(domElement) {
|
|
setTextContent(domElement, "");
|
|
}
|
|
function commitTextUpdate(textInstance, oldText, newText) {
|
|
textInstance.nodeValue = newText;
|
|
}
|
|
function appendChild(parentInstance, child) {
|
|
parentInstance.appendChild(child);
|
|
}
|
|
function appendChildToContainer(container, child) {
|
|
var parentNode;
|
|
if (container.nodeType === COMMENT_NODE) {
|
|
parentNode = container.parentNode;
|
|
parentNode.insertBefore(child, container);
|
|
} else {
|
|
parentNode = container;
|
|
parentNode.appendChild(child);
|
|
}
|
|
var reactRootContainer = container._reactRootContainer;
|
|
if ((reactRootContainer === null || reactRootContainer === void 0) && parentNode.onclick === null) {
|
|
trapClickOnNonInteractiveElement(parentNode);
|
|
}
|
|
}
|
|
function insertBefore(parentInstance, child, beforeChild) {
|
|
parentInstance.insertBefore(child, beforeChild);
|
|
}
|
|
function insertInContainerBefore(container, child, beforeChild) {
|
|
if (container.nodeType === COMMENT_NODE) {
|
|
container.parentNode.insertBefore(child, beforeChild);
|
|
} else {
|
|
container.insertBefore(child, beforeChild);
|
|
}
|
|
}
|
|
function removeChild(parentInstance, child) {
|
|
parentInstance.removeChild(child);
|
|
}
|
|
function removeChildFromContainer(container, child) {
|
|
if (container.nodeType === COMMENT_NODE) {
|
|
container.parentNode.removeChild(child);
|
|
} else {
|
|
container.removeChild(child);
|
|
}
|
|
}
|
|
function clearSuspenseBoundary(parentInstance, suspenseInstance) {
|
|
var node = suspenseInstance;
|
|
var depth = 0;
|
|
do {
|
|
var nextNode = node.nextSibling;
|
|
parentInstance.removeChild(node);
|
|
if (nextNode && nextNode.nodeType === COMMENT_NODE) {
|
|
var data = nextNode.data;
|
|
if (data === SUSPENSE_END_DATA) {
|
|
if (depth === 0) {
|
|
parentInstance.removeChild(nextNode);
|
|
retryIfBlockedOn(suspenseInstance);
|
|
return;
|
|
} else {
|
|
depth--;
|
|
}
|
|
} else if (data === SUSPENSE_START_DATA || data === SUSPENSE_PENDING_START_DATA || data === SUSPENSE_FALLBACK_START_DATA) {
|
|
depth++;
|
|
}
|
|
}
|
|
node = nextNode;
|
|
} while (node);
|
|
retryIfBlockedOn(suspenseInstance);
|
|
}
|
|
function clearSuspenseBoundaryFromContainer(container, suspenseInstance) {
|
|
if (container.nodeType === COMMENT_NODE) {
|
|
clearSuspenseBoundary(container.parentNode, suspenseInstance);
|
|
} else if (container.nodeType === ELEMENT_NODE) {
|
|
clearSuspenseBoundary(container, suspenseInstance);
|
|
}
|
|
retryIfBlockedOn(container);
|
|
}
|
|
function hideInstance(instance) {
|
|
instance = instance;
|
|
var style2 = instance.style;
|
|
if (typeof style2.setProperty === "function") {
|
|
style2.setProperty("display", "none", "important");
|
|
} else {
|
|
style2.display = "none";
|
|
}
|
|
}
|
|
function hideTextInstance(textInstance) {
|
|
textInstance.nodeValue = "";
|
|
}
|
|
function unhideInstance(instance, props) {
|
|
instance = instance;
|
|
var styleProp = props[STYLE$1];
|
|
var display = styleProp !== void 0 && styleProp !== null && styleProp.hasOwnProperty("display") ? styleProp.display : null;
|
|
instance.style.display = dangerousStyleValue("display", display);
|
|
}
|
|
function unhideTextInstance(textInstance, text2) {
|
|
textInstance.nodeValue = text2;
|
|
}
|
|
function clearContainer(container) {
|
|
if (container.nodeType === ELEMENT_NODE) {
|
|
container.textContent = "";
|
|
} else if (container.nodeType === DOCUMENT_NODE) {
|
|
if (container.documentElement) {
|
|
container.removeChild(container.documentElement);
|
|
}
|
|
}
|
|
}
|
|
function canHydrateInstance(instance, type, props) {
|
|
if (instance.nodeType !== ELEMENT_NODE || type.toLowerCase() !== instance.nodeName.toLowerCase()) {
|
|
return null;
|
|
}
|
|
return instance;
|
|
}
|
|
function canHydrateTextInstance(instance, text2) {
|
|
if (text2 === "" || instance.nodeType !== TEXT_NODE) {
|
|
return null;
|
|
}
|
|
return instance;
|
|
}
|
|
function canHydrateSuspenseInstance(instance) {
|
|
if (instance.nodeType !== COMMENT_NODE) {
|
|
return null;
|
|
}
|
|
return instance;
|
|
}
|
|
function isSuspenseInstancePending(instance) {
|
|
return instance.data === SUSPENSE_PENDING_START_DATA;
|
|
}
|
|
function isSuspenseInstanceFallback(instance) {
|
|
return instance.data === SUSPENSE_FALLBACK_START_DATA;
|
|
}
|
|
function getSuspenseInstanceFallbackErrorDetails(instance) {
|
|
var dataset = instance.nextSibling && instance.nextSibling.dataset;
|
|
var digest, message, stack;
|
|
if (dataset) {
|
|
digest = dataset.dgst;
|
|
{
|
|
message = dataset.msg;
|
|
stack = dataset.stck;
|
|
}
|
|
}
|
|
{
|
|
return {
|
|
message,
|
|
digest,
|
|
stack
|
|
};
|
|
}
|
|
}
|
|
function registerSuspenseInstanceRetry(instance, callback) {
|
|
instance._reactRetry = callback;
|
|
}
|
|
function getNextHydratable(node) {
|
|
for (; node != null; node = node.nextSibling) {
|
|
var nodeType = node.nodeType;
|
|
if (nodeType === ELEMENT_NODE || nodeType === TEXT_NODE) {
|
|
break;
|
|
}
|
|
if (nodeType === COMMENT_NODE) {
|
|
var nodeData = node.data;
|
|
if (nodeData === SUSPENSE_START_DATA || nodeData === SUSPENSE_FALLBACK_START_DATA || nodeData === SUSPENSE_PENDING_START_DATA) {
|
|
break;
|
|
}
|
|
if (nodeData === SUSPENSE_END_DATA) {
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
return node;
|
|
}
|
|
function getNextHydratableSibling(instance) {
|
|
return getNextHydratable(instance.nextSibling);
|
|
}
|
|
function getFirstHydratableChild(parentInstance) {
|
|
return getNextHydratable(parentInstance.firstChild);
|
|
}
|
|
function getFirstHydratableChildWithinContainer(parentContainer) {
|
|
return getNextHydratable(parentContainer.firstChild);
|
|
}
|
|
function getFirstHydratableChildWithinSuspenseInstance(parentInstance) {
|
|
return getNextHydratable(parentInstance.nextSibling);
|
|
}
|
|
function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle, shouldWarnDev) {
|
|
precacheFiberNode(internalInstanceHandle, instance);
|
|
updateFiberProps(instance, props);
|
|
var parentNamespace;
|
|
{
|
|
var hostContextDev = hostContext;
|
|
parentNamespace = hostContextDev.namespace;
|
|
}
|
|
var isConcurrentMode = (internalInstanceHandle.mode & ConcurrentMode) !== NoMode;
|
|
return diffHydratedProperties(instance, type, props, parentNamespace, rootContainerInstance, isConcurrentMode, shouldWarnDev);
|
|
}
|
|
function hydrateTextInstance(textInstance, text2, internalInstanceHandle, shouldWarnDev) {
|
|
precacheFiberNode(internalInstanceHandle, textInstance);
|
|
var isConcurrentMode = (internalInstanceHandle.mode & ConcurrentMode) !== NoMode;
|
|
return diffHydratedText(textInstance, text2);
|
|
}
|
|
function hydrateSuspenseInstance(suspenseInstance, internalInstanceHandle) {
|
|
precacheFiberNode(internalInstanceHandle, suspenseInstance);
|
|
}
|
|
function getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance) {
|
|
var node = suspenseInstance.nextSibling;
|
|
var depth = 0;
|
|
while (node) {
|
|
if (node.nodeType === COMMENT_NODE) {
|
|
var data = node.data;
|
|
if (data === SUSPENSE_END_DATA) {
|
|
if (depth === 0) {
|
|
return getNextHydratableSibling(node);
|
|
} else {
|
|
depth--;
|
|
}
|
|
} else if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) {
|
|
depth++;
|
|
}
|
|
}
|
|
node = node.nextSibling;
|
|
}
|
|
return null;
|
|
}
|
|
function getParentSuspenseInstance(targetInstance) {
|
|
var node = targetInstance.previousSibling;
|
|
var depth = 0;
|
|
while (node) {
|
|
if (node.nodeType === COMMENT_NODE) {
|
|
var data = node.data;
|
|
if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) {
|
|
if (depth === 0) {
|
|
return node;
|
|
} else {
|
|
depth--;
|
|
}
|
|
} else if (data === SUSPENSE_END_DATA) {
|
|
depth++;
|
|
}
|
|
}
|
|
node = node.previousSibling;
|
|
}
|
|
return null;
|
|
}
|
|
function commitHydratedContainer(container) {
|
|
retryIfBlockedOn(container);
|
|
}
|
|
function commitHydratedSuspenseInstance(suspenseInstance) {
|
|
retryIfBlockedOn(suspenseInstance);
|
|
}
|
|
function shouldDeleteUnhydratedTailInstances(parentType) {
|
|
return parentType !== "head" && parentType !== "body";
|
|
}
|
|
function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text2, isConcurrentMode) {
|
|
var shouldWarnDev = true;
|
|
checkForUnmatchedText(textInstance.nodeValue, text2, isConcurrentMode, shouldWarnDev);
|
|
}
|
|
function didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, text2, isConcurrentMode) {
|
|
if (parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
|
|
var shouldWarnDev = true;
|
|
checkForUnmatchedText(textInstance.nodeValue, text2, isConcurrentMode, shouldWarnDev);
|
|
}
|
|
}
|
|
function didNotHydrateInstanceWithinContainer(parentContainer, instance) {
|
|
{
|
|
if (instance.nodeType === ELEMENT_NODE) {
|
|
warnForDeletedHydratableElement(parentContainer, instance);
|
|
} else if (instance.nodeType === COMMENT_NODE)
|
|
;
|
|
else {
|
|
warnForDeletedHydratableText(parentContainer, instance);
|
|
}
|
|
}
|
|
}
|
|
function didNotHydrateInstanceWithinSuspenseInstance(parentInstance, instance) {
|
|
{
|
|
var parentNode = parentInstance.parentNode;
|
|
if (parentNode !== null) {
|
|
if (instance.nodeType === ELEMENT_NODE) {
|
|
warnForDeletedHydratableElement(parentNode, instance);
|
|
} else if (instance.nodeType === COMMENT_NODE)
|
|
;
|
|
else {
|
|
warnForDeletedHydratableText(parentNode, instance);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function didNotHydrateInstance(parentType, parentProps, parentInstance, instance, isConcurrentMode) {
|
|
{
|
|
if (isConcurrentMode || parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
|
|
if (instance.nodeType === ELEMENT_NODE) {
|
|
warnForDeletedHydratableElement(parentInstance, instance);
|
|
} else if (instance.nodeType === COMMENT_NODE)
|
|
;
|
|
else {
|
|
warnForDeletedHydratableText(parentInstance, instance);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function didNotFindHydratableInstanceWithinContainer(parentContainer, type, props) {
|
|
{
|
|
warnForInsertedHydratedElement(parentContainer, type);
|
|
}
|
|
}
|
|
function didNotFindHydratableTextInstanceWithinContainer(parentContainer, text2) {
|
|
{
|
|
warnForInsertedHydratedText(parentContainer, text2);
|
|
}
|
|
}
|
|
function didNotFindHydratableInstanceWithinSuspenseInstance(parentInstance, type, props) {
|
|
{
|
|
var parentNode = parentInstance.parentNode;
|
|
if (parentNode !== null)
|
|
warnForInsertedHydratedElement(parentNode, type);
|
|
}
|
|
}
|
|
function didNotFindHydratableTextInstanceWithinSuspenseInstance(parentInstance, text2) {
|
|
{
|
|
var parentNode = parentInstance.parentNode;
|
|
if (parentNode !== null)
|
|
warnForInsertedHydratedText(parentNode, text2);
|
|
}
|
|
}
|
|
function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props, isConcurrentMode) {
|
|
{
|
|
if (isConcurrentMode || parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
|
|
warnForInsertedHydratedElement(parentInstance, type);
|
|
}
|
|
}
|
|
}
|
|
function didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, text2, isConcurrentMode) {
|
|
{
|
|
if (isConcurrentMode || parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) {
|
|
warnForInsertedHydratedText(parentInstance, text2);
|
|
}
|
|
}
|
|
}
|
|
function errorHydratingContainer(parentContainer) {
|
|
{
|
|
error("An error occurred during hydration. The server HTML was replaced with client content in <%s>.", parentContainer.nodeName.toLowerCase());
|
|
}
|
|
}
|
|
function preparePortalMount(portalInstance) {
|
|
listenToAllSupportedEvents(portalInstance);
|
|
}
|
|
var randomKey = Math.random().toString(36).slice(2);
|
|
var internalInstanceKey = "__reactFiber$" + randomKey;
|
|
var internalPropsKey = "__reactProps$" + randomKey;
|
|
var internalContainerInstanceKey = "__reactContainer$" + randomKey;
|
|
var internalEventHandlersKey = "__reactEvents$" + randomKey;
|
|
var internalEventHandlerListenersKey = "__reactListeners$" + randomKey;
|
|
var internalEventHandlesSetKey = "__reactHandles$" + randomKey;
|
|
function detachDeletedInstance(node) {
|
|
delete node[internalInstanceKey];
|
|
delete node[internalPropsKey];
|
|
delete node[internalEventHandlersKey];
|
|
delete node[internalEventHandlerListenersKey];
|
|
delete node[internalEventHandlesSetKey];
|
|
}
|
|
function precacheFiberNode(hostInst, node) {
|
|
node[internalInstanceKey] = hostInst;
|
|
}
|
|
function markContainerAsRoot(hostRoot, node) {
|
|
node[internalContainerInstanceKey] = hostRoot;
|
|
}
|
|
function unmarkContainerAsRoot(node) {
|
|
node[internalContainerInstanceKey] = null;
|
|
}
|
|
function isContainerMarkedAsRoot(node) {
|
|
return !!node[internalContainerInstanceKey];
|
|
}
|
|
function getClosestInstanceFromNode(targetNode) {
|
|
var targetInst = targetNode[internalInstanceKey];
|
|
if (targetInst) {
|
|
return targetInst;
|
|
}
|
|
var parentNode = targetNode.parentNode;
|
|
while (parentNode) {
|
|
targetInst = parentNode[internalContainerInstanceKey] || parentNode[internalInstanceKey];
|
|
if (targetInst) {
|
|
var alternate = targetInst.alternate;
|
|
if (targetInst.child !== null || alternate !== null && alternate.child !== null) {
|
|
var suspenseInstance = getParentSuspenseInstance(targetNode);
|
|
while (suspenseInstance !== null) {
|
|
var targetSuspenseInst = suspenseInstance[internalInstanceKey];
|
|
if (targetSuspenseInst) {
|
|
return targetSuspenseInst;
|
|
}
|
|
suspenseInstance = getParentSuspenseInstance(suspenseInstance);
|
|
}
|
|
}
|
|
return targetInst;
|
|
}
|
|
targetNode = parentNode;
|
|
parentNode = targetNode.parentNode;
|
|
}
|
|
return null;
|
|
}
|
|
function getInstanceFromNode(node) {
|
|
var inst = node[internalInstanceKey] || node[internalContainerInstanceKey];
|
|
if (inst) {
|
|
if (inst.tag === HostComponent || inst.tag === HostText || inst.tag === SuspenseComponent || inst.tag === HostRoot) {
|
|
return inst;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
function getNodeFromInstance(inst) {
|
|
if (inst.tag === HostComponent || inst.tag === HostText) {
|
|
return inst.stateNode;
|
|
}
|
|
throw new Error("getNodeFromInstance: Invalid argument.");
|
|
}
|
|
function getFiberCurrentPropsFromNode(node) {
|
|
return node[internalPropsKey] || null;
|
|
}
|
|
function updateFiberProps(node, props) {
|
|
node[internalPropsKey] = props;
|
|
}
|
|
function getEventListenerSet(node) {
|
|
var elementListenerSet = node[internalEventHandlersKey];
|
|
if (elementListenerSet === void 0) {
|
|
elementListenerSet = node[internalEventHandlersKey] = /* @__PURE__ */ new Set();
|
|
}
|
|
return elementListenerSet;
|
|
}
|
|
var loggedTypeFailures = {};
|
|
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
function setCurrentlyValidatingElement(element) {
|
|
{
|
|
if (element) {
|
|
var owner = element._owner;
|
|
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
} else {
|
|
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
}
|
|
}
|
|
}
|
|
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
{
|
|
var has3 = Function.call.bind(hasOwnProperty2);
|
|
for (var typeSpecName in typeSpecs) {
|
|
if (has3(typeSpecs, typeSpecName)) {
|
|
var error$1 = void 0;
|
|
try {
|
|
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
err.name = "Invariant Violation";
|
|
throw err;
|
|
}
|
|
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
} catch (ex) {
|
|
error$1 = ex;
|
|
}
|
|
if (error$1 && !(error$1 instanceof Error)) {
|
|
setCurrentlyValidatingElement(element);
|
|
error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
|
|
setCurrentlyValidatingElement(null);
|
|
}
|
|
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
loggedTypeFailures[error$1.message] = true;
|
|
setCurrentlyValidatingElement(element);
|
|
error("Failed %s type: %s", location, error$1.message);
|
|
setCurrentlyValidatingElement(null);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var valueStack = [];
|
|
var fiberStack;
|
|
{
|
|
fiberStack = [];
|
|
}
|
|
var index = -1;
|
|
function createCursor(defaultValue) {
|
|
return {
|
|
current: defaultValue
|
|
};
|
|
}
|
|
function pop(cursor, fiber) {
|
|
if (index < 0) {
|
|
{
|
|
error("Unexpected pop.");
|
|
}
|
|
return;
|
|
}
|
|
{
|
|
if (fiber !== fiberStack[index]) {
|
|
error("Unexpected Fiber popped.");
|
|
}
|
|
}
|
|
cursor.current = valueStack[index];
|
|
valueStack[index] = null;
|
|
{
|
|
fiberStack[index] = null;
|
|
}
|
|
index--;
|
|
}
|
|
function push(cursor, value, fiber) {
|
|
index++;
|
|
valueStack[index] = cursor.current;
|
|
{
|
|
fiberStack[index] = fiber;
|
|
}
|
|
cursor.current = value;
|
|
}
|
|
var warnedAboutMissingGetChildContext;
|
|
{
|
|
warnedAboutMissingGetChildContext = {};
|
|
}
|
|
var emptyContextObject = {};
|
|
{
|
|
Object.freeze(emptyContextObject);
|
|
}
|
|
var contextStackCursor = createCursor(emptyContextObject);
|
|
var didPerformWorkStackCursor = createCursor(false);
|
|
var previousContext = emptyContextObject;
|
|
function getUnmaskedContext(workInProgress2, Component, didPushOwnContextIfProvider) {
|
|
{
|
|
if (didPushOwnContextIfProvider && isContextProvider(Component)) {
|
|
return previousContext;
|
|
}
|
|
return contextStackCursor.current;
|
|
}
|
|
}
|
|
function cacheContext(workInProgress2, unmaskedContext, maskedContext) {
|
|
{
|
|
var instance = workInProgress2.stateNode;
|
|
instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext;
|
|
instance.__reactInternalMemoizedMaskedChildContext = maskedContext;
|
|
}
|
|
}
|
|
function getMaskedContext(workInProgress2, unmaskedContext) {
|
|
{
|
|
var type = workInProgress2.type;
|
|
var contextTypes = type.contextTypes;
|
|
if (!contextTypes) {
|
|
return emptyContextObject;
|
|
}
|
|
var instance = workInProgress2.stateNode;
|
|
if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) {
|
|
return instance.__reactInternalMemoizedMaskedChildContext;
|
|
}
|
|
var context = {};
|
|
for (var key in contextTypes) {
|
|
context[key] = unmaskedContext[key];
|
|
}
|
|
{
|
|
var name = getComponentNameFromFiber(workInProgress2) || "Unknown";
|
|
checkPropTypes(contextTypes, context, "context", name);
|
|
}
|
|
if (instance) {
|
|
cacheContext(workInProgress2, unmaskedContext, context);
|
|
}
|
|
return context;
|
|
}
|
|
}
|
|
function hasContextChanged() {
|
|
{
|
|
return didPerformWorkStackCursor.current;
|
|
}
|
|
}
|
|
function isContextProvider(type) {
|
|
{
|
|
var childContextTypes = type.childContextTypes;
|
|
return childContextTypes !== null && childContextTypes !== void 0;
|
|
}
|
|
}
|
|
function popContext(fiber) {
|
|
{
|
|
pop(didPerformWorkStackCursor, fiber);
|
|
pop(contextStackCursor, fiber);
|
|
}
|
|
}
|
|
function popTopLevelContextObject(fiber) {
|
|
{
|
|
pop(didPerformWorkStackCursor, fiber);
|
|
pop(contextStackCursor, fiber);
|
|
}
|
|
}
|
|
function pushTopLevelContextObject(fiber, context, didChange) {
|
|
{
|
|
if (contextStackCursor.current !== emptyContextObject) {
|
|
throw new Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
push(contextStackCursor, context, fiber);
|
|
push(didPerformWorkStackCursor, didChange, fiber);
|
|
}
|
|
}
|
|
function processChildContext(fiber, type, parentContext) {
|
|
{
|
|
var instance = fiber.stateNode;
|
|
var childContextTypes = type.childContextTypes;
|
|
if (typeof instance.getChildContext !== "function") {
|
|
{
|
|
var componentName = getComponentNameFromFiber(fiber) || "Unknown";
|
|
if (!warnedAboutMissingGetChildContext[componentName]) {
|
|
warnedAboutMissingGetChildContext[componentName] = true;
|
|
error("%s.childContextTypes is specified but there is no getChildContext() method on the instance. You can either define getChildContext() on %s or remove childContextTypes from it.", componentName, componentName);
|
|
}
|
|
}
|
|
return parentContext;
|
|
}
|
|
var childContext = instance.getChildContext();
|
|
for (var contextKey in childContext) {
|
|
if (!(contextKey in childContextTypes)) {
|
|
throw new Error((getComponentNameFromFiber(fiber) || "Unknown") + '.getChildContext(): key "' + contextKey + '" is not defined in childContextTypes.');
|
|
}
|
|
}
|
|
{
|
|
var name = getComponentNameFromFiber(fiber) || "Unknown";
|
|
checkPropTypes(childContextTypes, childContext, "child context", name);
|
|
}
|
|
return assign2({}, parentContext, childContext);
|
|
}
|
|
}
|
|
function pushContextProvider(workInProgress2) {
|
|
{
|
|
var instance = workInProgress2.stateNode;
|
|
var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject;
|
|
previousContext = contextStackCursor.current;
|
|
push(contextStackCursor, memoizedMergedChildContext, workInProgress2);
|
|
push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress2);
|
|
return true;
|
|
}
|
|
}
|
|
function invalidateContextProvider(workInProgress2, type, didChange) {
|
|
{
|
|
var instance = workInProgress2.stateNode;
|
|
if (!instance) {
|
|
throw new Error("Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
if (didChange) {
|
|
var mergedContext = processChildContext(workInProgress2, type, previousContext);
|
|
instance.__reactInternalMemoizedMergedChildContext = mergedContext;
|
|
pop(didPerformWorkStackCursor, workInProgress2);
|
|
pop(contextStackCursor, workInProgress2);
|
|
push(contextStackCursor, mergedContext, workInProgress2);
|
|
push(didPerformWorkStackCursor, didChange, workInProgress2);
|
|
} else {
|
|
pop(didPerformWorkStackCursor, workInProgress2);
|
|
push(didPerformWorkStackCursor, didChange, workInProgress2);
|
|
}
|
|
}
|
|
}
|
|
function findCurrentUnmaskedContext(fiber) {
|
|
{
|
|
if (!isFiberMounted(fiber) || fiber.tag !== ClassComponent) {
|
|
throw new Error("Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
var node = fiber;
|
|
do {
|
|
switch (node.tag) {
|
|
case HostRoot:
|
|
return node.stateNode.context;
|
|
case ClassComponent: {
|
|
var Component = node.type;
|
|
if (isContextProvider(Component)) {
|
|
return node.stateNode.__reactInternalMemoizedMergedChildContext;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
node = node.return;
|
|
} while (node !== null);
|
|
throw new Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
var LegacyRoot = 0;
|
|
var ConcurrentRoot = 1;
|
|
var syncQueue = null;
|
|
var includesLegacySyncCallbacks = false;
|
|
var isFlushingSyncQueue = false;
|
|
function scheduleSyncCallback(callback) {
|
|
if (syncQueue === null) {
|
|
syncQueue = [callback];
|
|
} else {
|
|
syncQueue.push(callback);
|
|
}
|
|
}
|
|
function scheduleLegacySyncCallback(callback) {
|
|
includesLegacySyncCallbacks = true;
|
|
scheduleSyncCallback(callback);
|
|
}
|
|
function flushSyncCallbacksOnlyInLegacyMode() {
|
|
if (includesLegacySyncCallbacks) {
|
|
flushSyncCallbacks();
|
|
}
|
|
}
|
|
function flushSyncCallbacks() {
|
|
if (!isFlushingSyncQueue && syncQueue !== null) {
|
|
isFlushingSyncQueue = true;
|
|
var i = 0;
|
|
var previousUpdatePriority = getCurrentUpdatePriority();
|
|
try {
|
|
var isSync = true;
|
|
var queue = syncQueue;
|
|
setCurrentUpdatePriority(DiscreteEventPriority);
|
|
for (; i < queue.length; i++) {
|
|
var callback = queue[i];
|
|
do {
|
|
callback = callback(isSync);
|
|
} while (callback !== null);
|
|
}
|
|
syncQueue = null;
|
|
includesLegacySyncCallbacks = false;
|
|
} catch (error2) {
|
|
if (syncQueue !== null) {
|
|
syncQueue = syncQueue.slice(i + 1);
|
|
}
|
|
scheduleCallback(ImmediatePriority, flushSyncCallbacks);
|
|
throw error2;
|
|
} finally {
|
|
setCurrentUpdatePriority(previousUpdatePriority);
|
|
isFlushingSyncQueue = false;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
var forkStack = [];
|
|
var forkStackIndex = 0;
|
|
var treeForkProvider = null;
|
|
var treeForkCount = 0;
|
|
var idStack = [];
|
|
var idStackIndex = 0;
|
|
var treeContextProvider = null;
|
|
var treeContextId = 1;
|
|
var treeContextOverflow = "";
|
|
function isForkedChild(workInProgress2) {
|
|
warnIfNotHydrating();
|
|
return (workInProgress2.flags & Forked) !== NoFlags;
|
|
}
|
|
function getForksAtLevel(workInProgress2) {
|
|
warnIfNotHydrating();
|
|
return treeForkCount;
|
|
}
|
|
function getTreeId() {
|
|
var overflow = treeContextOverflow;
|
|
var idWithLeadingBit = treeContextId;
|
|
var id = idWithLeadingBit & ~getLeadingBit(idWithLeadingBit);
|
|
return id.toString(32) + overflow;
|
|
}
|
|
function pushTreeFork(workInProgress2, totalChildren) {
|
|
warnIfNotHydrating();
|
|
forkStack[forkStackIndex++] = treeForkCount;
|
|
forkStack[forkStackIndex++] = treeForkProvider;
|
|
treeForkProvider = workInProgress2;
|
|
treeForkCount = totalChildren;
|
|
}
|
|
function pushTreeId(workInProgress2, totalChildren, index2) {
|
|
warnIfNotHydrating();
|
|
idStack[idStackIndex++] = treeContextId;
|
|
idStack[idStackIndex++] = treeContextOverflow;
|
|
idStack[idStackIndex++] = treeContextProvider;
|
|
treeContextProvider = workInProgress2;
|
|
var baseIdWithLeadingBit = treeContextId;
|
|
var baseOverflow = treeContextOverflow;
|
|
var baseLength = getBitLength(baseIdWithLeadingBit) - 1;
|
|
var baseId = baseIdWithLeadingBit & ~(1 << baseLength);
|
|
var slot = index2 + 1;
|
|
var length = getBitLength(totalChildren) + baseLength;
|
|
if (length > 30) {
|
|
var numberOfOverflowBits = baseLength - baseLength % 5;
|
|
var newOverflowBits = (1 << numberOfOverflowBits) - 1;
|
|
var newOverflow = (baseId & newOverflowBits).toString(32);
|
|
var restOfBaseId = baseId >> numberOfOverflowBits;
|
|
var restOfBaseLength = baseLength - numberOfOverflowBits;
|
|
var restOfLength = getBitLength(totalChildren) + restOfBaseLength;
|
|
var restOfNewBits = slot << restOfBaseLength;
|
|
var id = restOfNewBits | restOfBaseId;
|
|
var overflow = newOverflow + baseOverflow;
|
|
treeContextId = 1 << restOfLength | id;
|
|
treeContextOverflow = overflow;
|
|
} else {
|
|
var newBits = slot << baseLength;
|
|
var _id = newBits | baseId;
|
|
var _overflow = baseOverflow;
|
|
treeContextId = 1 << length | _id;
|
|
treeContextOverflow = _overflow;
|
|
}
|
|
}
|
|
function pushMaterializedTreeId(workInProgress2) {
|
|
warnIfNotHydrating();
|
|
var returnFiber = workInProgress2.return;
|
|
if (returnFiber !== null) {
|
|
var numberOfForks = 1;
|
|
var slotIndex = 0;
|
|
pushTreeFork(workInProgress2, numberOfForks);
|
|
pushTreeId(workInProgress2, numberOfForks, slotIndex);
|
|
}
|
|
}
|
|
function getBitLength(number) {
|
|
return 32 - clz32(number);
|
|
}
|
|
function getLeadingBit(id) {
|
|
return 1 << getBitLength(id) - 1;
|
|
}
|
|
function popTreeContext(workInProgress2) {
|
|
while (workInProgress2 === treeForkProvider) {
|
|
treeForkProvider = forkStack[--forkStackIndex];
|
|
forkStack[forkStackIndex] = null;
|
|
treeForkCount = forkStack[--forkStackIndex];
|
|
forkStack[forkStackIndex] = null;
|
|
}
|
|
while (workInProgress2 === treeContextProvider) {
|
|
treeContextProvider = idStack[--idStackIndex];
|
|
idStack[idStackIndex] = null;
|
|
treeContextOverflow = idStack[--idStackIndex];
|
|
idStack[idStackIndex] = null;
|
|
treeContextId = idStack[--idStackIndex];
|
|
idStack[idStackIndex] = null;
|
|
}
|
|
}
|
|
function getSuspendedTreeContext() {
|
|
warnIfNotHydrating();
|
|
if (treeContextProvider !== null) {
|
|
return {
|
|
id: treeContextId,
|
|
overflow: treeContextOverflow
|
|
};
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
function restoreSuspendedTreeContext(workInProgress2, suspendedContext) {
|
|
warnIfNotHydrating();
|
|
idStack[idStackIndex++] = treeContextId;
|
|
idStack[idStackIndex++] = treeContextOverflow;
|
|
idStack[idStackIndex++] = treeContextProvider;
|
|
treeContextId = suspendedContext.id;
|
|
treeContextOverflow = suspendedContext.overflow;
|
|
treeContextProvider = workInProgress2;
|
|
}
|
|
function warnIfNotHydrating() {
|
|
{
|
|
if (!getIsHydrating()) {
|
|
error("Expected to be hydrating. This is a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
}
|
|
var hydrationParentFiber = null;
|
|
var nextHydratableInstance = null;
|
|
var isHydrating = false;
|
|
var didSuspendOrErrorDEV = false;
|
|
var hydrationErrors = null;
|
|
function warnIfHydrating() {
|
|
{
|
|
if (isHydrating) {
|
|
error("We should not be hydrating here. This is a bug in React. Please file a bug.");
|
|
}
|
|
}
|
|
}
|
|
function markDidThrowWhileHydratingDEV() {
|
|
{
|
|
didSuspendOrErrorDEV = true;
|
|
}
|
|
}
|
|
function didSuspendOrErrorWhileHydratingDEV() {
|
|
{
|
|
return didSuspendOrErrorDEV;
|
|
}
|
|
}
|
|
function enterHydrationState(fiber) {
|
|
var parentInstance = fiber.stateNode.containerInfo;
|
|
nextHydratableInstance = getFirstHydratableChildWithinContainer(parentInstance);
|
|
hydrationParentFiber = fiber;
|
|
isHydrating = true;
|
|
hydrationErrors = null;
|
|
didSuspendOrErrorDEV = false;
|
|
return true;
|
|
}
|
|
function reenterHydrationStateFromDehydratedSuspenseInstance(fiber, suspenseInstance, treeContext) {
|
|
nextHydratableInstance = getFirstHydratableChildWithinSuspenseInstance(suspenseInstance);
|
|
hydrationParentFiber = fiber;
|
|
isHydrating = true;
|
|
hydrationErrors = null;
|
|
didSuspendOrErrorDEV = false;
|
|
if (treeContext !== null) {
|
|
restoreSuspendedTreeContext(fiber, treeContext);
|
|
}
|
|
return true;
|
|
}
|
|
function warnUnhydratedInstance(returnFiber, instance) {
|
|
{
|
|
switch (returnFiber.tag) {
|
|
case HostRoot: {
|
|
didNotHydrateInstanceWithinContainer(returnFiber.stateNode.containerInfo, instance);
|
|
break;
|
|
}
|
|
case HostComponent: {
|
|
var isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode;
|
|
didNotHydrateInstance(
|
|
returnFiber.type,
|
|
returnFiber.memoizedProps,
|
|
returnFiber.stateNode,
|
|
instance,
|
|
isConcurrentMode
|
|
);
|
|
break;
|
|
}
|
|
case SuspenseComponent: {
|
|
var suspenseState = returnFiber.memoizedState;
|
|
if (suspenseState.dehydrated !== null)
|
|
didNotHydrateInstanceWithinSuspenseInstance(suspenseState.dehydrated, instance);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function deleteHydratableInstance(returnFiber, instance) {
|
|
warnUnhydratedInstance(returnFiber, instance);
|
|
var childToDelete = createFiberFromHostInstanceForDeletion();
|
|
childToDelete.stateNode = instance;
|
|
childToDelete.return = returnFiber;
|
|
var deletions = returnFiber.deletions;
|
|
if (deletions === null) {
|
|
returnFiber.deletions = [childToDelete];
|
|
returnFiber.flags |= ChildDeletion;
|
|
} else {
|
|
deletions.push(childToDelete);
|
|
}
|
|
}
|
|
function warnNonhydratedInstance(returnFiber, fiber) {
|
|
{
|
|
if (didSuspendOrErrorDEV) {
|
|
return;
|
|
}
|
|
switch (returnFiber.tag) {
|
|
case HostRoot: {
|
|
var parentContainer = returnFiber.stateNode.containerInfo;
|
|
switch (fiber.tag) {
|
|
case HostComponent:
|
|
var type = fiber.type;
|
|
var props = fiber.pendingProps;
|
|
didNotFindHydratableInstanceWithinContainer(parentContainer, type);
|
|
break;
|
|
case HostText:
|
|
var text2 = fiber.pendingProps;
|
|
didNotFindHydratableTextInstanceWithinContainer(parentContainer, text2);
|
|
break;
|
|
}
|
|
break;
|
|
}
|
|
case HostComponent: {
|
|
var parentType = returnFiber.type;
|
|
var parentProps = returnFiber.memoizedProps;
|
|
var parentInstance = returnFiber.stateNode;
|
|
switch (fiber.tag) {
|
|
case HostComponent: {
|
|
var _type = fiber.type;
|
|
var _props = fiber.pendingProps;
|
|
var isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode;
|
|
didNotFindHydratableInstance(
|
|
parentType,
|
|
parentProps,
|
|
parentInstance,
|
|
_type,
|
|
_props,
|
|
isConcurrentMode
|
|
);
|
|
break;
|
|
}
|
|
case HostText: {
|
|
var _text = fiber.pendingProps;
|
|
var _isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode;
|
|
didNotFindHydratableTextInstance(
|
|
parentType,
|
|
parentProps,
|
|
parentInstance,
|
|
_text,
|
|
_isConcurrentMode
|
|
);
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
case SuspenseComponent: {
|
|
var suspenseState = returnFiber.memoizedState;
|
|
var _parentInstance = suspenseState.dehydrated;
|
|
if (_parentInstance !== null)
|
|
switch (fiber.tag) {
|
|
case HostComponent:
|
|
var _type2 = fiber.type;
|
|
var _props2 = fiber.pendingProps;
|
|
didNotFindHydratableInstanceWithinSuspenseInstance(_parentInstance, _type2);
|
|
break;
|
|
case HostText:
|
|
var _text2 = fiber.pendingProps;
|
|
didNotFindHydratableTextInstanceWithinSuspenseInstance(_parentInstance, _text2);
|
|
break;
|
|
}
|
|
break;
|
|
}
|
|
default:
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
function insertNonHydratedInstance(returnFiber, fiber) {
|
|
fiber.flags = fiber.flags & ~Hydrating | Placement;
|
|
warnNonhydratedInstance(returnFiber, fiber);
|
|
}
|
|
function tryHydrate(fiber, nextInstance) {
|
|
switch (fiber.tag) {
|
|
case HostComponent: {
|
|
var type = fiber.type;
|
|
var props = fiber.pendingProps;
|
|
var instance = canHydrateInstance(nextInstance, type);
|
|
if (instance !== null) {
|
|
fiber.stateNode = instance;
|
|
hydrationParentFiber = fiber;
|
|
nextHydratableInstance = getFirstHydratableChild(instance);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
case HostText: {
|
|
var text2 = fiber.pendingProps;
|
|
var textInstance = canHydrateTextInstance(nextInstance, text2);
|
|
if (textInstance !== null) {
|
|
fiber.stateNode = textInstance;
|
|
hydrationParentFiber = fiber;
|
|
nextHydratableInstance = null;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
case SuspenseComponent: {
|
|
var suspenseInstance = canHydrateSuspenseInstance(nextInstance);
|
|
if (suspenseInstance !== null) {
|
|
var suspenseState = {
|
|
dehydrated: suspenseInstance,
|
|
treeContext: getSuspendedTreeContext(),
|
|
retryLane: OffscreenLane
|
|
};
|
|
fiber.memoizedState = suspenseState;
|
|
var dehydratedFragment = createFiberFromDehydratedFragment(suspenseInstance);
|
|
dehydratedFragment.return = fiber;
|
|
fiber.child = dehydratedFragment;
|
|
hydrationParentFiber = fiber;
|
|
nextHydratableInstance = null;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
function shouldClientRenderOnMismatch(fiber) {
|
|
return (fiber.mode & ConcurrentMode) !== NoMode && (fiber.flags & DidCapture) === NoFlags;
|
|
}
|
|
function throwOnHydrationMismatch(fiber) {
|
|
throw new Error("Hydration failed because the initial UI does not match what was rendered on the server.");
|
|
}
|
|
function tryToClaimNextHydratableInstance(fiber) {
|
|
if (!isHydrating) {
|
|
return;
|
|
}
|
|
var nextInstance = nextHydratableInstance;
|
|
if (!nextInstance) {
|
|
if (shouldClientRenderOnMismatch(fiber)) {
|
|
warnNonhydratedInstance(hydrationParentFiber, fiber);
|
|
throwOnHydrationMismatch();
|
|
}
|
|
insertNonHydratedInstance(hydrationParentFiber, fiber);
|
|
isHydrating = false;
|
|
hydrationParentFiber = fiber;
|
|
return;
|
|
}
|
|
var firstAttemptedInstance = nextInstance;
|
|
if (!tryHydrate(fiber, nextInstance)) {
|
|
if (shouldClientRenderOnMismatch(fiber)) {
|
|
warnNonhydratedInstance(hydrationParentFiber, fiber);
|
|
throwOnHydrationMismatch();
|
|
}
|
|
nextInstance = getNextHydratableSibling(firstAttemptedInstance);
|
|
var prevHydrationParentFiber = hydrationParentFiber;
|
|
if (!nextInstance || !tryHydrate(fiber, nextInstance)) {
|
|
insertNonHydratedInstance(hydrationParentFiber, fiber);
|
|
isHydrating = false;
|
|
hydrationParentFiber = fiber;
|
|
return;
|
|
}
|
|
deleteHydratableInstance(prevHydrationParentFiber, firstAttemptedInstance);
|
|
}
|
|
}
|
|
function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) {
|
|
var instance = fiber.stateNode;
|
|
var shouldWarnIfMismatchDev = !didSuspendOrErrorDEV;
|
|
var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber, shouldWarnIfMismatchDev);
|
|
fiber.updateQueue = updatePayload;
|
|
if (updatePayload !== null) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
function prepareToHydrateHostTextInstance(fiber) {
|
|
var textInstance = fiber.stateNode;
|
|
var textContent = fiber.memoizedProps;
|
|
var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber);
|
|
if (shouldUpdate) {
|
|
var returnFiber = hydrationParentFiber;
|
|
if (returnFiber !== null) {
|
|
switch (returnFiber.tag) {
|
|
case HostRoot: {
|
|
var parentContainer = returnFiber.stateNode.containerInfo;
|
|
var isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode;
|
|
didNotMatchHydratedContainerTextInstance(
|
|
parentContainer,
|
|
textInstance,
|
|
textContent,
|
|
isConcurrentMode
|
|
);
|
|
break;
|
|
}
|
|
case HostComponent: {
|
|
var parentType = returnFiber.type;
|
|
var parentProps = returnFiber.memoizedProps;
|
|
var parentInstance = returnFiber.stateNode;
|
|
var _isConcurrentMode2 = (returnFiber.mode & ConcurrentMode) !== NoMode;
|
|
didNotMatchHydratedTextInstance(
|
|
parentType,
|
|
parentProps,
|
|
parentInstance,
|
|
textInstance,
|
|
textContent,
|
|
_isConcurrentMode2
|
|
);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return shouldUpdate;
|
|
}
|
|
function prepareToHydrateHostSuspenseInstance(fiber) {
|
|
var suspenseState = fiber.memoizedState;
|
|
var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
|
|
if (!suspenseInstance) {
|
|
throw new Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
hydrateSuspenseInstance(suspenseInstance, fiber);
|
|
}
|
|
function skipPastDehydratedSuspenseInstance(fiber) {
|
|
var suspenseState = fiber.memoizedState;
|
|
var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null;
|
|
if (!suspenseInstance) {
|
|
throw new Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance);
|
|
}
|
|
function popToNextHostParent(fiber) {
|
|
var parent = fiber.return;
|
|
while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== SuspenseComponent) {
|
|
parent = parent.return;
|
|
}
|
|
hydrationParentFiber = parent;
|
|
}
|
|
function popHydrationState(fiber) {
|
|
if (fiber !== hydrationParentFiber) {
|
|
return false;
|
|
}
|
|
if (!isHydrating) {
|
|
popToNextHostParent(fiber);
|
|
isHydrating = true;
|
|
return false;
|
|
}
|
|
if (fiber.tag !== HostRoot && (fiber.tag !== HostComponent || shouldDeleteUnhydratedTailInstances(fiber.type) && !shouldSetTextContent(fiber.type, fiber.memoizedProps))) {
|
|
var nextInstance = nextHydratableInstance;
|
|
if (nextInstance) {
|
|
if (shouldClientRenderOnMismatch(fiber)) {
|
|
warnIfUnhydratedTailNodes(fiber);
|
|
throwOnHydrationMismatch();
|
|
} else {
|
|
while (nextInstance) {
|
|
deleteHydratableInstance(fiber, nextInstance);
|
|
nextInstance = getNextHydratableSibling(nextInstance);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
popToNextHostParent(fiber);
|
|
if (fiber.tag === SuspenseComponent) {
|
|
nextHydratableInstance = skipPastDehydratedSuspenseInstance(fiber);
|
|
} else {
|
|
nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null;
|
|
}
|
|
return true;
|
|
}
|
|
function hasUnhydratedTailNodes() {
|
|
return isHydrating && nextHydratableInstance !== null;
|
|
}
|
|
function warnIfUnhydratedTailNodes(fiber) {
|
|
var nextInstance = nextHydratableInstance;
|
|
while (nextInstance) {
|
|
warnUnhydratedInstance(fiber, nextInstance);
|
|
nextInstance = getNextHydratableSibling(nextInstance);
|
|
}
|
|
}
|
|
function resetHydrationState() {
|
|
hydrationParentFiber = null;
|
|
nextHydratableInstance = null;
|
|
isHydrating = false;
|
|
didSuspendOrErrorDEV = false;
|
|
}
|
|
function upgradeHydrationErrorsToRecoverable() {
|
|
if (hydrationErrors !== null) {
|
|
queueRecoverableErrors(hydrationErrors);
|
|
hydrationErrors = null;
|
|
}
|
|
}
|
|
function getIsHydrating() {
|
|
return isHydrating;
|
|
}
|
|
function queueHydrationError(error2) {
|
|
if (hydrationErrors === null) {
|
|
hydrationErrors = [error2];
|
|
} else {
|
|
hydrationErrors.push(error2);
|
|
}
|
|
}
|
|
var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig;
|
|
var NoTransition = null;
|
|
function requestCurrentTransition() {
|
|
return ReactCurrentBatchConfig$1.transition;
|
|
}
|
|
var ReactStrictModeWarnings = {
|
|
recordUnsafeLifecycleWarnings: function(fiber, instance) {
|
|
},
|
|
flushPendingUnsafeLifecycleWarnings: function() {
|
|
},
|
|
recordLegacyContextWarning: function(fiber, instance) {
|
|
},
|
|
flushLegacyContextWarning: function() {
|
|
},
|
|
discardPendingWarnings: function() {
|
|
}
|
|
};
|
|
{
|
|
var findStrictRoot = function(fiber) {
|
|
var maybeStrictRoot = null;
|
|
var node = fiber;
|
|
while (node !== null) {
|
|
if (node.mode & StrictLegacyMode) {
|
|
maybeStrictRoot = node;
|
|
}
|
|
node = node.return;
|
|
}
|
|
return maybeStrictRoot;
|
|
};
|
|
var setToSortedString = function(set4) {
|
|
var array = [];
|
|
set4.forEach(function(value) {
|
|
array.push(value);
|
|
});
|
|
return array.sort().join(", ");
|
|
};
|
|
var pendingComponentWillMountWarnings = [];
|
|
var pendingUNSAFE_ComponentWillMountWarnings = [];
|
|
var pendingComponentWillReceivePropsWarnings = [];
|
|
var pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
|
|
var pendingComponentWillUpdateWarnings = [];
|
|
var pendingUNSAFE_ComponentWillUpdateWarnings = [];
|
|
var didWarnAboutUnsafeLifecycles = /* @__PURE__ */ new Set();
|
|
ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function(fiber, instance) {
|
|
if (didWarnAboutUnsafeLifecycles.has(fiber.type)) {
|
|
return;
|
|
}
|
|
if (typeof instance.componentWillMount === "function" && instance.componentWillMount.__suppressDeprecationWarning !== true) {
|
|
pendingComponentWillMountWarnings.push(fiber);
|
|
}
|
|
if (fiber.mode & StrictLegacyMode && typeof instance.UNSAFE_componentWillMount === "function") {
|
|
pendingUNSAFE_ComponentWillMountWarnings.push(fiber);
|
|
}
|
|
if (typeof instance.componentWillReceiveProps === "function" && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
|
|
pendingComponentWillReceivePropsWarnings.push(fiber);
|
|
}
|
|
if (fiber.mode & StrictLegacyMode && typeof instance.UNSAFE_componentWillReceiveProps === "function") {
|
|
pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber);
|
|
}
|
|
if (typeof instance.componentWillUpdate === "function" && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
|
|
pendingComponentWillUpdateWarnings.push(fiber);
|
|
}
|
|
if (fiber.mode & StrictLegacyMode && typeof instance.UNSAFE_componentWillUpdate === "function") {
|
|
pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber);
|
|
}
|
|
};
|
|
ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function() {
|
|
var componentWillMountUniqueNames = /* @__PURE__ */ new Set();
|
|
if (pendingComponentWillMountWarnings.length > 0) {
|
|
pendingComponentWillMountWarnings.forEach(function(fiber) {
|
|
componentWillMountUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
|
|
didWarnAboutUnsafeLifecycles.add(fiber.type);
|
|
});
|
|
pendingComponentWillMountWarnings = [];
|
|
}
|
|
var UNSAFE_componentWillMountUniqueNames = /* @__PURE__ */ new Set();
|
|
if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) {
|
|
pendingUNSAFE_ComponentWillMountWarnings.forEach(function(fiber) {
|
|
UNSAFE_componentWillMountUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
|
|
didWarnAboutUnsafeLifecycles.add(fiber.type);
|
|
});
|
|
pendingUNSAFE_ComponentWillMountWarnings = [];
|
|
}
|
|
var componentWillReceivePropsUniqueNames = /* @__PURE__ */ new Set();
|
|
if (pendingComponentWillReceivePropsWarnings.length > 0) {
|
|
pendingComponentWillReceivePropsWarnings.forEach(function(fiber) {
|
|
componentWillReceivePropsUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
|
|
didWarnAboutUnsafeLifecycles.add(fiber.type);
|
|
});
|
|
pendingComponentWillReceivePropsWarnings = [];
|
|
}
|
|
var UNSAFE_componentWillReceivePropsUniqueNames = /* @__PURE__ */ new Set();
|
|
if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) {
|
|
pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function(fiber) {
|
|
UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
|
|
didWarnAboutUnsafeLifecycles.add(fiber.type);
|
|
});
|
|
pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
|
|
}
|
|
var componentWillUpdateUniqueNames = /* @__PURE__ */ new Set();
|
|
if (pendingComponentWillUpdateWarnings.length > 0) {
|
|
pendingComponentWillUpdateWarnings.forEach(function(fiber) {
|
|
componentWillUpdateUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
|
|
didWarnAboutUnsafeLifecycles.add(fiber.type);
|
|
});
|
|
pendingComponentWillUpdateWarnings = [];
|
|
}
|
|
var UNSAFE_componentWillUpdateUniqueNames = /* @__PURE__ */ new Set();
|
|
if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) {
|
|
pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function(fiber) {
|
|
UNSAFE_componentWillUpdateUniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
|
|
didWarnAboutUnsafeLifecycles.add(fiber.type);
|
|
});
|
|
pendingUNSAFE_ComponentWillUpdateWarnings = [];
|
|
}
|
|
if (UNSAFE_componentWillMountUniqueNames.size > 0) {
|
|
var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames);
|
|
error("Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move code with side effects to componentDidMount, and set initial state in the constructor.\n\nPlease update the following components: %s", sortedNames);
|
|
}
|
|
if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) {
|
|
var _sortedNames = setToSortedString(UNSAFE_componentWillReceivePropsUniqueNames);
|
|
error("Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state\n\nPlease update the following components: %s", _sortedNames);
|
|
}
|
|
if (UNSAFE_componentWillUpdateUniqueNames.size > 0) {
|
|
var _sortedNames2 = setToSortedString(UNSAFE_componentWillUpdateUniqueNames);
|
|
error("Using UNSAFE_componentWillUpdate in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n\nPlease update the following components: %s", _sortedNames2);
|
|
}
|
|
if (componentWillMountUniqueNames.size > 0) {
|
|
var _sortedNames3 = setToSortedString(componentWillMountUniqueNames);
|
|
warn("componentWillMount has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move code with side effects to componentDidMount, and set initial state in the constructor.\n* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\nPlease update the following components: %s", _sortedNames3);
|
|
}
|
|
if (componentWillReceivePropsUniqueNames.size > 0) {
|
|
var _sortedNames4 = setToSortedString(componentWillReceivePropsUniqueNames);
|
|
warn("componentWillReceiveProps has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state\n* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\nPlease update the following components: %s", _sortedNames4);
|
|
}
|
|
if (componentWillUpdateUniqueNames.size > 0) {
|
|
var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames);
|
|
warn("componentWillUpdate has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\nPlease update the following components: %s", _sortedNames5);
|
|
}
|
|
};
|
|
var pendingLegacyContextWarning = /* @__PURE__ */ new Map();
|
|
var didWarnAboutLegacyContext = /* @__PURE__ */ new Set();
|
|
ReactStrictModeWarnings.recordLegacyContextWarning = function(fiber, instance) {
|
|
var strictRoot = findStrictRoot(fiber);
|
|
if (strictRoot === null) {
|
|
error("Expected to find a StrictMode component in a strict mode tree. This error is likely caused by a bug in React. Please file an issue.");
|
|
return;
|
|
}
|
|
if (didWarnAboutLegacyContext.has(fiber.type)) {
|
|
return;
|
|
}
|
|
var warningsForRoot = pendingLegacyContextWarning.get(strictRoot);
|
|
if (fiber.type.contextTypes != null || fiber.type.childContextTypes != null || instance !== null && typeof instance.getChildContext === "function") {
|
|
if (warningsForRoot === void 0) {
|
|
warningsForRoot = [];
|
|
pendingLegacyContextWarning.set(strictRoot, warningsForRoot);
|
|
}
|
|
warningsForRoot.push(fiber);
|
|
}
|
|
};
|
|
ReactStrictModeWarnings.flushLegacyContextWarning = function() {
|
|
pendingLegacyContextWarning.forEach(function(fiberArray, strictRoot) {
|
|
if (fiberArray.length === 0) {
|
|
return;
|
|
}
|
|
var firstFiber = fiberArray[0];
|
|
var uniqueNames = /* @__PURE__ */ new Set();
|
|
fiberArray.forEach(function(fiber) {
|
|
uniqueNames.add(getComponentNameFromFiber(fiber) || "Component");
|
|
didWarnAboutLegacyContext.add(fiber.type);
|
|
});
|
|
var sortedNames = setToSortedString(uniqueNames);
|
|
try {
|
|
setCurrentFiber(firstFiber);
|
|
error("Legacy context API has been detected within a strict-mode tree.\n\nThe old API will be supported in all 16.x releases, but applications using it should migrate to the new version.\n\nPlease update the following components: %s\n\nLearn more about this warning here: https://reactjs.org/link/legacy-context", sortedNames);
|
|
} finally {
|
|
resetCurrentFiber();
|
|
}
|
|
});
|
|
};
|
|
ReactStrictModeWarnings.discardPendingWarnings = function() {
|
|
pendingComponentWillMountWarnings = [];
|
|
pendingUNSAFE_ComponentWillMountWarnings = [];
|
|
pendingComponentWillReceivePropsWarnings = [];
|
|
pendingUNSAFE_ComponentWillReceivePropsWarnings = [];
|
|
pendingComponentWillUpdateWarnings = [];
|
|
pendingUNSAFE_ComponentWillUpdateWarnings = [];
|
|
pendingLegacyContextWarning = /* @__PURE__ */ new Map();
|
|
};
|
|
}
|
|
var didWarnAboutMaps;
|
|
var didWarnAboutGenerators;
|
|
var didWarnAboutStringRefs;
|
|
var ownerHasKeyUseWarning;
|
|
var ownerHasFunctionTypeWarning;
|
|
var warnForMissingKey = function(child, returnFiber) {
|
|
};
|
|
{
|
|
didWarnAboutMaps = false;
|
|
didWarnAboutGenerators = false;
|
|
didWarnAboutStringRefs = {};
|
|
ownerHasKeyUseWarning = {};
|
|
ownerHasFunctionTypeWarning = {};
|
|
warnForMissingKey = function(child, returnFiber) {
|
|
if (child === null || typeof child !== "object") {
|
|
return;
|
|
}
|
|
if (!child._store || child._store.validated || child.key != null) {
|
|
return;
|
|
}
|
|
if (typeof child._store !== "object") {
|
|
throw new Error("React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
child._store.validated = true;
|
|
var componentName = getComponentNameFromFiber(returnFiber) || "Component";
|
|
if (ownerHasKeyUseWarning[componentName]) {
|
|
return;
|
|
}
|
|
ownerHasKeyUseWarning[componentName] = true;
|
|
error('Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.');
|
|
};
|
|
}
|
|
function isReactClass(type) {
|
|
return type.prototype && type.prototype.isReactComponent;
|
|
}
|
|
function coerceRef(returnFiber, current3, element) {
|
|
var mixedRef = element.ref;
|
|
if (mixedRef !== null && typeof mixedRef !== "function" && typeof mixedRef !== "object") {
|
|
{
|
|
if ((returnFiber.mode & StrictLegacyMode || warnAboutStringRefs) && !(element._owner && element._self && element._owner.stateNode !== element._self) && !(element._owner && element._owner.tag !== ClassComponent) && !(typeof element.type === "function" && !isReactClass(element.type)) && element._owner) {
|
|
var componentName = getComponentNameFromFiber(returnFiber) || "Component";
|
|
if (!didWarnAboutStringRefs[componentName]) {
|
|
{
|
|
error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. We recommend using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', componentName, mixedRef);
|
|
}
|
|
didWarnAboutStringRefs[componentName] = true;
|
|
}
|
|
}
|
|
}
|
|
if (element._owner) {
|
|
var owner = element._owner;
|
|
var inst;
|
|
if (owner) {
|
|
var ownerFiber = owner;
|
|
if (ownerFiber.tag !== ClassComponent) {
|
|
throw new Error("Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref");
|
|
}
|
|
inst = ownerFiber.stateNode;
|
|
}
|
|
if (!inst) {
|
|
throw new Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
var resolvedInst = inst;
|
|
{
|
|
checkPropStringCoercion(mixedRef, "ref");
|
|
}
|
|
var stringRef = "" + mixedRef;
|
|
if (current3 !== null && current3.ref !== null && typeof current3.ref === "function" && current3.ref._stringRef === stringRef) {
|
|
return current3.ref;
|
|
}
|
|
var ref = function(value) {
|
|
var refs = resolvedInst.refs;
|
|
if (value === null) {
|
|
delete refs[stringRef];
|
|
} else {
|
|
refs[stringRef] = value;
|
|
}
|
|
};
|
|
ref._stringRef = stringRef;
|
|
return ref;
|
|
} else {
|
|
if (typeof mixedRef !== "string") {
|
|
throw new Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null.");
|
|
}
|
|
if (!element._owner) {
|
|
throw new Error("Element ref was specified as a string (" + mixedRef + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://reactjs.org/link/refs-must-have-owner for more information.");
|
|
}
|
|
}
|
|
}
|
|
return mixedRef;
|
|
}
|
|
function throwOnInvalidObjectType(returnFiber, newChild) {
|
|
var childString = Object.prototype.toString.call(newChild);
|
|
throw new Error("Objects are not valid as a React child (found: " + (childString === "[object Object]" ? "object with keys {" + Object.keys(newChild).join(", ") + "}" : childString) + "). If you meant to render a collection of children, use an array instead.");
|
|
}
|
|
function warnOnFunctionType(returnFiber) {
|
|
{
|
|
var componentName = getComponentNameFromFiber(returnFiber) || "Component";
|
|
if (ownerHasFunctionTypeWarning[componentName]) {
|
|
return;
|
|
}
|
|
ownerHasFunctionTypeWarning[componentName] = true;
|
|
error("Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.");
|
|
}
|
|
}
|
|
function resolveLazy(lazyType) {
|
|
var payload = lazyType._payload;
|
|
var init = lazyType._init;
|
|
return init(payload);
|
|
}
|
|
function ChildReconciler(shouldTrackSideEffects) {
|
|
function deleteChild(returnFiber, childToDelete) {
|
|
if (!shouldTrackSideEffects) {
|
|
return;
|
|
}
|
|
var deletions = returnFiber.deletions;
|
|
if (deletions === null) {
|
|
returnFiber.deletions = [childToDelete];
|
|
returnFiber.flags |= ChildDeletion;
|
|
} else {
|
|
deletions.push(childToDelete);
|
|
}
|
|
}
|
|
function deleteRemainingChildren(returnFiber, currentFirstChild) {
|
|
if (!shouldTrackSideEffects) {
|
|
return null;
|
|
}
|
|
var childToDelete = currentFirstChild;
|
|
while (childToDelete !== null) {
|
|
deleteChild(returnFiber, childToDelete);
|
|
childToDelete = childToDelete.sibling;
|
|
}
|
|
return null;
|
|
}
|
|
function mapRemainingChildren(returnFiber, currentFirstChild) {
|
|
var existingChildren = /* @__PURE__ */ new Map();
|
|
var existingChild = currentFirstChild;
|
|
while (existingChild !== null) {
|
|
if (existingChild.key !== null) {
|
|
existingChildren.set(existingChild.key, existingChild);
|
|
} else {
|
|
existingChildren.set(existingChild.index, existingChild);
|
|
}
|
|
existingChild = existingChild.sibling;
|
|
}
|
|
return existingChildren;
|
|
}
|
|
function useFiber(fiber, pendingProps) {
|
|
var clone = createWorkInProgress(fiber, pendingProps);
|
|
clone.index = 0;
|
|
clone.sibling = null;
|
|
return clone;
|
|
}
|
|
function placeChild(newFiber, lastPlacedIndex, newIndex) {
|
|
newFiber.index = newIndex;
|
|
if (!shouldTrackSideEffects) {
|
|
newFiber.flags |= Forked;
|
|
return lastPlacedIndex;
|
|
}
|
|
var current3 = newFiber.alternate;
|
|
if (current3 !== null) {
|
|
var oldIndex = current3.index;
|
|
if (oldIndex < lastPlacedIndex) {
|
|
newFiber.flags |= Placement;
|
|
return lastPlacedIndex;
|
|
} else {
|
|
return oldIndex;
|
|
}
|
|
} else {
|
|
newFiber.flags |= Placement;
|
|
return lastPlacedIndex;
|
|
}
|
|
}
|
|
function placeSingleChild(newFiber) {
|
|
if (shouldTrackSideEffects && newFiber.alternate === null) {
|
|
newFiber.flags |= Placement;
|
|
}
|
|
return newFiber;
|
|
}
|
|
function updateTextNode(returnFiber, current3, textContent, lanes) {
|
|
if (current3 === null || current3.tag !== HostText) {
|
|
var created = createFiberFromText(textContent, returnFiber.mode, lanes);
|
|
created.return = returnFiber;
|
|
return created;
|
|
} else {
|
|
var existing = useFiber(current3, textContent);
|
|
existing.return = returnFiber;
|
|
return existing;
|
|
}
|
|
}
|
|
function updateElement(returnFiber, current3, element, lanes) {
|
|
var elementType = element.type;
|
|
if (elementType === REACT_FRAGMENT_TYPE2) {
|
|
return updateFragment2(returnFiber, current3, element.props.children, lanes, element.key);
|
|
}
|
|
if (current3 !== null) {
|
|
if (current3.elementType === elementType || isCompatibleFamilyForHotReloading(current3, element) || typeof elementType === "object" && elementType !== null && elementType.$$typeof === REACT_LAZY_TYPE2 && resolveLazy(elementType) === current3.type) {
|
|
var existing = useFiber(current3, element.props);
|
|
existing.ref = coerceRef(returnFiber, current3, element);
|
|
existing.return = returnFiber;
|
|
{
|
|
existing._debugSource = element._source;
|
|
existing._debugOwner = element._owner;
|
|
}
|
|
return existing;
|
|
}
|
|
}
|
|
var created = createFiberFromElement(element, returnFiber.mode, lanes);
|
|
created.ref = coerceRef(returnFiber, current3, element);
|
|
created.return = returnFiber;
|
|
return created;
|
|
}
|
|
function updatePortal(returnFiber, current3, portal, lanes) {
|
|
if (current3 === null || current3.tag !== HostPortal || current3.stateNode.containerInfo !== portal.containerInfo || current3.stateNode.implementation !== portal.implementation) {
|
|
var created = createFiberFromPortal(portal, returnFiber.mode, lanes);
|
|
created.return = returnFiber;
|
|
return created;
|
|
} else {
|
|
var existing = useFiber(current3, portal.children || []);
|
|
existing.return = returnFiber;
|
|
return existing;
|
|
}
|
|
}
|
|
function updateFragment2(returnFiber, current3, fragment, lanes, key) {
|
|
if (current3 === null || current3.tag !== Fragment7) {
|
|
var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key);
|
|
created.return = returnFiber;
|
|
return created;
|
|
} else {
|
|
var existing = useFiber(current3, fragment);
|
|
existing.return = returnFiber;
|
|
return existing;
|
|
}
|
|
}
|
|
function createChild(returnFiber, newChild, lanes) {
|
|
if (typeof newChild === "string" && newChild !== "" || typeof newChild === "number") {
|
|
var created = createFiberFromText("" + newChild, returnFiber.mode, lanes);
|
|
created.return = returnFiber;
|
|
return created;
|
|
}
|
|
if (typeof newChild === "object" && newChild !== null) {
|
|
switch (newChild.$$typeof) {
|
|
case REACT_ELEMENT_TYPE2: {
|
|
var _created = createFiberFromElement(newChild, returnFiber.mode, lanes);
|
|
_created.ref = coerceRef(returnFiber, null, newChild);
|
|
_created.return = returnFiber;
|
|
return _created;
|
|
}
|
|
case REACT_PORTAL_TYPE2: {
|
|
var _created2 = createFiberFromPortal(newChild, returnFiber.mode, lanes);
|
|
_created2.return = returnFiber;
|
|
return _created2;
|
|
}
|
|
case REACT_LAZY_TYPE2: {
|
|
var payload = newChild._payload;
|
|
var init = newChild._init;
|
|
return createChild(returnFiber, init(payload), lanes);
|
|
}
|
|
}
|
|
if (isArray2(newChild) || getIteratorFn(newChild)) {
|
|
var _created3 = createFiberFromFragment(newChild, returnFiber.mode, lanes, null);
|
|
_created3.return = returnFiber;
|
|
return _created3;
|
|
}
|
|
throwOnInvalidObjectType(returnFiber, newChild);
|
|
}
|
|
{
|
|
if (typeof newChild === "function") {
|
|
warnOnFunctionType(returnFiber);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
function updateSlot(returnFiber, oldFiber, newChild, lanes) {
|
|
var key = oldFiber !== null ? oldFiber.key : null;
|
|
if (typeof newChild === "string" && newChild !== "" || typeof newChild === "number") {
|
|
if (key !== null) {
|
|
return null;
|
|
}
|
|
return updateTextNode(returnFiber, oldFiber, "" + newChild, lanes);
|
|
}
|
|
if (typeof newChild === "object" && newChild !== null) {
|
|
switch (newChild.$$typeof) {
|
|
case REACT_ELEMENT_TYPE2: {
|
|
if (newChild.key === key) {
|
|
return updateElement(returnFiber, oldFiber, newChild, lanes);
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
case REACT_PORTAL_TYPE2: {
|
|
if (newChild.key === key) {
|
|
return updatePortal(returnFiber, oldFiber, newChild, lanes);
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
case REACT_LAZY_TYPE2: {
|
|
var payload = newChild._payload;
|
|
var init = newChild._init;
|
|
return updateSlot(returnFiber, oldFiber, init(payload), lanes);
|
|
}
|
|
}
|
|
if (isArray2(newChild) || getIteratorFn(newChild)) {
|
|
if (key !== null) {
|
|
return null;
|
|
}
|
|
return updateFragment2(returnFiber, oldFiber, newChild, lanes, null);
|
|
}
|
|
throwOnInvalidObjectType(returnFiber, newChild);
|
|
}
|
|
{
|
|
if (typeof newChild === "function") {
|
|
warnOnFunctionType(returnFiber);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
function updateFromMap(existingChildren, returnFiber, newIdx, newChild, lanes) {
|
|
if (typeof newChild === "string" && newChild !== "" || typeof newChild === "number") {
|
|
var matchedFiber = existingChildren.get(newIdx) || null;
|
|
return updateTextNode(returnFiber, matchedFiber, "" + newChild, lanes);
|
|
}
|
|
if (typeof newChild === "object" && newChild !== null) {
|
|
switch (newChild.$$typeof) {
|
|
case REACT_ELEMENT_TYPE2: {
|
|
var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
|
|
return updateElement(returnFiber, _matchedFiber, newChild, lanes);
|
|
}
|
|
case REACT_PORTAL_TYPE2: {
|
|
var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null;
|
|
return updatePortal(returnFiber, _matchedFiber2, newChild, lanes);
|
|
}
|
|
case REACT_LAZY_TYPE2:
|
|
var payload = newChild._payload;
|
|
var init = newChild._init;
|
|
return updateFromMap(existingChildren, returnFiber, newIdx, init(payload), lanes);
|
|
}
|
|
if (isArray2(newChild) || getIteratorFn(newChild)) {
|
|
var _matchedFiber3 = existingChildren.get(newIdx) || null;
|
|
return updateFragment2(returnFiber, _matchedFiber3, newChild, lanes, null);
|
|
}
|
|
throwOnInvalidObjectType(returnFiber, newChild);
|
|
}
|
|
{
|
|
if (typeof newChild === "function") {
|
|
warnOnFunctionType(returnFiber);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
function warnOnInvalidKey(child, knownKeys, returnFiber) {
|
|
{
|
|
if (typeof child !== "object" || child === null) {
|
|
return knownKeys;
|
|
}
|
|
switch (child.$$typeof) {
|
|
case REACT_ELEMENT_TYPE2:
|
|
case REACT_PORTAL_TYPE2:
|
|
warnForMissingKey(child, returnFiber);
|
|
var key = child.key;
|
|
if (typeof key !== "string") {
|
|
break;
|
|
}
|
|
if (knownKeys === null) {
|
|
knownKeys = /* @__PURE__ */ new Set();
|
|
knownKeys.add(key);
|
|
break;
|
|
}
|
|
if (!knownKeys.has(key)) {
|
|
knownKeys.add(key);
|
|
break;
|
|
}
|
|
error("Encountered two children with the same key, `%s`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted \u2014 the behavior is unsupported and could change in a future version.", key);
|
|
break;
|
|
case REACT_LAZY_TYPE2:
|
|
var payload = child._payload;
|
|
var init = child._init;
|
|
warnOnInvalidKey(init(payload), knownKeys, returnFiber);
|
|
break;
|
|
}
|
|
}
|
|
return knownKeys;
|
|
}
|
|
function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, lanes) {
|
|
{
|
|
var knownKeys = null;
|
|
for (var i = 0; i < newChildren.length; i++) {
|
|
var child = newChildren[i];
|
|
knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber);
|
|
}
|
|
}
|
|
var resultingFirstChild = null;
|
|
var previousNewFiber = null;
|
|
var oldFiber = currentFirstChild;
|
|
var lastPlacedIndex = 0;
|
|
var newIdx = 0;
|
|
var nextOldFiber = null;
|
|
for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) {
|
|
if (oldFiber.index > newIdx) {
|
|
nextOldFiber = oldFiber;
|
|
oldFiber = null;
|
|
} else {
|
|
nextOldFiber = oldFiber.sibling;
|
|
}
|
|
var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], lanes);
|
|
if (newFiber === null) {
|
|
if (oldFiber === null) {
|
|
oldFiber = nextOldFiber;
|
|
}
|
|
break;
|
|
}
|
|
if (shouldTrackSideEffects) {
|
|
if (oldFiber && newFiber.alternate === null) {
|
|
deleteChild(returnFiber, oldFiber);
|
|
}
|
|
}
|
|
lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
|
|
if (previousNewFiber === null) {
|
|
resultingFirstChild = newFiber;
|
|
} else {
|
|
previousNewFiber.sibling = newFiber;
|
|
}
|
|
previousNewFiber = newFiber;
|
|
oldFiber = nextOldFiber;
|
|
}
|
|
if (newIdx === newChildren.length) {
|
|
deleteRemainingChildren(returnFiber, oldFiber);
|
|
if (getIsHydrating()) {
|
|
var numberOfForks = newIdx;
|
|
pushTreeFork(returnFiber, numberOfForks);
|
|
}
|
|
return resultingFirstChild;
|
|
}
|
|
if (oldFiber === null) {
|
|
for (; newIdx < newChildren.length; newIdx++) {
|
|
var _newFiber = createChild(returnFiber, newChildren[newIdx], lanes);
|
|
if (_newFiber === null) {
|
|
continue;
|
|
}
|
|
lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx);
|
|
if (previousNewFiber === null) {
|
|
resultingFirstChild = _newFiber;
|
|
} else {
|
|
previousNewFiber.sibling = _newFiber;
|
|
}
|
|
previousNewFiber = _newFiber;
|
|
}
|
|
if (getIsHydrating()) {
|
|
var _numberOfForks = newIdx;
|
|
pushTreeFork(returnFiber, _numberOfForks);
|
|
}
|
|
return resultingFirstChild;
|
|
}
|
|
var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
|
|
for (; newIdx < newChildren.length; newIdx++) {
|
|
var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], lanes);
|
|
if (_newFiber2 !== null) {
|
|
if (shouldTrackSideEffects) {
|
|
if (_newFiber2.alternate !== null) {
|
|
existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key);
|
|
}
|
|
}
|
|
lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx);
|
|
if (previousNewFiber === null) {
|
|
resultingFirstChild = _newFiber2;
|
|
} else {
|
|
previousNewFiber.sibling = _newFiber2;
|
|
}
|
|
previousNewFiber = _newFiber2;
|
|
}
|
|
}
|
|
if (shouldTrackSideEffects) {
|
|
existingChildren.forEach(function(child2) {
|
|
return deleteChild(returnFiber, child2);
|
|
});
|
|
}
|
|
if (getIsHydrating()) {
|
|
var _numberOfForks2 = newIdx;
|
|
pushTreeFork(returnFiber, _numberOfForks2);
|
|
}
|
|
return resultingFirstChild;
|
|
}
|
|
function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, lanes) {
|
|
var iteratorFn = getIteratorFn(newChildrenIterable);
|
|
if (typeof iteratorFn !== "function") {
|
|
throw new Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
{
|
|
if (typeof Symbol === "function" && newChildrenIterable[Symbol.toStringTag] === "Generator") {
|
|
if (!didWarnAboutGenerators) {
|
|
error("Using Generators as children is unsupported and will likely yield unexpected results because enumerating a generator mutates it. You may convert it to an array with `Array.from()` or the `[...spread]` operator before rendering. Keep in mind you might need to polyfill these features for older browsers.");
|
|
}
|
|
didWarnAboutGenerators = true;
|
|
}
|
|
if (newChildrenIterable.entries === iteratorFn) {
|
|
if (!didWarnAboutMaps) {
|
|
error("Using Maps as children is not supported. Use an array of keyed ReactElements instead.");
|
|
}
|
|
didWarnAboutMaps = true;
|
|
}
|
|
var _newChildren = iteratorFn.call(newChildrenIterable);
|
|
if (_newChildren) {
|
|
var knownKeys = null;
|
|
var _step = _newChildren.next();
|
|
for (; !_step.done; _step = _newChildren.next()) {
|
|
var child = _step.value;
|
|
knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber);
|
|
}
|
|
}
|
|
}
|
|
var newChildren = iteratorFn.call(newChildrenIterable);
|
|
if (newChildren == null) {
|
|
throw new Error("An iterable object provided no iterator.");
|
|
}
|
|
var resultingFirstChild = null;
|
|
var previousNewFiber = null;
|
|
var oldFiber = currentFirstChild;
|
|
var lastPlacedIndex = 0;
|
|
var newIdx = 0;
|
|
var nextOldFiber = null;
|
|
var step = newChildren.next();
|
|
for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) {
|
|
if (oldFiber.index > newIdx) {
|
|
nextOldFiber = oldFiber;
|
|
oldFiber = null;
|
|
} else {
|
|
nextOldFiber = oldFiber.sibling;
|
|
}
|
|
var newFiber = updateSlot(returnFiber, oldFiber, step.value, lanes);
|
|
if (newFiber === null) {
|
|
if (oldFiber === null) {
|
|
oldFiber = nextOldFiber;
|
|
}
|
|
break;
|
|
}
|
|
if (shouldTrackSideEffects) {
|
|
if (oldFiber && newFiber.alternate === null) {
|
|
deleteChild(returnFiber, oldFiber);
|
|
}
|
|
}
|
|
lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx);
|
|
if (previousNewFiber === null) {
|
|
resultingFirstChild = newFiber;
|
|
} else {
|
|
previousNewFiber.sibling = newFiber;
|
|
}
|
|
previousNewFiber = newFiber;
|
|
oldFiber = nextOldFiber;
|
|
}
|
|
if (step.done) {
|
|
deleteRemainingChildren(returnFiber, oldFiber);
|
|
if (getIsHydrating()) {
|
|
var numberOfForks = newIdx;
|
|
pushTreeFork(returnFiber, numberOfForks);
|
|
}
|
|
return resultingFirstChild;
|
|
}
|
|
if (oldFiber === null) {
|
|
for (; !step.done; newIdx++, step = newChildren.next()) {
|
|
var _newFiber3 = createChild(returnFiber, step.value, lanes);
|
|
if (_newFiber3 === null) {
|
|
continue;
|
|
}
|
|
lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx);
|
|
if (previousNewFiber === null) {
|
|
resultingFirstChild = _newFiber3;
|
|
} else {
|
|
previousNewFiber.sibling = _newFiber3;
|
|
}
|
|
previousNewFiber = _newFiber3;
|
|
}
|
|
if (getIsHydrating()) {
|
|
var _numberOfForks3 = newIdx;
|
|
pushTreeFork(returnFiber, _numberOfForks3);
|
|
}
|
|
return resultingFirstChild;
|
|
}
|
|
var existingChildren = mapRemainingChildren(returnFiber, oldFiber);
|
|
for (; !step.done; newIdx++, step = newChildren.next()) {
|
|
var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, lanes);
|
|
if (_newFiber4 !== null) {
|
|
if (shouldTrackSideEffects) {
|
|
if (_newFiber4.alternate !== null) {
|
|
existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key);
|
|
}
|
|
}
|
|
lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx);
|
|
if (previousNewFiber === null) {
|
|
resultingFirstChild = _newFiber4;
|
|
} else {
|
|
previousNewFiber.sibling = _newFiber4;
|
|
}
|
|
previousNewFiber = _newFiber4;
|
|
}
|
|
}
|
|
if (shouldTrackSideEffects) {
|
|
existingChildren.forEach(function(child2) {
|
|
return deleteChild(returnFiber, child2);
|
|
});
|
|
}
|
|
if (getIsHydrating()) {
|
|
var _numberOfForks4 = newIdx;
|
|
pushTreeFork(returnFiber, _numberOfForks4);
|
|
}
|
|
return resultingFirstChild;
|
|
}
|
|
function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, lanes) {
|
|
if (currentFirstChild !== null && currentFirstChild.tag === HostText) {
|
|
deleteRemainingChildren(returnFiber, currentFirstChild.sibling);
|
|
var existing = useFiber(currentFirstChild, textContent);
|
|
existing.return = returnFiber;
|
|
return existing;
|
|
}
|
|
deleteRemainingChildren(returnFiber, currentFirstChild);
|
|
var created = createFiberFromText(textContent, returnFiber.mode, lanes);
|
|
created.return = returnFiber;
|
|
return created;
|
|
}
|
|
function reconcileSingleElement(returnFiber, currentFirstChild, element, lanes) {
|
|
var key = element.key;
|
|
var child = currentFirstChild;
|
|
while (child !== null) {
|
|
if (child.key === key) {
|
|
var elementType = element.type;
|
|
if (elementType === REACT_FRAGMENT_TYPE2) {
|
|
if (child.tag === Fragment7) {
|
|
deleteRemainingChildren(returnFiber, child.sibling);
|
|
var existing = useFiber(child, element.props.children);
|
|
existing.return = returnFiber;
|
|
{
|
|
existing._debugSource = element._source;
|
|
existing._debugOwner = element._owner;
|
|
}
|
|
return existing;
|
|
}
|
|
} else {
|
|
if (child.elementType === elementType || isCompatibleFamilyForHotReloading(child, element) || typeof elementType === "object" && elementType !== null && elementType.$$typeof === REACT_LAZY_TYPE2 && resolveLazy(elementType) === child.type) {
|
|
deleteRemainingChildren(returnFiber, child.sibling);
|
|
var _existing = useFiber(child, element.props);
|
|
_existing.ref = coerceRef(returnFiber, child, element);
|
|
_existing.return = returnFiber;
|
|
{
|
|
_existing._debugSource = element._source;
|
|
_existing._debugOwner = element._owner;
|
|
}
|
|
return _existing;
|
|
}
|
|
}
|
|
deleteRemainingChildren(returnFiber, child);
|
|
break;
|
|
} else {
|
|
deleteChild(returnFiber, child);
|
|
}
|
|
child = child.sibling;
|
|
}
|
|
if (element.type === REACT_FRAGMENT_TYPE2) {
|
|
var created = createFiberFromFragment(element.props.children, returnFiber.mode, lanes, element.key);
|
|
created.return = returnFiber;
|
|
return created;
|
|
} else {
|
|
var _created4 = createFiberFromElement(element, returnFiber.mode, lanes);
|
|
_created4.ref = coerceRef(returnFiber, currentFirstChild, element);
|
|
_created4.return = returnFiber;
|
|
return _created4;
|
|
}
|
|
}
|
|
function reconcileSinglePortal(returnFiber, currentFirstChild, portal, lanes) {
|
|
var key = portal.key;
|
|
var child = currentFirstChild;
|
|
while (child !== null) {
|
|
if (child.key === key) {
|
|
if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) {
|
|
deleteRemainingChildren(returnFiber, child.sibling);
|
|
var existing = useFiber(child, portal.children || []);
|
|
existing.return = returnFiber;
|
|
return existing;
|
|
} else {
|
|
deleteRemainingChildren(returnFiber, child);
|
|
break;
|
|
}
|
|
} else {
|
|
deleteChild(returnFiber, child);
|
|
}
|
|
child = child.sibling;
|
|
}
|
|
var created = createFiberFromPortal(portal, returnFiber.mode, lanes);
|
|
created.return = returnFiber;
|
|
return created;
|
|
}
|
|
function reconcileChildFibers2(returnFiber, currentFirstChild, newChild, lanes) {
|
|
var isUnkeyedTopLevelFragment = typeof newChild === "object" && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE2 && newChild.key === null;
|
|
if (isUnkeyedTopLevelFragment) {
|
|
newChild = newChild.props.children;
|
|
}
|
|
if (typeof newChild === "object" && newChild !== null) {
|
|
switch (newChild.$$typeof) {
|
|
case REACT_ELEMENT_TYPE2:
|
|
return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, lanes));
|
|
case REACT_PORTAL_TYPE2:
|
|
return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, lanes));
|
|
case REACT_LAZY_TYPE2:
|
|
var payload = newChild._payload;
|
|
var init = newChild._init;
|
|
return reconcileChildFibers2(returnFiber, currentFirstChild, init(payload), lanes);
|
|
}
|
|
if (isArray2(newChild)) {
|
|
return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, lanes);
|
|
}
|
|
if (getIteratorFn(newChild)) {
|
|
return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, lanes);
|
|
}
|
|
throwOnInvalidObjectType(returnFiber, newChild);
|
|
}
|
|
if (typeof newChild === "string" && newChild !== "" || typeof newChild === "number") {
|
|
return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, "" + newChild, lanes));
|
|
}
|
|
{
|
|
if (typeof newChild === "function") {
|
|
warnOnFunctionType(returnFiber);
|
|
}
|
|
}
|
|
return deleteRemainingChildren(returnFiber, currentFirstChild);
|
|
}
|
|
return reconcileChildFibers2;
|
|
}
|
|
var reconcileChildFibers = ChildReconciler(true);
|
|
var mountChildFibers = ChildReconciler(false);
|
|
function cloneChildFibers(current3, workInProgress2) {
|
|
if (current3 !== null && workInProgress2.child !== current3.child) {
|
|
throw new Error("Resuming work not yet implemented.");
|
|
}
|
|
if (workInProgress2.child === null) {
|
|
return;
|
|
}
|
|
var currentChild = workInProgress2.child;
|
|
var newChild = createWorkInProgress(currentChild, currentChild.pendingProps);
|
|
workInProgress2.child = newChild;
|
|
newChild.return = workInProgress2;
|
|
while (currentChild.sibling !== null) {
|
|
currentChild = currentChild.sibling;
|
|
newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps);
|
|
newChild.return = workInProgress2;
|
|
}
|
|
newChild.sibling = null;
|
|
}
|
|
function resetChildFibers(workInProgress2, lanes) {
|
|
var child = workInProgress2.child;
|
|
while (child !== null) {
|
|
resetWorkInProgress(child, lanes);
|
|
child = child.sibling;
|
|
}
|
|
}
|
|
var valueCursor = createCursor(null);
|
|
var rendererSigil;
|
|
{
|
|
rendererSigil = {};
|
|
}
|
|
var currentlyRenderingFiber = null;
|
|
var lastContextDependency = null;
|
|
var lastFullyObservedContext = null;
|
|
var isDisallowedContextReadInDEV = false;
|
|
function resetContextDependencies() {
|
|
currentlyRenderingFiber = null;
|
|
lastContextDependency = null;
|
|
lastFullyObservedContext = null;
|
|
{
|
|
isDisallowedContextReadInDEV = false;
|
|
}
|
|
}
|
|
function enterDisallowedContextReadInDEV() {
|
|
{
|
|
isDisallowedContextReadInDEV = true;
|
|
}
|
|
}
|
|
function exitDisallowedContextReadInDEV() {
|
|
{
|
|
isDisallowedContextReadInDEV = false;
|
|
}
|
|
}
|
|
function pushProvider(providerFiber, context, nextValue) {
|
|
{
|
|
push(valueCursor, context._currentValue, providerFiber);
|
|
context._currentValue = nextValue;
|
|
{
|
|
if (context._currentRenderer !== void 0 && context._currentRenderer !== null && context._currentRenderer !== rendererSigil) {
|
|
error("Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported.");
|
|
}
|
|
context._currentRenderer = rendererSigil;
|
|
}
|
|
}
|
|
}
|
|
function popProvider(context, providerFiber) {
|
|
var currentValue = valueCursor.current;
|
|
pop(valueCursor, providerFiber);
|
|
{
|
|
{
|
|
context._currentValue = currentValue;
|
|
}
|
|
}
|
|
}
|
|
function scheduleContextWorkOnParentPath(parent, renderLanes2, propagationRoot) {
|
|
var node = parent;
|
|
while (node !== null) {
|
|
var alternate = node.alternate;
|
|
if (!isSubsetOfLanes(node.childLanes, renderLanes2)) {
|
|
node.childLanes = mergeLanes(node.childLanes, renderLanes2);
|
|
if (alternate !== null) {
|
|
alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes2);
|
|
}
|
|
} else if (alternate !== null && !isSubsetOfLanes(alternate.childLanes, renderLanes2)) {
|
|
alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes2);
|
|
}
|
|
if (node === propagationRoot) {
|
|
break;
|
|
}
|
|
node = node.return;
|
|
}
|
|
{
|
|
if (node !== propagationRoot) {
|
|
error("Expected to find the propagation root when scheduling context work. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
}
|
|
function propagateContextChange(workInProgress2, context, renderLanes2) {
|
|
{
|
|
propagateContextChange_eager(workInProgress2, context, renderLanes2);
|
|
}
|
|
}
|
|
function propagateContextChange_eager(workInProgress2, context, renderLanes2) {
|
|
var fiber = workInProgress2.child;
|
|
if (fiber !== null) {
|
|
fiber.return = workInProgress2;
|
|
}
|
|
while (fiber !== null) {
|
|
var nextFiber = void 0;
|
|
var list = fiber.dependencies;
|
|
if (list !== null) {
|
|
nextFiber = fiber.child;
|
|
var dependency = list.firstContext;
|
|
while (dependency !== null) {
|
|
if (dependency.context === context) {
|
|
if (fiber.tag === ClassComponent) {
|
|
var lane = pickArbitraryLane(renderLanes2);
|
|
var update = createUpdate(NoTimestamp, lane);
|
|
update.tag = ForceUpdate;
|
|
var updateQueue = fiber.updateQueue;
|
|
if (updateQueue === null)
|
|
;
|
|
else {
|
|
var sharedQueue = updateQueue.shared;
|
|
var pending = sharedQueue.pending;
|
|
if (pending === null) {
|
|
update.next = update;
|
|
} else {
|
|
update.next = pending.next;
|
|
pending.next = update;
|
|
}
|
|
sharedQueue.pending = update;
|
|
}
|
|
}
|
|
fiber.lanes = mergeLanes(fiber.lanes, renderLanes2);
|
|
var alternate = fiber.alternate;
|
|
if (alternate !== null) {
|
|
alternate.lanes = mergeLanes(alternate.lanes, renderLanes2);
|
|
}
|
|
scheduleContextWorkOnParentPath(fiber.return, renderLanes2, workInProgress2);
|
|
list.lanes = mergeLanes(list.lanes, renderLanes2);
|
|
break;
|
|
}
|
|
dependency = dependency.next;
|
|
}
|
|
} else if (fiber.tag === ContextProvider) {
|
|
nextFiber = fiber.type === workInProgress2.type ? null : fiber.child;
|
|
} else if (fiber.tag === DehydratedFragment) {
|
|
var parentSuspense = fiber.return;
|
|
if (parentSuspense === null) {
|
|
throw new Error("We just came from a parent so we must have had a parent. This is a bug in React.");
|
|
}
|
|
parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes2);
|
|
var _alternate = parentSuspense.alternate;
|
|
if (_alternate !== null) {
|
|
_alternate.lanes = mergeLanes(_alternate.lanes, renderLanes2);
|
|
}
|
|
scheduleContextWorkOnParentPath(parentSuspense, renderLanes2, workInProgress2);
|
|
nextFiber = fiber.sibling;
|
|
} else {
|
|
nextFiber = fiber.child;
|
|
}
|
|
if (nextFiber !== null) {
|
|
nextFiber.return = fiber;
|
|
} else {
|
|
nextFiber = fiber;
|
|
while (nextFiber !== null) {
|
|
if (nextFiber === workInProgress2) {
|
|
nextFiber = null;
|
|
break;
|
|
}
|
|
var sibling = nextFiber.sibling;
|
|
if (sibling !== null) {
|
|
sibling.return = nextFiber.return;
|
|
nextFiber = sibling;
|
|
break;
|
|
}
|
|
nextFiber = nextFiber.return;
|
|
}
|
|
}
|
|
fiber = nextFiber;
|
|
}
|
|
}
|
|
function prepareToReadContext(workInProgress2, renderLanes2) {
|
|
currentlyRenderingFiber = workInProgress2;
|
|
lastContextDependency = null;
|
|
lastFullyObservedContext = null;
|
|
var dependencies = workInProgress2.dependencies;
|
|
if (dependencies !== null) {
|
|
{
|
|
var firstContext = dependencies.firstContext;
|
|
if (firstContext !== null) {
|
|
if (includesSomeLane(dependencies.lanes, renderLanes2)) {
|
|
markWorkInProgressReceivedUpdate();
|
|
}
|
|
dependencies.firstContext = null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function readContext(context) {
|
|
{
|
|
if (isDisallowedContextReadInDEV) {
|
|
error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");
|
|
}
|
|
}
|
|
var value = context._currentValue;
|
|
if (lastFullyObservedContext === context)
|
|
;
|
|
else {
|
|
var contextItem = {
|
|
context,
|
|
memoizedValue: value,
|
|
next: null
|
|
};
|
|
if (lastContextDependency === null) {
|
|
if (currentlyRenderingFiber === null) {
|
|
throw new Error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");
|
|
}
|
|
lastContextDependency = contextItem;
|
|
currentlyRenderingFiber.dependencies = {
|
|
lanes: NoLanes,
|
|
firstContext: contextItem
|
|
};
|
|
} else {
|
|
lastContextDependency = lastContextDependency.next = contextItem;
|
|
}
|
|
}
|
|
return value;
|
|
}
|
|
var concurrentQueues = null;
|
|
function pushConcurrentUpdateQueue(queue) {
|
|
if (concurrentQueues === null) {
|
|
concurrentQueues = [queue];
|
|
} else {
|
|
concurrentQueues.push(queue);
|
|
}
|
|
}
|
|
function finishQueueingConcurrentUpdates() {
|
|
if (concurrentQueues !== null) {
|
|
for (var i = 0; i < concurrentQueues.length; i++) {
|
|
var queue = concurrentQueues[i];
|
|
var lastInterleavedUpdate = queue.interleaved;
|
|
if (lastInterleavedUpdate !== null) {
|
|
queue.interleaved = null;
|
|
var firstInterleavedUpdate = lastInterleavedUpdate.next;
|
|
var lastPendingUpdate = queue.pending;
|
|
if (lastPendingUpdate !== null) {
|
|
var firstPendingUpdate = lastPendingUpdate.next;
|
|
lastPendingUpdate.next = firstInterleavedUpdate;
|
|
lastInterleavedUpdate.next = firstPendingUpdate;
|
|
}
|
|
queue.pending = lastInterleavedUpdate;
|
|
}
|
|
}
|
|
concurrentQueues = null;
|
|
}
|
|
}
|
|
function enqueueConcurrentHookUpdate(fiber, queue, update, lane) {
|
|
var interleaved = queue.interleaved;
|
|
if (interleaved === null) {
|
|
update.next = update;
|
|
pushConcurrentUpdateQueue(queue);
|
|
} else {
|
|
update.next = interleaved.next;
|
|
interleaved.next = update;
|
|
}
|
|
queue.interleaved = update;
|
|
return markUpdateLaneFromFiberToRoot(fiber, lane);
|
|
}
|
|
function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update, lane) {
|
|
var interleaved = queue.interleaved;
|
|
if (interleaved === null) {
|
|
update.next = update;
|
|
pushConcurrentUpdateQueue(queue);
|
|
} else {
|
|
update.next = interleaved.next;
|
|
interleaved.next = update;
|
|
}
|
|
queue.interleaved = update;
|
|
}
|
|
function enqueueConcurrentClassUpdate(fiber, queue, update, lane) {
|
|
var interleaved = queue.interleaved;
|
|
if (interleaved === null) {
|
|
update.next = update;
|
|
pushConcurrentUpdateQueue(queue);
|
|
} else {
|
|
update.next = interleaved.next;
|
|
interleaved.next = update;
|
|
}
|
|
queue.interleaved = update;
|
|
return markUpdateLaneFromFiberToRoot(fiber, lane);
|
|
}
|
|
function enqueueConcurrentRenderForLane(fiber, lane) {
|
|
return markUpdateLaneFromFiberToRoot(fiber, lane);
|
|
}
|
|
var unsafe_markUpdateLaneFromFiberToRoot = markUpdateLaneFromFiberToRoot;
|
|
function markUpdateLaneFromFiberToRoot(sourceFiber, lane) {
|
|
sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane);
|
|
var alternate = sourceFiber.alternate;
|
|
if (alternate !== null) {
|
|
alternate.lanes = mergeLanes(alternate.lanes, lane);
|
|
}
|
|
{
|
|
if (alternate === null && (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags) {
|
|
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
|
|
}
|
|
}
|
|
var node = sourceFiber;
|
|
var parent = sourceFiber.return;
|
|
while (parent !== null) {
|
|
parent.childLanes = mergeLanes(parent.childLanes, lane);
|
|
alternate = parent.alternate;
|
|
if (alternate !== null) {
|
|
alternate.childLanes = mergeLanes(alternate.childLanes, lane);
|
|
} else {
|
|
{
|
|
if ((parent.flags & (Placement | Hydrating)) !== NoFlags) {
|
|
warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber);
|
|
}
|
|
}
|
|
}
|
|
node = parent;
|
|
parent = parent.return;
|
|
}
|
|
if (node.tag === HostRoot) {
|
|
var root2 = node.stateNode;
|
|
return root2;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
var UpdateState = 0;
|
|
var ReplaceState = 1;
|
|
var ForceUpdate = 2;
|
|
var CaptureUpdate = 3;
|
|
var hasForceUpdate = false;
|
|
var didWarnUpdateInsideUpdate;
|
|
var currentlyProcessingQueue;
|
|
{
|
|
didWarnUpdateInsideUpdate = false;
|
|
currentlyProcessingQueue = null;
|
|
}
|
|
function initializeUpdateQueue(fiber) {
|
|
var queue = {
|
|
baseState: fiber.memoizedState,
|
|
firstBaseUpdate: null,
|
|
lastBaseUpdate: null,
|
|
shared: {
|
|
pending: null,
|
|
interleaved: null,
|
|
lanes: NoLanes
|
|
},
|
|
effects: null
|
|
};
|
|
fiber.updateQueue = queue;
|
|
}
|
|
function cloneUpdateQueue(current3, workInProgress2) {
|
|
var queue = workInProgress2.updateQueue;
|
|
var currentQueue = current3.updateQueue;
|
|
if (queue === currentQueue) {
|
|
var clone = {
|
|
baseState: currentQueue.baseState,
|
|
firstBaseUpdate: currentQueue.firstBaseUpdate,
|
|
lastBaseUpdate: currentQueue.lastBaseUpdate,
|
|
shared: currentQueue.shared,
|
|
effects: currentQueue.effects
|
|
};
|
|
workInProgress2.updateQueue = clone;
|
|
}
|
|
}
|
|
function createUpdate(eventTime, lane) {
|
|
var update = {
|
|
eventTime,
|
|
lane,
|
|
tag: UpdateState,
|
|
payload: null,
|
|
callback: null,
|
|
next: null
|
|
};
|
|
return update;
|
|
}
|
|
function enqueueUpdate(fiber, update, lane) {
|
|
var updateQueue = fiber.updateQueue;
|
|
if (updateQueue === null) {
|
|
return null;
|
|
}
|
|
var sharedQueue = updateQueue.shared;
|
|
{
|
|
if (currentlyProcessingQueue === sharedQueue && !didWarnUpdateInsideUpdate) {
|
|
error("An update (setState, replaceState, or forceUpdate) was scheduled from inside an update function. Update functions should be pure, with zero side-effects. Consider using componentDidUpdate or a callback.");
|
|
didWarnUpdateInsideUpdate = true;
|
|
}
|
|
}
|
|
if (isUnsafeClassRenderPhaseUpdate()) {
|
|
var pending = sharedQueue.pending;
|
|
if (pending === null) {
|
|
update.next = update;
|
|
} else {
|
|
update.next = pending.next;
|
|
pending.next = update;
|
|
}
|
|
sharedQueue.pending = update;
|
|
return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane);
|
|
} else {
|
|
return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane);
|
|
}
|
|
}
|
|
function entangleTransitions(root2, fiber, lane) {
|
|
var updateQueue = fiber.updateQueue;
|
|
if (updateQueue === null) {
|
|
return;
|
|
}
|
|
var sharedQueue = updateQueue.shared;
|
|
if (isTransitionLane(lane)) {
|
|
var queueLanes = sharedQueue.lanes;
|
|
queueLanes = intersectLanes(queueLanes, root2.pendingLanes);
|
|
var newQueueLanes = mergeLanes(queueLanes, lane);
|
|
sharedQueue.lanes = newQueueLanes;
|
|
markRootEntangled(root2, newQueueLanes);
|
|
}
|
|
}
|
|
function enqueueCapturedUpdate(workInProgress2, capturedUpdate) {
|
|
var queue = workInProgress2.updateQueue;
|
|
var current3 = workInProgress2.alternate;
|
|
if (current3 !== null) {
|
|
var currentQueue = current3.updateQueue;
|
|
if (queue === currentQueue) {
|
|
var newFirst = null;
|
|
var newLast = null;
|
|
var firstBaseUpdate = queue.firstBaseUpdate;
|
|
if (firstBaseUpdate !== null) {
|
|
var update = firstBaseUpdate;
|
|
do {
|
|
var clone = {
|
|
eventTime: update.eventTime,
|
|
lane: update.lane,
|
|
tag: update.tag,
|
|
payload: update.payload,
|
|
callback: update.callback,
|
|
next: null
|
|
};
|
|
if (newLast === null) {
|
|
newFirst = newLast = clone;
|
|
} else {
|
|
newLast.next = clone;
|
|
newLast = clone;
|
|
}
|
|
update = update.next;
|
|
} while (update !== null);
|
|
if (newLast === null) {
|
|
newFirst = newLast = capturedUpdate;
|
|
} else {
|
|
newLast.next = capturedUpdate;
|
|
newLast = capturedUpdate;
|
|
}
|
|
} else {
|
|
newFirst = newLast = capturedUpdate;
|
|
}
|
|
queue = {
|
|
baseState: currentQueue.baseState,
|
|
firstBaseUpdate: newFirst,
|
|
lastBaseUpdate: newLast,
|
|
shared: currentQueue.shared,
|
|
effects: currentQueue.effects
|
|
};
|
|
workInProgress2.updateQueue = queue;
|
|
return;
|
|
}
|
|
}
|
|
var lastBaseUpdate = queue.lastBaseUpdate;
|
|
if (lastBaseUpdate === null) {
|
|
queue.firstBaseUpdate = capturedUpdate;
|
|
} else {
|
|
lastBaseUpdate.next = capturedUpdate;
|
|
}
|
|
queue.lastBaseUpdate = capturedUpdate;
|
|
}
|
|
function getStateFromUpdate(workInProgress2, queue, update, prevState, nextProps, instance) {
|
|
switch (update.tag) {
|
|
case ReplaceState: {
|
|
var payload = update.payload;
|
|
if (typeof payload === "function") {
|
|
{
|
|
enterDisallowedContextReadInDEV();
|
|
}
|
|
var nextState = payload.call(instance, prevState, nextProps);
|
|
{
|
|
if (workInProgress2.mode & StrictLegacyMode) {
|
|
setIsStrictModeForDevtools(true);
|
|
try {
|
|
payload.call(instance, prevState, nextProps);
|
|
} finally {
|
|
setIsStrictModeForDevtools(false);
|
|
}
|
|
}
|
|
exitDisallowedContextReadInDEV();
|
|
}
|
|
return nextState;
|
|
}
|
|
return payload;
|
|
}
|
|
case CaptureUpdate: {
|
|
workInProgress2.flags = workInProgress2.flags & ~ShouldCapture | DidCapture;
|
|
}
|
|
case UpdateState: {
|
|
var _payload = update.payload;
|
|
var partialState;
|
|
if (typeof _payload === "function") {
|
|
{
|
|
enterDisallowedContextReadInDEV();
|
|
}
|
|
partialState = _payload.call(instance, prevState, nextProps);
|
|
{
|
|
if (workInProgress2.mode & StrictLegacyMode) {
|
|
setIsStrictModeForDevtools(true);
|
|
try {
|
|
_payload.call(instance, prevState, nextProps);
|
|
} finally {
|
|
setIsStrictModeForDevtools(false);
|
|
}
|
|
}
|
|
exitDisallowedContextReadInDEV();
|
|
}
|
|
} else {
|
|
partialState = _payload;
|
|
}
|
|
if (partialState === null || partialState === void 0) {
|
|
return prevState;
|
|
}
|
|
return assign2({}, prevState, partialState);
|
|
}
|
|
case ForceUpdate: {
|
|
hasForceUpdate = true;
|
|
return prevState;
|
|
}
|
|
}
|
|
return prevState;
|
|
}
|
|
function processUpdateQueue(workInProgress2, props, instance, renderLanes2) {
|
|
var queue = workInProgress2.updateQueue;
|
|
hasForceUpdate = false;
|
|
{
|
|
currentlyProcessingQueue = queue.shared;
|
|
}
|
|
var firstBaseUpdate = queue.firstBaseUpdate;
|
|
var lastBaseUpdate = queue.lastBaseUpdate;
|
|
var pendingQueue = queue.shared.pending;
|
|
if (pendingQueue !== null) {
|
|
queue.shared.pending = null;
|
|
var lastPendingUpdate = pendingQueue;
|
|
var firstPendingUpdate = lastPendingUpdate.next;
|
|
lastPendingUpdate.next = null;
|
|
if (lastBaseUpdate === null) {
|
|
firstBaseUpdate = firstPendingUpdate;
|
|
} else {
|
|
lastBaseUpdate.next = firstPendingUpdate;
|
|
}
|
|
lastBaseUpdate = lastPendingUpdate;
|
|
var current3 = workInProgress2.alternate;
|
|
if (current3 !== null) {
|
|
var currentQueue = current3.updateQueue;
|
|
var currentLastBaseUpdate = currentQueue.lastBaseUpdate;
|
|
if (currentLastBaseUpdate !== lastBaseUpdate) {
|
|
if (currentLastBaseUpdate === null) {
|
|
currentQueue.firstBaseUpdate = firstPendingUpdate;
|
|
} else {
|
|
currentLastBaseUpdate.next = firstPendingUpdate;
|
|
}
|
|
currentQueue.lastBaseUpdate = lastPendingUpdate;
|
|
}
|
|
}
|
|
}
|
|
if (firstBaseUpdate !== null) {
|
|
var newState = queue.baseState;
|
|
var newLanes = NoLanes;
|
|
var newBaseState = null;
|
|
var newFirstBaseUpdate = null;
|
|
var newLastBaseUpdate = null;
|
|
var update = firstBaseUpdate;
|
|
do {
|
|
var updateLane = update.lane;
|
|
var updateEventTime = update.eventTime;
|
|
if (!isSubsetOfLanes(renderLanes2, updateLane)) {
|
|
var clone = {
|
|
eventTime: updateEventTime,
|
|
lane: updateLane,
|
|
tag: update.tag,
|
|
payload: update.payload,
|
|
callback: update.callback,
|
|
next: null
|
|
};
|
|
if (newLastBaseUpdate === null) {
|
|
newFirstBaseUpdate = newLastBaseUpdate = clone;
|
|
newBaseState = newState;
|
|
} else {
|
|
newLastBaseUpdate = newLastBaseUpdate.next = clone;
|
|
}
|
|
newLanes = mergeLanes(newLanes, updateLane);
|
|
} else {
|
|
if (newLastBaseUpdate !== null) {
|
|
var _clone = {
|
|
eventTime: updateEventTime,
|
|
lane: NoLane,
|
|
tag: update.tag,
|
|
payload: update.payload,
|
|
callback: update.callback,
|
|
next: null
|
|
};
|
|
newLastBaseUpdate = newLastBaseUpdate.next = _clone;
|
|
}
|
|
newState = getStateFromUpdate(workInProgress2, queue, update, newState, props, instance);
|
|
var callback = update.callback;
|
|
if (callback !== null && update.lane !== NoLane) {
|
|
workInProgress2.flags |= Callback;
|
|
var effects = queue.effects;
|
|
if (effects === null) {
|
|
queue.effects = [update];
|
|
} else {
|
|
effects.push(update);
|
|
}
|
|
}
|
|
}
|
|
update = update.next;
|
|
if (update === null) {
|
|
pendingQueue = queue.shared.pending;
|
|
if (pendingQueue === null) {
|
|
break;
|
|
} else {
|
|
var _lastPendingUpdate = pendingQueue;
|
|
var _firstPendingUpdate = _lastPendingUpdate.next;
|
|
_lastPendingUpdate.next = null;
|
|
update = _firstPendingUpdate;
|
|
queue.lastBaseUpdate = _lastPendingUpdate;
|
|
queue.shared.pending = null;
|
|
}
|
|
}
|
|
} while (true);
|
|
if (newLastBaseUpdate === null) {
|
|
newBaseState = newState;
|
|
}
|
|
queue.baseState = newBaseState;
|
|
queue.firstBaseUpdate = newFirstBaseUpdate;
|
|
queue.lastBaseUpdate = newLastBaseUpdate;
|
|
var lastInterleaved = queue.shared.interleaved;
|
|
if (lastInterleaved !== null) {
|
|
var interleaved = lastInterleaved;
|
|
do {
|
|
newLanes = mergeLanes(newLanes, interleaved.lane);
|
|
interleaved = interleaved.next;
|
|
} while (interleaved !== lastInterleaved);
|
|
} else if (firstBaseUpdate === null) {
|
|
queue.shared.lanes = NoLanes;
|
|
}
|
|
markSkippedUpdateLanes(newLanes);
|
|
workInProgress2.lanes = newLanes;
|
|
workInProgress2.memoizedState = newState;
|
|
}
|
|
{
|
|
currentlyProcessingQueue = null;
|
|
}
|
|
}
|
|
function callCallback(callback, context) {
|
|
if (typeof callback !== "function") {
|
|
throw new Error("Invalid argument passed as callback. Expected a function. Instead " + ("received: " + callback));
|
|
}
|
|
callback.call(context);
|
|
}
|
|
function resetHasForceUpdateBeforeProcessing() {
|
|
hasForceUpdate = false;
|
|
}
|
|
function checkHasForceUpdateAfterProcessing() {
|
|
return hasForceUpdate;
|
|
}
|
|
function commitUpdateQueue(finishedWork, finishedQueue, instance) {
|
|
var effects = finishedQueue.effects;
|
|
finishedQueue.effects = null;
|
|
if (effects !== null) {
|
|
for (var i = 0; i < effects.length; i++) {
|
|
var effect = effects[i];
|
|
var callback = effect.callback;
|
|
if (callback !== null) {
|
|
effect.callback = null;
|
|
callCallback(callback, instance);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var NO_CONTEXT = {};
|
|
var contextStackCursor$1 = createCursor(NO_CONTEXT);
|
|
var contextFiberStackCursor = createCursor(NO_CONTEXT);
|
|
var rootInstanceStackCursor = createCursor(NO_CONTEXT);
|
|
function requiredContext(c) {
|
|
if (c === NO_CONTEXT) {
|
|
throw new Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
return c;
|
|
}
|
|
function getRootHostContainer() {
|
|
var rootInstance = requiredContext(rootInstanceStackCursor.current);
|
|
return rootInstance;
|
|
}
|
|
function pushHostContainer(fiber, nextRootInstance) {
|
|
push(rootInstanceStackCursor, nextRootInstance, fiber);
|
|
push(contextFiberStackCursor, fiber, fiber);
|
|
push(contextStackCursor$1, NO_CONTEXT, fiber);
|
|
var nextRootContext = getRootHostContext(nextRootInstance);
|
|
pop(contextStackCursor$1, fiber);
|
|
push(contextStackCursor$1, nextRootContext, fiber);
|
|
}
|
|
function popHostContainer(fiber) {
|
|
pop(contextStackCursor$1, fiber);
|
|
pop(contextFiberStackCursor, fiber);
|
|
pop(rootInstanceStackCursor, fiber);
|
|
}
|
|
function getHostContext() {
|
|
var context = requiredContext(contextStackCursor$1.current);
|
|
return context;
|
|
}
|
|
function pushHostContext(fiber) {
|
|
var rootInstance = requiredContext(rootInstanceStackCursor.current);
|
|
var context = requiredContext(contextStackCursor$1.current);
|
|
var nextContext = getChildHostContext(context, fiber.type);
|
|
if (context === nextContext) {
|
|
return;
|
|
}
|
|
push(contextFiberStackCursor, fiber, fiber);
|
|
push(contextStackCursor$1, nextContext, fiber);
|
|
}
|
|
function popHostContext(fiber) {
|
|
if (contextFiberStackCursor.current !== fiber) {
|
|
return;
|
|
}
|
|
pop(contextStackCursor$1, fiber);
|
|
pop(contextFiberStackCursor, fiber);
|
|
}
|
|
var DefaultSuspenseContext = 0;
|
|
var SubtreeSuspenseContextMask = 1;
|
|
var InvisibleParentSuspenseContext = 1;
|
|
var ForceSuspenseFallback = 2;
|
|
var suspenseStackCursor = createCursor(DefaultSuspenseContext);
|
|
function hasSuspenseContext(parentContext, flag) {
|
|
return (parentContext & flag) !== 0;
|
|
}
|
|
function setDefaultShallowSuspenseContext(parentContext) {
|
|
return parentContext & SubtreeSuspenseContextMask;
|
|
}
|
|
function setShallowSuspenseContext(parentContext, shallowContext) {
|
|
return parentContext & SubtreeSuspenseContextMask | shallowContext;
|
|
}
|
|
function addSubtreeSuspenseContext(parentContext, subtreeContext) {
|
|
return parentContext | subtreeContext;
|
|
}
|
|
function pushSuspenseContext(fiber, newContext) {
|
|
push(suspenseStackCursor, newContext, fiber);
|
|
}
|
|
function popSuspenseContext(fiber) {
|
|
pop(suspenseStackCursor, fiber);
|
|
}
|
|
function shouldCaptureSuspense(workInProgress2, hasInvisibleParent) {
|
|
var nextState = workInProgress2.memoizedState;
|
|
if (nextState !== null) {
|
|
if (nextState.dehydrated !== null) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
var props = workInProgress2.memoizedProps;
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
function findFirstSuspended(row) {
|
|
var node = row;
|
|
while (node !== null) {
|
|
if (node.tag === SuspenseComponent) {
|
|
var state = node.memoizedState;
|
|
if (state !== null) {
|
|
var dehydrated = state.dehydrated;
|
|
if (dehydrated === null || isSuspenseInstancePending(dehydrated) || isSuspenseInstanceFallback(dehydrated)) {
|
|
return node;
|
|
}
|
|
}
|
|
} else if (node.tag === SuspenseListComponent && node.memoizedProps.revealOrder !== void 0) {
|
|
var didSuspend = (node.flags & DidCapture) !== NoFlags;
|
|
if (didSuspend) {
|
|
return node;
|
|
}
|
|
} else if (node.child !== null) {
|
|
node.child.return = node;
|
|
node = node.child;
|
|
continue;
|
|
}
|
|
if (node === row) {
|
|
return null;
|
|
}
|
|
while (node.sibling === null) {
|
|
if (node.return === null || node.return === row) {
|
|
return null;
|
|
}
|
|
node = node.return;
|
|
}
|
|
node.sibling.return = node.return;
|
|
node = node.sibling;
|
|
}
|
|
return null;
|
|
}
|
|
var NoFlags$1 = 0;
|
|
var HasEffect = 1;
|
|
var Insertion = 2;
|
|
var Layout = 4;
|
|
var Passive$1 = 8;
|
|
var workInProgressSources = [];
|
|
function resetWorkInProgressVersions() {
|
|
for (var i = 0; i < workInProgressSources.length; i++) {
|
|
var mutableSource = workInProgressSources[i];
|
|
{
|
|
mutableSource._workInProgressVersionPrimary = null;
|
|
}
|
|
}
|
|
workInProgressSources.length = 0;
|
|
}
|
|
function registerMutableSourceForHydration(root2, mutableSource) {
|
|
var getVersion = mutableSource._getVersion;
|
|
var version = getVersion(mutableSource._source);
|
|
if (root2.mutableSourceEagerHydrationData == null) {
|
|
root2.mutableSourceEagerHydrationData = [mutableSource, version];
|
|
} else {
|
|
root2.mutableSourceEagerHydrationData.push(mutableSource, version);
|
|
}
|
|
}
|
|
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig;
|
|
var didWarnAboutMismatchedHooksForComponent;
|
|
var didWarnUncachedGetSnapshot;
|
|
{
|
|
didWarnAboutMismatchedHooksForComponent = /* @__PURE__ */ new Set();
|
|
}
|
|
var renderLanes = NoLanes;
|
|
var currentlyRenderingFiber$1 = null;
|
|
var currentHook = null;
|
|
var workInProgressHook = null;
|
|
var didScheduleRenderPhaseUpdate = false;
|
|
var didScheduleRenderPhaseUpdateDuringThisPass = false;
|
|
var localIdCounter = 0;
|
|
var globalClientIdCounter = 0;
|
|
var RE_RENDER_LIMIT = 25;
|
|
var currentHookNameInDev = null;
|
|
var hookTypesDev = null;
|
|
var hookTypesUpdateIndexDev = -1;
|
|
var ignorePreviousDependencies = false;
|
|
function mountHookTypesDev() {
|
|
{
|
|
var hookName = currentHookNameInDev;
|
|
if (hookTypesDev === null) {
|
|
hookTypesDev = [hookName];
|
|
} else {
|
|
hookTypesDev.push(hookName);
|
|
}
|
|
}
|
|
}
|
|
function updateHookTypesDev() {
|
|
{
|
|
var hookName = currentHookNameInDev;
|
|
if (hookTypesDev !== null) {
|
|
hookTypesUpdateIndexDev++;
|
|
if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) {
|
|
warnOnHookMismatchInDev(hookName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function checkDepsAreArrayDev(deps) {
|
|
{
|
|
if (deps !== void 0 && deps !== null && !isArray2(deps)) {
|
|
error("%s received a final argument that is not an array (instead, received `%s`). When specified, the final argument must be an array.", currentHookNameInDev, typeof deps);
|
|
}
|
|
}
|
|
}
|
|
function warnOnHookMismatchInDev(currentHookName) {
|
|
{
|
|
var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1);
|
|
if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) {
|
|
didWarnAboutMismatchedHooksForComponent.add(componentName);
|
|
if (hookTypesDev !== null) {
|
|
var table = "";
|
|
var secondColumnStart = 30;
|
|
for (var i = 0; i <= hookTypesUpdateIndexDev; i++) {
|
|
var oldHookName = hookTypesDev[i];
|
|
var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName;
|
|
var row = i + 1 + ". " + oldHookName;
|
|
while (row.length < secondColumnStart) {
|
|
row += " ";
|
|
}
|
|
row += newHookName + "\n";
|
|
table += row;
|
|
}
|
|
error("React has detected a change in the order of Hooks called by %s. This will lead to bugs and errors if not fixed. For more information, read the Rules of Hooks: https://reactjs.org/link/rules-of-hooks\n\n Previous render Next render\n ------------------------------------------------------\n%s ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", componentName, table);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function throwInvalidHookError() {
|
|
throw new Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");
|
|
}
|
|
function areHookInputsEqual(nextDeps, prevDeps) {
|
|
{
|
|
if (ignorePreviousDependencies) {
|
|
return false;
|
|
}
|
|
}
|
|
if (prevDeps === null) {
|
|
{
|
|
error("%s received a final argument during this render, but not during the previous render. Even though the final argument is optional, its type cannot change between renders.", currentHookNameInDev);
|
|
}
|
|
return false;
|
|
}
|
|
{
|
|
if (nextDeps.length !== prevDeps.length) {
|
|
error("The final argument passed to %s changed size between renders. The order and size of this array must remain constant.\n\nPrevious: %s\nIncoming: %s", currentHookNameInDev, "[" + prevDeps.join(", ") + "]", "[" + nextDeps.join(", ") + "]");
|
|
}
|
|
}
|
|
for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
|
|
if (objectIs(nextDeps[i], prevDeps[i])) {
|
|
continue;
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
function renderWithHooks(current3, workInProgress2, Component, props, secondArg, nextRenderLanes) {
|
|
renderLanes = nextRenderLanes;
|
|
currentlyRenderingFiber$1 = workInProgress2;
|
|
{
|
|
hookTypesDev = current3 !== null ? current3._debugHookTypes : null;
|
|
hookTypesUpdateIndexDev = -1;
|
|
ignorePreviousDependencies = current3 !== null && current3.type !== workInProgress2.type;
|
|
}
|
|
workInProgress2.memoizedState = null;
|
|
workInProgress2.updateQueue = null;
|
|
workInProgress2.lanes = NoLanes;
|
|
{
|
|
if (current3 !== null && current3.memoizedState !== null) {
|
|
ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV;
|
|
} else if (hookTypesDev !== null) {
|
|
ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV;
|
|
} else {
|
|
ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV;
|
|
}
|
|
}
|
|
var children = Component(props, secondArg);
|
|
if (didScheduleRenderPhaseUpdateDuringThisPass) {
|
|
var numberOfReRenders = 0;
|
|
do {
|
|
didScheduleRenderPhaseUpdateDuringThisPass = false;
|
|
localIdCounter = 0;
|
|
if (numberOfReRenders >= RE_RENDER_LIMIT) {
|
|
throw new Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");
|
|
}
|
|
numberOfReRenders += 1;
|
|
{
|
|
ignorePreviousDependencies = false;
|
|
}
|
|
currentHook = null;
|
|
workInProgressHook = null;
|
|
workInProgress2.updateQueue = null;
|
|
{
|
|
hookTypesUpdateIndexDev = -1;
|
|
}
|
|
ReactCurrentDispatcher$1.current = HooksDispatcherOnRerenderInDEV;
|
|
children = Component(props, secondArg);
|
|
} while (didScheduleRenderPhaseUpdateDuringThisPass);
|
|
}
|
|
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
|
|
{
|
|
workInProgress2._debugHookTypes = hookTypesDev;
|
|
}
|
|
var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null;
|
|
renderLanes = NoLanes;
|
|
currentlyRenderingFiber$1 = null;
|
|
currentHook = null;
|
|
workInProgressHook = null;
|
|
{
|
|
currentHookNameInDev = null;
|
|
hookTypesDev = null;
|
|
hookTypesUpdateIndexDev = -1;
|
|
if (current3 !== null && (current3.flags & StaticMask) !== (workInProgress2.flags & StaticMask) && (current3.mode & ConcurrentMode) !== NoMode) {
|
|
error("Internal React error: Expected static flag was missing. Please notify the React team.");
|
|
}
|
|
}
|
|
didScheduleRenderPhaseUpdate = false;
|
|
if (didRenderTooFewHooks) {
|
|
throw new Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");
|
|
}
|
|
return children;
|
|
}
|
|
function checkDidRenderIdHook() {
|
|
var didRenderIdHook = localIdCounter !== 0;
|
|
localIdCounter = 0;
|
|
return didRenderIdHook;
|
|
}
|
|
function bailoutHooks(current3, workInProgress2, lanes) {
|
|
workInProgress2.updateQueue = current3.updateQueue;
|
|
if ((workInProgress2.mode & StrictEffectsMode) !== NoMode) {
|
|
workInProgress2.flags &= ~(MountPassiveDev | MountLayoutDev | Passive | Update);
|
|
} else {
|
|
workInProgress2.flags &= ~(Passive | Update);
|
|
}
|
|
current3.lanes = removeLanes(current3.lanes, lanes);
|
|
}
|
|
function resetHooksAfterThrow() {
|
|
ReactCurrentDispatcher$1.current = ContextOnlyDispatcher;
|
|
if (didScheduleRenderPhaseUpdate) {
|
|
var hook = currentlyRenderingFiber$1.memoizedState;
|
|
while (hook !== null) {
|
|
var queue = hook.queue;
|
|
if (queue !== null) {
|
|
queue.pending = null;
|
|
}
|
|
hook = hook.next;
|
|
}
|
|
didScheduleRenderPhaseUpdate = false;
|
|
}
|
|
renderLanes = NoLanes;
|
|
currentlyRenderingFiber$1 = null;
|
|
currentHook = null;
|
|
workInProgressHook = null;
|
|
{
|
|
hookTypesDev = null;
|
|
hookTypesUpdateIndexDev = -1;
|
|
currentHookNameInDev = null;
|
|
isUpdatingOpaqueValueInRenderPhase = false;
|
|
}
|
|
didScheduleRenderPhaseUpdateDuringThisPass = false;
|
|
localIdCounter = 0;
|
|
}
|
|
function mountWorkInProgressHook() {
|
|
var hook = {
|
|
memoizedState: null,
|
|
baseState: null,
|
|
baseQueue: null,
|
|
queue: null,
|
|
next: null
|
|
};
|
|
if (workInProgressHook === null) {
|
|
currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook;
|
|
} else {
|
|
workInProgressHook = workInProgressHook.next = hook;
|
|
}
|
|
return workInProgressHook;
|
|
}
|
|
function updateWorkInProgressHook() {
|
|
var nextCurrentHook;
|
|
if (currentHook === null) {
|
|
var current3 = currentlyRenderingFiber$1.alternate;
|
|
if (current3 !== null) {
|
|
nextCurrentHook = current3.memoizedState;
|
|
} else {
|
|
nextCurrentHook = null;
|
|
}
|
|
} else {
|
|
nextCurrentHook = currentHook.next;
|
|
}
|
|
var nextWorkInProgressHook;
|
|
if (workInProgressHook === null) {
|
|
nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState;
|
|
} else {
|
|
nextWorkInProgressHook = workInProgressHook.next;
|
|
}
|
|
if (nextWorkInProgressHook !== null) {
|
|
workInProgressHook = nextWorkInProgressHook;
|
|
nextWorkInProgressHook = workInProgressHook.next;
|
|
currentHook = nextCurrentHook;
|
|
} else {
|
|
if (nextCurrentHook === null) {
|
|
throw new Error("Rendered more hooks than during the previous render.");
|
|
}
|
|
currentHook = nextCurrentHook;
|
|
var newHook = {
|
|
memoizedState: currentHook.memoizedState,
|
|
baseState: currentHook.baseState,
|
|
baseQueue: currentHook.baseQueue,
|
|
queue: currentHook.queue,
|
|
next: null
|
|
};
|
|
if (workInProgressHook === null) {
|
|
currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook;
|
|
} else {
|
|
workInProgressHook = workInProgressHook.next = newHook;
|
|
}
|
|
}
|
|
return workInProgressHook;
|
|
}
|
|
function createFunctionComponentUpdateQueue() {
|
|
return {
|
|
lastEffect: null,
|
|
stores: null
|
|
};
|
|
}
|
|
function basicStateReducer(state, action) {
|
|
return typeof action === "function" ? action(state) : action;
|
|
}
|
|
function mountReducer(reducer, initialArg, init) {
|
|
var hook = mountWorkInProgressHook();
|
|
var initialState9;
|
|
if (init !== void 0) {
|
|
initialState9 = init(initialArg);
|
|
} else {
|
|
initialState9 = initialArg;
|
|
}
|
|
hook.memoizedState = hook.baseState = initialState9;
|
|
var queue = {
|
|
pending: null,
|
|
interleaved: null,
|
|
lanes: NoLanes,
|
|
dispatch: null,
|
|
lastRenderedReducer: reducer,
|
|
lastRenderedState: initialState9
|
|
};
|
|
hook.queue = queue;
|
|
var dispatch = queue.dispatch = dispatchReducerAction.bind(null, currentlyRenderingFiber$1, queue);
|
|
return [hook.memoizedState, dispatch];
|
|
}
|
|
function updateReducer(reducer, initialArg, init) {
|
|
var hook = updateWorkInProgressHook();
|
|
var queue = hook.queue;
|
|
if (queue === null) {
|
|
throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");
|
|
}
|
|
queue.lastRenderedReducer = reducer;
|
|
var current3 = currentHook;
|
|
var baseQueue = current3.baseQueue;
|
|
var pendingQueue = queue.pending;
|
|
if (pendingQueue !== null) {
|
|
if (baseQueue !== null) {
|
|
var baseFirst = baseQueue.next;
|
|
var pendingFirst = pendingQueue.next;
|
|
baseQueue.next = pendingFirst;
|
|
pendingQueue.next = baseFirst;
|
|
}
|
|
{
|
|
if (current3.baseQueue !== baseQueue) {
|
|
error("Internal error: Expected work-in-progress queue to be a clone. This is a bug in React.");
|
|
}
|
|
}
|
|
current3.baseQueue = baseQueue = pendingQueue;
|
|
queue.pending = null;
|
|
}
|
|
if (baseQueue !== null) {
|
|
var first = baseQueue.next;
|
|
var newState = current3.baseState;
|
|
var newBaseState = null;
|
|
var newBaseQueueFirst = null;
|
|
var newBaseQueueLast = null;
|
|
var update = first;
|
|
do {
|
|
var updateLane = update.lane;
|
|
if (!isSubsetOfLanes(renderLanes, updateLane)) {
|
|
var clone = {
|
|
lane: updateLane,
|
|
action: update.action,
|
|
hasEagerState: update.hasEagerState,
|
|
eagerState: update.eagerState,
|
|
next: null
|
|
};
|
|
if (newBaseQueueLast === null) {
|
|
newBaseQueueFirst = newBaseQueueLast = clone;
|
|
newBaseState = newState;
|
|
} else {
|
|
newBaseQueueLast = newBaseQueueLast.next = clone;
|
|
}
|
|
currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, updateLane);
|
|
markSkippedUpdateLanes(updateLane);
|
|
} else {
|
|
if (newBaseQueueLast !== null) {
|
|
var _clone = {
|
|
lane: NoLane,
|
|
action: update.action,
|
|
hasEagerState: update.hasEagerState,
|
|
eagerState: update.eagerState,
|
|
next: null
|
|
};
|
|
newBaseQueueLast = newBaseQueueLast.next = _clone;
|
|
}
|
|
if (update.hasEagerState) {
|
|
newState = update.eagerState;
|
|
} else {
|
|
var action = update.action;
|
|
newState = reducer(newState, action);
|
|
}
|
|
}
|
|
update = update.next;
|
|
} while (update !== null && update !== first);
|
|
if (newBaseQueueLast === null) {
|
|
newBaseState = newState;
|
|
} else {
|
|
newBaseQueueLast.next = newBaseQueueFirst;
|
|
}
|
|
if (!objectIs(newState, hook.memoizedState)) {
|
|
markWorkInProgressReceivedUpdate();
|
|
}
|
|
hook.memoizedState = newState;
|
|
hook.baseState = newBaseState;
|
|
hook.baseQueue = newBaseQueueLast;
|
|
queue.lastRenderedState = newState;
|
|
}
|
|
var lastInterleaved = queue.interleaved;
|
|
if (lastInterleaved !== null) {
|
|
var interleaved = lastInterleaved;
|
|
do {
|
|
var interleavedLane = interleaved.lane;
|
|
currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, interleavedLane);
|
|
markSkippedUpdateLanes(interleavedLane);
|
|
interleaved = interleaved.next;
|
|
} while (interleaved !== lastInterleaved);
|
|
} else if (baseQueue === null) {
|
|
queue.lanes = NoLanes;
|
|
}
|
|
var dispatch = queue.dispatch;
|
|
return [hook.memoizedState, dispatch];
|
|
}
|
|
function rerenderReducer(reducer, initialArg, init) {
|
|
var hook = updateWorkInProgressHook();
|
|
var queue = hook.queue;
|
|
if (queue === null) {
|
|
throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");
|
|
}
|
|
queue.lastRenderedReducer = reducer;
|
|
var dispatch = queue.dispatch;
|
|
var lastRenderPhaseUpdate = queue.pending;
|
|
var newState = hook.memoizedState;
|
|
if (lastRenderPhaseUpdate !== null) {
|
|
queue.pending = null;
|
|
var firstRenderPhaseUpdate = lastRenderPhaseUpdate.next;
|
|
var update = firstRenderPhaseUpdate;
|
|
do {
|
|
var action = update.action;
|
|
newState = reducer(newState, action);
|
|
update = update.next;
|
|
} while (update !== firstRenderPhaseUpdate);
|
|
if (!objectIs(newState, hook.memoizedState)) {
|
|
markWorkInProgressReceivedUpdate();
|
|
}
|
|
hook.memoizedState = newState;
|
|
if (hook.baseQueue === null) {
|
|
hook.baseState = newState;
|
|
}
|
|
queue.lastRenderedState = newState;
|
|
}
|
|
return [newState, dispatch];
|
|
}
|
|
function mountMutableSource(source, getSnapshot, subscribe) {
|
|
{
|
|
return void 0;
|
|
}
|
|
}
|
|
function updateMutableSource(source, getSnapshot, subscribe) {
|
|
{
|
|
return void 0;
|
|
}
|
|
}
|
|
function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
var fiber = currentlyRenderingFiber$1;
|
|
var hook = mountWorkInProgressHook();
|
|
var nextSnapshot;
|
|
var isHydrating2 = getIsHydrating();
|
|
if (isHydrating2) {
|
|
if (getServerSnapshot === void 0) {
|
|
throw new Error("Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.");
|
|
}
|
|
nextSnapshot = getServerSnapshot();
|
|
{
|
|
if (!didWarnUncachedGetSnapshot) {
|
|
if (nextSnapshot !== getServerSnapshot()) {
|
|
error("The result of getServerSnapshot should be cached to avoid an infinite loop");
|
|
didWarnUncachedGetSnapshot = true;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
nextSnapshot = getSnapshot();
|
|
{
|
|
if (!didWarnUncachedGetSnapshot) {
|
|
var cachedSnapshot = getSnapshot();
|
|
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
|
error("The result of getSnapshot should be cached to avoid an infinite loop");
|
|
didWarnUncachedGetSnapshot = true;
|
|
}
|
|
}
|
|
}
|
|
var root2 = getWorkInProgressRoot();
|
|
if (root2 === null) {
|
|
throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");
|
|
}
|
|
if (!includesBlockingLane(root2, renderLanes)) {
|
|
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
|
}
|
|
}
|
|
hook.memoizedState = nextSnapshot;
|
|
var inst = {
|
|
value: nextSnapshot,
|
|
getSnapshot
|
|
};
|
|
hook.queue = inst;
|
|
mountEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [subscribe]);
|
|
fiber.flags |= Passive;
|
|
pushEffect(HasEffect | Passive$1, updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), void 0, null);
|
|
return nextSnapshot;
|
|
}
|
|
function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
var fiber = currentlyRenderingFiber$1;
|
|
var hook = updateWorkInProgressHook();
|
|
var nextSnapshot = getSnapshot();
|
|
{
|
|
if (!didWarnUncachedGetSnapshot) {
|
|
var cachedSnapshot = getSnapshot();
|
|
if (!objectIs(nextSnapshot, cachedSnapshot)) {
|
|
error("The result of getSnapshot should be cached to avoid an infinite loop");
|
|
didWarnUncachedGetSnapshot = true;
|
|
}
|
|
}
|
|
}
|
|
var prevSnapshot = hook.memoizedState;
|
|
var snapshotChanged = !objectIs(prevSnapshot, nextSnapshot);
|
|
if (snapshotChanged) {
|
|
hook.memoizedState = nextSnapshot;
|
|
markWorkInProgressReceivedUpdate();
|
|
}
|
|
var inst = hook.queue;
|
|
updateEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [subscribe]);
|
|
if (inst.getSnapshot !== getSnapshot || snapshotChanged || workInProgressHook !== null && workInProgressHook.memoizedState.tag & HasEffect) {
|
|
fiber.flags |= Passive;
|
|
pushEffect(HasEffect | Passive$1, updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), void 0, null);
|
|
var root2 = getWorkInProgressRoot();
|
|
if (root2 === null) {
|
|
throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");
|
|
}
|
|
if (!includesBlockingLane(root2, renderLanes)) {
|
|
pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot);
|
|
}
|
|
}
|
|
return nextSnapshot;
|
|
}
|
|
function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {
|
|
fiber.flags |= StoreConsistency;
|
|
var check = {
|
|
getSnapshot,
|
|
value: renderedSnapshot
|
|
};
|
|
var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue;
|
|
if (componentUpdateQueue === null) {
|
|
componentUpdateQueue = createFunctionComponentUpdateQueue();
|
|
currentlyRenderingFiber$1.updateQueue = componentUpdateQueue;
|
|
componentUpdateQueue.stores = [check];
|
|
} else {
|
|
var stores = componentUpdateQueue.stores;
|
|
if (stores === null) {
|
|
componentUpdateQueue.stores = [check];
|
|
} else {
|
|
stores.push(check);
|
|
}
|
|
}
|
|
}
|
|
function updateStoreInstance(fiber, inst, nextSnapshot, getSnapshot) {
|
|
inst.value = nextSnapshot;
|
|
inst.getSnapshot = getSnapshot;
|
|
if (checkIfSnapshotChanged(inst)) {
|
|
forceStoreRerender(fiber);
|
|
}
|
|
}
|
|
function subscribeToStore(fiber, inst, subscribe) {
|
|
var handleStoreChange = function() {
|
|
if (checkIfSnapshotChanged(inst)) {
|
|
forceStoreRerender(fiber);
|
|
}
|
|
};
|
|
return subscribe(handleStoreChange);
|
|
}
|
|
function checkIfSnapshotChanged(inst) {
|
|
var latestGetSnapshot = inst.getSnapshot;
|
|
var prevValue = inst.value;
|
|
try {
|
|
var nextValue = latestGetSnapshot();
|
|
return !objectIs(prevValue, nextValue);
|
|
} catch (error2) {
|
|
return true;
|
|
}
|
|
}
|
|
function forceStoreRerender(fiber) {
|
|
var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
|
|
if (root2 !== null) {
|
|
scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
|
|
}
|
|
}
|
|
function mountState(initialState9) {
|
|
var hook = mountWorkInProgressHook();
|
|
if (typeof initialState9 === "function") {
|
|
initialState9 = initialState9();
|
|
}
|
|
hook.memoizedState = hook.baseState = initialState9;
|
|
var queue = {
|
|
pending: null,
|
|
interleaved: null,
|
|
lanes: NoLanes,
|
|
dispatch: null,
|
|
lastRenderedReducer: basicStateReducer,
|
|
lastRenderedState: initialState9
|
|
};
|
|
hook.queue = queue;
|
|
var dispatch = queue.dispatch = dispatchSetState.bind(null, currentlyRenderingFiber$1, queue);
|
|
return [hook.memoizedState, dispatch];
|
|
}
|
|
function updateState(initialState9) {
|
|
return updateReducer(basicStateReducer);
|
|
}
|
|
function rerenderState(initialState9) {
|
|
return rerenderReducer(basicStateReducer);
|
|
}
|
|
function pushEffect(tag, create, destroy, deps) {
|
|
var effect = {
|
|
tag,
|
|
create,
|
|
destroy,
|
|
deps,
|
|
next: null
|
|
};
|
|
var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue;
|
|
if (componentUpdateQueue === null) {
|
|
componentUpdateQueue = createFunctionComponentUpdateQueue();
|
|
currentlyRenderingFiber$1.updateQueue = componentUpdateQueue;
|
|
componentUpdateQueue.lastEffect = effect.next = effect;
|
|
} else {
|
|
var lastEffect = componentUpdateQueue.lastEffect;
|
|
if (lastEffect === null) {
|
|
componentUpdateQueue.lastEffect = effect.next = effect;
|
|
} else {
|
|
var firstEffect = lastEffect.next;
|
|
lastEffect.next = effect;
|
|
effect.next = firstEffect;
|
|
componentUpdateQueue.lastEffect = effect;
|
|
}
|
|
}
|
|
return effect;
|
|
}
|
|
function mountRef(initialValue) {
|
|
var hook = mountWorkInProgressHook();
|
|
{
|
|
var _ref2 = {
|
|
current: initialValue
|
|
};
|
|
hook.memoizedState = _ref2;
|
|
return _ref2;
|
|
}
|
|
}
|
|
function updateRef(initialValue) {
|
|
var hook = updateWorkInProgressHook();
|
|
return hook.memoizedState;
|
|
}
|
|
function mountEffectImpl(fiberFlags, hookFlags, create, deps) {
|
|
var hook = mountWorkInProgressHook();
|
|
var nextDeps = deps === void 0 ? null : deps;
|
|
currentlyRenderingFiber$1.flags |= fiberFlags;
|
|
hook.memoizedState = pushEffect(HasEffect | hookFlags, create, void 0, nextDeps);
|
|
}
|
|
function updateEffectImpl(fiberFlags, hookFlags, create, deps) {
|
|
var hook = updateWorkInProgressHook();
|
|
var nextDeps = deps === void 0 ? null : deps;
|
|
var destroy = void 0;
|
|
if (currentHook !== null) {
|
|
var prevEffect = currentHook.memoizedState;
|
|
destroy = prevEffect.destroy;
|
|
if (nextDeps !== null) {
|
|
var prevDeps = prevEffect.deps;
|
|
if (areHookInputsEqual(nextDeps, prevDeps)) {
|
|
hook.memoizedState = pushEffect(hookFlags, create, destroy, nextDeps);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
currentlyRenderingFiber$1.flags |= fiberFlags;
|
|
hook.memoizedState = pushEffect(HasEffect | hookFlags, create, destroy, nextDeps);
|
|
}
|
|
function mountEffect(create, deps) {
|
|
if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) {
|
|
return mountEffectImpl(MountPassiveDev | Passive | PassiveStatic, Passive$1, create, deps);
|
|
} else {
|
|
return mountEffectImpl(Passive | PassiveStatic, Passive$1, create, deps);
|
|
}
|
|
}
|
|
function updateEffect(create, deps) {
|
|
return updateEffectImpl(Passive, Passive$1, create, deps);
|
|
}
|
|
function mountInsertionEffect(create, deps) {
|
|
return mountEffectImpl(Update, Insertion, create, deps);
|
|
}
|
|
function updateInsertionEffect(create, deps) {
|
|
return updateEffectImpl(Update, Insertion, create, deps);
|
|
}
|
|
function mountLayoutEffect(create, deps) {
|
|
var fiberFlags = Update;
|
|
{
|
|
fiberFlags |= LayoutStatic;
|
|
}
|
|
if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) {
|
|
fiberFlags |= MountLayoutDev;
|
|
}
|
|
return mountEffectImpl(fiberFlags, Layout, create, deps);
|
|
}
|
|
function updateLayoutEffect(create, deps) {
|
|
return updateEffectImpl(Update, Layout, create, deps);
|
|
}
|
|
function imperativeHandleEffect(create, ref) {
|
|
if (typeof ref === "function") {
|
|
var refCallback = ref;
|
|
var _inst = create();
|
|
refCallback(_inst);
|
|
return function() {
|
|
refCallback(null);
|
|
};
|
|
} else if (ref !== null && ref !== void 0) {
|
|
var refObject = ref;
|
|
{
|
|
if (!refObject.hasOwnProperty("current")) {
|
|
error("Expected useImperativeHandle() first argument to either be a ref callback or React.createRef() object. Instead received: %s.", "an object with keys {" + Object.keys(refObject).join(", ") + "}");
|
|
}
|
|
}
|
|
var _inst2 = create();
|
|
refObject.current = _inst2;
|
|
return function() {
|
|
refObject.current = null;
|
|
};
|
|
}
|
|
}
|
|
function mountImperativeHandle(ref, create, deps) {
|
|
{
|
|
if (typeof create !== "function") {
|
|
error("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.", create !== null ? typeof create : "null");
|
|
}
|
|
}
|
|
var effectDeps = deps !== null && deps !== void 0 ? deps.concat([ref]) : null;
|
|
var fiberFlags = Update;
|
|
{
|
|
fiberFlags |= LayoutStatic;
|
|
}
|
|
if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) {
|
|
fiberFlags |= MountLayoutDev;
|
|
}
|
|
return mountEffectImpl(fiberFlags, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
|
|
}
|
|
function updateImperativeHandle(ref, create, deps) {
|
|
{
|
|
if (typeof create !== "function") {
|
|
error("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.", create !== null ? typeof create : "null");
|
|
}
|
|
}
|
|
var effectDeps = deps !== null && deps !== void 0 ? deps.concat([ref]) : null;
|
|
return updateEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps);
|
|
}
|
|
function mountDebugValue(value, formatterFn) {
|
|
}
|
|
var updateDebugValue = mountDebugValue;
|
|
function mountCallback(callback, deps) {
|
|
var hook = mountWorkInProgressHook();
|
|
var nextDeps = deps === void 0 ? null : deps;
|
|
hook.memoizedState = [callback, nextDeps];
|
|
return callback;
|
|
}
|
|
function updateCallback(callback, deps) {
|
|
var hook = updateWorkInProgressHook();
|
|
var nextDeps = deps === void 0 ? null : deps;
|
|
var prevState = hook.memoizedState;
|
|
if (prevState !== null) {
|
|
if (nextDeps !== null) {
|
|
var prevDeps = prevState[1];
|
|
if (areHookInputsEqual(nextDeps, prevDeps)) {
|
|
return prevState[0];
|
|
}
|
|
}
|
|
}
|
|
hook.memoizedState = [callback, nextDeps];
|
|
return callback;
|
|
}
|
|
function mountMemo(nextCreate, deps) {
|
|
var hook = mountWorkInProgressHook();
|
|
var nextDeps = deps === void 0 ? null : deps;
|
|
var nextValue = nextCreate();
|
|
hook.memoizedState = [nextValue, nextDeps];
|
|
return nextValue;
|
|
}
|
|
function updateMemo(nextCreate, deps) {
|
|
var hook = updateWorkInProgressHook();
|
|
var nextDeps = deps === void 0 ? null : deps;
|
|
var prevState = hook.memoizedState;
|
|
if (prevState !== null) {
|
|
if (nextDeps !== null) {
|
|
var prevDeps = prevState[1];
|
|
if (areHookInputsEqual(nextDeps, prevDeps)) {
|
|
return prevState[0];
|
|
}
|
|
}
|
|
}
|
|
var nextValue = nextCreate();
|
|
hook.memoizedState = [nextValue, nextDeps];
|
|
return nextValue;
|
|
}
|
|
function mountDeferredValue(value) {
|
|
var hook = mountWorkInProgressHook();
|
|
hook.memoizedState = value;
|
|
return value;
|
|
}
|
|
function updateDeferredValue(value) {
|
|
var hook = updateWorkInProgressHook();
|
|
var resolvedCurrentHook = currentHook;
|
|
var prevValue = resolvedCurrentHook.memoizedState;
|
|
return updateDeferredValueImpl(hook, prevValue, value);
|
|
}
|
|
function rerenderDeferredValue(value) {
|
|
var hook = updateWorkInProgressHook();
|
|
if (currentHook === null) {
|
|
hook.memoizedState = value;
|
|
return value;
|
|
} else {
|
|
var prevValue = currentHook.memoizedState;
|
|
return updateDeferredValueImpl(hook, prevValue, value);
|
|
}
|
|
}
|
|
function updateDeferredValueImpl(hook, prevValue, value) {
|
|
var shouldDeferValue = !includesOnlyNonUrgentLanes(renderLanes);
|
|
if (shouldDeferValue) {
|
|
if (!objectIs(value, prevValue)) {
|
|
var deferredLane = claimNextTransitionLane();
|
|
currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, deferredLane);
|
|
markSkippedUpdateLanes(deferredLane);
|
|
hook.baseState = true;
|
|
}
|
|
return prevValue;
|
|
} else {
|
|
if (hook.baseState) {
|
|
hook.baseState = false;
|
|
markWorkInProgressReceivedUpdate();
|
|
}
|
|
hook.memoizedState = value;
|
|
return value;
|
|
}
|
|
}
|
|
function startTransition(setPending, callback, options2) {
|
|
var previousPriority = getCurrentUpdatePriority();
|
|
setCurrentUpdatePriority(higherEventPriority(previousPriority, ContinuousEventPriority));
|
|
setPending(true);
|
|
var prevTransition = ReactCurrentBatchConfig$2.transition;
|
|
ReactCurrentBatchConfig$2.transition = {};
|
|
var currentTransition = ReactCurrentBatchConfig$2.transition;
|
|
{
|
|
ReactCurrentBatchConfig$2.transition._updatedFibers = /* @__PURE__ */ new Set();
|
|
}
|
|
try {
|
|
setPending(false);
|
|
callback();
|
|
} finally {
|
|
setCurrentUpdatePriority(previousPriority);
|
|
ReactCurrentBatchConfig$2.transition = prevTransition;
|
|
{
|
|
if (prevTransition === null && currentTransition._updatedFibers) {
|
|
var updatedFibersCount = currentTransition._updatedFibers.size;
|
|
if (updatedFibersCount > 10) {
|
|
warn("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table.");
|
|
}
|
|
currentTransition._updatedFibers.clear();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function mountTransition() {
|
|
var _mountState = mountState(false), isPending = _mountState[0], setPending = _mountState[1];
|
|
var start = startTransition.bind(null, setPending);
|
|
var hook = mountWorkInProgressHook();
|
|
hook.memoizedState = start;
|
|
return [isPending, start];
|
|
}
|
|
function updateTransition() {
|
|
var _updateState = updateState(), isPending = _updateState[0];
|
|
var hook = updateWorkInProgressHook();
|
|
var start = hook.memoizedState;
|
|
return [isPending, start];
|
|
}
|
|
function rerenderTransition() {
|
|
var _rerenderState = rerenderState(), isPending = _rerenderState[0];
|
|
var hook = updateWorkInProgressHook();
|
|
var start = hook.memoizedState;
|
|
return [isPending, start];
|
|
}
|
|
var isUpdatingOpaqueValueInRenderPhase = false;
|
|
function getIsUpdatingOpaqueValueInRenderPhaseInDEV() {
|
|
{
|
|
return isUpdatingOpaqueValueInRenderPhase;
|
|
}
|
|
}
|
|
function mountId() {
|
|
var hook = mountWorkInProgressHook();
|
|
var root2 = getWorkInProgressRoot();
|
|
var identifierPrefix = root2.identifierPrefix;
|
|
var id;
|
|
if (getIsHydrating()) {
|
|
var treeId = getTreeId();
|
|
id = ":" + identifierPrefix + "R" + treeId;
|
|
var localId = localIdCounter++;
|
|
if (localId > 0) {
|
|
id += "H" + localId.toString(32);
|
|
}
|
|
id += ":";
|
|
} else {
|
|
var globalClientId = globalClientIdCounter++;
|
|
id = ":" + identifierPrefix + "r" + globalClientId.toString(32) + ":";
|
|
}
|
|
hook.memoizedState = id;
|
|
return id;
|
|
}
|
|
function updateId() {
|
|
var hook = updateWorkInProgressHook();
|
|
var id = hook.memoizedState;
|
|
return id;
|
|
}
|
|
function dispatchReducerAction(fiber, queue, action) {
|
|
{
|
|
if (typeof arguments[3] === "function") {
|
|
error("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");
|
|
}
|
|
}
|
|
var lane = requestUpdateLane(fiber);
|
|
var update = {
|
|
lane,
|
|
action,
|
|
hasEagerState: false,
|
|
eagerState: null,
|
|
next: null
|
|
};
|
|
if (isRenderPhaseUpdate(fiber)) {
|
|
enqueueRenderPhaseUpdate(queue, update);
|
|
} else {
|
|
var root2 = enqueueConcurrentHookUpdate(fiber, queue, update, lane);
|
|
if (root2 !== null) {
|
|
var eventTime = requestEventTime();
|
|
scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
|
|
entangleTransitionUpdate(root2, queue, lane);
|
|
}
|
|
}
|
|
markUpdateInDevTools(fiber, lane);
|
|
}
|
|
function dispatchSetState(fiber, queue, action) {
|
|
{
|
|
if (typeof arguments[3] === "function") {
|
|
error("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");
|
|
}
|
|
}
|
|
var lane = requestUpdateLane(fiber);
|
|
var update = {
|
|
lane,
|
|
action,
|
|
hasEagerState: false,
|
|
eagerState: null,
|
|
next: null
|
|
};
|
|
if (isRenderPhaseUpdate(fiber)) {
|
|
enqueueRenderPhaseUpdate(queue, update);
|
|
} else {
|
|
var alternate = fiber.alternate;
|
|
if (fiber.lanes === NoLanes && (alternate === null || alternate.lanes === NoLanes)) {
|
|
var lastRenderedReducer = queue.lastRenderedReducer;
|
|
if (lastRenderedReducer !== null) {
|
|
var prevDispatcher;
|
|
{
|
|
prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
}
|
|
try {
|
|
var currentState = queue.lastRenderedState;
|
|
var eagerState = lastRenderedReducer(currentState, action);
|
|
update.hasEagerState = true;
|
|
update.eagerState = eagerState;
|
|
if (objectIs(eagerState, currentState)) {
|
|
enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update, lane);
|
|
return;
|
|
}
|
|
} catch (error2) {
|
|
} finally {
|
|
{
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var root2 = enqueueConcurrentHookUpdate(fiber, queue, update, lane);
|
|
if (root2 !== null) {
|
|
var eventTime = requestEventTime();
|
|
scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
|
|
entangleTransitionUpdate(root2, queue, lane);
|
|
}
|
|
}
|
|
markUpdateInDevTools(fiber, lane);
|
|
}
|
|
function isRenderPhaseUpdate(fiber) {
|
|
var alternate = fiber.alternate;
|
|
return fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1;
|
|
}
|
|
function enqueueRenderPhaseUpdate(queue, update) {
|
|
didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true;
|
|
var pending = queue.pending;
|
|
if (pending === null) {
|
|
update.next = update;
|
|
} else {
|
|
update.next = pending.next;
|
|
pending.next = update;
|
|
}
|
|
queue.pending = update;
|
|
}
|
|
function entangleTransitionUpdate(root2, queue, lane) {
|
|
if (isTransitionLane(lane)) {
|
|
var queueLanes = queue.lanes;
|
|
queueLanes = intersectLanes(queueLanes, root2.pendingLanes);
|
|
var newQueueLanes = mergeLanes(queueLanes, lane);
|
|
queue.lanes = newQueueLanes;
|
|
markRootEntangled(root2, newQueueLanes);
|
|
}
|
|
}
|
|
function markUpdateInDevTools(fiber, lane, action) {
|
|
{
|
|
markStateUpdateScheduled(fiber, lane);
|
|
}
|
|
}
|
|
var ContextOnlyDispatcher = {
|
|
readContext,
|
|
useCallback: throwInvalidHookError,
|
|
useContext: throwInvalidHookError,
|
|
useEffect: throwInvalidHookError,
|
|
useImperativeHandle: throwInvalidHookError,
|
|
useInsertionEffect: throwInvalidHookError,
|
|
useLayoutEffect: throwInvalidHookError,
|
|
useMemo: throwInvalidHookError,
|
|
useReducer: throwInvalidHookError,
|
|
useRef: throwInvalidHookError,
|
|
useState: throwInvalidHookError,
|
|
useDebugValue: throwInvalidHookError,
|
|
useDeferredValue: throwInvalidHookError,
|
|
useTransition: throwInvalidHookError,
|
|
useMutableSource: throwInvalidHookError,
|
|
useSyncExternalStore: throwInvalidHookError,
|
|
useId: throwInvalidHookError,
|
|
unstable_isNewReconciler: enableNewReconciler
|
|
};
|
|
var HooksDispatcherOnMountInDEV = null;
|
|
var HooksDispatcherOnMountWithHookTypesInDEV = null;
|
|
var HooksDispatcherOnUpdateInDEV = null;
|
|
var HooksDispatcherOnRerenderInDEV = null;
|
|
var InvalidNestedHooksDispatcherOnMountInDEV = null;
|
|
var InvalidNestedHooksDispatcherOnUpdateInDEV = null;
|
|
var InvalidNestedHooksDispatcherOnRerenderInDEV = null;
|
|
{
|
|
var warnInvalidContextAccess = function() {
|
|
error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().");
|
|
};
|
|
var warnInvalidHookAccess = function() {
|
|
error("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://reactjs.org/link/rules-of-hooks");
|
|
};
|
|
HooksDispatcherOnMountInDEV = {
|
|
readContext: function(context) {
|
|
return readContext(context);
|
|
},
|
|
useCallback: function(callback, deps) {
|
|
currentHookNameInDev = "useCallback";
|
|
mountHookTypesDev();
|
|
checkDepsAreArrayDev(deps);
|
|
return mountCallback(callback, deps);
|
|
},
|
|
useContext: function(context) {
|
|
currentHookNameInDev = "useContext";
|
|
mountHookTypesDev();
|
|
return readContext(context);
|
|
},
|
|
useEffect: function(create, deps) {
|
|
currentHookNameInDev = "useEffect";
|
|
mountHookTypesDev();
|
|
checkDepsAreArrayDev(deps);
|
|
return mountEffect(create, deps);
|
|
},
|
|
useImperativeHandle: function(ref, create, deps) {
|
|
currentHookNameInDev = "useImperativeHandle";
|
|
mountHookTypesDev();
|
|
checkDepsAreArrayDev(deps);
|
|
return mountImperativeHandle(ref, create, deps);
|
|
},
|
|
useInsertionEffect: function(create, deps) {
|
|
currentHookNameInDev = "useInsertionEffect";
|
|
mountHookTypesDev();
|
|
checkDepsAreArrayDev(deps);
|
|
return mountInsertionEffect(create, deps);
|
|
},
|
|
useLayoutEffect: function(create, deps) {
|
|
currentHookNameInDev = "useLayoutEffect";
|
|
mountHookTypesDev();
|
|
checkDepsAreArrayDev(deps);
|
|
return mountLayoutEffect(create, deps);
|
|
},
|
|
useMemo: function(create, deps) {
|
|
currentHookNameInDev = "useMemo";
|
|
mountHookTypesDev();
|
|
checkDepsAreArrayDev(deps);
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
try {
|
|
return mountMemo(create, deps);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useReducer: function(reducer, initialArg, init) {
|
|
currentHookNameInDev = "useReducer";
|
|
mountHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
try {
|
|
return mountReducer(reducer, initialArg, init);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useRef: function(initialValue) {
|
|
currentHookNameInDev = "useRef";
|
|
mountHookTypesDev();
|
|
return mountRef(initialValue);
|
|
},
|
|
useState: function(initialState9) {
|
|
currentHookNameInDev = "useState";
|
|
mountHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
try {
|
|
return mountState(initialState9);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useDebugValue: function(value, formatterFn) {
|
|
currentHookNameInDev = "useDebugValue";
|
|
mountHookTypesDev();
|
|
return mountDebugValue();
|
|
},
|
|
useDeferredValue: function(value) {
|
|
currentHookNameInDev = "useDeferredValue";
|
|
mountHookTypesDev();
|
|
return mountDeferredValue(value);
|
|
},
|
|
useTransition: function() {
|
|
currentHookNameInDev = "useTransition";
|
|
mountHookTypesDev();
|
|
return mountTransition();
|
|
},
|
|
useMutableSource: function(source, getSnapshot, subscribe) {
|
|
currentHookNameInDev = "useMutableSource";
|
|
mountHookTypesDev();
|
|
return mountMutableSource();
|
|
},
|
|
useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) {
|
|
currentHookNameInDev = "useSyncExternalStore";
|
|
mountHookTypesDev();
|
|
return mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
},
|
|
useId: function() {
|
|
currentHookNameInDev = "useId";
|
|
mountHookTypesDev();
|
|
return mountId();
|
|
},
|
|
unstable_isNewReconciler: enableNewReconciler
|
|
};
|
|
HooksDispatcherOnMountWithHookTypesInDEV = {
|
|
readContext: function(context) {
|
|
return readContext(context);
|
|
},
|
|
useCallback: function(callback, deps) {
|
|
currentHookNameInDev = "useCallback";
|
|
updateHookTypesDev();
|
|
return mountCallback(callback, deps);
|
|
},
|
|
useContext: function(context) {
|
|
currentHookNameInDev = "useContext";
|
|
updateHookTypesDev();
|
|
return readContext(context);
|
|
},
|
|
useEffect: function(create, deps) {
|
|
currentHookNameInDev = "useEffect";
|
|
updateHookTypesDev();
|
|
return mountEffect(create, deps);
|
|
},
|
|
useImperativeHandle: function(ref, create, deps) {
|
|
currentHookNameInDev = "useImperativeHandle";
|
|
updateHookTypesDev();
|
|
return mountImperativeHandle(ref, create, deps);
|
|
},
|
|
useInsertionEffect: function(create, deps) {
|
|
currentHookNameInDev = "useInsertionEffect";
|
|
updateHookTypesDev();
|
|
return mountInsertionEffect(create, deps);
|
|
},
|
|
useLayoutEffect: function(create, deps) {
|
|
currentHookNameInDev = "useLayoutEffect";
|
|
updateHookTypesDev();
|
|
return mountLayoutEffect(create, deps);
|
|
},
|
|
useMemo: function(create, deps) {
|
|
currentHookNameInDev = "useMemo";
|
|
updateHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
try {
|
|
return mountMemo(create, deps);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useReducer: function(reducer, initialArg, init) {
|
|
currentHookNameInDev = "useReducer";
|
|
updateHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
try {
|
|
return mountReducer(reducer, initialArg, init);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useRef: function(initialValue) {
|
|
currentHookNameInDev = "useRef";
|
|
updateHookTypesDev();
|
|
return mountRef(initialValue);
|
|
},
|
|
useState: function(initialState9) {
|
|
currentHookNameInDev = "useState";
|
|
updateHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
try {
|
|
return mountState(initialState9);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useDebugValue: function(value, formatterFn) {
|
|
currentHookNameInDev = "useDebugValue";
|
|
updateHookTypesDev();
|
|
return mountDebugValue();
|
|
},
|
|
useDeferredValue: function(value) {
|
|
currentHookNameInDev = "useDeferredValue";
|
|
updateHookTypesDev();
|
|
return mountDeferredValue(value);
|
|
},
|
|
useTransition: function() {
|
|
currentHookNameInDev = "useTransition";
|
|
updateHookTypesDev();
|
|
return mountTransition();
|
|
},
|
|
useMutableSource: function(source, getSnapshot, subscribe) {
|
|
currentHookNameInDev = "useMutableSource";
|
|
updateHookTypesDev();
|
|
return mountMutableSource();
|
|
},
|
|
useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) {
|
|
currentHookNameInDev = "useSyncExternalStore";
|
|
updateHookTypesDev();
|
|
return mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
},
|
|
useId: function() {
|
|
currentHookNameInDev = "useId";
|
|
updateHookTypesDev();
|
|
return mountId();
|
|
},
|
|
unstable_isNewReconciler: enableNewReconciler
|
|
};
|
|
HooksDispatcherOnUpdateInDEV = {
|
|
readContext: function(context) {
|
|
return readContext(context);
|
|
},
|
|
useCallback: function(callback, deps) {
|
|
currentHookNameInDev = "useCallback";
|
|
updateHookTypesDev();
|
|
return updateCallback(callback, deps);
|
|
},
|
|
useContext: function(context) {
|
|
currentHookNameInDev = "useContext";
|
|
updateHookTypesDev();
|
|
return readContext(context);
|
|
},
|
|
useEffect: function(create, deps) {
|
|
currentHookNameInDev = "useEffect";
|
|
updateHookTypesDev();
|
|
return updateEffect(create, deps);
|
|
},
|
|
useImperativeHandle: function(ref, create, deps) {
|
|
currentHookNameInDev = "useImperativeHandle";
|
|
updateHookTypesDev();
|
|
return updateImperativeHandle(ref, create, deps);
|
|
},
|
|
useInsertionEffect: function(create, deps) {
|
|
currentHookNameInDev = "useInsertionEffect";
|
|
updateHookTypesDev();
|
|
return updateInsertionEffect(create, deps);
|
|
},
|
|
useLayoutEffect: function(create, deps) {
|
|
currentHookNameInDev = "useLayoutEffect";
|
|
updateHookTypesDev();
|
|
return updateLayoutEffect(create, deps);
|
|
},
|
|
useMemo: function(create, deps) {
|
|
currentHookNameInDev = "useMemo";
|
|
updateHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
try {
|
|
return updateMemo(create, deps);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useReducer: function(reducer, initialArg, init) {
|
|
currentHookNameInDev = "useReducer";
|
|
updateHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
try {
|
|
return updateReducer(reducer, initialArg, init);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useRef: function(initialValue) {
|
|
currentHookNameInDev = "useRef";
|
|
updateHookTypesDev();
|
|
return updateRef();
|
|
},
|
|
useState: function(initialState9) {
|
|
currentHookNameInDev = "useState";
|
|
updateHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
try {
|
|
return updateState(initialState9);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useDebugValue: function(value, formatterFn) {
|
|
currentHookNameInDev = "useDebugValue";
|
|
updateHookTypesDev();
|
|
return updateDebugValue();
|
|
},
|
|
useDeferredValue: function(value) {
|
|
currentHookNameInDev = "useDeferredValue";
|
|
updateHookTypesDev();
|
|
return updateDeferredValue(value);
|
|
},
|
|
useTransition: function() {
|
|
currentHookNameInDev = "useTransition";
|
|
updateHookTypesDev();
|
|
return updateTransition();
|
|
},
|
|
useMutableSource: function(source, getSnapshot, subscribe) {
|
|
currentHookNameInDev = "useMutableSource";
|
|
updateHookTypesDev();
|
|
return updateMutableSource();
|
|
},
|
|
useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) {
|
|
currentHookNameInDev = "useSyncExternalStore";
|
|
updateHookTypesDev();
|
|
return updateSyncExternalStore(subscribe, getSnapshot);
|
|
},
|
|
useId: function() {
|
|
currentHookNameInDev = "useId";
|
|
updateHookTypesDev();
|
|
return updateId();
|
|
},
|
|
unstable_isNewReconciler: enableNewReconciler
|
|
};
|
|
HooksDispatcherOnRerenderInDEV = {
|
|
readContext: function(context) {
|
|
return readContext(context);
|
|
},
|
|
useCallback: function(callback, deps) {
|
|
currentHookNameInDev = "useCallback";
|
|
updateHookTypesDev();
|
|
return updateCallback(callback, deps);
|
|
},
|
|
useContext: function(context) {
|
|
currentHookNameInDev = "useContext";
|
|
updateHookTypesDev();
|
|
return readContext(context);
|
|
},
|
|
useEffect: function(create, deps) {
|
|
currentHookNameInDev = "useEffect";
|
|
updateHookTypesDev();
|
|
return updateEffect(create, deps);
|
|
},
|
|
useImperativeHandle: function(ref, create, deps) {
|
|
currentHookNameInDev = "useImperativeHandle";
|
|
updateHookTypesDev();
|
|
return updateImperativeHandle(ref, create, deps);
|
|
},
|
|
useInsertionEffect: function(create, deps) {
|
|
currentHookNameInDev = "useInsertionEffect";
|
|
updateHookTypesDev();
|
|
return updateInsertionEffect(create, deps);
|
|
},
|
|
useLayoutEffect: function(create, deps) {
|
|
currentHookNameInDev = "useLayoutEffect";
|
|
updateHookTypesDev();
|
|
return updateLayoutEffect(create, deps);
|
|
},
|
|
useMemo: function(create, deps) {
|
|
currentHookNameInDev = "useMemo";
|
|
updateHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV;
|
|
try {
|
|
return updateMemo(create, deps);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useReducer: function(reducer, initialArg, init) {
|
|
currentHookNameInDev = "useReducer";
|
|
updateHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV;
|
|
try {
|
|
return rerenderReducer(reducer, initialArg, init);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useRef: function(initialValue) {
|
|
currentHookNameInDev = "useRef";
|
|
updateHookTypesDev();
|
|
return updateRef();
|
|
},
|
|
useState: function(initialState9) {
|
|
currentHookNameInDev = "useState";
|
|
updateHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV;
|
|
try {
|
|
return rerenderState(initialState9);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useDebugValue: function(value, formatterFn) {
|
|
currentHookNameInDev = "useDebugValue";
|
|
updateHookTypesDev();
|
|
return updateDebugValue();
|
|
},
|
|
useDeferredValue: function(value) {
|
|
currentHookNameInDev = "useDeferredValue";
|
|
updateHookTypesDev();
|
|
return rerenderDeferredValue(value);
|
|
},
|
|
useTransition: function() {
|
|
currentHookNameInDev = "useTransition";
|
|
updateHookTypesDev();
|
|
return rerenderTransition();
|
|
},
|
|
useMutableSource: function(source, getSnapshot, subscribe) {
|
|
currentHookNameInDev = "useMutableSource";
|
|
updateHookTypesDev();
|
|
return updateMutableSource();
|
|
},
|
|
useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) {
|
|
currentHookNameInDev = "useSyncExternalStore";
|
|
updateHookTypesDev();
|
|
return updateSyncExternalStore(subscribe, getSnapshot);
|
|
},
|
|
useId: function() {
|
|
currentHookNameInDev = "useId";
|
|
updateHookTypesDev();
|
|
return updateId();
|
|
},
|
|
unstable_isNewReconciler: enableNewReconciler
|
|
};
|
|
InvalidNestedHooksDispatcherOnMountInDEV = {
|
|
readContext: function(context) {
|
|
warnInvalidContextAccess();
|
|
return readContext(context);
|
|
},
|
|
useCallback: function(callback, deps) {
|
|
currentHookNameInDev = "useCallback";
|
|
warnInvalidHookAccess();
|
|
mountHookTypesDev();
|
|
return mountCallback(callback, deps);
|
|
},
|
|
useContext: function(context) {
|
|
currentHookNameInDev = "useContext";
|
|
warnInvalidHookAccess();
|
|
mountHookTypesDev();
|
|
return readContext(context);
|
|
},
|
|
useEffect: function(create, deps) {
|
|
currentHookNameInDev = "useEffect";
|
|
warnInvalidHookAccess();
|
|
mountHookTypesDev();
|
|
return mountEffect(create, deps);
|
|
},
|
|
useImperativeHandle: function(ref, create, deps) {
|
|
currentHookNameInDev = "useImperativeHandle";
|
|
warnInvalidHookAccess();
|
|
mountHookTypesDev();
|
|
return mountImperativeHandle(ref, create, deps);
|
|
},
|
|
useInsertionEffect: function(create, deps) {
|
|
currentHookNameInDev = "useInsertionEffect";
|
|
warnInvalidHookAccess();
|
|
mountHookTypesDev();
|
|
return mountInsertionEffect(create, deps);
|
|
},
|
|
useLayoutEffect: function(create, deps) {
|
|
currentHookNameInDev = "useLayoutEffect";
|
|
warnInvalidHookAccess();
|
|
mountHookTypesDev();
|
|
return mountLayoutEffect(create, deps);
|
|
},
|
|
useMemo: function(create, deps) {
|
|
currentHookNameInDev = "useMemo";
|
|
warnInvalidHookAccess();
|
|
mountHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
try {
|
|
return mountMemo(create, deps);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useReducer: function(reducer, initialArg, init) {
|
|
currentHookNameInDev = "useReducer";
|
|
warnInvalidHookAccess();
|
|
mountHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
try {
|
|
return mountReducer(reducer, initialArg, init);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useRef: function(initialValue) {
|
|
currentHookNameInDev = "useRef";
|
|
warnInvalidHookAccess();
|
|
mountHookTypesDev();
|
|
return mountRef(initialValue);
|
|
},
|
|
useState: function(initialState9) {
|
|
currentHookNameInDev = "useState";
|
|
warnInvalidHookAccess();
|
|
mountHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV;
|
|
try {
|
|
return mountState(initialState9);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useDebugValue: function(value, formatterFn) {
|
|
currentHookNameInDev = "useDebugValue";
|
|
warnInvalidHookAccess();
|
|
mountHookTypesDev();
|
|
return mountDebugValue();
|
|
},
|
|
useDeferredValue: function(value) {
|
|
currentHookNameInDev = "useDeferredValue";
|
|
warnInvalidHookAccess();
|
|
mountHookTypesDev();
|
|
return mountDeferredValue(value);
|
|
},
|
|
useTransition: function() {
|
|
currentHookNameInDev = "useTransition";
|
|
warnInvalidHookAccess();
|
|
mountHookTypesDev();
|
|
return mountTransition();
|
|
},
|
|
useMutableSource: function(source, getSnapshot, subscribe) {
|
|
currentHookNameInDev = "useMutableSource";
|
|
warnInvalidHookAccess();
|
|
mountHookTypesDev();
|
|
return mountMutableSource();
|
|
},
|
|
useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) {
|
|
currentHookNameInDev = "useSyncExternalStore";
|
|
warnInvalidHookAccess();
|
|
mountHookTypesDev();
|
|
return mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
},
|
|
useId: function() {
|
|
currentHookNameInDev = "useId";
|
|
warnInvalidHookAccess();
|
|
mountHookTypesDev();
|
|
return mountId();
|
|
},
|
|
unstable_isNewReconciler: enableNewReconciler
|
|
};
|
|
InvalidNestedHooksDispatcherOnUpdateInDEV = {
|
|
readContext: function(context) {
|
|
warnInvalidContextAccess();
|
|
return readContext(context);
|
|
},
|
|
useCallback: function(callback, deps) {
|
|
currentHookNameInDev = "useCallback";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateCallback(callback, deps);
|
|
},
|
|
useContext: function(context) {
|
|
currentHookNameInDev = "useContext";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return readContext(context);
|
|
},
|
|
useEffect: function(create, deps) {
|
|
currentHookNameInDev = "useEffect";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateEffect(create, deps);
|
|
},
|
|
useImperativeHandle: function(ref, create, deps) {
|
|
currentHookNameInDev = "useImperativeHandle";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateImperativeHandle(ref, create, deps);
|
|
},
|
|
useInsertionEffect: function(create, deps) {
|
|
currentHookNameInDev = "useInsertionEffect";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateInsertionEffect(create, deps);
|
|
},
|
|
useLayoutEffect: function(create, deps) {
|
|
currentHookNameInDev = "useLayoutEffect";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateLayoutEffect(create, deps);
|
|
},
|
|
useMemo: function(create, deps) {
|
|
currentHookNameInDev = "useMemo";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
try {
|
|
return updateMemo(create, deps);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useReducer: function(reducer, initialArg, init) {
|
|
currentHookNameInDev = "useReducer";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
try {
|
|
return updateReducer(reducer, initialArg, init);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useRef: function(initialValue) {
|
|
currentHookNameInDev = "useRef";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateRef();
|
|
},
|
|
useState: function(initialState9) {
|
|
currentHookNameInDev = "useState";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
try {
|
|
return updateState(initialState9);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useDebugValue: function(value, formatterFn) {
|
|
currentHookNameInDev = "useDebugValue";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateDebugValue();
|
|
},
|
|
useDeferredValue: function(value) {
|
|
currentHookNameInDev = "useDeferredValue";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateDeferredValue(value);
|
|
},
|
|
useTransition: function() {
|
|
currentHookNameInDev = "useTransition";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateTransition();
|
|
},
|
|
useMutableSource: function(source, getSnapshot, subscribe) {
|
|
currentHookNameInDev = "useMutableSource";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateMutableSource();
|
|
},
|
|
useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) {
|
|
currentHookNameInDev = "useSyncExternalStore";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateSyncExternalStore(subscribe, getSnapshot);
|
|
},
|
|
useId: function() {
|
|
currentHookNameInDev = "useId";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateId();
|
|
},
|
|
unstable_isNewReconciler: enableNewReconciler
|
|
};
|
|
InvalidNestedHooksDispatcherOnRerenderInDEV = {
|
|
readContext: function(context) {
|
|
warnInvalidContextAccess();
|
|
return readContext(context);
|
|
},
|
|
useCallback: function(callback, deps) {
|
|
currentHookNameInDev = "useCallback";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateCallback(callback, deps);
|
|
},
|
|
useContext: function(context) {
|
|
currentHookNameInDev = "useContext";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return readContext(context);
|
|
},
|
|
useEffect: function(create, deps) {
|
|
currentHookNameInDev = "useEffect";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateEffect(create, deps);
|
|
},
|
|
useImperativeHandle: function(ref, create, deps) {
|
|
currentHookNameInDev = "useImperativeHandle";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateImperativeHandle(ref, create, deps);
|
|
},
|
|
useInsertionEffect: function(create, deps) {
|
|
currentHookNameInDev = "useInsertionEffect";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateInsertionEffect(create, deps);
|
|
},
|
|
useLayoutEffect: function(create, deps) {
|
|
currentHookNameInDev = "useLayoutEffect";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateLayoutEffect(create, deps);
|
|
},
|
|
useMemo: function(create, deps) {
|
|
currentHookNameInDev = "useMemo";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
try {
|
|
return updateMemo(create, deps);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useReducer: function(reducer, initialArg, init) {
|
|
currentHookNameInDev = "useReducer";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
try {
|
|
return rerenderReducer(reducer, initialArg, init);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useRef: function(initialValue) {
|
|
currentHookNameInDev = "useRef";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateRef();
|
|
},
|
|
useState: function(initialState9) {
|
|
currentHookNameInDev = "useState";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
var prevDispatcher = ReactCurrentDispatcher$1.current;
|
|
ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV;
|
|
try {
|
|
return rerenderState(initialState9);
|
|
} finally {
|
|
ReactCurrentDispatcher$1.current = prevDispatcher;
|
|
}
|
|
},
|
|
useDebugValue: function(value, formatterFn) {
|
|
currentHookNameInDev = "useDebugValue";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateDebugValue();
|
|
},
|
|
useDeferredValue: function(value) {
|
|
currentHookNameInDev = "useDeferredValue";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return rerenderDeferredValue(value);
|
|
},
|
|
useTransition: function() {
|
|
currentHookNameInDev = "useTransition";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return rerenderTransition();
|
|
},
|
|
useMutableSource: function(source, getSnapshot, subscribe) {
|
|
currentHookNameInDev = "useMutableSource";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateMutableSource();
|
|
},
|
|
useSyncExternalStore: function(subscribe, getSnapshot, getServerSnapshot) {
|
|
currentHookNameInDev = "useSyncExternalStore";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateSyncExternalStore(subscribe, getSnapshot);
|
|
},
|
|
useId: function() {
|
|
currentHookNameInDev = "useId";
|
|
warnInvalidHookAccess();
|
|
updateHookTypesDev();
|
|
return updateId();
|
|
},
|
|
unstable_isNewReconciler: enableNewReconciler
|
|
};
|
|
}
|
|
var now$1 = Scheduler.unstable_now;
|
|
var commitTime = 0;
|
|
var layoutEffectStartTime = -1;
|
|
var profilerStartTime = -1;
|
|
var passiveEffectStartTime = -1;
|
|
var currentUpdateIsNested = false;
|
|
var nestedUpdateScheduled = false;
|
|
function isCurrentUpdateNested() {
|
|
return currentUpdateIsNested;
|
|
}
|
|
function markNestedUpdateScheduled() {
|
|
{
|
|
nestedUpdateScheduled = true;
|
|
}
|
|
}
|
|
function resetNestedUpdateFlag() {
|
|
{
|
|
currentUpdateIsNested = false;
|
|
nestedUpdateScheduled = false;
|
|
}
|
|
}
|
|
function syncNestedUpdateFlag() {
|
|
{
|
|
currentUpdateIsNested = nestedUpdateScheduled;
|
|
nestedUpdateScheduled = false;
|
|
}
|
|
}
|
|
function getCommitTime() {
|
|
return commitTime;
|
|
}
|
|
function recordCommitTime() {
|
|
commitTime = now$1();
|
|
}
|
|
function startProfilerTimer(fiber) {
|
|
profilerStartTime = now$1();
|
|
if (fiber.actualStartTime < 0) {
|
|
fiber.actualStartTime = now$1();
|
|
}
|
|
}
|
|
function stopProfilerTimerIfRunning(fiber) {
|
|
profilerStartTime = -1;
|
|
}
|
|
function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) {
|
|
if (profilerStartTime >= 0) {
|
|
var elapsedTime = now$1() - profilerStartTime;
|
|
fiber.actualDuration += elapsedTime;
|
|
if (overrideBaseTime) {
|
|
fiber.selfBaseDuration = elapsedTime;
|
|
}
|
|
profilerStartTime = -1;
|
|
}
|
|
}
|
|
function recordLayoutEffectDuration(fiber) {
|
|
if (layoutEffectStartTime >= 0) {
|
|
var elapsedTime = now$1() - layoutEffectStartTime;
|
|
layoutEffectStartTime = -1;
|
|
var parentFiber = fiber.return;
|
|
while (parentFiber !== null) {
|
|
switch (parentFiber.tag) {
|
|
case HostRoot:
|
|
var root2 = parentFiber.stateNode;
|
|
root2.effectDuration += elapsedTime;
|
|
return;
|
|
case Profiler:
|
|
var parentStateNode = parentFiber.stateNode;
|
|
parentStateNode.effectDuration += elapsedTime;
|
|
return;
|
|
}
|
|
parentFiber = parentFiber.return;
|
|
}
|
|
}
|
|
}
|
|
function recordPassiveEffectDuration(fiber) {
|
|
if (passiveEffectStartTime >= 0) {
|
|
var elapsedTime = now$1() - passiveEffectStartTime;
|
|
passiveEffectStartTime = -1;
|
|
var parentFiber = fiber.return;
|
|
while (parentFiber !== null) {
|
|
switch (parentFiber.tag) {
|
|
case HostRoot:
|
|
var root2 = parentFiber.stateNode;
|
|
if (root2 !== null) {
|
|
root2.passiveEffectDuration += elapsedTime;
|
|
}
|
|
return;
|
|
case Profiler:
|
|
var parentStateNode = parentFiber.stateNode;
|
|
if (parentStateNode !== null) {
|
|
parentStateNode.passiveEffectDuration += elapsedTime;
|
|
}
|
|
return;
|
|
}
|
|
parentFiber = parentFiber.return;
|
|
}
|
|
}
|
|
}
|
|
function startLayoutEffectTimer() {
|
|
layoutEffectStartTime = now$1();
|
|
}
|
|
function startPassiveEffectTimer() {
|
|
passiveEffectStartTime = now$1();
|
|
}
|
|
function transferActualDuration(fiber) {
|
|
var child = fiber.child;
|
|
while (child) {
|
|
fiber.actualDuration += child.actualDuration;
|
|
child = child.sibling;
|
|
}
|
|
}
|
|
function resolveDefaultProps(Component, baseProps) {
|
|
if (Component && Component.defaultProps) {
|
|
var props = assign2({}, baseProps);
|
|
var defaultProps = Component.defaultProps;
|
|
for (var propName in defaultProps) {
|
|
if (props[propName] === void 0) {
|
|
props[propName] = defaultProps[propName];
|
|
}
|
|
}
|
|
return props;
|
|
}
|
|
return baseProps;
|
|
}
|
|
var fakeInternalInstance = {};
|
|
var didWarnAboutStateAssignmentForComponent;
|
|
var didWarnAboutUninitializedState;
|
|
var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
|
|
var didWarnAboutLegacyLifecyclesAndDerivedState;
|
|
var didWarnAboutUndefinedDerivedState;
|
|
var warnOnUndefinedDerivedState;
|
|
var warnOnInvalidCallback;
|
|
var didWarnAboutDirectlyAssigningPropsToState;
|
|
var didWarnAboutContextTypeAndContextTypes;
|
|
var didWarnAboutInvalidateContextType;
|
|
var didWarnAboutLegacyContext$1;
|
|
{
|
|
didWarnAboutStateAssignmentForComponent = /* @__PURE__ */ new Set();
|
|
didWarnAboutUninitializedState = /* @__PURE__ */ new Set();
|
|
didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = /* @__PURE__ */ new Set();
|
|
didWarnAboutLegacyLifecyclesAndDerivedState = /* @__PURE__ */ new Set();
|
|
didWarnAboutDirectlyAssigningPropsToState = /* @__PURE__ */ new Set();
|
|
didWarnAboutUndefinedDerivedState = /* @__PURE__ */ new Set();
|
|
didWarnAboutContextTypeAndContextTypes = /* @__PURE__ */ new Set();
|
|
didWarnAboutInvalidateContextType = /* @__PURE__ */ new Set();
|
|
didWarnAboutLegacyContext$1 = /* @__PURE__ */ new Set();
|
|
var didWarnOnInvalidCallback = /* @__PURE__ */ new Set();
|
|
warnOnInvalidCallback = function(callback, callerName) {
|
|
if (callback === null || typeof callback === "function") {
|
|
return;
|
|
}
|
|
var key = callerName + "_" + callback;
|
|
if (!didWarnOnInvalidCallback.has(key)) {
|
|
didWarnOnInvalidCallback.add(key);
|
|
error("%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.", callerName, callback);
|
|
}
|
|
};
|
|
warnOnUndefinedDerivedState = function(type, partialState) {
|
|
if (partialState === void 0) {
|
|
var componentName = getComponentNameFromType(type) || "Component";
|
|
if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
|
|
didWarnAboutUndefinedDerivedState.add(componentName);
|
|
error("%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. You have returned undefined.", componentName);
|
|
}
|
|
}
|
|
};
|
|
Object.defineProperty(fakeInternalInstance, "_processChildContext", {
|
|
enumerable: false,
|
|
value: function() {
|
|
throw new Error("_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).");
|
|
}
|
|
});
|
|
Object.freeze(fakeInternalInstance);
|
|
}
|
|
function applyDerivedStateFromProps(workInProgress2, ctor, getDerivedStateFromProps, nextProps) {
|
|
var prevState = workInProgress2.memoizedState;
|
|
var partialState = getDerivedStateFromProps(nextProps, prevState);
|
|
{
|
|
if (workInProgress2.mode & StrictLegacyMode) {
|
|
setIsStrictModeForDevtools(true);
|
|
try {
|
|
partialState = getDerivedStateFromProps(nextProps, prevState);
|
|
} finally {
|
|
setIsStrictModeForDevtools(false);
|
|
}
|
|
}
|
|
warnOnUndefinedDerivedState(ctor, partialState);
|
|
}
|
|
var memoizedState = partialState === null || partialState === void 0 ? prevState : assign2({}, prevState, partialState);
|
|
workInProgress2.memoizedState = memoizedState;
|
|
if (workInProgress2.lanes === NoLanes) {
|
|
var updateQueue = workInProgress2.updateQueue;
|
|
updateQueue.baseState = memoizedState;
|
|
}
|
|
}
|
|
var classComponentUpdater = {
|
|
isMounted,
|
|
enqueueSetState: function(inst, payload, callback) {
|
|
var fiber = get2(inst);
|
|
var eventTime = requestEventTime();
|
|
var lane = requestUpdateLane(fiber);
|
|
var update = createUpdate(eventTime, lane);
|
|
update.payload = payload;
|
|
if (callback !== void 0 && callback !== null) {
|
|
{
|
|
warnOnInvalidCallback(callback, "setState");
|
|
}
|
|
update.callback = callback;
|
|
}
|
|
var root2 = enqueueUpdate(fiber, update, lane);
|
|
if (root2 !== null) {
|
|
scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
|
|
entangleTransitions(root2, fiber, lane);
|
|
}
|
|
{
|
|
markStateUpdateScheduled(fiber, lane);
|
|
}
|
|
},
|
|
enqueueReplaceState: function(inst, payload, callback) {
|
|
var fiber = get2(inst);
|
|
var eventTime = requestEventTime();
|
|
var lane = requestUpdateLane(fiber);
|
|
var update = createUpdate(eventTime, lane);
|
|
update.tag = ReplaceState;
|
|
update.payload = payload;
|
|
if (callback !== void 0 && callback !== null) {
|
|
{
|
|
warnOnInvalidCallback(callback, "replaceState");
|
|
}
|
|
update.callback = callback;
|
|
}
|
|
var root2 = enqueueUpdate(fiber, update, lane);
|
|
if (root2 !== null) {
|
|
scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
|
|
entangleTransitions(root2, fiber, lane);
|
|
}
|
|
{
|
|
markStateUpdateScheduled(fiber, lane);
|
|
}
|
|
},
|
|
enqueueForceUpdate: function(inst, callback) {
|
|
var fiber = get2(inst);
|
|
var eventTime = requestEventTime();
|
|
var lane = requestUpdateLane(fiber);
|
|
var update = createUpdate(eventTime, lane);
|
|
update.tag = ForceUpdate;
|
|
if (callback !== void 0 && callback !== null) {
|
|
{
|
|
warnOnInvalidCallback(callback, "forceUpdate");
|
|
}
|
|
update.callback = callback;
|
|
}
|
|
var root2 = enqueueUpdate(fiber, update, lane);
|
|
if (root2 !== null) {
|
|
scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
|
|
entangleTransitions(root2, fiber, lane);
|
|
}
|
|
{
|
|
markForceUpdateScheduled(fiber, lane);
|
|
}
|
|
}
|
|
};
|
|
function checkShouldComponentUpdate(workInProgress2, ctor, oldProps, newProps, oldState, newState, nextContext) {
|
|
var instance = workInProgress2.stateNode;
|
|
if (typeof instance.shouldComponentUpdate === "function") {
|
|
var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
|
|
{
|
|
if (workInProgress2.mode & StrictLegacyMode) {
|
|
setIsStrictModeForDevtools(true);
|
|
try {
|
|
shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext);
|
|
} finally {
|
|
setIsStrictModeForDevtools(false);
|
|
}
|
|
}
|
|
if (shouldUpdate === void 0) {
|
|
error("%s.shouldComponentUpdate(): Returned undefined instead of a boolean value. Make sure to return true or false.", getComponentNameFromType(ctor) || "Component");
|
|
}
|
|
}
|
|
return shouldUpdate;
|
|
}
|
|
if (ctor.prototype && ctor.prototype.isPureReactComponent) {
|
|
return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState);
|
|
}
|
|
return true;
|
|
}
|
|
function checkClassInstance(workInProgress2, ctor, newProps) {
|
|
var instance = workInProgress2.stateNode;
|
|
{
|
|
var name = getComponentNameFromType(ctor) || "Component";
|
|
var renderPresent = instance.render;
|
|
if (!renderPresent) {
|
|
if (ctor.prototype && typeof ctor.prototype.render === "function") {
|
|
error("%s(...): No `render` method found on the returned component instance: did you accidentally return an object from the constructor?", name);
|
|
} else {
|
|
error("%s(...): No `render` method found on the returned component instance: you may have forgotten to define `render`.", name);
|
|
}
|
|
}
|
|
if (instance.getInitialState && !instance.getInitialState.isReactClassApproved && !instance.state) {
|
|
error("getInitialState was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?", name);
|
|
}
|
|
if (instance.getDefaultProps && !instance.getDefaultProps.isReactClassApproved) {
|
|
error("getDefaultProps was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Use a static property to define defaultProps instead.", name);
|
|
}
|
|
if (instance.propTypes) {
|
|
error("propTypes was defined as an instance property on %s. Use a static property to define propTypes instead.", name);
|
|
}
|
|
if (instance.contextType) {
|
|
error("contextType was defined as an instance property on %s. Use a static property to define contextType instead.", name);
|
|
}
|
|
{
|
|
if (ctor.childContextTypes && !didWarnAboutLegacyContext$1.has(ctor) && (workInProgress2.mode & StrictLegacyMode) === NoMode) {
|
|
didWarnAboutLegacyContext$1.add(ctor);
|
|
error("%s uses the legacy childContextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext() instead\n\n.Learn more about this warning here: https://reactjs.org/link/legacy-context", name);
|
|
}
|
|
if (ctor.contextTypes && !didWarnAboutLegacyContext$1.has(ctor) && (workInProgress2.mode & StrictLegacyMode) === NoMode) {
|
|
didWarnAboutLegacyContext$1.add(ctor);
|
|
error("%s uses the legacy contextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext() with static contextType instead.\n\nLearn more about this warning here: https://reactjs.org/link/legacy-context", name);
|
|
}
|
|
if (instance.contextTypes) {
|
|
error("contextTypes was defined as an instance property on %s. Use a static property to define contextTypes instead.", name);
|
|
}
|
|
if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) {
|
|
didWarnAboutContextTypeAndContextTypes.add(ctor);
|
|
error("%s declares both contextTypes and contextType static properties. The legacy contextTypes property will be ignored.", name);
|
|
}
|
|
}
|
|
if (typeof instance.componentShouldUpdate === "function") {
|
|
error("%s has a method called componentShouldUpdate(). Did you mean shouldComponentUpdate()? The name is phrased as a question because the function is expected to return a value.", name);
|
|
}
|
|
if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== "undefined") {
|
|
error("%s has a method called shouldComponentUpdate(). shouldComponentUpdate should not be used when extending React.PureComponent. Please extend React.Component if shouldComponentUpdate is used.", getComponentNameFromType(ctor) || "A pure component");
|
|
}
|
|
if (typeof instance.componentDidUnmount === "function") {
|
|
error("%s has a method called componentDidUnmount(). But there is no such lifecycle method. Did you mean componentWillUnmount()?", name);
|
|
}
|
|
if (typeof instance.componentDidReceiveProps === "function") {
|
|
error("%s has a method called componentDidReceiveProps(). But there is no such lifecycle method. If you meant to update the state in response to changing props, use componentWillReceiveProps(). If you meant to fetch data or run side-effects or mutations after React has updated the UI, use componentDidUpdate().", name);
|
|
}
|
|
if (typeof instance.componentWillRecieveProps === "function") {
|
|
error("%s has a method called componentWillRecieveProps(). Did you mean componentWillReceiveProps()?", name);
|
|
}
|
|
if (typeof instance.UNSAFE_componentWillRecieveProps === "function") {
|
|
error("%s has a method called UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?", name);
|
|
}
|
|
var hasMutatedProps = instance.props !== newProps;
|
|
if (instance.props !== void 0 && hasMutatedProps) {
|
|
error("%s(...): When calling super() in `%s`, make sure to pass up the same props that your component's constructor was passed.", name, name);
|
|
}
|
|
if (instance.defaultProps) {
|
|
error("Setting defaultProps as an instance property on %s is not supported and will be ignored. Instead, define defaultProps as a static property on %s.", name, name);
|
|
}
|
|
if (typeof instance.getSnapshotBeforeUpdate === "function" && typeof instance.componentDidUpdate !== "function" && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) {
|
|
didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor);
|
|
error("%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). This component defines getSnapshotBeforeUpdate() only.", getComponentNameFromType(ctor));
|
|
}
|
|
if (typeof instance.getDerivedStateFromProps === "function") {
|
|
error("%s: getDerivedStateFromProps() is defined as an instance method and will be ignored. Instead, declare it as a static method.", name);
|
|
}
|
|
if (typeof instance.getDerivedStateFromError === "function") {
|
|
error("%s: getDerivedStateFromError() is defined as an instance method and will be ignored. Instead, declare it as a static method.", name);
|
|
}
|
|
if (typeof ctor.getSnapshotBeforeUpdate === "function") {
|
|
error("%s: getSnapshotBeforeUpdate() is defined as a static method and will be ignored. Instead, declare it as an instance method.", name);
|
|
}
|
|
var _state = instance.state;
|
|
if (_state && (typeof _state !== "object" || isArray2(_state))) {
|
|
error("%s.state: must be set to an object or null", name);
|
|
}
|
|
if (typeof instance.getChildContext === "function" && typeof ctor.childContextTypes !== "object") {
|
|
error("%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().", name);
|
|
}
|
|
}
|
|
}
|
|
function adoptClassInstance(workInProgress2, instance) {
|
|
instance.updater = classComponentUpdater;
|
|
workInProgress2.stateNode = instance;
|
|
set3(instance, workInProgress2);
|
|
{
|
|
instance._reactInternalInstance = fakeInternalInstance;
|
|
}
|
|
}
|
|
function constructClassInstance(workInProgress2, ctor, props) {
|
|
var isLegacyContextConsumer = false;
|
|
var unmaskedContext = emptyContextObject;
|
|
var context = emptyContextObject;
|
|
var contextType = ctor.contextType;
|
|
{
|
|
if ("contextType" in ctor) {
|
|
var isValid = contextType === null || contextType !== void 0 && contextType.$$typeof === REACT_CONTEXT_TYPE2 && contextType._context === void 0;
|
|
if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) {
|
|
didWarnAboutInvalidateContextType.add(ctor);
|
|
var addendum = "";
|
|
if (contextType === void 0) {
|
|
addendum = " However, it is set to undefined. This can be caused by a typo or by mixing up named and default imports. This can also happen due to a circular dependency, so try moving the createContext() call to a separate file.";
|
|
} else if (typeof contextType !== "object") {
|
|
addendum = " However, it is set to a " + typeof contextType + ".";
|
|
} else if (contextType.$$typeof === REACT_PROVIDER_TYPE2) {
|
|
addendum = " Did you accidentally pass the Context.Provider instead?";
|
|
} else if (contextType._context !== void 0) {
|
|
addendum = " Did you accidentally pass the Context.Consumer instead?";
|
|
} else {
|
|
addendum = " However, it is set to an object with keys {" + Object.keys(contextType).join(", ") + "}.";
|
|
}
|
|
error("%s defines an invalid contextType. contextType should point to the Context object returned by React.createContext().%s", getComponentNameFromType(ctor) || "Component", addendum);
|
|
}
|
|
}
|
|
}
|
|
if (typeof contextType === "object" && contextType !== null) {
|
|
context = readContext(contextType);
|
|
} else {
|
|
unmaskedContext = getUnmaskedContext(workInProgress2, ctor, true);
|
|
var contextTypes = ctor.contextTypes;
|
|
isLegacyContextConsumer = contextTypes !== null && contextTypes !== void 0;
|
|
context = isLegacyContextConsumer ? getMaskedContext(workInProgress2, unmaskedContext) : emptyContextObject;
|
|
}
|
|
var instance = new ctor(props, context);
|
|
{
|
|
if (workInProgress2.mode & StrictLegacyMode) {
|
|
setIsStrictModeForDevtools(true);
|
|
try {
|
|
instance = new ctor(props, context);
|
|
} finally {
|
|
setIsStrictModeForDevtools(false);
|
|
}
|
|
}
|
|
}
|
|
var state = workInProgress2.memoizedState = instance.state !== null && instance.state !== void 0 ? instance.state : null;
|
|
adoptClassInstance(workInProgress2, instance);
|
|
{
|
|
if (typeof ctor.getDerivedStateFromProps === "function" && state === null) {
|
|
var componentName = getComponentNameFromType(ctor) || "Component";
|
|
if (!didWarnAboutUninitializedState.has(componentName)) {
|
|
didWarnAboutUninitializedState.add(componentName);
|
|
error("`%s` uses `getDerivedStateFromProps` but its initial state is %s. This is not recommended. Instead, define the initial state by assigning an object to `this.state` in the constructor of `%s`. This ensures that `getDerivedStateFromProps` arguments have a consistent shape.", componentName, instance.state === null ? "null" : "undefined", componentName);
|
|
}
|
|
}
|
|
if (typeof ctor.getDerivedStateFromProps === "function" || typeof instance.getSnapshotBeforeUpdate === "function") {
|
|
var foundWillMountName = null;
|
|
var foundWillReceivePropsName = null;
|
|
var foundWillUpdateName = null;
|
|
if (typeof instance.componentWillMount === "function" && instance.componentWillMount.__suppressDeprecationWarning !== true) {
|
|
foundWillMountName = "componentWillMount";
|
|
} else if (typeof instance.UNSAFE_componentWillMount === "function") {
|
|
foundWillMountName = "UNSAFE_componentWillMount";
|
|
}
|
|
if (typeof instance.componentWillReceiveProps === "function" && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) {
|
|
foundWillReceivePropsName = "componentWillReceiveProps";
|
|
} else if (typeof instance.UNSAFE_componentWillReceiveProps === "function") {
|
|
foundWillReceivePropsName = "UNSAFE_componentWillReceiveProps";
|
|
}
|
|
if (typeof instance.componentWillUpdate === "function" && instance.componentWillUpdate.__suppressDeprecationWarning !== true) {
|
|
foundWillUpdateName = "componentWillUpdate";
|
|
} else if (typeof instance.UNSAFE_componentWillUpdate === "function") {
|
|
foundWillUpdateName = "UNSAFE_componentWillUpdate";
|
|
}
|
|
if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) {
|
|
var _componentName = getComponentNameFromType(ctor) || "Component";
|
|
var newApiName = typeof ctor.getDerivedStateFromProps === "function" ? "getDerivedStateFromProps()" : "getSnapshotBeforeUpdate()";
|
|
if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) {
|
|
didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName);
|
|
error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://reactjs.org/link/unsafe-component-lifecycles", _componentName, newApiName, foundWillMountName !== null ? "\n " + foundWillMountName : "", foundWillReceivePropsName !== null ? "\n " + foundWillReceivePropsName : "", foundWillUpdateName !== null ? "\n " + foundWillUpdateName : "");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (isLegacyContextConsumer) {
|
|
cacheContext(workInProgress2, unmaskedContext, context);
|
|
}
|
|
return instance;
|
|
}
|
|
function callComponentWillMount(workInProgress2, instance) {
|
|
var oldState = instance.state;
|
|
if (typeof instance.componentWillMount === "function") {
|
|
instance.componentWillMount();
|
|
}
|
|
if (typeof instance.UNSAFE_componentWillMount === "function") {
|
|
instance.UNSAFE_componentWillMount();
|
|
}
|
|
if (oldState !== instance.state) {
|
|
{
|
|
error("%s.componentWillMount(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.", getComponentNameFromFiber(workInProgress2) || "Component");
|
|
}
|
|
classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
|
|
}
|
|
}
|
|
function callComponentWillReceiveProps(workInProgress2, instance, newProps, nextContext) {
|
|
var oldState = instance.state;
|
|
if (typeof instance.componentWillReceiveProps === "function") {
|
|
instance.componentWillReceiveProps(newProps, nextContext);
|
|
}
|
|
if (typeof instance.UNSAFE_componentWillReceiveProps === "function") {
|
|
instance.UNSAFE_componentWillReceiveProps(newProps, nextContext);
|
|
}
|
|
if (instance.state !== oldState) {
|
|
{
|
|
var componentName = getComponentNameFromFiber(workInProgress2) || "Component";
|
|
if (!didWarnAboutStateAssignmentForComponent.has(componentName)) {
|
|
didWarnAboutStateAssignmentForComponent.add(componentName);
|
|
error("%s.componentWillReceiveProps(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.", componentName);
|
|
}
|
|
}
|
|
classComponentUpdater.enqueueReplaceState(instance, instance.state, null);
|
|
}
|
|
}
|
|
function mountClassInstance(workInProgress2, ctor, newProps, renderLanes2) {
|
|
{
|
|
checkClassInstance(workInProgress2, ctor, newProps);
|
|
}
|
|
var instance = workInProgress2.stateNode;
|
|
instance.props = newProps;
|
|
instance.state = workInProgress2.memoizedState;
|
|
instance.refs = {};
|
|
initializeUpdateQueue(workInProgress2);
|
|
var contextType = ctor.contextType;
|
|
if (typeof contextType === "object" && contextType !== null) {
|
|
instance.context = readContext(contextType);
|
|
} else {
|
|
var unmaskedContext = getUnmaskedContext(workInProgress2, ctor, true);
|
|
instance.context = getMaskedContext(workInProgress2, unmaskedContext);
|
|
}
|
|
{
|
|
if (instance.state === newProps) {
|
|
var componentName = getComponentNameFromType(ctor) || "Component";
|
|
if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) {
|
|
didWarnAboutDirectlyAssigningPropsToState.add(componentName);
|
|
error("%s: It is not recommended to assign props directly to state because updates to props won't be reflected in state. In most cases, it is better to use props directly.", componentName);
|
|
}
|
|
}
|
|
if (workInProgress2.mode & StrictLegacyMode) {
|
|
ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress2, instance);
|
|
}
|
|
{
|
|
ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress2, instance);
|
|
}
|
|
}
|
|
instance.state = workInProgress2.memoizedState;
|
|
var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
|
|
if (typeof getDerivedStateFromProps === "function") {
|
|
applyDerivedStateFromProps(workInProgress2, ctor, getDerivedStateFromProps, newProps);
|
|
instance.state = workInProgress2.memoizedState;
|
|
}
|
|
if (typeof ctor.getDerivedStateFromProps !== "function" && typeof instance.getSnapshotBeforeUpdate !== "function" && (typeof instance.UNSAFE_componentWillMount === "function" || typeof instance.componentWillMount === "function")) {
|
|
callComponentWillMount(workInProgress2, instance);
|
|
processUpdateQueue(workInProgress2, newProps, instance, renderLanes2);
|
|
instance.state = workInProgress2.memoizedState;
|
|
}
|
|
if (typeof instance.componentDidMount === "function") {
|
|
var fiberFlags = Update;
|
|
{
|
|
fiberFlags |= LayoutStatic;
|
|
}
|
|
if ((workInProgress2.mode & StrictEffectsMode) !== NoMode) {
|
|
fiberFlags |= MountLayoutDev;
|
|
}
|
|
workInProgress2.flags |= fiberFlags;
|
|
}
|
|
}
|
|
function resumeMountClassInstance(workInProgress2, ctor, newProps, renderLanes2) {
|
|
var instance = workInProgress2.stateNode;
|
|
var oldProps = workInProgress2.memoizedProps;
|
|
instance.props = oldProps;
|
|
var oldContext = instance.context;
|
|
var contextType = ctor.contextType;
|
|
var nextContext = emptyContextObject;
|
|
if (typeof contextType === "object" && contextType !== null) {
|
|
nextContext = readContext(contextType);
|
|
} else {
|
|
var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress2, ctor, true);
|
|
nextContext = getMaskedContext(workInProgress2, nextLegacyUnmaskedContext);
|
|
}
|
|
var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
|
|
var hasNewLifecycles = typeof getDerivedStateFromProps === "function" || typeof instance.getSnapshotBeforeUpdate === "function";
|
|
if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === "function" || typeof instance.componentWillReceiveProps === "function")) {
|
|
if (oldProps !== newProps || oldContext !== nextContext) {
|
|
callComponentWillReceiveProps(workInProgress2, instance, newProps, nextContext);
|
|
}
|
|
}
|
|
resetHasForceUpdateBeforeProcessing();
|
|
var oldState = workInProgress2.memoizedState;
|
|
var newState = instance.state = oldState;
|
|
processUpdateQueue(workInProgress2, newProps, instance, renderLanes2);
|
|
newState = workInProgress2.memoizedState;
|
|
if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) {
|
|
if (typeof instance.componentDidMount === "function") {
|
|
var fiberFlags = Update;
|
|
{
|
|
fiberFlags |= LayoutStatic;
|
|
}
|
|
if ((workInProgress2.mode & StrictEffectsMode) !== NoMode) {
|
|
fiberFlags |= MountLayoutDev;
|
|
}
|
|
workInProgress2.flags |= fiberFlags;
|
|
}
|
|
return false;
|
|
}
|
|
if (typeof getDerivedStateFromProps === "function") {
|
|
applyDerivedStateFromProps(workInProgress2, ctor, getDerivedStateFromProps, newProps);
|
|
newState = workInProgress2.memoizedState;
|
|
}
|
|
var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress2, ctor, oldProps, newProps, oldState, newState, nextContext);
|
|
if (shouldUpdate) {
|
|
if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === "function" || typeof instance.componentWillMount === "function")) {
|
|
if (typeof instance.componentWillMount === "function") {
|
|
instance.componentWillMount();
|
|
}
|
|
if (typeof instance.UNSAFE_componentWillMount === "function") {
|
|
instance.UNSAFE_componentWillMount();
|
|
}
|
|
}
|
|
if (typeof instance.componentDidMount === "function") {
|
|
var _fiberFlags = Update;
|
|
{
|
|
_fiberFlags |= LayoutStatic;
|
|
}
|
|
if ((workInProgress2.mode & StrictEffectsMode) !== NoMode) {
|
|
_fiberFlags |= MountLayoutDev;
|
|
}
|
|
workInProgress2.flags |= _fiberFlags;
|
|
}
|
|
} else {
|
|
if (typeof instance.componentDidMount === "function") {
|
|
var _fiberFlags2 = Update;
|
|
{
|
|
_fiberFlags2 |= LayoutStatic;
|
|
}
|
|
if ((workInProgress2.mode & StrictEffectsMode) !== NoMode) {
|
|
_fiberFlags2 |= MountLayoutDev;
|
|
}
|
|
workInProgress2.flags |= _fiberFlags2;
|
|
}
|
|
workInProgress2.memoizedProps = newProps;
|
|
workInProgress2.memoizedState = newState;
|
|
}
|
|
instance.props = newProps;
|
|
instance.state = newState;
|
|
instance.context = nextContext;
|
|
return shouldUpdate;
|
|
}
|
|
function updateClassInstance(current3, workInProgress2, ctor, newProps, renderLanes2) {
|
|
var instance = workInProgress2.stateNode;
|
|
cloneUpdateQueue(current3, workInProgress2);
|
|
var unresolvedOldProps = workInProgress2.memoizedProps;
|
|
var oldProps = workInProgress2.type === workInProgress2.elementType ? unresolvedOldProps : resolveDefaultProps(workInProgress2.type, unresolvedOldProps);
|
|
instance.props = oldProps;
|
|
var unresolvedNewProps = workInProgress2.pendingProps;
|
|
var oldContext = instance.context;
|
|
var contextType = ctor.contextType;
|
|
var nextContext = emptyContextObject;
|
|
if (typeof contextType === "object" && contextType !== null) {
|
|
nextContext = readContext(contextType);
|
|
} else {
|
|
var nextUnmaskedContext = getUnmaskedContext(workInProgress2, ctor, true);
|
|
nextContext = getMaskedContext(workInProgress2, nextUnmaskedContext);
|
|
}
|
|
var getDerivedStateFromProps = ctor.getDerivedStateFromProps;
|
|
var hasNewLifecycles = typeof getDerivedStateFromProps === "function" || typeof instance.getSnapshotBeforeUpdate === "function";
|
|
if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === "function" || typeof instance.componentWillReceiveProps === "function")) {
|
|
if (unresolvedOldProps !== unresolvedNewProps || oldContext !== nextContext) {
|
|
callComponentWillReceiveProps(workInProgress2, instance, newProps, nextContext);
|
|
}
|
|
}
|
|
resetHasForceUpdateBeforeProcessing();
|
|
var oldState = workInProgress2.memoizedState;
|
|
var newState = instance.state = oldState;
|
|
processUpdateQueue(workInProgress2, newProps, instance, renderLanes2);
|
|
newState = workInProgress2.memoizedState;
|
|
if (unresolvedOldProps === unresolvedNewProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing() && !enableLazyContextPropagation) {
|
|
if (typeof instance.componentDidUpdate === "function") {
|
|
if (unresolvedOldProps !== current3.memoizedProps || oldState !== current3.memoizedState) {
|
|
workInProgress2.flags |= Update;
|
|
}
|
|
}
|
|
if (typeof instance.getSnapshotBeforeUpdate === "function") {
|
|
if (unresolvedOldProps !== current3.memoizedProps || oldState !== current3.memoizedState) {
|
|
workInProgress2.flags |= Snapshot;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
if (typeof getDerivedStateFromProps === "function") {
|
|
applyDerivedStateFromProps(workInProgress2, ctor, getDerivedStateFromProps, newProps);
|
|
newState = workInProgress2.memoizedState;
|
|
}
|
|
var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress2, ctor, oldProps, newProps, oldState, newState, nextContext) || enableLazyContextPropagation;
|
|
if (shouldUpdate) {
|
|
if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === "function" || typeof instance.componentWillUpdate === "function")) {
|
|
if (typeof instance.componentWillUpdate === "function") {
|
|
instance.componentWillUpdate(newProps, newState, nextContext);
|
|
}
|
|
if (typeof instance.UNSAFE_componentWillUpdate === "function") {
|
|
instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext);
|
|
}
|
|
}
|
|
if (typeof instance.componentDidUpdate === "function") {
|
|
workInProgress2.flags |= Update;
|
|
}
|
|
if (typeof instance.getSnapshotBeforeUpdate === "function") {
|
|
workInProgress2.flags |= Snapshot;
|
|
}
|
|
} else {
|
|
if (typeof instance.componentDidUpdate === "function") {
|
|
if (unresolvedOldProps !== current3.memoizedProps || oldState !== current3.memoizedState) {
|
|
workInProgress2.flags |= Update;
|
|
}
|
|
}
|
|
if (typeof instance.getSnapshotBeforeUpdate === "function") {
|
|
if (unresolvedOldProps !== current3.memoizedProps || oldState !== current3.memoizedState) {
|
|
workInProgress2.flags |= Snapshot;
|
|
}
|
|
}
|
|
workInProgress2.memoizedProps = newProps;
|
|
workInProgress2.memoizedState = newState;
|
|
}
|
|
instance.props = newProps;
|
|
instance.state = newState;
|
|
instance.context = nextContext;
|
|
return shouldUpdate;
|
|
}
|
|
function createCapturedValueAtFiber(value, source) {
|
|
return {
|
|
value,
|
|
source,
|
|
stack: getStackByFiberInDevAndProd(source),
|
|
digest: null
|
|
};
|
|
}
|
|
function createCapturedValue(value, digest, stack) {
|
|
return {
|
|
value,
|
|
source: null,
|
|
stack: stack != null ? stack : null,
|
|
digest: digest != null ? digest : null
|
|
};
|
|
}
|
|
function showErrorDialog(boundary, errorInfo) {
|
|
return true;
|
|
}
|
|
function logCapturedError(boundary, errorInfo) {
|
|
try {
|
|
var logError = showErrorDialog(boundary, errorInfo);
|
|
if (logError === false) {
|
|
return;
|
|
}
|
|
var error2 = errorInfo.value;
|
|
if (true) {
|
|
var source = errorInfo.source;
|
|
var stack = errorInfo.stack;
|
|
var componentStack = stack !== null ? stack : "";
|
|
if (error2 != null && error2._suppressLogging) {
|
|
if (boundary.tag === ClassComponent) {
|
|
return;
|
|
}
|
|
console["error"](error2);
|
|
}
|
|
var componentName = source ? getComponentNameFromFiber(source) : null;
|
|
var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : "The above error occurred in one of your React components:";
|
|
var errorBoundaryMessage;
|
|
if (boundary.tag === HostRoot) {
|
|
errorBoundaryMessage = "Consider adding an error boundary to your tree to customize error handling behavior.\nVisit https://reactjs.org/link/error-boundaries to learn more about error boundaries.";
|
|
} else {
|
|
var errorBoundaryName = getComponentNameFromFiber(boundary) || "Anonymous";
|
|
errorBoundaryMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + errorBoundaryName + ".");
|
|
}
|
|
var combinedMessage = componentNameMessage + "\n" + componentStack + "\n\n" + ("" + errorBoundaryMessage);
|
|
console["error"](combinedMessage);
|
|
} else {
|
|
console["error"](error2);
|
|
}
|
|
} catch (e) {
|
|
setTimeout(function() {
|
|
throw e;
|
|
});
|
|
}
|
|
}
|
|
var PossiblyWeakMap$1 = typeof WeakMap === "function" ? WeakMap : Map;
|
|
function createRootErrorUpdate(fiber, errorInfo, lane) {
|
|
var update = createUpdate(NoTimestamp, lane);
|
|
update.tag = CaptureUpdate;
|
|
update.payload = {
|
|
element: null
|
|
};
|
|
var error2 = errorInfo.value;
|
|
update.callback = function() {
|
|
onUncaughtError(error2);
|
|
logCapturedError(fiber, errorInfo);
|
|
};
|
|
return update;
|
|
}
|
|
function createClassErrorUpdate(fiber, errorInfo, lane) {
|
|
var update = createUpdate(NoTimestamp, lane);
|
|
update.tag = CaptureUpdate;
|
|
var getDerivedStateFromError = fiber.type.getDerivedStateFromError;
|
|
if (typeof getDerivedStateFromError === "function") {
|
|
var error$1 = errorInfo.value;
|
|
update.payload = function() {
|
|
return getDerivedStateFromError(error$1);
|
|
};
|
|
update.callback = function() {
|
|
{
|
|
markFailedErrorBoundaryForHotReloading(fiber);
|
|
}
|
|
logCapturedError(fiber, errorInfo);
|
|
};
|
|
}
|
|
var inst = fiber.stateNode;
|
|
if (inst !== null && typeof inst.componentDidCatch === "function") {
|
|
update.callback = function callback() {
|
|
{
|
|
markFailedErrorBoundaryForHotReloading(fiber);
|
|
}
|
|
logCapturedError(fiber, errorInfo);
|
|
if (typeof getDerivedStateFromError !== "function") {
|
|
markLegacyErrorBoundaryAsFailed(this);
|
|
}
|
|
var error$12 = errorInfo.value;
|
|
var stack = errorInfo.stack;
|
|
this.componentDidCatch(error$12, {
|
|
componentStack: stack !== null ? stack : ""
|
|
});
|
|
{
|
|
if (typeof getDerivedStateFromError !== "function") {
|
|
if (!includesSomeLane(fiber.lanes, SyncLane)) {
|
|
error("%s: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.", getComponentNameFromFiber(fiber) || "Unknown");
|
|
}
|
|
}
|
|
}
|
|
};
|
|
}
|
|
return update;
|
|
}
|
|
function attachPingListener(root2, wakeable, lanes) {
|
|
var pingCache = root2.pingCache;
|
|
var threadIDs;
|
|
if (pingCache === null) {
|
|
pingCache = root2.pingCache = new PossiblyWeakMap$1();
|
|
threadIDs = /* @__PURE__ */ new Set();
|
|
pingCache.set(wakeable, threadIDs);
|
|
} else {
|
|
threadIDs = pingCache.get(wakeable);
|
|
if (threadIDs === void 0) {
|
|
threadIDs = /* @__PURE__ */ new Set();
|
|
pingCache.set(wakeable, threadIDs);
|
|
}
|
|
}
|
|
if (!threadIDs.has(lanes)) {
|
|
threadIDs.add(lanes);
|
|
var ping = pingSuspendedRoot.bind(null, root2, wakeable, lanes);
|
|
{
|
|
if (isDevToolsPresent) {
|
|
restorePendingUpdaters(root2, lanes);
|
|
}
|
|
}
|
|
wakeable.then(ping, ping);
|
|
}
|
|
}
|
|
function attachRetryListener(suspenseBoundary, root2, wakeable, lanes) {
|
|
var wakeables = suspenseBoundary.updateQueue;
|
|
if (wakeables === null) {
|
|
var updateQueue = /* @__PURE__ */ new Set();
|
|
updateQueue.add(wakeable);
|
|
suspenseBoundary.updateQueue = updateQueue;
|
|
} else {
|
|
wakeables.add(wakeable);
|
|
}
|
|
}
|
|
function resetSuspendedComponent(sourceFiber, rootRenderLanes) {
|
|
var tag = sourceFiber.tag;
|
|
if ((sourceFiber.mode & ConcurrentMode) === NoMode && (tag === FunctionComponent || tag === ForwardRef2 || tag === SimpleMemoComponent)) {
|
|
var currentSource = sourceFiber.alternate;
|
|
if (currentSource) {
|
|
sourceFiber.updateQueue = currentSource.updateQueue;
|
|
sourceFiber.memoizedState = currentSource.memoizedState;
|
|
sourceFiber.lanes = currentSource.lanes;
|
|
} else {
|
|
sourceFiber.updateQueue = null;
|
|
sourceFiber.memoizedState = null;
|
|
}
|
|
}
|
|
}
|
|
function getNearestSuspenseBoundaryToCapture(returnFiber) {
|
|
var node = returnFiber;
|
|
do {
|
|
if (node.tag === SuspenseComponent && shouldCaptureSuspense(node)) {
|
|
return node;
|
|
}
|
|
node = node.return;
|
|
} while (node !== null);
|
|
return null;
|
|
}
|
|
function markSuspenseBoundaryShouldCapture(suspenseBoundary, returnFiber, sourceFiber, root2, rootRenderLanes) {
|
|
if ((suspenseBoundary.mode & ConcurrentMode) === NoMode) {
|
|
if (suspenseBoundary === returnFiber) {
|
|
suspenseBoundary.flags |= ShouldCapture;
|
|
} else {
|
|
suspenseBoundary.flags |= DidCapture;
|
|
sourceFiber.flags |= ForceUpdateForLegacySuspense;
|
|
sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete);
|
|
if (sourceFiber.tag === ClassComponent) {
|
|
var currentSourceFiber = sourceFiber.alternate;
|
|
if (currentSourceFiber === null) {
|
|
sourceFiber.tag = IncompleteClassComponent;
|
|
} else {
|
|
var update = createUpdate(NoTimestamp, SyncLane);
|
|
update.tag = ForceUpdate;
|
|
enqueueUpdate(sourceFiber, update, SyncLane);
|
|
}
|
|
}
|
|
sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane);
|
|
}
|
|
return suspenseBoundary;
|
|
}
|
|
suspenseBoundary.flags |= ShouldCapture;
|
|
suspenseBoundary.lanes = rootRenderLanes;
|
|
return suspenseBoundary;
|
|
}
|
|
function throwException(root2, returnFiber, sourceFiber, value, rootRenderLanes) {
|
|
sourceFiber.flags |= Incomplete;
|
|
{
|
|
if (isDevToolsPresent) {
|
|
restorePendingUpdaters(root2, rootRenderLanes);
|
|
}
|
|
}
|
|
if (value !== null && typeof value === "object" && typeof value.then === "function") {
|
|
var wakeable = value;
|
|
resetSuspendedComponent(sourceFiber);
|
|
{
|
|
if (getIsHydrating() && sourceFiber.mode & ConcurrentMode) {
|
|
markDidThrowWhileHydratingDEV();
|
|
}
|
|
}
|
|
var suspenseBoundary = getNearestSuspenseBoundaryToCapture(returnFiber);
|
|
if (suspenseBoundary !== null) {
|
|
suspenseBoundary.flags &= ~ForceClientRender;
|
|
markSuspenseBoundaryShouldCapture(suspenseBoundary, returnFiber, sourceFiber, root2, rootRenderLanes);
|
|
if (suspenseBoundary.mode & ConcurrentMode) {
|
|
attachPingListener(root2, wakeable, rootRenderLanes);
|
|
}
|
|
attachRetryListener(suspenseBoundary, root2, wakeable);
|
|
return;
|
|
} else {
|
|
if (!includesSyncLane(rootRenderLanes)) {
|
|
attachPingListener(root2, wakeable, rootRenderLanes);
|
|
renderDidSuspendDelayIfPossible();
|
|
return;
|
|
}
|
|
var uncaughtSuspenseError = new Error("A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition.");
|
|
value = uncaughtSuspenseError;
|
|
}
|
|
} else {
|
|
if (getIsHydrating() && sourceFiber.mode & ConcurrentMode) {
|
|
markDidThrowWhileHydratingDEV();
|
|
var _suspenseBoundary = getNearestSuspenseBoundaryToCapture(returnFiber);
|
|
if (_suspenseBoundary !== null) {
|
|
if ((_suspenseBoundary.flags & ShouldCapture) === NoFlags) {
|
|
_suspenseBoundary.flags |= ForceClientRender;
|
|
}
|
|
markSuspenseBoundaryShouldCapture(_suspenseBoundary, returnFiber, sourceFiber, root2, rootRenderLanes);
|
|
queueHydrationError(createCapturedValueAtFiber(value, sourceFiber));
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
value = createCapturedValueAtFiber(value, sourceFiber);
|
|
renderDidError(value);
|
|
var workInProgress2 = returnFiber;
|
|
do {
|
|
switch (workInProgress2.tag) {
|
|
case HostRoot: {
|
|
var _errorInfo = value;
|
|
workInProgress2.flags |= ShouldCapture;
|
|
var lane = pickArbitraryLane(rootRenderLanes);
|
|
workInProgress2.lanes = mergeLanes(workInProgress2.lanes, lane);
|
|
var update = createRootErrorUpdate(workInProgress2, _errorInfo, lane);
|
|
enqueueCapturedUpdate(workInProgress2, update);
|
|
return;
|
|
}
|
|
case ClassComponent:
|
|
var errorInfo = value;
|
|
var ctor = workInProgress2.type;
|
|
var instance = workInProgress2.stateNode;
|
|
if ((workInProgress2.flags & DidCapture) === NoFlags && (typeof ctor.getDerivedStateFromError === "function" || instance !== null && typeof instance.componentDidCatch === "function" && !isAlreadyFailedLegacyErrorBoundary(instance))) {
|
|
workInProgress2.flags |= ShouldCapture;
|
|
var _lane = pickArbitraryLane(rootRenderLanes);
|
|
workInProgress2.lanes = mergeLanes(workInProgress2.lanes, _lane);
|
|
var _update = createClassErrorUpdate(workInProgress2, errorInfo, _lane);
|
|
enqueueCapturedUpdate(workInProgress2, _update);
|
|
return;
|
|
}
|
|
break;
|
|
}
|
|
workInProgress2 = workInProgress2.return;
|
|
} while (workInProgress2 !== null);
|
|
}
|
|
function getSuspendedCache() {
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
var didReceiveUpdate = false;
|
|
var didWarnAboutBadClass;
|
|
var didWarnAboutModulePatternComponent;
|
|
var didWarnAboutContextTypeOnFunctionComponent;
|
|
var didWarnAboutGetDerivedStateOnFunctionComponent;
|
|
var didWarnAboutFunctionRefs;
|
|
var didWarnAboutReassigningProps;
|
|
var didWarnAboutRevealOrder;
|
|
var didWarnAboutTailOptions;
|
|
var didWarnAboutDefaultPropsOnFunctionComponent;
|
|
{
|
|
didWarnAboutBadClass = {};
|
|
didWarnAboutModulePatternComponent = {};
|
|
didWarnAboutContextTypeOnFunctionComponent = {};
|
|
didWarnAboutGetDerivedStateOnFunctionComponent = {};
|
|
didWarnAboutFunctionRefs = {};
|
|
didWarnAboutReassigningProps = false;
|
|
didWarnAboutRevealOrder = {};
|
|
didWarnAboutTailOptions = {};
|
|
didWarnAboutDefaultPropsOnFunctionComponent = {};
|
|
}
|
|
function reconcileChildren(current3, workInProgress2, nextChildren, renderLanes2) {
|
|
if (current3 === null) {
|
|
workInProgress2.child = mountChildFibers(workInProgress2, null, nextChildren, renderLanes2);
|
|
} else {
|
|
workInProgress2.child = reconcileChildFibers(workInProgress2, current3.child, nextChildren, renderLanes2);
|
|
}
|
|
}
|
|
function forceUnmountCurrentAndReconcile(current3, workInProgress2, nextChildren, renderLanes2) {
|
|
workInProgress2.child = reconcileChildFibers(workInProgress2, current3.child, null, renderLanes2);
|
|
workInProgress2.child = reconcileChildFibers(workInProgress2, null, nextChildren, renderLanes2);
|
|
}
|
|
function updateForwardRef(current3, workInProgress2, Component, nextProps, renderLanes2) {
|
|
{
|
|
if (workInProgress2.type !== workInProgress2.elementType) {
|
|
var innerPropTypes = Component.propTypes;
|
|
if (innerPropTypes) {
|
|
checkPropTypes(
|
|
innerPropTypes,
|
|
nextProps,
|
|
"prop",
|
|
getComponentNameFromType(Component)
|
|
);
|
|
}
|
|
}
|
|
}
|
|
var render4 = Component.render;
|
|
var ref = workInProgress2.ref;
|
|
var nextChildren;
|
|
var hasId;
|
|
prepareToReadContext(workInProgress2, renderLanes2);
|
|
{
|
|
markComponentRenderStarted(workInProgress2);
|
|
}
|
|
{
|
|
ReactCurrentOwner$1.current = workInProgress2;
|
|
setIsRendering(true);
|
|
nextChildren = renderWithHooks(current3, workInProgress2, render4, nextProps, ref, renderLanes2);
|
|
hasId = checkDidRenderIdHook();
|
|
if (workInProgress2.mode & StrictLegacyMode) {
|
|
setIsStrictModeForDevtools(true);
|
|
try {
|
|
nextChildren = renderWithHooks(current3, workInProgress2, render4, nextProps, ref, renderLanes2);
|
|
hasId = checkDidRenderIdHook();
|
|
} finally {
|
|
setIsStrictModeForDevtools(false);
|
|
}
|
|
}
|
|
setIsRendering(false);
|
|
}
|
|
{
|
|
markComponentRenderStopped();
|
|
}
|
|
if (current3 !== null && !didReceiveUpdate) {
|
|
bailoutHooks(current3, workInProgress2, renderLanes2);
|
|
return bailoutOnAlreadyFinishedWork(current3, workInProgress2, renderLanes2);
|
|
}
|
|
if (getIsHydrating() && hasId) {
|
|
pushMaterializedTreeId(workInProgress2);
|
|
}
|
|
workInProgress2.flags |= PerformedWork;
|
|
reconcileChildren(current3, workInProgress2, nextChildren, renderLanes2);
|
|
return workInProgress2.child;
|
|
}
|
|
function updateMemoComponent(current3, workInProgress2, Component, nextProps, renderLanes2) {
|
|
if (current3 === null) {
|
|
var type = Component.type;
|
|
if (isSimpleFunctionComponent(type) && Component.compare === null && Component.defaultProps === void 0) {
|
|
var resolvedType = type;
|
|
{
|
|
resolvedType = resolveFunctionForHotReloading(type);
|
|
}
|
|
workInProgress2.tag = SimpleMemoComponent;
|
|
workInProgress2.type = resolvedType;
|
|
{
|
|
validateFunctionComponentInDev(workInProgress2, type);
|
|
}
|
|
return updateSimpleMemoComponent(current3, workInProgress2, resolvedType, nextProps, renderLanes2);
|
|
}
|
|
{
|
|
var innerPropTypes = type.propTypes;
|
|
if (innerPropTypes) {
|
|
checkPropTypes(
|
|
innerPropTypes,
|
|
nextProps,
|
|
"prop",
|
|
getComponentNameFromType(type)
|
|
);
|
|
}
|
|
if (Component.defaultProps !== void 0) {
|
|
var componentName = getComponentNameFromType(type) || "Unknown";
|
|
if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) {
|
|
error("%s: Support for defaultProps will be removed from memo components in a future major release. Use JavaScript default parameters instead.", componentName);
|
|
didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true;
|
|
}
|
|
}
|
|
}
|
|
var child = createFiberFromTypeAndProps(Component.type, null, nextProps, workInProgress2, workInProgress2.mode, renderLanes2);
|
|
child.ref = workInProgress2.ref;
|
|
child.return = workInProgress2;
|
|
workInProgress2.child = child;
|
|
return child;
|
|
}
|
|
{
|
|
var _type = Component.type;
|
|
var _innerPropTypes = _type.propTypes;
|
|
if (_innerPropTypes) {
|
|
checkPropTypes(
|
|
_innerPropTypes,
|
|
nextProps,
|
|
"prop",
|
|
getComponentNameFromType(_type)
|
|
);
|
|
}
|
|
}
|
|
var currentChild = current3.child;
|
|
var hasScheduledUpdateOrContext = checkScheduledUpdateOrContext(current3, renderLanes2);
|
|
if (!hasScheduledUpdateOrContext) {
|
|
var prevProps = currentChild.memoizedProps;
|
|
var compare = Component.compare;
|
|
compare = compare !== null ? compare : shallowEqual;
|
|
if (compare(prevProps, nextProps) && current3.ref === workInProgress2.ref) {
|
|
return bailoutOnAlreadyFinishedWork(current3, workInProgress2, renderLanes2);
|
|
}
|
|
}
|
|
workInProgress2.flags |= PerformedWork;
|
|
var newChild = createWorkInProgress(currentChild, nextProps);
|
|
newChild.ref = workInProgress2.ref;
|
|
newChild.return = workInProgress2;
|
|
workInProgress2.child = newChild;
|
|
return newChild;
|
|
}
|
|
function updateSimpleMemoComponent(current3, workInProgress2, Component, nextProps, renderLanes2) {
|
|
{
|
|
if (workInProgress2.type !== workInProgress2.elementType) {
|
|
var outerMemoType = workInProgress2.elementType;
|
|
if (outerMemoType.$$typeof === REACT_LAZY_TYPE2) {
|
|
var lazyComponent = outerMemoType;
|
|
var payload = lazyComponent._payload;
|
|
var init = lazyComponent._init;
|
|
try {
|
|
outerMemoType = init(payload);
|
|
} catch (x) {
|
|
outerMemoType = null;
|
|
}
|
|
var outerPropTypes = outerMemoType && outerMemoType.propTypes;
|
|
if (outerPropTypes) {
|
|
checkPropTypes(
|
|
outerPropTypes,
|
|
nextProps,
|
|
"prop",
|
|
getComponentNameFromType(outerMemoType)
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (current3 !== null) {
|
|
var prevProps = current3.memoizedProps;
|
|
if (shallowEqual(prevProps, nextProps) && current3.ref === workInProgress2.ref && workInProgress2.type === current3.type) {
|
|
didReceiveUpdate = false;
|
|
workInProgress2.pendingProps = nextProps = prevProps;
|
|
if (!checkScheduledUpdateOrContext(current3, renderLanes2)) {
|
|
workInProgress2.lanes = current3.lanes;
|
|
return bailoutOnAlreadyFinishedWork(current3, workInProgress2, renderLanes2);
|
|
} else if ((current3.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
|
|
didReceiveUpdate = true;
|
|
}
|
|
}
|
|
}
|
|
return updateFunctionComponent(current3, workInProgress2, Component, nextProps, renderLanes2);
|
|
}
|
|
function updateOffscreenComponent(current3, workInProgress2, renderLanes2) {
|
|
var nextProps = workInProgress2.pendingProps;
|
|
var nextChildren = nextProps.children;
|
|
var prevState = current3 !== null ? current3.memoizedState : null;
|
|
if (nextProps.mode === "hidden" || enableLegacyHidden) {
|
|
if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
|
|
var nextState = {
|
|
baseLanes: NoLanes,
|
|
cachePool: null,
|
|
transitions: null
|
|
};
|
|
workInProgress2.memoizedState = nextState;
|
|
pushRenderLanes(workInProgress2, renderLanes2);
|
|
} else if (!includesSomeLane(renderLanes2, OffscreenLane)) {
|
|
var spawnedCachePool = null;
|
|
var nextBaseLanes;
|
|
if (prevState !== null) {
|
|
var prevBaseLanes = prevState.baseLanes;
|
|
nextBaseLanes = mergeLanes(prevBaseLanes, renderLanes2);
|
|
} else {
|
|
nextBaseLanes = renderLanes2;
|
|
}
|
|
workInProgress2.lanes = workInProgress2.childLanes = laneToLanes(OffscreenLane);
|
|
var _nextState = {
|
|
baseLanes: nextBaseLanes,
|
|
cachePool: spawnedCachePool,
|
|
transitions: null
|
|
};
|
|
workInProgress2.memoizedState = _nextState;
|
|
workInProgress2.updateQueue = null;
|
|
pushRenderLanes(workInProgress2, nextBaseLanes);
|
|
return null;
|
|
} else {
|
|
var _nextState2 = {
|
|
baseLanes: NoLanes,
|
|
cachePool: null,
|
|
transitions: null
|
|
};
|
|
workInProgress2.memoizedState = _nextState2;
|
|
var subtreeRenderLanes2 = prevState !== null ? prevState.baseLanes : renderLanes2;
|
|
pushRenderLanes(workInProgress2, subtreeRenderLanes2);
|
|
}
|
|
} else {
|
|
var _subtreeRenderLanes;
|
|
if (prevState !== null) {
|
|
_subtreeRenderLanes = mergeLanes(prevState.baseLanes, renderLanes2);
|
|
workInProgress2.memoizedState = null;
|
|
} else {
|
|
_subtreeRenderLanes = renderLanes2;
|
|
}
|
|
pushRenderLanes(workInProgress2, _subtreeRenderLanes);
|
|
}
|
|
reconcileChildren(current3, workInProgress2, nextChildren, renderLanes2);
|
|
return workInProgress2.child;
|
|
}
|
|
function updateFragment(current3, workInProgress2, renderLanes2) {
|
|
var nextChildren = workInProgress2.pendingProps;
|
|
reconcileChildren(current3, workInProgress2, nextChildren, renderLanes2);
|
|
return workInProgress2.child;
|
|
}
|
|
function updateMode(current3, workInProgress2, renderLanes2) {
|
|
var nextChildren = workInProgress2.pendingProps.children;
|
|
reconcileChildren(current3, workInProgress2, nextChildren, renderLanes2);
|
|
return workInProgress2.child;
|
|
}
|
|
function updateProfiler(current3, workInProgress2, renderLanes2) {
|
|
{
|
|
workInProgress2.flags |= Update;
|
|
{
|
|
var stateNode = workInProgress2.stateNode;
|
|
stateNode.effectDuration = 0;
|
|
stateNode.passiveEffectDuration = 0;
|
|
}
|
|
}
|
|
var nextProps = workInProgress2.pendingProps;
|
|
var nextChildren = nextProps.children;
|
|
reconcileChildren(current3, workInProgress2, nextChildren, renderLanes2);
|
|
return workInProgress2.child;
|
|
}
|
|
function markRef(current3, workInProgress2) {
|
|
var ref = workInProgress2.ref;
|
|
if (current3 === null && ref !== null || current3 !== null && current3.ref !== ref) {
|
|
workInProgress2.flags |= Ref2;
|
|
{
|
|
workInProgress2.flags |= RefStatic;
|
|
}
|
|
}
|
|
}
|
|
function updateFunctionComponent(current3, workInProgress2, Component, nextProps, renderLanes2) {
|
|
{
|
|
if (workInProgress2.type !== workInProgress2.elementType) {
|
|
var innerPropTypes = Component.propTypes;
|
|
if (innerPropTypes) {
|
|
checkPropTypes(
|
|
innerPropTypes,
|
|
nextProps,
|
|
"prop",
|
|
getComponentNameFromType(Component)
|
|
);
|
|
}
|
|
}
|
|
}
|
|
var context;
|
|
{
|
|
var unmaskedContext = getUnmaskedContext(workInProgress2, Component, true);
|
|
context = getMaskedContext(workInProgress2, unmaskedContext);
|
|
}
|
|
var nextChildren;
|
|
var hasId;
|
|
prepareToReadContext(workInProgress2, renderLanes2);
|
|
{
|
|
markComponentRenderStarted(workInProgress2);
|
|
}
|
|
{
|
|
ReactCurrentOwner$1.current = workInProgress2;
|
|
setIsRendering(true);
|
|
nextChildren = renderWithHooks(current3, workInProgress2, Component, nextProps, context, renderLanes2);
|
|
hasId = checkDidRenderIdHook();
|
|
if (workInProgress2.mode & StrictLegacyMode) {
|
|
setIsStrictModeForDevtools(true);
|
|
try {
|
|
nextChildren = renderWithHooks(current3, workInProgress2, Component, nextProps, context, renderLanes2);
|
|
hasId = checkDidRenderIdHook();
|
|
} finally {
|
|
setIsStrictModeForDevtools(false);
|
|
}
|
|
}
|
|
setIsRendering(false);
|
|
}
|
|
{
|
|
markComponentRenderStopped();
|
|
}
|
|
if (current3 !== null && !didReceiveUpdate) {
|
|
bailoutHooks(current3, workInProgress2, renderLanes2);
|
|
return bailoutOnAlreadyFinishedWork(current3, workInProgress2, renderLanes2);
|
|
}
|
|
if (getIsHydrating() && hasId) {
|
|
pushMaterializedTreeId(workInProgress2);
|
|
}
|
|
workInProgress2.flags |= PerformedWork;
|
|
reconcileChildren(current3, workInProgress2, nextChildren, renderLanes2);
|
|
return workInProgress2.child;
|
|
}
|
|
function updateClassComponent(current3, workInProgress2, Component, nextProps, renderLanes2) {
|
|
{
|
|
switch (shouldError(workInProgress2)) {
|
|
case false: {
|
|
var _instance = workInProgress2.stateNode;
|
|
var ctor = workInProgress2.type;
|
|
var tempInstance = new ctor(workInProgress2.memoizedProps, _instance.context);
|
|
var state = tempInstance.state;
|
|
_instance.updater.enqueueSetState(_instance, state, null);
|
|
break;
|
|
}
|
|
case true: {
|
|
workInProgress2.flags |= DidCapture;
|
|
workInProgress2.flags |= ShouldCapture;
|
|
var error$1 = new Error("Simulated error coming from DevTools");
|
|
var lane = pickArbitraryLane(renderLanes2);
|
|
workInProgress2.lanes = mergeLanes(workInProgress2.lanes, lane);
|
|
var update = createClassErrorUpdate(workInProgress2, createCapturedValueAtFiber(error$1, workInProgress2), lane);
|
|
enqueueCapturedUpdate(workInProgress2, update);
|
|
break;
|
|
}
|
|
}
|
|
if (workInProgress2.type !== workInProgress2.elementType) {
|
|
var innerPropTypes = Component.propTypes;
|
|
if (innerPropTypes) {
|
|
checkPropTypes(
|
|
innerPropTypes,
|
|
nextProps,
|
|
"prop",
|
|
getComponentNameFromType(Component)
|
|
);
|
|
}
|
|
}
|
|
}
|
|
var hasContext;
|
|
if (isContextProvider(Component)) {
|
|
hasContext = true;
|
|
pushContextProvider(workInProgress2);
|
|
} else {
|
|
hasContext = false;
|
|
}
|
|
prepareToReadContext(workInProgress2, renderLanes2);
|
|
var instance = workInProgress2.stateNode;
|
|
var shouldUpdate;
|
|
if (instance === null) {
|
|
resetSuspendedCurrentOnMountInLegacyMode(current3, workInProgress2);
|
|
constructClassInstance(workInProgress2, Component, nextProps);
|
|
mountClassInstance(workInProgress2, Component, nextProps, renderLanes2);
|
|
shouldUpdate = true;
|
|
} else if (current3 === null) {
|
|
shouldUpdate = resumeMountClassInstance(workInProgress2, Component, nextProps, renderLanes2);
|
|
} else {
|
|
shouldUpdate = updateClassInstance(current3, workInProgress2, Component, nextProps, renderLanes2);
|
|
}
|
|
var nextUnitOfWork = finishClassComponent(current3, workInProgress2, Component, shouldUpdate, hasContext, renderLanes2);
|
|
{
|
|
var inst = workInProgress2.stateNode;
|
|
if (shouldUpdate && inst.props !== nextProps) {
|
|
if (!didWarnAboutReassigningProps) {
|
|
error("It looks like %s is reassigning its own `this.props` while rendering. This is not supported and can lead to confusing bugs.", getComponentNameFromFiber(workInProgress2) || "a component");
|
|
}
|
|
didWarnAboutReassigningProps = true;
|
|
}
|
|
}
|
|
return nextUnitOfWork;
|
|
}
|
|
function finishClassComponent(current3, workInProgress2, Component, shouldUpdate, hasContext, renderLanes2) {
|
|
markRef(current3, workInProgress2);
|
|
var didCaptureError = (workInProgress2.flags & DidCapture) !== NoFlags;
|
|
if (!shouldUpdate && !didCaptureError) {
|
|
if (hasContext) {
|
|
invalidateContextProvider(workInProgress2, Component, false);
|
|
}
|
|
return bailoutOnAlreadyFinishedWork(current3, workInProgress2, renderLanes2);
|
|
}
|
|
var instance = workInProgress2.stateNode;
|
|
ReactCurrentOwner$1.current = workInProgress2;
|
|
var nextChildren;
|
|
if (didCaptureError && typeof Component.getDerivedStateFromError !== "function") {
|
|
nextChildren = null;
|
|
{
|
|
stopProfilerTimerIfRunning();
|
|
}
|
|
} else {
|
|
{
|
|
markComponentRenderStarted(workInProgress2);
|
|
}
|
|
{
|
|
setIsRendering(true);
|
|
nextChildren = instance.render();
|
|
if (workInProgress2.mode & StrictLegacyMode) {
|
|
setIsStrictModeForDevtools(true);
|
|
try {
|
|
instance.render();
|
|
} finally {
|
|
setIsStrictModeForDevtools(false);
|
|
}
|
|
}
|
|
setIsRendering(false);
|
|
}
|
|
{
|
|
markComponentRenderStopped();
|
|
}
|
|
}
|
|
workInProgress2.flags |= PerformedWork;
|
|
if (current3 !== null && didCaptureError) {
|
|
forceUnmountCurrentAndReconcile(current3, workInProgress2, nextChildren, renderLanes2);
|
|
} else {
|
|
reconcileChildren(current3, workInProgress2, nextChildren, renderLanes2);
|
|
}
|
|
workInProgress2.memoizedState = instance.state;
|
|
if (hasContext) {
|
|
invalidateContextProvider(workInProgress2, Component, true);
|
|
}
|
|
return workInProgress2.child;
|
|
}
|
|
function pushHostRootContext(workInProgress2) {
|
|
var root2 = workInProgress2.stateNode;
|
|
if (root2.pendingContext) {
|
|
pushTopLevelContextObject(workInProgress2, root2.pendingContext, root2.pendingContext !== root2.context);
|
|
} else if (root2.context) {
|
|
pushTopLevelContextObject(workInProgress2, root2.context, false);
|
|
}
|
|
pushHostContainer(workInProgress2, root2.containerInfo);
|
|
}
|
|
function updateHostRoot(current3, workInProgress2, renderLanes2) {
|
|
pushHostRootContext(workInProgress2);
|
|
if (current3 === null) {
|
|
throw new Error("Should have a current fiber. This is a bug in React.");
|
|
}
|
|
var nextProps = workInProgress2.pendingProps;
|
|
var prevState = workInProgress2.memoizedState;
|
|
var prevChildren = prevState.element;
|
|
cloneUpdateQueue(current3, workInProgress2);
|
|
processUpdateQueue(workInProgress2, nextProps, null, renderLanes2);
|
|
var nextState = workInProgress2.memoizedState;
|
|
var root2 = workInProgress2.stateNode;
|
|
var nextChildren = nextState.element;
|
|
if (prevState.isDehydrated) {
|
|
var overrideState = {
|
|
element: nextChildren,
|
|
isDehydrated: false,
|
|
cache: nextState.cache,
|
|
pendingSuspenseBoundaries: nextState.pendingSuspenseBoundaries,
|
|
transitions: nextState.transitions
|
|
};
|
|
var updateQueue = workInProgress2.updateQueue;
|
|
updateQueue.baseState = overrideState;
|
|
workInProgress2.memoizedState = overrideState;
|
|
if (workInProgress2.flags & ForceClientRender) {
|
|
var recoverableError = createCapturedValueAtFiber(new Error("There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering."), workInProgress2);
|
|
return mountHostRootWithoutHydrating(current3, workInProgress2, nextChildren, renderLanes2, recoverableError);
|
|
} else if (nextChildren !== prevChildren) {
|
|
var _recoverableError = createCapturedValueAtFiber(new Error("This root received an early update, before anything was able hydrate. Switched the entire root to client rendering."), workInProgress2);
|
|
return mountHostRootWithoutHydrating(current3, workInProgress2, nextChildren, renderLanes2, _recoverableError);
|
|
} else {
|
|
enterHydrationState(workInProgress2);
|
|
var child = mountChildFibers(workInProgress2, null, nextChildren, renderLanes2);
|
|
workInProgress2.child = child;
|
|
var node = child;
|
|
while (node) {
|
|
node.flags = node.flags & ~Placement | Hydrating;
|
|
node = node.sibling;
|
|
}
|
|
}
|
|
} else {
|
|
resetHydrationState();
|
|
if (nextChildren === prevChildren) {
|
|
return bailoutOnAlreadyFinishedWork(current3, workInProgress2, renderLanes2);
|
|
}
|
|
reconcileChildren(current3, workInProgress2, nextChildren, renderLanes2);
|
|
}
|
|
return workInProgress2.child;
|
|
}
|
|
function mountHostRootWithoutHydrating(current3, workInProgress2, nextChildren, renderLanes2, recoverableError) {
|
|
resetHydrationState();
|
|
queueHydrationError(recoverableError);
|
|
workInProgress2.flags |= ForceClientRender;
|
|
reconcileChildren(current3, workInProgress2, nextChildren, renderLanes2);
|
|
return workInProgress2.child;
|
|
}
|
|
function updateHostComponent(current3, workInProgress2, renderLanes2) {
|
|
pushHostContext(workInProgress2);
|
|
if (current3 === null) {
|
|
tryToClaimNextHydratableInstance(workInProgress2);
|
|
}
|
|
var type = workInProgress2.type;
|
|
var nextProps = workInProgress2.pendingProps;
|
|
var prevProps = current3 !== null ? current3.memoizedProps : null;
|
|
var nextChildren = nextProps.children;
|
|
var isDirectTextChild = shouldSetTextContent(type, nextProps);
|
|
if (isDirectTextChild) {
|
|
nextChildren = null;
|
|
} else if (prevProps !== null && shouldSetTextContent(type, prevProps)) {
|
|
workInProgress2.flags |= ContentReset;
|
|
}
|
|
markRef(current3, workInProgress2);
|
|
reconcileChildren(current3, workInProgress2, nextChildren, renderLanes2);
|
|
return workInProgress2.child;
|
|
}
|
|
function updateHostText(current3, workInProgress2) {
|
|
if (current3 === null) {
|
|
tryToClaimNextHydratableInstance(workInProgress2);
|
|
}
|
|
return null;
|
|
}
|
|
function mountLazyComponent(_current, workInProgress2, elementType, renderLanes2) {
|
|
resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress2);
|
|
var props = workInProgress2.pendingProps;
|
|
var lazyComponent = elementType;
|
|
var payload = lazyComponent._payload;
|
|
var init = lazyComponent._init;
|
|
var Component = init(payload);
|
|
workInProgress2.type = Component;
|
|
var resolvedTag = workInProgress2.tag = resolveLazyComponentTag(Component);
|
|
var resolvedProps = resolveDefaultProps(Component, props);
|
|
var child;
|
|
switch (resolvedTag) {
|
|
case FunctionComponent: {
|
|
{
|
|
validateFunctionComponentInDev(workInProgress2, Component);
|
|
workInProgress2.type = Component = resolveFunctionForHotReloading(Component);
|
|
}
|
|
child = updateFunctionComponent(null, workInProgress2, Component, resolvedProps, renderLanes2);
|
|
return child;
|
|
}
|
|
case ClassComponent: {
|
|
{
|
|
workInProgress2.type = Component = resolveClassForHotReloading(Component);
|
|
}
|
|
child = updateClassComponent(null, workInProgress2, Component, resolvedProps, renderLanes2);
|
|
return child;
|
|
}
|
|
case ForwardRef2: {
|
|
{
|
|
workInProgress2.type = Component = resolveForwardRefForHotReloading(Component);
|
|
}
|
|
child = updateForwardRef(null, workInProgress2, Component, resolvedProps, renderLanes2);
|
|
return child;
|
|
}
|
|
case MemoComponent: {
|
|
{
|
|
if (workInProgress2.type !== workInProgress2.elementType) {
|
|
var outerPropTypes = Component.propTypes;
|
|
if (outerPropTypes) {
|
|
checkPropTypes(
|
|
outerPropTypes,
|
|
resolvedProps,
|
|
"prop",
|
|
getComponentNameFromType(Component)
|
|
);
|
|
}
|
|
}
|
|
}
|
|
child = updateMemoComponent(
|
|
null,
|
|
workInProgress2,
|
|
Component,
|
|
resolveDefaultProps(Component.type, resolvedProps),
|
|
renderLanes2
|
|
);
|
|
return child;
|
|
}
|
|
}
|
|
var hint = "";
|
|
{
|
|
if (Component !== null && typeof Component === "object" && Component.$$typeof === REACT_LAZY_TYPE2) {
|
|
hint = " Did you wrap a component in React.lazy() more than once?";
|
|
}
|
|
}
|
|
throw new Error("Element type is invalid. Received a promise that resolves to: " + Component + ". " + ("Lazy element type must resolve to a class or function." + hint));
|
|
}
|
|
function mountIncompleteClassComponent(_current, workInProgress2, Component, nextProps, renderLanes2) {
|
|
resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress2);
|
|
workInProgress2.tag = ClassComponent;
|
|
var hasContext;
|
|
if (isContextProvider(Component)) {
|
|
hasContext = true;
|
|
pushContextProvider(workInProgress2);
|
|
} else {
|
|
hasContext = false;
|
|
}
|
|
prepareToReadContext(workInProgress2, renderLanes2);
|
|
constructClassInstance(workInProgress2, Component, nextProps);
|
|
mountClassInstance(workInProgress2, Component, nextProps, renderLanes2);
|
|
return finishClassComponent(null, workInProgress2, Component, true, hasContext, renderLanes2);
|
|
}
|
|
function mountIndeterminateComponent(_current, workInProgress2, Component, renderLanes2) {
|
|
resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress2);
|
|
var props = workInProgress2.pendingProps;
|
|
var context;
|
|
{
|
|
var unmaskedContext = getUnmaskedContext(workInProgress2, Component, false);
|
|
context = getMaskedContext(workInProgress2, unmaskedContext);
|
|
}
|
|
prepareToReadContext(workInProgress2, renderLanes2);
|
|
var value;
|
|
var hasId;
|
|
{
|
|
markComponentRenderStarted(workInProgress2);
|
|
}
|
|
{
|
|
if (Component.prototype && typeof Component.prototype.render === "function") {
|
|
var componentName = getComponentNameFromType(Component) || "Unknown";
|
|
if (!didWarnAboutBadClass[componentName]) {
|
|
error("The <%s /> component appears to have a render method, but doesn't extend React.Component. This is likely to cause errors. Change %s to extend React.Component instead.", componentName, componentName);
|
|
didWarnAboutBadClass[componentName] = true;
|
|
}
|
|
}
|
|
if (workInProgress2.mode & StrictLegacyMode) {
|
|
ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress2, null);
|
|
}
|
|
setIsRendering(true);
|
|
ReactCurrentOwner$1.current = workInProgress2;
|
|
value = renderWithHooks(null, workInProgress2, Component, props, context, renderLanes2);
|
|
hasId = checkDidRenderIdHook();
|
|
setIsRendering(false);
|
|
}
|
|
{
|
|
markComponentRenderStopped();
|
|
}
|
|
workInProgress2.flags |= PerformedWork;
|
|
{
|
|
if (typeof value === "object" && value !== null && typeof value.render === "function" && value.$$typeof === void 0) {
|
|
var _componentName = getComponentNameFromType(Component) || "Unknown";
|
|
if (!didWarnAboutModulePatternComponent[_componentName]) {
|
|
error("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.", _componentName, _componentName, _componentName);
|
|
didWarnAboutModulePatternComponent[_componentName] = true;
|
|
}
|
|
}
|
|
}
|
|
if (typeof value === "object" && value !== null && typeof value.render === "function" && value.$$typeof === void 0) {
|
|
{
|
|
var _componentName2 = getComponentNameFromType(Component) || "Unknown";
|
|
if (!didWarnAboutModulePatternComponent[_componentName2]) {
|
|
error("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.", _componentName2, _componentName2, _componentName2);
|
|
didWarnAboutModulePatternComponent[_componentName2] = true;
|
|
}
|
|
}
|
|
workInProgress2.tag = ClassComponent;
|
|
workInProgress2.memoizedState = null;
|
|
workInProgress2.updateQueue = null;
|
|
var hasContext = false;
|
|
if (isContextProvider(Component)) {
|
|
hasContext = true;
|
|
pushContextProvider(workInProgress2);
|
|
} else {
|
|
hasContext = false;
|
|
}
|
|
workInProgress2.memoizedState = value.state !== null && value.state !== void 0 ? value.state : null;
|
|
initializeUpdateQueue(workInProgress2);
|
|
adoptClassInstance(workInProgress2, value);
|
|
mountClassInstance(workInProgress2, Component, props, renderLanes2);
|
|
return finishClassComponent(null, workInProgress2, Component, true, hasContext, renderLanes2);
|
|
} else {
|
|
workInProgress2.tag = FunctionComponent;
|
|
{
|
|
if (workInProgress2.mode & StrictLegacyMode) {
|
|
setIsStrictModeForDevtools(true);
|
|
try {
|
|
value = renderWithHooks(null, workInProgress2, Component, props, context, renderLanes2);
|
|
hasId = checkDidRenderIdHook();
|
|
} finally {
|
|
setIsStrictModeForDevtools(false);
|
|
}
|
|
}
|
|
}
|
|
if (getIsHydrating() && hasId) {
|
|
pushMaterializedTreeId(workInProgress2);
|
|
}
|
|
reconcileChildren(null, workInProgress2, value, renderLanes2);
|
|
{
|
|
validateFunctionComponentInDev(workInProgress2, Component);
|
|
}
|
|
return workInProgress2.child;
|
|
}
|
|
}
|
|
function validateFunctionComponentInDev(workInProgress2, Component) {
|
|
{
|
|
if (Component) {
|
|
if (Component.childContextTypes) {
|
|
error("%s(...): childContextTypes cannot be defined on a function component.", Component.displayName || Component.name || "Component");
|
|
}
|
|
}
|
|
if (workInProgress2.ref !== null) {
|
|
var info = "";
|
|
var ownerName = getCurrentFiberOwnerNameInDevOrNull();
|
|
if (ownerName) {
|
|
info += "\n\nCheck the render method of `" + ownerName + "`.";
|
|
}
|
|
var warningKey = ownerName || "";
|
|
var debugSource = workInProgress2._debugSource;
|
|
if (debugSource) {
|
|
warningKey = debugSource.fileName + ":" + debugSource.lineNumber;
|
|
}
|
|
if (!didWarnAboutFunctionRefs[warningKey]) {
|
|
didWarnAboutFunctionRefs[warningKey] = true;
|
|
error("Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s", info);
|
|
}
|
|
}
|
|
if (Component.defaultProps !== void 0) {
|
|
var componentName = getComponentNameFromType(Component) || "Unknown";
|
|
if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) {
|
|
error("%s: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.", componentName);
|
|
didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true;
|
|
}
|
|
}
|
|
if (typeof Component.getDerivedStateFromProps === "function") {
|
|
var _componentName3 = getComponentNameFromType(Component) || "Unknown";
|
|
if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3]) {
|
|
error("%s: Function components do not support getDerivedStateFromProps.", _componentName3);
|
|
didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] = true;
|
|
}
|
|
}
|
|
if (typeof Component.contextType === "object" && Component.contextType !== null) {
|
|
var _componentName4 = getComponentNameFromType(Component) || "Unknown";
|
|
if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) {
|
|
error("%s: Function components do not support contextType.", _componentName4);
|
|
didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var SUSPENDED_MARKER = {
|
|
dehydrated: null,
|
|
treeContext: null,
|
|
retryLane: NoLane
|
|
};
|
|
function mountSuspenseOffscreenState(renderLanes2) {
|
|
return {
|
|
baseLanes: renderLanes2,
|
|
cachePool: getSuspendedCache(),
|
|
transitions: null
|
|
};
|
|
}
|
|
function updateSuspenseOffscreenState(prevOffscreenState, renderLanes2) {
|
|
var cachePool = null;
|
|
return {
|
|
baseLanes: mergeLanes(prevOffscreenState.baseLanes, renderLanes2),
|
|
cachePool,
|
|
transitions: prevOffscreenState.transitions
|
|
};
|
|
}
|
|
function shouldRemainOnFallback(suspenseContext, current3, workInProgress2, renderLanes2) {
|
|
if (current3 !== null) {
|
|
var suspenseState = current3.memoizedState;
|
|
if (suspenseState === null) {
|
|
return false;
|
|
}
|
|
}
|
|
return hasSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
|
}
|
|
function getRemainingWorkInPrimaryTree(current3, renderLanes2) {
|
|
return removeLanes(current3.childLanes, renderLanes2);
|
|
}
|
|
function updateSuspenseComponent(current3, workInProgress2, renderLanes2) {
|
|
var nextProps = workInProgress2.pendingProps;
|
|
{
|
|
if (shouldSuspend(workInProgress2)) {
|
|
workInProgress2.flags |= DidCapture;
|
|
}
|
|
}
|
|
var suspenseContext = suspenseStackCursor.current;
|
|
var showFallback = false;
|
|
var didSuspend = (workInProgress2.flags & DidCapture) !== NoFlags;
|
|
if (didSuspend || shouldRemainOnFallback(suspenseContext, current3)) {
|
|
showFallback = true;
|
|
workInProgress2.flags &= ~DidCapture;
|
|
} else {
|
|
if (current3 === null || current3.memoizedState !== null) {
|
|
{
|
|
suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext);
|
|
}
|
|
}
|
|
}
|
|
suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
|
|
pushSuspenseContext(workInProgress2, suspenseContext);
|
|
if (current3 === null) {
|
|
tryToClaimNextHydratableInstance(workInProgress2);
|
|
var suspenseState = workInProgress2.memoizedState;
|
|
if (suspenseState !== null) {
|
|
var dehydrated = suspenseState.dehydrated;
|
|
if (dehydrated !== null) {
|
|
return mountDehydratedSuspenseComponent(workInProgress2, dehydrated);
|
|
}
|
|
}
|
|
var nextPrimaryChildren = nextProps.children;
|
|
var nextFallbackChildren = nextProps.fallback;
|
|
if (showFallback) {
|
|
var fallbackFragment = mountSuspenseFallbackChildren(workInProgress2, nextPrimaryChildren, nextFallbackChildren, renderLanes2);
|
|
var primaryChildFragment = workInProgress2.child;
|
|
primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes2);
|
|
workInProgress2.memoizedState = SUSPENDED_MARKER;
|
|
return fallbackFragment;
|
|
} else {
|
|
return mountSuspensePrimaryChildren(workInProgress2, nextPrimaryChildren);
|
|
}
|
|
} else {
|
|
var prevState = current3.memoizedState;
|
|
if (prevState !== null) {
|
|
var _dehydrated = prevState.dehydrated;
|
|
if (_dehydrated !== null) {
|
|
return updateDehydratedSuspenseComponent(current3, workInProgress2, didSuspend, nextProps, _dehydrated, prevState, renderLanes2);
|
|
}
|
|
}
|
|
if (showFallback) {
|
|
var _nextFallbackChildren = nextProps.fallback;
|
|
var _nextPrimaryChildren = nextProps.children;
|
|
var fallbackChildFragment = updateSuspenseFallbackChildren(current3, workInProgress2, _nextPrimaryChildren, _nextFallbackChildren, renderLanes2);
|
|
var _primaryChildFragment2 = workInProgress2.child;
|
|
var prevOffscreenState = current3.child.memoizedState;
|
|
_primaryChildFragment2.memoizedState = prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes2) : updateSuspenseOffscreenState(prevOffscreenState, renderLanes2);
|
|
_primaryChildFragment2.childLanes = getRemainingWorkInPrimaryTree(current3, renderLanes2);
|
|
workInProgress2.memoizedState = SUSPENDED_MARKER;
|
|
return fallbackChildFragment;
|
|
} else {
|
|
var _nextPrimaryChildren2 = nextProps.children;
|
|
var _primaryChildFragment3 = updateSuspensePrimaryChildren(current3, workInProgress2, _nextPrimaryChildren2, renderLanes2);
|
|
workInProgress2.memoizedState = null;
|
|
return _primaryChildFragment3;
|
|
}
|
|
}
|
|
}
|
|
function mountSuspensePrimaryChildren(workInProgress2, primaryChildren, renderLanes2) {
|
|
var mode = workInProgress2.mode;
|
|
var primaryChildProps = {
|
|
mode: "visible",
|
|
children: primaryChildren
|
|
};
|
|
var primaryChildFragment = mountWorkInProgressOffscreenFiber(primaryChildProps, mode);
|
|
primaryChildFragment.return = workInProgress2;
|
|
workInProgress2.child = primaryChildFragment;
|
|
return primaryChildFragment;
|
|
}
|
|
function mountSuspenseFallbackChildren(workInProgress2, primaryChildren, fallbackChildren, renderLanes2) {
|
|
var mode = workInProgress2.mode;
|
|
var progressedPrimaryFragment = workInProgress2.child;
|
|
var primaryChildProps = {
|
|
mode: "hidden",
|
|
children: primaryChildren
|
|
};
|
|
var primaryChildFragment;
|
|
var fallbackChildFragment;
|
|
if ((mode & ConcurrentMode) === NoMode && progressedPrimaryFragment !== null) {
|
|
primaryChildFragment = progressedPrimaryFragment;
|
|
primaryChildFragment.childLanes = NoLanes;
|
|
primaryChildFragment.pendingProps = primaryChildProps;
|
|
if (workInProgress2.mode & ProfileMode) {
|
|
primaryChildFragment.actualDuration = 0;
|
|
primaryChildFragment.actualStartTime = -1;
|
|
primaryChildFragment.selfBaseDuration = 0;
|
|
primaryChildFragment.treeBaseDuration = 0;
|
|
}
|
|
fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes2, null);
|
|
} else {
|
|
primaryChildFragment = mountWorkInProgressOffscreenFiber(primaryChildProps, mode);
|
|
fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes2, null);
|
|
}
|
|
primaryChildFragment.return = workInProgress2;
|
|
fallbackChildFragment.return = workInProgress2;
|
|
primaryChildFragment.sibling = fallbackChildFragment;
|
|
workInProgress2.child = primaryChildFragment;
|
|
return fallbackChildFragment;
|
|
}
|
|
function mountWorkInProgressOffscreenFiber(offscreenProps, mode, renderLanes2) {
|
|
return createFiberFromOffscreen(offscreenProps, mode, NoLanes, null);
|
|
}
|
|
function updateWorkInProgressOffscreenFiber(current3, offscreenProps) {
|
|
return createWorkInProgress(current3, offscreenProps);
|
|
}
|
|
function updateSuspensePrimaryChildren(current3, workInProgress2, primaryChildren, renderLanes2) {
|
|
var currentPrimaryChildFragment = current3.child;
|
|
var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
|
|
var primaryChildFragment = updateWorkInProgressOffscreenFiber(currentPrimaryChildFragment, {
|
|
mode: "visible",
|
|
children: primaryChildren
|
|
});
|
|
if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
|
|
primaryChildFragment.lanes = renderLanes2;
|
|
}
|
|
primaryChildFragment.return = workInProgress2;
|
|
primaryChildFragment.sibling = null;
|
|
if (currentFallbackChildFragment !== null) {
|
|
var deletions = workInProgress2.deletions;
|
|
if (deletions === null) {
|
|
workInProgress2.deletions = [currentFallbackChildFragment];
|
|
workInProgress2.flags |= ChildDeletion;
|
|
} else {
|
|
deletions.push(currentFallbackChildFragment);
|
|
}
|
|
}
|
|
workInProgress2.child = primaryChildFragment;
|
|
return primaryChildFragment;
|
|
}
|
|
function updateSuspenseFallbackChildren(current3, workInProgress2, primaryChildren, fallbackChildren, renderLanes2) {
|
|
var mode = workInProgress2.mode;
|
|
var currentPrimaryChildFragment = current3.child;
|
|
var currentFallbackChildFragment = currentPrimaryChildFragment.sibling;
|
|
var primaryChildProps = {
|
|
mode: "hidden",
|
|
children: primaryChildren
|
|
};
|
|
var primaryChildFragment;
|
|
if ((mode & ConcurrentMode) === NoMode && workInProgress2.child !== currentPrimaryChildFragment) {
|
|
var progressedPrimaryFragment = workInProgress2.child;
|
|
primaryChildFragment = progressedPrimaryFragment;
|
|
primaryChildFragment.childLanes = NoLanes;
|
|
primaryChildFragment.pendingProps = primaryChildProps;
|
|
if (workInProgress2.mode & ProfileMode) {
|
|
primaryChildFragment.actualDuration = 0;
|
|
primaryChildFragment.actualStartTime = -1;
|
|
primaryChildFragment.selfBaseDuration = currentPrimaryChildFragment.selfBaseDuration;
|
|
primaryChildFragment.treeBaseDuration = currentPrimaryChildFragment.treeBaseDuration;
|
|
}
|
|
workInProgress2.deletions = null;
|
|
} else {
|
|
primaryChildFragment = updateWorkInProgressOffscreenFiber(currentPrimaryChildFragment, primaryChildProps);
|
|
primaryChildFragment.subtreeFlags = currentPrimaryChildFragment.subtreeFlags & StaticMask;
|
|
}
|
|
var fallbackChildFragment;
|
|
if (currentFallbackChildFragment !== null) {
|
|
fallbackChildFragment = createWorkInProgress(currentFallbackChildFragment, fallbackChildren);
|
|
} else {
|
|
fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes2, null);
|
|
fallbackChildFragment.flags |= Placement;
|
|
}
|
|
fallbackChildFragment.return = workInProgress2;
|
|
primaryChildFragment.return = workInProgress2;
|
|
primaryChildFragment.sibling = fallbackChildFragment;
|
|
workInProgress2.child = primaryChildFragment;
|
|
return fallbackChildFragment;
|
|
}
|
|
function retrySuspenseComponentWithoutHydrating(current3, workInProgress2, renderLanes2, recoverableError) {
|
|
if (recoverableError !== null) {
|
|
queueHydrationError(recoverableError);
|
|
}
|
|
reconcileChildFibers(workInProgress2, current3.child, null, renderLanes2);
|
|
var nextProps = workInProgress2.pendingProps;
|
|
var primaryChildren = nextProps.children;
|
|
var primaryChildFragment = mountSuspensePrimaryChildren(workInProgress2, primaryChildren);
|
|
primaryChildFragment.flags |= Placement;
|
|
workInProgress2.memoizedState = null;
|
|
return primaryChildFragment;
|
|
}
|
|
function mountSuspenseFallbackAfterRetryWithoutHydrating(current3, workInProgress2, primaryChildren, fallbackChildren, renderLanes2) {
|
|
var fiberMode = workInProgress2.mode;
|
|
var primaryChildProps = {
|
|
mode: "visible",
|
|
children: primaryChildren
|
|
};
|
|
var primaryChildFragment = mountWorkInProgressOffscreenFiber(primaryChildProps, fiberMode);
|
|
var fallbackChildFragment = createFiberFromFragment(fallbackChildren, fiberMode, renderLanes2, null);
|
|
fallbackChildFragment.flags |= Placement;
|
|
primaryChildFragment.return = workInProgress2;
|
|
fallbackChildFragment.return = workInProgress2;
|
|
primaryChildFragment.sibling = fallbackChildFragment;
|
|
workInProgress2.child = primaryChildFragment;
|
|
if ((workInProgress2.mode & ConcurrentMode) !== NoMode) {
|
|
reconcileChildFibers(workInProgress2, current3.child, null, renderLanes2);
|
|
}
|
|
return fallbackChildFragment;
|
|
}
|
|
function mountDehydratedSuspenseComponent(workInProgress2, suspenseInstance, renderLanes2) {
|
|
if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
|
|
{
|
|
error("Cannot hydrate Suspense in legacy mode. Switch from ReactDOM.hydrate(element, container) to ReactDOMClient.hydrateRoot(container, <App />).render(element) or remove the Suspense components from the server rendered components.");
|
|
}
|
|
workInProgress2.lanes = laneToLanes(SyncLane);
|
|
} else if (isSuspenseInstanceFallback(suspenseInstance)) {
|
|
workInProgress2.lanes = laneToLanes(DefaultHydrationLane);
|
|
} else {
|
|
workInProgress2.lanes = laneToLanes(OffscreenLane);
|
|
}
|
|
return null;
|
|
}
|
|
function updateDehydratedSuspenseComponent(current3, workInProgress2, didSuspend, nextProps, suspenseInstance, suspenseState, renderLanes2) {
|
|
if (!didSuspend) {
|
|
warnIfHydrating();
|
|
if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
|
|
return retrySuspenseComponentWithoutHydrating(
|
|
current3,
|
|
workInProgress2,
|
|
renderLanes2,
|
|
null
|
|
);
|
|
}
|
|
if (isSuspenseInstanceFallback(suspenseInstance)) {
|
|
var digest, message, stack;
|
|
{
|
|
var _getSuspenseInstanceF = getSuspenseInstanceFallbackErrorDetails(suspenseInstance);
|
|
digest = _getSuspenseInstanceF.digest;
|
|
message = _getSuspenseInstanceF.message;
|
|
stack = _getSuspenseInstanceF.stack;
|
|
}
|
|
var error2;
|
|
if (message) {
|
|
error2 = new Error(message);
|
|
} else {
|
|
error2 = new Error("The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.");
|
|
}
|
|
var capturedValue = createCapturedValue(error2, digest, stack);
|
|
return retrySuspenseComponentWithoutHydrating(current3, workInProgress2, renderLanes2, capturedValue);
|
|
}
|
|
var hasContextChanged2 = includesSomeLane(renderLanes2, current3.childLanes);
|
|
if (didReceiveUpdate || hasContextChanged2) {
|
|
var root2 = getWorkInProgressRoot();
|
|
if (root2 !== null) {
|
|
var attemptHydrationAtLane = getBumpedLaneForHydration(root2, renderLanes2);
|
|
if (attemptHydrationAtLane !== NoLane && attemptHydrationAtLane !== suspenseState.retryLane) {
|
|
suspenseState.retryLane = attemptHydrationAtLane;
|
|
var eventTime = NoTimestamp;
|
|
enqueueConcurrentRenderForLane(current3, attemptHydrationAtLane);
|
|
scheduleUpdateOnFiber(root2, current3, attemptHydrationAtLane, eventTime);
|
|
}
|
|
}
|
|
renderDidSuspendDelayIfPossible();
|
|
var _capturedValue = createCapturedValue(new Error("This Suspense boundary received an update before it finished hydrating. This caused the boundary to switch to client rendering. The usual way to fix this is to wrap the original update in startTransition."));
|
|
return retrySuspenseComponentWithoutHydrating(current3, workInProgress2, renderLanes2, _capturedValue);
|
|
} else if (isSuspenseInstancePending(suspenseInstance)) {
|
|
workInProgress2.flags |= DidCapture;
|
|
workInProgress2.child = current3.child;
|
|
var retry = retryDehydratedSuspenseBoundary.bind(null, current3);
|
|
registerSuspenseInstanceRetry(suspenseInstance, retry);
|
|
return null;
|
|
} else {
|
|
reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress2, suspenseInstance, suspenseState.treeContext);
|
|
var primaryChildren = nextProps.children;
|
|
var primaryChildFragment = mountSuspensePrimaryChildren(workInProgress2, primaryChildren);
|
|
primaryChildFragment.flags |= Hydrating;
|
|
return primaryChildFragment;
|
|
}
|
|
} else {
|
|
if (workInProgress2.flags & ForceClientRender) {
|
|
workInProgress2.flags &= ~ForceClientRender;
|
|
var _capturedValue2 = createCapturedValue(new Error("There was an error while hydrating this Suspense boundary. Switched to client rendering."));
|
|
return retrySuspenseComponentWithoutHydrating(current3, workInProgress2, renderLanes2, _capturedValue2);
|
|
} else if (workInProgress2.memoizedState !== null) {
|
|
workInProgress2.child = current3.child;
|
|
workInProgress2.flags |= DidCapture;
|
|
return null;
|
|
} else {
|
|
var nextPrimaryChildren = nextProps.children;
|
|
var nextFallbackChildren = nextProps.fallback;
|
|
var fallbackChildFragment = mountSuspenseFallbackAfterRetryWithoutHydrating(current3, workInProgress2, nextPrimaryChildren, nextFallbackChildren, renderLanes2);
|
|
var _primaryChildFragment4 = workInProgress2.child;
|
|
_primaryChildFragment4.memoizedState = mountSuspenseOffscreenState(renderLanes2);
|
|
workInProgress2.memoizedState = SUSPENDED_MARKER;
|
|
return fallbackChildFragment;
|
|
}
|
|
}
|
|
}
|
|
function scheduleSuspenseWorkOnFiber(fiber, renderLanes2, propagationRoot) {
|
|
fiber.lanes = mergeLanes(fiber.lanes, renderLanes2);
|
|
var alternate = fiber.alternate;
|
|
if (alternate !== null) {
|
|
alternate.lanes = mergeLanes(alternate.lanes, renderLanes2);
|
|
}
|
|
scheduleContextWorkOnParentPath(fiber.return, renderLanes2, propagationRoot);
|
|
}
|
|
function propagateSuspenseContextChange(workInProgress2, firstChild, renderLanes2) {
|
|
var node = firstChild;
|
|
while (node !== null) {
|
|
if (node.tag === SuspenseComponent) {
|
|
var state = node.memoizedState;
|
|
if (state !== null) {
|
|
scheduleSuspenseWorkOnFiber(node, renderLanes2, workInProgress2);
|
|
}
|
|
} else if (node.tag === SuspenseListComponent) {
|
|
scheduleSuspenseWorkOnFiber(node, renderLanes2, workInProgress2);
|
|
} else if (node.child !== null) {
|
|
node.child.return = node;
|
|
node = node.child;
|
|
continue;
|
|
}
|
|
if (node === workInProgress2) {
|
|
return;
|
|
}
|
|
while (node.sibling === null) {
|
|
if (node.return === null || node.return === workInProgress2) {
|
|
return;
|
|
}
|
|
node = node.return;
|
|
}
|
|
node.sibling.return = node.return;
|
|
node = node.sibling;
|
|
}
|
|
}
|
|
function findLastContentRow(firstChild) {
|
|
var row = firstChild;
|
|
var lastContentRow = null;
|
|
while (row !== null) {
|
|
var currentRow = row.alternate;
|
|
if (currentRow !== null && findFirstSuspended(currentRow) === null) {
|
|
lastContentRow = row;
|
|
}
|
|
row = row.sibling;
|
|
}
|
|
return lastContentRow;
|
|
}
|
|
function validateRevealOrder(revealOrder) {
|
|
{
|
|
if (revealOrder !== void 0 && revealOrder !== "forwards" && revealOrder !== "backwards" && revealOrder !== "together" && !didWarnAboutRevealOrder[revealOrder]) {
|
|
didWarnAboutRevealOrder[revealOrder] = true;
|
|
if (typeof revealOrder === "string") {
|
|
switch (revealOrder.toLowerCase()) {
|
|
case "together":
|
|
case "forwards":
|
|
case "backwards": {
|
|
error('"%s" is not a valid value for revealOrder on <SuspenseList />. Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase());
|
|
break;
|
|
}
|
|
case "forward":
|
|
case "backward": {
|
|
error('"%s" is not a valid value for revealOrder on <SuspenseList />. React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase());
|
|
break;
|
|
}
|
|
default:
|
|
error('"%s" is not a supported revealOrder on <SuspenseList />. Did you mean "together", "forwards" or "backwards"?', revealOrder);
|
|
break;
|
|
}
|
|
} else {
|
|
error('%s is not a supported value for revealOrder on <SuspenseList />. Did you mean "together", "forwards" or "backwards"?', revealOrder);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function validateTailOptions(tailMode, revealOrder) {
|
|
{
|
|
if (tailMode !== void 0 && !didWarnAboutTailOptions[tailMode]) {
|
|
if (tailMode !== "collapsed" && tailMode !== "hidden") {
|
|
didWarnAboutTailOptions[tailMode] = true;
|
|
error('"%s" is not a supported value for tail on <SuspenseList />. Did you mean "collapsed" or "hidden"?', tailMode);
|
|
} else if (revealOrder !== "forwards" && revealOrder !== "backwards") {
|
|
didWarnAboutTailOptions[tailMode] = true;
|
|
error('<SuspenseList tail="%s" /> is only valid if revealOrder is "forwards" or "backwards". Did you mean to specify revealOrder="forwards"?', tailMode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function validateSuspenseListNestedChild(childSlot, index2) {
|
|
{
|
|
var isAnArray = isArray2(childSlot);
|
|
var isIterable = !isAnArray && typeof getIteratorFn(childSlot) === "function";
|
|
if (isAnArray || isIterable) {
|
|
var type = isAnArray ? "array" : "iterable";
|
|
error("A nested %s was passed to row #%s in <SuspenseList />. Wrap it in an additional SuspenseList to configure its revealOrder: <SuspenseList revealOrder=...> ... <SuspenseList revealOrder=...>{%s}</SuspenseList> ... </SuspenseList>", type, index2, type);
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
function validateSuspenseListChildren(children, revealOrder) {
|
|
{
|
|
if ((revealOrder === "forwards" || revealOrder === "backwards") && children !== void 0 && children !== null && children !== false) {
|
|
if (isArray2(children)) {
|
|
for (var i = 0; i < children.length; i++) {
|
|
if (!validateSuspenseListNestedChild(children[i], i)) {
|
|
return;
|
|
}
|
|
}
|
|
} else {
|
|
var iteratorFn = getIteratorFn(children);
|
|
if (typeof iteratorFn === "function") {
|
|
var childrenIterator = iteratorFn.call(children);
|
|
if (childrenIterator) {
|
|
var step = childrenIterator.next();
|
|
var _i = 0;
|
|
for (; !step.done; step = childrenIterator.next()) {
|
|
if (!validateSuspenseListNestedChild(step.value, _i)) {
|
|
return;
|
|
}
|
|
_i++;
|
|
}
|
|
}
|
|
} else {
|
|
error('A single row was passed to a <SuspenseList revealOrder="%s" />. This is not useful since it needs multiple rows. Did you mean to pass multiple children or an array?', revealOrder);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function initSuspenseListRenderState(workInProgress2, isBackwards, tail, lastContentRow, tailMode) {
|
|
var renderState = workInProgress2.memoizedState;
|
|
if (renderState === null) {
|
|
workInProgress2.memoizedState = {
|
|
isBackwards,
|
|
rendering: null,
|
|
renderingStartTime: 0,
|
|
last: lastContentRow,
|
|
tail,
|
|
tailMode
|
|
};
|
|
} else {
|
|
renderState.isBackwards = isBackwards;
|
|
renderState.rendering = null;
|
|
renderState.renderingStartTime = 0;
|
|
renderState.last = lastContentRow;
|
|
renderState.tail = tail;
|
|
renderState.tailMode = tailMode;
|
|
}
|
|
}
|
|
function updateSuspenseListComponent(current3, workInProgress2, renderLanes2) {
|
|
var nextProps = workInProgress2.pendingProps;
|
|
var revealOrder = nextProps.revealOrder;
|
|
var tailMode = nextProps.tail;
|
|
var newChildren = nextProps.children;
|
|
validateRevealOrder(revealOrder);
|
|
validateTailOptions(tailMode, revealOrder);
|
|
validateSuspenseListChildren(newChildren, revealOrder);
|
|
reconcileChildren(current3, workInProgress2, newChildren, renderLanes2);
|
|
var suspenseContext = suspenseStackCursor.current;
|
|
var shouldForceFallback = hasSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
|
if (shouldForceFallback) {
|
|
suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
|
workInProgress2.flags |= DidCapture;
|
|
} else {
|
|
var didSuspendBefore = current3 !== null && (current3.flags & DidCapture) !== NoFlags;
|
|
if (didSuspendBefore) {
|
|
propagateSuspenseContextChange(workInProgress2, workInProgress2.child, renderLanes2);
|
|
}
|
|
suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
|
|
}
|
|
pushSuspenseContext(workInProgress2, suspenseContext);
|
|
if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
|
|
workInProgress2.memoizedState = null;
|
|
} else {
|
|
switch (revealOrder) {
|
|
case "forwards": {
|
|
var lastContentRow = findLastContentRow(workInProgress2.child);
|
|
var tail;
|
|
if (lastContentRow === null) {
|
|
tail = workInProgress2.child;
|
|
workInProgress2.child = null;
|
|
} else {
|
|
tail = lastContentRow.sibling;
|
|
lastContentRow.sibling = null;
|
|
}
|
|
initSuspenseListRenderState(
|
|
workInProgress2,
|
|
false,
|
|
tail,
|
|
lastContentRow,
|
|
tailMode
|
|
);
|
|
break;
|
|
}
|
|
case "backwards": {
|
|
var _tail = null;
|
|
var row = workInProgress2.child;
|
|
workInProgress2.child = null;
|
|
while (row !== null) {
|
|
var currentRow = row.alternate;
|
|
if (currentRow !== null && findFirstSuspended(currentRow) === null) {
|
|
workInProgress2.child = row;
|
|
break;
|
|
}
|
|
var nextRow = row.sibling;
|
|
row.sibling = _tail;
|
|
_tail = row;
|
|
row = nextRow;
|
|
}
|
|
initSuspenseListRenderState(
|
|
workInProgress2,
|
|
true,
|
|
_tail,
|
|
null,
|
|
tailMode
|
|
);
|
|
break;
|
|
}
|
|
case "together": {
|
|
initSuspenseListRenderState(
|
|
workInProgress2,
|
|
false,
|
|
null,
|
|
null,
|
|
void 0
|
|
);
|
|
break;
|
|
}
|
|
default: {
|
|
workInProgress2.memoizedState = null;
|
|
}
|
|
}
|
|
}
|
|
return workInProgress2.child;
|
|
}
|
|
function updatePortalComponent(current3, workInProgress2, renderLanes2) {
|
|
pushHostContainer(workInProgress2, workInProgress2.stateNode.containerInfo);
|
|
var nextChildren = workInProgress2.pendingProps;
|
|
if (current3 === null) {
|
|
workInProgress2.child = reconcileChildFibers(workInProgress2, null, nextChildren, renderLanes2);
|
|
} else {
|
|
reconcileChildren(current3, workInProgress2, nextChildren, renderLanes2);
|
|
}
|
|
return workInProgress2.child;
|
|
}
|
|
var hasWarnedAboutUsingNoValuePropOnContextProvider = false;
|
|
function updateContextProvider(current3, workInProgress2, renderLanes2) {
|
|
var providerType = workInProgress2.type;
|
|
var context = providerType._context;
|
|
var newProps = workInProgress2.pendingProps;
|
|
var oldProps = workInProgress2.memoizedProps;
|
|
var newValue = newProps.value;
|
|
{
|
|
if (!("value" in newProps)) {
|
|
if (!hasWarnedAboutUsingNoValuePropOnContextProvider) {
|
|
hasWarnedAboutUsingNoValuePropOnContextProvider = true;
|
|
error("The `value` prop is required for the `<Context.Provider>`. Did you misspell it or forget to pass it?");
|
|
}
|
|
}
|
|
var providerPropTypes = workInProgress2.type.propTypes;
|
|
if (providerPropTypes) {
|
|
checkPropTypes(providerPropTypes, newProps, "prop", "Context.Provider");
|
|
}
|
|
}
|
|
pushProvider(workInProgress2, context, newValue);
|
|
{
|
|
if (oldProps !== null) {
|
|
var oldValue = oldProps.value;
|
|
if (objectIs(oldValue, newValue)) {
|
|
if (oldProps.children === newProps.children && !hasContextChanged()) {
|
|
return bailoutOnAlreadyFinishedWork(current3, workInProgress2, renderLanes2);
|
|
}
|
|
} else {
|
|
propagateContextChange(workInProgress2, context, renderLanes2);
|
|
}
|
|
}
|
|
}
|
|
var newChildren = newProps.children;
|
|
reconcileChildren(current3, workInProgress2, newChildren, renderLanes2);
|
|
return workInProgress2.child;
|
|
}
|
|
var hasWarnedAboutUsingContextAsConsumer = false;
|
|
function updateContextConsumer(current3, workInProgress2, renderLanes2) {
|
|
var context = workInProgress2.type;
|
|
{
|
|
if (context._context === void 0) {
|
|
if (context !== context.Consumer) {
|
|
if (!hasWarnedAboutUsingContextAsConsumer) {
|
|
hasWarnedAboutUsingContextAsConsumer = true;
|
|
error("Rendering <Context> directly is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?");
|
|
}
|
|
}
|
|
} else {
|
|
context = context._context;
|
|
}
|
|
}
|
|
var newProps = workInProgress2.pendingProps;
|
|
var render4 = newProps.children;
|
|
{
|
|
if (typeof render4 !== "function") {
|
|
error("A context consumer was rendered with multiple children, or a child that isn't a function. A context consumer expects a single child that is a function. If you did pass a function, make sure there is no trailing or leading whitespace around it.");
|
|
}
|
|
}
|
|
prepareToReadContext(workInProgress2, renderLanes2);
|
|
var newValue = readContext(context);
|
|
{
|
|
markComponentRenderStarted(workInProgress2);
|
|
}
|
|
var newChildren;
|
|
{
|
|
ReactCurrentOwner$1.current = workInProgress2;
|
|
setIsRendering(true);
|
|
newChildren = render4(newValue);
|
|
setIsRendering(false);
|
|
}
|
|
{
|
|
markComponentRenderStopped();
|
|
}
|
|
workInProgress2.flags |= PerformedWork;
|
|
reconcileChildren(current3, workInProgress2, newChildren, renderLanes2);
|
|
return workInProgress2.child;
|
|
}
|
|
function markWorkInProgressReceivedUpdate() {
|
|
didReceiveUpdate = true;
|
|
}
|
|
function resetSuspendedCurrentOnMountInLegacyMode(current3, workInProgress2) {
|
|
if ((workInProgress2.mode & ConcurrentMode) === NoMode) {
|
|
if (current3 !== null) {
|
|
current3.alternate = null;
|
|
workInProgress2.alternate = null;
|
|
workInProgress2.flags |= Placement;
|
|
}
|
|
}
|
|
}
|
|
function bailoutOnAlreadyFinishedWork(current3, workInProgress2, renderLanes2) {
|
|
if (current3 !== null) {
|
|
workInProgress2.dependencies = current3.dependencies;
|
|
}
|
|
{
|
|
stopProfilerTimerIfRunning();
|
|
}
|
|
markSkippedUpdateLanes(workInProgress2.lanes);
|
|
if (!includesSomeLane(renderLanes2, workInProgress2.childLanes)) {
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
cloneChildFibers(current3, workInProgress2);
|
|
return workInProgress2.child;
|
|
}
|
|
function remountFiber(current3, oldWorkInProgress, newWorkInProgress) {
|
|
{
|
|
var returnFiber = oldWorkInProgress.return;
|
|
if (returnFiber === null) {
|
|
throw new Error("Cannot swap the root fiber.");
|
|
}
|
|
current3.alternate = null;
|
|
oldWorkInProgress.alternate = null;
|
|
newWorkInProgress.index = oldWorkInProgress.index;
|
|
newWorkInProgress.sibling = oldWorkInProgress.sibling;
|
|
newWorkInProgress.return = oldWorkInProgress.return;
|
|
newWorkInProgress.ref = oldWorkInProgress.ref;
|
|
if (oldWorkInProgress === returnFiber.child) {
|
|
returnFiber.child = newWorkInProgress;
|
|
} else {
|
|
var prevSibling = returnFiber.child;
|
|
if (prevSibling === null) {
|
|
throw new Error("Expected parent to have a child.");
|
|
}
|
|
while (prevSibling.sibling !== oldWorkInProgress) {
|
|
prevSibling = prevSibling.sibling;
|
|
if (prevSibling === null) {
|
|
throw new Error("Expected to find the previous sibling.");
|
|
}
|
|
}
|
|
prevSibling.sibling = newWorkInProgress;
|
|
}
|
|
var deletions = returnFiber.deletions;
|
|
if (deletions === null) {
|
|
returnFiber.deletions = [current3];
|
|
returnFiber.flags |= ChildDeletion;
|
|
} else {
|
|
deletions.push(current3);
|
|
}
|
|
newWorkInProgress.flags |= Placement;
|
|
return newWorkInProgress;
|
|
}
|
|
}
|
|
function checkScheduledUpdateOrContext(current3, renderLanes2) {
|
|
var updateLanes = current3.lanes;
|
|
if (includesSomeLane(updateLanes, renderLanes2)) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
function attemptEarlyBailoutIfNoScheduledUpdate(current3, workInProgress2, renderLanes2) {
|
|
switch (workInProgress2.tag) {
|
|
case HostRoot:
|
|
pushHostRootContext(workInProgress2);
|
|
var root2 = workInProgress2.stateNode;
|
|
resetHydrationState();
|
|
break;
|
|
case HostComponent:
|
|
pushHostContext(workInProgress2);
|
|
break;
|
|
case ClassComponent: {
|
|
var Component = workInProgress2.type;
|
|
if (isContextProvider(Component)) {
|
|
pushContextProvider(workInProgress2);
|
|
}
|
|
break;
|
|
}
|
|
case HostPortal:
|
|
pushHostContainer(workInProgress2, workInProgress2.stateNode.containerInfo);
|
|
break;
|
|
case ContextProvider: {
|
|
var newValue = workInProgress2.memoizedProps.value;
|
|
var context = workInProgress2.type._context;
|
|
pushProvider(workInProgress2, context, newValue);
|
|
break;
|
|
}
|
|
case Profiler:
|
|
{
|
|
var hasChildWork = includesSomeLane(renderLanes2, workInProgress2.childLanes);
|
|
if (hasChildWork) {
|
|
workInProgress2.flags |= Update;
|
|
}
|
|
{
|
|
var stateNode = workInProgress2.stateNode;
|
|
stateNode.effectDuration = 0;
|
|
stateNode.passiveEffectDuration = 0;
|
|
}
|
|
}
|
|
break;
|
|
case SuspenseComponent: {
|
|
var state = workInProgress2.memoizedState;
|
|
if (state !== null) {
|
|
if (state.dehydrated !== null) {
|
|
pushSuspenseContext(workInProgress2, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
|
|
workInProgress2.flags |= DidCapture;
|
|
return null;
|
|
}
|
|
var primaryChildFragment = workInProgress2.child;
|
|
var primaryChildLanes = primaryChildFragment.childLanes;
|
|
if (includesSomeLane(renderLanes2, primaryChildLanes)) {
|
|
return updateSuspenseComponent(current3, workInProgress2, renderLanes2);
|
|
} else {
|
|
pushSuspenseContext(workInProgress2, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
|
|
var child = bailoutOnAlreadyFinishedWork(current3, workInProgress2, renderLanes2);
|
|
if (child !== null) {
|
|
return child.sibling;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
} else {
|
|
pushSuspenseContext(workInProgress2, setDefaultShallowSuspenseContext(suspenseStackCursor.current));
|
|
}
|
|
break;
|
|
}
|
|
case SuspenseListComponent: {
|
|
var didSuspendBefore = (current3.flags & DidCapture) !== NoFlags;
|
|
var _hasChildWork = includesSomeLane(renderLanes2, workInProgress2.childLanes);
|
|
if (didSuspendBefore) {
|
|
if (_hasChildWork) {
|
|
return updateSuspenseListComponent(current3, workInProgress2, renderLanes2);
|
|
}
|
|
workInProgress2.flags |= DidCapture;
|
|
}
|
|
var renderState = workInProgress2.memoizedState;
|
|
if (renderState !== null) {
|
|
renderState.rendering = null;
|
|
renderState.tail = null;
|
|
renderState.lastEffect = null;
|
|
}
|
|
pushSuspenseContext(workInProgress2, suspenseStackCursor.current);
|
|
if (_hasChildWork) {
|
|
break;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
case OffscreenComponent:
|
|
case LegacyHiddenComponent: {
|
|
workInProgress2.lanes = NoLanes;
|
|
return updateOffscreenComponent(current3, workInProgress2, renderLanes2);
|
|
}
|
|
}
|
|
return bailoutOnAlreadyFinishedWork(current3, workInProgress2, renderLanes2);
|
|
}
|
|
function beginWork(current3, workInProgress2, renderLanes2) {
|
|
{
|
|
if (workInProgress2._debugNeedsRemount && current3 !== null) {
|
|
return remountFiber(current3, workInProgress2, createFiberFromTypeAndProps(workInProgress2.type, workInProgress2.key, workInProgress2.pendingProps, workInProgress2._debugOwner || null, workInProgress2.mode, workInProgress2.lanes));
|
|
}
|
|
}
|
|
if (current3 !== null) {
|
|
var oldProps = current3.memoizedProps;
|
|
var newProps = workInProgress2.pendingProps;
|
|
if (oldProps !== newProps || hasContextChanged() || workInProgress2.type !== current3.type) {
|
|
didReceiveUpdate = true;
|
|
} else {
|
|
var hasScheduledUpdateOrContext = checkScheduledUpdateOrContext(current3, renderLanes2);
|
|
if (!hasScheduledUpdateOrContext && (workInProgress2.flags & DidCapture) === NoFlags) {
|
|
didReceiveUpdate = false;
|
|
return attemptEarlyBailoutIfNoScheduledUpdate(current3, workInProgress2, renderLanes2);
|
|
}
|
|
if ((current3.flags & ForceUpdateForLegacySuspense) !== NoFlags) {
|
|
didReceiveUpdate = true;
|
|
} else {
|
|
didReceiveUpdate = false;
|
|
}
|
|
}
|
|
} else {
|
|
didReceiveUpdate = false;
|
|
if (getIsHydrating() && isForkedChild(workInProgress2)) {
|
|
var slotIndex = workInProgress2.index;
|
|
var numberOfForks = getForksAtLevel();
|
|
pushTreeId(workInProgress2, numberOfForks, slotIndex);
|
|
}
|
|
}
|
|
workInProgress2.lanes = NoLanes;
|
|
switch (workInProgress2.tag) {
|
|
case IndeterminateComponent: {
|
|
return mountIndeterminateComponent(current3, workInProgress2, workInProgress2.type, renderLanes2);
|
|
}
|
|
case LazyComponent: {
|
|
var elementType = workInProgress2.elementType;
|
|
return mountLazyComponent(current3, workInProgress2, elementType, renderLanes2);
|
|
}
|
|
case FunctionComponent: {
|
|
var Component = workInProgress2.type;
|
|
var unresolvedProps = workInProgress2.pendingProps;
|
|
var resolvedProps = workInProgress2.elementType === Component ? unresolvedProps : resolveDefaultProps(Component, unresolvedProps);
|
|
return updateFunctionComponent(current3, workInProgress2, Component, resolvedProps, renderLanes2);
|
|
}
|
|
case ClassComponent: {
|
|
var _Component = workInProgress2.type;
|
|
var _unresolvedProps = workInProgress2.pendingProps;
|
|
var _resolvedProps = workInProgress2.elementType === _Component ? _unresolvedProps : resolveDefaultProps(_Component, _unresolvedProps);
|
|
return updateClassComponent(current3, workInProgress2, _Component, _resolvedProps, renderLanes2);
|
|
}
|
|
case HostRoot:
|
|
return updateHostRoot(current3, workInProgress2, renderLanes2);
|
|
case HostComponent:
|
|
return updateHostComponent(current3, workInProgress2, renderLanes2);
|
|
case HostText:
|
|
return updateHostText(current3, workInProgress2);
|
|
case SuspenseComponent:
|
|
return updateSuspenseComponent(current3, workInProgress2, renderLanes2);
|
|
case HostPortal:
|
|
return updatePortalComponent(current3, workInProgress2, renderLanes2);
|
|
case ForwardRef2: {
|
|
var type = workInProgress2.type;
|
|
var _unresolvedProps2 = workInProgress2.pendingProps;
|
|
var _resolvedProps2 = workInProgress2.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2);
|
|
return updateForwardRef(current3, workInProgress2, type, _resolvedProps2, renderLanes2);
|
|
}
|
|
case Fragment7:
|
|
return updateFragment(current3, workInProgress2, renderLanes2);
|
|
case Mode:
|
|
return updateMode(current3, workInProgress2, renderLanes2);
|
|
case Profiler:
|
|
return updateProfiler(current3, workInProgress2, renderLanes2);
|
|
case ContextProvider:
|
|
return updateContextProvider(current3, workInProgress2, renderLanes2);
|
|
case ContextConsumer:
|
|
return updateContextConsumer(current3, workInProgress2, renderLanes2);
|
|
case MemoComponent: {
|
|
var _type2 = workInProgress2.type;
|
|
var _unresolvedProps3 = workInProgress2.pendingProps;
|
|
var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3);
|
|
{
|
|
if (workInProgress2.type !== workInProgress2.elementType) {
|
|
var outerPropTypes = _type2.propTypes;
|
|
if (outerPropTypes) {
|
|
checkPropTypes(
|
|
outerPropTypes,
|
|
_resolvedProps3,
|
|
"prop",
|
|
getComponentNameFromType(_type2)
|
|
);
|
|
}
|
|
}
|
|
}
|
|
_resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3);
|
|
return updateMemoComponent(current3, workInProgress2, _type2, _resolvedProps3, renderLanes2);
|
|
}
|
|
case SimpleMemoComponent: {
|
|
return updateSimpleMemoComponent(current3, workInProgress2, workInProgress2.type, workInProgress2.pendingProps, renderLanes2);
|
|
}
|
|
case IncompleteClassComponent: {
|
|
var _Component2 = workInProgress2.type;
|
|
var _unresolvedProps4 = workInProgress2.pendingProps;
|
|
var _resolvedProps4 = workInProgress2.elementType === _Component2 ? _unresolvedProps4 : resolveDefaultProps(_Component2, _unresolvedProps4);
|
|
return mountIncompleteClassComponent(current3, workInProgress2, _Component2, _resolvedProps4, renderLanes2);
|
|
}
|
|
case SuspenseListComponent: {
|
|
return updateSuspenseListComponent(current3, workInProgress2, renderLanes2);
|
|
}
|
|
case ScopeComponent: {
|
|
break;
|
|
}
|
|
case OffscreenComponent: {
|
|
return updateOffscreenComponent(current3, workInProgress2, renderLanes2);
|
|
}
|
|
}
|
|
throw new Error("Unknown unit of work tag (" + workInProgress2.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
function markUpdate(workInProgress2) {
|
|
workInProgress2.flags |= Update;
|
|
}
|
|
function markRef$1(workInProgress2) {
|
|
workInProgress2.flags |= Ref2;
|
|
{
|
|
workInProgress2.flags |= RefStatic;
|
|
}
|
|
}
|
|
var appendAllChildren;
|
|
var updateHostContainer;
|
|
var updateHostComponent$1;
|
|
var updateHostText$1;
|
|
{
|
|
appendAllChildren = function(parent, workInProgress2, needsVisibilityToggle, isHidden) {
|
|
var node = workInProgress2.child;
|
|
while (node !== null) {
|
|
if (node.tag === HostComponent || node.tag === HostText) {
|
|
appendInitialChild(parent, node.stateNode);
|
|
} else if (node.tag === HostPortal)
|
|
;
|
|
else if (node.child !== null) {
|
|
node.child.return = node;
|
|
node = node.child;
|
|
continue;
|
|
}
|
|
if (node === workInProgress2) {
|
|
return;
|
|
}
|
|
while (node.sibling === null) {
|
|
if (node.return === null || node.return === workInProgress2) {
|
|
return;
|
|
}
|
|
node = node.return;
|
|
}
|
|
node.sibling.return = node.return;
|
|
node = node.sibling;
|
|
}
|
|
};
|
|
updateHostContainer = function(current3, workInProgress2) {
|
|
};
|
|
updateHostComponent$1 = function(current3, workInProgress2, type, newProps, rootContainerInstance) {
|
|
var oldProps = current3.memoizedProps;
|
|
if (oldProps === newProps) {
|
|
return;
|
|
}
|
|
var instance = workInProgress2.stateNode;
|
|
var currentHostContext = getHostContext();
|
|
var updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext);
|
|
workInProgress2.updateQueue = updatePayload;
|
|
if (updatePayload) {
|
|
markUpdate(workInProgress2);
|
|
}
|
|
};
|
|
updateHostText$1 = function(current3, workInProgress2, oldText, newText) {
|
|
if (oldText !== newText) {
|
|
markUpdate(workInProgress2);
|
|
}
|
|
};
|
|
}
|
|
function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {
|
|
if (getIsHydrating()) {
|
|
return;
|
|
}
|
|
switch (renderState.tailMode) {
|
|
case "hidden": {
|
|
var tailNode = renderState.tail;
|
|
var lastTailNode = null;
|
|
while (tailNode !== null) {
|
|
if (tailNode.alternate !== null) {
|
|
lastTailNode = tailNode;
|
|
}
|
|
tailNode = tailNode.sibling;
|
|
}
|
|
if (lastTailNode === null) {
|
|
renderState.tail = null;
|
|
} else {
|
|
lastTailNode.sibling = null;
|
|
}
|
|
break;
|
|
}
|
|
case "collapsed": {
|
|
var _tailNode = renderState.tail;
|
|
var _lastTailNode = null;
|
|
while (_tailNode !== null) {
|
|
if (_tailNode.alternate !== null) {
|
|
_lastTailNode = _tailNode;
|
|
}
|
|
_tailNode = _tailNode.sibling;
|
|
}
|
|
if (_lastTailNode === null) {
|
|
if (!hasRenderedATailFallback && renderState.tail !== null) {
|
|
renderState.tail.sibling = null;
|
|
} else {
|
|
renderState.tail = null;
|
|
}
|
|
} else {
|
|
_lastTailNode.sibling = null;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
function bubbleProperties(completedWork) {
|
|
var didBailout = completedWork.alternate !== null && completedWork.alternate.child === completedWork.child;
|
|
var newChildLanes = NoLanes;
|
|
var subtreeFlags = NoFlags;
|
|
if (!didBailout) {
|
|
if ((completedWork.mode & ProfileMode) !== NoMode) {
|
|
var actualDuration = completedWork.actualDuration;
|
|
var treeBaseDuration = completedWork.selfBaseDuration;
|
|
var child = completedWork.child;
|
|
while (child !== null) {
|
|
newChildLanes = mergeLanes(newChildLanes, mergeLanes(child.lanes, child.childLanes));
|
|
subtreeFlags |= child.subtreeFlags;
|
|
subtreeFlags |= child.flags;
|
|
actualDuration += child.actualDuration;
|
|
treeBaseDuration += child.treeBaseDuration;
|
|
child = child.sibling;
|
|
}
|
|
completedWork.actualDuration = actualDuration;
|
|
completedWork.treeBaseDuration = treeBaseDuration;
|
|
} else {
|
|
var _child = completedWork.child;
|
|
while (_child !== null) {
|
|
newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child.lanes, _child.childLanes));
|
|
subtreeFlags |= _child.subtreeFlags;
|
|
subtreeFlags |= _child.flags;
|
|
_child.return = completedWork;
|
|
_child = _child.sibling;
|
|
}
|
|
}
|
|
completedWork.subtreeFlags |= subtreeFlags;
|
|
} else {
|
|
if ((completedWork.mode & ProfileMode) !== NoMode) {
|
|
var _treeBaseDuration = completedWork.selfBaseDuration;
|
|
var _child2 = completedWork.child;
|
|
while (_child2 !== null) {
|
|
newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child2.lanes, _child2.childLanes));
|
|
subtreeFlags |= _child2.subtreeFlags & StaticMask;
|
|
subtreeFlags |= _child2.flags & StaticMask;
|
|
_treeBaseDuration += _child2.treeBaseDuration;
|
|
_child2 = _child2.sibling;
|
|
}
|
|
completedWork.treeBaseDuration = _treeBaseDuration;
|
|
} else {
|
|
var _child3 = completedWork.child;
|
|
while (_child3 !== null) {
|
|
newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child3.lanes, _child3.childLanes));
|
|
subtreeFlags |= _child3.subtreeFlags & StaticMask;
|
|
subtreeFlags |= _child3.flags & StaticMask;
|
|
_child3.return = completedWork;
|
|
_child3 = _child3.sibling;
|
|
}
|
|
}
|
|
completedWork.subtreeFlags |= subtreeFlags;
|
|
}
|
|
completedWork.childLanes = newChildLanes;
|
|
return didBailout;
|
|
}
|
|
function completeDehydratedSuspenseBoundary(current3, workInProgress2, nextState) {
|
|
if (hasUnhydratedTailNodes() && (workInProgress2.mode & ConcurrentMode) !== NoMode && (workInProgress2.flags & DidCapture) === NoFlags) {
|
|
warnIfUnhydratedTailNodes(workInProgress2);
|
|
resetHydrationState();
|
|
workInProgress2.flags |= ForceClientRender | Incomplete | ShouldCapture;
|
|
return false;
|
|
}
|
|
var wasHydrated = popHydrationState(workInProgress2);
|
|
if (nextState !== null && nextState.dehydrated !== null) {
|
|
if (current3 === null) {
|
|
if (!wasHydrated) {
|
|
throw new Error("A dehydrated suspense component was completed without a hydrated node. This is probably a bug in React.");
|
|
}
|
|
prepareToHydrateHostSuspenseInstance(workInProgress2);
|
|
bubbleProperties(workInProgress2);
|
|
{
|
|
if ((workInProgress2.mode & ProfileMode) !== NoMode) {
|
|
var isTimedOutSuspense = nextState !== null;
|
|
if (isTimedOutSuspense) {
|
|
var primaryChildFragment = workInProgress2.child;
|
|
if (primaryChildFragment !== null) {
|
|
workInProgress2.treeBaseDuration -= primaryChildFragment.treeBaseDuration;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
} else {
|
|
resetHydrationState();
|
|
if ((workInProgress2.flags & DidCapture) === NoFlags) {
|
|
workInProgress2.memoizedState = null;
|
|
}
|
|
workInProgress2.flags |= Update;
|
|
bubbleProperties(workInProgress2);
|
|
{
|
|
if ((workInProgress2.mode & ProfileMode) !== NoMode) {
|
|
var _isTimedOutSuspense = nextState !== null;
|
|
if (_isTimedOutSuspense) {
|
|
var _primaryChildFragment = workInProgress2.child;
|
|
if (_primaryChildFragment !== null) {
|
|
workInProgress2.treeBaseDuration -= _primaryChildFragment.treeBaseDuration;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
} else {
|
|
upgradeHydrationErrorsToRecoverable();
|
|
return true;
|
|
}
|
|
}
|
|
function completeWork(current3, workInProgress2, renderLanes2) {
|
|
var newProps = workInProgress2.pendingProps;
|
|
popTreeContext(workInProgress2);
|
|
switch (workInProgress2.tag) {
|
|
case IndeterminateComponent:
|
|
case LazyComponent:
|
|
case SimpleMemoComponent:
|
|
case FunctionComponent:
|
|
case ForwardRef2:
|
|
case Fragment7:
|
|
case Mode:
|
|
case Profiler:
|
|
case ContextConsumer:
|
|
case MemoComponent:
|
|
bubbleProperties(workInProgress2);
|
|
return null;
|
|
case ClassComponent: {
|
|
var Component = workInProgress2.type;
|
|
if (isContextProvider(Component)) {
|
|
popContext(workInProgress2);
|
|
}
|
|
bubbleProperties(workInProgress2);
|
|
return null;
|
|
}
|
|
case HostRoot: {
|
|
var fiberRoot = workInProgress2.stateNode;
|
|
popHostContainer(workInProgress2);
|
|
popTopLevelContextObject(workInProgress2);
|
|
resetWorkInProgressVersions();
|
|
if (fiberRoot.pendingContext) {
|
|
fiberRoot.context = fiberRoot.pendingContext;
|
|
fiberRoot.pendingContext = null;
|
|
}
|
|
if (current3 === null || current3.child === null) {
|
|
var wasHydrated = popHydrationState(workInProgress2);
|
|
if (wasHydrated) {
|
|
markUpdate(workInProgress2);
|
|
} else {
|
|
if (current3 !== null) {
|
|
var prevState = current3.memoizedState;
|
|
if (!prevState.isDehydrated || (workInProgress2.flags & ForceClientRender) !== NoFlags) {
|
|
workInProgress2.flags |= Snapshot;
|
|
upgradeHydrationErrorsToRecoverable();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
updateHostContainer(current3, workInProgress2);
|
|
bubbleProperties(workInProgress2);
|
|
return null;
|
|
}
|
|
case HostComponent: {
|
|
popHostContext(workInProgress2);
|
|
var rootContainerInstance = getRootHostContainer();
|
|
var type = workInProgress2.type;
|
|
if (current3 !== null && workInProgress2.stateNode != null) {
|
|
updateHostComponent$1(current3, workInProgress2, type, newProps, rootContainerInstance);
|
|
if (current3.ref !== workInProgress2.ref) {
|
|
markRef$1(workInProgress2);
|
|
}
|
|
} else {
|
|
if (!newProps) {
|
|
if (workInProgress2.stateNode === null) {
|
|
throw new Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
bubbleProperties(workInProgress2);
|
|
return null;
|
|
}
|
|
var currentHostContext = getHostContext();
|
|
var _wasHydrated = popHydrationState(workInProgress2);
|
|
if (_wasHydrated) {
|
|
if (prepareToHydrateHostInstance(workInProgress2, rootContainerInstance, currentHostContext)) {
|
|
markUpdate(workInProgress2);
|
|
}
|
|
} else {
|
|
var instance = createInstance2(type, newProps, rootContainerInstance, currentHostContext, workInProgress2);
|
|
appendAllChildren(instance, workInProgress2, false, false);
|
|
workInProgress2.stateNode = instance;
|
|
if (finalizeInitialChildren(instance, type, newProps, rootContainerInstance)) {
|
|
markUpdate(workInProgress2);
|
|
}
|
|
}
|
|
if (workInProgress2.ref !== null) {
|
|
markRef$1(workInProgress2);
|
|
}
|
|
}
|
|
bubbleProperties(workInProgress2);
|
|
return null;
|
|
}
|
|
case HostText: {
|
|
var newText = newProps;
|
|
if (current3 && workInProgress2.stateNode != null) {
|
|
var oldText = current3.memoizedProps;
|
|
updateHostText$1(current3, workInProgress2, oldText, newText);
|
|
} else {
|
|
if (typeof newText !== "string") {
|
|
if (workInProgress2.stateNode === null) {
|
|
throw new Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
var _rootContainerInstance = getRootHostContainer();
|
|
var _currentHostContext = getHostContext();
|
|
var _wasHydrated2 = popHydrationState(workInProgress2);
|
|
if (_wasHydrated2) {
|
|
if (prepareToHydrateHostTextInstance(workInProgress2)) {
|
|
markUpdate(workInProgress2);
|
|
}
|
|
} else {
|
|
workInProgress2.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress2);
|
|
}
|
|
}
|
|
bubbleProperties(workInProgress2);
|
|
return null;
|
|
}
|
|
case SuspenseComponent: {
|
|
popSuspenseContext(workInProgress2);
|
|
var nextState = workInProgress2.memoizedState;
|
|
if (current3 === null || current3.memoizedState !== null && current3.memoizedState.dehydrated !== null) {
|
|
var fallthroughToNormalSuspensePath = completeDehydratedSuspenseBoundary(current3, workInProgress2, nextState);
|
|
if (!fallthroughToNormalSuspensePath) {
|
|
if (workInProgress2.flags & ShouldCapture) {
|
|
return workInProgress2;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
if ((workInProgress2.flags & DidCapture) !== NoFlags) {
|
|
workInProgress2.lanes = renderLanes2;
|
|
if ((workInProgress2.mode & ProfileMode) !== NoMode) {
|
|
transferActualDuration(workInProgress2);
|
|
}
|
|
return workInProgress2;
|
|
}
|
|
var nextDidTimeout = nextState !== null;
|
|
var prevDidTimeout = current3 !== null && current3.memoizedState !== null;
|
|
if (nextDidTimeout !== prevDidTimeout) {
|
|
if (nextDidTimeout) {
|
|
var _offscreenFiber2 = workInProgress2.child;
|
|
_offscreenFiber2.flags |= Visibility;
|
|
if ((workInProgress2.mode & ConcurrentMode) !== NoMode) {
|
|
var hasInvisibleChildContext = current3 === null && (workInProgress2.memoizedProps.unstable_avoidThisFallback !== true || !enableSuspenseAvoidThisFallback);
|
|
if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) {
|
|
renderDidSuspend();
|
|
} else {
|
|
renderDidSuspendDelayIfPossible();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var wakeables = workInProgress2.updateQueue;
|
|
if (wakeables !== null) {
|
|
workInProgress2.flags |= Update;
|
|
}
|
|
bubbleProperties(workInProgress2);
|
|
{
|
|
if ((workInProgress2.mode & ProfileMode) !== NoMode) {
|
|
if (nextDidTimeout) {
|
|
var primaryChildFragment = workInProgress2.child;
|
|
if (primaryChildFragment !== null) {
|
|
workInProgress2.treeBaseDuration -= primaryChildFragment.treeBaseDuration;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
case HostPortal:
|
|
popHostContainer(workInProgress2);
|
|
updateHostContainer(current3, workInProgress2);
|
|
if (current3 === null) {
|
|
preparePortalMount(workInProgress2.stateNode.containerInfo);
|
|
}
|
|
bubbleProperties(workInProgress2);
|
|
return null;
|
|
case ContextProvider:
|
|
var context = workInProgress2.type._context;
|
|
popProvider(context, workInProgress2);
|
|
bubbleProperties(workInProgress2);
|
|
return null;
|
|
case IncompleteClassComponent: {
|
|
var _Component = workInProgress2.type;
|
|
if (isContextProvider(_Component)) {
|
|
popContext(workInProgress2);
|
|
}
|
|
bubbleProperties(workInProgress2);
|
|
return null;
|
|
}
|
|
case SuspenseListComponent: {
|
|
popSuspenseContext(workInProgress2);
|
|
var renderState = workInProgress2.memoizedState;
|
|
if (renderState === null) {
|
|
bubbleProperties(workInProgress2);
|
|
return null;
|
|
}
|
|
var didSuspendAlready = (workInProgress2.flags & DidCapture) !== NoFlags;
|
|
var renderedTail = renderState.rendering;
|
|
if (renderedTail === null) {
|
|
if (!didSuspendAlready) {
|
|
var cannotBeSuspended = renderHasNotSuspendedYet() && (current3 === null || (current3.flags & DidCapture) === NoFlags);
|
|
if (!cannotBeSuspended) {
|
|
var row = workInProgress2.child;
|
|
while (row !== null) {
|
|
var suspended = findFirstSuspended(row);
|
|
if (suspended !== null) {
|
|
didSuspendAlready = true;
|
|
workInProgress2.flags |= DidCapture;
|
|
cutOffTailIfNeeded(renderState, false);
|
|
var newThenables = suspended.updateQueue;
|
|
if (newThenables !== null) {
|
|
workInProgress2.updateQueue = newThenables;
|
|
workInProgress2.flags |= Update;
|
|
}
|
|
workInProgress2.subtreeFlags = NoFlags;
|
|
resetChildFibers(workInProgress2, renderLanes2);
|
|
pushSuspenseContext(workInProgress2, setShallowSuspenseContext(suspenseStackCursor.current, ForceSuspenseFallback));
|
|
return workInProgress2.child;
|
|
}
|
|
row = row.sibling;
|
|
}
|
|
}
|
|
if (renderState.tail !== null && now() > getRenderTargetTime()) {
|
|
workInProgress2.flags |= DidCapture;
|
|
didSuspendAlready = true;
|
|
cutOffTailIfNeeded(renderState, false);
|
|
workInProgress2.lanes = SomeRetryLane;
|
|
}
|
|
} else {
|
|
cutOffTailIfNeeded(renderState, false);
|
|
}
|
|
} else {
|
|
if (!didSuspendAlready) {
|
|
var _suspended = findFirstSuspended(renderedTail);
|
|
if (_suspended !== null) {
|
|
workInProgress2.flags |= DidCapture;
|
|
didSuspendAlready = true;
|
|
var _newThenables = _suspended.updateQueue;
|
|
if (_newThenables !== null) {
|
|
workInProgress2.updateQueue = _newThenables;
|
|
workInProgress2.flags |= Update;
|
|
}
|
|
cutOffTailIfNeeded(renderState, true);
|
|
if (renderState.tail === null && renderState.tailMode === "hidden" && !renderedTail.alternate && !getIsHydrating()) {
|
|
bubbleProperties(workInProgress2);
|
|
return null;
|
|
}
|
|
} else if (now() * 2 - renderState.renderingStartTime > getRenderTargetTime() && renderLanes2 !== OffscreenLane) {
|
|
workInProgress2.flags |= DidCapture;
|
|
didSuspendAlready = true;
|
|
cutOffTailIfNeeded(renderState, false);
|
|
workInProgress2.lanes = SomeRetryLane;
|
|
}
|
|
}
|
|
if (renderState.isBackwards) {
|
|
renderedTail.sibling = workInProgress2.child;
|
|
workInProgress2.child = renderedTail;
|
|
} else {
|
|
var previousSibling = renderState.last;
|
|
if (previousSibling !== null) {
|
|
previousSibling.sibling = renderedTail;
|
|
} else {
|
|
workInProgress2.child = renderedTail;
|
|
}
|
|
renderState.last = renderedTail;
|
|
}
|
|
}
|
|
if (renderState.tail !== null) {
|
|
var next = renderState.tail;
|
|
renderState.rendering = next;
|
|
renderState.tail = next.sibling;
|
|
renderState.renderingStartTime = now();
|
|
next.sibling = null;
|
|
var suspenseContext = suspenseStackCursor.current;
|
|
if (didSuspendAlready) {
|
|
suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback);
|
|
} else {
|
|
suspenseContext = setDefaultShallowSuspenseContext(suspenseContext);
|
|
}
|
|
pushSuspenseContext(workInProgress2, suspenseContext);
|
|
return next;
|
|
}
|
|
bubbleProperties(workInProgress2);
|
|
return null;
|
|
}
|
|
case ScopeComponent: {
|
|
break;
|
|
}
|
|
case OffscreenComponent:
|
|
case LegacyHiddenComponent: {
|
|
popRenderLanes(workInProgress2);
|
|
var _nextState = workInProgress2.memoizedState;
|
|
var nextIsHidden = _nextState !== null;
|
|
if (current3 !== null) {
|
|
var _prevState = current3.memoizedState;
|
|
var prevIsHidden = _prevState !== null;
|
|
if (prevIsHidden !== nextIsHidden && !enableLegacyHidden) {
|
|
workInProgress2.flags |= Visibility;
|
|
}
|
|
}
|
|
if (!nextIsHidden || (workInProgress2.mode & ConcurrentMode) === NoMode) {
|
|
bubbleProperties(workInProgress2);
|
|
} else {
|
|
if (includesSomeLane(subtreeRenderLanes, OffscreenLane)) {
|
|
bubbleProperties(workInProgress2);
|
|
{
|
|
if (workInProgress2.subtreeFlags & (Placement | Update)) {
|
|
workInProgress2.flags |= Visibility;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
case CacheComponent: {
|
|
return null;
|
|
}
|
|
case TracingMarkerComponent: {
|
|
return null;
|
|
}
|
|
}
|
|
throw new Error("Unknown unit of work tag (" + workInProgress2.tag + "). This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
function unwindWork(current3, workInProgress2, renderLanes2) {
|
|
popTreeContext(workInProgress2);
|
|
switch (workInProgress2.tag) {
|
|
case ClassComponent: {
|
|
var Component = workInProgress2.type;
|
|
if (isContextProvider(Component)) {
|
|
popContext(workInProgress2);
|
|
}
|
|
var flags = workInProgress2.flags;
|
|
if (flags & ShouldCapture) {
|
|
workInProgress2.flags = flags & ~ShouldCapture | DidCapture;
|
|
if ((workInProgress2.mode & ProfileMode) !== NoMode) {
|
|
transferActualDuration(workInProgress2);
|
|
}
|
|
return workInProgress2;
|
|
}
|
|
return null;
|
|
}
|
|
case HostRoot: {
|
|
var root2 = workInProgress2.stateNode;
|
|
popHostContainer(workInProgress2);
|
|
popTopLevelContextObject(workInProgress2);
|
|
resetWorkInProgressVersions();
|
|
var _flags = workInProgress2.flags;
|
|
if ((_flags & ShouldCapture) !== NoFlags && (_flags & DidCapture) === NoFlags) {
|
|
workInProgress2.flags = _flags & ~ShouldCapture | DidCapture;
|
|
return workInProgress2;
|
|
}
|
|
return null;
|
|
}
|
|
case HostComponent: {
|
|
popHostContext(workInProgress2);
|
|
return null;
|
|
}
|
|
case SuspenseComponent: {
|
|
popSuspenseContext(workInProgress2);
|
|
var suspenseState = workInProgress2.memoizedState;
|
|
if (suspenseState !== null && suspenseState.dehydrated !== null) {
|
|
if (workInProgress2.alternate === null) {
|
|
throw new Error("Threw in newly mounted dehydrated component. This is likely a bug in React. Please file an issue.");
|
|
}
|
|
resetHydrationState();
|
|
}
|
|
var _flags2 = workInProgress2.flags;
|
|
if (_flags2 & ShouldCapture) {
|
|
workInProgress2.flags = _flags2 & ~ShouldCapture | DidCapture;
|
|
if ((workInProgress2.mode & ProfileMode) !== NoMode) {
|
|
transferActualDuration(workInProgress2);
|
|
}
|
|
return workInProgress2;
|
|
}
|
|
return null;
|
|
}
|
|
case SuspenseListComponent: {
|
|
popSuspenseContext(workInProgress2);
|
|
return null;
|
|
}
|
|
case HostPortal:
|
|
popHostContainer(workInProgress2);
|
|
return null;
|
|
case ContextProvider:
|
|
var context = workInProgress2.type._context;
|
|
popProvider(context, workInProgress2);
|
|
return null;
|
|
case OffscreenComponent:
|
|
case LegacyHiddenComponent:
|
|
popRenderLanes(workInProgress2);
|
|
return null;
|
|
case CacheComponent:
|
|
return null;
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
function unwindInterruptedWork(current3, interruptedWork, renderLanes2) {
|
|
popTreeContext(interruptedWork);
|
|
switch (interruptedWork.tag) {
|
|
case ClassComponent: {
|
|
var childContextTypes = interruptedWork.type.childContextTypes;
|
|
if (childContextTypes !== null && childContextTypes !== void 0) {
|
|
popContext(interruptedWork);
|
|
}
|
|
break;
|
|
}
|
|
case HostRoot: {
|
|
var root2 = interruptedWork.stateNode;
|
|
popHostContainer(interruptedWork);
|
|
popTopLevelContextObject(interruptedWork);
|
|
resetWorkInProgressVersions();
|
|
break;
|
|
}
|
|
case HostComponent: {
|
|
popHostContext(interruptedWork);
|
|
break;
|
|
}
|
|
case HostPortal:
|
|
popHostContainer(interruptedWork);
|
|
break;
|
|
case SuspenseComponent:
|
|
popSuspenseContext(interruptedWork);
|
|
break;
|
|
case SuspenseListComponent:
|
|
popSuspenseContext(interruptedWork);
|
|
break;
|
|
case ContextProvider:
|
|
var context = interruptedWork.type._context;
|
|
popProvider(context, interruptedWork);
|
|
break;
|
|
case OffscreenComponent:
|
|
case LegacyHiddenComponent:
|
|
popRenderLanes(interruptedWork);
|
|
break;
|
|
}
|
|
}
|
|
var didWarnAboutUndefinedSnapshotBeforeUpdate = null;
|
|
{
|
|
didWarnAboutUndefinedSnapshotBeforeUpdate = /* @__PURE__ */ new Set();
|
|
}
|
|
var offscreenSubtreeIsHidden = false;
|
|
var offscreenSubtreeWasHidden = false;
|
|
var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set;
|
|
var nextEffect = null;
|
|
var inProgressLanes = null;
|
|
var inProgressRoot = null;
|
|
function reportUncaughtErrorInDEV(error2) {
|
|
{
|
|
invokeGuardedCallback(null, function() {
|
|
throw error2;
|
|
});
|
|
clearCaughtError();
|
|
}
|
|
}
|
|
var callComponentWillUnmountWithTimer = function(current3, instance) {
|
|
instance.props = current3.memoizedProps;
|
|
instance.state = current3.memoizedState;
|
|
if (current3.mode & ProfileMode) {
|
|
try {
|
|
startLayoutEffectTimer();
|
|
instance.componentWillUnmount();
|
|
} finally {
|
|
recordLayoutEffectDuration(current3);
|
|
}
|
|
} else {
|
|
instance.componentWillUnmount();
|
|
}
|
|
};
|
|
function safelyCallCommitHookLayoutEffectListMount(current3, nearestMountedAncestor) {
|
|
try {
|
|
commitHookEffectListMount(Layout, current3);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(current3, nearestMountedAncestor, error2);
|
|
}
|
|
}
|
|
function safelyCallComponentWillUnmount(current3, nearestMountedAncestor, instance) {
|
|
try {
|
|
callComponentWillUnmountWithTimer(current3, instance);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(current3, nearestMountedAncestor, error2);
|
|
}
|
|
}
|
|
function safelyCallComponentDidMount(current3, nearestMountedAncestor, instance) {
|
|
try {
|
|
instance.componentDidMount();
|
|
} catch (error2) {
|
|
captureCommitPhaseError(current3, nearestMountedAncestor, error2);
|
|
}
|
|
}
|
|
function safelyAttachRef(current3, nearestMountedAncestor) {
|
|
try {
|
|
commitAttachRef(current3);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(current3, nearestMountedAncestor, error2);
|
|
}
|
|
}
|
|
function safelyDetachRef(current3, nearestMountedAncestor) {
|
|
var ref = current3.ref;
|
|
if (ref !== null) {
|
|
if (typeof ref === "function") {
|
|
var retVal;
|
|
try {
|
|
if (enableProfilerTimer && enableProfilerCommitHooks && current3.mode & ProfileMode) {
|
|
try {
|
|
startLayoutEffectTimer();
|
|
retVal = ref(null);
|
|
} finally {
|
|
recordLayoutEffectDuration(current3);
|
|
}
|
|
} else {
|
|
retVal = ref(null);
|
|
}
|
|
} catch (error2) {
|
|
captureCommitPhaseError(current3, nearestMountedAncestor, error2);
|
|
}
|
|
{
|
|
if (typeof retVal === "function") {
|
|
error("Unexpected return value from a callback ref in %s. A callback ref should not return a function.", getComponentNameFromFiber(current3));
|
|
}
|
|
}
|
|
} else {
|
|
ref.current = null;
|
|
}
|
|
}
|
|
}
|
|
function safelyCallDestroy(current3, nearestMountedAncestor, destroy) {
|
|
try {
|
|
destroy();
|
|
} catch (error2) {
|
|
captureCommitPhaseError(current3, nearestMountedAncestor, error2);
|
|
}
|
|
}
|
|
var focusedInstanceHandle = null;
|
|
var shouldFireAfterActiveInstanceBlur = false;
|
|
function commitBeforeMutationEffects(root2, firstChild) {
|
|
focusedInstanceHandle = prepareForCommit(root2.containerInfo);
|
|
nextEffect = firstChild;
|
|
commitBeforeMutationEffects_begin();
|
|
var shouldFire = shouldFireAfterActiveInstanceBlur;
|
|
shouldFireAfterActiveInstanceBlur = false;
|
|
focusedInstanceHandle = null;
|
|
return shouldFire;
|
|
}
|
|
function commitBeforeMutationEffects_begin() {
|
|
while (nextEffect !== null) {
|
|
var fiber = nextEffect;
|
|
var child = fiber.child;
|
|
if ((fiber.subtreeFlags & BeforeMutationMask) !== NoFlags && child !== null) {
|
|
child.return = fiber;
|
|
nextEffect = child;
|
|
} else {
|
|
commitBeforeMutationEffects_complete();
|
|
}
|
|
}
|
|
}
|
|
function commitBeforeMutationEffects_complete() {
|
|
while (nextEffect !== null) {
|
|
var fiber = nextEffect;
|
|
setCurrentFiber(fiber);
|
|
try {
|
|
commitBeforeMutationEffectsOnFiber(fiber);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(fiber, fiber.return, error2);
|
|
}
|
|
resetCurrentFiber();
|
|
var sibling = fiber.sibling;
|
|
if (sibling !== null) {
|
|
sibling.return = fiber.return;
|
|
nextEffect = sibling;
|
|
return;
|
|
}
|
|
nextEffect = fiber.return;
|
|
}
|
|
}
|
|
function commitBeforeMutationEffectsOnFiber(finishedWork) {
|
|
var current3 = finishedWork.alternate;
|
|
var flags = finishedWork.flags;
|
|
if ((flags & Snapshot) !== NoFlags) {
|
|
setCurrentFiber(finishedWork);
|
|
switch (finishedWork.tag) {
|
|
case FunctionComponent:
|
|
case ForwardRef2:
|
|
case SimpleMemoComponent: {
|
|
break;
|
|
}
|
|
case ClassComponent: {
|
|
if (current3 !== null) {
|
|
var prevProps = current3.memoizedProps;
|
|
var prevState = current3.memoizedState;
|
|
var instance = finishedWork.stateNode;
|
|
{
|
|
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
|
if (instance.props !== finishedWork.memoizedProps) {
|
|
error("Expected %s props to match memoized props before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
|
|
}
|
|
if (instance.state !== finishedWork.memoizedState) {
|
|
error("Expected %s state to match memoized state before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
|
|
}
|
|
}
|
|
}
|
|
var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState);
|
|
{
|
|
var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate;
|
|
if (snapshot === void 0 && !didWarnSet.has(finishedWork.type)) {
|
|
didWarnSet.add(finishedWork.type);
|
|
error("%s.getSnapshotBeforeUpdate(): A snapshot value (or null) must be returned. You have returned undefined.", getComponentNameFromFiber(finishedWork));
|
|
}
|
|
}
|
|
instance.__reactInternalSnapshotBeforeUpdate = snapshot;
|
|
}
|
|
break;
|
|
}
|
|
case HostRoot: {
|
|
{
|
|
var root2 = finishedWork.stateNode;
|
|
clearContainer(root2.containerInfo);
|
|
}
|
|
break;
|
|
}
|
|
case HostComponent:
|
|
case HostText:
|
|
case HostPortal:
|
|
case IncompleteClassComponent:
|
|
break;
|
|
default: {
|
|
throw new Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
resetCurrentFiber();
|
|
}
|
|
}
|
|
function commitHookEffectListUnmount(flags, finishedWork, nearestMountedAncestor) {
|
|
var updateQueue = finishedWork.updateQueue;
|
|
var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
|
|
if (lastEffect !== null) {
|
|
var firstEffect = lastEffect.next;
|
|
var effect = firstEffect;
|
|
do {
|
|
if ((effect.tag & flags) === flags) {
|
|
var destroy = effect.destroy;
|
|
effect.destroy = void 0;
|
|
if (destroy !== void 0) {
|
|
{
|
|
if ((flags & Passive$1) !== NoFlags$1) {
|
|
markComponentPassiveEffectUnmountStarted(finishedWork);
|
|
} else if ((flags & Layout) !== NoFlags$1) {
|
|
markComponentLayoutEffectUnmountStarted(finishedWork);
|
|
}
|
|
}
|
|
{
|
|
if ((flags & Insertion) !== NoFlags$1) {
|
|
setIsRunningInsertionEffect(true);
|
|
}
|
|
}
|
|
safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy);
|
|
{
|
|
if ((flags & Insertion) !== NoFlags$1) {
|
|
setIsRunningInsertionEffect(false);
|
|
}
|
|
}
|
|
{
|
|
if ((flags & Passive$1) !== NoFlags$1) {
|
|
markComponentPassiveEffectUnmountStopped();
|
|
} else if ((flags & Layout) !== NoFlags$1) {
|
|
markComponentLayoutEffectUnmountStopped();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
effect = effect.next;
|
|
} while (effect !== firstEffect);
|
|
}
|
|
}
|
|
function commitHookEffectListMount(flags, finishedWork) {
|
|
var updateQueue = finishedWork.updateQueue;
|
|
var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null;
|
|
if (lastEffect !== null) {
|
|
var firstEffect = lastEffect.next;
|
|
var effect = firstEffect;
|
|
do {
|
|
if ((effect.tag & flags) === flags) {
|
|
{
|
|
if ((flags & Passive$1) !== NoFlags$1) {
|
|
markComponentPassiveEffectMountStarted(finishedWork);
|
|
} else if ((flags & Layout) !== NoFlags$1) {
|
|
markComponentLayoutEffectMountStarted(finishedWork);
|
|
}
|
|
}
|
|
var create = effect.create;
|
|
{
|
|
if ((flags & Insertion) !== NoFlags$1) {
|
|
setIsRunningInsertionEffect(true);
|
|
}
|
|
}
|
|
effect.destroy = create();
|
|
{
|
|
if ((flags & Insertion) !== NoFlags$1) {
|
|
setIsRunningInsertionEffect(false);
|
|
}
|
|
}
|
|
{
|
|
if ((flags & Passive$1) !== NoFlags$1) {
|
|
markComponentPassiveEffectMountStopped();
|
|
} else if ((flags & Layout) !== NoFlags$1) {
|
|
markComponentLayoutEffectMountStopped();
|
|
}
|
|
}
|
|
{
|
|
var destroy = effect.destroy;
|
|
if (destroy !== void 0 && typeof destroy !== "function") {
|
|
var hookName = void 0;
|
|
if ((effect.tag & Layout) !== NoFlags) {
|
|
hookName = "useLayoutEffect";
|
|
} else if ((effect.tag & Insertion) !== NoFlags) {
|
|
hookName = "useInsertionEffect";
|
|
} else {
|
|
hookName = "useEffect";
|
|
}
|
|
var addendum = void 0;
|
|
if (destroy === null) {
|
|
addendum = " You returned null. If your effect does not require clean up, return undefined (or nothing).";
|
|
} else if (typeof destroy.then === "function") {
|
|
addendum = "\n\nIt looks like you wrote " + hookName + "(async () => ...) or returned a Promise. Instead, write the async function inside your effect and call it immediately:\n\n" + hookName + "(() => {\n async function fetchData() {\n // You can await here\n const response = await MyAPI.getData(someId);\n // ...\n }\n fetchData();\n}, [someId]); // Or [] if effect doesn't need props or state\n\nLearn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching";
|
|
} else {
|
|
addendum = " You returned: " + destroy;
|
|
}
|
|
error("%s must not return anything besides a function, which is used for clean-up.%s", hookName, addendum);
|
|
}
|
|
}
|
|
}
|
|
effect = effect.next;
|
|
} while (effect !== firstEffect);
|
|
}
|
|
}
|
|
function commitPassiveEffectDurations(finishedRoot, finishedWork) {
|
|
{
|
|
if ((finishedWork.flags & Update) !== NoFlags) {
|
|
switch (finishedWork.tag) {
|
|
case Profiler: {
|
|
var passiveEffectDuration = finishedWork.stateNode.passiveEffectDuration;
|
|
var _finishedWork$memoize = finishedWork.memoizedProps, id = _finishedWork$memoize.id, onPostCommit = _finishedWork$memoize.onPostCommit;
|
|
var commitTime2 = getCommitTime();
|
|
var phase = finishedWork.alternate === null ? "mount" : "update";
|
|
{
|
|
if (isCurrentUpdateNested()) {
|
|
phase = "nested-update";
|
|
}
|
|
}
|
|
if (typeof onPostCommit === "function") {
|
|
onPostCommit(id, phase, passiveEffectDuration, commitTime2);
|
|
}
|
|
var parentFiber = finishedWork.return;
|
|
outer:
|
|
while (parentFiber !== null) {
|
|
switch (parentFiber.tag) {
|
|
case HostRoot:
|
|
var root2 = parentFiber.stateNode;
|
|
root2.passiveEffectDuration += passiveEffectDuration;
|
|
break outer;
|
|
case Profiler:
|
|
var parentStateNode = parentFiber.stateNode;
|
|
parentStateNode.passiveEffectDuration += passiveEffectDuration;
|
|
break outer;
|
|
}
|
|
parentFiber = parentFiber.return;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function commitLayoutEffectOnFiber(finishedRoot, current3, finishedWork, committedLanes) {
|
|
if ((finishedWork.flags & LayoutMask) !== NoFlags) {
|
|
switch (finishedWork.tag) {
|
|
case FunctionComponent:
|
|
case ForwardRef2:
|
|
case SimpleMemoComponent: {
|
|
if (!offscreenSubtreeWasHidden) {
|
|
if (finishedWork.mode & ProfileMode) {
|
|
try {
|
|
startLayoutEffectTimer();
|
|
commitHookEffectListMount(Layout | HasEffect, finishedWork);
|
|
} finally {
|
|
recordLayoutEffectDuration(finishedWork);
|
|
}
|
|
} else {
|
|
commitHookEffectListMount(Layout | HasEffect, finishedWork);
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
case ClassComponent: {
|
|
var instance = finishedWork.stateNode;
|
|
if (finishedWork.flags & Update) {
|
|
if (!offscreenSubtreeWasHidden) {
|
|
if (current3 === null) {
|
|
{
|
|
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
|
if (instance.props !== finishedWork.memoizedProps) {
|
|
error("Expected %s props to match memoized props before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
|
|
}
|
|
if (instance.state !== finishedWork.memoizedState) {
|
|
error("Expected %s state to match memoized state before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
|
|
}
|
|
}
|
|
}
|
|
if (finishedWork.mode & ProfileMode) {
|
|
try {
|
|
startLayoutEffectTimer();
|
|
instance.componentDidMount();
|
|
} finally {
|
|
recordLayoutEffectDuration(finishedWork);
|
|
}
|
|
} else {
|
|
instance.componentDidMount();
|
|
}
|
|
} else {
|
|
var prevProps = finishedWork.elementType === finishedWork.type ? current3.memoizedProps : resolveDefaultProps(finishedWork.type, current3.memoizedProps);
|
|
var prevState = current3.memoizedState;
|
|
{
|
|
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
|
if (instance.props !== finishedWork.memoizedProps) {
|
|
error("Expected %s props to match memoized props before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
|
|
}
|
|
if (instance.state !== finishedWork.memoizedState) {
|
|
error("Expected %s state to match memoized state before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
|
|
}
|
|
}
|
|
}
|
|
if (finishedWork.mode & ProfileMode) {
|
|
try {
|
|
startLayoutEffectTimer();
|
|
instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
|
|
} finally {
|
|
recordLayoutEffectDuration(finishedWork);
|
|
}
|
|
} else {
|
|
instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var updateQueue = finishedWork.updateQueue;
|
|
if (updateQueue !== null) {
|
|
{
|
|
if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) {
|
|
if (instance.props !== finishedWork.memoizedProps) {
|
|
error("Expected %s props to match memoized props before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
|
|
}
|
|
if (instance.state !== finishedWork.memoizedState) {
|
|
error("Expected %s state to match memoized state before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentNameFromFiber(finishedWork) || "instance");
|
|
}
|
|
}
|
|
}
|
|
commitUpdateQueue(finishedWork, updateQueue, instance);
|
|
}
|
|
break;
|
|
}
|
|
case HostRoot: {
|
|
var _updateQueue = finishedWork.updateQueue;
|
|
if (_updateQueue !== null) {
|
|
var _instance = null;
|
|
if (finishedWork.child !== null) {
|
|
switch (finishedWork.child.tag) {
|
|
case HostComponent:
|
|
_instance = getPublicInstance(finishedWork.child.stateNode);
|
|
break;
|
|
case ClassComponent:
|
|
_instance = finishedWork.child.stateNode;
|
|
break;
|
|
}
|
|
}
|
|
commitUpdateQueue(finishedWork, _updateQueue, _instance);
|
|
}
|
|
break;
|
|
}
|
|
case HostComponent: {
|
|
var _instance2 = finishedWork.stateNode;
|
|
if (current3 === null && finishedWork.flags & Update) {
|
|
var type = finishedWork.type;
|
|
var props = finishedWork.memoizedProps;
|
|
commitMount(_instance2, type, props);
|
|
}
|
|
break;
|
|
}
|
|
case HostText: {
|
|
break;
|
|
}
|
|
case HostPortal: {
|
|
break;
|
|
}
|
|
case Profiler: {
|
|
{
|
|
var _finishedWork$memoize2 = finishedWork.memoizedProps, onCommit = _finishedWork$memoize2.onCommit, onRender = _finishedWork$memoize2.onRender;
|
|
var effectDuration = finishedWork.stateNode.effectDuration;
|
|
var commitTime2 = getCommitTime();
|
|
var phase = current3 === null ? "mount" : "update";
|
|
{
|
|
if (isCurrentUpdateNested()) {
|
|
phase = "nested-update";
|
|
}
|
|
}
|
|
if (typeof onRender === "function") {
|
|
onRender(finishedWork.memoizedProps.id, phase, finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, commitTime2);
|
|
}
|
|
{
|
|
if (typeof onCommit === "function") {
|
|
onCommit(finishedWork.memoizedProps.id, phase, effectDuration, commitTime2);
|
|
}
|
|
enqueuePendingPassiveProfilerEffect(finishedWork);
|
|
var parentFiber = finishedWork.return;
|
|
outer:
|
|
while (parentFiber !== null) {
|
|
switch (parentFiber.tag) {
|
|
case HostRoot:
|
|
var root2 = parentFiber.stateNode;
|
|
root2.effectDuration += effectDuration;
|
|
break outer;
|
|
case Profiler:
|
|
var parentStateNode = parentFiber.stateNode;
|
|
parentStateNode.effectDuration += effectDuration;
|
|
break outer;
|
|
}
|
|
parentFiber = parentFiber.return;
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
case SuspenseComponent: {
|
|
commitSuspenseHydrationCallbacks(finishedRoot, finishedWork);
|
|
break;
|
|
}
|
|
case SuspenseListComponent:
|
|
case IncompleteClassComponent:
|
|
case ScopeComponent:
|
|
case OffscreenComponent:
|
|
case LegacyHiddenComponent:
|
|
case TracingMarkerComponent: {
|
|
break;
|
|
}
|
|
default:
|
|
throw new Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
if (!offscreenSubtreeWasHidden) {
|
|
{
|
|
if (finishedWork.flags & Ref2) {
|
|
commitAttachRef(finishedWork);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function reappearLayoutEffectsOnFiber(node) {
|
|
switch (node.tag) {
|
|
case FunctionComponent:
|
|
case ForwardRef2:
|
|
case SimpleMemoComponent: {
|
|
if (node.mode & ProfileMode) {
|
|
try {
|
|
startLayoutEffectTimer();
|
|
safelyCallCommitHookLayoutEffectListMount(node, node.return);
|
|
} finally {
|
|
recordLayoutEffectDuration(node);
|
|
}
|
|
} else {
|
|
safelyCallCommitHookLayoutEffectListMount(node, node.return);
|
|
}
|
|
break;
|
|
}
|
|
case ClassComponent: {
|
|
var instance = node.stateNode;
|
|
if (typeof instance.componentDidMount === "function") {
|
|
safelyCallComponentDidMount(node, node.return, instance);
|
|
}
|
|
safelyAttachRef(node, node.return);
|
|
break;
|
|
}
|
|
case HostComponent: {
|
|
safelyAttachRef(node, node.return);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
function hideOrUnhideAllChildren(finishedWork, isHidden) {
|
|
var hostSubtreeRoot = null;
|
|
{
|
|
var node = finishedWork;
|
|
while (true) {
|
|
if (node.tag === HostComponent) {
|
|
if (hostSubtreeRoot === null) {
|
|
hostSubtreeRoot = node;
|
|
try {
|
|
var instance = node.stateNode;
|
|
if (isHidden) {
|
|
hideInstance(instance);
|
|
} else {
|
|
unhideInstance(node.stateNode, node.memoizedProps);
|
|
}
|
|
} catch (error2) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error2);
|
|
}
|
|
}
|
|
} else if (node.tag === HostText) {
|
|
if (hostSubtreeRoot === null) {
|
|
try {
|
|
var _instance3 = node.stateNode;
|
|
if (isHidden) {
|
|
hideTextInstance(_instance3);
|
|
} else {
|
|
unhideTextInstance(_instance3, node.memoizedProps);
|
|
}
|
|
} catch (error2) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error2);
|
|
}
|
|
}
|
|
} else if ((node.tag === OffscreenComponent || node.tag === LegacyHiddenComponent) && node.memoizedState !== null && node !== finishedWork)
|
|
;
|
|
else if (node.child !== null) {
|
|
node.child.return = node;
|
|
node = node.child;
|
|
continue;
|
|
}
|
|
if (node === finishedWork) {
|
|
return;
|
|
}
|
|
while (node.sibling === null) {
|
|
if (node.return === null || node.return === finishedWork) {
|
|
return;
|
|
}
|
|
if (hostSubtreeRoot === node) {
|
|
hostSubtreeRoot = null;
|
|
}
|
|
node = node.return;
|
|
}
|
|
if (hostSubtreeRoot === node) {
|
|
hostSubtreeRoot = null;
|
|
}
|
|
node.sibling.return = node.return;
|
|
node = node.sibling;
|
|
}
|
|
}
|
|
}
|
|
function commitAttachRef(finishedWork) {
|
|
var ref = finishedWork.ref;
|
|
if (ref !== null) {
|
|
var instance = finishedWork.stateNode;
|
|
var instanceToUse;
|
|
switch (finishedWork.tag) {
|
|
case HostComponent:
|
|
instanceToUse = getPublicInstance(instance);
|
|
break;
|
|
default:
|
|
instanceToUse = instance;
|
|
}
|
|
if (typeof ref === "function") {
|
|
var retVal;
|
|
if (finishedWork.mode & ProfileMode) {
|
|
try {
|
|
startLayoutEffectTimer();
|
|
retVal = ref(instanceToUse);
|
|
} finally {
|
|
recordLayoutEffectDuration(finishedWork);
|
|
}
|
|
} else {
|
|
retVal = ref(instanceToUse);
|
|
}
|
|
{
|
|
if (typeof retVal === "function") {
|
|
error("Unexpected return value from a callback ref in %s. A callback ref should not return a function.", getComponentNameFromFiber(finishedWork));
|
|
}
|
|
}
|
|
} else {
|
|
{
|
|
if (!ref.hasOwnProperty("current")) {
|
|
error("Unexpected ref object provided for %s. Use either a ref-setter function or React.createRef().", getComponentNameFromFiber(finishedWork));
|
|
}
|
|
}
|
|
ref.current = instanceToUse;
|
|
}
|
|
}
|
|
}
|
|
function detachFiberMutation(fiber) {
|
|
var alternate = fiber.alternate;
|
|
if (alternate !== null) {
|
|
alternate.return = null;
|
|
}
|
|
fiber.return = null;
|
|
}
|
|
function detachFiberAfterEffects(fiber) {
|
|
var alternate = fiber.alternate;
|
|
if (alternate !== null) {
|
|
fiber.alternate = null;
|
|
detachFiberAfterEffects(alternate);
|
|
}
|
|
{
|
|
fiber.child = null;
|
|
fiber.deletions = null;
|
|
fiber.sibling = null;
|
|
if (fiber.tag === HostComponent) {
|
|
var hostInstance = fiber.stateNode;
|
|
if (hostInstance !== null) {
|
|
detachDeletedInstance(hostInstance);
|
|
}
|
|
}
|
|
fiber.stateNode = null;
|
|
{
|
|
fiber._debugOwner = null;
|
|
}
|
|
{
|
|
fiber.return = null;
|
|
fiber.dependencies = null;
|
|
fiber.memoizedProps = null;
|
|
fiber.memoizedState = null;
|
|
fiber.pendingProps = null;
|
|
fiber.stateNode = null;
|
|
fiber.updateQueue = null;
|
|
}
|
|
}
|
|
}
|
|
function getHostParentFiber(fiber) {
|
|
var parent = fiber.return;
|
|
while (parent !== null) {
|
|
if (isHostParent(parent)) {
|
|
return parent;
|
|
}
|
|
parent = parent.return;
|
|
}
|
|
throw new Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
function isHostParent(fiber) {
|
|
return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal;
|
|
}
|
|
function getHostSibling(fiber) {
|
|
var node = fiber;
|
|
siblings:
|
|
while (true) {
|
|
while (node.sibling === null) {
|
|
if (node.return === null || isHostParent(node.return)) {
|
|
return null;
|
|
}
|
|
node = node.return;
|
|
}
|
|
node.sibling.return = node.return;
|
|
node = node.sibling;
|
|
while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) {
|
|
if (node.flags & Placement) {
|
|
continue siblings;
|
|
}
|
|
if (node.child === null || node.tag === HostPortal) {
|
|
continue siblings;
|
|
} else {
|
|
node.child.return = node;
|
|
node = node.child;
|
|
}
|
|
}
|
|
if (!(node.flags & Placement)) {
|
|
return node.stateNode;
|
|
}
|
|
}
|
|
}
|
|
function commitPlacement(finishedWork) {
|
|
var parentFiber = getHostParentFiber(finishedWork);
|
|
switch (parentFiber.tag) {
|
|
case HostComponent: {
|
|
var parent = parentFiber.stateNode;
|
|
if (parentFiber.flags & ContentReset) {
|
|
resetTextContent(parent);
|
|
parentFiber.flags &= ~ContentReset;
|
|
}
|
|
var before = getHostSibling(finishedWork);
|
|
insertOrAppendPlacementNode(finishedWork, before, parent);
|
|
break;
|
|
}
|
|
case HostRoot:
|
|
case HostPortal: {
|
|
var _parent = parentFiber.stateNode.containerInfo;
|
|
var _before = getHostSibling(finishedWork);
|
|
insertOrAppendPlacementNodeIntoContainer(finishedWork, _before, _parent);
|
|
break;
|
|
}
|
|
default:
|
|
throw new Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
function insertOrAppendPlacementNodeIntoContainer(node, before, parent) {
|
|
var tag = node.tag;
|
|
var isHost = tag === HostComponent || tag === HostText;
|
|
if (isHost) {
|
|
var stateNode = node.stateNode;
|
|
if (before) {
|
|
insertInContainerBefore(parent, stateNode, before);
|
|
} else {
|
|
appendChildToContainer(parent, stateNode);
|
|
}
|
|
} else if (tag === HostPortal)
|
|
;
|
|
else {
|
|
var child = node.child;
|
|
if (child !== null) {
|
|
insertOrAppendPlacementNodeIntoContainer(child, before, parent);
|
|
var sibling = child.sibling;
|
|
while (sibling !== null) {
|
|
insertOrAppendPlacementNodeIntoContainer(sibling, before, parent);
|
|
sibling = sibling.sibling;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function insertOrAppendPlacementNode(node, before, parent) {
|
|
var tag = node.tag;
|
|
var isHost = tag === HostComponent || tag === HostText;
|
|
if (isHost) {
|
|
var stateNode = node.stateNode;
|
|
if (before) {
|
|
insertBefore(parent, stateNode, before);
|
|
} else {
|
|
appendChild(parent, stateNode);
|
|
}
|
|
} else if (tag === HostPortal)
|
|
;
|
|
else {
|
|
var child = node.child;
|
|
if (child !== null) {
|
|
insertOrAppendPlacementNode(child, before, parent);
|
|
var sibling = child.sibling;
|
|
while (sibling !== null) {
|
|
insertOrAppendPlacementNode(sibling, before, parent);
|
|
sibling = sibling.sibling;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var hostParent = null;
|
|
var hostParentIsContainer = false;
|
|
function commitDeletionEffects(root2, returnFiber, deletedFiber) {
|
|
{
|
|
var parent = returnFiber;
|
|
findParent:
|
|
while (parent !== null) {
|
|
switch (parent.tag) {
|
|
case HostComponent: {
|
|
hostParent = parent.stateNode;
|
|
hostParentIsContainer = false;
|
|
break findParent;
|
|
}
|
|
case HostRoot: {
|
|
hostParent = parent.stateNode.containerInfo;
|
|
hostParentIsContainer = true;
|
|
break findParent;
|
|
}
|
|
case HostPortal: {
|
|
hostParent = parent.stateNode.containerInfo;
|
|
hostParentIsContainer = true;
|
|
break findParent;
|
|
}
|
|
}
|
|
parent = parent.return;
|
|
}
|
|
if (hostParent === null) {
|
|
throw new Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
commitDeletionEffectsOnFiber(root2, returnFiber, deletedFiber);
|
|
hostParent = null;
|
|
hostParentIsContainer = false;
|
|
}
|
|
detachFiberMutation(deletedFiber);
|
|
}
|
|
function recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, parent) {
|
|
var child = parent.child;
|
|
while (child !== null) {
|
|
commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, child);
|
|
child = child.sibling;
|
|
}
|
|
}
|
|
function commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, deletedFiber) {
|
|
onCommitUnmount(deletedFiber);
|
|
switch (deletedFiber.tag) {
|
|
case HostComponent: {
|
|
if (!offscreenSubtreeWasHidden) {
|
|
safelyDetachRef(deletedFiber, nearestMountedAncestor);
|
|
}
|
|
}
|
|
case HostText: {
|
|
{
|
|
var prevHostParent = hostParent;
|
|
var prevHostParentIsContainer = hostParentIsContainer;
|
|
hostParent = null;
|
|
recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
|
|
hostParent = prevHostParent;
|
|
hostParentIsContainer = prevHostParentIsContainer;
|
|
if (hostParent !== null) {
|
|
if (hostParentIsContainer) {
|
|
removeChildFromContainer(hostParent, deletedFiber.stateNode);
|
|
} else {
|
|
removeChild(hostParent, deletedFiber.stateNode);
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
case DehydratedFragment: {
|
|
{
|
|
if (hostParent !== null) {
|
|
if (hostParentIsContainer) {
|
|
clearSuspenseBoundaryFromContainer(hostParent, deletedFiber.stateNode);
|
|
} else {
|
|
clearSuspenseBoundary(hostParent, deletedFiber.stateNode);
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
case HostPortal: {
|
|
{
|
|
var _prevHostParent = hostParent;
|
|
var _prevHostParentIsContainer = hostParentIsContainer;
|
|
hostParent = deletedFiber.stateNode.containerInfo;
|
|
hostParentIsContainer = true;
|
|
recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
|
|
hostParent = _prevHostParent;
|
|
hostParentIsContainer = _prevHostParentIsContainer;
|
|
}
|
|
return;
|
|
}
|
|
case FunctionComponent:
|
|
case ForwardRef2:
|
|
case MemoComponent:
|
|
case SimpleMemoComponent: {
|
|
if (!offscreenSubtreeWasHidden) {
|
|
var updateQueue = deletedFiber.updateQueue;
|
|
if (updateQueue !== null) {
|
|
var lastEffect = updateQueue.lastEffect;
|
|
if (lastEffect !== null) {
|
|
var firstEffect = lastEffect.next;
|
|
var effect = firstEffect;
|
|
do {
|
|
var _effect = effect, destroy = _effect.destroy, tag = _effect.tag;
|
|
if (destroy !== void 0) {
|
|
if ((tag & Insertion) !== NoFlags$1) {
|
|
safelyCallDestroy(deletedFiber, nearestMountedAncestor, destroy);
|
|
} else if ((tag & Layout) !== NoFlags$1) {
|
|
{
|
|
markComponentLayoutEffectUnmountStarted(deletedFiber);
|
|
}
|
|
if (deletedFiber.mode & ProfileMode) {
|
|
startLayoutEffectTimer();
|
|
safelyCallDestroy(deletedFiber, nearestMountedAncestor, destroy);
|
|
recordLayoutEffectDuration(deletedFiber);
|
|
} else {
|
|
safelyCallDestroy(deletedFiber, nearestMountedAncestor, destroy);
|
|
}
|
|
{
|
|
markComponentLayoutEffectUnmountStopped();
|
|
}
|
|
}
|
|
}
|
|
effect = effect.next;
|
|
} while (effect !== firstEffect);
|
|
}
|
|
}
|
|
}
|
|
recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
|
|
return;
|
|
}
|
|
case ClassComponent: {
|
|
if (!offscreenSubtreeWasHidden) {
|
|
safelyDetachRef(deletedFiber, nearestMountedAncestor);
|
|
var instance = deletedFiber.stateNode;
|
|
if (typeof instance.componentWillUnmount === "function") {
|
|
safelyCallComponentWillUnmount(deletedFiber, nearestMountedAncestor, instance);
|
|
}
|
|
}
|
|
recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
|
|
return;
|
|
}
|
|
case ScopeComponent: {
|
|
recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
|
|
return;
|
|
}
|
|
case OffscreenComponent: {
|
|
if (deletedFiber.mode & ConcurrentMode) {
|
|
var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden;
|
|
offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || deletedFiber.memoizedState !== null;
|
|
recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
|
|
offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden;
|
|
} else {
|
|
recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
|
|
}
|
|
break;
|
|
}
|
|
default: {
|
|
recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
function commitSuspenseCallback(finishedWork) {
|
|
var newState = finishedWork.memoizedState;
|
|
}
|
|
function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) {
|
|
var newState = finishedWork.memoizedState;
|
|
if (newState === null) {
|
|
var current3 = finishedWork.alternate;
|
|
if (current3 !== null) {
|
|
var prevState = current3.memoizedState;
|
|
if (prevState !== null) {
|
|
var suspenseInstance = prevState.dehydrated;
|
|
if (suspenseInstance !== null) {
|
|
commitHydratedSuspenseInstance(suspenseInstance);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function attachSuspenseRetryListeners(finishedWork) {
|
|
var wakeables = finishedWork.updateQueue;
|
|
if (wakeables !== null) {
|
|
finishedWork.updateQueue = null;
|
|
var retryCache = finishedWork.stateNode;
|
|
if (retryCache === null) {
|
|
retryCache = finishedWork.stateNode = new PossiblyWeakSet();
|
|
}
|
|
wakeables.forEach(function(wakeable) {
|
|
var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable);
|
|
if (!retryCache.has(wakeable)) {
|
|
retryCache.add(wakeable);
|
|
{
|
|
if (isDevToolsPresent) {
|
|
if (inProgressLanes !== null && inProgressRoot !== null) {
|
|
restorePendingUpdaters(inProgressRoot, inProgressLanes);
|
|
} else {
|
|
throw Error("Expected finished root and lanes to be set. This is a bug in React.");
|
|
}
|
|
}
|
|
}
|
|
wakeable.then(retry, retry);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
function commitMutationEffects(root2, finishedWork, committedLanes) {
|
|
inProgressLanes = committedLanes;
|
|
inProgressRoot = root2;
|
|
setCurrentFiber(finishedWork);
|
|
commitMutationEffectsOnFiber(finishedWork, root2);
|
|
setCurrentFiber(finishedWork);
|
|
inProgressLanes = null;
|
|
inProgressRoot = null;
|
|
}
|
|
function recursivelyTraverseMutationEffects(root2, parentFiber, lanes) {
|
|
var deletions = parentFiber.deletions;
|
|
if (deletions !== null) {
|
|
for (var i = 0; i < deletions.length; i++) {
|
|
var childToDelete = deletions[i];
|
|
try {
|
|
commitDeletionEffects(root2, parentFiber, childToDelete);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(childToDelete, parentFiber, error2);
|
|
}
|
|
}
|
|
}
|
|
var prevDebugFiber = getCurrentFiber();
|
|
if (parentFiber.subtreeFlags & MutationMask) {
|
|
var child = parentFiber.child;
|
|
while (child !== null) {
|
|
setCurrentFiber(child);
|
|
commitMutationEffectsOnFiber(child, root2);
|
|
child = child.sibling;
|
|
}
|
|
}
|
|
setCurrentFiber(prevDebugFiber);
|
|
}
|
|
function commitMutationEffectsOnFiber(finishedWork, root2, lanes) {
|
|
var current3 = finishedWork.alternate;
|
|
var flags = finishedWork.flags;
|
|
switch (finishedWork.tag) {
|
|
case FunctionComponent:
|
|
case ForwardRef2:
|
|
case MemoComponent:
|
|
case SimpleMemoComponent: {
|
|
recursivelyTraverseMutationEffects(root2, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
if (flags & Update) {
|
|
try {
|
|
commitHookEffectListUnmount(Insertion | HasEffect, finishedWork, finishedWork.return);
|
|
commitHookEffectListMount(Insertion | HasEffect, finishedWork);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error2);
|
|
}
|
|
if (finishedWork.mode & ProfileMode) {
|
|
try {
|
|
startLayoutEffectTimer();
|
|
commitHookEffectListUnmount(Layout | HasEffect, finishedWork, finishedWork.return);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error2);
|
|
}
|
|
recordLayoutEffectDuration(finishedWork);
|
|
} else {
|
|
try {
|
|
commitHookEffectListUnmount(Layout | HasEffect, finishedWork, finishedWork.return);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error2);
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
case ClassComponent: {
|
|
recursivelyTraverseMutationEffects(root2, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
if (flags & Ref2) {
|
|
if (current3 !== null) {
|
|
safelyDetachRef(current3, current3.return);
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
case HostComponent: {
|
|
recursivelyTraverseMutationEffects(root2, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
if (flags & Ref2) {
|
|
if (current3 !== null) {
|
|
safelyDetachRef(current3, current3.return);
|
|
}
|
|
}
|
|
{
|
|
if (finishedWork.flags & ContentReset) {
|
|
var instance = finishedWork.stateNode;
|
|
try {
|
|
resetTextContent(instance);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error2);
|
|
}
|
|
}
|
|
if (flags & Update) {
|
|
var _instance4 = finishedWork.stateNode;
|
|
if (_instance4 != null) {
|
|
var newProps = finishedWork.memoizedProps;
|
|
var oldProps = current3 !== null ? current3.memoizedProps : newProps;
|
|
var type = finishedWork.type;
|
|
var updatePayload = finishedWork.updateQueue;
|
|
finishedWork.updateQueue = null;
|
|
if (updatePayload !== null) {
|
|
try {
|
|
commitUpdate(_instance4, updatePayload, type, oldProps, newProps, finishedWork);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
case HostText: {
|
|
recursivelyTraverseMutationEffects(root2, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
if (flags & Update) {
|
|
{
|
|
if (finishedWork.stateNode === null) {
|
|
throw new Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
var textInstance = finishedWork.stateNode;
|
|
var newText = finishedWork.memoizedProps;
|
|
var oldText = current3 !== null ? current3.memoizedProps : newText;
|
|
try {
|
|
commitTextUpdate(textInstance, oldText, newText);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error2);
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
case HostRoot: {
|
|
recursivelyTraverseMutationEffects(root2, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
if (flags & Update) {
|
|
{
|
|
if (current3 !== null) {
|
|
var prevRootState = current3.memoizedState;
|
|
if (prevRootState.isDehydrated) {
|
|
try {
|
|
commitHydratedContainer(root2.containerInfo);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
case HostPortal: {
|
|
recursivelyTraverseMutationEffects(root2, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
return;
|
|
}
|
|
case SuspenseComponent: {
|
|
recursivelyTraverseMutationEffects(root2, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
var offscreenFiber = finishedWork.child;
|
|
if (offscreenFiber.flags & Visibility) {
|
|
var offscreenInstance = offscreenFiber.stateNode;
|
|
var newState = offscreenFiber.memoizedState;
|
|
var isHidden = newState !== null;
|
|
offscreenInstance.isHidden = isHidden;
|
|
if (isHidden) {
|
|
var wasHidden = offscreenFiber.alternate !== null && offscreenFiber.alternate.memoizedState !== null;
|
|
if (!wasHidden) {
|
|
markCommitTimeOfFallback();
|
|
}
|
|
}
|
|
}
|
|
if (flags & Update) {
|
|
try {
|
|
commitSuspenseCallback(finishedWork);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error2);
|
|
}
|
|
attachSuspenseRetryListeners(finishedWork);
|
|
}
|
|
return;
|
|
}
|
|
case OffscreenComponent: {
|
|
var _wasHidden = current3 !== null && current3.memoizedState !== null;
|
|
if (finishedWork.mode & ConcurrentMode) {
|
|
var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden;
|
|
offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || _wasHidden;
|
|
recursivelyTraverseMutationEffects(root2, finishedWork);
|
|
offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden;
|
|
} else {
|
|
recursivelyTraverseMutationEffects(root2, finishedWork);
|
|
}
|
|
commitReconciliationEffects(finishedWork);
|
|
if (flags & Visibility) {
|
|
var _offscreenInstance = finishedWork.stateNode;
|
|
var _newState = finishedWork.memoizedState;
|
|
var _isHidden = _newState !== null;
|
|
var offscreenBoundary = finishedWork;
|
|
_offscreenInstance.isHidden = _isHidden;
|
|
{
|
|
if (_isHidden) {
|
|
if (!_wasHidden) {
|
|
if ((offscreenBoundary.mode & ConcurrentMode) !== NoMode) {
|
|
nextEffect = offscreenBoundary;
|
|
var offscreenChild = offscreenBoundary.child;
|
|
while (offscreenChild !== null) {
|
|
nextEffect = offscreenChild;
|
|
disappearLayoutEffects_begin(offscreenChild);
|
|
offscreenChild = offscreenChild.sibling;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
{
|
|
hideOrUnhideAllChildren(offscreenBoundary, _isHidden);
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
case SuspenseListComponent: {
|
|
recursivelyTraverseMutationEffects(root2, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
if (flags & Update) {
|
|
attachSuspenseRetryListeners(finishedWork);
|
|
}
|
|
return;
|
|
}
|
|
case ScopeComponent: {
|
|
return;
|
|
}
|
|
default: {
|
|
recursivelyTraverseMutationEffects(root2, finishedWork);
|
|
commitReconciliationEffects(finishedWork);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
function commitReconciliationEffects(finishedWork) {
|
|
var flags = finishedWork.flags;
|
|
if (flags & Placement) {
|
|
try {
|
|
commitPlacement(finishedWork);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(finishedWork, finishedWork.return, error2);
|
|
}
|
|
finishedWork.flags &= ~Placement;
|
|
}
|
|
if (flags & Hydrating) {
|
|
finishedWork.flags &= ~Hydrating;
|
|
}
|
|
}
|
|
function commitLayoutEffects(finishedWork, root2, committedLanes) {
|
|
inProgressLanes = committedLanes;
|
|
inProgressRoot = root2;
|
|
nextEffect = finishedWork;
|
|
commitLayoutEffects_begin(finishedWork, root2, committedLanes);
|
|
inProgressLanes = null;
|
|
inProgressRoot = null;
|
|
}
|
|
function commitLayoutEffects_begin(subtreeRoot, root2, committedLanes) {
|
|
var isModernRoot = (subtreeRoot.mode & ConcurrentMode) !== NoMode;
|
|
while (nextEffect !== null) {
|
|
var fiber = nextEffect;
|
|
var firstChild = fiber.child;
|
|
if (fiber.tag === OffscreenComponent && isModernRoot) {
|
|
var isHidden = fiber.memoizedState !== null;
|
|
var newOffscreenSubtreeIsHidden = isHidden || offscreenSubtreeIsHidden;
|
|
if (newOffscreenSubtreeIsHidden) {
|
|
commitLayoutMountEffects_complete(subtreeRoot, root2, committedLanes);
|
|
continue;
|
|
} else {
|
|
var current3 = fiber.alternate;
|
|
var wasHidden = current3 !== null && current3.memoizedState !== null;
|
|
var newOffscreenSubtreeWasHidden = wasHidden || offscreenSubtreeWasHidden;
|
|
var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden;
|
|
var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden;
|
|
offscreenSubtreeIsHidden = newOffscreenSubtreeIsHidden;
|
|
offscreenSubtreeWasHidden = newOffscreenSubtreeWasHidden;
|
|
if (offscreenSubtreeWasHidden && !prevOffscreenSubtreeWasHidden) {
|
|
nextEffect = fiber;
|
|
reappearLayoutEffects_begin(fiber);
|
|
}
|
|
var child = firstChild;
|
|
while (child !== null) {
|
|
nextEffect = child;
|
|
commitLayoutEffects_begin(
|
|
child,
|
|
root2,
|
|
committedLanes
|
|
);
|
|
child = child.sibling;
|
|
}
|
|
nextEffect = fiber;
|
|
offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden;
|
|
offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden;
|
|
commitLayoutMountEffects_complete(subtreeRoot, root2, committedLanes);
|
|
continue;
|
|
}
|
|
}
|
|
if ((fiber.subtreeFlags & LayoutMask) !== NoFlags && firstChild !== null) {
|
|
firstChild.return = fiber;
|
|
nextEffect = firstChild;
|
|
} else {
|
|
commitLayoutMountEffects_complete(subtreeRoot, root2, committedLanes);
|
|
}
|
|
}
|
|
}
|
|
function commitLayoutMountEffects_complete(subtreeRoot, root2, committedLanes) {
|
|
while (nextEffect !== null) {
|
|
var fiber = nextEffect;
|
|
if ((fiber.flags & LayoutMask) !== NoFlags) {
|
|
var current3 = fiber.alternate;
|
|
setCurrentFiber(fiber);
|
|
try {
|
|
commitLayoutEffectOnFiber(root2, current3, fiber, committedLanes);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(fiber, fiber.return, error2);
|
|
}
|
|
resetCurrentFiber();
|
|
}
|
|
if (fiber === subtreeRoot) {
|
|
nextEffect = null;
|
|
return;
|
|
}
|
|
var sibling = fiber.sibling;
|
|
if (sibling !== null) {
|
|
sibling.return = fiber.return;
|
|
nextEffect = sibling;
|
|
return;
|
|
}
|
|
nextEffect = fiber.return;
|
|
}
|
|
}
|
|
function disappearLayoutEffects_begin(subtreeRoot) {
|
|
while (nextEffect !== null) {
|
|
var fiber = nextEffect;
|
|
var firstChild = fiber.child;
|
|
switch (fiber.tag) {
|
|
case FunctionComponent:
|
|
case ForwardRef2:
|
|
case MemoComponent:
|
|
case SimpleMemoComponent: {
|
|
if (fiber.mode & ProfileMode) {
|
|
try {
|
|
startLayoutEffectTimer();
|
|
commitHookEffectListUnmount(Layout, fiber, fiber.return);
|
|
} finally {
|
|
recordLayoutEffectDuration(fiber);
|
|
}
|
|
} else {
|
|
commitHookEffectListUnmount(Layout, fiber, fiber.return);
|
|
}
|
|
break;
|
|
}
|
|
case ClassComponent: {
|
|
safelyDetachRef(fiber, fiber.return);
|
|
var instance = fiber.stateNode;
|
|
if (typeof instance.componentWillUnmount === "function") {
|
|
safelyCallComponentWillUnmount(fiber, fiber.return, instance);
|
|
}
|
|
break;
|
|
}
|
|
case HostComponent: {
|
|
safelyDetachRef(fiber, fiber.return);
|
|
break;
|
|
}
|
|
case OffscreenComponent: {
|
|
var isHidden = fiber.memoizedState !== null;
|
|
if (isHidden) {
|
|
disappearLayoutEffects_complete(subtreeRoot);
|
|
continue;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
if (firstChild !== null) {
|
|
firstChild.return = fiber;
|
|
nextEffect = firstChild;
|
|
} else {
|
|
disappearLayoutEffects_complete(subtreeRoot);
|
|
}
|
|
}
|
|
}
|
|
function disappearLayoutEffects_complete(subtreeRoot) {
|
|
while (nextEffect !== null) {
|
|
var fiber = nextEffect;
|
|
if (fiber === subtreeRoot) {
|
|
nextEffect = null;
|
|
return;
|
|
}
|
|
var sibling = fiber.sibling;
|
|
if (sibling !== null) {
|
|
sibling.return = fiber.return;
|
|
nextEffect = sibling;
|
|
return;
|
|
}
|
|
nextEffect = fiber.return;
|
|
}
|
|
}
|
|
function reappearLayoutEffects_begin(subtreeRoot) {
|
|
while (nextEffect !== null) {
|
|
var fiber = nextEffect;
|
|
var firstChild = fiber.child;
|
|
if (fiber.tag === OffscreenComponent) {
|
|
var isHidden = fiber.memoizedState !== null;
|
|
if (isHidden) {
|
|
reappearLayoutEffects_complete(subtreeRoot);
|
|
continue;
|
|
}
|
|
}
|
|
if (firstChild !== null) {
|
|
firstChild.return = fiber;
|
|
nextEffect = firstChild;
|
|
} else {
|
|
reappearLayoutEffects_complete(subtreeRoot);
|
|
}
|
|
}
|
|
}
|
|
function reappearLayoutEffects_complete(subtreeRoot) {
|
|
while (nextEffect !== null) {
|
|
var fiber = nextEffect;
|
|
setCurrentFiber(fiber);
|
|
try {
|
|
reappearLayoutEffectsOnFiber(fiber);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(fiber, fiber.return, error2);
|
|
}
|
|
resetCurrentFiber();
|
|
if (fiber === subtreeRoot) {
|
|
nextEffect = null;
|
|
return;
|
|
}
|
|
var sibling = fiber.sibling;
|
|
if (sibling !== null) {
|
|
sibling.return = fiber.return;
|
|
nextEffect = sibling;
|
|
return;
|
|
}
|
|
nextEffect = fiber.return;
|
|
}
|
|
}
|
|
function commitPassiveMountEffects(root2, finishedWork, committedLanes, committedTransitions) {
|
|
nextEffect = finishedWork;
|
|
commitPassiveMountEffects_begin(finishedWork, root2, committedLanes, committedTransitions);
|
|
}
|
|
function commitPassiveMountEffects_begin(subtreeRoot, root2, committedLanes, committedTransitions) {
|
|
while (nextEffect !== null) {
|
|
var fiber = nextEffect;
|
|
var firstChild = fiber.child;
|
|
if ((fiber.subtreeFlags & PassiveMask) !== NoFlags && firstChild !== null) {
|
|
firstChild.return = fiber;
|
|
nextEffect = firstChild;
|
|
} else {
|
|
commitPassiveMountEffects_complete(subtreeRoot, root2, committedLanes, committedTransitions);
|
|
}
|
|
}
|
|
}
|
|
function commitPassiveMountEffects_complete(subtreeRoot, root2, committedLanes, committedTransitions) {
|
|
while (nextEffect !== null) {
|
|
var fiber = nextEffect;
|
|
if ((fiber.flags & Passive) !== NoFlags) {
|
|
setCurrentFiber(fiber);
|
|
try {
|
|
commitPassiveMountOnFiber(root2, fiber, committedLanes, committedTransitions);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(fiber, fiber.return, error2);
|
|
}
|
|
resetCurrentFiber();
|
|
}
|
|
if (fiber === subtreeRoot) {
|
|
nextEffect = null;
|
|
return;
|
|
}
|
|
var sibling = fiber.sibling;
|
|
if (sibling !== null) {
|
|
sibling.return = fiber.return;
|
|
nextEffect = sibling;
|
|
return;
|
|
}
|
|
nextEffect = fiber.return;
|
|
}
|
|
}
|
|
function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) {
|
|
switch (finishedWork.tag) {
|
|
case FunctionComponent:
|
|
case ForwardRef2:
|
|
case SimpleMemoComponent: {
|
|
if (finishedWork.mode & ProfileMode) {
|
|
startPassiveEffectTimer();
|
|
try {
|
|
commitHookEffectListMount(Passive$1 | HasEffect, finishedWork);
|
|
} finally {
|
|
recordPassiveEffectDuration(finishedWork);
|
|
}
|
|
} else {
|
|
commitHookEffectListMount(Passive$1 | HasEffect, finishedWork);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
function commitPassiveUnmountEffects(firstChild) {
|
|
nextEffect = firstChild;
|
|
commitPassiveUnmountEffects_begin();
|
|
}
|
|
function commitPassiveUnmountEffects_begin() {
|
|
while (nextEffect !== null) {
|
|
var fiber = nextEffect;
|
|
var child = fiber.child;
|
|
if ((nextEffect.flags & ChildDeletion) !== NoFlags) {
|
|
var deletions = fiber.deletions;
|
|
if (deletions !== null) {
|
|
for (var i = 0; i < deletions.length; i++) {
|
|
var fiberToDelete = deletions[i];
|
|
nextEffect = fiberToDelete;
|
|
commitPassiveUnmountEffectsInsideOfDeletedTree_begin(fiberToDelete, fiber);
|
|
}
|
|
{
|
|
var previousFiber = fiber.alternate;
|
|
if (previousFiber !== null) {
|
|
var detachedChild = previousFiber.child;
|
|
if (detachedChild !== null) {
|
|
previousFiber.child = null;
|
|
do {
|
|
var detachedSibling = detachedChild.sibling;
|
|
detachedChild.sibling = null;
|
|
detachedChild = detachedSibling;
|
|
} while (detachedChild !== null);
|
|
}
|
|
}
|
|
}
|
|
nextEffect = fiber;
|
|
}
|
|
}
|
|
if ((fiber.subtreeFlags & PassiveMask) !== NoFlags && child !== null) {
|
|
child.return = fiber;
|
|
nextEffect = child;
|
|
} else {
|
|
commitPassiveUnmountEffects_complete();
|
|
}
|
|
}
|
|
}
|
|
function commitPassiveUnmountEffects_complete() {
|
|
while (nextEffect !== null) {
|
|
var fiber = nextEffect;
|
|
if ((fiber.flags & Passive) !== NoFlags) {
|
|
setCurrentFiber(fiber);
|
|
commitPassiveUnmountOnFiber(fiber);
|
|
resetCurrentFiber();
|
|
}
|
|
var sibling = fiber.sibling;
|
|
if (sibling !== null) {
|
|
sibling.return = fiber.return;
|
|
nextEffect = sibling;
|
|
return;
|
|
}
|
|
nextEffect = fiber.return;
|
|
}
|
|
}
|
|
function commitPassiveUnmountOnFiber(finishedWork) {
|
|
switch (finishedWork.tag) {
|
|
case FunctionComponent:
|
|
case ForwardRef2:
|
|
case SimpleMemoComponent: {
|
|
if (finishedWork.mode & ProfileMode) {
|
|
startPassiveEffectTimer();
|
|
commitHookEffectListUnmount(Passive$1 | HasEffect, finishedWork, finishedWork.return);
|
|
recordPassiveEffectDuration(finishedWork);
|
|
} else {
|
|
commitHookEffectListUnmount(Passive$1 | HasEffect, finishedWork, finishedWork.return);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot, nearestMountedAncestor) {
|
|
while (nextEffect !== null) {
|
|
var fiber = nextEffect;
|
|
setCurrentFiber(fiber);
|
|
commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor);
|
|
resetCurrentFiber();
|
|
var child = fiber.child;
|
|
if (child !== null) {
|
|
child.return = fiber;
|
|
nextEffect = child;
|
|
} else {
|
|
commitPassiveUnmountEffectsInsideOfDeletedTree_complete(deletedSubtreeRoot);
|
|
}
|
|
}
|
|
}
|
|
function commitPassiveUnmountEffectsInsideOfDeletedTree_complete(deletedSubtreeRoot) {
|
|
while (nextEffect !== null) {
|
|
var fiber = nextEffect;
|
|
var sibling = fiber.sibling;
|
|
var returnFiber = fiber.return;
|
|
{
|
|
detachFiberAfterEffects(fiber);
|
|
if (fiber === deletedSubtreeRoot) {
|
|
nextEffect = null;
|
|
return;
|
|
}
|
|
}
|
|
if (sibling !== null) {
|
|
sibling.return = returnFiber;
|
|
nextEffect = sibling;
|
|
return;
|
|
}
|
|
nextEffect = returnFiber;
|
|
}
|
|
}
|
|
function commitPassiveUnmountInsideDeletedTreeOnFiber(current3, nearestMountedAncestor) {
|
|
switch (current3.tag) {
|
|
case FunctionComponent:
|
|
case ForwardRef2:
|
|
case SimpleMemoComponent: {
|
|
if (current3.mode & ProfileMode) {
|
|
startPassiveEffectTimer();
|
|
commitHookEffectListUnmount(Passive$1, current3, nearestMountedAncestor);
|
|
recordPassiveEffectDuration(current3);
|
|
} else {
|
|
commitHookEffectListUnmount(Passive$1, current3, nearestMountedAncestor);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
function invokeLayoutEffectMountInDEV(fiber) {
|
|
{
|
|
switch (fiber.tag) {
|
|
case FunctionComponent:
|
|
case ForwardRef2:
|
|
case SimpleMemoComponent: {
|
|
try {
|
|
commitHookEffectListMount(Layout | HasEffect, fiber);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(fiber, fiber.return, error2);
|
|
}
|
|
break;
|
|
}
|
|
case ClassComponent: {
|
|
var instance = fiber.stateNode;
|
|
try {
|
|
instance.componentDidMount();
|
|
} catch (error2) {
|
|
captureCommitPhaseError(fiber, fiber.return, error2);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function invokePassiveEffectMountInDEV(fiber) {
|
|
{
|
|
switch (fiber.tag) {
|
|
case FunctionComponent:
|
|
case ForwardRef2:
|
|
case SimpleMemoComponent: {
|
|
try {
|
|
commitHookEffectListMount(Passive$1 | HasEffect, fiber);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(fiber, fiber.return, error2);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function invokeLayoutEffectUnmountInDEV(fiber) {
|
|
{
|
|
switch (fiber.tag) {
|
|
case FunctionComponent:
|
|
case ForwardRef2:
|
|
case SimpleMemoComponent: {
|
|
try {
|
|
commitHookEffectListUnmount(Layout | HasEffect, fiber, fiber.return);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(fiber, fiber.return, error2);
|
|
}
|
|
break;
|
|
}
|
|
case ClassComponent: {
|
|
var instance = fiber.stateNode;
|
|
if (typeof instance.componentWillUnmount === "function") {
|
|
safelyCallComponentWillUnmount(fiber, fiber.return, instance);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function invokePassiveEffectUnmountInDEV(fiber) {
|
|
{
|
|
switch (fiber.tag) {
|
|
case FunctionComponent:
|
|
case ForwardRef2:
|
|
case SimpleMemoComponent: {
|
|
try {
|
|
commitHookEffectListUnmount(Passive$1 | HasEffect, fiber, fiber.return);
|
|
} catch (error2) {
|
|
captureCommitPhaseError(fiber, fiber.return, error2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var COMPONENT_TYPE = 0;
|
|
var HAS_PSEUDO_CLASS_TYPE = 1;
|
|
var ROLE_TYPE = 2;
|
|
var TEST_NAME_TYPE = 3;
|
|
var TEXT_TYPE = 4;
|
|
if (typeof Symbol === "function" && Symbol.for) {
|
|
var symbolFor = Symbol.for;
|
|
COMPONENT_TYPE = symbolFor("selector.component");
|
|
HAS_PSEUDO_CLASS_TYPE = symbolFor("selector.has_pseudo_class");
|
|
ROLE_TYPE = symbolFor("selector.role");
|
|
TEST_NAME_TYPE = symbolFor("selector.test_id");
|
|
TEXT_TYPE = symbolFor("selector.text");
|
|
}
|
|
var commitHooks = [];
|
|
function onCommitRoot$1() {
|
|
{
|
|
commitHooks.forEach(function(commitHook) {
|
|
return commitHook();
|
|
});
|
|
}
|
|
}
|
|
var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue;
|
|
function isLegacyActEnvironment(fiber) {
|
|
{
|
|
var isReactActEnvironmentGlobal = typeof IS_REACT_ACT_ENVIRONMENT !== "undefined" ? IS_REACT_ACT_ENVIRONMENT : void 0;
|
|
var jestIsDefined = typeof jest !== "undefined";
|
|
return jestIsDefined && isReactActEnvironmentGlobal !== false;
|
|
}
|
|
}
|
|
function isConcurrentActEnvironment() {
|
|
{
|
|
var isReactActEnvironmentGlobal = typeof IS_REACT_ACT_ENVIRONMENT !== "undefined" ? IS_REACT_ACT_ENVIRONMENT : void 0;
|
|
if (!isReactActEnvironmentGlobal && ReactCurrentActQueue.current !== null) {
|
|
error("The current testing environment is not configured to support act(...)");
|
|
}
|
|
return isReactActEnvironmentGlobal;
|
|
}
|
|
}
|
|
var ceil = Math.ceil;
|
|
var ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, ReactCurrentBatchConfig$3 = ReactSharedInternals.ReactCurrentBatchConfig, ReactCurrentActQueue$1 = ReactSharedInternals.ReactCurrentActQueue;
|
|
var NoContext = 0;
|
|
var BatchedContext = 1;
|
|
var RenderContext = 2;
|
|
var CommitContext = 4;
|
|
var RootInProgress = 0;
|
|
var RootFatalErrored = 1;
|
|
var RootErrored = 2;
|
|
var RootSuspended = 3;
|
|
var RootSuspendedWithDelay = 4;
|
|
var RootCompleted = 5;
|
|
var RootDidNotComplete = 6;
|
|
var executionContext = NoContext;
|
|
var workInProgressRoot = null;
|
|
var workInProgress = null;
|
|
var workInProgressRootRenderLanes = NoLanes;
|
|
var subtreeRenderLanes = NoLanes;
|
|
var subtreeRenderLanesCursor = createCursor(NoLanes);
|
|
var workInProgressRootExitStatus = RootInProgress;
|
|
var workInProgressRootFatalError = null;
|
|
var workInProgressRootIncludedLanes = NoLanes;
|
|
var workInProgressRootSkippedLanes = NoLanes;
|
|
var workInProgressRootInterleavedUpdatedLanes = NoLanes;
|
|
var workInProgressRootPingedLanes = NoLanes;
|
|
var workInProgressRootConcurrentErrors = null;
|
|
var workInProgressRootRecoverableErrors = null;
|
|
var globalMostRecentFallbackTime = 0;
|
|
var FALLBACK_THROTTLE_MS = 500;
|
|
var workInProgressRootRenderTargetTime = Infinity;
|
|
var RENDER_TIMEOUT_MS = 500;
|
|
var workInProgressTransitions = null;
|
|
function resetRenderTimer() {
|
|
workInProgressRootRenderTargetTime = now() + RENDER_TIMEOUT_MS;
|
|
}
|
|
function getRenderTargetTime() {
|
|
return workInProgressRootRenderTargetTime;
|
|
}
|
|
var hasUncaughtError = false;
|
|
var firstUncaughtError = null;
|
|
var legacyErrorBoundariesThatAlreadyFailed = null;
|
|
var rootDoesHavePassiveEffects = false;
|
|
var rootWithPendingPassiveEffects = null;
|
|
var pendingPassiveEffectsLanes = NoLanes;
|
|
var pendingPassiveProfilerEffects = [];
|
|
var pendingPassiveTransitions = null;
|
|
var NESTED_UPDATE_LIMIT = 50;
|
|
var nestedUpdateCount = 0;
|
|
var rootWithNestedUpdates = null;
|
|
var isFlushingPassiveEffects = false;
|
|
var didScheduleUpdateDuringPassiveEffects = false;
|
|
var NESTED_PASSIVE_UPDATE_LIMIT = 50;
|
|
var nestedPassiveUpdateCount = 0;
|
|
var rootWithPassiveNestedUpdates = null;
|
|
var currentEventTime = NoTimestamp;
|
|
var currentEventTransitionLane = NoLanes;
|
|
var isRunningInsertionEffect = false;
|
|
function getWorkInProgressRoot() {
|
|
return workInProgressRoot;
|
|
}
|
|
function requestEventTime() {
|
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
return now();
|
|
}
|
|
if (currentEventTime !== NoTimestamp) {
|
|
return currentEventTime;
|
|
}
|
|
currentEventTime = now();
|
|
return currentEventTime;
|
|
}
|
|
function requestUpdateLane(fiber) {
|
|
var mode = fiber.mode;
|
|
if ((mode & ConcurrentMode) === NoMode) {
|
|
return SyncLane;
|
|
} else if ((executionContext & RenderContext) !== NoContext && workInProgressRootRenderLanes !== NoLanes) {
|
|
return pickArbitraryLane(workInProgressRootRenderLanes);
|
|
}
|
|
var isTransition = requestCurrentTransition() !== NoTransition;
|
|
if (isTransition) {
|
|
if (ReactCurrentBatchConfig$3.transition !== null) {
|
|
var transition = ReactCurrentBatchConfig$3.transition;
|
|
if (!transition._updatedFibers) {
|
|
transition._updatedFibers = /* @__PURE__ */ new Set();
|
|
}
|
|
transition._updatedFibers.add(fiber);
|
|
}
|
|
if (currentEventTransitionLane === NoLane) {
|
|
currentEventTransitionLane = claimNextTransitionLane();
|
|
}
|
|
return currentEventTransitionLane;
|
|
}
|
|
var updateLane = getCurrentUpdatePriority();
|
|
if (updateLane !== NoLane) {
|
|
return updateLane;
|
|
}
|
|
var eventLane = getCurrentEventPriority();
|
|
return eventLane;
|
|
}
|
|
function requestRetryLane(fiber) {
|
|
var mode = fiber.mode;
|
|
if ((mode & ConcurrentMode) === NoMode) {
|
|
return SyncLane;
|
|
}
|
|
return claimNextRetryLane();
|
|
}
|
|
function scheduleUpdateOnFiber(root2, fiber, lane, eventTime) {
|
|
checkForNestedUpdates();
|
|
{
|
|
if (isRunningInsertionEffect) {
|
|
error("useInsertionEffect must not schedule updates.");
|
|
}
|
|
}
|
|
{
|
|
if (isFlushingPassiveEffects) {
|
|
didScheduleUpdateDuringPassiveEffects = true;
|
|
}
|
|
}
|
|
markRootUpdated(root2, lane, eventTime);
|
|
if ((executionContext & RenderContext) !== NoLanes && root2 === workInProgressRoot) {
|
|
warnAboutRenderPhaseUpdatesInDEV(fiber);
|
|
} else {
|
|
{
|
|
if (isDevToolsPresent) {
|
|
addFiberToLanesMap(root2, fiber, lane);
|
|
}
|
|
}
|
|
warnIfUpdatesNotWrappedWithActDEV(fiber);
|
|
if (root2 === workInProgressRoot) {
|
|
if ((executionContext & RenderContext) === NoContext) {
|
|
workInProgressRootInterleavedUpdatedLanes = mergeLanes(workInProgressRootInterleavedUpdatedLanes, lane);
|
|
}
|
|
if (workInProgressRootExitStatus === RootSuspendedWithDelay) {
|
|
markRootSuspended$1(root2, workInProgressRootRenderLanes);
|
|
}
|
|
}
|
|
ensureRootIsScheduled(root2, eventTime);
|
|
if (lane === SyncLane && executionContext === NoContext && (fiber.mode & ConcurrentMode) === NoMode && !ReactCurrentActQueue$1.isBatchingLegacy) {
|
|
resetRenderTimer();
|
|
flushSyncCallbacksOnlyInLegacyMode();
|
|
}
|
|
}
|
|
}
|
|
function scheduleInitialHydrationOnRoot(root2, lane, eventTime) {
|
|
var current3 = root2.current;
|
|
current3.lanes = lane;
|
|
markRootUpdated(root2, lane, eventTime);
|
|
ensureRootIsScheduled(root2, eventTime);
|
|
}
|
|
function isUnsafeClassRenderPhaseUpdate(fiber) {
|
|
return (executionContext & RenderContext) !== NoContext;
|
|
}
|
|
function ensureRootIsScheduled(root2, currentTime) {
|
|
var existingCallbackNode = root2.callbackNode;
|
|
markStarvedLanesAsExpired(root2, currentTime);
|
|
var nextLanes = getNextLanes(root2, root2 === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes);
|
|
if (nextLanes === NoLanes) {
|
|
if (existingCallbackNode !== null) {
|
|
cancelCallback$1(existingCallbackNode);
|
|
}
|
|
root2.callbackNode = null;
|
|
root2.callbackPriority = NoLane;
|
|
return;
|
|
}
|
|
var newCallbackPriority = getHighestPriorityLane(nextLanes);
|
|
var existingCallbackPriority = root2.callbackPriority;
|
|
if (existingCallbackPriority === newCallbackPriority && !(ReactCurrentActQueue$1.current !== null && existingCallbackNode !== fakeActCallbackNode)) {
|
|
{
|
|
if (existingCallbackNode == null && existingCallbackPriority !== SyncLane) {
|
|
error("Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
if (existingCallbackNode != null) {
|
|
cancelCallback$1(existingCallbackNode);
|
|
}
|
|
var newCallbackNode;
|
|
if (newCallbackPriority === SyncLane) {
|
|
if (root2.tag === LegacyRoot) {
|
|
if (ReactCurrentActQueue$1.isBatchingLegacy !== null) {
|
|
ReactCurrentActQueue$1.didScheduleLegacyUpdate = true;
|
|
}
|
|
scheduleLegacySyncCallback(performSyncWorkOnRoot.bind(null, root2));
|
|
} else {
|
|
scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root2));
|
|
}
|
|
{
|
|
if (ReactCurrentActQueue$1.current !== null) {
|
|
ReactCurrentActQueue$1.current.push(flushSyncCallbacks);
|
|
} else {
|
|
scheduleMicrotask(function() {
|
|
if ((executionContext & (RenderContext | CommitContext)) === NoContext) {
|
|
flushSyncCallbacks();
|
|
}
|
|
});
|
|
}
|
|
}
|
|
newCallbackNode = null;
|
|
} else {
|
|
var schedulerPriorityLevel;
|
|
switch (lanesToEventPriority(nextLanes)) {
|
|
case DiscreteEventPriority:
|
|
schedulerPriorityLevel = ImmediatePriority;
|
|
break;
|
|
case ContinuousEventPriority:
|
|
schedulerPriorityLevel = UserBlockingPriority;
|
|
break;
|
|
case DefaultEventPriority:
|
|
schedulerPriorityLevel = NormalPriority;
|
|
break;
|
|
case IdleEventPriority:
|
|
schedulerPriorityLevel = IdlePriority;
|
|
break;
|
|
default:
|
|
schedulerPriorityLevel = NormalPriority;
|
|
break;
|
|
}
|
|
newCallbackNode = scheduleCallback$1(schedulerPriorityLevel, performConcurrentWorkOnRoot.bind(null, root2));
|
|
}
|
|
root2.callbackPriority = newCallbackPriority;
|
|
root2.callbackNode = newCallbackNode;
|
|
}
|
|
function performConcurrentWorkOnRoot(root2, didTimeout) {
|
|
{
|
|
resetNestedUpdateFlag();
|
|
}
|
|
currentEventTime = NoTimestamp;
|
|
currentEventTransitionLane = NoLanes;
|
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
throw new Error("Should not already be working.");
|
|
}
|
|
var originalCallbackNode = root2.callbackNode;
|
|
var didFlushPassiveEffects = flushPassiveEffects();
|
|
if (didFlushPassiveEffects) {
|
|
if (root2.callbackNode !== originalCallbackNode) {
|
|
return null;
|
|
}
|
|
}
|
|
var lanes = getNextLanes(root2, root2 === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes);
|
|
if (lanes === NoLanes) {
|
|
return null;
|
|
}
|
|
var shouldTimeSlice = !includesBlockingLane(root2, lanes) && !includesExpiredLane(root2, lanes) && !didTimeout;
|
|
var exitStatus = shouldTimeSlice ? renderRootConcurrent(root2, lanes) : renderRootSync(root2, lanes);
|
|
if (exitStatus !== RootInProgress) {
|
|
if (exitStatus === RootErrored) {
|
|
var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root2);
|
|
if (errorRetryLanes !== NoLanes) {
|
|
lanes = errorRetryLanes;
|
|
exitStatus = recoverFromConcurrentError(root2, errorRetryLanes);
|
|
}
|
|
}
|
|
if (exitStatus === RootFatalErrored) {
|
|
var fatalError = workInProgressRootFatalError;
|
|
prepareFreshStack(root2, NoLanes);
|
|
markRootSuspended$1(root2, lanes);
|
|
ensureRootIsScheduled(root2, now());
|
|
throw fatalError;
|
|
}
|
|
if (exitStatus === RootDidNotComplete) {
|
|
markRootSuspended$1(root2, lanes);
|
|
} else {
|
|
var renderWasConcurrent = !includesBlockingLane(root2, lanes);
|
|
var finishedWork = root2.current.alternate;
|
|
if (renderWasConcurrent && !isRenderConsistentWithExternalStores(finishedWork)) {
|
|
exitStatus = renderRootSync(root2, lanes);
|
|
if (exitStatus === RootErrored) {
|
|
var _errorRetryLanes = getLanesToRetrySynchronouslyOnError(root2);
|
|
if (_errorRetryLanes !== NoLanes) {
|
|
lanes = _errorRetryLanes;
|
|
exitStatus = recoverFromConcurrentError(root2, _errorRetryLanes);
|
|
}
|
|
}
|
|
if (exitStatus === RootFatalErrored) {
|
|
var _fatalError = workInProgressRootFatalError;
|
|
prepareFreshStack(root2, NoLanes);
|
|
markRootSuspended$1(root2, lanes);
|
|
ensureRootIsScheduled(root2, now());
|
|
throw _fatalError;
|
|
}
|
|
}
|
|
root2.finishedWork = finishedWork;
|
|
root2.finishedLanes = lanes;
|
|
finishConcurrentRender(root2, exitStatus, lanes);
|
|
}
|
|
}
|
|
ensureRootIsScheduled(root2, now());
|
|
if (root2.callbackNode === originalCallbackNode) {
|
|
return performConcurrentWorkOnRoot.bind(null, root2);
|
|
}
|
|
return null;
|
|
}
|
|
function recoverFromConcurrentError(root2, errorRetryLanes) {
|
|
var errorsFromFirstAttempt = workInProgressRootConcurrentErrors;
|
|
if (isRootDehydrated(root2)) {
|
|
var rootWorkInProgress = prepareFreshStack(root2, errorRetryLanes);
|
|
rootWorkInProgress.flags |= ForceClientRender;
|
|
{
|
|
errorHydratingContainer(root2.containerInfo);
|
|
}
|
|
}
|
|
var exitStatus = renderRootSync(root2, errorRetryLanes);
|
|
if (exitStatus !== RootErrored) {
|
|
var errorsFromSecondAttempt = workInProgressRootRecoverableErrors;
|
|
workInProgressRootRecoverableErrors = errorsFromFirstAttempt;
|
|
if (errorsFromSecondAttempt !== null) {
|
|
queueRecoverableErrors(errorsFromSecondAttempt);
|
|
}
|
|
}
|
|
return exitStatus;
|
|
}
|
|
function queueRecoverableErrors(errors2) {
|
|
if (workInProgressRootRecoverableErrors === null) {
|
|
workInProgressRootRecoverableErrors = errors2;
|
|
} else {
|
|
workInProgressRootRecoverableErrors.push.apply(workInProgressRootRecoverableErrors, errors2);
|
|
}
|
|
}
|
|
function finishConcurrentRender(root2, exitStatus, lanes) {
|
|
switch (exitStatus) {
|
|
case RootInProgress:
|
|
case RootFatalErrored: {
|
|
throw new Error("Root did not complete. This is a bug in React.");
|
|
}
|
|
case RootErrored: {
|
|
commitRoot(root2, workInProgressRootRecoverableErrors, workInProgressTransitions);
|
|
break;
|
|
}
|
|
case RootSuspended: {
|
|
markRootSuspended$1(root2, lanes);
|
|
if (includesOnlyRetries(lanes) && !shouldForceFlushFallbacksInDEV()) {
|
|
var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now();
|
|
if (msUntilTimeout > 10) {
|
|
var nextLanes = getNextLanes(root2, NoLanes);
|
|
if (nextLanes !== NoLanes) {
|
|
break;
|
|
}
|
|
var suspendedLanes = root2.suspendedLanes;
|
|
if (!isSubsetOfLanes(suspendedLanes, lanes)) {
|
|
var eventTime = requestEventTime();
|
|
markRootPinged(root2, suspendedLanes);
|
|
break;
|
|
}
|
|
root2.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root2, workInProgressRootRecoverableErrors, workInProgressTransitions), msUntilTimeout);
|
|
break;
|
|
}
|
|
}
|
|
commitRoot(root2, workInProgressRootRecoverableErrors, workInProgressTransitions);
|
|
break;
|
|
}
|
|
case RootSuspendedWithDelay: {
|
|
markRootSuspended$1(root2, lanes);
|
|
if (includesOnlyTransitions(lanes)) {
|
|
break;
|
|
}
|
|
if (!shouldForceFlushFallbacksInDEV()) {
|
|
var mostRecentEventTime = getMostRecentEventTime(root2, lanes);
|
|
var eventTimeMs = mostRecentEventTime;
|
|
var timeElapsedMs = now() - eventTimeMs;
|
|
var _msUntilTimeout = jnd(timeElapsedMs) - timeElapsedMs;
|
|
if (_msUntilTimeout > 10) {
|
|
root2.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root2, workInProgressRootRecoverableErrors, workInProgressTransitions), _msUntilTimeout);
|
|
break;
|
|
}
|
|
}
|
|
commitRoot(root2, workInProgressRootRecoverableErrors, workInProgressTransitions);
|
|
break;
|
|
}
|
|
case RootCompleted: {
|
|
commitRoot(root2, workInProgressRootRecoverableErrors, workInProgressTransitions);
|
|
break;
|
|
}
|
|
default: {
|
|
throw new Error("Unknown root exit status.");
|
|
}
|
|
}
|
|
}
|
|
function isRenderConsistentWithExternalStores(finishedWork) {
|
|
var node = finishedWork;
|
|
while (true) {
|
|
if (node.flags & StoreConsistency) {
|
|
var updateQueue = node.updateQueue;
|
|
if (updateQueue !== null) {
|
|
var checks = updateQueue.stores;
|
|
if (checks !== null) {
|
|
for (var i = 0; i < checks.length; i++) {
|
|
var check = checks[i];
|
|
var getSnapshot = check.getSnapshot;
|
|
var renderedValue = check.value;
|
|
try {
|
|
if (!objectIs(getSnapshot(), renderedValue)) {
|
|
return false;
|
|
}
|
|
} catch (error2) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var child = node.child;
|
|
if (node.subtreeFlags & StoreConsistency && child !== null) {
|
|
child.return = node;
|
|
node = child;
|
|
continue;
|
|
}
|
|
if (node === finishedWork) {
|
|
return true;
|
|
}
|
|
while (node.sibling === null) {
|
|
if (node.return === null || node.return === finishedWork) {
|
|
return true;
|
|
}
|
|
node = node.return;
|
|
}
|
|
node.sibling.return = node.return;
|
|
node = node.sibling;
|
|
}
|
|
return true;
|
|
}
|
|
function markRootSuspended$1(root2, suspendedLanes) {
|
|
suspendedLanes = removeLanes(suspendedLanes, workInProgressRootPingedLanes);
|
|
suspendedLanes = removeLanes(suspendedLanes, workInProgressRootInterleavedUpdatedLanes);
|
|
markRootSuspended(root2, suspendedLanes);
|
|
}
|
|
function performSyncWorkOnRoot(root2) {
|
|
{
|
|
syncNestedUpdateFlag();
|
|
}
|
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
throw new Error("Should not already be working.");
|
|
}
|
|
flushPassiveEffects();
|
|
var lanes = getNextLanes(root2, NoLanes);
|
|
if (!includesSomeLane(lanes, SyncLane)) {
|
|
ensureRootIsScheduled(root2, now());
|
|
return null;
|
|
}
|
|
var exitStatus = renderRootSync(root2, lanes);
|
|
if (root2.tag !== LegacyRoot && exitStatus === RootErrored) {
|
|
var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root2);
|
|
if (errorRetryLanes !== NoLanes) {
|
|
lanes = errorRetryLanes;
|
|
exitStatus = recoverFromConcurrentError(root2, errorRetryLanes);
|
|
}
|
|
}
|
|
if (exitStatus === RootFatalErrored) {
|
|
var fatalError = workInProgressRootFatalError;
|
|
prepareFreshStack(root2, NoLanes);
|
|
markRootSuspended$1(root2, lanes);
|
|
ensureRootIsScheduled(root2, now());
|
|
throw fatalError;
|
|
}
|
|
if (exitStatus === RootDidNotComplete) {
|
|
throw new Error("Root did not complete. This is a bug in React.");
|
|
}
|
|
var finishedWork = root2.current.alternate;
|
|
root2.finishedWork = finishedWork;
|
|
root2.finishedLanes = lanes;
|
|
commitRoot(root2, workInProgressRootRecoverableErrors, workInProgressTransitions);
|
|
ensureRootIsScheduled(root2, now());
|
|
return null;
|
|
}
|
|
function flushRoot(root2, lanes) {
|
|
if (lanes !== NoLanes) {
|
|
markRootEntangled(root2, mergeLanes(lanes, SyncLane));
|
|
ensureRootIsScheduled(root2, now());
|
|
if ((executionContext & (RenderContext | CommitContext)) === NoContext) {
|
|
resetRenderTimer();
|
|
flushSyncCallbacks();
|
|
}
|
|
}
|
|
}
|
|
function batchedUpdates$1(fn, a) {
|
|
var prevExecutionContext = executionContext;
|
|
executionContext |= BatchedContext;
|
|
try {
|
|
return fn(a);
|
|
} finally {
|
|
executionContext = prevExecutionContext;
|
|
if (executionContext === NoContext && !ReactCurrentActQueue$1.isBatchingLegacy) {
|
|
resetRenderTimer();
|
|
flushSyncCallbacksOnlyInLegacyMode();
|
|
}
|
|
}
|
|
}
|
|
function discreteUpdates(fn, a, b, c, d2) {
|
|
var previousPriority = getCurrentUpdatePriority();
|
|
var prevTransition = ReactCurrentBatchConfig$3.transition;
|
|
try {
|
|
ReactCurrentBatchConfig$3.transition = null;
|
|
setCurrentUpdatePriority(DiscreteEventPriority);
|
|
return fn(a, b, c, d2);
|
|
} finally {
|
|
setCurrentUpdatePriority(previousPriority);
|
|
ReactCurrentBatchConfig$3.transition = prevTransition;
|
|
if (executionContext === NoContext) {
|
|
resetRenderTimer();
|
|
}
|
|
}
|
|
}
|
|
function flushSync(fn) {
|
|
if (rootWithPendingPassiveEffects !== null && rootWithPendingPassiveEffects.tag === LegacyRoot && (executionContext & (RenderContext | CommitContext)) === NoContext) {
|
|
flushPassiveEffects();
|
|
}
|
|
var prevExecutionContext = executionContext;
|
|
executionContext |= BatchedContext;
|
|
var prevTransition = ReactCurrentBatchConfig$3.transition;
|
|
var previousPriority = getCurrentUpdatePriority();
|
|
try {
|
|
ReactCurrentBatchConfig$3.transition = null;
|
|
setCurrentUpdatePriority(DiscreteEventPriority);
|
|
if (fn) {
|
|
return fn();
|
|
} else {
|
|
return void 0;
|
|
}
|
|
} finally {
|
|
setCurrentUpdatePriority(previousPriority);
|
|
ReactCurrentBatchConfig$3.transition = prevTransition;
|
|
executionContext = prevExecutionContext;
|
|
if ((executionContext & (RenderContext | CommitContext)) === NoContext) {
|
|
flushSyncCallbacks();
|
|
}
|
|
}
|
|
}
|
|
function isAlreadyRendering() {
|
|
return (executionContext & (RenderContext | CommitContext)) !== NoContext;
|
|
}
|
|
function pushRenderLanes(fiber, lanes) {
|
|
push(subtreeRenderLanesCursor, subtreeRenderLanes, fiber);
|
|
subtreeRenderLanes = mergeLanes(subtreeRenderLanes, lanes);
|
|
workInProgressRootIncludedLanes = mergeLanes(workInProgressRootIncludedLanes, lanes);
|
|
}
|
|
function popRenderLanes(fiber) {
|
|
subtreeRenderLanes = subtreeRenderLanesCursor.current;
|
|
pop(subtreeRenderLanesCursor, fiber);
|
|
}
|
|
function prepareFreshStack(root2, lanes) {
|
|
root2.finishedWork = null;
|
|
root2.finishedLanes = NoLanes;
|
|
var timeoutHandle = root2.timeoutHandle;
|
|
if (timeoutHandle !== noTimeout) {
|
|
root2.timeoutHandle = noTimeout;
|
|
cancelTimeout(timeoutHandle);
|
|
}
|
|
if (workInProgress !== null) {
|
|
var interruptedWork = workInProgress.return;
|
|
while (interruptedWork !== null) {
|
|
var current3 = interruptedWork.alternate;
|
|
unwindInterruptedWork(current3, interruptedWork);
|
|
interruptedWork = interruptedWork.return;
|
|
}
|
|
}
|
|
workInProgressRoot = root2;
|
|
var rootWorkInProgress = createWorkInProgress(root2.current, null);
|
|
workInProgress = rootWorkInProgress;
|
|
workInProgressRootRenderLanes = subtreeRenderLanes = workInProgressRootIncludedLanes = lanes;
|
|
workInProgressRootExitStatus = RootInProgress;
|
|
workInProgressRootFatalError = null;
|
|
workInProgressRootSkippedLanes = NoLanes;
|
|
workInProgressRootInterleavedUpdatedLanes = NoLanes;
|
|
workInProgressRootPingedLanes = NoLanes;
|
|
workInProgressRootConcurrentErrors = null;
|
|
workInProgressRootRecoverableErrors = null;
|
|
finishQueueingConcurrentUpdates();
|
|
{
|
|
ReactStrictModeWarnings.discardPendingWarnings();
|
|
}
|
|
return rootWorkInProgress;
|
|
}
|
|
function handleError(root2, thrownValue) {
|
|
do {
|
|
var erroredWork = workInProgress;
|
|
try {
|
|
resetContextDependencies();
|
|
resetHooksAfterThrow();
|
|
resetCurrentFiber();
|
|
ReactCurrentOwner$2.current = null;
|
|
if (erroredWork === null || erroredWork.return === null) {
|
|
workInProgressRootExitStatus = RootFatalErrored;
|
|
workInProgressRootFatalError = thrownValue;
|
|
workInProgress = null;
|
|
return;
|
|
}
|
|
if (enableProfilerTimer && erroredWork.mode & ProfileMode) {
|
|
stopProfilerTimerIfRunningAndRecordDelta(erroredWork, true);
|
|
}
|
|
if (enableSchedulingProfiler) {
|
|
markComponentRenderStopped();
|
|
if (thrownValue !== null && typeof thrownValue === "object" && typeof thrownValue.then === "function") {
|
|
var wakeable = thrownValue;
|
|
markComponentSuspended(erroredWork, wakeable, workInProgressRootRenderLanes);
|
|
} else {
|
|
markComponentErrored(erroredWork, thrownValue, workInProgressRootRenderLanes);
|
|
}
|
|
}
|
|
throwException(root2, erroredWork.return, erroredWork, thrownValue, workInProgressRootRenderLanes);
|
|
completeUnitOfWork(erroredWork);
|
|
} catch (yetAnotherThrownValue) {
|
|
thrownValue = yetAnotherThrownValue;
|
|
if (workInProgress === erroredWork && erroredWork !== null) {
|
|
erroredWork = erroredWork.return;
|
|
workInProgress = erroredWork;
|
|
} else {
|
|
erroredWork = workInProgress;
|
|
}
|
|
continue;
|
|
}
|
|
return;
|
|
} while (true);
|
|
}
|
|
function pushDispatcher() {
|
|
var prevDispatcher = ReactCurrentDispatcher$2.current;
|
|
ReactCurrentDispatcher$2.current = ContextOnlyDispatcher;
|
|
if (prevDispatcher === null) {
|
|
return ContextOnlyDispatcher;
|
|
} else {
|
|
return prevDispatcher;
|
|
}
|
|
}
|
|
function popDispatcher(prevDispatcher) {
|
|
ReactCurrentDispatcher$2.current = prevDispatcher;
|
|
}
|
|
function markCommitTimeOfFallback() {
|
|
globalMostRecentFallbackTime = now();
|
|
}
|
|
function markSkippedUpdateLanes(lane) {
|
|
workInProgressRootSkippedLanes = mergeLanes(lane, workInProgressRootSkippedLanes);
|
|
}
|
|
function renderDidSuspend() {
|
|
if (workInProgressRootExitStatus === RootInProgress) {
|
|
workInProgressRootExitStatus = RootSuspended;
|
|
}
|
|
}
|
|
function renderDidSuspendDelayIfPossible() {
|
|
if (workInProgressRootExitStatus === RootInProgress || workInProgressRootExitStatus === RootSuspended || workInProgressRootExitStatus === RootErrored) {
|
|
workInProgressRootExitStatus = RootSuspendedWithDelay;
|
|
}
|
|
if (workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes))) {
|
|
markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes);
|
|
}
|
|
}
|
|
function renderDidError(error2) {
|
|
if (workInProgressRootExitStatus !== RootSuspendedWithDelay) {
|
|
workInProgressRootExitStatus = RootErrored;
|
|
}
|
|
if (workInProgressRootConcurrentErrors === null) {
|
|
workInProgressRootConcurrentErrors = [error2];
|
|
} else {
|
|
workInProgressRootConcurrentErrors.push(error2);
|
|
}
|
|
}
|
|
function renderHasNotSuspendedYet() {
|
|
return workInProgressRootExitStatus === RootInProgress;
|
|
}
|
|
function renderRootSync(root2, lanes) {
|
|
var prevExecutionContext = executionContext;
|
|
executionContext |= RenderContext;
|
|
var prevDispatcher = pushDispatcher();
|
|
if (workInProgressRoot !== root2 || workInProgressRootRenderLanes !== lanes) {
|
|
{
|
|
if (isDevToolsPresent) {
|
|
var memoizedUpdaters = root2.memoizedUpdaters;
|
|
if (memoizedUpdaters.size > 0) {
|
|
restorePendingUpdaters(root2, workInProgressRootRenderLanes);
|
|
memoizedUpdaters.clear();
|
|
}
|
|
movePendingFibersToMemoized(root2, lanes);
|
|
}
|
|
}
|
|
workInProgressTransitions = getTransitionsForLanes();
|
|
prepareFreshStack(root2, lanes);
|
|
}
|
|
{
|
|
markRenderStarted(lanes);
|
|
}
|
|
do {
|
|
try {
|
|
workLoopSync();
|
|
break;
|
|
} catch (thrownValue) {
|
|
handleError(root2, thrownValue);
|
|
}
|
|
} while (true);
|
|
resetContextDependencies();
|
|
executionContext = prevExecutionContext;
|
|
popDispatcher(prevDispatcher);
|
|
if (workInProgress !== null) {
|
|
throw new Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
{
|
|
markRenderStopped();
|
|
}
|
|
workInProgressRoot = null;
|
|
workInProgressRootRenderLanes = NoLanes;
|
|
return workInProgressRootExitStatus;
|
|
}
|
|
function workLoopSync() {
|
|
while (workInProgress !== null) {
|
|
performUnitOfWork(workInProgress);
|
|
}
|
|
}
|
|
function renderRootConcurrent(root2, lanes) {
|
|
var prevExecutionContext = executionContext;
|
|
executionContext |= RenderContext;
|
|
var prevDispatcher = pushDispatcher();
|
|
if (workInProgressRoot !== root2 || workInProgressRootRenderLanes !== lanes) {
|
|
{
|
|
if (isDevToolsPresent) {
|
|
var memoizedUpdaters = root2.memoizedUpdaters;
|
|
if (memoizedUpdaters.size > 0) {
|
|
restorePendingUpdaters(root2, workInProgressRootRenderLanes);
|
|
memoizedUpdaters.clear();
|
|
}
|
|
movePendingFibersToMemoized(root2, lanes);
|
|
}
|
|
}
|
|
workInProgressTransitions = getTransitionsForLanes();
|
|
resetRenderTimer();
|
|
prepareFreshStack(root2, lanes);
|
|
}
|
|
{
|
|
markRenderStarted(lanes);
|
|
}
|
|
do {
|
|
try {
|
|
workLoopConcurrent();
|
|
break;
|
|
} catch (thrownValue) {
|
|
handleError(root2, thrownValue);
|
|
}
|
|
} while (true);
|
|
resetContextDependencies();
|
|
popDispatcher(prevDispatcher);
|
|
executionContext = prevExecutionContext;
|
|
if (workInProgress !== null) {
|
|
{
|
|
markRenderYielded();
|
|
}
|
|
return RootInProgress;
|
|
} else {
|
|
{
|
|
markRenderStopped();
|
|
}
|
|
workInProgressRoot = null;
|
|
workInProgressRootRenderLanes = NoLanes;
|
|
return workInProgressRootExitStatus;
|
|
}
|
|
}
|
|
function workLoopConcurrent() {
|
|
while (workInProgress !== null && !shouldYield()) {
|
|
performUnitOfWork(workInProgress);
|
|
}
|
|
}
|
|
function performUnitOfWork(unitOfWork) {
|
|
var current3 = unitOfWork.alternate;
|
|
setCurrentFiber(unitOfWork);
|
|
var next;
|
|
if ((unitOfWork.mode & ProfileMode) !== NoMode) {
|
|
startProfilerTimer(unitOfWork);
|
|
next = beginWork$1(current3, unitOfWork, subtreeRenderLanes);
|
|
stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true);
|
|
} else {
|
|
next = beginWork$1(current3, unitOfWork, subtreeRenderLanes);
|
|
}
|
|
resetCurrentFiber();
|
|
unitOfWork.memoizedProps = unitOfWork.pendingProps;
|
|
if (next === null) {
|
|
completeUnitOfWork(unitOfWork);
|
|
} else {
|
|
workInProgress = next;
|
|
}
|
|
ReactCurrentOwner$2.current = null;
|
|
}
|
|
function completeUnitOfWork(unitOfWork) {
|
|
var completedWork = unitOfWork;
|
|
do {
|
|
var current3 = completedWork.alternate;
|
|
var returnFiber = completedWork.return;
|
|
if ((completedWork.flags & Incomplete) === NoFlags) {
|
|
setCurrentFiber(completedWork);
|
|
var next = void 0;
|
|
if ((completedWork.mode & ProfileMode) === NoMode) {
|
|
next = completeWork(current3, completedWork, subtreeRenderLanes);
|
|
} else {
|
|
startProfilerTimer(completedWork);
|
|
next = completeWork(current3, completedWork, subtreeRenderLanes);
|
|
stopProfilerTimerIfRunningAndRecordDelta(completedWork, false);
|
|
}
|
|
resetCurrentFiber();
|
|
if (next !== null) {
|
|
workInProgress = next;
|
|
return;
|
|
}
|
|
} else {
|
|
var _next = unwindWork(current3, completedWork);
|
|
if (_next !== null) {
|
|
_next.flags &= HostEffectMask;
|
|
workInProgress = _next;
|
|
return;
|
|
}
|
|
if ((completedWork.mode & ProfileMode) !== NoMode) {
|
|
stopProfilerTimerIfRunningAndRecordDelta(completedWork, false);
|
|
var actualDuration = completedWork.actualDuration;
|
|
var child = completedWork.child;
|
|
while (child !== null) {
|
|
actualDuration += child.actualDuration;
|
|
child = child.sibling;
|
|
}
|
|
completedWork.actualDuration = actualDuration;
|
|
}
|
|
if (returnFiber !== null) {
|
|
returnFiber.flags |= Incomplete;
|
|
returnFiber.subtreeFlags = NoFlags;
|
|
returnFiber.deletions = null;
|
|
} else {
|
|
workInProgressRootExitStatus = RootDidNotComplete;
|
|
workInProgress = null;
|
|
return;
|
|
}
|
|
}
|
|
var siblingFiber = completedWork.sibling;
|
|
if (siblingFiber !== null) {
|
|
workInProgress = siblingFiber;
|
|
return;
|
|
}
|
|
completedWork = returnFiber;
|
|
workInProgress = completedWork;
|
|
} while (completedWork !== null);
|
|
if (workInProgressRootExitStatus === RootInProgress) {
|
|
workInProgressRootExitStatus = RootCompleted;
|
|
}
|
|
}
|
|
function commitRoot(root2, recoverableErrors, transitions) {
|
|
var previousUpdateLanePriority = getCurrentUpdatePriority();
|
|
var prevTransition = ReactCurrentBatchConfig$3.transition;
|
|
try {
|
|
ReactCurrentBatchConfig$3.transition = null;
|
|
setCurrentUpdatePriority(DiscreteEventPriority);
|
|
commitRootImpl(root2, recoverableErrors, transitions, previousUpdateLanePriority);
|
|
} finally {
|
|
ReactCurrentBatchConfig$3.transition = prevTransition;
|
|
setCurrentUpdatePriority(previousUpdateLanePriority);
|
|
}
|
|
return null;
|
|
}
|
|
function commitRootImpl(root2, recoverableErrors, transitions, renderPriorityLevel) {
|
|
do {
|
|
flushPassiveEffects();
|
|
} while (rootWithPendingPassiveEffects !== null);
|
|
flushRenderPhaseStrictModeWarningsInDEV();
|
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
throw new Error("Should not already be working.");
|
|
}
|
|
var finishedWork = root2.finishedWork;
|
|
var lanes = root2.finishedLanes;
|
|
{
|
|
markCommitStarted(lanes);
|
|
}
|
|
if (finishedWork === null) {
|
|
{
|
|
markCommitStopped();
|
|
}
|
|
return null;
|
|
} else {
|
|
{
|
|
if (lanes === NoLanes) {
|
|
error("root.finishedLanes should not be empty during a commit. This is a bug in React.");
|
|
}
|
|
}
|
|
}
|
|
root2.finishedWork = null;
|
|
root2.finishedLanes = NoLanes;
|
|
if (finishedWork === root2.current) {
|
|
throw new Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue.");
|
|
}
|
|
root2.callbackNode = null;
|
|
root2.callbackPriority = NoLane;
|
|
var remainingLanes = mergeLanes(finishedWork.lanes, finishedWork.childLanes);
|
|
markRootFinished(root2, remainingLanes);
|
|
if (root2 === workInProgressRoot) {
|
|
workInProgressRoot = null;
|
|
workInProgress = null;
|
|
workInProgressRootRenderLanes = NoLanes;
|
|
}
|
|
if ((finishedWork.subtreeFlags & PassiveMask) !== NoFlags || (finishedWork.flags & PassiveMask) !== NoFlags) {
|
|
if (!rootDoesHavePassiveEffects) {
|
|
rootDoesHavePassiveEffects = true;
|
|
pendingPassiveTransitions = transitions;
|
|
scheduleCallback$1(NormalPriority, function() {
|
|
flushPassiveEffects();
|
|
return null;
|
|
});
|
|
}
|
|
}
|
|
var subtreeHasEffects = (finishedWork.subtreeFlags & (BeforeMutationMask | MutationMask | LayoutMask | PassiveMask)) !== NoFlags;
|
|
var rootHasEffect = (finishedWork.flags & (BeforeMutationMask | MutationMask | LayoutMask | PassiveMask)) !== NoFlags;
|
|
if (subtreeHasEffects || rootHasEffect) {
|
|
var prevTransition = ReactCurrentBatchConfig$3.transition;
|
|
ReactCurrentBatchConfig$3.transition = null;
|
|
var previousPriority = getCurrentUpdatePriority();
|
|
setCurrentUpdatePriority(DiscreteEventPriority);
|
|
var prevExecutionContext = executionContext;
|
|
executionContext |= CommitContext;
|
|
ReactCurrentOwner$2.current = null;
|
|
var shouldFireAfterActiveInstanceBlur2 = commitBeforeMutationEffects(root2, finishedWork);
|
|
{
|
|
recordCommitTime();
|
|
}
|
|
commitMutationEffects(root2, finishedWork, lanes);
|
|
resetAfterCommit(root2.containerInfo);
|
|
root2.current = finishedWork;
|
|
{
|
|
markLayoutEffectsStarted(lanes);
|
|
}
|
|
commitLayoutEffects(finishedWork, root2, lanes);
|
|
{
|
|
markLayoutEffectsStopped();
|
|
}
|
|
requestPaint();
|
|
executionContext = prevExecutionContext;
|
|
setCurrentUpdatePriority(previousPriority);
|
|
ReactCurrentBatchConfig$3.transition = prevTransition;
|
|
} else {
|
|
root2.current = finishedWork;
|
|
{
|
|
recordCommitTime();
|
|
}
|
|
}
|
|
var rootDidHavePassiveEffects = rootDoesHavePassiveEffects;
|
|
if (rootDoesHavePassiveEffects) {
|
|
rootDoesHavePassiveEffects = false;
|
|
rootWithPendingPassiveEffects = root2;
|
|
pendingPassiveEffectsLanes = lanes;
|
|
} else {
|
|
{
|
|
nestedPassiveUpdateCount = 0;
|
|
rootWithPassiveNestedUpdates = null;
|
|
}
|
|
}
|
|
remainingLanes = root2.pendingLanes;
|
|
if (remainingLanes === NoLanes) {
|
|
legacyErrorBoundariesThatAlreadyFailed = null;
|
|
}
|
|
{
|
|
if (!rootDidHavePassiveEffects) {
|
|
commitDoubleInvokeEffectsInDEV(root2.current, false);
|
|
}
|
|
}
|
|
onCommitRoot(finishedWork.stateNode, renderPriorityLevel);
|
|
{
|
|
if (isDevToolsPresent) {
|
|
root2.memoizedUpdaters.clear();
|
|
}
|
|
}
|
|
{
|
|
onCommitRoot$1();
|
|
}
|
|
ensureRootIsScheduled(root2, now());
|
|
if (recoverableErrors !== null) {
|
|
var onRecoverableError = root2.onRecoverableError;
|
|
for (var i = 0; i < recoverableErrors.length; i++) {
|
|
var recoverableError = recoverableErrors[i];
|
|
var componentStack = recoverableError.stack;
|
|
var digest = recoverableError.digest;
|
|
onRecoverableError(recoverableError.value, {
|
|
componentStack,
|
|
digest
|
|
});
|
|
}
|
|
}
|
|
if (hasUncaughtError) {
|
|
hasUncaughtError = false;
|
|
var error$1 = firstUncaughtError;
|
|
firstUncaughtError = null;
|
|
throw error$1;
|
|
}
|
|
if (includesSomeLane(pendingPassiveEffectsLanes, SyncLane) && root2.tag !== LegacyRoot) {
|
|
flushPassiveEffects();
|
|
}
|
|
remainingLanes = root2.pendingLanes;
|
|
if (includesSomeLane(remainingLanes, SyncLane)) {
|
|
{
|
|
markNestedUpdateScheduled();
|
|
}
|
|
if (root2 === rootWithNestedUpdates) {
|
|
nestedUpdateCount++;
|
|
} else {
|
|
nestedUpdateCount = 0;
|
|
rootWithNestedUpdates = root2;
|
|
}
|
|
} else {
|
|
nestedUpdateCount = 0;
|
|
}
|
|
flushSyncCallbacks();
|
|
{
|
|
markCommitStopped();
|
|
}
|
|
return null;
|
|
}
|
|
function flushPassiveEffects() {
|
|
if (rootWithPendingPassiveEffects !== null) {
|
|
var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes);
|
|
var priority = lowerEventPriority(DefaultEventPriority, renderPriority);
|
|
var prevTransition = ReactCurrentBatchConfig$3.transition;
|
|
var previousPriority = getCurrentUpdatePriority();
|
|
try {
|
|
ReactCurrentBatchConfig$3.transition = null;
|
|
setCurrentUpdatePriority(priority);
|
|
return flushPassiveEffectsImpl();
|
|
} finally {
|
|
setCurrentUpdatePriority(previousPriority);
|
|
ReactCurrentBatchConfig$3.transition = prevTransition;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
function enqueuePendingPassiveProfilerEffect(fiber) {
|
|
{
|
|
pendingPassiveProfilerEffects.push(fiber);
|
|
if (!rootDoesHavePassiveEffects) {
|
|
rootDoesHavePassiveEffects = true;
|
|
scheduleCallback$1(NormalPriority, function() {
|
|
flushPassiveEffects();
|
|
return null;
|
|
});
|
|
}
|
|
}
|
|
}
|
|
function flushPassiveEffectsImpl() {
|
|
if (rootWithPendingPassiveEffects === null) {
|
|
return false;
|
|
}
|
|
var transitions = pendingPassiveTransitions;
|
|
pendingPassiveTransitions = null;
|
|
var root2 = rootWithPendingPassiveEffects;
|
|
var lanes = pendingPassiveEffectsLanes;
|
|
rootWithPendingPassiveEffects = null;
|
|
pendingPassiveEffectsLanes = NoLanes;
|
|
if ((executionContext & (RenderContext | CommitContext)) !== NoContext) {
|
|
throw new Error("Cannot flush passive effects while already rendering.");
|
|
}
|
|
{
|
|
isFlushingPassiveEffects = true;
|
|
didScheduleUpdateDuringPassiveEffects = false;
|
|
}
|
|
{
|
|
markPassiveEffectsStarted(lanes);
|
|
}
|
|
var prevExecutionContext = executionContext;
|
|
executionContext |= CommitContext;
|
|
commitPassiveUnmountEffects(root2.current);
|
|
commitPassiveMountEffects(root2, root2.current, lanes, transitions);
|
|
{
|
|
var profilerEffects = pendingPassiveProfilerEffects;
|
|
pendingPassiveProfilerEffects = [];
|
|
for (var i = 0; i < profilerEffects.length; i++) {
|
|
var _fiber = profilerEffects[i];
|
|
commitPassiveEffectDurations(root2, _fiber);
|
|
}
|
|
}
|
|
{
|
|
markPassiveEffectsStopped();
|
|
}
|
|
{
|
|
commitDoubleInvokeEffectsInDEV(root2.current, true);
|
|
}
|
|
executionContext = prevExecutionContext;
|
|
flushSyncCallbacks();
|
|
{
|
|
if (didScheduleUpdateDuringPassiveEffects) {
|
|
if (root2 === rootWithPassiveNestedUpdates) {
|
|
nestedPassiveUpdateCount++;
|
|
} else {
|
|
nestedPassiveUpdateCount = 0;
|
|
rootWithPassiveNestedUpdates = root2;
|
|
}
|
|
} else {
|
|
nestedPassiveUpdateCount = 0;
|
|
}
|
|
isFlushingPassiveEffects = false;
|
|
didScheduleUpdateDuringPassiveEffects = false;
|
|
}
|
|
onPostCommitRoot(root2);
|
|
{
|
|
var stateNode = root2.current.stateNode;
|
|
stateNode.effectDuration = 0;
|
|
stateNode.passiveEffectDuration = 0;
|
|
}
|
|
return true;
|
|
}
|
|
function isAlreadyFailedLegacyErrorBoundary(instance) {
|
|
return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance);
|
|
}
|
|
function markLegacyErrorBoundaryAsFailed(instance) {
|
|
if (legacyErrorBoundariesThatAlreadyFailed === null) {
|
|
legacyErrorBoundariesThatAlreadyFailed = /* @__PURE__ */ new Set([instance]);
|
|
} else {
|
|
legacyErrorBoundariesThatAlreadyFailed.add(instance);
|
|
}
|
|
}
|
|
function prepareToThrowUncaughtError(error2) {
|
|
if (!hasUncaughtError) {
|
|
hasUncaughtError = true;
|
|
firstUncaughtError = error2;
|
|
}
|
|
}
|
|
var onUncaughtError = prepareToThrowUncaughtError;
|
|
function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error2) {
|
|
var errorInfo = createCapturedValueAtFiber(error2, sourceFiber);
|
|
var update = createRootErrorUpdate(rootFiber, errorInfo, SyncLane);
|
|
var root2 = enqueueUpdate(rootFiber, update, SyncLane);
|
|
var eventTime = requestEventTime();
|
|
if (root2 !== null) {
|
|
markRootUpdated(root2, SyncLane, eventTime);
|
|
ensureRootIsScheduled(root2, eventTime);
|
|
}
|
|
}
|
|
function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error$1) {
|
|
{
|
|
reportUncaughtErrorInDEV(error$1);
|
|
setIsRunningInsertionEffect(false);
|
|
}
|
|
if (sourceFiber.tag === HostRoot) {
|
|
captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error$1);
|
|
return;
|
|
}
|
|
var fiber = null;
|
|
{
|
|
fiber = nearestMountedAncestor;
|
|
}
|
|
while (fiber !== null) {
|
|
if (fiber.tag === HostRoot) {
|
|
captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error$1);
|
|
return;
|
|
} else if (fiber.tag === ClassComponent) {
|
|
var ctor = fiber.type;
|
|
var instance = fiber.stateNode;
|
|
if (typeof ctor.getDerivedStateFromError === "function" || typeof instance.componentDidCatch === "function" && !isAlreadyFailedLegacyErrorBoundary(instance)) {
|
|
var errorInfo = createCapturedValueAtFiber(error$1, sourceFiber);
|
|
var update = createClassErrorUpdate(fiber, errorInfo, SyncLane);
|
|
var root2 = enqueueUpdate(fiber, update, SyncLane);
|
|
var eventTime = requestEventTime();
|
|
if (root2 !== null) {
|
|
markRootUpdated(root2, SyncLane, eventTime);
|
|
ensureRootIsScheduled(root2, eventTime);
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
fiber = fiber.return;
|
|
}
|
|
{
|
|
error("Internal React error: Attempted to capture a commit phase error inside a detached tree. This indicates a bug in React. Likely causes include deleting the same fiber more than once, committing an already-finished tree, or an inconsistent return pointer.\n\nError message:\n\n%s", error$1);
|
|
}
|
|
}
|
|
function pingSuspendedRoot(root2, wakeable, pingedLanes) {
|
|
var pingCache = root2.pingCache;
|
|
if (pingCache !== null) {
|
|
pingCache.delete(wakeable);
|
|
}
|
|
var eventTime = requestEventTime();
|
|
markRootPinged(root2, pingedLanes);
|
|
warnIfSuspenseResolutionNotWrappedWithActDEV(root2);
|
|
if (workInProgressRoot === root2 && isSubsetOfLanes(workInProgressRootRenderLanes, pingedLanes)) {
|
|
if (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && includesOnlyRetries(workInProgressRootRenderLanes) && now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) {
|
|
prepareFreshStack(root2, NoLanes);
|
|
} else {
|
|
workInProgressRootPingedLanes = mergeLanes(workInProgressRootPingedLanes, pingedLanes);
|
|
}
|
|
}
|
|
ensureRootIsScheduled(root2, eventTime);
|
|
}
|
|
function retryTimedOutBoundary(boundaryFiber, retryLane) {
|
|
if (retryLane === NoLane) {
|
|
retryLane = requestRetryLane(boundaryFiber);
|
|
}
|
|
var eventTime = requestEventTime();
|
|
var root2 = enqueueConcurrentRenderForLane(boundaryFiber, retryLane);
|
|
if (root2 !== null) {
|
|
markRootUpdated(root2, retryLane, eventTime);
|
|
ensureRootIsScheduled(root2, eventTime);
|
|
}
|
|
}
|
|
function retryDehydratedSuspenseBoundary(boundaryFiber) {
|
|
var suspenseState = boundaryFiber.memoizedState;
|
|
var retryLane = NoLane;
|
|
if (suspenseState !== null) {
|
|
retryLane = suspenseState.retryLane;
|
|
}
|
|
retryTimedOutBoundary(boundaryFiber, retryLane);
|
|
}
|
|
function resolveRetryWakeable(boundaryFiber, wakeable) {
|
|
var retryLane = NoLane;
|
|
var retryCache;
|
|
switch (boundaryFiber.tag) {
|
|
case SuspenseComponent:
|
|
retryCache = boundaryFiber.stateNode;
|
|
var suspenseState = boundaryFiber.memoizedState;
|
|
if (suspenseState !== null) {
|
|
retryLane = suspenseState.retryLane;
|
|
}
|
|
break;
|
|
case SuspenseListComponent:
|
|
retryCache = boundaryFiber.stateNode;
|
|
break;
|
|
default:
|
|
throw new Error("Pinged unknown suspense boundary type. This is probably a bug in React.");
|
|
}
|
|
if (retryCache !== null) {
|
|
retryCache.delete(wakeable);
|
|
}
|
|
retryTimedOutBoundary(boundaryFiber, retryLane);
|
|
}
|
|
function jnd(timeElapsed) {
|
|
return timeElapsed < 120 ? 120 : timeElapsed < 480 ? 480 : timeElapsed < 1080 ? 1080 : timeElapsed < 1920 ? 1920 : timeElapsed < 3e3 ? 3e3 : timeElapsed < 4320 ? 4320 : ceil(timeElapsed / 1960) * 1960;
|
|
}
|
|
function checkForNestedUpdates() {
|
|
if (nestedUpdateCount > NESTED_UPDATE_LIMIT) {
|
|
nestedUpdateCount = 0;
|
|
rootWithNestedUpdates = null;
|
|
throw new Error("Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.");
|
|
}
|
|
{
|
|
if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) {
|
|
nestedPassiveUpdateCount = 0;
|
|
rootWithPassiveNestedUpdates = null;
|
|
error("Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.");
|
|
}
|
|
}
|
|
}
|
|
function flushRenderPhaseStrictModeWarningsInDEV() {
|
|
{
|
|
ReactStrictModeWarnings.flushLegacyContextWarning();
|
|
{
|
|
ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings();
|
|
}
|
|
}
|
|
}
|
|
function commitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) {
|
|
{
|
|
setCurrentFiber(fiber);
|
|
invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectUnmountInDEV);
|
|
if (hasPassiveEffects) {
|
|
invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectUnmountInDEV);
|
|
}
|
|
invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectMountInDEV);
|
|
if (hasPassiveEffects) {
|
|
invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectMountInDEV);
|
|
}
|
|
resetCurrentFiber();
|
|
}
|
|
}
|
|
function invokeEffectsInDev(firstChild, fiberFlags, invokeEffectFn) {
|
|
{
|
|
var current3 = firstChild;
|
|
var subtreeRoot = null;
|
|
while (current3 !== null) {
|
|
var primarySubtreeFlag = current3.subtreeFlags & fiberFlags;
|
|
if (current3 !== subtreeRoot && current3.child !== null && primarySubtreeFlag !== NoFlags) {
|
|
current3 = current3.child;
|
|
} else {
|
|
if ((current3.flags & fiberFlags) !== NoFlags) {
|
|
invokeEffectFn(current3);
|
|
}
|
|
if (current3.sibling !== null) {
|
|
current3 = current3.sibling;
|
|
} else {
|
|
current3 = subtreeRoot = current3.return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var didWarnStateUpdateForNotYetMountedComponent = null;
|
|
function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) {
|
|
{
|
|
if ((executionContext & RenderContext) !== NoContext) {
|
|
return;
|
|
}
|
|
if (!(fiber.mode & ConcurrentMode)) {
|
|
return;
|
|
}
|
|
var tag = fiber.tag;
|
|
if (tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef2 && tag !== MemoComponent && tag !== SimpleMemoComponent) {
|
|
return;
|
|
}
|
|
var componentName = getComponentNameFromFiber(fiber) || "ReactComponent";
|
|
if (didWarnStateUpdateForNotYetMountedComponent !== null) {
|
|
if (didWarnStateUpdateForNotYetMountedComponent.has(componentName)) {
|
|
return;
|
|
}
|
|
didWarnStateUpdateForNotYetMountedComponent.add(componentName);
|
|
} else {
|
|
didWarnStateUpdateForNotYetMountedComponent = /* @__PURE__ */ new Set([componentName]);
|
|
}
|
|
var previousFiber = current2;
|
|
try {
|
|
setCurrentFiber(fiber);
|
|
error("Can't perform a React state update on a component that hasn't mounted yet. This indicates that you have a side-effect in your render function that asynchronously later calls tries to update the component. Move this work to useEffect instead.");
|
|
} finally {
|
|
if (previousFiber) {
|
|
setCurrentFiber(fiber);
|
|
} else {
|
|
resetCurrentFiber();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var beginWork$1;
|
|
{
|
|
var dummyFiber = null;
|
|
beginWork$1 = function(current3, unitOfWork, lanes) {
|
|
var originalWorkInProgressCopy = assignFiberPropertiesInDEV(dummyFiber, unitOfWork);
|
|
try {
|
|
return beginWork(current3, unitOfWork, lanes);
|
|
} catch (originalError) {
|
|
if (didSuspendOrErrorWhileHydratingDEV() || originalError !== null && typeof originalError === "object" && typeof originalError.then === "function") {
|
|
throw originalError;
|
|
}
|
|
resetContextDependencies();
|
|
resetHooksAfterThrow();
|
|
unwindInterruptedWork(current3, unitOfWork);
|
|
assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy);
|
|
if (unitOfWork.mode & ProfileMode) {
|
|
startProfilerTimer(unitOfWork);
|
|
}
|
|
invokeGuardedCallback(null, beginWork, null, current3, unitOfWork, lanes);
|
|
if (hasCaughtError()) {
|
|
var replayError = clearCaughtError();
|
|
if (typeof replayError === "object" && replayError !== null && replayError._suppressLogging && typeof originalError === "object" && originalError !== null && !originalError._suppressLogging) {
|
|
originalError._suppressLogging = true;
|
|
}
|
|
}
|
|
throw originalError;
|
|
}
|
|
};
|
|
}
|
|
var didWarnAboutUpdateInRender = false;
|
|
var didWarnAboutUpdateInRenderForAnotherComponent;
|
|
{
|
|
didWarnAboutUpdateInRenderForAnotherComponent = /* @__PURE__ */ new Set();
|
|
}
|
|
function warnAboutRenderPhaseUpdatesInDEV(fiber) {
|
|
{
|
|
if (isRendering && !getIsUpdatingOpaqueValueInRenderPhaseInDEV()) {
|
|
switch (fiber.tag) {
|
|
case FunctionComponent:
|
|
case ForwardRef2:
|
|
case SimpleMemoComponent: {
|
|
var renderingComponentName = workInProgress && getComponentNameFromFiber(workInProgress) || "Unknown";
|
|
var dedupeKey = renderingComponentName;
|
|
if (!didWarnAboutUpdateInRenderForAnotherComponent.has(dedupeKey)) {
|
|
didWarnAboutUpdateInRenderForAnotherComponent.add(dedupeKey);
|
|
var setStateComponentName = getComponentNameFromFiber(fiber) || "Unknown";
|
|
error("Cannot update a component (`%s`) while rendering a different component (`%s`). To locate the bad setState() call inside `%s`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render", setStateComponentName, renderingComponentName, renderingComponentName);
|
|
}
|
|
break;
|
|
}
|
|
case ClassComponent: {
|
|
if (!didWarnAboutUpdateInRender) {
|
|
error("Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state.");
|
|
didWarnAboutUpdateInRender = true;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function restorePendingUpdaters(root2, lanes) {
|
|
{
|
|
if (isDevToolsPresent) {
|
|
var memoizedUpdaters = root2.memoizedUpdaters;
|
|
memoizedUpdaters.forEach(function(schedulingFiber) {
|
|
addFiberToLanesMap(root2, schedulingFiber, lanes);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
var fakeActCallbackNode = {};
|
|
function scheduleCallback$1(priorityLevel, callback) {
|
|
{
|
|
var actQueue = ReactCurrentActQueue$1.current;
|
|
if (actQueue !== null) {
|
|
actQueue.push(callback);
|
|
return fakeActCallbackNode;
|
|
} else {
|
|
return scheduleCallback(priorityLevel, callback);
|
|
}
|
|
}
|
|
}
|
|
function cancelCallback$1(callbackNode) {
|
|
if (callbackNode === fakeActCallbackNode) {
|
|
return;
|
|
}
|
|
return cancelCallback(callbackNode);
|
|
}
|
|
function shouldForceFlushFallbacksInDEV() {
|
|
return ReactCurrentActQueue$1.current !== null;
|
|
}
|
|
function warnIfUpdatesNotWrappedWithActDEV(fiber) {
|
|
{
|
|
if (fiber.mode & ConcurrentMode) {
|
|
if (!isConcurrentActEnvironment()) {
|
|
return;
|
|
}
|
|
} else {
|
|
if (!isLegacyActEnvironment()) {
|
|
return;
|
|
}
|
|
if (executionContext !== NoContext) {
|
|
return;
|
|
}
|
|
if (fiber.tag !== FunctionComponent && fiber.tag !== ForwardRef2 && fiber.tag !== SimpleMemoComponent) {
|
|
return;
|
|
}
|
|
}
|
|
if (ReactCurrentActQueue$1.current === null) {
|
|
var previousFiber = current2;
|
|
try {
|
|
setCurrentFiber(fiber);
|
|
error("An update to %s inside a test was not wrapped in act(...).\n\nWhen testing, code that causes React state updates should be wrapped into act(...):\n\nact(() => {\n /* fire events that update state */\n});\n/* assert on the output */\n\nThis ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act", getComponentNameFromFiber(fiber));
|
|
} finally {
|
|
if (previousFiber) {
|
|
setCurrentFiber(fiber);
|
|
} else {
|
|
resetCurrentFiber();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function warnIfSuspenseResolutionNotWrappedWithActDEV(root2) {
|
|
{
|
|
if (root2.tag !== LegacyRoot && isConcurrentActEnvironment() && ReactCurrentActQueue$1.current === null) {
|
|
error("A suspended resource finished loading inside a test, but the event was not wrapped in act(...).\n\nWhen testing, code that resolves suspended data should be wrapped into act(...):\n\nact(() => {\n /* finish loading suspended data */\n});\n/* assert on the output */\n\nThis ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act");
|
|
}
|
|
}
|
|
}
|
|
function setIsRunningInsertionEffect(isRunning) {
|
|
{
|
|
isRunningInsertionEffect = isRunning;
|
|
}
|
|
}
|
|
var resolveFamily = null;
|
|
var failedBoundaries = null;
|
|
var setRefreshHandler = function(handler) {
|
|
{
|
|
resolveFamily = handler;
|
|
}
|
|
};
|
|
function resolveFunctionForHotReloading(type) {
|
|
{
|
|
if (resolveFamily === null) {
|
|
return type;
|
|
}
|
|
var family = resolveFamily(type);
|
|
if (family === void 0) {
|
|
return type;
|
|
}
|
|
return family.current;
|
|
}
|
|
}
|
|
function resolveClassForHotReloading(type) {
|
|
return resolveFunctionForHotReloading(type);
|
|
}
|
|
function resolveForwardRefForHotReloading(type) {
|
|
{
|
|
if (resolveFamily === null) {
|
|
return type;
|
|
}
|
|
var family = resolveFamily(type);
|
|
if (family === void 0) {
|
|
if (type !== null && type !== void 0 && typeof type.render === "function") {
|
|
var currentRender = resolveFunctionForHotReloading(type.render);
|
|
if (type.render !== currentRender) {
|
|
var syntheticType = {
|
|
$$typeof: REACT_FORWARD_REF_TYPE2,
|
|
render: currentRender
|
|
};
|
|
if (type.displayName !== void 0) {
|
|
syntheticType.displayName = type.displayName;
|
|
}
|
|
return syntheticType;
|
|
}
|
|
}
|
|
return type;
|
|
}
|
|
return family.current;
|
|
}
|
|
}
|
|
function isCompatibleFamilyForHotReloading(fiber, element) {
|
|
{
|
|
if (resolveFamily === null) {
|
|
return false;
|
|
}
|
|
var prevType = fiber.elementType;
|
|
var nextType = element.type;
|
|
var needsCompareFamilies = false;
|
|
var $$typeofNextType = typeof nextType === "object" && nextType !== null ? nextType.$$typeof : null;
|
|
switch (fiber.tag) {
|
|
case ClassComponent: {
|
|
if (typeof nextType === "function") {
|
|
needsCompareFamilies = true;
|
|
}
|
|
break;
|
|
}
|
|
case FunctionComponent: {
|
|
if (typeof nextType === "function") {
|
|
needsCompareFamilies = true;
|
|
} else if ($$typeofNextType === REACT_LAZY_TYPE2) {
|
|
needsCompareFamilies = true;
|
|
}
|
|
break;
|
|
}
|
|
case ForwardRef2: {
|
|
if ($$typeofNextType === REACT_FORWARD_REF_TYPE2) {
|
|
needsCompareFamilies = true;
|
|
} else if ($$typeofNextType === REACT_LAZY_TYPE2) {
|
|
needsCompareFamilies = true;
|
|
}
|
|
break;
|
|
}
|
|
case MemoComponent:
|
|
case SimpleMemoComponent: {
|
|
if ($$typeofNextType === REACT_MEMO_TYPE2) {
|
|
needsCompareFamilies = true;
|
|
} else if ($$typeofNextType === REACT_LAZY_TYPE2) {
|
|
needsCompareFamilies = true;
|
|
}
|
|
break;
|
|
}
|
|
default:
|
|
return false;
|
|
}
|
|
if (needsCompareFamilies) {
|
|
var prevFamily = resolveFamily(prevType);
|
|
if (prevFamily !== void 0 && prevFamily === resolveFamily(nextType)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
function markFailedErrorBoundaryForHotReloading(fiber) {
|
|
{
|
|
if (resolveFamily === null) {
|
|
return;
|
|
}
|
|
if (typeof WeakSet !== "function") {
|
|
return;
|
|
}
|
|
if (failedBoundaries === null) {
|
|
failedBoundaries = /* @__PURE__ */ new WeakSet();
|
|
}
|
|
failedBoundaries.add(fiber);
|
|
}
|
|
}
|
|
var scheduleRefresh = function(root2, update) {
|
|
{
|
|
if (resolveFamily === null) {
|
|
return;
|
|
}
|
|
var staleFamilies = update.staleFamilies, updatedFamilies = update.updatedFamilies;
|
|
flushPassiveEffects();
|
|
flushSync(function() {
|
|
scheduleFibersWithFamiliesRecursively(root2.current, updatedFamilies, staleFamilies);
|
|
});
|
|
}
|
|
};
|
|
var scheduleRoot = function(root2, element) {
|
|
{
|
|
if (root2.context !== emptyContextObject) {
|
|
return;
|
|
}
|
|
flushPassiveEffects();
|
|
flushSync(function() {
|
|
updateContainer(element, root2, null, null);
|
|
});
|
|
}
|
|
};
|
|
function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) {
|
|
{
|
|
var alternate = fiber.alternate, child = fiber.child, sibling = fiber.sibling, tag = fiber.tag, type = fiber.type;
|
|
var candidateType = null;
|
|
switch (tag) {
|
|
case FunctionComponent:
|
|
case SimpleMemoComponent:
|
|
case ClassComponent:
|
|
candidateType = type;
|
|
break;
|
|
case ForwardRef2:
|
|
candidateType = type.render;
|
|
break;
|
|
}
|
|
if (resolveFamily === null) {
|
|
throw new Error("Expected resolveFamily to be set during hot reload.");
|
|
}
|
|
var needsRender = false;
|
|
var needsRemount = false;
|
|
if (candidateType !== null) {
|
|
var family = resolveFamily(candidateType);
|
|
if (family !== void 0) {
|
|
if (staleFamilies.has(family)) {
|
|
needsRemount = true;
|
|
} else if (updatedFamilies.has(family)) {
|
|
if (tag === ClassComponent) {
|
|
needsRemount = true;
|
|
} else {
|
|
needsRender = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (failedBoundaries !== null) {
|
|
if (failedBoundaries.has(fiber) || alternate !== null && failedBoundaries.has(alternate)) {
|
|
needsRemount = true;
|
|
}
|
|
}
|
|
if (needsRemount) {
|
|
fiber._debugNeedsRemount = true;
|
|
}
|
|
if (needsRemount || needsRender) {
|
|
var _root = enqueueConcurrentRenderForLane(fiber, SyncLane);
|
|
if (_root !== null) {
|
|
scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp);
|
|
}
|
|
}
|
|
if (child !== null && !needsRemount) {
|
|
scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies);
|
|
}
|
|
if (sibling !== null) {
|
|
scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies);
|
|
}
|
|
}
|
|
}
|
|
var findHostInstancesForRefresh = function(root2, families) {
|
|
{
|
|
var hostInstances = /* @__PURE__ */ new Set();
|
|
var types = new Set(families.map(function(family) {
|
|
return family.current;
|
|
}));
|
|
findHostInstancesForMatchingFibersRecursively(root2.current, types, hostInstances);
|
|
return hostInstances;
|
|
}
|
|
};
|
|
function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) {
|
|
{
|
|
var child = fiber.child, sibling = fiber.sibling, tag = fiber.tag, type = fiber.type;
|
|
var candidateType = null;
|
|
switch (tag) {
|
|
case FunctionComponent:
|
|
case SimpleMemoComponent:
|
|
case ClassComponent:
|
|
candidateType = type;
|
|
break;
|
|
case ForwardRef2:
|
|
candidateType = type.render;
|
|
break;
|
|
}
|
|
var didMatch = false;
|
|
if (candidateType !== null) {
|
|
if (types.has(candidateType)) {
|
|
didMatch = true;
|
|
}
|
|
}
|
|
if (didMatch) {
|
|
findHostInstancesForFiberShallowly(fiber, hostInstances);
|
|
} else {
|
|
if (child !== null) {
|
|
findHostInstancesForMatchingFibersRecursively(child, types, hostInstances);
|
|
}
|
|
}
|
|
if (sibling !== null) {
|
|
findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances);
|
|
}
|
|
}
|
|
}
|
|
function findHostInstancesForFiberShallowly(fiber, hostInstances) {
|
|
{
|
|
var foundHostInstances = findChildHostInstancesForFiberShallowly(fiber, hostInstances);
|
|
if (foundHostInstances) {
|
|
return;
|
|
}
|
|
var node = fiber;
|
|
while (true) {
|
|
switch (node.tag) {
|
|
case HostComponent:
|
|
hostInstances.add(node.stateNode);
|
|
return;
|
|
case HostPortal:
|
|
hostInstances.add(node.stateNode.containerInfo);
|
|
return;
|
|
case HostRoot:
|
|
hostInstances.add(node.stateNode.containerInfo);
|
|
return;
|
|
}
|
|
if (node.return === null) {
|
|
throw new Error("Expected to reach root first.");
|
|
}
|
|
node = node.return;
|
|
}
|
|
}
|
|
}
|
|
function findChildHostInstancesForFiberShallowly(fiber, hostInstances) {
|
|
{
|
|
var node = fiber;
|
|
var foundHostInstances = false;
|
|
while (true) {
|
|
if (node.tag === HostComponent) {
|
|
foundHostInstances = true;
|
|
hostInstances.add(node.stateNode);
|
|
} else if (node.child !== null) {
|
|
node.child.return = node;
|
|
node = node.child;
|
|
continue;
|
|
}
|
|
if (node === fiber) {
|
|
return foundHostInstances;
|
|
}
|
|
while (node.sibling === null) {
|
|
if (node.return === null || node.return === fiber) {
|
|
return foundHostInstances;
|
|
}
|
|
node = node.return;
|
|
}
|
|
node.sibling.return = node.return;
|
|
node = node.sibling;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
var hasBadMapPolyfill;
|
|
{
|
|
hasBadMapPolyfill = false;
|
|
try {
|
|
var nonExtensibleObject = Object.preventExtensions({});
|
|
/* @__PURE__ */ new Map([[nonExtensibleObject, null]]);
|
|
/* @__PURE__ */ new Set([nonExtensibleObject]);
|
|
} catch (e) {
|
|
hasBadMapPolyfill = true;
|
|
}
|
|
}
|
|
function FiberNode(tag, pendingProps, key, mode) {
|
|
this.tag = tag;
|
|
this.key = key;
|
|
this.elementType = null;
|
|
this.type = null;
|
|
this.stateNode = null;
|
|
this.return = null;
|
|
this.child = null;
|
|
this.sibling = null;
|
|
this.index = 0;
|
|
this.ref = null;
|
|
this.pendingProps = pendingProps;
|
|
this.memoizedProps = null;
|
|
this.updateQueue = null;
|
|
this.memoizedState = null;
|
|
this.dependencies = null;
|
|
this.mode = mode;
|
|
this.flags = NoFlags;
|
|
this.subtreeFlags = NoFlags;
|
|
this.deletions = null;
|
|
this.lanes = NoLanes;
|
|
this.childLanes = NoLanes;
|
|
this.alternate = null;
|
|
{
|
|
this.actualDuration = Number.NaN;
|
|
this.actualStartTime = Number.NaN;
|
|
this.selfBaseDuration = Number.NaN;
|
|
this.treeBaseDuration = Number.NaN;
|
|
this.actualDuration = 0;
|
|
this.actualStartTime = -1;
|
|
this.selfBaseDuration = 0;
|
|
this.treeBaseDuration = 0;
|
|
}
|
|
{
|
|
this._debugSource = null;
|
|
this._debugOwner = null;
|
|
this._debugNeedsRemount = false;
|
|
this._debugHookTypes = null;
|
|
if (!hasBadMapPolyfill && typeof Object.preventExtensions === "function") {
|
|
Object.preventExtensions(this);
|
|
}
|
|
}
|
|
}
|
|
var createFiber = function(tag, pendingProps, key, mode) {
|
|
return new FiberNode(tag, pendingProps, key, mode);
|
|
};
|
|
function shouldConstruct$1(Component) {
|
|
var prototype3 = Component.prototype;
|
|
return !!(prototype3 && prototype3.isReactComponent);
|
|
}
|
|
function isSimpleFunctionComponent(type) {
|
|
return typeof type === "function" && !shouldConstruct$1(type) && type.defaultProps === void 0;
|
|
}
|
|
function resolveLazyComponentTag(Component) {
|
|
if (typeof Component === "function") {
|
|
return shouldConstruct$1(Component) ? ClassComponent : FunctionComponent;
|
|
} else if (Component !== void 0 && Component !== null) {
|
|
var $$typeof = Component.$$typeof;
|
|
if ($$typeof === REACT_FORWARD_REF_TYPE2) {
|
|
return ForwardRef2;
|
|
}
|
|
if ($$typeof === REACT_MEMO_TYPE2) {
|
|
return MemoComponent;
|
|
}
|
|
}
|
|
return IndeterminateComponent;
|
|
}
|
|
function createWorkInProgress(current3, pendingProps) {
|
|
var workInProgress2 = current3.alternate;
|
|
if (workInProgress2 === null) {
|
|
workInProgress2 = createFiber(current3.tag, pendingProps, current3.key, current3.mode);
|
|
workInProgress2.elementType = current3.elementType;
|
|
workInProgress2.type = current3.type;
|
|
workInProgress2.stateNode = current3.stateNode;
|
|
{
|
|
workInProgress2._debugSource = current3._debugSource;
|
|
workInProgress2._debugOwner = current3._debugOwner;
|
|
workInProgress2._debugHookTypes = current3._debugHookTypes;
|
|
}
|
|
workInProgress2.alternate = current3;
|
|
current3.alternate = workInProgress2;
|
|
} else {
|
|
workInProgress2.pendingProps = pendingProps;
|
|
workInProgress2.type = current3.type;
|
|
workInProgress2.flags = NoFlags;
|
|
workInProgress2.subtreeFlags = NoFlags;
|
|
workInProgress2.deletions = null;
|
|
{
|
|
workInProgress2.actualDuration = 0;
|
|
workInProgress2.actualStartTime = -1;
|
|
}
|
|
}
|
|
workInProgress2.flags = current3.flags & StaticMask;
|
|
workInProgress2.childLanes = current3.childLanes;
|
|
workInProgress2.lanes = current3.lanes;
|
|
workInProgress2.child = current3.child;
|
|
workInProgress2.memoizedProps = current3.memoizedProps;
|
|
workInProgress2.memoizedState = current3.memoizedState;
|
|
workInProgress2.updateQueue = current3.updateQueue;
|
|
var currentDependencies = current3.dependencies;
|
|
workInProgress2.dependencies = currentDependencies === null ? null : {
|
|
lanes: currentDependencies.lanes,
|
|
firstContext: currentDependencies.firstContext
|
|
};
|
|
workInProgress2.sibling = current3.sibling;
|
|
workInProgress2.index = current3.index;
|
|
workInProgress2.ref = current3.ref;
|
|
{
|
|
workInProgress2.selfBaseDuration = current3.selfBaseDuration;
|
|
workInProgress2.treeBaseDuration = current3.treeBaseDuration;
|
|
}
|
|
{
|
|
workInProgress2._debugNeedsRemount = current3._debugNeedsRemount;
|
|
switch (workInProgress2.tag) {
|
|
case IndeterminateComponent:
|
|
case FunctionComponent:
|
|
case SimpleMemoComponent:
|
|
workInProgress2.type = resolveFunctionForHotReloading(current3.type);
|
|
break;
|
|
case ClassComponent:
|
|
workInProgress2.type = resolveClassForHotReloading(current3.type);
|
|
break;
|
|
case ForwardRef2:
|
|
workInProgress2.type = resolveForwardRefForHotReloading(current3.type);
|
|
break;
|
|
}
|
|
}
|
|
return workInProgress2;
|
|
}
|
|
function resetWorkInProgress(workInProgress2, renderLanes2) {
|
|
workInProgress2.flags &= StaticMask | Placement;
|
|
var current3 = workInProgress2.alternate;
|
|
if (current3 === null) {
|
|
workInProgress2.childLanes = NoLanes;
|
|
workInProgress2.lanes = renderLanes2;
|
|
workInProgress2.child = null;
|
|
workInProgress2.subtreeFlags = NoFlags;
|
|
workInProgress2.memoizedProps = null;
|
|
workInProgress2.memoizedState = null;
|
|
workInProgress2.updateQueue = null;
|
|
workInProgress2.dependencies = null;
|
|
workInProgress2.stateNode = null;
|
|
{
|
|
workInProgress2.selfBaseDuration = 0;
|
|
workInProgress2.treeBaseDuration = 0;
|
|
}
|
|
} else {
|
|
workInProgress2.childLanes = current3.childLanes;
|
|
workInProgress2.lanes = current3.lanes;
|
|
workInProgress2.child = current3.child;
|
|
workInProgress2.subtreeFlags = NoFlags;
|
|
workInProgress2.deletions = null;
|
|
workInProgress2.memoizedProps = current3.memoizedProps;
|
|
workInProgress2.memoizedState = current3.memoizedState;
|
|
workInProgress2.updateQueue = current3.updateQueue;
|
|
workInProgress2.type = current3.type;
|
|
var currentDependencies = current3.dependencies;
|
|
workInProgress2.dependencies = currentDependencies === null ? null : {
|
|
lanes: currentDependencies.lanes,
|
|
firstContext: currentDependencies.firstContext
|
|
};
|
|
{
|
|
workInProgress2.selfBaseDuration = current3.selfBaseDuration;
|
|
workInProgress2.treeBaseDuration = current3.treeBaseDuration;
|
|
}
|
|
}
|
|
return workInProgress2;
|
|
}
|
|
function createHostRootFiber(tag, isStrictMode, concurrentUpdatesByDefaultOverride) {
|
|
var mode;
|
|
if (tag === ConcurrentRoot) {
|
|
mode = ConcurrentMode;
|
|
if (isStrictMode === true) {
|
|
mode |= StrictLegacyMode;
|
|
{
|
|
mode |= StrictEffectsMode;
|
|
}
|
|
}
|
|
} else {
|
|
mode = NoMode;
|
|
}
|
|
if (isDevToolsPresent) {
|
|
mode |= ProfileMode;
|
|
}
|
|
return createFiber(HostRoot, null, null, mode);
|
|
}
|
|
function createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, lanes) {
|
|
var fiberTag = IndeterminateComponent;
|
|
var resolvedType = type;
|
|
if (typeof type === "function") {
|
|
if (shouldConstruct$1(type)) {
|
|
fiberTag = ClassComponent;
|
|
{
|
|
resolvedType = resolveClassForHotReloading(resolvedType);
|
|
}
|
|
} else {
|
|
{
|
|
resolvedType = resolveFunctionForHotReloading(resolvedType);
|
|
}
|
|
}
|
|
} else if (typeof type === "string") {
|
|
fiberTag = HostComponent;
|
|
} else {
|
|
getTag:
|
|
switch (type) {
|
|
case REACT_FRAGMENT_TYPE2:
|
|
return createFiberFromFragment(pendingProps.children, mode, lanes, key);
|
|
case REACT_STRICT_MODE_TYPE2:
|
|
fiberTag = Mode;
|
|
mode |= StrictLegacyMode;
|
|
if ((mode & ConcurrentMode) !== NoMode) {
|
|
mode |= StrictEffectsMode;
|
|
}
|
|
break;
|
|
case REACT_PROFILER_TYPE2:
|
|
return createFiberFromProfiler(pendingProps, mode, lanes, key);
|
|
case REACT_SUSPENSE_TYPE2:
|
|
return createFiberFromSuspense(pendingProps, mode, lanes, key);
|
|
case REACT_SUSPENSE_LIST_TYPE2:
|
|
return createFiberFromSuspenseList(pendingProps, mode, lanes, key);
|
|
case REACT_OFFSCREEN_TYPE2:
|
|
return createFiberFromOffscreen(pendingProps, mode, lanes, key);
|
|
case REACT_LEGACY_HIDDEN_TYPE:
|
|
case REACT_SCOPE_TYPE:
|
|
case REACT_CACHE_TYPE:
|
|
case REACT_TRACING_MARKER_TYPE:
|
|
case REACT_DEBUG_TRACING_MODE_TYPE:
|
|
default: {
|
|
if (typeof type === "object" && type !== null) {
|
|
switch (type.$$typeof) {
|
|
case REACT_PROVIDER_TYPE2:
|
|
fiberTag = ContextProvider;
|
|
break getTag;
|
|
case REACT_CONTEXT_TYPE2:
|
|
fiberTag = ContextConsumer;
|
|
break getTag;
|
|
case REACT_FORWARD_REF_TYPE2:
|
|
fiberTag = ForwardRef2;
|
|
{
|
|
resolvedType = resolveForwardRefForHotReloading(resolvedType);
|
|
}
|
|
break getTag;
|
|
case REACT_MEMO_TYPE2:
|
|
fiberTag = MemoComponent;
|
|
break getTag;
|
|
case REACT_LAZY_TYPE2:
|
|
fiberTag = LazyComponent;
|
|
resolvedType = null;
|
|
break getTag;
|
|
}
|
|
}
|
|
var info = "";
|
|
{
|
|
if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
|
|
info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
|
|
}
|
|
var ownerName = owner ? getComponentNameFromFiber(owner) : null;
|
|
if (ownerName) {
|
|
info += "\n\nCheck the render method of `" + ownerName + "`.";
|
|
}
|
|
}
|
|
throw new Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) " + ("but got: " + (type == null ? type : typeof type) + "." + info));
|
|
}
|
|
}
|
|
}
|
|
var fiber = createFiber(fiberTag, pendingProps, key, mode);
|
|
fiber.elementType = type;
|
|
fiber.type = resolvedType;
|
|
fiber.lanes = lanes;
|
|
{
|
|
fiber._debugOwner = owner;
|
|
}
|
|
return fiber;
|
|
}
|
|
function createFiberFromElement(element, mode, lanes) {
|
|
var owner = null;
|
|
{
|
|
owner = element._owner;
|
|
}
|
|
var type = element.type;
|
|
var key = element.key;
|
|
var pendingProps = element.props;
|
|
var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, lanes);
|
|
{
|
|
fiber._debugSource = element._source;
|
|
fiber._debugOwner = element._owner;
|
|
}
|
|
return fiber;
|
|
}
|
|
function createFiberFromFragment(elements, mode, lanes, key) {
|
|
var fiber = createFiber(Fragment7, elements, key, mode);
|
|
fiber.lanes = lanes;
|
|
return fiber;
|
|
}
|
|
function createFiberFromProfiler(pendingProps, mode, lanes, key) {
|
|
{
|
|
if (typeof pendingProps.id !== "string") {
|
|
error('Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.', typeof pendingProps.id);
|
|
}
|
|
}
|
|
var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode);
|
|
fiber.elementType = REACT_PROFILER_TYPE2;
|
|
fiber.lanes = lanes;
|
|
{
|
|
fiber.stateNode = {
|
|
effectDuration: 0,
|
|
passiveEffectDuration: 0
|
|
};
|
|
}
|
|
return fiber;
|
|
}
|
|
function createFiberFromSuspense(pendingProps, mode, lanes, key) {
|
|
var fiber = createFiber(SuspenseComponent, pendingProps, key, mode);
|
|
fiber.elementType = REACT_SUSPENSE_TYPE2;
|
|
fiber.lanes = lanes;
|
|
return fiber;
|
|
}
|
|
function createFiberFromSuspenseList(pendingProps, mode, lanes, key) {
|
|
var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode);
|
|
fiber.elementType = REACT_SUSPENSE_LIST_TYPE2;
|
|
fiber.lanes = lanes;
|
|
return fiber;
|
|
}
|
|
function createFiberFromOffscreen(pendingProps, mode, lanes, key) {
|
|
var fiber = createFiber(OffscreenComponent, pendingProps, key, mode);
|
|
fiber.elementType = REACT_OFFSCREEN_TYPE2;
|
|
fiber.lanes = lanes;
|
|
var primaryChildInstance = {
|
|
isHidden: false
|
|
};
|
|
fiber.stateNode = primaryChildInstance;
|
|
return fiber;
|
|
}
|
|
function createFiberFromText(content, mode, lanes) {
|
|
var fiber = createFiber(HostText, content, null, mode);
|
|
fiber.lanes = lanes;
|
|
return fiber;
|
|
}
|
|
function createFiberFromHostInstanceForDeletion() {
|
|
var fiber = createFiber(HostComponent, null, null, NoMode);
|
|
fiber.elementType = "DELETED";
|
|
return fiber;
|
|
}
|
|
function createFiberFromDehydratedFragment(dehydratedNode) {
|
|
var fiber = createFiber(DehydratedFragment, null, null, NoMode);
|
|
fiber.stateNode = dehydratedNode;
|
|
return fiber;
|
|
}
|
|
function createFiberFromPortal(portal, mode, lanes) {
|
|
var pendingProps = portal.children !== null ? portal.children : [];
|
|
var fiber = createFiber(HostPortal, pendingProps, portal.key, mode);
|
|
fiber.lanes = lanes;
|
|
fiber.stateNode = {
|
|
containerInfo: portal.containerInfo,
|
|
pendingChildren: null,
|
|
implementation: portal.implementation
|
|
};
|
|
return fiber;
|
|
}
|
|
function assignFiberPropertiesInDEV(target, source) {
|
|
if (target === null) {
|
|
target = createFiber(IndeterminateComponent, null, null, NoMode);
|
|
}
|
|
target.tag = source.tag;
|
|
target.key = source.key;
|
|
target.elementType = source.elementType;
|
|
target.type = source.type;
|
|
target.stateNode = source.stateNode;
|
|
target.return = source.return;
|
|
target.child = source.child;
|
|
target.sibling = source.sibling;
|
|
target.index = source.index;
|
|
target.ref = source.ref;
|
|
target.pendingProps = source.pendingProps;
|
|
target.memoizedProps = source.memoizedProps;
|
|
target.updateQueue = source.updateQueue;
|
|
target.memoizedState = source.memoizedState;
|
|
target.dependencies = source.dependencies;
|
|
target.mode = source.mode;
|
|
target.flags = source.flags;
|
|
target.subtreeFlags = source.subtreeFlags;
|
|
target.deletions = source.deletions;
|
|
target.lanes = source.lanes;
|
|
target.childLanes = source.childLanes;
|
|
target.alternate = source.alternate;
|
|
{
|
|
target.actualDuration = source.actualDuration;
|
|
target.actualStartTime = source.actualStartTime;
|
|
target.selfBaseDuration = source.selfBaseDuration;
|
|
target.treeBaseDuration = source.treeBaseDuration;
|
|
}
|
|
target._debugSource = source._debugSource;
|
|
target._debugOwner = source._debugOwner;
|
|
target._debugNeedsRemount = source._debugNeedsRemount;
|
|
target._debugHookTypes = source._debugHookTypes;
|
|
return target;
|
|
}
|
|
function FiberRootNode(containerInfo, tag, hydrate2, identifierPrefix, onRecoverableError) {
|
|
this.tag = tag;
|
|
this.containerInfo = containerInfo;
|
|
this.pendingChildren = null;
|
|
this.current = null;
|
|
this.pingCache = null;
|
|
this.finishedWork = null;
|
|
this.timeoutHandle = noTimeout;
|
|
this.context = null;
|
|
this.pendingContext = null;
|
|
this.callbackNode = null;
|
|
this.callbackPriority = NoLane;
|
|
this.eventTimes = createLaneMap(NoLanes);
|
|
this.expirationTimes = createLaneMap(NoTimestamp);
|
|
this.pendingLanes = NoLanes;
|
|
this.suspendedLanes = NoLanes;
|
|
this.pingedLanes = NoLanes;
|
|
this.expiredLanes = NoLanes;
|
|
this.mutableReadLanes = NoLanes;
|
|
this.finishedLanes = NoLanes;
|
|
this.entangledLanes = NoLanes;
|
|
this.entanglements = createLaneMap(NoLanes);
|
|
this.identifierPrefix = identifierPrefix;
|
|
this.onRecoverableError = onRecoverableError;
|
|
{
|
|
this.mutableSourceEagerHydrationData = null;
|
|
}
|
|
{
|
|
this.effectDuration = 0;
|
|
this.passiveEffectDuration = 0;
|
|
}
|
|
{
|
|
this.memoizedUpdaters = /* @__PURE__ */ new Set();
|
|
var pendingUpdatersLaneMap = this.pendingUpdatersLaneMap = [];
|
|
for (var _i = 0; _i < TotalLanes; _i++) {
|
|
pendingUpdatersLaneMap.push(/* @__PURE__ */ new Set());
|
|
}
|
|
}
|
|
{
|
|
switch (tag) {
|
|
case ConcurrentRoot:
|
|
this._debugRootType = hydrate2 ? "hydrateRoot()" : "createRoot()";
|
|
break;
|
|
case LegacyRoot:
|
|
this._debugRootType = hydrate2 ? "hydrate()" : "render()";
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
function createFiberRoot(containerInfo, tag, hydrate2, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError, transitionCallbacks) {
|
|
var root2 = new FiberRootNode(containerInfo, tag, hydrate2, identifierPrefix, onRecoverableError);
|
|
var uninitializedFiber = createHostRootFiber(tag, isStrictMode);
|
|
root2.current = uninitializedFiber;
|
|
uninitializedFiber.stateNode = root2;
|
|
{
|
|
var _initialState = {
|
|
element: initialChildren,
|
|
isDehydrated: hydrate2,
|
|
cache: null,
|
|
transitions: null,
|
|
pendingSuspenseBoundaries: null
|
|
};
|
|
uninitializedFiber.memoizedState = _initialState;
|
|
}
|
|
initializeUpdateQueue(uninitializedFiber);
|
|
return root2;
|
|
}
|
|
var ReactVersion = "18.3.1";
|
|
function createPortal(children, containerInfo, implementation) {
|
|
var key = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
|
|
{
|
|
checkKeyStringCoercion(key);
|
|
}
|
|
return {
|
|
$$typeof: REACT_PORTAL_TYPE2,
|
|
key: key == null ? null : "" + key,
|
|
children,
|
|
containerInfo,
|
|
implementation
|
|
};
|
|
}
|
|
var didWarnAboutNestedUpdates;
|
|
var didWarnAboutFindNodeInStrictMode;
|
|
{
|
|
didWarnAboutNestedUpdates = false;
|
|
didWarnAboutFindNodeInStrictMode = {};
|
|
}
|
|
function getContextForSubtree(parentComponent) {
|
|
if (!parentComponent) {
|
|
return emptyContextObject;
|
|
}
|
|
var fiber = get2(parentComponent);
|
|
var parentContext = findCurrentUnmaskedContext(fiber);
|
|
if (fiber.tag === ClassComponent) {
|
|
var Component = fiber.type;
|
|
if (isContextProvider(Component)) {
|
|
return processChildContext(fiber, Component, parentContext);
|
|
}
|
|
}
|
|
return parentContext;
|
|
}
|
|
function findHostInstanceWithWarning(component, methodName) {
|
|
{
|
|
var fiber = get2(component);
|
|
if (fiber === void 0) {
|
|
if (typeof component.render === "function") {
|
|
throw new Error("Unable to find node on an unmounted component.");
|
|
} else {
|
|
var keys2 = Object.keys(component).join(",");
|
|
throw new Error("Argument appears to not be a ReactComponent. Keys: " + keys2);
|
|
}
|
|
}
|
|
var hostFiber = findCurrentHostFiber(fiber);
|
|
if (hostFiber === null) {
|
|
return null;
|
|
}
|
|
if (hostFiber.mode & StrictLegacyMode) {
|
|
var componentName = getComponentNameFromFiber(fiber) || "Component";
|
|
if (!didWarnAboutFindNodeInStrictMode[componentName]) {
|
|
didWarnAboutFindNodeInStrictMode[componentName] = true;
|
|
var previousFiber = current2;
|
|
try {
|
|
setCurrentFiber(hostFiber);
|
|
if (fiber.mode & StrictLegacyMode) {
|
|
error("%s is deprecated in StrictMode. %s was passed an instance of %s which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node", methodName, methodName, componentName);
|
|
} else {
|
|
error("%s is deprecated in StrictMode. %s was passed an instance of %s which renders StrictMode children. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node", methodName, methodName, componentName);
|
|
}
|
|
} finally {
|
|
if (previousFiber) {
|
|
setCurrentFiber(previousFiber);
|
|
} else {
|
|
resetCurrentFiber();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return hostFiber.stateNode;
|
|
}
|
|
}
|
|
function createContainer(containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError, transitionCallbacks) {
|
|
var hydrate2 = false;
|
|
var initialChildren = null;
|
|
return createFiberRoot(containerInfo, tag, hydrate2, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError);
|
|
}
|
|
function createHydrationContainer(initialChildren, callback, containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError, transitionCallbacks) {
|
|
var hydrate2 = true;
|
|
var root2 = createFiberRoot(containerInfo, tag, hydrate2, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError);
|
|
root2.context = getContextForSubtree(null);
|
|
var current3 = root2.current;
|
|
var eventTime = requestEventTime();
|
|
var lane = requestUpdateLane(current3);
|
|
var update = createUpdate(eventTime, lane);
|
|
update.callback = callback !== void 0 && callback !== null ? callback : null;
|
|
enqueueUpdate(current3, update, lane);
|
|
scheduleInitialHydrationOnRoot(root2, lane, eventTime);
|
|
return root2;
|
|
}
|
|
function updateContainer(element, container, parentComponent, callback) {
|
|
{
|
|
onScheduleRoot(container, element);
|
|
}
|
|
var current$1 = container.current;
|
|
var eventTime = requestEventTime();
|
|
var lane = requestUpdateLane(current$1);
|
|
{
|
|
markRenderScheduled(lane);
|
|
}
|
|
var context = getContextForSubtree(parentComponent);
|
|
if (container.context === null) {
|
|
container.context = context;
|
|
} else {
|
|
container.pendingContext = context;
|
|
}
|
|
{
|
|
if (isRendering && current2 !== null && !didWarnAboutNestedUpdates) {
|
|
didWarnAboutNestedUpdates = true;
|
|
error("Render methods should be a pure function of props and state; triggering nested component updates from render is not allowed. If necessary, trigger nested updates in componentDidUpdate.\n\nCheck the render method of %s.", getComponentNameFromFiber(current2) || "Unknown");
|
|
}
|
|
}
|
|
var update = createUpdate(eventTime, lane);
|
|
update.payload = {
|
|
element
|
|
};
|
|
callback = callback === void 0 ? null : callback;
|
|
if (callback !== null) {
|
|
{
|
|
if (typeof callback !== "function") {
|
|
error("render(...): Expected the last optional `callback` argument to be a function. Instead received: %s.", callback);
|
|
}
|
|
}
|
|
update.callback = callback;
|
|
}
|
|
var root2 = enqueueUpdate(current$1, update, lane);
|
|
if (root2 !== null) {
|
|
scheduleUpdateOnFiber(root2, current$1, lane, eventTime);
|
|
entangleTransitions(root2, current$1, lane);
|
|
}
|
|
return lane;
|
|
}
|
|
function getPublicRootInstance(container) {
|
|
var containerFiber = container.current;
|
|
if (!containerFiber.child) {
|
|
return null;
|
|
}
|
|
switch (containerFiber.child.tag) {
|
|
case HostComponent:
|
|
return getPublicInstance(containerFiber.child.stateNode);
|
|
default:
|
|
return containerFiber.child.stateNode;
|
|
}
|
|
}
|
|
function attemptSynchronousHydration$1(fiber) {
|
|
switch (fiber.tag) {
|
|
case HostRoot: {
|
|
var root2 = fiber.stateNode;
|
|
if (isRootDehydrated(root2)) {
|
|
var lanes = getHighestPriorityPendingLanes(root2);
|
|
flushRoot(root2, lanes);
|
|
}
|
|
break;
|
|
}
|
|
case SuspenseComponent: {
|
|
flushSync(function() {
|
|
var root3 = enqueueConcurrentRenderForLane(fiber, SyncLane);
|
|
if (root3 !== null) {
|
|
var eventTime = requestEventTime();
|
|
scheduleUpdateOnFiber(root3, fiber, SyncLane, eventTime);
|
|
}
|
|
});
|
|
var retryLane = SyncLane;
|
|
markRetryLaneIfNotHydrated(fiber, retryLane);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
function markRetryLaneImpl(fiber, retryLane) {
|
|
var suspenseState = fiber.memoizedState;
|
|
if (suspenseState !== null && suspenseState.dehydrated !== null) {
|
|
suspenseState.retryLane = higherPriorityLane(suspenseState.retryLane, retryLane);
|
|
}
|
|
}
|
|
function markRetryLaneIfNotHydrated(fiber, retryLane) {
|
|
markRetryLaneImpl(fiber, retryLane);
|
|
var alternate = fiber.alternate;
|
|
if (alternate) {
|
|
markRetryLaneImpl(alternate, retryLane);
|
|
}
|
|
}
|
|
function attemptContinuousHydration$1(fiber) {
|
|
if (fiber.tag !== SuspenseComponent) {
|
|
return;
|
|
}
|
|
var lane = SelectiveHydrationLane;
|
|
var root2 = enqueueConcurrentRenderForLane(fiber, lane);
|
|
if (root2 !== null) {
|
|
var eventTime = requestEventTime();
|
|
scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
|
|
}
|
|
markRetryLaneIfNotHydrated(fiber, lane);
|
|
}
|
|
function attemptHydrationAtCurrentPriority$1(fiber) {
|
|
if (fiber.tag !== SuspenseComponent) {
|
|
return;
|
|
}
|
|
var lane = requestUpdateLane(fiber);
|
|
var root2 = enqueueConcurrentRenderForLane(fiber, lane);
|
|
if (root2 !== null) {
|
|
var eventTime = requestEventTime();
|
|
scheduleUpdateOnFiber(root2, fiber, lane, eventTime);
|
|
}
|
|
markRetryLaneIfNotHydrated(fiber, lane);
|
|
}
|
|
function findHostInstanceWithNoPortals(fiber) {
|
|
var hostFiber = findCurrentHostFiberWithNoPortals(fiber);
|
|
if (hostFiber === null) {
|
|
return null;
|
|
}
|
|
return hostFiber.stateNode;
|
|
}
|
|
var shouldErrorImpl = function(fiber) {
|
|
return null;
|
|
};
|
|
function shouldError(fiber) {
|
|
return shouldErrorImpl(fiber);
|
|
}
|
|
var shouldSuspendImpl = function(fiber) {
|
|
return false;
|
|
};
|
|
function shouldSuspend(fiber) {
|
|
return shouldSuspendImpl(fiber);
|
|
}
|
|
var overrideHookState = null;
|
|
var overrideHookStateDeletePath = null;
|
|
var overrideHookStateRenamePath = null;
|
|
var overrideProps = null;
|
|
var overridePropsDeletePath = null;
|
|
var overridePropsRenamePath = null;
|
|
var scheduleUpdate = null;
|
|
var setErrorHandler = null;
|
|
var setSuspenseHandler = null;
|
|
{
|
|
var copyWithDeleteImpl = function(obj, path, index2) {
|
|
var key = path[index2];
|
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
if (index2 + 1 === path.length) {
|
|
if (isArray2(updated)) {
|
|
updated.splice(key, 1);
|
|
} else {
|
|
delete updated[key];
|
|
}
|
|
return updated;
|
|
}
|
|
updated[key] = copyWithDeleteImpl(obj[key], path, index2 + 1);
|
|
return updated;
|
|
};
|
|
var copyWithDelete = function(obj, path) {
|
|
return copyWithDeleteImpl(obj, path, 0);
|
|
};
|
|
var copyWithRenameImpl = function(obj, oldPath, newPath, index2) {
|
|
var oldKey = oldPath[index2];
|
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
if (index2 + 1 === oldPath.length) {
|
|
var newKey = newPath[index2];
|
|
updated[newKey] = updated[oldKey];
|
|
if (isArray2(updated)) {
|
|
updated.splice(oldKey, 1);
|
|
} else {
|
|
delete updated[oldKey];
|
|
}
|
|
} else {
|
|
updated[oldKey] = copyWithRenameImpl(
|
|
obj[oldKey],
|
|
oldPath,
|
|
newPath,
|
|
index2 + 1
|
|
);
|
|
}
|
|
return updated;
|
|
};
|
|
var copyWithRename = function(obj, oldPath, newPath) {
|
|
if (oldPath.length !== newPath.length) {
|
|
warn("copyWithRename() expects paths of the same length");
|
|
return;
|
|
} else {
|
|
for (var i = 0; i < newPath.length - 1; i++) {
|
|
if (oldPath[i] !== newPath[i]) {
|
|
warn("copyWithRename() expects paths to be the same except for the deepest key");
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
return copyWithRenameImpl(obj, oldPath, newPath, 0);
|
|
};
|
|
var copyWithSetImpl = function(obj, path, index2, value) {
|
|
if (index2 >= path.length) {
|
|
return value;
|
|
}
|
|
var key = path[index2];
|
|
var updated = isArray2(obj) ? obj.slice() : assign2({}, obj);
|
|
updated[key] = copyWithSetImpl(obj[key], path, index2 + 1, value);
|
|
return updated;
|
|
};
|
|
var copyWithSet = function(obj, path, value) {
|
|
return copyWithSetImpl(obj, path, 0, value);
|
|
};
|
|
var findHook = function(fiber, id) {
|
|
var currentHook2 = fiber.memoizedState;
|
|
while (currentHook2 !== null && id > 0) {
|
|
currentHook2 = currentHook2.next;
|
|
id--;
|
|
}
|
|
return currentHook2;
|
|
};
|
|
overrideHookState = function(fiber, id, path, value) {
|
|
var hook = findHook(fiber, id);
|
|
if (hook !== null) {
|
|
var newState = copyWithSet(hook.memoizedState, path, value);
|
|
hook.memoizedState = newState;
|
|
hook.baseState = newState;
|
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
|
|
if (root2 !== null) {
|
|
scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
|
|
}
|
|
}
|
|
};
|
|
overrideHookStateDeletePath = function(fiber, id, path) {
|
|
var hook = findHook(fiber, id);
|
|
if (hook !== null) {
|
|
var newState = copyWithDelete(hook.memoizedState, path);
|
|
hook.memoizedState = newState;
|
|
hook.baseState = newState;
|
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
|
|
if (root2 !== null) {
|
|
scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
|
|
}
|
|
}
|
|
};
|
|
overrideHookStateRenamePath = function(fiber, id, oldPath, newPath) {
|
|
var hook = findHook(fiber, id);
|
|
if (hook !== null) {
|
|
var newState = copyWithRename(hook.memoizedState, oldPath, newPath);
|
|
hook.memoizedState = newState;
|
|
hook.baseState = newState;
|
|
fiber.memoizedProps = assign2({}, fiber.memoizedProps);
|
|
var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
|
|
if (root2 !== null) {
|
|
scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
|
|
}
|
|
}
|
|
};
|
|
overrideProps = function(fiber, path, value) {
|
|
fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value);
|
|
if (fiber.alternate) {
|
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
}
|
|
var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
|
|
if (root2 !== null) {
|
|
scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
|
|
}
|
|
};
|
|
overridePropsDeletePath = function(fiber, path) {
|
|
fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path);
|
|
if (fiber.alternate) {
|
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
}
|
|
var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
|
|
if (root2 !== null) {
|
|
scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
|
|
}
|
|
};
|
|
overridePropsRenamePath = function(fiber, oldPath, newPath) {
|
|
fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath);
|
|
if (fiber.alternate) {
|
|
fiber.alternate.pendingProps = fiber.pendingProps;
|
|
}
|
|
var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
|
|
if (root2 !== null) {
|
|
scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
|
|
}
|
|
};
|
|
scheduleUpdate = function(fiber) {
|
|
var root2 = enqueueConcurrentRenderForLane(fiber, SyncLane);
|
|
if (root2 !== null) {
|
|
scheduleUpdateOnFiber(root2, fiber, SyncLane, NoTimestamp);
|
|
}
|
|
};
|
|
setErrorHandler = function(newShouldErrorImpl) {
|
|
shouldErrorImpl = newShouldErrorImpl;
|
|
};
|
|
setSuspenseHandler = function(newShouldSuspendImpl) {
|
|
shouldSuspendImpl = newShouldSuspendImpl;
|
|
};
|
|
}
|
|
function findHostInstanceByFiber(fiber) {
|
|
var hostFiber = findCurrentHostFiber(fiber);
|
|
if (hostFiber === null) {
|
|
return null;
|
|
}
|
|
return hostFiber.stateNode;
|
|
}
|
|
function emptyFindFiberByHostInstance(instance) {
|
|
return null;
|
|
}
|
|
function getCurrentFiberForDevTools() {
|
|
return current2;
|
|
}
|
|
function injectIntoDevTools(devToolsConfig) {
|
|
var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance;
|
|
var ReactCurrentDispatcher2 = ReactSharedInternals.ReactCurrentDispatcher;
|
|
return injectInternals({
|
|
bundleType: devToolsConfig.bundleType,
|
|
version: devToolsConfig.version,
|
|
rendererPackageName: devToolsConfig.rendererPackageName,
|
|
rendererConfig: devToolsConfig.rendererConfig,
|
|
overrideHookState,
|
|
overrideHookStateDeletePath,
|
|
overrideHookStateRenamePath,
|
|
overrideProps,
|
|
overridePropsDeletePath,
|
|
overridePropsRenamePath,
|
|
setErrorHandler,
|
|
setSuspenseHandler,
|
|
scheduleUpdate,
|
|
currentDispatcherRef: ReactCurrentDispatcher2,
|
|
findHostInstanceByFiber,
|
|
findFiberByHostInstance: findFiberByHostInstance || emptyFindFiberByHostInstance,
|
|
findHostInstancesForRefresh,
|
|
scheduleRefresh,
|
|
scheduleRoot,
|
|
setRefreshHandler,
|
|
getCurrentFiber: getCurrentFiberForDevTools,
|
|
reconcilerVersion: ReactVersion
|
|
});
|
|
}
|
|
var defaultOnRecoverableError = typeof reportError === "function" ? reportError : function(error2) {
|
|
console["error"](error2);
|
|
};
|
|
function ReactDOMRoot(internalRoot) {
|
|
this._internalRoot = internalRoot;
|
|
}
|
|
ReactDOMHydrationRoot.prototype.render = ReactDOMRoot.prototype.render = function(children) {
|
|
var root2 = this._internalRoot;
|
|
if (root2 === null) {
|
|
throw new Error("Cannot update an unmounted root.");
|
|
}
|
|
{
|
|
if (typeof arguments[1] === "function") {
|
|
error("render(...): does not support the second callback argument. To execute a side effect after rendering, declare it in a component body with useEffect().");
|
|
} else if (isValidContainer(arguments[1])) {
|
|
error("You passed a container to the second argument of root.render(...). You don't need to pass it again since you already passed it to create the root.");
|
|
} else if (typeof arguments[1] !== "undefined") {
|
|
error("You passed a second argument to root.render(...) but it only accepts one argument.");
|
|
}
|
|
var container = root2.containerInfo;
|
|
if (container.nodeType !== COMMENT_NODE) {
|
|
var hostInstance = findHostInstanceWithNoPortals(root2.current);
|
|
if (hostInstance) {
|
|
if (hostInstance.parentNode !== container) {
|
|
error("render(...): It looks like the React-rendered content of the root container was removed without using React. This is not supported and will cause errors. Instead, call root.unmount() to empty a root's container.");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
updateContainer(children, root2, null, null);
|
|
};
|
|
ReactDOMHydrationRoot.prototype.unmount = ReactDOMRoot.prototype.unmount = function() {
|
|
{
|
|
if (typeof arguments[0] === "function") {
|
|
error("unmount(...): does not support a callback argument. To execute a side effect after rendering, declare it in a component body with useEffect().");
|
|
}
|
|
}
|
|
var root2 = this._internalRoot;
|
|
if (root2 !== null) {
|
|
this._internalRoot = null;
|
|
var container = root2.containerInfo;
|
|
{
|
|
if (isAlreadyRendering()) {
|
|
error("Attempted to synchronously unmount a root while React was already rendering. React cannot finish unmounting the root until the current render has completed, which may lead to a race condition.");
|
|
}
|
|
}
|
|
flushSync(function() {
|
|
updateContainer(null, root2, null, null);
|
|
});
|
|
unmarkContainerAsRoot(container);
|
|
}
|
|
};
|
|
function createRoot(container, options2) {
|
|
if (!isValidContainer(container)) {
|
|
throw new Error("createRoot(...): Target container is not a DOM element.");
|
|
}
|
|
warnIfReactDOMContainerInDEV(container);
|
|
var isStrictMode = false;
|
|
var concurrentUpdatesByDefaultOverride = false;
|
|
var identifierPrefix = "";
|
|
var onRecoverableError = defaultOnRecoverableError;
|
|
var transitionCallbacks = null;
|
|
if (options2 !== null && options2 !== void 0) {
|
|
{
|
|
if (options2.hydrate) {
|
|
warn("hydrate through createRoot is deprecated. Use ReactDOMClient.hydrateRoot(container, <App />) instead.");
|
|
} else {
|
|
if (typeof options2 === "object" && options2 !== null && options2.$$typeof === REACT_ELEMENT_TYPE2) {
|
|
error("You passed a JSX element to createRoot. You probably meant to call root.render instead. Example usage:\n\n let root = createRoot(domContainer);\n root.render(<App />);");
|
|
}
|
|
}
|
|
}
|
|
if (options2.unstable_strictMode === true) {
|
|
isStrictMode = true;
|
|
}
|
|
if (options2.identifierPrefix !== void 0) {
|
|
identifierPrefix = options2.identifierPrefix;
|
|
}
|
|
if (options2.onRecoverableError !== void 0) {
|
|
onRecoverableError = options2.onRecoverableError;
|
|
}
|
|
if (options2.transitionCallbacks !== void 0) {
|
|
transitionCallbacks = options2.transitionCallbacks;
|
|
}
|
|
}
|
|
var root2 = createContainer(container, ConcurrentRoot, null, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError);
|
|
markContainerAsRoot(root2.current, container);
|
|
var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container;
|
|
listenToAllSupportedEvents(rootContainerElement);
|
|
return new ReactDOMRoot(root2);
|
|
}
|
|
function ReactDOMHydrationRoot(internalRoot) {
|
|
this._internalRoot = internalRoot;
|
|
}
|
|
function scheduleHydration(target) {
|
|
if (target) {
|
|
queueExplicitHydrationTarget(target);
|
|
}
|
|
}
|
|
ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = scheduleHydration;
|
|
function hydrateRoot(container, initialChildren, options2) {
|
|
if (!isValidContainer(container)) {
|
|
throw new Error("hydrateRoot(...): Target container is not a DOM element.");
|
|
}
|
|
warnIfReactDOMContainerInDEV(container);
|
|
{
|
|
if (initialChildren === void 0) {
|
|
error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");
|
|
}
|
|
}
|
|
var hydrationCallbacks = options2 != null ? options2 : null;
|
|
var mutableSources = options2 != null && options2.hydratedSources || null;
|
|
var isStrictMode = false;
|
|
var concurrentUpdatesByDefaultOverride = false;
|
|
var identifierPrefix = "";
|
|
var onRecoverableError = defaultOnRecoverableError;
|
|
if (options2 !== null && options2 !== void 0) {
|
|
if (options2.unstable_strictMode === true) {
|
|
isStrictMode = true;
|
|
}
|
|
if (options2.identifierPrefix !== void 0) {
|
|
identifierPrefix = options2.identifierPrefix;
|
|
}
|
|
if (options2.onRecoverableError !== void 0) {
|
|
onRecoverableError = options2.onRecoverableError;
|
|
}
|
|
}
|
|
var root2 = createHydrationContainer(initialChildren, null, container, ConcurrentRoot, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError);
|
|
markContainerAsRoot(root2.current, container);
|
|
listenToAllSupportedEvents(container);
|
|
if (mutableSources) {
|
|
for (var i = 0; i < mutableSources.length; i++) {
|
|
var mutableSource = mutableSources[i];
|
|
registerMutableSourceForHydration(root2, mutableSource);
|
|
}
|
|
}
|
|
return new ReactDOMHydrationRoot(root2);
|
|
}
|
|
function isValidContainer(node) {
|
|
return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || !disableCommentsAsDOMContainers));
|
|
}
|
|
function isValidContainerLegacy(node) {
|
|
return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === " react-mount-point-unstable "));
|
|
}
|
|
function warnIfReactDOMContainerInDEV(container) {
|
|
{
|
|
if (container.nodeType === ELEMENT_NODE && container.tagName && container.tagName.toUpperCase() === "BODY") {
|
|
error("createRoot(): Creating roots directly with document.body is discouraged, since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try using a container element created for your app.");
|
|
}
|
|
if (isContainerMarkedAsRoot(container)) {
|
|
if (container._reactRootContainer) {
|
|
error("You are calling ReactDOMClient.createRoot() on a container that was previously passed to ReactDOM.render(). This is not supported.");
|
|
} else {
|
|
error("You are calling ReactDOMClient.createRoot() on a container that has already been passed to createRoot() before. Instead, call root.render() on the existing root instead if you want to update it.");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner;
|
|
var topLevelUpdateWarnings;
|
|
{
|
|
topLevelUpdateWarnings = function(container) {
|
|
if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) {
|
|
var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer.current);
|
|
if (hostInstance) {
|
|
if (hostInstance.parentNode !== container) {
|
|
error("render(...): It looks like the React-rendered content of this container was removed without using React. This is not supported and will cause errors. Instead, call ReactDOM.unmountComponentAtNode to empty a container.");
|
|
}
|
|
}
|
|
}
|
|
var isRootRenderedBySomeReact = !!container._reactRootContainer;
|
|
var rootEl = getReactRootElementInContainer(container);
|
|
var hasNonRootReactChild = !!(rootEl && getInstanceFromNode(rootEl));
|
|
if (hasNonRootReactChild && !isRootRenderedBySomeReact) {
|
|
error("render(...): Replacing React-rendered children with a new root component. If you intended to update the children of this node, you should instead have the existing children update their state and render the new components instead of calling ReactDOM.render.");
|
|
}
|
|
if (container.nodeType === ELEMENT_NODE && container.tagName && container.tagName.toUpperCase() === "BODY") {
|
|
error("render(): Rendering components directly into document.body is discouraged, since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try rendering into a container element created for your app.");
|
|
}
|
|
};
|
|
}
|
|
function getReactRootElementInContainer(container) {
|
|
if (!container) {
|
|
return null;
|
|
}
|
|
if (container.nodeType === DOCUMENT_NODE) {
|
|
return container.documentElement;
|
|
} else {
|
|
return container.firstChild;
|
|
}
|
|
}
|
|
function noopOnRecoverableError() {
|
|
}
|
|
function legacyCreateRootFromDOMContainer(container, initialChildren, parentComponent, callback, isHydrationContainer) {
|
|
if (isHydrationContainer) {
|
|
if (typeof callback === "function") {
|
|
var originalCallback = callback;
|
|
callback = function() {
|
|
var instance = getPublicRootInstance(root2);
|
|
originalCallback.call(instance);
|
|
};
|
|
}
|
|
var root2 = createHydrationContainer(
|
|
initialChildren,
|
|
callback,
|
|
container,
|
|
LegacyRoot,
|
|
null,
|
|
false,
|
|
false,
|
|
"",
|
|
noopOnRecoverableError
|
|
);
|
|
container._reactRootContainer = root2;
|
|
markContainerAsRoot(root2.current, container);
|
|
var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container;
|
|
listenToAllSupportedEvents(rootContainerElement);
|
|
flushSync();
|
|
return root2;
|
|
} else {
|
|
var rootSibling;
|
|
while (rootSibling = container.lastChild) {
|
|
container.removeChild(rootSibling);
|
|
}
|
|
if (typeof callback === "function") {
|
|
var _originalCallback = callback;
|
|
callback = function() {
|
|
var instance = getPublicRootInstance(_root);
|
|
_originalCallback.call(instance);
|
|
};
|
|
}
|
|
var _root = createContainer(
|
|
container,
|
|
LegacyRoot,
|
|
null,
|
|
false,
|
|
false,
|
|
"",
|
|
noopOnRecoverableError
|
|
);
|
|
container._reactRootContainer = _root;
|
|
markContainerAsRoot(_root.current, container);
|
|
var _rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container;
|
|
listenToAllSupportedEvents(_rootContainerElement);
|
|
flushSync(function() {
|
|
updateContainer(initialChildren, _root, parentComponent, callback);
|
|
});
|
|
return _root;
|
|
}
|
|
}
|
|
function warnOnInvalidCallback$1(callback, callerName) {
|
|
{
|
|
if (callback !== null && typeof callback !== "function") {
|
|
error("%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.", callerName, callback);
|
|
}
|
|
}
|
|
}
|
|
function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) {
|
|
{
|
|
topLevelUpdateWarnings(container);
|
|
warnOnInvalidCallback$1(callback === void 0 ? null : callback, "render");
|
|
}
|
|
var maybeRoot = container._reactRootContainer;
|
|
var root2;
|
|
if (!maybeRoot) {
|
|
root2 = legacyCreateRootFromDOMContainer(container, children, parentComponent, callback, forceHydrate);
|
|
} else {
|
|
root2 = maybeRoot;
|
|
if (typeof callback === "function") {
|
|
var originalCallback = callback;
|
|
callback = function() {
|
|
var instance = getPublicRootInstance(root2);
|
|
originalCallback.call(instance);
|
|
};
|
|
}
|
|
updateContainer(children, root2, parentComponent, callback);
|
|
}
|
|
return getPublicRootInstance(root2);
|
|
}
|
|
var didWarnAboutFindDOMNode = false;
|
|
function findDOMNode(componentOrElement) {
|
|
{
|
|
if (!didWarnAboutFindDOMNode) {
|
|
didWarnAboutFindDOMNode = true;
|
|
error("findDOMNode is deprecated and will be removed in the next major release. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node");
|
|
}
|
|
var owner = ReactCurrentOwner$3.current;
|
|
if (owner !== null && owner.stateNode !== null) {
|
|
var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender;
|
|
if (!warnedAboutRefsInRender) {
|
|
error("%s is accessing findDOMNode inside its render(). render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.", getComponentNameFromType(owner.type) || "A component");
|
|
}
|
|
owner.stateNode._warnedAboutRefsInRender = true;
|
|
}
|
|
}
|
|
if (componentOrElement == null) {
|
|
return null;
|
|
}
|
|
if (componentOrElement.nodeType === ELEMENT_NODE) {
|
|
return componentOrElement;
|
|
}
|
|
{
|
|
return findHostInstanceWithWarning(componentOrElement, "findDOMNode");
|
|
}
|
|
}
|
|
function hydrate(element, container, callback) {
|
|
{
|
|
error("ReactDOM.hydrate is no longer supported in React 18. Use hydrateRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot");
|
|
}
|
|
if (!isValidContainerLegacy(container)) {
|
|
throw new Error("Target container is not a DOM element.");
|
|
}
|
|
{
|
|
var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === void 0;
|
|
if (isModernRoot) {
|
|
error("You are calling ReactDOM.hydrate() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call hydrateRoot(container, element)?");
|
|
}
|
|
}
|
|
return legacyRenderSubtreeIntoContainer(null, element, container, true, callback);
|
|
}
|
|
function render3(element, container, callback) {
|
|
{
|
|
error("ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot");
|
|
}
|
|
if (!isValidContainerLegacy(container)) {
|
|
throw new Error("Target container is not a DOM element.");
|
|
}
|
|
{
|
|
var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === void 0;
|
|
if (isModernRoot) {
|
|
error("You are calling ReactDOM.render() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.render(element)?");
|
|
}
|
|
}
|
|
return legacyRenderSubtreeIntoContainer(null, element, container, false, callback);
|
|
}
|
|
function unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) {
|
|
{
|
|
error("ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported in React 18. Consider using a portal instead. Until you switch to the createRoot API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot");
|
|
}
|
|
if (!isValidContainerLegacy(containerNode)) {
|
|
throw new Error("Target container is not a DOM element.");
|
|
}
|
|
if (parentComponent == null || !has2(parentComponent)) {
|
|
throw new Error("parentComponent must be a valid React Component");
|
|
}
|
|
return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback);
|
|
}
|
|
var didWarnAboutUnmountComponentAtNode = false;
|
|
function unmountComponentAtNode(container) {
|
|
{
|
|
if (!didWarnAboutUnmountComponentAtNode) {
|
|
didWarnAboutUnmountComponentAtNode = true;
|
|
error("unmountComponentAtNode is deprecated and will be removed in the next major release. Switch to the createRoot API. Learn more: https://reactjs.org/link/switch-to-createroot");
|
|
}
|
|
}
|
|
if (!isValidContainerLegacy(container)) {
|
|
throw new Error("unmountComponentAtNode(...): Target container is not a DOM element.");
|
|
}
|
|
{
|
|
var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === void 0;
|
|
if (isModernRoot) {
|
|
error("You are calling ReactDOM.unmountComponentAtNode() on a container that was previously passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.unmount()?");
|
|
}
|
|
}
|
|
if (container._reactRootContainer) {
|
|
{
|
|
var rootEl = getReactRootElementInContainer(container);
|
|
var renderedByDifferentReact = rootEl && !getInstanceFromNode(rootEl);
|
|
if (renderedByDifferentReact) {
|
|
error("unmountComponentAtNode(): The node you're attempting to unmount was rendered by another copy of React.");
|
|
}
|
|
}
|
|
flushSync(function() {
|
|
legacyRenderSubtreeIntoContainer(null, null, container, false, function() {
|
|
container._reactRootContainer = null;
|
|
unmarkContainerAsRoot(container);
|
|
});
|
|
});
|
|
return true;
|
|
} else {
|
|
{
|
|
var _rootEl = getReactRootElementInContainer(container);
|
|
var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode(_rootEl));
|
|
var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainerLegacy(container.parentNode) && !!container.parentNode._reactRootContainer;
|
|
if (hasNonRootReactChild) {
|
|
error("unmountComponentAtNode(): The node you're attempting to unmount was rendered by React and is not a top-level container. %s", isContainerReactRoot ? "You may have accidentally passed in a React root node instead of its container." : "Instead, have the parent component update its state and rerender in order to remove this component.");
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
setAttemptSynchronousHydration(attemptSynchronousHydration$1);
|
|
setAttemptContinuousHydration(attemptContinuousHydration$1);
|
|
setAttemptHydrationAtCurrentPriority(attemptHydrationAtCurrentPriority$1);
|
|
setGetCurrentUpdatePriority(getCurrentUpdatePriority);
|
|
setAttemptHydrationAtPriority(runWithPriority);
|
|
{
|
|
if (typeof Map !== "function" || Map.prototype == null || typeof Map.prototype.forEach !== "function" || typeof Set !== "function" || Set.prototype == null || typeof Set.prototype.clear !== "function" || typeof Set.prototype.forEach !== "function") {
|
|
error("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills");
|
|
}
|
|
}
|
|
setRestoreImplementation(restoreControlledState$3);
|
|
setBatchingImplementation(batchedUpdates$1, discreteUpdates, flushSync);
|
|
function createPortal$1(children, container) {
|
|
var key = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
|
|
if (!isValidContainer(container)) {
|
|
throw new Error("Target container is not a DOM element.");
|
|
}
|
|
return createPortal(children, container, null, key);
|
|
}
|
|
function renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) {
|
|
return unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback);
|
|
}
|
|
var Internals = {
|
|
usingClientEntryPoint: false,
|
|
Events: [getInstanceFromNode, getNodeFromInstance, getFiberCurrentPropsFromNode, enqueueStateRestore, restoreStateIfNeeded, batchedUpdates$1]
|
|
};
|
|
function createRoot$1(container, options2) {
|
|
{
|
|
if (!Internals.usingClientEntryPoint && true) {
|
|
error('You are importing createRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".');
|
|
}
|
|
}
|
|
return createRoot(container, options2);
|
|
}
|
|
function hydrateRoot$1(container, initialChildren, options2) {
|
|
{
|
|
if (!Internals.usingClientEntryPoint && true) {
|
|
error('You are importing hydrateRoot from "react-dom" which is not supported. You should instead import it from "react-dom/client".');
|
|
}
|
|
}
|
|
return hydrateRoot(container, initialChildren, options2);
|
|
}
|
|
function flushSync$1(fn) {
|
|
{
|
|
if (isAlreadyRendering()) {
|
|
error("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task.");
|
|
}
|
|
}
|
|
return flushSync(fn);
|
|
}
|
|
var foundDevTools = injectIntoDevTools({
|
|
findFiberByHostInstance: getClosestInstanceFromNode,
|
|
bundleType: 1,
|
|
version: ReactVersion,
|
|
rendererPackageName: "react-dom"
|
|
});
|
|
{
|
|
if (!foundDevTools && canUseDOM2 && window.top === window.self) {
|
|
if (navigator.userAgent.indexOf("Chrome") > -1 && navigator.userAgent.indexOf("Edge") === -1 || navigator.userAgent.indexOf("Firefox") > -1) {
|
|
var protocol = window.location.protocol;
|
|
if (/^(https?|file):$/.test(protocol)) {
|
|
console.info("%cDownload the React DevTools for a better development experience: https://reactjs.org/link/react-devtools" + (protocol === "file:" ? "\nYou might need to use a local HTTP server (instead of file://): https://reactjs.org/link/react-devtools-faq" : ""), "font-weight:bold");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals;
|
|
exports.createPortal = createPortal$1;
|
|
exports.createRoot = createRoot$1;
|
|
exports.findDOMNode = findDOMNode;
|
|
exports.flushSync = flushSync$1;
|
|
exports.hydrate = hydrate;
|
|
exports.hydrateRoot = hydrateRoot$1;
|
|
exports.render = render3;
|
|
exports.unmountComponentAtNode = unmountComponentAtNode;
|
|
exports.unstable_batchedUpdates = batchedUpdates$1;
|
|
exports.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer;
|
|
exports.version = ReactVersion;
|
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
|
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
}
|
|
})();
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/react-dom/index.js
|
|
var require_react_dom = __commonJS({
|
|
"node_modules/react-dom/index.js"(exports, module) {
|
|
"use strict";
|
|
if (false) {
|
|
checkDCE();
|
|
module.exports = null;
|
|
} else {
|
|
module.exports = require_react_dom_development();
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/react-dom/client.js
|
|
var require_client = __commonJS({
|
|
"node_modules/react-dom/client.js"(exports) {
|
|
"use strict";
|
|
var m = require_react_dom();
|
|
if (false) {
|
|
exports.createRoot = m.createRoot;
|
|
exports.hydrateRoot = m.hydrateRoot;
|
|
} else {
|
|
i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
exports.createRoot = function(c, o) {
|
|
i.usingClientEntryPoint = true;
|
|
try {
|
|
return m.createRoot(c, o);
|
|
} finally {
|
|
i.usingClientEntryPoint = false;
|
|
}
|
|
};
|
|
exports.hydrateRoot = function(c, h, o) {
|
|
i.usingClientEntryPoint = true;
|
|
try {
|
|
return m.hydrateRoot(c, h, o);
|
|
} finally {
|
|
i.usingClientEntryPoint = false;
|
|
}
|
|
};
|
|
}
|
|
var i;
|
|
}
|
|
});
|
|
|
|
// src/lib/p3d.ts
|
|
var p3d_exports = {};
|
|
__export(p3d_exports, {
|
|
default: () => p3d_default,
|
|
getEFBVariable: () => getEFBVariable,
|
|
getSimulatorVariable: () => getSimulatorVariable,
|
|
setDefaultPanelState: () => setDefaultPanelState,
|
|
setEFBVariable: () => setEFBVariable,
|
|
setPanelState: () => setPanelState,
|
|
setPayload: () => setPayload,
|
|
setSimulatorVariable: () => setSimulatorVariable,
|
|
triggerReadVariable: () => triggerReadVariable
|
|
});
|
|
var variables, setSimulatorVariable, setEFBVariable, getSimulatorVariable, getEFBVariable, triggerReadVariable, setPayload, setPanelState, setDefaultPanelState, p3d_default;
|
|
var init_p3d = __esm({
|
|
"src/lib/p3d.ts"() {
|
|
init_common();
|
|
variables = {
|
|
"A:SIM ON GROUND": 1,
|
|
"A:EMPTY WEIGHT": 35e4,
|
|
"L:MD11_EFB_IS_CARGO": 0,
|
|
"L:MD11_EFB_SERIAL_NUMBER": 990,
|
|
"L:MD11_EFB_DEFAULT_PANEL_STATE": 4,
|
|
"L:MD11_EFB_IRS_ALIGN": 2,
|
|
"E:TIME OF DAY": 1,
|
|
"L:MD11_EFB_MTOW": 273290,
|
|
"L:MD11_EFB_TAKEOFF_CG": 25,
|
|
"L:MD11_EFB_VAPP": 140,
|
|
"L:MD11_EFB_VREF": 160,
|
|
"L:MD11_EFB_CAN_BE_ER": 1
|
|
};
|
|
setSimulatorVariable = async (name, type, value) => {
|
|
variables[name] = value;
|
|
console.log(name, type, value);
|
|
};
|
|
setEFBVariable = async (name, type, value) => {
|
|
setSimulatorVariable(`L:MD11_EFB_${name}`, type, value);
|
|
};
|
|
getSimulatorVariable = (name, type = "number") => {
|
|
if (variables[name]) {
|
|
return variables[name];
|
|
}
|
|
return 0;
|
|
};
|
|
getEFBVariable = (name, type = "number") => {
|
|
return getSimulatorVariable(`L:MD11_EFB_${name}`, type);
|
|
};
|
|
triggerReadVariable = async (ready) => {
|
|
let total = getSimulatorVariable("READ_READY", "number");
|
|
ready.forEach((value) => {
|
|
total = total | value;
|
|
});
|
|
await setEFBVariable("READ_READY", "number", total);
|
|
if (ready.includes(128 /* DeparturePerformance */)) {
|
|
await setEFBVariable("V1", "knots", 150);
|
|
await setEFBVariable("VR", "knots", 160);
|
|
await setEFBVariable("V2", "knots", 170);
|
|
await setEFBVariable("FLEX_TEMP", "celsius", 50);
|
|
await setEFBVariable("FLAPS", "number", 15);
|
|
}
|
|
await setEFBVariable("READ_READY", "number", 0);
|
|
};
|
|
setPayload = async (output) => {
|
|
await setEFBVariable("PAYLOAD_GW", "pounds", output.gw);
|
|
await setEFBVariable("PAYLOAD_ZFW", "pounds", output.zfw);
|
|
await setEFBVariable("PAYLOAD_PAYLOAD", "pounds", output.payload);
|
|
await setEFBVariable("PAYLOAD_FUEL", "pounds", output.fuel);
|
|
await setEFBVariable("PAYLOAD_LOAD", "pounds", output.load);
|
|
await triggerReadVariable([1 /* Payload */]);
|
|
};
|
|
setPanelState = async (state) => {
|
|
await setEFBVariable("PANEL_STATE", "number", state);
|
|
await triggerReadVariable([2 /* PanelState */]);
|
|
};
|
|
setDefaultPanelState = async (state) => {
|
|
await setEFBVariable("DEFAULT_PANEL_STATE", "number", state);
|
|
await triggerReadVariable([4 /* DefaultPanelState */]);
|
|
};
|
|
p3d_default = () => {
|
|
console.log("running in p3d");
|
|
};
|
|
}
|
|
});
|
|
|
|
// src/lib/msfs.ts
|
|
var msfs_exports = {};
|
|
__export(msfs_exports, {
|
|
default: () => msfs_default,
|
|
getEFBVariable: () => getEFBVariable2,
|
|
getSimulatorVariable: () => getSimulatorVariable2,
|
|
setDefaultPanelState: () => setDefaultPanelState2,
|
|
setEFBVariable: () => setEFBVariable2,
|
|
setPanelState: () => setPanelState2,
|
|
setPayload: () => setPayload2,
|
|
setSimulatorVariable: () => setSimulatorVariable2,
|
|
triggerReadVariable: () => triggerReadVariable2
|
|
});
|
|
var setSimulatorVariable2, setEFBVariable2, getSimulatorVariable2, getEFBVariable2, triggerReadVariable2, setPayload2, setPanelState2, setDefaultPanelState2, msfs_default;
|
|
var init_msfs = __esm({
|
|
"src/lib/msfs.ts"() {
|
|
init_common();
|
|
setSimulatorVariable2 = async (name, type, value) => {
|
|
await SimVar.SetSimVarValue(name, type, value);
|
|
};
|
|
setEFBVariable2 = async (name, type, value) => {
|
|
await setSimulatorVariable2(`L:MD11_EFB_${name}`, type, value);
|
|
};
|
|
getSimulatorVariable2 = (name, type = "number") => {
|
|
return SimVar.GetSimVarValue(name, type);
|
|
};
|
|
getEFBVariable2 = (name, type = "number") => {
|
|
return getSimulatorVariable2(`L:MD11_EFB_${name}`, type);
|
|
};
|
|
triggerReadVariable2 = async (ready) => {
|
|
let total = getEFBVariable2("READ_READY", "number");
|
|
ready.forEach((value) => {
|
|
total = total | value;
|
|
});
|
|
await setEFBVariable2("READ_READY", "number", total);
|
|
};
|
|
setPayload2 = async (output) => {
|
|
await setEFBVariable2("PAYLOAD_GW", "pounds", output.gw);
|
|
await setEFBVariable2("PAYLOAD_ZFW", "pounds", output.zfw);
|
|
await setEFBVariable2("PAYLOAD_PAYLOAD", "pounds", output.payload);
|
|
await setEFBVariable2("PAYLOAD_FUEL", "pounds", output.fuel);
|
|
await setEFBVariable2("PAYLOAD_LOAD", "pounds", output.load);
|
|
await triggerReadVariable2([1 /* Payload */]);
|
|
};
|
|
setPanelState2 = async (state) => {
|
|
await setEFBVariable2("PANEL_STATE", "number", state);
|
|
await triggerReadVariable2([2 /* PanelState */]);
|
|
};
|
|
setDefaultPanelState2 = async (state) => {
|
|
await setEFBVariable2("DEFAULT_PANEL_STATE", "number", state);
|
|
await triggerReadVariable2([4 /* DefaultPanelState */]);
|
|
};
|
|
msfs_default = () => {
|
|
console.log("running in msfs");
|
|
};
|
|
}
|
|
});
|
|
|
|
// src/lib/common.ts
|
|
var import_meta, simulator, lib;
|
|
var init_common = __esm({
|
|
"src/lib/common.ts"() {
|
|
import_meta = {};
|
|
simulator = () => {
|
|
if (import_meta != null && import_meta.env != null && import_meta.env.MODE != null && import_meta.env.MODE === "p3d") {
|
|
return 1 /* P3D */;
|
|
}
|
|
return 0 /* MSFS */;
|
|
};
|
|
lib = () => {
|
|
switch (simulator()) {
|
|
case 1 /* P3D */:
|
|
return Promise.resolve().then(() => (init_p3d(), p3d_exports));
|
|
case 0 /* MSFS */:
|
|
return Promise.resolve().then(() => (init_msfs(), msfs_exports));
|
|
}
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js
|
|
var require_use_sync_external_store_with_selector_development = __commonJS({
|
|
"node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js"(exports) {
|
|
"use strict";
|
|
if (true) {
|
|
(function() {
|
|
"use strict";
|
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
}
|
|
var React6 = require_react();
|
|
function is2(x, y) {
|
|
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
|
|
}
|
|
var objectIs = typeof Object.is === "function" ? Object.is : is2;
|
|
var useSyncExternalStore3 = React6.useSyncExternalStore;
|
|
var useRef3 = React6.useRef, useEffect15 = React6.useEffect, useMemo = React6.useMemo, useDebugValue = React6.useDebugValue;
|
|
function useSyncExternalStoreWithSelector3(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
var instRef = useRef3(null);
|
|
var inst;
|
|
if (instRef.current === null) {
|
|
inst = {
|
|
hasValue: false,
|
|
value: null
|
|
};
|
|
instRef.current = inst;
|
|
} else {
|
|
inst = instRef.current;
|
|
}
|
|
var _useMemo = useMemo(function() {
|
|
var hasMemo = false;
|
|
var memoizedSnapshot;
|
|
var memoizedSelection;
|
|
var memoizedSelector = function(nextSnapshot) {
|
|
if (!hasMemo) {
|
|
hasMemo = true;
|
|
memoizedSnapshot = nextSnapshot;
|
|
var _nextSelection = selector(nextSnapshot);
|
|
if (isEqual !== void 0) {
|
|
if (inst.hasValue) {
|
|
var currentSelection = inst.value;
|
|
if (isEqual(currentSelection, _nextSelection)) {
|
|
memoizedSelection = currentSelection;
|
|
return currentSelection;
|
|
}
|
|
}
|
|
}
|
|
memoizedSelection = _nextSelection;
|
|
return _nextSelection;
|
|
}
|
|
var prevSnapshot = memoizedSnapshot;
|
|
var prevSelection = memoizedSelection;
|
|
if (objectIs(prevSnapshot, nextSnapshot)) {
|
|
return prevSelection;
|
|
}
|
|
var nextSelection = selector(nextSnapshot);
|
|
if (isEqual !== void 0 && isEqual(prevSelection, nextSelection)) {
|
|
return prevSelection;
|
|
}
|
|
memoizedSnapshot = nextSnapshot;
|
|
memoizedSelection = nextSelection;
|
|
return nextSelection;
|
|
};
|
|
var maybeGetServerSnapshot = getServerSnapshot === void 0 ? null : getServerSnapshot;
|
|
var getSnapshotWithSelector = function() {
|
|
return memoizedSelector(getSnapshot());
|
|
};
|
|
var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? void 0 : function() {
|
|
return memoizedSelector(maybeGetServerSnapshot());
|
|
};
|
|
return [getSnapshotWithSelector, getServerSnapshotWithSelector];
|
|
}, [getSnapshot, getServerSnapshot, selector, isEqual]), getSelection = _useMemo[0], getServerSelection = _useMemo[1];
|
|
var value = useSyncExternalStore3(subscribe, getSelection, getServerSelection);
|
|
useEffect15(function() {
|
|
inst.hasValue = true;
|
|
inst.value = value;
|
|
}, [value]);
|
|
useDebugValue(value);
|
|
return value;
|
|
}
|
|
exports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector3;
|
|
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
|
|
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
}
|
|
})();
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/use-sync-external-store/with-selector.js
|
|
var require_with_selector = __commonJS({
|
|
"node_modules/use-sync-external-store/with-selector.js"(exports, module) {
|
|
"use strict";
|
|
if (false) {
|
|
module.exports = null;
|
|
} else {
|
|
module.exports = require_use_sync_external_store_with_selector_development();
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/react-error-boundary/dist/react-error-boundary.cjs.js
|
|
var require_react_error_boundary_cjs = __commonJS({
|
|
"node_modules/react-error-boundary/dist/react-error-boundary.cjs.js"(exports) {
|
|
"use strict";
|
|
"use client";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var react = require_react();
|
|
var ErrorBoundaryContext2 = react.createContext(null);
|
|
var initialState9 = {
|
|
didCatch: false,
|
|
error: null
|
|
};
|
|
var ErrorBoundary2 = class extends react.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.resetErrorBoundary = this.resetErrorBoundary.bind(this);
|
|
this.state = initialState9;
|
|
}
|
|
static getDerivedStateFromError(error) {
|
|
return {
|
|
didCatch: true,
|
|
error
|
|
};
|
|
}
|
|
resetErrorBoundary() {
|
|
const {
|
|
error
|
|
} = this.state;
|
|
if (error !== null) {
|
|
var _this$props$onReset, _this$props;
|
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
args[_key] = arguments[_key];
|
|
}
|
|
(_this$props$onReset = (_this$props = this.props).onReset) === null || _this$props$onReset === void 0 ? void 0 : _this$props$onReset.call(_this$props, {
|
|
args,
|
|
reason: "imperative-api"
|
|
});
|
|
this.setState(initialState9);
|
|
}
|
|
}
|
|
componentDidCatch(error, info) {
|
|
var _this$props$onError, _this$props2;
|
|
(_this$props$onError = (_this$props2 = this.props).onError) === null || _this$props$onError === void 0 ? void 0 : _this$props$onError.call(_this$props2, error, info);
|
|
}
|
|
componentDidUpdate(prevProps, prevState) {
|
|
const {
|
|
didCatch
|
|
} = this.state;
|
|
const {
|
|
resetKeys
|
|
} = this.props;
|
|
if (didCatch && prevState.error !== null && hasArrayChanged(prevProps.resetKeys, resetKeys)) {
|
|
var _this$props$onReset2, _this$props3;
|
|
(_this$props$onReset2 = (_this$props3 = this.props).onReset) === null || _this$props$onReset2 === void 0 ? void 0 : _this$props$onReset2.call(_this$props3, {
|
|
next: resetKeys,
|
|
prev: prevProps.resetKeys,
|
|
reason: "keys"
|
|
});
|
|
this.setState(initialState9);
|
|
}
|
|
}
|
|
render() {
|
|
const {
|
|
children,
|
|
fallbackRender,
|
|
FallbackComponent,
|
|
fallback
|
|
} = this.props;
|
|
const {
|
|
didCatch,
|
|
error
|
|
} = this.state;
|
|
let childToRender = children;
|
|
if (didCatch) {
|
|
const props = {
|
|
error,
|
|
resetErrorBoundary: this.resetErrorBoundary
|
|
};
|
|
if (typeof fallbackRender === "function") {
|
|
childToRender = fallbackRender(props);
|
|
} else if (FallbackComponent) {
|
|
childToRender = react.createElement(FallbackComponent, props);
|
|
} else if (fallback === null || react.isValidElement(fallback)) {
|
|
childToRender = fallback;
|
|
} else {
|
|
throw error;
|
|
}
|
|
}
|
|
return react.createElement(ErrorBoundaryContext2.Provider, {
|
|
value: {
|
|
didCatch,
|
|
error,
|
|
resetErrorBoundary: this.resetErrorBoundary
|
|
}
|
|
}, childToRender);
|
|
}
|
|
};
|
|
function hasArrayChanged() {
|
|
let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
let b = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
return a.length !== b.length || a.some((item, index) => !Object.is(item, b[index]));
|
|
}
|
|
function assertErrorBoundaryContext(value) {
|
|
if (value == null || typeof value.didCatch !== "boolean" || typeof value.resetErrorBoundary !== "function") {
|
|
throw new Error("ErrorBoundaryContext not found");
|
|
}
|
|
}
|
|
function useErrorBoundary2() {
|
|
const context = react.useContext(ErrorBoundaryContext2);
|
|
assertErrorBoundaryContext(context);
|
|
const [state, setState] = react.useState({
|
|
error: null,
|
|
hasError: false
|
|
});
|
|
const memoized = react.useMemo(() => ({
|
|
resetBoundary: () => {
|
|
context.resetErrorBoundary();
|
|
setState({
|
|
error: null,
|
|
hasError: false
|
|
});
|
|
},
|
|
showBoundary: (error) => setState({
|
|
error,
|
|
hasError: true
|
|
})
|
|
}), [context.resetErrorBoundary]);
|
|
if (state.hasError) {
|
|
throw state.error;
|
|
}
|
|
return memoized;
|
|
}
|
|
function withErrorBoundary2(component, errorBoundaryProps) {
|
|
const Wrapped = react.forwardRef((props, ref) => react.createElement(ErrorBoundary2, errorBoundaryProps, react.createElement(component, __spreadProps(__spreadValues({}, props), {
|
|
ref
|
|
}))));
|
|
const name = component.displayName || component.name || "Unknown";
|
|
Wrapped.displayName = "withErrorBoundary(".concat(name, ")");
|
|
return Wrapped;
|
|
}
|
|
exports.ErrorBoundary = ErrorBoundary2;
|
|
exports.ErrorBoundaryContext = ErrorBoundaryContext2;
|
|
exports.useErrorBoundary = useErrorBoundary2;
|
|
exports.withErrorBoundary = withErrorBoundary2;
|
|
}
|
|
});
|
|
|
|
// node_modules/react-is/cjs/react-is.development.js
|
|
var require_react_is_development = __commonJS({
|
|
"node_modules/react-is/cjs/react-is.development.js"(exports) {
|
|
"use strict";
|
|
if (true) {
|
|
(function() {
|
|
"use strict";
|
|
var hasSymbol = typeof Symbol === "function" && Symbol.for;
|
|
var REACT_ELEMENT_TYPE2 = hasSymbol ? Symbol.for("react.element") : 60103;
|
|
var REACT_PORTAL_TYPE2 = hasSymbol ? Symbol.for("react.portal") : 60106;
|
|
var REACT_FRAGMENT_TYPE2 = hasSymbol ? Symbol.for("react.fragment") : 60107;
|
|
var REACT_STRICT_MODE_TYPE2 = hasSymbol ? Symbol.for("react.strict_mode") : 60108;
|
|
var REACT_PROFILER_TYPE2 = hasSymbol ? Symbol.for("react.profiler") : 60114;
|
|
var REACT_PROVIDER_TYPE2 = hasSymbol ? Symbol.for("react.provider") : 60109;
|
|
var REACT_CONTEXT_TYPE2 = hasSymbol ? Symbol.for("react.context") : 60110;
|
|
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 60111;
|
|
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 60111;
|
|
var REACT_FORWARD_REF_TYPE2 = hasSymbol ? Symbol.for("react.forward_ref") : 60112;
|
|
var REACT_SUSPENSE_TYPE2 = hasSymbol ? Symbol.for("react.suspense") : 60113;
|
|
var REACT_SUSPENSE_LIST_TYPE2 = hasSymbol ? Symbol.for("react.suspense_list") : 60120;
|
|
var REACT_MEMO_TYPE2 = hasSymbol ? Symbol.for("react.memo") : 60115;
|
|
var REACT_LAZY_TYPE2 = hasSymbol ? Symbol.for("react.lazy") : 60116;
|
|
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 60121;
|
|
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 60117;
|
|
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 60118;
|
|
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 60119;
|
|
function isValidElementType(type) {
|
|
return typeof type === "string" || typeof type === "function" || type === REACT_FRAGMENT_TYPE2 || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE2 || type === REACT_STRICT_MODE_TYPE2 || type === REACT_SUSPENSE_TYPE2 || type === REACT_SUSPENSE_LIST_TYPE2 || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE2 || type.$$typeof === REACT_MEMO_TYPE2 || type.$$typeof === REACT_PROVIDER_TYPE2 || type.$$typeof === REACT_CONTEXT_TYPE2 || type.$$typeof === REACT_FORWARD_REF_TYPE2 || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
}
|
|
function typeOf(object) {
|
|
if (typeof object === "object" && object !== null) {
|
|
var $$typeof = object.$$typeof;
|
|
switch ($$typeof) {
|
|
case REACT_ELEMENT_TYPE2:
|
|
var type = object.type;
|
|
switch (type) {
|
|
case REACT_ASYNC_MODE_TYPE:
|
|
case REACT_CONCURRENT_MODE_TYPE:
|
|
case REACT_FRAGMENT_TYPE2:
|
|
case REACT_PROFILER_TYPE2:
|
|
case REACT_STRICT_MODE_TYPE2:
|
|
case REACT_SUSPENSE_TYPE2:
|
|
return type;
|
|
default:
|
|
var $$typeofType = type && type.$$typeof;
|
|
switch ($$typeofType) {
|
|
case REACT_CONTEXT_TYPE2:
|
|
case REACT_FORWARD_REF_TYPE2:
|
|
case REACT_LAZY_TYPE2:
|
|
case REACT_MEMO_TYPE2:
|
|
case REACT_PROVIDER_TYPE2:
|
|
return $$typeofType;
|
|
default:
|
|
return $$typeof;
|
|
}
|
|
}
|
|
case REACT_PORTAL_TYPE2:
|
|
return $$typeof;
|
|
}
|
|
}
|
|
return void 0;
|
|
}
|
|
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
var ContextConsumer = REACT_CONTEXT_TYPE2;
|
|
var ContextProvider = REACT_PROVIDER_TYPE2;
|
|
var Element = REACT_ELEMENT_TYPE2;
|
|
var ForwardRef2 = REACT_FORWARD_REF_TYPE2;
|
|
var Fragment7 = REACT_FRAGMENT_TYPE2;
|
|
var Lazy = REACT_LAZY_TYPE2;
|
|
var Memo2 = REACT_MEMO_TYPE2;
|
|
var Portal = REACT_PORTAL_TYPE2;
|
|
var Profiler = REACT_PROFILER_TYPE2;
|
|
var StrictMode = REACT_STRICT_MODE_TYPE2;
|
|
var Suspense = REACT_SUSPENSE_TYPE2;
|
|
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
function isAsyncMode(object) {
|
|
{
|
|
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
hasWarnedAboutDeprecatedIsAsyncMode = true;
|
|
console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.");
|
|
}
|
|
}
|
|
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
}
|
|
function isConcurrentMode(object) {
|
|
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
}
|
|
function isContextConsumer(object) {
|
|
return typeOf(object) === REACT_CONTEXT_TYPE2;
|
|
}
|
|
function isContextProvider(object) {
|
|
return typeOf(object) === REACT_PROVIDER_TYPE2;
|
|
}
|
|
function isElement(object) {
|
|
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE2;
|
|
}
|
|
function isForwardRef(object) {
|
|
return typeOf(object) === REACT_FORWARD_REF_TYPE2;
|
|
}
|
|
function isFragment(object) {
|
|
return typeOf(object) === REACT_FRAGMENT_TYPE2;
|
|
}
|
|
function isLazy(object) {
|
|
return typeOf(object) === REACT_LAZY_TYPE2;
|
|
}
|
|
function isMemo(object) {
|
|
return typeOf(object) === REACT_MEMO_TYPE2;
|
|
}
|
|
function isPortal(object) {
|
|
return typeOf(object) === REACT_PORTAL_TYPE2;
|
|
}
|
|
function isProfiler(object) {
|
|
return typeOf(object) === REACT_PROFILER_TYPE2;
|
|
}
|
|
function isStrictMode(object) {
|
|
return typeOf(object) === REACT_STRICT_MODE_TYPE2;
|
|
}
|
|
function isSuspense(object) {
|
|
return typeOf(object) === REACT_SUSPENSE_TYPE2;
|
|
}
|
|
exports.AsyncMode = AsyncMode;
|
|
exports.ConcurrentMode = ConcurrentMode;
|
|
exports.ContextConsumer = ContextConsumer;
|
|
exports.ContextProvider = ContextProvider;
|
|
exports.Element = Element;
|
|
exports.ForwardRef = ForwardRef2;
|
|
exports.Fragment = Fragment7;
|
|
exports.Lazy = Lazy;
|
|
exports.Memo = Memo2;
|
|
exports.Portal = Portal;
|
|
exports.Profiler = Profiler;
|
|
exports.StrictMode = StrictMode;
|
|
exports.Suspense = Suspense;
|
|
exports.isAsyncMode = isAsyncMode;
|
|
exports.isConcurrentMode = isConcurrentMode;
|
|
exports.isContextConsumer = isContextConsumer;
|
|
exports.isContextProvider = isContextProvider;
|
|
exports.isElement = isElement;
|
|
exports.isForwardRef = isForwardRef;
|
|
exports.isFragment = isFragment;
|
|
exports.isLazy = isLazy;
|
|
exports.isMemo = isMemo;
|
|
exports.isPortal = isPortal;
|
|
exports.isProfiler = isProfiler;
|
|
exports.isStrictMode = isStrictMode;
|
|
exports.isSuspense = isSuspense;
|
|
exports.isValidElementType = isValidElementType;
|
|
exports.typeOf = typeOf;
|
|
})();
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/react-is/index.js
|
|
var require_react_is = __commonJS({
|
|
"node_modules/react-is/index.js"(exports, module) {
|
|
"use strict";
|
|
if (false) {
|
|
module.exports = null;
|
|
} else {
|
|
module.exports = require_react_is_development();
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/object-assign/index.js
|
|
var require_object_assign = __commonJS({
|
|
"node_modules/object-assign/index.js"(exports, module) {
|
|
"use strict";
|
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
var hasOwnProperty2 = Object.prototype.hasOwnProperty;
|
|
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
function toObject(val) {
|
|
if (val === null || val === void 0) {
|
|
throw new TypeError("Object.assign cannot be called with null or undefined");
|
|
}
|
|
return Object(val);
|
|
}
|
|
function shouldUseNative() {
|
|
try {
|
|
if (!Object.assign) {
|
|
return false;
|
|
}
|
|
var test1 = new String("abc");
|
|
test1[5] = "de";
|
|
if (Object.getOwnPropertyNames(test1)[0] === "5") {
|
|
return false;
|
|
}
|
|
var test2 = {};
|
|
for (var i = 0; i < 10; i++) {
|
|
test2["_" + String.fromCharCode(i)] = i;
|
|
}
|
|
var order2 = Object.getOwnPropertyNames(test2).map(function(n) {
|
|
return test2[n];
|
|
});
|
|
if (order2.join("") !== "0123456789") {
|
|
return false;
|
|
}
|
|
var test3 = {};
|
|
"abcdefghijklmnopqrst".split("").forEach(function(letter) {
|
|
test3[letter] = letter;
|
|
});
|
|
if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
|
|
return false;
|
|
}
|
|
return true;
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
}
|
|
module.exports = shouldUseNative() ? Object.assign : function(target, source) {
|
|
var from;
|
|
var to = toObject(target);
|
|
var symbols;
|
|
for (var s = 1; s < arguments.length; s++) {
|
|
from = Object(arguments[s]);
|
|
for (var key in from) {
|
|
if (hasOwnProperty2.call(from, key)) {
|
|
to[key] = from[key];
|
|
}
|
|
}
|
|
if (getOwnPropertySymbols) {
|
|
symbols = getOwnPropertySymbols(from);
|
|
for (var i = 0; i < symbols.length; i++) {
|
|
if (propIsEnumerable.call(from, symbols[i])) {
|
|
to[symbols[i]] = from[symbols[i]];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return to;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/prop-types/lib/ReactPropTypesSecret.js
|
|
var require_ReactPropTypesSecret = __commonJS({
|
|
"node_modules/prop-types/lib/ReactPropTypesSecret.js"(exports, module) {
|
|
"use strict";
|
|
var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
|
|
module.exports = ReactPropTypesSecret;
|
|
}
|
|
});
|
|
|
|
// node_modules/prop-types/lib/has.js
|
|
var require_has = __commonJS({
|
|
"node_modules/prop-types/lib/has.js"(exports, module) {
|
|
module.exports = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
}
|
|
});
|
|
|
|
// node_modules/prop-types/checkPropTypes.js
|
|
var require_checkPropTypes = __commonJS({
|
|
"node_modules/prop-types/checkPropTypes.js"(exports, module) {
|
|
"use strict";
|
|
var printWarning = function() {
|
|
};
|
|
if (true) {
|
|
ReactPropTypesSecret = require_ReactPropTypesSecret();
|
|
loggedTypeFailures = {};
|
|
has2 = require_has();
|
|
printWarning = function(text2) {
|
|
var message = "Warning: " + text2;
|
|
if (typeof console !== "undefined") {
|
|
console.error(message);
|
|
}
|
|
try {
|
|
throw new Error(message);
|
|
} catch (x) {
|
|
}
|
|
};
|
|
}
|
|
var ReactPropTypesSecret;
|
|
var loggedTypeFailures;
|
|
var has2;
|
|
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
|
if (true) {
|
|
for (var typeSpecName in typeSpecs) {
|
|
if (has2(typeSpecs, typeSpecName)) {
|
|
var error;
|
|
try {
|
|
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
var err = Error(
|
|
(componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."
|
|
);
|
|
err.name = "Invariant Violation";
|
|
throw err;
|
|
}
|
|
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
|
} catch (ex) {
|
|
error = ex;
|
|
}
|
|
if (error && !(error instanceof Error)) {
|
|
printWarning(
|
|
(componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker function must return `null` or an `Error` but returned a " + typeof error + ". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."
|
|
);
|
|
}
|
|
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
|
loggedTypeFailures[error.message] = true;
|
|
var stack = getStack ? getStack() : "";
|
|
printWarning(
|
|
"Failed " + location + " type: " + error.message + (stack != null ? stack : "")
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
checkPropTypes.resetWarningCache = function() {
|
|
if (true) {
|
|
loggedTypeFailures = {};
|
|
}
|
|
};
|
|
module.exports = checkPropTypes;
|
|
}
|
|
});
|
|
|
|
// node_modules/prop-types/factoryWithTypeCheckers.js
|
|
var require_factoryWithTypeCheckers = __commonJS({
|
|
"node_modules/prop-types/factoryWithTypeCheckers.js"(exports, module) {
|
|
"use strict";
|
|
var ReactIs = require_react_is();
|
|
var assign2 = require_object_assign();
|
|
var ReactPropTypesSecret = require_ReactPropTypesSecret();
|
|
var has2 = require_has();
|
|
var checkPropTypes = require_checkPropTypes();
|
|
var printWarning = function() {
|
|
};
|
|
if (true) {
|
|
printWarning = function(text2) {
|
|
var message = "Warning: " + text2;
|
|
if (typeof console !== "undefined") {
|
|
console.error(message);
|
|
}
|
|
try {
|
|
throw new Error(message);
|
|
} catch (x) {
|
|
}
|
|
};
|
|
}
|
|
function emptyFunctionThatReturnsNull() {
|
|
return null;
|
|
}
|
|
module.exports = function(isValidElement, throwOnDirectAccess) {
|
|
var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator;
|
|
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
function getIteratorFn(maybeIterable) {
|
|
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
if (typeof iteratorFn === "function") {
|
|
return iteratorFn;
|
|
}
|
|
}
|
|
var ANONYMOUS = "<<anonymous>>";
|
|
var ReactPropTypes = {
|
|
array: createPrimitiveTypeChecker("array"),
|
|
bigint: createPrimitiveTypeChecker("bigint"),
|
|
bool: createPrimitiveTypeChecker("boolean"),
|
|
func: createPrimitiveTypeChecker("function"),
|
|
number: createPrimitiveTypeChecker("number"),
|
|
object: createPrimitiveTypeChecker("object"),
|
|
string: createPrimitiveTypeChecker("string"),
|
|
symbol: createPrimitiveTypeChecker("symbol"),
|
|
any: createAnyTypeChecker(),
|
|
arrayOf: createArrayOfTypeChecker,
|
|
element: createElementTypeChecker(),
|
|
elementType: createElementTypeTypeChecker(),
|
|
instanceOf: createInstanceTypeChecker,
|
|
node: createNodeChecker(),
|
|
objectOf: createObjectOfTypeChecker,
|
|
oneOf: createEnumTypeChecker,
|
|
oneOfType: createUnionTypeChecker,
|
|
shape: createShapeTypeChecker,
|
|
exact: createStrictShapeTypeChecker
|
|
};
|
|
function is2(x, y) {
|
|
if (x === y) {
|
|
return x !== 0 || 1 / x === 1 / y;
|
|
} else {
|
|
return x !== x && y !== y;
|
|
}
|
|
}
|
|
function PropTypeError(message, data) {
|
|
this.message = message;
|
|
this.data = data && typeof data === "object" ? data : {};
|
|
this.stack = "";
|
|
}
|
|
PropTypeError.prototype = Error.prototype;
|
|
function createChainableTypeChecker(validate) {
|
|
if (true) {
|
|
var manualPropTypeCallCache = {};
|
|
var manualPropTypeWarningCount = 0;
|
|
}
|
|
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
|
componentName = componentName || ANONYMOUS;
|
|
propFullName = propFullName || propName;
|
|
if (secret !== ReactPropTypesSecret) {
|
|
if (throwOnDirectAccess) {
|
|
var err = new Error(
|
|
"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"
|
|
);
|
|
err.name = "Invariant Violation";
|
|
throw err;
|
|
} else if (typeof console !== "undefined") {
|
|
var cacheKey = componentName + ":" + propName;
|
|
if (!manualPropTypeCallCache[cacheKey] && manualPropTypeWarningCount < 3) {
|
|
printWarning(
|
|
"You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."
|
|
);
|
|
manualPropTypeCallCache[cacheKey] = true;
|
|
manualPropTypeWarningCount++;
|
|
}
|
|
}
|
|
}
|
|
if (props[propName] == null) {
|
|
if (isRequired) {
|
|
if (props[propName] === null) {
|
|
return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`."));
|
|
}
|
|
return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`."));
|
|
}
|
|
return null;
|
|
} else {
|
|
return validate(props, propName, componentName, location, propFullName);
|
|
}
|
|
}
|
|
var chainedCheckType = checkType.bind(null, false);
|
|
chainedCheckType.isRequired = checkType.bind(null, true);
|
|
return chainedCheckType;
|
|
}
|
|
function createPrimitiveTypeChecker(expectedType) {
|
|
function validate(props, propName, componentName, location, propFullName, secret) {
|
|
var propValue = props[propName];
|
|
var propType = getPropType(propValue);
|
|
if (propType !== expectedType) {
|
|
var preciseType = getPreciseType(propValue);
|
|
return new PropTypeError(
|
|
"Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."),
|
|
{ expectedType }
|
|
);
|
|
}
|
|
return null;
|
|
}
|
|
return createChainableTypeChecker(validate);
|
|
}
|
|
function createAnyTypeChecker() {
|
|
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
|
|
}
|
|
function createArrayOfTypeChecker(typeChecker) {
|
|
function validate(props, propName, componentName, location, propFullName) {
|
|
if (typeof typeChecker !== "function") {
|
|
return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf.");
|
|
}
|
|
var propValue = props[propName];
|
|
if (!Array.isArray(propValue)) {
|
|
var propType = getPropType(propValue);
|
|
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array."));
|
|
}
|
|
for (var i = 0; i < propValue.length; i++) {
|
|
var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret);
|
|
if (error instanceof Error) {
|
|
return error;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
return createChainableTypeChecker(validate);
|
|
}
|
|
function createElementTypeChecker() {
|
|
function validate(props, propName, componentName, location, propFullName) {
|
|
var propValue = props[propName];
|
|
if (!isValidElement(propValue)) {
|
|
var propType = getPropType(propValue);
|
|
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement."));
|
|
}
|
|
return null;
|
|
}
|
|
return createChainableTypeChecker(validate);
|
|
}
|
|
function createElementTypeTypeChecker() {
|
|
function validate(props, propName, componentName, location, propFullName) {
|
|
var propValue = props[propName];
|
|
if (!ReactIs.isValidElementType(propValue)) {
|
|
var propType = getPropType(propValue);
|
|
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type."));
|
|
}
|
|
return null;
|
|
}
|
|
return createChainableTypeChecker(validate);
|
|
}
|
|
function createInstanceTypeChecker(expectedClass) {
|
|
function validate(props, propName, componentName, location, propFullName) {
|
|
if (!(props[propName] instanceof expectedClass)) {
|
|
var expectedClassName = expectedClass.name || ANONYMOUS;
|
|
var actualClassName = getClassName(props[propName]);
|
|
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`."));
|
|
}
|
|
return null;
|
|
}
|
|
return createChainableTypeChecker(validate);
|
|
}
|
|
function createEnumTypeChecker(expectedValues) {
|
|
if (!Array.isArray(expectedValues)) {
|
|
if (true) {
|
|
if (arguments.length > 1) {
|
|
printWarning(
|
|
"Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."
|
|
);
|
|
} else {
|
|
printWarning("Invalid argument supplied to oneOf, expected an array.");
|
|
}
|
|
}
|
|
return emptyFunctionThatReturnsNull;
|
|
}
|
|
function validate(props, propName, componentName, location, propFullName) {
|
|
var propValue = props[propName];
|
|
for (var i = 0; i < expectedValues.length; i++) {
|
|
if (is2(propValue, expectedValues[i])) {
|
|
return null;
|
|
}
|
|
}
|
|
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
|
|
var type = getPreciseType(value);
|
|
if (type === "symbol") {
|
|
return String(value);
|
|
}
|
|
return value;
|
|
});
|
|
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + "."));
|
|
}
|
|
return createChainableTypeChecker(validate);
|
|
}
|
|
function createObjectOfTypeChecker(typeChecker) {
|
|
function validate(props, propName, componentName, location, propFullName) {
|
|
if (typeof typeChecker !== "function") {
|
|
return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf.");
|
|
}
|
|
var propValue = props[propName];
|
|
var propType = getPropType(propValue);
|
|
if (propType !== "object") {
|
|
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object."));
|
|
}
|
|
for (var key in propValue) {
|
|
if (has2(propValue, key)) {
|
|
var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
if (error instanceof Error) {
|
|
return error;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
return createChainableTypeChecker(validate);
|
|
}
|
|
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
|
if (!Array.isArray(arrayOfTypeCheckers)) {
|
|
true ? printWarning("Invalid argument supplied to oneOfType, expected an instance of array.") : void 0;
|
|
return emptyFunctionThatReturnsNull;
|
|
}
|
|
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
var checker = arrayOfTypeCheckers[i];
|
|
if (typeof checker !== "function") {
|
|
printWarning(
|
|
"Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i + "."
|
|
);
|
|
return emptyFunctionThatReturnsNull;
|
|
}
|
|
}
|
|
function validate(props, propName, componentName, location, propFullName) {
|
|
var expectedTypes = [];
|
|
for (var i2 = 0; i2 < arrayOfTypeCheckers.length; i2++) {
|
|
var checker2 = arrayOfTypeCheckers[i2];
|
|
var checkerResult = checker2(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
|
|
if (checkerResult == null) {
|
|
return null;
|
|
}
|
|
if (checkerResult.data && has2(checkerResult.data, "expectedType")) {
|
|
expectedTypes.push(checkerResult.data.expectedType);
|
|
}
|
|
}
|
|
var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : "";
|
|
return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + "."));
|
|
}
|
|
return createChainableTypeChecker(validate);
|
|
}
|
|
function createNodeChecker() {
|
|
function validate(props, propName, componentName, location, propFullName) {
|
|
if (!isNode(props[propName])) {
|
|
return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode."));
|
|
}
|
|
return null;
|
|
}
|
|
return createChainableTypeChecker(validate);
|
|
}
|
|
function invalidValidatorError(componentName, location, propFullName, key, type) {
|
|
return new PropTypeError(
|
|
(componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + type + "`."
|
|
);
|
|
}
|
|
function createShapeTypeChecker(shapeTypes) {
|
|
function validate(props, propName, componentName, location, propFullName) {
|
|
var propValue = props[propName];
|
|
var propType = getPropType(propValue);
|
|
if (propType !== "object") {
|
|
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
|
|
}
|
|
for (var key in shapeTypes) {
|
|
var checker = shapeTypes[key];
|
|
if (typeof checker !== "function") {
|
|
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
}
|
|
var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
if (error) {
|
|
return error;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
return createChainableTypeChecker(validate);
|
|
}
|
|
function createStrictShapeTypeChecker(shapeTypes) {
|
|
function validate(props, propName, componentName, location, propFullName) {
|
|
var propValue = props[propName];
|
|
var propType = getPropType(propValue);
|
|
if (propType !== "object") {
|
|
return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`."));
|
|
}
|
|
var allKeys = assign2({}, props[propName], shapeTypes);
|
|
for (var key in allKeys) {
|
|
var checker = shapeTypes[key];
|
|
if (has2(shapeTypes, key) && typeof checker !== "function") {
|
|
return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
|
|
}
|
|
if (!checker) {
|
|
return new PropTypeError(
|
|
"Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`.\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " ")
|
|
);
|
|
}
|
|
var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret);
|
|
if (error) {
|
|
return error;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
return createChainableTypeChecker(validate);
|
|
}
|
|
function isNode(propValue) {
|
|
switch (typeof propValue) {
|
|
case "number":
|
|
case "string":
|
|
case "undefined":
|
|
return true;
|
|
case "boolean":
|
|
return !propValue;
|
|
case "object":
|
|
if (Array.isArray(propValue)) {
|
|
return propValue.every(isNode);
|
|
}
|
|
if (propValue === null || isValidElement(propValue)) {
|
|
return true;
|
|
}
|
|
var iteratorFn = getIteratorFn(propValue);
|
|
if (iteratorFn) {
|
|
var iterator = iteratorFn.call(propValue);
|
|
var step;
|
|
if (iteratorFn !== propValue.entries) {
|
|
while (!(step = iterator.next()).done) {
|
|
if (!isNode(step.value)) {
|
|
return false;
|
|
}
|
|
}
|
|
} else {
|
|
while (!(step = iterator.next()).done) {
|
|
var entry = step.value;
|
|
if (entry) {
|
|
if (!isNode(entry[1])) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
return false;
|
|
}
|
|
return true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
function isSymbol(propType, propValue) {
|
|
if (propType === "symbol") {
|
|
return true;
|
|
}
|
|
if (!propValue) {
|
|
return false;
|
|
}
|
|
if (propValue["@@toStringTag"] === "Symbol") {
|
|
return true;
|
|
}
|
|
if (typeof Symbol === "function" && propValue instanceof Symbol) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
function getPropType(propValue) {
|
|
var propType = typeof propValue;
|
|
if (Array.isArray(propValue)) {
|
|
return "array";
|
|
}
|
|
if (propValue instanceof RegExp) {
|
|
return "object";
|
|
}
|
|
if (isSymbol(propType, propValue)) {
|
|
return "symbol";
|
|
}
|
|
return propType;
|
|
}
|
|
function getPreciseType(propValue) {
|
|
if (typeof propValue === "undefined" || propValue === null) {
|
|
return "" + propValue;
|
|
}
|
|
var propType = getPropType(propValue);
|
|
if (propType === "object") {
|
|
if (propValue instanceof Date) {
|
|
return "date";
|
|
} else if (propValue instanceof RegExp) {
|
|
return "regexp";
|
|
}
|
|
}
|
|
return propType;
|
|
}
|
|
function getPostfixForTypeWarning(value) {
|
|
var type = getPreciseType(value);
|
|
switch (type) {
|
|
case "array":
|
|
case "object":
|
|
return "an " + type;
|
|
case "boolean":
|
|
case "date":
|
|
case "regexp":
|
|
return "a " + type;
|
|
default:
|
|
return type;
|
|
}
|
|
}
|
|
function getClassName(propValue) {
|
|
if (!propValue.constructor || !propValue.constructor.name) {
|
|
return ANONYMOUS;
|
|
}
|
|
return propValue.constructor.name;
|
|
}
|
|
ReactPropTypes.checkPropTypes = checkPropTypes;
|
|
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
|
|
ReactPropTypes.PropTypes = ReactPropTypes;
|
|
return ReactPropTypes;
|
|
};
|
|
}
|
|
});
|
|
|
|
// node_modules/prop-types/index.js
|
|
var require_prop_types = __commonJS({
|
|
"node_modules/prop-types/index.js"(exports, module) {
|
|
if (true) {
|
|
ReactIs = require_react_is();
|
|
throwOnDirectAccess = true;
|
|
module.exports = require_factoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
|
|
} else {
|
|
module.exports = null();
|
|
}
|
|
var ReactIs;
|
|
var throwOnDirectAccess;
|
|
}
|
|
});
|
|
|
|
// node_modules/react/cjs/react-jsx-runtime.development.js
|
|
var require_react_jsx_runtime_development = __commonJS({
|
|
"node_modules/react/cjs/react-jsx-runtime.development.js"(exports) {
|
|
"use strict";
|
|
if (true) {
|
|
(function() {
|
|
"use strict";
|
|
var React6 = require_react();
|
|
var REACT_ELEMENT_TYPE2 = Symbol.for("react.element");
|
|
var REACT_PORTAL_TYPE2 = Symbol.for("react.portal");
|
|
var REACT_FRAGMENT_TYPE2 = Symbol.for("react.fragment");
|
|
var REACT_STRICT_MODE_TYPE2 = Symbol.for("react.strict_mode");
|
|
var REACT_PROFILER_TYPE2 = Symbol.for("react.profiler");
|
|
var REACT_PROVIDER_TYPE2 = Symbol.for("react.provider");
|
|
var REACT_CONTEXT_TYPE2 = Symbol.for("react.context");
|
|
var REACT_FORWARD_REF_TYPE2 = Symbol.for("react.forward_ref");
|
|
var REACT_SUSPENSE_TYPE2 = Symbol.for("react.suspense");
|
|
var REACT_SUSPENSE_LIST_TYPE2 = Symbol.for("react.suspense_list");
|
|
var REACT_MEMO_TYPE2 = Symbol.for("react.memo");
|
|
var REACT_LAZY_TYPE2 = Symbol.for("react.lazy");
|
|
var REACT_OFFSCREEN_TYPE2 = Symbol.for("react.offscreen");
|
|
var MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
|
var FAUX_ITERATOR_SYMBOL = "@@iterator";
|
|
function getIteratorFn(maybeIterable) {
|
|
if (maybeIterable === null || typeof maybeIterable !== "object") {
|
|
return null;
|
|
}
|
|
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
|
if (typeof maybeIterator === "function") {
|
|
return maybeIterator;
|
|
}
|
|
return null;
|
|
}
|
|
var ReactSharedInternals = React6.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
function error(format) {
|
|
{
|
|
{
|
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
args[_key2 - 1] = arguments[_key2];
|
|
}
|
|
printWarning("error", format, args);
|
|
}
|
|
}
|
|
}
|
|
function printWarning(level, format, args) {
|
|
{
|
|
var ReactDebugCurrentFrame2 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
var stack = ReactDebugCurrentFrame2.getStackAddendum();
|
|
if (stack !== "") {
|
|
format += "%s";
|
|
args = args.concat([stack]);
|
|
}
|
|
var argsWithFormat = args.map(function(item) {
|
|
return String(item);
|
|
});
|
|
argsWithFormat.unshift("Warning: " + format);
|
|
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
}
|
|
}
|
|
var enableScopeAPI = false;
|
|
var enableCacheElement = false;
|
|
var enableTransitionTracing = false;
|
|
var enableLegacyHidden = false;
|
|
var enableDebugTracing = false;
|
|
var REACT_MODULE_REFERENCE;
|
|
{
|
|
REACT_MODULE_REFERENCE = Symbol.for("react.module.reference");
|
|
}
|
|
function isValidElementType(type) {
|
|
if (typeof type === "string" || typeof type === "function") {
|
|
return true;
|
|
}
|
|
if (type === REACT_FRAGMENT_TYPE2 || type === REACT_PROFILER_TYPE2 || enableDebugTracing || type === REACT_STRICT_MODE_TYPE2 || type === REACT_SUSPENSE_TYPE2 || type === REACT_SUSPENSE_LIST_TYPE2 || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE2 || enableScopeAPI || enableCacheElement || enableTransitionTracing) {
|
|
return true;
|
|
}
|
|
if (typeof type === "object" && type !== null) {
|
|
if (type.$$typeof === REACT_LAZY_TYPE2 || type.$$typeof === REACT_MEMO_TYPE2 || type.$$typeof === REACT_PROVIDER_TYPE2 || type.$$typeof === REACT_CONTEXT_TYPE2 || type.$$typeof === REACT_FORWARD_REF_TYPE2 || type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
function getWrappedName(outerType, innerType, wrapperName) {
|
|
var displayName = outerType.displayName;
|
|
if (displayName) {
|
|
return displayName;
|
|
}
|
|
var functionName = innerType.displayName || innerType.name || "";
|
|
return functionName !== "" ? wrapperName + "(" + functionName + ")" : wrapperName;
|
|
}
|
|
function getContextName(type) {
|
|
return type.displayName || "Context";
|
|
}
|
|
function getComponentNameFromType(type) {
|
|
if (type == null) {
|
|
return null;
|
|
}
|
|
{
|
|
if (typeof type.tag === "number") {
|
|
error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
if (typeof type === "function") {
|
|
return type.displayName || type.name || null;
|
|
}
|
|
if (typeof type === "string") {
|
|
return type;
|
|
}
|
|
switch (type) {
|
|
case REACT_FRAGMENT_TYPE2:
|
|
return "Fragment";
|
|
case REACT_PORTAL_TYPE2:
|
|
return "Portal";
|
|
case REACT_PROFILER_TYPE2:
|
|
return "Profiler";
|
|
case REACT_STRICT_MODE_TYPE2:
|
|
return "StrictMode";
|
|
case REACT_SUSPENSE_TYPE2:
|
|
return "Suspense";
|
|
case REACT_SUSPENSE_LIST_TYPE2:
|
|
return "SuspenseList";
|
|
}
|
|
if (typeof type === "object") {
|
|
switch (type.$$typeof) {
|
|
case REACT_CONTEXT_TYPE2:
|
|
var context = type;
|
|
return getContextName(context) + ".Consumer";
|
|
case REACT_PROVIDER_TYPE2:
|
|
var provider = type;
|
|
return getContextName(provider._context) + ".Provider";
|
|
case REACT_FORWARD_REF_TYPE2:
|
|
return getWrappedName(type, type.render, "ForwardRef");
|
|
case REACT_MEMO_TYPE2:
|
|
var outerName = type.displayName || null;
|
|
if (outerName !== null) {
|
|
return outerName;
|
|
}
|
|
return getComponentNameFromType(type.type) || "Memo";
|
|
case REACT_LAZY_TYPE2: {
|
|
var lazyComponent = type;
|
|
var payload = lazyComponent._payload;
|
|
var init = lazyComponent._init;
|
|
try {
|
|
return getComponentNameFromType(init(payload));
|
|
} catch (x) {
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
var assign2 = Object.assign;
|
|
var disabledDepth = 0;
|
|
var prevLog;
|
|
var prevInfo;
|
|
var prevWarn;
|
|
var prevError;
|
|
var prevGroup;
|
|
var prevGroupCollapsed;
|
|
var prevGroupEnd;
|
|
function disabledLog() {
|
|
}
|
|
disabledLog.__reactDisabledLog = true;
|
|
function disableLogs() {
|
|
{
|
|
if (disabledDepth === 0) {
|
|
prevLog = console.log;
|
|
prevInfo = console.info;
|
|
prevWarn = console.warn;
|
|
prevError = console.error;
|
|
prevGroup = console.group;
|
|
prevGroupCollapsed = console.groupCollapsed;
|
|
prevGroupEnd = console.groupEnd;
|
|
var props = {
|
|
configurable: true,
|
|
enumerable: true,
|
|
value: disabledLog,
|
|
writable: true
|
|
};
|
|
Object.defineProperties(console, {
|
|
info: props,
|
|
log: props,
|
|
warn: props,
|
|
error: props,
|
|
group: props,
|
|
groupCollapsed: props,
|
|
groupEnd: props
|
|
});
|
|
}
|
|
disabledDepth++;
|
|
}
|
|
}
|
|
function reenableLogs() {
|
|
{
|
|
disabledDepth--;
|
|
if (disabledDepth === 0) {
|
|
var props = {
|
|
configurable: true,
|
|
enumerable: true,
|
|
writable: true
|
|
};
|
|
Object.defineProperties(console, {
|
|
log: assign2({}, props, {
|
|
value: prevLog
|
|
}),
|
|
info: assign2({}, props, {
|
|
value: prevInfo
|
|
}),
|
|
warn: assign2({}, props, {
|
|
value: prevWarn
|
|
}),
|
|
error: assign2({}, props, {
|
|
value: prevError
|
|
}),
|
|
group: assign2({}, props, {
|
|
value: prevGroup
|
|
}),
|
|
groupCollapsed: assign2({}, props, {
|
|
value: prevGroupCollapsed
|
|
}),
|
|
groupEnd: assign2({}, props, {
|
|
value: prevGroupEnd
|
|
})
|
|
});
|
|
}
|
|
if (disabledDepth < 0) {
|
|
error("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
}
|
|
}
|
|
}
|
|
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher;
|
|
var prefix;
|
|
function describeBuiltInComponentFrame(name, source, ownerFn) {
|
|
{
|
|
if (prefix === void 0) {
|
|
try {
|
|
throw Error();
|
|
} catch (x) {
|
|
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
prefix = match && match[1] || "";
|
|
}
|
|
}
|
|
return "\n" + prefix + name;
|
|
}
|
|
}
|
|
var reentry = false;
|
|
var componentFrameCache;
|
|
{
|
|
var PossiblyWeakMap = typeof WeakMap === "function" ? WeakMap : Map;
|
|
componentFrameCache = new PossiblyWeakMap();
|
|
}
|
|
function describeNativeComponentFrame(fn, construct) {
|
|
if (!fn || reentry) {
|
|
return "";
|
|
}
|
|
{
|
|
var frame = componentFrameCache.get(fn);
|
|
if (frame !== void 0) {
|
|
return frame;
|
|
}
|
|
}
|
|
var control;
|
|
reentry = true;
|
|
var previousPrepareStackTrace = Error.prepareStackTrace;
|
|
Error.prepareStackTrace = void 0;
|
|
var previousDispatcher;
|
|
{
|
|
previousDispatcher = ReactCurrentDispatcher.current;
|
|
ReactCurrentDispatcher.current = null;
|
|
disableLogs();
|
|
}
|
|
try {
|
|
if (construct) {
|
|
var Fake = function() {
|
|
throw Error();
|
|
};
|
|
Object.defineProperty(Fake.prototype, "props", {
|
|
set: function() {
|
|
throw Error();
|
|
}
|
|
});
|
|
if (typeof Reflect === "object" && Reflect.construct) {
|
|
try {
|
|
Reflect.construct(Fake, []);
|
|
} catch (x) {
|
|
control = x;
|
|
}
|
|
Reflect.construct(fn, [], Fake);
|
|
} else {
|
|
try {
|
|
Fake.call();
|
|
} catch (x) {
|
|
control = x;
|
|
}
|
|
fn.call(Fake.prototype);
|
|
}
|
|
} else {
|
|
try {
|
|
throw Error();
|
|
} catch (x) {
|
|
control = x;
|
|
}
|
|
fn();
|
|
}
|
|
} catch (sample) {
|
|
if (sample && control && typeof sample.stack === "string") {
|
|
var sampleLines = sample.stack.split("\n");
|
|
var controlLines = control.stack.split("\n");
|
|
var s = sampleLines.length - 1;
|
|
var c = controlLines.length - 1;
|
|
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
|
|
c--;
|
|
}
|
|
for (; s >= 1 && c >= 0; s--, c--) {
|
|
if (sampleLines[s] !== controlLines[c]) {
|
|
if (s !== 1 || c !== 1) {
|
|
do {
|
|
s--;
|
|
c--;
|
|
if (c < 0 || sampleLines[s] !== controlLines[c]) {
|
|
var _frame = "\n" + sampleLines[s].replace(" at new ", " at ");
|
|
if (fn.displayName && _frame.includes("<anonymous>")) {
|
|
_frame = _frame.replace("<anonymous>", fn.displayName);
|
|
}
|
|
{
|
|
if (typeof fn === "function") {
|
|
componentFrameCache.set(fn, _frame);
|
|
}
|
|
}
|
|
return _frame;
|
|
}
|
|
} while (s >= 1 && c >= 0);
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} finally {
|
|
reentry = false;
|
|
{
|
|
ReactCurrentDispatcher.current = previousDispatcher;
|
|
reenableLogs();
|
|
}
|
|
Error.prepareStackTrace = previousPrepareStackTrace;
|
|
}
|
|
var name = fn ? fn.displayName || fn.name : "";
|
|
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
|
|
{
|
|
if (typeof fn === "function") {
|
|
componentFrameCache.set(fn, syntheticFrame);
|
|
}
|
|
}
|
|
return syntheticFrame;
|
|
}
|
|
function describeFunctionComponentFrame(fn, source, ownerFn) {
|
|
{
|
|
return describeNativeComponentFrame(fn, false);
|
|
}
|
|
}
|
|
function shouldConstruct(Component) {
|
|
var prototype3 = Component.prototype;
|
|
return !!(prototype3 && prototype3.isReactComponent);
|
|
}
|
|
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
|
|
if (type == null) {
|
|
return "";
|
|
}
|
|
if (typeof type === "function") {
|
|
{
|
|
return describeNativeComponentFrame(type, shouldConstruct(type));
|
|
}
|
|
}
|
|
if (typeof type === "string") {
|
|
return describeBuiltInComponentFrame(type);
|
|
}
|
|
switch (type) {
|
|
case REACT_SUSPENSE_TYPE2:
|
|
return describeBuiltInComponentFrame("Suspense");
|
|
case REACT_SUSPENSE_LIST_TYPE2:
|
|
return describeBuiltInComponentFrame("SuspenseList");
|
|
}
|
|
if (typeof type === "object") {
|
|
switch (type.$$typeof) {
|
|
case REACT_FORWARD_REF_TYPE2:
|
|
return describeFunctionComponentFrame(type.render);
|
|
case REACT_MEMO_TYPE2:
|
|
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
|
|
case REACT_LAZY_TYPE2: {
|
|
var lazyComponent = type;
|
|
var payload = lazyComponent._payload;
|
|
var init = lazyComponent._init;
|
|
try {
|
|
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
|
|
} catch (x) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
var hasOwnProperty2 = Object.prototype.hasOwnProperty;
|
|
var loggedTypeFailures = {};
|
|
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
function setCurrentlyValidatingElement(element) {
|
|
{
|
|
if (element) {
|
|
var owner = element._owner;
|
|
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
ReactDebugCurrentFrame.setExtraStackFrame(stack);
|
|
} else {
|
|
ReactDebugCurrentFrame.setExtraStackFrame(null);
|
|
}
|
|
}
|
|
}
|
|
function checkPropTypes(typeSpecs, values, location, componentName, element) {
|
|
{
|
|
var has2 = Function.call.bind(hasOwnProperty2);
|
|
for (var typeSpecName in typeSpecs) {
|
|
if (has2(typeSpecs, typeSpecName)) {
|
|
var error$1 = void 0;
|
|
try {
|
|
if (typeof typeSpecs[typeSpecName] !== "function") {
|
|
var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
err.name = "Invariant Violation";
|
|
throw err;
|
|
}
|
|
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
} catch (ex) {
|
|
error$1 = ex;
|
|
}
|
|
if (error$1 && !(error$1 instanceof Error)) {
|
|
setCurrentlyValidatingElement(element);
|
|
error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1);
|
|
setCurrentlyValidatingElement(null);
|
|
}
|
|
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
|
|
loggedTypeFailures[error$1.message] = true;
|
|
setCurrentlyValidatingElement(element);
|
|
error("Failed %s type: %s", location, error$1.message);
|
|
setCurrentlyValidatingElement(null);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var isArrayImpl = Array.isArray;
|
|
function isArray2(a) {
|
|
return isArrayImpl(a);
|
|
}
|
|
function typeName(value) {
|
|
{
|
|
var hasToStringTag = typeof Symbol === "function" && Symbol.toStringTag;
|
|
var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
return type;
|
|
}
|
|
}
|
|
function willCoercionThrow(value) {
|
|
{
|
|
try {
|
|
testStringCoercion(value);
|
|
return false;
|
|
} catch (e) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
function testStringCoercion(value) {
|
|
return "" + value;
|
|
}
|
|
function checkKeyStringCoercion(value) {
|
|
{
|
|
if (willCoercionThrow(value)) {
|
|
error("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", typeName(value));
|
|
return testStringCoercion(value);
|
|
}
|
|
}
|
|
}
|
|
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner;
|
|
var RESERVED_PROPS = {
|
|
key: true,
|
|
ref: true,
|
|
__self: true,
|
|
__source: true
|
|
};
|
|
var specialPropKeyWarningShown;
|
|
var specialPropRefWarningShown;
|
|
var didWarnAboutStringRefs;
|
|
{
|
|
didWarnAboutStringRefs = {};
|
|
}
|
|
function hasValidRef(config3) {
|
|
{
|
|
if (hasOwnProperty2.call(config3, "ref")) {
|
|
var getter = Object.getOwnPropertyDescriptor(config3, "ref").get;
|
|
if (getter && getter.isReactWarning) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return config3.ref !== void 0;
|
|
}
|
|
function hasValidKey(config3) {
|
|
{
|
|
if (hasOwnProperty2.call(config3, "key")) {
|
|
var getter = Object.getOwnPropertyDescriptor(config3, "key").get;
|
|
if (getter && getter.isReactWarning) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return config3.key !== void 0;
|
|
}
|
|
function warnIfStringRefCannotBeAutoConverted(config3, self2) {
|
|
{
|
|
if (typeof config3.ref === "string" && ReactCurrentOwner.current && self2 && ReactCurrentOwner.current.stateNode !== self2) {
|
|
var componentName = getComponentNameFromType(ReactCurrentOwner.current.type);
|
|
if (!didWarnAboutStringRefs[componentName]) {
|
|
error('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config3.ref);
|
|
didWarnAboutStringRefs[componentName] = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function defineKeyPropWarningGetter(props, displayName) {
|
|
{
|
|
var warnAboutAccessingKey = function() {
|
|
if (!specialPropKeyWarningShown) {
|
|
specialPropKeyWarningShown = true;
|
|
error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
|
|
}
|
|
};
|
|
warnAboutAccessingKey.isReactWarning = true;
|
|
Object.defineProperty(props, "key", {
|
|
get: warnAboutAccessingKey,
|
|
configurable: true
|
|
});
|
|
}
|
|
}
|
|
function defineRefPropWarningGetter(props, displayName) {
|
|
{
|
|
var warnAboutAccessingRef = function() {
|
|
if (!specialPropRefWarningShown) {
|
|
specialPropRefWarningShown = true;
|
|
error("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", displayName);
|
|
}
|
|
};
|
|
warnAboutAccessingRef.isReactWarning = true;
|
|
Object.defineProperty(props, "ref", {
|
|
get: warnAboutAccessingRef,
|
|
configurable: true
|
|
});
|
|
}
|
|
}
|
|
var ReactElement = function(type, key, ref, self2, source, owner, props) {
|
|
var element = {
|
|
$$typeof: REACT_ELEMENT_TYPE2,
|
|
type,
|
|
key,
|
|
ref,
|
|
props,
|
|
_owner: owner
|
|
};
|
|
{
|
|
element._store = {};
|
|
Object.defineProperty(element._store, "validated", {
|
|
configurable: false,
|
|
enumerable: false,
|
|
writable: true,
|
|
value: false
|
|
});
|
|
Object.defineProperty(element, "_self", {
|
|
configurable: false,
|
|
enumerable: false,
|
|
writable: false,
|
|
value: self2
|
|
});
|
|
Object.defineProperty(element, "_source", {
|
|
configurable: false,
|
|
enumerable: false,
|
|
writable: false,
|
|
value: source
|
|
});
|
|
if (Object.freeze) {
|
|
Object.freeze(element.props);
|
|
Object.freeze(element);
|
|
}
|
|
}
|
|
return element;
|
|
};
|
|
function jsxDEV(type, config3, maybeKey, source, self2) {
|
|
{
|
|
var propName;
|
|
var props = {};
|
|
var key = null;
|
|
var ref = null;
|
|
if (maybeKey !== void 0) {
|
|
{
|
|
checkKeyStringCoercion(maybeKey);
|
|
}
|
|
key = "" + maybeKey;
|
|
}
|
|
if (hasValidKey(config3)) {
|
|
{
|
|
checkKeyStringCoercion(config3.key);
|
|
}
|
|
key = "" + config3.key;
|
|
}
|
|
if (hasValidRef(config3)) {
|
|
ref = config3.ref;
|
|
warnIfStringRefCannotBeAutoConverted(config3, self2);
|
|
}
|
|
for (propName in config3) {
|
|
if (hasOwnProperty2.call(config3, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
props[propName] = config3[propName];
|
|
}
|
|
}
|
|
if (type && type.defaultProps) {
|
|
var defaultProps = type.defaultProps;
|
|
for (propName in defaultProps) {
|
|
if (props[propName] === void 0) {
|
|
props[propName] = defaultProps[propName];
|
|
}
|
|
}
|
|
}
|
|
if (key || ref) {
|
|
var displayName = typeof type === "function" ? type.displayName || type.name || "Unknown" : type;
|
|
if (key) {
|
|
defineKeyPropWarningGetter(props, displayName);
|
|
}
|
|
if (ref) {
|
|
defineRefPropWarningGetter(props, displayName);
|
|
}
|
|
}
|
|
return ReactElement(type, key, ref, self2, source, ReactCurrentOwner.current, props);
|
|
}
|
|
}
|
|
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
|
|
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
function setCurrentlyValidatingElement$1(element) {
|
|
{
|
|
if (element) {
|
|
var owner = element._owner;
|
|
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
|
|
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
|
|
} else {
|
|
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
|
|
}
|
|
}
|
|
}
|
|
var propTypesMisspellWarningShown;
|
|
{
|
|
propTypesMisspellWarningShown = false;
|
|
}
|
|
function isValidElement(object) {
|
|
{
|
|
return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE2;
|
|
}
|
|
}
|
|
function getDeclarationErrorAddendum() {
|
|
{
|
|
if (ReactCurrentOwner$1.current) {
|
|
var name = getComponentNameFromType(ReactCurrentOwner$1.current.type);
|
|
if (name) {
|
|
return "\n\nCheck the render method of `" + name + "`.";
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
}
|
|
function getSourceInfoErrorAddendum(source) {
|
|
{
|
|
if (source !== void 0) {
|
|
var fileName = source.fileName.replace(/^.*[\\\/]/, "");
|
|
var lineNumber = source.lineNumber;
|
|
return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
|
|
}
|
|
return "";
|
|
}
|
|
}
|
|
var ownerHasKeyUseWarning = {};
|
|
function getCurrentComponentErrorInfo(parentType) {
|
|
{
|
|
var info = getDeclarationErrorAddendum();
|
|
if (!info) {
|
|
var parentName = typeof parentType === "string" ? parentType : parentType.displayName || parentType.name;
|
|
if (parentName) {
|
|
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
|
|
}
|
|
}
|
|
return info;
|
|
}
|
|
}
|
|
function validateExplicitKey(element, parentType) {
|
|
{
|
|
if (!element._store || element._store.validated || element.key != null) {
|
|
return;
|
|
}
|
|
element._store.validated = true;
|
|
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
return;
|
|
}
|
|
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
var childOwner = "";
|
|
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {
|
|
childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + ".";
|
|
}
|
|
setCurrentlyValidatingElement$1(element);
|
|
error('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
setCurrentlyValidatingElement$1(null);
|
|
}
|
|
}
|
|
function validateChildKeys(node, parentType) {
|
|
{
|
|
if (typeof node !== "object") {
|
|
return;
|
|
}
|
|
if (isArray2(node)) {
|
|
for (var i = 0; i < node.length; i++) {
|
|
var child = node[i];
|
|
if (isValidElement(child)) {
|
|
validateExplicitKey(child, parentType);
|
|
}
|
|
}
|
|
} else if (isValidElement(node)) {
|
|
if (node._store) {
|
|
node._store.validated = true;
|
|
}
|
|
} else if (node) {
|
|
var iteratorFn = getIteratorFn(node);
|
|
if (typeof iteratorFn === "function") {
|
|
if (iteratorFn !== node.entries) {
|
|
var iterator = iteratorFn.call(node);
|
|
var step;
|
|
while (!(step = iterator.next()).done) {
|
|
if (isValidElement(step.value)) {
|
|
validateExplicitKey(step.value, parentType);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function validatePropTypes(element) {
|
|
{
|
|
var type = element.type;
|
|
if (type === null || type === void 0 || typeof type === "string") {
|
|
return;
|
|
}
|
|
var propTypes;
|
|
if (typeof type === "function") {
|
|
propTypes = type.propTypes;
|
|
} else if (typeof type === "object" && (type.$$typeof === REACT_FORWARD_REF_TYPE2 || type.$$typeof === REACT_MEMO_TYPE2)) {
|
|
propTypes = type.propTypes;
|
|
} else {
|
|
return;
|
|
}
|
|
if (propTypes) {
|
|
var name = getComponentNameFromType(type);
|
|
checkPropTypes(propTypes, element.props, "prop", name, element);
|
|
} else if (type.PropTypes !== void 0 && !propTypesMisspellWarningShown) {
|
|
propTypesMisspellWarningShown = true;
|
|
var _name = getComponentNameFromType(type);
|
|
error("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", _name || "Unknown");
|
|
}
|
|
if (typeof type.getDefaultProps === "function" && !type.getDefaultProps.isReactClassApproved) {
|
|
error("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
}
|
|
}
|
|
}
|
|
function validateFragmentProps(fragment) {
|
|
{
|
|
var keys2 = Object.keys(fragment.props);
|
|
for (var i = 0; i < keys2.length; i++) {
|
|
var key = keys2[i];
|
|
if (key !== "children" && key !== "key") {
|
|
setCurrentlyValidatingElement$1(fragment);
|
|
error("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", key);
|
|
setCurrentlyValidatingElement$1(null);
|
|
break;
|
|
}
|
|
}
|
|
if (fragment.ref !== null) {
|
|
setCurrentlyValidatingElement$1(fragment);
|
|
error("Invalid attribute `ref` supplied to `React.Fragment`.");
|
|
setCurrentlyValidatingElement$1(null);
|
|
}
|
|
}
|
|
}
|
|
var didWarnAboutKeySpread = {};
|
|
function jsxWithValidation(type, props, key, isStaticChildren, source, self2) {
|
|
{
|
|
var validType = isValidElementType(type);
|
|
if (!validType) {
|
|
var info = "";
|
|
if (type === void 0 || typeof type === "object" && type !== null && Object.keys(type).length === 0) {
|
|
info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
|
|
}
|
|
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
if (sourceInfo) {
|
|
info += sourceInfo;
|
|
} else {
|
|
info += getDeclarationErrorAddendum();
|
|
}
|
|
var typeString;
|
|
if (type === null) {
|
|
typeString = "null";
|
|
} else if (isArray2(type)) {
|
|
typeString = "array";
|
|
} else if (type !== void 0 && type.$$typeof === REACT_ELEMENT_TYPE2) {
|
|
typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />";
|
|
info = " Did you accidentally export a JSX literal instead of a component?";
|
|
} else {
|
|
typeString = typeof type;
|
|
}
|
|
error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", typeString, info);
|
|
}
|
|
var element = jsxDEV(type, props, key, source, self2);
|
|
if (element == null) {
|
|
return element;
|
|
}
|
|
if (validType) {
|
|
var children = props.children;
|
|
if (children !== void 0) {
|
|
if (isStaticChildren) {
|
|
if (isArray2(children)) {
|
|
for (var i = 0; i < children.length; i++) {
|
|
validateChildKeys(children[i], type);
|
|
}
|
|
if (Object.freeze) {
|
|
Object.freeze(children);
|
|
}
|
|
} else {
|
|
error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
}
|
|
} else {
|
|
validateChildKeys(children, type);
|
|
}
|
|
}
|
|
}
|
|
{
|
|
if (hasOwnProperty2.call(props, "key")) {
|
|
var componentName = getComponentNameFromType(type);
|
|
var keys2 = Object.keys(props).filter(function(k) {
|
|
return k !== "key";
|
|
});
|
|
var beforeExample = keys2.length > 0 ? "{key: someKey, " + keys2.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
if (!didWarnAboutKeySpread[componentName + beforeExample]) {
|
|
var afterExample = keys2.length > 0 ? "{" + keys2.join(": ..., ") + ": ...}" : "{}";
|
|
error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName);
|
|
didWarnAboutKeySpread[componentName + beforeExample] = true;
|
|
}
|
|
}
|
|
}
|
|
if (type === REACT_FRAGMENT_TYPE2) {
|
|
validateFragmentProps(element);
|
|
} else {
|
|
validatePropTypes(element);
|
|
}
|
|
return element;
|
|
}
|
|
}
|
|
function jsxWithValidationStatic(type, props, key) {
|
|
{
|
|
return jsxWithValidation(type, props, key, true);
|
|
}
|
|
}
|
|
function jsxWithValidationDynamic(type, props, key) {
|
|
{
|
|
return jsxWithValidation(type, props, key, false);
|
|
}
|
|
}
|
|
var jsx16 = jsxWithValidationDynamic;
|
|
var jsxs13 = jsxWithValidationStatic;
|
|
exports.Fragment = REACT_FRAGMENT_TYPE2;
|
|
exports.jsx = jsx16;
|
|
exports.jsxs = jsxs13;
|
|
})();
|
|
}
|
|
}
|
|
});
|
|
|
|
// node_modules/react/jsx-runtime.js
|
|
var require_jsx_runtime = __commonJS({
|
|
"node_modules/react/jsx-runtime.js"(exports, module) {
|
|
"use strict";
|
|
if (false) {
|
|
module.exports = null;
|
|
} else {
|
|
module.exports = require_react_jsx_runtime_development();
|
|
}
|
|
}
|
|
});
|
|
|
|
// src/main.tsx
|
|
var import_react16 = __toESM(require_react());
|
|
var import_client = __toESM(require_client());
|
|
|
|
// node_modules/redux/dist/redux.mjs
|
|
var $$observable = /* @__PURE__ */ (() => typeof Symbol === "function" && Symbol.observable || "@@observable")();
|
|
var symbol_observable_default = $$observable;
|
|
var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
|
|
var ActionTypes = {
|
|
INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
|
|
REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
|
|
PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
|
|
};
|
|
var actionTypes_default = ActionTypes;
|
|
function isPlainObject(obj) {
|
|
if (typeof obj !== "object" || obj === null)
|
|
return false;
|
|
let proto2 = obj;
|
|
while (Object.getPrototypeOf(proto2) !== null) {
|
|
proto2 = Object.getPrototypeOf(proto2);
|
|
}
|
|
return Object.getPrototypeOf(obj) === proto2 || Object.getPrototypeOf(obj) === null;
|
|
}
|
|
function miniKindOf(val) {
|
|
if (val === void 0)
|
|
return "undefined";
|
|
if (val === null)
|
|
return "null";
|
|
const type = typeof val;
|
|
switch (type) {
|
|
case "boolean":
|
|
case "string":
|
|
case "number":
|
|
case "symbol":
|
|
case "function": {
|
|
return type;
|
|
}
|
|
}
|
|
if (Array.isArray(val))
|
|
return "array";
|
|
if (isDate(val))
|
|
return "date";
|
|
if (isError(val))
|
|
return "error";
|
|
const constructorName = ctorName(val);
|
|
switch (constructorName) {
|
|
case "Symbol":
|
|
case "Promise":
|
|
case "WeakMap":
|
|
case "WeakSet":
|
|
case "Map":
|
|
case "Set":
|
|
return constructorName;
|
|
}
|
|
return Object.prototype.toString.call(val).slice(8, -1).toLowerCase().replace(/\s/g, "");
|
|
}
|
|
function ctorName(val) {
|
|
return typeof val.constructor === "function" ? val.constructor.name : null;
|
|
}
|
|
function isError(val) {
|
|
return val instanceof Error || typeof val.message === "string" && val.constructor && typeof val.constructor.stackTraceLimit === "number";
|
|
}
|
|
function isDate(val) {
|
|
if (val instanceof Date)
|
|
return true;
|
|
return typeof val.toDateString === "function" && typeof val.getDate === "function" && typeof val.setDate === "function";
|
|
}
|
|
function kindOf(val) {
|
|
let typeOfVal = typeof val;
|
|
if (true) {
|
|
typeOfVal = miniKindOf(val);
|
|
}
|
|
return typeOfVal;
|
|
}
|
|
function createStore(reducer, preloadedState, enhancer) {
|
|
if (typeof reducer !== "function") {
|
|
throw new Error(false ? formatProdErrorMessage(2) : `Expected the root reducer to be a function. Instead, received: '${kindOf(reducer)}'`);
|
|
}
|
|
if (typeof preloadedState === "function" && typeof enhancer === "function" || typeof enhancer === "function" && typeof arguments[3] === "function") {
|
|
throw new Error(false ? formatProdErrorMessage(0) : "It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");
|
|
}
|
|
if (typeof preloadedState === "function" && typeof enhancer === "undefined") {
|
|
enhancer = preloadedState;
|
|
preloadedState = void 0;
|
|
}
|
|
if (typeof enhancer !== "undefined") {
|
|
if (typeof enhancer !== "function") {
|
|
throw new Error(false ? formatProdErrorMessage(1) : `Expected the enhancer to be a function. Instead, received: '${kindOf(enhancer)}'`);
|
|
}
|
|
return enhancer(createStore)(reducer, preloadedState);
|
|
}
|
|
let currentReducer = reducer;
|
|
let currentState = preloadedState;
|
|
let currentListeners = /* @__PURE__ */ new Map();
|
|
let nextListeners = currentListeners;
|
|
let listenerIdCounter = 0;
|
|
let isDispatching = false;
|
|
function ensureCanMutateNextListeners() {
|
|
if (nextListeners === currentListeners) {
|
|
nextListeners = /* @__PURE__ */ new Map();
|
|
currentListeners.forEach((listener4, key) => {
|
|
nextListeners.set(key, listener4);
|
|
});
|
|
}
|
|
}
|
|
function getState() {
|
|
if (isDispatching) {
|
|
throw new Error(false ? formatProdErrorMessage(3) : "You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");
|
|
}
|
|
return currentState;
|
|
}
|
|
function subscribe(listener4) {
|
|
if (typeof listener4 !== "function") {
|
|
throw new Error(false ? formatProdErrorMessage(4) : `Expected the listener to be a function. Instead, received: '${kindOf(listener4)}'`);
|
|
}
|
|
if (isDispatching) {
|
|
throw new Error(false ? formatProdErrorMessage(5) : "You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");
|
|
}
|
|
let isSubscribed = true;
|
|
ensureCanMutateNextListeners();
|
|
const listenerId = listenerIdCounter++;
|
|
nextListeners.set(listenerId, listener4);
|
|
return function unsubscribe() {
|
|
if (!isSubscribed) {
|
|
return;
|
|
}
|
|
if (isDispatching) {
|
|
throw new Error(false ? formatProdErrorMessage(6) : "You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");
|
|
}
|
|
isSubscribed = false;
|
|
ensureCanMutateNextListeners();
|
|
nextListeners.delete(listenerId);
|
|
currentListeners = null;
|
|
};
|
|
}
|
|
function dispatch(action) {
|
|
if (!isPlainObject(action)) {
|
|
throw new Error(false ? formatProdErrorMessage(7) : `Actions must be plain objects. Instead, the actual type was: '${kindOf(action)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);
|
|
}
|
|
if (typeof action.type === "undefined") {
|
|
throw new Error(false ? formatProdErrorMessage(8) : 'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');
|
|
}
|
|
if (typeof action.type !== "string") {
|
|
throw new Error(false ? formatProdErrorMessage(17) : `Action "type" property must be a string. Instead, the actual type was: '${kindOf(action.type)}'. Value was: '${action.type}' (stringified)`);
|
|
}
|
|
if (isDispatching) {
|
|
throw new Error(false ? formatProdErrorMessage(9) : "Reducers may not dispatch actions.");
|
|
}
|
|
try {
|
|
isDispatching = true;
|
|
currentState = currentReducer(currentState, action);
|
|
} finally {
|
|
isDispatching = false;
|
|
}
|
|
const listeners = currentListeners = nextListeners;
|
|
listeners.forEach((listener4) => {
|
|
listener4();
|
|
});
|
|
return action;
|
|
}
|
|
function replaceReducer(nextReducer) {
|
|
if (typeof nextReducer !== "function") {
|
|
throw new Error(false ? formatProdErrorMessage(10) : `Expected the nextReducer to be a function. Instead, received: '${kindOf(nextReducer)}`);
|
|
}
|
|
currentReducer = nextReducer;
|
|
dispatch({
|
|
type: actionTypes_default.REPLACE
|
|
});
|
|
}
|
|
function observable() {
|
|
const outerSubscribe = subscribe;
|
|
return {
|
|
subscribe(observer) {
|
|
if (typeof observer !== "object" || observer === null) {
|
|
throw new Error(false ? formatProdErrorMessage(11) : `Expected the observer to be an object. Instead, received: '${kindOf(observer)}'`);
|
|
}
|
|
function observeState() {
|
|
const observerAsObserver = observer;
|
|
if (observerAsObserver.next) {
|
|
observerAsObserver.next(getState());
|
|
}
|
|
}
|
|
observeState();
|
|
const unsubscribe = outerSubscribe(observeState);
|
|
return {
|
|
unsubscribe
|
|
};
|
|
},
|
|
[symbol_observable_default]() {
|
|
return this;
|
|
}
|
|
};
|
|
}
|
|
dispatch({
|
|
type: actionTypes_default.INIT
|
|
});
|
|
const store2 = {
|
|
dispatch,
|
|
subscribe,
|
|
getState,
|
|
replaceReducer,
|
|
[symbol_observable_default]: observable
|
|
};
|
|
return store2;
|
|
}
|
|
function warning(message) {
|
|
if (typeof console !== "undefined" && typeof console.error === "function") {
|
|
console.error(message);
|
|
}
|
|
try {
|
|
throw new Error(message);
|
|
} catch (e) {
|
|
}
|
|
}
|
|
function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {
|
|
const reducerKeys = Object.keys(reducers);
|
|
const argumentName = action && action.type === actionTypes_default.INIT ? "preloadedState argument passed to createStore" : "previous state received by the reducer";
|
|
if (reducerKeys.length === 0) {
|
|
return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";
|
|
}
|
|
if (!isPlainObject(inputState)) {
|
|
return `The ${argumentName} has unexpected type of "${kindOf(inputState)}". Expected argument to be an object with the following keys: "${reducerKeys.join('", "')}"`;
|
|
}
|
|
const unexpectedKeys = Object.keys(inputState).filter((key) => !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]);
|
|
unexpectedKeys.forEach((key) => {
|
|
unexpectedKeyCache[key] = true;
|
|
});
|
|
if (action && action.type === actionTypes_default.REPLACE)
|
|
return;
|
|
if (unexpectedKeys.length > 0) {
|
|
return `Unexpected ${unexpectedKeys.length > 1 ? "keys" : "key"} "${unexpectedKeys.join('", "')}" found in ${argumentName}. Expected to find one of the known reducer keys instead: "${reducerKeys.join('", "')}". Unexpected keys will be ignored.`;
|
|
}
|
|
}
|
|
function assertReducerShape(reducers) {
|
|
Object.keys(reducers).forEach((key) => {
|
|
const reducer = reducers[key];
|
|
const initialState9 = reducer(void 0, {
|
|
type: actionTypes_default.INIT
|
|
});
|
|
if (typeof initialState9 === "undefined") {
|
|
throw new Error(false ? formatProdErrorMessage(12) : `The slice reducer for key "${key}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);
|
|
}
|
|
if (typeof reducer(void 0, {
|
|
type: actionTypes_default.PROBE_UNKNOWN_ACTION()
|
|
}) === "undefined") {
|
|
throw new Error(false ? formatProdErrorMessage(13) : `The slice reducer for key "${key}" returned undefined when probed with a random type. Don't try to handle '${actionTypes_default.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`);
|
|
}
|
|
});
|
|
}
|
|
function combineReducers(reducers) {
|
|
const reducerKeys = Object.keys(reducers);
|
|
const finalReducers = {};
|
|
for (let i = 0; i < reducerKeys.length; i++) {
|
|
const key = reducerKeys[i];
|
|
if (true) {
|
|
if (typeof reducers[key] === "undefined") {
|
|
warning(`No reducer provided for key "${key}"`);
|
|
}
|
|
}
|
|
if (typeof reducers[key] === "function") {
|
|
finalReducers[key] = reducers[key];
|
|
}
|
|
}
|
|
const finalReducerKeys = Object.keys(finalReducers);
|
|
let unexpectedKeyCache;
|
|
if (true) {
|
|
unexpectedKeyCache = {};
|
|
}
|
|
let shapeAssertionError;
|
|
try {
|
|
assertReducerShape(finalReducers);
|
|
} catch (e) {
|
|
shapeAssertionError = e;
|
|
}
|
|
return function combination(state = {}, action) {
|
|
if (shapeAssertionError) {
|
|
throw shapeAssertionError;
|
|
}
|
|
if (true) {
|
|
const warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);
|
|
if (warningMessage) {
|
|
warning(warningMessage);
|
|
}
|
|
}
|
|
let hasChanged = false;
|
|
const nextState = {};
|
|
for (let i = 0; i < finalReducerKeys.length; i++) {
|
|
const key = finalReducerKeys[i];
|
|
const reducer = finalReducers[key];
|
|
const previousStateForKey = state[key];
|
|
const nextStateForKey = reducer(previousStateForKey, action);
|
|
if (typeof nextStateForKey === "undefined") {
|
|
const actionType = action && action.type;
|
|
throw new Error(false ? formatProdErrorMessage(14) : `When called with an action of type ${actionType ? `"${String(actionType)}"` : "(unknown type)"}, the slice reducer for key "${key}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`);
|
|
}
|
|
nextState[key] = nextStateForKey;
|
|
hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
|
|
}
|
|
hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
|
|
return hasChanged ? nextState : state;
|
|
};
|
|
}
|
|
function compose(...funcs) {
|
|
if (funcs.length === 0) {
|
|
return (arg) => arg;
|
|
}
|
|
if (funcs.length === 1) {
|
|
return funcs[0];
|
|
}
|
|
return funcs.reduce((a, b) => (...args) => a(b(...args)));
|
|
}
|
|
function applyMiddleware(...middlewares) {
|
|
return (createStore2) => (reducer, preloadedState) => {
|
|
const store2 = createStore2(reducer, preloadedState);
|
|
let dispatch = () => {
|
|
throw new Error(false ? formatProdErrorMessage(15) : "Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.");
|
|
};
|
|
const middlewareAPI = {
|
|
getState: store2.getState,
|
|
dispatch: (action, ...args) => dispatch(action, ...args)
|
|
};
|
|
const chain = middlewares.map((middleware) => middleware(middlewareAPI));
|
|
dispatch = compose(...chain)(store2.dispatch);
|
|
return __spreadProps(__spreadValues({}, store2), {
|
|
dispatch
|
|
});
|
|
};
|
|
}
|
|
function isAction(action) {
|
|
return isPlainObject(action) && "type" in action && typeof action.type === "string";
|
|
}
|
|
|
|
// node_modules/immer/dist/immer.mjs
|
|
var NOTHING = Symbol.for("immer-nothing");
|
|
var DRAFTABLE = Symbol.for("immer-draftable");
|
|
var DRAFT_STATE = Symbol.for("immer-state");
|
|
var errors = true ? [
|
|
function(plugin) {
|
|
return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`;
|
|
},
|
|
function(thing) {
|
|
return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${thing}'`;
|
|
},
|
|
"This object has been frozen and should not be mutated",
|
|
function(data) {
|
|
return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + data;
|
|
},
|
|
"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
|
|
"Immer forbids circular references",
|
|
"The first or second argument to `produce` must be a function",
|
|
"The third argument to `produce` must be a function or undefined",
|
|
"First argument to `createDraft` must be a plain object, an array, or an immerable object",
|
|
"First argument to `finishDraft` must be a draft returned by `createDraft`",
|
|
function(thing) {
|
|
return `'current' expects a draft, got: ${thing}`;
|
|
},
|
|
"Object.defineProperty() cannot be used on an Immer draft",
|
|
"Object.setPrototypeOf() cannot be used on an Immer draft",
|
|
"Immer only supports deleting array indices",
|
|
"Immer only supports setting array indices and the 'length' property",
|
|
function(thing) {
|
|
return `'original' expects a draft, got: ${thing}`;
|
|
}
|
|
] : [];
|
|
function die(error, ...args) {
|
|
if (true) {
|
|
const e = errors[error];
|
|
const msg = typeof e === "function" ? e.apply(null, args) : e;
|
|
throw new Error(`[Immer] ${msg}`);
|
|
}
|
|
throw new Error(
|
|
`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`
|
|
);
|
|
}
|
|
var getPrototypeOf = Object.getPrototypeOf;
|
|
function isDraft(value) {
|
|
return !!value && !!value[DRAFT_STATE];
|
|
}
|
|
function isDraftable(value) {
|
|
var _a;
|
|
if (!value)
|
|
return false;
|
|
return isPlainObject2(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!((_a = value.constructor) == null ? void 0 : _a[DRAFTABLE]) || isMap(value) || isSet(value);
|
|
}
|
|
var objectCtorString = Object.prototype.constructor.toString();
|
|
function isPlainObject2(value) {
|
|
if (!value || typeof value !== "object")
|
|
return false;
|
|
const proto2 = getPrototypeOf(value);
|
|
if (proto2 === null) {
|
|
return true;
|
|
}
|
|
const Ctor = Object.hasOwnProperty.call(proto2, "constructor") && proto2.constructor;
|
|
if (Ctor === Object)
|
|
return true;
|
|
return typeof Ctor == "function" && Function.toString.call(Ctor) === objectCtorString;
|
|
}
|
|
function each(obj, iter) {
|
|
if (getArchtype(obj) === 0) {
|
|
Reflect.ownKeys(obj).forEach((key) => {
|
|
iter(key, obj[key], obj);
|
|
});
|
|
} else {
|
|
obj.forEach((entry, index) => iter(index, entry, obj));
|
|
}
|
|
}
|
|
function getArchtype(thing) {
|
|
const state = thing[DRAFT_STATE];
|
|
return state ? state.type_ : Array.isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
|
|
}
|
|
function has(thing, prop) {
|
|
return getArchtype(thing) === 2 ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
|
|
}
|
|
function set(thing, propOrOldValue, value) {
|
|
const t = getArchtype(thing);
|
|
if (t === 2)
|
|
thing.set(propOrOldValue, value);
|
|
else if (t === 3) {
|
|
thing.add(value);
|
|
} else
|
|
thing[propOrOldValue] = value;
|
|
}
|
|
function is(x, y) {
|
|
if (x === y) {
|
|
return x !== 0 || 1 / x === 1 / y;
|
|
} else {
|
|
return x !== x && y !== y;
|
|
}
|
|
}
|
|
function isMap(target) {
|
|
return target instanceof Map;
|
|
}
|
|
function isSet(target) {
|
|
return target instanceof Set;
|
|
}
|
|
function latest(state) {
|
|
return state.copy_ || state.base_;
|
|
}
|
|
function shallowCopy(base, strict) {
|
|
if (isMap(base)) {
|
|
return new Map(base);
|
|
}
|
|
if (isSet(base)) {
|
|
return new Set(base);
|
|
}
|
|
if (Array.isArray(base))
|
|
return Array.prototype.slice.call(base);
|
|
const isPlain2 = isPlainObject2(base);
|
|
if (strict === true || strict === "class_only" && !isPlain2) {
|
|
const descriptors2 = Object.getOwnPropertyDescriptors(base);
|
|
delete descriptors2[DRAFT_STATE];
|
|
let keys2 = Reflect.ownKeys(descriptors2);
|
|
for (let i = 0; i < keys2.length; i++) {
|
|
const key = keys2[i];
|
|
const desc = descriptors2[key];
|
|
if (desc.writable === false) {
|
|
desc.writable = true;
|
|
desc.configurable = true;
|
|
}
|
|
if (desc.get || desc.set)
|
|
descriptors2[key] = {
|
|
configurable: true,
|
|
writable: true,
|
|
enumerable: desc.enumerable,
|
|
value: base[key]
|
|
};
|
|
}
|
|
return Object.create(getPrototypeOf(base), descriptors2);
|
|
} else {
|
|
const proto2 = getPrototypeOf(base);
|
|
if (proto2 !== null && isPlain2) {
|
|
return __spreadValues({}, base);
|
|
}
|
|
const obj = Object.create(proto2);
|
|
return Object.assign(obj, base);
|
|
}
|
|
}
|
|
function freeze(obj, deep = false) {
|
|
if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj))
|
|
return obj;
|
|
if (getArchtype(obj) > 1) {
|
|
obj.set = obj.add = obj.clear = obj.delete = dontMutateFrozenCollections;
|
|
}
|
|
Object.freeze(obj);
|
|
if (deep)
|
|
Object.entries(obj).forEach(([key, value]) => freeze(value, true));
|
|
return obj;
|
|
}
|
|
function dontMutateFrozenCollections() {
|
|
die(2);
|
|
}
|
|
function isFrozen(obj) {
|
|
return Object.isFrozen(obj);
|
|
}
|
|
var plugins = {};
|
|
function getPlugin(pluginKey) {
|
|
const plugin = plugins[pluginKey];
|
|
if (!plugin) {
|
|
die(0, pluginKey);
|
|
}
|
|
return plugin;
|
|
}
|
|
var currentScope;
|
|
function getCurrentScope() {
|
|
return currentScope;
|
|
}
|
|
function createScope(parent_, immer_) {
|
|
return {
|
|
drafts_: [],
|
|
parent_,
|
|
immer_,
|
|
canAutoFreeze_: true,
|
|
unfinalizedDrafts_: 0
|
|
};
|
|
}
|
|
function usePatchesInScope(scope, patchListener) {
|
|
if (patchListener) {
|
|
getPlugin("Patches");
|
|
scope.patches_ = [];
|
|
scope.inversePatches_ = [];
|
|
scope.patchListener_ = patchListener;
|
|
}
|
|
}
|
|
function revokeScope(scope) {
|
|
leaveScope(scope);
|
|
scope.drafts_.forEach(revokeDraft);
|
|
scope.drafts_ = null;
|
|
}
|
|
function leaveScope(scope) {
|
|
if (scope === currentScope) {
|
|
currentScope = scope.parent_;
|
|
}
|
|
}
|
|
function enterScope(immer2) {
|
|
return currentScope = createScope(currentScope, immer2);
|
|
}
|
|
function revokeDraft(draft) {
|
|
const state = draft[DRAFT_STATE];
|
|
if (state.type_ === 0 || state.type_ === 1)
|
|
state.revoke_();
|
|
else
|
|
state.revoked_ = true;
|
|
}
|
|
function processResult(result, scope) {
|
|
scope.unfinalizedDrafts_ = scope.drafts_.length;
|
|
const baseDraft = scope.drafts_[0];
|
|
const isReplaced = result !== void 0 && result !== baseDraft;
|
|
if (isReplaced) {
|
|
if (baseDraft[DRAFT_STATE].modified_) {
|
|
revokeScope(scope);
|
|
die(4);
|
|
}
|
|
if (isDraftable(result)) {
|
|
result = finalize(scope, result);
|
|
if (!scope.parent_)
|
|
maybeFreeze(scope, result);
|
|
}
|
|
if (scope.patches_) {
|
|
getPlugin("Patches").generateReplacementPatches_(
|
|
baseDraft[DRAFT_STATE].base_,
|
|
result,
|
|
scope.patches_,
|
|
scope.inversePatches_
|
|
);
|
|
}
|
|
} else {
|
|
result = finalize(scope, baseDraft, []);
|
|
}
|
|
revokeScope(scope);
|
|
if (scope.patches_) {
|
|
scope.patchListener_(scope.patches_, scope.inversePatches_);
|
|
}
|
|
return result !== NOTHING ? result : void 0;
|
|
}
|
|
function finalize(rootScope, value, path) {
|
|
if (isFrozen(value))
|
|
return value;
|
|
const state = value[DRAFT_STATE];
|
|
if (!state) {
|
|
each(
|
|
value,
|
|
(key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path)
|
|
);
|
|
return value;
|
|
}
|
|
if (state.scope_ !== rootScope)
|
|
return value;
|
|
if (!state.modified_) {
|
|
maybeFreeze(rootScope, state.base_, true);
|
|
return state.base_;
|
|
}
|
|
if (!state.finalized_) {
|
|
state.finalized_ = true;
|
|
state.scope_.unfinalizedDrafts_--;
|
|
const result = state.copy_;
|
|
let resultEach = result;
|
|
let isSet2 = false;
|
|
if (state.type_ === 3) {
|
|
resultEach = new Set(result);
|
|
result.clear();
|
|
isSet2 = true;
|
|
}
|
|
each(
|
|
resultEach,
|
|
(key, childValue) => finalizeProperty(rootScope, state, result, key, childValue, path, isSet2)
|
|
);
|
|
maybeFreeze(rootScope, result, false);
|
|
if (path && rootScope.patches_) {
|
|
getPlugin("Patches").generatePatches_(
|
|
state,
|
|
path,
|
|
rootScope.patches_,
|
|
rootScope.inversePatches_
|
|
);
|
|
}
|
|
}
|
|
return state.copy_;
|
|
}
|
|
function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) {
|
|
if (childValue === targetObject)
|
|
die(5);
|
|
if (isDraft(childValue)) {
|
|
const path = rootPath && parentState && parentState.type_ !== 3 && !has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0;
|
|
const res = finalize(rootScope, childValue, path);
|
|
set(targetObject, prop, res);
|
|
if (isDraft(res)) {
|
|
rootScope.canAutoFreeze_ = false;
|
|
} else
|
|
return;
|
|
} else if (targetIsSet) {
|
|
targetObject.add(childValue);
|
|
}
|
|
if (isDraftable(childValue) && !isFrozen(childValue)) {
|
|
if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) {
|
|
return;
|
|
}
|
|
finalize(rootScope, childValue);
|
|
if ((!parentState || !parentState.scope_.parent_) && typeof prop !== "symbol" && Object.prototype.propertyIsEnumerable.call(targetObject, prop))
|
|
maybeFreeze(rootScope, childValue);
|
|
}
|
|
}
|
|
function maybeFreeze(scope, value, deep = false) {
|
|
if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) {
|
|
freeze(value, deep);
|
|
}
|
|
}
|
|
function createProxyProxy(base, parent) {
|
|
const isArray2 = Array.isArray(base);
|
|
const state = {
|
|
type_: isArray2 ? 1 : 0,
|
|
scope_: parent ? parent.scope_ : getCurrentScope(),
|
|
modified_: false,
|
|
finalized_: false,
|
|
assigned_: {},
|
|
parent_: parent,
|
|
base_: base,
|
|
draft_: null,
|
|
copy_: null,
|
|
revoke_: null,
|
|
isManual_: false
|
|
};
|
|
let target = state;
|
|
let traps = objectTraps;
|
|
if (isArray2) {
|
|
target = [state];
|
|
traps = arrayTraps;
|
|
}
|
|
const { revoke, proxy } = Proxy.revocable(target, traps);
|
|
state.draft_ = proxy;
|
|
state.revoke_ = revoke;
|
|
return proxy;
|
|
}
|
|
var objectTraps = {
|
|
get(state, prop) {
|
|
if (prop === DRAFT_STATE)
|
|
return state;
|
|
const source = latest(state);
|
|
if (!has(source, prop)) {
|
|
return readPropFromProto(state, source, prop);
|
|
}
|
|
const value = source[prop];
|
|
if (state.finalized_ || !isDraftable(value)) {
|
|
return value;
|
|
}
|
|
if (value === peek(state.base_, prop)) {
|
|
prepareCopy(state);
|
|
return state.copy_[prop] = createProxy(value, state);
|
|
}
|
|
return value;
|
|
},
|
|
has(state, prop) {
|
|
return prop in latest(state);
|
|
},
|
|
ownKeys(state) {
|
|
return Reflect.ownKeys(latest(state));
|
|
},
|
|
set(state, prop, value) {
|
|
const desc = getDescriptorFromProto(latest(state), prop);
|
|
if (desc == null ? void 0 : desc.set) {
|
|
desc.set.call(state.draft_, value);
|
|
return true;
|
|
}
|
|
if (!state.modified_) {
|
|
const current2 = peek(latest(state), prop);
|
|
const currentState = current2 == null ? void 0 : current2[DRAFT_STATE];
|
|
if (currentState && currentState.base_ === value) {
|
|
state.copy_[prop] = value;
|
|
state.assigned_[prop] = false;
|
|
return true;
|
|
}
|
|
if (is(value, current2) && (value !== void 0 || has(state.base_, prop)))
|
|
return true;
|
|
prepareCopy(state);
|
|
markChanged(state);
|
|
}
|
|
if (state.copy_[prop] === value && (value !== void 0 || prop in state.copy_) || Number.isNaN(value) && Number.isNaN(state.copy_[prop]))
|
|
return true;
|
|
state.copy_[prop] = value;
|
|
state.assigned_[prop] = true;
|
|
return true;
|
|
},
|
|
deleteProperty(state, prop) {
|
|
if (peek(state.base_, prop) !== void 0 || prop in state.base_) {
|
|
state.assigned_[prop] = false;
|
|
prepareCopy(state);
|
|
markChanged(state);
|
|
} else {
|
|
delete state.assigned_[prop];
|
|
}
|
|
if (state.copy_) {
|
|
delete state.copy_[prop];
|
|
}
|
|
return true;
|
|
},
|
|
getOwnPropertyDescriptor(state, prop) {
|
|
const owner = latest(state);
|
|
const desc = Reflect.getOwnPropertyDescriptor(owner, prop);
|
|
if (!desc)
|
|
return desc;
|
|
return {
|
|
writable: true,
|
|
configurable: state.type_ !== 1 || prop !== "length",
|
|
enumerable: desc.enumerable,
|
|
value: owner[prop]
|
|
};
|
|
},
|
|
defineProperty() {
|
|
die(11);
|
|
},
|
|
getPrototypeOf(state) {
|
|
return getPrototypeOf(state.base_);
|
|
},
|
|
setPrototypeOf() {
|
|
die(12);
|
|
}
|
|
};
|
|
var arrayTraps = {};
|
|
each(objectTraps, (key, fn) => {
|
|
arrayTraps[key] = function() {
|
|
arguments[0] = arguments[0][0];
|
|
return fn.apply(this, arguments);
|
|
};
|
|
});
|
|
arrayTraps.deleteProperty = function(state, prop) {
|
|
if (isNaN(parseInt(prop)))
|
|
die(13);
|
|
return arrayTraps.set.call(this, state, prop, void 0);
|
|
};
|
|
arrayTraps.set = function(state, prop, value) {
|
|
if (prop !== "length" && isNaN(parseInt(prop)))
|
|
die(14);
|
|
return objectTraps.set.call(this, state[0], prop, value, state[0]);
|
|
};
|
|
function peek(draft, prop) {
|
|
const state = draft[DRAFT_STATE];
|
|
const source = state ? latest(state) : draft;
|
|
return source[prop];
|
|
}
|
|
function readPropFromProto(state, source, prop) {
|
|
var _a;
|
|
const desc = getDescriptorFromProto(source, prop);
|
|
return desc ? `value` in desc ? desc.value : (_a = desc.get) == null ? void 0 : _a.call(state.draft_) : void 0;
|
|
}
|
|
function getDescriptorFromProto(source, prop) {
|
|
if (!(prop in source))
|
|
return void 0;
|
|
let proto2 = getPrototypeOf(source);
|
|
while (proto2) {
|
|
const desc = Object.getOwnPropertyDescriptor(proto2, prop);
|
|
if (desc)
|
|
return desc;
|
|
proto2 = getPrototypeOf(proto2);
|
|
}
|
|
return void 0;
|
|
}
|
|
function markChanged(state) {
|
|
if (!state.modified_) {
|
|
state.modified_ = true;
|
|
if (state.parent_) {
|
|
markChanged(state.parent_);
|
|
}
|
|
}
|
|
}
|
|
function prepareCopy(state) {
|
|
if (!state.copy_) {
|
|
state.copy_ = shallowCopy(
|
|
state.base_,
|
|
state.scope_.immer_.useStrictShallowCopy_
|
|
);
|
|
}
|
|
}
|
|
var Immer2 = class {
|
|
constructor(config3) {
|
|
this.autoFreeze_ = true;
|
|
this.useStrictShallowCopy_ = false;
|
|
this.produce = (base, recipe, patchListener) => {
|
|
if (typeof base === "function" && typeof recipe !== "function") {
|
|
const defaultBase = recipe;
|
|
recipe = base;
|
|
const self2 = this;
|
|
return function curriedProduce(base2 = defaultBase, ...args) {
|
|
return self2.produce(base2, (draft) => recipe.call(this, draft, ...args));
|
|
};
|
|
}
|
|
if (typeof recipe !== "function")
|
|
die(6);
|
|
if (patchListener !== void 0 && typeof patchListener !== "function")
|
|
die(7);
|
|
let result;
|
|
if (isDraftable(base)) {
|
|
const scope = enterScope(this);
|
|
const proxy = createProxy(base, void 0);
|
|
let hasError = true;
|
|
try {
|
|
result = recipe(proxy);
|
|
hasError = false;
|
|
} finally {
|
|
if (hasError)
|
|
revokeScope(scope);
|
|
else
|
|
leaveScope(scope);
|
|
}
|
|
usePatchesInScope(scope, patchListener);
|
|
return processResult(result, scope);
|
|
} else if (!base || typeof base !== "object") {
|
|
result = recipe(base);
|
|
if (result === void 0)
|
|
result = base;
|
|
if (result === NOTHING)
|
|
result = void 0;
|
|
if (this.autoFreeze_)
|
|
freeze(result, true);
|
|
if (patchListener) {
|
|
const p2 = [];
|
|
const ip = [];
|
|
getPlugin("Patches").generateReplacementPatches_(base, result, p2, ip);
|
|
patchListener(p2, ip);
|
|
}
|
|
return result;
|
|
} else
|
|
die(1, base);
|
|
};
|
|
this.produceWithPatches = (base, recipe) => {
|
|
if (typeof base === "function") {
|
|
return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
|
|
}
|
|
let patches, inversePatches;
|
|
const result = this.produce(base, recipe, (p2, ip) => {
|
|
patches = p2;
|
|
inversePatches = ip;
|
|
});
|
|
return [result, patches, inversePatches];
|
|
};
|
|
if (typeof (config3 == null ? void 0 : config3.autoFreeze) === "boolean")
|
|
this.setAutoFreeze(config3.autoFreeze);
|
|
if (typeof (config3 == null ? void 0 : config3.useStrictShallowCopy) === "boolean")
|
|
this.setUseStrictShallowCopy(config3.useStrictShallowCopy);
|
|
}
|
|
createDraft(base) {
|
|
if (!isDraftable(base))
|
|
die(8);
|
|
if (isDraft(base))
|
|
base = current(base);
|
|
const scope = enterScope(this);
|
|
const proxy = createProxy(base, void 0);
|
|
proxy[DRAFT_STATE].isManual_ = true;
|
|
leaveScope(scope);
|
|
return proxy;
|
|
}
|
|
finishDraft(draft, patchListener) {
|
|
const state = draft && draft[DRAFT_STATE];
|
|
if (!state || !state.isManual_)
|
|
die(9);
|
|
const { scope_: scope } = state;
|
|
usePatchesInScope(scope, patchListener);
|
|
return processResult(void 0, scope);
|
|
}
|
|
setAutoFreeze(value) {
|
|
this.autoFreeze_ = value;
|
|
}
|
|
setUseStrictShallowCopy(value) {
|
|
this.useStrictShallowCopy_ = value;
|
|
}
|
|
applyPatches(base, patches) {
|
|
let i;
|
|
for (i = patches.length - 1; i >= 0; i--) {
|
|
const patch = patches[i];
|
|
if (patch.path.length === 0 && patch.op === "replace") {
|
|
base = patch.value;
|
|
break;
|
|
}
|
|
}
|
|
if (i > -1) {
|
|
patches = patches.slice(i + 1);
|
|
}
|
|
const applyPatchesImpl = getPlugin("Patches").applyPatches_;
|
|
if (isDraft(base)) {
|
|
return applyPatchesImpl(base, patches);
|
|
}
|
|
return this.produce(
|
|
base,
|
|
(draft) => applyPatchesImpl(draft, patches)
|
|
);
|
|
}
|
|
};
|
|
function createProxy(value, parent) {
|
|
const draft = isMap(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent);
|
|
const scope = parent ? parent.scope_ : getCurrentScope();
|
|
scope.drafts_.push(draft);
|
|
return draft;
|
|
}
|
|
function current(value) {
|
|
if (!isDraft(value))
|
|
die(10, value);
|
|
return currentImpl(value);
|
|
}
|
|
function currentImpl(value) {
|
|
if (!isDraftable(value) || isFrozen(value))
|
|
return value;
|
|
const state = value[DRAFT_STATE];
|
|
let copy;
|
|
if (state) {
|
|
if (!state.modified_)
|
|
return state.base_;
|
|
state.finalized_ = true;
|
|
copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);
|
|
} else {
|
|
copy = shallowCopy(value, true);
|
|
}
|
|
each(copy, (key, childValue) => {
|
|
set(copy, key, currentImpl(childValue));
|
|
});
|
|
if (state) {
|
|
state.finalized_ = false;
|
|
}
|
|
return copy;
|
|
}
|
|
var immer = new Immer2();
|
|
var produce = immer.produce;
|
|
var produceWithPatches = immer.produceWithPatches.bind(
|
|
immer
|
|
);
|
|
var setAutoFreeze = immer.setAutoFreeze.bind(immer);
|
|
var setUseStrictShallowCopy = immer.setUseStrictShallowCopy.bind(immer);
|
|
var applyPatches = immer.applyPatches.bind(immer);
|
|
var createDraft = immer.createDraft.bind(immer);
|
|
var finishDraft = immer.finishDraft.bind(immer);
|
|
|
|
// node_modules/reselect/dist/reselect.mjs
|
|
var runIdentityFunctionCheck = (resultFunc, inputSelectorsResults, outputSelectorResult) => {
|
|
if (inputSelectorsResults.length === 1 && inputSelectorsResults[0] === outputSelectorResult) {
|
|
let isInputSameAsOutput = false;
|
|
try {
|
|
const emptyObject = {};
|
|
if (resultFunc(emptyObject) === emptyObject)
|
|
isInputSameAsOutput = true;
|
|
} catch (e) {
|
|
}
|
|
if (isInputSameAsOutput) {
|
|
let stack = void 0;
|
|
try {
|
|
throw new Error();
|
|
} catch (e) {
|
|
;
|
|
({ stack } = e);
|
|
}
|
|
console.warn(
|
|
"The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.",
|
|
{ stack }
|
|
);
|
|
}
|
|
}
|
|
};
|
|
var runInputStabilityCheck = (inputSelectorResultsObject, options, inputSelectorArgs) => {
|
|
const { memoize, memoizeOptions } = options;
|
|
const { inputSelectorResults, inputSelectorResultsCopy } = inputSelectorResultsObject;
|
|
const createAnEmptyObject = memoize(() => ({}), ...memoizeOptions);
|
|
const areInputSelectorResultsEqual = createAnEmptyObject.apply(null, inputSelectorResults) === createAnEmptyObject.apply(null, inputSelectorResultsCopy);
|
|
if (!areInputSelectorResultsEqual) {
|
|
let stack = void 0;
|
|
try {
|
|
throw new Error();
|
|
} catch (e) {
|
|
;
|
|
({ stack } = e);
|
|
}
|
|
console.warn(
|
|
"An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`",
|
|
{
|
|
arguments: inputSelectorArgs,
|
|
firstInputs: inputSelectorResults,
|
|
secondInputs: inputSelectorResultsCopy,
|
|
stack
|
|
}
|
|
);
|
|
}
|
|
};
|
|
var globalDevModeChecks = {
|
|
inputStabilityCheck: "once",
|
|
identityFunctionCheck: "once"
|
|
};
|
|
function assertIsFunction(func, errorMessage = `expected a function, instead received ${typeof func}`) {
|
|
if (typeof func !== "function") {
|
|
throw new TypeError(errorMessage);
|
|
}
|
|
}
|
|
function assertIsObject(object, errorMessage = `expected an object, instead received ${typeof object}`) {
|
|
if (typeof object !== "object") {
|
|
throw new TypeError(errorMessage);
|
|
}
|
|
}
|
|
function assertIsArrayOfFunctions(array, errorMessage = `expected all items to be functions, instead received the following types: `) {
|
|
if (!array.every((item) => typeof item === "function")) {
|
|
const itemTypes = array.map(
|
|
(item) => typeof item === "function" ? `function ${item.name || "unnamed"}()` : typeof item
|
|
).join(", ");
|
|
throw new TypeError(`${errorMessage}[${itemTypes}]`);
|
|
}
|
|
}
|
|
var ensureIsArray = (item) => {
|
|
return Array.isArray(item) ? item : [item];
|
|
};
|
|
function getDependencies(createSelectorArgs) {
|
|
const dependencies = Array.isArray(createSelectorArgs[0]) ? createSelectorArgs[0] : createSelectorArgs;
|
|
assertIsArrayOfFunctions(
|
|
dependencies,
|
|
`createSelector expects all input-selectors to be functions, but received the following types: `
|
|
);
|
|
return dependencies;
|
|
}
|
|
function collectInputSelectorResults(dependencies, inputSelectorArgs) {
|
|
const inputSelectorResults = [];
|
|
const { length } = dependencies;
|
|
for (let i = 0; i < length; i++) {
|
|
inputSelectorResults.push(dependencies[i].apply(null, inputSelectorArgs));
|
|
}
|
|
return inputSelectorResults;
|
|
}
|
|
var getDevModeChecksExecutionInfo = (firstRun, devModeChecks) => {
|
|
const { identityFunctionCheck, inputStabilityCheck } = __spreadValues(__spreadValues({}, globalDevModeChecks), devModeChecks);
|
|
return {
|
|
identityFunctionCheck: {
|
|
shouldRun: identityFunctionCheck === "always" || identityFunctionCheck === "once" && firstRun,
|
|
run: runIdentityFunctionCheck
|
|
},
|
|
inputStabilityCheck: {
|
|
shouldRun: inputStabilityCheck === "always" || inputStabilityCheck === "once" && firstRun,
|
|
run: runInputStabilityCheck
|
|
}
|
|
};
|
|
};
|
|
var REDUX_PROXY_LABEL = Symbol();
|
|
var proto = Object.getPrototypeOf({});
|
|
var StrongRef = class {
|
|
constructor(value) {
|
|
this.value = value;
|
|
}
|
|
deref() {
|
|
return this.value;
|
|
}
|
|
};
|
|
var Ref = typeof WeakRef !== "undefined" ? WeakRef : StrongRef;
|
|
var UNTERMINATED = 0;
|
|
var TERMINATED = 1;
|
|
function createCacheNode() {
|
|
return {
|
|
s: UNTERMINATED,
|
|
v: void 0,
|
|
o: null,
|
|
p: null
|
|
};
|
|
}
|
|
function weakMapMemoize(func, options = {}) {
|
|
let fnNode = createCacheNode();
|
|
const { resultEqualityCheck } = options;
|
|
let lastResult;
|
|
let resultsCount = 0;
|
|
function memoized() {
|
|
var _a, _b;
|
|
let cacheNode = fnNode;
|
|
const { length } = arguments;
|
|
for (let i = 0, l = length; i < l; i++) {
|
|
const arg = arguments[i];
|
|
if (typeof arg === "function" || typeof arg === "object" && arg !== null) {
|
|
let objectCache = cacheNode.o;
|
|
if (objectCache === null) {
|
|
cacheNode.o = objectCache = /* @__PURE__ */ new WeakMap();
|
|
}
|
|
const objectNode = objectCache.get(arg);
|
|
if (objectNode === void 0) {
|
|
cacheNode = createCacheNode();
|
|
objectCache.set(arg, cacheNode);
|
|
} else {
|
|
cacheNode = objectNode;
|
|
}
|
|
} else {
|
|
let primitiveCache = cacheNode.p;
|
|
if (primitiveCache === null) {
|
|
cacheNode.p = primitiveCache = /* @__PURE__ */ new Map();
|
|
}
|
|
const primitiveNode = primitiveCache.get(arg);
|
|
if (primitiveNode === void 0) {
|
|
cacheNode = createCacheNode();
|
|
primitiveCache.set(arg, cacheNode);
|
|
} else {
|
|
cacheNode = primitiveNode;
|
|
}
|
|
}
|
|
}
|
|
const terminatedNode = cacheNode;
|
|
let result;
|
|
if (cacheNode.s === TERMINATED) {
|
|
result = cacheNode.v;
|
|
} else {
|
|
result = func.apply(null, arguments);
|
|
resultsCount++;
|
|
}
|
|
terminatedNode.s = TERMINATED;
|
|
if (resultEqualityCheck) {
|
|
const lastResultValue = (_b = (_a = lastResult == null ? void 0 : lastResult.deref) == null ? void 0 : _a.call(lastResult)) != null ? _b : lastResult;
|
|
if (lastResultValue != null && resultEqualityCheck(lastResultValue, result)) {
|
|
result = lastResultValue;
|
|
resultsCount !== 0 && resultsCount--;
|
|
}
|
|
const needsWeakRef = typeof result === "object" && result !== null || typeof result === "function";
|
|
lastResult = needsWeakRef ? new Ref(result) : result;
|
|
}
|
|
terminatedNode.v = result;
|
|
return result;
|
|
}
|
|
memoized.clearCache = () => {
|
|
fnNode = createCacheNode();
|
|
memoized.resetResultsCount();
|
|
};
|
|
memoized.resultsCount = () => resultsCount;
|
|
memoized.resetResultsCount = () => {
|
|
resultsCount = 0;
|
|
};
|
|
return memoized;
|
|
}
|
|
function createSelectorCreator(memoizeOrOptions, ...memoizeOptionsFromArgs) {
|
|
const createSelectorCreatorOptions = typeof memoizeOrOptions === "function" ? {
|
|
memoize: memoizeOrOptions,
|
|
memoizeOptions: memoizeOptionsFromArgs
|
|
} : memoizeOrOptions;
|
|
const createSelector2 = (...createSelectorArgs) => {
|
|
let recomputations = 0;
|
|
let dependencyRecomputations = 0;
|
|
let lastResult;
|
|
let directlyPassedOptions = {};
|
|
let resultFunc = createSelectorArgs.pop();
|
|
if (typeof resultFunc === "object") {
|
|
directlyPassedOptions = resultFunc;
|
|
resultFunc = createSelectorArgs.pop();
|
|
}
|
|
assertIsFunction(
|
|
resultFunc,
|
|
`createSelector expects an output function after the inputs, but received: [${typeof resultFunc}]`
|
|
);
|
|
const combinedOptions = __spreadValues(__spreadValues({}, createSelectorCreatorOptions), directlyPassedOptions);
|
|
const {
|
|
memoize,
|
|
memoizeOptions = [],
|
|
argsMemoize = weakMapMemoize,
|
|
argsMemoizeOptions = [],
|
|
devModeChecks = {}
|
|
} = combinedOptions;
|
|
const finalMemoizeOptions = ensureIsArray(memoizeOptions);
|
|
const finalArgsMemoizeOptions = ensureIsArray(argsMemoizeOptions);
|
|
const dependencies = getDependencies(createSelectorArgs);
|
|
const memoizedResultFunc = memoize(function recomputationWrapper() {
|
|
recomputations++;
|
|
return resultFunc.apply(
|
|
null,
|
|
arguments
|
|
);
|
|
}, ...finalMemoizeOptions);
|
|
let firstRun = true;
|
|
const selector = argsMemoize(function dependenciesChecker() {
|
|
dependencyRecomputations++;
|
|
const inputSelectorResults = collectInputSelectorResults(
|
|
dependencies,
|
|
arguments
|
|
);
|
|
lastResult = memoizedResultFunc.apply(null, inputSelectorResults);
|
|
if (true) {
|
|
const { identityFunctionCheck, inputStabilityCheck } = getDevModeChecksExecutionInfo(firstRun, devModeChecks);
|
|
if (identityFunctionCheck.shouldRun) {
|
|
identityFunctionCheck.run(
|
|
resultFunc,
|
|
inputSelectorResults,
|
|
lastResult
|
|
);
|
|
}
|
|
if (inputStabilityCheck.shouldRun) {
|
|
const inputSelectorResultsCopy = collectInputSelectorResults(
|
|
dependencies,
|
|
arguments
|
|
);
|
|
inputStabilityCheck.run(
|
|
{ inputSelectorResults, inputSelectorResultsCopy },
|
|
{ memoize, memoizeOptions: finalMemoizeOptions },
|
|
arguments
|
|
);
|
|
}
|
|
if (firstRun)
|
|
firstRun = false;
|
|
}
|
|
return lastResult;
|
|
}, ...finalArgsMemoizeOptions);
|
|
return Object.assign(selector, {
|
|
resultFunc,
|
|
memoizedResultFunc,
|
|
dependencies,
|
|
dependencyRecomputations: () => dependencyRecomputations,
|
|
resetDependencyRecomputations: () => {
|
|
dependencyRecomputations = 0;
|
|
},
|
|
lastResult: () => lastResult,
|
|
recomputations: () => recomputations,
|
|
resetRecomputations: () => {
|
|
recomputations = 0;
|
|
},
|
|
memoize,
|
|
argsMemoize
|
|
});
|
|
};
|
|
Object.assign(createSelector2, {
|
|
withTypes: () => createSelector2
|
|
});
|
|
return createSelector2;
|
|
}
|
|
var createSelector = /* @__PURE__ */ createSelectorCreator(weakMapMemoize);
|
|
var createStructuredSelector = Object.assign(
|
|
(inputSelectorsObject, selectorCreator = createSelector) => {
|
|
assertIsObject(
|
|
inputSelectorsObject,
|
|
`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof inputSelectorsObject}`
|
|
);
|
|
const inputSelectorKeys = Object.keys(inputSelectorsObject);
|
|
const dependencies = inputSelectorKeys.map(
|
|
(key) => inputSelectorsObject[key]
|
|
);
|
|
const structuredSelector = selectorCreator(
|
|
dependencies,
|
|
(...inputSelectorResults) => {
|
|
return inputSelectorResults.reduce((composition, value, index) => {
|
|
composition[inputSelectorKeys[index]] = value;
|
|
return composition;
|
|
}, {});
|
|
}
|
|
);
|
|
return structuredSelector;
|
|
},
|
|
{ withTypes: () => createStructuredSelector }
|
|
);
|
|
|
|
// node_modules/redux-thunk/dist/redux-thunk.mjs
|
|
function createThunkMiddleware(extraArgument) {
|
|
const middleware = ({ dispatch, getState }) => (next) => (action) => {
|
|
if (typeof action === "function") {
|
|
return action(dispatch, getState, extraArgument);
|
|
}
|
|
return next(action);
|
|
};
|
|
return middleware;
|
|
}
|
|
var thunk = createThunkMiddleware();
|
|
var withExtraArgument = createThunkMiddleware;
|
|
|
|
// node_modules/@reduxjs/toolkit/dist/redux-toolkit.modern.mjs
|
|
var createDraftSafeSelectorCreator = (...args) => {
|
|
const createSelector2 = createSelectorCreator(...args);
|
|
const createDraftSafeSelector2 = Object.assign((...args2) => {
|
|
const selector = createSelector2(...args2);
|
|
const wrappedSelector = (value, ...rest) => selector(isDraft(value) ? current(value) : value, ...rest);
|
|
Object.assign(wrappedSelector, selector);
|
|
return wrappedSelector;
|
|
}, {
|
|
withTypes: () => createDraftSafeSelector2
|
|
});
|
|
return createDraftSafeSelector2;
|
|
};
|
|
var createDraftSafeSelector = createDraftSafeSelectorCreator(weakMapMemoize);
|
|
var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() {
|
|
if (arguments.length === 0)
|
|
return void 0;
|
|
if (typeof arguments[0] === "object")
|
|
return compose;
|
|
return compose.apply(null, arguments);
|
|
};
|
|
var devToolsEnhancer = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__ : function() {
|
|
return function(noop32) {
|
|
return noop32;
|
|
};
|
|
};
|
|
var hasMatchFunction = (v) => {
|
|
return v && typeof v.match === "function";
|
|
};
|
|
function createAction(type, prepareAction) {
|
|
function actionCreator(...args) {
|
|
if (prepareAction) {
|
|
let prepared = prepareAction(...args);
|
|
if (!prepared) {
|
|
throw new Error(false ? formatProdErrorMessage(0) : "prepareAction did not return an object");
|
|
}
|
|
return __spreadValues(__spreadValues({
|
|
type,
|
|
payload: prepared.payload
|
|
}, "meta" in prepared && {
|
|
meta: prepared.meta
|
|
}), "error" in prepared && {
|
|
error: prepared.error
|
|
});
|
|
}
|
|
return {
|
|
type,
|
|
payload: args[0]
|
|
};
|
|
}
|
|
actionCreator.toString = () => `${type}`;
|
|
actionCreator.type = type;
|
|
actionCreator.match = (action) => isAction(action) && action.type === type;
|
|
return actionCreator;
|
|
}
|
|
function isActionCreator(action) {
|
|
return typeof action === "function" && "type" in action && hasMatchFunction(action);
|
|
}
|
|
function getMessage(type) {
|
|
const splitType = type ? `${type}`.split("/") : [];
|
|
const actionName = splitType[splitType.length - 1] || "actionCreator";
|
|
return `Detected an action creator with type "${type || "unknown"}" being dispatched.
|
|
Make sure you're calling the action creator before dispatching, i.e. \`dispatch(${actionName}())\` instead of \`dispatch(${actionName})\`. This is necessary even if the action has no payload.`;
|
|
}
|
|
function createActionCreatorInvariantMiddleware(options = {}) {
|
|
if (false) {
|
|
return () => (next) => (action) => next(action);
|
|
}
|
|
const {
|
|
isActionCreator: isActionCreator2 = isActionCreator
|
|
} = options;
|
|
return () => (next) => (action) => {
|
|
if (isActionCreator2(action)) {
|
|
console.warn(getMessage(action.type));
|
|
}
|
|
return next(action);
|
|
};
|
|
}
|
|
function getTimeMeasureUtils(maxDelay, fnName) {
|
|
let elapsed = 0;
|
|
return {
|
|
measureTime(fn) {
|
|
const started = Date.now();
|
|
try {
|
|
return fn();
|
|
} finally {
|
|
const finished = Date.now();
|
|
elapsed += finished - started;
|
|
}
|
|
},
|
|
warnIfExceeded() {
|
|
if (elapsed > maxDelay) {
|
|
console.warn(`${fnName} took ${elapsed}ms, which is more than the warning threshold of ${maxDelay}ms.
|
|
If your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.
|
|
It is disabled in production builds, so you don't need to worry about that.`);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
var Tuple = class _Tuple extends Array {
|
|
constructor(...items) {
|
|
super(...items);
|
|
Object.setPrototypeOf(this, _Tuple.prototype);
|
|
}
|
|
static get [Symbol.species]() {
|
|
return _Tuple;
|
|
}
|
|
concat(...arr) {
|
|
return super.concat.apply(this, arr);
|
|
}
|
|
prepend(...arr) {
|
|
if (arr.length === 1 && Array.isArray(arr[0])) {
|
|
return new _Tuple(...arr[0].concat(this));
|
|
}
|
|
return new _Tuple(...arr.concat(this));
|
|
}
|
|
};
|
|
function freezeDraftable(val) {
|
|
return isDraftable(val) ? produce(val, () => {
|
|
}) : val;
|
|
}
|
|
function emplace(map, key, handler) {
|
|
if (map.has(key)) {
|
|
let value = map.get(key);
|
|
if (handler.update) {
|
|
value = handler.update(value, key, map);
|
|
map.set(key, value);
|
|
}
|
|
return value;
|
|
}
|
|
if (!handler.insert)
|
|
throw new Error(false ? formatProdErrorMessage(10) : "No insert provided for key not already in map");
|
|
const inserted = handler.insert(key, map);
|
|
map.set(key, inserted);
|
|
return inserted;
|
|
}
|
|
function isImmutableDefault(value) {
|
|
return typeof value !== "object" || value == null || Object.isFrozen(value);
|
|
}
|
|
function trackForMutations(isImmutable, ignorePaths, obj) {
|
|
const trackedProperties = trackProperties(isImmutable, ignorePaths, obj);
|
|
return {
|
|
detectMutations() {
|
|
return detectMutations(isImmutable, ignorePaths, trackedProperties, obj);
|
|
}
|
|
};
|
|
}
|
|
function trackProperties(isImmutable, ignorePaths = [], obj, path = "", checkedObjects = /* @__PURE__ */ new Set()) {
|
|
const tracked = {
|
|
value: obj
|
|
};
|
|
if (!isImmutable(obj) && !checkedObjects.has(obj)) {
|
|
checkedObjects.add(obj);
|
|
tracked.children = {};
|
|
for (const key in obj) {
|
|
const childPath = path ? path + "." + key : key;
|
|
if (ignorePaths.length && ignorePaths.indexOf(childPath) !== -1) {
|
|
continue;
|
|
}
|
|
tracked.children[key] = trackProperties(isImmutable, ignorePaths, obj[key], childPath);
|
|
}
|
|
}
|
|
return tracked;
|
|
}
|
|
function detectMutations(isImmutable, ignoredPaths = [], trackedProperty, obj, sameParentRef = false, path = "") {
|
|
const prevObj = trackedProperty ? trackedProperty.value : void 0;
|
|
const sameRef = prevObj === obj;
|
|
if (sameParentRef && !sameRef && !Number.isNaN(obj)) {
|
|
return {
|
|
wasMutated: true,
|
|
path
|
|
};
|
|
}
|
|
if (isImmutable(prevObj) || isImmutable(obj)) {
|
|
return {
|
|
wasMutated: false
|
|
};
|
|
}
|
|
const keysToDetect = {};
|
|
for (let key in trackedProperty.children) {
|
|
keysToDetect[key] = true;
|
|
}
|
|
for (let key in obj) {
|
|
keysToDetect[key] = true;
|
|
}
|
|
const hasIgnoredPaths = ignoredPaths.length > 0;
|
|
for (let key in keysToDetect) {
|
|
const nestedPath = path ? path + "." + key : key;
|
|
if (hasIgnoredPaths) {
|
|
const hasMatches = ignoredPaths.some((ignored) => {
|
|
if (ignored instanceof RegExp) {
|
|
return ignored.test(nestedPath);
|
|
}
|
|
return nestedPath === ignored;
|
|
});
|
|
if (hasMatches) {
|
|
continue;
|
|
}
|
|
}
|
|
const result = detectMutations(isImmutable, ignoredPaths, trackedProperty.children[key], obj[key], sameRef, nestedPath);
|
|
if (result.wasMutated) {
|
|
return result;
|
|
}
|
|
}
|
|
return {
|
|
wasMutated: false
|
|
};
|
|
}
|
|
function createImmutableStateInvariantMiddleware(options = {}) {
|
|
if (false) {
|
|
return () => (next) => (action) => next(action);
|
|
} else {
|
|
let stringify2 = function(obj, serializer, indent, decycler) {
|
|
return JSON.stringify(obj, getSerialize2(serializer, decycler), indent);
|
|
}, getSerialize2 = function(serializer, decycler) {
|
|
let stack = [], keys2 = [];
|
|
if (!decycler)
|
|
decycler = function(_, value) {
|
|
if (stack[0] === value)
|
|
return "[Circular ~]";
|
|
return "[Circular ~." + keys2.slice(0, stack.indexOf(value)).join(".") + "]";
|
|
};
|
|
return function(key, value) {
|
|
if (stack.length > 0) {
|
|
var thisPos = stack.indexOf(this);
|
|
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
|
|
~thisPos ? keys2.splice(thisPos, Infinity, key) : keys2.push(key);
|
|
if (~stack.indexOf(value))
|
|
value = decycler.call(this, key, value);
|
|
} else
|
|
stack.push(value);
|
|
return serializer == null ? value : serializer.call(this, key, value);
|
|
};
|
|
};
|
|
var stringify = stringify2, getSerialize = getSerialize2;
|
|
let {
|
|
isImmutable = isImmutableDefault,
|
|
ignoredPaths,
|
|
warnAfter = 32
|
|
} = options;
|
|
const track = trackForMutations.bind(null, isImmutable, ignoredPaths);
|
|
return ({
|
|
getState
|
|
}) => {
|
|
let state = getState();
|
|
let tracker = track(state);
|
|
let result;
|
|
return (next) => (action) => {
|
|
const measureUtils = getTimeMeasureUtils(warnAfter, "ImmutableStateInvariantMiddleware");
|
|
measureUtils.measureTime(() => {
|
|
state = getState();
|
|
result = tracker.detectMutations();
|
|
tracker = track(state);
|
|
if (result.wasMutated) {
|
|
throw new Error(false ? formatProdErrorMessage(19) : `A state mutation was detected between dispatches, in the path '${result.path || ""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`);
|
|
}
|
|
});
|
|
const dispatchedAction = next(action);
|
|
measureUtils.measureTime(() => {
|
|
state = getState();
|
|
result = tracker.detectMutations();
|
|
tracker = track(state);
|
|
if (result.wasMutated) {
|
|
throw new Error(false ? formatProdErrorMessage(20) : `A state mutation was detected inside a dispatch, in the path: ${result.path || ""}. Take a look at the reducer(s) handling the action ${stringify2(action)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`);
|
|
}
|
|
});
|
|
measureUtils.warnIfExceeded();
|
|
return dispatchedAction;
|
|
};
|
|
};
|
|
}
|
|
}
|
|
function isPlain(val) {
|
|
const type = typeof val;
|
|
return val == null || type === "string" || type === "boolean" || type === "number" || Array.isArray(val) || isPlainObject(val);
|
|
}
|
|
function findNonSerializableValue(value, path = "", isSerializable = isPlain, getEntries, ignoredPaths = [], cache) {
|
|
let foundNestedSerializable;
|
|
if (!isSerializable(value)) {
|
|
return {
|
|
keyPath: path || "<root>",
|
|
value
|
|
};
|
|
}
|
|
if (typeof value !== "object" || value === null) {
|
|
return false;
|
|
}
|
|
if (cache == null ? void 0 : cache.has(value))
|
|
return false;
|
|
const entries = getEntries != null ? getEntries(value) : Object.entries(value);
|
|
const hasIgnoredPaths = ignoredPaths.length > 0;
|
|
for (const [key, nestedValue] of entries) {
|
|
const nestedPath = path ? path + "." + key : key;
|
|
if (hasIgnoredPaths) {
|
|
const hasMatches = ignoredPaths.some((ignored) => {
|
|
if (ignored instanceof RegExp) {
|
|
return ignored.test(nestedPath);
|
|
}
|
|
return nestedPath === ignored;
|
|
});
|
|
if (hasMatches) {
|
|
continue;
|
|
}
|
|
}
|
|
if (!isSerializable(nestedValue)) {
|
|
return {
|
|
keyPath: nestedPath,
|
|
value: nestedValue
|
|
};
|
|
}
|
|
if (typeof nestedValue === "object") {
|
|
foundNestedSerializable = findNonSerializableValue(nestedValue, nestedPath, isSerializable, getEntries, ignoredPaths, cache);
|
|
if (foundNestedSerializable) {
|
|
return foundNestedSerializable;
|
|
}
|
|
}
|
|
}
|
|
if (cache && isNestedFrozen(value))
|
|
cache.add(value);
|
|
return false;
|
|
}
|
|
function isNestedFrozen(value) {
|
|
if (!Object.isFrozen(value))
|
|
return false;
|
|
for (const nestedValue of Object.values(value)) {
|
|
if (typeof nestedValue !== "object" || nestedValue === null)
|
|
continue;
|
|
if (!isNestedFrozen(nestedValue))
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
function createSerializableStateInvariantMiddleware(options = {}) {
|
|
if (false) {
|
|
return () => (next) => (action) => next(action);
|
|
} else {
|
|
const {
|
|
isSerializable = isPlain,
|
|
getEntries,
|
|
ignoredActions = [],
|
|
ignoredActionPaths = ["meta.arg", "meta.baseQueryMeta"],
|
|
ignoredPaths = [],
|
|
warnAfter = 32,
|
|
ignoreState = false,
|
|
ignoreActions = false,
|
|
disableCache = false
|
|
} = options;
|
|
const cache = !disableCache && WeakSet ? /* @__PURE__ */ new WeakSet() : void 0;
|
|
return (storeAPI) => (next) => (action) => {
|
|
if (!isAction(action)) {
|
|
return next(action);
|
|
}
|
|
const result = next(action);
|
|
const measureUtils = getTimeMeasureUtils(warnAfter, "SerializableStateInvariantMiddleware");
|
|
if (!ignoreActions && !(ignoredActions.length && ignoredActions.indexOf(action.type) !== -1)) {
|
|
measureUtils.measureTime(() => {
|
|
const foundActionNonSerializableValue = findNonSerializableValue(action, "", isSerializable, getEntries, ignoredActionPaths, cache);
|
|
if (foundActionNonSerializableValue) {
|
|
const {
|
|
keyPath,
|
|
value
|
|
} = foundActionNonSerializableValue;
|
|
console.error(`A non-serializable value was detected in an action, in the path: \`${keyPath}\`. Value:`, value, "\nTake a look at the logic that dispatched this action: ", action, "\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)", "\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)");
|
|
}
|
|
});
|
|
}
|
|
if (!ignoreState) {
|
|
measureUtils.measureTime(() => {
|
|
const state = storeAPI.getState();
|
|
const foundStateNonSerializableValue = findNonSerializableValue(state, "", isSerializable, getEntries, ignoredPaths, cache);
|
|
if (foundStateNonSerializableValue) {
|
|
const {
|
|
keyPath,
|
|
value
|
|
} = foundStateNonSerializableValue;
|
|
console.error(`A non-serializable value was detected in the state, in the path: \`${keyPath}\`. Value:`, value, `
|
|
Take a look at the reducer(s) handling this action type: ${action.type}.
|
|
(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`);
|
|
}
|
|
});
|
|
measureUtils.warnIfExceeded();
|
|
}
|
|
return result;
|
|
};
|
|
}
|
|
}
|
|
function isBoolean(x) {
|
|
return typeof x === "boolean";
|
|
}
|
|
var buildGetDefaultMiddleware = () => function getDefaultMiddleware(options) {
|
|
const {
|
|
thunk: thunk2 = true,
|
|
immutableCheck = true,
|
|
serializableCheck = true,
|
|
actionCreatorCheck = true
|
|
} = options != null ? options : {};
|
|
let middlewareArray = new Tuple();
|
|
if (thunk2) {
|
|
if (isBoolean(thunk2)) {
|
|
middlewareArray.push(thunk);
|
|
} else {
|
|
middlewareArray.push(withExtraArgument(thunk2.extraArgument));
|
|
}
|
|
}
|
|
if (true) {
|
|
if (immutableCheck) {
|
|
let immutableOptions = {};
|
|
if (!isBoolean(immutableCheck)) {
|
|
immutableOptions = immutableCheck;
|
|
}
|
|
middlewareArray.unshift(createImmutableStateInvariantMiddleware(immutableOptions));
|
|
}
|
|
if (serializableCheck) {
|
|
let serializableOptions = {};
|
|
if (!isBoolean(serializableCheck)) {
|
|
serializableOptions = serializableCheck;
|
|
}
|
|
middlewareArray.push(createSerializableStateInvariantMiddleware(serializableOptions));
|
|
}
|
|
if (actionCreatorCheck) {
|
|
let actionCreatorOptions = {};
|
|
if (!isBoolean(actionCreatorCheck)) {
|
|
actionCreatorOptions = actionCreatorCheck;
|
|
}
|
|
middlewareArray.unshift(createActionCreatorInvariantMiddleware(actionCreatorOptions));
|
|
}
|
|
}
|
|
return middlewareArray;
|
|
};
|
|
var SHOULD_AUTOBATCH = "RTK_autoBatch";
|
|
var createQueueWithTimer = (timeout) => {
|
|
return (notify) => {
|
|
setTimeout(notify, timeout);
|
|
};
|
|
};
|
|
var rAF = typeof window !== "undefined" && window.requestAnimationFrame ? window.requestAnimationFrame : createQueueWithTimer(10);
|
|
var autoBatchEnhancer = (options = {
|
|
type: "raf"
|
|
}) => (next) => (...args) => {
|
|
const store2 = next(...args);
|
|
let notifying = true;
|
|
let shouldNotifyAtEndOfTick = false;
|
|
let notificationQueued = false;
|
|
const listeners = /* @__PURE__ */ new Set();
|
|
const queueCallback = options.type === "tick" ? queueMicrotask : options.type === "raf" ? rAF : options.type === "callback" ? options.queueNotification : createQueueWithTimer(options.timeout);
|
|
const notifyListeners = () => {
|
|
notificationQueued = false;
|
|
if (shouldNotifyAtEndOfTick) {
|
|
shouldNotifyAtEndOfTick = false;
|
|
listeners.forEach((l) => l());
|
|
}
|
|
};
|
|
return Object.assign({}, store2, {
|
|
subscribe(listener22) {
|
|
const wrappedListener = () => notifying && listener22();
|
|
const unsubscribe = store2.subscribe(wrappedListener);
|
|
listeners.add(listener22);
|
|
return () => {
|
|
unsubscribe();
|
|
listeners.delete(listener22);
|
|
};
|
|
},
|
|
dispatch(action) {
|
|
var _a;
|
|
try {
|
|
notifying = !((_a = action == null ? void 0 : action.meta) == null ? void 0 : _a[SHOULD_AUTOBATCH]);
|
|
shouldNotifyAtEndOfTick = !notifying;
|
|
if (shouldNotifyAtEndOfTick) {
|
|
if (!notificationQueued) {
|
|
notificationQueued = true;
|
|
queueCallback(notifyListeners);
|
|
}
|
|
}
|
|
return store2.dispatch(action);
|
|
} finally {
|
|
notifying = true;
|
|
}
|
|
}
|
|
});
|
|
};
|
|
var buildGetDefaultEnhancers = (middlewareEnhancer) => function getDefaultEnhancers(options) {
|
|
const {
|
|
autoBatch = true
|
|
} = options != null ? options : {};
|
|
let enhancerArray = new Tuple(middlewareEnhancer);
|
|
if (autoBatch) {
|
|
enhancerArray.push(autoBatchEnhancer(typeof autoBatch === "object" ? autoBatch : void 0));
|
|
}
|
|
return enhancerArray;
|
|
};
|
|
var IS_PRODUCTION = false;
|
|
function configureStore(options) {
|
|
const getDefaultMiddleware = buildGetDefaultMiddleware();
|
|
const {
|
|
reducer = void 0,
|
|
middleware,
|
|
devTools = true,
|
|
preloadedState = void 0,
|
|
enhancers = void 0
|
|
} = options || {};
|
|
let rootReducer;
|
|
if (typeof reducer === "function") {
|
|
rootReducer = reducer;
|
|
} else if (isPlainObject(reducer)) {
|
|
rootReducer = combineReducers(reducer);
|
|
} else {
|
|
throw new Error(false ? formatProdErrorMessage(1) : "`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");
|
|
}
|
|
if (!IS_PRODUCTION && middleware && typeof middleware !== "function") {
|
|
throw new Error(false ? formatProdErrorMessage(2) : "`middleware` field must be a callback");
|
|
}
|
|
let finalMiddleware;
|
|
if (typeof middleware === "function") {
|
|
finalMiddleware = middleware(getDefaultMiddleware);
|
|
if (!IS_PRODUCTION && !Array.isArray(finalMiddleware)) {
|
|
throw new Error(false ? formatProdErrorMessage(3) : "when using a middleware builder function, an array of middleware must be returned");
|
|
}
|
|
} else {
|
|
finalMiddleware = getDefaultMiddleware();
|
|
}
|
|
if (!IS_PRODUCTION && finalMiddleware.some((item) => typeof item !== "function")) {
|
|
throw new Error(false ? formatProdErrorMessage(4) : "each middleware provided to configureStore must be a function");
|
|
}
|
|
let finalCompose = compose;
|
|
if (devTools) {
|
|
finalCompose = composeWithDevTools(__spreadValues({
|
|
trace: !IS_PRODUCTION
|
|
}, typeof devTools === "object" && devTools));
|
|
}
|
|
const middlewareEnhancer = applyMiddleware(...finalMiddleware);
|
|
const getDefaultEnhancers = buildGetDefaultEnhancers(middlewareEnhancer);
|
|
if (!IS_PRODUCTION && enhancers && typeof enhancers !== "function") {
|
|
throw new Error(false ? formatProdErrorMessage(5) : "`enhancers` field must be a callback");
|
|
}
|
|
let storeEnhancers = typeof enhancers === "function" ? enhancers(getDefaultEnhancers) : getDefaultEnhancers();
|
|
if (!IS_PRODUCTION && !Array.isArray(storeEnhancers)) {
|
|
throw new Error(false ? formatProdErrorMessage(6) : "`enhancers` callback must return an array");
|
|
}
|
|
if (!IS_PRODUCTION && storeEnhancers.some((item) => typeof item !== "function")) {
|
|
throw new Error(false ? formatProdErrorMessage(7) : "each enhancer provided to configureStore must be a function");
|
|
}
|
|
if (!IS_PRODUCTION && finalMiddleware.length && !storeEnhancers.includes(middlewareEnhancer)) {
|
|
console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");
|
|
}
|
|
const composedEnhancer = finalCompose(...storeEnhancers);
|
|
return createStore(rootReducer, preloadedState, composedEnhancer);
|
|
}
|
|
function executeReducerBuilderCallback(builderCallback) {
|
|
const actionsMap = {};
|
|
const actionMatchers = [];
|
|
let defaultCaseReducer;
|
|
const builder = {
|
|
addCase(typeOrActionCreator, reducer) {
|
|
if (true) {
|
|
if (actionMatchers.length > 0) {
|
|
throw new Error(false ? formatProdErrorMessage(26) : "`builder.addCase` should only be called before calling `builder.addMatcher`");
|
|
}
|
|
if (defaultCaseReducer) {
|
|
throw new Error(false ? formatProdErrorMessage(27) : "`builder.addCase` should only be called before calling `builder.addDefaultCase`");
|
|
}
|
|
}
|
|
const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
|
|
if (!type) {
|
|
throw new Error(false ? formatProdErrorMessage(28) : "`builder.addCase` cannot be called with an empty action type");
|
|
}
|
|
if (type in actionsMap) {
|
|
throw new Error(false ? formatProdErrorMessage(29) : `\`builder.addCase\` cannot be called with two reducers for the same action type '${type}'`);
|
|
}
|
|
actionsMap[type] = reducer;
|
|
return builder;
|
|
},
|
|
addMatcher(matcher, reducer) {
|
|
if (true) {
|
|
if (defaultCaseReducer) {
|
|
throw new Error(false ? formatProdErrorMessage(30) : "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
|
|
}
|
|
}
|
|
actionMatchers.push({
|
|
matcher,
|
|
reducer
|
|
});
|
|
return builder;
|
|
},
|
|
addDefaultCase(reducer) {
|
|
if (true) {
|
|
if (defaultCaseReducer) {
|
|
throw new Error(false ? formatProdErrorMessage(31) : "`builder.addDefaultCase` can only be called once");
|
|
}
|
|
}
|
|
defaultCaseReducer = reducer;
|
|
return builder;
|
|
}
|
|
};
|
|
builderCallback(builder);
|
|
return [actionsMap, actionMatchers, defaultCaseReducer];
|
|
}
|
|
function isStateFunction(x) {
|
|
return typeof x === "function";
|
|
}
|
|
function createReducer(initialState9, mapOrBuilderCallback) {
|
|
if (true) {
|
|
if (typeof mapOrBuilderCallback === "object") {
|
|
throw new Error(false ? formatProdErrorMessage(8) : "The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
|
|
}
|
|
}
|
|
let [actionsMap, finalActionMatchers, finalDefaultCaseReducer] = executeReducerBuilderCallback(mapOrBuilderCallback);
|
|
let getInitialState;
|
|
if (isStateFunction(initialState9)) {
|
|
getInitialState = () => freezeDraftable(initialState9());
|
|
} else {
|
|
const frozenInitialState = freezeDraftable(initialState9);
|
|
getInitialState = () => frozenInitialState;
|
|
}
|
|
function reducer(state = getInitialState(), action) {
|
|
let caseReducers = [actionsMap[action.type], ...finalActionMatchers.filter(({
|
|
matcher
|
|
}) => matcher(action)).map(({
|
|
reducer: reducer2
|
|
}) => reducer2)];
|
|
if (caseReducers.filter((cr) => !!cr).length === 0) {
|
|
caseReducers = [finalDefaultCaseReducer];
|
|
}
|
|
return caseReducers.reduce((previousState, caseReducer) => {
|
|
if (caseReducer) {
|
|
if (isDraft(previousState)) {
|
|
const draft = previousState;
|
|
const result = caseReducer(draft, action);
|
|
if (result === void 0) {
|
|
return previousState;
|
|
}
|
|
return result;
|
|
} else if (!isDraftable(previousState)) {
|
|
const result = caseReducer(previousState, action);
|
|
if (result === void 0) {
|
|
if (previousState === null) {
|
|
return previousState;
|
|
}
|
|
throw new Error(false ? formatProdErrorMessage(9) : "A case reducer on a non-draftable value must not return undefined");
|
|
}
|
|
return result;
|
|
} else {
|
|
return produce(previousState, (draft) => {
|
|
return caseReducer(draft, action);
|
|
});
|
|
}
|
|
}
|
|
return previousState;
|
|
}, state);
|
|
}
|
|
reducer.getInitialState = getInitialState;
|
|
return reducer;
|
|
}
|
|
var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW";
|
|
var nanoid = (size = 21) => {
|
|
let id = "";
|
|
let i = size;
|
|
while (i--) {
|
|
id += urlAlphabet[Math.random() * 64 | 0];
|
|
}
|
|
return id;
|
|
};
|
|
var matches = (matcher, action) => {
|
|
if (hasMatchFunction(matcher)) {
|
|
return matcher.match(action);
|
|
} else {
|
|
return matcher(action);
|
|
}
|
|
};
|
|
function isAnyOf(...matchers) {
|
|
return (action) => {
|
|
return matchers.some((matcher) => matches(matcher, action));
|
|
};
|
|
}
|
|
var commonProperties = ["name", "message", "stack", "code"];
|
|
var RejectWithValue = class {
|
|
constructor(payload, meta) {
|
|
__publicField(this, "_type");
|
|
this.payload = payload;
|
|
this.meta = meta;
|
|
}
|
|
};
|
|
var FulfillWithMeta = class {
|
|
constructor(payload, meta) {
|
|
__publicField(this, "_type");
|
|
this.payload = payload;
|
|
this.meta = meta;
|
|
}
|
|
};
|
|
var miniSerializeError = (value) => {
|
|
if (typeof value === "object" && value !== null) {
|
|
const simpleError = {};
|
|
for (const property of commonProperties) {
|
|
if (typeof value[property] === "string") {
|
|
simpleError[property] = value[property];
|
|
}
|
|
}
|
|
return simpleError;
|
|
}
|
|
return {
|
|
message: String(value)
|
|
};
|
|
};
|
|
var createAsyncThunk = /* @__PURE__ */ (() => {
|
|
function createAsyncThunk2(typePrefix, payloadCreator, options) {
|
|
const fulfilled = createAction(typePrefix + "/fulfilled", (payload, requestId, arg, meta) => ({
|
|
payload,
|
|
meta: __spreadProps(__spreadValues({}, meta || {}), {
|
|
arg,
|
|
requestId,
|
|
requestStatus: "fulfilled"
|
|
})
|
|
}));
|
|
const pending = createAction(typePrefix + "/pending", (requestId, arg, meta) => ({
|
|
payload: void 0,
|
|
meta: __spreadProps(__spreadValues({}, meta || {}), {
|
|
arg,
|
|
requestId,
|
|
requestStatus: "pending"
|
|
})
|
|
}));
|
|
const rejected = createAction(typePrefix + "/rejected", (error, requestId, arg, payload, meta) => ({
|
|
payload,
|
|
error: (options && options.serializeError || miniSerializeError)(error || "Rejected"),
|
|
meta: __spreadProps(__spreadValues({}, meta || {}), {
|
|
arg,
|
|
requestId,
|
|
rejectedWithValue: !!payload,
|
|
requestStatus: "rejected",
|
|
aborted: (error == null ? void 0 : error.name) === "AbortError",
|
|
condition: (error == null ? void 0 : error.name) === "ConditionError"
|
|
})
|
|
}));
|
|
function actionCreator(arg) {
|
|
return (dispatch, getState, extra) => {
|
|
const requestId = (options == null ? void 0 : options.idGenerator) ? options.idGenerator(arg) : nanoid();
|
|
const abortController = new AbortController();
|
|
let abortHandler;
|
|
let abortReason;
|
|
function abort(reason) {
|
|
abortReason = reason;
|
|
abortController.abort();
|
|
}
|
|
const promise = async function() {
|
|
var _a, _b;
|
|
let finalAction;
|
|
try {
|
|
let conditionResult = (_a = options == null ? void 0 : options.condition) == null ? void 0 : _a.call(options, arg, {
|
|
getState,
|
|
extra
|
|
});
|
|
if (isThenable(conditionResult)) {
|
|
conditionResult = await conditionResult;
|
|
}
|
|
if (conditionResult === false || abortController.signal.aborted) {
|
|
throw {
|
|
name: "ConditionError",
|
|
message: "Aborted due to condition callback returning false."
|
|
};
|
|
}
|
|
const abortedPromise = new Promise((_, reject) => {
|
|
abortHandler = () => {
|
|
reject({
|
|
name: "AbortError",
|
|
message: abortReason || "Aborted"
|
|
});
|
|
};
|
|
abortController.signal.addEventListener("abort", abortHandler);
|
|
});
|
|
dispatch(pending(requestId, arg, (_b = options == null ? void 0 : options.getPendingMeta) == null ? void 0 : _b.call(options, {
|
|
requestId,
|
|
arg
|
|
}, {
|
|
getState,
|
|
extra
|
|
})));
|
|
finalAction = await Promise.race([abortedPromise, Promise.resolve(payloadCreator(arg, {
|
|
dispatch,
|
|
getState,
|
|
extra,
|
|
requestId,
|
|
signal: abortController.signal,
|
|
abort,
|
|
rejectWithValue: (value, meta) => {
|
|
return new RejectWithValue(value, meta);
|
|
},
|
|
fulfillWithValue: (value, meta) => {
|
|
return new FulfillWithMeta(value, meta);
|
|
}
|
|
})).then((result) => {
|
|
if (result instanceof RejectWithValue) {
|
|
throw result;
|
|
}
|
|
if (result instanceof FulfillWithMeta) {
|
|
return fulfilled(result.payload, requestId, arg, result.meta);
|
|
}
|
|
return fulfilled(result, requestId, arg);
|
|
})]);
|
|
} catch (err) {
|
|
finalAction = err instanceof RejectWithValue ? rejected(null, requestId, arg, err.payload, err.meta) : rejected(err, requestId, arg);
|
|
} finally {
|
|
if (abortHandler) {
|
|
abortController.signal.removeEventListener("abort", abortHandler);
|
|
}
|
|
}
|
|
const skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition;
|
|
if (!skipDispatch) {
|
|
dispatch(finalAction);
|
|
}
|
|
return finalAction;
|
|
}();
|
|
return Object.assign(promise, {
|
|
abort,
|
|
requestId,
|
|
arg,
|
|
unwrap() {
|
|
return promise.then(unwrapResult);
|
|
}
|
|
});
|
|
};
|
|
}
|
|
return Object.assign(actionCreator, {
|
|
pending,
|
|
rejected,
|
|
fulfilled,
|
|
settled: isAnyOf(rejected, fulfilled),
|
|
typePrefix
|
|
});
|
|
}
|
|
createAsyncThunk2.withTypes = () => createAsyncThunk2;
|
|
return createAsyncThunk2;
|
|
})();
|
|
function unwrapResult(action) {
|
|
if (action.meta && action.meta.rejectedWithValue) {
|
|
throw action.payload;
|
|
}
|
|
if (action.error) {
|
|
throw action.error;
|
|
}
|
|
return action.payload;
|
|
}
|
|
function isThenable(value) {
|
|
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
}
|
|
var asyncThunkSymbol = /* @__PURE__ */ Symbol.for("rtk-slice-createasyncthunk");
|
|
var asyncThunkCreator = {
|
|
[asyncThunkSymbol]: createAsyncThunk
|
|
};
|
|
function getType(slice, actionKey) {
|
|
return `${slice}/${actionKey}`;
|
|
}
|
|
function buildCreateSlice({
|
|
creators
|
|
} = {}) {
|
|
var _a;
|
|
const cAT = (_a = creators == null ? void 0 : creators.asyncThunk) == null ? void 0 : _a[asyncThunkSymbol];
|
|
return function createSlice2(options) {
|
|
const {
|
|
name,
|
|
reducerPath = name
|
|
} = options;
|
|
if (!name) {
|
|
throw new Error(false ? formatProdErrorMessage(11) : "`name` is a required option for createSlice");
|
|
}
|
|
if (typeof process !== "undefined" && true) {
|
|
if (options.initialState === void 0) {
|
|
console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");
|
|
}
|
|
}
|
|
const reducers = (typeof options.reducers === "function" ? options.reducers(buildReducerCreators()) : options.reducers) || {};
|
|
const reducerNames = Object.keys(reducers);
|
|
const context = {
|
|
sliceCaseReducersByName: {},
|
|
sliceCaseReducersByType: {},
|
|
actionCreators: {},
|
|
sliceMatchers: []
|
|
};
|
|
const contextMethods = {
|
|
addCase(typeOrActionCreator, reducer2) {
|
|
const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
|
|
if (!type) {
|
|
throw new Error(false ? formatProdErrorMessage(12) : "`context.addCase` cannot be called with an empty action type");
|
|
}
|
|
if (type in context.sliceCaseReducersByType) {
|
|
throw new Error(false ? formatProdErrorMessage(13) : "`context.addCase` cannot be called with two reducers for the same action type: " + type);
|
|
}
|
|
context.sliceCaseReducersByType[type] = reducer2;
|
|
return contextMethods;
|
|
},
|
|
addMatcher(matcher, reducer2) {
|
|
context.sliceMatchers.push({
|
|
matcher,
|
|
reducer: reducer2
|
|
});
|
|
return contextMethods;
|
|
},
|
|
exposeAction(name2, actionCreator) {
|
|
context.actionCreators[name2] = actionCreator;
|
|
return contextMethods;
|
|
},
|
|
exposeCaseReducer(name2, reducer2) {
|
|
context.sliceCaseReducersByName[name2] = reducer2;
|
|
return contextMethods;
|
|
}
|
|
};
|
|
reducerNames.forEach((reducerName) => {
|
|
const reducerDefinition = reducers[reducerName];
|
|
const reducerDetails = {
|
|
reducerName,
|
|
type: getType(name, reducerName),
|
|
createNotation: typeof options.reducers === "function"
|
|
};
|
|
if (isAsyncThunkSliceReducerDefinition(reducerDefinition)) {
|
|
handleThunkCaseReducerDefinition(reducerDetails, reducerDefinition, contextMethods, cAT);
|
|
} else {
|
|
handleNormalReducerDefinition(reducerDetails, reducerDefinition, contextMethods);
|
|
}
|
|
});
|
|
function buildReducer() {
|
|
if (true) {
|
|
if (typeof options.extraReducers === "object") {
|
|
throw new Error(false ? formatProdErrorMessage(14) : "The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
|
|
}
|
|
}
|
|
const [extraReducers = {}, actionMatchers = [], defaultCaseReducer = void 0] = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers];
|
|
const finalCaseReducers = __spreadValues(__spreadValues({}, extraReducers), context.sliceCaseReducersByType);
|
|
return createReducer(options.initialState, (builder) => {
|
|
for (let key in finalCaseReducers) {
|
|
builder.addCase(key, finalCaseReducers[key]);
|
|
}
|
|
for (let sM of context.sliceMatchers) {
|
|
builder.addMatcher(sM.matcher, sM.reducer);
|
|
}
|
|
for (let m of actionMatchers) {
|
|
builder.addMatcher(m.matcher, m.reducer);
|
|
}
|
|
if (defaultCaseReducer) {
|
|
builder.addDefaultCase(defaultCaseReducer);
|
|
}
|
|
});
|
|
}
|
|
const selectSelf = (state) => state;
|
|
const injectedSelectorCache = /* @__PURE__ */ new Map();
|
|
let _reducer;
|
|
function reducer(state, action) {
|
|
if (!_reducer)
|
|
_reducer = buildReducer();
|
|
return _reducer(state, action);
|
|
}
|
|
function getInitialState() {
|
|
if (!_reducer)
|
|
_reducer = buildReducer();
|
|
return _reducer.getInitialState();
|
|
}
|
|
function makeSelectorProps(reducerPath2, injected = false) {
|
|
function selectSlice(state) {
|
|
let sliceState = state[reducerPath2];
|
|
if (typeof sliceState === "undefined") {
|
|
if (injected) {
|
|
sliceState = getInitialState();
|
|
} else if (true) {
|
|
throw new Error(false ? formatProdErrorMessage(15) : "selectSlice returned undefined for an uninjected slice reducer");
|
|
}
|
|
}
|
|
return sliceState;
|
|
}
|
|
function getSelectors(selectState = selectSelf) {
|
|
const selectorCache = emplace(injectedSelectorCache, injected, {
|
|
insert: () => /* @__PURE__ */ new WeakMap()
|
|
});
|
|
return emplace(selectorCache, selectState, {
|
|
insert: () => {
|
|
var _a2;
|
|
const map = {};
|
|
for (const [name2, selector] of Object.entries((_a2 = options.selectors) != null ? _a2 : {})) {
|
|
map[name2] = wrapSelector(selector, selectState, getInitialState, injected);
|
|
}
|
|
return map;
|
|
}
|
|
});
|
|
}
|
|
return {
|
|
reducerPath: reducerPath2,
|
|
getSelectors,
|
|
get selectors() {
|
|
return getSelectors(selectSlice);
|
|
},
|
|
selectSlice
|
|
};
|
|
}
|
|
const slice = __spreadProps(__spreadValues({
|
|
name,
|
|
reducer,
|
|
actions: context.actionCreators,
|
|
caseReducers: context.sliceCaseReducersByName,
|
|
getInitialState
|
|
}, makeSelectorProps(reducerPath)), {
|
|
injectInto(injectable, _a2 = {}) {
|
|
var _b = _a2, {
|
|
reducerPath: pathOpt
|
|
} = _b, config3 = __objRest(_b, [
|
|
"reducerPath"
|
|
]);
|
|
const newReducerPath = pathOpt != null ? pathOpt : reducerPath;
|
|
injectable.inject({
|
|
reducerPath: newReducerPath,
|
|
reducer
|
|
}, config3);
|
|
return __spreadValues(__spreadValues({}, slice), makeSelectorProps(newReducerPath, true));
|
|
}
|
|
});
|
|
return slice;
|
|
};
|
|
}
|
|
function wrapSelector(selector, selectState, getInitialState, injected) {
|
|
function wrapper(rootState, ...args) {
|
|
let sliceState = selectState(rootState);
|
|
if (typeof sliceState === "undefined") {
|
|
if (injected) {
|
|
sliceState = getInitialState();
|
|
} else if (true) {
|
|
throw new Error(false ? formatProdErrorMessage(16) : "selectState returned undefined for an uninjected slice reducer");
|
|
}
|
|
}
|
|
return selector(sliceState, ...args);
|
|
}
|
|
wrapper.unwrapped = selector;
|
|
return wrapper;
|
|
}
|
|
var createSlice = /* @__PURE__ */ buildCreateSlice();
|
|
function buildReducerCreators() {
|
|
function asyncThunk(payloadCreator, config3) {
|
|
return __spreadValues({
|
|
_reducerDefinitionType: "asyncThunk",
|
|
payloadCreator
|
|
}, config3);
|
|
}
|
|
asyncThunk.withTypes = () => asyncThunk;
|
|
return {
|
|
reducer(caseReducer) {
|
|
return Object.assign({
|
|
[caseReducer.name](...args) {
|
|
return caseReducer(...args);
|
|
}
|
|
}[caseReducer.name], {
|
|
_reducerDefinitionType: "reducer"
|
|
});
|
|
},
|
|
preparedReducer(prepare, reducer) {
|
|
return {
|
|
_reducerDefinitionType: "reducerWithPrepare",
|
|
prepare,
|
|
reducer
|
|
};
|
|
},
|
|
asyncThunk
|
|
};
|
|
}
|
|
function handleNormalReducerDefinition({
|
|
type,
|
|
reducerName,
|
|
createNotation
|
|
}, maybeReducerWithPrepare, context) {
|
|
let caseReducer;
|
|
let prepareCallback;
|
|
if ("reducer" in maybeReducerWithPrepare) {
|
|
if (createNotation && !isCaseReducerWithPrepareDefinition(maybeReducerWithPrepare)) {
|
|
throw new Error(false ? formatProdErrorMessage(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
|
|
}
|
|
caseReducer = maybeReducerWithPrepare.reducer;
|
|
prepareCallback = maybeReducerWithPrepare.prepare;
|
|
} else {
|
|
caseReducer = maybeReducerWithPrepare;
|
|
}
|
|
context.addCase(type, caseReducer).exposeCaseReducer(reducerName, caseReducer).exposeAction(reducerName, prepareCallback ? createAction(type, prepareCallback) : createAction(type));
|
|
}
|
|
function isAsyncThunkSliceReducerDefinition(reducerDefinition) {
|
|
return reducerDefinition._reducerDefinitionType === "asyncThunk";
|
|
}
|
|
function isCaseReducerWithPrepareDefinition(reducerDefinition) {
|
|
return reducerDefinition._reducerDefinitionType === "reducerWithPrepare";
|
|
}
|
|
function handleThunkCaseReducerDefinition({
|
|
type,
|
|
reducerName
|
|
}, reducerDefinition, context, cAT) {
|
|
if (!cAT) {
|
|
throw new Error(false ? formatProdErrorMessage(18) : "Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");
|
|
}
|
|
const {
|
|
payloadCreator,
|
|
fulfilled,
|
|
pending,
|
|
rejected,
|
|
settled,
|
|
options
|
|
} = reducerDefinition;
|
|
const thunk2 = cAT(type, payloadCreator, options);
|
|
context.exposeAction(reducerName, thunk2);
|
|
if (fulfilled) {
|
|
context.addCase(thunk2.fulfilled, fulfilled);
|
|
}
|
|
if (pending) {
|
|
context.addCase(thunk2.pending, pending);
|
|
}
|
|
if (rejected) {
|
|
context.addCase(thunk2.rejected, rejected);
|
|
}
|
|
if (settled) {
|
|
context.addMatcher(thunk2.settled, settled);
|
|
}
|
|
context.exposeCaseReducer(reducerName, {
|
|
fulfilled: fulfilled || noop,
|
|
pending: pending || noop,
|
|
rejected: rejected || noop,
|
|
settled: settled || noop
|
|
});
|
|
}
|
|
function noop() {
|
|
}
|
|
var listener = "listener";
|
|
var completed = "completed";
|
|
var cancelled = "cancelled";
|
|
var taskCancelled = `task-${cancelled}`;
|
|
var taskCompleted = `task-${completed}`;
|
|
var listenerCancelled = `${listener}-${cancelled}`;
|
|
var listenerCompleted = `${listener}-${completed}`;
|
|
var assertFunction = (func, expected) => {
|
|
if (typeof func !== "function") {
|
|
throw new Error(false ? formatProdErrorMessage(32) : `${expected} is not a function`);
|
|
}
|
|
};
|
|
var {
|
|
assign
|
|
} = Object;
|
|
var alm = "listenerMiddleware";
|
|
var getListenerEntryPropsFrom = (options) => {
|
|
let {
|
|
type,
|
|
actionCreator,
|
|
matcher,
|
|
predicate,
|
|
effect
|
|
} = options;
|
|
if (type) {
|
|
predicate = createAction(type).match;
|
|
} else if (actionCreator) {
|
|
type = actionCreator.type;
|
|
predicate = actionCreator.match;
|
|
} else if (matcher) {
|
|
predicate = matcher;
|
|
} else if (predicate) {
|
|
} else {
|
|
throw new Error(false ? formatProdErrorMessage(21) : "Creating or removing a listener requires one of the known fields for matching an action");
|
|
}
|
|
assertFunction(effect, "options.listener");
|
|
return {
|
|
predicate,
|
|
type,
|
|
effect
|
|
};
|
|
};
|
|
var createListenerEntry = Object.assign((options) => {
|
|
const {
|
|
type,
|
|
predicate,
|
|
effect
|
|
} = getListenerEntryPropsFrom(options);
|
|
const id = nanoid();
|
|
const entry = {
|
|
id,
|
|
effect,
|
|
type,
|
|
predicate,
|
|
pending: /* @__PURE__ */ new Set(),
|
|
unsubscribe: () => {
|
|
throw new Error(false ? formatProdErrorMessage(22) : "Unsubscribe not initialized");
|
|
}
|
|
};
|
|
return entry;
|
|
}, {
|
|
withTypes: () => createListenerEntry
|
|
});
|
|
var addListener = Object.assign(createAction(`${alm}/add`), {
|
|
withTypes: () => addListener
|
|
});
|
|
var clearAllListeners = createAction(`${alm}/removeAll`);
|
|
var removeListener = Object.assign(createAction(`${alm}/remove`), {
|
|
withTypes: () => removeListener
|
|
});
|
|
var ORIGINAL_STATE = Symbol.for("rtk-state-proxy-original");
|
|
|
|
// src/redux/slices/simbrief.ts
|
|
init_common();
|
|
var initialState = {
|
|
username: "",
|
|
plan: null
|
|
};
|
|
var simBriefSlice = createSlice({
|
|
name: "simbrief",
|
|
initialState,
|
|
reducers: {
|
|
setUsername: (state, action) => {
|
|
state.username = action.payload;
|
|
},
|
|
saveUsername: (state) => {
|
|
if (simulator() === 0 /* MSFS */) {
|
|
Coherent.call(
|
|
"COMM_BUS_WASM_CALLBACK",
|
|
"saveSimBriefUsername",
|
|
state.username
|
|
);
|
|
}
|
|
localStorage.setItem("simBriefUsername", state.username);
|
|
},
|
|
sendPlan: (state) => {
|
|
const plan = {
|
|
origin: {
|
|
icao_code: state.plan.origin.icao_code
|
|
},
|
|
destination: {
|
|
icao_code: state.plan.destination.icao_code
|
|
},
|
|
navlog: {
|
|
fix: state.plan.navlog.fix.map((fix) => {
|
|
return {
|
|
ident: fix.ident,
|
|
via_airway: fix.via_airway,
|
|
pos_lat: fix.pos_lat,
|
|
pos_long: fix.pos_long,
|
|
type: fix.type,
|
|
is_sid_star: fix.is_sid_star,
|
|
altitude_feet: fix.altitude_feet,
|
|
oat: fix.oat,
|
|
wind_data: fix.wind_data
|
|
};
|
|
})
|
|
}
|
|
};
|
|
if (simulator() === 0 /* MSFS */) {
|
|
Coherent.call(
|
|
"COMM_BUS_WASM_CALLBACK",
|
|
"sendSimBriefPlan",
|
|
JSON.stringify(plan)
|
|
);
|
|
} else {
|
|
console.log(plan);
|
|
}
|
|
},
|
|
setPlan: (state, action) => {
|
|
state.plan = action.payload;
|
|
}
|
|
}
|
|
});
|
|
var { setUsername, saveUsername, setPlan, sendPlan } = simBriefSlice.actions;
|
|
var simbrief_default = simBriefSlice.reducer;
|
|
|
|
// src/redux/slices/hoppies.ts
|
|
init_common();
|
|
var initialState2 = {
|
|
code: ""
|
|
};
|
|
var hoppiesSlice = createSlice({
|
|
name: "hoppies",
|
|
initialState: initialState2,
|
|
reducers: {
|
|
setCode: (state, action) => {
|
|
state.code = action.payload;
|
|
},
|
|
saveCode: (state) => {
|
|
if (simulator() === 0 /* MSFS */) {
|
|
Coherent.call(
|
|
"COMM_BUS_WASM_CALLBACK",
|
|
"saveHoppieCode",
|
|
state.code
|
|
);
|
|
}
|
|
localStorage.setItem("hoppiesACARSCode", state.code);
|
|
}
|
|
}
|
|
});
|
|
var { setCode, saveCode } = hoppiesSlice.actions;
|
|
var hoppies_default = hoppiesSlice.reducer;
|
|
|
|
// src/redux/slices/plane.ts
|
|
init_common();
|
|
var initialState3 = {
|
|
brightness: 100,
|
|
maxZfw: 181440,
|
|
maxFuel: 116213,
|
|
mtow: 273294,
|
|
options: {
|
|
general: {
|
|
weightUnits: "kgs",
|
|
temperatureUnits: "c",
|
|
canBeER: false,
|
|
hasXS: false,
|
|
enableSevereFailures: true,
|
|
enableRandomFailures: false,
|
|
failureChance: 1,
|
|
isExtendedRange: false,
|
|
isCargo: false,
|
|
manpads: false,
|
|
pauseAtTOD: false
|
|
},
|
|
systems: {
|
|
automaticAntiIce: false,
|
|
digitalStandby: false,
|
|
fuelDipstick: false,
|
|
rcws: false,
|
|
tapeDisplays: false,
|
|
highDecelRateABS: false,
|
|
singleCueFD: false,
|
|
inhibitTireFailure: false,
|
|
windVectorType: "track",
|
|
radAltBehavior: 0,
|
|
wbs: false,
|
|
customSIDs: false,
|
|
customSTARs: false,
|
|
customAPPRs: false
|
|
},
|
|
caws: {
|
|
altAlertType: 0,
|
|
altAlertOnCapture: true,
|
|
callout2500: true,
|
|
callout1000: true,
|
|
callout500: true,
|
|
callout400: true,
|
|
callout300: true,
|
|
callout200: true,
|
|
callout100: true,
|
|
callout50onwards: true
|
|
},
|
|
performance: {
|
|
fuelCGControl: 0,
|
|
to1DeRate: 0,
|
|
to2DeRate: 0,
|
|
cl1DeRate: 0,
|
|
cl2DeRate: 0,
|
|
ga1DeRate: 0,
|
|
ga2DeRate: 0,
|
|
flapPylonPIP: false,
|
|
deflectedAilerons: false
|
|
},
|
|
communication: {
|
|
useHoppies: true
|
|
},
|
|
behaviour: {
|
|
allowHardwareOverforce: false,
|
|
automaticSeatbelt: false,
|
|
irsAlignTime: 0,
|
|
baroSync: 0,
|
|
parkBrakeBehaviour: true,
|
|
minimumsSync: false,
|
|
showPhysicalThrottlePos: 0,
|
|
scrollAcceleration: true
|
|
}
|
|
}
|
|
};
|
|
var maxZfw = {
|
|
cargo: {
|
|
kgs: 181440,
|
|
lbs: 4e5
|
|
},
|
|
extendedRange: {
|
|
kgs: 204710,
|
|
lbs: 451300
|
|
},
|
|
passenger: {
|
|
kgs: 181440,
|
|
lbs: 4e5
|
|
}
|
|
};
|
|
var mtow = {
|
|
cargo: {
|
|
kgs: 283730,
|
|
lbs: 625500
|
|
},
|
|
extendedRange: {
|
|
kgs: 285988,
|
|
lbs: 630500
|
|
},
|
|
passenger: {
|
|
kgs: 283730,
|
|
lbs: 625500
|
|
}
|
|
};
|
|
var maxFuel = {
|
|
cargo: {
|
|
kgs: 116213,
|
|
lbs: 256207
|
|
},
|
|
extendedRange: {
|
|
kgs: 128193,
|
|
lbs: 282619
|
|
},
|
|
passenger: {
|
|
kgs: 116213,
|
|
lbs: 256207
|
|
}
|
|
};
|
|
var getMetricBoundaries = (isExtendedRange, isCargo) => {
|
|
if (isExtendedRange) {
|
|
return {
|
|
maxZfw: maxZfw.extendedRange.kgs,
|
|
maxFuel: maxFuel.extendedRange.kgs,
|
|
mtow: mtow.extendedRange.kgs
|
|
};
|
|
} else if (isCargo) {
|
|
return {
|
|
maxZfw: maxZfw.cargo.kgs,
|
|
maxFuel: maxFuel.cargo.kgs,
|
|
mtow: mtow.cargo.kgs
|
|
};
|
|
}
|
|
return {
|
|
maxZfw: maxZfw.passenger.kgs,
|
|
maxFuel: maxFuel.passenger.kgs,
|
|
mtow: mtow.passenger.kgs
|
|
};
|
|
};
|
|
var getImperialBoundaries = (isExtendedRange, isCargo) => {
|
|
if (isExtendedRange) {
|
|
return {
|
|
maxZfw: maxZfw.extendedRange.lbs,
|
|
maxFuel: maxFuel.extendedRange.lbs,
|
|
mtow: mtow.extendedRange.lbs
|
|
};
|
|
} else if (isCargo) {
|
|
return {
|
|
maxZfw: maxZfw.cargo.lbs,
|
|
maxFuel: maxFuel.cargo.lbs,
|
|
mtow: mtow.cargo.lbs
|
|
};
|
|
}
|
|
return {
|
|
maxZfw: maxZfw.passenger.lbs,
|
|
maxFuel: maxFuel.passenger.lbs,
|
|
mtow: mtow.passenger.lbs
|
|
};
|
|
};
|
|
var updateBoundaries = (state) => {
|
|
const boundaries = state.options.general.weightUnits === "lbs" ? getImperialBoundaries(
|
|
state.options.general.isExtendedRange,
|
|
state.options.general.isCargo
|
|
) : getMetricBoundaries(
|
|
state.options.general.isExtendedRange,
|
|
state.options.general.isCargo
|
|
);
|
|
return __spreadValues(__spreadValues({}, state), boundaries);
|
|
};
|
|
var getPlaneConfig = createAsyncThunk(
|
|
"plane/getConfig",
|
|
async (_, thunkAPI) => {
|
|
const api2 = await lib();
|
|
const state = thunkAPI.getState();
|
|
const generalOptions = api2.getEFBVariable("OPTIONS_GENERAL", "number");
|
|
const canBeER = api2.getEFBVariable("CAN_BE_ER", "number") === 1;
|
|
const hasXS = api2.getEFBVariable("HAS_XS", "number") === 1;
|
|
const isExtendedRange = api2.getSimulatorVariable("L:MD11_OPT_ER") === 1;
|
|
const isCargo = api2.getEFBVariable("IS_CARGO", "number") === 1;
|
|
const irsAlignTime = api2.getEFBVariable("IRS_ALIGN", "number");
|
|
const optionsSystem = api2.getEFBVariable("OPTIONS_SYSTEMS", "number");
|
|
const cawsOptions = api2.getEFBVariable("OPTIONS_CAWS", "number");
|
|
const behaviourOptions = api2.getEFBVariable(
|
|
"OPTIONS_BEHAVIOUR",
|
|
"number"
|
|
);
|
|
const manpads = api2.getSimulatorVariable(`L:MD11_OPT_GUARDIAN`);
|
|
return {
|
|
brightness: state.plane.brightness,
|
|
mtow: 0,
|
|
maxZfw: 0,
|
|
maxFuel: 0,
|
|
options: {
|
|
general: {
|
|
isCargo,
|
|
canBeER,
|
|
hasXS,
|
|
isExtendedRange,
|
|
weightUnits: generalOptions & 1 << 0 ? "lbs" : "kgs",
|
|
temperatureUnits: generalOptions & 1 << 1 ? "f" : "c",
|
|
manpads: manpads === 1 ? true : false,
|
|
pauseAtTOD: generalOptions & 1 << 4 ? true : false,
|
|
enableSevereFailures: generalOptions & 1 << 2 ? true : false,
|
|
enableRandomFailures: generalOptions & 1 << 3 ? true : false,
|
|
failureChance: api2.getEFBVariable(
|
|
"FAILURE_CHANCE",
|
|
"number"
|
|
)
|
|
},
|
|
systems: {
|
|
digitalStandby: !!(optionsSystem & 1 << 0),
|
|
fuelDipstick: !!(optionsSystem & 1 << 1),
|
|
customSIDs: !!(optionsSystem & 1 << 2),
|
|
customSTARs: !!(optionsSystem & 1 << 3),
|
|
customAPPRs: !!(optionsSystem & 1 << 4),
|
|
rcws: !!(optionsSystem & 1 << 5),
|
|
tapeDisplays: !!(optionsSystem & 1 << 6),
|
|
highDecelRateABS: !!(optionsSystem & 1 << 7),
|
|
singleCueFD: !!(optionsSystem & 1 << 8),
|
|
inhibitTireFailure: !!(optionsSystem & 1 << 9),
|
|
windVectorType: optionsSystem & 1 << 10 ? "vector" : "track",
|
|
radAltBehavior: api2.getEFBVariable(
|
|
"OPTIONS_RAD_ALT_BEHAVIOR",
|
|
"number"
|
|
),
|
|
wbs: !!(optionsSystem & 1 << 11),
|
|
automaticAntiIce: !!(optionsSystem & 1 << 12)
|
|
},
|
|
caws: {
|
|
altAlertType: api2.getEFBVariable(
|
|
"OPTIONS_ALT_ALERT_TYPE",
|
|
"number"
|
|
),
|
|
altAlertOnCapture: !!(cawsOptions & 1 << 0),
|
|
callout2500: !!(cawsOptions & 1 << 1),
|
|
callout1000: !!(cawsOptions & 1 << 2),
|
|
callout500: !!(cawsOptions & 1 << 3),
|
|
callout400: !!(cawsOptions & 1 << 4),
|
|
callout300: !!(cawsOptions & 1 << 5),
|
|
callout200: !!(cawsOptions & 1 << 6),
|
|
callout100: !!(cawsOptions & 1 << 7),
|
|
callout50onwards: !!(cawsOptions & 1 << 8)
|
|
},
|
|
performance: {
|
|
fuelCGControl: api2.getEFBVariable(
|
|
"OPTIONS_FUEL_CG_CONTROL",
|
|
"number"
|
|
),
|
|
to1DeRate: api2.getEFBVariable(
|
|
"OPTIONS_TO1_DERATE",
|
|
"number"
|
|
),
|
|
to2DeRate: api2.getEFBVariable(
|
|
"OPTIONS_TO2_DERATE",
|
|
"number"
|
|
),
|
|
cl1DeRate: api2.getEFBVariable(
|
|
"OPTIONS_CLIMB1_DERATE",
|
|
"number"
|
|
),
|
|
cl2DeRate: api2.getEFBVariable(
|
|
"OPTIONS_CLIMB2_DERATE",
|
|
"number"
|
|
),
|
|
ga1DeRate: api2.getEFBVariable(
|
|
"OPTIONS_GA1_DERATE",
|
|
"number"
|
|
),
|
|
ga2DeRate: api2.getEFBVariable(
|
|
"OPTIONS_GA2_DERATE",
|
|
"number"
|
|
),
|
|
flapPylonPIP: api2.getEFBVariable(
|
|
"OPTIONS_FLAP_PYLON_PIP",
|
|
"number"
|
|
) == 1,
|
|
deflectedAilerons: api2.getEFBVariable("OPTIONS_PERFORMANCE", "number") & 1 << 0 ? true : false
|
|
},
|
|
communication: {
|
|
useHoppies: api2.getEFBVariable("OPTIONS_COMMUNICATION", "number") & 1 << 0 ? true : false
|
|
},
|
|
behaviour: {
|
|
allowHardwareOverforce: behaviourOptions & 1 << 0 ? true : false,
|
|
automaticSeatbelt: behaviourOptions & 1 << 1 ? true : false,
|
|
irsAlignTime,
|
|
baroSync: api2.getEFBVariable("OPTIONS_BARO_SYNC", "number"),
|
|
parkBrakeBehaviour: behaviourOptions & 1 << 2 ? true : false,
|
|
minimumsSync: behaviourOptions & 1 << 3 ? true : false,
|
|
showPhysicalThrottlePos: api2.getEFBVariable(
|
|
"OPTIONS_PHYSICAL_THROTTLE_POS",
|
|
"number"
|
|
),
|
|
scrollAcceleration: behaviourOptions & 1 << 4 ? true : false
|
|
}
|
|
},
|
|
payload: state.plane.payload
|
|
};
|
|
}
|
|
);
|
|
var saveGeneralOptions = createAsyncThunk(
|
|
"plane/saveGeneralOptions",
|
|
async (_, thunkAPI) => {
|
|
const api2 = await lib();
|
|
const state = thunkAPI.getState();
|
|
const weightUnits = state.plane.options.general.weightUnits === "lbs" ? 1 << 0 : 0;
|
|
const tempUnits = state.plane.options.general.temperatureUnits === "f" ? 1 << 1 : 0;
|
|
const enableSevereFailures = state.plane.options.general.enableSevereFailures ? 1 << 2 : 0;
|
|
const enableRandomFailures = state.plane.options.general.enableRandomFailures ? 1 << 3 : 0;
|
|
const pauseAtTOD = state.plane.options.general.pauseAtTOD ? 1 << 4 : 0;
|
|
await Promise.all([
|
|
api2.setEFBVariable(
|
|
"OPTIONS_GENERAL",
|
|
"number",
|
|
weightUnits | tempUnits | enableSevereFailures | enableRandomFailures | pauseAtTOD
|
|
),
|
|
api2.setEFBVariable(
|
|
"FAILURE_CHANCE",
|
|
"number",
|
|
state.plane.options.general.failureChance
|
|
),
|
|
api2.setSimulatorVariable(
|
|
"L:MD11_OPT_ER",
|
|
"number",
|
|
state.plane.options.general.isExtendedRange ? 1 : 0
|
|
),
|
|
api2.setSimulatorVariable(
|
|
"L:MD11_OPT_GUARDIAN",
|
|
"number",
|
|
state.plane.options.general.manpads ? 1 : 0
|
|
),
|
|
api2.triggerReadVariable([8 /* GeneralOptions */])
|
|
]);
|
|
return state.plane;
|
|
}
|
|
);
|
|
var unpause = createAsyncThunk(
|
|
"plane/unpause",
|
|
async () => {
|
|
const api2 = await lib();
|
|
await api2.setSimulatorVariable("K:PAUSE_OFF", "number", 1);
|
|
}
|
|
);
|
|
var saveSystemsOptions = createAsyncThunk(
|
|
"plane/saveSystemsOptions",
|
|
async (_, thunkAPI) => {
|
|
const api2 = await lib();
|
|
const state = thunkAPI.getState();
|
|
const digitalStandby = state.plane.options.systems.digitalStandby ? 1 << 0 : 0;
|
|
const fuelDipstick = state.plane.options.systems.fuelDipstick ? 1 << 1 : 0;
|
|
const customSIDs = state.plane.options.systems.customSIDs ? 1 << 2 : 0;
|
|
const customSTARs = state.plane.options.systems.customSTARs ? 1 << 3 : 0;
|
|
const customAPPRs = state.plane.options.systems.customAPPRs ? 1 << 4 : 0;
|
|
const rcws = state.plane.options.systems.rcws ? 1 << 5 : 0;
|
|
const tapeDisplays = state.plane.options.systems.tapeDisplays ? 1 << 6 : 0;
|
|
const highDecelRateABS = state.plane.options.systems.highDecelRateABS ? 1 << 7 : 0;
|
|
const singleCueFD = state.plane.options.systems.singleCueFD ? 1 << 8 : 0;
|
|
const inhibitTireFailure = state.plane.options.systems.inhibitTireFailure ? 1 << 9 : 0;
|
|
const windVectorType = state.plane.options.systems.windVectorType === "vector" ? 1 << 10 : 0;
|
|
const wbs = state.plane.options.systems.wbs ? 1 << 11 : 0;
|
|
const automaticAntiIce = state.plane.options.systems.automaticAntiIce ? 1 << 12 : 0;
|
|
await Promise.all([
|
|
api2.setEFBVariable(
|
|
"OPTIONS_RAD_ALT_BEHAVIOR",
|
|
"number",
|
|
state.plane.options.systems.radAltBehavior
|
|
),
|
|
api2.setEFBVariable(
|
|
"OPTIONS_SYSTEMS",
|
|
"number",
|
|
digitalStandby | fuelDipstick | customSIDs | customSTARs | customAPPRs | rcws | tapeDisplays | highDecelRateABS | singleCueFD | inhibitTireFailure | windVectorType | wbs | automaticAntiIce
|
|
)
|
|
]);
|
|
await api2.triggerReadVariable([16 /* SystemOptions */]);
|
|
return state.plane;
|
|
}
|
|
);
|
|
var saveCAWSOptions = createAsyncThunk(
|
|
"plane/saveCAWSOptions",
|
|
async (_, thunkAPI) => {
|
|
const api2 = await lib();
|
|
const state = thunkAPI.getState();
|
|
const altAlertOnDepart = state.plane.options.caws.altAlertOnCapture ? 1 << 0 : 0;
|
|
const callout2500 = state.plane.options.caws.callout2500 ? 1 << 1 : 0;
|
|
const callout1000 = state.plane.options.caws.callout1000 ? 1 << 2 : 0;
|
|
const callout500 = state.plane.options.caws.callout500 ? 1 << 3 : 0;
|
|
const callout400 = state.plane.options.caws.callout400 ? 1 << 4 : 0;
|
|
const callout300 = state.plane.options.caws.callout300 ? 1 << 5 : 0;
|
|
const callout200 = state.plane.options.caws.callout200 ? 1 << 6 : 0;
|
|
const callout100 = state.plane.options.caws.callout100 ? 1 << 7 : 0;
|
|
const callout50onwards = state.plane.options.caws.callout50onwards ? 1 << 8 : 0;
|
|
await Promise.all([
|
|
api2.setEFBVariable(
|
|
"OPTIONS_ALT_ALERT_TYPE",
|
|
"number",
|
|
state.plane.options.caws.altAlertType
|
|
),
|
|
api2.setEFBVariable(
|
|
"OPTIONS_CAWS",
|
|
"number",
|
|
altAlertOnDepart | callout2500 | callout1000 | callout500 | callout400 | callout300 | callout200 | callout100 | callout50onwards
|
|
)
|
|
]);
|
|
await api2.triggerReadVariable([64 /* CAWSOptions */]);
|
|
return state.plane;
|
|
}
|
|
);
|
|
var savePerformanceOptions = createAsyncThunk(
|
|
"plane/savePerformanceOptions",
|
|
async (_, thunkAPI) => {
|
|
const api2 = await lib();
|
|
const state = thunkAPI.getState();
|
|
const deflectedAilerons = state.plane.options.performance.deflectedAilerons ? 1 << 0 : 0;
|
|
await Promise.all([
|
|
api2.setEFBVariable(
|
|
"OPTIONS_TO1_DERATE",
|
|
"number",
|
|
state.plane.options.performance.to1DeRate
|
|
),
|
|
api2.setEFBVariable(
|
|
"OPTIONS_TO2_DERATE",
|
|
"number",
|
|
state.plane.options.performance.to2DeRate
|
|
),
|
|
api2.setEFBVariable(
|
|
"OPTIONS_CLIMB1_DERATE",
|
|
"number",
|
|
state.plane.options.performance.cl1DeRate
|
|
),
|
|
api2.setEFBVariable(
|
|
"OPTIONS_CLIMB2_DERATE",
|
|
"number",
|
|
state.plane.options.performance.cl2DeRate
|
|
),
|
|
api2.setEFBVariable(
|
|
"OPTIONS_GA1_DERATE",
|
|
"number",
|
|
state.plane.options.performance.ga1DeRate
|
|
),
|
|
api2.setEFBVariable(
|
|
"OPTIONS_GA2_DERATE",
|
|
"number",
|
|
state.plane.options.performance.ga2DeRate
|
|
),
|
|
api2.setEFBVariable(
|
|
"OPTIONS_FUEL_CG_CONTROL",
|
|
"number",
|
|
state.plane.options.performance.fuelCGControl
|
|
),
|
|
api2.setEFBVariable(
|
|
"OPTIONS_FLAP_PYLON_PIP",
|
|
"number",
|
|
state.plane.options.performance.flapPylonPIP ? 1 : 0
|
|
),
|
|
api2.setEFBVariable(
|
|
"OPTIONS_PERFORMANCE",
|
|
"number",
|
|
deflectedAilerons
|
|
)
|
|
]);
|
|
await api2.triggerReadVariable([32 /* PerformanceOptions */]);
|
|
return state.plane;
|
|
}
|
|
);
|
|
var saveCommunicationOptions = createAsyncThunk(
|
|
"plane/saveCommunicationOptions",
|
|
async (_, thunkAPI) => {
|
|
const api2 = await lib();
|
|
const state = thunkAPI.getState();
|
|
await api2.setEFBVariable(
|
|
"OPTIONS_COMMUNICATION",
|
|
"number",
|
|
state.plane.options.communication.useHoppies ? 1 << 0 : 0
|
|
);
|
|
await api2.triggerReadVariable([256 /* CommunicationOptions */]);
|
|
return state.plane;
|
|
}
|
|
);
|
|
var saveBehaviourOptions = createAsyncThunk(
|
|
"plane/saveBehaviourOptions",
|
|
async (_, thunkAPI) => {
|
|
const api2 = await lib();
|
|
const state = thunkAPI.getState();
|
|
const allowHardwareOverforce = state.plane.options.behaviour.allowHardwareOverforce ? 1 << 0 : 0;
|
|
const automaticSeatbelt = state.plane.options.behaviour.automaticSeatbelt ? 1 << 1 : 0;
|
|
const parkBrakeBehaviour = state.plane.options.behaviour.parkBrakeBehaviour ? 1 << 2 : 0;
|
|
const minimumsSync = state.plane.options.behaviour.minimumsSync ? 1 << 3 : 0;
|
|
const scrollAcceleration = state.plane.options.behaviour.scrollAcceleration ? 1 << 4 : 0;
|
|
await Promise.all([
|
|
api2.setEFBVariable(
|
|
"OPTIONS_IRS_ALIGN",
|
|
"number",
|
|
state.plane.options.behaviour.irsAlignTime
|
|
),
|
|
api2.setEFBVariable(
|
|
"OPTIONS_BARO_SYNC",
|
|
"number",
|
|
state.plane.options.behaviour.baroSync
|
|
),
|
|
api2.setEFBVariable(
|
|
"OPTIONS_PHYSICAL_THROTTLE_POS",
|
|
"number",
|
|
state.plane.options.behaviour.showPhysicalThrottlePos
|
|
),
|
|
api2.setEFBVariable(
|
|
"OPTIONS_BEHAVIOUR",
|
|
"number",
|
|
allowHardwareOverforce | automaticSeatbelt | parkBrakeBehaviour | minimumsSync | scrollAcceleration
|
|
)
|
|
]);
|
|
await api2.triggerReadVariable([512 /* BehaviourOptions */]);
|
|
return state.plane;
|
|
}
|
|
);
|
|
var setPayload3 = createAsyncThunk(
|
|
"plane/setPayload",
|
|
async (action, thunkAPI) => {
|
|
const api2 = await lib();
|
|
const state = thunkAPI.getState();
|
|
if (action === null) {
|
|
return thunkAPI.dispatch(planeSlice.actions.resetPayload());
|
|
}
|
|
api2.setPayload({
|
|
payload: action.payload * (state.plane.options.general.weightUnits === "kgs" ? 2.20462262185 : 1),
|
|
zfw: action.zfw * (state.plane.options.general.weightUnits === "kgs" ? 2.20462262185 : 1),
|
|
gw: action.gw * (state.plane.options.general.weightUnits === "kgs" ? 2.20462262185 : 1),
|
|
fuel: action.fuel * (state.plane.options.general.weightUnits === "kgs" ? 2.20462262185 : 1),
|
|
load: action.load
|
|
});
|
|
return thunkAPI.dispatch(
|
|
planeSlice.actions.setInternalPayload({
|
|
payload: action.payload,
|
|
zfw: action.zfw,
|
|
gw: action.gw,
|
|
fuel: action.fuel,
|
|
load: action.load
|
|
})
|
|
);
|
|
}
|
|
);
|
|
var planeSlice = createSlice({
|
|
name: "plane",
|
|
initialState: initialState3,
|
|
reducers: {
|
|
setBrightness: (state, action) => {
|
|
state.brightness = action.payload.brightness;
|
|
},
|
|
setGeneralOptions: (state, action) => {
|
|
state.options.general = action.payload;
|
|
state = updateBoundaries(state);
|
|
},
|
|
setSystemsOptions: (state, action) => {
|
|
state.options.systems = action.payload;
|
|
},
|
|
setCAWSOptions: (state, action) => {
|
|
state.options.caws = action.payload;
|
|
},
|
|
setPerformanceOptions: (state, action) => {
|
|
state.options.performance = action.payload;
|
|
},
|
|
setCommunicationOptions: (state, action) => {
|
|
state.options.communication = action.payload;
|
|
},
|
|
setBehaviourOptions: (state, action) => {
|
|
state.options.behaviour = action.payload;
|
|
},
|
|
setInternalPayload: (state, action) => {
|
|
state.payload = action.payload;
|
|
},
|
|
resetPayload: (state) => {
|
|
state.payload = null;
|
|
}
|
|
},
|
|
extraReducers: (builder) => {
|
|
builder.addCase(getPlaneConfig.fulfilled, (state, action) => {
|
|
return updateBoundaries(action.payload);
|
|
});
|
|
}
|
|
});
|
|
var {
|
|
setGeneralOptions,
|
|
setSystemsOptions,
|
|
setBrightness,
|
|
setCAWSOptions,
|
|
setPerformanceOptions,
|
|
setCommunicationOptions,
|
|
setBehaviourOptions,
|
|
resetPayload
|
|
} = planeSlice.actions;
|
|
var plane_default = planeSlice.reducer;
|
|
|
|
// src/redux/slices/payload.ts
|
|
var initialState4 = {
|
|
selectedTab: 0,
|
|
input: {
|
|
zfw: 0,
|
|
passengers: 0,
|
|
cargo: 0,
|
|
fuel: 15e3,
|
|
weightPerPassenger: 79
|
|
}
|
|
};
|
|
var payloadSlice = createSlice({
|
|
name: "payload",
|
|
initialState: initialState4,
|
|
reducers: {
|
|
setSelectedTab: (state, action) => {
|
|
state.selectedTab = action.payload;
|
|
},
|
|
setInput: (state, action) => {
|
|
state.input = action.payload;
|
|
}
|
|
}
|
|
});
|
|
var { setSelectedTab, setInput } = payloadSlice.actions;
|
|
var payload_default = payloadSlice.reducer;
|
|
|
|
// src/redux/slices/router.ts
|
|
var initialState5 = {
|
|
toast: null,
|
|
timeout: 0,
|
|
route: {
|
|
path: "/dispatch"
|
|
}
|
|
};
|
|
var toastSlice = createSlice({
|
|
name: "toast",
|
|
initialState: initialState5,
|
|
reducers: {
|
|
setToast: (state, action) => {
|
|
state.toast = action.payload;
|
|
state.timeout = 5e3;
|
|
},
|
|
clearToast: (state) => {
|
|
state.toast = null;
|
|
state.timeout = 0;
|
|
},
|
|
setRoute: (state, action) => {
|
|
state.route = action.payload;
|
|
}
|
|
}
|
|
});
|
|
var { setToast, clearToast, setRoute } = toastSlice.actions;
|
|
var router_default = toastSlice.reducer;
|
|
|
|
// src/redux/slices/charts.ts
|
|
var initialState6 = {
|
|
chart: null,
|
|
icao: "",
|
|
tab: void 0,
|
|
chartList: null
|
|
};
|
|
var chartsSlice = createSlice({
|
|
name: "charts",
|
|
initialState: initialState6,
|
|
reducers: {
|
|
setChart: (state, action) => {
|
|
state.chart = action.payload;
|
|
},
|
|
setIcao: (state, action) => {
|
|
state.icao = action.payload;
|
|
},
|
|
setTab: (state, action) => {
|
|
state.tab = action.payload;
|
|
},
|
|
setChartList: (state, action) => {
|
|
state.chartList = action.payload;
|
|
}
|
|
}
|
|
});
|
|
var { setChart, setIcao, setTab, setChartList } = chartsSlice.actions;
|
|
var charts_default = chartsSlice.reducer;
|
|
|
|
// src/redux/slices/performance.ts
|
|
init_common();
|
|
|
|
// src/lib/interfaces/thrust.ts
|
|
var thrustSettings = [
|
|
{
|
|
value: 0 /* FLEX */,
|
|
label: "FLEX"
|
|
},
|
|
{
|
|
value: 1 /* TO */,
|
|
label: "TO"
|
|
},
|
|
{
|
|
value: 2 /* TO1 */,
|
|
label: "TO1"
|
|
},
|
|
{
|
|
value: 3 /* TO2 */,
|
|
label: "TO2"
|
|
}
|
|
];
|
|
|
|
// src/lib/interfaces/antiIce.ts
|
|
var antiIceSettings = [
|
|
{
|
|
value: 0 /* NONE */,
|
|
label: "NONE"
|
|
},
|
|
{
|
|
value: 1 /* ENGINE */,
|
|
label: "ENG"
|
|
},
|
|
{
|
|
value: 2 /* ENGINE_WING */,
|
|
label: "ENG + WING"
|
|
}
|
|
];
|
|
|
|
// src/lib/interfaces/autobrake.ts
|
|
var autobrakeSettings = [
|
|
{
|
|
value: 0 /* MIN */,
|
|
label: "MIN"
|
|
},
|
|
{
|
|
value: 1 /* MED */,
|
|
label: "MED"
|
|
},
|
|
{
|
|
value: 2 /* MAX */,
|
|
label: "MAX"
|
|
}
|
|
];
|
|
|
|
// src/lib/interfaces/reverseThrust.ts
|
|
var reverseThrustSettings = [
|
|
{
|
|
value: 0 /* ALL */,
|
|
label: "ALL"
|
|
},
|
|
{
|
|
value: 1 /* WING */,
|
|
label: "WING"
|
|
},
|
|
{
|
|
value: 2 /* TAIL */,
|
|
label: "TAIL"
|
|
},
|
|
{
|
|
value: 3 /* NONE */,
|
|
label: "NONE"
|
|
}
|
|
];
|
|
|
|
// src/redux/slices/performance.ts
|
|
var airportData = [];
|
|
var runwayData = [];
|
|
var initialState7 = {
|
|
departure: {
|
|
icao: "",
|
|
selectedRunwayID: 0,
|
|
weather: {
|
|
windString: "",
|
|
windDirection: -1,
|
|
windSpeed: -1,
|
|
temperature: NaN,
|
|
pressure: NaN
|
|
},
|
|
performance: {
|
|
v1: -1,
|
|
vr: -1,
|
|
v2: -1,
|
|
flex: -999,
|
|
flaps: 0
|
|
},
|
|
tow: -1,
|
|
specificFlapString: "",
|
|
thrustSetting: 0 /* FLEX */,
|
|
antiIce: 0 /* NONE */,
|
|
flapsSetting: 0 /* OPTIMUM */,
|
|
packs: false
|
|
},
|
|
arrival: {
|
|
icao: "",
|
|
selectedRunwayID: 0,
|
|
weather: {
|
|
windString: "",
|
|
windDirection: -1,
|
|
windSpeed: -1,
|
|
temperature: NaN,
|
|
pressure: NaN
|
|
},
|
|
lw: -1,
|
|
autobrake: 0 /* MIN */,
|
|
reversers: 3 /* NONE */,
|
|
flaps50: false,
|
|
performance: {
|
|
vapp: NaN,
|
|
vref: NaN
|
|
},
|
|
decelDistance: -1,
|
|
canLand: true
|
|
}
|
|
};
|
|
var performanceSlice = createSlice({
|
|
name: "performance",
|
|
initialState: initialState7,
|
|
reducers: {
|
|
setDeparture(state, action) {
|
|
state.departure = action.payload;
|
|
state.departure.performance = initialState7.departure.performance;
|
|
},
|
|
setDepartureAirport(state, action) {
|
|
state.departure.icao = action.payload.icao;
|
|
state.departure.airport = action.payload;
|
|
},
|
|
fetchDepartureAirport: (state) => {
|
|
if (simulator() === 0 /* MSFS */) {
|
|
Coherent.call(
|
|
"COMM_BUS_WASM_CALLBACK",
|
|
"requestAirport",
|
|
"D:" + state.departure.icao
|
|
);
|
|
} else {
|
|
const airport = airportData.find(
|
|
(airport2) => airport2.ICAO === state.departure.icao
|
|
);
|
|
if (airport) {
|
|
const runways = runwayData.filter(
|
|
(runway) => runway.AirportID === airport.ID
|
|
);
|
|
state.departure.airport = {
|
|
icao: airport.ICAO,
|
|
elevation: airport.Elevation,
|
|
runways: runways.map((runway) => {
|
|
return {
|
|
id: runway.ID,
|
|
ident: runway.Ident,
|
|
trueHeading: runway.TrueHeading,
|
|
length: runway.Length,
|
|
slope: 0
|
|
};
|
|
})
|
|
};
|
|
}
|
|
}
|
|
},
|
|
setDeparturePerformance(state, action) {
|
|
state.departure.performance = action.payload;
|
|
},
|
|
setArrival(state, action) {
|
|
state.arrival = action.payload;
|
|
state.arrival.performance = initialState7.arrival.performance;
|
|
state.arrival.decelDistance = initialState7.arrival.decelDistance;
|
|
state.arrival.canLand = initialState7.arrival.canLand;
|
|
},
|
|
setArrivalAirport(state, action) {
|
|
state.arrival.icao = action.payload.icao;
|
|
state.arrival.airport = action.payload;
|
|
},
|
|
fetchArrivalAirport: (state) => {
|
|
if (simulator() === 0 /* MSFS */) {
|
|
Coherent.call(
|
|
"COMM_BUS_WASM_CALLBACK",
|
|
"requestAirport",
|
|
"A:" + state.arrival.icao
|
|
);
|
|
} else {
|
|
const airport = airportData.find(
|
|
(airport2) => airport2.ICAO === state.arrival.icao
|
|
);
|
|
if (airport) {
|
|
const runways = runwayData.filter(
|
|
(runway) => runway.AirportID === airport.ID
|
|
);
|
|
state.arrival.airport = {
|
|
icao: airport.ICAO,
|
|
elevation: airport.Elevation,
|
|
runways: runways.map((runway) => {
|
|
return {
|
|
id: runway.ID,
|
|
ident: runway.Ident,
|
|
trueHeading: runway.TrueHeading,
|
|
length: runway.Length,
|
|
slope: 0
|
|
};
|
|
})
|
|
};
|
|
}
|
|
}
|
|
},
|
|
setArrivalPerformance(state, action) {
|
|
state.arrival.performance = action.payload;
|
|
},
|
|
setArrivalDecelAndLand(state, action) {
|
|
state.arrival.decelDistance = action.payload.decelDistance;
|
|
state.arrival.canLand = action.payload.canLand;
|
|
}
|
|
}
|
|
});
|
|
var {
|
|
setDeparture,
|
|
setDepartureAirport,
|
|
fetchDepartureAirport,
|
|
setDeparturePerformance,
|
|
setArrival,
|
|
setArrivalAirport,
|
|
fetchArrivalAirport,
|
|
setArrivalPerformance,
|
|
setArrivalDecelAndLand
|
|
} = performanceSlice.actions;
|
|
var performance_default = performanceSlice.reducer;
|
|
|
|
// src/redux/slices/navigraph.ts
|
|
init_common();
|
|
var navigraphSlice = createSlice({
|
|
name: "navigraph",
|
|
initialState: {
|
|
NAVIGRAPH_SDK_INIT: "",
|
|
NAVIGRAPH_REFRESH_TOKEN: "",
|
|
NAVIGRAPH_ACCESS_TOKEN: ""
|
|
},
|
|
reducers: {
|
|
setNavigraphSDKInit: (state, action) => {
|
|
state.NAVIGRAPH_SDK_INIT = action.payload;
|
|
if (simulator() === 0 /* MSFS */) {
|
|
Coherent.call(
|
|
"COMM_BUS_WASM_CALLBACK",
|
|
"saveNavigraphSDKInit",
|
|
action.payload
|
|
);
|
|
} else if (typeof localStorage !== "undefined") {
|
|
localStorage.setItem("NAVIGRAPH_SDK_INIT", action.payload);
|
|
}
|
|
},
|
|
setNavigraphRefreshToken: (state, action) => {
|
|
state.NAVIGRAPH_REFRESH_TOKEN = action.payload;
|
|
if (simulator() === 0 /* MSFS */) {
|
|
Coherent.call(
|
|
"COMM_BUS_WASM_CALLBACK",
|
|
"saveNavigraphRefreshToken",
|
|
action.payload
|
|
);
|
|
} else if (typeof localStorage !== "undefined") {
|
|
localStorage.setItem("NAVIGRAPH_REFRESH_TOKEN", action.payload);
|
|
}
|
|
},
|
|
setNavigraphAccessToken: (state, action) => {
|
|
state.NAVIGRAPH_ACCESS_TOKEN = action.payload;
|
|
if (simulator() === 0 /* MSFS */) {
|
|
Coherent.call(
|
|
"COMM_BUS_WASM_CALLBACK",
|
|
"saveNavigraphAccessToken",
|
|
action.payload
|
|
);
|
|
} else if (typeof localStorage !== "undefined") {
|
|
localStorage.setItem("NAVIGRAPH_ACCESS_TOKEN", action.payload);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
var {
|
|
setNavigraphSDKInit,
|
|
setNavigraphRefreshToken,
|
|
setNavigraphAccessToken
|
|
} = navigraphSlice.actions;
|
|
var navigraph_default = navigraphSlice.reducer;
|
|
|
|
// src/redux/slices/sayintentions.ts
|
|
init_common();
|
|
var initialState8 = {
|
|
code: ""
|
|
};
|
|
var sayIntentionsSlice = createSlice({
|
|
name: "sayIntentions",
|
|
initialState: initialState8,
|
|
reducers: {
|
|
setCode: (state, action) => {
|
|
state.code = action.payload;
|
|
},
|
|
saveCode: (state) => {
|
|
if (simulator() === 0 /* MSFS */) {
|
|
Coherent.call(
|
|
"COMM_BUS_WASM_CALLBACK",
|
|
"saveSayIntentionsCode",
|
|
state.code
|
|
);
|
|
}
|
|
localStorage.setItem("sayIntentionsCode", state.code);
|
|
}
|
|
}
|
|
});
|
|
var { setCode: setCode2, saveCode: saveCode2 } = sayIntentionsSlice.actions;
|
|
var sayintentions_default = sayIntentionsSlice.reducer;
|
|
|
|
// src/redux/store.ts
|
|
var store = configureStore({
|
|
reducer: {
|
|
simbrief: simbrief_default,
|
|
hoppies: hoppies_default,
|
|
plane: plane_default,
|
|
payload: payload_default,
|
|
router: router_default,
|
|
sayIntentions: sayintentions_default,
|
|
charts: charts_default,
|
|
performance: performance_default,
|
|
navigraph: navigraph_default
|
|
}
|
|
});
|
|
|
|
// node_modules/react-redux/dist/react-redux.mjs
|
|
var React2 = __toESM(require_react(), 1);
|
|
var import_with_selector = __toESM(require_with_selector(), 1);
|
|
var ReactOriginal = __toESM(require_react(), 1);
|
|
var React = "default" in ReactOriginal ? ReactOriginal["default"] : ReactOriginal;
|
|
var ContextKey = Symbol.for(`react-redux-context`);
|
|
var gT = typeof globalThis !== "undefined" ? globalThis : {};
|
|
function getContext() {
|
|
var _a;
|
|
if (!React.createContext)
|
|
return {};
|
|
const contextMap = (_a = gT[ContextKey]) != null ? _a : gT[ContextKey] = /* @__PURE__ */ new Map();
|
|
let realContext = contextMap.get(React.createContext);
|
|
if (!realContext) {
|
|
realContext = React.createContext(
|
|
null
|
|
);
|
|
if (true) {
|
|
realContext.displayName = "ReactRedux";
|
|
}
|
|
contextMap.set(React.createContext, realContext);
|
|
}
|
|
return realContext;
|
|
}
|
|
var ReactReduxContext = /* @__PURE__ */ getContext();
|
|
var notInitialized = () => {
|
|
throw new Error("uSES not initialized!");
|
|
};
|
|
function createReduxContextHook(context = ReactReduxContext) {
|
|
return function useReduxContext2() {
|
|
const contextValue = React.useContext(context);
|
|
if (!contextValue) {
|
|
throw new Error(
|
|
"could not find react-redux context value; please ensure the component is wrapped in a <Provider>"
|
|
);
|
|
}
|
|
return contextValue;
|
|
};
|
|
}
|
|
var useReduxContext = /* @__PURE__ */ createReduxContextHook();
|
|
var useSyncExternalStoreWithSelector = notInitialized;
|
|
var initializeUseSelector = (fn) => {
|
|
useSyncExternalStoreWithSelector = fn;
|
|
};
|
|
var refEquality = (a, b) => a === b;
|
|
function createSelectorHook(context = ReactReduxContext) {
|
|
const useReduxContext2 = context === ReactReduxContext ? useReduxContext : createReduxContextHook(context);
|
|
const useSelector2 = (selector, equalityFnOrOptions = {}) => {
|
|
const { equalityFn = refEquality, devModeChecks = {} } = typeof equalityFnOrOptions === "function" ? { equalityFn: equalityFnOrOptions } : equalityFnOrOptions;
|
|
if (true) {
|
|
if (!selector) {
|
|
throw new Error(`You must pass a selector to useSelector`);
|
|
}
|
|
if (typeof selector !== "function") {
|
|
throw new Error(`You must pass a function as a selector to useSelector`);
|
|
}
|
|
if (typeof equalityFn !== "function") {
|
|
throw new Error(
|
|
`You must pass a function as an equality function to useSelector`
|
|
);
|
|
}
|
|
}
|
|
const {
|
|
store: store2,
|
|
subscription,
|
|
getServerState,
|
|
stabilityCheck,
|
|
identityFunctionCheck
|
|
} = useReduxContext2();
|
|
const firstRun = React.useRef(true);
|
|
const wrappedSelector = React.useCallback(
|
|
{
|
|
[selector.name](state) {
|
|
const selected = selector(state);
|
|
if (true) {
|
|
const {
|
|
identityFunctionCheck: finalIdentityFunctionCheck,
|
|
stabilityCheck: finalStabilityCheck
|
|
} = __spreadValues({
|
|
stabilityCheck,
|
|
identityFunctionCheck
|
|
}, devModeChecks);
|
|
if (finalStabilityCheck === "always" || finalStabilityCheck === "once" && firstRun.current) {
|
|
const toCompare = selector(state);
|
|
if (!equalityFn(selected, toCompare)) {
|
|
let stack = void 0;
|
|
try {
|
|
throw new Error();
|
|
} catch (e) {
|
|
;
|
|
({ stack } = e);
|
|
}
|
|
console.warn(
|
|
"Selector " + (selector.name || "unknown") + " returned a different result when called with the same parameters. This can lead to unnecessary rerenders.\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization",
|
|
{
|
|
state,
|
|
selected,
|
|
selected2: toCompare,
|
|
stack
|
|
}
|
|
);
|
|
}
|
|
}
|
|
if (finalIdentityFunctionCheck === "always" || finalIdentityFunctionCheck === "once" && firstRun.current) {
|
|
if (selected === state) {
|
|
let stack = void 0;
|
|
try {
|
|
throw new Error();
|
|
} catch (e) {
|
|
;
|
|
({ stack } = e);
|
|
}
|
|
console.warn(
|
|
"Selector " + (selector.name || "unknown") + " returned the root state when called. This can lead to unnecessary rerenders.\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.",
|
|
{ stack }
|
|
);
|
|
}
|
|
}
|
|
if (firstRun.current)
|
|
firstRun.current = false;
|
|
}
|
|
return selected;
|
|
}
|
|
}[selector.name],
|
|
[selector, stabilityCheck, devModeChecks.stabilityCheck]
|
|
);
|
|
const selectedState = useSyncExternalStoreWithSelector(
|
|
subscription.addNestedSub,
|
|
store2.getState,
|
|
getServerState || store2.getState,
|
|
wrappedSelector,
|
|
equalityFn
|
|
);
|
|
React.useDebugValue(selectedState);
|
|
return selectedState;
|
|
};
|
|
Object.assign(useSelector2, {
|
|
withTypes: () => useSelector2
|
|
});
|
|
return useSelector2;
|
|
}
|
|
var useSelector = /* @__PURE__ */ createSelectorHook();
|
|
var REACT_ELEMENT_TYPE = Symbol.for("react.element");
|
|
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
|
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
var REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode");
|
|
var REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
var REACT_PROVIDER_TYPE = Symbol.for("react.provider");
|
|
var REACT_CONTEXT_TYPE = Symbol.for("react.context");
|
|
var REACT_SERVER_CONTEXT_TYPE = Symbol.for("react.server_context");
|
|
var REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
|
var REACT_SUSPENSE_TYPE = Symbol.for("react.suspense");
|
|
var REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list");
|
|
var REACT_MEMO_TYPE = Symbol.for("react.memo");
|
|
var REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
var REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen");
|
|
var REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
|
|
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
var Memo = REACT_MEMO_TYPE;
|
|
function defaultNoopBatch(callback) {
|
|
callback();
|
|
}
|
|
function createListenerCollection() {
|
|
let first = null;
|
|
let last = null;
|
|
return {
|
|
clear() {
|
|
first = null;
|
|
last = null;
|
|
},
|
|
notify() {
|
|
defaultNoopBatch(() => {
|
|
let listener4 = first;
|
|
while (listener4) {
|
|
listener4.callback();
|
|
listener4 = listener4.next;
|
|
}
|
|
});
|
|
},
|
|
get() {
|
|
const listeners = [];
|
|
let listener4 = first;
|
|
while (listener4) {
|
|
listeners.push(listener4);
|
|
listener4 = listener4.next;
|
|
}
|
|
return listeners;
|
|
},
|
|
subscribe(callback) {
|
|
let isSubscribed = true;
|
|
const listener4 = last = {
|
|
callback,
|
|
next: null,
|
|
prev: last
|
|
};
|
|
if (listener4.prev) {
|
|
listener4.prev.next = listener4;
|
|
} else {
|
|
first = listener4;
|
|
}
|
|
return function unsubscribe() {
|
|
if (!isSubscribed || first === null)
|
|
return;
|
|
isSubscribed = false;
|
|
if (listener4.next) {
|
|
listener4.next.prev = listener4.prev;
|
|
} else {
|
|
last = listener4.prev;
|
|
}
|
|
if (listener4.prev) {
|
|
listener4.prev.next = listener4.next;
|
|
} else {
|
|
first = listener4.next;
|
|
}
|
|
};
|
|
}
|
|
};
|
|
}
|
|
var nullListeners = {
|
|
notify() {
|
|
},
|
|
get: () => []
|
|
};
|
|
function createSubscription(store2, parentSub) {
|
|
let unsubscribe;
|
|
let listeners = nullListeners;
|
|
let subscriptionsAmount = 0;
|
|
let selfSubscribed = false;
|
|
function addNestedSub(listener4) {
|
|
trySubscribe();
|
|
const cleanupListener = listeners.subscribe(listener4);
|
|
let removed = false;
|
|
return () => {
|
|
if (!removed) {
|
|
removed = true;
|
|
cleanupListener();
|
|
tryUnsubscribe();
|
|
}
|
|
};
|
|
}
|
|
function notifyNestedSubs() {
|
|
listeners.notify();
|
|
}
|
|
function handleChangeWrapper() {
|
|
if (subscription.onStateChange) {
|
|
subscription.onStateChange();
|
|
}
|
|
}
|
|
function isSubscribed() {
|
|
return selfSubscribed;
|
|
}
|
|
function trySubscribe() {
|
|
subscriptionsAmount++;
|
|
if (!unsubscribe) {
|
|
unsubscribe = parentSub ? parentSub.addNestedSub(handleChangeWrapper) : store2.subscribe(handleChangeWrapper);
|
|
listeners = createListenerCollection();
|
|
}
|
|
}
|
|
function tryUnsubscribe() {
|
|
subscriptionsAmount--;
|
|
if (unsubscribe && subscriptionsAmount === 0) {
|
|
unsubscribe();
|
|
unsubscribe = void 0;
|
|
listeners.clear();
|
|
listeners = nullListeners;
|
|
}
|
|
}
|
|
function trySubscribeSelf() {
|
|
if (!selfSubscribed) {
|
|
selfSubscribed = true;
|
|
trySubscribe();
|
|
}
|
|
}
|
|
function tryUnsubscribeSelf() {
|
|
if (selfSubscribed) {
|
|
selfSubscribed = false;
|
|
tryUnsubscribe();
|
|
}
|
|
}
|
|
const subscription = {
|
|
addNestedSub,
|
|
notifyNestedSubs,
|
|
handleChangeWrapper,
|
|
isSubscribed,
|
|
trySubscribe: trySubscribeSelf,
|
|
tryUnsubscribe: tryUnsubscribeSelf,
|
|
getListeners: () => listeners
|
|
};
|
|
return subscription;
|
|
}
|
|
var canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
|
|
var isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
var useIsomorphicLayoutEffect = canUseDOM || isReactNative ? React.useLayoutEffect : React.useEffect;
|
|
var FORWARD_REF_STATICS = {
|
|
$$typeof: true,
|
|
render: true,
|
|
defaultProps: true,
|
|
displayName: true,
|
|
propTypes: true
|
|
};
|
|
var MEMO_STATICS = {
|
|
$$typeof: true,
|
|
compare: true,
|
|
defaultProps: true,
|
|
displayName: true,
|
|
propTypes: true,
|
|
type: true
|
|
};
|
|
var TYPE_STATICS = {
|
|
[ForwardRef]: FORWARD_REF_STATICS,
|
|
[Memo]: MEMO_STATICS
|
|
};
|
|
var objectPrototype = Object.prototype;
|
|
var useSyncExternalStore2 = notInitialized;
|
|
var initializeConnect = (fn) => {
|
|
useSyncExternalStore2 = fn;
|
|
};
|
|
function Provider({
|
|
store: store2,
|
|
context,
|
|
children,
|
|
serverState,
|
|
stabilityCheck = "once",
|
|
identityFunctionCheck = "once"
|
|
}) {
|
|
const contextValue = React.useMemo(() => {
|
|
const subscription = createSubscription(store2);
|
|
return {
|
|
store: store2,
|
|
subscription,
|
|
getServerState: serverState ? () => serverState : void 0,
|
|
stabilityCheck,
|
|
identityFunctionCheck
|
|
};
|
|
}, [store2, serverState, stabilityCheck, identityFunctionCheck]);
|
|
const previousState = React.useMemo(() => store2.getState(), [store2]);
|
|
useIsomorphicLayoutEffect(() => {
|
|
const { subscription } = contextValue;
|
|
subscription.onStateChange = subscription.notifyNestedSubs;
|
|
subscription.trySubscribe();
|
|
if (previousState !== store2.getState()) {
|
|
subscription.notifyNestedSubs();
|
|
}
|
|
return () => {
|
|
subscription.tryUnsubscribe();
|
|
subscription.onStateChange = void 0;
|
|
};
|
|
}, [contextValue, previousState]);
|
|
const Context = context || ReactReduxContext;
|
|
return /* @__PURE__ */ React.createElement(Context.Provider, { value: contextValue }, children);
|
|
}
|
|
var Provider_default = Provider;
|
|
function createStoreHook(context = ReactReduxContext) {
|
|
const useReduxContext2 = context === ReactReduxContext ? useReduxContext : createReduxContextHook(context);
|
|
const useStore2 = () => {
|
|
const { store: store2 } = useReduxContext2();
|
|
return store2;
|
|
};
|
|
Object.assign(useStore2, {
|
|
withTypes: () => useStore2
|
|
});
|
|
return useStore2;
|
|
}
|
|
var useStore = /* @__PURE__ */ createStoreHook();
|
|
function createDispatchHook(context = ReactReduxContext) {
|
|
const useStore2 = context === ReactReduxContext ? useStore : createStoreHook(context);
|
|
const useDispatch2 = () => {
|
|
const store2 = useStore2();
|
|
return store2.dispatch;
|
|
};
|
|
Object.assign(useDispatch2, {
|
|
withTypes: () => useDispatch2
|
|
});
|
|
return useDispatch2;
|
|
}
|
|
var useDispatch = /* @__PURE__ */ createDispatchHook();
|
|
initializeUseSelector(import_with_selector.useSyncExternalStoreWithSelector);
|
|
initializeConnect(React2.useSyncExternalStore);
|
|
|
|
// node_modules/react-error-boundary/dist/react-error-boundary.cjs.mjs
|
|
var import_react_error_boundary_cjs = __toESM(require_react_error_boundary_cjs(), 1);
|
|
|
|
// node_modules/abortcontroller-polyfill/dist/polyfill-patch-fetch.js
|
|
(function(factory) {
|
|
typeof define === "function" && define.amd ? define(factory) : factory();
|
|
})(function() {
|
|
"use strict";
|
|
function _classCallCheck2(instance, Constructor) {
|
|
if (!(instance instanceof Constructor)) {
|
|
throw new TypeError("Cannot call a class as a function");
|
|
}
|
|
}
|
|
function _defineProperties2(target, props) {
|
|
for (var i = 0; i < props.length; i++) {
|
|
var descriptor = props[i];
|
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
descriptor.configurable = true;
|
|
if ("value" in descriptor)
|
|
descriptor.writable = true;
|
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
}
|
|
}
|
|
function _createClass2(Constructor, protoProps, staticProps) {
|
|
if (protoProps)
|
|
_defineProperties2(Constructor.prototype, protoProps);
|
|
if (staticProps)
|
|
_defineProperties2(Constructor, staticProps);
|
|
Object.defineProperty(Constructor, "prototype", {
|
|
writable: false
|
|
});
|
|
return Constructor;
|
|
}
|
|
function _inherits(subClass, superClass) {
|
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
throw new TypeError("Super expression must either be null or a function");
|
|
}
|
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
constructor: {
|
|
value: subClass,
|
|
writable: true,
|
|
configurable: true
|
|
}
|
|
});
|
|
Object.defineProperty(subClass, "prototype", {
|
|
writable: false
|
|
});
|
|
if (superClass)
|
|
_setPrototypeOf(subClass, superClass);
|
|
}
|
|
function _getPrototypeOf(o) {
|
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
|
|
return o2.__proto__ || Object.getPrototypeOf(o2);
|
|
};
|
|
return _getPrototypeOf(o);
|
|
}
|
|
function _setPrototypeOf(o, p2) {
|
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p3) {
|
|
o2.__proto__ = p3;
|
|
return o2;
|
|
};
|
|
return _setPrototypeOf(o, p2);
|
|
}
|
|
function _isNativeReflectConstruct() {
|
|
if (typeof Reflect === "undefined" || !Reflect.construct)
|
|
return false;
|
|
if (Reflect.construct.sham)
|
|
return false;
|
|
if (typeof Proxy === "function")
|
|
return true;
|
|
try {
|
|
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
}));
|
|
return true;
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
function _assertThisInitialized(self2) {
|
|
if (self2 === void 0) {
|
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
}
|
|
return self2;
|
|
}
|
|
function _possibleConstructorReturn(self2, call) {
|
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
return call;
|
|
} else if (call !== void 0) {
|
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
}
|
|
return _assertThisInitialized(self2);
|
|
}
|
|
function _createSuper(Derived) {
|
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
return function _createSuperInternal() {
|
|
var Super = _getPrototypeOf(Derived), result;
|
|
if (hasNativeReflectConstruct) {
|
|
var NewTarget = _getPrototypeOf(this).constructor;
|
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
} else {
|
|
result = Super.apply(this, arguments);
|
|
}
|
|
return _possibleConstructorReturn(this, result);
|
|
};
|
|
}
|
|
function _superPropBase(object, property) {
|
|
while (!Object.prototype.hasOwnProperty.call(object, property)) {
|
|
object = _getPrototypeOf(object);
|
|
if (object === null)
|
|
break;
|
|
}
|
|
return object;
|
|
}
|
|
function _get() {
|
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
_get = Reflect.get.bind();
|
|
} else {
|
|
_get = function _get2(target, property, receiver) {
|
|
var base = _superPropBase(target, property);
|
|
if (!base)
|
|
return;
|
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
if (desc.get) {
|
|
return desc.get.call(arguments.length < 3 ? target : receiver);
|
|
}
|
|
return desc.value;
|
|
};
|
|
}
|
|
return _get.apply(this, arguments);
|
|
}
|
|
var Emitter = /* @__PURE__ */ function() {
|
|
function Emitter2() {
|
|
_classCallCheck2(this, Emitter2);
|
|
Object.defineProperty(this, "listeners", {
|
|
value: {},
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
}
|
|
_createClass2(Emitter2, [{
|
|
key: "addEventListener",
|
|
value: function addEventListener(type, callback, options) {
|
|
if (!(type in this.listeners)) {
|
|
this.listeners[type] = [];
|
|
}
|
|
this.listeners[type].push({
|
|
callback,
|
|
options
|
|
});
|
|
}
|
|
}, {
|
|
key: "removeEventListener",
|
|
value: function removeEventListener(type, callback) {
|
|
if (!(type in this.listeners)) {
|
|
return;
|
|
}
|
|
var stack = this.listeners[type];
|
|
for (var i = 0, l = stack.length; i < l; i++) {
|
|
if (stack[i].callback === callback) {
|
|
stack.splice(i, 1);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
key: "dispatchEvent",
|
|
value: function dispatchEvent(event) {
|
|
if (!(event.type in this.listeners)) {
|
|
return;
|
|
}
|
|
var stack = this.listeners[event.type];
|
|
var stackToCall = stack.slice();
|
|
for (var i = 0, l = stackToCall.length; i < l; i++) {
|
|
var listener4 = stackToCall[i];
|
|
try {
|
|
listener4.callback.call(this, event);
|
|
} catch (e) {
|
|
Promise.resolve().then(function() {
|
|
throw e;
|
|
});
|
|
}
|
|
if (listener4.options && listener4.options.once) {
|
|
this.removeEventListener(event.type, listener4.callback);
|
|
}
|
|
}
|
|
return !event.defaultPrevented;
|
|
}
|
|
}]);
|
|
return Emitter2;
|
|
}();
|
|
var AbortSignal = /* @__PURE__ */ function(_Emitter) {
|
|
_inherits(AbortSignal2, _Emitter);
|
|
var _super = _createSuper(AbortSignal2);
|
|
function AbortSignal2() {
|
|
var _this;
|
|
_classCallCheck2(this, AbortSignal2);
|
|
_this = _super.call(this);
|
|
if (!_this.listeners) {
|
|
Emitter.call(_assertThisInitialized(_this));
|
|
}
|
|
Object.defineProperty(_assertThisInitialized(_this), "aborted", {
|
|
value: false,
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
Object.defineProperty(_assertThisInitialized(_this), "onabort", {
|
|
value: null,
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
Object.defineProperty(_assertThisInitialized(_this), "reason", {
|
|
value: void 0,
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
return _this;
|
|
}
|
|
_createClass2(AbortSignal2, [{
|
|
key: "toString",
|
|
value: function toString3() {
|
|
return "[object AbortSignal]";
|
|
}
|
|
}, {
|
|
key: "dispatchEvent",
|
|
value: function dispatchEvent(event) {
|
|
if (event.type === "abort") {
|
|
this.aborted = true;
|
|
if (typeof this.onabort === "function") {
|
|
this.onabort.call(this, event);
|
|
}
|
|
}
|
|
_get(_getPrototypeOf(AbortSignal2.prototype), "dispatchEvent", this).call(this, event);
|
|
}
|
|
}]);
|
|
return AbortSignal2;
|
|
}(Emitter);
|
|
var AbortController2 = /* @__PURE__ */ function() {
|
|
function AbortController3() {
|
|
_classCallCheck2(this, AbortController3);
|
|
Object.defineProperty(this, "signal", {
|
|
value: new AbortSignal(),
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
}
|
|
_createClass2(AbortController3, [{
|
|
key: "abort",
|
|
value: function abort(reason) {
|
|
var event;
|
|
try {
|
|
event = new Event("abort");
|
|
} catch (e) {
|
|
if (typeof document !== "undefined") {
|
|
if (!document.createEvent) {
|
|
event = document.createEventObject();
|
|
event.type = "abort";
|
|
} else {
|
|
event = document.createEvent("Event");
|
|
event.initEvent("abort", false, false);
|
|
}
|
|
} else {
|
|
event = {
|
|
type: "abort",
|
|
bubbles: false,
|
|
cancelable: false
|
|
};
|
|
}
|
|
}
|
|
var signalReason = reason;
|
|
if (signalReason === void 0) {
|
|
if (typeof document === "undefined") {
|
|
signalReason = new Error("This operation was aborted");
|
|
signalReason.name = "AbortError";
|
|
} else {
|
|
try {
|
|
signalReason = new DOMException("signal is aborted without reason");
|
|
} catch (err) {
|
|
signalReason = new Error("This operation was aborted");
|
|
signalReason.name = "AbortError";
|
|
}
|
|
}
|
|
}
|
|
this.signal.reason = signalReason;
|
|
this.signal.dispatchEvent(event);
|
|
}
|
|
}, {
|
|
key: "toString",
|
|
value: function toString3() {
|
|
return "[object AbortController]";
|
|
}
|
|
}]);
|
|
return AbortController3;
|
|
}();
|
|
if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
|
|
AbortController2.prototype[Symbol.toStringTag] = "AbortController";
|
|
AbortSignal.prototype[Symbol.toStringTag] = "AbortSignal";
|
|
}
|
|
function polyfillNeeded(self2) {
|
|
if (self2.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
|
|
console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill");
|
|
return true;
|
|
}
|
|
return typeof self2.Request === "function" && !self2.Request.prototype.hasOwnProperty("signal") || !self2.AbortController;
|
|
}
|
|
function abortableFetchDecorator(patchTargets) {
|
|
if ("function" === typeof patchTargets) {
|
|
patchTargets = {
|
|
fetch: patchTargets
|
|
};
|
|
}
|
|
var _patchTargets = patchTargets, fetch = _patchTargets.fetch, _patchTargets$Request = _patchTargets.Request, NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request, NativeAbortController = _patchTargets.AbortController, _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL, __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;
|
|
if (!polyfillNeeded({
|
|
fetch,
|
|
Request: NativeRequest,
|
|
AbortController: NativeAbortController,
|
|
__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL
|
|
})) {
|
|
return {
|
|
fetch,
|
|
Request
|
|
};
|
|
}
|
|
var Request = NativeRequest;
|
|
if (Request && !Request.prototype.hasOwnProperty("signal") || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
|
|
Request = function Request2(input, init) {
|
|
var signal;
|
|
if (init && init.signal) {
|
|
signal = init.signal;
|
|
delete init.signal;
|
|
}
|
|
var request = new NativeRequest(input, init);
|
|
if (signal) {
|
|
Object.defineProperty(request, "signal", {
|
|
writable: false,
|
|
enumerable: false,
|
|
configurable: true,
|
|
value: signal
|
|
});
|
|
}
|
|
return request;
|
|
};
|
|
Request.prototype = NativeRequest.prototype;
|
|
}
|
|
var realFetch = fetch;
|
|
var abortableFetch = function abortableFetch2(input, init) {
|
|
var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : void 0;
|
|
if (signal) {
|
|
var abortError;
|
|
try {
|
|
abortError = new DOMException("Aborted", "AbortError");
|
|
} catch (err) {
|
|
abortError = new Error("Aborted");
|
|
abortError.name = "AbortError";
|
|
}
|
|
if (signal.aborted) {
|
|
return Promise.reject(abortError);
|
|
}
|
|
var cancellation = new Promise(function(_, reject) {
|
|
signal.addEventListener("abort", function() {
|
|
return reject(abortError);
|
|
}, {
|
|
once: true
|
|
});
|
|
});
|
|
if (init && init.signal) {
|
|
delete init.signal;
|
|
}
|
|
return Promise.race([cancellation, realFetch(input, init)]);
|
|
}
|
|
return realFetch(input, init);
|
|
};
|
|
return {
|
|
fetch: abortableFetch,
|
|
Request
|
|
};
|
|
}
|
|
(function(self2) {
|
|
if (!polyfillNeeded(self2)) {
|
|
return;
|
|
}
|
|
if (!self2.fetch) {
|
|
console.warn("fetch() is not available, cannot install abortcontroller-polyfill");
|
|
return;
|
|
}
|
|
var _abortableFetch = abortableFetchDecorator(self2), fetch = _abortableFetch.fetch, Request = _abortableFetch.Request;
|
|
self2.fetch = fetch;
|
|
self2.Request = Request;
|
|
Object.defineProperty(self2, "AbortController", {
|
|
writable: true,
|
|
enumerable: false,
|
|
configurable: true,
|
|
value: AbortController2
|
|
});
|
|
Object.defineProperty(self2, "AbortSignal", {
|
|
writable: true,
|
|
enumerable: false,
|
|
configurable: true,
|
|
value: AbortSignal
|
|
});
|
|
})(typeof self !== "undefined" ? self : global);
|
|
});
|
|
|
|
// src/components/Router.tsx
|
|
var import_react15 = __toESM(require_react());
|
|
|
|
// node_modules/@fortawesome/pro-solid-svg-icons/index.mjs
|
|
var faPlaneTail = {
|
|
prefix: "fas",
|
|
iconName: "plane-tail",
|
|
icon: [512, 512, [], "e22c", "M61.5 308.8L.8 39C-3.7 19 11.5 0 32 0h76.9c17.3 0 33.9 7 46 19.5L384 256H488h24v24 24V464v24 24H488 267.7c-10.7 0-21.2-1.9-31.2-5.7L40.4 431.9C16.1 422.7 0 399.4 0 373.4c0-28.2 18.8-52.8 45.9-60.3l15.5-4.3zM216 352c-13.3 0-24 10.7-24 24s10.7 24 24 24H360c13.3 0 24-10.7 24-24s-10.7-24-24-24H216z"]
|
|
};
|
|
var faWeightHanging = {
|
|
prefix: "fas",
|
|
iconName: "weight-hanging",
|
|
icon: [512, 512, [], "f5cd", "M224 96a32 32 0 1 1 64 0 32 32 0 1 1 -64 0zm122.5 32c3.5-10 5.5-20.8 5.5-32c0-53-43-96-96-96s-96 43-96 96c0 11.2 1.9 22 5.5 32H120c-22 0-41.2 15-46.6 36.4l-72 288c-3.6 14.3-.4 29.5 8.7 41.2S33.2 512 48 512H464c14.8 0 28.7-6.8 37.8-18.5s12.3-26.8 8.7-41.2l-72-288C433.2 143 414 128 392 128H346.5z"]
|
|
};
|
|
var faPanelEws = {
|
|
prefix: "fas",
|
|
iconName: "panel-ews",
|
|
icon: [512, 512, [], "e42e", "M64 0C28.7 0 0 28.7 0 64V288H16c44.2 0 80 35.8 80 80v16c0 17.7 14.3 32 32 32s32-14.3 32-32V352c-17.7 0-32-14.3-32-32V288c0-17.7 14.3-32 32-32h32c17.7 0 32 14.3 32 32v32c0 17.7-14.3 32-32 32v32c0 35.3-28.7 64-64 64s-64-28.7-64-64V368c0-26.5-21.5-48-48-48H0V448c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64H64zm48 64h96c8.8 0 16 7.2 16 16s-7.2 16-16 16H112c-8.8 0-16-7.2-16-16s7.2-16 16-16zm192 0h96c8.8 0 16 7.2 16 16s-7.2 16-16 16H304c-8.8 0-16-7.2-16-16s7.2-16 16-16zM112 128h96c8.8 0 16 7.2 16 16s-7.2 16-16 16H112c-8.8 0-16-7.2-16-16s7.2-16 16-16zm192 0h96c8.8 0 16 7.2 16 16s-7.2 16-16 16H304c-8.8 0-16-7.2-16-16s7.2-16 16-16zm16 128h64c17.7 0 32 14.3 32 32V416c0 17.7-14.3 32-32 32H320c-17.7 0-32-14.3-32-32V288c0-17.7 14.3-32 32-32z"]
|
|
};
|
|
var faCaretUp = {
|
|
prefix: "fas",
|
|
iconName: "caret-up",
|
|
icon: [320, 512, [], "f0d8", "M182.6 137.4c-12.5-12.5-32.8-12.5-45.3 0l-128 128c-9.2 9.2-11.9 22.9-6.9 34.9s16.6 19.8 29.6 19.8H288c12.9 0 24.6-7.8 29.6-19.8s2.2-25.7-6.9-34.9l-128-128z"]
|
|
};
|
|
var faSnowflake = {
|
|
prefix: "fas",
|
|
iconName: "snowflake",
|
|
icon: [448, 512, [10052, 10054], "f2dc", "M224 0c17.7 0 32 14.3 32 32V62.1l15-15c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-49 49v70.3l61.4-35.8 17.7-66.1c3.4-12.8 16.6-20.4 29.4-17s20.4 16.6 17 29.4l-5.2 19.3 23.6-13.8c15.3-8.9 34.9-3.7 43.8 11.5s3.8 34.9-11.5 43.8l-25.3 14.8 21.7 5.8c12.8 3.4 20.4 16.6 17 29.4s-16.6 20.4-29.4 17l-67.7-18.1L287.5 256l60.9 35.5 67.7-18.1c12.8-3.4 26 4.2 29.4 17s-4.2 26-17 29.4l-21.7 5.8 25.3 14.8c15.3 8.9 20.4 28.5 11.5 43.8s-28.5 20.4-43.8 11.5l-23.6-13.8 5.2 19.3c3.4 12.8-4.2 26-17 29.4s-26-4.2-29.4-17l-17.7-66.1L256 311.7v70.3l49 49c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-15-15V480c0 17.7-14.3 32-32 32s-32-14.3-32-32V449.9l-15 15c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l49-49V311.7l-61.4 35.8-17.7 66.1c-3.4 12.8-16.6 20.4-29.4 17s-20.4-16.6-17-29.4l5.2-19.3L48.1 395.6c-15.3 8.9-34.9 3.7-43.8-11.5s-3.7-34.9 11.5-43.8l25.3-14.8-21.7-5.8c-12.8-3.4-20.4-16.6-17-29.4s16.6-20.4 29.4-17l67.7 18.1L160.5 256 99.6 220.5 31.9 238.6c-12.8 3.4-26-4.2-29.4-17s4.2-26 17-29.4l21.7-5.8L15.9 171.6C.6 162.7-4.5 143.1 4.4 127.9s28.5-20.4 43.8-11.5l23.6 13.8-5.2-19.3c-3.4-12.8 4.2-26 17-29.4s26 4.2 29.4 17l17.7 66.1L192 200.3V129.9L143 81c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l15 15V32c0-17.7 14.3-32 32-32z"]
|
|
};
|
|
var faPlaneDeparture = {
|
|
prefix: "fas",
|
|
iconName: "plane-departure",
|
|
icon: [640, 512, [128747], "f5b0", "M381 114.9L186.1 41.8c-16.7-6.2-35.2-5.3-51.1 2.7L89.1 67.4C78 73 77.2 88.5 87.6 95.2l146.9 94.5L136 240 77.8 214.1c-8.7-3.9-18.8-3.7-27.3 .6L18.3 230.8c-9.3 4.7-11.8 16.8-5 24.7l73.1 85.3c6.1 7.1 15 11.2 24.3 11.2H248.4c5 0 9.9-1.2 14.3-3.4L535.6 212.2c46.5-23.3 82.5-63.3 100.8-112C645.9 75 627.2 48 600.2 48H542.8c-20.2 0-40.2 4.8-58.2 14L381 114.9zM0 480c0 17.7 14.3 32 32 32H608c17.7 0 32-14.3 32-32s-14.3-32-32-32H32c-17.7 0-32 14.3-32 32z"]
|
|
};
|
|
var faRoute = {
|
|
prefix: "fas",
|
|
iconName: "route",
|
|
icon: [512, 512, [], "f4d7", "M512 96c0 50.2-59.1 125.1-84.6 155c-3.8 4.4-9.4 6.1-14.5 5H320c-17.7 0-32 14.3-32 32s14.3 32 32 32h96c53 0 96 43 96 96s-43 96-96 96H139.6c8.7-9.9 19.3-22.6 30-36.8c6.3-8.4 12.8-17.6 19-27.2H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H320c-53 0-96-43-96-96s43-96 96-96h39.8c-21-31.5-39.8-67.7-39.8-96c0-53 43-96 96-96s96 43 96 96zM117.1 489.1c-3.8 4.3-7.2 8.1-10.1 11.3l-1.8 2-.2-.2c-6 4.6-14.6 4-20-1.8C59.8 473 0 402.5 0 352c0-53 43-96 96-96s96 43 96 96c0 30-21.1 67-43.5 97.9c-10.7 14.7-21.7 28-30.8 38.5l-.6 .7zM128 352a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zM416 128a32 32 0 1 0 0-64 32 32 0 1 0 0 64z"]
|
|
};
|
|
var faFloppyDisk = {
|
|
prefix: "fas",
|
|
iconName: "floppy-disk",
|
|
icon: [448, 512, [128190, 128426, "save"], "f0c7", "M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V173.3c0-17-6.7-33.3-18.7-45.3L352 50.7C340 38.7 323.7 32 306.7 32H64zm0 96c0-17.7 14.3-32 32-32H288c17.7 0 32 14.3 32 32v64c0 17.7-14.3 32-32 32H96c-17.7 0-32-14.3-32-32V128zM224 288a64 64 0 1 1 0 128 64 64 0 1 1 0-128z"]
|
|
};
|
|
var faGear = {
|
|
prefix: "fas",
|
|
iconName: "gear",
|
|
icon: [512, 512, [9881, "cog"], "f013", "M495.9 166.6c3.2 8.7 .5 18.4-6.4 24.6l-43.3 39.4c1.1 8.3 1.7 16.8 1.7 25.4s-.6 17.1-1.7 25.4l43.3 39.4c6.9 6.2 9.6 15.9 6.4 24.6c-4.4 11.9-9.7 23.3-15.8 34.3l-4.7 8.1c-6.6 11-14 21.4-22.1 31.2c-5.9 7.2-15.7 9.6-24.5 6.8l-55.7-17.7c-13.4 10.3-28.2 18.9-44 25.4l-12.5 57.1c-2 9.1-9 16.3-18.2 17.8c-13.8 2.3-28 3.5-42.5 3.5s-28.7-1.2-42.5-3.5c-9.2-1.5-16.2-8.7-18.2-17.8l-12.5-57.1c-15.8-6.5-30.6-15.1-44-25.4L83.1 425.9c-8.8 2.8-18.6 .3-24.5-6.8c-8.1-9.8-15.5-20.2-22.1-31.2l-4.7-8.1c-6.1-11-11.4-22.4-15.8-34.3c-3.2-8.7-.5-18.4 6.4-24.6l43.3-39.4C64.6 273.1 64 264.6 64 256s.6-17.1 1.7-25.4L22.4 191.2c-6.9-6.2-9.6-15.9-6.4-24.6c4.4-11.9 9.7-23.3 15.8-34.3l4.7-8.1c6.6-11 14-21.4 22.1-31.2c5.9-7.2 15.7-9.6 24.5-6.8l55.7 17.7c13.4-10.3 28.2-18.9 44-25.4l12.5-57.1c2-9.1 9-16.3 18.2-17.8C227.3 1.2 241.5 0 256 0s28.7 1.2 42.5 3.5c9.2 1.5 16.2 8.7 18.2 17.8l12.5 57.1c15.8 6.5 30.6 15.1 44 25.4l55.7-17.7c8.8-2.8 18.6-.3 24.5 6.8c8.1 9.8 15.5 20.2 22.1 31.2l4.7 8.1c6.1 11 11.4 22.4 15.8 34.3zM256 336a80 80 0 1 0 0-160 80 80 0 1 0 0 160z"]
|
|
};
|
|
var faCog = faGear;
|
|
var faCaretDown = {
|
|
prefix: "fas",
|
|
iconName: "caret-down",
|
|
icon: [320, 512, [], "f0d7", "M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z"]
|
|
};
|
|
var faMagnifyingGlass = {
|
|
prefix: "fas",
|
|
iconName: "magnifying-glass",
|
|
icon: [512, 512, [128269, "search"], "f002", "M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"]
|
|
};
|
|
var faSearch = faMagnifyingGlass;
|
|
var faXmark = {
|
|
prefix: "fas",
|
|
iconName: "xmark",
|
|
icon: [384, 512, [128473, 10005, 10006, 10060, 215, "close", "multiply", "remove", "times"], "f00d", "M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"]
|
|
};
|
|
var faClose = faXmark;
|
|
var faMap = {
|
|
prefix: "fas",
|
|
iconName: "map",
|
|
icon: [576, 512, [128506, 62072], "f279", "M384 476.1L192 421.2V35.9L384 90.8V476.1zm32-1.2V88.4L543.1 37.5c15.8-6.3 32.9 5.3 32.9 22.3V394.6c0 9.8-6 18.6-15.1 22.3L416 474.8zM15.1 95.1L160 37.2V423.6L32.9 474.5C17.1 480.8 0 469.2 0 452.2V117.4c0-9.8 6-18.6 15.1-22.3z"]
|
|
};
|
|
var faSpinner = {
|
|
prefix: "fas",
|
|
iconName: "spinner",
|
|
icon: [512, 512, [], "f110", "M304 48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zm0 416a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM48 304a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm464-48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM142.9 437A48 48 0 1 0 75 369.1 48 48 0 1 0 142.9 437zm0-294.2A48 48 0 1 0 75 75a48 48 0 1 0 67.9 67.9zM369.1 437A48 48 0 1 0 437 369.1 48 48 0 1 0 369.1 437z"]
|
|
};
|
|
var faTransformerBolt = {
|
|
prefix: "fas",
|
|
iconName: "transformer-bolt",
|
|
icon: [384, 512, [], "e2a4", "M136 24v8h24c8.8 0 16 7.2 16 16s-7.2 16-16 16H112 64c-8.8 0-16-7.2-16-16s7.2-16 16-16H88V24C88 10.7 98.7 0 112 0s24 10.7 24 24zm160 0v8h24c8.8 0 16 7.2 16 16s-7.2 16-16 16H272 224c-8.8 0-16-7.2-16-16s7.2-16 16-16h24V24c0-13.3 10.7-24 24-24s24 10.7 24 24zM48 112c0-8.8 7.2-16 16-16h96c8.8 0 16 7.2 16 16s-7.2 16-16 16H64c-8.8 0-16-7.2-16-16zm160 0c0-8.8 7.2-16 16-16h96c8.8 0 16 7.2 16 16s-7.2 16-16 16H224c-8.8 0-16-7.2-16-16zM0 192c0-17.7 14.3-32 32-32H352c17.7 0 32 14.3 32 32s-14.3 32-32 32V448c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32V224c-17.7 0-32-14.3-32-32zm232.9 34.7c-6-4-13.9-3.6-19.3 1.1l-112 96c-5.1 4.4-6.9 11.4-4.6 17.7s8.3 10.4 15 10.4h57.8l-25 74.9c-2.3 6.8 .3 14.3 6.3 18.3s13.9 3.6 19.3-1.1l112-96c5.1-4.4 6.9-11.4 4.6-17.7s-8.3-10.4-15-10.4H214.2l25-74.9c2.3-6.8-.3-14.3-6.3-18.3z"]
|
|
};
|
|
var faCheck = {
|
|
prefix: "fas",
|
|
iconName: "check",
|
|
icon: [448, 512, [10003, 10004], "f00c", "M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"]
|
|
};
|
|
var faMagnifyingGlassPlus = {
|
|
prefix: "fas",
|
|
iconName: "magnifying-glass-plus",
|
|
icon: [512, 512, ["search-plus"], "f00e", "M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM184 296c0 13.3 10.7 24 24 24s24-10.7 24-24V232h64c13.3 0 24-10.7 24-24s-10.7-24-24-24H232V120c0-13.3-10.7-24-24-24s-24 10.7-24 24v64H120c-13.3 0-24 10.7-24 24s10.7 24 24 24h64v64z"]
|
|
};
|
|
var faMagnifyingGlassMinus = {
|
|
prefix: "fas",
|
|
iconName: "magnifying-glass-minus",
|
|
icon: [512, 512, ["search-minus"], "f010", "M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM136 184c-13.3 0-24 10.7-24 24s10.7 24 24 24H280c13.3 0 24-10.7 24-24s-10.7-24-24-24H136z"]
|
|
};
|
|
var faPlane = {
|
|
prefix: "fas",
|
|
iconName: "plane",
|
|
icon: [576, 512, [], "f072", "M482.3 192c34.2 0 93.7 29 93.7 64c0 36-59.5 64-93.7 64l-116.6 0L265.2 495.9c-5.7 10-16.3 16.1-27.8 16.1l-56.2 0c-10.6 0-18.3-10.2-15.4-20.4l49-171.6L112 320 68.8 377.6c-3 4-7.8 6.4-12.8 6.4l-42 0c-7.8 0-14-6.3-14-14c0-1.3 .2-2.6 .5-3.9L32 256 .5 145.9c-.4-1.3-.5-2.6-.5-3.9c0-7.8 6.3-14 14-14l42 0c5 0 9.8 2.4 12.8 6.4L112 192l102.9 0-49-171.6C162.9 10.2 170.6 0 181.2 0l56.2 0c11.5 0 22.1 6.2 27.8 16.1L365.7 192l116.6 0z"]
|
|
};
|
|
|
|
// node_modules/@fortawesome/fontawesome-svg-core/index.mjs
|
|
function ownKeys(object, enumerableOnly) {
|
|
var keys2 = Object.keys(object);
|
|
if (Object.getOwnPropertySymbols) {
|
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
})), keys2.push.apply(keys2, symbols);
|
|
}
|
|
return keys2;
|
|
}
|
|
function _objectSpread2(target) {
|
|
for (var i = 1; i < arguments.length; i++) {
|
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
_defineProperty(target, key, source[key]);
|
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
});
|
|
}
|
|
return target;
|
|
}
|
|
function _typeof(obj) {
|
|
"@babel/helpers - typeof";
|
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
return typeof obj2;
|
|
} : function(obj2) {
|
|
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
}, _typeof(obj);
|
|
}
|
|
function _classCallCheck(instance, Constructor) {
|
|
if (!(instance instanceof Constructor)) {
|
|
throw new TypeError("Cannot call a class as a function");
|
|
}
|
|
}
|
|
function _defineProperties(target, props) {
|
|
for (var i = 0; i < props.length; i++) {
|
|
var descriptor = props[i];
|
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
descriptor.configurable = true;
|
|
if ("value" in descriptor)
|
|
descriptor.writable = true;
|
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
}
|
|
}
|
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
if (protoProps)
|
|
_defineProperties(Constructor.prototype, protoProps);
|
|
if (staticProps)
|
|
_defineProperties(Constructor, staticProps);
|
|
Object.defineProperty(Constructor, "prototype", {
|
|
writable: false
|
|
});
|
|
return Constructor;
|
|
}
|
|
function _defineProperty(obj, key, value) {
|
|
if (key in obj) {
|
|
Object.defineProperty(obj, key, {
|
|
value,
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true
|
|
});
|
|
} else {
|
|
obj[key] = value;
|
|
}
|
|
return obj;
|
|
}
|
|
function _slicedToArray(arr, i) {
|
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
}
|
|
function _toConsumableArray(arr) {
|
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
}
|
|
function _arrayWithoutHoles(arr) {
|
|
if (Array.isArray(arr))
|
|
return _arrayLikeToArray(arr);
|
|
}
|
|
function _arrayWithHoles(arr) {
|
|
if (Array.isArray(arr))
|
|
return arr;
|
|
}
|
|
function _iterableToArray(iter) {
|
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
return Array.from(iter);
|
|
}
|
|
function _iterableToArrayLimit(arr, i) {
|
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
if (_i == null)
|
|
return;
|
|
var _arr = [];
|
|
var _n = true;
|
|
var _d = false;
|
|
var _s, _e;
|
|
try {
|
|
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
_arr.push(_s.value);
|
|
if (i && _arr.length === i)
|
|
break;
|
|
}
|
|
} catch (err) {
|
|
_d = true;
|
|
_e = err;
|
|
} finally {
|
|
try {
|
|
if (!_n && _i["return"] != null)
|
|
_i["return"]();
|
|
} finally {
|
|
if (_d)
|
|
throw _e;
|
|
}
|
|
}
|
|
return _arr;
|
|
}
|
|
function _unsupportedIterableToArray(o, minLen) {
|
|
if (!o)
|
|
return;
|
|
if (typeof o === "string")
|
|
return _arrayLikeToArray(o, minLen);
|
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
if (n === "Object" && o.constructor)
|
|
n = o.constructor.name;
|
|
if (n === "Map" || n === "Set")
|
|
return Array.from(o);
|
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
return _arrayLikeToArray(o, minLen);
|
|
}
|
|
function _arrayLikeToArray(arr, len) {
|
|
if (len == null || len > arr.length)
|
|
len = arr.length;
|
|
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
arr2[i] = arr[i];
|
|
return arr2;
|
|
}
|
|
function _nonIterableSpread() {
|
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
}
|
|
function _nonIterableRest() {
|
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
}
|
|
var noop2 = function noop3() {
|
|
};
|
|
var _WINDOW = {};
|
|
var _DOCUMENT = {};
|
|
var _MUTATION_OBSERVER = null;
|
|
var _PERFORMANCE = {
|
|
mark: noop2,
|
|
measure: noop2
|
|
};
|
|
try {
|
|
if (typeof window !== "undefined")
|
|
_WINDOW = window;
|
|
if (typeof document !== "undefined")
|
|
_DOCUMENT = document;
|
|
if (typeof MutationObserver !== "undefined")
|
|
_MUTATION_OBSERVER = MutationObserver;
|
|
if (typeof performance !== "undefined")
|
|
_PERFORMANCE = performance;
|
|
} catch (e) {
|
|
}
|
|
var _ref = _WINDOW.navigator || {};
|
|
var _ref$userAgent = _ref.userAgent;
|
|
var userAgent = _ref$userAgent === void 0 ? "" : _ref$userAgent;
|
|
var WINDOW = _WINDOW;
|
|
var DOCUMENT = _DOCUMENT;
|
|
var MUTATION_OBSERVER = _MUTATION_OBSERVER;
|
|
var PERFORMANCE = _PERFORMANCE;
|
|
var IS_BROWSER = !!WINDOW.document;
|
|
var IS_DOM = !!DOCUMENT.documentElement && !!DOCUMENT.head && typeof DOCUMENT.addEventListener === "function" && typeof DOCUMENT.createElement === "function";
|
|
var IS_IE = ~userAgent.indexOf("MSIE") || ~userAgent.indexOf("Trident/");
|
|
var _familyProxy;
|
|
var _familyProxy2;
|
|
var _familyProxy3;
|
|
var _familyProxy4;
|
|
var _familyProxy5;
|
|
var NAMESPACE_IDENTIFIER = "___FONT_AWESOME___";
|
|
var UNITS_IN_GRID = 16;
|
|
var DEFAULT_CSS_PREFIX = "fa";
|
|
var DEFAULT_REPLACEMENT_CLASS = "svg-inline--fa";
|
|
var DATA_FA_I2SVG = "data-fa-i2svg";
|
|
var DATA_FA_PSEUDO_ELEMENT = "data-fa-pseudo-element";
|
|
var DATA_FA_PSEUDO_ELEMENT_PENDING = "data-fa-pseudo-element-pending";
|
|
var DATA_PREFIX = "data-prefix";
|
|
var DATA_ICON = "data-icon";
|
|
var HTML_CLASS_I2SVG_BASE_CLASS = "fontawesome-i2svg";
|
|
var MUTATION_APPROACH_ASYNC = "async";
|
|
var TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS = ["HTML", "HEAD", "STYLE", "SCRIPT"];
|
|
var PRODUCTION = function() {
|
|
try {
|
|
return false;
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}();
|
|
var FAMILY_CLASSIC = "classic";
|
|
var FAMILY_SHARP = "sharp";
|
|
var FAMILIES = [FAMILY_CLASSIC, FAMILY_SHARP];
|
|
function familyProxy(obj) {
|
|
return new Proxy(obj, {
|
|
get: function get2(target, prop) {
|
|
return prop in target ? target[prop] : target[FAMILY_CLASSIC];
|
|
}
|
|
});
|
|
}
|
|
var PREFIX_TO_STYLE = familyProxy((_familyProxy = {}, _defineProperty(_familyProxy, FAMILY_CLASSIC, {
|
|
"fa": "solid",
|
|
"fas": "solid",
|
|
"fa-solid": "solid",
|
|
"far": "regular",
|
|
"fa-regular": "regular",
|
|
"fal": "light",
|
|
"fa-light": "light",
|
|
"fat": "thin",
|
|
"fa-thin": "thin",
|
|
"fad": "duotone",
|
|
"fa-duotone": "duotone",
|
|
"fab": "brands",
|
|
"fa-brands": "brands",
|
|
"fak": "kit",
|
|
"fakd": "kit",
|
|
"fa-kit": "kit",
|
|
"fa-kit-duotone": "kit"
|
|
}), _defineProperty(_familyProxy, FAMILY_SHARP, {
|
|
"fa": "solid",
|
|
"fass": "solid",
|
|
"fa-solid": "solid",
|
|
"fasr": "regular",
|
|
"fa-regular": "regular",
|
|
"fasl": "light",
|
|
"fa-light": "light",
|
|
"fast": "thin",
|
|
"fa-thin": "thin"
|
|
}), _familyProxy));
|
|
var STYLE_TO_PREFIX = familyProxy((_familyProxy2 = {}, _defineProperty(_familyProxy2, FAMILY_CLASSIC, {
|
|
solid: "fas",
|
|
regular: "far",
|
|
light: "fal",
|
|
thin: "fat",
|
|
duotone: "fad",
|
|
brands: "fab",
|
|
kit: "fak"
|
|
}), _defineProperty(_familyProxy2, FAMILY_SHARP, {
|
|
solid: "fass",
|
|
regular: "fasr",
|
|
light: "fasl",
|
|
thin: "fast"
|
|
}), _familyProxy2));
|
|
var PREFIX_TO_LONG_STYLE = familyProxy((_familyProxy3 = {}, _defineProperty(_familyProxy3, FAMILY_CLASSIC, {
|
|
fab: "fa-brands",
|
|
fad: "fa-duotone",
|
|
fak: "fa-kit",
|
|
fal: "fa-light",
|
|
far: "fa-regular",
|
|
fas: "fa-solid",
|
|
fat: "fa-thin"
|
|
}), _defineProperty(_familyProxy3, FAMILY_SHARP, {
|
|
fass: "fa-solid",
|
|
fasr: "fa-regular",
|
|
fasl: "fa-light",
|
|
fast: "fa-thin"
|
|
}), _familyProxy3));
|
|
var LONG_STYLE_TO_PREFIX = familyProxy((_familyProxy4 = {}, _defineProperty(_familyProxy4, FAMILY_CLASSIC, {
|
|
"fa-brands": "fab",
|
|
"fa-duotone": "fad",
|
|
"fa-kit": "fak",
|
|
"fa-light": "fal",
|
|
"fa-regular": "far",
|
|
"fa-solid": "fas",
|
|
"fa-thin": "fat"
|
|
}), _defineProperty(_familyProxy4, FAMILY_SHARP, {
|
|
"fa-solid": "fass",
|
|
"fa-regular": "fasr",
|
|
"fa-light": "fasl",
|
|
"fa-thin": "fast"
|
|
}), _familyProxy4));
|
|
var ICON_SELECTION_SYNTAX_PATTERN = /fa(s|r|l|t|d|b|k|ss|sr|sl|st)?[\-\ ]/;
|
|
var LAYERS_TEXT_CLASSNAME = "fa-layers-text";
|
|
var FONT_FAMILY_PATTERN = /Font ?Awesome ?([56 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp|Kit)?.*/i;
|
|
var FONT_WEIGHT_TO_PREFIX = familyProxy((_familyProxy5 = {}, _defineProperty(_familyProxy5, FAMILY_CLASSIC, {
|
|
900: "fas",
|
|
400: "far",
|
|
normal: "far",
|
|
300: "fal",
|
|
100: "fat"
|
|
}), _defineProperty(_familyProxy5, FAMILY_SHARP, {
|
|
900: "fass",
|
|
400: "fasr",
|
|
300: "fasl",
|
|
100: "fast"
|
|
}), _familyProxy5));
|
|
var oneToTen = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
var oneToTwenty = oneToTen.concat([11, 12, 13, 14, 15, 16, 17, 18, 19, 20]);
|
|
var ATTRIBUTES_WATCHED_FOR_MUTATION = ["class", "data-prefix", "data-icon", "data-fa-transform", "data-fa-mask"];
|
|
var DUOTONE_CLASSES = {
|
|
GROUP: "duotone-group",
|
|
SWAP_OPACITY: "swap-opacity",
|
|
PRIMARY: "primary",
|
|
SECONDARY: "secondary"
|
|
};
|
|
var prefixes = /* @__PURE__ */ new Set();
|
|
Object.keys(STYLE_TO_PREFIX[FAMILY_CLASSIC]).map(prefixes.add.bind(prefixes));
|
|
Object.keys(STYLE_TO_PREFIX[FAMILY_SHARP]).map(prefixes.add.bind(prefixes));
|
|
var RESERVED_CLASSES = [].concat(FAMILIES, _toConsumableArray(prefixes), ["2xs", "xs", "sm", "lg", "xl", "2xl", "beat", "border", "fade", "beat-fade", "bounce", "flip-both", "flip-horizontal", "flip-vertical", "flip", "fw", "inverse", "layers-counter", "layers-text", "layers", "li", "pull-left", "pull-right", "pulse", "rotate-180", "rotate-270", "rotate-90", "rotate-by", "shake", "spin-pulse", "spin-reverse", "spin", "stack-1x", "stack-2x", "stack", "ul", DUOTONE_CLASSES.GROUP, DUOTONE_CLASSES.SWAP_OPACITY, DUOTONE_CLASSES.PRIMARY, DUOTONE_CLASSES.SECONDARY]).concat(oneToTen.map(function(n) {
|
|
return "".concat(n, "x");
|
|
})).concat(oneToTwenty.map(function(n) {
|
|
return "w-".concat(n);
|
|
}));
|
|
var initial = WINDOW.FontAwesomeConfig || {};
|
|
function getAttrConfig(attr) {
|
|
var element = DOCUMENT.querySelector("script[" + attr + "]");
|
|
if (element) {
|
|
return element.getAttribute(attr);
|
|
}
|
|
}
|
|
function coerce(val) {
|
|
if (val === "")
|
|
return true;
|
|
if (val === "false")
|
|
return false;
|
|
if (val === "true")
|
|
return true;
|
|
return val;
|
|
}
|
|
if (DOCUMENT && typeof DOCUMENT.querySelector === "function") {
|
|
attrs = [["data-family-prefix", "familyPrefix"], ["data-css-prefix", "cssPrefix"], ["data-family-default", "familyDefault"], ["data-style-default", "styleDefault"], ["data-replacement-class", "replacementClass"], ["data-auto-replace-svg", "autoReplaceSvg"], ["data-auto-add-css", "autoAddCss"], ["data-auto-a11y", "autoA11y"], ["data-search-pseudo-elements", "searchPseudoElements"], ["data-observe-mutations", "observeMutations"], ["data-mutate-approach", "mutateApproach"], ["data-keep-original-source", "keepOriginalSource"], ["data-measure-performance", "measurePerformance"], ["data-show-missing-icons", "showMissingIcons"]];
|
|
attrs.forEach(function(_ref2) {
|
|
var _ref22 = _slicedToArray(_ref2, 2), attr = _ref22[0], key = _ref22[1];
|
|
var val = coerce(getAttrConfig(attr));
|
|
if (val !== void 0 && val !== null) {
|
|
initial[key] = val;
|
|
}
|
|
});
|
|
}
|
|
var attrs;
|
|
var _default = {
|
|
styleDefault: "solid",
|
|
familyDefault: "classic",
|
|
cssPrefix: DEFAULT_CSS_PREFIX,
|
|
replacementClass: DEFAULT_REPLACEMENT_CLASS,
|
|
autoReplaceSvg: true,
|
|
autoAddCss: true,
|
|
autoA11y: true,
|
|
searchPseudoElements: false,
|
|
observeMutations: true,
|
|
mutateApproach: "async",
|
|
keepOriginalSource: true,
|
|
measurePerformance: false,
|
|
showMissingIcons: true
|
|
};
|
|
if (initial.familyPrefix) {
|
|
initial.cssPrefix = initial.familyPrefix;
|
|
}
|
|
var _config = _objectSpread2(_objectSpread2({}, _default), initial);
|
|
if (!_config.autoReplaceSvg)
|
|
_config.observeMutations = false;
|
|
var config = {};
|
|
Object.keys(_default).forEach(function(key) {
|
|
Object.defineProperty(config, key, {
|
|
enumerable: true,
|
|
set: function set3(val) {
|
|
_config[key] = val;
|
|
_onChangeCb.forEach(function(cb) {
|
|
return cb(config);
|
|
});
|
|
},
|
|
get: function get2() {
|
|
return _config[key];
|
|
}
|
|
});
|
|
});
|
|
Object.defineProperty(config, "familyPrefix", {
|
|
enumerable: true,
|
|
set: function set2(val) {
|
|
_config.cssPrefix = val;
|
|
_onChangeCb.forEach(function(cb) {
|
|
return cb(config);
|
|
});
|
|
},
|
|
get: function get() {
|
|
return _config.cssPrefix;
|
|
}
|
|
});
|
|
WINDOW.FontAwesomeConfig = config;
|
|
var _onChangeCb = [];
|
|
function onChange(cb) {
|
|
_onChangeCb.push(cb);
|
|
return function() {
|
|
_onChangeCb.splice(_onChangeCb.indexOf(cb), 1);
|
|
};
|
|
}
|
|
var d = UNITS_IN_GRID;
|
|
var meaninglessTransform = {
|
|
size: 16,
|
|
x: 0,
|
|
y: 0,
|
|
rotate: 0,
|
|
flipX: false,
|
|
flipY: false
|
|
};
|
|
function insertCss(css2) {
|
|
if (!css2 || !IS_DOM) {
|
|
return;
|
|
}
|
|
var style = DOCUMENT.createElement("style");
|
|
style.setAttribute("type", "text/css");
|
|
style.innerHTML = css2;
|
|
var headChildren = DOCUMENT.head.childNodes;
|
|
var beforeChild = null;
|
|
for (var i = headChildren.length - 1; i > -1; i--) {
|
|
var child = headChildren[i];
|
|
var tagName = (child.tagName || "").toUpperCase();
|
|
if (["STYLE", "LINK"].indexOf(tagName) > -1) {
|
|
beforeChild = child;
|
|
}
|
|
}
|
|
DOCUMENT.head.insertBefore(style, beforeChild);
|
|
return css2;
|
|
}
|
|
var idPool = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
function nextUniqueId() {
|
|
var size = 12;
|
|
var id = "";
|
|
while (size-- > 0) {
|
|
id += idPool[Math.random() * 62 | 0];
|
|
}
|
|
return id;
|
|
}
|
|
function toArray(obj) {
|
|
var array = [];
|
|
for (var i = (obj || []).length >>> 0; i--; ) {
|
|
array[i] = obj[i];
|
|
}
|
|
return array;
|
|
}
|
|
function classArray(node) {
|
|
if (node.classList) {
|
|
return toArray(node.classList);
|
|
} else {
|
|
return (node.getAttribute("class") || "").split(" ").filter(function(i) {
|
|
return i;
|
|
});
|
|
}
|
|
}
|
|
function htmlEscape(str) {
|
|
return "".concat(str).replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
|
}
|
|
function joinAttributes(attributes) {
|
|
return Object.keys(attributes || {}).reduce(function(acc, attributeName) {
|
|
return acc + "".concat(attributeName, '="').concat(htmlEscape(attributes[attributeName]), '" ');
|
|
}, "").trim();
|
|
}
|
|
function joinStyles(styles2) {
|
|
return Object.keys(styles2 || {}).reduce(function(acc, styleName) {
|
|
return acc + "".concat(styleName, ": ").concat(styles2[styleName].trim(), ";");
|
|
}, "");
|
|
}
|
|
function transformIsMeaningful(transform) {
|
|
return transform.size !== meaninglessTransform.size || transform.x !== meaninglessTransform.x || transform.y !== meaninglessTransform.y || transform.rotate !== meaninglessTransform.rotate || transform.flipX || transform.flipY;
|
|
}
|
|
function transformForSvg(_ref2) {
|
|
var transform = _ref2.transform, containerWidth = _ref2.containerWidth, iconWidth = _ref2.iconWidth;
|
|
var outer = {
|
|
transform: "translate(".concat(containerWidth / 2, " 256)")
|
|
};
|
|
var innerTranslate = "translate(".concat(transform.x * 32, ", ").concat(transform.y * 32, ") ");
|
|
var innerScale = "scale(".concat(transform.size / 16 * (transform.flipX ? -1 : 1), ", ").concat(transform.size / 16 * (transform.flipY ? -1 : 1), ") ");
|
|
var innerRotate = "rotate(".concat(transform.rotate, " 0 0)");
|
|
var inner = {
|
|
transform: "".concat(innerTranslate, " ").concat(innerScale, " ").concat(innerRotate)
|
|
};
|
|
var path = {
|
|
transform: "translate(".concat(iconWidth / 2 * -1, " -256)")
|
|
};
|
|
return {
|
|
outer,
|
|
inner,
|
|
path
|
|
};
|
|
}
|
|
function transformForCss(_ref2) {
|
|
var transform = _ref2.transform, _ref2$width = _ref2.width, width = _ref2$width === void 0 ? UNITS_IN_GRID : _ref2$width, _ref2$height = _ref2.height, height = _ref2$height === void 0 ? UNITS_IN_GRID : _ref2$height, _ref2$startCentered = _ref2.startCentered, startCentered = _ref2$startCentered === void 0 ? false : _ref2$startCentered;
|
|
var val = "";
|
|
if (startCentered && IS_IE) {
|
|
val += "translate(".concat(transform.x / d - width / 2, "em, ").concat(transform.y / d - height / 2, "em) ");
|
|
} else if (startCentered) {
|
|
val += "translate(calc(-50% + ".concat(transform.x / d, "em), calc(-50% + ").concat(transform.y / d, "em)) ");
|
|
} else {
|
|
val += "translate(".concat(transform.x / d, "em, ").concat(transform.y / d, "em) ");
|
|
}
|
|
val += "scale(".concat(transform.size / d * (transform.flipX ? -1 : 1), ", ").concat(transform.size / d * (transform.flipY ? -1 : 1), ") ");
|
|
val += "rotate(".concat(transform.rotate, "deg) ");
|
|
return val;
|
|
}
|
|
var baseStyles = ':root, :host {\n --fa-font-solid: normal 900 1em/1 "Font Awesome 6 Solid";\n --fa-font-regular: normal 400 1em/1 "Font Awesome 6 Regular";\n --fa-font-light: normal 300 1em/1 "Font Awesome 6 Light";\n --fa-font-thin: normal 100 1em/1 "Font Awesome 6 Thin";\n --fa-font-duotone: normal 900 1em/1 "Font Awesome 6 Duotone";\n --fa-font-sharp-solid: normal 900 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-regular: normal 400 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-light: normal 300 1em/1 "Font Awesome 6 Sharp";\n --fa-font-sharp-thin: normal 100 1em/1 "Font Awesome 6 Sharp";\n --fa-font-brands: normal 400 1em/1 "Font Awesome 6 Brands";\n}\n\nsvg:not(:root).svg-inline--fa, svg:not(:host).svg-inline--fa {\n overflow: visible;\n box-sizing: content-box;\n}\n\n.svg-inline--fa {\n display: var(--fa-display, inline-block);\n height: 1em;\n overflow: visible;\n vertical-align: -0.125em;\n}\n.svg-inline--fa.fa-2xs {\n vertical-align: 0.1em;\n}\n.svg-inline--fa.fa-xs {\n vertical-align: 0em;\n}\n.svg-inline--fa.fa-sm {\n vertical-align: -0.0714285705em;\n}\n.svg-inline--fa.fa-lg {\n vertical-align: -0.2em;\n}\n.svg-inline--fa.fa-xl {\n vertical-align: -0.25em;\n}\n.svg-inline--fa.fa-2xl {\n vertical-align: -0.3125em;\n}\n.svg-inline--fa.fa-pull-left {\n margin-right: var(--fa-pull-margin, 0.3em);\n width: auto;\n}\n.svg-inline--fa.fa-pull-right {\n margin-left: var(--fa-pull-margin, 0.3em);\n width: auto;\n}\n.svg-inline--fa.fa-li {\n width: var(--fa-li-width, 2em);\n top: 0.25em;\n}\n.svg-inline--fa.fa-fw {\n width: var(--fa-fw-width, 1.25em);\n}\n\n.fa-layers svg.svg-inline--fa {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.fa-layers-counter, .fa-layers-text {\n display: inline-block;\n position: absolute;\n text-align: center;\n}\n\n.fa-layers {\n display: inline-block;\n height: 1em;\n position: relative;\n text-align: center;\n vertical-align: -0.125em;\n width: 1em;\n}\n.fa-layers svg.svg-inline--fa {\n -webkit-transform-origin: center center;\n transform-origin: center center;\n}\n\n.fa-layers-text {\n left: 50%;\n top: 50%;\n -webkit-transform: translate(-50%, -50%);\n transform: translate(-50%, -50%);\n -webkit-transform-origin: center center;\n transform-origin: center center;\n}\n\n.fa-layers-counter {\n background-color: var(--fa-counter-background-color, #ff253a);\n border-radius: var(--fa-counter-border-radius, 1em);\n box-sizing: border-box;\n color: var(--fa-inverse, #fff);\n line-height: var(--fa-counter-line-height, 1);\n max-width: var(--fa-counter-max-width, 5em);\n min-width: var(--fa-counter-min-width, 1.5em);\n overflow: hidden;\n padding: var(--fa-counter-padding, 0.25em 0.5em);\n right: var(--fa-right, 0);\n text-overflow: ellipsis;\n top: var(--fa-top, 0);\n -webkit-transform: scale(var(--fa-counter-scale, 0.25));\n transform: scale(var(--fa-counter-scale, 0.25));\n -webkit-transform-origin: top right;\n transform-origin: top right;\n}\n\n.fa-layers-bottom-right {\n bottom: var(--fa-bottom, 0);\n right: var(--fa-right, 0);\n top: auto;\n -webkit-transform: scale(var(--fa-layers-scale, 0.25));\n transform: scale(var(--fa-layers-scale, 0.25));\n -webkit-transform-origin: bottom right;\n transform-origin: bottom right;\n}\n\n.fa-layers-bottom-left {\n bottom: var(--fa-bottom, 0);\n left: var(--fa-left, 0);\n right: auto;\n top: auto;\n -webkit-transform: scale(var(--fa-layers-scale, 0.25));\n transform: scale(var(--fa-layers-scale, 0.25));\n -webkit-transform-origin: bottom left;\n transform-origin: bottom left;\n}\n\n.fa-layers-top-right {\n top: var(--fa-top, 0);\n right: var(--fa-right, 0);\n -webkit-transform: scale(var(--fa-layers-scale, 0.25));\n transform: scale(var(--fa-layers-scale, 0.25));\n -webkit-transform-origin: top right;\n transform-origin: top right;\n}\n\n.fa-layers-top-left {\n left: var(--fa-left, 0);\n right: auto;\n top: var(--fa-top, 0);\n -webkit-transform: scale(var(--fa-layers-scale, 0.25));\n transform: scale(var(--fa-layers-scale, 0.25));\n -webkit-transform-origin: top left;\n transform-origin: top left;\n}\n\n.fa-1x {\n font-size: 1em;\n}\n\n.fa-2x {\n font-size: 2em;\n}\n\n.fa-3x {\n font-size: 3em;\n}\n\n.fa-4x {\n font-size: 4em;\n}\n\n.fa-5x {\n font-size: 5em;\n}\n\n.fa-6x {\n font-size: 6em;\n}\n\n.fa-7x {\n font-size: 7em;\n}\n\n.fa-8x {\n font-size: 8em;\n}\n\n.fa-9x {\n font-size: 9em;\n}\n\n.fa-10x {\n font-size: 10em;\n}\n\n.fa-2xs {\n font-size: 0.625em;\n line-height: 0.1em;\n vertical-align: 0.225em;\n}\n\n.fa-xs {\n font-size: 0.75em;\n line-height: 0.0833333337em;\n vertical-align: 0.125em;\n}\n\n.fa-sm {\n font-size: 0.875em;\n line-height: 0.0714285718em;\n vertical-align: 0.0535714295em;\n}\n\n.fa-lg {\n font-size: 1.25em;\n line-height: 0.05em;\n vertical-align: -0.075em;\n}\n\n.fa-xl {\n font-size: 1.5em;\n line-height: 0.0416666682em;\n vertical-align: -0.125em;\n}\n\n.fa-2xl {\n font-size: 2em;\n line-height: 0.03125em;\n vertical-align: -0.1875em;\n}\n\n.fa-fw {\n text-align: center;\n width: 1.25em;\n}\n\n.fa-ul {\n list-style-type: none;\n margin-left: var(--fa-li-margin, 2.5em);\n padding-left: 0;\n}\n.fa-ul > li {\n position: relative;\n}\n\n.fa-li {\n left: calc(var(--fa-li-width, 2em) * -1);\n position: absolute;\n text-align: center;\n width: var(--fa-li-width, 2em);\n line-height: inherit;\n}\n\n.fa-border {\n border-color: var(--fa-border-color, #eee);\n border-radius: var(--fa-border-radius, 0.1em);\n border-style: var(--fa-border-style, solid);\n border-width: var(--fa-border-width, 0.08em);\n padding: var(--fa-border-padding, 0.2em 0.25em 0.15em);\n}\n\n.fa-pull-left {\n float: left;\n margin-right: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-pull-right {\n float: right;\n margin-left: var(--fa-pull-margin, 0.3em);\n}\n\n.fa-beat {\n -webkit-animation-name: fa-beat;\n animation-name: fa-beat;\n -webkit-animation-delay: var(--fa-animation-delay, 0s);\n animation-delay: var(--fa-animation-delay, 0s);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, ease-in-out);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-bounce {\n -webkit-animation-name: fa-bounce;\n animation-name: fa-bounce;\n -webkit-animation-delay: var(--fa-animation-delay, 0s);\n animation-delay: var(--fa-animation-delay, 0s);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));\n}\n\n.fa-fade {\n -webkit-animation-name: fa-fade;\n animation-name: fa-fade;\n -webkit-animation-delay: var(--fa-animation-delay, 0s);\n animation-delay: var(--fa-animation-delay, 0s);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-beat-fade {\n -webkit-animation-name: fa-beat-fade;\n animation-name: fa-beat-fade;\n -webkit-animation-delay: var(--fa-animation-delay, 0s);\n animation-delay: var(--fa-animation-delay, 0s);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));\n}\n\n.fa-flip {\n -webkit-animation-name: fa-flip;\n animation-name: fa-flip;\n -webkit-animation-delay: var(--fa-animation-delay, 0s);\n animation-delay: var(--fa-animation-delay, 0s);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, ease-in-out);\n animation-timing-function: var(--fa-animation-timing, ease-in-out);\n}\n\n.fa-shake {\n -webkit-animation-name: fa-shake;\n animation-name: fa-shake;\n -webkit-animation-delay: var(--fa-animation-delay, 0s);\n animation-delay: var(--fa-animation-delay, 0s);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, linear);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin {\n -webkit-animation-name: fa-spin;\n animation-name: fa-spin;\n -webkit-animation-delay: var(--fa-animation-delay, 0s);\n animation-delay: var(--fa-animation-delay, 0s);\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 2s);\n animation-duration: var(--fa-animation-duration, 2s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, linear);\n animation-timing-function: var(--fa-animation-timing, linear);\n}\n\n.fa-spin-reverse {\n --fa-animation-direction: reverse;\n}\n\n.fa-pulse,\n.fa-spin-pulse {\n -webkit-animation-name: fa-spin;\n animation-name: fa-spin;\n -webkit-animation-direction: var(--fa-animation-direction, normal);\n animation-direction: var(--fa-animation-direction, normal);\n -webkit-animation-duration: var(--fa-animation-duration, 1s);\n animation-duration: var(--fa-animation-duration, 1s);\n -webkit-animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n animation-iteration-count: var(--fa-animation-iteration-count, infinite);\n -webkit-animation-timing-function: var(--fa-animation-timing, steps(8));\n animation-timing-function: var(--fa-animation-timing, steps(8));\n}\n\n@media (prefers-reduced-motion: reduce) {\n .fa-beat,\n.fa-bounce,\n.fa-fade,\n.fa-beat-fade,\n.fa-flip,\n.fa-pulse,\n.fa-shake,\n.fa-spin,\n.fa-spin-pulse {\n -webkit-animation-delay: -1ms;\n animation-delay: -1ms;\n -webkit-animation-duration: 1ms;\n animation-duration: 1ms;\n -webkit-animation-iteration-count: 1;\n animation-iteration-count: 1;\n -webkit-transition-delay: 0s;\n transition-delay: 0s;\n -webkit-transition-duration: 0s;\n transition-duration: 0s;\n }\n}\n@-webkit-keyframes fa-beat {\n 0%, 90% {\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n 45% {\n -webkit-transform: scale(var(--fa-beat-scale, 1.25));\n transform: scale(var(--fa-beat-scale, 1.25));\n }\n}\n@keyframes fa-beat {\n 0%, 90% {\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n 45% {\n -webkit-transform: scale(var(--fa-beat-scale, 1.25));\n transform: scale(var(--fa-beat-scale, 1.25));\n }\n}\n@-webkit-keyframes fa-bounce {\n 0% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n 10% {\n -webkit-transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n }\n 30% {\n -webkit-transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n }\n 50% {\n -webkit-transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n }\n 57% {\n -webkit-transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n }\n 64% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n 100% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n}\n@keyframes fa-bounce {\n 0% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n 10% {\n -webkit-transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);\n }\n 30% {\n -webkit-transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));\n }\n 50% {\n -webkit-transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);\n }\n 57% {\n -webkit-transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));\n }\n 64% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n 100% {\n -webkit-transform: scale(1, 1) translateY(0);\n transform: scale(1, 1) translateY(0);\n }\n}\n@-webkit-keyframes fa-fade {\n 50% {\n opacity: var(--fa-fade-opacity, 0.4);\n }\n}\n@keyframes fa-fade {\n 50% {\n opacity: var(--fa-fade-opacity, 0.4);\n }\n}\n@-webkit-keyframes fa-beat-fade {\n 0%, 100% {\n opacity: var(--fa-beat-fade-opacity, 0.4);\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n 50% {\n opacity: 1;\n -webkit-transform: scale(var(--fa-beat-fade-scale, 1.125));\n transform: scale(var(--fa-beat-fade-scale, 1.125));\n }\n}\n@keyframes fa-beat-fade {\n 0%, 100% {\n opacity: var(--fa-beat-fade-opacity, 0.4);\n -webkit-transform: scale(1);\n transform: scale(1);\n }\n 50% {\n opacity: 1;\n -webkit-transform: scale(var(--fa-beat-fade-scale, 1.125));\n transform: scale(var(--fa-beat-fade-scale, 1.125));\n }\n}\n@-webkit-keyframes fa-flip {\n 50% {\n -webkit-transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n }\n}\n@keyframes fa-flip {\n 50% {\n -webkit-transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));\n }\n}\n@-webkit-keyframes fa-shake {\n 0% {\n -webkit-transform: rotate(-15deg);\n transform: rotate(-15deg);\n }\n 4% {\n -webkit-transform: rotate(15deg);\n transform: rotate(15deg);\n }\n 8%, 24% {\n -webkit-transform: rotate(-18deg);\n transform: rotate(-18deg);\n }\n 12%, 28% {\n -webkit-transform: rotate(18deg);\n transform: rotate(18deg);\n }\n 16% {\n -webkit-transform: rotate(-22deg);\n transform: rotate(-22deg);\n }\n 20% {\n -webkit-transform: rotate(22deg);\n transform: rotate(22deg);\n }\n 32% {\n -webkit-transform: rotate(-12deg);\n transform: rotate(-12deg);\n }\n 36% {\n -webkit-transform: rotate(12deg);\n transform: rotate(12deg);\n }\n 40%, 100% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n}\n@keyframes fa-shake {\n 0% {\n -webkit-transform: rotate(-15deg);\n transform: rotate(-15deg);\n }\n 4% {\n -webkit-transform: rotate(15deg);\n transform: rotate(15deg);\n }\n 8%, 24% {\n -webkit-transform: rotate(-18deg);\n transform: rotate(-18deg);\n }\n 12%, 28% {\n -webkit-transform: rotate(18deg);\n transform: rotate(18deg);\n }\n 16% {\n -webkit-transform: rotate(-22deg);\n transform: rotate(-22deg);\n }\n 20% {\n -webkit-transform: rotate(22deg);\n transform: rotate(22deg);\n }\n 32% {\n -webkit-transform: rotate(-12deg);\n transform: rotate(-12deg);\n }\n 36% {\n -webkit-transform: rotate(12deg);\n transform: rotate(12deg);\n }\n 40%, 100% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n}\n@-webkit-keyframes fa-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n@keyframes fa-spin {\n 0% {\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n.fa-rotate-90 {\n -webkit-transform: rotate(90deg);\n transform: rotate(90deg);\n}\n\n.fa-rotate-180 {\n -webkit-transform: rotate(180deg);\n transform: rotate(180deg);\n}\n\n.fa-rotate-270 {\n -webkit-transform: rotate(270deg);\n transform: rotate(270deg);\n}\n\n.fa-flip-horizontal {\n -webkit-transform: scale(-1, 1);\n transform: scale(-1, 1);\n}\n\n.fa-flip-vertical {\n -webkit-transform: scale(1, -1);\n transform: scale(1, -1);\n}\n\n.fa-flip-both,\n.fa-flip-horizontal.fa-flip-vertical {\n -webkit-transform: scale(-1, -1);\n transform: scale(-1, -1);\n}\n\n.fa-rotate-by {\n -webkit-transform: rotate(var(--fa-rotate-angle, 0));\n transform: rotate(var(--fa-rotate-angle, 0));\n}\n\n.fa-stack {\n display: inline-block;\n vertical-align: middle;\n height: 2em;\n position: relative;\n width: 2.5em;\n}\n\n.fa-stack-1x,\n.fa-stack-2x {\n bottom: 0;\n left: 0;\n margin: auto;\n position: absolute;\n right: 0;\n top: 0;\n z-index: var(--fa-stack-z-index, auto);\n}\n\n.svg-inline--fa.fa-stack-1x {\n height: 1em;\n width: 1.25em;\n}\n.svg-inline--fa.fa-stack-2x {\n height: 2em;\n width: 2.5em;\n}\n\n.fa-inverse {\n color: var(--fa-inverse, #fff);\n}\n\n.sr-only,\n.fa-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.sr-only-focusable:not(:focus),\n.fa-sr-only-focusable:not(:focus) {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border-width: 0;\n}\n\n.svg-inline--fa .fa-primary {\n fill: var(--fa-primary-color, currentColor);\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa .fa-secondary {\n fill: var(--fa-secondary-color, currentColor);\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-primary {\n opacity: var(--fa-secondary-opacity, 0.4);\n}\n\n.svg-inline--fa.fa-swap-opacity .fa-secondary {\n opacity: var(--fa-primary-opacity, 1);\n}\n\n.svg-inline--fa mask .fa-primary,\n.svg-inline--fa mask .fa-secondary {\n fill: black;\n}\n\n.fad.fa-inverse,\n.fa-duotone.fa-inverse {\n color: var(--fa-inverse, #fff);\n}';
|
|
function css() {
|
|
var dcp = DEFAULT_CSS_PREFIX;
|
|
var drc = DEFAULT_REPLACEMENT_CLASS;
|
|
var fp = config.cssPrefix;
|
|
var rc = config.replacementClass;
|
|
var s = baseStyles;
|
|
if (fp !== dcp || rc !== drc) {
|
|
var dPatt = new RegExp("\\.".concat(dcp, "\\-"), "g");
|
|
var customPropPatt = new RegExp("\\--".concat(dcp, "\\-"), "g");
|
|
var rPatt = new RegExp("\\.".concat(drc), "g");
|
|
s = s.replace(dPatt, ".".concat(fp, "-")).replace(customPropPatt, "--".concat(fp, "-")).replace(rPatt, ".".concat(rc));
|
|
}
|
|
return s;
|
|
}
|
|
var _cssInserted = false;
|
|
function ensureCss() {
|
|
if (config.autoAddCss && !_cssInserted) {
|
|
insertCss(css());
|
|
_cssInserted = true;
|
|
}
|
|
}
|
|
var InjectCSS = {
|
|
mixout: function mixout() {
|
|
return {
|
|
dom: {
|
|
css,
|
|
insertCss: ensureCss
|
|
}
|
|
};
|
|
},
|
|
hooks: function hooks() {
|
|
return {
|
|
beforeDOMElementCreation: function beforeDOMElementCreation() {
|
|
ensureCss();
|
|
},
|
|
beforeI2svg: function beforeI2svg() {
|
|
ensureCss();
|
|
}
|
|
};
|
|
}
|
|
};
|
|
var w = WINDOW || {};
|
|
if (!w[NAMESPACE_IDENTIFIER])
|
|
w[NAMESPACE_IDENTIFIER] = {};
|
|
if (!w[NAMESPACE_IDENTIFIER].styles)
|
|
w[NAMESPACE_IDENTIFIER].styles = {};
|
|
if (!w[NAMESPACE_IDENTIFIER].hooks)
|
|
w[NAMESPACE_IDENTIFIER].hooks = {};
|
|
if (!w[NAMESPACE_IDENTIFIER].shims)
|
|
w[NAMESPACE_IDENTIFIER].shims = [];
|
|
var namespace = w[NAMESPACE_IDENTIFIER];
|
|
var functions = [];
|
|
var listener2 = function listener3() {
|
|
DOCUMENT.removeEventListener("DOMContentLoaded", listener3);
|
|
loaded = 1;
|
|
functions.map(function(fn) {
|
|
return fn();
|
|
});
|
|
};
|
|
var loaded = false;
|
|
if (IS_DOM) {
|
|
loaded = (DOCUMENT.documentElement.doScroll ? /^loaded|^c/ : /^loaded|^i|^c/).test(DOCUMENT.readyState);
|
|
if (!loaded)
|
|
DOCUMENT.addEventListener("DOMContentLoaded", listener2);
|
|
}
|
|
function domready(fn) {
|
|
if (!IS_DOM)
|
|
return;
|
|
loaded ? setTimeout(fn, 0) : functions.push(fn);
|
|
}
|
|
function toHtml(abstractNodes) {
|
|
var tag = abstractNodes.tag, _abstractNodes$attrib = abstractNodes.attributes, attributes = _abstractNodes$attrib === void 0 ? {} : _abstractNodes$attrib, _abstractNodes$childr = abstractNodes.children, children = _abstractNodes$childr === void 0 ? [] : _abstractNodes$childr;
|
|
if (typeof abstractNodes === "string") {
|
|
return htmlEscape(abstractNodes);
|
|
} else {
|
|
return "<".concat(tag, " ").concat(joinAttributes(attributes), ">").concat(children.map(toHtml).join(""), "</").concat(tag, ">");
|
|
}
|
|
}
|
|
function iconFromMapping(mapping, prefix, iconName) {
|
|
if (mapping && mapping[prefix] && mapping[prefix][iconName]) {
|
|
return {
|
|
prefix,
|
|
iconName,
|
|
icon: mapping[prefix][iconName]
|
|
};
|
|
}
|
|
}
|
|
var bindInternal4 = function bindInternal42(func, thisContext) {
|
|
return function(a, b, c, d2) {
|
|
return func.call(thisContext, a, b, c, d2);
|
|
};
|
|
};
|
|
var reduce = function fastReduceObject(subject, fn, initialValue, thisContext) {
|
|
var keys2 = Object.keys(subject), length = keys2.length, iterator = thisContext !== void 0 ? bindInternal4(fn, thisContext) : fn, i, key, result;
|
|
if (initialValue === void 0) {
|
|
i = 1;
|
|
result = subject[keys2[0]];
|
|
} else {
|
|
i = 0;
|
|
result = initialValue;
|
|
}
|
|
for (; i < length; i++) {
|
|
key = keys2[i];
|
|
result = iterator(result, subject[key], key, subject);
|
|
}
|
|
return result;
|
|
};
|
|
function ucs2decode(string) {
|
|
var output = [];
|
|
var counter2 = 0;
|
|
var length = string.length;
|
|
while (counter2 < length) {
|
|
var value = string.charCodeAt(counter2++);
|
|
if (value >= 55296 && value <= 56319 && counter2 < length) {
|
|
var extra = string.charCodeAt(counter2++);
|
|
if ((extra & 64512) == 56320) {
|
|
output.push(((value & 1023) << 10) + (extra & 1023) + 65536);
|
|
} else {
|
|
output.push(value);
|
|
counter2--;
|
|
}
|
|
} else {
|
|
output.push(value);
|
|
}
|
|
}
|
|
return output;
|
|
}
|
|
function toHex(unicode) {
|
|
var decoded = ucs2decode(unicode);
|
|
return decoded.length === 1 ? decoded[0].toString(16) : null;
|
|
}
|
|
function codePointAt(string, index) {
|
|
var size = string.length;
|
|
var first = string.charCodeAt(index);
|
|
var second;
|
|
if (first >= 55296 && first <= 56319 && size > index + 1) {
|
|
second = string.charCodeAt(index + 1);
|
|
if (second >= 56320 && second <= 57343) {
|
|
return (first - 55296) * 1024 + second - 56320 + 65536;
|
|
}
|
|
}
|
|
return first;
|
|
}
|
|
function normalizeIcons(icons) {
|
|
return Object.keys(icons).reduce(function(acc, iconName) {
|
|
var icon3 = icons[iconName];
|
|
var expanded = !!icon3.icon;
|
|
if (expanded) {
|
|
acc[icon3.iconName] = icon3.icon;
|
|
} else {
|
|
acc[iconName] = icon3;
|
|
}
|
|
return acc;
|
|
}, {});
|
|
}
|
|
function defineIcons(prefix, icons) {
|
|
var params = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
var _params$skipHooks = params.skipHooks, skipHooks = _params$skipHooks === void 0 ? false : _params$skipHooks;
|
|
var normalized = normalizeIcons(icons);
|
|
if (typeof namespace.hooks.addPack === "function" && !skipHooks) {
|
|
namespace.hooks.addPack(prefix, normalizeIcons(icons));
|
|
} else {
|
|
namespace.styles[prefix] = _objectSpread2(_objectSpread2({}, namespace.styles[prefix] || {}), normalized);
|
|
}
|
|
if (prefix === "fas") {
|
|
defineIcons("fa", icons);
|
|
}
|
|
}
|
|
var _LONG_STYLE;
|
|
var _PREFIXES;
|
|
var _PREFIXES_FOR_FAMILY;
|
|
var styles = namespace.styles;
|
|
var shims = namespace.shims;
|
|
var LONG_STYLE = (_LONG_STYLE = {}, _defineProperty(_LONG_STYLE, FAMILY_CLASSIC, Object.values(PREFIX_TO_LONG_STYLE[FAMILY_CLASSIC])), _defineProperty(_LONG_STYLE, FAMILY_SHARP, Object.values(PREFIX_TO_LONG_STYLE[FAMILY_SHARP])), _LONG_STYLE);
|
|
var _defaultUsablePrefix = null;
|
|
var _byUnicode = {};
|
|
var _byLigature = {};
|
|
var _byOldName = {};
|
|
var _byOldUnicode = {};
|
|
var _byAlias = {};
|
|
var PREFIXES = (_PREFIXES = {}, _defineProperty(_PREFIXES, FAMILY_CLASSIC, Object.keys(PREFIX_TO_STYLE[FAMILY_CLASSIC])), _defineProperty(_PREFIXES, FAMILY_SHARP, Object.keys(PREFIX_TO_STYLE[FAMILY_SHARP])), _PREFIXES);
|
|
function isReserved(name) {
|
|
return ~RESERVED_CLASSES.indexOf(name);
|
|
}
|
|
function getIconName(cssPrefix, cls) {
|
|
var parts = cls.split("-");
|
|
var prefix = parts[0];
|
|
var iconName = parts.slice(1).join("-");
|
|
if (prefix === cssPrefix && iconName !== "" && !isReserved(iconName)) {
|
|
return iconName;
|
|
} else {
|
|
return null;
|
|
}
|
|
}
|
|
var build = function build2() {
|
|
var lookup = function lookup2(reducer) {
|
|
return reduce(styles, function(o, style, prefix) {
|
|
o[prefix] = reduce(style, reducer, {});
|
|
return o;
|
|
}, {});
|
|
};
|
|
_byUnicode = lookup(function(acc, icon3, iconName) {
|
|
if (icon3[3]) {
|
|
acc[icon3[3]] = iconName;
|
|
}
|
|
if (icon3[2]) {
|
|
var aliases = icon3[2].filter(function(a) {
|
|
return typeof a === "number";
|
|
});
|
|
aliases.forEach(function(alias) {
|
|
acc[alias.toString(16)] = iconName;
|
|
});
|
|
}
|
|
return acc;
|
|
});
|
|
_byLigature = lookup(function(acc, icon3, iconName) {
|
|
acc[iconName] = iconName;
|
|
if (icon3[2]) {
|
|
var aliases = icon3[2].filter(function(a) {
|
|
return typeof a === "string";
|
|
});
|
|
aliases.forEach(function(alias) {
|
|
acc[alias] = iconName;
|
|
});
|
|
}
|
|
return acc;
|
|
});
|
|
_byAlias = lookup(function(acc, icon3, iconName) {
|
|
var aliases = icon3[2];
|
|
acc[iconName] = iconName;
|
|
aliases.forEach(function(alias) {
|
|
acc[alias] = iconName;
|
|
});
|
|
return acc;
|
|
});
|
|
var hasRegular = "far" in styles || config.autoFetchSvg;
|
|
var shimLookups = reduce(shims, function(acc, shim) {
|
|
var maybeNameMaybeUnicode = shim[0];
|
|
var prefix = shim[1];
|
|
var iconName = shim[2];
|
|
if (prefix === "far" && !hasRegular) {
|
|
prefix = "fas";
|
|
}
|
|
if (typeof maybeNameMaybeUnicode === "string") {
|
|
acc.names[maybeNameMaybeUnicode] = {
|
|
prefix,
|
|
iconName
|
|
};
|
|
}
|
|
if (typeof maybeNameMaybeUnicode === "number") {
|
|
acc.unicodes[maybeNameMaybeUnicode.toString(16)] = {
|
|
prefix,
|
|
iconName
|
|
};
|
|
}
|
|
return acc;
|
|
}, {
|
|
names: {},
|
|
unicodes: {}
|
|
});
|
|
_byOldName = shimLookups.names;
|
|
_byOldUnicode = shimLookups.unicodes;
|
|
_defaultUsablePrefix = getCanonicalPrefix(config.styleDefault, {
|
|
family: config.familyDefault
|
|
});
|
|
};
|
|
onChange(function(c) {
|
|
_defaultUsablePrefix = getCanonicalPrefix(c.styleDefault, {
|
|
family: config.familyDefault
|
|
});
|
|
});
|
|
build();
|
|
function byUnicode(prefix, unicode) {
|
|
return (_byUnicode[prefix] || {})[unicode];
|
|
}
|
|
function byLigature(prefix, ligature) {
|
|
return (_byLigature[prefix] || {})[ligature];
|
|
}
|
|
function byAlias(prefix, alias) {
|
|
return (_byAlias[prefix] || {})[alias];
|
|
}
|
|
function byOldName(name) {
|
|
return _byOldName[name] || {
|
|
prefix: null,
|
|
iconName: null
|
|
};
|
|
}
|
|
function byOldUnicode(unicode) {
|
|
var oldUnicode = _byOldUnicode[unicode];
|
|
var newUnicode = byUnicode("fas", unicode);
|
|
return oldUnicode || (newUnicode ? {
|
|
prefix: "fas",
|
|
iconName: newUnicode
|
|
} : null) || {
|
|
prefix: null,
|
|
iconName: null
|
|
};
|
|
}
|
|
function getDefaultUsablePrefix() {
|
|
return _defaultUsablePrefix;
|
|
}
|
|
var emptyCanonicalIcon = function emptyCanonicalIcon2() {
|
|
return {
|
|
prefix: null,
|
|
iconName: null,
|
|
rest: []
|
|
};
|
|
};
|
|
function getCanonicalPrefix(styleOrPrefix) {
|
|
var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
var _params$family = params.family, family = _params$family === void 0 ? FAMILY_CLASSIC : _params$family;
|
|
var style = PREFIX_TO_STYLE[family][styleOrPrefix];
|
|
var prefix = STYLE_TO_PREFIX[family][styleOrPrefix] || STYLE_TO_PREFIX[family][style];
|
|
var defined = styleOrPrefix in namespace.styles ? styleOrPrefix : null;
|
|
return prefix || defined || null;
|
|
}
|
|
var PREFIXES_FOR_FAMILY = (_PREFIXES_FOR_FAMILY = {}, _defineProperty(_PREFIXES_FOR_FAMILY, FAMILY_CLASSIC, Object.keys(PREFIX_TO_LONG_STYLE[FAMILY_CLASSIC])), _defineProperty(_PREFIXES_FOR_FAMILY, FAMILY_SHARP, Object.keys(PREFIX_TO_LONG_STYLE[FAMILY_SHARP])), _PREFIXES_FOR_FAMILY);
|
|
function getCanonicalIcon(values) {
|
|
var _famProps;
|
|
var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
var _params$skipLookups = params.skipLookups, skipLookups = _params$skipLookups === void 0 ? false : _params$skipLookups;
|
|
var famProps = (_famProps = {}, _defineProperty(_famProps, FAMILY_CLASSIC, "".concat(config.cssPrefix, "-").concat(FAMILY_CLASSIC)), _defineProperty(_famProps, FAMILY_SHARP, "".concat(config.cssPrefix, "-").concat(FAMILY_SHARP)), _famProps);
|
|
var givenPrefix = null;
|
|
var family = FAMILY_CLASSIC;
|
|
if (values.includes(famProps[FAMILY_CLASSIC]) || values.some(function(v) {
|
|
return PREFIXES_FOR_FAMILY[FAMILY_CLASSIC].includes(v);
|
|
})) {
|
|
family = FAMILY_CLASSIC;
|
|
}
|
|
if (values.includes(famProps[FAMILY_SHARP]) || values.some(function(v) {
|
|
return PREFIXES_FOR_FAMILY[FAMILY_SHARP].includes(v);
|
|
})) {
|
|
family = FAMILY_SHARP;
|
|
}
|
|
var canonical = values.reduce(function(acc, cls) {
|
|
var iconName = getIconName(config.cssPrefix, cls);
|
|
if (styles[cls]) {
|
|
cls = LONG_STYLE[family].includes(cls) ? LONG_STYLE_TO_PREFIX[family][cls] : cls;
|
|
givenPrefix = cls;
|
|
acc.prefix = cls;
|
|
} else if (PREFIXES[family].indexOf(cls) > -1) {
|
|
givenPrefix = cls;
|
|
acc.prefix = getCanonicalPrefix(cls, {
|
|
family
|
|
});
|
|
} else if (iconName) {
|
|
acc.iconName = iconName;
|
|
} else if (cls !== config.replacementClass && cls !== famProps[FAMILY_CLASSIC] && cls !== famProps[FAMILY_SHARP]) {
|
|
acc.rest.push(cls);
|
|
}
|
|
if (!skipLookups && acc.prefix && acc.iconName) {
|
|
var shim = givenPrefix === "fa" ? byOldName(acc.iconName) : {};
|
|
var aliasIconName = byAlias(acc.prefix, acc.iconName);
|
|
if (shim.prefix) {
|
|
givenPrefix = null;
|
|
}
|
|
acc.iconName = shim.iconName || aliasIconName || acc.iconName;
|
|
acc.prefix = shim.prefix || acc.prefix;
|
|
if (acc.prefix === "far" && !styles["far"] && styles["fas"] && !config.autoFetchSvg) {
|
|
acc.prefix = "fas";
|
|
}
|
|
}
|
|
return acc;
|
|
}, emptyCanonicalIcon());
|
|
if (values.includes("fa-brands") || values.includes("fab")) {
|
|
canonical.prefix = "fab";
|
|
}
|
|
if (values.includes("fa-duotone") || values.includes("fad")) {
|
|
canonical.prefix = "fad";
|
|
}
|
|
if (!canonical.prefix && family === FAMILY_SHARP && (styles["fass"] || config.autoFetchSvg)) {
|
|
canonical.prefix = "fass";
|
|
canonical.iconName = byAlias(canonical.prefix, canonical.iconName) || canonical.iconName;
|
|
}
|
|
if (canonical.prefix === "fa" || givenPrefix === "fa") {
|
|
canonical.prefix = getDefaultUsablePrefix() || "fas";
|
|
}
|
|
return canonical;
|
|
}
|
|
var Library = /* @__PURE__ */ function() {
|
|
function Library2() {
|
|
_classCallCheck(this, Library2);
|
|
this.definitions = {};
|
|
}
|
|
_createClass(Library2, [{
|
|
key: "add",
|
|
value: function add() {
|
|
var _this = this;
|
|
for (var _len = arguments.length, definitions = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
definitions[_key] = arguments[_key];
|
|
}
|
|
var additions = definitions.reduce(this._pullDefinitions, {});
|
|
Object.keys(additions).forEach(function(key) {
|
|
_this.definitions[key] = _objectSpread2(_objectSpread2({}, _this.definitions[key] || {}), additions[key]);
|
|
defineIcons(key, additions[key]);
|
|
var longPrefix = PREFIX_TO_LONG_STYLE[FAMILY_CLASSIC][key];
|
|
if (longPrefix)
|
|
defineIcons(longPrefix, additions[key]);
|
|
build();
|
|
});
|
|
}
|
|
}, {
|
|
key: "reset",
|
|
value: function reset() {
|
|
this.definitions = {};
|
|
}
|
|
}, {
|
|
key: "_pullDefinitions",
|
|
value: function _pullDefinitions(additions, definition) {
|
|
var normalized = definition.prefix && definition.iconName && definition.icon ? {
|
|
0: definition
|
|
} : definition;
|
|
Object.keys(normalized).map(function(key) {
|
|
var _normalized$key = normalized[key], prefix = _normalized$key.prefix, iconName = _normalized$key.iconName, icon3 = _normalized$key.icon;
|
|
var aliases = icon3[2];
|
|
if (!additions[prefix])
|
|
additions[prefix] = {};
|
|
if (aliases.length > 0) {
|
|
aliases.forEach(function(alias) {
|
|
if (typeof alias === "string") {
|
|
additions[prefix][alias] = icon3;
|
|
}
|
|
});
|
|
}
|
|
additions[prefix][iconName] = icon3;
|
|
});
|
|
return additions;
|
|
}
|
|
}]);
|
|
return Library2;
|
|
}();
|
|
var _plugins = [];
|
|
var _hooks = {};
|
|
var providers = {};
|
|
var defaultProviderKeys = Object.keys(providers);
|
|
function registerPlugins(nextPlugins, _ref2) {
|
|
var obj = _ref2.mixoutsTo;
|
|
_plugins = nextPlugins;
|
|
_hooks = {};
|
|
Object.keys(providers).forEach(function(k) {
|
|
if (defaultProviderKeys.indexOf(k) === -1) {
|
|
delete providers[k];
|
|
}
|
|
});
|
|
_plugins.forEach(function(plugin) {
|
|
var mixout8 = plugin.mixout ? plugin.mixout() : {};
|
|
Object.keys(mixout8).forEach(function(tk) {
|
|
if (typeof mixout8[tk] === "function") {
|
|
obj[tk] = mixout8[tk];
|
|
}
|
|
if (_typeof(mixout8[tk]) === "object") {
|
|
Object.keys(mixout8[tk]).forEach(function(sk) {
|
|
if (!obj[tk]) {
|
|
obj[tk] = {};
|
|
}
|
|
obj[tk][sk] = mixout8[tk][sk];
|
|
});
|
|
}
|
|
});
|
|
if (plugin.hooks) {
|
|
var hooks8 = plugin.hooks();
|
|
Object.keys(hooks8).forEach(function(hook) {
|
|
if (!_hooks[hook]) {
|
|
_hooks[hook] = [];
|
|
}
|
|
_hooks[hook].push(hooks8[hook]);
|
|
});
|
|
}
|
|
if (plugin.provides) {
|
|
plugin.provides(providers);
|
|
}
|
|
});
|
|
return obj;
|
|
}
|
|
function chainHooks(hook, accumulator) {
|
|
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
args[_key - 2] = arguments[_key];
|
|
}
|
|
var hookFns = _hooks[hook] || [];
|
|
hookFns.forEach(function(hookFn) {
|
|
accumulator = hookFn.apply(null, [accumulator].concat(args));
|
|
});
|
|
return accumulator;
|
|
}
|
|
function callHooks(hook) {
|
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
args[_key2 - 1] = arguments[_key2];
|
|
}
|
|
var hookFns = _hooks[hook] || [];
|
|
hookFns.forEach(function(hookFn) {
|
|
hookFn.apply(null, args);
|
|
});
|
|
return void 0;
|
|
}
|
|
function callProvided() {
|
|
var hook = arguments[0];
|
|
var args = Array.prototype.slice.call(arguments, 1);
|
|
return providers[hook] ? providers[hook].apply(null, args) : void 0;
|
|
}
|
|
function findIconDefinition(iconLookup) {
|
|
if (iconLookup.prefix === "fa") {
|
|
iconLookup.prefix = "fas";
|
|
}
|
|
var iconName = iconLookup.iconName;
|
|
var prefix = iconLookup.prefix || getDefaultUsablePrefix();
|
|
if (!iconName)
|
|
return;
|
|
iconName = byAlias(prefix, iconName) || iconName;
|
|
return iconFromMapping(library.definitions, prefix, iconName) || iconFromMapping(namespace.styles, prefix, iconName);
|
|
}
|
|
var library = new Library();
|
|
var noAuto = function noAuto2() {
|
|
config.autoReplaceSvg = false;
|
|
config.observeMutations = false;
|
|
callHooks("noAuto");
|
|
};
|
|
var dom = {
|
|
i2svg: function i2svg() {
|
|
var params = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
if (IS_DOM) {
|
|
callHooks("beforeI2svg", params);
|
|
callProvided("pseudoElements2svg", params);
|
|
return callProvided("i2svg", params);
|
|
} else {
|
|
return Promise.reject("Operation requires a DOM of some kind.");
|
|
}
|
|
},
|
|
watch: function watch() {
|
|
var params = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
var autoReplaceSvgRoot = params.autoReplaceSvgRoot;
|
|
if (config.autoReplaceSvg === false) {
|
|
config.autoReplaceSvg = true;
|
|
}
|
|
config.observeMutations = true;
|
|
domready(function() {
|
|
autoReplace({
|
|
autoReplaceSvgRoot
|
|
});
|
|
callHooks("watch", params);
|
|
});
|
|
}
|
|
};
|
|
var parse = {
|
|
icon: function icon(_icon) {
|
|
if (_icon === null) {
|
|
return null;
|
|
}
|
|
if (_typeof(_icon) === "object" && _icon.prefix && _icon.iconName) {
|
|
return {
|
|
prefix: _icon.prefix,
|
|
iconName: byAlias(_icon.prefix, _icon.iconName) || _icon.iconName
|
|
};
|
|
}
|
|
if (Array.isArray(_icon) && _icon.length === 2) {
|
|
var iconName = _icon[1].indexOf("fa-") === 0 ? _icon[1].slice(3) : _icon[1];
|
|
var prefix = getCanonicalPrefix(_icon[0]);
|
|
return {
|
|
prefix,
|
|
iconName: byAlias(prefix, iconName) || iconName
|
|
};
|
|
}
|
|
if (typeof _icon === "string" && (_icon.indexOf("".concat(config.cssPrefix, "-")) > -1 || _icon.match(ICON_SELECTION_SYNTAX_PATTERN))) {
|
|
var canonicalIcon = getCanonicalIcon(_icon.split(" "), {
|
|
skipLookups: true
|
|
});
|
|
return {
|
|
prefix: canonicalIcon.prefix || getDefaultUsablePrefix(),
|
|
iconName: byAlias(canonicalIcon.prefix, canonicalIcon.iconName) || canonicalIcon.iconName
|
|
};
|
|
}
|
|
if (typeof _icon === "string") {
|
|
var _prefix = getDefaultUsablePrefix();
|
|
return {
|
|
prefix: _prefix,
|
|
iconName: byAlias(_prefix, _icon) || _icon
|
|
};
|
|
}
|
|
}
|
|
};
|
|
var api = {
|
|
noAuto,
|
|
config,
|
|
dom,
|
|
parse,
|
|
library,
|
|
findIconDefinition,
|
|
toHtml
|
|
};
|
|
var autoReplace = function autoReplace2() {
|
|
var params = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
var _params$autoReplaceSv = params.autoReplaceSvgRoot, autoReplaceSvgRoot = _params$autoReplaceSv === void 0 ? DOCUMENT : _params$autoReplaceSv;
|
|
if ((Object.keys(namespace.styles).length > 0 || config.autoFetchSvg) && IS_DOM && config.autoReplaceSvg)
|
|
api.dom.i2svg({
|
|
node: autoReplaceSvgRoot
|
|
});
|
|
};
|
|
function domVariants(val, abstractCreator) {
|
|
Object.defineProperty(val, "abstract", {
|
|
get: abstractCreator
|
|
});
|
|
Object.defineProperty(val, "html", {
|
|
get: function get2() {
|
|
return val.abstract.map(function(a) {
|
|
return toHtml(a);
|
|
});
|
|
}
|
|
});
|
|
Object.defineProperty(val, "node", {
|
|
get: function get2() {
|
|
if (!IS_DOM)
|
|
return;
|
|
var container = DOCUMENT.createElement("div");
|
|
container.innerHTML = val.html;
|
|
return container.children;
|
|
}
|
|
});
|
|
return val;
|
|
}
|
|
function asIcon(_ref2) {
|
|
var children = _ref2.children, main = _ref2.main, mask = _ref2.mask, attributes = _ref2.attributes, styles2 = _ref2.styles, transform = _ref2.transform;
|
|
if (transformIsMeaningful(transform) && main.found && !mask.found) {
|
|
var width = main.width, height = main.height;
|
|
var offset = {
|
|
x: width / height / 2,
|
|
y: 0.5
|
|
};
|
|
attributes["style"] = joinStyles(_objectSpread2(_objectSpread2({}, styles2), {}, {
|
|
"transform-origin": "".concat(offset.x + transform.x / 16, "em ").concat(offset.y + transform.y / 16, "em")
|
|
}));
|
|
}
|
|
return [{
|
|
tag: "svg",
|
|
attributes,
|
|
children
|
|
}];
|
|
}
|
|
function asSymbol(_ref2) {
|
|
var prefix = _ref2.prefix, iconName = _ref2.iconName, children = _ref2.children, attributes = _ref2.attributes, symbol = _ref2.symbol;
|
|
var id = symbol === true ? "".concat(prefix, "-").concat(config.cssPrefix, "-").concat(iconName) : symbol;
|
|
return [{
|
|
tag: "svg",
|
|
attributes: {
|
|
style: "display: none;"
|
|
},
|
|
children: [{
|
|
tag: "symbol",
|
|
attributes: _objectSpread2(_objectSpread2({}, attributes), {}, {
|
|
id
|
|
}),
|
|
children
|
|
}]
|
|
}];
|
|
}
|
|
function makeInlineSvgAbstract(params) {
|
|
var _params$icons = params.icons, main = _params$icons.main, mask = _params$icons.mask, prefix = params.prefix, iconName = params.iconName, transform = params.transform, symbol = params.symbol, title = params.title, maskId = params.maskId, titleId = params.titleId, extra = params.extra, _params$watchable = params.watchable, watchable = _params$watchable === void 0 ? false : _params$watchable;
|
|
var _ref2 = mask.found ? mask : main, width = _ref2.width, height = _ref2.height;
|
|
var isUploadedIcon = prefix === "fak";
|
|
var attrClass = [config.replacementClass, iconName ? "".concat(config.cssPrefix, "-").concat(iconName) : ""].filter(function(c) {
|
|
return extra.classes.indexOf(c) === -1;
|
|
}).filter(function(c) {
|
|
return c !== "" || !!c;
|
|
}).concat(extra.classes).join(" ");
|
|
var content = {
|
|
children: [],
|
|
attributes: _objectSpread2(_objectSpread2({}, extra.attributes), {}, {
|
|
"data-prefix": prefix,
|
|
"data-icon": iconName,
|
|
"class": attrClass,
|
|
"role": extra.attributes.role || "img",
|
|
"xmlns": "http://www.w3.org/2000/svg",
|
|
"viewBox": "0 0 ".concat(width, " ").concat(height)
|
|
})
|
|
};
|
|
var uploadedIconWidthStyle = isUploadedIcon && !~extra.classes.indexOf("fa-fw") ? {
|
|
width: "".concat(width / height * 16 * 0.0625, "em")
|
|
} : {};
|
|
if (watchable) {
|
|
content.attributes[DATA_FA_I2SVG] = "";
|
|
}
|
|
if (title) {
|
|
content.children.push({
|
|
tag: "title",
|
|
attributes: {
|
|
id: content.attributes["aria-labelledby"] || "title-".concat(titleId || nextUniqueId())
|
|
},
|
|
children: [title]
|
|
});
|
|
delete content.attributes.title;
|
|
}
|
|
var args = _objectSpread2(_objectSpread2({}, content), {}, {
|
|
prefix,
|
|
iconName,
|
|
main,
|
|
mask,
|
|
maskId,
|
|
transform,
|
|
symbol,
|
|
styles: _objectSpread2(_objectSpread2({}, uploadedIconWidthStyle), extra.styles)
|
|
});
|
|
var _ref22 = mask.found && main.found ? callProvided("generateAbstractMask", args) || {
|
|
children: [],
|
|
attributes: {}
|
|
} : callProvided("generateAbstractIcon", args) || {
|
|
children: [],
|
|
attributes: {}
|
|
}, children = _ref22.children, attributes = _ref22.attributes;
|
|
args.children = children;
|
|
args.attributes = attributes;
|
|
if (symbol) {
|
|
return asSymbol(args);
|
|
} else {
|
|
return asIcon(args);
|
|
}
|
|
}
|
|
function makeLayersTextAbstract(params) {
|
|
var content = params.content, width = params.width, height = params.height, transform = params.transform, title = params.title, extra = params.extra, _params$watchable2 = params.watchable, watchable = _params$watchable2 === void 0 ? false : _params$watchable2;
|
|
var attributes = _objectSpread2(_objectSpread2(_objectSpread2({}, extra.attributes), title ? {
|
|
"title": title
|
|
} : {}), {}, {
|
|
"class": extra.classes.join(" ")
|
|
});
|
|
if (watchable) {
|
|
attributes[DATA_FA_I2SVG] = "";
|
|
}
|
|
var styles2 = _objectSpread2({}, extra.styles);
|
|
if (transformIsMeaningful(transform)) {
|
|
styles2["transform"] = transformForCss({
|
|
transform,
|
|
startCentered: true,
|
|
width,
|
|
height
|
|
});
|
|
styles2["-webkit-transform"] = styles2["transform"];
|
|
}
|
|
var styleString = joinStyles(styles2);
|
|
if (styleString.length > 0) {
|
|
attributes["style"] = styleString;
|
|
}
|
|
var val = [];
|
|
val.push({
|
|
tag: "span",
|
|
attributes,
|
|
children: [content]
|
|
});
|
|
if (title) {
|
|
val.push({
|
|
tag: "span",
|
|
attributes: {
|
|
class: "sr-only"
|
|
},
|
|
children: [title]
|
|
});
|
|
}
|
|
return val;
|
|
}
|
|
function makeLayersCounterAbstract(params) {
|
|
var content = params.content, title = params.title, extra = params.extra;
|
|
var attributes = _objectSpread2(_objectSpread2(_objectSpread2({}, extra.attributes), title ? {
|
|
"title": title
|
|
} : {}), {}, {
|
|
"class": extra.classes.join(" ")
|
|
});
|
|
var styleString = joinStyles(extra.styles);
|
|
if (styleString.length > 0) {
|
|
attributes["style"] = styleString;
|
|
}
|
|
var val = [];
|
|
val.push({
|
|
tag: "span",
|
|
attributes,
|
|
children: [content]
|
|
});
|
|
if (title) {
|
|
val.push({
|
|
tag: "span",
|
|
attributes: {
|
|
class: "sr-only"
|
|
},
|
|
children: [title]
|
|
});
|
|
}
|
|
return val;
|
|
}
|
|
var styles$1 = namespace.styles;
|
|
function asFoundIcon(icon3) {
|
|
var width = icon3[0];
|
|
var height = icon3[1];
|
|
var _icon$slice = icon3.slice(4), _icon$slice2 = _slicedToArray(_icon$slice, 1), vectorData = _icon$slice2[0];
|
|
var element = null;
|
|
if (Array.isArray(vectorData)) {
|
|
element = {
|
|
tag: "g",
|
|
attributes: {
|
|
class: "".concat(config.cssPrefix, "-").concat(DUOTONE_CLASSES.GROUP)
|
|
},
|
|
children: [{
|
|
tag: "path",
|
|
attributes: {
|
|
class: "".concat(config.cssPrefix, "-").concat(DUOTONE_CLASSES.SECONDARY),
|
|
fill: "currentColor",
|
|
d: vectorData[0]
|
|
}
|
|
}, {
|
|
tag: "path",
|
|
attributes: {
|
|
class: "".concat(config.cssPrefix, "-").concat(DUOTONE_CLASSES.PRIMARY),
|
|
fill: "currentColor",
|
|
d: vectorData[1]
|
|
}
|
|
}]
|
|
};
|
|
} else {
|
|
element = {
|
|
tag: "path",
|
|
attributes: {
|
|
fill: "currentColor",
|
|
d: vectorData
|
|
}
|
|
};
|
|
}
|
|
return {
|
|
found: true,
|
|
width,
|
|
height,
|
|
icon: element
|
|
};
|
|
}
|
|
var missingIconResolutionMixin = {
|
|
found: false,
|
|
width: 512,
|
|
height: 512
|
|
};
|
|
function maybeNotifyMissing(iconName, prefix) {
|
|
if (!PRODUCTION && !config.showMissingIcons && iconName) {
|
|
console.error('Icon with name "'.concat(iconName, '" and prefix "').concat(prefix, '" is missing.'));
|
|
}
|
|
}
|
|
function findIcon(iconName, prefix) {
|
|
var givenPrefix = prefix;
|
|
if (prefix === "fa" && config.styleDefault !== null) {
|
|
prefix = getDefaultUsablePrefix();
|
|
}
|
|
return new Promise(function(resolve, reject) {
|
|
var val = {
|
|
found: false,
|
|
width: 512,
|
|
height: 512,
|
|
icon: callProvided("missingIconAbstract") || {}
|
|
};
|
|
if (givenPrefix === "fa") {
|
|
var shim = byOldName(iconName) || {};
|
|
iconName = shim.iconName || iconName;
|
|
prefix = shim.prefix || prefix;
|
|
}
|
|
if (iconName && prefix && styles$1[prefix] && styles$1[prefix][iconName]) {
|
|
var icon3 = styles$1[prefix][iconName];
|
|
return resolve(asFoundIcon(icon3));
|
|
}
|
|
maybeNotifyMissing(iconName, prefix);
|
|
resolve(_objectSpread2(_objectSpread2({}, missingIconResolutionMixin), {}, {
|
|
icon: config.showMissingIcons && iconName ? callProvided("missingIconAbstract") || {} : {}
|
|
}));
|
|
});
|
|
}
|
|
var noop$1 = function noop4() {
|
|
};
|
|
var p = config.measurePerformance && PERFORMANCE && PERFORMANCE.mark && PERFORMANCE.measure ? PERFORMANCE : {
|
|
mark: noop$1,
|
|
measure: noop$1
|
|
};
|
|
var preamble = 'FA "6.5.2"';
|
|
var begin = function begin2(name) {
|
|
p.mark("".concat(preamble, " ").concat(name, " begins"));
|
|
return function() {
|
|
return end(name);
|
|
};
|
|
};
|
|
var end = function end2(name) {
|
|
p.mark("".concat(preamble, " ").concat(name, " ends"));
|
|
p.measure("".concat(preamble, " ").concat(name), "".concat(preamble, " ").concat(name, " begins"), "".concat(preamble, " ").concat(name, " ends"));
|
|
};
|
|
var perf = {
|
|
begin,
|
|
end
|
|
};
|
|
var noop$2 = function noop5() {
|
|
};
|
|
function isWatched(node) {
|
|
var i2svg2 = node.getAttribute ? node.getAttribute(DATA_FA_I2SVG) : null;
|
|
return typeof i2svg2 === "string";
|
|
}
|
|
function hasPrefixAndIcon(node) {
|
|
var prefix = node.getAttribute ? node.getAttribute(DATA_PREFIX) : null;
|
|
var icon3 = node.getAttribute ? node.getAttribute(DATA_ICON) : null;
|
|
return prefix && icon3;
|
|
}
|
|
function hasBeenReplaced(node) {
|
|
return node && node.classList && node.classList.contains && node.classList.contains(config.replacementClass);
|
|
}
|
|
function getMutator() {
|
|
if (config.autoReplaceSvg === true) {
|
|
return mutators.replace;
|
|
}
|
|
var mutator = mutators[config.autoReplaceSvg];
|
|
return mutator || mutators.replace;
|
|
}
|
|
function createElementNS(tag) {
|
|
return DOCUMENT.createElementNS("http://www.w3.org/2000/svg", tag);
|
|
}
|
|
function createElement(tag) {
|
|
return DOCUMENT.createElement(tag);
|
|
}
|
|
function convertSVG(abstractObj) {
|
|
var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
var _params$ceFn = params.ceFn, ceFn = _params$ceFn === void 0 ? abstractObj.tag === "svg" ? createElementNS : createElement : _params$ceFn;
|
|
if (typeof abstractObj === "string") {
|
|
return DOCUMENT.createTextNode(abstractObj);
|
|
}
|
|
var tag = ceFn(abstractObj.tag);
|
|
Object.keys(abstractObj.attributes || []).forEach(function(key) {
|
|
tag.setAttribute(key, abstractObj.attributes[key]);
|
|
});
|
|
var children = abstractObj.children || [];
|
|
children.forEach(function(child) {
|
|
tag.appendChild(convertSVG(child, {
|
|
ceFn
|
|
}));
|
|
});
|
|
return tag;
|
|
}
|
|
function nodeAsComment(node) {
|
|
var comment = " ".concat(node.outerHTML, " ");
|
|
comment = "".concat(comment, "Font Awesome fontawesome.com ");
|
|
return comment;
|
|
}
|
|
var mutators = {
|
|
replace: function replace(mutation) {
|
|
var node = mutation[0];
|
|
if (node.parentNode) {
|
|
mutation[1].forEach(function(_abstract) {
|
|
node.parentNode.insertBefore(convertSVG(_abstract), node);
|
|
});
|
|
if (node.getAttribute(DATA_FA_I2SVG) === null && config.keepOriginalSource) {
|
|
var comment = DOCUMENT.createComment(nodeAsComment(node));
|
|
node.parentNode.replaceChild(comment, node);
|
|
} else {
|
|
node.remove();
|
|
}
|
|
}
|
|
},
|
|
nest: function nest(mutation) {
|
|
var node = mutation[0];
|
|
var _abstract2 = mutation[1];
|
|
if (~classArray(node).indexOf(config.replacementClass)) {
|
|
return mutators.replace(mutation);
|
|
}
|
|
var forSvg = new RegExp("".concat(config.cssPrefix, "-.*"));
|
|
delete _abstract2[0].attributes.id;
|
|
if (_abstract2[0].attributes.class) {
|
|
var splitClasses = _abstract2[0].attributes.class.split(" ").reduce(function(acc, cls) {
|
|
if (cls === config.replacementClass || cls.match(forSvg)) {
|
|
acc.toSvg.push(cls);
|
|
} else {
|
|
acc.toNode.push(cls);
|
|
}
|
|
return acc;
|
|
}, {
|
|
toNode: [],
|
|
toSvg: []
|
|
});
|
|
_abstract2[0].attributes.class = splitClasses.toSvg.join(" ");
|
|
if (splitClasses.toNode.length === 0) {
|
|
node.removeAttribute("class");
|
|
} else {
|
|
node.setAttribute("class", splitClasses.toNode.join(" "));
|
|
}
|
|
}
|
|
var newInnerHTML = _abstract2.map(function(a) {
|
|
return toHtml(a);
|
|
}).join("\n");
|
|
node.setAttribute(DATA_FA_I2SVG, "");
|
|
node.innerHTML = newInnerHTML;
|
|
}
|
|
};
|
|
function performOperationSync(op) {
|
|
op();
|
|
}
|
|
function perform(mutations, callback) {
|
|
var callbackFunction = typeof callback === "function" ? callback : noop$2;
|
|
if (mutations.length === 0) {
|
|
callbackFunction();
|
|
} else {
|
|
var frame = performOperationSync;
|
|
if (config.mutateApproach === MUTATION_APPROACH_ASYNC) {
|
|
frame = WINDOW.requestAnimationFrame || performOperationSync;
|
|
}
|
|
frame(function() {
|
|
var mutator = getMutator();
|
|
var mark = perf.begin("mutate");
|
|
mutations.map(mutator);
|
|
mark();
|
|
callbackFunction();
|
|
});
|
|
}
|
|
}
|
|
var disabled = false;
|
|
function disableObservation() {
|
|
disabled = true;
|
|
}
|
|
function enableObservation() {
|
|
disabled = false;
|
|
}
|
|
var mo = null;
|
|
function observe(options) {
|
|
if (!MUTATION_OBSERVER) {
|
|
return;
|
|
}
|
|
if (!config.observeMutations) {
|
|
return;
|
|
}
|
|
var _options$treeCallback = options.treeCallback, treeCallback = _options$treeCallback === void 0 ? noop$2 : _options$treeCallback, _options$nodeCallback = options.nodeCallback, nodeCallback = _options$nodeCallback === void 0 ? noop$2 : _options$nodeCallback, _options$pseudoElemen = options.pseudoElementsCallback, pseudoElementsCallback = _options$pseudoElemen === void 0 ? noop$2 : _options$pseudoElemen, _options$observeMutat = options.observeMutationsRoot, observeMutationsRoot = _options$observeMutat === void 0 ? DOCUMENT : _options$observeMutat;
|
|
mo = new MUTATION_OBSERVER(function(objects) {
|
|
if (disabled)
|
|
return;
|
|
var defaultPrefix = getDefaultUsablePrefix();
|
|
toArray(objects).forEach(function(mutationRecord) {
|
|
if (mutationRecord.type === "childList" && mutationRecord.addedNodes.length > 0 && !isWatched(mutationRecord.addedNodes[0])) {
|
|
if (config.searchPseudoElements) {
|
|
pseudoElementsCallback(mutationRecord.target);
|
|
}
|
|
treeCallback(mutationRecord.target);
|
|
}
|
|
if (mutationRecord.type === "attributes" && mutationRecord.target.parentNode && config.searchPseudoElements) {
|
|
pseudoElementsCallback(mutationRecord.target.parentNode);
|
|
}
|
|
if (mutationRecord.type === "attributes" && isWatched(mutationRecord.target) && ~ATTRIBUTES_WATCHED_FOR_MUTATION.indexOf(mutationRecord.attributeName)) {
|
|
if (mutationRecord.attributeName === "class" && hasPrefixAndIcon(mutationRecord.target)) {
|
|
var _getCanonicalIcon = getCanonicalIcon(classArray(mutationRecord.target)), prefix = _getCanonicalIcon.prefix, iconName = _getCanonicalIcon.iconName;
|
|
mutationRecord.target.setAttribute(DATA_PREFIX, prefix || defaultPrefix);
|
|
if (iconName)
|
|
mutationRecord.target.setAttribute(DATA_ICON, iconName);
|
|
} else if (hasBeenReplaced(mutationRecord.target)) {
|
|
nodeCallback(mutationRecord.target);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
if (!IS_DOM)
|
|
return;
|
|
mo.observe(observeMutationsRoot, {
|
|
childList: true,
|
|
attributes: true,
|
|
characterData: true,
|
|
subtree: true
|
|
});
|
|
}
|
|
function disconnect() {
|
|
if (!mo)
|
|
return;
|
|
mo.disconnect();
|
|
}
|
|
function styleParser(node) {
|
|
var style = node.getAttribute("style");
|
|
var val = [];
|
|
if (style) {
|
|
val = style.split(";").reduce(function(acc, style2) {
|
|
var styles2 = style2.split(":");
|
|
var prop = styles2[0];
|
|
var value = styles2.slice(1);
|
|
if (prop && value.length > 0) {
|
|
acc[prop] = value.join(":").trim();
|
|
}
|
|
return acc;
|
|
}, {});
|
|
}
|
|
return val;
|
|
}
|
|
function classParser(node) {
|
|
var existingPrefix = node.getAttribute("data-prefix");
|
|
var existingIconName = node.getAttribute("data-icon");
|
|
var innerText = node.innerText !== void 0 ? node.innerText.trim() : "";
|
|
var val = getCanonicalIcon(classArray(node));
|
|
if (!val.prefix) {
|
|
val.prefix = getDefaultUsablePrefix();
|
|
}
|
|
if (existingPrefix && existingIconName) {
|
|
val.prefix = existingPrefix;
|
|
val.iconName = existingIconName;
|
|
}
|
|
if (val.iconName && val.prefix) {
|
|
return val;
|
|
}
|
|
if (val.prefix && innerText.length > 0) {
|
|
val.iconName = byLigature(val.prefix, node.innerText) || byUnicode(val.prefix, toHex(node.innerText));
|
|
}
|
|
if (!val.iconName && config.autoFetchSvg && node.firstChild && node.firstChild.nodeType === Node.TEXT_NODE) {
|
|
val.iconName = node.firstChild.data;
|
|
}
|
|
return val;
|
|
}
|
|
function attributesParser(node) {
|
|
var extraAttributes = toArray(node.attributes).reduce(function(acc, attr) {
|
|
if (acc.name !== "class" && acc.name !== "style") {
|
|
acc[attr.name] = attr.value;
|
|
}
|
|
return acc;
|
|
}, {});
|
|
var title = node.getAttribute("title");
|
|
var titleId = node.getAttribute("data-fa-title-id");
|
|
if (config.autoA11y) {
|
|
if (title) {
|
|
extraAttributes["aria-labelledby"] = "".concat(config.replacementClass, "-title-").concat(titleId || nextUniqueId());
|
|
} else {
|
|
extraAttributes["aria-hidden"] = "true";
|
|
extraAttributes["focusable"] = "false";
|
|
}
|
|
}
|
|
return extraAttributes;
|
|
}
|
|
function blankMeta() {
|
|
return {
|
|
iconName: null,
|
|
title: null,
|
|
titleId: null,
|
|
prefix: null,
|
|
transform: meaninglessTransform,
|
|
symbol: false,
|
|
mask: {
|
|
iconName: null,
|
|
prefix: null,
|
|
rest: []
|
|
},
|
|
maskId: null,
|
|
extra: {
|
|
classes: [],
|
|
styles: {},
|
|
attributes: {}
|
|
}
|
|
};
|
|
}
|
|
function parseMeta(node) {
|
|
var parser = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
styleParser: true
|
|
};
|
|
var _classParser = classParser(node), iconName = _classParser.iconName, prefix = _classParser.prefix, extraClasses = _classParser.rest;
|
|
var extraAttributes = attributesParser(node);
|
|
var pluginMeta = chainHooks("parseNodeAttributes", {}, node);
|
|
var extraStyles = parser.styleParser ? styleParser(node) : [];
|
|
return _objectSpread2({
|
|
iconName,
|
|
title: node.getAttribute("title"),
|
|
titleId: node.getAttribute("data-fa-title-id"),
|
|
prefix,
|
|
transform: meaninglessTransform,
|
|
mask: {
|
|
iconName: null,
|
|
prefix: null,
|
|
rest: []
|
|
},
|
|
maskId: null,
|
|
symbol: false,
|
|
extra: {
|
|
classes: extraClasses,
|
|
styles: extraStyles,
|
|
attributes: extraAttributes
|
|
}
|
|
}, pluginMeta);
|
|
}
|
|
var styles$2 = namespace.styles;
|
|
function generateMutation(node) {
|
|
var nodeMeta = config.autoReplaceSvg === "nest" ? parseMeta(node, {
|
|
styleParser: false
|
|
}) : parseMeta(node);
|
|
if (~nodeMeta.extra.classes.indexOf(LAYERS_TEXT_CLASSNAME)) {
|
|
return callProvided("generateLayersText", node, nodeMeta);
|
|
} else {
|
|
return callProvided("generateSvgReplacementMutation", node, nodeMeta);
|
|
}
|
|
}
|
|
var knownPrefixes = /* @__PURE__ */ new Set();
|
|
FAMILIES.map(function(family) {
|
|
knownPrefixes.add("fa-".concat(family));
|
|
});
|
|
Object.keys(PREFIX_TO_STYLE[FAMILY_CLASSIC]).map(knownPrefixes.add.bind(knownPrefixes));
|
|
Object.keys(PREFIX_TO_STYLE[FAMILY_SHARP]).map(knownPrefixes.add.bind(knownPrefixes));
|
|
knownPrefixes = _toConsumableArray(knownPrefixes);
|
|
function onTree(root) {
|
|
var callback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
|
|
if (!IS_DOM)
|
|
return Promise.resolve();
|
|
var htmlClassList = DOCUMENT.documentElement.classList;
|
|
var hclAdd = function hclAdd2(suffix) {
|
|
return htmlClassList.add("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix));
|
|
};
|
|
var hclRemove = function hclRemove2(suffix) {
|
|
return htmlClassList.remove("".concat(HTML_CLASS_I2SVG_BASE_CLASS, "-").concat(suffix));
|
|
};
|
|
var prefixes2 = config.autoFetchSvg ? knownPrefixes : FAMILIES.map(function(f) {
|
|
return "fa-".concat(f);
|
|
}).concat(Object.keys(styles$2));
|
|
if (!prefixes2.includes("fa")) {
|
|
prefixes2.push("fa");
|
|
}
|
|
var prefixesDomQuery = [".".concat(LAYERS_TEXT_CLASSNAME, ":not([").concat(DATA_FA_I2SVG, "])")].concat(prefixes2.map(function(p2) {
|
|
return ".".concat(p2, ":not([").concat(DATA_FA_I2SVG, "])");
|
|
})).join(", ");
|
|
if (prefixesDomQuery.length === 0) {
|
|
return Promise.resolve();
|
|
}
|
|
var candidates = [];
|
|
try {
|
|
candidates = toArray(root.querySelectorAll(prefixesDomQuery));
|
|
} catch (e) {
|
|
}
|
|
if (candidates.length > 0) {
|
|
hclAdd("pending");
|
|
hclRemove("complete");
|
|
} else {
|
|
return Promise.resolve();
|
|
}
|
|
var mark = perf.begin("onTree");
|
|
var mutations = candidates.reduce(function(acc, node) {
|
|
try {
|
|
var mutation = generateMutation(node);
|
|
if (mutation) {
|
|
acc.push(mutation);
|
|
}
|
|
} catch (e) {
|
|
if (!PRODUCTION) {
|
|
if (e.name === "MissingIcon") {
|
|
console.error(e);
|
|
}
|
|
}
|
|
}
|
|
return acc;
|
|
}, []);
|
|
return new Promise(function(resolve, reject) {
|
|
Promise.all(mutations).then(function(resolvedMutations) {
|
|
perform(resolvedMutations, function() {
|
|
hclAdd("active");
|
|
hclAdd("complete");
|
|
hclRemove("pending");
|
|
if (typeof callback === "function")
|
|
callback();
|
|
mark();
|
|
resolve();
|
|
});
|
|
}).catch(function(e) {
|
|
mark();
|
|
reject(e);
|
|
});
|
|
});
|
|
}
|
|
function onNode(node) {
|
|
var callback = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
|
|
generateMutation(node).then(function(mutation) {
|
|
if (mutation) {
|
|
perform([mutation], callback);
|
|
}
|
|
});
|
|
}
|
|
function resolveIcons(next) {
|
|
return function(maybeIconDefinition) {
|
|
var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
var iconDefinition = (maybeIconDefinition || {}).icon ? maybeIconDefinition : findIconDefinition(maybeIconDefinition || {});
|
|
var mask = params.mask;
|
|
if (mask) {
|
|
mask = (mask || {}).icon ? mask : findIconDefinition(mask || {});
|
|
}
|
|
return next(iconDefinition, _objectSpread2(_objectSpread2({}, params), {}, {
|
|
mask
|
|
}));
|
|
};
|
|
}
|
|
var render = function render2(iconDefinition) {
|
|
var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
var _params$transform = params.transform, transform = _params$transform === void 0 ? meaninglessTransform : _params$transform, _params$symbol = params.symbol, symbol = _params$symbol === void 0 ? false : _params$symbol, _params$mask = params.mask, mask = _params$mask === void 0 ? null : _params$mask, _params$maskId = params.maskId, maskId = _params$maskId === void 0 ? null : _params$maskId, _params$title = params.title, title = _params$title === void 0 ? null : _params$title, _params$titleId = params.titleId, titleId = _params$titleId === void 0 ? null : _params$titleId, _params$classes = params.classes, classes = _params$classes === void 0 ? [] : _params$classes, _params$attributes = params.attributes, attributes = _params$attributes === void 0 ? {} : _params$attributes, _params$styles = params.styles, styles2 = _params$styles === void 0 ? {} : _params$styles;
|
|
if (!iconDefinition)
|
|
return;
|
|
var prefix = iconDefinition.prefix, iconName = iconDefinition.iconName, icon3 = iconDefinition.icon;
|
|
return domVariants(_objectSpread2({
|
|
type: "icon"
|
|
}, iconDefinition), function() {
|
|
callHooks("beforeDOMElementCreation", {
|
|
iconDefinition,
|
|
params
|
|
});
|
|
if (config.autoA11y) {
|
|
if (title) {
|
|
attributes["aria-labelledby"] = "".concat(config.replacementClass, "-title-").concat(titleId || nextUniqueId());
|
|
} else {
|
|
attributes["aria-hidden"] = "true";
|
|
attributes["focusable"] = "false";
|
|
}
|
|
}
|
|
return makeInlineSvgAbstract({
|
|
icons: {
|
|
main: asFoundIcon(icon3),
|
|
mask: mask ? asFoundIcon(mask.icon) : {
|
|
found: false,
|
|
width: null,
|
|
height: null,
|
|
icon: {}
|
|
}
|
|
},
|
|
prefix,
|
|
iconName,
|
|
transform: _objectSpread2(_objectSpread2({}, meaninglessTransform), transform),
|
|
symbol,
|
|
title,
|
|
maskId,
|
|
titleId,
|
|
extra: {
|
|
attributes,
|
|
styles: styles2,
|
|
classes
|
|
}
|
|
});
|
|
});
|
|
};
|
|
var ReplaceElements = {
|
|
mixout: function mixout2() {
|
|
return {
|
|
icon: resolveIcons(render)
|
|
};
|
|
},
|
|
hooks: function hooks2() {
|
|
return {
|
|
mutationObserverCallbacks: function mutationObserverCallbacks(accumulator) {
|
|
accumulator.treeCallback = onTree;
|
|
accumulator.nodeCallback = onNode;
|
|
return accumulator;
|
|
}
|
|
};
|
|
},
|
|
provides: function provides(providers$$1) {
|
|
providers$$1.i2svg = function(params) {
|
|
var _params$node = params.node, node = _params$node === void 0 ? DOCUMENT : _params$node, _params$callback = params.callback, callback = _params$callback === void 0 ? function() {
|
|
} : _params$callback;
|
|
return onTree(node, callback);
|
|
};
|
|
providers$$1.generateSvgReplacementMutation = function(node, nodeMeta) {
|
|
var iconName = nodeMeta.iconName, title = nodeMeta.title, titleId = nodeMeta.titleId, prefix = nodeMeta.prefix, transform = nodeMeta.transform, symbol = nodeMeta.symbol, mask = nodeMeta.mask, maskId = nodeMeta.maskId, extra = nodeMeta.extra;
|
|
return new Promise(function(resolve, reject) {
|
|
Promise.all([findIcon(iconName, prefix), mask.iconName ? findIcon(mask.iconName, mask.prefix) : Promise.resolve({
|
|
found: false,
|
|
width: 512,
|
|
height: 512,
|
|
icon: {}
|
|
})]).then(function(_ref2) {
|
|
var _ref22 = _slicedToArray(_ref2, 2), main = _ref22[0], mask2 = _ref22[1];
|
|
resolve([node, makeInlineSvgAbstract({
|
|
icons: {
|
|
main,
|
|
mask: mask2
|
|
},
|
|
prefix,
|
|
iconName,
|
|
transform,
|
|
symbol,
|
|
maskId,
|
|
title,
|
|
titleId,
|
|
extra,
|
|
watchable: true
|
|
})]);
|
|
}).catch(reject);
|
|
});
|
|
};
|
|
providers$$1.generateAbstractIcon = function(_ref3) {
|
|
var children = _ref3.children, attributes = _ref3.attributes, main = _ref3.main, transform = _ref3.transform, styles2 = _ref3.styles;
|
|
var styleString = joinStyles(styles2);
|
|
if (styleString.length > 0) {
|
|
attributes["style"] = styleString;
|
|
}
|
|
var nextChild;
|
|
if (transformIsMeaningful(transform)) {
|
|
nextChild = callProvided("generateAbstractTransformGrouping", {
|
|
main,
|
|
transform,
|
|
containerWidth: main.width,
|
|
iconWidth: main.width
|
|
});
|
|
}
|
|
children.push(nextChild || main.icon);
|
|
return {
|
|
children,
|
|
attributes
|
|
};
|
|
};
|
|
}
|
|
};
|
|
var Layers = {
|
|
mixout: function mixout3() {
|
|
return {
|
|
layer: function layer2(assembler) {
|
|
var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
var _params$classes = params.classes, classes = _params$classes === void 0 ? [] : _params$classes;
|
|
return domVariants({
|
|
type: "layer"
|
|
}, function() {
|
|
callHooks("beforeDOMElementCreation", {
|
|
assembler,
|
|
params
|
|
});
|
|
var children = [];
|
|
assembler(function(args) {
|
|
Array.isArray(args) ? args.map(function(a) {
|
|
children = children.concat(a.abstract);
|
|
}) : children = children.concat(args.abstract);
|
|
});
|
|
return [{
|
|
tag: "span",
|
|
attributes: {
|
|
class: ["".concat(config.cssPrefix, "-layers")].concat(_toConsumableArray(classes)).join(" ")
|
|
},
|
|
children
|
|
}];
|
|
});
|
|
}
|
|
};
|
|
}
|
|
};
|
|
var LayersCounter = {
|
|
mixout: function mixout4() {
|
|
return {
|
|
counter: function counter2(content) {
|
|
var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
var _params$title = params.title, title = _params$title === void 0 ? null : _params$title, _params$classes = params.classes, classes = _params$classes === void 0 ? [] : _params$classes, _params$attributes = params.attributes, attributes = _params$attributes === void 0 ? {} : _params$attributes, _params$styles = params.styles, styles2 = _params$styles === void 0 ? {} : _params$styles;
|
|
return domVariants({
|
|
type: "counter",
|
|
content
|
|
}, function() {
|
|
callHooks("beforeDOMElementCreation", {
|
|
content,
|
|
params
|
|
});
|
|
return makeLayersCounterAbstract({
|
|
content: content.toString(),
|
|
title,
|
|
extra: {
|
|
attributes,
|
|
styles: styles2,
|
|
classes: ["".concat(config.cssPrefix, "-layers-counter")].concat(_toConsumableArray(classes))
|
|
}
|
|
});
|
|
});
|
|
}
|
|
};
|
|
}
|
|
};
|
|
var LayersText = {
|
|
mixout: function mixout5() {
|
|
return {
|
|
text: function text2(content) {
|
|
var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
var _params$transform = params.transform, transform = _params$transform === void 0 ? meaninglessTransform : _params$transform, _params$title = params.title, title = _params$title === void 0 ? null : _params$title, _params$classes = params.classes, classes = _params$classes === void 0 ? [] : _params$classes, _params$attributes = params.attributes, attributes = _params$attributes === void 0 ? {} : _params$attributes, _params$styles = params.styles, styles2 = _params$styles === void 0 ? {} : _params$styles;
|
|
return domVariants({
|
|
type: "text",
|
|
content
|
|
}, function() {
|
|
callHooks("beforeDOMElementCreation", {
|
|
content,
|
|
params
|
|
});
|
|
return makeLayersTextAbstract({
|
|
content,
|
|
transform: _objectSpread2(_objectSpread2({}, meaninglessTransform), transform),
|
|
title,
|
|
extra: {
|
|
attributes,
|
|
styles: styles2,
|
|
classes: ["".concat(config.cssPrefix, "-layers-text")].concat(_toConsumableArray(classes))
|
|
}
|
|
});
|
|
});
|
|
}
|
|
};
|
|
},
|
|
provides: function provides2(providers$$1) {
|
|
providers$$1.generateLayersText = function(node, nodeMeta) {
|
|
var title = nodeMeta.title, transform = nodeMeta.transform, extra = nodeMeta.extra;
|
|
var width = null;
|
|
var height = null;
|
|
if (IS_IE) {
|
|
var computedFontSize = parseInt(getComputedStyle(node).fontSize, 10);
|
|
var boundingClientRect = node.getBoundingClientRect();
|
|
width = boundingClientRect.width / computedFontSize;
|
|
height = boundingClientRect.height / computedFontSize;
|
|
}
|
|
if (config.autoA11y && !title) {
|
|
extra.attributes["aria-hidden"] = "true";
|
|
}
|
|
return Promise.resolve([node, makeLayersTextAbstract({
|
|
content: node.innerHTML,
|
|
width,
|
|
height,
|
|
transform,
|
|
title,
|
|
extra,
|
|
watchable: true
|
|
})]);
|
|
};
|
|
}
|
|
};
|
|
var CLEAN_CONTENT_PATTERN = new RegExp('"', "ug");
|
|
var SECONDARY_UNICODE_RANGE = [1105920, 1112319];
|
|
function hexValueFromContent(content) {
|
|
var cleaned = content.replace(CLEAN_CONTENT_PATTERN, "");
|
|
var codePoint = codePointAt(cleaned, 0);
|
|
var isPrependTen = codePoint >= SECONDARY_UNICODE_RANGE[0] && codePoint <= SECONDARY_UNICODE_RANGE[1];
|
|
var isDoubled = cleaned.length === 2 ? cleaned[0] === cleaned[1] : false;
|
|
return {
|
|
value: isDoubled ? toHex(cleaned[0]) : toHex(cleaned),
|
|
isSecondary: isPrependTen || isDoubled
|
|
};
|
|
}
|
|
function replaceForPosition(node, position) {
|
|
var pendingAttribute = "".concat(DATA_FA_PSEUDO_ELEMENT_PENDING).concat(position.replace(":", "-"));
|
|
return new Promise(function(resolve, reject) {
|
|
if (node.getAttribute(pendingAttribute) !== null) {
|
|
return resolve();
|
|
}
|
|
var children = toArray(node.children);
|
|
var alreadyProcessedPseudoElement = children.filter(function(c) {
|
|
return c.getAttribute(DATA_FA_PSEUDO_ELEMENT) === position;
|
|
})[0];
|
|
var styles2 = WINDOW.getComputedStyle(node, position);
|
|
var fontFamily = styles2.getPropertyValue("font-family").match(FONT_FAMILY_PATTERN);
|
|
var fontWeight = styles2.getPropertyValue("font-weight");
|
|
var content = styles2.getPropertyValue("content");
|
|
if (alreadyProcessedPseudoElement && !fontFamily) {
|
|
node.removeChild(alreadyProcessedPseudoElement);
|
|
return resolve();
|
|
} else if (fontFamily && content !== "none" && content !== "") {
|
|
var _content = styles2.getPropertyValue("content");
|
|
var family = ~["Sharp"].indexOf(fontFamily[2]) ? FAMILY_SHARP : FAMILY_CLASSIC;
|
|
var prefix = ~["Solid", "Regular", "Light", "Thin", "Duotone", "Brands", "Kit"].indexOf(fontFamily[2]) ? STYLE_TO_PREFIX[family][fontFamily[2].toLowerCase()] : FONT_WEIGHT_TO_PREFIX[family][fontWeight];
|
|
var _hexValueFromContent = hexValueFromContent(_content), hexValue = _hexValueFromContent.value, isSecondary = _hexValueFromContent.isSecondary;
|
|
var isV4 = fontFamily[0].startsWith("FontAwesome");
|
|
var iconName = byUnicode(prefix, hexValue);
|
|
var iconIdentifier = iconName;
|
|
if (isV4) {
|
|
var iconName4 = byOldUnicode(hexValue);
|
|
if (iconName4.iconName && iconName4.prefix) {
|
|
iconName = iconName4.iconName;
|
|
prefix = iconName4.prefix;
|
|
}
|
|
}
|
|
if (iconName && !isSecondary && (!alreadyProcessedPseudoElement || alreadyProcessedPseudoElement.getAttribute(DATA_PREFIX) !== prefix || alreadyProcessedPseudoElement.getAttribute(DATA_ICON) !== iconIdentifier)) {
|
|
node.setAttribute(pendingAttribute, iconIdentifier);
|
|
if (alreadyProcessedPseudoElement) {
|
|
node.removeChild(alreadyProcessedPseudoElement);
|
|
}
|
|
var meta = blankMeta();
|
|
var extra = meta.extra;
|
|
extra.attributes[DATA_FA_PSEUDO_ELEMENT] = position;
|
|
findIcon(iconName, prefix).then(function(main) {
|
|
var _abstract = makeInlineSvgAbstract(_objectSpread2(_objectSpread2({}, meta), {}, {
|
|
icons: {
|
|
main,
|
|
mask: emptyCanonicalIcon()
|
|
},
|
|
prefix,
|
|
iconName: iconIdentifier,
|
|
extra,
|
|
watchable: true
|
|
}));
|
|
var element = DOCUMENT.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
if (position === "::before") {
|
|
node.insertBefore(element, node.firstChild);
|
|
} else {
|
|
node.appendChild(element);
|
|
}
|
|
element.outerHTML = _abstract.map(function(a) {
|
|
return toHtml(a);
|
|
}).join("\n");
|
|
node.removeAttribute(pendingAttribute);
|
|
resolve();
|
|
}).catch(reject);
|
|
} else {
|
|
resolve();
|
|
}
|
|
} else {
|
|
resolve();
|
|
}
|
|
});
|
|
}
|
|
function replace2(node) {
|
|
return Promise.all([replaceForPosition(node, "::before"), replaceForPosition(node, "::after")]);
|
|
}
|
|
function processable(node) {
|
|
return node.parentNode !== document.head && !~TAGNAMES_TO_SKIP_FOR_PSEUDOELEMENTS.indexOf(node.tagName.toUpperCase()) && !node.getAttribute(DATA_FA_PSEUDO_ELEMENT) && (!node.parentNode || node.parentNode.tagName !== "svg");
|
|
}
|
|
function searchPseudoElements(root) {
|
|
if (!IS_DOM)
|
|
return;
|
|
return new Promise(function(resolve, reject) {
|
|
var operations = toArray(root.querySelectorAll("*")).filter(processable).map(replace2);
|
|
var end3 = perf.begin("searchPseudoElements");
|
|
disableObservation();
|
|
Promise.all(operations).then(function() {
|
|
end3();
|
|
enableObservation();
|
|
resolve();
|
|
}).catch(function() {
|
|
end3();
|
|
enableObservation();
|
|
reject();
|
|
});
|
|
});
|
|
}
|
|
var PseudoElements = {
|
|
hooks: function hooks3() {
|
|
return {
|
|
mutationObserverCallbacks: function mutationObserverCallbacks(accumulator) {
|
|
accumulator.pseudoElementsCallback = searchPseudoElements;
|
|
return accumulator;
|
|
}
|
|
};
|
|
},
|
|
provides: function provides3(providers$$1) {
|
|
providers$$1.pseudoElements2svg = function(params) {
|
|
var _params$node = params.node, node = _params$node === void 0 ? DOCUMENT : _params$node;
|
|
if (config.searchPseudoElements) {
|
|
searchPseudoElements(node);
|
|
}
|
|
};
|
|
}
|
|
};
|
|
var _unwatched = false;
|
|
var MutationObserver$1 = {
|
|
mixout: function mixout6() {
|
|
return {
|
|
dom: {
|
|
unwatch: function unwatch() {
|
|
disableObservation();
|
|
_unwatched = true;
|
|
}
|
|
}
|
|
};
|
|
},
|
|
hooks: function hooks4() {
|
|
return {
|
|
bootstrap: function bootstrap() {
|
|
observe(chainHooks("mutationObserverCallbacks", {}));
|
|
},
|
|
noAuto: function noAuto3() {
|
|
disconnect();
|
|
},
|
|
watch: function watch2(params) {
|
|
var observeMutationsRoot = params.observeMutationsRoot;
|
|
if (_unwatched) {
|
|
enableObservation();
|
|
} else {
|
|
observe(chainHooks("mutationObserverCallbacks", {
|
|
observeMutationsRoot
|
|
}));
|
|
}
|
|
}
|
|
};
|
|
}
|
|
};
|
|
var parseTransformString = function parseTransformString2(transformString) {
|
|
var transform = {
|
|
size: 16,
|
|
x: 0,
|
|
y: 0,
|
|
flipX: false,
|
|
flipY: false,
|
|
rotate: 0
|
|
};
|
|
return transformString.toLowerCase().split(" ").reduce(function(acc, n) {
|
|
var parts = n.toLowerCase().split("-");
|
|
var first = parts[0];
|
|
var rest = parts.slice(1).join("-");
|
|
if (first && rest === "h") {
|
|
acc.flipX = true;
|
|
return acc;
|
|
}
|
|
if (first && rest === "v") {
|
|
acc.flipY = true;
|
|
return acc;
|
|
}
|
|
rest = parseFloat(rest);
|
|
if (isNaN(rest)) {
|
|
return acc;
|
|
}
|
|
switch (first) {
|
|
case "grow":
|
|
acc.size = acc.size + rest;
|
|
break;
|
|
case "shrink":
|
|
acc.size = acc.size - rest;
|
|
break;
|
|
case "left":
|
|
acc.x = acc.x - rest;
|
|
break;
|
|
case "right":
|
|
acc.x = acc.x + rest;
|
|
break;
|
|
case "up":
|
|
acc.y = acc.y - rest;
|
|
break;
|
|
case "down":
|
|
acc.y = acc.y + rest;
|
|
break;
|
|
case "rotate":
|
|
acc.rotate = acc.rotate + rest;
|
|
break;
|
|
}
|
|
return acc;
|
|
}, transform);
|
|
};
|
|
var PowerTransforms = {
|
|
mixout: function mixout7() {
|
|
return {
|
|
parse: {
|
|
transform: function transform(transformString) {
|
|
return parseTransformString(transformString);
|
|
}
|
|
}
|
|
};
|
|
},
|
|
hooks: function hooks5() {
|
|
return {
|
|
parseNodeAttributes: function parseNodeAttributes(accumulator, node) {
|
|
var transformString = node.getAttribute("data-fa-transform");
|
|
if (transformString) {
|
|
accumulator.transform = parseTransformString(transformString);
|
|
}
|
|
return accumulator;
|
|
}
|
|
};
|
|
},
|
|
provides: function provides4(providers2) {
|
|
providers2.generateAbstractTransformGrouping = function(_ref2) {
|
|
var main = _ref2.main, transform = _ref2.transform, containerWidth = _ref2.containerWidth, iconWidth = _ref2.iconWidth;
|
|
var outer = {
|
|
transform: "translate(".concat(containerWidth / 2, " 256)")
|
|
};
|
|
var innerTranslate = "translate(".concat(transform.x * 32, ", ").concat(transform.y * 32, ") ");
|
|
var innerScale = "scale(".concat(transform.size / 16 * (transform.flipX ? -1 : 1), ", ").concat(transform.size / 16 * (transform.flipY ? -1 : 1), ") ");
|
|
var innerRotate = "rotate(".concat(transform.rotate, " 0 0)");
|
|
var inner = {
|
|
transform: "".concat(innerTranslate, " ").concat(innerScale, " ").concat(innerRotate)
|
|
};
|
|
var path = {
|
|
transform: "translate(".concat(iconWidth / 2 * -1, " -256)")
|
|
};
|
|
var operations = {
|
|
outer,
|
|
inner,
|
|
path
|
|
};
|
|
return {
|
|
tag: "g",
|
|
attributes: _objectSpread2({}, operations.outer),
|
|
children: [{
|
|
tag: "g",
|
|
attributes: _objectSpread2({}, operations.inner),
|
|
children: [{
|
|
tag: main.icon.tag,
|
|
children: main.icon.children,
|
|
attributes: _objectSpread2(_objectSpread2({}, main.icon.attributes), operations.path)
|
|
}]
|
|
}]
|
|
};
|
|
};
|
|
}
|
|
};
|
|
var ALL_SPACE = {
|
|
x: 0,
|
|
y: 0,
|
|
width: "100%",
|
|
height: "100%"
|
|
};
|
|
function fillBlack(_abstract) {
|
|
var force = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
if (_abstract.attributes && (_abstract.attributes.fill || force)) {
|
|
_abstract.attributes.fill = "black";
|
|
}
|
|
return _abstract;
|
|
}
|
|
function deGroup(_abstract2) {
|
|
if (_abstract2.tag === "g") {
|
|
return _abstract2.children;
|
|
} else {
|
|
return [_abstract2];
|
|
}
|
|
}
|
|
var Masks = {
|
|
hooks: function hooks6() {
|
|
return {
|
|
parseNodeAttributes: function parseNodeAttributes(accumulator, node) {
|
|
var maskData = node.getAttribute("data-fa-mask");
|
|
var mask = !maskData ? emptyCanonicalIcon() : getCanonicalIcon(maskData.split(" ").map(function(i) {
|
|
return i.trim();
|
|
}));
|
|
if (!mask.prefix) {
|
|
mask.prefix = getDefaultUsablePrefix();
|
|
}
|
|
accumulator.mask = mask;
|
|
accumulator.maskId = node.getAttribute("data-fa-mask-id");
|
|
return accumulator;
|
|
}
|
|
};
|
|
},
|
|
provides: function provides5(providers2) {
|
|
providers2.generateAbstractMask = function(_ref2) {
|
|
var children = _ref2.children, attributes = _ref2.attributes, main = _ref2.main, mask = _ref2.mask, explicitMaskId = _ref2.maskId, transform = _ref2.transform;
|
|
var mainWidth = main.width, mainPath = main.icon;
|
|
var maskWidth = mask.width, maskPath = mask.icon;
|
|
var trans = transformForSvg({
|
|
transform,
|
|
containerWidth: maskWidth,
|
|
iconWidth: mainWidth
|
|
});
|
|
var maskRect = {
|
|
tag: "rect",
|
|
attributes: _objectSpread2(_objectSpread2({}, ALL_SPACE), {}, {
|
|
fill: "white"
|
|
})
|
|
};
|
|
var maskInnerGroupChildrenMixin = mainPath.children ? {
|
|
children: mainPath.children.map(fillBlack)
|
|
} : {};
|
|
var maskInnerGroup = {
|
|
tag: "g",
|
|
attributes: _objectSpread2({}, trans.inner),
|
|
children: [fillBlack(_objectSpread2({
|
|
tag: mainPath.tag,
|
|
attributes: _objectSpread2(_objectSpread2({}, mainPath.attributes), trans.path)
|
|
}, maskInnerGroupChildrenMixin))]
|
|
};
|
|
var maskOuterGroup = {
|
|
tag: "g",
|
|
attributes: _objectSpread2({}, trans.outer),
|
|
children: [maskInnerGroup]
|
|
};
|
|
var maskId = "mask-".concat(explicitMaskId || nextUniqueId());
|
|
var clipId = "clip-".concat(explicitMaskId || nextUniqueId());
|
|
var maskTag = {
|
|
tag: "mask",
|
|
attributes: _objectSpread2(_objectSpread2({}, ALL_SPACE), {}, {
|
|
id: maskId,
|
|
maskUnits: "userSpaceOnUse",
|
|
maskContentUnits: "userSpaceOnUse"
|
|
}),
|
|
children: [maskRect, maskOuterGroup]
|
|
};
|
|
var defs = {
|
|
tag: "defs",
|
|
children: [{
|
|
tag: "clipPath",
|
|
attributes: {
|
|
id: clipId
|
|
},
|
|
children: deGroup(maskPath)
|
|
}, maskTag]
|
|
};
|
|
children.push(defs, {
|
|
tag: "rect",
|
|
attributes: _objectSpread2({
|
|
fill: "currentColor",
|
|
"clip-path": "url(#".concat(clipId, ")"),
|
|
mask: "url(#".concat(maskId, ")")
|
|
}, ALL_SPACE)
|
|
});
|
|
return {
|
|
children,
|
|
attributes
|
|
};
|
|
};
|
|
}
|
|
};
|
|
var MissingIconIndicator = {
|
|
provides: function provides6(providers2) {
|
|
var reduceMotion = false;
|
|
if (WINDOW.matchMedia) {
|
|
reduceMotion = WINDOW.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
}
|
|
providers2.missingIconAbstract = function() {
|
|
var gChildren = [];
|
|
var FILL = {
|
|
fill: "currentColor"
|
|
};
|
|
var ANIMATION_BASE = {
|
|
attributeType: "XML",
|
|
repeatCount: "indefinite",
|
|
dur: "2s"
|
|
};
|
|
gChildren.push({
|
|
tag: "path",
|
|
attributes: _objectSpread2(_objectSpread2({}, FILL), {}, {
|
|
d: "M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"
|
|
})
|
|
});
|
|
var OPACITY_ANIMATE = _objectSpread2(_objectSpread2({}, ANIMATION_BASE), {}, {
|
|
attributeName: "opacity"
|
|
});
|
|
var dot = {
|
|
tag: "circle",
|
|
attributes: _objectSpread2(_objectSpread2({}, FILL), {}, {
|
|
cx: "256",
|
|
cy: "364",
|
|
r: "28"
|
|
}),
|
|
children: []
|
|
};
|
|
if (!reduceMotion) {
|
|
dot.children.push({
|
|
tag: "animate",
|
|
attributes: _objectSpread2(_objectSpread2({}, ANIMATION_BASE), {}, {
|
|
attributeName: "r",
|
|
values: "28;14;28;28;14;28;"
|
|
})
|
|
}, {
|
|
tag: "animate",
|
|
attributes: _objectSpread2(_objectSpread2({}, OPACITY_ANIMATE), {}, {
|
|
values: "1;0;1;1;0;1;"
|
|
})
|
|
});
|
|
}
|
|
gChildren.push(dot);
|
|
gChildren.push({
|
|
tag: "path",
|
|
attributes: _objectSpread2(_objectSpread2({}, FILL), {}, {
|
|
opacity: "1",
|
|
d: "M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"
|
|
}),
|
|
children: reduceMotion ? [] : [{
|
|
tag: "animate",
|
|
attributes: _objectSpread2(_objectSpread2({}, OPACITY_ANIMATE), {}, {
|
|
values: "1;0;0;0;0;1;"
|
|
})
|
|
}]
|
|
});
|
|
if (!reduceMotion) {
|
|
gChildren.push({
|
|
tag: "path",
|
|
attributes: _objectSpread2(_objectSpread2({}, FILL), {}, {
|
|
opacity: "0",
|
|
d: "M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"
|
|
}),
|
|
children: [{
|
|
tag: "animate",
|
|
attributes: _objectSpread2(_objectSpread2({}, OPACITY_ANIMATE), {}, {
|
|
values: "0;0;1;1;0;0;"
|
|
})
|
|
}]
|
|
});
|
|
}
|
|
return {
|
|
tag: "g",
|
|
attributes: {
|
|
"class": "missing"
|
|
},
|
|
children: gChildren
|
|
};
|
|
};
|
|
}
|
|
};
|
|
var SvgSymbols = {
|
|
hooks: function hooks7() {
|
|
return {
|
|
parseNodeAttributes: function parseNodeAttributes(accumulator, node) {
|
|
var symbolData = node.getAttribute("data-fa-symbol");
|
|
var symbol = symbolData === null ? false : symbolData === "" ? true : symbolData;
|
|
accumulator["symbol"] = symbol;
|
|
return accumulator;
|
|
}
|
|
};
|
|
}
|
|
};
|
|
var plugins2 = [InjectCSS, ReplaceElements, Layers, LayersCounter, LayersText, PseudoElements, MutationObserver$1, PowerTransforms, Masks, MissingIconIndicator, SvgSymbols];
|
|
registerPlugins(plugins2, {
|
|
mixoutsTo: api
|
|
});
|
|
var noAuto$1 = api.noAuto;
|
|
var config$1 = api.config;
|
|
var library$1 = api.library;
|
|
var dom$1 = api.dom;
|
|
var parse$1 = api.parse;
|
|
var findIconDefinition$1 = api.findIconDefinition;
|
|
var toHtml$1 = api.toHtml;
|
|
var icon2 = api.icon;
|
|
var layer = api.layer;
|
|
var text = api.text;
|
|
var counter = api.counter;
|
|
|
|
// node_modules/@fortawesome/react-fontawesome/index.es.js
|
|
var import_prop_types = __toESM(require_prop_types());
|
|
var import_react = __toESM(require_react());
|
|
function ownKeys2(object, enumerableOnly) {
|
|
var keys2 = Object.keys(object);
|
|
if (Object.getOwnPropertySymbols) {
|
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
})), keys2.push.apply(keys2, symbols);
|
|
}
|
|
return keys2;
|
|
}
|
|
function _objectSpread22(target) {
|
|
for (var i = 1; i < arguments.length; i++) {
|
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
i % 2 ? ownKeys2(Object(source), true).forEach(function(key) {
|
|
_defineProperty2(target, key, source[key]);
|
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys2(Object(source)).forEach(function(key) {
|
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
});
|
|
}
|
|
return target;
|
|
}
|
|
function _typeof2(obj) {
|
|
"@babel/helpers - typeof";
|
|
return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
return typeof obj2;
|
|
} : function(obj2) {
|
|
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
}, _typeof2(obj);
|
|
}
|
|
function _defineProperty2(obj, key, value) {
|
|
if (key in obj) {
|
|
Object.defineProperty(obj, key, {
|
|
value,
|
|
enumerable: true,
|
|
configurable: true,
|
|
writable: true
|
|
});
|
|
} else {
|
|
obj[key] = value;
|
|
}
|
|
return obj;
|
|
}
|
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
if (source == null)
|
|
return {};
|
|
var target = {};
|
|
var sourceKeys = Object.keys(source);
|
|
var key, i;
|
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
key = sourceKeys[i];
|
|
if (excluded.indexOf(key) >= 0)
|
|
continue;
|
|
target[key] = source[key];
|
|
}
|
|
return target;
|
|
}
|
|
function _objectWithoutProperties(source, excluded) {
|
|
if (source == null)
|
|
return {};
|
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
var key, i;
|
|
if (Object.getOwnPropertySymbols) {
|
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
key = sourceSymbolKeys[i];
|
|
if (excluded.indexOf(key) >= 0)
|
|
continue;
|
|
if (!Object.prototype.propertyIsEnumerable.call(source, key))
|
|
continue;
|
|
target[key] = source[key];
|
|
}
|
|
}
|
|
return target;
|
|
}
|
|
function _toConsumableArray2(arr) {
|
|
return _arrayWithoutHoles2(arr) || _iterableToArray2(arr) || _unsupportedIterableToArray2(arr) || _nonIterableSpread2();
|
|
}
|
|
function _arrayWithoutHoles2(arr) {
|
|
if (Array.isArray(arr))
|
|
return _arrayLikeToArray2(arr);
|
|
}
|
|
function _iterableToArray2(iter) {
|
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
|
|
return Array.from(iter);
|
|
}
|
|
function _unsupportedIterableToArray2(o, minLen) {
|
|
if (!o)
|
|
return;
|
|
if (typeof o === "string")
|
|
return _arrayLikeToArray2(o, minLen);
|
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
if (n === "Object" && o.constructor)
|
|
n = o.constructor.name;
|
|
if (n === "Map" || n === "Set")
|
|
return Array.from(o);
|
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
|
|
return _arrayLikeToArray2(o, minLen);
|
|
}
|
|
function _arrayLikeToArray2(arr, len) {
|
|
if (len == null || len > arr.length)
|
|
len = arr.length;
|
|
for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
arr2[i] = arr[i];
|
|
return arr2;
|
|
}
|
|
function _nonIterableSpread2() {
|
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
}
|
|
function classList(props) {
|
|
var _classes;
|
|
var beat = props.beat, fade = props.fade, beatFade = props.beatFade, bounce = props.bounce, shake = props.shake, flash = props.flash, spin = props.spin, spinPulse = props.spinPulse, spinReverse = props.spinReverse, pulse = props.pulse, fixedWidth = props.fixedWidth, inverse = props.inverse, border = props.border, listItem = props.listItem, flip = props.flip, size = props.size, rotation = props.rotation, pull = props.pull;
|
|
var classes = (_classes = {
|
|
"fa-beat": beat,
|
|
"fa-fade": fade,
|
|
"fa-beat-fade": beatFade,
|
|
"fa-bounce": bounce,
|
|
"fa-shake": shake,
|
|
"fa-flash": flash,
|
|
"fa-spin": spin,
|
|
"fa-spin-reverse": spinReverse,
|
|
"fa-spin-pulse": spinPulse,
|
|
"fa-pulse": pulse,
|
|
"fa-fw": fixedWidth,
|
|
"fa-inverse": inverse,
|
|
"fa-border": border,
|
|
"fa-li": listItem,
|
|
"fa-flip": flip === true,
|
|
"fa-flip-horizontal": flip === "horizontal" || flip === "both",
|
|
"fa-flip-vertical": flip === "vertical" || flip === "both"
|
|
}, _defineProperty2(_classes, "fa-".concat(size), typeof size !== "undefined" && size !== null), _defineProperty2(_classes, "fa-rotate-".concat(rotation), typeof rotation !== "undefined" && rotation !== null && rotation !== 0), _defineProperty2(_classes, "fa-pull-".concat(pull), typeof pull !== "undefined" && pull !== null), _defineProperty2(_classes, "fa-swap-opacity", props.swapOpacity), _classes);
|
|
return Object.keys(classes).map(function(key) {
|
|
return classes[key] ? key : null;
|
|
}).filter(function(key) {
|
|
return key;
|
|
});
|
|
}
|
|
function _isNumerical(obj) {
|
|
obj = obj - 0;
|
|
return obj === obj;
|
|
}
|
|
function camelize(string) {
|
|
if (_isNumerical(string)) {
|
|
return string;
|
|
}
|
|
string = string.replace(/[\-_\s]+(.)?/g, function(match, chr) {
|
|
return chr ? chr.toUpperCase() : "";
|
|
});
|
|
return string.substr(0, 1).toLowerCase() + string.substr(1);
|
|
}
|
|
var _excluded = ["style"];
|
|
function capitalize(val) {
|
|
return val.charAt(0).toUpperCase() + val.slice(1);
|
|
}
|
|
function styleToObject(style) {
|
|
return style.split(";").map(function(s) {
|
|
return s.trim();
|
|
}).filter(function(s) {
|
|
return s;
|
|
}).reduce(function(acc, pair) {
|
|
var i = pair.indexOf(":");
|
|
var prop = camelize(pair.slice(0, i));
|
|
var value = pair.slice(i + 1).trim();
|
|
prop.startsWith("webkit") ? acc[capitalize(prop)] = value : acc[prop] = value;
|
|
return acc;
|
|
}, {});
|
|
}
|
|
function convert(createElement2, element) {
|
|
var extraProps = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
if (typeof element === "string") {
|
|
return element;
|
|
}
|
|
var children = (element.children || []).map(function(child) {
|
|
return convert(createElement2, child);
|
|
});
|
|
var mixins = Object.keys(element.attributes || {}).reduce(function(acc, key) {
|
|
var val = element.attributes[key];
|
|
switch (key) {
|
|
case "class":
|
|
acc.attrs["className"] = val;
|
|
delete element.attributes["class"];
|
|
break;
|
|
case "style":
|
|
acc.attrs["style"] = styleToObject(val);
|
|
break;
|
|
default:
|
|
if (key.indexOf("aria-") === 0 || key.indexOf("data-") === 0) {
|
|
acc.attrs[key.toLowerCase()] = val;
|
|
} else {
|
|
acc.attrs[camelize(key)] = val;
|
|
}
|
|
}
|
|
return acc;
|
|
}, {
|
|
attrs: {}
|
|
});
|
|
var _extraProps$style = extraProps.style, existingStyle = _extraProps$style === void 0 ? {} : _extraProps$style, remaining = _objectWithoutProperties(extraProps, _excluded);
|
|
mixins.attrs["style"] = _objectSpread22(_objectSpread22({}, mixins.attrs["style"]), existingStyle);
|
|
return createElement2.apply(void 0, [element.tag, _objectSpread22(_objectSpread22({}, mixins.attrs), remaining)].concat(_toConsumableArray2(children)));
|
|
}
|
|
var PRODUCTION2 = false;
|
|
try {
|
|
PRODUCTION2 = false;
|
|
} catch (e) {
|
|
}
|
|
function log() {
|
|
if (!PRODUCTION2 && console && typeof console.error === "function") {
|
|
var _console;
|
|
(_console = console).error.apply(_console, arguments);
|
|
}
|
|
}
|
|
function normalizeIconArgs(icon3) {
|
|
if (icon3 && _typeof2(icon3) === "object" && icon3.prefix && icon3.iconName && icon3.icon) {
|
|
return icon3;
|
|
}
|
|
if (parse$1.icon) {
|
|
return parse$1.icon(icon3);
|
|
}
|
|
if (icon3 === null) {
|
|
return null;
|
|
}
|
|
if (icon3 && _typeof2(icon3) === "object" && icon3.prefix && icon3.iconName) {
|
|
return icon3;
|
|
}
|
|
if (Array.isArray(icon3) && icon3.length === 2) {
|
|
return {
|
|
prefix: icon3[0],
|
|
iconName: icon3[1]
|
|
};
|
|
}
|
|
if (typeof icon3 === "string") {
|
|
return {
|
|
prefix: "fas",
|
|
iconName: icon3
|
|
};
|
|
}
|
|
}
|
|
function objectWithKey(key, value) {
|
|
return Array.isArray(value) && value.length > 0 || !Array.isArray(value) && value ? _defineProperty2({}, key, value) : {};
|
|
}
|
|
var FontAwesomeIcon = /* @__PURE__ */ import_react.default.forwardRef(function(props, ref) {
|
|
var iconArgs = props.icon, maskArgs = props.mask, symbol = props.symbol, className = props.className, title = props.title, titleId = props.titleId, maskId = props.maskId;
|
|
var iconLookup = normalizeIconArgs(iconArgs);
|
|
var classes = objectWithKey("classes", [].concat(_toConsumableArray2(classList(props)), _toConsumableArray2(className.split(" "))));
|
|
var transform = objectWithKey("transform", typeof props.transform === "string" ? parse$1.transform(props.transform) : props.transform);
|
|
var mask = objectWithKey("mask", normalizeIconArgs(maskArgs));
|
|
var renderedIcon = icon2(iconLookup, _objectSpread22(_objectSpread22(_objectSpread22(_objectSpread22({}, classes), transform), mask), {}, {
|
|
symbol,
|
|
title,
|
|
titleId,
|
|
maskId
|
|
}));
|
|
if (!renderedIcon) {
|
|
log("Could not find icon", iconLookup);
|
|
return null;
|
|
}
|
|
var abstract = renderedIcon.abstract;
|
|
var extraProps = {
|
|
ref
|
|
};
|
|
Object.keys(props).forEach(function(key) {
|
|
if (!FontAwesomeIcon.defaultProps.hasOwnProperty(key)) {
|
|
extraProps[key] = props[key];
|
|
}
|
|
});
|
|
return convertCurry(abstract[0], extraProps);
|
|
});
|
|
FontAwesomeIcon.displayName = "FontAwesomeIcon";
|
|
FontAwesomeIcon.propTypes = {
|
|
beat: import_prop_types.default.bool,
|
|
border: import_prop_types.default.bool,
|
|
beatFade: import_prop_types.default.bool,
|
|
bounce: import_prop_types.default.bool,
|
|
className: import_prop_types.default.string,
|
|
fade: import_prop_types.default.bool,
|
|
flash: import_prop_types.default.bool,
|
|
mask: import_prop_types.default.oneOfType([import_prop_types.default.object, import_prop_types.default.array, import_prop_types.default.string]),
|
|
maskId: import_prop_types.default.string,
|
|
fixedWidth: import_prop_types.default.bool,
|
|
inverse: import_prop_types.default.bool,
|
|
flip: import_prop_types.default.oneOf([true, false, "horizontal", "vertical", "both"]),
|
|
icon: import_prop_types.default.oneOfType([import_prop_types.default.object, import_prop_types.default.array, import_prop_types.default.string]),
|
|
listItem: import_prop_types.default.bool,
|
|
pull: import_prop_types.default.oneOf(["right", "left"]),
|
|
pulse: import_prop_types.default.bool,
|
|
rotation: import_prop_types.default.oneOf([0, 90, 180, 270]),
|
|
shake: import_prop_types.default.bool,
|
|
size: import_prop_types.default.oneOf(["2xs", "xs", "sm", "lg", "xl", "2xl", "1x", "2x", "3x", "4x", "5x", "6x", "7x", "8x", "9x", "10x"]),
|
|
spin: import_prop_types.default.bool,
|
|
spinPulse: import_prop_types.default.bool,
|
|
spinReverse: import_prop_types.default.bool,
|
|
symbol: import_prop_types.default.oneOfType([import_prop_types.default.bool, import_prop_types.default.string]),
|
|
title: import_prop_types.default.string,
|
|
titleId: import_prop_types.default.string,
|
|
transform: import_prop_types.default.oneOfType([import_prop_types.default.string, import_prop_types.default.object]),
|
|
swapOpacity: import_prop_types.default.bool
|
|
};
|
|
FontAwesomeIcon.defaultProps = {
|
|
border: false,
|
|
className: "",
|
|
mask: null,
|
|
maskId: null,
|
|
fixedWidth: false,
|
|
inverse: false,
|
|
flip: false,
|
|
icon: null,
|
|
listItem: false,
|
|
pull: null,
|
|
pulse: false,
|
|
rotation: null,
|
|
size: null,
|
|
spin: false,
|
|
spinPulse: false,
|
|
spinReverse: false,
|
|
beat: false,
|
|
fade: false,
|
|
beatFade: false,
|
|
bounce: false,
|
|
shake: false,
|
|
symbol: false,
|
|
title: "",
|
|
titleId: null,
|
|
transform: null,
|
|
swapOpacity: false
|
|
};
|
|
var convertCurry = convert.bind(null, import_react.default.createElement);
|
|
|
|
// src/components/IconButton.tsx
|
|
var import_jsx_runtime = __toESM(require_jsx_runtime());
|
|
function IconButton(props) {
|
|
const dispatch = useDispatch();
|
|
const selected = props.currentRoute == props.link;
|
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
"button",
|
|
{
|
|
onClick: () => {
|
|
dispatch(
|
|
setRoute({
|
|
path: props.link
|
|
})
|
|
);
|
|
},
|
|
className: `mx-2 flex flex-grow items-center rounded-b-lg` + (selected ? " bg-red-800" : " bg-zinc-600"),
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "z-10 w-full text-center text-xs text-white", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex place-content-center gap-x-3", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
FontAwesomeIcon,
|
|
{
|
|
icon: props.icon,
|
|
size: "xl",
|
|
className: "mb-1"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-mono text-xs", children: props.title })
|
|
] }),
|
|
selected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative -inset-x-3 -inset-y-1 mx-auto h-0 w-0", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-6 w-6 rotate-45 bg-red-800" }) }) : ""
|
|
] })
|
|
}
|
|
);
|
|
}
|
|
|
|
// src/routes/PayloadPage.tsx
|
|
var import_react4 = __toESM(require_react());
|
|
|
|
// src/components/Input.tsx
|
|
var import_react2 = __toESM(require_react());
|
|
|
|
// node_modules/uuid/dist/esm-browser/rng.js
|
|
var getRandomValues;
|
|
var rnds8 = new Uint8Array(16);
|
|
function rng() {
|
|
if (!getRandomValues) {
|
|
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
if (!getRandomValues) {
|
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
}
|
|
}
|
|
return getRandomValues(rnds8);
|
|
}
|
|
|
|
// node_modules/uuid/dist/esm-browser/stringify.js
|
|
var byteToHex = [];
|
|
for (let i = 0; i < 256; ++i) {
|
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
}
|
|
function unsafeStringify(arr, offset = 0) {
|
|
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
}
|
|
|
|
// node_modules/uuid/dist/esm-browser/native.js
|
|
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
var native_default = {
|
|
randomUUID
|
|
};
|
|
|
|
// node_modules/uuid/dist/esm-browser/v4.js
|
|
function v4(options, buf, offset) {
|
|
if (native_default.randomUUID && !buf && !options) {
|
|
return native_default.randomUUID();
|
|
}
|
|
options = options || {};
|
|
const rnds = options.random || (options.rng || rng)();
|
|
rnds[6] = rnds[6] & 15 | 64;
|
|
rnds[8] = rnds[8] & 63 | 128;
|
|
if (buf) {
|
|
offset = offset || 0;
|
|
for (let i = 0; i < 16; ++i) {
|
|
buf[offset + i] = rnds[i];
|
|
}
|
|
return buf;
|
|
}
|
|
return unsafeStringify(rnds);
|
|
}
|
|
var v4_default = v4;
|
|
|
|
// src/components/Input.tsx
|
|
init_common();
|
|
var import_jsx_runtime2 = __toESM(require_jsx_runtime());
|
|
function Input(props) {
|
|
const [guid, setGuid] = (0, import_react2.useState)(v4_default());
|
|
const [toFocus, setFocus] = (0, import_react2.useState)(false);
|
|
(0, import_react2.useEffect)(() => {
|
|
if (simulator() === 0 /* MSFS */) {
|
|
if (toFocus) {
|
|
Coherent.trigger("FOCUS_INPUT_FIELD", guid, "", "", "", false);
|
|
} else {
|
|
Coherent.trigger("UNFOCUS_INPUT_FIELD", guid);
|
|
}
|
|
}
|
|
}, [toFocus, guid]);
|
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
"input",
|
|
{
|
|
type: props.type ? props.type : "text",
|
|
min: props.min,
|
|
max: props.max,
|
|
step: props.step,
|
|
placeholder: props.placeholder,
|
|
disabled: props.disabled,
|
|
onFocus: (e) => {
|
|
if (!toFocus) {
|
|
setFocus(true);
|
|
e.target.select();
|
|
}
|
|
},
|
|
onBlur: (e) => {
|
|
if (props.onBlur)
|
|
props.onBlur(e.target.value);
|
|
if (toFocus)
|
|
setFocus(false);
|
|
},
|
|
value: props.value,
|
|
className: props.className,
|
|
onChange: (e) => {
|
|
if (props.onChange) {
|
|
props.onChange(e.target.value);
|
|
}
|
|
}
|
|
}
|
|
);
|
|
}
|
|
|
|
// src/components/GroundPage.tsx
|
|
var import_react3 = __toESM(require_react());
|
|
init_common();
|
|
var import_jsx_runtime3 = __toESM(require_jsx_runtime());
|
|
function GroundPage({ children }) {
|
|
const [isOnGround, setIsOnGround] = (0, import_react3.useState)(false);
|
|
(0, import_react3.useEffect)(() => {
|
|
async function getIsOnGround() {
|
|
const api2 = await lib();
|
|
setIsOnGround(
|
|
api2.getSimulatorVariable("A:SIM ON GROUND", "bool") != 0
|
|
);
|
|
}
|
|
getIsOnGround();
|
|
});
|
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: isOnGround ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h1", { className: "z-100 text-3xl font-bold text-red-300", children: "This page cannot be used right now" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "z-100 text-xl", children: "Please try again when you're on the ground" })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "h-full w-full bg-zinc-900 opacity-10", children })
|
|
] }) });
|
|
}
|
|
|
|
// src/routes/PayloadPage.tsx
|
|
init_common();
|
|
var import_jsx_runtime4 = __toESM(require_jsx_runtime());
|
|
function PayloadPage() {
|
|
const dispatch = useDispatch();
|
|
const planeConfig = useSelector((state) => state.plane);
|
|
const payloadConfig = useSelector((state) => state.payload);
|
|
const [minZFW, setMinZFW] = (0, import_react4.useState)(0);
|
|
const getOutput = async () => {
|
|
const api2 = await lib();
|
|
if (api2.getSimulatorVariable("A:SIM ON GROUND", "bool") != 1) {
|
|
return dispatch(
|
|
setToast({
|
|
type: "error",
|
|
message: "You must be on the ground to set fuel and payload."
|
|
})
|
|
);
|
|
}
|
|
if (payloadConfig.input.passengers > 0 || payloadConfig.input.cargo > 0) {
|
|
const payload = payloadConfig.input.passengers * payloadConfig.input.weightPerPassenger + payloadConfig.input.cargo;
|
|
const currentZfw = minZFW + payload;
|
|
return dispatch(
|
|
setPayload3({
|
|
payload,
|
|
zfw: currentZfw,
|
|
gw: currentZfw + payloadConfig.input.fuel,
|
|
fuel: payloadConfig.input.fuel,
|
|
load: (payload + payloadConfig.input.fuel) / (planeConfig.mtow - minZFW) * 100
|
|
})
|
|
);
|
|
}
|
|
dispatch(
|
|
setPayload3({
|
|
gw: payloadConfig.input.zfw + payloadConfig.input.cargo + payloadConfig.input.fuel,
|
|
payload: payloadConfig.input.zfw == 0 ? 0 : payloadConfig.input.zfw - minZFW,
|
|
zfw: payloadConfig.input.zfw == 0 ? minZFW : payloadConfig.input.zfw,
|
|
fuel: payloadConfig.input.fuel,
|
|
load: (payloadConfig.input.cargo + payloadConfig.input.fuel) / (planeConfig.mtow - minZFW) * 100
|
|
})
|
|
);
|
|
};
|
|
(0, import_react4.useEffect)(() => {
|
|
dispatch(getPlaneConfig());
|
|
if (payloadConfig.input.zfw == 0) {
|
|
dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
zfw: minZFW
|
|
}))
|
|
);
|
|
}
|
|
async function getMinZFW() {
|
|
const api2 = await lib();
|
|
const rawMinZFW = api2.getSimulatorVariable(
|
|
"A:EMPTY WEIGHT",
|
|
"Pounds"
|
|
);
|
|
setMinZFW(
|
|
planeConfig.options.general.weightUnits == "kgs" ? Math.round(rawMinZFW / 2.20462) : rawMinZFW
|
|
);
|
|
}
|
|
getMinZFW();
|
|
}, [dispatch]);
|
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(GroundPage, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex h-full w-full flex-col items-center pt-4 text-xs", children: planeConfig.payload ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "w-3/4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "w-full", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { children: "Load" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
Input,
|
|
{
|
|
type: "text",
|
|
value: `${Math.round(
|
|
planeConfig.payload.load
|
|
)}%`,
|
|
disabled: true,
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right text-white focus:border-blue-600 focus:ring-blue-600"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
"GW\xA0(x1000",
|
|
" ",
|
|
planeConfig.options.general.weightUnits.toUpperCase(),
|
|
")"
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
Input,
|
|
{
|
|
type: "text",
|
|
value: `${Math.round(
|
|
planeConfig.payload.gw / 100
|
|
) / 10}`,
|
|
disabled: true,
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right text-white focus:border-blue-600 focus:ring-blue-600"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
"ZFW\xA0(x1000",
|
|
" ",
|
|
planeConfig.options.general.weightUnits.toUpperCase(),
|
|
")"
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
Input,
|
|
{
|
|
type: "text",
|
|
value: `${Math.round(
|
|
planeConfig.payload.zfw / 100
|
|
) / 10}`,
|
|
disabled: true,
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right text-white focus:border-blue-600 focus:ring-blue-600"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
"Fuel\xA0(x1000",
|
|
" ",
|
|
planeConfig.options.general.weightUnits.toUpperCase(),
|
|
")"
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
Input,
|
|
{
|
|
type: "text",
|
|
value: `${Math.round(
|
|
planeConfig.payload.fuel / 100
|
|
) / 10}`,
|
|
disabled: true,
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right text-white focus:border-blue-600 focus:ring-blue-600"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex w-full items-center justify-between rounded-b-md bg-zinc-600 p-2 px-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
"Payload\xA0(x1000",
|
|
" ",
|
|
planeConfig.options.general.weightUnits.toUpperCase(),
|
|
")"
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
Input,
|
|
{
|
|
type: "text",
|
|
value: `${Math.round(
|
|
planeConfig.payload.payload / 100
|
|
) / 10}`,
|
|
disabled: true,
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right text-white focus:border-blue-600 focus:ring-blue-600"
|
|
}
|
|
)
|
|
] })
|
|
] }),
|
|
planeConfig.payload.load > 100 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "text-right font-medium text-red-500", children: "Load is over 100%" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mt-3 flex w-full items-center justify-start", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
"button",
|
|
{
|
|
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
"data-ripple-light": "true",
|
|
onClick: () => dispatch(resetPayload()),
|
|
children: "Go back"
|
|
}
|
|
) })
|
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
"ul",
|
|
{
|
|
className: "mb-4 flex list-none flex-row flex-wrap border-b-0 bg-zinc-900 pl-0",
|
|
role: "tablist",
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
"button",
|
|
{
|
|
className: `${payloadConfig.selectedTab === 0 ? "text-white underline" : "text-neutral-500"} my-2 block border-x-0 border-b-2 border-t-0 border-transparent bg-zinc-900 px-7 text-sm font-medium uppercase`,
|
|
role: "tab",
|
|
onClick: () => dispatch(setSelectedTab(0)),
|
|
children: "Passenger & Cargo"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("li", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
"button",
|
|
{
|
|
className: `${payloadConfig.selectedTab === 1 ? "text-white underline" : "text-neutral-500"} my-2 block border-x-0 border-b-2 border-t-0 border-transparent bg-zinc-900 px-7 text-sm font-medium uppercase`,
|
|
onClick: () => dispatch(setSelectedTab(1)),
|
|
children: "ZFW"
|
|
}
|
|
) })
|
|
]
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "w-3/4 flex-col items-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
"div",
|
|
{
|
|
className: `${payloadConfig.selectedTab === 0 ? "block" : "hidden"} flex h-full w-full flex-col opacity-100 transition-opacity duration-150 ease-linear`,
|
|
role: "tabpanel",
|
|
children: [
|
|
!planeConfig.options.general.isCargo && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { children: "Passengers" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
Input,
|
|
{
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600",
|
|
placeholder: "",
|
|
onChange: (e) => {
|
|
if (e.length > 3)
|
|
return;
|
|
const value = parseInt(e);
|
|
dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
passengers: value || 0
|
|
}))
|
|
);
|
|
},
|
|
onBlur: (e) => {
|
|
const value = parseInt(e);
|
|
if (value < 0 || isNaN(value)) {
|
|
return dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
passengers: 0
|
|
}))
|
|
);
|
|
} else if (value > 410) {
|
|
return dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
passengers: value || 0
|
|
}))
|
|
);
|
|
}
|
|
dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
passengers: value
|
|
}))
|
|
);
|
|
},
|
|
value: payloadConfig.input.passengers
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
"Weight per passenger (",
|
|
planeConfig.options.general.weightUnits.toUpperCase(),
|
|
")"
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
Input,
|
|
{
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600",
|
|
placeholder: "",
|
|
onChange: (e) => {
|
|
if (e.length > 3)
|
|
return;
|
|
const value = parseInt(e);
|
|
dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
weightPerPassenger: value || planeConfig.options.general.weightUnits == "kgs" ? 79 : 175
|
|
}))
|
|
);
|
|
},
|
|
onBlur: (e) => {
|
|
const value = parseInt(e);
|
|
if (value < 0 || isNaN(value)) {
|
|
return dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
weightPerPassenger: 79
|
|
}))
|
|
);
|
|
}
|
|
dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
weightPerPassenger: value
|
|
}))
|
|
);
|
|
},
|
|
value: payloadConfig.input.weightPerPassenger
|
|
}
|
|
)
|
|
] })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
"div",
|
|
{
|
|
className: `relative flex w-full items-center justify-between ${planeConfig.options.general.isCargo ? "rounded-t-md" : ""} bg-zinc-600 p-2 px-4`,
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
"Cargo (",
|
|
planeConfig.options.general.weightUnits.toUpperCase(),
|
|
")"
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
Input,
|
|
{
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600",
|
|
placeholder: "",
|
|
onChange: (e) => {
|
|
if (e.length > 6)
|
|
return;
|
|
const value = parseInt(e);
|
|
dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
cargo: value || 0
|
|
}))
|
|
);
|
|
},
|
|
onBlur: (e) => {
|
|
const value = parseInt(e);
|
|
if (value < 0 || isNaN(value)) {
|
|
return dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
cargo: 0
|
|
}))
|
|
);
|
|
}
|
|
dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
cargo: value
|
|
}))
|
|
);
|
|
},
|
|
value: payloadConfig.input.cargo
|
|
}
|
|
)
|
|
]
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
"Fuel Quantity (",
|
|
planeConfig.options.general.weightUnits.toUpperCase(),
|
|
")"
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
Input,
|
|
{
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600",
|
|
placeholder: "",
|
|
onChange: (e) => {
|
|
if (e.length > 6)
|
|
return;
|
|
const value = parseInt(e);
|
|
dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
fuel: value || 0
|
|
}))
|
|
);
|
|
},
|
|
onBlur: (e) => {
|
|
const value = parseInt(e);
|
|
if (value < 0 || isNaN(value)) {
|
|
return dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
fuel: 0
|
|
}))
|
|
);
|
|
} else if (value > planeConfig.maxFuel) {
|
|
return dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
fuel: planeConfig.maxFuel
|
|
}))
|
|
);
|
|
}
|
|
return dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
fuel: value
|
|
}))
|
|
);
|
|
},
|
|
value: payloadConfig.input.fuel
|
|
}
|
|
)
|
|
] })
|
|
]
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
"div",
|
|
{
|
|
className: `${payloadConfig.selectedTab === 1 ? "block" : "hidden"} opacity-100 transition-opacity duration-150 ease-linear`,
|
|
role: "tabpanel",
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
"ZFW (",
|
|
planeConfig.options.general.weightUnits.toUpperCase(),
|
|
")"
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
Input,
|
|
{
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600",
|
|
placeholder: "",
|
|
onChange: (e) => {
|
|
if (e.length > 6)
|
|
return;
|
|
const value = parseInt(e);
|
|
dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
zfw: value
|
|
}))
|
|
);
|
|
},
|
|
onBlur: (e) => {
|
|
const value = parseInt(e);
|
|
if (value < minZFW || isNaN(value)) {
|
|
return dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
zfw: minZFW
|
|
}))
|
|
);
|
|
} else if (value > planeConfig.maxZfw) {
|
|
return dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
zfw: planeConfig.maxZfw
|
|
}))
|
|
);
|
|
}
|
|
return dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
zfw: parseInt(e)
|
|
}))
|
|
);
|
|
},
|
|
value: Number.isNaN(
|
|
payloadConfig.input.zfw
|
|
) ? 0 : payloadConfig.input.zfw === 0 ? minZFW : payloadConfig.input.zfw
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
|
|
"Fuel Quantity (",
|
|
planeConfig.options.general.weightUnits.toUpperCase(),
|
|
")"
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
Input,
|
|
{
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-right focus:border-blue-600 focus:ring-blue-600",
|
|
placeholder: "",
|
|
onChange: (e) => {
|
|
if (e.length > 6)
|
|
return;
|
|
const value = parseInt(e);
|
|
dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
fuel: value || 0
|
|
}))
|
|
);
|
|
},
|
|
onBlur: (e) => {
|
|
const value = parseInt(e);
|
|
if (value < 0 || isNaN(value)) {
|
|
return dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
fuel: 0
|
|
}))
|
|
);
|
|
} else if (value > planeConfig.maxFuel) {
|
|
return dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
fuel: planeConfig.maxFuel
|
|
}))
|
|
);
|
|
}
|
|
dispatch(
|
|
setInput(__spreadProps(__spreadValues({}, payloadConfig.input), {
|
|
fuel: value
|
|
}))
|
|
);
|
|
},
|
|
value: payloadConfig.input.fuel
|
|
}
|
|
)
|
|
] })
|
|
]
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "mt-4 flex h-full w-3/4 flex-col items-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "relative flex w-full items-center justify-start", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
"button",
|
|
{
|
|
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
"data-ripple-light": "true",
|
|
onClick: () => getOutput(),
|
|
children: "Set Payload"
|
|
}
|
|
) }) })
|
|
] }) }) });
|
|
}
|
|
|
|
// src/routes/PerformancePage.tsx
|
|
var import_react8 = __toESM(require_react());
|
|
|
|
// src/components/DeparturePerf.tsx
|
|
var import_react6 = __toESM(require_react());
|
|
|
|
// src/lib/wind.ts
|
|
function fmod(a, b) {
|
|
return Number((a - Math.floor(a / b) * b).toPrecision(8));
|
|
}
|
|
function degToRadians(deg) {
|
|
return deg * (Math.PI / 180);
|
|
}
|
|
function diffAngle(newAngle, oldAngle) {
|
|
const diff = fmod(newAngle - oldAngle + 180, 360) - 180;
|
|
return diff < -180 ? diff + 360 : diff;
|
|
}
|
|
function getWindComponent(windDirection, windSpeed, runwayHeading) {
|
|
const htwind = windSpeed * Math.cos(degToRadians(diffAngle(runwayHeading, windDirection)));
|
|
return {
|
|
speed: htwind,
|
|
headwind: htwind < 0
|
|
};
|
|
}
|
|
|
|
// node_modules/axios/lib/helpers/bind.js
|
|
function bind(fn, thisArg) {
|
|
return function wrap() {
|
|
return fn.apply(thisArg, arguments);
|
|
};
|
|
}
|
|
|
|
// node_modules/axios/lib/utils.js
|
|
var { toString } = Object.prototype;
|
|
var { getPrototypeOf: getPrototypeOf2 } = Object;
|
|
var kindOf2 = ((cache) => (thing) => {
|
|
const str = toString.call(thing);
|
|
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
})(/* @__PURE__ */ Object.create(null));
|
|
var kindOfTest = (type) => {
|
|
type = type.toLowerCase();
|
|
return (thing) => kindOf2(thing) === type;
|
|
};
|
|
var typeOfTest = (type) => (thing) => typeof thing === type;
|
|
var { isArray } = Array;
|
|
var isUndefined = typeOfTest("undefined");
|
|
function isBuffer(val) {
|
|
return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor) && isFunction(val.constructor.isBuffer) && val.constructor.isBuffer(val);
|
|
}
|
|
var isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
function isArrayBufferView(val) {
|
|
let result;
|
|
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
result = ArrayBuffer.isView(val);
|
|
} else {
|
|
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
}
|
|
return result;
|
|
}
|
|
var isString = typeOfTest("string");
|
|
var isFunction = typeOfTest("function");
|
|
var isNumber = typeOfTest("number");
|
|
var isObject = (thing) => thing !== null && typeof thing === "object";
|
|
var isBoolean2 = (thing) => thing === true || thing === false;
|
|
var isPlainObject3 = (val) => {
|
|
if (kindOf2(val) !== "object") {
|
|
return false;
|
|
}
|
|
const prototype3 = getPrototypeOf2(val);
|
|
return (prototype3 === null || prototype3 === Object.prototype || Object.getPrototypeOf(prototype3) === null) && !(Symbol.toStringTag in val) && !(Symbol.iterator in val);
|
|
};
|
|
var isDate2 = kindOfTest("Date");
|
|
var isFile = kindOfTest("File");
|
|
var isBlob = kindOfTest("Blob");
|
|
var isFileList = kindOfTest("FileList");
|
|
var isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
var isFormData = (thing) => {
|
|
let kind;
|
|
return thing && (typeof FormData === "function" && thing instanceof FormData || isFunction(thing.append) && ((kind = kindOf2(thing)) === "formdata" || kind === "object" && isFunction(thing.toString) && thing.toString() === "[object FormData]"));
|
|
};
|
|
var isURLSearchParams = kindOfTest("URLSearchParams");
|
|
var trim = (str) => str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
if (obj === null || typeof obj === "undefined") {
|
|
return;
|
|
}
|
|
let i;
|
|
let l;
|
|
if (typeof obj !== "object") {
|
|
obj = [obj];
|
|
}
|
|
if (isArray(obj)) {
|
|
for (i = 0, l = obj.length; i < l; i++) {
|
|
fn.call(null, obj[i], i, obj);
|
|
}
|
|
} else {
|
|
const keys2 = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);
|
|
const len = keys2.length;
|
|
let key;
|
|
for (i = 0; i < len; i++) {
|
|
key = keys2[i];
|
|
fn.call(null, obj[key], key, obj);
|
|
}
|
|
}
|
|
}
|
|
function findKey(obj, key) {
|
|
key = key.toLowerCase();
|
|
const keys2 = Object.keys(obj);
|
|
let i = keys2.length;
|
|
let _key;
|
|
while (i-- > 0) {
|
|
_key = keys2[i];
|
|
if (key === _key.toLowerCase()) {
|
|
return _key;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
var _global = (() => {
|
|
if (typeof globalThis !== "undefined")
|
|
return globalThis;
|
|
return typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : global;
|
|
})();
|
|
var isContextDefined = (context) => !isUndefined(context) && context !== _global;
|
|
function merge() {
|
|
const { caseless } = isContextDefined(this) && this || {};
|
|
const result = {};
|
|
const assignValue = (val, key) => {
|
|
const targetKey = caseless && findKey(result, key) || key;
|
|
if (isPlainObject3(result[targetKey]) && isPlainObject3(val)) {
|
|
result[targetKey] = merge(result[targetKey], val);
|
|
} else if (isPlainObject3(val)) {
|
|
result[targetKey] = merge({}, val);
|
|
} else if (isArray(val)) {
|
|
result[targetKey] = val.slice();
|
|
} else {
|
|
result[targetKey] = val;
|
|
}
|
|
};
|
|
for (let i = 0, l = arguments.length; i < l; i++) {
|
|
arguments[i] && forEach(arguments[i], assignValue);
|
|
}
|
|
return result;
|
|
}
|
|
var extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
forEach(b, (val, key) => {
|
|
if (thisArg && isFunction(val)) {
|
|
a[key] = bind(val, thisArg);
|
|
} else {
|
|
a[key] = val;
|
|
}
|
|
}, { allOwnKeys });
|
|
return a;
|
|
};
|
|
var stripBOM = (content) => {
|
|
if (content.charCodeAt(0) === 65279) {
|
|
content = content.slice(1);
|
|
}
|
|
return content;
|
|
};
|
|
var inherits = (constructor, superConstructor, props, descriptors2) => {
|
|
constructor.prototype = Object.create(superConstructor.prototype, descriptors2);
|
|
constructor.prototype.constructor = constructor;
|
|
Object.defineProperty(constructor, "super", {
|
|
value: superConstructor.prototype
|
|
});
|
|
props && Object.assign(constructor.prototype, props);
|
|
};
|
|
var toFlatObject = (sourceObj, destObj, filter2, propFilter) => {
|
|
let props;
|
|
let i;
|
|
let prop;
|
|
const merged = {};
|
|
destObj = destObj || {};
|
|
if (sourceObj == null)
|
|
return destObj;
|
|
do {
|
|
props = Object.getOwnPropertyNames(sourceObj);
|
|
i = props.length;
|
|
while (i-- > 0) {
|
|
prop = props[i];
|
|
if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {
|
|
destObj[prop] = sourceObj[prop];
|
|
merged[prop] = true;
|
|
}
|
|
}
|
|
sourceObj = filter2 !== false && getPrototypeOf2(sourceObj);
|
|
} while (sourceObj && (!filter2 || filter2(sourceObj, destObj)) && sourceObj !== Object.prototype);
|
|
return destObj;
|
|
};
|
|
var endsWith = (str, searchString, position) => {
|
|
str = String(str);
|
|
if (position === void 0 || position > str.length) {
|
|
position = str.length;
|
|
}
|
|
position -= searchString.length;
|
|
const lastIndex = str.indexOf(searchString, position);
|
|
return lastIndex !== -1 && lastIndex === position;
|
|
};
|
|
var toArray2 = (thing) => {
|
|
if (!thing)
|
|
return null;
|
|
if (isArray(thing))
|
|
return thing;
|
|
let i = thing.length;
|
|
if (!isNumber(i))
|
|
return null;
|
|
const arr = new Array(i);
|
|
while (i-- > 0) {
|
|
arr[i] = thing[i];
|
|
}
|
|
return arr;
|
|
};
|
|
var isTypedArray = ((TypedArray) => {
|
|
return (thing) => {
|
|
return TypedArray && thing instanceof TypedArray;
|
|
};
|
|
})(typeof Uint8Array !== "undefined" && getPrototypeOf2(Uint8Array));
|
|
var forEachEntry = (obj, fn) => {
|
|
const generator = obj && obj[Symbol.iterator];
|
|
const iterator = generator.call(obj);
|
|
let result;
|
|
while ((result = iterator.next()) && !result.done) {
|
|
const pair = result.value;
|
|
fn.call(obj, pair[0], pair[1]);
|
|
}
|
|
};
|
|
var matchAll = (regExp, str) => {
|
|
let matches2;
|
|
const arr = [];
|
|
while ((matches2 = regExp.exec(str)) !== null) {
|
|
arr.push(matches2);
|
|
}
|
|
return arr;
|
|
};
|
|
var isHTMLForm = kindOfTest("HTMLFormElement");
|
|
var toCamelCase = (str) => {
|
|
return str.toLowerCase().replace(
|
|
/[-_\s]([a-z\d])(\w*)/g,
|
|
function replacer(m, p1, p2) {
|
|
return p1.toUpperCase() + p2;
|
|
}
|
|
);
|
|
};
|
|
var hasOwnProperty = (({ hasOwnProperty: hasOwnProperty2 }) => (obj, prop) => hasOwnProperty2.call(obj, prop))(Object.prototype);
|
|
var isRegExp = kindOfTest("RegExp");
|
|
var reduceDescriptors = (obj, reducer) => {
|
|
const descriptors2 = Object.getOwnPropertyDescriptors(obj);
|
|
const reducedDescriptors = {};
|
|
forEach(descriptors2, (descriptor, name) => {
|
|
let ret;
|
|
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
|
reducedDescriptors[name] = ret || descriptor;
|
|
}
|
|
});
|
|
Object.defineProperties(obj, reducedDescriptors);
|
|
};
|
|
var freezeMethods = (obj) => {
|
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
if (isFunction(obj) && ["arguments", "caller", "callee"].indexOf(name) !== -1) {
|
|
return false;
|
|
}
|
|
const value = obj[name];
|
|
if (!isFunction(value))
|
|
return;
|
|
descriptor.enumerable = false;
|
|
if ("writable" in descriptor) {
|
|
descriptor.writable = false;
|
|
return;
|
|
}
|
|
if (!descriptor.set) {
|
|
descriptor.set = () => {
|
|
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
};
|
|
}
|
|
});
|
|
};
|
|
var toObjectSet = (arrayOrString, delimiter) => {
|
|
const obj = {};
|
|
const define2 = (arr) => {
|
|
arr.forEach((value) => {
|
|
obj[value] = true;
|
|
});
|
|
};
|
|
isArray(arrayOrString) ? define2(arrayOrString) : define2(String(arrayOrString).split(delimiter));
|
|
return obj;
|
|
};
|
|
var noop6 = () => {
|
|
};
|
|
var toFiniteNumber = (value, defaultValue) => {
|
|
value = +value;
|
|
return Number.isFinite(value) ? value : defaultValue;
|
|
};
|
|
var ALPHA = "abcdefghijklmnopqrstuvwxyz";
|
|
var DIGIT = "0123456789";
|
|
var ALPHABET = {
|
|
DIGIT,
|
|
ALPHA,
|
|
ALPHA_DIGIT: ALPHA + ALPHA.toUpperCase() + DIGIT
|
|
};
|
|
var generateString = (size = 16, alphabet = ALPHABET.ALPHA_DIGIT) => {
|
|
let str = "";
|
|
const { length } = alphabet;
|
|
while (size--) {
|
|
str += alphabet[Math.random() * length | 0];
|
|
}
|
|
return str;
|
|
};
|
|
function isSpecCompliantForm(thing) {
|
|
return !!(thing && isFunction(thing.append) && thing[Symbol.toStringTag] === "FormData" && thing[Symbol.iterator]);
|
|
}
|
|
var toJSONObject = (obj) => {
|
|
const stack = new Array(10);
|
|
const visit = (source, i) => {
|
|
if (isObject(source)) {
|
|
if (stack.indexOf(source) >= 0) {
|
|
return;
|
|
}
|
|
if (!("toJSON" in source)) {
|
|
stack[i] = source;
|
|
const target = isArray(source) ? [] : {};
|
|
forEach(source, (value, key) => {
|
|
const reducedValue = visit(value, i + 1);
|
|
!isUndefined(reducedValue) && (target[key] = reducedValue);
|
|
});
|
|
stack[i] = void 0;
|
|
return target;
|
|
}
|
|
}
|
|
return source;
|
|
};
|
|
return visit(obj, 0);
|
|
};
|
|
var isAsyncFn = kindOfTest("AsyncFunction");
|
|
var isThenable2 = (thing) => thing && (isObject(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
|
|
var utils_default = {
|
|
isArray,
|
|
isArrayBuffer,
|
|
isBuffer,
|
|
isFormData,
|
|
isArrayBufferView,
|
|
isString,
|
|
isNumber,
|
|
isBoolean: isBoolean2,
|
|
isObject,
|
|
isPlainObject: isPlainObject3,
|
|
isUndefined,
|
|
isDate: isDate2,
|
|
isFile,
|
|
isBlob,
|
|
isRegExp,
|
|
isFunction,
|
|
isStream,
|
|
isURLSearchParams,
|
|
isTypedArray,
|
|
isFileList,
|
|
forEach,
|
|
merge,
|
|
extend,
|
|
trim,
|
|
stripBOM,
|
|
inherits,
|
|
toFlatObject,
|
|
kindOf: kindOf2,
|
|
kindOfTest,
|
|
endsWith,
|
|
toArray: toArray2,
|
|
forEachEntry,
|
|
matchAll,
|
|
isHTMLForm,
|
|
hasOwnProperty,
|
|
hasOwnProp: hasOwnProperty,
|
|
reduceDescriptors,
|
|
freezeMethods,
|
|
toObjectSet,
|
|
toCamelCase,
|
|
noop: noop6,
|
|
toFiniteNumber,
|
|
findKey,
|
|
global: _global,
|
|
isContextDefined,
|
|
ALPHABET,
|
|
generateString,
|
|
isSpecCompliantForm,
|
|
toJSONObject,
|
|
isAsyncFn,
|
|
isThenable: isThenable2
|
|
};
|
|
|
|
// node_modules/axios/lib/core/AxiosError.js
|
|
function AxiosError(message, code, config3, request, response) {
|
|
Error.call(this);
|
|
if (Error.captureStackTrace) {
|
|
Error.captureStackTrace(this, this.constructor);
|
|
} else {
|
|
this.stack = new Error().stack;
|
|
}
|
|
this.message = message;
|
|
this.name = "AxiosError";
|
|
code && (this.code = code);
|
|
config3 && (this.config = config3);
|
|
request && (this.request = request);
|
|
response && (this.response = response);
|
|
}
|
|
utils_default.inherits(AxiosError, Error, {
|
|
toJSON: function toJSON() {
|
|
return {
|
|
message: this.message,
|
|
name: this.name,
|
|
description: this.description,
|
|
number: this.number,
|
|
fileName: this.fileName,
|
|
lineNumber: this.lineNumber,
|
|
columnNumber: this.columnNumber,
|
|
stack: this.stack,
|
|
config: utils_default.toJSONObject(this.config),
|
|
code: this.code,
|
|
status: this.response && this.response.status ? this.response.status : null
|
|
};
|
|
}
|
|
});
|
|
var prototype = AxiosError.prototype;
|
|
var descriptors = {};
|
|
[
|
|
"ERR_BAD_OPTION_VALUE",
|
|
"ERR_BAD_OPTION",
|
|
"ECONNABORTED",
|
|
"ETIMEDOUT",
|
|
"ERR_NETWORK",
|
|
"ERR_FR_TOO_MANY_REDIRECTS",
|
|
"ERR_DEPRECATED",
|
|
"ERR_BAD_RESPONSE",
|
|
"ERR_BAD_REQUEST",
|
|
"ERR_CANCELED",
|
|
"ERR_NOT_SUPPORT",
|
|
"ERR_INVALID_URL"
|
|
].forEach((code) => {
|
|
descriptors[code] = { value: code };
|
|
});
|
|
Object.defineProperties(AxiosError, descriptors);
|
|
Object.defineProperty(prototype, "isAxiosError", { value: true });
|
|
AxiosError.from = (error, code, config3, request, response, customProps) => {
|
|
const axiosError = Object.create(prototype);
|
|
utils_default.toFlatObject(error, axiosError, function filter2(obj) {
|
|
return obj !== Error.prototype;
|
|
}, (prop) => {
|
|
return prop !== "isAxiosError";
|
|
});
|
|
AxiosError.call(axiosError, error.message, code, config3, request, response);
|
|
axiosError.cause = error;
|
|
axiosError.name = error.name;
|
|
customProps && Object.assign(axiosError, customProps);
|
|
return axiosError;
|
|
};
|
|
var AxiosError_default = AxiosError;
|
|
|
|
// node_modules/axios/lib/helpers/null.js
|
|
var null_default = null;
|
|
|
|
// node_modules/axios/lib/helpers/toFormData.js
|
|
function isVisitable(thing) {
|
|
return utils_default.isPlainObject(thing) || utils_default.isArray(thing);
|
|
}
|
|
function removeBrackets(key) {
|
|
return utils_default.endsWith(key, "[]") ? key.slice(0, -2) : key;
|
|
}
|
|
function renderKey(path, key, dots) {
|
|
if (!path)
|
|
return key;
|
|
return path.concat(key).map(function each2(token, i) {
|
|
token = removeBrackets(token);
|
|
return !dots && i ? "[" + token + "]" : token;
|
|
}).join(dots ? "." : "");
|
|
}
|
|
function isFlatArray(arr) {
|
|
return utils_default.isArray(arr) && !arr.some(isVisitable);
|
|
}
|
|
var predicates = utils_default.toFlatObject(utils_default, {}, null, function filter(prop) {
|
|
return /^is[A-Z]/.test(prop);
|
|
});
|
|
function toFormData(obj, formData, options) {
|
|
if (!utils_default.isObject(obj)) {
|
|
throw new TypeError("target must be an object");
|
|
}
|
|
formData = formData || new (null_default || FormData)();
|
|
options = utils_default.toFlatObject(options, {
|
|
metaTokens: true,
|
|
dots: false,
|
|
indexes: false
|
|
}, false, function defined(option, source) {
|
|
return !utils_default.isUndefined(source[option]);
|
|
});
|
|
const metaTokens = options.metaTokens;
|
|
const visitor = options.visitor || defaultVisitor;
|
|
const dots = options.dots;
|
|
const indexes = options.indexes;
|
|
const _Blob = options.Blob || typeof Blob !== "undefined" && Blob;
|
|
const useBlob = _Blob && utils_default.isSpecCompliantForm(formData);
|
|
if (!utils_default.isFunction(visitor)) {
|
|
throw new TypeError("visitor must be a function");
|
|
}
|
|
function convertValue(value) {
|
|
if (value === null)
|
|
return "";
|
|
if (utils_default.isDate(value)) {
|
|
return value.toISOString();
|
|
}
|
|
if (!useBlob && utils_default.isBlob(value)) {
|
|
throw new AxiosError_default("Blob is not supported. Use a Buffer instead.");
|
|
}
|
|
if (utils_default.isArrayBuffer(value) || utils_default.isTypedArray(value)) {
|
|
return useBlob && typeof Blob === "function" ? new Blob([value]) : Buffer.from(value);
|
|
}
|
|
return value;
|
|
}
|
|
function defaultVisitor(value, key, path) {
|
|
let arr = value;
|
|
if (value && !path && typeof value === "object") {
|
|
if (utils_default.endsWith(key, "{}")) {
|
|
key = metaTokens ? key : key.slice(0, -2);
|
|
value = JSON.stringify(value);
|
|
} else if (utils_default.isArray(value) && isFlatArray(value) || (utils_default.isFileList(value) || utils_default.endsWith(key, "[]")) && (arr = utils_default.toArray(value))) {
|
|
key = removeBrackets(key);
|
|
arr.forEach(function each2(el, index) {
|
|
!(utils_default.isUndefined(el) || el === null) && formData.append(
|
|
indexes === true ? renderKey([key], index, dots) : indexes === null ? key : key + "[]",
|
|
convertValue(el)
|
|
);
|
|
});
|
|
return false;
|
|
}
|
|
}
|
|
if (isVisitable(value)) {
|
|
return true;
|
|
}
|
|
formData.append(renderKey(path, key, dots), convertValue(value));
|
|
return false;
|
|
}
|
|
const stack = [];
|
|
const exposedHelpers = Object.assign(predicates, {
|
|
defaultVisitor,
|
|
convertValue,
|
|
isVisitable
|
|
});
|
|
function build3(value, path) {
|
|
if (utils_default.isUndefined(value))
|
|
return;
|
|
if (stack.indexOf(value) !== -1) {
|
|
throw Error("Circular reference detected in " + path.join("."));
|
|
}
|
|
stack.push(value);
|
|
utils_default.forEach(value, function each2(el, key) {
|
|
const result = !(utils_default.isUndefined(el) || el === null) && visitor.call(
|
|
formData,
|
|
el,
|
|
utils_default.isString(key) ? key.trim() : key,
|
|
path,
|
|
exposedHelpers
|
|
);
|
|
if (result === true) {
|
|
build3(el, path ? path.concat(key) : [key]);
|
|
}
|
|
});
|
|
stack.pop();
|
|
}
|
|
if (!utils_default.isObject(obj)) {
|
|
throw new TypeError("data must be an object");
|
|
}
|
|
build3(obj);
|
|
return formData;
|
|
}
|
|
var toFormData_default = toFormData;
|
|
|
|
// node_modules/axios/lib/helpers/AxiosURLSearchParams.js
|
|
function encode(str) {
|
|
const charMap = {
|
|
"!": "%21",
|
|
"'": "%27",
|
|
"(": "%28",
|
|
")": "%29",
|
|
"~": "%7E",
|
|
"%20": "+",
|
|
"%00": "\0"
|
|
};
|
|
return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
|
|
return charMap[match];
|
|
});
|
|
}
|
|
function AxiosURLSearchParams(params, options) {
|
|
this._pairs = [];
|
|
params && toFormData_default(params, this, options);
|
|
}
|
|
var prototype2 = AxiosURLSearchParams.prototype;
|
|
prototype2.append = function append(name, value) {
|
|
this._pairs.push([name, value]);
|
|
};
|
|
prototype2.toString = function toString2(encoder) {
|
|
const _encode = encoder ? function(value) {
|
|
return encoder.call(this, value, encode);
|
|
} : encode;
|
|
return this._pairs.map(function each2(pair) {
|
|
return _encode(pair[0]) + "=" + _encode(pair[1]);
|
|
}, "").join("&");
|
|
};
|
|
var AxiosURLSearchParams_default = AxiosURLSearchParams;
|
|
|
|
// node_modules/axios/lib/helpers/buildURL.js
|
|
function encode2(val) {
|
|
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
}
|
|
function buildURL(url, params, options) {
|
|
if (!params) {
|
|
return url;
|
|
}
|
|
const _encode = options && options.encode || encode2;
|
|
const serializeFn = options && options.serialize;
|
|
let serializedParams;
|
|
if (serializeFn) {
|
|
serializedParams = serializeFn(params, options);
|
|
} else {
|
|
serializedParams = utils_default.isURLSearchParams(params) ? params.toString() : new AxiosURLSearchParams_default(params, options).toString(_encode);
|
|
}
|
|
if (serializedParams) {
|
|
const hashmarkIndex = url.indexOf("#");
|
|
if (hashmarkIndex !== -1) {
|
|
url = url.slice(0, hashmarkIndex);
|
|
}
|
|
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
|
}
|
|
return url;
|
|
}
|
|
|
|
// node_modules/axios/lib/core/InterceptorManager.js
|
|
var InterceptorManager = class {
|
|
constructor() {
|
|
this.handlers = [];
|
|
}
|
|
use(fulfilled, rejected, options) {
|
|
this.handlers.push({
|
|
fulfilled,
|
|
rejected,
|
|
synchronous: options ? options.synchronous : false,
|
|
runWhen: options ? options.runWhen : null
|
|
});
|
|
return this.handlers.length - 1;
|
|
}
|
|
eject(id) {
|
|
if (this.handlers[id]) {
|
|
this.handlers[id] = null;
|
|
}
|
|
}
|
|
clear() {
|
|
if (this.handlers) {
|
|
this.handlers = [];
|
|
}
|
|
}
|
|
forEach(fn) {
|
|
utils_default.forEach(this.handlers, function forEachHandler(h) {
|
|
if (h !== null) {
|
|
fn(h);
|
|
}
|
|
});
|
|
}
|
|
};
|
|
var InterceptorManager_default = InterceptorManager;
|
|
|
|
// node_modules/axios/lib/defaults/transitional.js
|
|
var transitional_default = {
|
|
silentJSONParsing: true,
|
|
forcedJSONParsing: true,
|
|
clarifyTimeoutError: false
|
|
};
|
|
|
|
// node_modules/axios/lib/platform/browser/classes/URLSearchParams.js
|
|
var URLSearchParams_default = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams_default;
|
|
|
|
// node_modules/axios/lib/platform/browser/classes/FormData.js
|
|
var FormData_default = typeof FormData !== "undefined" ? FormData : null;
|
|
|
|
// node_modules/axios/lib/platform/browser/classes/Blob.js
|
|
var Blob_default = typeof Blob !== "undefined" ? Blob : null;
|
|
|
|
// node_modules/axios/lib/platform/browser/index.js
|
|
var browser_default = {
|
|
isBrowser: true,
|
|
classes: {
|
|
URLSearchParams: URLSearchParams_default,
|
|
FormData: FormData_default,
|
|
Blob: Blob_default
|
|
},
|
|
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
};
|
|
|
|
// node_modules/axios/lib/platform/common/utils.js
|
|
var utils_exports = {};
|
|
__export(utils_exports, {
|
|
hasBrowserEnv: () => hasBrowserEnv,
|
|
hasStandardBrowserEnv: () => hasStandardBrowserEnv,
|
|
hasStandardBrowserWebWorkerEnv: () => hasStandardBrowserWebWorkerEnv
|
|
});
|
|
var hasBrowserEnv = typeof window !== "undefined" && typeof document !== "undefined";
|
|
var hasStandardBrowserEnv = ((product) => {
|
|
return hasBrowserEnv && ["ReactNative", "NativeScript", "NS"].indexOf(product) < 0;
|
|
})(typeof navigator !== "undefined" && navigator.product);
|
|
var hasStandardBrowserWebWorkerEnv = (() => {
|
|
return typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope && typeof self.importScripts === "function";
|
|
})();
|
|
|
|
// node_modules/axios/lib/platform/index.js
|
|
var platform_default = __spreadValues(__spreadValues({}, utils_exports), browser_default);
|
|
|
|
// node_modules/axios/lib/helpers/toURLEncodedForm.js
|
|
function toURLEncodedForm(data, options) {
|
|
return toFormData_default(data, new platform_default.classes.URLSearchParams(), Object.assign({
|
|
visitor: function(value, key, path, helpers) {
|
|
if (platform_default.isNode && utils_default.isBuffer(value)) {
|
|
this.append(key, value.toString("base64"));
|
|
return false;
|
|
}
|
|
return helpers.defaultVisitor.apply(this, arguments);
|
|
}
|
|
}, options));
|
|
}
|
|
|
|
// node_modules/axios/lib/helpers/formDataToJSON.js
|
|
function parsePropPath(name) {
|
|
return utils_default.matchAll(/\w+|\[(\w*)]/g, name).map((match) => {
|
|
return match[0] === "[]" ? "" : match[1] || match[0];
|
|
});
|
|
}
|
|
function arrayToObject(arr) {
|
|
const obj = {};
|
|
const keys2 = Object.keys(arr);
|
|
let i;
|
|
const len = keys2.length;
|
|
let key;
|
|
for (i = 0; i < len; i++) {
|
|
key = keys2[i];
|
|
obj[key] = arr[key];
|
|
}
|
|
return obj;
|
|
}
|
|
function formDataToJSON(formData) {
|
|
function buildPath(path, value, target, index) {
|
|
let name = path[index++];
|
|
if (name === "__proto__")
|
|
return true;
|
|
const isNumericKey = Number.isFinite(+name);
|
|
const isLast = index >= path.length;
|
|
name = !name && utils_default.isArray(target) ? target.length : name;
|
|
if (isLast) {
|
|
if (utils_default.hasOwnProp(target, name)) {
|
|
target[name] = [target[name], value];
|
|
} else {
|
|
target[name] = value;
|
|
}
|
|
return !isNumericKey;
|
|
}
|
|
if (!target[name] || !utils_default.isObject(target[name])) {
|
|
target[name] = [];
|
|
}
|
|
const result = buildPath(path, value, target[name], index);
|
|
if (result && utils_default.isArray(target[name])) {
|
|
target[name] = arrayToObject(target[name]);
|
|
}
|
|
return !isNumericKey;
|
|
}
|
|
if (utils_default.isFormData(formData) && utils_default.isFunction(formData.entries)) {
|
|
const obj = {};
|
|
utils_default.forEachEntry(formData, (name, value) => {
|
|
buildPath(parsePropPath(name), value, obj, 0);
|
|
});
|
|
return obj;
|
|
}
|
|
return null;
|
|
}
|
|
var formDataToJSON_default = formDataToJSON;
|
|
|
|
// node_modules/axios/lib/defaults/index.js
|
|
function stringifySafely(rawValue, parser, encoder) {
|
|
if (utils_default.isString(rawValue)) {
|
|
try {
|
|
(parser || JSON.parse)(rawValue);
|
|
return utils_default.trim(rawValue);
|
|
} catch (e) {
|
|
if (e.name !== "SyntaxError") {
|
|
throw e;
|
|
}
|
|
}
|
|
}
|
|
return (encoder || JSON.stringify)(rawValue);
|
|
}
|
|
var defaults = {
|
|
transitional: transitional_default,
|
|
adapter: ["xhr", "http"],
|
|
transformRequest: [function transformRequest(data, headers) {
|
|
const contentType = headers.getContentType() || "";
|
|
const hasJSONContentType = contentType.indexOf("application/json") > -1;
|
|
const isObjectPayload = utils_default.isObject(data);
|
|
if (isObjectPayload && utils_default.isHTMLForm(data)) {
|
|
data = new FormData(data);
|
|
}
|
|
const isFormData2 = utils_default.isFormData(data);
|
|
if (isFormData2) {
|
|
return hasJSONContentType ? JSON.stringify(formDataToJSON_default(data)) : data;
|
|
}
|
|
if (utils_default.isArrayBuffer(data) || utils_default.isBuffer(data) || utils_default.isStream(data) || utils_default.isFile(data) || utils_default.isBlob(data)) {
|
|
return data;
|
|
}
|
|
if (utils_default.isArrayBufferView(data)) {
|
|
return data.buffer;
|
|
}
|
|
if (utils_default.isURLSearchParams(data)) {
|
|
headers.setContentType("application/x-www-form-urlencoded;charset=utf-8", false);
|
|
return data.toString();
|
|
}
|
|
let isFileList2;
|
|
if (isObjectPayload) {
|
|
if (contentType.indexOf("application/x-www-form-urlencoded") > -1) {
|
|
return toURLEncodedForm(data, this.formSerializer).toString();
|
|
}
|
|
if ((isFileList2 = utils_default.isFileList(data)) || contentType.indexOf("multipart/form-data") > -1) {
|
|
const _FormData = this.env && this.env.FormData;
|
|
return toFormData_default(
|
|
isFileList2 ? { "files[]": data } : data,
|
|
_FormData && new _FormData(),
|
|
this.formSerializer
|
|
);
|
|
}
|
|
}
|
|
if (isObjectPayload || hasJSONContentType) {
|
|
headers.setContentType("application/json", false);
|
|
return stringifySafely(data);
|
|
}
|
|
return data;
|
|
}],
|
|
transformResponse: [function transformResponse(data) {
|
|
const transitional2 = this.transitional || defaults.transitional;
|
|
const forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
|
|
const JSONRequested = this.responseType === "json";
|
|
if (data && utils_default.isString(data) && (forcedJSONParsing && !this.responseType || JSONRequested)) {
|
|
const silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
|
|
const strictJSONParsing = !silentJSONParsing && JSONRequested;
|
|
try {
|
|
return JSON.parse(data);
|
|
} catch (e) {
|
|
if (strictJSONParsing) {
|
|
if (e.name === "SyntaxError") {
|
|
throw AxiosError_default.from(e, AxiosError_default.ERR_BAD_RESPONSE, this, null, this.response);
|
|
}
|
|
throw e;
|
|
}
|
|
}
|
|
}
|
|
return data;
|
|
}],
|
|
timeout: 0,
|
|
xsrfCookieName: "XSRF-TOKEN",
|
|
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
maxContentLength: -1,
|
|
maxBodyLength: -1,
|
|
env: {
|
|
FormData: platform_default.classes.FormData,
|
|
Blob: platform_default.classes.Blob
|
|
},
|
|
validateStatus: function validateStatus(status) {
|
|
return status >= 200 && status < 300;
|
|
},
|
|
headers: {
|
|
common: {
|
|
"Accept": "application/json, text/plain, */*",
|
|
"Content-Type": void 0
|
|
}
|
|
}
|
|
};
|
|
utils_default.forEach(["delete", "get", "head", "post", "put", "patch"], (method) => {
|
|
defaults.headers[method] = {};
|
|
});
|
|
var defaults_default = defaults;
|
|
|
|
// node_modules/axios/lib/helpers/parseHeaders.js
|
|
var ignoreDuplicateOf = utils_default.toObjectSet([
|
|
"age",
|
|
"authorization",
|
|
"content-length",
|
|
"content-type",
|
|
"etag",
|
|
"expires",
|
|
"from",
|
|
"host",
|
|
"if-modified-since",
|
|
"if-unmodified-since",
|
|
"last-modified",
|
|
"location",
|
|
"max-forwards",
|
|
"proxy-authorization",
|
|
"referer",
|
|
"retry-after",
|
|
"user-agent"
|
|
]);
|
|
var parseHeaders_default = (rawHeaders) => {
|
|
const parsed = {};
|
|
let key;
|
|
let val;
|
|
let i;
|
|
rawHeaders && rawHeaders.split("\n").forEach(function parser(line) {
|
|
i = line.indexOf(":");
|
|
key = line.substring(0, i).trim().toLowerCase();
|
|
val = line.substring(i + 1).trim();
|
|
if (!key || parsed[key] && ignoreDuplicateOf[key]) {
|
|
return;
|
|
}
|
|
if (key === "set-cookie") {
|
|
if (parsed[key]) {
|
|
parsed[key].push(val);
|
|
} else {
|
|
parsed[key] = [val];
|
|
}
|
|
} else {
|
|
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
|
|
}
|
|
});
|
|
return parsed;
|
|
};
|
|
|
|
// node_modules/axios/lib/core/AxiosHeaders.js
|
|
var $internals = Symbol("internals");
|
|
function normalizeHeader(header) {
|
|
return header && String(header).trim().toLowerCase();
|
|
}
|
|
function normalizeValue(value) {
|
|
if (value === false || value == null) {
|
|
return value;
|
|
}
|
|
return utils_default.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
}
|
|
function parseTokens(str) {
|
|
const tokens = /* @__PURE__ */ Object.create(null);
|
|
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
let match;
|
|
while (match = tokensRE.exec(str)) {
|
|
tokens[match[1]] = match[2];
|
|
}
|
|
return tokens;
|
|
}
|
|
var isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
function matchHeaderValue(context, value, header, filter2, isHeaderNameFilter) {
|
|
if (utils_default.isFunction(filter2)) {
|
|
return filter2.call(this, value, header);
|
|
}
|
|
if (isHeaderNameFilter) {
|
|
value = header;
|
|
}
|
|
if (!utils_default.isString(value))
|
|
return;
|
|
if (utils_default.isString(filter2)) {
|
|
return value.indexOf(filter2) !== -1;
|
|
}
|
|
if (utils_default.isRegExp(filter2)) {
|
|
return filter2.test(value);
|
|
}
|
|
}
|
|
function formatHeader(header) {
|
|
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w2, char, str) => {
|
|
return char.toUpperCase() + str;
|
|
});
|
|
}
|
|
function buildAccessors(obj, header) {
|
|
const accessorName = utils_default.toCamelCase(" " + header);
|
|
["get", "set", "has"].forEach((methodName) => {
|
|
Object.defineProperty(obj, methodName + accessorName, {
|
|
value: function(arg1, arg2, arg3) {
|
|
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
},
|
|
configurable: true
|
|
});
|
|
});
|
|
}
|
|
var AxiosHeaders = class {
|
|
constructor(headers) {
|
|
headers && this.set(headers);
|
|
}
|
|
set(header, valueOrRewrite, rewrite) {
|
|
const self2 = this;
|
|
function setHeader(_value, _header, _rewrite) {
|
|
const lHeader = normalizeHeader(_header);
|
|
if (!lHeader) {
|
|
throw new Error("header name must be a non-empty string");
|
|
}
|
|
const key = utils_default.findKey(self2, lHeader);
|
|
if (!key || self2[key] === void 0 || _rewrite === true || _rewrite === void 0 && self2[key] !== false) {
|
|
self2[key || _header] = normalizeValue(_value);
|
|
}
|
|
}
|
|
const setHeaders = (headers, _rewrite) => utils_default.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
if (utils_default.isPlainObject(header) || header instanceof this.constructor) {
|
|
setHeaders(header, valueOrRewrite);
|
|
} else if (utils_default.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
setHeaders(parseHeaders_default(header), valueOrRewrite);
|
|
} else {
|
|
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
}
|
|
return this;
|
|
}
|
|
get(header, parser) {
|
|
header = normalizeHeader(header);
|
|
if (header) {
|
|
const key = utils_default.findKey(this, header);
|
|
if (key) {
|
|
const value = this[key];
|
|
if (!parser) {
|
|
return value;
|
|
}
|
|
if (parser === true) {
|
|
return parseTokens(value);
|
|
}
|
|
if (utils_default.isFunction(parser)) {
|
|
return parser.call(this, value, key);
|
|
}
|
|
if (utils_default.isRegExp(parser)) {
|
|
return parser.exec(value);
|
|
}
|
|
throw new TypeError("parser must be boolean|regexp|function");
|
|
}
|
|
}
|
|
}
|
|
has(header, matcher) {
|
|
header = normalizeHeader(header);
|
|
if (header) {
|
|
const key = utils_default.findKey(this, header);
|
|
return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
}
|
|
return false;
|
|
}
|
|
delete(header, matcher) {
|
|
const self2 = this;
|
|
let deleted = false;
|
|
function deleteHeader(_header) {
|
|
_header = normalizeHeader(_header);
|
|
if (_header) {
|
|
const key = utils_default.findKey(self2, _header);
|
|
if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
|
|
delete self2[key];
|
|
deleted = true;
|
|
}
|
|
}
|
|
}
|
|
if (utils_default.isArray(header)) {
|
|
header.forEach(deleteHeader);
|
|
} else {
|
|
deleteHeader(header);
|
|
}
|
|
return deleted;
|
|
}
|
|
clear(matcher) {
|
|
const keys2 = Object.keys(this);
|
|
let i = keys2.length;
|
|
let deleted = false;
|
|
while (i--) {
|
|
const key = keys2[i];
|
|
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
delete this[key];
|
|
deleted = true;
|
|
}
|
|
}
|
|
return deleted;
|
|
}
|
|
normalize(format) {
|
|
const self2 = this;
|
|
const headers = {};
|
|
utils_default.forEach(this, (value, header) => {
|
|
const key = utils_default.findKey(headers, header);
|
|
if (key) {
|
|
self2[key] = normalizeValue(value);
|
|
delete self2[header];
|
|
return;
|
|
}
|
|
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
if (normalized !== header) {
|
|
delete self2[header];
|
|
}
|
|
self2[normalized] = normalizeValue(value);
|
|
headers[normalized] = true;
|
|
});
|
|
return this;
|
|
}
|
|
concat(...targets) {
|
|
return this.constructor.concat(this, ...targets);
|
|
}
|
|
toJSON(asStrings) {
|
|
const obj = /* @__PURE__ */ Object.create(null);
|
|
utils_default.forEach(this, (value, header) => {
|
|
value != null && value !== false && (obj[header] = asStrings && utils_default.isArray(value) ? value.join(", ") : value);
|
|
});
|
|
return obj;
|
|
}
|
|
[Symbol.iterator]() {
|
|
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
}
|
|
toString() {
|
|
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
|
|
}
|
|
get [Symbol.toStringTag]() {
|
|
return "AxiosHeaders";
|
|
}
|
|
static from(thing) {
|
|
return thing instanceof this ? thing : new this(thing);
|
|
}
|
|
static concat(first, ...targets) {
|
|
const computed = new this(first);
|
|
targets.forEach((target) => computed.set(target));
|
|
return computed;
|
|
}
|
|
static accessor(header) {
|
|
const internals = this[$internals] = this[$internals] = {
|
|
accessors: {}
|
|
};
|
|
const accessors = internals.accessors;
|
|
const prototype3 = this.prototype;
|
|
function defineAccessor(_header) {
|
|
const lHeader = normalizeHeader(_header);
|
|
if (!accessors[lHeader]) {
|
|
buildAccessors(prototype3, _header);
|
|
accessors[lHeader] = true;
|
|
}
|
|
}
|
|
utils_default.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
return this;
|
|
}
|
|
};
|
|
AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
utils_default.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
let mapped = key[0].toUpperCase() + key.slice(1);
|
|
return {
|
|
get: () => value,
|
|
set(headerValue) {
|
|
this[mapped] = headerValue;
|
|
}
|
|
};
|
|
});
|
|
utils_default.freezeMethods(AxiosHeaders);
|
|
var AxiosHeaders_default = AxiosHeaders;
|
|
|
|
// node_modules/axios/lib/core/transformData.js
|
|
function transformData(fns, response) {
|
|
const config3 = this || defaults_default;
|
|
const context = response || config3;
|
|
const headers = AxiosHeaders_default.from(context.headers);
|
|
let data = context.data;
|
|
utils_default.forEach(fns, function transform(fn) {
|
|
data = fn.call(config3, data, headers.normalize(), response ? response.status : void 0);
|
|
});
|
|
headers.normalize();
|
|
return data;
|
|
}
|
|
|
|
// node_modules/axios/lib/cancel/isCancel.js
|
|
function isCancel(value) {
|
|
return !!(value && value.__CANCEL__);
|
|
}
|
|
|
|
// node_modules/axios/lib/cancel/CanceledError.js
|
|
function CanceledError(message, config3, request) {
|
|
AxiosError_default.call(this, message == null ? "canceled" : message, AxiosError_default.ERR_CANCELED, config3, request);
|
|
this.name = "CanceledError";
|
|
}
|
|
utils_default.inherits(CanceledError, AxiosError_default, {
|
|
__CANCEL__: true
|
|
});
|
|
var CanceledError_default = CanceledError;
|
|
|
|
// node_modules/axios/lib/core/settle.js
|
|
function settle(resolve, reject, response) {
|
|
const validateStatus2 = response.config.validateStatus;
|
|
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
|
|
resolve(response);
|
|
} else {
|
|
reject(new AxiosError_default(
|
|
"Request failed with status code " + response.status,
|
|
[AxiosError_default.ERR_BAD_REQUEST, AxiosError_default.ERR_BAD_RESPONSE][Math.floor(response.status / 100) - 4],
|
|
response.config,
|
|
response.request,
|
|
response
|
|
));
|
|
}
|
|
}
|
|
|
|
// node_modules/axios/lib/helpers/cookies.js
|
|
var cookies_default = platform_default.hasStandardBrowserEnv ? {
|
|
write(name, value, expires, path, domain, secure) {
|
|
const cookie = [name + "=" + encodeURIComponent(value)];
|
|
utils_default.isNumber(expires) && cookie.push("expires=" + new Date(expires).toGMTString());
|
|
utils_default.isString(path) && cookie.push("path=" + path);
|
|
utils_default.isString(domain) && cookie.push("domain=" + domain);
|
|
secure === true && cookie.push("secure");
|
|
document.cookie = cookie.join("; ");
|
|
},
|
|
read(name) {
|
|
const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
|
|
return match ? decodeURIComponent(match[3]) : null;
|
|
},
|
|
remove(name) {
|
|
this.write(name, "", Date.now() - 864e5);
|
|
}
|
|
} : {
|
|
write() {
|
|
},
|
|
read() {
|
|
return null;
|
|
},
|
|
remove() {
|
|
}
|
|
};
|
|
|
|
// node_modules/axios/lib/helpers/isAbsoluteURL.js
|
|
function isAbsoluteURL(url) {
|
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
}
|
|
|
|
// node_modules/axios/lib/helpers/combineURLs.js
|
|
function combineURLs(baseURL, relativeURL) {
|
|
return relativeURL ? baseURL.replace(/\/?\/$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
}
|
|
|
|
// node_modules/axios/lib/core/buildFullPath.js
|
|
function buildFullPath(baseURL, requestedURL) {
|
|
if (baseURL && !isAbsoluteURL(requestedURL)) {
|
|
return combineURLs(baseURL, requestedURL);
|
|
}
|
|
return requestedURL;
|
|
}
|
|
|
|
// node_modules/axios/lib/helpers/isURLSameOrigin.js
|
|
var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? function standardBrowserEnv() {
|
|
const msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
const urlParsingNode = document.createElement("a");
|
|
let originURL;
|
|
function resolveURL(url) {
|
|
let href = url;
|
|
if (msie) {
|
|
urlParsingNode.setAttribute("href", href);
|
|
href = urlParsingNode.href;
|
|
}
|
|
urlParsingNode.setAttribute("href", href);
|
|
return {
|
|
href: urlParsingNode.href,
|
|
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
|
|
host: urlParsingNode.host,
|
|
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
|
|
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
|
|
hostname: urlParsingNode.hostname,
|
|
port: urlParsingNode.port,
|
|
pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
|
|
};
|
|
}
|
|
originURL = resolveURL(window.location.href);
|
|
return function isURLSameOrigin(requestURL) {
|
|
const parsed = utils_default.isString(requestURL) ? resolveURL(requestURL) : requestURL;
|
|
return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
|
|
};
|
|
}() : function nonStandardBrowserEnv() {
|
|
return function isURLSameOrigin() {
|
|
return true;
|
|
};
|
|
}();
|
|
|
|
// node_modules/axios/lib/helpers/parseProtocol.js
|
|
function parseProtocol(url) {
|
|
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
|
return match && match[1] || "";
|
|
}
|
|
|
|
// node_modules/axios/lib/helpers/speedometer.js
|
|
function speedometer(samplesCount, min) {
|
|
samplesCount = samplesCount || 10;
|
|
const bytes = new Array(samplesCount);
|
|
const timestamps = new Array(samplesCount);
|
|
let head = 0;
|
|
let tail = 0;
|
|
let firstSampleTS;
|
|
min = min !== void 0 ? min : 1e3;
|
|
return function push(chunkLength) {
|
|
const now = Date.now();
|
|
const startedAt = timestamps[tail];
|
|
if (!firstSampleTS) {
|
|
firstSampleTS = now;
|
|
}
|
|
bytes[head] = chunkLength;
|
|
timestamps[head] = now;
|
|
let i = tail;
|
|
let bytesCount = 0;
|
|
while (i !== head) {
|
|
bytesCount += bytes[i++];
|
|
i = i % samplesCount;
|
|
}
|
|
head = (head + 1) % samplesCount;
|
|
if (head === tail) {
|
|
tail = (tail + 1) % samplesCount;
|
|
}
|
|
if (now - firstSampleTS < min) {
|
|
return;
|
|
}
|
|
const passed = startedAt && now - startedAt;
|
|
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
|
|
};
|
|
}
|
|
var speedometer_default = speedometer;
|
|
|
|
// node_modules/axios/lib/adapters/xhr.js
|
|
function progressEventReducer(listener4, isDownloadStream) {
|
|
let bytesNotified = 0;
|
|
const _speedometer = speedometer_default(50, 250);
|
|
return (e) => {
|
|
const loaded2 = e.loaded;
|
|
const total = e.lengthComputable ? e.total : void 0;
|
|
const progressBytes = loaded2 - bytesNotified;
|
|
const rate = _speedometer(progressBytes);
|
|
const inRange = loaded2 <= total;
|
|
bytesNotified = loaded2;
|
|
const data = {
|
|
loaded: loaded2,
|
|
total,
|
|
progress: total ? loaded2 / total : void 0,
|
|
bytes: progressBytes,
|
|
rate: rate ? rate : void 0,
|
|
estimated: rate && total && inRange ? (total - loaded2) / rate : void 0,
|
|
event: e
|
|
};
|
|
data[isDownloadStream ? "download" : "upload"] = true;
|
|
listener4(data);
|
|
};
|
|
}
|
|
var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
|
|
var xhr_default = isXHRAdapterSupported && function(config3) {
|
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
let requestData = config3.data;
|
|
const requestHeaders = AxiosHeaders_default.from(config3.headers).normalize();
|
|
let { responseType, withXSRFToken } = config3;
|
|
let onCanceled;
|
|
function done() {
|
|
if (config3.cancelToken) {
|
|
config3.cancelToken.unsubscribe(onCanceled);
|
|
}
|
|
if (config3.signal) {
|
|
config3.signal.removeEventListener("abort", onCanceled);
|
|
}
|
|
}
|
|
let contentType;
|
|
if (utils_default.isFormData(requestData)) {
|
|
if (platform_default.hasStandardBrowserEnv || platform_default.hasStandardBrowserWebWorkerEnv) {
|
|
requestHeaders.setContentType(false);
|
|
} else if ((contentType = requestHeaders.getContentType()) !== false) {
|
|
const [type, ...tokens] = contentType ? contentType.split(";").map((token) => token.trim()).filter(Boolean) : [];
|
|
requestHeaders.setContentType([type || "multipart/form-data", ...tokens].join("; "));
|
|
}
|
|
}
|
|
let request = new XMLHttpRequest();
|
|
if (config3.auth) {
|
|
const username = config3.auth.username || "";
|
|
const password = config3.auth.password ? unescape(encodeURIComponent(config3.auth.password)) : "";
|
|
requestHeaders.set("Authorization", "Basic " + btoa(username + ":" + password));
|
|
}
|
|
const fullPath = buildFullPath(config3.baseURL, config3.url);
|
|
request.open(config3.method.toUpperCase(), buildURL(fullPath, config3.params, config3.paramsSerializer), true);
|
|
request.timeout = config3.timeout;
|
|
function onloadend() {
|
|
if (!request) {
|
|
return;
|
|
}
|
|
const responseHeaders = AxiosHeaders_default.from(
|
|
"getAllResponseHeaders" in request && request.getAllResponseHeaders()
|
|
);
|
|
const responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
|
|
const response = {
|
|
data: responseData,
|
|
status: request.status,
|
|
statusText: request.statusText,
|
|
headers: responseHeaders,
|
|
config: config3,
|
|
request
|
|
};
|
|
settle(function _resolve(value) {
|
|
resolve(value);
|
|
done();
|
|
}, function _reject(err) {
|
|
reject(err);
|
|
done();
|
|
}, response);
|
|
request = null;
|
|
}
|
|
if ("onloadend" in request) {
|
|
request.onloadend = onloadend;
|
|
} else {
|
|
request.onreadystatechange = function handleLoad() {
|
|
if (!request || request.readyState !== 4) {
|
|
return;
|
|
}
|
|
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
|
|
return;
|
|
}
|
|
setTimeout(onloadend);
|
|
};
|
|
}
|
|
request.onabort = function handleAbort() {
|
|
if (!request) {
|
|
return;
|
|
}
|
|
reject(new AxiosError_default("Request aborted", AxiosError_default.ECONNABORTED, config3, request));
|
|
request = null;
|
|
};
|
|
request.onerror = function handleError() {
|
|
reject(new AxiosError_default("Network Error", AxiosError_default.ERR_NETWORK, config3, request));
|
|
request = null;
|
|
};
|
|
request.ontimeout = function handleTimeout() {
|
|
let timeoutErrorMessage = config3.timeout ? "timeout of " + config3.timeout + "ms exceeded" : "timeout exceeded";
|
|
const transitional2 = config3.transitional || transitional_default;
|
|
if (config3.timeoutErrorMessage) {
|
|
timeoutErrorMessage = config3.timeoutErrorMessage;
|
|
}
|
|
reject(new AxiosError_default(
|
|
timeoutErrorMessage,
|
|
transitional2.clarifyTimeoutError ? AxiosError_default.ETIMEDOUT : AxiosError_default.ECONNABORTED,
|
|
config3,
|
|
request
|
|
));
|
|
request = null;
|
|
};
|
|
if (platform_default.hasStandardBrowserEnv) {
|
|
withXSRFToken && utils_default.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(config3));
|
|
if (withXSRFToken || withXSRFToken !== false && isURLSameOrigin_default(fullPath)) {
|
|
const xsrfValue = config3.xsrfHeaderName && config3.xsrfCookieName && cookies_default.read(config3.xsrfCookieName);
|
|
if (xsrfValue) {
|
|
requestHeaders.set(config3.xsrfHeaderName, xsrfValue);
|
|
}
|
|
}
|
|
}
|
|
requestData === void 0 && requestHeaders.setContentType(null);
|
|
if ("setRequestHeader" in request) {
|
|
utils_default.forEach(requestHeaders.toJSON(), function setRequestHeader(val, key) {
|
|
request.setRequestHeader(key, val);
|
|
});
|
|
}
|
|
if (!utils_default.isUndefined(config3.withCredentials)) {
|
|
request.withCredentials = !!config3.withCredentials;
|
|
}
|
|
if (responseType && responseType !== "json") {
|
|
request.responseType = config3.responseType;
|
|
}
|
|
if (typeof config3.onDownloadProgress === "function") {
|
|
request.addEventListener("progress", progressEventReducer(config3.onDownloadProgress, true));
|
|
}
|
|
if (typeof config3.onUploadProgress === "function" && request.upload) {
|
|
request.upload.addEventListener("progress", progressEventReducer(config3.onUploadProgress));
|
|
}
|
|
if (config3.cancelToken || config3.signal) {
|
|
onCanceled = (cancel) => {
|
|
if (!request) {
|
|
return;
|
|
}
|
|
reject(!cancel || cancel.type ? new CanceledError_default(null, config3, request) : cancel);
|
|
request.abort();
|
|
request = null;
|
|
};
|
|
config3.cancelToken && config3.cancelToken.subscribe(onCanceled);
|
|
if (config3.signal) {
|
|
config3.signal.aborted ? onCanceled() : config3.signal.addEventListener("abort", onCanceled);
|
|
}
|
|
}
|
|
const protocol = parseProtocol(fullPath);
|
|
if (protocol && platform_default.protocols.indexOf(protocol) === -1) {
|
|
reject(new AxiosError_default("Unsupported protocol " + protocol + ":", AxiosError_default.ERR_BAD_REQUEST, config3));
|
|
return;
|
|
}
|
|
request.send(requestData || null);
|
|
});
|
|
};
|
|
|
|
// node_modules/axios/lib/adapters/adapters.js
|
|
var knownAdapters = {
|
|
http: null_default,
|
|
xhr: xhr_default
|
|
};
|
|
utils_default.forEach(knownAdapters, (fn, value) => {
|
|
if (fn) {
|
|
try {
|
|
Object.defineProperty(fn, "name", { value });
|
|
} catch (e) {
|
|
}
|
|
Object.defineProperty(fn, "adapterName", { value });
|
|
}
|
|
});
|
|
var renderReason = (reason) => `- ${reason}`;
|
|
var isResolvedHandle = (adapter) => utils_default.isFunction(adapter) || adapter === null || adapter === false;
|
|
var adapters_default = {
|
|
getAdapter: (adapters) => {
|
|
adapters = utils_default.isArray(adapters) ? adapters : [adapters];
|
|
const { length } = adapters;
|
|
let nameOrAdapter;
|
|
let adapter;
|
|
const rejectedReasons = {};
|
|
for (let i = 0; i < length; i++) {
|
|
nameOrAdapter = adapters[i];
|
|
let id;
|
|
adapter = nameOrAdapter;
|
|
if (!isResolvedHandle(nameOrAdapter)) {
|
|
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
if (adapter === void 0) {
|
|
throw new AxiosError_default(`Unknown adapter '${id}'`);
|
|
}
|
|
}
|
|
if (adapter) {
|
|
break;
|
|
}
|
|
rejectedReasons[id || "#" + i] = adapter;
|
|
}
|
|
if (!adapter) {
|
|
const reasons = Object.entries(rejectedReasons).map(
|
|
([id, state]) => `adapter ${id} ` + (state === false ? "is not supported by the environment" : "is not available in the build")
|
|
);
|
|
let s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
|
|
throw new AxiosError_default(
|
|
`There is no suitable adapter to dispatch the request ` + s,
|
|
"ERR_NOT_SUPPORT"
|
|
);
|
|
}
|
|
return adapter;
|
|
},
|
|
adapters: knownAdapters
|
|
};
|
|
|
|
// node_modules/axios/lib/core/dispatchRequest.js
|
|
function throwIfCancellationRequested(config3) {
|
|
if (config3.cancelToken) {
|
|
config3.cancelToken.throwIfRequested();
|
|
}
|
|
if (config3.signal && config3.signal.aborted) {
|
|
throw new CanceledError_default(null, config3);
|
|
}
|
|
}
|
|
function dispatchRequest(config3) {
|
|
throwIfCancellationRequested(config3);
|
|
config3.headers = AxiosHeaders_default.from(config3.headers);
|
|
config3.data = transformData.call(
|
|
config3,
|
|
config3.transformRequest
|
|
);
|
|
if (["post", "put", "patch"].indexOf(config3.method) !== -1) {
|
|
config3.headers.setContentType("application/x-www-form-urlencoded", false);
|
|
}
|
|
const adapter = adapters_default.getAdapter(config3.adapter || defaults_default.adapter);
|
|
return adapter(config3).then(function onAdapterResolution(response) {
|
|
throwIfCancellationRequested(config3);
|
|
response.data = transformData.call(
|
|
config3,
|
|
config3.transformResponse,
|
|
response
|
|
);
|
|
response.headers = AxiosHeaders_default.from(response.headers);
|
|
return response;
|
|
}, function onAdapterRejection(reason) {
|
|
if (!isCancel(reason)) {
|
|
throwIfCancellationRequested(config3);
|
|
if (reason && reason.response) {
|
|
reason.response.data = transformData.call(
|
|
config3,
|
|
config3.transformResponse,
|
|
reason.response
|
|
);
|
|
reason.response.headers = AxiosHeaders_default.from(reason.response.headers);
|
|
}
|
|
}
|
|
return Promise.reject(reason);
|
|
});
|
|
}
|
|
|
|
// node_modules/axios/lib/core/mergeConfig.js
|
|
var headersToObject = (thing) => thing instanceof AxiosHeaders_default ? __spreadValues({}, thing) : thing;
|
|
function mergeConfig(config1, config22) {
|
|
config22 = config22 || {};
|
|
const config3 = {};
|
|
function getMergedValue(target, source, caseless) {
|
|
if (utils_default.isPlainObject(target) && utils_default.isPlainObject(source)) {
|
|
return utils_default.merge.call({ caseless }, target, source);
|
|
} else if (utils_default.isPlainObject(source)) {
|
|
return utils_default.merge({}, source);
|
|
} else if (utils_default.isArray(source)) {
|
|
return source.slice();
|
|
}
|
|
return source;
|
|
}
|
|
function mergeDeepProperties(a, b, caseless) {
|
|
if (!utils_default.isUndefined(b)) {
|
|
return getMergedValue(a, b, caseless);
|
|
} else if (!utils_default.isUndefined(a)) {
|
|
return getMergedValue(void 0, a, caseless);
|
|
}
|
|
}
|
|
function valueFromConfig2(a, b) {
|
|
if (!utils_default.isUndefined(b)) {
|
|
return getMergedValue(void 0, b);
|
|
}
|
|
}
|
|
function defaultToConfig2(a, b) {
|
|
if (!utils_default.isUndefined(b)) {
|
|
return getMergedValue(void 0, b);
|
|
} else if (!utils_default.isUndefined(a)) {
|
|
return getMergedValue(void 0, a);
|
|
}
|
|
}
|
|
function mergeDirectKeys(a, b, prop) {
|
|
if (prop in config22) {
|
|
return getMergedValue(a, b);
|
|
} else if (prop in config1) {
|
|
return getMergedValue(void 0, a);
|
|
}
|
|
}
|
|
const mergeMap = {
|
|
url: valueFromConfig2,
|
|
method: valueFromConfig2,
|
|
data: valueFromConfig2,
|
|
baseURL: defaultToConfig2,
|
|
transformRequest: defaultToConfig2,
|
|
transformResponse: defaultToConfig2,
|
|
paramsSerializer: defaultToConfig2,
|
|
timeout: defaultToConfig2,
|
|
timeoutMessage: defaultToConfig2,
|
|
withCredentials: defaultToConfig2,
|
|
withXSRFToken: defaultToConfig2,
|
|
adapter: defaultToConfig2,
|
|
responseType: defaultToConfig2,
|
|
xsrfCookieName: defaultToConfig2,
|
|
xsrfHeaderName: defaultToConfig2,
|
|
onUploadProgress: defaultToConfig2,
|
|
onDownloadProgress: defaultToConfig2,
|
|
decompress: defaultToConfig2,
|
|
maxContentLength: defaultToConfig2,
|
|
maxBodyLength: defaultToConfig2,
|
|
beforeRedirect: defaultToConfig2,
|
|
transport: defaultToConfig2,
|
|
httpAgent: defaultToConfig2,
|
|
httpsAgent: defaultToConfig2,
|
|
cancelToken: defaultToConfig2,
|
|
socketPath: defaultToConfig2,
|
|
responseEncoding: defaultToConfig2,
|
|
validateStatus: mergeDirectKeys,
|
|
headers: (a, b) => mergeDeepProperties(headersToObject(a), headersToObject(b), true)
|
|
};
|
|
utils_default.forEach(Object.keys(Object.assign({}, config1, config22)), function computeConfigValue(prop) {
|
|
const merge2 = mergeMap[prop] || mergeDeepProperties;
|
|
const configValue = merge2(config1[prop], config22[prop], prop);
|
|
utils_default.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config3[prop] = configValue);
|
|
});
|
|
return config3;
|
|
}
|
|
|
|
// node_modules/axios/lib/env/data.js
|
|
var VERSION = "1.6.8";
|
|
|
|
// node_modules/axios/lib/helpers/validator.js
|
|
var validators = {};
|
|
["object", "boolean", "number", "function", "string", "symbol"].forEach((type, i) => {
|
|
validators[type] = function validator(thing) {
|
|
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
|
|
};
|
|
});
|
|
var deprecatedWarnings = {};
|
|
validators.transitional = function transitional(validator, version, message) {
|
|
function formatMessage(opt, desc) {
|
|
return "[Axios v" + VERSION + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
}
|
|
return (value, opt, opts) => {
|
|
if (validator === false) {
|
|
throw new AxiosError_default(
|
|
formatMessage(opt, " has been removed" + (version ? " in " + version : "")),
|
|
AxiosError_default.ERR_DEPRECATED
|
|
);
|
|
}
|
|
if (version && !deprecatedWarnings[opt]) {
|
|
deprecatedWarnings[opt] = true;
|
|
console.warn(
|
|
formatMessage(
|
|
opt,
|
|
" has been deprecated since v" + version + " and will be removed in the near future"
|
|
)
|
|
);
|
|
}
|
|
return validator ? validator(value, opt, opts) : true;
|
|
};
|
|
};
|
|
function assertOptions(options, schema, allowUnknown) {
|
|
if (typeof options !== "object") {
|
|
throw new AxiosError_default("options must be an object", AxiosError_default.ERR_BAD_OPTION_VALUE);
|
|
}
|
|
const keys2 = Object.keys(options);
|
|
let i = keys2.length;
|
|
while (i-- > 0) {
|
|
const opt = keys2[i];
|
|
const validator = schema[opt];
|
|
if (validator) {
|
|
const value = options[opt];
|
|
const result = value === void 0 || validator(value, opt, options);
|
|
if (result !== true) {
|
|
throw new AxiosError_default("option " + opt + " must be " + result, AxiosError_default.ERR_BAD_OPTION_VALUE);
|
|
}
|
|
continue;
|
|
}
|
|
if (allowUnknown !== true) {
|
|
throw new AxiosError_default("Unknown option " + opt, AxiosError_default.ERR_BAD_OPTION);
|
|
}
|
|
}
|
|
}
|
|
var validator_default = {
|
|
assertOptions,
|
|
validators
|
|
};
|
|
|
|
// node_modules/axios/lib/core/Axios.js
|
|
var validators2 = validator_default.validators;
|
|
var Axios = class {
|
|
constructor(instanceConfig) {
|
|
this.defaults = instanceConfig;
|
|
this.interceptors = {
|
|
request: new InterceptorManager_default(),
|
|
response: new InterceptorManager_default()
|
|
};
|
|
}
|
|
async request(configOrUrl, config3) {
|
|
try {
|
|
return await this._request(configOrUrl, config3);
|
|
} catch (err) {
|
|
if (err instanceof Error) {
|
|
let dummy;
|
|
Error.captureStackTrace ? Error.captureStackTrace(dummy = {}) : dummy = new Error();
|
|
const stack = dummy.stack ? dummy.stack.replace(/^.+\n/, "") : "";
|
|
if (!err.stack) {
|
|
err.stack = stack;
|
|
} else if (stack && !String(err.stack).endsWith(stack.replace(/^.+\n.+\n/, ""))) {
|
|
err.stack += "\n" + stack;
|
|
}
|
|
}
|
|
throw err;
|
|
}
|
|
}
|
|
_request(configOrUrl, config3) {
|
|
if (typeof configOrUrl === "string") {
|
|
config3 = config3 || {};
|
|
config3.url = configOrUrl;
|
|
} else {
|
|
config3 = configOrUrl || {};
|
|
}
|
|
config3 = mergeConfig(this.defaults, config3);
|
|
const { transitional: transitional2, paramsSerializer, headers } = config3;
|
|
if (transitional2 !== void 0) {
|
|
validator_default.assertOptions(transitional2, {
|
|
silentJSONParsing: validators2.transitional(validators2.boolean),
|
|
forcedJSONParsing: validators2.transitional(validators2.boolean),
|
|
clarifyTimeoutError: validators2.transitional(validators2.boolean)
|
|
}, false);
|
|
}
|
|
if (paramsSerializer != null) {
|
|
if (utils_default.isFunction(paramsSerializer)) {
|
|
config3.paramsSerializer = {
|
|
serialize: paramsSerializer
|
|
};
|
|
} else {
|
|
validator_default.assertOptions(paramsSerializer, {
|
|
encode: validators2.function,
|
|
serialize: validators2.function
|
|
}, true);
|
|
}
|
|
}
|
|
config3.method = (config3.method || this.defaults.method || "get").toLowerCase();
|
|
let contextHeaders = headers && utils_default.merge(
|
|
headers.common,
|
|
headers[config3.method]
|
|
);
|
|
headers && utils_default.forEach(
|
|
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
(method) => {
|
|
delete headers[method];
|
|
}
|
|
);
|
|
config3.headers = AxiosHeaders_default.concat(contextHeaders, headers);
|
|
const requestInterceptorChain = [];
|
|
let synchronousRequestInterceptors = true;
|
|
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config3) === false) {
|
|
return;
|
|
}
|
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
});
|
|
const responseInterceptorChain = [];
|
|
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
});
|
|
let promise;
|
|
let i = 0;
|
|
let len;
|
|
if (!synchronousRequestInterceptors) {
|
|
const chain = [dispatchRequest.bind(this), void 0];
|
|
chain.unshift.apply(chain, requestInterceptorChain);
|
|
chain.push.apply(chain, responseInterceptorChain);
|
|
len = chain.length;
|
|
promise = Promise.resolve(config3);
|
|
while (i < len) {
|
|
promise = promise.then(chain[i++], chain[i++]);
|
|
}
|
|
return promise;
|
|
}
|
|
len = requestInterceptorChain.length;
|
|
let newConfig = config3;
|
|
i = 0;
|
|
while (i < len) {
|
|
const onFulfilled = requestInterceptorChain[i++];
|
|
const onRejected = requestInterceptorChain[i++];
|
|
try {
|
|
newConfig = onFulfilled(newConfig);
|
|
} catch (error) {
|
|
onRejected.call(this, error);
|
|
break;
|
|
}
|
|
}
|
|
try {
|
|
promise = dispatchRequest.call(this, newConfig);
|
|
} catch (error) {
|
|
return Promise.reject(error);
|
|
}
|
|
i = 0;
|
|
len = responseInterceptorChain.length;
|
|
while (i < len) {
|
|
promise = promise.then(responseInterceptorChain[i++], responseInterceptorChain[i++]);
|
|
}
|
|
return promise;
|
|
}
|
|
getUri(config3) {
|
|
config3 = mergeConfig(this.defaults, config3);
|
|
const fullPath = buildFullPath(config3.baseURL, config3.url);
|
|
return buildURL(fullPath, config3.params, config3.paramsSerializer);
|
|
}
|
|
};
|
|
utils_default.forEach(["delete", "get", "head", "options"], function forEachMethodNoData(method) {
|
|
Axios.prototype[method] = function(url, config3) {
|
|
return this.request(mergeConfig(config3 || {}, {
|
|
method,
|
|
url,
|
|
data: (config3 || {}).data
|
|
}));
|
|
};
|
|
});
|
|
utils_default.forEach(["post", "put", "patch"], function forEachMethodWithData(method) {
|
|
function generateHTTPMethod(isForm) {
|
|
return function httpMethod(url, data, config3) {
|
|
return this.request(mergeConfig(config3 || {}, {
|
|
method,
|
|
headers: isForm ? {
|
|
"Content-Type": "multipart/form-data"
|
|
} : {},
|
|
url,
|
|
data
|
|
}));
|
|
};
|
|
}
|
|
Axios.prototype[method] = generateHTTPMethod();
|
|
Axios.prototype[method + "Form"] = generateHTTPMethod(true);
|
|
});
|
|
var Axios_default = Axios;
|
|
|
|
// node_modules/axios/lib/cancel/CancelToken.js
|
|
var CancelToken = class {
|
|
constructor(executor) {
|
|
if (typeof executor !== "function") {
|
|
throw new TypeError("executor must be a function.");
|
|
}
|
|
let resolvePromise;
|
|
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
resolvePromise = resolve;
|
|
});
|
|
const token = this;
|
|
this.promise.then((cancel) => {
|
|
if (!token._listeners)
|
|
return;
|
|
let i = token._listeners.length;
|
|
while (i-- > 0) {
|
|
token._listeners[i](cancel);
|
|
}
|
|
token._listeners = null;
|
|
});
|
|
this.promise.then = (onfulfilled) => {
|
|
let _resolve;
|
|
const promise = new Promise((resolve) => {
|
|
token.subscribe(resolve);
|
|
_resolve = resolve;
|
|
}).then(onfulfilled);
|
|
promise.cancel = function reject() {
|
|
token.unsubscribe(_resolve);
|
|
};
|
|
return promise;
|
|
};
|
|
executor(function cancel(message, config3, request) {
|
|
if (token.reason) {
|
|
return;
|
|
}
|
|
token.reason = new CanceledError_default(message, config3, request);
|
|
resolvePromise(token.reason);
|
|
});
|
|
}
|
|
throwIfRequested() {
|
|
if (this.reason) {
|
|
throw this.reason;
|
|
}
|
|
}
|
|
subscribe(listener4) {
|
|
if (this.reason) {
|
|
listener4(this.reason);
|
|
return;
|
|
}
|
|
if (this._listeners) {
|
|
this._listeners.push(listener4);
|
|
} else {
|
|
this._listeners = [listener4];
|
|
}
|
|
}
|
|
unsubscribe(listener4) {
|
|
if (!this._listeners) {
|
|
return;
|
|
}
|
|
const index = this._listeners.indexOf(listener4);
|
|
if (index !== -1) {
|
|
this._listeners.splice(index, 1);
|
|
}
|
|
}
|
|
static source() {
|
|
let cancel;
|
|
const token = new CancelToken(function executor(c) {
|
|
cancel = c;
|
|
});
|
|
return {
|
|
token,
|
|
cancel
|
|
};
|
|
}
|
|
};
|
|
var CancelToken_default = CancelToken;
|
|
|
|
// node_modules/axios/lib/helpers/spread.js
|
|
function spread(callback) {
|
|
return function wrap(arr) {
|
|
return callback.apply(null, arr);
|
|
};
|
|
}
|
|
|
|
// node_modules/axios/lib/helpers/isAxiosError.js
|
|
function isAxiosError(payload) {
|
|
return utils_default.isObject(payload) && payload.isAxiosError === true;
|
|
}
|
|
|
|
// node_modules/axios/lib/helpers/HttpStatusCode.js
|
|
var HttpStatusCode = {
|
|
Continue: 100,
|
|
SwitchingProtocols: 101,
|
|
Processing: 102,
|
|
EarlyHints: 103,
|
|
Ok: 200,
|
|
Created: 201,
|
|
Accepted: 202,
|
|
NonAuthoritativeInformation: 203,
|
|
NoContent: 204,
|
|
ResetContent: 205,
|
|
PartialContent: 206,
|
|
MultiStatus: 207,
|
|
AlreadyReported: 208,
|
|
ImUsed: 226,
|
|
MultipleChoices: 300,
|
|
MovedPermanently: 301,
|
|
Found: 302,
|
|
SeeOther: 303,
|
|
NotModified: 304,
|
|
UseProxy: 305,
|
|
Unused: 306,
|
|
TemporaryRedirect: 307,
|
|
PermanentRedirect: 308,
|
|
BadRequest: 400,
|
|
Unauthorized: 401,
|
|
PaymentRequired: 402,
|
|
Forbidden: 403,
|
|
NotFound: 404,
|
|
MethodNotAllowed: 405,
|
|
NotAcceptable: 406,
|
|
ProxyAuthenticationRequired: 407,
|
|
RequestTimeout: 408,
|
|
Conflict: 409,
|
|
Gone: 410,
|
|
LengthRequired: 411,
|
|
PreconditionFailed: 412,
|
|
PayloadTooLarge: 413,
|
|
UriTooLong: 414,
|
|
UnsupportedMediaType: 415,
|
|
RangeNotSatisfiable: 416,
|
|
ExpectationFailed: 417,
|
|
ImATeapot: 418,
|
|
MisdirectedRequest: 421,
|
|
UnprocessableEntity: 422,
|
|
Locked: 423,
|
|
FailedDependency: 424,
|
|
TooEarly: 425,
|
|
UpgradeRequired: 426,
|
|
PreconditionRequired: 428,
|
|
TooManyRequests: 429,
|
|
RequestHeaderFieldsTooLarge: 431,
|
|
UnavailableForLegalReasons: 451,
|
|
InternalServerError: 500,
|
|
NotImplemented: 501,
|
|
BadGateway: 502,
|
|
ServiceUnavailable: 503,
|
|
GatewayTimeout: 504,
|
|
HttpVersionNotSupported: 505,
|
|
VariantAlsoNegotiates: 506,
|
|
InsufficientStorage: 507,
|
|
LoopDetected: 508,
|
|
NotExtended: 510,
|
|
NetworkAuthenticationRequired: 511
|
|
};
|
|
Object.entries(HttpStatusCode).forEach(([key, value]) => {
|
|
HttpStatusCode[value] = key;
|
|
});
|
|
var HttpStatusCode_default = HttpStatusCode;
|
|
|
|
// node_modules/axios/lib/axios.js
|
|
function createInstance(defaultConfig) {
|
|
const context = new Axios_default(defaultConfig);
|
|
const instance = bind(Axios_default.prototype.request, context);
|
|
utils_default.extend(instance, Axios_default.prototype, context, { allOwnKeys: true });
|
|
utils_default.extend(instance, context, null, { allOwnKeys: true });
|
|
instance.create = function create(instanceConfig) {
|
|
return createInstance(mergeConfig(defaultConfig, instanceConfig));
|
|
};
|
|
return instance;
|
|
}
|
|
var axios = createInstance(defaults_default);
|
|
axios.Axios = Axios_default;
|
|
axios.CanceledError = CanceledError_default;
|
|
axios.CancelToken = CancelToken_default;
|
|
axios.isCancel = isCancel;
|
|
axios.VERSION = VERSION;
|
|
axios.toFormData = toFormData_default;
|
|
axios.AxiosError = AxiosError_default;
|
|
axios.Cancel = axios.CanceledError;
|
|
axios.all = function all(promises) {
|
|
return Promise.all(promises);
|
|
};
|
|
axios.spread = spread;
|
|
axios.isAxiosError = isAxiosError;
|
|
axios.mergeConfig = mergeConfig;
|
|
axios.AxiosHeaders = AxiosHeaders_default;
|
|
axios.formToJSON = (thing) => formDataToJSON_default(utils_default.isHTMLForm(thing) ? new FormData(thing) : thing);
|
|
axios.getAdapter = adapters_default.getAdapter;
|
|
axios.HttpStatusCode = HttpStatusCode_default;
|
|
axios.default = axios;
|
|
var axios_default = axios;
|
|
|
|
// node_modules/axios/index.js
|
|
var {
|
|
Axios: Axios2,
|
|
AxiosError: AxiosError2,
|
|
CanceledError: CanceledError2,
|
|
isCancel: isCancel2,
|
|
CancelToken: CancelToken2,
|
|
VERSION: VERSION2,
|
|
all: all2,
|
|
Cancel,
|
|
isAxiosError: isAxiosError2,
|
|
spread: spread2,
|
|
toFormData: toFormData2,
|
|
AxiosHeaders: AxiosHeaders2,
|
|
HttpStatusCode: HttpStatusCode2,
|
|
formToJSON,
|
|
getAdapter,
|
|
mergeConfig: mergeConfig2
|
|
} = axios_default;
|
|
|
|
// src/lib/weather.ts
|
|
async function getMETAR(icao) {
|
|
const url = `https://md11.tfdidesign.com/metar.php?icao=${icao}`;
|
|
const response = await axios_default.get(url, {
|
|
headers: {
|
|
Accept: "application/json"
|
|
}
|
|
});
|
|
return response.data[0];
|
|
}
|
|
|
|
// src/components/DeparturePerf.tsx
|
|
init_common();
|
|
|
|
// src/components/Select.tsx
|
|
var import_react5 = __toESM(require_react());
|
|
var import_jsx_runtime5 = __toESM(require_jsx_runtime());
|
|
function Select(props) {
|
|
const [option, setOption] = (0, import_react5.useState)(0);
|
|
(0, import_react5.useEffect)(() => {
|
|
if (props.options.length == 0) {
|
|
setOption(0);
|
|
}
|
|
}, [props.options]);
|
|
if (props.options.length === 0) {
|
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { disabled: true, className: props.className, value: "" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: "absolute right-2 top-0 -mt-[.5px] border-t bg-zinc-700 text-white disabled:text-zinc-400",
|
|
disabled: true,
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FontAwesomeIcon, { icon: faCaretUp })
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: "absolute bottom-0 right-2 -mt-[.5px] border-b bg-zinc-700 text-white disabled:text-zinc-400",
|
|
disabled: true,
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FontAwesomeIcon, { icon: faCaretDown })
|
|
}
|
|
)
|
|
] });
|
|
}
|
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
"input",
|
|
{
|
|
disabled: true,
|
|
className: props.className,
|
|
value: props.options[option].label
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: "absolute right-2 top-0 -mt-[.5px] border-t bg-zinc-700 text-white disabled:text-zinc-400",
|
|
disabled: option === 0,
|
|
onClick: () => {
|
|
setOption(option - 1);
|
|
if (props.onChange)
|
|
props.onChange(props.options[option - 1].value);
|
|
},
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FontAwesomeIcon, { icon: faCaretUp })
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: "absolute bottom-0 right-2 -mt-[.5px] border-b bg-zinc-700 text-white disabled:text-zinc-400",
|
|
disabled: option === props.options.length - 1,
|
|
onClick: () => {
|
|
setOption(option + 1);
|
|
if (props.onChange)
|
|
props.onChange(props.options[option + 1].value);
|
|
},
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FontAwesomeIcon, { icon: faCaretDown })
|
|
}
|
|
)
|
|
] });
|
|
}
|
|
|
|
// src/components/DeparturePerf.tsx
|
|
var import_jsx_runtime6 = __toESM(require_jsx_runtime());
|
|
function isFlapsValid(deflectedAilerons, flapInput) {
|
|
if (deflectedAilerons && flapInput == 28) {
|
|
return true;
|
|
}
|
|
if (flapInput >= 10 && flapInput <= 25 && flapInput % 0.5 == 0) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
function DeparturePerformance() {
|
|
const dispatch = useDispatch();
|
|
const planeConfig = useSelector((state) => state.plane);
|
|
const isMetric = planeConfig.options.general.weightUnits === "kgs";
|
|
const [windComponent, setWindComponent] = (0, import_react6.useState)({
|
|
speed: 0,
|
|
headwind: false
|
|
});
|
|
const [isAbleToCalculate, setIsAbleToCalculate] = (0, import_react6.useState)(false);
|
|
const config3 = useSelector(
|
|
(state) => state.performance.departure
|
|
);
|
|
const icao = config3.icao;
|
|
const airport = useSelector(
|
|
(state) => state.performance.departure.airport
|
|
);
|
|
const departurePerformanceResult = useSelector(
|
|
(state) => state.performance.departure.performance
|
|
);
|
|
const selRunwayID = useSelector(
|
|
(state) => state.performance.departure.selectedRunwayID
|
|
);
|
|
const runway = useSelector(
|
|
(state) => state.performance.departure.runway
|
|
);
|
|
const runwayLength = useSelector(
|
|
(state) => state.performance.departure.runwayLength
|
|
);
|
|
const windString = useSelector(
|
|
(state) => state.performance.departure.weather.windString
|
|
);
|
|
const windSpeed = useSelector(
|
|
(state) => state.performance.departure.weather.windSpeed
|
|
);
|
|
const windDirection = useSelector(
|
|
(state) => state.performance.departure.weather.windDirection
|
|
);
|
|
const temperature = useSelector(
|
|
(state) => state.performance.departure.weather.temperature
|
|
);
|
|
const qnh = useSelector(
|
|
(state) => state.performance.departure.weather.pressure
|
|
);
|
|
const takeoffWeight = useSelector(
|
|
(state) => state.performance.departure.tow
|
|
);
|
|
(0, import_react6.useEffect)(() => {
|
|
if (airport !== void 0 && selRunwayID === 0) {
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
runway: airport.runways[0],
|
|
selectedRunwayID: airport.runways[0].id,
|
|
runwayLength: isMetric ? Math.round(airport.runways[0].length * 0.3048) : airport.runways[0].length
|
|
}))
|
|
);
|
|
}
|
|
}, [airport, config3, isMetric, selRunwayID, dispatch]);
|
|
(0, import_react6.useEffect)(() => {
|
|
if (runway && runwayLength > 0 && windSpeed >= 0 && windDirection >= 0 && temperature !== -200 && qnh > 0 && takeoffWeight > 0 && (config3.flapsSetting === 0 /* OPTIMUM */ || isFlapsValid(
|
|
planeConfig.options.performance.deflectedAilerons,
|
|
config3.specificFlap
|
|
))) {
|
|
setIsAbleToCalculate(true);
|
|
} else {
|
|
setIsAbleToCalculate(false);
|
|
}
|
|
}, [
|
|
qnh,
|
|
runway,
|
|
runwayLength,
|
|
takeoffWeight,
|
|
temperature,
|
|
windDirection,
|
|
windSpeed,
|
|
config3,
|
|
planeConfig
|
|
]);
|
|
(0, import_react6.useEffect)(() => {
|
|
if (windSpeed >= 0 && windDirection >= 0) {
|
|
setWindComponent(
|
|
getWindComponent(
|
|
windDirection,
|
|
windSpeed,
|
|
runway ? runway.trueHeading : 0
|
|
)
|
|
);
|
|
}
|
|
}, [runway, windDirection, windSpeed]);
|
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mx-auto flex w-10/12 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "grid w-full grid-cols-2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "mr-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { className: "mb-2 text-center text-base font-bold", children: "Airport" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "ICAO code" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
Input,
|
|
{
|
|
value: icao,
|
|
onChange: (value) => {
|
|
if (value.length < 4) {
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
icao: value.toUpperCase(),
|
|
airport: void 0,
|
|
selectedRunwayID: 0,
|
|
runway: void 0,
|
|
runwayLength: 0,
|
|
weather: {
|
|
windString: "",
|
|
windDirection: -1,
|
|
windSpeed: -1,
|
|
temperature: -200,
|
|
pressure: 0
|
|
}
|
|
}))
|
|
);
|
|
return;
|
|
}
|
|
if (value.length > 4)
|
|
return;
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
icao: value.toUpperCase()
|
|
}))
|
|
);
|
|
if (value.length === 4) {
|
|
dispatch(fetchDepartureAirport());
|
|
}
|
|
},
|
|
className: `${airport === void 0 ? "border-red-500" : "border-white"} w-1/2 rounded-lg border bg-zinc-700 px-3 py-2 text-left focus:border-blue-600 focus:ring-blue-600`
|
|
}
|
|
)
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Runway" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-1/2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
Select,
|
|
{
|
|
className: "w-full rounded-l-lg border border-white bg-zinc-700 px-3 py-2 text-white shadow-sm focus:border-blue-600 focus:outline-none focus:ring-blue-600",
|
|
onChange: (value) => {
|
|
const rwy = airport.runways.find(
|
|
(rwy2) => rwy2.id === value
|
|
);
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
selectedRunwayID: value,
|
|
runway: rwy,
|
|
runwayLength: isMetric ? Math.round(
|
|
rwy.length * 0.3048
|
|
) : rwy.length
|
|
}))
|
|
);
|
|
},
|
|
options: airport ? airport.runways.map(
|
|
(runway2) => {
|
|
return {
|
|
value: runway2.id,
|
|
label: runway2.ident
|
|
};
|
|
}
|
|
) : []
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-1/2 items-center justify-center rounded-r-lg border border-white bg-zinc-600 px-2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mr-2", children: "Slope" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
|
|
runway ? Math.round(runway.slope * 10) / 10 : "--",
|
|
"%"
|
|
] })
|
|
] })
|
|
] })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-between bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Runway Length" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-1/2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
Input,
|
|
{
|
|
type: "number",
|
|
placeholder: "----",
|
|
className: `${runway && runwayLength <= (isMetric ? Math.round(
|
|
runway.length * 0.3048
|
|
) : runway.length) || !runway && runwayLength === 0 ? "border-white" : "border-red-500"} basis-full rounded-l-lg border bg-zinc-700 px-3 py-2 text-left focus:border-blue-600 focus:ring-blue-600`,
|
|
value: runwayLength === 0 ? "" : runwayLength,
|
|
min: 0,
|
|
max: 2e4,
|
|
disabled: runway === null,
|
|
onChange: (value) => {
|
|
const input = parseInt(value);
|
|
if (value.length === 0) {
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
runwayLength: 0
|
|
}))
|
|
);
|
|
return;
|
|
}
|
|
if (isNaN(input) || input < 0) {
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
runwayLength: runway ? isMetric ? Math.round(
|
|
runway.length * 0.3048
|
|
) : runway.length : 0
|
|
}))
|
|
);
|
|
return;
|
|
}
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
runwayLength: input
|
|
}))
|
|
);
|
|
}
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center rounded-r-lg border border-white bg-zinc-600 px-2", children: isMetric ? "m" : "ft" })
|
|
] })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Wind" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-1/2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
Input,
|
|
{
|
|
type: "text",
|
|
placeholder: "---/--",
|
|
className: `${windSpeed >= 0 && windDirection >= 0 || windSpeed === -1 && windDirection === -1 ? "border-white" : "border-red-500"} w-1/2 rounded-l-lg border bg-zinc-700 px-3 py-2 text-left focus:border-blue-600 focus:ring-blue-600`,
|
|
value: windString,
|
|
onChange: (value) => {
|
|
const wind = value.split("/");
|
|
if (wind.length !== 2) {
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
windString: value,
|
|
windDirection: -1,
|
|
windSpeed: -1
|
|
})
|
|
}))
|
|
);
|
|
return;
|
|
}
|
|
const speed = parseInt(wind[1]);
|
|
const direction = parseInt(wind[0]);
|
|
if (isNaN(speed) || isNaN(direction) || direction < 0 && direction > 360 || speed < 0 && speed > 99) {
|
|
if (isNaN(speed) || speed < 0 && speed > 99) {
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
windSpeed: -1
|
|
})
|
|
}))
|
|
);
|
|
}
|
|
if (isNaN(direction) || direction < 0 && direction > 360) {
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
windDirection: -1
|
|
})
|
|
}))
|
|
);
|
|
}
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
windString: value
|
|
})
|
|
}))
|
|
);
|
|
return;
|
|
}
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
windString: value,
|
|
windSpeed: speed,
|
|
windDirection: direction
|
|
})
|
|
}))
|
|
);
|
|
},
|
|
onBlur: () => {
|
|
if (windSpeed > -1 && windDirection > -1)
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
windString: windDirection.toString().padStart(
|
|
3,
|
|
"0"
|
|
) + "/" + windSpeed.toString()
|
|
})
|
|
}))
|
|
);
|
|
}
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-1/2 items-center justify-center rounded-r-lg border border-white bg-zinc-600 px-2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mr-2", children: windComponent.headwind ? "Tailwind" : "Headwind" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
|
|
Math.abs(
|
|
Math.round(windComponent.speed)
|
|
),
|
|
"KT"
|
|
] })
|
|
] })
|
|
] })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-between bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Temperature" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-1/2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
Input,
|
|
{
|
|
type: "number",
|
|
placeholder: "--",
|
|
className: `${temperature !== -200 ? "border-white" : "border-red-500"} w-full rounded-l-lg border bg-zinc-700 px-3 py-2 text-left focus:border-blue-600 focus:ring-blue-600`,
|
|
value: temperature === -200 ? "" : temperature,
|
|
onChange: (value) => {
|
|
const temperature2 = parseInt(value);
|
|
if (isNaN(temperature2)) {
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
temperature: -200
|
|
})
|
|
}))
|
|
);
|
|
return;
|
|
}
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
temperature: temperature2
|
|
})
|
|
}))
|
|
);
|
|
}
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center rounded-r-lg border border-white bg-zinc-600 px-2", children: [
|
|
"\xB0",
|
|
planeConfig.options.general.temperatureUnits.toUpperCase()
|
|
] })
|
|
] })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Pressure" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-1/2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
Input,
|
|
{
|
|
type: "number",
|
|
placeholder: airport && (airport.icao.startsWith("K") || airport.icao.startsWith("RJ") || airport.icao.startsWith("C")) ? "--.--" : "----",
|
|
min: 0,
|
|
max: 1100,
|
|
className: `${qnh === 0 ? "border-red-500" : "border-white"} w-3/4 rounded-l-lg border bg-zinc-700 px-3 py-2 text-left focus:border-blue-600 focus:ring-blue-600`,
|
|
value: qnh === 0 ? "" : airport && (airport.icao.startsWith("K") || airport.icao.startsWith(
|
|
"RJ"
|
|
) || airport.icao.startsWith(
|
|
"C"
|
|
)) ? qnh.toFixed(2) : qnh,
|
|
onChange: (value) => {
|
|
const pressure = parseFloat(value);
|
|
if (isNaN(pressure)) {
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
pressure: 0
|
|
})
|
|
}))
|
|
);
|
|
return;
|
|
}
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
pressure
|
|
})
|
|
}))
|
|
);
|
|
}
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex w-1/4 items-center justify-center rounded-r-lg border border-white bg-zinc-600 px-2", children: airport && (airport.icao.startsWith("K") || airport.icao.startsWith("RJ") || airport.icao.startsWith("C")) ? "inHg" : "hPA" })
|
|
] })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
"button",
|
|
{
|
|
className: "text-2xs w-full rounded-b-lg bg-blue-700 px-6 py-3 font-sans font-bold uppercase text-white shadow-md shadow-blue-500/20 transition-all hover:shadow-lg hover:shadow-blue-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
onClick: async () => {
|
|
if (airport) {
|
|
const data = await getMETAR(airport.icao);
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
weather: {
|
|
windString: data.wdir === "VRB" ? "360/" + data.wspd.toString() : data.wdir.toString().padStart(3, "0") + "/" + data.wspd.toString(),
|
|
windDirection: data.wdir === "VRB" ? 0 : parseInt(data.wdir),
|
|
windSpeed: data.wspd,
|
|
temperature: planeConfig.options.general.temperatureUnits == "c" ? Math.round(data.temp) : Math.round(
|
|
data.temp * 9 / 5 + 32
|
|
),
|
|
pressure: airport.icao.startsWith("K") || airport.icao.startsWith("RJ") || airport.icao.startsWith("C") ? Math.round(
|
|
data.altim * 0.02953 * 100
|
|
) / 100 : Math.round(data.altim)
|
|
}
|
|
}))
|
|
);
|
|
}
|
|
},
|
|
children: "Get weather information"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "ml-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { className: "mb-2 text-center text-base font-bold", children: "Aircraft" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Takeoff Weight" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-1/2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
Input,
|
|
{
|
|
type: "number",
|
|
placeholder: "-----",
|
|
className: `${takeoffWeight !== -1 ? "border-white" : "border-red-500"} w-full rounded-l-lg border bg-zinc-700 px-3 py-2 text-left focus:border-blue-600 focus:ring-blue-600`,
|
|
value: takeoffWeight === -1 ? "" : takeoffWeight,
|
|
onChange: (value) => {
|
|
if (value.length === 0) {
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
tow: -1
|
|
}))
|
|
);
|
|
return;
|
|
}
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
tow: parseFloat(value)
|
|
}))
|
|
);
|
|
}
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center rounded-r-lg border border-white bg-zinc-600 px-2", children: isMetric ? "kg" : "lb" })
|
|
] })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Thrust Setting" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
Select,
|
|
{
|
|
className: "w-full rounded-lg border border-white bg-zinc-700 px-3 py-2 text-white shadow-sm focus:border-blue-600 focus:outline-none focus:ring-blue-600",
|
|
onChange: (value) => {
|
|
return dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
thrustSetting: value
|
|
}))
|
|
);
|
|
},
|
|
options: thrustSettings.map((setting) => {
|
|
return {
|
|
value: setting.value,
|
|
label: setting.label
|
|
};
|
|
})
|
|
}
|
|
) })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-between bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Anti-Ice" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
Select,
|
|
{
|
|
className: "w-full rounded-lg border border-white bg-zinc-700 px-3 py-2 text-white shadow-sm focus:border-blue-600 focus:outline-none focus:ring-blue-600",
|
|
onChange: (value) => {
|
|
return dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
antiIce: value
|
|
}))
|
|
);
|
|
},
|
|
options: antiIceSettings.map((setting) => {
|
|
return {
|
|
value: setting.value,
|
|
label: setting.label
|
|
};
|
|
})
|
|
}
|
|
) })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Flaps" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
"div",
|
|
{
|
|
className: "inline-flex w-1/2 rounded-md shadow-sm",
|
|
role: "group",
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${config3.flapsSetting === 0 /* OPTIMUM */ ? "bg-green-700" : "bg-zinc-700"} w-1/2 rounded-l-lg border border-white px-4 py-2 text-white`,
|
|
onClick: () => {
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
flapsSetting: 0 /* OPTIMUM */
|
|
}))
|
|
);
|
|
},
|
|
children: "Optimum"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${config3.flapsSetting === 1 /* SPECIFIC */ ? "bg-green-700" : "bg-zinc-700"} w-1/2 rounded-r-md border border-white px-4 py-2 text-white`,
|
|
onClick: () => {
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
flapsSetting: 1 /* SPECIFIC */
|
|
}))
|
|
);
|
|
},
|
|
children: "Specific"
|
|
}
|
|
)
|
|
]
|
|
}
|
|
)
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-between bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Specific Flaps" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
Input,
|
|
{
|
|
type: "number",
|
|
placeholder: "--",
|
|
className: `${config3.flapsSetting === 0 /* OPTIMUM */ || isFlapsValid(
|
|
planeConfig.options.performance.deflectedAilerons,
|
|
config3.specificFlap
|
|
) ? "border-white" : "border-red-500"} w-1/2 rounded-lg border bg-zinc-700 px-3 py-2 text-white shadow-sm focus:border-blue-600 focus:outline-none focus:ring-blue-600 disabled:opacity-50`,
|
|
disabled: config3.flapsSetting === 0 /* OPTIMUM */,
|
|
value: config3.specificFlapString,
|
|
onChange: (value) => {
|
|
if (value.length === 0) {
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
specificFlap: 0,
|
|
specificFlapString: ""
|
|
}))
|
|
);
|
|
return;
|
|
}
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
specificFlapString: value
|
|
}))
|
|
);
|
|
},
|
|
onBlur: () => {
|
|
const flapInput = parseFloat(
|
|
config3.specificFlapString
|
|
);
|
|
if (isNaN(flapInput)) {
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
specificFlap: 0
|
|
}))
|
|
);
|
|
return;
|
|
}
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
specificFlap: flapInput
|
|
}))
|
|
);
|
|
}
|
|
}
|
|
)
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Packs" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
"div",
|
|
{
|
|
className: "inline-flex w-1/2 rounded-md shadow-sm",
|
|
role: "group",
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${config3.packs ? "bg-green-700" : "bg-zinc-700"} w-1/2 rounded-l-lg border border-white px-4 py-2 text-white`,
|
|
onClick: () => {
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
packs: true
|
|
}))
|
|
);
|
|
},
|
|
children: "On"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${!config3.packs ? "bg-green-700" : "bg-zinc-700"} w-1/2 rounded-r-md border border-white px-4 py-2 text-white`,
|
|
onClick: () => {
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
packs: false
|
|
}))
|
|
);
|
|
},
|
|
children: "Off"
|
|
}
|
|
)
|
|
]
|
|
}
|
|
)
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
"button",
|
|
{
|
|
className: "text-2xs w-full rounded-b-lg bg-blue-700 px-6 py-3 font-sans font-bold uppercase text-white shadow-md shadow-blue-500/20 transition-all hover:shadow-lg hover:shadow-blue-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
onClick: async () => {
|
|
const api2 = await lib();
|
|
const tow = await api2.getEFBVariable("ACTUAL_TOW");
|
|
dispatch(
|
|
setDeparture(__spreadProps(__spreadValues({}, config3), {
|
|
tow: Math.round(
|
|
isMetric ? tow * 0.453592 : tow
|
|
)
|
|
}))
|
|
);
|
|
},
|
|
children: "Get Takeoff Weight"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "col-span-2 flex h-min flex-col", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
"button",
|
|
{
|
|
disabled: !isAbleToCalculate,
|
|
className: "text-2xs rounded-t-lg bg-green-700 px-6 py-3 font-sans font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
onClick: async () => {
|
|
const api2 = await lib();
|
|
await api2.setEFBVariable(
|
|
"RWY_LENGTH",
|
|
"number",
|
|
isMetric ? runwayLength : runwayLength * 0.3048
|
|
);
|
|
await api2.setEFBVariable(
|
|
"ELEVATION",
|
|
"number",
|
|
airport.elevation
|
|
);
|
|
await api2.setEFBVariable(
|
|
"SLOPE",
|
|
"number",
|
|
runway.slope
|
|
);
|
|
await api2.setEFBVariable("RWY_COND", "number", 0);
|
|
await api2.setEFBVariable(
|
|
"HEADWIND",
|
|
"number",
|
|
windComponent.speed
|
|
);
|
|
await api2.setEFBVariable(
|
|
"TEMP",
|
|
"number",
|
|
Math.round(
|
|
planeConfig.options.general.temperatureUnits == "c" ? config3.weather.temperature : (config3.weather.temperature - 32) * 5 / 9
|
|
)
|
|
);
|
|
await api2.setEFBVariable(
|
|
"TOW",
|
|
"number",
|
|
isMetric ? config3.tow : Math.round(config3.tow * 0.453592)
|
|
);
|
|
await api2.setEFBVariable(
|
|
"THRUST_SETTING",
|
|
"number",
|
|
config3.thrustSetting == 0 /* FLEX */ ? 1 : 0
|
|
);
|
|
await api2.setEFBVariable(
|
|
"ANTI_ICE",
|
|
"number",
|
|
config3.antiIce == 2 /* ENGINE_WING */ ? 1 : 0
|
|
);
|
|
await api2.setEFBVariable(
|
|
"FLAPS_SETTING",
|
|
"number",
|
|
config3.flapsSetting
|
|
);
|
|
await api2.setEFBVariable(
|
|
"FLAPS_SPCF",
|
|
"number",
|
|
config3.specificFlap
|
|
);
|
|
await api2.setEFBVariable(
|
|
"PACKS",
|
|
"number",
|
|
config3.packs ? 1 : 0
|
|
);
|
|
await api2.triggerReadVariable([
|
|
128 /* DeparturePerformance */
|
|
]);
|
|
if (simulator() === 1 /* P3D */) {
|
|
dispatch(
|
|
setDeparturePerformance({
|
|
v1: Math.round(
|
|
api2.getEFBVariable("V1")
|
|
),
|
|
vr: Math.round(
|
|
api2.getEFBVariable("VR")
|
|
),
|
|
v2: Math.round(
|
|
api2.getEFBVariable("V2")
|
|
),
|
|
flex: Math.round(
|
|
api2.getEFBVariable("FLEX_TEMP")
|
|
),
|
|
flaps: api2.getEFBVariable("FLAPS")
|
|
})
|
|
);
|
|
}
|
|
},
|
|
children: "Calculate"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex flex-row", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex w-full items-center justify-between rounded-bl-lg bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full flex-col items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mb-2", children: "V1" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
Input,
|
|
{
|
|
type: "text",
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-left focus:border-blue-600 focus:ring-blue-600",
|
|
value: departurePerformanceResult.v1 === -1 ? "---" : departurePerformanceResult.v1,
|
|
disabled: true
|
|
}
|
|
)
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full flex-col items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mb-2", children: "VR" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
Input,
|
|
{
|
|
type: "text",
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-left focus:border-blue-600 focus:ring-blue-600",
|
|
value: departurePerformanceResult.vr === -1 ? "---" : departurePerformanceResult.vr,
|
|
disabled: true
|
|
}
|
|
)
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full flex-col items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mb-2", children: "V2" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
Input,
|
|
{
|
|
type: "text",
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-left focus:border-blue-600 focus:ring-blue-600",
|
|
value: departurePerformanceResult.v2 === -1 ? "---" : departurePerformanceResult.v2,
|
|
disabled: true
|
|
}
|
|
)
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full flex-col items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mb-2", children: "Flex Temperature" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-1/2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
Input,
|
|
{
|
|
type: "text",
|
|
placeholder: "---",
|
|
disabled: true,
|
|
className: "w-full rounded-l-lg border border-white bg-zinc-700 px-3 py-2 text-left focus:border-blue-600 focus:ring-blue-600",
|
|
value: departurePerformanceResult.flex === -999 ? "---" : departurePerformanceResult.flex
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex items-center rounded-r-lg border border-white bg-zinc-600 px-2", children: "\xB0C" })
|
|
] })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex w-full items-center justify-between rounded-br-lg bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex w-full flex-col items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mb-2", children: "Flaps" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
Input,
|
|
{
|
|
type: "text",
|
|
placeholder: "---",
|
|
disabled: true,
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 text-left focus:border-blue-600 focus:ring-blue-600",
|
|
value: departurePerformanceResult.flaps === 0 ? "---" : Math.round(
|
|
departurePerformanceResult.flaps * 10
|
|
) / 10
|
|
}
|
|
)
|
|
] }) })
|
|
] })
|
|
] })
|
|
] }) });
|
|
}
|
|
|
|
// src/routes/PerformancePage.tsx
|
|
init_common();
|
|
|
|
// src/components/ArrivalPerf.tsx
|
|
var import_react7 = __toESM(require_react());
|
|
|
|
// src/lib/interfaces/rwyCondition.ts
|
|
var runwayConditions = [
|
|
{
|
|
value: 0 /* DRY */,
|
|
label: "DRY"
|
|
},
|
|
{
|
|
value: 1 /* WET */,
|
|
label: "WET"
|
|
},
|
|
{
|
|
value: 2 /* CONTAMINATED */,
|
|
label: "CONTAMINATED"
|
|
}
|
|
];
|
|
|
|
// src/components/ArrivalPerf.tsx
|
|
init_common();
|
|
|
|
// src/lib/arrivalPerf.ts
|
|
var perfData = [
|
|
{
|
|
brakingAction: 0 /* GOOD */,
|
|
autoBrake: 0 /* MIN */,
|
|
baseDistances: [
|
|
{ headwind: -10, distance: 2230, landingAllowed: true },
|
|
{ headwind: -5, distance: 2140, landingAllowed: true },
|
|
{ headwind: 0, distance: 2050, landingAllowed: true },
|
|
{ headwind: 10, distance: 1880, landingAllowed: true },
|
|
{ headwind: 20, distance: 1710, landingAllowed: true },
|
|
{ headwind: 30, distance: 1540, landingAllowed: true }
|
|
],
|
|
corrections: [
|
|
{
|
|
correctionType: 0 /* WEIGHT */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (weight < 18e4)
|
|
return (18e4 - weight) / 1e4 * -90;
|
|
else
|
|
return (weight - 18e4) / 1e4 * 90;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 1 /* TEMPERATURE */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (temp < 288)
|
|
return (288 - temp) * -7;
|
|
else
|
|
return (temp - 288) * 7;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 2 /* SPEED */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (vapp > vmin + 5)
|
|
return (vapp - vmin) * 25;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 3 /* SLOPE */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (slope > 0)
|
|
return Math.abs(slope / 0.1) * -10;
|
|
else
|
|
return Math.abs(slope / 0.1) * 15;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 4 /* FLAPS */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (flaps === 50)
|
|
return -120;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 5 /* REVERSE_TRHUST */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (reverseThrust === 1 /* WING */)
|
|
return 20;
|
|
else if (reverseThrust === 2 /* TAIL */)
|
|
return 30;
|
|
else if (reverseThrust === 3 /* NONE */)
|
|
return 60;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 6 /* AIRPORT_ELEVATION */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust, airportElevation) => {
|
|
if (airportElevation > 0)
|
|
return airportElevation / 1e3 * 70;
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
brakingAction: 0 /* GOOD */,
|
|
autoBrake: 1 /* MED */,
|
|
baseDistances: [
|
|
{ headwind: -10, distance: 1870, landingAllowed: true },
|
|
{ headwind: -5, distance: 1800, landingAllowed: true },
|
|
{ headwind: 0, distance: 1730, landingAllowed: true },
|
|
{ headwind: 10, distance: 1600, landingAllowed: true },
|
|
{ headwind: 20, distance: 1470, landingAllowed: true },
|
|
{ headwind: 30, distance: 1340, landingAllowed: true }
|
|
],
|
|
corrections: [
|
|
{
|
|
correctionType: 0 /* WEIGHT */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (weight < 18e4)
|
|
return (18e4 - weight) / 1e4 * -80;
|
|
else
|
|
return (weight - 18e4) / 1e4 * 80;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 1 /* TEMPERATURE */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (temp < 288)
|
|
return (288 - temp) * -6;
|
|
else
|
|
return (temp - 288) * 6;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 2 /* SPEED */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (vapp > vmin + 5)
|
|
return (vapp - vmin) * 20;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 3 /* SLOPE */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (slope > 0)
|
|
return Math.abs(slope / 0.1) * -10;
|
|
else
|
|
return Math.abs(slope / 0.1) * 15;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 4 /* FLAPS */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (flaps === 50)
|
|
return -100;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 5 /* REVERSE_TRHUST */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (reverseThrust === 1 /* WING */)
|
|
return 20;
|
|
else if (reverseThrust === 2 /* TAIL */)
|
|
return 30;
|
|
else if (reverseThrust === 3 /* NONE */)
|
|
return 60;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 6 /* AIRPORT_ELEVATION */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust, airportElevation) => {
|
|
if (airportElevation > 0)
|
|
return airportElevation / 1e3 * 60;
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
brakingAction: 0 /* GOOD */,
|
|
autoBrake: 2 /* MAX */,
|
|
baseDistances: [
|
|
{ headwind: -10, distance: 1540, landingAllowed: true },
|
|
{ headwind: -5, distance: 1490, landingAllowed: true },
|
|
{ headwind: 0, distance: 1440, landingAllowed: true },
|
|
{ headwind: 10, distance: 1340, landingAllowed: true },
|
|
{ headwind: 20, distance: 1240, landingAllowed: true },
|
|
{ headwind: 30, distance: 1140, landingAllowed: true }
|
|
],
|
|
corrections: [
|
|
{
|
|
correctionType: 0 /* WEIGHT */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (weight < 18e4)
|
|
return (18e4 - weight) / 1e4 * -50;
|
|
else
|
|
return (weight - 18e4) / 1e4 * 50;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 1 /* TEMPERATURE */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (temp < 288)
|
|
return (288 - temp) * -5;
|
|
else
|
|
return (temp - 288) * 5;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 2 /* SPEED */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (vapp > vmin + 5)
|
|
return (vapp - vmin) * 15;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 3 /* SLOPE */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (slope > 0)
|
|
return Math.abs(slope / 0.1) * -10;
|
|
else
|
|
return Math.abs(slope / 0.1) * 15;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 4 /* FLAPS */,
|
|
getCorrection: (fweight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (flaps === 50)
|
|
return -70;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 5 /* REVERSE_TRHUST */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (reverseThrust === 1 /* WING */)
|
|
return 20;
|
|
else if (reverseThrust === 2 /* TAIL */)
|
|
return 30;
|
|
else if (reverseThrust === 3 /* NONE */)
|
|
return 80;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 6 /* AIRPORT_ELEVATION */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust, airportElevation) => {
|
|
if (airportElevation > 0)
|
|
return airportElevation / 1e3 * 50;
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
brakingAction: 1 /* MEDIUM */,
|
|
autoBrake: 0 /* MIN */,
|
|
baseDistances: [
|
|
{ headwind: -10, distance: 2230, landingAllowed: false },
|
|
{ headwind: -5, distance: 2140, landingAllowed: true },
|
|
{ headwind: 0, distance: 2050, landingAllowed: true },
|
|
{ headwind: 10, distance: 1880, landingAllowed: true },
|
|
{ headwind: 20, distance: 1710, landingAllowed: true },
|
|
{ headwind: 30, distance: 1540, landingAllowed: true }
|
|
],
|
|
corrections: [
|
|
{
|
|
correctionType: 0 /* WEIGHT */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (weight < 18e4)
|
|
return (18e4 - weight) / 1e4 * -90;
|
|
else
|
|
return (weight - 18e4) / 1e4 * 90;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 1 /* TEMPERATURE */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (temp < 288)
|
|
return (288 - temp) * -7;
|
|
else
|
|
return (temp - 288) * 7;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 2 /* SPEED */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (vapp > vmin + 5)
|
|
return (vapp - vmin) * 25;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 3 /* SLOPE */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (slope > 0)
|
|
return Math.abs(slope / 0.1) * -10;
|
|
else
|
|
return Math.abs(slope / 0.1) * 15;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 4 /* FLAPS */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (flaps === 50)
|
|
return -120;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 5 /* REVERSE_TRHUST */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (reverseThrust === 1 /* WING */)
|
|
return 30;
|
|
else if (reverseThrust === 2 /* TAIL */)
|
|
return 50;
|
|
else if (reverseThrust === 3 /* NONE */)
|
|
return 120;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 6 /* AIRPORT_ELEVATION */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust, airportElevation) => {
|
|
if (airportElevation > 0)
|
|
return airportElevation / 1e3 * 75;
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
brakingAction: 1 /* MEDIUM */,
|
|
autoBrake: 1 /* MED */,
|
|
baseDistances: [
|
|
{ headwind: -10, distance: 1950, landingAllowed: false },
|
|
{ headwind: -5, distance: 1880, landingAllowed: true },
|
|
{ headwind: 0, distance: 1800, landingAllowed: true },
|
|
{ headwind: 10, distance: 1660, landingAllowed: true },
|
|
{ headwind: 20, distance: 1520, landingAllowed: true },
|
|
{ headwind: 30, distance: 1380, landingAllowed: true }
|
|
],
|
|
corrections: [
|
|
{
|
|
correctionType: 0 /* WEIGHT */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (weight < 18e4)
|
|
return (18e4 - weight) / 1e4 * -70;
|
|
else
|
|
return (weight - 18e4) / 1e4 * 70;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 1 /* TEMPERATURE */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (temp < 288)
|
|
return (288 - temp) * -6;
|
|
else
|
|
return (temp - 288) * 6;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 2 /* SPEED */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (vapp > vmin + 5)
|
|
return (vapp - (vmin + 5)) * 20;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 3 /* SLOPE */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (slope > 0)
|
|
return Math.abs(slope / 0.1) * -10;
|
|
else
|
|
return Math.abs(slope / 0.1) * 15;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 4 /* FLAPS */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (flaps === 50)
|
|
return -100;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 5 /* REVERSE_TRHUST */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (reverseThrust === 1 /* WING */)
|
|
return 60;
|
|
else if (reverseThrust === 2 /* TAIL */)
|
|
return 170;
|
|
else if (reverseThrust === 3 /* NONE */)
|
|
return 370;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 6 /* AIRPORT_ELEVATION */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust, airportElevation) => {
|
|
if (airportElevation > 0)
|
|
return airportElevation / 1e3 * 70;
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
brakingAction: 1 /* MEDIUM */,
|
|
autoBrake: 2 /* MAX */,
|
|
baseDistances: [
|
|
{ headwind: -10, distance: 1860, landingAllowed: false },
|
|
{ headwind: -5, distance: 1790, landingAllowed: true },
|
|
{ headwind: 0, distance: 1720, landingAllowed: true },
|
|
{ headwind: 10, distance: 1590, landingAllowed: true },
|
|
{ headwind: 20, distance: 1460, landingAllowed: true },
|
|
{ headwind: 30, distance: 1330, landingAllowed: true }
|
|
],
|
|
corrections: [
|
|
{
|
|
correctionType: 0 /* WEIGHT */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (weight < 18e4)
|
|
return (18e4 - weight) / 1e4 * -70;
|
|
else
|
|
return (weight - 18e4) / 1e4 * 70;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 1 /* TEMPERATURE */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (temp < 288)
|
|
return (288 - temp) * -6;
|
|
else
|
|
return (temp - 288) * 6;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 2 /* SPEED */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (vapp > vmin + 5)
|
|
return (vapp - vmin) * 20;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 3 /* SLOPE */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (slope > 0)
|
|
return Math.abs(slope / 0.1) * -10;
|
|
else
|
|
return Math.abs(slope / 0.1) * 15;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 4 /* FLAPS */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (flaps === 50)
|
|
return -100;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 5 /* REVERSE_TRHUST */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (reverseThrust === 1 /* WING */)
|
|
return 90;
|
|
else if (reverseThrust === 2 /* TAIL */)
|
|
return 190;
|
|
else if (reverseThrust === 3 /* NONE */)
|
|
return 380;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 6 /* AIRPORT_ELEVATION */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust, airportElevation) => {
|
|
if (airportElevation > 0)
|
|
return airportElevation / 1e3 * 60;
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
brakingAction: 2 /* POOR */,
|
|
autoBrake: 1 /* MED */,
|
|
baseDistances: [
|
|
{ headwind: -10, distance: 2720, landingAllowed: false },
|
|
{ headwind: -5, distance: 2600, landingAllowed: false },
|
|
{ headwind: 0, distance: 2490, landingAllowed: true },
|
|
{ headwind: 10, distance: 2270, landingAllowed: true },
|
|
{ headwind: 20, distance: 2050, landingAllowed: true },
|
|
{ headwind: 30, distance: 1830, landingAllowed: true }
|
|
],
|
|
corrections: [
|
|
{
|
|
correctionType: 0 /* WEIGHT */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (weight < 18e4)
|
|
return (18e4 - weight) / 1e4 * -110;
|
|
else
|
|
return (weight - 18e4) / 1e4 * 110;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 1 /* TEMPERATURE */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (temp < 288)
|
|
return (288 - temp) * -9;
|
|
else
|
|
return (temp - 288) * 9;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 2 /* SPEED */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (vapp > vmin + 5)
|
|
return (vapp - vmin) * 30;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 3 /* SLOPE */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (slope > 0)
|
|
return Math.abs(slope / 0.1) * -20;
|
|
else
|
|
return Math.abs(slope / 0.1) * 30;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 4 /* FLAPS */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (flaps === 50)
|
|
return -160;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 5 /* REVERSE_TRHUST */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (reverseThrust === 1 /* WING */)
|
|
return 270;
|
|
else if (reverseThrust === 2 /* TAIL */)
|
|
return 630;
|
|
else if (reverseThrust === 3 /* NONE */)
|
|
return 1620;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 6 /* AIRPORT_ELEVATION */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust, airportElevation) => {
|
|
if (airportElevation > 0)
|
|
return airportElevation / 1e3 * 90;
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
brakingAction: 2 /* POOR */,
|
|
autoBrake: 2 /* MAX */,
|
|
baseDistances: [
|
|
{ headwind: -10, distance: 2700, landingAllowed: false },
|
|
{ headwind: -5, distance: 2590, landingAllowed: false },
|
|
{ headwind: 0, distance: 2470, landingAllowed: true },
|
|
{ headwind: 10, distance: 2250, landingAllowed: true },
|
|
{ headwind: 20, distance: 2030, landingAllowed: true },
|
|
{ headwind: 30, distance: 1810, landingAllowed: true }
|
|
],
|
|
corrections: [
|
|
{
|
|
correctionType: 0 /* WEIGHT */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (weight < 18e4)
|
|
return (18e4 - weight) / 1e4 * -110;
|
|
else
|
|
return (weight - 18e4) / 1e4 * 110;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 1 /* TEMPERATURE */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (temp < 288)
|
|
return (288 - temp) * -9;
|
|
else
|
|
return (temp - 288) * 9;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 2 /* SPEED */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (vapp > vmin + 5)
|
|
return (vapp - vmin) * 30;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 3 /* SLOPE */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (slope > 0)
|
|
return Math.abs(slope / 0.1) * -20;
|
|
else
|
|
return Math.abs(slope / 0.1) * 30;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 4 /* FLAPS */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (flaps === 50)
|
|
return -160;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 5 /* REVERSE_TRHUST */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust) => {
|
|
if (reverseThrust === 1 /* WING */)
|
|
return 270;
|
|
else if (reverseThrust === 2 /* TAIL */)
|
|
return 630;
|
|
else if (reverseThrust === 3 /* NONE */)
|
|
return 1620;
|
|
else
|
|
return 0;
|
|
}
|
|
},
|
|
{
|
|
correctionType: 6 /* AIRPORT_ELEVATION */,
|
|
getCorrection: (weight, temp, vapp, vmin, slope, flaps, reverseThrust, airportElevation) => {
|
|
if (airportElevation > 0)
|
|
return airportElevation / 1e3 * 90;
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
]
|
|
}
|
|
];
|
|
function getArrivalDistance(weight, temp, vapp, vmin, slope, flaps, reverseThrust, headwind, breakingAction, autoBrake, airportElevation) {
|
|
let distance = 0;
|
|
let isLandable = false;
|
|
const perfSituation = perfData.find(
|
|
(perf2) => perf2.brakingAction === breakingAction && perf2.autoBrake === autoBrake
|
|
);
|
|
if (headwind < -10)
|
|
return { distance: NaN, isLandable: false };
|
|
else if (perfSituation) {
|
|
if (headwind > 30)
|
|
headwind = 30;
|
|
const closestHeadwind = perfSituation.baseDistances.reduce(
|
|
(prev, curr) => Math.abs(curr.headwind - headwind) < Math.abs(prev.headwind - headwind) ? curr : prev
|
|
);
|
|
distance = closestHeadwind.distance || 0;
|
|
isLandable = closestHeadwind.landingAllowed || true;
|
|
perfSituation.corrections.forEach((correction) => {
|
|
distance += correction.getCorrection(
|
|
weight,
|
|
273.15 + temp,
|
|
vapp,
|
|
vmin,
|
|
slope,
|
|
flaps,
|
|
reverseThrust,
|
|
airportElevation
|
|
);
|
|
});
|
|
return { distance, isLandable };
|
|
} else
|
|
return { distance: NaN, isLandable };
|
|
}
|
|
|
|
// src/components/ArrivalPerf.tsx
|
|
var import_jsx_runtime7 = __toESM(require_jsx_runtime());
|
|
function ArrivalPerf() {
|
|
const dispatch = useDispatch();
|
|
const planeConfig = useSelector((state) => state.plane);
|
|
const isMetric = planeConfig.options.general.weightUnits === "kgs";
|
|
const [windComponent, setWindComponent] = (0, import_react7.useState)({
|
|
speed: 0,
|
|
headwind: false
|
|
});
|
|
const [isAbleToCalculate, setIsAbleToCalculate] = (0, import_react7.useState)(false);
|
|
const config3 = useSelector((state) => state.performance.arrival);
|
|
const icao = config3.icao;
|
|
const airport = useSelector(
|
|
(state) => state.performance.arrival.airport
|
|
);
|
|
const selRunwayID = useSelector(
|
|
(state) => state.performance.arrival.selectedRunwayID
|
|
);
|
|
const runway = useSelector(
|
|
(state) => state.performance.arrival.runway
|
|
);
|
|
const runwayCondition = useSelector(
|
|
(state) => state.performance.arrival.runwayCondition
|
|
);
|
|
const windString = useSelector(
|
|
(state) => state.performance.arrival.weather.windString
|
|
);
|
|
const windSpeed = useSelector(
|
|
(state) => state.performance.arrival.weather.windSpeed
|
|
);
|
|
const windDirection = useSelector(
|
|
(state) => state.performance.arrival.weather.windDirection
|
|
);
|
|
const temperature = useSelector(
|
|
(state) => state.performance.arrival.weather.temperature
|
|
);
|
|
const qnh = useSelector(
|
|
(state) => state.performance.arrival.weather.pressure
|
|
);
|
|
const landingWeight = useSelector(
|
|
(state) => state.performance.arrival.lw
|
|
);
|
|
const decelDistance = useSelector(
|
|
(state) => state.performance.arrival.decelDistance
|
|
);
|
|
(0, import_react7.useEffect)(() => {
|
|
if (airport !== void 0 && selRunwayID === 0) {
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
runway: airport.runways[0],
|
|
selectedRunwayID: airport.runways[0].id,
|
|
runwayLength: isMetric ? Math.round(airport.runways[0].length * 0.3048) : airport.runways[0].length
|
|
}))
|
|
);
|
|
}
|
|
}, [airport, config3, isMetric, selRunwayID, dispatch]);
|
|
(0, import_react7.useEffect)(() => {
|
|
if (windSpeed >= 0 && windDirection >= 0) {
|
|
setWindComponent(
|
|
getWindComponent(
|
|
windDirection,
|
|
windSpeed,
|
|
runway ? runway.trueHeading : 0
|
|
)
|
|
);
|
|
}
|
|
}, [runway, windDirection, windSpeed]);
|
|
(0, import_react7.useEffect)(() => {
|
|
if (airport !== void 0 && selRunwayID !== 0 && runwayCondition !== 0 && windSpeed >= 0 && windDirection >= 0 && temperature !== -200 && qnh !== 0 && landingWeight !== -1) {
|
|
setIsAbleToCalculate(true);
|
|
} else {
|
|
setIsAbleToCalculate(false);
|
|
}
|
|
}, [
|
|
airport,
|
|
landingWeight,
|
|
qnh,
|
|
runwayCondition,
|
|
selRunwayID,
|
|
temperature,
|
|
windDirection,
|
|
windSpeed
|
|
]);
|
|
const calculate = () => {
|
|
if (isAbleToCalculate && config3.performance.vapp !== -1 && config3.performance.vref !== -1 && decelDistance === -1) {
|
|
let brakingAction = 0 /* GOOD */;
|
|
if (config3.runwayCondition) {
|
|
if (runwayCondition === 0 /* DRY */) {
|
|
brakingAction = 0 /* GOOD */;
|
|
} else if (runwayCondition === 1 /* WET */) {
|
|
brakingAction = 1 /* MEDIUM */;
|
|
} else if (runwayCondition === 2 /* CONTAMINATED */) {
|
|
brakingAction = 2 /* POOR */;
|
|
}
|
|
}
|
|
const decel = getArrivalDistance(
|
|
config3.lw * (isMetric ? 1 : 0.3048),
|
|
planeConfig.options.general.temperatureUnits == "c" ? config3.weather.temperature : (config3.weather.temperature - 32) * 5 / 9,
|
|
config3.performance.vapp,
|
|
config3.performance.vref,
|
|
runway.slope,
|
|
config3.flaps50 ? 50 : 35,
|
|
config3.reversers,
|
|
windComponent.speed,
|
|
brakingAction,
|
|
config3.autobrake,
|
|
airport.elevation
|
|
);
|
|
dispatch(
|
|
setArrivalDecelAndLand(__spreadProps(__spreadValues({}, config3), {
|
|
decelDistance: decel.distance,
|
|
canLand: decel.isLandable
|
|
}))
|
|
);
|
|
}
|
|
};
|
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mx-auto flex w-10/12 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "grid w-full grid-cols-2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mr-8", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { className: "mb-2 text-center text-base font-bold", children: "Airport" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "ICAO code" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
Input,
|
|
{
|
|
value: icao,
|
|
onChange: (value) => {
|
|
if (value.length < 4) {
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
icao: value.toUpperCase(),
|
|
airport: void 0,
|
|
selectedRunwayID: 0,
|
|
runway: void 0,
|
|
runwayLength: 0,
|
|
weather: {
|
|
windString: "",
|
|
windDirection: -1,
|
|
windSpeed: -1,
|
|
temperature: -200,
|
|
pressure: 0
|
|
}
|
|
}))
|
|
);
|
|
return;
|
|
}
|
|
if (value.length > 4)
|
|
return;
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
icao: value.toUpperCase()
|
|
}))
|
|
);
|
|
if (value.length === 4) {
|
|
dispatch(fetchArrivalAirport());
|
|
}
|
|
},
|
|
className: `${airport === void 0 ? "border-red-500" : "border-white"} w-1/2 rounded-lg border bg-zinc-700 px-3 py-2 text-left focus:border-blue-600 focus:ring-blue-600`
|
|
}
|
|
)
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Runway" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-1/2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
Select,
|
|
{
|
|
className: "w-full rounded-l-lg border border-white bg-zinc-700 px-3 py-2 text-white shadow-sm focus:border-blue-600 focus:outline-none focus:ring-blue-600",
|
|
onChange: (value) => {
|
|
const rwy = airport.runways.find(
|
|
(rwy2) => rwy2.id === value
|
|
);
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
selectedRunwayID: value,
|
|
runway: rwy,
|
|
runwayLength: isMetric ? Math.round(
|
|
rwy.length * 0.3048
|
|
) : rwy.length
|
|
}))
|
|
);
|
|
},
|
|
options: airport ? airport.runways.map(
|
|
(runway2) => {
|
|
return {
|
|
value: runway2.id,
|
|
label: runway2.ident
|
|
};
|
|
}
|
|
) : []
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-1/2 items-center justify-center rounded-r-lg border border-white bg-zinc-600 px-2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mr-2", children: "Slope" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
|
|
runway ? Math.round(runway.slope * 10) / 10 : "--",
|
|
"%"
|
|
] })
|
|
] })
|
|
] })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-between bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Runway Condition" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
Select,
|
|
{
|
|
className: "w-full rounded-lg border border-white bg-zinc-700 px-3 py-2 text-white shadow-sm focus:border-blue-600 focus:outline-none focus:ring-blue-600",
|
|
onChange: (value) => {
|
|
return dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
runwayCondition: value
|
|
}))
|
|
);
|
|
},
|
|
options: runwayConditions.map((setting) => {
|
|
return {
|
|
value: setting.value,
|
|
label: setting.label
|
|
};
|
|
})
|
|
}
|
|
) })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Wind" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-1/2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
Input,
|
|
{
|
|
type: "text",
|
|
placeholder: "---/--",
|
|
className: `${windSpeed >= 0 && windDirection >= 0 || windSpeed === -1 && windDirection === -1 ? "border-white" : "border-red-500"} w-1/2 rounded-l-lg border bg-zinc-700 px-3 py-2 text-left focus:border-blue-600 focus:ring-blue-600`,
|
|
value: windString,
|
|
onChange: (value) => {
|
|
const wind = value.split("/");
|
|
if (wind.length !== 2) {
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
windString: value,
|
|
windDirection: -1,
|
|
windSpeed: -1
|
|
})
|
|
}))
|
|
);
|
|
return;
|
|
}
|
|
const speed = parseInt(wind[1]);
|
|
const direction = parseInt(wind[0]);
|
|
if (isNaN(speed) || isNaN(direction) || direction < 0 && direction > 360 || speed < 0 && speed > 99) {
|
|
if (isNaN(speed) || speed < 0 && speed > 99) {
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
windSpeed: -1
|
|
})
|
|
}))
|
|
);
|
|
}
|
|
if (isNaN(direction) || direction < 0 && direction > 360) {
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
windDirection: -1
|
|
})
|
|
}))
|
|
);
|
|
}
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
decelDistance: -1,
|
|
performance: {
|
|
vapp: -1,
|
|
vref: -1
|
|
},
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
windString: value
|
|
})
|
|
}))
|
|
);
|
|
return;
|
|
}
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
windString: value,
|
|
windSpeed: speed,
|
|
windDirection: direction
|
|
})
|
|
}))
|
|
);
|
|
},
|
|
onBlur: () => {
|
|
if (windSpeed > -1 && windDirection > -1)
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
windString: windDirection.toString().padStart(
|
|
3,
|
|
"0"
|
|
) + "/" + windSpeed.toString()
|
|
})
|
|
}))
|
|
);
|
|
}
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
"div",
|
|
{
|
|
className: `${windComponent.speed < -10 ? "text-red-400" : "text-white"} flex w-1/2 items-center justify-center rounded-r-lg border border-white bg-zinc-600 px-2`,
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "mr-2", children: windComponent.headwind ? "Tailwind" : "Headwind" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
|
|
Math.abs(
|
|
Math.round(windComponent.speed)
|
|
),
|
|
"KT"
|
|
] })
|
|
]
|
|
}
|
|
)
|
|
] })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-between bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Temperature" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-1/2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
Input,
|
|
{
|
|
type: "number",
|
|
placeholder: "--",
|
|
className: `${temperature !== -200 ? "border-white" : "border-red-500"} w-full rounded-l-lg border bg-zinc-700 px-3 py-2 text-left focus:border-blue-600 focus:ring-blue-600`,
|
|
value: temperature === -200 ? "" : temperature,
|
|
onChange: (value) => {
|
|
const temperature2 = parseInt(value);
|
|
if (isNaN(temperature2)) {
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
decelDistance: -1,
|
|
performance: {
|
|
vapp: -1,
|
|
vref: -1
|
|
},
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
temperature: -200
|
|
})
|
|
}))
|
|
);
|
|
return;
|
|
}
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
temperature: temperature2
|
|
})
|
|
}))
|
|
);
|
|
}
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center rounded-r-lg border border-white bg-zinc-600 px-2", children: [
|
|
"\xB0",
|
|
planeConfig.options.general.temperatureUnits.toUpperCase()
|
|
] })
|
|
] })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Pressure" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-1/2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
Input,
|
|
{
|
|
type: "number",
|
|
placeholder: airport && (airport.icao.startsWith("K") || airport.icao.startsWith("RJ") || airport.icao.startsWith("C")) ? "--.--" : "----",
|
|
min: 0,
|
|
max: 1100,
|
|
className: `${qnh === 0 ? "border-red-500" : "border-white"} w-3/4 rounded-l-lg border bg-zinc-700 px-3 py-2 text-left focus:border-blue-600 focus:ring-blue-600`,
|
|
value: qnh === 0 ? "" : airport && (airport.icao.startsWith("K") || airport.icao.startsWith(
|
|
"RJ"
|
|
) || airport.icao.startsWith(
|
|
"C"
|
|
)) ? qnh.toFixed(2) : qnh,
|
|
onChange: (value) => {
|
|
const pressure = parseFloat(value);
|
|
if (isNaN(pressure)) {
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
decelDistance: -1,
|
|
performance: {
|
|
vapp: -1,
|
|
vref: -1
|
|
},
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
pressure: 0
|
|
})
|
|
}))
|
|
);
|
|
return;
|
|
}
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
weather: __spreadProps(__spreadValues({}, config3.weather), {
|
|
pressure
|
|
})
|
|
}))
|
|
);
|
|
}
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex w-1/4 items-center justify-center rounded-r-lg border border-white bg-zinc-600 px-2", children: airport && (airport.icao.startsWith("K") || airport.icao.startsWith("RJ") || airport.icao.startsWith("C")) ? "inHg" : "hPA" })
|
|
] })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
"button",
|
|
{
|
|
className: "text-2xs w-full rounded-b-lg bg-blue-700 px-6 py-3 font-sans font-bold uppercase text-white shadow-md shadow-blue-500/20 transition-all hover:shadow-lg hover:shadow-blue-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
onClick: async () => {
|
|
if (airport) {
|
|
const data = await getMETAR(airport.icao);
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
weather: {
|
|
windString: data.wdir === "VRB" ? "000" : data.wdir.toString().padStart(3, "0") + "/" + data.wspd.toString(),
|
|
windDirection: data.wdir === "VRB" ? 0 : parseInt(data.wdir),
|
|
windSpeed: data.wspd,
|
|
temperature: Math.round(data.temp),
|
|
pressure: airport.icao.startsWith("K") || airport.icao.startsWith("RJ") || airport.icao.startsWith("C") ? Math.round(
|
|
data.altim * 0.02953 * 100
|
|
) / 100 : Math.round(data.altim)
|
|
}
|
|
}))
|
|
);
|
|
}
|
|
},
|
|
children: "Get weather information"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("h2", { className: "my-2 text-center text-base font-bold", children: "Aircraft" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Landing Weight" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-1/2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
Input,
|
|
{
|
|
type: "number",
|
|
placeholder: "-----",
|
|
className: `${landingWeight !== -1 ? "border-white" : "border-red-500"} w-full rounded-l-lg border bg-zinc-700 px-3 py-2 text-left focus:border-blue-600 focus:ring-blue-600`,
|
|
value: landingWeight === -1 ? "" : landingWeight,
|
|
onChange: (value) => {
|
|
if (value.length === 0) {
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
decelDistance: -1,
|
|
performance: {
|
|
vapp: -1,
|
|
vref: -1
|
|
},
|
|
lw: -1
|
|
}))
|
|
);
|
|
return;
|
|
}
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
lw: parseFloat(value)
|
|
}))
|
|
);
|
|
}
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center rounded-r-lg border border-white bg-zinc-600 px-2", children: isMetric ? "kg" : "lb" })
|
|
] })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Autobrake" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
Select,
|
|
{
|
|
className: "w-full rounded-lg border border-white bg-zinc-700 px-3 py-2 text-white shadow-sm focus:border-blue-600 focus:outline-none focus:ring-blue-600",
|
|
onChange: (value) => {
|
|
return dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
autobrake: value
|
|
}))
|
|
);
|
|
},
|
|
options: autobrakeSettings.map(
|
|
(setting) => {
|
|
return {
|
|
value: setting.value,
|
|
label: setting.label
|
|
};
|
|
}
|
|
)
|
|
}
|
|
) })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-between bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Reversers" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
Select,
|
|
{
|
|
className: "w-full rounded-lg border border-white bg-zinc-700 px-3 py-2 text-white shadow-sm focus:border-blue-600 focus:outline-none focus:ring-blue-600",
|
|
onChange: (value) => {
|
|
return dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
reversers: value
|
|
}))
|
|
);
|
|
},
|
|
options: reverseThrustSettings.map(
|
|
(setting) => {
|
|
return {
|
|
value: setting.value,
|
|
label: setting.label
|
|
};
|
|
}
|
|
)
|
|
}
|
|
) })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Flaps" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
"div",
|
|
{
|
|
className: "inline-flex w-1/2 rounded-md shadow-sm",
|
|
role: "group",
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${!config3.flaps50 ? "bg-green-700" : "bg-zinc-700"} w-1/2 rounded-l-lg border border-white px-4 py-2 text-white`,
|
|
onClick: () => {
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
flaps50: false
|
|
}))
|
|
);
|
|
},
|
|
children: "35"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${config3.flaps50 ? "bg-green-700" : "bg-zinc-700"} w-1/2 rounded-r-md border border-white px-4 py-2 text-white`,
|
|
onClick: () => {
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
flaps50: true
|
|
}))
|
|
);
|
|
},
|
|
children: "50"
|
|
}
|
|
)
|
|
]
|
|
}
|
|
)
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
"button",
|
|
{
|
|
className: "text-2xs w-full rounded-b-lg bg-blue-700 px-6 py-3 font-sans font-bold uppercase text-white shadow-md shadow-blue-500/20 transition-all hover:shadow-lg hover:shadow-blue-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
onClick: async () => {
|
|
const api2 = await lib();
|
|
const lw = await api2.getEFBVariable("PRED_LW");
|
|
dispatch(
|
|
setArrival(__spreadProps(__spreadValues({}, config3), {
|
|
lw: Math.round(
|
|
isMetric ? lw * 0.453592 : lw
|
|
)
|
|
}))
|
|
);
|
|
},
|
|
children: "Get Landing Weight"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mb-6 ml-8 flex flex-col gap-y-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "relative mx-auto h-full w-1/4 flex-grow border-2 bg-zinc-700", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
"div",
|
|
{
|
|
className: `${config3.canLand ? "bg-white" : "bg-red-400"} absolute bottom-0 left-0 w-full opacity-50`,
|
|
style: {
|
|
height: `${config3.decelDistance !== -1 ? config3.decelDistance * 3.28084 / runway.length * 100 : 0}%`
|
|
}
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "absolute bottom-0 left-0 h-1/4 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex h-full flex-col justify-center px-2 pb-5", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-center text-lg font-bold", children: runway ? runway.ident : "XX" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex h-full flex-grow justify-between gap-x-2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "h-full w-1/12 bg-white" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "h-full w-1/12 bg-white" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "h-full w-1/12 bg-white" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "h-full w-1/12 bg-white" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "h-full w-1/12 bg-transparent" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "h-full w-1/12 bg-white" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "h-full w-1/12 bg-white" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "h-full w-1/12 bg-white" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "h-full w-1/12 bg-white" })
|
|
] })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "absolute left-0 top-0 h-3/4 w-full p-4", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex h-full flex-col justify-between gap-y-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mx-auto h-1/6 w-1 bg-zinc-400" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mx-auto h-1/6 w-1 bg-zinc-400" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mx-auto h-1/6 w-1 bg-zinc-400" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mx-auto h-1/6 w-1 bg-zinc-400" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mx-auto h-1/6 w-1 bg-zinc-400" })
|
|
] }) })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
"button",
|
|
{
|
|
disabled: !isAbleToCalculate,
|
|
className: "text-2xs rounded-lg bg-green-700 px-6 py-3 font-sans font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
onClick: async () => {
|
|
const api2 = await lib();
|
|
dispatch(
|
|
setArrivalPerformance({
|
|
vapp: api2.getEFBVariable("VAPP"),
|
|
vref: api2.getEFBVariable("VREF")
|
|
})
|
|
);
|
|
calculate();
|
|
},
|
|
children: "Calculate"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex justify-between", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
"div",
|
|
{
|
|
className: `${config3.canLand ? "text-white" : "text-red-400"} py-2 text-center`,
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "mb-2 text-xs", children: "Estimated Landing Distance" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { className: "text-lg font-bold", children: [
|
|
Number.isNaN(decelDistance) ? "N/A" : decelDistance === -1 ? "----" : isMetric ? Math.round(decelDistance) : Math.round(decelDistance * 3.28084),
|
|
isMetric ? "m" : "ft"
|
|
] })
|
|
]
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-1 border-l-2 border-white" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "py-2 text-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "mb-2 text-xs", children: "Stop Distance Available" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { className: "text-lg font-bold", children: [
|
|
runway ? Math.round(
|
|
(runway.length - runway.length * 0.15) * (isMetric ? 0.3048 : 1)
|
|
) : "----",
|
|
isMetric ? "m" : "ft"
|
|
] })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-1 border-l-2 border-white" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "py-2 text-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "mb-2 text-xs", children: "Landing Distance Available" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { className: "text-lg font-bold", children: [
|
|
runway ? Math.round(
|
|
(runway.length - runway.length * 0.15 + 300) * (isMetric ? 0.3048 : 1)
|
|
) : "----",
|
|
isMetric ? "m" : "ft"
|
|
] })
|
|
] })
|
|
] })
|
|
] })
|
|
] }) });
|
|
}
|
|
|
|
// src/routes/PerformancePage.tsx
|
|
var import_jsx_runtime8 = __toESM(require_jsx_runtime());
|
|
function PerformancePage() {
|
|
const dispatch = useDispatch();
|
|
const [isOnGround, setIsOnGround] = (0, import_react8.useState)(false);
|
|
(0, import_react8.useEffect)(() => {
|
|
async function getIsOnGround() {
|
|
const api2 = await lib();
|
|
setIsOnGround(
|
|
api2.getSimulatorVariable("A:SIM ON GROUND", "bool") != 0
|
|
);
|
|
}
|
|
getIsOnGround();
|
|
dispatch(getPlaneConfig());
|
|
});
|
|
return isOnGround ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DeparturePerformance, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ArrivalPerf, {});
|
|
}
|
|
|
|
// src/routes/ChartPage.tsx
|
|
var import_react10 = __toESM(require_react());
|
|
|
|
// node_modules/qrcode.react/lib/esm/index.js
|
|
var import_react9 = __toESM(require_react());
|
|
var __defProp2 = Object.defineProperty;
|
|
var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues2 = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp2.call(b, prop))
|
|
__defNormalProp2(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols2)
|
|
for (var prop of __getOwnPropSymbols2(b)) {
|
|
if (__propIsEnum2.call(b, prop))
|
|
__defNormalProp2(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __objRest2 = (source, exclude) => {
|
|
var target = {};
|
|
for (var prop in source)
|
|
if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
target[prop] = source[prop];
|
|
if (source != null && __getOwnPropSymbols2)
|
|
for (var prop of __getOwnPropSymbols2(source)) {
|
|
if (exclude.indexOf(prop) < 0 && __propIsEnum2.call(source, prop))
|
|
target[prop] = source[prop];
|
|
}
|
|
return target;
|
|
};
|
|
var qrcodegen;
|
|
((qrcodegen2) => {
|
|
const _QrCode = class {
|
|
constructor(version, errorCorrectionLevel, dataCodewords, msk) {
|
|
this.version = version;
|
|
this.errorCorrectionLevel = errorCorrectionLevel;
|
|
this.modules = [];
|
|
this.isFunction = [];
|
|
if (version < _QrCode.MIN_VERSION || version > _QrCode.MAX_VERSION)
|
|
throw new RangeError("Version value out of range");
|
|
if (msk < -1 || msk > 7)
|
|
throw new RangeError("Mask value out of range");
|
|
this.size = version * 4 + 17;
|
|
let row = [];
|
|
for (let i = 0; i < this.size; i++)
|
|
row.push(false);
|
|
for (let i = 0; i < this.size; i++) {
|
|
this.modules.push(row.slice());
|
|
this.isFunction.push(row.slice());
|
|
}
|
|
this.drawFunctionPatterns();
|
|
const allCodewords = this.addEccAndInterleave(dataCodewords);
|
|
this.drawCodewords(allCodewords);
|
|
if (msk == -1) {
|
|
let minPenalty = 1e9;
|
|
for (let i = 0; i < 8; i++) {
|
|
this.applyMask(i);
|
|
this.drawFormatBits(i);
|
|
const penalty = this.getPenaltyScore();
|
|
if (penalty < minPenalty) {
|
|
msk = i;
|
|
minPenalty = penalty;
|
|
}
|
|
this.applyMask(i);
|
|
}
|
|
}
|
|
assert(0 <= msk && msk <= 7);
|
|
this.mask = msk;
|
|
this.applyMask(msk);
|
|
this.drawFormatBits(msk);
|
|
this.isFunction = [];
|
|
}
|
|
static encodeText(text2, ecl) {
|
|
const segs = qrcodegen2.QrSegment.makeSegments(text2);
|
|
return _QrCode.encodeSegments(segs, ecl);
|
|
}
|
|
static encodeBinary(data, ecl) {
|
|
const seg = qrcodegen2.QrSegment.makeBytes(data);
|
|
return _QrCode.encodeSegments([seg], ecl);
|
|
}
|
|
static encodeSegments(segs, ecl, minVersion = 1, maxVersion = 40, mask = -1, boostEcl = true) {
|
|
if (!(_QrCode.MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= _QrCode.MAX_VERSION) || mask < -1 || mask > 7)
|
|
throw new RangeError("Invalid value");
|
|
let version;
|
|
let dataUsedBits;
|
|
for (version = minVersion; ; version++) {
|
|
const dataCapacityBits2 = _QrCode.getNumDataCodewords(version, ecl) * 8;
|
|
const usedBits = QrSegment.getTotalBits(segs, version);
|
|
if (usedBits <= dataCapacityBits2) {
|
|
dataUsedBits = usedBits;
|
|
break;
|
|
}
|
|
if (version >= maxVersion)
|
|
throw new RangeError("Data too long");
|
|
}
|
|
for (const newEcl of [_QrCode.Ecc.MEDIUM, _QrCode.Ecc.QUARTILE, _QrCode.Ecc.HIGH]) {
|
|
if (boostEcl && dataUsedBits <= _QrCode.getNumDataCodewords(version, newEcl) * 8)
|
|
ecl = newEcl;
|
|
}
|
|
let bb = [];
|
|
for (const seg of segs) {
|
|
appendBits(seg.mode.modeBits, 4, bb);
|
|
appendBits(seg.numChars, seg.mode.numCharCountBits(version), bb);
|
|
for (const b of seg.getData())
|
|
bb.push(b);
|
|
}
|
|
assert(bb.length == dataUsedBits);
|
|
const dataCapacityBits = _QrCode.getNumDataCodewords(version, ecl) * 8;
|
|
assert(bb.length <= dataCapacityBits);
|
|
appendBits(0, Math.min(4, dataCapacityBits - bb.length), bb);
|
|
appendBits(0, (8 - bb.length % 8) % 8, bb);
|
|
assert(bb.length % 8 == 0);
|
|
for (let padByte = 236; bb.length < dataCapacityBits; padByte ^= 236 ^ 17)
|
|
appendBits(padByte, 8, bb);
|
|
let dataCodewords = [];
|
|
while (dataCodewords.length * 8 < bb.length)
|
|
dataCodewords.push(0);
|
|
bb.forEach((b, i) => dataCodewords[i >>> 3] |= b << 7 - (i & 7));
|
|
return new _QrCode(version, ecl, dataCodewords, mask);
|
|
}
|
|
getModule(x, y) {
|
|
return 0 <= x && x < this.size && 0 <= y && y < this.size && this.modules[y][x];
|
|
}
|
|
getModules() {
|
|
return this.modules;
|
|
}
|
|
drawFunctionPatterns() {
|
|
for (let i = 0; i < this.size; i++) {
|
|
this.setFunctionModule(6, i, i % 2 == 0);
|
|
this.setFunctionModule(i, 6, i % 2 == 0);
|
|
}
|
|
this.drawFinderPattern(3, 3);
|
|
this.drawFinderPattern(this.size - 4, 3);
|
|
this.drawFinderPattern(3, this.size - 4);
|
|
const alignPatPos = this.getAlignmentPatternPositions();
|
|
const numAlign = alignPatPos.length;
|
|
for (let i = 0; i < numAlign; i++) {
|
|
for (let j = 0; j < numAlign; j++) {
|
|
if (!(i == 0 && j == 0 || i == 0 && j == numAlign - 1 || i == numAlign - 1 && j == 0))
|
|
this.drawAlignmentPattern(alignPatPos[i], alignPatPos[j]);
|
|
}
|
|
}
|
|
this.drawFormatBits(0);
|
|
this.drawVersion();
|
|
}
|
|
drawFormatBits(mask) {
|
|
const data = this.errorCorrectionLevel.formatBits << 3 | mask;
|
|
let rem = data;
|
|
for (let i = 0; i < 10; i++)
|
|
rem = rem << 1 ^ (rem >>> 9) * 1335;
|
|
const bits = (data << 10 | rem) ^ 21522;
|
|
assert(bits >>> 15 == 0);
|
|
for (let i = 0; i <= 5; i++)
|
|
this.setFunctionModule(8, i, getBit(bits, i));
|
|
this.setFunctionModule(8, 7, getBit(bits, 6));
|
|
this.setFunctionModule(8, 8, getBit(bits, 7));
|
|
this.setFunctionModule(7, 8, getBit(bits, 8));
|
|
for (let i = 9; i < 15; i++)
|
|
this.setFunctionModule(14 - i, 8, getBit(bits, i));
|
|
for (let i = 0; i < 8; i++)
|
|
this.setFunctionModule(this.size - 1 - i, 8, getBit(bits, i));
|
|
for (let i = 8; i < 15; i++)
|
|
this.setFunctionModule(8, this.size - 15 + i, getBit(bits, i));
|
|
this.setFunctionModule(8, this.size - 8, true);
|
|
}
|
|
drawVersion() {
|
|
if (this.version < 7)
|
|
return;
|
|
let rem = this.version;
|
|
for (let i = 0; i < 12; i++)
|
|
rem = rem << 1 ^ (rem >>> 11) * 7973;
|
|
const bits = this.version << 12 | rem;
|
|
assert(bits >>> 18 == 0);
|
|
for (let i = 0; i < 18; i++) {
|
|
const color = getBit(bits, i);
|
|
const a = this.size - 11 + i % 3;
|
|
const b = Math.floor(i / 3);
|
|
this.setFunctionModule(a, b, color);
|
|
this.setFunctionModule(b, a, color);
|
|
}
|
|
}
|
|
drawFinderPattern(x, y) {
|
|
for (let dy = -4; dy <= 4; dy++) {
|
|
for (let dx = -4; dx <= 4; dx++) {
|
|
const dist = Math.max(Math.abs(dx), Math.abs(dy));
|
|
const xx = x + dx;
|
|
const yy = y + dy;
|
|
if (0 <= xx && xx < this.size && 0 <= yy && yy < this.size)
|
|
this.setFunctionModule(xx, yy, dist != 2 && dist != 4);
|
|
}
|
|
}
|
|
}
|
|
drawAlignmentPattern(x, y) {
|
|
for (let dy = -2; dy <= 2; dy++) {
|
|
for (let dx = -2; dx <= 2; dx++)
|
|
this.setFunctionModule(x + dx, y + dy, Math.max(Math.abs(dx), Math.abs(dy)) != 1);
|
|
}
|
|
}
|
|
setFunctionModule(x, y, isDark) {
|
|
this.modules[y][x] = isDark;
|
|
this.isFunction[y][x] = true;
|
|
}
|
|
addEccAndInterleave(data) {
|
|
const ver = this.version;
|
|
const ecl = this.errorCorrectionLevel;
|
|
if (data.length != _QrCode.getNumDataCodewords(ver, ecl))
|
|
throw new RangeError("Invalid argument");
|
|
const numBlocks = _QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
|
|
const blockEccLen = _QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver];
|
|
const rawCodewords = Math.floor(_QrCode.getNumRawDataModules(ver) / 8);
|
|
const numShortBlocks = numBlocks - rawCodewords % numBlocks;
|
|
const shortBlockLen = Math.floor(rawCodewords / numBlocks);
|
|
let blocks = [];
|
|
const rsDiv = _QrCode.reedSolomonComputeDivisor(blockEccLen);
|
|
for (let i = 0, k = 0; i < numBlocks; i++) {
|
|
let dat = data.slice(k, k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1));
|
|
k += dat.length;
|
|
const ecc = _QrCode.reedSolomonComputeRemainder(dat, rsDiv);
|
|
if (i < numShortBlocks)
|
|
dat.push(0);
|
|
blocks.push(dat.concat(ecc));
|
|
}
|
|
let result = [];
|
|
for (let i = 0; i < blocks[0].length; i++) {
|
|
blocks.forEach((block, j) => {
|
|
if (i != shortBlockLen - blockEccLen || j >= numShortBlocks)
|
|
result.push(block[i]);
|
|
});
|
|
}
|
|
assert(result.length == rawCodewords);
|
|
return result;
|
|
}
|
|
drawCodewords(data) {
|
|
if (data.length != Math.floor(_QrCode.getNumRawDataModules(this.version) / 8))
|
|
throw new RangeError("Invalid argument");
|
|
let i = 0;
|
|
for (let right = this.size - 1; right >= 1; right -= 2) {
|
|
if (right == 6)
|
|
right = 5;
|
|
for (let vert = 0; vert < this.size; vert++) {
|
|
for (let j = 0; j < 2; j++) {
|
|
const x = right - j;
|
|
const upward = (right + 1 & 2) == 0;
|
|
const y = upward ? this.size - 1 - vert : vert;
|
|
if (!this.isFunction[y][x] && i < data.length * 8) {
|
|
this.modules[y][x] = getBit(data[i >>> 3], 7 - (i & 7));
|
|
i++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
assert(i == data.length * 8);
|
|
}
|
|
applyMask(mask) {
|
|
if (mask < 0 || mask > 7)
|
|
throw new RangeError("Mask value out of range");
|
|
for (let y = 0; y < this.size; y++) {
|
|
for (let x = 0; x < this.size; x++) {
|
|
let invert;
|
|
switch (mask) {
|
|
case 0:
|
|
invert = (x + y) % 2 == 0;
|
|
break;
|
|
case 1:
|
|
invert = y % 2 == 0;
|
|
break;
|
|
case 2:
|
|
invert = x % 3 == 0;
|
|
break;
|
|
case 3:
|
|
invert = (x + y) % 3 == 0;
|
|
break;
|
|
case 4:
|
|
invert = (Math.floor(x / 3) + Math.floor(y / 2)) % 2 == 0;
|
|
break;
|
|
case 5:
|
|
invert = x * y % 2 + x * y % 3 == 0;
|
|
break;
|
|
case 6:
|
|
invert = (x * y % 2 + x * y % 3) % 2 == 0;
|
|
break;
|
|
case 7:
|
|
invert = ((x + y) % 2 + x * y % 3) % 2 == 0;
|
|
break;
|
|
default:
|
|
throw new Error("Unreachable");
|
|
}
|
|
if (!this.isFunction[y][x] && invert)
|
|
this.modules[y][x] = !this.modules[y][x];
|
|
}
|
|
}
|
|
}
|
|
getPenaltyScore() {
|
|
let result = 0;
|
|
for (let y = 0; y < this.size; y++) {
|
|
let runColor = false;
|
|
let runX = 0;
|
|
let runHistory = [0, 0, 0, 0, 0, 0, 0];
|
|
for (let x = 0; x < this.size; x++) {
|
|
if (this.modules[y][x] == runColor) {
|
|
runX++;
|
|
if (runX == 5)
|
|
result += _QrCode.PENALTY_N1;
|
|
else if (runX > 5)
|
|
result++;
|
|
} else {
|
|
this.finderPenaltyAddHistory(runX, runHistory);
|
|
if (!runColor)
|
|
result += this.finderPenaltyCountPatterns(runHistory) * _QrCode.PENALTY_N3;
|
|
runColor = this.modules[y][x];
|
|
runX = 1;
|
|
}
|
|
}
|
|
result += this.finderPenaltyTerminateAndCount(runColor, runX, runHistory) * _QrCode.PENALTY_N3;
|
|
}
|
|
for (let x = 0; x < this.size; x++) {
|
|
let runColor = false;
|
|
let runY = 0;
|
|
let runHistory = [0, 0, 0, 0, 0, 0, 0];
|
|
for (let y = 0; y < this.size; y++) {
|
|
if (this.modules[y][x] == runColor) {
|
|
runY++;
|
|
if (runY == 5)
|
|
result += _QrCode.PENALTY_N1;
|
|
else if (runY > 5)
|
|
result++;
|
|
} else {
|
|
this.finderPenaltyAddHistory(runY, runHistory);
|
|
if (!runColor)
|
|
result += this.finderPenaltyCountPatterns(runHistory) * _QrCode.PENALTY_N3;
|
|
runColor = this.modules[y][x];
|
|
runY = 1;
|
|
}
|
|
}
|
|
result += this.finderPenaltyTerminateAndCount(runColor, runY, runHistory) * _QrCode.PENALTY_N3;
|
|
}
|
|
for (let y = 0; y < this.size - 1; y++) {
|
|
for (let x = 0; x < this.size - 1; x++) {
|
|
const color = this.modules[y][x];
|
|
if (color == this.modules[y][x + 1] && color == this.modules[y + 1][x] && color == this.modules[y + 1][x + 1])
|
|
result += _QrCode.PENALTY_N2;
|
|
}
|
|
}
|
|
let dark = 0;
|
|
for (const row of this.modules)
|
|
dark = row.reduce((sum, color) => sum + (color ? 1 : 0), dark);
|
|
const total = this.size * this.size;
|
|
const k = Math.ceil(Math.abs(dark * 20 - total * 10) / total) - 1;
|
|
assert(0 <= k && k <= 9);
|
|
result += k * _QrCode.PENALTY_N4;
|
|
assert(0 <= result && result <= 2568888);
|
|
return result;
|
|
}
|
|
getAlignmentPatternPositions() {
|
|
if (this.version == 1)
|
|
return [];
|
|
else {
|
|
const numAlign = Math.floor(this.version / 7) + 2;
|
|
const step = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (numAlign * 2 - 2)) * 2;
|
|
let result = [6];
|
|
for (let pos = this.size - 7; result.length < numAlign; pos -= step)
|
|
result.splice(1, 0, pos);
|
|
return result;
|
|
}
|
|
}
|
|
static getNumRawDataModules(ver) {
|
|
if (ver < _QrCode.MIN_VERSION || ver > _QrCode.MAX_VERSION)
|
|
throw new RangeError("Version number out of range");
|
|
let result = (16 * ver + 128) * ver + 64;
|
|
if (ver >= 2) {
|
|
const numAlign = Math.floor(ver / 7) + 2;
|
|
result -= (25 * numAlign - 10) * numAlign - 55;
|
|
if (ver >= 7)
|
|
result -= 36;
|
|
}
|
|
assert(208 <= result && result <= 29648);
|
|
return result;
|
|
}
|
|
static getNumDataCodewords(ver, ecl) {
|
|
return Math.floor(_QrCode.getNumRawDataModules(ver) / 8) - _QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] * _QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver];
|
|
}
|
|
static reedSolomonComputeDivisor(degree) {
|
|
if (degree < 1 || degree > 255)
|
|
throw new RangeError("Degree out of range");
|
|
let result = [];
|
|
for (let i = 0; i < degree - 1; i++)
|
|
result.push(0);
|
|
result.push(1);
|
|
let root = 1;
|
|
for (let i = 0; i < degree; i++) {
|
|
for (let j = 0; j < result.length; j++) {
|
|
result[j] = _QrCode.reedSolomonMultiply(result[j], root);
|
|
if (j + 1 < result.length)
|
|
result[j] ^= result[j + 1];
|
|
}
|
|
root = _QrCode.reedSolomonMultiply(root, 2);
|
|
}
|
|
return result;
|
|
}
|
|
static reedSolomonComputeRemainder(data, divisor) {
|
|
let result = divisor.map((_) => 0);
|
|
for (const b of data) {
|
|
const factor = b ^ result.shift();
|
|
result.push(0);
|
|
divisor.forEach((coef, i) => result[i] ^= _QrCode.reedSolomonMultiply(coef, factor));
|
|
}
|
|
return result;
|
|
}
|
|
static reedSolomonMultiply(x, y) {
|
|
if (x >>> 8 != 0 || y >>> 8 != 0)
|
|
throw new RangeError("Byte out of range");
|
|
let z = 0;
|
|
for (let i = 7; i >= 0; i--) {
|
|
z = z << 1 ^ (z >>> 7) * 285;
|
|
z ^= (y >>> i & 1) * x;
|
|
}
|
|
assert(z >>> 8 == 0);
|
|
return z;
|
|
}
|
|
finderPenaltyCountPatterns(runHistory) {
|
|
const n = runHistory[1];
|
|
assert(n <= this.size * 3);
|
|
const core = n > 0 && runHistory[2] == n && runHistory[3] == n * 3 && runHistory[4] == n && runHistory[5] == n;
|
|
return (core && runHistory[0] >= n * 4 && runHistory[6] >= n ? 1 : 0) + (core && runHistory[6] >= n * 4 && runHistory[0] >= n ? 1 : 0);
|
|
}
|
|
finderPenaltyTerminateAndCount(currentRunColor, currentRunLength, runHistory) {
|
|
if (currentRunColor) {
|
|
this.finderPenaltyAddHistory(currentRunLength, runHistory);
|
|
currentRunLength = 0;
|
|
}
|
|
currentRunLength += this.size;
|
|
this.finderPenaltyAddHistory(currentRunLength, runHistory);
|
|
return this.finderPenaltyCountPatterns(runHistory);
|
|
}
|
|
finderPenaltyAddHistory(currentRunLength, runHistory) {
|
|
if (runHistory[0] == 0)
|
|
currentRunLength += this.size;
|
|
runHistory.pop();
|
|
runHistory.unshift(currentRunLength);
|
|
}
|
|
};
|
|
let QrCode = _QrCode;
|
|
QrCode.MIN_VERSION = 1;
|
|
QrCode.MAX_VERSION = 40;
|
|
QrCode.PENALTY_N1 = 3;
|
|
QrCode.PENALTY_N2 = 3;
|
|
QrCode.PENALTY_N3 = 40;
|
|
QrCode.PENALTY_N4 = 10;
|
|
QrCode.ECC_CODEWORDS_PER_BLOCK = [
|
|
[-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
|
|
[-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28],
|
|
[-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30],
|
|
[-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30]
|
|
];
|
|
QrCode.NUM_ERROR_CORRECTION_BLOCKS = [
|
|
[-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25],
|
|
[-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49],
|
|
[-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68],
|
|
[-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81]
|
|
];
|
|
qrcodegen2.QrCode = QrCode;
|
|
function appendBits(val, len, bb) {
|
|
if (len < 0 || len > 31 || val >>> len != 0)
|
|
throw new RangeError("Value out of range");
|
|
for (let i = len - 1; i >= 0; i--)
|
|
bb.push(val >>> i & 1);
|
|
}
|
|
function getBit(x, i) {
|
|
return (x >>> i & 1) != 0;
|
|
}
|
|
function assert(cond) {
|
|
if (!cond)
|
|
throw new Error("Assertion error");
|
|
}
|
|
const _QrSegment = class {
|
|
constructor(mode, numChars, bitData) {
|
|
this.mode = mode;
|
|
this.numChars = numChars;
|
|
this.bitData = bitData;
|
|
if (numChars < 0)
|
|
throw new RangeError("Invalid argument");
|
|
this.bitData = bitData.slice();
|
|
}
|
|
static makeBytes(data) {
|
|
let bb = [];
|
|
for (const b of data)
|
|
appendBits(b, 8, bb);
|
|
return new _QrSegment(_QrSegment.Mode.BYTE, data.length, bb);
|
|
}
|
|
static makeNumeric(digits) {
|
|
if (!_QrSegment.isNumeric(digits))
|
|
throw new RangeError("String contains non-numeric characters");
|
|
let bb = [];
|
|
for (let i = 0; i < digits.length; ) {
|
|
const n = Math.min(digits.length - i, 3);
|
|
appendBits(parseInt(digits.substr(i, n), 10), n * 3 + 1, bb);
|
|
i += n;
|
|
}
|
|
return new _QrSegment(_QrSegment.Mode.NUMERIC, digits.length, bb);
|
|
}
|
|
static makeAlphanumeric(text2) {
|
|
if (!_QrSegment.isAlphanumeric(text2))
|
|
throw new RangeError("String contains unencodable characters in alphanumeric mode");
|
|
let bb = [];
|
|
let i;
|
|
for (i = 0; i + 2 <= text2.length; i += 2) {
|
|
let temp = _QrSegment.ALPHANUMERIC_CHARSET.indexOf(text2.charAt(i)) * 45;
|
|
temp += _QrSegment.ALPHANUMERIC_CHARSET.indexOf(text2.charAt(i + 1));
|
|
appendBits(temp, 11, bb);
|
|
}
|
|
if (i < text2.length)
|
|
appendBits(_QrSegment.ALPHANUMERIC_CHARSET.indexOf(text2.charAt(i)), 6, bb);
|
|
return new _QrSegment(_QrSegment.Mode.ALPHANUMERIC, text2.length, bb);
|
|
}
|
|
static makeSegments(text2) {
|
|
if (text2 == "")
|
|
return [];
|
|
else if (_QrSegment.isNumeric(text2))
|
|
return [_QrSegment.makeNumeric(text2)];
|
|
else if (_QrSegment.isAlphanumeric(text2))
|
|
return [_QrSegment.makeAlphanumeric(text2)];
|
|
else
|
|
return [_QrSegment.makeBytes(_QrSegment.toUtf8ByteArray(text2))];
|
|
}
|
|
static makeEci(assignVal) {
|
|
let bb = [];
|
|
if (assignVal < 0)
|
|
throw new RangeError("ECI assignment value out of range");
|
|
else if (assignVal < 1 << 7)
|
|
appendBits(assignVal, 8, bb);
|
|
else if (assignVal < 1 << 14) {
|
|
appendBits(2, 2, bb);
|
|
appendBits(assignVal, 14, bb);
|
|
} else if (assignVal < 1e6) {
|
|
appendBits(6, 3, bb);
|
|
appendBits(assignVal, 21, bb);
|
|
} else
|
|
throw new RangeError("ECI assignment value out of range");
|
|
return new _QrSegment(_QrSegment.Mode.ECI, 0, bb);
|
|
}
|
|
static isNumeric(text2) {
|
|
return _QrSegment.NUMERIC_REGEX.test(text2);
|
|
}
|
|
static isAlphanumeric(text2) {
|
|
return _QrSegment.ALPHANUMERIC_REGEX.test(text2);
|
|
}
|
|
getData() {
|
|
return this.bitData.slice();
|
|
}
|
|
static getTotalBits(segs, version) {
|
|
let result = 0;
|
|
for (const seg of segs) {
|
|
const ccbits = seg.mode.numCharCountBits(version);
|
|
if (seg.numChars >= 1 << ccbits)
|
|
return Infinity;
|
|
result += 4 + ccbits + seg.bitData.length;
|
|
}
|
|
return result;
|
|
}
|
|
static toUtf8ByteArray(str) {
|
|
str = encodeURI(str);
|
|
let result = [];
|
|
for (let i = 0; i < str.length; i++) {
|
|
if (str.charAt(i) != "%")
|
|
result.push(str.charCodeAt(i));
|
|
else {
|
|
result.push(parseInt(str.substr(i + 1, 2), 16));
|
|
i += 2;
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
};
|
|
let QrSegment = _QrSegment;
|
|
QrSegment.NUMERIC_REGEX = /^[0-9]*$/;
|
|
QrSegment.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/;
|
|
QrSegment.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
|
qrcodegen2.QrSegment = QrSegment;
|
|
})(qrcodegen || (qrcodegen = {}));
|
|
((qrcodegen2) => {
|
|
let QrCode;
|
|
((QrCode2) => {
|
|
const _Ecc = class {
|
|
constructor(ordinal, formatBits) {
|
|
this.ordinal = ordinal;
|
|
this.formatBits = formatBits;
|
|
}
|
|
};
|
|
let Ecc = _Ecc;
|
|
Ecc.LOW = new _Ecc(0, 1);
|
|
Ecc.MEDIUM = new _Ecc(1, 0);
|
|
Ecc.QUARTILE = new _Ecc(2, 3);
|
|
Ecc.HIGH = new _Ecc(3, 2);
|
|
QrCode2.Ecc = Ecc;
|
|
})(QrCode = qrcodegen2.QrCode || (qrcodegen2.QrCode = {}));
|
|
})(qrcodegen || (qrcodegen = {}));
|
|
((qrcodegen2) => {
|
|
let QrSegment;
|
|
((QrSegment2) => {
|
|
const _Mode = class {
|
|
constructor(modeBits, numBitsCharCount) {
|
|
this.modeBits = modeBits;
|
|
this.numBitsCharCount = numBitsCharCount;
|
|
}
|
|
numCharCountBits(ver) {
|
|
return this.numBitsCharCount[Math.floor((ver + 7) / 17)];
|
|
}
|
|
};
|
|
let Mode = _Mode;
|
|
Mode.NUMERIC = new _Mode(1, [10, 12, 14]);
|
|
Mode.ALPHANUMERIC = new _Mode(2, [9, 11, 13]);
|
|
Mode.BYTE = new _Mode(4, [8, 16, 16]);
|
|
Mode.KANJI = new _Mode(8, [8, 10, 12]);
|
|
Mode.ECI = new _Mode(7, [0, 0, 0]);
|
|
QrSegment2.Mode = Mode;
|
|
})(QrSegment = qrcodegen2.QrSegment || (qrcodegen2.QrSegment = {}));
|
|
})(qrcodegen || (qrcodegen = {}));
|
|
var qrcodegen_default = qrcodegen;
|
|
var ERROR_LEVEL_MAP = {
|
|
L: qrcodegen_default.QrCode.Ecc.LOW,
|
|
M: qrcodegen_default.QrCode.Ecc.MEDIUM,
|
|
Q: qrcodegen_default.QrCode.Ecc.QUARTILE,
|
|
H: qrcodegen_default.QrCode.Ecc.HIGH
|
|
};
|
|
var DEFAULT_SIZE = 128;
|
|
var DEFAULT_LEVEL = "L";
|
|
var DEFAULT_BGCOLOR = "#FFFFFF";
|
|
var DEFAULT_FGCOLOR = "#000000";
|
|
var DEFAULT_INCLUDEMARGIN = false;
|
|
var MARGIN_SIZE = 4;
|
|
var DEFAULT_IMG_SCALE = 0.1;
|
|
function generatePath(modules, margin = 0) {
|
|
const ops = [];
|
|
modules.forEach(function(row, y) {
|
|
let start = null;
|
|
row.forEach(function(cell, x) {
|
|
if (!cell && start !== null) {
|
|
ops.push(`M${start + margin} ${y + margin}h${x - start}v1H${start + margin}z`);
|
|
start = null;
|
|
return;
|
|
}
|
|
if (x === row.length - 1) {
|
|
if (!cell) {
|
|
return;
|
|
}
|
|
if (start === null) {
|
|
ops.push(`M${x + margin},${y + margin} h1v1H${x + margin}z`);
|
|
} else {
|
|
ops.push(`M${start + margin},${y + margin} h${x + 1 - start}v1H${start + margin}z`);
|
|
}
|
|
return;
|
|
}
|
|
if (cell && start === null) {
|
|
start = x;
|
|
}
|
|
});
|
|
});
|
|
return ops.join("");
|
|
}
|
|
function excavateModules(modules, excavation) {
|
|
return modules.slice().map((row, y) => {
|
|
if (y < excavation.y || y >= excavation.y + excavation.h) {
|
|
return row;
|
|
}
|
|
return row.map((cell, x) => {
|
|
if (x < excavation.x || x >= excavation.x + excavation.w) {
|
|
return cell;
|
|
}
|
|
return false;
|
|
});
|
|
});
|
|
}
|
|
function getImageSettings(cells, size, includeMargin, imageSettings) {
|
|
if (imageSettings == null) {
|
|
return null;
|
|
}
|
|
const margin = includeMargin ? MARGIN_SIZE : 0;
|
|
const numCells = cells.length + margin * 2;
|
|
const defaultSize = Math.floor(size * DEFAULT_IMG_SCALE);
|
|
const scale = numCells / size;
|
|
const w2 = (imageSettings.width || defaultSize) * scale;
|
|
const h = (imageSettings.height || defaultSize) * scale;
|
|
const x = imageSettings.x == null ? cells.length / 2 - w2 / 2 : imageSettings.x * scale;
|
|
const y = imageSettings.y == null ? cells.length / 2 - h / 2 : imageSettings.y * scale;
|
|
let excavation = null;
|
|
if (imageSettings.excavate) {
|
|
let floorX = Math.floor(x);
|
|
let floorY = Math.floor(y);
|
|
let ceilW = Math.ceil(w2 + x - floorX);
|
|
let ceilH = Math.ceil(h + y - floorY);
|
|
excavation = { x: floorX, y: floorY, w: ceilW, h: ceilH };
|
|
}
|
|
return { x, y, h, w: w2, excavation };
|
|
}
|
|
var SUPPORTS_PATH2D = function() {
|
|
try {
|
|
new Path2D().addPath(new Path2D());
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}();
|
|
function QRCodeCanvas(props) {
|
|
const _a = props, {
|
|
value,
|
|
size = DEFAULT_SIZE,
|
|
level = DEFAULT_LEVEL,
|
|
bgColor = DEFAULT_BGCOLOR,
|
|
fgColor = DEFAULT_FGCOLOR,
|
|
includeMargin = DEFAULT_INCLUDEMARGIN,
|
|
style,
|
|
imageSettings
|
|
} = _a, otherProps = __objRest2(_a, [
|
|
"value",
|
|
"size",
|
|
"level",
|
|
"bgColor",
|
|
"fgColor",
|
|
"includeMargin",
|
|
"style",
|
|
"imageSettings"
|
|
]);
|
|
const imgSrc = imageSettings == null ? void 0 : imageSettings.src;
|
|
const _canvas = (0, import_react9.useRef)(null);
|
|
const _image = (0, import_react9.useRef)(null);
|
|
const [isImgLoaded, setIsImageLoaded] = (0, import_react9.useState)(false);
|
|
(0, import_react9.useEffect)(() => {
|
|
if (_canvas.current != null) {
|
|
const canvas = _canvas.current;
|
|
const ctx = canvas.getContext("2d");
|
|
if (!ctx) {
|
|
return;
|
|
}
|
|
let cells = qrcodegen_default.QrCode.encodeText(value, ERROR_LEVEL_MAP[level]).getModules();
|
|
const margin = includeMargin ? MARGIN_SIZE : 0;
|
|
const numCells = cells.length + margin * 2;
|
|
const calculatedImageSettings = getImageSettings(cells, size, includeMargin, imageSettings);
|
|
const image = _image.current;
|
|
const haveImageToRender = calculatedImageSettings != null && image !== null && image.complete && image.naturalHeight !== 0 && image.naturalWidth !== 0;
|
|
if (haveImageToRender) {
|
|
if (calculatedImageSettings.excavation != null) {
|
|
cells = excavateModules(cells, calculatedImageSettings.excavation);
|
|
}
|
|
}
|
|
const pixelRatio = window.devicePixelRatio || 1;
|
|
canvas.height = canvas.width = size * pixelRatio;
|
|
const scale = size / numCells * pixelRatio;
|
|
ctx.scale(scale, scale);
|
|
ctx.fillStyle = bgColor;
|
|
ctx.fillRect(0, 0, numCells, numCells);
|
|
ctx.fillStyle = fgColor;
|
|
if (SUPPORTS_PATH2D) {
|
|
ctx.fill(new Path2D(generatePath(cells, margin)));
|
|
} else {
|
|
cells.forEach(function(row, rdx) {
|
|
row.forEach(function(cell, cdx) {
|
|
if (cell) {
|
|
ctx.fillRect(cdx + margin, rdx + margin, 1, 1);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
if (haveImageToRender) {
|
|
ctx.drawImage(image, calculatedImageSettings.x + margin, calculatedImageSettings.y + margin, calculatedImageSettings.w, calculatedImageSettings.h);
|
|
}
|
|
}
|
|
});
|
|
(0, import_react9.useEffect)(() => {
|
|
setIsImageLoaded(false);
|
|
}, [imgSrc]);
|
|
const canvasStyle = __spreadValues2({ height: size, width: size }, style);
|
|
let img = null;
|
|
if (imgSrc != null) {
|
|
img = /* @__PURE__ */ import_react9.default.createElement("img", {
|
|
src: imgSrc,
|
|
key: imgSrc,
|
|
style: { display: "none" },
|
|
onLoad: () => {
|
|
setIsImageLoaded(true);
|
|
},
|
|
ref: _image
|
|
});
|
|
}
|
|
return /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, /* @__PURE__ */ import_react9.default.createElement("canvas", __spreadValues2({
|
|
style: canvasStyle,
|
|
height: size,
|
|
width: size,
|
|
ref: _canvas
|
|
}, otherProps)), img);
|
|
}
|
|
function QRCodeSVG(props) {
|
|
const _a = props, {
|
|
value,
|
|
size = DEFAULT_SIZE,
|
|
level = DEFAULT_LEVEL,
|
|
bgColor = DEFAULT_BGCOLOR,
|
|
fgColor = DEFAULT_FGCOLOR,
|
|
includeMargin = DEFAULT_INCLUDEMARGIN,
|
|
imageSettings
|
|
} = _a, otherProps = __objRest2(_a, [
|
|
"value",
|
|
"size",
|
|
"level",
|
|
"bgColor",
|
|
"fgColor",
|
|
"includeMargin",
|
|
"imageSettings"
|
|
]);
|
|
let cells = qrcodegen_default.QrCode.encodeText(value, ERROR_LEVEL_MAP[level]).getModules();
|
|
const margin = includeMargin ? MARGIN_SIZE : 0;
|
|
const numCells = cells.length + margin * 2;
|
|
const calculatedImageSettings = getImageSettings(cells, size, includeMargin, imageSettings);
|
|
let image = null;
|
|
if (imageSettings != null && calculatedImageSettings != null) {
|
|
if (calculatedImageSettings.excavation != null) {
|
|
cells = excavateModules(cells, calculatedImageSettings.excavation);
|
|
}
|
|
image = /* @__PURE__ */ import_react9.default.createElement("image", {
|
|
xlinkHref: imageSettings.src,
|
|
height: calculatedImageSettings.h,
|
|
width: calculatedImageSettings.w,
|
|
x: calculatedImageSettings.x + margin,
|
|
y: calculatedImageSettings.y + margin,
|
|
preserveAspectRatio: "none"
|
|
});
|
|
}
|
|
const fgPath = generatePath(cells, margin);
|
|
return /* @__PURE__ */ import_react9.default.createElement("svg", __spreadValues2({
|
|
height: size,
|
|
width: size,
|
|
viewBox: `0 0 ${numCells} ${numCells}`
|
|
}, otherProps), /* @__PURE__ */ import_react9.default.createElement("path", {
|
|
fill: bgColor,
|
|
d: `M0,0 h${numCells}v${numCells}H0z`,
|
|
shapeRendering: "crispEdges"
|
|
}), /* @__PURE__ */ import_react9.default.createElement("path", {
|
|
fill: fgColor,
|
|
d: fgPath,
|
|
shapeRendering: "crispEdges"
|
|
}), image);
|
|
}
|
|
var QRCode = (props) => {
|
|
const _a = props, { renderAs } = _a, otherProps = __objRest2(_a, ["renderAs"]);
|
|
if (renderAs === "svg") {
|
|
return /* @__PURE__ */ import_react9.default.createElement(QRCodeSVG, __spreadValues2({}, otherProps));
|
|
}
|
|
return /* @__PURE__ */ import_react9.default.createElement(QRCodeCanvas, __spreadValues2({}, otherProps));
|
|
};
|
|
|
|
// node_modules/@navigraph/app/dist/index.esm.js
|
|
var __defProp3 = Object.defineProperty;
|
|
var __defNormalProp3 = (obj, key, value) => key in obj ? __defProp3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __publicField2 = (obj, key, value) => {
|
|
__defNormalProp3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
return value;
|
|
};
|
|
var Scope = /* @__PURE__ */ ((Scope2) => {
|
|
Scope2["CHARTS"] = "charts";
|
|
Scope2["FMSDATA"] = "fmsdata";
|
|
Scope2["TILES"] = "tiles";
|
|
return Scope2;
|
|
})(Scope || {});
|
|
var NotInitializedError = class extends Error {
|
|
constructor(source) {
|
|
const message = source ? `[${source}] Navigraph app is not initialized.` : "Navigraph app is not initialized.";
|
|
super(message);
|
|
this.name = "NotInitializedError";
|
|
}
|
|
};
|
|
var UserDeniedAccessError = class extends Error {
|
|
constructor() {
|
|
super("Authentication failed. User denied access.");
|
|
this.name = "UserDeniedAccessError";
|
|
}
|
|
};
|
|
var DeviceFlowTokenExpiredError = class extends Error {
|
|
constructor() {
|
|
super("Authentication failed. Device flow token expired.");
|
|
this.name = "DeviceFlowTokenExpiredError";
|
|
}
|
|
};
|
|
var InvalidScopeError = class extends Error {
|
|
constructor(scope) {
|
|
super(`Authentication failed. Invalid scope ${scope ? ": " + scope : "provided."}`);
|
|
this.name = "InvalidScopeError";
|
|
}
|
|
};
|
|
var InvalidClientError = class extends Error {
|
|
constructor() {
|
|
super("Unable to sign in with device flow. The client is likely incorrectly configured.");
|
|
this.name = "InvalidClientError";
|
|
}
|
|
};
|
|
var AuthenticationAbortedError = class extends Error {
|
|
constructor() {
|
|
super("Unable to sign in with device flow. The authentication was aborted.");
|
|
this.name = "AuthenticationAborted";
|
|
}
|
|
};
|
|
var LEVELS = ["emerg", "alert", "crit", "err", "warning", "notice", "info", "debug"];
|
|
var Logger = class {
|
|
constructor() {
|
|
__publicField2(this, "level", "notice");
|
|
}
|
|
_log(level, ...message) {
|
|
if (LEVELS.indexOf(this.level) < LEVELS.indexOf(level)) {
|
|
return;
|
|
}
|
|
switch (level) {
|
|
case "emerg":
|
|
case "alert":
|
|
case "crit":
|
|
case "err":
|
|
console.error("[Navigraph]", ...message);
|
|
break;
|
|
case "warning":
|
|
console.warn("[Navigraph]", ...message);
|
|
break;
|
|
case "debug":
|
|
console.debug("[Navigraph]", ...message);
|
|
break;
|
|
default:
|
|
console.log("[Navigraph]", ...message);
|
|
break;
|
|
}
|
|
}
|
|
log(...message) {
|
|
this._log("info", ...message);
|
|
}
|
|
emerg(...message) {
|
|
this._log("emerg", ...message);
|
|
}
|
|
alert(...message) {
|
|
this._log("alert", ...message);
|
|
}
|
|
crit(...message) {
|
|
this._log("crit", ...message);
|
|
}
|
|
err(...message) {
|
|
this._log("err", ...message);
|
|
}
|
|
warning(...message) {
|
|
this._log("warning", ...message);
|
|
}
|
|
notice(...message) {
|
|
this._log("notice", ...message);
|
|
}
|
|
info(...message) {
|
|
this._log("info", ...message);
|
|
}
|
|
debug(...message) {
|
|
this._log("debug", ...message);
|
|
}
|
|
};
|
|
var logger = new Logger();
|
|
var Logger_default = logger;
|
|
var app;
|
|
var getApp = () => app;
|
|
var setApp = (newApp) => {
|
|
if (app) {
|
|
Logger_default.warning("Navigraph App has already been initialized. The existing configuration will be overwritten.");
|
|
}
|
|
app = newApp;
|
|
};
|
|
var getDefaultAppDomain = () => {
|
|
var _a;
|
|
return (_a = app == null ? void 0 : app.domain) != null ? _a : "navigraph.com";
|
|
};
|
|
function initializeApp(app2) {
|
|
const DEFAULT_SCOPES = ["userinfo", "openid", "offline_access"];
|
|
app2.scopes = Array.from(/* @__PURE__ */ new Set([...DEFAULT_SCOPES, ...app2.scopes]));
|
|
setApp(app2);
|
|
}
|
|
|
|
// node_modules/@navigraph/auth/dist/index.esm.js
|
|
var __create2 = Object.create;
|
|
var __defProp4 = Object.defineProperty;
|
|
var __defProps2 = Object.defineProperties;
|
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
|
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
var __getOwnPropSymbols3 = Object.getOwnPropertySymbols;
|
|
var __getProtoOf2 = Object.getPrototypeOf;
|
|
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum3 = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp4 = (obj, key, value) => key in obj ? __defProp4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues3 = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp3.call(b, prop))
|
|
__defNormalProp4(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols3)
|
|
for (var prop of __getOwnPropSymbols3(b)) {
|
|
if (__propIsEnum3.call(b, prop))
|
|
__defNormalProp4(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
|
|
var __commonJS2 = (cb, mod) => function __require() {
|
|
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
};
|
|
var __copyProps2 = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames2(from))
|
|
if (!__hasOwnProp3.call(to, key) && key !== except)
|
|
__defProp4(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
isNodeMode || !mod || !mod.__esModule ? __defProp4(target, "default", { value: mod, enumerable: true }) : target,
|
|
mod
|
|
));
|
|
var __async = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
var require_bind = __commonJS2({
|
|
"../../node_modules/axios/lib/helpers/bind.js"(exports, module) {
|
|
"use strict";
|
|
module.exports = function bind2(fn, thisArg) {
|
|
return function wrap() {
|
|
var args = new Array(arguments.length);
|
|
for (var i = 0; i < args.length; i++) {
|
|
args[i] = arguments[i];
|
|
}
|
|
return fn.apply(thisArg, args);
|
|
};
|
|
};
|
|
}
|
|
});
|
|
var require_utils = __commonJS2({
|
|
"../../node_modules/axios/lib/utils.js"(exports, module) {
|
|
"use strict";
|
|
var bind2 = require_bind();
|
|
var toString3 = Object.prototype.toString;
|
|
function isArray2(val) {
|
|
return toString3.call(val) === "[object Array]";
|
|
}
|
|
function isUndefined2(val) {
|
|
return typeof val === "undefined";
|
|
}
|
|
function isBuffer2(val) {
|
|
return val !== null && !isUndefined2(val) && val.constructor !== null && !isUndefined2(val.constructor) && typeof val.constructor.isBuffer === "function" && val.constructor.isBuffer(val);
|
|
}
|
|
function isArrayBuffer2(val) {
|
|
return toString3.call(val) === "[object ArrayBuffer]";
|
|
}
|
|
function isFormData2(val) {
|
|
return typeof FormData !== "undefined" && val instanceof FormData;
|
|
}
|
|
function isArrayBufferView2(val) {
|
|
var result;
|
|
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
result = ArrayBuffer.isView(val);
|
|
} else {
|
|
result = val && val.buffer && val.buffer instanceof ArrayBuffer;
|
|
}
|
|
return result;
|
|
}
|
|
function isString2(val) {
|
|
return typeof val === "string";
|
|
}
|
|
function isNumber2(val) {
|
|
return typeof val === "number";
|
|
}
|
|
function isObject2(val) {
|
|
return val !== null && typeof val === "object";
|
|
}
|
|
function isPlainObject4(val) {
|
|
if (toString3.call(val) !== "[object Object]") {
|
|
return false;
|
|
}
|
|
var prototype3 = Object.getPrototypeOf(val);
|
|
return prototype3 === null || prototype3 === Object.prototype;
|
|
}
|
|
function isDate3(val) {
|
|
return toString3.call(val) === "[object Date]";
|
|
}
|
|
function isFile2(val) {
|
|
return toString3.call(val) === "[object File]";
|
|
}
|
|
function isBlob2(val) {
|
|
return toString3.call(val) === "[object Blob]";
|
|
}
|
|
function isFunction2(val) {
|
|
return toString3.call(val) === "[object Function]";
|
|
}
|
|
function isStream2(val) {
|
|
return isObject2(val) && isFunction2(val.pipe);
|
|
}
|
|
function isURLSearchParams2(val) {
|
|
return typeof URLSearchParams !== "undefined" && val instanceof URLSearchParams;
|
|
}
|
|
function trim2(str) {
|
|
return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
|
|
}
|
|
function isStandardBrowserEnv() {
|
|
if (typeof navigator !== "undefined" && (navigator.product === "ReactNative" || navigator.product === "NativeScript" || navigator.product === "NS")) {
|
|
return false;
|
|
}
|
|
return typeof window !== "undefined" && typeof document !== "undefined";
|
|
}
|
|
function forEach2(obj, fn) {
|
|
if (obj === null || typeof obj === "undefined") {
|
|
return;
|
|
}
|
|
if (typeof obj !== "object") {
|
|
obj = [obj];
|
|
}
|
|
if (isArray2(obj)) {
|
|
for (var i = 0, l = obj.length; i < l; i++) {
|
|
fn.call(null, obj[i], i, obj);
|
|
}
|
|
} else {
|
|
for (var key in obj) {
|
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
fn.call(null, obj[key], key, obj);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
function merge2() {
|
|
var result = {};
|
|
function assignValue(val, key) {
|
|
if (isPlainObject4(result[key]) && isPlainObject4(val)) {
|
|
result[key] = merge2(result[key], val);
|
|
} else if (isPlainObject4(val)) {
|
|
result[key] = merge2({}, val);
|
|
} else if (isArray2(val)) {
|
|
result[key] = val.slice();
|
|
} else {
|
|
result[key] = val;
|
|
}
|
|
}
|
|
for (var i = 0, l = arguments.length; i < l; i++) {
|
|
forEach2(arguments[i], assignValue);
|
|
}
|
|
return result;
|
|
}
|
|
function extend2(a, b, thisArg) {
|
|
forEach2(b, function assignValue(val, key) {
|
|
if (thisArg && typeof val === "function") {
|
|
a[key] = bind2(val, thisArg);
|
|
} else {
|
|
a[key] = val;
|
|
}
|
|
});
|
|
return a;
|
|
}
|
|
function stripBOM2(content) {
|
|
if (content.charCodeAt(0) === 65279) {
|
|
content = content.slice(1);
|
|
}
|
|
return content;
|
|
}
|
|
module.exports = {
|
|
isArray: isArray2,
|
|
isArrayBuffer: isArrayBuffer2,
|
|
isBuffer: isBuffer2,
|
|
isFormData: isFormData2,
|
|
isArrayBufferView: isArrayBufferView2,
|
|
isString: isString2,
|
|
isNumber: isNumber2,
|
|
isObject: isObject2,
|
|
isPlainObject: isPlainObject4,
|
|
isUndefined: isUndefined2,
|
|
isDate: isDate3,
|
|
isFile: isFile2,
|
|
isBlob: isBlob2,
|
|
isFunction: isFunction2,
|
|
isStream: isStream2,
|
|
isURLSearchParams: isURLSearchParams2,
|
|
isStandardBrowserEnv,
|
|
forEach: forEach2,
|
|
merge: merge2,
|
|
extend: extend2,
|
|
trim: trim2,
|
|
stripBOM: stripBOM2
|
|
};
|
|
}
|
|
});
|
|
var require_buildURL = __commonJS2({
|
|
"../../node_modules/axios/lib/helpers/buildURL.js"(exports, module) {
|
|
"use strict";
|
|
var utils = require_utils();
|
|
function encode3(val) {
|
|
return encodeURIComponent(val).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+").replace(/%5B/gi, "[").replace(/%5D/gi, "]");
|
|
}
|
|
module.exports = function buildURL2(url, params, paramsSerializer) {
|
|
if (!params) {
|
|
return url;
|
|
}
|
|
var serializedParams;
|
|
if (paramsSerializer) {
|
|
serializedParams = paramsSerializer(params);
|
|
} else if (utils.isURLSearchParams(params)) {
|
|
serializedParams = params.toString();
|
|
} else {
|
|
var parts = [];
|
|
utils.forEach(params, function serialize(val, key) {
|
|
if (val === null || typeof val === "undefined") {
|
|
return;
|
|
}
|
|
if (utils.isArray(val)) {
|
|
key = key + "[]";
|
|
} else {
|
|
val = [val];
|
|
}
|
|
utils.forEach(val, function parseValue(v) {
|
|
if (utils.isDate(v)) {
|
|
v = v.toISOString();
|
|
} else if (utils.isObject(v)) {
|
|
v = JSON.stringify(v);
|
|
}
|
|
parts.push(encode3(key) + "=" + encode3(v));
|
|
});
|
|
});
|
|
serializedParams = parts.join("&");
|
|
}
|
|
if (serializedParams) {
|
|
var hashmarkIndex = url.indexOf("#");
|
|
if (hashmarkIndex !== -1) {
|
|
url = url.slice(0, hashmarkIndex);
|
|
}
|
|
url += (url.indexOf("?") === -1 ? "?" : "&") + serializedParams;
|
|
}
|
|
return url;
|
|
};
|
|
}
|
|
});
|
|
var require_InterceptorManager = __commonJS2({
|
|
"../../node_modules/axios/lib/core/InterceptorManager.js"(exports, module) {
|
|
"use strict";
|
|
var utils = require_utils();
|
|
function InterceptorManager2() {
|
|
this.handlers = [];
|
|
}
|
|
InterceptorManager2.prototype.use = function use(fulfilled, rejected, options) {
|
|
this.handlers.push({
|
|
fulfilled,
|
|
rejected,
|
|
synchronous: options ? options.synchronous : false,
|
|
runWhen: options ? options.runWhen : null
|
|
});
|
|
return this.handlers.length - 1;
|
|
};
|
|
InterceptorManager2.prototype.eject = function eject(id) {
|
|
if (this.handlers[id]) {
|
|
this.handlers[id] = null;
|
|
}
|
|
};
|
|
InterceptorManager2.prototype.forEach = function forEach2(fn) {
|
|
utils.forEach(this.handlers, function forEachHandler(h) {
|
|
if (h !== null) {
|
|
fn(h);
|
|
}
|
|
});
|
|
};
|
|
module.exports = InterceptorManager2;
|
|
}
|
|
});
|
|
var require_normalizeHeaderName = __commonJS2({
|
|
"../../node_modules/axios/lib/helpers/normalizeHeaderName.js"(exports, module) {
|
|
"use strict";
|
|
var utils = require_utils();
|
|
module.exports = function normalizeHeaderName(headers, normalizedName) {
|
|
utils.forEach(headers, function processHeader(value, name) {
|
|
if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
|
|
headers[normalizedName] = value;
|
|
delete headers[name];
|
|
}
|
|
});
|
|
};
|
|
}
|
|
});
|
|
var require_enhanceError = __commonJS2({
|
|
"../../node_modules/axios/lib/core/enhanceError.js"(exports, module) {
|
|
"use strict";
|
|
module.exports = function enhanceError(error, config3, code, request, response) {
|
|
error.config = config3;
|
|
if (code) {
|
|
error.code = code;
|
|
}
|
|
error.request = request;
|
|
error.response = response;
|
|
error.isAxiosError = true;
|
|
error.toJSON = function toJSON2() {
|
|
return {
|
|
message: this.message,
|
|
name: this.name,
|
|
description: this.description,
|
|
number: this.number,
|
|
fileName: this.fileName,
|
|
lineNumber: this.lineNumber,
|
|
columnNumber: this.columnNumber,
|
|
stack: this.stack,
|
|
config: this.config,
|
|
code: this.code,
|
|
status: this.response && this.response.status ? this.response.status : null
|
|
};
|
|
};
|
|
return error;
|
|
};
|
|
}
|
|
});
|
|
var require_createError = __commonJS2({
|
|
"../../node_modules/axios/lib/core/createError.js"(exports, module) {
|
|
"use strict";
|
|
var enhanceError = require_enhanceError();
|
|
module.exports = function createError(message, config3, code, request, response) {
|
|
var error = new Error(message);
|
|
return enhanceError(error, config3, code, request, response);
|
|
};
|
|
}
|
|
});
|
|
var require_settle = __commonJS2({
|
|
"../../node_modules/axios/lib/core/settle.js"(exports, module) {
|
|
"use strict";
|
|
var createError = require_createError();
|
|
module.exports = function settle2(resolve, reject, response) {
|
|
var validateStatus2 = response.config.validateStatus;
|
|
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
|
|
resolve(response);
|
|
} else {
|
|
reject(createError(
|
|
"Request failed with status code " + response.status,
|
|
response.config,
|
|
null,
|
|
response.request,
|
|
response
|
|
));
|
|
}
|
|
};
|
|
}
|
|
});
|
|
var require_cookies = __commonJS2({
|
|
"../../node_modules/axios/lib/helpers/cookies.js"(exports, module) {
|
|
"use strict";
|
|
var utils = require_utils();
|
|
module.exports = utils.isStandardBrowserEnv() ? function standardBrowserEnv2() {
|
|
return {
|
|
write: function write(name, value, expires, path, domain, secure) {
|
|
var cookie = [];
|
|
cookie.push(name + "=" + encodeURIComponent(value));
|
|
if (utils.isNumber(expires)) {
|
|
cookie.push("expires=" + new Date(expires).toGMTString());
|
|
}
|
|
if (utils.isString(path)) {
|
|
cookie.push("path=" + path);
|
|
}
|
|
if (utils.isString(domain)) {
|
|
cookie.push("domain=" + domain);
|
|
}
|
|
if (secure === true) {
|
|
cookie.push("secure");
|
|
}
|
|
document.cookie = cookie.join("; ");
|
|
},
|
|
read: function read(name) {
|
|
var match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
|
|
return match ? decodeURIComponent(match[3]) : null;
|
|
},
|
|
remove: function remove(name) {
|
|
this.write(name, "", Date.now() - 864e5);
|
|
}
|
|
};
|
|
}() : function nonStandardBrowserEnv2() {
|
|
return {
|
|
write: function write() {
|
|
},
|
|
read: function read() {
|
|
return null;
|
|
},
|
|
remove: function remove() {
|
|
}
|
|
};
|
|
}();
|
|
}
|
|
});
|
|
var require_isAbsoluteURL = __commonJS2({
|
|
"../../node_modules/axios/lib/helpers/isAbsoluteURL.js"(exports, module) {
|
|
"use strict";
|
|
module.exports = function isAbsoluteURL2(url) {
|
|
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
};
|
|
}
|
|
});
|
|
var require_combineURLs = __commonJS2({
|
|
"../../node_modules/axios/lib/helpers/combineURLs.js"(exports, module) {
|
|
"use strict";
|
|
module.exports = function combineURLs2(baseURL, relativeURL) {
|
|
return relativeURL ? baseURL.replace(/\/+$/, "") + "/" + relativeURL.replace(/^\/+/, "") : baseURL;
|
|
};
|
|
}
|
|
});
|
|
var require_buildFullPath = __commonJS2({
|
|
"../../node_modules/axios/lib/core/buildFullPath.js"(exports, module) {
|
|
"use strict";
|
|
var isAbsoluteURL2 = require_isAbsoluteURL();
|
|
var combineURLs2 = require_combineURLs();
|
|
module.exports = function buildFullPath2(baseURL, requestedURL) {
|
|
if (baseURL && !isAbsoluteURL2(requestedURL)) {
|
|
return combineURLs2(baseURL, requestedURL);
|
|
}
|
|
return requestedURL;
|
|
};
|
|
}
|
|
});
|
|
var require_parseHeaders = __commonJS2({
|
|
"../../node_modules/axios/lib/helpers/parseHeaders.js"(exports, module) {
|
|
"use strict";
|
|
var utils = require_utils();
|
|
var ignoreDuplicateOf2 = [
|
|
"age",
|
|
"authorization",
|
|
"content-length",
|
|
"content-type",
|
|
"etag",
|
|
"expires",
|
|
"from",
|
|
"host",
|
|
"if-modified-since",
|
|
"if-unmodified-since",
|
|
"last-modified",
|
|
"location",
|
|
"max-forwards",
|
|
"proxy-authorization",
|
|
"referer",
|
|
"retry-after",
|
|
"user-agent"
|
|
];
|
|
module.exports = function parseHeaders(headers) {
|
|
var parsed = {};
|
|
var key;
|
|
var val;
|
|
var i;
|
|
if (!headers) {
|
|
return parsed;
|
|
}
|
|
utils.forEach(headers.split("\n"), function parser(line) {
|
|
i = line.indexOf(":");
|
|
key = utils.trim(line.substr(0, i)).toLowerCase();
|
|
val = utils.trim(line.substr(i + 1));
|
|
if (key) {
|
|
if (parsed[key] && ignoreDuplicateOf2.indexOf(key) >= 0) {
|
|
return;
|
|
}
|
|
if (key === "set-cookie") {
|
|
parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);
|
|
} else {
|
|
parsed[key] = parsed[key] ? parsed[key] + ", " + val : val;
|
|
}
|
|
}
|
|
});
|
|
return parsed;
|
|
};
|
|
}
|
|
});
|
|
var require_isURLSameOrigin = __commonJS2({
|
|
"../../node_modules/axios/lib/helpers/isURLSameOrigin.js"(exports, module) {
|
|
"use strict";
|
|
var utils = require_utils();
|
|
module.exports = utils.isStandardBrowserEnv() ? function standardBrowserEnv2() {
|
|
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
var urlParsingNode = document.createElement("a");
|
|
var originURL;
|
|
function resolveURL(url) {
|
|
var href = url;
|
|
if (msie) {
|
|
urlParsingNode.setAttribute("href", href);
|
|
href = urlParsingNode.href;
|
|
}
|
|
urlParsingNode.setAttribute("href", href);
|
|
return {
|
|
href: urlParsingNode.href,
|
|
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
|
|
host: urlParsingNode.host,
|
|
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
|
|
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
|
|
hostname: urlParsingNode.hostname,
|
|
port: urlParsingNode.port,
|
|
pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
|
|
};
|
|
}
|
|
originURL = resolveURL(window.location.href);
|
|
return function isURLSameOrigin(requestURL) {
|
|
var parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL;
|
|
return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
|
|
};
|
|
}() : function nonStandardBrowserEnv2() {
|
|
return function isURLSameOrigin() {
|
|
return true;
|
|
};
|
|
}();
|
|
}
|
|
});
|
|
var require_Cancel = __commonJS2({
|
|
"../../node_modules/axios/lib/cancel/Cancel.js"(exports, module) {
|
|
"use strict";
|
|
function Cancel2(message) {
|
|
this.message = message;
|
|
}
|
|
Cancel2.prototype.toString = function toString3() {
|
|
return "Cancel" + (this.message ? ": " + this.message : "");
|
|
};
|
|
Cancel2.prototype.__CANCEL__ = true;
|
|
module.exports = Cancel2;
|
|
}
|
|
});
|
|
var require_xhr = __commonJS2({
|
|
"../../node_modules/axios/lib/adapters/xhr.js"(exports, module) {
|
|
"use strict";
|
|
var utils = require_utils();
|
|
var settle2 = require_settle();
|
|
var cookies = require_cookies();
|
|
var buildURL2 = require_buildURL();
|
|
var buildFullPath2 = require_buildFullPath();
|
|
var parseHeaders = require_parseHeaders();
|
|
var isURLSameOrigin = require_isURLSameOrigin();
|
|
var createError = require_createError();
|
|
var defaults2 = require_defaults();
|
|
var Cancel2 = require_Cancel();
|
|
module.exports = function xhrAdapter(config3) {
|
|
return new Promise(function dispatchXhrRequest(resolve, reject) {
|
|
var requestData = config3.data;
|
|
var requestHeaders = config3.headers;
|
|
var responseType = config3.responseType;
|
|
var onCanceled;
|
|
function done() {
|
|
if (config3.cancelToken) {
|
|
config3.cancelToken.unsubscribe(onCanceled);
|
|
}
|
|
if (config3.signal) {
|
|
config3.signal.removeEventListener("abort", onCanceled);
|
|
}
|
|
}
|
|
if (utils.isFormData(requestData)) {
|
|
delete requestHeaders["Content-Type"];
|
|
}
|
|
var request = new XMLHttpRequest();
|
|
if (config3.auth) {
|
|
var username = config3.auth.username || "";
|
|
var password = config3.auth.password ? unescape(encodeURIComponent(config3.auth.password)) : "";
|
|
requestHeaders.Authorization = "Basic " + btoa(username + ":" + password);
|
|
}
|
|
var fullPath = buildFullPath2(config3.baseURL, config3.url);
|
|
request.open(config3.method.toUpperCase(), buildURL2(fullPath, config3.params, config3.paramsSerializer), true);
|
|
request.timeout = config3.timeout;
|
|
function onloadend() {
|
|
if (!request) {
|
|
return;
|
|
}
|
|
var responseHeaders = "getAllResponseHeaders" in request ? parseHeaders(request.getAllResponseHeaders()) : null;
|
|
var responseData = !responseType || responseType === "text" || responseType === "json" ? request.responseText : request.response;
|
|
var response = {
|
|
data: responseData,
|
|
status: request.status,
|
|
statusText: request.statusText,
|
|
headers: responseHeaders,
|
|
config: config3,
|
|
request
|
|
};
|
|
settle2(function _resolve(value) {
|
|
resolve(value);
|
|
done();
|
|
}, function _reject(err) {
|
|
reject(err);
|
|
done();
|
|
}, response);
|
|
request = null;
|
|
}
|
|
if ("onloadend" in request) {
|
|
request.onloadend = onloadend;
|
|
} else {
|
|
request.onreadystatechange = function handleLoad() {
|
|
if (!request || request.readyState !== 4) {
|
|
return;
|
|
}
|
|
if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf("file:") === 0)) {
|
|
return;
|
|
}
|
|
setTimeout(onloadend);
|
|
};
|
|
}
|
|
request.onabort = function handleAbort() {
|
|
if (!request) {
|
|
return;
|
|
}
|
|
reject(createError("Request aborted", config3, "ECONNABORTED", request));
|
|
request = null;
|
|
};
|
|
request.onerror = function handleError() {
|
|
reject(createError("Network Error", config3, null, request));
|
|
request = null;
|
|
};
|
|
request.ontimeout = function handleTimeout() {
|
|
var timeoutErrorMessage = config3.timeout ? "timeout of " + config3.timeout + "ms exceeded" : "timeout exceeded";
|
|
var transitional2 = config3.transitional || defaults2.transitional;
|
|
if (config3.timeoutErrorMessage) {
|
|
timeoutErrorMessage = config3.timeoutErrorMessage;
|
|
}
|
|
reject(createError(
|
|
timeoutErrorMessage,
|
|
config3,
|
|
transitional2.clarifyTimeoutError ? "ETIMEDOUT" : "ECONNABORTED",
|
|
request
|
|
));
|
|
request = null;
|
|
};
|
|
if (utils.isStandardBrowserEnv()) {
|
|
var xsrfValue = (config3.withCredentials || isURLSameOrigin(fullPath)) && config3.xsrfCookieName ? cookies.read(config3.xsrfCookieName) : void 0;
|
|
if (xsrfValue) {
|
|
requestHeaders[config3.xsrfHeaderName] = xsrfValue;
|
|
}
|
|
}
|
|
if ("setRequestHeader" in request) {
|
|
utils.forEach(requestHeaders, function setRequestHeader(val, key) {
|
|
if (typeof requestData === "undefined" && key.toLowerCase() === "content-type") {
|
|
delete requestHeaders[key];
|
|
} else {
|
|
request.setRequestHeader(key, val);
|
|
}
|
|
});
|
|
}
|
|
if (!utils.isUndefined(config3.withCredentials)) {
|
|
request.withCredentials = !!config3.withCredentials;
|
|
}
|
|
if (responseType && responseType !== "json") {
|
|
request.responseType = config3.responseType;
|
|
}
|
|
if (typeof config3.onDownloadProgress === "function") {
|
|
request.addEventListener("progress", config3.onDownloadProgress);
|
|
}
|
|
if (typeof config3.onUploadProgress === "function" && request.upload) {
|
|
request.upload.addEventListener("progress", config3.onUploadProgress);
|
|
}
|
|
if (config3.cancelToken || config3.signal) {
|
|
onCanceled = function(cancel) {
|
|
if (!request) {
|
|
return;
|
|
}
|
|
reject(!cancel || cancel && cancel.type ? new Cancel2("canceled") : cancel);
|
|
request.abort();
|
|
request = null;
|
|
};
|
|
config3.cancelToken && config3.cancelToken.subscribe(onCanceled);
|
|
if (config3.signal) {
|
|
config3.signal.aborted ? onCanceled() : config3.signal.addEventListener("abort", onCanceled);
|
|
}
|
|
}
|
|
if (!requestData) {
|
|
requestData = null;
|
|
}
|
|
request.send(requestData);
|
|
});
|
|
};
|
|
}
|
|
});
|
|
var require_defaults = __commonJS2({
|
|
"../../node_modules/axios/lib/defaults.js"(exports, module) {
|
|
"use strict";
|
|
var utils = require_utils();
|
|
var normalizeHeaderName = require_normalizeHeaderName();
|
|
var enhanceError = require_enhanceError();
|
|
var DEFAULT_CONTENT_TYPE = {
|
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
};
|
|
function setContentTypeIfUnset(headers, value) {
|
|
if (!utils.isUndefined(headers) && utils.isUndefined(headers["Content-Type"])) {
|
|
headers["Content-Type"] = value;
|
|
}
|
|
}
|
|
function getDefaultAdapter() {
|
|
var adapter;
|
|
if (typeof XMLHttpRequest !== "undefined") {
|
|
adapter = require_xhr();
|
|
}
|
|
return adapter;
|
|
}
|
|
function stringifySafely2(rawValue, parser, encoder) {
|
|
if (utils.isString(rawValue)) {
|
|
try {
|
|
(parser || JSON.parse)(rawValue);
|
|
return utils.trim(rawValue);
|
|
} catch (e) {
|
|
if (e.name !== "SyntaxError") {
|
|
throw e;
|
|
}
|
|
}
|
|
}
|
|
return (encoder || JSON.stringify)(rawValue);
|
|
}
|
|
var defaults2 = {
|
|
transitional: {
|
|
silentJSONParsing: true,
|
|
forcedJSONParsing: true,
|
|
clarifyTimeoutError: false
|
|
},
|
|
adapter: getDefaultAdapter(),
|
|
transformRequest: [function transformRequest2(data, headers) {
|
|
normalizeHeaderName(headers, "Accept");
|
|
normalizeHeaderName(headers, "Content-Type");
|
|
if (utils.isFormData(data) || utils.isArrayBuffer(data) || utils.isBuffer(data) || utils.isStream(data) || utils.isFile(data) || utils.isBlob(data)) {
|
|
return data;
|
|
}
|
|
if (utils.isArrayBufferView(data)) {
|
|
return data.buffer;
|
|
}
|
|
if (utils.isURLSearchParams(data)) {
|
|
setContentTypeIfUnset(headers, "application/x-www-form-urlencoded;charset=utf-8");
|
|
return data.toString();
|
|
}
|
|
if (utils.isObject(data) || headers && headers["Content-Type"] === "application/json") {
|
|
setContentTypeIfUnset(headers, "application/json");
|
|
return stringifySafely2(data);
|
|
}
|
|
return data;
|
|
}],
|
|
transformResponse: [function transformResponse2(data) {
|
|
var transitional2 = this.transitional || defaults2.transitional;
|
|
var silentJSONParsing = transitional2 && transitional2.silentJSONParsing;
|
|
var forcedJSONParsing = transitional2 && transitional2.forcedJSONParsing;
|
|
var strictJSONParsing = !silentJSONParsing && this.responseType === "json";
|
|
if (strictJSONParsing || forcedJSONParsing && utils.isString(data) && data.length) {
|
|
try {
|
|
return JSON.parse(data);
|
|
} catch (e) {
|
|
if (strictJSONParsing) {
|
|
if (e.name === "SyntaxError") {
|
|
throw enhanceError(e, this, "E_JSON_PARSE");
|
|
}
|
|
throw e;
|
|
}
|
|
}
|
|
}
|
|
return data;
|
|
}],
|
|
timeout: 0,
|
|
xsrfCookieName: "XSRF-TOKEN",
|
|
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
maxContentLength: -1,
|
|
maxBodyLength: -1,
|
|
validateStatus: function validateStatus2(status) {
|
|
return status >= 200 && status < 300;
|
|
},
|
|
headers: {
|
|
common: {
|
|
"Accept": "application/json, text/plain, */*"
|
|
}
|
|
}
|
|
};
|
|
utils.forEach(["delete", "get", "head"], function forEachMethodNoData2(method) {
|
|
defaults2.headers[method] = {};
|
|
});
|
|
utils.forEach(["post", "put", "patch"], function forEachMethodWithData2(method) {
|
|
defaults2.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
|
});
|
|
module.exports = defaults2;
|
|
}
|
|
});
|
|
var require_transformData = __commonJS2({
|
|
"../../node_modules/axios/lib/core/transformData.js"(exports, module) {
|
|
"use strict";
|
|
var utils = require_utils();
|
|
var defaults2 = require_defaults();
|
|
module.exports = function transformData2(data, headers, fns) {
|
|
var context = this || defaults2;
|
|
utils.forEach(fns, function transform(fn) {
|
|
data = fn.call(context, data, headers);
|
|
});
|
|
return data;
|
|
};
|
|
}
|
|
});
|
|
var require_isCancel = __commonJS2({
|
|
"../../node_modules/axios/lib/cancel/isCancel.js"(exports, module) {
|
|
"use strict";
|
|
module.exports = function isCancel3(value) {
|
|
return !!(value && value.__CANCEL__);
|
|
};
|
|
}
|
|
});
|
|
var require_dispatchRequest = __commonJS2({
|
|
"../../node_modules/axios/lib/core/dispatchRequest.js"(exports, module) {
|
|
"use strict";
|
|
var utils = require_utils();
|
|
var transformData2 = require_transformData();
|
|
var isCancel3 = require_isCancel();
|
|
var defaults2 = require_defaults();
|
|
var Cancel2 = require_Cancel();
|
|
function throwIfCancellationRequested2(config3) {
|
|
if (config3.cancelToken) {
|
|
config3.cancelToken.throwIfRequested();
|
|
}
|
|
if (config3.signal && config3.signal.aborted) {
|
|
throw new Cancel2("canceled");
|
|
}
|
|
}
|
|
module.exports = function dispatchRequest2(config3) {
|
|
throwIfCancellationRequested2(config3);
|
|
config3.headers = config3.headers || {};
|
|
config3.data = transformData2.call(
|
|
config3,
|
|
config3.data,
|
|
config3.headers,
|
|
config3.transformRequest
|
|
);
|
|
config3.headers = utils.merge(
|
|
config3.headers.common || {},
|
|
config3.headers[config3.method] || {},
|
|
config3.headers
|
|
);
|
|
utils.forEach(
|
|
["delete", "get", "head", "post", "put", "patch", "common"],
|
|
function cleanHeaderConfig(method) {
|
|
delete config3.headers[method];
|
|
}
|
|
);
|
|
var adapter = config3.adapter || defaults2.adapter;
|
|
return adapter(config3).then(function onAdapterResolution(response) {
|
|
throwIfCancellationRequested2(config3);
|
|
response.data = transformData2.call(
|
|
config3,
|
|
response.data,
|
|
response.headers,
|
|
config3.transformResponse
|
|
);
|
|
return response;
|
|
}, function onAdapterRejection(reason) {
|
|
if (!isCancel3(reason)) {
|
|
throwIfCancellationRequested2(config3);
|
|
if (reason && reason.response) {
|
|
reason.response.data = transformData2.call(
|
|
config3,
|
|
reason.response.data,
|
|
reason.response.headers,
|
|
config3.transformResponse
|
|
);
|
|
}
|
|
}
|
|
return Promise.reject(reason);
|
|
});
|
|
};
|
|
}
|
|
});
|
|
var require_mergeConfig = __commonJS2({
|
|
"../../node_modules/axios/lib/core/mergeConfig.js"(exports, module) {
|
|
"use strict";
|
|
var utils = require_utils();
|
|
module.exports = function mergeConfig3(config1, config22) {
|
|
config22 = config22 || {};
|
|
var config3 = {};
|
|
function getMergedValue(target, source) {
|
|
if (utils.isPlainObject(target) && utils.isPlainObject(source)) {
|
|
return utils.merge(target, source);
|
|
} else if (utils.isPlainObject(source)) {
|
|
return utils.merge({}, source);
|
|
} else if (utils.isArray(source)) {
|
|
return source.slice();
|
|
}
|
|
return source;
|
|
}
|
|
function mergeDeepProperties(prop) {
|
|
if (!utils.isUndefined(config22[prop])) {
|
|
return getMergedValue(config1[prop], config22[prop]);
|
|
} else if (!utils.isUndefined(config1[prop])) {
|
|
return getMergedValue(void 0, config1[prop]);
|
|
}
|
|
}
|
|
function valueFromConfig2(prop) {
|
|
if (!utils.isUndefined(config22[prop])) {
|
|
return getMergedValue(void 0, config22[prop]);
|
|
}
|
|
}
|
|
function defaultToConfig2(prop) {
|
|
if (!utils.isUndefined(config22[prop])) {
|
|
return getMergedValue(void 0, config22[prop]);
|
|
} else if (!utils.isUndefined(config1[prop])) {
|
|
return getMergedValue(void 0, config1[prop]);
|
|
}
|
|
}
|
|
function mergeDirectKeys(prop) {
|
|
if (prop in config22) {
|
|
return getMergedValue(config1[prop], config22[prop]);
|
|
} else if (prop in config1) {
|
|
return getMergedValue(void 0, config1[prop]);
|
|
}
|
|
}
|
|
var mergeMap = {
|
|
"url": valueFromConfig2,
|
|
"method": valueFromConfig2,
|
|
"data": valueFromConfig2,
|
|
"baseURL": defaultToConfig2,
|
|
"transformRequest": defaultToConfig2,
|
|
"transformResponse": defaultToConfig2,
|
|
"paramsSerializer": defaultToConfig2,
|
|
"timeout": defaultToConfig2,
|
|
"timeoutMessage": defaultToConfig2,
|
|
"withCredentials": defaultToConfig2,
|
|
"adapter": defaultToConfig2,
|
|
"responseType": defaultToConfig2,
|
|
"xsrfCookieName": defaultToConfig2,
|
|
"xsrfHeaderName": defaultToConfig2,
|
|
"onUploadProgress": defaultToConfig2,
|
|
"onDownloadProgress": defaultToConfig2,
|
|
"decompress": defaultToConfig2,
|
|
"maxContentLength": defaultToConfig2,
|
|
"maxBodyLength": defaultToConfig2,
|
|
"transport": defaultToConfig2,
|
|
"httpAgent": defaultToConfig2,
|
|
"httpsAgent": defaultToConfig2,
|
|
"cancelToken": defaultToConfig2,
|
|
"socketPath": defaultToConfig2,
|
|
"responseEncoding": defaultToConfig2,
|
|
"validateStatus": mergeDirectKeys
|
|
};
|
|
utils.forEach(Object.keys(config1).concat(Object.keys(config22)), function computeConfigValue(prop) {
|
|
var merge2 = mergeMap[prop] || mergeDeepProperties;
|
|
var configValue = merge2(prop);
|
|
utils.isUndefined(configValue) && merge2 !== mergeDirectKeys || (config3[prop] = configValue);
|
|
});
|
|
return config3;
|
|
};
|
|
}
|
|
});
|
|
var require_data = __commonJS2({
|
|
"../../node_modules/axios/lib/env/data.js"(exports, module) {
|
|
module.exports = {
|
|
"version": "0.24.0"
|
|
};
|
|
}
|
|
});
|
|
var require_validator = __commonJS2({
|
|
"../../node_modules/axios/lib/helpers/validator.js"(exports, module) {
|
|
"use strict";
|
|
var VERSION3 = require_data().version;
|
|
var validators3 = {};
|
|
["object", "boolean", "number", "function", "string", "symbol"].forEach(function(type, i) {
|
|
validators3[type] = function validator(thing) {
|
|
return typeof thing === type || "a" + (i < 1 ? "n " : " ") + type;
|
|
};
|
|
});
|
|
var deprecatedWarnings2 = {};
|
|
validators3.transitional = function transitional2(validator, version, message) {
|
|
function formatMessage(opt, desc) {
|
|
return "[Axios v" + VERSION3 + "] Transitional option '" + opt + "'" + desc + (message ? ". " + message : "");
|
|
}
|
|
return function(value, opt, opts) {
|
|
if (validator === false) {
|
|
throw new Error(formatMessage(opt, " has been removed" + (version ? " in " + version : "")));
|
|
}
|
|
if (version && !deprecatedWarnings2[opt]) {
|
|
deprecatedWarnings2[opt] = true;
|
|
console.warn(
|
|
formatMessage(
|
|
opt,
|
|
" has been deprecated since v" + version + " and will be removed in the near future"
|
|
)
|
|
);
|
|
}
|
|
return validator ? validator(value, opt, opts) : true;
|
|
};
|
|
};
|
|
function assertOptions2(options, schema, allowUnknown) {
|
|
if (typeof options !== "object") {
|
|
throw new TypeError("options must be an object");
|
|
}
|
|
var keys2 = Object.keys(options);
|
|
var i = keys2.length;
|
|
while (i-- > 0) {
|
|
var opt = keys2[i];
|
|
var validator = schema[opt];
|
|
if (validator) {
|
|
var value = options[opt];
|
|
var result = value === void 0 || validator(value, opt, options);
|
|
if (result !== true) {
|
|
throw new TypeError("option " + opt + " must be " + result);
|
|
}
|
|
continue;
|
|
}
|
|
if (allowUnknown !== true) {
|
|
throw Error("Unknown option " + opt);
|
|
}
|
|
}
|
|
}
|
|
module.exports = {
|
|
assertOptions: assertOptions2,
|
|
validators: validators3
|
|
};
|
|
}
|
|
});
|
|
var require_Axios = __commonJS2({
|
|
"../../node_modules/axios/lib/core/Axios.js"(exports, module) {
|
|
"use strict";
|
|
var utils = require_utils();
|
|
var buildURL2 = require_buildURL();
|
|
var InterceptorManager2 = require_InterceptorManager();
|
|
var dispatchRequest2 = require_dispatchRequest();
|
|
var mergeConfig3 = require_mergeConfig();
|
|
var validator = require_validator();
|
|
var validators3 = validator.validators;
|
|
function Axios3(instanceConfig) {
|
|
this.defaults = instanceConfig;
|
|
this.interceptors = {
|
|
request: new InterceptorManager2(),
|
|
response: new InterceptorManager2()
|
|
};
|
|
}
|
|
Axios3.prototype.request = function request(config3) {
|
|
if (typeof config3 === "string") {
|
|
config3 = arguments[1] || {};
|
|
config3.url = arguments[0];
|
|
} else {
|
|
config3 = config3 || {};
|
|
}
|
|
config3 = mergeConfig3(this.defaults, config3);
|
|
if (config3.method) {
|
|
config3.method = config3.method.toLowerCase();
|
|
} else if (this.defaults.method) {
|
|
config3.method = this.defaults.method.toLowerCase();
|
|
} else {
|
|
config3.method = "get";
|
|
}
|
|
var transitional2 = config3.transitional;
|
|
if (transitional2 !== void 0) {
|
|
validator.assertOptions(transitional2, {
|
|
silentJSONParsing: validators3.transitional(validators3.boolean),
|
|
forcedJSONParsing: validators3.transitional(validators3.boolean),
|
|
clarifyTimeoutError: validators3.transitional(validators3.boolean)
|
|
}, false);
|
|
}
|
|
var requestInterceptorChain = [];
|
|
var synchronousRequestInterceptors = true;
|
|
this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
|
|
if (typeof interceptor.runWhen === "function" && interceptor.runWhen(config3) === false) {
|
|
return;
|
|
}
|
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
});
|
|
var responseInterceptorChain = [];
|
|
this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
|
|
responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
});
|
|
var promise;
|
|
if (!synchronousRequestInterceptors) {
|
|
var chain = [dispatchRequest2, void 0];
|
|
Array.prototype.unshift.apply(chain, requestInterceptorChain);
|
|
chain = chain.concat(responseInterceptorChain);
|
|
promise = Promise.resolve(config3);
|
|
while (chain.length) {
|
|
promise = promise.then(chain.shift(), chain.shift());
|
|
}
|
|
return promise;
|
|
}
|
|
var newConfig = config3;
|
|
while (requestInterceptorChain.length) {
|
|
var onFulfilled = requestInterceptorChain.shift();
|
|
var onRejected = requestInterceptorChain.shift();
|
|
try {
|
|
newConfig = onFulfilled(newConfig);
|
|
} catch (error) {
|
|
onRejected(error);
|
|
break;
|
|
}
|
|
}
|
|
try {
|
|
promise = dispatchRequest2(newConfig);
|
|
} catch (error) {
|
|
return Promise.reject(error);
|
|
}
|
|
while (responseInterceptorChain.length) {
|
|
promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());
|
|
}
|
|
return promise;
|
|
};
|
|
Axios3.prototype.getUri = function getUri(config3) {
|
|
config3 = mergeConfig3(this.defaults, config3);
|
|
return buildURL2(config3.url, config3.params, config3.paramsSerializer).replace(/^\?/, "");
|
|
};
|
|
utils.forEach(["delete", "get", "head", "options"], function forEachMethodNoData2(method) {
|
|
Axios3.prototype[method] = function(url, config3) {
|
|
return this.request(mergeConfig3(config3 || {}, {
|
|
method,
|
|
url,
|
|
data: (config3 || {}).data
|
|
}));
|
|
};
|
|
});
|
|
utils.forEach(["post", "put", "patch"], function forEachMethodWithData2(method) {
|
|
Axios3.prototype[method] = function(url, data, config3) {
|
|
return this.request(mergeConfig3(config3 || {}, {
|
|
method,
|
|
url,
|
|
data
|
|
}));
|
|
};
|
|
});
|
|
module.exports = Axios3;
|
|
}
|
|
});
|
|
var require_CancelToken = __commonJS2({
|
|
"../../node_modules/axios/lib/cancel/CancelToken.js"(exports, module) {
|
|
"use strict";
|
|
var Cancel2 = require_Cancel();
|
|
function CancelToken22(executor) {
|
|
if (typeof executor !== "function") {
|
|
throw new TypeError("executor must be a function.");
|
|
}
|
|
var resolvePromise;
|
|
this.promise = new Promise(function promiseExecutor(resolve) {
|
|
resolvePromise = resolve;
|
|
});
|
|
var token = this;
|
|
this.promise.then(function(cancel) {
|
|
if (!token._listeners)
|
|
return;
|
|
var i;
|
|
var l = token._listeners.length;
|
|
for (i = 0; i < l; i++) {
|
|
token._listeners[i](cancel);
|
|
}
|
|
token._listeners = null;
|
|
});
|
|
this.promise.then = function(onfulfilled) {
|
|
var _resolve;
|
|
var promise = new Promise(function(resolve) {
|
|
token.subscribe(resolve);
|
|
_resolve = resolve;
|
|
}).then(onfulfilled);
|
|
promise.cancel = function reject() {
|
|
token.unsubscribe(_resolve);
|
|
};
|
|
return promise;
|
|
};
|
|
executor(function cancel(message) {
|
|
if (token.reason) {
|
|
return;
|
|
}
|
|
token.reason = new Cancel2(message);
|
|
resolvePromise(token.reason);
|
|
});
|
|
}
|
|
CancelToken22.prototype.throwIfRequested = function throwIfRequested() {
|
|
if (this.reason) {
|
|
throw this.reason;
|
|
}
|
|
};
|
|
CancelToken22.prototype.subscribe = function subscribe(listener4) {
|
|
if (this.reason) {
|
|
listener4(this.reason);
|
|
return;
|
|
}
|
|
if (this._listeners) {
|
|
this._listeners.push(listener4);
|
|
} else {
|
|
this._listeners = [listener4];
|
|
}
|
|
};
|
|
CancelToken22.prototype.unsubscribe = function unsubscribe(listener4) {
|
|
if (!this._listeners) {
|
|
return;
|
|
}
|
|
var index = this._listeners.indexOf(listener4);
|
|
if (index !== -1) {
|
|
this._listeners.splice(index, 1);
|
|
}
|
|
};
|
|
CancelToken22.source = function source() {
|
|
var cancel;
|
|
var token = new CancelToken22(function executor(c) {
|
|
cancel = c;
|
|
});
|
|
return {
|
|
token,
|
|
cancel
|
|
};
|
|
};
|
|
module.exports = CancelToken22;
|
|
}
|
|
});
|
|
var require_spread = __commonJS2({
|
|
"../../node_modules/axios/lib/helpers/spread.js"(exports, module) {
|
|
"use strict";
|
|
module.exports = function spread3(callback) {
|
|
return function wrap(arr) {
|
|
return callback.apply(null, arr);
|
|
};
|
|
};
|
|
}
|
|
});
|
|
var require_isAxiosError = __commonJS2({
|
|
"../../node_modules/axios/lib/helpers/isAxiosError.js"(exports, module) {
|
|
"use strict";
|
|
module.exports = function isAxiosError22(payload) {
|
|
return typeof payload === "object" && payload.isAxiosError === true;
|
|
};
|
|
}
|
|
});
|
|
var require_axios = __commonJS2({
|
|
"../../node_modules/axios/lib/axios.js"(exports, module) {
|
|
"use strict";
|
|
var utils = require_utils();
|
|
var bind2 = require_bind();
|
|
var Axios3 = require_Axios();
|
|
var mergeConfig3 = require_mergeConfig();
|
|
var defaults2 = require_defaults();
|
|
function createInstance2(defaultConfig) {
|
|
var context = new Axios3(defaultConfig);
|
|
var instance = bind2(Axios3.prototype.request, context);
|
|
utils.extend(instance, Axios3.prototype, context);
|
|
utils.extend(instance, context);
|
|
instance.create = function create(instanceConfig) {
|
|
return createInstance2(mergeConfig3(defaultConfig, instanceConfig));
|
|
};
|
|
return instance;
|
|
}
|
|
var axios4 = createInstance2(defaults2);
|
|
axios4.Axios = Axios3;
|
|
axios4.Cancel = require_Cancel();
|
|
axios4.CancelToken = require_CancelToken();
|
|
axios4.isCancel = require_isCancel();
|
|
axios4.VERSION = require_data().version;
|
|
axios4.all = function all3(promises) {
|
|
return Promise.all(promises);
|
|
};
|
|
axios4.spread = require_spread();
|
|
axios4.isAxiosError = require_isAxiosError();
|
|
module.exports = axios4;
|
|
module.exports.default = axios4;
|
|
}
|
|
});
|
|
var require_axios2 = __commonJS2({
|
|
"../../node_modules/axios/index.js"(exports, module) {
|
|
module.exports = require_axios();
|
|
}
|
|
});
|
|
var require_pkce = __commonJS2({
|
|
"../../node_modules/@navigraph/pkce/index.js"(exports, module) {
|
|
function sha256(r) {
|
|
function t(r2, t2) {
|
|
return r2 >>> t2 | r2 << 32 - t2;
|
|
}
|
|
for (var h, n, o = Math.pow, e = o(2, 32), f = "", a = [], l = 8 * r.length, g = sha256.h = sha256.h || [], c = sha256.k = sha256.k || [], i = c.length, s = {}, u = 2; i < 64; u++)
|
|
if (!s[u]) {
|
|
for (h = 0; h < 313; h += u)
|
|
s[h] = u;
|
|
g[i] = o(u, 0.5) * e | 0, c[i++] = o(u, 1 / 3) * e | 0;
|
|
}
|
|
for (r += "\x80"; r.length % 64 - 56; )
|
|
r += "\0";
|
|
for (h = 0; h < r.length; h++) {
|
|
if ((n = r.charCodeAt(h)) >> 8)
|
|
return;
|
|
a[h >> 2] |= n << (3 - h) % 4 * 8;
|
|
}
|
|
for (a[a.length] = l / e | 0, a[a.length] = l, n = 0; n < a.length; ) {
|
|
var v = a.slice(n, n += 16), k = g;
|
|
for (g = g.slice(0, 8), h = 0; h < 64; h++) {
|
|
var d2 = v[h - 15], p2 = v[h - 2], w2 = g[0], A = g[4], C = g[7] + (t(A, 6) ^ t(A, 11) ^ t(A, 25)) + (A & g[5] ^ ~A & g[6]) + c[h] + (v[h] = h < 16 ? v[h] : v[h - 16] + (t(d2, 7) ^ t(d2, 18) ^ d2 >>> 3) + v[h - 7] + (t(p2, 17) ^ t(p2, 19) ^ p2 >>> 10) | 0);
|
|
(g = [C + ((t(w2, 2) ^ t(w2, 13) ^ t(w2, 22)) + (w2 & g[1] ^ w2 & g[2] ^ g[1] & g[2])) | 0].concat(g))[4] = g[4] + C | 0;
|
|
}
|
|
for (h = 0; h < 8; h++)
|
|
g[h] = g[h] + k[h] | 0;
|
|
}
|
|
for (h = 0; h < 8; h++)
|
|
for (n = 3; n + 1; n--) {
|
|
var M = g[h] >> 8 * n & 255;
|
|
f += (M < 16 ? 0 : "") + M.toString(16);
|
|
}
|
|
return f;
|
|
}
|
|
function getRandomBytes(length) {
|
|
const bytes = new Uint8Array(length);
|
|
window.crypto.getRandomValues(bytes);
|
|
return bytes;
|
|
}
|
|
function arrayBufferToBase64(buffer) {
|
|
const bytes = new Uint8Array(buffer);
|
|
const binary = bytes.reduce((previousValue, currentValue) => {
|
|
return previousValue + String.fromCharCode(currentValue);
|
|
}, "");
|
|
return btoa(binary);
|
|
}
|
|
function base64URLEncode(str) {
|
|
return arrayBufferToBase64(str).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
}
|
|
function hexStringToBytes(str) {
|
|
return Array.from(str.match(/.{1,2}/g), (byte) => {
|
|
return parseInt(byte, 16);
|
|
});
|
|
}
|
|
function pkce2() {
|
|
if (typeof window !== "object") {
|
|
throw new Error("This code is only meant to run in a browser environment.");
|
|
}
|
|
const verifier = base64URLEncode(getRandomBytes(32));
|
|
const challenge = base64URLEncode(hexStringToBytes(sha256(verifier)));
|
|
return { "code_verifier": verifier, "code_challenge": challenge };
|
|
}
|
|
module.exports = pkce2;
|
|
}
|
|
});
|
|
Promise.prototype.finally || (Promise.prototype.finally = function(t) {
|
|
if ("function" != typeof t)
|
|
return this.then(t, t);
|
|
const e = this.constructor || Promise;
|
|
return this.then((o) => e.resolve(t()).then(() => o), (o) => e.resolve(t()).then(() => {
|
|
throw o;
|
|
}));
|
|
});
|
|
var import_axios22 = __toESM2(require_axios2());
|
|
var import_axios3 = __toESM2(require_axios2());
|
|
var IDENTITY_DEVICE_AUTH_ENDPOINT = "/connect/deviceauthorization";
|
|
var IDENTITY_TOKEN_ENDPOINT = "/connect/token";
|
|
var IDENTITY_REVOCATION_ENDPOINT = "/connect/revocation";
|
|
var getIdentityApiRoot = () => `https://identity.api.${getDefaultAppDomain()}`;
|
|
var getIdentityDeviceAuthEndpoint = () => getIdentityApiRoot() + IDENTITY_DEVICE_AUTH_ENDPOINT;
|
|
var getIdentityRevocationEndpoint = () => getIdentityApiRoot() + IDENTITY_REVOCATION_ENDPOINT;
|
|
var getIdentityTokenEndpoint = () => getIdentityApiRoot() + IDENTITY_TOKEN_ENDPOINT;
|
|
var keys = {
|
|
accessToken: "access_token",
|
|
refreshToken: "refresh_token"
|
|
};
|
|
var STORAGE = {
|
|
getItem: () => null,
|
|
setItem: () => void 0
|
|
};
|
|
var tokenStorage = {
|
|
getAccessToken: () => STORAGE.getItem(keys.accessToken),
|
|
getRefreshToken: () => STORAGE.getItem(keys.refreshToken),
|
|
setAccessToken: (accessToken) => STORAGE.setItem(keys.accessToken, accessToken != null ? accessToken : ""),
|
|
setRefreshToken: (refreshToken) => STORAGE.setItem(keys.refreshToken, refreshToken != null ? refreshToken : ""),
|
|
setStorage: (newStorage) => STORAGE = newStorage,
|
|
setStorageKeys: (newKeys) => keys = __spreadValues3(__spreadValues3({}, keys), newKeys)
|
|
};
|
|
function isDecodedToken(payload) {
|
|
return typeof payload === "object" && payload !== null && "sub" in payload;
|
|
}
|
|
function decodeAccessToken(token) {
|
|
try {
|
|
const decoded = JSON.parse(atob(token.split(".")[1]));
|
|
return isDecodedToken(decoded) ? decoded : null;
|
|
} catch (e) {
|
|
return null;
|
|
}
|
|
}
|
|
function decodeUser(token) {
|
|
if (!token) {
|
|
Logger_default.warning("Tried to parse user without access token.");
|
|
return null;
|
|
}
|
|
const userFields = ["preferred_username", "scope", "sub", "subscriptions"];
|
|
const decodedToken = decodeAccessToken(token);
|
|
if (!decodedToken)
|
|
return null;
|
|
return userFields.reduce((acc, field) => __spreadProps2(__spreadValues3({}, acc), { [field]: decodedToken[field] }), {});
|
|
}
|
|
function getId() {
|
|
return `${Date.now()}:${Math.random()}`;
|
|
}
|
|
function runWithLock(_0, _1) {
|
|
return __async(this, arguments, function* (key, fn, { timeout = 1e3, lockWriteTime = 50, checkTime = 10, retry = true } = {}) {
|
|
const timerRunWithLock = () => __async(this, null, function* () {
|
|
return new Promise(
|
|
(r) => setTimeout(() => __async(this, null, function* () {
|
|
yield runWithLock.bind(null, key, fn, { timeout, lockWriteTime, checkTime, retry })();
|
|
r();
|
|
}), checkTime)
|
|
);
|
|
});
|
|
const result = yield STORAGE.getItem(key);
|
|
if (result) {
|
|
const data = JSON.parse(result);
|
|
if (data.time >= Date.now() - timeout) {
|
|
if (retry)
|
|
yield timerRunWithLock();
|
|
return;
|
|
} else {
|
|
yield STORAGE.setItem(key, "");
|
|
}
|
|
}
|
|
const id = getId();
|
|
yield STORAGE.setItem(key, JSON.stringify({ id, time: Date.now() }));
|
|
yield new Promise(
|
|
(r) => setTimeout(() => __async(this, null, function* () {
|
|
const currentResult = yield STORAGE.getItem(key);
|
|
if (!currentResult)
|
|
return;
|
|
const data = JSON.parse(currentResult);
|
|
if (data.id !== id) {
|
|
if (retry)
|
|
yield timerRunWithLock();
|
|
r();
|
|
return;
|
|
}
|
|
try {
|
|
yield fn();
|
|
} finally {
|
|
yield STORAGE.setItem(key, "");
|
|
}
|
|
r();
|
|
}), lockWriteTime)
|
|
);
|
|
});
|
|
}
|
|
var verifyUserPromise = null;
|
|
function verifyUser() {
|
|
return __async(this, null, function* () {
|
|
const app2 = getApp();
|
|
if (!app2)
|
|
throw new NotInitializedError("Auth");
|
|
if (verifyUserPromise) {
|
|
Logger_default.debug("Found ongoing verification request, returning promise early");
|
|
return verifyUserPromise;
|
|
}
|
|
verifyUserPromise = new Promise((resolve, reject) => {
|
|
runWithLock("NAVIGRAPH_SDK_INIT", () => __async(this, null, function* () {
|
|
const REFRESH_TOKEN = yield tokenStorage.getRefreshToken();
|
|
if (REFRESH_TOKEN) {
|
|
yield requestToken({
|
|
client_id: app2.clientId,
|
|
client_secret: app2.clientSecret,
|
|
grant_type: "refresh_token",
|
|
refresh_token: REFRESH_TOKEN
|
|
}).catch(reject);
|
|
}
|
|
resolve(USER);
|
|
})).catch(reject).finally(() => verifyUserPromise = null);
|
|
});
|
|
return verifyUserPromise;
|
|
});
|
|
}
|
|
var USER = null;
|
|
var USER_LISTENERS = {
|
|
listeners: /* @__PURE__ */ new Set(),
|
|
add(listener4) {
|
|
this.listeners.add(listener4);
|
|
},
|
|
remove(listener4) {
|
|
this.listeners.delete(listener4);
|
|
},
|
|
notify(user) {
|
|
this.listeners.forEach((listener4) => listener4(user));
|
|
}
|
|
};
|
|
function setUser(user) {
|
|
USER = user;
|
|
USER_LISTENERS.notify(user);
|
|
}
|
|
function getUser(verify) {
|
|
return verify ? verifyUser() : USER;
|
|
}
|
|
var requests = /* @__PURE__ */ new Map();
|
|
function requestToken(params, cancelToken) {
|
|
return __async(this, null, function* () {
|
|
const app2 = getApp();
|
|
if (!app2)
|
|
throw new NotInitializedError("Auth");
|
|
const key = JSON.stringify(params);
|
|
const ongoingRequest = requests.get(key);
|
|
if (ongoingRequest) {
|
|
Logger_default.debug("Found ongoing request with key " + key);
|
|
return ongoingRequest;
|
|
}
|
|
Logger_default.debug("No ongoing request found with key " + key);
|
|
const requestPromise = import_axios3.default.post(getIdentityTokenEndpoint(), new URLSearchParams(params), {
|
|
cancelToken,
|
|
withCredentials: app2.scopes.includes(Scope.TILES) ? true : void 0,
|
|
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
}).then((_0) => __async(this, [_0], function* ({ data }) {
|
|
if (data.access_token && data.refresh_token) {
|
|
yield tokenStorage.setAccessToken(data.access_token);
|
|
yield tokenStorage.setRefreshToken(data.refresh_token);
|
|
setUser(decodeUser(data.access_token));
|
|
}
|
|
return data;
|
|
})).catch((err) => {
|
|
if (import_axios3.default.isCancel(err))
|
|
throw new AuthenticationAbortedError();
|
|
throw err;
|
|
}).finally(() => requests.delete(key));
|
|
requests.set(key, requestPromise);
|
|
return requestPromise;
|
|
});
|
|
}
|
|
function revokeToken(refreshToken) {
|
|
return __async(this, null, function* () {
|
|
const app2 = getApp();
|
|
if (!app2)
|
|
throw new NotInitializedError("Token Revocation");
|
|
return navigraphRequest.post(
|
|
getIdentityRevocationEndpoint(),
|
|
new URLSearchParams({
|
|
client_id: app2.clientId,
|
|
client_secret: app2.clientSecret,
|
|
token__type_hint: "refresh_token",
|
|
token: refreshToken
|
|
})
|
|
).catch(() => Logger_default.warning("Failed to revoke token on signout"));
|
|
});
|
|
}
|
|
function signOut() {
|
|
return __async(this, null, function* () {
|
|
const REFRESH_TOKEN = yield tokenStorage.getRefreshToken();
|
|
if (REFRESH_TOKEN)
|
|
yield revokeToken(REFRESH_TOKEN);
|
|
yield tokenStorage.setAccessToken();
|
|
yield tokenStorage.setRefreshToken();
|
|
setUser(null);
|
|
});
|
|
}
|
|
var isAxiosError3 = (payload) => import_axios22.default.isAxiosError(payload);
|
|
var CancelToken3 = import_axios22.default.CancelToken;
|
|
var navigraphRequest = import_axios22.default.create();
|
|
navigraphRequest.interceptors.request.use((config3) => __async(void 0, null, function* () {
|
|
const token = yield tokenStorage.getAccessToken();
|
|
if (token) {
|
|
config3.headers = __spreadProps2(__spreadValues3({}, config3.headers), {
|
|
Authorization: `Bearer ${token}`
|
|
});
|
|
}
|
|
return config3;
|
|
}));
|
|
navigraphRequest.interceptors.response.use(
|
|
(res) => res,
|
|
(error) => __async(void 0, null, function* () {
|
|
var _a;
|
|
const app2 = getApp();
|
|
const REFRESH_TOKEN = yield tokenStorage.getRefreshToken();
|
|
if (app2 && ((_a = error == null ? void 0 : error.response) == null ? void 0 : _a.status) === 401 && REFRESH_TOKEN) {
|
|
const tokenResponse = yield requestToken({
|
|
client_id: app2.clientId,
|
|
client_secret: app2.clientSecret,
|
|
grant_type: "refresh_token",
|
|
refresh_token: REFRESH_TOKEN
|
|
});
|
|
if (tokenResponse.refresh_token) {
|
|
yield tokenStorage.setAccessToken(tokenResponse.access_token);
|
|
yield tokenStorage.setRefreshToken(tokenResponse.refresh_token);
|
|
return import_axios22.default.request(__spreadProps2(__spreadValues3({}, error.config), {
|
|
headers: {
|
|
Authorization: "Bearer " + tokenResponse.access_token
|
|
}
|
|
}));
|
|
}
|
|
signOut().catch((e) => Logger_default.warning("Failed to sign out after a token refresh failure", e));
|
|
}
|
|
throw error;
|
|
})
|
|
);
|
|
var import_pkce = __toESM2(require_pkce());
|
|
var import_axios32 = __toESM2(require_axios2());
|
|
function signInWithDeviceFlow(callback, cancelToken) {
|
|
return __async(this, null, function* () {
|
|
const app2 = getApp();
|
|
if (!app2) {
|
|
throw new NotInitializedError("Auth");
|
|
}
|
|
const { code_verifier, code_challenge } = (0, import_pkce.default)();
|
|
const response = yield import_axios32.default.post(
|
|
getIdentityDeviceAuthEndpoint(),
|
|
new URLSearchParams({
|
|
client_id: app2.clientId,
|
|
client_secret: app2.clientSecret,
|
|
code_challenge,
|
|
code_challenge_method: "S256"
|
|
}),
|
|
{ headers: { "Content-Type": "application/x-www-form-urlencoded" } }
|
|
).catch((err) => {
|
|
var _a;
|
|
const status = (_a = err.response) == null ? void 0 : _a.status;
|
|
return status && status < 500 ? new InvalidClientError() : new Error(`Unable to sign in with device flow. ${err.message}`);
|
|
});
|
|
if (response instanceof Error) {
|
|
throw response;
|
|
}
|
|
const { verification_uri, verification_uri_complete, user_code, interval } = response.data;
|
|
if (callback) {
|
|
callback({
|
|
verification_uri,
|
|
verification_uri_complete,
|
|
user_code
|
|
});
|
|
}
|
|
const tokens = yield poll(app2, __spreadProps2(__spreadValues3({}, response.data), { interval: interval * 1e3, code_verifier }), cancelToken);
|
|
return decodeUser(tokens.access_token);
|
|
});
|
|
}
|
|
function poll(app2, params, cancelToken, attempts = 0) {
|
|
return __async(this, null, function* () {
|
|
var _a;
|
|
yield new Promise((resolve) => setTimeout(resolve, params.interval));
|
|
try {
|
|
const response = yield requestToken(
|
|
{
|
|
client_id: app2.clientId,
|
|
client_secret: app2.clientSecret,
|
|
code_verifier: params.code_verifier,
|
|
device_code: params.device_code,
|
|
grant_type: "urn:ietf:params:oauth:grant-type:device_code",
|
|
scope: app2.scopes.join(" ")
|
|
},
|
|
cancelToken
|
|
);
|
|
return response;
|
|
} catch (exception) {
|
|
if (import_axios32.default.isAxiosError(exception)) {
|
|
const { error } = (_a = exception.response) == null ? void 0 : _a.data;
|
|
switch (error) {
|
|
case "slow_down":
|
|
attempts++;
|
|
params.interval += 5e3;
|
|
return poll(app2, params, cancelToken, attempts);
|
|
case "authorization_pending":
|
|
attempts++;
|
|
return poll(app2, params, cancelToken, attempts);
|
|
case "access_denied":
|
|
throw new UserDeniedAccessError();
|
|
case "expired_token":
|
|
throw new DeviceFlowTokenExpiredError();
|
|
case "invalid_scope":
|
|
throw new InvalidScopeError();
|
|
default:
|
|
throw new Error("An unknown error ocurred: " + error);
|
|
}
|
|
} else {
|
|
throw exception;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
var INITIALIZED = false;
|
|
function loadPersistedCredentials() {
|
|
return __async(this, null, function* () {
|
|
if (INITIALIZED)
|
|
return Promise.resolve();
|
|
yield verifyUser().catch((e) => {
|
|
Logger_default.warning("Failed to load persisted credentials", e);
|
|
signOut().catch((e2) => Logger_default.warning("Failed to sign out after failed initialization attempt", e2));
|
|
});
|
|
INITIALIZED = true;
|
|
});
|
|
}
|
|
function getAuth({ keys: keys2, storage } = {}) {
|
|
if (typeof localStorage === "undefined" && !storage) {
|
|
Logger_default.warning("No storage API available in your environment. Please provide a custom tokenStorage implementation.");
|
|
}
|
|
if (storage) {
|
|
tokenStorage.setStorage(storage);
|
|
} else if (typeof localStorage !== "undefined") {
|
|
tokenStorage.setStorage(localStorage);
|
|
}
|
|
if (keys2)
|
|
tokenStorage.setStorageKeys(keys2);
|
|
const app2 = getApp();
|
|
if (!app2)
|
|
throw new NotInitializedError("Auth");
|
|
const initPromise = loadPersistedCredentials();
|
|
return {
|
|
onAuthStateChanged: (callback, initialNotify = true) => {
|
|
const promise = INITIALIZED ? Promise.resolve() : initPromise;
|
|
promise.then(() => {
|
|
initialNotify && callback(USER);
|
|
USER_LISTENERS.add(callback);
|
|
});
|
|
return () => USER_LISTENERS.remove(callback);
|
|
},
|
|
signOut,
|
|
getUser,
|
|
signInWithDeviceFlow,
|
|
isInitialized: () => INITIALIZED
|
|
};
|
|
}
|
|
|
|
// node_modules/@navigraph/charts/dist/index.esm.js
|
|
var __defProp5 = Object.defineProperty;
|
|
var __getOwnPropSymbols4 = Object.getOwnPropertySymbols;
|
|
var __hasOwnProp4 = Object.prototype.hasOwnProperty;
|
|
var __propIsEnum4 = Object.prototype.propertyIsEnumerable;
|
|
var __defNormalProp5 = (obj, key, value) => key in obj ? __defProp5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
var __spreadValues4 = (a, b) => {
|
|
for (var prop in b || (b = {}))
|
|
if (__hasOwnProp4.call(b, prop))
|
|
__defNormalProp5(a, prop, b[prop]);
|
|
if (__getOwnPropSymbols4)
|
|
for (var prop of __getOwnPropSymbols4(b)) {
|
|
if (__propIsEnum4.call(b, prop))
|
|
__defNormalProp5(a, prop, b[prop]);
|
|
}
|
|
return a;
|
|
};
|
|
var __async2 = (__this, __arguments, generator) => {
|
|
return new Promise((resolve, reject) => {
|
|
var fulfilled = (value) => {
|
|
try {
|
|
step(generator.next(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var rejected = (value) => {
|
|
try {
|
|
step(generator.throw(value));
|
|
} catch (e) {
|
|
reject(e);
|
|
}
|
|
};
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
});
|
|
};
|
|
var ApproachChartTypeCode = /* @__PURE__ */ ((ApproachChartTypeCode2) => {
|
|
ApproachChartTypeCode2["ILSApproachChart"] = "01";
|
|
ApproachChartTypeCode2["PARApproachChart"] = "02";
|
|
ApproachChartTypeCode2["VORApproachChart"] = "03";
|
|
ApproachChartTypeCode2["TACANApproachChart"] = "04";
|
|
ApproachChartTypeCode2["NonPrecisionHelicopterApproachChart"] = "05";
|
|
ApproachChartTypeCode2["NDBApproachChart"] = "06";
|
|
ApproachChartTypeCode2["DFApproachChart"] = "07";
|
|
ApproachChartTypeCode2["ASRApproachChart"] = "08";
|
|
ApproachChartTypeCode2["VORDMERNAVApproachChart"] = "09";
|
|
ApproachChartTypeCode2["ILSSACatI"] = "11";
|
|
ApproachChartTypeCode2["PrecisionHelicopterApproachChart"] = "15";
|
|
ApproachChartTypeCode2["ILSCatIIApproachChart"] = "1A";
|
|
ApproachChartTypeCode2["ILSCatIIAndIIIAApproachChart"] = "1B";
|
|
ApproachChartTypeCode2["ILSCatIIAndIIIAAndBApproachChart"] = "1C";
|
|
ApproachChartTypeCode2["LOCApproachChart"] = "1D";
|
|
ApproachChartTypeCode2["LOCBackCrsApproachChart"] = "1E";
|
|
ApproachChartTypeCode2["LDAApproachChart"] = "1F";
|
|
ApproachChartTypeCode2["SDFApproachChart"] = "1G";
|
|
ApproachChartTypeCode2["MLSApproachChart"] = "1H";
|
|
ApproachChartTypeCode2["VisualApproachChartExcludesCvfps"] = "1J";
|
|
ApproachChartTypeCode2["VicinityChart"] = "1K";
|
|
ApproachChartTypeCode2["RNAVApproachChartExcludesVORDMERNAV"] = "1L";
|
|
ApproachChartTypeCode2["SoleUseGpsNonPrecisionApproachChartExcludes"] = "1M";
|
|
ApproachChartTypeCode2["SoleUseFmsApproachChart"] = "1N";
|
|
ApproachChartTypeCode2["ILSSACatII"] = "1P";
|
|
ApproachChartTypeCode2["ILSApproachOrGpsChart"] = "21";
|
|
ApproachChartTypeCode2["PARApproachOrGpsChart"] = "22";
|
|
ApproachChartTypeCode2["VORApproachOrGpsChart"] = "23";
|
|
ApproachChartTypeCode2["TACANApproachOrGpsChart"] = "24";
|
|
ApproachChartTypeCode2["HelicopterApproachOrGpsChart"] = "25";
|
|
ApproachChartTypeCode2["NDBApproachOrGpsChart"] = "26";
|
|
ApproachChartTypeCode2["DFApproachOrGpsChart"] = "27";
|
|
ApproachChartTypeCode2["ASRApproachOrGpsChart"] = "28";
|
|
ApproachChartTypeCode2["VORDMERNAVApproachOrGpsChart"] = "29";
|
|
ApproachChartTypeCode2["ILSCatIIApproachOrGpsChart"] = "2A";
|
|
ApproachChartTypeCode2["ILSCatIIAndIIIAApproachOrGpsChart"] = "2B";
|
|
ApproachChartTypeCode2["ILSCatIiAndIiiAAndBApproachOrGpsChart"] = "2C";
|
|
ApproachChartTypeCode2["LOCApproachOrGpsChart"] = "2D";
|
|
ApproachChartTypeCode2["LOCBackCrsApproachOrGpsChart"] = "2E";
|
|
ApproachChartTypeCode2["LDAApproachOrGpsChart"] = "2F";
|
|
ApproachChartTypeCode2["SDFApproachOrGpsChart"] = "2G";
|
|
ApproachChartTypeCode2["MLSApproachOrGpsChart"] = "2H";
|
|
ApproachChartTypeCode2["VisualApproachOrGpsChart"] = "2J";
|
|
ApproachChartTypeCode2["VicinityOrGpsChart"] = "2K";
|
|
ApproachChartTypeCode2["SoleUseFmsApproachOrGpsChart"] = "2N";
|
|
ApproachChartTypeCode2["RNPProcedures"] = "RP";
|
|
ApproachChartTypeCode2["GLSApproachCharts"] = "RS";
|
|
ApproachChartTypeCode2["VFRArrivalsAndDepartures"] = "VF";
|
|
return ApproachChartTypeCode2;
|
|
})(ApproachChartTypeCode || {});
|
|
var AirspaceChartTypeCode = /* @__PURE__ */ ((AirspaceChartTypeCode2) => {
|
|
AirspaceChartTypeCode2["AreaChart"] = "A";
|
|
AirspaceChartTypeCode2["ClassBTCAOrTMAChart"] = "B";
|
|
AirspaceChartTypeCode2["EnrouteVisualChart"] = "C";
|
|
AirspaceChartTypeCode2["CAOQuickReferenceChart"] = "FF";
|
|
return AirspaceChartTypeCode2;
|
|
})(AirspaceChartTypeCode || {});
|
|
var AirportChartTypeCode = /* @__PURE__ */ ((AirportChartTypeCode2) => {
|
|
AirportChartTypeCode2["AirportChart"] = "AP";
|
|
AirportChartTypeCode2["AirportFamiliarizationChart"] = "AF";
|
|
AirportChartTypeCode2["AirportQualificationChart"] = "AQ";
|
|
AirportChartTypeCode2["AirportBriefingChart"] = "P";
|
|
AirportChartTypeCode2["MiscAirportChart"] = "AA";
|
|
AirportChartTypeCode2["MiscGraphicChart"] = "MG";
|
|
AirportChartTypeCode2["NonAssignedTypeWillBeResearchedLater"] = "NA";
|
|
AirportChartTypeCode2["ColdTemperatureTable"] = "P1";
|
|
AirportChartTypeCode2["ParkingGatesSMGCSAndLowVisProcedureChart"] = "R";
|
|
AirportChartTypeCode2["NoseInParkingAndDockingCharts"] = "S";
|
|
return AirportChartTypeCode2;
|
|
})(AirportChartTypeCode || {});
|
|
var DepartureChartTypeCode = /* @__PURE__ */ ((DepartureChartTypeCode2) => {
|
|
DepartureChartTypeCode2["SIDOrDPChart"] = "G";
|
|
DepartureChartTypeCode2["SIDOrDPOrGPSChart"] = "G2";
|
|
DepartureChartTypeCode2["RNAVOrBothGPSAndFMSAuthorizedDepartureChar"] = "GG";
|
|
DepartureChartTypeCode2["RNPSIDOrDepartureChart"] = "GP";
|
|
DepartureChartTypeCode2["EngineOutProcedures"] = "EO";
|
|
DepartureChartTypeCode2["SoleUseFMSDepartureChart"] = "GH";
|
|
DepartureChartTypeCode2["OpsdataEngineFailureProcedure"] = "OP";
|
|
return DepartureChartTypeCode2;
|
|
})(DepartureChartTypeCode || {});
|
|
var ArrivalChartTypeCode = /* @__PURE__ */ ((ArrivalChartTypeCode2) => {
|
|
ArrivalChartTypeCode2["STARChart"] = "J";
|
|
ArrivalChartTypeCode2["STARChartOrGp"] = "J2";
|
|
ArrivalChartTypeCode2["RNAVOrBothGPSAndFMSAuthorizedArrivalChart"] = "JG";
|
|
ArrivalChartTypeCode2["SoleUseFMSArrivalChart"] = "JH";
|
|
ArrivalChartTypeCode2["RNPSTAROrArrivalChart"] = "JP";
|
|
return ArrivalChartTypeCode2;
|
|
})(ArrivalChartTypeCode || {});
|
|
var NoiseChartTypeCode = /* @__PURE__ */ ((NoiseChartTypeCode2) => {
|
|
NoiseChartTypeCode2["NoiseAbatementChart"] = "N";
|
|
return NoiseChartTypeCode2;
|
|
})(NoiseChartTypeCode || {});
|
|
var TextChartTypeCode = /* @__PURE__ */ ((TextChartTypeCode2) => {
|
|
TextChartTypeCode2["MiscTextPages"] = "ST";
|
|
TextChartTypeCode2["TerminalTextPages"] = "TP";
|
|
TextChartTypeCode2["TailoredTextPages"] = "TT";
|
|
return TextChartTypeCode2;
|
|
})(TextChartTypeCode || {});
|
|
var ChartTypeCode = __spreadValues4(__spreadValues4(__spreadValues4(__spreadValues4(__spreadValues4(__spreadValues4(__spreadValues4({}, AirportChartTypeCode), AirspaceChartTypeCode), ApproachChartTypeCode), DepartureChartTypeCode), ArrivalChartTypeCode), NoiseChartTypeCode), TextChartTypeCode);
|
|
var getChartsApiRoot = () => `https://api.${getDefaultAppDomain()}/v2/charts`;
|
|
var getAirportApiRoot = () => `https://api.${getDefaultAppDomain()}/v2/airport`;
|
|
function getAirportInfo(_0) {
|
|
return __async2(this, arguments, function* ({ icao }) {
|
|
const result = yield navigraphRequest.get(`${getAirportApiRoot()}/${icao}`).catch((e) => Logger_default.err("Failed to fetch airport information. Reason:", isAxiosError3(e) ? e.message : e));
|
|
return (result == null ? void 0 : result.data) || null;
|
|
});
|
|
}
|
|
function getChartImage(_0) {
|
|
return __async2(this, arguments, function* ({ chart, theme = "light" }) {
|
|
const imageUrl = theme === "light" ? chart.image_day_url : chart.image_night_url;
|
|
const result = yield navigraphRequest.get(imageUrl, {
|
|
responseType: "blob"
|
|
}).catch((e) => Logger_default.err("Failed to fetch charts image. Reason:", isAxiosError3(e) ? e.message : e));
|
|
return (result == null ? void 0 : result.data) || null;
|
|
});
|
|
}
|
|
function getChartsIndex(_0) {
|
|
return __async2(this, arguments, function* ({ icao, version = "STD" }) {
|
|
var _a;
|
|
const result = yield navigraphRequest.get(`${getChartsApiRoot()}/${icao}`, { params: { version } }).catch((e) => Logger_default.err("Failed to fetch charts index. Reason:", isAxiosError3(e) ? e.message : e));
|
|
return ((_a = result == null ? void 0 : result.data) == null ? void 0 : _a.charts) || null;
|
|
});
|
|
}
|
|
var getChartsAPI = () => {
|
|
const app2 = getApp();
|
|
if (!app2) {
|
|
throw new NotInitializedError("Auth");
|
|
} else if (!app2.scopes.includes(Scope.CHARTS)) {
|
|
Logger_default.warning(
|
|
"Your Navigraph Application does not have the CHARTS scope. Attempts to access the Charts API will fail."
|
|
);
|
|
}
|
|
return {
|
|
getChartsIndex,
|
|
getChartImage,
|
|
getAirportInfo
|
|
};
|
|
};
|
|
|
|
// src/routes/ChartPage.tsx
|
|
init_common();
|
|
var import_jsx_runtime9 = __toESM(require_jsx_runtime());
|
|
var config2 = {
|
|
clientId: "tfdi-md11",
|
|
clientSecret: "e2i0ExdZxCxkh5BPtqVuqHE4IJtpVFos",
|
|
scopes: [Scope.CHARTS]
|
|
};
|
|
initializeApp(config2);
|
|
var ChartsView = ({ chartBlob, width, height, close }) => {
|
|
let zoomLevel = 0;
|
|
let isDragging = false;
|
|
(0, import_react10.useEffect)(() => {
|
|
zoomLevel = 0;
|
|
setChartStyle(
|
|
getImageWidth() > getImageHeight() ? "landscape" : "portrait",
|
|
zoomLevel,
|
|
width,
|
|
height
|
|
);
|
|
}, [chartBlob]);
|
|
const getImageHeight = () => {
|
|
const image = document.getElementById("chart-image");
|
|
if (image) {
|
|
return image.clientHeight;
|
|
}
|
|
return 0;
|
|
};
|
|
const getImageWidth = () => {
|
|
const image = document.getElementById("chart-image");
|
|
if (image) {
|
|
return image.clientWidth;
|
|
}
|
|
return 0;
|
|
};
|
|
const zoomIn = () => {
|
|
const orientation = getImageWidth() > getImageHeight() ? "landscape" : "portrait";
|
|
const isMaxZoom = orientation === "portrait" ? getImageWidth() === width : getImageHeight() === height;
|
|
if (zoomLevel < 100 && !isMaxZoom) {
|
|
zoomLevel += 1;
|
|
const newChartWidth = orientation === "portrait" ? width : Math.round(width * (1 + zoomLevel * 0.1));
|
|
const newChartHeight = orientation === "portrait" ? Math.round(height * (1 + zoomLevel * 0.1)) : height;
|
|
setChartStyle(
|
|
orientation,
|
|
zoomLevel,
|
|
newChartWidth,
|
|
newChartHeight
|
|
);
|
|
}
|
|
};
|
|
const zoomOut = () => {
|
|
const orientation = getImageWidth() > getImageHeight() ? "landscape" : "portrait";
|
|
if (zoomLevel > -5) {
|
|
zoomLevel -= 1;
|
|
const newChartWidth = orientation === "portrait" ? width : Math.round(width * (1 + zoomLevel * 0.1));
|
|
const newChartHeight = orientation === "portrait" ? Math.round(height * (1 + zoomLevel * 0.1)) : height;
|
|
setChartStyle(
|
|
orientation,
|
|
zoomLevel,
|
|
newChartWidth,
|
|
newChartHeight
|
|
);
|
|
}
|
|
};
|
|
const setChartStyle = (orientation, zoomLevel2, chartWidth, chartHeight) => {
|
|
const chart = document.getElementById("chart");
|
|
if (chart) {
|
|
if (zoomLevel2 <= 0) {
|
|
chart.style.top = "50%";
|
|
chart.style.left = "50%";
|
|
chart.style.transform = "translate(-50%, -50%)";
|
|
chart.style.height = `${chartHeight}px`;
|
|
chart.style.width = `${chartWidth}px`;
|
|
} else {
|
|
chart.style.height = `${chartHeight}px`;
|
|
chart.style.width = `${chartWidth}px`;
|
|
chart.style.top = orientation === "landscape" ? "50%" : "0";
|
|
chart.style.left = orientation === "landscape" ? "0" : "50%";
|
|
chart.style.transform = orientation === "landscape" ? "translateY(-50%)" : "translateX(-50%)";
|
|
}
|
|
}
|
|
const image = document.getElementById("chart-image");
|
|
if (image) {
|
|
if (zoomLevel2 <= 0) {
|
|
image.style.maxHeight = "100%";
|
|
image.style.maxWidth = "100%";
|
|
image.style.top = "50%";
|
|
image.style.left = "50%";
|
|
image.style.transform = "translate(-50%, -50%)";
|
|
} else {
|
|
image.style.maxHeight = "100%";
|
|
image.style.maxWidth = "100%";
|
|
image.style.top = orientation === "landscape" ? "50%" : "0";
|
|
image.style.left = orientation === "landscape" ? "0" : "50%";
|
|
image.style.transform = orientation === "landscape" ? "translateY(-50%)" : "translateX(-50%)";
|
|
}
|
|
}
|
|
};
|
|
const handleChartDrag = (e) => {
|
|
e.preventDefault();
|
|
if (isDragging) {
|
|
const element = document.getElementById("chart-container");
|
|
element.scrollBy(-e.movementX, -e.movementY);
|
|
}
|
|
};
|
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
"div",
|
|
{
|
|
className: "cursor-draggable relative flex flex-col items-center justify-center overflow-scroll bg-navigraph-background",
|
|
style: {
|
|
height: `${height}px`,
|
|
width: `${width}px`
|
|
},
|
|
onMouseMove: handleChartDrag,
|
|
onMouseDown: () => isDragging = true,
|
|
onMouseUp: () => isDragging = false,
|
|
onMouseLeave: () => isDragging = false,
|
|
id: "chart-container",
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
"div",
|
|
{
|
|
className: "pointer-events-none absolute h-full w-full",
|
|
id: "chart",
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
"img",
|
|
{
|
|
className: "pointer-events-none absolute",
|
|
id: "chart-image",
|
|
src: URL.createObjectURL(chartBlob)
|
|
}
|
|
)
|
|
}
|
|
)
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "absolute right-4 top-16", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
"button",
|
|
{
|
|
onClick: () => close(),
|
|
className: "rounded bg-navigraph-sidebar px-2 py-1",
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FontAwesomeIcon, { icon: faXmark, size: "2x" })
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "absolute bottom-16 right-4 flex flex-col", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
"button",
|
|
{
|
|
onClick: () => zoomIn(),
|
|
className: "rounded bg-navigraph-sidebar p-2",
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FontAwesomeIcon, { icon: faMagnifyingGlassPlus })
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
"button",
|
|
{
|
|
onClick: () => zoomOut(),
|
|
className: "mt-4 rounded bg-navigraph-sidebar p-2",
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FontAwesomeIcon, { icon: faMagnifyingGlassMinus })
|
|
}
|
|
)
|
|
] })
|
|
] });
|
|
};
|
|
var ChartsComponent = ({ charts }) => {
|
|
let isDragging = false;
|
|
const chartListRef = (0, import_react10.useRef)(null);
|
|
const dispatch = useDispatch();
|
|
const airport = useSelector(
|
|
(state) => {
|
|
var _a;
|
|
return ((_a = state.router.route.params) == null ? void 0 : _a.icao) || state.charts.icao;
|
|
}
|
|
);
|
|
const tab = useSelector((state) => state.charts.tab);
|
|
const chartList = useSelector((state) => state.charts.chartList);
|
|
const chart = useSelector((state) => state.charts.chart);
|
|
const [chartListHeight, setChartListHeight] = (0, import_react10.useState)(0);
|
|
const chartRef = (0, import_react10.useRef)(null);
|
|
const [chartHeight, setChartHeight] = (0, import_react10.useState)(0);
|
|
const [chartWidth, setChartWidth] = (0, import_react10.useState)(0);
|
|
const [chartBlob, setChartBlob] = (0, import_react10.useState)(null);
|
|
(0, import_react10.useEffect)(() => {
|
|
if (airport) {
|
|
listCharts(airport);
|
|
}
|
|
if (chartListRef.current) {
|
|
setChartListHeight(chartListRef.current.clientHeight - 40);
|
|
}
|
|
if (chartRef.current) {
|
|
setChartHeight(chartRef.current.clientHeight);
|
|
setChartWidth(chartRef.current.clientWidth);
|
|
}
|
|
}, []);
|
|
(0, import_react10.useEffect)(() => {
|
|
if (chart) {
|
|
loadChart(chart);
|
|
}
|
|
}, [chart]);
|
|
const listCharts = async (icao) => {
|
|
try {
|
|
const chartsData = await charts.getChartsIndex({ icao });
|
|
if (chartsData) {
|
|
dispatch(
|
|
setChartList({
|
|
ref: chartsData.filter((c) => c.category === "REF"),
|
|
dep: chartsData.filter((c) => c.category === "DEP"),
|
|
arr: chartsData.filter((c) => c.category === "ARR"),
|
|
app: chartsData.filter((c) => c.category === "APP"),
|
|
apt: chartsData.filter((c) => c.category === "APT")
|
|
})
|
|
);
|
|
dispatch(setChart(null));
|
|
dispatch(setIcao(icao));
|
|
dispatch(setTab("arr"));
|
|
}
|
|
} catch (err) {
|
|
dispatch(
|
|
setToast({
|
|
type: "error",
|
|
message: "Failed to load charts"
|
|
})
|
|
);
|
|
}
|
|
};
|
|
const loadChart = (chart2) => {
|
|
charts.getChartImage({ chart: chart2, theme: "dark" }).then((b) => setChartBlob(b));
|
|
};
|
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex h-full w-full", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex h-full w-1/4 flex-col bg-navigraph-sidebar", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex w-full flex-row p-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
Input,
|
|
{
|
|
value: airport,
|
|
onChange: (e) => dispatch(setIcao(e)),
|
|
placeholder: "Airport ICAO",
|
|
className: "h-8 w-3/4 rounded-lg border border-white bg-gray-700 pl-1 text-xs focus:border-blue-600 focus:ring-blue-600"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex w-1/4 justify-end", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
"button",
|
|
{
|
|
className: "h-8 rounded-lg bg-green-500 px-2 py-1 hover:bg-green-700",
|
|
onClick: () => listCharts(airport),
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FontAwesomeIcon, { icon: faSearch })
|
|
}
|
|
) })
|
|
] }),
|
|
chartList ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mb-3 h-8 rounded-md bg-navigraph-background px-4", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex h-full w-full justify-evenly", children: [
|
|
chartList.arr.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
"button",
|
|
{
|
|
onClick: () => dispatch(setTab("arr")),
|
|
className: `mr-2 grow rounded-lg p-1 font-bold ${tab === "arr" ? "bg-green-500" : "bg-navigraph-background text-green-500 hover:bg-green-900"}`,
|
|
children: "STAR"
|
|
}
|
|
),
|
|
chartList.app.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
"button",
|
|
{
|
|
onClick: () => dispatch(setTab("app")),
|
|
className: `mr-2 grow rounded-lg p-1 font-bold ${tab === "app" ? "bg-amber-500" : "bg-navigraph-background text-amber-500 hover:bg-amber-900"}`,
|
|
children: "APP"
|
|
}
|
|
),
|
|
chartList.apt.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
"button",
|
|
{
|
|
onClick: () => dispatch(setTab("apt")),
|
|
className: `mr-2 grow rounded-lg p-1 font-bold ${tab === "apt" ? "bg-blue-500" : "bg-navigraph-background text-blue-500 hover:bg-blue-900"}`,
|
|
children: "TAXI"
|
|
}
|
|
),
|
|
chartList.dep.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
"button",
|
|
{
|
|
onClick: () => dispatch(setTab("dep")),
|
|
className: `mr-2 grow rounded-lg p-1 font-bold ${tab === "dep" ? "bg-pink-500" : "bg-navigraph-background text-pink-500 hover:bg-pink-900"}`,
|
|
children: "SID"
|
|
}
|
|
),
|
|
chartList.ref.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
"button",
|
|
{
|
|
onClick: () => dispatch(setTab("ref")),
|
|
className: `grow rounded-lg p-1 font-bold ${tab === "ref" ? "bg-purple-500" : "bg-navigraph-background text-purple-500 hover:bg-purple-900"}`,
|
|
children: "REF"
|
|
}
|
|
)
|
|
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, {}),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grow", ref: chartListRef, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
"div",
|
|
{
|
|
className: "overflow-y-auto",
|
|
style: { maxHeight: chartListHeight },
|
|
id: "nav-sidebar",
|
|
onMouseDown: () => isDragging = true,
|
|
onMouseUp: () => isDragging = false,
|
|
onMouseLeave: () => isDragging = false,
|
|
onMouseMove: (e) => {
|
|
if (isDragging) {
|
|
const element = document.getElementById("nav-sidebar");
|
|
element.scrollBy(0, -e.movementY);
|
|
}
|
|
},
|
|
children: tab && chartList[tab].length > 0 && chartList[tab].map((c) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
"button",
|
|
{
|
|
className: "w-full bg-navigraph-sidebar p-2 text-left hover:bg-gray-700",
|
|
onClick: () => dispatch(setChart(c)),
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: c.name }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "mb-2 text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("b", { children: c.index_number }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("hr", {})
|
|
]
|
|
},
|
|
c.id
|
|
))
|
|
}
|
|
) })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
"div",
|
|
{
|
|
className: "h-full w-3/4 bg-navigraph-background",
|
|
ref: chartRef,
|
|
children: [
|
|
!chartList ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex h-full flex-col place-content-center text-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h1", { className: "mb-3 text-5xl font-bold", children: "Select an airport" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-base", children: 'To get started, type an airport into the "Airport ICAO" box and press search!' })
|
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, {}),
|
|
chartBlob && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
ChartsView,
|
|
{
|
|
chartBlob,
|
|
close: () => {
|
|
setChartBlob(null);
|
|
dispatch(setChart(null));
|
|
},
|
|
width: chartWidth,
|
|
height: chartHeight
|
|
}
|
|
)
|
|
]
|
|
}
|
|
)
|
|
] });
|
|
};
|
|
function ChartPage() {
|
|
const [deviceFlowParams, setParams] = (0, import_react10.useState)(
|
|
null
|
|
);
|
|
const [user, setUser2] = (0, import_react10.useState)(null);
|
|
const [initialized, setinitialized] = (0, import_react10.useState)(false);
|
|
const navigraph = useSelector((state) => state.navigraph);
|
|
const charts = getChartsAPI();
|
|
const dispatch = useDispatch();
|
|
const auth = getAuth({
|
|
storage: {
|
|
getItem: (key) => {
|
|
if (simulator() === 0 /* MSFS */) {
|
|
if (key === "NAVIGRAPH_ACCESS_TOKEN") {
|
|
return navigraph.NAVIGRAPH_ACCESS_TOKEN;
|
|
}
|
|
if (key === "NAVIGRAPH_REFRESH_TOKEN") {
|
|
return navigraph.NAVIGRAPH_REFRESH_TOKEN;
|
|
}
|
|
if (key === "NAVIGRAPH_SDK_INIT") {
|
|
return navigraph.NAVIGRAPH_SDK_INIT;
|
|
}
|
|
} else if (typeof localStorage !== "undefined") {
|
|
return localStorage.getItem(key);
|
|
}
|
|
},
|
|
setItem: (key, value) => {
|
|
if (key === "NAVIGRAPH_ACCESS_TOKEN") {
|
|
dispatch(setNavigraphAccessToken(value));
|
|
}
|
|
if (key === "NAVIGRAPH_REFRESH_TOKEN") {
|
|
dispatch(setNavigraphRefreshToken(value));
|
|
}
|
|
if (key === "NAVIGRAPH_SDK_INIT") {
|
|
dispatch(setNavigraphSDKInit(value));
|
|
}
|
|
}
|
|
},
|
|
keys: {
|
|
accessToken: "NAVIGRAPH_ACCESS_TOKEN",
|
|
refreshToken: "NAVIGRAPH_REFRESH_TOKEN"
|
|
}
|
|
});
|
|
const handleSignIn = () => auth.signInWithDeviceFlow((p2) => setParams(p2));
|
|
(0, import_react10.useEffect)(() => {
|
|
const unsubscribe = auth.onAuthStateChanged((u) => {
|
|
if (!initialized)
|
|
setinitialized(true);
|
|
setUser2(u);
|
|
});
|
|
return () => unsubscribe();
|
|
}, []);
|
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex h-full w-full flex-col items-center", children: [
|
|
!initialized && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex h-full w-full flex-col items-center justify-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
FontAwesomeIcon,
|
|
{
|
|
icon: faSpinner,
|
|
className: "animate-spin text-6xl"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "mb-6 text-lg", children: "Loading..." })
|
|
] }),
|
|
initialized && !deviceFlowParams && !user && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex h-full flex-col place-content-center text-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h1", { className: "mb-3 text-6xl font-bold", children: "Charts" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "mb-6 text-lg", children: "You are currently not signed in with Navigraph" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
"button",
|
|
{
|
|
onClick: handleSignIn,
|
|
className: "middle none center mx-auto w-min whitespace-nowrap rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
children: "Sign in"
|
|
}
|
|
)
|
|
] }),
|
|
(deviceFlowParams == null ? void 0 : deviceFlowParams.verification_uri_complete) && !user && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex h-full w-full flex-col place-content-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h1", { className: "mb-6 text-center text-6xl font-bold", children: "Signing in with Navigraph" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex w-full items-center justify-around gap-x-6", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { className: "mb-3 text-center text-4xl font-bold text-red-500", children: "Scan a QR Code" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "mx-auto w-min bg-white p-8", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
QRCode,
|
|
{
|
|
value: deviceFlowParams.verification_uri_complete,
|
|
size: 250
|
|
}
|
|
) })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex h-full flex-col items-center justify-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
"div",
|
|
{
|
|
className: "w-2 bg-white",
|
|
style: {
|
|
height: "100px",
|
|
width: "2px",
|
|
backgroundColor: "white"
|
|
}
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "my-3 font-bold", children: "OR" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
"div",
|
|
{
|
|
className: "w-2 bg-white",
|
|
style: {
|
|
height: "100px",
|
|
width: "2px",
|
|
backgroundColor: "white"
|
|
}
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex flex-col flex-wrap place-content-center text-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h2", { className: "text-4xl font-bold text-red-500", children: "Visit Navigraph" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-blue-300", children: "navigraph.com/code" }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-lg font-semibold", children: "Type in:" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-3xl font-bold text-red-400", children: deviceFlowParams.user_code })
|
|
] })
|
|
] })
|
|
] }),
|
|
user && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: user.subscriptions.includes("charts") ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ChartsComponent, { charts }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex h-full w-full flex-col place-content-center text-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h1", { className: "mb-3 text-6xl font-bold", children: "Charts unavailable" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: "Your Navigraph subscription does not include chart access" })
|
|
] }) })
|
|
] });
|
|
}
|
|
|
|
// src/routes/OptionsPage.tsx
|
|
var import_react11 = __toESM(require_react());
|
|
var import_jsx_runtime10 = __toESM(require_jsx_runtime());
|
|
var ToggleComponent = (props) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: props.optionName }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "inline-flex w-1/2 rounded-md shadow-sm", role: "group", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${props.value === props.leftLabel.value ? "bg-green-700" : props.backgroundColor} w-1/2 rounded-l-lg border border-white px-4 py-2 text-white`,
|
|
onClick: () => props.setValue(props.leftLabel.value),
|
|
children: props.leftLabel.label || "Enabled"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${props.value === props.rightLabel.value ? "bg-green-700" : props.backgroundColor} w-1/2 rounded-r-md border border-white px-4 py-2 text-white`,
|
|
onClick: () => props.setValue(props.rightLabel.value),
|
|
children: props.rightLabel.label || "Disabled"
|
|
}
|
|
)
|
|
] })
|
|
] });
|
|
var GeneralOptionsTab = () => {
|
|
const dispatch = useDispatch();
|
|
const planeConfig = useSelector((state) => state.plane);
|
|
const [brightness, setLocalBrightness] = (0, import_react11.useState)(planeConfig.brightness);
|
|
(0, import_react11.useEffect)(() => {
|
|
dispatch(getPlaneConfig());
|
|
}, []);
|
|
const save = async () => {
|
|
try {
|
|
await dispatch(saveGeneralOptions());
|
|
dispatch(
|
|
setToast({
|
|
type: "success",
|
|
message: "Options saved successfully."
|
|
})
|
|
);
|
|
} catch (error) {
|
|
dispatch(
|
|
setToast({
|
|
type: "error",
|
|
message: "Failed to save options."
|
|
})
|
|
);
|
|
}
|
|
};
|
|
const setValue = (key, value) => {
|
|
dispatch(
|
|
setGeneralOptions(__spreadProps(__spreadValues({}, planeConfig.options.general), {
|
|
[key]: value
|
|
}))
|
|
);
|
|
};
|
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex h-16 w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Screen Brightness" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "inline-flex w-1/2 rounded-md shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"input",
|
|
{
|
|
type: "range",
|
|
min: 10,
|
|
max: 100,
|
|
className: "w-full",
|
|
value: brightness,
|
|
onChange: (e) => {
|
|
setLocalBrightness(+e.target.value);
|
|
dispatch(
|
|
setBrightness({
|
|
brightness: +e.target.value
|
|
})
|
|
);
|
|
}
|
|
}
|
|
) })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Weight Units",
|
|
value: planeConfig.options.general.weightUnits,
|
|
setValue: (value) => setValue("weightUnits", value),
|
|
leftLabel: { label: "Metric", value: "kgs" },
|
|
rightLabel: { label: "Imperial", value: "lbs" },
|
|
backgroundColor: "bg-zinc-700"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Temperature Units",
|
|
value: planeConfig.options.general.temperatureUnits,
|
|
setValue: (value) => setValue("temperatureUnits", value),
|
|
leftLabel: { label: "\xB0C", value: "c" },
|
|
rightLabel: { label: "\xB0F", value: "f" },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "MANPADS Defense System",
|
|
value: planeConfig.options.general.manpads,
|
|
setValue: (value) => setValue("manpads", value),
|
|
leftLabel: { label: "Hidden", value: false },
|
|
rightLabel: { label: "Visible", value: true },
|
|
backgroundColor: "bg-zinc-700"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"div",
|
|
{
|
|
className: `flex w-full items-center justify-between bg-zinc-600 p-2 px-4 text-xs ${!planeConfig.options.general.canBeER && "rounded-b-md"}`,
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Pause at TOD",
|
|
value: planeConfig.options.general.pauseAtTOD,
|
|
setValue: (value) => setValue("pauseAtTOD", value),
|
|
leftLabel: { label: "No", value: false },
|
|
rightLabel: { label: "Yes", value: true },
|
|
backgroundColor: planeConfig.options.general.canBeER ? "bg-zinc-700" : "bg-zinc-600"
|
|
}
|
|
)
|
|
}
|
|
),
|
|
planeConfig.options.general.hasXS && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Failure Chance" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
"div",
|
|
{
|
|
className: "inline-flex w-1/2 rounded-md shadow-sm",
|
|
role: "group",
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.general.failureChance === 0 ? "bg-green-700" : "bg-zinc-600"} w-1/2 rounded-l-lg border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("failureChance", 0),
|
|
children: "Never"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.general.failureChance === 1 ? "bg-green-700" : "bg-zinc-600"} w-1/2 border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("failureChance", 1),
|
|
children: "Normal"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.general.failureChance === 2 ? "bg-green-700" : "bg-zinc-600"} w-1/2 rounded-r-lg border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("failureChance", 2),
|
|
children: "High"
|
|
}
|
|
)
|
|
]
|
|
}
|
|
)
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Severe Failures",
|
|
value: planeConfig.options.general.enableSevereFailures,
|
|
setValue: (value) => setValue("enableSevereFailures", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: `flex w-full items-center justify-between bg-zinc-700 p-2 px-4 text-lg ${!planeConfig.options.general.canBeER ? "rounded-b-md" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Random Failures",
|
|
value: planeConfig.options.general.enableRandomFailures,
|
|
setValue: (value) => setValue("enableRandomFailures", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) })
|
|
] }),
|
|
planeConfig.options.general.canBeER && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between rounded-b-md bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Extended Range",
|
|
value: planeConfig.options.general.isExtendedRange,
|
|
setValue: (value) => setValue("isExtendedRange", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex justify-between", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-2 flex w-full items-center justify-start text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
"data-ripple-light": "true",
|
|
onClick: save,
|
|
children: "Save"
|
|
}
|
|
) }),
|
|
planeConfig.options.general.pauseAtTOD && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-2 flex items-center justify-start text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
className: "middle none center rounded-lg bg-red-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-red-500/20 transition-all hover:shadow-lg hover:shadow-red-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
"data-ripple-light": "true",
|
|
onClick: () => {
|
|
dispatch(unpause());
|
|
},
|
|
children: "Unpause"
|
|
}
|
|
) })
|
|
] })
|
|
] });
|
|
};
|
|
var SystemsOptionsTab = () => {
|
|
const dispatch = useDispatch();
|
|
const planeConfig = useSelector((state) => state.plane);
|
|
(0, import_react11.useEffect)(() => {
|
|
dispatch(getPlaneConfig());
|
|
}, []);
|
|
const save = async () => {
|
|
try {
|
|
await dispatch(saveSystemsOptions());
|
|
dispatch(
|
|
setToast({
|
|
type: "success",
|
|
message: "Options saved successfully."
|
|
})
|
|
);
|
|
} catch (error) {
|
|
dispatch(
|
|
setToast({
|
|
type: "error",
|
|
message: "Failed to save options."
|
|
})
|
|
);
|
|
}
|
|
};
|
|
const setValue = (key, value) => {
|
|
dispatch(
|
|
setSystemsOptions(__spreadProps(__spreadValues({}, planeConfig.options.systems), {
|
|
[key]: value
|
|
}))
|
|
);
|
|
};
|
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Automatic Anti-Ice",
|
|
value: planeConfig.options.systems.automaticAntiIce,
|
|
setValue: (value) => setValue("automaticAntiIce", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Digital Standby",
|
|
value: planeConfig.options.systems.digitalStandby,
|
|
setValue: (value) => setValue("digitalStandby", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-700"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Fuel Dipstick",
|
|
value: planeConfig.options.systems.fuelDipstick,
|
|
setValue: (value) => setValue("fuelDipstick", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "RCWS",
|
|
value: planeConfig.options.systems.rcws,
|
|
setValue: (value) => setValue("rcws", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-700"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Tape Displays",
|
|
value: planeConfig.options.systems.tapeDisplays,
|
|
setValue: (value) => setValue("tapeDisplays", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "High Decel Rate ABS",
|
|
value: planeConfig.options.systems.highDecelRateABS,
|
|
setValue: (value) => setValue("highDecelRateABS", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-700"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Single Cue FD",
|
|
value: planeConfig.options.systems.singleCueFD,
|
|
setValue: (value) => setValue("singleCueFD", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Inhibit Tire Failure",
|
|
value: planeConfig.options.systems.inhibitTireFailure,
|
|
setValue: (value) => setValue("inhibitTireFailure", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-700"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Wind Vector Type",
|
|
value: planeConfig.options.systems.windVectorType,
|
|
setValue: (value) => setValue("windVectorType", value),
|
|
leftLabel: { label: "Vector", value: "vector" },
|
|
rightLabel: { label: "Track", value: "track" },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Radio Altitude Behavior" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
"div",
|
|
{
|
|
className: "inline-flex w-1/2 rounded-md shadow-sm",
|
|
role: "group",
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.systems.radAltBehavior === 0 ? "bg-green-700" : "bg-zinc-600"} w-1/2 rounded-l-lg border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("radAltBehavior", 0),
|
|
children: "Standard"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.systems.radAltBehavior === 1 ? "bg-green-700" : "bg-zinc-600"} w-1/2 border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("radAltBehavior", 1),
|
|
children: "Rising Box"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.systems.radAltBehavior === 2 ? "bg-green-700" : "bg-zinc-600"} w-1/2 rounded-r-lg border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("radAltBehavior", 2),
|
|
children: "Rising Runway"
|
|
}
|
|
)
|
|
]
|
|
}
|
|
)
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between rounded-b-md bg-zinc-600 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "WBS",
|
|
value: planeConfig.options.systems.wbs,
|
|
setValue: (value) => setValue("wbs", value),
|
|
leftLabel: { label: "Not Installed", value: false },
|
|
rightLabel: { label: "Installed", value: true },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-2 flex w-full items-center justify-start pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
"data-ripple-light": "true",
|
|
onClick: save,
|
|
children: "Save"
|
|
}
|
|
) })
|
|
] });
|
|
};
|
|
var CAWSOptionsTab = () => {
|
|
const dispatch = useDispatch();
|
|
const planeConfig = useSelector((state) => state.plane);
|
|
(0, import_react11.useEffect)(() => {
|
|
dispatch(getPlaneConfig());
|
|
}, []);
|
|
const setValue = (key, value) => {
|
|
dispatch(
|
|
setCAWSOptions(__spreadProps(__spreadValues({}, planeConfig.options.caws), {
|
|
[key]: value
|
|
}))
|
|
);
|
|
};
|
|
const save = async () => {
|
|
try {
|
|
await dispatch(saveCAWSOptions());
|
|
dispatch(
|
|
setToast({
|
|
type: "success",
|
|
message: "Options saved successfully."
|
|
})
|
|
);
|
|
} catch (error) {
|
|
dispatch(
|
|
setToast({
|
|
type: "error",
|
|
message: "Failed to save options."
|
|
})
|
|
);
|
|
}
|
|
};
|
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Altitude Alert Type" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
"div",
|
|
{
|
|
className: "inline-flex w-1/2 rounded-md shadow-sm",
|
|
role: "group",
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.caws.altAlertType === 0 ? "bg-green-700" : "bg-zinc-600"} w-1/2 rounded-l-lg border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("altAlertType", 0),
|
|
children: "None"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.caws.altAlertType === 1 ? "bg-green-700" : "bg-zinc-600"} w-1/2 border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("altAlertType", 1),
|
|
children: "Tone"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.caws.altAlertType === 2 ? "bg-green-700" : "bg-zinc-600"} w-1/2 rounded-r-lg border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("altAlertType", 2),
|
|
children: "Voice and Tone"
|
|
}
|
|
)
|
|
]
|
|
}
|
|
)
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Altitude Alert Conditions",
|
|
value: planeConfig.options.caws.altAlertOnCapture,
|
|
setValue: (value) => setValue("altAlertOnCapture", value),
|
|
leftLabel: { label: "On Deviation", value: false },
|
|
rightLabel: {
|
|
label: "On Capture or Deviation",
|
|
value: true
|
|
},
|
|
backgroundColor: "bg-zinc-700"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "2500ft Callout",
|
|
value: planeConfig.options.caws.callout2500,
|
|
setValue: (value) => setValue("callout2500", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-700"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "1000ft Callout",
|
|
value: planeConfig.options.caws.callout1000,
|
|
setValue: (value) => setValue("callout1000", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "500ft Callout",
|
|
value: planeConfig.options.caws.callout500,
|
|
setValue: (value) => setValue("callout500", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-700"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "400ft Callout",
|
|
value: planeConfig.options.caws.callout400,
|
|
setValue: (value) => setValue("callout400", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "300ft Callout",
|
|
value: planeConfig.options.caws.callout300,
|
|
setValue: (value) => setValue("callout300", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-700"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "200ft Callout",
|
|
value: planeConfig.options.caws.callout200,
|
|
setValue: (value) => setValue("callout200", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "100ft Callout",
|
|
value: planeConfig.options.caws.callout100,
|
|
setValue: (value) => setValue("callout100", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-700"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "50ft to 10ft Callouts",
|
|
value: planeConfig.options.caws.callout50onwards,
|
|
setValue: (value) => setValue("callout50onwards", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-2 flex w-full items-center justify-start pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
"data-ripple-light": "true",
|
|
onClick: save,
|
|
children: "Save"
|
|
}
|
|
) })
|
|
] });
|
|
};
|
|
var PerformanceOptionsTab = () => {
|
|
const dispatch = useDispatch();
|
|
const planeConfig = useSelector((state) => state.plane);
|
|
(0, import_react11.useEffect)(() => {
|
|
dispatch(getPlaneConfig());
|
|
}, []);
|
|
const setValue = (key, value) => {
|
|
dispatch(
|
|
setPerformanceOptions(__spreadProps(__spreadValues({}, planeConfig.options.performance), {
|
|
[key]: value
|
|
}))
|
|
);
|
|
};
|
|
const save = async () => {
|
|
try {
|
|
await dispatch(savePerformanceOptions());
|
|
dispatch(
|
|
setToast({
|
|
type: "success",
|
|
message: "Options saved successfully."
|
|
})
|
|
);
|
|
} catch (error) {
|
|
dispatch(
|
|
setToast({
|
|
type: "error",
|
|
message: "Failed to save options."
|
|
})
|
|
);
|
|
}
|
|
};
|
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4 text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Fuel CG Control %" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
Input,
|
|
{
|
|
type: "number",
|
|
min: 0,
|
|
max: 5,
|
|
step: 0.5,
|
|
value: planeConfig.options.performance.fuelCGControl,
|
|
onChange: (value) => setValue("fuelCGControl", Number.parseFloat(value)),
|
|
className: "w-1/4 rounded-lg border border-white bg-zinc-700 px-3 py-2 focus:border-blue-600 focus:ring-blue-600"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4 text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "TO 1 Derate" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
Input,
|
|
{
|
|
type: "number",
|
|
min: 0,
|
|
step: 1,
|
|
value: planeConfig.options.performance.to1DeRate,
|
|
onChange: (value) => setValue("to1DeRate", Number.parseFloat(value)),
|
|
className: "w-1/4 rounded-lg border border-white bg-zinc-700 px-3 py-2 focus:border-blue-600 focus:ring-blue-600"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4 text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "TO 2 Derate" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
Input,
|
|
{
|
|
type: "number",
|
|
min: 0,
|
|
step: 1,
|
|
value: planeConfig.options.performance.to2DeRate,
|
|
onChange: (value) => setValue("to2DeRate", Number.parseFloat(value)),
|
|
className: "w-1/4 rounded-lg border border-white bg-zinc-700 px-3 py-2 focus:border-blue-600 focus:ring-blue-600"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4 text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Climb 1 Derate" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
Input,
|
|
{
|
|
type: "number",
|
|
min: 0,
|
|
step: 1,
|
|
value: planeConfig.options.performance.cl1DeRate,
|
|
onChange: (value) => setValue("cl1DeRate", Number.parseFloat(value)),
|
|
className: "w-1/4 rounded-lg border border-white bg-zinc-700 px-3 py-2 focus:border-blue-600 focus:ring-blue-600"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4 text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Climb 2 Derate" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
Input,
|
|
{
|
|
type: "number",
|
|
min: 0,
|
|
step: 1,
|
|
value: planeConfig.options.performance.cl2DeRate,
|
|
onChange: (value) => setValue("cl2DeRate", Number.parseFloat(value)),
|
|
className: "w-1/4 rounded-lg border border-white bg-zinc-700 px-3 py-2 focus:border-blue-600 focus:ring-blue-600"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4 text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "GA 1 Derate" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
Input,
|
|
{
|
|
type: "number",
|
|
min: 0,
|
|
step: 1,
|
|
value: planeConfig.options.performance.ga1DeRate,
|
|
onChange: (value) => setValue("ga1DeRate", Number.parseFloat(value)),
|
|
className: "w-1/4 rounded-lg border border-white bg-zinc-700 px-3 py-2 focus:border-blue-600 focus:ring-blue-600"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4 text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "GA 2 Derate" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
Input,
|
|
{
|
|
type: "number",
|
|
min: 0,
|
|
step: 1,
|
|
value: planeConfig.options.performance.ga2DeRate,
|
|
onChange: (value) => setValue("ga2DeRate", Number.parseFloat(value)),
|
|
className: "w-1/4 rounded-lg border border-white bg-zinc-700 px-3 py-2 focus:border-blue-600 focus:ring-blue-600"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "High-Efficiency Flap Pylon",
|
|
value: planeConfig.options.performance.flapPylonPIP,
|
|
setValue: (value) => setValue("flapPylonPIP", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-700"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between rounded-b-md bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Deflected Ailerons",
|
|
value: planeConfig.options.performance.deflectedAilerons,
|
|
setValue: (value) => setValue("deflectedAilerons", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-2 flex w-full items-center justify-start text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
"data-ripple-light": "true",
|
|
onClick: save,
|
|
children: "Save"
|
|
}
|
|
) })
|
|
] });
|
|
};
|
|
var CommunicationOptionsTab = () => {
|
|
const dispatch = useDispatch();
|
|
const planeConfig = useSelector((state) => state.plane);
|
|
const simBriefUsername = useSelector(
|
|
(state) => state.simbrief.username
|
|
);
|
|
const hoppiesACARSCode = useSelector(
|
|
(state) => state.hoppies.code
|
|
);
|
|
const sayIntentionsCode = useSelector(
|
|
(state) => state.sayIntentions.code
|
|
);
|
|
(0, import_react11.useEffect)(() => {
|
|
dispatch(getPlaneConfig());
|
|
}, []);
|
|
const setValue = (key, value) => {
|
|
dispatch(
|
|
setCommunicationOptions(__spreadProps(__spreadValues({}, planeConfig.options.communication), {
|
|
[key]: value
|
|
}))
|
|
);
|
|
};
|
|
const save = async () => {
|
|
try {
|
|
await Promise.all([
|
|
dispatch(saveCommunicationOptions()),
|
|
dispatch(saveUsername()),
|
|
dispatch(saveCode()),
|
|
dispatch(saveCode2())
|
|
]);
|
|
dispatch(
|
|
setToast({
|
|
type: "success",
|
|
message: "Options saved successfully."
|
|
})
|
|
);
|
|
} catch (error) {
|
|
dispatch(
|
|
setToast({
|
|
type: "error",
|
|
message: "Failed to save options."
|
|
})
|
|
);
|
|
}
|
|
};
|
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4 text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "SimBrief Username" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
Input,
|
|
{
|
|
type: "text",
|
|
value: simBriefUsername,
|
|
onChange: (value) => dispatch(setUsername(value)),
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 focus:border-blue-600 focus:ring-blue-600"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "CPDLC Provider",
|
|
value: planeConfig.options.communication.useHoppies,
|
|
setValue: (value) => setValue("useHoppies", value),
|
|
leftLabel: { label: "SayIntentions AI", value: false },
|
|
rightLabel: { label: "Hoppie", value: true },
|
|
backgroundColor: "bg-zinc-700"
|
|
}
|
|
) }),
|
|
planeConfig.options.communication.useHoppies && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between rounded-b-md bg-zinc-600 p-2 px-4 text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Hoppie Logon Code" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
Input,
|
|
{
|
|
type: "password",
|
|
value: hoppiesACARSCode,
|
|
onChange: (value) => dispatch(setCode(value)),
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 focus:border-blue-600 focus:ring-blue-600"
|
|
}
|
|
)
|
|
] }),
|
|
!planeConfig.options.communication.useHoppies && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between rounded-b-md bg-zinc-600 p-2 px-4 text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "SayIntentions Key" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
Input,
|
|
{
|
|
type: "password",
|
|
value: sayIntentionsCode,
|
|
onChange: (value) => dispatch(setCode2(value)),
|
|
className: "w-1/2 rounded-lg border border-white bg-zinc-700 px-3 py-2 focus:border-blue-600 focus:ring-blue-600"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-2 flex w-full items-center justify-start pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
"data-ripple-light": "true",
|
|
onClick: save,
|
|
children: "Save"
|
|
}
|
|
) })
|
|
] });
|
|
};
|
|
var BehaviorOptionsTab = () => {
|
|
const dispatch = useDispatch();
|
|
const planeConfig = useSelector((state) => state.plane);
|
|
(0, import_react11.useEffect)(() => {
|
|
dispatch(getPlaneConfig());
|
|
}, []);
|
|
const setValue = (key, value) => {
|
|
dispatch(
|
|
setBehaviourOptions(__spreadProps(__spreadValues({}, planeConfig.options.behaviour), {
|
|
[key]: value
|
|
}))
|
|
);
|
|
};
|
|
const save = async () => {
|
|
try {
|
|
await dispatch(saveBehaviourOptions());
|
|
dispatch(
|
|
setToast({
|
|
type: "success",
|
|
message: "Options saved successfully."
|
|
})
|
|
);
|
|
} catch (error) {
|
|
dispatch(
|
|
setToast({
|
|
type: "error",
|
|
message: "Failed to save options."
|
|
})
|
|
);
|
|
}
|
|
};
|
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between rounded-t-md bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Allow Hardware Overforce",
|
|
value: planeConfig.options.behaviour.allowHardwareOverforce,
|
|
setValue: (value) => setValue("allowHardwareOverforce", value),
|
|
leftLabel: { label: "No", value: false },
|
|
rightLabel: { label: "Yes", value: true },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Automatic Seatbelt Behavior",
|
|
value: planeConfig.options.behaviour.automaticSeatbelt,
|
|
setValue: (value) => setValue("automaticSeatbelt", value),
|
|
leftLabel: { label: "Configuration", value: false },
|
|
rightLabel: { label: "Altitude", value: true },
|
|
backgroundColor: "bg-zinc-700"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "IRS Align Time" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
"div",
|
|
{
|
|
className: "inline-flex w-1/2 rounded-md shadow-sm",
|
|
role: "group",
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.behaviour.irsAlignTime === 0 ? "bg-green-700" : "bg-zinc-600"} w-1/2 rounded-l-lg border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("irsAlignTime", 0),
|
|
children: "Instant"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.behaviour.irsAlignTime === 1 ? "bg-green-700" : "bg-zinc-600"} w-1/2 border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("irsAlignTime", 1),
|
|
children: "Fast"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.behaviour.irsAlignTime === 2 ? "bg-green-700" : "bg-zinc-600"} w-1/2 rounded-r-lg border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("irsAlignTime", 2),
|
|
children: "Realistic"
|
|
}
|
|
)
|
|
]
|
|
}
|
|
)
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Baro Sync" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
"div",
|
|
{
|
|
className: "inline-flex w-1/2 rounded-md shadow-sm",
|
|
role: "group",
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.behaviour.baroSync === 0 ? "bg-green-700" : "bg-zinc-700"} w-1/2 rounded-l-lg border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("baroSync", 0),
|
|
children: "None"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.behaviour.baroSync === 1 ? "bg-green-700" : "bg-zinc-700"} w-1/2 border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("baroSync", 1),
|
|
children: "Capt + FO"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.behaviour.baroSync === 2 ? "bg-green-700" : "bg-zinc-700"} w-1/2 rounded-r-lg border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("baroSync", 2),
|
|
children: "All"
|
|
}
|
|
)
|
|
]
|
|
}
|
|
)
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Parking Brake Behavior",
|
|
value: planeConfig.options.behaviour.parkBrakeBehaviour,
|
|
setValue: (value) => setValue("parkBrakeBehaviour", value),
|
|
leftLabel: { label: "Simplified", value: false },
|
|
rightLabel: { label: "Realistic", value: true },
|
|
backgroundColor: "bg-zinc-600"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Sync Minimums",
|
|
value: planeConfig.options.behaviour.minimumsSync,
|
|
setValue: (value) => setValue("minimumsSync", value),
|
|
leftLabel: { label: "No", value: false },
|
|
rightLabel: { label: "Yes", value: true },
|
|
backgroundColor: "bg-zinc-700"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between bg-zinc-600 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-full items-center justify-between text-xs", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: "Show Physical Throttle Position" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
"div",
|
|
{
|
|
className: "inline-flex w-1/2 rounded-md shadow-sm",
|
|
role: "group",
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.behaviour.showPhysicalThrottlePos === 0 ? "bg-green-700" : "bg-zinc-600"} w-1/2 rounded-l-lg border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("showPhysicalThrottlePos", 0),
|
|
children: "Never"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.behaviour.showPhysicalThrottlePos === 1 ? "bg-green-700" : "bg-zinc-600"} w-1/2 border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("showPhysicalThrottlePos", 1),
|
|
children: "When moving"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
type: "button",
|
|
className: `${planeConfig.options.behaviour.showPhysicalThrottlePos === 2 ? "bg-green-700" : "bg-zinc-600"} w-1/2 rounded-r-lg border border-white px-4 py-2 text-white`,
|
|
onClick: () => setValue("showPhysicalThrottlePos", 2),
|
|
children: "Always"
|
|
}
|
|
)
|
|
]
|
|
}
|
|
)
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full items-center justify-between rounded-b-md bg-zinc-700 p-2 px-4 text-lg", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
ToggleComponent,
|
|
{
|
|
optionName: "Scroll Acceleration",
|
|
value: planeConfig.options.behaviour.scrollAcceleration,
|
|
setValue: (value) => setValue("scrollAcceleration", value),
|
|
leftLabel: { label: "Disabled", value: false },
|
|
rightLabel: { label: "Enabled", value: true },
|
|
backgroundColor: "bg-zinc-700"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "mt-2 flex w-full items-center justify-start pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
"data-ripple-light": "true",
|
|
onClick: save,
|
|
children: "Save"
|
|
}
|
|
) })
|
|
] });
|
|
};
|
|
function OptionsPage() {
|
|
const [selectedTab, setSelectedTab2] = (0, import_react11.useState)(0);
|
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "flex w-full justify-center pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "flex w-3/4 flex-col items-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
"ul",
|
|
{
|
|
className: "mb-4 flex list-none flex-row flex-wrap border-b-0 bg-zinc-900 pl-0",
|
|
role: "tablist",
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
className: `${selectedTab === 0 ? "text-white underline" : "text-neutral-500"} my-2 block border-x-0 border-b-2 border-t-0 border-slate-100 bg-zinc-900 px-7 text-sm font-medium uppercase`,
|
|
role: "tab",
|
|
onClick: () => setSelectedTab2(0),
|
|
children: "General"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
className: `${selectedTab === 1 ? "text-white underline" : "text-neutral-500"} my-2 block border-x-0 border-b-2 border-t-0 border-slate-100 bg-zinc-900 px-7 text-sm font-medium uppercase`,
|
|
onClick: () => setSelectedTab2(1),
|
|
children: "Systems"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
className: `${selectedTab === 2 ? "text-white underline" : "text-neutral-500"} my-2 block border-x-0 border-b-2 border-t-0 border-slate-100 bg-zinc-900 px-7 text-sm font-medium uppercase`,
|
|
onClick: () => setSelectedTab2(2),
|
|
children: "CAWS"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
className: `${selectedTab === 3 ? "text-white underline" : "text-neutral-500"} my-2 block border-x-0 border-b-2 border-t-0 border-slate-100 bg-zinc-900 px-7 text-sm font-medium uppercase`,
|
|
onClick: () => setSelectedTab2(3),
|
|
children: "Perf"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
className: `${selectedTab === 4 ? "text-white underline" : "text-neutral-500"} my-2 block border-x-0 border-b-2 border-t-0 border-slate-100 bg-zinc-900 px-7 text-sm font-medium uppercase`,
|
|
onClick: () => setSelectedTab2(4),
|
|
children: "Comms"
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("li", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
"button",
|
|
{
|
|
className: `${selectedTab === 5 ? "text-white underline" : "text-neutral-500"} my-2 block border-x-0 border-b-2 border-t-0 border-slate-100 bg-zinc-900 px-7 text-sm font-medium uppercase`,
|
|
onClick: () => setSelectedTab2(5),
|
|
children: "Behavior"
|
|
}
|
|
) })
|
|
]
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "w-full", children: [
|
|
selectedTab === 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(GeneralOptionsTab, {}),
|
|
selectedTab === 1 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SystemsOptionsTab, {}),
|
|
selectedTab === 2 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CAWSOptionsTab, {}),
|
|
selectedTab === 3 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PerformanceOptionsTab, {}),
|
|
selectedTab === 4 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CommunicationOptionsTab, {}),
|
|
selectedTab === 5 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(BehaviorOptionsTab, {})
|
|
] })
|
|
] }) });
|
|
}
|
|
|
|
// src/routes/PanelStatePage.tsx
|
|
init_common();
|
|
var import_react12 = __toESM(require_react());
|
|
var import_jsx_runtime11 = __toESM(require_jsx_runtime());
|
|
var STATES = {
|
|
"Cold and Dark": 1 /* ColdAndDark */,
|
|
"Ready to Start": 2 /* ReadyToStart */,
|
|
"Ready to Fly": 3 /* ReadyToFly */,
|
|
"Load Last Save": 4 /* LoadLastSave */
|
|
};
|
|
var STATE_ICONS = {
|
|
"Cold and Dark": faSnowflake,
|
|
"Ready to Start": faPlaneTail,
|
|
"Ready to Fly": faPlaneDeparture,
|
|
"Load Last Save": faFloppyDisk
|
|
};
|
|
function PanelStatePage() {
|
|
const [defaultState, setPageDefaultState] = (0, import_react12.useState)(
|
|
4 /* LoadLastSave */
|
|
);
|
|
(0, import_react12.useEffect)(() => {
|
|
async function getDefaultState() {
|
|
const simLib = await lib();
|
|
const state = await simLib.getEFBVariable("DEFAULT_PANEL_STATE");
|
|
setPageDefaultState(state);
|
|
}
|
|
getDefaultState();
|
|
}, []);
|
|
const setDefaultState = (state) => {
|
|
setPageDefaultState(state);
|
|
lib().then((lib2) => lib2.setDefaultPanelState(state));
|
|
};
|
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(GroundPage, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex h-full w-full flex-col items-center py-8", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex h-full w-3/4 flex-wrap place-content-stretch gap-4", children: Object.entries(STATES).map(([label, value]) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
"div",
|
|
{
|
|
className: "flew-grow grid flex-[48%] grid-rows-6 justify-stretch overflow-hidden rounded-lg border-2 border-white bg-transparent bg-zinc-900 text-gray-400 transition-all hover:bg-gray-600 hover:text-white",
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
"button",
|
|
{
|
|
className: "group row-span-5 bg-zinc-900",
|
|
onClick: () => lib().then(
|
|
(lib2) => lib2.setPanelState(value)
|
|
),
|
|
children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
FontAwesomeIcon,
|
|
{
|
|
icon: STATE_ICONS[label],
|
|
size: "5x",
|
|
className: "mb-2"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-xl transition-[font-weight] group-hover:font-bold", children: label })
|
|
]
|
|
}
|
|
),
|
|
value === defaultState && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "rounded-b-md border-t-2 border-green-600 bg-green-600 text-white", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
FontAwesomeIcon,
|
|
{
|
|
icon: faCheck,
|
|
size: "2x",
|
|
className: "font-extrabold"
|
|
}
|
|
) }),
|
|
value !== defaultState && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
"button",
|
|
{
|
|
className: "rounded-b-md border-t-2 border-green-600 bg-zinc-900 text-base text-green-600 transition-all hover:bg-green-600 hover:font-bold hover:text-white",
|
|
onClick: () => setDefaultState(value),
|
|
children: "Set as default"
|
|
}
|
|
)
|
|
]
|
|
},
|
|
value
|
|
)) }) }) });
|
|
}
|
|
|
|
// src/lib/simbrief.ts
|
|
var getSimBriefFlightPlan = async (simBriefUsername) => {
|
|
const flightPlanURL = `https://www.simbrief.com/api/xml.fetcher.php?username=${simBriefUsername}&json=1`;
|
|
let response;
|
|
let success = false;
|
|
try {
|
|
response = await axios_default.get(flightPlanURL);
|
|
success = true;
|
|
} catch (e) {
|
|
response = e.response;
|
|
}
|
|
return {
|
|
success,
|
|
data: response.data
|
|
};
|
|
};
|
|
|
|
// src/routes/DispatchPage.tsx
|
|
var import_react13 = __toESM(require_react());
|
|
init_common();
|
|
var import_jsx_runtime12 = __toESM(require_jsx_runtime());
|
|
var RedirectToOptionsPage = () => {
|
|
const dispatch = useDispatch();
|
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex h-full w-full flex-col items-center justify-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h1", { className: "mb-3 text-6xl font-bold", children: "Dispatch" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mb-6 text-lg", children: "Your SimBrief username is not set" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
"button",
|
|
{
|
|
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
onClick: () => dispatch(setRoute({ path: "/options" })),
|
|
children: "Set my SimBrief username"
|
|
}
|
|
)
|
|
] });
|
|
};
|
|
var ImportFlightPlan = () => {
|
|
const dispatch = useDispatch();
|
|
const simBrief = useSelector((state) => state.simbrief);
|
|
const importPlan = async () => {
|
|
var _a;
|
|
const flightPlan = await getSimBriefFlightPlan(simBrief.username);
|
|
if (!flightPlan.success) {
|
|
return dispatch(
|
|
setToast({
|
|
type: "error",
|
|
message: flightPlan.data.fetch.status
|
|
})
|
|
);
|
|
}
|
|
if (!["MD11", "MD1F"].includes((_a = flightPlan.data) == null ? void 0 : _a.aircraft.icao_code)) {
|
|
return dispatch(
|
|
setToast({
|
|
type: "error",
|
|
message: `Your SimBrief plan is not for a MD-11`
|
|
})
|
|
);
|
|
}
|
|
dispatch(setPlan(flightPlan.data));
|
|
};
|
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex h-full w-full flex-col items-center justify-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h1", { className: "mb-3 text-6xl font-bold", children: "Dispatch" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mb-6 text-lg", children: "You currently do not have a SimBrief flight plan loaded" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
"button",
|
|
{
|
|
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
onClick: importPlan,
|
|
children: "Import flight plan"
|
|
}
|
|
)
|
|
] });
|
|
};
|
|
var FlightPlanViewer = () => {
|
|
var _a, _b, _c;
|
|
const dispatch = useDispatch();
|
|
const simBrief = useSelector((state) => state.simbrief);
|
|
const planeConfig = useSelector((state) => state.plane);
|
|
const [minZFW, setMinZFW] = (0, import_react13.useState)(0);
|
|
(0, import_react13.useEffect)(() => {
|
|
dispatch(getPlaneConfig());
|
|
}, []);
|
|
const importPlan = async () => {
|
|
var _a2;
|
|
dispatch(setPlan("reloading"));
|
|
const flightPlan = await getSimBriefFlightPlan(simBrief.username);
|
|
if (!flightPlan.success) {
|
|
return dispatch(
|
|
setToast({
|
|
type: "error",
|
|
message: flightPlan.data.fetch.status
|
|
})
|
|
);
|
|
}
|
|
if (!["MD11", "MD1F"].includes((_a2 = flightPlan.data) == null ? void 0 : _a2.aircraft.icao_code)) {
|
|
return dispatch(
|
|
setToast({
|
|
type: "error",
|
|
message: `Your SimBrief plan is not for a MD-11`
|
|
})
|
|
);
|
|
}
|
|
dispatch(setPlan(flightPlan.data));
|
|
};
|
|
const sendFlightplan = async () => {
|
|
dispatch(sendPlan());
|
|
dispatch(
|
|
setToast({
|
|
type: "success",
|
|
message: `Flight plan sent!`
|
|
})
|
|
);
|
|
};
|
|
function toTime(timestamp) {
|
|
const date = new Date(Number(timestamp) * 1e3);
|
|
return `${date.getUTCHours().toString().padStart(2, "0")}:${date.getUTCMinutes().toString().padStart(2, "0")}`;
|
|
}
|
|
const loadPayload = async () => {
|
|
try {
|
|
if (simBrief.plan.params.units !== planeConfig.options.general.weightUnits) {
|
|
switch (simBrief.plan.params.units) {
|
|
case "kgs":
|
|
simBrief.plan.weights.est_ramp = Math.round(
|
|
simBrief.plan.weights.est_ramp * 2.204623
|
|
);
|
|
simBrief.plan.weights.est_zfw = Math.round(
|
|
simBrief.plan.weights.est_zfw * 2.204623
|
|
);
|
|
simBrief.plan.weights.payload = Math.round(
|
|
simBrief.plan.weights.payload * 2.204623
|
|
);
|
|
simBrief.plan.fuel.plan_ramp = Math.round(
|
|
simBrief.plan.fuel.plan_ramp * 2.204623
|
|
);
|
|
break;
|
|
case "lbs":
|
|
simBrief.plan.weights.est_ramp = Math.round(
|
|
simBrief.plan.weights.est_ramp / 2.204623
|
|
);
|
|
simBrief.plan.weights.est_zfw = Math.round(
|
|
simBrief.plan.weights.est_zfw / 2.204623
|
|
);
|
|
simBrief.plan.weights.payload = Math.round(
|
|
simBrief.plan.weights.payload / 2.204623
|
|
);
|
|
simBrief.plan.fuel.plan_ramp = Math.round(
|
|
simBrief.plan.fuel.plan_ramp / 2.204623
|
|
);
|
|
break;
|
|
}
|
|
}
|
|
dispatch(
|
|
setPayload3({
|
|
load: simBrief.plan.weights.payload / (planeConfig.mtow - minZFW) * 100,
|
|
gw: simBrief.plan.weights.est_ramp,
|
|
zfw: simBrief.plan.weights.est_zfw,
|
|
payload: simBrief.plan.weights.payload,
|
|
fuel: simBrief.plan.fuel.plan_ramp
|
|
})
|
|
);
|
|
dispatch(
|
|
setToast({
|
|
type: "success",
|
|
message: `Payload set!`
|
|
})
|
|
);
|
|
} catch (error) {
|
|
dispatch(
|
|
setToast({
|
|
type: "error",
|
|
message: `Error setting payload`
|
|
})
|
|
);
|
|
}
|
|
};
|
|
(0, import_react13.useEffect)(() => {
|
|
async function getMinZFW() {
|
|
const api2 = await lib();
|
|
const rawMinZFW = api2.getSimulatorVariable(
|
|
"A:EMPTY WEIGHT",
|
|
"Pounds"
|
|
);
|
|
setMinZFW(
|
|
planeConfig.options.general.weightUnits == "kgs" ? Math.round(rawMinZFW / 2.20462) : rawMinZFW
|
|
);
|
|
}
|
|
getMinZFW();
|
|
}, []);
|
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "p-8", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex w-full justify-between", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { className: "text-lg font-bold", children: `${simBrief.plan.general.icao_airline.length ? simBrief.plan.general.icao_airline : ""}${simBrief.plan.general.flight_number}` }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-right text-lg font-bold", children: [
|
|
simBrief.plan.aircraft.name,
|
|
" (",
|
|
simBrief.plan.aircraft.reg,
|
|
")"
|
|
] })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "col-span-2 mt-3 flex items-center justify-center pt-3 md:mt-0", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h1", { className: "text-left text-lg", children: simBrief.plan.origin.icao_code }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex-grow", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative h-full w-full", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "align-items-center absolute top-1/2 w-full px-2", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("hr", { className: "border-2" }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "color-accent-bkg background-color absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 px-2", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "text-center text-lg font-bold", children: [
|
|
toTime(simBrief.plan.times.est_block),
|
|
"\xA0(air:\xA0",
|
|
toTime(simBrief.plan.times.est_time_enroute),
|
|
")"
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "text-center text-lg font-bold", children: [
|
|
`${Number(
|
|
simBrief.plan.general.initial_altitude
|
|
).toLocaleString("en-us")} ft`,
|
|
"\xA0(",
|
|
simBrief.plan.general.cruise_profile,
|
|
")"
|
|
] })
|
|
] })
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-col", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h1", { className: "text-right text-lg", children: simBrief.plan.destination.icao_code }) })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex w-full justify-between", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("h3", { children: [
|
|
Math.floor(
|
|
Number(simBrief.plan.times.sched_out) % 86400 / 3600
|
|
),
|
|
":",
|
|
Math.floor(
|
|
Number(simBrief.plan.times.sched_out) % 86400 % 3600 / 60
|
|
).toString().padStart(2, "0"),
|
|
"\xA0UTC"
|
|
] }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("h3", { className: "text-right", children: [
|
|
Math.floor(
|
|
Number(simBrief.plan.times.est_in) % 86400 / 3600
|
|
),
|
|
":",
|
|
Math.floor(
|
|
Number(simBrief.plan.times.est_in) % 86400 % 3600 / 60
|
|
).toString().padStart(2, "0"),
|
|
"\xA0UTC"
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("h3", { className: "text-right", children: [
|
|
"[",
|
|
simBrief.plan.alternate.icao_code,
|
|
"]"
|
|
] })
|
|
] })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "pb-3 text-center text-base", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-lg", children: `${((_b = (_a = simBrief.plan.general.route) == null ? void 0 : _a.length) != null ? _b : 0) < 500 ? simBrief.plan.general.route : ((_c = simBrief.plan.general.route) == null ? void 0 : _c.substring(0, 500)) + "..."}` }) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("hr", {}),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "grid grid-cols-2 gap-3 pt-3 text-center md:grid-cols-4 md:divide-x-[1px]", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "text-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "whitespace-nowrap", children: "Block Fuel" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-lg", children: `${Number(
|
|
simBrief.plan.fuel.plan_ramp
|
|
).toLocaleString("en-us")} ${simBrief.plan.params.units}` })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "border-l-0 md:border-l-[1px]", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "whitespace-nowrap", children: "Enroute Fuel" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-lg", children: `${Number(
|
|
simBrief.plan.fuel.enroute_burn
|
|
).toLocaleString("en-us")} ${simBrief.plan.params.units}` })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "border-l-0 md:border-l-[1px]", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "whitespace-nowrap", children: "Contingency Fuel" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-lg", children: `${Number(
|
|
simBrief.plan.fuel.contingency
|
|
).toLocaleString("en-us")} ${simBrief.plan.params.units}` })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "border-l-0 md:border-l-[1px]", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "whitespace-nowrap", children: "Taxi Fuel" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-lg", children: `${Number(
|
|
simBrief.plan.fuel.taxi
|
|
).toLocaleString("en-us")} ${simBrief.plan.params.units}` })
|
|
] })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("hr", { className: "my-3" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "grid grid-cols-2 gap-3 text-center md:grid-cols-4 md:divide-x-[1px]", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "whitespace-nowrap", children: "Extra + ETOPS Fuel" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-lg", children: `${(Number(simBrief.plan.fuel.extra) + Number(simBrief.plan.fuel.etops)).toLocaleString("en-us")} ${simBrief.plan.params.units}` })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "whitespace-nowrap", children: "Alternate Fuel" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-lg", children: `${Number(
|
|
simBrief.plan.fuel.alternate_burn
|
|
).toLocaleString("en-us")} ${simBrief.plan.params.units}` })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "whitespace-nowrap", children: "Reserve Fuel" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "text-lg", children: `${Number(
|
|
simBrief.plan.fuel.reserve
|
|
).toLocaleString("en-us")} ${simBrief.plan.params.units}` })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "whitespace-nowrap", children: "Estimated ZFW" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "text-lg", children: [
|
|
Number(
|
|
simBrief.plan.weights.est_zfw
|
|
).toLocaleString("en-us"),
|
|
" ",
|
|
simBrief.plan.params.units
|
|
] })
|
|
] })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("hr", { className: "my-3" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "grid grid-cols-2 gap-3 text-center md:grid-cols-4 md:divide-x-[1px]", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", {}),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "border-l-0 md:border-l-[1px]", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "whitespace-nowrap", children: "Estimated TOW" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "text-lg", children: [
|
|
Number(
|
|
simBrief.plan.weights.est_tow
|
|
).toLocaleString("en-us"),
|
|
" ",
|
|
simBrief.plan.params.units
|
|
] })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "border-l-0 md:border-l-[1px]", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "whitespace-nowrap", children: "Estimated LW" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("p", { className: "text-lg", children: [
|
|
Number(
|
|
simBrief.plan.weights.est_ldw
|
|
).toLocaleString("en-us"),
|
|
" ",
|
|
simBrief.plan.params.units
|
|
] })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", {})
|
|
] })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "mt-6 flex w-full items-center justify-around gap-x-6", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
"button",
|
|
{
|
|
onClick: sendFlightplan,
|
|
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
children: "Send flight plan to FMC"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
"button",
|
|
{
|
|
onClick: loadPayload,
|
|
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
children: "Set payload & fuel"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
"button",
|
|
{
|
|
onClick: () => dispatch(
|
|
setRoute({
|
|
path: "/charts",
|
|
params: {
|
|
icao: simBrief.plan.origin.icao_code
|
|
}
|
|
})
|
|
),
|
|
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
children: "View departure airport charts"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
"button",
|
|
{
|
|
onClick: () => dispatch(
|
|
setRoute({
|
|
path: "/charts",
|
|
params: {
|
|
icao: simBrief.plan.destination.icao_code
|
|
}
|
|
})
|
|
),
|
|
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
children: "View arrival airport charts"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
"button",
|
|
{
|
|
onClick: () => importPlan(),
|
|
className: "middle none center rounded-lg bg-green-700 px-6 py-3 font-sans text-xs font-bold uppercase text-white shadow-md shadow-green-500/20 transition-all hover:shadow-lg hover:shadow-green-500/40 focus:opacity-[0.85] focus:shadow-none active:opacity-[0.85] active:shadow-none disabled:pointer-events-none disabled:opacity-50 disabled:shadow-none",
|
|
children: "Reload flight plan"
|
|
}
|
|
)
|
|
] })
|
|
] });
|
|
};
|
|
var Reloading = () => {
|
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex h-full w-full flex-col items-center justify-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
FontAwesomeIcon,
|
|
{
|
|
icon: faSpinner,
|
|
className: "animate-spin text-6xl"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "mb-6 text-lg", children: "Reloading flight plan..." })
|
|
] });
|
|
};
|
|
function DispatchPage() {
|
|
const simBrief = useSelector((state) => state.simbrief);
|
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex h-full w-full flex-col items-center justify-center", children: simBrief.username && !simBrief.plan ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ImportFlightPlan, {}) : simBrief.plan === "reloading" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Reloading, {}) : simBrief.plan ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FlightPlanViewer, {}) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(RedirectToOptionsPage, {}) });
|
|
}
|
|
|
|
// src/routes/ServicesPage.tsx
|
|
var import_react14 = __toESM(require_react());
|
|
init_common();
|
|
var import_jsx_runtime13 = __toESM(require_jsx_runtime());
|
|
var DoorIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
"svg",
|
|
{
|
|
height: "96",
|
|
viewBox: "0 0 64 64",
|
|
width: "96",
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
"rect",
|
|
{
|
|
className: `fill-none ${props.stroke} stroke-[3]`,
|
|
height: "44",
|
|
rx: "4",
|
|
ry: "4",
|
|
width: "28",
|
|
x: "18",
|
|
y: "10"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
"circle",
|
|
{
|
|
className: `fill-none ${props.stroke} stroke-[3]`,
|
|
cx: "32",
|
|
cy: "22",
|
|
r: "4"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
"rect",
|
|
{
|
|
className: `fill-none ${props.stroke} stroke-[3]`,
|
|
height: "6",
|
|
width: "16",
|
|
x: "24",
|
|
y: "34"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
"line",
|
|
{
|
|
className: `fill-none ${props.stroke} stroke-[3]`,
|
|
x1: "18",
|
|
x2: "46",
|
|
y1: "46",
|
|
y2: "46"
|
|
}
|
|
)
|
|
] })
|
|
}
|
|
);
|
|
var GPUIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
"svg",
|
|
{
|
|
height: "96",
|
|
version: "1.1",
|
|
viewBox: "0 0 846.66 846.66",
|
|
width: "96",
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("g", { id: "Layer_x0020_1", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
"path",
|
|
{
|
|
className: props.fill,
|
|
d: "M124.47 156.15l287.42 0c62.69,0 113.9,51.21 113.9,113.9l0 219.18c78.2,0 68.3,-9.18 68.3,80.08 136.19,77.86 298.94,-89.42 127.82,-269.41 -31.96,18.89 -73.25,13.8 -99.6,-12.54l-63.04 -63.05c-7.9,-7.9 -7.9,-20.71 0,-28.61l6.93 -6.93 -40.33 -40.33c-7.9,-7.9 -7.9,-20.71 0,-28.61l44.68 -44.69c7.9,-7.9 20.72,-7.9 28.62,0l40.33 40.33 6.93 -6.94c7.9,-7.9 20.71,-7.9 28.61,0l63.05 63.05c26.41,26.42 31.45,67.85 12.41,99.83 197.5,206.85 14.07,416.68 -156.41,342.92l0 25.42c0,11.18 -9.06,20.24 -20.23,20.24l-48.07 0c0,67.14 -50.55,117.46 -113.9,117.46l-287.42 0c-62.68,0 -113.9,-51.21 -113.9,-113.9l0 -393.5c0,-62.69 51.21,-113.9 113.9,-113.9zm179.53 220.62c18.83,-18.84 47.45,9.77 28.61,28.61l-73.63 73.63 67.25 0c18.06,0 26.95,21.9 14.31,34.54l-111.52 111.52c-18.84,18.83 -47.45,-9.78 -28.61,-28.61l76.98 -76.98 -67.25 0c-17.88,-0.01 -27.08,-21.78 -14.31,-34.54l108.17 -108.17zm221.79 152.92l0 89.83 27.84 0 0 -89.83 -27.84 0zm76.39 -319.69l48.74 48.74c38.94,38.94 96.56,-20.54 58.56,-58.54l-48.75 -48.75 -58.55 58.55zm-17.32 -91.95l-16.08 16.08 26.03 26.02 16.08 -16.07 -26.03 -26.03zm-193.21 111.5c0,-26.64 40.47,-26.64 40.47,0l0 32.12c0,26.64 -40.47,26.64 -40.47,0l0 -32.12zm-71.85 0c0,-26.64 40.47,-26.64 40.47,0l0 32.12c0,26.64 -40.47,26.64 -40.47,0l0 -32.12zm-71.85 0c0,-26.64 40.46,-26.64 40.46,0l0 32.12c0,26.64 -40.46,26.64 -40.46,0l0 -32.12zm-71.85 0c0,-26.64 40.46,-26.64 40.46,0l0 32.12c0,26.64 -40.46,26.64 -40.46,0l0 -32.12zm-71.86 0c0,-26.64 40.47,-26.64 40.47,0l0 32.12c0,26.64 -40.47,26.64 -40.47,0l0 -32.12zm307.65 -32.94l-287.42 0c-40.35,0 -73.44,33.09 -73.44,73.44l0 393.5c0,40.35 33.1,73.43 73.44,73.43l287.42 0c40.35,0 73.44,-33.08 73.44,-73.43l0 -393.5c0,-40.35 -33.09,-73.44 -73.44,-73.44z"
|
|
}
|
|
) })
|
|
}
|
|
);
|
|
var ASUIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
"svg",
|
|
{
|
|
height: "96",
|
|
version: "1.1",
|
|
viewBox: "0 0 64 64",
|
|
width: "96",
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
"path",
|
|
{
|
|
d: "M49,18c-2.897,0-5.665,0.894-8,2.527v-4.628c2.279-0.465,4-2.484,4-4.899V7h-8V6 c0-2.757-2.243-5-5-5H6C3.243,1,1,3.243,1,6v57h36v-7.826C39.449,59.255,43.904,62,49,62c7.72,0,14-6.28,14-14V32 C63,24.28,56.72,18,49,18z M41,34v-2c0-4.411,3.589-8,8-8s8,3.589,8,8v16c0,4.411-3.589,8-8,8s-8-3.589-8-8V34z M43,11 c0,1.654-1.346,3-3,3h-4c-1.654,0-3-1.346-3-3V9h10V11z M35,44H3V31h32v1V44z M6,3h26c1.654,0,3,1.346,3,3v1h-2.184 C32.402,5.839,31.302,5,30,5H8C6.346,5,5,6.346,5,8v14c0,1.654,1.346,3,3,3h22c1.654,0,3-1.346,3-3v-7.026 c0.584,0.442,1.257,0.773,2,0.924V29H3V6C3,4.346,4.346,3,6,3z M31,11v11c0,0.552-0.448,1-1,1H8c-0.552,0-1-0.448-1-1V8 c0-0.552,0.448-1,1-1h22c0.552,0,1,0.448,1,1V11z M35,61H3V46h32v2V61z M61,48c0,6.617-5.383,12-12,12s-12-5.383-12-12V32V16h2v16 v2v14c0,5.514,4.486,10,10,10s10-4.486,10-10V32c0-5.514-4.486-10-10-10c-3.273,0-6.175,1.588-8,4.026v-2.953 C43.205,21.095,46.025,20,49,20c6.617,0,12,5.383,12,12V48z",
|
|
className: props.fill
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
"path",
|
|
{
|
|
d: "M11,38c0-1.103,0.897-2,2-2h2v-2h-2c-2.206,0-4,1.794-4,4s1.794,4,4,4h10v-2H13 C11.897,40,11,39.103,11,38z",
|
|
className: props.fill
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { height: "2", className: props.fill, width: "2", x: "25", y: "40" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
"path",
|
|
{
|
|
d: "M19,35.5c0-0.275,0.225-0.5,0.5-0.5h1v-2h-1c-1.379,0-2.5,1.121-2.5,2.5s1.121,2.5,2.5,2.5H27v-2 h-7.5C19.225,36,19,35.775,19,35.5z",
|
|
className: props.fill
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { height: "2", className: props.fill, width: "2", x: "27", y: "19" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { height: "2", className: props.fill, width: "2", x: "23", y: "19" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("rect", { height: "2", className: props.fill, width: "2", x: "19", y: "19" })
|
|
] })
|
|
}
|
|
);
|
|
var ChocksIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
"svg",
|
|
{
|
|
height: "96",
|
|
width: "96",
|
|
id: "eoaxE0scCFZ1",
|
|
className: props.fill,
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
viewBox: "0 0 300 300",
|
|
shapeRendering: "geometricPrecision",
|
|
textRendering: "geometricPrecision",
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M71.389234,133.77154L56.999467,164.682892h186.001065l-14.389755-30.911345-157.221543-.000007Z" })
|
|
}
|
|
);
|
|
var DoorComponent = (props) => {
|
|
const [actualPosition, setActualPosition] = (0, import_react14.useState)(0);
|
|
const [commandedPosition, setCommandedPosition] = (0, import_react14.useState)(0);
|
|
const [keepAlive, setKeepAlive] = (0, import_react14.useState)(0);
|
|
const commandPosition = (position) => {
|
|
lib().then((api2) => {
|
|
api2.setSimulatorVariable(
|
|
`L:MD11_EXT_DOOR_CMD_${props.variable}`,
|
|
"number",
|
|
position
|
|
);
|
|
setCommandedPosition(position);
|
|
});
|
|
};
|
|
(0, import_react14.useEffect)(() => {
|
|
lib().then((api2) => {
|
|
setActualPosition(
|
|
api2.getSimulatorVariable(`L:MD11_EXT_DOOR_${props.variable}`)
|
|
);
|
|
setCommandedPosition(
|
|
api2.getSimulatorVariable(
|
|
`L:MD11_EXT_DOOR_CMD_${props.variable}`
|
|
)
|
|
);
|
|
});
|
|
}, [props.variable]);
|
|
(0, import_react14.useEffect)(() => {
|
|
const timeoutID = setTimeout(() => {
|
|
setKeepAlive(keepAlive == 1 ? 0 : 1);
|
|
lib().then((api2) => {
|
|
const position = api2.getSimulatorVariable(
|
|
`L:MD11_EXT_DOOR_${props.variable}`
|
|
);
|
|
const commandedPos = api2.getSimulatorVariable(
|
|
`L:MD11_EXT_DOOR_CMD_${props.variable}`,
|
|
"number"
|
|
);
|
|
setActualPosition(position);
|
|
setCommandedPosition(commandedPos);
|
|
});
|
|
}, 2500);
|
|
return () => clearTimeout(timeoutID);
|
|
}, [keepAlive, props.variable]);
|
|
const getBackgroundColor = () => {
|
|
if (actualPosition === 0 && actualPosition === commandedPosition) {
|
|
return "bg-green-600";
|
|
} else if (actualPosition === 100 && actualPosition === commandedPosition) {
|
|
return "bg-red-600";
|
|
} else {
|
|
return "bg-orange-600";
|
|
}
|
|
};
|
|
const getStroke = () => {
|
|
const backgroundColor = getBackgroundColor();
|
|
switch (backgroundColor) {
|
|
case "bg-green-600":
|
|
return "stroke-white";
|
|
case "bg-red-600":
|
|
return "stroke-green-400";
|
|
default:
|
|
return "stroke-flash";
|
|
}
|
|
};
|
|
const getText = () => {
|
|
if (actualPosition === 0 && actualPosition === commandedPosition) {
|
|
return "Closed";
|
|
} else if (actualPosition === 100 && actualPosition === commandedPosition) {
|
|
return "Open";
|
|
} else {
|
|
return "Moving...";
|
|
}
|
|
};
|
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "mb-5 flex h-36 w-full place-items-center rounded-lg bg-zinc-600 p-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DoorIcon, { stroke: getStroke() }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "basis-full text-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "mb-1 h-min whitespace-nowrap text-base", children: props.doorName }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
"button",
|
|
{
|
|
onClick: () => {
|
|
commandPosition(commandedPosition === 0 ? 100 : 0);
|
|
},
|
|
className: `h-min rounded-lg p-2 disabled:opacity-75 ${getBackgroundColor()}`,
|
|
children: [
|
|
getText(),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "hidden", children: keepAlive })
|
|
]
|
|
}
|
|
)
|
|
] })
|
|
] });
|
|
};
|
|
function ServicesPage() {
|
|
const [gpu, setGPU] = (0, import_react14.useState)(false);
|
|
const [asu, setASU] = (0, import_react14.useState)(false);
|
|
const [chocks, setChocks] = (0, import_react14.useState)(false);
|
|
const [noseWeight, setNoseWeight] = (0, import_react14.useState)(false);
|
|
const [isCargo, setIsCargo] = (0, import_react14.useState)(false);
|
|
(0, import_react14.useEffect)(() => {
|
|
async function getGroundServices() {
|
|
const simLib = await lib();
|
|
setGPU(simLib.getSimulatorVariable(`L:MD11_EXT_GPU`));
|
|
setASU(simLib.getSimulatorVariable(`L:MD11_EXT_ASU`));
|
|
setChocks(simLib.getSimulatorVariable(`L:MD11_EXT_CHOCKS`));
|
|
setNoseWeight(simLib.getSimulatorVariable(`L:MD11_EXT_NOSE_WGT`));
|
|
setIsCargo(simLib.getEFBVariable("IS_CARGO") === 1);
|
|
}
|
|
getGroundServices();
|
|
}, []);
|
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(GroundPage, { children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex h-full w-full flex-col gap-y-2 py-5 text-base", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-grow justify-evenly", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex w-1/5 flex-col", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
DoorComponent,
|
|
{
|
|
doorName: "Passenger 1L",
|
|
variable: "PAX_1L"
|
|
}
|
|
),
|
|
!isCargo && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
DoorComponent,
|
|
{
|
|
doorName: "Passenger 2L",
|
|
variable: "PAX_2L"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
DoorComponent,
|
|
{
|
|
doorName: "Passenger 3L",
|
|
variable: "PAX_3L"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
DoorComponent,
|
|
{
|
|
doorName: "Passenger 4L",
|
|
variable: "PAX_4L"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex w-1/5 flex-col", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
DoorComponent,
|
|
{
|
|
doorName: "Passenger 1R",
|
|
variable: "PAX_1R"
|
|
}
|
|
),
|
|
!isCargo && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
DoorComponent,
|
|
{
|
|
doorName: "Passenger 2R",
|
|
variable: "PAX_2R"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
DoorComponent,
|
|
{
|
|
doorName: "Passenger 3R",
|
|
variable: "PAX_3R"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
DoorComponent,
|
|
{
|
|
doorName: "Passenger 4R",
|
|
variable: "PAX_4R"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex w-1/5 flex-col", children: [
|
|
isCargo && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
DoorComponent,
|
|
{
|
|
doorName: "Cargo Main",
|
|
variable: "CARGO_MAIN"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
DoorComponent,
|
|
{
|
|
doorName: "Cargo 1R",
|
|
variable: "CARGO_1R"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
DoorComponent,
|
|
{
|
|
doorName: "Cargo 2R",
|
|
variable: "CARGO_2R"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
DoorComponent,
|
|
{
|
|
doorName: "Bulk Cargo",
|
|
variable: "CARGO_BULK"
|
|
}
|
|
)
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex w-1/5 flex-col", children: [
|
|
isCargo && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "mb-5 flex w-full grow basis-1 place-items-center gap-x-2 rounded-lg bg-zinc-600 p-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "h-[96px] w-[96px] p-2", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
FontAwesomeIcon,
|
|
{
|
|
icon: faWeightHanging,
|
|
className: `h-full w-full ${noseWeight ? "text-green-400" : "text-white"}`
|
|
}
|
|
) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "grow text-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "mb-1 h-min whitespace-nowrap text-base", children: "Nose Weight" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
"button",
|
|
{
|
|
onClick: () => {
|
|
lib().then((api2) => {
|
|
api2.setSimulatorVariable(
|
|
"L:MD11_EXT_NOSE_WGT",
|
|
"number",
|
|
noseWeight ? 0 : 1
|
|
);
|
|
setNoseWeight(!noseWeight);
|
|
});
|
|
},
|
|
className: `h-min rounded-lg p-2 ${noseWeight ? "bg-red-600" : "bg-green-600"}`,
|
|
children: noseWeight ? "Remove" : "Set"
|
|
}
|
|
)
|
|
] })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "mb-5 flex w-full grow basis-1 place-items-center rounded-lg bg-zinc-600 p-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
GPUIcon,
|
|
{
|
|
fill: gpu ? "fill-green-400" : "fill-white"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "grow text-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "mb-1 h-min whitespace-nowrap text-base", children: "GPU" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
"button",
|
|
{
|
|
onClick: () => {
|
|
lib().then((api2) => {
|
|
api2.setSimulatorVariable(
|
|
"L:MD11_EXT_GPU",
|
|
"number",
|
|
gpu ? 0 : 1
|
|
);
|
|
setGPU(!gpu);
|
|
});
|
|
},
|
|
className: `h-min rounded-lg p-2 ${gpu ? "bg-red-600" : "bg-green-600"}`,
|
|
children: gpu ? "Disconnect" : "Connect"
|
|
}
|
|
)
|
|
] })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "mb-5 flex w-full grow basis-1 place-items-center rounded-lg bg-zinc-600 p-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
ASUIcon,
|
|
{
|
|
fill: asu ? "fill-green-400" : "fill-white"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "grow text-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "mb-1 h-min whitespace-nowrap text-base", children: "ASU" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
"button",
|
|
{
|
|
onClick: () => {
|
|
lib().then((api2) => {
|
|
api2.setSimulatorVariable(
|
|
"L:MD11_EXT_ASU",
|
|
"number",
|
|
asu ? 0 : 1
|
|
);
|
|
setASU(!asu);
|
|
});
|
|
},
|
|
className: `h-min rounded-lg p-2 ${asu ? "bg-red-600" : "bg-green-600"}`,
|
|
children: asu ? "Disconnect" : "Connect"
|
|
}
|
|
)
|
|
] })
|
|
] }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex w-full grow basis-1 place-items-center rounded-lg bg-zinc-600 p-4", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
ChocksIcon,
|
|
{
|
|
fill: chocks ? "fill-green-400" : "fill-white"
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "grow text-center", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "mb-1 h-min whitespace-nowrap text-base", children: "Wheel Chocks" }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
"button",
|
|
{
|
|
onClick: () => {
|
|
lib().then((api2) => {
|
|
api2.setSimulatorVariable(
|
|
"L:MD11_EXT_CHOCKS",
|
|
"number",
|
|
chocks ? 0 : 1
|
|
);
|
|
setChocks(!chocks);
|
|
});
|
|
},
|
|
className: `h-min rounded-lg p-2 ${chocks ? "bg-red-600" : "bg-green-600"}`,
|
|
children: chocks ? "Remove" : "Set"
|
|
}
|
|
)
|
|
] })
|
|
] })
|
|
] })
|
|
] }) }) });
|
|
}
|
|
|
|
// src/components/Router.tsx
|
|
init_common();
|
|
var import_jsx_runtime14 = __toESM(require_jsx_runtime());
|
|
var routes = {
|
|
"/dispatch": {
|
|
button: {
|
|
title: "Dispatch",
|
|
icon: faRoute
|
|
},
|
|
page: DispatchPage
|
|
},
|
|
"/payload": {
|
|
button: {
|
|
title: "Payload",
|
|
icon: faWeightHanging
|
|
},
|
|
page: PayloadPage
|
|
},
|
|
"/perf": {
|
|
button: {
|
|
title: "Perf",
|
|
icon: faPlane
|
|
},
|
|
page: PerformancePage
|
|
},
|
|
"/charts": {
|
|
button: {
|
|
title: "Charts",
|
|
icon: faMap
|
|
},
|
|
page: ChartPage
|
|
},
|
|
"/services": {
|
|
button: {
|
|
title: "Services",
|
|
icon: faTransformerBolt
|
|
},
|
|
page: ServicesPage
|
|
},
|
|
"/state": {
|
|
button: {
|
|
title: "State",
|
|
icon: faPanelEws
|
|
},
|
|
page: PanelStatePage
|
|
},
|
|
"/options": {
|
|
button: {
|
|
title: "Options",
|
|
icon: faCog
|
|
},
|
|
page: OptionsPage
|
|
}
|
|
};
|
|
function Router() {
|
|
const dispatch = useDispatch();
|
|
const router = useSelector((state) => state.router);
|
|
const brightness = useSelector(
|
|
(state) => state.plane.brightness
|
|
);
|
|
const [serialNumber, setSerialNumber] = (0, import_react15.useState)(0);
|
|
let commBus = null;
|
|
if (simulator() == 0 /* MSFS */) {
|
|
commBus = RegisterViewListener("JS_LISTENER_COMM_BUS");
|
|
commBus.on("receiveSimBriefUsername", (username) => {
|
|
dispatch(setUsername(username));
|
|
});
|
|
commBus.on("receiveHoppie", (code) => {
|
|
dispatch(setCode(code));
|
|
});
|
|
commBus.on("receiveSayIntentions", (code) => {
|
|
dispatch(setCode2(code));
|
|
});
|
|
commBus.on("receiveAirport", (airportEntry) => {
|
|
const arpt = JSON.parse(airportEntry).airport;
|
|
const airport = {
|
|
icao: arpt.ICAO.split(":")[1],
|
|
elevation: arpt.Elevation,
|
|
runways: arpt.Runways.map((runway) => {
|
|
return {
|
|
id: runway.ID,
|
|
ident: runway.Ident,
|
|
trueHeading: runway.TrueHeading,
|
|
length: runway.Length,
|
|
slope: runway.Slope
|
|
};
|
|
})
|
|
};
|
|
if (arpt.ICAO.startsWith("D:")) {
|
|
dispatch(setDepartureAirport(airport));
|
|
} else {
|
|
dispatch(setArrivalAirport(airport));
|
|
}
|
|
});
|
|
commBus.on("receiveNavigraphSDKInit", (sdkInit) => {
|
|
dispatch(setNavigraphSDKInit(sdkInit));
|
|
});
|
|
commBus.on("receiveNavigraphRefreshToken", (refreshToken) => {
|
|
dispatch(setNavigraphRefreshToken(refreshToken));
|
|
});
|
|
commBus.on("receiveNavigraphAccessToken", (accessToken) => {
|
|
dispatch(setNavigraphAccessToken(accessToken));
|
|
});
|
|
commBus.on("perfTOReadyRead", async () => {
|
|
const api2 = await lib();
|
|
setTimeout(() => {
|
|
dispatch(
|
|
setDeparturePerformance({
|
|
v1: Math.round(api2.getEFBVariable("V1")),
|
|
vr: Math.round(api2.getEFBVariable("VR")),
|
|
v2: Math.round(api2.getEFBVariable("V2")),
|
|
flex: Math.round(api2.getEFBVariable("FLEX_TEMP")),
|
|
flaps: api2.getEFBVariable("FLAPS")
|
|
})
|
|
);
|
|
}, 500);
|
|
});
|
|
commBus.on("optionsReady", async () => {
|
|
const api2 = await lib();
|
|
setTimeout(() => {
|
|
switch (api2.getSimulatorVariable("E:TIME OF DAY", "number")) {
|
|
case 0:
|
|
case 2:
|
|
dispatch(
|
|
setBrightness({
|
|
brightness: 55
|
|
})
|
|
);
|
|
break;
|
|
case 1:
|
|
dispatch(
|
|
setBrightness({
|
|
brightness: 100
|
|
})
|
|
);
|
|
break;
|
|
case 3:
|
|
dispatch(
|
|
setBrightness({
|
|
brightness: 25
|
|
})
|
|
);
|
|
break;
|
|
default:
|
|
dispatch(
|
|
setBrightness({
|
|
brightness: 55
|
|
})
|
|
);
|
|
break;
|
|
}
|
|
dispatch(getPlaneConfig());
|
|
}, 500);
|
|
});
|
|
Coherent.call(
|
|
"COMM_BUS_WASM_CALLBACK",
|
|
"requestSimBriefUsername",
|
|
"null"
|
|
);
|
|
Coherent.call("COMM_BUS_WASM_CALLBACK", "requestHoppieCode", "null");
|
|
Coherent.call(
|
|
"COMM_BUS_WASM_CALLBACK",
|
|
"requestSayIntentionsCode",
|
|
"null"
|
|
);
|
|
Coherent.call(
|
|
"COMM_BUS_WASM_CALLBACK",
|
|
"requestNavigraphSDKInit",
|
|
"null"
|
|
);
|
|
Coherent.call(
|
|
"COMM_BUS_WASM_CALLBACK",
|
|
"requestNavigraphRefreshToken",
|
|
"null"
|
|
);
|
|
Coherent.call(
|
|
"COMM_BUS_WASM_CALLBACK",
|
|
"requestNavigraphAccessToken",
|
|
"null"
|
|
);
|
|
}
|
|
const Component = routes[router.route.path] !== void 0 ? routes[router.route.path].page : null;
|
|
(0, import_react15.useEffect)(() => {
|
|
setTimeout(() => {
|
|
async function getSerialNumber() {
|
|
const api2 = await lib();
|
|
setSerialNumber(api2.getEFBVariable("SERIAL_NUMBER"));
|
|
}
|
|
getSerialNumber();
|
|
}, 5e3);
|
|
}, []);
|
|
(0, import_react15.useEffect)(() => {
|
|
if (router.timeout) {
|
|
setTimeout(() => {
|
|
dispatch(clearToast());
|
|
}, router.timeout);
|
|
}
|
|
}, [dispatch, router.timeout]);
|
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
"div",
|
|
{
|
|
className: "pointer-events-none absolute left-0 top-0 z-20 h-screen w-screen bg-black",
|
|
style: {
|
|
opacity: (100 - brightness) / 100
|
|
}
|
|
}
|
|
),
|
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex h-screen w-screen flex-col bg-zinc-900", children: [
|
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-row", style: { height: "48px" }, children: Object.entries(routes).map(([route, { button }]) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
IconButton,
|
|
{
|
|
link: route,
|
|
title: button.title,
|
|
icon: button.icon,
|
|
currentRoute: router.route.path
|
|
},
|
|
route
|
|
)) }),
|
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
"div",
|
|
{
|
|
className: "flex w-full pt-4 text-white",
|
|
style: { height: "calc(100vh - 48px)" },
|
|
children: [
|
|
Component ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Component, { params: router.route.params || {} }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, {}),
|
|
router.toast && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "absolute bottom-0 right-0 z-10 m-4", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
"div",
|
|
{
|
|
className: `${router.toast.type === "error" ? "bg-red-500" : "bg-green-700"} rounded-lg p-4`,
|
|
children: [
|
|
router.toast.message,
|
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
"button",
|
|
{
|
|
className: `${router.toast.type === "error" ? "bg-red-500" : "bg-green-700"} float-right ml-4`,
|
|
onClick: () => dispatch(clearToast()),
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FontAwesomeIcon, { icon: faClose })
|
|
}
|
|
)
|
|
]
|
|
}
|
|
) }),
|
|
serialNumber !== 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { className: "absolute bottom-0 right-0 z-0 m-4 text-lg text-zinc-400", children: [
|
|
"Collector #",
|
|
String(serialNumber).padStart(4, "0")
|
|
] })
|
|
]
|
|
}
|
|
)
|
|
] })
|
|
] });
|
|
}
|
|
|
|
// src/main.tsx
|
|
var import_jsx_runtime15 = __toESM(require_jsx_runtime());
|
|
import_client.default.createRoot(document.getElementById("MSFS_REACT_MOUNT")).render(
|
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react16.default.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
import_react_error_boundary_cjs.ErrorBoundary,
|
|
{
|
|
fallbackRender: ({ error }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: error.message }),
|
|
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Provider_default, { store, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Router, {}) })
|
|
}
|
|
) })
|
|
);
|
|
})();
|
|
/*
|
|
object-assign
|
|
(c) Sindre Sorhus
|
|
@license MIT
|
|
*/
|
|
/**
|
|
* @license QR Code generator library (TypeScript)
|
|
* Copyright (c) Project Nayuki.
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
/**
|
|
* @license React
|
|
* react-dom.development.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
/**
|
|
* @license React
|
|
* react-jsx-runtime.development.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
/**
|
|
* @license React
|
|
* react.development.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
/**
|
|
* @license React
|
|
* scheduler.development.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
/**
|
|
* @license React
|
|
* use-sync-external-store-with-selector.development.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
/**
|
|
* @license qrcode.react
|
|
* Copyright (c) Paul O'Shannessy
|
|
* SPDX-License-Identifier: ISC
|
|
*/
|
|
/**
|
|
* Checks if an event is supported in the current execution environment.
|
|
*
|
|
* NOTE: This will not work correctly for non-generic events such as `change`,
|
|
* `reset`, `load`, `error`, and `select`.
|
|
*
|
|
* Borrows from Modernizr.
|
|
*
|
|
* @param {string} eventNameSuffix Event name, e.g. "click".
|
|
* @return {boolean} True if the event is supported.
|
|
* @internal
|
|
* @license Modernizr 3.0.0pre (Custom Build) | MIT
|
|
*/
|
|
/** @license React v16.13.1
|
|
* react-is.development.js
|
|
*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
}
|
|
|
|
Update() {
|
|
super.Update();
|
|
this.dispatchEvent(new CustomEvent('update', { detail: this.getDeltaTime() }));
|
|
}
|
|
|
|
onInteractionEvent(event) {
|
|
const eventName = String(event);
|
|
this.dispatchEvent(new CustomEvent(eventName));
|
|
this.dispatchEvent(new CustomEvent('*', { detail: eventName }));
|
|
}
|
|
}
|
|
|
|
registerInstrument('aircraft_efb-tfdi_md11_efb', InstrumentLogic);
|