@reactive-vscode/reactivity 1.0.0-beta.1 → 1.0.0
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.
- package/dist/index.cjs +1659 -2069
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +21 -14
- package/dist/index.js +1660 -2123
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,2276 +1,1813 @@
|
|
|
1
|
-
|
|
1
|
+
//#region ../../node_modules/.pnpm/@vue+shared@3.5.32/node_modules/@vue/shared/dist/shared.esm-bundler.js
|
|
2
|
+
/**
|
|
3
|
+
* @vue/shared v3.5.32
|
|
4
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
+
* @license MIT
|
|
6
|
+
**/
|
|
7
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
2
8
|
function makeMap(str) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
if (i > -1) {
|
|
15
|
-
arr.splice(i, 1);
|
|
16
|
-
}
|
|
9
|
+
const map = /* @__PURE__ */ Object.create(null);
|
|
10
|
+
for (const key of str.split(",")) map[key] = 1;
|
|
11
|
+
return (val) => val in map;
|
|
12
|
+
}
|
|
13
|
+
var EMPTY_OBJ = !!(process.env.NODE_ENV !== "production") ? Object.freeze({}) : {};
|
|
14
|
+
process.env.NODE_ENV !== "production" && Object.freeze([]);
|
|
15
|
+
var NOOP = () => {};
|
|
16
|
+
var extend = Object.assign;
|
|
17
|
+
var remove = (arr, el) => {
|
|
18
|
+
const i = arr.indexOf(el);
|
|
19
|
+
if (i > -1) arr.splice(i, 1);
|
|
17
20
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
|
|
22
|
+
var hasOwn = (val, key) => hasOwnProperty$1.call(val, key);
|
|
23
|
+
var isArray = Array.isArray;
|
|
24
|
+
var isMap = (val) => toTypeString(val) === "[object Map]";
|
|
25
|
+
var isSet = (val) => toTypeString(val) === "[object Set]";
|
|
26
|
+
var isFunction = (val) => typeof val === "function";
|
|
27
|
+
var isString = (val) => typeof val === "string";
|
|
28
|
+
var isSymbol = (val) => typeof val === "symbol";
|
|
29
|
+
var isObject = (val) => val !== null && typeof val === "object";
|
|
30
|
+
var isPromise = (val) => {
|
|
31
|
+
return (isObject(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
|
|
29
32
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
var objectToString = Object.prototype.toString;
|
|
34
|
+
var toTypeString = (value) => objectToString.call(value);
|
|
35
|
+
var toRawType = (value) => {
|
|
36
|
+
return toTypeString(value).slice(8, -1);
|
|
34
37
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
});
|
|
38
|
+
var isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
39
|
+
var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
40
|
+
var cacheStringFunction = (fn) => {
|
|
41
|
+
const cache = /* @__PURE__ */ Object.create(null);
|
|
42
|
+
return ((str) => {
|
|
43
|
+
return cache[str] || (cache[str] = fn(str));
|
|
44
|
+
});
|
|
43
45
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
var camelizeRE = /-\w/g;
|
|
47
|
+
cacheStringFunction((str) => {
|
|
48
|
+
return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
|
|
49
|
+
});
|
|
50
|
+
var hyphenateRE = /\B([A-Z])/g;
|
|
51
|
+
cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
52
|
+
var capitalize = cacheStringFunction((str) => {
|
|
53
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
54
|
+
});
|
|
55
|
+
cacheStringFunction((str) => {
|
|
56
|
+
return str ? `on${capitalize(str)}` : ``;
|
|
46
57
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
var hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
59
|
+
var def = (obj, key, value, writable = false) => {
|
|
60
|
+
Object.defineProperty(obj, key, {
|
|
61
|
+
configurable: true,
|
|
62
|
+
enumerable: false,
|
|
63
|
+
writable,
|
|
64
|
+
value
|
|
65
|
+
});
|
|
55
66
|
};
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region ../../node_modules/.pnpm/@vue+reactivity@3.5.32/node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js
|
|
69
|
+
/**
|
|
70
|
+
* @vue/reactivity v3.5.32
|
|
71
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
72
|
+
* @license MIT
|
|
73
|
+
**/
|
|
56
74
|
function warn$1(msg, ...args) {
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if (!this.detached && this.parent && !fromParent) {
|
|
163
|
-
const last = this.parent.scopes.pop();
|
|
164
|
-
if (last && last !== this) {
|
|
165
|
-
this.parent.scopes[this.index] = last;
|
|
166
|
-
last.index = this.index;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
this.parent = void 0;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
75
|
+
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
76
|
+
}
|
|
77
|
+
var activeEffectScope;
|
|
78
|
+
var EffectScope = class {
|
|
79
|
+
constructor(detached = false) {
|
|
80
|
+
this.detached = detached;
|
|
81
|
+
/**
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
this._active = true;
|
|
85
|
+
/**
|
|
86
|
+
* @internal track `on` calls, allow `on` call multiple times
|
|
87
|
+
*/
|
|
88
|
+
this._on = 0;
|
|
89
|
+
/**
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
this.effects = [];
|
|
93
|
+
/**
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
96
|
+
this.cleanups = [];
|
|
97
|
+
this._isPaused = false;
|
|
98
|
+
this.__v_skip = true;
|
|
99
|
+
this.parent = activeEffectScope;
|
|
100
|
+
if (!detached && activeEffectScope) this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
|
|
101
|
+
}
|
|
102
|
+
get active() {
|
|
103
|
+
return this._active;
|
|
104
|
+
}
|
|
105
|
+
pause() {
|
|
106
|
+
if (this._active) {
|
|
107
|
+
this._isPaused = true;
|
|
108
|
+
let i, l;
|
|
109
|
+
if (this.scopes) for (i = 0, l = this.scopes.length; i < l; i++) this.scopes[i].pause();
|
|
110
|
+
for (i = 0, l = this.effects.length; i < l; i++) this.effects[i].pause();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Resumes the effect scope, including all child scopes and effects.
|
|
115
|
+
*/
|
|
116
|
+
resume() {
|
|
117
|
+
if (this._active) {
|
|
118
|
+
if (this._isPaused) {
|
|
119
|
+
this._isPaused = false;
|
|
120
|
+
let i, l;
|
|
121
|
+
if (this.scopes) for (i = 0, l = this.scopes.length; i < l; i++) this.scopes[i].resume();
|
|
122
|
+
for (i = 0, l = this.effects.length; i < l; i++) this.effects[i].resume();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
run(fn) {
|
|
127
|
+
if (this._active) {
|
|
128
|
+
const currentEffectScope = activeEffectScope;
|
|
129
|
+
try {
|
|
130
|
+
activeEffectScope = this;
|
|
131
|
+
return fn();
|
|
132
|
+
} finally {
|
|
133
|
+
activeEffectScope = currentEffectScope;
|
|
134
|
+
}
|
|
135
|
+
} else if (!!(process.env.NODE_ENV !== "production")) warn$1(`cannot run an inactive effect scope.`);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* This should only be called on non-detached scopes
|
|
139
|
+
* @internal
|
|
140
|
+
*/
|
|
141
|
+
on() {
|
|
142
|
+
if (++this._on === 1) {
|
|
143
|
+
this.prevScope = activeEffectScope;
|
|
144
|
+
activeEffectScope = this;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* This should only be called on non-detached scopes
|
|
149
|
+
* @internal
|
|
150
|
+
*/
|
|
151
|
+
off() {
|
|
152
|
+
if (this._on > 0 && --this._on === 0) {
|
|
153
|
+
activeEffectScope = this.prevScope;
|
|
154
|
+
this.prevScope = void 0;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
stop(fromParent) {
|
|
158
|
+
if (this._active) {
|
|
159
|
+
this._active = false;
|
|
160
|
+
let i, l;
|
|
161
|
+
for (i = 0, l = this.effects.length; i < l; i++) this.effects[i].stop();
|
|
162
|
+
this.effects.length = 0;
|
|
163
|
+
for (i = 0, l = this.cleanups.length; i < l; i++) this.cleanups[i]();
|
|
164
|
+
this.cleanups.length = 0;
|
|
165
|
+
if (this.scopes) {
|
|
166
|
+
for (i = 0, l = this.scopes.length; i < l; i++) this.scopes[i].stop(true);
|
|
167
|
+
this.scopes.length = 0;
|
|
168
|
+
}
|
|
169
|
+
if (!this.detached && this.parent && !fromParent) {
|
|
170
|
+
const last = this.parent.scopes.pop();
|
|
171
|
+
if (last && last !== this) {
|
|
172
|
+
this.parent.scopes[this.index] = last;
|
|
173
|
+
last.index = this.index;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
this.parent = void 0;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
};
|
|
173
180
|
function effectScope(detached) {
|
|
174
|
-
|
|
181
|
+
return new EffectScope(detached);
|
|
175
182
|
}
|
|
176
183
|
function getCurrentScope() {
|
|
177
|
-
|
|
184
|
+
return activeEffectScope;
|
|
178
185
|
}
|
|
179
186
|
function onScopeDispose(fn, failSilently = false) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
"32": "ALLOW_RECURSE",
|
|
202
|
-
"PAUSED": 64,
|
|
203
|
-
"64": "PAUSED",
|
|
204
|
-
"EVALUATED": 128,
|
|
205
|
-
"128": "EVALUATED"
|
|
187
|
+
if (activeEffectScope) activeEffectScope.cleanups.push(fn);
|
|
188
|
+
else if (!!(process.env.NODE_ENV !== "production") && !failSilently) warn$1(`onScopeDispose() is called when there is no active effect scope to be associated with.`);
|
|
189
|
+
}
|
|
190
|
+
var activeSub;
|
|
191
|
+
var EffectFlags = {
|
|
192
|
+
"ACTIVE": 1,
|
|
193
|
+
"1": "ACTIVE",
|
|
194
|
+
"RUNNING": 2,
|
|
195
|
+
"2": "RUNNING",
|
|
196
|
+
"TRACKING": 4,
|
|
197
|
+
"4": "TRACKING",
|
|
198
|
+
"NOTIFIED": 8,
|
|
199
|
+
"8": "NOTIFIED",
|
|
200
|
+
"DIRTY": 16,
|
|
201
|
+
"16": "DIRTY",
|
|
202
|
+
"ALLOW_RECURSE": 32,
|
|
203
|
+
"32": "ALLOW_RECURSE",
|
|
204
|
+
"PAUSED": 64,
|
|
205
|
+
"64": "PAUSED",
|
|
206
|
+
"EVALUATED": 128,
|
|
207
|
+
"128": "EVALUATED"
|
|
206
208
|
};
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
let batchDepth = 0;
|
|
302
|
-
let batchedSub;
|
|
303
|
-
let batchedComputed;
|
|
209
|
+
var pausedQueueEffects = /* @__PURE__ */ new WeakSet();
|
|
210
|
+
var ReactiveEffect = class {
|
|
211
|
+
constructor(fn) {
|
|
212
|
+
this.fn = fn;
|
|
213
|
+
/**
|
|
214
|
+
* @internal
|
|
215
|
+
*/
|
|
216
|
+
this.deps = void 0;
|
|
217
|
+
/**
|
|
218
|
+
* @internal
|
|
219
|
+
*/
|
|
220
|
+
this.depsTail = void 0;
|
|
221
|
+
/**
|
|
222
|
+
* @internal
|
|
223
|
+
*/
|
|
224
|
+
this.flags = 5;
|
|
225
|
+
/**
|
|
226
|
+
* @internal
|
|
227
|
+
*/
|
|
228
|
+
this.next = void 0;
|
|
229
|
+
/**
|
|
230
|
+
* @internal
|
|
231
|
+
*/
|
|
232
|
+
this.cleanup = void 0;
|
|
233
|
+
this.scheduler = void 0;
|
|
234
|
+
if (activeEffectScope && activeEffectScope.active) activeEffectScope.effects.push(this);
|
|
235
|
+
}
|
|
236
|
+
pause() {
|
|
237
|
+
this.flags |= 64;
|
|
238
|
+
}
|
|
239
|
+
resume() {
|
|
240
|
+
if (this.flags & 64) {
|
|
241
|
+
this.flags &= -65;
|
|
242
|
+
if (pausedQueueEffects.has(this)) {
|
|
243
|
+
pausedQueueEffects.delete(this);
|
|
244
|
+
this.trigger();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* @internal
|
|
250
|
+
*/
|
|
251
|
+
notify() {
|
|
252
|
+
if (this.flags & 2 && !(this.flags & 32)) return;
|
|
253
|
+
if (!(this.flags & 8)) batch(this);
|
|
254
|
+
}
|
|
255
|
+
run() {
|
|
256
|
+
if (!(this.flags & 1)) return this.fn();
|
|
257
|
+
this.flags |= 2;
|
|
258
|
+
cleanupEffect(this);
|
|
259
|
+
prepareDeps(this);
|
|
260
|
+
const prevEffect = activeSub;
|
|
261
|
+
const prevShouldTrack = shouldTrack;
|
|
262
|
+
activeSub = this;
|
|
263
|
+
shouldTrack = true;
|
|
264
|
+
try {
|
|
265
|
+
return this.fn();
|
|
266
|
+
} finally {
|
|
267
|
+
if (!!(process.env.NODE_ENV !== "production") && activeSub !== this) warn$1("Active effect was not restored correctly - this is likely a Vue internal bug.");
|
|
268
|
+
cleanupDeps(this);
|
|
269
|
+
activeSub = prevEffect;
|
|
270
|
+
shouldTrack = prevShouldTrack;
|
|
271
|
+
this.flags &= -3;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
stop() {
|
|
275
|
+
if (this.flags & 1) {
|
|
276
|
+
for (let link = this.deps; link; link = link.nextDep) removeSub(link);
|
|
277
|
+
this.deps = this.depsTail = void 0;
|
|
278
|
+
cleanupEffect(this);
|
|
279
|
+
this.onStop && this.onStop();
|
|
280
|
+
this.flags &= -2;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
trigger() {
|
|
284
|
+
if (this.flags & 64) pausedQueueEffects.add(this);
|
|
285
|
+
else if (this.scheduler) this.scheduler();
|
|
286
|
+
else this.runIfDirty();
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* @internal
|
|
290
|
+
*/
|
|
291
|
+
runIfDirty() {
|
|
292
|
+
if (isDirty(this)) this.run();
|
|
293
|
+
}
|
|
294
|
+
get dirty() {
|
|
295
|
+
return isDirty(this);
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
var batchDepth = 0;
|
|
299
|
+
var batchedSub;
|
|
300
|
+
var batchedComputed;
|
|
304
301
|
function batch(sub, isComputed = false) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
302
|
+
sub.flags |= 8;
|
|
303
|
+
if (isComputed) {
|
|
304
|
+
sub.next = batchedComputed;
|
|
305
|
+
batchedComputed = sub;
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
sub.next = batchedSub;
|
|
309
|
+
batchedSub = sub;
|
|
313
310
|
}
|
|
314
311
|
function startBatch() {
|
|
315
|
-
|
|
312
|
+
batchDepth++;
|
|
316
313
|
}
|
|
317
314
|
function endBatch() {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
e = next;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
if (error) throw error;
|
|
315
|
+
if (--batchDepth > 0) return;
|
|
316
|
+
if (batchedComputed) {
|
|
317
|
+
let e = batchedComputed;
|
|
318
|
+
batchedComputed = void 0;
|
|
319
|
+
while (e) {
|
|
320
|
+
const next = e.next;
|
|
321
|
+
e.next = void 0;
|
|
322
|
+
e.flags &= -9;
|
|
323
|
+
e = next;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
let error;
|
|
327
|
+
while (batchedSub) {
|
|
328
|
+
let e = batchedSub;
|
|
329
|
+
batchedSub = void 0;
|
|
330
|
+
while (e) {
|
|
331
|
+
const next = e.next;
|
|
332
|
+
e.next = void 0;
|
|
333
|
+
e.flags &= -9;
|
|
334
|
+
if (e.flags & 1) try {
|
|
335
|
+
e.trigger();
|
|
336
|
+
} catch (err) {
|
|
337
|
+
if (!error) error = err;
|
|
338
|
+
}
|
|
339
|
+
e = next;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if (error) throw error;
|
|
351
343
|
}
|
|
352
344
|
function prepareDeps(sub) {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
345
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
346
|
+
link.version = -1;
|
|
347
|
+
link.prevActiveLink = link.dep.activeLink;
|
|
348
|
+
link.dep.activeLink = link;
|
|
349
|
+
}
|
|
358
350
|
}
|
|
359
351
|
function cleanupDeps(sub) {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
sub.deps = head;
|
|
377
|
-
sub.depsTail = tail;
|
|
352
|
+
let head;
|
|
353
|
+
let tail = sub.depsTail;
|
|
354
|
+
let link = tail;
|
|
355
|
+
while (link) {
|
|
356
|
+
const prev = link.prevDep;
|
|
357
|
+
if (link.version === -1) {
|
|
358
|
+
if (link === tail) tail = prev;
|
|
359
|
+
removeSub(link);
|
|
360
|
+
removeDep(link);
|
|
361
|
+
} else head = link;
|
|
362
|
+
link.dep.activeLink = link.prevActiveLink;
|
|
363
|
+
link.prevActiveLink = void 0;
|
|
364
|
+
link = prev;
|
|
365
|
+
}
|
|
366
|
+
sub.deps = head;
|
|
367
|
+
sub.depsTail = tail;
|
|
378
368
|
}
|
|
379
369
|
function isDirty(sub) {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
computed2._value = value;
|
|
414
|
-
dep.version++;
|
|
415
|
-
}
|
|
416
|
-
} catch (err) {
|
|
417
|
-
dep.version++;
|
|
418
|
-
throw err;
|
|
419
|
-
} finally {
|
|
420
|
-
activeSub = prevSub;
|
|
421
|
-
shouldTrack = prevShouldTrack;
|
|
422
|
-
cleanupDeps(computed2);
|
|
423
|
-
computed2.flags &= -3;
|
|
424
|
-
}
|
|
370
|
+
for (let link = sub.deps; link; link = link.nextDep) if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) return true;
|
|
371
|
+
if (sub._dirty) return true;
|
|
372
|
+
return false;
|
|
373
|
+
}
|
|
374
|
+
function refreshComputed(computed) {
|
|
375
|
+
if (computed.flags & 4 && !(computed.flags & 16)) return;
|
|
376
|
+
computed.flags &= -17;
|
|
377
|
+
if (computed.globalVersion === globalVersion) return;
|
|
378
|
+
computed.globalVersion = globalVersion;
|
|
379
|
+
if (!computed.isSSR && computed.flags & 128 && (!computed.deps && !computed._dirty || !isDirty(computed))) return;
|
|
380
|
+
computed.flags |= 2;
|
|
381
|
+
const dep = computed.dep;
|
|
382
|
+
const prevSub = activeSub;
|
|
383
|
+
const prevShouldTrack = shouldTrack;
|
|
384
|
+
activeSub = computed;
|
|
385
|
+
shouldTrack = true;
|
|
386
|
+
try {
|
|
387
|
+
prepareDeps(computed);
|
|
388
|
+
const value = computed.fn(computed._value);
|
|
389
|
+
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
390
|
+
computed.flags |= 128;
|
|
391
|
+
computed._value = value;
|
|
392
|
+
dep.version++;
|
|
393
|
+
}
|
|
394
|
+
} catch (err) {
|
|
395
|
+
dep.version++;
|
|
396
|
+
throw err;
|
|
397
|
+
} finally {
|
|
398
|
+
activeSub = prevSub;
|
|
399
|
+
shouldTrack = prevShouldTrack;
|
|
400
|
+
cleanupDeps(computed);
|
|
401
|
+
computed.flags &= -3;
|
|
402
|
+
}
|
|
425
403
|
}
|
|
426
404
|
function removeSub(link, soft = false) {
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
if (!soft && !--dep.sc && dep.map) {
|
|
449
|
-
dep.map.delete(dep.key);
|
|
450
|
-
}
|
|
405
|
+
const { dep, prevSub, nextSub } = link;
|
|
406
|
+
if (prevSub) {
|
|
407
|
+
prevSub.nextSub = nextSub;
|
|
408
|
+
link.prevSub = void 0;
|
|
409
|
+
}
|
|
410
|
+
if (nextSub) {
|
|
411
|
+
nextSub.prevSub = prevSub;
|
|
412
|
+
link.nextSub = void 0;
|
|
413
|
+
}
|
|
414
|
+
if (!!(process.env.NODE_ENV !== "production") && dep.subsHead === link) dep.subsHead = nextSub;
|
|
415
|
+
if (dep.subs === link) {
|
|
416
|
+
dep.subs = prevSub;
|
|
417
|
+
if (!prevSub && dep.computed) {
|
|
418
|
+
dep.computed.flags &= -5;
|
|
419
|
+
for (let l = dep.computed.deps; l; l = l.nextDep) removeSub(l, true);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
if (!soft && !--dep.sc && dep.map) dep.map.delete(dep.key);
|
|
451
423
|
}
|
|
452
424
|
function removeDep(link) {
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
425
|
+
const { prevDep, nextDep } = link;
|
|
426
|
+
if (prevDep) {
|
|
427
|
+
prevDep.nextDep = nextDep;
|
|
428
|
+
link.prevDep = void 0;
|
|
429
|
+
}
|
|
430
|
+
if (nextDep) {
|
|
431
|
+
nextDep.prevDep = prevDep;
|
|
432
|
+
link.nextDep = void 0;
|
|
433
|
+
}
|
|
462
434
|
}
|
|
463
435
|
function effect(fn, options) {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
}
|
|
477
|
-
const runner = e.run.bind(e);
|
|
478
|
-
runner.effect = e;
|
|
479
|
-
return runner;
|
|
436
|
+
if (fn.effect instanceof ReactiveEffect) fn = fn.effect.fn;
|
|
437
|
+
const e = new ReactiveEffect(fn);
|
|
438
|
+
if (options) extend(e, options);
|
|
439
|
+
try {
|
|
440
|
+
e.run();
|
|
441
|
+
} catch (err) {
|
|
442
|
+
e.stop();
|
|
443
|
+
throw err;
|
|
444
|
+
}
|
|
445
|
+
const runner = e.run.bind(e);
|
|
446
|
+
runner.effect = e;
|
|
447
|
+
return runner;
|
|
480
448
|
}
|
|
481
449
|
function stop(runner) {
|
|
482
|
-
|
|
450
|
+
runner.effect.stop();
|
|
483
451
|
}
|
|
484
|
-
|
|
485
|
-
|
|
452
|
+
var shouldTrack = true;
|
|
453
|
+
var trackStack = [];
|
|
486
454
|
function pauseTracking() {
|
|
487
|
-
|
|
488
|
-
|
|
455
|
+
trackStack.push(shouldTrack);
|
|
456
|
+
shouldTrack = false;
|
|
489
457
|
}
|
|
490
458
|
function enableTracking() {
|
|
491
|
-
|
|
492
|
-
|
|
459
|
+
trackStack.push(shouldTrack);
|
|
460
|
+
shouldTrack = true;
|
|
493
461
|
}
|
|
494
462
|
function resetTracking() {
|
|
495
|
-
|
|
496
|
-
|
|
463
|
+
const last = trackStack.pop();
|
|
464
|
+
shouldTrack = last === void 0 ? true : last;
|
|
497
465
|
}
|
|
498
466
|
function onEffectCleanup(fn, failSilently = false) {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
} else if (!!(process.env.NODE_ENV !== "production") && !failSilently) {
|
|
502
|
-
warn$1(
|
|
503
|
-
`onEffectCleanup() was called when there was no active effect to associate with.`
|
|
504
|
-
);
|
|
505
|
-
}
|
|
467
|
+
if (activeSub instanceof ReactiveEffect) activeSub.cleanup = fn;
|
|
468
|
+
else if (!!(process.env.NODE_ENV !== "production") && !failSilently) warn$1(`onEffectCleanup() was called when there was no active effect to associate with.`);
|
|
506
469
|
}
|
|
507
470
|
function cleanupEffect(e) {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
{
|
|
602
|
-
effect: head.sub
|
|
603
|
-
},
|
|
604
|
-
debugInfo
|
|
605
|
-
)
|
|
606
|
-
);
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
for (let link = this.subs; link; link = link.prevSub) {
|
|
611
|
-
if (link.sub.notify()) {
|
|
612
|
-
;
|
|
613
|
-
link.sub.dep.notify();
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
} finally {
|
|
617
|
-
endBatch();
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
}
|
|
471
|
+
const { cleanup } = e;
|
|
472
|
+
e.cleanup = void 0;
|
|
473
|
+
if (cleanup) {
|
|
474
|
+
const prevSub = activeSub;
|
|
475
|
+
activeSub = void 0;
|
|
476
|
+
try {
|
|
477
|
+
cleanup();
|
|
478
|
+
} finally {
|
|
479
|
+
activeSub = prevSub;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
var globalVersion = 0;
|
|
484
|
+
var Link = class {
|
|
485
|
+
constructor(sub, dep) {
|
|
486
|
+
this.sub = sub;
|
|
487
|
+
this.dep = dep;
|
|
488
|
+
this.version = dep.version;
|
|
489
|
+
this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = void 0;
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
var Dep = class {
|
|
493
|
+
constructor(computed) {
|
|
494
|
+
this.computed = computed;
|
|
495
|
+
this.version = 0;
|
|
496
|
+
/**
|
|
497
|
+
* Link between this dep and the current active effect
|
|
498
|
+
*/
|
|
499
|
+
this.activeLink = void 0;
|
|
500
|
+
/**
|
|
501
|
+
* Doubly linked list representing the subscribing effects (tail)
|
|
502
|
+
*/
|
|
503
|
+
this.subs = void 0;
|
|
504
|
+
/**
|
|
505
|
+
* For object property deps cleanup
|
|
506
|
+
*/
|
|
507
|
+
this.map = void 0;
|
|
508
|
+
this.key = void 0;
|
|
509
|
+
/**
|
|
510
|
+
* Subscriber counter
|
|
511
|
+
*/
|
|
512
|
+
this.sc = 0;
|
|
513
|
+
/**
|
|
514
|
+
* @internal
|
|
515
|
+
*/
|
|
516
|
+
this.__v_skip = true;
|
|
517
|
+
if (!!(process.env.NODE_ENV !== "production")) this.subsHead = void 0;
|
|
518
|
+
}
|
|
519
|
+
track(debugInfo) {
|
|
520
|
+
if (!activeSub || !shouldTrack || activeSub === this.computed) return;
|
|
521
|
+
let link = this.activeLink;
|
|
522
|
+
if (link === void 0 || link.sub !== activeSub) {
|
|
523
|
+
link = this.activeLink = new Link(activeSub, this);
|
|
524
|
+
if (!activeSub.deps) activeSub.deps = activeSub.depsTail = link;
|
|
525
|
+
else {
|
|
526
|
+
link.prevDep = activeSub.depsTail;
|
|
527
|
+
activeSub.depsTail.nextDep = link;
|
|
528
|
+
activeSub.depsTail = link;
|
|
529
|
+
}
|
|
530
|
+
addSub(link);
|
|
531
|
+
} else if (link.version === -1) {
|
|
532
|
+
link.version = this.version;
|
|
533
|
+
if (link.nextDep) {
|
|
534
|
+
const next = link.nextDep;
|
|
535
|
+
next.prevDep = link.prevDep;
|
|
536
|
+
if (link.prevDep) link.prevDep.nextDep = next;
|
|
537
|
+
link.prevDep = activeSub.depsTail;
|
|
538
|
+
link.nextDep = void 0;
|
|
539
|
+
activeSub.depsTail.nextDep = link;
|
|
540
|
+
activeSub.depsTail = link;
|
|
541
|
+
if (activeSub.deps === link) activeSub.deps = next;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
if (!!(process.env.NODE_ENV !== "production") && activeSub.onTrack) activeSub.onTrack(extend({ effect: activeSub }, debugInfo));
|
|
545
|
+
return link;
|
|
546
|
+
}
|
|
547
|
+
trigger(debugInfo) {
|
|
548
|
+
this.version++;
|
|
549
|
+
globalVersion++;
|
|
550
|
+
this.notify(debugInfo);
|
|
551
|
+
}
|
|
552
|
+
notify(debugInfo) {
|
|
553
|
+
startBatch();
|
|
554
|
+
try {
|
|
555
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
556
|
+
for (let head = this.subsHead; head; head = head.nextSub) if (head.sub.onTrigger && !(head.sub.flags & 8)) head.sub.onTrigger(extend({ effect: head.sub }, debugInfo));
|
|
557
|
+
}
|
|
558
|
+
for (let link = this.subs; link; link = link.prevSub) if (link.sub.notify()) link.sub.dep.notify();
|
|
559
|
+
} finally {
|
|
560
|
+
endBatch();
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
};
|
|
621
564
|
function addSub(link) {
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
643
|
-
const ITERATE_KEY = /* @__PURE__ */ Symbol(
|
|
644
|
-
!!(process.env.NODE_ENV !== "production") ? "Object iterate" : ""
|
|
645
|
-
);
|
|
646
|
-
const MAP_KEY_ITERATE_KEY = /* @__PURE__ */ Symbol(
|
|
647
|
-
!!(process.env.NODE_ENV !== "production") ? "Map keys iterate" : ""
|
|
648
|
-
);
|
|
649
|
-
const ARRAY_ITERATE_KEY = /* @__PURE__ */ Symbol(
|
|
650
|
-
!!(process.env.NODE_ENV !== "production") ? "Array iterate" : ""
|
|
651
|
-
);
|
|
565
|
+
link.dep.sc++;
|
|
566
|
+
if (link.sub.flags & 4) {
|
|
567
|
+
const computed = link.dep.computed;
|
|
568
|
+
if (computed && !link.dep.subs) {
|
|
569
|
+
computed.flags |= 20;
|
|
570
|
+
for (let l = computed.deps; l; l = l.nextDep) addSub(l);
|
|
571
|
+
}
|
|
572
|
+
const currentTail = link.dep.subs;
|
|
573
|
+
if (currentTail !== link) {
|
|
574
|
+
link.prevSub = currentTail;
|
|
575
|
+
if (currentTail) currentTail.nextSub = link;
|
|
576
|
+
}
|
|
577
|
+
if (!!(process.env.NODE_ENV !== "production") && link.dep.subsHead === void 0) link.dep.subsHead = link;
|
|
578
|
+
link.dep.subs = link;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
var targetMap = /* @__PURE__ */ new WeakMap();
|
|
582
|
+
var ITERATE_KEY = /* @__PURE__ */ Symbol(!!(process.env.NODE_ENV !== "production") ? "Object iterate" : "");
|
|
583
|
+
var MAP_KEY_ITERATE_KEY = /* @__PURE__ */ Symbol(!!(process.env.NODE_ENV !== "production") ? "Map keys iterate" : "");
|
|
584
|
+
var ARRAY_ITERATE_KEY = /* @__PURE__ */ Symbol(!!(process.env.NODE_ENV !== "production") ? "Array iterate" : "");
|
|
652
585
|
function track(target, type, key) {
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
});
|
|
670
|
-
} else {
|
|
671
|
-
dep.track();
|
|
672
|
-
}
|
|
673
|
-
}
|
|
586
|
+
if (shouldTrack && activeSub) {
|
|
587
|
+
let depsMap = targetMap.get(target);
|
|
588
|
+
if (!depsMap) targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
589
|
+
let dep = depsMap.get(key);
|
|
590
|
+
if (!dep) {
|
|
591
|
+
depsMap.set(key, dep = new Dep());
|
|
592
|
+
dep.map = depsMap;
|
|
593
|
+
dep.key = key;
|
|
594
|
+
}
|
|
595
|
+
if (!!(process.env.NODE_ENV !== "production")) dep.track({
|
|
596
|
+
target,
|
|
597
|
+
type,
|
|
598
|
+
key
|
|
599
|
+
});
|
|
600
|
+
else dep.track();
|
|
601
|
+
}
|
|
674
602
|
}
|
|
675
603
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
run(depsMap.get("length"));
|
|
726
|
-
}
|
|
727
|
-
break;
|
|
728
|
-
case "delete":
|
|
729
|
-
if (!targetIsArray) {
|
|
730
|
-
run(depsMap.get(ITERATE_KEY));
|
|
731
|
-
if (isMap(target)) {
|
|
732
|
-
run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
break;
|
|
736
|
-
case "set":
|
|
737
|
-
if (isMap(target)) {
|
|
738
|
-
run(depsMap.get(ITERATE_KEY));
|
|
739
|
-
}
|
|
740
|
-
break;
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
endBatch();
|
|
604
|
+
const depsMap = targetMap.get(target);
|
|
605
|
+
if (!depsMap) {
|
|
606
|
+
globalVersion++;
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
const run = (dep) => {
|
|
610
|
+
if (dep) if (!!(process.env.NODE_ENV !== "production")) dep.trigger({
|
|
611
|
+
target,
|
|
612
|
+
type,
|
|
613
|
+
key,
|
|
614
|
+
newValue,
|
|
615
|
+
oldValue,
|
|
616
|
+
oldTarget
|
|
617
|
+
});
|
|
618
|
+
else dep.trigger();
|
|
619
|
+
};
|
|
620
|
+
startBatch();
|
|
621
|
+
if (type === "clear") depsMap.forEach(run);
|
|
622
|
+
else {
|
|
623
|
+
const targetIsArray = isArray(target);
|
|
624
|
+
const isArrayIndex = targetIsArray && isIntegerKey(key);
|
|
625
|
+
if (targetIsArray && key === "length") {
|
|
626
|
+
const newLength = Number(newValue);
|
|
627
|
+
depsMap.forEach((dep, key2) => {
|
|
628
|
+
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) run(dep);
|
|
629
|
+
});
|
|
630
|
+
} else {
|
|
631
|
+
if (key !== void 0 || depsMap.has(void 0)) run(depsMap.get(key));
|
|
632
|
+
if (isArrayIndex) run(depsMap.get(ARRAY_ITERATE_KEY));
|
|
633
|
+
switch (type) {
|
|
634
|
+
case "add":
|
|
635
|
+
if (!targetIsArray) {
|
|
636
|
+
run(depsMap.get(ITERATE_KEY));
|
|
637
|
+
if (isMap(target)) run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
638
|
+
} else if (isArrayIndex) run(depsMap.get("length"));
|
|
639
|
+
break;
|
|
640
|
+
case "delete":
|
|
641
|
+
if (!targetIsArray) {
|
|
642
|
+
run(depsMap.get(ITERATE_KEY));
|
|
643
|
+
if (isMap(target)) run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
644
|
+
}
|
|
645
|
+
break;
|
|
646
|
+
case "set":
|
|
647
|
+
if (isMap(target)) run(depsMap.get(ITERATE_KEY));
|
|
648
|
+
break;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
endBatch();
|
|
745
653
|
}
|
|
746
654
|
function getDepFromReactive(object, key) {
|
|
747
|
-
|
|
748
|
-
|
|
655
|
+
const depMap = targetMap.get(object);
|
|
656
|
+
return depMap && depMap.get(key);
|
|
749
657
|
}
|
|
750
658
|
function reactiveReadArray(array) {
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
659
|
+
const raw = /* @__PURE__ */ toRaw(array);
|
|
660
|
+
if (raw === array) return raw;
|
|
661
|
+
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
662
|
+
return /* @__PURE__ */ isShallow(array) ? raw : raw.map(toReactive);
|
|
755
663
|
}
|
|
756
664
|
function shallowReadArray(arr) {
|
|
757
|
-
|
|
758
|
-
|
|
665
|
+
track(arr = /* @__PURE__ */ toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
666
|
+
return arr;
|
|
759
667
|
}
|
|
760
668
|
function toWrapped(target, item) {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
reduceRight(fn, ...args) {
|
|
851
|
-
return reduce(this, "reduceRight", fn, args);
|
|
852
|
-
},
|
|
853
|
-
shift() {
|
|
854
|
-
return noTracking(this, "shift");
|
|
855
|
-
},
|
|
856
|
-
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
857
|
-
some(fn, thisArg) {
|
|
858
|
-
return apply(this, "some", fn, thisArg, void 0, arguments);
|
|
859
|
-
},
|
|
860
|
-
splice(...args) {
|
|
861
|
-
return noTracking(this, "splice", args);
|
|
862
|
-
},
|
|
863
|
-
toReversed() {
|
|
864
|
-
return reactiveReadArray(this).toReversed();
|
|
865
|
-
},
|
|
866
|
-
toSorted(comparer) {
|
|
867
|
-
return reactiveReadArray(this).toSorted(comparer);
|
|
868
|
-
},
|
|
869
|
-
toSpliced(...args) {
|
|
870
|
-
return reactiveReadArray(this).toSpliced(...args);
|
|
871
|
-
},
|
|
872
|
-
unshift(...args) {
|
|
873
|
-
return noTracking(this, "unshift", args);
|
|
874
|
-
},
|
|
875
|
-
values() {
|
|
876
|
-
return iterator(this, "values", (item) => toWrapped(this, item));
|
|
877
|
-
}
|
|
669
|
+
if (/* @__PURE__ */ isReadonly(target)) return /* @__PURE__ */ isReactive(target) ? toReadonly(toReactive(item)) : toReadonly(item);
|
|
670
|
+
return toReactive(item);
|
|
671
|
+
}
|
|
672
|
+
var arrayInstrumentations = {
|
|
673
|
+
__proto__: null,
|
|
674
|
+
[Symbol.iterator]() {
|
|
675
|
+
return iterator(this, Symbol.iterator, (item) => toWrapped(this, item));
|
|
676
|
+
},
|
|
677
|
+
concat(...args) {
|
|
678
|
+
return reactiveReadArray(this).concat(...args.map((x) => isArray(x) ? reactiveReadArray(x) : x));
|
|
679
|
+
},
|
|
680
|
+
entries() {
|
|
681
|
+
return iterator(this, "entries", (value) => {
|
|
682
|
+
value[1] = toWrapped(this, value[1]);
|
|
683
|
+
return value;
|
|
684
|
+
});
|
|
685
|
+
},
|
|
686
|
+
every(fn, thisArg) {
|
|
687
|
+
return apply(this, "every", fn, thisArg, void 0, arguments);
|
|
688
|
+
},
|
|
689
|
+
filter(fn, thisArg) {
|
|
690
|
+
return apply(this, "filter", fn, thisArg, (v) => v.map((item) => toWrapped(this, item)), arguments);
|
|
691
|
+
},
|
|
692
|
+
find(fn, thisArg) {
|
|
693
|
+
return apply(this, "find", fn, thisArg, (item) => toWrapped(this, item), arguments);
|
|
694
|
+
},
|
|
695
|
+
findIndex(fn, thisArg) {
|
|
696
|
+
return apply(this, "findIndex", fn, thisArg, void 0, arguments);
|
|
697
|
+
},
|
|
698
|
+
findLast(fn, thisArg) {
|
|
699
|
+
return apply(this, "findLast", fn, thisArg, (item) => toWrapped(this, item), arguments);
|
|
700
|
+
},
|
|
701
|
+
findLastIndex(fn, thisArg) {
|
|
702
|
+
return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
|
|
703
|
+
},
|
|
704
|
+
forEach(fn, thisArg) {
|
|
705
|
+
return apply(this, "forEach", fn, thisArg, void 0, arguments);
|
|
706
|
+
},
|
|
707
|
+
includes(...args) {
|
|
708
|
+
return searchProxy(this, "includes", args);
|
|
709
|
+
},
|
|
710
|
+
indexOf(...args) {
|
|
711
|
+
return searchProxy(this, "indexOf", args);
|
|
712
|
+
},
|
|
713
|
+
join(separator) {
|
|
714
|
+
return reactiveReadArray(this).join(separator);
|
|
715
|
+
},
|
|
716
|
+
lastIndexOf(...args) {
|
|
717
|
+
return searchProxy(this, "lastIndexOf", args);
|
|
718
|
+
},
|
|
719
|
+
map(fn, thisArg) {
|
|
720
|
+
return apply(this, "map", fn, thisArg, void 0, arguments);
|
|
721
|
+
},
|
|
722
|
+
pop() {
|
|
723
|
+
return noTracking(this, "pop");
|
|
724
|
+
},
|
|
725
|
+
push(...args) {
|
|
726
|
+
return noTracking(this, "push", args);
|
|
727
|
+
},
|
|
728
|
+
reduce(fn, ...args) {
|
|
729
|
+
return reduce(this, "reduce", fn, args);
|
|
730
|
+
},
|
|
731
|
+
reduceRight(fn, ...args) {
|
|
732
|
+
return reduce(this, "reduceRight", fn, args);
|
|
733
|
+
},
|
|
734
|
+
shift() {
|
|
735
|
+
return noTracking(this, "shift");
|
|
736
|
+
},
|
|
737
|
+
some(fn, thisArg) {
|
|
738
|
+
return apply(this, "some", fn, thisArg, void 0, arguments);
|
|
739
|
+
},
|
|
740
|
+
splice(...args) {
|
|
741
|
+
return noTracking(this, "splice", args);
|
|
742
|
+
},
|
|
743
|
+
toReversed() {
|
|
744
|
+
return reactiveReadArray(this).toReversed();
|
|
745
|
+
},
|
|
746
|
+
toSorted(comparer) {
|
|
747
|
+
return reactiveReadArray(this).toSorted(comparer);
|
|
748
|
+
},
|
|
749
|
+
toSpliced(...args) {
|
|
750
|
+
return reactiveReadArray(this).toSpliced(...args);
|
|
751
|
+
},
|
|
752
|
+
unshift(...args) {
|
|
753
|
+
return noTracking(this, "unshift", args);
|
|
754
|
+
},
|
|
755
|
+
values() {
|
|
756
|
+
return iterator(this, "values", (item) => toWrapped(this, item));
|
|
757
|
+
}
|
|
878
758
|
};
|
|
879
759
|
function iterator(self, method, wrapValue) {
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
}
|
|
894
|
-
const arrayProto = Array.prototype;
|
|
760
|
+
const arr = shallowReadArray(self);
|
|
761
|
+
const iter = arr[method]();
|
|
762
|
+
if (arr !== self && !/* @__PURE__ */ isShallow(self)) {
|
|
763
|
+
iter._next = iter.next;
|
|
764
|
+
iter.next = () => {
|
|
765
|
+
const result = iter._next();
|
|
766
|
+
if (!result.done) result.value = wrapValue(result.value);
|
|
767
|
+
return result;
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
return iter;
|
|
771
|
+
}
|
|
772
|
+
var arrayProto = Array.prototype;
|
|
895
773
|
function apply(self, method, fn, thisArg, wrappedRetFn, args) {
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
}
|
|
915
|
-
const result = methodFn.call(arr, wrappedFn, thisArg);
|
|
916
|
-
return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
|
|
774
|
+
const arr = shallowReadArray(self);
|
|
775
|
+
const needsWrap = arr !== self && !/* @__PURE__ */ isShallow(self);
|
|
776
|
+
const methodFn = arr[method];
|
|
777
|
+
if (methodFn !== arrayProto[method]) {
|
|
778
|
+
const result2 = methodFn.apply(self, args);
|
|
779
|
+
return needsWrap ? toReactive(result2) : result2;
|
|
780
|
+
}
|
|
781
|
+
let wrappedFn = fn;
|
|
782
|
+
if (arr !== self) {
|
|
783
|
+
if (needsWrap) wrappedFn = function(item, index) {
|
|
784
|
+
return fn.call(this, toWrapped(self, item), index, self);
|
|
785
|
+
};
|
|
786
|
+
else if (fn.length > 2) wrappedFn = function(item, index) {
|
|
787
|
+
return fn.call(this, item, index, self);
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
const result = methodFn.call(arr, wrappedFn, thisArg);
|
|
791
|
+
return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
|
|
917
792
|
}
|
|
918
793
|
function reduce(self, method, fn, args) {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
794
|
+
const arr = shallowReadArray(self);
|
|
795
|
+
const needsWrap = arr !== self && !/* @__PURE__ */ isShallow(self);
|
|
796
|
+
let wrappedFn = fn;
|
|
797
|
+
let wrapInitialAccumulator = false;
|
|
798
|
+
if (arr !== self) {
|
|
799
|
+
if (needsWrap) {
|
|
800
|
+
wrapInitialAccumulator = args.length === 0;
|
|
801
|
+
wrappedFn = function(acc, item, index) {
|
|
802
|
+
if (wrapInitialAccumulator) {
|
|
803
|
+
wrapInitialAccumulator = false;
|
|
804
|
+
acc = toWrapped(self, acc);
|
|
805
|
+
}
|
|
806
|
+
return fn.call(this, acc, toWrapped(self, item), index, self);
|
|
807
|
+
};
|
|
808
|
+
} else if (fn.length > 3) wrappedFn = function(acc, item, index) {
|
|
809
|
+
return fn.call(this, acc, item, index, self);
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
const result = arr[method](wrappedFn, ...args);
|
|
813
|
+
return wrapInitialAccumulator ? toWrapped(self, result) : result;
|
|
933
814
|
}
|
|
934
815
|
function searchProxy(self, method, args) {
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
816
|
+
const arr = /* @__PURE__ */ toRaw(self);
|
|
817
|
+
track(arr, "iterate", ARRAY_ITERATE_KEY);
|
|
818
|
+
const res = arr[method](...args);
|
|
819
|
+
if ((res === -1 || res === false) && /* @__PURE__ */ isProxy(args[0])) {
|
|
820
|
+
args[0] = /* @__PURE__ */ toRaw(args[0]);
|
|
821
|
+
return arr[method](...args);
|
|
822
|
+
}
|
|
823
|
+
return res;
|
|
943
824
|
}
|
|
944
825
|
function noTracking(self, method, args = []) {
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
955
|
-
);
|
|
826
|
+
pauseTracking();
|
|
827
|
+
startBatch();
|
|
828
|
+
const res = (/* @__PURE__ */ toRaw(self))[method].apply(self, args);
|
|
829
|
+
endBatch();
|
|
830
|
+
resetTracking();
|
|
831
|
+
return res;
|
|
832
|
+
}
|
|
833
|
+
var isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
834
|
+
var builtInSymbols = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol));
|
|
956
835
|
function hasOwnProperty(key) {
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
trigger(target, "set", key, value, oldValue);
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
return result;
|
|
1064
|
-
}
|
|
1065
|
-
deleteProperty(target, key) {
|
|
1066
|
-
const hadKey = hasOwn(target, key);
|
|
1067
|
-
const oldValue = target[key];
|
|
1068
|
-
const result = Reflect.deleteProperty(target, key);
|
|
1069
|
-
if (result && hadKey) {
|
|
1070
|
-
trigger(target, "delete", key, void 0, oldValue);
|
|
1071
|
-
}
|
|
1072
|
-
return result;
|
|
1073
|
-
}
|
|
1074
|
-
has(target, key) {
|
|
1075
|
-
const result = Reflect.has(target, key);
|
|
1076
|
-
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
|
1077
|
-
track(target, "has", key);
|
|
1078
|
-
}
|
|
1079
|
-
return result;
|
|
1080
|
-
}
|
|
1081
|
-
ownKeys(target) {
|
|
1082
|
-
track(
|
|
1083
|
-
target,
|
|
1084
|
-
"iterate",
|
|
1085
|
-
isArray(target) ? "length" : ITERATE_KEY
|
|
1086
|
-
);
|
|
1087
|
-
return Reflect.ownKeys(target);
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
|
1091
|
-
constructor(isShallow2 = false) {
|
|
1092
|
-
super(true, isShallow2);
|
|
1093
|
-
}
|
|
1094
|
-
set(target, key) {
|
|
1095
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1096
|
-
warn$1(
|
|
1097
|
-
`Set operation on key "${String(key)}" failed: target is readonly.`,
|
|
1098
|
-
target
|
|
1099
|
-
);
|
|
1100
|
-
}
|
|
1101
|
-
return true;
|
|
1102
|
-
}
|
|
1103
|
-
deleteProperty(target, key) {
|
|
1104
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1105
|
-
warn$1(
|
|
1106
|
-
`Delete operation on key "${String(key)}" failed: target is readonly.`,
|
|
1107
|
-
target
|
|
1108
|
-
);
|
|
1109
|
-
}
|
|
1110
|
-
return true;
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
|
|
1114
|
-
const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
|
|
1115
|
-
const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
|
|
1116
|
-
const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
|
|
1117
|
-
const toShallow = (value) => value;
|
|
1118
|
-
const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
836
|
+
if (!isSymbol(key)) key = String(key);
|
|
837
|
+
const obj = /* @__PURE__ */ toRaw(this);
|
|
838
|
+
track(obj, "has", key);
|
|
839
|
+
return obj.hasOwnProperty(key);
|
|
840
|
+
}
|
|
841
|
+
var BaseReactiveHandler = class {
|
|
842
|
+
constructor(_isReadonly = false, _isShallow = false) {
|
|
843
|
+
this._isReadonly = _isReadonly;
|
|
844
|
+
this._isShallow = _isShallow;
|
|
845
|
+
}
|
|
846
|
+
get(target, key, receiver) {
|
|
847
|
+
if (key === "__v_skip") return target["__v_skip"];
|
|
848
|
+
const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
|
|
849
|
+
if (key === "__v_isReactive") return !isReadonly2;
|
|
850
|
+
else if (key === "__v_isReadonly") return isReadonly2;
|
|
851
|
+
else if (key === "__v_isShallow") return isShallow2;
|
|
852
|
+
else if (key === "__v_raw") {
|
|
853
|
+
if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) return target;
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
const targetIsArray = isArray(target);
|
|
857
|
+
if (!isReadonly2) {
|
|
858
|
+
let fn;
|
|
859
|
+
if (targetIsArray && (fn = arrayInstrumentations[key])) return fn;
|
|
860
|
+
if (key === "hasOwnProperty") return hasOwnProperty;
|
|
861
|
+
}
|
|
862
|
+
const res = Reflect.get(target, key, /* @__PURE__ */ isRef(target) ? target : receiver);
|
|
863
|
+
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) return res;
|
|
864
|
+
if (!isReadonly2) track(target, "get", key);
|
|
865
|
+
if (isShallow2) return res;
|
|
866
|
+
if (/* @__PURE__ */ isRef(res)) {
|
|
867
|
+
const value = targetIsArray && isIntegerKey(key) ? res : res.value;
|
|
868
|
+
return isReadonly2 && isObject(value) ? /* @__PURE__ */ readonly(value) : value;
|
|
869
|
+
}
|
|
870
|
+
if (isObject(res)) return isReadonly2 ? /* @__PURE__ */ readonly(res) : /* @__PURE__ */ reactive(res);
|
|
871
|
+
return res;
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
var MutableReactiveHandler = class extends BaseReactiveHandler {
|
|
875
|
+
constructor(isShallow2 = false) {
|
|
876
|
+
super(false, isShallow2);
|
|
877
|
+
}
|
|
878
|
+
set(target, key, value, receiver) {
|
|
879
|
+
let oldValue = target[key];
|
|
880
|
+
const isArrayWithIntegerKey = isArray(target) && isIntegerKey(key);
|
|
881
|
+
if (!this._isShallow) {
|
|
882
|
+
const isOldValueReadonly = /* @__PURE__ */ isReadonly(oldValue);
|
|
883
|
+
if (!/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value)) {
|
|
884
|
+
oldValue = /* @__PURE__ */ toRaw(oldValue);
|
|
885
|
+
value = /* @__PURE__ */ toRaw(value);
|
|
886
|
+
}
|
|
887
|
+
if (!isArrayWithIntegerKey && /* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) if (isOldValueReadonly) {
|
|
888
|
+
if (!!(process.env.NODE_ENV !== "production")) warn$1(`Set operation on key "${String(key)}" failed: target is readonly.`, target[key]);
|
|
889
|
+
return true;
|
|
890
|
+
} else {
|
|
891
|
+
oldValue.value = value;
|
|
892
|
+
return true;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
const hadKey = isArrayWithIntegerKey ? Number(key) < target.length : hasOwn(target, key);
|
|
896
|
+
const result = Reflect.set(target, key, value, /* @__PURE__ */ isRef(target) ? target : receiver);
|
|
897
|
+
if (target === /* @__PURE__ */ toRaw(receiver)) {
|
|
898
|
+
if (!hadKey) trigger(target, "add", key, value);
|
|
899
|
+
else if (hasChanged(value, oldValue)) trigger(target, "set", key, value, oldValue);
|
|
900
|
+
}
|
|
901
|
+
return result;
|
|
902
|
+
}
|
|
903
|
+
deleteProperty(target, key) {
|
|
904
|
+
const hadKey = hasOwn(target, key);
|
|
905
|
+
const oldValue = target[key];
|
|
906
|
+
const result = Reflect.deleteProperty(target, key);
|
|
907
|
+
if (result && hadKey) trigger(target, "delete", key, void 0, oldValue);
|
|
908
|
+
return result;
|
|
909
|
+
}
|
|
910
|
+
has(target, key) {
|
|
911
|
+
const result = Reflect.has(target, key);
|
|
912
|
+
if (!isSymbol(key) || !builtInSymbols.has(key)) track(target, "has", key);
|
|
913
|
+
return result;
|
|
914
|
+
}
|
|
915
|
+
ownKeys(target) {
|
|
916
|
+
track(target, "iterate", isArray(target) ? "length" : ITERATE_KEY);
|
|
917
|
+
return Reflect.ownKeys(target);
|
|
918
|
+
}
|
|
919
|
+
};
|
|
920
|
+
var ReadonlyReactiveHandler = class extends BaseReactiveHandler {
|
|
921
|
+
constructor(isShallow2 = false) {
|
|
922
|
+
super(true, isShallow2);
|
|
923
|
+
}
|
|
924
|
+
set(target, key) {
|
|
925
|
+
if (!!(process.env.NODE_ENV !== "production")) warn$1(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
926
|
+
return true;
|
|
927
|
+
}
|
|
928
|
+
deleteProperty(target, key) {
|
|
929
|
+
if (!!(process.env.NODE_ENV !== "production")) warn$1(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
930
|
+
return true;
|
|
931
|
+
}
|
|
932
|
+
};
|
|
933
|
+
var mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
|
|
934
|
+
var readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
|
|
935
|
+
var shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
|
|
936
|
+
var shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
|
|
937
|
+
var toShallow = (value) => value;
|
|
938
|
+
var getProto = (v) => Reflect.getPrototypeOf(v);
|
|
1119
939
|
function createIterableMethod(method, isReadonly2, isShallow2) {
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
};
|
|
1141
|
-
},
|
|
1142
|
-
// iterable protocol
|
|
1143
|
-
[Symbol.iterator]() {
|
|
1144
|
-
return this;
|
|
1145
|
-
}
|
|
1146
|
-
};
|
|
1147
|
-
};
|
|
940
|
+
return function(...args) {
|
|
941
|
+
const target = this["__v_raw"];
|
|
942
|
+
const rawTarget = /* @__PURE__ */ toRaw(target);
|
|
943
|
+
const targetIsMap = isMap(rawTarget);
|
|
944
|
+
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
|
|
945
|
+
const isKeyOnly = method === "keys" && targetIsMap;
|
|
946
|
+
const innerIterator = target[method](...args);
|
|
947
|
+
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
|
|
948
|
+
!isReadonly2 && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
|
949
|
+
return extend(Object.create(innerIterator), { next() {
|
|
950
|
+
const { value, done } = innerIterator.next();
|
|
951
|
+
return done ? {
|
|
952
|
+
value,
|
|
953
|
+
done
|
|
954
|
+
} : {
|
|
955
|
+
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
|
956
|
+
done
|
|
957
|
+
};
|
|
958
|
+
} });
|
|
959
|
+
};
|
|
1148
960
|
}
|
|
1149
961
|
function createReadonlyMethod(type) {
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
}
|
|
1264
|
-
const oldValue = get ? get.call(target, key) : void 0;
|
|
1265
|
-
const result = target.delete(key);
|
|
1266
|
-
if (hadKey) {
|
|
1267
|
-
trigger(target, "delete", key, void 0, oldValue);
|
|
1268
|
-
}
|
|
1269
|
-
return result;
|
|
1270
|
-
},
|
|
1271
|
-
clear() {
|
|
1272
|
-
const target = toRaw(this);
|
|
1273
|
-
const hadItems = target.size !== 0;
|
|
1274
|
-
const oldTarget = !!(process.env.NODE_ENV !== "production") ? isMap(target) ? new Map(target) : new Set(target) : void 0;
|
|
1275
|
-
const result = target.clear();
|
|
1276
|
-
if (hadItems) {
|
|
1277
|
-
trigger(
|
|
1278
|
-
target,
|
|
1279
|
-
"clear",
|
|
1280
|
-
void 0,
|
|
1281
|
-
void 0,
|
|
1282
|
-
oldTarget
|
|
1283
|
-
);
|
|
1284
|
-
}
|
|
1285
|
-
return result;
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
);
|
|
1289
|
-
const iteratorMethods = [
|
|
1290
|
-
"keys",
|
|
1291
|
-
"values",
|
|
1292
|
-
"entries",
|
|
1293
|
-
Symbol.iterator
|
|
1294
|
-
];
|
|
1295
|
-
iteratorMethods.forEach((method) => {
|
|
1296
|
-
instrumentations[method] = createIterableMethod(method, readonly2, shallow);
|
|
1297
|
-
});
|
|
1298
|
-
return instrumentations;
|
|
962
|
+
return function(...args) {
|
|
963
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
964
|
+
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
|
965
|
+
warn$1(`${capitalize(type)} operation ${key}failed: target is readonly.`, /* @__PURE__ */ toRaw(this));
|
|
966
|
+
}
|
|
967
|
+
return type === "delete" ? false : type === "clear" ? void 0 : this;
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
function createInstrumentations(readonly, shallow) {
|
|
971
|
+
const instrumentations = {
|
|
972
|
+
get(key) {
|
|
973
|
+
const target = this["__v_raw"];
|
|
974
|
+
const rawTarget = /* @__PURE__ */ toRaw(target);
|
|
975
|
+
const rawKey = /* @__PURE__ */ toRaw(key);
|
|
976
|
+
if (!readonly) {
|
|
977
|
+
if (hasChanged(key, rawKey)) track(rawTarget, "get", key);
|
|
978
|
+
track(rawTarget, "get", rawKey);
|
|
979
|
+
}
|
|
980
|
+
const { has } = getProto(rawTarget);
|
|
981
|
+
const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
|
|
982
|
+
if (has.call(rawTarget, key)) return wrap(target.get(key));
|
|
983
|
+
else if (has.call(rawTarget, rawKey)) return wrap(target.get(rawKey));
|
|
984
|
+
else if (target !== rawTarget) target.get(key);
|
|
985
|
+
},
|
|
986
|
+
get size() {
|
|
987
|
+
const target = this["__v_raw"];
|
|
988
|
+
!readonly && track(/* @__PURE__ */ toRaw(target), "iterate", ITERATE_KEY);
|
|
989
|
+
return target.size;
|
|
990
|
+
},
|
|
991
|
+
has(key) {
|
|
992
|
+
const target = this["__v_raw"];
|
|
993
|
+
const rawTarget = /* @__PURE__ */ toRaw(target);
|
|
994
|
+
const rawKey = /* @__PURE__ */ toRaw(key);
|
|
995
|
+
if (!readonly) {
|
|
996
|
+
if (hasChanged(key, rawKey)) track(rawTarget, "has", key);
|
|
997
|
+
track(rawTarget, "has", rawKey);
|
|
998
|
+
}
|
|
999
|
+
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
|
|
1000
|
+
},
|
|
1001
|
+
forEach(callback, thisArg) {
|
|
1002
|
+
const observed = this;
|
|
1003
|
+
const target = observed["__v_raw"];
|
|
1004
|
+
const rawTarget = /* @__PURE__ */ toRaw(target);
|
|
1005
|
+
const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
|
|
1006
|
+
!readonly && track(rawTarget, "iterate", ITERATE_KEY);
|
|
1007
|
+
return target.forEach((value, key) => {
|
|
1008
|
+
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
};
|
|
1012
|
+
extend(instrumentations, readonly ? {
|
|
1013
|
+
add: createReadonlyMethod("add"),
|
|
1014
|
+
set: createReadonlyMethod("set"),
|
|
1015
|
+
delete: createReadonlyMethod("delete"),
|
|
1016
|
+
clear: createReadonlyMethod("clear")
|
|
1017
|
+
} : {
|
|
1018
|
+
add(value) {
|
|
1019
|
+
const target = /* @__PURE__ */ toRaw(this);
|
|
1020
|
+
const proto = getProto(target);
|
|
1021
|
+
const rawValue = /* @__PURE__ */ toRaw(value);
|
|
1022
|
+
const valueToAdd = !shallow && !/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value) ? rawValue : value;
|
|
1023
|
+
if (!(proto.has.call(target, valueToAdd) || hasChanged(value, valueToAdd) && proto.has.call(target, value) || hasChanged(rawValue, valueToAdd) && proto.has.call(target, rawValue))) {
|
|
1024
|
+
target.add(valueToAdd);
|
|
1025
|
+
trigger(target, "add", valueToAdd, valueToAdd);
|
|
1026
|
+
}
|
|
1027
|
+
return this;
|
|
1028
|
+
},
|
|
1029
|
+
set(key, value) {
|
|
1030
|
+
if (!shallow && !/* @__PURE__ */ isShallow(value) && !/* @__PURE__ */ isReadonly(value)) value = /* @__PURE__ */ toRaw(value);
|
|
1031
|
+
const target = /* @__PURE__ */ toRaw(this);
|
|
1032
|
+
const { has, get } = getProto(target);
|
|
1033
|
+
let hadKey = has.call(target, key);
|
|
1034
|
+
if (!hadKey) {
|
|
1035
|
+
key = /* @__PURE__ */ toRaw(key);
|
|
1036
|
+
hadKey = has.call(target, key);
|
|
1037
|
+
} else if (!!(process.env.NODE_ENV !== "production")) checkIdentityKeys(target, has, key);
|
|
1038
|
+
const oldValue = get.call(target, key);
|
|
1039
|
+
target.set(key, value);
|
|
1040
|
+
if (!hadKey) trigger(target, "add", key, value);
|
|
1041
|
+
else if (hasChanged(value, oldValue)) trigger(target, "set", key, value, oldValue);
|
|
1042
|
+
return this;
|
|
1043
|
+
},
|
|
1044
|
+
delete(key) {
|
|
1045
|
+
const target = /* @__PURE__ */ toRaw(this);
|
|
1046
|
+
const { has, get } = getProto(target);
|
|
1047
|
+
let hadKey = has.call(target, key);
|
|
1048
|
+
if (!hadKey) {
|
|
1049
|
+
key = /* @__PURE__ */ toRaw(key);
|
|
1050
|
+
hadKey = has.call(target, key);
|
|
1051
|
+
} else if (!!(process.env.NODE_ENV !== "production")) checkIdentityKeys(target, has, key);
|
|
1052
|
+
const oldValue = get ? get.call(target, key) : void 0;
|
|
1053
|
+
const result = target.delete(key);
|
|
1054
|
+
if (hadKey) trigger(target, "delete", key, void 0, oldValue);
|
|
1055
|
+
return result;
|
|
1056
|
+
},
|
|
1057
|
+
clear() {
|
|
1058
|
+
const target = /* @__PURE__ */ toRaw(this);
|
|
1059
|
+
const hadItems = target.size !== 0;
|
|
1060
|
+
const oldTarget = !!(process.env.NODE_ENV !== "production") ? isMap(target) ? new Map(target) : new Set(target) : void 0;
|
|
1061
|
+
const result = target.clear();
|
|
1062
|
+
if (hadItems) trigger(target, "clear", void 0, void 0, oldTarget);
|
|
1063
|
+
return result;
|
|
1064
|
+
}
|
|
1065
|
+
});
|
|
1066
|
+
[
|
|
1067
|
+
"keys",
|
|
1068
|
+
"values",
|
|
1069
|
+
"entries",
|
|
1070
|
+
Symbol.iterator
|
|
1071
|
+
].forEach((method) => {
|
|
1072
|
+
instrumentations[method] = createIterableMethod(method, readonly, shallow);
|
|
1073
|
+
});
|
|
1074
|
+
return instrumentations;
|
|
1299
1075
|
}
|
|
1300
1076
|
function createInstrumentationGetter(isReadonly2, shallow) {
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
receiver
|
|
1314
|
-
);
|
|
1315
|
-
};
|
|
1316
|
-
}
|
|
1317
|
-
const mutableCollectionHandlers = {
|
|
1318
|
-
get: /* @__PURE__ */ createInstrumentationGetter(false, false)
|
|
1319
|
-
};
|
|
1320
|
-
const shallowCollectionHandlers = {
|
|
1321
|
-
get: /* @__PURE__ */ createInstrumentationGetter(false, true)
|
|
1322
|
-
};
|
|
1323
|
-
const readonlyCollectionHandlers = {
|
|
1324
|
-
get: /* @__PURE__ */ createInstrumentationGetter(true, false)
|
|
1325
|
-
};
|
|
1326
|
-
const shallowReadonlyCollectionHandlers = {
|
|
1327
|
-
get: /* @__PURE__ */ createInstrumentationGetter(true, true)
|
|
1328
|
-
};
|
|
1077
|
+
const instrumentations = createInstrumentations(isReadonly2, shallow);
|
|
1078
|
+
return (target, key, receiver) => {
|
|
1079
|
+
if (key === "__v_isReactive") return !isReadonly2;
|
|
1080
|
+
else if (key === "__v_isReadonly") return isReadonly2;
|
|
1081
|
+
else if (key === "__v_raw") return target;
|
|
1082
|
+
return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
var mutableCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(false, false) };
|
|
1086
|
+
var shallowCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(false, true) };
|
|
1087
|
+
var readonlyCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(true, false) };
|
|
1088
|
+
var shallowReadonlyCollectionHandlers = { get: /* @__PURE__ */ createInstrumentationGetter(true, true) };
|
|
1329
1089
|
function checkIdentityKeys(target, has, key) {
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
const readonlyMap = /* @__PURE__ */ new WeakMap();
|
|
1341
|
-
const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
|
|
1090
|
+
const rawKey = /* @__PURE__ */ toRaw(key);
|
|
1091
|
+
if (rawKey !== key && has.call(target, rawKey)) {
|
|
1092
|
+
const type = toRawType(target);
|
|
1093
|
+
warn$1(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`);
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
var reactiveMap = /* @__PURE__ */ new WeakMap();
|
|
1097
|
+
var shallowReactiveMap = /* @__PURE__ */ new WeakMap();
|
|
1098
|
+
var readonlyMap = /* @__PURE__ */ new WeakMap();
|
|
1099
|
+
var shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
|
|
1342
1100
|
function targetTypeMap(rawType) {
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
default:
|
|
1353
|
-
return 0;
|
|
1354
|
-
}
|
|
1101
|
+
switch (rawType) {
|
|
1102
|
+
case "Object":
|
|
1103
|
+
case "Array": return 1;
|
|
1104
|
+
case "Map":
|
|
1105
|
+
case "Set":
|
|
1106
|
+
case "WeakMap":
|
|
1107
|
+
case "WeakSet": return 2;
|
|
1108
|
+
default: return 0;
|
|
1109
|
+
}
|
|
1355
1110
|
}
|
|
1356
1111
|
function getTargetType(value) {
|
|
1357
|
-
|
|
1112
|
+
return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value));
|
|
1358
1113
|
}
|
|
1114
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1359
1115
|
function reactive(target) {
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
}
|
|
1363
|
-
return createReactiveObject(
|
|
1364
|
-
target,
|
|
1365
|
-
false,
|
|
1366
|
-
mutableHandlers,
|
|
1367
|
-
mutableCollectionHandlers,
|
|
1368
|
-
reactiveMap
|
|
1369
|
-
);
|
|
1116
|
+
if (/* @__PURE__ */ isReadonly(target)) return target;
|
|
1117
|
+
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
|
|
1370
1118
|
}
|
|
1119
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1371
1120
|
function shallowReactive(target) {
|
|
1372
|
-
|
|
1373
|
-
target,
|
|
1374
|
-
false,
|
|
1375
|
-
shallowReactiveHandlers,
|
|
1376
|
-
shallowCollectionHandlers,
|
|
1377
|
-
shallowReactiveMap
|
|
1378
|
-
);
|
|
1121
|
+
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
|
|
1379
1122
|
}
|
|
1123
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1380
1124
|
function readonly(target) {
|
|
1381
|
-
|
|
1382
|
-
target,
|
|
1383
|
-
true,
|
|
1384
|
-
readonlyHandlers,
|
|
1385
|
-
readonlyCollectionHandlers,
|
|
1386
|
-
readonlyMap
|
|
1387
|
-
);
|
|
1125
|
+
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
|
|
1388
1126
|
}
|
|
1127
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1389
1128
|
function shallowReadonly(target) {
|
|
1390
|
-
|
|
1391
|
-
target,
|
|
1392
|
-
true,
|
|
1393
|
-
shallowReadonlyHandlers,
|
|
1394
|
-
shallowReadonlyCollectionHandlers,
|
|
1395
|
-
shallowReadonlyMap
|
|
1396
|
-
);
|
|
1129
|
+
return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
|
|
1397
1130
|
}
|
|
1398
1131
|
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
if (targetType === 0) {
|
|
1414
|
-
return target;
|
|
1415
|
-
}
|
|
1416
|
-
const existingProxy = proxyMap.get(target);
|
|
1417
|
-
if (existingProxy) {
|
|
1418
|
-
return existingProxy;
|
|
1419
|
-
}
|
|
1420
|
-
const proxy = new Proxy(
|
|
1421
|
-
target,
|
|
1422
|
-
targetType === 2 ? collectionHandlers : baseHandlers
|
|
1423
|
-
);
|
|
1424
|
-
proxyMap.set(target, proxy);
|
|
1425
|
-
return proxy;
|
|
1426
|
-
}
|
|
1132
|
+
if (!isObject(target)) {
|
|
1133
|
+
if (!!(process.env.NODE_ENV !== "production")) warn$1(`value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(target)}`);
|
|
1134
|
+
return target;
|
|
1135
|
+
}
|
|
1136
|
+
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) return target;
|
|
1137
|
+
const targetType = getTargetType(target);
|
|
1138
|
+
if (targetType === 0) return target;
|
|
1139
|
+
const existingProxy = proxyMap.get(target);
|
|
1140
|
+
if (existingProxy) return existingProxy;
|
|
1141
|
+
const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
|
|
1142
|
+
proxyMap.set(target, proxy);
|
|
1143
|
+
return proxy;
|
|
1144
|
+
}
|
|
1145
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1427
1146
|
function isReactive(value) {
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
}
|
|
1431
|
-
return !!(value && value["__v_isReactive"]);
|
|
1147
|
+
if (/* @__PURE__ */ isReadonly(value)) return /* @__PURE__ */ isReactive(value["__v_raw"]);
|
|
1148
|
+
return !!(value && value["__v_isReactive"]);
|
|
1432
1149
|
}
|
|
1150
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1433
1151
|
function isReadonly(value) {
|
|
1434
|
-
|
|
1152
|
+
return !!(value && value["__v_isReadonly"]);
|
|
1435
1153
|
}
|
|
1154
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1436
1155
|
function isShallow(value) {
|
|
1437
|
-
|
|
1156
|
+
return !!(value && value["__v_isShallow"]);
|
|
1438
1157
|
}
|
|
1158
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1439
1159
|
function isProxy(value) {
|
|
1440
|
-
|
|
1160
|
+
return value ? !!value["__v_raw"] : false;
|
|
1441
1161
|
}
|
|
1162
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1442
1163
|
function toRaw(observed) {
|
|
1443
|
-
|
|
1444
|
-
|
|
1164
|
+
const raw = observed && observed["__v_raw"];
|
|
1165
|
+
return raw ? /* @__PURE__ */ toRaw(raw) : observed;
|
|
1445
1166
|
}
|
|
1446
1167
|
function markRaw(value) {
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
}
|
|
1450
|
-
return value;
|
|
1168
|
+
if (!hasOwn(value, "__v_skip") && Object.isExtensible(value)) def(value, "__v_skip", true);
|
|
1169
|
+
return value;
|
|
1451
1170
|
}
|
|
1452
|
-
|
|
1453
|
-
|
|
1171
|
+
var toReactive = (value) => isObject(value) ? /* @__PURE__ */ reactive(value) : value;
|
|
1172
|
+
var toReadonly = (value) => isObject(value) ? /* @__PURE__ */ readonly(value) : value;
|
|
1173
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1454
1174
|
function isRef(r) {
|
|
1455
|
-
|
|
1175
|
+
return r ? r["__v_isRef"] === true : false;
|
|
1456
1176
|
}
|
|
1177
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1457
1178
|
function ref(value) {
|
|
1458
|
-
|
|
1179
|
+
return createRef(value, false);
|
|
1459
1180
|
}
|
|
1181
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1460
1182
|
function shallowRef(value) {
|
|
1461
|
-
|
|
1183
|
+
return createRef(value, true);
|
|
1462
1184
|
}
|
|
1463
1185
|
function createRef(rawValue, shallow) {
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
oldValue
|
|
1504
|
-
});
|
|
1505
|
-
} else {
|
|
1506
|
-
this.dep.trigger();
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
}
|
|
1186
|
+
if (/* @__PURE__ */ isRef(rawValue)) return rawValue;
|
|
1187
|
+
return new RefImpl(rawValue, shallow);
|
|
1188
|
+
}
|
|
1189
|
+
var RefImpl = class {
|
|
1190
|
+
constructor(value, isShallow2) {
|
|
1191
|
+
this.dep = new Dep();
|
|
1192
|
+
this["__v_isRef"] = true;
|
|
1193
|
+
this["__v_isShallow"] = false;
|
|
1194
|
+
this._rawValue = isShallow2 ? value : /* @__PURE__ */ toRaw(value);
|
|
1195
|
+
this._value = isShallow2 ? value : toReactive(value);
|
|
1196
|
+
this["__v_isShallow"] = isShallow2;
|
|
1197
|
+
}
|
|
1198
|
+
get value() {
|
|
1199
|
+
if (!!(process.env.NODE_ENV !== "production")) this.dep.track({
|
|
1200
|
+
target: this,
|
|
1201
|
+
type: "get",
|
|
1202
|
+
key: "value"
|
|
1203
|
+
});
|
|
1204
|
+
else this.dep.track();
|
|
1205
|
+
return this._value;
|
|
1206
|
+
}
|
|
1207
|
+
set value(newValue) {
|
|
1208
|
+
const oldValue = this._rawValue;
|
|
1209
|
+
const useDirectValue = this["__v_isShallow"] || /* @__PURE__ */ isShallow(newValue) || /* @__PURE__ */ isReadonly(newValue);
|
|
1210
|
+
newValue = useDirectValue ? newValue : /* @__PURE__ */ toRaw(newValue);
|
|
1211
|
+
if (hasChanged(newValue, oldValue)) {
|
|
1212
|
+
this._rawValue = newValue;
|
|
1213
|
+
this._value = useDirectValue ? newValue : toReactive(newValue);
|
|
1214
|
+
if (!!(process.env.NODE_ENV !== "production")) this.dep.trigger({
|
|
1215
|
+
target: this,
|
|
1216
|
+
type: "set",
|
|
1217
|
+
key: "value",
|
|
1218
|
+
newValue,
|
|
1219
|
+
oldValue
|
|
1220
|
+
});
|
|
1221
|
+
else this.dep.trigger();
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
};
|
|
1511
1225
|
function triggerRef(ref2) {
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
});
|
|
1520
|
-
} else {
|
|
1521
|
-
ref2.dep.trigger();
|
|
1522
|
-
}
|
|
1523
|
-
}
|
|
1226
|
+
if (ref2.dep) if (!!(process.env.NODE_ENV !== "production")) ref2.dep.trigger({
|
|
1227
|
+
target: ref2,
|
|
1228
|
+
type: "set",
|
|
1229
|
+
key: "value",
|
|
1230
|
+
newValue: ref2._value
|
|
1231
|
+
});
|
|
1232
|
+
else ref2.dep.trigger();
|
|
1524
1233
|
}
|
|
1525
1234
|
function unref(ref2) {
|
|
1526
|
-
|
|
1235
|
+
return /* @__PURE__ */ isRef(ref2) ? ref2.value : ref2;
|
|
1527
1236
|
}
|
|
1528
1237
|
function toValue(source) {
|
|
1529
|
-
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
}
|
|
1541
|
-
}
|
|
1238
|
+
return isFunction(source) ? source() : unref(source);
|
|
1239
|
+
}
|
|
1240
|
+
var shallowUnwrapHandlers = {
|
|
1241
|
+
get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
|
|
1242
|
+
set: (target, key, value, receiver) => {
|
|
1243
|
+
const oldValue = target[key];
|
|
1244
|
+
if (/* @__PURE__ */ isRef(oldValue) && !/* @__PURE__ */ isRef(value)) {
|
|
1245
|
+
oldValue.value = value;
|
|
1246
|
+
return true;
|
|
1247
|
+
} else return Reflect.set(target, key, value, receiver);
|
|
1248
|
+
}
|
|
1542
1249
|
};
|
|
1543
1250
|
function proxyRefs(objectWithRefs) {
|
|
1544
|
-
|
|
1545
|
-
}
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
}
|
|
1251
|
+
return /* @__PURE__ */ isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
|
1252
|
+
}
|
|
1253
|
+
var CustomRefImpl = class {
|
|
1254
|
+
constructor(factory) {
|
|
1255
|
+
this["__v_isRef"] = true;
|
|
1256
|
+
this._value = void 0;
|
|
1257
|
+
const dep = this.dep = new Dep();
|
|
1258
|
+
const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
|
1259
|
+
this._get = get;
|
|
1260
|
+
this._set = set;
|
|
1261
|
+
}
|
|
1262
|
+
get value() {
|
|
1263
|
+
return this._value = this._get();
|
|
1264
|
+
}
|
|
1265
|
+
set value(newVal) {
|
|
1266
|
+
this._set(newVal);
|
|
1267
|
+
}
|
|
1268
|
+
};
|
|
1562
1269
|
function customRef(factory) {
|
|
1563
|
-
|
|
1270
|
+
return new CustomRefImpl(factory);
|
|
1564
1271
|
}
|
|
1272
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1565
1273
|
function toRefs(object) {
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
this["__v_isReadonly"] = true;
|
|
1618
|
-
this._value = void 0;
|
|
1619
|
-
}
|
|
1620
|
-
get value() {
|
|
1621
|
-
return this._value = this._getter();
|
|
1622
|
-
}
|
|
1623
|
-
}
|
|
1274
|
+
if (!!(process.env.NODE_ENV !== "production") && !/* @__PURE__ */ isProxy(object)) warn$1(`toRefs() expects a reactive object but received a plain one.`);
|
|
1275
|
+
const ret = isArray(object) ? new Array(object.length) : {};
|
|
1276
|
+
for (const key in object) ret[key] = propertyToRef(object, key);
|
|
1277
|
+
return ret;
|
|
1278
|
+
}
|
|
1279
|
+
var ObjectRefImpl = class {
|
|
1280
|
+
constructor(_object, key, _defaultValue) {
|
|
1281
|
+
this._object = _object;
|
|
1282
|
+
this._defaultValue = _defaultValue;
|
|
1283
|
+
this["__v_isRef"] = true;
|
|
1284
|
+
this._value = void 0;
|
|
1285
|
+
this._key = isSymbol(key) ? key : String(key);
|
|
1286
|
+
this._raw = /* @__PURE__ */ toRaw(_object);
|
|
1287
|
+
let shallow = true;
|
|
1288
|
+
let obj = _object;
|
|
1289
|
+
if (!isArray(_object) || isSymbol(this._key) || !isIntegerKey(this._key)) do
|
|
1290
|
+
shallow = !/* @__PURE__ */ isProxy(obj) || /* @__PURE__ */ isShallow(obj);
|
|
1291
|
+
while (shallow && (obj = obj["__v_raw"]));
|
|
1292
|
+
this._shallow = shallow;
|
|
1293
|
+
}
|
|
1294
|
+
get value() {
|
|
1295
|
+
let val = this._object[this._key];
|
|
1296
|
+
if (this._shallow) val = unref(val);
|
|
1297
|
+
return this._value = val === void 0 ? this._defaultValue : val;
|
|
1298
|
+
}
|
|
1299
|
+
set value(newVal) {
|
|
1300
|
+
if (this._shallow && /* @__PURE__ */ isRef(this._raw[this._key])) {
|
|
1301
|
+
const nestedRef = this._object[this._key];
|
|
1302
|
+
if (/* @__PURE__ */ isRef(nestedRef)) {
|
|
1303
|
+
nestedRef.value = newVal;
|
|
1304
|
+
return;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
this._object[this._key] = newVal;
|
|
1308
|
+
}
|
|
1309
|
+
get dep() {
|
|
1310
|
+
return getDepFromReactive(this._raw, this._key);
|
|
1311
|
+
}
|
|
1312
|
+
};
|
|
1313
|
+
var GetterRefImpl = class {
|
|
1314
|
+
constructor(_getter) {
|
|
1315
|
+
this._getter = _getter;
|
|
1316
|
+
this["__v_isRef"] = true;
|
|
1317
|
+
this["__v_isReadonly"] = true;
|
|
1318
|
+
this._value = void 0;
|
|
1319
|
+
}
|
|
1320
|
+
get value() {
|
|
1321
|
+
return this._value = this._getter();
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1324
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1624
1325
|
function toRef(source, key, defaultValue) {
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
} else if (isObject(source) && arguments.length > 1) {
|
|
1630
|
-
return propertyToRef(source, key, defaultValue);
|
|
1631
|
-
} else {
|
|
1632
|
-
return ref(source);
|
|
1633
|
-
}
|
|
1326
|
+
if (/* @__PURE__ */ isRef(source)) return source;
|
|
1327
|
+
else if (isFunction(source)) return new GetterRefImpl(source);
|
|
1328
|
+
else if (isObject(source) && arguments.length > 1) return propertyToRef(source, key, defaultValue);
|
|
1329
|
+
else return /* @__PURE__ */ ref(source);
|
|
1634
1330
|
}
|
|
1635
1331
|
function propertyToRef(source, key, defaultValue) {
|
|
1636
|
-
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1332
|
+
return new ObjectRefImpl(source, key, defaultValue);
|
|
1333
|
+
}
|
|
1334
|
+
var ComputedRefImpl = class {
|
|
1335
|
+
constructor(fn, setter, isSSR) {
|
|
1336
|
+
this.fn = fn;
|
|
1337
|
+
this.setter = setter;
|
|
1338
|
+
/**
|
|
1339
|
+
* @internal
|
|
1340
|
+
*/
|
|
1341
|
+
this._value = void 0;
|
|
1342
|
+
/**
|
|
1343
|
+
* @internal
|
|
1344
|
+
*/
|
|
1345
|
+
this.dep = new Dep(this);
|
|
1346
|
+
/**
|
|
1347
|
+
* @internal
|
|
1348
|
+
*/
|
|
1349
|
+
this.__v_isRef = true;
|
|
1350
|
+
/**
|
|
1351
|
+
* @internal
|
|
1352
|
+
*/
|
|
1353
|
+
this.deps = void 0;
|
|
1354
|
+
/**
|
|
1355
|
+
* @internal
|
|
1356
|
+
*/
|
|
1357
|
+
this.depsTail = void 0;
|
|
1358
|
+
/**
|
|
1359
|
+
* @internal
|
|
1360
|
+
*/
|
|
1361
|
+
this.flags = 16;
|
|
1362
|
+
/**
|
|
1363
|
+
* @internal
|
|
1364
|
+
*/
|
|
1365
|
+
this.globalVersion = globalVersion - 1;
|
|
1366
|
+
/**
|
|
1367
|
+
* @internal
|
|
1368
|
+
*/
|
|
1369
|
+
this.next = void 0;
|
|
1370
|
+
this.effect = this;
|
|
1371
|
+
this["__v_isReadonly"] = !setter;
|
|
1372
|
+
this.isSSR = isSSR;
|
|
1373
|
+
}
|
|
1374
|
+
/**
|
|
1375
|
+
* @internal
|
|
1376
|
+
*/
|
|
1377
|
+
notify() {
|
|
1378
|
+
this.flags |= 16;
|
|
1379
|
+
if (!(this.flags & 8) && activeSub !== this) {
|
|
1380
|
+
batch(this, true);
|
|
1381
|
+
return true;
|
|
1382
|
+
} else if (!!(process.env.NODE_ENV !== "production"));
|
|
1383
|
+
}
|
|
1384
|
+
get value() {
|
|
1385
|
+
const link = !!(process.env.NODE_ENV !== "production") ? this.dep.track({
|
|
1386
|
+
target: this,
|
|
1387
|
+
type: "get",
|
|
1388
|
+
key: "value"
|
|
1389
|
+
}) : this.dep.track();
|
|
1390
|
+
refreshComputed(this);
|
|
1391
|
+
if (link) link.version = this.dep.version;
|
|
1392
|
+
return this._value;
|
|
1393
|
+
}
|
|
1394
|
+
set value(newValue) {
|
|
1395
|
+
if (this.setter) this.setter(newValue);
|
|
1396
|
+
else if (!!(process.env.NODE_ENV !== "production")) warn$1("Write operation failed: computed value is readonly");
|
|
1397
|
+
}
|
|
1398
|
+
};
|
|
1399
|
+
/* @__NO_SIDE_EFFECTS__ */
|
|
1685
1400
|
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
"ITERATE": "iterate"
|
|
1401
|
+
let getter;
|
|
1402
|
+
let setter;
|
|
1403
|
+
if (isFunction(getterOrOptions)) getter = getterOrOptions;
|
|
1404
|
+
else {
|
|
1405
|
+
getter = getterOrOptions.get;
|
|
1406
|
+
setter = getterOrOptions.set;
|
|
1407
|
+
}
|
|
1408
|
+
const cRef = new ComputedRefImpl(getter, setter, isSSR);
|
|
1409
|
+
if (!!(process.env.NODE_ENV !== "production") && debugOptions && !isSSR) {
|
|
1410
|
+
cRef.onTrack = debugOptions.onTrack;
|
|
1411
|
+
cRef.onTrigger = debugOptions.onTrigger;
|
|
1412
|
+
}
|
|
1413
|
+
return cRef;
|
|
1414
|
+
}
|
|
1415
|
+
var TrackOpTypes = {
|
|
1416
|
+
"GET": "get",
|
|
1417
|
+
"HAS": "has",
|
|
1418
|
+
"ITERATE": "iterate"
|
|
1705
1419
|
};
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1420
|
+
var TriggerOpTypes = {
|
|
1421
|
+
"SET": "set",
|
|
1422
|
+
"ADD": "add",
|
|
1423
|
+
"DELETE": "delete",
|
|
1424
|
+
"CLEAR": "clear"
|
|
1711
1425
|
};
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1426
|
+
var ReactiveFlags = {
|
|
1427
|
+
"SKIP": "__v_skip",
|
|
1428
|
+
"IS_REACTIVE": "__v_isReactive",
|
|
1429
|
+
"IS_READONLY": "__v_isReadonly",
|
|
1430
|
+
"IS_SHALLOW": "__v_isShallow",
|
|
1431
|
+
"RAW": "__v_raw",
|
|
1432
|
+
"IS_REF": "__v_isRef"
|
|
1719
1433
|
};
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1434
|
+
var WatchErrorCodes = {
|
|
1435
|
+
"WATCH_GETTER": 2,
|
|
1436
|
+
"2": "WATCH_GETTER",
|
|
1437
|
+
"WATCH_CALLBACK": 3,
|
|
1438
|
+
"3": "WATCH_CALLBACK",
|
|
1439
|
+
"WATCH_CLEANUP": 4,
|
|
1440
|
+
"4": "WATCH_CLEANUP"
|
|
1727
1441
|
};
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1442
|
+
var INITIAL_WATCHER_VALUE = {};
|
|
1443
|
+
var cleanupMap = /* @__PURE__ */ new WeakMap();
|
|
1444
|
+
var activeWatcher = void 0;
|
|
1731
1445
|
function getCurrentWatcher() {
|
|
1732
|
-
|
|
1446
|
+
return activeWatcher;
|
|
1733
1447
|
}
|
|
1734
1448
|
function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
warn$1(
|
|
1741
|
-
`onWatcherCleanup() was called when there was no active watcher to associate with.`
|
|
1742
|
-
);
|
|
1743
|
-
}
|
|
1449
|
+
if (owner) {
|
|
1450
|
+
let cleanups = cleanupMap.get(owner);
|
|
1451
|
+
if (!cleanups) cleanupMap.set(owner, cleanups = []);
|
|
1452
|
+
cleanups.push(cleanupFn);
|
|
1453
|
+
} else if (!!(process.env.NODE_ENV !== "production") && !failSilently) warn$1(`onWatcherCleanup() was called when there was no active watcher to associate with.`);
|
|
1744
1454
|
}
|
|
1745
1455
|
function watch$1(source, cb, options = EMPTY_OBJ) {
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
}
|
|
1863
|
-
};
|
|
1864
|
-
if (augmentJob) {
|
|
1865
|
-
augmentJob(job);
|
|
1866
|
-
}
|
|
1867
|
-
effect2 = new ReactiveEffect(getter);
|
|
1868
|
-
effect2.scheduler = scheduler ? () => scheduler(job, false) : job;
|
|
1869
|
-
boundCleanup = (fn) => onWatcherCleanup(fn, false, effect2);
|
|
1870
|
-
cleanup = effect2.onStop = () => {
|
|
1871
|
-
const cleanups = cleanupMap.get(effect2);
|
|
1872
|
-
if (cleanups) {
|
|
1873
|
-
if (call) {
|
|
1874
|
-
call(cleanups, 4);
|
|
1875
|
-
} else {
|
|
1876
|
-
for (const cleanup2 of cleanups) cleanup2();
|
|
1877
|
-
}
|
|
1878
|
-
cleanupMap.delete(effect2);
|
|
1879
|
-
}
|
|
1880
|
-
};
|
|
1881
|
-
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1882
|
-
effect2.onTrack = options.onTrack;
|
|
1883
|
-
effect2.onTrigger = options.onTrigger;
|
|
1884
|
-
}
|
|
1885
|
-
if (cb) {
|
|
1886
|
-
if (immediate) {
|
|
1887
|
-
job(true);
|
|
1888
|
-
} else {
|
|
1889
|
-
oldValue = effect2.run();
|
|
1890
|
-
}
|
|
1891
|
-
} else if (scheduler) {
|
|
1892
|
-
scheduler(job.bind(null, true), true);
|
|
1893
|
-
} else {
|
|
1894
|
-
effect2.run();
|
|
1895
|
-
}
|
|
1896
|
-
watchHandle.pause = effect2.pause.bind(effect2);
|
|
1897
|
-
watchHandle.resume = effect2.resume.bind(effect2);
|
|
1898
|
-
watchHandle.stop = watchHandle;
|
|
1899
|
-
return watchHandle;
|
|
1456
|
+
const { immediate, deep, once, scheduler, augmentJob, call } = options;
|
|
1457
|
+
const warnInvalidSource = (s) => {
|
|
1458
|
+
(options.onWarn || warn$1)(`Invalid watch source: `, s, `A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`);
|
|
1459
|
+
};
|
|
1460
|
+
const reactiveGetter = (source2) => {
|
|
1461
|
+
if (deep) return source2;
|
|
1462
|
+
if (/* @__PURE__ */ isShallow(source2) || deep === false || deep === 0) return traverse(source2, 1);
|
|
1463
|
+
return traverse(source2);
|
|
1464
|
+
};
|
|
1465
|
+
let effect;
|
|
1466
|
+
let getter;
|
|
1467
|
+
let cleanup;
|
|
1468
|
+
let boundCleanup;
|
|
1469
|
+
let forceTrigger = false;
|
|
1470
|
+
let isMultiSource = false;
|
|
1471
|
+
if (/* @__PURE__ */ isRef(source)) {
|
|
1472
|
+
getter = () => source.value;
|
|
1473
|
+
forceTrigger = /* @__PURE__ */ isShallow(source);
|
|
1474
|
+
} else if (/* @__PURE__ */ isReactive(source)) {
|
|
1475
|
+
getter = () => reactiveGetter(source);
|
|
1476
|
+
forceTrigger = true;
|
|
1477
|
+
} else if (isArray(source)) {
|
|
1478
|
+
isMultiSource = true;
|
|
1479
|
+
forceTrigger = source.some((s) => /* @__PURE__ */ isReactive(s) || /* @__PURE__ */ isShallow(s));
|
|
1480
|
+
getter = () => source.map((s) => {
|
|
1481
|
+
if (/* @__PURE__ */ isRef(s)) return s.value;
|
|
1482
|
+
else if (/* @__PURE__ */ isReactive(s)) return reactiveGetter(s);
|
|
1483
|
+
else if (isFunction(s)) return call ? call(s, 2) : s();
|
|
1484
|
+
else process.env.NODE_ENV !== "production" && warnInvalidSource(s);
|
|
1485
|
+
});
|
|
1486
|
+
} else if (isFunction(source)) if (cb) getter = call ? () => call(source, 2) : source;
|
|
1487
|
+
else getter = () => {
|
|
1488
|
+
if (cleanup) {
|
|
1489
|
+
pauseTracking();
|
|
1490
|
+
try {
|
|
1491
|
+
cleanup();
|
|
1492
|
+
} finally {
|
|
1493
|
+
resetTracking();
|
|
1494
|
+
}
|
|
1495
|
+
}
|
|
1496
|
+
const currentEffect = activeWatcher;
|
|
1497
|
+
activeWatcher = effect;
|
|
1498
|
+
try {
|
|
1499
|
+
return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
|
|
1500
|
+
} finally {
|
|
1501
|
+
activeWatcher = currentEffect;
|
|
1502
|
+
}
|
|
1503
|
+
};
|
|
1504
|
+
else {
|
|
1505
|
+
getter = NOOP;
|
|
1506
|
+
process.env.NODE_ENV !== "production" && warnInvalidSource(source);
|
|
1507
|
+
}
|
|
1508
|
+
if (cb && deep) {
|
|
1509
|
+
const baseGetter = getter;
|
|
1510
|
+
const depth = deep === true ? Infinity : deep;
|
|
1511
|
+
getter = () => traverse(baseGetter(), depth);
|
|
1512
|
+
}
|
|
1513
|
+
const scope = getCurrentScope();
|
|
1514
|
+
const watchHandle = () => {
|
|
1515
|
+
effect.stop();
|
|
1516
|
+
if (scope && scope.active) remove(scope.effects, effect);
|
|
1517
|
+
};
|
|
1518
|
+
if (once && cb) {
|
|
1519
|
+
const _cb = cb;
|
|
1520
|
+
cb = (...args) => {
|
|
1521
|
+
_cb(...args);
|
|
1522
|
+
watchHandle();
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1525
|
+
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
1526
|
+
const job = (immediateFirstRun) => {
|
|
1527
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) return;
|
|
1528
|
+
if (cb) {
|
|
1529
|
+
const newValue = effect.run();
|
|
1530
|
+
if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => hasChanged(v, oldValue[i])) : hasChanged(newValue, oldValue))) {
|
|
1531
|
+
if (cleanup) cleanup();
|
|
1532
|
+
const currentWatcher = activeWatcher;
|
|
1533
|
+
activeWatcher = effect;
|
|
1534
|
+
try {
|
|
1535
|
+
const args = [
|
|
1536
|
+
newValue,
|
|
1537
|
+
oldValue === INITIAL_WATCHER_VALUE ? void 0 : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
1538
|
+
boundCleanup
|
|
1539
|
+
];
|
|
1540
|
+
oldValue = newValue;
|
|
1541
|
+
call ? call(cb, 3, args) : cb(...args);
|
|
1542
|
+
} finally {
|
|
1543
|
+
activeWatcher = currentWatcher;
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
} else effect.run();
|
|
1547
|
+
};
|
|
1548
|
+
if (augmentJob) augmentJob(job);
|
|
1549
|
+
effect = new ReactiveEffect(getter);
|
|
1550
|
+
effect.scheduler = scheduler ? () => scheduler(job, false) : job;
|
|
1551
|
+
boundCleanup = (fn) => onWatcherCleanup(fn, false, effect);
|
|
1552
|
+
cleanup = effect.onStop = () => {
|
|
1553
|
+
const cleanups = cleanupMap.get(effect);
|
|
1554
|
+
if (cleanups) {
|
|
1555
|
+
if (call) call(cleanups, 4);
|
|
1556
|
+
else for (const cleanup2 of cleanups) cleanup2();
|
|
1557
|
+
cleanupMap.delete(effect);
|
|
1558
|
+
}
|
|
1559
|
+
};
|
|
1560
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1561
|
+
effect.onTrack = options.onTrack;
|
|
1562
|
+
effect.onTrigger = options.onTrigger;
|
|
1563
|
+
}
|
|
1564
|
+
if (cb) if (immediate) job(true);
|
|
1565
|
+
else oldValue = effect.run();
|
|
1566
|
+
else if (scheduler) scheduler(job.bind(null, true), true);
|
|
1567
|
+
else effect.run();
|
|
1568
|
+
watchHandle.pause = effect.pause.bind(effect);
|
|
1569
|
+
watchHandle.resume = effect.resume.bind(effect);
|
|
1570
|
+
watchHandle.stop = watchHandle;
|
|
1571
|
+
return watchHandle;
|
|
1900
1572
|
}
|
|
1901
1573
|
function traverse(value, depth = Infinity, seen) {
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
});
|
|
1921
|
-
} else if (isPlainObject(value)) {
|
|
1922
|
-
for (const key in value) {
|
|
1923
|
-
traverse(value[key], depth, seen);
|
|
1924
|
-
}
|
|
1925
|
-
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
1926
|
-
if (Object.prototype.propertyIsEnumerable.call(value, key)) {
|
|
1927
|
-
traverse(value[key], depth, seen);
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
}
|
|
1931
|
-
return value;
|
|
1932
|
-
}
|
|
1574
|
+
if (depth <= 0 || !isObject(value) || value["__v_skip"]) return value;
|
|
1575
|
+
seen = seen || /* @__PURE__ */ new Map();
|
|
1576
|
+
if ((seen.get(value) || 0) >= depth) return value;
|
|
1577
|
+
seen.set(value, depth);
|
|
1578
|
+
depth--;
|
|
1579
|
+
if (/* @__PURE__ */ isRef(value)) traverse(value.value, depth, seen);
|
|
1580
|
+
else if (isArray(value)) for (let i = 0; i < value.length; i++) traverse(value[i], depth, seen);
|
|
1581
|
+
else if (isSet(value) || isMap(value)) value.forEach((v) => {
|
|
1582
|
+
traverse(v, depth, seen);
|
|
1583
|
+
});
|
|
1584
|
+
else if (isPlainObject(value)) {
|
|
1585
|
+
for (const key in value) traverse(value[key], depth, seen);
|
|
1586
|
+
for (const key of Object.getOwnPropertySymbols(value)) if (Object.prototype.propertyIsEnumerable.call(value, key)) traverse(value[key], depth, seen);
|
|
1587
|
+
}
|
|
1588
|
+
return value;
|
|
1589
|
+
}
|
|
1590
|
+
//#endregion
|
|
1591
|
+
//#region src/warning.ts
|
|
1933
1592
|
function warn(msg, ...args) {
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
/* WATCH_CLEANUP */
|
|
1966
|
-
]: "watcher cleanup function",
|
|
1967
|
-
[
|
|
1968
|
-
3
|
|
1969
|
-
/* APP_ERROR_HANDLER */
|
|
1970
|
-
]: "app errorHandler",
|
|
1971
|
-
[
|
|
1972
|
-
4
|
|
1973
|
-
/* SCHEDULER */
|
|
1974
|
-
]: "scheduler flush"
|
|
1593
|
+
pauseTracking();
|
|
1594
|
+
const warnArgs = [`[Vue warn]: ${msg}`, ...args];
|
|
1595
|
+
/* istanbul ignore if */
|
|
1596
|
+
console.warn(...warnArgs);
|
|
1597
|
+
resetTracking();
|
|
1598
|
+
}
|
|
1599
|
+
//#endregion
|
|
1600
|
+
//#region src/enums.ts
|
|
1601
|
+
var LifecycleHooks = /* @__PURE__ */ function(LifecycleHooks) {
|
|
1602
|
+
LifecycleHooks["ACTIVATED"] = "a";
|
|
1603
|
+
LifecycleHooks["DEACTIVATED"] = "da";
|
|
1604
|
+
return LifecycleHooks;
|
|
1605
|
+
}({});
|
|
1606
|
+
//#endregion
|
|
1607
|
+
//#region src/errorHandling.ts
|
|
1608
|
+
var ErrorCodes = /* @__PURE__ */ function(ErrorCodes) {
|
|
1609
|
+
ErrorCodes[ErrorCodes["WATCH_GETTER"] = 0] = "WATCH_GETTER";
|
|
1610
|
+
ErrorCodes[ErrorCodes["WATCH_CALLBACK"] = 1] = "WATCH_CALLBACK";
|
|
1611
|
+
ErrorCodes[ErrorCodes["WATCH_CLEANUP"] = 2] = "WATCH_CLEANUP";
|
|
1612
|
+
ErrorCodes[ErrorCodes["APP_ERROR_HANDLER"] = 3] = "APP_ERROR_HANDLER";
|
|
1613
|
+
ErrorCodes[ErrorCodes["SCHEDULER"] = 4] = "SCHEDULER";
|
|
1614
|
+
return ErrorCodes;
|
|
1615
|
+
}({});
|
|
1616
|
+
var ErrorTypeStrings = {
|
|
1617
|
+
[LifecycleHooks.ACTIVATED]: "activated hook",
|
|
1618
|
+
[LifecycleHooks.DEACTIVATED]: "deactivated hook",
|
|
1619
|
+
[ErrorCodes.WATCH_GETTER]: "watcher getter",
|
|
1620
|
+
[ErrorCodes.WATCH_CALLBACK]: "watcher callback",
|
|
1621
|
+
[ErrorCodes.WATCH_CLEANUP]: "watcher cleanup function",
|
|
1622
|
+
[ErrorCodes.APP_ERROR_HANDLER]: "app errorHandler",
|
|
1623
|
+
[ErrorCodes.SCHEDULER]: "scheduler flush"
|
|
1975
1624
|
};
|
|
1976
1625
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1626
|
+
try {
|
|
1627
|
+
return args ? fn(...args) : fn();
|
|
1628
|
+
} catch (err) {
|
|
1629
|
+
handleError(err, instance, type);
|
|
1630
|
+
}
|
|
1982
1631
|
}
|
|
1983
1632
|
function callWithAsyncErrorHandling(fn, instance, type, args) {
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
|
|
1997
|
-
}
|
|
1998
|
-
return values;
|
|
1999
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
2000
|
-
warn(
|
|
2001
|
-
`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`
|
|
2002
|
-
);
|
|
2003
|
-
}
|
|
1633
|
+
if (isFunction(fn)) {
|
|
1634
|
+
const res = callWithErrorHandling(fn, instance, type, args);
|
|
1635
|
+
if (res && isPromise(res)) res.catch((err) => {
|
|
1636
|
+
handleError(err, instance, type);
|
|
1637
|
+
});
|
|
1638
|
+
return res;
|
|
1639
|
+
}
|
|
1640
|
+
if (isArray(fn)) {
|
|
1641
|
+
const values = [];
|
|
1642
|
+
for (let i = 0; i < fn.length; i++) values.push(callWithAsyncErrorHandling(fn[i], instance, type, args));
|
|
1643
|
+
return values;
|
|
1644
|
+
} else if (!!(process.env.NODE_ENV !== "production")) warn(`Invalid value type passed to callWithAsyncErrorHandling(): ${typeof fn}`);
|
|
2004
1645
|
}
|
|
2005
1646
|
function handleError(err, instance, type, throwInDev = true) {
|
|
2006
|
-
|
|
2007
|
-
logError(err, type, contextVNode, throwInDev);
|
|
1647
|
+
logError(err, type, null, throwInDev);
|
|
2008
1648
|
}
|
|
2009
1649
|
function logError(err, type, contextVNode, throwInDev = true) {
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
1650
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1651
|
+
const info = ErrorTypeStrings[type];
|
|
1652
|
+
warn(`Unhandled error${info ? ` during execution of ${info}` : ``}`);
|
|
1653
|
+
if (throwInDev) throw err;
|
|
1654
|
+
else console.error(err);
|
|
1655
|
+
} else console.error(err);
|
|
1656
|
+
}
|
|
1657
|
+
//#endregion
|
|
1658
|
+
//#region src/scheduler.ts
|
|
1659
|
+
var SchedulerJobFlags = /* @__PURE__ */ function(SchedulerJobFlags) {
|
|
1660
|
+
SchedulerJobFlags[SchedulerJobFlags["QUEUED"] = 1] = "QUEUED";
|
|
1661
|
+
SchedulerJobFlags[SchedulerJobFlags["PRE"] = 2] = "PRE";
|
|
1662
|
+
/**
|
|
1663
|
+
* Indicates whether the effect is allowed to recursively trigger itself
|
|
1664
|
+
* when managed by the scheduler.
|
|
1665
|
+
*
|
|
1666
|
+
* By default, a job cannot trigger itself because some built-in method calls,
|
|
1667
|
+
* e.g. Array.prototype.push actually performs reads as well (#1740) which
|
|
1668
|
+
* can lead to confusing infinite loops.
|
|
1669
|
+
* The allowed cases are component update functions and watch callbacks.
|
|
1670
|
+
* Component update functions may update child component props, which in turn
|
|
1671
|
+
* trigger flush: "pre" watch callbacks that mutates state that the parent
|
|
1672
|
+
* relies on (#1801). Watch callbacks doesn't track its dependencies so if it
|
|
1673
|
+
* triggers itself again, it's likely intentional and it is the user's
|
|
1674
|
+
* responsibility to perform recursive state mutation that eventually
|
|
1675
|
+
* stabilizes (#1727).
|
|
1676
|
+
*/
|
|
1677
|
+
SchedulerJobFlags[SchedulerJobFlags["ALLOW_RECURSE"] = 4] = "ALLOW_RECURSE";
|
|
1678
|
+
SchedulerJobFlags[SchedulerJobFlags["DISPOSED"] = 8] = "DISPOSED";
|
|
1679
|
+
return SchedulerJobFlags;
|
|
1680
|
+
}({});
|
|
1681
|
+
var queue = [];
|
|
1682
|
+
var flushIndex = -1;
|
|
1683
|
+
var pendingPostFlushCbs = [];
|
|
1684
|
+
var activePostFlushCbs = null;
|
|
1685
|
+
var postFlushIndex = 0;
|
|
1686
|
+
var resolvedPromise = /* @__PURE__ */ Promise.resolve();
|
|
1687
|
+
var currentFlushPromise = null;
|
|
1688
|
+
var RECURSION_LIMIT = 100;
|
|
2037
1689
|
function nextTick(fn) {
|
|
2038
|
-
|
|
2039
|
-
|
|
1690
|
+
const p = currentFlushPromise || resolvedPromise;
|
|
1691
|
+
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
2040
1692
|
}
|
|
2041
1693
|
function findInsertionIndex(id) {
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
}
|
|
2053
|
-
}
|
|
2054
|
-
return start;
|
|
1694
|
+
let start = flushIndex + 1;
|
|
1695
|
+
let end = queue.length;
|
|
1696
|
+
while (start < end) {
|
|
1697
|
+
const middle = start + end >>> 1;
|
|
1698
|
+
const middleJob = queue[middle];
|
|
1699
|
+
const middleJobId = getId(middleJob);
|
|
1700
|
+
if (middleJobId < id || middleJobId === id && middleJob.flags & SchedulerJobFlags.PRE) start = middle + 1;
|
|
1701
|
+
else end = middle;
|
|
1702
|
+
}
|
|
1703
|
+
return start;
|
|
2055
1704
|
}
|
|
2056
1705
|
function queueJob(job) {
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
}
|
|
2066
|
-
job.flags |= 1;
|
|
2067
|
-
queueFlush();
|
|
2068
|
-
}
|
|
1706
|
+
if (!(job.flags & SchedulerJobFlags.QUEUED)) {
|
|
1707
|
+
const jobId = getId(job);
|
|
1708
|
+
const lastJob = queue[queue.length - 1];
|
|
1709
|
+
if (!lastJob || !(job.flags & SchedulerJobFlags.PRE) && jobId >= getId(lastJob)) queue.push(job);
|
|
1710
|
+
else queue.splice(findInsertionIndex(jobId), 0, job);
|
|
1711
|
+
job.flags |= SchedulerJobFlags.QUEUED;
|
|
1712
|
+
queueFlush();
|
|
1713
|
+
}
|
|
2069
1714
|
}
|
|
2070
1715
|
function queueFlush() {
|
|
2071
|
-
|
|
2072
|
-
currentFlushPromise = resolvedPromise.then(flushJobs);
|
|
2073
|
-
}
|
|
1716
|
+
if (!currentFlushPromise) currentFlushPromise = resolvedPromise.then(flushJobs);
|
|
2074
1717
|
}
|
|
2075
1718
|
function flushPostFlushCbs(seen) {
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
if (!(cb.flags & 8)) cb();
|
|
2098
|
-
cb.flags &= -2;
|
|
2099
|
-
}
|
|
2100
|
-
activePostFlushCbs = null;
|
|
2101
|
-
postFlushIndex = 0;
|
|
2102
|
-
}
|
|
2103
|
-
}
|
|
2104
|
-
const getId = (job) => job.id == null ? job.flags & 2 ? -1 : Infinity : job.id;
|
|
1719
|
+
if (pendingPostFlushCbs.length) {
|
|
1720
|
+
const deduped = [...new Set(pendingPostFlushCbs)].sort((a, b) => getId(a) - getId(b));
|
|
1721
|
+
pendingPostFlushCbs.length = 0;
|
|
1722
|
+
if (activePostFlushCbs) {
|
|
1723
|
+
activePostFlushCbs.push(...deduped);
|
|
1724
|
+
return;
|
|
1725
|
+
}
|
|
1726
|
+
activePostFlushCbs = deduped;
|
|
1727
|
+
if (!!(process.env.NODE_ENV !== "production")) seen = seen || /* @__PURE__ */ new Map();
|
|
1728
|
+
for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
|
|
1729
|
+
const cb = activePostFlushCbs[postFlushIndex];
|
|
1730
|
+
if (!!(process.env.NODE_ENV !== "production") && checkRecursiveUpdates(seen, cb)) continue;
|
|
1731
|
+
if (cb.flags & SchedulerJobFlags.ALLOW_RECURSE) cb.flags &= ~SchedulerJobFlags.QUEUED;
|
|
1732
|
+
if (!(cb.flags & SchedulerJobFlags.DISPOSED)) cb();
|
|
1733
|
+
cb.flags &= ~SchedulerJobFlags.QUEUED;
|
|
1734
|
+
}
|
|
1735
|
+
activePostFlushCbs = null;
|
|
1736
|
+
postFlushIndex = 0;
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
var getId = (job) => job.id == null ? job.flags & SchedulerJobFlags.PRE ? -1 : Infinity : job.id;
|
|
2105
1740
|
function flushJobs(seen) {
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
}
|
|
2130
|
-
} finally {
|
|
2131
|
-
for (; flushIndex < queue.length; flushIndex++) {
|
|
2132
|
-
const job = queue[flushIndex];
|
|
2133
|
-
if (job) {
|
|
2134
|
-
job.flags &= -2;
|
|
2135
|
-
}
|
|
2136
|
-
}
|
|
2137
|
-
flushIndex = -1;
|
|
2138
|
-
queue.length = 0;
|
|
2139
|
-
flushPostFlushCbs(seen);
|
|
2140
|
-
currentFlushPromise = null;
|
|
2141
|
-
if (queue.length || pendingPostFlushCbs.length) {
|
|
2142
|
-
flushJobs(seen);
|
|
2143
|
-
}
|
|
2144
|
-
}
|
|
1741
|
+
if (!!(process.env.NODE_ENV !== "production")) seen = seen || /* @__PURE__ */ new Map();
|
|
1742
|
+
const check = !!(process.env.NODE_ENV !== "production") ? (job) => checkRecursiveUpdates(seen, job) : NOOP;
|
|
1743
|
+
try {
|
|
1744
|
+
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
1745
|
+
const job = queue[flushIndex];
|
|
1746
|
+
if (job && !(job.flags & SchedulerJobFlags.DISPOSED)) {
|
|
1747
|
+
if (!!(process.env.NODE_ENV !== "production") && check(job)) continue;
|
|
1748
|
+
if (job.flags & SchedulerJobFlags.ALLOW_RECURSE) job.flags &= ~SchedulerJobFlags.QUEUED;
|
|
1749
|
+
callWithErrorHandling(job, null, ErrorCodes.SCHEDULER);
|
|
1750
|
+
if (!(job.flags & SchedulerJobFlags.ALLOW_RECURSE)) job.flags &= ~SchedulerJobFlags.QUEUED;
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
} finally {
|
|
1754
|
+
for (; flushIndex < queue.length; flushIndex++) {
|
|
1755
|
+
const job = queue[flushIndex];
|
|
1756
|
+
if (job) job.flags &= ~SchedulerJobFlags.QUEUED;
|
|
1757
|
+
}
|
|
1758
|
+
flushIndex = -1;
|
|
1759
|
+
queue.length = 0;
|
|
1760
|
+
flushPostFlushCbs(seen);
|
|
1761
|
+
currentFlushPromise = null;
|
|
1762
|
+
if (queue.length || pendingPostFlushCbs.length) flushJobs(seen);
|
|
1763
|
+
}
|
|
2145
1764
|
}
|
|
2146
1765
|
function checkRecursiveUpdates(seen, fn) {
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
}
|
|
2162
|
-
function watchSyncEffect(effect2, options) {
|
|
2163
|
-
return doWatch(
|
|
2164
|
-
effect2,
|
|
2165
|
-
null,
|
|
2166
|
-
!!(process.env.NODE_ENV !== "production") ? extend({}, options, { flush: "sync" }) : { flush: "sync" }
|
|
2167
|
-
);
|
|
1766
|
+
const count = seen.get(fn) || 0;
|
|
1767
|
+
if (count > RECURSION_LIMIT) {
|
|
1768
|
+
handleError("Maximum recursive updates exceeded. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.", null, ErrorCodes.APP_ERROR_HANDLER);
|
|
1769
|
+
return true;
|
|
1770
|
+
}
|
|
1771
|
+
seen.set(fn, count + 1);
|
|
1772
|
+
return false;
|
|
1773
|
+
}
|
|
1774
|
+
//#endregion
|
|
1775
|
+
//#region src/apiWatch.ts
|
|
1776
|
+
function watchEffect(effect, options) {
|
|
1777
|
+
return doWatch(effect, null, options);
|
|
1778
|
+
}
|
|
1779
|
+
function watchSyncEffect(effect, options) {
|
|
1780
|
+
return doWatch(effect, null, !!(process.env.NODE_ENV !== "production") ? extend({}, options, { flush: "sync" }) : { flush: "sync" });
|
|
2168
1781
|
}
|
|
2169
1782
|
function watch(source, cb, options) {
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
`\`watch(fn, options?)\` signature has been moved to a separate API. Use \`watchEffect(fn, options?)\` instead. \`watch\` now only supports \`watch(source, cb, options?) signature.`
|
|
2173
|
-
);
|
|
2174
|
-
}
|
|
2175
|
-
return doWatch(source, cb, options);
|
|
1783
|
+
if (!!(process.env.NODE_ENV !== "production") && !isFunction(cb)) warn("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature.");
|
|
1784
|
+
return doWatch(source, cb, options);
|
|
2176
1785
|
}
|
|
2177
1786
|
function doWatch(source, cb, options = EMPTY_OBJ) {
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
} else {
|
|
2206
|
-
queueJob(job);
|
|
2207
|
-
}
|
|
2208
|
-
};
|
|
2209
|
-
}
|
|
2210
|
-
baseWatchOptions.augmentJob = (job) => {
|
|
2211
|
-
if (cb) {
|
|
2212
|
-
job.flags |= SchedulerJobFlags.ALLOW_RECURSE;
|
|
2213
|
-
}
|
|
2214
|
-
if (isPre) {
|
|
2215
|
-
job.flags |= SchedulerJobFlags.PRE;
|
|
2216
|
-
}
|
|
2217
|
-
};
|
|
2218
|
-
const watchHandle = watch$1(source, cb, baseWatchOptions);
|
|
2219
|
-
return watchHandle;
|
|
2220
|
-
}
|
|
2221
|
-
export {
|
|
2222
|
-
ARRAY_ITERATE_KEY,
|
|
2223
|
-
EffectFlags,
|
|
2224
|
-
EffectScope,
|
|
2225
|
-
ITERATE_KEY,
|
|
2226
|
-
MAP_KEY_ITERATE_KEY,
|
|
2227
|
-
ReactiveEffect,
|
|
2228
|
-
ReactiveFlags,
|
|
2229
|
-
TrackOpTypes,
|
|
2230
|
-
TriggerOpTypes,
|
|
2231
|
-
WatchErrorCodes,
|
|
2232
|
-
computed,
|
|
2233
|
-
customRef,
|
|
2234
|
-
effect,
|
|
2235
|
-
effectScope,
|
|
2236
|
-
enableTracking,
|
|
2237
|
-
getCurrentScope,
|
|
2238
|
-
getCurrentWatcher,
|
|
2239
|
-
isProxy,
|
|
2240
|
-
isReactive,
|
|
2241
|
-
isReadonly,
|
|
2242
|
-
isRef,
|
|
2243
|
-
isShallow,
|
|
2244
|
-
markRaw,
|
|
2245
|
-
nextTick,
|
|
2246
|
-
onEffectCleanup,
|
|
2247
|
-
onScopeDispose,
|
|
2248
|
-
onWatcherCleanup,
|
|
2249
|
-
pauseTracking,
|
|
2250
|
-
proxyRefs,
|
|
2251
|
-
reactive,
|
|
2252
|
-
reactiveReadArray,
|
|
2253
|
-
readonly,
|
|
2254
|
-
ref,
|
|
2255
|
-
resetTracking,
|
|
2256
|
-
shallowReactive,
|
|
2257
|
-
shallowReadArray,
|
|
2258
|
-
shallowReadonly,
|
|
2259
|
-
shallowRef,
|
|
2260
|
-
stop,
|
|
2261
|
-
toRaw,
|
|
2262
|
-
toReactive,
|
|
2263
|
-
toReadonly,
|
|
2264
|
-
toRef,
|
|
2265
|
-
toRefs,
|
|
2266
|
-
toValue,
|
|
2267
|
-
track,
|
|
2268
|
-
traverse,
|
|
2269
|
-
trigger,
|
|
2270
|
-
triggerRef,
|
|
2271
|
-
unref,
|
|
2272
|
-
watch,
|
|
2273
|
-
watchEffect,
|
|
2274
|
-
watchSyncEffect
|
|
2275
|
-
};
|
|
2276
|
-
//# sourceMappingURL=index.js.map
|
|
1787
|
+
const { immediate, deep, flush, once } = options;
|
|
1788
|
+
if (!!(process.env.NODE_ENV !== "production") && !cb) {
|
|
1789
|
+
if (immediate !== void 0) warn("watch() \"immediate\" option is only respected when using the watch(source, callback, options?) signature.");
|
|
1790
|
+
if (deep !== void 0) warn("watch() \"deep\" option is only respected when using the watch(source, callback, options?) signature.");
|
|
1791
|
+
if (once !== void 0) warn("watch() \"once\" option is only respected when using the watch(source, callback, options?) signature.");
|
|
1792
|
+
}
|
|
1793
|
+
const baseWatchOptions = extend({}, options);
|
|
1794
|
+
if (!!(process.env.NODE_ENV !== "production")) baseWatchOptions.onWarn = warn;
|
|
1795
|
+
baseWatchOptions.call = (fn, type, args) => callWithAsyncErrorHandling(fn, null, type, args);
|
|
1796
|
+
let isPre = false;
|
|
1797
|
+
if (flush !== "sync") {
|
|
1798
|
+
isPre = true;
|
|
1799
|
+
baseWatchOptions.scheduler = (job, isFirstRun) => {
|
|
1800
|
+
if (isFirstRun) job();
|
|
1801
|
+
else queueJob(job);
|
|
1802
|
+
};
|
|
1803
|
+
}
|
|
1804
|
+
baseWatchOptions.augmentJob = (job) => {
|
|
1805
|
+
if (cb) job.flags |= SchedulerJobFlags.ALLOW_RECURSE;
|
|
1806
|
+
if (isPre) job.flags |= SchedulerJobFlags.PRE;
|
|
1807
|
+
};
|
|
1808
|
+
return watch$1(source, cb, baseWatchOptions);
|
|
1809
|
+
}
|
|
1810
|
+
//#endregion
|
|
1811
|
+
export { ARRAY_ITERATE_KEY, EffectFlags, EffectScope, ITERATE_KEY, MAP_KEY_ITERATE_KEY, ReactiveEffect, ReactiveFlags, TrackOpTypes, TriggerOpTypes, WatchErrorCodes, computed, customRef, effect, effectScope, enableTracking, getCurrentScope, getCurrentWatcher, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, nextTick, onEffectCleanup, onScopeDispose, onWatcherCleanup, pauseTracking, proxyRefs, reactive, reactiveReadArray, readonly, ref, resetTracking, shallowReactive, shallowReadArray, shallowReadonly, shallowRef, stop, toRaw, toReactive, toReadonly, toRef, toRefs, toValue, track, traverse, trigger, triggerRef, unref, watch, watchEffect, watchSyncEffect };
|
|
1812
|
+
|
|
1813
|
+
//# sourceMappingURL=index.js.map
|