@yiin/reactive-proxy-state 2.0.0 → 3.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/README.md +2 -0
- package/dist/index.cjs +550 -2557
- package/dist/index.js +539 -2537
- package/dist/integrations/vue3.d.ts +14 -8
- package/package.json +10 -3
package/dist/index.cjs
CHANGED
|
@@ -1,2328 +1,30 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
3
1
|
var __defProp = Object.defineProperty;
|
|
4
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
return entry;
|
|
31
|
-
};
|
|
32
|
-
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
33
|
-
var __export = (target, all) => {
|
|
34
|
-
for (var name in all)
|
|
35
|
-
__defProp(target, name, {
|
|
36
|
-
get: all[name],
|
|
37
|
-
enumerable: true,
|
|
38
|
-
configurable: true,
|
|
39
|
-
set: (newValue) => all[name] = () => newValue
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// node_modules/@vue/shared/dist/shared.cjs.js
|
|
44
|
-
var require_shared_cjs = __commonJS((exports2) => {
|
|
45
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
46
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
47
|
-
function makeMap(str) {
|
|
48
|
-
const map = /* @__PURE__ */ Object.create(null);
|
|
49
|
-
for (const key of str.split(","))
|
|
50
|
-
map[key] = 1;
|
|
51
|
-
return (val) => (val in map);
|
|
52
|
-
}
|
|
53
|
-
var EMPTY_OBJ = Object.freeze({});
|
|
54
|
-
var EMPTY_ARR = Object.freeze([]);
|
|
55
|
-
var NOOP = () => {};
|
|
56
|
-
var NO = () => false;
|
|
57
|
-
var isOn = (key) => key.charCodeAt(0) === 111 && key.charCodeAt(1) === 110 && (key.charCodeAt(2) > 122 || key.charCodeAt(2) < 97);
|
|
58
|
-
var isModelListener = (key) => key.startsWith("onUpdate:");
|
|
59
|
-
var extend = Object.assign;
|
|
60
|
-
var remove = (arr, el) => {
|
|
61
|
-
const i = arr.indexOf(el);
|
|
62
|
-
if (i > -1) {
|
|
63
|
-
arr.splice(i, 1);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
67
|
-
var hasOwn2 = (val, key) => hasOwnProperty.call(val, key);
|
|
68
|
-
var isArray = Array.isArray;
|
|
69
|
-
var isMap = (val) => toTypeString(val) === "[object Map]";
|
|
70
|
-
var isSet = (val) => toTypeString(val) === "[object Set]";
|
|
71
|
-
var isDate = (val) => toTypeString(val) === "[object Date]";
|
|
72
|
-
var isRegExp = (val) => toTypeString(val) === "[object RegExp]";
|
|
73
|
-
var isFunction = (val) => typeof val === "function";
|
|
74
|
-
var isString = (val) => typeof val === "string";
|
|
75
|
-
var isSymbol = (val) => typeof val === "symbol";
|
|
76
|
-
var isObject7 = (val) => val !== null && typeof val === "object";
|
|
77
|
-
var isPromise = (val) => {
|
|
78
|
-
return (isObject7(val) || isFunction(val)) && isFunction(val.then) && isFunction(val.catch);
|
|
79
|
-
};
|
|
80
|
-
var objectToString = Object.prototype.toString;
|
|
81
|
-
var toTypeString = (value) => objectToString.call(value);
|
|
82
|
-
var toRawType = (value) => {
|
|
83
|
-
return toTypeString(value).slice(8, -1);
|
|
84
|
-
};
|
|
85
|
-
var isPlainObject = (val) => toTypeString(val) === "[object Object]";
|
|
86
|
-
var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key;
|
|
87
|
-
var isReservedProp = /* @__PURE__ */ makeMap(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted");
|
|
88
|
-
var isBuiltInDirective = /* @__PURE__ */ makeMap("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo");
|
|
89
|
-
var cacheStringFunction = (fn) => {
|
|
90
|
-
const cache = /* @__PURE__ */ Object.create(null);
|
|
91
|
-
return (str) => {
|
|
92
|
-
const hit = cache[str];
|
|
93
|
-
return hit || (cache[str] = fn(str));
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
var camelizeRE = /-(\w)/g;
|
|
97
|
-
var camelize = cacheStringFunction((str) => {
|
|
98
|
-
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
|
|
99
|
-
});
|
|
100
|
-
var hyphenateRE = /\B([A-Z])/g;
|
|
101
|
-
var hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
|
|
102
|
-
var capitalize = cacheStringFunction((str) => {
|
|
103
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
104
|
-
});
|
|
105
|
-
var toHandlerKey = cacheStringFunction((str) => {
|
|
106
|
-
const s = str ? `on${capitalize(str)}` : ``;
|
|
107
|
-
return s;
|
|
108
|
-
});
|
|
109
|
-
var hasChanged = (value, oldValue) => !Object.is(value, oldValue);
|
|
110
|
-
var invokeArrayFns = (fns, ...arg) => {
|
|
111
|
-
for (let i = 0;i < fns.length; i++) {
|
|
112
|
-
fns[i](...arg);
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
var def = (obj, key, value, writable = false) => {
|
|
116
|
-
Object.defineProperty(obj, key, {
|
|
117
|
-
configurable: true,
|
|
118
|
-
enumerable: false,
|
|
119
|
-
writable,
|
|
120
|
-
value
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
var looseToNumber = (val) => {
|
|
124
|
-
const n = parseFloat(val);
|
|
125
|
-
return isNaN(n) ? val : n;
|
|
126
|
-
};
|
|
127
|
-
var toNumber = (val) => {
|
|
128
|
-
const n = isString(val) ? Number(val) : NaN;
|
|
129
|
-
return isNaN(n) ? val : n;
|
|
130
|
-
};
|
|
131
|
-
var _globalThis;
|
|
132
|
-
var getGlobalThis = () => {
|
|
133
|
-
return _globalThis || (_globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {});
|
|
134
|
-
};
|
|
135
|
-
var identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
|
|
136
|
-
function genPropsAccessExp(name) {
|
|
137
|
-
return identRE.test(name) ? `__props.${name}` : `__props[${JSON.stringify(name)}]`;
|
|
138
|
-
}
|
|
139
|
-
function genCacheKey(source, options) {
|
|
140
|
-
return source + JSON.stringify(options, (_, val) => typeof val === "function" ? val.toString() : val);
|
|
141
|
-
}
|
|
142
|
-
var PatchFlags = {
|
|
143
|
-
TEXT: 1,
|
|
144
|
-
"1": "TEXT",
|
|
145
|
-
CLASS: 2,
|
|
146
|
-
"2": "CLASS",
|
|
147
|
-
STYLE: 4,
|
|
148
|
-
"4": "STYLE",
|
|
149
|
-
PROPS: 8,
|
|
150
|
-
"8": "PROPS",
|
|
151
|
-
FULL_PROPS: 16,
|
|
152
|
-
"16": "FULL_PROPS",
|
|
153
|
-
NEED_HYDRATION: 32,
|
|
154
|
-
"32": "NEED_HYDRATION",
|
|
155
|
-
STABLE_FRAGMENT: 64,
|
|
156
|
-
"64": "STABLE_FRAGMENT",
|
|
157
|
-
KEYED_FRAGMENT: 128,
|
|
158
|
-
"128": "KEYED_FRAGMENT",
|
|
159
|
-
UNKEYED_FRAGMENT: 256,
|
|
160
|
-
"256": "UNKEYED_FRAGMENT",
|
|
161
|
-
NEED_PATCH: 512,
|
|
162
|
-
"512": "NEED_PATCH",
|
|
163
|
-
DYNAMIC_SLOTS: 1024,
|
|
164
|
-
"1024": "DYNAMIC_SLOTS",
|
|
165
|
-
DEV_ROOT_FRAGMENT: 2048,
|
|
166
|
-
"2048": "DEV_ROOT_FRAGMENT",
|
|
167
|
-
CACHED: -1,
|
|
168
|
-
"-1": "CACHED",
|
|
169
|
-
BAIL: -2,
|
|
170
|
-
"-2": "BAIL"
|
|
171
|
-
};
|
|
172
|
-
var PatchFlagNames = {
|
|
173
|
-
[1]: `TEXT`,
|
|
174
|
-
[2]: `CLASS`,
|
|
175
|
-
[4]: `STYLE`,
|
|
176
|
-
[8]: `PROPS`,
|
|
177
|
-
[16]: `FULL_PROPS`,
|
|
178
|
-
[32]: `NEED_HYDRATION`,
|
|
179
|
-
[64]: `STABLE_FRAGMENT`,
|
|
180
|
-
[128]: `KEYED_FRAGMENT`,
|
|
181
|
-
[256]: `UNKEYED_FRAGMENT`,
|
|
182
|
-
[512]: `NEED_PATCH`,
|
|
183
|
-
[1024]: `DYNAMIC_SLOTS`,
|
|
184
|
-
[2048]: `DEV_ROOT_FRAGMENT`,
|
|
185
|
-
[-1]: `HOISTED`,
|
|
186
|
-
[-2]: `BAIL`
|
|
187
|
-
};
|
|
188
|
-
var ShapeFlags = {
|
|
189
|
-
ELEMENT: 1,
|
|
190
|
-
"1": "ELEMENT",
|
|
191
|
-
FUNCTIONAL_COMPONENT: 2,
|
|
192
|
-
"2": "FUNCTIONAL_COMPONENT",
|
|
193
|
-
STATEFUL_COMPONENT: 4,
|
|
194
|
-
"4": "STATEFUL_COMPONENT",
|
|
195
|
-
TEXT_CHILDREN: 8,
|
|
196
|
-
"8": "TEXT_CHILDREN",
|
|
197
|
-
ARRAY_CHILDREN: 16,
|
|
198
|
-
"16": "ARRAY_CHILDREN",
|
|
199
|
-
SLOTS_CHILDREN: 32,
|
|
200
|
-
"32": "SLOTS_CHILDREN",
|
|
201
|
-
TELEPORT: 64,
|
|
202
|
-
"64": "TELEPORT",
|
|
203
|
-
SUSPENSE: 128,
|
|
204
|
-
"128": "SUSPENSE",
|
|
205
|
-
COMPONENT_SHOULD_KEEP_ALIVE: 256,
|
|
206
|
-
"256": "COMPONENT_SHOULD_KEEP_ALIVE",
|
|
207
|
-
COMPONENT_KEPT_ALIVE: 512,
|
|
208
|
-
"512": "COMPONENT_KEPT_ALIVE",
|
|
209
|
-
COMPONENT: 6,
|
|
210
|
-
"6": "COMPONENT"
|
|
211
|
-
};
|
|
212
|
-
var SlotFlags = {
|
|
213
|
-
STABLE: 1,
|
|
214
|
-
"1": "STABLE",
|
|
215
|
-
DYNAMIC: 2,
|
|
216
|
-
"2": "DYNAMIC",
|
|
217
|
-
FORWARDED: 3,
|
|
218
|
-
"3": "FORWARDED"
|
|
219
|
-
};
|
|
220
|
-
var slotFlagsText = {
|
|
221
|
-
[1]: "STABLE",
|
|
222
|
-
[2]: "DYNAMIC",
|
|
223
|
-
[3]: "FORWARDED"
|
|
224
|
-
};
|
|
225
|
-
var GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol";
|
|
226
|
-
var isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED);
|
|
227
|
-
var isGloballyWhitelisted = isGloballyAllowed;
|
|
228
|
-
var range = 2;
|
|
229
|
-
function generateCodeFrame(source, start = 0, end = source.length) {
|
|
230
|
-
start = Math.max(0, Math.min(start, source.length));
|
|
231
|
-
end = Math.max(0, Math.min(end, source.length));
|
|
232
|
-
if (start > end)
|
|
233
|
-
return "";
|
|
234
|
-
let lines = source.split(/(\r?\n)/);
|
|
235
|
-
const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
|
|
236
|
-
lines = lines.filter((_, idx) => idx % 2 === 0);
|
|
237
|
-
let count = 0;
|
|
238
|
-
const res = [];
|
|
239
|
-
for (let i = 0;i < lines.length; i++) {
|
|
240
|
-
count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
|
|
241
|
-
if (count >= start) {
|
|
242
|
-
for (let j = i - range;j <= i + range || end > count; j++) {
|
|
243
|
-
if (j < 0 || j >= lines.length)
|
|
244
|
-
continue;
|
|
245
|
-
const line = j + 1;
|
|
246
|
-
res.push(`${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`);
|
|
247
|
-
const lineLength = lines[j].length;
|
|
248
|
-
const newLineSeqLength = newlineSequences[j] && newlineSequences[j].length || 0;
|
|
249
|
-
if (j === i) {
|
|
250
|
-
const pad = start - (count - (lineLength + newLineSeqLength));
|
|
251
|
-
const length = Math.max(1, end > count ? lineLength - pad : end - start);
|
|
252
|
-
res.push(` | ` + " ".repeat(pad) + "^".repeat(length));
|
|
253
|
-
} else if (j > i) {
|
|
254
|
-
if (end > count) {
|
|
255
|
-
const length = Math.max(Math.min(end - count, lineLength), 1);
|
|
256
|
-
res.push(` | ` + "^".repeat(length));
|
|
257
|
-
}
|
|
258
|
-
count += lineLength + newLineSeqLength;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
break;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
return res.join(`
|
|
265
|
-
`);
|
|
266
|
-
}
|
|
267
|
-
function normalizeStyle(value) {
|
|
268
|
-
if (isArray(value)) {
|
|
269
|
-
const res = {};
|
|
270
|
-
for (let i = 0;i < value.length; i++) {
|
|
271
|
-
const item = value[i];
|
|
272
|
-
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle(item);
|
|
273
|
-
if (normalized) {
|
|
274
|
-
for (const key in normalized) {
|
|
275
|
-
res[key] = normalized[key];
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
return res;
|
|
280
|
-
} else if (isString(value) || isObject7(value)) {
|
|
281
|
-
return value;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
var listDelimiterRE = /;(?![^(]*\))/g;
|
|
285
|
-
var propertyDelimiterRE = /:([^]+)/;
|
|
286
|
-
var styleCommentRE = /\/\*[^]*?\*\//g;
|
|
287
|
-
function parseStringStyle(cssText) {
|
|
288
|
-
const ret = {};
|
|
289
|
-
cssText.replace(styleCommentRE, "").split(listDelimiterRE).forEach((item) => {
|
|
290
|
-
if (item) {
|
|
291
|
-
const tmp = item.split(propertyDelimiterRE);
|
|
292
|
-
tmp.length > 1 && (ret[tmp[0].trim()] = tmp[1].trim());
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
return ret;
|
|
296
|
-
}
|
|
297
|
-
function stringifyStyle(styles) {
|
|
298
|
-
if (!styles)
|
|
299
|
-
return "";
|
|
300
|
-
if (isString(styles))
|
|
301
|
-
return styles;
|
|
302
|
-
let ret = "";
|
|
303
|
-
for (const key in styles) {
|
|
304
|
-
const value = styles[key];
|
|
305
|
-
if (isString(value) || typeof value === "number") {
|
|
306
|
-
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key);
|
|
307
|
-
ret += `${normalizedKey}:${value};`;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
return ret;
|
|
311
|
-
}
|
|
312
|
-
function normalizeClass(value) {
|
|
313
|
-
let res = "";
|
|
314
|
-
if (isString(value)) {
|
|
315
|
-
res = value;
|
|
316
|
-
} else if (isArray(value)) {
|
|
317
|
-
for (let i = 0;i < value.length; i++) {
|
|
318
|
-
const normalized = normalizeClass(value[i]);
|
|
319
|
-
if (normalized) {
|
|
320
|
-
res += normalized + " ";
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
} else if (isObject7(value)) {
|
|
324
|
-
for (const name in value) {
|
|
325
|
-
if (value[name]) {
|
|
326
|
-
res += name + " ";
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
return res.trim();
|
|
331
|
-
}
|
|
332
|
-
function normalizeProps(props) {
|
|
333
|
-
if (!props)
|
|
334
|
-
return null;
|
|
335
|
-
let { class: klass, style } = props;
|
|
336
|
-
if (klass && !isString(klass)) {
|
|
337
|
-
props.class = normalizeClass(klass);
|
|
338
|
-
}
|
|
339
|
-
if (style) {
|
|
340
|
-
props.style = normalizeStyle(style);
|
|
341
|
-
}
|
|
342
|
-
return props;
|
|
343
|
-
}
|
|
344
|
-
var HTML_TAGS = "html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot";
|
|
345
|
-
var SVG_TAGS = "svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view";
|
|
346
|
-
var MATH_TAGS = "annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics";
|
|
347
|
-
var VOID_TAGS = "area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr";
|
|
348
|
-
var isHTMLTag = /* @__PURE__ */ makeMap(HTML_TAGS);
|
|
349
|
-
var isSVGTag = /* @__PURE__ */ makeMap(SVG_TAGS);
|
|
350
|
-
var isMathMLTag = /* @__PURE__ */ makeMap(MATH_TAGS);
|
|
351
|
-
var isVoidTag = /* @__PURE__ */ makeMap(VOID_TAGS);
|
|
352
|
-
var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
|
|
353
|
-
var isSpecialBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs);
|
|
354
|
-
var isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);
|
|
355
|
-
function includeBooleanAttr(value) {
|
|
356
|
-
return !!value || value === "";
|
|
357
|
-
}
|
|
358
|
-
var unsafeAttrCharRE = /[>/="'\u0009\u000a\u000c\u0020]/;
|
|
359
|
-
var attrValidationCache = {};
|
|
360
|
-
function isSSRSafeAttrName(name) {
|
|
361
|
-
if (attrValidationCache.hasOwnProperty(name)) {
|
|
362
|
-
return attrValidationCache[name];
|
|
363
|
-
}
|
|
364
|
-
const isUnsafe = unsafeAttrCharRE.test(name);
|
|
365
|
-
if (isUnsafe) {
|
|
366
|
-
console.error(`unsafe attribute name: ${name}`);
|
|
367
|
-
}
|
|
368
|
-
return attrValidationCache[name] = !isUnsafe;
|
|
369
|
-
}
|
|
370
|
-
var propsToAttrMap = {
|
|
371
|
-
acceptCharset: "accept-charset",
|
|
372
|
-
className: "class",
|
|
373
|
-
htmlFor: "for",
|
|
374
|
-
httpEquiv: "http-equiv"
|
|
375
|
-
};
|
|
376
|
-
var isKnownHtmlAttr = /* @__PURE__ */ makeMap(`accept,accept-charset,accesskey,action,align,allow,alt,async,autocapitalize,autocomplete,autofocus,autoplay,background,bgcolor,border,buffered,capture,challenge,charset,checked,cite,class,code,codebase,color,cols,colspan,content,contenteditable,contextmenu,controls,coords,crossorigin,csp,data,datetime,decoding,default,defer,dir,dirname,disabled,download,draggable,dropzone,enctype,enterkeyhint,for,form,formaction,formenctype,formmethod,formnovalidate,formtarget,headers,height,hidden,high,href,hreflang,http-equiv,icon,id,importance,inert,integrity,ismap,itemprop,keytype,kind,label,lang,language,loading,list,loop,low,manifest,max,maxlength,minlength,media,min,multiple,muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,preload,radiogroup,readonly,referrerpolicy,rel,required,reversed,rows,rowspan,sandbox,scope,scoped,selected,shape,size,sizes,slot,span,spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,target,title,translate,type,usemap,value,width,wrap`);
|
|
377
|
-
var isKnownSvgAttr = /* @__PURE__ */ makeMap(`xmlns,accent-height,accumulate,additive,alignment-baseline,alphabetic,amplitude,arabic-form,ascent,attributeName,attributeType,azimuth,baseFrequency,baseline-shift,baseProfile,bbox,begin,bias,by,calcMode,cap-height,class,clip,clipPathUnits,clip-path,clip-rule,color,color-interpolation,color-interpolation-filters,color-profile,color-rendering,contentScriptType,contentStyleType,crossorigin,cursor,cx,cy,d,decelerate,descent,diffuseConstant,direction,display,divisor,dominant-baseline,dur,dx,dy,edgeMode,elevation,enable-background,end,exponent,fill,fill-opacity,fill-rule,filter,filterRes,filterUnits,flood-color,flood-opacity,font-family,font-size,font-size-adjust,font-stretch,font-style,font-variant,font-weight,format,from,fr,fx,fy,g1,g2,glyph-name,glyph-orientation-horizontal,glyph-orientation-vertical,glyphRef,gradientTransform,gradientUnits,hanging,height,href,hreflang,horiz-adv-x,horiz-origin-x,id,ideographic,image-rendering,in,in2,intercept,k,k1,k2,k3,k4,kernelMatrix,kernelUnitLength,kerning,keyPoints,keySplines,keyTimes,lang,lengthAdjust,letter-spacing,lighting-color,limitingConeAngle,local,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mask,maskContentUnits,maskUnits,mathematical,max,media,method,min,mode,name,numOctaves,offset,opacity,operator,order,orient,orientation,origin,overflow,overline-position,overline-thickness,panose-1,paint-order,path,pathLength,patternContentUnits,patternTransform,patternUnits,ping,pointer-events,points,pointsAtX,pointsAtY,pointsAtZ,preserveAlpha,preserveAspectRatio,primitiveUnits,r,radius,referrerPolicy,refX,refY,rel,rendering-intent,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,result,rotate,rx,ry,scale,seed,shape-rendering,slope,spacing,specularConstant,specularExponent,speed,spreadMethod,startOffset,stdDeviation,stemh,stemv,stitchTiles,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,string,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,style,surfaceScale,systemLanguage,tabindex,tableValues,target,targetX,targetY,text-anchor,text-decoration,text-rendering,textLength,to,transform,transform-origin,type,u1,u2,underline-position,underline-thickness,unicode,unicode-bidi,unicode-range,units-per-em,v-alphabetic,v-hanging,v-ideographic,v-mathematical,values,vector-effect,version,vert-adv-y,vert-origin-x,vert-origin-y,viewBox,viewTarget,visibility,width,widths,word-spacing,writing-mode,x,x-height,x1,x2,xChannelSelector,xlink:actuate,xlink:arcrole,xlink:href,xlink:role,xlink:show,xlink:title,xlink:type,xmlns:xlink,xml:base,xml:lang,xml:space,y,y1,y2,yChannelSelector,z,zoomAndPan`);
|
|
378
|
-
var isKnownMathMLAttr = /* @__PURE__ */ makeMap(`accent,accentunder,actiontype,align,alignmentscope,altimg,altimg-height,altimg-valign,altimg-width,alttext,bevelled,close,columnsalign,columnlines,columnspan,denomalign,depth,dir,display,displaystyle,encoding,equalcolumns,equalrows,fence,fontstyle,fontweight,form,frame,framespacing,groupalign,height,href,id,indentalign,indentalignfirst,indentalignlast,indentshift,indentshiftfirst,indentshiftlast,indextype,justify,largetop,largeop,lquote,lspace,mathbackground,mathcolor,mathsize,mathvariant,maxsize,minlabelspacing,mode,other,overflow,position,rowalign,rowlines,rowspan,rquote,rspace,scriptlevel,scriptminsize,scriptsizemultiplier,selection,separator,separators,shift,side,src,stackalign,stretchy,subscriptshift,superscriptshift,symmetric,voffset,width,widths,xlink:href,xlink:show,xlink:type,xmlns`);
|
|
379
|
-
function isRenderableAttrValue(value) {
|
|
380
|
-
if (value == null) {
|
|
381
|
-
return false;
|
|
382
|
-
}
|
|
383
|
-
const type = typeof value;
|
|
384
|
-
return type === "string" || type === "number" || type === "boolean";
|
|
385
|
-
}
|
|
386
|
-
var escapeRE = /["'&<>]/;
|
|
387
|
-
function escapeHtml(string) {
|
|
388
|
-
const str = "" + string;
|
|
389
|
-
const match = escapeRE.exec(str);
|
|
390
|
-
if (!match) {
|
|
391
|
-
return str;
|
|
392
|
-
}
|
|
393
|
-
let html = "";
|
|
394
|
-
let escaped;
|
|
395
|
-
let index;
|
|
396
|
-
let lastIndex = 0;
|
|
397
|
-
for (index = match.index;index < str.length; index++) {
|
|
398
|
-
switch (str.charCodeAt(index)) {
|
|
399
|
-
case 34:
|
|
400
|
-
escaped = """;
|
|
401
|
-
break;
|
|
402
|
-
case 38:
|
|
403
|
-
escaped = "&";
|
|
404
|
-
break;
|
|
405
|
-
case 39:
|
|
406
|
-
escaped = "'";
|
|
407
|
-
break;
|
|
408
|
-
case 60:
|
|
409
|
-
escaped = "<";
|
|
410
|
-
break;
|
|
411
|
-
case 62:
|
|
412
|
-
escaped = ">";
|
|
413
|
-
break;
|
|
414
|
-
default:
|
|
415
|
-
continue;
|
|
416
|
-
}
|
|
417
|
-
if (lastIndex !== index) {
|
|
418
|
-
html += str.slice(lastIndex, index);
|
|
419
|
-
}
|
|
420
|
-
lastIndex = index + 1;
|
|
421
|
-
html += escaped;
|
|
422
|
-
}
|
|
423
|
-
return lastIndex !== index ? html + str.slice(lastIndex, index) : html;
|
|
424
|
-
}
|
|
425
|
-
var commentStripRE = /^-?>|<!--|-->|--!>|<!-$/g;
|
|
426
|
-
function escapeHtmlComment(src) {
|
|
427
|
-
return src.replace(commentStripRE, "");
|
|
428
|
-
}
|
|
429
|
-
var cssVarNameEscapeSymbolsRE = /[ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~]/g;
|
|
430
|
-
function getEscapedCssVarName(key, doubleEscape) {
|
|
431
|
-
return key.replace(cssVarNameEscapeSymbolsRE, (s) => doubleEscape ? s === '"' ? "\\\\\\\"" : `\\\\${s}` : `\\${s}`);
|
|
432
|
-
}
|
|
433
|
-
function looseCompareArrays(a, b) {
|
|
434
|
-
if (a.length !== b.length)
|
|
435
|
-
return false;
|
|
436
|
-
let equal = true;
|
|
437
|
-
for (let i = 0;equal && i < a.length; i++) {
|
|
438
|
-
equal = looseEqual(a[i], b[i]);
|
|
439
|
-
}
|
|
440
|
-
return equal;
|
|
441
|
-
}
|
|
442
|
-
function looseEqual(a, b) {
|
|
443
|
-
if (a === b)
|
|
444
|
-
return true;
|
|
445
|
-
let aValidType = isDate(a);
|
|
446
|
-
let bValidType = isDate(b);
|
|
447
|
-
if (aValidType || bValidType) {
|
|
448
|
-
return aValidType && bValidType ? a.getTime() === b.getTime() : false;
|
|
449
|
-
}
|
|
450
|
-
aValidType = isSymbol(a);
|
|
451
|
-
bValidType = isSymbol(b);
|
|
452
|
-
if (aValidType || bValidType) {
|
|
453
|
-
return a === b;
|
|
454
|
-
}
|
|
455
|
-
aValidType = isArray(a);
|
|
456
|
-
bValidType = isArray(b);
|
|
457
|
-
if (aValidType || bValidType) {
|
|
458
|
-
return aValidType && bValidType ? looseCompareArrays(a, b) : false;
|
|
459
|
-
}
|
|
460
|
-
aValidType = isObject7(a);
|
|
461
|
-
bValidType = isObject7(b);
|
|
462
|
-
if (aValidType || bValidType) {
|
|
463
|
-
if (!aValidType || !bValidType) {
|
|
464
|
-
return false;
|
|
465
|
-
}
|
|
466
|
-
const aKeysCount = Object.keys(a).length;
|
|
467
|
-
const bKeysCount = Object.keys(b).length;
|
|
468
|
-
if (aKeysCount !== bKeysCount) {
|
|
469
|
-
return false;
|
|
470
|
-
}
|
|
471
|
-
for (const key in a) {
|
|
472
|
-
const aHasKey = a.hasOwnProperty(key);
|
|
473
|
-
const bHasKey = b.hasOwnProperty(key);
|
|
474
|
-
if (aHasKey && !bHasKey || !aHasKey && bHasKey || !looseEqual(a[key], b[key])) {
|
|
475
|
-
return false;
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
return String(a) === String(b);
|
|
480
|
-
}
|
|
481
|
-
function looseIndexOf(arr, val) {
|
|
482
|
-
return arr.findIndex((item) => looseEqual(item, val));
|
|
483
|
-
}
|
|
484
|
-
var isRef3 = (val) => {
|
|
485
|
-
return !!(val && val["__v_isRef"] === true);
|
|
486
|
-
};
|
|
487
|
-
var toDisplayString = (val) => {
|
|
488
|
-
return isString(val) ? val : val == null ? "" : isArray(val) || isObject7(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef3(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val);
|
|
489
|
-
};
|
|
490
|
-
var replacer = (_key, val) => {
|
|
491
|
-
if (isRef3(val)) {
|
|
492
|
-
return replacer(_key, val.value);
|
|
493
|
-
} else if (isMap(val)) {
|
|
494
|
-
return {
|
|
495
|
-
[`Map(${val.size})`]: [...val.entries()].reduce((entries, [key, val2], i) => {
|
|
496
|
-
entries[stringifySymbol(key, i) + " =>"] = val2;
|
|
497
|
-
return entries;
|
|
498
|
-
}, {})
|
|
499
|
-
};
|
|
500
|
-
} else if (isSet(val)) {
|
|
501
|
-
return {
|
|
502
|
-
[`Set(${val.size})`]: [...val.values()].map((v) => stringifySymbol(v))
|
|
503
|
-
};
|
|
504
|
-
} else if (isSymbol(val)) {
|
|
505
|
-
return stringifySymbol(val);
|
|
506
|
-
} else if (isObject7(val) && !isArray(val) && !isPlainObject(val)) {
|
|
507
|
-
return String(val);
|
|
508
|
-
}
|
|
509
|
-
return val;
|
|
510
|
-
};
|
|
511
|
-
var stringifySymbol = (v, i = "") => {
|
|
512
|
-
var _a;
|
|
513
|
-
return isSymbol(v) ? `Symbol(${(_a = v.description) != null ? _a : i})` : v;
|
|
514
|
-
};
|
|
515
|
-
exports2.EMPTY_ARR = EMPTY_ARR;
|
|
516
|
-
exports2.EMPTY_OBJ = EMPTY_OBJ;
|
|
517
|
-
exports2.NO = NO;
|
|
518
|
-
exports2.NOOP = NOOP;
|
|
519
|
-
exports2.PatchFlagNames = PatchFlagNames;
|
|
520
|
-
exports2.PatchFlags = PatchFlags;
|
|
521
|
-
exports2.ShapeFlags = ShapeFlags;
|
|
522
|
-
exports2.SlotFlags = SlotFlags;
|
|
523
|
-
exports2.camelize = camelize;
|
|
524
|
-
exports2.capitalize = capitalize;
|
|
525
|
-
exports2.cssVarNameEscapeSymbolsRE = cssVarNameEscapeSymbolsRE;
|
|
526
|
-
exports2.def = def;
|
|
527
|
-
exports2.escapeHtml = escapeHtml;
|
|
528
|
-
exports2.escapeHtmlComment = escapeHtmlComment;
|
|
529
|
-
exports2.extend = extend;
|
|
530
|
-
exports2.genCacheKey = genCacheKey;
|
|
531
|
-
exports2.genPropsAccessExp = genPropsAccessExp;
|
|
532
|
-
exports2.generateCodeFrame = generateCodeFrame;
|
|
533
|
-
exports2.getEscapedCssVarName = getEscapedCssVarName;
|
|
534
|
-
exports2.getGlobalThis = getGlobalThis;
|
|
535
|
-
exports2.hasChanged = hasChanged;
|
|
536
|
-
exports2.hasOwn = hasOwn2;
|
|
537
|
-
exports2.hyphenate = hyphenate;
|
|
538
|
-
exports2.includeBooleanAttr = includeBooleanAttr;
|
|
539
|
-
exports2.invokeArrayFns = invokeArrayFns;
|
|
540
|
-
exports2.isArray = isArray;
|
|
541
|
-
exports2.isBooleanAttr = isBooleanAttr;
|
|
542
|
-
exports2.isBuiltInDirective = isBuiltInDirective;
|
|
543
|
-
exports2.isDate = isDate;
|
|
544
|
-
exports2.isFunction = isFunction;
|
|
545
|
-
exports2.isGloballyAllowed = isGloballyAllowed;
|
|
546
|
-
exports2.isGloballyWhitelisted = isGloballyWhitelisted;
|
|
547
|
-
exports2.isHTMLTag = isHTMLTag;
|
|
548
|
-
exports2.isIntegerKey = isIntegerKey;
|
|
549
|
-
exports2.isKnownHtmlAttr = isKnownHtmlAttr;
|
|
550
|
-
exports2.isKnownMathMLAttr = isKnownMathMLAttr;
|
|
551
|
-
exports2.isKnownSvgAttr = isKnownSvgAttr;
|
|
552
|
-
exports2.isMap = isMap;
|
|
553
|
-
exports2.isMathMLTag = isMathMLTag;
|
|
554
|
-
exports2.isModelListener = isModelListener;
|
|
555
|
-
exports2.isObject = isObject7;
|
|
556
|
-
exports2.isOn = isOn;
|
|
557
|
-
exports2.isPlainObject = isPlainObject;
|
|
558
|
-
exports2.isPromise = isPromise;
|
|
559
|
-
exports2.isRegExp = isRegExp;
|
|
560
|
-
exports2.isRenderableAttrValue = isRenderableAttrValue;
|
|
561
|
-
exports2.isReservedProp = isReservedProp;
|
|
562
|
-
exports2.isSSRSafeAttrName = isSSRSafeAttrName;
|
|
563
|
-
exports2.isSVGTag = isSVGTag;
|
|
564
|
-
exports2.isSet = isSet;
|
|
565
|
-
exports2.isSpecialBooleanAttr = isSpecialBooleanAttr;
|
|
566
|
-
exports2.isString = isString;
|
|
567
|
-
exports2.isSymbol = isSymbol;
|
|
568
|
-
exports2.isVoidTag = isVoidTag;
|
|
569
|
-
exports2.looseEqual = looseEqual;
|
|
570
|
-
exports2.looseIndexOf = looseIndexOf;
|
|
571
|
-
exports2.looseToNumber = looseToNumber;
|
|
572
|
-
exports2.makeMap = makeMap;
|
|
573
|
-
exports2.normalizeClass = normalizeClass;
|
|
574
|
-
exports2.normalizeProps = normalizeProps;
|
|
575
|
-
exports2.normalizeStyle = normalizeStyle;
|
|
576
|
-
exports2.objectToString = objectToString;
|
|
577
|
-
exports2.parseStringStyle = parseStringStyle;
|
|
578
|
-
exports2.propsToAttrMap = propsToAttrMap;
|
|
579
|
-
exports2.remove = remove;
|
|
580
|
-
exports2.slotFlagsText = slotFlagsText;
|
|
581
|
-
exports2.stringifyStyle = stringifyStyle;
|
|
582
|
-
exports2.toDisplayString = toDisplayString;
|
|
583
|
-
exports2.toHandlerKey = toHandlerKey;
|
|
584
|
-
exports2.toNumber = toNumber;
|
|
585
|
-
exports2.toRawType = toRawType;
|
|
586
|
-
exports2.toTypeString = toTypeString;
|
|
587
|
-
});
|
|
588
|
-
|
|
589
|
-
// node_modules/@vue/reactivity/dist/reactivity.cjs.js
|
|
590
|
-
var require_reactivity_cjs = __commonJS((exports2) => {
|
|
591
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
592
|
-
var shared = require_shared_cjs();
|
|
593
|
-
function warn(msg, ...args) {
|
|
594
|
-
console.warn(`[Vue warn] ${msg}`, ...args);
|
|
595
|
-
}
|
|
596
|
-
var activeEffectScope;
|
|
597
|
-
|
|
598
|
-
class EffectScope {
|
|
599
|
-
constructor(detached = false) {
|
|
600
|
-
this.detached = detached;
|
|
601
|
-
this._active = true;
|
|
602
|
-
this.effects = [];
|
|
603
|
-
this.cleanups = [];
|
|
604
|
-
this._isPaused = false;
|
|
605
|
-
this.parent = activeEffectScope;
|
|
606
|
-
if (!detached && activeEffectScope) {
|
|
607
|
-
this.index = (activeEffectScope.scopes || (activeEffectScope.scopes = [])).push(this) - 1;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
get active() {
|
|
611
|
-
return this._active;
|
|
612
|
-
}
|
|
613
|
-
pause() {
|
|
614
|
-
if (this._active) {
|
|
615
|
-
this._isPaused = true;
|
|
616
|
-
let i, l;
|
|
617
|
-
if (this.scopes) {
|
|
618
|
-
for (i = 0, l = this.scopes.length;i < l; i++) {
|
|
619
|
-
this.scopes[i].pause();
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
for (i = 0, l = this.effects.length;i < l; i++) {
|
|
623
|
-
this.effects[i].pause();
|
|
624
|
-
}
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
resume() {
|
|
628
|
-
if (this._active) {
|
|
629
|
-
if (this._isPaused) {
|
|
630
|
-
this._isPaused = false;
|
|
631
|
-
let i, l;
|
|
632
|
-
if (this.scopes) {
|
|
633
|
-
for (i = 0, l = this.scopes.length;i < l; i++) {
|
|
634
|
-
this.scopes[i].resume();
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
for (i = 0, l = this.effects.length;i < l; i++) {
|
|
638
|
-
this.effects[i].resume();
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
run(fn) {
|
|
644
|
-
if (this._active) {
|
|
645
|
-
const currentEffectScope = activeEffectScope;
|
|
646
|
-
try {
|
|
647
|
-
activeEffectScope = this;
|
|
648
|
-
return fn();
|
|
649
|
-
} finally {
|
|
650
|
-
activeEffectScope = currentEffectScope;
|
|
651
|
-
}
|
|
652
|
-
} else {
|
|
653
|
-
warn(`cannot run an inactive effect scope.`);
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
on() {
|
|
657
|
-
activeEffectScope = this;
|
|
658
|
-
}
|
|
659
|
-
off() {
|
|
660
|
-
activeEffectScope = this.parent;
|
|
661
|
-
}
|
|
662
|
-
stop(fromParent) {
|
|
663
|
-
if (this._active) {
|
|
664
|
-
this._active = false;
|
|
665
|
-
let i, l;
|
|
666
|
-
for (i = 0, l = this.effects.length;i < l; i++) {
|
|
667
|
-
this.effects[i].stop();
|
|
668
|
-
}
|
|
669
|
-
this.effects.length = 0;
|
|
670
|
-
for (i = 0, l = this.cleanups.length;i < l; i++) {
|
|
671
|
-
this.cleanups[i]();
|
|
672
|
-
}
|
|
673
|
-
this.cleanups.length = 0;
|
|
674
|
-
if (this.scopes) {
|
|
675
|
-
for (i = 0, l = this.scopes.length;i < l; i++) {
|
|
676
|
-
this.scopes[i].stop(true);
|
|
677
|
-
}
|
|
678
|
-
this.scopes.length = 0;
|
|
679
|
-
}
|
|
680
|
-
if (!this.detached && this.parent && !fromParent) {
|
|
681
|
-
const last = this.parent.scopes.pop();
|
|
682
|
-
if (last && last !== this) {
|
|
683
|
-
this.parent.scopes[this.index] = last;
|
|
684
|
-
last.index = this.index;
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
this.parent = undefined;
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
function effectScope(detached) {
|
|
692
|
-
return new EffectScope(detached);
|
|
693
|
-
}
|
|
694
|
-
function getCurrentScope() {
|
|
695
|
-
return activeEffectScope;
|
|
696
|
-
}
|
|
697
|
-
function onScopeDispose(fn, failSilently = false) {
|
|
698
|
-
if (activeEffectScope) {
|
|
699
|
-
activeEffectScope.cleanups.push(fn);
|
|
700
|
-
} else if (!failSilently) {
|
|
701
|
-
warn(`onScopeDispose() is called when there is no active effect scope to be associated with.`);
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
var activeSub;
|
|
705
|
-
var EffectFlags = {
|
|
706
|
-
ACTIVE: 1,
|
|
707
|
-
"1": "ACTIVE",
|
|
708
|
-
RUNNING: 2,
|
|
709
|
-
"2": "RUNNING",
|
|
710
|
-
TRACKING: 4,
|
|
711
|
-
"4": "TRACKING",
|
|
712
|
-
NOTIFIED: 8,
|
|
713
|
-
"8": "NOTIFIED",
|
|
714
|
-
DIRTY: 16,
|
|
715
|
-
"16": "DIRTY",
|
|
716
|
-
ALLOW_RECURSE: 32,
|
|
717
|
-
"32": "ALLOW_RECURSE",
|
|
718
|
-
PAUSED: 64,
|
|
719
|
-
"64": "PAUSED"
|
|
720
|
-
};
|
|
721
|
-
var pausedQueueEffects = /* @__PURE__ */ new WeakSet;
|
|
722
|
-
|
|
723
|
-
class ReactiveEffect {
|
|
724
|
-
constructor(fn) {
|
|
725
|
-
this.fn = fn;
|
|
726
|
-
this.deps = undefined;
|
|
727
|
-
this.depsTail = undefined;
|
|
728
|
-
this.flags = 1 | 4;
|
|
729
|
-
this.next = undefined;
|
|
730
|
-
this.cleanup = undefined;
|
|
731
|
-
this.scheduler = undefined;
|
|
732
|
-
if (activeEffectScope && activeEffectScope.active) {
|
|
733
|
-
activeEffectScope.effects.push(this);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
pause() {
|
|
737
|
-
this.flags |= 64;
|
|
738
|
-
}
|
|
739
|
-
resume() {
|
|
740
|
-
if (this.flags & 64) {
|
|
741
|
-
this.flags &= ~64;
|
|
742
|
-
if (pausedQueueEffects.has(this)) {
|
|
743
|
-
pausedQueueEffects.delete(this);
|
|
744
|
-
this.trigger();
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
notify() {
|
|
749
|
-
if (this.flags & 2 && !(this.flags & 32)) {
|
|
750
|
-
return;
|
|
751
|
-
}
|
|
752
|
-
if (!(this.flags & 8)) {
|
|
753
|
-
batch(this);
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
run() {
|
|
757
|
-
if (!(this.flags & 1)) {
|
|
758
|
-
return this.fn();
|
|
759
|
-
}
|
|
760
|
-
this.flags |= 2;
|
|
761
|
-
cleanupEffect3(this);
|
|
762
|
-
prepareDeps(this);
|
|
763
|
-
const prevEffect = activeSub;
|
|
764
|
-
const prevShouldTrack = shouldTrack;
|
|
765
|
-
activeSub = this;
|
|
766
|
-
shouldTrack = true;
|
|
767
|
-
try {
|
|
768
|
-
return this.fn();
|
|
769
|
-
} finally {
|
|
770
|
-
if (activeSub !== this) {
|
|
771
|
-
warn("Active effect was not restored correctly - this is likely a Vue internal bug.");
|
|
772
|
-
}
|
|
773
|
-
cleanupDeps(this);
|
|
774
|
-
activeSub = prevEffect;
|
|
775
|
-
shouldTrack = prevShouldTrack;
|
|
776
|
-
this.flags &= ~2;
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
stop() {
|
|
780
|
-
if (this.flags & 1) {
|
|
781
|
-
for (let link = this.deps;link; link = link.nextDep) {
|
|
782
|
-
removeSub(link);
|
|
783
|
-
}
|
|
784
|
-
this.deps = this.depsTail = undefined;
|
|
785
|
-
cleanupEffect3(this);
|
|
786
|
-
this.onStop && this.onStop();
|
|
787
|
-
this.flags &= ~1;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
trigger() {
|
|
791
|
-
if (this.flags & 64) {
|
|
792
|
-
pausedQueueEffects.add(this);
|
|
793
|
-
} else if (this.scheduler) {
|
|
794
|
-
this.scheduler();
|
|
795
|
-
} else {
|
|
796
|
-
this.runIfDirty();
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
runIfDirty() {
|
|
800
|
-
if (isDirty(this)) {
|
|
801
|
-
this.run();
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
get dirty() {
|
|
805
|
-
return isDirty(this);
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
var batchDepth = 0;
|
|
809
|
-
var batchedSub;
|
|
810
|
-
var batchedComputed;
|
|
811
|
-
function batch(sub, isComputed2 = false) {
|
|
812
|
-
sub.flags |= 8;
|
|
813
|
-
if (isComputed2) {
|
|
814
|
-
sub.next = batchedComputed;
|
|
815
|
-
batchedComputed = sub;
|
|
816
|
-
return;
|
|
817
|
-
}
|
|
818
|
-
sub.next = batchedSub;
|
|
819
|
-
batchedSub = sub;
|
|
820
|
-
}
|
|
821
|
-
function startBatch() {
|
|
822
|
-
batchDepth++;
|
|
823
|
-
}
|
|
824
|
-
function endBatch() {
|
|
825
|
-
if (--batchDepth > 0) {
|
|
826
|
-
return;
|
|
827
|
-
}
|
|
828
|
-
if (batchedComputed) {
|
|
829
|
-
let e = batchedComputed;
|
|
830
|
-
batchedComputed = undefined;
|
|
831
|
-
while (e) {
|
|
832
|
-
const next = e.next;
|
|
833
|
-
e.next = undefined;
|
|
834
|
-
e.flags &= ~8;
|
|
835
|
-
e = next;
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
let error;
|
|
839
|
-
while (batchedSub) {
|
|
840
|
-
let e = batchedSub;
|
|
841
|
-
batchedSub = undefined;
|
|
842
|
-
while (e) {
|
|
843
|
-
const next = e.next;
|
|
844
|
-
e.next = undefined;
|
|
845
|
-
e.flags &= ~8;
|
|
846
|
-
if (e.flags & 1) {
|
|
847
|
-
try {
|
|
848
|
-
e.trigger();
|
|
849
|
-
} catch (err) {
|
|
850
|
-
if (!error)
|
|
851
|
-
error = err;
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
e = next;
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
if (error)
|
|
858
|
-
throw error;
|
|
859
|
-
}
|
|
860
|
-
function prepareDeps(sub) {
|
|
861
|
-
for (let link = sub.deps;link; link = link.nextDep) {
|
|
862
|
-
link.version = -1;
|
|
863
|
-
link.prevActiveLink = link.dep.activeLink;
|
|
864
|
-
link.dep.activeLink = link;
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
function cleanupDeps(sub) {
|
|
868
|
-
let head;
|
|
869
|
-
let tail = sub.depsTail;
|
|
870
|
-
let link = tail;
|
|
871
|
-
while (link) {
|
|
872
|
-
const prev = link.prevDep;
|
|
873
|
-
if (link.version === -1) {
|
|
874
|
-
if (link === tail)
|
|
875
|
-
tail = prev;
|
|
876
|
-
removeSub(link);
|
|
877
|
-
removeDep(link);
|
|
878
|
-
} else {
|
|
879
|
-
head = link;
|
|
880
|
-
}
|
|
881
|
-
link.dep.activeLink = link.prevActiveLink;
|
|
882
|
-
link.prevActiveLink = undefined;
|
|
883
|
-
link = prev;
|
|
884
|
-
}
|
|
885
|
-
sub.deps = head;
|
|
886
|
-
sub.depsTail = tail;
|
|
887
|
-
}
|
|
888
|
-
function isDirty(sub) {
|
|
889
|
-
for (let link = sub.deps;link; link = link.nextDep) {
|
|
890
|
-
if (link.dep.version !== link.version || link.dep.computed && (refreshComputed(link.dep.computed) || link.dep.version !== link.version)) {
|
|
891
|
-
return true;
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
if (sub._dirty) {
|
|
895
|
-
return true;
|
|
896
|
-
}
|
|
897
|
-
return false;
|
|
898
|
-
}
|
|
899
|
-
function refreshComputed(computed3) {
|
|
900
|
-
if (computed3.flags & 4 && !(computed3.flags & 16)) {
|
|
901
|
-
return;
|
|
902
|
-
}
|
|
903
|
-
computed3.flags &= ~16;
|
|
904
|
-
if (computed3.globalVersion === globalVersion) {
|
|
905
|
-
return;
|
|
906
|
-
}
|
|
907
|
-
computed3.globalVersion = globalVersion;
|
|
908
|
-
const dep = computed3.dep;
|
|
909
|
-
computed3.flags |= 2;
|
|
910
|
-
if (dep.version > 0 && !computed3.isSSR && computed3.deps && !isDirty(computed3)) {
|
|
911
|
-
computed3.flags &= ~2;
|
|
912
|
-
return;
|
|
913
|
-
}
|
|
914
|
-
const prevSub = activeSub;
|
|
915
|
-
const prevShouldTrack = shouldTrack;
|
|
916
|
-
activeSub = computed3;
|
|
917
|
-
shouldTrack = true;
|
|
918
|
-
try {
|
|
919
|
-
prepareDeps(computed3);
|
|
920
|
-
const value = computed3.fn(computed3._value);
|
|
921
|
-
if (dep.version === 0 || shared.hasChanged(value, computed3._value)) {
|
|
922
|
-
computed3._value = value;
|
|
923
|
-
dep.version++;
|
|
924
|
-
}
|
|
925
|
-
} catch (err) {
|
|
926
|
-
dep.version++;
|
|
927
|
-
throw err;
|
|
928
|
-
} finally {
|
|
929
|
-
activeSub = prevSub;
|
|
930
|
-
shouldTrack = prevShouldTrack;
|
|
931
|
-
cleanupDeps(computed3);
|
|
932
|
-
computed3.flags &= ~2;
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
function removeSub(link, soft = false) {
|
|
936
|
-
const { dep, prevSub, nextSub } = link;
|
|
937
|
-
if (prevSub) {
|
|
938
|
-
prevSub.nextSub = nextSub;
|
|
939
|
-
link.prevSub = undefined;
|
|
940
|
-
}
|
|
941
|
-
if (nextSub) {
|
|
942
|
-
nextSub.prevSub = prevSub;
|
|
943
|
-
link.nextSub = undefined;
|
|
944
|
-
}
|
|
945
|
-
if (dep.subsHead === link) {
|
|
946
|
-
dep.subsHead = nextSub;
|
|
947
|
-
}
|
|
948
|
-
if (dep.subs === link) {
|
|
949
|
-
dep.subs = prevSub;
|
|
950
|
-
if (!prevSub && dep.computed) {
|
|
951
|
-
dep.computed.flags &= ~4;
|
|
952
|
-
for (let l = dep.computed.deps;l; l = l.nextDep) {
|
|
953
|
-
removeSub(l, true);
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
if (!soft && !--dep.sc && dep.map) {
|
|
958
|
-
dep.map.delete(dep.key);
|
|
959
|
-
}
|
|
960
|
-
}
|
|
961
|
-
function removeDep(link) {
|
|
962
|
-
const { prevDep, nextDep } = link;
|
|
963
|
-
if (prevDep) {
|
|
964
|
-
prevDep.nextDep = nextDep;
|
|
965
|
-
link.prevDep = undefined;
|
|
966
|
-
}
|
|
967
|
-
if (nextDep) {
|
|
968
|
-
nextDep.prevDep = prevDep;
|
|
969
|
-
link.nextDep = undefined;
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
function effect(fn, options) {
|
|
973
|
-
if (fn.effect instanceof ReactiveEffect) {
|
|
974
|
-
fn = fn.effect.fn;
|
|
975
|
-
}
|
|
976
|
-
const e = new ReactiveEffect(fn);
|
|
977
|
-
if (options) {
|
|
978
|
-
shared.extend(e, options);
|
|
979
|
-
}
|
|
980
|
-
try {
|
|
981
|
-
e.run();
|
|
982
|
-
} catch (err) {
|
|
983
|
-
e.stop();
|
|
984
|
-
throw err;
|
|
985
|
-
}
|
|
986
|
-
const runner = e.run.bind(e);
|
|
987
|
-
runner.effect = e;
|
|
988
|
-
return runner;
|
|
989
|
-
}
|
|
990
|
-
function stop(runner) {
|
|
991
|
-
runner.effect.stop();
|
|
992
|
-
}
|
|
993
|
-
var shouldTrack = true;
|
|
994
|
-
var trackStack = [];
|
|
995
|
-
function pauseTracking() {
|
|
996
|
-
trackStack.push(shouldTrack);
|
|
997
|
-
shouldTrack = false;
|
|
998
|
-
}
|
|
999
|
-
function enableTracking() {
|
|
1000
|
-
trackStack.push(shouldTrack);
|
|
1001
|
-
shouldTrack = true;
|
|
1002
|
-
}
|
|
1003
|
-
function resetTracking() {
|
|
1004
|
-
const last = trackStack.pop();
|
|
1005
|
-
shouldTrack = last === undefined ? true : last;
|
|
1006
|
-
}
|
|
1007
|
-
function onEffectCleanup(fn, failSilently = false) {
|
|
1008
|
-
if (activeSub instanceof ReactiveEffect) {
|
|
1009
|
-
activeSub.cleanup = fn;
|
|
1010
|
-
} else if (!failSilently) {
|
|
1011
|
-
warn(`onEffectCleanup() was called when there was no active effect to associate with.`);
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
function cleanupEffect3(e) {
|
|
1015
|
-
const { cleanup } = e;
|
|
1016
|
-
e.cleanup = undefined;
|
|
1017
|
-
if (cleanup) {
|
|
1018
|
-
const prevSub = activeSub;
|
|
1019
|
-
activeSub = undefined;
|
|
1020
|
-
try {
|
|
1021
|
-
cleanup();
|
|
1022
|
-
} finally {
|
|
1023
|
-
activeSub = prevSub;
|
|
1024
|
-
}
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
var globalVersion = 0;
|
|
1028
|
-
|
|
1029
|
-
class Link {
|
|
1030
|
-
constructor(sub, dep) {
|
|
1031
|
-
this.sub = sub;
|
|
1032
|
-
this.dep = dep;
|
|
1033
|
-
this.version = dep.version;
|
|
1034
|
-
this.nextDep = this.prevDep = this.nextSub = this.prevSub = this.prevActiveLink = undefined;
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
class Dep {
|
|
1039
|
-
constructor(computed3) {
|
|
1040
|
-
this.computed = computed3;
|
|
1041
|
-
this.version = 0;
|
|
1042
|
-
this.activeLink = undefined;
|
|
1043
|
-
this.subs = undefined;
|
|
1044
|
-
this.map = undefined;
|
|
1045
|
-
this.key = undefined;
|
|
1046
|
-
this.sc = 0;
|
|
1047
|
-
{
|
|
1048
|
-
this.subsHead = undefined;
|
|
1049
|
-
}
|
|
1050
|
-
}
|
|
1051
|
-
track(debugInfo) {
|
|
1052
|
-
if (!activeSub || !shouldTrack || activeSub === this.computed) {
|
|
1053
|
-
return;
|
|
1054
|
-
}
|
|
1055
|
-
let link = this.activeLink;
|
|
1056
|
-
if (link === undefined || link.sub !== activeSub) {
|
|
1057
|
-
link = this.activeLink = new Link(activeSub, this);
|
|
1058
|
-
if (!activeSub.deps) {
|
|
1059
|
-
activeSub.deps = activeSub.depsTail = link;
|
|
1060
|
-
} else {
|
|
1061
|
-
link.prevDep = activeSub.depsTail;
|
|
1062
|
-
activeSub.depsTail.nextDep = link;
|
|
1063
|
-
activeSub.depsTail = link;
|
|
1064
|
-
}
|
|
1065
|
-
addSub(link);
|
|
1066
|
-
} else if (link.version === -1) {
|
|
1067
|
-
link.version = this.version;
|
|
1068
|
-
if (link.nextDep) {
|
|
1069
|
-
const next = link.nextDep;
|
|
1070
|
-
next.prevDep = link.prevDep;
|
|
1071
|
-
if (link.prevDep) {
|
|
1072
|
-
link.prevDep.nextDep = next;
|
|
1073
|
-
}
|
|
1074
|
-
link.prevDep = activeSub.depsTail;
|
|
1075
|
-
link.nextDep = undefined;
|
|
1076
|
-
activeSub.depsTail.nextDep = link;
|
|
1077
|
-
activeSub.depsTail = link;
|
|
1078
|
-
if (activeSub.deps === link) {
|
|
1079
|
-
activeSub.deps = next;
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
if (activeSub.onTrack) {
|
|
1084
|
-
activeSub.onTrack(shared.extend({
|
|
1085
|
-
effect: activeSub
|
|
1086
|
-
}, debugInfo));
|
|
1087
|
-
}
|
|
1088
|
-
return link;
|
|
1089
|
-
}
|
|
1090
|
-
trigger(debugInfo) {
|
|
1091
|
-
this.version++;
|
|
1092
|
-
globalVersion++;
|
|
1093
|
-
this.notify(debugInfo);
|
|
1094
|
-
}
|
|
1095
|
-
notify(debugInfo) {
|
|
1096
|
-
startBatch();
|
|
1097
|
-
try {
|
|
1098
|
-
if (true) {
|
|
1099
|
-
for (let head = this.subsHead;head; head = head.nextSub) {
|
|
1100
|
-
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
1101
|
-
head.sub.onTrigger(shared.extend({
|
|
1102
|
-
effect: head.sub
|
|
1103
|
-
}, debugInfo));
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
}
|
|
1107
|
-
for (let link = this.subs;link; link = link.prevSub) {
|
|
1108
|
-
if (link.sub.notify()) {
|
|
1109
|
-
link.sub.dep.notify();
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
} finally {
|
|
1113
|
-
endBatch();
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
function addSub(link) {
|
|
1118
|
-
link.dep.sc++;
|
|
1119
|
-
if (link.sub.flags & 4) {
|
|
1120
|
-
const computed3 = link.dep.computed;
|
|
1121
|
-
if (computed3 && !link.dep.subs) {
|
|
1122
|
-
computed3.flags |= 4 | 16;
|
|
1123
|
-
for (let l = computed3.deps;l; l = l.nextDep) {
|
|
1124
|
-
addSub(l);
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
const currentTail = link.dep.subs;
|
|
1128
|
-
if (currentTail !== link) {
|
|
1129
|
-
link.prevSub = currentTail;
|
|
1130
|
-
if (currentTail)
|
|
1131
|
-
currentTail.nextSub = link;
|
|
1132
|
-
}
|
|
1133
|
-
if (link.dep.subsHead === undefined) {
|
|
1134
|
-
link.dep.subsHead = link;
|
|
1135
|
-
}
|
|
1136
|
-
link.dep.subs = link;
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
var targetMap2 = /* @__PURE__ */ new WeakMap;
|
|
1140
|
-
var ITERATE_KEY = Symbol("Object iterate");
|
|
1141
|
-
var MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate");
|
|
1142
|
-
var ARRAY_ITERATE_KEY = Symbol("Array iterate");
|
|
1143
|
-
function track2(target, type, key) {
|
|
1144
|
-
if (shouldTrack && activeSub) {
|
|
1145
|
-
let depsMap = targetMap2.get(target);
|
|
1146
|
-
if (!depsMap) {
|
|
1147
|
-
targetMap2.set(target, depsMap = /* @__PURE__ */ new Map);
|
|
1148
|
-
}
|
|
1149
|
-
let dep = depsMap.get(key);
|
|
1150
|
-
if (!dep) {
|
|
1151
|
-
depsMap.set(key, dep = new Dep);
|
|
1152
|
-
dep.map = depsMap;
|
|
1153
|
-
dep.key = key;
|
|
1154
|
-
}
|
|
1155
|
-
{
|
|
1156
|
-
dep.track({
|
|
1157
|
-
target,
|
|
1158
|
-
type,
|
|
1159
|
-
key
|
|
1160
|
-
});
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
function trigger2(target, type, key, newValue, oldValue, oldTarget) {
|
|
1165
|
-
const depsMap = targetMap2.get(target);
|
|
1166
|
-
if (!depsMap) {
|
|
1167
|
-
globalVersion++;
|
|
1168
|
-
return;
|
|
1169
|
-
}
|
|
1170
|
-
const run = (dep) => {
|
|
1171
|
-
if (dep) {
|
|
1172
|
-
{
|
|
1173
|
-
dep.trigger({
|
|
1174
|
-
target,
|
|
1175
|
-
type,
|
|
1176
|
-
key,
|
|
1177
|
-
newValue,
|
|
1178
|
-
oldValue,
|
|
1179
|
-
oldTarget
|
|
1180
|
-
});
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
};
|
|
1184
|
-
startBatch();
|
|
1185
|
-
if (type === "clear") {
|
|
1186
|
-
depsMap.forEach(run);
|
|
1187
|
-
} else {
|
|
1188
|
-
const targetIsArray = shared.isArray(target);
|
|
1189
|
-
const isArrayIndex = targetIsArray && shared.isIntegerKey(key);
|
|
1190
|
-
if (targetIsArray && key === "length") {
|
|
1191
|
-
const newLength = Number(newValue);
|
|
1192
|
-
depsMap.forEach((dep, key2) => {
|
|
1193
|
-
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !shared.isSymbol(key2) && key2 >= newLength) {
|
|
1194
|
-
run(dep);
|
|
1195
|
-
}
|
|
1196
|
-
});
|
|
1197
|
-
} else {
|
|
1198
|
-
if (key !== undefined || depsMap.has(undefined)) {
|
|
1199
|
-
run(depsMap.get(key));
|
|
1200
|
-
}
|
|
1201
|
-
if (isArrayIndex) {
|
|
1202
|
-
run(depsMap.get(ARRAY_ITERATE_KEY));
|
|
1203
|
-
}
|
|
1204
|
-
switch (type) {
|
|
1205
|
-
case "add":
|
|
1206
|
-
if (!targetIsArray) {
|
|
1207
|
-
run(depsMap.get(ITERATE_KEY));
|
|
1208
|
-
if (shared.isMap(target)) {
|
|
1209
|
-
run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
1210
|
-
}
|
|
1211
|
-
} else if (isArrayIndex) {
|
|
1212
|
-
run(depsMap.get("length"));
|
|
1213
|
-
}
|
|
1214
|
-
break;
|
|
1215
|
-
case "delete":
|
|
1216
|
-
if (!targetIsArray) {
|
|
1217
|
-
run(depsMap.get(ITERATE_KEY));
|
|
1218
|
-
if (shared.isMap(target)) {
|
|
1219
|
-
run(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
break;
|
|
1223
|
-
case "set":
|
|
1224
|
-
if (shared.isMap(target)) {
|
|
1225
|
-
run(depsMap.get(ITERATE_KEY));
|
|
1226
|
-
}
|
|
1227
|
-
break;
|
|
1228
|
-
}
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
endBatch();
|
|
1232
|
-
}
|
|
1233
|
-
function getDepFromReactive(object, key) {
|
|
1234
|
-
const depMap = targetMap2.get(object);
|
|
1235
|
-
return depMap && depMap.get(key);
|
|
1236
|
-
}
|
|
1237
|
-
function reactiveReadArray(array) {
|
|
1238
|
-
const raw = toRaw2(array);
|
|
1239
|
-
if (raw === array)
|
|
1240
|
-
return raw;
|
|
1241
|
-
track2(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
1242
|
-
return isShallow(array) ? raw : raw.map(toReactive);
|
|
1243
|
-
}
|
|
1244
|
-
function shallowReadArray(arr) {
|
|
1245
|
-
track2(arr = toRaw2(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
1246
|
-
return arr;
|
|
1247
|
-
}
|
|
1248
|
-
var arrayInstrumentations = {
|
|
1249
|
-
__proto__: null,
|
|
1250
|
-
[Symbol.iterator]() {
|
|
1251
|
-
return iterator(this, Symbol.iterator, toReactive);
|
|
1252
|
-
},
|
|
1253
|
-
concat(...args) {
|
|
1254
|
-
return reactiveReadArray(this).concat(...args.map((x) => shared.isArray(x) ? reactiveReadArray(x) : x));
|
|
1255
|
-
},
|
|
1256
|
-
entries() {
|
|
1257
|
-
return iterator(this, "entries", (value) => {
|
|
1258
|
-
value[1] = toReactive(value[1]);
|
|
1259
|
-
return value;
|
|
1260
|
-
});
|
|
1261
|
-
},
|
|
1262
|
-
every(fn, thisArg) {
|
|
1263
|
-
return apply(this, "every", fn, thisArg, undefined, arguments);
|
|
1264
|
-
},
|
|
1265
|
-
filter(fn, thisArg) {
|
|
1266
|
-
return apply(this, "filter", fn, thisArg, (v) => v.map(toReactive), arguments);
|
|
1267
|
-
},
|
|
1268
|
-
find(fn, thisArg) {
|
|
1269
|
-
return apply(this, "find", fn, thisArg, toReactive, arguments);
|
|
1270
|
-
},
|
|
1271
|
-
findIndex(fn, thisArg) {
|
|
1272
|
-
return apply(this, "findIndex", fn, thisArg, undefined, arguments);
|
|
1273
|
-
},
|
|
1274
|
-
findLast(fn, thisArg) {
|
|
1275
|
-
return apply(this, "findLast", fn, thisArg, toReactive, arguments);
|
|
1276
|
-
},
|
|
1277
|
-
findLastIndex(fn, thisArg) {
|
|
1278
|
-
return apply(this, "findLastIndex", fn, thisArg, undefined, arguments);
|
|
1279
|
-
},
|
|
1280
|
-
forEach(fn, thisArg) {
|
|
1281
|
-
return apply(this, "forEach", fn, thisArg, undefined, arguments);
|
|
1282
|
-
},
|
|
1283
|
-
includes(...args) {
|
|
1284
|
-
return searchProxy(this, "includes", args);
|
|
1285
|
-
},
|
|
1286
|
-
indexOf(...args) {
|
|
1287
|
-
return searchProxy(this, "indexOf", args);
|
|
1288
|
-
},
|
|
1289
|
-
join(separator) {
|
|
1290
|
-
return reactiveReadArray(this).join(separator);
|
|
1291
|
-
},
|
|
1292
|
-
lastIndexOf(...args) {
|
|
1293
|
-
return searchProxy(this, "lastIndexOf", args);
|
|
1294
|
-
},
|
|
1295
|
-
map(fn, thisArg) {
|
|
1296
|
-
return apply(this, "map", fn, thisArg, undefined, arguments);
|
|
1297
|
-
},
|
|
1298
|
-
pop() {
|
|
1299
|
-
return noTracking(this, "pop");
|
|
1300
|
-
},
|
|
1301
|
-
push(...args) {
|
|
1302
|
-
return noTracking(this, "push", args);
|
|
1303
|
-
},
|
|
1304
|
-
reduce(fn, ...args) {
|
|
1305
|
-
return reduce(this, "reduce", fn, args);
|
|
1306
|
-
},
|
|
1307
|
-
reduceRight(fn, ...args) {
|
|
1308
|
-
return reduce(this, "reduceRight", fn, args);
|
|
1309
|
-
},
|
|
1310
|
-
shift() {
|
|
1311
|
-
return noTracking(this, "shift");
|
|
1312
|
-
},
|
|
1313
|
-
some(fn, thisArg) {
|
|
1314
|
-
return apply(this, "some", fn, thisArg, undefined, arguments);
|
|
1315
|
-
},
|
|
1316
|
-
splice(...args) {
|
|
1317
|
-
return noTracking(this, "splice", args);
|
|
1318
|
-
},
|
|
1319
|
-
toReversed() {
|
|
1320
|
-
return reactiveReadArray(this).toReversed();
|
|
1321
|
-
},
|
|
1322
|
-
toSorted(comparer) {
|
|
1323
|
-
return reactiveReadArray(this).toSorted(comparer);
|
|
1324
|
-
},
|
|
1325
|
-
toSpliced(...args) {
|
|
1326
|
-
return reactiveReadArray(this).toSpliced(...args);
|
|
1327
|
-
},
|
|
1328
|
-
unshift(...args) {
|
|
1329
|
-
return noTracking(this, "unshift", args);
|
|
1330
|
-
},
|
|
1331
|
-
values() {
|
|
1332
|
-
return iterator(this, "values", toReactive);
|
|
1333
|
-
}
|
|
1334
|
-
};
|
|
1335
|
-
function iterator(self2, method, wrapValue) {
|
|
1336
|
-
const arr = shallowReadArray(self2);
|
|
1337
|
-
const iter = arr[method]();
|
|
1338
|
-
if (arr !== self2 && !isShallow(self2)) {
|
|
1339
|
-
iter._next = iter.next;
|
|
1340
|
-
iter.next = () => {
|
|
1341
|
-
const result = iter._next();
|
|
1342
|
-
if (result.value) {
|
|
1343
|
-
result.value = wrapValue(result.value);
|
|
1344
|
-
}
|
|
1345
|
-
return result;
|
|
1346
|
-
};
|
|
1347
|
-
}
|
|
1348
|
-
return iter;
|
|
1349
|
-
}
|
|
1350
|
-
var arrayProto = Array.prototype;
|
|
1351
|
-
function apply(self2, method, fn, thisArg, wrappedRetFn, args) {
|
|
1352
|
-
const arr = shallowReadArray(self2);
|
|
1353
|
-
const needsWrap = arr !== self2 && !isShallow(self2);
|
|
1354
|
-
const methodFn = arr[method];
|
|
1355
|
-
if (methodFn !== arrayProto[method]) {
|
|
1356
|
-
const result2 = methodFn.apply(self2, args);
|
|
1357
|
-
return needsWrap ? toReactive(result2) : result2;
|
|
1358
|
-
}
|
|
1359
|
-
let wrappedFn = fn;
|
|
1360
|
-
if (arr !== self2) {
|
|
1361
|
-
if (needsWrap) {
|
|
1362
|
-
wrappedFn = function(item, index) {
|
|
1363
|
-
return fn.call(this, toReactive(item), index, self2);
|
|
1364
|
-
};
|
|
1365
|
-
} else if (fn.length > 2) {
|
|
1366
|
-
wrappedFn = function(item, index) {
|
|
1367
|
-
return fn.call(this, item, index, self2);
|
|
1368
|
-
};
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
|
-
const result = methodFn.call(arr, wrappedFn, thisArg);
|
|
1372
|
-
return needsWrap && wrappedRetFn ? wrappedRetFn(result) : result;
|
|
1373
|
-
}
|
|
1374
|
-
function reduce(self2, method, fn, args) {
|
|
1375
|
-
const arr = shallowReadArray(self2);
|
|
1376
|
-
let wrappedFn = fn;
|
|
1377
|
-
if (arr !== self2) {
|
|
1378
|
-
if (!isShallow(self2)) {
|
|
1379
|
-
wrappedFn = function(acc, item, index) {
|
|
1380
|
-
return fn.call(this, acc, toReactive(item), index, self2);
|
|
1381
|
-
};
|
|
1382
|
-
} else if (fn.length > 3) {
|
|
1383
|
-
wrappedFn = function(acc, item, index) {
|
|
1384
|
-
return fn.call(this, acc, item, index, self2);
|
|
1385
|
-
};
|
|
1386
|
-
}
|
|
1387
|
-
}
|
|
1388
|
-
return arr[method](wrappedFn, ...args);
|
|
1389
|
-
}
|
|
1390
|
-
function searchProxy(self2, method, args) {
|
|
1391
|
-
const arr = toRaw2(self2);
|
|
1392
|
-
track2(arr, "iterate", ARRAY_ITERATE_KEY);
|
|
1393
|
-
const res = arr[method](...args);
|
|
1394
|
-
if ((res === -1 || res === false) && isProxy(args[0])) {
|
|
1395
|
-
args[0] = toRaw2(args[0]);
|
|
1396
|
-
return arr[method](...args);
|
|
1397
|
-
}
|
|
1398
|
-
return res;
|
|
1399
|
-
}
|
|
1400
|
-
function noTracking(self2, method, args = []) {
|
|
1401
|
-
pauseTracking();
|
|
1402
|
-
startBatch();
|
|
1403
|
-
const res = toRaw2(self2)[method].apply(self2, args);
|
|
1404
|
-
endBatch();
|
|
1405
|
-
resetTracking();
|
|
1406
|
-
return res;
|
|
1407
|
-
}
|
|
1408
|
-
var isNonTrackableKeys = /* @__PURE__ */ shared.makeMap(`__proto__,__v_isRef,__isVue`);
|
|
1409
|
-
var builtInSymbols = new Set(/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(shared.isSymbol));
|
|
1410
|
-
function hasOwnProperty(key) {
|
|
1411
|
-
if (!shared.isSymbol(key))
|
|
1412
|
-
key = String(key);
|
|
1413
|
-
const obj = toRaw2(this);
|
|
1414
|
-
track2(obj, "has", key);
|
|
1415
|
-
return obj.hasOwnProperty(key);
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
class BaseReactiveHandler {
|
|
1419
|
-
constructor(_isReadonly = false, _isShallow = false) {
|
|
1420
|
-
this._isReadonly = _isReadonly;
|
|
1421
|
-
this._isShallow = _isShallow;
|
|
1422
|
-
}
|
|
1423
|
-
get(target, key, receiver) {
|
|
1424
|
-
if (key === "__v_skip")
|
|
1425
|
-
return target["__v_skip"];
|
|
1426
|
-
const isReadonly2 = this._isReadonly, isShallow2 = this._isShallow;
|
|
1427
|
-
if (key === "__v_isReactive") {
|
|
1428
|
-
return !isReadonly2;
|
|
1429
|
-
} else if (key === "__v_isReadonly") {
|
|
1430
|
-
return isReadonly2;
|
|
1431
|
-
} else if (key === "__v_isShallow") {
|
|
1432
|
-
return isShallow2;
|
|
1433
|
-
} else if (key === "__v_raw") {
|
|
1434
|
-
if (receiver === (isReadonly2 ? isShallow2 ? shallowReadonlyMap : readonlyMap : isShallow2 ? shallowReactiveMap : reactiveMap).get(target) || Object.getPrototypeOf(target) === Object.getPrototypeOf(receiver)) {
|
|
1435
|
-
return target;
|
|
1436
|
-
}
|
|
1437
|
-
return;
|
|
1438
|
-
}
|
|
1439
|
-
const targetIsArray = shared.isArray(target);
|
|
1440
|
-
if (!isReadonly2) {
|
|
1441
|
-
let fn;
|
|
1442
|
-
if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
|
1443
|
-
return fn;
|
|
1444
|
-
}
|
|
1445
|
-
if (key === "hasOwnProperty") {
|
|
1446
|
-
return hasOwnProperty;
|
|
1447
|
-
}
|
|
1448
|
-
}
|
|
1449
|
-
const res = Reflect.get(target, key, isRef3(target) ? target : receiver);
|
|
1450
|
-
if (shared.isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
1451
|
-
return res;
|
|
1452
|
-
}
|
|
1453
|
-
if (!isReadonly2) {
|
|
1454
|
-
track2(target, "get", key);
|
|
1455
|
-
}
|
|
1456
|
-
if (isShallow2) {
|
|
1457
|
-
return res;
|
|
1458
|
-
}
|
|
1459
|
-
if (isRef3(res)) {
|
|
1460
|
-
return targetIsArray && shared.isIntegerKey(key) ? res : res.value;
|
|
1461
|
-
}
|
|
1462
|
-
if (shared.isObject(res)) {
|
|
1463
|
-
return isReadonly2 ? readonly(res) : reactive2(res);
|
|
1464
|
-
}
|
|
1465
|
-
return res;
|
|
1466
|
-
}
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
|
-
class MutableReactiveHandler extends BaseReactiveHandler {
|
|
1470
|
-
constructor(isShallow2 = false) {
|
|
1471
|
-
super(false, isShallow2);
|
|
1472
|
-
}
|
|
1473
|
-
set(target, key, value, receiver) {
|
|
1474
|
-
let oldValue = target[key];
|
|
1475
|
-
if (!this._isShallow) {
|
|
1476
|
-
const isOldValueReadonly = isReadonly(oldValue);
|
|
1477
|
-
if (!isShallow(value) && !isReadonly(value)) {
|
|
1478
|
-
oldValue = toRaw2(oldValue);
|
|
1479
|
-
value = toRaw2(value);
|
|
1480
|
-
}
|
|
1481
|
-
if (!shared.isArray(target) && isRef3(oldValue) && !isRef3(value)) {
|
|
1482
|
-
if (isOldValueReadonly) {
|
|
1483
|
-
return false;
|
|
1484
|
-
} else {
|
|
1485
|
-
oldValue.value = value;
|
|
1486
|
-
return true;
|
|
1487
|
-
}
|
|
1488
|
-
}
|
|
1489
|
-
}
|
|
1490
|
-
const hadKey = shared.isArray(target) && shared.isIntegerKey(key) ? Number(key) < target.length : shared.hasOwn(target, key);
|
|
1491
|
-
const result = Reflect.set(target, key, value, isRef3(target) ? target : receiver);
|
|
1492
|
-
if (target === toRaw2(receiver)) {
|
|
1493
|
-
if (!hadKey) {
|
|
1494
|
-
trigger2(target, "add", key, value);
|
|
1495
|
-
} else if (shared.hasChanged(value, oldValue)) {
|
|
1496
|
-
trigger2(target, "set", key, value, oldValue);
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
return result;
|
|
1500
|
-
}
|
|
1501
|
-
deleteProperty(target, key) {
|
|
1502
|
-
const hadKey = shared.hasOwn(target, key);
|
|
1503
|
-
const oldValue = target[key];
|
|
1504
|
-
const result = Reflect.deleteProperty(target, key);
|
|
1505
|
-
if (result && hadKey) {
|
|
1506
|
-
trigger2(target, "delete", key, undefined, oldValue);
|
|
1507
|
-
}
|
|
1508
|
-
return result;
|
|
1509
|
-
}
|
|
1510
|
-
has(target, key) {
|
|
1511
|
-
const result = Reflect.has(target, key);
|
|
1512
|
-
if (!shared.isSymbol(key) || !builtInSymbols.has(key)) {
|
|
1513
|
-
track2(target, "has", key);
|
|
1514
|
-
}
|
|
1515
|
-
return result;
|
|
1516
|
-
}
|
|
1517
|
-
ownKeys(target) {
|
|
1518
|
-
track2(target, "iterate", shared.isArray(target) ? "length" : ITERATE_KEY);
|
|
1519
|
-
return Reflect.ownKeys(target);
|
|
1520
|
-
}
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
class ReadonlyReactiveHandler extends BaseReactiveHandler {
|
|
1524
|
-
constructor(isShallow2 = false) {
|
|
1525
|
-
super(true, isShallow2);
|
|
1526
|
-
}
|
|
1527
|
-
set(target, key) {
|
|
1528
|
-
{
|
|
1529
|
-
warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
1530
|
-
}
|
|
1531
|
-
return true;
|
|
1532
|
-
}
|
|
1533
|
-
deleteProperty(target, key) {
|
|
1534
|
-
{
|
|
1535
|
-
warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
|
|
1536
|
-
}
|
|
1537
|
-
return true;
|
|
1538
|
-
}
|
|
1539
|
-
}
|
|
1540
|
-
var mutableHandlers = /* @__PURE__ */ new MutableReactiveHandler;
|
|
1541
|
-
var readonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler;
|
|
1542
|
-
var shallowReactiveHandlers = /* @__PURE__ */ new MutableReactiveHandler(true);
|
|
1543
|
-
var shallowReadonlyHandlers = /* @__PURE__ */ new ReadonlyReactiveHandler(true);
|
|
1544
|
-
var toShallow = (value) => value;
|
|
1545
|
-
var getProto = (v) => Reflect.getPrototypeOf(v);
|
|
1546
|
-
function createIterableMethod(method, isReadonly2, isShallow2) {
|
|
1547
|
-
return function(...args) {
|
|
1548
|
-
const target = this["__v_raw"];
|
|
1549
|
-
const rawTarget = toRaw2(target);
|
|
1550
|
-
const targetIsMap = shared.isMap(rawTarget);
|
|
1551
|
-
const isPair = method === "entries" || method === Symbol.iterator && targetIsMap;
|
|
1552
|
-
const isKeyOnly = method === "keys" && targetIsMap;
|
|
1553
|
-
const innerIterator = target[method](...args);
|
|
1554
|
-
const wrap = isShallow2 ? toShallow : isReadonly2 ? toReadonly : toReactive;
|
|
1555
|
-
!isReadonly2 && track2(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
|
1556
|
-
return {
|
|
1557
|
-
next() {
|
|
1558
|
-
const { value, done } = innerIterator.next();
|
|
1559
|
-
return done ? { value, done } : {
|
|
1560
|
-
value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value),
|
|
1561
|
-
done
|
|
1562
|
-
};
|
|
1563
|
-
},
|
|
1564
|
-
[Symbol.iterator]() {
|
|
1565
|
-
return this;
|
|
1566
|
-
}
|
|
1567
|
-
};
|
|
1568
|
-
};
|
|
1569
|
-
}
|
|
1570
|
-
function createReadonlyMethod(type) {
|
|
1571
|
-
return function(...args) {
|
|
1572
|
-
{
|
|
1573
|
-
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
|
1574
|
-
warn(`${shared.capitalize(type)} operation ${key}failed: target is readonly.`, toRaw2(this));
|
|
1575
|
-
}
|
|
1576
|
-
return type === "delete" ? false : type === "clear" ? undefined : this;
|
|
1577
|
-
};
|
|
1578
|
-
}
|
|
1579
|
-
function createInstrumentations(readonly2, shallow) {
|
|
1580
|
-
const instrumentations = {
|
|
1581
|
-
get(key) {
|
|
1582
|
-
const target = this["__v_raw"];
|
|
1583
|
-
const rawTarget = toRaw2(target);
|
|
1584
|
-
const rawKey = toRaw2(key);
|
|
1585
|
-
if (!readonly2) {
|
|
1586
|
-
if (shared.hasChanged(key, rawKey)) {
|
|
1587
|
-
track2(rawTarget, "get", key);
|
|
1588
|
-
}
|
|
1589
|
-
track2(rawTarget, "get", rawKey);
|
|
1590
|
-
}
|
|
1591
|
-
const { has } = getProto(rawTarget);
|
|
1592
|
-
const wrap = shallow ? toShallow : readonly2 ? toReadonly : toReactive;
|
|
1593
|
-
if (has.call(rawTarget, key)) {
|
|
1594
|
-
return wrap(target.get(key));
|
|
1595
|
-
} else if (has.call(rawTarget, rawKey)) {
|
|
1596
|
-
return wrap(target.get(rawKey));
|
|
1597
|
-
} else if (target !== rawTarget) {
|
|
1598
|
-
target.get(key);
|
|
1599
|
-
}
|
|
1600
|
-
},
|
|
1601
|
-
get size() {
|
|
1602
|
-
const target = this["__v_raw"];
|
|
1603
|
-
!readonly2 && track2(toRaw2(target), "iterate", ITERATE_KEY);
|
|
1604
|
-
return Reflect.get(target, "size", target);
|
|
1605
|
-
},
|
|
1606
|
-
has(key) {
|
|
1607
|
-
const target = this["__v_raw"];
|
|
1608
|
-
const rawTarget = toRaw2(target);
|
|
1609
|
-
const rawKey = toRaw2(key);
|
|
1610
|
-
if (!readonly2) {
|
|
1611
|
-
if (shared.hasChanged(key, rawKey)) {
|
|
1612
|
-
track2(rawTarget, "has", key);
|
|
1613
|
-
}
|
|
1614
|
-
track2(rawTarget, "has", rawKey);
|
|
1615
|
-
}
|
|
1616
|
-
return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey);
|
|
1617
|
-
},
|
|
1618
|
-
forEach(callback, thisArg) {
|
|
1619
|
-
const observed = this;
|
|
1620
|
-
const target = observed["__v_raw"];
|
|
1621
|
-
const rawTarget = toRaw2(target);
|
|
1622
|
-
const wrap = shallow ? toShallow : readonly2 ? toReadonly : toReactive;
|
|
1623
|
-
!readonly2 && track2(rawTarget, "iterate", ITERATE_KEY);
|
|
1624
|
-
return target.forEach((value, key) => {
|
|
1625
|
-
return callback.call(thisArg, wrap(value), wrap(key), observed);
|
|
1626
|
-
});
|
|
1627
|
-
}
|
|
1628
|
-
};
|
|
1629
|
-
shared.extend(instrumentations, readonly2 ? {
|
|
1630
|
-
add: createReadonlyMethod("add"),
|
|
1631
|
-
set: createReadonlyMethod("set"),
|
|
1632
|
-
delete: createReadonlyMethod("delete"),
|
|
1633
|
-
clear: createReadonlyMethod("clear")
|
|
1634
|
-
} : {
|
|
1635
|
-
add(value) {
|
|
1636
|
-
if (!shallow && !isShallow(value) && !isReadonly(value)) {
|
|
1637
|
-
value = toRaw2(value);
|
|
1638
|
-
}
|
|
1639
|
-
const target = toRaw2(this);
|
|
1640
|
-
const proto = getProto(target);
|
|
1641
|
-
const hadKey = proto.has.call(target, value);
|
|
1642
|
-
if (!hadKey) {
|
|
1643
|
-
target.add(value);
|
|
1644
|
-
trigger2(target, "add", value, value);
|
|
1645
|
-
}
|
|
1646
|
-
return this;
|
|
1647
|
-
},
|
|
1648
|
-
set(key, value) {
|
|
1649
|
-
if (!shallow && !isShallow(value) && !isReadonly(value)) {
|
|
1650
|
-
value = toRaw2(value);
|
|
1651
|
-
}
|
|
1652
|
-
const target = toRaw2(this);
|
|
1653
|
-
const { has, get } = getProto(target);
|
|
1654
|
-
let hadKey = has.call(target, key);
|
|
1655
|
-
if (!hadKey) {
|
|
1656
|
-
key = toRaw2(key);
|
|
1657
|
-
hadKey = has.call(target, key);
|
|
1658
|
-
} else {
|
|
1659
|
-
checkIdentityKeys(target, has, key);
|
|
1660
|
-
}
|
|
1661
|
-
const oldValue = get.call(target, key);
|
|
1662
|
-
target.set(key, value);
|
|
1663
|
-
if (!hadKey) {
|
|
1664
|
-
trigger2(target, "add", key, value);
|
|
1665
|
-
} else if (shared.hasChanged(value, oldValue)) {
|
|
1666
|
-
trigger2(target, "set", key, value, oldValue);
|
|
1667
|
-
}
|
|
1668
|
-
return this;
|
|
1669
|
-
},
|
|
1670
|
-
delete(key) {
|
|
1671
|
-
const target = toRaw2(this);
|
|
1672
|
-
const { has, get } = getProto(target);
|
|
1673
|
-
let hadKey = has.call(target, key);
|
|
1674
|
-
if (!hadKey) {
|
|
1675
|
-
key = toRaw2(key);
|
|
1676
|
-
hadKey = has.call(target, key);
|
|
1677
|
-
} else {
|
|
1678
|
-
checkIdentityKeys(target, has, key);
|
|
1679
|
-
}
|
|
1680
|
-
const oldValue = get ? get.call(target, key) : undefined;
|
|
1681
|
-
const result = target.delete(key);
|
|
1682
|
-
if (hadKey) {
|
|
1683
|
-
trigger2(target, "delete", key, undefined, oldValue);
|
|
1684
|
-
}
|
|
1685
|
-
return result;
|
|
1686
|
-
},
|
|
1687
|
-
clear() {
|
|
1688
|
-
const target = toRaw2(this);
|
|
1689
|
-
const hadItems = target.size !== 0;
|
|
1690
|
-
const oldTarget = shared.isMap(target) ? new Map(target) : new Set(target);
|
|
1691
|
-
const result = target.clear();
|
|
1692
|
-
if (hadItems) {
|
|
1693
|
-
trigger2(target, "clear", undefined, undefined, oldTarget);
|
|
1694
|
-
}
|
|
1695
|
-
return result;
|
|
1696
|
-
}
|
|
1697
|
-
});
|
|
1698
|
-
const iteratorMethods = [
|
|
1699
|
-
"keys",
|
|
1700
|
-
"values",
|
|
1701
|
-
"entries",
|
|
1702
|
-
Symbol.iterator
|
|
1703
|
-
];
|
|
1704
|
-
iteratorMethods.forEach((method) => {
|
|
1705
|
-
instrumentations[method] = createIterableMethod(method, readonly2, shallow);
|
|
1706
|
-
});
|
|
1707
|
-
return instrumentations;
|
|
1708
|
-
}
|
|
1709
|
-
function createInstrumentationGetter(isReadonly2, shallow) {
|
|
1710
|
-
const instrumentations = createInstrumentations(isReadonly2, shallow);
|
|
1711
|
-
return (target, key, receiver) => {
|
|
1712
|
-
if (key === "__v_isReactive") {
|
|
1713
|
-
return !isReadonly2;
|
|
1714
|
-
} else if (key === "__v_isReadonly") {
|
|
1715
|
-
return isReadonly2;
|
|
1716
|
-
} else if (key === "__v_raw") {
|
|
1717
|
-
return target;
|
|
1718
|
-
}
|
|
1719
|
-
return Reflect.get(shared.hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver);
|
|
1720
|
-
};
|
|
1721
|
-
}
|
|
1722
|
-
var mutableCollectionHandlers = {
|
|
1723
|
-
get: /* @__PURE__ */ createInstrumentationGetter(false, false)
|
|
1724
|
-
};
|
|
1725
|
-
var shallowCollectionHandlers = {
|
|
1726
|
-
get: /* @__PURE__ */ createInstrumentationGetter(false, true)
|
|
1727
|
-
};
|
|
1728
|
-
var readonlyCollectionHandlers = {
|
|
1729
|
-
get: /* @__PURE__ */ createInstrumentationGetter(true, false)
|
|
1730
|
-
};
|
|
1731
|
-
var shallowReadonlyCollectionHandlers = {
|
|
1732
|
-
get: /* @__PURE__ */ createInstrumentationGetter(true, true)
|
|
1733
|
-
};
|
|
1734
|
-
function checkIdentityKeys(target, has, key) {
|
|
1735
|
-
const rawKey = toRaw2(key);
|
|
1736
|
-
if (rawKey !== key && has.call(target, rawKey)) {
|
|
1737
|
-
const type = shared.toRawType(target);
|
|
1738
|
-
warn(`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.`);
|
|
1739
|
-
}
|
|
1740
|
-
}
|
|
1741
|
-
var reactiveMap = /* @__PURE__ */ new WeakMap;
|
|
1742
|
-
var shallowReactiveMap = /* @__PURE__ */ new WeakMap;
|
|
1743
|
-
var readonlyMap = /* @__PURE__ */ new WeakMap;
|
|
1744
|
-
var shallowReadonlyMap = /* @__PURE__ */ new WeakMap;
|
|
1745
|
-
function targetTypeMap(rawType) {
|
|
1746
|
-
switch (rawType) {
|
|
1747
|
-
case "Object":
|
|
1748
|
-
case "Array":
|
|
1749
|
-
return 1;
|
|
1750
|
-
case "Map":
|
|
1751
|
-
case "Set":
|
|
1752
|
-
case "WeakMap":
|
|
1753
|
-
case "WeakSet":
|
|
1754
|
-
return 2;
|
|
1755
|
-
default:
|
|
1756
|
-
return 0;
|
|
1757
|
-
}
|
|
1758
|
-
}
|
|
1759
|
-
function getTargetType(value) {
|
|
1760
|
-
return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(shared.toRawType(value));
|
|
1761
|
-
}
|
|
1762
|
-
function reactive2(target) {
|
|
1763
|
-
if (isReadonly(target)) {
|
|
1764
|
-
return target;
|
|
1765
|
-
}
|
|
1766
|
-
return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
|
|
1767
|
-
}
|
|
1768
|
-
function shallowReactive(target) {
|
|
1769
|
-
return createReactiveObject(target, false, shallowReactiveHandlers, shallowCollectionHandlers, shallowReactiveMap);
|
|
1770
|
-
}
|
|
1771
|
-
function readonly(target) {
|
|
1772
|
-
return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap);
|
|
1773
|
-
}
|
|
1774
|
-
function shallowReadonly(target) {
|
|
1775
|
-
return createReactiveObject(target, true, shallowReadonlyHandlers, shallowReadonlyCollectionHandlers, shallowReadonlyMap);
|
|
1776
|
-
}
|
|
1777
|
-
function createReactiveObject(target, isReadonly2, baseHandlers, collectionHandlers, proxyMap) {
|
|
1778
|
-
if (!shared.isObject(target)) {
|
|
1779
|
-
{
|
|
1780
|
-
warn(`value cannot be made ${isReadonly2 ? "readonly" : "reactive"}: ${String(target)}`);
|
|
1781
|
-
}
|
|
1782
|
-
return target;
|
|
1783
|
-
}
|
|
1784
|
-
if (target["__v_raw"] && !(isReadonly2 && target["__v_isReactive"])) {
|
|
1785
|
-
return target;
|
|
1786
|
-
}
|
|
1787
|
-
const existingProxy = proxyMap.get(target);
|
|
1788
|
-
if (existingProxy) {
|
|
1789
|
-
return existingProxy;
|
|
1790
|
-
}
|
|
1791
|
-
const targetType = getTargetType(target);
|
|
1792
|
-
if (targetType === 0) {
|
|
1793
|
-
return target;
|
|
1794
|
-
}
|
|
1795
|
-
const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers);
|
|
1796
|
-
proxyMap.set(target, proxy);
|
|
1797
|
-
return proxy;
|
|
1798
|
-
}
|
|
1799
|
-
function isReactive2(value) {
|
|
1800
|
-
if (isReadonly(value)) {
|
|
1801
|
-
return isReactive2(value["__v_raw"]);
|
|
1802
|
-
}
|
|
1803
|
-
return !!(value && value["__v_isReactive"]);
|
|
1804
|
-
}
|
|
1805
|
-
function isReadonly(value) {
|
|
1806
|
-
return !!(value && value["__v_isReadonly"]);
|
|
1807
|
-
}
|
|
1808
|
-
function isShallow(value) {
|
|
1809
|
-
return !!(value && value["__v_isShallow"]);
|
|
1810
|
-
}
|
|
1811
|
-
function isProxy(value) {
|
|
1812
|
-
return value ? !!value["__v_raw"] : false;
|
|
1813
|
-
}
|
|
1814
|
-
function toRaw2(observed) {
|
|
1815
|
-
const raw = observed && observed["__v_raw"];
|
|
1816
|
-
return raw ? toRaw2(raw) : observed;
|
|
1817
|
-
}
|
|
1818
|
-
function markRaw2(value) {
|
|
1819
|
-
if (!shared.hasOwn(value, "__v_skip") && Object.isExtensible(value)) {
|
|
1820
|
-
shared.def(value, "__v_skip", true);
|
|
1821
|
-
}
|
|
1822
|
-
return value;
|
|
1823
|
-
}
|
|
1824
|
-
var toReactive = (value) => shared.isObject(value) ? reactive2(value) : value;
|
|
1825
|
-
var toReadonly = (value) => shared.isObject(value) ? readonly(value) : value;
|
|
1826
|
-
function isRef3(r) {
|
|
1827
|
-
return r ? r["__v_isRef"] === true : false;
|
|
1828
|
-
}
|
|
1829
|
-
function ref2(value) {
|
|
1830
|
-
return createRef2(value, false);
|
|
1831
|
-
}
|
|
1832
|
-
function shallowRef(value) {
|
|
1833
|
-
return createRef2(value, true);
|
|
1834
|
-
}
|
|
1835
|
-
function createRef2(rawValue, shallow) {
|
|
1836
|
-
if (isRef3(rawValue)) {
|
|
1837
|
-
return rawValue;
|
|
1838
|
-
}
|
|
1839
|
-
return new RefImpl(rawValue, shallow);
|
|
1840
|
-
}
|
|
1841
|
-
|
|
1842
|
-
class RefImpl {
|
|
1843
|
-
constructor(value, isShallow2) {
|
|
1844
|
-
this.dep = new Dep;
|
|
1845
|
-
this["__v_isRef"] = true;
|
|
1846
|
-
this["__v_isShallow"] = false;
|
|
1847
|
-
this._rawValue = isShallow2 ? value : toRaw2(value);
|
|
1848
|
-
this._value = isShallow2 ? value : toReactive(value);
|
|
1849
|
-
this["__v_isShallow"] = isShallow2;
|
|
1850
|
-
}
|
|
1851
|
-
get value() {
|
|
1852
|
-
{
|
|
1853
|
-
this.dep.track({
|
|
1854
|
-
target: this,
|
|
1855
|
-
type: "get",
|
|
1856
|
-
key: "value"
|
|
1857
|
-
});
|
|
1858
|
-
}
|
|
1859
|
-
return this._value;
|
|
1860
|
-
}
|
|
1861
|
-
set value(newValue) {
|
|
1862
|
-
const oldValue = this._rawValue;
|
|
1863
|
-
const useDirectValue = this["__v_isShallow"] || isShallow(newValue) || isReadonly(newValue);
|
|
1864
|
-
newValue = useDirectValue ? newValue : toRaw2(newValue);
|
|
1865
|
-
if (shared.hasChanged(newValue, oldValue)) {
|
|
1866
|
-
this._rawValue = newValue;
|
|
1867
|
-
this._value = useDirectValue ? newValue : toReactive(newValue);
|
|
1868
|
-
{
|
|
1869
|
-
this.dep.trigger({
|
|
1870
|
-
target: this,
|
|
1871
|
-
type: "set",
|
|
1872
|
-
key: "value",
|
|
1873
|
-
newValue,
|
|
1874
|
-
oldValue
|
|
1875
|
-
});
|
|
1876
|
-
}
|
|
1877
|
-
}
|
|
1878
|
-
}
|
|
1879
|
-
}
|
|
1880
|
-
function triggerRef2(ref22) {
|
|
1881
|
-
if (ref22.dep) {
|
|
1882
|
-
{
|
|
1883
|
-
ref22.dep.trigger({
|
|
1884
|
-
target: ref22,
|
|
1885
|
-
type: "set",
|
|
1886
|
-
key: "value",
|
|
1887
|
-
newValue: ref22._value
|
|
1888
|
-
});
|
|
1889
|
-
}
|
|
1890
|
-
}
|
|
1891
|
-
}
|
|
1892
|
-
function unref3(ref22) {
|
|
1893
|
-
return isRef3(ref22) ? ref22.value : ref22;
|
|
1894
|
-
}
|
|
1895
|
-
function toValue(source) {
|
|
1896
|
-
return shared.isFunction(source) ? source() : unref3(source);
|
|
1897
|
-
}
|
|
1898
|
-
var shallowUnwrapHandlers = {
|
|
1899
|
-
get: (target, key, receiver) => key === "__v_raw" ? target : unref3(Reflect.get(target, key, receiver)),
|
|
1900
|
-
set: (target, key, value, receiver) => {
|
|
1901
|
-
const oldValue = target[key];
|
|
1902
|
-
if (isRef3(oldValue) && !isRef3(value)) {
|
|
1903
|
-
oldValue.value = value;
|
|
1904
|
-
return true;
|
|
1905
|
-
} else {
|
|
1906
|
-
return Reflect.set(target, key, value, receiver);
|
|
1907
|
-
}
|
|
1908
|
-
}
|
|
1909
|
-
};
|
|
1910
|
-
function proxyRefs(objectWithRefs) {
|
|
1911
|
-
return isReactive2(objectWithRefs) ? objectWithRefs : new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
|
1912
|
-
}
|
|
1913
|
-
|
|
1914
|
-
class CustomRefImpl {
|
|
1915
|
-
constructor(factory) {
|
|
1916
|
-
this["__v_isRef"] = true;
|
|
1917
|
-
this._value = undefined;
|
|
1918
|
-
const dep = this.dep = new Dep;
|
|
1919
|
-
const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
|
1920
|
-
this._get = get;
|
|
1921
|
-
this._set = set;
|
|
1922
|
-
}
|
|
1923
|
-
get value() {
|
|
1924
|
-
return this._value = this._get();
|
|
1925
|
-
}
|
|
1926
|
-
set value(newVal) {
|
|
1927
|
-
this._set(newVal);
|
|
1928
|
-
}
|
|
1929
|
-
}
|
|
1930
|
-
function customRef(factory) {
|
|
1931
|
-
return new CustomRefImpl(factory);
|
|
1932
|
-
}
|
|
1933
|
-
function toRefs2(object) {
|
|
1934
|
-
if (!isProxy(object)) {
|
|
1935
|
-
warn(`toRefs() expects a reactive object but received a plain one.`);
|
|
1936
|
-
}
|
|
1937
|
-
const ret = shared.isArray(object) ? new Array(object.length) : {};
|
|
1938
|
-
for (const key in object) {
|
|
1939
|
-
ret[key] = propertyToRef(object, key);
|
|
1940
|
-
}
|
|
1941
|
-
return ret;
|
|
1942
|
-
}
|
|
1943
|
-
|
|
1944
|
-
class ObjectRefImpl {
|
|
1945
|
-
constructor(_object, _key, _defaultValue) {
|
|
1946
|
-
this._object = _object;
|
|
1947
|
-
this._key = _key;
|
|
1948
|
-
this._defaultValue = _defaultValue;
|
|
1949
|
-
this["__v_isRef"] = true;
|
|
1950
|
-
this._value = undefined;
|
|
1951
|
-
}
|
|
1952
|
-
get value() {
|
|
1953
|
-
const val = this._object[this._key];
|
|
1954
|
-
return this._value = val === undefined ? this._defaultValue : val;
|
|
1955
|
-
}
|
|
1956
|
-
set value(newVal) {
|
|
1957
|
-
this._object[this._key] = newVal;
|
|
1958
|
-
}
|
|
1959
|
-
get dep() {
|
|
1960
|
-
return getDepFromReactive(toRaw2(this._object), this._key);
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
|
|
1964
|
-
class GetterRefImpl {
|
|
1965
|
-
constructor(_getter) {
|
|
1966
|
-
this._getter = _getter;
|
|
1967
|
-
this["__v_isRef"] = true;
|
|
1968
|
-
this["__v_isReadonly"] = true;
|
|
1969
|
-
this._value = undefined;
|
|
1970
|
-
}
|
|
1971
|
-
get value() {
|
|
1972
|
-
return this._value = this._getter();
|
|
1973
|
-
}
|
|
1974
|
-
}
|
|
1975
|
-
function toRef2(source, key, defaultValue) {
|
|
1976
|
-
if (isRef3(source)) {
|
|
1977
|
-
return source;
|
|
1978
|
-
} else if (shared.isFunction(source)) {
|
|
1979
|
-
return new GetterRefImpl(source);
|
|
1980
|
-
} else if (shared.isObject(source) && arguments.length > 1) {
|
|
1981
|
-
return propertyToRef(source, key, defaultValue);
|
|
1982
|
-
} else {
|
|
1983
|
-
return ref2(source);
|
|
1984
|
-
}
|
|
1985
|
-
}
|
|
1986
|
-
function propertyToRef(source, key, defaultValue) {
|
|
1987
|
-
const val = source[key];
|
|
1988
|
-
return isRef3(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1989
|
-
}
|
|
1990
|
-
|
|
1991
|
-
class ComputedRefImpl {
|
|
1992
|
-
constructor(fn, setter, isSSR) {
|
|
1993
|
-
this.fn = fn;
|
|
1994
|
-
this.setter = setter;
|
|
1995
|
-
this._value = undefined;
|
|
1996
|
-
this.dep = new Dep(this);
|
|
1997
|
-
this.__v_isRef = true;
|
|
1998
|
-
this.deps = undefined;
|
|
1999
|
-
this.depsTail = undefined;
|
|
2000
|
-
this.flags = 16;
|
|
2001
|
-
this.globalVersion = globalVersion - 1;
|
|
2002
|
-
this.next = undefined;
|
|
2003
|
-
this.effect = this;
|
|
2004
|
-
this["__v_isReadonly"] = !setter;
|
|
2005
|
-
this.isSSR = isSSR;
|
|
2006
|
-
}
|
|
2007
|
-
notify() {
|
|
2008
|
-
this.flags |= 16;
|
|
2009
|
-
if (!(this.flags & 8) && activeSub !== this) {
|
|
2010
|
-
batch(this, true);
|
|
2011
|
-
return true;
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
get value() {
|
|
2015
|
-
const link = this.dep.track({
|
|
2016
|
-
target: this,
|
|
2017
|
-
type: "get",
|
|
2018
|
-
key: "value"
|
|
2019
|
-
});
|
|
2020
|
-
refreshComputed(this);
|
|
2021
|
-
if (link) {
|
|
2022
|
-
link.version = this.dep.version;
|
|
2023
|
-
}
|
|
2024
|
-
return this._value;
|
|
2025
|
-
}
|
|
2026
|
-
set value(newValue) {
|
|
2027
|
-
if (this.setter) {
|
|
2028
|
-
this.setter(newValue);
|
|
2029
|
-
} else {
|
|
2030
|
-
warn("Write operation failed: computed value is readonly");
|
|
2031
|
-
}
|
|
2032
|
-
}
|
|
2033
|
-
}
|
|
2034
|
-
function computed2(getterOrOptions, debugOptions, isSSR = false) {
|
|
2035
|
-
let getter;
|
|
2036
|
-
let setter;
|
|
2037
|
-
if (shared.isFunction(getterOrOptions)) {
|
|
2038
|
-
getter = getterOrOptions;
|
|
2039
|
-
} else {
|
|
2040
|
-
getter = getterOrOptions.get;
|
|
2041
|
-
setter = getterOrOptions.set;
|
|
2042
|
-
}
|
|
2043
|
-
const cRef = new ComputedRefImpl(getter, setter, isSSR);
|
|
2044
|
-
if (debugOptions && !isSSR) {
|
|
2045
|
-
cRef.onTrack = debugOptions.onTrack;
|
|
2046
|
-
cRef.onTrigger = debugOptions.onTrigger;
|
|
2047
|
-
}
|
|
2048
|
-
return cRef;
|
|
2049
|
-
}
|
|
2050
|
-
var TrackOpTypes = {
|
|
2051
|
-
GET: "get",
|
|
2052
|
-
HAS: "has",
|
|
2053
|
-
ITERATE: "iterate"
|
|
2054
|
-
};
|
|
2055
|
-
var TriggerOpTypes = {
|
|
2056
|
-
SET: "set",
|
|
2057
|
-
ADD: "add",
|
|
2058
|
-
DELETE: "delete",
|
|
2059
|
-
CLEAR: "clear"
|
|
2060
|
-
};
|
|
2061
|
-
var ReactiveFlags2 = {
|
|
2062
|
-
SKIP: "__v_skip",
|
|
2063
|
-
IS_REACTIVE: "__v_isReactive",
|
|
2064
|
-
IS_READONLY: "__v_isReadonly",
|
|
2065
|
-
IS_SHALLOW: "__v_isShallow",
|
|
2066
|
-
RAW: "__v_raw",
|
|
2067
|
-
IS_REF: "__v_isRef"
|
|
2068
|
-
};
|
|
2069
|
-
var WatchErrorCodes = {
|
|
2070
|
-
WATCH_GETTER: 2,
|
|
2071
|
-
"2": "WATCH_GETTER",
|
|
2072
|
-
WATCH_CALLBACK: 3,
|
|
2073
|
-
"3": "WATCH_CALLBACK",
|
|
2074
|
-
WATCH_CLEANUP: 4,
|
|
2075
|
-
"4": "WATCH_CLEANUP"
|
|
2076
|
-
};
|
|
2077
|
-
var INITIAL_WATCHER_VALUE = {};
|
|
2078
|
-
var cleanupMap = /* @__PURE__ */ new WeakMap;
|
|
2079
|
-
var activeWatcher = undefined;
|
|
2080
|
-
function getCurrentWatcher() {
|
|
2081
|
-
return activeWatcher;
|
|
2082
|
-
}
|
|
2083
|
-
function onWatcherCleanup(cleanupFn, failSilently = false, owner = activeWatcher) {
|
|
2084
|
-
if (owner) {
|
|
2085
|
-
let cleanups = cleanupMap.get(owner);
|
|
2086
|
-
if (!cleanups)
|
|
2087
|
-
cleanupMap.set(owner, cleanups = []);
|
|
2088
|
-
cleanups.push(cleanupFn);
|
|
2089
|
-
} else if (!failSilently) {
|
|
2090
|
-
warn(`onWatcherCleanup() was called when there was no active watcher to associate with.`);
|
|
2091
|
-
}
|
|
2092
|
-
}
|
|
2093
|
-
function watch2(source, cb, options = shared.EMPTY_OBJ) {
|
|
2094
|
-
const { immediate, deep, once, scheduler, augmentJob, call } = options;
|
|
2095
|
-
const warnInvalidSource = (s) => {
|
|
2096
|
-
(options.onWarn || warn)(`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.`);
|
|
2097
|
-
};
|
|
2098
|
-
const reactiveGetter = (source2) => {
|
|
2099
|
-
if (deep)
|
|
2100
|
-
return source2;
|
|
2101
|
-
if (isShallow(source2) || deep === false || deep === 0)
|
|
2102
|
-
return traverse2(source2, 1);
|
|
2103
|
-
return traverse2(source2);
|
|
2104
|
-
};
|
|
2105
|
-
let effect2;
|
|
2106
|
-
let getter;
|
|
2107
|
-
let cleanup;
|
|
2108
|
-
let boundCleanup;
|
|
2109
|
-
let forceTrigger = false;
|
|
2110
|
-
let isMultiSource = false;
|
|
2111
|
-
if (isRef3(source)) {
|
|
2112
|
-
getter = () => source.value;
|
|
2113
|
-
forceTrigger = isShallow(source);
|
|
2114
|
-
} else if (isReactive2(source)) {
|
|
2115
|
-
getter = () => reactiveGetter(source);
|
|
2116
|
-
forceTrigger = true;
|
|
2117
|
-
} else if (shared.isArray(source)) {
|
|
2118
|
-
isMultiSource = true;
|
|
2119
|
-
forceTrigger = source.some((s) => isReactive2(s) || isShallow(s));
|
|
2120
|
-
getter = () => source.map((s) => {
|
|
2121
|
-
if (isRef3(s)) {
|
|
2122
|
-
return s.value;
|
|
2123
|
-
} else if (isReactive2(s)) {
|
|
2124
|
-
return reactiveGetter(s);
|
|
2125
|
-
} else if (shared.isFunction(s)) {
|
|
2126
|
-
return call ? call(s, 2) : s();
|
|
2127
|
-
} else {
|
|
2128
|
-
warnInvalidSource(s);
|
|
2129
|
-
}
|
|
2130
|
-
});
|
|
2131
|
-
} else if (shared.isFunction(source)) {
|
|
2132
|
-
if (cb) {
|
|
2133
|
-
getter = call ? () => call(source, 2) : source;
|
|
2134
|
-
} else {
|
|
2135
|
-
getter = () => {
|
|
2136
|
-
if (cleanup) {
|
|
2137
|
-
pauseTracking();
|
|
2138
|
-
try {
|
|
2139
|
-
cleanup();
|
|
2140
|
-
} finally {
|
|
2141
|
-
resetTracking();
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2144
|
-
const currentEffect = activeWatcher;
|
|
2145
|
-
activeWatcher = effect2;
|
|
2146
|
-
try {
|
|
2147
|
-
return call ? call(source, 3, [boundCleanup]) : source(boundCleanup);
|
|
2148
|
-
} finally {
|
|
2149
|
-
activeWatcher = currentEffect;
|
|
2150
|
-
}
|
|
2151
|
-
};
|
|
2152
|
-
}
|
|
2153
|
-
} else {
|
|
2154
|
-
getter = shared.NOOP;
|
|
2155
|
-
warnInvalidSource(source);
|
|
2156
|
-
}
|
|
2157
|
-
if (cb && deep) {
|
|
2158
|
-
const baseGetter = getter;
|
|
2159
|
-
const depth = deep === true ? Infinity : deep;
|
|
2160
|
-
getter = () => traverse2(baseGetter(), depth);
|
|
2161
|
-
}
|
|
2162
|
-
const scope = getCurrentScope();
|
|
2163
|
-
const watchHandle = () => {
|
|
2164
|
-
effect2.stop();
|
|
2165
|
-
if (scope && scope.active) {
|
|
2166
|
-
shared.remove(scope.effects, effect2);
|
|
2167
|
-
}
|
|
2168
|
-
};
|
|
2169
|
-
if (once && cb) {
|
|
2170
|
-
const _cb = cb;
|
|
2171
|
-
cb = (...args) => {
|
|
2172
|
-
_cb(...args);
|
|
2173
|
-
watchHandle();
|
|
2174
|
-
};
|
|
2175
|
-
}
|
|
2176
|
-
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
2177
|
-
const job = (immediateFirstRun) => {
|
|
2178
|
-
if (!(effect2.flags & 1) || !effect2.dirty && !immediateFirstRun) {
|
|
2179
|
-
return;
|
|
2180
|
-
}
|
|
2181
|
-
if (cb) {
|
|
2182
|
-
const newValue = effect2.run();
|
|
2183
|
-
if (deep || forceTrigger || (isMultiSource ? newValue.some((v, i) => shared.hasChanged(v, oldValue[i])) : shared.hasChanged(newValue, oldValue))) {
|
|
2184
|
-
if (cleanup) {
|
|
2185
|
-
cleanup();
|
|
2186
|
-
}
|
|
2187
|
-
const currentWatcher = activeWatcher;
|
|
2188
|
-
activeWatcher = effect2;
|
|
2189
|
-
try {
|
|
2190
|
-
const args = [
|
|
2191
|
-
newValue,
|
|
2192
|
-
oldValue === INITIAL_WATCHER_VALUE ? undefined : isMultiSource && oldValue[0] === INITIAL_WATCHER_VALUE ? [] : oldValue,
|
|
2193
|
-
boundCleanup
|
|
2194
|
-
];
|
|
2195
|
-
call ? call(cb, 3, args) : cb(...args);
|
|
2196
|
-
oldValue = newValue;
|
|
2197
|
-
} finally {
|
|
2198
|
-
activeWatcher = currentWatcher;
|
|
2199
|
-
}
|
|
2200
|
-
}
|
|
2201
|
-
} else {
|
|
2202
|
-
effect2.run();
|
|
2203
|
-
}
|
|
2204
|
-
};
|
|
2205
|
-
if (augmentJob) {
|
|
2206
|
-
augmentJob(job);
|
|
2207
|
-
}
|
|
2208
|
-
effect2 = new ReactiveEffect(getter);
|
|
2209
|
-
effect2.scheduler = scheduler ? () => scheduler(job, false) : job;
|
|
2210
|
-
boundCleanup = (fn) => onWatcherCleanup(fn, false, effect2);
|
|
2211
|
-
cleanup = effect2.onStop = () => {
|
|
2212
|
-
const cleanups = cleanupMap.get(effect2);
|
|
2213
|
-
if (cleanups) {
|
|
2214
|
-
if (call) {
|
|
2215
|
-
call(cleanups, 4);
|
|
2216
|
-
} else {
|
|
2217
|
-
for (const cleanup2 of cleanups)
|
|
2218
|
-
cleanup2();
|
|
2219
|
-
}
|
|
2220
|
-
cleanupMap.delete(effect2);
|
|
2221
|
-
}
|
|
2222
|
-
};
|
|
2223
|
-
{
|
|
2224
|
-
effect2.onTrack = options.onTrack;
|
|
2225
|
-
effect2.onTrigger = options.onTrigger;
|
|
2226
|
-
}
|
|
2227
|
-
if (cb) {
|
|
2228
|
-
if (immediate) {
|
|
2229
|
-
job(true);
|
|
2230
|
-
} else {
|
|
2231
|
-
oldValue = effect2.run();
|
|
2232
|
-
}
|
|
2233
|
-
} else if (scheduler) {
|
|
2234
|
-
scheduler(job.bind(null, true), true);
|
|
2235
|
-
} else {
|
|
2236
|
-
effect2.run();
|
|
2237
|
-
}
|
|
2238
|
-
watchHandle.pause = effect2.pause.bind(effect2);
|
|
2239
|
-
watchHandle.resume = effect2.resume.bind(effect2);
|
|
2240
|
-
watchHandle.stop = watchHandle;
|
|
2241
|
-
return watchHandle;
|
|
2242
|
-
}
|
|
2243
|
-
function traverse2(value, depth = Infinity, seen) {
|
|
2244
|
-
if (depth <= 0 || !shared.isObject(value) || value["__v_skip"]) {
|
|
2245
|
-
return value;
|
|
2246
|
-
}
|
|
2247
|
-
seen = seen || /* @__PURE__ */ new Set;
|
|
2248
|
-
if (seen.has(value)) {
|
|
2249
|
-
return value;
|
|
2250
|
-
}
|
|
2251
|
-
seen.add(value);
|
|
2252
|
-
depth--;
|
|
2253
|
-
if (isRef3(value)) {
|
|
2254
|
-
traverse2(value.value, depth, seen);
|
|
2255
|
-
} else if (shared.isArray(value)) {
|
|
2256
|
-
for (let i = 0;i < value.length; i++) {
|
|
2257
|
-
traverse2(value[i], depth, seen);
|
|
2258
|
-
}
|
|
2259
|
-
} else if (shared.isSet(value) || shared.isMap(value)) {
|
|
2260
|
-
value.forEach((v) => {
|
|
2261
|
-
traverse2(v, depth, seen);
|
|
2262
|
-
});
|
|
2263
|
-
} else if (shared.isPlainObject(value)) {
|
|
2264
|
-
for (const key in value) {
|
|
2265
|
-
traverse2(value[key], depth, seen);
|
|
2266
|
-
}
|
|
2267
|
-
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
2268
|
-
if (Object.prototype.propertyIsEnumerable.call(value, key)) {
|
|
2269
|
-
traverse2(value[key], depth, seen);
|
|
2270
|
-
}
|
|
2271
|
-
}
|
|
2272
|
-
}
|
|
2273
|
-
return value;
|
|
2274
|
-
}
|
|
2275
|
-
exports2.ARRAY_ITERATE_KEY = ARRAY_ITERATE_KEY;
|
|
2276
|
-
exports2.EffectFlags = EffectFlags;
|
|
2277
|
-
exports2.EffectScope = EffectScope;
|
|
2278
|
-
exports2.ITERATE_KEY = ITERATE_KEY;
|
|
2279
|
-
exports2.MAP_KEY_ITERATE_KEY = MAP_KEY_ITERATE_KEY;
|
|
2280
|
-
exports2.ReactiveEffect = ReactiveEffect;
|
|
2281
|
-
exports2.ReactiveFlags = ReactiveFlags2;
|
|
2282
|
-
exports2.TrackOpTypes = TrackOpTypes;
|
|
2283
|
-
exports2.TriggerOpTypes = TriggerOpTypes;
|
|
2284
|
-
exports2.WatchErrorCodes = WatchErrorCodes;
|
|
2285
|
-
exports2.computed = computed2;
|
|
2286
|
-
exports2.customRef = customRef;
|
|
2287
|
-
exports2.effect = effect;
|
|
2288
|
-
exports2.effectScope = effectScope;
|
|
2289
|
-
exports2.enableTracking = enableTracking;
|
|
2290
|
-
exports2.getCurrentScope = getCurrentScope;
|
|
2291
|
-
exports2.getCurrentWatcher = getCurrentWatcher;
|
|
2292
|
-
exports2.isProxy = isProxy;
|
|
2293
|
-
exports2.isReactive = isReactive2;
|
|
2294
|
-
exports2.isReadonly = isReadonly;
|
|
2295
|
-
exports2.isRef = isRef3;
|
|
2296
|
-
exports2.isShallow = isShallow;
|
|
2297
|
-
exports2.markRaw = markRaw2;
|
|
2298
|
-
exports2.onEffectCleanup = onEffectCleanup;
|
|
2299
|
-
exports2.onScopeDispose = onScopeDispose;
|
|
2300
|
-
exports2.onWatcherCleanup = onWatcherCleanup;
|
|
2301
|
-
exports2.pauseTracking = pauseTracking;
|
|
2302
|
-
exports2.proxyRefs = proxyRefs;
|
|
2303
|
-
exports2.reactive = reactive2;
|
|
2304
|
-
exports2.reactiveReadArray = reactiveReadArray;
|
|
2305
|
-
exports2.readonly = readonly;
|
|
2306
|
-
exports2.ref = ref2;
|
|
2307
|
-
exports2.resetTracking = resetTracking;
|
|
2308
|
-
exports2.shallowReactive = shallowReactive;
|
|
2309
|
-
exports2.shallowReadArray = shallowReadArray;
|
|
2310
|
-
exports2.shallowReadonly = shallowReadonly;
|
|
2311
|
-
exports2.shallowRef = shallowRef;
|
|
2312
|
-
exports2.stop = stop;
|
|
2313
|
-
exports2.toRaw = toRaw2;
|
|
2314
|
-
exports2.toReactive = toReactive;
|
|
2315
|
-
exports2.toReadonly = toReadonly;
|
|
2316
|
-
exports2.toRef = toRef2;
|
|
2317
|
-
exports2.toRefs = toRefs2;
|
|
2318
|
-
exports2.toValue = toValue;
|
|
2319
|
-
exports2.track = track2;
|
|
2320
|
-
exports2.traverse = traverse2;
|
|
2321
|
-
exports2.trigger = trigger2;
|
|
2322
|
-
exports2.triggerRef = triggerRef2;
|
|
2323
|
-
exports2.unref = unref3;
|
|
2324
|
-
exports2.watch = watch2;
|
|
2325
|
-
});
|
|
5
|
+
var __moduleCache = /* @__PURE__ */ new WeakMap;
|
|
6
|
+
var __toCommonJS = (from) => {
|
|
7
|
+
var entry = __moduleCache.get(from), desc;
|
|
8
|
+
if (entry)
|
|
9
|
+
return entry;
|
|
10
|
+
entry = __defProp({}, "__esModule", { value: true });
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function")
|
|
12
|
+
__getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
}));
|
|
16
|
+
__moduleCache.set(from, entry);
|
|
17
|
+
return entry;
|
|
18
|
+
};
|
|
19
|
+
var __export = (target, all) => {
|
|
20
|
+
for (var name in all)
|
|
21
|
+
__defProp(target, name, {
|
|
22
|
+
get: all[name],
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
set: (newValue) => all[name] = () => newValue
|
|
26
|
+
});
|
|
27
|
+
};
|
|
2326
28
|
|
|
2327
29
|
// src/index.ts
|
|
2328
30
|
var exports_src = {};
|
|
@@ -6404,104 +4106,412 @@ function markRaw(obj) {
|
|
|
6404
4106
|
return obj;
|
|
6405
4107
|
}
|
|
6406
4108
|
// src/integrations/vue3.ts
|
|
6407
|
-
var
|
|
6408
|
-
var import_reactivity = __toESM(require_reactivity_cjs(), 1);
|
|
4109
|
+
var import_reactivity = require("@vue/reactivity");
|
|
6409
4110
|
function trackVueReactiveEvents(vueState, emit, options = {}) {
|
|
6410
4111
|
const { emitInitialReplace = true, onDiffError } = options;
|
|
4112
|
+
assertSameVueCopy(vueState);
|
|
6411
4113
|
if (emitInitialReplace) {
|
|
6412
4114
|
try {
|
|
6413
4115
|
emit({ action: "replace", path: [], newValue: deepClone(vueState) });
|
|
6414
4116
|
} catch (e) {}
|
|
6415
4117
|
}
|
|
6416
|
-
const
|
|
6417
|
-
const
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
for (const k of Object.keys(vueState)) {
|
|
6421
|
-
prev[k] = deepClone(vueState[k]);
|
|
4118
|
+
const tracker = new Tracker(emit, onDiffError);
|
|
4119
|
+
const root = createNode(tracker, null, null, vueState).start();
|
|
4120
|
+
function warnStopped(method) {
|
|
4121
|
+
console.warn(`[reactive-proxy-state] trackVueReactiveEvents: ${method}() after stop() does nothing. stop() is final; create a new tracker to track again.`);
|
|
6422
4122
|
}
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
if (
|
|
6426
|
-
return;
|
|
6427
|
-
const currVal = vueState[k];
|
|
6428
|
-
pathStack.push(k);
|
|
6429
|
-
try {
|
|
6430
|
-
const result = diffAndClone(currVal, prev[k], pathStack, emit);
|
|
6431
|
-
if (result !== prev[k]) {
|
|
6432
|
-
prev[k] = result;
|
|
6433
|
-
}
|
|
6434
|
-
} catch (e) {
|
|
6435
|
-
const errorPath = pathStack.slice();
|
|
6436
|
-
pathStack.length = 0;
|
|
6437
|
-
prev[k] = deepClone(vueState[k]);
|
|
6438
|
-
if (onDiffError) {
|
|
6439
|
-
onDiffError({ key: k, path: errorPath, error: e });
|
|
6440
|
-
}
|
|
4123
|
+
return {
|
|
4124
|
+
stop() {
|
|
4125
|
+
if (tracker.stopped)
|
|
6441
4126
|
return;
|
|
4127
|
+
tracker.stopped = true;
|
|
4128
|
+
tracker.emitting = false;
|
|
4129
|
+
root.dispose();
|
|
4130
|
+
tracker.scope.stop();
|
|
4131
|
+
},
|
|
4132
|
+
pause() {
|
|
4133
|
+
if (tracker.stopped)
|
|
4134
|
+
warnStopped("pause");
|
|
4135
|
+
else
|
|
4136
|
+
tracker.emitting = false;
|
|
4137
|
+
},
|
|
4138
|
+
resume() {
|
|
4139
|
+
if (tracker.stopped)
|
|
4140
|
+
warnStopped("resume");
|
|
4141
|
+
else
|
|
4142
|
+
tracker.emitting = true;
|
|
4143
|
+
}
|
|
4144
|
+
};
|
|
4145
|
+
}
|
|
4146
|
+
function assertSameVueCopy(state) {
|
|
4147
|
+
if (import_reactivity.isProxy(state)) {
|
|
4148
|
+
if (import_reactivity.isReadonly(state))
|
|
4149
|
+
return;
|
|
4150
|
+
const raw = import_reactivity.toRaw(state);
|
|
4151
|
+
if ((import_reactivity.isShallow(state) ? import_reactivity.shallowReactive(raw) : import_reactivity.reactive(raw)) === state)
|
|
4152
|
+
return;
|
|
4153
|
+
}
|
|
4154
|
+
throw new TypeError("trackVueReactiveEvents: the state is not a reactive() object of the @vue/reactivity copy this library imports. " + "Pass the object Vue's reactive() returned. If it is one, the app loads two copies of @vue/reactivity: " + "dedupe 'vue' and '@vue/reactivity' in the bundler.");
|
|
4155
|
+
}
|
|
4156
|
+
var hasOwn2 = Object.prototype.hasOwnProperty;
|
|
4157
|
+
var NO_CHILDREN = new Map;
|
|
4158
|
+
|
|
4159
|
+
class Tracker {
|
|
4160
|
+
listener;
|
|
4161
|
+
onDiffError;
|
|
4162
|
+
scope = import_reactivity.effectScope(true);
|
|
4163
|
+
emitting = true;
|
|
4164
|
+
stopped = false;
|
|
4165
|
+
scans = 0;
|
|
4166
|
+
constructor(listener, onDiffError) {
|
|
4167
|
+
this.listener = listener;
|
|
4168
|
+
this.onDiffError = onDiffError;
|
|
4169
|
+
}
|
|
4170
|
+
emit(event) {
|
|
4171
|
+
import_reactivity.pauseTracking();
|
|
4172
|
+
try {
|
|
4173
|
+
this.listener(event);
|
|
4174
|
+
} catch (error) {
|
|
4175
|
+
this.report(event.path, error);
|
|
4176
|
+
} finally {
|
|
4177
|
+
import_reactivity.resetTracking();
|
|
4178
|
+
}
|
|
4179
|
+
}
|
|
4180
|
+
report(path, error) {
|
|
4181
|
+
if (this.onDiffError === undefined)
|
|
4182
|
+
return;
|
|
4183
|
+
import_reactivity.pauseTracking();
|
|
4184
|
+
try {
|
|
4185
|
+
this.onDiffError({ key: path.length > 0 ? String(path[0]) : "", path, error });
|
|
4186
|
+
} finally {
|
|
4187
|
+
import_reactivity.resetTracking();
|
|
4188
|
+
}
|
|
4189
|
+
}
|
|
4190
|
+
}
|
|
4191
|
+
function scanNode() {
|
|
4192
|
+
this.scan();
|
|
4193
|
+
}
|
|
4194
|
+
function rerunNode() {
|
|
4195
|
+
if (this.disposed)
|
|
4196
|
+
return;
|
|
4197
|
+
this.run();
|
|
4198
|
+
if (!this.disposed && this.dirty)
|
|
4199
|
+
this.run();
|
|
4200
|
+
}
|
|
4201
|
+
function createNode(tracker, parent, key, proxy) {
|
|
4202
|
+
const node = tracker.scope.run(() => new TrackedNode(tracker, parent, key, proxy));
|
|
4203
|
+
const effects = tracker.scope.effects;
|
|
4204
|
+
if (effects[effects.length - 1] === node)
|
|
4205
|
+
effects.pop();
|
|
4206
|
+
return node;
|
|
4207
|
+
}
|
|
4208
|
+
|
|
4209
|
+
class TrackedNode extends import_reactivity.ReactiveEffect {
|
|
4210
|
+
tracker;
|
|
4211
|
+
parent;
|
|
4212
|
+
key;
|
|
4213
|
+
proxy;
|
|
4214
|
+
raw;
|
|
4215
|
+
kind;
|
|
4216
|
+
shadow;
|
|
4217
|
+
children;
|
|
4218
|
+
pending;
|
|
4219
|
+
rawIndex;
|
|
4220
|
+
claim;
|
|
4221
|
+
started;
|
|
4222
|
+
disposed;
|
|
4223
|
+
constructor(tracker, parent, key, proxy) {
|
|
4224
|
+
super(scanNode);
|
|
4225
|
+
this.scheduler = rerunNode;
|
|
4226
|
+
this.tracker = tracker;
|
|
4227
|
+
this.parent = parent;
|
|
4228
|
+
this.key = key;
|
|
4229
|
+
this.proxy = proxy;
|
|
4230
|
+
this.raw = import_reactivity.toRaw(proxy);
|
|
4231
|
+
this.kind = nodeKind(this.raw);
|
|
4232
|
+
this.shadow = undefined;
|
|
4233
|
+
this.children = NO_CHILDREN;
|
|
4234
|
+
this.pending = null;
|
|
4235
|
+
this.rawIndex = null;
|
|
4236
|
+
this.claim = 0;
|
|
4237
|
+
this.started = false;
|
|
4238
|
+
this.disposed = false;
|
|
4239
|
+
}
|
|
4240
|
+
start() {
|
|
4241
|
+
this.run();
|
|
4242
|
+
this.started = true;
|
|
4243
|
+
return this;
|
|
4244
|
+
}
|
|
4245
|
+
path() {
|
|
4246
|
+
const path = [];
|
|
4247
|
+
for (let node = this;node.parent !== null; node = node.parent)
|
|
4248
|
+
path.push(node.key);
|
|
4249
|
+
return path.reverse();
|
|
4250
|
+
}
|
|
4251
|
+
dispose() {
|
|
4252
|
+
if (this.disposed)
|
|
4253
|
+
return;
|
|
4254
|
+
this.disposed = true;
|
|
4255
|
+
this.stop();
|
|
4256
|
+
for (const child of this.children.values())
|
|
4257
|
+
child.dispose();
|
|
4258
|
+
this.children = NO_CHILDREN;
|
|
4259
|
+
this.shadow = undefined;
|
|
4260
|
+
}
|
|
4261
|
+
attachShadow() {
|
|
4262
|
+
const parent = this.parent;
|
|
4263
|
+
if (this.disposed || parent === null || parent.shadow === undefined)
|
|
4264
|
+
return;
|
|
4265
|
+
parent.shadow[this.key] = this.shadow;
|
|
4266
|
+
}
|
|
4267
|
+
scan() {
|
|
4268
|
+
try {
|
|
4269
|
+
if (this.shadow === undefined) {
|
|
4270
|
+
this.firstScan();
|
|
4271
|
+
if (this.started)
|
|
4272
|
+
this.attachShadow();
|
|
4273
|
+
} else if (this.kind === "map" || this.kind === "set") {
|
|
4274
|
+
this.scanCollection();
|
|
4275
|
+
} else {
|
|
4276
|
+
this.scanEntries();
|
|
6442
4277
|
}
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6446
|
-
}
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
4278
|
+
} catch (error) {
|
|
4279
|
+
this.fail(error);
|
|
4280
|
+
}
|
|
4281
|
+
}
|
|
4282
|
+
firstScan() {
|
|
4283
|
+
const proxy = this.proxy;
|
|
4284
|
+
if (this.kind === "map" || this.kind === "set") {
|
|
4285
|
+
this.shadow = deepClone(proxy);
|
|
4286
|
+
return;
|
|
4287
|
+
}
|
|
4288
|
+
if (this.kind === "array") {
|
|
4289
|
+
const length = proxy.length;
|
|
4290
|
+
const shadow2 = new Array(length);
|
|
4291
|
+
this.shadow = shadow2;
|
|
4292
|
+
for (let index = 0;index < length; index++)
|
|
4293
|
+
shadow2[index] = this.adopt(index, proxy[index]);
|
|
4294
|
+
return;
|
|
4295
|
+
}
|
|
4296
|
+
const keys = Object.keys(proxy);
|
|
4297
|
+
const shadow = {};
|
|
4298
|
+
this.shadow = shadow;
|
|
4299
|
+
for (let index = 0;index < keys.length; index++) {
|
|
4300
|
+
const key = keys[index];
|
|
4301
|
+
shadow[key] = this.adopt(key, proxy[key]);
|
|
4302
|
+
}
|
|
4303
|
+
}
|
|
4304
|
+
adopt(key, value) {
|
|
4305
|
+
if (!isNodeValue(value))
|
|
4306
|
+
return copyValue(value);
|
|
4307
|
+
const child = this.createChild(key, value);
|
|
4308
|
+
if (this.children === NO_CHILDREN)
|
|
4309
|
+
this.children = new Map;
|
|
4310
|
+
this.children.set(key, child);
|
|
4311
|
+
return child.shadow;
|
|
4312
|
+
}
|
|
4313
|
+
createChild(key, value) {
|
|
4314
|
+
const raw = import_reactivity.toRaw(value);
|
|
4315
|
+
for (let node = this;node !== null; node = node.parent) {
|
|
4316
|
+
if (node.raw === raw) {
|
|
4317
|
+
throw new Error(`trackVueReactiveEvents: the state holds a cycle at ${[...this.path(), key].join(".")}`);
|
|
4318
|
+
}
|
|
4319
|
+
}
|
|
4320
|
+
return createNode(this.tracker, this, key, value).start();
|
|
4321
|
+
}
|
|
4322
|
+
scanCollection() {
|
|
4323
|
+
const current = deepClone(this.proxy);
|
|
4324
|
+
if (this.tracker.emitting)
|
|
4325
|
+
diffCollection(current, this.shadow, this.path(), this.tracker);
|
|
4326
|
+
if (this.disposed)
|
|
4327
|
+
return;
|
|
4328
|
+
this.shadow = current;
|
|
4329
|
+
this.attachShadow();
|
|
4330
|
+
}
|
|
4331
|
+
scanEntries() {
|
|
4332
|
+
const proxy = this.proxy;
|
|
4333
|
+
const isArray = this.kind === "array";
|
|
4334
|
+
const keys = isArray ? null : Object.keys(proxy);
|
|
4335
|
+
const length = isArray ? proxy.length : keys.length;
|
|
4336
|
+
const values = new Array(length);
|
|
4337
|
+
if (isArray)
|
|
4338
|
+
for (let index = 0;index < length; index++)
|
|
4339
|
+
values[index] = proxy[index];
|
|
4340
|
+
else
|
|
4341
|
+
for (let index = 0;index < length; index++)
|
|
4342
|
+
values[index] = proxy[keys[index]];
|
|
4343
|
+
const scanId = ++this.tracker.scans;
|
|
4344
|
+
const oldChildren = this.children;
|
|
4345
|
+
let children = null;
|
|
4346
|
+
let nodes2 = null;
|
|
4347
|
+
for (let index = 0;index < length; index++) {
|
|
4348
|
+
const value = values[index];
|
|
4349
|
+
if (!isNodeValue(value))
|
|
4350
|
+
continue;
|
|
4351
|
+
const key = isArray ? index : keys[index];
|
|
4352
|
+
const child = this.resolveChild(key, value, oldChildren, scanId);
|
|
4353
|
+
if (children === null) {
|
|
4354
|
+
children = new Map;
|
|
4355
|
+
this.pending = children;
|
|
4356
|
+
nodes2 = new Array(length);
|
|
4357
|
+
}
|
|
4358
|
+
children.set(key, child);
|
|
4359
|
+
nodes2[index] = child;
|
|
4360
|
+
}
|
|
4361
|
+
this.rawIndex = null;
|
|
4362
|
+
for (const child of oldChildren.values())
|
|
4363
|
+
if (child.claim !== scanId)
|
|
4364
|
+
child.dispose();
|
|
4365
|
+
if (isArray)
|
|
4366
|
+
this.diffArray(values, nodes2, oldChildren);
|
|
4367
|
+
else
|
|
4368
|
+
this.diffObject(keys, values, nodes2, oldChildren, scanId);
|
|
4369
|
+
this.pending = null;
|
|
4370
|
+
if (this.disposed) {
|
|
4371
|
+
if (children !== null)
|
|
4372
|
+
for (const child of children.values())
|
|
4373
|
+
child.dispose();
|
|
4374
|
+
return;
|
|
4375
|
+
}
|
|
4376
|
+
this.children = children ?? NO_CHILDREN;
|
|
4377
|
+
}
|
|
4378
|
+
resolveChild(key, value, oldChildren, scanId) {
|
|
4379
|
+
const raw = import_reactivity.toRaw(value);
|
|
4380
|
+
const same = oldChildren.get(key);
|
|
4381
|
+
if (same !== undefined && same.raw === raw && same.claim !== scanId) {
|
|
4382
|
+
same.claim = scanId;
|
|
4383
|
+
return same;
|
|
4384
|
+
}
|
|
4385
|
+
if (oldChildren !== NO_CHILDREN) {
|
|
4386
|
+
this.rawIndex ??= indexByRaw(oldChildren);
|
|
4387
|
+
const candidates = this.rawIndex.get(raw);
|
|
4388
|
+
if (candidates !== undefined) {
|
|
4389
|
+
for (const candidate of candidates) {
|
|
4390
|
+
if (candidate.claim === scanId)
|
|
4391
|
+
continue;
|
|
4392
|
+
candidate.claim = scanId;
|
|
4393
|
+
candidate.key = key;
|
|
4394
|
+
return candidate;
|
|
6462
4395
|
}
|
|
6463
4396
|
}
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
4397
|
+
}
|
|
4398
|
+
return this.createChild(key, value);
|
|
4399
|
+
}
|
|
4400
|
+
diffArray(values, nodes2, oldChildren) {
|
|
4401
|
+
const tracker = this.tracker;
|
|
4402
|
+
const shadow = this.shadow;
|
|
4403
|
+
const emitting = tracker.emitting;
|
|
4404
|
+
const path = emitting ? this.path() : null;
|
|
4405
|
+
const length = values.length;
|
|
4406
|
+
const oldLength = shadow.length;
|
|
4407
|
+
for (let index = 0;index < length; index++) {
|
|
4408
|
+
const child = nodes2 === null ? undefined : nodes2[index];
|
|
4409
|
+
const existed = index < oldLength;
|
|
4410
|
+
const before = shadow[index];
|
|
4411
|
+
const after = child !== undefined ? child.shadow : copyValue(values[index]);
|
|
4412
|
+
if (emitting && !(existed && (child !== undefined ? oldChildren.get(index) === child : before === after))) {
|
|
4413
|
+
path.push(index);
|
|
4414
|
+
if (existed)
|
|
4415
|
+
diffPlain(after, before, path, tracker);
|
|
4416
|
+
else
|
|
4417
|
+
tracker.emit({ action: "set", path: path.slice(), newValue: copyValue(after) });
|
|
4418
|
+
path.pop();
|
|
6473
4419
|
}
|
|
6474
|
-
|
|
6475
|
-
}
|
|
6476
|
-
function stopAll() {
|
|
6477
|
-
rootStop?.();
|
|
6478
|
-
rootStop = null;
|
|
6479
|
-
for (const stop of keyStops.values())
|
|
6480
|
-
stop();
|
|
6481
|
-
keyStops.clear();
|
|
6482
|
-
}
|
|
6483
|
-
function startAll() {
|
|
6484
|
-
for (const k of Object.keys(prev)) {
|
|
6485
|
-
createKeyEffect(k);
|
|
4420
|
+
shadow[index] = after;
|
|
6486
4421
|
}
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
pause: stopAll,
|
|
6493
|
-
resume() {
|
|
6494
|
-
const currentKeys = new Set(Object.keys(vueState));
|
|
6495
|
-
for (const k of Object.keys(prev)) {
|
|
6496
|
-
if (!currentKeys.has(k))
|
|
6497
|
-
delete prev[k];
|
|
4422
|
+
if (length < oldLength) {
|
|
4423
|
+
if (emitting) {
|
|
4424
|
+
path.push("length");
|
|
4425
|
+
tracker.emit({ action: "set", path: path.slice(), newValue: length, oldValue: oldLength });
|
|
4426
|
+
path.pop();
|
|
6498
4427
|
}
|
|
6499
|
-
|
|
6500
|
-
|
|
4428
|
+
shadow.length = length;
|
|
4429
|
+
}
|
|
4430
|
+
}
|
|
4431
|
+
diffObject(keys, values, nodes2, oldChildren, scanId) {
|
|
4432
|
+
const tracker = this.tracker;
|
|
4433
|
+
const raw = this.raw;
|
|
4434
|
+
const shadow = this.shadow;
|
|
4435
|
+
const emitting = tracker.emitting;
|
|
4436
|
+
const path = emitting ? this.path() : null;
|
|
4437
|
+
for (const key of Object.keys(shadow)) {
|
|
4438
|
+
if (hasOwn2.call(raw, key))
|
|
4439
|
+
continue;
|
|
4440
|
+
if (emitting) {
|
|
4441
|
+
const gone = oldChildren.get(key);
|
|
4442
|
+
const oldValue = gone !== undefined && gone.claim !== scanId ? shadow[key] : copyValue(shadow[key]);
|
|
4443
|
+
path.push(key);
|
|
4444
|
+
tracker.emit({ action: "delete", path: path.slice(), oldValue });
|
|
4445
|
+
path.pop();
|
|
4446
|
+
}
|
|
4447
|
+
delete shadow[key];
|
|
4448
|
+
}
|
|
4449
|
+
for (let index = 0;index < keys.length; index++) {
|
|
4450
|
+
const key = keys[index];
|
|
4451
|
+
const child = nodes2 === null ? undefined : nodes2[index];
|
|
4452
|
+
const existed = hasOwn2.call(shadow, key);
|
|
4453
|
+
const before = shadow[key];
|
|
4454
|
+
const after = child !== undefined ? child.shadow : copyValue(values[index]);
|
|
4455
|
+
if (emitting && !(existed && (child !== undefined ? oldChildren.get(key) === child : before === after))) {
|
|
4456
|
+
path.push(key);
|
|
4457
|
+
if (existed)
|
|
4458
|
+
diffPlain(after, before, path, tracker);
|
|
4459
|
+
else
|
|
4460
|
+
tracker.emit({ action: "set", path: path.slice(), newValue: copyValue(after) });
|
|
4461
|
+
path.pop();
|
|
6501
4462
|
}
|
|
6502
|
-
|
|
4463
|
+
shadow[key] = after;
|
|
6503
4464
|
}
|
|
6504
|
-
}
|
|
4465
|
+
}
|
|
4466
|
+
fail(error) {
|
|
4467
|
+
this.discardChildren();
|
|
4468
|
+
if (this.disposed)
|
|
4469
|
+
return;
|
|
4470
|
+
const path = this.path();
|
|
4471
|
+
this.shadow = undefined;
|
|
4472
|
+
try {
|
|
4473
|
+
this.firstScan();
|
|
4474
|
+
} catch {
|
|
4475
|
+
this.discardChildren();
|
|
4476
|
+
this.shadow = undefined;
|
|
4477
|
+
}
|
|
4478
|
+
if (this.started)
|
|
4479
|
+
this.attachShadow();
|
|
4480
|
+
this.tracker.report(path, error);
|
|
4481
|
+
}
|
|
4482
|
+
discardChildren() {
|
|
4483
|
+
for (const child of this.children.values())
|
|
4484
|
+
child.dispose();
|
|
4485
|
+
if (this.pending !== null)
|
|
4486
|
+
for (const child of this.pending.values())
|
|
4487
|
+
child.dispose();
|
|
4488
|
+
this.children = NO_CHILDREN;
|
|
4489
|
+
this.pending = null;
|
|
4490
|
+
this.rawIndex = null;
|
|
4491
|
+
}
|
|
4492
|
+
}
|
|
4493
|
+
function nodeKind(raw) {
|
|
4494
|
+
if (Array.isArray(raw))
|
|
4495
|
+
return "array";
|
|
4496
|
+
if (raw instanceof Map)
|
|
4497
|
+
return "map";
|
|
4498
|
+
if (raw instanceof Set)
|
|
4499
|
+
return "set";
|
|
4500
|
+
return "object";
|
|
4501
|
+
}
|
|
4502
|
+
function isNodeValue(value) {
|
|
4503
|
+
return value !== null && typeof value === "object" && import_reactivity.isReactive(value);
|
|
4504
|
+
}
|
|
4505
|
+
function indexByRaw(children) {
|
|
4506
|
+
const byRaw = new Map;
|
|
4507
|
+
for (const child of children.values()) {
|
|
4508
|
+
const list = byRaw.get(child.raw);
|
|
4509
|
+
if (list)
|
|
4510
|
+
list.push(child);
|
|
4511
|
+
else
|
|
4512
|
+
byRaw.set(child.raw, [child]);
|
|
4513
|
+
}
|
|
4514
|
+
return byRaw;
|
|
6505
4515
|
}
|
|
6506
4516
|
function typeTag(v) {
|
|
6507
4517
|
if (v === null || typeof v !== "object")
|
|
@@ -6516,178 +4526,161 @@ function typeTag(v) {
|
|
|
6516
4526
|
return "date";
|
|
6517
4527
|
return "object";
|
|
6518
4528
|
}
|
|
6519
|
-
function
|
|
6520
|
-
if (
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
return
|
|
4529
|
+
function copyValue(value) {
|
|
4530
|
+
if (value === null || typeof value !== "object")
|
|
4531
|
+
return value;
|
|
4532
|
+
const raw = import_reactivity.toRaw(value);
|
|
4533
|
+
if (raw instanceof Date)
|
|
4534
|
+
return new Date(raw.getTime());
|
|
4535
|
+
if (Array.isArray(raw)) {
|
|
4536
|
+
const length = raw.length;
|
|
4537
|
+
const copy2 = new Array(length);
|
|
4538
|
+
for (let index = 0;index < length; index++)
|
|
4539
|
+
copy2[index] = copyValue(raw[index]);
|
|
4540
|
+
return copy2;
|
|
4541
|
+
}
|
|
4542
|
+
if (raw instanceof Map) {
|
|
4543
|
+
const copy2 = new Map;
|
|
4544
|
+
raw.forEach((entry, key) => copy2.set(copyValue(key), copyValue(entry)));
|
|
4545
|
+
return copy2;
|
|
6525
4546
|
}
|
|
6526
|
-
if (
|
|
6527
|
-
|
|
6528
|
-
|
|
4547
|
+
if (raw instanceof Set) {
|
|
4548
|
+
const copy2 = new Set;
|
|
4549
|
+
raw.forEach((entry) => copy2.add(copyValue(entry)));
|
|
4550
|
+
return copy2;
|
|
6529
4551
|
}
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
4552
|
+
const copy = {};
|
|
4553
|
+
const keys = Object.keys(raw);
|
|
4554
|
+
for (let index = 0;index < keys.length; index++)
|
|
4555
|
+
copy[keys[index]] = copyValue(raw[keys[index]]);
|
|
4556
|
+
return copy;
|
|
4557
|
+
}
|
|
4558
|
+
function diffPlain(curr, old, path, tracker) {
|
|
4559
|
+
if (curr === null || typeof curr !== "object") {
|
|
4560
|
+
if (curr !== old && !(curr !== curr && old !== old)) {
|
|
4561
|
+
tracker.emit({ action: "set", path: path.slice(), oldValue: copyValue(old), newValue: curr });
|
|
6534
4562
|
}
|
|
6535
|
-
return
|
|
4563
|
+
return;
|
|
6536
4564
|
}
|
|
6537
|
-
|
|
6538
|
-
|
|
4565
|
+
const tag = typeTag(curr);
|
|
4566
|
+
if (tag !== typeTag(old)) {
|
|
4567
|
+
tracker.emit({ action: "set", path: path.slice(), oldValue: copyValue(old), newValue: copyValue(curr) });
|
|
4568
|
+
return;
|
|
6539
4569
|
}
|
|
6540
|
-
if (
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
if (curr instanceof Set) {
|
|
6544
|
-
return diffAndCloneSet(curr, old, pathStack, emit);
|
|
6545
|
-
}
|
|
6546
|
-
return diffAndCloneObject(curr, old, pathStack, emit);
|
|
6547
|
-
}
|
|
6548
|
-
function diffAndCloneObject(curr, old, pathStack, emit) {
|
|
6549
|
-
const currKeys = Object.keys(curr);
|
|
6550
|
-
const oldKeys = Object.keys(old);
|
|
6551
|
-
let changed = false;
|
|
6552
|
-
let result = null;
|
|
6553
|
-
for (let i = 0;i < oldKeys.length; i++) {
|
|
6554
|
-
const k = oldKeys[i];
|
|
6555
|
-
if (!(k in curr)) {
|
|
6556
|
-
if (!changed) {
|
|
6557
|
-
changed = true;
|
|
6558
|
-
result = { ...old };
|
|
6559
|
-
}
|
|
6560
|
-
pathStack.push(k);
|
|
6561
|
-
emit({ action: "delete", path: pathStack.slice(), oldValue: old[k] });
|
|
6562
|
-
pathStack.pop();
|
|
6563
|
-
delete result[k];
|
|
6564
|
-
}
|
|
6565
|
-
}
|
|
6566
|
-
for (let i = 0;i < currKeys.length; i++) {
|
|
6567
|
-
const k = currKeys[i];
|
|
6568
|
-
if (!(k in old)) {
|
|
6569
|
-
if (!changed) {
|
|
6570
|
-
changed = true;
|
|
6571
|
-
result = { ...old };
|
|
6572
|
-
}
|
|
6573
|
-
pathStack.push(k);
|
|
6574
|
-
emit({ action: "set", path: pathStack.slice(), newValue: deepClone(curr[k]) });
|
|
6575
|
-
pathStack.pop();
|
|
6576
|
-
result[k] = deepClone(curr[k]);
|
|
6577
|
-
} else {
|
|
6578
|
-
pathStack.push(k);
|
|
6579
|
-
const childResult = diffAndClone(curr[k], old[k], pathStack, emit);
|
|
6580
|
-
pathStack.pop();
|
|
6581
|
-
if (childResult !== old[k]) {
|
|
6582
|
-
if (!changed) {
|
|
6583
|
-
changed = true;
|
|
6584
|
-
result = { ...old };
|
|
6585
|
-
}
|
|
6586
|
-
result[k] = childResult;
|
|
6587
|
-
}
|
|
4570
|
+
if (tag === "date") {
|
|
4571
|
+
if (+curr !== +old) {
|
|
4572
|
+
tracker.emit({ action: "set", path: path.slice(), oldValue: copyValue(old), newValue: new Date(+curr) });
|
|
6588
4573
|
}
|
|
4574
|
+
return;
|
|
6589
4575
|
}
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
changed = true;
|
|
6603
|
-
result = old.slice();
|
|
6604
|
-
}
|
|
6605
|
-
result[i] = childResult;
|
|
6606
|
-
}
|
|
6607
|
-
}
|
|
6608
|
-
if (curr.length > old.length) {
|
|
6609
|
-
if (!changed) {
|
|
6610
|
-
changed = true;
|
|
6611
|
-
result = old.slice();
|
|
6612
|
-
}
|
|
6613
|
-
result.length = curr.length;
|
|
6614
|
-
for (let i = old.length;i < curr.length; i++) {
|
|
6615
|
-
pathStack.push(i);
|
|
6616
|
-
emit({ action: "set", path: pathStack.slice(), newValue: deepClone(curr[i]) });
|
|
6617
|
-
pathStack.pop();
|
|
6618
|
-
result[i] = deepClone(curr[i]);
|
|
6619
|
-
}
|
|
6620
|
-
} else if (curr.length < old.length) {
|
|
6621
|
-
if (!changed) {
|
|
6622
|
-
changed = true;
|
|
6623
|
-
result = old.slice();
|
|
6624
|
-
}
|
|
6625
|
-
pathStack.push("length");
|
|
6626
|
-
emit({ action: "set", path: pathStack.slice(), newValue: curr.length, oldValue: old.length });
|
|
6627
|
-
pathStack.pop();
|
|
6628
|
-
result.length = curr.length;
|
|
6629
|
-
}
|
|
6630
|
-
return changed ? result : old;
|
|
6631
|
-
}
|
|
6632
|
-
function diffAndCloneMap(curr, old, pathStack, emit) {
|
|
6633
|
-
let changed = false;
|
|
6634
|
-
let result = null;
|
|
6635
|
-
const path = pathStack.slice();
|
|
6636
|
-
for (const [k, v] of old.entries()) {
|
|
6637
|
-
if (!curr.has(k)) {
|
|
6638
|
-
if (!changed) {
|
|
6639
|
-
changed = true;
|
|
6640
|
-
result = new Map(old);
|
|
4576
|
+
if (tag === "array") {
|
|
4577
|
+
const min = Math.min(curr.length, old.length);
|
|
4578
|
+
for (let i = 0;i < min; i++) {
|
|
4579
|
+
path.push(i);
|
|
4580
|
+
diffPlain(curr[i], old[i], path, tracker);
|
|
4581
|
+
path.pop();
|
|
4582
|
+
}
|
|
4583
|
+
if (curr.length > old.length) {
|
|
4584
|
+
for (let i = old.length;i < curr.length; i++) {
|
|
4585
|
+
path.push(i);
|
|
4586
|
+
tracker.emit({ action: "set", path: path.slice(), newValue: copyValue(curr[i]) });
|
|
4587
|
+
path.pop();
|
|
6641
4588
|
}
|
|
6642
|
-
|
|
6643
|
-
|
|
4589
|
+
} else if (curr.length < old.length) {
|
|
4590
|
+
path.push("length");
|
|
4591
|
+
tracker.emit({ action: "set", path: path.slice(), newValue: curr.length, oldValue: old.length });
|
|
4592
|
+
path.pop();
|
|
6644
4593
|
}
|
|
4594
|
+
return;
|
|
6645
4595
|
}
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
emit({ action: "
|
|
6654
|
-
|
|
6655
|
-
} else if (!deepEqual(vClone, old.get(k), new WeakMap)) {
|
|
6656
|
-
if (!changed) {
|
|
6657
|
-
changed = true;
|
|
6658
|
-
result = new Map(old);
|
|
6659
|
-
}
|
|
6660
|
-
emit({ action: "map-set", path, key: k, newValue: vClone, oldValue: old.get(k) });
|
|
6661
|
-
result.set(k, vClone);
|
|
4596
|
+
if (tag === "map" || tag === "set") {
|
|
4597
|
+
diffCollection(curr, old, path.slice(), tracker);
|
|
4598
|
+
return;
|
|
4599
|
+
}
|
|
4600
|
+
for (const k of Object.keys(old)) {
|
|
4601
|
+
if (!hasOwn2.call(curr, k)) {
|
|
4602
|
+
path.push(k);
|
|
4603
|
+
tracker.emit({ action: "delete", path: path.slice(), oldValue: copyValue(old[k]) });
|
|
4604
|
+
path.pop();
|
|
6662
4605
|
}
|
|
6663
4606
|
}
|
|
6664
|
-
|
|
4607
|
+
for (const k of Object.keys(curr)) {
|
|
4608
|
+
path.push(k);
|
|
4609
|
+
if (!hasOwn2.call(old, k))
|
|
4610
|
+
tracker.emit({ action: "set", path: path.slice(), newValue: copyValue(curr[k]) });
|
|
4611
|
+
else
|
|
4612
|
+
diffPlain(curr[k], old[k], path, tracker);
|
|
4613
|
+
path.pop();
|
|
4614
|
+
}
|
|
6665
4615
|
}
|
|
6666
|
-
function
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
const
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
4616
|
+
function sameValue(a, b, seen) {
|
|
4617
|
+
if (a === b || a !== a && b !== b)
|
|
4618
|
+
return true;
|
|
4619
|
+
const tag = typeTag(a);
|
|
4620
|
+
if (tag === "primitive" || tag !== typeTag(b))
|
|
4621
|
+
return false;
|
|
4622
|
+
if (tag === "date")
|
|
4623
|
+
return sameValue(+a, +b, seen);
|
|
4624
|
+
seen ??= new WeakMap;
|
|
4625
|
+
if (seen.get(a) === b)
|
|
4626
|
+
return true;
|
|
4627
|
+
seen.set(a, b);
|
|
4628
|
+
if (tag === "array") {
|
|
4629
|
+
if (a.length !== b.length)
|
|
4630
|
+
return false;
|
|
4631
|
+
for (let i = 0;i < a.length; i++)
|
|
4632
|
+
if (!sameValue(a[i], b[i], seen))
|
|
4633
|
+
return false;
|
|
4634
|
+
return true;
|
|
4635
|
+
}
|
|
4636
|
+
if (tag === "map") {
|
|
4637
|
+
if (a.size !== b.size)
|
|
4638
|
+
return false;
|
|
4639
|
+
for (const [k, v] of a)
|
|
4640
|
+
if (!b.has(k) || !sameValue(v, b.get(k), seen))
|
|
4641
|
+
return false;
|
|
4642
|
+
return true;
|
|
4643
|
+
}
|
|
4644
|
+
if (tag === "set") {
|
|
4645
|
+
if (a.size !== b.size)
|
|
4646
|
+
return false;
|
|
4647
|
+
for (const v of a)
|
|
4648
|
+
if (!b.has(v))
|
|
4649
|
+
return false;
|
|
4650
|
+
return true;
|
|
6679
4651
|
}
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
4652
|
+
const keys = Object.keys(a);
|
|
4653
|
+
if (keys.length !== Object.keys(b).length)
|
|
4654
|
+
return false;
|
|
4655
|
+
for (const k of keys)
|
|
4656
|
+
if (!hasOwn2.call(b, k) || !sameValue(a[k], b[k], seen))
|
|
4657
|
+
return false;
|
|
4658
|
+
return true;
|
|
4659
|
+
}
|
|
4660
|
+
function diffCollection(curr, old, path, tracker) {
|
|
4661
|
+
if (curr instanceof Map) {
|
|
4662
|
+
const before = old;
|
|
4663
|
+
for (const [k, v] of before) {
|
|
4664
|
+
if (!curr.has(k))
|
|
4665
|
+
tracker.emit({ action: "map-delete", path: path.slice(), key: k, oldValue: v });
|
|
4666
|
+
}
|
|
4667
|
+
for (const [k, v] of curr) {
|
|
4668
|
+
if (!before.has(k)) {
|
|
4669
|
+
tracker.emit({ action: "map-set", path: path.slice(), key: k, newValue: v });
|
|
4670
|
+
} else if (!sameValue(v, before.get(k), undefined)) {
|
|
4671
|
+
tracker.emit({ action: "map-set", path: path.slice(), key: k, newValue: v, oldValue: before.get(k) });
|
|
6685
4672
|
}
|
|
6686
|
-
emit({ action: "set-add", path, value: deepClone(v) });
|
|
6687
|
-
result.add(deepClone(v));
|
|
6688
4673
|
}
|
|
4674
|
+
return;
|
|
4675
|
+
}
|
|
4676
|
+
for (const v of old) {
|
|
4677
|
+
if (!curr.has(v))
|
|
4678
|
+
tracker.emit({ action: "set-delete", path: path.slice(), value: v, oldValue: v });
|
|
4679
|
+
}
|
|
4680
|
+
for (const v of curr) {
|
|
4681
|
+
if (!old.has(v))
|
|
4682
|
+
tracker.emit({ action: "set-add", path: path.slice(), value: v });
|
|
6689
4683
|
}
|
|
6690
|
-
return changed ? result : old;
|
|
6691
4684
|
}
|
|
6692
4685
|
// src/integrations/electron-bridge.ts
|
|
6693
4686
|
function makeTx() {
|