-
Notifications
You must be signed in to change notification settings - Fork 47
257 lines (249 loc) · 458 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
diff --git a/dist/mobxreactlite.cjs.development.js b/dist/mobxreactlite.cjs.development.js
index e10035411e8b1a78cf40a8e29ee334702bbfa55f..e2e7e400c26b732e44ad0d3f6bc1bc3757375084 100644
--- a/dist/mobxreactlite.cjs.development.js
+++ b/dist/mobxreactlite.cjs.development.js
@@ -8,7 +8,6 @@ var mobx = require('mobx');
var React = require('react');
var React__default = _interopDefault(React);
var reactDom = require('react-dom');
-var shim = require('use-sync-external-store/shim');
if (!React.useState) {
throw new Error("mobx-react-lite requires React with Hooks support");
@@ -182,7 +181,7 @@ function useObserver(render, baseComponentName) {
observerFinalizationRegistry.register(admRef, adm, adm);
}
React__default.useDebugValue(adm.reaction, printDebugValue);
- shim.useSyncExternalStore(
+ React__default.useSyncExternalStore(
// Both of these must be stable, otherwise it would keep resubscribing every render.
adm.subscribe, adm.getSnapshot, adm.getSnapshot);
// render the original component, but have the
diff --git a/dist/mobxreactlite.cjs.development.js.map b/dist/mobxreactlite.cjs.development.js.map
index 46a8d8b0dcadb21f9efe148f7d96cb6db2e17f2b..8a0f5b48fc3057e9e16331b4ef8b312598c1bdcd 100644
--- a/dist/mobxreactlite.cjs.development.js.map
+++ b/dist/mobxreactlite.cjs.development.js.map
@@ -1 +1 @@
-{"version":3,"file":"mobxreactlite.cjs.development.js","sources":["../src/utils/assertEnvironment.ts","../src/utils/observerBatching.ts","../src/utils/utils.ts","../src/utils/printDebugValue.ts","../src/staticRendering.ts","../src/utils/UniversalFinalizationRegistry.ts","../src/utils/observerFinalizationRegistry.ts","../src/useObserver.ts","../src/observer.ts","../src/ObserverComponent.ts","../src/useLocalObservable.ts","../src/useAsObservableSource.ts","../src/useLocalStore.ts","../src/index.ts"],"sourcesContent":["import { makeObservable } from \"mobx\"\nimport { useState } from \"react\"\n\nif (!useState) {\n throw new Error(\"mobx-react-lite requires React with Hooks support\")\n}\nif (!makeObservable) {\n throw new Error(\"mobx-react-lite@3 requires mobx at least version 6 to be available\")\n}\n","import { configure } from \"mobx\"\n\nexport function defaultNoopBatch(callback: () => void) {\n callback()\n}\n\nexport function observerBatching(reactionScheduler: any) {\n if (!reactionScheduler) {\n reactionScheduler = defaultNoopBatch\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[MobX] Failed to get unstable_batched updates from react-dom / react-native\"\n )\n }\n }\n configure({ reactionScheduler })\n}\n\nexport const isObserverBatched = () => {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\"[MobX] Deprecated\")\n }\n\n return true\n}\n","const deprecatedMessages: string[] = []\n\nexport function useDeprecated(msg: string) {\n if (!deprecatedMessages.includes(msg)) {\n deprecatedMessages.push(msg)\n console.warn(msg)\n }\n}\n","import { getDependencyTree, Reaction } from \"mobx\"\n\nexport function printDebugValue(v: Reaction) {\n return getDependencyTree(v)\n}\n","let globalIsUsingStaticRendering = false\n\nexport function enableStaticRendering(enable: boolean) {\n globalIsUsingStaticRendering = enable\n}\n\nexport function isUsingStaticRendering(): boolean {\n return globalIsUsingStaticRendering\n}\n","export declare class FinalizationRegistryType<T> {\n constructor(finalize: (value: T) => void)\n register(target: object, value: T, token?: object): void\n unregister(token: object): void\n}\n\ndeclare const FinalizationRegistry: typeof FinalizationRegistryType | undefined\n\nexport const REGISTRY_FINALIZE_AFTER = 10_000\nexport const REGISTRY_SWEEP_INTERVAL = 10_000\n\nexport class TimerBasedFinalizationRegistry<T> implements FinalizationRegistryType<T> {\n private registrations: Map<unknown, { value: T; registeredAt: number }> = new Map()\n private sweepTimeout: ReturnType<typeof setTimeout> | undefined\n\n constructor(private readonly finalize: (value: T) => void) {}\n\n // Token is actually required with this impl\n register(target: object, value: T, token?: object) {\n this.registrations.set(token, {\n value,\n registeredAt: Date.now()\n })\n this.scheduleSweep()\n }\n\n unregister(token: unknown) {\n this.registrations.delete(token)\n }\n\n // Bound so it can be used directly as setTimeout callback.\n sweep = (maxAge = REGISTRY_FINALIZE_AFTER) => {\n // cancel timeout so we can force sweep anytime\n clearTimeout(this.sweepTimeout)\n this.sweepTimeout = undefined\n\n const now = Date.now()\n this.registrations.forEach((registration, token) => {\n if (now - registration.registeredAt >= maxAge) {\n this.finalize(registration.value)\n this.registrations.delete(token)\n }\n })\n\n if (this.registrations.size > 0) {\n this.scheduleSweep()\n }\n }\n\n // Bound so it can be exported directly as clearTimers test utility.\n finalizeAllImmediately = () => {\n this.sweep(0)\n }\n\n private scheduleSweep() {\n if (this.sweepTimeout === undefined) {\n this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL)\n }\n }\n}\n\nexport const UniversalFinalizationRegistry =\n typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : TimerBasedFinalizationRegistry\n","import { Reaction } from \"mobx\"\nimport { UniversalFinalizationRegistry } from \"./UniversalFinalizationRegistry\"\n\nexport const observerFinalizationRegistry = new UniversalFinalizationRegistry(\n (adm: { reaction: Reaction | null }) => {\n adm.reaction?.dispose()\n adm.reaction = null\n }\n)\n","import { Reaction } from \"mobx\"\nimport React from \"react\"\nimport { printDebugValue } from \"./utils/printDebugValue\"\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\nimport { useSyncExternalStore } from \"use-sync-external-store/shim\"\n\n// Do not store `admRef` (even as part of a closure!) on this object,\n// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.\ntype ObserverAdministration = {\n reaction: Reaction | null // also serves as disposed flag\n onStoreChange: Function | null // also serves as mounted flag\n // stateVersion that 'ticks' for every time the reaction fires\n // tearing is still present,\n // because there is no cross component synchronization,\n // but we can use `useSyncExternalStore` API.\n // TODO: optimize to use number?\n stateVersion: any\n name: string\n // These don't depend on state/props, therefore we can keep them here instead of `useCallback`\n subscribe: Parameters<typeof React.useSyncExternalStore>[0]\n getSnapshot: Parameters<typeof React.useSyncExternalStore>[1]\n}\n\nfunction createReaction(adm: ObserverAdministration) {\n adm.reaction = new Reaction(`observer${adm.name}`, () => {\n adm.stateVersion = Symbol()\n // onStoreChange won't be available until the component \"mounts\".\n // If state changes in between initial render and mount,\n // `useSyncExternalStore` should handle that by checking the state version and issuing update.\n adm.onStoreChange?.()\n })\n}\n\nexport function useObserver<T>(render: () => T, baseComponentName: string = \"observed\"): T {\n if (isUsingStaticRendering()) {\n return render()\n }\n\n const admRef = React.useRef<ObserverAdministration | null>(null)\n\n if (!admRef.current) {\n // First render\n const adm: ObserverAdministration = {\n reaction: null,\n onStoreChange: null,\n stateVersion: Symbol(),\n name: baseComponentName,\n subscribe(onStoreChange: () => void) {\n // Do NOT access admRef here!\n observerFinalizationRegistry.unregister(adm)\n adm.onStoreChange = onStoreChange\n if (!adm.reaction) {\n // We've lost our reaction and therefore all subscriptions, occurs when:\n // 1. Timer based finalization registry disposed reaction before component mounted.\n // 2. React \"re-mounts\" same component without calling render in between (typically <StrictMode>).\n // We have to recreate reaction and schedule re-render to recreate subscriptions,\n // even if state did not change.\n createReaction(adm)\n // `onStoreChange` won't force update if subsequent `getSnapshot` returns same value.\n // So we make sure that is not the case\n adm.stateVersion = Symbol()\n }\n\n return () => {\n // Do NOT access admRef here!\n adm.onStoreChange = null\n adm.reaction?.dispose()\n adm.reaction = null\n }\n },\n getSnapshot() {\n // Do NOT access admRef here!\n return adm.stateVersion\n }\n }\n\n admRef.current = adm\n }\n\n const adm = admRef.current!\n\n if (!adm.reaction) {\n // First render or reaction was disposed by registry before subscribe\n createReaction(adm)\n // StrictMode/ConcurrentMode/Suspense may mean that our component is\n // rendered and abandoned multiple times, so we need to track leaked\n // Reactions.\n observerFinalizationRegistry.register(admRef, adm, adm)\n }\n\n React.useDebugValue(adm.reaction!, printDebugValue)\n\n useSyncExternalStore(\n // Both of these must be stable, otherwise it would keep resubscribing every render.\n adm.subscribe,\n adm.getSnapshot,\n adm.getSnapshot\n )\n\n // render the original component, but have the\n // reaction track the observables, so that rendering\n // can be invalidated (see above) once a dependency changes\n let renderResult!: T\n let exception\n adm.reaction!.track(() => {\n try {\n renderResult = render()\n } catch (e) {\n exception = e\n }\n })\n\n if (exception) {\n throw exception // re-throw any exceptions caught during rendering\n }\n\n return renderResult\n}\n","import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n ? Symbol.for(\"react.forward_ref\")\n : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n ? Symbol.for(\"react.memo\")\n : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\nexport interface IObserverOptions {\n readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n options: IObserverOptions & { forwardRef: true }\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n baseComponent: React.FunctionComponent<P>,\n options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<\n C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n Options extends IObserverOptions\n>(\n baseComponent: C,\n options?: Options\n): Options extends { forwardRef: true }\n ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n ? C &\n React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n >\n : never /* forwardRef set for a non forwarding component */\n : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n baseComponent:\n | React.ForwardRefRenderFunction<TRef, P>\n | React.FunctionComponent<P>\n | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n // TODO remove in next major\n options?: IObserverOptions\n) {\n if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n warnObserverOptionsDeprecated = false\n console.warn(\n `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n )\n }\n\n if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n throw new Error(\n `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n )\n }\n\n // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n if (isUsingStaticRendering()) {\n return baseComponent\n }\n\n let useForwardRef = options?.forwardRef ?? false\n let render = baseComponent\n\n const baseComponentName = baseComponent.displayName || baseComponent.name\n\n // If already wrapped with forwardRef, unwrap,\n // so we can patch render and apply memo\n if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n useForwardRef = true\n render = baseComponent[\"render\"]\n if (typeof render !== \"function\") {\n throw new Error(\n `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n )\n }\n }\n\n let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n return useObserver(() => render(props, ref), baseComponentName)\n }\n\n // Inherit original name and displayName, see #3438\n ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n if (isFunctionNameConfigurable) {\n Object.defineProperty(observerComponent, \"name\", {\n value: baseComponent.name,\n writable: true,\n configurable: true\n })\n }\n\n // Support legacy context: `contextTypes` must be applied before `memo`\n if ((baseComponent as any).contextTypes) {\n ;(observerComponent as React.FunctionComponent).contextTypes = (\n baseComponent as any\n ).contextTypes\n }\n\n if (useForwardRef) {\n // `forwardRef` must be applied prior `memo`\n // `forwardRef(observer(cmp))` throws:\n // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n observerComponent = forwardRef(observerComponent)\n }\n\n // memo; we are not interested in deep updates\n // in props; we assume that if deep objects are changed,\n // this is in observables, which would have been tracked anyway\n observerComponent = memo(observerComponent)\n\n copyStaticProperties(baseComponent, observerComponent)\n\n if (\"production\" !== process.env.NODE_ENV) {\n Object.defineProperty(observerComponent, \"contextTypes\", {\n set() {\n throw new Error(\n `[mobx-react-lite] \\`${\n this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n }.contextTypes\\` must be set before applying \\`observer\\`.`\n )\n }\n })\n }\n\n return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n $$typeof: true,\n render: true,\n compare: true,\n type: true,\n // Don't redefine `displayName`,\n // it's defined as getter-setter pair on `memo` (see #3192).\n displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n Object.keys(base).forEach(key => {\n if (!hoistBlackList[key]) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n }\n })\n}\n","import { useObserver } from \"./useObserver\"\n\ninterface IObserverProps {\n children?(): React.ReactElement | null\n render?(): React.ReactElement | null\n}\n\nfunction ObserverComponent({ children, render }: IObserverProps) {\n const component = children || render\n if (typeof component !== \"function\") {\n return null\n }\n return useObserver(component)\n}\nif (\"production\" !== process.env.NODE_ENV) {\n ObserverComponent.propTypes = {\n children: ObserverPropsCheck,\n render: ObserverPropsCheck\n }\n}\nObserverComponent.displayName = \"Observer\"\n\nexport { ObserverComponent as Observer }\n\nfunction ObserverPropsCheck(\n props: { [k: string]: any },\n key: string,\n componentName: string,\n location: any,\n propFullName: string\n) {\n const extraKey = key === \"children\" ? \"render\" : \"children\"\n const hasProp = typeof props[key] === \"function\"\n const hasExtraProp = typeof props[extraKey] === \"function\"\n if (hasProp && hasExtraProp) {\n return new Error(\n \"MobX Observer: Do not use children and render in the same time in`\" + componentName\n )\n }\n\n if (hasProp || hasExtraProp) {\n return null\n }\n return new Error(\n \"Invalid prop `\" +\n propFullName +\n \"` of type `\" +\n typeof props[key] +\n \"` supplied to\" +\n \" `\" +\n componentName +\n \"`, expected `function`.\"\n )\n}\n","import { observable, AnnotationsMap } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useLocalObservable<TStore extends Record<string, any>>(\n initializer: () => TStore,\n annotations?: AnnotationsMap<TStore, never>\n): TStore {\n return useState(() => observable(initializer(), annotations, { autoBind: true }))[0]\n}\n","import { useDeprecated } from \"./utils/utils\"\nimport { observable, runInAction } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useAsObservableSource<TSource extends object>(current: TSource): TSource {\n if (\"production\" !== process.env.NODE_ENV)\n useDeprecated(\n \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\"\n )\n // We're deliberately not using idiomatic destructuring for the hook here.\n // Accessing the state value as an array element prevents TypeScript from generating unnecessary helpers in the resulting code.\n // For further details, please refer to mobxjs/mobx#3842.\n const res = useState(() => observable(current, {}, { deep: false }))[0]\n runInAction(() => {\n Object.assign(res, current)\n })\n return res\n}\n","import { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nimport { useDeprecated } from \"./utils/utils\"\nimport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport function useLocalStore<TStore extends Record<string, any>>(initializer: () => TStore): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source: TSource) => TStore,\n current: TSource\n): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source?: TSource) => TStore,\n current?: TSource\n): TStore {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\"\n )\n }\n const source = current && useAsObservableSource(current)\n return useState(() => observable(initializer(source), undefined, { autoBind: true }))[0]\n}\n","import \"./utils/assertEnvironment\"\n\nimport { unstable_batchedUpdates as batch } from \"./utils/reactBatchedUpdates\"\nimport { observerBatching } from \"./utils/observerBatching\"\nimport { useDeprecated } from \"./utils/utils\"\nimport { useObserver as useObserverOriginal } from \"./useObserver\"\nimport { enableStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\nobserverBatching(batch)\n\nexport { isUsingStaticRendering, enableStaticRendering } from \"./staticRendering\"\nexport { observer, IObserverOptions } from \"./observer\"\nexport { Observer } from \"./ObserverComponent\"\nexport { useLocalObservable } from \"./useLocalObservable\"\nexport { useLocalStore } from \"./useLocalStore\"\nexport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport { observerFinalizationRegistry as _observerFinalizationRegistry }\nexport const clearTimers = observerFinalizationRegistry[\"finalizeAllImmediately\"] ?? (() => {})\n\nexport function useObserver<T>(fn: () => T, baseComponentName: string = \"observed\"): T {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`.\"\n )\n }\n return useObserverOriginal(fn, baseComponentName)\n}\n\nexport { isObserverBatched, observerBatching } from \"./utils/observerBatching\"\n\nexport function useStaticRendering(enable: boolean) {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead\"\n )\n }\n enableStaticRendering(enable)\n}\n"],"names":["useState","Error","makeObservable","defaultNoopBatch","callback","observerBatching","reactionScheduler","console","warn","configure","isObserverBatched","deprecatedMessages","useDeprecated","msg","includes","push","printDebugValue","v","getDependencyTree","globalIsUsingStaticRendering","enableStaticRendering","enable","isUsingStaticRendering","REGISTRY_FINALIZE_AFTER","REGISTRY_SWEEP_INTERVAL","TimerBasedFinalizationRegistry","finalize","registrations","Map","sweepTimeout","sweep","maxAge","clearTimeout","_this","undefined","now","Date","forEach","registration","token","registeredAt","value","size","scheduleSweep","finalizeAllImmediately","_proto","prototype","register","target","set","unregister","setTimeout","UniversalFinalizationRegistry","FinalizationRegistry","observerFinalizationRegistry","adm","_adm$reaction","reaction","dispose","createReaction","Reaction","name","stateVersion","Symbol","onStoreChange","useObserver","render","baseComponentName","admRef","React","useRef","current","subscribe","getSnapshot","useDebugValue","useSyncExternalStore","renderResult","exception","track","e","warnObserverOptionsDeprecated","hasSymbol","isFunctionNameConfigurable","_Object$getOwnPropert","_Object$getOwnPropert2","Object","getOwnPropertyDescriptor","configurable","ReactForwardRefSymbol","forwardRef","props","ReactMemoSymbol","memo","observer","baseComponent","options","process","useForwardRef","_options$forwardRef","displayName","observerComponent","ref","defineProperty","writable","contextTypes","copyStaticProperties","_this$type","type","_this$type2","hoistBlackList","$$typeof","compare","base","keys","key","ObserverComponent","_ref","children","component","propTypes","ObserverPropsCheck","componentName","location","propFullName","extraKey","hasProp","hasExtraProp","useLocalObservable","initializer","annotations","observable","autoBind","useAsObservableSource","res","deep","runInAction","assign","useLocalStore","source","batch","clearTimers","_observerFinalization","fn","useObserverOriginal","useStaticRendering"],"mappings":";;;;;;;;;;;;AAGA,IAAI,CAACA,cAAQ,EAAE;EACX,MAAM,IAAIC,KAAK,CAAC,mDAAmD,CAAC;;AAExE,IAAI,CAACC,mBAAc,EAAE;EACjB,MAAM,IAAID,KAAK,CAAC,oEAAoE,CAAC;;;SCLzEE,gBAAgBA,CAACC,QAAoB;EACjDA,QAAQ,EAAE;AACd;AAEA,SAAgBC,gBAAgBA,CAACC,iBAAsB;EACnD,IAAI,CAACA,iBAAiB,EAAE;IACpBA,iBAAiB,GAAGH,gBAAgB;IACpC,AAA2C;MACvCI,OAAO,CAACC,IAAI,CACR,6EAA6E,CAChF;;;EAGTC,cAAS,CAAC;IAAEH,iBAAiB,EAAjBA;GAAmB,CAAC;AACpC;AAEA,IAAaI,iBAAiB,GAAG,SAApBA,iBAAiBA;EAC1B,AAA2C;IACvCH,OAAO,CAACC,IAAI,CAAC,mBAAmB,CAAC;;EAGrC,OAAO,IAAI;AACf,CAAC;;ACxBD,IAAMG,kBAAkB,GAAa,EAAE;AAEvC,SAAgBC,aAAaA,CAACC,GAAW;EACrC,IAAI,CAACF,kBAAkB,CAACG,QAAQ,CAACD,GAAG,CAAC,EAAE;IACnCF,kBAAkB,CAACI,IAAI,CAACF,GAAG,CAAC;IAC5BN,OAAO,CAACC,IAAI,CAACK,GAAG,CAAC;;AAEzB;;SCLgBG,eAAeA,CAACC,CAAW;EACvC,OAAOC,sBAAiB,CAACD,CAAC,CAAC;AAC/B;;ACJA,IAAIE,4BAA4B,GAAG,KAAK;AAExC,SAAgBC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E;KAAM,CAAC;IAAC,CAAC,CAAC,CAAC;AAC5F;;;ACtBA,AASA9H,gBAAgB,CAACsI,gCAAK,CAAC;AAEvB,IAQaC,WAAW,IAAAC,qBAAA,GAAGvF,4BAA4B,CAAC,wBAAwB,CAAC,YAAAuF,qBAAA,GAAK,cAAS;AAE/F,SAAgB5E,aAAWA,CAAI6E,EAAW,EAAE3E;MAAAA;IAAAA,oBAA4B,UAAU;;EAC9E,AAA2C;IACvCvD,aAAa,CACT,yIAAyI,CAC5I;;EAEL,OAAOmI,WAAmB,CAACD,EAAE,EAAE3E,iBAAiB,CAAC;AACrD;AAEA,SAEgB6E,kBAAkBA,CAAC3H,MAAe;EAC9C,AAA2C;IACvCd,OAAO,CAACC,IAAI,CACR,2FAA2F,CAC9F;;EAELY,qBAAqB,CAACC,MAAM,CAAC;AACjC;;;;;;;;;;;;;;;;"}
\ No newline at end of file
+{"version":3,"file":"mobxreactlite.cjs.development.js","sources":["../src/utils/assertEnvironment.ts","../src/utils/observerBatching.ts","../src/utils/utils.ts","../src/utils/printDebugValue.ts","../src/staticRendering.ts","../src/utils/UniversalFinalizationRegistry.ts","../src/utils/observerFinalizationRegistry.ts","../src/useObserver.ts","../src/observer.ts","../src/ObserverComponent.ts","../src/useLocalObservable.ts","../src/useAsObservableSource.ts","../src/useLocalStore.ts","../src/index.ts"],"sourcesContent":["import { makeObservable } from \"mobx\"\nimport { useState } from \"react\"\n\nif (!useState) {\n throw new Error(\"mobx-react-lite requires React with Hooks support\")\n}\nif (!makeObservable) {\n throw new Error(\"mobx-react-lite@3 requires mobx at least version 6 to be available\")\n}\n","import { configure } from \"mobx\"\n\nexport function defaultNoopBatch(callback: () => void) {\n callback()\n}\n\nexport function observerBatching(reactionScheduler: any) {\n if (!reactionScheduler) {\n reactionScheduler = defaultNoopBatch\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[MobX] Failed to get unstable_batched updates from react-dom / react-native\"\n )\n }\n }\n configure({ reactionScheduler })\n}\n\nexport const isObserverBatched = () => {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\"[MobX] Deprecated\")\n }\n\n return true\n}\n","const deprecatedMessages: string[] = []\n\nexport function useDeprecated(msg: string) {\n if (!deprecatedMessages.includes(msg)) {\n deprecatedMessages.push(msg)\n console.warn(msg)\n }\n}\n","import { getDependencyTree, Reaction } from \"mobx\"\n\nexport function printDebugValue(v: Reaction) {\n return getDependencyTree(v)\n}\n","let globalIsUsingStaticRendering = false\n\nexport function enableStaticRendering(enable: boolean) {\n globalIsUsingStaticRendering = enable\n}\n\nexport function isUsingStaticRendering(): boolean {\n return globalIsUsingStaticRendering\n}\n","export declare class FinalizationRegistryType<T> {\n constructor(finalize: (value: T) => void)\n register(target: object, value: T, token?: object): void\n unregister(token: object): void\n}\n\ndeclare const FinalizationRegistry: typeof FinalizationRegistryType | undefined\n\nexport const REGISTRY_FINALIZE_AFTER = 10_000\nexport const REGISTRY_SWEEP_INTERVAL = 10_000\n\nexport class TimerBasedFinalizationRegistry<T> implements FinalizationRegistryType<T> {\n private registrations: Map<unknown, { value: T; registeredAt: number }> = new Map()\n private sweepTimeout: ReturnType<typeof setTimeout> | undefined\n\n constructor(private readonly finalize: (value: T) => void) {}\n\n // Token is actually required with this impl\n register(target: object, value: T, token?: object) {\n this.registrations.set(token, {\n value,\n registeredAt: Date.now()\n })\n this.scheduleSweep()\n }\n\n unregister(token: unknown) {\n this.registrations.delete(token)\n }\n\n // Bound so it can be used directly as setTimeout callback.\n sweep = (maxAge = REGISTRY_FINALIZE_AFTER) => {\n // cancel timeout so we can force sweep anytime\n clearTimeout(this.sweepTimeout)\n this.sweepTimeout = undefined\n\n const now = Date.now()\n this.registrations.forEach((registration, token) => {\n if (now - registration.registeredAt >= maxAge) {\n this.finalize(registration.value)\n this.registrations.delete(token)\n }\n })\n\n if (this.registrations.size > 0) {\n this.scheduleSweep()\n }\n }\n\n // Bound so it can be exported directly as clearTimers test utility.\n finalizeAllImmediately = () => {\n this.sweep(0)\n }\n\n private scheduleSweep() {\n if (this.sweepTimeout === undefined) {\n this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL)\n }\n }\n}\n\nexport const UniversalFinalizationRegistry =\n typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : TimerBasedFinalizationRegistry\n","import { Reaction } from \"mobx\"\nimport { UniversalFinalizationRegistry } from \"./UniversalFinalizationRegistry\"\n\nexport const observerFinalizationRegistry = new UniversalFinalizationRegistry(\n (adm: { reaction: Reaction | null }) => {\n adm.reaction?.dispose()\n adm.reaction = null\n }\n)\n","import { Reaction } from \"mobx\"\nimport React from \"react\"\nimport { printDebugValue } from \"./utils/printDebugValue\"\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\n// Do not store `admRef` (even as part of a closure!) on this object,\n// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.\ntype ObserverAdministration = {\n reaction: Reaction | null // also serves as disposed flag\n onStoreChange: Function | null // also serves as mounted flag\n // stateVersion that 'ticks' for every time the reaction fires\n // tearing is still present,\n // because there is no cross component synchronization,\n // but we can use `useSyncExternalStore` API.\n // TODO: optimize to use number?\n stateVersion: any\n name: string\n // These don't depend on state/props, therefore we can keep them here instead of `useCallback`\n subscribe: Parameters<typeof React.useSyncExternalStore>[0]\n getSnapshot: Parameters<typeof React.useSyncExternalStore>[1]\n}\n\nfunction createReaction(adm: ObserverAdministration) {\n adm.reaction = new Reaction(`observer${adm.name}`, () => {\n adm.stateVersion = Symbol()\n // onStoreChange won't be available until the component \"mounts\".\n // If state changes in between initial render and mount,\n // `useSyncExternalStore` should handle that by checking the state version and issuing update.\n adm.onStoreChange?.()\n })\n}\n\nexport function useObserver<T>(render: () => T, baseComponentName: string = \"observed\"): T {\n if (isUsingStaticRendering()) {\n return render()\n }\n\n const admRef = React.useRef<ObserverAdministration | null>(null)\n\n if (!admRef.current) {\n // First render\n const adm: ObserverAdministration = {\n reaction: null,\n onStoreChange: null,\n stateVersion: Symbol(),\n name: baseComponentName,\n subscribe(onStoreChange: () => void) {\n // Do NOT access admRef here!\n observerFinalizationRegistry.unregister(adm)\n adm.onStoreChange = onStoreChange\n if (!adm.reaction) {\n // We've lost our reaction and therefore all subscriptions, occurs when:\n // 1. Timer based finalization registry disposed reaction before component mounted.\n // 2. React \"re-mounts\" same component without calling render in between (typically <StrictMode>).\n // We have to recreate reaction and schedule re-render to recreate subscriptions,\n // even if state did not change.\n createReaction(adm)\n // `onStoreChange` won't force update if subsequent `getSnapshot` returns same value.\n // So we make sure that is not the case\n adm.stateVersion = Symbol()\n }\n\n return () => {\n // Do NOT access admRef here!\n adm.onStoreChange = null\n adm.reaction?.dispose()\n adm.reaction = null\n }\n },\n getSnapshot() {\n // Do NOT access admRef here!\n return adm.stateVersion\n }\n }\n\n admRef.current = adm\n }\n\n const adm = admRef.current!\n\n if (!adm.reaction) {\n // First render or reaction was disposed by registry before subscribe\n createReaction(adm)\n // StrictMode/ConcurrentMode/Suspense may mean that our component is\n // rendered and abandoned multiple times, so we need to track leaked\n // Reactions.\n observerFinalizationRegistry.register(admRef, adm, adm)\n }\n\n React.useDebugValue(adm.reaction!, printDebugValue)\n\n React.useSyncExternalStore(\n // Both of these must be stable, otherwise it would keep resubscribing every render.\n adm.subscribe,\n adm.getSnapshot,\n adm.getSnapshot\n )\n\n // render the original component, but have the\n // reaction track the observables, so that rendering\n // can be invalidated (see above) once a dependency changes\n let renderResult!: T\n let exception\n adm.reaction!.track(() => {\n try {\n renderResult = render()\n } catch (e) {\n exception = e\n }\n })\n\n if (exception) {\n throw exception // re-throw any exceptions caught during rendering\n }\n\n return renderResult\n}\n","import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n ? Symbol.for(\"react.forward_ref\")\n : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n ? Symbol.for(\"react.memo\")\n : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\nexport interface IObserverOptions {\n readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n options: IObserverOptions & { forwardRef: true }\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n baseComponent: React.FunctionComponent<P>,\n options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<\n C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n Options extends IObserverOptions\n>(\n baseComponent: C,\n options?: Options\n): Options extends { forwardRef: true }\n ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n ? C &\n React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n >\n : never /* forwardRef set for a non forwarding component */\n : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n baseComponent:\n | React.ForwardRefRenderFunction<TRef, P>\n | React.FunctionComponent<P>\n | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n // TODO remove in next major\n options?: IObserverOptions\n) {\n if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n warnObserverOptionsDeprecated = false\n console.warn(\n `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n )\n }\n\n if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n throw new Error(\n `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n )\n }\n\n // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n if (isUsingStaticRendering()) {\n return baseComponent\n }\n\n let useForwardRef = options?.forwardRef ?? false\n let render = baseComponent\n\n const baseComponentName = baseComponent.displayName || baseComponent.name\n\n // If already wrapped with forwardRef, unwrap,\n // so we can patch render and apply memo\n if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n useForwardRef = true\n render = baseComponent[\"render\"]\n if (typeof render !== \"function\") {\n throw new Error(\n `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n )\n }\n }\n\n let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n return useObserver(() => render(props, ref), baseComponentName)\n }\n\n // Inherit original name and displayName, see #3438\n ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n if (isFunctionNameConfigurable) {\n Object.defineProperty(observerComponent, \"name\", {\n value: baseComponent.name,\n writable: true,\n configurable: true\n })\n }\n\n // Support legacy context: `contextTypes` must be applied before `memo`\n if ((baseComponent as any).contextTypes) {\n ;(observerComponent as React.FunctionComponent).contextTypes = (\n baseComponent as any\n ).contextTypes\n }\n\n if (useForwardRef) {\n // `forwardRef` must be applied prior `memo`\n // `forwardRef(observer(cmp))` throws:\n // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n observerComponent = forwardRef(observerComponent)\n }\n\n // memo; we are not interested in deep updates\n // in props; we assume that if deep objects are changed,\n // this is in observables, which would have been tracked anyway\n observerComponent = memo(observerComponent)\n\n copyStaticProperties(baseComponent, observerComponent)\n\n if (\"production\" !== process.env.NODE_ENV) {\n Object.defineProperty(observerComponent, \"contextTypes\", {\n set() {\n throw new Error(\n `[mobx-react-lite] \\`${\n this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n }.contextTypes\\` must be set before applying \\`observer\\`.`\n )\n }\n })\n }\n\n return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n $$typeof: true,\n render: true,\n compare: true,\n type: true,\n // Don't redefine `displayName`,\n // it's defined as getter-setter pair on `memo` (see #3192).\n displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n Object.keys(base).forEach(key => {\n if (!hoistBlackList[key]) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n }\n })\n}\n","import { useObserver } from \"./useObserver\"\n\ninterface IObserverProps {\n children?(): React.ReactElement | null\n render?(): React.ReactElement | null\n}\n\nfunction ObserverComponent({ children, render }: IObserverProps) {\n const component = children || render\n if (typeof component !== \"function\") {\n return null\n }\n return useObserver(component)\n}\nif (\"production\" !== process.env.NODE_ENV) {\n ObserverComponent.propTypes = {\n children: ObserverPropsCheck,\n render: ObserverPropsCheck\n }\n}\nObserverComponent.displayName = \"Observer\"\n\nexport { ObserverComponent as Observer }\n\nfunction ObserverPropsCheck(\n props: { [k: string]: any },\n key: string,\n componentName: string,\n location: any,\n propFullName: string\n) {\n const extraKey = key === \"children\" ? \"render\" : \"children\"\n const hasProp = typeof props[key] === \"function\"\n const hasExtraProp = typeof props[extraKey] === \"function\"\n if (hasProp && hasExtraProp) {\n return new Error(\n \"MobX Observer: Do not use children and render in the same time in`\" + componentName\n )\n }\n\n if (hasProp || hasExtraProp) {\n return null\n }\n return new Error(\n \"Invalid prop `\" +\n propFullName +\n \"` of type `\" +\n typeof props[key] +\n \"` supplied to\" +\n \" `\" +\n componentName +\n \"`, expected `function`.\"\n )\n}\n","import { observable, AnnotationsMap } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useLocalObservable<TStore extends Record<string, any>>(\n initializer: () => TStore,\n annotations?: AnnotationsMap<TStore, never>\n): TStore {\n return useState(() => observable(initializer(), annotations, { autoBind: true }))[0]\n}\n","import { useDeprecated } from \"./utils/utils\"\nimport { observable, runInAction } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useAsObservableSource<TSource extends object>(current: TSource): TSource {\n if (\"production\" !== process.env.NODE_ENV)\n useDeprecated(\n \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\"\n )\n // We're deliberately not using idiomatic destructuring for the hook here.\n // Accessing the state value as an array element prevents TypeScript from generating unnecessary helpers in the resulting code.\n // For further details, please refer to mobxjs/mobx#3842.\n const res = useState(() => observable(current, {}, { deep: false }))[0]\n runInAction(() => {\n Object.assign(res, current)\n })\n return res\n}\n","import { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nimport { useDeprecated } from \"./utils/utils\"\nimport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport function useLocalStore<TStore extends Record<string, any>>(initializer: () => TStore): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source: TSource) => TStore,\n current: TSource\n): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source?: TSource) => TStore,\n current?: TSource\n): TStore {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\"\n )\n }\n const source = current && useAsObservableSource(current)\n return useState(() => observable(initializer(source), undefined, { autoBind: true }))[0]\n}\n","import \"./utils/assertEnvironment\"\n\nimport { unstable_batchedUpdates as batch } from \"./utils/reactBatchedUpdates\"\nimport { observerBatching } from \"./utils/observerBatching\"\nimport { useDeprecated } from \"./utils/utils\"\nimport { useObserver as useObserverOriginal } from \"./useObserver\"\nimport { enableStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\nobserverBatching(batch)\n\nexport { isUsingStaticRendering, enableStaticRendering } from \"./staticRendering\"\nexport { observer, IObserverOptions } from \"./observer\"\nexport { Observer } from \"./ObserverComponent\"\nexport { useLocalObservable } from \"./useLocalObservable\"\nexport { useLocalStore } from \"./useLocalStore\"\nexport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport { observerFinalizationRegistry as _observerFinalizationRegistry }\nexport const clearTimers = observerFinalizationRegistry[\"finalizeAllImmediately\"] ?? (() => {})\n\nexport function useObserver<T>(fn: () => T, baseComponentName: string = \"observed\"): T {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`.\"\n )\n }\n return useObserverOriginal(fn, baseComponentName)\n}\n\nexport { isObserverBatched, observerBatching } from \"./utils/observerBatching\"\n\nexport function useStaticRendering(enable: boolean) {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead\"\n )\n }\n enableStaticRendering(enable)\n}\n"],"names":["useState","Error","makeObservable","defaultNoopBatch","callback","observerBatching","reactionScheduler","console","warn","configure","isObserverBatched","deprecatedMessages","useDeprecated","msg","includes","push","printDebugValue","v","getDependencyTree","globalIsUsingStaticRendering","enableStaticRendering","enable","isUsingStaticRendering","REGISTRY_FINALIZE_AFTER","REGISTRY_SWEEP_INTERVAL","TimerBasedFinalizationRegistry","finalize","registrations","Map","sweepTimeout","sweep","maxAge","clearTimeout","_this","undefined","now","Date","forEach","registration","token","registeredAt","value","size","scheduleSweep","finalizeAllImmediately","_proto","prototype","register","target","set","unregister","setTimeout","UniversalFinalizationRegistry","FinalizationRegistry","observerFinalizationRegistry","adm","_adm$reaction","reaction","dispose","createReaction","Reaction","name","stateVersion","Symbol","onStoreChange","useObserver","render","baseComponentName","admRef","React","useRef","current","subscribe","getSnapshot","useDebugValue","useSyncExternalStore","renderResult","exception","track","e","warnObserverOptionsDeprecated","hasSymbol","isFunctionNameConfigurable","_Object$getOwnPropert","_Object$getOwnPropert2","Object","getOwnPropertyDescriptor","configurable","ReactForwardRefSymbol","forwardRef","props","ReactMemoSymbol","memo","observer","baseComponent","options","process","useForwardRef","_options$forwardRef","displayName","observerComponent","ref","defineProperty","writable","contextTypes","copyStaticProperties","_this$type","type","_this$type2","hoistBlackList","$$typeof","compare","base","keys","key","ObserverComponent","_ref","children","component","propTypes","ObserverPropsCheck","componentName","location","propFullName","extraKey","hasProp","hasExtraProp","useLocalObservable","initializer","annotations","observable","autoBind","useAsObservableSource","res","deep","runInAction","assign","useLocalStore","source","batch","clearTimers","_observerFinalization","fn","useObserverOriginal","useStaticRendering"],"mappings":";;;;;;;;;;;AAGA,IAAI,CAACA,cAAQ,EAAE;EACX,MAAM,IAAIC,KAAK,CAAC,mDAAmD,CAAC;;AAExE,IAAI,CAACC,mBAAc,EAAE;EACjB,MAAM,IAAID,KAAK,CAAC,oEAAoE,CAAC;;;SCLzEE,gBAAgBA,CAACC,QAAoB;EACjDA,QAAQ,EAAE;AACd;AAEA,SAAgBC,gBAAgBA,CAACC,iBAAsB;EACnD,IAAI,CAACA,iBAAiB,EAAE;IACpBA,iBAAiB,GAAGH,gBAAgB;IACpC,AAA2C;MACvCI,OAAO,CAACC,IAAI,CACR,6EAA6E,CAChF;;;EAGTC,cAAS,CAAC;IAAEH,iBAAiB,EAAjBA;GAAmB,CAAC;AACpC;AAEA,IAAaI,iBAAiB,GAAG,SAApBA,iBAAiBA;EAC1B,AAA2C;IACvCH,OAAO,CAACC,IAAI,CAAC,mBAAmB,CAAC;;EAGrC,OAAO,IAAI;AACf,CAAC;;ACxBD,IAAMG,kBAAkB,GAAa,EAAE;AAEvC,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C;GAC9B,CAAC;EACF,OAAO8D,GAAG;AACd;;SCNgBI,aAAaA,CACzBT,WAAyC,EACzCzD,OAAiB;EAEjB,AAA2C;IACvC3D,aAAa,CACT,oFAAoF,CACvF;;EAEL,IAAM8H,MAAM,GAAGnE,OAAO,IAAI6D,qBAAqB,CAAC7D,OAAO,CAAC;EACxD,OAAOvE,cAAQ,CAAC;IAAA,OAAMkI,eAAU,CAACF,WAAW,CAACU,MAAM,CAAC,EAAExG,SAAS,EAAE;MAAEiG,QAAQ,EAAE;KAAM,CAAC;IAAC,CAAC,CAAC,CAAC;AAC5F;;;ACtBA,AASA9H,gBAAgB,CAACsI,gCAAK,CAAC;AAEvB,IAQaC,WAAW,IAAAC,qBAAA,GAAGvF,4BAA4B,CAAC,wBAAwB,CAAC,YAAAuF,qBAAA,GAAK,cAAS;AAE/F,SAAgB5E,aAAWA,CAAI6E,EAAW,EAAE3E;MAAAA;IAAAA,oBAA4B,UAAU;;EAC9E,AAA2C;IACvCvD,aAAa,CACT,yIAAyI,CAC5I;;EAEL,OAAOmI,WAAmB,CAACD,EAAE,EAAE3E,iBAAiB,CAAC;AACrD;AAEA,SAEgB6E,kBAAkBA,CAAC3H,MAAe;EAC9C,AAA2C;IACvCd,OAAO,CAACC,IAAI,CACR,2FAA2F,CAC9F;;EAELY,qBAAqB,CAACC,MAAM,CAAC;AACjC;;;;;;;;;;;;;;;;"}
\ No newline at end of file
diff --git a/dist/mobxreactlite.cjs.production.min.js b/dist/mobxreactlite.cjs.production.min.js
index dc1f5e3e08e1737102d7a9fcc636541e339e6242..3d53f73b2a70a8cd89c4c2b8644389134ff8d9e1 100644
--- a/dist/mobxreactlite.cjs.production.min.js
+++ b/dist/mobxreactlite.cjs.production.min.js
@@ -1,2 +1,2 @@
-"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("mobx"),r=require("react"),n=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,o=require("react-dom"),i=require("use-sync-external-store/shim");if(!r.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!t.makeObservable)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function a(e){e()}function s(e){e||(e=a),t.configure({reactionScheduler:e})}function u(e){return t.getDependencyTree(e)}var c=!1;function l(e){c=e}function f(){return c}var p,d,b=new("undefined"!=typeof FinalizationRegistry?FinalizationRegistry:function(){function e(e){var t=this;this.finalize=void 0,this.registrations=new Map,this.sweepTimeout=void 0,this.sweep=function(e){void 0===e&&(e=1e4),clearTimeout(t.sweepTimeout),t.sweepTimeout=void 0;var r=Date.now();t.registrations.forEach((function(n,o){r-n.registeredAt>=e&&(t.finalize(n.value),t.registrations.delete(o))})),t.registrations.size>0&&t.scheduleSweep()},this.finalizeAllImmediately=function(){t.sweep(0)},this.finalize=e}var t=e.prototype;return t.register=function(e,t,r){this.registrations.set(r,{value:t,registeredAt:Date.now()}),this.scheduleSweep()},t.unregister=function(e){this.registrations.delete(e)},t.scheduleSweep=function(){void 0===this.sweepTimeout&&(this.sweepTimeout=setTimeout(this.sweep,1e4))},e}())((function(e){var t;null==(t=e.reaction)||t.dispose(),e.reaction=null}));function v(e){e.reaction=new t.Reaction("observer"+e.name,(function(){e.stateVersion=Symbol(),null==e.onStoreChange||e.onStoreChange()}))}function m(e,t){if(void 0===t&&(t="observed"),f())return e();var r=n.useRef(null);if(!r.current){var o={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return b.unregister(o),o.onStoreChange=e,o.reaction||(v(o),o.stateVersion=Symbol()),function(){var e;o.onStoreChange=null,null==(e=o.reaction)||e.dispose(),o.reaction=null}},getSnapshot:function(){return o.stateVersion}};r.current=o}var a,s,c=r.current;if(c.reaction||(v(c),b.register(r,c,c)),n.useDebugValue(c.reaction,u),i.useSyncExternalStore(c.subscribe,c.getSnapshot,c.getSnapshot),c.reaction.track((function(){try{a=e()}catch(e){s=e}})),s)throw s;return a}var y,h="function"==typeof Symbol&&Symbol.for,g=null!=(p=null==(d=Object.getOwnPropertyDescriptor((function(){}),"name"))?void 0:d.configurable)&&p,w=h?Symbol.for("react.forward_ref"):"function"==typeof r.forwardRef&&r.forwardRef((function(e){return null})).$$typeof,S=h?Symbol.for("react.memo"):"function"==typeof r.memo&&r.memo((function(e){return null})).$$typeof,x={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function O(e){var t=e.children||e.render;return"function"!=typeof t?null:m(t)}function R(e){var n=r.useState((function(){return t.observable(e,{},{deep:!1})}))[0];return t.runInAction((function(){Object.assign(n,e)})),n}O.displayName="Observer",s(o.unstable_batchedUpdates);var T=null!=(y=b.finalizeAllImmediately)?y:function(){};exports.Observer=O,exports._observerFinalizationRegistry=b,exports.clearTimers=T,exports.enableStaticRendering=l,exports.isObserverBatched=function(){return!0},exports.isUsingStaticRendering=f,exports.observer=function(e,t){var n;if(S&&e.$$typeof===S)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");if(f())return e;var o=null!=(n=null==t?void 0:t.forwardRef)&&n,i=e,a=e.displayName||e.name;if(w&&e.$$typeof===w&&(o=!0,"function"!=typeof(i=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var s,u,c=function(e,t){return m((function(){return i(e,t)}),a)};return c.displayName=e.displayName,g&&Object.defineProperty(c,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(c.contextTypes=e.contextTypes),o&&(c=r.forwardRef(c)),c=r.memo(c),s=e,u=c,Object.keys(s).forEach((function(e){x[e]||Object.defineProperty(u,e,Object.getOwnPropertyDescriptor(s,e))})),c},exports.observerBatching=s,exports.useAsObservableSource=R,exports.useLocalObservable=function(e,n){return r.useState((function(){return t.observable(e(),n,{autoBind:!0})}))[0]},exports.useLocalStore=function(e,n){var o=n&&R(n);return r.useState((function(){return t.observable(e(o),void 0,{autoBind:!0})}))[0]},exports.useObserver=function(e,t){return void 0===t&&(t="observed"),m(e,t)},exports.useStaticRendering=function(e){l(e)};
+"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("mobx"),r=require("react"),n=(e=r)&&"object"==typeof e&&"default"in e?e.default:e,o=require("react-dom");if(!r.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!t.makeObservable)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function i(e){e()}function a(e){e||(e=i),t.configure({reactionScheduler:e})}function s(e){return t.getDependencyTree(e)}var u=!1;function c(e){u=e}function f(){return u}var l,p,d=new("undefined"!=typeof FinalizationRegistry?FinalizationRegistry:function(){function e(e){var t=this;this.finalize=void 0,this.registrations=new Map,this.sweepTimeout=void 0,this.sweep=function(e){void 0===e&&(e=1e4),clearTimeout(t.sweepTimeout),t.sweepTimeout=void 0;var r=Date.now();t.registrations.forEach((function(n,o){r-n.registeredAt>=e&&(t.finalize(n.value),t.registrations.delete(o))})),t.registrations.size>0&&t.scheduleSweep()},this.finalizeAllImmediately=function(){t.sweep(0)},this.finalize=e}var t=e.prototype;return t.register=function(e,t,r){this.registrations.set(r,{value:t,registeredAt:Date.now()}),this.scheduleSweep()},t.unregister=function(e){this.registrations.delete(e)},t.scheduleSweep=function(){void 0===this.sweepTimeout&&(this.sweepTimeout=setTimeout(this.sweep,1e4))},e}())((function(e){var t;null==(t=e.reaction)||t.dispose(),e.reaction=null}));function b(e){e.reaction=new t.Reaction("observer"+e.name,(function(){e.stateVersion=Symbol(),null==e.onStoreChange||e.onStoreChange()}))}function v(e,t){if(void 0===t&&(t="observed"),f())return e();var r=n.useRef(null);if(!r.current){var o={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return d.unregister(o),o.onStoreChange=e,o.reaction||(b(o),o.stateVersion=Symbol()),function(){var e;o.onStoreChange=null,null==(e=o.reaction)||e.dispose(),o.reaction=null}},getSnapshot:function(){return o.stateVersion}};r.current=o}var i,a,u=r.current;if(u.reaction||(b(u),d.register(r,u,u)),n.useDebugValue(u.reaction,s),n.useSyncExternalStore(u.subscribe,u.getSnapshot,u.getSnapshot),u.reaction.track((function(){try{i=e()}catch(e){a=e}})),a)throw a;return i}var m,y="function"==typeof Symbol&&Symbol.for,h=null!=(l=null==(p=Object.getOwnPropertyDescriptor((function(){}),"name"))?void 0:p.configurable)&&l,g=y?Symbol.for("react.forward_ref"):"function"==typeof r.forwardRef&&r.forwardRef((function(e){return null})).$$typeof,w=y?Symbol.for("react.memo"):"function"==typeof r.memo&&r.memo((function(e){return null})).$$typeof,S={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function x(e){var t=e.children||e.render;return"function"!=typeof t?null:v(t)}function O(e){var n=r.useState((function(){return t.observable(e,{},{deep:!1})}))[0];return t.runInAction((function(){Object.assign(n,e)})),n}x.displayName="Observer",a(o.unstable_batchedUpdates);var R=null!=(m=d.finalizeAllImmediately)?m:function(){};exports.Observer=x,exports._observerFinalizationRegistry=d,exports.clearTimers=R,exports.enableStaticRendering=c,exports.isObserverBatched=function(){return!0},exports.isUsingStaticRendering=f,exports.observer=function(e,t){var n;if(w&&e.$$typeof===w)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");if(f())return e;var o=null!=(n=null==t?void 0:t.forwardRef)&&n,i=e,a=e.displayName||e.name;if(g&&e.$$typeof===g&&(o=!0,"function"!=typeof(i=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var s,u,c=function(e,t){return v((function(){return i(e,t)}),a)};return c.displayName=e.displayName,h&&Object.defineProperty(c,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(c.contextTypes=e.contextTypes),o&&(c=r.forwardRef(c)),c=r.memo(c),s=e,u=c,Object.keys(s).forEach((function(e){S[e]||Object.defineProperty(u,e,Object.getOwnPropertyDescriptor(s,e))})),c},exports.observerBatching=a,exports.useAsObservableSource=O,exports.useLocalObservable=function(e,n){return r.useState((function(){return t.observable(e(),n,{autoBind:!0})}))[0]},exports.useLocalStore=function(e,n){var o=n&&O(n);return r.useState((function(){return t.observable(e(o),void 0,{autoBind:!0})}))[0]},exports.useObserver=function(e,t){return void 0===t&&(t="observed"),v(e,t)},exports.useStaticRendering=function(e){c(e)};
//# sourceMappingURL=mobxreactlite.cjs.production.min.js.map
diff --git a/dist/mobxreactlite.cjs.production.min.js.map b/dist/mobxreactlite.cjs.production.min.js.map
index 56ca957062e8649b2f9a1e004ebdc6563b69e9c1..73dc86945cdf3ab3736213baa4c1a83c426f053e 100644
--- a/dist/mobxreactlite.cjs.production.min.js.map
+++ b/dist/mobxreactlite.cjs.production.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"mobxreactlite.cjs.production.min.js","sources":["../src/utils/assertEnvironment.ts","../src/utils/observerBatching.ts","../src/utils/printDebugValue.ts","../src/staticRendering.ts","../src/utils/UniversalFinalizationRegistry.ts","../src/utils/observerFinalizationRegistry.ts","../src/useObserver.ts","../src/observer.ts","../src/ObserverComponent.ts","../src/useAsObservableSource.ts","../src/index.ts","../src/useLocalObservable.ts","../src/useLocalStore.ts"],"sourcesContent":["import { makeObservable } from \"mobx\"\nimport { useState } from \"react\"\n\nif (!useState) {\n throw new Error(\"mobx-react-lite requires React with Hooks support\")\n}\nif (!makeObservable) {\n throw new Error(\"mobx-react-lite@3 requires mobx at least version 6 to be available\")\n}\n","import { configure } from \"mobx\"\n\nexport function defaultNoopBatch(callback: () => void) {\n callback()\n}\n\nexport function observerBatching(reactionScheduler: any) {\n if (!reactionScheduler) {\n reactionScheduler = defaultNoopBatch\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[MobX] Failed to get unstable_batched updates from react-dom / react-native\"\n )\n }\n }\n configure({ reactionScheduler })\n}\n\nexport const isObserverBatched = () => {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\"[MobX] Deprecated\")\n }\n\n return true\n}\n","import { getDependencyTree, Reaction } from \"mobx\"\n\nexport function printDebugValue(v: Reaction) {\n return getDependencyTree(v)\n}\n","let globalIsUsingStaticRendering = false\n\nexport function enableStaticRendering(enable: boolean) {\n globalIsUsingStaticRendering = enable\n}\n\nexport function isUsingStaticRendering(): boolean {\n return globalIsUsingStaticRendering\n}\n","export declare class FinalizationRegistryType<T> {\n constructor(finalize: (value: T) => void)\n register(target: object, value: T, token?: object): void\n unregister(token: object): void\n}\n\ndeclare const FinalizationRegistry: typeof FinalizationRegistryType | undefined\n\nexport const REGISTRY_FINALIZE_AFTER = 10_000\nexport const REGISTRY_SWEEP_INTERVAL = 10_000\n\nexport class TimerBasedFinalizationRegistry<T> implements FinalizationRegistryType<T> {\n private registrations: Map<unknown, { value: T; registeredAt: number }> = new Map()\n private sweepTimeout: ReturnType<typeof setTimeout> | undefined\n\n constructor(private readonly finalize: (value: T) => void) {}\n\n // Token is actually required with this impl\n register(target: object, value: T, token?: object) {\n this.registrations.set(token, {\n value,\n registeredAt: Date.now()\n })\n this.scheduleSweep()\n }\n\n unregister(token: unknown) {\n this.registrations.delete(token)\n }\n\n // Bound so it can be used directly as setTimeout callback.\n sweep = (maxAge = REGISTRY_FINALIZE_AFTER) => {\n // cancel timeout so we can force sweep anytime\n clearTimeout(this.sweepTimeout)\n this.sweepTimeout = undefined\n\n const now = Date.now()\n this.registrations.forEach((registration, token) => {\n if (now - registration.registeredAt >= maxAge) {\n this.finalize(registration.value)\n this.registrations.delete(token)\n }\n })\n\n if (this.registrations.size > 0) {\n this.scheduleSweep()\n }\n }\n\n // Bound so it can be exported directly as clearTimers test utility.\n finalizeAllImmediately = () => {\n this.sweep(0)\n }\n\n private scheduleSweep() {\n if (this.sweepTimeout === undefined) {\n this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL)\n }\n }\n}\n\nexport const UniversalFinalizationRegistry =\n typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : TimerBasedFinalizationRegistry\n","import { Reaction } from \"mobx\"\nimport { UniversalFinalizationRegistry } from \"./UniversalFinalizationRegistry\"\n\nexport const observerFinalizationRegistry = new UniversalFinalizationRegistry(\n (adm: { reaction: Reaction | null }) => {\n adm.reaction?.dispose()\n adm.reaction = null\n }\n)\n","import { Reaction } from \"mobx\"\nimport React from \"react\"\nimport { printDebugValue } from \"./utils/printDebugValue\"\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\nimport { useSyncExternalStore } from \"use-sync-external-store/shim\"\n\n// Do not store `admRef` (even as part of a closure!) on this object,\n// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.\ntype ObserverAdministration = {\n reaction: Reaction | null // also serves as disposed flag\n onStoreChange: Function | null // also serves as mounted flag\n // stateVersion that 'ticks' for every time the reaction fires\n // tearing is still present,\n // because there is no cross component synchronization,\n // but we can use `useSyncExternalStore` API.\n // TODO: optimize to use number?\n stateVersion: any\n name: string\n // These don't depend on state/props, therefore we can keep them here instead of `useCallback`\n subscribe: Parameters<typeof React.useSyncExternalStore>[0]\n getSnapshot: Parameters<typeof React.useSyncExternalStore>[1]\n}\n\nfunction createReaction(adm: ObserverAdministration) {\n adm.reaction = new Reaction(`observer${adm.name}`, () => {\n adm.stateVersion = Symbol()\n // onStoreChange won't be available until the component \"mounts\".\n // If state changes in between initial render and mount,\n // `useSyncExternalStore` should handle that by checking the state version and issuing update.\n adm.onStoreChange?.()\n })\n}\n\nexport function useObserver<T>(render: () => T, baseComponentName: string = \"observed\"): T {\n if (isUsingStaticRendering()) {\n return render()\n }\n\n const admRef = React.useRef<ObserverAdministration | null>(null)\n\n if (!admRef.current) {\n // First render\n const adm: ObserverAdministration = {\n reaction: null,\n onStoreChange: null,\n stateVersion: Symbol(),\n name: baseComponentName,\n subscribe(onStoreChange: () => void) {\n // Do NOT access admRef here!\n observerFinalizationRegistry.unregister(adm)\n adm.onStoreChange = onStoreChange\n if (!adm.reaction) {\n // We've lost our reaction and therefore all subscriptions, occurs when:\n // 1. Timer based finalization registry disposed reaction before component mounted.\n // 2. React \"re-mounts\" same component without calling render in between (typically <StrictMode>).\n // We have to recreate reaction and schedule re-render to recreate subscriptions,\n // even if state did not change.\n createReaction(adm)\n // `onStoreChange` won't force update if subsequent `getSnapshot` returns same value.\n // So we make sure that is not the case\n adm.stateVersion = Symbol()\n }\n\n return () => {\n // Do NOT access admRef here!\n adm.onStoreChange = null\n adm.reaction?.dispose()\n adm.reaction = null\n }\n },\n getSnapshot() {\n // Do NOT access admRef here!\n return adm.stateVersion\n }\n }\n\n admRef.current = adm\n }\n\n const adm = admRef.current!\n\n if (!adm.reaction) {\n // First render or reaction was disposed by registry before subscribe\n createReaction(adm)\n // StrictMode/ConcurrentMode/Suspense may mean that our component is\n // rendered and abandoned multiple times, so we need to track leaked\n // Reactions.\n observerFinalizationRegistry.register(admRef, adm, adm)\n }\n\n React.useDebugValue(adm.reaction!, printDebugValue)\n\n useSyncExternalStore(\n // Both of these must be stable, otherwise it would keep resubscribing every render.\n adm.subscribe,\n adm.getSnapshot,\n adm.getSnapshot\n )\n\n // render the original component, but have the\n // reaction track the observables, so that rendering\n // can be invalidated (see above) once a dependency changes\n let renderResult!: T\n let exception\n adm.reaction!.track(() => {\n try {\n renderResult = render()\n } catch (e) {\n exception = e\n }\n })\n\n if (exception) {\n throw exception // re-throw any exceptions caught during rendering\n }\n\n return renderResult\n}\n","import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n ? Symbol.for(\"react.forward_ref\")\n : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n ? Symbol.for(\"react.memo\")\n : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\nexport interface IObserverOptions {\n readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n options: IObserverOptions & { forwardRef: true }\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n baseComponent: React.FunctionComponent<P>,\n options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<\n C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n Options extends IObserverOptions\n>(\n baseComponent: C,\n options?: Options\n): Options extends { forwardRef: true }\n ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n ? C &\n React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n >\n : never /* forwardRef set for a non forwarding component */\n : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n baseComponent:\n | React.ForwardRefRenderFunction<TRef, P>\n | React.FunctionComponent<P>\n | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n // TODO remove in next major\n options?: IObserverOptions\n) {\n if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n warnObserverOptionsDeprecated = false\n console.warn(\n `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n )\n }\n\n if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n throw new Error(\n `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n )\n }\n\n // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n if (isUsingStaticRendering()) {\n return baseComponent\n }\n\n let useForwardRef = options?.forwardRef ?? false\n let render = baseComponent\n\n const baseComponentName = baseComponent.displayName || baseComponent.name\n\n // If already wrapped with forwardRef, unwrap,\n // so we can patch render and apply memo\n if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n useForwardRef = true\n render = baseComponent[\"render\"]\n if (typeof render !== \"function\") {\n throw new Error(\n `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n )\n }\n }\n\n let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n return useObserver(() => render(props, ref), baseComponentName)\n }\n\n // Inherit original name and displayName, see #3438\n ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n if (isFunctionNameConfigurable) {\n Object.defineProperty(observerComponent, \"name\", {\n value: baseComponent.name,\n writable: true,\n configurable: true\n })\n }\n\n // Support legacy context: `contextTypes` must be applied before `memo`\n if ((baseComponent as any).contextTypes) {\n ;(observerComponent as React.FunctionComponent).contextTypes = (\n baseComponent as any\n ).contextTypes\n }\n\n if (useForwardRef) {\n // `forwardRef` must be applied prior `memo`\n // `forwardRef(observer(cmp))` throws:\n // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n observerComponent = forwardRef(observerComponent)\n }\n\n // memo; we are not interested in deep updates\n // in props; we assume that if deep objects are changed,\n // this is in observables, which would have been tracked anyway\n observerComponent = memo(observerComponent)\n\n copyStaticProperties(baseComponent, observerComponent)\n\n if (\"production\" !== process.env.NODE_ENV) {\n Object.defineProperty(observerComponent, \"contextTypes\", {\n set() {\n throw new Error(\n `[mobx-react-lite] \\`${\n this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n }.contextTypes\\` must be set before applying \\`observer\\`.`\n )\n }\n })\n }\n\n return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n $$typeof: true,\n render: true,\n compare: true,\n type: true,\n // Don't redefine `displayName`,\n // it's defined as getter-setter pair on `memo` (see #3192).\n displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n Object.keys(base).forEach(key => {\n if (!hoistBlackList[key]) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n }\n })\n}\n","import { useObserver } from \"./useObserver\"\n\ninterface IObserverProps {\n children?(): React.ReactElement | null\n render?(): React.ReactElement | null\n}\n\nfunction ObserverComponent({ children, render }: IObserverProps) {\n const component = children || render\n if (typeof component !== \"function\") {\n return null\n }\n return useObserver(component)\n}\nif (\"production\" !== process.env.NODE_ENV) {\n ObserverComponent.propTypes = {\n children: ObserverPropsCheck,\n render: ObserverPropsCheck\n }\n}\nObserverComponent.displayName = \"Observer\"\n\nexport { ObserverComponent as Observer }\n\nfunction ObserverPropsCheck(\n props: { [k: string]: any },\n key: string,\n componentName: string,\n location: any,\n propFullName: string\n) {\n const extraKey = key === \"children\" ? \"render\" : \"children\"\n const hasProp = typeof props[key] === \"function\"\n const hasExtraProp = typeof props[extraKey] === \"function\"\n if (hasProp && hasExtraProp) {\n return new Error(\n \"MobX Observer: Do not use children and render in the same time in`\" + componentName\n )\n }\n\n if (hasProp || hasExtraProp) {\n return null\n }\n return new Error(\n \"Invalid prop `\" +\n propFullName +\n \"` of type `\" +\n typeof props[key] +\n \"` supplied to\" +\n \" `\" +\n componentName +\n \"`, expected `function`.\"\n )\n}\n","import { useDeprecated } from \"./utils/utils\"\nimport { observable, runInAction } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useAsObservableSource<TSource extends object>(current: TSource): TSource {\n if (\"production\" !== process.env.NODE_ENV)\n useDeprecated(\n \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\"\n )\n // We're deliberately not using idiomatic destructuring for the hook here.\n // Accessing the state value as an array element prevents TypeScript from generating unnecessary helpers in the resulting code.\n // For further details, please refer to mobxjs/mobx#3842.\n const res = useState(() => observable(current, {}, { deep: false }))[0]\n runInAction(() => {\n Object.assign(res, current)\n })\n return res\n}\n","import \"./utils/assertEnvironment\"\n\nimport { unstable_batchedUpdates as batch } from \"./utils/reactBatchedUpdates\"\nimport { observerBatching } from \"./utils/observerBatching\"\nimport { useDeprecated } from \"./utils/utils\"\nimport { useObserver as useObserverOriginal } from \"./useObserver\"\nimport { enableStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\nobserverBatching(batch)\n\nexport { isUsingStaticRendering, enableStaticRendering } from \"./staticRendering\"\nexport { observer, IObserverOptions } from \"./observer\"\nexport { Observer } from \"./ObserverComponent\"\nexport { useLocalObservable } from \"./useLocalObservable\"\nexport { useLocalStore } from \"./useLocalStore\"\nexport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport { observerFinalizationRegistry as _observerFinalizationRegistry }\nexport const clearTimers = observerFinalizationRegistry[\"finalizeAllImmediately\"] ?? (() => {})\n\nexport function useObserver<T>(fn: () => T, baseComponentName: string = \"observed\"): T {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`.\"\n )\n }\n return useObserverOriginal(fn, baseComponentName)\n}\n\nexport { isObserverBatched, observerBatching } from \"./utils/observerBatching\"\n\nexport function useStaticRendering(enable: boolean) {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead\"\n )\n }\n enableStaticRendering(enable)\n}\n","import { observable, AnnotationsMap } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useLocalObservable<TStore extends Record<string, any>>(\n initializer: () => TStore,\n annotations?: AnnotationsMap<TStore, never>\n): TStore {\n return useState(() => observable(initializer(), annotations, { autoBind: true }))[0]\n}\n","import { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nimport { useDeprecated } from \"./utils/utils\"\nimport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport function useLocalStore<TStore extends Record<string, any>>(initializer: () => TStore): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source: TSource) => TStore,\n current: TSource\n): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source?: TSource) => TStore,\n current?: TSource\n): TStore {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\"\n )\n }\n const source = current && useAsObservableSource(current)\n return useState(() => observable(initializer(source), undefined, { autoBind: true }))[0]\n}\n"],"names":["useState","Error","makeObservable","defaultNoopBatch","callback","observerBatching","reactionScheduler","configure","printDebugValue","v","getDependencyTree","globalIsUsingStaticRendering","enableStaticRendering","enable","isUsingStaticRendering","observerFinalizationRegistry","FinalizationRegistry","TimerBasedFinalizationRegistry","finalize","registrations","Map","this","sweepTimeout","sweep","maxAge","clearTimeout","_this","undefined","now","Date","forEach","registration","token","registeredAt","value","size","scheduleSweep","finalizeAllImmediately","_proto","prototype","register","target","set","unregister","setTimeout","adm","_adm$reaction","reaction","dispose","createReaction","Reaction","name","stateVersion","Symbol","onStoreChange","useObserver","render","baseComponentName","admRef","React","useRef","current","subscribe","getSnapshot","renderResult","exception","useDebugValue","useSyncExternalStore","track","e","hasSymbol","isFunctionNameConfigurable","_Object$getOwnPropert","_Object$getOwnPropert2","Object","getOwnPropertyDescriptor","configurable","ReactForwardRefSymbol","forwardRef","props","ReactMemoSymbol","memo","hoistBlackList","$$typeof","compare","type","displayName","ObserverComponent","_ref","component","children","useAsObservableSource","res","observable","deep","runInAction","assign","batch","clearTimers","_observerFinalization","baseComponent","options","useForwardRef","_options$forwardRef","base","observerComponent","ref","defineProperty","writable","contextTypes","keys","key","initializer","annotations","autoBind","source","fn","useObserverOriginal"],"mappings":"uOAGA,IAAKA,WACD,MAAM,IAAIC,MAAM,qDAEpB,IAAKC,iBACD,MAAM,IAAID,MAAM,+ECLJE,EAAiBC,GAC7BA,aAGYC,EAAiBC,GACxBA,IACDA,EAAoBH,GAOxBI,YAAU,CAAED,kBAAAA,aCbAE,EAAgBC,GAC5B,OAAOC,oBAAkBD,GCH7B,IAAIE,GAA+B,WAEnBC,EAAsBC,GAClCF,EAA+BE,EAGnC,SAAgBC,IACZ,OAAOH,ECCJ,QCLMI,EAA+B,ID2DR,oBAAzBC,qBACDA,gCAhDN,SAAAC,EAA6BC,mBAAAA,qBAHrBC,cAAkE,IAAIC,IAAKC,KAC3EC,oBAAYD,KAkBpBE,MAAQ,SAACC,YAAAA,IAAAA,EAvB0B,KAyB/BC,aAAaC,EAAKJ,cAClBI,EAAKJ,kBAAeK,EAEpB,IAAMC,EAAMC,KAAKD,MACjBF,EAAKP,cAAcW,SAAQ,SAACC,EAAcC,GAClCJ,EAAMG,EAAaE,cAAgBT,IACnCE,EAAKR,SAASa,EAAaG,OAC3BR,EAAKP,qBAAqBa,OAI9BN,EAAKP,cAAcgB,KAAO,GAC1BT,EAAKU,iBAEZf,KAGDgB,uBAAyB,WACrBX,EAAKH,MAAM,IApCcF,cAAAH,EAE7B,IAAAoB,EAAArB,EAAAsB,UAyCC,OAzCDD,EACAE,SAAA,SAASC,EAAgBP,EAAUF,GAC/BX,KAAKF,cAAcuB,IAAIV,EAAO,CAC1BE,MAAAA,EACAD,aAAcJ,KAAKD,QAEvBP,KAAKe,iBACRE,EAEDK,WAAA,SAAWX,GACPX,KAAKF,qBAAqBa,IAG9BM,EAwBQF,cAAA,gBACsBT,IAAtBN,KAAKC,eACLD,KAAKC,aAAesB,WAAWvB,KAAKE,MA/CT,OAiDlCN,OCtDD,SAAC4B,gBACGC,EAAAD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6BpC/B,OAAOoC,KAAKN,GAAM1E,SAAQ,SAAAiF,GACjB7B,EAAe6B,IAChBrC,OAAOiC,eAAelE,EAAQsE,EAAKrC,OAAOC,yBAAyB6B,EAAMO,OAjB1EN,kGIrJPO,EACAC,GAEA,OAAOjH,YAAS,WAAA,OAAM6F,aAAWmB,IAAeC,EAAa,CAAEC,UAAU,OAAS,mCCKlFF,EACAnD,GAOA,IAAMsD,EAAStD,GAAW8B,EAAsB9B,GAChD,OAAO7D,YAAS,WAAA,OAAM6F,aAAWmB,EAAYG,QAASxF,EAAW,CAAEuF,UAAU,OAAS,iCFA3DE,EAAa3D,GAMxC,gBANwCA,IAAAA,EAA4B,YAM7D4D,EAAoBD,EAAI3D,wCAKA5C,GAM/BD,EAAsBC"}
\ No newline at end of file
+{"version":3,"file":"mobxreactlite.cjs.production.min.js","sources":["../src/utils/assertEnvironment.ts","../src/utils/observerBatching.ts","../src/utils/printDebugValue.ts","../src/staticRendering.ts","../src/utils/UniversalFinalizationRegistry.ts","../src/utils/observerFinalizationRegistry.ts","../src/useObserver.ts","../src/observer.ts","../src/ObserverComponent.ts","../src/useAsObservableSource.ts","../src/index.ts","../src/useLocalObservable.ts","../src/useLocalStore.ts"],"sourcesContent":["import { makeObservable } from \"mobx\"\nimport { useState } from \"react\"\n\nif (!useState) {\n throw new Error(\"mobx-react-lite requires React with Hooks support\")\n}\nif (!makeObservable) {\n throw new Error(\"mobx-react-lite@3 requires mobx at least version 6 to be available\")\n}\n","import { configure } from \"mobx\"\n\nexport function defaultNoopBatch(callback: () => void) {\n callback()\n}\n\nexport function observerBatching(reactionScheduler: any) {\n if (!reactionScheduler) {\n reactionScheduler = defaultNoopBatch\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[MobX] Failed to get unstable_batched updates from react-dom / react-native\"\n )\n }\n }\n configure({ reactionScheduler })\n}\n\nexport const isObserverBatched = () => {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\"[MobX] Deprecated\")\n }\n\n return true\n}\n","import { getDependencyTree, Reaction } from \"mobx\"\n\nexport function printDebugValue(v: Reaction) {\n return getDependencyTree(v)\n}\n","let globalIsUsingStaticRendering = false\n\nexport function enableStaticRendering(enable: boolean) {\n globalIsUsingStaticRendering = enable\n}\n\nexport function isUsingStaticRendering(): boolean {\n return globalIsUsingStaticRendering\n}\n","export declare class FinalizationRegistryType<T> {\n constructor(finalize: (value: T) => void)\n register(target: object, value: T, token?: object): void\n unregister(token: object): void\n}\n\ndeclare const FinalizationRegistry: typeof FinalizationRegistryType | undefined\n\nexport const REGISTRY_FINALIZE_AFTER = 10_000\nexport const REGISTRY_SWEEP_INTERVAL = 10_000\n\nexport class TimerBasedFinalizationRegistry<T> implements FinalizationRegistryType<T> {\n private registrations: Map<unknown, { value: T; registeredAt: number }> = new Map()\n private sweepTimeout: ReturnType<typeof setTimeout> | undefined\n\n constructor(private readonly finalize: (value: T) => void) {}\n\n // Token is actually required with this impl\n register(target: object, value: T, token?: object) {\n this.registrations.set(token, {\n value,\n registeredAt: Date.now()\n })\n this.scheduleSweep()\n }\n\n unregister(token: unknown) {\n this.registrations.delete(token)\n }\n\n // Bound so it can be used directly as setTimeout callback.\n sweep = (maxAge = REGISTRY_FINALIZE_AFTER) => {\n // cancel timeout so we can force sweep anytime\n clearTimeout(this.sweepTimeout)\n this.sweepTimeout = undefined\n\n const now = Date.now()\n this.registrations.forEach((registration, token) => {\n if (now - registration.registeredAt >= maxAge) {\n this.finalize(registration.value)\n this.registrations.delete(token)\n }\n })\n\n if (this.registrations.size > 0) {\n this.scheduleSweep()\n }\n }\n\n // Bound so it can be exported directly as clearTimers test utility.\n finalizeAllImmediately = () => {\n this.sweep(0)\n }\n\n private scheduleSweep() {\n if (this.sweepTimeout === undefined) {\n this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL)\n }\n }\n}\n\nexport const UniversalFinalizationRegistry =\n typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : TimerBasedFinalizationRegistry\n","import { Reaction } from \"mobx\"\nimport { UniversalFinalizationRegistry } from \"./UniversalFinalizationRegistry\"\n\nexport const observerFinalizationRegistry = new UniversalFinalizationRegistry(\n (adm: { reaction: Reaction | null }) => {\n adm.reaction?.dispose()\n adm.reaction = null\n }\n)\n","import { Reaction } from \"mobx\"\nimport React from \"react\"\nimport { printDebugValue } from \"./utils/printDebugValue\"\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\n// Do not store `admRef` (even as part of a closure!) on this object,\n// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.\ntype ObserverAdministration = {\n reaction: Reaction | null // also serves as disposed flag\n onStoreChange: Function | null // also serves as mounted flag\n // stateVersion that 'ticks' for every time the reaction fires\n // tearing is still present,\n // because there is no cross component synchronization,\n // but we can use `useSyncExternalStore` API.\n // TODO: optimize to use number?\n stateVersion: any\n name: string\n // These don't depend on state/props, therefore we can keep them here instead of `useCallback`\n subscribe: Parameters<typeof React.useSyncExternalStore>[0]\n getSnapshot: Parameters<typeof React.useSyncExternalStore>[1]\n}\n\nfunction createReaction(adm: ObserverAdministration) {\n adm.reaction = new Reaction(`observer${adm.name}`, () => {\n adm.stateVersion = Symbol()\n // onStoreChange won't be available until the component \"mounts\".\n // If state changes in between initial render and mount,\n // `useSyncExternalStore` should handle that by checking the state version and issuing update.\n adm.onStoreChange?.()\n })\n}\n\nexport function useObserver<T>(render: () => T, baseComponentName: string = \"observed\"): T {\n if (isUsingStaticRendering()) {\n return render()\n }\n\n const admRef = React.useRef<ObserverAdministration | null>(null)\n\n if (!admRef.current) {\n // First render\n const adm: ObserverAdministration = {\n reaction: null,\n onStoreChange: null,\n stateVersion: Symbol(),\n name: baseComponentName,\n subscribe(onStoreChange: () => void) {\n // Do NOT access admRef here!\n observerFinalizationRegistry.unregister(adm)\n adm.onStoreChange = onStoreChange\n if (!adm.reaction) {\n // We've lost our reaction and therefore all subscriptions, occurs when:\n // 1. Timer based finalization registry disposed reaction before component mounted.\n // 2. React \"re-mounts\" same component without calling render in between (typically <StrictMode>).\n // We have to recreate reaction and schedule re-render to recreate subscriptions,\n // even if state did not change.\n createReaction(adm)\n // `onStoreChange` won't force update if subsequent `getSnapshot` returns same value.\n // So we make sure that is not the case\n adm.stateVersion = Symbol()\n }\n\n return () => {\n // Do NOT access admRef here!\n adm.onStoreChange = null\n adm.reaction?.dispose()\n adm.reaction = null\n }\n },\n getSnapshot() {\n // Do NOT access admRef here!\n return adm.stateVersion\n }\n }\n\n admRef.current = adm\n }\n\n const adm = admRef.current!\n\n if (!adm.reaction) {\n // First render or reaction was disposed by registry before subscribe\n createReaction(adm)\n // StrictMode/ConcurrentMode/Suspense may mean that our component is\n // rendered and abandoned multiple times, so we need to track leaked\n // Reactions.\n observerFinalizationRegistry.register(admRef, adm, adm)\n }\n\n React.useDebugValue(adm.reaction!, printDebugValue)\n\n React.useSyncExternalStore(\n // Both of these must be stable, otherwise it would keep resubscribing every render.\n adm.subscribe,\n adm.getSnapshot,\n adm.getSnapshot\n )\n\n // render the original component, but have the\n // reaction track the observables, so that rendering\n // can be invalidated (see above) once a dependency changes\n let renderResult!: T\n let exception\n adm.reaction!.track(() => {\n try {\n renderResult = render()\n } catch (e) {\n exception = e\n }\n })\n\n if (exception) {\n throw exception // re-throw any exceptions caught during rendering\n }\n\n return renderResult\n}\n","import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n ? Symbol.for(\"react.forward_ref\")\n : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n ? Symbol.for(\"react.memo\")\n : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\nexport interface IObserverOptions {\n readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n options: IObserverOptions & { forwardRef: true }\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n baseComponent: React.FunctionComponent<P>,\n options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<\n C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n Options extends IObserverOptions\n>(\n baseComponent: C,\n options?: Options\n): Options extends { forwardRef: true }\n ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n ? C &\n React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n >\n : never /* forwardRef set for a non forwarding component */\n : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n baseComponent:\n | React.ForwardRefRenderFunction<TRef, P>\n | React.FunctionComponent<P>\n | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n // TODO remove in next major\n options?: IObserverOptions\n) {\n if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n warnObserverOptionsDeprecated = false\n console.warn(\n `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n )\n }\n\n if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n throw new Error(\n `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n )\n }\n\n // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n if (isUsingStaticRendering()) {\n return baseComponent\n }\n\n let useForwardRef = options?.forwardRef ?? false\n let render = baseComponent\n\n const baseComponentName = baseComponent.displayName || baseComponent.name\n\n // If already wrapped with forwardRef, unwrap,\n // so we can patch render and apply memo\n if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n useForwardRef = true\n render = baseComponent[\"render\"]\n if (typeof render !== \"function\") {\n throw new Error(\n `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n )\n }\n }\n\n let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n return useObserver(() => render(props, ref), baseComponentName)\n }\n\n // Inherit original name and displayName, see #3438\n ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n if (isFunctionNameConfigurable) {\n Object.defineProperty(observerComponent, \"name\", {\n value: baseComponent.name,\n writable: true,\n configurable: true\n })\n }\n\n // Support legacy context: `contextTypes` must be applied before `memo`\n if ((baseComponent as any).contextTypes) {\n ;(observerComponent as React.FunctionComponent).contextTypes = (\n baseComponent as any\n ).contextTypes\n }\n\n if (useForwardRef) {\n // `forwardRef` must be applied prior `memo`\n // `forwardRef(observer(cmp))` throws:\n // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n observerComponent = forwardRef(observerComponent)\n }\n\n // memo; we are not interested in deep updates\n // in props; we assume that if deep objects are changed,\n // this is in observables, which would have been tracked anyway\n observerComponent = memo(observerComponent)\n\n copyStaticProperties(baseComponent, observerComponent)\n\n if (\"production\" !== process.env.NODE_ENV) {\n Object.defineProperty(observerComponent, \"contextTypes\", {\n set() {\n throw new Error(\n `[mobx-react-lite] \\`${\n this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n }.contextTypes\\` must be set before applying \\`observer\\`.`\n )\n }\n })\n }\n\n return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n $$typeof: true,\n render: true,\n compare: true,\n type: true,\n // Don't redefine `displayName`,\n // it's defined as getter-setter pair on `memo` (see #3192).\n displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n Object.keys(base).forEach(key => {\n if (!hoistBlackList[key]) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n }\n })\n}\n","import { useObserver } from \"./useObserver\"\n\ninterface IObserverProps {\n children?(): React.ReactElement | null\n render?(): React.ReactElement | null\n}\n\nfunction ObserverComponent({ children, render }: IObserverProps) {\n const component = children || render\n if (typeof component !== \"function\") {\n return null\n }\n return useObserver(component)\n}\nif (\"production\" !== process.env.NODE_ENV) {\n ObserverComponent.propTypes = {\n children: ObserverPropsCheck,\n render: ObserverPropsCheck\n }\n}\nObserverComponent.displayName = \"Observer\"\n\nexport { ObserverComponent as Observer }\n\nfunction ObserverPropsCheck(\n props: { [k: string]: any },\n key: string,\n componentName: string,\n location: any,\n propFullName: string\n) {\n const extraKey = key === \"children\" ? \"render\" : \"children\"\n const hasProp = typeof props[key] === \"function\"\n const hasExtraProp = typeof props[extraKey] === \"function\"\n if (hasProp && hasExtraProp) {\n return new Error(\n \"MobX Observer: Do not use children and render in the same time in`\" + componentName\n )\n }\n\n if (hasProp || hasExtraProp) {\n return null\n }\n return new Error(\n \"Invalid prop `\" +\n propFullName +\n \"` of type `\" +\n typeof props[key] +\n \"` supplied to\" +\n \" `\" +\n componentName +\n \"`, expected `function`.\"\n )\n}\n","import { useDeprecated } from \"./utils/utils\"\nimport { observable, runInAction } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useAsObservableSource<TSource extends object>(current: TSource): TSource {\n if (\"production\" !== process.env.NODE_ENV)\n useDeprecated(\n \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\"\n )\n // We're deliberately not using idiomatic destructuring for the hook here.\n // Accessing the state value as an array element prevents TypeScript from generating unnecessary helpers in the resulting code.\n // For further details, please refer to mobxjs/mobx#3842.\n const res = useState(() => observable(current, {}, { deep: false }))[0]\n runInAction(() => {\n Object.assign(res, current)\n })\n return res\n}\n","import \"./utils/assertEnvironment\"\n\nimport { unstable_batchedUpdates as batch } from \"./utils/reactBatchedUpdates\"\nimport { observerBatching } from \"./utils/observerBatching\"\nimport { useDeprecated } from \"./utils/utils\"\nimport { useObserver as useObserverOriginal } from \"./useObserver\"\nimport { enableStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\nobserverBatching(batch)\n\nexport { isUsingStaticRendering, enableStaticRendering } from \"./staticRendering\"\nexport { observer, IObserverOptions } from \"./observer\"\nexport { Observer } from \"./ObserverComponent\"\nexport { useLocalObservable } from \"./useLocalObservable\"\nexport { useLocalStore } from \"./useLocalStore\"\nexport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport { observerFinalizationRegistry as _observerFinalizationRegistry }\nexport const clearTimers = observerFinalizationRegistry[\"finalizeAllImmediately\"] ?? (() => {})\n\nexport function useObserver<T>(fn: () => T, baseComponentName: string = \"observed\"): T {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`.\"\n )\n }\n return useObserverOriginal(fn, baseComponentName)\n}\n\nexport { isObserverBatched, observerBatching } from \"./utils/observerBatching\"\n\nexport function useStaticRendering(enable: boolean) {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead\"\n )\n }\n enableStaticRendering(enable)\n}\n","import { observable, AnnotationsMap } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useLocalObservable<TStore extends Record<string, any>>(\n initializer: () => TStore,\n annotations?: AnnotationsMap<TStore, never>\n): TStore {\n return useState(() => observable(initializer(), annotations, { autoBind: true }))[0]\n}\n","import { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nimport { useDeprecated } from \"./utils/utils\"\nimport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport function useLocalStore<TStore extends Record<string, any>>(initializer: () => TStore): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source: TSource) => TStore,\n current: TSource\n): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source?: TSource) => TStore,\n current?: TSource\n): TStore {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\"\n )\n }\n const source = current && useAsObservableSource(current)\n return useState(() => observable(initializer(source), undefined, { autoBind: true }))[0]\n}\n"],"names":["useState","Error","makeObservable","defaultNoopBatch","callback","observerBatching","reactionScheduler","configure","printDebugValue","v","getDependencyTree","globalIsUsingStaticRendering","enableStaticRendering","enable","isUsingStaticRendering","observerFinalizationRegistry","FinalizationRegistry","TimerBasedFinalizationRegistry","finalize","registrations","Map","this","sweepTimeout","sweep","maxAge","clearTimeout","_this","undefined","now","Date","forEach","registration","token","registeredAt","value","size","scheduleSweep","finalizeAllImmediately","_proto","prototype","register","target","set","unregister","setTimeout","adm","_adm$reaction","reaction","dispose","createReaction","Reaction","name","stateVersion","Symbol","onStoreChange","useObserver","render","baseComponentName","admRef","React","useRef","current","subscribe","getSnapshot","renderResult","exception","useDebugValue","useSyncExternalStore","track","e","hasSymbol","isFunctionNameConfigurable","_Object$getOwnPropert","_Object$getOwnPropert2","Object","getOwnPropertyDescriptor","configurable","ReactForwardRefSymbol","forwardRef","props","ReactMemoSymbol","memo","hoistBlackList","$$typeof","compare","type","displayName","ObserverComponent","_ref","component","children","useAsObservableSource","res","observable","deep","runInAction","assign","batch","clearTimers","_observerFinalization","baseComponent","options","useForwardRef","_options$forwardRef","base","observerComponent","ref","defineProperty","writable","contextTypes","keys","key","initializer","annotations","autoBind","source","fn","useObserverOriginal"],"mappings":"6LAGA,IAAKA,WACD,MAAM,IAAIC,MAAM,qDAEpB,IAAKC,iBACD,MAAM,IAAID,MAAM,+ECLJE,EAAiBC,GAC7BA,aAGYC,EAAiBC,GACxBA,IACDA,EAAoBH,GAOxBI,YAAU,CAAED,kBAAAA,aCbAE,EAAgBC,GAC5B,OAAOC,oBAAkBD,GCH7B,IAAIE,GAA+B,WAEnBC,EAAsBC,GAClCF,EAA+BE,EAGnC,SAAgBC,IACZ,OAAOH,ECCJ,QCLMI,EAA+B,ID2DR,oBAAzBC,qBACDA,gCAhDN,SAAAC,EAA6BC,mBAAAA,qBAHrBC,cAAkE,IAAIC,IAAKC,KAC3EC,oBAAYD,KAkBpBE,MAAQ,SAACC,YAAAA,IAAAA,EAvB0B,KAyB/BC,aAAaC,EAAKJ,cAClBI,EAAKJ,kBAAeK,EAEpB,IAAMC,EAAMC,KAAKD,MACjBF,EAAKP,cAAcW,SAAQ,SAACC,EAAcC,GAClCJ,EAAMG,EAAaE,cAAgBT,IACnCE,EAAKR,SAASa,EAAaG,OAC3BR,EAAKP,qBAAqBa,OAI9BN,EAAKP,cAAcgB,KAAO,GAC1BT,EAAKU,iBAEZf,KAGDgB,uBAAyB,WACrBX,EAAKH,MAAM,IApCcF,cAAAH,EAE7B,IAAAoB,EAAArB,EAAAsB,UAyCC,OAzCDD,EACAE,SAAA,SAASC,EAAgBP,EAAUF,GAC/BX,KAAKF,cAAcuB,IAAIV,EAAO,CAC1BE,MAAAA,EACAD,aAAcJ,KAAKD,QAEvBP,KAAKe,iBACRE,EAEDK,WAAA,SAAWX,GACPX,KAAKF,qBAAqBa,IAG9BM,EAwBQF,cAAA,gBACsBT,IAAtBN,KAAKC,eACLD,KAA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oB3B,aAAW2B,IAMnCA,EAAoBxB,OAAKwB,GA8BCD,EA5BLJ,EA4BgB3D,EA5BDgE,EA6BpC/B,OAAOoC,KAAKN,GAAM1E,SAAQ,SAAAiF,GACjB7B,EAAe6B,IAChBrC,OAAOiC,eAAelE,EAAQsE,EAAKrC,OAAOC,yBAAyB6B,EAAMO,OAjB1EN,kGIrJPO,EACAC,GAEA,OAAOjH,YAAS,WAAA,OAAM6F,aAAWmB,IAAeC,EAAa,CAAEC,UAAU,OAAS,mCCKlFF,EACAnD,GAOA,IAAMsD,EAAStD,GAAW8B,EAAsB9B,GAChD,OAAO7D,YAAS,WAAA,OAAM6F,aAAWmB,EAAYG,QAASxF,EAAW,CAAEuF,UAAU,OAAS,iCFA3DE,EAAa3D,GAMxC,gBANwCA,IAAAA,EAA4B,YAM7D4D,EAAoBD,EAAI3D,wCAKA5C,GAM/BD,EAAsBC"}
\ No newline at end of file
diff --git a/dist/mobxreactlite.esm.development.js b/dist/mobxreactlite.esm.development.js
index 9ffe365e69ebcdfaa3d82aa340e7328456f99bab..2cea4fc93debcb7df62f4fd8cc27ab99be0740df 100644
--- a/dist/mobxreactlite.esm.development.js
+++ b/dist/mobxreactlite.esm.development.js
@@ -1,7 +1,6 @@
import { makeObservable, configure, getDependencyTree, Reaction, observable, runInAction } from 'mobx';
import React, { useState, forwardRef, memo } from 'react';
import { unstable_batchedUpdates } from 'react-dom';
-import { useSyncExternalStore } from 'use-sync-external-store/shim';
if (!useState) {
throw new Error("mobx-react-lite requires React with Hooks support");
@@ -175,7 +174,7 @@ function useObserver(render, baseComponentName) {
observerFinalizationRegistry.register(admRef, adm, adm);
}
React.useDebugValue(adm.reaction, printDebugValue);
- useSyncExternalStore(
+ React.useSyncExternalStore(
// Both of these must be stable, otherwise it would keep resubscribing every render.
adm.subscribe, adm.getSnapshot, adm.getSnapshot);
// render the original component, but have the
diff --git a/dist/mobxreactlite.esm.development.js.map b/dist/mobxreactlite.esm.development.js.map
index 139d5dc919a0f86e424ebb3e46e4013bc8839ba0..62590d70e73503610935a78cc8cbc08a830dec3c 100644
--- a/dist/mobxreactlite.esm.development.js.map
+++ b/dist/mobxreactlite.esm.development.js.map
@@ -1 +1 @@
-{"version":3,"file":"mobxreactlite.esm.development.js","sources":["../src/utils/assertEnvironment.ts","../src/utils/observerBatching.ts","../src/utils/utils.ts","../src/utils/printDebugValue.ts","../src/staticRendering.ts","../src/utils/UniversalFinalizationRegistry.ts","../src/utils/observerFinalizationRegistry.ts","../src/useObserver.ts","../src/observer.ts","../src/ObserverComponent.ts","../src/useLocalObservable.ts","../src/useAsObservableSource.ts","../src/useLocalStore.ts","../src/index.ts"],"sourcesContent":["import { makeObservable } from \"mobx\"\nimport { useState } from \"react\"\n\nif (!useState) {\n throw new Error(\"mobx-react-lite requires React with Hooks support\")\n}\nif (!makeObservable) {\n throw new Error(\"mobx-react-lite@3 requires mobx at least version 6 to be available\")\n}\n","import { configure } from \"mobx\"\n\nexport function defaultNoopBatch(callback: () => void) {\n callback()\n}\n\nexport function observerBatching(reactionScheduler: any) {\n if (!reactionScheduler) {\n reactionScheduler = defaultNoopBatch\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[MobX] Failed to get unstable_batched updates from react-dom / react-native\"\n )\n }\n }\n configure({ reactionScheduler })\n}\n\nexport const isObserverBatched = () => {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\"[MobX] Deprecated\")\n }\n\n return true\n}\n","const deprecatedMessages: string[] = []\n\nexport function useDeprecated(msg: string) {\n if (!deprecatedMessages.includes(msg)) {\n deprecatedMessages.push(msg)\n console.warn(msg)\n }\n}\n","import { getDependencyTree, Reaction } from \"mobx\"\n\nexport function printDebugValue(v: Reaction) {\n return getDependencyTree(v)\n}\n","let globalIsUsingStaticRendering = false\n\nexport function enableStaticRendering(enable: boolean) {\n globalIsUsingStaticRendering = enable\n}\n\nexport function isUsingStaticRendering(): boolean {\n return globalIsUsingStaticRendering\n}\n","export declare class FinalizationRegistryType<T> {\n constructor(finalize: (value: T) => void)\n register(target: object, value: T, token?: object): void\n unregister(token: object): void\n}\n\ndeclare const FinalizationRegistry: typeof FinalizationRegistryType | undefined\n\nexport const REGISTRY_FINALIZE_AFTER = 10_000\nexport const REGISTRY_SWEEP_INTERVAL = 10_000\n\nexport class TimerBasedFinalizationRegistry<T> implements FinalizationRegistryType<T> {\n private registrations: Map<unknown, { value: T; registeredAt: number }> = new Map()\n private sweepTimeout: ReturnType<typeof setTimeout> | undefined\n\n constructor(private readonly finalize: (value: T) => void) {}\n\n // Token is actually required with this impl\n register(target: object, value: T, token?: object) {\n this.registrations.set(token, {\n value,\n registeredAt: Date.now()\n })\n this.scheduleSweep()\n }\n\n unregister(token: unknown) {\n this.registrations.delete(token)\n }\n\n // Bound so it can be used directly as setTimeout callback.\n sweep = (maxAge = REGISTRY_FINALIZE_AFTER) => {\n // cancel timeout so we can force sweep anytime\n clearTimeout(this.sweepTimeout)\n this.sweepTimeout = undefined\n\n const now = Date.now()\n this.registrations.forEach((registration, token) => {\n if (now - registration.registeredAt >= maxAge) {\n this.finalize(registration.value)\n this.registrations.delete(token)\n }\n })\n\n if (this.registrations.size > 0) {\n this.scheduleSweep()\n }\n }\n\n // Bound so it can be exported directly as clearTimers test utility.\n finalizeAllImmediately = () => {\n this.sweep(0)\n }\n\n private scheduleSweep() {\n if (this.sweepTimeout === undefined) {\n this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL)\n }\n }\n}\n\nexport const UniversalFinalizationRegistry =\n typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : TimerBasedFinalizationRegistry\n","import { Reaction } from \"mobx\"\nimport { UniversalFinalizationRegistry } from \"./UniversalFinalizationRegistry\"\n\nexport const observerFinalizationRegistry = new UniversalFinalizationRegistry(\n (adm: { reaction: Reaction | null }) => {\n adm.reaction?.dispose()\n adm.reaction = null\n }\n)\n","import { Reaction } from \"mobx\"\nimport React from \"react\"\nimport { printDebugValue } from \"./utils/printDebugValue\"\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\nimport { useSyncExternalStore } from \"use-sync-external-store/shim\"\n\n// Do not store `admRef` (even as part of a closure!) on this object,\n// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.\ntype ObserverAdministration = {\n reaction: Reaction | null // also serves as disposed flag\n onStoreChange: Function | null // also serves as mounted flag\n // stateVersion that 'ticks' for every time the reaction fires\n // tearing is still present,\n // because there is no cross component synchronization,\n // but we can use `useSyncExternalStore` API.\n // TODO: optimize to use number?\n stateVersion: any\n name: string\n // These don't depend on state/props, therefore we can keep them here instead of `useCallback`\n subscribe: Parameters<typeof React.useSyncExternalStore>[0]\n getSnapshot: Parameters<typeof React.useSyncExternalStore>[1]\n}\n\nfunction createReaction(adm: ObserverAdministration) {\n adm.reaction = new Reaction(`observer${adm.name}`, () => {\n adm.stateVersion = Symbol()\n // onStoreChange won't be available until the component \"mounts\".\n // If state changes in between initial render and mount,\n // `useSyncExternalStore` should handle that by checking the state version and issuing update.\n adm.onStoreChange?.()\n })\n}\n\nexport function useObserver<T>(render: () => T, baseComponentName: string = \"observed\"): T {\n if (isUsingStaticRendering()) {\n return render()\n }\n\n const admRef = React.useRef<ObserverAdministration | null>(null)\n\n if (!admRef.current) {\n // First render\n const adm: ObserverAdministration = {\n reaction: null,\n onStoreChange: null,\n stateVersion: Symbol(),\n name: baseComponentName,\n subscribe(onStoreChange: () => void) {\n // Do NOT access admRef here!\n observerFinalizationRegistry.unregister(adm)\n adm.onStoreChange = onStoreChange\n if (!adm.reaction) {\n // We've lost our reaction and therefore all subscriptions, occurs when:\n // 1. Timer based finalization registry disposed reaction before component mounted.\n // 2. React \"re-mounts\" same component without calling render in between (typically <StrictMode>).\n // We have to recreate reaction and schedule re-render to recreate subscriptions,\n // even if state did not change.\n createReaction(adm)\n // `onStoreChange` won't force update if subsequent `getSnapshot` returns same value.\n // So we make sure that is not the case\n adm.stateVersion = Symbol()\n }\n\n return () => {\n // Do NOT access admRef here!\n adm.onStoreChange = null\n adm.reaction?.dispose()\n adm.reaction = null\n }\n },\n getSnapshot() {\n // Do NOT access admRef here!\n return adm.stateVersion\n }\n }\n\n admRef.current = adm\n }\n\n const adm = admRef.current!\n\n if (!adm.reaction) {\n // First render or reaction was disposed by registry before subscribe\n createReaction(adm)\n // StrictMode/ConcurrentMode/Suspense may mean that our component is\n // rendered and abandoned multiple times, so we need to track leaked\n // Reactions.\n observerFinalizationRegistry.register(admRef, adm, adm)\n }\n\n React.useDebugValue(adm.reaction!, printDebugValue)\n\n useSyncExternalStore(\n // Both of these must be stable, otherwise it would keep resubscribing every render.\n adm.subscribe,\n adm.getSnapshot,\n adm.getSnapshot\n )\n\n // render the original component, but have the\n // reaction track the observables, so that rendering\n // can be invalidated (see above) once a dependency changes\n let renderResult!: T\n let exception\n adm.reaction!.track(() => {\n try {\n renderResult = render()\n } catch (e) {\n exception = e\n }\n })\n\n if (exception) {\n throw exception // re-throw any exceptions caught during rendering\n }\n\n return renderResult\n}\n","import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n ? Symbol.for(\"react.forward_ref\")\n : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n ? Symbol.for(\"react.memo\")\n : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\nexport interface IObserverOptions {\n readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n options: IObserverOptions & { forwardRef: true }\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n baseComponent: React.FunctionComponent<P>,\n options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<\n C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n Options extends IObserverOptions\n>(\n baseComponent: C,\n options?: Options\n): Options extends { forwardRef: true }\n ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n ? C &\n React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n >\n : never /* forwardRef set for a non forwarding component */\n : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n baseComponent:\n | React.ForwardRefRenderFunction<TRef, P>\n | React.FunctionComponent<P>\n | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n // TODO remove in next major\n options?: IObserverOptions\n) {\n if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n warnObserverOptionsDeprecated = false\n console.warn(\n `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n )\n }\n\n if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n throw new Error(\n `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n )\n }\n\n // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n if (isUsingStaticRendering()) {\n return baseComponent\n }\n\n let useForwardRef = options?.forwardRef ?? false\n let render = baseComponent\n\n const baseComponentName = baseComponent.displayName || baseComponent.name\n\n // If already wrapped with forwardRef, unwrap,\n // so we can patch render and apply memo\n if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n useForwardRef = true\n render = baseComponent[\"render\"]\n if (typeof render !== \"function\") {\n throw new Error(\n `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n )\n }\n }\n\n let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n return useObserver(() => render(props, ref), baseComponentName)\n }\n\n // Inherit original name and displayName, see #3438\n ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n if (isFunctionNameConfigurable) {\n Object.defineProperty(observerComponent, \"name\", {\n value: baseComponent.name,\n writable: true,\n configurable: true\n })\n }\n\n // Support legacy context: `contextTypes` must be applied before `memo`\n if ((baseComponent as any).contextTypes) {\n ;(observerComponent as React.FunctionComponent).contextTypes = (\n baseComponent as any\n ).contextTypes\n }\n\n if (useForwardRef) {\n // `forwardRef` must be applied prior `memo`\n // `forwardRef(observer(cmp))` throws:\n // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n observerComponent = forwardRef(observerComponent)\n }\n\n // memo; we are not interested in deep updates\n // in props; we assume that if deep objects are changed,\n // this is in observables, which would have been tracked anyway\n observerComponent = memo(observerComponent)\n\n copyStaticProperties(baseComponent, observerComponent)\n\n if (\"production\" !== process.env.NODE_ENV) {\n Object.defineProperty(observerComponent, \"contextTypes\", {\n set() {\n throw new Error(\n `[mobx-react-lite] \\`${\n this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n }.contextTypes\\` must be set before applying \\`observer\\`.`\n )\n }\n })\n }\n\n return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n $$typeof: true,\n render: true,\n compare: true,\n type: true,\n // Don't redefine `displayName`,\n // it's defined as getter-setter pair on `memo` (see #3192).\n displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n Object.keys(base).forEach(key => {\n if (!hoistBlackList[key]) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n }\n })\n}\n","import { useObserver } from \"./useObserver\"\n\ninterface IObserverProps {\n children?(): React.ReactElement | null\n render?(): React.ReactElement | null\n}\n\nfunction ObserverComponent({ children, render }: IObserverProps) {\n const component = children || render\n if (typeof component !== \"function\") {\n return null\n }\n return useObserver(component)\n}\nif (\"production\" !== process.env.NODE_ENV) {\n ObserverComponent.propTypes = {\n children: ObserverPropsCheck,\n render: ObserverPropsCheck\n }\n}\nObserverComponent.displayName = \"Observer\"\n\nexport { ObserverComponent as Observer }\n\nfunction ObserverPropsCheck(\n props: { [k: string]: any },\n key: string,\n componentName: string,\n location: any,\n propFullName: string\n) {\n const extraKey = key === \"children\" ? \"render\" : \"children\"\n const hasProp = typeof props[key] === \"function\"\n const hasExtraProp = typeof props[extraKey] === \"function\"\n if (hasProp && hasExtraProp) {\n return new Error(\n \"MobX Observer: Do not use children and render in the same time in`\" + componentName\n )\n }\n\n if (hasProp || hasExtraProp) {\n return null\n }\n return new Error(\n \"Invalid prop `\" +\n propFullName +\n \"` of type `\" +\n typeof props[key] +\n \"` supplied to\" +\n \" `\" +\n componentName +\n \"`, expected `function`.\"\n )\n}\n","import { observable, AnnotationsMap } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useLocalObservable<TStore extends Record<string, any>>(\n initializer: () => TStore,\n annotations?: AnnotationsMap<TStore, never>\n): TStore {\n return useState(() => observable(initializer(), annotations, { autoBind: true }))[0]\n}\n","import { useDeprecated } from \"./utils/utils\"\nimport { observable, runInAction } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useAsObservableSource<TSource extends object>(current: TSource): TSource {\n if (\"production\" !== process.env.NODE_ENV)\n useDeprecated(\n \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\"\n )\n // We're deliberately not using idiomatic destructuring for the hook here.\n // Accessing the state value as an array element prevents TypeScript from generating unnecessary helpers in the resulting code.\n // For further details, please refer to mobxjs/mobx#3842.\n const res = useState(() => observable(current, {}, { deep: false }))[0]\n runInAction(() => {\n Object.assign(res, current)\n })\n return res\n}\n","import { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nimport { useDeprecated } from \"./utils/utils\"\nimport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport function useLocalStore<TStore extends Record<string, any>>(initializer: () => TStore): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source: TSource) => TStore,\n current: TSource\n): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source?: TSource) => TStore,\n current?: TSource\n): TStore {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\"\n )\n }\n const source = current && useAsObservableSource(current)\n return useState(() => observable(initializer(source), undefined, { autoBind: true }))[0]\n}\n","import \"./utils/assertEnvironment\"\n\nimport { unstable_batchedUpdates as batch } from \"./utils/reactBatchedUpdates\"\nimport { observerBatching } from \"./utils/observerBatching\"\nimport { useDeprecated } from \"./utils/utils\"\nimport { useObserver as useObserverOriginal } from \"./useObserver\"\nimport { enableStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\nobserverBatching(batch)\n\nexport { isUsingStaticRendering, enableStaticRendering } from \"./staticRendering\"\nexport { observer, IObserverOptions } from \"./observer\"\nexport { Observer } from \"./ObserverComponent\"\nexport { useLocalObservable } from \"./useLocalObservable\"\nexport { useLocalStore } from \"./useLocalStore\"\nexport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport { observerFinalizationRegistry as _observerFinalizationRegistry }\nexport const clearTimers = observerFinalizationRegistry[\"finalizeAllImmediately\"] ?? (() => {})\n\nexport function useObserver<T>(fn: () => T, baseComponentName: string = \"observed\"): T {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`.\"\n )\n }\n return useObserverOriginal(fn, baseComponentName)\n}\n\nexport { isObserverBatched, observerBatching } from \"./utils/observerBatching\"\n\nexport function useStaticRendering(enable: boolean) {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead\"\n )\n }\n enableStaticRendering(enable)\n}\n"],"names":["useState","Error","makeObservable","defaultNoopBatch","callback","observerBatching","reactionScheduler","console","warn","configure","isObserverBatched","deprecatedMessages","useDeprecated","msg","includes","push","printDebugValue","v","getDependencyTree","globalIsUsingStaticRendering","enableStaticRendering","enable","isUsingStaticRendering","REGISTRY_FINALIZE_AFTER","REGISTRY_SWEEP_INTERVAL","TimerBasedFinalizationRegistry","finalize","registrations","Map","sweepTimeout","sweep","maxAge","clearTimeout","_this","undefined","now","Date","forEach","registration","token","registeredAt","value","size","scheduleSweep","finalizeAllImmediately","_proto","prototype","register","target","set","unregister","setTimeout","UniversalFinalizationRegistry","FinalizationRegistry","observerFinalizationRegistry","adm","_adm$reaction","reaction","dispose","createReaction","Reaction","name","stateVersion","Symbol","onStoreChange","useObserver","render","baseComponentName","admRef","React","useRef","current","subscribe","getSnapshot","useDebugValue","useSyncExternalStore","renderResult","exception","track","e","warnObserverOptionsDeprecated","hasSymbol","isFunctionNameConfigurable","_Object$getOwnPropert","_Object$getOwnPropert2","Object","getOwnPropertyDescriptor","configurable","ReactForwardRefSymbol","forwardRef","props","ReactMemoSymbol","memo","observer","baseComponent","options","process","useForwardRef","_options$forwardRef","displayName","observerComponent","ref","defineProperty","writable","contextTypes","copyStaticProperties","_this$type","type","_this$type2","hoistBlackList","$$typeof","compare","base","keys","key","ObserverComponent","_ref","children","component","propTypes","ObserverPropsCheck","componentName","location","propFullName","extraKey","hasProp","hasExtraProp","useLocalObservable","initializer","annotations","observable","autoBind","useAsObservableSource","res","deep","runInAction","assign","useLocalStore","source","batch","clearTimers","_observerFinalization","fn","useObserverOriginal","useStaticRendering"],"mappings":";;;;;AAGA,IAAI,CAACA,QAAQ,EAAE;EACX,MAAM,IAAIC,KAAK,CAAC,mDAAmD,CAAC;;AAExE,IAAI,CAACC,cAAc,EAAE;EACjB,MAAM,IAAID,KAAK,CAAC,oEAAoE,CAAC;;;SCLzEE,gBAAgBA,CAACC,QAAoB;EACjDA,QAAQ,EAAE;AACd;AAEA,SAAgBC,gBAAgBA,CAACC,iBAAsB;EACnD,IAAI,CAACA,iBAAiB,EAAE;IACpBA,iBAAiB,GAAGH,gBAAgB;IACpC,AAA2C;MACvCI,OAAO,CAACC,IAAI,CACR,6EAA6E,CAChF;;;EAGTC,SAAS,CAAC;IAAEH,iBAAiB,EAAjBA;GAAmB,CAAC;AACpC;AAEA,IAAaI,iBAAiB,GAAG,SAApBA,iBAAiBA;EAC1B,AAA2C;IACvCH,OAAO,CAACC,IAAI,CAAC,mBAAmB,CAAC;;EAGrC,OAAO,IAAI;AACf,CAAC;;ACxBD,IAAMG,kBAAkB,GAAa,EAAE;AAEvC,SAAgBC,aAAaA,CAACC,GAAW;EACrC,IAAI,CAACF,kBAAkB,CAACG,QAAQ,CAACD,GAAG,CAAC,EAAE;IACnCF,kBAAkB,CAACI,IAAI,CAACF,GAAG,CAAC;IAC5BN,OAAO,CAACC,IAAI,CAACK,GAAG,CAAC;;AAEzB;;SCLgBG,eAAeA,CAACC,CAAW;EACvC,OAAOC,iBAAiB,CAACD,CAAC,CAAC;AAC/B;;ACJA,IAAIE,4BAA4B,GAAG,KAAK;AAExC,SAAgBC,qBAAqBA,CAACC,MAAe;EACjDF,4BAA4B,GAAGE,MAAM;AACzC;AAEA,SAAgBC,sBAAsBA;EACl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;AAEvB,IAQaC,WAAW,IAAAC,qBAAA,GAAGvF,4BAA4B,CAAC,wBAAwB,CAAC,YAAAuF,qBAAA,GAAK,cAAS;AAE/F,SAAgB5E,aAAWA,CAAI6E,EAAW,EAAE3E;MAAAA;IAAAA,oBAA4B,UAAU;;EAC9E,AAA2C;IACvCvD,aAAa,CACT,yIAAyI,CAC5I;;EAEL,OAAOmI,WAAmB,CAACD,EAAE,EAAE3E,iBAAiB,CAAC;AACrD;AAEA,SAEgB6E,kBAAkBA,CAAC3H,MAAe;EAC9C,AAA2C;IACvCd,OAAO,CAACC,IAAI,CACR,2FAA2F,CAC9F;;EAELY,qBAAqB,CAACC,MAAM,CAAC;AACjC;;;;"}
\ No newline at end of file
+{"version":3,"file":"mobxreactlite.esm.development.js","sources":["../src/utils/assertEnvironment.ts","../src/utils/observerBatching.ts","../src/utils/utils.ts","../src/utils/printDebugValue.ts","../src/staticRendering.ts","../src/utils/UniversalFinalizationRegistry.ts","../src/utils/observerFinalizationRegistry.ts","../src/useObserver.ts","../src/observer.ts","../src/ObserverComponent.ts","../src/useLocalObservable.ts","../src/useAsObservableSource.ts","../src/useLocalStore.ts","../src/index.ts"],"sourcesContent":["import { makeObservable } from \"mobx\"\nimport { useState } from \"react\"\n\nif (!useState) {\n throw new Error(\"mobx-react-lite requires React with Hooks support\")\n}\nif (!makeObservable) {\n throw new Error(\"mobx-react-lite@3 requires mobx at least version 6 to be available\")\n}\n","import { configure } from \"mobx\"\n\nexport function defaultNoopBatch(callback: () => void) {\n callback()\n}\n\nexport function observerBatching(reactionScheduler: any) {\n if (!reactionScheduler) {\n reactionScheduler = defaultNoopBatch\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[MobX] Failed to get unstable_batched updates from react-dom / react-native\"\n )\n }\n }\n configure({ reactionScheduler })\n}\n\nexport const isObserverBatched = () => {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\"[MobX] Deprecated\")\n }\n\n return true\n}\n","const deprecatedMessages: string[] = []\n\nexport function useDeprecated(msg: string) {\n if (!deprecatedMessages.includes(msg)) {\n deprecatedMessages.push(msg)\n console.warn(msg)\n }\n}\n","import { getDependencyTree, Reaction } from \"mobx\"\n\nexport function printDebugValue(v: Reaction) {\n return getDependencyTree(v)\n}\n","let globalIsUsingStaticRendering = false\n\nexport function enableStaticRendering(enable: boolean) {\n globalIsUsingStaticRendering = enable\n}\n\nexport function isUsingStaticRendering(): boolean {\n return globalIsUsingStaticRendering\n}\n","export declare class FinalizationRegistryType<T> {\n constructor(finalize: (value: T) => void)\n register(target: object, value: T, token?: object): void\n unregister(token: object): void\n}\n\ndeclare const FinalizationRegistry: typeof FinalizationRegistryType | undefined\n\nexport const REGISTRY_FINALIZE_AFTER = 10_000\nexport const REGISTRY_SWEEP_INTERVAL = 10_000\n\nexport class TimerBasedFinalizationRegistry<T> implements FinalizationRegistryType<T> {\n private registrations: Map<unknown, { value: T; registeredAt: number }> = new Map()\n private sweepTimeout: ReturnType<typeof setTimeout> | undefined\n\n constructor(private readonly finalize: (value: T) => void) {}\n\n // Token is actually required with this impl\n register(target: object, value: T, token?: object) {\n this.registrations.set(token, {\n value,\n registeredAt: Date.now()\n })\n this.scheduleSweep()\n }\n\n unregister(token: unknown) {\n this.registrations.delete(token)\n }\n\n // Bound so it can be used directly as setTimeout callback.\n sweep = (maxAge = REGISTRY_FINALIZE_AFTER) => {\n // cancel timeout so we can force sweep anytime\n clearTimeout(this.sweepTimeout)\n this.sweepTimeout = undefined\n\n const now = Date.now()\n this.registrations.forEach((registration, token) => {\n if (now - registration.registeredAt >= maxAge) {\n this.finalize(registration.value)\n this.registrations.delete(token)\n }\n })\n\n if (this.registrations.size > 0) {\n this.scheduleSweep()\n }\n }\n\n // Bound so it can be exported directly as clearTimers test utility.\n finalizeAllImmediately = () => {\n this.sweep(0)\n }\n\n private scheduleSweep() {\n if (this.sweepTimeout === undefined) {\n this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL)\n }\n }\n}\n\nexport const UniversalFinalizationRegistry =\n typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : TimerBasedFinalizationRegistry\n","import { Reaction } from \"mobx\"\nimport { UniversalFinalizationRegistry } from \"./UniversalFinalizationRegistry\"\n\nexport const observerFinalizationRegistry = new UniversalFinalizationRegistry(\n (adm: { reaction: Reaction | null }) => {\n adm.reaction?.dispose()\n adm.reaction = null\n }\n)\n","import { Reaction } from \"mobx\"\nimport React from \"react\"\nimport { printDebugValue } from \"./utils/printDebugValue\"\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\n// Do not store `admRef` (even as part of a closure!) on this object,\n// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.\ntype ObserverAdministration = {\n reaction: Reaction | null // also serves as disposed flag\n onStoreChange: Function | null // also serves as mounted flag\n // stateVersion that 'ticks' for every time the reaction fires\n // tearing is still present,\n // because there is no cross component synchronization,\n // but we can use `useSyncExternalStore` API.\n // TODO: optimize to use number?\n stateVersion: any\n name: string\n // These don't depend on state/props, therefore we can keep them here instead of `useCallback`\n subscribe: Parameters<typeof React.useSyncExternalStore>[0]\n getSnapshot: Parameters<typeof React.useSyncExternalStore>[1]\n}\n\nfunction createReaction(adm: ObserverAdministration) {\n adm.reaction = new Reaction(`observer${adm.name}`, () => {\n adm.stateVersion = Symbol()\n // onStoreChange won't be available until the component \"mounts\".\n // If state changes in between initial render and mount,\n // `useSyncExternalStore` should handle that by checking the state version and issuing update.\n adm.onStoreChange?.()\n })\n}\n\nexport function useObserver<T>(render: () => T, baseComponentName: string = \"observed\"): T {\n if (isUsingStaticRendering()) {\n return render()\n }\n\n const admRef = React.useRef<ObserverAdministration | null>(null)\n\n if (!admRef.current) {\n // First render\n const adm: ObserverAdministration = {\n reaction: null,\n onStoreChange: null,\n stateVersion: Symbol(),\n name: baseComponentName,\n subscribe(onStoreChange: () => void) {\n // Do NOT access admRef here!\n observerFinalizationRegistry.unregister(adm)\n adm.onStoreChange = onStoreChange\n if (!adm.reaction) {\n // We've lost our reaction and therefore all subscriptions, occurs when:\n // 1. Timer based finalization registry disposed reaction before component mounted.\n // 2. React \"re-mounts\" same component without calling render in between (typically <StrictMode>).\n // We have to recreate reaction and schedule re-render to recreate subscriptions,\n // even if state did not change.\n createReaction(adm)\n // `onStoreChange` won't force update if subsequent `getSnapshot` returns same value.\n // So we make sure that is not the case\n adm.stateVersion = Symbol()\n }\n\n return () => {\n // Do NOT access admRef here!\n adm.onStoreChange = null\n adm.reaction?.dispose()\n adm.reaction = null\n }\n },\n getSnapshot() {\n // Do NOT access admRef here!\n return adm.stateVersion\n }\n }\n\n admRef.current = adm\n }\n\n const adm = admRef.current!\n\n if (!adm.reaction) {\n // First render or reaction was disposed by registry before subscribe\n createReaction(adm)\n // StrictMode/ConcurrentMode/Suspense may mean that our component is\n // rendered and abandoned multiple times, so we need to track leaked\n // Reactions.\n observerFinalizationRegistry.register(admRef, adm, adm)\n }\n\n React.useDebugValue(adm.reaction!, printDebugValue)\n\n React.useSyncExternalStore(\n // Both of these must be stable, otherwise it would keep resubscribing every render.\n adm.subscribe,\n adm.getSnapshot,\n adm.getSnapshot\n )\n\n // render the original component, but have the\n // reaction track the observables, so that rendering\n // can be invalidated (see above) once a dependency changes\n let renderResult!: T\n let exception\n adm.reaction!.track(() => {\n try {\n renderResult = render()\n } catch (e) {\n exception = e\n }\n })\n\n if (exception) {\n throw exception // re-throw any exceptions caught during rendering\n }\n\n return renderResult\n}\n","import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n ? Symbol.for(\"react.forward_ref\")\n : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n ? Symbol.for(\"react.memo\")\n : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\nexport interface IObserverOptions {\n readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n options: IObserverOptions & { forwardRef: true }\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n baseComponent: React.FunctionComponent<P>,\n options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<\n C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n Options extends IObserverOptions\n>(\n baseComponent: C,\n options?: Options\n): Options extends { forwardRef: true }\n ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n ? C &\n React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n >\n : never /* forwardRef set for a non forwarding component */\n : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n baseComponent:\n | React.ForwardRefRenderFunction<TRef, P>\n | React.FunctionComponent<P>\n | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n // TODO remove in next major\n options?: IObserverOptions\n) {\n if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n warnObserverOptionsDeprecated = false\n console.warn(\n `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n )\n }\n\n if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n throw new Error(\n `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n )\n }\n\n // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n if (isUsingStaticRendering()) {\n return baseComponent\n }\n\n let useForwardRef = options?.forwardRef ?? false\n let render = baseComponent\n\n const baseComponentName = baseComponent.displayName || baseComponent.name\n\n // If already wrapped with forwardRef, unwrap,\n // so we can patch render and apply memo\n if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n useForwardRef = true\n render = baseComponent[\"render\"]\n if (typeof render !== \"function\") {\n throw new Error(\n `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n )\n }\n }\n\n let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n return useObserver(() => render(props, ref), baseComponentName)\n }\n\n // Inherit original name and displayName, see #3438\n ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n if (isFunctionNameConfigurable) {\n Object.defineProperty(observerComponent, \"name\", {\n value: baseComponent.name,\n writable: true,\n configurable: true\n })\n }\n\n // Support legacy context: `contextTypes` must be applied before `memo`\n if ((baseComponent as any).contextTypes) {\n ;(observerComponent as React.FunctionComponent).contextTypes = (\n baseComponent as any\n ).contextTypes\n }\n\n if (useForwardRef) {\n // `forwardRef` must be applied prior `memo`\n // `forwardRef(observer(cmp))` throws:\n // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n observerComponent = forwardRef(observerComponent)\n }\n\n // memo; we are not interested in deep updates\n // in props; we assume that if deep objects are changed,\n // this is in observables, which would have been tracked anyway\n observerComponent = memo(observerComponent)\n\n copyStaticProperties(baseComponent, observerComponent)\n\n if (\"production\" !== process.env.NODE_ENV) {\n Object.defineProperty(observerComponent, \"contextTypes\", {\n set() {\n throw new Error(\n `[mobx-react-lite] \\`${\n this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n }.contextTypes\\` must be set before applying \\`observer\\`.`\n )\n }\n })\n }\n\n return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n $$typeof: true,\n render: true,\n compare: true,\n type: true,\n // Don't redefine `displayName`,\n // it's defined as getter-setter pair on `memo` (see #3192).\n displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n Object.keys(base).forEach(key => {\n if (!hoistBlackList[key]) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n }\n })\n}\n","import { useObserver } from \"./useObserver\"\n\ninterface IObserverProps {\n children?(): React.ReactElement | null\n render?(): React.ReactElement | null\n}\n\nfunction ObserverComponent({ children, render }: IObserverProps) {\n const component = children || render\n if (typeof component !== \"function\") {\n return null\n }\n return useObserver(component)\n}\nif (\"production\" !== process.env.NODE_ENV) {\n ObserverComponent.propTypes = {\n children: ObserverPropsCheck,\n render: ObserverPropsCheck\n }\n}\nObserverComponent.displayName = \"Observer\"\n\nexport { ObserverComponent as Observer }\n\nfunction ObserverPropsCheck(\n props: { [k: string]: any },\n key: string,\n componentName: string,\n location: any,\n propFullName: string\n) {\n const extraKey = key === \"children\" ? \"render\" : \"children\"\n const hasProp = typeof props[key] === \"function\"\n const hasExtraProp = typeof props[extraKey] === \"function\"\n if (hasProp && hasExtraProp) {\n return new Error(\n \"MobX Observer: Do not use children and render in the same time in`\" + componentName\n )\n }\n\n if (hasProp || hasExtraProp) {\n return null\n }\n return new Error(\n \"Invalid prop `\" +\n propFullName +\n \"` of type `\" +\n typeof props[key] +\n \"` supplied to\" +\n \" `\" +\n componentName +\n \"`, expected `function`.\"\n )\n}\n","import { observable, AnnotationsMap } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useLocalObservable<TStore extends Record<string, any>>(\n initializer: () => TStore,\n annotations?: AnnotationsMap<TStore, never>\n): TStore {\n return useState(() => observable(initializer(), annotations, { autoBind: true }))[0]\n}\n","import { useDeprecated } from \"./utils/utils\"\nimport { observable, runInAction } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useAsObservableSource<TSource extends object>(current: TSource): TSource {\n if (\"production\" !== process.env.NODE_ENV)\n useDeprecated(\n \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\"\n )\n // We're deliberately not using idiomatic destructuring for the hook here.\n // Accessing the state value as an array element prevents TypeScript from generating unnecessary helpers in the resulting code.\n // For further details, please refer to mobxjs/mobx#3842.\n const res = useState(() => observable(current, {}, { deep: false }))[0]\n runInAction(() => {\n Object.assign(res, current)\n })\n return res\n}\n","import { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nimport { useDeprecated } from \"./utils/utils\"\nimport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport function useLocalStore<TStore extends Record<string, any>>(initializer: () => TStore): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source: TSource) => TStore,\n current: TSource\n): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source?: TSource) => TStore,\n current?: TSource\n): TStore {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\"\n )\n }\n const source = current && useAsObservableSource(current)\n return useState(() => observable(initializer(source), undefined, { autoBind: true }))[0]\n}\n","import \"./utils/assertEnvironment\"\n\nimport { unstable_batchedUpdates as batch } from \"./utils/reactBatchedUpdates\"\nimport { observerBatching } from \"./utils/observerBatching\"\nimport { useDeprecated } from \"./utils/utils\"\nimport { useObserver as useObserverOriginal } from \"./useObserver\"\nimport { enableStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\nobserverBatching(batch)\n\nexport { isUsingStaticRendering, enableStaticRendering } from \"./staticRendering\"\nexport { observer, IObserverOptions } from \"./observer\"\nexport { Observer } from \"./ObserverComponent\"\nexport { useLocalObservable } from \"./useLocalObservable\"\nexport { useLocalStore } from \"./useLocalStore\"\nexport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport { observerFinalizationRegistry as _observerFinalizationRegistry }\nexport const clearTimers = observerFinalizationRegistry[\"finalizeAllImmediately\"] ?? (() => {})\n\nexport function useObserver<T>(fn: () => T, baseComponentName: string = \"observed\"): T {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`.\"\n )\n }\n return useObserverOriginal(fn, baseComponentName)\n}\n\nexport { isObserverBatched, observerBatching } from \"./utils/observerBatching\"\n\nexport function useStaticRendering(enable: boolean) {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead\"\n )\n }\n enableStaticRendering(enable)\n}\n"],"names":["useState","Error","makeObservable","defaultNoopBatch","callback","observerBatching","reactionScheduler","console","warn","configure","isObserverBatched","deprecatedMessages","useDeprecated","msg","includes","push","printDebugValue","v","getDependencyTree","globalIsUsingStaticRendering","enableStaticRendering","enable","isUsingStaticRendering","REGISTRY_FINALIZE_AFTER","REGISTRY_SWEEP_INTERVAL","TimerBasedFinalizationRegistry","finalize","registrations","Map","sweepTimeout","sweep","maxAge","clearTimeout","_this","undefined","now","Date","forEach","registration","token","registeredAt","value","size","scheduleSweep","finalizeAllImmediately","_proto","prototype","register","target","set","unregister","setTimeout","UniversalFinalizationRegistry","FinalizationRegistry","observerFinalizationRegistry","adm","_adm$reaction","reaction","dispose","createReaction","Reaction","name","stateVersion","Symbol","onStoreChange","useObserver","render","baseComponentName","admRef","React","useRef","current","subscribe","getSnapshot","useDebugValue","useSyncExternalStore","renderResult","exception","track","e","warnObserverOptionsDeprecated","hasSymbol","isFunctionNameConfigurable","_Object$getOwnPropert","_Object$getOwnPropert2","Object","getOwnPropertyDescriptor","configurable","ReactForwardRefSymbol","forwardRef","props","ReactMemoSymbol","memo","observer","baseComponent","options","process","useForwardRef","_options$forwardRef","displayName","observerComponent","ref","defineProperty","writable","contextTypes","copyStaticProperties","_this$type","type","_this$type2","hoistBlackList","$$typeof","compare","base","keys","key","ObserverComponent","_ref","children","component","propTypes","ObserverPropsCheck","componentName","location","propFullName","extraKey","hasProp","hasExtraProp","useLocalObservable","initializer","annotations","observable","autoBind","useAsObservableSource","res","deep","runInAction","assign","useLocalStore","source","batch","clearTimers","_observerFinalization","fn","useObserverOriginal","useStaticRendering"],"mappings":";;;;AAGA,IAAI,CAACA,QAAQ,EAAE;EACX,MAAM,IAAIC,KAAK,CAAC,mDAAmD,CAAC;;AAExE,IAAI,CAACC,cAAc,EAAE;EACjB,MAAM,IAAID,KAAK,CAAC,oEAAoE,CAAC;;;SCLzEE,gBAAgBA,CAACC,QAAoB;EACjDA,QAAQ,EAAE;AACd;AAEA,SAAgBC,gBAAgBA,CAACC,iBAAsB;EACnD,IAAI,CAACA,iBAAiB,EAAE;IACpBA,iBAAiB,GAAGH,gBAAgB;IACpC,AAA2C;MACvCI,OAAO,CAACC,IAAI,CACR,6EAA6E,CAChF;;;EAGTC,SAAS,CAAC;IAAEH,iBAAiB,EAAjBA;GAAmB,CAAC;AACpC;AAEA,IAAaI,iBAAiB,GAAG,SAApBA,iBAAiBA;EAC1B,AAA2C;IACvCH,OAAO,CAACC,IAAI,CAAC,mBAAmB,CAAC;;EAGrC,OAAO,IAAI;AACf,CAAC;;ACxBD,IAAMG,kBAAkB,GAAa,EAAE;AAEvC,SAAgBC,aAAaA,CAACC,GAAW;EACrC,IAAI,CAACF,kBAAkB,CAACG,QAAQ,CAACD,GAAG,CAAC,EAAE;IACnCF,kBAAkB,CAACI,IA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oFAAoF,CACvF;;EAEL,IAAM8H,MAAM,GAAGnE,OAAO,IAAI6D,qBAAqB,CAAC7D,OAAO,CAAC;EACxD,OAAOvE,QAAQ,CAAC;IAAA,OAAMkI,UAAU,CAACF,WAAW,CAACU,MAAM,CAAC,EAAExG,SAAS,EAAE;MAAEiG,QAAQ,EAAE;KAAM,CAAC;IAAC,CAAC,CAAC,CAAC;AAC5F;;;ACtBA,AASA9H,gBAAgB,CAACsI,uBAAK,CAAC;AAEvB,IAQaC,WAAW,IAAAC,qBAAA,GAAGvF,4BAA4B,CAAC,wBAAwB,CAAC,YAAAuF,qBAAA,GAAK,cAAS;AAE/F,SAAgB5E,aAAWA,CAAI6E,EAAW,EAAE3E;MAAAA;IAAAA,oBAA4B,UAAU;;EAC9E,AAA2C;IACvCvD,aAAa,CACT,yIAAyI,CAC5I;;EAEL,OAAOmI,WAAmB,CAACD,EAAE,EAAE3E,iBAAiB,CAAC;AACrD;AAEA,SAEgB6E,kBAAkBA,CAAC3H,MAAe;EAC9C,AAA2C;IACvCd,OAAO,CAACC,IAAI,CACR,2FAA2F,CAC9F;;EAELY,qBAAqB,CAACC,MAAM,CAAC;AACjC;;;;"}
\ No newline at end of file
diff --git a/dist/mobxreactlite.esm.js b/dist/mobxreactlite.esm.js
index 80618c2a700d6f8b216b27ddde0b5e3d6230a559..ee46b2d2b84314aa40c6c753eddbd380a698f258 100644
--- a/dist/mobxreactlite.esm.js
+++ b/dist/mobxreactlite.esm.js
@@ -1,7 +1,6 @@
import { makeObservable, configure, getDependencyTree, Reaction, observable, runInAction } from 'mobx';
import React, { useState, forwardRef, memo } from 'react';
import { unstable_batchedUpdates } from 'react-dom';
-import { useSyncExternalStore } from 'use-sync-external-store/shim';
if (!useState) {
throw new Error("mobx-react-lite requires React with Hooks support");
@@ -175,7 +174,7 @@ function useObserver(render, baseComponentName) {
observerFinalizationRegistry.register(admRef, adm, adm);
}
React.useDebugValue(adm.reaction, printDebugValue);
- useSyncExternalStore(
+ React.useSyncExternalStore(
// Both of these must be stable, otherwise it would keep resubscribing every render.
adm.subscribe, adm.getSnapshot, adm.getSnapshot);
// render the original component, but have the
diff --git a/dist/mobxreactlite.esm.js.map b/dist/mobxreactlite.esm.js.map
index 3351192b7f8fca68de5916f6839a70a6a480e697..12df219d63cd5a6f53f4414919e80be4fb187b9e 100644
--- a/dist/mobxreactlite.esm.js.map
+++ b/dist/mobxreactlite.esm.js.map
@@ -1 +1 @@
-{"version":3,"file":"mobxreactlite.esm.js","sources":["../src/utils/assertEnvironment.ts","../src/utils/observerBatching.ts","../src/utils/utils.ts","../src/utils/printDebugValue.ts","../src/staticRendering.ts","../src/utils/UniversalFinalizationRegistry.ts","../src/utils/observerFinalizationRegistry.ts","../src/useObserver.ts","../src/observer.ts","../src/ObserverComponent.ts","../src/useLocalObservable.ts","../src/useAsObservableSource.ts","../src/useLocalStore.ts","../src/index.ts"],"sourcesContent":["import { makeObservable } from \"mobx\"\nimport { useState } from \"react\"\n\nif (!useState) {\n throw new Error(\"mobx-react-lite requires React with Hooks support\")\n}\nif (!makeObservable) {\n throw new Error(\"mobx-react-lite@3 requires mobx at least version 6 to be available\")\n}\n","import { configure } from \"mobx\"\n\nexport function defaultNoopBatch(callback: () => void) {\n callback()\n}\n\nexport function observerBatching(reactionScheduler: any) {\n if (!reactionScheduler) {\n reactionScheduler = defaultNoopBatch\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[MobX] Failed to get unstable_batched updates from react-dom / react-native\"\n )\n }\n }\n configure({ reactionScheduler })\n}\n\nexport const isObserverBatched = () => {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\"[MobX] Deprecated\")\n }\n\n return true\n}\n","const deprecatedMessages: string[] = []\n\nexport function useDeprecated(msg: string) {\n if (!deprecatedMessages.includes(msg)) {\n deprecatedMessages.push(msg)\n console.warn(msg)\n }\n}\n","import { getDependencyTree, Reaction } from \"mobx\"\n\nexport function printDebugValue(v: Reaction) {\n return getDependencyTree(v)\n}\n","let globalIsUsingStaticRendering = false\n\nexport function enableStaticRendering(enable: boolean) {\n globalIsUsingStaticRendering = enable\n}\n\nexport function isUsingStaticRendering(): boolean {\n return globalIsUsingStaticRendering\n}\n","export declare class FinalizationRegistryType<T> {\n constructor(finalize: (value: T) => void)\n register(target: object, value: T, token?: object): void\n unregister(token: object): void\n}\n\ndeclare const FinalizationRegistry: typeof FinalizationRegistryType | undefined\n\nexport const REGISTRY_FINALIZE_AFTER = 10_000\nexport const REGISTRY_SWEEP_INTERVAL = 10_000\n\nexport class TimerBasedFinalizationRegistry<T> implements FinalizationRegistryType<T> {\n private registrations: Map<unknown, { value: T; registeredAt: number }> = new Map()\n private sweepTimeout: ReturnType<typeof setTimeout> | undefined\n\n constructor(private readonly finalize: (value: T) => void) {}\n\n // Token is actually required with this impl\n register(target: object, value: T, token?: object) {\n this.registrations.set(token, {\n value,\n registeredAt: Date.now()\n })\n this.scheduleSweep()\n }\n\n unregister(token: unknown) {\n this.registrations.delete(token)\n }\n\n // Bound so it can be used directly as setTimeout callback.\n sweep = (maxAge = REGISTRY_FINALIZE_AFTER) => {\n // cancel timeout so we can force sweep anytime\n clearTimeout(this.sweepTimeout)\n this.sweepTimeout = undefined\n\n const now = Date.now()\n this.registrations.forEach((registration, token) => {\n if (now - registration.registeredAt >= maxAge) {\n this.finalize(registration.value)\n this.registrations.delete(token)\n }\n })\n\n if (this.registrations.size > 0) {\n this.scheduleSweep()\n }\n }\n\n // Bound so it can be exported directly as clearTimers test utility.\n finalizeAllImmediately = () => {\n this.sweep(0)\n }\n\n private scheduleSweep() {\n if (this.sweepTimeout === undefined) {\n this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL)\n }\n }\n}\n\nexport const UniversalFinalizationRegistry =\n typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : TimerBasedFinalizationRegistry\n","import { Reaction } from \"mobx\"\nimport { UniversalFinalizationRegistry } from \"./UniversalFinalizationRegistry\"\n\nexport const observerFinalizationRegistry = new UniversalFinalizationRegistry(\n (adm: { reaction: Reaction | null }) => {\n adm.reaction?.dispose()\n adm.reaction = null\n }\n)\n","import { Reaction } from \"mobx\"\nimport React from \"react\"\nimport { printDebugValue } from \"./utils/printDebugValue\"\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\nimport { useSyncExternalStore } from \"use-sync-external-store/shim\"\n\n// Do not store `admRef` (even as part of a closure!) on this object,\n// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.\ntype ObserverAdministration = {\n reaction: Reaction | null // also serves as disposed flag\n onStoreChange: Function | null // also serves as mounted flag\n // stateVersion that 'ticks' for every time the reaction fires\n // tearing is still present,\n // because there is no cross component synchronization,\n // but we can use `useSyncExternalStore` API.\n // TODO: optimize to use number?\n stateVersion: any\n name: string\n // These don't depend on state/props, therefore we can keep them here instead of `useCallback`\n subscribe: Parameters<typeof React.useSyncExternalStore>[0]\n getSnapshot: Parameters<typeof React.useSyncExternalStore>[1]\n}\n\nfunction createReaction(adm: ObserverAdministration) {\n adm.reaction = new Reaction(`observer${adm.name}`, () => {\n adm.stateVersion = Symbol()\n // onStoreChange won't be available until the component \"mounts\".\n // If state changes in between initial render and mount,\n // `useSyncExternalStore` should handle that by checking the state version and issuing update.\n adm.onStoreChange?.()\n })\n}\n\nexport function useObserver<T>(render: () => T, baseComponentName: string = \"observed\"): T {\n if (isUsingStaticRendering()) {\n return render()\n }\n\n const admRef = React.useRef<ObserverAdministration | null>(null)\n\n if (!admRef.current) {\n // First render\n const adm: ObserverAdministration = {\n reaction: null,\n onStoreChange: null,\n stateVersion: Symbol(),\n name: baseComponentName,\n subscribe(onStoreChange: () => void) {\n // Do NOT access admRef here!\n observerFinalizationRegistry.unregister(adm)\n adm.onStoreChange = onStoreChange\n if (!adm.reaction) {\n // We've lost our reaction and therefore all subscriptions, occurs when:\n // 1. Timer based finalization registry disposed reaction before component mounted.\n // 2. React \"re-mounts\" same component without calling render in between (typically <StrictMode>).\n // We have to recreate reaction and schedule re-render to recreate subscriptions,\n // even if state did not change.\n createReaction(adm)\n // `onStoreChange` won't force update if subsequent `getSnapshot` returns same value.\n // So we make sure that is not the case\n adm.stateVersion = Symbol()\n }\n\n return () => {\n // Do NOT access admRef here!\n adm.onStoreChange = null\n adm.reaction?.dispose()\n adm.reaction = null\n }\n },\n getSnapshot() {\n // Do NOT access admRef here!\n return adm.stateVersion\n }\n }\n\n admRef.current = adm\n }\n\n const adm = admRef.current!\n\n if (!adm.reaction) {\n // First render or reaction was disposed by registry before subscribe\n createReaction(adm)\n // StrictMode/ConcurrentMode/Suspense may mean that our component is\n // rendered and abandoned multiple times, so we need to track leaked\n // Reactions.\n observerFinalizationRegistry.register(admRef, adm, adm)\n }\n\n React.useDebugValue(adm.reaction!, printDebugValue)\n\n useSyncExternalStore(\n // Both of these must be stable, otherwise it would keep resubscribing every render.\n adm.subscribe,\n adm.getSnapshot,\n adm.getSnapshot\n )\n\n // render the original component, but have the\n // reaction track the observables, so that rendering\n // can be invalidated (see above) once a dependency changes\n let renderResult!: T\n let exception\n adm.reaction!.track(() => {\n try {\n renderResult = render()\n } catch (e) {\n exception = e\n }\n })\n\n if (exception) {\n throw exception // re-throw any exceptions caught during rendering\n }\n\n return renderResult\n}\n","import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n ? Symbol.for(\"react.forward_ref\")\n : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n ? Symbol.for(\"react.memo\")\n : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\nexport interface IObserverOptions {\n readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n options: IObserverOptions & { forwardRef: true }\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n baseComponent: React.FunctionComponent<P>,\n options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<\n C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n Options extends IObserverOptions\n>(\n baseComponent: C,\n options?: Options\n): Options extends { forwardRef: true }\n ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n ? C &\n React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n >\n : never /* forwardRef set for a non forwarding component */\n : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n baseComponent:\n | React.ForwardRefRenderFunction<TRef, P>\n | React.FunctionComponent<P>\n | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n // TODO remove in next major\n options?: IObserverOptions\n) {\n if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n warnObserverOptionsDeprecated = false\n console.warn(\n `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n )\n }\n\n if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n throw new Error(\n `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n )\n }\n\n // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n if (isUsingStaticRendering()) {\n return baseComponent\n }\n\n let useForwardRef = options?.forwardRef ?? false\n let render = baseComponent\n\n const baseComponentName = baseComponent.displayName || baseComponent.name\n\n // If already wrapped with forwardRef, unwrap,\n // so we can patch render and apply memo\n if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n useForwardRef = true\n render = baseComponent[\"render\"]\n if (typeof render !== \"function\") {\n throw new Error(\n `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n )\n }\n }\n\n let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n return useObserver(() => render(props, ref), baseComponentName)\n }\n\n // Inherit original name and displayName, see #3438\n ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n if (isFunctionNameConfigurable) {\n Object.defineProperty(observerComponent, \"name\", {\n value: baseComponent.name,\n writable: true,\n configurable: true\n })\n }\n\n // Support legacy context: `contextTypes` must be applied before `memo`\n if ((baseComponent as any).contextTypes) {\n ;(observerComponent as React.FunctionComponent).contextTypes = (\n baseComponent as any\n ).contextTypes\n }\n\n if (useForwardRef) {\n // `forwardRef` must be applied prior `memo`\n // `forwardRef(observer(cmp))` throws:\n // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n observerComponent = forwardRef(observerComponent)\n }\n\n // memo; we are not interested in deep updates\n // in props; we assume that if deep objects are changed,\n // this is in observables, which would have been tracked anyway\n observerComponent = memo(observerComponent)\n\n copyStaticProperties(baseComponent, observerComponent)\n\n if (\"production\" !== process.env.NODE_ENV) {\n Object.defineProperty(observerComponent, \"contextTypes\", {\n set() {\n throw new Error(\n `[mobx-react-lite] \\`${\n this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n }.contextTypes\\` must be set before applying \\`observer\\`.`\n )\n }\n })\n }\n\n return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n $$typeof: true,\n render: true,\n compare: true,\n type: true,\n // Don't redefine `displayName`,\n // it's defined as getter-setter pair on `memo` (see #3192).\n displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n Object.keys(base).forEach(key => {\n if (!hoistBlackList[key]) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n }\n })\n}\n","import { useObserver } from \"./useObserver\"\n\ninterface IObserverProps {\n children?(): React.ReactElement | null\n render?(): React.ReactElement | null\n}\n\nfunction ObserverComponent({ children, render }: IObserverProps) {\n const component = children || render\n if (typeof component !== \"function\") {\n return null\n }\n return useObserver(component)\n}\nif (\"production\" !== process.env.NODE_ENV) {\n ObserverComponent.propTypes = {\n children: ObserverPropsCheck,\n render: ObserverPropsCheck\n }\n}\nObserverComponent.displayName = \"Observer\"\n\nexport { ObserverComponent as Observer }\n\nfunction ObserverPropsCheck(\n props: { [k: string]: any },\n key: string,\n componentName: string,\n location: any,\n propFullName: string\n) {\n const extraKey = key === \"children\" ? \"render\" : \"children\"\n const hasProp = typeof props[key] === \"function\"\n const hasExtraProp = typeof props[extraKey] === \"function\"\n if (hasProp && hasExtraProp) {\n return new Error(\n \"MobX Observer: Do not use children and render in the same time in`\" + componentName\n )\n }\n\n if (hasProp || hasExtraProp) {\n return null\n }\n return new Error(\n \"Invalid prop `\" +\n propFullName +\n \"` of type `\" +\n typeof props[key] +\n \"` supplied to\" +\n \" `\" +\n componentName +\n \"`, expected `function`.\"\n )\n}\n","import { observable, AnnotationsMap } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useLocalObservable<TStore extends Record<string, any>>(\n initializer: () => TStore,\n annotations?: AnnotationsMap<TStore, never>\n): TStore {\n return useState(() => observable(initializer(), annotations, { autoBind: true }))[0]\n}\n","import { useDeprecated } from \"./utils/utils\"\nimport { observable, runInAction } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useAsObservableSource<TSource extends object>(current: TSource): TSource {\n if (\"production\" !== process.env.NODE_ENV)\n useDeprecated(\n \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\"\n )\n // We're deliberately not using idiomatic destructuring for the hook here.\n // Accessing the state value as an array element prevents TypeScript from generating unnecessary helpers in the resulting code.\n // For further details, please refer to mobxjs/mobx#3842.\n const res = useState(() => observable(current, {}, { deep: false }))[0]\n runInAction(() => {\n Object.assign(res, current)\n })\n return res\n}\n","import { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nimport { useDeprecated } from \"./utils/utils\"\nimport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport function useLocalStore<TStore extends Record<string, any>>(initializer: () => TStore): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source: TSource) => TStore,\n current: TSource\n): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source?: TSource) => TStore,\n current?: TSource\n): TStore {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\"\n )\n }\n const source = current && useAsObservableSource(current)\n return useState(() => observable(initializer(source), undefined, { autoBind: true }))[0]\n}\n","import \"./utils/assertEnvironment\"\n\nimport { unstable_batchedUpdates as batch } from \"./utils/reactBatchedUpdates\"\nimport { observerBatching } from \"./utils/observerBatching\"\nimport { useDeprecated } from \"./utils/utils\"\nimport { useObserver as useObserverOriginal } from \"./useObserver\"\nimport { enableStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\nobserverBatching(batch)\n\nexport { isUsingStaticRendering, enableStaticRendering } from \"./staticRendering\"\nexport { observer, IObserverOptions } from \"./observer\"\nexport { Observer } from \"./ObserverComponent\"\nexport { useLocalObservable } from \"./useLocalObservable\"\nexport { useLocalStore } from \"./useLocalStore\"\nexport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport { observerFinalizationRegistry as _observerFinalizationRegistry }\nexport const clearTimers = observerFinalizationRegistry[\"finalizeAllImmediately\"] ?? (() => {})\n\nexport function useObserver<T>(fn: () => T, baseComponentName: string = \"observed\"): T {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`.\"\n )\n }\n return useObserverOriginal(fn, baseComponentName)\n}\n\nexport { isObserverBatched, observerBatching } from \"./utils/observerBatching\"\n\nexport function useStaticRendering(enable: boolean) {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead\"\n )\n }\n enableStaticRendering(enable)\n}\n"],"names":["useState","Error","makeObservable","defaultNoopBatch","callback","observerBatching","reactionScheduler","process","env","NODE_ENV","console","warn","configure","isObserverBatched","deprecatedMessages","useDeprecated","msg","includes","push","printDebugValue","v","getDependencyTree","globalIsUsingStaticRendering","enableStaticRendering","enable","isUsingStaticRendering","REGISTRY_FINALIZE_AFTER","REGISTRY_SWEEP_INTERVAL","TimerBasedFinalizationRegistry","finalize","registrations","Map","sweepTimeout","sweep","maxAge","clearTimeout","_this","undefined","now","Date","forEach","registration","token","registeredAt","value","size","scheduleSweep","finalizeAllImmediately","_proto","prototype","register","target","set","unregister","setTimeout","UniversalFinalizationRegistry","FinalizationRegistry","observerFinalizationRegistry","adm","_adm$reaction","reaction","dispose","createReaction","Reaction","name","stateVersion","Symbol","onStoreChange","useObserver","render","baseComponentName","admRef","React","useRef","current","subscribe","getSnapshot","useDebugValue","useSyncExternalStore","renderResult","exception","track","e","warnObserverOptionsDeprecated","hasSymbol","isFunctionNameConfigurable","_Object$getOwnPropert","_Object$getOwnPropert2","Object","getOwnPropertyDescriptor","configurable","ReactForwardRefSymbol","forwardRef","props","ReactMemoSymbol","memo","observer","baseComponent","options","useForwardRef","_options$forwardRef","displayName","observerComponent","ref","defineProperty","writable","contextTypes","copyStaticProperties","_this$type","type","_this$type2","hoistBlackList","$$typeof","compare","base","keys","key","ObserverComponent","_ref","children","component","propTypes","ObserverPropsCheck","componentName","location","propFullName","extraKey","hasProp","hasExtraProp","useLocalObservable","initializer","annotations","observable","autoBind","useAsObservableSource","res","deep","runInAction","assign","useLocalStore","source","batch","clearTimers","_observerFinalization","fn","useObserverOriginal","useStaticRendering"],"mappings":";;;;;AAGA,IAAI,CAACA,QAAQ,EAAE;EACX,MAAM,IAAIC,KAAK,CAAC,mDAAmD,CAAC;;AAExE,IAAI,CAACC,cAAc,EAAE;EACjB,MAAM,IAAID,KAAK,CAAC,oEAAoE,CAAC;;;SCLzEE,gBAAgBA,CAACC,QAAoB;EACjDA,QAAQ,EAAE;AACd;AAEA,SAAgBC,gBAAgBA,CAACC,iBAAsB;EACnD,IAAI,CAACA,iBAAiB,EAAE;IACpBA,iBAAiB,GAAGH,gBAAgB;IACpC,IAAI,YAAY,KAAKI,OAAO,CAACC,GAAG,CAACC,QAAQ,EAAE;MACvCC,OAAO,CAACC,IAAI,CACR,6EAA6E,CAChF;;;EAGTC,SAAS,CAAC;IAAEN,iBAAiB,EAAjBA;GAAmB,CAAC;AACpC;AAEA,IAAaO,iBAAiB,GAAG,SAApBA,iBAAiBA;EAC1B,IAAI,YAAY,KAAKN,OAAO,CAACC,GAAG,CAACC,QAAQ,EAAE;IACvCC,OAAO,CAACC,IAAI,CAAC,mBAAmB,CAAC;;EAGrC,OAAO,IAAI;AACf,CAAC;;ACxBD,IAAMG,kBAAkB,GAAa,EAAE;AAEvC,SAAgBC,aAAaA,CAACC,GAAW;EACrC,IAAI,CAACF,kBAAkB,CAACG,QAAQ,CAACD,GAAG,CAAC,EAAE;IACnCF,kBAAkB,CAACI,IAAI,CAACF,GAAG,CAAC;IAC5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CAACkD,MAAM,CAACH,GAAG,EAAE7D,OAAO,CAAC;GAC9B,CAAC;EACF,OAAO6D,GAAG;AACd;;SCNgBI,aAAaA,CACzBT,WAAyC,EACzCxD,OAAiB;EAEjB,IAAI,YAAY,KAAKnE,OAAO,CAACC,GAAG,CAACC,QAAQ,EAAE;IACvCM,aAAa,CACT,oFAAoF,CACvF;;EAEL,IAAM6H,MAAM,GAAGlE,OAAO,IAAI4D,qBAAqB,CAAC5D,OAAO,CAAC;EACxD,OAAO1E,QAAQ,CAAC;IAAA,OAAMoI,UAAU,CAACF,WAAW,CAACU,MAAM,CAAC,EAAEvG,SAAS,EAAE;MAAEgG,QAAQ,EAAE;KAAM,CAAC;IAAC,CAAC,CAAC,CAAC;AAC5F;;;ACtBA,AASAhI,gBAAgB,CAACwI,uBAAK,CAAC;AAEvB,IAQaC,WAAW,IAAAC,qBAAA,GAAGtF,4BAA4B,CAAC,wBAAwB,CAAC,YAAAsF,qBAAA,GAAK,cAAS;AAE/F,SAAgB3E,aAAWA,CAAI4E,EAAW,EAAE1E;MAAAA;IAAAA,oBAA4B,UAAU;;EAC9E,IAAI,YAAY,KAAK/D,OAAO,CAACC,GAAG,CAACC,QAAQ,EAAE;IACvCM,aAAa,CACT,yIAAyI,CAC5I;;EAEL,OAAOkI,WAAmB,CAACD,EAAE,EAAE1E,iBAAiB,CAAC;AACrD;AAEA,SAEgB4E,kBAAkBA,CAAC1H,MAAe;EAC9C,IAAI,YAAY,KAAKjB,OAAO,CAACC,GAAG,CAACC,QAAQ,EAAE;IACvCC,OAAO,CAACC,IAAI,CACR,2FAA2F,CAC9F;;EAELY,qBAAqB,CAACC,MAAM,CAAC;AACjC;;;;"}
\ No newline at end of file
+{"version":3,"file":"mobxreactlite.esm.js","sources":["../src/utils/assertEnvironment.ts","../src/utils/observerBatching.ts","../src/utils/utils.ts","../src/utils/printDebugValue.ts","../src/staticRendering.ts","../src/utils/UniversalFinalizationRegistry.ts","../src/utils/observerFinalizationRegistry.ts","../src/useObserver.ts","../src/observer.ts","../src/ObserverComponent.ts","../src/useLocalObservable.ts","../src/useAsObservableSource.ts","../src/useLocalStore.ts","../src/index.ts"],"sourcesContent":["import { makeObservable } from \"mobx\"\nimport { useState } from \"react\"\n\nif (!useState) {\n throw new Error(\"mobx-react-lite requires React with Hooks support\")\n}\nif (!makeObservable) {\n throw new Error(\"mobx-react-lite@3 requires mobx at least version 6 to be available\")\n}\n","import { configure } from \"mobx\"\n\nexport function defaultNoopBatch(callback: () => void) {\n callback()\n}\n\nexport function observerBatching(reactionScheduler: any) {\n if (!reactionScheduler) {\n reactionScheduler = defaultNoopBatch\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[MobX] Failed to get unstable_batched updates from react-dom / react-native\"\n )\n }\n }\n configure({ reactionScheduler })\n}\n\nexport const isObserverBatched = () => {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\"[MobX] Deprecated\")\n }\n\n return true\n}\n","const deprecatedMessages: string[] = []\n\nexport function useDeprecated(msg: string) {\n if (!deprecatedMessages.includes(msg)) {\n deprecatedMessages.push(msg)\n console.warn(msg)\n }\n}\n","import { getDependencyTree, Reaction } from \"mobx\"\n\nexport function printDebugValue(v: Reaction) {\n return getDependencyTree(v)\n}\n","let globalIsUsingStaticRendering = false\n\nexport function enableStaticRendering(enable: boolean) {\n globalIsUsingStaticRendering = enable\n}\n\nexport function isUsingStaticRendering(): boolean {\n return globalIsUsingStaticRendering\n}\n","export declare class FinalizationRegistryType<T> {\n constructor(finalize: (value: T) => void)\n register(target: object, value: T, token?: object): void\n unregister(token: object): void\n}\n\ndeclare const FinalizationRegistry: typeof FinalizationRegistryType | undefined\n\nexport const REGISTRY_FINALIZE_AFTER = 10_000\nexport const REGISTRY_SWEEP_INTERVAL = 10_000\n\nexport class TimerBasedFinalizationRegistry<T> implements FinalizationRegistryType<T> {\n private registrations: Map<unknown, { value: T; registeredAt: number }> = new Map()\n private sweepTimeout: ReturnType<typeof setTimeout> | undefined\n\n constructor(private readonly finalize: (value: T) => void) {}\n\n // Token is actually required with this impl\n register(target: object, value: T, token?: object) {\n this.registrations.set(token, {\n value,\n registeredAt: Date.now()\n })\n this.scheduleSweep()\n }\n\n unregister(token: unknown) {\n this.registrations.delete(token)\n }\n\n // Bound so it can be used directly as setTimeout callback.\n sweep = (maxAge = REGISTRY_FINALIZE_AFTER) => {\n // cancel timeout so we can force sweep anytime\n clearTimeout(this.sweepTimeout)\n this.sweepTimeout = undefined\n\n const now = Date.now()\n this.registrations.forEach((registration, token) => {\n if (now - registration.registeredAt >= maxAge) {\n this.finalize(registration.value)\n this.registrations.delete(token)\n }\n })\n\n if (this.registrations.size > 0) {\n this.scheduleSweep()\n }\n }\n\n // Bound so it can be exported directly as clearTimers test utility.\n finalizeAllImmediately = () => {\n this.sweep(0)\n }\n\n private scheduleSweep() {\n if (this.sweepTimeout === undefined) {\n this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL)\n }\n }\n}\n\nexport const UniversalFinalizationRegistry =\n typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : TimerBasedFinalizationRegistry\n","import { Reaction } from \"mobx\"\nimport { UniversalFinalizationRegistry } from \"./UniversalFinalizationRegistry\"\n\nexport const observerFinalizationRegistry = new UniversalFinalizationRegistry(\n (adm: { reaction: Reaction | null }) => {\n adm.reaction?.dispose()\n adm.reaction = null\n }\n)\n","import { Reaction } from \"mobx\"\nimport React from \"react\"\nimport { printDebugValue } from \"./utils/printDebugValue\"\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\n// Do not store `admRef` (even as part of a closure!) on this object,\n// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.\ntype ObserverAdministration = {\n reaction: Reaction | null // also serves as disposed flag\n onStoreChange: Function | null // also serves as mounted flag\n // stateVersion that 'ticks' for every time the reaction fires\n // tearing is still present,\n // because there is no cross component synchronization,\n // but we can use `useSyncExternalStore` API.\n // TODO: optimize to use number?\n stateVersion: any\n name: string\n // These don't depend on state/props, therefore we can keep them here instead of `useCallback`\n subscribe: Parameters<typeof React.useSyncExternalStore>[0]\n getSnapshot: Parameters<typeof React.useSyncExternalStore>[1]\n}\n\nfunction createReaction(adm: ObserverAdministration) {\n adm.reaction = new Reaction(`observer${adm.name}`, () => {\n adm.stateVersion = Symbol()\n // onStoreChange won't be available until the component \"mounts\".\n // If state changes in between initial render and mount,\n // `useSyncExternalStore` should handle that by checking the state version and issuing update.\n adm.onStoreChange?.()\n })\n}\n\nexport function useObserver<T>(render: () => T, baseComponentName: string = \"observed\"): T {\n if (isUsingStaticRendering()) {\n return render()\n }\n\n const admRef = React.useRef<ObserverAdministration | null>(null)\n\n if (!admRef.current) {\n // First render\n const adm: ObserverAdministration = {\n reaction: null,\n onStoreChange: null,\n stateVersion: Symbol(),\n name: baseComponentName,\n subscribe(onStoreChange: () => void) {\n // Do NOT access admRef here!\n observerFinalizationRegistry.unregister(adm)\n adm.onStoreChange = onStoreChange\n if (!adm.reaction) {\n // We've lost our reaction and therefore all subscriptions, occurs when:\n // 1. Timer based finalization registry disposed reaction before component mounted.\n // 2. React \"re-mounts\" same component without calling render in between (typically <StrictMode>).\n // We have to recreate reaction and schedule re-render to recreate subscriptions,\n // even if state did not change.\n createReaction(adm)\n // `onStoreChange` won't force update if subsequent `getSnapshot` returns same value.\n // So we make sure that is not the case\n adm.stateVersion = Symbol()\n }\n\n return () => {\n // Do NOT access admRef here!\n adm.onStoreChange = null\n adm.reaction?.dispose()\n adm.reaction = null\n }\n },\n getSnapshot() {\n // Do NOT access admRef here!\n return adm.stateVersion\n }\n }\n\n admRef.current = adm\n }\n\n const adm = admRef.current!\n\n if (!adm.reaction) {\n // First render or reaction was disposed by registry before subscribe\n createReaction(adm)\n // StrictMode/ConcurrentMode/Suspense may mean that our component is\n // rendered and abandoned multiple times, so we need to track leaked\n // Reactions.\n observerFinalizationRegistry.register(admRef, adm, adm)\n }\n\n React.useDebugValue(adm.reaction!, printDebugValue)\n\n React.useSyncExternalStore(\n // Both of these must be stable, otherwise it would keep resubscribing every render.\n adm.subscribe,\n adm.getSnapshot,\n adm.getSnapshot\n )\n\n // render the original component, but have the\n // reaction track the observables, so that rendering\n // can be invalidated (see above) once a dependency changes\n let renderResult!: T\n let exception\n adm.reaction!.track(() => {\n try {\n renderResult = render()\n } catch (e) {\n exception = e\n }\n })\n\n if (exception) {\n throw exception // re-throw any exceptions caught during rendering\n }\n\n return renderResult\n}\n","import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n ? Symbol.for(\"react.forward_ref\")\n : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n ? Symbol.for(\"react.memo\")\n : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\nexport interface IObserverOptions {\n readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n options: IObserverOptions & { forwardRef: true }\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n baseComponent: React.FunctionComponent<P>,\n options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<\n C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n Options extends IObserverOptions\n>(\n baseComponent: C,\n options?: Options\n): Options extends { forwardRef: true }\n ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n ? C &\n React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n >\n : never /* forwardRef set for a non forwarding component */\n : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n baseComponent:\n | React.ForwardRefRenderFunction<TRef, P>\n | React.FunctionComponent<P>\n | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n // TODO remove in next major\n options?: IObserverOptions\n) {\n if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n warnObserverOptionsDeprecated = false\n console.warn(\n `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n )\n }\n\n if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n throw new Error(\n `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n )\n }\n\n // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n if (isUsingStaticRendering()) {\n return baseComponent\n }\n\n let useForwardRef = options?.forwardRef ?? false\n let render = baseComponent\n\n const baseComponentName = baseComponent.displayName || baseComponent.name\n\n // If already wrapped with forwardRef, unwrap,\n // so we can patch render and apply memo\n if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n useForwardRef = true\n render = baseComponent[\"render\"]\n if (typeof render !== \"function\") {\n throw new Error(\n `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n )\n }\n }\n\n let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n return useObserver(() => render(props, ref), baseComponentName)\n }\n\n // Inherit original name and displayName, see #3438\n ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n if (isFunctionNameConfigurable) {\n Object.defineProperty(observerComponent, \"name\", {\n value: baseComponent.name,\n writable: true,\n configurable: true\n })\n }\n\n // Support legacy context: `contextTypes` must be applied before `memo`\n if ((baseComponent as any).contextTypes) {\n ;(observerComponent as React.FunctionComponent).contextTypes = (\n baseComponent as any\n ).contextTypes\n }\n\n if (useForwardRef) {\n // `forwardRef` must be applied prior `memo`\n // `forwardRef(observer(cmp))` throws:\n // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n observerComponent = forwardRef(observerComponent)\n }\n\n // memo; we are not interested in deep updates\n // in props; we assume that if deep objects are changed,\n // this is in observables, which would have been tracked anyway\n observerComponent = memo(observerComponent)\n\n copyStaticProperties(baseComponent, observerComponent)\n\n if (\"production\" !== process.env.NODE_ENV) {\n Object.defineProperty(observerComponent, \"contextTypes\", {\n set() {\n throw new Error(\n `[mobx-react-lite] \\`${\n this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n }.contextTypes\\` must be set before applying \\`observer\\`.`\n )\n }\n })\n }\n\n return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n $$typeof: true,\n render: true,\n compare: true,\n type: true,\n // Don't redefine `displayName`,\n // it's defined as getter-setter pair on `memo` (see #3192).\n displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n Object.keys(base).forEach(key => {\n if (!hoistBlackList[key]) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n }\n })\n}\n","import { useObserver } from \"./useObserver\"\n\ninterface IObserverProps {\n children?(): React.ReactElement | null\n render?(): React.ReactElement | null\n}\n\nfunction ObserverComponent({ children, render }: IObserverProps) {\n const component = children || render\n if (typeof component !== \"function\") {\n return null\n }\n return useObserver(component)\n}\nif (\"production\" !== process.env.NODE_ENV) {\n ObserverComponent.propTypes = {\n children: ObserverPropsCheck,\n render: ObserverPropsCheck\n }\n}\nObserverComponent.displayName = \"Observer\"\n\nexport { ObserverComponent as Observer }\n\nfunction ObserverPropsCheck(\n props: { [k: string]: any },\n key: string,\n componentName: string,\n location: any,\n propFullName: string\n) {\n const extraKey = key === \"children\" ? \"render\" : \"children\"\n const hasProp = typeof props[key] === \"function\"\n const hasExtraProp = typeof props[extraKey] === \"function\"\n if (hasProp && hasExtraProp) {\n return new Error(\n \"MobX Observer: Do not use children and render in the same time in`\" + componentName\n )\n }\n\n if (hasProp || hasExtraProp) {\n return null\n }\n return new Error(\n \"Invalid prop `\" +\n propFullName +\n \"` of type `\" +\n typeof props[key] +\n \"` supplied to\" +\n \" `\" +\n componentName +\n \"`, expected `function`.\"\n )\n}\n","import { observable, AnnotationsMap } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useLocalObservable<TStore extends Record<string, any>>(\n initializer: () => TStore,\n annotations?: AnnotationsMap<TStore, never>\n): TStore {\n return useState(() => observable(initializer(), annotations, { autoBind: true }))[0]\n}\n","import { useDeprecated } from \"./utils/utils\"\nimport { observable, runInAction } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useAsObservableSource<TSource extends object>(current: TSource): TSource {\n if (\"production\" !== process.env.NODE_ENV)\n useDeprecated(\n \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\"\n )\n // We're deliberately not using idiomatic destructuring for the hook here.\n // Accessing the state value as an array element prevents TypeScript from generating unnecessary helpers in the resulting code.\n // For further details, please refer to mobxjs/mobx#3842.\n const res = useState(() => observable(current, {}, { deep: false }))[0]\n runInAction(() => {\n Object.assign(res, current)\n })\n return res\n}\n","import { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nimport { useDeprecated } from \"./utils/utils\"\nimport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport function useLocalStore<TStore extends Record<string, any>>(initializer: () => TStore): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source: TSource) => TStore,\n current: TSource\n): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source?: TSource) => TStore,\n current?: TSource\n): TStore {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\"\n )\n }\n const source = current && useAsObservableSource(current)\n return useState(() => observable(initializer(source), undefined, { autoBind: true }))[0]\n}\n","import \"./utils/assertEnvironment\"\n\nimport { unstable_batchedUpdates as batch } from \"./utils/reactBatchedUpdates\"\nimport { observerBatching } from \"./utils/observerBatching\"\nimport { useDeprecated } from \"./utils/utils\"\nimport { useObserver as useObserverOriginal } from \"./useObserver\"\nimport { enableStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\nobserverBatching(batch)\n\nexport { isUsingStaticRendering, enableStaticRendering } from \"./staticRendering\"\nexport { observer, IObserverOptions } from \"./observer\"\nexport { Observer } from \"./ObserverComponent\"\nexport { useLocalObservable } from \"./useLocalObservable\"\nexport { useLocalStore } from \"./useLocalStore\"\nexport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport { observerFinalizationRegistry as _observerFinalizationRegistry }\nexport const clearTimers = observerFinalizationRegistry[\"finalizeAllImmediately\"] ?? (() => {})\n\nexport function useObserver<T>(fn: () => T, baseComponentName: string = \"observed\"): T {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`.\"\n )\n }\n return useObserverOriginal(fn, baseComponentName)\n}\n\nexport { isObserverBatched, observerBatching } from \"./utils/observerBatching\"\n\nexport function useStaticRendering(enable: boolean) {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead\"\n )\n }\n enableStaticRendering(enable)\n}\n"],"names":["useState","Error","makeObservable","defaultNoopBatch","callback","observerBatching","reactionScheduler","process","env","NODE_ENV","console","warn","configure","isObserverBatched","deprecatedMessages","useDeprecated","msg","includes","push","printDebugValue","v","getDependencyTree","globalIsUsingStaticRendering","enableStaticRendering","enable","isUsingStaticRendering","REGISTRY_FINALIZE_AFTER","REGISTRY_SWEEP_INTERVAL","TimerBasedFinalizationRegistry","finalize","registrations","Map","sweepTimeout","sweep","maxAge","clearTimeout","_this","undefined","now","Date","forEach","registration","token","registeredAt","value","size","scheduleSweep","finalizeAllImmediately","_proto","prototype","register","target","set","unregister","setTimeout","UniversalFinalizationRegistry","FinalizationRegistry","observerFinalizationRegistry","adm","_adm$reaction","reaction","dispose","createReaction","Reaction","name","stateVersion","Symbol","onStoreChange","useObserver","render","baseComponentName","admRef","React","useRef","current","subscribe","getSnapshot","useDebugValue","useSyncExternalStore","renderResult","exception","track","e","warnObserverOptionsDeprecated","hasSymbol","isFunctionNameConfigurable","_Object$getOwnPropert","_Object$getOwnPropert2","Object","getOwnPropertyDescriptor","configurable","ReactForwardRefSymbol","forwardRef","props","ReactMemoSymbol","memo","observer","baseComponent","options","useForwardRef","_options$forwardRef","displayName","observerComponent","ref","defineProperty","writable","contextTypes","copyStaticProperties","_this$type","type","_this$type2","hoistBlackList","$$typeof","compare","base","keys","key","ObserverComponent","_ref","children","component","propTypes","ObserverPropsCheck","componentName","location","propFullName","extraKey","hasProp","hasExtraProp","useLocalObservable","initializer","annotations","observable","autoBind","useAsObservableSource","res","deep","runInAction","assign","useLocalStore","source","batch","clearTimers","_observerFinalization","fn","useObserverOriginal","useStaticRendering"],"mappings":";;;;AAGA,IAAI,CAACA,QAAQ,EAAE;EACX,MAAM,IAAIC,KAAK,CAAC,mDAAmD,CAAC;;AAExE,IAAI,CAACC,cAAc,EAAE;EACjB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hI,gBAAgB,CAACwI,uBAAK,CAAC;AAEvB,IAQaC,WAAW,IAAAC,qBAAA,GAAGtF,4BAA4B,CAAC,wBAAwB,CAAC,YAAAsF,qBAAA,GAAK,cAAS;AAE/F,SAAgB3E,aAAWA,CAAI4E,EAAW,EAAE1E;MAAAA;IAAAA,oBAA4B,UAAU;;EAC9E,IAAI,YAAY,KAAK/D,OAAO,CAACC,GAAG,CAACC,QAAQ,EAAE;IACvCM,aAAa,CACT,yIAAyI,CAC5I;;EAEL,OAAOkI,WAAmB,CAACD,EAAE,EAAE1E,iBAAiB,CAAC;AACrD;AAEA,SAEgB4E,kBAAkBA,CAAC1H,MAAe;EAC9C,IAAI,YAAY,KAAKjB,OAAO,CAACC,GAAG,CAACC,QAAQ,EAAE;IACvCC,OAAO,CAACC,IAAI,CACR,2FAA2F,CAC9F;;EAELY,qBAAqB,CAACC,MAAM,CAAC;AACjC;;;;"}
\ No newline at end of file
diff --git a/dist/mobxreactlite.esm.production.min.js b/dist/mobxreactlite.esm.production.min.js
index acad14de2bbb34e3e635bfcf5fef2065eec1028f..0969cdd444205b5fae6f586a9ae73320ab8ca58f 100644
--- a/dist/mobxreactlite.esm.production.min.js
+++ b/dist/mobxreactlite.esm.production.min.js
@@ -1,2 +1,2 @@
-import{makeObservable as e,configure as t,getDependencyTree as r,Reaction as n,observable as o,runInAction as i}from"mobx";import a,{useState as u,forwardRef as s,memo as c}from"react";import{unstable_batchedUpdates as f}from"react-dom";import{useSyncExternalStore as l}from"use-sync-external-store/shim";if(!u)throw new Error("mobx-react-lite requires React with Hooks support");if(!e)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function p(e){e()}function m(e){e||(e=p),t({reactionScheduler:e})}var d=function(){return!0};function v(e){return r(e)}var y=!1;function b(e){y=e}function h(){return y}var w,g,S=new("undefined"!=typeof FinalizationRegistry?FinalizationRegistry:function(){function e(e){var t=this;this.finalize=void 0,this.registrations=new Map,this.sweepTimeout=void 0,this.sweep=function(e){void 0===e&&(e=1e4),clearTimeout(t.sweepTimeout),t.sweepTimeout=void 0;var r=Date.now();t.registrations.forEach((function(n,o){r-n.registeredAt>=e&&(t.finalize(n.value),t.registrations.delete(o))})),t.registrations.size>0&&t.scheduleSweep()},this.finalizeAllImmediately=function(){t.sweep(0)},this.finalize=e}var t=e.prototype;return t.register=function(e,t,r){this.registrations.set(r,{value:t,registeredAt:Date.now()}),this.scheduleSweep()},t.unregister=function(e){this.registrations.delete(e)},t.scheduleSweep=function(){void 0===this.sweepTimeout&&(this.sweepTimeout=setTimeout(this.sweep,1e4))},e}())((function(e){var t;null==(t=e.reaction)||t.dispose(),e.reaction=null}));function x(e){e.reaction=new n("observer"+e.name,(function(){e.stateVersion=Symbol(),null==e.onStoreChange||e.onStoreChange()}))}function O(e,t){if(void 0===t&&(t="observed"),h())return e();var r=a.useRef(null);if(!r.current){var n={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return S.unregister(n),n.onStoreChange=e,n.reaction||(x(n),n.stateVersion=Symbol()),function(){var e;n.onStoreChange=null,null==(e=n.reaction)||e.dispose(),n.reaction=null}},getSnapshot:function(){return n.stateVersion}};r.current=n}var o,i,u=r.current;if(u.reaction||(x(u),S.register(r,u,u)),a.useDebugValue(u.reaction,v),l(u.subscribe,u.getSnapshot,u.getSnapshot),u.reaction.track((function(){try{o=e()}catch(e){i=e}})),i)throw i;return o}var T="function"==typeof Symbol&&Symbol.for,$=null!=(w=null==(g=Object.getOwnPropertyDescriptor((function(){}),"name"))?void 0:g.configurable)&&w,z=T?Symbol.for("react.forward_ref"):"function"==typeof s&&s((function(e){return null})).$$typeof,R=T?Symbol.for("react.memo"):"function"==typeof c&&c((function(e){return null})).$$typeof;function j(e,t){var r;if(R&&e.$$typeof===R)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");if(h())return e;var n=null!=(r=null==t?void 0:t.forwardRef)&&r,o=e,i=e.displayName||e.name;if(z&&e.$$typeof===z&&(n=!0,"function"!=typeof(o=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var a,u,f=function(e,t){return O((function(){return o(e,t)}),i)};return f.displayName=e.displayName,$&&Object.defineProperty(f,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(f.contextTypes=e.contextTypes),n&&(f=s(f)),f=c(f),a=e,u=f,Object.keys(a).forEach((function(e){C[e]||Object.defineProperty(u,e,Object.getOwnPropertyDescriptor(a,e))})),f}var E,C={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function D(e){var t=e.children||e.render;return"function"!=typeof t?null:O(t)}function N(e,t){return u((function(){return o(e(),t,{autoBind:!0})}))[0]}function V(e){var t=u((function(){return o(e,{},{deep:!1})}))[0];return i((function(){Object.assign(t,e)})),t}function A(e,t){var r=t&&V(t);return u((function(){return o(e(r),void 0,{autoBind:!0})}))[0]}D.displayName="Observer",m(f);var F=null!=(E=S.finalizeAllImmediately)?E:function(){};function P(e,t){return void 0===t&&(t="observed"),O(e,t)}function k(e){b(e)}export{D as Observer,S as _observerFinalizationRegistry,F as clearTimers,b as enableStaticRendering,d as isObserverBatched,h as isUsingStaticRendering,j as observer,m as observerBatching,V as useAsObservableSource,N as useLocalObservable,A as useLocalStore,P as useObserver,k as useStaticRendering};
+import{makeObservable as e,configure as t,getDependencyTree as r,Reaction as n,observable as o,runInAction as i}from"mobx";import a,{useState as u,forwardRef as s,memo as c}from"react";import{unstable_batchedUpdates as f}from"react-dom";if(!u)throw new Error("mobx-react-lite requires React with Hooks support");if(!e)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function l(e){e()}function p(e){e||(e=l),t({reactionScheduler:e})}var m=function(){return!0};function d(e){return r(e)}var v=!1;function y(e){v=e}function b(){return v}var h,w,g=new("undefined"!=typeof FinalizationRegistry?FinalizationRegistry:function(){function e(e){var t=this;this.finalize=void 0,this.registrations=new Map,this.sweepTimeout=void 0,this.sweep=function(e){void 0===e&&(e=1e4),clearTimeout(t.sweepTimeout),t.sweepTimeout=void 0;var r=Date.now();t.registrations.forEach((function(n,o){r-n.registeredAt>=e&&(t.finalize(n.value),t.registrations.delete(o))})),t.registrations.size>0&&t.scheduleSweep()},this.finalizeAllImmediately=function(){t.sweep(0)},this.finalize=e}var t=e.prototype;return t.register=function(e,t,r){this.registrations.set(r,{value:t,registeredAt:Date.now()}),this.scheduleSweep()},t.unregister=function(e){this.registrations.delete(e)},t.scheduleSweep=function(){void 0===this.sweepTimeout&&(this.sweepTimeout=setTimeout(this.sweep,1e4))},e}())((function(e){var t;null==(t=e.reaction)||t.dispose(),e.reaction=null}));function S(e){e.reaction=new n("observer"+e.name,(function(){e.stateVersion=Symbol(),null==e.onStoreChange||e.onStoreChange()}))}function x(e,t){if(void 0===t&&(t="observed"),b())return e();var r=a.useRef(null);if(!r.current){var n={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return g.unregister(n),n.onStoreChange=e,n.reaction||(S(n),n.stateVersion=Symbol()),function(){var e;n.onStoreChange=null,null==(e=n.reaction)||e.dispose(),n.reaction=null}},getSnapshot:function(){return n.stateVersion}};r.current=n}var o,i,u=r.current;if(u.reaction||(S(u),g.register(r,u,u)),a.useDebugValue(u.reaction,d),a.useSyncExternalStore(u.subscribe,u.getSnapshot,u.getSnapshot),u.reaction.track((function(){try{o=e()}catch(e){i=e}})),i)throw i;return o}var O="function"==typeof Symbol&&Symbol.for,T=null!=(h=null==(w=Object.getOwnPropertyDescriptor((function(){}),"name"))?void 0:w.configurable)&&h,$=O?Symbol.for("react.forward_ref"):"function"==typeof s&&s((function(e){return null})).$$typeof,z=O?Symbol.for("react.memo"):"function"==typeof c&&c((function(e){return null})).$$typeof;function R(e,t){var r;if(z&&e.$$typeof===z)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");if(b())return e;var n=null!=(r=null==t?void 0:t.forwardRef)&&r,o=e,i=e.displayName||e.name;if($&&e.$$typeof===$&&(n=!0,"function"!=typeof(o=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var a,u,f=function(e,t){return x((function(){return o(e,t)}),i)};return f.displayName=e.displayName,T&&Object.defineProperty(f,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(f.contextTypes=e.contextTypes),n&&(f=s(f)),f=c(f),a=e,u=f,Object.keys(a).forEach((function(e){j[e]||Object.defineProperty(u,e,Object.getOwnPropertyDescriptor(a,e))})),f}var E,j={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function C(e){var t=e.children||e.render;return"function"!=typeof t?null:x(t)}function D(e,t){return u((function(){return o(e(),t,{autoBind:!0})}))[0]}function N(e){var t=u((function(){return o(e,{},{deep:!1})}))[0];return i((function(){Object.assign(t,e)})),t}function V(e,t){var r=t&&N(t);return u((function(){return o(e(r),void 0,{autoBind:!0})}))[0]}C.displayName="Observer",p(f);var A=null!=(E=g.finalizeAllImmediately)?E:function(){};function F(e,t){return void 0===t&&(t="observed"),x(e,t)}function P(e){y(e)}export{C as Observer,g as _observerFinalizationRegistry,A as clearTimers,y as enableStaticRendering,m as isObserverBatched,b as isUsingStaticRendering,R as observer,p as observerBatching,N as useAsObservableSource,D as useLocalObservable,V as useLocalStore,F as useObserver,P as useStaticRendering};
//# sourceMappingURL=mobxreactlite.esm.production.min.js.map
diff --git a/dist/mobxreactlite.esm.production.min.js.map b/dist/mobxreactlite.esm.production.min.js.map
index 19526ec83722d50e3ae029cf2cb8d58f3e98b059..96f95819637c0bd145990583ba9b7f875ab78a4a 100644
--- a/dist/mobxreactlite.esm.production.min.js.map
+++ b/dist/mobxreactlite.esm.production.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"mobxreactlite.esm.production.min.js","sources":["../src/utils/assertEnvironment.ts","../src/utils/observerBatching.ts","../src/utils/printDebugValue.ts","../src/staticRendering.ts","../src/utils/UniversalFinalizationRegistry.ts","../src/utils/observerFinalizationRegistry.ts","../src/useObserver.ts","../src/observer.ts","../src/ObserverComponent.ts","../src/useLocalObservable.ts","../src/useAsObservableSource.ts","../src/useLocalStore.ts","../src/index.ts"],"sourcesContent":["import { makeObservable } from \"mobx\"\nimport { useState } from \"react\"\n\nif (!useState) {\n throw new Error(\"mobx-react-lite requires React with Hooks support\")\n}\nif (!makeObservable) {\n throw new Error(\"mobx-react-lite@3 requires mobx at least version 6 to be available\")\n}\n","import { configure } from \"mobx\"\n\nexport function defaultNoopBatch(callback: () => void) {\n callback()\n}\n\nexport function observerBatching(reactionScheduler: any) {\n if (!reactionScheduler) {\n reactionScheduler = defaultNoopBatch\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[MobX] Failed to get unstable_batched updates from react-dom / react-native\"\n )\n }\n }\n configure({ reactionScheduler })\n}\n\nexport const isObserverBatched = () => {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\"[MobX] Deprecated\")\n }\n\n return true\n}\n","import { getDependencyTree, Reaction } from \"mobx\"\n\nexport function printDebugValue(v: Reaction) {\n return getDependencyTree(v)\n}\n","let globalIsUsingStaticRendering = false\n\nexport function enableStaticRendering(enable: boolean) {\n globalIsUsingStaticRendering = enable\n}\n\nexport function isUsingStaticRendering(): boolean {\n return globalIsUsingStaticRendering\n}\n","export declare class FinalizationRegistryType<T> {\n constructor(finalize: (value: T) => void)\n register(target: object, value: T, token?: object): void\n unregister(token: object): void\n}\n\ndeclare const FinalizationRegistry: typeof FinalizationRegistryType | undefined\n\nexport const REGISTRY_FINALIZE_AFTER = 10_000\nexport const REGISTRY_SWEEP_INTERVAL = 10_000\n\nexport class TimerBasedFinalizationRegistry<T> implements FinalizationRegistryType<T> {\n private registrations: Map<unknown, { value: T; registeredAt: number }> = new Map()\n private sweepTimeout: ReturnType<typeof setTimeout> | undefined\n\n constructor(private readonly finalize: (value: T) => void) {}\n\n // Token is actually required with this impl\n register(target: object, value: T, token?: object) {\n this.registrations.set(token, {\n value,\n registeredAt: Date.now()\n })\n this.scheduleSweep()\n }\n\n unregister(token: unknown) {\n this.registrations.delete(token)\n }\n\n // Bound so it can be used directly as setTimeout callback.\n sweep = (maxAge = REGISTRY_FINALIZE_AFTER) => {\n // cancel timeout so we can force sweep anytime\n clearTimeout(this.sweepTimeout)\n this.sweepTimeout = undefined\n\n const now = Date.now()\n this.registrations.forEach((registration, token) => {\n if (now - registration.registeredAt >= maxAge) {\n this.finalize(registration.value)\n this.registrations.delete(token)\n }\n })\n\n if (this.registrations.size > 0) {\n this.scheduleSweep()\n }\n }\n\n // Bound so it can be exported directly as clearTimers test utility.\n finalizeAllImmediately = () => {\n this.sweep(0)\n }\n\n private scheduleSweep() {\n if (this.sweepTimeout === undefined) {\n this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL)\n }\n }\n}\n\nexport const UniversalFinalizationRegistry =\n typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : TimerBasedFinalizationRegistry\n","import { Reaction } from \"mobx\"\nimport { UniversalFinalizationRegistry } from \"./UniversalFinalizationRegistry\"\n\nexport const observerFinalizationRegistry = new UniversalFinalizationRegistry(\n (adm: { reaction: Reaction | null }) => {\n adm.reaction?.dispose()\n adm.reaction = null\n }\n)\n","import { Reaction } from \"mobx\"\nimport React from \"react\"\nimport { printDebugValue } from \"./utils/printDebugValue\"\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\nimport { useSyncExternalStore } from \"use-sync-external-store/shim\"\n\n// Do not store `admRef` (even as part of a closure!) on this object,\n// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.\ntype ObserverAdministration = {\n reaction: Reaction | null // also serves as disposed flag\n onStoreChange: Function | null // also serves as mounted flag\n // stateVersion that 'ticks' for every time the reaction fires\n // tearing is still present,\n // because there is no cross component synchronization,\n // but we can use `useSyncExternalStore` API.\n // TODO: optimize to use number?\n stateVersion: any\n name: string\n // These don't depend on state/props, therefore we can keep them here instead of `useCallback`\n subscribe: Parameters<typeof React.useSyncExternalStore>[0]\n getSnapshot: Parameters<typeof React.useSyncExternalStore>[1]\n}\n\nfunction createReaction(adm: ObserverAdministration) {\n adm.reaction = new Reaction(`observer${adm.name}`, () => {\n adm.stateVersion = Symbol()\n // onStoreChange won't be available until the component \"mounts\".\n // If state changes in between initial render and mount,\n // `useSyncExternalStore` should handle that by checking the state version and issuing update.\n adm.onStoreChange?.()\n })\n}\n\nexport function useObserver<T>(render: () => T, baseComponentName: string = \"observed\"): T {\n if (isUsingStaticRendering()) {\n return render()\n }\n\n const admRef = React.useRef<ObserverAdministration | null>(null)\n\n if (!admRef.current) {\n // First render\n const adm: ObserverAdministration = {\n reaction: null,\n onStoreChange: null,\n stateVersion: Symbol(),\n name: baseComponentName,\n subscribe(onStoreChange: () => void) {\n // Do NOT access admRef here!\n observerFinalizationRegistry.unregister(adm)\n adm.onStoreChange = onStoreChange\n if (!adm.reaction) {\n // We've lost our reaction and therefore all subscriptions, occurs when:\n // 1. Timer based finalization registry disposed reaction before component mounted.\n // 2. React \"re-mounts\" same component without calling render in between (typically <StrictMode>).\n // We have to recreate reaction and schedule re-render to recreate subscriptions,\n // even if state did not change.\n createReaction(adm)\n // `onStoreChange` won't force update if subsequent `getSnapshot` returns same value.\n // So we make sure that is not the case\n adm.stateVersion = Symbol()\n }\n\n return () => {\n // Do NOT access admRef here!\n adm.onStoreChange = null\n adm.reaction?.dispose()\n adm.reaction = null\n }\n },\n getSnapshot() {\n // Do NOT access admRef here!\n return adm.stateVersion\n }\n }\n\n admRef.current = adm\n }\n\n const adm = admRef.current!\n\n if (!adm.reaction) {\n // First render or reaction was disposed by registry before subscribe\n createReaction(adm)\n // StrictMode/ConcurrentMode/Suspense may mean that our component is\n // rendered and abandoned multiple times, so we need to track leaked\n // Reactions.\n observerFinalizationRegistry.register(admRef, adm, adm)\n }\n\n React.useDebugValue(adm.reaction!, printDebugValue)\n\n useSyncExternalStore(\n // Both of these must be stable, otherwise it would keep resubscribing every render.\n adm.subscribe,\n adm.getSnapshot,\n adm.getSnapshot\n )\n\n // render the original component, but have the\n // reaction track the observables, so that rendering\n // can be invalidated (see above) once a dependency changes\n let renderResult!: T\n let exception\n adm.reaction!.track(() => {\n try {\n renderResult = render()\n } catch (e) {\n exception = e\n }\n })\n\n if (exception) {\n throw exception // re-throw any exceptions caught during rendering\n }\n\n return renderResult\n}\n","import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n ? Symbol.for(\"react.forward_ref\")\n : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n ? Symbol.for(\"react.memo\")\n : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\nexport interface IObserverOptions {\n readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n options: IObserverOptions & { forwardRef: true }\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n baseComponent: React.FunctionComponent<P>,\n options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<\n C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n Options extends IObserverOptions\n>(\n baseComponent: C,\n options?: Options\n): Options extends { forwardRef: true }\n ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n ? C &\n React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n >\n : never /* forwardRef set for a non forwarding component */\n : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n baseComponent:\n | React.ForwardRefRenderFunction<TRef, P>\n | React.FunctionComponent<P>\n | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n // TODO remove in next major\n options?: IObserverOptions\n) {\n if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n warnObserverOptionsDeprecated = false\n console.warn(\n `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n )\n }\n\n if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n throw new Error(\n `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n )\n }\n\n // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n if (isUsingStaticRendering()) {\n return baseComponent\n }\n\n let useForwardRef = options?.forwardRef ?? false\n let render = baseComponent\n\n const baseComponentName = baseComponent.displayName || baseComponent.name\n\n // If already wrapped with forwardRef, unwrap,\n // so we can patch render and apply memo\n if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n useForwardRef = true\n render = baseComponent[\"render\"]\n if (typeof render !== \"function\") {\n throw new Error(\n `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n )\n }\n }\n\n let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n return useObserver(() => render(props, ref), baseComponentName)\n }\n\n // Inherit original name and displayName, see #3438\n ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n if (isFunctionNameConfigurable) {\n Object.defineProperty(observerComponent, \"name\", {\n value: baseComponent.name,\n writable: true,\n configurable: true\n })\n }\n\n // Support legacy context: `contextTypes` must be applied before `memo`\n if ((baseComponent as any).contextTypes) {\n ;(observerComponent as React.FunctionComponent).contextTypes = (\n baseComponent as any\n ).contextTypes\n }\n\n if (useForwardRef) {\n // `forwardRef` must be applied prior `memo`\n // `forwardRef(observer(cmp))` throws:\n // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n observerComponent = forwardRef(observerComponent)\n }\n\n // memo; we are not interested in deep updates\n // in props; we assume that if deep objects are changed,\n // this is in observables, which would have been tracked anyway\n observerComponent = memo(observerComponent)\n\n copyStaticProperties(baseComponent, observerComponent)\n\n if (\"production\" !== process.env.NODE_ENV) {\n Object.defineProperty(observerComponent, \"contextTypes\", {\n set() {\n throw new Error(\n `[mobx-react-lite] \\`${\n this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n }.contextTypes\\` must be set before applying \\`observer\\`.`\n )\n }\n })\n }\n\n return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n $$typeof: true,\n render: true,\n compare: true,\n type: true,\n // Don't redefine `displayName`,\n // it's defined as getter-setter pair on `memo` (see #3192).\n displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n Object.keys(base).forEach(key => {\n if (!hoistBlackList[key]) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n }\n })\n}\n","import { useObserver } from \"./useObserver\"\n\ninterface IObserverProps {\n children?(): React.ReactElement | null\n render?(): React.ReactElement | null\n}\n\nfunction ObserverComponent({ children, render }: IObserverProps) {\n const component = children || render\n if (typeof component !== \"function\") {\n return null\n }\n return useObserver(component)\n}\nif (\"production\" !== process.env.NODE_ENV) {\n ObserverComponent.propTypes = {\n children: ObserverPropsCheck,\n render: ObserverPropsCheck\n }\n}\nObserverComponent.displayName = \"Observer\"\n\nexport { ObserverComponent as Observer }\n\nfunction ObserverPropsCheck(\n props: { [k: string]: any },\n key: string,\n componentName: string,\n location: any,\n propFullName: string\n) {\n const extraKey = key === \"children\" ? \"render\" : \"children\"\n const hasProp = typeof props[key] === \"function\"\n const hasExtraProp = typeof props[extraKey] === \"function\"\n if (hasProp && hasExtraProp) {\n return new Error(\n \"MobX Observer: Do not use children and render in the same time in`\" + componentName\n )\n }\n\n if (hasProp || hasExtraProp) {\n return null\n }\n return new Error(\n \"Invalid prop `\" +\n propFullName +\n \"` of type `\" +\n typeof props[key] +\n \"` supplied to\" +\n \" `\" +\n componentName +\n \"`, expected `function`.\"\n )\n}\n","import { observable, AnnotationsMap } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useLocalObservable<TStore extends Record<string, any>>(\n initializer: () => TStore,\n annotations?: AnnotationsMap<TStore, never>\n): TStore {\n return useState(() => observable(initializer(), annotations, { autoBind: true }))[0]\n}\n","import { useDeprecated } from \"./utils/utils\"\nimport { observable, runInAction } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useAsObservableSource<TSource extends object>(current: TSource): TSource {\n if (\"production\" !== process.env.NODE_ENV)\n useDeprecated(\n \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\"\n )\n // We're deliberately not using idiomatic destructuring for the hook here.\n // Accessing the state value as an array element prevents TypeScript from generating unnecessary helpers in the resulting code.\n // For further details, please refer to mobxjs/mobx#3842.\n const res = useState(() => observable(current, {}, { deep: false }))[0]\n runInAction(() => {\n Object.assign(res, current)\n })\n return res\n}\n","import { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nimport { useDeprecated } from \"./utils/utils\"\nimport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport function useLocalStore<TStore extends Record<string, any>>(initializer: () => TStore): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source: TSource) => TStore,\n current: TSource\n): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source?: TSource) => TStore,\n current?: TSource\n): TStore {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\"\n )\n }\n const source = current && useAsObservableSource(current)\n return useState(() => observable(initializer(source), undefined, { autoBind: true }))[0]\n}\n","import \"./utils/assertEnvironment\"\n\nimport { unstable_batchedUpdates as batch } from \"./utils/reactBatchedUpdates\"\nimport { observerBatching } from \"./utils/observerBatching\"\nimport { useDeprecated } from \"./utils/utils\"\nimport { useObserver as useObserverOriginal } from \"./useObserver\"\nimport { enableStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\nobserverBatching(batch)\n\nexport { isUsingStaticRendering, enableStaticRendering } from \"./staticRendering\"\nexport { observer, IObserverOptions } from \"./observer\"\nexport { Observer } from \"./ObserverComponent\"\nexport { useLocalObservable } from \"./useLocalObservable\"\nexport { useLocalStore } from \"./useLocalStore\"\nexport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport { observerFinalizationRegistry as _observerFinalizationRegistry }\nexport const clearTimers = observerFinalizationRegistry[\"finalizeAllImmediately\"] ?? (() => {})\n\nexport function useObserver<T>(fn: () => T, baseComponentName: string = \"observed\"): T {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`.\"\n )\n }\n return useObserverOriginal(fn, baseComponentName)\n}\n\nexport { isObserverBatched, observerBatching } from \"./utils/observerBatching\"\n\nexport function useStaticRendering(enable: boolean) {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead\"\n )\n }\n enableStaticRendering(enable)\n}\n"],"names":["useState","Error","makeObservable","defaultNoopBatch","callback","observerBatching","reactionScheduler","configure","isObserverBatched","printDebugValue","v","getDependencyTree","globalIsUsingStaticRendering","enableStaticRendering","enable","isUsingStaticRendering","observerFinalizationRegistry","FinalizationRegistry","TimerBasedFinalizationRegistry","finalize","registrations","Map","this","sweepTimeout","sweep","maxAge","clearTimeout","_this","undefined","now","Date","forEach","registration","token","registeredAt","value","size","scheduleSweep","finalizeAllImmediately","_proto","prototype","register","target","set","unregister","setTimeout","adm","_adm$reaction","reaction","dispose","createReaction","Reaction","name","stateVersion","Symbol","onStoreChange","useObserver","render","baseComponentName","admRef","React","useRef","current","subscribe","getSnapshot","renderResult","exception","useDebugValue","useSyncExternalStore","track","e","hasSymbol","isFunctionNameConfigurable","_Object$getOwnPropert","_Object$getOwnPropert2","Object","getOwnPropertyDescriptor","configurable","ReactForwardRefSymbol","forwardRef","props","ReactMemoSymbol","memo","observer","baseComponent","options","useForwardRef","_options$forwardRef","displayName","base","observerComponent","ref","defineProperty","writable","contextTypes","keys","key","hoistBlackList","$$typeof","compare","type","ObserverComponent","_ref","component","children","useLocalObservable","initializer","annotations","observable","autoBind","useAsObservableSource","res","deep","runInAction","assign","useLocalStore","source","batch","clearTimers","_observerFinalization","fn","useObserverOriginal","useStaticRendering"],"mappings":"iTAGA,IAAKA,EACD,MAAM,IAAIC,MAAM,qDAEpB,IAAKC,EACD,MAAM,IAAID,MAAM,+ECLJE,EAAiBC,GAC7BA,aAGYC,EAAiBC,GACxBA,IACDA,EAAoBH,GAOxBI,EAAU,CAAED,kBAAAA,QAGHE,EAAoB,WAK7B,OAAO,YCrBKC,EAAgBC,GAC5B,OAAOC,EAAkBD,GCH7B,IAAIE,GAA+B,WAEnBC,EAAsBC,GAClCF,EAA+BE,EAGnC,SAAgBC,IACZ,OAAOH,ECCJ,QCLMI,EAA+B,ID2DR,oBAAzBC,qBACDA,gCAhDN,SAAAC,EAA6BC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"}
\ No newline at end of file
+{"version":3,"file":"mobxreactlite.esm.production.min.js","sources":["../src/utils/assertEnvironment.ts","../src/utils/observerBatching.ts","../src/utils/printDebugValue.ts","../src/staticRendering.ts","../src/utils/UniversalFinalizationRegistry.ts","../src/utils/observerFinalizationRegistry.ts","../src/useObserver.ts","../src/observer.ts","../src/ObserverComponent.ts","../src/useLocalObservable.ts","../src/useAsObservableSource.ts","../src/useLocalStore.ts","../src/index.ts"],"sourcesContent":["import { makeObservable } from \"mobx\"\nimport { useState } from \"react\"\n\nif (!useState) {\n throw new Error(\"mobx-react-lite requires React with Hooks support\")\n}\nif (!makeObservable) {\n throw new Error(\"mobx-react-lite@3 requires mobx at least version 6 to be available\")\n}\n","import { configure } from \"mobx\"\n\nexport function defaultNoopBatch(callback: () => void) {\n callback()\n}\n\nexport function observerBatching(reactionScheduler: any) {\n if (!reactionScheduler) {\n reactionScheduler = defaultNoopBatch\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[MobX] Failed to get unstable_batched updates from react-dom / react-native\"\n )\n }\n }\n configure({ reactionScheduler })\n}\n\nexport const isObserverBatched = () => {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\"[MobX] Deprecated\")\n }\n\n return true\n}\n","import { getDependencyTree, Reaction } from \"mobx\"\n\nexport function printDebugValue(v: Reaction) {\n return getDependencyTree(v)\n}\n","let globalIsUsingStaticRendering = false\n\nexport function enableStaticRendering(enable: boolean) {\n globalIsUsingStaticRendering = enable\n}\n\nexport function isUsingStaticRendering(): boolean {\n return globalIsUsingStaticRendering\n}\n","export declare class FinalizationRegistryType<T> {\n constructor(finalize: (value: T) => void)\n register(target: object, value: T, token?: object): void\n unregister(token: object): void\n}\n\ndeclare const FinalizationRegistry: typeof FinalizationRegistryType | undefined\n\nexport const REGISTRY_FINALIZE_AFTER = 10_000\nexport const REGISTRY_SWEEP_INTERVAL = 10_000\n\nexport class TimerBasedFinalizationRegistry<T> implements FinalizationRegistryType<T> {\n private registrations: Map<unknown, { value: T; registeredAt: number }> = new Map()\n private sweepTimeout: ReturnType<typeof setTimeout> | undefined\n\n constructor(private readonly finalize: (value: T) => void) {}\n\n // Token is actually required with this impl\n register(target: object, value: T, token?: object) {\n this.registrations.set(token, {\n value,\n registeredAt: Date.now()\n })\n this.scheduleSweep()\n }\n\n unregister(token: unknown) {\n this.registrations.delete(token)\n }\n\n // Bound so it can be used directly as setTimeout callback.\n sweep = (maxAge = REGISTRY_FINALIZE_AFTER) => {\n // cancel timeout so we can force sweep anytime\n clearTimeout(this.sweepTimeout)\n this.sweepTimeout = undefined\n\n const now = Date.now()\n this.registrations.forEach((registration, token) => {\n if (now - registration.registeredAt >= maxAge) {\n this.finalize(registration.value)\n this.registrations.delete(token)\n }\n })\n\n if (this.registrations.size > 0) {\n this.scheduleSweep()\n }\n }\n\n // Bound so it can be exported directly as clearTimers test utility.\n finalizeAllImmediately = () => {\n this.sweep(0)\n }\n\n private scheduleSweep() {\n if (this.sweepTimeout === undefined) {\n this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL)\n }\n }\n}\n\nexport const UniversalFinalizationRegistry =\n typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : TimerBasedFinalizationRegistry\n","import { Reaction } from \"mobx\"\nimport { UniversalFinalizationRegistry } from \"./UniversalFinalizationRegistry\"\n\nexport const observerFinalizationRegistry = new UniversalFinalizationRegistry(\n (adm: { reaction: Reaction | null }) => {\n adm.reaction?.dispose()\n adm.reaction = null\n }\n)\n","import { Reaction } from \"mobx\"\nimport React from \"react\"\nimport { printDebugValue } from \"./utils/printDebugValue\"\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\n// Do not store `admRef` (even as part of a closure!) on this object,\n// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.\ntype ObserverAdministration = {\n reaction: Reaction | null // also serves as disposed flag\n onStoreChange: Function | null // also serves as mounted flag\n // stateVersion that 'ticks' for every time the reaction fires\n // tearing is still present,\n // because there is no cross component synchronization,\n // but we can use `useSyncExternalStore` API.\n // TODO: optimize to use number?\n stateVersion: any\n name: string\n // These don't depend on state/props, therefore we can keep them here instead of `useCallback`\n subscribe: Parameters<typeof React.useSyncExternalStore>[0]\n getSnapshot: Parameters<typeof React.useSyncExternalStore>[1]\n}\n\nfunction createReaction(adm: ObserverAdministration) {\n adm.reaction = new Reaction(`observer${adm.name}`, () => {\n adm.stateVersion = Symbol()\n // onStoreChange won't be available until the component \"mounts\".\n // If state changes in between initial render and mount,\n // `useSyncExternalStore` should handle that by checking the state version and issuing update.\n adm.onStoreChange?.()\n })\n}\n\nexport function useObserver<T>(render: () => T, baseComponentName: string = \"observed\"): T {\n if (isUsingStaticRendering()) {\n return render()\n }\n\n const admRef = React.useRef<ObserverAdministration | null>(null)\n\n if (!admRef.current) {\n // First render\n const adm: ObserverAdministration = {\n reaction: null,\n onStoreChange: null,\n stateVersion: Symbol(),\n name: baseComponentName,\n subscribe(onStoreChange: () => void) {\n // Do NOT access admRef here!\n observerFinalizationRegistry.unregister(adm)\n adm.onStoreChange = onStoreChange\n if (!adm.reaction) {\n // We've lost our reaction and therefore all subscriptions, occurs when:\n // 1. Timer based finalization registry disposed reaction before component mounted.\n // 2. React \"re-mounts\" same component without calling render in between (typically <StrictMode>).\n // We have to recreate reaction and schedule re-render to recreate subscriptions,\n // even if state did not change.\n createReaction(adm)\n // `onStoreChange` won't force update if subsequent `getSnapshot` returns same value.\n // So we make sure that is not the case\n adm.stateVersion = Symbol()\n }\n\n return () => {\n // Do NOT access admRef here!\n adm.onStoreChange = null\n adm.reaction?.dispose()\n adm.reaction = null\n }\n },\n getSnapshot() {\n // Do NOT access admRef here!\n return adm.stateVersion\n }\n }\n\n admRef.current = adm\n }\n\n const adm = admRef.current!\n\n if (!adm.reaction) {\n // First render or reaction was disposed by registry before subscribe\n createReaction(adm)\n // StrictMode/ConcurrentMode/Suspense may mean that our component is\n // rendered and abandoned multiple times, so we need to track leaked\n // Reactions.\n observerFinalizationRegistry.register(admRef, adm, adm)\n }\n\n React.useDebugValue(adm.reaction!, printDebugValue)\n\n React.useSyncExternalStore(\n // Both of these must be stable, otherwise it would keep resubscribing every render.\n adm.subscribe,\n adm.getSnapshot,\n adm.getSnapshot\n )\n\n // render the original component, but have the\n // reaction track the observables, so that rendering\n // can be invalidated (see above) once a dependency changes\n let renderResult!: T\n let exception\n adm.reaction!.track(() => {\n try {\n renderResult = render()\n } catch (e) {\n exception = e\n }\n })\n\n if (exception) {\n throw exception // re-throw any exceptions caught during rendering\n }\n\n return renderResult\n}\n","import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n ? Symbol.for(\"react.forward_ref\")\n : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n ? Symbol.for(\"react.memo\")\n : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\nexport interface IObserverOptions {\n readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n options: IObserverOptions & { forwardRef: true }\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n baseComponent: React.FunctionComponent<P>,\n options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<\n C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n Options extends IObserverOptions\n>(\n baseComponent: C,\n options?: Options\n): Options extends { forwardRef: true }\n ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n ? C &\n React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n >\n : never /* forwardRef set for a non forwarding component */\n : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n baseComponent:\n | React.ForwardRefRenderFunction<TRef, P>\n | React.FunctionComponent<P>\n | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n // TODO remove in next major\n options?: IObserverOptions\n) {\n if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n warnObserverOptionsDeprecated = false\n console.warn(\n `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n )\n }\n\n if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n throw new Error(\n `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n )\n }\n\n // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n if (isUsingStaticRendering()) {\n return baseComponent\n }\n\n let useForwardRef = options?.forwardRef ?? false\n let render = baseComponent\n\n const baseComponentName = baseComponent.displayName || baseComponent.name\n\n // If already wrapped with forwardRef, unwrap,\n // so we can patch render and apply memo\n if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n useForwardRef = true\n render = baseComponent[\"render\"]\n if (typeof render !== \"function\") {\n throw new Error(\n `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n )\n }\n }\n\n let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n return useObserver(() => render(props, ref), baseComponentName)\n }\n\n // Inherit original name and displayName, see #3438\n ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n if (isFunctionNameConfigurable) {\n Object.defineProperty(observerComponent, \"name\", {\n value: baseComponent.name,\n writable: true,\n configurable: true\n })\n }\n\n // Support legacy context: `contextTypes` must be applied before `memo`\n if ((baseComponent as any).contextTypes) {\n ;(observerComponent as React.FunctionComponent).contextTypes = (\n baseComponent as any\n ).contextTypes\n }\n\n if (useForwardRef) {\n // `forwardRef` must be applied prior `memo`\n // `forwardRef(observer(cmp))` throws:\n // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n observerComponent = forwardRef(observerComponent)\n }\n\n // memo; we are not interested in deep updates\n // in props; we assume that if deep objects are changed,\n // this is in observables, which would have been tracked anyway\n observerComponent = memo(observerComponent)\n\n copyStaticProperties(baseComponent, observerComponent)\n\n if (\"production\" !== process.env.NODE_ENV) {\n Object.defineProperty(observerComponent, \"contextTypes\", {\n set() {\n throw new Error(\n `[mobx-react-lite] \\`${\n this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n }.contextTypes\\` must be set before applying \\`observer\\`.`\n )\n }\n })\n }\n\n return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n $$typeof: true,\n render: true,\n compare: true,\n type: true,\n // Don't redefine `displayName`,\n // it's defined as getter-setter pair on `memo` (see #3192).\n displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n Object.keys(base).forEach(key => {\n if (!hoistBlackList[key]) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n }\n })\n}\n","import { useObserver } from \"./useObserver\"\n\ninterface IObserverProps {\n children?(): React.ReactElement | null\n render?(): React.ReactElement | null\n}\n\nfunction ObserverComponent({ children, render }: IObserverProps) {\n const component = children || render\n if (typeof component !== \"function\") {\n return null\n }\n return useObserver(component)\n}\nif (\"production\" !== process.env.NODE_ENV) {\n ObserverComponent.propTypes = {\n children: ObserverPropsCheck,\n render: ObserverPropsCheck\n }\n}\nObserverComponent.displayName = \"Observer\"\n\nexport { ObserverComponent as Observer }\n\nfunction ObserverPropsCheck(\n props: { [k: string]: any },\n key: string,\n componentName: string,\n location: any,\n propFullName: string\n) {\n const extraKey = key === \"children\" ? \"render\" : \"children\"\n const hasProp = typeof props[key] === \"function\"\n const hasExtraProp = typeof props[extraKey] === \"function\"\n if (hasProp && hasExtraProp) {\n return new Error(\n \"MobX Observer: Do not use children and render in the same time in`\" + componentName\n )\n }\n\n if (hasProp || hasExtraProp) {\n return null\n }\n return new Error(\n \"Invalid prop `\" +\n propFullName +\n \"` of type `\" +\n typeof props[key] +\n \"` supplied to\" +\n \" `\" +\n componentName +\n \"`, expected `function`.\"\n )\n}\n","import { observable, AnnotationsMap } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useLocalObservable<TStore extends Record<string, any>>(\n initializer: () => TStore,\n annotations?: AnnotationsMap<TStore, never>\n): TStore {\n return useState(() => observable(initializer(), annotations, { autoBind: true }))[0]\n}\n","import { useDeprecated } from \"./utils/utils\"\nimport { observable, runInAction } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useAsObservableSource<TSource extends object>(current: TSource): TSource {\n if (\"production\" !== process.env.NODE_ENV)\n useDeprecated(\n \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\"\n )\n // We're deliberately not using idiomatic destructuring for the hook here.\n // Accessing the state value as an array element prevents TypeScript from generating unnecessary helpers in the resulting code.\n // For further details, please refer to mobxjs/mobx#3842.\n const res = useState(() => observable(current, {}, { deep: false }))[0]\n runInAction(() => {\n Object.assign(res, current)\n })\n return res\n}\n","import { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nimport { useDeprecated } from \"./utils/utils\"\nimport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport function useLocalStore<TStore extends Record<string, any>>(initializer: () => TStore): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source: TSource) => TStore,\n current: TSource\n): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source?: TSource) => TStore,\n current?: TSource\n): TStore {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\"\n )\n }\n const source = current && useAsObservableSource(current)\n return useState(() => observable(initializer(source), undefined, { autoBind: true }))[0]\n}\n","import \"./utils/assertEnvironment\"\n\nimport { unstable_batchedUpdates as batch } from \"./utils/reactBatchedUpdates\"\nimport { observerBatching } from \"./utils/observerBatching\"\nimport { useDeprecated } from \"./utils/utils\"\nimport { useObserver as useObserverOriginal } from \"./useObserver\"\nimport { enableStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\nobserverBatching(batch)\n\nexport { isUsingStaticRendering, enableStaticRendering } from \"./staticRendering\"\nexport { observer, IObserverOptions } from \"./observer\"\nexport { Observer } from \"./ObserverComponent\"\nexport { useLocalObservable } from \"./useLocalObservable\"\nexport { useLocalStore } from \"./useLocalStore\"\nexport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport { observerFinalizationRegistry as _observerFinalizationRegistry }\nexport const clearTimers = observerFinalizationRegistry[\"finalizeAllImmediately\"] ?? (() => {})\n\nexport function useObserver<T>(fn: () => T, baseComponentName: string = \"observed\"): T {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`.\"\n )\n }\n return useObserverOriginal(fn, baseComponentName)\n}\n\nexport { isObserverBatched, observerBatching } from \"./utils/observerBatching\"\n\nexport function useStaticRendering(enable: boolean) {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead\"\n )\n }\n enableStaticRendering(enable)\n}\n"],"names":["useState","Error","makeObservable","defaultNoopBatch","callback","observerBatching","reactionScheduler","configure","isObserverBatched","printDebugValue","v","getDependencyTree","globalIsUsingStaticRendering","enableStaticRendering","enable","isUsingStaticRendering","observerFinalizationRegistry","FinalizationRegistry","TimerBasedFinalizationRegistry","finalize","registrations","Map","this","sweepTimeout","sweep","maxAge","clearTimeout","_this","undefined","now","Date","forEach","registration","token","registeredAt","value","size","scheduleSweep","finalizeAllImmediately","_proto","prototype","register","target","set","unregister","setTimeout","adm","_adm$reaction","reaction","dispose","createReaction","Reaction","name","stateVersion","Symbol","onStoreChange","useObserver","render","baseComponentName","admRef","React","useRef","current","subscribe","getSnapshot","renderResult","exception","useDebugValue","useSyncExternalStore","track","e","hasSymbol","isFunctionNameConfigurable","_Object$getOwnPropert","_Object$getOwnPropert2","Object","getOwnPropertyDescriptor","configurable","ReactForwardRefSymbol","forwardRef","props","ReactMemoSymbol","memo","observer","baseComponent","options","useForwardRef","_options$forwardRef","displayName","base","observerComponent","ref","defineProperty","writable","contextTypes","keys","key","hoistBlackList","$$typeof","compare","type","ObserverComponent","_ref","component","children","useLocalObservable","initializer","annotations","observable","autoBind","useAsObservableSource","res","deep","runInAction","assign","useLocalStore","source","batch","clearTimers","_observerFinalization","fn","useObserverOriginal","useStaticRendering"],"mappings":"6OAGA,IAAKA,EACD,MAAM,IAAIC,MAAM,qDAEpB,IAAKC,EACD,MAAM,IAAID,MAAM,+ECLJE,EAAiBC,GAC7BA,aAGYC,EAAiBC,GACxBA,IACDA,EAAoBH,GAOxBI,EAAU,CAAED,kBAAAA,QAGHE,EAAoB,WAK7B,OAAO,YCrBKC,EAAgBC,GAC5B,OAAOC,EAAkBD,GCH7B,IAAIE,GAA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GvG,EAAqD,wBAACuG,EAAK,sBAEtE/D,EAAegE,EAAa9D,GAMxC,gBANwCA,IAAAA,EAA4B,YAM7D+D,EAAoBD,EAAI9D,YAKnBgE,EAAmB5G,GAM/BD,EAAsBC"}
\ No newline at end of file
diff --git a/dist/mobxreactlite.umd.development.js b/dist/mobxreactlite.umd.development.js
index dc582a2ee356fdf4920e6081794e95544bd22b79..655729eeeb3663b275d9eba4d89c4383eed847e2 100644
--- a/dist/mobxreactlite.umd.development.js
+++ b/dist/mobxreactlite.umd.development.js
@@ -1,8 +1,8 @@
(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('mobx'), require('react'), require('react-dom'), require('use-sync-external-store/shim')) :
- typeof define === 'function' && define.amd ? define(['exports', 'mobx', 'react', 'react-dom', 'use-sync-external-store/shim'], factory) :
- (global = global || self, factory(global.mobxReactLite = {}, global.mobx, global.React, global.ReactDOM, global.shim));
-}(this, (function (exports, mobx, React, reactDom, shim) { 'use strict';
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('mobx'), require('react'), require('react-dom')) :
+ typeof define === 'function' && define.amd ? define(['exports', 'mobx', 'react', 'react-dom'], factory) :
+ (global = global || self, factory(global.mobxReactLite = {}, global.mobx, global.React, global.ReactDOM));
+}(this, (function (exports, mobx, React, reactDom) { 'use strict';
var React__default = 'default' in React ? React['default'] : React;
@@ -178,7 +178,7 @@
observerFinalizationRegistry.register(admRef, adm, adm);
}
React__default.useDebugValue(adm.reaction, printDebugValue);
- shim.useSyncExternalStore(
+ React__default.useSyncExternalStore(
// Both of these must be stable, otherwise it would keep resubscribing every render.
adm.subscribe, adm.getSnapshot, adm.getSnapshot);
// render the original component, but have the
diff --git a/dist/mobxreactlite.umd.development.js.map b/dist/mobxreactlite.umd.development.js.map
index ff758eab607ab8c189f4fae4541670d086f2ffa9..37e21033fc98de31f3935ba7e81e3491f5161012 100644
--- a/dist/mobxreactlite.umd.development.js.map
+++ b/dist/mobxreactlite.umd.development.js.map
@@ -1 +1 @@
-{"version":3,"file":"mobxreactlite.umd.development.js","sources":["../src/utils/assertEnvironment.ts","../src/utils/observerBatching.ts","../src/utils/utils.ts","../src/utils/printDebugValue.ts","../src/staticRendering.ts","../src/utils/UniversalFinalizationRegistry.ts","../src/utils/observerFinalizationRegistry.ts","../src/useObserver.ts","../src/observer.ts","../src/ObserverComponent.ts","../src/useLocalObservable.ts","../src/useAsObservableSource.ts","../src/useLocalStore.ts","../src/index.ts"],"sourcesContent":["import { makeObservable } from \"mobx\"\nimport { useState } from \"react\"\n\nif (!useState) {\n throw new Error(\"mobx-react-lite requires React with Hooks support\")\n}\nif (!makeObservable) {\n throw new Error(\"mobx-react-lite@3 requires mobx at least version 6 to be available\")\n}\n","import { configure } from \"mobx\"\n\nexport function defaultNoopBatch(callback: () => void) {\n callback()\n}\n\nexport function observerBatching(reactionScheduler: any) {\n if (!reactionScheduler) {\n reactionScheduler = defaultNoopBatch\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[MobX] Failed to get unstable_batched updates from react-dom / react-native\"\n )\n }\n }\n configure({ reactionScheduler })\n}\n\nexport const isObserverBatched = () => {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\"[MobX] Deprecated\")\n }\n\n return true\n}\n","const deprecatedMessages: string[] = []\n\nexport function useDeprecated(msg: string) {\n if (!deprecatedMessages.includes(msg)) {\n deprecatedMessages.push(msg)\n console.warn(msg)\n }\n}\n","import { getDependencyTree, Reaction } from \"mobx\"\n\nexport function printDebugValue(v: Reaction) {\n return getDependencyTree(v)\n}\n","let globalIsUsingStaticRendering = false\n\nexport function enableStaticRendering(enable: boolean) {\n globalIsUsingStaticRendering = enable\n}\n\nexport function isUsingStaticRendering(): boolean {\n return globalIsUsingStaticRendering\n}\n","export declare class FinalizationRegistryType<T> {\n constructor(finalize: (value: T) => void)\n register(target: object, value: T, token?: object): void\n unregister(token: object): void\n}\n\ndeclare const FinalizationRegistry: typeof FinalizationRegistryType | undefined\n\nexport const REGISTRY_FINALIZE_AFTER = 10_000\nexport const REGISTRY_SWEEP_INTERVAL = 10_000\n\nexport class TimerBasedFinalizationRegistry<T> implements FinalizationRegistryType<T> {\n private registrations: Map<unknown, { value: T; registeredAt: number }> = new Map()\n private sweepTimeout: ReturnType<typeof setTimeout> | undefined\n\n constructor(private readonly finalize: (value: T) => void) {}\n\n // Token is actually required with this impl\n register(target: object, value: T, token?: object) {\n this.registrations.set(token, {\n value,\n registeredAt: Date.now()\n })\n this.scheduleSweep()\n }\n\n unregister(token: unknown) {\n this.registrations.delete(token)\n }\n\n // Bound so it can be used directly as setTimeout callback.\n sweep = (maxAge = REGISTRY_FINALIZE_AFTER) => {\n // cancel timeout so we can force sweep anytime\n clearTimeout(this.sweepTimeout)\n this.sweepTimeout = undefined\n\n const now = Date.now()\n this.registrations.forEach((registration, token) => {\n if (now - registration.registeredAt >= maxAge) {\n this.finalize(registration.value)\n this.registrations.delete(token)\n }\n })\n\n if (this.registrations.size > 0) {\n this.scheduleSweep()\n }\n }\n\n // Bound so it can be exported directly as clearTimers test utility.\n finalizeAllImmediately = () => {\n this.sweep(0)\n }\n\n private scheduleSweep() {\n if (this.sweepTimeout === undefined) {\n this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL)\n }\n }\n}\n\nexport const UniversalFinalizationRegistry =\n typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : TimerBasedFinalizationRegistry\n","import { Reaction } from \"mobx\"\nimport { UniversalFinalizationRegistry } from \"./UniversalFinalizationRegistry\"\n\nexport const observerFinalizationRegistry = new UniversalFinalizationRegistry(\n (adm: { reaction: Reaction | null }) => {\n adm.reaction?.dispose()\n adm.reaction = null\n }\n)\n","import { Reaction } from \"mobx\"\nimport React from \"react\"\nimport { printDebugValue } from \"./utils/printDebugValue\"\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\nimport { useSyncExternalStore } from \"use-sync-external-store/shim\"\n\n// Do not store `admRef` (even as part of a closure!) on this object,\n// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.\ntype ObserverAdministration = {\n reaction: Reaction | null // also serves as disposed flag\n onStoreChange: Function | null // also serves as mounted flag\n // stateVersion that 'ticks' for every time the reaction fires\n // tearing is still present,\n // because there is no cross component synchronization,\n // but we can use `useSyncExternalStore` API.\n // TODO: optimize to use number?\n stateVersion: any\n name: string\n // These don't depend on state/props, therefore we can keep them here instead of `useCallback`\n subscribe: Parameters<typeof React.useSyncExternalStore>[0]\n getSnapshot: Parameters<typeof React.useSyncExternalStore>[1]\n}\n\nfunction createReaction(adm: ObserverAdministration) {\n adm.reaction = new Reaction(`observer${adm.name}`, () => {\n adm.stateVersion = Symbol()\n // onStoreChange won't be available until the component \"mounts\".\n // If state changes in between initial render and mount,\n // `useSyncExternalStore` should handle that by checking the state version and issuing update.\n adm.onStoreChange?.()\n })\n}\n\nexport function useObserver<T>(render: () => T, baseComponentName: string = \"observed\"): T {\n if (isUsingStaticRendering()) {\n return render()\n }\n\n const admRef = React.useRef<ObserverAdministration | null>(null)\n\n if (!admRef.current) {\n // First render\n const adm: ObserverAdministration = {\n reaction: null,\n onStoreChange: null,\n stateVersion: Symbol(),\n name: baseComponentName,\n subscribe(onStoreChange: () => void) {\n // Do NOT access admRef here!\n observerFinalizationRegistry.unregister(adm)\n adm.onStoreChange = onStoreChange\n if (!adm.reaction) {\n // We've lost our reaction and therefore all subscriptions, occurs when:\n // 1. Timer based finalization registry disposed reaction before component mounted.\n // 2. React \"re-mounts\" same component without calling render in between (typically <StrictMode>).\n // We have to recreate reaction and schedule re-render to recreate subscriptions,\n // even if state did not change.\n createReaction(adm)\n // `onStoreChange` won't force update if subsequent `getSnapshot` returns same value.\n // So we make sure that is not the case\n adm.stateVersion = Symbol()\n }\n\n return () => {\n // Do NOT access admRef here!\n adm.onStoreChange = null\n adm.reaction?.dispose()\n adm.reaction = null\n }\n },\n getSnapshot() {\n // Do NOT access admRef here!\n return adm.stateVersion\n }\n }\n\n admRef.current = adm\n }\n\n const adm = admRef.current!\n\n if (!adm.reaction) {\n // First render or reaction was disposed by registry before subscribe\n createReaction(adm)\n // StrictMode/ConcurrentMode/Suspense may mean that our component is\n // rendered and abandoned multiple times, so we need to track leaked\n // Reactions.\n observerFinalizationRegistry.register(admRef, adm, adm)\n }\n\n React.useDebugValue(adm.reaction!, printDebugValue)\n\n useSyncExternalStore(\n // Both of these must be stable, otherwise it would keep resubscribing every render.\n adm.subscribe,\n adm.getSnapshot,\n adm.getSnapshot\n )\n\n // render the original component, but have the\n // reaction track the observables, so that rendering\n // can be invalidated (see above) once a dependency changes\n let renderResult!: T\n let exception\n adm.reaction!.track(() => {\n try {\n renderResult = render()\n } catch (e) {\n exception = e\n }\n })\n\n if (exception) {\n throw exception // re-throw any exceptions caught during rendering\n }\n\n return renderResult\n}\n","import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n ? Symbol.for(\"react.forward_ref\")\n : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n ? Symbol.for(\"react.memo\")\n : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\nexport interface IObserverOptions {\n readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n options: IObserverOptions & { forwardRef: true }\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n baseComponent: React.FunctionComponent<P>,\n options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<\n C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n Options extends IObserverOptions\n>(\n baseComponent: C,\n options?: Options\n): Options extends { forwardRef: true }\n ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n ? C &\n React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n >\n : never /* forwardRef set for a non forwarding component */\n : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n baseComponent:\n | React.ForwardRefRenderFunction<TRef, P>\n | React.FunctionComponent<P>\n | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n // TODO remove in next major\n options?: IObserverOptions\n) {\n if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n warnObserverOptionsDeprecated = false\n console.warn(\n `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n )\n }\n\n if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n throw new Error(\n `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n )\n }\n\n // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n if (isUsingStaticRendering()) {\n return baseComponent\n }\n\n let useForwardRef = options?.forwardRef ?? false\n let render = baseComponent\n\n const baseComponentName = baseComponent.displayName || baseComponent.name\n\n // If already wrapped with forwardRef, unwrap,\n // so we can patch render and apply memo\n if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n useForwardRef = true\n render = baseComponent[\"render\"]\n if (typeof render !== \"function\") {\n throw new Error(\n `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n )\n }\n }\n\n let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n return useObserver(() => render(props, ref), baseComponentName)\n }\n\n // Inherit original name and displayName, see #3438\n ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n if (isFunctionNameConfigurable) {\n Object.defineProperty(observerComponent, \"name\", {\n value: baseComponent.name,\n writable: true,\n configurable: true\n })\n }\n\n // Support legacy context: `contextTypes` must be applied before `memo`\n if ((baseComponent as any).contextTypes) {\n ;(observerComponent as React.FunctionComponent).contextTypes = (\n baseComponent as any\n ).contextTypes\n }\n\n if (useForwardRef) {\n // `forwardRef` must be applied prior `memo`\n // `forwardRef(observer(cmp))` throws:\n // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n observerComponent = forwardRef(observerComponent)\n }\n\n // memo; we are not interested in deep updates\n // in props; we assume that if deep objects are changed,\n // this is in observables, which would have been tracked anyway\n observerComponent = memo(observerComponent)\n\n copyStaticProperties(baseComponent, observerComponent)\n\n if (\"production\" !== process.env.NODE_ENV) {\n Object.defineProperty(observerComponent, \"contextTypes\", {\n set() {\n throw new Error(\n `[mobx-react-lite] \\`${\n this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n }.contextTypes\\` must be set before applying \\`observer\\`.`\n )\n }\n })\n }\n\n return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n $$typeof: true,\n render: true,\n compare: true,\n type: true,\n // Don't redefine `displayName`,\n // it's defined as getter-setter pair on `memo` (see #3192).\n displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n Object.keys(base).forEach(key => {\n if (!hoistBlackList[key]) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n }\n })\n}\n","import { useObserver } from \"./useObserver\"\n\ninterface IObserverProps {\n children?(): React.ReactElement | null\n render?(): React.ReactElement | null\n}\n\nfunction ObserverComponent({ children, render }: IObserverProps) {\n const component = children || render\n if (typeof component !== \"function\") {\n return null\n }\n return useObserver(component)\n}\nif (\"production\" !== process.env.NODE_ENV) {\n ObserverComponent.propTypes = {\n children: ObserverPropsCheck,\n render: ObserverPropsCheck\n }\n}\nObserverComponent.displayName = \"Observer\"\n\nexport { ObserverComponent as Observer }\n\nfunction ObserverPropsCheck(\n props: { [k: string]: any },\n key: string,\n componentName: string,\n location: any,\n propFullName: string\n) {\n const extraKey = key === \"children\" ? \"render\" : \"children\"\n const hasProp = typeof props[key] === \"function\"\n const hasExtraProp = typeof props[extraKey] === \"function\"\n if (hasProp && hasExtraProp) {\n return new Error(\n \"MobX Observer: Do not use children and render in the same time in`\" + componentName\n )\n }\n\n if (hasProp || hasExtraProp) {\n return null\n }\n return new Error(\n \"Invalid prop `\" +\n propFullName +\n \"` of type `\" +\n typeof props[key] +\n \"` supplied to\" +\n \" `\" +\n componentName +\n \"`, expected `function`.\"\n )\n}\n","import { observable, AnnotationsMap } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useLocalObservable<TStore extends Record<string, any>>(\n initializer: () => TStore,\n annotations?: AnnotationsMap<TStore, never>\n): TStore {\n return useState(() => observable(initializer(), annotations, { autoBind: true }))[0]\n}\n","import { useDeprecated } from \"./utils/utils\"\nimport { observable, runInAction } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useAsObservableSource<TSource extends object>(current: TSource): TSource {\n if (\"production\" !== process.env.NODE_ENV)\n useDeprecated(\n \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\"\n )\n // We're deliberately not using idiomatic destructuring for the hook here.\n // Accessing the state value as an array element prevents TypeScript from generating unnecessary helpers in the resulting code.\n // For further details, please refer to mobxjs/mobx#3842.\n const res = useState(() => observable(current, {}, { deep: false }))[0]\n runInAction(() => {\n Object.assign(res, current)\n })\n return res\n}\n","import { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nimport { useDeprecated } from \"./utils/utils\"\nimport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport function useLocalStore<TStore extends Record<string, any>>(initializer: () => TStore): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source: TSource) => TStore,\n current: TSource\n): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source?: TSource) => TStore,\n current?: TSource\n): TStore {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\"\n )\n }\n const source = current && useAsObservableSource(current)\n return useState(() => observable(initializer(source), undefined, { autoBind: true }))[0]\n}\n","import \"./utils/assertEnvironment\"\n\nimport { unstable_batchedUpdates as batch } from \"./utils/reactBatchedUpdates\"\nimport { observerBatching } from \"./utils/observerBatching\"\nimport { useDeprecated } from \"./utils/utils\"\nimport { useObserver as useObserverOriginal } from \"./useObserver\"\nimport { enableStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\nobserverBatching(batch)\n\nexport { isUsingStaticRendering, enableStaticRendering } from \"./staticRendering\"\nexport { observer, IObserverOptions } from \"./observer\"\nexport { Observer } from \"./ObserverComponent\"\nexport { useLocalObservable } from \"./useLocalObservable\"\nexport { useLocalStore } from \"./useLocalStore\"\nexport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport { observerFinalizationRegistry as _observerFinalizationRegistry }\nexport const clearTimers = observerFinalizationRegistry[\"finalizeAllImmediately\"] ?? (() => {})\n\nexport function useObserver<T>(fn: () => T, baseComponentName: string = \"observed\"): T {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`.\"\n )\n }\n return useObserverOriginal(fn, baseComponentName)\n}\n\nexport { isObserverBatched, observerBatching } from \"./utils/observerBatching\"\n\nexport function useStaticRendering(enable: boolean) {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead\"\n )\n }\n enableStaticRendering(enable)\n}\n"],"names":["useState","Error","makeObservable","defaultNoopBatch","callback","observerBatching","reactionScheduler","console","warn","configure","isObserverBatched","deprecatedMessages","useDeprecated","msg","includes","push","printDebugValue","v","getDependencyTree","globalIsUsingStaticRendering","enableStaticRendering","enable","isUsingStaticRendering","REGISTRY_FINALIZE_AFTER","REGISTRY_SWEEP_INTERVAL","TimerBasedFinalizationRegistry","finalize","registrations","Map","sweepTimeout","sweep","maxAge","clearTimeout","_this","undefined","now","Date","forEach","registration","token","registeredAt","value","size","scheduleSweep","finalizeAllImmediately","_proto","prototype","register","target","set","unregister","setTimeout","UniversalFinalizationRegistry","FinalizationRegistry","observerFinalizationRegistry","adm","_adm$reaction","reaction","dispose","createReaction","Reaction","name","stateVersion","Symbol","onStoreChange","useObserver","render","baseComponentName","admRef","React","useRef","current","subscribe","getSnapshot","useDebugValue","useSyncExternalStore","renderResult","exception","track","e","warnObserverOptionsDeprecated","hasSymbol","isFunctionNameConfigurable","_Object$getOwnPropert","_Object$getOwnPropert2","Object","getOwnPropertyDescriptor","configurable","ReactForwardRefSymbol","forwardRef","props","ReactMemoSymbol","memo","observer","baseComponent","options","process","useForwardRef","_options$forwardRef","displayName","observerComponent","ref","defineProperty","writable","contextTypes","copyStaticProperties","_this$type","type","_this$type2","hoistBlackList","$$typeof","compare","base","keys","key","ObserverComponent","_ref","children","component","propTypes","ObserverPropsCheck","componentName","location","propFullName","extraKey","hasProp","hasExtraProp","useLocalObservable","initializer","annotations","observable","autoBind","useAsObservableSource","res","deep","runInAction","assign","useLocalStore","source","batch","clearTimers","_observerFinalization","fn","useObserverOriginal","useStaticRendering"],"mappings":";;;;;;;;IAGA,IAAI,CAACA,cAAQ,EAAE;MACX,MAAM,IAAIC,KAAK,CAAC,mDAAmD,CAAC;;IAExE,IAAI,CAACC,mBAAc,EAAE;MACjB,MAAM,IAAID,KAAK,CAAC,oEAAoE,CAAC;;;aCLzEE,gBAAgBA,CAACC,QAAoB;MACjDA,QAAQ,EAAE;IACd;AAEA,aAAgBC,gBAAgBA,CAACC,iBAAsB;MACnD,IAAI,CAACA,iBAAiB,EAAE;QACpBA,iBAAiB,GAAGH,gBAAgB;QACpC,AAA2C;UACvCI,OAAO,CAACC,IAAI,CACR,6EAA6E,CAChF;;;MAGTC,cAAS,CAAC;QAAEH,iBAAiB,EAAjBA;OAAmB,CAAC;IACpC;AAEA,QAAaI,iBAAiB,GAAG,SAApBA,iBAAiBA;MAC1B,AAA2C;QACvCH,OAAO,CAACC,IAAI,CAAC,mBAAmB,CAAC;;MAGrC,OAAO,IAAI;IACf,CAAC;;ICxBD,IAAMG,kBAAkB,GAAa,EAAE;AAEvC,aAAgBC,aAAaA,CAACC,GAAW;MACrC,IAAI,CAACF,kBAAkB,CAACG,QAAQ,CAACD,GAAG,CAAC,EAAE;QACnCF,kBAAkB,CAACI,IAAI,CAACF,GAAG,CAAC;QAC5BN,OAAO,CAACC,IAAI,CAACK,GAAG,CAAC;;IAEzB;;aCLgBG,eAAeA,CAACC,CAAW;MACvC,OAAOC,sBAAiB,CAACD,CAAC,CAAC;IAC/B;;ICJA,IAAIE,4BAA4B,GAAG,KAAK;AAExC,aAAgBC,qBAAqBA,CAACC,MAAe;MACjDF,4BAA4B,GAAGE,MAAM;IACzC;AAEA,aAAgBC,sBAAsBA;MAClC,OAAOH,4BAA4B;IACvC;;ICAO,IAAMI,uBAAuB,GAAG,KAAM;AAC7C,IAAO,IAAMC,uBAAuB,GAAG,KAAM;A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AAS;AAE/F,aAAgB5E,aAAWA,CAAI6E,EAAW,EAAE3E;UAAAA;QAAAA,oBAA4B,UAAU;;MAC9E,AAA2C;QACvCvD,aAAa,CACT,yIAAyI,CAC5I;;MAEL,OAAOmI,WAAmB,CAACD,EAAE,EAAE3E,iBAAiB,CAAC;IACrD;AAEA,aAEgB6E,kBAAkBA,CAAC3H,MAAe;MAC9C,AAA2C;QACvCd,OAAO,CAACC,IAAI,CACR,2FAA2F,CAC9F;;MAELY,qBAAqB,CAACC,MAAM,CAAC;IACjC;;;;;;;;;;;;;;;;;;;;;;;;"}
\ No newline at end of file
+{"version":3,"file":"mobxreactlite.umd.development.js","sources":["../src/utils/assertEnvironment.ts","../src/utils/observerBatching.ts","../src/utils/utils.ts","../src/utils/printDebugValue.ts","../src/staticRendering.ts","../src/utils/UniversalFinalizationRegistry.ts","../src/utils/observerFinalizationRegistry.ts","../src/useObserver.ts","../src/observer.ts","../src/ObserverComponent.ts","../src/useLocalObservable.ts","../src/useAsObservableSource.ts","../src/useLocalStore.ts","../src/index.ts"],"sourcesContent":["import { makeObservable } from \"mobx\"\nimport { useState } from \"react\"\n\nif (!useState) {\n throw new Error(\"mobx-react-lite requires React with Hooks support\")\n}\nif (!makeObservable) {\n throw new Error(\"mobx-react-lite@3 requires mobx at least version 6 to be available\")\n}\n","import { configure } from \"mobx\"\n\nexport function defaultNoopBatch(callback: () => void) {\n callback()\n}\n\nexport function observerBatching(reactionScheduler: any) {\n if (!reactionScheduler) {\n reactionScheduler = defaultNoopBatch\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[MobX] Failed to get unstable_batched updates from react-dom / react-native\"\n )\n }\n }\n configure({ reactionScheduler })\n}\n\nexport const isObserverBatched = () => {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\"[MobX] Deprecated\")\n }\n\n return true\n}\n","const deprecatedMessages: string[] = []\n\nexport function useDeprecated(msg: string) {\n if (!deprecatedMessages.includes(msg)) {\n deprecatedMessages.push(msg)\n console.warn(msg)\n }\n}\n","import { getDependencyTree, Reaction } from \"mobx\"\n\nexport function printDebugValue(v: Reaction) {\n return getDependencyTree(v)\n}\n","let globalIsUsingStaticRendering = false\n\nexport function enableStaticRendering(enable: boolean) {\n globalIsUsingStaticRendering = enable\n}\n\nexport function isUsingStaticRendering(): boolean {\n return globalIsUsingStaticRendering\n}\n","export declare class FinalizationRegistryType<T> {\n constructor(finalize: (value: T) => void)\n register(target: object, value: T, token?: object): void\n unregister(token: object): void\n}\n\ndeclare const FinalizationRegistry: typeof FinalizationRegistryType | undefined\n\nexport const REGISTRY_FINALIZE_AFTER = 10_000\nexport const REGISTRY_SWEEP_INTERVAL = 10_000\n\nexport class TimerBasedFinalizationRegistry<T> implements FinalizationRegistryType<T> {\n private registrations: Map<unknown, { value: T; registeredAt: number }> = new Map()\n private sweepTimeout: ReturnType<typeof setTimeout> | undefined\n\n constructor(private readonly finalize: (value: T) => void) {}\n\n // Token is actually required with this impl\n register(target: object, value: T, token?: object) {\n this.registrations.set(token, {\n value,\n registeredAt: Date.now()\n })\n this.scheduleSweep()\n }\n\n unregister(token: unknown) {\n this.registrations.delete(token)\n }\n\n // Bound so it can be used directly as setTimeout callback.\n sweep = (maxAge = REGISTRY_FINALIZE_AFTER) => {\n // cancel timeout so we can force sweep anytime\n clearTimeout(this.sweepTimeout)\n this.sweepTimeout = undefined\n\n const now = Date.now()\n this.registrations.forEach((registration, token) => {\n if (now - registration.registeredAt >= maxAge) {\n this.finalize(registration.value)\n this.registrations.delete(token)\n }\n })\n\n if (this.registrations.size > 0) {\n this.scheduleSweep()\n }\n }\n\n // Bound so it can be exported directly as clearTimers test utility.\n finalizeAllImmediately = () => {\n this.sweep(0)\n }\n\n private scheduleSweep() {\n if (this.sweepTimeout === undefined) {\n this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL)\n }\n }\n}\n\nexport const UniversalFinalizationRegistry =\n typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : TimerBasedFinalizationRegistry\n","import { Reaction } from \"mobx\"\nimport { UniversalFinalizationRegistry } from \"./UniversalFinalizationRegistry\"\n\nexport const observerFinalizationRegistry = new UniversalFinalizationRegistry(\n (adm: { reaction: Reaction | null }) => {\n adm.reaction?.dispose()\n adm.reaction = null\n }\n)\n","import { Reaction } from \"mobx\"\nimport React from \"react\"\nimport { printDebugValue } from \"./utils/printDebugValue\"\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\n// Do not store `admRef` (even as part of a closure!) on this object,\n// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.\ntype ObserverAdministration = {\n reaction: Reaction | null // also serves as disposed flag\n onStoreChange: Function | null // also serves as mounted flag\n // stateVersion that 'ticks' for every time the reaction fires\n // tearing is still present,\n // because there is no cross component synchronization,\n // but we can use `useSyncExternalStore` API.\n // TODO: optimize to use number?\n stateVersion: any\n name: string\n // These don't depend on state/props, therefore we can keep them here instead of `useCallback`\n subscribe: Parameters<typeof React.useSyncExternalStore>[0]\n getSnapshot: Parameters<typeof React.useSyncExternalStore>[1]\n}\n\nfunction createReaction(adm: ObserverAdministration) {\n adm.reaction = new Reaction(`observer${adm.name}`, () => {\n adm.stateVersion = Symbol()\n // onStoreChange won't be available until the component \"mounts\".\n // If state changes in between initial render and mount,\n // `useSyncExternalStore` should handle that by checking the state version and issuing update.\n adm.onStoreChange?.()\n })\n}\n\nexport function useObserver<T>(render: () => T, baseComponentName: string = \"observed\"): T {\n if (isUsingStaticRendering()) {\n return render()\n }\n\n const admRef = React.useRef<ObserverAdministration | null>(null)\n\n if (!admRef.current) {\n // First render\n const adm: ObserverAdministration = {\n reaction: null,\n onStoreChange: null,\n stateVersion: Symbol(),\n name: baseComponentName,\n subscribe(onStoreChange: () => void) {\n // Do NOT access admRef here!\n observerFinalizationRegistry.unregister(adm)\n adm.onStoreChange = onStoreChange\n if (!adm.reaction) {\n // We've lost our reaction and therefore all subscriptions, occurs when:\n // 1. Timer based finalization registry disposed reaction before component mounted.\n // 2. React \"re-mounts\" same component without calling render in between (typically <StrictMode>).\n // We have to recreate reaction and schedule re-render to recreate subscriptions,\n // even if state did not change.\n createReaction(adm)\n // `onStoreChange` won't force update if subsequent `getSnapshot` returns same value.\n // So we make sure that is not the case\n adm.stateVersion = Symbol()\n }\n\n return () => {\n // Do NOT access admRef here!\n adm.onStoreChange = null\n adm.reaction?.dispose()\n adm.reaction = null\n }\n },\n getSnapshot() {\n // Do NOT access admRef here!\n return adm.stateVersion\n }\n }\n\n admRef.current = adm\n }\n\n const adm = admRef.current!\n\n if (!adm.reaction) {\n // First render or reaction was disposed by registry before subscribe\n createReaction(adm)\n // StrictMode/ConcurrentMode/Suspense may mean that our component is\n // rendered and abandoned multiple times, so we need to track leaked\n // Reactions.\n observerFinalizationRegistry.register(admRef, adm, adm)\n }\n\n React.useDebugValue(adm.reaction!, printDebugValue)\n\n React.useSyncExternalStore(\n // Both of these must be stable, otherwise it would keep resubscribing every render.\n adm.subscribe,\n adm.getSnapshot,\n adm.getSnapshot\n )\n\n // render the original component, but have the\n // reaction track the observables, so that rendering\n // can be invalidated (see above) once a dependency changes\n let renderResult!: T\n let exception\n adm.reaction!.track(() => {\n try {\n renderResult = render()\n } catch (e) {\n exception = e\n }\n })\n\n if (exception) {\n throw exception // re-throw any exceptions caught during rendering\n }\n\n return renderResult\n}\n","import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n ? Symbol.for(\"react.forward_ref\")\n : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n ? Symbol.for(\"react.memo\")\n : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\nexport interface IObserverOptions {\n readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n options: IObserverOptions & { forwardRef: true }\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n baseComponent: React.FunctionComponent<P>,\n options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<\n C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n Options extends IObserverOptions\n>(\n baseComponent: C,\n options?: Options\n): Options extends { forwardRef: true }\n ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n ? C &\n React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n >\n : never /* forwardRef set for a non forwarding component */\n : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n baseComponent:\n | React.ForwardRefRenderFunction<TRef, P>\n | React.FunctionComponent<P>\n | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n // TODO remove in next major\n options?: IObserverOptions\n) {\n if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n warnObserverOptionsDeprecated = false\n console.warn(\n `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n )\n }\n\n if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n throw new Error(\n `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n )\n }\n\n // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n if (isUsingStaticRendering()) {\n return baseComponent\n }\n\n let useForwardRef = options?.forwardRef ?? false\n let render = baseComponent\n\n const baseComponentName = baseComponent.displayName || baseComponent.name\n\n // If already wrapped with forwardRef, unwrap,\n // so we can patch render and apply memo\n if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n useForwardRef = true\n render = baseComponent[\"render\"]\n if (typeof render !== \"function\") {\n throw new Error(\n `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n )\n }\n }\n\n let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n return useObserver(() => render(props, ref), baseComponentName)\n }\n\n // Inherit original name and displayName, see #3438\n ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n if (isFunctionNameConfigurable) {\n Object.defineProperty(observerComponent, \"name\", {\n value: baseComponent.name,\n writable: true,\n configurable: true\n })\n }\n\n // Support legacy context: `contextTypes` must be applied before `memo`\n if ((baseComponent as any).contextTypes) {\n ;(observerComponent as React.FunctionComponent).contextTypes = (\n baseComponent as any\n ).contextTypes\n }\n\n if (useForwardRef) {\n // `forwardRef` must be applied prior `memo`\n // `forwardRef(observer(cmp))` throws:\n // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n observerComponent = forwardRef(observerComponent)\n }\n\n // memo; we are not interested in deep updates\n // in props; we assume that if deep objects are changed,\n // this is in observables, which would have been tracked anyway\n observerComponent = memo(observerComponent)\n\n copyStaticProperties(baseComponent, observerComponent)\n\n if (\"production\" !== process.env.NODE_ENV) {\n Object.defineProperty(observerComponent, \"contextTypes\", {\n set() {\n throw new Error(\n `[mobx-react-lite] \\`${\n this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n }.contextTypes\\` must be set before applying \\`observer\\`.`\n )\n }\n })\n }\n\n return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n $$typeof: true,\n render: true,\n compare: true,\n type: true,\n // Don't redefine `displayName`,\n // it's defined as getter-setter pair on `memo` (see #3192).\n displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n Object.keys(base).forEach(key => {\n if (!hoistBlackList[key]) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n }\n })\n}\n","import { useObserver } from \"./useObserver\"\n\ninterface IObserverProps {\n children?(): React.ReactElement | null\n render?(): React.ReactElement | null\n}\n\nfunction ObserverComponent({ children, render }: IObserverProps) {\n const component = children || render\n if (typeof component !== \"function\") {\n return null\n }\n return useObserver(component)\n}\nif (\"production\" !== process.env.NODE_ENV) {\n ObserverComponent.propTypes = {\n children: ObserverPropsCheck,\n render: ObserverPropsCheck\n }\n}\nObserverComponent.displayName = \"Observer\"\n\nexport { ObserverComponent as Observer }\n\nfunction ObserverPropsCheck(\n props: { [k: string]: any },\n key: string,\n componentName: string,\n location: any,\n propFullName: string\n) {\n const extraKey = key === \"children\" ? \"render\" : \"children\"\n const hasProp = typeof props[key] === \"function\"\n const hasExtraProp = typeof props[extraKey] === \"function\"\n if (hasProp && hasExtraProp) {\n return new Error(\n \"MobX Observer: Do not use children and render in the same time in`\" + componentName\n )\n }\n\n if (hasProp || hasExtraProp) {\n return null\n }\n return new Error(\n \"Invalid prop `\" +\n propFullName +\n \"` of type `\" +\n typeof props[key] +\n \"` supplied to\" +\n \" `\" +\n componentName +\n \"`, expected `function`.\"\n )\n}\n","import { observable, AnnotationsMap } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useLocalObservable<TStore extends Record<string, any>>(\n initializer: () => TStore,\n annotations?: AnnotationsMap<TStore, never>\n): TStore {\n return useState(() => observable(initializer(), annotations, { autoBind: true }))[0]\n}\n","import { useDeprecated } from \"./utils/utils\"\nimport { observable, runInAction } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useAsObservableSource<TSource extends object>(current: TSource): TSource {\n if (\"production\" !== process.env.NODE_ENV)\n useDeprecated(\n \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\"\n )\n // We're deliberately not using idiomatic destructuring for the hook here.\n // Accessing the state value as an array element prevents TypeScript from generating unnecessary helpers in the resulting code.\n // For further details, please refer to mobxjs/mobx#3842.\n const res = useState(() => observable(current, {}, { deep: false }))[0]\n runInAction(() => {\n Object.assign(res, current)\n })\n return res\n}\n","import { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nimport { useDeprecated } from \"./utils/utils\"\nimport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport function useLocalStore<TStore extends Record<string, any>>(initializer: () => TStore): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source: TSource) => TStore,\n current: TSource\n): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source?: TSource) => TStore,\n current?: TSource\n): TStore {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\"\n )\n }\n const source = current && useAsObservableSource(current)\n return useState(() => observable(initializer(source), undefined, { autoBind: true }))[0]\n}\n","import \"./utils/assertEnvironment\"\n\nimport { unstable_batchedUpdates as batch } from \"./utils/reactBatchedUpdates\"\nimport { observerBatching } from \"./utils/observerBatching\"\nimport { useDeprecated } from \"./utils/utils\"\nimport { useObserver as useObserverOriginal } from \"./useObserver\"\nimport { enableStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\nobserverBatching(batch)\n\nexport { isUsingStaticRendering, enableStaticRendering } from \"./staticRendering\"\nexport { observer, IObserverOptions } from \"./observer\"\nexport { Observer } from \"./ObserverComponent\"\nexport { useLocalObservable } from \"./useLocalObservable\"\nexport { useLocalStore } from \"./useLocalStore\"\nexport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport { observerFinalizationRegistry as _observerFinalizationRegistry }\nexport const clearTimers = observerFinalizationRegistry[\"finalizeAllImmediately\"] ?? (() => {})\n\nexport function useObserver<T>(fn: () => T, baseComponentName: string = \"observed\"): T {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`.\"\n )\n }\n return useObserverOriginal(fn, baseComponentName)\n}\n\nexport { isObserverBatched, observerBatching } from \"./utils/observerBatching\"\n\nexport function useStaticRendering(enable: boolean) {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead\"\n )\n }\n enableStaticRendering(enable)\n}\n"],"names":["useState","Error","makeObservable","defaultNoopBatch","callback","observerBatching","reactionScheduler","console","warn","configure","isObserverBatched","deprecatedMessages","useDeprecated","msg","includes","push","printDebugValue","v","getDependencyTree","globalIsUsingStaticRendering","enableStaticRendering","enable","isUsingStaticRendering","REGISTRY_FINALIZE_AFTER","REGISTRY_SWEEP_INTERVAL","TimerBasedFinalizationRegistry","finalize","registrations","Map","sweepTimeout","sweep","maxAge","clearTimeout","_this","undefined","now","Date","forEach","registration","token","registeredAt","value","size","scheduleSweep","finalizeAllImmediately","_proto","prototype","register","target","set","unregister","setTimeout","UniversalFinalizationRegistry","FinalizationRegistry","observerFinalizationRegistry","adm","_adm$reaction","reaction","dispose","createReaction","Reaction","name","stateVersion","Symbol","onStoreChange","useObserver","render","baseComponentName","admRef","React","useRef","current","subscribe","getSnapshot","useDebugValue","useSyncExternalStore","renderResult","exception","track","e","warnObserverOptionsDeprecated","hasSymbol","isFunctionNameConfigurable","_Object$getOwnPropert","_Object$getOwnPropert2","Object","getOwnPropertyDescriptor","configurable","ReactForwardRefSymbol","forwardRef","props","ReactMemoSymbol","memo","observer","baseComponent","options","process","useForwardRef","_options$forwardRef","displayName","observerComponent","ref","defineProperty","writable","contextTypes","copyStaticProperties","_this$type","type","_this$type2","hoistBlackList","$$typeof","compare","base","keys","key","ObserverComponent","_ref","children","component","propTypes","ObserverPropsCheck","componentName","location","propFullName","extraKey","hasProp","hasExtraProp","useLocalObservable","initializer","annotations","observable","autoBind","useAsObservableSource","res","deep","runInAction","assign","useLocalStore","source","batch","clearTimers","_observerFinalization","fn","useObserverOriginal","useStaticRendering"],"mappings":";;;;;;;;IAGA,IAAI,CAACA,cAAQ,EAAE;MACX,MAAM,IAAIC,KAAK,CAAC,mDAAmD,CAAC;;IAExE,IAAI,CAACC,mBAAc,EAAE;MACjB,MAAM,IAAID,KAAK,CAAC,oEAAoE,CAAC;;;aCLzEE,gBAAgBA,CAACC,QAAoB;MACjDA,QAAQ,EAAE;IACd;AAEA,aAAgBC,gBAAgBA,CAACC,iBAAsB;MACnD,IAAI,CAACA,iBAAiB,EAAE;QACpBA,iBAAiB,GAAGH,gBAAgB;QACpC,AAA2C;UACvCI,OAAO,CAACC,IAAI,CACR,6EAA6E,CAChF;;;MAGTC,cAAS,CAAC;QAAEH,iBAAiB,EAAjBA;OAAmB,CAAC;IACpC;AAEA,QAAaI,iBAAiB,GAAG,SAApBA,iBAAiBA;MAC1B,AAA2C;QACvCH,OAAO,CAACC,IAAI,CAAC,mBAAmB,CAAC;;MAGrC,OAAO,IAAI;IACf,CAAC;;ICxBD,IAAMG,kBAAkB,GAAa,EAAE;AAEvC,aAAgBC,aAAaA,CAACC,GAAW;MACrC,IAAI,CAACF,kBAAkB,CAACG,QAAQ,CAACD,GAAG,CAAC,EAAE;QACnCF,kBAAkB,CAACI,IAAI,CAACF,GAAG,CAAC;QAC5BN,OAAO,CAACC,IAAI,CAACK,GAAG,CAAC;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AAqB,CAAC7D,OAAO,CAAC;MACxD,OAAOvE,cAAQ,CAAC;QAAA,OAAMkI,eAAU,CAACF,WAAW,CAACU,MAAM,CAAC,EAAExG,SAAS,EAAE;UAAEiG,QAAQ,EAAE;SAAM,CAAC;QAAC,CAAC,CAAC,CAAC;IAC5F;;;ACtBA,IASA9H,gBAAgB,CAACsI,gCAAK,CAAC;AAEvB,QAQaC,WAAW,IAAAC,qBAAA,GAAGvF,4BAA4B,CAAC,wBAAwB,CAAC,YAAAuF,qBAAA,GAAK,cAAS;AAE/F,aAAgB5E,aAAWA,CAAI6E,EAAW,EAAE3E;UAAAA;QAAAA,oBAA4B,UAAU;;MAC9E,AAA2C;QACvCvD,aAAa,CACT,yIAAyI,CAC5I;;MAEL,OAAOmI,WAAmB,CAACD,EAAE,EAAE3E,iBAAiB,CAAC;IACrD;AAEA,aAEgB6E,kBAAkBA,CAAC3H,MAAe;MAC9C,AAA2C;QACvCd,OAAO,CAACC,IAAI,CACR,2FAA2F,CAC9F;;MAELY,qBAAqB,CAACC,MAAM,CAAC;IACjC;;;;;;;;;;;;;;;;;;;;;;;;"}
\ No newline at end of file
diff --git a/dist/mobxreactlite.umd.production.min.js b/dist/mobxreactlite.umd.production.min.js
index fc3fdc6cfcbc0a927cfb6e32ba8b20996f9ebe24..f398ad3ca2dec24c64cf9a23a9896324ab192ef2 100644
--- a/dist/mobxreactlite.umd.production.min.js
+++ b/dist/mobxreactlite.umd.production.min.js
@@ -1,2 +1,2 @@
-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("mobx"),require("react"),require("react-dom"),require("use-sync-external-store/shim")):"function"==typeof define&&define.amd?define(["exports","mobx","react","react-dom","use-sync-external-store/shim"],t):t((e=e||self).mobxReactLite={},e.mobx,e.React,e.ReactDOM,e.shim)}(this,(function(e,t,r,n,o){"use strict";var i="default"in r?r.default:r;if(!r.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!t.makeObservable)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function a(e){e()}function u(e){e||(e=a),t.configure({reactionScheduler:e})}function s(e){return t.getDependencyTree(e)}var c=!1;function f(e){c=e}function l(){return c}var d,p,b=new("undefined"!=typeof FinalizationRegistry?FinalizationRegistry:function(){function e(e){var t=this;this.finalize=void 0,this.registrations=new Map,this.sweepTimeout=void 0,this.sweep=function(e){void 0===e&&(e=1e4),clearTimeout(t.sweepTimeout),t.sweepTimeout=void 0;var r=Date.now();t.registrations.forEach((function(n,o){r-n.registeredAt>=e&&(t.finalize(n.value),t.registrations.delete(o))})),t.registrations.size>0&&t.scheduleSweep()},this.finalizeAllImmediately=function(){t.sweep(0)},this.finalize=e}var t=e.prototype;return t.register=function(e,t,r){this.registrations.set(r,{value:t,registeredAt:Date.now()}),this.scheduleSweep()},t.unregister=function(e){this.registrations.delete(e)},t.scheduleSweep=function(){void 0===this.sweepTimeout&&(this.sweepTimeout=setTimeout(this.sweep,1e4))},e}())((function(e){var t;null==(t=e.reaction)||t.dispose(),e.reaction=null}));function m(e){e.reaction=new t.Reaction("observer"+e.name,(function(){e.stateVersion=Symbol(),null==e.onStoreChange||e.onStoreChange()}))}function v(e,t){if(void 0===t&&(t="observed"),l())return e();var r=i.useRef(null);if(!r.current){var n={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return b.unregister(n),n.onStoreChange=e,n.reaction||(m(n),n.stateVersion=Symbol()),function(){var e;n.onStoreChange=null,null==(e=n.reaction)||e.dispose(),n.reaction=null}},getSnapshot:function(){return n.stateVersion}};r.current=n}var a,u,c=r.current;if(c.reaction||(m(c),b.register(r,c,c)),i.useDebugValue(c.reaction,s),o.useSyncExternalStore(c.subscribe,c.getSnapshot,c.getSnapshot),c.reaction.track((function(){try{a=e()}catch(e){u=e}})),u)throw u;return a}var y,h="function"==typeof Symbol&&Symbol.for,g=null!=(d=null==(p=Object.getOwnPropertyDescriptor((function(){}),"name"))?void 0:p.configurable)&&d,w=h?Symbol.for("react.forward_ref"):"function"==typeof r.forwardRef&&r.forwardRef((function(e){return null})).$$typeof,S=h?Symbol.for("react.memo"):"function"==typeof r.memo&&r.memo((function(e){return null})).$$typeof,R={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function x(e){var t=e.children||e.render;return"function"!=typeof t?null:v(t)}function O(e){var n=r.useState((function(){return t.observable(e,{},{deep:!1})}))[0];return t.runInAction((function(){Object.assign(n,e)})),n}x.displayName="Observer",u(n.unstable_batchedUpdates);var T=null!=(y=b.finalizeAllImmediately)?y:function(){};e.Observer=x,e._observerFinalizationRegistry=b,e.clearTimers=T,e.enableStaticRendering=f,e.isObserverBatched=function(){return!0},e.isUsingStaticRendering=l,e.observer=function(e,t){var n;if(S&&e.$$typeof===S)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");if(l())return e;var o=null!=(n=null==t?void 0:t.forwardRef)&&n,i=e,a=e.displayName||e.name;if(w&&e.$$typeof===w&&(o=!0,"function"!=typeof(i=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var u,s,c=function(e,t){return v((function(){return i(e,t)}),a)};return c.displayName=e.displayName,g&&Object.defineProperty(c,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(c.contextTypes=e.contextTypes),o&&(c=r.forwardRef(c)),c=r.memo(c),u=e,s=c,Object.keys(u).forEach((function(e){R[e]||Object.defineProperty(s,e,Object.getOwnPropertyDescriptor(u,e))})),c},e.observerBatching=u,e.useAsObservableSource=O,e.useLocalObservable=function(e,n){return r.useState((function(){return t.observable(e(),n,{autoBind:!0})}))[0]},e.useLocalStore=function(e,n){var o=n&&O(n);return r.useState((function(){return t.observable(e(o),void 0,{autoBind:!0})}))[0]},e.useObserver=function(e,t){return void 0===t&&(t="observed"),v(e,t)},e.useStaticRendering=function(e){f(e)},Object.defineProperty(e,"__esModule",{value:!0})}));
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("mobx"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","mobx","react","react-dom"],t):t((e=e||self).mobxReactLite={},e.mobx,e.React,e.ReactDOM)}(this,(function(e,t,r,n){"use strict";var o="default"in r?r.default:r;if(!r.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!t.makeObservable)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function i(e){e()}function a(e){e||(e=i),t.configure({reactionScheduler:e})}function u(e){return t.getDependencyTree(e)}var s=!1;function c(e){s=e}function f(){return s}var l,d,p=new("undefined"!=typeof FinalizationRegistry?FinalizationRegistry:function(){function e(e){var t=this;this.finalize=void 0,this.registrations=new Map,this.sweepTimeout=void 0,this.sweep=function(e){void 0===e&&(e=1e4),clearTimeout(t.sweepTimeout),t.sweepTimeout=void 0;var r=Date.now();t.registrations.forEach((function(n,o){r-n.registeredAt>=e&&(t.finalize(n.value),t.registrations.delete(o))})),t.registrations.size>0&&t.scheduleSweep()},this.finalizeAllImmediately=function(){t.sweep(0)},this.finalize=e}var t=e.prototype;return t.register=function(e,t,r){this.registrations.set(r,{value:t,registeredAt:Date.now()}),this.scheduleSweep()},t.unregister=function(e){this.registrations.delete(e)},t.scheduleSweep=function(){void 0===this.sweepTimeout&&(this.sweepTimeout=setTimeout(this.sweep,1e4))},e}())((function(e){var t;null==(t=e.reaction)||t.dispose(),e.reaction=null}));function b(e){e.reaction=new t.Reaction("observer"+e.name,(function(){e.stateVersion=Symbol(),null==e.onStoreChange||e.onStoreChange()}))}function m(e,t){if(void 0===t&&(t="observed"),f())return e();var r=o.useRef(null);if(!r.current){var n={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(e){return p.unregister(n),n.onStoreChange=e,n.reaction||(b(n),n.stateVersion=Symbol()),function(){var e;n.onStoreChange=null,null==(e=n.reaction)||e.dispose(),n.reaction=null}},getSnapshot:function(){return n.stateVersion}};r.current=n}var i,a,s=r.current;if(s.reaction||(b(s),p.register(r,s,s)),o.useDebugValue(s.reaction,u),o.useSyncExternalStore(s.subscribe,s.getSnapshot,s.getSnapshot),s.reaction.track((function(){try{i=e()}catch(e){a=e}})),a)throw a;return i}var v,y="function"==typeof Symbol&&Symbol.for,h=null!=(l=null==(d=Object.getOwnPropertyDescriptor((function(){}),"name"))?void 0:d.configurable)&&l,g=y?Symbol.for("react.forward_ref"):"function"==typeof r.forwardRef&&r.forwardRef((function(e){return null})).$$typeof,w=y?Symbol.for("react.memo"):"function"==typeof r.memo&&r.memo((function(e){return null})).$$typeof,S={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function R(e){var t=e.children||e.render;return"function"!=typeof t?null:m(t)}function O(e){var n=r.useState((function(){return t.observable(e,{},{deep:!1})}))[0];return t.runInAction((function(){Object.assign(n,e)})),n}R.displayName="Observer",a(n.unstable_batchedUpdates);var x=null!=(v=p.finalizeAllImmediately)?v:function(){};e.Observer=R,e._observerFinalizationRegistry=p,e.clearTimers=x,e.enableStaticRendering=c,e.isObserverBatched=function(){return!0},e.isUsingStaticRendering=f,e.observer=function(e,t){var n;if(w&&e.$$typeof===w)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");if(f())return e;var o=null!=(n=null==t?void 0:t.forwardRef)&&n,i=e,a=e.displayName||e.name;if(g&&e.$$typeof===g&&(o=!0,"function"!=typeof(i=e.render)))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var u,s,c=function(e,t){return m((function(){return i(e,t)}),a)};return c.displayName=e.displayName,h&&Object.defineProperty(c,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(c.contextTypes=e.contextTypes),o&&(c=r.forwardRef(c)),c=r.memo(c),u=e,s=c,Object.keys(u).forEach((function(e){S[e]||Object.defineProperty(s,e,Object.getOwnPropertyDescriptor(u,e))})),c},e.observerBatching=a,e.useAsObservableSource=O,e.useLocalObservable=function(e,n){return r.useState((function(){return t.observable(e(),n,{autoBind:!0})}))[0]},e.useLocalStore=function(e,n){var o=n&&O(n);return r.useState((function(){return t.observable(e(o),void 0,{autoBind:!0})}))[0]},e.useObserver=function(e,t){return void 0===t&&(t="observed"),m(e,t)},e.useStaticRendering=function(e){c(e)},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=mobxreactlite.umd.production.min.js.map
diff --git a/dist/mobxreactlite.umd.production.min.js.map b/dist/mobxreactlite.umd.production.min.js.map
index 4951ca88456538dfca043ae52096ed7893aab3a6..a25bd5a30a8702ccb82e291793abbd3656cd5270 100644
--- a/dist/mobxreactlite.umd.production.min.js.map
+++ b/dist/mobxreactlite.umd.production.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"mobxreactlite.umd.production.min.js","sources":["../src/utils/assertEnvironment.ts","../src/utils/observerBatching.ts","../src/utils/printDebugValue.ts","../src/staticRendering.ts","../src/utils/UniversalFinalizationRegistry.ts","../src/utils/observerFinalizationRegistry.ts","../src/useObserver.ts","../src/observer.ts","../src/ObserverComponent.ts","../src/useAsObservableSource.ts","../src/index.ts","../src/useLocalObservable.ts","../src/useLocalStore.ts"],"sourcesContent":["import { makeObservable } from \"mobx\"\nimport { useState } from \"react\"\n\nif (!useState) {\n throw new Error(\"mobx-react-lite requires React with Hooks support\")\n}\nif (!makeObservable) {\n throw new Error(\"mobx-react-lite@3 requires mobx at least version 6 to be available\")\n}\n","import { configure } from \"mobx\"\n\nexport function defaultNoopBatch(callback: () => void) {\n callback()\n}\n\nexport function observerBatching(reactionScheduler: any) {\n if (!reactionScheduler) {\n reactionScheduler = defaultNoopBatch\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[MobX] Failed to get unstable_batched updates from react-dom / react-native\"\n )\n }\n }\n configure({ reactionScheduler })\n}\n\nexport const isObserverBatched = () => {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\"[MobX] Deprecated\")\n }\n\n return true\n}\n","import { getDependencyTree, Reaction } from \"mobx\"\n\nexport function printDebugValue(v: Reaction) {\n return getDependencyTree(v)\n}\n","let globalIsUsingStaticRendering = false\n\nexport function enableStaticRendering(enable: boolean) {\n globalIsUsingStaticRendering = enable\n}\n\nexport function isUsingStaticRendering(): boolean {\n return globalIsUsingStaticRendering\n}\n","export declare class FinalizationRegistryType<T> {\n constructor(finalize: (value: T) => void)\n register(target: object, value: T, token?: object): void\n unregister(token: object): void\n}\n\ndeclare const FinalizationRegistry: typeof FinalizationRegistryType | undefined\n\nexport const REGISTRY_FINALIZE_AFTER = 10_000\nexport const REGISTRY_SWEEP_INTERVAL = 10_000\n\nexport class TimerBasedFinalizationRegistry<T> implements FinalizationRegistryType<T> {\n private registrations: Map<unknown, { value: T; registeredAt: number }> = new Map()\n private sweepTimeout: ReturnType<typeof setTimeout> | undefined\n\n constructor(private readonly finalize: (value: T) => void) {}\n\n // Token is actually required with this impl\n register(target: object, value: T, token?: object) {\n this.registrations.set(token, {\n value,\n registeredAt: Date.now()\n })\n this.scheduleSweep()\n }\n\n unregister(token: unknown) {\n this.registrations.delete(token)\n }\n\n // Bound so it can be used directly as setTimeout callback.\n sweep = (maxAge = REGISTRY_FINALIZE_AFTER) => {\n // cancel timeout so we can force sweep anytime\n clearTimeout(this.sweepTimeout)\n this.sweepTimeout = undefined\n\n const now = Date.now()\n this.registrations.forEach((registration, token) => {\n if (now - registration.registeredAt >= maxAge) {\n this.finalize(registration.value)\n this.registrations.delete(token)\n }\n })\n\n if (this.registrations.size > 0) {\n this.scheduleSweep()\n }\n }\n\n // Bound so it can be exported directly as clearTimers test utility.\n finalizeAllImmediately = () => {\n this.sweep(0)\n }\n\n private scheduleSweep() {\n if (this.sweepTimeout === undefined) {\n this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL)\n }\n }\n}\n\nexport const UniversalFinalizationRegistry =\n typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : TimerBasedFinalizationRegistry\n","import { Reaction } from \"mobx\"\nimport { UniversalFinalizationRegistry } from \"./UniversalFinalizationRegistry\"\n\nexport const observerFinalizationRegistry = new UniversalFinalizationRegistry(\n (adm: { reaction: Reaction | null }) => {\n adm.reaction?.dispose()\n adm.reaction = null\n }\n)\n","import { Reaction } from \"mobx\"\nimport React from \"react\"\nimport { printDebugValue } from \"./utils/printDebugValue\"\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\nimport { useSyncExternalStore } from \"use-sync-external-store/shim\"\n\n// Do not store `admRef` (even as part of a closure!) on this object,\n// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.\ntype ObserverAdministration = {\n reaction: Reaction | null // also serves as disposed flag\n onStoreChange: Function | null // also serves as mounted flag\n // stateVersion that 'ticks' for every time the reaction fires\n // tearing is still present,\n // because there is no cross component synchronization,\n // but we can use `useSyncExternalStore` API.\n // TODO: optimize to use number?\n stateVersion: any\n name: string\n // These don't depend on state/props, therefore we can keep them here instead of `useCallback`\n subscribe: Parameters<typeof React.useSyncExternalStore>[0]\n getSnapshot: Parameters<typeof React.useSyncExternalStore>[1]\n}\n\nfunction createReaction(adm: ObserverAdministration) {\n adm.reaction = new Reaction(`observer${adm.name}`, () => {\n adm.stateVersion = Symbol()\n // onStoreChange won't be available until the component \"mounts\".\n // If state changes in between initial render and mount,\n // `useSyncExternalStore` should handle that by checking the state version and issuing update.\n adm.onStoreChange?.()\n })\n}\n\nexport function useObserver<T>(render: () => T, baseComponentName: string = \"observed\"): T {\n if (isUsingStaticRendering()) {\n return render()\n }\n\n const admRef = React.useRef<ObserverAdministration | null>(null)\n\n if (!admRef.current) {\n // First render\n const adm: ObserverAdministration = {\n reaction: null,\n onStoreChange: null,\n stateVersion: Symbol(),\n name: baseComponentName,\n subscribe(onStoreChange: () => void) {\n // Do NOT access admRef here!\n observerFinalizationRegistry.unregister(adm)\n adm.onStoreChange = onStoreChange\n if (!adm.reaction) {\n // We've lost our reaction and therefore all subscriptions, occurs when:\n // 1. Timer based finalization registry disposed reaction before component mounted.\n // 2. React \"re-mounts\" same component without calling render in between (typically <StrictMode>).\n // We have to recreate reaction and schedule re-render to recreate subscriptions,\n // even if state did not change.\n createReaction(adm)\n // `onStoreChange` won't force update if subsequent `getSnapshot` returns same value.\n // So we make sure that is not the case\n adm.stateVersion = Symbol()\n }\n\n return () => {\n // Do NOT access admRef here!\n adm.onStoreChange = null\n adm.reaction?.dispose()\n adm.reaction = null\n }\n },\n getSnapshot() {\n // Do NOT access admRef here!\n return adm.stateVersion\n }\n }\n\n admRef.current = adm\n }\n\n const adm = admRef.current!\n\n if (!adm.reaction) {\n // First render or reaction was disposed by registry before subscribe\n createReaction(adm)\n // StrictMode/ConcurrentMode/Suspense may mean that our component is\n // rendered and abandoned multiple times, so we need to track leaked\n // Reactions.\n observerFinalizationRegistry.register(admRef, adm, adm)\n }\n\n React.useDebugValue(adm.reaction!, printDebugValue)\n\n useSyncExternalStore(\n // Both of these must be stable, otherwise it would keep resubscribing every render.\n adm.subscribe,\n adm.getSnapshot,\n adm.getSnapshot\n )\n\n // render the original component, but have the\n // reaction track the observables, so that rendering\n // can be invalidated (see above) once a dependency changes\n let renderResult!: T\n let exception\n adm.reaction!.track(() => {\n try {\n renderResult = render()\n } catch (e) {\n exception = e\n }\n })\n\n if (exception) {\n throw exception // re-throw any exceptions caught during rendering\n }\n\n return renderResult\n}\n","import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n ? Symbol.for(\"react.forward_ref\")\n : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n ? Symbol.for(\"react.memo\")\n : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\nexport interface IObserverOptions {\n readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n options: IObserverOptions & { forwardRef: true }\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n baseComponent: React.FunctionComponent<P>,\n options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<\n C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n Options extends IObserverOptions\n>(\n baseComponent: C,\n options?: Options\n): Options extends { forwardRef: true }\n ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n ? C &\n React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n >\n : never /* forwardRef set for a non forwarding component */\n : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n baseComponent:\n | React.ForwardRefRenderFunction<TRef, P>\n | React.FunctionComponent<P>\n | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n // TODO remove in next major\n options?: IObserverOptions\n) {\n if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n warnObserverOptionsDeprecated = false\n console.warn(\n `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n )\n }\n\n if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n throw new Error(\n `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n )\n }\n\n // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n if (isUsingStaticRendering()) {\n return baseComponent\n }\n\n let useForwardRef = options?.forwardRef ?? false\n let render = baseComponent\n\n const baseComponentName = baseComponent.displayName || baseComponent.name\n\n // If already wrapped with forwardRef, unwrap,\n // so we can patch render and apply memo\n if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n useForwardRef = true\n render = baseComponent[\"render\"]\n if (typeof render !== \"function\") {\n throw new Error(\n `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n )\n }\n }\n\n let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n return useObserver(() => render(props, ref), baseComponentName)\n }\n\n // Inherit original name and displayName, see #3438\n ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n if (isFunctionNameConfigurable) {\n Object.defineProperty(observerComponent, \"name\", {\n value: baseComponent.name,\n writable: true,\n configurable: true\n })\n }\n\n // Support legacy context: `contextTypes` must be applied before `memo`\n if ((baseComponent as any).contextTypes) {\n ;(observerComponent as React.FunctionComponent).contextTypes = (\n baseComponent as any\n ).contextTypes\n }\n\n if (useForwardRef) {\n // `forwardRef` must be applied prior `memo`\n // `forwardRef(observer(cmp))` throws:\n // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n observerComponent = forwardRef(observerComponent)\n }\n\n // memo; we are not interested in deep updates\n // in props; we assume that if deep objects are changed,\n // this is in observables, which would have been tracked anyway\n observerComponent = memo(observerComponent)\n\n copyStaticProperties(baseComponent, observerComponent)\n\n if (\"production\" !== process.env.NODE_ENV) {\n Object.defineProperty(observerComponent, \"contextTypes\", {\n set() {\n throw new Error(\n `[mobx-react-lite] \\`${\n this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n }.contextTypes\\` must be set before applying \\`observer\\`.`\n )\n }\n })\n }\n\n return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n $$typeof: true,\n render: true,\n compare: true,\n type: true,\n // Don't redefine `displayName`,\n // it's defined as getter-setter pair on `memo` (see #3192).\n displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n Object.keys(base).forEach(key => {\n if (!hoistBlackList[key]) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n }\n })\n}\n","import { useObserver } from \"./useObserver\"\n\ninterface IObserverProps {\n children?(): React.ReactElement | null\n render?(): React.ReactElement | null\n}\n\nfunction ObserverComponent({ children, render }: IObserverProps) {\n const component = children || render\n if (typeof component !== \"function\") {\n return null\n }\n return useObserver(component)\n}\nif (\"production\" !== process.env.NODE_ENV) {\n ObserverComponent.propTypes = {\n children: ObserverPropsCheck,\n render: ObserverPropsCheck\n }\n}\nObserverComponent.displayName = \"Observer\"\n\nexport { ObserverComponent as Observer }\n\nfunction ObserverPropsCheck(\n props: { [k: string]: any },\n key: string,\n componentName: string,\n location: any,\n propFullName: string\n) {\n const extraKey = key === \"children\" ? \"render\" : \"children\"\n const hasProp = typeof props[key] === \"function\"\n const hasExtraProp = typeof props[extraKey] === \"function\"\n if (hasProp && hasExtraProp) {\n return new Error(\n \"MobX Observer: Do not use children and render in the same time in`\" + componentName\n )\n }\n\n if (hasProp || hasExtraProp) {\n return null\n }\n return new Error(\n \"Invalid prop `\" +\n propFullName +\n \"` of type `\" +\n typeof props[key] +\n \"` supplied to\" +\n \" `\" +\n componentName +\n \"`, expected `function`.\"\n )\n}\n","import { useDeprecated } from \"./utils/utils\"\nimport { observable, runInAction } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useAsObservableSource<TSource extends object>(current: TSource): TSource {\n if (\"production\" !== process.env.NODE_ENV)\n useDeprecated(\n \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\"\n )\n // We're deliberately not using idiomatic destructuring for the hook here.\n // Accessing the state value as an array element prevents TypeScript from generating unnecessary helpers in the resulting code.\n // For further details, please refer to mobxjs/mobx#3842.\n const res = useState(() => observable(current, {}, { deep: false }))[0]\n runInAction(() => {\n Object.assign(res, current)\n })\n return res\n}\n","import \"./utils/assertEnvironment\"\n\nimport { unstable_batchedUpdates as batch } from \"./utils/reactBatchedUpdates\"\nimport { observerBatching } from \"./utils/observerBatching\"\nimport { useDeprecated } from \"./utils/utils\"\nimport { useObserver as useObserverOriginal } from \"./useObserver\"\nimport { enableStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\nobserverBatching(batch)\n\nexport { isUsingStaticRendering, enableStaticRendering } from \"./staticRendering\"\nexport { observer, IObserverOptions } from \"./observer\"\nexport { Observer } from \"./ObserverComponent\"\nexport { useLocalObservable } from \"./useLocalObservable\"\nexport { useLocalStore } from \"./useLocalStore\"\nexport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport { observerFinalizationRegistry as _observerFinalizationRegistry }\nexport const clearTimers = observerFinalizationRegistry[\"finalizeAllImmediately\"] ?? (() => {})\n\nexport function useObserver<T>(fn: () => T, baseComponentName: string = \"observed\"): T {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`.\"\n )\n }\n return useObserverOriginal(fn, baseComponentName)\n}\n\nexport { isObserverBatched, observerBatching } from \"./utils/observerBatching\"\n\nexport function useStaticRendering(enable: boolean) {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead\"\n )\n }\n enableStaticRendering(enable)\n}\n","import { observable, AnnotationsMap } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useLocalObservable<TStore extends Record<string, any>>(\n initializer: () => TStore,\n annotations?: AnnotationsMap<TStore, never>\n): TStore {\n return useState(() => observable(initializer(), annotations, { autoBind: true }))[0]\n}\n","import { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nimport { useDeprecated } from \"./utils/utils\"\nimport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport function useLocalStore<TStore extends Record<string, any>>(initializer: () => TStore): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source: TSource) => TStore,\n current: TSource\n): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source?: TSource) => TStore,\n current?: TSource\n): TStore {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\"\n )\n }\n const source = current && useAsObservableSource(current)\n return useState(() => observable(initializer(source), undefined, { autoBind: true }))[0]\n}\n"],"names":["useState","Error","makeObservable","defaultNoopBatch","callback","observerBatching","reactionScheduler","configure","printDebugValue","v","getDependencyTree","globalIsUsingStaticRendering","enableStaticRendering","enable","isUsingStaticRendering","observerFinalizationRegistry","FinalizationRegistry","TimerBasedFinalizationRegistry","finalize","registrations","Map","this","sweepTimeout","sweep","maxAge","clearTimeout","_this","undefined","now","Date","forEach","registration","token","registeredAt","value","size","scheduleSweep","finalizeAllImmediately","_proto","prototype","register","target","set","unregister","setTimeout","adm","_adm$reaction","reaction","dispose","createReaction","Reaction","name","stateVersion","Symbol","onStoreChange","useObserver","render","baseComponentName","admRef","React","useRef","current","subscribe","getSnapshot","renderResult","exception","useDebugValue","useSyncExternalStore","track","e","hasSymbol","isFunctionNameConfigurable","_Object$getOwnPropert","_Object$getOwnPropert2","Object","getOwnPropertyDescriptor","configurable","ReactForwardRefSymbol","forwardRef","props","ReactMemoSymbol","memo","hoistBlackList","$$typeof","compare","type","displayName","ObserverComponent","_ref","component","children","useAsObservableSource","res","observable","deep","runInAction","assign","batch","clearTimers","_observerFinalization","baseComponent","options","useForwardRef","_options$forwardRef","base","observerComponent","ref","defineProperty","writable","contextTypes","keys","key","initializer","annotations","autoBind","source","fn","useObserverOriginal"],"mappings":"4aAGA,IAAKA,WACD,MAAM,IAAIC,MAAM,qDAEpB,IAAKC,iBACD,MAAM,IAAID,MAAM,+ECLJE,EAAiBC,GAC7BA,aAGYC,EAAiBC,GACxBA,IACDA,EAAoBH,GAOxBI,YAAU,CAAED,kBAAAA,aCbAE,EAAgBC,GAC5B,OAAOC,oBAAkBD,GCH7B,IAAIE,GAA+B,WAEnBC,EAAsBC,GAClCF,EAA+BE,WAGnBC,IACZ,OAAOH,ECCJ,QCLMI,EAA+B,ID2DR,oBAAzBC,qBACDA,gCAhDN,SAAAC,EAA6BC,mBAAAA,qBAHrBC,cAAkE,IAAIC,IAAKC,KAC3EC,oBAAYD,KAkBpBE,MAAQ,SAACC,YAAAA,IAAAA,EAvB0B,KAyB/BC,aAAaC,EAAKJ,cAClBI,EAAKJ,kBAAeK,EAEpB,IAAMC,EAAMC,KAAKD,MACjBF,EAAKP,cAAcW,SAAQ,SAACC,EAAcC,GAClCJ,EAAMG,EAAaE,cAAgBT,IACnCE,EAAKR,SAASa,EAAaG,OAC3BR,EAAKP,qBAAqBa,OAI9BN,EAAKP,cAAcgB,KAAO,GAC1BT,EAAKU,iBAEZf,KAGDgB,uBAAyB,WACrBX,EAAKH,MAAM,IApCcF,cAAAH,EAE7B,IAAAoB,EAAArB,EAAAsB,UAyCC,OAzCDD,EACAE,SAAA,SAASC,EAAgBP,EAAUF,GAC/BX,KAAKF,cAAcuB,IAAIV,EAAO,CAC1BE,MAAAA,EACAD,aAAcJ,KAAKD,QAEvBP,KAAKe,iBACRE,EAEDK,WAAA,SAAWX,GACPX,KAAKF,qBAAqBa,IAG9BM,EAwBQF,cAAA,gBACsBT,IAAtBN,KAAKC,eACLD,KAAKC,aAAesB,WAAWvB,KAAKE,MA/CT,OAiDlC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J,EA4BgB3D,EA5BDgE,EA6BpC/B,OAAOoC,KAAKN,GAAM1E,SAAQ,SAAAiF,GACjB7B,EAAe6B,IAChBrC,OAAOiC,eAAelE,EAAQsE,EAAKrC,OAAOC,yBAAyB6B,EAAMO,OAjB1EN,gFIrJPO,EACAC,GAEA,OAAOjH,YAAS,WAAA,OAAM6F,aAAWmB,IAAeC,EAAa,CAAEC,UAAU,OAAS,6BCKlFF,EACAnD,GAOA,IAAMsD,EAAStD,GAAW8B,EAAsB9B,GAChD,OAAO7D,YAAS,WAAA,OAAM6F,aAAWmB,EAAYG,QAASxF,EAAW,CAAEuF,UAAU,OAAS,2BFA3DE,EAAa3D,GAMxC,gBANwCA,IAAAA,EAA4B,YAM7D4D,EAAoBD,EAAI3D,kCAKA5C,GAM/BD,EAAsBC"}
\ No newline at end of file
+{"version":3,"file":"mobxreactlite.umd.production.min.js","sources":["../src/utils/assertEnvironment.ts","../src/utils/observerBatching.ts","../src/utils/printDebugValue.ts","../src/staticRendering.ts","../src/utils/UniversalFinalizationRegistry.ts","../src/utils/observerFinalizationRegistry.ts","../src/useObserver.ts","../src/observer.ts","../src/ObserverComponent.ts","../src/useAsObservableSource.ts","../src/index.ts","../src/useLocalObservable.ts","../src/useLocalStore.ts"],"sourcesContent":["import { makeObservable } from \"mobx\"\nimport { useState } from \"react\"\n\nif (!useState) {\n throw new Error(\"mobx-react-lite requires React with Hooks support\")\n}\nif (!makeObservable) {\n throw new Error(\"mobx-react-lite@3 requires mobx at least version 6 to be available\")\n}\n","import { configure } from \"mobx\"\n\nexport function defaultNoopBatch(callback: () => void) {\n callback()\n}\n\nexport function observerBatching(reactionScheduler: any) {\n if (!reactionScheduler) {\n reactionScheduler = defaultNoopBatch\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[MobX] Failed to get unstable_batched updates from react-dom / react-native\"\n )\n }\n }\n configure({ reactionScheduler })\n}\n\nexport const isObserverBatched = () => {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\"[MobX] Deprecated\")\n }\n\n return true\n}\n","import { getDependencyTree, Reaction } from \"mobx\"\n\nexport function printDebugValue(v: Reaction) {\n return getDependencyTree(v)\n}\n","let globalIsUsingStaticRendering = false\n\nexport function enableStaticRendering(enable: boolean) {\n globalIsUsingStaticRendering = enable\n}\n\nexport function isUsingStaticRendering(): boolean {\n return globalIsUsingStaticRendering\n}\n","export declare class FinalizationRegistryType<T> {\n constructor(finalize: (value: T) => void)\n register(target: object, value: T, token?: object): void\n unregister(token: object): void\n}\n\ndeclare const FinalizationRegistry: typeof FinalizationRegistryType | undefined\n\nexport const REGISTRY_FINALIZE_AFTER = 10_000\nexport const REGISTRY_SWEEP_INTERVAL = 10_000\n\nexport class TimerBasedFinalizationRegistry<T> implements FinalizationRegistryType<T> {\n private registrations: Map<unknown, { value: T; registeredAt: number }> = new Map()\n private sweepTimeout: ReturnType<typeof setTimeout> | undefined\n\n constructor(private readonly finalize: (value: T) => void) {}\n\n // Token is actually required with this impl\n register(target: object, value: T, token?: object) {\n this.registrations.set(token, {\n value,\n registeredAt: Date.now()\n })\n this.scheduleSweep()\n }\n\n unregister(token: unknown) {\n this.registrations.delete(token)\n }\n\n // Bound so it can be used directly as setTimeout callback.\n sweep = (maxAge = REGISTRY_FINALIZE_AFTER) => {\n // cancel timeout so we can force sweep anytime\n clearTimeout(this.sweepTimeout)\n this.sweepTimeout = undefined\n\n const now = Date.now()\n this.registrations.forEach((registration, token) => {\n if (now - registration.registeredAt >= maxAge) {\n this.finalize(registration.value)\n this.registrations.delete(token)\n }\n })\n\n if (this.registrations.size > 0) {\n this.scheduleSweep()\n }\n }\n\n // Bound so it can be exported directly as clearTimers test utility.\n finalizeAllImmediately = () => {\n this.sweep(0)\n }\n\n private scheduleSweep() {\n if (this.sweepTimeout === undefined) {\n this.sweepTimeout = setTimeout(this.sweep, REGISTRY_SWEEP_INTERVAL)\n }\n }\n}\n\nexport const UniversalFinalizationRegistry =\n typeof FinalizationRegistry !== \"undefined\"\n ? FinalizationRegistry\n : TimerBasedFinalizationRegistry\n","import { Reaction } from \"mobx\"\nimport { UniversalFinalizationRegistry } from \"./UniversalFinalizationRegistry\"\n\nexport const observerFinalizationRegistry = new UniversalFinalizationRegistry(\n (adm: { reaction: Reaction | null }) => {\n adm.reaction?.dispose()\n adm.reaction = null\n }\n)\n","import { Reaction } from \"mobx\"\nimport React from \"react\"\nimport { printDebugValue } from \"./utils/printDebugValue\"\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\n// Do not store `admRef` (even as part of a closure!) on this object,\n// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.\ntype ObserverAdministration = {\n reaction: Reaction | null // also serves as disposed flag\n onStoreChange: Function | null // also serves as mounted flag\n // stateVersion that 'ticks' for every time the reaction fires\n // tearing is still present,\n // because there is no cross component synchronization,\n // but we can use `useSyncExternalStore` API.\n // TODO: optimize to use number?\n stateVersion: any\n name: string\n // These don't depend on state/props, therefore we can keep them here instead of `useCallback`\n subscribe: Parameters<typeof React.useSyncExternalStore>[0]\n getSnapshot: Parameters<typeof React.useSyncExternalStore>[1]\n}\n\nfunction createReaction(adm: ObserverAdministration) {\n adm.reaction = new Reaction(`observer${adm.name}`, () => {\n adm.stateVersion = Symbol()\n // onStoreChange won't be available until the component \"mounts\".\n // If state changes in between initial render and mount,\n // `useSyncExternalStore` should handle that by checking the state version and issuing update.\n adm.onStoreChange?.()\n })\n}\n\nexport function useObserver<T>(render: () => T, baseComponentName: string = \"observed\"): T {\n if (isUsingStaticRendering()) {\n return render()\n }\n\n const admRef = React.useRef<ObserverAdministration | null>(null)\n\n if (!admRef.current) {\n // First render\n const adm: ObserverAdministration = {\n reaction: null,\n onStoreChange: null,\n stateVersion: Symbol(),\n name: baseComponentName,\n subscribe(onStoreChange: () => void) {\n // Do NOT access admRef here!\n observerFinalizationRegistry.unregister(adm)\n adm.onStoreChange = onStoreChange\n if (!adm.reaction) {\n // We've lost our reaction and therefore all subscriptions, occurs when:\n // 1. Timer based finalization registry disposed reaction before component mounted.\n // 2. React \"re-mounts\" same component without calling render in between (typically <StrictMode>).\n // We have to recreate reaction and schedule re-render to recreate subscriptions,\n // even if state did not change.\n createReaction(adm)\n // `onStoreChange` won't force update if subsequent `getSnapshot` returns same value.\n // So we make sure that is not the case\n adm.stateVersion = Symbol()\n }\n\n return () => {\n // Do NOT access admRef here!\n adm.onStoreChange = null\n adm.reaction?.dispose()\n adm.reaction = null\n }\n },\n getSnapshot() {\n // Do NOT access admRef here!\n return adm.stateVersion\n }\n }\n\n admRef.current = adm\n }\n\n const adm = admRef.current!\n\n if (!adm.reaction) {\n // First render or reaction was disposed by registry before subscribe\n createReaction(adm)\n // StrictMode/ConcurrentMode/Suspense may mean that our component is\n // rendered and abandoned multiple times, so we need to track leaked\n // Reactions.\n observerFinalizationRegistry.register(admRef, adm, adm)\n }\n\n React.useDebugValue(adm.reaction!, printDebugValue)\n\n React.useSyncExternalStore(\n // Both of these must be stable, otherwise it would keep resubscribing every render.\n adm.subscribe,\n adm.getSnapshot,\n adm.getSnapshot\n )\n\n // render the original component, but have the\n // reaction track the observables, so that rendering\n // can be invalidated (see above) once a dependency changes\n let renderResult!: T\n let exception\n adm.reaction!.track(() => {\n try {\n renderResult = render()\n } catch (e) {\n exception = e\n }\n })\n\n if (exception) {\n throw exception // re-throw any exceptions caught during rendering\n }\n\n return renderResult\n}\n","import { forwardRef, memo } from \"react\"\n\nimport { isUsingStaticRendering } from \"./staticRendering\"\nimport { useObserver } from \"./useObserver\"\n\nlet warnObserverOptionsDeprecated = true\n\nconst hasSymbol = typeof Symbol === \"function\" && Symbol.for\nconst isFunctionNameConfigurable =\n Object.getOwnPropertyDescriptor(() => {}, \"name\")?.configurable ?? false\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol = hasSymbol\n ? Symbol.for(\"react.forward_ref\")\n : typeof forwardRef === \"function\" && forwardRef((props: any) => null)[\"$$typeof\"]\n\nconst ReactMemoSymbol = hasSymbol\n ? Symbol.for(\"react.memo\")\n : typeof memo === \"function\" && memo((props: any) => null)[\"$$typeof\"]\n\nexport interface IObserverOptions {\n readonly forwardRef?: boolean\n}\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefRenderFunction<TRef, P>,\n options: IObserverOptions & { forwardRef: true }\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object, TRef = {}>(\n baseComponent: React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n): React.MemoExoticComponent<\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>\n>\n\nexport function observer<P extends object>(\n baseComponent: React.FunctionComponent<P>,\n options?: IObserverOptions\n): React.FunctionComponent<P>\n\nexport function observer<\n C extends React.FunctionComponent<any> | React.ForwardRefRenderFunction<any>,\n Options extends IObserverOptions\n>(\n baseComponent: C,\n options?: Options\n): Options extends { forwardRef: true }\n ? C extends React.ForwardRefRenderFunction<infer TRef, infer P>\n ? C &\n React.MemoExoticComponent<\n React.ForwardRefExoticComponent<\n React.PropsWithoutRef<P> & React.RefAttributes<TRef>\n >\n >\n : never /* forwardRef set for a non forwarding component */\n : C & { displayName: string }\n\n// n.b. base case is not used for actual typings or exported in the typing files\nexport function observer<P extends object, TRef = {}>(\n baseComponent:\n | React.ForwardRefRenderFunction<TRef, P>\n | React.FunctionComponent<P>\n | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<TRef>>,\n // TODO remove in next major\n options?: IObserverOptions\n) {\n if (process.env.NODE_ENV !== \"production\" && warnObserverOptionsDeprecated && options) {\n warnObserverOptionsDeprecated = false\n console.warn(\n `[mobx-react-lite] \\`observer(fn, { forwardRef: true })\\` is deprecated, use \\`observer(React.forwardRef(fn))\\``\n )\n }\n\n if (ReactMemoSymbol && baseComponent[\"$$typeof\"] === ReactMemoSymbol) {\n throw new Error(\n `[mobx-react-lite] You are trying to use \\`observer\\` on a function component wrapped in either another \\`observer\\` or \\`React.memo\\`. The observer already applies 'React.memo' for you.`\n )\n }\n\n // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307\n if (isUsingStaticRendering()) {\n return baseComponent\n }\n\n let useForwardRef = options?.forwardRef ?? false\n let render = baseComponent\n\n const baseComponentName = baseComponent.displayName || baseComponent.name\n\n // If already wrapped with forwardRef, unwrap,\n // so we can patch render and apply memo\n if (ReactForwardRefSymbol && baseComponent[\"$$typeof\"] === ReactForwardRefSymbol) {\n useForwardRef = true\n render = baseComponent[\"render\"]\n if (typeof render !== \"function\") {\n throw new Error(\n `[mobx-react-lite] \\`render\\` property of ForwardRef was not a function`\n )\n }\n }\n\n let observerComponent = (props: any, ref: React.Ref<TRef>) => {\n return useObserver(() => render(props, ref), baseComponentName)\n }\n\n // Inherit original name and displayName, see #3438\n ;(observerComponent as React.FunctionComponent).displayName = baseComponent.displayName\n\n if (isFunctionNameConfigurable) {\n Object.defineProperty(observerComponent, \"name\", {\n value: baseComponent.name,\n writable: true,\n configurable: true\n })\n }\n\n // Support legacy context: `contextTypes` must be applied before `memo`\n if ((baseComponent as any).contextTypes) {\n ;(observerComponent as React.FunctionComponent).contextTypes = (\n baseComponent as any\n ).contextTypes\n }\n\n if (useForwardRef) {\n // `forwardRef` must be applied prior `memo`\n // `forwardRef(observer(cmp))` throws:\n // \"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))\"\n observerComponent = forwardRef(observerComponent)\n }\n\n // memo; we are not interested in deep updates\n // in props; we assume that if deep objects are changed,\n // this is in observables, which would have been tracked anyway\n observerComponent = memo(observerComponent)\n\n copyStaticProperties(baseComponent, observerComponent)\n\n if (\"production\" !== process.env.NODE_ENV) {\n Object.defineProperty(observerComponent, \"contextTypes\", {\n set() {\n throw new Error(\n `[mobx-react-lite] \\`${\n this.displayName || this.type?.displayName || this.type?.name || \"Component\"\n }.contextTypes\\` must be set before applying \\`observer\\`.`\n )\n }\n })\n }\n\n return observerComponent\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList: any = {\n $$typeof: true,\n render: true,\n compare: true,\n type: true,\n // Don't redefine `displayName`,\n // it's defined as getter-setter pair on `memo` (see #3192).\n displayName: true\n}\n\nfunction copyStaticProperties(base: any, target: any) {\n Object.keys(base).forEach(key => {\n if (!hoistBlackList[key]) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)!)\n }\n })\n}\n","import { useObserver } from \"./useObserver\"\n\ninterface IObserverProps {\n children?(): React.ReactElement | null\n render?(): React.ReactElement | null\n}\n\nfunction ObserverComponent({ children, render }: IObserverProps) {\n const component = children || render\n if (typeof component !== \"function\") {\n return null\n }\n return useObserver(component)\n}\nif (\"production\" !== process.env.NODE_ENV) {\n ObserverComponent.propTypes = {\n children: ObserverPropsCheck,\n render: ObserverPropsCheck\n }\n}\nObserverComponent.displayName = \"Observer\"\n\nexport { ObserverComponent as Observer }\n\nfunction ObserverPropsCheck(\n props: { [k: string]: any },\n key: string,\n componentName: string,\n location: any,\n propFullName: string\n) {\n const extraKey = key === \"children\" ? \"render\" : \"children\"\n const hasProp = typeof props[key] === \"function\"\n const hasExtraProp = typeof props[extraKey] === \"function\"\n if (hasProp && hasExtraProp) {\n return new Error(\n \"MobX Observer: Do not use children and render in the same time in`\" + componentName\n )\n }\n\n if (hasProp || hasExtraProp) {\n return null\n }\n return new Error(\n \"Invalid prop `\" +\n propFullName +\n \"` of type `\" +\n typeof props[key] +\n \"` supplied to\" +\n \" `\" +\n componentName +\n \"`, expected `function`.\"\n )\n}\n","import { useDeprecated } from \"./utils/utils\"\nimport { observable, runInAction } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useAsObservableSource<TSource extends object>(current: TSource): TSource {\n if (\"production\" !== process.env.NODE_ENV)\n useDeprecated(\n \"[mobx-react-lite] 'useAsObservableSource' is deprecated, please store the values directly in an observable, for example by using 'useLocalObservable', and sync future updates using 'useEffect' when needed. See the README for examples.\"\n )\n // We're deliberately not using idiomatic destructuring for the hook here.\n // Accessing the state value as an array element prevents TypeScript from generating unnecessary helpers in the resulting code.\n // For further details, please refer to mobxjs/mobx#3842.\n const res = useState(() => observable(current, {}, { deep: false }))[0]\n runInAction(() => {\n Object.assign(res, current)\n })\n return res\n}\n","import \"./utils/assertEnvironment\"\n\nimport { unstable_batchedUpdates as batch } from \"./utils/reactBatchedUpdates\"\nimport { observerBatching } from \"./utils/observerBatching\"\nimport { useDeprecated } from \"./utils/utils\"\nimport { useObserver as useObserverOriginal } from \"./useObserver\"\nimport { enableStaticRendering } from \"./staticRendering\"\nimport { observerFinalizationRegistry } from \"./utils/observerFinalizationRegistry\"\n\nobserverBatching(batch)\n\nexport { isUsingStaticRendering, enableStaticRendering } from \"./staticRendering\"\nexport { observer, IObserverOptions } from \"./observer\"\nexport { Observer } from \"./ObserverComponent\"\nexport { useLocalObservable } from \"./useLocalObservable\"\nexport { useLocalStore } from \"./useLocalStore\"\nexport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport { observerFinalizationRegistry as _observerFinalizationRegistry }\nexport const clearTimers = observerFinalizationRegistry[\"finalizeAllImmediately\"] ?? (() => {})\n\nexport function useObserver<T>(fn: () => T, baseComponentName: string = \"observed\"): T {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useObserver(fn)' is deprecated. Use `<Observer>{fn}</Observer>` instead, or wrap the entire component in `observer`.\"\n )\n }\n return useObserverOriginal(fn, baseComponentName)\n}\n\nexport { isObserverBatched, observerBatching } from \"./utils/observerBatching\"\n\nexport function useStaticRendering(enable: boolean) {\n if (\"production\" !== process.env.NODE_ENV) {\n console.warn(\n \"[mobx-react-lite] 'useStaticRendering' is deprecated, use 'enableStaticRendering' instead\"\n )\n }\n enableStaticRendering(enable)\n}\n","import { observable, AnnotationsMap } from \"mobx\"\nimport { useState } from \"react\"\n\nexport function useLocalObservable<TStore extends Record<string, any>>(\n initializer: () => TStore,\n annotations?: AnnotationsMap<TStore, never>\n): TStore {\n return useState(() => observable(initializer(), annotations, { autoBind: true }))[0]\n}\n","import { observable } from \"mobx\"\nimport { useState } from \"react\"\n\nimport { useDeprecated } from \"./utils/utils\"\nimport { useAsObservableSource } from \"./useAsObservableSource\"\n\nexport function useLocalStore<TStore extends Record<string, any>>(initializer: () => TStore): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source: TSource) => TStore,\n current: TSource\n): TStore\nexport function useLocalStore<TStore extends Record<string, any>, TSource extends object>(\n initializer: (source?: TSource) => TStore,\n current?: TSource\n): TStore {\n if (\"production\" !== process.env.NODE_ENV) {\n useDeprecated(\n \"[mobx-react-lite] 'useLocalStore' is deprecated, use 'useLocalObservable' instead.\"\n )\n }\n const source = current && useAsObservableSource(current)\n return useState(() => observable(initializer(source), undefined, { autoBind: true }))[0]\n}\n"],"names":["useState","Error","makeObservable","defaultNoopBatch","callback","observerBatching","reactionScheduler","configure","printDebugValue","v","getDependencyTree","globalIsUsingStaticRendering","enableStaticRendering","enable","isUsingStaticRendering","observerFinalizationRegistry","FinalizationRegistry","TimerBasedFinalizationRegistry","finalize","registrations","Map","this","sweepTimeout","sweep","maxAge","clearTimeout","_this","undefined","now","Date","forEach","registration","token","registeredAt","value","size","scheduleSweep","finalizeAllImmediately","_proto","prototype","register","target","set","unregister","setTimeout","adm","_adm$reaction","reaction","dispose","createReaction","Reaction","name","stateVersion","Symbol","onStoreChange","useObserver","render","baseComponentName","admRef","React","useRef","current","subscribe","getSnapshot","renderResult","exception","useDebugValue","useSyncExternalStore","track","e","hasSymbol","isFunctionNameConfigurable","_Object$getOwnPropert","_Object$getOwnPropert2","Object","getOwnPropertyDescriptor","configurable","ReactForwardRefSymbol","forwardRef","props","ReactMemoSymbol","memo","hoistBlackList","$$typeof","compare","type","displayName","ObserverComponent","_ref","component","children","useAsObservableSource","res","observable","deep","runInAction","assign","batch","clearTimers","_observerFinalization","baseComponent","options","useForwardRef","_options$forwardRef","base","observerComponent","ref","defineProperty","writable","contextTypes","keys","key","initializer","annotations","autoBind","source","fn","useObserverOriginal"],"mappings":"4VAGA,IAAKA,WACD,MAAM,IAAIC,MAAM,qDAEpB,IAAKC,iBACD,MAAM,IAAID,MAAM,+ECLJE,EAAiBC,GAC7BA,aAGYC,EAAiBC,GACxBA,IACDA,EAAoBH,GAOxBI,YAAU,CAAED,kBAAAA,aCbAE,EAAgBC,GAC5B,OAAOC,oBAAkBD,GCH7B,IAAIE,GAA+B,WAEnBC,EAAsBC,GAClCF,EAA+BE,WAGnBC,IACZ,OAAOH,ECCJ,QCLMI,EAA+B,ID2DR,oBAAzBC,qBACDA,gCAhDN,SAAAC,EAA6BC,mBAAAA,qBAHrBC,cAAkE,IAAIC,IAAKC,KAC3EC,oBAAYD,KAkBpBE,MAAQ,SAACC,YAAAA,IAAAA,EAvB0B,KAyB/BC,aAAaC,EAAKJ,cAClBI,EAAKJ,kBAAeK,EAEpB,IAAMC,EAAMC,KAAKD,MACjBF,EAAKP,cAAcW,SAAQ,SAACC,EAAcC,GAClCJ,EAAMG,EAAaE,cAAgBT,IACnCE,EAAKR,SAASa,EAAaG,OAC3BR,EAAKP,qBAAqBa,OAI9BN,EAAKP,cAAcgB,KAAO,GAC1BT,EAAKU,iBAEZf,KAGDgB,uBAAyB,WACrBX,EAAKH,MAAM,IApCcF,cAAAH,EAE7B,IAAAoB,EAAArB,EAAAsB,UAyCC,OAzCDD,EACAE,SAAA,SAASC,EAAgBP,EAAUF,GAC/BX,KAAKF,cAAcuB,IAAIV,EAAO,CAC1BE,MAAAA,EACAD,aAAcJ,KAAKD,QAEvBP,KAAKe,iBACRE,EAEDK,WAAA,SAAWX,GACPX,KAAKF,qBAAqBa,IAG9BM,EAwBQF,cAAA,gBACsBT,IAAtBN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P,IAIAG,EAAoB3B,aAAW2B,IAMnCA,EAAoBxB,OAAKwB,GA8BCD,EA5BLJ,EA4BgB3D,EA5BDgE,EA6BpC/B,OAAOoC,KAAKN,GAAM1E,SAAQ,SAAAiF,GACjB7B,EAAe6B,IAChBrC,OAAOiC,eAAelE,EAAQsE,EAAKrC,OAAOC,yBAAyB6B,EAAMO,OAjB1EN,gFIrJPO,EACAC,GAEA,OAAOjH,YAAS,WAAA,OAAM6F,aAAWmB,IAAeC,EAAa,CAAEC,UAAU,OAAS,6BCKlFF,EACAnD,GAOA,IAAMsD,EAAStD,GAAW8B,EAAsB9B,GAChD,OAAO7D,YAAS,WAAA,OAAM6F,aAAWmB,EAAYG,QAASxF,EAAW,CAAEuF,UAAU,OAAS,2BFA3DE,EAAa3D,GAMxC,gBANwCA,IAAAA,EAA4B,YAM7D4D,EAAoBD,EAAI3D,kCAKA5C,GAM/BD,EAAsBC"}
\ No newline at end of file
diff --git a/es/useObserver.js b/es/useObserver.js
index e99f59ec8a3ec869f54d98d05192e2806794b8ce..131cd1ed4e3927c8facab0c03debc9fd7ad903f1 100644
--- a/es/useObserver.js
+++ b/es/useObserver.js
@@ -3,7 +3,6 @@ import React from "react";
import { printDebugValue } from "./utils/printDebugValue";
import { isUsingStaticRendering } from "./staticRendering";
import { observerFinalizationRegistry } from "./utils/observerFinalizationRegistry";
-import { useSyncExternalStore } from "use-sync-external-store/shim";
function createReaction(adm) {
adm.reaction = new Reaction("observer".concat(adm.name), function () {
var _a;
@@ -67,7 +66,7 @@ export function useObserver(render, baseComponentName) {
observerFinalizationRegistry.register(admRef, adm, adm);
}
React.useDebugValue(adm.reaction, printDebugValue);
- useSyncExternalStore(
+ React.useSyncExternalStore(
// Both of these must be stable, otherwise it would keep resubscribing every render.
adm.subscribe, adm.getSnapshot, adm.getSnapshot);
// render the original component, but have the
diff --git a/es/useObserver.js.map b/es/useObserver.js.map
index 9a5459bd6cf857f59a159ef35564c810ef02213c..b4dea2c626eaa9e10591d35ce1ac1a6806b75615 100644
--- a/es/useObserver.js.map
+++ b/es/useObserver.js.map
@@ -1 +1 @@
-{"version":3,"file":"useObserver.js","sourceRoot":"","sources":["../src/useObserver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAC/B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAA;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AAmBnE,SAAS,cAAc,CAAC,GAA2B;IAC/C,GAAG,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,kBAAW,GAAG,CAAC,IAAI,CAAE,EAAE;;QAC/C,GAAG,CAAC,YAAY,GAAG,MAAM,EAAE,CAAA;QAC3B,iEAAiE;QACjE,wDAAwD;QACxD,8FAA8F;QAC9F,MAAA,GAAG,CAAC,aAAa,mDAAI,CAAA;IACzB,CAAC,CAAC,CAAA;AACN,CAAC;AAED,MAAM,UAAU,WAAW,CAAI,MAAe,EAAE,iBAAsC;IAAtC,kCAAA,EAAA,8BAAsC;IAClF,IAAI,sBAAsB,EAAE,EAAE;QAC1B,OAAO,MAAM,EAAE,CAAA;KAClB;IAED,IAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAgC,IAAI,CAAC,CAAA;IAEhE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACjB,eAAe;QACf,IAAM,KAAG,GAA2B;YAChC,QAAQ,EAAE,IAAI;YACd,aAAa,EAAE,IAAI;YACnB,YAAY,EAAE,MAAM,EAAE;YACtB,IAAI,EAAE,iBAAiB;YACvB,SAAS,YAAC,aAAyB;gBAC/B,6BAA6B;gBAC7B,4BAA4B,CAAC,UAAU,CAAC,KAAG,CAAC,CAAA;gBAC5C,K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C3D,IAAI,YAAgB,CAAA;IACpB,IAAI,SAAS,CAAA;IACb,GAAG,CAAC,QAAS,CAAC,KAAK,CAAC;QAChB,IAAI;YACA,YAAY,GAAG,MAAM,EAAE,CAAA;SAC1B;QAAC,OAAO,CAAC,EAAE;YACR,SAAS,GAAG,CAAC,CAAA;SAChB;IACL,CAAC,CAAC,CAAA;IAEF,IAAI,SAAS,EAAE;QACX,MAAM,SAAS,CAAA,CAAC,kDAAkD;KACrE;IAED,OAAO,YAAY,CAAA;AACvB,CAAC"}
\ No newline at end of file
diff --git a/lib/useObserver.js b/lib/useObserver.js
index c996a3be4083eb508cc36e07d4e8496c21a2b007..fdbaa846627ee36eebbab36cf8a2bac33e40e543 100644
--- a/lib/useObserver.js
+++ b/lib/useObserver.js
@@ -9,7 +9,6 @@ var react_1 = __importDefault(require("react"));
var printDebugValue_1 = require("./utils/printDebugValue");
var staticRendering_1 = require("./staticRendering");
var observerFinalizationRegistry_1 = require("./utils/observerFinalizationRegistry");
-var shim_1 = require("use-sync-external-store/shim");
function createReaction(adm) {
adm.reaction = new mobx_1.Reaction("observer".concat(adm.name), function () {
var _a;
@@ -73,7 +72,7 @@ function useObserver(render, baseComponentName) {
observerFinalizationRegistry_1.observerFinalizationRegistry.register(admRef, adm, adm);
}
react_1.default.useDebugValue(adm.reaction, printDebugValue_1.printDebugValue);
- (0, shim_1.useSyncExternalStore)(
+ react_1.default.useSyncExternalStore(
// Both of these must be stable, otherwise it would keep resubscribing every render.
adm.subscribe, adm.getSnapshot, adm.getSnapshot);
// render the original component, but have the
diff --git a/lib/useObserver.js.map b/lib/useObserver.js.map
index d98b25aab146358111d070560e8b298999a35e23..6d5f681a020263235c4edff23358b4e3c3c20841 100644
--- a/lib/useObserver.js.map
+++ b/lib/useObserver.js.map
@@ -1 +1 @@
-{"version":3,"file":"useObserver.js","sourceRoot":"","sources":["../src/useObserver.ts"],"names":[],"mappings":";;;;;;AAAA,6BAA+B;AAC/B,gDAAyB;AACzB,2DAAy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Q,0CAAE,OAAO,EAAE,CAAA;oBACvB,KAAG,CAAC,QAAQ,GAAG,IAAI,CAAA;gBACvB,CAAC,CAAA;YACL,CAAC;YACD,WAAW;gBACP,6BAA6B;gBAC7B,OAAO,KAAG,CAAC,YAAY,CAAA;YAC3B,CAAC;SACJ,CAAA;QAED,MAAM,CAAC,OAAO,GAAG,KAAG,CAAA;KACvB;IAED,IAAM,GAAG,GAAG,MAAM,CAAC,OAAQ,CAAA;IAE3B,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE;QACf,qEAAqE;QACrE,cAAc,CAAC,GAAG,CAAC,CAAA;QACnB,oEAAoE;QACpE,oEAAoE;QACpE,aAAa;QACb,2DAA4B,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;KAC1D;IAED,eAAK,CAAC,aAAa,CAAC,GAAG,CAAC,QAAS,EAAE,iCAAe,CAAC,CAAA;IAEnD,IAAA,2BAAoB;IAChB,oFAAoF;IACpF,GAAG,CAAC,SAAS,EACb,GAAG,CAAC,WAAW,EACf,GAAG,CAAC,WAAW,CAClB,CAAA;IAED,8CAA8C;IAC9C,oDAAoD;IACpD,2DAA2D;IAC3D,IAAI,YAAgB,CAAA;IACpB,IAAI,SAAS,CAAA;IACb,GAAG,CAAC,QAAS,CAAC,KAAK,CAAC;QAChB,IAAI;YACA,YAAY,GAAG,MAAM,EAAE,CAAA;SAC1B;QAAC,OAAO,CAAC,EAAE;YACR,SAAS,GAAG,CAAC,CAAA;SAChB;IACL,CAAC,CAAC,CAAA;IAEF,IAAI,SAAS,EAAE;QACX,MAAM,SAAS,CAAA,CAAC,kDAAkD;KACrE;IAED,OAAO,YAAY,CAAA;AACvB,CAAC;AApFD,kCAoFC"}
\ No newline at end of file
+{"version":3,"file":"useObserver.js","sourceRoot":"","sources":["../src/useObserver.ts"],"names":[],"mappings":";;;;;;AAAA,6BAA+B;AAC/B,gDAAyB;AACzB,2DAAyD;AACzD,qDAA0D;AAC1D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AAG,CAAC,QAAQ,GAAG,IAAI,CAAA;gBACvB,CAAC,CAAA;YACL,CAAC;YACD,WAAW;gBACP,6BAA6B;gBAC7B,OAAO,KAAG,CAAC,YAAY,CAAA;YAC3B,CAAC;SACJ,CAAA;QAED,MAAM,CAAC,OAAO,GAAG,KAAG,CAAA;KACvB;IAED,IAAM,GAAG,GAAG,MAAM,CAAC,OAAQ,CAAA;IAE3B,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE;QACf,qEAAqE;QACrE,cAAc,CAAC,GAAG,CAAC,CAAA;QACnB,oEAAoE;QACpE,oEAAoE;QACpE,aAAa;QACb,2DAA4B,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;KAC1D;IAED,eAAK,CAAC,aAAa,CAAC,GAAG,CAAC,QAAS,EAAE,iCAAe,CAAC,CAAA;IAEnD,eAAK,CAAC,oBAAoB;IACtB,oFAAoF;IACpF,GAAG,CAAC,SAAS,EACb,GAAG,CAAC,WAAW,EACf,GAAG,CAAC,WAAW,CAClB,CAAA;IAED,8CAA8C;IAC9C,oDAAoD;IACpD,2DAA2D;IAC3D,IAAI,YAAgB,CAAA;IACpB,IAAI,SAAS,CAAA;IACb,GAAG,CAAC,QAAS,CAAC,KAAK,CAAC;QAChB,IAAI;YACA,YAAY,GAAG,MAAM,EAAE,CAAA;SAC1B;QAAC,OAAO,CAAC,EAAE;YACR,SAAS,GAAG,CAAC,CAAA;SAChB;IACL,CAAC,CAAC,CAAA;IAEF,IAAI,SAAS,EAAE;QACX,MAAM,SAAS,CAAA,CAAC,kDAAkD;KACrE;IAED,OAAO,YAAY,CAAA;AACvB,CAAC;AApFD,kCAoFC"}
\ No newline at end of file
diff --git a/src/useObserver.ts b/src/useObserver.ts
index 886073467f09c6929a14fb553ad37a311300ee22..44324b6263d96a35607c72ba005a500a81904bd9 100644
--- a/src/useObserver.ts
+++ b/src/useObserver.ts
@@ -3,7 +3,6 @@ import React from "react"
import { printDebugValue } from "./utils/printDebugValue"
import { isUsingStaticRendering } from "./staticRendering"
import { observerFinalizationRegistry } from "./utils/observerFinalizationRegistry"
-import { useSyncExternalStore } from "use-sync-external-store/shim"
// Do not store `admRef` (even as part of a closure!) on this object,
// otherwise it will prevent GC and therefore reaction disposal via FinalizationRegistry.
@@ -91,7 +90,7 @@ export function useObserver<T>(render: () => T, baseComponentName: string = "obs
React.useDebugValue(adm.reaction!, printDebugValue)
- useSyncExternalStore(
+ React.useSyncExternalStore(
// Both of these must be stable, otherwise it would keep resubscribing every render.
adm.subscribe,
adm.getSnapshot,