@dcloudio/uni-cli-shared 3.0.0-alpha-4070720250804001 → 3.0.0-alpha-4070620250731002

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.
Files changed (163) hide show
  1. package/dist/easycom.d.ts +0 -1
  2. package/dist/easycom.js +13 -17
  3. package/dist/hbx/alias.js +10 -43
  4. package/dist/hbx/index.js +0 -10
  5. package/dist/hbx/log.js +1 -23
  6. package/dist/index.d.ts +1 -2
  7. package/dist/index.js +1 -3
  8. package/dist/json/index.d.ts +1 -1
  9. package/dist/json/index.js +1 -2
  10. package/dist/json/manifest.d.ts +0 -1
  11. package/dist/json/manifest.js +1 -11
  12. package/dist/json/mp/jsonFile.js +2 -4
  13. package/dist/json/mp/pages.js +0 -1
  14. package/dist/json/mp/types.d.ts +1 -4
  15. package/dist/json/uni-x/manifest.d.ts +0 -1
  16. package/dist/json/uni-x/manifest.js +1 -5
  17. package/dist/messages/zh_CN.js +0 -1
  18. package/dist/uni_modules.cloud.d.ts +4 -10
  19. package/dist/uni_modules.cloud.js +19 -58
  20. package/dist/uni_modules.d.ts +0 -2
  21. package/dist/uni_modules.js +2 -81
  22. package/dist/uts.js +0 -16
  23. package/dist/vite/autoImport.js +0 -2
  24. package/dist/vite/cloud.js +5 -51
  25. package/dist/vite/plugins/index.d.ts +0 -1
  26. package/dist/vite/plugins/index.js +1 -3
  27. package/dist/vite/plugins/inject.js +1 -3
  28. package/dist/vite/plugins/uts/uni_modules.d.ts +0 -1
  29. package/dist/vite/plugins/uts/uni_modules.js +14 -63
  30. package/dist/vite/plugins/uts/uvue.js +3 -17
  31. package/dist/vite/plugins/vitejs/plugins/css.js +5 -40
  32. package/dist/vue/transforms/transformUTSComponent.js +3 -8
  33. package/package.json +38 -38
  34. package/dist/vite/plugins/stats.d.ts +0 -2
  35. package/dist/vite/plugins/stats.js +0 -42
  36. package/dist/workers.d.ts +0 -14
  37. package/dist/workers.js +0 -187
  38. package/lib/vapor/@vitejs/plugin-vue/LICENSE +0 -21
  39. package/lib/vapor/@vitejs/plugin-vue/README.md +0 -278
  40. package/lib/vapor/@vitejs/plugin-vue/dist/index.cjs +0 -3105
  41. package/lib/vapor/@vitejs/plugin-vue/dist/index.d.cts +0 -113
  42. package/lib/vapor/@vitejs/plugin-vue/dist/index.d.mts +0 -111
  43. package/lib/vapor/@vitejs/plugin-vue/dist/index.d.ts +0 -113
  44. package/lib/vapor/@vitejs/plugin-vue/dist/index.mjs +0 -3090
  45. package/lib/vapor/@vitejs/plugin-vue/package.json +0 -50
  46. package/lib/vapor/@vue/compiler-core/LICENSE +0 -21
  47. package/lib/vapor/@vue/compiler-core/README.md +0 -1
  48. package/lib/vapor/@vue/compiler-core/dist/compiler-core.cjs.js +0 -6902
  49. package/lib/vapor/@vue/compiler-core/dist/compiler-core.cjs.prod.js +0 -6779
  50. package/lib/vapor/@vue/compiler-core/dist/compiler-core.esm-bundler.js +0 -5870
  51. package/lib/vapor/@vue/compiler-core/index.js +0 -7
  52. package/lib/vapor/@vue/compiler-core/package.json +0 -58
  53. package/lib/vapor/@vue/compiler-dom/LICENSE +0 -21
  54. package/lib/vapor/@vue/compiler-dom/README.md +0 -1
  55. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.cjs.js +0 -936
  56. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +0 -856
  57. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.esm-browser.js +0 -6682
  58. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.esm-browser.prod.js +0 -14
  59. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.esm-bundler.js +0 -693
  60. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.global.js +0 -6855
  61. package/lib/vapor/@vue/compiler-dom/dist/compiler-dom.global.prod.js +0 -14
  62. package/lib/vapor/@vue/compiler-dom/index.js +0 -7
  63. package/lib/vapor/@vue/compiler-dom/package.json +0 -57
  64. package/lib/vapor/@vue/compiler-sfc/LICENSE +0 -21
  65. package/lib/vapor/@vue/compiler-sfc/README.md +0 -80
  66. package/lib/vapor/@vue/compiler-sfc/dist/compiler-sfc.cjs.js +0 -21682
  67. package/lib/vapor/@vue/compiler-sfc/dist/compiler-sfc.esm-browser.js +0 -66272
  68. package/lib/vapor/@vue/compiler-sfc/package.json +0 -68
  69. package/lib/vapor/@vue/compiler-ssr/LICENSE +0 -21
  70. package/lib/vapor/@vue/compiler-ssr/README.md +0 -1
  71. package/lib/vapor/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +0 -1402
  72. package/lib/vapor/@vue/compiler-ssr/package.json +0 -34
  73. package/lib/vapor/@vue/compiler-vapor/LICENSE +0 -21
  74. package/lib/vapor/@vue/compiler-vapor/README.md +0 -1
  75. package/lib/vapor/@vue/compiler-vapor/dist/compiler-vapor.cjs.js +0 -4540
  76. package/lib/vapor/@vue/compiler-vapor/dist/compiler-vapor.esm-browser.js +0 -37020
  77. package/lib/vapor/@vue/compiler-vapor/package.json +0 -49
  78. package/lib/vapor/@vue/reactivity/LICENSE +0 -21
  79. package/lib/vapor/@vue/reactivity/README.md +0 -19
  80. package/lib/vapor/@vue/reactivity/dist/reactivity.cjs.js +0 -2033
  81. package/lib/vapor/@vue/reactivity/dist/reactivity.cjs.prod.js +0 -1841
  82. package/lib/vapor/@vue/reactivity/dist/reactivity.esm-browser.js +0 -2023
  83. package/lib/vapor/@vue/reactivity/dist/reactivity.esm-browser.prod.js +0 -5
  84. package/lib/vapor/@vue/reactivity/dist/reactivity.esm-bundler.js +0 -1992
  85. package/lib/vapor/@vue/reactivity/dist/reactivity.global.js +0 -2082
  86. package/lib/vapor/@vue/reactivity/dist/reactivity.global.prod.js +0 -5
  87. package/lib/vapor/@vue/reactivity/index.js +0 -7
  88. package/lib/vapor/@vue/reactivity/package.json +0 -55
  89. package/lib/vapor/@vue/runtime-core/LICENSE +0 -21
  90. package/lib/vapor/@vue/runtime-core/README.md +0 -28
  91. package/lib/vapor/@vue/runtime-core/dist/runtime-core.cjs.js +0 -8972
  92. package/lib/vapor/@vue/runtime-core/dist/runtime-core.cjs.prod.js +0 -7088
  93. package/lib/vapor/@vue/runtime-core/dist/runtime-core.esm-bundler.js +0 -8913
  94. package/lib/vapor/@vue/runtime-core/index.js +0 -7
  95. package/lib/vapor/@vue/runtime-core/package.json +0 -54
  96. package/lib/vapor/@vue/runtime-dom/LICENSE +0 -21
  97. package/lib/vapor/@vue/runtime-dom/README.md +0 -13
  98. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.cjs.js +0 -1797
  99. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +0 -1646
  100. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.esm-browser.js +0 -12929
  101. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.esm-browser.prod.js +0 -6
  102. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js +0 -1838
  103. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.global.js +0 -13086
  104. package/lib/vapor/@vue/runtime-dom/dist/runtime-dom.global.prod.js +0 -6
  105. package/lib/vapor/@vue/runtime-dom/index.js +0 -7
  106. package/lib/vapor/@vue/runtime-dom/package.json +0 -60
  107. package/lib/vapor/@vue/runtime-vapor/LICENSE +0 -21
  108. package/lib/vapor/@vue/runtime-vapor/README.md +0 -8
  109. package/lib/vapor/@vue/runtime-vapor/dist/runtime-vapor.esm-bundler.js +0 -3242
  110. package/lib/vapor/@vue/runtime-vapor/package.json +0 -47
  111. package/lib/vapor/@vue/server-renderer/LICENSE +0 -21
  112. package/lib/vapor/@vue/server-renderer/README.md +0 -178
  113. package/lib/vapor/@vue/server-renderer/dist/server-renderer.cjs.js +0 -1144
  114. package/lib/vapor/@vue/server-renderer/dist/server-renderer.cjs.prod.js +0 -871
  115. package/lib/vapor/@vue/server-renderer/dist/server-renderer.esm-browser.js +0 -8756
  116. package/lib/vapor/@vue/server-renderer/dist/server-renderer.esm-browser.prod.js +0 -5
  117. package/lib/vapor/@vue/server-renderer/dist/server-renderer.esm-bundler.js +0 -1366
  118. package/lib/vapor/@vue/server-renderer/index.js +0 -7
  119. package/lib/vapor/@vue/server-renderer/package.json +0 -55
  120. package/lib/vapor/@vue/shared/LICENSE +0 -21
  121. package/lib/vapor/@vue/shared/README.md +0 -3
  122. package/lib/vapor/@vue/shared/dist/shared.cjs.js +0 -698
  123. package/lib/vapor/@vue/shared/dist/shared.cjs.prod.js +0 -690
  124. package/lib/vapor/@vue/shared/dist/shared.esm-bundler.js +0 -616
  125. package/lib/vapor/@vue/shared/index.js +0 -7
  126. package/lib/vapor/@vue/shared/package.json +0 -47
  127. package/lib/vapor/@vue/vue/LICENSE +0 -21
  128. package/lib/vapor/@vue/vue/README.md +0 -62
  129. package/lib/vapor/@vue/vue/compiler-sfc/index.browser.js +0 -1
  130. package/lib/vapor/@vue/vue/compiler-sfc/index.browser.mjs +0 -1
  131. package/lib/vapor/@vue/vue/compiler-sfc/index.d.mts +0 -1
  132. package/lib/vapor/@vue/vue/compiler-sfc/index.d.ts +0 -1
  133. package/lib/vapor/@vue/vue/compiler-sfc/index.js +0 -3
  134. package/lib/vapor/@vue/vue/compiler-sfc/index.mjs +0 -3
  135. package/lib/vapor/@vue/vue/compiler-sfc/package.json +0 -4
  136. package/lib/vapor/@vue/vue/compiler-sfc/register-ts.js +0 -3
  137. package/lib/vapor/@vue/vue/dist/vue.cjs.js +0 -80
  138. package/lib/vapor/@vue/vue/dist/vue.cjs.prod.js +0 -66
  139. package/lib/vapor/@vue/vue/dist/vue.esm-browser.js +0 -18840
  140. package/lib/vapor/@vue/vue/dist/vue.esm-browser.prod.js +0 -12
  141. package/lib/vapor/@vue/vue/dist/vue.esm-bundler.js +0 -72
  142. package/lib/vapor/@vue/vue/dist/vue.global.js +0 -18820
  143. package/lib/vapor/@vue/vue/dist/vue.global.prod.js +0 -12
  144. package/lib/vapor/@vue/vue/dist/vue.runtime-with-vapor.esm-browser.js +0 -15648
  145. package/lib/vapor/@vue/vue/dist/vue.runtime-with-vapor.esm-browser.prod.js +0 -9
  146. package/lib/vapor/@vue/vue/dist/vue.runtime.esm-browser.js +0 -12953
  147. package/lib/vapor/@vue/vue/dist/vue.runtime.esm-browser.prod.js +0 -6
  148. package/lib/vapor/@vue/vue/dist/vue.runtime.esm-bundler.js +0 -29
  149. package/lib/vapor/@vue/vue/dist/vue.runtime.global.js +0 -13111
  150. package/lib/vapor/@vue/vue/dist/vue.runtime.global.prod.js +0 -6
  151. package/lib/vapor/@vue/vue/index.js +0 -7
  152. package/lib/vapor/@vue/vue/index.mjs +0 -1
  153. package/lib/vapor/@vue/vue/jsx-runtime/index.d.ts +0 -25
  154. package/lib/vapor/@vue/vue/jsx-runtime/index.js +0 -15
  155. package/lib/vapor/@vue/vue/jsx-runtime/index.mjs +0 -12
  156. package/lib/vapor/@vue/vue/jsx-runtime/package.json +0 -5
  157. package/lib/vapor/@vue/vue/jsx.d.ts +0 -22
  158. package/lib/vapor/@vue/vue/package.json +0 -114
  159. package/lib/vapor/@vue/vue/server-renderer/index.d.mts +0 -1
  160. package/lib/vapor/@vue/vue/server-renderer/index.d.ts +0 -1
  161. package/lib/vapor/@vue/vue/server-renderer/index.js +0 -1
  162. package/lib/vapor/@vue/vue/server-renderer/index.mjs +0 -1
  163. package/lib/vapor/@vue/vue/server-renderer/package.json +0 -4
@@ -1,1841 +0,0 @@
1
- /**
2
- * @vue/reactivity v3.6.0-alpha.2
3
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
- * @license MIT
5
- **/
6
- 'use strict';
7
-
8
- Object.defineProperty(exports, '__esModule', { value: true });
9
-
10
- var shared = require('@vue/shared');
11
-
12
- var ReactiveFlags$1 = /* @__PURE__ */ ((ReactiveFlags2) => {
13
- ReactiveFlags2[ReactiveFlags2["None"] = 0] = "None";
14
- ReactiveFlags2[ReactiveFlags2["Mutable"] = 1] = "Mutable";
15
- ReactiveFlags2[ReactiveFlags2["Watching"] = 2] = "Watching";
16
- ReactiveFlags2[ReactiveFlags2["RecursedCheck"] = 4] = "RecursedCheck";
17
- ReactiveFlags2[ReactiveFlags2["Recursed"] = 8] = "Recursed";
18
- ReactiveFlags2[ReactiveFlags2["Dirty"] = 16] = "Dirty";
19
- ReactiveFlags2[ReactiveFlags2["Pending"] = 32] = "Pending";
20
- return ReactiveFlags2;
21
- })(ReactiveFlags$1 || {});
22
- const notifyBuffer = [];
23
- let batchDepth = 0;
24
- let activeSub = void 0;
25
- let notifyIndex = 0;
26
- let notifyBufferLength = 0;
27
- function setActiveSub(sub) {
28
- try {
29
- return activeSub;
30
- } finally {
31
- activeSub = sub;
32
- }
33
- }
34
- function startBatch() {
35
- ++batchDepth;
36
- }
37
- function endBatch() {
38
- if (!--batchDepth && notifyBufferLength) {
39
- flush();
40
- }
41
- }
42
- function link(dep, sub) {
43
- const prevDep = sub.depsTail;
44
- if (prevDep !== void 0 && prevDep.dep === dep) {
45
- return;
46
- }
47
- let nextDep = void 0;
48
- const recursedCheck = sub.flags & 4 /* RecursedCheck */;
49
- if (recursedCheck) {
50
- nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
51
- if (nextDep !== void 0 && nextDep.dep === dep) {
52
- sub.depsTail = nextDep;
53
- return;
54
- }
55
- }
56
- const prevSub = dep.subsTail;
57
- const newLink = sub.depsTail = dep.subsTail = {
58
- dep,
59
- sub,
60
- prevDep,
61
- nextDep,
62
- prevSub,
63
- nextSub: void 0
64
- };
65
- if (nextDep !== void 0) {
66
- nextDep.prevDep = newLink;
67
- }
68
- if (prevDep !== void 0) {
69
- prevDep.nextDep = newLink;
70
- } else {
71
- sub.deps = newLink;
72
- }
73
- if (prevSub !== void 0) {
74
- prevSub.nextSub = newLink;
75
- } else {
76
- dep.subs = newLink;
77
- }
78
- }
79
- function unlink(link2, sub = link2.sub) {
80
- const dep = link2.dep;
81
- const prevDep = link2.prevDep;
82
- const nextDep = link2.nextDep;
83
- const nextSub = link2.nextSub;
84
- const prevSub = link2.prevSub;
85
- if (nextDep !== void 0) {
86
- nextDep.prevDep = prevDep;
87
- } else {
88
- sub.depsTail = prevDep;
89
- }
90
- if (prevDep !== void 0) {
91
- prevDep.nextDep = nextDep;
92
- } else {
93
- sub.deps = nextDep;
94
- }
95
- if (nextSub !== void 0) {
96
- nextSub.prevSub = prevSub;
97
- } else {
98
- dep.subsTail = prevSub;
99
- }
100
- if (prevSub !== void 0) {
101
- prevSub.nextSub = nextSub;
102
- } else if ((dep.subs = nextSub) === void 0) {
103
- let toRemove = dep.deps;
104
- if (toRemove !== void 0) {
105
- do {
106
- toRemove = unlink(toRemove, dep);
107
- } while (toRemove !== void 0);
108
- dep.flags |= 16 /* Dirty */;
109
- }
110
- }
111
- return nextDep;
112
- }
113
- function propagate(link2) {
114
- let next = link2.nextSub;
115
- let stack;
116
- top: do {
117
- const sub = link2.sub;
118
- let flags = sub.flags;
119
- if (flags & (1 /* Mutable */ | 2 /* Watching */)) {
120
- if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */ | 16 /* Dirty */ | 32 /* Pending */))) {
121
- sub.flags = flags | 32 /* Pending */;
122
- } else if (!(flags & (4 /* RecursedCheck */ | 8 /* Recursed */))) {
123
- flags = 0 /* None */;
124
- } else if (!(flags & 4 /* RecursedCheck */)) {
125
- sub.flags = flags & -9 /* Recursed */ | 32 /* Pending */;
126
- } else if (!(flags & (16 /* Dirty */ | 32 /* Pending */)) && isValidLink(link2, sub)) {
127
- sub.flags = flags | 8 /* Recursed */ | 32 /* Pending */;
128
- flags &= 1 /* Mutable */;
129
- } else {
130
- flags = 0 /* None */;
131
- }
132
- if (flags & 2 /* Watching */) {
133
- notifyBuffer[notifyBufferLength++] = sub;
134
- }
135
- if (flags & 1 /* Mutable */) {
136
- const subSubs = sub.subs;
137
- if (subSubs !== void 0) {
138
- link2 = subSubs;
139
- if (subSubs.nextSub !== void 0) {
140
- stack = { value: next, prev: stack };
141
- next = link2.nextSub;
142
- }
143
- continue;
144
- }
145
- }
146
- }
147
- if ((link2 = next) !== void 0) {
148
- next = link2.nextSub;
149
- continue;
150
- }
151
- while (stack !== void 0) {
152
- link2 = stack.value;
153
- stack = stack.prev;
154
- if (link2 !== void 0) {
155
- next = link2.nextSub;
156
- continue top;
157
- }
158
- }
159
- break;
160
- } while (true);
161
- }
162
- function startTracking(sub) {
163
- sub.depsTail = void 0;
164
- sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
165
- return setActiveSub(sub);
166
- }
167
- function endTracking(sub, prevSub) {
168
- activeSub = prevSub;
169
- const depsTail = sub.depsTail;
170
- let toRemove = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
171
- while (toRemove !== void 0) {
172
- toRemove = unlink(toRemove, sub);
173
- }
174
- sub.flags &= -5 /* RecursedCheck */;
175
- }
176
- function flush() {
177
- while (notifyIndex < notifyBufferLength) {
178
- const effect = notifyBuffer[notifyIndex];
179
- notifyBuffer[notifyIndex++] = void 0;
180
- effect.notify();
181
- }
182
- notifyIndex = 0;
183
- notifyBufferLength = 0;
184
- }
185
- function checkDirty(link2, sub) {
186
- let stack;
187
- let checkDepth = 0;
188
- top: do {
189
- const dep = link2.dep;
190
- const depFlags = dep.flags;
191
- let dirty = false;
192
- if (sub.flags & 16 /* Dirty */) {
193
- dirty = true;
194
- } else if ((depFlags & (1 /* Mutable */ | 16 /* Dirty */)) === (1 /* Mutable */ | 16 /* Dirty */)) {
195
- if (dep.update()) {
196
- const subs = dep.subs;
197
- if (subs.nextSub !== void 0) {
198
- shallowPropagate(subs);
199
- }
200
- dirty = true;
201
- }
202
- } else if ((depFlags & (1 /* Mutable */ | 32 /* Pending */)) === (1 /* Mutable */ | 32 /* Pending */)) {
203
- if (link2.nextSub !== void 0 || link2.prevSub !== void 0) {
204
- stack = { value: link2, prev: stack };
205
- }
206
- link2 = dep.deps;
207
- sub = dep;
208
- ++checkDepth;
209
- continue;
210
- }
211
- if (!dirty && link2.nextDep !== void 0) {
212
- link2 = link2.nextDep;
213
- continue;
214
- }
215
- while (checkDepth) {
216
- --checkDepth;
217
- const firstSub = sub.subs;
218
- const hasMultipleSubs = firstSub.nextSub !== void 0;
219
- if (hasMultipleSubs) {
220
- link2 = stack.value;
221
- stack = stack.prev;
222
- } else {
223
- link2 = firstSub;
224
- }
225
- if (dirty) {
226
- if (sub.update()) {
227
- if (hasMultipleSubs) {
228
- shallowPropagate(firstSub);
229
- }
230
- sub = link2.sub;
231
- continue;
232
- }
233
- } else {
234
- sub.flags &= -33 /* Pending */;
235
- }
236
- sub = link2.sub;
237
- if (link2.nextDep !== void 0) {
238
- link2 = link2.nextDep;
239
- continue top;
240
- }
241
- dirty = false;
242
- }
243
- return dirty;
244
- } while (true);
245
- }
246
- function shallowPropagate(link2) {
247
- do {
248
- const sub = link2.sub;
249
- const nextSub = link2.nextSub;
250
- const subFlags = sub.flags;
251
- if ((subFlags & (32 /* Pending */ | 16 /* Dirty */)) === 32 /* Pending */) {
252
- sub.flags = subFlags | 16 /* Dirty */;
253
- }
254
- link2 = nextSub;
255
- } while (link2 !== void 0);
256
- }
257
- function isValidLink(checkLink, sub) {
258
- const depsTail = sub.depsTail;
259
- if (depsTail !== void 0) {
260
- let link2 = sub.deps;
261
- do {
262
- if (link2 === checkLink) {
263
- return true;
264
- }
265
- if (link2 === depsTail) {
266
- break;
267
- }
268
- link2 = link2.nextDep;
269
- } while (link2 !== void 0);
270
- }
271
- return false;
272
- }
273
-
274
- class Dep {
275
- constructor(map, key) {
276
- this.map = map;
277
- this.key = key;
278
- this._subs = void 0;
279
- this.subsTail = void 0;
280
- this.flags = ReactiveFlags$1.None;
281
- }
282
- get subs() {
283
- return this._subs;
284
- }
285
- set subs(value) {
286
- this._subs = value;
287
- if (value === void 0) {
288
- this.map.delete(this.key);
289
- }
290
- }
291
- }
292
- const targetMap = /* @__PURE__ */ new WeakMap();
293
- const ITERATE_KEY = Symbol(
294
- ""
295
- );
296
- const MAP_KEY_ITERATE_KEY = Symbol(
297
- ""
298
- );
299
- const ARRAY_ITERATE_KEY = Symbol(
300
- ""
301
- );
302
- function track(target, type, key) {
303
- if (activeSub !== void 0) {
304
- let depsMap = targetMap.get(target);
305
- if (!depsMap) {
306
- targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
307
- }
308
- let dep = depsMap.get(key);
309
- if (!dep) {
310
- depsMap.set(key, dep = new Dep(depsMap, key));
311
- }
312
- link(dep, activeSub);
313
- }
314
- }
315
- function trigger(target, type, key, newValue, oldValue, oldTarget) {
316
- const depsMap = targetMap.get(target);
317
- if (!depsMap) {
318
- return;
319
- }
320
- const run = (dep) => {
321
- if (dep !== void 0 && dep.subs !== void 0) {
322
- propagate(dep.subs);
323
- shallowPropagate(dep.subs);
324
- }
325
- };
326
- startBatch();
327
- if (type === "clear") {
328
- depsMap.forEach(run);
329
- } else {
330
- const targetIsArray = shared.isArray(target);
331
- const isArrayIndex = targetIsArray && shared.isIntegerKey(key);
332
- if (targetIsArray && key === "length") {
333
- const newLength = Number(newValue);
334
- depsMap.forEach((dep, key2) => {
335
- if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !shared.isSymbol(key2) && key2 >= newLength) {
336
- run(dep);
337
- }
338
- });
339
- } else {
340
- if (key !== void 0 || depsMap.has(void 0)) {
341
- run(depsMap.get(key));
342
- }
343
- if (isArrayIndex) {
344
- run(depsMap.get(ARRAY_ITERATE_KEY));
345
- }
346
- switch (type) {
347
- case "add":
348
- if (!targetIsArray) {
349
- run(depsMap.get(ITERATE_KEY));
350
- if (shared.isMap(target)) {
351
- run(depsMap.get(MAP_KEY_ITERATE_KEY));
352
- }
353
- } else if (isArrayIndex) {
354
- run(depsMap.get("length"));
355
- }
356
- break;
357
- case "delete":
358
- if (!targetIsArray) {
359
- run(depsMap.get(ITERATE_KEY));
360
- if (shared.isMap(target)) {
361
- run(depsMap.get(MAP_KEY_ITERATE_KEY));
362
- }
363
- }
364
- break;
365
- case "set":
366
- if (shared.isMap(target)) {
367
- run(depsMap.get(ITERATE_KEY));
368
- }
369
- break;
370
- }
371
- }
372
- }
373
- endBatch();
374
- }
375
- function getDepFromReactive(object, key) {
376
- const depMap = targetMap.get(object);
377
- return depMap && depMap.get(key);
378
- }
379
-
380
- function reactiveReadArray(array) {
381
- const raw = toRaw(array);
382
- if (raw === array) return raw;
383
- track(raw, "iterate", ARRAY_ITERATE_KEY);
384
- return isShallow(array) ? raw : raw.map(toReactive);
385
- }
386
- function shallowReadArray(arr) {
387
- track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
388
- return arr;
389
- }
390
- const arrayInstrumentations = {
391
- __proto__: null,
392
- [Symbol.iterator]() {
393
- return iterator(this, Symbol.iterator, toReactive);
394
- },
395
- concat(...args) {
396
- return reactiveReadArray(this).concat(
397
- ...args.map((x) => shared.isArray(x) ? reactiveReadArray(x) : x)
398
- );
399
- },
400
- entries() {
401
- return iterator(this, "entries", (value) => {
402
- value[1] = toReactive(value[1]);
403
- return value;
404
- });
405
- },
406
- every(fn, thisArg) {
407
- return apply(this, "every", fn, thisArg, void 0, arguments);
408
- },
409
- filter(fn, thisArg) {
410
- return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
411
- },
412
- find(fn, thisArg) {
413
- return apply(this, "find", fn, thisArg, toReactive, arguments);
414
- },
415
- findIndex(fn, thisArg) {
416
- return apply(this, "findIndex", fn, thisArg, void 0, arguments);
417
- },
418
- findLast(fn, thisArg) {
419
- return apply(this, "findLast", fn, thisArg, toReactive, arguments);
420
- },
421
- findLastIndex(fn, thisArg) {
422
- return apply(this, "findLastIndex", fn, thisArg, void 0, arguments);
423
- },
424
- // flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
425
- forEach(fn, thisArg) {
426
- return apply(this, "forEach", fn, thisArg, void 0, arguments);
427
- },
428
- includes(...args) {
429
- return searchProxy(this, "includes", args);
430
- },
431
- indexOf(...args) {
432
- return searchProxy(this, "indexOf", args);
433
- },
434
- join(separator) {
435
- return reactiveReadArray(this).join(separator);
436
- },
437
- // keys() iterator only reads `length`, no optimisation required
438
- lastIndexOf(...args) {
439
- return searchProxy(this, "lastIndexOf", args);
440
- },
441
- map(fn, thisArg) {
442
- return apply(this, "map", fn, thisArg, void 0, arguments);
443
- },
444
- pop() {
445
- return noTracking(this, "pop");
446
- },
447
- push(...args) {
448
- return noTracking(this, "push", args);
449
- },
450
- reduce(fn, ...args) {
451
- return reduce(this, "reduce", fn, args);
452
- },
453
- reduceRight(fn, ...args) {
454
- return reduce(this, "reduceRight", fn, args);
455
- },
456
- shift() {
457
- return noTracking(this, "shift");
458
- },
459
- // slice could use ARRAY_ITERATE but also seems to beg for range tracking
460
- some(fn, thisArg) {
461
- return apply(this, "some", fn, thisArg, void 0, arguments);
462
- },
463
- splice(...args) {
464
- return noTracking(this, "splice", args);
465
- },
466
- toReversed() {
467
- return reactiveReadArray(this).toReversed();
468
- },
469
- toSorted(comparer) {
470
- return reactiveReadArray(this).toSorted(comparer);
471
- },
472
- toSpliced(...args) {
473
- return reactiveReadArray(this).toSpliced(...args);
474
- },
475
- unshift(...args) {
476
- return noTracking(this, "unshift", args);
477
- },
478
- values() {
479
- return iterator(this, "values", toReactive);
480
- }
481
- };
482
- function iterator(self, method, wrapValue) {
483
- const arr = shallowReadArray(self);
484
- const iter = arr[method]();
485
- if (arr !== self && !isShallow(self)) {
486
- iter._next = iter.next;
487
- iter.next = () => {
488
- const result = iter._next();
489
- if (result.value) {
490
- result.value = wrapValue(result.value);
491
- }
492
- return result;
493
- };
494
- }
495
- return iter;
496
- }
497
- const arrayProto = Array.prototype;
498
- function apply(self, method, fn, thisArg, wrappedRetFn, args) {
499
- const arr = shallowReadArray(self);
500
- const needsWrap = arr !== self && !isShallow(self);
501
- const methodFn = arr[method];
502
- if (methodFn !== arrayProto[method]) {
503
- const result2 = methodFn.apply(self, args);
504
- return needsWrap ? toReactive(result2) : result2;
505
- }
506
- let wrappedFn = fn;
507
- if (arr !== self) {
508
- if (needsWrap) {
509
- wrappedFn = function(item, index) {
510
- return fn.call(this, toReactive(item), index, self);
511
- };
512
- } else if (fn.length > 2) {
513
- wrappedFn = function(item, index) {
514
- return fn.call(this, item, index, self);
515
- };
516
- }
517
- }
518
- const result = methodFn.call(arr, wrappedFn, thisArg);
519
- return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
520
- }
521
- function reduce(self, method, fn, args) {
522
- const arr = shallowReadArray(self);
523
- let wrappedFn = fn;
524
- if (arr !== self) {
525
- if (!isShallow(self)) {
526
- wrappedFn = function(acc, item, index) {
527
- return fn.call(this, acc, toReactive(item), index, self);
528
- };
529
- } else if (fn.length > 3) {
530
- wrappedFn = function(acc, item, index) {
531
- return fn.call(this, acc, item, index, self);
532
- };
533
- }
534
- }
535
- return arr[method](wrappedFn, ...args);
536
- }
537
- function searchProxy(self, method, args) {
538
- const arr = toRaw(self);
539
- track(arr, "iterate", ARRAY_ITERATE_KEY);
540
- const res = arr[method](...args);
541
- if ((res === -1 || res === false) && isProxy(args[0])) {
542
- args[0] = toRaw(args[0]);
543
- return arr[method](...args);
544
- }
545
- return res;
546
- }
547
- function noTracking(self, method, args = []) {
548
- startBatch();
549
- const prevSub = setActiveSub();
550
- const res = toRaw(self)[method].apply(self, args);
551
- setActiveSub(prevSub);
552
- endBatch();
553
- return res;
554
- }
555
-
556
- const isNonTrackableKeys = /* @__PURE__ */ shared.makeMap(`__proto__,__v_isRef,__isVue`);
557
- const builtInSymbols = new Set(
558
- /* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(shared.isSymbol)
559
- );
560
- function hasOwnProperty(key) {
561
- if (!shared.isSymbol(key)) key = String(key);
562
- const obj = toRaw(this);
563
- track(obj, "has", key);
564
- return obj.hasOwnProperty(key);
565
- }
566
- class BaseReactiveHandler {
567
- constructor(_isReadonly = false, _isShallow = false) {
568
- this._isReadonly = _isReadonly;
569
- this._isShallow = _isShallow;
570
- }
571
- get(target, key, receiver) {
572
- if (key === "__v_skip") return target["__v_skip"];
573
- const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
574
- if (key === "__v_isReactive") {
575
- return !isReadonly2;
576
- } else if (key === "__v_isReadonly") {
577
- return isReadonly2;
578
- } else if (key === "__v_isShallow") {
579
- return isShallow2;
580
- } else if (key === "__v_raw") {
581
- if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || // receiver is not the reactive proxy, but has the same prototype
582
- // this means the receiver is a user proxy of the reactive proxy
583
- Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
584
- return target;
585
- }
586
- return;
587
- }
588
- const targetIsArray = shared.isArray(target);
589
- if (!isReadonly2) {
590
- let fn;
591
- if (targetIsArray && (fn = arrayInstrumentations[key])) {
592
- return fn;
593
- }
594
- if (key === "hasOwnProperty") {
595
- return hasOwnProperty;
596
- }
597
- }
598
- const wasRef = isRef(target);
599
- const res = Reflect.get(
600
- target,
601
- key,
602
- // if this is a proxy wrapping a ref, return methods using the raw ref
603
- // as receiver so that we don't have to call `toRaw` on the ref in all
604
- // its class methods
605
- wasRef ? target : receiver
606
- );
607
- if (wasRef && key !== "value") {
608
- return res;
609
- }
610
- if (shared.isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
611
- return res;
612
- }
613
- if (!isReadonly2) {
614
- track(target, "get", key);
615
- }
616
- if (isShallow2) {
617
- return res;
618
- }
619
- if (isRef(res)) {
620
- return targetIsArray && shared.isIntegerKey(key) ? res : res.value;
621
- }
622
- if (shared.isObject(res)) {
623
- return isReadonly2 ? readonly(res) : reactive(res);
624
- }
625
- return res;
626
- }
627
- }
628
- class MutableReactiveHandler extends BaseReactiveHandler {
629
- constructor(isShallow2 = false) {
630
- super(false, isShallow2);
631
- }
632
- set(target, key, value, receiver) {
633
- let oldValue = target[key];
634
- if (!this._isShallow) {
635
- const isOldValueReadonly = isReadonly(oldValue);
636
- if (!isShallow(value) && !isReadonly(value)) {
637
- oldValue = toRaw(oldValue);
638
- value = toRaw(value);
639
- }
640
- if (!shared.isArray(target) && isRef(oldValue) && !isRef(value)) {
641
- if (isOldValueReadonly) {
642
- return false;
643
- } else {
644
- oldValue.value = value;
645
- return true;
646
- }
647
- }
648
- }
649
- const hadKey = shared.isArray(target) && shared.isIntegerKey(key) ? Number(key) < target.length : shared.hasOwn(target, key);
650
- const result = Reflect.set(
651
- target,
652
- key,
653
- value,
654
- isRef(target) ? target : receiver
655
- );
656
- if (target === toRaw(receiver)) {
657
- if (!hadKey) {
658
- trigger(target, "add", key, value);
659
- } else if (shared.hasChanged(value, oldValue)) {
660
- trigger(target, "set", key, value);
661
- }
662
- }
663
- return result;
664
- }
665
- deleteProperty(target, key) {
666
- const hadKey = shared.hasOwn(target, key);
667
- target[key];
668
- const result = Reflect.deleteProperty(target, key);
669
- if (result && hadKey) {
670
- trigger(target, "delete", key, void 0);
671
- }
672
- return result;
673
- }
674
- has(target, key) {
675
- const result = Reflect.has(target, key);
676
- if (!shared.isSymbol(key) || !builtInSymbols.has(key)) {
677
- track(target, "has", key);
678
- }
679
- return result;
680
- }
681
- ownKeys(target) {
682
- track(
683
- target,
684
- "iterate",
685
- shared.isArray(target) ? "length" : ITERATE_KEY
686
- );
687
- return Reflect.ownKeys(target);
688
- }
689
- }
690
- class ReadonlyReactiveHandler extends BaseReactiveHandler {
691
- constructor(isShallow2 = false) {
692
- super(true, isShallow2);
693
- }
694
- set(target, key) {
695
- return true;
696
- }
697
- deleteProperty(target, key) {
698
- return true;
699
- }
700
- }
701
- const mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler();
702
- const readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler();
703
- const shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
704
- const shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
705
-
706
- const toShallow = (value) => value;
707
- const getProto = (v) => Reflect.getPrototypeOf(v);
708
- function createIterableMethod(method, isReadonly2, isShallow2) {
709
- return function(...args) {
710
- const target = this["__v_raw"];
711
- const rawTarget = toRaw(target);
712
- const targetIsMap = shared.isMap(rawTarget);
713
- const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
714
- const isKeyOnly = method === "keys" && targetIsMap;
715
- const innerIterator = target[method](...args);
716
- const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
717
- !isReadonly2 && track(
718
- rawTarget,
719
- "iterate",
720
- isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY
721
- );
722
- return {
723
- // iterator protocol
724
- next() {
725
- const { value, done } = innerIterator.next();
726
- return done ? { value, done } : {
727
- value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
728
- done
729
- };
730
- },
731
- // iterable protocol
732
- [Symbol.iterator]() {
733
- return this;
734
- }
735
- };
736
- };
737
- }
738
- function createReadonlyMethod(type) {
739
- return function(...args) {
740
- return type === "delete" ? false : type === "clear" ? void 0 : this;
741
- };
742
- }
743
- function createInstrumentations(readonly, shallow) {
744
- const instrumentations = {
745
- get(key) {
746
- const target = this["__v_raw"];
747
- const rawTarget = toRaw(target);
748
- const rawKey = toRaw(key);
749
- if (!readonly) {
750
- if (shared.hasChanged(key, rawKey)) {
751
- track(rawTarget, "get", key);
752
- }
753
- track(rawTarget, "get", rawKey);
754
- }
755
- const { has } = getProto(rawTarget);
756
- const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
757
- if (has.call(rawTarget, key)) {
758
- return wrap(target.get(key));
759
- } else if (has.call(rawTarget, rawKey)) {
760
- return wrap(target.get(rawKey));
761
- } else if (target !== rawTarget) {
762
- target.get(key);
763
- }
764
- },
765
- get size() {
766
- const target = this["__v_raw"];
767
- !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
768
- return Reflect.get(target, "size", target);
769
- },
770
- has(key) {
771
- const target = this["__v_raw"];
772
- const rawTarget = toRaw(target);
773
- const rawKey = toRaw(key);
774
- if (!readonly) {
775
- if (shared.hasChanged(key, rawKey)) {
776
- track(rawTarget, "has", key);
777
- }
778
- track(rawTarget, "has", rawKey);
779
- }
780
- return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
781
- },
782
- forEach(callback, thisArg) {
783
- const observed = this;
784
- const target = observed["__v_raw"];
785
- const rawTarget = toRaw(target);
786
- const wrap = shallow ? toShallow : readonly ? toReadonly : toReactive;
787
- !readonly && track(rawTarget, "iterate", ITERATE_KEY);
788
- return target.forEach((value, key) => {
789
- return callback.call(thisArg, wrap(value), wrap(key), observed);
790
- });
791
- }
792
- };
793
- shared.extend(
794
- instrumentations,
795
- readonly ? {
796
- add: createReadonlyMethod("add"),
797
- set: createReadonlyMethod("set"),
798
- delete: createReadonlyMethod("delete"),
799
- clear: createReadonlyMethod("clear")
800
- } : {
801
- add(value) {
802
- if (!shallow && !isShallow(value) && !isReadonly(value)) {
803
- value = toRaw(value);
804
- }
805
- const target = toRaw(this);
806
- const proto = getProto(target);
807
- const hadKey = proto.has.call(target, value);
808
- if (!hadKey) {
809
- target.add(value);
810
- trigger(target, "add", value, value);
811
- }
812
- return this;
813
- },
814
- set(key, value) {
815
- if (!shallow && !isShallow(value) && !isReadonly(value)) {
816
- value = toRaw(value);
817
- }
818
- const target = toRaw(this);
819
- const { has, get } = getProto(target);
820
- let hadKey = has.call(target, key);
821
- if (!hadKey) {
822
- key = toRaw(key);
823
- hadKey = has.call(target, key);
824
- }
825
- const oldValue = get.call(target, key);
826
- target.set(key, value);
827
- if (!hadKey) {
828
- trigger(target, "add", key, value);
829
- } else if (shared.hasChanged(value, oldValue)) {
830
- trigger(target, "set", key, value);
831
- }
832
- return this;
833
- },
834
- delete(key) {
835
- const target = toRaw(this);
836
- const { has, get } = getProto(target);
837
- let hadKey = has.call(target, key);
838
- if (!hadKey) {
839
- key = toRaw(key);
840
- hadKey = has.call(target, key);
841
- }
842
- get ? get.call(target, key) : void 0;
843
- const result = target.delete(key);
844
- if (hadKey) {
845
- trigger(target, "delete", key, void 0);
846
- }
847
- return result;
848
- },
849
- clear() {
850
- const target = toRaw(this);
851
- const hadItems = target.size !== 0;
852
- const result = target.clear();
853
- if (hadItems) {
854
- trigger(
855
- target,
856
- "clear",
857
- void 0,
858
- void 0);
859
- }
860
- return result;
861
- }
862
- }
863
- );
864
- const iteratorMethods = [
865
- "keys",
866
- "values",
867
- "entries",
868
- Symbol.iterator
869
- ];
870
- iteratorMethods.forEach((method) => {
871
- instrumentations[method] = createIterableMethod(method, readonly, shallow);
872
- });
873
- return instrumentations;
874
- }
875
- function createInstrumentationGetter(isReadonly2, shallow) {
876
- const instrumentations = createInstrumentations(isReadonly2, shallow);
877
- return (target, key, receiver) => {
878
- if (key === "__v_isReactive") {
879
- return !isReadonly2;
880
- } else if (key === "__v_isReadonly") {
881
- return isReadonly2;
882
- } else if (key === "__v_raw") {
883
- return target;
884
- }
885
- return Reflect.get(
886
- shared.hasOwn(instrumentations, key) && key in target ? instrumentations : target,
887
- key,
888
- receiver
889
- );
890
- };
891
- }
892
- const mutableCollectionHandlers = {
893
- get: /* @__PURE__ */ createInstrumentationGetter(false, false)
894
- };
895
- const shallowCollectionHandlers = {
896
- get: /* @__PURE__ */ createInstrumentationGetter(false, true)
897
- };
898
- const readonlyCollectionHandlers = {
899
- get: /* @__PURE__ */ createInstrumentationGetter(true, false)
900
- };
901
- const shallowReadonlyCollectionHandlers = {
902
- get: /* @__PURE__ */ createInstrumentationGetter(true, true)
903
- };
904
-
905
- const reactiveMap = /* @__PURE__ */ new WeakMap();
906
- const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
907
- const readonlyMap = /* @__PURE__ */ new WeakMap();
908
- const shallowReadonlyMap = /* @__PURE__ */ new WeakMap();
909
- function targetTypeMap(rawType) {
910
- switch (rawType) {
911
- case "Object":
912
- case "Array":
913
- return 1 /* COMMON */;
914
- case "Map":
915
- case "Set":
916
- case "WeakMap":
917
- case "WeakSet":
918
- return 2 /* COLLECTION */;
919
- default:
920
- return 0 /* INVALID */;
921
- }
922
- }
923
- function getTargetType(value) {
924
- return value["__v_skip"] || !Object.isExtensible(value) ? 0 /* INVALID */ : targetTypeMap(shared.toRawType(value));
925
- }
926
- function reactive(target) {
927
- if (isReadonly(target)) {
928
- return target;
929
- }
930
- return createReactiveObject(
931
- target,
932
- false,
933
- mutableHandlers,
934
- mutableCollectionHandlers,
935
- reactiveMap
936
- );
937
- }
938
- function shallowReactive(target) {
939
- return createReactiveObject(
940
- target,
941
- false,
942
- shallowReactiveHandlers,
943
- shallowCollectionHandlers,
944
- shallowReactiveMap
945
- );
946
- }
947
- function readonly(target) {
948
- return createReactiveObject(
949
- target,
950
- true,
951
- readonlyHandlers,
952
- readonlyCollectionHandlers,
953
- readonlyMap
954
- );
955
- }
956
- function shallowReadonly(target) {
957
- return createReactiveObject(
958
- target,
959
- true,
960
- shallowReadonlyHandlers,
961
- shallowReadonlyCollectionHandlers,
962
- shallowReadonlyMap
963
- );
964
- }
965
- function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
966
- if (!shared.isObject(target)) {
967
- return target;
968
- }
969
- if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
970
- return target;
971
- }
972
- const targetType = getTargetType(target);
973
- if (targetType === 0 /* INVALID */) {
974
- return target;
975
- }
976
- const existingProxy = proxyMap.get(target);
977
- if (existingProxy) {
978
- return existingProxy;
979
- }
980
- const proxy = new Proxy(
981
- target,
982
- targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers
983
- );
984
- proxyMap.set(target, proxy);
985
- return proxy;
986
- }
987
- function isReactive(value) {
988
- if (isReadonly(value)) {
989
- return isReactive(value["__v_raw"]);
990
- }
991
- return !!(value && value["__v_isReactive"]);
992
- }
993
- function isReadonly(value) {
994
- return !!(value && value["__v_isReadonly"]);
995
- }
996
- function isShallow(value) {
997
- return !!(value && value["__v_isShallow"]);
998
- }
999
- function isProxy(value) {
1000
- return value ? !!value["__v_raw"] : false;
1001
- }
1002
- function toRaw(observed) {
1003
- const raw = observed && observed["__v_raw"];
1004
- return raw ? toRaw(raw) : observed;
1005
- }
1006
- function markRaw(value) {
1007
- if (!shared.hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
1008
- shared.def(value, "__v_skip", true);
1009
- }
1010
- return value;
1011
- }
1012
- const toReactive = (value) => shared.isObject(value) ? reactive(value) : value;
1013
- const toReadonly = (value) => shared.isObject(value) ? readonly(value) : value;
1014
-
1015
- function isRef(r) {
1016
- return r ? r["__v_isRef"] === true : false;
1017
- }
1018
- function ref(value) {
1019
- return createRef(value, toReactive);
1020
- }
1021
- function shallowRef(value) {
1022
- return createRef(value);
1023
- }
1024
- function createRef(rawValue, wrap) {
1025
- if (isRef(rawValue)) {
1026
- return rawValue;
1027
- }
1028
- return new RefImpl(rawValue, wrap);
1029
- }
1030
- class RefImpl {
1031
- // TODO isolatedDeclarations "__v_isShallow"
1032
- constructor(value, wrap) {
1033
- this.subs = void 0;
1034
- this.subsTail = void 0;
1035
- this.flags = ReactiveFlags$1.Mutable;
1036
- /**
1037
- * @internal
1038
- */
1039
- this.__v_isRef = true;
1040
- // TODO isolatedDeclarations "__v_isRef"
1041
- /**
1042
- * @internal
1043
- */
1044
- this.__v_isShallow = false;
1045
- this._oldValue = this._rawValue = wrap ? toRaw(value) : value;
1046
- this._value = wrap ? wrap(value) : value;
1047
- this._wrap = wrap;
1048
- this["__v_isShallow"] = !wrap;
1049
- }
1050
- get dep() {
1051
- return this;
1052
- }
1053
- get value() {
1054
- trackRef(this);
1055
- if (this.flags & ReactiveFlags$1.Dirty && this.update()) {
1056
- const subs = this.subs;
1057
- if (subs !== void 0) {
1058
- shallowPropagate(subs);
1059
- }
1060
- }
1061
- return this._value;
1062
- }
1063
- set value(newValue) {
1064
- const oldValue = this._rawValue;
1065
- const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
1066
- newValue = useDirectValue ? newValue : toRaw(newValue);
1067
- if (shared.hasChanged(newValue, oldValue)) {
1068
- this.flags |= ReactiveFlags$1.Dirty;
1069
- this._rawValue = newValue;
1070
- this._value = !useDirectValue && this._wrap ? this._wrap(newValue) : newValue;
1071
- const subs = this.subs;
1072
- if (subs !== void 0) {
1073
- propagate(subs);
1074
- if (!batchDepth) {
1075
- flush();
1076
- }
1077
- }
1078
- }
1079
- }
1080
- update() {
1081
- this.flags &= ~ReactiveFlags$1.Dirty;
1082
- return shared.hasChanged(this._oldValue, this._oldValue = this._rawValue);
1083
- }
1084
- }
1085
- function triggerRef(ref2) {
1086
- const dep = ref2.dep;
1087
- if (dep !== void 0 && dep.subs !== void 0) {
1088
- propagate(dep.subs);
1089
- shallowPropagate(dep.subs);
1090
- if (!batchDepth) {
1091
- flush();
1092
- }
1093
- }
1094
- }
1095
- function trackRef(dep) {
1096
- if (activeSub !== void 0) {
1097
- link(dep, activeSub);
1098
- }
1099
- }
1100
- function unref(ref2) {
1101
- return isRef(ref2) ? ref2.value : ref2;
1102
- }
1103
- function toValue(source) {
1104
- return shared.isFunction(source) ? source() : unref(source);
1105
- }
1106
- const shallowUnwrapHandlers = {
1107
- get: (target, key, receiver) => key === "__v_raw" ? target : unref(Reflect.get(target, key, receiver)),
1108
- set: (target, key, value, receiver) => {
1109
- const oldValue = target[key];
1110
- if (isRef(oldValue) && !isRef(value)) {
1111
- oldValue.value = value;
1112
- return true;
1113
- } else {
1114
- return Reflect.set(target, key, value, receiver);
1115
- }
1116
- }
1117
- };
1118
- function proxyRefs(objectWithRefs) {
1119
- return isReactive(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
1120
- }
1121
- class CustomRefImpl {
1122
- constructor(factory) {
1123
- this.subs = void 0;
1124
- this.subsTail = void 0;
1125
- this.flags = ReactiveFlags$1.None;
1126
- this["__v_isRef"] = true;
1127
- this._value = void 0;
1128
- const { get, set } = factory(
1129
- () => trackRef(this),
1130
- () => triggerRef(this)
1131
- );
1132
- this._get = get;
1133
- this._set = set;
1134
- }
1135
- get dep() {
1136
- return this;
1137
- }
1138
- get value() {
1139
- return this._value = this._get();
1140
- }
1141
- set value(newVal) {
1142
- this._set(newVal);
1143
- }
1144
- }
1145
- function customRef(factory) {
1146
- return new CustomRefImpl(factory);
1147
- }
1148
- function toRefs(object) {
1149
- const ret = shared.isArray(object) ? new Array(object.length) : {};
1150
- for (const key in object) {
1151
- ret[key] = propertyToRef(object, key);
1152
- }
1153
- return ret;
1154
- }
1155
- class ObjectRefImpl {
1156
- constructor(_object, _key, _defaultValue) {
1157
- this._object = _object;
1158
- this._key = _key;
1159
- this._defaultValue = _defaultValue;
1160
- this["__v_isRef"] = true;
1161
- this._value = void 0;
1162
- }
1163
- get value() {
1164
- const val = this._object[this._key];
1165
- return this._value = val === void 0 ? this._defaultValue : val;
1166
- }
1167
- set value(newVal) {
1168
- this._object[this._key] = newVal;
1169
- }
1170
- get dep() {
1171
- return getDepFromReactive(toRaw(this._object), this._key);
1172
- }
1173
- }
1174
- class GetterRefImpl {
1175
- constructor(_getter) {
1176
- this._getter = _getter;
1177
- this["__v_isRef"] = true;
1178
- this["__v_isReadonly"] = true;
1179
- this._value = void 0;
1180
- }
1181
- get value() {
1182
- return this._value = this._getter();
1183
- }
1184
- }
1185
- function toRef(source, key, defaultValue) {
1186
- if (isRef(source)) {
1187
- return source;
1188
- } else if (shared.isFunction(source)) {
1189
- return new GetterRefImpl(source);
1190
- } else if (shared.isObject(source) && arguments.length > 1) {
1191
- return propertyToRef(source, key, defaultValue);
1192
- } else {
1193
- return ref(source);
1194
- }
1195
- }
1196
- function propertyToRef(source, key, defaultValue) {
1197
- const val = source[key];
1198
- return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
1199
- }
1200
-
1201
- const EffectFlags = {
1202
- "ALLOW_RECURSE": 128,
1203
- "128": "ALLOW_RECURSE",
1204
- "PAUSED": 256,
1205
- "256": "PAUSED",
1206
- "STOP": 1024,
1207
- "1024": "STOP"
1208
- };
1209
- class ReactiveEffect {
1210
- constructor(fn) {
1211
- this.deps = void 0;
1212
- this.depsTail = void 0;
1213
- this.subs = void 0;
1214
- this.subsTail = void 0;
1215
- this.flags = ReactiveFlags$1.Watching | ReactiveFlags$1.Dirty;
1216
- /**
1217
- * @internal
1218
- */
1219
- this.cleanups = [];
1220
- /**
1221
- * @internal
1222
- */
1223
- this.cleanupsLength = 0;
1224
- if (fn !== void 0) {
1225
- this.fn = fn;
1226
- }
1227
- if (activeEffectScope) {
1228
- link(this, activeEffectScope);
1229
- }
1230
- }
1231
- // @ts-expect-error
1232
- fn() {
1233
- }
1234
- get active() {
1235
- return !(this.flags & 1024);
1236
- }
1237
- pause() {
1238
- this.flags |= 256;
1239
- }
1240
- resume() {
1241
- const flags = this.flags &= -257;
1242
- if (flags & (ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending)) {
1243
- this.notify();
1244
- }
1245
- }
1246
- notify() {
1247
- if (!(this.flags & 256) && this.dirty) {
1248
- this.run();
1249
- }
1250
- }
1251
- run() {
1252
- if (!this.active) {
1253
- return this.fn();
1254
- }
1255
- cleanup(this);
1256
- const prevSub = startTracking(this);
1257
- try {
1258
- return this.fn();
1259
- } finally {
1260
- endTracking(this, prevSub);
1261
- const flags = this.flags;
1262
- if ((flags & (ReactiveFlags$1.Recursed | 128)) === (ReactiveFlags$1.Recursed | 128)) {
1263
- this.flags = flags & ~ReactiveFlags$1.Recursed;
1264
- this.notify();
1265
- }
1266
- }
1267
- }
1268
- stop() {
1269
- if (!this.active) {
1270
- return;
1271
- }
1272
- this.flags = 1024;
1273
- let dep = this.deps;
1274
- while (dep !== void 0) {
1275
- dep = unlink(dep, this);
1276
- }
1277
- const sub = this.subs;
1278
- if (sub !== void 0) {
1279
- unlink(sub);
1280
- }
1281
- cleanup(this);
1282
- }
1283
- get dirty() {
1284
- const flags = this.flags;
1285
- if (flags & ReactiveFlags$1.Dirty) {
1286
- return true;
1287
- }
1288
- if (flags & ReactiveFlags$1.Pending) {
1289
- if (checkDirty(this.deps, this)) {
1290
- this.flags = flags | ReactiveFlags$1.Dirty;
1291
- return true;
1292
- } else {
1293
- this.flags = flags & ~ReactiveFlags$1.Pending;
1294
- }
1295
- }
1296
- return false;
1297
- }
1298
- }
1299
- function effect(fn, options) {
1300
- if (fn.effect instanceof ReactiveEffect) {
1301
- fn = fn.effect.fn;
1302
- }
1303
- const e = new ReactiveEffect(fn);
1304
- if (options) {
1305
- const { onStop, scheduler } = options;
1306
- if (onStop) {
1307
- options.onStop = void 0;
1308
- const stop2 = e.stop.bind(e);
1309
- e.stop = () => {
1310
- stop2();
1311
- onStop();
1312
- };
1313
- }
1314
- if (scheduler) {
1315
- options.scheduler = void 0;
1316
- e.notify = () => {
1317
- if (!(e.flags & 256)) {
1318
- scheduler();
1319
- }
1320
- };
1321
- }
1322
- shared.extend(e, options);
1323
- }
1324
- try {
1325
- e.run();
1326
- } catch (err) {
1327
- e.stop();
1328
- throw err;
1329
- }
1330
- const runner = e.run.bind(e);
1331
- runner.effect = e;
1332
- return runner;
1333
- }
1334
- function stop(runner) {
1335
- runner.effect.stop();
1336
- }
1337
- const resetTrackingStack = [];
1338
- function pauseTracking() {
1339
- resetTrackingStack.push(activeSub);
1340
- setActiveSub();
1341
- }
1342
- function enableTracking() {
1343
- const isPaused = activeSub === void 0;
1344
- if (!isPaused) {
1345
- resetTrackingStack.push(activeSub);
1346
- } else {
1347
- resetTrackingStack.push(void 0);
1348
- for (let i = resetTrackingStack.length - 1; i >= 0; i--) {
1349
- if (resetTrackingStack[i] !== void 0) {
1350
- setActiveSub(resetTrackingStack[i]);
1351
- break;
1352
- }
1353
- }
1354
- }
1355
- }
1356
- function resetTracking() {
1357
- if (resetTrackingStack.length) {
1358
- setActiveSub(resetTrackingStack.pop());
1359
- } else {
1360
- setActiveSub();
1361
- }
1362
- }
1363
- function cleanup(sub) {
1364
- const l = sub.cleanupsLength;
1365
- if (l) {
1366
- for (let i = 0; i < l; i++) {
1367
- sub.cleanups[i]();
1368
- }
1369
- sub.cleanupsLength = 0;
1370
- }
1371
- }
1372
- function onEffectCleanup(fn, failSilently = false) {
1373
- if (activeSub instanceof ReactiveEffect) {
1374
- activeSub.cleanups[activeSub.cleanupsLength++] = () => cleanupEffect(fn);
1375
- }
1376
- }
1377
- function cleanupEffect(fn) {
1378
- const prevSub = setActiveSub();
1379
- try {
1380
- fn();
1381
- } finally {
1382
- setActiveSub(prevSub);
1383
- }
1384
- }
1385
-
1386
- let activeEffectScope;
1387
- class EffectScope {
1388
- constructor(detached = false) {
1389
- this.deps = void 0;
1390
- this.depsTail = void 0;
1391
- this.subs = void 0;
1392
- this.subsTail = void 0;
1393
- this.flags = 0;
1394
- /**
1395
- * @internal
1396
- */
1397
- this.cleanups = [];
1398
- /**
1399
- * @internal
1400
- */
1401
- this.cleanupsLength = 0;
1402
- if (!detached && activeEffectScope) {
1403
- link(this, activeEffectScope);
1404
- }
1405
- }
1406
- get active() {
1407
- return !(this.flags & 1024);
1408
- }
1409
- pause() {
1410
- if (!(this.flags & 256)) {
1411
- this.flags |= 256;
1412
- for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1413
- const dep = link2.dep;
1414
- if ("pause" in dep) {
1415
- dep.pause();
1416
- }
1417
- }
1418
- }
1419
- }
1420
- /**
1421
- * Resumes the effect scope, including all child scopes and effects.
1422
- */
1423
- resume() {
1424
- const flags = this.flags;
1425
- if (flags & 256) {
1426
- this.flags = flags & -257;
1427
- for (let link2 = this.deps; link2 !== void 0; link2 = link2.nextDep) {
1428
- const dep = link2.dep;
1429
- if ("resume" in dep) {
1430
- dep.resume();
1431
- }
1432
- }
1433
- }
1434
- }
1435
- run(fn) {
1436
- const prevScope = activeEffectScope;
1437
- try {
1438
- activeEffectScope = this;
1439
- return fn();
1440
- } finally {
1441
- activeEffectScope = prevScope;
1442
- }
1443
- }
1444
- stop() {
1445
- if (!this.active) {
1446
- return;
1447
- }
1448
- this.flags = 1024;
1449
- let dep = this.deps;
1450
- while (dep !== void 0) {
1451
- const node = dep.dep;
1452
- if ("stop" in node) {
1453
- dep = dep.nextDep;
1454
- node.stop();
1455
- } else {
1456
- dep = unlink(dep, this);
1457
- }
1458
- }
1459
- const sub = this.subs;
1460
- if (sub !== void 0) {
1461
- unlink(sub);
1462
- }
1463
- cleanup(this);
1464
- }
1465
- }
1466
- function effectScope(detached) {
1467
- return new EffectScope(detached);
1468
- }
1469
- function getCurrentScope() {
1470
- return activeEffectScope;
1471
- }
1472
- function setCurrentScope(scope) {
1473
- try {
1474
- return activeEffectScope;
1475
- } finally {
1476
- activeEffectScope = scope;
1477
- }
1478
- }
1479
- function onScopeDispose(fn, failSilently = false) {
1480
- if (activeEffectScope !== void 0) {
1481
- activeEffectScope.cleanups[activeEffectScope.cleanupsLength++] = fn;
1482
- }
1483
- }
1484
-
1485
- class ComputedRefImpl {
1486
- constructor(fn, setter) {
1487
- this.fn = fn;
1488
- this.setter = setter;
1489
- /**
1490
- * @internal
1491
- */
1492
- this._value = void 0;
1493
- this.subs = void 0;
1494
- this.subsTail = void 0;
1495
- this.deps = void 0;
1496
- this.depsTail = void 0;
1497
- this.flags = ReactiveFlags$1.Mutable | ReactiveFlags$1.Dirty;
1498
- /**
1499
- * @internal
1500
- */
1501
- this.__v_isRef = true;
1502
- this["__v_isReadonly"] = !setter;
1503
- }
1504
- // TODO isolatedDeclarations "__v_isReadonly"
1505
- // for backwards compat
1506
- get effect() {
1507
- return this;
1508
- }
1509
- // for backwards compat
1510
- get dep() {
1511
- return this;
1512
- }
1513
- /**
1514
- * @internal
1515
- * for backwards compat
1516
- */
1517
- get _dirty() {
1518
- const flags = this.flags;
1519
- if (flags & ReactiveFlags$1.Dirty) {
1520
- return true;
1521
- }
1522
- if (flags & ReactiveFlags$1.Pending) {
1523
- if (checkDirty(this.deps, this)) {
1524
- this.flags = flags | ReactiveFlags$1.Dirty;
1525
- return true;
1526
- } else {
1527
- this.flags = flags & ~ReactiveFlags$1.Pending;
1528
- }
1529
- }
1530
- return false;
1531
- }
1532
- /**
1533
- * @internal
1534
- * for backwards compat
1535
- */
1536
- set _dirty(v) {
1537
- if (v) {
1538
- this.flags |= ReactiveFlags$1.Dirty;
1539
- } else {
1540
- this.flags &= ~(ReactiveFlags$1.Dirty | ReactiveFlags$1.Pending);
1541
- }
1542
- }
1543
- get value() {
1544
- const flags = this.flags;
1545
- if (flags & ReactiveFlags$1.Dirty || flags & ReactiveFlags$1.Pending && checkDirty(this.deps, this)) {
1546
- if (this.update()) {
1547
- const subs = this.subs;
1548
- if (subs !== void 0) {
1549
- shallowPropagate(subs);
1550
- }
1551
- }
1552
- } else if (flags & ReactiveFlags$1.Pending) {
1553
- this.flags = flags & ~ReactiveFlags$1.Pending;
1554
- }
1555
- if (activeSub !== void 0) {
1556
- link(this, activeSub);
1557
- } else if (activeEffectScope !== void 0) {
1558
- link(this, activeEffectScope);
1559
- }
1560
- return this._value;
1561
- }
1562
- set value(newValue) {
1563
- if (this.setter) {
1564
- this.setter(newValue);
1565
- }
1566
- }
1567
- update() {
1568
- const prevSub = startTracking(this);
1569
- try {
1570
- const oldValue = this._value;
1571
- const newValue = this.fn(oldValue);
1572
- if (shared.hasChanged(oldValue, newValue)) {
1573
- this._value = newValue;
1574
- return true;
1575
- }
1576
- return false;
1577
- } finally {
1578
- endTracking(this, prevSub);
1579
- }
1580
- }
1581
- }
1582
- function computed(getterOrOptions, debugOptions, isSSR = false) {
1583
- let getter;
1584
- let setter;
1585
- if (shared.isFunction(getterOrOptions)) {
1586
- getter = getterOrOptions;
1587
- } else {
1588
- getter = getterOrOptions.get;
1589
- setter = getterOrOptions.set;
1590
- }
1591
- const cRef = new ComputedRefImpl(getter, setter);
1592
- return cRef;
1593
- }
1594
-
1595
- const TrackOpTypes = {
1596
- "GET": "get",
1597
- "HAS": "has",
1598
- "ITERATE": "iterate"
1599
- };
1600
- const TriggerOpTypes = {
1601
- "SET": "set",
1602
- "ADD": "add",
1603
- "DELETE": "delete",
1604
- "CLEAR": "clear"
1605
- };
1606
- const ReactiveFlags = {
1607
- "SKIP": "__v_skip",
1608
- "IS_REACTIVE": "__v_isReactive",
1609
- "IS_READONLY": "__v_isReadonly",
1610
- "IS_SHALLOW": "__v_isShallow",
1611
- "RAW": "__v_raw",
1612
- "IS_REF": "__v_isRef"
1613
- };
1614
-
1615
- const WatchErrorCodes = {
1616
- "WATCH_GETTER": 2,
1617
- "2": "WATCH_GETTER",
1618
- "WATCH_CALLBACK": 3,
1619
- "3": "WATCH_CALLBACK",
1620
- "WATCH_CLEANUP": 4,
1621
- "4": "WATCH_CLEANUP"
1622
- };
1623
- const INITIAL_WATCHER_VALUE = {};
1624
- let activeWatcher = void 0;
1625
- function getCurrentWatcher() {
1626
- return activeWatcher;
1627
- }
1628
- function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
1629
- if (owner) {
1630
- const { call } = owner.options;
1631
- if (call) {
1632
- owner.cleanups[owner.cleanupsLength++] = () => call(cleanupFn, 4);
1633
- } else {
1634
- owner.cleanups[owner.cleanupsLength++] = cleanupFn;
1635
- }
1636
- }
1637
- }
1638
- class WatcherEffect extends ReactiveEffect {
1639
- constructor(source, cb, options = shared.EMPTY_OBJ) {
1640
- const { deep, once, call, onWarn } = options;
1641
- let getter;
1642
- let forceTrigger = false;
1643
- let isMultiSource = false;
1644
- if (isRef(source)) {
1645
- getter = () => source.value;
1646
- forceTrigger = isShallow(source);
1647
- } else if (isReactive(source)) {
1648
- getter = () => reactiveGetter(source, deep);
1649
- forceTrigger = true;
1650
- } else if (shared.isArray(source)) {
1651
- isMultiSource = true;
1652
- forceTrigger = source.some((s) => isReactive(s) || isShallow(s));
1653
- getter = () => source.map((s) => {
1654
- if (isRef(s)) {
1655
- return s.value;
1656
- } else if (isReactive(s)) {
1657
- return reactiveGetter(s, deep);
1658
- } else if (shared.isFunction(s)) {
1659
- return call ? call(s, 2) : s();
1660
- } else ;
1661
- });
1662
- } else if (shared.isFunction(source)) {
1663
- if (cb) {
1664
- getter = call ? () => call(source, 2) : source;
1665
- } else {
1666
- getter = () => {
1667
- if (this.cleanupsLength) {
1668
- const prevSub = setActiveSub();
1669
- try {
1670
- cleanup(this);
1671
- } finally {
1672
- setActiveSub(prevSub);
1673
- }
1674
- }
1675
- const currentEffect = activeWatcher;
1676
- activeWatcher = this;
1677
- try {
1678
- return call ? call(source, 3, [
1679
- this.boundCleanup
1680
- ]) : source(this.boundCleanup);
1681
- } finally {
1682
- activeWatcher = currentEffect;
1683
- }
1684
- };
1685
- }
1686
- } else {
1687
- getter = shared.NOOP;
1688
- }
1689
- if (cb && deep) {
1690
- const baseGetter = getter;
1691
- const depth = deep === true ? Infinity : deep;
1692
- getter = () => traverse(baseGetter(), depth);
1693
- }
1694
- super(getter);
1695
- this.cb = cb;
1696
- this.options = options;
1697
- this.boundCleanup = (fn) => onWatcherCleanup(fn, false, this);
1698
- this.forceTrigger = forceTrigger;
1699
- this.isMultiSource = isMultiSource;
1700
- if (once && cb) {
1701
- const _cb = cb;
1702
- cb = (...args) => {
1703
- _cb(...args);
1704
- this.stop();
1705
- };
1706
- }
1707
- this.cb = cb;
1708
- this.oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
1709
- }
1710
- run(initialRun = false) {
1711
- const oldValue = this.oldValue;
1712
- const newValue = this.oldValue = super.run();
1713
- if (!this.cb) {
1714
- return;
1715
- }
1716
- const { immediate, deep, call } = this.options;
1717
- if (initialRun && !immediate) {
1718
- return;
1719
- }
1720
- if (deep || this.forceTrigger || (this.isMultiSource ? newValue.some((v, i) => shared.hasChanged(v, oldValue[i])) : shared.hasChanged(newValue, oldValue))) {
1721
- cleanup(this);
1722
- const currentWatcher = activeWatcher;
1723
- activeWatcher = this;
1724
- try {
1725
- const args = [
1726
- newValue,
1727
- // pass undefined as the old value when it's changed for the first time
1728
- oldValue === INITIAL_WATCHER_VALUE ? void 0 : this.isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
1729
- this.boundCleanup
1730
- ];
1731
- call ? call(this.cb, 3, args) : (
1732
- // @ts-expect-error
1733
- this.cb(...args)
1734
- );
1735
- } finally {
1736
- activeWatcher = currentWatcher;
1737
- }
1738
- }
1739
- }
1740
- }
1741
- function reactiveGetter(source, deep) {
1742
- if (deep) return source;
1743
- if (isShallow(source) || deep === false || deep === 0)
1744
- return traverse(source, 1);
1745
- return traverse(source);
1746
- }
1747
- function watch(source, cb, options = shared.EMPTY_OBJ) {
1748
- const effect = new WatcherEffect(source, cb, options);
1749
- effect.run(true);
1750
- const stop = effect.stop.bind(effect);
1751
- stop.pause = effect.pause.bind(effect);
1752
- stop.resume = effect.resume.bind(effect);
1753
- stop.stop = stop;
1754
- return stop;
1755
- }
1756
- function traverse(value, depth = Infinity, seen) {
1757
- if (depth <= 0 || !shared.isObject(value) || value["__v_skip"]) {
1758
- return value;
1759
- }
1760
- seen = seen || /* @__PURE__ */ new Set();
1761
- if (seen.has(value)) {
1762
- return value;
1763
- }
1764
- seen.add(value);
1765
- depth--;
1766
- if (isRef(value)) {
1767
- traverse(value.value, depth, seen);
1768
- } else if (shared.isArray(value)) {
1769
- for (let i = 0; i < value.length; i++) {
1770
- traverse(value[i], depth, seen);
1771
- }
1772
- } else if (shared.isSet(value) || shared.isMap(value)) {
1773
- value.forEach((v) => {
1774
- traverse(v, depth, seen);
1775
- });
1776
- } else if (shared.isPlainObject(value)) {
1777
- for (const key in value) {
1778
- traverse(value[key], depth, seen);
1779
- }
1780
- for (const key of Object.getOwnPropertySymbols(value)) {
1781
- if (Object.prototype.propertyIsEnumerable.call(value, key)) {
1782
- traverse(value[key], depth, seen);
1783
- }
1784
- }
1785
- }
1786
- return value;
1787
- }
1788
-
1789
- exports.ARRAY_ITERATE_KEY = ARRAY_ITERATE_KEY;
1790
- exports.EffectFlags = EffectFlags;
1791
- exports.EffectScope = EffectScope;
1792
- exports.ITERATE_KEY = ITERATE_KEY;
1793
- exports.MAP_KEY_ITERATE_KEY = MAP_KEY_ITERATE_KEY;
1794
- exports.ReactiveEffect = ReactiveEffect;
1795
- exports.ReactiveFlags = ReactiveFlags;
1796
- exports.TrackOpTypes = TrackOpTypes;
1797
- exports.TriggerOpTypes = TriggerOpTypes;
1798
- exports.WatchErrorCodes = WatchErrorCodes;
1799
- exports.WatcherEffect = WatcherEffect;
1800
- exports.computed = computed;
1801
- exports.customRef = customRef;
1802
- exports.effect = effect;
1803
- exports.effectScope = effectScope;
1804
- exports.enableTracking = enableTracking;
1805
- exports.getCurrentScope = getCurrentScope;
1806
- exports.getCurrentWatcher = getCurrentWatcher;
1807
- exports.isProxy = isProxy;
1808
- exports.isReactive = isReactive;
1809
- exports.isReadonly = isReadonly;
1810
- exports.isRef = isRef;
1811
- exports.isShallow = isShallow;
1812
- exports.markRaw = markRaw;
1813
- exports.onEffectCleanup = onEffectCleanup;
1814
- exports.onScopeDispose = onScopeDispose;
1815
- exports.onWatcherCleanup = onWatcherCleanup;
1816
- exports.pauseTracking = pauseTracking;
1817
- exports.proxyRefs = proxyRefs;
1818
- exports.reactive = reactive;
1819
- exports.reactiveReadArray = reactiveReadArray;
1820
- exports.readonly = readonly;
1821
- exports.ref = ref;
1822
- exports.resetTracking = resetTracking;
1823
- exports.setActiveSub = setActiveSub;
1824
- exports.setCurrentScope = setCurrentScope;
1825
- exports.shallowReactive = shallowReactive;
1826
- exports.shallowReadArray = shallowReadArray;
1827
- exports.shallowReadonly = shallowReadonly;
1828
- exports.shallowRef = shallowRef;
1829
- exports.stop = stop;
1830
- exports.toRaw = toRaw;
1831
- exports.toReactive = toReactive;
1832
- exports.toReadonly = toReadonly;
1833
- exports.toRef = toRef;
1834
- exports.toRefs = toRefs;
1835
- exports.toValue = toValue;
1836
- exports.track = track;
1837
- exports.traverse = traverse;
1838
- exports.trigger = trigger;
1839
- exports.triggerRef = triggerRef;
1840
- exports.unref = unref;
1841
- exports.watch = watch;