@vue/reactivity 3.5.17 → 3.6.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/reactivity v3.5.17
2
+ * @vue/reactivity v3.6.0-alpha.1
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -18,12 +18,6 @@ var VueReactivity = (function (exports) {
18
18
  const NOOP = () => {
19
19
  };
20
20
  const extend = Object.assign;
21
- const remove = (arr, el) => {
22
- const i = arr.indexOf(el);
23
- if (i > -1) {
24
- arr.splice(i, 1);
25
- }
26
- };
27
21
  const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
28
22
  const hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
29
23
  const isArray = Array.isArray;
@@ -64,631 +58,344 @@ var VueReactivity = (function (exports) {
64
58
  console.warn(`[Vue warn] ${msg}`, ...args);
65
59
  }
66
60
 
67
- let activeEffectScope;
68
- class EffectScope {
69
- constructor(detached = false) {
70
- this.detached = detached;
71
- /**
72
- * @internal
73
- */
74
- this._active = true;
75
- /**
76
- * @internal track `on` calls, allow `on` call multiple times
77
- */
78
- this._on = 0;
79
- /**
80
- * @internal
81
- */
82
- this.effects = [];
83
- /**
84
- * @internal
85
- */
86
- this.cleanups = [];
87
- this._isPaused = false;
88
- this.parent = activeEffectScope;
89
- if (!detached && activeEffectScope) {
90
- this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(
91
- this
92
- ) - 1;
93
- }
94
- }
95
- get active() {
96
- return this._active;
97
- }
98
- pause() {
99
- if (this._active) {
100
- this._isPaused = true;
101
- let i, l;
102
- if (this.scopes) {
103
- for (i = 0, l = this.scopes.length; i < l; i++) {
104
- this.scopes[i].pause();
105
- }
106
- }
107
- for (i = 0, l = this.effects.length; i < l; i++) {
108
- this.effects[i].pause();
109
- }
110
- }
111
- }
112
- /**
113
- * Resumes the effect scope, including all child scopes and effects.
114
- */
115
- resume() {
116
- if (this._active) {
117
- if (this._isPaused) {
118
- this._isPaused = false;
119
- let i, l;
120
- if (this.scopes) {
121
- for (i = 0, l = this.scopes.length; i < l; i++) {
122
- this.scopes[i].resume();
123
- }
124
- }
125
- for (i = 0, l = this.effects.length; i < l; i++) {
126
- this.effects[i].resume();
127
- }
128
- }
129
- }
130
- }
131
- run(fn) {
132
- if (this._active) {
133
- const currentEffectScope = activeEffectScope;
134
- try {
135
- activeEffectScope = this;
136
- return fn();
137
- } finally {
138
- activeEffectScope = currentEffectScope;
139
- }
140
- } else {
141
- warn(`cannot run an inactive effect scope.`);
142
- }
143
- }
144
- /**
145
- * This should only be called on non-detached scopes
146
- * @internal
147
- */
148
- on() {
149
- if (++this._on === 1) {
150
- this.prevScope = activeEffectScope;
151
- activeEffectScope = this;
152
- }
153
- }
154
- /**
155
- * This should only be called on non-detached scopes
156
- * @internal
157
- */
158
- off() {
159
- if (this._on > 0 && --this._on === 0) {
160
- activeEffectScope = this.prevScope;
161
- this.prevScope = void 0;
162
- }
163
- }
164
- stop(fromParent) {
165
- if (this._active) {
166
- this._active = false;
167
- let i, l;
168
- for (i = 0, l = this.effects.length; i < l; i++) {
169
- this.effects[i].stop();
170
- }
171
- this.effects.length = 0;
172
- for (i = 0, l = this.cleanups.length; i < l; i++) {
173
- this.cleanups[i]();
174
- }
175
- this.cleanups.length = 0;
176
- if (this.scopes) {
177
- for (i = 0, l = this.scopes.length; i < l; i++) {
178
- this.scopes[i].stop(true);
179
- }
180
- this.scopes.length = 0;
181
- }
182
- if (!this.detached && this.parent && !fromParent) {
183
- const last = this.parent.scopes.pop();
184
- if (last && last !== this) {
185
- this.parent.scopes[this.index] = last;
186
- last.index = this.index;
187
- }
188
- }
189
- this.parent = void 0;
190
- }
191
- }
192
- }
193
- function effectScope(detached) {
194
- return new EffectScope(detached);
195
- }
196
- function getCurrentScope() {
197
- return activeEffectScope;
198
- }
199
- function onScopeDispose(fn, failSilently = false) {
200
- if (activeEffectScope) {
201
- activeEffectScope.cleanups.push(fn);
202
- } else if (!failSilently) {
203
- warn(
204
- `onScopeDispose() is called when there is no active effect scope to be associated with.`
205
- );
206
- }
207
- }
208
-
209
- let activeSub;
210
- const EffectFlags = {
211
- "ACTIVE": 1,
212
- "1": "ACTIVE",
213
- "RUNNING": 2,
214
- "2": "RUNNING",
215
- "TRACKING": 4,
216
- "4": "TRACKING",
217
- "NOTIFIED": 8,
218
- "8": "NOTIFIED",
219
- "DIRTY": 16,
220
- "16": "DIRTY",
221
- "ALLOW_RECURSE": 32,
222
- "32": "ALLOW_RECURSE",
223
- "PAUSED": 64,
224
- "64": "PAUSED",
225
- "EVALUATED": 128,
226
- "128": "EVALUATED"
227
- };
228
- const pausedQueueEffects = /* @__PURE__ */ new WeakSet();
229
- class ReactiveEffect {
230
- constructor(fn) {
231
- this.fn = fn;
232
- /**
233
- * @internal
234
- */
235
- this.deps = void 0;
236
- /**
237
- * @internal
238
- */
239
- this.depsTail = void 0;
240
- /**
241
- * @internal
242
- */
243
- this.flags = 1 | 4;
244
- /**
245
- * @internal
246
- */
247
- this.next = void 0;
248
- /**
249
- * @internal
250
- */
251
- this.cleanup = void 0;
252
- this.scheduler = void 0;
253
- if (activeEffectScope && activeEffectScope.active) {
254
- activeEffectScope.effects.push(this);
255
- }
256
- }
257
- pause() {
258
- this.flags |= 64;
259
- }
260
- resume() {
261
- if (this.flags & 64) {
262
- this.flags &= -65;
263
- if (pausedQueueEffects.has(this)) {
264
- pausedQueueEffects.delete(this);
265
- this.trigger();
266
- }
267
- }
268
- }
269
- /**
270
- * @internal
271
- */
272
- notify() {
273
- if (this.flags & 2 && !(this.flags & 32)) {
274
- return;
275
- }
276
- if (!(this.flags & 8)) {
277
- batch(this);
278
- }
279
- }
280
- run() {
281
- if (!(this.flags & 1)) {
282
- return this.fn();
283
- }
284
- this.flags |= 2;
285
- cleanupEffect(this);
286
- prepareDeps(this);
287
- const prevEffect = activeSub;
288
- const prevShouldTrack = shouldTrack;
289
- activeSub = this;
290
- shouldTrack = true;
291
- try {
292
- return this.fn();
293
- } finally {
294
- if (activeSub !== this) {
295
- warn(
296
- "Active effect was not restored correctly - this is likely a Vue internal bug."
297
- );
298
- }
299
- cleanupDeps(this);
300
- activeSub = prevEffect;
301
- shouldTrack = prevShouldTrack;
302
- this.flags &= -3;
303
- }
304
- }
305
- stop() {
306
- if (this.flags & 1) {
307
- for (let link = this.deps; link; link = link.nextDep) {
308
- removeSub(link);
309
- }
310
- this.deps = this.depsTail = void 0;
311
- cleanupEffect(this);
312
- this.onStop && this.onStop();
313
- this.flags &= -2;
314
- }
315
- }
316
- trigger() {
317
- if (this.flags & 64) {
318
- pausedQueueEffects.add(this);
319
- } else if (this.scheduler) {
320
- this.scheduler();
321
- } else {
322
- this.runIfDirty();
323
- }
324
- }
325
- /**
326
- * @internal
327
- */
328
- runIfDirty() {
329
- if (isDirty(this)) {
330
- this.run();
331
- }
332
- }
333
- get dirty() {
334
- return isDirty(this);
335
- }
336
- }
61
+ var ReactiveFlags$1 = /* @__PURE__ */ ((ReactiveFlags2) => {
62
+ ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
63
+ ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
64
+ ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
65
+ ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
66
+ ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
67
+ ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
68
+ ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
69
+ return ReactiveFlags2;
70
+ })(ReactiveFlags$1 || {});
71
+ const notifyBuffer = [];
337
72
  let batchDepth = 0;
338
- let batchedSub;
339
- let batchedComputed;
340
- function batch(sub, isComputed = false) {
341
- sub.flags |= 8;
342
- if (isComputed) {
343
- sub.next = batchedComputed;
344
- batchedComputed = sub;
345
- return;
73
+ let activeSub = void 0;
74
+ let notifyIndex = 0;
75
+ let notifyBufferLength = 0;
76
+ function setActiveSub(sub) {
77
+ try {
78
+ return activeSub;
79
+ } finally {
80
+ activeSub = sub;
346
81
  }
347
- sub.next = batchedSub;
348
- batchedSub = sub;
349
82
  }
350
83
  function startBatch() {
351
- batchDepth++;
84
+ ++batchDepth;
352
85
  }
353
86
  function endBatch() {
354
- if (--batchDepth > 0) {
355
- return;
356
- }
357
- if (batchedComputed) {
358
- let e = batchedComputed;
359
- batchedComputed = void 0;
360
- while (e) {
361
- const next = e.next;
362
- e.next = void 0;
363
- e.flags &= -9;
364
- e = next;
365
- }
366
- }
367
- let error;
368
- while (batchedSub) {
369
- let e = batchedSub;
370
- batchedSub = void 0;
371
- while (e) {
372
- const next = e.next;
373
- e.next = void 0;
374
- e.flags &= -9;
375
- if (e.flags & 1) {
376
- try {
377
- ;
378
- e.trigger();
379
- } catch (err) {
380
- if (!error) error = err;
381
- }
382
- }
383
- e = next;
384
- }
385
- }
386
- if (error) throw error;
387
- }
388
- function prepareDeps(sub) {
389
- for (let link = sub.deps; link; link = link.nextDep) {
390
- link.version = -1;
391
- link.prevActiveLink = link.dep.activeLink;
392
- link.dep.activeLink = link;
87
+ if (!--batchDepth && notifyBufferLength) {
88
+ flush();
393
89
  }
394
90
  }
395
- function cleanupDeps(sub) {
396
- let head;
397
- let tail = sub.depsTail;
398
- let link = tail;
399
- while (link) {
400
- const prev = link.prevDep;
401
- if (link.version === -1) {
402
- if (link === tail) tail = prev;
403
- removeSub(link);
404
- removeDep(link);
405
- } else {
406
- head = link;
407
- }
408
- link.dep.activeLink = link.prevActiveLink;
409
- link.prevActiveLink = void 0;
410
- link = prev;
91
+ function link(dep, sub) {
92
+ const prevDep = sub.depsTail;
93
+ if (prevDep !== void 0 && prevDep.dep === dep) {
94
+ return;
411
95
  }
412
- sub.deps = head;
413
- sub.depsTail = tail;
414
- }
415
- function isDirty(sub) {
416
- for (let link = sub.deps; link; link = link.nextDep) {
417
- if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
418
- return true;
96
+ let nextDep = void 0;
97
+ const recursedCheck = sub.flags & 4 /* RecursedCheck */;
98
+ if (recursedCheck) {
99
+ nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
100
+ if (nextDep !== void 0 && nextDep.dep === dep) {
101
+ sub.depsTail = nextDep;
102
+ return;
419
103
  }
420
104
  }
421
- if (sub._dirty) {
422
- return true;
423
- }
424
- return false;
425
- }
426
- function refreshComputed(computed) {
427
- if (computed.flags & 4 && !(computed.flags & 16)) {
105
+ const prevSub = dep.subsTail;
106
+ if (prevSub !== void 0 && prevSub.sub === sub && (!recursedCheck || isValidLink(prevSub, sub))) {
428
107
  return;
429
108
  }
430
- computed.flags &= -17;
431
- if (computed.globalVersion === globalVersion) {
432
- return;
109
+ const newLink = sub.depsTail = dep.subsTail = {
110
+ dep,
111
+ sub,
112
+ prevDep,
113
+ nextDep,
114
+ prevSub,
115
+ nextSub: void 0
116
+ };
117
+ if (nextDep !== void 0) {
118
+ nextDep.prevDep = newLink;
433
119
  }
434
- computed.globalVersion = globalVersion;
435
- if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) {
436
- return;
120
+ if (prevDep !== void 0) {
121
+ prevDep.nextDep = newLink;
122
+ } else {
123
+ sub.deps = newLink;
437
124
  }
438
- computed.flags |= 2;
439
- const dep = computed.dep;
440
- const prevSub = activeSub;
441
- const prevShouldTrack = shouldTrack;
442
- activeSub = computed;
443
- shouldTrack = true;
444
- try {
445
- prepareDeps(computed);
446
- const value = computed.fn(computed._value);
447
- if (dep.version === 0 || hasChanged(value, computed._value)) {
448
- computed.flags |= 128;
449
- computed._value = value;
450
- dep.version++;
451
- }
452
- } catch (err) {
453
- dep.version++;
454
- throw err;
455
- } finally {
456
- activeSub = prevSub;
457
- shouldTrack = prevShouldTrack;
458
- cleanupDeps(computed);
459
- computed.flags &= -3;
125
+ if (prevSub !== void 0) {
126
+ prevSub.nextSub = newLink;
127
+ } else {
128
+ dep.subs = newLink;
460
129
  }
461
130
  }
462
- function removeSub(link, soft = false) {
463
- const { dep, prevSub, nextSub } = link;
464
- if (prevSub) {
465
- prevSub.nextSub = nextSub;
466
- link.prevSub = void 0;
131
+ function unlink(link2, sub = link2.sub) {
132
+ const dep = link2.dep;
133
+ const prevDep = link2.prevDep;
134
+ const nextDep = link2.nextDep;
135
+ const nextSub = link2.nextSub;
136
+ const prevSub = link2.prevSub;
137
+ if (nextDep !== void 0) {
138
+ nextDep.prevDep = prevDep;
139
+ } else {
140
+ sub.depsTail = prevDep;
467
141
  }
468
- if (nextSub) {
469
- nextSub.prevSub = prevSub;
470
- link.nextSub = void 0;
142
+ if (prevDep !== void 0) {
143
+ prevDep.nextDep = nextDep;
144
+ } else {
145
+ sub.deps = nextDep;
471
146
  }
472
- if (dep.subsHead === link) {
473
- dep.subsHead = nextSub;
147
+ if (nextSub !== void 0) {
148
+ nextSub.prevSub = prevSub;
149
+ } else {
150
+ dep.subsTail = prevSub;
474
151
  }
475
- if (dep.subs === link) {
476
- dep.subs = prevSub;
477
- if (!prevSub && dep.computed) {
478
- dep.computed.flags &= -5;
479
- for (let l = dep.computed.deps; l; l = l.nextDep) {
480
- removeSub(l, true);
152
+ if (prevSub !== void 0) {
153
+ prevSub.nextSub = nextSub;
154
+ } else if ((dep.subs = nextSub) === void 0) {
155
+ let toRemove = dep.deps;
156
+ if (toRemove !== void 0) {
157
+ do {
158
+ toRemove = unlink(toRemove, dep);
159
+ } while (toRemove !== void 0);
160
+ dep.flags |= 16 /* Dirty */;
161
+ }
162
+ }
163
+ return nextDep;
164
+ }
165
+ function propagate(link2) {
166
+ let next = link2.nextSub;
167
+ let stack;
168
+ top: do {
169
+ const sub = link2.sub;
170
+ let flags = sub.flags;
171
+ if (flags & (1 /* Mutable */ | 2 /* Watching */)) {
172
+ if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */ | 16 /* Dirty */ | 32 /* Pending */))) {
173
+ sub.flags = flags | 32 /* Pending */;
174
+ } else if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */))) {
175
+ flags = 0 /* None */;
176
+ } else if (!(flags & 4 /* RecursedCheck */)) {
177
+ sub.flags = flags & -9 /* Recursed */ | 32 /* Pending */;
178
+ } else if (!(flags & (16 /* Dirty */ | 32 /* Pending */)) && isValidLink(link2, sub)) {
179
+ sub.flags = flags | 8 /* Recursed */ | 32 /* Pending */;
180
+ flags &= 1 /* Mutable */;
181
+ } else {
182
+ flags = 0 /* None */;
183
+ }
184
+ if (flags & 2 /* Watching */) {
185
+ notifyBuffer[notifyBufferLength++] = sub;
186
+ }
187
+ if (flags & 1 /* Mutable */) {
188
+ const subSubs = sub.subs;
189
+ if (subSubs !== void 0) {
190
+ link2 = subSubs;
191
+ if (subSubs.nextSub !== void 0) {
192
+ stack = { value: next, prev: stack };
193
+ next = link2.nextSub;
194
+ }
195
+ continue;
196
+ }
481
197
  }
482
198
  }
483
- }
484
- if (!soft && !--dep.sc && dep.map) {
485
- dep.map.delete(dep.key);
486
- }
487
- }
488
- function removeDep(link) {
489
- const { prevDep, nextDep } = link;
490
- if (prevDep) {
491
- prevDep.nextDep = nextDep;
492
- link.prevDep = void 0;
493
- }
494
- if (nextDep) {
495
- nextDep.prevDep = prevDep;
496
- link.nextDep = void 0;
497
- }
498
- }
499
- function effect(fn, options) {
500
- if (fn.effect instanceof ReactiveEffect) {
501
- fn = fn.effect.fn;
502
- }
503
- const e = new ReactiveEffect(fn);
504
- if (options) {
505
- extend(e, options);
506
- }
507
- try {
508
- e.run();
509
- } catch (err) {
510
- e.stop();
511
- throw err;
512
- }
513
- const runner = e.run.bind(e);
514
- runner.effect = e;
515
- return runner;
516
- }
517
- function stop(runner) {
518
- runner.effect.stop();
519
- }
520
- let shouldTrack = true;
521
- const trackStack = [];
522
- function pauseTracking() {
523
- trackStack.push(shouldTrack);
524
- shouldTrack = false;
525
- }
526
- function enableTracking() {
527
- trackStack.push(shouldTrack);
528
- shouldTrack = true;
199
+ if ((link2 = next) !== void 0) {
200
+ next = link2.nextSub;
201
+ continue;
202
+ }
203
+ while (stack !== void 0) {
204
+ link2 = stack.value;
205
+ stack = stack.prev;
206
+ if (link2 !== void 0) {
207
+ next = link2.nextSub;
208
+ continue top;
209
+ }
210
+ }
211
+ break;
212
+ } while (true);
529
213
  }
530
- function resetTracking() {
531
- const last = trackStack.pop();
532
- shouldTrack = last === void 0 ? true : last;
214
+ function startTracking(sub) {
215
+ sub.depsTail = void 0;
216
+ sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
217
+ return setActiveSub(sub);
533
218
  }
534
- function onEffectCleanup(fn, failSilently = false) {
535
- if (activeSub instanceof ReactiveEffect) {
536
- activeSub.cleanup = fn;
537
- } else if (!failSilently) {
219
+ function endTracking(sub, prevSub) {
220
+ if (activeSub !== sub) {
538
221
  warn(
539
- `onEffectCleanup() was called when there was no active effect to associate with.`
222
+ "Active effect was not restored correctly - this is likely a Vue internal bug."
540
223
  );
541
224
  }
542
- }
543
- function cleanupEffect(e) {
544
- const { cleanup } = e;
545
- e.cleanup = void 0;
546
- if (cleanup) {
547
- const prevSub = activeSub;
548
- activeSub = void 0;
549
- try {
550
- cleanup();
551
- } finally {
552
- activeSub = prevSub;
553
- }
225
+ activeSub = prevSub;
226
+ const depsTail = sub.depsTail;
227
+ let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
228
+ while (toRemove !== void 0) {
229
+ toRemove = unlink(toRemove, sub);
230
+ }
231
+ sub.flags &= -5 /* RecursedCheck */;
232
+ }
233
+ function flush() {
234
+ while (notifyIndex < notifyBufferLength) {
235
+ const effect = notifyBuffer[notifyIndex];
236
+ notifyBuffer[notifyIndex++] = void 0;
237
+ effect.notify();
238
+ }
239
+ notifyIndex = 0;
240
+ notifyBufferLength = 0;
241
+ }
242
+ function checkDirty(link2, sub) {
243
+ let stack;
244
+ let checkDepth = 0;
245
+ top: do {
246
+ const dep = link2.dep;
247
+ const depFlags = dep.flags;
248
+ let dirty = false;
249
+ if (sub.flags & 16 /* Dirty */) {
250
+ dirty = true;
251
+ } else if ((depFlags & (1 /* Mutable */ | 16 /* Dirty */)) === (1 /* Mutable */ | 16 /* Dirty */)) {
252
+ if (dep.update()) {
253
+ const subs = dep.subs;
254
+ if (subs.nextSub !== void 0) {
255
+ shallowPropagate(subs);
256
+ }
257
+ dirty = true;
258
+ }
259
+ } else if ((depFlags & (1 /* Mutable */ | 32 /* Pending */)) === (1 /* Mutable */ | 32 /* Pending */)) {
260
+ if (link2.nextSub !== void 0 || link2.prevSub !== void 0) {
261
+ stack = { value: link2, prev: stack };
262
+ }
263
+ link2 = dep.deps;
264
+ sub = dep;
265
+ ++checkDepth;
266
+ continue;
267
+ }
268
+ if (!dirty && link2.nextDep !== void 0) {
269
+ link2 = link2.nextDep;
270
+ continue;
271
+ }
272
+ while (checkDepth) {
273
+ --checkDepth;
274
+ const firstSub = sub.subs;
275
+ const hasMultipleSubs = firstSub.nextSub !== void 0;
276
+ if (hasMultipleSubs) {
277
+ link2 = stack.value;
278
+ stack = stack.prev;
279
+ } else {
280
+ link2 = firstSub;
281
+ }
282
+ if (dirty) {
283
+ if (sub.update()) {
284
+ if (hasMultipleSubs) {
285
+ shallowPropagate(firstSub);
286
+ }
287
+ sub = link2.sub;
288
+ continue;
289
+ }
290
+ } else {
291
+ sub.flags &= -33 /* Pending */;
292
+ }
293
+ sub = link2.sub;
294
+ if (link2.nextDep !== void 0) {
295
+ link2 = link2.nextDep;
296
+ continue top;
297
+ }
298
+ dirty = false;
299
+ }
300
+ return dirty;
301
+ } while (true);
302
+ }
303
+ function shallowPropagate(link2) {
304
+ do {
305
+ const sub = link2.sub;
306
+ const nextSub = link2.nextSub;
307
+ const subFlags = sub.flags;
308
+ if ((subFlags & (32 /* Pending */ | 16 /* Dirty */)) === 32 /* Pending */) {
309
+ sub.flags = subFlags | 16 /* Dirty */;
310
+ }
311
+ link2 = nextSub;
312
+ } while (link2 !== void 0);
313
+ }
314
+ function isValidLink(checkLink, sub) {
315
+ const depsTail = sub.depsTail;
316
+ if (depsTail !== void 0) {
317
+ let link2 = sub.deps;
318
+ do {
319
+ if (link2 === checkLink) {
320
+ return true;
321
+ }
322
+ if (link2 === depsTail) {
323
+ break;
324
+ }
325
+ link2 = link2.nextDep;
326
+ } while (link2 !== void 0);
554
327
  }
328
+ return false;
555
329
  }
556
330
 
557
- let globalVersion = 0;
558
- class Link {
559
- constructor(sub, dep) {
560
- this.sub = sub;
561
- this.dep = dep;
562
- this.version = dep.version;
563
- this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
331
+ const triggerEventInfos = [];
332
+ function onTrack(sub, debugInfo) {
333
+ if (sub.onTrack) {
334
+ sub.onTrack(
335
+ extend(
336
+ {
337
+ effect: sub
338
+ },
339
+ debugInfo
340
+ )
341
+ );
564
342
  }
565
343
  }
566
- class Dep {
567
- // TODO isolatedDeclarations "__v_skip"
568
- constructor(computed) {
569
- this.computed = computed;
570
- this.version = 0;
571
- /**
572
- * Link between this dep and the current active effect
573
- */
574
- this.activeLink = void 0;
575
- /**
576
- * Doubly linked list representing the subscribing effects (tail)
577
- */
578
- this.subs = void 0;
579
- /**
580
- * For object property deps cleanup
581
- */
582
- this.map = void 0;
583
- this.key = void 0;
584
- /**
585
- * Subscriber counter
586
- */
587
- this.sc = 0;
588
- /**
589
- * @internal
590
- */
591
- this.__v_skip = true;
592
- {
593
- this.subsHead = void 0;
594
- }
344
+ function onTrigger(sub) {
345
+ if (sub.onTrigger) {
346
+ const debugInfo = triggerEventInfos[triggerEventInfos.length - 1];
347
+ sub.onTrigger(
348
+ extend(
349
+ {
350
+ effect: sub
351
+ },
352
+ debugInfo
353
+ )
354
+ );
595
355
  }
596
- track(debugInfo) {
597
- if (!activeSub || !shouldTrack || activeSub === this.computed) {
598
- return;
356
+ }
357
+ function setupOnTrigger(target) {
358
+ Object.defineProperty(target.prototype, "onTrigger", {
359
+ get() {
360
+ return this._onTrigger;
361
+ },
362
+ set(val) {
363
+ if (val && !this._onTrigger) setupFlagsHandler(this);
364
+ this._onTrigger = val;
599
365
  }
600
- let link = this.activeLink;
601
- if (link === void 0 || link.sub !== activeSub) {
602
- link = this.activeLink = new Link(activeSub, this);
603
- if (!activeSub.deps) {
604
- activeSub.deps = activeSub.depsTail = link;
605
- } else {
606
- link.prevDep = activeSub.depsTail;
607
- activeSub.depsTail.nextDep = link;
608
- activeSub.depsTail = link;
609
- }
610
- addSub(link);
611
- } else if (link.version === -1) {
612
- link.version = this.version;
613
- if (link.nextDep) {
614
- const next = link.nextDep;
615
- next.prevDep = link.prevDep;
616
- if (link.prevDep) {
617
- link.prevDep.nextDep = next;
618
- }
619
- link.prevDep = activeSub.depsTail;
620
- link.nextDep = void 0;
621
- activeSub.depsTail.nextDep = link;
622
- activeSub.depsTail = link;
623
- if (activeSub.deps === link) {
624
- activeSub.deps = next;
625
- }
366
+ });
367
+ }
368
+ function setupFlagsHandler(target) {
369
+ target._flags = target.flags;
370
+ Object.defineProperty(target, "flags", {
371
+ get() {
372
+ return target._flags;
373
+ },
374
+ set(value) {
375
+ if (!(target._flags & (ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending)) && !!(value & (ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending))) {
376
+ onTrigger(this);
626
377
  }
378
+ target._flags = value;
627
379
  }
628
- if (activeSub.onTrack) {
629
- activeSub.onTrack(
630
- extend(
631
- {
632
- effect: activeSub
633
- },
634
- debugInfo
635
- )
636
- );
637
- }
638
- return link;
639
- }
640
- trigger(debugInfo) {
641
- this.version++;
642
- globalVersion++;
643
- this.notify(debugInfo);
380
+ });
381
+ }
382
+
383
+ class Dep {
384
+ constructor(map, key) {
385
+ this.map = map;
386
+ this.key = key;
387
+ this._subs = void 0;
388
+ this.subsTail = void 0;
389
+ this.flags = ReactiveFlags$1.None;
644
390
  }
645
- notify(debugInfo) {
646
- startBatch();
647
- try {
648
- if (true) {
649
- for (let head = this.subsHead; head; head = head.nextSub) {
650
- if (head.sub.onTrigger && !(head.sub.flags & 8)) {
651
- head.sub.onTrigger(
652
- extend(
653
- {
654
- effect: head.sub
655
- },
656
- debugInfo
657
- )
658
- );
659
- }
660
- }
661
- }
662
- for (let link = this.subs; link; link = link.prevSub) {
663
- if (link.sub.notify()) {
664
- ;
665
- link.sub.dep.notify();
666
- }
667
- }
668
- } finally {
669
- endBatch();
670
- }
391
+ get subs() {
392
+ return this._subs;
671
393
  }
672
- }
673
- function addSub(link) {
674
- link.dep.sc++;
675
- if (link.sub.flags & 4) {
676
- const computed = link.dep.computed;
677
- if (computed && !link.dep.subs) {
678
- computed.flags |= 4 | 16;
679
- for (let l = computed.deps; l; l = l.nextDep) {
680
- addSub(l);
681
- }
682
- }
683
- const currentTail = link.dep.subs;
684
- if (currentTail !== link) {
685
- link.prevSub = currentTail;
686
- if (currentTail) currentTail.nextSub = link;
687
- }
688
- if (link.dep.subsHead === void 0) {
689
- link.dep.subsHead = link;
394
+ set subs(value) {
395
+ this._subs = value;
396
+ if (value === void 0) {
397
+ this.map.delete(this.key);
690
398
  }
691
- link.dep.subs = link;
692
399
  }
693
400
  }
694
401
  const targetMap = /* @__PURE__ */ new WeakMap();
@@ -702,36 +409,34 @@ var VueReactivity = (function (exports) {
702
409
  "Array iterate"
703
410
  );
704
411
  function track(target, type, key) {
705
- if (shouldTrack && activeSub) {
412
+ if (activeSub !== void 0) {
706
413
  let depsMap = targetMap.get(target);
707
414
  if (!depsMap) {
708
415
  targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
709
416
  }
710
417
  let dep = depsMap.get(key);
711
418
  if (!dep) {
712
- depsMap.set(key, dep = new Dep());
713
- dep.map = depsMap;
714
- dep.key = key;
419
+ depsMap.set(key, dep = new Dep(depsMap, key));
715
420
  }
716
421
  {
717
- dep.track({
422
+ onTrack(activeSub, {
718
423
  target,
719
424
  type,
720
425
  key
721
426
  });
722
427
  }
428
+ link(dep, activeSub);
723
429
  }
724
430
  }
725
431
  function trigger(target, type, key, newValue, oldValue, oldTarget) {
726
432
  const depsMap = targetMap.get(target);
727
433
  if (!depsMap) {
728
- globalVersion++;
729
434
  return;
730
435
  }
731
436
  const run = (dep) => {
732
- if (dep) {
437
+ if (dep !== void 0 && dep.subs !== void 0) {
733
438
  {
734
- dep.trigger({
439
+ triggerEventInfos.push({
735
440
  target,
736
441
  type,
737
442
  key,
@@ -740,6 +445,11 @@ var VueReactivity = (function (exports) {
740
445
  oldTarget
741
446
  });
742
447
  }
448
+ propagate(dep.subs);
449
+ shallowPropagate(dep.subs);
450
+ {
451
+ triggerEventInfos.pop();
452
+ }
743
453
  }
744
454
  };
745
455
  startBatch();
@@ -964,11 +674,11 @@ var VueReactivity = (function (exports) {
964
674
  return res;
965
675
  }
966
676
  function noTracking(self, method, args = []) {
967
- pauseTracking();
968
677
  startBatch();
678
+ const prevSub = setActiveSub();
969
679
  const res = toRaw(self)[method].apply(self, args);
680
+ setActiveSub(prevSub);
970
681
  endBatch();
971
- resetTracking();
972
682
  return res;
973
683
  }
974
684
 
@@ -1014,14 +724,18 @@ var VueReactivity = (function (exports) {
1014
724
  return hasOwnProperty;
1015
725
  }
1016
726
  }
727
+ const wasRef = isRef(target);
1017
728
  const res = Reflect.get(
1018
729
  target,
1019
730
  key,
1020
731
  // if this is a proxy wrapping a ref, return methods using the raw ref
1021
732
  // as receiver so that we don't have to call `toRaw` on the ref in all
1022
733
  // its class methods
1023
- isRef(target) ? target : receiver
734
+ wasRef ? target : receiver
1024
735
  );
736
+ if (wasRef && key !== "value") {
737
+ return res;
738
+ }
1025
739
  if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
1026
740
  return res;
1027
741
  }
@@ -1473,33 +1187,47 @@ var VueReactivity = (function (exports) {
1473
1187
  return r ? r["__v_isRef"] === true : false;
1474
1188
  }
1475
1189
  function ref(value) {
1476
- return createRef(value, false);
1190
+ return createRef(value, toReactive);
1477
1191
  }
1478
1192
  function shallowRef(value) {
1479
- return createRef(value, true);
1193
+ return createRef(value);
1480
1194
  }
1481
- function createRef(rawValue, shallow) {
1195
+ function createRef(rawValue, wrap) {
1482
1196
  if (isRef(rawValue)) {
1483
1197
  return rawValue;
1484
1198
  }
1485
- return new RefImpl(rawValue, shallow);
1199
+ return new RefImpl(rawValue, wrap);
1486
1200
  }
1487
1201
  class RefImpl {
1488
- constructor(value, isShallow2) {
1489
- this.dep = new Dep();
1490
- this["__v_isRef"] = true;
1491
- this["__v_isShallow"] = false;
1492
- this._rawValue = isShallow2 ? value : toRaw(value);
1493
- this._value = isShallow2 ? value : toReactive(value);
1494
- this["__v_isShallow"] = isShallow2;
1202
+ // TODO isolatedDeclarations "__v_isShallow"
1203
+ constructor(value, wrap) {
1204
+ this.subs = void 0;
1205
+ this.subsTail = void 0;
1206
+ this.flags = ReactiveFlags$1.Mutable;
1207
+ /**
1208
+ * @internal
1209
+ */
1210
+ this.__v_isRef = true;
1211
+ // TODO isolatedDeclarations "__v_isRef"
1212
+ /**
1213
+ * @internal
1214
+ */
1215
+ this.__v_isShallow = false;
1216
+ this._oldValue = this._rawValue = wrap ? toRaw(value) : value;
1217
+ this._value = wrap ? wrap(value) : value;
1218
+ this._wrap = wrap;
1219
+ this["__v_isShallow"] = !wrap;
1220
+ }
1221
+ get dep() {
1222
+ return this;
1495
1223
  }
1496
1224
  get value() {
1497
- {
1498
- this.dep.track({
1499
- target: this,
1500
- type: "get",
1501
- key: "value"
1502
- });
1225
+ trackRef(this);
1226
+ if (this.flags & ReactiveFlags$1.Dirty && this.update()) {
1227
+ const subs = this.subs;
1228
+ if (subs !== void 0) {
1229
+ shallowPropagate(subs);
1230
+ }
1503
1231
  }
1504
1232
  return this._value;
1505
1233
  }
@@ -1508,191 +1236,541 @@ var VueReactivity = (function (exports) {
1508
1236
  const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
1509
1237
  newValue = useDirectValue ? newValue : toRaw(newValue);
1510
1238
  if (hasChanged(newValue, oldValue)) {
1239
+ this.flags |= ReactiveFlags$1.Dirty;
1511
1240
  this._rawValue = newValue;
1512
- this._value = useDirectValue ? newValue : toReactive(newValue);
1513
- {
1514
- this.dep.trigger({
1515
- target: this,
1516
- type: "set",
1517
- key: "value",
1518
- newValue,
1519
- oldValue
1520
- });
1241
+ this._value = !useDirectValue && this._wrap ? this._wrap(newValue) : newValue;
1242
+ const subs = this.subs;
1243
+ if (subs !== void 0) {
1244
+ {
1245
+ triggerEventInfos.push({
1246
+ target: this,
1247
+ type: "set",
1248
+ key: "value",
1249
+ newValue,
1250
+ oldValue
1251
+ });
1252
+ }
1253
+ propagate(subs);
1254
+ if (!batchDepth) {
1255
+ flush();
1256
+ }
1257
+ {
1258
+ triggerEventInfos.pop();
1259
+ }
1521
1260
  }
1522
1261
  }
1523
1262
  }
1524
- }
1525
- function triggerRef(ref2) {
1526
- if (ref2.dep) {
1527
- {
1528
- ref2.dep.trigger({
1529
- target: ref2,
1530
- type: "set",
1531
- key: "value",
1532
- newValue: ref2._value
1533
- });
1534
- }
1263
+ update() {
1264
+ this.flags &= ~ReactiveFlags$1.Dirty;
1265
+ return hasChanged(this._oldValue, this._oldValue = this._rawValue);
1266
+ }
1267
+ }
1268
+ function triggerRef(ref2) {
1269
+ const dep = ref2.dep;
1270
+ if (dep !== void 0 && dep.subs !== void 0) {
1271
+ propagate(dep.subs);
1272
+ shallowPropagate(dep.subs);
1273
+ if (!batchDepth) {
1274
+ flush();
1275
+ }
1276
+ }
1277
+ }
1278
+ function trackRef(dep) {
1279
+ if (activeSub !== void 0) {
1280
+ {
1281
+ onTrack(activeSub, {
1282
+ target: dep,
1283
+ type: "get",
1284
+ key: "value"
1285
+ });
1286
+ }
1287
+ link(dep, activeSub);
1288
+ }
1289
+ }
1290
+ function unref(ref2) {
1291
+ return isRef(ref2) ? ref2.value : ref2;
1292
+ }
1293
+ function toValue(source) {
1294
+ return isFunction(source) ? source() : unref(source);
1295
+ }
1296
+ const shallowUnwrapHandlers = {
1297
+ get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1298
+ set: (target, key, value, receiver) => {
1299
+ const oldValue = target[key];
1300
+ if (isRef(oldValue) && !isRef(value)) {
1301
+ oldValue.value = value;
1302
+ return true;
1303
+ } else {
1304
+ return Reflect.set(target, key, value, receiver);
1305
+ }
1306
+ }
1307
+ };
1308
+ function proxyRefs(objectWithRefs) {
1309
+ return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1310
+ }
1311
+ class CustomRefImpl {
1312
+ constructor(factory) {
1313
+ this.subs = void 0;
1314
+ this.subsTail = void 0;
1315
+ this.flags = ReactiveFlags$1.None;
1316
+ this["__v_isRef"] = true;
1317
+ this._value = void 0;
1318
+ const { get, set } = factory(
1319
+ () => trackRef(this),
1320
+ () => triggerRef(this)
1321
+ );
1322
+ this._get = get;
1323
+ this._set = set;
1324
+ }
1325
+ get dep() {
1326
+ return this;
1327
+ }
1328
+ get value() {
1329
+ return this._value = this._get();
1330
+ }
1331
+ set value(newVal) {
1332
+ this._set(newVal);
1333
+ }
1334
+ }
1335
+ function customRef(factory) {
1336
+ return new CustomRefImpl(factory);
1337
+ }
1338
+ function toRefs(object) {
1339
+ const ret = isArray(object) ? new Array(object.length) : {};
1340
+ for (const key in object) {
1341
+ ret[key] = propertyToRef(object, key);
1342
+ }
1343
+ return ret;
1344
+ }
1345
+ class ObjectRefImpl {
1346
+ constructor(_object, _key, _defaultValue) {
1347
+ this._object = _object;
1348
+ this._key = _key;
1349
+ this._defaultValue = _defaultValue;
1350
+ this["__v_isRef"] = true;
1351
+ this._value = void 0;
1352
+ }
1353
+ get value() {
1354
+ const val = this._object[this._key];
1355
+ return this._value = val === void 0 ? this._defaultValue : val;
1356
+ }
1357
+ set value(newVal) {
1358
+ this._object[this._key] = newVal;
1359
+ }
1360
+ get dep() {
1361
+ return getDepFromReactive(toRaw(this._object), this._key);
1362
+ }
1363
+ }
1364
+ class GetterRefImpl {
1365
+ constructor(_getter) {
1366
+ this._getter = _getter;
1367
+ this["__v_isRef"] = true;
1368
+ this["__v_isReadonly"] = true;
1369
+ this._value = void 0;
1370
+ }
1371
+ get value() {
1372
+ return this._value = this._getter();
1373
+ }
1374
+ }
1375
+ function toRef(source, key, defaultValue) {
1376
+ if (isRef(source)) {
1377
+ return source;
1378
+ } else if (isFunction(source)) {
1379
+ return new GetterRefImpl(source);
1380
+ } else if (isObject(source) && arguments.length > 1) {
1381
+ return propertyToRef(source, key, defaultValue);
1382
+ } else {
1383
+ return ref(source);
1384
+ }
1385
+ }
1386
+ function propertyToRef(source, key, defaultValue) {
1387
+ const val = source[key];
1388
+ return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1389
+ }
1390
+
1391
+ const EffectFlags = {
1392
+ "ALLOW_RECURSE": 128,
1393
+ "128": "ALLOW_RECURSE",
1394
+ "PAUSED": 256,
1395
+ "256": "PAUSED",
1396
+ "STOP": 1024,
1397
+ "1024": "STOP"
1398
+ };
1399
+ class ReactiveEffect {
1400
+ constructor(fn) {
1401
+ this.deps = void 0;
1402
+ this.depsTail = void 0;
1403
+ this.subs = void 0;
1404
+ this.subsTail = void 0;
1405
+ this.flags = ReactiveFlags$1.Watching | ReactiveFlags$1.Dirty;
1406
+ /**
1407
+ * @internal
1408
+ */
1409
+ this.cleanups = [];
1410
+ /**
1411
+ * @internal
1412
+ */
1413
+ this.cleanupsLength = 0;
1414
+ if (fn !== void 0) {
1415
+ this.fn = fn;
1416
+ }
1417
+ if (activeEffectScope) {
1418
+ link(this, activeEffectScope);
1419
+ }
1420
+ }
1421
+ // @ts-expect-error
1422
+ fn() {
1423
+ }
1424
+ get active() {
1425
+ return !(this.flags & 1024);
1426
+ }
1427
+ pause() {
1428
+ this.flags |= 256;
1429
+ }
1430
+ resume() {
1431
+ const flags = this.flags &= -257;
1432
+ if (flags & (ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending)) {
1433
+ this.notify();
1434
+ }
1435
+ }
1436
+ notify() {
1437
+ if (!(this.flags & 256) && this.dirty) {
1438
+ this.run();
1439
+ }
1440
+ }
1441
+ run() {
1442
+ if (!this.active) {
1443
+ return this.fn();
1444
+ }
1445
+ cleanup(this);
1446
+ const prevSub = startTracking(this);
1447
+ try {
1448
+ return this.fn();
1449
+ } finally {
1450
+ endTracking(this, prevSub);
1451
+ const flags = this.flags;
1452
+ if ((flags & (ReactiveFlags$1.Recursed | 128)) === (ReactiveFlags$1.Recursed | 128)) {
1453
+ this.flags = flags & ~ReactiveFlags$1.Recursed;
1454
+ this.notify();
1455
+ }
1456
+ }
1457
+ }
1458
+ stop() {
1459
+ if (!this.active) {
1460
+ return;
1461
+ }
1462
+ this.flags = 1024;
1463
+ let dep = this.deps;
1464
+ while (dep !== void 0) {
1465
+ dep = unlink(dep, this);
1466
+ }
1467
+ const sub = this.subs;
1468
+ if (sub !== void 0) {
1469
+ unlink(sub);
1470
+ }
1471
+ cleanup(this);
1472
+ }
1473
+ get dirty() {
1474
+ const flags = this.flags;
1475
+ if (flags & ReactiveFlags$1.Dirty) {
1476
+ return true;
1477
+ }
1478
+ if (flags & ReactiveFlags$1.Pending) {
1479
+ if (checkDirty(this.deps, this)) {
1480
+ this.flags = flags | ReactiveFlags$1.Dirty;
1481
+ return true;
1482
+ } else {
1483
+ this.flags = flags & ~ReactiveFlags$1.Pending;
1484
+ }
1485
+ }
1486
+ return false;
1487
+ }
1488
+ }
1489
+ {
1490
+ setupOnTrigger(ReactiveEffect);
1491
+ }
1492
+ function effect(fn, options) {
1493
+ if (fn.effect instanceof ReactiveEffect) {
1494
+ fn = fn.effect.fn;
1495
+ }
1496
+ const e = new ReactiveEffect(fn);
1497
+ if (options) {
1498
+ const { onStop, scheduler } = options;
1499
+ if (onStop) {
1500
+ options.onStop = void 0;
1501
+ const stop2 = e.stop.bind(e);
1502
+ e.stop = () => {
1503
+ stop2();
1504
+ onStop();
1505
+ };
1506
+ }
1507
+ if (scheduler) {
1508
+ options.scheduler = void 0;
1509
+ e.notify = () => {
1510
+ if (!(e.flags & 256)) {
1511
+ scheduler();
1512
+ }
1513
+ };
1514
+ }
1515
+ extend(e, options);
1516
+ }
1517
+ try {
1518
+ e.run();
1519
+ } catch (err) {
1520
+ e.stop();
1521
+ throw err;
1535
1522
  }
1523
+ const runner = e.run.bind(e);
1524
+ runner.effect = e;
1525
+ return runner;
1536
1526
  }
1537
- function unref(ref2) {
1538
- return isRef(ref2) ? ref2.value : ref2;
1527
+ function stop(runner) {
1528
+ runner.effect.stop();
1539
1529
  }
1540
- function toValue(source) {
1541
- return isFunction(source) ? source() : unref(source);
1530
+ const resetTrackingStack = [];
1531
+ function pauseTracking() {
1532
+ resetTrackingStack.push(activeSub);
1533
+ setActiveSub();
1542
1534
  }
1543
- const shallowUnwrapHandlers = {
1544
- get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1545
- set: (target, key, value, receiver) => {
1546
- const oldValue = target[key];
1547
- if (isRef(oldValue) && !isRef(value)) {
1548
- oldValue.value = value;
1549
- return true;
1550
- } else {
1551
- return Reflect.set(target, key, value, receiver);
1535
+ function enableTracking() {
1536
+ const isPaused = activeSub === void 0;
1537
+ if (!isPaused) {
1538
+ resetTrackingStack.push(activeSub);
1539
+ } else {
1540
+ resetTrackingStack.push(void 0);
1541
+ for (let i = resetTrackingStack.length - 1; i >= 0; i--) {
1542
+ if (resetTrackingStack[i] !== void 0) {
1543
+ setActiveSub(resetTrackingStack[i]);
1544
+ break;
1545
+ }
1552
1546
  }
1553
1547
  }
1554
- };
1555
- function proxyRefs(objectWithRefs) {
1556
- return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1557
1548
  }
1558
- class CustomRefImpl {
1559
- constructor(factory) {
1560
- this["__v_isRef"] = true;
1561
- this._value = void 0;
1562
- const dep = this.dep = new Dep();
1563
- const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
1564
- this._get = get;
1565
- this._set = set;
1566
- }
1567
- get value() {
1568
- return this._value = this._get();
1549
+ function resetTracking() {
1550
+ if (resetTrackingStack.length === 0) {
1551
+ warn(
1552
+ `resetTracking() was called when there was no active tracking to reset.`
1553
+ );
1569
1554
  }
1570
- set value(newVal) {
1571
- this._set(newVal);
1555
+ if (resetTrackingStack.length) {
1556
+ setActiveSub(resetTrackingStack.pop());
1557
+ } else {
1558
+ setActiveSub();
1572
1559
  }
1573
1560
  }
1574
- function customRef(factory) {
1575
- return new CustomRefImpl(factory);
1561
+ function cleanup(sub) {
1562
+ const l = sub.cleanupsLength;
1563
+ if (l) {
1564
+ for (let i = 0; i < l; i++) {
1565
+ sub.cleanups[i]();
1566
+ }
1567
+ sub.cleanupsLength = 0;
1568
+ }
1576
1569
  }
1577
- function toRefs(object) {
1578
- if (!isProxy(object)) {
1579
- warn(`toRefs() expects a reactive object but received a plain one.`);
1570
+ function onEffectCleanup(fn, failSilently = false) {
1571
+ if (activeSub instanceof ReactiveEffect) {
1572
+ activeSub.cleanups[activeSub.cleanupsLength++] = () => cleanupEffect(fn);
1573
+ } else if (!failSilently) {
1574
+ warn(
1575
+ `onEffectCleanup() was called when there was no active effect to associate with.`
1576
+ );
1580
1577
  }
1581
- const ret = isArray(object) ? new Array(object.length) : {};
1582
- for (const key in object) {
1583
- ret[key] = propertyToRef(object, key);
1578
+ }
1579
+ function cleanupEffect(fn) {
1580
+ const prevSub = setActiveSub();
1581
+ try {
1582
+ fn();
1583
+ } finally {
1584
+ setActiveSub(prevSub);
1584
1585
  }
1585
- return ret;
1586
1586
  }
1587
- class ObjectRefImpl {
1588
- constructor(_object, _key, _defaultValue) {
1589
- this._object = _object;
1590
- this._key = _key;
1591
- this._defaultValue = _defaultValue;
1592
- this["__v_isRef"] = true;
1593
- this._value = void 0;
1587
+
1588
+ let activeEffectScope;
1589
+ class EffectScope {
1590
+ constructor(detached = false) {
1591
+ this.deps = void 0;
1592
+ this.depsTail = void 0;
1593
+ this.subs = void 0;
1594
+ this.subsTail = void 0;
1595
+ this.flags = 0;
1596
+ /**
1597
+ * @internal
1598
+ */
1599
+ this.cleanups = [];
1600
+ /**
1601
+ * @internal
1602
+ */
1603
+ this.cleanupsLength = 0;
1604
+ if (!detached && activeEffectScope) {
1605
+ link(this, activeEffectScope);
1606
+ }
1594
1607
  }
1595
- get value() {
1596
- const val = this._object[this._key];
1597
- return this._value = val === void 0 ? this._defaultValue : val;
1608
+ get active() {
1609
+ return !(this.flags & 1024);
1598
1610
  }
1599
- set value(newVal) {
1600
- this._object[this._key] = newVal;
1611
+ pause() {
1612
+ if (!(this.flags & 256)) {
1613
+ this.flags |= 256;
1614
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1615
+ const dep = link2.dep;
1616
+ if ("pause" in dep) {
1617
+ dep.pause();
1618
+ }
1619
+ }
1620
+ }
1601
1621
  }
1602
- get dep() {
1603
- return getDepFromReactive(toRaw(this._object), this._key);
1622
+ /**
1623
+ * Resumes the effect scope, including all child scopes and effects.
1624
+ */
1625
+ resume() {
1626
+ const flags = this.flags;
1627
+ if (flags & 256) {
1628
+ this.flags = flags & -257;
1629
+ for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1630
+ const dep = link2.dep;
1631
+ if ("resume" in dep) {
1632
+ dep.resume();
1633
+ }
1634
+ }
1635
+ }
1604
1636
  }
1605
- }
1606
- class GetterRefImpl {
1607
- constructor(_getter) {
1608
- this._getter = _getter;
1609
- this["__v_isRef"] = true;
1610
- this["__v_isReadonly"] = true;
1611
- this._value = void 0;
1637
+ run(fn) {
1638
+ const prevSub = setActiveSub();
1639
+ const prevScope = activeEffectScope;
1640
+ try {
1641
+ activeEffectScope = this;
1642
+ return fn();
1643
+ } finally {
1644
+ activeEffectScope = prevScope;
1645
+ setActiveSub(prevSub);
1646
+ }
1612
1647
  }
1613
- get value() {
1614
- return this._value = this._getter();
1648
+ stop() {
1649
+ if (!this.active) {
1650
+ return;
1651
+ }
1652
+ this.flags = 1024;
1653
+ let dep = this.deps;
1654
+ while (dep !== void 0) {
1655
+ const node = dep.dep;
1656
+ if ("stop" in node) {
1657
+ dep = dep.nextDep;
1658
+ node.stop();
1659
+ } else {
1660
+ dep = unlink(dep, this);
1661
+ }
1662
+ }
1663
+ const sub = this.subs;
1664
+ if (sub !== void 0) {
1665
+ unlink(sub);
1666
+ }
1667
+ cleanup(this);
1615
1668
  }
1616
1669
  }
1617
- function toRef(source, key, defaultValue) {
1618
- if (isRef(source)) {
1619
- return source;
1620
- } else if (isFunction(source)) {
1621
- return new GetterRefImpl(source);
1622
- } else if (isObject(source) && arguments.length > 1) {
1623
- return propertyToRef(source, key, defaultValue);
1624
- } else {
1625
- return ref(source);
1670
+ function effectScope(detached) {
1671
+ return new EffectScope(detached);
1672
+ }
1673
+ function getCurrentScope() {
1674
+ return activeEffectScope;
1675
+ }
1676
+ function setCurrentScope(scope) {
1677
+ try {
1678
+ return activeEffectScope;
1679
+ } finally {
1680
+ activeEffectScope = scope;
1626
1681
  }
1627
1682
  }
1628
- function propertyToRef(source, key, defaultValue) {
1629
- const val = source[key];
1630
- return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1683
+ function onScopeDispose(fn, failSilently = false) {
1684
+ if (activeEffectScope !== void 0) {
1685
+ activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
1686
+ } else if (!failSilently) {
1687
+ warn(
1688
+ `onScopeDispose() is called when there is no active effect scope to be associated with.`
1689
+ );
1690
+ }
1631
1691
  }
1632
1692
 
1633
1693
  class ComputedRefImpl {
1634
- constructor(fn, setter, isSSR) {
1694
+ constructor(fn, setter) {
1635
1695
  this.fn = fn;
1636
1696
  this.setter = setter;
1637
1697
  /**
1638
1698
  * @internal
1639
1699
  */
1640
1700
  this._value = void 0;
1641
- /**
1642
- * @internal
1643
- */
1644
- this.dep = new Dep(this);
1645
- /**
1646
- * @internal
1647
- */
1648
- this.__v_isRef = true;
1649
- // TODO isolatedDeclarations "__v_isReadonly"
1650
- // A computed is also a subscriber that tracks other deps
1651
- /**
1652
- * @internal
1653
- */
1701
+ this.subs = void 0;
1702
+ this.subsTail = void 0;
1654
1703
  this.deps = void 0;
1655
- /**
1656
- * @internal
1657
- */
1658
1704
  this.depsTail = void 0;
1705
+ this.flags = ReactiveFlags$1.Mutable | ReactiveFlags$1.Dirty;
1659
1706
  /**
1660
1707
  * @internal
1661
1708
  */
1662
- this.flags = 16;
1663
- /**
1664
- * @internal
1665
- */
1666
- this.globalVersion = globalVersion - 1;
1667
- /**
1668
- * @internal
1669
- */
1670
- this.next = void 0;
1671
- // for backwards compat
1672
- this.effect = this;
1709
+ this.__v_isRef = true;
1673
1710
  this["__v_isReadonly"] = !setter;
1674
- this.isSSR = isSSR;
1711
+ }
1712
+ // TODO isolatedDeclarations "__v_isReadonly"
1713
+ // for backwards compat
1714
+ get effect() {
1715
+ return this;
1716
+ }
1717
+ // for backwards compat
1718
+ get dep() {
1719
+ return this;
1675
1720
  }
1676
1721
  /**
1677
1722
  * @internal
1723
+ * for backwards compat
1678
1724
  */
1679
- notify() {
1680
- this.flags |= 16;
1681
- if (!(this.flags & 8) && // avoid infinite self recursion
1682
- activeSub !== this) {
1683
- batch(this, true);
1725
+ get _dirty() {
1726
+ const flags = this.flags;
1727
+ if (flags & ReactiveFlags$1.Dirty) {
1684
1728
  return true;
1685
1729
  }
1730
+ if (flags & ReactiveFlags$1.Pending) {
1731
+ if (checkDirty(this.deps, this)) {
1732
+ this.flags = flags | ReactiveFlags$1.Dirty;
1733
+ return true;
1734
+ } else {
1735
+ this.flags = flags & ~ReactiveFlags$1.Pending;
1736
+ }
1737
+ }
1738
+ return false;
1739
+ }
1740
+ /**
1741
+ * @internal
1742
+ * for backwards compat
1743
+ */
1744
+ set _dirty(v) {
1745
+ if (v) {
1746
+ this.flags |= ReactiveFlags$1.Dirty;
1747
+ } else {
1748
+ this.flags &= ~(ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending);
1749
+ }
1686
1750
  }
1687
1751
  get value() {
1688
- const link = this.dep.track({
1689
- target: this,
1690
- type: "get",
1691
- key: "value"
1692
- }) ;
1693
- refreshComputed(this);
1694
- if (link) {
1695
- link.version = this.dep.version;
1752
+ const flags = this.flags;
1753
+ if (flags & ReactiveFlags$1.Dirty || flags & ReactiveFlags$1.Pending && checkDirty(this.deps, this)) {
1754
+ if (this.update()) {
1755
+ const subs = this.subs;
1756
+ if (subs !== void 0) {
1757
+ shallowPropagate(subs);
1758
+ }
1759
+ }
1760
+ } else if (flags & ReactiveFlags$1.Pending) {
1761
+ this.flags = flags & ~ReactiveFlags$1.Pending;
1762
+ }
1763
+ if (activeSub !== void 0) {
1764
+ {
1765
+ onTrack(activeSub, {
1766
+ target: this,
1767
+ type: "get",
1768
+ key: "value"
1769
+ });
1770
+ }
1771
+ link(this, activeSub);
1772
+ } else if (activeEffectScope !== void 0) {
1773
+ link(this, activeEffectScope);
1696
1774
  }
1697
1775
  return this._value;
1698
1776
  }
@@ -1703,6 +1781,23 @@ var VueReactivity = (function (exports) {
1703
1781
  warn("Write operation failed: computed value is readonly");
1704
1782
  }
1705
1783
  }
1784
+ update() {
1785
+ const prevSub = startTracking(this);
1786
+ try {
1787
+ const oldValue = this._value;
1788
+ const newValue = this.fn(oldValue);
1789
+ if (hasChanged(oldValue, newValue)) {
1790
+ this._value = newValue;
1791
+ return true;
1792
+ }
1793
+ return false;
1794
+ } finally {
1795
+ endTracking(this, prevSub);
1796
+ }
1797
+ }
1798
+ }
1799
+ {
1800
+ setupOnTrigger(ComputedRefImpl);
1706
1801
  }
1707
1802
  function computed(getterOrOptions, debugOptions, isSSR = false) {
1708
1803
  let getter;
@@ -1713,7 +1808,7 @@ var VueReactivity = (function (exports) {
1713
1808
  getter = getterOrOptions.get;
1714
1809
  setter = getterOrOptions.set;
1715
1810
  }
1716
- const cRef = new ComputedRefImpl(getter, setter, isSSR);
1811
+ const cRef = new ComputedRefImpl(getter, setter);
1717
1812
  if (debugOptions && !isSSR) {
1718
1813
  cRef.onTrack = debugOptions.onTrack;
1719
1814
  cRef.onTrigger = debugOptions.onTrigger;
@@ -1750,177 +1845,155 @@ var VueReactivity = (function (exports) {
1750
1845
  "4": "WATCH_CLEANUP"
1751
1846
  };
1752
1847
  const INITIAL_WATCHER_VALUE = {};
1753
- const cleanupMap = /* @__PURE__ */ new WeakMap();
1754
1848
  let activeWatcher = void 0;
1755
1849
  function getCurrentWatcher() {
1756
1850
  return activeWatcher;
1757
1851
  }
1758
1852
  function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1759
1853
  if (owner) {
1760
- let cleanups = cleanupMap.get(owner);
1761
- if (!cleanups) cleanupMap.set(owner, cleanups = []);
1762
- cleanups.push(cleanupFn);
1854
+ const { call } = owner.options;
1855
+ if (call) {
1856
+ owner.cleanups[owner.cleanupsLength++] = () => call(cleanupFn, 4);
1857
+ } else {
1858
+ owner.cleanups[owner.cleanupsLength++] = cleanupFn;
1859
+ }
1763
1860
  } else if (!failSilently) {
1764
1861
  warn(
1765
1862
  `onWatcherCleanup() was called when there was no active watcher to associate with.`
1766
1863
  );
1767
1864
  }
1768
1865
  }
1769
- function watch(source, cb, options = EMPTY_OBJ) {
1770
- const { immediate, deep, once, scheduler, augmentJob, call } = options;
1771
- const warnInvalidSource = (s) => {
1772
- (options.onWarn || warn)(
1773
- `Invalid watch source: `,
1774
- s,
1775
- `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1776
- );
1777
- };
1778
- const reactiveGetter = (source2) => {
1779
- if (deep) return source2;
1780
- if (isShallow(source2) || deep === false || deep === 0)
1781
- return traverse(source2, 1);
1782
- return traverse(source2);
1783
- };
1784
- let effect;
1785
- let getter;
1786
- let cleanup;
1787
- let boundCleanup;
1788
- let forceTrigger = false;
1789
- let isMultiSource = false;
1790
- if (isRef(source)) {
1791
- getter = () => source.value;
1792
- forceTrigger = isShallow(source);
1793
- } else if (isReactive(source)) {
1794
- getter = () => reactiveGetter(source);
1795
- forceTrigger = true;
1796
- } else if (isArray(source)) {
1797
- isMultiSource = true;
1798
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1799
- getter = () => source.map((s) => {
1800
- if (isRef(s)) {
1801
- return s.value;
1802
- } else if (isReactive(s)) {
1803
- return reactiveGetter(s);
1804
- } else if (isFunction(s)) {
1805
- return call ? call(s, 2) : s();
1866
+ class WatcherEffect extends ReactiveEffect {
1867
+ constructor(source, cb, options = EMPTY_OBJ) {
1868
+ const { deep, once, call, onWarn } = options;
1869
+ let getter;
1870
+ let forceTrigger = false;
1871
+ let isMultiSource = false;
1872
+ if (isRef(source)) {
1873
+ getter = () => source.value;
1874
+ forceTrigger = isShallow(source);
1875
+ } else if (isReactive(source)) {
1876
+ getter = () => reactiveGetter(source, deep);
1877
+ forceTrigger = true;
1878
+ } else if (isArray(source)) {
1879
+ isMultiSource = true;
1880
+ forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1881
+ getter = () => source.map((s) => {
1882
+ if (isRef(s)) {
1883
+ return s.value;
1884
+ } else if (isReactive(s)) {
1885
+ return reactiveGetter(s, deep);
1886
+ } else if (isFunction(s)) {
1887
+ return call ? call(s, 2) : s();
1888
+ } else {
1889
+ warnInvalidSource(s, onWarn);
1890
+ }
1891
+ });
1892
+ } else if (isFunction(source)) {
1893
+ if (cb) {
1894
+ getter = call ? () => call(source, 2) : source;
1806
1895
  } else {
1807
- warnInvalidSource(s);
1808
- }
1809
- });
1810
- } else if (isFunction(source)) {
1811
- if (cb) {
1812
- getter = call ? () => call(source, 2) : source;
1813
- } else {
1814
- getter = () => {
1815
- if (cleanup) {
1816
- pauseTracking();
1896
+ getter = () => {
1897
+ if (this.cleanupsLength) {
1898
+ const prevSub = setActiveSub();
1899
+ try {
1900
+ cleanup(this);
1901
+ } finally {
1902
+ setActiveSub(prevSub);
1903
+ }
1904
+ }
1905
+ const currentEffect = activeWatcher;
1906
+ activeWatcher = this;
1817
1907
  try {
1818
- cleanup();
1908
+ return call ? call(source, 3, [
1909
+ this.boundCleanup
1910
+ ]) : source(this.boundCleanup);
1819
1911
  } finally {
1820
- resetTracking();
1912
+ activeWatcher = currentEffect;
1821
1913
  }
1822
- }
1823
- const currentEffect = activeWatcher;
1824
- activeWatcher = effect;
1825
- try {
1826
- return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
1827
- } finally {
1828
- activeWatcher = currentEffect;
1829
- }
1914
+ };
1915
+ }
1916
+ } else {
1917
+ getter = NOOP;
1918
+ warnInvalidSource(source, onWarn);
1919
+ }
1920
+ if (cb && deep) {
1921
+ const baseGetter = getter;
1922
+ const depth = deep === true ? Infinity : deep;
1923
+ getter = () => traverse(baseGetter(), depth);
1924
+ }
1925
+ super(getter);
1926
+ this.cb = cb;
1927
+ this.options = options;
1928
+ this.boundCleanup = (fn) => onWatcherCleanup(fn, false, this);
1929
+ this.forceTrigger = forceTrigger;
1930
+ this.isMultiSource = isMultiSource;
1931
+ if (once && cb) {
1932
+ const _cb = cb;
1933
+ cb = (...args) => {
1934
+ _cb(...args);
1935
+ this.stop();
1830
1936
  };
1831
1937
  }
1832
- } else {
1833
- getter = NOOP;
1834
- warnInvalidSource(source);
1835
- }
1836
- if (cb && deep) {
1837
- const baseGetter = getter;
1838
- const depth = deep === true ? Infinity : deep;
1839
- getter = () => traverse(baseGetter(), depth);
1840
- }
1841
- const scope = getCurrentScope();
1842
- const watchHandle = () => {
1843
- effect.stop();
1844
- if (scope && scope.active) {
1845
- remove(scope.effects, effect);
1938
+ this.cb = cb;
1939
+ this.oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1940
+ {
1941
+ this.onTrack = options.onTrack;
1942
+ this.onTrigger = options.onTrigger;
1846
1943
  }
1847
- };
1848
- if (once && cb) {
1849
- const _cb = cb;
1850
- cb = (...args) => {
1851
- _cb(...args);
1852
- watchHandle();
1853
- };
1854
1944
  }
1855
- let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1856
- const job = (immediateFirstRun) => {
1857
- if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
1945
+ run(initialRun = false) {
1946
+ const oldValue = this.oldValue;
1947
+ const newValue = this.oldValue = super.run();
1948
+ if (!this.cb) {
1858
1949
  return;
1859
1950
  }
1860
- if (cb) {
1861
- const newValue = effect.run();
1862
- if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
1863
- if (cleanup) {
1864
- cleanup();
1865
- }
1866
- const currentWatcher = activeWatcher;
1867
- activeWatcher = effect;
1868
- try {
1869
- const args = [
1870
- newValue,
1871
- // pass undefined as the old value when it's changed for the first time
1872
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1873
- boundCleanup
1874
- ];
1875
- oldValue = newValue;
1876
- call ? call(cb, 3, args) : (
1877
- // @ts-expect-error
1878
- cb(...args)
1879
- );
1880
- } finally {
1881
- activeWatcher = currentWatcher;
1882
- }
1883
- }
1884
- } else {
1885
- effect.run();
1951
+ const { immediate, deep, call } = this.options;
1952
+ if (initialRun && !immediate) {
1953
+ return;
1886
1954
  }
1887
- };
1888
- if (augmentJob) {
1889
- augmentJob(job);
1890
- }
1891
- effect = new ReactiveEffect(getter);
1892
- effect.scheduler = scheduler ? () => scheduler(job, false) : job;
1893
- boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
1894
- cleanup = effect.onStop = () => {
1895
- const cleanups = cleanupMap.get(effect);
1896
- if (cleanups) {
1897
- if (call) {
1898
- call(cleanups, 4);
1899
- } else {
1900
- for (const cleanup2 of cleanups) cleanup2();
1955
+ if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
1956
+ cleanup(this);
1957
+ const currentWatcher = activeWatcher;
1958
+ activeWatcher = this;
1959
+ try {
1960
+ const args = [
1961
+ newValue,
1962
+ // pass undefined as the old value when it's changed for the first time
1963
+ oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1964
+ this.boundCleanup
1965
+ ];
1966
+ call ? call(this.cb, 3, args) : (
1967
+ // @ts-expect-error
1968
+ this.cb(...args)
1969
+ );
1970
+ } finally {
1971
+ activeWatcher = currentWatcher;
1901
1972
  }
1902
- cleanupMap.delete(effect);
1903
- }
1904
- };
1905
- {
1906
- effect.onTrack = options.onTrack;
1907
- effect.onTrigger = options.onTrigger;
1908
- }
1909
- if (cb) {
1910
- if (immediate) {
1911
- job(true);
1912
- } else {
1913
- oldValue = effect.run();
1914
1973
  }
1915
- } else if (scheduler) {
1916
- scheduler(job.bind(null, true), true);
1917
- } else {
1918
- effect.run();
1919
1974
  }
1920
- watchHandle.pause = effect.pause.bind(effect);
1921
- watchHandle.resume = effect.resume.bind(effect);
1922
- watchHandle.stop = watchHandle;
1923
- return watchHandle;
1975
+ }
1976
+ function reactiveGetter(source, deep) {
1977
+ if (deep) return source;
1978
+ if (isShallow(source) || deep === false || deep === 0)
1979
+ return traverse(source, 1);
1980
+ return traverse(source);
1981
+ }
1982
+ function warnInvalidSource(s, onWarn) {
1983
+ (onWarn || warn)(
1984
+ `Invalid watch source: `,
1985
+ s,
1986
+ `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`
1987
+ );
1988
+ }
1989
+ function watch(source, cb, options = EMPTY_OBJ) {
1990
+ const effect = new WatcherEffect(source, cb, options);
1991
+ effect.run(true);
1992
+ const stop = effect.stop.bind(effect);
1993
+ stop.pause = effect.pause.bind(effect);
1994
+ stop.resume = effect.resume.bind(effect);
1995
+ stop.stop = stop;
1996
+ return stop;
1924
1997
  }
1925
1998
  function traverse(value, depth = Infinity, seen) {
1926
1999
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
@@ -1965,6 +2038,7 @@ var VueReactivity = (function (exports) {
1965
2038
  exports.TrackOpTypes = TrackOpTypes;
1966
2039
  exports.TriggerOpTypes = TriggerOpTypes;
1967
2040
  exports.WatchErrorCodes = WatchErrorCodes;
2041
+ exports.WatcherEffect = WatcherEffect;
1968
2042
  exports.computed = computed;
1969
2043
  exports.customRef = customRef;
1970
2044
  exports.effect = effect;
@@ -1988,6 +2062,8 @@ var VueReactivity = (function (exports) {
1988
2062
  exports.readonly = readonly;
1989
2063
  exports.ref = ref;
1990
2064
  exports.resetTracking = resetTracking;
2065
+ exports.setActiveSub = setActiveSub;
2066
+ exports.setCurrentScope = setCurrentScope;
1991
2067
  exports.shallowReactive = shallowReactive;
1992
2068
  exports.shallowReadArray = shallowReadArray;
1993
2069
  exports.shallowReadonly = shallowReadonly;