wevu 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiler.cjs +1 -17
- package/dist/compiler.d.cts +10 -1
- package/dist/compiler.d.mts +10 -1
- package/dist/compiler.mjs +1 -16
- package/dist/index.cjs +1 -2408
- package/dist/index.d.cts +159 -2
- package/dist/index.d.mts +159 -2
- package/dist/index.mjs +1 -2319
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2408 +1 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/scheduler.ts
|
|
3
|
-
const resolvedPromise = Promise.resolve();
|
|
4
|
-
const jobQueue = /* @__PURE__ */ new Set();
|
|
5
|
-
let isFlushing = false;
|
|
6
|
-
function flushJobs() {
|
|
7
|
-
isFlushing = true;
|
|
8
|
-
try {
|
|
9
|
-
jobQueue.forEach((job) => job());
|
|
10
|
-
} finally {
|
|
11
|
-
jobQueue.clear();
|
|
12
|
-
isFlushing = false;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
function queueJob(job) {
|
|
16
|
-
jobQueue.add(job);
|
|
17
|
-
if (!isFlushing) resolvedPromise.then(flushJobs);
|
|
18
|
-
}
|
|
19
|
-
function nextTick(fn) {
|
|
20
|
-
return fn ? resolvedPromise.then(fn) : resolvedPromise;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
//#region src/reactivity/core.ts
|
|
25
|
-
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
26
|
-
let activeEffect = null;
|
|
27
|
-
const effectStack = [];
|
|
28
|
-
let batchDepth = 0;
|
|
29
|
-
const batchedEffects = /* @__PURE__ */ new Set();
|
|
30
|
-
function startBatch() {
|
|
31
|
-
batchDepth++;
|
|
32
|
-
}
|
|
33
|
-
function endBatch() {
|
|
34
|
-
if (batchDepth === 0) return;
|
|
35
|
-
batchDepth--;
|
|
36
|
-
if (batchDepth === 0) flushBatchedEffects();
|
|
37
|
-
}
|
|
38
|
-
function batch(fn) {
|
|
39
|
-
startBatch();
|
|
40
|
-
try {
|
|
41
|
-
return fn();
|
|
42
|
-
} finally {
|
|
43
|
-
endBatch();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function flushBatchedEffects() {
|
|
47
|
-
while (batchedEffects.size) {
|
|
48
|
-
const effects = Array.from(batchedEffects);
|
|
49
|
-
batchedEffects.clear();
|
|
50
|
-
for (const ef of effects) ef();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
let activeEffectScope;
|
|
54
|
-
var EffectScopeImpl = class {
|
|
55
|
-
active = true;
|
|
56
|
-
effects = [];
|
|
57
|
-
cleanups = [];
|
|
58
|
-
parent;
|
|
59
|
-
scopes;
|
|
60
|
-
constructor(detached = false) {
|
|
61
|
-
this.detached = detached;
|
|
62
|
-
if (!detached && activeEffectScope) {
|
|
63
|
-
this.parent = activeEffectScope;
|
|
64
|
-
(activeEffectScope.scopes ||= []).push(this);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
run(fn) {
|
|
68
|
-
if (!this.active) return;
|
|
69
|
-
const prev = activeEffectScope;
|
|
70
|
-
activeEffectScope = this;
|
|
71
|
-
try {
|
|
72
|
-
return fn();
|
|
73
|
-
} finally {
|
|
74
|
-
activeEffectScope = prev;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
stop() {
|
|
78
|
-
if (!this.active) return;
|
|
79
|
-
this.active = false;
|
|
80
|
-
for (const effect$1 of this.effects) stop(effect$1);
|
|
81
|
-
this.effects.length = 0;
|
|
82
|
-
for (const cleanup of this.cleanups) cleanup();
|
|
83
|
-
this.cleanups.length = 0;
|
|
84
|
-
if (this.scopes) {
|
|
85
|
-
for (const scope of this.scopes) scope.stop();
|
|
86
|
-
this.scopes.length = 0;
|
|
87
|
-
}
|
|
88
|
-
if (this.parent?.scopes) {
|
|
89
|
-
const index = this.parent.scopes.indexOf(this);
|
|
90
|
-
if (index >= 0) this.parent.scopes.splice(index, 1);
|
|
91
|
-
}
|
|
92
|
-
this.parent = void 0;
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
function effectScope(detached = false) {
|
|
96
|
-
return new EffectScopeImpl(detached);
|
|
97
|
-
}
|
|
98
|
-
function getCurrentScope() {
|
|
99
|
-
return activeEffectScope;
|
|
100
|
-
}
|
|
101
|
-
function onScopeDispose(fn) {
|
|
102
|
-
if (activeEffectScope?.active) activeEffectScope.cleanups.push(fn);
|
|
103
|
-
}
|
|
104
|
-
function recordEffectScope(effect$1) {
|
|
105
|
-
if (activeEffectScope?.active) activeEffectScope.effects.push(effect$1);
|
|
106
|
-
}
|
|
107
|
-
function cleanupEffect(effect$1) {
|
|
108
|
-
const { deps } = effect$1;
|
|
109
|
-
for (let i = 0; i < deps.length; i++) deps[i].delete(effect$1);
|
|
110
|
-
deps.length = 0;
|
|
111
|
-
}
|
|
112
|
-
function createReactiveEffect(fn, options = {}) {
|
|
113
|
-
const effect$1 = function reactiveEffect() {
|
|
114
|
-
if (!effect$1.active) return fn();
|
|
115
|
-
if (effect$1._running) return fn();
|
|
116
|
-
cleanupEffect(effect$1);
|
|
117
|
-
try {
|
|
118
|
-
effect$1._running = true;
|
|
119
|
-
effectStack.push(effect$1);
|
|
120
|
-
activeEffect = effect$1;
|
|
121
|
-
return fn();
|
|
122
|
-
} finally {
|
|
123
|
-
effectStack.pop();
|
|
124
|
-
activeEffect = effectStack[effectStack.length - 1] ?? null;
|
|
125
|
-
effect$1._running = false;
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
effect$1.deps = [];
|
|
129
|
-
effect$1.scheduler = options.scheduler;
|
|
130
|
-
effect$1.onStop = options.onStop;
|
|
131
|
-
effect$1.active = true;
|
|
132
|
-
effect$1._running = false;
|
|
133
|
-
effect$1._fn = fn;
|
|
134
|
-
return effect$1;
|
|
135
|
-
}
|
|
136
|
-
function effect(fn, options = {}) {
|
|
137
|
-
const _effect = createReactiveEffect(fn, options);
|
|
138
|
-
recordEffectScope(_effect);
|
|
139
|
-
if (!options.lazy) _effect();
|
|
140
|
-
return _effect;
|
|
141
|
-
}
|
|
142
|
-
function stop(runner) {
|
|
143
|
-
if (!runner.active) return;
|
|
144
|
-
runner.active = false;
|
|
145
|
-
cleanupEffect(runner);
|
|
146
|
-
runner.onStop?.();
|
|
147
|
-
}
|
|
148
|
-
function track(target, key) {
|
|
149
|
-
if (!activeEffect) return;
|
|
150
|
-
let depsMap = targetMap.get(target);
|
|
151
|
-
if (!depsMap) {
|
|
152
|
-
depsMap = /* @__PURE__ */ new Map();
|
|
153
|
-
targetMap.set(target, depsMap);
|
|
154
|
-
}
|
|
155
|
-
let dep = depsMap.get(key);
|
|
156
|
-
if (!dep) {
|
|
157
|
-
dep = /* @__PURE__ */ new Set();
|
|
158
|
-
depsMap.set(key, dep);
|
|
159
|
-
}
|
|
160
|
-
if (!dep.has(activeEffect)) {
|
|
161
|
-
dep.add(activeEffect);
|
|
162
|
-
activeEffect.deps.push(dep);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
function trigger(target, key) {
|
|
166
|
-
const depsMap = targetMap.get(target);
|
|
167
|
-
if (!depsMap) return;
|
|
168
|
-
const effects = depsMap.get(key);
|
|
169
|
-
if (!effects) return;
|
|
170
|
-
const effectsToRun = /* @__PURE__ */ new Set();
|
|
171
|
-
effects.forEach((ef) => {
|
|
172
|
-
if (ef !== activeEffect) effectsToRun.add(ef);
|
|
173
|
-
});
|
|
174
|
-
effectsToRun.forEach(scheduleEffect);
|
|
175
|
-
}
|
|
176
|
-
function trackEffects(dep) {
|
|
177
|
-
if (!activeEffect) return;
|
|
178
|
-
if (!dep.has(activeEffect)) {
|
|
179
|
-
dep.add(activeEffect);
|
|
180
|
-
activeEffect.deps.push(dep);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
function triggerEffects(dep) {
|
|
184
|
-
dep.forEach(scheduleEffect);
|
|
185
|
-
}
|
|
186
|
-
function scheduleEffect(ef) {
|
|
187
|
-
if (ef.scheduler) {
|
|
188
|
-
ef.scheduler();
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
if (batchDepth > 0) {
|
|
192
|
-
batchedEffects.add(ef);
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
ef();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
//#endregion
|
|
199
|
-
//#region src/reactivity/computed.ts
|
|
200
|
-
function computed(getterOrOptions) {
|
|
201
|
-
let getter;
|
|
202
|
-
let setter;
|
|
203
|
-
const onlyGetter = typeof getterOrOptions === "function";
|
|
204
|
-
if (onlyGetter) {
|
|
205
|
-
getter = getterOrOptions;
|
|
206
|
-
setter = () => {
|
|
207
|
-
throw new Error("Computed value is readonly");
|
|
208
|
-
};
|
|
209
|
-
} else {
|
|
210
|
-
getter = getterOrOptions.get;
|
|
211
|
-
setter = getterOrOptions.set;
|
|
212
|
-
}
|
|
213
|
-
let value;
|
|
214
|
-
let dirty = true;
|
|
215
|
-
let runner;
|
|
216
|
-
const obj = {
|
|
217
|
-
get value() {
|
|
218
|
-
if (dirty) {
|
|
219
|
-
value = runner();
|
|
220
|
-
dirty = false;
|
|
221
|
-
}
|
|
222
|
-
track(obj, "value");
|
|
223
|
-
return value;
|
|
224
|
-
},
|
|
225
|
-
set value(newValue) {
|
|
226
|
-
setter(newValue);
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
runner = effect(getter, {
|
|
230
|
-
lazy: true,
|
|
231
|
-
scheduler: () => {
|
|
232
|
-
if (!dirty) {
|
|
233
|
-
dirty = true;
|
|
234
|
-
trigger(obj, "value");
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
return onlyGetter ? obj : obj;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
//#endregion
|
|
242
|
-
//#region src/reactivity/reactive.ts
|
|
243
|
-
const reactiveMap = /* @__PURE__ */ new WeakMap();
|
|
244
|
-
const rawMap = /* @__PURE__ */ new WeakMap();
|
|
245
|
-
const rawRootMap = /* @__PURE__ */ new WeakMap();
|
|
246
|
-
let ReactiveFlags = /* @__PURE__ */ function(ReactiveFlags$1) {
|
|
247
|
-
ReactiveFlags$1["IS_REACTIVE"] = "__r_isReactive";
|
|
248
|
-
ReactiveFlags$1["RAW"] = "__r_raw";
|
|
249
|
-
ReactiveFlags$1["SKIP"] = "__r_skip";
|
|
250
|
-
return ReactiveFlags$1;
|
|
251
|
-
}({});
|
|
252
|
-
function isObject$1(value) {
|
|
253
|
-
return typeof value === "object" && value !== null;
|
|
254
|
-
}
|
|
255
|
-
const VERSION_KEY = Symbol("wevu.version");
|
|
256
|
-
const mutableHandlers = {
|
|
257
|
-
get(target, key, receiver) {
|
|
258
|
-
if (key === ReactiveFlags.IS_REACTIVE) return true;
|
|
259
|
-
if (key === ReactiveFlags.RAW) return target;
|
|
260
|
-
const res = Reflect.get(target, key, receiver);
|
|
261
|
-
track(target, key);
|
|
262
|
-
if (isObject$1(res)) {
|
|
263
|
-
if (res[ReactiveFlags.SKIP]) return res;
|
|
264
|
-
const child = res;
|
|
265
|
-
const parentRoot = rawRootMap.get(target) ?? target;
|
|
266
|
-
if (!rawRootMap.has(child)) rawRootMap.set(child, parentRoot);
|
|
267
|
-
return reactive(res);
|
|
268
|
-
}
|
|
269
|
-
return res;
|
|
270
|
-
},
|
|
271
|
-
set(target, key, value, receiver) {
|
|
272
|
-
const oldValue = Reflect.get(target, key, receiver);
|
|
273
|
-
const result = Reflect.set(target, key, value, receiver);
|
|
274
|
-
if (!Object.is(oldValue, value)) {
|
|
275
|
-
trigger(target, key);
|
|
276
|
-
trigger(target, VERSION_KEY);
|
|
277
|
-
const root = rawRootMap.get(target);
|
|
278
|
-
if (root && root !== target) trigger(root, VERSION_KEY);
|
|
279
|
-
}
|
|
280
|
-
return result;
|
|
281
|
-
},
|
|
282
|
-
deleteProperty(target, key) {
|
|
283
|
-
const hadKey = Object.prototype.hasOwnProperty.call(target, key);
|
|
284
|
-
const result = Reflect.deleteProperty(target, key);
|
|
285
|
-
if (hadKey && result) {
|
|
286
|
-
trigger(target, key);
|
|
287
|
-
trigger(target, VERSION_KEY);
|
|
288
|
-
const root = rawRootMap.get(target);
|
|
289
|
-
if (root && root !== target) trigger(root, VERSION_KEY);
|
|
290
|
-
}
|
|
291
|
-
return result;
|
|
292
|
-
},
|
|
293
|
-
ownKeys(target) {
|
|
294
|
-
track(target, Symbol.iterator);
|
|
295
|
-
track(target, VERSION_KEY);
|
|
296
|
-
return Reflect.ownKeys(target);
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
function reactive(target) {
|
|
300
|
-
if (!isObject$1(target)) return target;
|
|
301
|
-
const existingProxy = reactiveMap.get(target);
|
|
302
|
-
if (existingProxy) return existingProxy;
|
|
303
|
-
if (target[ReactiveFlags.IS_REACTIVE]) return target;
|
|
304
|
-
const proxy = new Proxy(target, mutableHandlers);
|
|
305
|
-
reactiveMap.set(target, proxy);
|
|
306
|
-
rawMap.set(proxy, target);
|
|
307
|
-
if (!rawRootMap.has(target)) rawRootMap.set(target, target);
|
|
308
|
-
return proxy;
|
|
309
|
-
}
|
|
310
|
-
function isReactive(value) {
|
|
311
|
-
return Boolean(value && value[ReactiveFlags.IS_REACTIVE]);
|
|
312
|
-
}
|
|
313
|
-
function toRaw(observed) {
|
|
314
|
-
return observed?.[ReactiveFlags.RAW] ?? observed;
|
|
315
|
-
}
|
|
316
|
-
function convertToReactive(value) {
|
|
317
|
-
return isObject$1(value) ? reactive(value) : value;
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* 让 effect 订阅整个对象的“版本号”,无需深度遍历即可对任何字段变化做出响应。
|
|
321
|
-
*/
|
|
322
|
-
function touchReactive(target) {
|
|
323
|
-
track(toRaw(target), VERSION_KEY);
|
|
324
|
-
}
|
|
325
|
-
const shallowReactiveMap = /* @__PURE__ */ new WeakMap();
|
|
326
|
-
const shallowHandlers = {
|
|
327
|
-
get(target, key, receiver) {
|
|
328
|
-
if (key === ReactiveFlags.IS_REACTIVE) return true;
|
|
329
|
-
if (key === ReactiveFlags.RAW) return target;
|
|
330
|
-
const res = Reflect.get(target, key, receiver);
|
|
331
|
-
track(target, key);
|
|
332
|
-
return res;
|
|
333
|
-
},
|
|
334
|
-
set(target, key, value, receiver) {
|
|
335
|
-
const oldValue = Reflect.get(target, key, receiver);
|
|
336
|
-
const result = Reflect.set(target, key, value, receiver);
|
|
337
|
-
if (!Object.is(oldValue, value)) {
|
|
338
|
-
trigger(target, key);
|
|
339
|
-
trigger(target, VERSION_KEY);
|
|
340
|
-
}
|
|
341
|
-
return result;
|
|
342
|
-
},
|
|
343
|
-
deleteProperty(target, key) {
|
|
344
|
-
const hadKey = Object.prototype.hasOwnProperty.call(target, key);
|
|
345
|
-
const result = Reflect.deleteProperty(target, key);
|
|
346
|
-
if (hadKey && result) {
|
|
347
|
-
trigger(target, key);
|
|
348
|
-
trigger(target, VERSION_KEY);
|
|
349
|
-
}
|
|
350
|
-
return result;
|
|
351
|
-
},
|
|
352
|
-
ownKeys(target) {
|
|
353
|
-
track(target, Symbol.iterator);
|
|
354
|
-
track(target, VERSION_KEY);
|
|
355
|
-
return Reflect.ownKeys(target);
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
/**
|
|
359
|
-
* 创建一个浅层响应式代理:仅跟踪第一层属性变更,不深度递归嵌套对象。
|
|
360
|
-
*
|
|
361
|
-
* @param target 待转换的对象
|
|
362
|
-
* @returns 浅层响应式代理
|
|
363
|
-
*
|
|
364
|
-
* @example
|
|
365
|
-
* ```ts
|
|
366
|
-
* const state = shallowReactive({ nested: { count: 0 } })
|
|
367
|
-
*
|
|
368
|
-
* state.nested.count++ // 不会触发 effect(嵌套对象未深度代理)
|
|
369
|
-
* state.nested = { count: 1 } // 会触发 effect(顶层属性变更)
|
|
370
|
-
* ```
|
|
371
|
-
*/
|
|
372
|
-
function shallowReactive(target) {
|
|
373
|
-
if (!isObject$1(target)) return target;
|
|
374
|
-
const existingProxy = shallowReactiveMap.get(target);
|
|
375
|
-
if (existingProxy) return existingProxy;
|
|
376
|
-
if (target[ReactiveFlags.IS_REACTIVE]) return target;
|
|
377
|
-
const proxy = new Proxy(target, shallowHandlers);
|
|
378
|
-
shallowReactiveMap.set(target, proxy);
|
|
379
|
-
rawMap.set(proxy, target);
|
|
380
|
-
return proxy;
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* 判断一个值是否为 shallowReactive 创建的浅层响应式对象
|
|
384
|
-
*/
|
|
385
|
-
function isShallowReactive(value) {
|
|
386
|
-
const raw = toRaw(value);
|
|
387
|
-
return shallowReactiveMap.has(raw);
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* 标记对象为“原始”状态,后续不会被转换为响应式,返回原对象本身。
|
|
391
|
-
*
|
|
392
|
-
* @param value 需要标记的对象
|
|
393
|
-
* @returns 带有跳过标记的原对象
|
|
394
|
-
*
|
|
395
|
-
* @example
|
|
396
|
-
* ```ts
|
|
397
|
-
* const foo = markRaw({
|
|
398
|
-
* nested: {}
|
|
399
|
-
* })
|
|
400
|
-
*
|
|
401
|
-
* const state = reactive({
|
|
402
|
-
* foo
|
|
403
|
-
* })
|
|
404
|
-
*
|
|
405
|
-
* state.foo // 不是响应式对象
|
|
406
|
-
* ```
|
|
407
|
-
*/
|
|
408
|
-
function markRaw(value) {
|
|
409
|
-
if (!isObject$1(value)) return value;
|
|
410
|
-
Object.defineProperty(value, ReactiveFlags.SKIP, {
|
|
411
|
-
value: true,
|
|
412
|
-
configurable: true,
|
|
413
|
-
enumerable: false,
|
|
414
|
-
writable: true
|
|
415
|
-
});
|
|
416
|
-
return value;
|
|
417
|
-
}
|
|
418
|
-
/**
|
|
419
|
-
* 判断某个值是否被标记为原始(即不应转换为响应式)。
|
|
420
|
-
*
|
|
421
|
-
* @param value 待检测的值
|
|
422
|
-
* @returns 若含有跳过标记则返回 true
|
|
423
|
-
*/
|
|
424
|
-
function isRaw(value) {
|
|
425
|
-
return isObject$1(value) && ReactiveFlags.SKIP in value;
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
//#endregion
|
|
429
|
-
//#region src/reactivity/ref.ts
|
|
430
|
-
function isRef(value) {
|
|
431
|
-
return Boolean(value && typeof value === "object" && "value" in value);
|
|
432
|
-
}
|
|
433
|
-
var RefImpl = class {
|
|
434
|
-
_value;
|
|
435
|
-
_rawValue;
|
|
436
|
-
dep;
|
|
437
|
-
constructor(value) {
|
|
438
|
-
this._rawValue = value;
|
|
439
|
-
this._value = convertToReactive(value);
|
|
440
|
-
}
|
|
441
|
-
get value() {
|
|
442
|
-
if (!this.dep) this.dep = /* @__PURE__ */ new Set();
|
|
443
|
-
trackEffects(this.dep);
|
|
444
|
-
return this._value;
|
|
445
|
-
}
|
|
446
|
-
set value(newValue) {
|
|
447
|
-
if (!Object.is(newValue, this._rawValue)) {
|
|
448
|
-
this._rawValue = newValue;
|
|
449
|
-
this._value = convertToReactive(newValue);
|
|
450
|
-
if (this.dep) triggerEffects(this.dep);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
function ref(value) {
|
|
455
|
-
if (isRef(value)) return value;
|
|
456
|
-
return markRaw(new RefImpl(value));
|
|
457
|
-
}
|
|
458
|
-
function unref(value) {
|
|
459
|
-
return isRef(value) ? value.value : value;
|
|
460
|
-
}
|
|
461
|
-
var CustomRefImpl = class {
|
|
462
|
-
_value;
|
|
463
|
-
_factory;
|
|
464
|
-
dep;
|
|
465
|
-
constructor(factory, defaultValue) {
|
|
466
|
-
this._factory = factory;
|
|
467
|
-
this._value = defaultValue;
|
|
468
|
-
}
|
|
469
|
-
get value() {
|
|
470
|
-
if (!this.dep) this.dep = /* @__PURE__ */ new Set();
|
|
471
|
-
trackEffects(this.dep);
|
|
472
|
-
return this._factory.get();
|
|
473
|
-
}
|
|
474
|
-
set value(newValue) {
|
|
475
|
-
this._factory.set(newValue);
|
|
476
|
-
if (this.dep) triggerEffects(this.dep);
|
|
477
|
-
}
|
|
478
|
-
};
|
|
479
|
-
function customRef(factory, defaultValue) {
|
|
480
|
-
return markRaw(new CustomRefImpl(factory, defaultValue));
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
//#endregion
|
|
484
|
-
//#region src/reactivity/readonly.ts
|
|
485
|
-
function readonly(target) {
|
|
486
|
-
if (isRef(target)) {
|
|
487
|
-
const source = target;
|
|
488
|
-
return {
|
|
489
|
-
get value() {
|
|
490
|
-
return source.value;
|
|
491
|
-
},
|
|
492
|
-
set value(_v) {
|
|
493
|
-
throw new Error("Cannot assign to a readonly ref");
|
|
494
|
-
}
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
|
-
if (!isObject$1(target)) return target;
|
|
498
|
-
return new Proxy(target, {
|
|
499
|
-
set() {
|
|
500
|
-
throw new Error("Cannot set property on readonly object");
|
|
501
|
-
},
|
|
502
|
-
deleteProperty() {
|
|
503
|
-
throw new Error("Cannot delete property on readonly object");
|
|
504
|
-
},
|
|
505
|
-
defineProperty() {
|
|
506
|
-
throw new Error("Cannot define property on readonly object");
|
|
507
|
-
},
|
|
508
|
-
get(target$1, key, receiver) {
|
|
509
|
-
return Reflect.get(target$1, key, receiver);
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
//#endregion
|
|
515
|
-
//#region src/reactivity/shallowRef.ts
|
|
516
|
-
function shallowRef(value, defaultValue) {
|
|
517
|
-
return customRef((track$1, trigger$1) => ({
|
|
518
|
-
get() {
|
|
519
|
-
track$1();
|
|
520
|
-
return value;
|
|
521
|
-
},
|
|
522
|
-
set(newValue) {
|
|
523
|
-
if (Object.is(value, newValue)) return;
|
|
524
|
-
value = newValue;
|
|
525
|
-
trigger$1();
|
|
526
|
-
}
|
|
527
|
-
}), defaultValue);
|
|
528
|
-
}
|
|
529
|
-
/**
|
|
530
|
-
* 判断传入值是否为浅层 ref。
|
|
531
|
-
*
|
|
532
|
-
* @param r 待判断的值
|
|
533
|
-
* @returns 若为浅层 ref 则返回 true
|
|
534
|
-
*/
|
|
535
|
-
function isShallowRef(r) {
|
|
536
|
-
return r && typeof r === "object" && "value" in r && typeof r.value !== "function";
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* 主动触发一次浅层 ref 的更新(无需深度比较)。
|
|
540
|
-
*
|
|
541
|
-
* @param ref 需要触发的 ref
|
|
542
|
-
*/
|
|
543
|
-
function triggerRef(ref$1) {
|
|
544
|
-
if (ref$1 && typeof ref$1 === "object" && "value" in ref$1) ref$1.value = ref$1.value;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
//#endregion
|
|
548
|
-
//#region src/reactivity/toRefs.ts
|
|
549
|
-
/**
|
|
550
|
-
* 将一个响应式对象转换成“同结构的普通对象”,其中每个字段都是指向原对象对应属性的 ref。
|
|
551
|
-
*
|
|
552
|
-
* @param object 待转换的响应式对象
|
|
553
|
-
* @returns 包含若干 ref 的普通对象
|
|
554
|
-
*
|
|
555
|
-
* @example
|
|
556
|
-
* ```ts
|
|
557
|
-
* const state = reactive({ foo: 1, bar: 2 })
|
|
558
|
-
* const stateAsRefs = toRefs(state)
|
|
559
|
-
*
|
|
560
|
-
* stateAsRefs.foo.value++ // 2
|
|
561
|
-
* state.foo // 2
|
|
562
|
-
* ```
|
|
563
|
-
*/
|
|
564
|
-
function toRefs(object) {
|
|
565
|
-
if (!isReactive(object)) console.warn(`toRefs() expects a reactive object but received a plain one.`);
|
|
566
|
-
const result = Array.isArray(object) ? Array.from({ length: object.length }) : {};
|
|
567
|
-
for (const key in object) result[key] = toRef(object, key);
|
|
568
|
-
return result;
|
|
569
|
-
}
|
|
570
|
-
function toRef(object, key, defaultValue) {
|
|
571
|
-
const value = object[key];
|
|
572
|
-
if (isRef(value)) return value;
|
|
573
|
-
return customRef((track$1, trigger$1) => ({
|
|
574
|
-
get() {
|
|
575
|
-
track$1();
|
|
576
|
-
return object[key];
|
|
577
|
-
},
|
|
578
|
-
set(newValue) {
|
|
579
|
-
object[key] = newValue;
|
|
580
|
-
trigger$1();
|
|
581
|
-
}
|
|
582
|
-
}), defaultValue);
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
//#endregion
|
|
586
|
-
//#region src/reactivity/traverse.ts
|
|
587
|
-
function traverse(value, seen = /* @__PURE__ */ new Set()) {
|
|
588
|
-
if (!isObject$1(value) || seen.has(value)) return value;
|
|
589
|
-
seen.add(value);
|
|
590
|
-
for (const key in value) traverse(value[key], seen);
|
|
591
|
-
return value;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
//#endregion
|
|
595
|
-
//#region src/reactivity/watch.ts
|
|
596
|
-
let __deepWatchStrategy = "version";
|
|
597
|
-
function setDeepWatchStrategy(strategy) {
|
|
598
|
-
__deepWatchStrategy = strategy;
|
|
599
|
-
}
|
|
600
|
-
function getDeepWatchStrategy() {
|
|
601
|
-
return __deepWatchStrategy;
|
|
602
|
-
}
|
|
603
|
-
function watch(source, cb, options = {}) {
|
|
604
|
-
let getter;
|
|
605
|
-
if (typeof source === "function") getter = source;
|
|
606
|
-
else if (isRef(source)) getter = () => source.value;
|
|
607
|
-
else if (isReactive(source)) getter = () => source;
|
|
608
|
-
else throw new Error("Invalid watch source");
|
|
609
|
-
if (options.deep) {
|
|
610
|
-
const baseGetter = getter;
|
|
611
|
-
getter = () => {
|
|
612
|
-
const val = baseGetter();
|
|
613
|
-
if (__deepWatchStrategy === "version" && isReactive(val)) {
|
|
614
|
-
touchReactive(val);
|
|
615
|
-
return val;
|
|
616
|
-
}
|
|
617
|
-
return traverse(val);
|
|
618
|
-
};
|
|
619
|
-
}
|
|
620
|
-
let cleanup;
|
|
621
|
-
const onCleanup = (fn) => {
|
|
622
|
-
cleanup = fn;
|
|
623
|
-
};
|
|
624
|
-
let oldValue;
|
|
625
|
-
let runner;
|
|
626
|
-
const job = () => {
|
|
627
|
-
if (!runner.active) return;
|
|
628
|
-
const newValue = runner();
|
|
629
|
-
cleanup?.();
|
|
630
|
-
cb(newValue, oldValue, onCleanup);
|
|
631
|
-
oldValue = newValue;
|
|
632
|
-
};
|
|
633
|
-
runner = effect(() => getter(), {
|
|
634
|
-
scheduler: () => queueJob(job),
|
|
635
|
-
lazy: true
|
|
636
|
-
});
|
|
637
|
-
if (options.immediate) job();
|
|
638
|
-
else oldValue = runner();
|
|
639
|
-
const stopHandle = () => {
|
|
640
|
-
cleanup?.();
|
|
641
|
-
cleanup = void 0;
|
|
642
|
-
stop(runner);
|
|
643
|
-
};
|
|
644
|
-
onScopeDispose(stopHandle);
|
|
645
|
-
return stopHandle;
|
|
646
|
-
}
|
|
647
|
-
/**
|
|
648
|
-
* watchEffect 注册一个响应式副作用,可选清理函数。
|
|
649
|
-
* 副作用会立即执行,并在依赖变化时重新运行。
|
|
650
|
-
*/
|
|
651
|
-
function watchEffect(effectFn) {
|
|
652
|
-
let cleanup;
|
|
653
|
-
const onCleanup = (fn) => {
|
|
654
|
-
cleanup = fn;
|
|
655
|
-
};
|
|
656
|
-
const runner = effect(() => {
|
|
657
|
-
cleanup?.();
|
|
658
|
-
cleanup = void 0;
|
|
659
|
-
effectFn(onCleanup);
|
|
660
|
-
}, {
|
|
661
|
-
lazy: true,
|
|
662
|
-
scheduler: () => queueJob(() => {
|
|
663
|
-
if (runner.active) runner();
|
|
664
|
-
})
|
|
665
|
-
});
|
|
666
|
-
runner();
|
|
667
|
-
const stopHandle = () => {
|
|
668
|
-
cleanup?.();
|
|
669
|
-
cleanup = void 0;
|
|
670
|
-
stop(runner);
|
|
671
|
-
};
|
|
672
|
-
onScopeDispose(stopHandle);
|
|
673
|
-
return stopHandle;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
//#endregion
|
|
677
|
-
//#region src/utils.ts
|
|
678
|
-
function capitalize(str) {
|
|
679
|
-
if (!str) return "";
|
|
680
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
681
|
-
}
|
|
682
|
-
function toPathSegments(path) {
|
|
683
|
-
if (!path) return [];
|
|
684
|
-
return path.split(".").map((segment) => segment.trim()).filter(Boolean);
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
//#endregion
|
|
688
|
-
//#region src/runtime/bindModel.ts
|
|
689
|
-
function setComputedValue$1(setters, key, value) {
|
|
690
|
-
const setter = setters[key];
|
|
691
|
-
if (!setter) throw new Error(`Computed property "${key}" is readonly`);
|
|
692
|
-
setter(value);
|
|
693
|
-
}
|
|
694
|
-
function setWithSegments(target, segments, value) {
|
|
695
|
-
let current = target;
|
|
696
|
-
for (let i = 0; i < segments.length - 1; i++) {
|
|
697
|
-
const key = segments[i];
|
|
698
|
-
if (current[key] == null || typeof current[key] !== "object") current[key] = {};
|
|
699
|
-
current = current[key];
|
|
700
|
-
}
|
|
701
|
-
current[segments[segments.length - 1]] = value;
|
|
702
|
-
}
|
|
703
|
-
function setByPath(state, computedRefs, computedSetters, segments, value) {
|
|
704
|
-
if (!segments.length) return;
|
|
705
|
-
const [head, ...rest] = segments;
|
|
706
|
-
if (!rest.length) {
|
|
707
|
-
if (computedRefs[head]) setComputedValue$1(computedSetters, head, value);
|
|
708
|
-
else {
|
|
709
|
-
const current = state[head];
|
|
710
|
-
if (isRef(current)) current.value = value;
|
|
711
|
-
else state[head] = value;
|
|
712
|
-
}
|
|
713
|
-
return;
|
|
714
|
-
}
|
|
715
|
-
if (computedRefs[head]) {
|
|
716
|
-
setComputedValue$1(computedSetters, head, value);
|
|
717
|
-
return;
|
|
718
|
-
}
|
|
719
|
-
if (state[head] == null || typeof state[head] !== "object") state[head] = {};
|
|
720
|
-
setWithSegments(state[head], rest, value);
|
|
721
|
-
}
|
|
722
|
-
function getFromPath(target, segments) {
|
|
723
|
-
return segments.reduce((acc, segment) => {
|
|
724
|
-
if (acc == null) return acc;
|
|
725
|
-
return acc[segment];
|
|
726
|
-
}, target);
|
|
727
|
-
}
|
|
728
|
-
function defaultParser(event) {
|
|
729
|
-
if (event == null) return event;
|
|
730
|
-
if (typeof event === "object") {
|
|
731
|
-
if ("detail" in event && event.detail && "value" in event.detail) return event.detail.value;
|
|
732
|
-
if ("target" in event && event.target && "value" in event.target) return event.target.value;
|
|
733
|
-
}
|
|
734
|
-
return event;
|
|
735
|
-
}
|
|
736
|
-
function createBindModel(publicInstance, state, computedRefs, computedSetters) {
|
|
737
|
-
const bindModel = (path, bindingOptions) => {
|
|
738
|
-
const segments = toPathSegments(path);
|
|
739
|
-
if (!segments.length) throw new Error("bindModel requires a non-empty path");
|
|
740
|
-
const resolveValue = () => getFromPath(publicInstance, segments);
|
|
741
|
-
const assignValue = (value) => {
|
|
742
|
-
setByPath(state, computedRefs, computedSetters, segments, value);
|
|
743
|
-
};
|
|
744
|
-
const defaultOptions = {
|
|
745
|
-
event: "input",
|
|
746
|
-
valueProp: "value",
|
|
747
|
-
parser: defaultParser,
|
|
748
|
-
formatter: (value) => value,
|
|
749
|
-
...bindingOptions
|
|
750
|
-
};
|
|
751
|
-
return {
|
|
752
|
-
get value() {
|
|
753
|
-
return resolveValue();
|
|
754
|
-
},
|
|
755
|
-
set value(nextValue) {
|
|
756
|
-
assignValue(nextValue);
|
|
757
|
-
},
|
|
758
|
-
update(nextValue) {
|
|
759
|
-
assignValue(nextValue);
|
|
760
|
-
},
|
|
761
|
-
model(modelOptions) {
|
|
762
|
-
const merged = {
|
|
763
|
-
...defaultOptions,
|
|
764
|
-
...modelOptions
|
|
765
|
-
};
|
|
766
|
-
const handlerKey = `on${capitalize(merged.event)}`;
|
|
767
|
-
const payload = { [merged.valueProp]: merged.formatter(resolveValue()) };
|
|
768
|
-
payload[handlerKey] = (event) => {
|
|
769
|
-
assignValue(merged.parser(event));
|
|
770
|
-
};
|
|
771
|
-
return payload;
|
|
772
|
-
}
|
|
773
|
-
};
|
|
774
|
-
};
|
|
775
|
-
return bindModel;
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
//#endregion
|
|
779
|
-
//#region src/runtime/diff.ts
|
|
780
|
-
function isPlainObject$1(value) {
|
|
781
|
-
if (Object.prototype.toString.call(value) !== "[object Object]") return false;
|
|
782
|
-
const proto = Object.getPrototypeOf(value);
|
|
783
|
-
return proto === null || proto === Object.prototype;
|
|
784
|
-
}
|
|
785
|
-
function toPlain(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
786
|
-
const unwrapped = unref(value);
|
|
787
|
-
if (typeof unwrapped !== "object" || unwrapped === null) return unwrapped;
|
|
788
|
-
const raw = isReactive(unwrapped) ? toRaw(unwrapped) : unwrapped;
|
|
789
|
-
if (seen.has(raw)) return seen.get(raw);
|
|
790
|
-
if (Array.isArray(raw)) {
|
|
791
|
-
const arr = [];
|
|
792
|
-
seen.set(raw, arr);
|
|
793
|
-
raw.forEach((item, index) => {
|
|
794
|
-
arr[index] = toPlain(item, seen);
|
|
795
|
-
});
|
|
796
|
-
return arr;
|
|
797
|
-
}
|
|
798
|
-
const output = {};
|
|
799
|
-
seen.set(raw, output);
|
|
800
|
-
Object.keys(raw).forEach((key) => {
|
|
801
|
-
output[key] = toPlain(raw[key], seen);
|
|
802
|
-
});
|
|
803
|
-
return output;
|
|
804
|
-
}
|
|
805
|
-
function isDeepEqual(a, b) {
|
|
806
|
-
if (Object.is(a, b)) return true;
|
|
807
|
-
if (Array.isArray(a) && Array.isArray(b)) return isArrayEqual(a, b);
|
|
808
|
-
if (isPlainObject$1(a) && isPlainObject$1(b)) return isPlainObjectEqual(a, b);
|
|
809
|
-
return false;
|
|
810
|
-
}
|
|
811
|
-
function isArrayEqual(a, b) {
|
|
812
|
-
if (a.length !== b.length) return false;
|
|
813
|
-
for (let i = 0; i < a.length; i++) if (!isDeepEqual(a[i], b[i])) return false;
|
|
814
|
-
return true;
|
|
815
|
-
}
|
|
816
|
-
function isPlainObjectEqual(a, b) {
|
|
817
|
-
const aKeys = Object.keys(a);
|
|
818
|
-
const bKeys = Object.keys(b);
|
|
819
|
-
if (aKeys.length !== bKeys.length) return false;
|
|
820
|
-
for (const key of aKeys) {
|
|
821
|
-
if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
|
|
822
|
-
if (!isDeepEqual(a[key], b[key])) return false;
|
|
823
|
-
}
|
|
824
|
-
return true;
|
|
825
|
-
}
|
|
826
|
-
function normalizeSetDataValue(value) {
|
|
827
|
-
return value === void 0 ? null : value;
|
|
828
|
-
}
|
|
829
|
-
function assignNestedDiff(prev, next, path, output) {
|
|
830
|
-
if (isDeepEqual(prev, next)) return;
|
|
831
|
-
if (isPlainObject$1(prev) && isPlainObject$1(next)) {
|
|
832
|
-
new Set([...Object.keys(prev), ...Object.keys(next)]).forEach((key) => {
|
|
833
|
-
if (!Object.prototype.hasOwnProperty.call(next, key)) {
|
|
834
|
-
output[`${path}.${key}`] = null;
|
|
835
|
-
return;
|
|
836
|
-
}
|
|
837
|
-
assignNestedDiff(prev[key], next[key], `${path}.${key}`, output);
|
|
838
|
-
});
|
|
839
|
-
return;
|
|
840
|
-
}
|
|
841
|
-
if (Array.isArray(prev) && Array.isArray(next)) {
|
|
842
|
-
if (!isArrayEqual(prev, next)) output[path] = normalizeSetDataValue(next);
|
|
843
|
-
return;
|
|
844
|
-
}
|
|
845
|
-
output[path] = normalizeSetDataValue(next);
|
|
846
|
-
}
|
|
847
|
-
function diffSnapshots(prev, next) {
|
|
848
|
-
const diff = {};
|
|
849
|
-
new Set([...Object.keys(prev), ...Object.keys(next)]).forEach((key) => {
|
|
850
|
-
if (!Object.prototype.hasOwnProperty.call(next, key)) {
|
|
851
|
-
diff[key] = null;
|
|
852
|
-
return;
|
|
853
|
-
}
|
|
854
|
-
assignNestedDiff(prev[key], next[key], key, diff);
|
|
855
|
-
});
|
|
856
|
-
return diff;
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
//#endregion
|
|
860
|
-
//#region src/runtime/hooks.ts
|
|
861
|
-
let __currentInstance;
|
|
862
|
-
let __currentSetupContext;
|
|
863
|
-
function getCurrentInstance() {
|
|
864
|
-
return __currentInstance;
|
|
865
|
-
}
|
|
866
|
-
function setCurrentInstance(inst) {
|
|
867
|
-
__currentInstance = inst;
|
|
868
|
-
}
|
|
869
|
-
function getCurrentSetupContext() {
|
|
870
|
-
return __currentSetupContext;
|
|
871
|
-
}
|
|
872
|
-
function setCurrentSetupContext(ctx) {
|
|
873
|
-
__currentSetupContext = ctx;
|
|
874
|
-
}
|
|
875
|
-
function ensureHookBucket(target) {
|
|
876
|
-
if (!target.__wevuHooks) target.__wevuHooks = Object.create(null);
|
|
877
|
-
return target.__wevuHooks;
|
|
878
|
-
}
|
|
879
|
-
function pushHook(target, name, handler, { single = false } = {}) {
|
|
880
|
-
const bucket = ensureHookBucket(target);
|
|
881
|
-
if (single) bucket[name] = handler;
|
|
882
|
-
else (bucket[name] ?? (bucket[name] = [])).push(handler);
|
|
883
|
-
}
|
|
884
|
-
function callHookList(target, name, args = []) {
|
|
885
|
-
const hooks = target.__wevuHooks;
|
|
886
|
-
if (!hooks) return;
|
|
887
|
-
const list = hooks[name];
|
|
888
|
-
if (!list) return;
|
|
889
|
-
const ctx = target.__wevu?.proxy ?? target;
|
|
890
|
-
if (Array.isArray(list)) for (const fn of list) try {
|
|
891
|
-
fn.apply(ctx, args);
|
|
892
|
-
} catch {}
|
|
893
|
-
else if (typeof list === "function") try {
|
|
894
|
-
list.apply(ctx, args);
|
|
895
|
-
} catch {}
|
|
896
|
-
}
|
|
897
|
-
function callHookReturn(target, name, args = []) {
|
|
898
|
-
const hooks = target.__wevuHooks;
|
|
899
|
-
if (!hooks) return;
|
|
900
|
-
const entry = hooks[name];
|
|
901
|
-
if (!entry) return;
|
|
902
|
-
const ctx = target.__wevu?.proxy ?? target;
|
|
903
|
-
if (typeof entry === "function") try {
|
|
904
|
-
return entry.apply(ctx, args);
|
|
905
|
-
} catch {
|
|
906
|
-
return;
|
|
907
|
-
}
|
|
908
|
-
if (Array.isArray(entry)) {
|
|
909
|
-
let out;
|
|
910
|
-
for (const fn of entry) try {
|
|
911
|
-
out = fn.apply(ctx, args);
|
|
912
|
-
} catch {}
|
|
913
|
-
return out;
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
function onLaunch(handler) {
|
|
917
|
-
if (!__currentInstance) throw new Error("onLaunch() must be called synchronously inside setup()");
|
|
918
|
-
pushHook(__currentInstance, "onLaunch", handler);
|
|
919
|
-
}
|
|
920
|
-
function onPageNotFound(handler) {
|
|
921
|
-
if (!__currentInstance) throw new Error("onPageNotFound() must be called synchronously inside setup()");
|
|
922
|
-
pushHook(__currentInstance, "onPageNotFound", handler);
|
|
923
|
-
}
|
|
924
|
-
function onUnhandledRejection(handler) {
|
|
925
|
-
if (!__currentInstance) throw new Error("onUnhandledRejection() must be called synchronously inside setup()");
|
|
926
|
-
pushHook(__currentInstance, "onUnhandledRejection", handler);
|
|
927
|
-
}
|
|
928
|
-
function onThemeChange(handler) {
|
|
929
|
-
if (!__currentInstance) throw new Error("onThemeChange() must be called synchronously inside setup()");
|
|
930
|
-
pushHook(__currentInstance, "onThemeChange", handler);
|
|
931
|
-
}
|
|
932
|
-
function onShow(handler) {
|
|
933
|
-
if (!__currentInstance) throw new Error("onShow() must be called synchronously inside setup()");
|
|
934
|
-
pushHook(__currentInstance, "onShow", handler);
|
|
935
|
-
}
|
|
936
|
-
function onLoad(handler) {
|
|
937
|
-
if (!__currentInstance) throw new Error("onLoad() must be called synchronously inside setup()");
|
|
938
|
-
pushHook(__currentInstance, "onLoad", handler);
|
|
939
|
-
}
|
|
940
|
-
function onHide(handler) {
|
|
941
|
-
if (!__currentInstance) throw new Error("onHide() must be called synchronously inside setup()");
|
|
942
|
-
pushHook(__currentInstance, "onHide", handler);
|
|
943
|
-
}
|
|
944
|
-
function onUnload(handler) {
|
|
945
|
-
if (!__currentInstance) throw new Error("onUnload() must be called synchronously inside setup()");
|
|
946
|
-
pushHook(__currentInstance, "onUnload", handler);
|
|
947
|
-
}
|
|
948
|
-
function onReady(handler) {
|
|
949
|
-
if (!__currentInstance) throw new Error("onReady() must be called synchronously inside setup()");
|
|
950
|
-
pushHook(__currentInstance, "onReady", handler);
|
|
951
|
-
}
|
|
952
|
-
function onPullDownRefresh(handler) {
|
|
953
|
-
if (!__currentInstance) throw new Error("onPullDownRefresh() must be called synchronously inside setup()");
|
|
954
|
-
pushHook(__currentInstance, "onPullDownRefresh", handler);
|
|
955
|
-
}
|
|
956
|
-
function onReachBottom(handler) {
|
|
957
|
-
if (!__currentInstance) throw new Error("onReachBottom() must be called synchronously inside setup()");
|
|
958
|
-
pushHook(__currentInstance, "onReachBottom", handler);
|
|
959
|
-
}
|
|
960
|
-
function onPageScroll(handler) {
|
|
961
|
-
if (!__currentInstance) throw new Error("onPageScroll() must be called synchronously inside setup()");
|
|
962
|
-
pushHook(__currentInstance, "onPageScroll", handler);
|
|
963
|
-
}
|
|
964
|
-
function onRouteDone(handler) {
|
|
965
|
-
if (!__currentInstance) throw new Error("onRouteDone() must be called synchronously inside setup()");
|
|
966
|
-
pushHook(__currentInstance, "onRouteDone", handler);
|
|
967
|
-
}
|
|
968
|
-
function onTabItemTap(handler) {
|
|
969
|
-
if (!__currentInstance) throw new Error("onTabItemTap() must be called synchronously inside setup()");
|
|
970
|
-
pushHook(__currentInstance, "onTabItemTap", handler);
|
|
971
|
-
}
|
|
972
|
-
function onResize(handler) {
|
|
973
|
-
if (!__currentInstance) throw new Error("onResize() must be called synchronously inside setup()");
|
|
974
|
-
pushHook(__currentInstance, "onResize", handler);
|
|
975
|
-
}
|
|
976
|
-
function onMoved(handler) {
|
|
977
|
-
if (!__currentInstance) throw new Error("onMoved() must be called synchronously inside setup()");
|
|
978
|
-
pushHook(__currentInstance, "onMoved", handler);
|
|
979
|
-
}
|
|
980
|
-
function onError(handler) {
|
|
981
|
-
if (!__currentInstance) throw new Error("onError() must be called synchronously inside setup()");
|
|
982
|
-
pushHook(__currentInstance, "onError", handler);
|
|
983
|
-
}
|
|
984
|
-
function onSaveExitState(handler) {
|
|
985
|
-
if (!__currentInstance) throw new Error("onSaveExitState() must be called synchronously inside setup()");
|
|
986
|
-
pushHook(__currentInstance, "onSaveExitState", handler, { single: true });
|
|
987
|
-
}
|
|
988
|
-
function onShareAppMessage(handler) {
|
|
989
|
-
if (!__currentInstance) throw new Error("onShareAppMessage() must be called synchronously inside setup()");
|
|
990
|
-
pushHook(__currentInstance, "onShareAppMessage", handler, { single: true });
|
|
991
|
-
}
|
|
992
|
-
function onShareTimeline(handler) {
|
|
993
|
-
if (!__currentInstance) throw new Error("onShareTimeline() must be called synchronously inside setup()");
|
|
994
|
-
pushHook(__currentInstance, "onShareTimeline", handler, { single: true });
|
|
995
|
-
}
|
|
996
|
-
function onAddToFavorites(handler) {
|
|
997
|
-
if (!__currentInstance) throw new Error("onAddToFavorites() must be called synchronously inside setup()");
|
|
998
|
-
pushHook(__currentInstance, "onAddToFavorites", handler, { single: true });
|
|
999
|
-
}
|
|
1000
|
-
/**
|
|
1001
|
-
* Vue 3 对齐:组件/页面已挂载,映射小程序 onReady
|
|
1002
|
-
*/
|
|
1003
|
-
function onMounted(handler) {
|
|
1004
|
-
if (!__currentInstance) throw new Error("onMounted() must be called synchronously inside setup()");
|
|
1005
|
-
pushHook(__currentInstance, "onReady", handler);
|
|
1006
|
-
}
|
|
1007
|
-
/**
|
|
1008
|
-
* Vue 3 对齐:组件/页面更新后触发。
|
|
1009
|
-
* 小程序没有专用 update 生命周期,这里在每次 setData 完成后调用。
|
|
1010
|
-
*/
|
|
1011
|
-
function onUpdated(handler) {
|
|
1012
|
-
if (!__currentInstance) throw new Error("onUpdated() must be called synchronously inside setup()");
|
|
1013
|
-
pushHook(__currentInstance, "__wevuOnUpdated", handler);
|
|
1014
|
-
}
|
|
1015
|
-
/**
|
|
1016
|
-
* Vue 3 对齐:卸载前触发。
|
|
1017
|
-
* 小程序无 before-unload 生命周期,setup 时同步执行以保持语义。
|
|
1018
|
-
*/
|
|
1019
|
-
function onBeforeUnmount(handler) {
|
|
1020
|
-
if (!__currentInstance) throw new Error("onBeforeUnmount() must be called synchronously inside setup()");
|
|
1021
|
-
handler();
|
|
1022
|
-
}
|
|
1023
|
-
/**
|
|
1024
|
-
* Vue 3 对齐:组件/页面卸载;映射到页面 onUnload 或组件 detached
|
|
1025
|
-
*/
|
|
1026
|
-
function onUnmounted(handler) {
|
|
1027
|
-
if (!__currentInstance) throw new Error("onUnmounted() must be called synchronously inside setup()");
|
|
1028
|
-
pushHook(__currentInstance, "onUnload", handler);
|
|
1029
|
-
}
|
|
1030
|
-
/**
|
|
1031
|
-
* Vue 3 对齐:挂载前;setup 时同步触发以模拟 beforeMount 语义
|
|
1032
|
-
*/
|
|
1033
|
-
function onBeforeMount(handler) {
|
|
1034
|
-
if (!__currentInstance) throw new Error("onBeforeMount() must be called synchronously inside setup()");
|
|
1035
|
-
handler();
|
|
1036
|
-
}
|
|
1037
|
-
/**
|
|
1038
|
-
* Vue 3 对齐:更新前;在每次 setData 前触发
|
|
1039
|
-
*/
|
|
1040
|
-
function onBeforeUpdate(handler) {
|
|
1041
|
-
if (!__currentInstance) throw new Error("onBeforeUpdate() must be called synchronously inside setup()");
|
|
1042
|
-
pushHook(__currentInstance, "__wevuOnBeforeUpdate", handler);
|
|
1043
|
-
}
|
|
1044
|
-
/**
|
|
1045
|
-
* Vue 3 对齐:错误捕获;映射到小程序 onError
|
|
1046
|
-
*/
|
|
1047
|
-
function onErrorCaptured(handler) {
|
|
1048
|
-
if (!__currentInstance) throw new Error("onErrorCaptured() must be called synchronously inside setup()");
|
|
1049
|
-
pushHook(__currentInstance, "onError", (err) => handler(err, __currentInstance, ""));
|
|
1050
|
-
}
|
|
1051
|
-
/**
|
|
1052
|
-
* Vue 3 对齐:组件激活;映射到小程序 onShow
|
|
1053
|
-
*/
|
|
1054
|
-
function onActivated(handler) {
|
|
1055
|
-
if (!__currentInstance) throw new Error("onActivated() must be called synchronously inside setup()");
|
|
1056
|
-
pushHook(__currentInstance, "onShow", handler);
|
|
1057
|
-
}
|
|
1058
|
-
/**
|
|
1059
|
-
* Vue 3 对齐:组件失活;映射到小程序 onHide
|
|
1060
|
-
*/
|
|
1061
|
-
function onDeactivated(handler) {
|
|
1062
|
-
if (!__currentInstance) throw new Error("onDeactivated() must be called synchronously inside setup()");
|
|
1063
|
-
pushHook(__currentInstance, "onHide", handler);
|
|
1064
|
-
}
|
|
1065
|
-
/**
|
|
1066
|
-
* Vue 3 对齐:服务端渲染前置钩子。
|
|
1067
|
-
* 小程序无此场景,保留空实现以保持 API 兼容。
|
|
1068
|
-
*/
|
|
1069
|
-
function onServerPrefetch(_handler) {
|
|
1070
|
-
if (!__currentInstance) throw new Error("onServerPrefetch() must be called synchronously inside setup()");
|
|
1071
|
-
}
|
|
1072
|
-
function callUpdateHooks(target, phase) {
|
|
1073
|
-
callHookList(target, phase === "before" ? "__wevuOnBeforeUpdate" : "__wevuOnUpdated");
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
//#endregion
|
|
1077
|
-
//#region src/runtime/register.ts
|
|
1078
|
-
function decodeWxmlEntities(value) {
|
|
1079
|
-
return value.replace(/&/g, "&").replace(/"/g, "\"").replace(/"/g, "\"").replace(/'/g, "'").replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
|
1080
|
-
}
|
|
1081
|
-
function parseModelEventValue(event) {
|
|
1082
|
-
if (event == null) return event;
|
|
1083
|
-
if (typeof event === "object") {
|
|
1084
|
-
if ("detail" in event && event.detail && "value" in event.detail) return event.detail.value;
|
|
1085
|
-
if ("target" in event && event.target && "value" in event.target) return event.target.value;
|
|
1086
|
-
}
|
|
1087
|
-
return event;
|
|
1088
|
-
}
|
|
1089
|
-
function runInlineExpression(ctx, expr, event) {
|
|
1090
|
-
const handlerName = typeof expr === "string" ? expr : void 0;
|
|
1091
|
-
if (!handlerName) return;
|
|
1092
|
-
const argsRaw = (event?.currentTarget)?.dataset?.wvArgs ?? (event?.target)?.dataset?.wvArgs;
|
|
1093
|
-
let args = [];
|
|
1094
|
-
if (typeof argsRaw === "string") try {
|
|
1095
|
-
args = JSON.parse(argsRaw);
|
|
1096
|
-
} catch {
|
|
1097
|
-
try {
|
|
1098
|
-
args = JSON.parse(decodeWxmlEntities(argsRaw));
|
|
1099
|
-
} catch {
|
|
1100
|
-
args = [];
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
if (!Array.isArray(args)) args = [];
|
|
1104
|
-
const resolvedArgs = args.map((item) => item === "$event" ? event : item);
|
|
1105
|
-
const handler = ctx?.[handlerName];
|
|
1106
|
-
if (typeof handler === "function") return handler.apply(ctx, resolvedArgs);
|
|
1107
|
-
}
|
|
1108
|
-
function runSetupFunction(setup, props, context) {
|
|
1109
|
-
if (typeof setup !== "function") return;
|
|
1110
|
-
const runtimeContext = context?.runtime ?? {
|
|
1111
|
-
methods: Object.create(null),
|
|
1112
|
-
state: {},
|
|
1113
|
-
proxy: {},
|
|
1114
|
-
watch: () => () => {},
|
|
1115
|
-
bindModel: () => {}
|
|
1116
|
-
};
|
|
1117
|
-
if (context) context.runtime = runtimeContext;
|
|
1118
|
-
const finalContext = {
|
|
1119
|
-
...context ?? {},
|
|
1120
|
-
runtime: runtimeContext
|
|
1121
|
-
};
|
|
1122
|
-
return setup.length >= 2 ? setup(props, finalContext) : setup(finalContext);
|
|
1123
|
-
}
|
|
1124
|
-
function normalizeWatchDescriptor(descriptor, runtime, instance) {
|
|
1125
|
-
if (typeof descriptor === "function") return {
|
|
1126
|
-
handler: descriptor.bind(runtime.proxy),
|
|
1127
|
-
options: {}
|
|
1128
|
-
};
|
|
1129
|
-
if (typeof descriptor === "string") {
|
|
1130
|
-
const method = runtime.methods?.[descriptor] ?? instance[descriptor];
|
|
1131
|
-
if (typeof method === "function") return {
|
|
1132
|
-
handler: method.bind(runtime.proxy),
|
|
1133
|
-
options: {}
|
|
1134
|
-
};
|
|
1135
|
-
return;
|
|
1136
|
-
}
|
|
1137
|
-
if (!descriptor || typeof descriptor !== "object") return;
|
|
1138
|
-
const base = normalizeWatchDescriptor(descriptor.handler, runtime, instance);
|
|
1139
|
-
if (!base) return;
|
|
1140
|
-
const options = { ...base.options };
|
|
1141
|
-
if (descriptor.immediate !== void 0) options.immediate = descriptor.immediate;
|
|
1142
|
-
if (descriptor.deep !== void 0) options.deep = descriptor.deep;
|
|
1143
|
-
return {
|
|
1144
|
-
handler: base.handler,
|
|
1145
|
-
options
|
|
1146
|
-
};
|
|
1147
|
-
}
|
|
1148
|
-
function createPathGetter(target, path) {
|
|
1149
|
-
const segments = path.split(".").map((segment) => segment.trim()).filter(Boolean);
|
|
1150
|
-
if (!segments.length) return () => target;
|
|
1151
|
-
return () => {
|
|
1152
|
-
let current = target;
|
|
1153
|
-
for (const segment of segments) {
|
|
1154
|
-
if (current == null) return current;
|
|
1155
|
-
current = current[segment];
|
|
1156
|
-
}
|
|
1157
|
-
return current;
|
|
1158
|
-
};
|
|
1159
|
-
}
|
|
1160
|
-
function registerWatches(runtime, watchMap, instance) {
|
|
1161
|
-
const stops = [];
|
|
1162
|
-
const proxy = runtime.proxy;
|
|
1163
|
-
for (const [expression, descriptor] of Object.entries(watchMap)) {
|
|
1164
|
-
const normalized = normalizeWatchDescriptor(descriptor, runtime, instance);
|
|
1165
|
-
if (!normalized) continue;
|
|
1166
|
-
const getter = createPathGetter(proxy, expression);
|
|
1167
|
-
const stop$1 = runtime.watch(getter, normalized.handler, normalized.options);
|
|
1168
|
-
stops.push(stop$1);
|
|
1169
|
-
}
|
|
1170
|
-
return stops;
|
|
1171
|
-
}
|
|
1172
|
-
function mountRuntimeInstance(target, runtimeApp, watchMap, setup, options) {
|
|
1173
|
-
if (target.__wevu) return target.__wevu;
|
|
1174
|
-
const createDeferredAdapter = (instance) => {
|
|
1175
|
-
let pending;
|
|
1176
|
-
let enabled = false;
|
|
1177
|
-
const adapter$1 = { setData(payload) {
|
|
1178
|
-
if (!enabled) {
|
|
1179
|
-
pending = {
|
|
1180
|
-
...pending ?? {},
|
|
1181
|
-
...payload
|
|
1182
|
-
};
|
|
1183
|
-
return;
|
|
1184
|
-
}
|
|
1185
|
-
if (typeof instance.setData === "function") return instance.setData(payload);
|
|
1186
|
-
} };
|
|
1187
|
-
adapter$1.__wevu_enableSetData = () => {
|
|
1188
|
-
enabled = true;
|
|
1189
|
-
if (pending && Object.keys(pending).length && typeof instance.setData === "function") {
|
|
1190
|
-
const payload = pending;
|
|
1191
|
-
pending = void 0;
|
|
1192
|
-
instance.setData(payload);
|
|
1193
|
-
}
|
|
1194
|
-
};
|
|
1195
|
-
return adapter$1;
|
|
1196
|
-
};
|
|
1197
|
-
const adapter = options?.deferSetData ? createDeferredAdapter(target) : { setData(payload) {
|
|
1198
|
-
if (typeof target.setData === "function") return target.setData(payload);
|
|
1199
|
-
} };
|
|
1200
|
-
const runtime = runtimeApp.mount({ ...adapter });
|
|
1201
|
-
const runtimeProxy = runtime?.proxy ?? {};
|
|
1202
|
-
const runtimeState = runtime?.state ?? {};
|
|
1203
|
-
if (!runtime?.methods) try {
|
|
1204
|
-
runtime.methods = Object.create(null);
|
|
1205
|
-
} catch {}
|
|
1206
|
-
const runtimeMethods = runtime?.methods ?? Object.create(null);
|
|
1207
|
-
const runtimeWatch = runtime?.watch ?? (() => () => {});
|
|
1208
|
-
const runtimeBindModel = runtime?.bindModel ?? (() => {});
|
|
1209
|
-
const runtimeWithDefaults = {
|
|
1210
|
-
...runtime ?? {},
|
|
1211
|
-
state: runtimeState,
|
|
1212
|
-
proxy: runtimeProxy,
|
|
1213
|
-
methods: runtimeMethods,
|
|
1214
|
-
watch: runtimeWatch,
|
|
1215
|
-
bindModel: runtimeBindModel
|
|
1216
|
-
};
|
|
1217
|
-
Object.defineProperty(target, "$wevu", {
|
|
1218
|
-
value: runtimeWithDefaults,
|
|
1219
|
-
configurable: true,
|
|
1220
|
-
enumerable: false,
|
|
1221
|
-
writable: false
|
|
1222
|
-
});
|
|
1223
|
-
target.__wevu = runtimeWithDefaults;
|
|
1224
|
-
if (watchMap) {
|
|
1225
|
-
const stops = registerWatches(runtimeWithDefaults, watchMap, target);
|
|
1226
|
-
if (stops.length) target.__wevuWatchStops = stops;
|
|
1227
|
-
}
|
|
1228
|
-
if (setup) {
|
|
1229
|
-
const props = shallowReactive({ ...target.properties || {} });
|
|
1230
|
-
try {
|
|
1231
|
-
Object.defineProperty(target, "__wevuProps", {
|
|
1232
|
-
value: props,
|
|
1233
|
-
configurable: true,
|
|
1234
|
-
enumerable: false,
|
|
1235
|
-
writable: false
|
|
1236
|
-
});
|
|
1237
|
-
} catch {
|
|
1238
|
-
target.__wevuProps = props;
|
|
1239
|
-
}
|
|
1240
|
-
const context = {
|
|
1241
|
-
props,
|
|
1242
|
-
runtime: runtimeWithDefaults,
|
|
1243
|
-
state: runtimeState,
|
|
1244
|
-
proxy: runtimeProxy,
|
|
1245
|
-
bindModel: runtimeBindModel.bind(runtimeWithDefaults),
|
|
1246
|
-
watch: runtimeWatch.bind(runtimeWithDefaults),
|
|
1247
|
-
instance: target,
|
|
1248
|
-
emit: (event, detail, options$1) => {
|
|
1249
|
-
if (typeof target.triggerEvent === "function") target.triggerEvent(event, detail, options$1);
|
|
1250
|
-
},
|
|
1251
|
-
expose: (exposed) => {
|
|
1252
|
-
target.__wevuExposed = exposed;
|
|
1253
|
-
},
|
|
1254
|
-
attrs: {},
|
|
1255
|
-
slots: Object.create(null)
|
|
1256
|
-
};
|
|
1257
|
-
setCurrentInstance(target);
|
|
1258
|
-
setCurrentSetupContext(context);
|
|
1259
|
-
try {
|
|
1260
|
-
const result = runSetupFunction(setup, props, context);
|
|
1261
|
-
if (result && typeof result === "object") Object.keys(result).forEach((key) => {
|
|
1262
|
-
const val = result[key];
|
|
1263
|
-
if (typeof val === "function") runtime.methods[key] = (...args) => val.apply(runtime.proxy, args);
|
|
1264
|
-
else runtime.state[key] = val;
|
|
1265
|
-
});
|
|
1266
|
-
} finally {
|
|
1267
|
-
setCurrentSetupContext(void 0);
|
|
1268
|
-
setCurrentInstance(void 0);
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
|
-
try {
|
|
1272
|
-
const methods = runtime.methods;
|
|
1273
|
-
for (const name of Object.keys(methods)) if (typeof target[name] !== "function") target[name] = function bridged(...args) {
|
|
1274
|
-
const bound = (this.$wevu?.methods)?.[name];
|
|
1275
|
-
if (typeof bound === "function") return bound.apply(this.$wevu.proxy, args);
|
|
1276
|
-
};
|
|
1277
|
-
} catch {}
|
|
1278
|
-
return runtime;
|
|
1279
|
-
}
|
|
1280
|
-
function enableDeferredSetData(target) {
|
|
1281
|
-
const adapter = target.__wevu?.adapter;
|
|
1282
|
-
if (adapter && typeof adapter.__wevu_enableSetData === "function") adapter.__wevu_enableSetData();
|
|
1283
|
-
}
|
|
1284
|
-
function teardownRuntimeInstance(target) {
|
|
1285
|
-
const runtime = target.__wevu;
|
|
1286
|
-
if (runtime && target.__wevuHooks) callHookList(target, "onUnload", []);
|
|
1287
|
-
if (target.__wevuHooks) target.__wevuHooks = void 0;
|
|
1288
|
-
const stops = target.__wevuWatchStops;
|
|
1289
|
-
if (Array.isArray(stops)) for (const stop$1 of stops) try {
|
|
1290
|
-
stop$1();
|
|
1291
|
-
} catch {}
|
|
1292
|
-
target.__wevuWatchStops = void 0;
|
|
1293
|
-
if (runtime) runtime.unmount();
|
|
1294
|
-
delete target.__wevu;
|
|
1295
|
-
if ("$wevu" in target) delete target.$wevu;
|
|
1296
|
-
}
|
|
1297
|
-
function registerApp(runtimeApp, methods, watch$1, setup, mpOptions) {
|
|
1298
|
-
if (typeof App !== "function") throw new TypeError("createApp requires the global App constructor to be available");
|
|
1299
|
-
const methodNames = Object.keys(methods ?? {});
|
|
1300
|
-
const appOptions = { ...mpOptions };
|
|
1301
|
-
appOptions.globalData = appOptions.globalData ?? {};
|
|
1302
|
-
if (!appOptions.__weapp_vite_inline) appOptions.__weapp_vite_inline = function __weapp_vite_inline(event) {
|
|
1303
|
-
const expr = event?.currentTarget?.dataset?.wvHandler ?? event?.target?.dataset?.wvHandler;
|
|
1304
|
-
return runInlineExpression(this.__wevu?.proxy ?? this, expr, event);
|
|
1305
|
-
};
|
|
1306
|
-
const userOnLaunch = appOptions.onLaunch;
|
|
1307
|
-
appOptions.onLaunch = function onLaunch$1(...args) {
|
|
1308
|
-
mountRuntimeInstance(this, runtimeApp, watch$1, setup);
|
|
1309
|
-
callHookList(this, "onLaunch", args);
|
|
1310
|
-
if (typeof userOnLaunch === "function") userOnLaunch.apply(this, args);
|
|
1311
|
-
};
|
|
1312
|
-
const userOnShow = appOptions.onShow;
|
|
1313
|
-
appOptions.onShow = function onShow$1(...args) {
|
|
1314
|
-
callHookList(this, "onShow", args);
|
|
1315
|
-
if (typeof userOnShow === "function") userOnShow.apply(this, args);
|
|
1316
|
-
};
|
|
1317
|
-
const userOnHide = appOptions.onHide;
|
|
1318
|
-
appOptions.onHide = function onHide$1(...args) {
|
|
1319
|
-
callHookList(this, "onHide", args);
|
|
1320
|
-
if (typeof userOnHide === "function") userOnHide.apply(this, args);
|
|
1321
|
-
};
|
|
1322
|
-
const userOnError = appOptions.onError;
|
|
1323
|
-
appOptions.onError = function onError$1(...args) {
|
|
1324
|
-
callHookList(this, "onError", args);
|
|
1325
|
-
if (typeof userOnError === "function") userOnError.apply(this, args);
|
|
1326
|
-
};
|
|
1327
|
-
const userOnPageNotFound = appOptions.onPageNotFound;
|
|
1328
|
-
appOptions.onPageNotFound = function onPageNotFound$1(...args) {
|
|
1329
|
-
callHookList(this, "onPageNotFound", args);
|
|
1330
|
-
if (typeof userOnPageNotFound === "function") userOnPageNotFound.apply(this, args);
|
|
1331
|
-
};
|
|
1332
|
-
const userOnUnhandledRejection = appOptions.onUnhandledRejection;
|
|
1333
|
-
appOptions.onUnhandledRejection = function onUnhandledRejection$1(...args) {
|
|
1334
|
-
callHookList(this, "onUnhandledRejection", args);
|
|
1335
|
-
if (typeof userOnUnhandledRejection === "function") userOnUnhandledRejection.apply(this, args);
|
|
1336
|
-
};
|
|
1337
|
-
const userOnThemeChange = appOptions.onThemeChange;
|
|
1338
|
-
appOptions.onThemeChange = function onThemeChange$1(...args) {
|
|
1339
|
-
callHookList(this, "onThemeChange", args);
|
|
1340
|
-
if (typeof userOnThemeChange === "function") userOnThemeChange.apply(this, args);
|
|
1341
|
-
};
|
|
1342
|
-
for (const methodName of methodNames) {
|
|
1343
|
-
const userMethod = appOptions[methodName];
|
|
1344
|
-
appOptions[methodName] = function runtimeMethod(...args) {
|
|
1345
|
-
const runtime = this.__wevu;
|
|
1346
|
-
let result;
|
|
1347
|
-
const bound = runtime?.methods?.[methodName];
|
|
1348
|
-
if (bound) result = bound.apply(runtime.proxy, args);
|
|
1349
|
-
if (typeof userMethod === "function") return userMethod.apply(this, args);
|
|
1350
|
-
return result;
|
|
1351
|
-
};
|
|
1352
|
-
}
|
|
1353
|
-
App(appOptions);
|
|
1354
|
-
}
|
|
1355
|
-
function registerComponent(runtimeApp, methods, watch$1, setup, mpOptions) {
|
|
1356
|
-
const { methods: userMethods = {}, lifetimes: userLifetimes = {}, pageLifetimes: userPageLifetimes = {}, options: userOptions = {}, ...rest } = mpOptions;
|
|
1357
|
-
const userOnLoad = rest.onLoad;
|
|
1358
|
-
const userOnUnload = rest.onUnload;
|
|
1359
|
-
const userOnShow = rest.onShow;
|
|
1360
|
-
const userOnHide = rest.onHide;
|
|
1361
|
-
const userOnReady = rest.onReady;
|
|
1362
|
-
const userOnSaveExitState = rest.onSaveExitState;
|
|
1363
|
-
const userOnPullDownRefresh = rest.onPullDownRefresh;
|
|
1364
|
-
const userOnReachBottom = rest.onReachBottom;
|
|
1365
|
-
const userOnPageScroll = rest.onPageScroll;
|
|
1366
|
-
const userOnRouteDone = rest.onRouteDone;
|
|
1367
|
-
const userOnTabItemTap = rest.onTabItemTap;
|
|
1368
|
-
const userOnResize = rest.onResize;
|
|
1369
|
-
const userOnShareAppMessage = rest.onShareAppMessage;
|
|
1370
|
-
const userOnShareTimeline = rest.onShareTimeline;
|
|
1371
|
-
const userOnAddToFavorites = rest.onAddToFavorites;
|
|
1372
|
-
const features = rest.features ?? {};
|
|
1373
|
-
const restOptions = { ...rest };
|
|
1374
|
-
const userObservers = restOptions.observers;
|
|
1375
|
-
const legacyCreated = restOptions.created;
|
|
1376
|
-
delete restOptions.features;
|
|
1377
|
-
delete restOptions.created;
|
|
1378
|
-
delete restOptions.onLoad;
|
|
1379
|
-
delete restOptions.onUnload;
|
|
1380
|
-
delete restOptions.onShow;
|
|
1381
|
-
delete restOptions.onHide;
|
|
1382
|
-
delete restOptions.onReady;
|
|
1383
|
-
const enableOnPullDownRefresh = typeof userOnPullDownRefresh === "function" || Boolean(features.enableOnPullDownRefresh);
|
|
1384
|
-
const enableOnReachBottom = typeof userOnReachBottom === "function" || Boolean(features.enableOnReachBottom);
|
|
1385
|
-
const enableOnPageScroll = typeof userOnPageScroll === "function" || Boolean(features.enableOnPageScroll);
|
|
1386
|
-
const enableOnRouteDone = typeof userOnRouteDone === "function" || Boolean(features.enableOnRouteDone);
|
|
1387
|
-
const enableOnTabItemTap = typeof userOnTabItemTap === "function" || Boolean(features.enableOnTabItemTap);
|
|
1388
|
-
const enableOnResize = typeof userOnResize === "function" || Boolean(features.enableOnResize);
|
|
1389
|
-
const enableOnShareAppMessage = typeof userOnShareAppMessage === "function" || Boolean(features.enableOnShareAppMessage);
|
|
1390
|
-
const enableOnShareTimeline = typeof userOnShareTimeline === "function" || Boolean(features.enableOnShareTimeline);
|
|
1391
|
-
const enableOnAddToFavorites = typeof userOnAddToFavorites === "function" || Boolean(features.enableOnAddToFavorites);
|
|
1392
|
-
const enableOnSaveExitState = typeof userOnSaveExitState === "function" || Boolean(features.enableOnSaveExitState);
|
|
1393
|
-
const fallbackNoop = () => {};
|
|
1394
|
-
const fallbackShareContent = () => ({});
|
|
1395
|
-
const fallbackTimelineContent = () => ({});
|
|
1396
|
-
const effectiveOnSaveExitState = typeof userOnSaveExitState === "function" ? userOnSaveExitState : (() => ({ data: void 0 }));
|
|
1397
|
-
const effectiveOnPullDownRefresh = typeof userOnPullDownRefresh === "function" ? userOnPullDownRefresh : fallbackNoop;
|
|
1398
|
-
const effectiveOnReachBottom = typeof userOnReachBottom === "function" ? userOnReachBottom : fallbackNoop;
|
|
1399
|
-
const effectiveOnPageScroll = typeof userOnPageScroll === "function" ? userOnPageScroll : fallbackNoop;
|
|
1400
|
-
const effectiveOnRouteDone = typeof userOnRouteDone === "function" ? userOnRouteDone : fallbackNoop;
|
|
1401
|
-
const effectiveOnTabItemTap = typeof userOnTabItemTap === "function" ? userOnTabItemTap : fallbackNoop;
|
|
1402
|
-
const effectiveOnResize = typeof userOnResize === "function" ? userOnResize : fallbackNoop;
|
|
1403
|
-
const effectiveOnShareAppMessage = typeof userOnShareAppMessage === "function" ? userOnShareAppMessage : fallbackShareContent;
|
|
1404
|
-
const effectiveOnShareTimeline = typeof userOnShareTimeline === "function" ? userOnShareTimeline : fallbackTimelineContent;
|
|
1405
|
-
const effectiveOnAddToFavorites = typeof userOnAddToFavorites === "function" ? userOnAddToFavorites : (() => ({}));
|
|
1406
|
-
const hasHook = (target, name) => {
|
|
1407
|
-
const hooks = target.__wevuHooks;
|
|
1408
|
-
if (!hooks) return false;
|
|
1409
|
-
const entry = hooks[name];
|
|
1410
|
-
if (!entry) return false;
|
|
1411
|
-
if (Array.isArray(entry)) return entry.length > 0;
|
|
1412
|
-
return typeof entry === "function";
|
|
1413
|
-
};
|
|
1414
|
-
{
|
|
1415
|
-
const userExport = restOptions.export;
|
|
1416
|
-
restOptions.export = function __wevu_export() {
|
|
1417
|
-
const exposed = this.__wevuExposed ?? {};
|
|
1418
|
-
const base = typeof userExport === "function" ? userExport.call(this) : {};
|
|
1419
|
-
if (base && typeof base === "object" && !Array.isArray(base)) return {
|
|
1420
|
-
...exposed,
|
|
1421
|
-
...base
|
|
1422
|
-
};
|
|
1423
|
-
return base ?? exposed;
|
|
1424
|
-
};
|
|
1425
|
-
}
|
|
1426
|
-
const finalOptions = {
|
|
1427
|
-
multipleSlots: userOptions.multipleSlots ?? true,
|
|
1428
|
-
...userOptions
|
|
1429
|
-
};
|
|
1430
|
-
const syncWevuPropsFromInstance = (instance) => {
|
|
1431
|
-
const propsProxy = instance.__wevuProps;
|
|
1432
|
-
const properties = instance.properties;
|
|
1433
|
-
if (!propsProxy || typeof propsProxy !== "object") return;
|
|
1434
|
-
if (!properties || typeof properties !== "object") return;
|
|
1435
|
-
const next = properties;
|
|
1436
|
-
const currentKeys = Object.keys(propsProxy);
|
|
1437
|
-
for (const existingKey of currentKeys) if (!Object.prototype.hasOwnProperty.call(next, existingKey)) try {
|
|
1438
|
-
delete propsProxy[existingKey];
|
|
1439
|
-
} catch {}
|
|
1440
|
-
for (const [k, v] of Object.entries(next)) try {
|
|
1441
|
-
propsProxy[k] = v;
|
|
1442
|
-
} catch {}
|
|
1443
|
-
};
|
|
1444
|
-
const syncWevuPropValue = (instance, key, value) => {
|
|
1445
|
-
const propsProxy = instance.__wevuProps;
|
|
1446
|
-
if (!propsProxy || typeof propsProxy !== "object") return;
|
|
1447
|
-
try {
|
|
1448
|
-
propsProxy[key] = value;
|
|
1449
|
-
} catch {}
|
|
1450
|
-
};
|
|
1451
|
-
const propKeys = restOptions.properties && typeof restOptions.properties === "object" ? Object.keys(restOptions.properties) : [];
|
|
1452
|
-
const injectedObservers = {};
|
|
1453
|
-
if (propKeys.length) for (const key of propKeys) injectedObservers[key] = function __wevu_prop_observer(newValue) {
|
|
1454
|
-
syncWevuPropValue(this, key, newValue);
|
|
1455
|
-
};
|
|
1456
|
-
const finalObservers = { ...userObservers ?? {} };
|
|
1457
|
-
for (const [key, injected] of Object.entries(injectedObservers)) {
|
|
1458
|
-
const existing = finalObservers[key];
|
|
1459
|
-
if (typeof existing === "function") finalObservers[key] = function chainedObserver(...args) {
|
|
1460
|
-
existing.apply(this, args);
|
|
1461
|
-
injected.apply(this, args);
|
|
1462
|
-
};
|
|
1463
|
-
else finalObservers[key] = injected;
|
|
1464
|
-
}
|
|
1465
|
-
const finalMethods = { ...userMethods };
|
|
1466
|
-
if (!finalMethods.__weapp_vite_inline) finalMethods.__weapp_vite_inline = function __weapp_vite_inline(event) {
|
|
1467
|
-
const expr = event?.currentTarget?.dataset?.wvHandler ?? event?.target?.dataset?.wvHandler;
|
|
1468
|
-
return runInlineExpression(this.__wevu?.proxy ?? this, expr, event);
|
|
1469
|
-
};
|
|
1470
|
-
if (!finalMethods.__weapp_vite_model) finalMethods.__weapp_vite_model = function __weapp_vite_model(event) {
|
|
1471
|
-
const path = event?.currentTarget?.dataset?.wvModel ?? event?.target?.dataset?.wvModel;
|
|
1472
|
-
if (typeof path !== "string" || !path) return;
|
|
1473
|
-
const runtime = this.__wevu;
|
|
1474
|
-
if (!runtime || typeof runtime.bindModel !== "function") return;
|
|
1475
|
-
const value = parseModelEventValue(event);
|
|
1476
|
-
try {
|
|
1477
|
-
runtime.bindModel(path).update(value);
|
|
1478
|
-
} catch {}
|
|
1479
|
-
};
|
|
1480
|
-
const methodNames = Object.keys(methods ?? {});
|
|
1481
|
-
for (const methodName of methodNames) {
|
|
1482
|
-
const userMethod = finalMethods[methodName];
|
|
1483
|
-
finalMethods[methodName] = function componentMethod(...args) {
|
|
1484
|
-
const runtime = this.__wevu;
|
|
1485
|
-
let result;
|
|
1486
|
-
const bound = runtime?.methods?.[methodName];
|
|
1487
|
-
if (bound) result = bound.apply(runtime.proxy, args);
|
|
1488
|
-
if (typeof userMethod === "function") return userMethod.apply(this, args);
|
|
1489
|
-
return result;
|
|
1490
|
-
};
|
|
1491
|
-
}
|
|
1492
|
-
const pageLifecycleHooks = {
|
|
1493
|
-
onLoad(...args) {
|
|
1494
|
-
mountRuntimeInstance(this, runtimeApp, watch$1, setup);
|
|
1495
|
-
enableDeferredSetData(this);
|
|
1496
|
-
callHookList(this, "onLoad", args);
|
|
1497
|
-
if (typeof userOnLoad === "function") return userOnLoad.apply(this, args);
|
|
1498
|
-
},
|
|
1499
|
-
onUnload(...args) {
|
|
1500
|
-
teardownRuntimeInstance(this);
|
|
1501
|
-
if (typeof userOnUnload === "function") return userOnUnload.apply(this, args);
|
|
1502
|
-
},
|
|
1503
|
-
onShow(...args) {
|
|
1504
|
-
callHookList(this, "onShow", args);
|
|
1505
|
-
if (typeof userOnShow === "function") return userOnShow.apply(this, args);
|
|
1506
|
-
},
|
|
1507
|
-
onHide(...args) {
|
|
1508
|
-
callHookList(this, "onHide", args);
|
|
1509
|
-
if (typeof userOnHide === "function") return userOnHide.apply(this, args);
|
|
1510
|
-
},
|
|
1511
|
-
onReady(...args) {
|
|
1512
|
-
if (!this.__wevuReadyCalled) {
|
|
1513
|
-
this.__wevuReadyCalled = true;
|
|
1514
|
-
callHookList(this, "onReady", args);
|
|
1515
|
-
}
|
|
1516
|
-
if (typeof userOnReady === "function") return userOnReady.apply(this, args);
|
|
1517
|
-
}
|
|
1518
|
-
};
|
|
1519
|
-
if (enableOnSaveExitState) pageLifecycleHooks.onSaveExitState = function onSaveExitState$1(...args) {
|
|
1520
|
-
const ret = callHookReturn(this, "onSaveExitState", args);
|
|
1521
|
-
if (ret !== void 0) return ret;
|
|
1522
|
-
return effectiveOnSaveExitState.apply(this, args);
|
|
1523
|
-
};
|
|
1524
|
-
if (enableOnPullDownRefresh) pageLifecycleHooks.onPullDownRefresh = function onPullDownRefresh$1(...args) {
|
|
1525
|
-
callHookList(this, "onPullDownRefresh", args);
|
|
1526
|
-
if (!hasHook(this, "onPullDownRefresh")) return effectiveOnPullDownRefresh.apply(this, args);
|
|
1527
|
-
};
|
|
1528
|
-
if (enableOnReachBottom) pageLifecycleHooks.onReachBottom = function onReachBottom$1(...args) {
|
|
1529
|
-
callHookList(this, "onReachBottom", args);
|
|
1530
|
-
if (!hasHook(this, "onReachBottom")) return effectiveOnReachBottom.apply(this, args);
|
|
1531
|
-
};
|
|
1532
|
-
if (enableOnPageScroll) pageLifecycleHooks.onPageScroll = function onPageScroll$1(...args) {
|
|
1533
|
-
callHookList(this, "onPageScroll", args);
|
|
1534
|
-
if (!hasHook(this, "onPageScroll")) return effectiveOnPageScroll.apply(this, args);
|
|
1535
|
-
};
|
|
1536
|
-
if (enableOnRouteDone) pageLifecycleHooks.onRouteDone = function onRouteDone$1(...args) {
|
|
1537
|
-
callHookList(this, "onRouteDone", args);
|
|
1538
|
-
if (!hasHook(this, "onRouteDone")) return effectiveOnRouteDone.apply(this, args);
|
|
1539
|
-
};
|
|
1540
|
-
if (enableOnTabItemTap) pageLifecycleHooks.onTabItemTap = function onTabItemTap$1(...args) {
|
|
1541
|
-
callHookList(this, "onTabItemTap", args);
|
|
1542
|
-
if (!hasHook(this, "onTabItemTap")) return effectiveOnTabItemTap.apply(this, args);
|
|
1543
|
-
};
|
|
1544
|
-
if (enableOnResize) pageLifecycleHooks.onResize = function onResize$1(...args) {
|
|
1545
|
-
callHookList(this, "onResize", args);
|
|
1546
|
-
if (!hasHook(this, "onResize")) return effectiveOnResize.apply(this, args);
|
|
1547
|
-
};
|
|
1548
|
-
if (enableOnShareAppMessage) pageLifecycleHooks.onShareAppMessage = function onShareAppMessage$1(...args) {
|
|
1549
|
-
const ret = callHookReturn(this, "onShareAppMessage", args);
|
|
1550
|
-
if (ret !== void 0) return ret;
|
|
1551
|
-
return effectiveOnShareAppMessage.apply(this, args);
|
|
1552
|
-
};
|
|
1553
|
-
if (enableOnShareTimeline) pageLifecycleHooks.onShareTimeline = function onShareTimeline$1(...args) {
|
|
1554
|
-
const ret = callHookReturn(this, "onShareTimeline", args);
|
|
1555
|
-
if (ret !== void 0) return ret;
|
|
1556
|
-
return effectiveOnShareTimeline.apply(this, args);
|
|
1557
|
-
};
|
|
1558
|
-
if (enableOnAddToFavorites) pageLifecycleHooks.onAddToFavorites = function onAddToFavorites$1(...args) {
|
|
1559
|
-
const ret = callHookReturn(this, "onAddToFavorites", args);
|
|
1560
|
-
if (ret !== void 0) return ret;
|
|
1561
|
-
return effectiveOnAddToFavorites.apply(this, args);
|
|
1562
|
-
};
|
|
1563
|
-
Component({
|
|
1564
|
-
...restOptions,
|
|
1565
|
-
...pageLifecycleHooks,
|
|
1566
|
-
observers: finalObservers,
|
|
1567
|
-
lifetimes: {
|
|
1568
|
-
...userLifetimes,
|
|
1569
|
-
created: function created(...args) {
|
|
1570
|
-
mountRuntimeInstance(this, runtimeApp, watch$1, setup, { deferSetData: true });
|
|
1571
|
-
syncWevuPropsFromInstance(this);
|
|
1572
|
-
if (typeof legacyCreated === "function") legacyCreated.apply(this, args);
|
|
1573
|
-
if (typeof userLifetimes.created === "function") userLifetimes.created.apply(this, args);
|
|
1574
|
-
},
|
|
1575
|
-
moved: function moved(...args) {
|
|
1576
|
-
callHookList(this, "onMoved", args);
|
|
1577
|
-
if (typeof userLifetimes.moved === "function") userLifetimes.moved.apply(this, args);
|
|
1578
|
-
},
|
|
1579
|
-
attached: function attached(...args) {
|
|
1580
|
-
mountRuntimeInstance(this, runtimeApp, watch$1, setup);
|
|
1581
|
-
syncWevuPropsFromInstance(this);
|
|
1582
|
-
enableDeferredSetData(this);
|
|
1583
|
-
if (typeof userLifetimes.attached === "function") userLifetimes.attached.apply(this, args);
|
|
1584
|
-
},
|
|
1585
|
-
ready: function ready(...args) {
|
|
1586
|
-
if (!this.__wevuReadyCalled) {
|
|
1587
|
-
this.__wevuReadyCalled = true;
|
|
1588
|
-
syncWevuPropsFromInstance(this);
|
|
1589
|
-
callHookList(this, "onReady", args);
|
|
1590
|
-
}
|
|
1591
|
-
if (typeof userLifetimes.ready === "function") userLifetimes.ready.apply(this, args);
|
|
1592
|
-
},
|
|
1593
|
-
detached: function detached(...args) {
|
|
1594
|
-
teardownRuntimeInstance(this);
|
|
1595
|
-
if (typeof userLifetimes.detached === "function") userLifetimes.detached.apply(this, args);
|
|
1596
|
-
},
|
|
1597
|
-
error: function error(...args) {
|
|
1598
|
-
callHookList(this, "onError", args);
|
|
1599
|
-
if (typeof userLifetimes.error === "function") userLifetimes.error.apply(this, args);
|
|
1600
|
-
}
|
|
1601
|
-
},
|
|
1602
|
-
pageLifetimes: {
|
|
1603
|
-
...userPageLifetimes,
|
|
1604
|
-
show: function show(...args) {
|
|
1605
|
-
callHookList(this, "onShow", args);
|
|
1606
|
-
if (typeof userPageLifetimes.show === "function") userPageLifetimes.show.apply(this, args);
|
|
1607
|
-
},
|
|
1608
|
-
hide: function hide(...args) {
|
|
1609
|
-
callHookList(this, "onHide", args);
|
|
1610
|
-
if (typeof userPageLifetimes.hide === "function") userPageLifetimes.hide.apply(this, args);
|
|
1611
|
-
},
|
|
1612
|
-
resize: function resize(...args) {
|
|
1613
|
-
callHookList(this, "onResize", args);
|
|
1614
|
-
if (typeof userPageLifetimes.resize === "function") userPageLifetimes.resize.apply(this, args);
|
|
1615
|
-
}
|
|
1616
|
-
},
|
|
1617
|
-
methods: finalMethods,
|
|
1618
|
-
options: finalOptions
|
|
1619
|
-
});
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
//#endregion
|
|
1623
|
-
//#region src/runtime/app.ts
|
|
1624
|
-
function createApp(options) {
|
|
1625
|
-
const { data, computed: computedOptions, methods, watch: appWatch, setup: appSetup, ...mpOptions } = options;
|
|
1626
|
-
const resolvedMethods = methods ?? {};
|
|
1627
|
-
const resolvedComputed = computedOptions ?? {};
|
|
1628
|
-
const installedPlugins = /* @__PURE__ */ new Set();
|
|
1629
|
-
const appConfig = { globalProperties: {} };
|
|
1630
|
-
const runtimeApp = {
|
|
1631
|
-
mount(adapter) {
|
|
1632
|
-
const state = reactive((data ?? (() => ({})))());
|
|
1633
|
-
const computedDefs = resolvedComputed;
|
|
1634
|
-
const methodDefs = resolvedMethods;
|
|
1635
|
-
const computedRefs = Object.create(null);
|
|
1636
|
-
const computedSetters = Object.create(null);
|
|
1637
|
-
const boundMethods = {};
|
|
1638
|
-
let mounted = true;
|
|
1639
|
-
let latestSnapshot = {};
|
|
1640
|
-
const stopHandles = [];
|
|
1641
|
-
const computedProxy = new Proxy({}, {
|
|
1642
|
-
get(_target, key) {
|
|
1643
|
-
if (typeof key === "string" && computedRefs[key]) return computedRefs[key].value;
|
|
1644
|
-
},
|
|
1645
|
-
has(_target, key) {
|
|
1646
|
-
return typeof key === "string" && Boolean(computedRefs[key]);
|
|
1647
|
-
},
|
|
1648
|
-
ownKeys() {
|
|
1649
|
-
return Object.keys(computedRefs);
|
|
1650
|
-
},
|
|
1651
|
-
getOwnPropertyDescriptor(_target, key) {
|
|
1652
|
-
if (typeof key === "string" && computedRefs[key]) return {
|
|
1653
|
-
configurable: true,
|
|
1654
|
-
enumerable: true,
|
|
1655
|
-
value: computedRefs[key].value
|
|
1656
|
-
};
|
|
1657
|
-
}
|
|
1658
|
-
});
|
|
1659
|
-
const publicInstance = new Proxy(state, {
|
|
1660
|
-
get(target, key, receiver) {
|
|
1661
|
-
if (typeof key === "string") {
|
|
1662
|
-
if (key === "$state") return state;
|
|
1663
|
-
if (key === "$computed") return computedProxy;
|
|
1664
|
-
if (Object.prototype.hasOwnProperty.call(boundMethods, key)) return boundMethods[key];
|
|
1665
|
-
if (computedRefs[key]) return computedRefs[key].value;
|
|
1666
|
-
if (Object.prototype.hasOwnProperty.call(appConfig.globalProperties, key)) return appConfig.globalProperties[key];
|
|
1667
|
-
}
|
|
1668
|
-
return Reflect.get(target, key, receiver);
|
|
1669
|
-
},
|
|
1670
|
-
set(target, key, value, receiver) {
|
|
1671
|
-
if (typeof key === "string" && computedRefs[key]) {
|
|
1672
|
-
setComputedValue(computedSetters, key, value);
|
|
1673
|
-
return true;
|
|
1674
|
-
}
|
|
1675
|
-
return Reflect.set(target, key, value, receiver);
|
|
1676
|
-
},
|
|
1677
|
-
has(target, key) {
|
|
1678
|
-
if (typeof key === "string" && (computedRefs[key] || Object.prototype.hasOwnProperty.call(boundMethods, key))) return true;
|
|
1679
|
-
return Reflect.has(target, key);
|
|
1680
|
-
},
|
|
1681
|
-
ownKeys(target) {
|
|
1682
|
-
const keys = /* @__PURE__ */ new Set();
|
|
1683
|
-
Reflect.ownKeys(target).forEach((key) => {
|
|
1684
|
-
keys.add(key);
|
|
1685
|
-
});
|
|
1686
|
-
Object.keys(boundMethods).forEach((key) => keys.add(key));
|
|
1687
|
-
Object.keys(computedRefs).forEach((key) => keys.add(key));
|
|
1688
|
-
return Array.from(keys);
|
|
1689
|
-
},
|
|
1690
|
-
getOwnPropertyDescriptor(target, key) {
|
|
1691
|
-
if (Reflect.has(target, key)) return Object.getOwnPropertyDescriptor(target, key);
|
|
1692
|
-
if (typeof key === "string") {
|
|
1693
|
-
if (computedRefs[key]) return {
|
|
1694
|
-
configurable: true,
|
|
1695
|
-
enumerable: true,
|
|
1696
|
-
get() {
|
|
1697
|
-
return computedRefs[key].value;
|
|
1698
|
-
},
|
|
1699
|
-
set(value) {
|
|
1700
|
-
setComputedValue(computedSetters, key, value);
|
|
1701
|
-
}
|
|
1702
|
-
};
|
|
1703
|
-
if (Object.prototype.hasOwnProperty.call(boundMethods, key)) return {
|
|
1704
|
-
configurable: true,
|
|
1705
|
-
enumerable: false,
|
|
1706
|
-
value: boundMethods[key]
|
|
1707
|
-
};
|
|
1708
|
-
}
|
|
1709
|
-
}
|
|
1710
|
-
});
|
|
1711
|
-
Object.keys(methodDefs).forEach((key) => {
|
|
1712
|
-
const handler = methodDefs[key];
|
|
1713
|
-
if (typeof handler === "function") boundMethods[key] = (...args) => handler.apply(publicInstance, args);
|
|
1714
|
-
});
|
|
1715
|
-
Object.keys(computedDefs).forEach((key) => {
|
|
1716
|
-
const definition = computedDefs[key];
|
|
1717
|
-
if (typeof definition === "function") computedRefs[key] = computed(() => definition.call(publicInstance));
|
|
1718
|
-
else {
|
|
1719
|
-
const getter = definition.get?.bind(publicInstance);
|
|
1720
|
-
if (!getter) throw new Error(`Computed property "${key}" requires a getter`);
|
|
1721
|
-
const setter = definition.set?.bind(publicInstance);
|
|
1722
|
-
if (setter) {
|
|
1723
|
-
computedSetters[key] = setter;
|
|
1724
|
-
computedRefs[key] = computed({
|
|
1725
|
-
get: getter,
|
|
1726
|
-
set: setter
|
|
1727
|
-
});
|
|
1728
|
-
} else computedRefs[key] = computed(getter);
|
|
1729
|
-
}
|
|
1730
|
-
});
|
|
1731
|
-
const currentAdapter = adapter ?? { setData: () => {} };
|
|
1732
|
-
const collectSnapshot = () => {
|
|
1733
|
-
const plain = toPlain(state);
|
|
1734
|
-
Object.keys(computedRefs).forEach((key) => {
|
|
1735
|
-
plain[key] = toPlain(computedRefs[key].value);
|
|
1736
|
-
});
|
|
1737
|
-
return plain;
|
|
1738
|
-
};
|
|
1739
|
-
const job = () => {
|
|
1740
|
-
if (!mounted) return;
|
|
1741
|
-
tracker();
|
|
1742
|
-
const snapshot = collectSnapshot();
|
|
1743
|
-
const diff = diffSnapshots(latestSnapshot, snapshot);
|
|
1744
|
-
latestSnapshot = snapshot;
|
|
1745
|
-
if (!Object.keys(diff).length) return;
|
|
1746
|
-
if (typeof currentAdapter.setData === "function") {
|
|
1747
|
-
const result = currentAdapter.setData(diff);
|
|
1748
|
-
if (result && typeof result.then === "function") result.catch(() => {});
|
|
1749
|
-
}
|
|
1750
|
-
};
|
|
1751
|
-
let tracker;
|
|
1752
|
-
tracker = effect(() => {
|
|
1753
|
-
touchReactive(state);
|
|
1754
|
-
Object.keys(state).forEach((key) => {
|
|
1755
|
-
const v = state[key];
|
|
1756
|
-
if (isRef(v)) v.value;
|
|
1757
|
-
else if (isReactive(v)) touchReactive(v);
|
|
1758
|
-
});
|
|
1759
|
-
Object.keys(computedRefs).forEach((key) => computedRefs[key].value);
|
|
1760
|
-
}, {
|
|
1761
|
-
lazy: true,
|
|
1762
|
-
scheduler: () => queueJob(job)
|
|
1763
|
-
});
|
|
1764
|
-
job();
|
|
1765
|
-
stopHandles.push(() => stop(tracker));
|
|
1766
|
-
function registerWatch(source, cb, watchOptions) {
|
|
1767
|
-
const stopHandle = watch(source, (value, oldValue) => cb(value, oldValue), watchOptions);
|
|
1768
|
-
stopHandles.push(stopHandle);
|
|
1769
|
-
return () => {
|
|
1770
|
-
stopHandle();
|
|
1771
|
-
const index = stopHandles.indexOf(stopHandle);
|
|
1772
|
-
if (index >= 0) stopHandles.splice(index, 1);
|
|
1773
|
-
};
|
|
1774
|
-
}
|
|
1775
|
-
const bindModel = createBindModel(publicInstance, state, computedRefs, computedSetters);
|
|
1776
|
-
const unmount = () => {
|
|
1777
|
-
if (!mounted) return;
|
|
1778
|
-
mounted = false;
|
|
1779
|
-
stopHandles.forEach((handle) => {
|
|
1780
|
-
try {
|
|
1781
|
-
handle();
|
|
1782
|
-
} catch {}
|
|
1783
|
-
});
|
|
1784
|
-
stopHandles.length = 0;
|
|
1785
|
-
};
|
|
1786
|
-
return {
|
|
1787
|
-
get state() {
|
|
1788
|
-
return state;
|
|
1789
|
-
},
|
|
1790
|
-
get proxy() {
|
|
1791
|
-
return publicInstance;
|
|
1792
|
-
},
|
|
1793
|
-
get methods() {
|
|
1794
|
-
return boundMethods;
|
|
1795
|
-
},
|
|
1796
|
-
get computed() {
|
|
1797
|
-
return computedProxy;
|
|
1798
|
-
},
|
|
1799
|
-
get adapter() {
|
|
1800
|
-
return currentAdapter;
|
|
1801
|
-
},
|
|
1802
|
-
bindModel,
|
|
1803
|
-
watch: registerWatch,
|
|
1804
|
-
snapshot: () => ({ ...latestSnapshot }),
|
|
1805
|
-
unmount
|
|
1806
|
-
};
|
|
1807
|
-
},
|
|
1808
|
-
use(plugin, ...options$1) {
|
|
1809
|
-
if (!plugin || installedPlugins.has(plugin)) return runtimeApp;
|
|
1810
|
-
installedPlugins.add(plugin);
|
|
1811
|
-
if (typeof plugin === "function") plugin(runtimeApp, ...options$1);
|
|
1812
|
-
else if (typeof plugin.install === "function") plugin.install(runtimeApp, ...options$1);
|
|
1813
|
-
else throw new TypeError("A plugin must be a function or an object with an install method");
|
|
1814
|
-
return runtimeApp;
|
|
1815
|
-
},
|
|
1816
|
-
config: appConfig
|
|
1817
|
-
};
|
|
1818
|
-
if (typeof globalThis.App === "function") registerApp(runtimeApp, methods ?? {}, appWatch, appSetup, mpOptions);
|
|
1819
|
-
return runtimeApp;
|
|
1820
|
-
}
|
|
1821
|
-
function setComputedValue(setters, key, value) {
|
|
1822
|
-
const setter = setters[key];
|
|
1823
|
-
if (!setter) throw new Error(`Computed property "${key}" is readonly`);
|
|
1824
|
-
setter(value);
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
|
-
//#endregion
|
|
1828
|
-
//#region src/runtime/define.ts
|
|
1829
|
-
/**
|
|
1830
|
-
* 按 Vue 3 风格定义一个小程序组件/页面。
|
|
1831
|
-
*
|
|
1832
|
-
* - 统一注册为 `Component()`
|
|
1833
|
-
*
|
|
1834
|
-
* @param options 组件定义项
|
|
1835
|
-
* @returns 可手动注册的组件定义
|
|
1836
|
-
*
|
|
1837
|
-
* @example
|
|
1838
|
-
* ```ts
|
|
1839
|
-
* defineComponent({
|
|
1840
|
-
* data: () => ({ count: 0 }),
|
|
1841
|
-
* setup() {
|
|
1842
|
-
* onMounted(() => console.log('mounted'))
|
|
1843
|
-
* }
|
|
1844
|
-
* })
|
|
1845
|
-
* ```
|
|
1846
|
-
*
|
|
1847
|
-
* @example
|
|
1848
|
-
* ```ts
|
|
1849
|
-
* defineComponent({
|
|
1850
|
-
* setup() {
|
|
1851
|
-
* onPageScroll(() => {})
|
|
1852
|
-
* }
|
|
1853
|
-
* })
|
|
1854
|
-
* ```
|
|
1855
|
-
*/
|
|
1856
|
-
function defineComponent(options) {
|
|
1857
|
-
const { data, computed: computed$1, methods, watch: watch$1, setup, props, ...mpOptions } = options;
|
|
1858
|
-
const runtimeApp = createApp({
|
|
1859
|
-
data,
|
|
1860
|
-
computed: computed$1,
|
|
1861
|
-
methods
|
|
1862
|
-
});
|
|
1863
|
-
const setupWrapper = (ctx) => {
|
|
1864
|
-
const result = runSetupFunction(setup, ctx?.props ?? {}, ctx);
|
|
1865
|
-
if (result) applySetupResult(ctx.runtime, ctx.instance, result);
|
|
1866
|
-
};
|
|
1867
|
-
const mpOptionsWithProps = normalizeProps(mpOptions, props);
|
|
1868
|
-
const componentOptions = {
|
|
1869
|
-
data,
|
|
1870
|
-
computed: computed$1,
|
|
1871
|
-
methods,
|
|
1872
|
-
watch: watch$1,
|
|
1873
|
-
setup: setupWrapper,
|
|
1874
|
-
mpOptions: mpOptionsWithProps
|
|
1875
|
-
};
|
|
1876
|
-
registerComponent(runtimeApp, methods ?? {}, watch$1, setupWrapper, mpOptionsWithProps);
|
|
1877
|
-
return {
|
|
1878
|
-
__wevu_runtime: runtimeApp,
|
|
1879
|
-
__wevu_options: componentOptions
|
|
1880
|
-
};
|
|
1881
|
-
}
|
|
1882
|
-
function applySetupResult(runtime, _target, result) {
|
|
1883
|
-
const methods = runtime?.methods ?? Object.create(null);
|
|
1884
|
-
const state = runtime?.state ?? Object.create(null);
|
|
1885
|
-
const rawState = isReactive(state) ? toRaw(state) : state;
|
|
1886
|
-
if (runtime && !runtime.methods) try {
|
|
1887
|
-
runtime.methods = methods;
|
|
1888
|
-
} catch {}
|
|
1889
|
-
if (runtime && !runtime.state) try {
|
|
1890
|
-
runtime.state = state;
|
|
1891
|
-
} catch {}
|
|
1892
|
-
Object.keys(result).forEach((key) => {
|
|
1893
|
-
const val = result[key];
|
|
1894
|
-
if (typeof val === "function") methods[key] = (...args) => val.apply(runtime?.proxy ?? runtime, args);
|
|
1895
|
-
else if (val === _target || !shouldExposeInSnapshot(val)) try {
|
|
1896
|
-
Object.defineProperty(rawState, key, {
|
|
1897
|
-
value: val,
|
|
1898
|
-
configurable: true,
|
|
1899
|
-
enumerable: false,
|
|
1900
|
-
writable: true
|
|
1901
|
-
});
|
|
1902
|
-
} catch {
|
|
1903
|
-
state[key] = val;
|
|
1904
|
-
}
|
|
1905
|
-
else state[key] = val;
|
|
1906
|
-
});
|
|
1907
|
-
if (runtime) {
|
|
1908
|
-
runtime.methods = runtime.methods ?? methods;
|
|
1909
|
-
runtime.state = runtime.state ?? state;
|
|
1910
|
-
}
|
|
1911
|
-
}
|
|
1912
|
-
function isPlainObject(value) {
|
|
1913
|
-
if (Object.prototype.toString.call(value) !== "[object Object]") return false;
|
|
1914
|
-
const proto = Object.getPrototypeOf(value);
|
|
1915
|
-
return proto === null || proto === Object.prototype;
|
|
1916
|
-
}
|
|
1917
|
-
function shouldExposeInSnapshot(value) {
|
|
1918
|
-
if (value == null) return true;
|
|
1919
|
-
if (typeof value !== "object") return true;
|
|
1920
|
-
if (isRef(value) || isReactive(value)) return true;
|
|
1921
|
-
if (Array.isArray(value)) return true;
|
|
1922
|
-
return isPlainObject(value);
|
|
1923
|
-
}
|
|
1924
|
-
/**
|
|
1925
|
-
* 从 Vue SFC 选项创建 wevu 组件,供 weapp-vite 编译产物直接调用的兼容入口。
|
|
1926
|
-
*
|
|
1927
|
-
* @param options 组件选项,可能包含小程序特有的 properties
|
|
1928
|
-
*/
|
|
1929
|
-
function createWevuComponent(options) {
|
|
1930
|
-
const { properties, props, ...restOptions } = options;
|
|
1931
|
-
defineComponent(normalizeProps(restOptions, props, properties));
|
|
1932
|
-
}
|
|
1933
|
-
function normalizeProps(baseOptions, props, explicitProperties) {
|
|
1934
|
-
if (explicitProperties || !props) return {
|
|
1935
|
-
...baseOptions,
|
|
1936
|
-
...explicitProperties ? { properties: explicitProperties } : {}
|
|
1937
|
-
};
|
|
1938
|
-
const properties = {};
|
|
1939
|
-
Object.entries(props).forEach(([key, definition]) => {
|
|
1940
|
-
if (definition === null || definition === void 0) return;
|
|
1941
|
-
if (Array.isArray(definition) || typeof definition === "function") {
|
|
1942
|
-
properties[key] = { type: definition };
|
|
1943
|
-
return;
|
|
1944
|
-
}
|
|
1945
|
-
if (typeof definition === "object") {
|
|
1946
|
-
if (key.endsWith("Modifiers") && Object.keys(definition).length === 0) {
|
|
1947
|
-
properties[key] = {
|
|
1948
|
-
type: Object,
|
|
1949
|
-
value: {}
|
|
1950
|
-
};
|
|
1951
|
-
return;
|
|
1952
|
-
}
|
|
1953
|
-
const propOptions = {};
|
|
1954
|
-
if ("type" in definition && definition.type !== void 0) propOptions.type = definition.type;
|
|
1955
|
-
const defaultValue = "default" in definition ? definition.default : definition.value;
|
|
1956
|
-
if (defaultValue !== void 0) propOptions.value = typeof defaultValue === "function" ? defaultValue() : defaultValue;
|
|
1957
|
-
properties[key] = propOptions;
|
|
1958
|
-
}
|
|
1959
|
-
});
|
|
1960
|
-
return {
|
|
1961
|
-
...baseOptions,
|
|
1962
|
-
properties
|
|
1963
|
-
};
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
|
-
//#endregion
|
|
1967
|
-
//#region src/runtime/provide.ts
|
|
1968
|
-
const PROVIDE_SCOPE_KEY = Symbol("wevu.provideScope");
|
|
1969
|
-
const __wevuGlobalProvideStore = /* @__PURE__ */ new Map();
|
|
1970
|
-
/**
|
|
1971
|
-
* 在组件上下文中向后代注入值(与 Vue 3 行为兼容),若没有当前实例则回落到全局存储。
|
|
1972
|
-
*
|
|
1973
|
-
* @param key 注入键,可为字符串、Symbol 或对象
|
|
1974
|
-
* @param value 提供的值
|
|
1975
|
-
*
|
|
1976
|
-
* @example
|
|
1977
|
-
* ```ts
|
|
1978
|
-
* defineComponent({
|
|
1979
|
-
* setup() {
|
|
1980
|
-
* provide(TOKEN_KEY, { data: 'value' })
|
|
1981
|
-
* }
|
|
1982
|
-
* })
|
|
1983
|
-
* ```
|
|
1984
|
-
*/
|
|
1985
|
-
function provide(key, value) {
|
|
1986
|
-
const instance = getCurrentInstance();
|
|
1987
|
-
if (instance) {
|
|
1988
|
-
let scope = instance[PROVIDE_SCOPE_KEY];
|
|
1989
|
-
if (!scope) {
|
|
1990
|
-
scope = /* @__PURE__ */ new Map();
|
|
1991
|
-
instance[PROVIDE_SCOPE_KEY] = scope;
|
|
1992
|
-
}
|
|
1993
|
-
scope.set(key, value);
|
|
1994
|
-
} else __wevuGlobalProvideStore.set(key, value);
|
|
1995
|
-
}
|
|
1996
|
-
/**
|
|
1997
|
-
* 从祖先组件(或全局存储)读取提供的值。
|
|
1998
|
-
*
|
|
1999
|
-
* @param key 注入键,需与 provide 使用的键保持一致
|
|
2000
|
-
* @param defaultValue 未找到提供者时的默认值
|
|
2001
|
-
* @returns 匹配到的值或默认值
|
|
2002
|
-
*
|
|
2003
|
-
* @example
|
|
2004
|
-
* ```ts
|
|
2005
|
-
* defineComponent({
|
|
2006
|
-
* setup() {
|
|
2007
|
-
* const data = inject(TOKEN_KEY)
|
|
2008
|
-
* const value = inject('key', 'default')
|
|
2009
|
-
* }
|
|
2010
|
-
* })
|
|
2011
|
-
* ```
|
|
2012
|
-
*/
|
|
2013
|
-
function inject(key, defaultValue) {
|
|
2014
|
-
const instance = getCurrentInstance();
|
|
2015
|
-
if (instance) {
|
|
2016
|
-
let current = instance;
|
|
2017
|
-
while (current) {
|
|
2018
|
-
const scope = current[PROVIDE_SCOPE_KEY];
|
|
2019
|
-
if (scope && scope.has(key)) return scope.get(key);
|
|
2020
|
-
current = null;
|
|
2021
|
-
}
|
|
2022
|
-
}
|
|
2023
|
-
if (__wevuGlobalProvideStore.has(key)) return __wevuGlobalProvideStore.get(key);
|
|
2024
|
-
if (arguments.length >= 2) return defaultValue;
|
|
2025
|
-
throw new Error(`wevu.inject: no value found for key`);
|
|
2026
|
-
}
|
|
2027
|
-
/**
|
|
2028
|
-
* 全局注入值,适用于组件外部调用场景。
|
|
2029
|
-
*/
|
|
2030
|
-
function provideGlobal(key, value) {
|
|
2031
|
-
__wevuGlobalProvideStore.set(key, value);
|
|
2032
|
-
}
|
|
2033
|
-
/**
|
|
2034
|
-
* 从全局存储读取值,适用于组件外部调用场景。
|
|
2035
|
-
*/
|
|
2036
|
-
function injectGlobal(key, defaultValue) {
|
|
2037
|
-
if (__wevuGlobalProvideStore.has(key)) return __wevuGlobalProvideStore.get(key);
|
|
2038
|
-
if (arguments.length >= 2) return defaultValue;
|
|
2039
|
-
throw new Error(`injectGlobal() no matching provider for key: ${String(key)}`);
|
|
2040
|
-
}
|
|
2041
|
-
|
|
2042
|
-
//#endregion
|
|
2043
|
-
//#region src/runtime/vueCompat.ts
|
|
2044
|
-
function useAttrs() {
|
|
2045
|
-
const ctx = getCurrentSetupContext();
|
|
2046
|
-
if (!ctx) throw new Error("useAttrs() must be called synchronously inside setup()");
|
|
2047
|
-
return ctx.attrs ?? {};
|
|
2048
|
-
}
|
|
2049
|
-
function useSlots() {
|
|
2050
|
-
const ctx = getCurrentSetupContext();
|
|
2051
|
-
if (!ctx) throw new Error("useSlots() must be called synchronously inside setup()");
|
|
2052
|
-
return ctx.slots ?? Object.create(null);
|
|
2053
|
-
}
|
|
2054
|
-
function useModel(props, name) {
|
|
2055
|
-
const ctx = getCurrentSetupContext();
|
|
2056
|
-
if (!ctx) throw new Error("useModel() must be called synchronously inside setup()");
|
|
2057
|
-
const emit = ctx.emit;
|
|
2058
|
-
const eventName = `update:${name}`;
|
|
2059
|
-
return customRef({
|
|
2060
|
-
get: () => props?.[name],
|
|
2061
|
-
set: (value) => {
|
|
2062
|
-
emit?.(eventName, value);
|
|
2063
|
-
}
|
|
2064
|
-
});
|
|
2065
|
-
}
|
|
2066
|
-
function mergeModels(a, b) {
|
|
2067
|
-
if (a == null) return b;
|
|
2068
|
-
if (b == null) return a;
|
|
2069
|
-
if (Array.isArray(a) && Array.isArray(b)) return Array.from(new Set([...a, ...b]));
|
|
2070
|
-
if (typeof a === "object" && typeof b === "object") return {
|
|
2071
|
-
...a,
|
|
2072
|
-
...b
|
|
2073
|
-
};
|
|
2074
|
-
return b;
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
//#endregion
|
|
2078
|
-
//#region src/store/actions.ts
|
|
2079
|
-
function wrapAction(store, name, action, actionSubs) {
|
|
2080
|
-
return function wrapped(...args) {
|
|
2081
|
-
const afterCbs = [];
|
|
2082
|
-
const errorCbs = [];
|
|
2083
|
-
const after = (cb) => afterCbs.push(cb);
|
|
2084
|
-
const onError$1 = (cb) => errorCbs.push(cb);
|
|
2085
|
-
actionSubs.forEach((sub) => {
|
|
2086
|
-
try {
|
|
2087
|
-
sub({
|
|
2088
|
-
name,
|
|
2089
|
-
store,
|
|
2090
|
-
args,
|
|
2091
|
-
after,
|
|
2092
|
-
onError: onError$1
|
|
2093
|
-
});
|
|
2094
|
-
} catch {}
|
|
2095
|
-
});
|
|
2096
|
-
let res;
|
|
2097
|
-
try {
|
|
2098
|
-
res = action.apply(store, args);
|
|
2099
|
-
} catch (e) {
|
|
2100
|
-
errorCbs.forEach((cb) => cb(e));
|
|
2101
|
-
throw e;
|
|
2102
|
-
}
|
|
2103
|
-
const finalize = (r) => {
|
|
2104
|
-
afterCbs.forEach((cb) => cb(r));
|
|
2105
|
-
return r;
|
|
2106
|
-
};
|
|
2107
|
-
if (res && typeof res.then === "function") return res.then((r) => finalize(r), (e) => {
|
|
2108
|
-
errorCbs.forEach((cb) => cb(e));
|
|
2109
|
-
return Promise.reject(e);
|
|
2110
|
-
});
|
|
2111
|
-
return finalize(res);
|
|
2112
|
-
};
|
|
2113
|
-
}
|
|
2114
|
-
|
|
2115
|
-
//#endregion
|
|
2116
|
-
//#region src/store/utils.ts
|
|
2117
|
-
function isObject(val) {
|
|
2118
|
-
return typeof val === "object" && val !== null;
|
|
2119
|
-
}
|
|
2120
|
-
function mergeShallow(target, patch) {
|
|
2121
|
-
for (const k in patch) target[k] = patch[k];
|
|
2122
|
-
}
|
|
2123
|
-
|
|
2124
|
-
//#endregion
|
|
2125
|
-
//#region src/store/base.ts
|
|
2126
|
-
function createBaseApi(id, stateObj, notify, resetImpl) {
|
|
2127
|
-
const api = { $id: id };
|
|
2128
|
-
Object.defineProperty(api, "$state", {
|
|
2129
|
-
get() {
|
|
2130
|
-
return stateObj;
|
|
2131
|
-
},
|
|
2132
|
-
set(v) {
|
|
2133
|
-
if (stateObj && isObject(v)) {
|
|
2134
|
-
mergeShallow(stateObj, v);
|
|
2135
|
-
notify("patch object");
|
|
2136
|
-
}
|
|
2137
|
-
}
|
|
2138
|
-
});
|
|
2139
|
-
api.$patch = (patch) => {
|
|
2140
|
-
if (!stateObj) {
|
|
2141
|
-
if (typeof patch === "function") {
|
|
2142
|
-
patch(api);
|
|
2143
|
-
notify("patch function");
|
|
2144
|
-
} else {
|
|
2145
|
-
mergeShallow(api, patch);
|
|
2146
|
-
notify("patch object");
|
|
2147
|
-
}
|
|
2148
|
-
return;
|
|
2149
|
-
}
|
|
2150
|
-
if (typeof patch === "function") {
|
|
2151
|
-
patch(stateObj);
|
|
2152
|
-
notify("patch function");
|
|
2153
|
-
} else {
|
|
2154
|
-
mergeShallow(stateObj, patch);
|
|
2155
|
-
notify("patch object");
|
|
2156
|
-
}
|
|
2157
|
-
};
|
|
2158
|
-
if (resetImpl) api.$reset = () => resetImpl();
|
|
2159
|
-
const subs = /* @__PURE__ */ new Set();
|
|
2160
|
-
api.$subscribe = (cb, _opts) => {
|
|
2161
|
-
subs.add(cb);
|
|
2162
|
-
return () => subs.delete(cb);
|
|
2163
|
-
};
|
|
2164
|
-
const actionSubs = /* @__PURE__ */ new Set();
|
|
2165
|
-
api.$onAction = (cb) => {
|
|
2166
|
-
actionSubs.add(cb);
|
|
2167
|
-
return () => actionSubs.delete(cb);
|
|
2168
|
-
};
|
|
2169
|
-
return {
|
|
2170
|
-
api,
|
|
2171
|
-
subs,
|
|
2172
|
-
actionSubs
|
|
2173
|
-
};
|
|
2174
|
-
}
|
|
2175
|
-
|
|
2176
|
-
//#endregion
|
|
2177
|
-
//#region src/store/manager.ts
|
|
2178
|
-
function createStore() {
|
|
2179
|
-
const manager = {
|
|
2180
|
-
_stores: /* @__PURE__ */ new Map(),
|
|
2181
|
-
_plugins: [],
|
|
2182
|
-
install(_app) {},
|
|
2183
|
-
use(plugin) {
|
|
2184
|
-
if (typeof plugin === "function") manager._plugins.push(plugin);
|
|
2185
|
-
return manager;
|
|
2186
|
-
}
|
|
2187
|
-
};
|
|
2188
|
-
createStore._instance = manager;
|
|
2189
|
-
return manager;
|
|
2190
|
-
}
|
|
2191
|
-
|
|
2192
|
-
//#endregion
|
|
2193
|
-
//#region src/store/define.ts
|
|
2194
|
-
function defineStore(id, setupOrOptions) {
|
|
2195
|
-
let instance;
|
|
2196
|
-
let created = false;
|
|
2197
|
-
const manager = createStore._instance;
|
|
2198
|
-
return function useStore() {
|
|
2199
|
-
if (created && instance) return instance;
|
|
2200
|
-
created = true;
|
|
2201
|
-
if (typeof setupOrOptions === "function") {
|
|
2202
|
-
const result = setupOrOptions();
|
|
2203
|
-
let notify$1 = () => {};
|
|
2204
|
-
const base$1 = createBaseApi(id, void 0, (t) => notify$1(t));
|
|
2205
|
-
notify$1 = (type) => {
|
|
2206
|
-
base$1.subs.forEach((cb) => {
|
|
2207
|
-
try {
|
|
2208
|
-
cb({
|
|
2209
|
-
type,
|
|
2210
|
-
storeId: id
|
|
2211
|
-
}, instance);
|
|
2212
|
-
} catch {}
|
|
2213
|
-
});
|
|
2214
|
-
};
|
|
2215
|
-
instance = Object.assign({}, result);
|
|
2216
|
-
for (const key of Object.getOwnPropertyNames(base$1.api)) {
|
|
2217
|
-
const d = Object.getOwnPropertyDescriptor(base$1.api, key);
|
|
2218
|
-
if (d) Object.defineProperty(instance, key, d);
|
|
2219
|
-
}
|
|
2220
|
-
Object.keys(result).forEach((k) => {
|
|
2221
|
-
const val = result[k];
|
|
2222
|
-
if (typeof val === "function" && !k.startsWith("$")) instance[k] = wrapAction(instance, k, val, base$1.actionSubs);
|
|
2223
|
-
});
|
|
2224
|
-
const plugins$1 = manager?._plugins ?? [];
|
|
2225
|
-
for (const plugin of plugins$1) try {
|
|
2226
|
-
plugin({ store: instance });
|
|
2227
|
-
} catch {}
|
|
2228
|
-
return instance;
|
|
2229
|
-
}
|
|
2230
|
-
const options = setupOrOptions;
|
|
2231
|
-
const rawState = options.state ? options.state() : {};
|
|
2232
|
-
const state = reactive(rawState);
|
|
2233
|
-
const initialSnapshot = { ...toRaw(rawState) };
|
|
2234
|
-
let notify = () => {};
|
|
2235
|
-
const base = createBaseApi(id, state, (t) => notify(t), () => {
|
|
2236
|
-
mergeShallow(state, initialSnapshot);
|
|
2237
|
-
notify("patch object");
|
|
2238
|
-
});
|
|
2239
|
-
notify = (type) => {
|
|
2240
|
-
base.subs.forEach((cb) => {
|
|
2241
|
-
try {
|
|
2242
|
-
cb({
|
|
2243
|
-
type,
|
|
2244
|
-
storeId: id
|
|
2245
|
-
}, state);
|
|
2246
|
-
} catch {}
|
|
2247
|
-
});
|
|
2248
|
-
};
|
|
2249
|
-
const store = {};
|
|
2250
|
-
for (const key of Object.getOwnPropertyNames(base.api)) {
|
|
2251
|
-
const d = Object.getOwnPropertyDescriptor(base.api, key);
|
|
2252
|
-
if (d) Object.defineProperty(store, key, d);
|
|
2253
|
-
}
|
|
2254
|
-
const getterDefs = options.getters ?? {};
|
|
2255
|
-
const computedMap = {};
|
|
2256
|
-
Object.keys(getterDefs).forEach((key) => {
|
|
2257
|
-
const getter = getterDefs[key];
|
|
2258
|
-
if (typeof getter === "function") {
|
|
2259
|
-
const c = computed(() => getter.call(store, state));
|
|
2260
|
-
computedMap[key] = c;
|
|
2261
|
-
Object.defineProperty(store, key, {
|
|
2262
|
-
enumerable: true,
|
|
2263
|
-
configurable: true,
|
|
2264
|
-
get() {
|
|
2265
|
-
return c.value;
|
|
2266
|
-
}
|
|
2267
|
-
});
|
|
2268
|
-
}
|
|
2269
|
-
});
|
|
2270
|
-
const actionDefs = options.actions ?? {};
|
|
2271
|
-
Object.keys(actionDefs).forEach((key) => {
|
|
2272
|
-
const act = actionDefs[key];
|
|
2273
|
-
if (typeof act === "function") store[key] = wrapAction(store, key, (...args) => {
|
|
2274
|
-
return act.apply(store, args);
|
|
2275
|
-
}, base.actionSubs);
|
|
2276
|
-
});
|
|
2277
|
-
Object.keys(state).forEach((k) => {
|
|
2278
|
-
Object.defineProperty(store, k, {
|
|
2279
|
-
enumerable: true,
|
|
2280
|
-
configurable: true,
|
|
2281
|
-
get() {
|
|
2282
|
-
return state[k];
|
|
2283
|
-
},
|
|
2284
|
-
set(v) {
|
|
2285
|
-
state[k] = v;
|
|
2286
|
-
}
|
|
2287
|
-
});
|
|
2288
|
-
});
|
|
2289
|
-
instance = store;
|
|
2290
|
-
const plugins = manager?._plugins ?? [];
|
|
2291
|
-
for (const plugin of plugins) try {
|
|
2292
|
-
plugin({ store: instance });
|
|
2293
|
-
} catch {}
|
|
2294
|
-
return instance;
|
|
2295
|
-
};
|
|
2296
|
-
}
|
|
2297
|
-
|
|
2298
|
-
//#endregion
|
|
2299
|
-
//#region src/store/storeToRefs.ts
|
|
2300
|
-
function storeToRefs(store) {
|
|
2301
|
-
const result = {};
|
|
2302
|
-
for (const key in store) {
|
|
2303
|
-
const value = store[key];
|
|
2304
|
-
if (typeof value === "function") {
|
|
2305
|
-
result[key] = value;
|
|
2306
|
-
continue;
|
|
2307
|
-
}
|
|
2308
|
-
if (isRef(value)) result[key] = value;
|
|
2309
|
-
else result[key] = computed({
|
|
2310
|
-
get: () => store[key],
|
|
2311
|
-
set: (v) => {
|
|
2312
|
-
store[key] = v;
|
|
2313
|
-
}
|
|
2314
|
-
});
|
|
2315
|
-
}
|
|
2316
|
-
return result;
|
|
2317
|
-
}
|
|
2318
|
-
|
|
2319
|
-
//#endregion
|
|
2320
|
-
exports.batch = batch;
|
|
2321
|
-
exports.callHookList = callHookList;
|
|
2322
|
-
exports.callHookReturn = callHookReturn;
|
|
2323
|
-
exports.callUpdateHooks = callUpdateHooks;
|
|
2324
|
-
exports.computed = computed;
|
|
2325
|
-
exports.createApp = createApp;
|
|
2326
|
-
exports.createStore = createStore;
|
|
2327
|
-
exports.createWevuComponent = createWevuComponent;
|
|
2328
|
-
exports.defineComponent = defineComponent;
|
|
2329
|
-
exports.defineStore = defineStore;
|
|
2330
|
-
exports.effect = effect;
|
|
2331
|
-
exports.effectScope = effectScope;
|
|
2332
|
-
exports.endBatch = endBatch;
|
|
2333
|
-
exports.getCurrentInstance = getCurrentInstance;
|
|
2334
|
-
exports.getCurrentScope = getCurrentScope;
|
|
2335
|
-
exports.getCurrentSetupContext = getCurrentSetupContext;
|
|
2336
|
-
exports.getDeepWatchStrategy = getDeepWatchStrategy;
|
|
2337
|
-
exports.inject = inject;
|
|
2338
|
-
exports.injectGlobal = injectGlobal;
|
|
2339
|
-
exports.isRaw = isRaw;
|
|
2340
|
-
exports.isReactive = isReactive;
|
|
2341
|
-
exports.isRef = isRef;
|
|
2342
|
-
exports.isShallowReactive = isShallowReactive;
|
|
2343
|
-
exports.isShallowRef = isShallowRef;
|
|
2344
|
-
exports.markRaw = markRaw;
|
|
2345
|
-
exports.mergeModels = mergeModels;
|
|
2346
|
-
exports.mountRuntimeInstance = mountRuntimeInstance;
|
|
2347
|
-
exports.nextTick = nextTick;
|
|
2348
|
-
exports.onActivated = onActivated;
|
|
2349
|
-
exports.onAddToFavorites = onAddToFavorites;
|
|
2350
|
-
exports.onBeforeMount = onBeforeMount;
|
|
2351
|
-
exports.onBeforeUnmount = onBeforeUnmount;
|
|
2352
|
-
exports.onBeforeUpdate = onBeforeUpdate;
|
|
2353
|
-
exports.onDeactivated = onDeactivated;
|
|
2354
|
-
exports.onError = onError;
|
|
2355
|
-
exports.onErrorCaptured = onErrorCaptured;
|
|
2356
|
-
exports.onHide = onHide;
|
|
2357
|
-
exports.onLaunch = onLaunch;
|
|
2358
|
-
exports.onLoad = onLoad;
|
|
2359
|
-
exports.onMounted = onMounted;
|
|
2360
|
-
exports.onMoved = onMoved;
|
|
2361
|
-
exports.onPageNotFound = onPageNotFound;
|
|
2362
|
-
exports.onPageScroll = onPageScroll;
|
|
2363
|
-
exports.onPullDownRefresh = onPullDownRefresh;
|
|
2364
|
-
exports.onReachBottom = onReachBottom;
|
|
2365
|
-
exports.onReady = onReady;
|
|
2366
|
-
exports.onResize = onResize;
|
|
2367
|
-
exports.onRouteDone = onRouteDone;
|
|
2368
|
-
exports.onSaveExitState = onSaveExitState;
|
|
2369
|
-
exports.onScopeDispose = onScopeDispose;
|
|
2370
|
-
exports.onServerPrefetch = onServerPrefetch;
|
|
2371
|
-
exports.onShareAppMessage = onShareAppMessage;
|
|
2372
|
-
exports.onShareTimeline = onShareTimeline;
|
|
2373
|
-
exports.onShow = onShow;
|
|
2374
|
-
exports.onTabItemTap = onTabItemTap;
|
|
2375
|
-
exports.onThemeChange = onThemeChange;
|
|
2376
|
-
exports.onUnhandledRejection = onUnhandledRejection;
|
|
2377
|
-
exports.onUnload = onUnload;
|
|
2378
|
-
exports.onUnmounted = onUnmounted;
|
|
2379
|
-
exports.onUpdated = onUpdated;
|
|
2380
|
-
exports.provide = provide;
|
|
2381
|
-
exports.provideGlobal = provideGlobal;
|
|
2382
|
-
exports.reactive = reactive;
|
|
2383
|
-
exports.readonly = readonly;
|
|
2384
|
-
exports.ref = ref;
|
|
2385
|
-
exports.registerApp = registerApp;
|
|
2386
|
-
exports.registerComponent = registerComponent;
|
|
2387
|
-
exports.runSetupFunction = runSetupFunction;
|
|
2388
|
-
exports.setCurrentInstance = setCurrentInstance;
|
|
2389
|
-
exports.setCurrentSetupContext = setCurrentSetupContext;
|
|
2390
|
-
exports.setDeepWatchStrategy = setDeepWatchStrategy;
|
|
2391
|
-
exports.shallowReactive = shallowReactive;
|
|
2392
|
-
exports.shallowRef = shallowRef;
|
|
2393
|
-
exports.startBatch = startBatch;
|
|
2394
|
-
exports.stop = stop;
|
|
2395
|
-
exports.storeToRefs = storeToRefs;
|
|
2396
|
-
exports.teardownRuntimeInstance = teardownRuntimeInstance;
|
|
2397
|
-
exports.toRaw = toRaw;
|
|
2398
|
-
exports.toRef = toRef;
|
|
2399
|
-
exports.toRefs = toRefs;
|
|
2400
|
-
exports.touchReactive = touchReactive;
|
|
2401
|
-
exports.traverse = traverse;
|
|
2402
|
-
exports.triggerRef = triggerRef;
|
|
2403
|
-
exports.unref = unref;
|
|
2404
|
-
exports.useAttrs = useAttrs;
|
|
2405
|
-
exports.useModel = useModel;
|
|
2406
|
-
exports.useSlots = useSlots;
|
|
2407
|
-
exports.watch = watch;
|
|
2408
|
-
exports.watchEffect = watchEffect;
|
|
1
|
+
const e=Promise.resolve(),t=new Set;let n=!1,r=!1;function i(){r=!1,n=!0;try{t.forEach(e=>e())}finally{t.clear(),n=!1}}function a(a){t.add(a),!n&&!r&&(r=!0,e.then(i))}function o(t){return t?e.then(t):e}const s=new WeakMap;let c=null;const l=[];let u=0;const d=new Set;function f(){u++}function p(){u!==0&&(u--,u===0&&h())}function m(e){f();try{return e()}finally{p()}}function h(){for(;d.size;){let e=Array.from(d);d.clear();for(let t of e)t()}}let g;var _=class{active=!0;effects=[];cleanups=[];parent;scopes;constructor(e=!1){this.detached=e,!e&&g&&(this.parent=g,(g.scopes||=[]).push(this))}run(e){if(!this.active)return;let t=g;g=this;try{return e()}finally{g=t}}stop(){if(this.active){this.active=!1;for(let e of this.effects)x(e);this.effects.length=0;for(let e of this.cleanups)e();if(this.cleanups.length=0,this.scopes){for(let e of this.scopes)e.stop();this.scopes.length=0}if(this.parent?.scopes){let e=this.parent.scopes.indexOf(this);e>=0&&this.parent.scopes.splice(e,1)}this.parent=void 0}}};function ee(e=!1){return new _(e)}function te(){return g}function v(e){g?.active&&g.cleanups.push(e)}function ne(e){g?.active&&g.effects.push(e)}function y(e){let{deps:t}=e;for(let n=0;n<t.length;n++)t[n].delete(e);t.length=0}function re(e,t={}){let n=function(){if(!n.active||n._running)return e();y(n);try{return n._running=!0,l.push(n),c=n,e()}finally{l.pop(),c=l[l.length-1]??null,n._running=!1}};return n.deps=[],n.scheduler=t.scheduler,n.onStop=t.onStop,n.active=!0,n._running=!1,n._fn=e,n}function b(e,t={}){let n=re(e,t);return ne(n),t.lazy||n(),n}function x(e){e.active&&(e.active=!1,y(e),e.onStop?.())}function S(e,t){if(!c)return;let n=s.get(e);n||(n=new Map,s.set(e,n));let r=n.get(t);r||(r=new Set,n.set(t,r)),r.has(c)||(r.add(c),c.deps.push(r))}function C(e,t){let n=s.get(e);if(!n)return;let r=n.get(t);if(!r)return;let i=new Set;r.forEach(e=>{e!==c&&i.add(e)}),i.forEach(oe)}function ie(e){c&&(e.has(c)||(e.add(c),c.deps.push(e)))}function ae(e){new Set(e).forEach(oe)}function oe(e){if(e.scheduler){e.scheduler();return}if(u>0){d.add(e);return}e()}const se=new WeakMap,ce=new WeakMap,w=new WeakMap,T=new WeakMap,E=new WeakMap,D=new WeakMap,O=new WeakSet,k=new WeakMap,A=new WeakMap;function le(e){let t=A.get(e);return t||(t=new Set,A.set(e,t)),t}function j(e,t){le(e).add(t)}function M(e){T.set(e,(T.get(e)??0)+1)}function N(e){let t=G(e);return T.get(t)??0}function ue(e){let t=new Set,n=[e];for(let e=0;e<2e3&&n.length;e++){let e=n.pop(),r=D.get(e);if(r)for(let e of r.keys())t.has(e)||(t.add(e),M(e),n.push(e))}}const P=new Set;function de(e){P.add(e)}function fe(e){P.delete(e)}let F=function(e){return e.IS_REACTIVE=`__r_isReactive`,e.RAW=`__r_raw`,e.SKIP=`__r_skip`,e}({});function I(e){return typeof e==`object`&&!!e}const L=Symbol(`wevu.version`);function R(e){if(!e)return!1;let t=e.charCodeAt(0);if(t<48||t>57)return!1;let n=Number(e);return Number.isInteger(n)&&n>=0&&String(n)===e}function z(e,t,n){if(typeof n!=`string`){O.add(e),E.delete(e);return}if(P.size){let n=w.get(t)??t;j(n,t),j(n,e)}let r=D.get(e);r||(r=new Map,D.set(e,r));let i=r.get(t);i||(i=new Set,r.set(t,i)),i.add(n),B(e)}function pe(e,t,n){let r=D.get(e);if(!r)return;let i=r.get(t);i&&(i.delete(n),i.size||r.delete(t),r.size||D.delete(e),B(e))}function B(e){let t=D.get(e);if(!t){O.delete(e),E.delete(e);return}let n,r,i=0;for(let[e,a]of t){for(let t of a){if(i+=1,i>1)break;n=e,r=t}if(i>1)break}if(i===1&&n&&r){O.delete(e),E.set(e,{parent:n,key:r});return}O.add(e),E.delete(e)}function me(e,t){if(t===e)return[];if(O.has(t))return;let n=[],r=t;for(let t=0;t<2e3;t++){if(r===e)return n.reverse();if(O.has(r))return;let t=E.get(r);if(!t||typeof t.key!=`string`)return;n.push(t.key),r=t.parent}}function V(e,t,n){if(!P.size||typeof t!=`string`||t.startsWith(`__r_`))return;let r=w.get(e)??e,i=Array.isArray(e)&&(t===`length`||R(t))?`array`:`property`,a=me(r,e);if(!a){let a=new Set,o=D.get(e);if(o)for(let[e,t]of o){let n=k.get(e),i=n?n.split(`.`,1)[0]:void 0,o=i?void 0:me(r,e)?.[0];for(let e of t)typeof e==`string`&&a.add(i??o??e)}else a.add(t);for(let e of P)e({root:r,kind:i,op:n,path:void 0,fallbackTopKeys:a.size?Array.from(a):void 0});return}let o=a.findIndex(e=>R(e));if(o!==-1){let e=a.slice(0,o).join(`.`)||void 0;for(let t of P)t({root:r,kind:`array`,op:n,path:e});return}let s=a.length?a.join(`.`):``,c=i===`array`?s||void 0:s?`${s}.${t}`:t;for(let e of P)e({root:r,kind:i,op:n,path:c})}const H={get(e,t,n){if(t===F.IS_REACTIVE)return!0;if(t===F.RAW)return e;let r=Reflect.get(e,t,n);if(S(e,t),I(r)){if(r[F.SKIP])return r;let n=w.get(e)??e,i=r?.[F.RAW]??r;w.has(i)||w.set(i,n),z(i,e,t);let a=k.get(e);if(P.size&&typeof t==`string`&&a!=null&&!O.has(i)){let e=a?`${a}.${t}`:t;k.set(i,e)}return U(r)}return r},set(e,t,n,r){let i=Array.isArray(e),a=i?e.length:0,o=Reflect.get(e,t,r),s=Reflect.set(e,t,n,r);if(!Object.is(o,n)){let r=I(o)?o?.[F.RAW]??o:void 0;if(r&&pe(r,e,t),I(n)&&!n[F.SKIP]){let r=w.get(e)??e,i=n?.[F.RAW]??n;w.has(i)||w.set(i,r),z(i,e,t);let a=k.get(e);if(P.size&&typeof t==`string`&&a!=null&&!O.has(i)){let e=a?`${a}.${t}`:t;k.set(i,e)}}C(e,t),i&&typeof t==`string`&&R(t)&&Number(t)>=a&&C(e,`length`),C(e,L),M(e),ue(e);let s=w.get(e);s&&s!==e&&(C(s,L),M(s)),V(e,t,`set`)}return s},deleteProperty(e,t){let n=Object.prototype.hasOwnProperty.call(e,t),r=n?e[t]:void 0,i=Reflect.deleteProperty(e,t);if(n&&i){let n=I(r)?r?.[F.RAW]??r:void 0;n&&pe(n,e,t),C(e,t),C(e,L),M(e),ue(e);let i=w.get(e);i&&i!==e&&(C(i,L),M(i)),V(e,t,`delete`)}return i},ownKeys(e){return S(e,Symbol.iterator),S(e,L),Reflect.ownKeys(e)}};function U(e){if(!I(e))return e;let t=se.get(e);if(t)return t;if(e[F.IS_REACTIVE])return e;let n=new Proxy(e,H);return se.set(e,n),ce.set(n,e),T.has(e)||T.set(e,0),w.has(e)||w.set(e,e),n}function W(e){return!!(e&&e[F.IS_REACTIVE])}function G(e){return e?.[F.RAW]??e}function K(e){return I(e)?U(e):e}function he(e,t){let n=G(e);k.set(n,``),j(n,n);let r=t?.shouldIncludeTopKey,i=typeof t?.maxDepth==`number`?Math.max(0,Math.floor(t.maxDepth)):1/0,a=typeof t?.maxKeys==`number`?Math.max(0,Math.floor(t.maxKeys)):1/0,o=new WeakSet,s=[{current:n,path:``,depth:0}],c=0;for(;s.length;){let e=s.pop();if(o.has(e.current)||(o.add(e.current),k.set(e.current,e.path),j(n,e.current),c+=1,c>=a)||e.depth>=i||Array.isArray(e.current))continue;let t=Object.entries(e.current);for(let[i,a]of t){if(e.path===``&&r&&!r(i)||!I(a)||a[F.SKIP])continue;let t=G(a);if(w.has(t)||w.set(t,n),z(t,e.current,i),!O.has(t)){let n=e.path?`${e.path}.${i}`:i;k.set(t,n)}j(n,t),s.push({current:t,path:e.path?`${e.path}.${i}`:i,depth:e.depth+1})}}}function ge(e){let t=G(e),n=A.get(t);if(!n){k.delete(t);return}for(let e of n)E.delete(e),D.delete(e),k.delete(e),O.delete(e),w.delete(e),T.delete(e);A.delete(t)}function _e(e){S(G(e),L)}const q=new WeakMap,ve={get(e,t,n){if(t===F.IS_REACTIVE)return!0;if(t===F.RAW)return e;let r=Reflect.get(e,t,n);return S(e,t),r},set(e,t,n,r){let i=Reflect.get(e,t,r),a=Reflect.set(e,t,n,r);return Object.is(i,n)||(C(e,t),C(e,L),M(e)),a},deleteProperty(e,t){let n=Object.prototype.hasOwnProperty.call(e,t),r=Reflect.deleteProperty(e,t);return n&&r&&(C(e,t),C(e,L),M(e)),r},ownKeys(e){return S(e,Symbol.iterator),S(e,L),Reflect.ownKeys(e)}};function ye(e){if(!I(e))return e;let t=q.get(e);if(t)return t;if(e[F.IS_REACTIVE])return e;let n=new Proxy(e,ve);return q.set(e,n),ce.set(n,e),T.has(e)||T.set(e,0),n}function be(e){let t=G(e);return q.has(t)}function xe(e){return I(e)&&Object.defineProperty(e,F.SKIP,{value:!0,configurable:!0,enumerable:!1,writable:!0}),e}function Se(e){return I(e)&&F.SKIP in e}const Ce=`__v_isRef`;function we(e){try{Object.defineProperty(e,Ce,{value:!0,configurable:!0})}catch{e[Ce]=!0}return e}function J(e){return!!(e&&typeof e==`object`&&e[Ce]===!0)}var Te=class{_value;_rawValue;dep;constructor(e){we(this),this._rawValue=e,this._value=K(e)}get value(){return this.dep||=new Set,ie(this.dep),this._value}set value(e){Object.is(e,this._rawValue)||(this._rawValue=e,this._value=K(e),this.dep&&ae(this.dep))}};function Ee(e){return J(e)?e:xe(new Te(e))}function De(e){return J(e)?e.value:e}var Oe=class{_getValue;_setValue;dep;constructor(e,t){we(this);let n=t,r=()=>{this.dep||=new Set,ie(this.dep)},i=()=>{this.dep&&ae(this.dep)},a=e=>e===void 0&&n!==void 0?n:e;if(typeof e==`function`){let t=e(r,i);this._getValue=()=>a(t.get()),this._setValue=e=>t.set(e);return}let o=e;this._getValue=()=>(r(),a(o.get())),this._setValue=e=>{o.set(e),i()}}get value(){return this._getValue()}set value(e){this._setValue(e)}};function ke(e,t){return xe(new Oe(e,t))}function Ae(e){let t,n;typeof e==`function`?(t=e,n=()=>{throw Error(`Computed value is readonly`)}):(t=e.get,n=e.set);let r,i=!0,a,o={get value(){return i&&=(r=a(),!1),S(o,`value`),r},set value(e){n(e)}};return we(o),a=b(t,{lazy:!0,scheduler:()=>{i||(i=!0,C(o,`value`))}}),o}function je(e){if(J(e)){let t=e;return we({get value(){return t.value},set value(e){throw Error(`Cannot assign to a readonly ref`)}})}return I(e)?new Proxy(e,{set(){throw Error(`Cannot set property on readonly object`)},deleteProperty(){throw Error(`Cannot delete property on readonly object`)},defineProperty(){throw Error(`Cannot define property on readonly object`)},get(e,t,n){return Reflect.get(e,t,n)}}):e}function Me(e,t){return ke((t,n)=>({get(){return t(),e},set(t){Object.is(e,t)||(e=t,n())}}),t)}function Ne(e){return J(e)&&typeof e.value!=`function`}function Pe(e){if(J(e)){let t=e.dep;if(t){ae(t);return}e.value=e.value}}function Fe(e){W(e)||console.warn(`toRefs() expects a reactive object but received a plain one.`);let t=Array.isArray(e)?Array.from({length:e.length}):{};for(let n in e)t[n]=Ie(e,n);return t}function Ie(e,t,n){let r=e[t];return J(r)?r:ke((n,r)=>({get(){return n(),e[t]},set(n){e[t]=n,r()}}),n)}function Le(e,t=new Set){if(!I(e)||t.has(e))return e;for(let n in t.add(e),e)Le(e[n],t);return e}let Re=`version`;function ze(e){Re=e}function Be(){return Re}function Ve(e,t,n={}){let r,i=W(e);if(typeof e==`function`)r=e;else if(J(e))r=()=>e.value;else if(i)r=()=>e;else throw Error(`Invalid watch source`);if(n.deep??i){let e=r;r=()=>{let t=e();return Re===`version`&&W(t)?(_e(t),t):Le(t)}}let o,s=e=>{o=e},c,l,u=()=>{if(!l.active)return;let e=l();o?.(),t(e,c,s),c=e};l=b(()=>r(),{scheduler:()=>a(u),lazy:!0}),n.immediate?u():c=l();let d=()=>{o?.(),o=void 0,x(l)};return v(d),d}function He(e){let t,n=e=>{t=e},r,i=()=>{r.active&&r()};r=b(()=>{t?.(),t=void 0,e(n)},{lazy:!0,scheduler:()=>a(i)}),r();let o=()=>{t?.(),t=void 0,x(r)};return v(o),o}function Ue(e){return e?e.charAt(0).toUpperCase()+e.slice(1):``}function We(e){return e?e.split(`.`).map(e=>e.trim()).filter(Boolean):[]}function Ge(e,t,n){let r=e[t];if(!r)throw Error(`Computed property "${t}" is readonly`);r(n)}function Ke(e){if(e==null)return e;if(typeof e==`object`){if(`detail`in e&&e.detail&&`value`in e.detail)return e.detail.value;if(`target`in e&&e.target&&`value`in e.target)return e.target.value}return e}function qe(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];(r[n]==null||typeof r[n]!=`object`)&&(r[n]={}),r=r[n]}r[t[t.length-1]]=n}function Je(e,t,n,r,i){if(!r.length)return;let[a,...o]=r;if(!o.length){if(t[a])Ge(n,a,i);else{let t=e[a];J(t)?t.value=i:e[a]=i}return}if(t[a]){Ge(n,a,i);return}(e[a]==null||typeof e[a]!=`object`)&&(e[a]={}),qe(e[a],o,i)}function Ye(e,t){return t.reduce((e,t)=>e==null?e:e[t],e)}function Xe(e){return Ke(e)}function Ze(e,t,n,r){return(i,a)=>{let o=We(i);if(!o.length)throw Error(`bindModel requires a non-empty path`);let s=()=>Ye(e,o),c=e=>{Je(t,n,r,o,e)},l={event:`input`,valueProp:`value`,parser:Xe,formatter:e=>e,...a};return{get value(){return s()},set value(e){c(e)},update(e){c(e)},model(e){let t={...l,...e},n=`on${Ue(t.event)}`,r={[t.valueProp]:t.formatter(s())};return r[n]=e=>{c(t.parser(e))},r}}}}const Qe=`__wevuDefaultsScope`;let $e={};function et(e){$e=it($e,e)}function tt(){$e={}}function nt(e){return at($e.app,e)}function rt(e){return at($e.component,e)}function it(e,t){return{app:ot(e.app,t.app),component:ot(e.component,t.component)}}function at(e,t){return ot(e,t)}function ot(e,t){if(!e)return t;if(!t)return e;let n={...e,...t},r=st(e.setData),i=st(t.setData);(r||i)&&(n.setData={...r??{},...i??{}});let a=st(e.options),o=st(t.options);return(a||o)&&(n.options={...a??{},...o??{}}),n}function st(e){if(!(!e||typeof e!=`object`||Array.isArray(e)))return e}const ct=Symbol(`wevu.noSetData`);function lt(e){return Object.defineProperty(e,ct,{value:!0,configurable:!0,enumerable:!1,writable:!1}),e}function ut(e){return typeof e==`object`&&!!e&&e[ct]===!0}function dt(e){if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function Y(e,t=new WeakMap,n){let r=De(e);if(typeof r==`bigint`){let e=Number(r);return Number.isSafeInteger(e)?e:r.toString()}if(typeof r==`symbol`)return r.toString();if(typeof r==`function`)return;if(typeof r!=`object`||!r)return r;if(ut(r))return;let i=W(r)?G(r):r,a=n?._depth??(typeof n?.maxDepth==`number`?Math.max(0,Math.floor(n.maxDepth)):1/0),o=n?._budget??(typeof n?.maxKeys==`number`?{keys:Math.max(0,Math.floor(n.maxKeys))}:{keys:1/0});if(a<=0||o.keys<=0)return i;let s=n?.cache;if(s){let e=N(i),t=s.get(i);if(t&&t.version===e)return t.value}if(t.has(i))return t.get(i);if(i instanceof Date)return i.getTime();if(i instanceof RegExp)return i.toString();if(i instanceof Map){let e=[];return t.set(i,e),i.forEach((n,r)=>{e.push([Y(r,t),Y(n,t)])}),e}if(i instanceof Set){let e=[];return t.set(i,e),i.forEach(n=>{e.push(Y(n,t))}),e}if(typeof ArrayBuffer<`u`){if(i instanceof ArrayBuffer)return i.byteLength;if(ArrayBuffer.isView(i)){let e=i;if(typeof e[Symbol.iterator]==`function`){let n=Array.from(e);return t.set(i,n),n.map(e=>Y(e,t))}let n=Array.from(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));return t.set(i,n),n}}if(i instanceof Error)return{name:i.name,message:i.message};if(Array.isArray(i)){let e=[];return t.set(i,e),i.forEach((r,i)=>{let s=Y(r,t,{...n,_depth:a-1,_budget:o});e[i]=s===void 0?null:s}),s&&s.set(i,{version:N(i),value:e}),e}let c={};return t.set(i,c),Object.keys(i).forEach(e=>{if(--o.keys,o.keys<=0)return;let r=Y(i[e],t,{...n,_depth:a-1,_budget:o});r!==void 0&&(c[e]=r)}),s&&s.set(i,{version:N(i),value:c}),c}function ft(e,t){return Object.is(e,t)?!0:Array.isArray(e)&&Array.isArray(t)?pt(e,t):dt(e)&&dt(t)?mt(e,t):!1}function pt(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!ft(e[n],t[n]))return!1;return!0}function mt(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!ft(e[r],t[r]))return!1;return!0}function ht(e){return e===void 0?null:e}function gt(e,t,n,r){if(!ft(e,t)){if(dt(e)&&dt(t)){for(let i of Object.keys(t)){if(!Object.prototype.hasOwnProperty.call(e,i)){r[`${n}.${i}`]=ht(t[i]);continue}gt(e[i],t[i],`${n}.${i}`,r)}for(let i of Object.keys(e))Object.prototype.hasOwnProperty.call(t,i)||(r[`${n}.${i}`]=null);return}if(Array.isArray(e)&&Array.isArray(t)){pt(e,t)||(r[n]=ht(t));return}r[n]=ht(t)}}function _t(e,t){let n={};for(let r of Object.keys(t))gt(e[r],t[r],r,n);for(let r of Object.keys(e))Object.prototype.hasOwnProperty.call(t,r)||(n[r]=null);return n}let vt,yt;function bt(){return vt}function xt(e){vt=e}function St(){return yt}function Ct(e){yt=e}function X(e){if(!vt)throw Error(`${e}() must be called synchronously inside setup()`);return vt}function wt(e){return e.__wevuHooks||=Object.create(null),e.__wevuHooks}function Z(e,t,n,{single:r=!1}={}){let i=wt(e);r?i[t]=n:(i[t]??(i[t]=[])).push(n)}function Q(e,t,n=[]){let r=e.__wevuHooks;if(!r)return;let i=r[t];if(!i)return;let a=e.__wevu?.proxy??e;if(Array.isArray(i))for(let e of i)try{e.apply(a,n)}catch{}else if(typeof i==`function`)try{i.apply(a,n)}catch{}}function Tt(e,t,n=[]){let r=e.__wevuHooks;if(!r)return;let i=r[t];if(!i)return;let a=e.__wevu?.proxy??e;if(typeof i==`function`)try{return i.apply(a,n)}catch{return}if(Array.isArray(i)){let e;for(let t of i)try{e=t.apply(a,n)}catch{}return e}}function Et(e){Z(X(`onLaunch`),`onLaunch`,e)}function Dt(e){Z(X(`onPageNotFound`),`onPageNotFound`,e)}function Ot(e){Z(X(`onUnhandledRejection`),`onUnhandledRejection`,e)}function kt(e){Z(X(`onThemeChange`),`onThemeChange`,e)}function At(e){Z(X(`onShow`),`onShow`,e)}function jt(e){Z(X(`onLoad`),`onLoad`,e)}function Mt(e){Z(X(`onHide`),`onHide`,e)}function Nt(e){Z(X(`onUnload`),`onUnload`,e)}function Pt(e){Z(X(`onReady`),`onReady`,e)}function Ft(e){Z(X(`onPullDownRefresh`),`onPullDownRefresh`,e)}function It(e){Z(X(`onReachBottom`),`onReachBottom`,e)}function Lt(e){Z(X(`onPageScroll`),`onPageScroll`,e)}function Rt(e){Z(X(`onRouteDone`),`onRouteDone`,e)}function zt(e){Z(X(`onTabItemTap`),`onTabItemTap`,e)}function Bt(e){Z(X(`onResize`),`onResize`,e)}function Vt(e){Z(X(`onMoved`),`onMoved`,e)}function Ht(e){Z(X(`onError`),`onError`,e)}function Ut(e){Z(X(`onSaveExitState`),`onSaveExitState`,e,{single:!0})}function Wt(e){Z(X(`onShareAppMessage`),`onShareAppMessage`,e,{single:!0})}function Gt(e){Z(X(`onShareTimeline`),`onShareTimeline`,e,{single:!0})}function Kt(e){Z(X(`onAddToFavorites`),`onAddToFavorites`,e,{single:!0})}function qt(e){Z(X(`onMounted`),`onReady`,e)}function Jt(e){Z(X(`onUpdated`),`__wevuOnUpdated`,e)}function Yt(e){X(`onBeforeUnmount`),e()}function Xt(e){Z(X(`onUnmounted`),`onUnload`,e)}function Zt(e){X(`onBeforeMount`),e()}function Qt(e){Z(X(`onBeforeUpdate`),`__wevuOnBeforeUpdate`,e)}function $t(e){let t=X(`onErrorCaptured`);Z(t,`onError`,n=>e(n,t,``))}function en(e){Z(X(`onActivated`),`onShow`,e)}function tn(e){Z(X(`onDeactivated`),`onHide`,e)}function nn(e){X(`onServerPrefetch`)}function rn(e,t){Q(e,t===`before`?`__wevuOnBeforeUpdate`:`__wevuOnUpdated`)}const $=new Map;let an=0;function on(){return an+=1,`wv${an}`}function sn(e,t,n){let r=$.get(e)??{snapshot:{},proxy:n,subscribers:new Set};if(r.snapshot=t,r.proxy=n,$.set(e,r),r.subscribers.size)for(let e of r.subscribers)try{e(t,n)}catch{}}function cn(e){$.delete(e)}function ln(e,t){let n=$.get(e)??{snapshot:{},proxy:void 0,subscribers:new Set};return n.subscribers.add(t),$.set(e,n),()=>{let n=$.get(e);n&&n.subscribers.delete(t)}}function un(e){return $.get(e)?.proxy}function dn(e){return $.get(e)?.snapshot}function fn(e,t,n){try{t.state.__wvOwnerId=n}catch{}try{e.__wvOwnerId=n}catch{}let r=typeof t.snapshot==`function`?t.snapshot():{},i=e.__wevuProps??e.properties;if(i&&typeof i==`object`)for(let[e,t]of Object.entries(i))r[e]=t;sn(n,r,t.proxy)}function pn(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/'/g,`'`).replace(/</g,`<`).replace(/>/g,`>`)}function mn(e,t,n){let r=typeof t==`string`?t:void 0;if(!r)return;let i=(n?.currentTarget)?.dataset?.wvArgs??(n?.target)?.dataset?.wvArgs,a=[];if(typeof i==`string`)try{a=JSON.parse(i)}catch{try{a=JSON.parse(pn(i))}catch{a=[]}}Array.isArray(a)||(a=[]);let o=a.map(e=>e===`$event`?n:e),s=e?.[r];if(typeof s==`function`)return s.apply(e,o)}function hn(e){let t=e.__wevu,n=e.__wvOwnerId;if(!t||!n||typeof t.snapshot!=`function`)return;let r=t.snapshot(),i=e.__wevuProps??e.properties;if(i&&typeof i==`object`)for(let[e,t]of Object.entries(i))r[e]=t;sn(n,r,t.proxy)}function gn(e,t,n){if(typeof e!=`function`)return;let r=n?.runtime??{methods:Object.create(null),state:{},proxy:{},watch:()=>()=>{},bindModel:()=>{}};n&&(n.runtime=r);let i={...n??{},runtime:r};return e.length>=2?e(t,i):e(i)}function _n(e,t,n){if(typeof e==`function`)return{handler:e.bind(t.proxy),options:{}};if(typeof e==`string`){let r=t.methods?.[e]??n[e];return typeof r==`function`?{handler:r.bind(t.proxy),options:{}}:void 0}if(!e||typeof e!=`object`)return;let r=_n(e.handler,t,n);if(!r)return;let i={...r.options};return e.immediate!==void 0&&(i.immediate=e.immediate),e.deep!==void 0&&(i.deep=e.deep),{handler:r.handler,options:i}}function vn(e,t){let n=t.split(`.`).map(e=>e.trim()).filter(Boolean);return n.length?()=>{let t=e;for(let e of n){if(t==null)return t;t=t[e]}return t}:()=>e}function yn(e,t,n){let r=[],i=e.proxy;for(let[a,o]of Object.entries(t)){let t=_n(o,e,n);if(!t)continue;let s=vn(i,a),c=e.watch(s,t.handler,t.options);r.push(c)}return r}function bn(e,t,n,r,i){if(e.__wevu)return e.__wevu;let a=on(),o=i?.deferSetData?(e=>{let t,n=!1,r={setData(r){if(!n){t={...t??{},...r};return}if(typeof e.setData==`function`)return e.setData(r)}};return r.__wevu_enableSetData=()=>{if(n=!0,t&&Object.keys(t).length&&typeof e.setData==`function`){let n=t;t=void 0,e.setData(n)}},r})(e):{setData(t){if(typeof e.setData==`function`)return e.setData(t)}},s,c=()=>{if(!s||typeof s.snapshot!=`function`)return;let t=s.snapshot(),n=e.__wevuProps??e.properties;if(n&&typeof n==`object`)for(let[e,r]of Object.entries(n))t[e]=r;sn(a,t,s.proxy)},l={...o,setData(e){let t=o.setData(e);return c(),t}},u=t.mount({...l});s=u;let d=u?.proxy??{},f=u?.state??{};if(!u?.methods)try{u.methods=Object.create(null)}catch{}let p=u?.methods??Object.create(null),m=u?.watch??(()=>()=>{}),h=u?.bindModel??(()=>{}),g={...u??{},state:f,proxy:d,methods:p,watch:m,bindModel:h};if(Object.defineProperty(e,`$wevu`,{value:g,configurable:!0,enumerable:!1,writable:!1}),e.__wevu=g,fn(e,g,a),n){let t=yn(g,n,e);t.length&&(e.__wevuWatchStops=t)}if(r){let t=ye({...e.properties||{}});try{Object.defineProperty(e,`__wevuProps`,{value:t,configurable:!0,enumerable:!1,writable:!1})}catch{e.__wevuProps=t}let n={props:t,runtime:g,state:f,proxy:d,bindModel:h.bind(g),watch:m.bind(g),instance:e,emit:(t,n,r)=>{typeof e.triggerEvent==`function`&&e.triggerEvent(t,n,r)},expose:t=>{e.__wevuExposed=t},attrs:{},slots:Object.create(null)};xt(e),Ct(n);try{let e=gn(r,t,n);e&&typeof e==`object`&&Object.keys(e).forEach(t=>{let n=e[t];typeof n==`function`?u.methods[t]=(...e)=>n.apply(u.proxy,e):u.state[t]=n})}finally{Ct(void 0),xt(void 0)}}try{let t=u.methods;for(let n of Object.keys(t))typeof e[n]!=`function`&&(e[n]=function(...e){let t=this.$wevu?.methods?.[n];if(typeof t==`function`)return t.apply(this.$wevu.proxy,e)})}catch{}return u}function xn(e){let t=e.__wevu?.adapter;t&&typeof t.__wevu_enableSetData==`function`&&t.__wevu_enableSetData()}function Sn(e){let t=e.__wevu,n=e.__wvOwnerId;n&&cn(n),t&&e.__wevuHooks&&Q(e,`onUnload`,[]),e.__wevuHooks&&=void 0;let r=e.__wevuWatchStops;if(Array.isArray(r))for(let e of r)try{e()}catch{}e.__wevuWatchStops=void 0,t&&t.unmount(),delete e.__wevu,`$wevu`in e&&delete e.$wevu}function Cn(e,t,n,r,i){if(typeof App!=`function`)throw TypeError(`createApp requires the global App constructor to be available`);let a=Object.keys(t??{}),o={...i};o.globalData=o.globalData??{},o.__weapp_vite_inline||=function(e){let t=e?.currentTarget?.dataset?.wvHandler??e?.target?.dataset?.wvHandler;return mn(this.__wevu?.proxy??this,t,e)};let s=o.onLaunch;o.onLaunch=function(...t){bn(this,e,n,r),Q(this,`onLaunch`,t),typeof s==`function`&&s.apply(this,t)};let c=o.onShow;o.onShow=function(...e){Q(this,`onShow`,e),typeof c==`function`&&c.apply(this,e)};let l=o.onHide;o.onHide=function(...e){Q(this,`onHide`,e),typeof l==`function`&&l.apply(this,e)};let u=o.onError;o.onError=function(...e){Q(this,`onError`,e),typeof u==`function`&&u.apply(this,e)};let d=o.onPageNotFound;o.onPageNotFound=function(...e){Q(this,`onPageNotFound`,e),typeof d==`function`&&d.apply(this,e)};let f=o.onUnhandledRejection;o.onUnhandledRejection=function(...e){Q(this,`onUnhandledRejection`,e),typeof f==`function`&&f.apply(this,e)};let p=o.onThemeChange;o.onThemeChange=function(...e){Q(this,`onThemeChange`,e),typeof p==`function`&&p.apply(this,e)};for(let e of a){let t=o[e];o[e]=function(...n){let r=this.__wevu,i,a=r?.methods?.[e];return a&&(i=a.apply(r.proxy,n)),typeof t==`function`?t.apply(this,n):i}}App(o)}function wn(e,t,n,r,i){let{methods:a={},lifetimes:o={},pageLifetimes:s={},options:c={},...l}=i,u=l.onLoad,d=l.onUnload,f=l.onShow,p=l.onHide,m=l.onReady,h=l.onSaveExitState,g=l.onPullDownRefresh,_=l.onReachBottom,ee=l.onPageScroll,te=l.onRouteDone,v=l.onTabItemTap,ne=l.onResize,y=l.onShareAppMessage,re=l.onShareTimeline,b=l.onAddToFavorites,x=l.features??{},S={...l},C=S.observers,ie=S.created;delete S.features,delete S.created,delete S.onLoad,delete S.onUnload,delete S.onShow,delete S.onHide,delete S.onReady;let ae=typeof g==`function`||!!x.enableOnPullDownRefresh,oe=typeof _==`function`||!!x.enableOnReachBottom,se=typeof ee==`function`||!!x.enableOnPageScroll,ce=typeof te==`function`||!!x.enableOnRouteDone,w=typeof v==`function`||!!x.enableOnTabItemTap,T=typeof ne==`function`||!!x.enableOnResize,E=typeof y==`function`||!!x.enableOnShareAppMessage,D=typeof re==`function`||!!x.enableOnShareTimeline,O=typeof b==`function`||!!x.enableOnAddToFavorites,k=typeof h==`function`||!!x.enableOnSaveExitState,A=()=>{},le=()=>({}),j=()=>({}),M=typeof h==`function`?h:(()=>({data:void 0})),N=typeof g==`function`?g:A,ue=typeof _==`function`?_:A,P=typeof ee==`function`?ee:A,de=typeof te==`function`?te:A,fe=typeof v==`function`?v:A,F=typeof ne==`function`?ne:A,I=typeof y==`function`?y:le,L=typeof re==`function`?re:j,R=typeof b==`function`?b:(()=>({})),z=(e,t)=>{let n=e.__wevuHooks;if(!n)return!1;let r=n[t];return r?Array.isArray(r)?r.length>0:typeof r==`function`:!1};{let e=S.export;S.export=function(){let t=this.__wevuExposed??{},n=typeof e==`function`?e.call(this):{};return n&&typeof n==`object`&&!Array.isArray(n)?{...t,...n}:n??t}}let pe={multipleSlots:c.multipleSlots??!0,...c},B=e=>{let t=e.__wevuProps,n=e.properties;if(!t||typeof t!=`object`||!n||typeof n!=`object`)return;let r=n,i=Object.keys(t);for(let e of i)if(!Object.prototype.hasOwnProperty.call(r,e))try{delete t[e]}catch{}for(let[e,n]of Object.entries(r))try{t[e]=n}catch{}hn(e)},me=(e,t,n)=>{let r=e.__wevuProps;if(!(!r||typeof r!=`object`)){try{r[t]=n}catch{}hn(e)}},V=S.properties&&typeof S.properties==`object`?Object.keys(S.properties):[],H={};if(V.length)for(let e of V)H[e]=function(t){me(this,e,t)};let U={...C??{}};for(let[e,t]of Object.entries(H)){let n=U[e];typeof n==`function`?U[e]=function(...e){n.apply(this,e),t.apply(this,e)}:U[e]=t}let W={...a};W.__weapp_vite_inline||=function(e){let t=e?.currentTarget?.dataset?.wvHandler??e?.target?.dataset?.wvHandler;return mn(this.__wevu?.proxy??this,t,e)},W.__weapp_vite_model||=function(e){let t=e?.currentTarget?.dataset?.wvModel??e?.target?.dataset?.wvModel;if(typeof t!=`string`||!t)return;let n=this.__wevu;if(!n||typeof n.bindModel!=`function`)return;let r=Ke(e);try{n.bindModel(t).update(r)}catch{}},!W.__weapp_vite_owner&&typeof t?.__weapp_vite_owner==`function`&&(W.__weapp_vite_owner=t.__weapp_vite_owner);let G=Object.keys(t??{});for(let e of G){let t=W[e];W[e]=function(...n){let r=this.__wevu,i,a=r?.methods?.[e];return a&&(i=a.apply(r.proxy,n)),typeof t==`function`?t.apply(this,n):i}}let K={onLoad(...t){if(bn(this,e,n,r),xn(this),Q(this,`onLoad`,t),typeof u==`function`)return u.apply(this,t)},onUnload(...e){if(Sn(this),typeof d==`function`)return d.apply(this,e)},onShow(...e){if(Q(this,`onShow`,e),typeof f==`function`)return f.apply(this,e)},onHide(...e){if(Q(this,`onHide`,e),typeof p==`function`)return p.apply(this,e)},onReady(...e){if(this.__wevuReadyCalled||(this.__wevuReadyCalled=!0,Q(this,`onReady`,e)),typeof m==`function`)return m.apply(this,e)}};k&&(K.onSaveExitState=function(...e){let t=Tt(this,`onSaveExitState`,e);return t===void 0?M.apply(this,e):t}),ae&&(K.onPullDownRefresh=function(...e){if(Q(this,`onPullDownRefresh`,e),!z(this,`onPullDownRefresh`))return N.apply(this,e)}),oe&&(K.onReachBottom=function(...e){if(Q(this,`onReachBottom`,e),!z(this,`onReachBottom`))return ue.apply(this,e)}),se&&(K.onPageScroll=function(...e){if(Q(this,`onPageScroll`,e),!z(this,`onPageScroll`))return P.apply(this,e)}),ce&&(K.onRouteDone=function(...e){if(Q(this,`onRouteDone`,e),!z(this,`onRouteDone`))return de.apply(this,e)}),w&&(K.onTabItemTap=function(...e){if(Q(this,`onTabItemTap`,e),!z(this,`onTabItemTap`))return fe.apply(this,e)}),T&&(K.onResize=function(...e){if(Q(this,`onResize`,e),!z(this,`onResize`))return F.apply(this,e)}),E&&(K.onShareAppMessage=function(...e){let t=Tt(this,`onShareAppMessage`,e);return t===void 0?I.apply(this,e):t}),D&&(K.onShareTimeline=function(...e){let t=Tt(this,`onShareTimeline`,e);return t===void 0?L.apply(this,e):t}),O&&(K.onAddToFavorites=function(...e){let t=Tt(this,`onAddToFavorites`,e);return t===void 0?R.apply(this,e):t}),Component({...S,...K,observers:U,lifetimes:{...o,created:function(...t){bn(this,e,n,r,{deferSetData:!0}),B(this),typeof ie==`function`&&ie.apply(this,t),typeof o.created==`function`&&o.created.apply(this,t)},moved:function(...e){Q(this,`onMoved`,e),typeof o.moved==`function`&&o.moved.apply(this,e)},attached:function(...t){bn(this,e,n,r),B(this),xn(this),typeof o.attached==`function`&&o.attached.apply(this,t)},ready:function(...e){this.__wevuReadyCalled||(this.__wevuReadyCalled=!0,B(this),Q(this,`onReady`,e)),typeof o.ready==`function`&&o.ready.apply(this,e)},detached:function(...e){Sn(this),typeof o.detached==`function`&&o.detached.apply(this,e)},error:function(...e){Q(this,`onError`,e),typeof o.error==`function`&&o.error.apply(this,e)}},pageLifetimes:{...s,show:function(...e){Q(this,`onShow`,e),typeof s.show==`function`&&s.show.apply(this,e)},hide:function(...e){Q(this,`onHide`,e),typeof s.hide==`function`&&s.hide.apply(this,e)},resize:function(...e){Q(this,`onResize`,e),typeof s.resize==`function`&&s.resize.apply(this,e)}},methods:W,options:pe})}function Tn(e){let{[Qe]:t,data:n,computed:r,methods:i,setData:o,watch:s,setup:c,...l}=e[Qe]===`component`?e:nt(e),u=i??{},d=r??{},f=new Set,p={globalProperties:{}},m={mount(e){let t=U((n??(()=>({})))()),r=d,i=u,s=Object.create(null),c=Object.create(null),l={},f=!0,m={},h=[],g=o?.includeComputed??!0,_=o?.strategy??`diff`,ee=typeof o?.maxPatchKeys==`number`?Math.max(0,o.maxPatchKeys):1/0,te=typeof o?.maxPayloadBytes==`number`?Math.max(0,o.maxPayloadBytes):1/0,v=typeof o?.mergeSiblingThreshold==`number`?Math.max(2,Math.floor(o.mergeSiblingThreshold)):0,ne=typeof o?.mergeSiblingMaxInflationRatio==`number`?Math.max(0,o.mergeSiblingMaxInflationRatio):1.25,y=typeof o?.mergeSiblingMaxParentBytes==`number`?Math.max(0,o.mergeSiblingMaxParentBytes):1/0,re=o?.mergeSiblingSkipArray??!0,ie=o?.computedCompare??(_===`patch`?`deep`:`reference`),ae=typeof o?.computedCompareMaxDepth==`number`?Math.max(0,Math.floor(o.computedCompareMaxDepth)):4,oe=typeof o?.computedCompareMaxKeys==`number`?Math.max(0,Math.floor(o.computedCompareMaxKeys)):200,se=o?.prelinkMaxDepth,ce=o?.prelinkMaxKeys,w=o?.debug,T=o?.debugWhen??`fallback`,E=typeof o?.debugSampleRate==`number`?Math.min(1,Math.max(0,o.debugSampleRate)):1,D=typeof o?.elevateTopKeyThreshold==`number`?Math.max(0,Math.floor(o.elevateTopKeyThreshold)):1/0,O=typeof o?.toPlainMaxDepth==`number`?Math.max(0,Math.floor(o.toPlainMaxDepth)):1/0,k=typeof o?.toPlainMaxKeys==`number`?Math.max(0,Math.floor(o.toPlainMaxKeys)):1/0,A=Array.isArray(o?.pick)&&o.pick.length>0?new Set(o.pick):void 0,le=Array.isArray(o?.omit)&&o.omit.length>0?new Set(o.omit):void 0,j=e=>!(A&&!A.has(e)||le&&le.has(e)),M=new Set,N=(e,t,n)=>{let r,i=!0,a,o={get value(){return i&&=(r=a(),!1),S(o,`value`),r},set value(e){if(!n)throw Error(`Computed value is readonly`);n(e)}};return we(o),a=b(t,{lazy:!0,scheduler:()=>{i||(i=!0,_===`patch`&&g&&M.add(e),C(o,`value`))}}),o},ue=new Proxy({},{get(e,t){if(typeof t==`string`&&s[t])return s[t].value},has(e,t){return typeof t==`string`&&!!s[t]},ownKeys(){return Object.keys(s)},getOwnPropertyDescriptor(e,t){if(typeof t==`string`&&s[t])return{configurable:!0,enumerable:!0,value:s[t].value}}}),P=new Proxy(t,{get(e,n,r){if(typeof n==`string`){if(n===`$state`)return t;if(n===`$computed`)return ue;if(Object.prototype.hasOwnProperty.call(l,n))return l[n];if(s[n])return s[n].value;if(Object.prototype.hasOwnProperty.call(p.globalProperties,n))return p.globalProperties[n]}return Reflect.get(e,n,r)},set(e,t,n,r){return typeof t==`string`&&s[t]?(Ge(c,t,n),!0):Reflect.set(e,t,n,r)},has(e,t){return typeof t==`string`&&(s[t]||Object.prototype.hasOwnProperty.call(l,t))?!0:Reflect.has(e,t)},ownKeys(e){let t=new Set;return Reflect.ownKeys(e).forEach(e=>{t.add(e)}),Object.keys(l).forEach(e=>t.add(e)),Object.keys(s).forEach(e=>t.add(e)),Array.from(t)},getOwnPropertyDescriptor(e,t){if(Reflect.has(e,t))return Object.getOwnPropertyDescriptor(e,t);if(typeof t==`string`){if(s[t])return{configurable:!0,enumerable:!0,get(){return s[t].value},set(e){Ge(c,t,e)}};if(Object.prototype.hasOwnProperty.call(l,t))return{configurable:!0,enumerable:!1,value:l[t]}}}});Object.keys(i).forEach(e=>{let t=i[e];typeof t==`function`&&(l[e]=(...e)=>t.apply(P,e))}),Object.keys(r).forEach(e=>{let t=r[e];if(typeof t==`function`)s[e]=N(e,()=>t.call(P));else{let n=t.get?.bind(P);if(!n)throw Error(`Computed property "${e}" requires a getter`);let r=t.set?.bind(P);r?(c[e]=r,s[e]=N(e,n,r)):s[e]=N(e,n)}});let F=e??{setData:()=>{}},I=new WeakMap,L=e=>e===void 0?null:e,R=e=>{if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},z=(e,t)=>{if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Object.is(e[n],t[n]))return!1;return!0}if(R(e)&&R(t)){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}return!1},pe=(e,t,n,r)=>{if(Object.is(e,t))return!0;if(n<=0||r.keys<=0||typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!pe(e[i],t[i],n-1,r))return!1;return!0}if(!R(e)||!R(t))return!1;let i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(let a of i)if(--r.keys,r.keys<=0||!Object.prototype.hasOwnProperty.call(t,a)||!pe(e[a],t[a],n-1,r))return!1;return!0},B=(e,t,n,r)=>{let i=t.split(`.`).filter(Boolean);if(!i.length)return;let a=e;for(let e=0;e<i.length-1;e++){let t=i[e];(!Object.prototype.hasOwnProperty.call(a,t)||a[t]==null||typeof a[t]!=`object`)&&(a[t]=Object.create(null)),a=a[t]}let o=i[i.length-1];if(r===`delete`)try{delete a[o]}catch{a[o]=null}else a[o]=n},me=()=>{let e=new WeakMap,n=Object.create(null),r=Number.isFinite(k)?{keys:k}:void 0,i=W(t)?G(t):t,a=Object.keys(i),o=g?Object.keys(s):[];for(let t of a)j(t)&&(n[t]=Y(i[t],e,{cache:I,maxDepth:O,_budget:r}));for(let t of o)j(t)&&(n[t]=Y(s[t].value,e,{cache:I,maxDepth:O,_budget:r}));return n},V=_===`patch`,H=new Map,K=G(t),q=new Set,ve=e=>{if(!f||e.root!==K)return;if(!e.path){if(Array.isArray(e.fallbackTopKeys)&&e.fallbackTopKeys.length)for(let t of e.fallbackTopKeys)q.add(t);else V=!0;return}let t=e.path.split(`.`,1)[0];j(t)&&H.set(e.path,{kind:e.kind,op:e.op})},ye=Object.create(null),be=e=>{if(!w)return;let t=e.reason!==`patch`&&e.reason!==`diff`;if(!(T===`fallback`&&!t)&&!(E<1&&Math.random()>E))try{w(e)}catch{}},xe=(e=`diff`)=>{let t=me(),n=_t(m,t);if(m=t,V=!1,H.clear(),_===`patch`&&g){ye=Object.create(null);for(let e of Object.keys(s))j(e)&&(ye[e]=t[e]);M.clear()}if(Object.keys(n).length){if(typeof F.setData==`function`){let e=F.setData(n);e&&typeof e.then==`function`&&e.catch(()=>{})}be({mode:`diff`,reason:e,pendingPatchKeys:0,payloadKeys:Object.keys(n).length})}},Se,Ce=()=>{if(f)if(Se?.(),_===`patch`&&!V){if(H.size>ee){V=!0;let e=H.size;H.clear(),M.clear(),be({mode:`diff`,reason:`maxPatchKeys`,pendingPatchKeys:e,payloadKeys:0}),xe(`maxPatchKeys`);return}let e=new WeakMap,n=new Map,r=Object.create(null),i=Array.from(H.entries());if(Number.isFinite(D)&&D>0){let e=new Map;for(let[t]of i){let n=t.split(`.`,1)[0];e.set(n,(e.get(n)??0)+1)}for(let[t,n]of e)n>=D&&q.add(t)}let a=i.filter(([e])=>{for(let t of q)if(e===t||e.startsWith(`${t}.`))return!1;return!0}),o=new Map(a);H.clear();let c=e=>{let n=e.split(`.`).filter(Boolean),r=t;for(let e of n){if(r==null)return r;r=r[e]}return r},l=t=>{if(n.has(t))return n.get(t);let r=L(Y(c(t),e,{cache:I,maxDepth:O,maxKeys:k}));return n.set(t,r),r};if(q.size){for(let e of q)j(e)&&(r[e]=l(e),o.set(e,{kind:`property`,op:`set`}));q.clear()}for(let[e,t]of a){if((t.kind===`array`?`set`:t.op)===`delete`){r[e]=null;continue}r[e]=l(e)}let u=0;if(g&&M.size){let t=Object.create(null),n=Array.from(M);M.clear(),u=n.length;for(let r of n){if(!j(r))continue;let n=Y(s[r].value,e,{cache:I,maxDepth:O,maxKeys:k}),i=ye[r];(ie===`deep`?pe(i,n,ae,{keys:oe}):ie===`shallow`?z(i,n):Object.is(i,n))||(t[r]=L(n),ye[r]=n)}Object.assign(r,t)}let d=e=>{let t=Object.keys(e).sort();if(t.length<=1)return e;let n=Object.create(null),r=[];for(let i of t){for(;r.length;){let e=r[r.length-1];if(i.startsWith(e))break;r.pop()}r.length||(n[i]=e[i],r.push(`${i}.`))}return n},f=(e,t,n)=>{if(t<=0)return t+1;if(e===null)return 4;let r=typeof e;if(r===`string`)return 2+e.length;if(r===`number`)return Number.isFinite(e)?String(e).length:4;if(r===`boolean`)return e?4:5;if(r===`undefined`||r===`function`||r===`symbol`||r!==`object`||n.has(e))return 4;if(n.add(e),Array.isArray(e)){let r=2;for(let i=0;i<e.length;i++)if(i&&(r+=1),r+=f(e[i],t-r,n),r>t)return r;return r}let i=2;for(let[r,a]of Object.entries(e))if(i>2&&(i+=1),i+=2+r.length+1,i+=f(a,t-i,n),i>t)return i;return i},p=e=>{if(te===1/0)return{fallback:!1,estimatedBytes:void 0,bytes:void 0};let t=te,n=Object.keys(e).length,r=f(e,t+1,new WeakSet);if(r>t)return{fallback:!0,estimatedBytes:r,bytes:void 0};if(r>=t*.85&&n>2)try{let n=JSON.stringify(e).length;return{fallback:n>t,estimatedBytes:r,bytes:n}}catch{return{fallback:!1,estimatedBytes:r,bytes:void 0}}return{fallback:!1,estimatedBytes:r,bytes:void 0}},h=e=>{if(!v)return{out:e,merged:0};let t=Object.keys(e);if(t.length<v)return{out:e,merged:0};let n=new Map,r=new Set;for(let i of t){let t=o.get(i);if(!t)continue;if(e[i]===null||t.op===`delete`){let e=i.lastIndexOf(`.`);e>0&&r.add(i.slice(0,e));continue}let a=i.lastIndexOf(`.`);if(a<=0)continue;let s=i.slice(0,a),c=n.get(s)??[];c.push(i),n.set(s,c)}let i=Array.from(n.entries()).filter(([e,t])=>t.length>=v&&!r.has(e)).sort((e,t)=>t[0].split(`.`).length-e[0].split(`.`).length);if(!i.length)return{out:e,merged:0};let a=Object.create(null);Object.assign(a,e);let s=0,c=new WeakMap,u=e=>{if(e&&typeof e==`object`){let t=c.get(e);if(t!==void 0)return t;let n=f(e,1/0,new WeakSet);return c.set(e,n),n}return f(e,1/0,new WeakSet)},d=(e,t)=>2+e.length+1+u(t);for(let[e,t]of i){if(Object.prototype.hasOwnProperty.call(a,e))continue;let n=t.filter(e=>Object.prototype.hasOwnProperty.call(a,e));if(n.length<v)continue;let r=l(e);if(!(re&&Array.isArray(r))&&!(y!==1/0&&d(e,r)>y)){if(ne!==1/0){let t=0;for(let e of n)t+=d(e,a[e]);if(d(e,r)>t*ne)continue}a[e]=r;for(let e of n)delete a[e];s+=1}}return{out:a,merged:s}},_=d(r),b=0;if(v){let e=h(_);b=e.merged,_=d(e.out)}let x=p(_),S=x.fallback;if(be({mode:S?`diff`:`patch`,reason:S?`maxPayloadBytes`:`patch`,pendingPatchKeys:a.length,payloadKeys:Object.keys(_).length,mergedSiblingParents:b||void 0,computedDirtyKeys:u||void 0,estimatedBytes:x.estimatedBytes,bytes:x.bytes}),S){V=!0,H.clear(),M.clear(),xe(`maxPayloadBytes`);return}if(!Object.keys(_).length)return;for(let[e,t]of Object.entries(_)){let n=o.get(e);n?B(m,e,t,n.kind===`array`?`set`:n.op):B(m,e,t,`set`)}if(typeof F.setData==`function`){let e=F.setData(_);e&&typeof e.then==`function`&&e.catch(()=>{})}be({mode:`patch`,reason:`patch`,pendingPatchKeys:a.length,payloadKeys:Object.keys(_).length})}else xe(V?`needsFullSnapshot`:`diff`)};Se=b(()=>{_e(t),Object.keys(t).forEach(e=>{let n=t[e];J(n)?n.value:W(n)&&_e(n)})},{lazy:!0,scheduler:()=>a(Ce)}),Ce(),h.push(()=>x(Se)),_===`patch`&&(he(t,{shouldIncludeTopKey:j,maxDepth:se,maxKeys:ce}),de(ve),h.push(()=>fe(ve)),h.push(()=>ge(t)));function Te(e,t,n){let r=Ve(e,(e,n)=>t(e,n),n);return h.push(r),()=>{r();let e=h.indexOf(r);e>=0&&h.splice(e,1)}}return{get state(){return t},get proxy(){return P},get methods(){return l},get computed(){return ue},get adapter(){return F},bindModel:Ze(P,t,s,c),watch:Te,snapshot:()=>_===`patch`?me():{...m},unmount:()=>{f&&(f=!1,h.forEach(e=>{try{e()}catch{}}),h.length=0)}}},use(e,...t){if(!e||f.has(e))return m;if(f.add(e),typeof e==`function`)e(m,...t);else if(typeof e.install==`function`)e.install(m,...t);else throw TypeError(`A plugin must be a function or an object with an install method`);return m},config:p};if(typeof globalThis.App==`function`){let e=globalThis,t=e.__wxConfig!==void 0,n=`__wevuAppRegistered`;(!t||!e[n])&&(t&&(e[n]=!0),Cn(m,i??{},s,c,l))}return m}function En(e){Pn();let{data:t,computed:n,methods:r,setData:i,watch:a,setup:o,props:s,...c}=rt(e),l=Tn({data:t,computed:n,methods:r,setData:i,[Qe]:`component`}),u=e=>{let t=gn(o,e?.props??{},e);t&&Dn(e.runtime,e.instance,t)},d=Fn(c,s),f={data:t,computed:n,methods:r,setData:i,watch:a,setup:u,mpOptions:d};return wn(l,r??{},a,u,d),{__wevu_runtime:l,__wevu_options:f}}function Dn(e,t,n){let r=e?.methods??Object.create(null),i=e?.state??Object.create(null),a=W(i)?G(i):i;if(e&&!e.methods)try{e.methods=r}catch{}if(e&&!e.state)try{e.state=i}catch{}Object.keys(n).forEach(o=>{let s=n[o];if(typeof s==`function`)r[o]=(...t)=>s.apply(e?.proxy??e,t);else if(s===t||!kn(s))try{Object.defineProperty(a,o,{value:s,configurable:!0,enumerable:!1,writable:!0})}catch{i[o]=s}else i[o]=s}),e&&(e.methods=e.methods??r,e.state=e.state??i)}function On(e){if(Object.prototype.toString.call(e)!==`[object Object]`)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function kn(e){return typeof e!=`object`||!e||J(e)||W(e)||Array.isArray(e)?!0:On(e)}function An(e){Pn();let{properties:t,props:n,...r}=e;En(Fn(r,n,t))}function jn(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/'/g,`'`).replace(/</g,`<`).replace(/>/g,`>`)}function Mn(e){let t=e?.currentTarget?.dataset?.wvArgs??e?.target?.dataset?.wvArgs,n=[];if(typeof t==`string`)try{n=JSON.parse(t)}catch{try{n=JSON.parse(jn(t))}catch{n=[]}}return Array.isArray(n)||(n=[]),n.map(t=>t===`$event`?e:t)}function Nn(){let e=e=>{if(!e||typeof e!=`object`)return{};if(Array.isArray(e)){let t={};for(let n=0;n<e.length;n+=2){let r=e[n];typeof r==`string`&&r&&(t[r]=e[n+1])}return t}return e},t=(t,n)=>{let r=Object.prototype.hasOwnProperty.call(n??{},`__wvSlotScope`)?n.__wvSlotScope:t?.properties?.__wvSlotScope,i=Object.prototype.hasOwnProperty.call(n??{},`__wvSlotProps`)?n.__wvSlotProps:t?.properties?.__wvSlotProps,a=e(r),o=e(i),s={...a,...o};typeof t?.setData==`function`&&t.setData({__wvSlotPropsData:s})};An({properties:{__wvOwnerId:{type:String,value:``},__wvSlotProps:{type:null,value:null,observer(e){t(this,{__wvSlotProps:e})}},__wvSlotScope:{type:null,value:null,observer(e){t(this,{__wvSlotScope:e})}}},data:()=>({__wvOwner:{},__wvSlotPropsData:{}}),lifetimes:{attached(){let e=this.properties?.__wvOwnerId??``;if(t(this),!e)return;let n=(e,t)=>{this.__wvOwnerProxy=t,typeof this.setData==`function`&&this.setData({__wvOwner:e||{}})};this.__wvOwnerUnsub=ln(e,n);let r=dn(e);r&&n(r,un(e))},detached(){typeof this.__wvOwnerUnsub==`function`&&this.__wvOwnerUnsub(),this.__wvOwnerUnsub=void 0,this.__wvOwnerProxy=void 0}},methods:{__weapp_vite_owner(e){let t=e?.currentTarget?.dataset?.wvHandler??e?.target?.dataset?.wvHandler;if(typeof t!=`string`||!t)return;let n=this.__wvOwnerProxy,r=n?.[t];if(typeof r!=`function`)return;let i=Mn(e);return r.apply(n,i)}}})}Pn();function Pn(){let e=typeof globalThis<`u`?globalThis:void 0;if(!e)return;let t=e;t.__weapp_vite_createScopedSlotComponent||=Nn}function Fn(e,t,n){let r=e.properties,i=n??(r&&typeof r==`object`?r:void 0),a=e=>{let t={...e??{}};return Object.prototype.hasOwnProperty.call(t,`__wvSlotOwnerId`)||(t.__wvSlotOwnerId={type:String,value:``}),Object.prototype.hasOwnProperty.call(t,`__wvSlotScope`)||(t.__wvSlotScope={type:null,value:null}),t};if(i||!t){let{properties:t,...n}=e;return{...n,properties:a(i)}}let o={};return Object.entries(t).forEach(([e,t])=>{if(t!=null){if(Array.isArray(t)||typeof t==`function`){o[e]={type:t};return}if(typeof t==`object`){if(e.endsWith(`Modifiers`)&&Object.keys(t).length===0){o[e]={type:Object,value:{}};return}let n={};`type`in t&&t.type!==void 0&&(n.type=t.type);let r=`default`in t?t.default:t.value;r!==void 0&&(n.value=typeof r==`function`?r():r),o[e]=n}}}),{...e,properties:a(o)}}const In=Symbol(`wevu.provideScope`),Ln=new Map;function Rn(e,t){let n=bt();if(n){let r=n[In];r||(r=new Map,n[In]=r),r.set(e,t)}else Ln.set(e,t)}function zn(e,t){let n=bt();if(n){let t=n;for(;t;){let n=t[In];if(n&&n.has(e))return n.get(e);t=null}}if(Ln.has(e))return Ln.get(e);if(arguments.length>=2)return t;throw Error(`wevu.inject: no value found for key`)}function Bn(e,t){Ln.set(e,t)}function Vn(e,t){if(Ln.has(e))return Ln.get(e);if(arguments.length>=2)return t;throw Error(`injectGlobal() no matching provider for key: ${String(e)}`)}function Hn(){let e=St();if(!e)throw Error(`useAttrs() must be called synchronously inside setup()`);return e.attrs??{}}function Un(){let e=St();if(!e)throw Error(`useSlots() must be called synchronously inside setup()`);return e.slots??Object.create(null)}function Wn(e,t){let n=St();if(!n)throw Error(`useModel() must be called synchronously inside setup()`);let r=n.emit,i=`update:${t}`;return ke({get:()=>e?.[t],set:e=>{r?.(i,e)}})}function Gn(e,t){return e==null?t:t==null?e:Array.isArray(e)&&Array.isArray(t)?Array.from(new Set([...e,...t])):typeof e==`object`&&typeof t==`object`?{...e,...t}:t}function Kn(e,t,n,r){return function(...i){let a=[],o=[],s=e=>a.push(e),c=e=>o.push(e);r.forEach(n=>{try{n({name:t,store:e,args:i,after:s,onError:c})}catch{}});let l;try{l=n.apply(e,i)}catch(e){throw o.forEach(t=>t(e)),e}let u=e=>(a.forEach(t=>t(e)),e);return l&&typeof l.then==`function`?l.then(e=>u(e),e=>(o.forEach(t=>t(e)),Promise.reject(e))):u(l)}}function qn(e){return typeof e==`object`&&!!e}function Jn(e,t){for(let n in t)e[n]=t[n]}function Yn(e,t,n,r){let i={$id:e};Object.defineProperty(i,`$state`,{get(){return t},set(e){t&&qn(e)&&(Jn(t,e),n(`patch object`))}}),i.$patch=e=>{if(!t){typeof e==`function`?(e(i),n(`patch function`)):(Jn(i,e),n(`patch object`));return}typeof e==`function`?(e(t),n(`patch function`)):(Jn(t,e),n(`patch object`))},r&&(i.$reset=()=>r());let a=new Set;i.$subscribe=(e,t)=>(a.add(e),()=>a.delete(e));let o=new Set;return i.$onAction=e=>(o.add(e),()=>o.delete(e)),{api:i,subs:a,actionSubs:o}}function Xn(){let e={_stores:new Map,_plugins:[],install(e){},use(t){return typeof t==`function`&&e._plugins.push(t),e}};return Xn._instance=e,e}function Zn(e,t){let n,r=!1,i=Xn._instance;return function(){if(r&&n)return n;if(r=!0,typeof t==`function`){let r=t(),a=()=>{},o=Yn(e,void 0,e=>a(e));a=t=>{o.subs.forEach(r=>{try{r({type:t,storeId:e},n)}catch{}})},n=Object.assign({},r);for(let e of Object.getOwnPropertyNames(o.api)){let t=Object.getOwnPropertyDescriptor(o.api,e);t&&Object.defineProperty(n,e,t)}Object.keys(r).forEach(e=>{let t=r[e];typeof t==`function`&&!e.startsWith(`$`)&&(n[e]=Kn(n,e,t,o.actionSubs))});let s=i?._plugins??[];for(let e of s)try{e({store:n})}catch{}return n}let a=t,o=a.state?a.state():{},s=U(o),c={...G(o)},l=()=>{},u=Yn(e,s,e=>l(e),()=>{Jn(s,c),l(`patch object`)});l=t=>{u.subs.forEach(n=>{try{n({type:t,storeId:e},s)}catch{}})};let d={};for(let e of Object.getOwnPropertyNames(u.api)){let t=Object.getOwnPropertyDescriptor(u.api,e);t&&Object.defineProperty(d,e,t)}let f=a.getters??{},p={};Object.keys(f).forEach(e=>{let t=f[e];if(typeof t==`function`){let n=Ae(()=>t.call(d,s));p[e]=n,Object.defineProperty(d,e,{enumerable:!0,configurable:!0,get(){return n.value}})}});let m=a.actions??{};Object.keys(m).forEach(e=>{let t=m[e];typeof t==`function`&&(d[e]=Kn(d,e,(...e)=>t.apply(d,e),u.actionSubs))}),Object.keys(s).forEach(e=>{Object.defineProperty(d,e,{enumerable:!0,configurable:!0,get(){return s[e]},set(t){s[e]=t}})}),n=d;let h=i?._plugins??[];for(let e of h)try{e({store:n})}catch{}return n}}function Qn(e){let t={};for(let n in e){let r=e[n];if(typeof r==`function`){t[n]=r;continue}J(r)?t[n]=r:t[n]=Ae({get:()=>e[n],set:t=>{e[n]=t}})}return t}exports.addMutationRecorder=de,exports.batch=m,exports.callHookList=Q,exports.callHookReturn=Tt,exports.callUpdateHooks=rn,exports.computed=Ae,exports.createApp=Tn,exports.createStore=Xn,exports.createWevuComponent=An,exports.createWevuScopedSlotComponent=Nn,exports.defineComponent=En,exports.defineStore=Zn,exports.effect=b,exports.effectScope=ee,exports.endBatch=p,exports.getCurrentInstance=bt,exports.getCurrentScope=te,exports.getCurrentSetupContext=St,exports.getDeepWatchStrategy=Be,exports.getReactiveVersion=N,exports.inject=zn,exports.injectGlobal=Vn,exports.isNoSetData=ut,exports.isRaw=Se,exports.isReactive=W,exports.isRef=J,exports.isShallowReactive=be,exports.isShallowRef=Ne,exports.markNoSetData=lt,exports.markRaw=xe,exports.mergeModels=Gn,exports.mountRuntimeInstance=bn,exports.nextTick=o,exports.onActivated=en,exports.onAddToFavorites=Kt,exports.onBeforeMount=Zt,exports.onBeforeUnmount=Yt,exports.onBeforeUpdate=Qt,exports.onDeactivated=tn,exports.onError=Ht,exports.onErrorCaptured=$t,exports.onHide=Mt,exports.onLaunch=Et,exports.onLoad=jt,exports.onMounted=qt,exports.onMoved=Vt,exports.onPageNotFound=Dt,exports.onPageScroll=Lt,exports.onPullDownRefresh=Ft,exports.onReachBottom=It,exports.onReady=Pt,exports.onResize=Bt,exports.onRouteDone=Rt,exports.onSaveExitState=Ut,exports.onScopeDispose=v,exports.onServerPrefetch=nn,exports.onShareAppMessage=Wt,exports.onShareTimeline=Gt,exports.onShow=At,exports.onTabItemTap=zt,exports.onThemeChange=kt,exports.onUnhandledRejection=Ot,exports.onUnload=Nt,exports.onUnmounted=Xt,exports.onUpdated=Jt,exports.prelinkReactiveTree=he,exports.provide=Rn,exports.provideGlobal=Bn,exports.reactive=U,exports.readonly=je,exports.ref=Ee,exports.registerApp=Cn,exports.registerComponent=wn,exports.removeMutationRecorder=fe,exports.resetWevuDefaults=tt,exports.runSetupFunction=gn,exports.setCurrentInstance=xt,exports.setCurrentSetupContext=Ct,exports.setDeepWatchStrategy=ze,exports.setWevuDefaults=et,exports.shallowReactive=ye,exports.shallowRef=Me,exports.startBatch=f,exports.stop=x,exports.storeToRefs=Qn,exports.teardownRuntimeInstance=Sn,exports.toRaw=G,exports.toRef=Ie,exports.toRefs=Fe,exports.touchReactive=_e,exports.traverse=Le,exports.triggerRef=Pe,exports.unref=De,exports.useAttrs=Hn,exports.useModel=Wn,exports.useSlots=Un,exports.watch=Ve,exports.watchEffect=He;
|