Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196// @ts-expect-error untypedimport { __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE as ReactSharedInternals_ } from "react";import type { ActivityProps, ComponentType, ConsumerProps, Context, Dispatch, ExoticComponent, ForwardRefExoticComponent, FragmentProps, LazyExoticComponent, MemoExoticComponent, ProfilerProps, ProviderExoticComponent, ProviderProps, ReactNode, SetStateAction, SuspenseProps, Usable,} from "react";
// SharedInternalsvar ReactSharedInternals: SharedStateClient = ReactSharedInternals_;export type StartTransitionOptions = { name?: string;};export type TransitionStatus = unknown;export type Dispatcher = { use: <T>(arg0: Usable<T>) => T; readContext<T>(context: Context<T>): T; useState<S>(initialState: (() => S) | S): [S, Dispatch<SetStateAction<S>>]; useReducer<S, I, A>( reducer: (arg0: S, arg1: A) => S, initialArg: I, init?: (arg0: I) => S, ): [S, Dispatch<A>]; useContext<T>(context: Context<T>): T; useRef<T>(initialValue: T): { current: T; }; useEffect( create: () => (() => void) | void, deps: Array<unknown> | void | null, ): void; useEffectEvent: <Args, F extends (..._: Array<Args>) => unknown>( callback: F, ) => F; useInsertionEffect( create: () => (() => void) | void, deps: Array<unknown> | void | null, ): void; useLayoutEffect( create: () => (() => void) | void, deps: Array<unknown> | void | null, ): void; useCallback<T>(callback: T, deps: Array<unknown> | void | null): T; useMemo<T>(nextCreate: () => T, deps: Array<unknown> | void | null): T; useImperativeHandle<T>( ref: | { current: T | null; } | ((inst: T | null) => unknown) | null | void, create: () => T, deps: Array<unknown> | void | null, ): void; useDebugValue<T>( value: T, formatterFn: ((value: T) => unknown) | null | undefined, ): void; useDeferredValue<T>(value: T, initialValue?: T): T; useTransition(): [ boolean, (callback: () => void, options?: StartTransitionOptions) => void, ]; useSyncExternalStore<T>( subscribe: (arg0: () => void) => () => void, getSnapshot: () => T, getServerSnapshot?: () => T, ): T; useId(): string; useCacheRefresh: () => <T>( arg0: (() => T) | null | undefined, arg1: T | null | undefined, ) => void; useMemoCache: (size: number) => Array<any>; useHostTransitionStatus: () => TransitionStatus; useOptimistic: <S, A>( passthrough: S, reducer: ((arg0: S, arg1: A) => S) | null | undefined, ) => [S, (arg0: A) => void]; useFormState: <S, P>( action: (arg0: Awaited<S>, arg1: P) => S, initialState: Awaited<S>, permalink?: string, ) => [Awaited<S>, (arg0: P) => void, boolean]; useActionState: <S, P>( action: (arg0: Awaited<S>, arg1: P) => S, initialState: Awaited<S>, permalink?: string, ) => [Awaited<S>, (arg0: P) => void, boolean];};export type AsyncDispatcher = { getCacheForType: <T>(resourceType: () => T) => T; cacheSignal: () => null | AbortSignal; // DEV-only getOwner: () => null;};export type TransitionTypes = Array<string>;export type Transition = { types: null | TransitionTypes; // enableViewTransition gesture: null | GestureProvider; // enableGestureTransition name: null | string; // enableTransitionTracing only startTime: number; // enableTransitionTracing only _updatedFibers: Set<never>; // DEV-only};export type GestureProvider = any;export type GestureOptions = { rangeStart?: number; rangeEnd?: number;};type onStartTransitionFinish = (arg0: Transition, arg1: unknown) => void;type onStartGestureTransitionFinish = ( arg0: Transition, arg1: GestureProvider, arg2: GestureOptions | null | undefined,) => () => void;export type SharedStateClient = { H: null | Dispatcher; // ReactCurrentDispatcher for Hooks A: null | AsyncDispatcher; // ReactCurrentCache for Cache T: null | Transition; // ReactCurrentBatchConfig for Transitions S: null | onStartTransitionFinish; G: null | onStartGestureTransitionFinish; // DEV-only // ReactCurrentActQueue actQueue: null | Array<RendererTask>; // When zero this means we're outside an async startTransition. asyncTransitions: number; // Used to reproduce behavior of `batchedUpdates` in legacy mode. isBatchingLegacy: boolean; didScheduleLegacyUpdate: boolean; // Tracks whether something called `use` during the current batch of work. // Determines whether we should yield to microtasks to unwrap already resolved // promises without suspending. didUsePromise: boolean; // Track first uncaught error within this act thrownErrors: Array<unknown>; // ReactDebugCurrentFrame getCurrentStack: null | (() => string); // ReactOwnerStackReset recentlyCreatedOwnerStacks: 0;};export type RendererTask = (arg0: boolean) => RendererTask | null;export var runWithDispatcher = <T>(dispatcher: Dispatcher, fn: () => T): T => { const prevDispatcher = ReactSharedInternals.H; try { ReactSharedInternals.H = dispatcher; return fn(); } finally { ReactSharedInternals.H = prevDispatcher; }};
// Extra Types
/*export interface ExoticComponentMap { // $$typeof [REACT_CONSUMER_TYPE]: ExoticComponent<ConsumerProps<unknown>>; [REACT_CONTEXT_TYPE]: ProviderExoticComponent<ProviderProps<unknown>>; [REACT_FORWARD_REF_TYPE]: ForwardRefExoticComponent<unknown>; [REACT_LAZY_TYPE]: LazyExoticComponent<ComponentType<unknown>>; [REACT_MEMO_TYPE]: MemoExoticComponent<ComponentType<unknown>>; [REACT_PORTAL_TYPE]: ExoticComponent<{ children: ReactNode }>;
// literal [REACT_ACTIVITY_TYPE]: ExoticComponent<ActivityProps>; [REACT_FRAGMENT_TYPE]: ExoticComponent<FragmentProps>; [REACT_PROFILER_TYPE]: ExoticComponent<ProfilerProps>; [REACT_STRICT_MODE_TYPE]: ExoticComponent< { children?: ReactNode | UNDEFINED } >; [REACT_SUSPENSE_LIST_TYPE]: ExoticComponent; [REACT_SUSPENSE_TYPE]: ExoticComponent<SuspenseProps>;}*/