@vue/reactivity 3.2.30 → 3.2.33

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.
@@ -11,8 +11,17 @@ function warn(msg, ...args) {
11
11
  let activeEffectScope;
12
12
  class EffectScope {
13
13
  constructor(detached = false) {
14
+ /**
15
+ * @internal
16
+ */
14
17
  this.active = true;
18
+ /**
19
+ * @internal
20
+ */
15
21
  this.effects = [];
22
+ /**
23
+ * @internal
24
+ */
16
25
  this.cleanups = [];
17
26
  if (!detached && activeEffectScope) {
18
27
  this.parent = activeEffectScope;
@@ -22,21 +31,30 @@ class EffectScope {
22
31
  }
23
32
  run(fn) {
24
33
  if (this.active) {
34
+ const currentEffectScope = activeEffectScope;
25
35
  try {
26
36
  activeEffectScope = this;
27
37
  return fn();
28
38
  }
29
39
  finally {
30
- activeEffectScope = this.parent;
40
+ activeEffectScope = currentEffectScope;
31
41
  }
32
42
  }
33
43
  else {
34
44
  warn(`cannot run an inactive effect scope.`);
35
45
  }
36
46
  }
47
+ /**
48
+ * This should only be called on non-detached scopes
49
+ * @internal
50
+ */
37
51
  on() {
38
52
  activeEffectScope = this;
39
53
  }
54
+ /**
55
+ * This should only be called on non-detached scopes
56
+ * @internal
57
+ */
40
58
  off() {
41
59
  activeEffectScope = this.parent;
42
60
  }
@@ -178,10 +196,17 @@ class ReactiveEffect {
178
196
  activeEffect = this.parent;
179
197
  shouldTrack = lastShouldTrack;
180
198
  this.parent = undefined;
199
+ if (this.deferStop) {
200
+ this.stop();
201
+ }
181
202
  }
182
203
  }
183
204
  stop() {
184
- if (this.active) {
205
+ // stopped while running itself - defer the cleanup
206
+ if (activeEffect === this) {
207
+ this.deferStop = true;
208
+ }
209
+ else if (this.active) {
185
210
  cleanupEffect(this);
186
211
  if (this.onStop) {
187
212
  this.onStop();
@@ -264,9 +289,7 @@ function trackEffects(dep, debuggerEventExtraInfo) {
264
289
  dep.add(activeEffect);
265
290
  activeEffect.deps.push(dep);
266
291
  if (activeEffect.onTrack) {
267
- activeEffect.onTrack(Object.assign({
268
- effect: activeEffect
269
- }, debuggerEventExtraInfo));
292
+ activeEffect.onTrack(Object.assign({ effect: activeEffect }, debuggerEventExtraInfo));
270
293
  }
271
294
  }
272
295
  }
@@ -362,7 +385,9 @@ function triggerEffects(dep, debuggerEventExtraInfo) {
362
385
  }
363
386
 
364
387
  const isNonTrackableKeys = /*#__PURE__*/ shared.makeMap(`__proto__,__v_isRef,__isVue`);
365
- const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
388
+ const builtInSymbols = new Set(
389
+ /*#__PURE__*/
390
+ Object.getOwnPropertyNames(Symbol)
366
391
  .map(key => Symbol[key])
367
392
  .filter(shared.isSymbol));
368
393
  const get = /*#__PURE__*/ createGetter();
@@ -514,13 +539,13 @@ const readonlyHandlers = {
514
539
  get: readonlyGet,
515
540
  set(target, key) {
516
541
  {
517
- console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
542
+ warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
518
543
  }
519
544
  return true;
520
545
  },
521
546
  deleteProperty(target, key) {
522
547
  {
523
- console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
548
+ warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
524
549
  }
525
550
  return true;
526
551
  }
@@ -1119,7 +1144,7 @@ function computed(getterOrOptions, debugOptions, isSSR = false) {
1119
1144
  }
1120
1145
 
1121
1146
  var _a;
1122
- const tick = Promise.resolve();
1147
+ const tick = /*#__PURE__*/ Promise.resolve();
1123
1148
  const queue = [];
1124
1149
  let queued = false;
1125
1150
  const scheduler = (fn) => {
@@ -7,8 +7,17 @@ var shared = require('@vue/shared');
7
7
  let activeEffectScope;
8
8
  class EffectScope {
9
9
  constructor(detached = false) {
10
+ /**
11
+ * @internal
12
+ */
10
13
  this.active = true;
14
+ /**
15
+ * @internal
16
+ */
11
17
  this.effects = [];
18
+ /**
19
+ * @internal
20
+ */
12
21
  this.cleanups = [];
13
22
  if (!detached && activeEffectScope) {
14
23
  this.parent = activeEffectScope;
@@ -18,18 +27,27 @@ class EffectScope {
18
27
  }
19
28
  run(fn) {
20
29
  if (this.active) {
30
+ const currentEffectScope = activeEffectScope;
21
31
  try {
22
32
  activeEffectScope = this;
23
33
  return fn();
24
34
  }
25
35
  finally {
26
- activeEffectScope = this.parent;
36
+ activeEffectScope = currentEffectScope;
27
37
  }
28
38
  }
29
39
  }
40
+ /**
41
+ * This should only be called on non-detached scopes
42
+ * @internal
43
+ */
30
44
  on() {
31
45
  activeEffectScope = this;
32
46
  }
47
+ /**
48
+ * This should only be called on non-detached scopes
49
+ * @internal
50
+ */
33
51
  off() {
34
52
  activeEffectScope = this.parent;
35
53
  }
@@ -167,10 +185,17 @@ class ReactiveEffect {
167
185
  activeEffect = this.parent;
168
186
  shouldTrack = lastShouldTrack;
169
187
  this.parent = undefined;
188
+ if (this.deferStop) {
189
+ this.stop();
190
+ }
170
191
  }
171
192
  }
172
193
  stop() {
173
- if (this.active) {
194
+ // stopped while running itself - defer the cleanup
195
+ if (activeEffect === this) {
196
+ this.deferStop = true;
197
+ }
198
+ else if (this.active) {
174
199
  cleanupEffect(this);
175
200
  if (this.onStop) {
176
201
  this.onStop();
@@ -339,7 +364,9 @@ function triggerEffects(dep, debuggerEventExtraInfo) {
339
364
  }
340
365
 
341
366
  const isNonTrackableKeys = /*#__PURE__*/ shared.makeMap(`__proto__,__v_isRef,__isVue`);
342
- const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
367
+ const builtInSymbols = new Set(
368
+ /*#__PURE__*/
369
+ Object.getOwnPropertyNames(Symbol)
343
370
  .map(key => Symbol[key])
344
371
  .filter(shared.isSymbol));
345
372
  const get = /*#__PURE__*/ createGetter();
@@ -1043,7 +1070,7 @@ function computed(getterOrOptions, debugOptions, isSSR = false) {
1043
1070
  }
1044
1071
 
1045
1072
  var _a;
1046
- const tick = Promise.resolve();
1073
+ const tick = /*#__PURE__*/ Promise.resolve();
1047
1074
  const queue = [];
1048
1075
  let queued = false;
1049
1076
  const scheduler = (fn) => {
@@ -73,20 +73,16 @@ export declare function effect<T = any>(fn: () => T, options?: ReactiveEffectOpt
73
73
  export declare type EffectScheduler = (...args: any[]) => any;
74
74
 
75
75
  export declare class EffectScope {
76
- active: boolean;
77
- effects: ReactiveEffect[];
78
- cleanups: (() => void)[];
79
- parent: EffectScope | undefined;
80
- scopes: EffectScope[] | undefined;
81
- /**
82
- * track a child scope's index in its parent's scopes array for optimized
83
- * removal
84
- */
85
- private index;
76
+ /* Excluded from this release type: active */
77
+ /* Excluded from this release type: effects */
78
+ /* Excluded from this release type: cleanups */
79
+ /* Excluded from this release type: parent */
80
+ /* Excluded from this release type: scopes */
81
+ /* Excluded from this release type: index */
86
82
  constructor(detached?: boolean);
87
83
  run<T>(fn: () => T): T | undefined;
88
- on(): void;
89
- off(): void;
84
+ /* Excluded from this release type: on */
85
+ /* Excluded from this release type: off */
90
86
  stop(fromParent?: boolean): void;
91
87
  }
92
88
 
@@ -152,6 +148,7 @@ export declare class ReactiveEffect<T = any> {
152
148
  parent: ReactiveEffect | undefined;
153
149
  /* Excluded from this release type: computed */
154
150
  /* Excluded from this release type: allowRecurse */
151
+ /* Excluded from this release type: deferStop */
155
152
  onStop?: () => void;
156
153
  onTrack?: (event: DebuggerEvent) => void;
157
154
  onTrigger?: (event: DebuggerEvent) => void;
@@ -64,8 +64,17 @@ function warn(msg, ...args) {
64
64
  let activeEffectScope;
65
65
  class EffectScope {
66
66
  constructor(detached = false) {
67
+ /**
68
+ * @internal
69
+ */
67
70
  this.active = true;
71
+ /**
72
+ * @internal
73
+ */
68
74
  this.effects = [];
75
+ /**
76
+ * @internal
77
+ */
69
78
  this.cleanups = [];
70
79
  if (!detached && activeEffectScope) {
71
80
  this.parent = activeEffectScope;
@@ -75,21 +84,30 @@ class EffectScope {
75
84
  }
76
85
  run(fn) {
77
86
  if (this.active) {
87
+ const currentEffectScope = activeEffectScope;
78
88
  try {
79
89
  activeEffectScope = this;
80
90
  return fn();
81
91
  }
82
92
  finally {
83
- activeEffectScope = this.parent;
93
+ activeEffectScope = currentEffectScope;
84
94
  }
85
95
  }
86
96
  else {
87
97
  warn(`cannot run an inactive effect scope.`);
88
98
  }
89
99
  }
100
+ /**
101
+ * This should only be called on non-detached scopes
102
+ * @internal
103
+ */
90
104
  on() {
91
105
  activeEffectScope = this;
92
106
  }
107
+ /**
108
+ * This should only be called on non-detached scopes
109
+ * @internal
110
+ */
93
111
  off() {
94
112
  activeEffectScope = this.parent;
95
113
  }
@@ -231,10 +249,17 @@ class ReactiveEffect {
231
249
  activeEffect = this.parent;
232
250
  shouldTrack = lastShouldTrack;
233
251
  this.parent = undefined;
252
+ if (this.deferStop) {
253
+ this.stop();
254
+ }
234
255
  }
235
256
  }
236
257
  stop() {
237
- if (this.active) {
258
+ // stopped while running itself - defer the cleanup
259
+ if (activeEffect === this) {
260
+ this.deferStop = true;
261
+ }
262
+ else if (this.active) {
238
263
  cleanupEffect(this);
239
264
  if (this.onStop) {
240
265
  this.onStop();
@@ -317,9 +342,7 @@ function trackEffects(dep, debuggerEventExtraInfo) {
317
342
  dep.add(activeEffect);
318
343
  activeEffect.deps.push(dep);
319
344
  if (activeEffect.onTrack) {
320
- activeEffect.onTrack(Object.assign({
321
- effect: activeEffect
322
- }, debuggerEventExtraInfo));
345
+ activeEffect.onTrack(Object.assign({ effect: activeEffect }, debuggerEventExtraInfo));
323
346
  }
324
347
  }
325
348
  }
@@ -415,7 +438,9 @@ function triggerEffects(dep, debuggerEventExtraInfo) {
415
438
  }
416
439
 
417
440
  const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
418
- const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
441
+ const builtInSymbols = new Set(
442
+ /*#__PURE__*/
443
+ Object.getOwnPropertyNames(Symbol)
419
444
  .map(key => Symbol[key])
420
445
  .filter(isSymbol));
421
446
  const get = /*#__PURE__*/ createGetter();
@@ -567,13 +592,13 @@ const readonlyHandlers = {
567
592
  get: readonlyGet,
568
593
  set(target, key) {
569
594
  {
570
- console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
595
+ warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
571
596
  }
572
597
  return true;
573
598
  },
574
599
  deleteProperty(target, key) {
575
600
  {
576
- console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
601
+ warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
577
602
  }
578
603
  return true;
579
604
  }
@@ -1172,7 +1197,7 @@ function computed(getterOrOptions, debugOptions, isSSR = false) {
1172
1197
  }
1173
1198
 
1174
1199
  var _a;
1175
- const tick = Promise.resolve();
1200
+ const tick = /*#__PURE__*/ Promise.resolve();
1176
1201
  const queue = [];
1177
1202
  let queued = false;
1178
1203
  const scheduler = (fn) => {
@@ -1 +1 @@
1
- function t(t,e){const n=Object.create(null),s=t.split(",");for(let i=0;i<s.length;i++)n[s[i]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const e=()=>{},n=Object.assign,s=Object.prototype.hasOwnProperty,i=(t,e)=>s.call(t,e),r=Array.isArray,c=t=>"[object Map]"===l(t),o=t=>"symbol"==typeof t,u=t=>null!==t&&"object"==typeof t,h=Object.prototype.toString,l=t=>h.call(t),a=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,f=(t,e)=>!Object.is(t,e);let _;class p{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],!t&&_&&(this.parent=_,this.index=(_.scopes||(_.scopes=[])).push(this)-1)}run(t){if(this.active)try{return _=this,t()}finally{_=this.parent}}on(){_=this}off(){_=this.parent}stop(t){if(this.active){let e,n;for(e=0,n=this.effects.length;e<n;e++)this.effects[e].stop();for(e=0,n=this.cleanups.length;e<n;e++)this.cleanups[e]();if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].stop(!0);if(this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.active=!1}}}function d(t){return new p(t)}function v(t,e=_){e&&e.active&&e.effects.push(t)}function g(){return _}function y(t){_&&_.cleanups.push(t)}const w=t=>{const e=new Set(t);return e.w=0,e.n=0,e},b=t=>(t.w&k)>0,R=t=>(t.n&k)>0,S=new WeakMap;let m=0,k=1;let j;const O=Symbol(""),x=Symbol("");class E{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],this.parent=void 0,v(this,n)}run(){if(!this.active)return this.fn();let t=j,e=W;for(;t;){if(t===this)return;t=t.parent}try{return this.parent=j,j=this,W=!0,k=1<<++m,m<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=k})(this):P(this),this.fn()}finally{m<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const i=e[s];b(i)&&!R(i)?i.delete(t):e[n++]=i,i.w&=~k,i.n&=~k}e.length=n}})(this),k=1<<--m,j=this.parent,W=e,this.parent=void 0}}stop(){this.active&&(P(this),this.onStop&&this.onStop(),this.active=!1)}}function P(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}function M(t,e){t.effect&&(t=t.effect.fn);const s=new E(t);e&&(n(s,e),e.scope&&v(s,e.scope)),e&&e.lazy||s.run();const i=s.run.bind(s);return i.effect=s,i}function z(t){t.effect.stop()}let W=!0;const V=[];function A(){V.push(W),W=!1}function N(){V.push(W),W=!0}function I(){const t=V.pop();W=void 0===t||t}function K(t,e,n){if(W&&j){let e=S.get(t);e||S.set(t,e=new Map);let s=e.get(n);s||e.set(n,s=w()),C(s)}}function C(t,e){let n=!1;m<=30?R(t)||(t.n|=k,n=!b(t)):n=!t.has(j),n&&(t.add(j),j.deps.push(t))}function L(t,e,n,s,i,o){const u=S.get(t);if(!u)return;let h=[];if("clear"===e)h=[...u.values()];else if("length"===n&&r(t))u.forEach(((t,e)=>{("length"===e||e>=s)&&h.push(t)}));else switch(void 0!==n&&h.push(u.get(n)),e){case"add":r(t)?a(n)&&h.push(u.get("length")):(h.push(u.get(O)),c(t)&&h.push(u.get(x)));break;case"delete":r(t)||(h.push(u.get(O)),c(t)&&h.push(u.get(x)));break;case"set":c(t)&&h.push(u.get(O))}if(1===h.length)h[0]&&q(h[0]);else{const t=[];for(const e of h)e&&t.push(...e);q(w(t))}}function q(t,e){for(const n of r(t)?t:[...t])(n!==j||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const B=t("__proto__,__v_isRef,__isVue"),D=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(o)),F=U(),G=U(!1,!0),H=U(!0),J=U(!0,!0),Q=T();function T(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Kt(this);for(let e=0,i=this.length;e<i;e++)K(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(Kt)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){A();const n=Kt(this)[e].apply(this,t);return I(),n}})),t}function U(t=!1,e=!1){return function(n,s,c){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_isShallow"===s)return e;if("__v_raw"===s&&c===(t?e?Ot:jt:e?kt:mt).get(n))return n;const h=r(n);if(!t&&h&&i(Q,s))return Reflect.get(Q,s,c);const l=Reflect.get(n,s,c);if(o(s)?D.has(s):B(s))return l;if(t||K(n,0,s),e)return l;if(Ft(l)){return!h||!a(s)?l.value:l}return u(l)?t?Mt(l):Et(l):l}}function X(t=!1){return function(e,n,s,c){let o=e[n];if(At(o)&&Ft(o)&&!Ft(s))return!1;if(!t&&!At(s)&&(Nt(s)||(s=Kt(s),o=Kt(o)),!r(e)&&Ft(o)&&!Ft(s)))return o.value=s,!0;const u=r(e)&&a(n)?Number(n)<e.length:i(e,n),h=Reflect.set(e,n,s,c);return e===Kt(c)&&(u?f(s,o)&&L(e,"set",n,s):L(e,"add",n,s)),h}}const Y={get:F,set:X(),deleteProperty:function(t,e){const n=i(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&L(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return o(e)&&D.has(e)||K(t,0,e),n},ownKeys:function(t){return K(t,0,r(t)?"length":O),Reflect.ownKeys(t)}},Z={get:H,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},$=n({},Y,{get:G,set:X(!0)}),tt=n({},Z,{get:J}),et=t=>t,nt=t=>Reflect.getPrototypeOf(t);function st(t,e,n=!1,s=!1){const i=Kt(t=t.__v_raw),r=Kt(e);e!==r&&!n&&K(i,0,e),!n&&K(i,0,r);const{has:c}=nt(i),o=s?et:n?qt:Lt;return c.call(i,e)?o(t.get(e)):c.call(i,r)?o(t.get(r)):void(t!==i&&t.get(e))}function it(t,e=!1){const n=this.__v_raw,s=Kt(n),i=Kt(t);return t!==i&&!e&&K(s,0,t),!e&&K(s,0,i),t===i?n.has(t):n.has(t)||n.has(i)}function rt(t,e=!1){return t=t.__v_raw,!e&&K(Kt(t),0,O),Reflect.get(t,"size",t)}function ct(t){t=Kt(t);const e=Kt(this);return nt(e).has.call(e,t)||(e.add(t),L(e,"add",t,t)),this}function ot(t,e){e=Kt(e);const n=Kt(this),{has:s,get:i}=nt(n);let r=s.call(n,t);r||(t=Kt(t),r=s.call(n,t));const c=i.call(n,t);return n.set(t,e),r?f(e,c)&&L(n,"set",t,e):L(n,"add",t,e),this}function ut(t){const e=Kt(this),{has:n,get:s}=nt(e);let i=n.call(e,t);i||(t=Kt(t),i=n.call(e,t)),s&&s.call(e,t);const r=e.delete(t);return i&&L(e,"delete",t,void 0),r}function ht(){const t=Kt(this),e=0!==t.size,n=t.clear();return e&&L(t,"clear",void 0,void 0),n}function lt(t,e){return function(n,s){const i=this,r=i.__v_raw,c=Kt(r),o=e?et:t?qt:Lt;return!t&&K(c,0,O),r.forEach(((t,e)=>n.call(s,o(t),o(e),i)))}}function at(t,e,n){return function(...s){const i=this.__v_raw,r=Kt(i),o=c(r),u="entries"===t||t===Symbol.iterator&&o,h="keys"===t&&o,l=i[t](...s),a=n?et:e?qt:Lt;return!e&&K(r,0,h?x:O),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:u?[a(t[0]),a(t[1])]:a(t),done:e}},[Symbol.iterator](){return this}}}}function ft(t){return function(...e){return"delete"!==t&&this}}function _t(){const t={get(t){return st(this,t)},get size(){return rt(this)},has:it,add:ct,set:ot,delete:ut,clear:ht,forEach:lt(!1,!1)},e={get(t){return st(this,t,!1,!0)},get size(){return rt(this)},has:it,add:ct,set:ot,delete:ut,clear:ht,forEach:lt(!1,!0)},n={get(t){return st(this,t,!0)},get size(){return rt(this,!0)},has(t){return it.call(this,t,!0)},add:ft("add"),set:ft("set"),delete:ft("delete"),clear:ft("clear"),forEach:lt(!0,!1)},s={get(t){return st(this,t,!0,!0)},get size(){return rt(this,!0)},has(t){return it.call(this,t,!0)},add:ft("add"),set:ft("set"),delete:ft("delete"),clear:ft("clear"),forEach:lt(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((i=>{t[i]=at(i,!1,!1),n[i]=at(i,!0,!1),e[i]=at(i,!1,!0),s[i]=at(i,!0,!0)})),[t,n,e,s]}const[pt,dt,vt,gt]=_t();function yt(t,e){const n=e?t?gt:vt:t?dt:pt;return(e,s,r)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(i(n,s)&&s in e?n:e,s,r)}const wt={get:yt(!1,!1)},bt={get:yt(!1,!0)},Rt={get:yt(!0,!1)},St={get:yt(!0,!0)},mt=new WeakMap,kt=new WeakMap,jt=new WeakMap,Ot=new WeakMap;function xt(t){return t.__v_skip||!Object.isExtensible(t)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((t=>l(t).slice(8,-1))(t))}function Et(t){return At(t)?t:Wt(t,!1,Y,wt,mt)}function Pt(t){return Wt(t,!1,$,bt,kt)}function Mt(t){return Wt(t,!0,Z,Rt,jt)}function zt(t){return Wt(t,!0,tt,St,Ot)}function Wt(t,e,n,s,i){if(!u(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const r=i.get(t);if(r)return r;const c=xt(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return i.set(t,o),o}function Vt(t){return At(t)?Vt(t.__v_raw):!(!t||!t.__v_isReactive)}function At(t){return!(!t||!t.__v_isReadonly)}function Nt(t){return!(!t||!t.__v_isShallow)}function It(t){return Vt(t)||At(t)}function Kt(t){const e=t&&t.__v_raw;return e?Kt(e):t}function Ct(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t}const Lt=t=>u(t)?Et(t):t,qt=t=>u(t)?Mt(t):t;function Bt(t){W&&j&&C((t=Kt(t)).dep||(t.dep=w()))}function Dt(t,e){(t=Kt(t)).dep&&q(t.dep)}function Ft(t){return!(!t||!0!==t.__v_isRef)}function Gt(t){return Jt(t,!1)}function Ht(t){return Jt(t,!0)}function Jt(t,e){return Ft(t)?t:new Qt(t,e)}class Qt{constructor(t,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Kt(t),this._value=e?t:Lt(t)}get value(){return Bt(this),this._value}set value(t){t=this.__v_isShallow?t:Kt(t),f(t,this._rawValue)&&(this._rawValue=t,this._value=this.__v_isShallow?t:Lt(t),Dt(this))}}function Tt(t){Dt(t)}function Ut(t){return Ft(t)?t.value:t}const Xt={get:(t,e,n)=>Ut(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const i=t[e];return Ft(i)&&!Ft(n)?(i.value=n,!0):Reflect.set(t,e,n,s)}};function Yt(t){return Vt(t)?t:new Proxy(t,Xt)}class Zt{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Bt(this)),(()=>Dt(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}function $t(t){return new Zt(t)}function te(t){const e=r(t)?new Array(t.length):{};for(const n in t)e[n]=ne(t,n);return e}class ee{constructor(t,e,n){this._object=t,this._key=e,this._defaultValue=n,this.__v_isRef=!0}get value(){const t=this._object[this._key];return void 0===t?this._defaultValue:t}set value(t){this._object[this._key]=t}}function ne(t,e,n){const s=t[e];return Ft(s)?s:new ee(t,e,n)}class se{constructor(t,e,n,s){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this._dirty=!0,this.effect=new E(t,(()=>{this._dirty||(this._dirty=!0,Dt(this))})),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=n}get value(){const t=Kt(this);return Bt(t),!t._dirty&&t._cacheable||(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}function ie(t,n,s=!1){let i,r;const c="function"==typeof t;c?(i=t,r=e):(i=t.get,r=t.set);return new se(i,r,c||!r,s)}var re;const ce=Promise.resolve(),oe=[];let ue=!1;const he=()=>{for(let t=0;t<oe.length;t++)oe[t]();oe.length=0,ue=!1};class le{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this[re]=!0;let n=!1,s=!1;this.effect=new E(t,(t=>{if(this.dep){if(t)e=this._value,n=!0;else if(!s){const t=n?e:this._value;s=!0,n=!1,oe.push((()=>{this.effect.active&&this._get()!==t&&Dt(this),s=!1})),ue||(ue=!0,ce.then(he))}for(const t of this.dep)t.computed instanceof le&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=this}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Bt(this),Kt(this)._get()}}function ae(t){return new le(t)}re="__v_isReadonly";export{p as EffectScope,O as ITERATE_KEY,E as ReactiveEffect,ie as computed,$t as customRef,ae as deferredComputed,M as effect,d as effectScope,N as enableTracking,g as getCurrentScope,It as isProxy,Vt as isReactive,At as isReadonly,Ft as isRef,Nt as isShallow,Ct as markRaw,y as onScopeDispose,A as pauseTracking,Yt as proxyRefs,Et as reactive,Mt as readonly,Gt as ref,I as resetTracking,Pt as shallowReactive,zt as shallowReadonly,Ht as shallowRef,z as stop,Kt as toRaw,ne as toRef,te as toRefs,K as track,L as trigger,Tt as triggerRef,Ut as unref};
1
+ function t(t,e){const n=Object.create(null),s=t.split(",");for(let i=0;i<s.length;i++)n[s[i]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const e=()=>{},n=Object.assign,s=Object.prototype.hasOwnProperty,i=(t,e)=>s.call(t,e),r=Array.isArray,c=t=>"[object Map]"===l(t),o=t=>"symbol"==typeof t,u=t=>null!==t&&"object"==typeof t,h=Object.prototype.toString,l=t=>h.call(t),a=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,f=(t,e)=>!Object.is(t,e);let _;class p{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],!t&&_&&(this.parent=_,this.index=(_.scopes||(_.scopes=[])).push(this)-1)}run(t){if(this.active){const e=_;try{return _=this,t()}finally{_=e}}}on(){_=this}off(){_=this.parent}stop(t){if(this.active){let e,n;for(e=0,n=this.effects.length;e<n;e++)this.effects[e].stop();for(e=0,n=this.cleanups.length;e<n;e++)this.cleanups[e]();if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].stop(!0);if(this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.active=!1}}}function d(t){return new p(t)}function v(t,e=_){e&&e.active&&e.effects.push(t)}function g(){return _}function y(t){_&&_.cleanups.push(t)}const w=t=>{const e=new Set(t);return e.w=0,e.n=0,e},b=t=>(t.w&k)>0,R=t=>(t.n&k)>0,S=new WeakMap;let m=0,k=1;let j;const O=Symbol(""),x=Symbol("");class E{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],this.parent=void 0,v(this,n)}run(){if(!this.active)return this.fn();let t=j,e=W;for(;t;){if(t===this)return;t=t.parent}try{return this.parent=j,j=this,W=!0,k=1<<++m,m<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=k})(this):P(this),this.fn()}finally{m<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const i=e[s];b(i)&&!R(i)?i.delete(t):e[n++]=i,i.w&=~k,i.n&=~k}e.length=n}})(this),k=1<<--m,j=this.parent,W=e,this.parent=void 0,this.deferStop&&this.stop()}}stop(){j===this?this.deferStop=!0:this.active&&(P(this),this.onStop&&this.onStop(),this.active=!1)}}function P(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}function M(t,e){t.effect&&(t=t.effect.fn);const s=new E(t);e&&(n(s,e),e.scope&&v(s,e.scope)),e&&e.lazy||s.run();const i=s.run.bind(s);return i.effect=s,i}function z(t){t.effect.stop()}let W=!0;const V=[];function A(){V.push(W),W=!1}function N(){V.push(W),W=!0}function I(){const t=V.pop();W=void 0===t||t}function K(t,e,n){if(W&&j){let e=S.get(t);e||S.set(t,e=new Map);let s=e.get(n);s||e.set(n,s=w()),C(s)}}function C(t,e){let n=!1;m<=30?R(t)||(t.n|=k,n=!b(t)):n=!t.has(j),n&&(t.add(j),j.deps.push(t))}function L(t,e,n,s,i,o){const u=S.get(t);if(!u)return;let h=[];if("clear"===e)h=[...u.values()];else if("length"===n&&r(t))u.forEach(((t,e)=>{("length"===e||e>=s)&&h.push(t)}));else switch(void 0!==n&&h.push(u.get(n)),e){case"add":r(t)?a(n)&&h.push(u.get("length")):(h.push(u.get(O)),c(t)&&h.push(u.get(x)));break;case"delete":r(t)||(h.push(u.get(O)),c(t)&&h.push(u.get(x)));break;case"set":c(t)&&h.push(u.get(O))}if(1===h.length)h[0]&&q(h[0]);else{const t=[];for(const e of h)e&&t.push(...e);q(w(t))}}function q(t,e){for(const n of r(t)?t:[...t])(n!==j||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const B=t("__proto__,__v_isRef,__isVue"),D=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(o)),F=U(),G=U(!1,!0),H=U(!0),J=U(!0,!0),Q=T();function T(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Kt(this);for(let e=0,i=this.length;e<i;e++)K(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(Kt)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){A();const n=Kt(this)[e].apply(this,t);return I(),n}})),t}function U(t=!1,e=!1){return function(n,s,c){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_isShallow"===s)return e;if("__v_raw"===s&&c===(t?e?Ot:jt:e?kt:mt).get(n))return n;const h=r(n);if(!t&&h&&i(Q,s))return Reflect.get(Q,s,c);const l=Reflect.get(n,s,c);if(o(s)?D.has(s):B(s))return l;if(t||K(n,0,s),e)return l;if(Ft(l)){return!h||!a(s)?l.value:l}return u(l)?t?Mt(l):Et(l):l}}function X(t=!1){return function(e,n,s,c){let o=e[n];if(At(o)&&Ft(o)&&!Ft(s))return!1;if(!t&&!At(s)&&(Nt(s)||(s=Kt(s),o=Kt(o)),!r(e)&&Ft(o)&&!Ft(s)))return o.value=s,!0;const u=r(e)&&a(n)?Number(n)<e.length:i(e,n),h=Reflect.set(e,n,s,c);return e===Kt(c)&&(u?f(s,o)&&L(e,"set",n,s):L(e,"add",n,s)),h}}const Y={get:F,set:X(),deleteProperty:function(t,e){const n=i(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&L(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return o(e)&&D.has(e)||K(t,0,e),n},ownKeys:function(t){return K(t,0,r(t)?"length":O),Reflect.ownKeys(t)}},Z={get:H,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},$=n({},Y,{get:G,set:X(!0)}),tt=n({},Z,{get:J}),et=t=>t,nt=t=>Reflect.getPrototypeOf(t);function st(t,e,n=!1,s=!1){const i=Kt(t=t.__v_raw),r=Kt(e);e!==r&&!n&&K(i,0,e),!n&&K(i,0,r);const{has:c}=nt(i),o=s?et:n?qt:Lt;return c.call(i,e)?o(t.get(e)):c.call(i,r)?o(t.get(r)):void(t!==i&&t.get(e))}function it(t,e=!1){const n=this.__v_raw,s=Kt(n),i=Kt(t);return t!==i&&!e&&K(s,0,t),!e&&K(s,0,i),t===i?n.has(t):n.has(t)||n.has(i)}function rt(t,e=!1){return t=t.__v_raw,!e&&K(Kt(t),0,O),Reflect.get(t,"size",t)}function ct(t){t=Kt(t);const e=Kt(this);return nt(e).has.call(e,t)||(e.add(t),L(e,"add",t,t)),this}function ot(t,e){e=Kt(e);const n=Kt(this),{has:s,get:i}=nt(n);let r=s.call(n,t);r||(t=Kt(t),r=s.call(n,t));const c=i.call(n,t);return n.set(t,e),r?f(e,c)&&L(n,"set",t,e):L(n,"add",t,e),this}function ut(t){const e=Kt(this),{has:n,get:s}=nt(e);let i=n.call(e,t);i||(t=Kt(t),i=n.call(e,t)),s&&s.call(e,t);const r=e.delete(t);return i&&L(e,"delete",t,void 0),r}function ht(){const t=Kt(this),e=0!==t.size,n=t.clear();return e&&L(t,"clear",void 0,void 0),n}function lt(t,e){return function(n,s){const i=this,r=i.__v_raw,c=Kt(r),o=e?et:t?qt:Lt;return!t&&K(c,0,O),r.forEach(((t,e)=>n.call(s,o(t),o(e),i)))}}function at(t,e,n){return function(...s){const i=this.__v_raw,r=Kt(i),o=c(r),u="entries"===t||t===Symbol.iterator&&o,h="keys"===t&&o,l=i[t](...s),a=n?et:e?qt:Lt;return!e&&K(r,0,h?x:O),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:u?[a(t[0]),a(t[1])]:a(t),done:e}},[Symbol.iterator](){return this}}}}function ft(t){return function(...e){return"delete"!==t&&this}}function _t(){const t={get(t){return st(this,t)},get size(){return rt(this)},has:it,add:ct,set:ot,delete:ut,clear:ht,forEach:lt(!1,!1)},e={get(t){return st(this,t,!1,!0)},get size(){return rt(this)},has:it,add:ct,set:ot,delete:ut,clear:ht,forEach:lt(!1,!0)},n={get(t){return st(this,t,!0)},get size(){return rt(this,!0)},has(t){return it.call(this,t,!0)},add:ft("add"),set:ft("set"),delete:ft("delete"),clear:ft("clear"),forEach:lt(!0,!1)},s={get(t){return st(this,t,!0,!0)},get size(){return rt(this,!0)},has(t){return it.call(this,t,!0)},add:ft("add"),set:ft("set"),delete:ft("delete"),clear:ft("clear"),forEach:lt(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((i=>{t[i]=at(i,!1,!1),n[i]=at(i,!0,!1),e[i]=at(i,!1,!0),s[i]=at(i,!0,!0)})),[t,n,e,s]}const[pt,dt,vt,gt]=_t();function yt(t,e){const n=e?t?gt:vt:t?dt:pt;return(e,s,r)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(i(n,s)&&s in e?n:e,s,r)}const wt={get:yt(!1,!1)},bt={get:yt(!1,!0)},Rt={get:yt(!0,!1)},St={get:yt(!0,!0)},mt=new WeakMap,kt=new WeakMap,jt=new WeakMap,Ot=new WeakMap;function xt(t){return t.__v_skip||!Object.isExtensible(t)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((t=>l(t).slice(8,-1))(t))}function Et(t){return At(t)?t:Wt(t,!1,Y,wt,mt)}function Pt(t){return Wt(t,!1,$,bt,kt)}function Mt(t){return Wt(t,!0,Z,Rt,jt)}function zt(t){return Wt(t,!0,tt,St,Ot)}function Wt(t,e,n,s,i){if(!u(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const r=i.get(t);if(r)return r;const c=xt(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return i.set(t,o),o}function Vt(t){return At(t)?Vt(t.__v_raw):!(!t||!t.__v_isReactive)}function At(t){return!(!t||!t.__v_isReadonly)}function Nt(t){return!(!t||!t.__v_isShallow)}function It(t){return Vt(t)||At(t)}function Kt(t){const e=t&&t.__v_raw;return e?Kt(e):t}function Ct(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t}const Lt=t=>u(t)?Et(t):t,qt=t=>u(t)?Mt(t):t;function Bt(t){W&&j&&C((t=Kt(t)).dep||(t.dep=w()))}function Dt(t,e){(t=Kt(t)).dep&&q(t.dep)}function Ft(t){return!(!t||!0!==t.__v_isRef)}function Gt(t){return Jt(t,!1)}function Ht(t){return Jt(t,!0)}function Jt(t,e){return Ft(t)?t:new Qt(t,e)}class Qt{constructor(t,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Kt(t),this._value=e?t:Lt(t)}get value(){return Bt(this),this._value}set value(t){t=this.__v_isShallow?t:Kt(t),f(t,this._rawValue)&&(this._rawValue=t,this._value=this.__v_isShallow?t:Lt(t),Dt(this))}}function Tt(t){Dt(t)}function Ut(t){return Ft(t)?t.value:t}const Xt={get:(t,e,n)=>Ut(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const i=t[e];return Ft(i)&&!Ft(n)?(i.value=n,!0):Reflect.set(t,e,n,s)}};function Yt(t){return Vt(t)?t:new Proxy(t,Xt)}class Zt{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Bt(this)),(()=>Dt(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}function $t(t){return new Zt(t)}function te(t){const e=r(t)?new Array(t.length):{};for(const n in t)e[n]=ne(t,n);return e}class ee{constructor(t,e,n){this._object=t,this._key=e,this._defaultValue=n,this.__v_isRef=!0}get value(){const t=this._object[this._key];return void 0===t?this._defaultValue:t}set value(t){this._object[this._key]=t}}function ne(t,e,n){const s=t[e];return Ft(s)?s:new ee(t,e,n)}class se{constructor(t,e,n,s){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this._dirty=!0,this.effect=new E(t,(()=>{this._dirty||(this._dirty=!0,Dt(this))})),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=n}get value(){const t=Kt(this);return Bt(t),!t._dirty&&t._cacheable||(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}function ie(t,n,s=!1){let i,r;const c="function"==typeof t;c?(i=t,r=e):(i=t.get,r=t.set);return new se(i,r,c||!r,s)}var re;const ce=Promise.resolve(),oe=[];let ue=!1;const he=()=>{for(let t=0;t<oe.length;t++)oe[t]();oe.length=0,ue=!1};class le{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this[re]=!0;let n=!1,s=!1;this.effect=new E(t,(t=>{if(this.dep){if(t)e=this._value,n=!0;else if(!s){const t=n?e:this._value;s=!0,n=!1,oe.push((()=>{this.effect.active&&this._get()!==t&&Dt(this),s=!1})),ue||(ue=!0,ce.then(he))}for(const t of this.dep)t.computed instanceof le&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=this}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Bt(this),Kt(this)._get()}}function ae(t){return new le(t)}re="__v_isReadonly";export{p as EffectScope,O as ITERATE_KEY,E as ReactiveEffect,ie as computed,$t as customRef,ae as deferredComputed,M as effect,d as effectScope,N as enableTracking,g as getCurrentScope,It as isProxy,Vt as isReactive,At as isReadonly,Ft as isRef,Nt as isShallow,Ct as markRaw,y as onScopeDispose,A as pauseTracking,Yt as proxyRefs,Et as reactive,Mt as readonly,Gt as ref,I as resetTracking,Pt as shallowReactive,zt as shallowReadonly,Ht as shallowRef,z as stop,Kt as toRaw,ne as toRef,te as toRefs,K as track,L as trigger,Tt as triggerRef,Ut as unref};
@@ -1,4 +1,4 @@
1
- import { extend, isArray, isMap, isIntegerKey, isSymbol, hasOwn, isObject, hasChanged, makeMap, capitalize, toRawType, def, isFunction, NOOP } from '@vue/shared';
1
+ import { extend, isArray, isMap, isIntegerKey, hasOwn, isSymbol, isObject, hasChanged, makeMap, capitalize, toRawType, def, isFunction, NOOP } from '@vue/shared';
2
2
 
3
3
  function warn(msg, ...args) {
4
4
  console.warn(`[Vue warn] ${msg}`, ...args);
@@ -7,8 +7,17 @@ function warn(msg, ...args) {
7
7
  let activeEffectScope;
8
8
  class EffectScope {
9
9
  constructor(detached = false) {
10
+ /**
11
+ * @internal
12
+ */
10
13
  this.active = true;
14
+ /**
15
+ * @internal
16
+ */
11
17
  this.effects = [];
18
+ /**
19
+ * @internal
20
+ */
12
21
  this.cleanups = [];
13
22
  if (!detached && activeEffectScope) {
14
23
  this.parent = activeEffectScope;
@@ -18,21 +27,30 @@ class EffectScope {
18
27
  }
19
28
  run(fn) {
20
29
  if (this.active) {
30
+ const currentEffectScope = activeEffectScope;
21
31
  try {
22
32
  activeEffectScope = this;
23
33
  return fn();
24
34
  }
25
35
  finally {
26
- activeEffectScope = this.parent;
36
+ activeEffectScope = currentEffectScope;
27
37
  }
28
38
  }
29
39
  else if ((process.env.NODE_ENV !== 'production')) {
30
40
  warn(`cannot run an inactive effect scope.`);
31
41
  }
32
42
  }
43
+ /**
44
+ * This should only be called on non-detached scopes
45
+ * @internal
46
+ */
33
47
  on() {
34
48
  activeEffectScope = this;
35
49
  }
50
+ /**
51
+ * This should only be called on non-detached scopes
52
+ * @internal
53
+ */
36
54
  off() {
37
55
  activeEffectScope = this.parent;
38
56
  }
@@ -174,10 +192,17 @@ class ReactiveEffect {
174
192
  activeEffect = this.parent;
175
193
  shouldTrack = lastShouldTrack;
176
194
  this.parent = undefined;
195
+ if (this.deferStop) {
196
+ this.stop();
197
+ }
177
198
  }
178
199
  }
179
200
  stop() {
180
- if (this.active) {
201
+ // stopped while running itself - defer the cleanup
202
+ if (activeEffect === this) {
203
+ this.deferStop = true;
204
+ }
205
+ else if (this.active) {
181
206
  cleanupEffect(this);
182
207
  if (this.onStop) {
183
208
  this.onStop();
@@ -261,9 +286,7 @@ function trackEffects(dep, debuggerEventExtraInfo) {
261
286
  dep.add(activeEffect);
262
287
  activeEffect.deps.push(dep);
263
288
  if ((process.env.NODE_ENV !== 'production') && activeEffect.onTrack) {
264
- activeEffect.onTrack(Object.assign({
265
- effect: activeEffect
266
- }, debuggerEventExtraInfo));
289
+ activeEffect.onTrack(Object.assign({ effect: activeEffect }, debuggerEventExtraInfo));
267
290
  }
268
291
  }
269
292
  }
@@ -366,7 +389,9 @@ function triggerEffects(dep, debuggerEventExtraInfo) {
366
389
  }
367
390
 
368
391
  const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
369
- const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
392
+ const builtInSymbols = new Set(
393
+ /*#__PURE__*/
394
+ Object.getOwnPropertyNames(Symbol)
370
395
  .map(key => Symbol[key])
371
396
  .filter(isSymbol));
372
397
  const get = /*#__PURE__*/ createGetter();
@@ -518,13 +543,13 @@ const readonlyHandlers = {
518
543
  get: readonlyGet,
519
544
  set(target, key) {
520
545
  if ((process.env.NODE_ENV !== 'production')) {
521
- console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
546
+ warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
522
547
  }
523
548
  return true;
524
549
  },
525
550
  deleteProperty(target, key) {
526
551
  if ((process.env.NODE_ENV !== 'production')) {
527
- console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
552
+ warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
528
553
  }
529
554
  return true;
530
555
  }
@@ -1131,7 +1156,7 @@ function computed(getterOrOptions, debugOptions, isSSR = false) {
1131
1156
  }
1132
1157
 
1133
1158
  var _a;
1134
- const tick = Promise.resolve();
1159
+ const tick = /*#__PURE__*/ Promise.resolve();
1135
1160
  const queue = [];
1136
1161
  let queued = false;
1137
1162
  const scheduler = (fn) => {
@@ -67,8 +67,17 @@ var VueReactivity = (function (exports) {
67
67
  let activeEffectScope;
68
68
  class EffectScope {
69
69
  constructor(detached = false) {
70
+ /**
71
+ * @internal
72
+ */
70
73
  this.active = true;
74
+ /**
75
+ * @internal
76
+ */
71
77
  this.effects = [];
78
+ /**
79
+ * @internal
80
+ */
72
81
  this.cleanups = [];
73
82
  if (!detached && activeEffectScope) {
74
83
  this.parent = activeEffectScope;
@@ -78,21 +87,30 @@ var VueReactivity = (function (exports) {
78
87
  }
79
88
  run(fn) {
80
89
  if (this.active) {
90
+ const currentEffectScope = activeEffectScope;
81
91
  try {
82
92
  activeEffectScope = this;
83
93
  return fn();
84
94
  }
85
95
  finally {
86
- activeEffectScope = this.parent;
96
+ activeEffectScope = currentEffectScope;
87
97
  }
88
98
  }
89
99
  else {
90
100
  warn(`cannot run an inactive effect scope.`);
91
101
  }
92
102
  }
103
+ /**
104
+ * This should only be called on non-detached scopes
105
+ * @internal
106
+ */
93
107
  on() {
94
108
  activeEffectScope = this;
95
109
  }
110
+ /**
111
+ * This should only be called on non-detached scopes
112
+ * @internal
113
+ */
96
114
  off() {
97
115
  activeEffectScope = this.parent;
98
116
  }
@@ -234,10 +252,17 @@ var VueReactivity = (function (exports) {
234
252
  activeEffect = this.parent;
235
253
  shouldTrack = lastShouldTrack;
236
254
  this.parent = undefined;
255
+ if (this.deferStop) {
256
+ this.stop();
257
+ }
237
258
  }
238
259
  }
239
260
  stop() {
240
- if (this.active) {
261
+ // stopped while running itself - defer the cleanup
262
+ if (activeEffect === this) {
263
+ this.deferStop = true;
264
+ }
265
+ else if (this.active) {
241
266
  cleanupEffect(this);
242
267
  if (this.onStop) {
243
268
  this.onStop();
@@ -320,9 +345,7 @@ var VueReactivity = (function (exports) {
320
345
  dep.add(activeEffect);
321
346
  activeEffect.deps.push(dep);
322
347
  if (activeEffect.onTrack) {
323
- activeEffect.onTrack(Object.assign({
324
- effect: activeEffect
325
- }, debuggerEventExtraInfo));
348
+ activeEffect.onTrack(Object.assign({ effect: activeEffect }, debuggerEventExtraInfo));
326
349
  }
327
350
  }
328
351
  }
@@ -418,7 +441,9 @@ var VueReactivity = (function (exports) {
418
441
  }
419
442
 
420
443
  const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
421
- const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
444
+ const builtInSymbols = new Set(
445
+ /*#__PURE__*/
446
+ Object.getOwnPropertyNames(Symbol)
422
447
  .map(key => Symbol[key])
423
448
  .filter(isSymbol));
424
449
  const get = /*#__PURE__*/ createGetter();
@@ -570,13 +595,13 @@ var VueReactivity = (function (exports) {
570
595
  get: readonlyGet,
571
596
  set(target, key) {
572
597
  {
573
- console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
598
+ warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
574
599
  }
575
600
  return true;
576
601
  },
577
602
  deleteProperty(target, key) {
578
603
  {
579
- console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
604
+ warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
580
605
  }
581
606
  return true;
582
607
  }
@@ -1175,7 +1200,7 @@ var VueReactivity = (function (exports) {
1175
1200
  }
1176
1201
 
1177
1202
  var _a;
1178
- const tick = Promise.resolve();
1203
+ const tick = /*#__PURE__*/ Promise.resolve();
1179
1204
  const queue = [];
1180
1205
  let queued = false;
1181
1206
  const scheduler = (fn) => {
@@ -1 +1 @@
1
- var VueReactivity=function(t){"use strict";function e(t,e){const n=Object.create(null),s=t.split(",");for(let i=0;i<s.length;i++)n[s[i]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const n=()=>{},s=Object.assign,i=Object.prototype.hasOwnProperty,r=(t,e)=>i.call(t,e),c=Array.isArray,o=t=>"[object Map]"===h(t),u=t=>"symbol"==typeof t,a=t=>null!==t&&"object"==typeof t,l=Object.prototype.toString,h=t=>l.call(t),f=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,_=(t,e)=>!Object.is(t,e);let p;class d{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],!t&&p&&(this.parent=p,this.index=(p.scopes||(p.scopes=[])).push(this)-1)}run(t){if(this.active)try{return p=this,t()}finally{p=this.parent}}on(){p=this}off(){p=this.parent}stop(t){if(this.active){let e,n;for(e=0,n=this.effects.length;e<n;e++)this.effects[e].stop();for(e=0,n=this.cleanups.length;e<n;e++)this.cleanups[e]();if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].stop(!0);if(this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.active=!1}}}function v(t,e=p){e&&e.active&&e.effects.push(t)}const g=t=>{const e=new Set(t);return e.w=0,e.n=0,e},y=t=>(t.w&S)>0,w=t=>(t.n&S)>0,R=new WeakMap;let b=0,S=1;let k;const m=Symbol(""),j=Symbol("");class E{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],this.parent=void 0,v(this,n)}run(){if(!this.active)return this.fn();let t=k,e=x;for(;t;){if(t===this)return;t=t.parent}try{return this.parent=k,k=this,x=!0,S=1<<++b,b<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=S})(this):O(this),this.fn()}finally{b<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const i=e[s];y(i)&&!w(i)?i.delete(t):e[n++]=i,i.w&=~S,i.n&=~S}e.length=n}})(this),S=1<<--b,k=this.parent,x=e,this.parent=void 0}}stop(){this.active&&(O(this),this.onStop&&this.onStop(),this.active=!1)}}function O(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let x=!0;const P=[];function M(){P.push(x),x=!1}function z(){const t=P.pop();x=void 0===t||t}function V(t,e,n){if(x&&k){let e=R.get(t);e||R.set(t,e=new Map);let s=e.get(n);s||e.set(n,s=g()),W(s)}}function W(t,e){let n=!1;b<=30?w(t)||(t.n|=S,n=!y(t)):n=!t.has(k),n&&(t.add(k),k.deps.push(t))}function A(t,e,n,s,i,r){const u=R.get(t);if(!u)return;let a=[];if("clear"===e)a=[...u.values()];else if("length"===n&&c(t))u.forEach(((t,e)=>{("length"===e||e>=s)&&a.push(t)}));else switch(void 0!==n&&a.push(u.get(n)),e){case"add":c(t)?f(n)&&a.push(u.get("length")):(a.push(u.get(m)),o(t)&&a.push(u.get(j)));break;case"delete":c(t)||(a.push(u.get(m)),o(t)&&a.push(u.get(j)));break;case"set":o(t)&&a.push(u.get(m))}if(1===a.length)a[0]&&T(a[0]);else{const t=[];for(const e of a)e&&t.push(...e);T(g(t))}}function T(t,e){for(const n of c(t)?t:[...t])(n!==k||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const N=e("__proto__,__v_isRef,__isVue"),C=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(u)),I=B(),K=B(!1,!0),D=B(!0),L=B(!0,!0),Y=q();function q(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Pt(this);for(let e=0,i=this.length;e<i;e++)V(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(Pt)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){M();const n=Pt(this)[e].apply(this,t);return z(),n}})),t}function B(t=!1,e=!1){return function(n,s,i){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_isShallow"===s)return e;if("__v_raw"===s&&i===(t?e?bt:Rt:e?wt:yt).get(n))return n;const o=c(n);if(!t&&o&&r(Y,s))return Reflect.get(Y,s,i);const l=Reflect.get(n,s,i);if(u(s)?C.has(s):N(s))return l;if(t||V(n,0,s),e)return l;if(At(l)){return!o||!f(s)?l.value:l}return a(l)?t?mt(l):kt(l):l}}function F(t=!1){return function(e,n,s,i){let o=e[n];if(Ot(o)&&At(o)&&!At(s))return!1;if(!t&&!Ot(s)&&(xt(s)||(s=Pt(s),o=Pt(o)),!c(e)&&At(o)&&!At(s)))return o.value=s,!0;const u=c(e)&&f(n)?Number(n)<e.length:r(e,n),a=Reflect.set(e,n,s,i);return e===Pt(i)&&(u?_(s,o)&&A(e,"set",n,s):A(e,"add",n,s)),a}}const G={get:I,set:F(),deleteProperty:function(t,e){const n=r(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&A(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return u(e)&&C.has(e)||V(t,0,e),n},ownKeys:function(t){return V(t,0,c(t)?"length":m),Reflect.ownKeys(t)}},H={get:D,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},J=s({},G,{get:K,set:F(!0)}),Q=s({},H,{get:L}),U=t=>t,X=t=>Reflect.getPrototypeOf(t);function Z(t,e,n=!1,s=!1){const i=Pt(t=t.__v_raw),r=Pt(e);e!==r&&!n&&V(i,0,e),!n&&V(i,0,r);const{has:c}=X(i),o=s?U:n?zt:Mt;return c.call(i,e)?o(t.get(e)):c.call(i,r)?o(t.get(r)):void(t!==i&&t.get(e))}function $(t,e=!1){const n=this.__v_raw,s=Pt(n),i=Pt(t);return t!==i&&!e&&V(s,0,t),!e&&V(s,0,i),t===i?n.has(t):n.has(t)||n.has(i)}function tt(t,e=!1){return t=t.__v_raw,!e&&V(Pt(t),0,m),Reflect.get(t,"size",t)}function et(t){t=Pt(t);const e=Pt(this);return X(e).has.call(e,t)||(e.add(t),A(e,"add",t,t)),this}function nt(t,e){e=Pt(e);const n=Pt(this),{has:s,get:i}=X(n);let r=s.call(n,t);r||(t=Pt(t),r=s.call(n,t));const c=i.call(n,t);return n.set(t,e),r?_(e,c)&&A(n,"set",t,e):A(n,"add",t,e),this}function st(t){const e=Pt(this),{has:n,get:s}=X(e);let i=n.call(e,t);i||(t=Pt(t),i=n.call(e,t)),s&&s.call(e,t);const r=e.delete(t);return i&&A(e,"delete",t,void 0),r}function it(){const t=Pt(this),e=0!==t.size,n=t.clear();return e&&A(t,"clear",void 0,void 0),n}function rt(t,e){return function(n,s){const i=this,r=i.__v_raw,c=Pt(r),o=e?U:t?zt:Mt;return!t&&V(c,0,m),r.forEach(((t,e)=>n.call(s,o(t),o(e),i)))}}function ct(t,e,n){return function(...s){const i=this.__v_raw,r=Pt(i),c=o(r),u="entries"===t||t===Symbol.iterator&&c,a="keys"===t&&c,l=i[t](...s),h=n?U:e?zt:Mt;return!e&&V(r,0,a?j:m),{next(){const{value:t,done:e}=l.next();return e?{value:t,done:e}:{value:u?[h(t[0]),h(t[1])]:h(t),done:e}},[Symbol.iterator](){return this}}}}function ot(t){return function(...e){return"delete"!==t&&this}}function ut(){const t={get(t){return Z(this,t)},get size(){return tt(this)},has:$,add:et,set:nt,delete:st,clear:it,forEach:rt(!1,!1)},e={get(t){return Z(this,t,!1,!0)},get size(){return tt(this)},has:$,add:et,set:nt,delete:st,clear:it,forEach:rt(!1,!0)},n={get(t){return Z(this,t,!0)},get size(){return tt(this,!0)},has(t){return $.call(this,t,!0)},add:ot("add"),set:ot("set"),delete:ot("delete"),clear:ot("clear"),forEach:rt(!0,!1)},s={get(t){return Z(this,t,!0,!0)},get size(){return tt(this,!0)},has(t){return $.call(this,t,!0)},add:ot("add"),set:ot("set"),delete:ot("delete"),clear:ot("clear"),forEach:rt(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((i=>{t[i]=ct(i,!1,!1),n[i]=ct(i,!0,!1),e[i]=ct(i,!1,!0),s[i]=ct(i,!0,!0)})),[t,n,e,s]}const[at,lt,ht,ft]=ut();function _t(t,e){const n=e?t?ft:ht:t?lt:at;return(e,s,i)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(r(n,s)&&s in e?n:e,s,i)}const pt={get:_t(!1,!1)},dt={get:_t(!1,!0)},vt={get:_t(!0,!1)},gt={get:_t(!0,!0)},yt=new WeakMap,wt=new WeakMap,Rt=new WeakMap,bt=new WeakMap;function St(t){return t.__v_skip||!Object.isExtensible(t)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((t=>h(t).slice(8,-1))(t))}function kt(t){return Ot(t)?t:jt(t,!1,G,pt,yt)}function mt(t){return jt(t,!0,H,vt,Rt)}function jt(t,e,n,s,i){if(!a(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const r=i.get(t);if(r)return r;const c=St(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return i.set(t,o),o}function Et(t){return Ot(t)?Et(t.__v_raw):!(!t||!t.__v_isReactive)}function Ot(t){return!(!t||!t.__v_isReadonly)}function xt(t){return!(!t||!t.__v_isShallow)}function Pt(t){const e=t&&t.__v_raw;return e?Pt(e):t}const Mt=t=>a(t)?kt(t):t,zt=t=>a(t)?mt(t):t;function Vt(t){x&&k&&W((t=Pt(t)).dep||(t.dep=g()))}function Wt(t,e){(t=Pt(t)).dep&&T(t.dep)}function At(t){return!(!t||!0!==t.__v_isRef)}function Tt(t,e){return At(t)?t:new Nt(t,e)}class Nt{constructor(t,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Pt(t),this._value=e?t:Mt(t)}get value(){return Vt(this),this._value}set value(t){t=this.__v_isShallow?t:Pt(t),_(t,this._rawValue)&&(this._rawValue=t,this._value=this.__v_isShallow?t:Mt(t),Wt(this))}}function Ct(t){return At(t)?t.value:t}const It={get:(t,e,n)=>Ct(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const i=t[e];return At(i)&&!At(n)?(i.value=n,!0):Reflect.set(t,e,n,s)}};class Kt{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Vt(this)),(()=>Wt(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}class Dt{constructor(t,e,n){this._object=t,this._key=e,this._defaultValue=n,this.__v_isRef=!0}get value(){const t=this._object[this._key];return void 0===t?this._defaultValue:t}set value(t){this._object[this._key]=t}}function Lt(t,e,n){const s=t[e];return At(s)?s:new Dt(t,e,n)}class Yt{constructor(t,e,n,s){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this._dirty=!0,this.effect=new E(t,(()=>{this._dirty||(this._dirty=!0,Wt(this))})),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=n}get value(){const t=Pt(this);return Vt(t),!t._dirty&&t._cacheable||(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}var qt;const Bt=Promise.resolve(),Ft=[];let Gt=!1;const Ht=()=>{for(let t=0;t<Ft.length;t++)Ft[t]();Ft.length=0,Gt=!1};class Jt{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this[qt]=!0;let n=!1,s=!1;this.effect=new E(t,(t=>{if(this.dep){if(t)e=this._value,n=!0;else if(!s){const t=n?e:this._value;s=!0,n=!1,Ft.push((()=>{this.effect.active&&this._get()!==t&&Wt(this),s=!1})),Gt||(Gt=!0,Bt.then(Ht))}for(const t of this.dep)t.computed instanceof Jt&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=this}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Vt(this),Pt(this)._get()}}return qt="__v_isReadonly",t.EffectScope=d,t.ITERATE_KEY=m,t.ReactiveEffect=E,t.computed=function(t,e,s=!1){let i,r;const c="function"==typeof t;return c?(i=t,r=n):(i=t.get,r=t.set),new Yt(i,r,c||!r,s)},t.customRef=function(t){return new Kt(t)},t.deferredComputed=function(t){return new Jt(t)},t.effect=function(t,e){t.effect&&(t=t.effect.fn);const n=new E(t);e&&(s(n,e),e.scope&&v(n,e.scope)),e&&e.lazy||n.run();const i=n.run.bind(n);return i.effect=n,i},t.effectScope=function(t){return new d(t)},t.enableTracking=function(){P.push(x),x=!0},t.getCurrentScope=function(){return p},t.isProxy=function(t){return Et(t)||Ot(t)},t.isReactive=Et,t.isReadonly=Ot,t.isRef=At,t.isShallow=xt,t.markRaw=function(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t},t.onScopeDispose=function(t){p&&p.cleanups.push(t)},t.pauseTracking=M,t.proxyRefs=function(t){return Et(t)?t:new Proxy(t,It)},t.reactive=kt,t.readonly=mt,t.ref=function(t){return Tt(t,!1)},t.resetTracking=z,t.shallowReactive=function(t){return jt(t,!1,J,dt,wt)},t.shallowReadonly=function(t){return jt(t,!0,Q,gt,bt)},t.shallowRef=function(t){return Tt(t,!0)},t.stop=function(t){t.effect.stop()},t.toRaw=Pt,t.toRef=Lt,t.toRefs=function(t){const e=c(t)?new Array(t.length):{};for(const n in t)e[n]=Lt(t,n);return e},t.track=V,t.trigger=A,t.triggerRef=function(t){Wt(t)},t.unref=Ct,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
1
+ var VueReactivity=function(t){"use strict";function e(t,e){const n=Object.create(null),s=t.split(",");for(let i=0;i<s.length;i++)n[s[i]]=!0;return e?t=>!!n[t.toLowerCase()]:t=>!!n[t]}const n=()=>{},s=Object.assign,i=Object.prototype.hasOwnProperty,r=(t,e)=>i.call(t,e),c=Array.isArray,o=t=>"[object Map]"===l(t),u=t=>"symbol"==typeof t,a=t=>null!==t&&"object"==typeof t,h=Object.prototype.toString,l=t=>h.call(t),f=t=>"string"==typeof t&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,_=(t,e)=>!Object.is(t,e);let p;class d{constructor(t=!1){this.active=!0,this.effects=[],this.cleanups=[],!t&&p&&(this.parent=p,this.index=(p.scopes||(p.scopes=[])).push(this)-1)}run(t){if(this.active){const e=p;try{return p=this,t()}finally{p=e}}}on(){p=this}off(){p=this.parent}stop(t){if(this.active){let e,n;for(e=0,n=this.effects.length;e<n;e++)this.effects[e].stop();for(e=0,n=this.cleanups.length;e<n;e++)this.cleanups[e]();if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].stop(!0);if(this.parent&&!t){const t=this.parent.scopes.pop();t&&t!==this&&(this.parent.scopes[this.index]=t,t.index=this.index)}this.active=!1}}}function v(t,e=p){e&&e.active&&e.effects.push(t)}const g=t=>{const e=new Set(t);return e.w=0,e.n=0,e},y=t=>(t.w&S)>0,w=t=>(t.n&S)>0,R=new WeakMap;let b=0,S=1;let k;const m=Symbol(""),j=Symbol("");class E{constructor(t,e=null,n){this.fn=t,this.scheduler=e,this.active=!0,this.deps=[],this.parent=void 0,v(this,n)}run(){if(!this.active)return this.fn();let t=k,e=x;for(;t;){if(t===this)return;t=t.parent}try{return this.parent=k,k=this,x=!0,S=1<<++b,b<=30?(({deps:t})=>{if(t.length)for(let e=0;e<t.length;e++)t[e].w|=S})(this):O(this),this.fn()}finally{b<=30&&(t=>{const{deps:e}=t;if(e.length){let n=0;for(let s=0;s<e.length;s++){const i=e[s];y(i)&&!w(i)?i.delete(t):e[n++]=i,i.w&=~S,i.n&=~S}e.length=n}})(this),S=1<<--b,k=this.parent,x=e,this.parent=void 0,this.deferStop&&this.stop()}}stop(){k===this?this.deferStop=!0:this.active&&(O(this),this.onStop&&this.onStop(),this.active=!1)}}function O(t){const{deps:e}=t;if(e.length){for(let n=0;n<e.length;n++)e[n].delete(t);e.length=0}}let x=!0;const P=[];function M(){P.push(x),x=!1}function z(){const t=P.pop();x=void 0===t||t}function V(t,e,n){if(x&&k){let e=R.get(t);e||R.set(t,e=new Map);let s=e.get(n);s||e.set(n,s=g()),W(s)}}function W(t,e){let n=!1;b<=30?w(t)||(t.n|=S,n=!y(t)):n=!t.has(k),n&&(t.add(k),k.deps.push(t))}function A(t,e,n,s,i,r){const u=R.get(t);if(!u)return;let a=[];if("clear"===e)a=[...u.values()];else if("length"===n&&c(t))u.forEach(((t,e)=>{("length"===e||e>=s)&&a.push(t)}));else switch(void 0!==n&&a.push(u.get(n)),e){case"add":c(t)?f(n)&&a.push(u.get("length")):(a.push(u.get(m)),o(t)&&a.push(u.get(j)));break;case"delete":c(t)||(a.push(u.get(m)),o(t)&&a.push(u.get(j)));break;case"set":o(t)&&a.push(u.get(m))}if(1===a.length)a[0]&&T(a[0]);else{const t=[];for(const e of a)e&&t.push(...e);T(g(t))}}function T(t,e){for(const n of c(t)?t:[...t])(n!==k||n.allowRecurse)&&(n.scheduler?n.scheduler():n.run())}const N=e("__proto__,__v_isRef,__isVue"),C=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(u)),I=B(),K=B(!1,!0),D=B(!0),L=B(!0,!0),Y=q();function q(){const t={};return["includes","indexOf","lastIndexOf"].forEach((e=>{t[e]=function(...t){const n=Pt(this);for(let e=0,i=this.length;e<i;e++)V(n,0,e+"");const s=n[e](...t);return-1===s||!1===s?n[e](...t.map(Pt)):s}})),["push","pop","shift","unshift","splice"].forEach((e=>{t[e]=function(...t){M();const n=Pt(this)[e].apply(this,t);return z(),n}})),t}function B(t=!1,e=!1){return function(n,s,i){if("__v_isReactive"===s)return!t;if("__v_isReadonly"===s)return t;if("__v_isShallow"===s)return e;if("__v_raw"===s&&i===(t?e?bt:Rt:e?wt:yt).get(n))return n;const o=c(n);if(!t&&o&&r(Y,s))return Reflect.get(Y,s,i);const h=Reflect.get(n,s,i);if(u(s)?C.has(s):N(s))return h;if(t||V(n,0,s),e)return h;if(At(h)){return!o||!f(s)?h.value:h}return a(h)?t?mt(h):kt(h):h}}function F(t=!1){return function(e,n,s,i){let o=e[n];if(Ot(o)&&At(o)&&!At(s))return!1;if(!t&&!Ot(s)&&(xt(s)||(s=Pt(s),o=Pt(o)),!c(e)&&At(o)&&!At(s)))return o.value=s,!0;const u=c(e)&&f(n)?Number(n)<e.length:r(e,n),a=Reflect.set(e,n,s,i);return e===Pt(i)&&(u?_(s,o)&&A(e,"set",n,s):A(e,"add",n,s)),a}}const G={get:I,set:F(),deleteProperty:function(t,e){const n=r(t,e),s=Reflect.deleteProperty(t,e);return s&&n&&A(t,"delete",e,void 0),s},has:function(t,e){const n=Reflect.has(t,e);return u(e)&&C.has(e)||V(t,0,e),n},ownKeys:function(t){return V(t,0,c(t)?"length":m),Reflect.ownKeys(t)}},H={get:D,set:(t,e)=>!0,deleteProperty:(t,e)=>!0},J=s({},G,{get:K,set:F(!0)}),Q=s({},H,{get:L}),U=t=>t,X=t=>Reflect.getPrototypeOf(t);function Z(t,e,n=!1,s=!1){const i=Pt(t=t.__v_raw),r=Pt(e);e!==r&&!n&&V(i,0,e),!n&&V(i,0,r);const{has:c}=X(i),o=s?U:n?zt:Mt;return c.call(i,e)?o(t.get(e)):c.call(i,r)?o(t.get(r)):void(t!==i&&t.get(e))}function $(t,e=!1){const n=this.__v_raw,s=Pt(n),i=Pt(t);return t!==i&&!e&&V(s,0,t),!e&&V(s,0,i),t===i?n.has(t):n.has(t)||n.has(i)}function tt(t,e=!1){return t=t.__v_raw,!e&&V(Pt(t),0,m),Reflect.get(t,"size",t)}function et(t){t=Pt(t);const e=Pt(this);return X(e).has.call(e,t)||(e.add(t),A(e,"add",t,t)),this}function nt(t,e){e=Pt(e);const n=Pt(this),{has:s,get:i}=X(n);let r=s.call(n,t);r||(t=Pt(t),r=s.call(n,t));const c=i.call(n,t);return n.set(t,e),r?_(e,c)&&A(n,"set",t,e):A(n,"add",t,e),this}function st(t){const e=Pt(this),{has:n,get:s}=X(e);let i=n.call(e,t);i||(t=Pt(t),i=n.call(e,t)),s&&s.call(e,t);const r=e.delete(t);return i&&A(e,"delete",t,void 0),r}function it(){const t=Pt(this),e=0!==t.size,n=t.clear();return e&&A(t,"clear",void 0,void 0),n}function rt(t,e){return function(n,s){const i=this,r=i.__v_raw,c=Pt(r),o=e?U:t?zt:Mt;return!t&&V(c,0,m),r.forEach(((t,e)=>n.call(s,o(t),o(e),i)))}}function ct(t,e,n){return function(...s){const i=this.__v_raw,r=Pt(i),c=o(r),u="entries"===t||t===Symbol.iterator&&c,a="keys"===t&&c,h=i[t](...s),l=n?U:e?zt:Mt;return!e&&V(r,0,a?j:m),{next(){const{value:t,done:e}=h.next();return e?{value:t,done:e}:{value:u?[l(t[0]),l(t[1])]:l(t),done:e}},[Symbol.iterator](){return this}}}}function ot(t){return function(...e){return"delete"!==t&&this}}function ut(){const t={get(t){return Z(this,t)},get size(){return tt(this)},has:$,add:et,set:nt,delete:st,clear:it,forEach:rt(!1,!1)},e={get(t){return Z(this,t,!1,!0)},get size(){return tt(this)},has:$,add:et,set:nt,delete:st,clear:it,forEach:rt(!1,!0)},n={get(t){return Z(this,t,!0)},get size(){return tt(this,!0)},has(t){return $.call(this,t,!0)},add:ot("add"),set:ot("set"),delete:ot("delete"),clear:ot("clear"),forEach:rt(!0,!1)},s={get(t){return Z(this,t,!0,!0)},get size(){return tt(this,!0)},has(t){return $.call(this,t,!0)},add:ot("add"),set:ot("set"),delete:ot("delete"),clear:ot("clear"),forEach:rt(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach((i=>{t[i]=ct(i,!1,!1),n[i]=ct(i,!0,!1),e[i]=ct(i,!1,!0),s[i]=ct(i,!0,!0)})),[t,n,e,s]}const[at,ht,lt,ft]=ut();function _t(t,e){const n=e?t?ft:lt:t?ht:at;return(e,s,i)=>"__v_isReactive"===s?!t:"__v_isReadonly"===s?t:"__v_raw"===s?e:Reflect.get(r(n,s)&&s in e?n:e,s,i)}const pt={get:_t(!1,!1)},dt={get:_t(!1,!0)},vt={get:_t(!0,!1)},gt={get:_t(!0,!0)},yt=new WeakMap,wt=new WeakMap,Rt=new WeakMap,bt=new WeakMap;function St(t){return t.__v_skip||!Object.isExtensible(t)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}((t=>l(t).slice(8,-1))(t))}function kt(t){return Ot(t)?t:jt(t,!1,G,pt,yt)}function mt(t){return jt(t,!0,H,vt,Rt)}function jt(t,e,n,s,i){if(!a(t))return t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const r=i.get(t);if(r)return r;const c=St(t);if(0===c)return t;const o=new Proxy(t,2===c?s:n);return i.set(t,o),o}function Et(t){return Ot(t)?Et(t.__v_raw):!(!t||!t.__v_isReactive)}function Ot(t){return!(!t||!t.__v_isReadonly)}function xt(t){return!(!t||!t.__v_isShallow)}function Pt(t){const e=t&&t.__v_raw;return e?Pt(e):t}const Mt=t=>a(t)?kt(t):t,zt=t=>a(t)?mt(t):t;function Vt(t){x&&k&&W((t=Pt(t)).dep||(t.dep=g()))}function Wt(t,e){(t=Pt(t)).dep&&T(t.dep)}function At(t){return!(!t||!0!==t.__v_isRef)}function Tt(t,e){return At(t)?t:new Nt(t,e)}class Nt{constructor(t,e){this.__v_isShallow=e,this.dep=void 0,this.__v_isRef=!0,this._rawValue=e?t:Pt(t),this._value=e?t:Mt(t)}get value(){return Vt(this),this._value}set value(t){t=this.__v_isShallow?t:Pt(t),_(t,this._rawValue)&&(this._rawValue=t,this._value=this.__v_isShallow?t:Mt(t),Wt(this))}}function Ct(t){return At(t)?t.value:t}const It={get:(t,e,n)=>Ct(Reflect.get(t,e,n)),set:(t,e,n,s)=>{const i=t[e];return At(i)&&!At(n)?(i.value=n,!0):Reflect.set(t,e,n,s)}};class Kt{constructor(t){this.dep=void 0,this.__v_isRef=!0;const{get:e,set:n}=t((()=>Vt(this)),(()=>Wt(this)));this._get=e,this._set=n}get value(){return this._get()}set value(t){this._set(t)}}class Dt{constructor(t,e,n){this._object=t,this._key=e,this._defaultValue=n,this.__v_isRef=!0}get value(){const t=this._object[this._key];return void 0===t?this._defaultValue:t}set value(t){this._object[this._key]=t}}function Lt(t,e,n){const s=t[e];return At(s)?s:new Dt(t,e,n)}class Yt{constructor(t,e,n,s){this._setter=e,this.dep=void 0,this.__v_isRef=!0,this._dirty=!0,this.effect=new E(t,(()=>{this._dirty||(this._dirty=!0,Wt(this))})),this.effect.computed=this,this.effect.active=this._cacheable=!s,this.__v_isReadonly=n}get value(){const t=Pt(this);return Vt(t),!t._dirty&&t._cacheable||(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}var qt;const Bt=Promise.resolve(),Ft=[];let Gt=!1;const Ht=()=>{for(let t=0;t<Ft.length;t++)Ft[t]();Ft.length=0,Gt=!1};class Jt{constructor(t){let e;this.dep=void 0,this._dirty=!0,this.__v_isRef=!0,this[qt]=!0;let n=!1,s=!1;this.effect=new E(t,(t=>{if(this.dep){if(t)e=this._value,n=!0;else if(!s){const t=n?e:this._value;s=!0,n=!1,Ft.push((()=>{this.effect.active&&this._get()!==t&&Wt(this),s=!1})),Gt||(Gt=!0,Bt.then(Ht))}for(const t of this.dep)t.computed instanceof Jt&&t.scheduler(!0)}this._dirty=!0})),this.effect.computed=this}_get(){return this._dirty?(this._dirty=!1,this._value=this.effect.run()):this._value}get value(){return Vt(this),Pt(this)._get()}}return qt="__v_isReadonly",t.EffectScope=d,t.ITERATE_KEY=m,t.ReactiveEffect=E,t.computed=function(t,e,s=!1){let i,r;const c="function"==typeof t;return c?(i=t,r=n):(i=t.get,r=t.set),new Yt(i,r,c||!r,s)},t.customRef=function(t){return new Kt(t)},t.deferredComputed=function(t){return new Jt(t)},t.effect=function(t,e){t.effect&&(t=t.effect.fn);const n=new E(t);e&&(s(n,e),e.scope&&v(n,e.scope)),e&&e.lazy||n.run();const i=n.run.bind(n);return i.effect=n,i},t.effectScope=function(t){return new d(t)},t.enableTracking=function(){P.push(x),x=!0},t.getCurrentScope=function(){return p},t.isProxy=function(t){return Et(t)||Ot(t)},t.isReactive=Et,t.isReadonly=Ot,t.isRef=At,t.isShallow=xt,t.markRaw=function(t){return((t,e,n)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:n})})(t,"__v_skip",!0),t},t.onScopeDispose=function(t){p&&p.cleanups.push(t)},t.pauseTracking=M,t.proxyRefs=function(t){return Et(t)?t:new Proxy(t,It)},t.reactive=kt,t.readonly=mt,t.ref=function(t){return Tt(t,!1)},t.resetTracking=z,t.shallowReactive=function(t){return jt(t,!1,J,dt,wt)},t.shallowReadonly=function(t){return jt(t,!0,Q,gt,bt)},t.shallowRef=function(t){return Tt(t,!0)},t.stop=function(t){t.effect.stop()},t.toRaw=Pt,t.toRef=Lt,t.toRefs=function(t){const e=c(t)?new Array(t.length):{};for(const n in t)e[n]=Lt(t,n);return e},t.track=V,t.trigger=A,t.triggerRef=function(t){Wt(t)},t.unref=Ct,Object.defineProperty(t,"__esModule",{value:!0}),t}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/reactivity",
3
- "version": "3.2.30",
3
+ "version": "3.2.33",
4
4
  "description": "@vue/reactivity",
5
5
  "main": "index.js",
6
6
  "module": "dist/reactivity.esm-bundler.js",
@@ -36,6 +36,6 @@
36
36
  },
37
37
  "homepage": "https://github.com/vuejs/core/tree/main/packages/reactivity#readme",
38
38
  "dependencies": {
39
- "@vue/shared": "3.2.30"
39
+ "@vue/shared": "3.2.33"
40
40
  }
41
41
  }