{"version":3,"sources":["../../src/utils/getReactFiberFromNode.ts"],"sourcesContent":["import type * as React from 'react';\n\n// ========================================================\n// react/packages/shared/ReactTypes.js\n// ========================================================\n\ntype ReactEventResponder<E, C> = {\n  $$typeof: Symbol | number;\n  displayName: string;\n  targetEventTypes: null | string[];\n  rootEventTypes: null | string[];\n  getInitialState: null | ((props: Object) => Object);\n  onEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n  onRootEvent: null | ((event: E, context: C, props: Object, state: Object) => void);\n  onMount: null | ((context: C, props: Object, state: Object) => void);\n  onUnmount: null | ((context: C, props: Object, state: Object) => void);\n};\n\ntype ReactEventResponderInstance<E, C> = {\n  fiber: Object;\n  props: Object;\n  responder: ReactEventResponder<E, C>;\n  rootEventTypes: null | Set<string>;\n  state: Object;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiberHooks.js\n// ========================================================\n\nexport type HookType =\n  | 'useState'\n  | 'useReducer'\n  | 'useContext'\n  | 'useRef'\n  | 'useEffect'\n  | 'useLayoutEffect'\n  | 'useCallback'\n  | 'useMemo'\n  | 'useImperativeHandle'\n  | 'useDebugValue'\n  | 'useResponder';\n\ntype ReactProviderType<T> = {\n  $$typeof: Symbol | number;\n  _context: ReactContext<T>;\n};\n\ntype ReactContext<T> = {\n  $$typeof: Symbol | number;\n  Consumer: ReactContext<T>;\n  Provider: ReactProviderType<T>;\n\n  _calculateChangedBits: ((a: T, b: T) => number) | null;\n\n  _currentValue: T;\n  _currentValue2: T;\n  _threadCount: number;\n\n  // DEV only\n  _currentRenderer?: Object | null;\n  _currentRenderer2?: Object | null;\n};\n\ntype ContextDependency<T> = {\n  context: ReactContext<T>;\n  observedBits: number;\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  next: ContextDependency<any> | null;\n};\n\nenum WorkTag {\n  FunctionComponent = 0,\n  ClassComponent = 1,\n  IndeterminateComponent = 2, // Before we know whether it is function or class\n  HostRoot = 3, // Root of a host tree. Could be nested inside another node.\n  HostPortal = 4, // A subtree. Could be an entry point to a different renderer.\n  HostComponent = 5,\n  HostText = 6,\n  Fragment = 7,\n  Mode = 8,\n  ContextConsumer = 9,\n  ContextProvider = 10,\n  ForwardRef = 11,\n  Profiler = 12,\n  SuspenseComponent = 13,\n  MemoComponent = 14,\n  SimpleMemoComponent = 15,\n  LazyComponent = 16,\n  IncompleteClassComponent = 17,\n  DehydratedFragment = 18,\n  SuspenseListComponent = 19,\n  FundamentalComponent = 20,\n  ScopeComponent = 21,\n}\n\ntype Source = {\n  fileName: string;\n  lineNumber: number;\n};\n\ntype ExpirationTime = number;\n\ntype Dependencies = {\n  expirationTime: ExpirationTime;\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  firstContext: ContextDependency<any> | null;\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  responders: Map<ReactEventResponder<any, any>, ReactEventResponderInstance<any, any>> | null;\n};\n\n// ========================================================\n// react/packages/react-reconciler/src/ReactFiber.js\n// ========================================================\n\n// A Fiber is work on a Component that needs to be done or was done. There can\n// be more than one per component.\n\nexport type Fiber = {\n  // These first fields are conceptually members of an Instance. This used to\n  // be split into a separate type and intersected with the other Fiber fields,\n  // but until Flow fixes its intersection bugs, we've merged them into a\n  // single type.\n\n  // An Instance is shared between all versions of a component. We can easily\n  // break this out into a separate object to avoid copying so much to the\n  // alternate versions of the tree. We put this on a single object for now to\n  // minimize the number of objects created during the initial render.\n\n  // Tag identifying the type of fiber.\n  tag: WorkTag;\n\n  // Unique identifier of this child.\n  key: null | string;\n\n  // The value of element.type which is used to preserve the identity during\n  // reconciliation of this child.\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  elementType: any;\n\n  // The resolved function/class/ associated with this fiber.\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  type: any;\n\n  // The local state associated with this fiber.\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  stateNode: any;\n\n  // Conceptual aliases\n  // parent : Instance -> return The parent happens to be the same as the\n  // return fiber since we've merged the fiber and instance.\n\n  // Remaining fields belong to Fiber\n\n  // The Fiber to return to after finishing processing this one.\n  // This is effectively the parent, but there can be multiple parents (two)\n  // so this is only the parent of the thing we're currently processing.\n  // It is conceptually the same as the return address of a stack frame.\n  return: Fiber | null;\n\n  // Singly Linked List Tree Structure.\n  child: Fiber | null;\n  sibling: Fiber | null;\n  index: number;\n\n  // The ref last used to attach this node.\n  // I'll avoid adding an owner field for prod and model that as functions.\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  ref: React.Ref<any>;\n\n  // Input is the data coming into process this fiber. Arguments. Props.\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  pendingProps: any; // This type will be more specific once we overload the tag.\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  memoizedProps: any; // The props used to create the output.\n\n  // A queue of state updates and callbacks.\n  // updateQueue: UpdateQueue<any> | null,\n\n  // The state used to create the output\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\n  memoizedState: any;\n\n  // Dependencies (contexts, events) for this fiber, if it has any\n  dependencies: Dependencies | null;\n\n  // // Bitfield that describes properties about the fiber and its subtree. E.g.\n  // // the ConcurrentMode flag indicates whether the subtree should be async-by-\n  // // default. When a fiber is created, it inherits the mode of its\n  // // parent. Additional flags can be set at creation time, but after that the\n  // // value should remain unchanged throughout the fiber's lifetime, particularly\n  // // before its child fibers are created.\n  // mode: TypeOfMode\n  //\n  // // Effect\n  // effectTag: SideEffectTag\n\n  // Singly linked list fast path to the next fiber with side-effects.\n  nextEffect: Fiber | null;\n\n  // The first and last fiber with side-effect within this subtree. This allows\n  // us to reuse a slice of the linked list when we reuse the work done within\n  // this fiber.\n  firstEffect: Fiber | null;\n  lastEffect: Fiber | null;\n\n  // Represents a time in the future by which this work should be completed.\n  // Does not include work found in its subtree.\n  expirationTime: ExpirationTime;\n\n  // This is used to quickly determine if a subtree has no pending changes.\n  childExpirationTime: ExpirationTime;\n\n  // This is a pooled version of a Fiber. Every fiber that gets updated will\n  // eventually have a pair. There are cases when we can clean up pairs to save\n  // memory if we need to.\n  alternate: Fiber | null;\n\n  // Time spent rendering this Fiber and its descendants for the current update.\n  // This tells us how well the tree makes use of sCU for memoization.\n  // It is reset to 0 each time we render and only updated when we don't bailout.\n  // This field is only set when the enableProfilerTimer flag is enabled.\n  actualDuration?: number;\n\n  // If the Fiber is currently active in the \"render\" phase,\n  // This marks the time at which the work began.\n  // This field is only set when the enableProfilerTimer flag is enabled.\n  actualStartTime?: number;\n\n  // Duration of the most recent render time for this Fiber.\n  // This value is not updated when we bailout for memoization purposes.\n  // This field is only set when the enableProfilerTimer flag is enabled.\n  selfBaseDuration?: number;\n\n  // Sum of base times for all descendants of this Fiber.\n  // This value bubbles up during the \"complete\" phase.\n  // This field is only set when the enableProfilerTimer flag is enabled.\n  treeBaseDuration?: number;\n\n  // Conceptual aliases\n  // workInProgress : Fiber ->  alternate The alternate used for reuse happens\n  // to be the same as work in progress.\n  // __DEV__ only\n  _debugID?: number;\n  _debugSource?: Source | null;\n  _debugOwner?: Fiber | null;\n  _debugIsCurrentlyTiming?: boolean;\n  _debugNeedsRemount?: boolean;\n\n  // Used to verify that the order of hooks does not change between renders.\n  _debugHookTypes?: HookType[] | null;\n};\n\nexport function getReactFiberFromNode(elm: Node | undefined): Fiber | null {\n  if (!elm) {\n    return null;\n  }\n\n  for (const k in elm) {\n    // React 16 uses \"__reactInternalInstance$\" prefix\n    // React 17 uses \"__reactFiber$\" prefix\n    // https://github.com/facebook/react/pull/18377\n    if (k.indexOf('__reactInternalInstance$') === 0 || k.indexOf('__reactFiber$') === 0) {\n      // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n      // @ts-ignore\n      return elm[k];\n    }\n  }\n\n  throw new Error('getReactFiber(): Failed to find a React Fiber on a node');\n}\n"],"names":["WorkTag","getReactFiberFromNode","elm","k","indexOf","Error"],"mappings":";;;;+BA6PgBC;;;;;;AAtLhB,IAAKD,UAAAA,WAAAA,GAAAA,SAAAA,OAAAA;2CACiB,EAAA,GAAA;wCACH,EAAA,GAAA;gDACQ,EAAA,GAAA;kCACd,EAAA,GAAA;oCACE,EAAA,GAAA;uCACG,EAAA,GAAA;kCACL,EAAA,GAAA;kCACA,EAAA,GAAA;8BACJ,EAAA,GAAA;yCACW,EAAA,GAAA;yCACA,GAAA,GAAA;oCACL,GAAA,GAAA;kCACF,GAAA,GAAA;2CACS,GAAA,GAAA;uCACJ,GAAA,GAAA;6CACM,GAAA,GAAA;uCACN,GAAA,GAAA;kDACW,GAAA,GAAA;4CACN,GAAA,GAAA;+CACG,GAAA,GAAA;8CACD,GAAA,GAAA;wCACN,GAAA,GAAA;WAtBdA;EAAAA,WAAAA,CAAAA;AAsLE,+BAA+BE,GAAqB;IACzD,IAAI,CAACA,KAAK;QACR,OAAO;IACT;IAEA,IAAK,MAAMC,KAAKD,IAAK;QACnB,kDAAkD;QAClD,uCAAuC;QACvC,+CAA+C;QAC/C,IAAIC,EAAEC,OAAO,CAAC,gCAAgC,KAAKD,EAAEC,OAAO,CAAC,qBAAqB,GAAG;YACnF,6DAA6D;YAC7D,aAAa;YACb,OAAOF,GAAG,CAACC,EAAE;QACf;IACF;IAEA,MAAM,IAAIE,MAAM;AAClB"}